python-neutronclient/doc/source/devref/client_command_extensions.rst
Gal Sagie ab7d9e805a Devref documentation for client command extension support
Change-Id: If71c9e2bbf888b1a68d3b7dc351f7df02f1a380f
Closes-Bug: #1470622
2015-07-14 18:00:43 +03:00

1.6 KiB

Client command extension support

The client command extension adds support for extending the neutron client while considering ease of creation. Extensions strongly conform to preexisting neutron commands (/neutron/v2_0/).

A sample extension can be seen at: neutronclient/neutron/v2_0/contrib/_fox_sockets.py

Minimum requirements from an extension

  • Will have a class that subclasses NeutronClientExtension to provide the requisite version support, paths, and variable names for the client. Example: neutronclient.neutron.v2_0.contrib._fox_sockets.FoxInSocket
  • Will have at least one class that subclasses from the ClientExtension classes to provide the new functionality to the client Example: neutronclient.neutron.v2_0.contrib._fox_sockets.FoxInSocketsList
  • ClientExtension subclasses must have a shell_command class variable if the command is to be available to the CLI (shell.py) Example: neutronclient.neutron.v2_0.contrib._fox_sockets.FoxInSocketsList

Precedence of command loading

  • hard coded commands are loaded first
  • contributed commands (those in /contrib)
  • external commands (installed in the environment) are loaded last

Commands that have the same name will be overwritten by commands that are loaded later. To change the execution of a command for your particular extension you only need to override the execute method.

Currently this extension support is limited to top-level resources. Parent/child relationships may be added if desired.