Metadata-Version: 2.1
Name: pywbemtools
Version: 1.3.0
Summary: Python client tools to work with WBEM Servers using the PyWBEM API.
Home-page: https://github.com/pywbem/pywbemtools
Author: Karl Schopmeyer, Andreas Maier
Author-email: k.schopmeyer@swbell.net, maiera@de.ibm.com
Maintainer: Karl Schopmeyer, Andreas Maier
Maintainer-email: k.schopmeyer@swbell.net, maiera@de.ibm.com
License: Apache License, Version 2.0
Project-URL: Bug Tracker, https://github.com/pywbem/pywbemtools/issues
Project-URL: Documentation, https://pywbemtools.readthedocs.io/en/latest/
Project-URL: Source Code, https://github.com/pywbem/pywbemtools
Platform: any
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*
Description-Content-Type: text/markdown
License-File: LICENSE.txt
License-File: AUTHORS
Requires-Dist: pywbem >=1.7.2
Requires-Dist: nocaselist >=1.0.3
Requires-Dist: nocasedict >=1.0.1
Requires-Dist: asciitree >=0.3.3
Requires-Dist: yamlloader >=0.5.5
Requires-Dist: mock <4.0.0,>=3.0.0 ; python_version < "3.6"
Requires-Dist: click-spinner >=0.1.8 ; python_version <= "3.11"
Requires-Dist: PyYAML >=5.3.1 ; python_version <= "3.5"
Requires-Dist: toposort <=1.7,>=1.6 ; python_version <= "3.7"
Requires-Dist: six >=1.14.0 ; python_version <= "3.9"
Requires-Dist: tabulate >=0.8.2 ; python_version <= "3.9"
Requires-Dist: psutil >=5.5.0 ; python_version <= "3.9"
Requires-Dist: Click <8.0,>=7.1.1 ; python_version == "2.7"
Requires-Dist: click-repl <0.3.0,>=0.1.6 ; python_version == "2.7"
Requires-Dist: prompt-toolkit <3.0.0,>=1.0.15 ; python_version == "2.7"
Requires-Dist: packaging >=17.0 ; python_version == "2.7"
Requires-Dist: funcsigs >=1.0.2 ; python_version == "2.7"
Requires-Dist: pyparsing <3.0.0,>=2.3.1 ; python_version == "2.7"
Requires-Dist: urllib3 <2.0.0,>=1.26.18 ; python_version == "2.7"
Requires-Dist: urllib3 <2.0.0,>=1.26.18 ; python_version == "3.6"
Requires-Dist: six >=1.16.0 ; python_version >= "3.10"
Requires-Dist: tabulate >=0.8.8 ; python_version >= "3.10"
Requires-Dist: psutil >=5.8.0 ; python_version >= "3.10"
Requires-Dist: click-spinner >=0.1.10 ; python_version >= "3.12"
Requires-Dist: PyYAML !=5.4.0,!=5.4.1,!=6.0.0,>=5.3.1 ; python_version >= "3.12"
Requires-Dist: Click >=8.0.2 ; python_version >= "3.6"
Requires-Dist: click-repl <0.3.0,>=0.2 ; python_version >= "3.6"
Requires-Dist: prompt-toolkit >=3.0.13 ; python_version >= "3.6"
Requires-Dist: packaging <22.0,>=21.0 ; python_version >= "3.6"
Requires-Dist: mock >=3.0.0 ; python_version >= "3.6"
Requires-Dist: pyparsing >=2.3.1 ; python_version >= "3.6"
Requires-Dist: PyYAML !=5.4.0,!=5.4.1,>=5.3.1 ; python_version >= "3.6" and python_version <= "3.11"
Requires-Dist: urllib3 >=1.26.18 ; python_version >= "3.7"
Requires-Dist: toposort >=1.6 ; python_version >= "3.8"

Pywbemtools is a collection of command line tools that communicate with
WBEM servers. The tools are written in pure Python and support Python 2
and Python 3.

