Learning OVS (open vswitch) using mininet — Part 6

In previous post we have seen that how we can add the flows to switch manually. Actually in switch flows are getting added in table, by default the flows are getting added in “table 0” but while adding new flow we can mention the table as well. In this post I am going to show how to add flow in table 0 which pass the network traffic  to table 1 and then suitable action taken on the network traffic in table 1.  This thing can be cascaded in forward direction.

Purpose this post is to only show how to add flows manually by specifying the tables.

Step 1 : Once again created topology without any controller.

root@mininet-vm:~# mn –topo=single,4 –mac –controller=none
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2 h3 h4
*** Adding switches:
s1
*** Adding links:
(h1, s1) (h2, s1) (h3, s1) (h4, s1)
*** Configuring hosts
h1 h2 h3 h4
*** Starting controller

*** Starting 1 switches
s1 …
*** Starting CLI:

Step 2 : I added the basic flow without specifying the table value and this time I am checking the flow working using ovs-appctl command.

mininet> sh ovs-ofctl dump-flows s1
NXST_FLOW reply (xid=0x4):
mininet> sh ovs-ofctl add-flow s1 priority=1000,in_port=1,actions=output:2

mininet> sh ovs-ofctl dump-flows s1
NXST_FLOW reply (xid=0x4):
cookie=0x0, duration=2.023s, table=0, n_packets=0, n_bytes=0, idle_age=2, priority=1000,in_port=1 actions=output:2

mininet> sh ovs-appctl ofproto/trace s1 in_port=1
Flow: metadata=0,in_port=1,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=00:00:00:00:00:00,dl_type=0x0000
Rule: table=0 cookie=0 priority=1000,in_port=1
OpenFlow actions=output:2

Final flow: unchanged
Relevant fields: skb_priority=0,in_port=1,dl_type=0x0000,nw_frag=no
Datapath actions: 4

We can see that ovs-appctl is showing the detailed results that which flow rules is matching the ingress traffic here Flow is containing the keywords from input and Rule is matching flow which is applied on Flow and OpenFlow is the appropriate actioin taken on the ingress traffic.

Step 3 : I deleted the flow added in step 2 and added in new flow which will forward the traffic to table 1 here “resubmit(,1) is the keyword to forward the traffic to table 1.

mininet> sh ovs-ofctl del-flows s1
mininet> sh ovs-ofctl add-flow s1 “table=0,priority=1000,in_port=1,actions=resubmit(,1)”

Step 4 : I added new flow to forward the traffic to port 2 i.e veth pair connecting to h2 in my configuration again we can verify the same using ovs-appctl command.

mininet> sh ovs-ofctl add-flow s1 “table=1,priority=1000,actions=output:2”
mininet> sh ovs-ofctl dump-flows s1
NXST_FLOW reply (xid=0x4):
cookie=0x0, duration=159.275s, table=0, n_packets=0, n_bytes=0, idle_age=159, priority=1000,in_port=1 actions=resubmit(,1)
cookie=0x0, duration=3.471s, table=1, n_packets=0, n_bytes=0, idle_age=3, priority=1000 actions=output:2
mininet> sh ovs-appctl ofproto/trace s1 in_port=1
Flow: metadata=0,in_port=1,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=00:00:00:00:00:00,dl_type=0x0000
Rule: table=0 cookie=0 priority=1000,in_port=1
OpenFlow actions=resubmit(,1)

Resubmitted flow: unchanged
Resubmitted regs: reg0=0x0 reg1=0x0 reg2=0x0 reg3=0x0 reg4=0x0 reg5=0x0 reg6=0x0 reg7=0x0
Resubmitted  odp: drop
Rule: table=1 cookie=0 priority=1000
OpenFlow actions=output:2

Final flow: unchanged
Relevant fields: skb_priority=0,in_port=1,dl_type=0x0000,nw_frag=no
Datapath actions: 4

Advertisements

One thought on “Learning OVS (open vswitch) using mininet — Part 6

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s