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

interface: add depth parameter to get_facts #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pyaoscx/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def from_uri(cls, session, uri):
return name, interface_obj

@classmethod
def get_facts(cls, session):
def get_facts(cls, session, depth=None):
"""
Perform a GET call to retrieve all Interfaces and their data.

Expand All @@ -415,7 +415,11 @@ def get_facts(cls, session):
logging.info("Retrieving the switch interfaces facts")

# Set depth
interface_depth = session.api.default_facts_depth
interface_depth = depth or session.api.default_facts_depth

if not session.api.valid_depth(interface_depth):
interface_depth = session.api.default_facts_depth
raise Exception("ERROR: Depth should be {0}".format(interface_depth))

# Build URI
uri = "{0}?depth={1}".format(Interface.base_uri, interface_depth)
Expand Down