At this point, pywbemtools includes a single command line tool named
`pywbemcli` that uses the
[pywbem package on Pypi](https://pypi.org/project/pywbem/) to issue operations
to a WBEM server using the
[CIM/WBEM standards](https://www.dmtf.org/standards/wbem/) defined by the
[DMTF](https://www.dmtf.org/) to perform system management tasks.

CIM/WBEM standards are used for a wide variety of systems management
tasks in the industry including DMTF management standards and the
[SNIA](https://www.snia.org/) Storage Management Initiative Specification
([SMI-S](https://www.snia.org/forums/smi/tech_programs/smis_home)).

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](https://www.dmtf.org/) standard
  [DSP0200 (CIM Operations over HTTP)](https://www.dmtf.org/sites/default/files/standards/documents/DSP0200_1.4.0.pdf).
- Inspect and manage WBEM server functionality including:
  - CIM namespaces
  - Advertised WBEM management profiles
  - WBEM server brand and version information
- 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.

# Documentation

For the latest version of pywbemtools released on Pypi:

- [Documentation](https://pywbemtools.readthedocs.io/en/stable/)
- [Installation](https://pywbemtools.readthedocs.io/en/stable/introduction.html#installation)
- [Change history](https://pywbemtools.readthedocs.io/en/stable/changes.html)

# Quickstart

All commands within pywbemcli show help with the `-help` or `-h` options:

``` text
$ pywbemcli --help
. . .
$ pywbemcli connection --help
. . .
$ pywbemcli connection save --help
. . .
```

The following examples build on each other and show a typical sequence
of exploration of a WBEM server. For simplicity, they all operate
against the default namespace of the server, and use a persistent
connection definition for the WBEM server:

-   Add a persistent connection definition named `conn1` for the WBEM
    server to be used, so that the subsequent commands can refer to it:

    ``` text
    $ pywbemcli -s https://localhost --no-verify -u user -p password connection save conn1
    ```

-   pywbemcli also supports mocked WBEM servers in memory, that are
    preloaded with CIM objects defined in MOF files. Add a persistent
    connection definition named `assoc1` to a mock server using one of
    the MOF files provided in the repo:

    ``` text
    $ pywbemcli -m tests/unit/simple_assoc_mock_model.mof connection save assoc1
    ```

-   List the persistent WBEM server connection definitions:

    ``` text
    $ pywbemcli connection list
    WBEM server connections(brief): (#: default, *: current)
    name    server             mock-server
    ------  -----------------  --------------------------------------
    assoc1                     tests/unit/simple_assoc_mock_model.mof
    conn1   https://localhost
    ```

-   List the persistent WBEM server connection definitions with full information:

    ``` text
    $ pywbemcli connection list --full
    WBEM server connections(full): (#: default, *: current)
    name    server             namespace    user      timeout  use_pull    verify    certfile    keyfile    mock-server
    ------  -----------------  -----------  ------  ---------  ----------  --------  ----------  ---------  --------------------------------------
    assoc1                     root/cimv2                  30              True                             tests/unit/simple_assoc_mock_model.mof
    conn1   https://localhost  root/cimv2   user           30  True        False
    ```

-   Show the class tree, using the previously added WBEM server connection
    definition `assoc1` (specified with the `-n` option):

    ``` text
    $ pywbemcli -n assoc1 class tree
    root
     +-- TST_FamilyCollection
     +-- TST_Lineage
     +-- TST_MemberOfFamilyCollection
     +-- TST_Person
         +-- TST_Personsub
    ```

-   Retrieve a single class from that class tree:

    ``` text
    $ pywbemcli -n assoc1 class get TST_Person
    class TST_Person {

          [Key ( true ),
           Description ( "This is key prop" )]
       string name;

       string extraProperty = "defaultvalue";

    };
    ```

-   Enumerate the instances of that class, returning only their instance
    names by use of the `--no` option:

    ``` text
    $ pywbemcli -n assoc1 instance enumerate TST_Person --no
    root/cimv2:TST_Person.name="Gabi"
    root/cimv2:TST_Person.name="Mike"
    root/cimv2:TST_Person.name="Saara"
    root/cimv2:TST_Person.name="Sofi"
    root/cimv2:TST_PersonSub.name="Gabisub"
    root/cimv2:TST_PersonSub.name="Mikesub"
    root/cimv2:TST_PersonSub.name="Saarasub"
    root/cimv2:TST_PersonSub.name="Sofisub"
    ```

-   Retrieve a single instance using one of these instance names:

    ``` text
    $ pywbemcli -n assoc1 instance get 'root/cimv2:TST_Person.name="Sofi"'
    instance of TST_Person {
       name = "Sofi";
    };
    ```

-   The instance to be retrieved can also be selected interactively by
    use of the wildcard instance key (\"CLASSNAME.?\"):

    ``` text
    $ pywbemcli -n assoc1 instance get TST_Person.?
    Pick Instance name to process
    0: root/cimv2:TST_Person.name="Saara"
    1: root/cimv2:TST_Person.name="Mike"
    2: root/cimv2:TST_Person.name="Sofi"
    3: root/cimv2:TST_Person.name="Gabi"
    4: root/cimv2:TST_PersonSub.name="Gabisub"
    5: root/cimv2:TST_PersonSub.name="Sofisub"
    6: root/cimv2:TST_PersonSub.name="Mikesub"
    7: root/cimv2:TST_PersonSub.name="Saarasub"
    Input integer between 0 and 7 or Ctrl-C to exit selection: 3
    instance of TST_Person {
       name = "Gabi";
    };
    ```

-   There are multiple output formats supported. The enumerated
    instances can for example be formatted as a table of properties by
    use of the `-o table` general option (these instances have only one
    property \'name\'):

    ``` text
    $ pywbemcli -n assoc1 -o table instance enumerate TST_Person
    Instances: TST_Person
    +------------+
    | name       |
    |------------|
    | "Gabi"     |
    | "Mike"     |
    | "Saara"    |
    | "Sofi"     |
    | "Gabisub"  |
    | "Mikesub"  |
    | "Saarasub" |
    | "Sofisub"  |
    +------------+
    ```

-   Traverse all associations starting from a specific instance that is
    selected interactively:

    ``` text
    $ pywbemcli -n assoc1 -o table instance associators TST_Person.?
    Pick Instance name to process
    0: root/cimv2:TST_Person.name="Saara"
    1: root/cimv2:TST_Person.name="Mike"
    2: root/cimv2:TST_Person.name="Sofi"
    3: root/cimv2:TST_Person.name="Gabi"
    4: root/cimv2:TST_PersonSub.name="Gabisub"
    5: root/cimv2:TST_PersonSub.name="Sofisub"
    6: root/cimv2:TST_PersonSub.name="Mikesub"
    7: root/cimv2:TST_PersonSub.name="Saarasub"
    Input integer between 0 and 7 or Ctrl-C to exit selection: 1
    Instances: TST_FamilyCollection
    +-----------+
    | name      |
    |-----------|
    | "Family2" |
    | "Gabi"    |
    | "Sofi"    |
    +-----------+
    ```

Other operations against WBEM servers include getting information on
namespaces, the Interop namespace, WBEM server brand information, or the
advertised management profiles:

-   Show the Interop namespace of the server:

    ``` text
    $ pywbemcli -n conn1 server interop
    Server Interop Namespace:
    Namespace Name
    ----------------
    root/PG_InterOp
    ```

-   List the advertised management profiles:

    ``` text
    $ pywbemcli -n conn1 server profiles --organization DMTF
    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     |
    +----------------+----------------------+-----------+
    ```

Pywbemcli can also be executed in the interactive (REPL) mode by
executing it without entering a command or by using the command `repl`.
In this mode the command line prompt is `pywbemcli>`, the WBEM server
connection is maintained between commands and the general options apply
to all commands executed:

``` text
$ pywbemcli -n conn1
Enter 'help' for help, <CTRL-D> or ':q' to exit pywbemcli.
pywbemcli> server brand

Server Brand:
WBEM Server Brand
-------------------
OpenPegasus
pywbemcli> server interop

Server Interop Namespace:
Namespace Name
----------------
root/PG_InterOp
pywbemcli> :q
```
