Namespaces¶
Namespaces in CIM and LMIShell provide a natural way, how to organize all the available classes and their instances. In the shell, they provide a hierarchic access point to other namespaces and corresponding classes.
The root namespace plays a special role in the managed system; it is the first entry point from the connection object and provides the access to other clamped namespaces.
Available namespaces¶
To get a LMINamespace object for the root namespace of the managed system, run following:
> root_namespace = c.root
>
To list all available namespace from the root one, run following code:
> c.root.print_namespaces()
...
> ns_lst = c.root.namespaces
>
If you want to access any namespace deeper (e.g. cimv2), run this:
> cimv2_namespace = c.root.cimv2
> cimv2_namespace = c.get_namespace("root/cimv2")
>
Available classes¶
Each namespace object can print its available classes. To print/get the list of the classes, run this:
> c.root.cimv2.print_classes()
...
> classes_lst = c.root.cimv2.classes()
>
Queries¶
Using a LMINamespace object, it is possible to retrieve a list of LMIInstance objects. The LMIShell supports 2 query languages:
- WQL
- CQL
Following code illustrates, how to execute WQL and CQL queries:
> instances_lst = namespace.wql("query")
> instances_lst = namespace.cql("query")
>