Skip to content

Commit

Permalink
Added namespace command group
Browse files Browse the repository at this point in the history
Details:

* Added a 'namespace' command group that allows liting, 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)

* Deprecated the 'server namespaces' and 'server interop' commands. Use the
  new commands 'namespace list' and 'namespace interop', respectively.
  (issue #877)

* Added a MOF file simple_interop_mock_model.mof that sets up the Interop
  namespace with a minimal model for namespace creation and deletion via
  pywbem.WBEMServer.create_namespace() and delete_namespace() (i.e. just the
  CIM_Namespace and CIM_ObjectManager classes), and a user namespace with
  the simple mock model.

* Added a mock script simple_interop_mock_script.py that loads the
  simple_interop_mock_model.mof model and registers the pywbem-provided
  namespace provider. It can be used as a standalone mock file that
  creates a minimal but functioning Interop namespace that allows
  operating on namespaces.

* Added unit testcases in test_namespace_cmds.py that use either the
  simple interop model when verifying that namespace operations can work,
  or the simple (non-interop) model for verifying that the missing interop
  namespace causes the commands to fail.

Signed-off-by: Andreas Maier <[email protected]>
  • Loading branch information
andy-maier committed Jan 23, 2021
1 parent a88d98c commit 9f23775
Show file tree
Hide file tree
Showing 12 changed files with 1,128 additions and 65 deletions.
9 changes: 9 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ Released: not yet

**Deprecations:**

* Deprecated the 'server namespaces' and 'server interop' commands. Use the
new commands 'namespace list' and 'namespace interop', respectively.
(issue #877)

**Bug fixes:**

* Fixed a ValueError on Windows that was raised when the connections file was
Expand Down Expand Up @@ -62,6 +66,11 @@ Released: not yet
* Migrated from Travis and Appveyor to GitHub Actions. This required several
changes in package dependencies for development.

* Added a 'namespace' command group that allows liting, 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)

**Known issues:**

* See `list of open issues`_.
Expand Down
165 changes: 161 additions & 4 deletions docs/pywbemcli/cmdshelp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ Help text for ``pywbemcli``:
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.
Expand Down Expand Up @@ -1547,6 +1548,152 @@ Help text for ``pywbemcli instance shrub`` (see :ref:`instance shrub command`):
-h, --help Show this help message.


.. _`pywbemcli namespace --help`:

pywbemcli namespace --help
--------------------------



Help text for ``pywbemcli namespace`` (see :ref:`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 'class' 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`:

pywbemcli namespace create --help
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^



Help text for ``pywbemcli namespace create`` (see :ref:`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.

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`:

pywbemcli namespace delete --help
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^



Help text for ``pywbemcli namespace delete`` (see :ref:`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 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 -n myconn namespace delete root/cimv2

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


.. _`pywbemcli namespace interop --help`:

pywbemcli namespace interop --help
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^



Help text for ``pywbemcli namespace interop`` (see :ref:`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`:

pywbemcli namespace list --help
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^



Help text for ``pywbemcli namespace list`` (see :ref:`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`:

pywbemcli profile --help
Expand Down Expand Up @@ -1793,8 +1940,8 @@ Help text for ``pywbemcli server`` (see :ref:`server command group`):
-h, --help Show this help message.

Commands:
namespaces List the namespaces of the server.
interop Get the Interop namespace of the server.
namespaces List the namespaces of the server (deprecated).
interop Get the Interop namespace of the server (deprecated).
brand Get the brand of the server.
info Get information about the server.

Expand Down Expand Up @@ -1858,7 +2005,12 @@ Help text for ``pywbemcli server interop`` (see :ref:`server interop command`):

Usage: pywbemcli [GENERAL-OPTIONS] server interop [COMMAND-OPTIONS]

Get the Interop namespace of the server.
Get the Interop namespace of the server (deprecated).

The Interop namespace must exist on the server.

Deprecated: The 'server interop' command is deprecated and will be removed in a future version. Use the 'namespace
interop' command instead.

Command Options:
-h, --help Show this help message.
Expand All @@ -1878,7 +2030,12 @@ Help text for ``pywbemcli server namespaces`` (see :ref:`server namespaces comma

Usage: pywbemcli [GENERAL-OPTIONS] server namespaces [COMMAND-OPTIONS]

List the namespaces of the server.
List the namespaces of the server (deprecated).

The Interop namespace must exist on the server.

Deprecated: The 'server namespaces' command is deprecated and will be removed in a future version. Use the
'namespace list' command instead.

Command Options:
-h, --help Show this help message.
Expand Down
149 changes: 147 additions & 2 deletions docs/pywbemcli/commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,149 @@ commands, see :ref:`Pywbemcli command line interface`.
**NOTE:** Many of the examples below use the :ref:`--mock-server general option`
with mock files that are located in the pywbemtools ``tests/unit`` subdirectory.


.. index:: pair: command groups; namespace commands

.. _`Namespace command group`:

``namespace`` command group
---------------------------

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

* :ref:`Namespace list command` - List the namespaces on the server.
* :ref:`Namespace create command` - Create a namespace on the server.
* :ref:`Namespace delete command` - Delete a namespace on the server.
* :ref:`Namespace interop command` - Get the Interop namespace on the server.

See :ref:`pywbemcli namespace --help`.


.. index::
pair: namespace commands; namespace list

.. _`Namespace list command`:

``namespace list`` command
^^^^^^^^^^^^^^^^^^^^^^^^^^

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

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

The Interop namespace must exist on the server.

Example:

.. code-block:: text
$ 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 :ref:`pywbemcli namespace list --help` for the exact help output of the command.


.. index::
pair: namespace commands; namespace create

.. _`Namespace create command`:

``namespace create`` command
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

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:

.. code-block:: text
$ pywbemcli --name mymock namespace create /root/abc
Created namespace root/abc
See :ref:`pywbemcli namespace create --help` for the exact help output of the command.


.. index::
pair: namespace commands; namespace delete

.. _`Namespace delete command`:

``namespace delete`` command
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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

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:

.. code-block:: text
$ pywbemcli --name mymock namespace delete /root/abc
Deleted namespace root/abc
See :ref:`pywbemcli namespace delete --help` for the exact help output of the command.


.. index::
pair: namespace commands; namespace interop

.. _`Namespace interop command`:

``namespace interop`` command
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The ``namespace interop`` command gets and displays the Interop namespace of
the WBEM server of the :term:`current connection`.

The Interop namespace must exist on the server.

Example:

.. code-block:: text
$ pywbemcli --name mymock namespace interop
root/interop
See :ref:`pywbemcli namespace interop --help` for the exact help output of the command.


.. index:: pair: command groups; class commands

.. _`Class command group`:
Expand Down Expand Up @@ -1256,14 +1399,16 @@ See :ref:`pywbemcli server interop --help` for the exact help output of the comm
The ``server namespaces`` command lists the namespaces of the WBEM server of
the :term:`current connection`.

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

The Interop namespace must exist on the server.

Example:

.. code-block:: text
$ pywbemcli --name myserver --output-format plain server namespaces
Server Namespaces:
Namespace Name
root/PG_InterOp
root/benchmark
Expand Down
1 change: 1 addition & 0 deletions pywbemtools/pywbemcli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

from __future__ import absolute_import, print_function

from ._cmd_namespace import * # noqa: F403,F401
from ._cmd_class import * # noqa: F403,F401
from ._cmd_instance import * # noqa: F403,F401
from ._cmd_qualifier import * # noqa: F403,F401
Expand Down
Loading

0 comments on commit 9f23775

Please sign in to comment.