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