Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
rmhasan authored and nickpegg committed May 31, 2017
1 parent 290606d commit 7a49009
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions pynsot/commands/cmd_interfaces.py
Original file line number Diff line number Diff line change
@@ -343,6 +343,58 @@ def addresses(ctx, *args, **kwargs):
)


@list.command()
@click.pass_context
def parent(ctx, *args, **kwargs):
"""Get the parent Interface of an Interface."""
callbacks.list_subcommand(
ctx, display_fields=VERBOSE_FIELDS, my_name=ctx.info_name
)


@list.command()
@click.pass_context
def ancestors(ctx, *args, **kwargs):
"""Recursively get all parents of an Interface."""
callbacks.list_subcommand(
ctx, display_fields=DISPLAY_FIELDS, my_name=ctx.info_name
)


@list.command()
@click.pass_context
def children(ctx, *args, **kwargs):
"""Get immediate children of an Interface."""
callbacks.list_subcommand(
ctx, display_fields=DISPLAY_FIELDS, my_name=ctx.info_name
)


@list.command()
@click.pass_context
def descendants(ctx, *args, **kwargs):
"""Recursively get all children of an Interface."""
callbacks.list_subcommand(
ctx, display_fields=DISPLAY_FIELDS, my_name=ctx.info_name
)


@list.command()
@click.pass_context
def root(ctx, *args, **kwargs):
"""Get parent of all ancestors of an Interface."""
callbacks.list_subcommand(
ctx, display_fields=VERBOSE_FIELDS, my_name=ctx.info_name
)

@list.command()
@click.pass_context
def siblings(ctx, *args, **kwargs):
"""Get Interfaces with the same parent and device id as an Interface."""
callbacks.list_subcommand(
ctx, display_fields=VERBOSE_FIELDS, my_name=ctx.info_name
)

ASSIGNMENT_FIELDS = (
('id', 'ID'),
('hostname', 'Device'),

0 comments on commit 7a49009

Please sign in to comment.