Example #1
0
    def build_class_repo(self, default_namespace):
        """
        Build the schema qualifier and class objects in the repository.
        This requires only that the leaf objects be defined in a mof
        include file since the compiler finds the files for qualifiers
        and dependent classes.
        """
        FakedWBEMConnection._reset_logging_config()
        conn = FakedWBEMConnection(default_namespace=default_namespace)
        classnames = [
            'CIM_Namespace', 'CIM_ObjectManager', 'CIM_RegisteredProfile',
            'CIM_ElementConformsToProfile'
        ]

        conn.compile_dmtf_schema(DMTF_TEST_SCHEMA_VER,
                                 TESTSUITE_SCHEMA_DIR,
                                 class_names=classnames,
                                 verbose=False)

        return conn
Example #2
0
    def build_class_repo(self, default_namespace):
        """
        Build the schema qualifier and class objects in the repository
        from a DMTF schema.
        This requires only that the leaf objects be defined in a mof
        include file since the compiler finds the files for qualifiers
        and dependent classes.

        Returns:
            Instance of FakedWBEMConnection object.
        """
        # pylint: disable=protected-access

        FakedWBEMConnection._reset_logging_config()
        conn = FakedWBEMConnection(default_namespace=default_namespace)

        conn.compile_dmtf_schema(
            self.dmtf_schema_ver,
            self.schema_dir,
            class_names=self.server_mock_data['class_names'],
            verbose=False)

        for fn in self.pg_schema_files:
            pg_file = os.path.join(self.pg_schema_dir, fn)
            conn.compile_mof_file(pg_file,
                                  namespace=default_namespace,
                                  search_paths=[self.pg_schema_dir],
                                  verbose=False)

        # compile the mof defined in the 'class-mof definitions
        for mof in self.server_mock_data['class-mof']:
            conn.compile_mof_string(mof,
                                    namespace=default_namespace,
                                    verbose=False)

        return conn