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

Implement tree traversal methods for Interface objects #260

Closed
jathanism opened this issue Jan 31, 2017 · 1 comment
Closed

Implement tree traversal methods for Interface objects #260

jathanism opened this issue Jan 31, 2017 · 1 comment

Comments

@jathanism
Copy link
Contributor

Similarly, yet not as detailed as for Networks, we need the following:

  ancestors       Recursively get all parents of an interface
  assignments     Get interface assignments for an interface
  children        Get immediate children of an interface
  descendants     Recursively get all children of an interface
  parent          Get parent interface of an interface
  root            Get parent of all ancestors of an interface
  siblings        Get interfaces with same parent as an interface

I'm uncertain if there's value of "siblings" but it may be useful to quickly and identify all other member interfaces of a LAG, for example.

nickpegg pushed a commit that referenced this issue May 30, 2017
* Fix for #260
Implemented all tree traversal methods like ancestors, parent, root,
children, descendents etc.

* added tests for interface tree traversal methods

* Added changes requested on 05/11/2017
- used self.retrieve to return parent and root of interfaces
- changed filter query on siblings to look for interfaces
	with same parent and device

* Added tests to check the following
- If someone calls the root view on an Interface object and its
	parent is None, then it should be returned as the root
- Also added tests to check that if sibling is called on an Interface
	object, then Interface objects with same parent and device
	are returned

* Added validation check and tests for following
-Added validation check to prevent users from adding interfaces with different
	device than its parent or add a parent to an existing interface that
	has a different device than itself
-Also added test to check that when a user calls siblings view on an interface
	object, then only interfaces with same parent and device are returned

* Changes include following
- Updated docstrings for parent and added docstrings
	for other view functions
- Changing ValidationError message for setting siblings to
	use a double quoted string
- Also returning a queryset from get_siblings instead of a list

* Changes include following
- Update the docstring of some Interface model functions
- Return queryset from get_descendants and get_ancestors in
	Interface model
@nickpegg
Copy link
Contributor

Fixed by #271, released in v1.1.4. Thanks @rmhasan!

nickpegg pushed a commit to dropbox/pynsot that referenced this issue May 31, 2017
* Fix for dropbox/nsot#260
Added all subcommands to query new endpoints in
Interface view

* Modified the docstrings in cmd_interfaces.py for the new
tree traversal subcommands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants