# Try a bunch of different flows and make sure that they are not distributed
# as they only vary a field that is not hashed
for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
- AT_CHECK([ovs-appctl ofproto/trace br0 "in_port=1,dl_src=50:54:00:00:00:$d,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0"], [0], [stdout])
+ AT_CHECK([ovs-appctl ofproto/trace br0 "in_port=1,dl_src=50:54:00:00:00:0$d,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0"], [0], [stdout])
tail -1 stdout >> results
done
sort results | uniq -c
-AT_CHECK([sort results | uniq], [0],
- [Datapath actions: 10
+AT_CHECK([sort results | uniq | sed 's/1[[01]]/1?/'], [0],
+ [Datapath actions: 1?
])
OVS_VSWITCHD_STOP
cookie=0xd dl_src=60:66:66:66:00:02 actions=pop_mpls:0x0800,load:0xa000001->OXM_OF_IPV4_DST[[]],controller
cookie=0xd dl_src=60:66:66:66:00:03 actions=pop_mpls:0x0800,move:OXM_OF_IPV4_DST[[]]->OXM_OF_IPV4_SRC[[]],controller
cookie=0xd dl_src=60:66:66:66:00:04 actions=pop_mpls:0x0800,push:OXM_OF_IPV4_DST[[]],pop:OXM_OF_IPV4_SRC[[]],controller
-cookie=0xd dl_src=60:66:66:66:00:05 actions=pop_mpls:0x0800,multipath(eth_src,50,modulo_n,256,0,OXM_OF_IPV4_SRC[[0..7]]),controller
+cookie=0xd dl_src=60:66:66:66:00:05 actions=pop_mpls:0x0800,multipath(eth_src,50,modulo_n,1,0,OXM_OF_IPV4_SRC[[0..7]]),controller
cookie=0xd dl_src=60:66:66:66:00:06 actions=pop_mpls:0x0800,bundle_load(eth_src,50,hrw,ofport,OXM_OF_IPV4_SRC[[0..15]],slaves:1,2),controller
cookie=0xd dl_src=60:66:66:66:00:07 actions=pop_mpls:0x0800,learn(table=1,hard_timeout=60,eth_type=0x800,nw_proto=6,OXM_OF_IPV4_SRC[[]]=OXM_OF_IPV4_DST[[]]),controller
AT_CHECK([strip_metadata < ofctl_monitor.log], [0], [dnl
NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
-tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.106,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:76db
+tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.0,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7745
dnl
NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
-tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.106,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:76db
+tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.0,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7745
dnl
NXT_PACKET_IN (xid=0x0): cookie=0xd total_len=58 in_port=1 (via action) data_len=58 (unbuffered)
-tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.106,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:76db
+tcp,vlan_tci=0x0000,dl_src=60:66:66:66:00:05,dl_dst=50:54:00:00:00:07,nw_src=192.168.0.0,nw_dst=192.168.0.2,nw_tos=0,nw_ecn=0,nw_ttl=255,tp_src=80,tp_dst=0,tcp_flags=0 tcp_csum:7745
])
AT_CHECK([ovs-appctl time/warp 5000], [0], [ignore])
cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:02 actions=pop_mpls:0x0800,load:0xa000001->NXM_OF_IP_DST[[]],CONTROLLER:65535
cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:03 actions=pop_mpls:0x0800,move:NXM_OF_IP_DST[[]]->NXM_OF_IP_SRC[[]],CONTROLLER:65535
cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:04 actions=pop_mpls:0x0800,push:NXM_OF_IP_DST[[]],pop:NXM_OF_IP_SRC[[]],CONTROLLER:65535
- cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:05 actions=pop_mpls:0x0800,multipath(eth_src,50,modulo_n,256,0,NXM_OF_IP_SRC[[0..7]]),CONTROLLER:65535
+ cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:05 actions=pop_mpls:0x0800,multipath(eth_src,50,modulo_n,1,0,NXM_OF_IP_SRC[[0..7]]),CONTROLLER:65535
cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:06 actions=pop_mpls:0x0800,bundle_load(eth_src,50,hrw,ofport,NXM_OF_IP_SRC[[0..15]],slaves:1,2),CONTROLLER:65535
cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:07 actions=pop_mpls:0x0800,learn(table=1,hard_timeout=60,eth_type=0x800,nw_proto=6,NXM_OF_IP_SRC[[]]=NXM_OF_IP_DST[[]]),CONTROLLER:65535
cookie=0xd, n_packets=3, n_bytes=186, dl_src=60:66:66:66:00:09 actions=resubmit(,2),CONTROLLER:65535
status=0
in_octets=0
in_unicasts=0
- in_multicasts=0
+ in_multicasts=4294967295
in_broadcasts=4294967295
- in_discards=0
- in_errors=0
+ in_discards=4294967295
+ in_errors=4294967295
in_unknownprotos=4294967295
out_octets=120
out_unicasts=2
out_multicasts=4294967295
out_broadcasts=4294967295
- out_discards=0
- out_errors=0
+ out_discards=4294967295
+ out_errors=4294967295
promiscuous=0
IFCOUNTERS
dgramSeqNo=2
status=0
in_octets=138
in_unicasts=3
- in_multicasts=0
+ in_multicasts=4294967295
in_broadcasts=4294967295
- in_discards=0
- in_errors=0
+ in_discards=4294967295
+ in_errors=4294967295
in_unknownprotos=4294967295
out_octets=120
out_unicasts=2
out_multicasts=4294967295
out_broadcasts=4294967295
- out_discards=0
- out_errors=0
+ out_discards=4294967295
+ out_errors=4294967295
promiscuous=0
IFCOUNTERS
dgramSeqNo=2
status=0
in_octets=84
in_unicasts=2
- in_multicasts=0
+ in_multicasts=4294967295
in_broadcasts=4294967295
- in_discards=0
- in_errors=0
+ in_discards=4294967295
+ in_errors=4294967295
in_unknownprotos=4294967295
out_octets=180
out_unicasts=3
out_multicasts=4294967295
out_broadcasts=4294967295
- out_discards=0
- out_errors=0
+ out_discards=4294967295
+ out_errors=4294967295
promiscuous=0
IFCOUNTERS
dgramSeqNo=3
status=0
in_octets=0
in_unicasts=0
- in_multicasts=0
+ in_multicasts=4294967295
in_broadcasts=4294967295
- in_discards=0
- in_errors=0
+ in_discards=4294967295
+ in_errors=4294967295
in_unknownprotos=4294967295
out_octets=120
out_unicasts=2
out_multicasts=4294967295
out_broadcasts=4294967295
- out_discards=0
- out_errors=0
+ out_discards=4294967295
+ out_errors=4294967295
promiscuous=0
IFCOUNTERS
dgramSeqNo=3
status=0
in_octets=138
in_unicasts=3
- in_multicasts=0
+ in_multicasts=4294967295
in_broadcasts=4294967295
- in_discards=0
- in_errors=0
+ in_discards=4294967295
+ in_errors=4294967295
in_unknownprotos=4294967295
out_octets=120
out_unicasts=2
out_multicasts=4294967295
out_broadcasts=4294967295
- out_discards=0
- out_errors=0
+ out_discards=4294967295
+ out_errors=4294967295
promiscuous=0
IFCOUNTERS
dgramSeqNo=3
status=0
in_octets=84
in_unicasts=2
- in_multicasts=0
+ in_multicasts=4294967295
in_broadcasts=4294967295
- in_discards=0
- in_errors=0
+ in_discards=4294967295
+ in_errors=4294967295
in_unknownprotos=4294967295
out_octets=180
out_unicasts=3
out_multicasts=4294967295
out_broadcasts=4294967295
- out_discards=0
- out_errors=0
+ out_discards=4294967295
+ out_errors=4294967295
promiscuous=0
OPENFLOWPORT
datapath_id=18364758544493064720
AT_CHECK([ovs-ofctl dump-ports br0 pbr0], [0], [dnl
OFPST_PORT reply (xid=0x4): 1 ports
- port 1: rx pkts=5, bytes=300, drop=0, errs=0, frame=0, over=0, crc=0
- tx pkts=10, bytes=600, drop=0, errs=0, coll=0
+ port 1: rx pkts=5, bytes=300, drop=?, errs=?, frame=?, over=?, crc=?
+ tx pkts=10, bytes=600, drop=?, errs=?, coll=?
])
AT_CHECK([ovs-ofctl dump-ports br1 pbr1], [0], [dnl
OFPST_PORT reply (xid=0x4): 1 ports
- port 1: rx pkts=10, bytes=600, drop=0, errs=0, frame=0, over=0, crc=0
- tx pkts=5, bytes=300, drop=0, errs=0, coll=0
+ port 1: rx pkts=10, bytes=600, drop=?, errs=?, frame=?, over=?, crc=?
+ tx pkts=5, bytes=300, drop=?, errs=?, coll=?
])
OVS_VSWITCHD_STOP
sleep 1
AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,nw_frag=no, actions: <del>
-recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:0b/ff:ff:00:00:00:02,nw_frag=no, actions: <del>
+recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:0b,nw_frag=no, actions: <del>
])
OVS_VSWITCHD_STOP
AT_CLEANUP
sleep 1
AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
recirc_id=0,icmp,in_port=1,vlan_tci=0x0000,nw_src=10.0.0.4,nw_frag=no, actions: <del>
-recirc_id=0,ip,in_port=1,vlan_tci=0x0000,nw_src=10.0.0.2/0.0.0.2,nw_frag=no, actions: <del>
+recirc_id=0,ip,in_port=1,vlan_tci=0x0000,nw_src=10.0.0.2/30,nw_frag=no, actions: <del>
])
OVS_VSWITCHD_STOP
AT_CLEANUP
sleep 1
AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
recirc_id=0,ipv6,in_port=1,vlan_tci=0x0000,ipv6_src=2001:db8:3c4d:1:2:3:4:5,nw_frag=no, actions: <del>
-recirc_id=0,ipv6,in_port=1,vlan_tci=0x0000,ipv6_src=2001:db8:3c4d:5:4:3:2:1/0:0:0:4::,nw_frag=no, actions: <del>
+recirc_id=0,ipv6,in_port=1,vlan_tci=0x0000,ipv6_src=2001:db8:3c4d:5:4:3:2:1/62,nw_frag=no, actions: <del>
])
OVS_VSWITCHD_STOP
AT_CLEANUP
sleep 1
AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout_keep_actions], [0], [dnl
recirc_id=0,mpls,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,mpls_label=11,mpls_tc=3,mpls_ttl=64,mpls_bos=1, actions:push_mpls(label=11,tc=3,ttl=64,bos=0,eth_type=0x8847),2
-recirc_id=0,mpls,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:0b,mpls_bos=1, actions:pop_mpls(eth_type=0x800),recirc(0x1)
-recirc_id=0x1,ip,in_port=1,vlan_tci=0x0000,nw_frag=no, actions:2
+recirc_id=0,mpls,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:0b,mpls_bos=1, actions:pop_mpls(eth_type=0x800),2
])
OVS_VSWITCHD_STOP
AT_CLEANUP
sleep 1
AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:09,nw_frag=no, actions: <del>
-recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:0b/ff:ff:00:00:00:02,nw_frag=no, actions: <del>
+recirc_id=0,ip,in_port=1,vlan_tci=0x0000,dl_src=50:54:00:00:00:0b,nw_frag=no, actions: <del>
])
OVS_VSWITCHD_STOP
AT_CLEANUP
sleep 1
AT_CHECK([filter_flow_install < ovs-vswitchd.log | strip_xout], [0], [dnl
recirc_id=0,icmp,in_port=1,vlan_tci=0x0000,nw_src=10.0.0.4,nw_ttl=64,nw_frag=no, actions: <del>
-recirc_id=0,ip,in_port=1,vlan_tci=0x0000,nw_src=10.0.0.2/0.0.0.2,nw_frag=no, actions: <del>
+recirc_id=0,ip,in_port=1,vlan_tci=0x0000,nw_src=10.0.0.2/30,nw_frag=no, actions: <del>
])
OVS_VSWITCHD_STOP
AT_CLEANUP
\f
AT_BANNER([ofproto-dpif - flow translation resource limits])
+dnl Resubmits to later tables do not count against the depth limit, so we
+dnl can do 99 of them even though the maximum depth is 64.
+AT_SETUP([ofproto-dpif - forward resubmit])
+OVS_VSWITCHD_START
+(for i in `seq 0 99`; do
+ j=`expr $i + 1`
+ echo "table=$i, actions=resubmit(,$j)"
+ done
+ echo "table=100, actions=local") > flows
+AT_CHECK([ovs-ofctl add-flows br0 flows])
+AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
+ [0], [stdout])
+AT_CHECK([tail -1 stdout], [0], [Datapath actions: 100
+])
+OVS_VSWITCHD_STOP
+AT_CLEANUP
+
+dnl Resubmits to the same or an earlier table count against the depth limit,
+dnl so only 64 of them are allowed.
+AT_SETUP([ofproto-dpif - backward resubmit])
+OVS_VSWITCHD_START
+(echo "table=0, actions=resubmit(,66)"
+ for i in `seq 2 66`; do
+ j=`expr $i - 1`
+ echo "table=$i, actions=resubmit(,$j)"
+ done
+ echo "table=1, actions=local") > flows
+AT_CHECK([ovs-ofctl add-flows br0 flows])
+AT_CHECK([ovs-appctl -vpoll_loop:off ofproto/trace br0 'eth_dst=ff:ff:ff:ff:ff:ff'],
+ [0], [stdout])
+AT_CHECK([tail -1 stdout], [0],
+ [Translation failed (Recursion too deep), packet is dropped.
+])
+AT_CHECK([grep -c 'over max translation depth 64' stdout],
+ [0], [1
+])
+OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
+AT_CLEANUP
+
AT_SETUP([ofproto-dpif - infinite resubmit])
OVS_VSWITCHD_START
AT_CHECK([ovs-ofctl add-flow br0 actions=resubmit:1,resubmit:2,output:3])
AT_CHECK([tail -1 stdout], [0],
[Translation failed (Recursion too deep), packet is dropped.
])
-AT_CHECK([grep -c 'resubmit actions recursed over 64 times' stdout],
+AT_CHECK([grep -c 'over max translation depth 64' stdout],
[0], [1
])
OVS_VSWITCHD_STOP(["/resubmit actions recursed/d"])
ovs-appctl time/stop
-for i in 1 2 3; do
+AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x1234)'])
+
+# Wait for the flow setup to be done.
+OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
+
+for i in 1 2; do
ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x1234)'
done
ovs-appctl time/stop
+AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x1234)'])
+
# Check that a correct datapath flow is created.
-for i in 1 2 3; do
+OVS_WAIT_UNTIL([grep 'flow_add:' ovs-vswitchd.log])
+
+for i in 1 2; do
ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x1234)'
done
])
# Check that VLAN packets will not hit the same datapath megaflow.
-for i in 1 2 3; do
+
+AT_CHECK([ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x8100),vlan(vid=99,pcp=7),encap(eth_type(0x1234))'])
+OVS_WAIT_UNTIL([grep 'flow_add:.*dl_vlan=99' ovs-vswitchd.log])
+
+for i in 1 2; do
ovs-appctl netdev-dummy/receive p1 'in_port(1),eth(src=50:54:00:00:00:09,dst=50:54:00:00:00:0a),eth_type(0x8100),vlan(vid=99,pcp=7),encap(eth_type(0x1234))'
done
AT_CHECK([ovs-appctl dpif/dump-flows br0 | strip_ufid | strip_used | sort], [0], [dnl
recirc_id(0),in_port(1),eth_type(0x1234), packets:8, bytes:480, used:0.0s, actions:100
-recirc_id(0),in_port(1),eth_type(0x8100),vlan(vid=99/0x0,pcp=7/0x0),encap(eth_type(0x1234)), packets:2, bytes:120, used:0.0s, actions:drop
+recirc_id(0),in_port(1),eth_type(0x8100),vlan(vid=99,pcp=7/0x0),encap(eth_type(0x1234)), packets:2, bytes:120, used:0.0s, actions:drop
])
# Check that the new flow matches the CFI bit, while both vid and pcp
dpif_netdev|DBG|flow_add: recirc_id=0,in_port=1,vlan_tci=0x0000,dl_type=0x1234, actions:100
dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x1234)
dpif|DBG|dummy@ovs-dummy: put[[modify]] skb_priority(0/0),skb_mark(0/0),recirc_id(0),dp_hash(0/0),in_port(1),eth(src=50:54:00:00:00:09/00:00:00:00:00:00,dst=50:54:00:00:00:0a/00:00:00:00:00:00),eth_type(0x1234), actions:100
-dpif_netdev|DBG|flow_add: recirc_id=0,in_port=1,vlan_tci=0xf063/0x1000,dl_type=0x1234, actions:drop
+dpif_netdev|DBG|flow_add: recirc_id=0,in_port=1,dl_vlan=99,dl_type=0x1234, actions:drop
])
OVS_VSWITCHD_STOP
AT_CLEANUP