Ejemplo n.º 1
0
    def load_from_xml(self, element, handle):
        """ Method creates the object from the XML representation of the an external method object. """
        from Imc import class_factory
        self.set_handle(handle)
        if element.attrib:
            for attr_name, attr_value in element.attrib.iteritems():
                attr = ImcUtils.word_u(attr_name)
                if attr in CoreUtils.get_property_list(self._class_id):
                    at_meta = CoreUtils.get_method_property_meta(self._class_id, attr)
                    if at_meta.io == "Input" or at_meta.is_complex_type:
                        continue
                    self.set_attr(attr, str(attr_value))
                elif attr_name in _EXTERNAL_METHOD_ATTRS:
                    self.set_attr(_EXTERNAL_METHOD_ATTRS[attr_name], str(attr_value))

        child_elements = element.getchildren()
        if child_elements:
            for child_element in child_elements:
                if not ET.iselement(child_element) :
                    continue
        
                cln = ImcUtils.word_u(child_element.tag)
                if cln in CoreUtils.get_property_list(self._class_id):
                    prop_meta = CoreUtils.get_method_property_meta(self._class_id, cln)
                    if prop_meta.io == "Output" and prop_meta.is_complex_type:
                        child = class_factory(prop_meta.field_type)
                        if child != None:
                            self.set_attr(cln, child)
                            child.load_from_xml(child_element, handle)
Ejemplo n.º 2
0
    def get_attr(self, key):
        """ This method gets attribute value of a Managed Object. """
        if key == "_class_id" and self.__dict__.has_key(key):
            return self.__dict__[key]

        if CoreUtils.find_class_id_in_mo_meta_ignore_case(self.class_id):
            if self.__dict__.has_key(key):
                if key in _MANAGED_OBJECT_META[self.class_id]:
                    # property exists
                    return self.__dict__[key]
            else:
                if self.__dict__.has_key('_ManagedObject__xtra_property'):
                    if self.__xtra_property.has_key(key):
                        return self.__xtra_property[ImcUtils.word_u(key)]
                    else:
                        raise AttributeError(key)
                else:
                    print "No xtra_property in mo:", self.class_id, " key:", key
        else:
            # property does not exist
            if self.__dict__['_ManagedObject__xtra_property'].has_key(key):
                return self.__xtra_property[ImcUtils.word_u(key)]
            elif key == "Dn" or key == "Rn":
                return None
            else:
                raise AttributeError(key)
Ejemplo n.º 3
0
    def load_from_xml(self, element, handle):
        """ Method creates the object from the xml representation of the managed object. """
        self.set_handle(handle)
        if element.attrib:
            for attr_name, attr_value in element.attrib.iteritems():
                attr = ImcUtils.word_u(attr_name)
                if CoreUtils.find_class_id_in_mo_meta_ignore_case(self._class_id) != None:
                    if attr in CoreUtils.get_property_list(self._class_id):
                        self.set_attr(attr, str(attr_value))
                    else:
                        self.set_attr(attr, str(attr_value))
                else:
                    self.set_attr(ImcUtils.word_u(attr), str(attr_value))
            
            if self.get_attr("Rn") == None and self.get_attr("Dn") != None:
                self.set_attr("Rn", str(re.sub(r'^.*/', '', self.get_attr("Dn"))))

        child_elements = element.getchildren()
        if child_elements:
            for child_element in child_elements:
                if not ET.iselement(child_element) :
                    continue
    
                if child_element.tag in self.prop_mo_meta.field_names:
                    pass
                #TODO: Need code analysis.
                child = ManagedObject(ImcUtils.word_u(child_element.tag))
                self._child.append(child)
                child.load_from_xml(child_element, handle)
