Skip to content

Commit

Permalink
Merge pull request #448 from kytos-ng/fix/failover_redeploy_cleanup
Browse files Browse the repository at this point in the history
fix: remove failover flows upfront during redeploy
  • Loading branch information
viniarck authored Mar 15, 2024
2 parents 60ebb1d + f84860c commit 06f53e5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Fixed
- fixed race condition in ``failover_path`` when handling simultaneous Link Down events leading to inconsistencies on some EVC
- fixed sdntrace_cp check_trace ``current_path`` comparison with the expected UNI order
- fixed ``DynamicPathManager.get_paths`` return value when ``pathfinder`` returns a request error
- ``failover_path`` will get removed if it exists during a redeploy

[2023.1.0] - 2023-06-27
***********************
Expand Down
3 changes: 2 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,8 @@ def redeploy(self, request: Request) -> JSONResponse:
) from KeyError
if evc.is_enabled():
with evc.lock:
evc.remove_current_flows()
evc.remove_failover_flows(sync=False)
evc.remove_current_flows(sync=True)
evc.deploy()
result = {"response": f"Circuit {circuit_id} redeploy received."}
status = 202
Expand Down
4 changes: 4 additions & 0 deletions tests/unit/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,8 @@ async def test_redeploy_evc(self):
self.napp.circuits = {"1": evc1, "2": MagicMock()}
url = f"{self.base_endpoint}/v2/evc/1/redeploy"
response = await self.api_client.patch(url)
evc1.remove_failover_flows.assert_called()
evc1.remove_current_flows.assert_called()
assert response.status_code == 202, response.data

async def test_redeploy_evc_disabled(self):
Expand All @@ -844,6 +846,8 @@ async def test_redeploy_evc_disabled(self):
self.napp.circuits = {"1": evc1, "2": MagicMock()}
url = f"{self.base_endpoint}/v2/evc/1/redeploy"
response = await self.api_client.patch(url)
evc1.remove_failover_flows.assert_not_called()
evc1.remove_current_flows.assert_not_called()
assert response.status_code == 409, response.data

async def test_redeploy_evc_deleted(self):
Expand Down

0 comments on commit 06f53e5

Please sign in to comment.