ucscsdk/ucschandle.py
def query_dn(self, dn, hierarchy=False, need_response=False,
                 dme="central-mgr"):
        """
        Finds an object using it's distinguished name.

        Args:
            dn (str): distinguished name of the object to be queried for.
            hierarchy(bool): True/False,
                                get all objects in hierarchy if True
            need_response(bool): True/False,
                                return the response xml node, instead of parsed
                                objects
            dme: DME to post the query to

        Returns:
            managedobject or None   by default\n
            managedobject list      if hierarchy=True\n
            externalmethod object   if need_response=True\n

        Example:
            obj = handle.lookup_by_dn("fabric/lan/net-100")\n
            obj = handle.lookup_by_dn("fabric/lan/net-100", hierarchy=True)\n
            obj = handle.lookup_by_dn("fabric/lan/net-100",
                                      need_response=True)\n
            obj = handle.lookup_by_dn("fabric/lan/net-100", hierarchy=True,
                                       need_response=True)\n
        """

        from .ucscmethodfactory import config_resolve_dn

        if not dn:
            raise ValueError("Provide dn.")

        elem = config_resolve_dn(cookie=self.cookie,
                                 dn=dn,
                                 in_hierarchical=hierarchy)
        response = self.post_elem(elem, dme=dme)
        if response.error_code != 0:
            raise UcscException(response.error_code, response.error_descr)

        if need_response:
            return response

        if hierarchy:
            out_mo_list = \
                ucsccoreutils.extract_molist_from_method_response(
                    response,
                    hierarchy)
            return out_mo_list

        mo = None
        if len(response.out_config.child) > 0:
            mo = response.out_config.child[0]
        return mo

        Finds an object using it's distinguished name.

        Args:
            dn (str): distinguished name of the object to be queried for.
            hierarchy(bool): True/False,
                                get all objects in hierarchy if True
            need_response(bool): True/False,
                                return the response xml node, instead of parsed
                                objects
            dme: DME to post the query to

        Returns:
            managedobject or None   by default\n
            managedobject list      if hierarchy=True\n
            externalmethod object   if need_response=True\n

        Example:
            obj = handle.lookup_by_dn("fabric/lan/net-100")\n
            obj = handle.lookup_by_dn("fabric/lan/net-100", hierarchy=True)\n
            obj = handle.lookup_by_dn("fabric/lan/net-100",
                                      need_response=True)\n
            obj = handle.lookup_by_dn("fabric/lan/net-100", hierarchy=True,
                                       need_response=True)\n
        
Finds an object using it's distinguished name.
Finds an object using it ' s distinguished name .
def query_dn(self, dn, hierarchy=False, need_response=False,
                 dme="central-mgr"):
        from .ucscmethodfactory import config_resolve_dn
        if not dn:
            raise ValueError("Provide dn.")
        elem = config_resolve_dn(cookie=self.cookie,
                                 dn=dn,
                                 in_hierarchical=hierarchy)
        response = self.post_elem(elem, dme=dme)
        if response.error_code != 0:
            raise UcscException(response.error_code, response.error_descr)
        if need_response:
            return response
        if hierarchy:
            out_mo_list = \
                ucsccoreutils.extract_molist_from_method_response(
                    response,
                    hierarchy)
            return out_mo_list
        mo = None
        if len(response.out_config.child) > 0:
            mo = response.out_config.child[0]
        return mo
def query_dn ( self , dn , hierarchy = False , need_response = False , dme = "central-mgr" ) : from . ucscmethodfactory import config_resolve_dn if not dn : raise ValueError ( "Provide dn." ) elem = config_resolve_dn ( cookie = self . cookie , dn = dn , in_hierarchical = hierarchy ) response = self . post_elem ( elem , dme = dme ) if response . error_code != 0 : raise UcscException ( response . error_code , response . error_descr ) if need_response : return response if hierarchy : out_mo_list = ucsccoreutils . extract_molist_from_method_response ( response , hierarchy ) return out_mo_list mo = None if len ( response . out_config . child ) > 0 : mo = response . out_config . child [ 0 ] return mo
Finds an object using it's distinguished name.
Finds an object using it ' s distinguished name .
"""
        Finds an object using it's distinguished name.

        Args:
            dn (str): distinguished name of the object to be queried for.
            hierarchy(bool): True/False,
                                get all objects in hierarchy if True
            need_response(bool): True/False,
                                return the response xml node, instead of parsed
                                objects
            dme: DME to post the query to

        Returns:
            managedobject or None   by default\n
            managedobject list      if hierarchy=True\n
            externalmethod object   if need_response=True\n

        Example:
            obj = handle.lookup_by_dn("fabric/lan/net-100")\n
            obj = handle.lookup_by_dn("fabric/lan/net-100", hierarchy=True)\n
            obj = handle.lookup_by_dn("fabric/lan/net-100",
                                      need_response=True)\n
            obj = handle.lookup_by_dn("fabric/lan/net-100", hierarchy=True,
                                       need_response=True)\n
        """
managedobject or None   by default\n
managedobject list      if hierarchy=True\n
externalmethod object   if need_response=True\n
managedobject or None by default \ n managedobject list if hierarchy = True \ n externalmethod object if need_response = True \ n
self
dn
distinguished name of the object to be queried for.
distinguished name of the object to be queried for .
hierarchy
True/False,
get all objects in hierarchy if True
True / False get all objects in hierarchy if True
need_response
True/False,
return the response xml node, instead of parsed
objects
True / False return the response xml node instead of parsed objects
dme
DME to post the query to
DME to post the query to
examples
obj = handle.lookup_by_dn("fabric/lan/net-100")\n
obj = handle.lookup_by_dn("fabric/lan/net-100", hierarchy=True)\n
obj = handle.lookup_by_dn("fabric/lan/net-100",
need_response=True)\n
obj = handle.lookup_by_dn("fabric/lan/net-100", hierarchy=True,
need_response=True)\n
obj = handle . lookup_by_dn ( " fabric / lan / net - 100 " ) \ n obj = handle . lookup_by_dn ( " fabric / lan / net - 100 " hierarchy = True ) \ n obj = handle . lookup_by_dn ( " fabric / lan / net - 100 " need_response = True ) \ n obj = handle . lookup_by_dn ( " fabric / lan / net - 100 " hierarchy = True need_response = True ) \ n