Ejemplo n.º 4
0
    def to_managed_object(self):
        """
        Method creates and returns an object of ManagedObject class using the class_id and information from the
        Generic managed object.
        """
        from Imc import class_factory

        cln = ImcUtils.word_u(self._class_id)
        mo = class_factory(cln)
        if mo and isinstance(mo, ManagedObject) == True:
            meta_class_id = CoreUtils.find_class_id_in_mo_meta_ignore_case(
                self._class_id)
            mo.set_handle(self._handle)
            for prop in self.properties:
                if ImcUtils.word_u(prop) in CoreUtils.get_property_list(
                        meta_class_id):
                    mo.set_attr(ImcUtils.word_u(prop), self.properties[prop])
                else:
                    ImcUtils.write_imc_warning(
                        "Property %s Not Exist in MO %s" %
                        (ImcUtils.word_u(prop), meta_class_id))

            if len(self._child):
                for child in self._child:
                    moch = child.to_managed_object()
                    mo.child.append(moch)
            return mo
        else:
            return None
Ejemplo n.º 5
0
def _write_mo(mo):
    """ Method to return string representation of a managed object. """
    class_not_found = False
    if CoreUtils.find_class_id_in_mo_meta_ignore_case(mo.class_id) == None:
        class_not_found = True
    tab_size = 8
    out_str = "\n"
    if class_not_found:
        out_str += "Managed Object\t\t\t:\t" + str(ImcUtils.word_u(mo.class_id)) + "\n"
    else:
        out_str += "Managed Object\t\t\t:\t" + str(mo.prop_mo_meta.name) + "\n"
    out_str += "-"*len("Managed Object") + "\n"
    if not class_not_found:
        for prop in CoreUtils.get_property_list(mo.prop_mo_meta.name):
            #prop_meta = CoreUtils.get_mo_property_meta(mo.prop_mo_meta.name, prop)
            #if (prop_meta.access == MoPropertyMeta.Internal):
                #continue
            val = mo.get_attr(prop)
            #if val != None and val != "":
            out_str += str(prop).ljust(tab_size*4) + ':' + str(val) + "\n"
    else:
        for prop in mo.__dict__:
            if prop in ['_class_id', '_ManagedObject__xtra_property', '_handle', 'prop_mo_meta', '_dirty_mask', '_child']:
                continue
            val = mo.__dict__[prop]
            out_str += str(ImcUtils.word_u(prop)).ljust(tab_size*4) + ':' + str(val) + "\n"
    if mo.__dict__.has_key('_ManagedObject__xtra_property'):
        for xtra_prop in mo.__dict__['_ManagedObject__xtra_property']:
            out_str += ('[X]' + str(ImcUtils.word_u(xtra_prop))).ljust(tab_size*4) + ':' + str(mo.__dict__['_ManagedObject__xtra_property'][xtra_prop]) + "\n"

    out_str += str("Imc").ljust(tab_size*4) + ':' + str(mo.handle.imc) + "\n"

    out_str += "\n"
    return out_str
Ejemplo n.º 6
0
    def load_from_xml(self, element, handle):
        """ Method creates the object from the XML representation of the an external method object. """
        from Imc import class_factory
        self.set_handle(handle)
        if element.attrib:
            for attr_name, attr_value in element.attrib.iteritems():
                attr = ImcUtils.word_u(attr_name)
                if attr in CoreUtils.get_property_list(self._class_id):
                    at_meta = CoreUtils.get_method_property_meta(
                        self._class_id, attr)
                    if at_meta.io == "Input" or at_meta.is_complex_type:
                        continue
                    self.set_attr(attr, str(attr_value))
                elif attr_name in _EXTERNAL_METHOD_ATTRS:
                    self.set_attr(_EXTERNAL_METHOD_ATTRS[attr_name],
                                  str(attr_value))

        child_elements = element.getchildren()
        if child_elements:
            for child_element in child_elements:
                if not ET.iselement(child_element):
                    continue

                cln = ImcUtils.word_u(child_element.tag)
                if cln in CoreUtils.get_property_list(self._class_id):
                    prop_meta = CoreUtils.get_method_property_meta(
                        self._class_id, cln)
                    if prop_meta.io == "Output" and prop_meta.is_complex_type:
                        child = class_factory(prop_meta.field_type)
                        if child != None:
                            self.set_attr(cln, child)
                            child.load_from_xml(child_element, handle)
