diff --git a/pyaoscx/interface.py b/pyaoscx/interface.py index 54273e2..bfd74bc 100644 --- a/pyaoscx/interface.py +++ b/pyaoscx/interface.py @@ -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. @@ -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)