1
|
|
|
"""Test flow_builder.""" |
2
|
|
|
|
3
|
1 |
|
from unittest.mock import MagicMock |
4
|
1 |
|
from napps.kytos.telemetry_int.managers import flow_builder as fb |
5
|
1 |
|
from napps.kytos.telemetry_int.managers.int import INTManager |
6
|
1 |
|
from napps.kytos.telemetry_int.utils import ProxyPort, get_cookie |
7
|
1 |
|
from napps.kytos.telemetry_int import settings |
8
|
1 |
|
from napps.kytos.telemetry_int.kytos_api_helper import _map_stored_flows_by_cookies |
9
|
1 |
|
from kytos.lib.helpers import get_controller_mock, get_switch_mock, get_interface_mock |
10
|
1 |
|
from kytos.core.common import EntityStatus |
11
|
|
|
|
12
|
|
|
|
13
|
1 |
|
def test_build_int_flows_inter_evpl( |
14
|
|
|
evcs_data, inter_evc_evpl_flows_data, monkeypatch |
15
|
|
|
) -> None: |
16
|
|
|
"""Test build INT flows inter EVPL. |
17
|
|
|
|
18
|
|
|
+----+ +----+ |
19
|
|
|
5| |6 5| |6 |
20
|
|
|
+---+----v---+ +------------+ +----+----v---+ |
21
|
|
|
1 | | | | | |1 |
22
|
|
|
-------+ |3 2 | |3 2 | +------- |
23
|
|
|
vlan | s1 +------------+ s2 +-----------+ s3 | vlan |
24
|
|
|
101 | | | | | | 102 |
25
|
|
|
| | | | | | |
26
|
|
|
+------------+ +------------+ +-------------+ |
27
|
|
|
|
28
|
|
|
""" |
29
|
1 |
|
controller = get_controller_mock() |
30
|
1 |
|
int_manager = INTManager(controller) |
31
|
1 |
|
get_proxy_port_or_raise = MagicMock() |
32
|
1 |
|
monkeypatch.setattr( |
33
|
|
|
"napps.kytos.telemetry_int.utils.get_proxy_port_or_raise", |
34
|
|
|
get_proxy_port_or_raise, |
35
|
|
|
) |
36
|
|
|
|
37
|
1 |
|
evc_id = "16a76ae61b2f46" |
38
|
1 |
|
dpid_a = "00:00:00:00:00:00:00:01" |
39
|
1 |
|
mock_switch_a = get_switch_mock(dpid_a, 0x04) |
40
|
1 |
|
mock_interface_a1 = get_interface_mock("s1-eth1", 1, mock_switch_a) |
41
|
1 |
|
mock_interface_a1.id = f"{dpid_a}:{mock_interface_a1.port_number}" |
42
|
1 |
|
mock_interface_a5 = get_interface_mock("s1-eth5", 5, mock_switch_a) |
43
|
1 |
|
mock_interface_a1.metadata = {"proxy_port": mock_interface_a5.port_number} |
44
|
1 |
|
mock_interface_a5.status = EntityStatus.UP |
45
|
1 |
|
mock_interface_a6 = get_interface_mock("s1-eth6", 6, mock_switch_a) |
46
|
1 |
|
mock_interface_a6.status = EntityStatus.UP |
47
|
1 |
|
mock_interface_a5.metadata = { |
48
|
|
|
"looped": { |
49
|
|
|
"port_numbers": [ |
50
|
|
|
mock_interface_a5.port_number, |
51
|
|
|
mock_interface_a6.port_number, |
52
|
|
|
] |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|
56
|
1 |
|
dpid_z = "00:00:00:00:00:00:00:03" |
57
|
1 |
|
mock_switch_z = get_switch_mock(dpid_z, 0x04) |
58
|
1 |
|
mock_interface_z1 = get_interface_mock("s1-eth1", 1, mock_switch_z) |
59
|
1 |
|
mock_interface_z1.status = EntityStatus.UP |
60
|
1 |
|
mock_interface_z1.id = f"{dpid_z}:{mock_interface_z1.port_number}" |
61
|
1 |
|
mock_interface_z5 = get_interface_mock("s1-eth5", 5, mock_switch_z) |
62
|
1 |
|
mock_interface_z1.metadata = {"proxy_port": mock_interface_z5.port_number} |
63
|
1 |
|
mock_interface_z5.status = EntityStatus.UP |
64
|
1 |
|
mock_interface_z6 = get_interface_mock("s1-eth6", 6, mock_switch_z) |
65
|
1 |
|
mock_interface_z6.status = EntityStatus.UP |
66
|
1 |
|
mock_interface_z5.metadata = { |
67
|
|
|
"looped": { |
68
|
|
|
"port_numbers": [ |
69
|
|
|
mock_interface_z5.port_number, |
70
|
|
|
mock_interface_z6.port_number, |
71
|
|
|
] |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|
75
|
1 |
|
mock_switch_a.get_interface_by_port_no = lambda port_no: { |
76
|
|
|
mock_interface_a5.port_number: mock_interface_a5, |
77
|
|
|
mock_interface_a6.port_number: mock_interface_a6, |
78
|
|
|
}[port_no] |
79
|
|
|
|
80
|
1 |
|
mock_switch_z.get_interface_by_port_no = lambda port_no: { |
81
|
|
|
mock_interface_z5.port_number: mock_interface_z5, |
82
|
|
|
mock_interface_z6.port_number: mock_interface_z6, |
83
|
|
|
}[port_no] |
84
|
|
|
|
85
|
1 |
|
pp_a = ProxyPort(controller, source=mock_interface_a5) |
86
|
1 |
|
assert pp_a.source == mock_interface_a5 |
87
|
1 |
|
assert pp_a.destination == mock_interface_a6 |
88
|
1 |
|
pp_z = ProxyPort(controller, source=mock_interface_z5) |
89
|
1 |
|
assert pp_z.source == mock_interface_z5 |
90
|
1 |
|
assert pp_z.destination == mock_interface_z6 |
91
|
|
|
|
92
|
1 |
|
get_proxy_port_or_raise.side_effect = [pp_a, pp_z] |
93
|
1 |
|
evcs_data = {evc_id: evcs_data[evc_id]} |
94
|
1 |
|
evcs_data = int_manager._validate_map_enable_evcs(evcs_data) |
95
|
1 |
|
stored_flows = _map_stored_flows_by_cookies(inter_evc_evpl_flows_data) |
96
|
|
|
|
97
|
1 |
|
cookie = get_cookie(evc_id, settings.MEF_COOKIE_PREFIX) |
98
|
1 |
|
flows = fb.build_int_flows(evcs_data, stored_flows)[cookie] |
99
|
|
|
|
100
|
1 |
|
n_expected_source_flows, n_expected_hop_flows, n_expected_sink_flows = 3, 2, 4 |
101
|
1 |
|
assert ( |
102
|
|
|
len(flows) |
103
|
|
|
== (n_expected_source_flows + n_expected_hop_flows + n_expected_sink_flows) * 2 |
104
|
|
|
) |
105
|
|
|
|
106
|
1 |
|
expected_uni_a_source_flows = [ |
107
|
|
|
{ |
108
|
|
|
"flow": { |
109
|
|
|
"owner": "telemetry_int", |
110
|
|
|
"cookie": int(0xA816A76AE61B2F46), |
111
|
|
|
"match": {"in_port": 1, "dl_vlan": 101, "dl_type": 2048, "nw_proto": 6}, |
112
|
|
|
"table_id": 0, |
113
|
|
|
"table_group": "evpl", |
114
|
|
|
"priority": 20100, |
115
|
|
|
"idle_timeout": 0, |
116
|
|
|
"hard_timeout": 0, |
117
|
|
|
"instructions": [ |
118
|
|
|
{ |
119
|
|
|
"instruction_type": "apply_actions", |
120
|
|
|
"actions": [{"action_type": "push_int"}], |
121
|
|
|
}, |
122
|
|
|
{"instruction_type": "goto_table", "table_id": 2}, |
123
|
|
|
], |
124
|
|
|
} |
125
|
|
|
}, |
126
|
|
|
{ |
127
|
|
|
"flow": { |
128
|
|
|
"owner": "telemetry_int", |
129
|
|
|
"cookie": int(0xA816A76AE61B2F46), |
130
|
|
|
"match": { |
131
|
|
|
"in_port": 1, |
132
|
|
|
"dl_vlan": 101, |
133
|
|
|
"dl_type": 2048, |
134
|
|
|
"nw_proto": 17, |
135
|
|
|
}, |
136
|
|
|
"table_id": 0, |
137
|
|
|
"table_group": "evpl", |
138
|
|
|
"priority": 20100, |
139
|
|
|
"idle_timeout": 0, |
140
|
|
|
"hard_timeout": 0, |
141
|
|
|
"instructions": [ |
142
|
|
|
{ |
143
|
|
|
"instruction_type": "apply_actions", |
144
|
|
|
"actions": [{"action_type": "push_int"}], |
145
|
|
|
}, |
146
|
|
|
{"instruction_type": "goto_table", "table_id": 2}, |
147
|
|
|
], |
148
|
|
|
}, |
149
|
|
|
}, |
150
|
|
|
{ |
151
|
|
|
"flow": { |
152
|
|
|
"owner": "telemetry_int", |
153
|
|
|
"cookie": int(0xA816A76AE61B2F46), |
154
|
|
|
"match": {"in_port": 1, "dl_vlan": 101}, |
155
|
|
|
"table_id": 2, |
156
|
|
|
"table_group": "base", |
157
|
|
|
"priority": 20000, |
158
|
|
|
"idle_timeout": 0, |
159
|
|
|
"hard_timeout": 0, |
160
|
|
|
"instructions": [ |
161
|
|
|
{ |
162
|
|
|
"instruction_type": "apply_actions", |
163
|
|
|
"actions": [ |
164
|
|
|
{"action_type": "add_int_metadata"}, |
165
|
|
|
{"action_type": "set_vlan", "vlan_id": 102}, |
166
|
|
|
{"action_type": "push_vlan", "tag_type": "s"}, |
167
|
|
|
{"action_type": "set_vlan", "vlan_id": 1}, |
168
|
|
|
{"action_type": "output", "port": 3}, |
169
|
|
|
], |
170
|
|
|
} |
171
|
|
|
], |
172
|
|
|
}, |
173
|
|
|
}, |
174
|
|
|
] |
175
|
|
|
|
176
|
1 |
|
expected_uni_z_source_flows = [ |
177
|
|
|
{ |
178
|
|
|
"flow": { |
179
|
|
|
"owner": "telemetry_int", |
180
|
|
|
"cookie": int(0xA816A76AE61B2F46), |
181
|
|
|
"match": {"in_port": 1, "dl_vlan": 102, "dl_type": 2048, "nw_proto": 6}, |
182
|
|
|
"table_id": 0, |
183
|
|
|
"table_group": "evpl", |
184
|
|
|
"priority": 20100, |
185
|
|
|
"idle_timeout": 0, |
186
|
|
|
"hard_timeout": 0, |
187
|
|
|
"instructions": [ |
188
|
|
|
{ |
189
|
|
|
"instruction_type": "apply_actions", |
190
|
|
|
"actions": [{"action_type": "push_int"}], |
191
|
|
|
}, |
192
|
|
|
{"instruction_type": "goto_table", "table_id": 2}, |
193
|
|
|
], |
194
|
|
|
}, |
195
|
|
|
}, |
196
|
|
|
{ |
197
|
|
|
"flow": { |
198
|
|
|
"owner": "telemetry_int", |
199
|
|
|
"cookie": int(0xA816A76AE61B2F46), |
200
|
|
|
"match": { |
201
|
|
|
"in_port": 1, |
202
|
|
|
"dl_vlan": 102, |
203
|
|
|
"dl_type": 2048, |
204
|
|
|
"nw_proto": 17, |
205
|
|
|
}, |
206
|
|
|
"table_id": 0, |
207
|
|
|
"table_group": "evpl", |
208
|
|
|
"priority": 20100, |
209
|
|
|
"idle_timeout": 0, |
210
|
|
|
"hard_timeout": 0, |
211
|
|
|
"instructions": [ |
212
|
|
|
{ |
213
|
|
|
"instruction_type": "apply_actions", |
214
|
|
|
"actions": [{"action_type": "push_int"}], |
215
|
|
|
}, |
216
|
|
|
{"instruction_type": "goto_table", "table_id": 2}, |
217
|
|
|
], |
218
|
|
|
}, |
219
|
|
|
}, |
220
|
|
|
{ |
221
|
|
|
"flow": { |
222
|
|
|
"owner": "telemetry_int", |
223
|
|
|
"cookie": int(0xA816A76AE61B2F46), |
224
|
|
|
"match": {"in_port": 1, "dl_vlan": 102}, |
225
|
|
|
"table_id": 2, |
226
|
|
|
"table_group": "base", |
227
|
|
|
"priority": 20000, |
228
|
|
|
"idle_timeout": 0, |
229
|
|
|
"hard_timeout": 0, |
230
|
|
|
"instructions": [ |
231
|
|
|
{ |
232
|
|
|
"instruction_type": "apply_actions", |
233
|
|
|
"actions": [ |
234
|
|
|
{"action_type": "add_int_metadata"}, |
235
|
|
|
{"action_type": "set_vlan", "vlan_id": 101}, |
236
|
|
|
{"action_type": "push_vlan", "tag_type": "s"}, |
237
|
|
|
{"action_type": "set_vlan", "vlan_id": 1}, |
238
|
|
|
{"action_type": "output", "port": 2}, |
239
|
|
|
], |
240
|
|
|
} |
241
|
|
|
], |
242
|
|
|
}, |
243
|
|
|
}, |
244
|
|
|
] |
245
|
|
|
|
246
|
1 |
|
expected_hop_flows = [ |
247
|
|
|
{ |
248
|
|
|
"flow": { |
249
|
|
|
"owner": "telemetry_int", |
250
|
|
|
"cookie": int(0xA816A76AE61B2F46), |
251
|
|
|
"match": {"in_port": 2, "dl_vlan": 1, "dl_type": 2048, "nw_proto": 6}, |
252
|
|
|
"table_id": 0, |
253
|
|
|
"table_group": "evpl", |
254
|
|
|
"priority": 20100, |
255
|
|
|
"idle_timeout": 0, |
256
|
|
|
"hard_timeout": 0, |
257
|
|
|
"instructions": [ |
258
|
|
|
{ |
259
|
|
|
"instruction_type": "apply_actions", |
260
|
|
|
"actions": [ |
261
|
|
|
{"action_type": "add_int_metadata"}, |
262
|
|
|
{"action_type": "set_vlan", "vlan_id": 1}, |
263
|
|
|
{"action_type": "output", "port": 3}, |
264
|
|
|
], |
265
|
|
|
} |
266
|
|
|
], |
267
|
|
|
}, |
268
|
|
|
}, |
269
|
|
|
{ |
270
|
|
|
"flow": { |
271
|
|
|
"owner": "telemetry_int", |
272
|
|
|
"cookie": int(0xA816A76AE61B2F46), |
273
|
|
|
"match": {"in_port": 2, "dl_vlan": 1, "dl_type": 2048, "nw_proto": 17}, |
274
|
|
|
"table_id": 0, |
275
|
|
|
"table_group": "evpl", |
276
|
|
|
"priority": 20100, |
277
|
|
|
"idle_timeout": 0, |
278
|
|
|
"hard_timeout": 0, |
279
|
|
|
"instructions": [ |
280
|
|
|
{ |
281
|
|
|
"instruction_type": "apply_actions", |
282
|
|
|
"actions": [ |
283
|
|
|
{"action_type": "add_int_metadata"}, |
284
|
|
|
{"action_type": "set_vlan", "vlan_id": 1}, |
285
|
|
|
{"action_type": "output", "port": 3}, |
286
|
|
|
], |
287
|
|
|
} |
288
|
|
|
], |
289
|
|
|
}, |
290
|
|
|
}, |
291
|
|
|
{ |
292
|
|
|
"flow": { |
293
|
|
|
"owner": "telemetry_int", |
294
|
|
|
"cookie": int(0xA816A76AE61B2F46), |
295
|
|
|
"match": {"in_port": 3, "dl_vlan": 1, "dl_type": 2048, "nw_proto": 6}, |
296
|
|
|
"table_id": 0, |
297
|
|
|
"table_group": "evpl", |
298
|
|
|
"priority": 20100, |
299
|
|
|
"idle_timeout": 0, |
300
|
|
|
"hard_timeout": 0, |
301
|
|
|
"instructions": [ |
302
|
|
|
{ |
303
|
|
|
"instruction_type": "apply_actions", |
304
|
|
|
"actions": [ |
305
|
|
|
{"action_type": "add_int_metadata"}, |
306
|
|
|
{"action_type": "set_vlan", "vlan_id": 1}, |
307
|
|
|
{"action_type": "output", "port": 2}, |
308
|
|
|
], |
309
|
|
|
} |
310
|
|
|
], |
311
|
|
|
}, |
312
|
|
|
}, |
313
|
|
|
{ |
314
|
|
|
"flow": { |
315
|
|
|
"owner": "telemetry_int", |
316
|
|
|
"cookie": int(0xA816A76AE61B2F46), |
317
|
|
|
"match": {"in_port": 3, "dl_vlan": 1, "dl_type": 2048, "nw_proto": 17}, |
318
|
|
|
"table_id": 0, |
319
|
|
|
"table_group": "evpl", |
320
|
|
|
"priority": 20100, |
321
|
|
|
"idle_timeout": 0, |
322
|
|
|
"hard_timeout": 0, |
323
|
|
|
"instructions": [ |
324
|
|
|
{ |
325
|
|
|
"instruction_type": "apply_actions", |
326
|
|
|
"actions": [ |
327
|
|
|
{"action_type": "add_int_metadata"}, |
328
|
|
|
{"action_type": "set_vlan", "vlan_id": 1}, |
329
|
|
|
{"action_type": "output", "port": 2}, |
330
|
|
|
], |
331
|
|
|
} |
332
|
|
|
], |
333
|
|
|
}, |
334
|
|
|
}, |
335
|
|
|
] |
336
|
|
|
|
337
|
1 |
|
expected_uni_z_sink_flows = [ |
338
|
|
|
{ |
339
|
|
|
"flow": { |
340
|
|
|
"owner": "telemetry_int", |
341
|
|
|
"cookie": int(0xA816A76AE61B2F46), |
342
|
|
|
"match": {"in_port": 2, "dl_vlan": 1, "dl_type": 2048, "nw_proto": 6}, |
343
|
|
|
"table_id": 0, |
344
|
|
|
"table_group": "evpl", |
345
|
|
|
"priority": 20100, |
346
|
|
|
"idle_timeout": 0, |
347
|
|
|
"hard_timeout": 0, |
348
|
|
|
"instructions": [ |
349
|
|
|
{ |
350
|
|
|
"instruction_type": "apply_actions", |
351
|
|
|
"actions": [ |
352
|
|
|
{"action_type": "add_int_metadata"}, |
353
|
|
|
{"action_type": "output", "port": 5}, |
354
|
|
|
], |
355
|
|
|
} |
356
|
|
|
], |
357
|
|
|
}, |
358
|
|
|
}, |
359
|
|
|
{ |
360
|
|
|
"flow": { |
361
|
|
|
"owner": "telemetry_int", |
362
|
|
|
"cookie": int(0xA816A76AE61B2F46), |
363
|
|
|
"match": {"in_port": 2, "dl_vlan": 1, "dl_type": 2048, "nw_proto": 17}, |
364
|
|
|
"table_id": 0, |
365
|
|
|
"table_group": "evpl", |
366
|
|
|
"priority": 20100, |
367
|
|
|
"idle_timeout": 0, |
368
|
|
|
"hard_timeout": 0, |
369
|
|
|
"instructions": [ |
370
|
|
|
{ |
371
|
|
|
"instruction_type": "apply_actions", |
372
|
|
|
"actions": [ |
373
|
|
|
{"action_type": "add_int_metadata"}, |
374
|
|
|
{"action_type": "output", "port": 5}, |
375
|
|
|
], |
376
|
|
|
} |
377
|
|
|
], |
378
|
|
|
}, |
379
|
|
|
}, |
380
|
|
|
{ |
381
|
|
|
"flow": { |
382
|
|
|
"owner": "telemetry_int", |
383
|
|
|
"cookie": int(0xA816A76AE61B2F46), |
384
|
|
|
"match": {"in_port": 6, "dl_vlan": 1}, |
385
|
|
|
"table_id": 0, |
386
|
|
|
"table_group": "evpl", |
387
|
|
|
"priority": 20000, |
388
|
|
|
"idle_timeout": 0, |
389
|
|
|
"hard_timeout": 0, |
390
|
|
|
"instructions": [ |
391
|
|
|
{ |
392
|
|
|
"instruction_type": "apply_actions", |
393
|
|
|
"actions": [{"action_type": "send_report"}], |
394
|
|
|
}, |
395
|
|
|
{"instruction_type": "goto_table", "table_id": 2}, |
396
|
|
|
], |
397
|
|
|
}, |
398
|
|
|
}, |
399
|
|
|
{ |
400
|
|
|
"flow": { |
401
|
|
|
"owner": "telemetry_int", |
402
|
|
|
"cookie": int(0xA816A76AE61B2F46), |
403
|
|
|
"match": {"in_port": 6, "dl_vlan": 1}, |
404
|
|
|
"table_id": 2, |
405
|
|
|
"table_group": "base", |
406
|
|
|
"priority": 20000, |
407
|
|
|
"idle_timeout": 0, |
408
|
|
|
"hard_timeout": 0, |
409
|
|
|
"instructions": [ |
410
|
|
|
{ |
411
|
|
|
"instruction_type": "apply_actions", |
412
|
|
|
"actions": [ |
413
|
|
|
{"action_type": "pop_int"}, |
414
|
|
|
{"action_type": "pop_vlan"}, |
415
|
|
|
{"action_type": "output", "port": 1}, |
416
|
|
|
], |
417
|
|
|
} |
418
|
|
|
], |
419
|
|
|
} |
420
|
|
|
}, |
421
|
|
|
] |
422
|
|
|
|
423
|
1 |
|
expected_uni_a_sink_flows = [ |
424
|
|
|
{ |
425
|
|
|
"flow": { |
426
|
|
|
"owner": "telemetry_int", |
427
|
|
|
"cookie": int(0xA816A76AE61B2F46), |
428
|
|
|
"match": {"in_port": 3, "dl_vlan": 1, "dl_type": 2048, "nw_proto": 6}, |
429
|
|
|
"table_id": 0, |
430
|
|
|
"table_group": "evpl", |
431
|
|
|
"priority": 20100, |
432
|
|
|
"idle_timeout": 0, |
433
|
|
|
"hard_timeout": 0, |
434
|
|
|
"instructions": [ |
435
|
|
|
{ |
436
|
|
|
"instruction_type": "apply_actions", |
437
|
|
|
"actions": [ |
438
|
|
|
{"action_type": "add_int_metadata"}, |
439
|
|
|
{"action_type": "output", "port": 5}, |
440
|
|
|
], |
441
|
|
|
} |
442
|
|
|
], |
443
|
|
|
}, |
444
|
|
|
}, |
445
|
|
|
{ |
446
|
|
|
"flow": { |
447
|
|
|
"owner": "telemetry_int", |
448
|
|
|
"cookie": int(0xA816A76AE61B2F46), |
449
|
|
|
"match": {"in_port": 3, "dl_vlan": 1, "dl_type": 2048, "nw_proto": 17}, |
450
|
|
|
"table_id": 0, |
451
|
|
|
"table_group": "evpl", |
452
|
|
|
"priority": 20100, |
453
|
|
|
"idle_timeout": 0, |
454
|
|
|
"hard_timeout": 0, |
455
|
|
|
"instructions": [ |
456
|
|
|
{ |
457
|
|
|
"instruction_type": "apply_actions", |
458
|
|
|
"actions": [ |
459
|
|
|
{"action_type": "add_int_metadata"}, |
460
|
|
|
{"action_type": "output", "port": 5}, |
461
|
|
|
], |
462
|
|
|
} |
463
|
|
|
], |
464
|
|
|
}, |
465
|
|
|
}, |
466
|
|
|
{ |
467
|
|
|
"flow": { |
468
|
|
|
"owner": "telemetry_int", |
469
|
|
|
"cookie": int(0xA816A76AE61B2F46), |
470
|
|
|
"match": {"in_port": 6, "dl_vlan": 1}, |
471
|
|
|
"table_id": 0, |
472
|
|
|
"table_group": "evpl", |
473
|
|
|
"priority": 20000, |
474
|
|
|
"idle_timeout": 0, |
475
|
|
|
"hard_timeout": 0, |
476
|
|
|
"instructions": [ |
477
|
|
|
{ |
478
|
|
|
"instruction_type": "apply_actions", |
479
|
|
|
"actions": [{"action_type": "send_report"}], |
480
|
|
|
}, |
481
|
|
|
{"instruction_type": "goto_table", "table_id": 2}, |
482
|
|
|
], |
483
|
|
|
}, |
484
|
|
|
}, |
485
|
|
|
{ |
486
|
|
|
"flow": { |
487
|
|
|
"owner": "telemetry_int", |
488
|
|
|
"cookie": int(0xA816A76AE61B2F46), |
489
|
|
|
"match": {"in_port": 6, "dl_vlan": 1}, |
490
|
|
|
"table_id": 2, |
491
|
|
|
"table_group": "base", |
492
|
|
|
"priority": 20000, |
493
|
|
|
"idle_timeout": 0, |
494
|
|
|
"hard_timeout": 0, |
495
|
|
|
"instructions": [ |
496
|
|
|
{ |
497
|
|
|
"instruction_type": "apply_actions", |
498
|
|
|
"actions": [ |
499
|
|
|
{"action_type": "pop_int"}, |
500
|
|
|
{"action_type": "pop_vlan"}, |
501
|
|
|
{"action_type": "output", "port": 1}, |
502
|
|
|
], |
503
|
|
|
} |
504
|
|
|
], |
505
|
|
|
}, |
506
|
|
|
}, |
507
|
|
|
] |
508
|
|
|
|
509
|
1 |
|
expected_flows = ( |
510
|
|
|
expected_uni_a_source_flows |
511
|
|
|
+ expected_uni_z_source_flows |
512
|
|
|
+ expected_hop_flows |
513
|
|
|
+ expected_uni_z_sink_flows |
514
|
|
|
+ expected_uni_a_sink_flows |
515
|
|
|
) |
516
|
|
|
|
517
|
1 |
|
for i, flow in enumerate(flows): |
518
|
|
|
assert (i, flow["flow"]) == (i, expected_flows[i]["flow"]) |
519
|
|
|
|