Ejemplo n.º 7
0
    def load_from_xml(self, element, handle):
        """ Method creates the object from the xml representation of the managed object. """
        self.set_handle(handle)
        if element.attrib:
            for attr_name, attr_value in element.attrib.iteritems():
                attr = ImcUtils.word_u(attr_name)
                if CoreUtils.find_class_id_in_mo_meta_ignore_case(
                        self._class_id) != None:
                    if attr in CoreUtils.get_property_list(self._class_id):
                        self.set_attr(attr, str(attr_value))
                    else:
                        self.set_attr(attr, str(attr_value))
                else:
                    self.set_attr(ImcUtils.word_u(attr), str(attr_value))

            if self.get_attr("Rn") == None and self.get_attr("Dn") != None:
                self.set_attr("Rn",
                              str(re.sub(r'^.*/', '', self.get_attr("Dn"))))

        child_elements = element.getchildren()
        if child_elements:
            for child_element in child_elements:
                if not ET.iselement(child_element):
                    continue

                if child_element.tag in self.prop_mo_meta.field_names:
                    pass
                #TODO: Need code analysis.
                child = ManagedObject(ImcUtils.word_u(child_element.tag))
                self._child.append(child)
                child.load_from_xml(child_element, handle)
Ejemplo n.º 8
0
    def get_attr(self, key):
        """ This method gets attribute value of a Managed Object. """
        if key == "_class_id" and self.__dict__.has_key(key):
            return self.__dict__[key]

        if CoreUtils.find_class_id_in_mo_meta_ignore_case(self.class_id):
            if self.__dict__.has_key(key):
                if key in _MANAGED_OBJECT_META[self.class_id]:
                    # property exists
                    return self.__dict__[key]
            else:
                if self.__dict__.has_key('_ManagedObject__xtra_property'):
                    if self.__xtra_property.has_key(key):
                        return self.__xtra_property[ImcUtils.word_u(key)]
                    else:
                        raise AttributeError(key)
                else:
                    print "No xtra_property in mo:", self.class_id, " key:", key
        else:
            # property does not exist
            if self.__dict__['_ManagedObject__xtra_property'].has_key(key):
                return self.__xtra_property[ImcUtils.word_u(key)]
            elif key == "Dn" or key == "Rn":
                return None
            else:
                raise AttributeError(key)
Ejemplo n.º 9
0
    def to_managed_object(self):
        """
        Method creates and returns an object of ManagedObject class using the class_id and information from the
        Generic managed object.
        """
        from Imc import class_factory

        cln = ImcUtils.word_u(self._class_id)
        mo = class_factory(cln)
        if mo and isinstance(mo, ManagedObject) == True:
            meta_class_id = CoreUtils.find_class_id_in_mo_meta_ignore_case(self._class_id)
            mo.set_handle(self._handle)
            for prop in self.properties:
                if ImcUtils.word_u(prop) in CoreUtils.get_property_list(meta_class_id):
                    mo.set_attr(ImcUtils.word_u(prop), self.properties[prop])
                else:
                    ImcUtils.write_imc_warning("Property %s Not Exist in MO %s" %(ImcUtils.word_u(prop), meta_class_id))

            if len(self._child):
                for child in self._child:
                    moch = child.to_managed_object()
                    mo.child.append(moch)
            return mo
        else:
            return None
Ejemplo n.º 10
0
def update_imc_firmware(handle, in_mo, admin_state, protocol, share_type, remote_server, remote_path, username, password, secure_boot=None, dump_xml=None):
    """
    Uploads the Firmware image to IMC Server.

    - in_mo            specifies the respective Managed Object to upload image.
    - remoteserver        specifies the IP address of host containing firmware image.
    - username        specifies the Username login credential of host containing firmware image.
    - password        specifies the Password login credential of host containing firmware image.
    - remotepath        specifies the path of firmware image on remoteserver.
    - protocol            specifies the protocol used for transferring the file to remotehost.
    - sharetype            specifies the share type.
    - admin_state        specifies the admin state.
    """
    from ImcMos import FirmwareUpdatable
    dn = None

    if in_mo != None:
        if str(ImcUtils.word_u(in_mo.class_id)) == "FirmwareUpdatable":
            dn = in_mo.get_attr("Dn")
        elif str(ImcUtils.word_u(in_mo.class_id)) == "BiosUnit":
            dn = CoreUtils.make_dn([in_mo.get_attr("Dn"), CoreUtils.make_rn("FirmwareUpdatable")])
        elif str(ImcUtils.word_u(in_mo.class_id)) == "MgmtController":
            dn = CoreUtils.make_dn([in_mo.get_attr("Dn"), CoreUtils.make_rn("FirmwareUpdatable")])
        else:
            raise ImcValidationException("Please provide correct Managed Object. Valid MOs <FirmwareUpdatable or BiosUnit or MgmtController")
    else:
        raise ImcValidationException("Please provide correct Managed Object. Valid MOs <FirmwareUpdatable or BiosUnit or MgmtController")

