| @@ 383-404 (lines=22) @@ | ||
| 380 | } |
|
| 381 | self.assertEqual(expected_flow_mod, flow_mod) |
|
| 382 | ||
| 383 | def test_prepare_pop_flow(self): |
|
| 384 | """Test prepare pop flow method.""" |
|
| 385 | attributes = { |
|
| 386 | "name": "custom_name", |
|
| 387 | "uni_a": get_uni_mocked(interface_port=1, is_valid=True), |
|
| 388 | "uni_z": get_uni_mocked(interface_port=2, is_valid=True), |
|
| 389 | } |
|
| 390 | evc = EVC(**attributes) |
|
| 391 | interface_a = evc.uni_a.interface |
|
| 392 | interface_z = evc.uni_z.interface |
|
| 393 | in_vlan = 10 |
|
| 394 | flow_mod = evc.prepare_pop_flow(interface_a, interface_z, in_vlan) |
|
| 395 | expected_flow_mod = { |
|
| 396 | 'match': {'in_port': interface_a.port_number, 'dl_vlan': in_vlan}, |
|
| 397 | 'actions': [ |
|
| 398 | {'action_type': 'pop_vlan'}, |
|
| 399 | {'action_type': 'output', |
|
| 400 | 'port': interface_z.port_number |
|
| 401 | } |
|
| 402 | ] |
|
| 403 | } |
|
| 404 | self.assertEqual(expected_flow_mod, flow_mod) |
|
| 405 | ||
| 406 | def test_prepare_push_flow(self): |
|
| 407 | """Test prepare push flow method.""" |
|
| @@ 112-133 (lines=22) @@ | ||
| 109 | } |
|
| 110 | self.assertEqual(expected_flow_mod, flow_mod) |
|
| 111 | ||
| 112 | def test_prepare_pop_flow(self): |
|
| 113 | """Test prepare pop flow method.""" |
|
| 114 | attributes = { |
|
| 115 | "name": "custom_name", |
|
| 116 | "uni_a": get_uni_mocked(interface_port=1, is_valid=True), |
|
| 117 | "uni_z": get_uni_mocked(interface_port=2, is_valid=True), |
|
| 118 | } |
|
| 119 | evc = EVC(**attributes) |
|
| 120 | interface_a = evc.uni_a.interface |
|
| 121 | interface_z = evc.uni_z.interface |
|
| 122 | in_vlan = 10 |
|
| 123 | flow_mod = evc.prepare_pop_flow(interface_a, interface_z, in_vlan) |
|
| 124 | expected_flow_mod = { |
|
| 125 | 'match': {'in_port': interface_a.port_number, 'dl_vlan': in_vlan}, |
|
| 126 | 'actions': [ |
|
| 127 | {'action_type': 'pop_vlan'}, |
|
| 128 | {'action_type': 'output', |
|
| 129 | 'port': interface_z.port_number |
|
| 130 | } |
|
| 131 | ] |
|
| 132 | } |
|
| 133 | self.assertEqual(expected_flow_mod, flow_mod) |
|
| 134 | ||
| 135 | def test_prepare_push_flow(self): |
|
| 136 | """Test prepare push flow method.""" |
|