Pywbemtools - WBEM command line tools

This package contains the following Python based WBEM tools:

  • pywbemcli - a WBEM client CLI tool for interacting with WBEM servers to execute both basic CIM/XML requests on the servers and higher level requests such as showing namespaces, indication subscriptions, profiles, etc.

  • pywbemlistener - a WBEM CLI tool that runs and manages WBEM listeners to receive and display WBEM indications.

CIM/WBEM standards are used for a wide variety of systems management tasks in the industry including DMTF management standards and the SNIA Storage Management Initiative Specification (SMI-S).

Pywbemtools uses the pywbem WBEM client infrastructure package.

The pywbemtools github page is: https://github.com/pywbem/pywbemtools.

Introduction

Pywbemtools features

  • pywbemcli - A command line tool using the Pywbemcli command line interface with a Command mode and and Interactive mode that provides command groups and commands for the pywbemcli client including:

    • Explore the CIM data of WBEM servers. It can manage/inspect the CIM model components including CIM classes(class command group), CIM instances(instance command group), and CIM qualifiers and execute CIM methods and queries on the WBEM server. Thus, for example, the command class enumerate returns CIM classes from the WBEM server defined by the current connection definition.

    • Execute specific CIM-XML operations on the WBEM server as defined in DMTF standard DSP0200 (CIM Operations over HTTP).

    • Display the responses in a variety of formats (Output formats) including viewing in the MOF, XML, pywbem Python formats and as tables and trees of hierarchical objects such as CIM classes.

    • Capture detailed information on CIM-XML interactions with the WBEM server including time statistics and details of data flow.

    • Maintain a file (connections file) with persisted WBEM connection definitions so that pywbemcli can access multiple WBEM servers by name. See connection command group

    • Use an integrated Mock WBEM Server to try out commands or demonstrate server capabilities. The mock server can be loaded with CIM objects defined in MOF files or via Python scripts.

  • pywbemlistener - A command line utility that manages WBEM indication listeners running as background processes on the local system and displays/logs CIM indications received by these listeners.

CIM/WBEM standards are used for a wide variety of systems management tasks in the industry including DMTF management standards and the SNIA Storage Management Initiative Specification (SMI-S).

Supported environments

The pywbemtools package is supported in these environments:

  • Operating systems: Linux, Windows (native and Unix-like environments (ex. Cygwin), OS-X

  • Python versions: 2.7, 3.4, and greater

  • WBEM servers: Any WBEM server that conforms to the DMTF specifications listed in Standards conformance. WBEM servers supporting older versions of these standards are also supported, but may have limitations. See the pywbem WBEM servers documentation for more details.

Installation

This section describes the complete installation of pywbemtools with all steps including prerequisite operating system packages.

The easiest way to install the pywbemtools package is using pip. Pip ensures that any dependent Python packages also get installed.

Pip will install the packages into your currently active Python environment See section Using Python virtual environments for more information on virtual environments.

If you want to contribute to the pywbem project, you need to set up a development and test environment for pywbemtools. That has a larger set of OS-level prerequisites and its setup is described in the Pywbemtools development chapter.

Installation prerequisites

The Python environment into which you want to install must have the following Python packages installed:

Pywbemtools installs the pywbem package.

When using pywbem versions before 1.0.0 on Python 2, pywbem requires a number of OS-level packages, and your system must have the following commands installed:

  • On native Windows:

    • choco - Chocolatey package manager. The pywbemtools package installation uses Chocolatey to install OS-level software. See https://chocolatey.org/ for the installation instructions for Chocolatey.

    • wget - Download tool. Can be installed with: choco install wget.

  • On Linux, OS-X, UNIX-like environments on Windows (e.g. Cygwin):

    • wget - Download tool. Can be installed using the OS-level package manager for the platform.

Installation with pip

When using pywbem versions before 1.0.0 on Python 2, install the OS-level packages needed by the pywbem package as follows:

  • On native Windows:

    > wget -q https://raw.githubusercontent.com/pywbem/pywbem/master/pywbem_os_setup.bat
    > pywbem_os_setup.bat
    
  • On Linux, OS-X, UNIX-like environments on Windows (e.g. Cygwin):

    $ wget -q https://raw.githubusercontent.com/pywbem/pywbem/master/pywbem_os_setup.sh
    $ chmod 755 pywbem_os_setup.sh
    $ ./pywbem_os_setup.sh
    

    The pywbem_os_setup.sh script uses sudo internally, so your userid needs to have sudo permission.

If you want to install the needed OS-level packages manually, see pywbem prerequisite OS packages.

The following command downloads and installs the latest released version of the pywbemtools package from PyPI into the currently active Python environment:

$ pip install pywbemtools

As an alternative, if you want to install the latest development level of the pywbemtools package for some reason, install directly from the master branch of the Git repository of the package:

$ pip install git+https://github.com/pywbem/pywbemtools.git@master#egg=pywbemtools

NOTE: pywbemtools may also be installed for development and to include the pywbemtools test environment by cloning the pywbemtools git repository as documented in Pywbemtools development.

Verification of the installation

You can verify that the pywbemtools package and its dependent packages are installed correctly by invoking pywbemcli. Invoking with the --version option displays the installed version of both pywbem and pywbemtools as shown in the following example:

$ pywbemcli --version
pywbemcli, version 0.5.0
pywbem, version 0.14.4

Standards conformance

Pywbemtools attempts to comply to the maximum possible with the relevant standards.

Pywbemtools uses pywbem for communication with the WBEM server. Therefore pywbemtools conformance to the relevant standards is defined in the pywbem standards conformance documentation.

Therefore, the level of conformance and limitations for pywbemtools is the same as pywbem except for any specific notations in this document.

Deprecation policy

Pywbemtools attempts to be as backwards compatible as possible.

Occasionally functionality needs to be retired, because it is flawed and a better but incompatible replacement has emerged.

In pywbemtools, such changes are done by deprecating existing functionality, without removing it. The deprecated functionality is still supported throughout new minor releases. Eventually, a new major release will break compatibility and will remove the deprecated functionality.

In order to prepare users of pywbemtools for that, deprecation of functionality is stated in the CLI documentation, and is made visible at runtime by issuing Python warnings of type DeprecationWarning (see the Python warnings module).

Since Python 2.7, DeprecationWarning messages are suppressed by default. They can be shown for example by invoking pywbemcli with the environment variable: PYTHONWARNINGS=default, or by using the ref:–warn general option.

It is recommended that users of the pywbemtools package run their test code with DeprecationWarning messages being shown, so they become aware of any use of deprecated functionality.

Here is a summary of the deprecation and compatibility policy used by pywbemtools, by release type:

  • New update release (M.N.U -> M.N.U+1): No new deprecations; fully backwards compatible.

  • New minor release (M.N.U -> M.N+1.0): New deprecations may be added; as backwards compatible as possible.

  • New major release (M.N.U -> M+1.0.0): Deprecated functionality may get removed; backwards compatibility may be broken.

Compatibility is always seen from the perspective of the user of pywbemtools, so a backwards compatible new pywbemtools release means that the user can safely upgrade to that new release without encountering compatibility issues.

Versioning

This documentation applies to version 1.1.2.dev1 of the pywbemtools package. You can also see that version in the top left corner of this page.

The pywbemtools package uses the rules of Semantic Versioning 2.0.0 for its version.

This documentation may have been built from a development level of the package. You can recognize a development version of this package by the presence of a “.devD” suffix in the version string. Development versions are pre-versions of the next assumed version that is not yet released. For example, version 0.5.1.dev2 is development pre-version #2 of the next version to be released after 0.5.0. Version 1.5.1 is an assumed next version, because the actually released next version might be 0.7.0 or even 1.0.0.

Compatibility

In this package, compatibility is always seen from the perspective of the user of the package. Thus, a backwards compatible new version of this package means that the user can safely upgrade to that new version without encountering compatibility issues.

This package uses the rules of Semantic Versioning 2.0.0 for compatibility between package versions, and for deprecations.

The public command line interface of this package that is subject to the semantic versioning rules (and specifically to its compatibility rules) is the CLI syntax described in this documentation.

The output formats are currently not the subject of compatibility assurances.

Violations of these compatibility rules are described in section Change log.

Reporting issues

If you encounter any problem with this package, or if you have questions of any kind related to this package (even when they are not about a problem), please open an issue in the pywbemtools issue tracker.

License

This package is licensed under the Apache 2.0 License.

Pywbemcli command

Pywbemcli provides access to WBEM servers from the command line. It provides functionality to:

  • Explore the CIM data of WBEM servers. It can manage/inspect the CIM model components including CIM classes, CIM instances, and CIM qualifiers and execute CIM methods and queries on the WBEM server.

  • Execute specific CIM-XML operations on the WBEM server as defined in DMTF standard DSP0200 (CIM Operations over HTTP).

  • Inspect and manage WBEM server functionality including:

  • Capture detailed information on CIM-XML interactions with the WBEM server including time statistics and details of data flow.

  • Maintain a file with persisted WBEM connection definitions so that pywbemcli can access multiple WBEM servers by name.

  • Provide both a command line mode and an interactive mode where multiple pywbemcli commands can be executed within the context of a WBEM server.

  • Use an integrated mock WBEM server to try out commands. The mock server can be loaded with CIM objects defined in MOF files or via Python scripts.

Pywbemcli command line interface

This section describes the command line interface of the pywbemcli command within the pywbemtools package.

Pywbemcli provides a command line interface(CLI) interaction with WBEM servers.

The command line can contain the following components:

The pywbemcli command is invoked with a command and arguments/options:

$ pywbemcli [GENERAL-OPTIONS] COMMAND [COMMAND-OPTIONS] [ARGUMENTSS]
or
$ pywbemcli [GENERAL-OPTIONS] COMMAND [ARGUMENTS] [COMMAND-OPTIONS]

Where the components are:

  • COMMAND - A name of a command which may consist of:
    • <group name> <command name> for commands that are defined within groups (ex. class find).

    • <group name> (ex. class) to show group help including list of command within the group.

    • <command name> for those commands that are not part of a group. For example repl and help that are not in any command group.

  • ARGUMENTSS - Arguments may be defineda specific command. Arguments are not individually documented in the help and do not have preceeding dashes. In pywbemcli arguments are only used in commands. There are no general arguments. Specifically they are used to specify request object names (ex. class namme or instance name for specifice commands.

  • COMMAND-OPTIONS - Options that apply only to a particular COMMAND.

Options are prefixed with the characters - for the short form or -- for the long form (ex. -n or --namespace). The other command line components do not begin with -.

Command groups are named after the objects the commands operate on (ex. class, instance, qualifier, server, connection, namespace, etc.). Executing:

$ pywbemcli --help
...
Commands:
  class       Command group for CIM classes.
...

returns the list of command groups under the title Commands.

Commands are named after actions on these objects (ex. get, create, delete). The list of commands for each group is displayed with the command pywbemcli <group name> –help.

For example, the command:

$ pywbemcli --output-format mof class get CIM_ManagedElement --namespace interop

gets class CIM_ManagedElement in namespace interop and displays it in the MOF output format. The option --output-format is a general option and --namespace is a command option.

Pywbemcli supports several modes of tab-completion, auto-completion suggestions depending on whether it is in command or interactive mode. This is detailed in the following sections.

Modes of operation

Pywbemcli supports two modes of operation:

  • Command mode: Executing standalone non-interactive commands.

  • Interactive mode: Invoking an interactive pywbemcli shell for typing pywbemcli commands.

Command mode

In command mode, the pywbemcli command performs its task defined on the command line and terminates like any other standalone non-interactive command.

This mode is used when the pywbemcli command is invoked with a command or command group name and arguments/options:

$ pywbemcli [GENERAL-OPTIONS] COMMAND [COMMAND-OPTIONS] [ARGS]

The following example enumerates classes in the root/cimv2 namespace of the WBEM server on localhost:

$ pywbemcli --server http://localhost --default-namespace root/cimv2 --user username class enumerate
Enter password: <password>
. . .
<Returns MOF for the enumerated classes>

In command mode, tab completion is also supported for some command shells, but must be enabled specifically for each shell.

For example, with a bash shell, enter the following to enable tab completion of pywbemcli:

$ eval "$(_PYWBEMCLI_COMPLETE=source pywbemcli)"

Bash tab completion for pywbemcli is used like any other bash tab completion:

$ pywbemcli --<TAB><TAB>
... <shows the general options to select from>

$ pywbemcli <TAB><TAB>
... <shows the command groups to select from>

$ pywbemcli class <TAB><TAB>
... <shows the class commands to select from>

Pywbemcli uses the Python click package for its command line handling. See Bash Complete in the Click documentation for additional features of the Bash tab completion of pywbemcli. This includes information on how to enable the auto complete on the command line.

Interactive mode

In interactive mode (also known as REPL mode), pywbem provides an interactive shell environment that allows typing pywbemcli commands, internal commands (for operating the pywbemcli shell), and external commands (that are executed in the standard shell of the user).

This pywbemcli shell is started when the pywbemcli command is invoked without specifying any command group or command:

$ pywbemcli [GENERAL-OPTIONS]
pywbemcli> _

Alternatively, the pywbemcli shell can also be started by specifying the repl command:

$ pywbemcli [GENERAL-OPTIONS] repl
pywbemcli> _

The pywbemcli shell uses the prompt pywbemcli>. The cursor is shown in the examples above as an underscore (_).

The commands and options that can be typed in the pywbemcli shell are the rest of the command line that would follow the pywbemcli command in command mode, as well as internal commands (for operating the pywbemcli shell), and external commands (that are executed in the standard shell of the user):

pywbemcli> [GENERAL-OPTIONS] COMMAND [ARGS] [COMMAND-OPTIONS]

    where: COMMAND can be either a group name and
           a command (ex. class find or repl)

pywbemcli> :INTERNAL-COMMAND

pywbemcli> !EXTERNAL-COMMAND

The general options may be included on the interactive command line to override the general options entered in the initial command line for pywbemcli. Thus, a user can define a server on the command line and override elements of that definition with commands in the interactive mode.

NOTE: The effects of any general option entered in the interactive mode exists only for that command and the original definition from the command line is restored for the next command. Any changes to the connections file defined in the interactive mode and executed in the same command are retained (ex. setting the default connection).

Thus:

pywbemcli --server http://blah
pywbemcli> class get CIM_ManagedObject
# The timeout change below only applies to the command on that line
pywbemcli> --timeout 90 class get CIM_ManagedObject.
# The --verbose mode only applies to the command on the same line.
pywbemcli> --verbose class get CIM_ManagedObject

The following example starts a pywbemcli shell in interactive mode, executes several commands, and exits the shell:

$ pywbemcli -s http://localhost -d root/cimv2 -u username

pywbemcli> class enumerate --no
. . . <Enumeration of class names in the default namespace>

pywbemcli> class get CIM_System
. . . <Class CIM_System in the default namespace in MOF format>

pywbemcli> :q

The pywbemcli shell command class get CIM_System in the example above has the same effect as the standalone command:

$ pywbemcli -s http://localhost -d root/cimv2 -u username class get CIM_System
. . . <Class CIM_System in the default namespace in MOF format>

The internal commands :?, :h, or :help display general help information for external and internal commands:

> :help
REPL help:

  External Commands:
    prefix external commands with "!"

  Internal Commands:
    prefix internal commands with ":"
    :?, :h, :help     displays general help information
    :exit, :q, :quit  exits the REPL

In addition to using one of the internal exit commands shown in the help text above, you can also exit the pywbemcli shell by typing Ctrl-D (on Linux, OS-X and UNIX-like environments on Windows), or Ctrl-C (on native Windows).

Typing --help or -h in the pywbemcli shell displays general help information for the pywbemcli commands which includes general options and a list of the supported command groups and commands without command group.

$ pywbemcli
pywbemcli> --help
Usage: pywbemcli [GENERAL-OPTIONS] COMMAND [ARGS] [COMMAND-OPTIONS]
. . .

General Options:
  -n, --name NAME                 Use the WBEM server ...
  . . .

Commands:
  class       Command group for CIM classes.
  connection  Command group for WBEM connection definitions.
  . . .

The usage line in this help text shows the usage in command mode. In interactive mode, the pywbemcli word is omitted.

Typing COMMAND --help, or COMMAND -h in the pywbemcli shell displays help information for the specified pywbemcli command group, for example:

pywbemcli> class --help
Usage: pywbemcli [GENERAL-OPTIONS] class COMMAND [ARGS] [COMMAND-OPTIONS]
. . .

Command Options:
  -h, --help  Show this message and exit.

Commands:
  associators   List the classes associated with a class.
  . . .

The pywbemcli shell in the interactive mode supports popup help text while for commands, arguments, and options typing, where the valid choices are shown based upon what was typed so far, and where an item from the popup list can be picked with <TAB> or with the cursor keys. It can be used to select from the list of general options. In the following examples, an underscore _ is shown as the cursor:

pywbemcli> --_
--name               Use the WBEM server defined by the WBEM connection ...
--mock-server        Use a mock WBEM server that is automatically ...
--server             Use the WBEM server at the specified URL with ...
. . .

pywbemcli> cl_
              class

The pywbemcli shell supports history across multiple invocations of the shell using <UP_ARROW>, <DOWN-ARROW> to step through the history line by line.

A incremental search of the history can be initiated by entering <CTRL-r> followed by one or more characters that define the search. The search displays the last command containing the search string. This search string can be modified in place to change the search, returning the last command in the command history that contains the the string. <UP_ARROW>, <DOWN-ARROW> will find other commands in the history containing the same string.

pywbemcli> <CTRL-r>
(reverse-i-search)`':
                                                    ENTER Characters CIM
(reverse-i-search)`CIM': class get CIM_ManagedElement
                                                    <UP-ARROW> and <DOWN-ARROW> find
                                                    other commands containing of "CIM"

<DOWN_ARROW>
(i-search)`get': instance get CIM_ComputerSystem.?
                                                    Hit <ENTER> selects current found command
pywbemcli> instance get CIM_ComputerSystem.?

The pywbemcli history is stored in the user home directory on linux systems.

The pywbemcli interactive mode also supports automated parameter suggestions based on the pywbemcli history file which works with the auto completion described above. The input is compared to the history and when there is another entry starting with the given text, the completion will be shown as gray text behind the current input. Pressing the right arrow → or c-e will insert this suggestion.

General options can be entered in the interactive mode but they generally only apply to the current command defined in the same command input as the general option. Thus, to modify the output format for a particular command, enter the –output-format general option before the command. The following command sets the output format to table before executing the command and then restores it to the original value.:

pywbemcli> --output-format table instance enumerate CIM_Foo

A particular difference between general options in the interactive mode and the command line mode is the ability to set general options back to their default value in the interactive mode. In the command mode this is not required. However, in the interactive mode, it could be useful to reset a general option to its default value for a command. Thus, if the log was set on startup (–log all), it could be disabled for a command or the user name (–user) could be set back to None. However, normally the default value is only set by not including that general option with the command line input

To reset selected string type general options in the interactive, the string value of "" (an empty string) is provided as the value which causes pywbemcli to set the default value of that general option.

The following code defines a server with --user and --password in interactive mode. Then it attempts to modify the user and password to their default values of None and execute the class enumerate again. This command would be executed without using the user and password because they have been reset for that command.

pywbemcli -s https:blah --user fred --pasword blah
pywbemcli> class enumerate
pywbemcli> --user "" --pasword "" class enumerate

Error handling

Pywbemcli terminates with one of the following program exit codes:

  • 0 - Success: The pywbemcli command has succeeded.

  • 1 - Error: In such cases, pywbemcli aborts the requested operation and displays one or more human readable error messages on standard error.

    If this happens for a command entered in interactive mode, the pywbemcli shell is not terminated; only the command that failed is terminated.

    Examples for errors reported that way:

    • Local system issues, e.g. pywbemcli history file or term:connections file cannot be written to.

    • WBEM server access issues, e.g. pywbemcli cannot connect to or authenticate with the WBEM server. This includes CIM errors about failed authentication returned by the server.

    • WBEM server operation issues, e.g. pywbemcli attempts to retrieve an instance that does not exist, or the WBEM server encountered an internal error. This will mostly be caused by CIM errors returned by the server, but can also be caused by the pywbemcli code itself.

    • Programming errors in mock Python scripts (see: Mock WBEM server overview); the error message includes a Python traceback of the error.

  • 1 - Python traceback: In such cases, pywbemcli terminates during its processing, and displays the Python stack traceback on standard error.

    If this happens for a command entered in interactive mode, the pywbemcli shell also terminates with a program exit code of 1.

    These Python tracebacks should never happen and are always considered a reason to open a bug in the pywbemtools issue tracker.

    Note that an error message with a traceback from a mock Python script does not fall into this category and is an issue in that Python script and not in pywbemcli.

  • 2 - User error: In such cases, pywbemcli terminates without even attempting to perform the requested operation, and displays one or more human readable error messages on standard error.

    If this happens for a command entered in interactive mode, the pywbemcli shell is not terminated; only the command that failed is terminated.

    Examples for user errors are a missing required command argument, the use of an invalid option, or an invalid option argument.

  • 2 - Help: When help is requested (--help/-h option or help command), pywbemcli displays the requested help text on standard output and terminates.

    If this happens for a command entered in interactive mode, the pywbemcli shell is not terminated; only the command that displayed the help is terminated.

Using the pywbemcli command line general options

Overview of the general options

General options define:

General options must be entered on the command line before the command group or command.

For example the following enumerates qualifier declarations and outputs the result in the simple table format:

pywbemcli --output-format simple --server http://localhost qualifier enumerate

Qualifier Declarations
Name         Type     Value    Array    Scopes       Flavors
-----------  -------  -------  -------  -----------  ---------------
Description  string            False    ANY          EnableOverride
                                                     ToSubclass
                                                     Translatable
Key          boolean  False    False    PROPERTY     DisableOverride
                                        REFERENCE    ToSubclass

In interactive mode, general options from the command line are defined once and retain their value throughout the execution of the interactive mode.

General options defined in the command line may be overwritten by specifying them on interactive mode commands. The resulting new value is used only for that one command, and is not retained for subsequent interactive mode commands.

In the following example, the --output-format general option is used on an interactive mode command to overwrite the default output format, and the --server general option is used to overwrite the server that was specified in the command line invocation:

$ pywbemcli --server http://myserver

pywbemcli> --output-format table --server http://localhost qualifier enumerate
Qualifier Declarations
+-------------+---------+---------+---------+-----------+-----------------+
| Name        | Type    | Value   | Array   | Scopes    | Flavors         |
+=============+=========+=========+=========+===========+=================+
| Description | string  |         | False   | ANY       | EnableOverride  |
|             |         |         |         |           | ToSubclass      |
|             |         |         |         |           | Translatable    |
+-------------+---------+---------+---------+-----------+-----------------+
| Key         | boolean | False   | False   | PROPERTY  | DisableOverride |
|             |         |         |         | REFERENCE | ToSubclass      |
+-------------+---------+---------+---------+-----------+-----------------+

The following table is an overview of all of the pywbemcli general options with a cross-reference to a detailed definition of each option.

pywbemcli general options

Option Name

Function(1)

Description

Type

Default Value

–server

Server Definition

Define server URI

String

–name

Sever Definition

Get server definition by name

String

–mock-server

Server Definition

Define mock server

String

–user

Server Attribute

Server user name

String

–password

Server Attribute

Server user password

String

–use-pull

Server attribute

Use of pull Operations

Choice

either

–pull-max-cnt

Server attribute

Max pull response size

Integer

1000

–certfile

Server attribute

Server cert attribute

String

–keyfile

Server attribute

Private key file attribute

String

–timestats

Client attribute

Control stats

Boolean

–log

Client attribute

Define log output

String

–verify

Client attribute

Verify server cert

Boolean

True

–ca-certs

Client blah

Define server ca certs

String

–timeout

Client attribute

Timeout server request

Integer (sec)

30 sec

–default-namespace

Client attribute

Connection default namespace

String

root/cimv2

–output-format

Client attribute

Define Table format

Choice

MOF

–verbose

Client attribute

Display processing details

Boolean

False

–version

Client attribute

Show pywbemtools version

–warn

Client attribute

Control warnings display

Boolean

–connections-file

Client attribute

Define file path

String

Default file

–pdb

Client attribute

Run with debugger

Boolean

–helo

Client attribute

Show help

String

  1. Server definitions and server attributes are attached to a connection definition and are used when defined for the current connection definition in the interactive mode. Client attribute exist for the life of an interactive session in the interactive mode. Thus –verbose entered on the command line is used for all commands in the interactive mode. –user entered on the command line applies to the current server definition only.

Defining the WBEM server

The target WBEM server can be defined on the command line in several ways with the following arguments :

  1. General options that define the WBEM server to be used.

    The following 3 mutually exclusive general options define the WBEM server that wil be the target of pywbem cli server-request commands (ex. class get <class name).

    • The --server general option defines the URI of a real WBEM server. The attributes of the server used by pywbemcli are defined by the connection characteristics general options (ex. –user, etc.)

 pwybmcli -s http:myserver

* The :ref:`--name general option` defines the name of a :term:`connection definition`
  in a :term:`connections file`. This name must have been previously created
  by saving the name of a server definition with the :ref:`Command
  connection save` command.
 pwybmcli -n mytestserver connection show

 defines the use of the previously defined connection ``mytestserver`` and
 executes the pywbem command ``connection show``.

Connection definitions can be stored in a :term:`connections file`
and are managed with the :ref:`Connection command group`.

* The :ref:`--mock-server general option` defines a :ref:`Mock WBEM Server` that
  is created upon pywbemcli startup.  The MOF or python files that are defined
  with as values of the option define the characteristics of thes mock WBEM server
  (The CIM objects that will be build in the mock environment and that can be
  accesses as if they were a real WBEM server).

  The mock WBEM server allows testing or demonstrating pywbemcli without
  having access to a real WBEM server.
pwybmcli -m mytestmof.mof -m mytestscript.py class enumerate

defines the use of the pywbemcli mock WBEM server script ``myscript.py`` and
executes the pywbem command ``class enumerate`` to show the first level
of the class hiearchy class names in the default namespace.
  1. Define connection characteristics for a WBEM server by using the

    The following general options can be used for specifying additional information for the connection and become part of the connection definition (i.e. connection) for a WBEM server.

    NOTE: Not all of the above general options are used by the mock WBEM server. Thus, since the mock WBEM server has no security layer, the --keyfile, --certfile, and --ca-certs options will be rejected if a mock WBEM server is specified

    A connection definition can be named and persisted in a pywbemcli connections file identified by a connection name so that it can be used by pywbem with the --name general option.

Controlling operation behavior and monitoring operations

Several general options control the behavior and monitoring of the operations executed against the WBEM server.

The DMTF specifications allow alternative forms of some operations, pywbemcli implements this flexibility and controls the choice of either the pull operations or the traditional operations through the --use-pull general option. With this option the user can choose to use either type of operation if that operation is available on the WBEM server. See Pywbemcli and the DMTF pull operations for more information on pull operations.

Since the pull operations include the ability to select the maximum size of returned chunks of data, the --pull-max-cnt general option can be used to control response chunk sizes.

In many cases it is important to the user to be able to monitor details of the operations executed against the WBEM server, either the APIs executed in pywbem, or the HTTP requests and responses and the time statistics for these operations.

The --log general option provides the capability to log information about this flow including:

  • The API calls and responses/exceptions executed by pywbem.

  • the HTTP requests and responses that pass between pywbemcli and the WBEM server.

The --log general option configures the logging including what is logged and the destination for the log output.

Thus, for example, the following command enumerates qualifiers and writes the log entries for the CIM-XML HTTP requests and responses to the pywbemcli log file pywbemcli.log:

$ pywbemcli --output-format table --server http://localhost --log http=file qualifier enumerate
<displays table of qualifier declarations>

$ cat pywbemcli.log
2019-09-16 21:14:04,296-pywbem.http.1-21020-Connection:1-21020 WBEMConnection(url='http://localhost', ...)
2019-09-16 21:14:04,297-pywbem.http.1-21020-Request:1-21020 POST /cimom 11 http://localhost
    CIMOperation:'MethodCall' CIMMethod:'EnumerateQualifiers' CIMObject:u'root/cimv2'
    <?xml version="1.0" encoding="utf-8" ?>
    <CIM CIMVERSION="2.0" DTDVERSION="2.0"><MESSAGE ID="1001" PROTOCOLVERSION="1.0">
    ...
    </CIM>
. . .
Controlling output formats

Pywbemcli supports multiple output formats for command results by using the --output-format general option.

The output formats fall into several groups (table formats, CIM object formats, text formats, and a tree format); however, not all formats are supported or applicable for all commands. For more details, see Output formats.

Other miscellaneous general options

The --verbose general option displays extra information about the pywbemcli internal processing.

The --warn general option controls the display of warnings.

The --version general option displays pywbemcli version information and the --help general option provides top level help

General options descriptions

This section defines in detail the requirements, characteristics, and any special syntax of each general option.

--server general option

The argument value of the --server/-s general option is a string that is the URL of the WBEM server to which pywbemcli will connect, in the format:

[SCHEME://]HOST[:PORT]

Where:

  • SCHEME: The protocol to be used. Must be “https” or “http”. Default: “https”.

  • HOST: The WBEM server host. Must be a short hostname, fully qualified DNS hostname, literal IPv4 address, or literal IPv6 address. See RFC3986 and RFC6874 for details.

  • PORT: The WBEM server port to be used. Default: 5988 for HTTP, and 5989 for HTTPS.

This option is mutually exclusive with the --name general option and the --mock-server general option since each defines a connection to a WBEM server.

In the interactive mode the connection is not actually established until a command requiring access to the WBEM server is entered.

Examples for the argument value of this option include:

https://localhost:15345       # https, port 15345, hostname localhost
http://10.2.3.9               # http, port 5988, IPv4 address 10.2.3.9
https://10.2.3.9              # https, port 5989, IPv4 address 10.2.3.9
http://[2001:db8::1234-eth0]  # http, port 5988, IPv6 address 2001:db8::1234, interface eth0
--name general option

The argument value of the --name/-n general option is a string that is the name of a connection definition in the connections file. The parameters for this named connection definition will be loaded from the connections file to become the current WBEM connection in pywbemcli.

In the interactive mode the connection is not actually established until a command requiring access to the WBEM server is entered.

This option is mutually exclusive with the --server general option and the --mock-server general option since each defines a connection to a WBEM server.

The following example creates a connection definition named myserver in the connections file, and then uses that connection to execute class get:

$ pywbemcli --server http://localhost --user me --password mypw connection save myserver

$ pywbemcli --name myserver class get CIM_ManagedElement
<displays MOF for CIM_ManagedElement>

See connection command group for more information on managing connections.

--default-namespace general option

The argument value of the --default-namespace/-d general option is a string that defines the default CIM namespace to use for the target WBEM server.

If this option is not specified, the default namespace will be root/cimv2.

The default namespace will be used if the --namespace/-n command option is not used on a command.

Some commands execute against multiple or all namespaces, for example the the class find command.

--user general option

The argument value of the --user/-u general option is a string that is the user name for authenticating with the WBEM server.

--password general option

The argument value of the --password/-p general option is a string that is the password for authenticating with the WBEM server.

This option is normally required if the --user general option is defined. If passwords are saved into the connections file, they are not encrypted in the file.

If the WBEM operations performed by any pywbemcli command require a password, the password is prompted for if --user/-u is used (in both modes of operation) and --password/-p is not used.

$ pywbemcli --server http://localhost --user me class get
Enter password: <password>
. . . <The display output from get class>

If both --user/-u and --password/-p are used, the command is executed without a password prompt:

$ pywbemcli --server http://localhost --user me --password blah class get
. . . <The display output from get class>

If the operations performed by a particular pywbemcli command do not require a password or no user is supplied, no password is prompted. For example:

$ pywbemcli --help
. . . <help output>

For script integration, it is important to have a way to avoid the interactive password prompt. This can be done by storing the password string in an environment variable or specifying it on the command line. See Environment variables for general options.

The pywbemcli connection export command outputs the (bash/Windows) shell commands to set all needed environment variables.

The environment variable output is OS dependent. Thus for example in Unix type OSs:

$ pywbemcli --server http://localhost --user fred connection export
export PYWBEMCLI_SERVER=http://localhost
export PYWBEMCLI_NAMESPACE=root/cimv2
...

This ability can be used to set those environment variables and thus to persist the connection name in the shell environment, from where it will be used in any subsequent pywbemcli commands:

$ eval $(pywbemcli --server http://localhost --user fred connection export)

$ env | grep PYWBEMCLI
export PYWBEMCLI_SERVER=http://localhost
export PYWBEMCLI_NAMESPACE=root/cimv2

$ pywbemcli server namespaces
. . . <list of namespaces for the defined server>
--timeout general option

The argument value of the --timeout/-t general option is an integer that defines the client side read timeout in seconds. The pywbem client includes a timeout mechanism that closes a WBEM connection and terminates the current pywbemcli request if there is no response to a WBEM server request in the time defined by timeout with multiple retries. A read timeout occurs any time no bytes have been received on the underlying socket for timeout seconds.

See pywbemcli --help for the actual retry count value. Thus, the actual time to command failure is multiple times the value of this option. Therefore a request that does not receive any response data and with timeout value of 5 would timeout in, for example ( 5 sec * 3 (request and retries)) = 15 seconds.

Pywbemcli defaults to a predefined read timeout (normally 30 seconds) if this option is not defined.

The connection functionality has a separate timeout time set by pywbem and set at 10 seconds also with retries. The connection timeout is not modifiable by pywbemcli.

In general the timeout value should only be modified where there is a specific reason such as specific commands or servers that have very long delay before returning data.

--verify general option

The pair of --verify and --no-verify general options control whether or not the client verifies any certificates received from the WBEM server.

By default or if --verify is specified, any certificates returned by the server are verified. If --no-verify is specified, any certificates returned by the server are accepted without verification.

This general option uses the approach with two long option names to allow the user to specifically enable or disable certificate verification when this general option is used in interactive mode.

--certfile general option

The argument value of the --certfile general option is the file path of a PEM file containing a X.509 client certificate to be presented to the WBEM server during the TLS/SSL handshake, enabling 2-way (mutual) authentication. This option is used only with HTTPS.

If --certfile is not used, no client certificate is presented to the server, resulting in 1-way authentication during the TLS/SSL handshake.

For more information on authentication types, see: https://pywbem.readthedocs.io/en/stable/client/security.html#authentication-types

--keyfile general option

The argument value of the --keyfile general option is the file path of a PEM file containing the private key belonging to the public key that is part of the X.509 certificate. See --certfile general option for more information.

Not required if the private key is part of the file defined in the --certfile option. --keyfile is not allowed if --certfile is not provided. Default: No client key file. The client private key should then be part of the file defined by --certfile.

--ca-certs general option

The argument value of the --ca-certs general option specifies which X.509 certificates are used on the client side for validating the X.509 certificate received from the WBEM server during SSL/TLS handshake when HTTPS is used.

The client-side and server-side certificates may be CA certificates (i.e. certificates issued by a certificate authority) or self-signed certificates.

Its value must be one of:

  • The path name of a file in PEM format that contains one or more certificates. See the description of the ‘CAfile’ argument of the OpenSSL SSL_CTX_load_verify_locations() function for details.

  • The path name of a directory with files in PEM format, each of which contains exactly one certificate. The file names must follow a particular naming convention. See the description of the ‘CApath’ argument of the OpenSSL SSL_CTX_load_verify_locations() function for details.

  • The string ‘certifi’ (only for pywbem version 1.0 or later). This choice will cause the certificates provided by the certifi package to be used. That package provides the certificates from the Mozilla Included CA Certificate List. Note that this list only contains CA certificates, so this choice does not work if the WBEM server uses self-signed certificates.

The default behavior depends on the version of the installed pywbem package:

  • Starting with pywbem version 1.0, the default is the behavior described above for the string ‘certifi’.

  • Before pywbem version 1.0, the default is the path name of the first existing directory from a list of system directories where certificates are expected to be stored.

The version of the installed pywbem package can be displayed using the --version general option.

Specifying the --no-verify option (see --verify general option) bypasses client side verification of the WBEM server certificate.

--timestats general option

The --timestats / --no-timestats -T general option is a boolean option that enables the display of time statistics on the interactions with the WBEM server.

When the option is included on the command line, the display of statistics is enabled after each command in the interactive mode and before exit in the command mode.

Statistics are always gathered in pywbemcli for the current connection for every command executed. They can be displayed at any time in the interactive mode with the command statistics show.

For more information on statistics gathered by pywbemcli and WBEM servers see section statistics command group .

--use-pull general option

The argument value of the --use-pull/-u general option determines whether the Pull operations or traditional operations are used for the instance enumerate, instance references, instance associators and instance query commands. See Pywbemcli and the DMTF pull operations for more information on pull operations. The choices for the argument value are as follows:

  • yes - pull operations will be used and if the server does not support pull, the request will fail.

  • no - forces pywbemcli to try only the traditional non-pull operations.

  • either - (default) pywbem tries both; first pull operations and then traditional operations. This is the recommended setting since it will generate a valid response from any server.

--pull-max-cnt general option

The argument value of the --pull-max-cnt general option is an integer passed to the WBEM server with the open and pull operation requests. This integer tells the server the maximum number of objects to be returned for each pull request if pull operations are used. This must be a positive non-zero integer. The default is 1000. See Pywbemcli and the DMTF pull operations for more information on pull operations.

--mock-server general option

The argument value of the --mock-server/-m general option is the file path of a MOF or Python script file that loads a mock WBEM server in the pywbemcli process with mock data (i.e. CIM objects).

This allows users to write MOF and scripts that define a Server environment including CIM namespaces, CIM qualifier declarations, CIM classes, and CIM instances that responds to pywbemcli commands.

This option may be specified multiple times to define multiple MOF and Python files that make up the definition of a mock server. The files must have the suffix “.mof” for MOF files and “.py” for Python scripts.

When this option is used, the security options (i.e. user, password, etc.) are irrelevant. They are rejected by pywemcli.

Section Mock WBEM Server defines the characteristics of the MOF and Python files that define a mock server environment.

A mock server may be saved in the connections file and is cached if saved in the default connections file. This can significantly speed up the loading of the mock server definition when pywbemcli is started.

The following example creates a mock server with two files defining the mock data, shows what parameters are defined for the connection, and then saves that connection named mymockserver where classdefs.mof could contain CIM qualifier declarations and CIM class definitions and insts.py could contain CIM instance definitions:

$ pywbemcli --mock-server classdefs.mof --mock-server insts.py --default-namespace root/myhome

pywbemcli> connection show
name: not-saved (current)
  server:
  mock-server: classdefs.mof, insts.py
  . . .

pywbemcli> connection save mymockserver
pywbemcli> connection show
Connection status:
name               value  (state)
-----------------  ------------------------------------------
name               mock1 (current)
server
default-namespace  root/cimv2
user
password
timeout            30
use-pull
pull-max-cnt       1000
verify             True
certfile
keyfile
mock-server        tests/unit/pywbemcli/simple_mock_model.mof
ca-certs
pywbemcli>class enumerate --names-only
CIM_BaseEmb
CIM_BaseRef
CIM_Foo
CIM_FooAssoc
pywbemcli>

See chapter Mock WBEM Server for more information on defining the files for a mock server.

--output-format general option

The argument value of the --output-format/-o general option is a string that defines the output format in which the result of any pywbemcli commands is displayed. The default output format depends on the command.

For details, see Output formats.

--log general option

The argument value of the --log/-l general option defines the destination and parameters of logging of the requests and responses to the WBEM server.

For details, see Pywbemcli defined logging.

--verbose general option

The --verbose/-v general option is a boolean option that enables the display of extra information about the processing.

In particular it outputs text for a number of commands that normally return nothing upon successful execution(ex. instance delete, instance enumerate that returns no CIM objects) to indicate the successful command completion.

--connections-file general option

The --connections-file/-C general option allows the user to select a path name for the connections file.

By default, the path name of the connections file is the value of the PYWBEMCLI_CONNECTIONS_FILE environment variable or if not set, the file .pywbemcli_connections.yaml in the user’s home directory. The user’s home directory depends on the operating system used and is determined with os.path.expanduser("~"), which works on all operating systems including Windows. See expanduser() for details.

The actually used path name of the connections file is shown in the connection list command.

The connection definition definitions in the connections file are managed with the commands in the connection command group.

--warn general option

The --warn/--no-warn general option is a boolean option that controls the display of all Python warnings.

If --warn is used, all Python warnings are shown once. If --no-warn is used (default), the PYTHONWARNINGS environment variable determines which warnings are shown. If that variable is not set, no warnings are shown. See PYTHONWARNINGS for details.

--pdb general option

The --pdb general option is a boolean option that enables debugging with the built-in pdb debugger.

If debugging is enabled, execution of each pywbemcli command will pause just before the command within pywbemcli is executed, and the pdb debugger prompt will appear. See pdb debugger commands for details on how to operate the built-in pdb debugger.

In addition to the --pdb option,

An alternate debugger such as pdb++ debugger can also be used.

--version general option

The --version general option displays the version of the pywbemcli command and the version of the pywbem package used by it, and then exits.

--help general option

The --help/-h general option displays help text which describes the command groups, commands, and general options, and then exits. A specific help exists for each command group, and command and pywbemcli --help presents the help on the general options

Environment variables for general options

:: index:: pair: general options; environment variables

Pywbemcli defines environment variables corresponding to its general options as follows:

Environment variable

Corresponding general option

PYWBEMCLI_SERVER

--server

PYWBEMCLI_NAME

--name

PYWBEMCLI_USER

--user

PYWBEMCLI_PASSWORD

--password

PYWBEMCLI_OUTPUT_FORMAT

--output-format

PYWBEMCLI_DEFAULT_NAMESPACE

--default-namespace

PYWBEMCLI_TIMEOUT

--timeout

PYWBEMCLI_KEYFILE

--keyfile

PYWBEMCLI_CERTFILE

--certfile

PYWBEMCLI_CA_CERTS

--ca-certs

PYWBEMCLI_USE_PULL

--use-pull

PYWBEMCLI_PULL_MAX_CNT

--pull-max-cnt

PYWBEMCLI_STATS_ENABLED

--timestats

PYWBEMCLI_MOCK_SERVER (1)

--mock-server

PYWBEMCLI_LOG

--log

PYWBEMCLI_PDB

--pdb

PYWBEMCLI_CONNECTIONS_FILE

--connections-file

PYWBEMCLI_SPINNER

No option attached

Notes:

  1. The --mock-server general option can be specified multiple times. To do that with the PYWBEMCLI_MOCK_SERVER environment variable, separate the multiple path names with space.

If these environment variables are set, the corresponding general options default to the value of the environment variables. If both an environment variable and its corresponding general option are set, the command line option overrides the environment variable with no warning.

Environment variables are not provided for command options or command arguments.

In the following example, the pywbemcli command uses server http://localhost defined by the environment variable:

$ export PYWBEMCLI_SERVER=http://localhost
$ pywbemcli class get CIM_ManagedElement
  <displays MOF for CIM_ManagedElement>

The pywbemcli connection export command outputs the (bash/Windows) shell commands to set all of the environment variables:

$ pywbemcli --server http://localhost --user fred connection export
export PYWBEMCLI_SERVER=http://localhost
export PYWBEMCLI_NAMESPACE=root/cimv2
. . .

This can be used to set those environment variables and thus to persist the connection name in the shell environment, from where it will be used in any subsequent pywbemcli commands until removed. The following shows the display of the pywbbemcli environment variables that are set :

$ eval $(pywbemcli --server http://localhost --user fred)

$ env | grep PYWBEMCLI
export PYWBEMCLI_SERVER=http://localhost
export PYWBEMCLI_NAMESPACE=root/cimv2
. . .

$ pywbemcli server namespaces
. . . <list of namespaces for the defined server>

In addition, an environment variable is provided to disable the spinner that is displayed when waiting for responses. The environment variable is PYWBEMCLI_SPINNER and the spinner is disabled when this environment variable is set.

Pywbemcli and the DMTF pull operations

The DMTF specifications and pywbem includes two ways to execute the enumerate instance type operations (Associators, References, EnumerateInstances, ExecQuery):

  • The traditional operations (ex. EnumerateInstances) where the WBEM server returns all of the response instances as a single response

  • The pull operations (ex. OpenEnumerateInstances, etc.) where the client and the server cooperate with client requests for Open… and subsequent Pull… requests to return groups of response instances.

Pywbem implements an overlay of the above two operations called the Iter.. operations where each Iter.. operation executes either the traditional or pull operation depending on the --use-pull general option of the connection.

While the pull operations may not be supported by all WBEM servers they can be significantly more efficient for large responses when they are available. Pywbem implements the client side of these operation and pywbemcli provides for the use of these operations through two general options:

  • --use-pull - This option allows the user to select from the the following alternatives:

    • either - (default) pywbemcli first tries the open operation and if that is not implemented by the server retries the operation with the corresponding traditional operation. The result of this first operation determines whether pull or the traditional operation are used for any further requests during the current pywbem interactive session.

    • yes - Forces the use of the pull operations and fails if that is not implemented by the server.

    • no - Forces the use of the traditional operation.

  • --pull-max-cnt - Sets the maximum count of objects the server is allowed to return for each open/pull operation. The default is 1000 objects which from experience is a logical choice.

The default alternative either is probably the most logical setting for --use-pull, unless you are specifically testing the use of pull operations.

However, there are some limitations with using the either choice as follows:

  • The original operations did not support the filtering of responses with a query language query (--filter-query-language and --filter-query ) which requests that the WBEM server filter the responses before they are returned. This can greatly reduce the size of the responses if effectively used but is used only when the pull operations are available on the server.

  • The pull operations do not support some of the options that traditional operations do:

  • --include-qualifiers - Since even the traditional operations specification deprecated this option and the user cannot depend on it being honored, the most logical solution is to never use this option.

  • --local-only - Since even the traditional operations specification deprecated this option and the user cannot depend on it being honored by the WBEM server, the most logical solution is to never use this option.

The following example forces the use of the pull operations and expects the WBEM server to return no more than 10 instances per request. It fails if the pull operations are not supported in the WBEM server:

$ pywbemcli --server http://localhost --use-pull=yes --pull-max-cnt=10 instance enumerate CIM_Foo

Output formats

Pywbemcli supports multiple output formats to present command results. The output format can be selected with the --output-format general option. The allowed output formats are different for the various command groups and commands.

The output formats fall into the following groups:

  • Table formats - The Table formats format the result as a table with rows and columns. Many of the result types allow table formatted response display including:

    • instance get, instance enumerate, instance references, instance associators where the table formats are alternatives to the CIM model formats that shows the properties for each instance as a column in a table.

    • instance count

    • server commands

    • class find

    • connection commands

  • CIM object formats - The CIM object formats format a result that consists of CIM objects in MOF, CIM-XML or pywbem repr format. All of the commands that return CIM objects support these output formats.

  • ASCII tree format - The ASCII tree format formats the result as a tree, using ASCII characters to represent the tree to show the hierarchial relationship between CIM classes. The only command supporting the ASCII tree format is class tree, and it supports only that one output format. The tree format is not supported by any other command today.

  • TEXT format - The Text formats is used for commands that output small quantites of text (ex. the interop namespace name) and that could be used as part of a command line redirection.

When an unsupported output format is specified for a command response, it is rejected with an exception. For example, the command class enumerate only supports the CIM object formats and will generate an exception if the command pywbemcli -o table class enumerate is entered.

Output formats for groups and commands

Each of the commands may allow only a subset of the possible ouput formats. Thus, the server brand only outputs data in a table format so there is no defined default format for the --output-format general option.

The following shows the default format for each command and the alternate formats where the values mean:

objects: xml, repr, or txt

table: table, plain, simple, grid, psql, rst, text, or html

Group

Command

Default

Alternates

Comments

class

associators

‘mof’

objects

See Note 1 below

class

delete

None

None

Nothing returned

class

enumerate

‘mof’

objects

See Note 1 below

class

find

‘simple’

table

class

get

‘mof’

objects

See Note 1 below

class

invokemethod

‘mof’

objects

See Note 1 below

class

references

‘mof’

objects

See Note 1 below

class

tree

None

None

Only outputs as ascii tree

instance

associators

‘mof’

objects, table

Output as cim object or table of properties

instance

count

‘simple’

table

instance

create

None

None

Nothing returned

instance

delete

None

None

Nothing returned

instance

enumerate

‘mof’

objects, table

instance

get

‘mof’

objects, table

instance

invokemethod

‘mof’

objects, table

instance

modify

None

None

Nothing returned

instance

references

‘mof’

table

qualifier

enumerate

‘mof’

table

qualifier

get

‘mof’

table

server

brand

‘text’

text

Alternate is table format

server

centralinsts

‘simple’

table

server

info

‘simple’

table

server

interop

‘text’

text

Alternate is table format

server

namespaces

‘simple’

table

Alternate is text format

server

profiles

‘simple’

table

connection

delete

None

table

connection

export

None

table

connection

list

‘simple’

table

connection

save

None

table

connection

select

None

None

connection

show

None

None

Currently ignores output format

connection

test

None

None

NOTES:

  1. The display of classes with the --names-only/--no or --summary/-s command options allows table output formats in addition to the objects output formats.

Table formats

The different variations of the table format define different formatting of the borders for tables. The following are examples of the table formats with a single command class find CIM_Foo:

  • --output-format table: Tables with a single-line border. This is the default:

    Find class CIM_Foo*
    +-------------+-----------------+
    | Namespace   | Classname       |
    |-------------+-----------------|
    | root/cimv2  | CIM_Foo         |
    | root/cimv2  | CIM_Foo_sub     |
    | root/cimv2  | CIM_Foo_sub2    |
    | root/cimv2  | CIM_Foo_sub_sub |
    +-------------+-----------------+
    
  • --output-format simple: Tables with a line between header row and data rows, but otherwise without borders:

    Find class CIM_Foo*
    Namespace    Classname
    -----------  ---------------
    root/cimv2   CIM_Foo
    root/cimv2   CIM_Foo_sub
    root/cimv2   CIM_Foo_sub2
    root/cimv2   CIM_Foo_sub_sub
    
  • --output-format plain: Tables do not use any pseudo-graphics to draw borders:

    Find class CIM_Foo*
    Namespace    Classname
    root/cimv2   CIM_Foo
    root/cimv2   CIM_Foo_sub
    root/cimv2   CIM_Foo_sub2
    root/cimv2   CIM_Foo_sub_sub
    
  • --output-format grid: Tables tables formatted by Emacs’ table.el package. It corresponds to grid_tables in Pandoc Markdown extensions:

    Find class CIM_Foo*
    +-------------+-----------------+
    | Namespace   | Classname       |
    +=============+=================+
    | root/cimv2  | CIM_Foo         |
    +-------------+-----------------+
    | root/cimv2  | CIM_Foo_sub     |
    +-------------+-----------------+
    | root/cimv2  | CIM_Foo_sub2    |
    +-------------+-----------------+
    | root/cimv2  | CIM_Foo_sub_sub |
    +-------------+-----------------+
    
  • --output-format rst: Tables in reStructuredText markup:

    Find class CIM_Foo*
    ===========  ===============
    Namespace    Classname
    ===========  ===============
    root/cimv2   CIM_Foo
    root/cimv2   CIM_Foo_sub
    root/cimv2   CIM_Foo_sub2
    root/cimv2   CIM_Foo_sub_sub
    ===========  ===============
    
  • --output-format psql: Like tables formatted by Postgres’ psql cli:

    Find class CIM_Foo*
    ===========  ===============
    Namespace    Classname
    ===========  ===============
    root/cimv2   CIM_Foo
    root/cimv2   CIM_Foo_sub
    root/cimv2   CIM_Foo_sub2
    root/cimv2   CIM_Foo_sub_sub
    ===========  ===============
    
  • --output-format html: Tables formatted as html table:

    <p>Find class CIM_Foo*</p>
    <table>
    <thead>
    <tr><th>Namespace  </th><th>Classname      </th></tr>
    </thead>
    <tbody>
    <tr><td>root/cimv2 </td><td>CIM_Foo        </td></tr>
    <tr><td>root/cimv2 </td><td>CIM_Foo_sub    </td></tr>
    <tr><td>root/cimv2 </td><td>CIM_Foo_sub2   </td></tr>
    <tr><td>root/cimv2 </td><td>CIM_Foo_sub_sub</td></tr>
    </tbody>
    </table>
    
CIM object formats

The output of CIM objects allows multiple formats as follows:

  • --output-format mof: Format for CIM classes, CIM instances, and CIM Parameters.

    MOF is the format used to define and document the CIM models released by the DMTF and SNIA. It textually defines the components and structure and data of CIM elements such as classes, instances, and qualifier declarations as shown in the following example of a CIM instance:

    instance of CIM_Foo {
       InstanceID = "CIM_Foo1";
       IntegerProp = 1;
    };
    

    The MOF output of CIM classes, CIM instances or CIM qualifier declaractions is normally compiler ready and can be recompiled by a MOF compiler such as the pywbem MOF compiler.

    The CIMInstanceName object (i.e. instance path) does not have a MOF format. Rather it is a formatted UNICODE string format as documented in DMTF specifications DSP0004 and :termL`DSP0207`.

    The following is an example of the output of an instance of CIMInstanceName:

    //ACME.com/cimv2/Test:CIM_RegisteredProfile.InstanceID=”Acme.1”

  • --output-format xml: CIM-XML format for CIM elements such as classes, instances and qualifier declarations. Besides being used as a protocol for WBEM servers, CIM-XML is also an alternative format for representing the CIM models released by the DMTF and SNIA. The XML syntax is defined in the DMTF specification DSP0201.

    This is the format used in the DMTF CIM-XML protocol:

    <VALUE.OBJECTWITHLOCALPATH>
        <LOCALINSTANCEPATH>
            <LOCALNAMESPACEPATH>
                <NAMESPACE NAME="root"/>
                <NAMESPACE NAME="cimv2"/>
            </LOCALNAMESPACEPATH>
            <INSTANCENAME CLASSNAME="CIM_Foo">
                <KEYBINDING NAME="InstanceID">
                    <KEYVALUE VALUETYPE="string">CIM_Foo1</KEYVALUE>
                </KEYBINDING>
            </INSTANCENAME>
        </LOCALINSTANCEPATH>
        <INSTANCE CLASSNAME="CIM_Foo">
            <PROPERTY NAME="InstanceID" PROPAGATED="false" TYPE="string">
                <VALUE>CIM_Foo1</VALUE>
            </PROPERTY>
            <PROPERTY NAME="IntegerProp" PROPAGATED="false" TYPE="uint32">
                <VALUE>1</VALUE>
            </PROPERTY>
        </INSTANCE>
    </VALUE.OBJECTWITHLOCALPATH>
    
  • --output-format repr: Python repr format of the objects.

    This is the structure and data of the pywbem Python objects representing each CIM objects and can be useful in understanding the pywbem interpretation of the CIM objects:

    CIMInstance(classname='CIM_Foo', path=CIMInstanceName(classname='CIM_Foo',
        keybindings=NocaseDict({'InstanceID': 'CIM_Foo1'}), namespace='root/cimv2',
        host=None),
        properties=NocaseDict({
          'InstanceID': CIMProperty(name='InstanceID',
            value='CIM_Foo1', type='string', reference_class=None, embedded_object=None,
            is_array=False, array_size=None, class_origin=None, propagated=False,
            qualifiers=NocaseDict({})),
          'IntegerProp': CIMProperty(name='IntegerProp', value=1, type='uint32',
              reference_class=None, embedded_object=None, is_array=False,
              array_size=None, class_origin=None, propagated=False,
              qualifiers=NocaseDict({}))}), property_list=None,
              qualifiers=NocaseDict({}))
    

    NOTE: The above is output as a single line and has been manually formatted for this documentation.

  • --output-format txt: Python str format of the objects.

    This should be considered the output of last resort as it simply uses the __str__() method of the Python class for each CIM object to output.

    Thus, for example, a class enumerate command of a model with only a single class creates output of the form:

    CIMClass(classname='CIM_Foo', ...)
    
ASCII tree format

This output format is an ASCII based output that shows the tree structure of the results of the class tree command. It is the only output format supported by this command, and therefore it is automatically selected and cannot be specified explicitly with the --output-format general option.

$ pywbemcli --mock-server tests/unit/simple_mock_model.mof class tree
root
+-- CIM_Foo
    +-- CIM_Foo_sub
    |   +-- CIM_Foo_sub_sub
    +-- CIM_Foo_sub2

This shows a very simple mock repository with 4 classes where CIM_Foo is the top level in the hierarchy, CIM_Foo_sub and CIM_Foo_sub2 are its subclasses, and CIM_Foo_sub_sub is the subclass of CIM_Foo_sub.

Text formats

The TEXT format group outputs the data returned from the command as text to the console without any formatting except for formatting lists and comma separated strings. It is useful for use with data that might be redirected to other commands or output that is simple enough that a single line of output is sufficient.

$ pywbemcli --mock-server tests/unit/testmock/wbemserver_mock.py -o table server namespaces
Server Namespaces:
Namespace Name
----------------
interop

$ pywbemcli --mock-server tests/unit/testmock/wbemserver_mock.py -o text server namespaces
interop
Pywbemcli defined logging

Pywbemcli provides logging to either a file or the standard error stream of information passing between the pywbemcli client and a WBEM server using the standard Python logging facility.

Logging is configured and enabled using the --log general option on the commmand line or the PYWBEMCLI_LOG environment variable.

Pywbemcli can log operation calls that send requests to a WBEM server and their responses and the HTTP messages between the pywbemcli client and the WBEM server including both the pywbem APIs and their responses and the HTTP requests and responses.

The default is no logging if the --log option is not specified.

The argument value of the --log option and the value of the PYWBEMCLI_LOG environment variable is a log configuration string with the format defined in the ABNF rule LOG_CONFIG_STRING, below. The log configuration string defines a list of one or more log configurations, each with fields COMPONENT, DESTINATION, and DETAIL:

LOG_CONFIG_STRING := CONFIG [ "," CONFIG ]
CONFIG            := COMPONENT [ "=" DESTINATION [ ":" DETAIL ]]
COMPONENT         := ( "all" / "api" / "http" )
DESTINATION       := ( "stderr" / "file" )
DETAIL            := ( "all" / "path" / "summary" )

For example the following log configuration string logs the pywbem API calls and writes summary information to a log file and the HTTP requests and responses to stderr:

$ pywbemcli --log api=file:summary,http=stderr

The simplest log configuration string to enable logging is all=stderr or all=file.

The COMPONENT field defines the component for which logging is enabled:

  • api - Logs the calls to the pywbem methods that make requests to a WBEM server. This logs both the requests and response including any exceptions generated by error responses from the WBEM server.

  • http - Logs the headers and data for HTTP requests and responses to the WBEM server.

  • all - (Default) Logs both the api and http components.

The DESTINATION field specifies the log destination:

  • stderr - Output log to stderr.

  • file - (default) Log to the pywbemcli log file pywbemcli.log in the current directory. Logs are appended to an existing log file.

The DETAIL component of the log configuration string defines the level of logging information for the api and http components. Because enormous quantities of information can be generated this option exists to limit the amount of information generated. The possible keywords are:

  • all - (Default) Logs the full request including all input parameters and the complete response including all data. Exceptions are fully logged.

  • paths - Logs the full request but only the path component of the api responses. This reduces the data included in the responses. Exceptions are fully logged.

  • summary - Logs the requests but only the count of objects received in the response. Exceptions are fully logged.

The log output is routed to the output defined by DESTINATION and includes the information determined by the COMPONENT and DETAIL fields.

The log output format is:

<Date time>-<Component>.<connection id>-<Direction>:<connection id> <PywbemOperation>(<data>)

For example, logging only of the summary API information would look something like the following:

$ pywbemcli -s http://localhost -u blah -p pw -l api=file:summary class enumerate -o

produces log output for the class enumerate operation in the log file pywbemcli.log as follows showing the input parameters to the pywbem method EnumerateClassName and the number of objects in the response:

2019-07-09 18:27:22,103-pywbem.api.1-27716-Request:1-27716 EnumerateClassNames(ClassName=None, DeepInheritance=False, namespace=None)
2019-07-09 18:27:22,142-pywbem.api.1-27716-Return:1-27716 EnumerateClassNames(list of str; count=103)

Pywbemcli persisted connection definitions

Pywbemcli can manage persisted connection definitions via the connection command group. These connection definitions are persisted in a connections file named .pywbemcli_connections.yaml in the user’s home directory. A connection definition has a name and defines all parameters necessary to connect to a WBEM server. Once defined these connection definitions can be used with the --name general option or in the interactive mode by defining a current connection with the connection select command.

A new persistent connection definition can be created with the connection save command.

At any point in time, pywbemcli can communicate with only a single WBEM server. That is the current connection. In the command mode, this is the WBEM server defined by the general options --server or --mock-server or --name. In the interactive mode, the current connection can be changed within an interactive session using the connection select command so that within a single session, the user can work with multiple WBEM servers (at different points in time).

The following example creates a persisted connection definition, using interactive mode:

$ pywbemcli

pywbemcli> --server http://localhost --user usr1 --password blah connection save testconn

pywbemcli> connection list
WBEM server connections: (#: default, *: current)
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+
| name      | server           | namespace   | user   |   timeout | verify   | mock-server                            |
|-----------+------------------+-------------+--------+-----------+----------+----------------------------------------|
| testconn  | http://localhost | root/cimv2  | usr1   |        30 | True     |                                        |
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+

Since the connection definition is persisted, it is available in command mode as well as in new interactive sessions:

$ pywbemcli connection list
WBEM server connections: (#: default, *: current)
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+
| name      | server           | namespace   | user   |   timeout | verify   | mock-server                            |
|-----------+------------------+-------------+--------+-----------+----------+----------------------------------------|
| testconn  | http://localhost | root/cimv2  | usr1   |        30 | True     |                                        |
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+

$ pywbemcli

pywbemcli> connection list
WBEM server connections: (#: default, *: current)
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+
| name      | server           | namespace   | user   |   timeout | verify   | mock-server                            |
|-----------+------------------+-------------+--------+-----------+----------+----------------------------------------|
| testconn  | http://localhost | root/cimv2  | usr1   |        30 | True     |                                        |
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+

Other connection definitions can be added, this time using command mode:

$ pywbemcli --server http://blah2 --user you --password xxx connection save Ronald

$ pywbemcli connection list
WBEM server connections: (#: default, *: current)
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+
| name      | server           | namespace   | user   |   timeout | verify   | mock-server                            |
|-----------+------------------+-------------+--------+-----------+----------+----------------------------------------|
| Ronald    | http://blah2     | root/cimv2  | you    |        30 | True     |                                        |
| testconn  | http://localhost | root/cimv2  | usr1   |        30 | True     |                                        |
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+

The following example shows how to select current connections in interactive mode. Note the marker * in front of the name, which indicates the current connection. The connection show command when used without a connection name shows the current connection:

$ pywbemcli

pywbemcli> connection select Ronald

pywbemcli> connection list
WBEM server connections: (#: default, *: current)
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+
| name      | server           | namespace   | user   |   timeout | verify   | mock-server                            |
|-----------+------------------+-------------+--------+-----------+----------+----------------------------------------|
| *Ronald   | http://blah2     | root/cimv2  | you    |        30 | True     |                                        |
| testconn  | http://localhost | root/cimv2  | usr1   |        30 | True     |                                        |
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+

pywbemcli> connection show
name: Ronald (current)
  server: http://blah2
  mock-server:
  . . .

pywbemcli> connection select testconn

pywbemcli> connection list
WBEM server connections: (#: default, *: current)
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+
| name      | server           | namespace   | user   |   timeout | verify   | mock-server                            |
|-----------+------------------+-------------+--------+-----------+----------+----------------------------------------|
| Ronald    | http://blah2     | root/cimv2  | you    |        30 | True     |                                        |
| *testconn | http://localhost | root/cimv2  | usr1   |        30 | True     |                                        |
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+

pywbemcli> connection show
name: testconn (current)
  server: http://localhost
  mock-server:
  . . .

pywbemcli> connection show Ronald
name: Ronald
  server: http://blah2
  mock-server:
  . . .

The concept of a current connection that can be selected is useful mostly for the interactive mode. In command mode, the connection specified with one of the -server, --mock-server, or --name general options automatically is considered the current connection, and there is no concept of selecting a current connection other than using these options. Therefore, pywbemcli additionally supports the concept of a persisted default connection.

The following example defines a persisted default connection and then uses it in command mode:

$ pywbemcli connection select Ronald --default
"Ronald" default and current

$ pywbemcli connection list
WBEM server connections: (#: default, *: current)
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+
| name      | server           | namespace   | user   |   timeout | verify   | mock-server                            |
|-----------+------------------+-------------+--------+-----------+----------+----------------------------------------|
| #Ronald   | http://blah2     | root/cimv2  | you    |        30 | True     |                                        |
| testconn  | http://localhost | root/cimv2  | usr1   |        30 | True     |                                        |
+-----------+------------------+-------------+--------+-----------+----------+----------------------------------------+

$ pywbemcli connection show
name: Ronald (default, current)
  server: http://blah2
  mock-server:
  . . .

Connections can be deleted with the connection delete command either with the command argument containing the connection name or with no name provided so pywbemcli presents a list of connections to choose from:

$ pywbemcli connection delete Ronald
Deleted default connection "Ronald".

or:

$ pywbemcli connection delete
Select a connection or CTRL_C to abort.
0: Ronald
1: testconn
Input integer between 0 and 1 or Ctrl-C to exit selection: 0
Deleted default connection "Ronald".

Pywbemcli special command line features

Pywbemcli includes several features in the command syntax that are worth presenting in detail to help the user understand the background, purpose and syntactic implementation of the features. This includes:

  • The ability to receive either CIM instances or classes or only their names with only a change of an option on the commands that request CIM instances or classes. The --names-only/--no command option defines whether only the name or the complete object will be displayed. See Displaying CIM instances/classes or their names

  • The ability to define complete INSTANCE name command arguments or interactively select the instance names from a list presented by pywbemcli for certain objects rather than typing in long names the full name. See Specifying the INSTANCENAME command argument.

  • The ability to filter classes and instances returned from a number of the enumerate commands filtered by characteristics of the classes. Thus, for example, it can for experimental classes, association classes, and deprecated classes. See Filtering responses for specific types of classes

  • The ability to view information on multiple namespaces in a single command. Many of the pywbemcli commands target a term:Namespace in the WBEM server for as the source of information (ex. enumerate, get, associators, references). Commands like create, delete, and modify are restricted to a single namespace which can be either the default namespace defined for the connection or a namespace defined with the --namespace command option. Commands like enumerate, get, associators, and references can be used to get CIM information from multiple namespaces in a single pywbemcli request using the --namespace command option. Thus, if single namespace is defined (--namespace root/blah) that becomes the namespace for the command. However with these particular commands, multiple namespaces can be specified (--namespace root/cimv2,root/cimv3 or --namespace root/cimv2 --namespace root/cimv3) and the CIM objects retrieved from all of the namespaces on this list and displayed. See Using multiple namespaces with server requests.

pywbemcli command relation to WBEM operations

The following table defines which pywbemcli commands are used for the corresponding WBEM operations.

WBEM CIM-XML Operation

pywbemcli command group & command

Instance Operations:

EnumerateInstances

instance enumerate INSTANCENAME

EnumerateInstanceNames

instance enumerate INSTANCENAME –names-only

GetInstance

instance get INSTANCENAME

ModifyInstance

instance modify

CreateInstance

instance create

DeleteInstance

instance delete INSTANCENAME

Associators(instance)

instance associators INSTANCENAME

Associators(class)

class associators CLASSNAME

AssociatorNames(instance)

instance associators INSTANCENAME –names-only

AssociatorNames(class)

class associators CLASSNAME –names-only

References(instance)

instance references INSTANCENAME

References(class)

class references CLASSNAME

ReferenceNames(instance)

instance references INSTANCENAME –names-only

ReferenceNames(class)

class references CLASSNAME –names-only

InvokeMethod

instance invokemethod INSTANCENAME –names-only

ReferenceNames

class invokemethod CLASSNAME –names-only

ExecQuery

instance query

Pull Operations:

Option –use-pull either or yes

OpenEnumerateInstances

instance enumerate INSTANCENAME

OpenEnumerateInstancePaths

instance enumerate INSTANCENAME –names-only

OpenAssociatorInstances

instance associators INSTANCENAME

OpenAssociatorInstancePaths

instance associators INSTANCENAME –names-only

OpenReferenceInstances

instance references INSTANCENAME

OpenReferenceInstancePaths

instance references INSTANCENAME –names-only

OpenQueryInstances

instance references INSTANCENAME –names-only

PullInstancesWithPath

part of pull sequence

PullInstancePaths

part of pull sequence

PullInstances

part of pull sequence

CloseEnumeration

Not implemented

Class Operations:

EnumerateClasses

class enumerate CLASSNAME

EnumerateClassNames

class enumerate –names-only

GetClass

class get CLASSNAME

ModifyClass

Not implemented

CreateClass

Not implemented

DeleteClass

class delete CLASSNAME

QualifierDeclaration Ops:

EnumerateQualifiers

qualifier enumerate

GetQualifier

qualifier get QUALIFIERNAME

SetQualifier

Not implemented

DeleteQualifier

Not Implemented

Specifying CIM property and parameter values

The instance create command, instance modify command, class invokemethod command, and instance invokemethod command define the values of properties and parameters that are to be applied to CIM instances and methods to be sent to the WBEM server.

For a single property or parameter these are the --property/-p or --parameter/-p command options with name and value in the form:

--property <name>=<value>
--parameter <name>=<value>
-p <name>=<value>

Where:

  • <name> is the name of the of the property or parameter.

  • <value> is the value of the property or parameter. The values represent the value of CIM types (ex. Uint32, String, etc.) or arrays of these types.

value := scalarValue | or arrayValues
arrayValues := scalarValue [ "," scalarValue]
scalarValue := integerValue, realValue, charValue, stringValue,
               datetimeValue, booleanValue, nullValue, objectPath of
               ANNEX A :term:`DSP0004`

These values define the syntax of the values to build CIM properties and CIM parameters to be sent to the CIM Server. Since the WBEM server requires that each property/parameter be typed to be created, pywbemcli retrieves the target CIM class from the WBEM Server to determine the CIM type and arrayness required to define a CIMProperty.

The scalarValues limitations with respect to the definitions in DSP0004 include:

  • Only decimal integers are allowed (octal, hex, and binary are not supported).

  • Integers must be in the value range of the corresponding CIM type (ex. Uint32) defined in the class to which the property is being applied.

  • The format for objectPath is the WBEM URI as defined in Specifying the INSTANCENAME command argument

Quotes around the value are only required if the value includes whitespace. See backslash-escaped for information on use of backslashes in formating property and parameter argument values.

The following are examples of scalar property definitions:

-p p1=SomeText
-p p2=\"Text with space\"
-p pint=3
-p psint=-3

For array properties the values are defined separated by commas:

-p <property-name>=<value>(,<value>)

For example:

-p strarray=abc,def,ghjk
-p strarray2=\"ab c\",def

Displaying CIM instances/classes or their names

The pywbem API includes different WBEM operations (ex. EnumerateInstances, EnumerateInstanceNames, EnumerateClasses, and EnumerateClassNames) to request CIM objects or just their names. To simplify the overall command line syntax pywbemcli combines these into a single command (i.e. enumerate, references, associators) in the class command group and the instance command group and includes the --names-only/--no command option that determines whether the names or the CIM objects are retrieved from the WBEM server.

Thus, for example an instance enumerate command with and without the --names-only/--no option:

$ pywbemcli --mock-server tests/unit/simple_mock_model.mof instance enumerate CIM_Foo

instance of CIM_Foo {
   InstanceID = "CIM_Foo1";
   IntegerProp = 1;
};

instance of CIM_Foo {
   InstanceID = "CIM_Foo2";
   IntegerProp = 2;
};

instance of CIM_Foo {
   InstanceID = "CIM_Foo3";
};

$ pywbemcli --mock-server tests/unit/simple_mock_model.mof instance enumerate CIM_Foo --names-only

root/cimv2:CIM_Foo.InstanceID="CIM_Foo1"
root/cimv2:CIM_Foo.InstanceID="CIM_Foo2"
root/cimv2:CIM_Foo.InstanceID="CIM_Foo3"

Specifying the INSTANCENAME command argument

The INSTANCENAME command argument used by some pywbemcli commands (e.g instance get) specifies the instance path (aka instance name) of a CIM instance in a CIM namespace of a WBEM server.

The instance name (INSTANCENAME argument) can be specified in two ways:

  • By specifying a complete untyped WBEM URI as defined in section The INSTANCENAME command argument as a WBEM URI. The namespace of the instance is the namespace specified in the WBEM URI, or the namespace specified with the --namespace/-n command option, or the default namespace of the connection. Any host name in the WBEM URI will be ignored.

  • By specifying the WBEM URI with the wildcard “?” in place of the keys component of the WBEM URI, as defined in section Interactively selecting INSTANCENAME command argument (i.e. CLASSNAME.?). The namespace of the instance is the namespace specified with the --namespace/-n command option, or the default namespace of the connection. If there is only a single instance, that instance is selected automaticaly with without user request.

  • By specifying the WBEM URI without keybindings and using the --key/-k command option to specify the keybindings ad defined in section Defining INSTANCENAME command argument with –key option. The advantage of this technique is that it eliminates the use of the double quote surrounding the key values.

The INSTANCENAME command argument as a WBEM URI

The format used by pywbemcli for specifying complete INSTANCENAME arguments on the command line is an untyped WBEM URI for instance paths as defined in DSP0207, this is the standard format. There is also a historical format for WBEM URIs that is described in the pywbem.CIMInstanceName.to_wbem_uri() method.

The INSTANCENAME argument can be specified using the standard format or the historical format.

Because pywbemcli always works with a single WBEM server at a time, the authority component of the WBEM URI does not need to be specified in an INSTANCENAME argument. Because the namespace type of the WBEM URI (e.g. “http” or “https”) is not relevant for identifying the CIM instance, the namespace type does not need to be specified in an INSTANCENAME argument.

With these simplifications and using the (simpler) historical format, the format for the INSTANCENAME argument can be described by the following ABNF:

INSTANCENAME = [ NAMESPACE ":" ] CLASSNAME [ "." keybindings ]

keybindings = keybinding *( "," keybinding )

keybinding = PROPERTYNAME "=" value

value = integerValue / charValue / stringValue / datetimeValue / booleanValue / referenceValue

referenceValue = "\"" escaped_INSTANCENAME "\""

where:

  • NAMESPACE, CLASSNAME and PROPERTYNAME are namespace, class and key property name, respectively, as used elsewhere in pywbemcli.

    The namespace, if specified, must be the target namespace of the operation. The purpose of being able to specify a namespace in INSTANCENAME is not to override the target namespace, but to use returned instance names that may contain a namespace, unchanged.

  • integerValue, charValue, stringValue, datetimeValue and booleanValue are defined in ANNEX A of DSP0004.

    Note that stringValue and datetimeValue when used in INSTANCENAME have exactly one set of surrounding double quotes (i.e. they cannot be constructed via string concatenation).

    Note that charValue when used in INSTANCENAME has exactly one set of surrounding single quotes.

    Note that DSP0004 prevents the use of real32 or real64 typed properties as keys.

  • escaped_INSTANCENAME is a backslash-escaped INSTANCENAME where at least backslash and double quote characters are backslash-escaped

Examples for UNIX-like shells. See backslash-escaped for information on use of backslashes:

pywbemcli instance get root/cimv2:MY_Foo.ID=42
pywbemcli instance get MY_Foo.ID=42
pywbemcli instance get "MY_Foo.CharKey='x'"
pywbemcli instance get 'MY_Foo.InstanceID="foo1"'
pywbemcli instance get "MY_Foo.InstanceID=\"$value\""
pywbemcli instance get 'MY_CS.CreationClassName="MY_CS",Name="MyComp"'
pywbemcli instance get 'MY_LogEntry.Timestamp="20190901183853.762122+120"'

Examples for Windows command processor:

pywbemcli instance get root/cimv2:MY_Foo.ID=42
pywbemcli instance get MY_Foo.ID=42
pywbemcli instance get MY_Foo.CharKey='x'
pywbemcli instance get MY_Foo.InstanceID="foo1"
pywbemcli instance get MY_Foo.InstanceID="%value%"
pywbemcli instance get MY_CS.CreationClassName="MY_CS",Name="MyComp"
pywbemcli instance get MY_LogEntry.Timestamp="20190901183853.762122+120"
Interactively selecting INSTANCENAME command argument

To simplify creating the INSTANCENAME argument on the command line, pywbemcli provides a wildcard character “?” that can be used in the INSTANCENAME argument in place of the keybindings component of the WBEM URI.

If an INSTANCENAME argument specifies the wildcard key, pywbemcli performs an interactive selection of the instance name by enumerating the instance names of the specified class, displaying the list of instance names along with index numbers, and prompting the user for the index number of the instance name to be used.

The ABNF for the INSTANCENAME argument with a wildcard key is:

INSTANCENAME = CLASSNAME "." wildcard

wildcard = "?"

where:

  • CLASSNAME is a class name as used elsewhere in pywbemcli.

Thus, in place of the full WBEM URI (ex. CIM_Foo.InstanceID="CIM_Foo1"), the user specifies CIM_Foo.? for the INSTANCENAME argument to trigger the interactive selection, as shown in the following example:

$ pywbemcli --mock-server tests/unit/simple_mock_model.mof instance get CIM_Foo.?
Pick Instance name to process
0: root/cimv2:CIM_Foo.InstanceID="CIM_Foo1"
1: root/cimv2:CIM_Foo.InstanceID="CIM_Foo2"
2: root/cimv2:CIM_Foo.InstanceID="CIM_Foo3"
Input integer between 0 and 2 or Ctrl-C to exit selection: 0  << user enters 0
instance of CIM_Foo {
   InstanceID = "CIM_Foo1";
   IntegerProp = 1;
};
Defining INSTANCENAME command argument with –key option

The INSTANCENAME may be specified by a combination of the namespace/classname as an argument with the --key/-k command option to define keybindings. Each --key/-k option definition defines a single keybinding in the form name=value. In general, the value component does not require the double quote that is required with the WBEM URI format unless there are space characters in a string value.

Example:

CIM_Foo --key InstanceId=inst1
Filtering responses for specific types of classes

Several of the commands include result filter options that filter returned information to include only those classes that have the defined filter option. Thus, pywbemcli class enumerate --association displays only classes that have the Association qualifier set. The filters are documented in the class filter options table below.

All of this filtering is done in pywbemcli so that it may require that significant information on the classes be requested from the server that would not be required without the filter. Thus, these commands may take more processing time.

Filter option name

Component filtered

--association/--no-association

Association qualifier(class) (see Note 1)

--indication/--no-indication

Indications qualifier(class)

--experimental/--no-experimental

Experimental qualifier(class)

--deprecated/--no-deprecated

Deprecated qualifier (any class element)

--since <CIM_Version_string>

Version qualifier GE <CIM_Version_string> (see Note 2)

--schema <schema_string>

Schema component of classname equality(see Note 3)

--subclasses <classname>

Subclasses of <classname>.

--leaf-classes

Classes with no subclass.

  1. The filters defined as --.../--no-... allow testing for the existence of the condition (association qualifier exists) or the non-existence(association qualifier does not exist on the class). When neither definition of the option is defined the association qualifier is ignored in the filtering. This applies to boolean qualifier declarations.

  2. The CIM version string value in the Version qualifier is defined as 3 integers separated by periods (ex. 2.14.0). All 3 integers must exist.

  3. The schema component is True if the schema component of classname (characters before “_” match <schema_string>). Ex –schema “CIM”

  4. The --leaf-classes filter can be important because the pywbem MOF compiler can compile all dependent classes given only the leaf classes. Thus, if the bottom class in a class hierarchy is specified, a path to schema classes is specified, and all classes are in files defined by the name of the class, the compiler will find and compile all super classes upon which the leaf class depends. NOTE: The user can observe this behavior be enabling the verbose mode --verbose general option.

If multiple filter options are applied, all of the boolean options must be true for the class to be displayed and only the classes that pass non-boolean filters (ex. --schema CIM) for the classes to be displayed.

Thus, for example:

  • the combination of --subclass-of CIM_blah and --leaf-classes will return all leaf classes that are a subclass of CIM_Blah.

  • --association and no-experimental will display only classes that have the Association qualifier set and the Experimental qualifier not set.

The following example displays classnames that are not associations (--no-association). The use of --deep-inheritance option returns the complete set of classes in the namespace rather than just direct subclasses (in this case the root classes).

$ pywbemcli --name mymock class enumerate --no --deep-inheritance --no-association
TST_Person
TST_Lineage

Using multiple namespaces with server requests

This feature was added in pywbemcli version 1.1.0.

Generally the CIM/XML commands defined by the DMTF execute operations on a single CIM namespace in the WBEM server. Thus, the command:

instance enumerate <classname> -n interop

is a request to the WBEM server to return instances of of <classname> from namespace interop.

However, pywbemcli expands this in version 1.1.0 to allow some requests to be executed against multiple namespaces in a single request. This was done primarily to allow viewing CIM objects in the server across namespaces (ex. comparing classes or instances between namespaces).

The commands enumerate, get, associators, and references for the command groups class and instance and the enumerate and get for the command group qualifiers allow issuing requests on multiple namespaces in a single pywbemcli command. Multiple namespaces for a command is defined with the --namespace option by defining the set of namespaces to be included rather than just a single namespace. If the default-namespace is not defined is the connection default namespace.

Thus, the requests below command pywbecli to make a request for each of the namespaces interop and root/comv2 and to present the results of both requests in a single response.

class enumerate CIM_ManagedElement -n interop, root/cimve class enumerate CIM_ManagedElement -s interop -n root/cimv2

The responses are displayed in the same form as for a single namespace except that the namespace is included for each type of output format to allow the user to determine which object is in which namespace. With MOF, the namespace appears as a MOF namespace pragma (commented because not all WBEM server compilers honor the namespace pragma). With tables, a namespace column is included in the table.

The order of the objects displayed in responses is controlled by a command options --object-order. The default order is to order the objects by namespace but defining this option allows modifying the order to display objects ordered by object name which allows comparing objects between namespaces.

For example:

# pywbemcli instance enumerate CIM_Door --namespace root/cimv2,root/cimv3

return the instances of CIM_Door from two namespaces root/cimv2 and root/cimv3.

A table output has the following form with table output

pywbemcli> -o table instance enumerate CIM_Foo -n root/cimv2,root/cimv3
Instances: CIM_Foo
+-------------+---------------------+---------------+
| namespace   | InstanceID          | IntegerProp   |
|-------------+---------------------+---------------|
| root/cimv2  | "CIM_Foo1"          | 1             |
| root/cimv2  | "CIM_Foo2"          | 2             |
| root/cimv2  | "CIM_Foo3"          |               |
| root/cimv2  | "CIM_Foo30"         |               |
| root/cimv2  | "CIM_Foo31"         |               |
| root/cimv2  | "CIM_Foo_sub1"      | 4             |
| root/cimv2  | "CIM_Foo_sub2"      | 5             |
| root/cimv2  | "CIM_Foo_sub3"      | 6             |
| root/cimv2  | "CIM_Foo_sub4"      | 7             |
| root/cimv3  | "CIM_Foo1"          | 1             |
| root/cimv3  | "CIM_Foo2"          | 2             |
| root/cimv3  | "CIM_Foo3"          |               |
| root/cimv3  | "CIM_Foo3-third-ns" | 3             |
| root/cimv3  | "CIM_Foo30"         |               |
| root/cimv3  | "CIM_Foo31"         |               |
| root/cimv3  | "CIM_Foo_sub1"      | 4             |
| root/cimv3  | "CIM_Foo_sub2"      | 5             |
| root/cimv3  | "CIM_Foo_sub3"      | 6             |
| root/cimv3  | "CIM_Foo_sub4"      | 7             |
+-------------+---------------------+---------------+

The –namespace option can be defined either using multiple definitions of the option: --namespace root/cimv2 --namespace root/cimv3 or as a single options with comma-separated namespace names : --namespace root/cimv2,root/cimv3.

The class find command and also process multiple namespaces in a single request but the default if the namespace is not provided is to use all of the namespaces defined in the server since the goal of these commands is to execute a wide search for the define class or instance entities.

To execute a request for multiple namespaces, pywbemcli executes the corresponding server request (ex. GetInstance) once for each namespace defined in the --namespace parameter. If a request for processing a command for multiple namespaces gets an exception for some of the requests but not all of them (ex. the class for a class get request only exists in some of the namespaces) it continues processing until all of the namespaces are processed and generates a warning message for each request exception. If all the requests fail, the command fails. If any of server requests return results, those results are displayed.

Pywbemcli command groups and commands

This section defines the characteristics of each of the pywbemcli command groups and commands including examples.

For the command line syntax of pywbemcli using these command groups and commands, see Pywbemcli command line interface.

NOTE: Many of the examples below use the --mock-server general option with mock files that are located in the pywbemtools tests/unit subdirectory and can be viewed in the pywbemtools git repository or by cloning pywbemtools.

The command groups are:

The individual commands (no command group) are: * help command - Show help message for interactive mode. * repl command - Enter interactive mode (default).

namespace command group

The namespace command group has commands that act on CIM namespaces:

See pywbemcli namespace –help.

namespace list command

The namespace list command lists the namespaces of the WBEM server of the current connection.

The result is displayed using txt output format or Table output formats.

The Interop namespace must exist on the server.

Example:

$ pywbemcli --name myserver --output-format plain namespace list
Namespace Name
root/PG_InterOp
root/benchmark
root/PG_Internal
test/WsmTest
test/EmbeddedInstance/Static
test/TestProvider
test/EmbeddedInstance/Dynamic
root/cimv2
root
test/cimv2
test/static

See pywbemcli namespace list –help for the exact help output of the command.

namespace create command

The namespace create command creates a CIM namespace on the WBEM server of the current connection.

The command format is:

pywbemcli [GENERAL-OPTIONS] namespace create NAMESPACE [COMMAND-OPTIONS]

Leading and trailing slash (/) characters specified in the NAMESPACE argument will be stripped.

The namespace must not yet exist on the server.

The Interop namespace must exist on the server and cannot be created using this command.

WBEM servers may not allow this operation or may severely limit the conditions under which a namespace can be created on the server.

Example:

$ pywbemcli --name mymock namespace create /root/abc
Created namespace root/abc

See pywbemcli namespace create –help for the exact help output of the command.

namespace delete command

The namespace delete command deletes a CIM namespace from the WBEM server of the current connection.

The command format is:

$ pywbemcli [GENERAL-OPTIONS] namespace delete NAMESPACE [COMMAND-OPTIONS]

Leading and trailing slash (/) characters specified in the NAMESPACE argument will be stripped.

The namespace must exist and must be empty. That is, it must not contain any objects (qualifiers, classes or instances).

The Interop namespace must exist on the server and cannot be deleted using this command.

WBEM servers may not allow this operation or may severely limit the conditions under which a namespace can be deleted.

Example:

$ pywbemcli --name mymock namespace delete /root/abc
Deleted namespace root/abc

See pywbemcli namespace delete –help for the exact help output of the command.

namespace interop command

The namespace interop command gets and displays the Interop namespace of the WBEM server that is the pywbemcli current connection.

The Interop namespace namespace must exist on the WBEM server. Some functionality such as determining namespaces and registered profiles assumes an interop namespace to function correctly.

Example:

$ pywbemcli --name mymock namespace interop
root/interop

See pywbemcli namespace interop –help for the exact help output of the command.

class command group

The class command group has commands that act on CIM classes:

See pywbemcli class –help.

class associators command

The class associators command lists the CIM classes that are associated with the specified source class.

The command format is:

$ pywbemcli [GENERAL-OPTIONS] class associators CLASSNAME [COMMAND-OPTIONS]

The source class is named with the CLASSNAME argument and is in the namespace specified with the -namespace/-n command option, or otherwise in the default namespace of the connection.

If the --names-only/--no command option is set, only the class path is displayed, using CIM object output formats or Table output formats. Otherwise, the class definition is displayed, using CIM object output formats.

Note: This command returns class associations. The instance associators command returns instance associations.

The command options are:

  • --assoc-class/--ac CLASSNAME - This option passes the CLASSNAME to the server to filter the result set by the association class name and its subclasses.

  • --result-class`/–rc``` CLASSNAME - This option passes the CLASSNAME to the server to filter the result set by result class name. Subclasses of the specified class also match.

  • --role/--r PROPERTYNAME - This option defines a reference property property name in the association class. The responses are filtered to match this role and property name.

  • --result-role/--rr PROPERTYNAME - This option defines a reference property name in the association class. The responses are filtered to match this role and property name.

  • --no-qualifiers`/–nq``` This option passes the flag to the server to not include qualifiers in the returned class(es). The default is to include qualifiers in the classes definitions returned.

  • --include-classorigin/--ico - This option passes the includeclassorigin flag to the server so the returned class(es) will include the class origin attribute. The default is to not include class origin information.

  • --propertylist/--pl PROPERTYLIST - This option passes the PROPERTYLIST to the server so that only properties in the list are included in the returned object(s). Multiple properties may be specified with either a comma-separated list of property names or by using the option multiple times. Properties specified in this option that are not in the object(s) will be ignored. AN empty string will include no properties. If this option is not set, the server is expected to return all properties.

  • --names-only/-no - This option determines whether the request to return classes or just class names is sent to the server. When set, only the object paths (names) are requested. The default is to return the class definitions.

index: pair –namespace option; command option –namespace

  • --namespace/-n NAMESPACE - This option defines the term:Namespace to use for this command, instead of the default namespace of the current connection. This option accepts single or multiple namespaces and displays the results for the list of namespaces supplied. See :ref: Pywbemcli special command line features for more information on using multiple namespaces

  • -s/--summary - Displays a summary count of the objects that are returned by the request rather than a table or CIM object representation of each object.

Example:

$ pywbemcli --name mymock class associators TST_Person --names-only
//FakedUrl/root/cimv2:TST_Person

See pywbemcli class associators –help for the exact help output of the command.

class delete command

The class delete command deletes the specified class on the server.

The command format is:

$ pywbemcli [GENERAL-OPTIONS] class delete CLASSNAME [COMMAND-OPTIONS]

The class to be deleted is named with the CLASSNAME argument and is in the namespace specified with the -namespace/-n command option, or otherwise in the default namespace of the connection.

If the class has subclasses, the command is rejected.

If the class has instances, the command is rejected, unless the --include-instances command option was specified, in which case the instances are also deleted.

WARNING: Deleting classes can cause damage to the server: It can impact instance providers and other components in the server. Use this command with caution.

Many WBEM servers may not allow this operation or may severely limit the conditions under which a class can be deleted from the server.

The command options are:

  • --include-instances - Delete any instances of the class as well. WARNING: Deletion of instances will cause the removal of corresponding resources in the managed environment (i.e. in the real world).Default: Reject command if the class has any instances.

  • --dry-run - Do not actually delete the objects, but display what would be done.

index:

pair –namespace option; command option –namespace

  • --namespace/-n NAMESPACE - This option defines the term:Namespace to use for this command, instead of the default namespace of the current connection.

Example:

$ pywbemcli class delete CIM_Blah

See pywbemcli class delete –help for the exact help output of the command.

class enumerate command

The class enumerate command enumerates the subclasses of the specified class, or the root classes of the class hierarchy.

The command format is:

$ pywbemcli [GENERAL-OPTIONS] class enumerate CLASSNAME [COMMAND-OPTIONS]

If the CLASSNAME argument is specified, the command enumerates the subclasses of the class named with the CLASSNAME argument in the namespace specified with the -namespace/-n command option, or otherwise in the default namespace of the connection.

If the CLASSNAME argument is omitted, the command enumerates the top classes of the class hierarchy in the namespace specified with the -namespace/-n command option, or otherwise in the default namespace of the connection.

If the --names-only/--no command option is set, only the class path is displayed, using CIM object output formats or Table output formats. Otherwise, the class definition is displayed, using CIM object output formats.

If the --deep-inheritance/--di command option is set, all direct and indirect subclasses are included in the result. Otherwise, only one level of the class hierarchy is in the result.

The class enumerate command includes result filter options that filter returned classes to display only those classes that have the defined filter option. See ref:Filter responses for specific types of classes for the documentation on these options.

Thus, for example:

  • pywbemcli class enumerate --association displays only classes

    that are associations

  • the combination of --subclass-of CIM_blah and --leaf-classes will return all leaf classes that are a subclass of CIM_Blah.

  • --association and no-experimental will display only classes that have the Association qualifier set and the Experimental qualifier not set.

The command options are:

  • --deep-inheritance/--di - Include the complete subclass hierarchy of the requested classes in the result set. The default is for the server to return only the first level subclasses of CLASSNAME.

  • --local-only/--lo - Do not include superclass properties and methods in the returned class(es). The default is to include properties and methods from all superclasses of CLASSNAME.

  • --no-qualifiers/--nq This option passes a flag to the server to not include qualifiers in the returned class(es). The default is to include qualifiers in the classes definitions returned.

  • --include-classorigin/--ico - This option passes the include-classorigin flag to the server so the returned class(es) will include the class origin attribute. The default is to not include class origin information.

  • --names-only/-no - This option determines whether the request to return classes or just class names is sent to the server. When set, only the object paths (names) are requested. The default is to return the class definitions.

  • --namespace/-n NAMESPACE - This option defines the term:Namespace to use for this command, instead of the default namespace of the current connection. This option accepts single or multiple namespaces and displays the results for the list of namespaces supplied. See :ref: Pywbemcli special command line features for more information on using multiple namespaces

  • -s/--summary - Show only a summary (count) of the objects.

  • The response filter options which further filter the classes to be displayed by characteristics such as whether the class is an association or is experimental, etc. These options are defined in Filtering responses for specific types of classes.

The following example enumerates the class names of the root classes in the default namespace because there is no classname and the --DeepInheritance option is not specified:

$ pywbemcli --name mymock class enumerate --names-only
TST_Person
TST_Lineage
TST_MemberOfFamilyCollection
TST_FamilyCollection

The following example displays classnames that are not associations (--no-association). The use of --deep-inheritance option returns the complete set of classes in the namespace rather than just direct subclasses (in this case the root classes).

$ pywbemcli --name mymock class enumerate --no --deep-inheritance --no-association
TST_Person
TST_Lineage

See pywbemcli class enumerate –help for the exact help output of the command.

class find command

The class find command lists classes with a class name that matches the Unix-style path name pattern specified in the CLASSNAME-GLOB argument in all namespaces of the connection, or otherwise in the specified namespaces if the -namespace/-n command option is specified one or more times.

The command format is:

$ pywbemcli [GENERAL-OPTIONS] class find CLASSNAME-GLOB [COMMAND-OPTIONS]

The class find command includes filter options that filter returned classes to display only those classes that have the defined filter options. Thus, pywbemcli class enumerate --association displays only classes that have the Association qualifier set. The filters are documented in section Filtering responses for specific types of classes.

The command displays the namespaces and class names of the result using the txt output format (default), or using Table output formats.

The command options are:

index:

pair –namespace option; command option –namespace

  • --namespace -n NAMESPACE - Add a namespace to the search scope. This option may be specified multiple times or the namespace list may be specified by comma-separated entries. If no namespace option is included, all namespaces in the current connection are included.

  • --sort/-s - Sort the results by namespace. The default is to sort by classname

  • The response filter options which further filter the classes to be displayed by characteristics such as whether the class is an association or is experimental, etc. These options are defined in Filtering responses for specific types of classes.

$ pywbemcli class find .*_WBEMS*
root/PG_InterOp:CIM_WBEMServer
root/PG_InterOp:CIM_WBEMServerCapabilities
root/PG_InterOp:CIM_WBEMServerNamespace
root/PG_InterOp:CIM_WBEMService
test/EmbeddedInstance/Dynamic:CIM_WBEMService
test/EmbeddedInstance/Static:CIM_WBEMService
test/TestProvider:CIM_WBEMServer
test/TestProvider:CIM_WBEMServerCapabilities
test/TestProvider:CIM_WBEMServerNamespace
test/TestProvider:CIM_WBEMService
root/SampleProvider:CIM_WBEMService
root/cimv2:CIM_WBEMServer
root/cimv2:CIM_WBEMServerCapabilities
root/cimv2:CIM_WBEMServerNamespace
root/cimv2:CIM_WBEMService
root/PG_Internal:PG_WBEMSLPTemplate

$ pywbemcli --output-format table class find CIM_SystemComponent*
Find class CIM_SystemComponent*
+-------------------------------+---------------------+
| Namespace                     | Classname           |
|-------------------------------+---------------------|
| root/PG_InterOp               | CIM_SystemComponent |
| test/WsmTest                  | CIM_SystemComponent |
| test/cimv2                    | CIM_SystemComponent |
| test/CimsubTestNS0            | CIM_SystemComponent |
| test/TestProvider             | CIM_SystemComponent |
| test/EmbeddedInstance/Dynamic | CIM_SystemComponent |
| root/SampleProvider           | CIM_SystemComponent |
| test/CimsubTestNS1            | CIM_SystemComponent |
| test/static                   | CIM_SystemComponent |
| test/CimsubTestNS2            | CIM_SystemComponent |
| test/TestINdSrcNS2            | CIM_SystemComponent |
| test/EmbeddedInstance/Static  | CIM_SystemComponent |
| test/CimsubTestNS3            | CIM_SystemComponent |
| test/TestIndSrcNS1            | CIM_SystemComponent |
| root/cimv2                    | CIM_SystemComponent |
| root/benchmark                | CIM_SystemComponent |
+-------------------------------+---------------------+

See pywbemcli class find –help for the exact help output of the command.

class get command

The class get command gets the specified class.

The command format is:

$ pywbemcli [GENERAL-OPTIONS] class get CLASSNAME [COMMAND-OPTIONS]

The class to be retrieved is named with the CLASSNAME argument and is in the namespace specified with the -namespace/-n command option, or otherwise in the default namespace of the connection.

The command options are:

  • --local-only/--lo - Do not include superclass properties and methods in the returned class(es). Default: Include superclass properties and methods.

  • --no-qualifiers/--nq - Do not include qualifiers in the returned class(es). Default: Include qualifiers.

  • --include-classorigin/--ico - Include class origin information in the returned class(es). Default: Do not include class origin information.

  • --propertylist/--pl PROPERTYLIST - This option passes the PROPERTYLIST to the server so that only properties in the list are included in the returned object(s). Multiple properties may be specified with either a comma-separated list of property names or by using the option multiple times. Properties specified in this option that are not in the object(s) will be ignored. AN empty string will include no properties. If this option is not set, the server is expected to return all properties.

  • --namespace/-n NAMESPACE - This option defines the term:Namespace to use for this command, instead of the default namespace of the current connection. This option accepts single or multiple namespaces and displays the results for the list of namespaces supplied. See :ref: Pywbemcli special command line features for more information on using multiple namespaces

The class definition is displayed using CIM object output formats. This command does not support Table output formats.

The following example shows getting the MOF representation of the class CIM_Foo:

$ pywbemcli --name mymock class get CIM_Foo

     [Description ( "Simple CIM Class" )]
  class CIM_Foo {

        [Key ( true ),
         Description ( "This is key property." )]
     string InstanceID;

        [Description ( "This is Uint32 property." )]
     uint32 IntegerProp;

        [Description ( "Method with in and out parameters" )]
     uint32 Fuzzy(
           [IN ( true ),
            OUT ( true ),
            Description ( "Define data to be returned in output parameter" )]
        string TestInOutParameter,
           [IN ( true ),
            OUT ( true ),
            Description ( "Test of ref in/out parameter" )]
        CIM_Foo REF TestRef,
           [IN ( false ),
            OUT ( true ),
            Description ( "Rtns method name if exists on input" )]
        string OutputParam,
           [IN ( true ),
            Description ( "Defines return value if provided." )]
        uint32 OutputRtnValue);

        [Description ( "Method with no Parameters" )]
     uint32 DeleteNothing();

  };

See pywbemcli class get –help for the exact help output of the command.

class invokemethod command

The class invokemethod command invokes a CIM method on the specified class and displays the return value and any output parameters.

The command format is:

$ pywbemcli [GENERAL-OPTIONS] class invokemethod CLASSNAME [COMMAND-OPTIONS]

The class is named with the CLASSNAME argument and is in the namespace specified with the -namespace/-n command option, or otherwise in the default namespace of the connection.

Input parameters for the method can be specified with the --parameter/-p command option, which can be specified multiple times. For details, see Specifying CIM property and parameter values.

The command options are:

  • --parameter``-p`` PARAMETERNAME=VALUE Specify a method input parameter with its value. May be used several time to define multiple input values.

index:

pair –namespace option; command option –namespace

  • --namespace/-n NAMESPACE - This option defines the term:Namespace to use for this command, instead of the default namespace of the current connection.

The return value and output parameters are displayed using CIM object output formats.

This command invokes a method on a class, not on an instance. To invoke a method on an instance, use the instance invokemethod command.

Example:

$ pywbemcli --mock-server tests/unit/all_types.mof --mock-server tests/unit/all_types_method_mock.py.py

pywbemcli> class invokemethod PyWBEM_AllTypes AllTypesMethod --parameter arrBool=True,False
ReturnValue=0
arrBool=true, false

See pywbemcli class invokemethod –help for the exact help output of the command.

class references command

The class references command lists the CIM classes that reference the specified source class.

The command format is:

$ pywbemcli [GENERAL-OPTIONS] class references CLASSNAME [COMMAND-OPTIONS]

The source class is named with the CLASSNAME argument and is in the namespace specified with the -namespace/-n command option, or otherwise in the default namespace of the connection.

If the --names-only/--no command option is set, only the class path is displayed, using CIM object output formats or Table output formats. Otherwise, the class definition is displayed, using CIM object output formats.

Note: This command returns the class references, not the instance references. The instance references command returns the instance references.

The command options are:

  • --assoc-class/--ac CLASSNAME This option passes the CLASSNAME to the server to filter the result set by association class name and subclasses.

  • --role/-r PROPERTYNAME This option passes the CLASSNAME to the server to filter the result set by the association class source end role name.

  • --no-qualifiers/--nq This option passes the flag to the server to not include qualifiers in the returned class(es). The default is to include qualifiers in the classes definitions returned.

  • --include-classorigin/--ico This option passes the include-classorigin flag to the server so the returned class(es) will include the class origin attribute. The default is to not include class origin information.

** --propertylist/--pl PROPERTYLIST - command option allows restricting the set of

properties to be retrieved and displayed on each object returned. Multiple properties may be specified with either a comma-separated list or by using the option multiple times. Properties specified in this option that are not in the object(s) will be ignored. The empty string will include no properties. Default: Do not filter properties.

  • --names-only/-no - This option determines whether the request to return classes or just class names is sent to the server. When set, only the object paths (names) are requested. The default is to return the class definitions.

index:

pair –namespace option; command option –namespace

  • --namespace/-n NAMESPACE - This option defines the term:Namespace to use for this command, instead of the default namespace of the current connection. This option accepts single or multiple namespaces and displays the results for the list of namespaces supplied. See :ref: Pywbemcli special command line features for more information on using multiple namespaces

$ pywbemcli --name mymock class references TST_Person --names-only
//FakedUrl/root/cimv2:TST_Lineage
//FakedUrl/root/cimv2:TST_MemberOfFamilyCollection

See pywbemcli class references –help for the exact help output of the command.

class tree command

The class tree command displays the subclass or superclass hierarchy of the specified class.

The command format is:

$ pywbemcli [GENERAL-OPTIONS] class tree CLASSNAME [COMMAND-OPTIONS]

The class is named with the optional CLASSNAME argument and is in the namespace specified with the -namespace/-n command option, or otherwise in the default namespace of the connection.

If CLASSNAME is omitted, the complete class hierarchy of the namespace is displayed.

If the -superclasses command option is set, the specified class and its superclass ancestry up to the top-level class are displayed. Otherwise, the specified class and its subclass hierarchy are displayed.

The class hierarchy (or ancestry) is always formatted in the Tree output format; the --output-format/-o general option is ignored.

The command options are:

  • --superclasses/-s - Show the superclass hierarchy starting with CLASSNAME. Normally the subclass hierarchy is displayed.

  • --detail`/-d``` - Show details about the class including the Version, Association, Indication, and Abstact qualifiers.

index:

pair –namespace option; command option –namespace

  • --namespace/-n NAMESPACE - This option defines the term:Namespace to use for this command, instead of the default namespace of the current connection.

Example:

$ pywbemcli class tree CIM_Foo
CIM_Foo
 +-- CIM_Foo_sub
 |   +-- CIM_Foo_sub_sub
 +-- CIM_Foo_sub2

Example:

$ pywbemcli -n mock1 class tree CIM_Foo_Sub2 -s
root
 +-- CIM_Foo
     +-- CIM_Foo_sub2

The following example displays additional information using the --detail option.

Example:

$ pywbemcli -m tests/unit/tree_test_model.mof class tree --detail
root
 +-- CIM_Foo (Version=2.30.0)
 |   +-- CIM_Foo_sub (Version=2.31.0)
 |       +-- CIM_Foo_sub_sub (Version=2.20.1)
 +-- CIM_Foo_no_version ()
 +-- CIM_Indication (Abstract,Indication,Version=2.24.0)
 +-- CIM_Indication_no_version (Abstract,Indication)
 +-- TST_Lineage (Association,Version=2.20.1)
 +-- TST_Lineage_no_version (Association)

See pywbemcli class tree –help for the exact help output of the command.

instance command group

The instance command group has commands that act on CIM instances:

See pywbemcli instance –help.

instance associators command

The instance associators command lists the CIM instances that are associated with the specified source instance.

The command format is:

$ pywbemcli [GENERAL-OPTIONS] instance associators INSTANCENAME [COMMAND-OPTIONS]

The specification of the instance name (INSTANCENAME argument) is documented in the section Specifying the INSTANCENAME command argument.

If the --names-only/--no command option is set, only the instance paths are displayed. Otherwise, the instances are displayed.

Valid output formats in both cases are CIM object output formats or Table output formats.

In the table output format with instances a column namespace is included if the request defines multiple namespaces and a classname column is included if the displayed instances are from multiple classes.

Note: This command returns the instance associators, not the class associators. The class associators command returns the class associators.

The command options are:

  • --assoc-class/--ac CLASSNAME - This option passes CLASSNAME to the server to filter the result set by association class name and subclasses.

  • --result-class/--rc CLASSNAME - This option passes CLASSNAME to the server to filter the result set by result class name. Subclasses of the specified class also match.

  • --role/-r PROPERTYNAME - This option passes CLASSNAME to the server to filter the result set by the association class source end role name.

  • --result-role/--rr PROPERTYNAME - This option passes PROPERTYNAME to the server to filter the result set by far end role name.

  • --no-qualifiers/--nq - This option passes the flag to the server to not include qualifiers in the returned class(es). The default is to include qualifiers in the classes definitions returned.

  • --include-classorigin/--ico - This option passes the includeclassorigin flag to the server so the returned class(es) will include the class origin attribute. The default is to not include class origin information.

** --propertylist/--pl PROPERTYLIST command option allows restricting the set of

properties to be retrieved and displayed on each object returned. Multiple properties may be specified with either a comma-separated list or by using the option multiple times. Properties specified in this option that are not in the object(s) will be ignored. The empty string will include no properties. If this option is not set, the server is expected to return all properties.

  • --names-only/-no - This option determines whether the request to return classes or just class names is sent to the server. When set, only the object paths (names) are requested. The default is to return the class definitions.

  • --object-order - This option modifies the order of the display of instances when there are multiple namespaces displayed to order by classname and then namespace where the normal display order is to order by namespace and then classname

index:

pair –namespace option; command option –namespace

  • --namespace/-n NAMESPACE - This option defines the term:Namespace to use for this command, instead of the default namespace of the current connection. This option accepts single or multiple namespaces and displays the results for the list of namespaces supplied. See :ref: Pywbemcli special command line features for more information on using multiple namespaces

  • -s/--summary - Show only a summary (count) of the objects.

  • --fq/--filter-query QUERY-STRING - When pull operations are used, filter the instances in the result via a filter query. By default, and when traditional operations are used, no such filtering takes place.

  • --fql/--filter-query-language QUERY-LANGUAGE = The filter query language to be used with --filter-query. Default: DMTF:FQL.

  • --show-null -In the TABLE output formats, show propertieswith no value (i.e. Null) in all of the instances to be displayed. Otherwise only properties at least one instance has a non- Null property are displayed

  • --help-instancename/--hi - Show help message for specifying INSTANCENAME including use of the --key and --namespace options because instance name specification on the command line is complex and there are several options to specifying the instance name.

Example:

$ pywbemcli --name mymock instance references TST_Person.? --names-only
Pick Instance name to process: 0
0: root/cimv2:TST_Person.name="Mike"
1: root/cimv2:TST_Person.name="Saara"
2: root/cimv2:TST_Person.name="Sofi"
3: root/cimv2:TST_Person.name="Gabi"
4: root/cimv2:TST_PersonSub.name="Mikesub"
5: root/cimv2:TST_PersonSub.name="Saarasub"
6: root/cimv2:TST_PersonSub.name="Sofisub"
7: root/cimv2:TST_PersonSub.name="Gabisub"
Input integer between 0 and 7 or Ctrl-C to exit selection: 0   << entered by user

//FakedUrl/root/cimv2:TST_Lineage.InstanceID="MikeSofi"
//FakedUrl/root/cimv2:TST_Lineage.InstanceID="MikeGabi"
//FakedUrl/root/cimv2:TST_MemberOfFamilyCollection.family="root/cimv2:TST_FamilyCollection.name=\"Family2\"",member="root/cimv2:TST_Person.name=\"Mike\""

See pywbemcli instance associators –help for the exact help output of the command.

instance count command

Count the instances of one or more classes defined by a GLOB pattern with matching class name

The instance count command counts the CIM instances classes that match a GLOB pattern in the namespaces specified with the -namespace/-n command option, or all namespaces in the server.

The command format is:

$ pywbemcli [GENERAL-OPTIONS] instance count CLASSNAME-GLOB [COMMAND-OPTIONS]

This command first finds all of the CIM classes that match the CLASSNAME-GLOB and -namespace/-n command option and then gets the instance names of all instances of these classes.

This command displays the count of instances of each CIM class whose class name matches the specified wildcard expression (CLASSNAME-GLOB) in all CIM namespaces of the WBEM server, or in the specified namespaces (--namespace option). This differs from instance enumerate, etc. in that it counts the instances specifically for the classname of each instance returned (the creation classname), not including subclasses.

If the CLASSNAME-GLOB argument is specified, only instances of classes that match the specified Unix-style path name pattern are counted. If the CLASSNAME-GLOB argument is not specified all instances of all classes in the target namespaces are counted.

The --association/--no-association, --indication/--no-indication, ,``–experimental``/--no-experimental and --deprecated/--no-deprecated options filter the returned classes or classnames to include or exclude classes with the corresponding qualifiers. Thus the --association option returns only instances of classes that are association classes.

The command options are:

  • --namespace/-n NAMESPACE - Add a namespace to the search scope. May be specified multiple times. If this option is not specified the search defaults to searching all namespaces in the server. Note that this option differs from the option of the same name in commands like instance enumerate in that it allows multiple namespaces and defaults to defining a list of all namespaces rather than defaulting to the connection default namespace.

  • --sort/-s - Sort by instance count. Otherwise the display is sorted by class name.

  • --ignore-class CLASSNAME - Class names of classes to be ignored (not inspected or counted). This option allows counting instances in servers where instance retrieval may cause a CIMError or Error exception during the enumeration of some classes. CIM errors on particular classes are ignored. Error exceptions cause scan to stop and remaining classes status shown as ‘not scanned’. Multiple class names are allowed (one per option or comma-separated).

  • The response filter options which further filter the classes to be displayed by characteristics such as whether the class is an association or is experimental, etc. These options are defined in Filtering responses for specific types of classes.

Valid output formats are Table output formats.

Thus, for example:

$ pywbemcli --name mymock instance count --association -n root/cimv2
  # Returns counts of instances of association classes from namespace root/cimv2

$ pywbemcli --name mymock instance count --experimental
  # returns the counts of instances where the class has the experimental qualifier

$ pywbemcli -n mymock instance count CIM_* -n root/interop
  # returns counts of instances in root/interop namespace where the classname
  # starts with CIM_

The --ignore-class option allows the user to ignore multiple selected classes in the scan for instances. This is useful in cases where the enumerate of instances of a class returns an error from the WBEM server. The command that will ignore some classes is as follows:

$ pywbemcli -n mymock instance count CIM_* -n root/interop --ignore-class classname1,classname2
  # Ignores classname1 and classname2 and shows them in the table as

  # classname1    ignored
  # classname2    ignored

# The command form may also be used
    $ pywbemcli -n mymock instance count CIM_* -n root/interop --ignore-class classname1 --ignore-class classname2

Results for classes that have no instances are not displayed.

The processing handles both CIMError exceptions (which are considered errors applicable to particular instances), and Error exceptions which are considered server errors so that the scan for instances is terminated). In all cases it tries to include all classes in the display and adds status information in place of the count of instances returned when a particular class causes an exception.

This command can take a long time to execute since it potentially enumerates all instance names for all classes in all namespaces of the WBEM server.

Example:

$ pywbemcli --name mymock instance count
Count of instances per class
+-------------+------------------------------+---------+
| Namespace   | Class                        |   count |
|-------------+------------------------------+---------|
| root/cimv2  | TST_FamilyCollection         |       2 |
| root/cimv2  | TST_Lineage                  |       3 |
| root/cimv2  | TST_MemberOfFamilyCollection |       3 |
| root/cimv2  | TST_Person                   |       4 |
| root/cimv2  | TST_Personsub                |       4 |
+-------------+------------------------------+---------+

Count is useful to determine which classes in the environment are actually implemented and define instances. However this command can take a long time to execute because it must a) enumerate all classes in the namespace, b) enumerate the instances for each class that is defined by the classname GLOB pattern and the namespace list.

See pywbemcli instance count –help for the exact help output of the command.

instance create command

The instance create command creates a CIM instance in the namespace specified with the -namespace/-n command option, or otherwise in the default namespace of the connection.

The command format is:

$ pywbemcli [GENERAL-OPTIONS] instance create CLASSNAME [COMMAND-OPTIONS]

The new CIM instance has the creation class specified in the CLASSNAME argument and initial property values as specified by zero or more --property/-p command options. For details, see Specifying CIM property and parameter values.

The command displays the instance path of the new instance that is returned by the WBEM server, using txt output format.

Since the WBEM server (and pywbem) requires that each property be typed, pywbemcli retrieves the creation class from the WBEM server to determine the data types for the properties.

The command options are:

  • --property/-p PROPERTYNAME=VALUE - This option defines the initial property value for the new instance and sets that property into the instance. The option may be specified multiple times. Array property values are specified as a comma- separated list; embedded instances are not supported. The default if there are no --property options is a new instance with no properties.

  • --verify/-V - Prompt the user for confirmation before performing a

    change, to allow for verification of parameters. Default: Do not prompt for confirmation.

  • --namespace/-n NAMESPACE - This option defines the term:Namespace to use for this command, instead of the default namespace of the :term:current connection.

The following examples create an instance of the class TST_Blah with two scalar and one array property:

$ pywbemcli instance create TST_Blah --property InstancId=blah1 --property IntProp=3 --property IntArr=3,6,9

$ pywbemcli instance create TST_Blah --property InstancId=\"blah 2\" --property IntProp=3 --property IntArr=3,6,9

See pywbemcli instance create –help for the exact help output of the command.

instance delete command

The instance delete command deletes a CIM instance.

The command format is:

$ pywbemcli [GENERAL-OPTIONS] instance delete INSTANCENAME [COMMAND-OPTIONS]

The specification of the instance name (INSTANCENAME argument) is documented in the section Specifying the INSTANCENAME command argument.

The command options are:

  • --key/-k KEYNAME=VALUE - The value for a key in the keybinding of CIM instance name. May be specified multiple times. This option allows defining keys on the command line without the issues of quotes.

  • --namespace/-n NAMESPACE - This option defines the term:Namespace to use for this command, instead of the default namespace of the :term:current connection.

  • --help-instancename/--hi - Show help message for specifying INSTANCENAME including use of the --key and --namespace options because instance name specification on the command line is complex and there are several options to specifying the instance name.

The following example deletes an instance by specifying its instance name. Note the extra backslash (see backslash-escaped) that is required to escape the double quote on the terminal:

$ pywbemcli --name mymock instance delete root/cimv2:TST_Person.name=\"Saara\"

See pywbemcli instance delete –help for the exact help output of the command.

instance enumerate command

The instance enumerate command lists the CIM instances of the specified class (including subclasses) in a namespace.

The command format is:

$ pywbemcli [GENERAL-OPTIONS] instance enumerate CLASSNAME [COMMAND-OPTIONS]

The class is named with the CLASSNAME argument and is in the namespace specified with the -namespace/-n command option, or otherwise in the default namespace of the connection.

The instance enumerate may use either the traditional operation (EnumerateInstances or EnumerateInstanceNames) or the corresponding pull operations depending on the --use-pull general option.

If the --names-only/--no command option is set, only the instance paths are displayed. Otherwise, the instances are displayed. Depending on other options, either EnumerateInstances or EnumerateInstanceNames may be executed when pywbem is called.

Valid output formats in both cases are CIM object output formats or Table output formats.

The table view displays a single instance per row and a column for each property in the instance. If the table display of instances includes instances from multiple classes, a column is added to the table with the classname. If the request covers multiple namespaces, a column is added defining the namespace in which each instance resides.

The command options are:

  • --local-only / --lo - option that allows showing only local properties in the instance rather than including the properties from superclasses. The default is to show properties from superclasses.

  • --deep-inheritance/--di - option that allows showing all properties or only properties defined in the class defined in the CLASSNAME argument

  • --include-qualifiers/--iq - This option passes the flag to the server to include qualifiers in the returned instanc(es). The default is to not include qualifiers in the classes definitions returned. Since the use of qualifiers on instances has been deprecated,

  • --include-classorigin/--ico - This option passes the includeclassorigin flag to the server so the returned class(es) will include the class origin attribute. The default is to not include class origin information.

  • --propertylist/--pl PROPERTYLIST - This option passes the PROPERTYLIST to the server so that only properties in the list are included in the returned object(s). Multiple properties may be specified with either a comma-separated list of property names or by using the option multiple times. Properties specified in this option that are not in the object(s) will be ignored. An empty string will include no properties. If this option is not set, the server is expected to return all properties.

  • `--names-only/-no - This option determines whether the request to return classes or just class names is sent to the server. When set, only the object paths (names) are requested. The default is to return the class definitions.

  • --namespace/-n NAMESPACE - This option defines the term:Namespace to use for this command, instead of the default namespace of the :term:current connection. This option accepts single or multiple namespaces and displays the results for the list of namespaces supplied. See :ref: Pywbemcli special command line features for more information on using multiple namespaces

  • --summary/-s - Show only a summary (count) of the objects.

  • filter-query/ –fq` QUERY-STRING - When pull operations are used, filter the instances in the result via a filter query defined by QUERY-STRING. By default, and when traditional operations (non-pull) are used, no such filtering takes place and the option is ignored.

  • --filter-query-language/fql QUERY-LANGUAGE = The filter query language to be used with --filter-query. This parameter is restricted to when pull operations are used. Default: DMTF:FQL. This parameter is ignored if traditional operations are executed.

  • --show-null - In the TABLE output formats, show propertieswith no value (i.e. Null) in all of the instances to be displayed. Otherwise only properties at least one instance has a non- Null property are displayed

  • --object-order - This option modifies the order of the display of instances when there are multiple namespaces displayed to order by classname and then namespace where the normal display order is to order by namespace and then classname.

The following example returns two instances as MOF:

$ pywbemcli --name mock1 instance enumerate CIM_Foo

instance of CIM_Foo {
   InstanceID = "CIM_Foo1";
   IntegerProp = 1;
};

instance of CIM_Foo {
   InstanceID = "CIM_Foo2";
   IntegerProp = 2;
};

instance of CIM_Foo {
   InstanceID = "CIM_Foo3";
};

instance of CIM_Foo {
   InstanceID = "CIM_Foo30";
};

instance of CIM_Foo {
   InstanceID = "CIM_Foo31";
};

instance of CIM_Foo_sub {
   InstanceID = "CIM_Foo_sub1";
   IntegerProp = 4;
};

instance of CIM_Foo_sub {
   InstanceID = "CIM_Foo_sub2";
   IntegerProp = 5;
};

instance of CIM_Foo_sub {
   InstanceID = "CIM_Foo_sub3";
   IntegerProp = 6;
};

... The remainder of the instances are shown

The corresponding table view would be:

ppp -o table -n mock1 instance enumerate CIM_Foo
Instances: CIM_Foo
+--------------------+---------------+
| InstanceID         | IntegerProp   |
|--------------------+---------------|
| "CIM_Foo1"         | 1             |
| "CIM_Foo2"         | 2             |
| "CIM_Foo3"         |               |
| "CIM_Foo30"        |               |
| "CIM_Foo31"        |               |
| "CIM_Foo_sub1"     | 4             |
| "CIM_Foo_sub2"     | 5             |
| "CIM_Foo_sub3"     | 6             |
| "CIM_Foo_sub4"     | 7             |
| "CIM_Foo_sub_sub1" | 8             |
| "CIM_Foo_sub_sub2" | 9             |
| "CIM_Foo_sub_sub3" | 10            |
+--------------------+---------------+

See pywbemcli instance enumerate –help for the exact help output of the command.

instance get command

The instance get command gets a CIM instance.

The command format is:

$ pywbemcli [GENERAL-OPTIONS] instance get INSTANCENAME [COMMAND-OPTIONS]

The specification of the instance name (INSTANCENAME argument) is documented in the section Specifying the INSTANCENAME command argument.

The command options are:

  • --local-only/--lo - Do not include superclass properties in the returned instance. Some servers may ignore this option. Default: Include superclass properties.

  • --include-qualifiers/--iq - Include qualifiers in the returned instance. Not all servers return qualifiers on instances. Default: Do not include qualifiers.

  • --include-classorigin/--ico - Include class origin information in the returned instance(s). Some servers may ignore this option. Default: Do not include class origin information.

  • --propertylist/--pl PROPERTYLIST command option allows restricting the set of properties to be retrieved and displayed on each object returned. Multiple properties may be specified with either a comma-separated list or by using the option multiple times. Properties specified in this option that are not in the object(s) will be ignored. The empty string will include no properties. If this option is not set, the server is expected to return all properties.

  • --key/-k KEYNAME=VALUE - The value for a key in the keybinding of CIM instance name. May be specified multiple times. This option allows defining keys on the command line without the issues of quotes. Default: No keybindings provided.

  • --namespace/-n NAMESPACE - This option defines the term:Namespace to use for this command, instead of the default namespace of the :term:current connection. This option accepts single or multiple namespaces and displays the results for the list of namespaces supplied. See :ref: Pywbemcli special command line features for more information on using multiple namespaces. The instance must exist in all of the defined namespaces.

  • --help-instancename/--hi - Show help message for specifying INSTANCENAME including use of the --key and --namespace options because instance name specification on the command line is complex and there are several options to specifying the instance name.

  • --show-null - In the TABLE output formats, show properties with no value (i.e. Null) in all of the instances to be displayed. Otherwise only properties at least one instance that has a non-Null property are displayed

The command displays the instance using CIM object output formats or Table output formats.

This example gets an instance by instance name:

$ pywbemcli --name mymock instance get root/cimv2:TST_Person.name=\"Saara\"
instance of TST_Person {
   name = "Saara";
};

or using the keys wildcard:

$ pywbemcli --name mock1 instance get TST_Person.?
Pick Instance name to process
0: root/cimv2:CIM_Foo.InstanceID="CIM_Foo1"
1: root/cimv2:CIM_Foo.InstanceID="CIM_Foo2"
2: root/cimv2:CIM_Foo.InstanceID="CIM_Foo3"
Input integer between 0 and 2 or Ctrl-C to exit selection: 0   << entered by user
instance of TST_Person {
   name = "Saara";
};

or using the key option:

$ pywbemcli --name mock1 instance get TST_Person --key=name=Gabi
instance of TST_Person {
   name = "Gabi";
   likes = { 2 };
   gender = 1;
};

See pywbemcli instance get –help for the exact help output of the command.

instance invokemethod command

The instance invokemethod command invokes a CIM method on the specified instance and displays the return value and any output parameters.

The command format is:

pywbemcli [GENERAL-OPTIONS] instance invokemethod INSTANCENAME [COMMAND-OPTIONS]

The specification of the instance name (INSTANCENAME argument) is documented in the section Specifying the INSTANCENAME command argument.

Input parameters for the method can be specified with the --parameter/-p command option, which can be specified multiple times. For details, see Specifying CIM property and parameter values.

The return value and output parameters are displayed using CIM object output formats.

The command options are:

  • --parameter``-p`` PARAMETERNAME=VALUE Specify a method input parameter with its value. May be used several time to define multiple input values.

  • --key/-k KEYNAME=VALUE - The value for a key in the keybinding of CIM instance name. May be specified multiple times. This option allows defining keys on the command line without the issues of quotes. Default: No keybindings provided.

  • --namespace/-n NAMESPACE - Namespace to use for this command,

    instead of the default namespace of the :term: current connection.

  • --help-instancename/--hi - Show help message for specifying INSTANCENAME including use of the --key and --namespace options because instance name specification on the command line is complex and there are several options to specifying the instance name.

Example:

$ pywbemcli --mock-server tests/unit/all_types.mof --mock-server tests/unit/all_types_method_mock.py.py

pywbemcli> instance invokemethod PyWBEM_AllTypes.InstanceId=\"test_instance\" AllTypesMethod --parameter arrBool=True,False
ReturnValue=0
arrBool=true, false

Or using the wildcard to create a selection list for the instance names

$ pywbemcli --mock-server tests/unit/all_types.mof --mock-server tests/unit/all_types_method_mock.py.py

pywbemcli> instance invokemethod PyWBEM_AllTypes.? --parameter arrBool=True,False
Pick Instance name to process
0: root/cimv2:CIM_Foo.InstanceID="CIM_Foo1"
1: root/cimv2:CIM_Foo.InstanceID="CIM_Foo2"
2: root/cimv2:CIM_Foo.InstanceID="CIM_Foo3"
Input integer between 0 and 2 or Ctrl-C to exit selection: 0   << entered by user
ReturnValue=0
arrBool=true, false

See pywbemcli instance invokemethod –help for the exact help output of the command.

instance modify command

The instance modify command modifies the properties of an existing CIM instance.

The command format is:

pywbemcli [GENERAL-OPTIONS] instance modify INSTANCENAME [COMMAND-OPTIONS]

The specification of the instance name (INSTANCENAME argument) is documented in the section Specifying the INSTANCENAME command argument.

The new property values are specified by possibly multiple --property/-p command options.

For details, see Specifying CIM property and parameter values.

Key properties cannot be modified, as per DSP0004.

The command arguments are:

  • --property/-p PROPERTYNAME=VALUE - This option defines the initial property value for the new instance and sets that property into the instance. The option may be specified multiple times. Array property values are specified as a comma- separated list; embedded instances are not supported. The default if there are no --property options is a new instance with no properties.

** --propertylist/--pl PROPERTYLIST command option allows restricting the set of

properties to be retrieved and displayed on each object returned. Multiple properties may be specified with either a comma-separated list or by using the option multiple times. Properties specified in this option that are not in the object(s) will be ignored. The empty string will include no properties. If this option is not set, the server is expected to return all properties.

  • --verify/-V -Prompt for confirmation before performing a change, to allow for verification of parameters. Default: Do not prompt for confirmation.

  • --key/-k KEYNAME=VALUE - The value for a key in the keybinding of CIM instance name. May be specified multiple times. This option allows defining keys on the command line without the issues of quotes. Default: No keybindings provided.

  • --namespace/-n NAMESPACE - This option defines the term:Namespace to use for this command, instead of the default namespace of the current connection.

  • --help-instancename/--hi - Show help message for specifying INSTANCENAME including use of the --key and --namespace options because instance name specification on the command line is complex and there are several options to specifying the instance name.

Since the WBEM server (and pywbem) requires that each property be typed, pywbemcli retrieves the creation class from the WBEM server to determine the data types for the properties.

The following examples modifies an instance of the class TST_Blah with two scalar and one array property:

$ pywbemcli instance modify TST_Blah --property InstancId=blah1 --property IntProp=3 --property IntArr=3,6,9

$ pywbemcli instance modify TST_Blah --property InstancId=\"blah 2\" --property IntProp=3 --property IntArr=3,6,9

See pywbemcli instance modify –help for the exact help output of the command.

instance references command

The instance references command lists the CIM instances that reference the specified source instance.

The command format is:

pywbemcli [GENERAL-OPTIONS] instance references INSTANCENAME [COMMAND-OPTIONS]

The specification of the instance name (INSTANCENAME argument) is documented in the section Specifying the INSTANCENAME command argument.

If the --names-only/--no command option is set, only the instance paths are displayed. Otherwise, the instances are displayed.

Valid output formats in both cases are CIM object output formats or Table output formats.

In the table output format with instances a column namespace is included if the request defines multiple namespaces and a classname column is included if the displayed instances are from multiple classes.

Note: This command returns the instance references, not the class references. The class references command returns the class references.

The command options are:

  • --assoc-class/--ac CLASSNAME This option passes the CLASSNAME to the server to filter the result set by association class name and subclasses.

  • --role/-r`` PROPERTYNAME This option passes the property name to the server to filter the result set by the association class source end role name.

  • --no-qualifiers/--nq This option passes the flag to the server to not include qualifiers in the returned class(es). The default is to include qualifiers in the classes definitions returned.

  • --include-classorigin/--ico This option passes the include-classorigin flag to the server so the returned class(es) will include the class origin attribute. The default is to not include class origin information.

  • --propertylist/--pl PROPERTYLIST - This option passes the PROPERTYLIST to the server so that only properties in the list are included in the returned object(s). Multiple properties may be specified with either a comma-separated list of property names or by using the option multiple times. Properties specified in this option that are not in the object(s) will be ignored. AN empty string will include no properties. If this option is not set, the server is expected to return all properties.

  • --names-only/-no - This option determines whether the request to return classes or just class names is sent to the server. When set, only the object paths (names) are requested. The default is to return the instances.

  • --namespace/-n NAMESPACE - This option defines the term:Namespace to use for this command, instead of the default namespace of the current connection.

  • --summary/-s - Show only a summary (count) of the objects.

  • --filter-query/--fq QUERY-STRING` - When pull operations are used, the WBEM server filters the instances in the result via a filter query. By default, and when traditional operations are used, no such filtering takes place.

  • --filter-query-language/--fql QUERY-LANGUAGE - The filter query language to be used with --filter-query. Default: DMTF:FQL.

  • --show-null - In the TABLE output formats, show properties with no value (i.e. Null) in all of the instances to be displayed. Otherwise only properties at least one instance has a non- Null property are displayed

  • --object-order - This option modifies the order of the display of instances when there are multiple namespaces displayed to order by classname and then namespace where the normal display order is to order by namespace and then classname

  • --help-instancename/--hi - Show help message for specifying INSTANCENAME including use of the --key and --namespace options because instance name specification on the command line is complex and there are several options to specifying the instance name.

Example:

$ pywbemcli --name mymock instance references root/cimv2:TST_Person.name=\"Saara\"
instance of TST_Lineage {
   InstanceID = "SaaraSofi";
   parent = "/root/cimv2:TST_Person.name=\"Saara\"";
   child = "/root/cimv2:TST_Person.name=\"Sofi\"";
};

See pywbemcli instance references –help for the exact help output of the command.

instance query command

The instance query command executes a query for CIM instances in a namespace.

The command format is:

pywbemcli [GENERAL-OPTIONS] instance query QUERY-STRING [COMMAND-OPTIONS]

The query is specified with the QUERY-STRING argument and must be a valid query in the query language specified with the --query-language/--ql command option. The default for that option is DMTF:CQL (see CQL).

NOTE: FQL is the filter query language and is not a valid query language for the query command

The command options are:

  • --query-language QUERY-LANGUAGE - The query language in which the query is defined. Normally this must be either WQL a Microsoft specified query language (see WQL) or DMTF:CQL (the DMTF specified query language) (see CQL), The default language for this command is WQL. The query language specified must be implemented in the target server. pywbemcli does not validate the query language specified but passes it on to the WBEM server.

  • --namespace/-n NAMESPACE - This option defines the term:Namespace to use for this command, instead of the default namespace of the current connection.

  • --summary / -s - If set, show only summary count of instances returned.

Valid output formats are CIM object output formats or Table output formats.

See pywbemcli instance query –help for the exact help output of the command.

instance shrub command

The instance shrub command executes a set of requests to get the association relationships for a non-association CIM instance defined by INSTANCENAME in a namespace and displays the result either as tree in ASCII or as a table showing the roles, reference classes, associated classes and associated instances for the input instance.

The command format is:

pywbemcli [GENERAL-OPTIONS] instance shrub INSTANCENAME [COMMAND-OPTIONS]

The command has a number of options to allow defining the request parameters for an association the same as the instance associators command. However, this command executes a number of requests on the server to get detailed characteristics of both the properties of the associated class as seen by the references request and of the associations.

A shrub is a structure that attempts to show all of the relationships and the paths between the input INSTANCENAME and the associated instances whereas the References command only shows referencing(associator) classes or instances and the Associators command only shows associated classes or instances.

Valid output formats are Table output formats or the default which displays the a visual tree.

The command options are:

  • --assoc-class/--ac CLASSNAME - This option passes the CLASSNAME to the server to filter the result set by the association class name and its subclasses.

  • --result-class`/–rc``` CLASSNAME - This option passes the CLASSNAME to the server to filter the result set by result class name. Subclasses of the specified class also match.

  • --role/--r PROPERTYNAME - This option defines a reference property property name in the association class. The responses are filtered to match this role and property name.

  • --result-role/--rr PROPERTYNAME - This option defines a reference property name in the association class. The responses are filtered to match this role and property name.

  • --key/-k KEYNAME=VALUE - The value for a key in the keybinding of CIM instance name. May be specified multiple times. This option allows defining keys on the command line without the issues of quotes.

  • --namespace/-n NAMESPACE - This option defines the term:Namespace to use for this command, instead of the default namespace of the current connection.

  • --summary/-s: Show only the class components and a count of instances.

  • --fullpath/-f: Show the full path of the instances. The default is to attempt to shorten the path by removing path components that are the same for all instances displayed. This can be important for some of the components of the model where instance paths include keys like CreationClassName and SystemCreationClassName which are either already known or do not distinguish instances but make the instance name difficult to visualize on the console. These key bindings are replaced with the character ~ as a place-marker unless the --fullpath/-f option is defined.

  • --help-instancename/--hi - Show help message for specifying INSTANCENAME including use of the --key and --namespace options because instance name specification on the command line is complex and there are several options to specifying the instance name.

Thus, a full path might look like:

/:CIM_FCPort.SystemCreationClassName="CIM_ComputerSystem",SystemName="ACME+CF2A5091300089",CreationClassName="CIM_FCPort",DeviceID="ACME+CF2A5091300089+SP_A+10"

But the shortened path would be:

/:CIM_FCPort.~,~,~,DeviceID="ACME+CF2A5091300089+SP_A+10"

This command is primarily a diagnostic and test tool to help users understand what comprises CIM association relationships.

See pywbemcli instance shrub –help for the exact help output of the command.

Example:

$ pywbemcli instance shrub root/cimv2:TST_EP.InstanceID=1

TST_EP.InstanceID=1
 +-- Initiator(Role)
     +-- TST_A3(AssocClass)
         +-- Target(ResultRole)
         |   +-- TST_EP(ResultClass)(3 insts)
         |       +-- TST_EP.InstanceID=2(refinst:0)
         |       +-- TST_EP.InstanceID=5(refinst:1)
         |       +-- TST_EP.InstanceID=7(refinst:2)
         +-- LogicalUnit(ResultRole)
             +-- TST_LD(ResultClass)(3 insts)
                 +-- TST_LD.InstanceID=3(refinst:0)
                 +-- TST_LD.InstanceID=6(refinst:1)
                 +-- TST_LD.InstanceID=8(refinst:2)

This displays the Role (Initiator), AssociationClass (TST_A3), etc. for the instance name defined in the command which is a complex association that contains 3 reference properties. The tag refinst on each instance defines the corresponding reference instance so that the instances returned can be correlated back to their reference instances.

The resulting table output for the same command but with -o table is:

Example:

$ pywbemcli -o table instance shrub root/cimv2:TST_EP.InstanceID=1

Shrub of root/cimv2:TST_EP.InstanceID=1
+-----------+-------------------+--------------+--------------------+-------------------------+
| Role      | Reference Class   | ResultRole   | Associated Class   | Assoc Inst paths        |
|-----------+-------------------+--------------+--------------------+-------------------------|
| Initiator | TST_A3            | Target       | TST_EP             | /:TST_EP.               |
|           |                   |              |                    | InstanceID=2(refinst:0) |
|           |                   |              |                    | /:TST_EP.               |
|           |                   |              |                    | InstanceID=5(refinst:1) |
|           |                   |              |                    | /:TST_EP.               |
|           |                   |              |                    | InstanceID=7(refinst:2) |
| Initiator | TST_A3            | LogicalUnit  | TST_LD             | /:TST_LD.               |
|           |                   |              |                    | InstanceID=3(refinst:0) |
|           |                   |              |                    | /:TST_LD.               |
|           |                   |              |                    | InstanceID=6(refinst:1) |
|           |                   |              |                    | /:TST_LD.               |
|           |                   |              |                    | InstanceID=8(refinst:2) |
+-----------+-------------------+--------------+--------------------+-------------------------+

qualifier command group

The qualifier command group has commands that act on CIM qualifier declarations:

qualifier get command

The qualifier get command gets the specified qualifier declaration.

The command format is:

pywbemcli [GENERAL-OPTIONS] qualifier get QUALIFIERNAME [COMMAND-OPTIONS]

The qualifier declaration is named with the QUALIFIERNAME argument and is in the namespace specified with the -namespace/-n command option, or otherwise in the default namespace of the connection.

The -namespace/-n command option option defines the term:Namespace to use for this command, instead of the default namespace of the current connection. This option accepts single or multiple namespaces and displays the results for the list of namespaces supplied. See :ref: Pywbemcli special command line features for more information on using multiple namespaces

The qualifier declaration is displayed using CIM object output formats or Table output formats.

The following example gets the Key qualifier declaration from the default namespace:

$ pywbemcli --name mymock qualifier get Key
Qualifier Key : boolean = false,
    Scope(property, reference),
    Flavor(DisableOverride, ToSubclass);

See pywbemcli qualifier get –help for the exact help output of the command.

qualifier delete command

The qualifier delete command deletes the specified qualifier declaration.

The command format is:

pywbemcli [GENERAL-OPTIONS] qualifier delete QUALIFIERNAME [COMMAND-OPTIONS]

The qualifier declaration is named with the QUALIFIERNAME argument and is in the namespace specified with the -namespace/-n command option, or otherwise in the default namespace of the connection.

The qualifier declaration is deleted using the DeleteQualifier operation. It is left to the WBEM server to reject the deletion if the qualifier is used anywhere.

The following example deletes the Xyz qualifier declaration from the default namespace:

$ pywbemcli --name mymock qualifier delete Xyz
Deleted qualifier Xyz

See pywbemcli qualifier delete –help for the exact help output of the command.

qualifier enumerate command

The qualifier enumerate command enumerates the qualifier declarations in a namespace.

The command format is:

pywbemcli [GENERAL-OPTIONS] qualifier enumerate [COMMAND-OPTIONS]

The namespace is specified with the -namespace/-n command option, or otherwise is the default namespace of the connection.

The -namespace/-n command option option defines the term:Namespace to use for this command, instead of the default namespace of the current connection. This option accepts single or multiple namespaces and displays the results for the list of namespaces supplied. See :ref: Pywbemcli special command line features for more information on using multiple namespaces

The qualifier declaration is displayed using CIM object output formats or Table output formats.

This example displays all of the qualifier declarations in the default namespace as a table:

$ pywbemcli --name mymock --output-format table qualifier enumerate
Qualifier Declarations
+-------------+---------+---------+---------+-------------+-----------------+
| Name        | Type    | Value   | Array   | Scopes      | Flavors         |
|-------------+---------+---------+---------+-------------+-----------------|
| Association | boolean | False   | False   | ASSOCIATION | DisableOverride |
|             |         |         |         |             | ToSubclass      |
| Description | string  |         | False   | ANY         | EnableOverride  |
|             |         |         |         |             | ToSubclass      |
|             |         |         |         |             | Translatable    |
| In          | boolean | True    | False   | PARAMETER   | DisableOverride |
|             |         |         |         |             | ToSubclass      |
| Key         | boolean | False   | False   | PROPERTY    | DisableOverride |
|             |         |         |         | REFERENCE   | ToSubclass      |
| Out         | boolean | False   | False   | PARAMETER   | DisableOverride |
|             |         |         |         |             | ToSubclass      |
+-------------+---------+---------+---------+-------------+-----------------+

See pywbemcli qualifier enumerate –help for the exact help output of the command.

profile command group

Profile list command

The profile list command lists the management profiles advertised by the WBEM server of the current connection.

The command format is:

pywbemcli [GENERAL-OPTIONS] profile list [COMMAND-OPTIONS]

The returned management profiles are displayed with organization, profile name, and profile version using the Table output formats.

  • The --organization/-o and --profile/ -p command options can be used to filter the returned management profiles by organization and profile name, respectively.

The command options are:

  • --organization/-o ORGANIZATION_NAME Filter the returned management profiles by the organization name ex. DMTF.

  • --profile/-p PROFILE-NAME Filter the returned management profiles by the profile name. (ex. -p Array)

Example:

$ pywbemcli --name myserver --output-format simple profile list
Advertised management profiles:
Organization    Registered Name           Version
--------------  ------------------------  ---------
DMTF            CPU                       1.0.0
DMTF            Computer System           1.0.0
DMTF            Ethernet Port             1.0.0
DMTF            Fan                       1.0.0
DMTF            Indications               1.1.0
DMTF            Profile Registration      1.0.0
Other           Some Other Subprofile     0.1.0
Other           Some Subprofile           0.1.0
Other           SomeSystemProfile         0.1.0
SNIA            Array                     1.1.0
SNIA            Block Server Performance  1.1.0
SNIA            Disk Drive Lite           1.1.0
SNIA            Indication                1.1.0
SNIA            Indication                1.2.0
SNIA            Profile Registration      1.0.0
SNIA            SMI-S                     1.2.0
SNIA            Server                    1.1.0
SNIA            Server                    1.2.0
SNIA            Software                  1.1.0
SNIA            Software                  1.2.0

See pywbemcli profile list –help for the exact help output of the command.

profile centralinsts command

The profile centralinsts command gets the central instances of the management profiles advertised by the WBEM server of the current connection.

The format of the command is:

pywbemcli [GENERAL-OPTIONS] profile centralinsts [COMMAND-OPTIONS]

The command displays the instance paths of the central instances by profile, using the Table output formats.

The --organization/-o and --profile/ -p command options can be used to filter the result by organization and name of the management profiles, respectively.

Example:

$ pywbemcli profile centralinsts --organization DMTF --profile "Computer System"
Advertised Central Instances:
+---------------------------------+----------------------------------------------------------------------------------------------------------------------+
| Profile                         | Central Instances                                                                                                    |
|---------------------------------+----------------------------------------------------------------------------------------------------------------------|
| DMTF:Computer System:1.0.0      | //leonard/test/TestProvider:Test_StorageSystem.Name="StorageSystemInstance1",CreationClassName="Test_StorageSystem"  |
|                                 | //leonard/test/TestProvider:Test_StorageSystem.Name="StorageSystemInstance2",CreationClassName="Test_StorageSystem"  |
+---------------------------------+----------------------------------------------------------------------------------------------------------------------+

See pywbemcli profile centralinsts –help for the exact help output of the command.

server command group

The server command group has commands that interact with the WBEM server of the current connection to access information about the WBEM server itself:

server brand command

The server brand command gets the brand of the WBEM server of the current connection.

The format of the command is:

pywbemcli [GENERAL-OPTIONS] server brand [COMMAND-OPTIONS]

The brand is intended to identify the product that represents the WBEM server infrastructure. Since that was not clearly defined in the DMTF specifications, this command may return strange results for some servers, but it returns legitimate results for the most commonly used servers.

The brand is displayed using Table output formats.

Example:

$ pywbemcli --name myserver server brand
Server Brand:
+---------------------+
| WBEM server brand   |
|---------------------|
| OpenPegasus         |
+---------------------+

See pywbemcli server brand –help for the exact help output of the command.

server info command

The server info command gets general information on the WBEM server of the current connection.

The format of the command is:

pywbemcli [GENERAL-OPTIONS] server info [COMMAND-OPTIONS]

This includes the brand, version, namespaces, and other reasonable information on the WBEM server.

The result is displayed using Table output formats.

Example:

$ pywbemcli --name myserver server info
Server General Information
+-------------+-----------+---------------------+-------------------------------+
| Brand       | Version   | Interop Namespace   | Namespaces                    |
|-------------+-----------+---------------------+-------------------------------|
| OpenPegasus | 2.15.0    | root/PG_InterOp     | root/PG_InterOp               |
|             |           |                     | root/benchmark                |
|             |           |                     | root/SampleProvider           |
|             |           |                     | test/CimsubTestNS2            |
|             |           |                     | test/CimsubTestNS3            |
|             |           |                     | test/CimsubTestNS0            |
|             |           |                     | test/CimsubTestNS1            |
|             |           |                     | root/PG_Internal              |
|             |           |                     | test/WsmTest                  |
|             |           |                     | test/TestIndSrcNS1            |
|             |           |                     | test/TestINdSrcNS2            |
|             |           |                     | test/EmbeddedInstance/Static  |
|             |           |                     | test/TestProvider             |
|             |           |                     | test/EmbeddedInstance/Dynamic |
|             |           |                     | root/cimv2                    |
|             |           |                     | root                          |
|             |           |                     | test/cimv2                    |
|             |           |                     | test/static                   |
+-------------+-----------+---------------------+-------------------------------+

See pywbemcli server info –help for the exact help output of the command.

server add-mof command

Compiles MOF and adds/updates CIM objects in the WBEM server.

The format of the command is:

pywbemcli [GENERAL-OPTIONS] server add-mof [COMMAND-OPTIONS]

The server add-mof command compiles one or more MOF files and adds the resulting CIM objects to the target namespace in the WBEM server of the current connection.

The command options are:

  • --namespace/-n NAMESPACE This option defines the term:Namespace to use for this command, instead of the default namespace of the current connection.

  • --include/-I INCLUDEDIR PATH the path name of a MOF include directory. This option may be specified multiple times.

  • --dry-run/-d Enable dry-run mode: Don’t actually modify the server. The onnection to the WBEM server is still required for reading information required to execute the compile from the server.

Example:

$ pywbemcli --name myserver server add-mof mymodel.mof

See pywbemcli server add-mof –help for the exact help output of the command.

server remove-mof command

Compile the MOF defined by the command option and remove the resulting objects from the server.

The format of the command is:

pywbemcli [GENERAL-OPTIONS] server remove-mof [COMMAND-OPTIONS]

The server remove-mof command compiles one or more MOF files and removes the resulting CIM objects from the target namespace in the WBEM server of the current connection.

The command options are:

  • --namespace/-n NAMESPACE The namespace to use for this command, instead of the default namespace of the connection.

  • --include/-I INCLUDEDIR PATH the path name of a MOF include directory. This option may be specified multiple times.

  • --dry-run/-d Enable dry-run mode: Don’t actually modify the server. The connection to the WBEM server is still required for reading information required to execute the compile from the server.

Example:

$ pywbemcli --name myserver server remove-mof mymodel.mof

See pywbemcli server remove-mof –help for the exact help output of the command.

server schema command

The server schema command returns information on the schemas in the namespace(s) of the current connection WBEM server.

The format of the command is:

pywbemcli [GENERAL-OPTIONS] server schema [COMMAND-OPTIONS]

The overview reports a summary by namespace of this information and the detail view (server schema --detail) reports the information for each schema in the namespace.

For each schema in each namespace, the report provides information on the CIM Schema version (maximum qualifier ‘Version’ for classes in that schema), whether the schemas have experimental classes, and the number of classes in each schema and CIM Schema.

Pywbemcli determines the version of the CIM Schema by finding the highest value of the Version qualifier on any of the classes in the namespace that are in that schema

There are two report outputs possible:

  • Detail report (--detail option) displays information on the number of classes, maximum version for each schema in each or the selected namespace, and whether the schema includes any experimental classes.

  • The overview output (without --detail command option) displays information on the number of classes, the CIM Schema and whether there are experimental classes in each or the selected namespace. For the CIM Schema in the overview report the highest value is determined by finding the highest ‘Version’ qualifier value for each schemas in the CIM schema (normally CIM, or PRS).

Example:

$ pywbemcli --name myserver server schema

Schema information; namespaces: all;
Namespace                      Schemas              classes  CIM schema    experimental
                                                      count  version
-----------------------------  -----------------  ---------  -------------  --------------
root                                                      0
root/PG_InterOp                CIM, PG                  276  2.40.0
root/benchmark                 CIM, (no-schema)         206  2.40.0
root/cimv2                     CIM, PG, PRS            1463  2.41.0         Experimental

The above report would indicate that the namespace root/cimv2 was probably created with DMTF released CIM Schema version 2.41.0. Other namespaces show a lower level of version because they are not using any of the classes that have the Version qualifier value of 2.41.0.

or a more detailed report (--detail option):

$ pywbemcli --name myserver server schema --detail

Namespace                      Schemas              classes  schema     experimental
                                                      count  version
-----------------------------  -----------------  ---------  ---------  --------------
root/PG_InterOp                CIM                      241  2.40.0
                               PG                        35  2.12.0
root/benchmark                 CIM                      177  2.40.0
                               (no-schema)               29  1.0.0
root/cimv2                     CIM                     1382  2.41.0     Experimental
                               PG                        20  2.12.0

This report tells more about each schema in that it reports that there are classes in the root/cimv2 namespace ‘CIM’ schema that are experimental indicating that the CIM Schema used was the Version 2.41.0, experimental CIM Schema.

See pywbemcli server remove-mof –help for the exact help output of the command.

statistics command group

The statistics command group includes commands that display statistics about the WBEM operations executed by a real WBEM server (or by a mock environment).

Statistics on WBEM operations are maintained by the pywbemcli client, and also separately by WBEM servers that support this. There are multiple components to statistics gathering and reporting in pywbemcli:

  1. Pywbemcli gathers and maintains statistics on WBEM operations it executes against a WBEM server (or mock environment). The client maintained statistics can be displayed either automatically after each pywbemcli command if the --timestats / -T general option is used, or in interactive mode with the statistics show command.

    For mock environments, artificial operations on the MOF compile time needed for setting up the mock respository are included in the client maintained statistics.

  2. WBEM servers may support two capabilities for managing statistics on WBEM operations:

    1. Each CIM-XML response from the WBEM server may include an extra header field WBEMServerResponseTime with the server response time for that operation. Pywbemcli puts those server response times into the client statistics it maintains. The inclusion of the server response time into the CIM-XML response can be enabled and disabled with the statistics server-on and statistics server-off commands.

    2. Statistical information on operation execution in the WBEM server and its providers may be gathered and maintained and by the WBEM server. These server maintained statistics are completely independent of the client maintained statistics and will include the operations driven by all clients working with that server. The gathering of server statistics can be enabled and disabled with the statistics server-on and statistics server-off commands. The server maintained statistics can be retrieved and displayed with the statistics server-show command.

    The mock environment implemented by pywbemcli does not support server maintained statistics.

    The capabilities for managing and retrieving server maintained statistics is supported only in some WBEM server implementations. While these capabilities were documented in the CIM Schema, they were never included as part of a DMTF or SNIA management profile, so the implementations may vary across WBEM server implementations. Pywbemcli makes a best effort to interact with the server maintained statistics based on the documentation in the CIM Schema, and has been verified to work with OpenPegasus.

The statistics commands are:

statistics server-on command

The statistics server-on command attempts to enable statistics gathering on the current WBEM server and the returning of the server response time in the WBEMServerResponseTime header field of the CIM-XML response, by setting the GatherStatisticalData property to True in the CIM_ObjectManager instance for the WBEM server.

See ‘_Operation statistics’_ for more information on statistics in pywbemcli and WBEM servers.

Since only some WBEM server implementations actually implement statistics gathering, the command may fail, for example if the CIM_ObjectManager class or its property GatherStatisticalData have not been implemented by the server, or if the server does not allow a client to modify the property.

Note that this command also affects whether the Server Time column of the client maintained statistics shows a value.

statistics server-off command

The statistics server-off command attempts to disable statistics gathering on the current WBEM server and the returning of the server response time in the WBEMServerResponseTime header field of the CIM-XML response, by setting the GatherStatisticalData property to False in the CIM_ObjectManager instance for the WBEM server.

See ‘_Operation statistics’_ for more information on statistics in pywbemcli and WBEM servers.

Since only some WBEM server implementations actually implement statistics gathering, the command may fail, for example if the ‘CIM_ObjectManager’ class or its property ‘GatherStatisticalData’ have not been implemented by the server, or if the server does not allow a client to modify the property.

Note that this command also affects whether the Server Time column of the client maintained statistics shows a value.

statistics status command

The statistics status command displays the enabled status of the statistic gathering in the current WBEM server and of the automatic display of the client maintained statistics.

See ‘_Operation statistics’_ for more information on statistics in pywbemcli and WBEM servers.

statistics reset command

The statistics reset command resets the counters of the client-maintained statistics. This includes the server response times returned by the WBEM server that are part of the client maintained statistics.

statistics show command

The statistics show command displays the client maintained statistics.

Using this command only makes sense in interactive mode. In interactive mode, the statistics is maintained for the entire interactive session, and executing commands that communicate with the server in the interactive session causes the statistics counters to be updated.

The following example shows the use of the statistics show command in the interactive mode with a real WBEM server:

$ pywbemcli -n pegasus

pywbemcli> server brand
OpenPegasus

pywbemcli> statistics show
Client statistics
Operation                 Count    Errors    Client Time    Server Time    Request Size    Response Size
                                                    [ms]           [ms]             [B]              [B]
----------------------  -------  --------  -------------  -------------  --------------  ---------------
EnumerateInstanceNames        2         1         33.174          1.407             333             6225
EnumerateInstances            1         0          7.938          2.813             345             3504

The following example shows the use of the statistics show command in the interactive mode with a mock environment:

$ pywbemcli -n mock1

pywbemcli> class enumerate --di --no
CIM_Foo
CIM_Foo_sub
CIM_Foo_sub2
CIM_Foo_sub_sub

pywbemcli> statistics show
Client statistics
Operation                    Count    Errors    Client Time    Server Time    Request Size    Response Size
                                                       [ms]           [ms]             [B]              [B]
-------------------------  -------  --------  -------------  -------------  --------------  ---------------
compile_mof_file(ns=None)        1         0        149.862              0               0                0
CreateClass                      4         0          4.075              0               0                0
CreateInstance                  12         0          1.715              0               0                0
EnumerateClassNames              1         0          0.167              0               0                0
SetQualifier                    10         0          0.139              0               0                0

The Operation column shows the name of the WBEM operation, plus the following additional entries:

  • compile_mof_file(ns=None)

The Count column shows the number of operations executed.

The Errors column shows the number of cases where the operation has resulted in an error at the level of the CIM-XML protocol. The occurrence of such errors is not necessarily a problem, depending on the logic in the pywbemcli client program.

All time and size values in this report are average values across the number of operations executed, rounded to the precision shown.

The Client Time column shows the total elapsed time the operation took from a perspective of the pywbemcli client program. This time includes network time and server time and most of the time spent in the pywbemcli command. More specifically, the client time is measured by the statistics support of the pywbem library directly after the API for executing an operation, so it does include the creation of the CIM-XML for the request and the parsing of the CIM-XML for the response, but it does not include any processing in the code of the pywbemcli command above the pywbem API.

The Server Time column shows the total elapsed time the operation took from a perspective of the WBEM server. It has the same meaning as the Server Time value shown in the server statistics. This time includes time spent in the CIM object manager code and time spent in its providers. The Server Time is obtained from the header field WBEMServerResponseTime in the CIM-XML response message; if the WBEM server does not support returning this field or has it disabled, the Server Time is shown as 0. That is why the Server Time values for the mock environment example are shown as 0.

The Request Size and Response Size columns show the size of the HTTP bodies of the CIM-XML request and response messages, respectively. These values do not include the size of the HTTP header fields.

statistics server-show command

The statistics server-show command displays the server maintained statistics of the current WBEM server. What is returned depends on the implementation of statistics gathering in the WBEM server.

This command does that by retrieving “CIM_CIMOMStatisticalData” instances associated from the “CIM_ObjectManager” instance representing the WBEM server, and organizing them into a server statistics report.

The format of the server statistics report of a real WBEM server is shown in the example below:

$ pywbemcli -s http://localhost statistics server-show

Server statistics
Operation                 Count    Server Time    Provider Time    Request Size    Response Size
                                          [ms]             [ms]             [B]              [B]
----------------------  -------  -------------  ---------------  --------------  ---------------
GetClass                    315          0.239            0                 399             4124
GetInstance                   4          0.495            0.07              862             3128
ModifyInstance                4          0.795            0.024            3523              376
EnumerateInstances          172          1.459            0.341             383            10111
EnumerateInstanceNames      132          0.913            0.657             377             4102
OpenEnumerateInstances      156          1.986            0                 616            14506

The Operation column shows the name of the WBEM operation.

The Count column shows the number of operations executed.

All time and size values in this report are average values across the number of operations executed, rounded to the precision shown.

The Server Time column shows the total elapsed time the operation took from a perspective of the WBEM server. It has the same meaning as the Server Time value shown in the client statistics. This time includes time spent in the CIM object manager code and time spent in any providers.

The Provider Time column shows the total elapsed time the operation spent in the provider from a perspective of the CIM object manager portion of the WBEM server that calls the provider. OpenPegasus only reports values for instance providers and reports the values for class and qualifier operations as 0. Other WBEM servers would typically also do that. The provider time includes the time spent for performing any actions in the managed system and also the time spent in any “up-calls” from the provider back to the CIM object manager portion of the WBEM server (and possibly down to other providers).

The Request Size and Response Size columns show the size of the CIM-XML request and response messages, respectively. For OpenPegasus and WBEM servers that followed the description in CIM_CIMOMStatisticalData.mof, these values include the size of the HTTP bodies and the size of the HTTP header fields.

Note that statistics gathering in WBEM servers is not standardized in WBEM management profiles, so the statements above are based on typical implementations of WBEM servers such as the implementation of OpenPegasus.

connection command group

The connection command group includes commands that manage named connection definitions that are persisted in a connections file. This allows maintaining multiple connection connection definitionss and then using any one via the --name general option. Only a single connection is active (selected) at any point in time but the connection connection can be selected on the pywbemcli command line (--name general option) or changed within an interactive session using the connection select command.

The attributes of each connection definition in the connections file are:

The commands in this group are:

connection delete command

The connection delete command deletes a connection definition from the connections file.

The format of this command is:

pywbemcli [GENERAL-OPTIONS] connection delete NAME [COMMAND-OPTIONS]

If the NAME argument is specified, the connection definition with that name is deleted. Otherwise, the command displays the list of connection definitions and prompts the user to select the one to be deleted. If there is only a single connection, that connection is deleted without the user selection request.

Example that deletes a connection definition by the specified name:

$ pywbemcli connection delete mytestconnection

Example that deletes a connection definition by selecting it:

$ pywbemcli connection delete
Select a connection or Ctrl_C to abort.
0: mock1
1: mockassoc
2: op
Input integer between 0 and 2 or Ctrl-C to exit selection: 1   << entered by user
Deleted connection "mockassoc".

See pywbemcli connection delete –help for the exact help output of the command.

connection export command

The connection export command exports the current connection as a set of environment variables.

The format of this command is:

pywbemcli [GENERAL-OPTIONS] connection export [COMMAND-OPTIONS]

This is done by displaying the commands to set the environment variables to stdout.

$ pywbemcli --server http://localhost connection export
export PYWBEMCLI_SERVER=http://localhost
export PYWBEMCLI_DEFAULT_NAMESPACE=root/cimv2
export PYWBEMCLI_TIMEOUT=30
. . .

This can be used for example on Linux and OS-X to set the environment variables as follows:

$ eval $(pywbemcli --server http://localhost connection export)

$ env |grep PYWBEMCLI
PYWBEMCLI_SERVER=http://localhost
PYWBEMCLI_DEFAULT_NAMESPACE=root/cimv2
PYWBEMCLI_TIMEOUT=30
. . .

See pywbemcli connection export –help for the exact help output of the command.

connection list command

The connection list command lists the connection definition definitions in the connections file and the current connection (if it has not been saved to the connections file).

The format of this command is:

pywbemcli [GENERAL-OPTIONS] connection list [COMMAND-OPTIONS]

Valid output formats are Table output formats.

This shows which connection is the current connection and if any connection is set as the default connection (connection select command ).

The current connection is marked with * in the Name column. The default connection, if defined, is marked with # in the Name column.

The title also displays the path of the file that is being used as the current connections file.

pywbemcli> --server http://localhost --user me --password mypw --no-verify connection save me

pywbemcli> --server http://blahblah connection list
WBEM server connections(brief):  (#: default, *: current)
file: /home/johndoe/.pywbemcli_connections.yaml
+--------------+------------------+----------------------------------------+
| name         | server           | mock-server                            |
|--------------+------------------+----------------------------------------|
| *blahblah    | http://blah      |                                        |
| mock1        |                  | tests/unit/simple_mock_model.mof       |
| mockalltypes |                  | tests/unit/all_types.mof               |
| mockassoc    |                  | tests/unit/simple_assoc_mock_model.mof |
| mockext      |                  | tests/unit/simple_mock_model_ext.mof   |
| op           | http://localhost |                                        |
| test3        |                  | tests/unit/simple_mock_model.mof       |
|              |                  | tests/unit/mock_confirm_y.py           |
+--------------+------------------+----------------------------------------+

A more complete display of the server parameters is available with the --full option as follows:

pywbemcli> connection list --full

WBEM server connections(full): (#: default, *: current)
+--------------+----------------------+------------------------+-------------+-----------+------------+----------+------------+-----------+--------------------------------------------------+
| name         | server               | namespace              | user        |   timeout | use_pull   | verify   | certfile   | keyfile   | mock-server                                      |
+==============+======================+========================+=============+===========+============+==========+============+===========+==================================================+
| #mockassoc   |                      | root/cimv2             |             |        30 |            | True     |            |           | tests/unit/simple_assoc_mock_model.mof           |
+--------------+----------------------+------------------------+-------------+-----------+------------+----------+------------+-----------+--------------------------------------------------+
| alltypes     |                      | root/cimv2             |             |        30 |            | True     |            |           | tests/unit/all_types.mof                         |
+--------------+----------------------+------------------------+-------------+-----------+------------+----------+------------+-----------+--------------------------------------------------+
| complexassoc |                      | root/cimv2             |             |        30 |            | True     |            |           | tests/unit/complex_assoc_model.mof               |
+--------------+----------------------+------------------------+-------------+-----------+------------+----------+------------+-----------+--------------------------------------------------+
| mock1        |                      | root/cimv2             |             |        30 |            | True     |            |           | tests/unit/simple_mock_model.mof                 |
+--------------+----------------------+------------------------+-------------+-----------+------------+----------+------------+-----------+--------------------------------------------------+
| mock1ext     |                      | root/cimv2             |             |        30 |            | True     |            |           | tests/unit/simple_mock_model_ext.mof             |
+--------------+----------------------+------------------------+-------------+-----------+------------+----------+------------+-----------+--------------------------------------------------+
| mock1interop |                      | interop                |             |        30 |            | True     |            |           | tests/unit/simple_mock_model.mof                 |
+--------------+----------------------+------------------------+-------------+-----------+------------+----------+------------+-----------+--------------------------------------------------+
| ophttp       | http://localhost     | root/cimv2             |             |        30 |            | True     |            |           |                                                  |
+--------------+----------------------+------------------------+-------------+-----------+------------+----------+------------+-----------+--------------------------------------------------+
| ophttps      | https://localhost    | root/cimv2             | blahblah    |        30 |            | False    |            |           |                                                  |
+--------------+----------------------+------------------------+-------------+-----------+------------+----------+------------+-----------+--------------------------------------------------+
| opt          | https://blah         | root/cimv2             |             |        45 |            | False    | c1.pem     | k1.pem    |                                                  |
+--------------+----------------------+------------------------+-------------+-----------+------------+----------+------------+-----------+--------------------------------------------------+
| test1        |                      | root/cimv2             |             |        30 |            | True     |            |           | tests/unit/simple_assoc_mock_model.mof           |
+--------------+----------------------+------------------------+-------------+-----------+------------+----------+------------+-----------+--------------------------------------------------+

Connection list does not display some fields such as the ca-certs field. See connection show command for more detailed display of individual fields used by the server.

See pywbemcli connection list –help for the exact help output of the command.

connection save command

The connection save command saves the current connection in the connections file as a named connection with the name specified in the NAME argument.

The format is:

pywbemcli [GENERAL-OPTIONS] connection save NAME [COMMAND-OPTIONS]

If a connection definition with that NAME already exists, it will be overwritten without notice.

This command includes an option (set-default) that sets the default connection of the current connections file to the name of the definition being saved. Once the default connection is set, that be comes the connection if pywbemcli is executed with no options for defining the server.

A new connection MYCONN can be created with the following command:

$ pywbemcli --server http://blah connection save MYCONN

A connection can be created, saved and set as the default connection with:

$ pywbemcli --server http://blah connection save MYCONN --set-default

See pywbemcli connection save –help for the exact help output of the command.

connection select command

The connection select command selects a named connection from the current connections file to become the current connection.

The command format is:

pywbemcli [GENERAL-OPTIONS] connection select NAME [COMMAND-OPTIONS]

If the NAME argument is specified, the connection definition with that name is selected. Otherwise, pywbemcli displays the list of names of connection definition entries from the connections file and prompts the user to pick one to be selected. If there is only a single connection, that connection is selected without the user request.

If the --default/-d command option is set, the connection definition in addition becomes the default connection, by marking it accordingly in the connections file.

The following example shows changing connection from within the interactive mode of pywbemcli:

$ pywbemcli

pywbemcli> connection select
Select a connection or Ctrl_C to abort.
0: mock1
1: mockassoc
2: op
Input integer between 0 and 2 or Ctrl-C to exit selection: 1   << entered by user

pywbemcli> connection list
WBEMServer Connections:   (#: default, *: current)
+------------+------------------+-------------+-------------+-----------+------------+-----------------------------------------+
| name       | server           | namespace   | user        |   timeout | verify     | mock-server                             |
|------------+------------------+-------------+-------------+-----------+------------+-----------------------------------------|
| #mock1     |                  | root/cimv2  |             |        30 | False      | tests/unit/simple_mock_model.mof        |
| *mockassoc |                  | root/cimv2  |             |        30 | False      | tests/unit/simple_assoc_mock_model.mof  |
| op         | http://localhost | root/cimv2  | me          |        30 | True       |                                         |
+------------+------------------+-------------+-------------+-----------+------------+-----------------------------------------+

pywbemcli> connection show
name: mockassoc
  server: None
  default-namespace: root/cimv2
  user: None
  password: None
  timeout: 30
  no-verify: False
  certfile: None
  keyfile: None
  use-pull: either
  pull-max-cnt: 1000
  mock-server: tests/unit/simple_assoc_mock_model.mof
  log: None

See pywbemcli connection select –help for the exact help output of the command.

connection show command

The connection show command shows information about a connection definition:

The command format is:

pywbemcli [GENERAL-OPTIONS] connection show NAME [COMMAND-OPTIONS]

  • If NAME is ?, pywbemcli prompts the user to select one and shows the existing current connection. If there is only a single connection the user selection is bypassed.

  • If NAME is specified, show the connection definition with that name.

  • If NAME is not specified, show the existing current connection.

$ pywbemcli -s http://blah connection show
name: not-saved (current)
  server: http://blah
  default-namespace: root/cimv2
  user: None
  password: None
  timeout: 30
  verify: True
  certfile: None
  keyfile: None
  mock-server:
  ca-certs: None

See pywbemcli connection show –help for the exact help output of the command.

connection test command

The connection test command executes a single predefined WBEM operation on the current connection to verify that accessing the WBEM server works.

The command format is:

pywbemcli [GENERAL-OPTIONS] connection test [COMMAND-OPTIONS]

The predefined operation is EnumerateClasses which attempts to enumerate the classes in the default namespace of the WBEM Server. Even if the server does not support the classes operations, this command should return a CIMError indicating that WBEM is supported (ex. CIM_ERR_NOT_SUPPORTED) indicating that WBEM is supported by the server.

If the --test-pull command option is included, pywbemcli will issue an instances request for each of the DMTF defined pull operations and report the results. This could be important because the pull operations are defined as optional and some servers may not include them or all of them.

If the server accepts the request, a simple text OK <server url will be returned.

The following example defines the connection with --server general option, --user, and --password and executes the test with successful result:

$ pywbemcli --server http://localhost --user me --password mypw connection test
Connection successful

See pywbemcli connection test –help for the exact help output of the command.

connection set-default command

The connection set-default command sets or clears the default-connection-name attribute in the currently specified connections file.

The command format is:

pywbemcli [GENERAL-OPTIONS] connection set-default NAME [COMMAND-OPTIONS]

The default-connection-name attribute in the connection file allows a named connection in a connections file to be loaded on startup without using the --name general option. If pywbemcli is started without --name general option, --server general option, or --mock-server general option, the default-connection-name attribute is retrieved from the connections file if defined, and the value of this attribute used as the name of the connection definition set as current connection.

Thus, for example, if the default connection definition is mytests the connection definition for mytests is created each time pywbemcli is started with no --server general option, --mock-server general option or the --name general option.

This command also allows clearing the value of the default connections file attribute with the --clear option.

The following demonstrates displaying the connection information for the current default connection mytests.

$ pywbemcli connection show

name: mytests (current, default)
  server: http://blah
  default-namespace: root/cimv2
  user: None
  password: None
  timeout: 30
  verify: True
  certfile: None
  keyfile: None
  mock-server:
  ca-certs: None

$ pywbemcli connection set-default --clear
  Connection default name cleared replacing None

$ pywbemcli connection show
  Error: No connection defined

$ pywbemcli connection set-default mytests
   'mytests' set as default connection

$ pywbemcli connection show
WBEM server connections(brief): (#: default, *: current)

file: tmp.yaml
name       server           mock-server
---------  ---------------  -------------
*#mytests  http://blah
blahblah   http://blahblah

The current status of the default-connection-name can be viewed with the connection show command and connection list command.

See pywbemcli connection set-default –help for the exact help output of the command.

subscription command group

The DMTF specification DMTF Indication Profile DSP0004 defines the capability for WBEM servers to generate indications (asynchronous notifications based on events that occur in the WBEM server managed environment) and for the indications to be generated to be defined by CIM indication subscriptions which may be created by WBEM clients.

A CIM indication subscription consists of instances of 3 separate classes:

1. CIM_IndicationFilter (filter/indication filter) - Defines an indication filter (using a query language) that defines the characteristics of indications to be sent to a listener destination.

2. CIM_ListenerDestination (destination/listener destination) - Defines a listener destination (a URL) for indications exported from a WBEM server. Pywbem and pywbemcli use the subclass CIM_ListenerDestinationCIMXML specifically because that class uses the protocol supported by pywbemcli and the Pywbemlistener command.

3. CIM_IndicationSubscription (subscription/indication subscription) - A CIM association class that relates an indication filter definition (Filter reference property) and a listener destination (Handler reference property) to link the definition of the indication to be generated and the listener destination for the indication.

An indication subscription defines for a WBEM server the target WBEM listener destination instance for indications to be generated based on the Query and QueryLanguage properties defined in the filter instance; an indication subscription relates a WBEM listener destination with the definition of the indications that will be generated. When a WBEM server receives a valid indication subscription it is expected to activate the functionality to generate and send indications defined by that subscription.

Pywbemcli provides commands that allow creating, displaying, and removing the components of CIM indication subscriptions from WBEM servers. In conjunction with pywbemtools Pywbemlistener command, a user can create indication subscriptions on a WBEM server and view indications generated by that WBEM server.

The subscription command group has commands that act on the CIM indication classes on a WBEM server including:

Pywbemtools groups indication subscription instances with an ownership concept where the instances of filters, destinations, and subscriptions can be either owned by the pywbemtools client or permanent.

All of the instances of indication destination, indication filter and indication subscriptions are created by pywbemcli are created in the WBEM server Interop namespace.

While the definition of indication subscriptions created by pywbemcli is based on the DMTF Indication Profile DSP1054 there are a number of limitations in the pywbem implementation including:

  • It does not provide direct access to any of the Indication Service or Indication capability functionality such as CIM_IndicationService.

  • It requires some properties in the instances that some of the options of DSP0004 consider optional including the destination URL property and the filter Query property. Thus pywbemcli does not implement what the specification calls free listener destinations where the Destination property is left empty when the destination is created in the WBEM server.

  • pywbemcli creates instances of CIM_ListenerDestinationCIMXML rather than CIM_ListenerDestination because pywbemcli is tied to the CIMXML protocol.

  • pywbemcli subscription does not provide a command to modify an existing destination, filter, or subscription instance. That must be done using the instance command group.

  • pywbemcli subscription always uses the CIM classes to create the listener destination, indication filter, and indication subscription and does not provide for using subclasses (ex. vendor specific subclasses) for creating instances subclasses.

  • pywbemcli does not support FilterCollections which uses the CIM_FilterCollectionSubscription class.

Owned destinations, filters, and subscriptions

Owned CIM instances are created with the subscription add-destination command, subscription add-filter command, and subscription add-subscription command and their life cycle is bound to the life cycle of the registration of a WBEM server with pywbemcli.

Pywbemcli registers a WBEM Server with the registration manager the first time a subscription command is executed if a WBEM server is currently defined with the --name general option, --server general option or the --mock-server general option. Thus the command:

$ pywbemcli -s http://myserver subscription add-destination -l http://localhost:50000

# will register the server http://myserver with the pywbemcli subscription
# manager and that server will remain registered until specifically unregistered.

The server remains registered until specifically unregistered with the Subscription remove-server command. Owned CIM instances are deleted automatically when their WBEM server is deregistered from pywbemcli. See Subscription remove-server command or by command with subscription remove-destination command, subscription remove-filter command, subscription remove-subscription command.

Having a server registered does not change the requirement to identify the server each time pywbemcli is started, it simply automates the process of syncing the owned subscription in the WBEM server with pywbemcli.

Owned instances provide a mechanism where the life cycle of indication subscriptions can be easily controlled by the pywbemcli client.

Owned instances are identified by pywbemcli using a specific string pattern in the instance Name property.

Permanent destinations, filters, and subscriptions

Permanent CIM instances are created by the subscription add-destination command, subscription add-filter command, and subscription add-subscription command with the command option --permanent and their life cycle is independent of the life cycle of the registration of that WBEM server with the subscription manager.

Permanent CIM instances are not deleted automatically when their WBEM server is deregistered from pywbemcli. The user is responsible for their lifetime management: They can be deleted by the commands subscription remove-destination command, subscription remove-filter command, subscription remove-subscription command with the option --permanent.

Permanent CIM instances should be used in cases where the user needs to have control over the destination or filter Name property (e.g. because a DMTF management profile requires a particular name).

Static destinations and filters

Static CIM instances pre-exist in the WBEM server and cannot be deleted (or created) by a WBEM client.

However, since there is no external difference between permanent and static instances, they appear to pywbemcli as permanent instances.

Ownership rules

When a client creates a subscription between a filter and a listener destination, the types of ownership of these three CIM instances may be arbitrarily mixed, with one exception:

  • A permanent subscription cannot be created on an owned filter or an owned listener destination. Allowing that would prevent the automatic life cycle management of the owned filter or listener destination by the subscription manager. This restriction is enforced by the WBEMSubscriptionManager class.

Pywbemcli remembers owned subscriptions, filters, and listener destinations between commands in both command line and interactive mode. It does this by recovering instances from the current WBEM server whenever the pywbem SubscriptionManager object is created by a pywbemcli subscription command.

Each command command execution in command mode discovers owned subscriptions, filters, and listener destinations for the current server. This discovery, is based upon the Name property. Therefore, if the Name property is set by the user (e.g. because a management profile requires a particular name), the filter must be permanent and cannot be owned.

NOTE: Pywbem_mock used in testing does not remember any of subscription instances between non-interactive commands since the mock server is created for each command line instantiation. Therefore most pywbemcli mock usage with the subscription subcommand is in interactive mode (creating, viewing, and deleting instances within a single interactive session).

Since pywbemcli does not directly modify existing instances of filter or destinations or subscriptions, the user must do this directly through the pywbemcli Instance modify command.

Pywbemcli creates all instances of CIM_IndicationSubscription, CIM_ListenerDestinationCIMXML and CIM_IndicationFilter in the Interop namespace. It does not use subclasses in the creation of instances. If a user requires the creation of instances with a specific subclass, that must be done through the instance create command.

Owned destinations, filters, and subscriptions created by pywbemcli are maintained in a local cache between commands in interactive mode and automatically restored from the WBEM server in command mode. Permanent destinations, filters, and subscriptions are enumerated from the WBEM server for each subscription command that uses them (ex. subscription list-filters –permanent or subscription list-filters –all).

Since pywbemcli does not directly modify existing instances of filter or destinations or subscriptions, the user must do this directly through the ModifyInstance WBEM request method and then update the local owned instances list by executing subscription list-filters, subscription list_destinations(), or subscription list-subscriptions().

NOTE: Pywbem_mock used in testing does not remember any of subscription instances between non-interactive commands so that most pywbemcli mock testing is done in interactive mode.

Identifying destinations, filters, and subscriptions on the command line

While instances of destinations, filters, and subscriptions are uniquely defined with their CIM instance name, this is difficult in a command line environment so a simpler string based identity was defined to allow easily identifying instances and using a simple string value to add and remove instances from the WBEM server. In particular the instances associated with subscriptions are complex names involving multiple components (SystemCreationClassName, SystemName, CreationClassName, and Name properties) so a simple string identity makes identifying and manipulating these instances usable in a command line environment

Pywbemcli identifies the instances created for destinations and listeners through the Name property both for owned and permanent/static instances.

For owned destinations and filters, the Name property string value is defined with a specific format that defines it as an owned instance and ends with a string that is unique to the instance (the owned identity).

Thus, for a filter, the Name property would be a string of the form:

"pywbemfilter:" {submgr_id} ":" {IDENTITY}
where:

submgr_id is the subscription manager ID,

This identity is used to used to create the value of the Name property when instances are created by pywbemcli and to identify the target instance for removal. The IDENTITY must be unique for each destination and filter created or the add command will be rejected.

For permanent instances of destinations and filters, the identity is always the complete Name property.

Thus, a new owned destination would be created with the identity ODEST1 and removed as follows (Note: filters created and removed without the option defining the ownership (--owned / --permanent) default to owned):

$ pywbemcli -s http://subscriptionWbemServer
pywbemcli> subscription add-filter ODEST1 --query "Select * from CIM_Indication"
Added owned destination: Name=pywbemdestination:defaultpywbemcliSubMgr:ODEST1

pywbemcli> subscription remove-filter ODEST1
Removed owned indication destination: identity=ODEST1, Name=pywbemdestination:defaultpywbemcliSubMgr:ODEST1.

Indication subscriptions are also added and removed using IDENTITY in pywbemcli. However, since subscription reference properties are CIMInstanceName values which are the corresponding filter (Filter reference property) and destination instance (Handler reference property) names both the destination and filter must be defined to uniquely define an indication subscription on add-subscription and remove-subscriptions commands.

Thus two identities are used to identify a subscription which uniquely identify the filter and destination associated with the subscription. For example:

$ pywbemcli -s http://subscriptionWbemServer
pywbemcli> subscription add-subscription DESTINATIONID FILTERID
pywbemcli> subscription remove-subscription  DESTINATIONID FILTERID

Thus an owned subscription is created with the following command as follows:

$ pywbemcli -s http://subscriptionWbemServer
pywbemcli> subscription add-destination ODEST1 -l http://blah:50000
pywbemcli> subscription add-filter OFILTER1 -q "SELECT * FROM CIM_INDICATION"
pywbemcli> subscription add-subscription ODEST1 OFILTER1

which create and owned destination, filter, and subscription because the default option is --owned. See subscription add-subscription command for more information.

In general IDENTITY makes it simpler to identify and manipulate the destination, filter, and, subscription instances on the command line using just strings for identity. However, there may be cases where instances outside the control of pywbemcli may cause duplication in identities. Thus, for example, an instance created using a subclass of one of the pywbemcli used classes could have a Name property with the same value but be unique because the instance name includes the a different class origin name.

pywbemcli tries to assure that all instance instance names are unique by insuring that the IDENTITY component of the Name property is unique when each instance is created.

In cases where multiple instances result with the same identity, pywbemcli generates an exception noting the duplication but provides an option (--select) to allow the user to select one instance from multiples instead of the exception.

See pywbemcli subscription –help for the exact help output.

subscription add-destination command

Add a new indication listener to the current WBEM server.

The format of this command is:

pywbemcli [GENERAL-OPTIONS] subscription add-destination IDENTITY [COMMAND-OPTIONS]

This command creates a listener destination instance (CIM class CIM_ListenerDestinationCIMXML) with the identity defined by the IDENTITY argument and the --owned | --permanent option in the Interop namespace of the specified WBEM server on the target WBEM server.

A listener destination defines the location of a WBEM indication listener (the listener URL including port) that defines the indication listener for indications exported from a WBEM server and other characteristics of the listener.

The listener destination to be added is identified by the IDENTITY argument and the --owned / --permanent option. Together these elements define the Name property of the destination instance.

If the instance is to be owned, (--owned) the value of the Name property will be:

"pywbemdestination:" {submgr_id} ":" {IDENTITY}

where:

If the instance is to be permanent, (--permanent option) the IDENTITY argument directly defines the instance Name property.

If an destination instance with the specified or generated Name property already exists, the method raises CIMError(CIM_ERR_ALREADY_EXISTS). Note that this is a more strict behavior than what a WBEM server would do, because the ‘Name’ property is only one of four key properties.

The options that can be applied when adding a destination are:

  • --listener-url/ -l URL - the URL of the listener including its scheme, host name and protocol. The host name and protocol are required and the scheme defaults to https if not specified.

  • -- owned/--permanent - flag defining whether the created instance will be owned or permanent where the default is owned.

The following example creates an owned destination instance with the IDENTITY ODEST1 and a permanent destination with IDENTITY PDEST1

In this case the owned instance will be created with the Name property value pywbemdestination:defaultpywbemcliSubMgr:ODEST1

$ pywbemcli subscription add-destinations ODEST1 --listener-url http://my-listener:5000 --owned
Added owned destination: Name=pywbemdestination:defaultpywbemcliSubMgr:ODEST1

$ pywbemcli subscription add-destinations PDEST1 --listener-url http://my-listener:5000 --permanent
Added permanent destination: Name=PDEST1

See pywbemcli subscription add-destination –help for the exact help output of the command.

subscription add-filter command

The add-filter command creates a dynamic indication filter to a WBEM server, by creating an indication filter instance (CIM class CIM_IndicationFilter) and adding this instance to the Interop namespace of the current pywbemcli WBEM server (defined by the --name general option, --server general option, or --mock-server general option).

The format of this command is:

$ pywbemcli [GENERAL-OPTIONS] subscription add-filter IDENTITY [COMMAND-OPTIONS]

The filter defines a query and optionally a query language which is the basis for defining an indication.

The filter to be added is identified by the IDENTITY argument and the --owned / --permanent option. Together these elements define the Name property of the filter instance.

If the instance is to be owned, (--owned) the value of the Name property will be:

"pywbemfilter:" {submgr_id} ":" {IDENTITY}``

where:

If the instance is to be permanent, (--permanent) the IDENTITY argument directly defines the instance Name property. This should be used in cases where the user needs to have control over the filter name (e.g. because a DMTF management profile requires a particular name).

If a indication filter instance with the specified Name property already exists, the method raises an exception. Note that this is a more strict behavior than what a WBEM server would do, because the Name property is only one of four key properties.

The command line options for this command are:

  • --query-language TEXT - The query language in which the query is defined. Normally this must be either WQL a Microsoft specified query language (see WQL) or DMTF:CQL (the DMTF specified query language) (see CQL), The default language for this command is WQL. The query language specified must be implemented in the target server.

  • query/q FILTER - The query itself defined as a string using the query language defined by the query-language option.

  • --source-namespaces - The name of WBEM namespaces on the server where indications originate. Multiple namespaces may be defined as one or more namespaces per options instantiation where multiple namespaces are separated by comma (“,”). For example either, --source-namespaces root/cimv2,root/cimv3 or --source-namespaces root/cimv2 --source-namespaces root/cimv3 provide the same result.

  • -- owned / --permanent - Flag defining whether the created instance will be owned or permanent where the default is owned.

The following example creates an owned subscription instance with the IDENTITY ofilter1 and a permanent filter with the Name property of pfilter1.

The owned instance ofilter1 will be created with the Name property value of:

pywbemfilter:<subscription manager id>:pfilter1

$ pywbemcli subscription add-filter ofilter1 --query-language DMTF:CQL -q "SELECT * from CIM_blah" --owned
Added owned filter: Name=pywbemfilter:defaultpywbemcliSubMgr:pfilter1

$ pywbemcli subscription add-filter pfilter1 --listener-url http://my-listener:5000 --permanent
Added permanent filter: Name=filter1

See pywbemcli subscription add-filter –help for the help output of the command.

subscription add-subscription command

The add-subscription command creates a single indication subscription instance (CIM class CIM_IndicationSubscription) that defines the association between a previously defined indication filter and destination instance.

The destination and filter are defined the two required arguments of the command DESTINATIONID and FILTERID. These arguments may be either the complete name property value of the destination and filter to be associated or the IDENTITY that was the IDENTITY argument of the command that created each of the elements.

The format of this command is:

$ pywbemcli [GENERAL-OPTIONS] subscription add-subscription ``DESTINATIONID`` ``FILTERID`` [COMMAND-OPTIONS]

where:

  • DESTINATIONID is the IDENTITY for the listener destination instance to be attached to the subscription. See subscription add-destination command: for the definition of DESTINATIONID

  • FILTERID is the IDENTITY for the indication filter instance to be attached to the subscription. See subscription add-filter command: for the definition of FILTERID.

The options for add-subscription are:

  • -- owned / --permanent - A flag defining whether the created instance will be owned or permanent where the default is owned. As described above, owned destinations and filters cannot be attached to permanent subscriptions. The default is --owned if the option is not provided with the command.

  • --select - A flag that allows the user to resolve any ambiguities where the IDENTITY is duplicated. Without this, if the FILTERID or DESTINATIONID result in choice of multiple filters or destinations, the command is aborted. With this option, the user is given a prompt to select one of the destinations or filters where the IDENTITY has found multiple instances.

The following is an example of the creation of the destination, filter and subscription.

$ pywbemcli -s https:/blah
pywbemcli> subscription add-destinations odest1 --listener-url http://my-listener:5000 --owned
Added owned destination: Name=pywbemdestination:defaultpywbemcliSubMgr:odest1

pywbemcli> subscription add-filter ofilter1 --query-language DMTF:CQL -q "SELECT * from CIM_blah" --owned
Added owned filter: Name=pywbemfilter:defaultpywbemcliSubMgr:ofilter1

pywbemcli> subscription list-destinations

Indication Destinations: submgr-id=defaultpywbemcliSubMgr, svr-id=http://FakedUrl:5988, type=all
+-------------+------------+--------------------------------+-------------------+---------------+------------+----------------+
| Ownership   | Identity   | Name                           | Destination       |   Persistence |   Protocol |   Subscription |
|             |            | Property                       |                   |          Type |            |          Count |
|-------------+------------+--------------------------------+-------------------+---------------+------------+----------------|
| owned       | odest1     | pywbemdestination:defaultpywbe | http://blah:5000  |             3 |          2 |              0 |
|             |            | mcliSubMgr:odest1              |                   |               |            |                |
+-------------+------------+--------------------------------+-------------------+---------------+------------+----------------+

pywbemcli> subscription list-filters

Indication Filters: submgr-id=defaultpywbemcliSubMgr, svr-id=http://FakedUrl:5988 type=all
+-------------+------------+--------------------------------+----------------+------------+--------------+----------------+
| Ownership   | identity   | Name                           | Query          | Query      | Source       |   Subscription |
|             |            | Property                       |                | Language   | Namespaces   |          Count |
|-------------+------------+--------------------------------+----------------+------------+--------------+----------------|
| owned       | ofilter1   | pywbemfilter:defaultpywbemcliS | SELECT * from  | WQL        | root/cimv2   |              0 |
|             |            | ubMgr:ofilter1                 | CIM_Indication |            |              |                |
+-------------+------------+--------------------------------+----------------+------------+--------------+----------------+

pywbemcli> subscription add-subscription pdest1 pfilter1 --owned
Added owned subscription: DestinationName=pywbemdestination:defaultpywbemcliSubMgr:odest1, FilterName=pywbemfilter:defaultpywbemcliSubMgr:ofilter1

See pywbemcli subscription add-subscription –help for the help output of the command.

subscription list command

The subscription list command provides a table with an overview of the subscription, filter, and destination counts organized by ownership.

The command format is:

pywbemcli [GENERAL-OPTIONS] subscription list [COMMAND-OPTIONS]

The options are:

  • --type [ owned``| ``permanent | all ] Defines whether the command is going to filter owned ,permanent, or all objects for the response display. The default is all.

  • --summary / -s - If True, show only summary count of instances returned.

$ pywbemcli -s http://subscriptionWbemServer
pywbemcli> subscription list

WBEM server instance counts: submgr-id=defaultpywbemcliSubMgr, svr-id=http://FakedUrl:5988
+-------------------------------+---------+-------------+-------+
| CIM_class                     |   owned |   permanent |   all |
|-------------------------------+---------+-------------+-------|
| CIM_IndicationSubscription    |       1 |           0 |     1 |
| CIM_IndicationFilter          |       2 |           1 |     3 |
| CIM_ListenerDestinationCIMXML |       2 |           1 |     3 |
+-------------------------------+---------+-------------+-------+

$ subscription list --summary
1 subscriptions, 3 filters, 3 destinations

See pywbemcli subscription list –help for the help output of the command.

subscription list-destinations command

The subscription ``list-destinations command displays the existing destination instances ((CIM class CIM_ListenerDestinationCIMXML)) on the current WBEM server.

NOTE: pywbemcli works only with the CIM_ListenerDestinationCIMXML class so that any indication destination instances defined with the superclass CIM_ListenerDestination are not visible.

The format of this command is:

$ pywbemcli [GENERAL-OPTIONS] subscription list-destinations [COMMAND-OPTIONS]

The set of destinations to be displayed may be all of the destinations, the owned destinations, or the permanent (not-owned) destinations as defined by the --type option where the values are owned | permanent | all.

The format of the output is determined by the --output-format general option so that the destinations may be displayed as either CIM objects ( for example, -o mof) or in the table format. The default is to display the destinations as a table. In the table format, the most important information for each instance is displayed, one instance per row.

The detail level of the output is determined by the --summary and the detail options and has an effect on both the mof and table outputs. The --summary displays counts of the number of objects and the --detail adds more data to the normal display, in particular displaying more properties in the table view.

The options for list-destinations are:

  • --type [ owned | permanent | all ] - choice option that limits the list of destinations displayed to either just owned or permanent instances or displays all destinations on the current WBEM server

  • --detail - displays additional detail for all of the possible output formats. For MOF it includes empty properties. For table, it adds more rows with properties from the instance.

  • --summary/-s limits the display to an overview

  • --no/names-only displays only the CIM instance names of the instances. This option only applies if the CIM object format (ex. mof) is used for output.

The following is an example of the display of the destinations as a table:

$ pywbemcli -s http://subscriptionWbemServer
pywbemcli> subscription list-destinations

Indication Destinations: submgr-id=defaultpywbemcliSubMgr, svr-id=http://FakedUrl:5988, type=all
+-------------+------------+--------------------------------+-------------------+---------------+------------+----------------+
| Ownership   | Identity   | Name                           | Destination       |   Persistence |   Protocol |   Subscription |
|             |            | Property                       |                   |          Type |            |          Count |
|-------------+------------+--------------------------------+-------------------+---------------+------------+----------------|
| owned       | odest1     | pywbemdestination:defaultpywbe | http://blah:5000  |             3 |          2 |              2 |
|             |            | mcliSubMgr:odest1              |                   |               |            |                |
| owned       | odest2     | pywbemdestination:defaultpywbe | http://blah:5001  |             3 |          2 |              1 |
|             |            | mcliSubMgr:odest2              |                   |               |            |                |
| permanent   | pdest1     | pdest1                         | https://blah:5003 |             2 |          2 |              2 |
| permanent   | pdest2     | pdest2                         | https://blah:5003 |             2 |          2 |              1 |
| owned       | pdestdup   | pywbemdestination:defaultpywbe | https://blah:5003 |             3 |          2 |              0 |
|             |            | mcliSubMgr:pdestdup            |                   |               |            |                |
| permanent   | pdestdup   | pdestdup                       | https://blah:5003 |             2 |          2 |              0 |
+-------------+------------+--------------------------------+-------------------+---------------+------------+----------------+

where the rows shown in the table view are:

  • Ownership - the owned/permanent definition of the destination.

  • Identity - The identity of the destination which should be the IDENTITY used to remove the destination

  • Name - The value of the instance Name property

  • Destination - The value of the Destination property.

  • Persistence Type - The value of the PersistenceType property.

  • Protocol - The value of the Protocol property.

  • Subscription Count - The number of subscriptions with which this destination is associated via the CIM_IndicationSubscription Handler reference.

See pywbemcli subscription list-destinations –help for the help output of the command.

subscription list-filters command

The subscription ``list-filters command displays the existing indication filter instances ((CIM class CIM_IndicationFilter)) on the current WBEM server.

The format of this command is:

$ pywbemcli [GENERAL-OPTIONS] subscription list-filters [COMMAND-OPTIONS]

The set of filters to be displayed may be all of the filters, the owned filters, or the permanent (not owned) filters as defined by the --type option where the values are owned | permanent | all.

The format of the output is determined by the --output-format general option so that the destinations may be displayed as either CIM objects (-o mof) or in the table format. The default is to display the destinations as a table.

The detail level of the output is determined by the --summary and the detail options and has an effect on both the MOF and table outputs. The --summary displays counts of the number of objects and the --detail adds more data to the normal display, in particular displaying more properties in the table view.

The options for list-destinations are:

  • -- type [ owned | permanent | all ] - choice option that limits the list of destinations displayed to either just owned or permanent instances or displays all destinations on the current WBEM server

  • --detail - displays additional detail for all of the possible output formats. For MOF it includes empty properties. For table, it adds more rows with properties from the instance.

  • -s/--summary limits the display to an overview

  • --no/names-only displays only the CIM instance names of the instances. This option only applies if the CIM object format (ex. mof) is used for output.

The following is an example of table output of indication filters:

$ pywbemcli -s http://subscriptionWbemServer
pywbemcli> subscription list-filters

Indication Filters: submgr-id=defaultpywbemcliSubMgr, svr-id=http://FakedUrl:5988 type=all
+-------------+------------+--------------------------------+----------------+------------+--------------+----------------+
| Ownership   | identity   | Name                           | Query          | Query      | Source       |   Subscription |
|             |            | Property                       |                | Language   | Namespaces   |          Count |
|-------------+------------+--------------------------------+----------------+------------+--------------+----------------|
| owned       | ofilter1   | pywbemfilter:defaultpywbemcliS | SELECT * from  | WQL        | root/cimv2   |              2 |
|             |            | ubMgr:ofilter1                 | CIM_Indication |            |              |                |
| owned       | ofilter2   | pywbemfilter:defaultpywbemcliS | SELECT * from  | DMTF:CQL   | root/cimv2   |              1 |
|             |            | ubMgr:ofilter2                 | CIM_Indication |            |              |                |
| permanent   | pfilter1   | pfilter1                       | SELECT * from  | WQL        | root/cimv2   |              2 |
|             |            |                                | CIM_Indication |            |              |                |
| permanent   | pfilter2   | pfilter2                       | SELECT * from  | DMTF:CQL   | root/cimv2   |              1 |
|             |            |                                | CIM_Indication |            |              |                |
+-------------+------------+--------------------------------+----------------+------------+--------------+----------------+

where the rows shown in the table view are:

  • Ownership - the owned/permanent definition of the destination.

  • Identity - The identity of the destination which should be the IDENTITY used to remove the destination

  • Name - The value of the instance Name property

  • Query - The query select statement defined for this filter.

  • QueryLanguage - The query language defined for this filter.

  • SourceNamespaces - The names of the local namespaces where the Indications originate. If NULL, the namespace of the Filter registration is assumed. SourceNamespaces replaces the deprecated SourceNamespace property on IndicationFilter to provide a means of defining the multiple namespaces where indications may originate.

  • Subscription Count - The number of subscriptions with which this filter is associated via the CIM_IndicationSubscription Filter reference.

See pywbemcli subscription list-filters –help for the help output of the command.

subscription list-subscriptions command

The subscription list-filters command displays the existing indication filter instances (CIM class “CIM_IndicationSubscription”) on the current WBEM server.

The format of this command is:

$ pywbemcli [GENERAL-OPTIONS] subscription list-subscriptions [COMMAND-OPTIONS]

The set of subscriptions to be displayed may be all of the destinations, the owned subscriptions, or the permanent (not owned) subscriptions as defined by the --type option where the values are owned | permanent | all.

The format of the output is determined by the --output-format general option so that the destinations may be displayed as either CIM objects (-o mof) or in the table format. The default is to display the destinations as a table.

The detail level of the output is determined by the --summary and the detail options and has an effect on both the mof and table outputs. The --summary displays counts of the number of objects and the --detail adds more data to the normal display, in particular displaying more properties in the table view.

The options for list-destinations are:

  • -- type [ owned | permanent | all ] - choice option that limits the list of destinations displayed to either just owned or permanent instances or displays all destinations on the current WBEM server

  • --detail - displays additional detail for all of the possible output formats. For MOF it includes empty properties. For table, it adds more rows with properties from the instance.

  • -s/--summary limits the display to an overview

  • --no/names-only displays only the CIM instance names (paths) of the instances. This option only applies if the CIM object format (ex. mof) is used for output.

The following is an example of table output of indication subscriptions:

$ pywbemcli -s http://subscriptionWbemServer
pywbemcli> subscription list-subscriptions

Indication Subscriptions: submgr-id=defaultpywbemcliSubMgr, svr-id=http://FakedUrl:5988, type=all
+-------------+-------------------+---------------------+-------------------+------------------------------+----------------+-------------------+
| Ownership   | Handler           | Filter              | Handler           | Filter                       | Filter Query   | Subscription      |
|             | Identity          | Identity            | Destination       | Query                        | language       | StartTime         |
|-------------+-------------------+---------------------+-------------------+------------------------------+----------------+-------------------|
| permanent   | pdest1(permanent) | pfilter1(permanent) | https://blah:5003 | SELECT * from CIM_Indication | WQL            | 10/22/21 14:31:30 |
| permanent   | pdest2(permanent) | pfilter2(permanent) | https://blah:5003 | SELECT * from CIM_Indication | DMTF:CQL       | 10/22/21 14:31:30 |
| owned       | odest1(owned)     | ofilter1(owned)     | http://blah:5000  | SELECT * from CIM_Indication | WQL            | 10/22/21 14:31:30 |
| owned       | odest2(owned)     | ofilter2(owned)     | http://blah:5001  | SELECT * from CIM_Indication | DMTF:CQL       | 10/22/21 14:31:30 |
| owned       | odest1(owned)     | pfilter1(permanent) | http://blah:5000  | SELECT * from CIM_Indication | WQL            | 10/22/21 14:31:31 |
| owned       | pdest1(permanent) | ofilter1(owned)     | https://blah:5003 | SELECT * from CIM_Indication | WQL            | 10/22/21 14:31:31 |
+-------------+-------------------+---------------------+-------------------+------------------------------+----------------+-------------------+
pywbemcli>

where the rows shown in the table view are:

  • Ownership - the owned/permanent definition of the destination.

  • HandlerIdentity - The identity (DESTINATIONID) and ownership of the destination associated with this subscription.

  • FilterIdentity - The identity (FILTERID) and ownership of the filter associated with this subscription.

  • Handler Destination - The listener destination (URL) defined in the destination defined by the HandlerIdentity.

  • FilterQuery - The FilterQuery property from the associated filter defined by the FilterIdentity defining the query statement.

  • FilterQueryLanguage - The FilterQueryLanguage property from the associated filter defined by the FilterIdentity.

  • SubscriptionStartTime - The date and time that the subscription was created if the WBEM server has implemented this property.

See pywbemcli subscription list-subscriptions –help for the help output of the command.

subscription remove-destination command

Removes a listener destination instance (CIM_ListenerDestinationCIMXML) from the WBEM server where the instance to be removed is identified by the IDENTITY argument and optional --owned option of the command.

The format of this command is:

$ pywbemcli [GENERAL-OPTIONS] subscription remove-destination IDENTITY [COMMAND-OPTIONS]

The listener destination to be removed is identified by the IDENTITY argument and the --owned / --permanent option. Together these elements define the Name property of the target destination instance.

If the instance is owned, (--owned) the IDENTITY argument will define the IDENTITY component of the Name property as follows:

``"pywbemdestination:" {submgr_id} ":" {IDENTITY}``

where:

If the instance is to be permanent, (--permanent option) the IDENTITY argument directly defines the instance Name property.

The --select option can be used if, for some reason, the IDENTITY and ownership option returns multiple instances. This should only occur in rare cases where destination instances have been created by other tools. If the –select option is not used pywbemcli displays the paths of the instances and terminates the command.

If the instance to be removed is part of an existing association the command is aborted. The subscription list-destinations command shows whether the destination is part of an existing subscription.

The following example shows a command failure when an attempt is made to remove a destination that is part of a subscription and a good completion when that subscription has been removed.

$ pywbemcli -s http://subscriptionWbemServer
pywbemcli> subscription list-destinations

Indication Destinations: submgr-id=defaultpywbemcliSubMgr, svr-id=http://FakedUrl:5988, type=all
+-------------+------------+--------------------------------+-------------------+---------------+------------+----------------+
| Ownership   | Identity   | Name                           | Destination       |   Persistence |   Protocol |   Subscription |
|             |            | Property                       |                   |          Type |            |          Count |
|-------------+------------+--------------------------------+-------------------+---------------+------------+----------------|
| owned       | odest1     | pywbemdestination:defaultpywbe | http://blah:5000  |             3 |          2 |              1 |
|             |            | mcliSubMgr:odest1              |                   |               |            |                |
+-------------+------------+--------------------------------+-------------------+---------------+------------+----------------+
pywbemcli> subscription remove-destination odest1
Error: 1 (CIM_ERR_FAILED): The listener destination is referenced by subscriptions.; remove-destination failed: Exception :CIMError. Subscription mgr id: 'WBEMSubscriptionManager(_subscription_manager_id='defaultpywbemcliSubMgr', _servers={'http://FakedUrl:5988': WBEMServer(conn.url='http://FakedUrl:5988', interop_ns='interop', namespaces=None, namespace_paths=None, namespace_classname=None, brand='OpenPegasus', version='2.15.0', profiles=[0 instances])}, _systemnames={'http://FakedUrl:5988': 'Mock_WBEMServerTest'}...)', server id: 'http://FakedUrl:5988',

pywbemcli> subscription list-subscriptions

Indication Subscriptions: submgr-id=defaultpywbemcliSubMgr, svr-id=http://FakedUrl:5988, type=all
+-------------+-------------------+---------------------+-------------------+------------------------------+----------------+-------------------+
| Ownership   | Handler           | Filter              | Handler           | Filter                       | Filter Query   | Subscription      |
|             | Identity          | Identity            | Destination       | Query                        | language       | StartTime         |
|-------------+-------------------+---------------------+-------------------+------------------------------+----------------+-------------------|
| owned       | odest1(owned)     | ofilter1(owned)     | http://blah:5000  | SELECT * from CIM_Indication | WQL            | 10/24/21 11:36:03 |
+-------------+-------------------+---------------------+-------------------+------------------------------+----------------+-------------------+

pywbemcli> subscription remove-subscription odest1 ofilter1
Removed 1 subscription(s) for destination-id: odest1, filter-id: ofilter1.

See pywbemcli subscription remove-destination –help for the help output of the command.

subscription remove-filter command

Removes an indication filter instance (CIM_IndicationFilter) from the WBEM server.

The format of this command is:

$ pywbemcli [GENERAL-OPTIONS] subscription remove-filter IDENTITY [COMMAND-OPTIONS]

The filter to be removed is identified by the IDENTITY argument and the --owned / --permanent option. Together these elements define the Name property of the target filter instance.

If the instance is owned, (--owned) the IDENTITY argument will define the IDENTITY component of the Name property as follows:

``"pywbemfilter:" {submgr_id} ":" {IDENTITY}``

where:

If the instance is to be permanent, (--permanent option) the IDENTITY argument directly defines the instance Name property.

Some filter instances on a server may be static in which case the server should generate an exception if an attempt to made to remove them. Pywbemcli has no way to identify these static filters and they will appear as permanent filter instances.

The --select option can be used if, for some reason, the IDENTITY argument and ownership option returns multiple instances. This should only occur in rare cases where filter instances have been created by other tools. If the –select option is not used pywbemcli displays the paths of the instances and terminates the command.

If the instance to be removed is part of an existing association the command is aborted. The subscription list-filters command shows whether the filter is part of an existing subscription.

$ pywbemcli -s http://subscriptionWbemServer
pywbemcli> subscription list-filters

Indication Filters: submgr-id=defaultpywbemcliSubMgr, svr-id=http://FakedUrl:5988 type=all
+-------------+------------+--------------------------------+----------------+------------+--------------+----------------+
| Ownership   | identity   | Name                           | Query          | Query      | Source       |   Subscription |
|             |            |                                |                | Language   | Namespaces   |          Count |
|-------------+------------+--------------------------------+----------------+------------+--------------+----------------|
| owned       | ofilter1   | pywbemfilter:defaultpywbemcliS | SELECT * from  | WQL        | root/cimv2   |              2 |
|             |            | ubMgr:ofilter1                 | CIM_Indication |            |              |                |
| owned       | ofilter2   | pywbemfilter:defaultpywbemcliS | SELECT * from  | DMTF:CQL   | root/cimv2   |              0 |
|             |            | ubMgr:ofilter2                 | CIM_Indication |            |              |                |
|             |            |                                | CIM_Indication |            |              |                |
| permanent   | pfilter2   | pfilter2                       | SELECT * from  | DMTF:CQL   | root/cimv2   |              1 |
|             |            |                                | CIM_Indication |            |              |                |
+-------------+------------+--------------------------------+----------------+------------+--------------+----------------+
pywbemcli> subscription remove-filter ofilter2
Removed owned indication filter: identity=ofilter2, Name=pywbemfilter:defaultpywbemcliSubMgr:ofilter2.

See pywbemcli subscription remove-filter –help for the help output of the command.

subscription remove-subscription command

This command removes an indication subscription that is identified by two arguments that represent the identity of the destination and filter references of the target indication subscription.

The format of this command is:

$ pywbemcli [GENERAL-OPTIONS] subscription remove-subscription DESTINATIONID FILTERID [COMMAND-OPTIONS]

where the two required arguments:

  • DESTINATIONID is the IDENTITY for the listener destination instance to be attached to the subscription. See subscription add-destination command: for the definition of DESTINATIONID

  • FILTERID is the IDENTITY for the indication filter instance to be attached to the subscription. See subscription add-filter command: for the definition of FILTERID.

These arguments may be either the complete Name property value of the destination and filter associated instances or the IDENTITY that was the IDENTITY argument of the command that created the instances.

The options for this command are:

  • -v | verify - Prompt the user to verify the subscription to be removed before the request is sent to the WBEM server.

  • --remove-associated-instances - Remove the associated destination and filter instances after removing the subscription. They will only be removed if they are not part of any other associations.

  • --select - Prompt user to select from multiple objects that match the identity arguments provided with the command. Otherwise, if the command finds multiple instances that match the IDENTITY, the operation fails. The --select option can be used if, for some reason, the DESTINATIONID and FILTERID and return multiple instances. This should only occur in rare cases where filter instances have been created by other tools. If the --select option is not used pywbemcli displays the instance names of the instances and terminates the command.

The following example demonstrates the removal of a subscription:

$ pywbemcli -s http://subscriptionWbemServer
pywbemcli> subscription list-destinations

Indication Destinations: submgr-id=defaultpywbemcliSubMgr, svr-id=http://FakedUrl:5988, type=all
+-------------+------------+--------------------------------+-------------------+---------------+------------+----------------+
| Ownership   | Identity   | Name                           | Destination       |   Persistence |   Protocol |   Subscription |
|             |            |                                |                   |          Type |            |          Count |
|-------------+------------+--------------------------------+-------------------+---------------+------------+----------------|
| owned       | odest1     | pywbemdestination:defaultpywbe | http://blah:5000  |             3 |          2 |              2 |
|             |            | mcliSubMgr:odest1              |                   |               |            |                |
| owned       | odest2     | pywbemdestination:defaultpywbe | http://blah:5001  |             3 |          2 |              0 |
|             |            | mcliSubMgr:odest2              |                   |               |            |                |
| permanent   | pdest1     | pdest1                         | https://blah:5003 |             2 |          2 |              2 |
| permanent   | pdest2     | pdest2                         | https://blah:5003 |             2 |          2 |              1 |
+-------------+------------+--------------------------------+-------------------+---------------+------------+----------------+

pywbemcli> subscription list-filters

Indication Filters: submgr-id=defaultpywbemcliSubMgr, svr-id=http://FakedUrl:5988 type=all
+-------------+------------+--------------------------------+----------------+------------+--------------+----------------+
| Ownership   | identity   | Name                           | Query          | Query      | Source       |   Subscription |
|             |            |                                |                | Language   | Namespaces   |          Count |
|-------------+------------+--------------------------------+----------------+------------+--------------+----------------|
| owned       | ofilter1   | pywbemfilter:defaultpywbemcliS | SELECT * from  | WQL        | root/cimv2   |              2 |
|             |            | ubMgr:ofilter1                 | CIM_Indication |            |              |                |
| permanent   | pfilter1   | pfilter1                       | SELECT * from  | WQL        | root/cimv2   |              2 |
|             |            |                                | CIM_Indication |            |              |                |
| permanent   | pfilter2   | pfilter2                       | SELECT * from  | DMTF:CQL   | root/cimv2   |              1 |
|             |            |                                | CIM_Indication |            |              |                |
+-------------+------------+--------------------------------+----------------+------------+--------------+----------------+

pywbemcli> subscription list-subscriptions

Indication Subscriptions: submgr-id=defaultpywbemcliSubMgr, svr-id=http://FakedUrl:5988, type=all
+-------------+-------------------+---------------------+-------------------+------------------------------+----------------+-------------------+
| Ownership   | Handler           | Filter              | Handler           | Filter                       | Filter Query   | Subscription      |
|             | Identity          | Identity            | Destination       | Query                        | language       | StartTime         |
|-------------+-------------------+---------------------+-------------------+------------------------------+----------------+-------------------|
| permanent   | pdest1(permanent) | pfilter1(permanent) | https://blah:5003 | SELECT * from CIM_Indication | WQL            | 11/02/21 10:36:32 |
| permanent   | pdest2(permanent) | pfilter2(permanent) | https://blah:5003 | SELECT * from CIM_Indication | DMTF:CQL       | 11/02/21 10:36:33 |
| owned       | odest1(owned)     | ofilter1(owned)     | http://blah:5000  | SELECT * from CIM_Indication | WQL            | 11/02/21 10:36:33 |
| owned       | odest1(owned)     | pfilter1(permanent) | http://blah:5000  | SELECT * from CIM_Indication | WQL            | 11/02/21 10:36:33 |
| owned       | pdest1(permanent) | ofilter1(owned)     | https://blah:5003 | SELECT * from CIM_Indication | WQL            | 11/02/21 10:36:34 |
+-------------+-------------------+---------------------+-------------------+------------------------------+----------------+-------------------+

pywbemcli> subscription remove-subscription odest1 ofilter1
Removed 1 subscription(s) for destination-id: odest1, filter-id: ofilter1.

See pywbemcli subscription remove-subscription –help for the help output of the command.

Subscription remove-server command

This command unregisters owned listeners from the WBEM server and removes all owned indication subscriptions, owned indication filters, and owned listener destinations for this currently active pywbemcli WBEM server from that WBEM server.

The format of this command is:


$ pywbemcli [GENERAL-OPTIONS] subscription remove [COMMAND-OPTIONS]

It can be used to completely clean the owned subscription entities for the currently active pywbemcli WBEM server from that wbem server and local caches.

The currently active WBEM server is the WBEM server to which pywbemcli is currently attached; the WBEM server defined by the --name general option, --server general option, or --mock-server general option.

The identity of the current wbem server id visible in the title of each of the subscription list table outputs.

Thus, for example current server is defined by svr_id and is actually the fixed name http://FakedUrl:5988 of the mock server.

$ pywbemcli -s http://subscriptionWbemServer
pywbemcli> subscription list

WBEM server instance counts: submgr-id=defaultpywbemcliSubMgr, svr-id=http://FakedUrl:5988
+-------------------------------+---------+-------------+-------+
| CIM_class                     |   owned |   permanent |   all |
|-------------------------------+---------+-------------+-------|
| CIM_IndicationSubscription    |       2 |           2 |     6 |
| CIM_IndicationFilter          |       2 |           3 |     6 |
| CIM_ListenerDestinationCIMXML |       2 |           3 |     6 |
+-------------------------------+---------+-------------+-------+

pywbemcli> subscription remove-server
Removing owned destinations, filters, and subscriptions for server-id http://FakedUrl:5988. Remove counts: destinations=2, filters=2, subscriptions=2

pywbemcli> subscription list

WBEM server instance counts: submgr-id=defaultpywbemcliSubMgr, svr-id=http://FakedUrl:5988
+-------------------------------+---------+-------------+-------+
| CIM_class                     |   owned |   permanent |   all |
|-------------------------------+---------+-------------+-------|
| CIM_IndicationSubscription    |       0 |           2 |     2 |
| CIM_IndicationFilter          |       0 |           3 |     3 |
| CIM_ListenerDestinationCIMXML |       0 |           3 |     3 |
+-------------------------------+---------+-------------+-------+

See pywbemcli subscription remove-server –help for the help output of the command.

repl command

The repl command sets pywbemcli into the Interactive mode. Pywbemcli can be started in the Interactive mode either by entering:

$ pywbemcli repl
Enter 'help' for help, <CTRL-D> or ':q' to exit pywbemcli.
pywbemcli>

or by executing the script without any command or command group:

$ pywbemcli
Enter 'help' for help, <CTRL-D> or ':q' to exit pywbemcli.
pywbemcli>

The repl mode is recognized by the prompt pywbemcli>.

Command history is available in the Interactive mode either by using <UP-ARROW> and <DOWN-ARROW> keys to step through the history file or by using incremental search of the command history.

An incremental search is initiated by <CTRL-r> (similar to some shells like bash) and does a search based on a string entered after the <CTRL-r> for the last command containing the search string. The search string may be modified and <UP_ARROW>, <DOWN-ARROW> will find other commands containing the search string. Hitting <ENTER> selects the currently shown command.

see Interactive mode for more details on using this mode and the search.

help command

The help command provides information on special commands and controls that can be executed in the Interactive mode including:

  • executing shell commands,

  • exiting pywbemcli,

  • getting help on commands,

  • viewing interactive mode command history.

This is different from the --help option that provides information on command groups, and commands.

$ pywbemcli help

The following can be entered in interactive mode:

  <pywbemcli-cmd>             Execute pywbemcli command <pywbemcli-cmd>.
  !<shell-cmd>                Execute shell command <shell-cmd>.

  <CTRL-D>, :q, :quit, :exit  Exit interactive mode.

  <TAB>                       Tab completion (can be used anywhere).
  -h, --help                  Show pywbemcli general help message, including a
                              list of pywbemcli commands.
  <pywbemcli-cmd> --help      Show help message for pywbemcli command
                              <pywbemcli-cmd>.
  help                        Show this help message.
  :?, :h, :help               Show help message about interactive mode.
  <up-arrow, down-arrow>      View pwbemcli command history:

pywbemcli Help Command Details

This section shows the help text for each pywbemcli command group and command.

Help text for pywbemcli:

Usage: pywbemcli [GENERAL-OPTIONS] COMMAND [ARGS] [COMMAND-OPTIONS]

  Pywbemcli is a command line WBEM client that uses the DMTF CIM-XML protocol to communicate with WBEM servers.
  Pywbemcli can:

  * Manage the information in WBEM servers CIM objects using the
    operations defined in the DMTF specification.  It can manage CIM
    classes, CIM instances and CIM qualifier declarations in the WBEM
    Server and execute CIM methods and queries on the server.

  * Inspect WBEM server characteristics including namespaces, registered
    profiles, and other server information.

  * Capture detailed information on communication with the WBEM
    server including time statistics and logs of the operations.

  * Maintain a persistent list of named connections to WBEM servers
    and execute operations on them by name.

  Pywbemcli implements command groups and commands to execute the CIM-XML operations defined by the DMTF CIM Operations
  Over HTTP specification (DSP0200).

  The general options shown below can also be specified on any of the commands, positioned right after the 'pywbemcli'
  command name.

  The width of help texts of this command can be set with the PYWBEMTOOLS_TERMWIDTH environment variable.

  For more detailed documentation, see:

      https://pywbemtools.readthedocs.io/en/stable/

General Options:
  -n, --name NAME                 Use the WBEM server defined by the WBEM connection definition NAME. This option is
                                  mutually exclusive with the --server and --mock-server options, since each defines a
                                  WBEM server. Default: EnvVar PYWBEMCLI_NAME, or none.
  -m, --mock-server FILE          Use a mock WBEM server that is automatically created in pywbemcli and populated with
                                  CIM objects that are defined in the specified MOF file or Python script file. The
                                  files may be specified with relative or absolute path.See the pywbemcli documentation
                                  for more information. This option may be specified multiple times, and is mutually
                                  exclusive with the --server and --name options, since each defines a WBEM server.
                                  Default: EnvVar PYWBEMCLI_MOCK_SERVER, or none.
  -s, --server URL                Use the WBEM server at the specified URL with format: [SCHEME://]HOST[:PORT]. SCHEME
                                  must be "https" (default) or "http". HOST is a short or long hostname or literal
                                  IPV4/v6 address. PORT defaults to 5989 for https and 5988 for http. This option is
                                  mutually exclusive with the --mock-server and --name options, since each defines a
                                  WBEM server. Default: EnvVar PYWBEMCLI_SERVER, or none.
  -u, --user TEXT                 User name for the WBEM server.  Use "" to set default in interactive mode.Default:
                                  EnvVar PYWBEMCLI_USER, or none.
  -p, --password TEXT             Password for the WBEM server. Default: EnvVar PYWBEMCLI_PASSWORD, or prompted for if
                                  --user specified. Use "" to set default in interactive mode.
  --verify / --no-verify          If --verify, client verifies the X.509 server certificate presented by the WBEM server
                                  during TLS/SSL handshake. If --no-verify client bypasses verification. Default: EnvVar
                                  PYWBEMCLI_VERIFY, or "--verify".
  --ca-certs CACERTS              Certificates used to validate the certificate presented by the WBEM server during
                                  TLS/SSL handshake: FILE: Use the certs in the specified PEM file; DIR: Use the certs
                                  in the PEM files in the specified directory; "certifi" (pywbem 1.0 or later): Use the
                                  certs provided by the certifi Python package; Default: EnvVar PYWBEMCLI_CA_CERTS, or
                                  "certifi" (pywbem 1.0 or later), or the certs in the PEM files in the first existing
                                  directory from from a system defined list of directories (pywbem before 1.0).
  -c, --certfile FILE             Path name of a PEM file containing a X.509 client certificate that is used to enable
                                  TLS/SSL 2-way authentication by presenting the certificate to the WBEM server during
                                  TLS/SSL handshake.  Use "" to set default in interactive mode. Default: EnvVar
                                  PYWBEMCLI_CERTFILE, or none.
  -k, --keyfile FILE              Path name of a PEM file containing a X.509 private key that belongs to the certificate
                                  in the --certfile file. Not required if the private key is part of the --certfile
                                  file. Use "" to set default in interactive mode.Default: EnvVar PYWBEMCLI_KEYFILE, or
                                  none.
  -t, --timeout INT               Client-side timeout (seconds) on data read for operations with the WBEM server. This
                                  integer is the timeout for a single server request. Pywbem retries reads 0 times so
                                  the delay for read timeout failure may be multiple times the timeout value.Default:
                                  EnvVar PYWBEMCLI_TIMEOUT, or 30. Min/max:   [0<=x<=300]
  -U, --use-pull [yes|no|either]  Determines whether pull operations are used for operations with the WBEM server that
                                  return lists of instances, as follows: "yes" uses pull operations and fails if not
                                  supported by the server; "no" uses traditional operations; "either" (default) uses
                                  pull operations if supported by the server, and otherwise traditional operations.
                                  Default: EnvVar PYWBEMCLI_USE_PULL, or "either".
  --pull-max-cnt INT              Maximum number of instances to be returned by the WBEM server in each open or pull
                                  response, if pull operations are used. This is a tuning parameter that does not affect
                                  the external behavior of the commands. Default: EnvVar PYWBEMCLI_PULL_MAX_CNT, or 1000
  -T, --timestats / --no-timestats
                                  Display operation time statistics gathered by pywbemcli after each command. Otherwise
                                  statistics can be displayed with "statistics show" command. Default: EnvVar
                                  PYWBEMCLI_TIMESTATS, or no-timestats.
  -d, --default-namespace NAMESPACE
                                  Default namespace, to be used when commands do not specify the --namespace command
                                  option. Use "" to set default in interactive mode. Default: EnvVar
                                  PYWBEMCLI_DEFAULT_NAMESPACE, or root/cimv2.
  -o, --output-format FORMAT      Output format for the command result. The default and allowed output formats are
                                  command specific. The default output_format is None so that each command selects its
                                  own default format. Use "" to set default in interactive mode. FORMAT is: table
                                  formats: [table|plain|simple|grid|psql|rst|html]; CIM object formats:
                                  [mof|xml|repr|txt]]; TEXT formats: [text].
  -l, --log COMP[=DEST[:DETAIL]],...
                                  Enable logging of WBEM operations, defined by a list of log configuration strings
                                  with: COMP: [api|http|all]; DEST: [file|stderr|off], default: file; DETAIL:
                                  [all|paths|summary], default: all. "all=off" disables all logging. "all" is max
                                  logging. EnvVar: PYWBEMCLI_LOG. Default: no logging
  -v, --verbose / --no-verbose    Display extra information about the processing.
  --warn / --no-warn              Warnings control: True enables display of all Python warnings; False leaves warning
                                  control to the PYHONWARNINGS env var, which by default displays no warnings. Default:
                                  False.
  -C, --connections-file FILE PATH
                                  Path name of the connections file to be used. Default: EnvVar
                                  PYWBEMCLI_CONNECTIONS_FILE, or ".pywbemcli_connections.yaml" in the user's home
                                  directory (as determined using Python's os.path.expanduser("~"). See there for
                                  details, particularly for Windows). Use "" to set default in interactive mode.
  --pdb                           Pause execution in the built-in pdb debugger just before executing the command within
                                  pywbemcli. Ignored in interactive mode, but can be specified on each interactive
                                  command. Default: EnvVar PYWBEMCLI_PDB, or false.
  --version                       Show the version of this command and the pywbem package.
  -h, --help                      Show this help message.

Commands:
  class         Command group for CIM classes.
  instance      Command group for CIM instances.
  namespace     Command group for CIM namespaces.
  profile       Command group for WBEM management profiles.
  qualifier     Command group for CIM qualifier declarations.
  server        Command group for WBEM servers.
  statistics    Command group for WBEM operation statistics.
  subscription  Command group to manage WBEM indication subscriptions.
  connection    Command group for WBEM connection definitions.
  help          Show help message for interactive mode.
  repl          Enter interactive mode (default).

pywbemcli class –help

Help text for pywbemcli class (see class command group):

Usage: pywbemcli [GENERAL-OPTIONS] class COMMAND [ARGS] [COMMAND-OPTIONS]

  Command group for CIM classes.

  This command group defines commands to inspect classes, invoke methods on classes, delete classes.

  Creation and modification of classes is not currently supported.

  In addition to the command-specific options shown in this help text, the general options (see 'pywbemcli --help') can
  also be specified before the 'class' keyword.

Command Options:
  -h, --help  Show this help message.

Commands:
  enumerate     List top classes or subclasses of a class in namespace(s).
  get           Get a class.
  delete        Delete a class.
  invokemethod  Invoke a method on a class.
  references    List the classes referencing a class.
  associators   List the classes associated with a class.
  find          List the classes with matching class names on the server.
  tree          Show the subclass or superclass hierarchy for a class.
pywbemcli class associators –help

Help text for pywbemcli class associators (see class associators command):

Usage: pywbemcli [GENERAL-OPTIONS] class associators CLASSNAME [COMMAND-OPTIONS]

  List the classes associated with a class.

  List the CIM classes that are associated with the specified class (CLASSNAME argument) in the specified CIM namespace
  (--namespace option). If no namespace was specified, the default namespace of the connection is used.

  The classes to be retrieved can be filtered by the --role, --result-role, --assoc-class, and --result-class options.

  The --include-classorigin, --no-qualifiers, and --propertylist options determine which parts are included in each
  retrieved class.

  The --names-only option can be used to show only the class paths.

  In the output, the classes and class paths will be formatted as defined by the --output-format general option. Table
  formats on classes will be replaced with MOF format.

  Examples:

    pywbemcli -n myconn class associators CIM_Foo -n interop

Command Options:
  --ac, --assoc-class CLASSNAME   Filter the result set by association class name. Subclasses of the specified class
                                  also match.
  --rc, --result-class CLASSNAME  Filter the result set by result class name. Subclasses of the specified class also
                                  match.
  -r, --role PROPERTYNAME         Filter the result set by source end role name.
  --rr, --result-role PROPERTYNAME
                                  Filter the result set by far end role name.
  --nq, --no-qualifiers           Do not include qualifiers in the returned class(es). Default: Include qualifiers.
  --ico, --include-classorigin    Include class origin information in the returned class(es). Default: Do not include
                                  class origin information.
  --pl, --propertylist PROPERTYLIST
                                  Filter the properties included in the returned object(s). Multiple properties may be
                                  specified with either a comma-separated list or by using the option multiple times.
                                  Properties specified in this option that are not in the object(s) will be ignored. The
                                  empty string will include no properties. Default: Do not filter properties.
  --no, --names-only              Retrieve only the object paths (names). Default: Retrieve the complete objects
                                  including object paths.
  -n, --namespace NAMESPACE(s)    Namespace(s) to use for this command, instead of the default connection namespace. May
                                  be specified multiple times using either the option multiple times and/or comma
                                  separated list. Default: connection default namespace.
  --object-order                  Order the objects by object before namespace. Only applies when multiple namespaces
                                  defined.
  -s, --summary                   Show only a summary (count) of the objects.
  -h, --help                      Show this help message.
pywbemcli class delete –help

Help text for pywbemcli class delete (see class delete command):

Usage: pywbemcli [GENERAL-OPTIONS] class delete CLASSNAME [COMMAND-OPTIONS]

  Delete a class.

  Delete a CIM class (CLASSNAME argument) in a CIM namespace (--namespace option). If no namespace was specified, the
  default namespace of the connection is used.

  If the class has instances, the command is rejected, unless the --include-instances option is specified, in which case
  the instances are also deleted.

  If other classes in that namespace depend on the class to be deleted, the command is rejected. Dependencies considered
  for this purpose are subclasses, referencing classes and embedding classes (EmbeddedInstance qualifier only).

  WARNING: Deletion of instances will cause the removal of corresponding resources in the managed environment (i.e. in
  the real world). Some instances may not be deletable.

  WARNING: Deleting classes can cause damage to the server: It can impact instance providers and other components in the
  server. Use this command with caution.

  Many WBEM servers may not allow this operation or may severely limit the conditions under which a class can be deleted
  from the server.

  Example:

    pywbemcli -n myconn class delete CIM_Foo -n interop

Command Options:
  --include-instances        Delete any instances of the class as well. WARNING: Deletion of instances will cause the
                             removal of corresponding resources in the managed environment (i.e. in the real
                             world).Default: Reject command if the class has any instances.
  --dry-run                  Enable dry-run mode: Do not actually delete the objects, but display what would be done.
  -n, --namespace NAMESPACE  Namespace to use for this command, instead of the default namespace of the connection.
  -h, --help                 Show this help message.
pywbemcli class enumerate –help

Help text for pywbemcli class enumerate (see class enumerate command):

Usage: pywbemcli [GENERAL-OPTIONS] class enumerate CLASSNAME [COMMAND-OPTIONS]

  List top classes or subclasses of a class in namespace(s).

  Enumerate CIM classes starting either at the top of the class hierarchy in the specified CIM namespace (--namespace
  option), or at the specified class (CLASSNAME argument) in the specified namespace. If no namespace was specified, the
  default namespace of the connection is used.

  The --local-only, --include-classorigin, and --no-qualifiers options determine which parts are included in each
  retrieved class.

  The --deep-inheritance option defines whether or not the complete subclass hierarchy of the classes is retrieved.

  The --names-only option can be used to show only the class paths.

  In the output, the classes and class paths will be formatted as defined by the --output-format general option. Table
  formats on classes will be replaced with MOF format.

  Examples:

    pywbemcli -n myconn class enumerate -n interop

    pywbemcli -n myconn class enumerate CIM_Foo -n interop

Command Options:
  --di, --deep-inheritance        Include the complete subclass hierarchy of the requested classes in the result set.
                                  Default: Do not include subclasses.
  --lo, --local-only              Do not include superclass properties and methods in the returned class(es). Default:
                                  Include superclass properties and methods.
  --nq, --no-qualifiers           Do not include qualifiers in the returned class(es). Default: Include qualifiers.
  --ico, --include-classorigin    Include class origin information in the returned class(es). Default: Do not include
                                  class origin information.
  --no, --names-only              Retrieve only the object paths (names). Default: Retrieve the complete objects
                                  including object paths.
  -n, --namespace NAMESPACE(s)    Namespace(s) to use for this command, instead of the default connection namespace. May
                                  be specified multiple times using either the option multiple times and/or comma
                                  separated list. Default: connection default namespace.
  -s, --summary                   Show only a summary (count) of the objects.
  --association / --no-association
                                  Filter the returned classes to return only indication classes (--association) or
                                  classes that are not associations(--no-association). If the option is not defined no
                                  filtering occurs
  --indication / --no-indication  Filter the returned classes to return only indication classes (--indication) or
                                  classes that are not indications (--no-indication). If the option is not defined no
                                  filtering occurs
  --experimental / --no-experimental
                                  Filter the returned classes to return only experimental classes (--experimental) or
                                  classes that are not experimental (--no-iexperimental). If the option is not defined
                                  no filtering occurs
  --deprecated / --no-deprecated  Filter the returned classes to return only deprecated classes (--deprecated) or
                                  classes that are not deprecated (--no-deprecated). If the option is not defined no
                                  filtering occurs
  --since VERSION                 Filter the returned classes to return only classes  with a version qualifier ge the
                                  supplied string. The string must define a version of the form M.N.V consistent the
                                  definitions of the VERSION qualifier.
  --schema SCHEMA                 Filter the returned classes to return only classes where the classname scheme
                                  component (characters before the "_" match the scheme provided.
  --subclass-of CLASSNAME         Filter the returned classes to return only classes that are a subclass of the option
                                  value.
  --leaf-classes                  Filter the returned classes to return only leaf (classes; classes with no subclass.
  --object-order                  Order the objects by object before namespace. Only applies when multiple namespaces
                                  defined.
  -h, --help                      Show this help message.
pywbemcli class find –help

Help text for pywbemcli class find (see class find command):

Usage: pywbemcli [GENERAL-OPTIONS] class find CLASSNAME-GLOB [COMMAND-OPTIONS]

  List the classes with matching class names on the server.

  Find the CIM classes whose class name matches the specified wildcard expression (CLASSNAME-GLOB argument) in all CIM
  namespaces of the WBEM server, or in the specified namespace (--namespace option).

  The CLASSNAME-GLOB argument is a wildcard expression that is matched on class names case insensitively. The special
  characters from Unix file name wildcarding are supported ('*' to match zero or more characters, '?' to match a single
  character, and '[]' to match character ranges). To avoid shell expansion of wildcard characters, the CLASSNAME-GLOB
  argument should be put in quotes.

  For example, "pywbem_*" returns classes whose name begins with "PyWBEM_", "pywbem_", etc. "*system*" returns classes
  whose names include the case insensitive string "system".

  In the output, the classes will be formatted as defined by the --output-format general option if it specifies table
  output. Otherwise the classes will be in the form "NAMESPACE:CLASSNAME".

  Examples:

    pywbemcli -n myconn class find "CIM_*System*" -n interop

    pywbemcli -n myconn class find *Foo*

Command Options:
  -n, --namespace NAMESPACE(s)    Namespace(s) for search scope. May be specified multiple times using either the option
                                  multiple times and/or comma separated list. Default: Search in all namespaces of the
                                  server.
  -s, --sort                      Sort by namespace. Default is to sort by classname
  --association / --no-association
                                  Filter the returned classes to return only indication classes (--association) or
                                  classes that are not associations(--no-association). If the option is not defined no
                                  filtering occurs
  --indication / --no-indication  Filter the returned classes to return only indication classes (--indication) or
                                  classes that are not indications (--no-indication). If the option is not defined no
                                  filtering occurs
  --experimental / --no-experimental
                                  Filter the returned classes to return only experimental classes (--experimental) or
                                  classes that are not experimental (--no-iexperimental). If the option is not defined
                                  no filtering occurs
  --deprecated / --no-deprecated  Filter the returned classes to return only deprecated classes (--deprecated) or
                                  classes that are not deprecated (--no-deprecated). If the option is not defined no
                                  filtering occurs
  --since VERSION                 Filter the returned classes to return only classes  with a version qualifier ge the
                                  supplied string. The string must define a version of the form M.N.V consistent the
                                  definitions of the VERSION qualifier.
  --schema SCHEMA                 Filter the returned classes to return only classes where the classname scheme
                                  component (characters before the "_" match the scheme provided.
  --subclass-of CLASSNAME         Filter the returned classes to return only classes that are a subclass of the option
                                  value.
  --leaf-classes                  Filter the returned classes to return only leaf (classes; classes with no subclass.
  -h, --help                      Show this help message.
pywbemcli class get –help

Help text for pywbemcli class get (see class get command):

Usage: pywbemcli [GENERAL-OPTIONS] class get CLASSNAME [COMMAND-OPTIONS]

  Get a class.

  Get a CIM class (CLASSNAME argument) in a CIM namespace (--namespace option). If no namespace was specified, the
  default namespace of the connection is used.

  The --local-only, --include-classorigin, --no-qualifiers, and --propertylist options determine which parts are
  included in each retrieved class.

  In the output, the class will be formatted as defined by the --output-format general option. Table formats are
  replaced with MOF format.

  Example:

    pywbemcli -n myconn class get CIM_Foo -n interop

Command Options:
  --lo, --local-only              Do not include superclass properties and methods in the returned class(es). Default:
                                  Include superclass properties and methods.
  --nq, --no-qualifiers           Do not include qualifiers in the returned class(es). Default: Include qualifiers.
  --ico, --include-classorigin    Include class origin information in the returned class(es). Default: Do not include
                                  class origin information.
  --pl, --propertylist PROPERTYLIST
                                  Filter the properties included in the returned object(s). Multiple properties may be
                                  specified with either a comma-separated list or by using the option multiple times.
                                  Properties specified in this option that are not in the object(s) will be ignored. The
                                  empty string will include no properties. Default: Do not filter properties.
  -n, --namespace NAMESPACE(s)    Namespace(s) to use for this command, instead of the default connection namespace. May
                                  be specified multiple times using either the option multiple times and/or comma
                                  separated list. Default: connection default namespace.
  -h, --help                      Show this help message.
pywbemcli class invokemethod –help

Help text for pywbemcli class invokemethod (see class invokemethod command):

Usage: pywbemcli [GENERAL-OPTIONS] class invokemethod CLASSNAME METHODNAME [COMMAND-OPTIONS]

  Invoke a method on a class.

  Invoke a static CIM method (METHODNAME argument) on a CIM class (CLASSNAME argument) in a CIM namespace (--namespace
  option), and display the method return value and output parameters. If no namespace was specified, the default
  namespace of the connection is used.

  The method input parameters are specified using the --parameter option, which may be specified multiple times.

  Pywbemcli retrieves the class definition from the server in order to verify that the specified input parameters are
  consistent with the parameter characteristics in the method definition.

  Use the 'instance invokemethod' command to invoke CIM methods on CIM instances.

  Example:

    pywbemcli -n myconn class invokemethod CIM_Foo methodx -p p1=9 -p p2=Fred

Command Options:
  -p, --parameter PARAMETERNAME=VALUE
                                  Specify a method input parameter with its value. May be specified multiple times.
                                  Default: No input parameters.
  -n, --namespace NAMESPACE       Namespace to use for this command, instead of the default namespace of the connection.
  -h, --help                      Show this help message.
pywbemcli class references –help

Help text for pywbemcli class references (see class references command):

Usage: pywbemcli [GENERAL-OPTIONS] class references CLASSNAME [COMMAND-OPTIONS]

  List the classes referencing a class.

  List the CIM (association) classes that reference the specified class (CLASSNAME argument) in the specified CIM
  namespace (--namespace option). If no namespace was specified, the default namespace of the connection is used.

  The classes to be retrieved can be filtered by the --role and --result-class options.

  The --include-classorigin, --no-qualifiers, and --propertylist options determine which parts are included in each
  retrieved class.

  The --names-only option can be used to show only the class paths.

  In the output, the classes and class paths will be formatted as defined by the --output-format general option. Table
  formats on classes will be replaced with MOF format.

  Examples:

    pywbemcli -n myconn class references CIM_Foo -n interop

Command Options:
  --rc, --result-class CLASSNAME  Filter the result set by result class name. Subclasses of the specified class also
                                  match.
  -r, --role PROPERTYNAME         Filter the result set by source end role name.
  --nq, --no-qualifiers           Do not include qualifiers in the returned class(es). Default: Include qualifiers.
  --ico, --include-classorigin    Include class origin information in the returned class(es). Default: Do not include
                                  class origin information.
  --pl, --propertylist PROPERTYLIST
                                  Filter the properties included in the returned object(s). Multiple properties may be
                                  specified with either a comma-separated list or by using the option multiple times.
                                  Properties specified in this option that are not in the object(s) will be ignored. The
                                  empty string will include no properties. Default: Do not filter properties.
  --no, --names-only              Retrieve only the object paths (names). Default: Retrieve the complete objects
                                  including object paths.
  -n, --namespace NAMESPACE(s)    Namespace(s) to use for this command, instead of the default connection namespace. May
                                  be specified multiple times using either the option multiple times and/or comma
                                  separated list. Default: connection default namespace.
  --object-order                  Order the objects by object before namespace. Only applies when multiple namespaces
                                  defined.
  -s, --summary                   Show only a summary (count) of the objects.
  -h, --help                      Show this help message.
pywbemcli class tree –help

Help text for pywbemcli class tree (see class tree command):

Usage: pywbemcli [GENERAL-OPTIONS] class tree CLASSNAME [COMMAND-OPTIONS]

  Show the subclass or superclass hierarchy for a class.

  List the subclass or superclass hierarchy of a CIM class (CLASSNAME argument) or CIM namespace (--namespace option):

  - If CLASSNAME is omitted, the complete class hierarchy of the specified   namespace is retrieved.

  - If CLASSNAME is specified but not --superclasses, the class and its   subclass hierarchy in the specified namespace
  are retrieved.

  - If CLASSNAME and --superclasses are specified, the class and its   superclass ancestry up to the top-level class in
  the specified namespace   are retrieved.

  If no namespace was specified, the default namespace of the connection is used.

  The class hierarchy will formatted as a ASCII graphical tree; the --output-format general option is ignored.

  The --detail options to display extra information about each class including:

  -  The Version qualifier value if the class includes a version    qualifier. This is normally a string with 3 integers

  -  Information about each class type (Association, Indication, Abstract)

  Examples:

    # Display the complete class hierarchy from the interop namespace   pywbemcli -n myconn class tree -n interop

    # Display CIM_Foo an its subclasses from the namespace interop   pywbemcli -n myconn class tree CIM_Foo -n interop

    # Display CIM_Foo and its superclasses from interop   pywbemcli -n myconn class tree CIM_Foo -s -n interop

Command Options:
  -s, --superclasses         Show the superclass hierarchy. Default: Show the subclass hierarchy.
  -d, --detail               Show details about the class: the Version,  Association, Indication, and Abstact
                             qualifiers.
  -n, --namespace NAMESPACE  Namespace to use for this command, instead of the default namespace of the connection.
  -h, --help                 Show this help message.

pywbemcli connection –help

Help text for pywbemcli connection (see connection command group):

Usage: pywbemcli [GENERAL-OPTIONS] connection COMMAND [ARGS] [COMMAND-OPTIONS]

  Command group for WBEM connection definitions.

  This command group defines commands to manage persistent WBEM connection definitions that have a name. The names of
  these connection definitions can then be used as shorthand for the WBEM server or mock server via the '--name' general
  option.

  The connection definitions are stored in a connections file. By default, the connections file is
  '.pywbemcli_connections.yaml' in the user's home directory. The location of the user's home directory depends on the
  operating system used. It is determined with Python's 'os.path.expanduser("~")', which works on all operating systems
  including Windows. The default path name of the connections file can be overwritten using the
  'PYWBEMCLI_CONNECTIONS_FILE' environment variable, or with the '--connections-file' general option.

  In addition to the command-specific options shown in this help text, the general options (see 'pywbemcli --help') can
  also be specified before the 'connection' keyword.

Command Options:
  -h, --help  Show this help message.

Commands:
  export       Export the current connection.
  show         Show a WBEM connection definition or the current connection.
  delete       Delete a WBEM connection definition.
  select       Select a WBEM connection definition as current or default.
  test         Test the current connection with a predefined WBEM request.
  save         Save the current connection to a new WBEM connection definition.
  list         List the WBEM connection definitions.
  set-default  Set a connection as the default connection.
pywbemcli connection delete –help

Help text for pywbemcli connection delete (see connection delete command):

Usage: pywbemcli [GENERAL-OPTIONS] connection delete NAME [COMMAND-OPTIONS]

  Delete a WBEM connection definition.

  Delete a named connection definition from the connections file. If the NAME argument is omitted, a list of all
  connection definitions is displayed on the terminal  and a prompt for selecting one of these connections.

  Example:

    pywbemcli connection delete blah

Command Options:
  -h, --help  Show this help message.
pywbemcli connection export –help

Help text for pywbemcli connection export (see connection export command):

Usage: pywbemcli [GENERAL-OPTIONS] connection export [COMMAND-OPTIONS]

  Export the current connection.

  Display commands that set pywbemcli environment variables to the parameters of the current connection.

  Examples:

    pywbemcli --name srv1 connection export

    pywbemcli --server https://srv1 --user me --password pw connection export

Command Options:
  -h, --help  Show this help message.
pywbemcli connection list –help

Help text for pywbemcli connection list (see connection list command):

Usage: pywbemcli [GENERAL-OPTIONS] connection list [COMMAND-OPTIONS]

  List the WBEM connection definitions.

  This command displays all entries in the connections file and the current connection if it exists and is not in the
  connections file as a table.

  '#' before the name indicates the default connection.
  '*' before the name indicates that it is the current connection.

  See also the 'connection select' command.

Command Options:
  -f, --full  If set, display the full table. Otherwise display a brief view(name, server, mock_server columns).
  -h, --help  Show this help message.
pywbemcli connection save –help

Help text for pywbemcli connection save (see connection save command):

Usage: pywbemcli [GENERAL-OPTIONS] connection save NAME [COMMAND-OPTIONS]

  Save the current connection to a new WBEM connection definition.

  Save the current connection to the connections file as a connection definition named NAME. The NAME argument is
  required. If a connection definition with that name already exists, it is overwritten without warning.

  In the interactive mode, general options that are connection related are applied to the current connection before it
  is saved.

  Examples:

    pywbemcli --server https://srv1 connection save mysrv

Command Options:
  -f, --set-default  Set this definition as the default definition that will be loaded upon pywbemcli startup if no
                     server or name is included on the command line.
  -h, --help         Show this help message.
pywbemcli connection select –help

Help text for pywbemcli connection select (see connection select command):

Usage: pywbemcli [GENERAL-OPTIONS] connection select NAME [COMMAND-OPTIONS]

  Select a WBEM connection definition as current or default.

  Select the connection definition named NAME from the connections file to be the current connection. The connection
  definition in the connections file must exist. If the NAME argument is omitted, a list of connection definitions from
  the connections file is presented with a prompt for the user to select a connection definition.

  If the --set-default option is set, the default connection is set to the selected connection definition, in addition.
  Once defined, the default connection will be used as a default in future executions of pywbemcli if none of the
  server-defining general options (i.e. --server, --mock-server, or --name) was used.

  The 'connection list' command marks the current connection with '*' and the default connection with '#'.

  Example of selecting a default connection in command mode:

    pywbemcli connection select myconn --default
    pywbemcli connection show
    name: myconn
      . . .

  Example of selecting just the current connection in interactive mode:

    pywbemcli
    pywbemcli> connection select myconn
    pywbemcli> connection show
    name: myconn
      . . .

Command Options:
  -d, --set-default  If set, the connection is set to be the default connection in the connections file in addition to
                     setting it as the current connection.
  -h, --help         Show this help message.
pywbemcli connection set-default –help

Help text for pywbemcli connection set-default (see connection set-default command):

Usage: pywbemcli [GENERAL-OPTIONS] connection set-default NAME [COMMAND-OPTIONS]

  Set a connection as the default connection.

  Sets either the connection defined in the NAME argument as the default current connection definition or, if there is
  no NAME argument on the command it sets the current connection (if there is one) as the default connection.

  The character "?" may be used as the name argument to allow selecting the connection to be set as the default
  connection interactively from all of the existing connection definitions.

Command Options:
  --clear       Clear default connection name.
  -v, --verify  Prompt user to verify change before changing the default connection definition).
  -h, --help    Show this help message.
pywbemcli connection show –help

Help text for pywbemcli connection show (see connection show command):

Usage: pywbemcli [GENERAL-OPTIONS] connection show NAME [COMMAND-OPTIONS]

  Show a WBEM connection definition or the current connection.

  Show the name and attributes of a WBEM connection definition or the current connection, as follows:

  * If the NAME argument is specified, display the connection information   with that name from the connections file or
  the current connection if it   is the same name.

  * If the NAME argument is '?', the command presents a list of connection   definitions from the connections file and
  prompts the user to   select one, which is then displayed.

  * If the NAME argument is omitted, displays the current connection   information if there is a current connection.

  Example showing a named connection definition:

    pywbemcli connection show svr1
      name: svr1
      ...

  Example for prompting for a connection definition:

    pywbemcli connection show ?
      0: svr1
      1: svr2
    Input integer between 0 and 2 or Ctrl-C to exit selection: : 0
      name: svr1
        ...

Command Options:
  --show-password  If set, show existing password in results. Otherwise, password is masked
  -h, --help       Show this help message.
pywbemcli connection test –help

Help text for pywbemcli connection test (see connection test command):

Usage: pywbemcli [GENERAL-OPTIONS] connection test [COMMAND-OPTIONS]

  Test the current connection with a predefined WBEM request.

  Execute the EnumerateClassNames operation on the default namespace against the current connection to confirm that the
  connection exists and is working.

  Examples:

    pywbemcli --name mysrv connection test

Command Options:
  --test-pull  If set, the connection is tested to determine if theDMTF defined pull operations (ex.
               OpenEnumerateInstancesare implemented since these are optional.
  -h, --help   Show this help message.

pywbemcli help –help

Help text for pywbemcli help (see help command):

Usage: pywbemcli [GENERAL-OPTIONS] help

  Show help message for interactive mode.

Command Options:
  -h, --help  Show this help message.

pywbemcli instance –help

Help text for pywbemcli instance (see instance command group):

Usage: pywbemcli [GENERAL-OPTIONS] instance COMMAND [ARGS] [COMMAND-OPTIONS]

  Command group for CIM instances.

  This command group defines commands to inspect instances, to invoke methods on instances, and to create and delete
  instances.

  Modification of instances is not currently supported.

  In addition to the command-specific options shown in this help text, the general options (see 'pywbemcli --help') can
  also be specified before the 'instance' keyword.

Command Options:
  -h, --help  Show this help message.

Commands:
  enumerate     List the instances of a class.
  get           Get an instance of a class.
  delete        Delete an instance of a class.
  create        Create an instance of a class in a namespace.
  modify        Modify properties of an instance.
  associators   List the instances associated with an instance.
  references    List the instances referencing an instance.
  invokemethod  Invoke a method on an instance.
  query         Execute a query on instances in a namespace.
  count         Count the instances of each class with matching class name.
  shrub         Show the association shrub for INSTANCENAME.
pywbemcli instance associators –help

Help text for pywbemcli instance associators (see instance associators command):

Usage: pywbemcli [GENERAL-OPTIONS] instance associators INSTANCENAME [COMMAND-OPTIONS]

  List the instances associated with an instance.

  List the CIM instances that are associated with the specified CIM instance, and display the returned instances, or
  instance paths if --names-only was specified.

  For information on how to specify the instance using INSTANCENAME and the --key and --namespace options, invoke with
  --help-instancename.

  The instances to be retrieved can be filtered by the --filter-query, --role, --result-role, --assoc-class, and
  --result-class options.

  The --include-qualifiers, --include-classorigin, and --propertylist options determine which parts are included in each
  retrieved instance.

  The --names-only option can be used to show only the instance paths.

  In the output, the instances and instance paths will be formatted as defined by the --output-format general option.
  Table formats on instances will be replaced with MOF format.

Command Options:
  --ac, --assoc-class CLASSNAME   Filter the result set by association class name. Subclasses of the specified class
                                  also match.
  --rc, --result-class CLASSNAME  Filter the result set by result class name. Subclasses of the specified class also
                                  match.
  -r, --role PROPERTYNAME         Filter the result set by source end role name.
  --rr, --result-role PROPERTYNAME
                                  Filter the result set by far end role name.
  --iq, --include-qualifiers      When traditional operations are used, include qualifiers in the returned instances.
                                  Some servers may ignore this option. By default, and when pull operations are used,
                                  qualifiers will never be included.
  --ico, --include-classorigin    Include class origin information in the returned instance(s). Some servers may ignore
                                  this option. Default: Do not include class origin information.
  --pl, --propertylist PROPERTYLIST
                                  Filter the properties included in the returned object(s). Multiple properties may be
                                  specified with either a comma-separated list or by using the option multiple times.
                                  Properties specified in this option that are not in the object(s) will be ignored. The
                                  empty string will include no properties. Default: Do not filter properties.
  --no, --names-only              Retrieve only the object paths (names). Default: Retrieve the complete objects
                                  including object paths.
  -k, --key KEYNAME=VALUE         Value for a key in keybinding of CIM instance name. May be specified multiple times.
                                  Allows defining keys without the issues of quotes. Default: No keybindings provided.
  -n, --namespace NAMESPACE(s)    Namespace(s) to use for this command, instead of the default connection namespace. May
                                  be specified multiple times using either the option multiple times and/or comma
                                  separated list. Default: connection default namespace.
  -s, --summary                   Show only a summary (count) of the objects.
  --fq, --filter-query QUERY-STRING
                                  When pull operations are used, filter the instances in the result via a filter query.
                                  By default, and when traditional operations are used, no such filtering takes place.
  --fql, --filter-query-language QUERY-LANGUAGE
                                  The filter query language to be used with --filter-query. Default: DMTF:FQL.
  --show-null                     In the TABLE output formats, show properties with no value (i.e. Null) in all of the
                                  instances to be displayed. Otherwise only properties at least one instance has a non-
                                  Null property are displayed
  --hi, --help-instancename       Show help message for specifying INSTANCENAME including use of the --key and
                                  --namespace options.
  --object-order                  Order the objects by object before namespace. Only applies when multiple namespaces
                                  defined.
  -h, --help                      Show this help message.
pywbemcli instance count –help

Help text for pywbemcli instance count (see instance count command):

Usage: pywbemcli [GENERAL-OPTIONS] instance count CLASSNAME-GLOB [COMMAND-OPTIONS]

  Count the instances of each class with matching class name.

  Display the count of instances of each CIM class whose class name matches the specified wildcard expression
  (CLASSNAME-GLOB) in all CIM namespaces of the WBEM server, or in the specified namespaces (--namespace option).  This
  differs from instance enumerate, etc. in that it counts the instances specifically for the classname of each instance
  returned, not including subclasses.

  The CLASSNAME-GLOB argument is a wildcard expression that is matched on class names case insensitively. The special
  characters from Unix file name wildcarding are supported ('*' to match zero or more characters, '?' to match a single
  character, and '[]' to match character ranges). To avoid shell expansion of wildcard characters, the CLASSNAME-GLOB
  argument should be put in quotes.

  If CLASSNAME-GLOB is not specified, then all classes in the specified namespaces are counted (same as when specifying
  CLASSNAME-GLOB as "*").

  For example, "pywbem_*" returns classes whose name begins with "PyWBEM_", "pywbem_", etc. "*system*" returns classes
  whose names include the case insensitive string "system".

  If a CIMError occurs on any enumerate, it is flagged with a warning message and the search for instances continues.
  If an Error exception occurs (ex. Connection error) the scan is terminated under the assumption that the server may
  have failed and the remaining items are shown as "Not scanned".

  This command can take a long time to execute since it potentially enumerates all instance names for all classes in all
  namespaces.

Command Options:
  -n, --namespace NAMESPACE(s)    Namespace(s) for search scope. May be specified multiple times using either the option
                                  multiple times and/or comma separated list. Default: Search in all namespaces of the
                                  server.
  -s, --sort                      Sort by instance count. Otherwise sorted by class name.
  --ignore-class CLASSNAME        Class names of classes to be ignored (not counted). Allows counting instances in
                                  servers where instance retrieval may cause a CIMError or Error exception on some
                                  classes. CIM errors on particular classes are ignored. Error exceptions cause scan to
                                  stop and remaining classes status shown as 'not scanned'. Multiple class names are
                                  allowed (one per option or comma-separated).
  --association / --no-association
                                  Filter the returned classes to return only indication classes (--association) or
                                  classes that are not associations(--no-association). If the option is not defined no
                                  filtering occurs
  --indication / --no-indication  Filter the returned classes to return only indication classes (--indication) or
                                  classes that are not indications (--no-indication). If the option is not defined no
                                  filtering occurs
  --experimental / --no-experimental
                                  Filter the returned classes to return only experimental classes (--experimental) or
                                  classes that are not experimental (--no-iexperimental). If the option is not defined
                                  no filtering occurs
  --deprecated / --no-deprecated  Filter the returned classes to return only deprecated classes (--deprecated) or
                                  classes that are not deprecated (--no-deprecated). If the option is not defined no
                                  filtering occurs
  --since VERSION                 Filter the returned classes to return only classes  with a version qualifier ge the
                                  supplied string. The string must define a version of the form M.N.V consistent the
                                  definitions of the VERSION qualifier.
  --schema SCHEMA                 Filter the returned classes to return only classes where the classname scheme
                                  component (characters before the "_" match the scheme provided.
  --subclass-of CLASSNAME         Filter the returned classes to return only classes that are a subclass of the option
                                  value.
  --leaf-classes                  Filter the returned classes to return only leaf (classes; classes with no subclass.
  -h, --help                      Show this help message.
pywbemcli instance create –help

Help text for pywbemcli instance create (see instance create command):

Usage: pywbemcli [GENERAL-OPTIONS] instance create CLASSNAME [COMMAND-OPTIONS]

  Create an instance of a class in a namespace.

  Create a CIM instance of the specified creation class (CLASSNAME argument) in the specified CIM namespace (--namespace
  option), with the specified properties (--property options) and display the CIM instance path of the created instance.
  If no namespace was specified, the default namespace of the connection is used.

  The properties to be initialized and their new values are specified using the --property option, which may be
  specified multiple times.

  Pywbemcli retrieves the class definition from the server in order to verify that the specified properties are
  consistent with the property characteristics in the class definition.

  Example:

    pywbemcli instance create CIM_blah -P id=3 -P arr="bla bla",foo

Command Options:
  -p, --property PROPERTYNAME=VALUE
                                  Initial property value for the new instance. May be specified multiple times. Array
                                  property values are specified as a comma-separated list; embedded instances are not
                                  supported. Default: No initial properties provided.
  -V, --verify                    Prompt for confirmation before performing a change, to allow for verification of
                                  parameters. Default: Do not prompt for confirmation.
  -n, --namespace NAMESPACE       Namespace to use for this command, instead of the default namespace of the connection.
  -h, --help                      Show this help message.
pywbemcli instance delete –help

Help text for pywbemcli instance delete (see instance delete command):

Usage: pywbemcli [GENERAL-OPTIONS] instance delete INSTANCENAME [COMMAND-OPTIONS]

  Delete an instance of a class.

  WARNING: Deletion of instances will cause the removal of corresponding resources in the managed environment (i.e. in
  the real world). Some instances may not be deletable.

  For information on how to specify the instance using INSTANCENAME and the --key and --namespace options, invoke with
  --help-instancename.

Command Options:
  -k, --key KEYNAME=VALUE    Value for a key in keybinding of CIM instance name. May be specified multiple times. Allows
                             defining keys without the issues of quotes. Default: No keybindings provided.
  -n, --namespace NAMESPACE  Namespace to use for this command, instead of the default namespace of the connection.
  --hi, --help-instancename  Show help message for specifying INSTANCENAME including use of the --key and --namespace
                             options.
  -h, --help                 Show this help message.
pywbemcli instance enumerate –help

Help text for pywbemcli instance enumerate (see instance enumerate command):

Usage: pywbemcli [GENERAL-OPTIONS] instance enumerate CLASSNAME [COMMAND-OPTIONS]

  List the instances of a class.

  Enumerate the CIM instances of the specified class (CLASSNAME argument), including instances of subclasses in the
  specified CIM namespace(s) (--namespace option), and display the returned instances, or instance paths if --names-only
  was specified. If no namespace was specified, the default namespace of the connection is used.

  The instances to be retrieved can be filtered by the --filter-query option.

  The --local-only, --deep-inheritance, --include-qualifiers, --include-classorigin, and --propertylist options
  determine which parts are included in each retrieved instance.

  The --names-only option can be used to show only the instance paths.

  In the output, the instances and instance paths will be formatted as defined by the --output-format general option.
  Table formats on instances will be replaced with MOF format.

Command Options:
  --lo, --local-only              When traditional operations are used, do not include superclass properties in the
                                  returned instances. Some servers may ignore this option. By default, and when pull
                                  operations are used, superclass properties will always be included.
  --di, --deep-inheritance        Include subclass properties in the returned instances. Default: Do not include
                                  subclass properties.
  --iq, --include-qualifiers      When traditional operations are used, include qualifiers in the returned instances.
                                  Some servers may ignore this option. By default, and when pull operations are used,
                                  qualifiers will never be included.
  --ico, --include-classorigin    Include class origin information in the returned instance(s). Some servers may ignore
                                  this option. Default: Do not include class origin information.
  --pl, --propertylist PROPERTYLIST
                                  Filter the properties included in the returned object(s). Multiple properties may be
                                  specified with either a comma-separated list or by using the option multiple times.
                                  Properties specified in this option that are not in the object(s) will be ignored. The
                                  empty string will include no properties. Default: Do not filter properties.
  -n, --namespace NAMESPACE(s)    Namespace(s) to use for this command, instead of the default connection namespace. May
                                  be specified multiple times using either the option multiple times and/or comma
                                  separated list. Default: connection default namespace.
  --no, --names-only              Retrieve only the object paths (names). Default: Retrieve the complete objects
                                  including object paths.
  -s, --summary                   Show only a summary (count) of the objects.
  --fq, --filter-query QUERY-STRING
                                  When pull operations are used, filter the instances in the result via a filter query.
                                  By default, and when traditional operations are used, no such filtering takes place.
  --fql, --filter-query-language QUERY-LANGUAGE
                                  The filter query language to be used with --filter-query. Default: DMTF:FQL.
  --show-null                     In the TABLE output formats, show properties with no value (i.e. Null) in all of the
                                  instances to be displayed. Otherwise only properties at least one instance has a non-
                                  Null property are displayed
  --object-order                  Order the objects by object before namespace. Only applies when multiple namespaces
                                  defined.
  -h, --help                      Show this help message.
pywbemcli instance get –help

Help text for pywbemcli instance get (see instance get command):

Usage: pywbemcli [GENERAL-OPTIONS] instance get INSTANCENAME [COMMAND-OPTIONS]

  Get an instance of a class.

  For information on how to specify the instance using INSTANCENAME and the --key and --namespace options, invoke with
  --help-instancename.

  The --local-only, --include-qualifiers, --include-classorigin, and --propertylist options determine which parts are
  included in the retrieved instance.

  In the output, the instance will formatted as defined by the --output-format general option.

Command Options:
  --lo, --local-only              Do not include superclass properties in the returned instance. Some servers may ignore
                                  this option. Default: Include superclass properties.
  --iq, --include-qualifiers      Include qualifiers in the returned instance. Not all servers return qualifiers on
                                  instances. Default: Do not include qualifiers.
  --ico, --include-classorigin    Include class origin information in the returned instance(s). Some servers may ignore
                                  this option. Default: Do not include class origin information.
  --pl, --propertylist PROPERTYLIST
                                  Filter the properties included in the returned object(s). Multiple properties may be
                                  specified with either a comma-separated list or by using the option multiple times.
                                  Properties specified in this option that are not in the object(s) will be ignored. The
                                  empty string will include no properties. Default: Do not filter properties.
  -k, --key KEYNAME=VALUE         Value for a key in keybinding of CIM instance name. May be specified multiple times.
                                  Allows defining keys without the issues of quotes. Default: No keybindings provided.
  -n, --namespace NAMESPACE(s)    Namespace(s) to use for this command, instead of the default connection namespace. May
                                  be specified multiple times using either the option multiple times and/or comma
                                  separated list. Default: connection default namespace.
  --object-order                  Order the objects by object before namespace. Only applies when multiple namespaces
                                  defined.
  --hi, --help-instancename       Show help message for specifying INSTANCENAME including use of the --key and
                                  --namespace options.
  --show-null                     In the TABLE output formats, show properties with no value (i.e. Null) in all of the
                                  instances to be displayed. Otherwise only properties at least one instance has a non-
                                  Null property are displayed
  -h, --help                      Show this help message.
pywbemcli instance invokemethod –help

Help text for pywbemcli instance invokemethod (see instance invokemethod command):

Usage: pywbemcli [GENERAL-OPTIONS] instance invokemethod INSTANCENAME METHODNAME [COMMAND-OPTIONS]

  Invoke a method on an instance.

  Invoke a CIM method (METHODNAME argument) on a CIM instance with the specified input parameters (--parameter options),
  and display the method return value and output parameters.

  For information on how to specify the instance using INSTANCENAME and the --key and --namespace options, invoke with
  --help-instancename.

  The method input parameters are specified using the --parameter option, which may be specified multiple times.

  Pywbemcli retrieves the class definition of the creation class of the instance from the server in order to verify that
  the specified input parameters are consistent with the parameter characteristics in the method definition.

  Use the 'class invokemethod' command to invoke CIM methods on CIM classes.

  Example:

    pywbemcli -n myconn instance invokemethod CIM_x.id='hi" methodx -p id=3

Command Options:
  -p, --parameter PARAMETERNAME=VALUE
                                  Specify a method input parameter with its value. May be specified multiple times.
                                  Array property values are specified as a comma-separated list; embedded instances are
                                  not supported. Default: No input parameters.
  -k, --key KEYNAME=VALUE         Value for a key in keybinding of CIM instance name. May be specified multiple times.
                                  Allows defining keys without the issues of quotes. Default: No keybindings provided.
  -n, --namespace NAMESPACE       Namespace to use for this command, instead of the default namespace of the connection.
  --hi, --help-instancename       Show help message for specifying INSTANCENAME including use of the --key and
                                  --namespace options.
  -h, --help                      Show this help message.
pywbemcli instance modify –help

Help text for pywbemcli instance modify (see instance modify command):

Usage: pywbemcli [GENERAL-OPTIONS] instance modify INSTANCENAME [COMMAND-OPTIONS]

  Modify properties of an instance.

  For information on how to specify the instance using INSTANCENAME and the --key and --namespace options, invoke with
  --help-instancename.

  The properties to be modified and their new values are specified using the --property option, which may be specified
  multiple times.

  The --propertylist option allows restricting the set of properties to be modified. Given that the set of properties to
  be modified is already determined by the specified --property options, it does not need to be specified.

  Example:

    pywbemcli instance modify CIM_blah.fred=3 -P id=3 -P arr="bla bla",foo

Command Options:
  -p, --property PROPERTYNAME=VALUE
                                  Property to be modified, with its new value. May be specified once for each property
                                  to be modified. Array property values are specified as a comma-separated list;
                                  embedded instances are not supported. Default: No properties modified.
  --pl, --propertylist PROPERTYLIST
                                  Reduce the properties to be modified (as per --property) to a specific property list.
                                  Multiple properties may be specified with either a comma-separated list or by using
                                  the option multiple times. The empty string will cause no properties to be modified.
                                  Default: Do not reduce the properties to be modified.
  -V, --verify                    Prompt for confirmation before performing a change, to allow for verification of
                                  parameters. Default: Do not prompt for confirmation.
  -k, --key KEYNAME=VALUE         Value for a key in keybinding of CIM instance name. May be specified multiple times.
                                  Allows defining keys without the issues of quotes. Default: No keybindings provided.
  -n, --namespace NAMESPACE       Namespace to use for this command, instead of the default namespace of the connection.
  --hi, --help-instancename       Show help message for specifying INSTANCENAME including use of the --key and
                                  --namespace options.
  -h, --help                      Show this help message.
pywbemcli instance query –help

Help text for pywbemcli instance query (see instance query command):

Usage: pywbemcli [GENERAL-OPTIONS] instance query QUERY-STRING [COMMAND-OPTIONS]

  Execute a query on instances in a namespace.

  Execute the specified query (QUERY_STRING argument) in the specified CIM namespace (--namespace option), and display
  the returned instances. If no namespace was specified, the default namespace of the connection is used.

  In the output, the instances will formatted as defined by the --output-format general option.

Command Options:
  --ql, --query-language QUERY-LANGUAGE
                                  The query language to be used with --query. Default: DMTF:CQL.
  -n, --namespace NAMESPACE       Namespace to use for this command, instead of the default namespace of the connection.
  -s, --summary                   Show only a summary (count) of the objects.
  -h, --help                      Show this help message.
pywbemcli instance references –help

Help text for pywbemcli instance references (see instance references command):

Usage: pywbemcli [GENERAL-OPTIONS] instance references INSTANCENAME [COMMAND-OPTIONS]

  List the instances referencing an instance.

  List the CIM (association) instances that reference the specified CIM instance, and display the returned instances, or
  instance paths if --names-only was specified.

  For information on how to specify the instance using INSTANCENAME and the --key and --namespace options, invoke with
  --help-instancename.

  The instances to be retrieved can be filtered by the --filter-query, --role and --result-class options.

  The --include-qualifiers, --include-classorigin, and --propertylist options determine which parts are included in each
  retrieved instance.

  The --names-only option can be used to show only the instance paths.

  In the output, the instances and instance paths will be formatted as defined by the --output-format general option.
  Table formats on instances will be replaced with MOF format.

Command Options:
  --rc, --result-class CLASSNAME  Filter the result set by result class name. Subclasses of the specified class also
                                  match.
  -r, --role PROPERTYNAME         Filter the result set by source end role name.
  --iq, --include-qualifiers      When traditional operations are used, include qualifiers in the returned instances.
                                  Some servers may ignore this option. By default, and when pull operations are used,
                                  qualifiers will never be included.
  --ico, --include-classorigin    Include class origin information in the returned instance(s). Some servers may ignore
                                  this option. Default: Do not include class origin information.
  --pl, --propertylist PROPERTYLIST
                                  Filter the properties included in the returned object(s). Multiple properties may be
                                  specified with either a comma-separated list or by using the option multiple times.
                                  Properties specified in this option that are not in the object(s) will be ignored. The
                                  empty string will include no properties. Default: Do not filter properties.
  --no, --names-only              Retrieve only the object paths (names). Default: Retrieve the complete objects
                                  including object paths.
  -k, --key KEYNAME=VALUE         Value for a key in keybinding of CIM instance name. May be specified multiple times.
                                  Allows defining keys without the issues of quotes. Default: No keybindings provided.
  -n, --namespace NAMESPACE(s)    Namespace(s) to use for this command, instead of the default connection namespace. May
                                  be specified multiple times using either the option multiple times and/or comma
                                  separated list. Default: connection default namespace.
  -s, --summary                   Show only a summary (count) of the objects.
  --fq, --filter-query QUERY-STRING
                                  When pull operations are used, filter the instances in the result via a filter query.
                                  By default, and when traditional operations are used, no such filtering takes place.
  --show-null                     In the TABLE output formats, show properties with no value (i.e. Null) in all of the
                                  instances to be displayed. Otherwise only properties at least one instance has a non-
                                  Null property are displayed
  --fql, --filter-query-language QUERY-LANGUAGE
                                  The filter query language to be used with --filter-query. Default: DMTF:FQL.
  --hi, --help-instancename       Show help message for specifying INSTANCENAME including use of the --key and
                                  --namespace options.
  --object-order                  Order the objects by object before namespace. Only applies when multiple namespaces
                                  defined.
  -h, --help                      Show this help message.
pywbemcli instance shrub –help

Help text for pywbemcli instance shrub (see instance shrub command):

Usage: pywbemcli [GENERAL-OPTIONS] instance shrub INSTANCENAME [COMMAND-OPTIONS]

  Show the association shrub for INSTANCENAME.

  The shrub is a view of all of the instance association relationships for a defined INSTANCENAME showing the various
  components that are part of the association including Role, AssocClasse,ResultRole, And ResultClas

  The default view is a tree view from the INSTANCENAME to associated instances.

  Displays the shrub of association components for the association source instance defined by INSTANCENAME.

  For information on how to specify the instance using INSTANCENAME and the --key and --namespace options, invoke with
  --help-instancename.

  Normally the association information is displayed as a tree but it may also be displayed as a table or as one of the
  object formats (ex. MOF) of all instances that are part of the shrub if one of the cim object formats is selected with
  the global output_format parameter.

  Results are formatted as defined by the output format global option.

Command Options:
  --ac, --assoc-class CLASSNAME   Filter the result set by association class name. Subclasses of the specified class
                                  also match.
  --rc, --result-class CLASSNAME  Filter the result set by result class name. Subclasses of the specified class also
                                  match.
  -r, --role PROPERTYNAME         Filter the result set by source end role name.
  --rr, --result-role PROPERTYNAME
                                  Filter the result set by far end role name.
  -k, --key KEYNAME=VALUE         Value for a key in keybinding of CIM instance name. May be specified multiple times.
                                  Allows defining keys without the issues of quotes. Default: No keybindings provided.
  -n, --namespace NAMESPACE       Namespace to use for this command, instead of the default namespace of the connection.
  -s, --summary                   Show only a summary (count) of the objects.
  -f, --fullpath                  Normally the instance paths in the tree views are by hiding some keys with ~ to make
                                  the tree simpler to read. This includes keys that have the same value for all
                                  instances and the "CreationClassName" key.  Whenthis option is used the full instance
                                  paths are displayed.
  --hi, --help-instancename       Show help message for specifying INSTANCENAME including use of the --key and
                                  --namespace options.
  -h, --help                      Show this help message.

pywbemcli namespace –help

Help text for pywbemcli namespace (see namespace command group):

Usage: pywbemcli [GENERAL-OPTIONS] namespace COMMAND [ARGS] [COMMAND-OPTIONS]

  Command group for CIM namespaces.

  This command group defines commands to create, delete and list namespaces in a WBEM server.

  In addition to the command-specific options shown in this help text, the general options (see 'pywbemcli --help') can
  also be specified before the 'namespace' keyword.

Command Options:
  -h, --help  Show this help message.

Commands:
  list     List the namespaces of the server.
  create   Create a namespace on the server.
  delete   Delete a namespace from the server.
  interop  Get the Interop namespace of the server.
pywbemcli namespace create –help

Help text for pywbemcli namespace create (see namespace create command):

Usage: pywbemcli [GENERAL-OPTIONS] namespace create NAMESPACE [COMMAND-OPTIONS]

  Create a namespace on the server.

  Leading and trailing slash (``/``) characters specified in the NAMESPACE argument will be stripped.

  The namespace must not yet exist on the server.

  The Interop namespace must exist on the server and cannot be created using this command, because that namespace is
  required to implement client requests to manage namespaces.

  WBEM servers may not allow this operation or may severely limit the conditions under which a namespace can be created
  on the server.

  Example:

    pywbemcli -n myconn namespace create root/cimv2

Command Options:
  -h, --help  Show this help message.
pywbemcli namespace delete –help

Help text for pywbemcli namespace delete (see namespace delete command):

Usage: pywbemcli [GENERAL-OPTIONS] namespace delete NAMESPACE [COMMAND-OPTIONS]

  Delete a namespace from the server.

  Leading and trailing slash (``/``) characters specified in the NAMESPACE argument will be stripped.

  The Interop namespace must exist on the server and cannot be deleted using this command.

  The targeted namespace must exist on the server. If the namespace contains any objects (qualifier types, classes or
  instances), the command is rejected unless the --include-objects option is specified.

  If the --include-objects option is specified, the dependency order of classes is determined, and the instances are
  deleted first in that order, then the classes in that order, and at last the qualifier types. This ensures that no
  dangling dependencies remain at any point in the operation. Dependencies that are considered for this purpose are
  subclasses, referencing classes and embedding classes (EmbeddedInstance qualifier only). Cross-namespace associations
  are deleted in the targeted namespace and are assumed to be properly handled by the server in the other namespace.
  (i.e. to be cleaned up there as well without requiring a deletion by the client).

  WARNING: Deletion of instances will cause the removal of corresponding resources in the managed environment (i.e. in
  the real world). Some instances may not be deletable.

  WARNING: Deletion of classes or qualifier types can cause damage to the server: It can impact instance providers and
  other components in the server. WBEM servers may not allow the deletion of classes or qualifier declarations.

  WBEM servers may not allow deletion of namespaces or may severely limit the conditions under which a namespace can be
  deleted.

  Example:

    pywbemcli -n myconn namespace delete root/cimv2

Command Options:
  --include-objects  Delete any objects in the namespace as well. WARNING: Deletion of instances will cause the removal
                     of corresponding resources in the managed environment (i.e. in the real world). Default: Reject
                     command if the namespace has any objects.
  --dry-run          Enable dry-run mode: Do not actually delete the objects, but display what would be done.
  -h, --help         Show this help message.
pywbemcli namespace interop –help

Help text for pywbemcli namespace interop (see namespace interop command):

Usage: pywbemcli [GENERAL-OPTIONS] namespace interop [COMMAND-OPTIONS]

  Get the Interop namespace of the server.

  The Interop namespace must exist on the server.

Command Options:
  -h, --help  Show this help message.
pywbemcli namespace list –help

Help text for pywbemcli namespace list (see namespace list command):

Usage: pywbemcli [GENERAL-OPTIONS] namespace list [COMMAND-OPTIONS]

  List the namespaces of the server.

  The Interop namespace must exist on the server.

  Examples:

    pywbemcli -n myconn namespace list

Command Options:
  -h, --help  Show this help message.

pywbemcli profile –help

Help text for pywbemcli profile (see profile command group):

Usage: pywbemcli [GENERAL-OPTIONS] profile COMMAND [ARGS] [COMMAND-OPTIONS]

  Command group for WBEM management profiles.

  This command group defines commands to inspect and manage the WBEM management profiles maintained by the WBEM server.

  In addition to the command-specific options shown in this help text, the general options (see 'pywbemcli --help') can
  also be specified before the 'server' keyword.

Command Options:
  -h, --help  Show this help message.

Commands:
  list          List WBEM management profiles advertised by the server.
  centralinsts  List WBEM management profile central instances on the server.
pywbemcli profile centralinsts –help

Help text for pywbemcli profile centralinsts (see profile centralinsts command):

Usage: pywbemcli [GENERAL-OPTIONS] profile centralinsts [COMMAND-OPTIONS]

  List WBEM management profile central instances on the server.

  Retrieve the CIM instances that are central instances of the specified WBEM management profiles, and display these
  instances. By default, all management profiles advertized on the server are included. The profiles can be filtered by
  using the --organization and --profile options.

  The central instances are determined using all methodologies defined in DSP1033 V1.1 in the order of
  GetCentralInstances, central class, and scoping class methodology.

  Profiles that only use the scoping class methodology require the specification of the --central-class, --scoping-
  class, and --scoping-path options because additional information is needed to perform the scoping class methodology.

  The retrieved central instances are displayed along with the organization, name, and version of the profile they
  belong to, formatted as a table. The --output-format general option is ignored unless it specifies a table format.

Command Options:
  -o, --organization ORG-NAME     Filter by the defined organization. (ex. -o DMTF
  -p, --profile PROFILE-NAME      Filter by the profile name. (ex. -p Array
  --cc, --central-class CLASSNAME
                                  Optional. Required only if profiles supports only scoping methodology
  --sc, --scoping-class CLASSNAME
                                  Optional. Required only if profiles supports only scoping methodology
  --sp, --scoping-path CLASSLIST  Optional. Required only if profiles supports only scoping methodology. Multiples
                                  allowed
  --rd, --reference-direction [snia|dmtf]
                                  Navigation direction for association.  [default: dmtf]
  -h, --help                      Show this help message.
pywbemcli profile list –help

Help text for pywbemcli profile list (see Profile list command):

Usage: pywbemcli [GENERAL-OPTIONS] profile list [COMMAND-OPTIONS]

  List WBEM management profiles advertised by the server.

  Retrieve  the WBEM management profiles advertised by the WBEM server, and display information about each profile. WBEM
  management profiles are defined by DMTF and SNIA and define the management functionality that is available.

  The retrieved profiles can be filtered using the --organization and --profile options.

  The output is formatted as a table showing the organization, name, and version for each profile. The --output-format
  option is ignored unless it specifies a table format.

Command Options:
  -o, --organization ORG-NAME  Filter by the defined organization. (ex. -o DMTF
  -p, --profile PROFILE-NAME   Filter by the profile name. (ex. -p Array
  -h, --help                   Show this help message.

pywbemcli qualifier –help

Help text for pywbemcli qualifier (see qualifier command group):

Usage: pywbemcli [GENERAL-OPTIONS] qualifier COMMAND [ARGS] [COMMAND-OPTIONS]

  Command group for CIM qualifier declarations.

  This command group defines commands to inspect and delete CIM qualifier declarations in the WBEM Server.

  In addition to the command-specific options shown in this help text, the general options (see 'pywbemcli --help') can
  also be specified before the 'qualifier' keyword.

Command Options:
  -h, --help  Show this help message.

Commands:
  get        Get a qualifier declaration.
  delete     Delete a qualifier declaration.
  enumerate  List the qualifier declarations in a namespace.
pywbemcli qualifier delete –help

Help text for pywbemcli qualifier delete (see qualifier delete command):

Usage: pywbemcli [GENERAL-OPTIONS] qualifier delete QUALIFIERNAME [COMMAND-OPTIONS]

  Delete a qualifier declaration.

  Delete a CIM qualifier declaration (QUALIFIERNAME argument) in a CIM namespace (--namespace option). If no namespace
  was specified, the default namespace of the connection is used.

  This command executes the DeleteQualifier operation against the WBEM server and leaves it to the WBEM server to reject
  the operation if any classes in the namespace use the qualifier.

  In the output, the qualifier declaration will formatted as defined by the --output-format general option.

Command Options:
  -n, --namespace NAMESPACE  Namespace to use for this command, instead of the default namespace of the connection.
  -h, --help                 Show this help message.
pywbemcli qualifier enumerate –help

Help text for pywbemcli qualifier enumerate (see qualifier enumerate command):

Usage: pywbemcli [GENERAL-OPTIONS] qualifier enumerate [COMMAND-OPTIONS]

  List the qualifier declarations in a namespace.

  Enumerate the CIM qualifier declarations in the specified CIM namespace(s) (--namespace option). If no namespace was
  specified, the default namespace of the connection is used.

  In the output, the qualifier declaration will formatted as defined by the --output-format general option.

Command Options:
  -n, --namespace NAMESPACE(s)  Namespace(s) to use for this command, instead of the default connection namespace. May
                                be specified multiple times using either the option multiple times and/or comma
                                separated list. Default: connection default namespace.
  --object-order                Order the objects by object before namespace. Only applies when multiple namespaces
                                defined.
  -s, --summary                 Show only a summary (count) of the objects.
  -h, --help                    Show this help message.
pywbemcli qualifier get –help

Help text for pywbemcli qualifier get (see qualifier get command):

Usage: pywbemcli [GENERAL-OPTIONS] qualifier get QUALIFIERNAME [COMMAND-OPTIONS]

  Get a qualifier declaration.

  Get a CIM qualifier declaration (QUALIFIERNAME argument) in a CIM namespace (--namespace option). If no namespace was
  specified, the default namespace of the connection is used.

  In the output, the qualifier declaration will formatted as defined by the --output-format general option.

Command Options:
  -n, --namespace NAMESPACE(s)  Namespace(s) to use for this command, instead of the default connection namespace. May
                                be specified multiple times using either the option multiple times and/or comma
                                separated list. Default: connection default namespace.
  --object-order                Order the objects by object before namespace. Only applies when multiple namespaces
                                defined.
  -h, --help                    Show this help message.

pywbemcli repl –help

Help text for pywbemcli repl (see repl command):

Usage: pywbemcli [GENERAL-OPTIONS] repl

  Enter interactive mode (default).

  Enter the interactive mode where pywbemcli commands can be entered interactively. The prompt is changed to
  'pywbemcli>'.

  Command history is supported. The command history is stored in a file ~/.pywbemcli_history.

  Pywbemcli may be terminated from this mode by entering <CTRL-D>, :q, :quit, :exit

  In the repl mode, <CTRL-r> man be used to initiate an interactive search of the history file.

  Interactive mode also includes an autosuggest feature that makes suggestions from the command history as the command
  the user types in the command and options.

Command Options:
  -h, --help  Show this help message.

pywbemcli server –help

Help text for pywbemcli server (see server command group):

Usage: pywbemcli [GENERAL-OPTIONS] server COMMAND [ARGS] [COMMAND-OPTIONS]

  Command group for WBEM servers.

  This command group defines commands to inspect and manage core components of a WBEM server including server
  attributes, namespaces, compiling MOF, the Interop namespace and schema information.

  In addition to the command-specific options shown in this help text, the general options (see 'pywbemcli --help') can
  also be specified before the 'server' keyword.

Command Options:
  -h, --help  Show this help message.

Commands:
  brand       Get the brand of the server.
  info        Get information about the server.
  add-mof     Compile MOF and add/update CIM objects in the server.
  remove-mof  Compile MOF and remove CIM objects from the server.
  schema      Get information about the server schemas.
pywbemcli server add-mof –help

Help text for pywbemcli server add-mof (see server add-mof command):

Usage: pywbemcli [GENERAL-OPTIONS] server add-mof MOFFILE [COMMAND-OPTIONS]

  Compile MOF and add/update CIM objects in the server.

  The MOF files are specified with the MOFFILE argument, which may be specified multiple times. The minus sign ('-')
  specifies the standard input.

  Initially, the target namespace is the namespace specified with the --namespace option or if not specified the default
  namespace of the connection. If the MOF contains '#pragma namespace' directives, the target namespace will be changed
  accordingly.

  MOF include files (specified with the '#pragma include' directive) are searched first in the directory of the
  including MOF file, and then in the directories specified with the --include option.

  Any CIM objects (instances, classes and qualifiers) specified in the MOF files are created in the server, or modified
  if they already exist in the server.

  The global --verbose option will show the CIM objects that are created or modified.

Command Options:
  -n, --namespace NAMESPACE  Namespace to use for this command, instead of the default namespace of the connection.
  -I, --include INCLUDEDIR   Path name of a MOF include directory. May be specified multiple times.
  -d, --dry-run              Enable dry-run mode: Don't actually modify the server. Connection to the server is still
                             required for reading.
  -h, --help                 Show this help message.
pywbemcli server brand –help

Help text for pywbemcli server brand (see server brand command):

Usage: pywbemcli [GENERAL-OPTIONS] server brand [COMMAND-OPTIONS]

  Get the brand of the server.

  Brand information is defined by the server implementor and may or may not be available. Pywbem attempts to collect the
  brand information from multiple sources.

Command Options:
  -h, --help  Show this help message.
pywbemcli server info –help

Help text for pywbemcli server info (see server info command):

Usage: pywbemcli [GENERAL-OPTIONS] server info [COMMAND-OPTIONS]

  Get information about the server.

  The information includes CIM namespaces and server brand.

Command Options:
  -h, --help  Show this help message.
pywbemcli server remove-mof –help

Help text for pywbemcli server remove-mof (see server remove-mof command):

Usage: pywbemcli [GENERAL-OPTIONS] server remove-mof MOFFILE [COMMAND-OPTIONS]

  Compile MOF and remove CIM objects from the server.

  The MOF files are specified with the MOFFILE argument, which may be specified multiple times. The minus sign ('-')
  specifies the standard input.

  Initially, the target namespace is the namespace specified with the --namespace option or if not specified the default
  namespace of the connection. If the MOF contains '#pragma namespace' directives, the target namespace will be changed
  accordingly.

  MOF include files (specified with the '#pragma include' directive) are searched first in the directory of the
  including MOF file, and then in the directories specified with the --include option.

  Any CIM objects (instances, classes and qualifiers) specified in the MOF files are deleted from the server.

  The global --verbose option will show the CIM objects that are removed.

Command Options:
  -n, --namespace NAMESPACE  Namespace to use for this command, instead of the default namespace of the connection.
  -I, --include INCLUDEDIR   Path name of a MOF include directory. May be specified multiple times.
  -d, --dry-run              Enable dry-run mode: Don't actually modify the server. Connection to the server is still
                             required for reading.
  -h, --help                 Show this help message.
pywbemcli server schema –help

Help text for pywbemcli server schema (see server schema command):

Usage: pywbemcli [GENERAL-OPTIONS] server schema [COMMAND-OPTIONS]

  Get information about the server schemas.

  Gets information about the schemas and CIM schemas that define the classes in each namespace. The information provided
  includes:   * The released DMTF CIM schema version that was the source for the     qualifier declarations and classes
  for the namespace.   * Experimental vs. final elements in the schema   * Schema name (defined by the prefix on each
  class before the first '_')   * Class count

Command Options:
  -n, --namespace NAMESPACE  Namespace to use for this command, instead of the default namespace of the connection.
  -d, --detail               Display details about each schema in the namespace rather than accumulated for the
                             namespace.
  -h, --help                 Show this help message.

pywbemcli statistics –help

Help text for pywbemcli statistics (see statistics command group):

Usage: pywbemcli [GENERAL-OPTIONS] statistics COMMAND [ARGS] [COMMAND-OPTIONS]

  Command group for WBEM operation statistics.

  This command group defines commands to control the gathering and display of statistical data about the WBEM operations
  issued by pywbemcli or processed by a WBEM server.

  Pywbemcli maintains statistics about the WBEM operations it has issued. This includes the Client Time measured on the
  client side and the Server Time measured by the WBEM server and reported in the 'WBEMServerResponseTime' header field
  in the CIM-XML response (if supported by the WBEM server).

  The WBEM server may also support maintaining statistics about the WBEM operations it has processed (possibly by
  multiple clients). Pywbemcli supports enabling or disabling the statistics gathering on the WBEM server via the
  'GatherStatisticalData' property in the 'CIM_ObjectManager' instance for the WBEM server and supports retrieving and
  displaying the server maintained statistics.

  In addition to the command-specific options shown in this help text, the general options (see 'pywbemcli --help') can
  also be specified before the 'statistics' keyword.

Command Options:
  -h, --help  Show this help message.

Commands:
  reset        Reset client maintained statistics.
  server-on    Enable server maintained statistics.
  server-off   Disable server maintained statistics.
  server-show  Display server maintained statistics.
  show         Display client maintained statistics.
  status       Show enabled status of client and server maintained statistics.
pywbemcli statistics reset –help

Help text for pywbemcli statistics reset (see statistics reset command):

Usage: pywbemcli [GENERAL-OPTIONS] statistics reset [COMMAND-OPTIONS]

  Reset client maintained statistics.

  This command resets the counts in the statistics maintained by pywbemcli. This includes the server response times
  received from the WBEM server in the 'WBEMServerResponseTime' header field of the CIM-XML response, if supported and
  enabled.

  This command does not reset the server maintained statistics.

Command Options:
  -h, --help  Show this help message.
pywbemcli statistics server-off –help

Help text for pywbemcli statistics server-off (see statistics server-off command):

Usage: pywbemcli [GENERAL-OPTIONS] statistics server-off [COMMAND-OPTIONS]

  Disable server maintained statistics.

  This command deactivates the gathering of statistics in the current WBEM server and also deactivates the returning of
  server response times in the CIM-XML response for inclusion in the client maintained statistics, by setting the
  'GatherStatisticalData' property to False in the 'CIM_ObjectManager' instance for the WBEM server.

  This command fails if the server does not support gathering statistics or does not allow a client to modify the state
  of statistics gathering.

  This command does not affect the state of the client maintained statistics other than whether the server response
  times are included. See the '--timestats' general option for controlling the displaying of client maintained
  statistics.

Command Options:
  -h, --help  Show this help message.
pywbemcli statistics server-on –help

Help text for pywbemcli statistics server-on (see statistics server-on command):

Usage: pywbemcli [GENERAL-OPTIONS] statistics server-on [COMMAND-OPTIONS]

  Enable server maintained statistics.

  This command activates the gathering of statistics in the current WBEM server and also activates the returning of
  server response times in the CIM-XML response for inclusion in the client maintained statistics, by setting the
  'GatherStatisticalData' property to True in the 'CIM_ObjectManager' instance for the WBEM server.

  This command fails if the server does not support gathering statistics or does not allow a client to modify the state
  of statistics gathering.

  This command does not affect the state of the client maintained statistics other than whether the server response
  times are included. See the '--timestats' general option for controlling the displaying of client maintained
  statistics.

Command Options:
  -h, --help  Show this help message.
pywbemcli statistics server-show –help

Help text for pywbemcli statistics server-show (see statistics server-show command):

Usage: pywbemcli [GENERAL-OPTIONS] statistics server-show [COMMAND-OPTIONS]

  Display server maintained statistics.

  Retrieve and display the statistics gathered by the current WBEM server. This requires statistics gathering to be
  enabled on the server (see 'statistics server-on' command).

  This command fails if the server does not support gathering statistics.

  These statistics are independent of the client maintained statistics which can be displayed with the command
  'statistics show'.

Command Options:
  -h, --help  Show this help message.
pywbemcli statistics show –help

Help text for pywbemcli statistics show (see statistics show command):

Usage: pywbemcli [GENERAL-OPTIONS] statistics show [COMMAND-OPTIONS]

  Display client maintained statistics.

  Display the statistics gathered by pywbemcli. This includes the server response times received from the WBEM server in
  the 'WBEMServerResponseTime' header field of the CIM-XML response, if supported and enabled.

  These statistics are independent of the server maintained statistics which can be displayed with the command
  'statistics server-show'.

Command Options:
  -h, --help  Show this help message.
pywbemcli statistics status –help

Help text for pywbemcli statistics status (see statistics status command):

Usage: pywbemcli [GENERAL-OPTIONS] statistics status [COMMAND-OPTIONS]

  Show enabled status of client and server maintained statistics.

  Show the enabled status for displaying the statistics gathered by pywbemcli, and for gathering the statistics on the
  current WBEM server.

Command Options:
  -h, --help  Show this help message.

pywbemcli subscription –help

Help text for pywbemcli subscription (see subscription command group):

Usage: pywbemcli [GENERAL-OPTIONS] subscription COMMAND [ARGS] [COMMAND-OPTIONS]

  Command group to manage WBEM indication subscriptions.

  This group uses the pywbem subscription manager to create, view, and remove CIM Indication subscriptions for a WBEM
  Server.

  In addition to the command-specific options shown in this help text, the general options (see 'pywbemcli --help') can
  also be specified before the command. These are NOT retained after the command is executed.

Command Options:
  -h, --help  Show this help message.

Commands:
  add-destination      Add new listener destination.
  add-filter           Add new indication filter.
  add-subscription     Add new indication subscription.
  list                 Display indication subscriptions overview.
  list-destinations    Display indication listeners on the WBEM server.
  list-filters         Display indication filters on the WBEM server.
  list-subscriptions   Display indication subscriptions on the WBEM server.
  remove-destination   Remove a listener destination from the WBEM server.
  remove-filter        Remove an indication filter from the WBEM server.
  remove-subscription  Remove indication subscription from the WBEM server.
  remove-server        Remove current WBEM server from the SubscriptionManager.
pywbemcli subscription add-destination –help

Help text for pywbemcli subscription add-destination (see subscription add-destination command):

Usage: pywbemcli [GENERAL-OPTIONS] subscription add-destination IDENTITY [COMMAND-OPTIONS]

  Add new listener destination.

  This command adds a listener destination to be the target of indications sent by a WBEM server a WBEM server, by
  adding an instance of the CIM class "CIM_ListenerDestinationCIMXML" in the Interop namespace of the WBEM server.

  A listener destination defines the target of a WBEM indication listener including URI of the listener including the
  listener port.

  The required IDENTITY argument along with the --owned/--permanent option define the ``Name`` key property of the new
  instance.  If the instance is to be owned by the current SubscriptionManager, pywbemcli creates a 'Name' property
  value with the format: "pywbemdestination:" <SubscriptionManagerID> ":" <IDENTITY>. If the destination instance is to
  be permanent, the value of the IDENTITY argument becomes the value of the 'Name' property.

  Owned destinations are added or updated conditionally: If the destination instance to be added is already registered
  with this subscription manager and has the same property values, it is not created or modified. If an instance with
  this path and properties does not exist yet (the normal case), it is created on the WBEM server.

  Permanent listener destinations are created unconditionally, and it is up to the user to ensure that such an instance
  does not already exist.

  If the --verbose general option is set, the created instance is displayed.

Command Options:
  -l, --listener-url URL  Defines the URL of the target listener in the format: [SCHEME://]HOST:PORT. SCHEME must be
                          "https" (default) or "http". HOST is a short or long hostname or literal IPV4/v6 address. PORT
                          is a positive integer and is required
  --owned / --permanent   Defines whether an owned or permanent filter, destination, or subscription is to be added.
                          Default: owned
  -h, --help              Show this help message.
pywbemcli subscription add-filter –help

Help text for pywbemcli subscription add-filter (see subscription add-filter command):

Usage: pywbemcli [GENERAL-OPTIONS] subscription add-filter IDENTITY [COMMAND-OPTIONS]

  Add new indication filter.

  This command adds an indication filter to a WBEM server, by creating an indication filter instance (CIM class
  "CIM_IndicationFilter") in the Interop namespace of the server.

  A indication listener defines the query and query language to be used by the WBEM server to create indications for an
  indication subscription.

  The required IDENTITY argument of the command and the --owned/--permanent option defines the 'Name' key property of
  the the created instance.  If the the instance is to be owned by the current SubscriptionManager, pywbemcli indirectly
  specifies the 'Name' property value with the format: "pywbemfilter:" "<SubscriptionManagerID>" ":" <identity>``. If
  the destination instance is to be permanent, the value of the IDENTITY argument directly becomes the value of the Name
  property.

  Owned indication filters are added or updated conditionally: If the indication filter instance to be added is already
  registered with this subscription manager and has the same property values, it is not created or modified. If it has
  the same path but different property values, it is modified to get the desired property values. If an instance with
  this path does not exist yet (the normal case), it is created.

  Permanent indication filters are created unconditionally; it is up to the user to ensure that such an instance does
  not exist yet.

  If the --verbose general option is set, the created instance is displayed.

Command Options:
  -q, --query FILTER        Filter query definition. This is a SELECT statement in the query language defined in the
                            filter-query-language parameter  [required]
  --query-language TEXT     Filter query language for this subscription The query languages normally implemented are
                            'DMTF:CQL' and 'WQL' .  Default: WQL
  --source-namespaces TEXT  The namespace(s) for which the query is defined. Multiple values may be defined with a
                            single comma-separated string of namespaces or multiple options. If defined the namespaces
                            will be inserted into the SourceNamespaces property. Otherwise the property will not be
                            created and the WBEM server typically use the Interop namespace for the indication filter.
  --owned / --permanent     Defines whether an owned or permanent filter, destination, or subscription is to be added.
                            Default: owned
  -h, --help                Show this help message.
pywbemcli subscription add-subscription –help

Help text for pywbemcli subscription add-subscription (see subscription add-subscription command):

Usage: pywbemcli [GENERAL-OPTIONS] subscription add-subscription DESTINATIONID FILTERID [COMMAND-OPTIONS]

  Add new indication subscription.

  Adds an indication subscription to the current WBEM server for a particular DESTINATIONID and FILTERID. The command
  creates an instance of CIM association class "CIM_IndicationSubscription" in the Interop namespace of the server.

  The destination and filter instances to be used in the subscription is based on the DESTINATIONID and FILTERID
  arguments which define the the 'Handler' and 'Filter' reference properties of the subscription instance to be created.

  The required DESTINATIONID argument defines the existing destination instance that will be attached to the 'Handler'
  reference of the association class. This argument may consist of either the value of the 'Name' property of the target
  destination instance or the identity of that instance.  The identity is the full value of the 'Name' property for
  permanent destinations and is a component of the 'Name' property for owned instances. If just the identity is used,
  this will result in multiple destinations being found if the same string is defined as the identity of an owned and
  permanent destination.

  The required FILTERID argument defines the existing filter instance that will be attached to the 'Filter' reference of
  the association class. This argument may consist of either the value of the 'Name' property of the target filter
  instance or the identity of that instance.  The identity is the full value of the 'Name' property for permanent
  filters and is a component of the 'Name' property for owned instances. If just the identity is used, this will result
  in multiple filters being found if the same string is defined as the identity of an owned and permanent filter.

  When creating permanent subscriptions, the indication filter and the listener destinations must not be owned. for
  owned subscriptions, indication filter and listener destination may be either owned or permanent.

  Owned subscriptions are added or updated conditionally: If the subscription instance to be added is already registered
  with this subscription manager and has the same path, it is not created.

  Permanent subscriptions are created unconditionally, and it is up to the user to ensure that such an instance does not
  already exist.

  Upon successful return of this method, the added subscription is active on the WBEM server, so that the specified WBEM
  listeners may immediately receive indications.

  If the --verbose general option is set, the created instance is displayed.

Command Options:
  --owned / --permanent  Defines whether an owned or permanent filter, destination, or subscription is to be added.
                         Default: owned
  --select               Prompt user to select from multiple objects that match the IDENTITY. Otherwise, if the command
                         finds multiple instance that match the IDENTITY, the operation fails.
  -h, --help             Show this help message.
pywbemcli subscription list –help

Help text for pywbemcli subscription list (see subscription list command):

Usage: pywbemcli [GENERAL-OPTIONS] subscription list [COMMAND-OPTIONS]

  Display indication subscriptions overview.

  This command provides an overview of the count of subscriptions, filters, and destinations retrieved from the WBEM
  server. The level of detail depends on the --summary and --detail options. '--summary' displays only a single count
  for each; --detail displays a table for the instances of each. The default is to display a table of the count of owned
  and permanent for each.

Command Options:
  --type [owned|permanent|all]  Defines whether the command filters owned,  permanent, or all objects for the response.
                                Default: all
  -s, --summary                 Show only summary count of instances. This option is mutually exclusive with options:
                                (--detail, --names-only).
  -d, --detail                  Show more detailed information. Otherwise only non-null or predefined property values
                                are displayed. It applies to both MOF and TABLE output formats. This option is mutually
                                exclusive with options: (--names-only, --summary).
  -h, --help                    Show this help message.
pywbemcli subscription list-destinations –help

Help text for pywbemcli subscription list-destinations (see subscription list-destinations command):

Usage: pywbemcli [GENERAL-OPTIONS] subscription list-destinations [COMMAND-OPTIONS]

  Display indication listeners on the WBEM server.

  Display existing CIM indication listener destinations on the current connection. The listener destinations to be
  displayed can be filtered by the owned choice option (owned, permanent, all).

  The data display is determined by the --detail, --names_only, and --summary options and can be displayed as either a
  table or CIM objects (ex. mof) format using the --output general option (ex. --output mof).

Command Options:
  --type [owned|permanent|all]  Defines whether the command filters owned,  permanent, or all objects for the response.
                                Default: all
  -d, --detail                  Show more detailed information. Otherwise only non-null or predefined property values
                                are displayed. It applies to both MOF and TABLE output formats. This option is mutually
                                exclusive with options: (--names-only, --summary).
  --names-only, --no            Show the CIMInstanceName elements of the instances. This only applies when the --output-
                                format is one of the CIM object options (ex. mof. This option is mutually exclusive with
                                options: (--detail, --summary).
  -s, --summary                 Show only summary count of instances. This option is mutually exclusive with options:
                                (--detail, --names-only).
  -h, --help                    Show this help message.
pywbemcli subscription list-filters –help

Help text for pywbemcli subscription list-filters (see subscription list-filters command):

Usage: pywbemcli [GENERAL-OPTIONS] subscription list-filters [COMMAND-OPTIONS]

  Display indication filters on the WBEM server.

  Display existing CIM indication filters (CIM_IndicationFilter class) on the current connection. The indication filters
  to be displayed can be filtered by the owned choice option (owned, permanent, all).

  The data display is determined by the --detail, --names-only, and --summary options and can be displayed as either a
  table or CIM objects (ex. mof) format using the --output general option (ex. --output mof).

Command Options:
  --type [owned|permanent|all]  Defines whether the command filters owned,  permanent, or all objects for the response.
                                Default: all
  -d, --detail                  Show more detailed information. Otherwise only non-null or predefined property values
                                are displayed. It applies to both MOF and TABLE output formats. This option is mutually
                                exclusive with options: (--names-only, --summary).
  --names-only, --no            Show the CIMInstanceName elements of the instances. This only applies when the --output-
                                format is one of the CIM object options (ex. mof. This option is mutually exclusive with
                                options: (--detail, --summary).
  -s, --summary                 Show only summary count of instances. This option is mutually exclusive with options:
                                (--detail, --names-only).
  -h, --help                    Show this help message.
pywbemcli subscription list-subscriptions –help

Help text for pywbemcli subscription list-subscriptions (see subscription list-subscriptions command):

Usage: pywbemcli [GENERAL-OPTIONS] subscription list-subscriptions [COMMAND-OPTIONS]

  Display indication subscriptions on the WBEM server.

  Displays information on indication subscriptions on the WBEM server, filtering the subscriptions to be displayed can
  be filtered by the owned choice option (owned, permanent, all).

  The default display is a table of information from the associated Filter and Handler instances

  The data display is determined by the --detail, --names-only, and --summary options and can be displayed as either a
  table or CIM objects (ex. mof) format using the --output general option (ex. --output mof).

Command Options:
  --type [owned|permanent|all]  Defines whether the command filters owned,  permanent, or all objects for the response.
                                Default: all
  -d, --detail                  Show more detailed information including MOF of referenced listeners and filters.
                                Otherwise only non-null or predefined property values are displayed. The extra
                                properties applies to both MOF and TABLE output formats. This option is mutually
                                exclusive with options: (--names-only, --summary).
  --names-only, --no            Show the CIMInstanceName elements of the instances. This only applies when the --output-
                                format is one of the CIM object options (ex. mof. This option is mutually exclusive with
                                options: (--detail, --summary).
  -s, --summary                 Show only summary count of instances. This option is mutually exclusive with options:
                                (--detail, --names-only).
  -h, --help                    Show this help message.
pywbemcli subscription remove-destination –help

Help text for pywbemcli subscription remove-destination (see subscription remove-destination command):

Usage: pywbemcli [GENERAL-OPTIONS] subscription remove-destination IDENTITY [COMMAND-OPTIONS]

  Remove a listener destination from the WBEM server.

  Removes a listener destination instance (CIM_ListenerDestinationCIMXML) from the WBEM server where the instance to be
  removed is identified by the IDENTITY argument and optional owned option of the command.

  The required IDENTITY argument may be the value of the IDENTITY used to create the destination or may be the full
  value of the destination 'Name' property. This is the value of the 'Name' property for permanent destinations and a
  component of the 'Name' property for owned destinations.

  If the instance is owned by the current pywbem SubscriptionManager, pywbemcli indirectly specifies the Name property
  value with the format: "pywbemdestination:" "<SubscriptionManagerID>" ":" <IDENTITY>``. If the destination instance is
  permanent, the value of the IDENTITY argument is the value of the Name property.

  Some listener_destination instances on a server may be static in which case the server should generate an exception.
  Pywbemcli has no way to identify these static destinations and they will appear as permanent destination instances.

  The --select option can be used if, for some reason, the IDENTITY and ownership returns multiple instances. This
  should only occur in rare cases where destination instances have been created by other tools. If the --select option
  is not used pywbemcli displays the paths of the instances and terminates the command.

Command Options:
  --owned / --permanent  Defines whether an owned or permanent filter, destination, or subscription is to be removed.
                         Default: owned
  --select               Prompt user to select from multiple objects that match the IDENTITY. Otherwise, if the command
                         finds multiple instance that match the IDENTITY, the operation fails.
  -h, --help             Show this help message.
  -v, --verify           Prompt user to verify instances to be removed before request is sent to WBEM server.
pywbemcli subscription remove-filter –help

Help text for pywbemcli subscription remove-filter (see subscription remove-filter command):

Usage: pywbemcli [GENERAL-OPTIONS] subscription remove-filter IDENTITY [COMMAND-OPTIONS]

  Remove an indication filter from the WBEM server.

  Removes a single indication filter instance (CIM_IndicationFilter class) from the WBEM server where the instance to be
  removed is identified by the IDENTITY argument and optional --owned option of the command.

  The required IDENTITY argument may be the value of the IDENTITY used to create the filter or may be the full value of
  the filter Name property. For permanent filters the value of the Name property is required; for owned destinations the
  IDENTITY component of the Name property is sufficient.

  If the instance is owned by the current pywbem SubscriptionManager, pywbemcli indirectly specifies the Name property
  value with the format: "pywbemfilter:" "<SubscriptionManagerID>" ":" <IDENTITY>``. If the destination instance is
  permanent, the value of the IDENTITY argument is the value of the Name property.

  The --select option can be used if, the IDENTITY and ownership returns multiple instances. This should only occur in
  rare cases where filter instances have been created by other tools. If the --select option is not used pywbemcli
  displays the paths of the instances and terminates the command.

Command Options:
  --owned / --permanent  Defines whether an owned or permanent filter, destination, or subscription is to be removed.
                         Default: owned
  --select               Prompt user to select from multiple objects that match the IDENTITY. Otherwise, if the command
                         finds multiple instance that match the IDENTITY, the operation fails.
  -v, --verify           Prompt user to verify instances to be removed before request is sent to WBEM server.
  -h, --help             Show this help message.
pywbemcli subscription remove-server –help

Help text for pywbemcli subscription remove-server (see Subscription remove-server command):

Usage: pywbemcli [GENERAL-OPTIONS] subscription remove-server [COMMAND-OPTIONS]

  Remove current WBEM server from the SubscriptionManager.

  This command unregisters owned listeners from the WBEM server and removes all owned indication subscriptions, owned
  indication filters, and owned listener destinations for this server-id from the WBEM server.

Command Options:
  -h, --help  Show this help message.
pywbemcli subscription remove-subscription –help

Help text for pywbemcli subscription remove-subscription (see subscription remove-subscription command):

Usage: pywbemcli [GENERAL-OPTIONS] subscription remove-subscription DESTINATIONID FILTERID [COMMAND-OPTIONS]

  Remove indication subscription from the WBEM server.

  This command removes an indication subscription instance from the WBEM server.

  The selection of subscription to be removed is defined by the DESTINATIONID and FILTERID arguments which define the
  Name property of the destination and filter associations of the subscription to be removed.

  The required DESTINATIONID argument defines the existing destination instance that will be attached to the Filter
  reference of the association class. This argument may consist of either the value of the Name property of the target
  destination instance or the identity of that instance.  The identity is the full value of the Name property for
  permanent destinations and is a component of the Name property for owned instances. If just the identity is used, this
  will result in multiple destinations being found if the same string is defined as the identity of an owned and
  permanent destination.

  The required FILTERID argument defines the existing filter instance that will be attached to the 'Filter' reference of
  the association class. This argument may consist of either the value of the 'Name' property of the target filter
  instance or the identity of that instance.  The identity is the full value of the 'Name' property for permanent
  filters and is a component of the 'Name' property for owned instances. If just the identity is used, this may result
  in multiple filters being found if the same string is defined as the identity of an owned and permanent filter.

  This operation does not remove associated filter or destination instances unless the option --remove-associated-
  instances is included in the command and the associated instances are not used in any other association.

Command Options:
  -v, --verify                   Prompt user to verify instances to be removed before request is sent to WBEM server.
  --remove-associated-instances  Attempt to remove the instances associated with this subscription. They will only be
                                 removed if they do not participate in any other associations.
  --select                       Prompt user to select from multiple objects that match the IDENTITY. Otherwise, if the
                                 command finds multiple instance that match the IDENTITY, the operation fails.
  -h, --help                     Show this help message.

Mock WBEM Server

Mock WBEM server overview

pywbemcli implements an in-process Mock WBEM Server using the pywbem Mock WBEM server which defines the mock environment. The mock sever provides WBEM server responses to pywbmcli commands. The configuration and contents of the mock server are defined by the pywbemcli --mock-server general option.

Pywbemcli starts the mock WBEM server when either the pywbemcli --mock-server general option or the --name general option defining a mock environment is executed. The mock server and its CIM repository are in the pywbemcli process in the pywbemcli process so its life-cycle is the life-cycle of a single pywbemcli execution (command line or interactive session) and it must be recreated or restored from cache using the --name general option (if the connection definition was saved)

The mock server environment can include CIM namespaces, CIM classes, CIM instances, CIM qualifier declarations, CIM instances, and mock CIM providers. This allows executing pywbemcli commands against the mock WBEM server that is created in pywbemcli rather than a real WBEM server.

The --mock-server general option is mutually exclusive with the --server general option and --name general option, since each defines a target WBEM server.

The created mock WBEM server has an in-memory repository for the CIM objects defined by the MOF/script (qualifier declarations, classes, and instances) and supports CIM namespaces. The operations performed against the mock WBEM server cause that mock repository to be inspected (ex. class enumerate) or manipulated (ex.``instance create ….``) accordingly.

The mock repository can be defined and created with CIM objects from files specified as an argument to the --mock-server general option. Each use of the option specifies one file path. The option may be used multiple times and each specified file is processed sequentially, in the sequence of the options on the command line.

pywbemcli supports the following file types for the --mock-server option:

  • MOF files: If the file extension is .mof, the file is considered a MOF file and must be compilable with the pywbem MOF compiler and the MOF syntax defined by the DMTF in DSP0004. Pywbemcli compiles the MOF in the file and adds the resulting pywbem CIM objects to the mock repository.

    The following is a very simple example that creates the qualdecls.mof file with two qualifier declarations and then defines the mock server withthis file execution of the command qualifier enumerate:

    cat <<EOT >> gualdecls.mof
    
    Qualifier Abstract : boolean = false,
    Scope(class, association, indication),
    Flavor(EnableOverride, Restricted);
    
    Qualifier Aggregate : boolean = false,
    Scope(reference),
    Flavor(DisableOverride, ToSubclass);
    EOT
    
    pywbemcli -m qualdecl.mof qualifier enumerate
    
    Qualifier Abstract : boolean = false,
        Scope(class, association, indication),
        Flavor(EnableOverride, Restricted);
    
    Qualifier Aggregate : boolean = false,
        Scope(reference),
        Flavor(DisableOverride, ToSubclass);
    

    The MOF file may define CIM namespaces (#pragma namespace (“user”)), CIM qualifier declarations, CIM classes and CIM instances.

    Thus the MOF files can create mocks of complete multi-namespace environments including multiple namespaces, multiple classes, and instances including complete association instances using the pywbem MOF compiler instance alias construct.

    If a CIM object already exists in the repository, it is updated accordingly.

  • Mock scripts: If the file extension is .py, the file is considered a Python script and the script is executed as part of the startup of pywbemcli in the command line mode or upon the first command executed that communicates with a WBEM server in the interactive mode.

    Mock scripts can for example create Python objects of type CIMQualifierDeclaration, CIMClass and CIMInstance for representing CIM objects, and add them to the mock repository via calls to add_cimobjects().

    Mock scripts can install user-defined providers (see User-defined providers) and register these providers with the mock WBEM server using register_provider().

    Since the mock repository created by mock scripts and MOF files can be cached, pywbemcli can also make the decision on pywbemcli with the --name general option whether the script is to retrieved from the cache or recreated from the named connection definition. To do this, it needs knowledge of whether the files that make up the script have been modified since the cache of the repository was created. To do this the files that are used in the script have to be registered with the pywbem provider_dependent_registry. using add_dependents()

    Finally, mock scripts can be used to add or update CIM objects in the mock CIM repository. This is an alternative to specifying MOF files, and can be used for example to parse files defining the CIM objects for entire WBEM management profiles.

It is possible to mix MOF files and mock scripts by specifying the --mock-server general option multiple times.

Pywbemcli logging (see --log general option) can be used together with the mock support. Since the pywbem mock support does not use HTTP(S), only the “api” component in the log configuration string will generate any log output.

Setting up the mock WBEM server with a MOF file

If the --mock-server general option defines a MOF file, The file most consist of DMTF MOF definitions of CIM qualifier declarations, CIM class definitions, and CIM instance definitions that are compiled by pywbemcli using the pywbem MOF compiler and installed in the mock CIM repository before the first pywbemcli command that calls the server is executed. CIM namespaces may be created (in addition to the default namespace) with the MOF namespace pragma command.

The following is an example MOF file named tst_file.mof that defines some CIM qualifier declarations, a single CIM class, and a single CIM instance of that class with the namespace pragma:

// namespace pragma defines target namespace. pywbem MOF Compiler createsf
// namespace if it does not exist and sets that namespace as the target for
// compiled cim objects.
#pragma namespace ("root/cimv2")

// Define some qualifier declarations
Qualifier Description : string = null,
    Scope(any),
    Flavor(EnableOverride, ToSubclass, Translatable);

Qualifier In : boolean = true,
    Scope(parameter),
    Flavor(DisableOverride, ToSubclass);

Qualifier Key : boolean = false,
    Scope(property, reference),
    Flavor(DisableOverride, ToSubclass);

Qualifier Out : boolean = false,
    Scope(parameter),
    Flavor(DisableOverride, ToSubclass);

// Define a class

   [Description ("Simple CIM Class")]
class CIM_Foo {

       [Key, Description("This is a key property")]
    string InstanceID;

       [Description("This is a uint32 property")]
    uint32 IntegerProp;

       [Description("Method with one output parameter")]
    uint32 TestMethod(
           [In (false), Out, Description("Output parameter")]
        string OutputParam;
    );
};

// Define an instance of the class

instance of CIM_Foo as $foo1 {
    InstanceID = "CIM_Foo1";
    IntegerProp = 1;
};

The pywbemcli command to use this MOF file for loading into a mock WBEM server, and then to enumerate its CIM class names is:

$ pywbemcli --mock-server tst_file.mof class enumerate --names-only

CIM_Foo

Defining the mock WBEM server with a Python script

Creating a python script provides additional flexibility in defining mock environments over just installing MOF files including:

  1. The ability to install instance providers to control the processing of specific instance operations (create, modify, delete) on specific classes. This is similar to the definition of providers in WBEM servers such as OpenPegasus which process requests and generate responses to the client in the WBEM server for specific request types and CIM classes. pywbem provides several prebuilt instance providers that can be installed with the setup script.

  2. The ability to install CIM qualifier declarations and CIM classes from DMTF schemas rather than simply from local MOF files. See Building a mocked CIM repository rather than from local MOF files.

  3. The ability to dynamically define and create CIM instances and in particular instances of associations using both MOF and instances build from pywbem CIM objects as defined in ref:~pywbem:CIM objects.

A pywbemcli startup script can create many of the basic characteristics of a WBEM server as defined in the following sections

Defining mock namespaces

Pywbem mock provides tools for defining multiple CIM namespaces.The mock environment namespaces can be as simple as just the connection default namespace or as complex as an environment with an Interop namespace and multiple other namespaces (see Mocking multiple CIM namespaces).

Namespaces can be created by:

  • Using the MOF namespace pragma in a MOF file or MOF string in the startup script.

  • Using the pywbem method pywbem_mock.add_namespace()

  • Using the mock CIM_namespace provider and adding namespaces by creating instances of the DMTF CIM_Namespace class

  • Using pywbemtools namespace create command.

Installing CIM classes and qualifier declarations

CIM classes and qualifier declarations can be defines as follows:

  • Compiling a fixed set of classes and qualifier declarations defined in a file or python string defining MOF within a python script.

  • Compiling qualifier declarations and classes from a DMTF schema. The DMTF packages a set of CIM Qualifier Declarations and CIM Classes representing the DMTF model and makes them available on the DMTF web site. Pywbem_mock includes a set of tools to download DMTF schemas defined by their version number and install them in a specific local directory. These object can be compiled either by compiling the complete model using the MOF compiler or by compiling selected classes defining only the leaf classes desired (the pywbem tools will automatically install the CIM Qualifier declarations and all class dependencies for the leaf classes (ex. superclasses and classes referenced in reference properties)).

  • Compiling MOF files with the pywbemcli command server add-mof command which can add new CIM objects to an existing mock repository.

See DMTF CIM schema download support for more information.

The following statements in a script installs qualifier declarations and the CIM classes CIM_ObjectManager and CIM_Namespace as well as all their dependencies, after downloading the schema from the DMTF schema version 2.49.0 from the DMTF web site if it was not already on the local system).

VERBOSE = False
namespace = 'Interop'          # Namespace where interop components to be installed
schema_dir = '.'               # Directory where DMTF schema downloaded and expanded
DMTF_SCHEMA_VER = (2, 49, 0)   # defines DMTF schema version 2.49.0
schema_dir = schema_dir        # Directory where schema will be downloaded and installed
experimental-schema = True     # If True, DMTF experimental schema used

# Get and expand the DMTF schema.
schema = DMTFCIMSchema(DMTF_SCHEMA_VER,
                       schema_dir,
                       use_experimental=False,
                       verbose=VERBOSE)
leaf_classes = ['CIM_ObjectManager', 'CIM_Namespace']

# Compile the qualifier declarations from the schema
# Compile the leaf classes and all classes on which they depend
conn.compile_schema_classes(
             leaf_classes,
             schema.schema_pragma_file,
             namespace=namespace,
         verbose=VERBOSE)

These methods are documented in pywbem_mock.FakedWBEMConnection class

Installing/registering instance providers

A pywbem user may create mock instance providers that override the default behavior for creating, modifying, or deleting CIM instances as defined in User-defined providers.

Registering providers defines for the mock server in which namespaces the providers will be active. See register_provider().

The namespace provider which is already a part of pywbem can be installed using a the following statements in the python script:

# Create the interop namespace and compile the required files into the
# namespace
INTEROP_Namespace = 'interop'    # Defines name for interop namespace
interop_mof_file = 'mock_interop.mof'
if sys.version_info >= (3, 5):
    this_file_path = __file__
else:
    # Unfortunately, it does not seem to be possible to find the file path
    # of the current script when it is executed using exec(), so we hard
    # code the file path. This requires that the tests are run from the
    # repo main directory.
    this_file_path = 'tests/unit/pywbemcli/simple_interop_mock_script.py'
    assert os.path.exists(this_file_path)

if INTEROP_NAMESPACE not in conn.cimrepository.namespaces:
    conn.add_namespace(INTEROP_NAMESPACE, verbose=verbose)

interop_mof_path = os.path.join(
    os.path.dirname(this_file_path), interop_mof_file)
conn.compile_mof_file(interop_mof_path, namespace=INTEROP_NAMESPACE,
                      verbose=verbose)

ns_provider = pywbem_mock.CIMNamespaceProvider(conn.cimrepository)
conn.register_provider(ns_provider, INTEROP_NAMESPACE, verbose=verbose)

dep_path = os.path.join(os.path.dirname(this_file_path), fn)
conn.provider_dependent_registry.add_dependents(this_file_path,
                                                    dep_path)

Pywbemcli itself includes a predefined provider for creating namespaces CIM_Namespace provider and user providers for managing indication subscriptions that provide interfaces the same as most WBEM servers.

Creating CIM instances required for the mock

CIM instances can be created in the mock repository by either:

  • Compiling MOF for the instances from a string or file

  • Defining the instances with the CIMInstance class and installing them.

Installing required mock CIM Method

Installing any mock CIM Methods that may be required. Pywbem provides support for user-defined mock CIM Methods that that would provide specific responses to CIM method requests. Note that a pywbemcli mock with no user defined methods would respond with an exception since the CIM model itself does not define the actions of CIM methods. See User-defined method providers.

Registering dependent startup files

If the mock environment is to become a named connection and become part of the default connection file, all of the startup files used in creating the mock environment should be registered as dependents so that the pywbemcli startup can determine whether to load the mock environment from the cache or (if any files have changed) recreate the environment.

Registering dependent startup files used in the startup script using add_dependents() so that the mock WBEM server can be cached and restored or recreated if any of the dependent files change.

Caching significantly increases the install speed of mock servers since the CIM objects are already compiled and the repository created. The pywbem method add_dependents() will register one or more file dependencies. The files to be registered would logically include any MOF or python files referenced in the startup script and the startup script itself.

For example:

 def register_dependents(conn, this_file_path, dependent_file_names):
     """
     Register a dependent file name with the pywbemcli dependent file api.
     This insures that any change to a dependent file will cause the
     script to be recompiled.
     """
     if isinstance(dependent_file_names, six.string_types):
         dependent_file_names = [dependent_file_names]

     for fn in dependent_file_names:
         dep_path = os.path.join(os.path.dirname(this_file_path), fn)
         conn.provider_dependent_registry.add_dependents(this_file_path,
                                                         dep_path)

 def _setup(conn, server, verbose):

     ...

     interop_mof_file = 'mock_interop.mof'
     if sys.version_info >= (3, 5):
         this_file_path = __file__
     else:
         # Unfortunately, it does not seem to be possible to find the file path
         # of the current script when it is executed using exec(), so we hard
         # code the file path. This requires that the tests are run from the
         # repo main directory.
         this_file_path = 'tests/unit/pywbemcli/simple_interop_mock_script.py'
         assert os.path.exists(this_file_path)

     register_dependents(conn, this_file_path, interop_mof_file)

The following is an example of registering dependent files including the
script file itself.
def register_dependents(conn, this_file_path, dependent_file_names):
    """
    Register a dependent file name with the pywbemcli dependent file api.
    This ensures that any change to a dependent file will cause the
    script to be recompiled.
    """
    if isinstance(dependent_file_names, six.string_types):
        dependent_file_names = [dependent_file_names]

    for fn in dependent_file_names:
        dep_path = os.path.join(os.path.dirname(this_file_path), fn)
        conn.provider_dependent_registry.add_dependents(this_file_path,
                                                    dep_path)

def _setup(conn, server, verbose):

    . . .

    if sys.version_info >= (3, 5):
        this_file_path = __file__
    else:
        # Unfortunately, it does not seem to be possible to find the file path
        # of the current script when it is executed using exec(), so we hard
        # code the file path. This requires that the tests are run from the
        # repo main directory.
        this_file_path = 'tests/unit/pywbemcli/simple_interop_mock_script.py'
        assert os.path.exists(this_file_path)

    # Register the script file itself and any other files used in the script.
    register_dependents(conn, this_file_path, <file-used-in-script>)
Defining up the startup script interface from pywbemcli

Mock scripts can be used for any kind of setup of the mock WBEM server, for example for creating namespaces, implementing and registering providers, or adding CIM objects either from the corresponding Python objects or by compiling MOF files or MOF strings.

Mock scripts support two approaches for passing the mock WBEM server they should operate on depending on the Python version:

  • New-style(Python >=3.5): The mock script has a setup() function. This avoids the messiness of using globals and also enables the mock environment of a connection definition to be cached.

New-style mock scripts are imported as a Python module into Python namespace pywbemtools.pywbemcli.mockscripts.<mock-script-name> and their setup() function is called. That function has the following interface:

def setup(conn, server, verbose):

where:

  • conn (FakedWBEMConnection): This object provides a connection to the mock WBEM server and is a subclass of pywbem/WBEMConnection. The methods of this object can be used to create and modify CIM objects in the mock repository and to register providers.

  • server (WBEMServer): This [ywbem ]object is layered on top of the CONN object and provides access to higher level features of the mock WBEM server, such as getting the Interop namespace, adding namespaces, or building more complex objects for the mock repository.

  • verbose (bool): A boolean flag that contains the value of the boolean --verbose general option of pywbemcli.

  • Old-style(all Python versions(Deprecated)): The mock script does not have a setup() function. This approach is not recommended, but it is supported on all supported Python versions. Using old-style mock scripts in a connection definition prevents caching of its mock environment.

    Old-style mock scripts are executed as Python scripts in Python namespace __builtin__, with the following Python global variables made available:

    • CONN (pywbem_mock.FakedWBEMConnection): This object provides a connection to the mock WBEM server. The methods of this object can be used to create and modify CIM objects in the mock repository and to register providers.

    • SERVER (pywbem.WBEMServer): This object is layered on top of the CONN object and provides access to higher level features of the mock WBEM server, such as getting the Interop namespace, adding namespaces, or building more complex objects for the mock repository.

    • VERBOSE (bool): A flag that contains the value of the boolean --verbose general option of pywbemcli.

Thus the structure of a setup script might be as shown in the following example that creates an Interop namespace, CIM_Namespace and indication subscription providers, and MOF in the default_namespace from a MOF file.

def register_dependents(conn, this_file_path, dependent_file_names):
    """
    Register a dependent file name with the pywbemcli dependent file api.
    This insures that any change to a dependent file will cause the
    script to be recompiled.
    """
    if isinstance(dependent_file_names, six.string_types):
        dependent_file_names = [dependent_file_names]

    for fn in dependent_file_names:
        dep_path = os.path.join(os.path.dirname(this_file_path), fn)
        conn.provider_dependent_registry.add_dependents(this_file_path,
                                                    dep_path)

def _setup(conn, server, verbose):

    if sys.version_info >= (3, 5):
        this_file_path = __file__
    else:
        # Unfortunately, it does not seem to be possible to find the file path
        # of the current script when it is executed using exec(), so we hard
        # code the file path. This requires that the tests are run from the
        # repo main directory.
        this_file_path = 'tests/unit/pywbemcli/simple_interop_mock_script.py'
        assert os.path.exists(this_file_path)

# Prepare an Interop namespace and namespace provider a DMTF schema

INTEROP_NAMESPACE = 'interop'

interop_mof_file = 'mock_interop.mof'
if INTEROP_NAMESPACE not in conn.cimrepository.namespaces:
    conn.add_namespace(INTEROP_NAMESPACE, verbose=verbose)

interop_mof_path = os.path.join(
    os.path.dirname(this_file_path), interop_mof_file)
conn.compile_mof_file(interop_mof_path, namespace=INTEROP_NAMESPACE,
                      verbose=verbose)
register_dependents(conn, this_file_path, interop_mof_file)

ns_provider = pywbem_mock.CIMNamespaceProvider(conn.cimrepository)
conn.register_provider(ns_provider, INTEROP_NAMESPACE, verbose=verbose)

# Add namespace-neutral MOF to the default namespace

mof_file = 'simple_mock_model.mof'
mof_path = os.path.join(os.path.dirname(this_file_path), mof_file)
conn.compile_mof_file(mof_path, namespace=None, verbose=verbose)
register_dependents(conn, this_file_path, mof_file)


# Interface from pywbemcli for both old and new interfaces

if sys.version_info >= (3, 5):
    # New-style setup

    # If the function is defined directly, it will be detected and refused
    # by the check for setup() functions on Python <3.5, despite being defined
    # only conditionally. The indirect approach with exec() addresses that.
    # pylint: disable=exec-used
    exec("""
def setup(conn, server, verbose):
    _setup(conn, server, verbose)
""")

else:
    # Old-style setup

    global CONN  # pylint: disable=global-at-module-level
    global SERVER  # pylint: disable=global-at-module-level
    global VERBOSE  # pylint: disable=global-at-module-level

    # pylint: disable=undefined-variable
    _setup(CONN, SERVER, VERBOSE)  # noqa: F821

Examples of pywbemcli startup python script

Simple MOF based startup file

The following is an example of the new-style version of mock script tst_script.py that builds CIM classes and instances from pywbem CIM classes (CIM objects) representing the CIM objects:

from pywbem import CIMQualifierDeclaration, CIMQualifier, CIMClass, \
    CIMProperty, CIMMethod, CIMParameter, CIMInstance, CIMInstanceName, Uint32

def setup(conn, server, verbose):
    """Setup script for python >= version 3.5"""

    # Define qualifier declarations using pywbem CIMQualifierDeclaration class

    description_qd = CIMQualifierDeclaration(
        'Description', type='string', value=None,
        scopes=dict(ANY=True),
        overridable=True, tosubclass=True, translatable=True)
    in_qd = CIMQualifierDeclaration(
        'In', type='boolean', value=True,
        scopes=dict(PARAMETER=True),
        overridable=False, tosubclass=True)
    key_qd = CIMQualifierDeclaration(
        'Key', type='boolean', value=False,
        scopes=dict(PROPERTY=True, REFERENCE=True),
        overridable=False, tosubclass=True)
    out_qd = CIMQualifierDeclaration(
        'Out', type='boolean', value=False,
        scopes=dict(PARAMETER=True),
        overridable=False, tosubclass=True)

    # Define a class using pywbem CIMClass
    foo_cl = CIMClass(
        'CIM_Foo',
        qualifiers=[
            CIMQualifier('Description', 'Simple CIM Class'),
        ],
        properties=[
            CIMProperty(
                'InstanceID', type='string', value=None,
                qualifiers=[
                    CIMQualifier('Key', True),
                    CIMQualifier('Description', 'This is a key property'),
                ],
                class_origin='CIM_Foo', propagated=False),
            CIMProperty(
                'IntegerProp', type='uint32', value=None,
                qualifiers=[
                    CIMQualifier('Key', True),
                    CIMQualifier('Description', 'This is a uint32 property'),
                ],
                class_origin='CIM_Foo', propagated=False),
        ],
        methods=[
            CIMMethod(
                'TestMethod', return_type='uint32',
                qualifiers=[
                    CIMQualifier('Description',
                                 'Method with one output parameter'),
                ],
                parameters=[
                    CIMParameter(
                        'OutputParam', type='string',
                        qualifiers=[
                            CIMQualifier('In', False),
                            CIMQualifier('Out', True),
                            CIMQualifier('Description', 'Output parameter'),
                        ]),
                ],
                class_origin='CIM_Foo', propagated=False),
        ]
    )

    # Define an instance of the class using pywbem CIMInstances.
    # Note: The mock repository does not add an instance path, so it must be
    # prepared upfront.
    foo1 = CIMInstance(
        'CIM_Foo',
        path=CIMInstanceName(
            'CIM_Foo', keybindings=dict(InstanceID="CIM_Foo1")),
        properties=[
            CIMProperty('InstanceID', value="CIM_Foo1"),
            CIMProperty('IntegerProp', value=Uint32(1)),
        ])

    # Add the CIM objects to the mock repository
    conn.add_cimobjects([
        description_qd, in_qd, key_qd, out_qd,
        foo_cl,
        foo1,
    ])

    if verbose:
        conn.display_repository()
Example setup script old-style with MOF file

The following is a old-style(deprecated) mock script named tst_script.py that will add the same CIM objects as MOF file tst_file.mof to the mock repository using add_cimobjects(). If the --verbose general option is set on the pywbemcli command line, the mock repository will be displayed:

#!/usr/bin/env python

from pywbem import CIMQualifierDeclaration, CIMQualifier, CIMClass, \
    CIMProperty, CIMMethod, CIMParameter, CIMInstance, CIMInstanceName, Uint32


def main():

    # Global variables made available by pywbemcli
    global CONN, VERBOSE

    # Define some qualifier declarations
    description_qd = CIMQualifierDeclaration(
        'Description', type='string', value=None,
        scopes=dict(ANY=True),
        overridable=True, tosubclass=True, translatable=True)
    in_qd = CIMQualifierDeclaration(
        'In', type='boolean', value=True,
        scopes=dict(PARAMETER=True),
        overridable=False, tosubclass=True)
    key_qd = CIMQualifierDeclaration(
        'Key', type='boolean', value=False,
        scopes=dict(PROPERTY=True, REFERENCE=True),
        overridable=False, tosubclass=True)
    out_qd = CIMQualifierDeclaration(
        'Out', type='boolean', value=False,
        scopes=dict(PARAMETER=True),
        overridable=False, tosubclass=True)

    # Define a class
    foo_cl = CIMClass(
        'CIM_Foo',
        qualifiers=[
            CIMQualifier('Description', 'Simple CIM Class'),
        ],
        properties=[
            CIMProperty(
                'InstanceID', type='string', value=None,
                qualifiers=[
                    CIMQualifier('Key', True),
                    CIMQualifier('Description', 'This is a key property'),
                ],
                class_origin='CIM_Foo', propagated=False),
            CIMProperty(
                'IntegerProp', type='uint32', value=None,
                qualifiers=[
                    CIMQualifier('Key', True),
                    CIMQualifier('Description', 'This is a uint32 property'),
                ],
                class_origin='CIM_Foo', propagated=False),
        ],
        methods=[
            CIMMethod(
                'TestMethod', return_type='uint32',
                qualifiers=[
                    CIMQualifier('Description',
                                 'Method with one output parameter'),
                ],
                parameters=[
                    CIMParameter(
                        'OutputParam', type='string',
                        qualifiers=[
                            CIMQualifier('In', False),
                            CIMQualifier('Out', True),
                            CIMQualifier('Description', 'Output parameter'),
                        ]),
                ],
                class_origin='CIM_Foo', propagated=False),
        ]
    )

    # Define an instance of the class.
    # Note: The mock repository does not add an instance path, so it must be
    # prepared upfront.
    foo1 = CIMInstance(
        'CIM_Foo',
        path=CIMInstanceName(
            'CIM_Foo', keybindings=dict(InstanceID="CIM_Foo1")),
        properties=[
            CIMProperty('InstanceID', value="CIM_Foo1"),
            CIMProperty('IntegerProp', value=Uint32(1)),
        ])

    # Add the CIM objects to the mock repository
    CONN.add_cimobjects([
        description_qd, in_qd, key_qd, out_qd,
        foo_cl,
        foo1,
    ])

    if VERBOSE:
        CONN.display_repository()


if __name__ == '__builtin__':
    main()

The pywbemcli command to use this mock script, and then to enumerate its CIM class names is:

$ pywbemcli --mock-server tst_script.py class enumerate --names-only
CIM_Foo

As you can see, adding CIM objects with a MOF file is more compact than doing that in a mock script, but the mock script can contain logic, and it allows defining providers.

Example setup script new-style with MOF file

The following new-style mock script defines and registers a method provider for CIM method “CIM_Foo.Method1()” that modifies property “Property1” of the target CIM instance and returns that property in an output parameter “OutputParam1”:

from pywbem import CIMInstanceName, CIMError, \\
    CIM_ERR_INVALID_PARAMETER, CIM_ERR_METHOD_NOT_AVAILABLE
from pywbem_mock import MethodProvider

class CIM_Foo_MethodProvider(MethodProvider):

    provider_classname = 'CIM_Foo'

    def InvokeMethod(self, methodname, localobject, params):

        if methodname.lower() == 'method1':
            if isinstance(localobject, CIMClassName):
                raise CIMError(
                    CIM_ERR_INVALID_PARAMETER,
                    "CIM method {0} must be invoked on a CIM instance".
                    format(methodname))
            return self.Method1(localobject, params)
        else:
            raise CIMError(CIM_ERR_METHOD_NOT_AVAILABLE)

    def Method1(self, localobject, params):

        namespace = localobject.namespace
        instance_store = self.cimrepository.get_instance_store(namespace)

        # Get the instance the method was invoked on, from the CIM
        # repository (as a copy)
        instance = instance_store.get(localobject.path)  # a copy

        # Modify a property value in the local copy of the instance
        if 'Property1' not in instance.properties:
            instance.properties['Property1'] = 'new'
        instance.properties['Property1'] += '+'

        # Update the instance in the CIM repository from the changed
        # local instance
        instance_store.update(localobject.path, instance)

        # Return the property value in the output parameter
        outputparam1 = instance.properties['Property1']
        out_params = [
            CIMParameter('OutputParam1', type='string', value=outputparam1),
        ]

        # Set the return value of the CIM method
        return_value = 0

        return (return_value, out_params)

def setup(conn, server, verbose):
    provider = CIM_Foo_MethodProvider(conn.cimrepository)
    conn.register_provider(provider, conn.default_namespace, verbose=verbose)

The pywbemtools github tests/unit/pywbemcli directory includes several good examples of pywbemcli startup scripts that are used for testing including:

  1. tests/unit/pywbemcli/simple_foo_mock_script.py that uses the default namespace to create a simple but repository with classes and instances defined in associated MOF files. See:

  2. simple_interop_mock_script.py - creates a mock server with interop and user namespaces and installs the namespace provider. It uses local MOF files to provide the qualifier declaration and class definitions.

  3. tests/unit/pywbemcli/testmock/wbemserver_mock_script.py which defines a dictionary to build a mock server and uses the class in tests/unit/pywbemcli/testmock/wbemserver_mock_script.py to build a mock environment that can includes building multiple namespaces, installing the namespace provider and subscription providers, and installing sample profiles, central classes, and the association classes for profile traversing.

Caching mock WBEM servers connection definitions

Pywbemcli automatically attempts to cache the contents of a mock WBEM server definition when:

  1. the connection definition is saved (connection save <name>) to the default connection file.

  2. the first command is executed that calls the mock repository (ex. class enumerate --no) which causes a call to a python script defined by the --name general option

Further, the connection will only be cached if:

  1. The setup script is the new-style mock setup script or a MOF file. The old style setup script cannot be cached.

  2. The connection definition is saved (connection save command)

  3. The connection is save in the default connection file (i.e the --connections-file general option is not used).

  4. The MOF compiles correctly and the setup script does not pass an exception back to the caller.

The advantage of caching the mock server definition is the speed of startup, in particular if the startup script compiles any classes and if the DMTF schema functions of pywbem are used to get CIM qualifier declaration and CIM class MOF.

The following data from a mock WBEM server is cached:

  • its CIM repository including namespaces defined, CIM qualifiers, CIM classes, and CIM_instances

  • the content of the Python namespaces of its mock scripts (this includes for example the definition of any Python classes for the providers)

  • its registered providers

  • a list of dependent files registered by its mock scripts

The caches for the connection definitions are maintained in the .pywbemcli_mockcache directory in the user’s home directory in separate files with names of the form <guid>.<connection name>.

If a connection definition is used as the wbem server (--name general option) , pywbemcli verifies whether its mock WBEM server has been cached, and if so, whether the cache is up to date. If it is not up to date, it is not used but re-generated.

For determining whether the cache is up to date, the file content of the MOF files and mock scripts of the connection definition, as well as any registered dependent files are used in a hash. The file dates are not used for this.

If a mock script uses further files that define the mock environment (e.g. when an XML or YAML file is used that defines an entire WBEM management profile), then pywbemcli does not know about these files. They can be made known to pywbemcli by registering them as dependent files. Once that is done, they are also used to determine whether the mock cache is up to date. See Registry for provider dependent files for more details on how to register dependent files. Generally all the files used in the setup script and the script itself should be registered as dependent files.

Pywbemlistener command

The pywbemlistener command can run and manage WBEM listeners.

Each listener is a process that executes the pywbemlistener run command to receive WBEM indications sent from a WBEM server.

A listener process can be started with the pywbemlistener start command and stopped with the pywbemlistener stop command.

There is no central registration of the currently running listeners. Instead, the currently running processes executing the pywbemlistener run command are by definition the currently running listeners. Because of this, there is no notion of a stopped listener nor does a listener have an operational status.

Pywbemlistener commands

This section describes each of the pywbemlistener commands including examples.

The pywbemlistener commands are:

pywbemlistener list command

The pywbemlistener list command lists the currently running WBEM indication listeners on the local system. They are identified as the processes executing the pywbemlistener run command.

Example:

$ pywbemlistener list
+--------+--------+----------+-------+---------------------+
| Name   |   Port | Scheme   |   PID | Created             |
|--------+--------+----------+-------+---------------------|
| lis1   |  25989 | https    | 59327 | 2021-07-03 15:31:55 |
+--------+--------+----------+-------+---------------------+

The -o, --output-format general option can be used to control the format of the table that is displayed, for example:

Example:

$ pywbemlistener -o rst list
======  ======  ========  =====  ===================
Name      Port  Scheme      PID  Created
======  ======  ========  =====  ===================
lis1     25989  https     59327  2021-07-03 15:31:55
======  ======  ========  =====  ===================

See pywbemlistener list –help for the exact help output of the command.

pywbemlistener show command

The pywbemlistener show command shows details of a specific running WBEM indication listener on the local system, by specifying the listener name.

The running listeners are identified as the processes executing the pywbemlistener run command. The listener name is also identified from the process command line.

Example:

$ pywbemlistener show lis1
+--------------------+---------------------------+
| Attribute          | Value                     |
|--------------------+---------------------------|
| Name               | lis1                      |
| Port               | 25989                     |
| Scheme             | https                     |
| Certificate file   | .../certs/server_cert.pem |
| Key file           | .../certs/server_key.pem  |
| Indication call    |                           |
| Indication display | False                     |
| Indication file    |                           |
| Log file           |                           |
| PID                | 59327                     |
| Created            | 2021-07-03 15:31:55       |
+--------------------+---------------------------+

See pywbemlistener show –help for the exact help output of the command.

pywbemlistener start command

The pywbemlistener start command starts a new WBEM indication listener on the local system.

The listener is running as a normal user process in the background, inheriting the group and user context from the process that runs the pywbemlistener start command (usually the shell process in a terminal session).

Example:

$ pywbemlistener start lis1 --cert-file .../certs/server_cert.pem --key-file .../certs/server_key.pem
Running listener lis1 at https://localhost:25989

The previous example started a listener for HTTPS (the default) on the default port 25989. Because HTTPS was used, it was necessary to specify an X.509 server certificate and its key file.

The port can be specified using the -p, --port option. The use of HTTP instead of the default HTTPS can be used by specifying it with the -s, --scheme option.

When the listener receives an indication, by default it drops it and does nothing else.

The following actions can be configured to be performed on each received indication. Multiple actions can be specified.

  • Appending it as a line to a file:

    This action is enabled by specifying the --indi-file FILE option.

    The format of the line can be configured using the --indi-format FORMAT option.

    FORMAT is a Python new-style format string that can use the following keyword args:

    • ‘dt’ - datetime object of the time the listener received the indication, in local time. The object is timezone-aware on Python 3.6 or higher.

    • ‘dt_tzname’ - timezone name of the datetime object if timezone-aware, else the empty string.

    • ‘h’ - Host name or IP address of the host that sent the indication

    • ‘i’ - pywbem.CIMInstance object with the indication instance

    • ‘c’ - CIM classname of the indication instance

    • ‘p’ - Case-insensitive dictionary of the indication properties, displayed as blank-separated name=value items

    The default format is: “{dt} {h} {c} {p}”.

  • Calling a Python function, via the --indi-call MODULE.FUNCTION option.

    MODULE must be a module name or a dotted package name in the module search path, e.g. ‘mymodule’ or ‘mypackage.mymodule’.

    The current directory is added to the front of the Python module search path, if needed. Thus, the module can be a single module file in the current directory, for example:

    ./mymodule.py
    

    or a module in a package in the current directory, for example:

    ./mypackage/__init__.py
    ./mypackage/mymodule.py
    

    FUNCTION must be a function in that module with the following interface:

    def func(indication, host)
    

    Parameters:

    • ‘indication’ is a pywbem.CIMInstance object representing the CIM indication that has been received. Its ‘path’ attribute is None.

    • ‘host’ is a string with the host name or IP address of the indication sender (typically a WBEM server).

    The return value of the function will be ignored.

    Exceptions raised when importing the module cause the ‘pywbemlistener run’ command to terminate with an error. Exceptions raised by the function when it is called cause an error message to be displayed on stderr of the listener process and logged, if logging is enabled.

The started WBEM indication listener can log any issues it encounters, to a file. This is enabled by using the -l, --logdir DIR general option.

See pywbemlistener start –help for the exact help output of the command.

pywbemlistener stop command

The pywbemlistener stop command stops a running WBEM indication listener on the local system.

Example:

$ pywbemlistener stop lis1
Shut down listener lis1 running at http://localhost:25989

On Windows, the listener process is stopped immediately without giving the process control to clean up. On other platforms, the listener process is stopped gracefully, giving the process control to clean up.

See pywbemlistener stop –help for the exact help output of the command.

pywbemlistener test command

The pywbemlistener test command sends a test indication to a running WBEM indication listener on the local system.

Example:

$ pywbemlistener test lis1
Sending the following test indication:
instance of CIM_AlertIndication {
   IndicationIdentifier = NULL;
   IndicationTime = "20210711160151.847111+000";
   AlertingElementFormat = 2;
   AlertingManagedElement = NULL;
   AlertType = 2;
   Message = "Test message";
   MessageID = "TEST0000";
   OwningEntity = "TEST";
   PerceivedSeverity = 2;
   ProbableCause = 0;
   SystemName = NULL;
   MessageArguments = { };
};
Sent test indication to listener lis1 at http://localhost:25989

See pywbemlistener test –help for the exact help output of the command.

pywbemlistener run command

The pywbemlistener run command runs the WBEM indication listener code in a loop that never ends. It is possible to start this command in the background or even run it in the foreground, but it is not recommended that users do that directly. Instead, users should use the pywbemlistener start command, which starts the pywbemlistener run command as a background process.

See pywbemlistener run –help for the exact help output of the command.

Pywbemlistener general options

General options are those that are specified directly after the pywbemlistener command, e.g. --output-format simple in the following example:

pywbemlistener --output-format simple list

Most of the general options can be specified with any of the sub-commands of the pywbemlistener command, but there are some general options that are used only on some sub-commands, and are ignored on the other sub-commands.

Logging

Logging is performed only by the pywbemlistener run command. The pywbemlistener start command passes its logging settings on to the pywbemlistener run command it starts as a background process. All other pywbemlistener commands ignore the logging settings.

Logging is enabled by specifying the -l DIR or --logdir DIR general option, or by setting the PYWBEMLISTENER_LOGDIR environment variable to DIR. The general option has precedence over the environment variable. DIR is the path name of the directory where the log files will reside in.

There is a log file created for each listener that is running. The log files are named pywbemlistener_NAME.log where NAME is the listener name.

Existing log files are appended to when a listener is started.

The lines in the log file are plain messages without any specific format, and without a time stamp.

Output format

The output of the pywbemlistener list and pywbemlistener show commands is influenced by the --output-format general option.

Only table formats can be specified; for details see Table formats.

Miscellaneous

The --verbose or -v general option displays extra information about the processing. It can be specified multiple times as follows:

  • -v (one time): Display indication processing settings

  • -vv (two times): Display interactions between start and run commands

The --warn general option controls the display of Python warnings.

The --version general option displays pywbemlistener version information

The --pdb general option is for debugging the command: It brings up the pdb debugger right before the sub-command starts executing.

The --help or -h general option provides help for the pywbemlistener command and its general options.

pywbemlistener Help Command Details

This section shows the help text for each pywbemlistener command.

Help text for pywbemlistener:

Usage: pywbemlistener [GENERAL-OPTIONS] COMMAND [ARGS] [COMMAND-OPTIONS]

  The pywbemlistener command can run and manage WBEM listeners.

  Each listener is a process that executes the 'pywbemlistener run' command to receive WBEM indications sent from a WBEM
  server.

  A listener process can be started with the 'pywbemlistener start' command and stopped with the 'pywbemlistener stop'
  command.

  There is no central registration of the currently running listeners. Instead, the currently running processes
  executing the 'pywbemlistener run' command are by definition the currently running listeners. Because of this, there
  is no notion of a stopped listener nor does a listener have an operational status.

  The general options shown below can also be specified on any of the commands, positioned right after the
  'pywbemlistener' command name.

  The width of help texts of this command can be set with the PYWBEMTOOLS_TERMWIDTH environment variable.

  For more detailed documentation, see:

      https://pywbemtools.readthedocs.io/en/stable/

General Options:
  -o, --output-format FORMAT  Output format for the command result. FORMAT is one of the table formats:
                              [table|plain|simple|grid|psql|rst|html].
  -l, --logdir DIR            Enable logging of the 'pywbemlistener run' command output to a file in a log directory.
                              The file will be named 'pywbemlistener_NAME.log' where NAME is the listener name. Default:
                              EnvVar PYWBEMLISTENER_LOGDIR, or no logging.
  -v, --verbose               Verbosity level. Can be specified multiple times: -v: Display indication processing
                              settings; -vv: Display interactions between start and run commands.
  --pdb                       Pause execution in the built-in pdb debugger just before executing the command within
                              pywbemlistener. Default: EnvVar PYWBEMLISTENER_PDB, or no debugger.
  --warn                      Enable display of all Python warnings. Default: Leave warning control to the
                              PYTHONWARNINGS EnvVar, which by default displays no warnings.
  --version                   Show the version of this command and the pywbem package.
  -h, --help                  Show this help message.

Commands:
  list   List the currently running named WBEM indication listeners.
  show   Show a named WBEM indication listener.
  start  Start a named WBEM indication listener in the background.
  stop   Stop a named WBEM indication listener.
  test   Send a test indication to a named WBEM indication listener.
  run    Run as a named WBEM indication listener.

pywbemlistener list –help

Help text for pywbemlistener list (see pywbemlistener list command):

Usage: pywbemlistener [GENERAL-OPTIONS] list [COMMAND-OPTIONS]

  List the currently running named WBEM indication listeners.

  This is done by listing the currently running `pywbemlistener run` commands.

Command Options:
  -h, --help  Show this help message.

pywbemlistener run –help

Help text for pywbemlistener run (see pywbemlistener run command):

Usage: pywbemlistener [GENERAL-OPTIONS] run NAME [COMMAND-OPTIONS]

  Run as a named WBEM indication listener.

  Run this command as a named WBEM indication listener until it gets terminated, e.g. by a keyboard interrupt, break
  signal (e.g. kill), or the `pywbemlistener stop` command.

  A listener with that name must not be running, otherwise the command fails.

  Note: The `pywbemlistener start` command should be used to start listeners, and it starts a `pywbemlistener run`
  command as a background process. Use the `pywbemlistener run` command only when you need to have control over how
  exactly the process runs in the background.

  Note: The --start-pid option is needed because on Windows, the `pywbemlistener run` command is not the direct child
  process of the `pywbemlistener start` command starting it.

  Examples:

    pywbemlistener run lis1

Command Options:
  --start-pid PID              PID of the "pywbemlistener start" process to be notified about the startup of the run
                               command. Default: No such notification will happen.
  -p, --port PORT              The port number the listener will open to receive indications. This can be any available
                               port. Default: 25989
  -s, --scheme SCHEME          The scheme used by the listener (http, https). Default: https
  -c, --certfile FILE          Path name of a PEM file containing the certificate that will be presented as a server
                               certificate during SSL/TLS handshake. Required when using https. The file may in addition
                               contain the private key of the certificate. Default: EnvVar PYWBEMLISTENER_CERTFILE, or
                               no certificate file.
  -k, --keyfile FILE           Path name of a PEM file containing the private key of the server certificate. Required
                               when using https and when the certificate file does not contain the private key. Default:
                               EnvVar PYWBEMLISTENER_KEYFILE, or no key file.
  --indi-call MODULE.FUNCTION  Call a Python function for each received indication. Invoke with --help-call for details
                               on the function interface. Default: No function is called.
  --indi-file FILE             Append received indications to a file. The format can be modified using the --indi-format
                               option. Default: Not appended.
  --indi-format FORMAT         Sets the format to be used when displaying received indications. Invoke with --help-
                               format for details on the format specification. Default: "{dt} {h} {i_mof}".
  --help-format                Show help message for the format specification used with the --indi-format option and
                               exit.
  --help-call                  Show help message for calling a Python function for each received indication when using
                               the --indi-call option and exit.
  -h, --help                   Show this help message.

pywbemlistener show –help

Help text for pywbemlistener show (see pywbemlistener show command):

Usage: pywbemlistener [GENERAL-OPTIONS] show NAME [COMMAND-OPTIONS]

  Show a named WBEM indication listener.

  A listener with that name must be running, otherwise the command fails.

  Examples:

    pywbemlistener show lis1

Command Options:
  -h, --help  Show this help message.

pywbemlistener start –help

Help text for pywbemlistener start (see pywbemlistener start command):

Usage: pywbemlistener [GENERAL-OPTIONS] start NAME [COMMAND-OPTIONS]

  Start a named WBEM indication listener in the background.

  A listener with that name must not be running, otherwise the command fails.

  A listener is identified by its hostname or IP address and a port number. It can be started with any free port.

  Examples:

    pywbemlistener start lis1

Command Options:
  -p, --port PORT              The port number the listener will open to receive indications. This can be any available
                               port. Default: 25989
  -s, --scheme SCHEME          The scheme used by the listener (http, https). Default: https
  -c, --certfile FILE          Path name of a PEM file containing the certificate that will be presented as a server
                               certificate during SSL/TLS handshake. Required when using https. The file may in addition
                               contain the private key of the certificate. Default: EnvVar PYWBEMLISTENER_CERTFILE, or
                               no certificate file.
  -k, --keyfile FILE           Path name of a PEM file containing the private key of the server certificate. Required
                               when using https and when the certificate file does not contain the private key. Default:
                               EnvVar PYWBEMLISTENER_KEYFILE, or no key file.
  --indi-call MODULE.FUNCTION  Call a Python function for each received indication. Invoke with --help-call for details
                               on the function interface. Default: No function is called.
  --indi-file FILE             Append received indications to a file. The format can be modified using the --indi-format
                               option. Default: Not appended.
  --indi-format FORMAT         Sets the format to be used when displaying received indications. Invoke with --help-
                               format for details on the format specification. Default: "{dt} {h} {i_mof}".
  --help-format                Show help message for the format specification used with the --indi-format option and
                               exit.
  --help-call                  Show help message for calling a Python function for each received indication when using
                               the --indi-call option and exit.
  -h, --help                   Show this help message.

pywbemlistener stop –help

Help text for pywbemlistener stop (see pywbemlistener stop command):

Usage: pywbemlistener [GENERAL-OPTIONS] stop NAME [COMMAND-OPTIONS]

  Stop a named WBEM indication listener.

  The listener will shut down gracefully.

  A listener with that name must be running, otherwise the command fails.

  Examples:

    pywbemlistener stop lis1

Command Options:
  -h, --help  Show this help message.

pywbemlistener test –help

Help text for pywbemlistener test (see pywbemlistener test command):

Usage: pywbemlistener [GENERAL-OPTIONS] test NAME [COMMAND-OPTIONS]

  Send a test indication to a named WBEM indication listener.

  The indication is an alert indication with fixed properties. This allows testing the listener and what it does with
  the indication.

  Examples:

    pywbemlistener test lis1

Command Options:
  -c, --count INT  Count of test indications to send. Default: 1
  -h, --help       Show this help message.

Pywbemtools development

This section only needs to be read by developers of the pywbemtools package. People that want to make a fix or develop some extension, and people that want to test the project are also considered developers for the purpose of this section.

Generally development users will install pywbemtools by cloning the pywbemtools GitHub package and using the Make utility to handle the installation of pywbemtools and its prerequisites. This provides the user with all of the source of pywbemtools and in addition, the test environment and the documentation files.

Repository

The repository for pywbemtools is on GitHub:

https://github.com/pywbem/pywbemtools

Setting up the development environment

It is recommended to use Linux as the development environment for pywbemtools. OS-X should work as well; Windows requires additional manual setup steps.

The pywbemtools development environment is based on a Makefile and therefore requires the GNUmake utility to execute most of the build steps. For Linux and the Mac environments, the GNU make utility normally exists but that is not the case for Windows. GNU make can be installed on native windows from tools such as chocolatey or winget for native windows or window environments such as cygwin or WSL(Windows Subsystem for Linux) enabled to provide a suitable GNUmake utility.

  1. Clone the Git repo of this project and switch to its working directory:

    $ git clone git@github.com:pywbem/pywbemtools.git
    $ cd pywbemtools
    
  2. It is recommended that you set up a Python virtual environment. See section Using Python virtual environments. Have the virtual Python environment active for all remaining steps.

  3. Install pywbemtools and its prerequisites for installing and running it as described in Installation. This will install Python packages into the active Python environment, and OS-level packages.

  4. Unix-like environments on Windows (such as CygWin, MinGW, Babun, Gow, or WSL(Windows subsystem for Linux)) may bring their own Python, so double check that the active Python environment is the one you want to use.

  5. Install the prerequisites for pywbemtools development. This will install Python packages into the active Python environment, and OS-level packages:

    $ make develop
    
  6. This project uses make to do things in the currently active Python environment. The command:

    $ make
    

    displays a list of valid Make targets for pywbemtools installation and test and a short description of what each target does.

Using Python virtual environments

It is beneficial to set up a virtual Python environment for your project, because that leaves your system Python installation unchanged, it does not require sudo rights, and gives you better control about the installed packages and their versions. In effect it isolates the environment for your pywbemtools installation from the rest of the OS environment.

There are a number of different virtual environment tools available for python depending on your OS and Python including venv, virtualenv, etc. More information on virtual environments can be found at sites like virtual Python environment, virtual Python environment tutorial or Python venv

The pywbem development team extensively uses virtualenv and virtualenvwrapper in multiple OS and python version environments.

Building the documentation

The ReadTheDocs (RTD) site is used to publish the documentation for the pywbemtools package at https://pywbemtools.readthedocs.io/

This page is automatically updated whenever the Git repo for this package changes the branch from which this documentation is built.

In order to build the documentation locally from the Git work directory, execute:

$ make builddoc

The top-level document to open with a web browser will be build_doc/html/docs/index.html.

Testing

All of the following make commands run the tests in the currently active Python environment. Depending on how the pywbemtools package is installed in that Python environment, either the pywbemtools directory in the main repository directory is used, or the installed pywbemtools package. The test case files and any utility functions they use are always used from the tests directory in the main repository directory.

The tests directory has the following subdirectory structure:

tests
 +-- unit                Unit tests
 |    +-- utils               Utility functions used by unit tests
 +-- manual              Manual tests
 +-- schema              The CIM schema MOF files used by some tests

There are multiple types of tests in pywbemtools:

  1. Unit tests and function tests

    Today, the unit tests and function tests are contained in the single directory unit.

    The distinction between unit tests and function tests as used in pywbemtools is that function tests exercise the entire pywbemcli client component or entire scripts using the pywbem_mock module and mock CIM model definitions to emulate a WBEM server, while unit tests exercise single modules without using access to a WBEM server.

    Generally, the function tests are organized by the command group so that for example the function tests for the class command group are in the file tests\unit\pywbemcli\test_class_subcmd.py.

    Tests are run by executing:

    $ make test
    

    Test execution can be modified by a number of environment variables, as documented in the make help (execute make help).

  2. Individual test files

    Individual test files in the tests/unit/ environment can be executed by executing pytest <test_file_path>. Note that the tests require some dependencies to locate the pywbemtools code and to set the terminal width for the tests to 120 characters (many command outputs depend on the terminal width to format output). Thus the following would execute the tests on the class command group contained in tests\unit\pywbemcli\test_class_cmds.py.

    $ PYTHONPATH=. PYWBEMTOOLS_TERMWIDTH=120 pytest tests/unit/pywbemcli/test_class_cmds.py
    
  3. Manual tests

    There are several Python scripts and shell scripts that can be run manually. The results need to be validated manually.

    These scripts are in the directory:

    tests/manual/
    

    and are executed by simply invoking them from within the main directory of the repository, e.g.:

    tests/manual/test_pegasus.py
    

    Some of the scripts support a --help option that informs about their usage.

    Some tests depend on the existence of a DMTF Schema defining the classes and qualifier declarations in a particular release

  4. Running Tox

    To run the unit and function tests in all supported Python environments, the Tox tool can be used. It creates the necessary virtual Python environments and executes make test (i.e. the unit and function tests) in each of them.

    For running Tox, it does not matter which Python environment is currently active, as long as the Python tox package is installed in it:

    $ tox                              # Run tests on all supported Python versions
    $ tox -e py27                      # Run tests on Python 2.7
    

Disabling the spinner when debugging

Subcommands normally display a spinner (a character-based spinning wheel) while waiting for completion.

For debugging, it is useful to disable that spinner. This can be done by setting the PYWBEM_SPINNER environment variable to ‘false’, ‘0’, or the empty string. For example:

$ export PYWBEM_SPINNER=false

Contributing

Third party contributions to this project are welcome!

In order to contribute, create a Git pull request, considering this:

  • Test is required.

  • Each commit should only contain one “logical” change.

  • A “logical” change should be put into one commit, and not split over multiple commits.

  • Large new features should be split into stages.

  • The commit message should not only summarize what you have done, but explain why the change is useful.

  • The commit message must follow the format explained below.

What comprises a “logical” change is subject to sound judgement. Sometimes, it makes sense to produce a set of commits for a feature (even if not large). For example, a first commit may introduce a (presumably) compatible API change without exploitation of that feature. With only this commit applied, it should be demonstrable that everything is still working as before. The next commit may be the exploitation of the feature in other components.

For further discussion of good and bad practices regarding commits, see:

Core Development Team

Anyone can contribute to pywbemtools via pull requests as described in the previous section.

The pywbemtools project has a core development team that holds regular web conferences and that is using Slack for offline communication, on the Slack workspace: https://pywbem.slack.com.

The web conference and the Slack workspace are by invitation, and if you want to participate in the core team, please open a pywbem issue to let us know.

Appendix

This section contains information that is referenced from other sections, and that does not really need to be read in sequence.

Special terms

This documentation uses a few special terms to refer to Python types:

CIM-XML

The name of the protocol that pywbemcli uses to communicate with WBEM servers. CIM-XML is defined in DSP0200.

CIM object output formats

Pywbemcli output formats (specified with the --output-format general option) that format the resulting CIM objects or CIM object paths as MOF, CIM-XML, or using the pywbem repr or str formatting. See CIM object formats for details.

Table output formats

Pywbemcli output formats (specified with the --output-format general option) that format the result as a table. See Table formats for details.

Tree output format

A pywbemcli output format (specified with the --output-format general option) that formats the result as a tree using ASCII characters. See ASCII tree format for details.

INSTANCENAME

A CIM instance path in a format that is suitable as a command line argument or option value of pywbemcli. Several commands of the instance command group use INSTANCENAME as a command line argument.

The supported formats for INSTANCENAME are an untyped WBEM URI and the use of wildcard keys i.e. CLASSNAME.?, as detailed in Specifying the INSTANCENAME command argument.

Examples:

CIM_RegisteredProfile.InstanceID="acme:1"
CIM_System.CreationClassName="ACME_System",Name="MySystem"
CIM_System.?
connection id

A string that uniquely identifies each pywbem.WBEMConnection object created. The connection id is immutable and is accessible as pywbem.WBEMConnection.conn_id. It is included in each log record and may be used to relate pywbem log records to connections.

DeprecationWarning

A standard Python warning that indicates a deprecated functionality. See section Deprecation and compatibility policy and the standard Python module warnings for details.

CIM namespace

A CIM namespace (defined in DSP0004) provides a scope of uniqueness for CIM objects; specifically, the names of class objects and of qualifier type objects shall be unique in a namespace. The compound key of non-embedded instance objects shall also be unique across all non-embedded instances of the class (not including subclasses) within the namespace.

Interop namespace

The Interop namespace is a CIM namespace that exists in a WBEM server as a point of interoperatbility with WBEM clients because it has a well known name. A WBEM server may have only a single Interop namespace and the names are limited normally to interop, root/interop. Pywbemcli adds root/PG_Interop as a third alternative when it looks for any Interop namespaces on a WBEM server. The object manager, profile, namespace information and indication subscription is available through the interop namespace.

connections file

A file maintained by pywbemcli and managed by the connection command group. The connections file defines a list of named WBEM connection definitions, each of which is either the set of parameters for connecting to a real WBEM server, or the set of files for creating a mock WBEM server. This allows connection definitions to be persisted and referenced by name in pywbemcli commands, via the --name general option.

By default, the connections file is .pywbemcli_connections.yaml in the user’s home directory. The user’s home directory depends on the operating system used. It is determined with os.path.expanduser("~"), which works on all operating systems including Windows. See expanduser() for details. The default connections file can be changed using the PYWBEMCLI_CONNECTIONS_FILE environment variable, or with the --connections-file general option.

A connections file may also include a default-connection-name that defines a named connection in the file that is the default connection to be created on pywbemcli startup.

default-connection-name

Each connections file includes an attribute, default-connection-name, that contains the name of a connection definition in the same connections file. Starting pywbemcli with without specifying the a server on the command line (i.e specifying –server, –name, or –mock-server options) triggers use of this name as the current server. This attribute can be defined, modified, or cleared with the connection set-default, command and modified with the connection save or connection save commands.

MOF

MOF (Managed Object Format) is the language used by the DMTF to describe in textual form CIM objects including CIM qualifier declarations, CIM classes, CIM instances, etc. MOF is the language used to define CIM objects in the DMTF schemas. It is one of the output formats provided for the display of CIM objects in pywbemcli. See DMTF DSP0004 for more information on the MOF format. MOF files can be compiled with the pywbem MOF compiler into pywbem CIM objects.

WBEM management profile
management profile

WBEM management profiles define specific management functionality in terms of the CIM model and WBEM operations. The DMTF publishes management profiles in several areas and the SNIA within the SMI-S specification.

Management profiles are identified by organization, name and version. WBEM servers advertise the management profiles that are implemented by the server so that they can be discovered by WBEM clients to determine the management capabilities of the WBEM server. This includes providing the clients a programmatic access to the central instances of the management profile. For details, see Profile advertisement methodologies.

central instances

The CIM instances that act as an algorithmic focal point for accessing the management functionality provided by the implementation of a management profile on a WBEM server. The central instances typically represent the central managed resource in the management domain that is addressed by the management profile.

WBEM URI

WBEM URI is a standardized text form for CIM object paths and is defined in DSP0207. Pywbemcli uses the untyped WBEM URI format for instance names in the command line (i.e. INSTANCENAME).

REPL

Stands for “Read-Execute-Print-Loop” which is a term that denotes the pywbemcli shell interactive mode where multiple command groups and commands may be executed within the context of a connection defined by a set of general options.

Unix-style path name pattern
GLOB pattern

A pattern used in Unix environments for wild card search for path names (file names and directory names). It is used by pywbemcli for example to expand class names in the class find command. No tilde expansion is done, but *, ?, and character ranges expressed with [] are supported. The escape characters patterns are:

  • * matches any number of any character including none.

  • ? matches any single character.

  • [abc] matches one character in the bracket.

  • [a-z] matches the character range in the bracket.

Example: CIM_*Device* or CIM*.

source end role

The reference in an association class that is on the source side when performing an association traversal. The source side is where the traversal begins.

far end role

The reference in an association class that is on the far side when performing an association traversal. The far side is where the traversal ends.

traditional operations

The CIM-XML operations originally defined by the DMTF in (DSP0200) for requesting multiple instances from a WBEM server are EnumerateInstances, EnumerateInstanceNames, Referencess, ReferenceNames, Associators, AssociatorNames, and ExecQuery. These are monolithic operations and expect the WBEM server to prepare complete responses before returning any results. Because the response must be either contain all of the requested instances or an error response they causes issues with very large reponses. In later versions of (DSP0200), an alternative to the above operations named pull operations were added to improve memory and response efficiency.

backslash-escaped

The UNIX-like shells interpret single and double quotes in a certain way and remove them before passing the arguments on to the program invoked. Because the single and double quotes in INSTANCENAME need to be passed on to pywbemcli, they need to be protected from removal by the shell. This can be achieved by putting INSTANCENAME into single quotes if it only includes double quotes, or into double quotes if it only includes single quotes. If there is a mix of single and double quotes in INSTANCENAME, or if shell variables need to be expanded, this can be achieved by backslash-escaping any double quotes in INSTANCENAME, and putting it into double quotes.

default connection

A connection definition in the connections file that is used by pywbemcli as the current connection if pywbemcli is started without any connection definition (no --server general option, --mock-server general option, or --name general option) and a defined default connection.. A connection definition in the connections file becomes the default connection on pywbemcli startup if it is specified using the connection select command with the --default/-d command option.

current connection

The connection definition in pywbemcli that is currently active; it is the target connection for pywbemcli commands. The current connection is created on pywbemcli startup with the following options --server general option, --mock-server general option, or --name general option or if a default connection) has been defined. The current connection can be changed in the interactive mode with the connection select command.

named connection

A connection definition that is in a connections file and can be used by referencing it by name with the :ref:–name general option`. Named connections can be created, modified, and deleted with the connection command group.

default namespace

The CIM namespace set as the current namespace for CIM operations if pywbemcli is started with a connection defined but without a specific namespace defined. Pywbemcli uses root/cimv2 as the default namespace.

CQL

CQL (CIM Query Language) is a query language defined by DMTF for use by query operations against WBEM servers. In operation parameters that define the use of a query language, it is specified with the string DMTF:CQL. CQL is described in DMTF standard DSP0202.

WQL

WQL (WBEM Query Language) is a query language defined by Microsoft for use by query operations against WBEM servers. In operation parameters that define the use of a query language, it is specified with the string WCL. CQL is described in informal specifications generally available on the internet. WQL is not a DMTF standard and there are differences in implementations partly because of different versions of the WQL specification. A number of WBEM servers implement WQL query processors because WQL was the first query language defined for CIM query operations.

query language

A language defined to support query operations against WBEM servers specifically the ExecuteQuery operation and its corresponding pull operation. A WBEM server may implement any desired query language but the DMTF specifies the characteristics of the CQL the WQL query language is specified by Microsoft documents.

filter query language

A query language defined to support the DMTF pull instance enumeration operation (ex. OpenEnumerateInstances, PullEnumerateInstances) specifically so that filtering of responses based on a query statement can be integrated into the enumeration of the instances. The DMTF defined the filter query language FQL (defined in DMTF specification (DSP0212))as one possible filter query language

See :term:query languages for query languages that support the ExecuteQuery operation and its corresponding pull operation.

Query languages and filter query languages are not interchangable.

schema

A schema (named CIM schema in the DMTF specification DSP0004) in the DMTF CIM model is a set of classes with a single defining authority or owning organization. In the CIM model, the schema elements for a class is defined as the components of the class name separated by the character “_” and the schema is the first such element. For example CIM is the schema for the class CIM_ManagedElement.

CIM Schema

The collection of qualifier declarations and classes created and maintained by the DMTF that make up the DMTF CIM model. This collection is regularly released by the DMTF as a package marked with a version number (ex. version 2.41.0). The DMTF CIM Schemas can be retrieved from the DMTF web site at: https://www.dmtf.org/standards/cim .

CIM indication subscription
indication subscription

A CIM indication subscription is the definition of listener destination and indication filter contained within an association class (CIM_IndicationSubscription class) that defines for a WBEM server the characteristics of indications to be generated and where they are to be sent. The listener destination is defined by the Handler reference property (class name CIM_ListenerDestination) and the filter is defined by the Filter reference property(class name CIM_IndicationFilter). The DMTF indication profile and is defined in DSP0154

CIM indication destination
listener destination

A listener destination is an instance of a CIM class that maintains a reference to a listener within an implementation. Specifically within the scope of pywbemcli it is an instance of the class CIM_ListenerDestinationCIMXML where the listener reference is the Destination property which contains the URL of the target indication listener.

CIM indication filter
indication filter

An indication filter is an instance of a CIM Class (CIM_IndicationFilter) that defines characteristics of indications that the WBEM server will generate. The basis for the indication characteristics is the query language and query statement properties of the instance.

dynamic indication filter

An :term: indication filter whose lifecycle is controlled by a client

subscription manager ID

A subscription manager ID is a string that is used as a component in the value of the Name property of owned indication filter and listener destination instances and thus allows identifying these instances in a WBEM server. The SubscriptionManagerID allows creating groups of owned indication destinations, filters and subscriptions. The subscription manager ID is a fixed string (defaultpywbemcliSubMgr) in pywbemcli

connection definition

The collection of parameters for a single pywbemcli connection to a WBEM server. This includes server location (URI), user/security information for the connection (user name and user password, certificates), pywbemcli connection configuration parameters used by pywbem to execute the connection including timeout, use of pull operations, etc. that are typically defined in the pywbemcli general options. These connection definitions can be persisted in a pywbem connection file and then referenced by name in future pywbemcli calls.

Profile advertisement methodologies

This section briefly explains the profile advertisement methodologies defined by DMTF. A full description can be found in DSP1033.

These methodologies describe how a client can discover the central instances of a management profile. Discovering the central instances through a management profile is the recommended approach for clients, over simply enumerating a CIM class of choice. The reason is that this approach enables clients to work seamlessly with different server implementations, even when they have implemented a different set of management profiles.

The DMTF defines three profile advertisement methodologies in DSP1033:

  • GetCentralInstances methodology (new in DSP1033 1.1)

  • Central class methodology

  • Scoping class methodology

At this point, the GetCentralInstances methodology has not widely been implemented, but pywbem supports it nevertheless.

All three profile advertisement methodologies start from the CIM_RegisteredProfile instance that identifies the management profile, by means of registered organization, registered name, and registered version.

It is important to understand that the CIM_RegisteredProfile instance not only identifies the management profile, but represents a particular use of the management profile within its scoping profiles. For an autonomous profile, there are no scoping profiles, so in that case, there is only one use of the autonomous profile in a server. However, component profiles do have scoping profiles, and it is well possible that a component profile is used multiple times in a server, in different scoping contexts. If that is the case, and if discovery of central instances using any of the profile advertisement methodologies is supposed to work, then each such use of the profile needs to have its own separate CIM_RegisteredProfile instance, because each such use of the profile will also have its own separate set of central instances.

Unfortunately, neither the DMTF standards nor the SMI-S standards are clear about that requirement, and so there are plenty of implementations that share a single CIM_RegisteredProfile instance identifying a particular component profile, for multiple distinct uses of the profile by its scoping profiles. In such a case, the profile advertisement methodologies will not be able to distinguish the distinct sets of central instances alone, and other means need to be used to distinguish them.

It is also important to understand that the choice which profile advertisement methodology to implement, is done by the WBEM server side. Therefore, a WBEM client such as pywbem needs to support all methodologies and needs to try them one by one until one succeeds. Pywbem tries the three methodologies in the order listed above.

In the GetCentralInstances methodology, the CIM_RegisteredProfile instance has a CIM method named GetCentralInstances that returns the instance paths of the central instances of the use of the profile.

In the central class methodology, the CIM_RegisteredProfile instance is associated directly with the set of central instances of the use of the profile, via a CIM_ElementConformsToProfile association.

In the scoping class methodology, the CIM_RegisteredProfile instance is not associated directly with the set of central instances of the use of the profile, but delegates that to its scoping profile. The client navigates up to the CIM_RegisteredProfile instance representing the (use of the) scoping profile, looks up its central instances, and from each of those, navigates down along the reversed scoping path to the central instances of the profile in question. The scoping path of a component profile describes the traversal across associations and ordinary classes from the central class to the scoping class of the profile. This profile advertisement methodology is obviously the most complex one of the three.

Pywbem encapsulates the complexity and choice of these methodologies into a single invocation of an easy-to use method pywbem.WBEMServer.get_central_instances().

Profile implementations in a WBEM server are not entirely free when making a choice of which methodology to implement:

  • Autonomous profiles in a WBEM server must implement the central-class methodology, and may in addition implement the GetCentralInstances methodology.

    Note that the scoping class methodology falls together with the central class methodology for autonomous profiles, because their scoping class is also their central class.

  • Component profiles in a WBEM server may implement the central class methodology and the GetCentralInstances methodology, and must support the scoping class methodology.

    Note that implementing the scoping class methodology in a WBEM server requires implementing the classes and associations of the scoping path, which are usually mandatory anyway. So while the scoping class methodology is more complex to use for clients than the central class methodology, it is easier to implement for servers.

Use of the scoping class methodology by a client requires knowing the central class, scoping class and scoping path defined by the component profile.

DSP1001 requires that conformant autonomous profiles specify a central class, and that conformant component profiles specify a central class, scoping class and a scoping path.

Older DMTF component profiles and older SNIA subprofiles do not always specify scoping class and scoping path. In such cases, the scoping class and scoping path can often be determined from the class diagram in the specification for the profile. Many times, CIM_System or CIM_ComputerSystem is the scoping class.

Change log

pywbemtools 1.1.2.dev1

Released: not yet

Incompatible changes:

Deprecations:

Bug fixes:

Enhancements:

Cleanup:

  • Use Ubuntu 20.04 for os target for some github CI tests because python setup action does not include Python 3.5 and 3.6 for ubuntu 22.04 (i.e ubuntu-latest as of Nov 2022) which causes scheduled test failure. See issue #1245

Known issues:

pywbemtools 1.1.1

Released: 2022-11-10

Bug fixes:

  • Changed the development status of the Python package from “4 - Beta” to “5 - Production/Stable”. This actually applies since version 1.1.0. (issue #1237)

pywbemtools 1.1.0

This version contains all fixes up to version 1.0.1.

Released: 2022-11-08

Incompatible changes:

  • Dropped support for Python 3.4. (issue #1129)

  • Removed deprecated commands (server namespaces and server interop. These commands are part of the namespace group namespace list and namespace interop.)

Bug fixes:

  • Resolved new issues reported by Pylint 2.13. (issue #1164)

  • Fix issue where the instance shrub –fullpath option was not displaying the paths. (see issue #1180)

  • Fixed new formatting issues raised by flake8 5.0.

  • Fixed issue where the instance shrub command duplicated the results instances tree in cases where there was an inter-namespace association and displayed the complete ClassName of the association class rather than just the class name. (see issue #1191)

  • Fix issue where we were not setting the flag to use the general option –max-pull-option when the was defined with an interactive command. This meant that the option was ignored for the current command. (see issue # 1193).

  • Fixed a flake8 AttributeError when using importlib-metadata 5.0.0 on Python>=3.7, by pinning importlib-metadata to <5.0.0 on these Python versions.

Enhancements:

  • Increased minimum version of Click to 8.0.1 on Python >= 3.6 to prepare for new features. Adjusted testcases accordingly.

  • Extended class/instance enumerate/get/associators/references and qualifier enumerate to allow getting the objects from multiple namespaces with a single request. This extends the command option –namespace to allow multiple namespaces for these commands using either comma-separated format (ex. –namespace root/cimv2,root/cimv3) or multiple definitions of the option (ex. –namespace root/cimv2 –namespace root/cimv3) The display of results have been extended to include the namespace name for the objects in all of the output formats if multiple namespaces are used. As before, the namespaces are not shown if only a single or the default namespace is requested.(see issues #1058 and #1059)

  • Add a new option (–object-order) to class and instance enumerate/get/associators/references and qualifier enumerate/get to reorder the command results displays by the object name rather than the default of namespace name. This allows the user to more easily compare the objects themselves in different namespaces. (see issues #1058 and #1059)

  • Extended documentation to better document the use and characteristics of the general options and the creation of the mock WBEM server script (see issue #1190)

Cleanup:

  • Extend use of general options in interactive mode to allow setting the connections-file for an interactive command. (see issue #1037)

  • Change DOCKER TEST_SERVER_IMAGE defined in Makefile to use one created from OpenPegasus toolset. See github OpenPegasus/OpenPegasusDocker repository for pegasus, pegasus tools, and pegasus docker build tools. This image should be faster and is smaller (lt 400 mb) although still too large. This docker file was created using the Docker definition and makefiles in the github project OpenPegasus and repository OpenPegasusDocker. It contains a build of OpenPegasus on Ubuntu 20.04 platform with the OpenPegasus test provider environment installed. The docker server image build was tested against the OpenPegasus testsuite. However, the interop namespace was modified to use root/interop in the container. The image contains the OpenPegasus components to run the server against a repository based on the DMTF schema version 2.41.0.

  • Remove deprecated commands server namespaces and server interop.

  • Fixed tests that fail because XML output of classes and qualifier declarations return attributes not ordered before python version 3.8. (see issue #1173).

  • Modify tests/unit/pywbemcli/wbemserver_mock_class.py to remove the CIMInstanceName host lement used in creating a ProfileImplements instance. That element of CIMInstanceName is not allowed on Create instance of association classes and as of pywbem 1.5.0 that limitation is enforces. (see issue #1203)

  • Modify instance shrub command to only display the classname of the association class (i.e. reference_class). Even with multi namespace environments the reference class must be in the target namespace.

  • Extend the pywbemtools documentation to further explain the mock server support, and how to create mock environments using MOF and python scripts including many more references back to the pywbem documentation.

  • Clarify the usage of the general options in the documentation. (see issue #1162)

  • Clean up issues in the docs where items in bullet lists do not show the bullets Changes rtd-requirements to avoid suspect versions. (see issue #1218)

  • Update to requirements files for new Nov 2022 security issues with wheel, safety, and py. (see PR # 1627)

pywbemtools 1.0.0

This version contains all fixes up to version 0.9.1.

Released: 2022-02-01

Incompatible changes:

  • The PYWBEMCLI_TERMWIDTH environment variable was renamed to PYWBEMTOOLS_TERMWIDTH since it is common to all pywbemtools commands.

  • Changed option –default on command connection select to set-default. to be compatible with other commands that touch the default connection definition.

  • Removed the deprecated option --force from the class delete command. It had been marked deprecated in pywbemtools version 0.9.0 and was superseded by the --include-instances option which performs exactly the same function. (see issue # 1142)

Bug fixes:

  • Test: Fixed that test_utils.py changed the PYWBEMCLI_TERMWIDTH env var for testing purposes without restoring it.

  • Fixes issue where the command: class invokemethod <class> <method> -n <namespace> ignores the command namespace option (-n) and usedsthe default namespace. (see issue #990)

  • Fix issue where an exception occurs if the user tries to display cim instances as a table but the class for the instances returned are not in the default namespace and an alternate namespace is defined for the command. The function display_cim_objects(…) uses valuemapping_for_property() but specifies the default namespace as the target. (See issue #995)

  • Fixed issues raised by new Pylint versions 2.9 and 2.10.

  • Fixed an error that resulted in exception traceback when instance commands used the instance wildcard (e.g. ‘CIM_ManagedSystemElement.?’) and the enumerate instances operation failed for some reason. (issue #963)

  • Fix issue where the general help for ‘–log’ was unclear. (see issue #1025)

  • Fixed an error that resulted in exception traceback when instance commands used the instance wildcard (e.g. ‘CIM_ManagedSystemElement.?’) and the enumerate instances operation failed for some reason. (issue #963)

  • Fix issue with –log general option where the log was left enabled when the option was used in interactive mode command; it did not revert to the log state before the interactive command. The change caused the log configuration to restore to either off if there was no –log option on the subsequent command line or to the value defined on the command line.(see issue #1023)

  • Disabled new Pylint issue ‘consider-using-f-string’, since f-strings were introduced only in Python 3.6.

  • Fixed install error of wrapt 1.13.0 on Python 2.7 on Windows due to lack of MS Visual C++ 9.0 on GitHub Actions, by pinning it to <1.13.

  • Fix issue with message from _common.py (parse_version_value) that was passed to warning_msg but should have been subclass of python warning. Changed to use pywbemtools_warn(). (see issue #1041)

  • Fixed issue with Sphinx and python 2.7 by changing the sphinx requirements in dev-requirements.txt and minimum-constraints.txt. (see issue #1070)

  • Modify dev-requirements.txt to limit version of more-itertools to != 8.11.0 for python < 3.6. (see issue #1077)

  • Fixed new issues raised by pylint 2.12.2.

  • Fixed issue with instance commands (ex. instance get, references, etc) that use the wildcard .? to request that pywbemcli present list of possible instances. It was not handling the non-existence of class in the target namespace correctly and would crash because no instances were returned get_instanceNames() . Now generates an exception. (see issue #1105)

  • Fixed issues in “instance count” including unitialized variable and correctly finishing scan when errors occur. Adds new option to this command to allow user to ignore classes defined with this option (–ignore-class). (see issues #1108 and #916 )

  • Fixed issue where pywbemcli can get exception if used against server that does not support pull operations (see #1118)

Enhancements:

  • Added a ‘pywbemlistener’ command for running and managing WBEM listeners. (issues #430, #479, #948)

  • Implement server schema command that returns information about the schemas for each namespace including: 5. the DMTF schemas, 2. schema version, 3. whether any classes in the schema/namespace are experimental, and 4) the number of classes in this schema, and 5. the DMTF schemas (characters before the _ in the namespace). (see issue #444)

  • Remove restrictions on parameter modification of server parameters when the –name general option is specified. Originally the –name server definition could not be modified with other general options (ex. –timeout). Those restrictions are removed. (see issue #1034)

  • Generate exception when general options such as –user, –password, etc. that apply only to the server are used with the –mock-server general option. (see issue #1035)

  • Extend the capability to set the default connection in a connections file to the connection save command and a specific command that will set or clear the default. Since the ability to set the default connection was only an option in the connection select command it was difficult to find. This makes the functionality more visible and more usable.

  • Enhanced test matrix for push-driven runs on GitHub Actions to add Python 3.5 on macOS, and removing Python 3.5 minimum on Windows.

  • Implement command group subscription that manages the creation, viewing and removal of indication subscription on WBEM servers. This creates a new command group ‘subscription’ and new commands for adding, removing, and displaying (list) indication destination, filter, and subscription instances on target WBEM servers. It includes the code for the new commands, a set of tests and the documentation for the new commands. (see issue #4)

  • Add new MutuallyExclusiveOption class to pywbemtools/_click_extensions.py to allow defining command options as mutually exclusive. See the class for documentation. Modify pywbemcli.py mutually excluseive options –server, –name, and –mock-server to use this class.

  • Increased minimum version of pywbem to 1.4.0. (issues #1020, #991, #1124)

  • Support for Python 3.10: Added Python 3.10 in GitHub Actions tests, and in package metadata.

  • Implement an end-end test for the subscription command group.

  • Changed output format for table output of instance enumerate –no option to show each key as a column in the table so that keys are more readable.

  • The ‘-v’ option now displays better information about namespace creation and deletion, particularly in mock environments. (related to issue #991)

  • Test: Added testcases for namespace creation and deletion. (related to issue #991)

  • Extended the table view of CIM instances to improve formatting, allow hiding columns where all property values are Null (–show-null option) and allow the table to be wider than the terminal width if there is more information than could be shown in the terminal width. (see issue #1131)

Cleanup:

  • Prepared the development environment for having more than one pywbemtools command. As part of that, moved a number of utility functions from the ‘pywbemtools/pywbemcli’ subdirectory to the common ‘pywbemtools’ directory.

  • Moved the environment variable names from being class attributes on the PywbemServer class to become constants in the config module. (issue #658)

  • Cleanup the test code used as pywbemcli scripts. Named all of them with the last part of the name _script.py and modified them to use the setup initialization with Python 3.6 and greater as well as the old script interface.

  • Modify pywbemcli.py code that copies command line defined pywbem_server for reuse in interactive commands to use WBEMConnection.copy() rather than deepcopy(). This includes adding a copy() method to PywbemServer. This also requires that the minimum version of pywbem be set to at least 1.3.0 where the copy() method was added to pywbem (see issue #1030). This fixes issue in python 2.7 with exception and avoids copying the FakedWBEMConnection CIM repository.

  • Add list of security issues to be ignored by Makefile security test and enable failure of build if security test fails. This brings Pywbemtools into line with pywbem Makefile.Reordered some of the items in the minumum_constraints.txt file to better compare with the pywbem file and also commented out all minimum constraints for Jupyter and its dependencies since we have no notebooks in pywbemcli today. Modified minimum version of typed-ast, pylint and astrid to match pywbem and pass saftey tests.

  • Remove the file minimum-constraints-base.txt and put contents into minimum-constraints.txt. (see issue #1076)

  • Add instance count tests to end-end testing against OpenPegasus.

  • Removed the deprecated option --force from the class delete command. It had been created in pywbemtools version 0.8.0 and was deprecated in version 0.90 in favor of the --include-instances option which performs exactly the same function. (see issue # 1142)

pywbemtools 0.9.0

This version contains all fixes up to pywbemtools 0.8.1.

Released: 2021-05-03

Incompatible changes:

  • Modified the –timestats general option from boolean to choice with 3 choices for when statistics are displayed (after each command or via a command). See issue #588)

Deprecations:

  • Deprecated the ‘server namespaces’ and ‘server interop’ commands. Use the new commands ‘namespace list’ and ‘namespace interop’, respectively. (issue #877)

  • The ‘–force’ / ‘-f’ option of the ‘class delete’ command has been deprecated because its name does not sufficiently make it clear that other inhibitors than existing instances of the class (such as existing subclasses, or referencing classes) will still cause rejection of the command. Use the new ‘–include-instances’ option instead. (issue #885)

Bug fixes:

  • Fixed a ValueError on Windows that was raised when the connections file was not on the home drive.

  • Limit click package to < 8.0 because of a) incompatibility with python 2.7, b) incompatibility between click 8.0 and clicl-repl. (see issues #816 and #817)

  • Limit mock package to lt 4.0.3 to avoid issue issue that causes test failure. (see #822)

  • Fix issue caused by mock package version 4.0.3 by creating replacements for warnings.warn and warnings.warn_explicit functions and removing the use of the patch decorator in pywbemcli.py before the definition of the cli function. (see issue #822)

  • Fixes issue where in pywbemcli the –timeout and –use-pull general options were not always correctly included in the new object context in interactive mode if they were specified on the interactive mode cmd line.

  • Fixed issue in tests with use of stdin and inputting the instance path for instance get and instance delete. This was a test setup issue and not a code issue. (see issue # 387)

  • Mitigated the coveralls HTTP status 422 by pinning coveralls-python to <3.0.0.

  • Fix issue where documentation index disappeared when we changed the documentation theme (see issue #868)

  • Test: Fixed behavior of ‘pdb’ test condition, which is supposed to stop in the pdb debugger before executing the command function, but did immediately leave the debugger again because of redirections of the standard streams. The debugger now properly comes up when ‘pdb’ is specified as a condition.

  • Test: Fixed restoring of environment variables that are modified by testcases, and displaying of PYWBEMCLI environment variables during testing in verbose mode.

  • Change MOFCompiler.add_mof/remove_mof() to only display exceptions received if not MOFCompileError since the MOF compiler logs all MOFCompileError exceptions. (see issue #395)

Enhancements:

  • Increased the minimum pywbem version to 1.2.0.

  • Add new option to class find command (–summary) to display a summary of the counts of classes found instead of the full list of the classes to make the command more useful for real servers that may return many classes for a class find. (see issue #810)

  • Extend the class tree command to optionally provide extra information about each class in the tree including 1) the value of the Version qualifier if it exists and whether the class is Abstract, an Association, or an Indication class. (see. # 817)

  • Migrated from Travis and Appveyor to GitHub Actions. This required several changes in package dependencies for development.

  • The verbose option (‘-v’ / ‘–verbose’) now also displays the objects that are compiled into a mock environment when setting it up.

  • Added ‘qualifier delete’ command. (see #884)

  • Enabled the tests for Python 3.4 on Windows again - this required some changes in the Makefile and constraints files.

  • Added a ‘namespace’ command group that allows listing, creating and deleting CIM namespaces, and showing the Interop namespace. The ‘server namespaces’ and ‘server interop’ commands that provide a subset of that functionality have been deprecated. (issue #877)

  • Added commands ‘add-mof’ and ‘remove-mof’ for compiling MOF to the ‘server’ command group. (issue #886)

  • Test: Added end2end test capability using the OpenPegasus container image on Docker Hub.

  • Added new command group (‘statistics’) that contols use of statistics. See issue #588)

  • Implement command to get statistics from server and present as a table #895)

  • Test: Added a unit test module for _utils.py.

  • Added an ‘–include-instances’ option to the ‘class delete’ command that replaces the deprecated ‘–force’ / ‘-f’ option. (issue #885)

  • Added an ‘–include-objects’ option to the ‘namespace delete’ command that causes the deletion of instances, classes and qualifier types in the targeted namespace before the namespace itself is deleted. The objects in the namespace are deleted in the correct order of dependencies so that no dangling dependencies exist at any point in the operation. (issue #885)

  • Added a ‘’–dry-run’ option to the ‘class delete’ and ‘namespace delete’ commands. If used, it displays the message about each deletion with a ‘Dry run:’ prefix and does not perform the actual deletion. (issue #911)

Cleanup:

  • Cleaned up the circumvention for Click issue #1231 by upgrading the minimum Click version to 7.1.1, where possible. The circumvention is still required on Python 2.7 and 3.4 on Windows.

  • Clarified in the help text of general option ‘–pdb’ that it will be ignored in interactive mode but can be specified on each interactive command.

  • Test: Added a check that rejects the use of the ‘pdb’ test condition when the test specifies stdin for the test, because the ‘pdb’ test condition disables the stdin/stdout/stderr redirection.

pywbemtools 0.8.0

This version contains all fixes up to pywbemtools 0.7.3.

Released: 2020-10-13

Incompatible changes:

  • Moving the commands “server profiles” and “serve centralinsts” to the new group profiles with the commmand names “profile list” and “profile centralinsts” added a command group and removed 2 commands from the server command group. (See issue #612)

  • The –deprecation-warnings / –no-deprecation-warnings general option has been remamed to –warn / –no-warn, and it now controls the display of all Python warnings.

Bug fixes:

  • Order display of instance names when the .? is used to pick an instance name so the same order of instance names is displayed for all versions of Python. (See issue #458 and #459)

  • Pinned prompt-toolkit to <3.0 on Python 3.8 on Windows to avoid WinError 995. (See issue #690)

  • Fixed exception when command entered in interactive mode, on Python 2. (See issue #224)

  • Test: Default connection file does not get restored in some cases during test. (See issue #680)

  • AssociationShrub produces instancename slightly different table output in some cases for pywbem 1 vs previous versions(inclusion of “/:” prefix). (see issue #704)

  • Test: Fixed attempt in test_class_cmds.py to invoke a non-static method on a class object. (see issue #707)

  • Fix help message for “–deprecated” to be unicode so python 2.7 help does not fail. (see issue #725). This error was added with issue #678

  • Upgraded nocasedict and nocaselist packages to pick up fixes.

  • Error in test defintion for qualdecl Indication causes failure with pywbem i.1.0 where mocker validates qualifiers scopes. (see issue #766)

  • Test: Preventive fix for potential issue with virtualenv raising AttributeError during installtest on Python 3.4. (see issue #775)

  • Test: Added checking for no expected warning. (see issue #774)

  • Fixed incorrect property order in instance table output, where key properties were not ordered before non-key properties but ordered along with them. (see issue #782)

  • Docs/Test: Fixed failing install of Jinja2 on Python 3.4 by adding it to dev-requirements.txt and pinning it to <2.11 for Python 3.4.

  • Test: Aligned qualifier definitions in test MOF with CIM Schema. (related to issue #788)

  • Upgraded pywbem to 1.1.1 to pick up fixes and enhancements. (see issues #749, #183)

Enhancements:

  • Introduced caching of the mock environment used by connection definitions in order to speed up the loading of the connection definition. The mock environments are stored in directory ~/.pywbemcli_mockcache and are automatically managed. The pywbemcli –verbose general option can be used to show messages about the cache management. (See issue #689)

  • A new approach for the setup of mock scripts has been introduced: The mock script defines a setup(conn, server, verbose) function that is called when the mock environment is built. It is not called when the mock environment is reinstantiated from the cache. The old approach with setting global variables CONN, SERVER, VERBOSE is still supported, but the mock environment cannot be cached and will be built every time when mock scripts with that setup approach are used. On Python <3.5, mock scripts with the setup() function are rejected, because the functionality to import them is not available, and the compile+exec approach does not allow executing the setup() function. (See issue #689)

  • Modify general help to display the full path of the default connections file. (See issue #660)

  • Move the commands associated with WBEM management profiles from the server group to a new profile group. (See issue #612). See also Incompatible changes.

  • Add –deprecated/-no-deprecated as a new qualifier filter for the class enumerate, class find, and instance count commands. Extend the behavior so that for each of the possible filters it looks for the qualifier on all of the elements (property, method, parameter) in addition to the class itself. See issue #678)

  • Test: Enabled coveralls to run on all Python versions in the Travis CI, resulting in a combined coverage for all Python versions.

  • For instance display in table format, added the display of the units of properties to the table headers. If a property in the class has a PUnit or Units qualifier set, the unit is translated to a human readable SI unit using the pywbem.siunit_obj() function, and appended to the property name in square brackets. (See issue #727)

  • Consolidated the warnings control, such that the deprecation messages were changed to be issued as Python warnings, and the –warn / –no-warn general options now control the display of all Python warnings. If –warn is used, all Python warnings are shown once. If –no-warn is used (default), the PYTHONWARNINGS environment variable determines which warnings are shown. If that variable is not set, no warnings are shown. (See issue #723) Added the ‘mock’ package and for Python 2.7, the ‘funcsigs’ package as new dependencies.

  • Specifying a property list (–pl option) on instance commands with table output formats now uses the order of properties as specified in the property list in the output table, instead of sorting them. (See issue #702)

  • Allow unsetting general options. Originally the general options could be either set specifically by defining them on the command line or the default would be enabled. However, in interactive mode the need may arise to set an option back to its default value (i.e. the equivalent of not including it on the command line). This fixes the options so that there is an alternative that will will set them to the default value. (see issue #350)

  • Converted remaining unittest testcases to pytest. (See issue #91)

  • Test: When testing with latest package levels, the package versions of indirect dependencies are now also upgraded to the latest compatible version from Pypi. (see issue #784)

Cleanup

  • Remove unused NocaseList from __common.py

  • Moved the general option –pull_max_cnt to become part of the persistent server definition rather than transient. This means that this parameter is part of the data maintained in the server definitionfile and applies to just the server defined. (See issue #694)

  • Docs: Improved the description and help texts of the connections file and the –connections-file general option in various places, for consistency. (Related to issue #708)

  • Move code associated with display_cimobjects() to a separate module. This is part of creating table representation of classes (See issue #249)

  • Resolved remaining Pylint issues and enforced clean pylint checks. (See issue #668)

  • Renamed the default connections file in the user’s home directory from pywbemcli_connection_definitions.yaml to .pywbemcli_connections.yaml, because it is really an internal file not meant for being edited. An existing file with the old name is migrated automatically. (See issue #716)

  • Refactor error handling for connections file handlingif there are problems with the YAML file or loading the file. Created new exceptions for the Connections File and created a unit test and function error test. (see issue #661)

  • Separate code to execute test files (ex. setup up mock of prompt) from the process of executing files defined by the –mock-server general option. The new capability is controled by an environment variable “PYWBEMCLI_STARTUP_SCRIPT” that is considered intenal to pywbemcli testing.

  • Refactor statistics display to present information consistent with the display in pywbem. (see issue # 724)

  • Refactor connections show command and clean up its documentation. (see issue #732)

  • Remove use of pydicti dictionary package in favor of NocaseDict.

  • set pylint disable on all uses of pdb.set_trace(). This is an issue between the add-on package pdbpp and lint, not pdb. (see issue # 751)

  • Docs: Changed Sphinx theme to sphinx_rtd_theme. (see issue #792)

  • Modified the class WbemServerMock in tests/unit/testmock to define a WBEM server configuration that includes multiple namespaces, a user and an interop namespace to test cross-namespace mock. (see issue #183)

pywbemtools 0.7.0

This version contains all fixes up to pywbemtools 0.6.1.

Released: 2020-07-12

Incompatible changes:

  • The default location for the connections file (pywbemcli_connection_definitions.yaml) has been moved from the users current directory to the users home directory. A general option (connections_file) allows the user to set other directories and file names for this file. (See issue #596)

Deprecations:

  • Deprecated support for Python 2.7 and 3.4, because these Python versions have reached their end of life. A future version of pywbemtools will remove support for Python 2.7 and 3.4. (see issue #630).

Bug fixes:

  • Fixed incorrect connection list output in readme files (see issue #593).

  • Fixed yaml.RepresenterError during ‘connection save’ command. This introduced a dependency on the yamlloader package. (see issue #603).

  • Fixed possible issue where the connection test command would fail on a server that did not support class operations. (See issue #606)

  • Pinned version of colorama to <0.4.0 for Python <=3.4.

  • Adjusted to changes in the pywbem mock support for method providers, in the sample method provider simple_mock_invokemethod_pywbem_V1.py. (See issue #646)

  • Fix issue with MOF compile in pywbem_mock to account for changes to pywbem.FakedWBEMConnection in pywbem 1.0.0. Because the pywbem mocker stopped displaying compile error messages, this change modifies the code to display the compile errors as exceptions for pywbem 1.0 and use the original display for pre 1.0 pywbem version. With pywbem 1.0.0 it also outputs the compile error message and exception to stderr whereas before the compile error text was routed to stdout. (See issue #637)

  • Fixed an issue where displaying instances in a table format missed properties if the list of instances had different sets of properties. (See issue #650)

  • Change the table output for outputformat html to output the title parameter as an html caption entity instead of as a paragraph. This allows html tables to be subtabled and also presents the table title better. (see issue #721)

Enhancements:

  • Enabled installation using ‘setup.py install’ from unpacked source distribution archive, and added install tests for various installation methods including this one. (see issues #590, #591).

  • Enhance output formats to allow an additional format group TEXT with a single format text. This format outputs the command result as a text string to the console and is use for simple commands like server interop that only output one piece of data. (see issue #594)

  • Extended the command connection test so that it will also test for existence of the DMTF pull operations. It tests for all of the operations and reports success or failure on each operation.

  • Added value-mapped strings to properties in instance table output. For integer-typed (scalar or array) properties that have a ValueMap qualifier, the output of instances in table format now includes the value of the Values qualifier in parenthesis, in addition to the integer value. (See issue #634)

  • The order of properties when displaying instances in a table format is now predictable: First the sorted key properties, then the sorted non-key properties. (Part of fix for issue #650)

  • Modify connections file location functionality so that the default file location is the users home directory. Any other directory and filename can be specified using the general option connections_file which has a corresponding environment variable. (See issue #596)

Cleanup

  • Adds command to test connection for existence of the pull operations (connection test-pull)

  • Refactored display_class_tree() and other functions in _displaytree.py and _cmd_class.py cmd_class_tree function to eliminate boundary conditions, and clarify code.

  • Extended parameter type testing in class PywbemServer so that all constructor parameters are value tested. This specifically fixes issue where we were depending on WBEMConnection to test types of ca_certs and invalid data types could get into the connections file. (See issue #663).

  • Added a function test test module test_misc_errors.py that tests for some common exceptions that apply to many commands (ex. connection error).

pywbemtools 0.6.0

This version contains all fixes up to pywbemtools 0.5.1.

Released: 2020-04-10

Bug fixes:

  • Fix issue with mixed old and new formats on click.echo statement. (See issue #419)

  • Fixed missing Python 3.7 in supported environments shown on Pypi. (See issue #416)

  • Fixed that the ‘class find’ command showed the –namespace option twice (see issue #417)

  • Added PyYAML>=5.1 as a prerequisite package for pywbemtools for installation. So far, it was pulled in indirectly via pywbem.

  • Fixed case sensitive matching of class names in instance modify by picking up the fix in pywbem 0.14.6. (See issue #429).

  • Fixed issue where extra diagnostic information about click was being displayed when the general option –verbose was defined.

  • Fixed issue with x509 parameter of WBEMConnection. (See issue #468)

  • Fixed issue with class find command not returning connection error when cannot connect to server.

  • Added documentation for the –version general option.

  • Increased pywbem minimum version to 0.16.0 to accomodate install issues on Python 3.4, and to pick up other fixes.

  • Test: Accomodated new formatting of error messages in Click 7.1.1, and excluded Click 7.1 due to bug.

  • Test: Fixed dependency to Python development packages on CygWin platform in Appveyor CI.

  • Pygments 2.4.0 and readme-renderer 25.0 have removed support for Python 3.4 and have therefore been pinned to below these versions on Python 3.4.

  • Fix bug where order of commands listed in help output was different for different versions of Python. (See issue #510)

  • Increased minimum version of pluggy package from 0.12.0 to 0.13.0 because it failed during loading of pytest plugins on Python 3.8. (See issue #494)

  • Test: Changed testcases that check the CIM-XML generated with output format ‘xml’ to tolerate the different order of XML attributes that happens on Python 3.8 (See issue #494)

  • Fixed several badges on the README page.

  • Remove use of pywbem internal functions from pywbemcli. This removes use of NocaseDict, _to_unicode, _ensure_unicode, _format from pywbemcli. (See issue #489)

  • Corrected issue with use-pull general option that causes issues with using the ‘either’ option with servers that do not have pull. (See issue #530)

  • Pinned dparse to <0.5.0 on Python 2.7 due to an issue.

  • Test: Fixed incorrect coverage reported at the end of the pytest run, by increasing the minimum version of the coverage package to 4.5.2. (See issue #547)

  • Test: Fixed bug with detection of invalid test validation values, and fixed testcases in turn (See issue #553).

  • Fixed issues in README and README_PYPI file (See issue #555)

  • Improvements and bug fixes in the way the INSTANCENAME parameter of pywbemcli commands is processed. (See issue #528)

  • Increased minimum versions of some packages used for development to address security issues reported by the pyup.io safety tool: twine, bleach, urllib3.

Enhancements:

  • Promoted development status of pywbemtools from Alpha to Beta. (See issue #476)

  • Add capability to reorder commands in the help for each group. The commands in all groups except for the top group (pywbemcli -h) are ordered in the help list by their order in their source file. The display of commands in the top level group is alphabetical except that connection, help, and repl are reordered to the bottom of the list. (See issue #466)

  • Define alternatives for creating INSTANCENAME input parameter since the original form using, WBEMURI is error prone with quote marks. (see issue #390)

  • Add prompt-toolkit auto-suggest. This extends the command completion capability in the repl mode (interactive mode) to make suggestions on command line input based on the history file. Usually auto-suggest completion will be shown as gray text behind the current input. Auto-suggest is not available in command line mode.

  • Add ability to filter results of ‘class enumerate’, ‘class find’, and ‘instance count’ commands for selected class qualifiers. This ability is based on 3 new options for each of the above commands ‘–association’, ‘–indication’, and ‘–experimental’ each of which has a corresponding ‘no-…’. The user can filter to find classes with combinations of these options returning only classes that meet the option criteria. Thus, ‘–association’ returns classes that are associations and ‘–no-association’ returns only classes that are not associations. See issue #447

  • Added support for disabling the spinner that is displayed by default during any ongoing activities, by setting the env var PYWBEM_SPINNER to ‘false’, ‘0’, or the empty string. This is useful when debugging. See issue #465.

  • Modified the response handling on commands that may return nothing with successful response to display a message if the general option –verbose is defined and display nothing if –verbose not set. This includes class/instance delete, instance modify and the commands that display cim objects. (See issue #123)

  • Changed the –ca-certs general option to support the changes as of pywbem version 1.0.0 (new values ‘system’ and ‘certifi’, and default changed from a fixed set of directories to ‘certifi’). The pywbem version is determined at run time and pywbem versions before 1.0.0 are still supported.

  • Test: Improved assertion messages in tests.

  • Output of “pywbemcli server profiles” command is now reliably sorted by version in addition to org and name. (See issue #500)

  • Added support for a new –pdb general option and corresponding PYWBEMCLI_PDB environment variable that causes the pywbemcli command to come up with the pdb debugger before invoking the specified command. This is a debug feature that is expected to be used mainly by the developers of pywbemcli. (See issue #505)

  • Test: Added support for entering the pdb debugger from specific unit testcases by setting the condition parameter of the testcase to the string ‘pdb’. This causes pywbemcli to be invoked with the new –pdb option for that testcase. (See issue #505)

  • Removed usage of the “pbr” package. It was used for automatic versioning of the pywbemtools package, but it had too many drawbacks for that small benefit (See issue #178):

    • Getting the minor version increased in a development version (instead of the patch version) by means of markers in the commit message never worked.

    • The package needed to be tagged twice during the release process.

    • If the last tag was too far in the past of the commit history, the shallow git checkout used by Travis failed and its depth needed to be adjusted. At some point this defeats the purpose of a shallow checkout.

  • Test: Added support for testing on Python 3.8 in Travis, Appveyor and Tox. (See issue #494)

  • Added support for adjusting the width of any help output to the terminal width. The width can be set using the PYWBEMCLI_TERMWIDTH env var. (See issues #518 and #542)

  • Docs: Increased the width of the help text to 120 (See issue #548).

  • Modified the help usage to better reflect the required and optional components of the command line. This includes showing the location in the cmd line for general options where before it was called [COMMAND-OPTIONS] and showing the positioning of both arguments and command arguments. (See issue #446)

  • Increased minimum version of pywbem to 0.17.0 (See issue #571)

  • Add option –full to connection list to create both a brief table output that only has 3 columns (name, server, mock-server) as default but when the option is set all of the columns currently in the report. We did this because it appears that the most frequent use of this command is to just get the name of the various servers defined within an 80 column display. This also now shows empty columns where the original report hid any columns that were empty. (See issue #556)

Cleanup:

  • Test: Enabled Python warning suppression for PendingDeprecationWarning and ResourceWarning (py3 only), and fixed incorrect make variable for that.

  • Test: Removed testfixtures from minimum constraints file, as it is not used.

  • Test: Increased minimum version of pytest from 3.3.0 to 4.3.1 because it fixed an issue that surfaced with pywbem minimum package levels on Python 3.7.

  • Code: refactor code to use only the .format formatter and remove all use of the % formatter.

  • Test: Added missing indirectly referenced prerequisite packages to minimum-constraints.txt, for a defined package level when testing with PACKAGE_LEVEL=minimum.

  • Clean up test mock files by merging mock_simple_model_ext.mof into mock_simple_model.mof

  • Changed some tests to account for behavior difference with pywbem 0.15.0 references and associations with invalid class, role.

  • Changed minimun version of pywbem to 0.15.0 because of test differences that resulted from differences between pywbem 0.14.6 and 0.15.0. The differences are in pywbem_mock where the code was changed to return errors for invalid classnames and roles in association and reference operations where it previously return empty, ignoring the invalid classname.

  • Added tests of all command groups and commands for server connection error.

  • Removed a circumvention for a pywbem bug related to colons in WBEM URIs that was fixed in pywbem 0.13.0. (See issue #131)

  • Added the general option –use-pull to the the PywbemServer() class so that it is persisted in the connection file and to the display of connection information (connection show and connection list). This means that –use-pull can now be set for a particular server permanently.(See issues #529 and #534).

  • Added table formatted output for connection show and removed original free-form output format. (See issue #572)

  • Added documentation on incremental search option to search the command history file in interactive mode. (See issue #595)

  • Added documentation index entries for commands, command groups, etc. (see issue #598)

pywbemtools 0.5.0

Released: 2019-09-29

This is the initial release of pywbemtools.

Document Index