#        if updatetype == FirmwareUpdatable.CONST_TYPE_BLADE_CONTROLLER:
#            dn = "sys/rack-unit-1/mgmt/fw-updatable"
#        if updatetype == FirmwareUpdatable.CONST_TYPE_BLADE_BIOS:
#            dn = "sys/rack-unit-1/bios/fw-updatable"
#        if updatetype == FirmwareUpdatable.CONST_TYPE_ADAPTOR:
#            dn = "sys/rack-unit-1/adaptor-1/mgmt/fw-updatable"

    firmware_updater = ManagedObject(NamingId.FIRMWARE_UPDATABLE)
    firmware_updater.dn = dn
    firmware_updater.Status = Status.MODIFIED
    #firmware_updater.AdminState = FirmwareUpdatable.CONST_ADMIN_STATE_TRIGGER
    firmware_updater.AdminState = admin_state
    firmware_updater.Protocol = protocol
    firmware_updater.RemoteServer = remote_server
    firmware_updater.RemotePath = remote_path
    firmware_updater.User = username
    firmware_updater.Pwd = password
    firmware_updater.Type = share_type
    firmware_updater.SecureBoot = secure_boot

    in_config = ConfigConfig()
    in_config.add_child(firmware_updater)

    ccm = handle.config_conf_mo(dn=dn, in_config=in_config, in_hierarchical=YesOrNo.FALSE, dump_xml=dump_xml)

    if ccm.error_code != 0:
        raise ImcException(ccm.error_code, ccm.error_descr)

    return ccm.OutConfig.child
Ejemplo n.º 11
0
def _translate_imc_managedobject(m_obj, xlate_map):
    """ Method used to translate a managedobject. This method is used in compare_imc_managedobject. """

    x_mo = m_obj.clone()
    x_mo.set_handle(m_obj.get_handle())

    if xlate_map != None:
        original_dn = x_mo.dn
        if original_dn in xlate_map:
            x_mometa = CoreUtils.get_mo_property_meta(ImcUtils.word_u(x_mo.class_id), "Meta")
            if x_mometa == None:
                ImcUtils.write_imc_warning('[Warning]: Could not translate [%s]' %(original_dn))
                return x_mo

            #Check for naming property
            match_obj = re.findall(r'(\[[^\]]+\])', x_mometa.rn)
            if match_obj:
                _update_mo_dn_along_with_naming_properties(x_mo, x_mometa, xlate_map[original_dn])
            else:
                #print "Translating", x_mo.dn, " => ", xlate_map[original_dn]
                x_mo.dn = xlate_map[original_dn]
        else:
            original_dn = re.sub(r'[/]*[^/]+$', '', original_dn)
            while original_dn != None or original_dn == "":
                if not original_dn in xlate_map:
                    original_dn = re.sub(r'[/]*[^/]+$', '', original_dn)
                    continue

                new_dn = re.sub("^%s/"%(original_dn), "%s/"%(xlate_map[original_dn]), x_mo.dn)
                #print "Translating", x_mo.dn, " => ", new_dn
                x_mo.dn = new_dn
                break

    return x_mo
