fixed apic synchronization state for multiple erspan session

Change-Id: Ifa41902518944702aeeb7f0b9e690f851199cdb1
This commit is contained in:
snehal tembhurne 2022-07-25 05:15:56 +00:00
parent 549f0f3688
commit 3ce1d76a39
2 changed files with 15 additions and 0 deletions

View File

@ -1311,6 +1311,11 @@ class ApicMechanismDriver(api_plus.MechanismDriver,
# the status objs for all of the associated AIM resources. Until # the status objs for all of the associated AIM resources. Until
# this happens, the sync_state is held as 'build' (unless it has # this happens, the sync_state is held as 'build' (unless it has
# to be set to 'error'). # to be set to 'error').
aim_resources = []
for resource in resources:
if resource not in aim_resources:
aim_resources.append(resource)
aim_status_track[AIM_RESOURCES_CNT] = len(aim_resources) aim_status_track[AIM_RESOURCES_CNT] = len(aim_resources)
aim_resources_aggregate.extend(aim_resources) aim_resources_aggregate.extend(aim_resources)

View File

@ -4241,6 +4241,16 @@ class TestSyncState(ApicAimTestCase):
self._bind_port_to_host(p1['id'], 'host1') self._bind_port_to_host(p1['id'], 'host1')
port = self._show('ports', p1['id'])['port'] port = self._show('ports', p1['id'])['port']
self.assertEqual(expected_state, port['apic:synchronization_state']) self.assertEqual(expected_state, port['apic:synchronization_state'])
# Verify synchronization state for multiple erspan session
if with_erspan:
erspan_config['apic:erspan_config'].append(
{'dest_ip': '192.168.0.11',
'direction': 'in',
'flow_id': '1022'})
data = {'port': erspan_config}
p1 = self._update('ports', p1['id'], data)['port']
self.assertEqual(expected_state,
port['apic:synchronization_state'])
def test_erspan_no_status(self): def test_erspan_no_status(self):
def get_status(self, context, resource, create_if_absent=True): def get_status(self, context, resource, create_if_absent=True):