Merge "Move _get_ips_info out of LRP event" into stable/2024.1

This commit is contained in:
Zuul 2024-11-20 12:54:55 +00:00 committed by Gerrit Code Review
commit 246dfb7c5d
3 changed files with 13 additions and 13 deletions

View File

@ -41,3 +41,14 @@ def make_lsp_dict(row):
'logical_switch': common.get_from_external_ids(
row, constants.OVN_LS_NAME_EXT_ID_KEY),
}
def make_lrp_dict(row):
return {
'mac': row.mac,
'cidrs': row.networks,
'type': constants.OVN_CR_LRP_PORT_TYPE,
'logical_switch': common.get_from_external_ids(
row, constants.OVN_LS_NAME_EXT_ID_KEY),
'router': row.external_ids.get(constants.OVN_LR_NAME_EXT_ID_KEY),
}

View File

@ -16,7 +16,6 @@ from oslo_log import log as logging
from ovsdbapp.backend.ovs_idl import event as row_event
from ovn_bgp_agent import constants
from ovn_bgp_agent.drivers.openstack.utils import common as common_utils
from ovn_bgp_agent.drivers.openstack.utils import driver_utils
@ -74,16 +73,6 @@ class LRPChassisEvent(Event):
super().__init__(bgp_agent, events, table)
self.event_name = self.__class__.__name__
def _get_ips_info(self, row):
return {
'mac': row.mac,
'cidrs': row.networks,
'type': constants.OVN_CR_LRP_PORT_TYPE,
'logical_switch': common_utils.get_from_external_ids(
row, constants.OVN_LS_NAME_EXT_ID_KEY),
'router': row.external_ids.get(constants.OVN_LR_NAME_EXT_ID_KEY),
}
class ChassisCreateEventBase(Event):
table = None

View File

@ -414,7 +414,7 @@ class ChassisRedirectCreateEvent(base_watcher.LRPChassisEvent):
def _run(self, event, row, old):
with _SYNC_STATE_LOCK.read_lock():
ips_info = self._get_ips_info(row)
ips_info = port_utils.make_lrp_dict(row)
ips = [net.split("/")[0] for net in row.networks]
self.agent.expose_ip(ips, ips_info)
@ -448,7 +448,7 @@ class ChassisRedirectDeleteEvent(base_watcher.LRPChassisEvent):
def _run(self, event, row, old):
with _SYNC_STATE_LOCK.read_lock():
ips_info = self._get_ips_info(row)
ips_info = port_utils.make_lrp_dict(row)
ips = [net.split("/")[0] for net in row.networks]
self.agent.withdraw_ip(ips, ips_info)