|
27 | 27 |
|
28 | 28 |
|
29 | 29 | class WaitForPortBindingDeleteEvent(event.WaitEvent):
|
30 |
| - event_name = 'WaitForPortBindingDeleteEvent' |
31 |
| - |
32 | 30 | def __init__(self, port_id):
|
33 | 31 | table = 'Port_Binding'
|
34 | 32 | events = (self.ROW_DELETE, )
|
35 | 33 | conditions = (('logical_port', '=', port_id), )
|
36 | 34 | super().__init__(events, table, conditions, timeout=10)
|
37 | 35 |
|
38 | 36 |
|
| 37 | +class WaitForPortBindingCreateEvent(event.WaitEvent): |
| 38 | + def __init__(self, port_id): |
| 39 | + table = 'Port_Binding' |
| 40 | + events = (self.ROW_CREATE, ) |
| 41 | + conditions = (('logical_port', '=', port_id), ) |
| 42 | + super().__init__(events, table, conditions, timeout=10) |
| 43 | + |
| 44 | + |
39 | 45 | class WaitForLSPSubportEvent(event.WaitEvent):
|
40 | 46 | event_name = 'WaitForLSPSubportEvent'
|
41 | 47 |
|
@@ -148,18 +154,23 @@ def test_subport_delete(self):
|
148 | 154 | lsp_subport = WaitForLSPSubportEvent(subport['port_id'])
|
149 | 155 | self.mech_driver.nb_ovn.idl.notify_handler.watch_event(
|
150 | 156 | lsp_subport)
|
| 157 | + pb_create = WaitForPortBindingCreateEvent(subport['port_id']) |
| 158 | + self.mech_driver.sb_ovn.idl.notify_handler.watch_event( |
| 159 | + pb_create) |
151 | 160 | with self.trunk([subport]) as trunk:
|
152 | 161 | # Wait for the subport LSP to be assigned as a subport.
|
153 | 162 | self.assertTrue(lsp_subport.wait())
|
154 |
| - pb_event = WaitForPortBindingDeleteEvent(subport['port_id']) |
| 163 | + self.assertTrue(pb_create.wait()) |
| 164 | + |
| 165 | + pb_delete = WaitForPortBindingDeleteEvent(subport['port_id']) |
155 | 166 | self.mech_driver.sb_ovn.idl.notify_handler.watch_event(
|
156 |
| - pb_event) |
| 167 | + pb_delete) |
157 | 168 | self.trunk_plugin.remove_subports(self.context, trunk['id'],
|
158 | 169 | {'sub_ports': [subport]})
|
159 | 170 | new_trunk = self.trunk_plugin.get_trunk(self.context,
|
160 | 171 | trunk['id'])
|
161 | 172 | # Wait for the subport LSP to be unbound.
|
162 |
| - self.assertTrue(pb_event.wait()) |
| 173 | + self.assertTrue(pb_delete.wait()) |
163 | 174 | self._verify_trunk_info(new_trunk, has_items=False)
|
164 | 175 |
|
165 | 176 | def test_trunk_delete(self):
|
|
0 commit comments