From 3ce1d76a394366f1d7574e20f20d56b6cb16a563 Mon Sep 17 00:00:00 2001 From: snehal tembhurne Date: Mon, 25 Jul 2022 05:15:56 +0000 Subject: [PATCH] fixed apic synchronization state for multiple erspan session Change-Id: Ifa41902518944702aeeb7f0b9e690f851199cdb1 --- .../ml2plus/drivers/apic_aim/mechanism_driver.py | 5 +++++ .../tests/unit/plugins/ml2plus/test_apic_aim.py | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/gbpservice/neutron/plugins/ml2plus/drivers/apic_aim/mechanism_driver.py b/gbpservice/neutron/plugins/ml2plus/drivers/apic_aim/mechanism_driver.py index 1d1c86270..d8b2f23ee 100644 --- a/gbpservice/neutron/plugins/ml2plus/drivers/apic_aim/mechanism_driver.py +++ b/gbpservice/neutron/plugins/ml2plus/drivers/apic_aim/mechanism_driver.py @@ -1311,6 +1311,11 @@ class ApicMechanismDriver(api_plus.MechanismDriver, # the status objs for all of the associated AIM resources. Until # this happens, the sync_state is held as 'build' (unless it has # 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_resources_aggregate.extend(aim_resources) diff --git a/gbpservice/neutron/tests/unit/plugins/ml2plus/test_apic_aim.py b/gbpservice/neutron/tests/unit/plugins/ml2plus/test_apic_aim.py index 4f352c4e3..167633e79 100644 --- a/gbpservice/neutron/tests/unit/plugins/ml2plus/test_apic_aim.py +++ b/gbpservice/neutron/tests/unit/plugins/ml2plus/test_apic_aim.py @@ -4241,6 +4241,16 @@ class TestSyncState(ApicAimTestCase): self._bind_port_to_host(p1['id'], 'host1') port = self._show('ports', p1['id'])['port'] 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 get_status(self, context, resource, create_if_absent=True):