Merge "Remove obtaining event classes from strings, vol 2"

This commit is contained in:
Zuul 2024-01-12 16:42:34 +00:00 committed by Gerrit Code Review
commit 87860fb44a
4 changed files with 35 additions and 49 deletions

View File

@ -119,9 +119,9 @@ class NBOVNBGPDriver(driver_api.AgentDriverBase):
LOG.info("Configured allowed address scopes: %s",
", ".join(self.allowed_address_scopes))
events = self._get_events()
self._post_start_event.clear()
events = self._get_events()
self.nb_idl = ovn.OvnNbIdl(
self.ovn_remote,
tables=OVN_TABLES,

View File

@ -93,13 +93,9 @@ class OVNBGPDriver(driver_api.AgentDriverBase):
LOG.info("Configured allowed address scopes: %s",
", ".join(self.allowed_address_scopes))
events = ()
for event in self._get_events():
event_class = getattr(watcher, event)
events += (event_class(self),)
self._post_fork_event.clear()
events = self._get_events()
self.sb_idl = ovn.OvnSbIdl(
self.ovn_remote,
chassis=self.chassis,
@ -110,21 +106,21 @@ class OVNBGPDriver(driver_api.AgentDriverBase):
self._post_fork_event.set()
def _get_events(self):
events = set(["PortBindingChassisCreatedEvent",
"PortBindingChassisDeletedEvent",
"FIPSetEvent",
"FIPUnsetEvent",
"OVNLBMemberCreateEvent",
"OVNLBMemberDeleteEvent",
"ChassisCreateEvent",
"ChassisPrivateCreateEvent",
"LocalnetCreateDeleteEvent"])
events = {watcher.PortBindingChassisCreatedEvent(self),
watcher.PortBindingChassisDeletedEvent(self),
watcher.FIPSetEvent(self),
watcher.FIPUnsetEvent(self),
watcher.OVNLBMemberCreateEvent(self),
watcher.OVNLBMemberDeleteEvent(self),
watcher.ChassisCreateEvent(self),
watcher.ChassisPrivateCreateEvent(self),
watcher.LocalnetCreateDeleteEvent(self)}
if self._expose_tenant_networks:
events.update(["SubnetRouterAttachedEvent",
"SubnetRouterDetachedEvent",
"TenantPortCreatedEvent",
"TenantPortDeletedEvent",
"OVNLBVIPPortEvent"])
events.update({watcher.SubnetRouterAttachedEvent(self),
watcher.SubnetRouterDetachedEvent(self),
watcher.TenantPortCreatedEvent(self),
watcher.TenantPortDeletedEvent(self),
watcher.OVNLBVIPPortEvent(self)})
return events
@lockutils.synchronized('bgp')

View File

@ -72,13 +72,9 @@ class OVNEVPNDriver(driver_api.AgentDriverBase):
self.ovn_remote = self.ovs_idl.get_ovn_remote()
LOG.debug("Loaded chassis %s.", self.chassis)
events = ()
for event in self._get_events():
event_class = getattr(watcher, event)
events += (event_class(self),)
self._post_fork_event.clear()
events = self._get_events()
self.sb_idl = ovn.OvnSbIdl(
self.ovn_remote,
chassis=self.chassis,
@ -89,15 +85,15 @@ class OVNEVPNDriver(driver_api.AgentDriverBase):
self._post_fork_event.set()
def _get_events(self):
return {"PortBindingChassisCreatedEvent",
"PortBindingChassisDeletedEvent",
"SubnetRouterAttachedEvent",
"SubnetRouterDetachedEvent",
"TenantPortCreatedEvent",
"TenantPortDeletedEvent",
"ChassisCreateEvent",
"ChassisPrivateCreateEvent",
"LocalnetCreateDeleteEvent"}
return {watcher.PortBindingChassisCreatedEvent(self),
watcher.PortBindingChassisDeletedEvent(self),
watcher.SubnetRouterAttachedEvent(self),
watcher.SubnetRouterDetachedEvent(self),
watcher.TenantPortCreatedEvent(self),
watcher.TenantPortDeletedEvent(self),
watcher.ChassisCreateEvent(self),
watcher.ChassisPrivateCreateEvent(self),
watcher.LocalnetCreateDeleteEvent(self)}
@lockutils.synchronized('evpn')
def frr_sync(self):

View File

@ -87,13 +87,9 @@ class OVNBGPStretchedL2Driver(driver_api.AgentDriverBase):
LOG.debug("Configured allowed address scopes: %s",
", ".join(self.allowed_address_scopes))
events = ()
for event in self._get_events():
event_class = getattr(watcher, event)
events += (event_class(self),)
self._post_fork_event.clear()
events = self._get_events()
self.sb_idl = ovn.OvnSbIdl(
self.ovn_remote,
chassis=self.chassis,
@ -105,15 +101,13 @@ class OVNBGPStretchedL2Driver(driver_api.AgentDriverBase):
self._post_fork_event.set()
def _get_events(self):
return set(
[
"SubnetRouterAttachedEvent",
"SubnetRouterUpdateEvent",
"SubnetRouterDetachedEvent",
"PortBindingChassisCreatedEvent",
"PortBindingChassisDeletedEvent",
]
)
return {
watcher.SubnetRouterAttachedEvent(self),
watcher.SubnetRouterUpdateEvent(self),
watcher.SubnetRouterDetachedEvent(self),
watcher.PortBindingChassisCreatedEvent(self),
watcher.PortBindingChassisDeletedEvent(self),
}
@lockutils.synchronized('bgp')
def frr_sync(self):