diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ea804e4e..340f83af 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -19,6 +19,10 @@ Changed - Optimized ``Path.status`` not to depend on a HTTP request - Upgraded UI framework to Vue3 +Fixed +===== +- Only redeploy when handling ``kytos/topology.link_up`` if a dynamic EVC isn't active + [2023.2.0] - 2024-02-16 *********************** diff --git a/models/evc.py b/models/evc.py index 70f66899..6a6fdc5d 100644 --- a/models/evc.py +++ b/models/evc.py @@ -1612,7 +1612,7 @@ def handle_link_up(self, link): # In this case, the circuit is not being used and we should # try a dynamic path ( - lambda me: me.dynamic_backup_path, + lambda me: me.dynamic_backup_path and not me.is_active(), lambda me: (me.deploy_to_path(), 'redeploy') ) ] diff --git a/tests/unit/models/test_link_protection.py b/tests/unit/models/test_link_protection.py index 9670dc21..e2f0db6f 100644 --- a/tests/unit/models/test_link_protection.py +++ b/tests/unit/models/test_link_protection.py @@ -832,6 +832,20 @@ async def test_handle_link_up_case_6(self): assert self.evc.deploy_to_backup_path.call_count == 2 assert self.evc.deploy_to_path.call_count == 5 + async def test_handle_link_up_case_7(self): + """Test handle_link_up method.""" + return_false_mock = MagicMock(return_value=False) + self.evc.is_using_primary_path = return_false_mock + self.evc.primary_path.is_affected_by_link = return_false_mock + self.evc.is_using_dynamic_path = return_false_mock + self.evc.backup_path.is_affected_by_link = return_false_mock + self.evc.dynamic_backup_path = True + self.evc.activate() + assert self.evc.is_active() + self.evc.deploy_to_path = MagicMock(return_value=True) + assert not self.evc.handle_link_up(MagicMock()) + assert self.evc.deploy_to_path.call_count == 0 + async def test_get_interface_from_switch(self): """Test get_interface_from_switch""" interface = id_to_interface_mock('00:01:1')