+AT_SETUP([ovs-ofctl parse-flows choice of protocol])
+# This doesn't cover some potential vlan_tci test cases.
+for test_case in \
+ 'tun_id=0 NXM,OXM,OXM-OpenFlow14' \
+ 'tun_id=0/0x1 NXM,OXM,OXM-OpenFlow14' \
+ 'tun_src=1.2.3.4 NXM,OXM,OXM-OpenFlow14' \
+ 'tun_src=1.2.3.4/0.0.0.1 NXM,OXM,OXM-OpenFlow14' \
+ 'tun_dst=1.2.3.4 NXM,OXM,OXM-OpenFlow14' \
+ 'tun_dst=1.2.3.4/0.0.0.1 NXM,OXM,OXM-OpenFlow14' \
+ 'tun_flags=0 none' \
+ 'tun_flags=1/1 none' \
+ 'tun_tos=0 none' \
+ 'tun_ttl=0 none' \
+ 'metadata=0 NXM,OXM,OpenFlow11,OXM-OpenFlow14' \
+ 'metadata=1/1 NXM,OXM,OpenFlow11,OXM-OpenFlow14' \
+ 'in_port=1 any,OXM-OpenFlow14' \
+ 'skb_priority=0 none' \
+ 'pkt_mark=1 NXM,OXM,OXM-OpenFlow14' \
+ 'pkt_mark=1/1 NXM,OXM,OXM-OpenFlow14' \
+ 'reg0=0 NXM,OXM,OXM-OpenFlow14' \
+ 'reg0=0/1 NXM,OXM,OXM-OpenFlow14' \
+ 'reg1=1 NXM,OXM,OXM-OpenFlow14' \
+ 'reg1=1/1 NXM,OXM,OXM-OpenFlow14' \
+ 'reg2=2 NXM,OXM,OXM-OpenFlow14' \
+ 'reg2=2/1 NXM,OXM,OXM-OpenFlow14' \
+ 'reg3=3 NXM,OXM,OXM-OpenFlow14' \
+ 'reg3=3/1 NXM,OXM,OXM-OpenFlow14' \
+ 'reg4=4 NXM,OXM,OXM-OpenFlow14' \
+ 'reg4=4/1 NXM,OXM,OXM-OpenFlow14' \
+ 'reg5=5 NXM,OXM,OXM-OpenFlow14' \
+ 'reg5=5/1 NXM,OXM,OXM-OpenFlow14' \
+ 'reg6=6 NXM,OXM,OXM-OpenFlow14' \
+ 'reg6=6/1 NXM,OXM,OXM-OpenFlow14' \
+ 'reg7=7 NXM,OXM,OXM-OpenFlow14' \
+ 'reg7=7/1 NXM,OXM,OXM-OpenFlow14' \
+ 'dl_src=00:11:22:33:44:55 any,OXM-OpenFlow14' \
+ 'dl_src=00:11:22:33:44:55/00:ff:ff:ff:ff:ff NXM,OXM,OpenFlow11,OXM-OpenFlow14' \
+ 'dl_dst=00:11:22:33:44:55 any,OXM-OpenFlow14' \
+ 'dl_dst=00:11:22:33:44:55/00:ff:ff:ff:ff:ff NXM,OXM,OpenFlow11,OXM-OpenFlow14' \
+ 'dl_type=0x1234 any,OXM-OpenFlow14' \
+ 'dl_type=0x0800 any,OXM-OpenFlow14' \
+ 'dl_type=0x0806 any,OXM-OpenFlow14' \
+ 'dl_type=0x86dd any,OXM-OpenFlow14' \
+ 'vlan_tci=0 any,OXM-OpenFlow14' \
+ 'vlan_tci=0x1009 any,OXM-OpenFlow14' \
+ 'vlan_tci=0x1009/0x1 NXM,OXM,OXM-OpenFlow14' \
+ 'dl_vlan=9 any,OXM-OpenFlow14' \
+ 'vlan_vid=11 any,OXM-OpenFlow14' \
+ 'vlan_vid=11/0x1 NXM,OXM,OXM-OpenFlow14' \
+ 'dl_vlan_pcp=6 any,OXM-OpenFlow14' \
+ 'vlan_pcp=5 any,OXM-OpenFlow14' \
+ 'mpls,mpls_label=5 NXM,OXM,OpenFlow11,OXM-OpenFlow14' \
+ 'mpls,mpls_tc=1 NXM,OXM,OpenFlow11,OXM-OpenFlow14' \
+ 'mpls,mpls_bos=0 NXM,OXM,OXM-OpenFlow14' \
+ 'ip,ip_src=1.2.3.4 any,OXM-OpenFlow14' \
+ 'ip,ip_src=192.168.0.0/24 any,OXM-OpenFlow14' \
+ 'ip,ip_src=192.0.168.0/255.0.255.0 NXM,OXM,OpenFlow11,OXM-OpenFlow14' \
+ 'ip,ip_dst=1.2.3.4 any,OXM-OpenFlow14' \
+ 'ip,ip_dst=192.168.0.0/24 any,OXM-OpenFlow14' \
+ 'ip,ip_dst=192.0.168.0/255.0.255.0 NXM,OXM,OpenFlow11,OXM-OpenFlow14' \
+ 'ipv6,ipv6_src=::1 NXM,OXM,OXM-OpenFlow14' \
+ 'ipv6,ipv6_src=::1/::1 NXM,OXM,OXM-OpenFlow14' \
+ 'ipv6,ipv6_dst=::1 NXM,OXM,OXM-OpenFlow14' \
+ 'ipv6,ipv6_dst=::1/::1 NXM,OXM,OXM-OpenFlow14' \
+ 'ipv6,ipv6_label=5 NXM,OXM,OXM-OpenFlow14' \
+ 'ipv6,ipv6_label=5/1 NXM,OXM,OXM-OpenFlow14' \
+ 'ip,nw_proto=1 any,OXM-OpenFlow14' \
+ 'ipv6,nw_proto=1 NXM,OXM,OXM-OpenFlow14' \
+ 'ip,nw_tos=0xf0 any,OXM-OpenFlow14' \
+ 'ipv6,nw_tos=0xf0 NXM,OXM,OXM-OpenFlow14' \
+ 'ip,ip_dscp=0x3c any,OXM-OpenFlow14' \
+ 'ipv6,ip_dscp=0x3c NXM,OXM,OXM-OpenFlow14' \
+ 'ip,nw_ecn=1 NXM,OXM,OXM-OpenFlow14' \
+ 'ipv6,nw_ecn=1 NXM,OXM,OXM-OpenFlow14' \
+ 'ip,nw_ttl=5 NXM,OXM,OXM-OpenFlow14' \
+ 'ipv6,nw_ttl=5 NXM,OXM,OXM-OpenFlow14' \
+ 'ip,ip_frag=no NXM,OXM,OXM-OpenFlow14' \
+ 'ipv6,ip_frag=no NXM,OXM,OXM-OpenFlow14' \
+ 'arp,arp_op=0 any,OXM-OpenFlow14' \
+ 'arp,arp_spa=1.2.3.4 any,OXM-OpenFlow14' \
+ 'arp,arp_spa=1.2.3.4/0.0.0.1 NXM,OXM,OpenFlow11,OXM-OpenFlow14' \
+ 'arp,arp_tpa=1.2.3.4 any,OXM-OpenFlow14' \
+ 'arp,arp_tpa=1.2.3.4/0.0.0.1 NXM,OXM,OpenFlow11,OXM-OpenFlow14' \
+ 'arp,arp_sha=00:11:22:33:44:55 NXM,OXM,OXM-OpenFlow14' \
+ 'arp,arp_sha=00:11:22:33:44:55/00:ff:ff:ff:ff:ff NXM,OXM,OXM-OpenFlow14' \
+ 'arp,arp_tha=00:11:22:33:44:55 NXM,OXM,OXM-OpenFlow14' \
+ 'arp,arp_tha=00:11:22:33:44:55/00:ff:ff:ff:ff:ff NXM,OXM,OXM-OpenFlow14' \
+ 'tcp,tcp_src=80 any,OXM-OpenFlow14' \
+ 'tcp,tcp_src=0x1000/0x1000 NXM,OXM,OXM-OpenFlow14' \
+ 'tcp6,tcp_src=80 NXM,OXM,OXM-OpenFlow14' \
+ 'tcp6,tcp_src=0x1000/0x1000 NXM,OXM,OXM-OpenFlow14' \
+ 'tcp,tcp_dst=80 any,OXM-OpenFlow14' \
+ 'tcp,tcp_dst=0x1000/0x1000 NXM,OXM,OXM-OpenFlow14' \
+ 'tcp6,tcp_dst=80 NXM,OXM,OXM-OpenFlow14' \
+ 'tcp6,tcp_dst=0x1000/0x1000 NXM,OXM,OXM-OpenFlow14' \
+ 'udp,udp_src=80 any,OXM-OpenFlow14' \
+ 'udp,udp_src=0x1000/0x1000 NXM,OXM,OXM-OpenFlow14' \
+ 'udp6,udp_src=80 NXM,OXM,OXM-OpenFlow14' \
+ 'udp6,udp_src=0x1000/0x1000 NXM,OXM,OXM-OpenFlow14' \
+ 'udp,udp_dst=80 any,OXM-OpenFlow14' \
+ 'udp,udp_dst=0x1000/0x1000 NXM,OXM,OXM-OpenFlow14' \
+ 'udp6,udp_dst=80 NXM,OXM,OXM-OpenFlow14' \
+ 'udp6,udp_dst=0x1000/0x1000 NXM,OXM,OXM-OpenFlow14' \
+ 'icmp,icmp_type=1 any,OXM-OpenFlow14' \
+ 'icmp,icmp_code=2 any,OXM-OpenFlow14' \
+ 'icmp6,icmpv6_type=1 NXM,OXM,OXM-OpenFlow14' \
+ 'icmp6,icmpv6_code=2 NXM,OXM,OXM-OpenFlow14'
+do
+ set $test_case
+ echo
+ echo "### test case: '$1' should have usable protocols '$2'"
+ if test "$2" = none; then
+ AT_CHECK([ovs-ofctl parse-flow "$1,actions=drop"], [1],
+ [usable protocols: none
+],
+ [ovs-ofctl: no usable protocol
+])
+ else
+ AT_CHECK_UNQUOTED([ovs-ofctl parse-flow "$1,actions=drop" | sed 1q], [0],
+ [usable protocols: $2
+])
+ fi
+done
+AT_CLEANUP
+