dropbox / nsot

Network Source of Truth is an open source IPAM and network inventory database
https://nsot.readthedocs.io
Other
399 stars 66 forks source link

Interface Tree traversal #271

Closed rmhasan closed 7 years ago

rmhasan commented 7 years ago

Added following methods in InterfaceViewSet which can be invoked by get requests to return view sets

  1. parent
  2. ancestors
  3. children
  4. descendants
  5. siblings
  6. root

Also implemented following methods in Interface model class in models.py which get invoked in the view methods

  1. get_ancestors
  2. get_children
  3. get_descendants
  4. get_root
  5. get_siblings

Also added tests in tests/api_tests/test_interfaces.py and tests/model_tests/test_interfaces.py

jathanism commented 7 years ago

Oh awesome. Sorry I've been behind the curve. I'll check this out. Thank you!!

jathanism commented 7 years ago

I'm going to review this damn thing eventually. I need a clone.

rmhasan commented 7 years ago

Hi @jathanism and @nickpegg, I saw the feed back on #266 and #271. I will work on them soon.

rmhasan commented 7 years ago

Hi @jathanism and @nickpegg I worked on the changes you requested. Sorry it took so long.

jathanism commented 7 years ago

@rmhasan There's no need to apologize, you're a hero!

rmhasan commented 7 years ago

Hi @jathanism and @nickpegg. I made the following changes.

EDIT: You can also checkout PR dropbox/pynsot#134 to test the new tree traversal methods.

rmhasan commented 7 years ago

Hi @jathanism I made the following changes

nickpegg commented 7 years ago

Thanks for this contribution! :) I'm merging this and cutting a new version. I'll drop a note on this PR once that version's available on PyPI.

nickpegg commented 7 years ago

v.1.1.4 released to PyPI: https://pypi.python.org/pypi/nsot/1.1.4