Ejemplo n.º 12
0
def _write_mo(mo):
    """ Method to return string representation of a managed object. """
    class_not_found = False
    if CoreUtils.find_class_id_in_mo_meta_ignore_case(mo.class_id) == None:
        class_not_found = True
    tab_size = 8
    out_str = "\n"
    if class_not_found:
        out_str += "Managed Object\t\t\t:\t" + str(ImcUtils.word_u(
            mo.class_id)) + "\n"
    else:
        out_str += "Managed Object\t\t\t:\t" + str(mo.prop_mo_meta.name) + "\n"
    out_str += "-" * len("Managed Object") + "\n"
    if not class_not_found:
        for prop in CoreUtils.get_property_list(mo.prop_mo_meta.name):
            #prop_meta = CoreUtils.get_mo_property_meta(mo.prop_mo_meta.name, prop)
            #if (prop_meta.access == MoPropertyMeta.Internal):
            #continue
            val = mo.get_attr(prop)
            #if val != None and val != "":
            out_str += str(prop).ljust(tab_size * 4) + ':' + str(val) + "\n"
    else:
        for prop in mo.__dict__:
            if prop in [
                    '_class_id', '_ManagedObject__xtra_property', '_handle',
                    'prop_mo_meta', '_dirty_mask', '_child'
            ]:
                continue
            val = mo.__dict__[prop]
            out_str += str(ImcUtils.word_u(prop)).ljust(
                tab_size * 4) + ':' + str(val) + "\n"
    if mo.__dict__.has_key('_ManagedObject__xtra_property'):
        for xtra_prop in mo.__dict__['_ManagedObject__xtra_property']:
            out_str += ('[X]' + str(ImcUtils.word_u(xtra_prop))).ljust(
                tab_size * 4) + ':' + str(
                    mo.__dict__['_ManagedObject__xtra_property']
                    [xtra_prop]) + "\n"

    out_str += str("Imc").ljust(tab_size * 4) + ':' + str(mo.handle.imc) + "\n"

    out_str += "\n"
    return out_str
Ejemplo n.º 13
0
    def set_attr(self, key, value):
        """ This method sets attribute of a Managed Object. """
        if CoreUtils.find_class_id_in_mo_meta_ignore_case(self._class_id) != None:
            if key in _MANAGED_OBJECT_META[self._class_id]:
                prop_meta = CoreUtils.get_mo_property_meta(self._class_id, key)

                if prop_meta.validate_property_value(value) == False:
                    #print "Validation Failure"
                    return False

                if prop_meta.mask != None:
                    self._dirty_mask |= prop_meta.mask

                self.__dict__[key] = value
            else:
                self.__xtra_property[key] = value
        else:
            # no such property
            self.__xtra_property[ImcUtils.word_u(key)] = value
Ejemplo n.º 14
0
    def set_attr(self, key, value):
        """ This method sets attribute of a Managed Object. """
        if CoreUtils.find_class_id_in_mo_meta_ignore_case(
                self._class_id) != None:
            if key in _MANAGED_OBJECT_META[self._class_id]:
                prop_meta = CoreUtils.get_mo_property_meta(self._class_id, key)

                if prop_meta.validate_property_value(value) == False:
                    #print "Validation Failure"
                    return False

                if prop_meta.mask != None:
                    self._dirty_mask |= prop_meta.mask

                self.__dict__[key] = value
            else:
                self.__xtra_property[key] = value
        else:
            # no such property
            self.__xtra_property[ImcUtils.word_u(key)] = value
Ejemplo n.º 15
0
def _translate_imc_managedobject(m_obj, xlate_map):
    """ Method used to translate a managedobject. This method is used in compare_imc_managedobject. """

    x_mo = m_obj.clone()
    x_mo.set_handle(m_obj.get_handle())

    if xlate_map != None:
        original_dn = x_mo.dn
        if original_dn in xlate_map:
            x_mometa = CoreUtils.get_mo_property_meta(
                ImcUtils.word_u(x_mo.class_id), "Meta")
            if x_mometa == None:
                ImcUtils.write_imc_warning(
                    '[Warning]: Could not translate [%s]' % (original_dn))
                return x_mo

            #Check for naming property
            match_obj = re.findall(r'(\[[^\]]+\])', x_mometa.rn)
            if match_obj:
                _update_mo_dn_along_with_naming_properties(
                    x_mo, x_mometa, xlate_map[original_dn])
            else:
                #print "Translating", x_mo.dn, " => ", xlate_map[original_dn]
                x_mo.dn = xlate_map[original_dn]
        else:
            original_dn = re.sub(r'[/]*[^/]+$', '', original_dn)
            while original_dn != None or original_dn == "":
                if not original_dn in xlate_map:
                    original_dn = re.sub(r'[/]*[^/]+$', '', original_dn)
                    continue

                new_dn = re.sub("^%s/" % (original_dn),
                                "%s/" % (xlate_map[original_dn]), x_mo.dn)
                #print "Translating", x_mo.dn, " => ", new_dn
                x_mo.dn = new_dn
                break

    return x_mo
