@@ -2531,6 +2531,9 @@ def get(cls, session, pod_parent=None, node=None, module=None, port=None):
25312531 If the pod, node, module and port are specified, then only that
25322532 specific interface is read.
25332533
2534+ If the pod and node are specified, then only those interfaces are
2535+ read
2536+
25342537 :param session: the instance of Session used for APIC communication
25352538 :param pod_parent: Linecard instance to limit interfaces or pod\
25362539 number (optional)
@@ -2558,9 +2561,14 @@ def get(cls, session, pod_parent=None, node=None, module=None, port=None):
25582561 if not isinstance (pod_parent , str ):
25592562 raise TypeError (('When specifying a specific port, the pod '
25602563 'must be identified by a string' ))
2564+ # Handle case where only node is specified
2565+ elif node :
2566+ if not isinstance (pod_parent , str ):
2567+ raise TypeError (('When specifying a specific node, the pod '
2568+ 'must be identified by a string' ))
25612569 else :
25622570 if pod_parent :
2563- if not isinstance (pod_parent , cls . _get_parent_class () ):
2571+ if not isinstance (pod_parent , str ):
25642572 raise TypeError ('Interface parent must be a {0} object' .format (cls ._get_parent_class ()))
25652573
25662574 cdp_policies = Interface ._get_discoveryprot_policies (session , 'cdp' )
@@ -2570,6 +2578,12 @@ def get(cls, session, pod_parent=None, node=None, module=None, port=None):
25702578 dist_name = 'topology/pod-{0}/node-{1}/sys/phys-[eth{2}/{3}]' .format (pod_parent , node , module , port )
25712579 interface_query_url = ('/api/mo/' + dist_name + '.json?query-target=self' )
25722580 eth_query_url = ('/api/mo/' + dist_name + '/phys.json?query-target=self' )
2581+ # add the case where we return all of the ports of a given node
2582+ elif node :
2583+ dist_name = 'topology/pod-1/node-{0}/sys' .format (node )
2584+ interface_query_url = ('/api/mo/' + dist_name + '.json?query-target=children&target-subtree-class=l1PhysIf' )
2585+ eth_query_url = ('/api/mo/' + dist_name + '.json?query-target=subtree&target-subtree-class=ethpmPhysIf' )
2586+
25732587 else :
25742588 interface_query_url = '/api/node/class/l1PhysIf.json?query-target=self'
25752589 eth_query_url = '/api/node/class/ethpmPhysIf.json?query-target=self'
0 commit comments