|
19 | 19 | from neutron_lib.callbacks import events
|
20 | 20 | from neutron_lib.callbacks import registry
|
21 | 21 | from neutron_lib.callbacks import resources
|
| 22 | +from neutron_lib import constants as neutron_const |
22 | 23 | from neutron_lib.plugins import directory
|
23 | 24 | from neutron_lib.services.trunk import constants
|
24 | 25 | import testtools
|
@@ -285,6 +286,32 @@ def test_remove_subports_trunk_goes_to_down(self):
|
285 | 286 | {'sub_ports': [{'port_id': subport['port']['id']}]})
|
286 | 287 | self.assertEqual(constants.TRUNK_DOWN_STATUS, trunk['status'])
|
287 | 288 |
|
| 289 | + def test__trigger_trunk_status_change_parent_port_status_down(self): |
| 290 | + callback = register_mock_callback(resources.TRUNK, events.AFTER_UPDATE) |
| 291 | + with self.port() as parent: |
| 292 | + parent['status'] = neutron_const.PORT_STATUS_DOWN |
| 293 | + original_port = {'status': neutron_const.PORT_STATUS_DOWN} |
| 294 | + _, _ = ( |
| 295 | + self._test__trigger_trunk_status_change( |
| 296 | + parent, original_port, |
| 297 | + constants.TRUNK_DOWN_STATUS, |
| 298 | + constants.TRUNK_DOWN_STATUS)) |
| 299 | + callback.assert_not_called() |
| 300 | + |
| 301 | + def test__trigger_trunk_status_change_parent_port_status_up(self): |
| 302 | + callback = register_mock_callback(resources.TRUNK, events.AFTER_UPDATE) |
| 303 | + with self.port() as parent: |
| 304 | + parent['status'] = neutron_const.PORT_STATUS_ACTIVE |
| 305 | + original_port = {'status': neutron_const.PORT_STATUS_DOWN} |
| 306 | + _, _ = ( |
| 307 | + self._test__trigger_trunk_status_change( |
| 308 | + parent, original_port, |
| 309 | + constants.TRUNK_DOWN_STATUS, |
| 310 | + constants.TRUNK_ACTIVE_STATUS)) |
| 311 | + callback.assert_called_once_with( |
| 312 | + resources.TRUNK, events.AFTER_UPDATE, |
| 313 | + self.trunk_plugin, payload=mock.ANY) |
| 314 | + |
288 | 315 | def test__trigger_trunk_status_change_vif_type_changed_unbound(self):
|
289 | 316 | callback = register_mock_callback(resources.TRUNK, events.AFTER_UPDATE)
|
290 | 317 | with self.port() as parent:
|
|
0 commit comments