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

List of links (topology) should be in core and not in topology #92

Open
ajoaoff opened this issue Jun 18, 2021 · 2 comments
Open

List of links (topology) should be in core and not in topology #92

ajoaoff opened this issue Jun 18, 2021 · 2 comments
Labels
future_release Planned for the next release priority_medium Medium priority

Comments

@ajoaoff
Copy link

ajoaoff commented Jun 18, 2021

Original issue opened by @ajoaoff at kytos#1064.

The list of links must be accessible by all applications, like the list of switches and interfaces. Although the topology is discovered by the kytos/topology NApp, the results should be stored in the core. The NApp kytos/of_core deals with switch connections, but the data is stored in the core.

@viniarck
Copy link
Member

Related issues:

kytos-ng/maintenance#90

kytos-ng/mef_eline#464

@viniarck
Copy link
Member

Quick summary of major points to be moved and refactored on both kytos and topology:

  • Move _get_link_or_create(endpoint_a, endpoint_b) to kytos.core.controller.get_link_or_create(endpoint_a: Interface, endpoint_b: Interface)
  • Move topology self.links dict to Controller.links
  • Move topology self._links_lock to Controller._links_lock.
  • Move topology get_link_from_interface(interface) to kytos.core.controller.get_link_from_interface(interface: Interface) -> Optional[Link]. This method should be thread safe using Controller._links_lock.
  • Add a new method get_link(link_id: str) -> Optional[Link]
  • Refactor all topology self.links usage to use kytos.core.controller.links instead, including preserving the shallow copies
  • Refactor topology self._links_lock to use a shallow copy where it's iterating over links.
  • Refactor topology on_interruption_start to use another local lock something like with self._interruption_lock each start event needs to be processed sequentially, and on_interruption_end to also use the same lock.
  • Add a new method on kytos.core.controller.remove_link(link_id: str) -> Optional[Link]

All topology DB writes will still be managed by topology, only the Link instances refs should be moved to core just so certain memory reads becomes easier and avoid IO in many cases that it used to have in certain request calls.

topology endpoints will still stay the same, no compatibility broken except self.links which shouldn't accessed by other NApps, although maintenance is doing it kytos-ng/maintenance#90, so that needs to be refactored too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
future_release Planned for the next release priority_medium Medium priority
Projects
None yet
Development

No branches or pull requests

2 participants