]>
Commit | Line | Data |
---|---|---|
3fd12197 | 1 | AT_BANNER([mpls-xlate]) |
5af43325 PS |
2 | |
3 | AT_SETUP([MPLS xlate action]) | |
4 | ||
e12ec36b SH |
5 | OVS_VSWITCHD_START( |
6 | [add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1 -- \ | |
7 | add-port br0 p1 -- set Interface p1 type=patch \ | |
8 | options:peer=p2 ofport_request=2 -- \ | |
9 | add-br br1 -- \ | |
10 | set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \ | |
11 | set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \ | |
12 | fail-mode=secure -- \ | |
13 | add-port br1 p2 -- set Interface p2 type=patch \ | |
14 | options:peer=p1]) | |
5af43325 PS |
15 | |
16 | AT_CHECK([ovs-appctl dpif/show], [0], [dnl | |
17 | dummy@ovs-dummy: hit:0 missed:0 | |
7be29a47 BP |
18 | br0: |
19 | br0 65534/100: (dummy-internal) | |
20 | p0 1/1: (dummy) | |
21 | p1 2/none: (patch: peer=p2) | |
22 | br1: | |
23 | br1 65534/101: (dummy-internal) | |
24 | p2 1/none: (patch: peer=p1) | |
5af43325 PS |
25 | ]) |
26 | ||
27 | dnl Setup single MPLS tags. | |
06db81cc | 28 | AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 group_id=1232,type=select,selection_method=hash,bucket=output:LOCAL]) |
e12ec36b SH |
29 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-group br0 group_id=1233,type=all,bucket=output:LOCAL]) |
30 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-group br0 group_id=1234,type=all,bucket=dec_ttl,output:LOCAL]) | |
5af43325 PS |
31 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 in_port=local,dl_type=0x0800,action=push_mpls:0x8847,set_field:10-\>mpls_label,output:1]) |
32 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 dl_type=0x8847,in_port=1,mpls_label=20,action=pop_mpls:0x0800,output:LOCAL]) | |
e12ec36b SH |
33 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 dl_type=0x8847,in_port=1,mpls_label=21,action=pop_mpls:0x0800,dec_ttl,output:LOCAL]) |
34 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 dl_type=0x8847,in_port=1,mpls_label=22,action=pop_mpls:0x0800,group:1232]) | |
35 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 dl_type=0x8847,in_port=1,mpls_label=23,action=pop_mpls:0x0800,group:1233]) | |
36 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 dl_type=0x8847,in_port=1,mpls_label=24,action=pop_mpls:0x0800,group:1234]) | |
37 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 dl_type=0x8847,in_port=1,mpls_label=25,action=pop_mpls:0x0800,output:2]) | |
38 | ||
39 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br1 in_port=1,action=output:LOCAL]) | |
40 | ||
6d43b84c AS |
41 | dnl The following is needed on slow systems, because the flows in the datapath |
42 | dnl will be evicted before the packet can match the recirculation context | |
43 | ovs-appctl time/stop | |
5af43325 PS |
44 | |
45 | dnl Test MPLS push | |
efa6665e | 46 | AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(100),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=17,tos=0,ttl=64,frag=no),udp(src=7777,dst=80)'], [0], [stdout]) |
5af43325 PS |
47 | AT_CHECK([tail -1 stdout], [0], |
48 | [Datapath actions: push_mpls(label=10,tc=0,ttl=64,bos=1,eth_type=0x8847),1 | |
49 | ]) | |
50 | ||
e12ec36b | 51 | dnl Test MPLS pop then output (actions do not trigger reciculation) |
5af43325 | 52 | AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x8847),mpls(label=20,tc=0,ttl=64,bos=1)'], [0], [stdout]) |
e12ec36b SH |
53 | AT_CHECK([tail -1 stdout], [0], |
54 | [Datapath actions: pop_mpls(eth_type=0x800),100 | |
55 | ]) | |
56 | ||
57 | dnl Test MPLS pop, dec_ttl, output (actions trigger recirculation) | |
58 | AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x8847),mpls(label=21,tc=0,ttl=64,bos=1)'], [0], [stdout]) | |
5af43325 | 59 | AT_CHECK([tail -1 stdout], [0], |
8bf009bf JR |
60 | [Datapath actions: pop_mpls(eth_type=0x800),recirc(0x1) |
61 | ]) | |
62 | ||
63 | AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'recirc_id(1),in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout]) | |
e12ec36b SH |
64 | AT_CHECK([tail -1 stdout], [0], |
65 | [Datapath actions: set(ipv4(ttl=63)),100 | |
66 | ]) | |
67 | ||
68 | dnl Test MPLS pop then select group output (group type triggers recirculation) | |
69 | AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x8847),mpls(label=22,tc=0,ttl=64,bos=1)'], [0], [stdout]) | |
70 | AT_CHECK([tail -1 stdout], [0], | |
71 | [Datapath actions: pop_mpls(eth_type=0x800),recirc(0x2) | |
72 | ]) | |
73 | ||
06db81cc JS |
74 | for d in 0 1 2 3; do |
75 | pkt="in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x8847),mpls(label=22,tc=0,ttl=64,bos=1)" | |
76 | AT_CHECK([ovs-appctl netdev-dummy/receive p0 $pkt]) | |
77 | done | |
78 | ||
79 | AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/packets.*actions:1/actions:1/' | strip_used | strip_ufid | sort], [0], [dnl | |
80 | flow-dump from non-dpdk interfaces: | |
81 | recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x8847),mpls(label=22/0xfffff,tc=0/0,ttl=64/0x0,bos=1/1), packets:3, bytes:54, used:0.0s, actions:pop_mpls(eth_type=0x800),recirc(0x3) | |
82 | recirc_id(0x3),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:100 | |
5af43325 PS |
83 | ]) |
84 | ||
e12ec36b SH |
85 | dnl Test MPLS pop then all group output (bucket actions do not trigger recirculation) |
86 | AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x8847),mpls(label=23,tc=0,ttl=64,bos=1)'], [0], [stdout]) | |
87 | AT_CHECK([tail -1 stdout], [0], | |
88 | [Datapath actions: pop_mpls(eth_type=0x800),100 | |
89 | ]) | |
90 | ||
91 | dnl Test MPLS pop then all group output (bucket actions trigger recirculation) | |
92 | AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x8847),mpls(label=24,tc=0,ttl=64,bos=1)'], [0], [stdout]) | |
93 | AT_CHECK([tail -1 stdout], [0], | |
06db81cc | 94 | [Datapath actions: pop_mpls(eth_type=0x800),recirc(0x4) |
e12ec36b SH |
95 | ]) |
96 | ||
06db81cc | 97 | AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'recirc_id(4),in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout]) |
e12ec36b SH |
98 | AT_CHECK([tail -1 stdout], [0], |
99 | [Datapath actions: set(ipv4(ttl=63)),100 | |
100 | ]) | |
101 | ||
102 | dnl Test MPLS pop then all output to patch port | |
103 | AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x8847),mpls(label=25,tc=0,ttl=64,bos=1)'], [0], [stdout]) | |
104 | AT_CHECK([tail -1 stdout], [0], | |
06db81cc | 105 | [Datapath actions: pop_mpls(eth_type=0x800),recirc(0x5) |
e12ec36b SH |
106 | ]) |
107 | ||
06db81cc | 108 | AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'recirc_id(5),in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout]) |
e12ec36b SH |
109 | AT_CHECK([tail -1 stdout], [0], |
110 | [Datapath actions: 101 | |
111 | ]) | |
112 | ||
5af43325 PS |
113 | dnl Setup multiple MPLS tags. |
114 | AT_CHECK([ovs-ofctl del-flows br0]) | |
115 | ||
116 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 in_port=local,dl_type=0x0800,action=push_mpls:0x8847,set_field:10-\>mpls_label,push_mpls:0x8847,set_field:20-\>mpls_label,output:1]) | |
e672ff9b JR |
117 | # The resubmits will be executed after recirculation, which preserves the |
118 | # register values. | |
119 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 cookie=0xa,table=0,dl_type=0x8847,in_port=1,mpls_label=60,action=set_field:10-\>reg0,pop_mpls:0x8847,goto_table:1]) | |
120 | # The pop_mpls below recirculates from within a resubmit | |
121 | # After recirculation the (restored) register value is moved to IP ttl. | |
122 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 cookie=0xb,table=1,dl_type=0x8847,in_port=1,mpls_label=50,action=push:NXM_NX_REG0[[0..7]],pop_mpls:0x0800,set_field:0-\>nw_ttl,pop:NXM_NX_REG1[[0..7]],move:NXM_NX_REG1[[0..7]]-\>NXM_NX_IP_TTL[[]],output:LOCAL]) | |
5af43325 PS |
123 | |
124 | dnl Double MPLS push | |
125 | AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(100),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout]) | |
126 | AT_CHECK([tail -1 stdout], [0], | |
127 | [Datapath actions: push_mpls(label=10,tc=0,ttl=64,bos=1,eth_type=0x8847),push_mpls(label=20,tc=0,ttl=64,bos=0,eth_type=0x8847),1 | |
128 | ]) | |
129 | ||
130 | dnl Double MPLS pop | |
8f79bb4d | 131 | AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x8847),mpls(label=60,tc=0,ttl=64,bos=0,label=50,tc=0,ttl=64,bos=1)'], [0], [stdout]) |
5af43325 | 132 | AT_CHECK([tail -1 stdout], [0], |
06db81cc | 133 | [Datapath actions: pop_mpls(eth_type=0x8847),pop_mpls(eth_type=0x800),recirc(0x7) |
e672ff9b JR |
134 | ]) |
135 | ||
06db81cc | 136 | AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'recirc_id(7),in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout]) |
e672ff9b JR |
137 | AT_CHECK([tail -1 stdout], [0], |
138 | [Datapath actions: set(ipv4(ttl=10)),100 | |
5af43325 PS |
139 | ]) |
140 | ||
141 | OVS_VSWITCHD_STOP | |
142 | AT_CLEANUP | |
742c0ac3 JR |
143 | |
144 | AT_SETUP([MPLS xlate action - patch-port]) | |
145 | ||
146 | OVS_VSWITCHD_START( | |
147 | [add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1 -- \ | |
148 | add-port br0 p1 -- set Interface p1 type=patch \ | |
149 | options:peer=p2 ofport_request=2 -- \ | |
150 | add-br br1 -- \ | |
151 | set bridge br1 other-config:hwaddr=aa:66:aa:66:00:00 -- \ | |
152 | set bridge br1 datapath-type=dummy other-config:datapath-id=1234 \ | |
153 | fail-mode=secure -- \ | |
154 | add-port br1 p2 -- set Interface p2 type=patch \ | |
155 | options:peer=p1 -- \ | |
156 | add-port br1 p3 -- set Interface p3 type=dummy ofport_request=3]) | |
157 | ||
158 | AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg ofproto_dpif_upcall:dbg]) | |
159 | ||
160 | AT_CHECK([ovs-appctl dpif/show], [0], [dnl | |
161 | dummy@ovs-dummy: hit:0 missed:0 | |
7be29a47 BP |
162 | br0: |
163 | br0 65534/100: (dummy-internal) | |
164 | p0 1/1: (dummy) | |
165 | p1 2/none: (patch: peer=p2) | |
166 | br1: | |
167 | br1 65534/101: (dummy-internal) | |
168 | p2 1/none: (patch: peer=p1) | |
169 | p3 3/3: (dummy) | |
742c0ac3 JR |
170 | ]) |
171 | ||
172 | dnl MPLS PUSH + POP. | |
173 | AT_CHECK([ovs-ofctl del-flows br0]) | |
174 | ||
175 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 in_port=local,ip,actions=2,1,1]) | |
176 | ||
177 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br1 in_port=1,ip,actions=dec_ttl,push_mpls:0x8847,3]) | |
178 | ||
179 | dnl MPLS push+pop | |
180 | AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(100),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=10.1.1.22,dst=10.0.0.3,proto=6,tos=0,ttl=64,frag=no),tcp(src=53295,dst=8080)'], [0], [stdout]) | |
181 | AT_CHECK([tail -1 stdout], [0], | |
182 | [Datapath actions: set(ipv4(ttl=63)),push_mpls(label=0,tc=0,ttl=63,bos=1,eth_type=0x8847),3,pop_mpls(eth_type=0x800),set(ipv4(tos=0/0xfc,ttl=64)),1,1 | |
183 | ]) | |
184 | ||
185 | OVS_VSWITCHD_STOP | |
186 | AT_CLEANUP | |
187 | ||
188 | AT_SETUP([MPLS xlate action - group bucket]) | |
189 | ||
190 | OVS_VSWITCHD_START | |
191 | add_of_ports br0 1 | |
192 | ||
193 | AT_CHECK([ovs-appctl vlog/set dpif:dbg dpif_netdev:dbg ofproto_dpif_upcall:dbg]) | |
194 | ||
195 | AT_CHECK([ovs-ofctl del-flows br0]) | |
196 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-group br0 'group_id=1234,type=all,bucket=push_mpls:0x8847,output:1']) | |
197 | AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 in_port=local,ip,actions=group:1234,output:1,output:1]) | |
198 | ||
199 | dnl MPLS push in a bucket | |
200 | AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(100),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=10.1.1.22,dst=10.0.0.3,proto=6,tos=0,ttl=64,frag=no),tcp(src=53295,dst=8080)'], [0], [stdout]) | |
201 | AT_CHECK([tail -1 stdout], [0], | |
202 | [Datapath actions: push_mpls(label=0,tc=0,ttl=64,bos=1,eth_type=0x8847),1,pop_mpls(eth_type=0x800),1,1 | |
203 | ]) | |
204 | ||
205 | OVS_VSWITCHD_STOP | |
206 | AT_CLEANUP |