Merge "Remove obtaining event classes from strings"

This commit is contained in:
Zuul 2024-01-12 13:53:19 +00:00 committed by Gerrit Code Review
commit 60a9b7ca18

View File

@ -119,10 +119,7 @@ class NBOVNBGPDriver(driver_api.AgentDriverBase):
LOG.info("Configured allowed address scopes: %s", LOG.info("Configured allowed address scopes: %s",
", ".join(self.allowed_address_scopes)) ", ".join(self.allowed_address_scopes))
events = () events = self._get_events()
for event in self._get_events():
event_class = getattr(watcher, event)
events += (event_class(self),)
self._post_start_event.clear() self._post_start_event.clear()
self.nb_idl = ovn.OvnNbIdl( self.nb_idl = ovn.OvnNbIdl(
@ -142,20 +139,20 @@ class NBOVNBGPDriver(driver_api.AgentDriverBase):
self._post_start_event.set() self._post_start_event.set()
def _get_events(self): def _get_events(self):
events = {"LogicalSwitchPortProviderCreateEvent", events = {watcher.LogicalSwitchPortProviderCreateEvent(self),
"LogicalSwitchPortProviderDeleteEvent", watcher.LogicalSwitchPortProviderDeleteEvent(self),
"LogicalSwitchPortFIPCreateEvent", watcher.LogicalSwitchPortFIPCreateEvent(self),
"LogicalSwitchPortFIPDeleteEvent", watcher.LogicalSwitchPortFIPDeleteEvent(self),
"LocalnetCreateDeleteEvent", watcher.LocalnetCreateDeleteEvent(self),
"OVNLBCreateEvent", watcher.OVNLBCreateEvent(self),
"OVNLBDeleteEvent"} watcher.OVNLBDeleteEvent(self)}
if self._expose_tenant_networks: if self._expose_tenant_networks:
events.update({"ChassisRedirectCreateEvent", events.update({watcher.ChassisRedirectCreateEvent(self),
"ChassisRedirectDeleteEvent", watcher.ChassisRedirectDeleteEvent(self),
"LogicalSwitchPortSubnetAttachEvent", watcher.LogicalSwitchPortSubnetAttachEvent(self),
"LogicalSwitchPortSubnetDetachEvent", watcher.LogicalSwitchPortSubnetDetachEvent(self),
"LogicalSwitchPortTenantCreateEvent", watcher.LogicalSwitchPortTenantCreateEvent(self),
"LogicalSwitchPortTenantDeleteEvent"}) watcher.LogicalSwitchPortTenantDeleteEvent(self)})
return events return events
@lockutils.synchronized('nbbgp') @lockutils.synchronized('nbbgp')