Skip to content

Commit

Permalink
Merge pull request #471 from kytos-ng/fix/link_up_redeploy
Browse files Browse the repository at this point in the history
fix: only redeploy when handling kytos/topology.link_up if a dynamic EVC isn't active
  • Loading branch information
viniarck authored Jun 11, 2024
2 parents f57e291 + 63ea29f commit 7981cdb
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
***********************

Expand Down
2 changes: 1 addition & 1 deletion models/evc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
)
]
Expand Down
14 changes: 14 additions & 0 deletions tests/unit/models/test_link_protection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 7981cdb

Please sign in to comment.