Ejemplo n.º 16
0
    def get_imc_managedobject(self,
                              in_mo=None,
                              class_id=None,
                              params=None,
                              in_hierarchical=False,
                              dump_xml=None):
        """
        Gets Managed Object from IMC.

        - in_mo, if provided, it acts as a parent for the present operation.
          It should be None unless a username wants to define a parent scope.
          It can be a single MO or a list containing multiple managed objects.
        - class_id of the managed object/s to get.
        - params contains semicolon (;) separated list of key/value pairs(key=value),
          that are used as filters for selecting specific managed objects.
          The key should be a valid property of the managed object to be retrieved.
        - in_hierarchical, Explores hierarchy if true, else returns managed objects at a single level.
        """

        if params != None:
            keys = params.keys()
        else:
            keys = []

        out_config = []
        meta_class_id = ""
        if class_id != None and class_id != "":
            #ClassId param set
            meta_class_id = CoreUtils.find_class_id_in_mo_meta_ignore_case(
                class_id)
            if meta_class_id == None:
                meta_class_id = class_id
                mo_meta = MoMeta(ImcUtils.word_u(class_id),
                                 ImcUtils.word_l(class_id), "", "",
                                 "InputOutput", ManagedObject.DUMMYDIRTY, [],
                                 [], [], [], [])
            else:
                mo_meta = CoreUtils.get_mo_property_meta(meta_class_id, "Meta")

            if mo_meta == None:
                raise ImcValidationException(
                    '[Error]: get_imc_managedobject: mo_meta for class_id [%s] is not valid'
                    % (class_id))
                #return None

            if in_mo != None and isinstance(in_mo, list) and len(in_mo) > 0:
                for mo in in_mo:
                    crc = self.config_resolve_children(mo_meta.xml_attribute,
                                                       mo.get_attr("Dn"),
                                                       in_hierarchical,
                                                       dump_xml)
                    if crc.error_code != 0:
                        raise ImcException(crc.error_code, crc.error_descr)

                    for child in crc.OutConfigs.child:
                        out_config.append(child)
            else:
                crc = self.config_resolve_class(mo_meta.xml_attribute,
                                                in_hierarchical, dump_xml)
                if crc.error_code != 0:
                    raise ImcException(crc.error_code, crc.error_descr)
                for child in crc.OutConfigs.child:
                    out_config.append(child)
        else:
            dn = ""
            for key in keys:
                if key.lower() == "dn":
                    dn = params[key]
            if not dn:
                raise ImcValidationException(
                    '[Error]: Please provide ClassId or dn')
            cr_dn = self.config_resolve_dn(dn, in_hierarchical, dump_xml)
            if cr_dn.error_code != 0:
                raise ImcException(cr_dn.error_code, cr_dn.error_descr)
            for child in cr_dn.OutConfig.child:
                out_config.append(child)

        #client side filtering starts
        for key in keys:
            prop_mo_meta = CoreUtils.is_property_in_meta_ignore_case(
                meta_class_id, key)
            if prop_mo_meta != None:
                attr_name = prop_mo_meta.xml_attribute
            else:
                attr_name = key
            for mo in out_config[:]:
                attr_name = attr_name[0].upper() + attr_name[1:]
                if mo.get_attr(attr_name) != params[key]:
                    out_config.remove(mo)
        #client side filtering ends

        molist = []
        current_molist = out_config
        while len(current_molist) > 0:
            child_molist = []
            for mo in current_molist:
                molist.append(mo)
                while mo.get_child_count() > 0:
                    for child in mo.child:
                        mo.remove_child(child)
                        if child.__dict__.has_key('Dn'):
                            if child.Dn == None or child.Dn == "":
                                child.set_attr("Dn", mo.Dn + '/' + child.Rn)
                                child.mark_clean()
                        else:
                            child.set_attr("Dn", mo.Dn + '/' + child.Rn)
                            child.mark_clean()
                        child_molist.append(child)
                        break
            current_molist = child_molist

        return molist
