X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fovs-ofctl.at;h=818582757fc4f62afcabd4e5af34f3f60da08db7;hb=1ba2441379b183a96eef51a824d772f1945a31a7;hp=73e2e9063b49f1b49806f41493281c4a33d50a9a;hpb=fbcbc81484d1945f1f25854e6b549b087ccfaacf;p=sliver-openvswitch.git diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at index 73e2e9063..818582757 100644 --- a/tests/ovs-ofctl.at +++ b/tests/ovs-ofctl.at @@ -10,6 +10,7 @@ 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 ]]) AT_CHECK([ovs-ofctl parse-flows flows.txt @@ -24,6 +25,7 @@ OFPT_FLOW_MOD: ADD tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output: OFPT_FLOW_MOD: ADD udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1 OFPT_FLOW_MOD: ADD priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535 OFPT_FLOW_MOD: ADD 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: ADD actions=load:0xa6badbfffefe59fa->NXM_NX_IPV6_SRC[0..63],load:0xfe8001234567890a->NXM_NX_IPV6_SRC[64..127] ]]) AT_CLEANUP @@ -187,7 +189,7 @@ actions=move:OXM_OF_ETH_DST[]->OXM_OF_ETH_SRC[] actions=autopath(5,NXM_NX_REG0[]) vlan_tci=0x1123/0x1fff,actions=drop ]]) -AT_CHECK([ovs-ofctl -F nxm -mmm parse-flows flows.txt], [0], [stdout]) +AT_CHECK([ovs-ofctl -F nxm -mmm parse-flows flows.txt], [0], [stdout], [stderr]) AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0], [[usable protocols: NXM chosen protocol: NXM-table_id @@ -216,6 +218,9 @@ NXT_FLOW_MOD: ADD actions=move:NXM_OF_ETH_DST[]->NXM_OF_ETH_SRC[] NXT_FLOW_MOD: ADD actions=autopath(5,NXM_NX_REG0[]) NXT_FLOW_MOD: ADD NXM_OF_VLAN_TCI_W(1123/1fff) actions=drop ]]) +AT_CHECK([[sed 's/^[^|]*|[^|]*|//' stderr]], [0], [dnl +autopath|WARN|The autopath action is deprecated and may be removed in February 2013. Please email dev@openvswitch.org with concerns. +]) AT_CLEANUP AT_SETUP([ovs-ofctl parse-nx-match]) @@ -726,6 +731,213 @@ nx_pull_match() returned error OFPBMC_BAD_FIELD ]) AT_CLEANUP +AT_SETUP([ovs-ofctl parse-ofp10-match]) +AT_KEYWORDS([OF1.0]) +AT_DATA([test-data], [dnl +# in_port=65534 +003820fe fffe xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx xxxx xx xx xxxx dnl +xxxxxxxx xxxxxxxx xxxx xxxx + +# dl_src=00:01:02:03:04:05 +003820fb xxxx 000102030405 xxxxxxxxxxxx xxxx xx xx xxxx xx xx xxxx dnl +xxxxxxxx xxxxxxxx xxxx xxxx + +# dl_dst=10:20:30:40:50:60 +003820f7 xxxx xxxxxxxxxxxx 102030405060 xxxx xx xx xxxx xx xx xxxx dnl +xxxxxxxx xxxxxxxx xxxx xxxx + +# dl_vlan=291 +003820fd xxxx xxxxxxxxxxxx xxxxxxxxxxxx 0123 xx xx xxxx xx xx xxxx dnl +xxxxxxxx xxxxxxxx xxxx xxxx + +# dl_vlan_pcp=5 +002820ff xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx 05 xx xxxx xx xx xxxx dnl +xxxxxxxx xxxxxxxx xxxx xxxx + +# dl_vlan=291,dl_vlan_pcp=4 +002820fd xxxx xxxxxxxxxxxx xxxxxxxxxxxx 0123 04 xx xxxx xx xx xxxx dnl +xxxxxxxx xxxxxxxx xxxx xxxx + +# vlan_tci=0x0000 +003820fd xxxx xxxxxxxxxxxx xxxxxxxxxxxx ffff xx xx xxxx xx xx xxxx dnl +xxxxxxxx xxxxxxxx xxxx xxxx + +dnl dl_vlan_pcp doesn't make sense when dl_vlan is "none", so +dnl OVS ignores it and drops it on output. +# vlan_tci=0x0000 +# 1: 28 -> 38 +# 20: 05 -> 00 +002820fd xxxx xxxxxxxxxxxx xxxxxxxxxxxx ffff 05 xx xxxx xx xx xxxx dnl +xxxxxxxx xxxxxxxx xxxx xxxx + +dnl Invalid VID and PCP discards out-of-range bits: +# dl_vlan=256,dl_vlan_pcp=7 +# 18: f1 -> 01 +# 20: ff -> 07 +002820fd xxxx xxxxxxxxxxxx xxxxxxxxxxxx f100 ff xx xxxx xx xx xxxx dnl +xxxxxxxx xxxxxxxx xxxx xxxx + +# dl_type=0x1234 +003820ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 1234 xx xx xxxx dnl +xxxxxxxx xxxxxxxx xxxx xxxx + +# ip,nw_proto=5 +003820cf xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 05 xxxx dnl +xxxxxxxx xxxxxxxx xxxx xxxx + +dnl Ignore nw_proto if not IP or ARP: +# dl_type=0x1234,nw_proto=5 +# normal: 3: cf -> ef +# normal: 25: 05 -> 00 +& ofp_util|INFO|normalization changed ofp_match, details: +& ofp_util|INFO| pre: dl_type=0x1234,nw_proto=5 +& ofp_util|INFO|post: dl_type=0x1234 +003820cf xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 1234 xx 05 xxxx dnl +xxxxxxxx xxxxxxxx xxxx xxxx + +# ip,nw_tos=252 +001820ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 fc xx xxxx dnl +xxxxxxxx xxxxxxxx xxxx xxxx + +dnl Ignore nw_tos if not IP: +# arp,nw_tos=4 +# 24: 05 -> 04 +# normal: 1: 18 -> 38 +# normal: 24: 04 -> 00 +& ofp_util|INFO|normalization changed ofp_match, details: +& ofp_util|INFO| pre: arp,nw_tos=4 +& ofp_util|INFO|post: arp +001820ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 05 xx xxxx dnl +xxxxxxxx xxxxxxxx xxxx xxxx + +dnl Low 2 bits of invalid TOS are forced to 0: +# ip,nw_tos=48 +# 24: 31 -> 30 +001820ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 31 xx xxxx dnl +xxxxxxxx xxxxxxxx xxxx xxxx + +# arp,arp_op=2 +003820cf xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 xx 02 xxxx dnl +xxxxxxxx xxxxxxxx xxxx xxxx + +# ip,nw_src=192.168.128.85 +003800ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx xx xxxx dnl +c0a88055 xxxxxxxx xxxx xxxx + +# ip,nw_src=192.168.128.0/24 +# 31: 55 -> 00 +003808ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx xx xxxx dnl +c0a88055 xxxxxxxx xxxx xxxx + +# ip,nw_dst=192.168.128.85 +003020ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx xx xxxx dnl +xxxxxxxx c0a88055 xxxx xxxx + +# ip,nw_dst=192.168.128.0/24 +# 35: 55 -> 00 +003220ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx xx xxxx dnl +xxxxxxxx c0a88055 xxxx xxxx + +# arp,nw_src=192.168.128.85 +003800ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 xx xx xxxx dnl +c0a88055 xxxxxxxx xxxx xxxx + +# arp,nw_src=192.168.128.0/24 +# 31: 55 -> 00 +003808ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 xx xx xxxx dnl +c0a88055 xxxxxxxx xxxx xxxx + +# arp,nw_dst=192.168.128.85 +003020ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 xx xx xxxx dnl +xxxxxxxx c0a88055 xxxx xxxx + +# arp,nw_dst=192.168.128.0/24 +# 35: 55 -> 00 +003220ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 xx xx xxxx dnl +xxxxxxxx c0a88055 xxxx xxxx + +dnl Ignore nw_src if not IP or ARP: +# dl_type=0x1234,nw_src=192.168.128.0/24 +# 31: 55 -> 00 +# normal: 2: 08 -> 20 +# normal: 28: c0 -> 00 +# normal: 29: a8 -> 00 +# normal: 30: 80 -> 00 +& ofp_util|INFO|normalization changed ofp_match, details: +& ofp_util|INFO| pre: dl_type=0x1234,nw_src=192.168.128.0/24 +& ofp_util|INFO|post: dl_type=0x1234 +003808ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 1234 xx xx xxxx dnl +c0a88055 xxxxxxxx xxxx xxxx + +dnl Ignore nw_dst if not IP or ARP: +# dl_type=0x1234,nw_dst=192.168.128.0/24 +# 35: 55 -> 00 +# normal: 1: 32 -> 38 +# normal: 32: c0 -> 00 +# normal: 33: a8 -> 00 +# normal: 34: 80 -> 00 +& ofp_util|INFO|normalization changed ofp_match, details: +& ofp_util|INFO| pre: dl_type=0x1234,nw_dst=192.168.128.0/24 +& ofp_util|INFO|post: dl_type=0x1234 +003220ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 1234 xx xx xxxx dnl +xxxxxxxx c0a88055 xxxx xxxx + +# tcp,tp_src=443 +0038208f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 06 xxxx dnl +xxxxxxxx xxxxxxxx 01bb xxxx + +# tcp,tp_dst=443 +0038204f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 06 xxxx dnl +xxxxxxxx xxxxxxxx xxxx 01bb + +# udp,tp_src=443 +0038208f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 11 xxxx dnl +xxxxxxxx xxxxxxxx 01bb xxxx + +# udp,tp_dst=443 +0038204f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 11 xxxx dnl +xxxxxxxx xxxxxxxx xxxx 01bb + +# icmp,icmp_type=5 +0038208f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 01 xxxx dnl +xxxxxxxx xxxxxxxx 0005 xxxx + +# icmp,icmp_code=8 +0038204f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 01 xxxx dnl +xxxxxxxx xxxxxxxx xxxx 0008 + +dnl Ignore tp_src if not TCP or UDP: +# ip,nw_proto=21,tp_src=443 +# normal: 3: 8f -> cf +# normal: 36: 01 -> 00 +# normal: 37: bb -> 00 +& ofp_util|INFO|normalization changed ofp_match, details: +& ofp_util|INFO| pre: ip,nw_proto=21,tp_src=443 +& ofp_util|INFO|post: ip,nw_proto=21 +0038208f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 15 xxxx dnl +xxxxxxxx xxxxxxxx 01bb xxxx + +dnl Ignore tp_dst if not TCP or UDP: +# ip,nw_proto=21,tp_dst=443 +# normal: 3: 4f -> cf +# normal: 38: 01 -> 00 +# normal: 39: bb -> 00 +dnl The normalization details are suppressed here due to rate-limiting. +0038204f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 15 xxxx dnl +xxxxxxxx xxxxxxxx xxxx 01bb + +]) +sed '/^[[#&]]/d' < test-data > input.txt +sed -n 's/^# //p; /^$/p' < test-data > expout +sed -n 's/^& //p' < test-data > experr +AT_CAPTURE_FILE([input.txt]) +AT_CAPTURE_FILE([expout]) +AT_CAPTURE_FILE([experr]) +AT_CHECK( + [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-ofp10-match < input.txt], + [0], [expout], [experr]) +AT_CLEANUP + AT_SETUP([ovs-ofctl parse-ofp11-match]) AT_KEYWORDS([OF1.1]) AT_DATA([test-data], [dnl @@ -1101,6 +1313,26 @@ OXM_OF_ETH_SRC(020898456ddb) OXM_OF_ETH_TYPE(0800) OXM_OF_ETH_TYPE(0800) OXM_OF_IN_PORT(00000012) +# vlan +OXM_OF_VLAN_VID(1009) OXM_OF_VLAN_VID(1009) # Duplicate Field +OXM_OF_VLAN_VID(f009) # Bad Value +OXM_OF_VLAN_PCP(00) # Bad Pre-Requisite +OXM_OF_VLAN_VID(0000) # Packets without 802.1Q header or with VID=0 +OXM_OF_VLAN_VID(1123) # Packets with VID=123, any PCP +OXM_OF_VLAN_VID(1123) OXM_OF_VLAN_PCP(01) # Packets with VID=123, PCP=1. +OXM_OF_VLAN_VID(0123) # Does not make sense (but supported anyway) +OXM_OF_VLAN_VID_W(0123/0123) # Does not make sense (but supported anyway) +OXM_OF_VLAN_VID_W(1123/0123) # Does not make sense (but supported anyway) +OXM_OF_VLAN_VID_W(0123/1123) # Does not make sense (but supported anyway) +OXM_OF_VLAN_VID(0123) OXM_OF_VLAN_PCP(01) #Bad Pre-Requisite +OXM_OF_VLAN_VID_W(1123/1fff) # Packets with VID=123, any PCP. +OXM_OF_VLAN_VID_W(1123/ffff) # Packets with VID=123, any PCP. +OXM_OF_VLAN_VID_W(1123/0000) # Packets with or without 802.1Q header +OXM_OF_VLAN_VID_W(1123/1f0f), # Packets with # VID=123 (masked) +OXM_OF_VLAN_VID_W(1123/1f0f), OXM_OF_VLAN_PCP(01) # Packets with VID=123 (masked), any PCP. +OXM_OF_VLAN_VID_W(1000/1000) # Packets with any VID, any PCP +OXM_OF_VLAN_VID_W(1000/1000), OXM_OF_VLAN_PCP(01) # Packets with any VID, PCP=1. + # IP ECN OXM_OF_ETH_TYPE(0800) OXM_OF_IP_ECN(03) OXM_OF_ETH_TYPE(0800) OXM_OF_IP_ECN(06) @@ -1192,11 +1424,17 @@ OXM_OF_ARP_TPA_W(C0D80000/FFFF0000) OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SHA(0002e30f80a4) OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_SHA(0002e30f80a4) OXM_OF_ARP_SHA(0002e30f80a4) +OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SHA_W(0002e30f80a4/ffffffffffff) +OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SHA_W(0002e30f80a4/000000000000) +OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SHA_W(0002e30f80a4/00000000000f) # ARP destination hardware address OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_THA(0002e30f80a4) OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_THA(0002e30f80a4) OXM_OF_ARP_THA(0002e30f80a4) +OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_THA_W(0002e30f80a4/ffffffffffff) +OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_THA_W(0002e30f80a4/000000000000) +OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_THA_W(0002e30f80a4/00000000000f) # IPv6 source OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_SRC(20010db83c4d00010002000300040005) @@ -1218,6 +1456,12 @@ OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/fffffff OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL(1000000f) OXM_OF_IPV6_FLABEL(0000000f) OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL(0000000f) +OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/0000000f) +OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/000fffff) +OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/000ffff0) +OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/100fffff) +OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/ffffffff) +OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/00000000) # ND source hardware address OXM_OF_ETH_TYPE(86dd) OXM_OF_IP_PROTO(3a) OXM_OF_ICMPV6_TYPE(87) OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005) OXM_OF_IPV6_ND_SLL(0002e30f80a4) @@ -1264,6 +1508,26 @@ OXM_OF_ETH_SRC(020898456ddb) OXM_OF_ETH_TYPE(0800) OXM_OF_IN_PORT(00000012), OXM_OF_ETH_TYPE(0800) +# vlan +nx_pull_match() returned error OFPBMC_DUP_FIELD +nx_pull_match() returned error OFPBMC_BAD_VALUE +nx_pull_match() returned error OFPBMC_BAD_PREREQ +OXM_OF_VLAN_VID(0000) +OXM_OF_VLAN_VID(1123) +OXM_OF_VLAN_VID(1123), OXM_OF_VLAN_PCP(01) +OXM_OF_VLAN_VID(0123) +OXM_OF_VLAN_VID_W(0123/0123) +OXM_OF_VLAN_VID_W(0123/0123) +OXM_OF_VLAN_VID_W(0123/1123) +nx_pull_match() returned error OFPBMC_BAD_PREREQ +OXM_OF_VLAN_VID(1123) +OXM_OF_VLAN_VID(1123) + +OXM_OF_VLAN_VID_W(1103/1f0f) +OXM_OF_VLAN_VID_W(1103/1f0f), OXM_OF_VLAN_PCP(01) +OXM_OF_VLAN_VID_W(1000/1000) +OXM_OF_VLAN_VID_W(1000/1000), OXM_OF_VLAN_PCP(01) + # IP ECN OXM_OF_ETH_TYPE(0800), OXM_OF_IP_ECN(03) nx_pull_match() returned error OFPBMC_BAD_VALUE @@ -1355,11 +1619,17 @@ nx_pull_match() returned error OFPBMC_BAD_PREREQ OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SHA(0002e30f80a4) nx_pull_match() returned error OFPBMC_BAD_PREREQ nx_pull_match() returned error OFPBMC_BAD_PREREQ +OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SHA(0002e30f80a4) +OXM_OF_ETH_TYPE(0806) +OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SHA_W(000000000004/00000000000f) # ARP destination hardware address OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_THA(0002e30f80a4) nx_pull_match() returned error OFPBMC_BAD_PREREQ nx_pull_match() returned error OFPBMC_BAD_PREREQ +OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_THA(0002e30f80a4) +OXM_OF_ETH_TYPE(0806) +OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_THA_W(000000000004/00000000000f) # IPv6 source OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_SRC(20010db83c4d00010002000300040005) @@ -1381,6 +1651,12 @@ nx_pull_match() returned error OFPBMC_BAD_PREREQ nx_pull_match() returned error OFPBMC_BAD_VALUE nx_pull_match() returned error OFPBMC_BAD_PREREQ OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL(0000000f) +OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL_W(0000000f/0000000f) +OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL(0000000f) +OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL_W(00000000/000ffff0) +OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL(0000000f) +OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL(0000000f) +OXM_OF_ETH_TYPE(86dd) # ND source hardware address OXM_OF_ETH_TYPE(86dd), OXM_OF_IP_PROTO(3a), OXM_OF_ICMPV6_TYPE(87), OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005), OXM_OF_IPV6_ND_SLL(0002e30f80a4) @@ -1414,6 +1690,103 @@ OXM_OF_IN_PORT(00000001), OXM_OF_ETH_TYPE(0800) ]) AT_CLEANUP +dnl Check all of the patterns mentioned in the "VLAN Matching" section +dnl in the DESIGN file at top level. +AT_SETUP([ovs-ofctl check-vlan]) +AT_KEYWORDS([VLAN]) + +dnl [1] +AT_CHECK([ovs-ofctl check-vlan 0000 0000], [0], [dnl + -> 0000/0000 +NXM: -> 0000/0000 +OXM: -> 0000/0000,-- +OF1.0: 0000/1,00/1 -> 0000/0000 +OF1.1: 0000/1,00/1 -> 0000/0000 +]) + +dnl [2] +AT_CHECK([ovs-ofctl check-vlan 0000 ffff], [0], [dnl +vlan_tci=0x0000 -> 0000/ffff +NXM: NXM_OF_VLAN_TCI(0000) -> 0000/ffff +OXM: OXM_OF_VLAN_VID(0000) -> 0000/1fff,-- +OF1.0: ffff/0,00/1 -> 0000/ffff +OF1.1: ffff/0,00/1 -> 0000/ffff +]) + +dnl [3] +AT_CHECK([ovs-ofctl check-vlan 1abc 1fff], [0], [dnl +dl_vlan=2748 -> 1abc/1fff +NXM: NXM_OF_VLAN_TCI_W(1abc/1fff) -> 1abc/1fff +OXM: OXM_OF_VLAN_VID(1abc) -> 1abc/1fff,-- +OF1.0: 0abc/0,00/1 -> 1abc/1fff +OF1.1: 0abc/0,00/1 -> 1abc/1fff +]) + +dnl [4] +AT_CHECK([ovs-ofctl check-vlan b000 f000], [0], [dnl +dl_vlan_pcp=5 -> b000/f000 +NXM: NXM_OF_VLAN_TCI_W(b000/f000) -> b000/f000 +OXM: OXM_OF_VLAN_VID_W(1000/1000), OXM_OF_VLAN_PCP(05) -> 1000/1000,05 +OF1.0: 0000/1,05/0 -> b000/f000 +OF1.1: fffe/0,05/0 -> b000/f000 +]) + +dnl [5] +AT_CHECK([ovs-ofctl check-vlan babc ffff], [0], [dnl +dl_vlan=2748,dl_vlan_pcp=5 -> babc/ffff +NXM: NXM_OF_VLAN_TCI(babc) -> babc/ffff +OXM: OXM_OF_VLAN_VID(1abc), OXM_OF_VLAN_PCP(05) -> 1abc/1fff,05 +OF1.0: 0abc/0,05/0 -> babc/ffff +OF1.1: 0abc/0,05/0 -> babc/ffff +]) + +dnl [6] +AT_CHECK([ovs-ofctl check-vlan 0000 0fff], [0], [dnl +vlan_tci=0x0000/0x0fff -> 0000/0fff +NXM: NXM_OF_VLAN_TCI_W(0000/0fff) -> 0000/0fff +OXM: OXM_OF_VLAN_VID_W(0000/0fff) -> 0000/0fff,-- +OF1.0: 0000/0,00/1 -> 1000/1fff +OF1.1: 0000/0,00/1 -> 1000/1fff +]) + +dnl [7] +AT_CHECK([ovs-ofctl check-vlan 0000 f000], [0], [dnl +vlan_tci=0x0000/0xf000 -> 0000/f000 +NXM: NXM_OF_VLAN_TCI_W(0000/f000) -> 0000/f000 +OXM: OXM_OF_VLAN_VID_W(0000/1000) -> 0000/1000,-- +OF1.0: ffff/0,00/1 -> 0000/ffff +OF1.1: ffff/0,00/1 -> 0000/ffff +]) + +dnl [8] +AT_CHECK([ovs-ofctl check-vlan 0000 efff], [0], [dnl +vlan_tci=0x0000/0xefff -> 0000/efff +NXM: NXM_OF_VLAN_TCI_W(0000/efff) -> 0000/efff +OXM: OXM_OF_VLAN_VID_W(0000/0fff) -> 0000/0fff,-- +OF1.0: 0000/0,00/0 -> 1000/ffff +OF1.1: 0000/0,00/0 -> 1000/ffff +]) + +dnl [9] +AT_CHECK([ovs-ofctl check-vlan 1001 1001], [0], [dnl +vlan_tci=0x1001/0x1001 -> 1001/1001 +NXM: NXM_OF_VLAN_TCI_W(1001/1001) -> 1001/1001 +OXM: OXM_OF_VLAN_VID_W(1001/1001) -> 1001/1001,-- +OF1.0: 0001/0,00/1 -> 1001/1fff +OF1.1: 0001/0,00/1 -> 1001/1fff +]) + +dnl [10] +AT_CHECK([ovs-ofctl check-vlan 3000 3000], [0], [dnl +vlan_tci=0x3000/0x3000 -> 3000/3000 +NXM: NXM_OF_VLAN_TCI_W(3000/3000) -> 3000/3000 +OXM: OXM_OF_VLAN_VID_W(1000/1000), OXM_OF_VLAN_PCP(01) -> 1000/1000,01 +OF1.0: 0000/1,01/0 -> 3000/f000 +OF1.1: fffe/0,01/0 -> 3000/f000 +]) +AT_CHECK +AT_CLEANUP + dnl Check that "-F openflow10" rejects a flow_mod with unsupported features, dnl such as tunnels and metadata. AT_SETUP([ovs-ofctl -F option and NXM features]) @@ -1566,14 +1939,6 @@ AT_CLEANUP AT_SETUP([ovs-ofctl diff-flows]) OVS_VSWITCHD_START -# Prints the integers from $1 to $2, increasing by $3 (default 1) on stdout. -seq () { - while test $1 -le $2; do - echo $1 - set `expr $1 + ${3-1}` $2 $3 - done -} - # Add tons of flows to br0. for i in `seq 0 1023`; do echo "dl_vlan=$i,actions=drop"; done > add-flows.txt AT_CHECK([ovs-ofctl add-flows br0 add-flows.txt]) @@ -1594,3 +1959,28 @@ AT_CHECK([ovs-ofctl diff-flows add-flows.txt br0 | sort], [0], [expout]) OVS_VSWITCHD_STOP AT_CLEANUP + +dnl ofpacts that differ bytewise don't necessarily differ when +dnl converted to another representation, such as OpenFlow 1.0 +dnl or to a string. "resubmit(,1)" is an example of an action +dnl of this type: "ofpact_resubmit"s can differ in their "compat" +dnl values even though this doesn't affect the string format. +dnl +dnl This test checks that "ovs-ofctl diff-flows" doesn't report +dnl false ofpacts differences. +AT_SETUP([ovs-ofctl diff-flows - suppress false differences]) +OVS_VSWITCHD_START +AT_DATA([flows.txt], [actions=resubmit(,1) +]) +AT_CHECK([ovs-ofctl add-flows br0 flows.txt]) +AT_CHECK([ovs-ofctl diff-flows br0 flows.txt]) +AT_CHECK([ovs-ofctl add-flow br0 idle_timeout=60,dl_vlan=9,actions=output:1]) +AT_CHECK([ovs-ofctl diff-flows br0 flows.txt], [2], [dnl +-dl_vlan=9 idle_timeout=60 actions=output:1 +]) +AT_CHECK([ovs-ofctl add-flow br0 hard_timeout=120,cookie=1234,dl_vlan=9,actions=output:1]) +AT_CHECK([ovs-ofctl diff-flows flows.txt br0], [2], [dnl ++dl_vlan=9 cookie=0x4d2 hard_timeout=120 actions=output:1 +]) +OVS_VSWITCHD_STOP +AT_CLEANUP