X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tests%2Fofproto.at;h=e2e6f1b0ff69d53d25453cc77abac922fcbef890;hb=4b570f12766f3c4eeb527de69d8eedfd59c34b86;hp=a87f4b5fa189c62fa2c0bdccec1cbff4f57103cf;hpb=4816a18f33380a33d381b77d41df39113c94500d;p=sliver-openvswitch.git diff --git a/tests/ofproto.at b/tests/ofproto.at index a87f4b5fa..e2e6f1b0f 100644 --- a/tests/ofproto.at +++ b/tests/ofproto.at @@ -253,6 +253,28 @@ AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [OFPST_FLO OVS_VSWITCHD_STOP AT_CLEANUP +AT_SETUP([ofproto - basic flow_mod commands (OpenFlow 1.1)]) +OVS_VSWITCHD_START +AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1): +]) +AT_CHECK([echo 'in_port=2,actions=1' | ovs-ofctl -O OpenFlow11 add-flows br0 -]) +AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 in_port=1,actions=2]) +AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 table=1,in_port=4,actions=3]) +AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl + in_port=1 actions=output:2 + in_port=2 actions=output:1 + table=1, in_port=4 actions=output:3 +OFPST_FLOW reply (OF1.1): +]) +AT_CHECK([ovs-ofctl -O OpenFlow11 dump-aggregate br0 table=0 | STRIP_XIDS], [0], [dnl +OFPST_AGGREGATE reply (OF1.1): packet_count=0 byte_count=0 flow_count=2 +]) +AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0]) +AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip], [0], [OFPST_FLOW reply (OF1.1): +]) +OVS_VSWITCHD_STOP +AT_CLEANUP + AT_SETUP([ofproto - set-field flow_mod commands (NXM)]) OVS_VSWITCHD_START AT_CHECK([ovs-ofctl add-flow br0 ipv6,table=1,in_port=3,actions=drop]) @@ -339,8 +361,23 @@ NXST_FLOW reply: OVS_VSWITCHD_STOP AT_CLEANUP +AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.1)]) +OVS_VSWITCHD_START +AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1]) +AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl + cookie=0x1, in_port=1 actions=output:1 +OFPST_FLOW reply (OF1.1): +]) +AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x2,in_port=1,actions=1]) +AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl + cookie=0x1, in_port=1 actions=output:1 +OFPST_FLOW reply (OF1.1): +]) +OVS_VSWITCHD_STOP +AT_CLEANUP + dnl The OpenFlow 1.2 spec states that the cookie may not be modified -AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow1.2)]) +AT_SETUP([ofproto - no mod flow with cookie change (OpenFlow 1.2)]) OVS_VSWITCHD_START AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1]) AT_CHECK([ovs-ofctl -O OpenFlow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl @@ -378,6 +415,28 @@ NXST_FLOW reply: OVS_VSWITCHD_STOP AT_CLEANUP +AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.1)]) +OVS_VSWITCHD_START +AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1]) +AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=2,actions=1]) +AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=3,actions=1]) +AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl + cookie=0x1, in_port=1 actions=output:1 + cookie=0x1, in_port=2 actions=output:1 + cookie=0x2, in_port=3 actions=output:1 +OFPST_FLOW reply (OF1.1): +]) + +AT_CHECK([ovs-ofctl -O OpenFlow11 mod-flows br0 cookie=0x1/0xff,actions=4]) +AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl + cookie=0x1, in_port=1 actions=output:4 + cookie=0x1, in_port=2 actions=output:4 + cookie=0x2, in_port=3 actions=output:1 +OFPST_FLOW reply (OF1.1): +]) +OVS_VSWITCHD_STOP +AT_CLEANUP + AT_SETUP([ofproto - mod flows based on cookie mask (OpenFlow 1.2)]) OVS_VSWITCHD_START AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1]) @@ -423,7 +482,7 @@ NXST_FLOW reply: OVS_VSWITCHD_STOP AT_CLEANUP -AT_SETUP([ofproto - mod flow with cookie miss (mask==0)]) +AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - NXM]) OVS_VSWITCHD_START AT_CHECK([ovs-ofctl -F nxm mod-flows br0 in_port=1,actions=1]) AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl @@ -433,7 +492,26 @@ NXST_FLOW reply: OVS_VSWITCHD_STOP AT_CLEANUP -AT_SETUP([ofproto - mod flow with cookie miss (mask!=0)]) +AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.1]) +OVS_VSWITCHD_START +AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 in_port=1,actions=1]) +AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl + in_port=1 actions=output:1 +OFPST_FLOW reply (OF1.1): +]) +OVS_VSWITCHD_STOP +AT_CLEANUP + +AT_SETUP([ofproto - mod flow with cookie miss (mask==0) - OF1.2]) +OVS_VSWITCHD_START +AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 in_port=1,actions=1]) +AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl +OFPST_FLOW reply (OF1.2): +]) +OVS_VSWITCHD_STOP +AT_CLEANUP + +AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - NXM]) OVS_VSWITCHD_START AT_CHECK([ovs-ofctl -F nxm mod-flows br0 cookie=1/1,in_port=1,actions=1]) AT_CHECK([ovs-ofctl -F nxm dump-flows br0 | ofctl_strip | sort], [0], [dnl @@ -442,6 +520,24 @@ NXST_FLOW reply: OVS_VSWITCHD_STOP AT_CLEANUP +AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.1]) +OVS_VSWITCHD_START +AT_CHECK([ovs-ofctl -O openflow11 mod-flows br0 cookie=1/1,in_port=1,actions=1]) +AT_CHECK([ovs-ofctl -O openflow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl +OFPST_FLOW reply (OF1.1): +]) +OVS_VSWITCHD_STOP +AT_CLEANUP + +AT_SETUP([ofproto - mod flow with cookie miss (mask!=0) - OF1.2]) +OVS_VSWITCHD_START +AT_CHECK([ovs-ofctl -O openflow12 mod-flows br0 cookie=1/1,in_port=1,actions=1]) +AT_CHECK([ovs-ofctl -O openflow12 dump-flows br0 | ofctl_strip | sort], [0], [dnl +OFPST_FLOW reply (OF1.2): +]) +OVS_VSWITCHD_STOP +AT_CLEANUP + AT_SETUP([ofproto - del flows with cookies]) OVS_VSWITCHD_START AT_CHECK([ovs-ofctl add-flow br0 cookie=0x1,in_port=1,actions=1]) @@ -533,6 +629,38 @@ NXST_FLOW reply: OVS_VSWITCHD_STOP AT_CLEANUP +AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.1)]) +OVS_VSWITCHD_START +AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1]) +AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1]) +AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl + cookie=0x1, in_port=1 actions=output:1 + cookie=0x2, table=1, in_port=2 actions=output:1 +OFPST_FLOW reply (OF1.1): +]) +AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=0]) +AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl + cookie=0x2, table=1, in_port=2 actions=output:1 +OFPST_FLOW reply (OF1.1): +]) +AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0 table=1]) +AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl +OFPST_FLOW reply (OF1.1): +]) +AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x1,in_port=1,actions=1]) +AT_CHECK([ovs-ofctl -O OpenFlow11 add-flow br0 cookie=0x2,in_port=2,table=1,actions=1]) +AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl + cookie=0x1, in_port=1 actions=output:1 + cookie=0x2, table=1, in_port=2 actions=output:1 +OFPST_FLOW reply (OF1.1): +]) +AT_CHECK([ovs-ofctl -O OpenFlow11 del-flows br0]) +AT_CHECK([ovs-ofctl -O OpenFlow11 dump-flows br0 | ofctl_strip | sort], [0], [dnl +OFPST_FLOW reply (OF1.1): +]) +OVS_VSWITCHD_STOP +AT_CLEANUP + AT_SETUP([ofproto - del flows based on table id (OpenFlow 1.2)]) OVS_VSWITCHD_START AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 cookie=0x1,in_port=1,actions=1]) @@ -1359,6 +1487,7 @@ dnl controllers despite the spec) as meaning a packet that was generated dnl by the controller. AT_SETUP([ofproto - packet-out from controller (OpenFlow 1.0)]) OVS_VSWITCHD_START +ADD_OF_PORTS([br0], [1]) # Start a monitor listening for packet-ins. AT_CHECK([ovs-ofctl -P openflow10 monitor br0 --detach --no-chdir --pidfile]) @@ -1368,13 +1497,15 @@ ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log AT_CAPTURE_FILE([monitor.log]) # Send some packet-outs with OFPP_NONE and OFPP_CONTROLLER (65533) as in_port. -AT_CHECK([ovs-ofctl packet-out br0 none controller '0001020304050010203040501234']) -AT_CHECK([ovs-ofctl packet-out br0 controller controller '0001020304050010203040505678']) +AT_CHECK([ovs-ofctl packet-out br0 none controller,1 '0001020304050010203040501234']) +AT_CHECK([ovs-ofctl packet-out br0 controller controller,1 '0001020304050010203040505678']) # Stop the monitor and check its output. ovs-appctl -t ovs-ofctl ofctl/barrier ovs-appctl -t ovs-ofctl exit +ovs-ofctl dump-ports br0 + AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl OFPT_PACKET_IN: total_len=14 in_port=ANY (via action) data_len=14 (unbuffered) metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234 @@ -1475,6 +1606,33 @@ OFPT_BARRIER_REPLY (OF1.2): OVS_VSWITCHD_STOP AT_CLEANUP +dnl This test checks that tunnel metadata is encoded in packet_in structures. +AT_SETUP([ofproto - packet-out with tunnel metadata (OpenFlow 1.2)]) +OVS_VSWITCHD_START + +# Start a monitor listening for packet-ins. +AT_CHECK([ovs-ofctl -O OpenFlow12 monitor br0 --detach --no-chdir --pidfile]) +ovs-appctl -t ovs-ofctl ofctl/send 0309000c0123456700000080 +ovs-appctl -t ovs-ofctl ofctl/barrier +ovs-appctl -t ovs-ofctl ofctl/set-output-file monitor.log +AT_CAPTURE_FILE([monitor.log]) + +# Send a packet-out with set field actions to set some tunnel metadata, and forward to controller +AT_CHECK([ovs-ofctl -O OpenFlow12 packet-out br0 none 'set_field:127.0.0.1->tun_src,set_field:0x01020304->tun_id,set_field:192.168.0.1->tun_dst, controller' '0001020304050010203040501234']) + +# Stop the monitor and check its output. +ovs-appctl -t ovs-ofctl ofctl/barrier +ovs-appctl -t ovs-ofctl exit + +AT_CHECK([sed 's/ (xid=0x[[0-9a-fA-F]]*)//' monitor.log], [0], [dnl +OFPT_PACKET_IN (OF1.2): total_len=14 in_port=ANY tun_id=0x1020304 tun_src=127.0.0.1 tun_dst=192.168.0.1 (via action) data_len=14 (unbuffered) +metadata=0,in_port=0,vlan_tci=0x0000,dl_src=00:10:20:30:40:50,dl_dst=00:01:02:03:04:05,dl_type=0x1234 +OFPT_BARRIER_REPLY (OF1.2): +]) + +OVS_VSWITCHD_STOP +AT_CLEANUP + AT_SETUP([ofproto - flow monitoring]) AT_KEYWORDS([monitor]) OVS_VSWITCHD_START @@ -1632,7 +1790,7 @@ if test -e /proc/sys/net/core/rmem_max; then # Linux rmem_max=`cat /proc/sys/net/core/rmem_max` elif rmem_max=`sysctl -n net.inet.tcp.recvbuf_max 2>/dev/null`; then - : # FreeBSD + : # FreeBSD, NetBSD else # Don't know how to get maximum socket receive buffer on this OS AT_SKIP_IF([:])