Ejemplo n.º 17
0
    def get_imc_managedobject(self, in_mo=None, class_id=None, params=None, in_hierarchical=False, dump_xml=None):
        """
        Gets Managed Object from IMC.

        - in_mo, if provided, it acts as a parent for the present operation.
          It should be None unless a username wants to define a parent scope.
          It can be a single MO or a list containing multiple managed objects.
        - class_id of the managed object/s to get.
        - params contains semicolon (;) separated list of key/value pairs(key=value),
          that are used as filters for selecting specific managed objects.
          The key should be a valid property of the managed object to be retrieved.
        - in_hierarchical, Explores hierarchy if true, else returns managed objects at a single level.
        """

        if params != None:
            keys = params.keys()
        else:
            keys = []

        out_config = []
        meta_class_id = ""
        if class_id != None and class_id != "":
            #ClassId param set
            meta_class_id = CoreUtils.find_class_id_in_mo_meta_ignore_case(class_id)
            if meta_class_id == None:
                meta_class_id = class_id
                mo_meta = MoMeta(ImcUtils.word_u(class_id), ImcUtils.word_l(class_id), "", "", "InputOutput", ManagedObject.DUMMYDIRTY, [], [], [], [], [])
            else:
                mo_meta = CoreUtils.get_mo_property_meta(meta_class_id, "Meta")

            if mo_meta == None:
                raise ImcValidationException('[Error]: get_imc_managedobject: mo_meta for class_id [%s] is not valid' %(class_id))
                #return None

            if in_mo != None and isinstance(in_mo, list) and len(in_mo) > 0:
                for mo in in_mo:
                    crc = self.config_resolve_children(mo_meta.xml_attribute, mo.get_attr("Dn"), in_hierarchical, dump_xml)
                    if crc.error_code != 0:
                        raise ImcException(crc.error_code, crc.error_descr)

                    for child in crc.OutConfigs.child:
                        out_config.append(child)
            else:
                crc = self.config_resolve_class(mo_meta.xml_attribute, in_hierarchical, dump_xml)
                if crc.error_code != 0:
                    raise ImcException(crc.error_code, crc.error_descr)
                for child in crc.OutConfigs.child:
                    out_config.append(child)
        else:
            dn = ""
            for key in keys:
                if key.lower() == "dn":
                    dn = params[key]
            if not dn:
                raise ImcValidationException('[Error]: Please provide ClassId or dn')
            cr_dn = self.config_resolve_dn(dn, in_hierarchical, dump_xml)
            if cr_dn.error_code != 0:
                raise ImcException(cr_dn.error_code, cr_dn.error_descr)
            for child in cr_dn.OutConfig.child:
                out_config.append(child)

        #client side filtering starts
        for key in keys:
            prop_mo_meta = CoreUtils.is_property_in_meta_ignore_case(meta_class_id, key)
            if prop_mo_meta != None:
                attr_name = prop_mo_meta.xml_attribute
            else:
                attr_name = key
            for mo in out_config[:]:
                attr_name = attr_name[0].upper() + attr_name[1:]
                if mo.get_attr(attr_name) != params[key]:
                    out_config.remove(mo)
        #client side filtering ends

        molist = []
        current_molist = out_config
        while len(current_molist) > 0:
            child_molist = []
            for mo in current_molist:
                molist.append(mo)
                while mo.get_child_count() > 0:
                    for child in mo.child:
                        mo.remove_child(child)
                        if child.__dict__.has_key('Dn'):
                            if child.Dn == None or child.Dn == "":
                                child.set_attr("Dn", mo.Dn + '/' + child.Rn)
                                child.mark_clean()
                        else:
                            child.set_attr("Dn", mo.Dn + '/' + child.Rn)
                            child.mark_clean()
                        child_molist.append(child)
                        break
            current_molist = child_molist

        return molist