X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tests%2Fovs-ofctl.at;h=ca68226b73d016932283cbb7dd20cadd345fd5be;hb=85b20fd6ee585f462e012fbcc7f966a81edab2ed;hp=2ad165c78db2d3d5eab60f6f6eb07f3f803fb9fb;hpb=37923ac734a8b8bdb4da2fe77a24d77d487dc056;p=sliver-openvswitch.git diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at index 2ad165c78..ca68226b7 100644 --- a/tests/ovs-ofctl.at +++ b/tests/ovs-ofctl.at @@ -20,7 +20,7 @@ AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0], [[usable protocols: any chosen protocol: OpenFlow10-table_id OFPT_FLOW_MOD: ADD tcp,tp_src=123 actions=FLOOD -OFPT_FLOW_MOD: ADD in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop +OFPT_FLOW_MOD: ADD in_port=LOCAL,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop OFPT_FLOW_MOD: ADD udp,dl_vlan_pcp=7 idle:5 actions=strip_vlan,output:0 OFPT_FLOW_MOD: ADD tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1 OFPT_FLOW_MOD: ADD udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1 @@ -31,6 +31,37 @@ OFPT_FLOW_MOD: ADD in_port=0 actions=resubmit:0 ]]) AT_CLEANUP +AT_SETUP([ovs-ofctl parse-flows (OpenFlow 1.2)]) +AT_DATA([flows.txt], [[ +# comment +tcp,tp_src=123,actions=flood +in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop +udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0 +tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1 +udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1 +cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller +actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note +actions=set_field:fe80:0123:4567:890a:a6ba:dbff:fefe:59fa->ipv6_src +in_port=0 actions=resubmit:0 +]]) + +AT_CHECK([ovs-ofctl --protocols OpenFlow12 parse-flows flows.txt +], [0], [stdout]) +AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0], +[[usable protocols: any +chosen protocol: OXM-OpenFlow12 +OFPT_FLOW_MOD (OF1.2): ADD table:255 tcp,tp_src=123 actions=FLOOD +OFPT_FLOW_MOD (OF1.2): ADD table:255 in_port=LOCAL,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop +OFPT_FLOW_MOD (OF1.2): ADD table:255 udp,dl_vlan_pcp=7 idle:5 actions=strip_vlan,output:0 +OFPT_FLOW_MOD (OF1.2): ADD table:255 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1 +OFPT_FLOW_MOD (OF1.2): ADD table:255 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1 +OFPT_FLOW_MOD (OF1.2): ADD table:255 priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535 +OFPT_FLOW_MOD (OF1.2): ADD table:255 actions=note:41.42.43.00.00.00,note:00.01.02.03.04.05.06.07.00.00.00.00.00.00,note:00.00.00.00.00.00 +OFPT_FLOW_MOD (OF1.2): ADD table:255 actions=set_field:fe80:123:4567:890a:a6ba:dbff:fefe:59fa->ipv6_src +OFPT_FLOW_MOD (OF1.2): ADD table:255 in_port=0 actions=resubmit:0 +]]) +AT_CLEANUP + AT_SETUP([ovs-ofctl parse-flows (With Tunnel-Parameters)]) AT_DATA([flows.txt], [[ tun_id=0x1234000056780000/0xffff0000ffff0000,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_tos=0x3,tun_ttl=20,tun_flags=key|csum actions=drop @@ -43,6 +74,18 @@ AT_CHECK([ovs-ofctl parse-flows flows.txt AT_CLEANUP +AT_SETUP([ovs-ofctl parse-flows (skb_mark and skb_priority)]) +AT_DATA([flows.txt], [[ +skb_mark=0x12345678,skb_priority=0x12341234,tcp,tp_src=123,actions=flood +]]) + +AT_CHECK([ovs-ofctl parse-flows flows.txt +], [1], [usable protocols: none +], [stderr]) + +AT_CLEANUP + + AT_SETUP([ovs-ofctl parse-flows (NXM)]) AT_DATA([flows.txt], [[ # comment @@ -81,7 +124,7 @@ AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0], [[usable protocols: OXM,NXM+table_id chosen protocol: NXM+table_id NXT_FLOW_MOD: ADD table:255 tcp,tp_src=123 actions=FLOOD -NXT_FLOW_MOD: ADD table:255 in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop +NXT_FLOW_MOD: ADD table:255 in_port=LOCAL,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop NXT_FLOW_MOD: ADD table:255 udp,dl_vlan_pcp=7 idle:5 actions=strip_vlan,output:0 NXT_FLOW_MOD: ADD table:255 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1 NXT_FLOW_MOD: ADD table:255 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1 @@ -146,7 +189,7 @@ AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0], [dnl usable protocols: NXM,OXM chosen protocol: NXM-table_id NXT_FLOW_MOD: ADD tcp,tp_src=123 actions=FLOOD -NXT_FLOW_MOD: ADD in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop +NXT_FLOW_MOD: ADD in_port=LOCAL,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop NXT_FLOW_MOD: ADD arp,dl_src=00:0a:e4:25:6b:b0,arp_sha=00:0a:e4:25:6b:b0 actions=drop NXT_FLOW_MOD: ADD ipv6,ipv6_label=0x12345 actions=output:2 NXT_FLOW_MOD: ADD ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output:3 @@ -526,7 +569,7 @@ NXM_NX_REG0_W(a0e0d050/00000000) 00011e04(12345678) 00011f08(12345678/12345678) ]) -AT_CHECK([ovs-ofctl --strict parse-nx-match < nx-match.txt], [0], [dnl +AT_CHECK([ovs-ofctl -vPATTERN:'console:%c|%p|%m' --strict parse-nx-match < nx-match.txt], [0], [dnl # in port @@ -812,13 +855,22 @@ NXM_NX_REG0(12345678) NXM_NX_REG0_W(12345678/12345678) nx_pull_match() returned error OFPBMC_BAD_FIELD nx_pull_match() returned error OFPBMC_BAD_FIELD +], [stderr]) + +# Check that at least the first warning made it. (It's rate-limited +# so a variable number could show up, especially under valgrind etc.) +AT_CHECK([grep 'has 1-bits in value' stderr | sed 1q], [0], [dnl +nx_match|WARN|NXM/OXM entry NXM_OF_ETH_DST_W(ffffffffffff/010000000000) has 1-bits in value for bits wildcarded by the mask. (Future versions of OVS may report this as an OpenFlow error.) ]) + +# Check that there wasn't any other stderr output. +AT_CHECK([grep -v 'has 1-bits in value' stderr], [1]) AT_CLEANUP AT_SETUP([ovs-ofctl parse-ofp10-match]) AT_KEYWORDS([OF1.0]) AT_DATA([test-data], [dnl -# in_port=65534 +# in_port=LOCAL 003820fe fffe xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx xxxx xx xx xxxx dnl xxxxxxxx xxxxxxxx xxxx xxxx @@ -1025,7 +1077,7 @@ AT_CLEANUP AT_SETUP([ovs-ofctl parse-ofp11-match]) AT_KEYWORDS([OF1.1]) AT_DATA([test-data], [dnl -# in_port=65534 +# in_port=LOCAL 0000 0058 fffffffe 000003fe dnl 000000000000ffffffffffff 000000000000ffffffffffff dnl 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl @@ -1562,7 +1614,8 @@ OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(3a) OXM_OF_ICMPV6_TYPE(88) OXM_OF_IPV6_ND_ # Invalid field number. 01020304(1111/2222) ]) -AT_CHECK([ovs-ofctl --strict parse-oxm < oxm.txt], [0], [dnl +AT_CHECK([ovs-ofctl '-vPATTERN:console:%c|%p|%m' --strict parse-oxm < oxm.txt], + [0], [dnl # in port @@ -1756,7 +1809,16 @@ nx_pull_match() returned error OFPBMC_BAD_PREREQ # Invalid field number. nx_pull_match() returned error OFPBMC_BAD_FIELD +], [stderr]) + +# Check that at least the first warning made it. (It's rate-limited +# so a variable number could show up, especially under valgrind etc.) +AT_CHECK([grep 'has 1-bits in value' stderr | sed 1q], [0], [dnl +nx_match|WARN|NXM/OXM entry OXM_OF_METADATA_W(1234567890abcdef/ffff0000ffff0000) has 1-bits in value for bits wildcarded by the mask. (Future versions of OVS may report this as an OpenFlow error.) ]) + +# Check that there wasn't any other stderr output. +AT_CHECK([grep -v 'has 1-bits in value' stderr], [1]) AT_CLEANUP AT_SETUP([ovs-ofctl parse-oxm loose])