atlanticwave-sdx / pce

Path Computation Element for AtlanticWave SDX.
https://www.atlanticwave-sdx.net
0 stars 3 forks source link

Hide implementation details #169

Open sajith opened 10 months ago

sajith commented 10 months ago

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:

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)