Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a method:TEManager.add_breakdowns_to_connection(connection_reques… #188

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/sdx_pce/topology/temanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,11 @@ def get_links_on_path(self, solution: ConnectionSolution) -> list:

return result

def add_breakdowns_to_connection(self, connection_request: dict, breakdowns: dict):
connection_request["breakdowns"] = breakdowns

return connection_request
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a docstring here? The purpose of this method is not immediately obvious... I will likely wonder what this was about after a couple of months or weeks. :-)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree-:). (1) the whole purpose is to associate the connect request with its computed breakdowns so sdx-controller can remember(2) I think this method might be absorbed by the pce.generate_connection_breakdown(), but I don't want to change any existing methods for . so this... when you work on unreserve_vlan workflow, feel free to change it if needed.


def generate_connection_breakdown(
self, solution: ConnectionSolution, connection_request: dict
) -> dict:
Expand Down
8 changes: 8 additions & 0 deletions tests/test_te_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,14 @@ def test_connection_amlight_to_zaoxi(self):
)
print(f"breakdown: {json.dumps(breakdown)}")

connection_request = temanager.add_breakdowns_to_connection(
connection_request, breakdown
)

temanager._logger.info(
f"connection_request with breakdowns: {connection_request}"
)

# Note that the "domain" key is correct in the breakdown
# result when we initialize TEManager with None for topology,
# and later add individual topologies with add_topology().
Expand Down