ucscsdk/ucschandle.py
def query_classid(self, class_id=None, filter_str=None, hierarchy=False,
                      need_response=False, dme="central-mgr"):
        """
        Finds an object using it's class id.

        Args:
            class_id (str): class id of the object to be queried for.
            filter_str(str): query objects with specific property with
                             specific value or pattern specifying value.

                      (property_name, "property_value, type="filter_type")\n
                      property_name: Name of the Property\n
                      property_value: Value of the property (str or
                                      regular expression)\n
                      filter_type: eq - equal to\n
                                   ne - not equal to\n
                                   ge - greater than or equal to\n
                                   gt - greater than\n
                                   le - less than or equal to\n
                                   lt - less than\n
                                   re - regular expression\n

                      logical filter type: not, and, or\n

                      e.g. '(dn,"org-root/ls-C1_B1", type="eq")
                            or (name, "event", type="re", flag="I")'\n
            hierarchy(bool): if set to True will return all the child
                             hierarchical objects.
            need_response(bool): if set to True will return only response
                                object.
            dme: DME to post the query to


        Returns:
            managedobjectlist or None   by default\n
            managedobjectlist or None   if hierarchy=True\n
            methodresponse              if need_response=True\n

        Example:
            obj = handle.query_classid(class_id="LsServer")\n
            obj = handle.query_classid(class_id="LsServer", hierarchy=True)\n
            obj = handle.query_classid(class_id="LsServer",
                                       need_response=True)\n

            filter_str = '(dn,"org-root/ls-C1_B1", type="eq") or
                        (name, "event", type="re", flag="I")'\n
            obj = handle.query_classid(class_id="LsServer",
                                       filter_str=filter_str)\n
        """

        from .ucscfilter import generate_infilter
        from .ucscmethodfactory import config_resolve_class

        if not class_id:
            raise ValueError("Provide Parameter class_id")

        meta_class_id = \
            ucsccoreutils.find_class_id_in_mo_meta_ignore_case(class_id)
        if meta_class_id:
            is_meta_class_id = True
        else:
            meta_class_id = class_id
            is_meta_class_id = False

        if filter_str:
            in_filter = generate_infilter(meta_class_id, filter_str,
                                          is_meta_class_id)
        else:
            in_filter = None

        elem = config_resolve_class(cookie=self.cookie,
                                    class_id=meta_class_id,
                                    in_filter=in_filter,
                                    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

        out_mo_list = ucsccoreutils.extract_molist_from_method_response(
            response, hierarchy)
        return out_mo_list

        Finds an object using it's class id.

        Args:
            class_id (str): class id of the object to be queried for.
            filter_str(str): query objects with specific property with
                             specific value or pattern specifying value.

                      (property_name, "property_value, type="filter_type")\n
                      property_name: Name of the Property\n
                      property_value: Value of the property (str or
                                      regular expression)\n
                      filter_type: eq - equal to\n
                                   ne - not equal to\n
                                   ge - greater than or equal to\n
                                   gt - greater than\n
                                   le - less than or equal to\n
                                   lt - less than\n
                                   re - regular expression\n

                      logical filter type: not, and, or\n

                      e.g. '(dn,"org-root/ls-C1_B1", type="eq")
                            or (name, "event", type="re", flag="I")'\n
            hierarchy(bool): if set to True will return all the child
                             hierarchical objects.
            need_response(bool): if set to True will return only response
                                object.
            dme: DME to post the query to


        Returns:
            managedobjectlist or None   by default\n
            managedobjectlist or None   if hierarchy=True\n
            methodresponse              if need_response=True\n

        Example:
            obj = handle.query_classid(class_id="LsServer")\n
            obj = handle.query_classid(class_id="LsServer", hierarchy=True)\n
            obj = handle.query_classid(class_id="LsServer",
                                       need_response=True)\n

            filter_str = '(dn,"org-root/ls-C1_B1", type="eq") or
                        (name, "event", type="re", flag="I")'\n
            obj = handle.query_classid(class_id="LsServer",
                                       filter_str=filter_str)\n
        
Finds an object using it's class id.
Finds an object using it ' s class id .
def query_classid(self, class_id=None, filter_str=None, hierarchy=False,
                      need_response=False, dme="central-mgr"):
        from .ucscfilter import generate_infilter
        from .ucscmethodfactory import config_resolve_class
        if not class_id:
            raise ValueError("Provide Parameter class_id")
        meta_class_id = \
            ucsccoreutils.find_class_id_in_mo_meta_ignore_case(class_id)
        if meta_class_id:
            is_meta_class_id = True
        else:
            meta_class_id = class_id
            is_meta_class_id = False
        if filter_str:
            in_filter = generate_infilter(meta_class_id, filter_str,
                                          is_meta_class_id)
        else:
            in_filter = None
        elem = config_resolve_class(cookie=self.cookie,
                                    class_id=meta_class_id,
                                    in_filter=in_filter,
                                    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
        out_mo_list = ucsccoreutils.extract_molist_from_method_response(
            response, hierarchy)
        return out_mo_list
def query_classid ( self , class_id = None , filter_str = None , hierarchy = False , need_response = False , dme = "central-mgr" ) : from . ucscfilter import generate_infilter from . ucscmethodfactory import config_resolve_class if not class_id : raise ValueError ( "Provide Parameter class_id" ) meta_class_id = ucsccoreutils . find_class_id_in_mo_meta_ignore_case ( class_id ) if meta_class_id : is_meta_class_id = True else : meta_class_id = class_id is_meta_class_id = False if filter_str : in_filter = generate_infilter ( meta_class_id , filter_str , is_meta_class_id ) else : in_filter = None elem = config_resolve_class ( cookie = self . cookie , class_id = meta_class_id , in_filter = in_filter , 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 out_mo_list = ucsccoreutils . extract_molist_from_method_response ( response , hierarchy ) return out_mo_list
Finds an object using it's class id.
Finds an object using it ' s class id .
"""
        Finds an object using it's class id.

        Args:
            class_id (str): class id of the object to be queried for.
            filter_str(str): query objects with specific property with
                             specific value or pattern specifying value.

                      (property_name, "property_value, type="filter_type")\n
                      property_name: Name of the Property\n
                      property_value: Value of the property (str or
                                      regular expression)\n
                      filter_type: eq - equal to\n
                                   ne - not equal to\n
                                   ge - greater than or equal to\n
                                   gt - greater than\n
                                   le - less than or equal to\n
                                   lt - less than\n
                                   re - regular expression\n

                      logical filter type: not, and, or\n

                      e.g. '(dn,"org-root/ls-C1_B1", type="eq")
                            or (name, "event", type="re", flag="I")'\n
            hierarchy(bool): if set to True will return all the child
                             hierarchical objects.
            need_response(bool): if set to True will return only response
                                object.
            dme: DME to post the query to


        Returns:
            managedobjectlist or None   by default\n
            managedobjectlist or None   if hierarchy=True\n
            methodresponse              if need_response=True\n

        Example:
            obj = handle.query_classid(class_id="LsServer")\n
            obj = handle.query_classid(class_id="LsServer", hierarchy=True)\n
            obj = handle.query_classid(class_id="LsServer",
                                       need_response=True)\n

            filter_str = '(dn,"org-root/ls-C1_B1", type="eq") or
                        (name, "event", type="re", flag="I")'\n
            obj = handle.query_classid(class_id="LsServer",
                                       filter_str=filter_str)\n
        """
managedobjectlist or None   by default\n
managedobjectlist or None   if hierarchy=True\n
methodresponse              if need_response=True\n
managedobjectlist or None by default \ n managedobjectlist or None if hierarchy = True \ n methodresponse if need_response = True \ n
self
class_id
class id of the object to be queried for.
class id of the object to be queried for .
filter_str
query objects with specific property with
specific value or pattern specifying value.

(property_name, "property_value, type="filter_type")\n
property_name: Name of the Property\n
property_value: Value of the property (str or
regular expression)\n
filter_type: eq - equal to\n
ne - not equal to\n
ge - greater than or equal to\n
gt - greater than\n
le - less than or equal to\n
lt - less than\n
re - regular expression\n

logical filter type: not, and, or\n

e.g.
query objects with specific property with specific value or pattern specifying value . ( property_name " property_value type = " filter_type " ) \ n property_name : Name of the Property \ n property_value : Value of the property ( str or regular expression ) \ n filter_type : eq - equal to \ n ne - not equal to \ n ge - greater than or equal to \ n gt - greater than \ n le - less than or equal to \ n lt - less than \ n re - regular expression \ n logical filter type : not and or \ n e . g .
hierarchy
if set to True will return all the child
hierarchical objects.
if set to True will return all the child hierarchical objects .
need_response
if set to True will return only response
object.
if set to True will return only response object .
dme
DME to post the query to
DME to post the query to
examples
obj = handle.query_classid(class_id="LsServer")\n
obj = handle.query_classid(class_id="LsServer", hierarchy=True)\n
obj = handle.query_classid(class_id="LsServer",
need_response=True)\n

filter_str = '(dn,"org-root/ls-C1_B1", type="eq") or
(name, "event", type="re", flag="I")'\n
obj = handle.query_classid(class_id="LsServer",
filter_str=filter_str)\n
obj = handle . query_classid ( class_id = " LsServer " ) \ n obj = handle . query_classid ( class_id = " LsServer " hierarchy = True ) \ n obj = handle . query_classid ( class_id = " LsServer " need_response = True ) \ n filter_str = ' ( dn " org - root / ls - C1_B1 " type = " eq " ) or ( name " event " type = " re " flag = " I " ) ' \ n obj = handle . query_classid ( class_id = " LsServer " filter_str = filter_str ) \ n