Wednesday, January 29, 2014

ovs-ofctl OVS action commands for OpenFlow 1.3

Add flows to Open vSwitch (OVSK)
Modify VLAN ID on a packet.
mininet@mininet-vm104:~$ sudo ovs-ofctl -O OpenFlow13 add-flow s1 "dl_type=0x0800,metadata=12345,cookie=8,table=2,actions=mod_vlan_vid:101"
mininet@mininet-vm104:~$

To list flows added to vSwitch
mininet@mininet-vm104:~$ sudo ovs-ofctl -O OpenFlow13 dump-flows s1
OFPST_FLOW reply (OF1.3) (xid=0x2):
 cookie=0x8, duration=20.959s, table=2, n_packets=0, n_bytes=0, ip,metadata=0x3039 actions=mod_vlan_vid:101
mininet@mininet-vm104:~$

To delete flows
mininet@mininet-vm104:~$ sudo ovs-ofctl -O OpenFlow13 del-flows s1
mininet@mininet-vm104:~$ sudo ovs-ofctl -O OpenFlow13 dump-flows s1
OFPST_FLOW reply (OF1.3) (xid=0x2):
mininet@mininet-vm104:~$

Modify VLAN priority on a packet. Valid values are between 0 (lowest) and 7 (highest).
mininet@mininet-vm104:~$ sudo ovs-ofctl -O OpenFlow13 add-flow s1 "dl_type=0x0800,metadata=12345,cookie=8,table=2,priority=100,actions=mod_vlan_pcp:7"
mininet@mininet-vm104:~$
mininet@mininet-vm104:~$
mininet@mininet-vm104:~$ sudo ovs-ofctl -O OpenFlow13 dump-flows s1       
OFPST_FLOW reply (OF1.3) (xid=0x2):
 cookie=0x8, duration=4.512s, table=2, n_packets=0, n_bytes=0, priority=100,ip,metadata=0x3039 actions=mod_vlan_pcp:7
mininet@mininet-vm104:~$

mininet@mininet-vm104:~$ sudo ovs-ofctl -O OpenFlow13 add-flow s1 "dl_type=0x0800,metadata=12345,cookie=8,table=2,priority=100,actions=push_mpls:0x8847"
mininet@mininet-vm104:~$
mininet@mininet-vm104:~$
mininet@mininet-vm104:~$ sudo ovs-ofctl -O OpenFlow13 dump-flows s1       
OFPST_FLOW reply (OF1.3) (xid=0x2):
 cookie=0x8, duration=4.49s, table=2, n_packets=0, n_bytes=0, priority=100,ip,metadata=0x3039 actions=push_mpls:0x8847
mininet@mininet-vm104:~$

IPv4 ToS/DSCP must be a multiple of 4 between 0 and 255.
mininet@mininet-vm104:~$ sudo ovs-ofctl -O OpenFlow13 add-flow s1 "dl_type=0x0800,metadata=12345,cookie=8,table=2,priority=100,actions=mod_dl_src:11:11:11:11:11:11,mod_dl_dst:22:22:22:22:22:22,mod_nw_src=1.1.1.1,mod_nw_dst=2.2.2.2,mod_nw_tos:16"
mininet@mininet-vm104:~$

mininet@mininet-vm104:~$ sudo ovs-ofctl -O OpenFlow13 dump-flows s1       
OFPST_FLOW reply (OF1.3) (xid=0x2):
 cookie=0x8, duration=3.884s, table=2, n_packets=0, n_bytes=0, priority=100,ip,metadata=0x3039 actions=mod_dl_src:11:11:11:11:11:11,mod_dl_dst:22:22:22:22:22:22,mod_nw_src:1.1.1.1,mod_nw_dst:2.2.2.2,mod_nw_tos:16
mininet@mininet-vm104:~$

For manpage you can refer below link

No comments:

Post a Comment