Esempio n. 1
0
        def attr_def_copy(attr_def):
            """ Deep copy attributes """
            attr_def_cpy = saImm.SaImmAttrDefinitionT_2()
            attr_def_cpy.attrName = attr_def.attrName[:]
            attr_def_cpy.attrValueType = attr_def.attrValueType
            attr_def_cpy.attrFlags = attr_def.attrFlags

            return attr_def_cpy
Esempio n. 2
0
def class_description_get(class_name):
    ''' get class description as a python list '''

    attr_defs = pointer(pointer(saImm.SaImmAttrDefinitionT_2()))
    category = saImm.SaImmClassCategoryT()
    err = saImmOmClassDescriptionGet_2(HANDLE, class_name, category, attr_defs)

    return saAis.unmarshalNullArray(attr_defs)
Esempio n. 3
0
    def get_class_description(self, class_name):
        """ Get class description as a Python list

        Args:
            class_name (str): Class name

        Returns:
            SaAisErrorT: Return code of the corresponding IMM API call(s)
            list: List of class attributes
        """

        # Perform a deep copy
        def attr_def_copy(attr_def):
            """ Deep copy attributes """
            attr_def_cpy = saImm.SaImmAttrDefinitionT_2()
            attr_def_cpy.attrName = SaImmAttrNameT(
                deepcopy(str(attr_def.attrName)))
            attr_def_cpy.attrValueType = attr_def.attrValueType
            attr_def_cpy.attrFlags = attr_def.attrFlags

            return attr_def_cpy

        class_attrs = []
        attr_defs = pointer(pointer(saImm.SaImmAttrDefinitionT_2()))
        category = saImm.SaImmClassCategoryT()
        c_class_name = class_name if isinstance(
            class_name, SaStringT) else SaImmClassNameT(class_name)
        rc = saImmOmClassDescriptionGet_2(self.handle, c_class_name, category,
                                          attr_defs)
        if rc != eSaAisErrorT.SA_AIS_OK:
            log_err("saImmOmClassDescriptionGet_2 FAILED - %s" %
                    eSaAisErrorT.whatis(rc))
        else:
            _class_attrs = unmarshalNullArray(attr_defs)

            # Make copy of attr_defs list
            class_attrs = [attr_def_copy(item) for item in _class_attrs]

            # Free the original memory
            saImmOmClassDescriptionMemoryFree_2(self.handle,
                                                attr_defs.contents)

        return rc, class_attrs