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

Hide implementation details #169

Open
sajith opened this issue Jan 24, 2024 · 0 comments
Open

Hide implementation details #169

sajith opened this issue Jan 24, 2024 · 0 comments
Assignees

Comments

@sajith
Copy link
Member

sajith commented Jan 24, 2024

Treating TESolver and TopologyManager classes as private implementation details should make this library easier to use, and thus reduce the chances of confusion. We could:

  • Make TEManager provide all of the surface API to PCE, by moving TESolver and TopologyManager classes to a private module.
  • "Gate" the necessary methods via TEManager.

As a more concrete example, consider this code sample from the README:

from sdx_pce.load_balancing.te_solver import TESolver
from sdx_pce.topology.temanager import TEManager

temanager = TEManager(initial_topology)
for topology in topologies:
    temanager.add_topology(topology)
    
graph = temanager.generate_graph_te()
traffic_matrix = temanager.generate_traffic_matrix(connection_request)

solution = TESolver(graph, traffic_matrix).solve()

breakdown = temanager.generate_connection_breakdown(solution)
for domain, link in breakdown.items():
    # publish(domain, link)

This would become:

from sdx_pce.topology.temanager import TEManager

temanager = TEManager(initial_topology)
for topology in topologies:
    temanager.add_topology(topology)
    
# generate graph, traffic matrix, and call TESolver.solve()
solution = temanager.solve(connection_request)

breakdown = temanager.generate_connection_breakdown(solution)
for domain, link in breakdown.items():
    # publish(domain, link)

Or maybe even:

from sdx_pce.topology.temanager import TEManager

temanager = TEManager(initial_topology)
for topology in topologies:
    temanager.add_topology(topology)

# generate graph, traffic matrix, call TESolver.solve(), and 
# then return a breakdown usable across domain.
breakdown = temanager.solve(connection_request)

for domain, link in breakdown.items():
    # publish(domain, link)
@sajith sajith self-assigned this Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant