]> git.proxmox.com Git - mirror_ovs.git/blame - tests/nsh.at
tests: Log commands being executed for async message control test.
[mirror_ovs.git] / tests / nsh.at
CommitLineData
e3981271
JS
1AT_BANNER([network service header (NSH)])
2
cc6902fe
JS
3### -----------------------------------------------------------------
4### Simple NSH matching test case
5### -----------------------------------------------------------------
6
e3981271
JS
7AT_SETUP([nsh - matching])
8
9OVS_VSWITCHD_START([dnl
10 set bridge br0 datapath_type=dummy \
11 protocols=OpenFlow10,OpenFlow13,OpenFlow14,OpenFlow15 -- \
12 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
13 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2])
14
15AT_DATA([flows.txt], [dnl
17553f27 16 table=0,in_port=1,dl_type=0x894f,nsh_ttl=63,nsh_mdtype=1,nsh_np=3,nsh_spi=0x123456,nsh_si=255,nsh_c1=0x11223344,actions=set_field:0x2->nsh_flags,set_field:254->nsh_si,set_field:0x44332211->nsh_c1,2
e3981271
JS
17])
18
19AT_CHECK([
20 ovs-ofctl del-flows br0
21 ovs-ofctl -Oopenflow13 add-flows br0 flows.txt
22 ovs-ofctl -Oopenflow13 dump-flows br0 | ofctl_strip | sort | grep actions
23], [0], [dnl
17553f27 24 in_port=1,dl_type=0x894f,nsh_ttl=63,nsh_mdtype=1,nsh_np=3,nsh_spi=0x123456,nsh_si=255,nsh_c1=0x11223344 actions=set_field:2->nsh_flags,set_field:254->nsh_si,set_field:0x44332211->nsh_c1,output:2
e3981271
JS
25])
26
27AT_CHECK([
17553f27 28 ovs-appctl ofproto/trace br0 'in_port=1,dl_type=0x894f,nsh_ttl=63,nsh_mdtype=1,nsh_np=3,nsh_spi=0x123456,nsh_si=255,nsh_c1=0x11223344,nsh_c2=0x55667788,nsh_c3=0x99aabbcc,nsh_c4=0xddeeff00'
e3981271 29], [0], [dnl
17553f27 30Flow: in_port=1,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=00:00:00:00:00:00,dl_type=0x894f,nsh_flags=0,nsh_ttl=63,nsh_mdtype=1,nsh_np=3,nsh_spi=0x123456,nsh_si=255,nsh_c1=0x11223344,nsh_c2=0x55667788,nsh_c3=0x99aabbcc,nsh_c4=0xddeeff00,nw_proto=0,nw_tos=0,nw_ecn=0,nw_ttl=0
e3981271
JS
31
32bridge("br0")
33-------------
17553f27
YY
34 0. in_port=1,dl_type=0x894f,nsh_ttl=63,nsh_mdtype=1,nsh_np=3,nsh_spi=0x123456,nsh_si=255,nsh_c1=0x11223344, priority 32768
35 set_field:2->nsh_flags
e3981271
JS
36 set_field:254->nsh_si
37 set_field:0x44332211->nsh_c1
38 output:2
39
17553f27
YY
40Final flow: in_port=1,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=00:00:00:00:00:00,dl_type=0x894f,nsh_flags=2,nsh_ttl=63,nsh_mdtype=1,nsh_np=3,nsh_spi=0x123456,nsh_si=254,nsh_c1=0x44332211,nsh_c2=0x55667788,nsh_c3=0x99aabbcc,nsh_c4=0xddeeff00,nw_proto=0,nw_tos=0,nw_ecn=0,nw_ttl=0
41Megaflow: recirc_id=0,eth,in_port=1,dl_type=0x894f,nsh_flags=0,nsh_ttl=63,nsh_mdtype=1,nsh_np=3,nsh_spi=0x123456,nsh_si=255,nsh_c1=0x11223344
42Datapath actions: set(nsh(flags=2,ttl=63,spi=0x123456,si=254,c1=0x44332211)),2
e3981271
JS
43])
44
45OVS_VSWITCHD_STOP
46AT_CLEANUP
cc6902fe
JS
47
48
49### -----------------------------------------------------------------
50### NSH MD1 on Ethernet encapsulation over veth link
51### -----------------------------------------------------------------
52
53AT_SETUP([nsh - md1 encap over a veth link])
54
55OVS_VSWITCHD_START([])
56
57AT_CHECK([
58ovs-vsctl set bridge br0 datapath_type=dummy \
59 protocols=OpenFlow10,OpenFlow13,OpenFlow14,OpenFlow15 -- \
60 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
61 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2 -- \
62 add-port br0 v3 -- set Interface v3 type=patch options:peer=v4 ofport_request=3 -- \
63 add-port br0 v4 -- set Interface v4 type=patch options:peer=v3 ofport_request=4])
64
65AT_DATA([flows.txt], [dnl
66 table=0,in_port=1,ip,actions=encap(nsh(md_type=1)),set_field:0x1234->nsh_spi,set_field:0x11223344->nsh_c1,encap(ethernet),set_field:11:22:33:44:55:66->dl_dst,3
67 table=0,in_port=4,dl_type=0x894f,nsh_mdtype=1,nsh_spi=0x1234,nsh_c1=0x11223344,actions=decap(),decap(),2
68])
69
70AT_CHECK([
71 ovs-ofctl del-flows br0
72 ovs-ofctl -Oopenflow13 add-flows br0 flows.txt
73 ovs-ofctl -Oopenflow13 dump-flows br0 | ofctl_strip | sort | grep actions
74], [0], [dnl
75 in_port=4,dl_type=0x894f,nsh_mdtype=1,nsh_spi=0x1234,nsh_c1=0x11223344 actions=decap(),decap(),output:2
76 ip,in_port=1 actions=encap(nsh(md_type=1)),set_field:0x1234->nsh_spi,set_field:0x11223344->nsh_c1,encap(ethernet),set_field:11:22:33:44:55:66->eth_dst,output:3
77])
78
79# TODO:
80# The fields nw_proto, nw_tos, nw_ecn, nw_ttl in final flow seem unnecessary. Can they be avoided?
81# The match on dl_dst=66:77:88:99:aa:bb in the Megaflow is a side effect of setting the dl_dst in the pushed outer
82# Ethernet header. It is a consequence of using wc->masks both for tracking matched and set bits and seems hard to
83# avoid except by using separate masks for both purposes.
84
85AT_CHECK([
86 ovs-appctl ofproto/trace br0 'in_port=1,icmp,dl_src=00:11:22:33:44:55,dl_dst=66:77:88:99:aa:bb,nw_dst=10.10.10.10,nw_src=20.20.20.20'
87], [0], [dnl
88Flow: icmp,in_port=1,vlan_tci=0x0000,dl_src=00:11:22:33:44:55,dl_dst=66:77:88:99:aa:bb,nw_src=20.20.20.20,nw_dst=10.10.10.10,nw_tos=0,nw_ecn=0,nw_ttl=0,icmp_type=0,icmp_code=0
89
90bridge("br0")
91-------------
92 0. ip,in_port=1, priority 32768
93 encap(nsh(md_type=1))
94 set_field:0x1234->nsh_spi
95 set_field:0x11223344->nsh_c1
96 encap(ethernet)
97 set_field:11:22:33:44:55:66->eth_dst
98 output:3
99
100bridge("br0")
101-------------
102 0. in_port=4,dl_type=0x894f,nsh_mdtype=1,nsh_spi=0x1234,nsh_c1=0x11223344, priority 32768
103 decap()
104 decap()
105
17553f27 106Final flow: in_port=1,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=11:22:33:44:55:66,dl_type=0x894f,nsh_flags=0,nsh_ttl=63,nsh_mdtype=1,nsh_np=3,nsh_spi=0x1234,nsh_si=255,nsh_c1=0x11223344,nsh_c2=0x0,nsh_c3=0x0,nsh_c4=0x0,nw_proto=0,nw_tos=0,nw_ecn=0,nw_ttl=0
cc6902fe 107Megaflow: recirc_id=0,eth,ip,in_port=1,dl_dst=66:77:88:99:aa:bb,nw_frag=no
17553f27 108Datapath actions: push_nsh(flags=0,ttl=63,mdtype=1,np=3,spi=0x1234,si=255,c1=0x11223344,c2=0x0,c3=0x0,c4=0x0),push_eth(src=00:00:00:00:00:00,dst=11:22:33:44:55:66),pop_eth,pop_nsh(),set(eth(dst=11:22:33:44:55:66)),recirc(0x1)
cc6902fe
JS
109])
110
111AT_CHECK([
112 ovs-appctl ofproto/trace br0 'in_port=4,dl_type=0x894f,nsh_mdtype=1,nsh_np=3,nsh_spi=0x1234,nsh_c1=0x11223344'
113], [0], [dnl
17553f27 114Flow: in_port=4,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=00:00:00:00:00:00,dl_type=0x894f,nsh_flags=0,nsh_ttl=0,nsh_mdtype=1,nsh_np=3,nsh_spi=0x1234,nsh_si=0,nsh_c1=0x11223344,nsh_c2=0x0,nsh_c3=0x0,nsh_c4=0x0,nw_proto=0,nw_tos=0,nw_ecn=0,nw_ttl=0
cc6902fe
JS
115
116bridge("br0")
117-------------
118 0. in_port=4,dl_type=0x894f,nsh_mdtype=1,nsh_spi=0x1234,nsh_c1=0x11223344, priority 32768
119 decap()
120 decap()
121
122Final flow: unchanged
123Megaflow: recirc_id=0,eth,in_port=4,dl_type=0x894f,nsh_mdtype=1,nsh_np=3,nsh_spi=0x1234,nsh_c1=0x11223344
f59cb331 124Datapath actions: pop_eth,pop_nsh(),recirc(0x2)
cc6902fe
JS
125])
126
127# Now send two real ICMP echo request packets in on port p1
128
129AT_CHECK([
130 ovs-appctl netdev-dummy/receive p1 1e2ce92a669e3a6dd2099cab0800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637
131 ovs-appctl netdev-dummy/receive p1 1e2ce92a669e3a6dd2099cab0800450000548a83400040011aadc0a80a0ac0a80a1e0800b7170a4d0002fd509a5800000000de1c020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637
132], [0], [ignore])
133
134ovs-appctl time/warp 1000
135
136# A packet count of 1 in the megaflow entries means the first packet was processed by
137# the ofproto slow path and the second successfully by the datapath flow entry.
138
139AT_CHECK([
140 ovs-appctl dpctl/dump-flows dummy@ovs-dummy | strip_used | grep -v ipv6 | sort
141], [0], [flow-dump from non-dpdk interfaces:
17553f27 142recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(dst=1e:2c:e9:2a:66:9e),eth_type(0x0800),ipv4(frag=no), packets:1, bytes:98, used:0.0s, actions:push_nsh(flags=0,ttl=63,mdtype=1,np=3,spi=0x1234,si=255,c1=0x11223344,c2=0x0,c3=0x0,c4=0x0),push_eth(src=00:00:00:00:00:00,dst=11:22:33:44:55:66),pop_eth,pop_nsh(),set(eth(dst=11:22:33:44:55:66)),recirc(0x3)
cc6902fe
JS
143recirc_id(0x3),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:1, bytes:98, used:0.0s, actions:2
144])
145
146# Verify, that VLAN tagged packets can be encapsulated by NSH header.
147ovs-appctl time/warp 10000
148
149AT_DATA([flows.txt], [dnl
150 table=0,in_port=1,actions=push_vlan:0x8100,mod_vlan_vid:100,3
151 table=0,in_port=4,actions=encap(nsh),decap(),2
152])
153
154AT_CHECK([
155 ovs-ofctl del-flows br0
156 ovs-ofctl -Oopenflow13 add-flows br0 flows.txt
157 ovs-ofctl -Oopenflow13 dump-flows br0 | ofctl_strip | sort | grep actions
158], [0], [dnl
159 in_port=1 actions=push_vlan:0x8100,set_field:4196->vlan_vid,output:3
160 in_port=4 actions=encap(nsh),decap(),output:2
161])
162
163AT_CHECK([
164 ovs-appctl netdev-dummy/receive p1 1e2ce92a669e3a6dd2099cab0800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637
165 ovs-appctl netdev-dummy/receive p1 1e2ce92a669e3a6dd2099cab0800450000548a83400040011aadc0a80a0ac0a80a1e0800b7170a4d0002fd509a5800000000de1c020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637
166], [0], [ignore])
167
f59cb331
YY
168ovs-appctl time/warp 1000
169ovs-appctl time/warp 1000
cc6902fe
JS
170ovs-appctl time/warp 1000
171
172AT_CHECK([
173 ovs-appctl dpctl/dump-flows dummy@ovs-dummy | strip_used | grep -v ipv6 | sort
174], [0], [flow-dump from non-dpdk interfaces:
17553f27 175recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:1, bytes:98, used:0.0s, actions:push_vlan(vid=100,pcp=0),push_nsh(flags=0,ttl=63,mdtype=1,np=3,spi=0x0,si=255,c1=0x0,c2=0x0,c3=0x0,c4=0x0),pop_nsh(),recirc(0x4)
cc6902fe
JS
176recirc_id(0x4),in_port(1),packet_type(ns=0,id=0),eth_type(0x8100),vlan(vid=100,pcp=0),encap(eth_type(0x0800),ipv4(frag=no)), packets:1, bytes:102, used:0.0s, actions:2
177])
178
179OVS_VSWITCHD_STOP
180AT_CLEANUP
181
182
183### -----------------------------------------------------------------
184### NSH MD2 on Ethernet encapsulation over veth link
185### -----------------------------------------------------------------
186
187AT_SETUP([nsh - md2 encap over a veth link])
188
189OVS_VSWITCHD_START([])
190
191AT_CHECK([
192ovs-vsctl set bridge br0 datapath_type=dummy \
193 protocols=OpenFlow10,OpenFlow13,OpenFlow14,OpenFlow15 -- \
194 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
195 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2 -- \
196 add-port br0 v3 -- set Interface v3 type=patch options:peer=v4 ofport_request=3 -- \
197 add-port br0 v4 -- set Interface v4 type=patch options:peer=v3 ofport_request=4])
198
199AT_DATA([flows.txt], [dnl
f59cb331 200 table=0,in_port=1,ip,actions=encap(nsh(md_type=2,tlv(0x1000,10,0x12345678),tlv(0x2000,20,0xfedcba9876543210))),set_field:0x1234->nsh_spi,encap(ethernet),set_field:11:22:33:44:55:66->dl_dst,3
cc6902fe
JS
201 table=0,in_port=4,dl_type=0x894f,nsh_mdtype=2,nsh_spi=0x1234,actions=decap(),decap(),2
202])
203
204AT_CHECK([
205 ovs-ofctl del-flows br0
206 ovs-ofctl -Oopenflow13 add-flows br0 flows.txt
207 ovs-ofctl -Oopenflow13 dump-flows br0 | ofctl_strip | sort | grep actions
208], [0], [dnl
209 in_port=4,dl_type=0x894f,nsh_mdtype=2,nsh_spi=0x1234 actions=decap(),decap(),output:2
f59cb331 210 ip,in_port=1 actions=encap(nsh(md_type=2,tlv(0x1000,10,0x12345678),tlv(0x2000,20,0xfedcba9876543210))),set_field:0x1234->nsh_spi,encap(ethernet),set_field:11:22:33:44:55:66->eth_dst,output:3
cc6902fe
JS
211])
212
213AT_CHECK([
214 ovs-appctl ofproto/trace br0 'in_port=1,icmp,dl_src=00:11:22:33:44:55,dl_dst=66:77:88:99:aa:bb,nw_dst=10.10.10.10,nw_src=20.20.20.20'
215], [0], [dnl
216Flow: icmp,in_port=1,vlan_tci=0x0000,dl_src=00:11:22:33:44:55,dl_dst=66:77:88:99:aa:bb,nw_src=20.20.20.20,nw_dst=10.10.10.10,nw_tos=0,nw_ecn=0,nw_ttl=0,icmp_type=0,icmp_code=0
217
218bridge("br0")
219-------------
220 0. ip,in_port=1, priority 32768
f59cb331 221 encap(nsh(md_type=2,tlv(0x1000,10,0x12345678),tlv(0x2000,20,0xfedcba9876543210)))
cc6902fe
JS
222 set_field:0x1234->nsh_spi
223 encap(ethernet)
224 set_field:11:22:33:44:55:66->eth_dst
225 output:3
226
227bridge("br0")
228-------------
229 0. in_port=4,dl_type=0x894f,nsh_mdtype=2,nsh_spi=0x1234, priority 32768
230 decap()
231 decap()
232
17553f27 233Final flow: in_port=1,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=11:22:33:44:55:66,dl_type=0x894f,nsh_flags=0,nsh_ttl=63,nsh_mdtype=2,nsh_np=3,nsh_spi=0x1234,nsh_si=255,nw_proto=0,nw_tos=0,nw_ecn=0,nw_ttl=0
cc6902fe 234Megaflow: recirc_id=0,eth,ip,in_port=1,dl_dst=66:77:88:99:aa:bb,nw_frag=no
17553f27 235Datapath actions: push_nsh(flags=0,ttl=63,mdtype=2,np=3,spi=0x1234,si=255,md2=0x10000a041234567820001408fedcba9876543210),push_eth(src=00:00:00:00:00:00,dst=11:22:33:44:55:66),pop_eth,pop_nsh(),set(eth(dst=11:22:33:44:55:66)),recirc(0x1)
cc6902fe
JS
236])
237
238AT_CHECK([
239 ovs-appctl ofproto/trace br0 'in_port=4,dl_type=0x894f,nsh_mdtype=2,nsh_np=3,nsh_spi=0x1234'
240], [0], [dnl
17553f27 241Flow: in_port=4,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=00:00:00:00:00:00,dl_type=0x894f,nsh_flags=0,nsh_ttl=0,nsh_mdtype=2,nsh_np=3,nsh_spi=0x1234,nsh_si=0,nw_proto=0,nw_tos=0,nw_ecn=0,nw_ttl=0
cc6902fe
JS
242
243bridge("br0")
244-------------
245 0. in_port=4,dl_type=0x894f,nsh_mdtype=2,nsh_spi=0x1234, priority 32768
246 decap()
247 decap()
248
249Final flow: unchanged
250Megaflow: recirc_id=0,eth,in_port=4,dl_type=0x894f,nsh_mdtype=2,nsh_np=3,nsh_spi=0x1234
f59cb331 251Datapath actions: pop_eth,pop_nsh(),recirc(0x2)
cc6902fe
JS
252])
253
254# Now send two real ICMP echo request packets in on port p1
255
256AT_CHECK([
257 ovs-appctl netdev-dummy/receive p1 1e2ce92a669e3a6dd2099cab0800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637
258 ovs-appctl netdev-dummy/receive p1 1e2ce92a669e3a6dd2099cab0800450000548a83400040011aadc0a80a0ac0a80a1e0800b7170a4d0002fd509a5800000000de1c020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637
259], [0], [ignore])
260
261ovs-appctl time/warp 1000
262
263# A packet count of 1 in the megaflow entries means the first packet was processed by
264# the ofproto slow path and the second successfully by the datapath flow entry.
265
266AT_CHECK([
267 ovs-appctl dpctl/dump-flows dummy@ovs-dummy | strip_used | grep -v ipv6 | sort
268], [0], [flow-dump from non-dpdk interfaces:
17553f27 269recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(dst=1e:2c:e9:2a:66:9e),eth_type(0x0800),ipv4(frag=no), packets:1, bytes:98, used:0.0s, actions:push_nsh(flags=0,ttl=63,mdtype=2,np=3,spi=0x1234,si=255,md2=0x10000a041234567820001408fedcba9876543210),push_eth(src=00:00:00:00:00:00,dst=11:22:33:44:55:66),pop_eth,pop_nsh(),set(eth(dst=11:22:33:44:55:66)),recirc(0x3)
cc6902fe
JS
270recirc_id(0x3),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:1, bytes:98, used:0.0s, actions:2
271])
272
273
274OVS_VSWITCHD_STOP
275AT_CLEANUP
276
277
a5b3e2a6
JS
278### -----------------------------------------------------------------
279### Double NSH MD1 encapsulation using groups over veth link
280### -----------------------------------------------------------------
281
282AT_SETUP([nsh - double encap over veth link using groups])
283
284OVS_VSWITCHD_START([])
285
286AT_CHECK([
287ovs-vsctl set bridge br0 datapath_type=dummy \
288 protocols=OpenFlow10,OpenFlow13,OpenFlow14,OpenFlow15 -- \
289 add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 -- \
290 add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2 -- \
291 add-port br0 v3 -- set Interface v3 type=patch options:peer=v4 ofport_request=3 -- \
292 add-port br0 v4 -- set Interface v4 type=patch options:peer=v3 ofport_request=4])
293
294AT_DATA([flows.txt], [dnl
295 table=0,in_port=1,ip,actions=group:100
296 table=0,in_port=4,packet_type=(0,0),dl_type=0x894f,nsh_mdtype=1,nsh_spi=0x5678,nsh_c1=0x55667788,actions=decap(),goto_table:1
297 table=1,packet_type=(1,0x894f),nsh_mdtype=1,nsh_spi=0x5678,nsh_c1=0x55667788,actions=decap(),goto_table:2
298 table=2,packet_type=(1,0x894f),nsh_mdtype=1,nsh_spi=0x1234,nsh_c1=0x11223344,actions=decap(),output:2
299])
300
301AT_DATA([groups.txt], [dnl
302 add group_id=100,type=indirect,bucket=actions=encap(nsh(md_type=1)),set_field:0x1234->nsh_spi,set_field:0x11223344->nsh_c1,group:200
303 add group_id=200,type=indirect,bucket=actions=encap(nsh(md_type=1)),set_field:0x5678->nsh_spi,set_field:0x55667788->nsh_c1,group:300
304 add group_id=300,type=indirect,bucket=actions=encap(ethernet),set_field:11:22:33:44:55:66->dl_dst,3
305])
306
307AT_CHECK([
308 ovs-ofctl del-flows br0
309 ovs-ofctl -Oopenflow13 add-groups br0 groups.txt
310 ovs-ofctl -Oopenflow13 add-flows br0 flows.txt
311 ovs-ofctl -Oopenflow13 dump-flows br0 | ofctl_strip | sort | grep actions
312], [0], [dnl
313 in_port=4,dl_type=0x894f,nsh_mdtype=1,nsh_spi=0x5678,nsh_c1=0x55667788 actions=decap(),goto_table:1
314 ip,in_port=1 actions=group:100
315 table=1, packet_type=(1,0x894f),nsh_mdtype=1,nsh_spi=0x5678,nsh_c1=0x55667788 actions=decap(),goto_table:2
316 table=2, packet_type=(1,0x894f),nsh_mdtype=1,nsh_spi=0x1234,nsh_c1=0x11223344 actions=decap(),output:2
317])
318
319# TODO:
320# The fields nw_proto, nw_tos, nw_ecn, nw_ttl in final flow seem unnecessary. Can they be avoided?
321# The match on dl_dst=66:77:88:99:aa:bb in the Megaflow is a side effect of setting the dl_dst in the pushed outer
322# Ethernet header. It is a consequence of using wc->masks both for tracking matched and set bits and seems hard to
323# avoid except by using separate masks for both purposes.
324
325AT_CHECK([
326 ovs-appctl ofproto/trace br0 'in_port=1,icmp,dl_src=00:11:22:33:44:55,dl_dst=66:77:88:99:aa:bb,nw_dst=10.10.10.10,nw_src=20.20.20.20'
327], [0], [dnl
328Flow: icmp,in_port=1,vlan_tci=0x0000,dl_src=00:11:22:33:44:55,dl_dst=66:77:88:99:aa:bb,nw_src=20.20.20.20,nw_dst=10.10.10.10,nw_tos=0,nw_ecn=0,nw_ttl=0,icmp_type=0,icmp_code=0
329
330bridge("br0")
331-------------
332 0. ip,in_port=1, priority 32768
333 group:100
fac4786a
BP
334 bucket 0
335 encap(nsh(md_type=1))
336 set_field:0x1234->nsh_spi
337 set_field:0x11223344->nsh_c1
338 group:200
339 bucket 0
340 encap(nsh(md_type=1))
341 set_field:0x5678->nsh_spi
342 set_field:0x55667788->nsh_c1
343 group:300
344 bucket 0
345 encap(ethernet)
346 set_field:11:22:33:44:55:66->eth_dst
347 output:3
348
349 bridge("br0")
350 -------------
351 0. in_port=4,dl_type=0x894f,nsh_mdtype=1,nsh_spi=0x5678,nsh_c1=0x55667788, priority 32768
352 decap()
353 goto_table:1
354 1. packet_type=(1,0x894f),nsh_mdtype=1,nsh_spi=0x5678,nsh_c1=0x55667788, priority 32768
355 decap()
a5b3e2a6
JS
356
357Final flow: unchanged
358Megaflow: recirc_id=0,eth,ip,in_port=1,dl_dst=66:77:88:99:aa:bb,nw_frag=no
359Datapath actions: push_nsh(flags=0,ttl=63,mdtype=1,np=3,spi=0x1234,si=255,c1=0x11223344,c2=0x0,c3=0x0,c4=0x0),push_nsh(flags=0,ttl=63,mdtype=1,np=4,spi=0x5678,si=255,c1=0x55667788,c2=0x0,c3=0x0,c4=0x0),push_eth(src=00:00:00:00:00:00,dst=11:22:33:44:55:66),pop_eth,pop_nsh(),recirc(0x1)
360])
361
362AT_CHECK([
363 ovs-appctl ofproto/trace br0 'recirc_id=1,in_port=4,packet_type=(1,0x894f),nsh_mdtype=1,nsh_np=3,nsh_spi=0x1234,nsh_c1=0x11223344'
364], [0], [dnl
365Flow: recirc_id=0x1,packet_type=(1,0x894f),in_port=4
366
367bridge("br0")
368-------------
369 thaw
370 Resuming from table 0
371 Restoring actions: goto_table:2
372 goto_table:2
373 2. packet_type=(1,0x894f),nsh_mdtype=1,nsh_spi=0x1234,nsh_c1=0x11223344, priority 32768
374 decap()
375
376Final flow: recirc_id=0x1,eth,in_port=4,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=00:00:00:00:00:00,dl_type=0x0000
29b5c0c3 377Megaflow: recirc_id=0x1,packet_type=(1,0x894f),in_port=4,dl_type=0x894f,nsh_mdtype=1,nsh_np=3,nsh_spi=0x1234,nsh_c1=0x11223344
a5b3e2a6
JS
378Datapath actions: pop_nsh(),recirc(0x2)
379])
380
381AT_CHECK([
382 ovs-appctl ofproto/trace br0 'recirc_id=2,in_port=4,ip'
383], [0], [dnl
384Flow: recirc_id=0x2,eth,ip,in_port=4,vlan_tci=0x0000,dl_src=00:00:00:00:00:00,dl_dst=00:00:00:00:00:00,nw_src=0.0.0.0,nw_dst=0.0.0.0,nw_proto=0,nw_tos=0,nw_ecn=0,nw_ttl=0
385
386bridge("br0")
387-------------
388 thaw
389 Resuming from table 0
390 Restoring actions: unroll_xlate(table=2, cookie=0),output:2
391 unroll_xlate(table=2, cookie=0)
392 restored state: table=2, cookie=0
393 output:2
394
395Final flow: unchanged
396Megaflow: recirc_id=0x2,eth,ip,in_port=4,nw_frag=no
397Datapath actions: 2
398])
399
400# Now send two real ICMP echo request packets in on port p1
401
402AT_CHECK([
403 ovs-appctl netdev-dummy/receive p1 1e2ce92a669e3a6dd2099cab0800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637
404 ovs-appctl netdev-dummy/receive p1 1e2ce92a669e3a6dd2099cab0800450000548a83400040011aadc0a80a0ac0a80a1e0800b7170a4d0002fd509a5800000000de1c020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637
405], [0], [ignore])
406
407ovs-appctl time/warp 1000
408
409# A packet count of 1 in the megaflow entries means the first packet was processed by
410# the ofproto slow path and the second successfully by the datapath flow entry.
411
412AT_CHECK([
413 ovs-appctl dpctl/dump-flows dummy@ovs-dummy | strip_used | grep -v ipv6 | sort
414], [0], [flow-dump from non-dpdk interfaces:
415recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(dst=1e:2c:e9:2a:66:9e),eth_type(0x0800),ipv4(frag=no), packets:1, bytes:98, used:0.0s, actions:push_nsh(flags=0,ttl=63,mdtype=1,np=3,spi=0x1234,si=255,c1=0x11223344,c2=0x0,c3=0x0,c4=0x0),push_nsh(flags=0,ttl=63,mdtype=1,np=4,spi=0x5678,si=255,c1=0x55667788,c2=0x0,c3=0x0,c4=0x0),push_eth(src=00:00:00:00:00:00,dst=11:22:33:44:55:66),pop_eth,pop_nsh(),recirc(0x3)
29b5c0c3 416recirc_id(0x3),in_port(1),packet_type(ns=1,id=0x894f),eth_type(0x894f),nsh(mdtype=1,np=3,spi=0x1234,c1=0x11223344), packets:1, bytes:122, used:0.0s, actions:pop_nsh(),recirc(0x4)
a5b3e2a6
JS
417recirc_id(0x4),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:1, bytes:98, used:0.0s, actions:2
418])
419
420OVS_VSWITCHD_STOP
421AT_CLEANUP
422
423
cc6902fe
JS
424### -----------------------------------------------------------------
425### Triangle bridge setup with VXLAN-GPE tunnels
426### -----------------------------------------------------------------
427
428########################
429# VxLAN-gpe + NSH tunneling test setup for PTAP bridge
430#
431# 192.168.10.10 192.168.10.20 192.168.10.30
432# n1 n2 n3
433# |ovs-n1 |ovs-n2 |ovs-n3
434# +------o------+ +------o------+ +------o------+
435# | br-in1 | | br-in2 | | br-in3 |
436# | (PTAP) | | (PTAP) | | (PTAP) |
437# +------o------+ +------o------+ +------o------+
438# vxlan-gpe vxlan-gpe vxlan-gpe
439# 10.0.0.1 (10.0.0.2) (10.0.0.3)
440# (20.0.0.1) 20.0.0.2 (20.0.0.3)
441# (30.0.0.1) LOCAL (30.0.0.2) LOCAL 30.0.0.3 LOCAL
442# +-----------o-+ +-----------o-+ +-----------o-+
443# | br-p1 | | br-p2 | | br-p3 |
444# +------o------+ +------o------+ +------o------+
445# p1-0 | | p2-0 | p3-0
446# p0-1 | | p0-2 | p0-3
447# +--o------------------------o-------------------------o--+
448# | br0 |
449# +--------------------------------------------------------+
450#
451# VxLAN-gpe tunnel ports:
452#
453# No Bridge Name Packet-type Remote bridge & ports
454# -----------------------------------------------------------------------
455# 1020 br-in1 vxlangpe12 ptap br-in2 2010 (ptap)
456# 1030 br-in1 vxlangpe13 ptap br-in3 3010 (ptap)
457# 2010 br-in2 vxlangpe21 ptap br-in1 1020 (ptap)
458# 2030 br-in2 vxlangpe13 ptap br-in3 3020 (ptap)
459# 3010 br-in1 vxlangpe31 ptap br-in1 1030 (ptap)
460# 3020 br-in1 vxlangpe32 ptap br-in2 2010 (ptap)
461
462AT_SETUP([nsh - triangle PTAP bridge setup with NSH over vxlan-gpe])
463
464OVS_VSWITCHD_START([])
465
466HWADDR_BRP1=aa:55:00:00:00:01
467HWADDR_BRP2=aa:55:00:00:00:02
468HWADDR_BRP3=aa:55:00:00:00:03
469
470# Setup bridge infrastructure
471AT_CHECK([
472 ovs-vsctl add-br br-in1 -- \
473 set bridge br-in1 datapath_type=dummy fail-mode=standalone
474 ovs-vsctl add-br br-in2 -- \
475 set bridge br-in2 datapath_type=dummy fail-mode=standalone
476 ovs-vsctl add-br br-in3 -- \
477 set bridge br-in3 datapath_type=dummy fail-mode=standalone
478 ovs-vsctl add-br br-p1 -- \
479 set bridge br-p1 datapath_type=dummy fail-mode=standalone other-config:hwaddr=$HWADDR_BRP1
480 ovs-vsctl add-br br-p2 -- \
481 set bridge br-p2 datapath_type=dummy fail-mode=standalone other-config:hwaddr=$HWADDR_BRP2
482 ovs-vsctl add-br br-p3 -- \
483 set bridge br-p3 datapath_type=dummy fail-mode=standalone other-config:hwaddr=$HWADDR_BRP3
484
485 ovs-vsctl add-port br-p1 p1-0 -- set interface p1-0 type=patch options:peer=p0-1 ofport_request=2
486 ovs-vsctl add-port br-p2 p2-0 -- set interface p2-0 type=patch options:peer=p0-2 ofport_request=2
487 ovs-vsctl add-port br-p3 p3-0 -- set interface p3-0 type=patch options:peer=p0-3 ofport_request=2
488 ovs-vsctl add-port br0 p0-1 -- set interface p0-1 type=patch options:peer=p1-0 ofport_request=10
489 ovs-vsctl add-port br0 p0-2 -- set interface p0-2 type=patch options:peer=p2-0 ofport_request=20
490 ovs-vsctl add-port br0 p0-3 -- set interface p0-3 type=patch options:peer=p3-0 ofport_request=30
491
492 # Populate the MAC table of br0
493 ovs-ofctl del-flows br0
494 ovs-ofctl add-flow br0 dl_dst=$HWADDR_BRP1,actions=10
495 ovs-ofctl add-flow br0 dl_dst=$HWADDR_BRP2,actions=20
496 ovs-ofctl add-flow br0 dl_dst=$HWADDR_BRP3,actions=30
497
498 ovs-ofctl del-flows br-in1
499 ovs-ofctl del-flows br-in2
500 ovs-ofctl del-flows br-in3
501 ovs-ofctl del-flows br-p1
502 ovs-ofctl del-flows br-p2
503 ovs-ofctl del-flows br-p3
504], [0])
505
506### Setup vxlan-gpe tunnels
507AT_CHECK([
508 ovs-vsctl add-port br-in1 vxlangpe12 -- \
509 set interface vxlangpe12 type=vxlan options:exts=gpe options:remote_ip=10.0.0.2 options:packet_type=ptap ofport_request=1020
510 ovs-vsctl add-port br-in1 vxlangpe13 -- \
511 set interface vxlangpe13 type=vxlan options:exts=gpe options:remote_ip=10.0.0.3 options:packet_type=ptap ofport_request=1030
512
513 ovs-vsctl add-port br-in2 vxlangpe21 -- \
514 set interface vxlangpe21 type=vxlan options:exts=gpe options:remote_ip=20.0.0.1 options:packet_type=ptap ofport_request=2010
515 ovs-vsctl add-port br-in2 vxlangpe23 -- \
516 set interface vxlangpe23 type=vxlan options:exts=gpe options:remote_ip=20.0.0.3 options:packet_type=ptap ofport_request=2030
517
518 ovs-vsctl add-port br-in3 vxlangpe31 -- \
519 set interface vxlangpe31 type=vxlan options:exts=gpe options:remote_ip=30.0.0.1 options:packet_type=ptap ofport_request=3010
520 ovs-vsctl add-port br-in3 vxlangpe32 -- \
521 set interface vxlangpe32 type=vxlan options:exts=gpe options:remote_ip=30.0.0.2 options:packet_type=ptap ofport_request=3020
522
523 ovs-appctl netdev-dummy/ip4addr br-p1 10.0.0.1/24
524 ovs-appctl ovs/route/add 10.0.0.0/24 br-p1
525 ovs-appctl tnl/arp/set br-p1 10.0.0.1 $HWADDR_BRP1
526 ovs-appctl tnl/arp/set br-p1 10.0.0.2 $HWADDR_BRP2
527 ovs-appctl tnl/arp/set br-p1 10.0.0.3 $HWADDR_BRP3
528
529 ovs-appctl netdev-dummy/ip4addr br-p2 20.0.0.2/24
530 ovs-appctl ovs/route/add 20.0.0.0/24 br-p2
531 ovs-appctl tnl/arp/set br-p2 20.0.0.1 $HWADDR_BRP1
532 ovs-appctl tnl/arp/set br-p2 20.0.0.2 $HWADDR_BRP2
533 ovs-appctl tnl/arp/set br-p2 20.0.0.3 $HWADDR_BRP3
534
535 ovs-appctl netdev-dummy/ip4addr br-p3 30.0.0.3/24
536 ovs-appctl ovs/route/add 30.0.0.0/24 br-p3
537 ovs-appctl tnl/arp/set br-p3 30.0.0.1 $HWADDR_BRP1
538 ovs-appctl tnl/arp/set br-p3 30.0.0.2 $HWADDR_BRP2
539 ovs-appctl tnl/arp/set br-p3 30.0.0.3 $HWADDR_BRP3
540], [0], [stdout])
541
542AT_CHECK([
543 ovs-appctl ovs/route/add 10.0.0.0/24 br-p1
544 ovs-appctl tnl/arp/set br-p1 10.0.0.1 $HWADDR_BRP1
545 ovs-appctl tnl/arp/set br-p1 10.0.0.2 $HWADDR_BRP2
546 ovs-appctl tnl/arp/set br-p1 10.0.0.3 $HWADDR_BRP3
547], [0], [stdout])
548
549AT_CHECK([
550 ovs-appctl ovs/route/add 20.0.0.0/24 br-p2
551 ovs-appctl tnl/arp/set br-p2 20.0.0.1 $HWADDR_BRP1
552 ovs-appctl tnl/arp/set br-p2 20.0.0.2 $HWADDR_BRP2
553 ovs-appctl tnl/arp/set br-p2 20.0.0.3 $HWADDR_BRP3
554], [0], [stdout])
555
556AT_CHECK([
557 ovs-appctl ovs/route/add 30.0.0.0/24 br-p3
558 ovs-appctl tnl/arp/set br-p3 30.0.0.1 $HWADDR_BRP1
559 ovs-appctl tnl/arp/set br-p3 30.0.0.2 $HWADDR_BRP2
560 ovs-appctl tnl/arp/set br-p3 30.0.0.3 $HWADDR_BRP3
561], [0], [stdout])
562
563AT_CHECK([
564 ovs-appctl ovs/route/show | grep User:
565], [0], [dnl
566User: 10.0.0.0/24 dev br-p1 SRC 10.0.0.1
567User: 20.0.0.0/24 dev br-p2 SRC 20.0.0.2
568User: 30.0.0.0/24 dev br-p3 SRC 30.0.0.3
569])
570
571AT_CHECK([
572 ovs-appctl tnl/neigh/show | grep br-p | sort
573], [0], [stdout])
574
575
576### Flows in br-p<x>to twist TEP IP addresses in tunnel IP headers
577AT_CHECK([
578 ovs-ofctl add-flow br-p1 in_port:LOCAL,actions=2
579 ovs-ofctl add-flow br-p1 in_port:2,ip,nw_dst:20.0.0.1,actions=mod_nw_dst:10.0.0.1,mod_nw_src:10.0.0.2,LOCAL
580 ovs-ofctl add-flow br-p1 in_port:2,ip,nw_dst:30.0.0.1,actions=mod_nw_dst:10.0.0.1,mod_nw_src:10.0.0.3,LOCAL
581
582 ovs-ofctl add-flow br-p2 in_port:LOCAL,actions=2
583 ovs-ofctl add-flow br-p2 in_port:2,ip,nw_dst:10.0.0.2,actions=mod_nw_dst:20.0.0.2,mod_nw_src:20.0.0.1,LOCAL
584 ovs-ofctl add-flow br-p2 in_port:2,ip,nw_dst:30.0.0.2,actions=mod_nw_dst:20.0.0.2,mod_nw_src:20.0.0.3,LOCAL
585
586 ovs-ofctl add-flow br-p3 in_port:LOCAL,actions=2
587 ovs-ofctl add-flow br-p3 in_port:2,ip,nw_dst:10.0.0.3,actions=mod_nw_dst:30.0.0.3,mod_nw_src:30.0.0.1,LOCAL
588 ovs-ofctl add-flow br-p3 in_port:2,ip,nw_dst:20.0.0.3,actions=mod_nw_dst:30.0.0.3,mod_nw_src:30.0.0.2,LOCAL
589], [0])
590
591AT_CHECK([
592 ovs-ofctl dump-flows br-p1 | ofctl_strip | sort | grep actions
593 ovs-ofctl dump-flows br-p2 | ofctl_strip | sort | grep actions
594 ovs-ofctl dump-flows br-p3 | ofctl_strip | sort | grep actions
595], [0], [dnl
596 in_port=LOCAL actions=output:2
597 ip,in_port=2,nw_dst=20.0.0.1 actions=mod_nw_dst:10.0.0.1,mod_nw_src:10.0.0.2,LOCAL
598 ip,in_port=2,nw_dst=30.0.0.1 actions=mod_nw_dst:10.0.0.1,mod_nw_src:10.0.0.3,LOCAL
599 in_port=LOCAL actions=output:2
600 ip,in_port=2,nw_dst=10.0.0.2 actions=mod_nw_dst:20.0.0.2,mod_nw_src:20.0.0.1,LOCAL
601 ip,in_port=2,nw_dst=30.0.0.2 actions=mod_nw_dst:20.0.0.2,mod_nw_src:20.0.0.3,LOCAL
602 in_port=LOCAL actions=output:2
603 ip,in_port=2,nw_dst=10.0.0.3 actions=mod_nw_dst:30.0.0.3,mod_nw_src:30.0.0.1,LOCAL
604 ip,in_port=2,nw_dst=20.0.0.3 actions=mod_nw_dst:30.0.0.3,mod_nw_src:30.0.0.2,LOCAL
605])
606
607### Setup test ports for traffic injection
608N1_IP=192.168.10.10
609N2_IP=192.168.10.20
610N3_IP=192.168.10.30
611N1_MAC=aa:55:aa:55:00:01
612N2_MAC=aa:55:aa:55:00:02
613N3_MAC=aa:55:aa:55:00:03
614N1_OFPORT=10
615N2_OFPORT=20
616N3_OFPORT=30
617
618AT_CHECK([
619 ovs-vsctl add-port br-in1 n1 -- \
620 set interface n1 type=dummy ofport_request=$N1_OFPORT options:tx_pcap=n1.pcap
621 ovs-vsctl add-port br-in2 n2 -- \
622 set interface n2 type=dummy ofport_request=$N2_OFPORT options:tx_pcap=n2.pcap
623 ovs-vsctl add-port br-in3 n3 -- \
624 set interface n3 type=dummy ofport_request=$N3_OFPORT options:tx_pcap=n3.pcap
625], [0])
626
627#N1_DPPORT=$(ovs-appctl dpif/show | grep "n1 10" | sed 's|.*/\([[0-9]]*\):.*|\1|')
628#N2_DPPORT=$(ovs-appctl dpif/show | grep "n2 20" | sed 's|.*/\([[0-9]]*\):.*|\1|')
629#N3_DPPORT=$(ovs-appctl dpif/show | grep "n3 30" | sed 's|.*/\([[0-9]]*\):.*|\1|')
630
631### Verify datapath configuration
7be29a47
BP
632AT_CHECK([ovs-appctl dpif/show | grep -v hit], [0], [dnl
633 br-in1:
634 br-in1 65534/101: (dummy-internal)
635 n1 10/4: (dummy)
636 vxlangpe12 1020/4789: (vxlan: packet_type=ptap, remote_ip=10.0.0.2)
637 vxlangpe13 1030/4789: (vxlan: packet_type=ptap, remote_ip=10.0.0.3)
638 br-in2:
639 br-in2 65534/102: (dummy-internal)
640 n2 20/5: (dummy)
641 vxlangpe21 2010/4789: (vxlan: packet_type=ptap, remote_ip=20.0.0.1)
642 vxlangpe23 2030/4789: (vxlan: packet_type=ptap, remote_ip=20.0.0.3)
643 br-in3:
644 br-in3 65534/103: (dummy-internal)
645 n3 30/6: (dummy)
646 vxlangpe31 3010/4789: (vxlan: packet_type=ptap, remote_ip=30.0.0.1)
647 vxlangpe32 3020/4789: (vxlan: packet_type=ptap, remote_ip=30.0.0.2)
648 br-p1:
649 br-p1 65534/1: (dummy-internal)
650 p1-0 2/none: (patch: peer=p0-1)
651 br-p2:
652 br-p2 65534/2: (dummy-internal)
653 p2-0 2/none: (patch: peer=p0-2)
654 br-p3:
655 br-p3 65534/3: (dummy-internal)
656 p3-0 2/none: (patch: peer=p0-3)
657 br0:
658 br0 65534/100: (dummy-internal)
659 p0-1 10/none: (patch: peer=p1-0)
660 p0-2 20/none: (patch: peer=p2-0)
661 p0-3 30/none: (patch: peer=p3-0)
cc6902fe
JS
662])
663
664### Setup SFC flow configuration
665
666# br-in1 is SFC classifier (table 1) and final SFF (tables 2,3)
667AT_DATA([br-in1.txt], [dnl
668 table=0,in_port=10,ip,actions=decap(),goto_table:1
669 table=0,in_port=10,packet_type=(1,0x800),actions=goto_table:1
670 table=0,in_port=1020,packet_type=(1,0x894f),actions=goto_table:2
671 table=0,in_port=1030,packet_type=(1,0x894f),actions=goto_table:2
672 table=1,priority=32,packet_type=(1,0x800),nw_dst=192.168.10.30,actions=encap(nsh(md_type=1)),set_field:0x3000->nsh_spi,output:1030
673 table=1,priority=0,packet_type=(1,0x800),nw_dst=0.0.0.0/0,actions=encap(nsh(md_type=1)),set_field:0x3020->nsh_spi,output:1020
674 table=2,packet_type=(1,0x894f),nsh_spi=0x1000,nsh_si=255,actions=decap(),goto_table:3
675 table=2,packet_type=(1,0x894f),nsh_spi=0x1020,nsh_si=254,actions=decap(),goto_table:3
676 table=3,ip,actions=set_field:aa:55:aa:55:00:01->dl_dst,output:10
677 table=3,packet_type=(1,0x800),actions=encap(ethernet),set_field:aa:55:aa:55:00:01->dl_dst,output:10
678])
679
680# br-in2 is intermediate SFF (table 2) and simulated SF (table 4)
681AT_DATA([br-in2.txt], [dnl
682 table=0,in_port=2010,packet_type=(1,0x894f),actions=goto_table:2
683 table=0,in_port=2030,packet_type=(1,0x894f),actions=goto_table:2
684 table=2,packet_type=(1,0x894f),nsh_spi=0x3020,nsh_si=255,actions=encap(ethernet),set_field:11:22:33:44:55:66->dl_dst,goto_table:4
685 table=2,packet_type=(1,0x894f),nsh_spi=0x3020,nsh_si=254,actions=output:2030
686 table=2,packet_type=(1,0x894f),nsh_spi=0x1020,nsh_si=255,actions=encap(ethernet),set_field:77:88:99:aa:bb:cc->dl_dst,goto_table:4
687 table=2,packet_type=(1,0x894f),nsh_spi=0x1020,nsh_si=254,actions=output:2010
688 table=4,dl_type=0x894f,dl_dst=11:22:33:44:55:66,actions=set_field:254->nsh_si,decap(),resubmit(,2)
491e05c2 689 table=4,dl_type=0x894f,dl_dst=77:88:99:aa:bb:cc,actions=dec_nsh_ttl,decap(),resubmit(,2)
cc6902fe
JS
690])
691
692# br-in3 is SFC classifier (table 1) and final SFF (tables 2,3)
693AT_DATA([br-in3.txt], [dnl
694 table=0,in_port=30,ip,actions=decap(),goto_table:1
695 table=0,in_port=30,packet_type=(1,0x800),actions=goto_table:1
696 table=0,in_port=3010,packet_type=(1,0x894f),actions=goto_table:2
697 table=0,in_port=3020,packet_type=(1,0x894f),actions=goto_table:2
698 table=1,priority=32,packet_type=(1,0x800),nw_dst=192.168.10.10,actions=encap(nsh(md_type=1)),set_field:0x1000->nsh_spi,3010
699 table=1,priority=0,packet_type=(1,0x800),nw_dst=0.0.0.0/0,actions=encap(nsh(md_type=1)),set_field:0x1020->nsh_spi,3020
700 table=2,packet_type=(1,0x894f),nsh_spi=0x3000,nsh_si=255,actions=decap(),goto_table:3
701 table=2,packet_type=(1,0x894f),nsh_spi=0x3020,nsh_si=254,actions=decap(),goto_table:3
702 table=3,ip,actions=set_field:aa:55:aa:55:00:03->dl_dst,output:30
703 table=3,packet_type=(1,0x800),actions=encap(ethernet),set_field:aa:55:aa:55:00:03->dl_dst,output:30
704])
705
706AT_CHECK([
707 ovs-ofctl -Oopenflow13 add-flows br-in1 br-in1.txt
708 ovs-ofctl -Oopenflow13 add-flows br-in2 br-in2.txt
709 ovs-ofctl -Oopenflow13 add-flows br-in3 br-in3.txt
710])
711
712### Inject ICMP Echo request test packets
713
714# N1 to N3, via the direct SF path with spi 0x3000
715AT_CHECK([
716 ovs-appctl netdev-dummy/receive n1 1e2ce92a669e3a6dd2099cab0800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637
717 ovs-appctl netdev-dummy/receive n1 1e2ce92a669e3a6dd2099cab0800450000548a83400040011aadc0a80a0ac0a80a1e0800b7170a4d0002fd509a5800000000de1c020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637
718], [0], [ignore])
719
17553f27 720ovs-appctl time/warp 1000
cc6902fe
JS
721ovs-appctl time/warp 1000
722ovs-appctl time/warp 1000
723
724AT_CHECK([
725 ovs-appctl dpctl/dump-flows dummy@ovs-dummy | strip_used | grep -v ipv6 | sort
726], [0], [flow-dump from non-dpdk interfaces:
17553f27 727recirc_id(0),in_port(4),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(dst=192.168.10.30,frag=no), packets:1, bytes:98, used:0.0s, actions:pop_eth,push_nsh(flags=0,ttl=63,mdtype=1,np=1,spi=0x3000,si=255,c1=0x0,c2=0x0,c3=0x0,c4=0x0),clone(tnl_push(tnl_port(4789),header(size=50,type=4,eth(dst=aa:55:00:00:00:03,src=aa:55:00:00:00:01,dl_type=0x0800),ipv4(src=10.0.0.1,dst=10.0.0.3,proto=17,tos=0,ttl=64,frag=0x4000),udp(src=0,dst=4789,csum=0x0),vxlan(flags=0xc000004,vni=0x0)),out_port(1)),set(ipv4(src=30.0.0.1,dst=30.0.0.3)),tnl_pop(4789))
29b5c0c3
BP
728tunnel(tun_id=0x0,src=30.0.0.1,dst=30.0.0.3,flags(-df-csum+key)),recirc_id(0),in_port(4789),packet_type(ns=1,id=0x894f),eth_type(0x894f),nsh(np=1,spi=0x3000,si=255), packets:1, bytes:108, used:0.0s, actions:pop_nsh(),recirc(0x1)
729tunnel(tun_id=0x0,src=30.0.0.1,dst=30.0.0.3,flags(-df-csum+key)),recirc_id(0x1),in_port(4789),packet_type(ns=1,id=0x800),eth_type(0x0800),ipv4(frag=no), packets:1, bytes:84, used:0.0s, actions:push_eth(src=00:00:00:00:00:00,dst=aa:55:aa:55:00:03),6
cc6902fe
JS
730])
731
732AT_CHECK([
733 ovs-ofctl -Oopenflow13 dump-flows br-in1 | ofctl_strip | sort | grep actions
734 ovs-ofctl -Oopenflow13 dump-flows br-in2 | ofctl_strip | sort | grep actions
735 ovs-ofctl -Oopenflow13 dump-flows br-in3 | ofctl_strip | sort | grep actions
736], [0], [dnl
737 n_packets=2, n_bytes=196, ip,in_port=10 actions=decap(),goto_table:1
738 packet_type=(1,0x800),in_port=10 actions=goto_table:1
739 packet_type=(1,0x894f),in_port=1020 actions=goto_table:2
740 packet_type=(1,0x894f),in_port=1030 actions=goto_table:2
741 table=1, n_packets=2, n_bytes=196, priority=32,packet_type=(1,0x800),nw_dst=192.168.10.30 actions=encap(nsh(md_type=1)),set_field:0x3000->nsh_spi,output:1030
742 table=1, priority=0,packet_type=(1,0x800) actions=encap(nsh(md_type=1)),set_field:0x3020->nsh_spi,output:1020
743 table=2, packet_type=(1,0x894f),nsh_spi=0x1000,nsh_si=255 actions=decap(),goto_table:3
744 table=2, packet_type=(1,0x894f),nsh_spi=0x1020,nsh_si=254 actions=decap(),goto_table:3
745 table=3, ip actions=set_field:aa:55:aa:55:00:01->eth_dst,output:10
746 table=3, packet_type=(1,0x800) actions=encap(ethernet),set_field:aa:55:aa:55:00:01->eth_dst,output:10
747 packet_type=(1,0x894f),in_port=2010 actions=goto_table:2
748 packet_type=(1,0x894f),in_port=2030 actions=goto_table:2
749 table=2, packet_type=(1,0x894f),nsh_spi=0x1020,nsh_si=254 actions=output:2010
750 table=2, packet_type=(1,0x894f),nsh_spi=0x1020,nsh_si=255 actions=encap(ethernet),set_field:77:88:99:aa:bb:cc->eth_dst,goto_table:4
751 table=2, packet_type=(1,0x894f),nsh_spi=0x3020,nsh_si=254 actions=output:2030
752 table=2, packet_type=(1,0x894f),nsh_spi=0x3020,nsh_si=255 actions=encap(ethernet),set_field:11:22:33:44:55:66->eth_dst,goto_table:4
753 table=4, dl_dst=11:22:33:44:55:66,dl_type=0x894f actions=set_field:254->nsh_si,decap(),resubmit(,2)
491e05c2 754 table=4, dl_dst=77:88:99:aa:bb:cc,dl_type=0x894f actions=dec_nsh_ttl,decap(),resubmit(,2)
cc6902fe
JS
755 ip,in_port=30 actions=decap(),goto_table:1
756 n_packets=2, n_bytes=216, packet_type=(1,0x894f),in_port=3010 actions=goto_table:2
757 packet_type=(1,0x800),in_port=30 actions=goto_table:1
758 packet_type=(1,0x894f),in_port=3020 actions=goto_table:2
759 table=1, priority=0,packet_type=(1,0x800) actions=encap(nsh(md_type=1)),set_field:0x1020->nsh_spi,output:3020
760 table=1, priority=32,packet_type=(1,0x800),nw_dst=192.168.10.10 actions=encap(nsh(md_type=1)),set_field:0x1000->nsh_spi,output:3010
761 table=2, n_packets=2, n_bytes=216, packet_type=(1,0x894f),nsh_spi=0x3000,nsh_si=255 actions=decap(),goto_table:3
762 table=2, packet_type=(1,0x894f),nsh_spi=0x3020,nsh_si=254 actions=decap(),goto_table:3
763 table=3, ip actions=set_field:aa:55:aa:55:00:03->eth_dst,output:30
764 table=3, n_packets=2, n_bytes=168, packet_type=(1,0x800) actions=encap(ethernet),set_field:aa:55:aa:55:00:03->eth_dst,output:30
765])
766
767# Clear up megaflow cache
768ovs-appctl time/warp 11000
769
770# N1 to some other IP destination (192.168.10.20), via the indirect SF path with spi 0x3020
771AT_CHECK([
772 ovs-appctl netdev-dummy/receive n1 461e7d1a95a13a6dd2099cab080045000054500b40004001552fc0a80a0ac0a80a140800531f09a90001e9509a580000000055ba030000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637
773 ovs-appctl netdev-dummy/receive n1 461e7d1a95a13a6dd2099cab08004500005450934000400154a7c0a80a0ac0a80a140800f41d09a90002ea509a5800000000b3ba030000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637], [0], [ignore])
774
775ovs-appctl time/warp 1000
776ovs-appctl time/warp 1000
777
778AT_CHECK([
779 ovs-appctl dpctl/dump-flows dummy@ovs-dummy | strip_used | grep -v ipv6 | sort
780], [0], [flow-dump from non-dpdk interfaces:
17553f27 781recirc_id(0),in_port(4),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(dst=192.168.10.20/255.255.255.248,frag=no), packets:1, bytes:98, used:0.0s, actions:pop_eth,push_nsh(flags=0,ttl=63,mdtype=1,np=1,spi=0x3020,si=255,c1=0x0,c2=0x0,c3=0x0,c4=0x0),clone(tnl_push(tnl_port(4789),header(size=50,type=4,eth(dst=aa:55:00:00:00:02,src=aa:55:00:00:00:01,dl_type=0x0800),ipv4(src=10.0.0.1,dst=10.0.0.2,proto=17,tos=0,ttl=64,frag=0x4000),udp(src=0,dst=4789,csum=0x0),vxlan(flags=0xc000004,vni=0x0)),out_port(1)),set(ipv4(src=20.0.0.1,dst=20.0.0.2)),tnl_pop(4789))
29b5c0c3
BP
782tunnel(tun_id=0x0,src=20.0.0.1,dst=20.0.0.2,flags(-df-csum+key)),recirc_id(0),in_port(4789),packet_type(ns=1,id=0x894f),eth_type(0x894f),nsh(spi=0x3020,si=255), packets:1, bytes:108, used:0.0s, actions:push_eth(src=00:00:00:00:00:00,dst=11:22:33:44:55:66),set(nsh(spi=0x3020,si=254)),pop_eth,clone(tnl_push(tnl_port(4789),header(size=50,type=4,eth(dst=aa:55:00:00:00:03,src=aa:55:00:00:00:02,dl_type=0x0800),ipv4(src=20.0.0.2,dst=20.0.0.3,proto=17,tos=0,ttl=64,frag=0x4000),udp(src=0,dst=4789,csum=0x0),vxlan(flags=0xc000004,vni=0x0)),out_port(2)),set(ipv4(src=30.0.0.2,dst=30.0.0.3)),tnl_pop(4789))
783tunnel(tun_id=0x0,src=30.0.0.2,dst=30.0.0.3,flags(-df-csum+key)),recirc_id(0),in_port(4789),packet_type(ns=1,id=0x894f),eth_type(0x894f),nsh(np=1,spi=0x3020,si=254), packets:1, bytes:108, used:0.0s, actions:pop_nsh(),recirc(0x2)
784tunnel(tun_id=0x0,src=30.0.0.2,dst=30.0.0.3,flags(-df-csum+key)),recirc_id(0x2),in_port(4789),packet_type(ns=1,id=0x800),eth_type(0x0800),ipv4(frag=no), packets:1, bytes:84, used:0.0s, actions:push_eth(src=00:00:00:00:00:00,dst=aa:55:aa:55:00:03),6
cc6902fe
JS
785])
786
787AT_CHECK([
788 ovs-ofctl -Oopenflow13 dump-flows br-in1 | ofctl_strip | sort | grep actions
789 ovs-ofctl -Oopenflow13 dump-flows br-in2 | ofctl_strip | sort | grep actions
790 ovs-ofctl -Oopenflow13 dump-flows br-in3 | ofctl_strip | sort | grep actions
791], [0], [dnl
792 n_packets=4, n_bytes=392, ip,in_port=10 actions=decap(),goto_table:1
793 packet_type=(1,0x800),in_port=10 actions=goto_table:1
794 packet_type=(1,0x894f),in_port=1020 actions=goto_table:2
795 packet_type=(1,0x894f),in_port=1030 actions=goto_table:2
796 table=1, n_packets=2, n_bytes=196, priority=0,packet_type=(1,0x800) actions=encap(nsh(md_type=1)),set_field:0x3020->nsh_spi,output:1020
797 table=1, n_packets=2, n_bytes=196, priority=32,packet_type=(1,0x800),nw_dst=192.168.10.30 actions=encap(nsh(md_type=1)),set_field:0x3000->nsh_spi,output:1030
798 table=2, packet_type=(1,0x894f),nsh_spi=0x1000,nsh_si=255 actions=decap(),goto_table:3
799 table=2, packet_type=(1,0x894f),nsh_spi=0x1020,nsh_si=254 actions=decap(),goto_table:3
800 table=3, ip actions=set_field:aa:55:aa:55:00:01->eth_dst,output:10
801 table=3, packet_type=(1,0x800) actions=encap(ethernet),set_field:aa:55:aa:55:00:01->eth_dst,output:10
802 n_packets=2, n_bytes=216, packet_type=(1,0x894f),in_port=2010 actions=goto_table:2
803 packet_type=(1,0x894f),in_port=2030 actions=goto_table:2
804 table=2, n_packets=2, n_bytes=216, packet_type=(1,0x894f),nsh_spi=0x3020,nsh_si=254 actions=output:2030
805 table=2, n_packets=2, n_bytes=216, packet_type=(1,0x894f),nsh_spi=0x3020,nsh_si=255 actions=encap(ethernet),set_field:11:22:33:44:55:66->eth_dst,goto_table:4
806 table=2, packet_type=(1,0x894f),nsh_spi=0x1020,nsh_si=254 actions=output:2010
807 table=2, packet_type=(1,0x894f),nsh_spi=0x1020,nsh_si=255 actions=encap(ethernet),set_field:77:88:99:aa:bb:cc->eth_dst,goto_table:4
491e05c2 808 table=4, dl_dst=77:88:99:aa:bb:cc,dl_type=0x894f actions=dec_nsh_ttl,decap(),resubmit(,2)
cc6902fe
JS
809 table=4, n_packets=2, n_bytes=216, dl_dst=11:22:33:44:55:66,dl_type=0x894f actions=set_field:254->nsh_si,decap(),resubmit(,2)
810 ip,in_port=30 actions=decap(),goto_table:1
811 n_packets=2, n_bytes=216, packet_type=(1,0x894f),in_port=3010 actions=goto_table:2
812 n_packets=2, n_bytes=216, packet_type=(1,0x894f),in_port=3020 actions=goto_table:2
813 packet_type=(1,0x800),in_port=30 actions=goto_table:1
814 table=1, priority=0,packet_type=(1,0x800) actions=encap(nsh(md_type=1)),set_field:0x1020->nsh_spi,output:3020
815 table=1, priority=32,packet_type=(1,0x800),nw_dst=192.168.10.10 actions=encap(nsh(md_type=1)),set_field:0x1000->nsh_spi,output:3010
816 table=2, n_packets=2, n_bytes=216, packet_type=(1,0x894f),nsh_spi=0x3000,nsh_si=255 actions=decap(),goto_table:3
817 table=2, n_packets=2, n_bytes=216, packet_type=(1,0x894f),nsh_spi=0x3020,nsh_si=254 actions=decap(),goto_table:3
818 table=3, ip actions=set_field:aa:55:aa:55:00:03->eth_dst,output:30
819 table=3, n_packets=4, n_bytes=336, packet_type=(1,0x800) actions=encap(ethernet),set_field:aa:55:aa:55:00:03->eth_dst,output:30
820])
821
822OVS_VSWITCHD_STOP
823AT_CLEANUP