Welcome to contrail-api-cli-extra’s documentation!

contrail_api_cli_extra package

This package contains contrail-api-cli commands to ease operating/fixing a contrail installation.

Commands are grouped in different packages with different purposes:

Installation

In the contrail-api-cli-extra directory run:

python setup.py install

If all goes well you will see new commands in contrail-api-cli:

contrail-api-cli --host 1.2.3.4 shell
1.2.3.4:/> help
Available commands: schema shell exec edit tree cat relative ln kv rm python du
ls find-orphaned-projects fix-subnets fix-vn-id fix-fip-locks reschedule-vm fix-sg
rpf provision dot exit help cd

Subpackages

contrail_api_cli_extra.utils module

Shared functions and classes for contrail_api_cli_extra commands.

class contrail_api_cli_extra.utils.CassandraCommand(name)

Bases: contrail_api_cli.command.Command

Inherit from this class to add –cassandra-servers options.

Cassandra servers list value is stored in self.cassandra_servers.

class contrail_api_cli_extra.utils.CheckCommand(name)

Bases: contrail_api_cli.command.Command

Inherit from this class to add –check and –dry-run options.

Options values are stored in self.check and self.dry_run (True or False).

class contrail_api_cli_extra.utils.ConfirmCommand(name)

Bases: contrail_api_cli.command.Command

Inherit from this class for a command that expect a confirmation.

This will add a –yes flag to skip the confirmation. self.yes can be used by the command to show the confirmation or not.

confirm_message

Confirmation message to run the command

class contrail_api_cli_extra.utils.PathCommand(name)

Bases: contrail_api_cli.command.Command

Inherit from this class for a command that expect a list of resource paths.

This will add a path argument to the command (nargs=*).

The selected resources are available in self.resources.

resource_type

Type of resource the command is about.

class contrail_api_cli_extra.utils.RouteTargetAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)

Bases: argparse.Action

class contrail_api_cli_extra.utils.ZKCommand(name)

Bases: contrail_api_cli.command.Command

Inherit from this class when a connection to the Zookeeper cluster is needed.

This will add a –zk-server option to the command.

The ZK client is available in self.zk_client.

contrail_api_cli_extra.utils.format_table_ascii_delimiters(header, widths, data)

Return ascii table with delimitation and lines wrapped.

usage:

header = ["name", "age", "job", "bag"]
widths = [20, 4, 10, 40]
data = [
         ["foo", 54, "policeman", ("pen", "knife", "glasses")],
         ["bar", 28, "fireman", ("socket", "hat")],
         ["joe", 36, "anthropologist", ("computer", "keyboard")]
       ]

format_table2(header, widths, data)

return:

+------+-----+------------+------------+
| name | age | job        | bag        |
+------+-----+------------+------------+
| foo  | 54  | policeman  | - pen      |
|      |     |            | - knife    |
|      |     |            | - glasses  |
|      |     |            |            |
| bar  | 28  | fireman    | - socket   |
|      |     |            | - hat      |
|      |     |            |            |
| joe  | 36  | anthropolo | - computer |
|      |     | gist       | - keyboard |
|      |     |            |            |
+------+-----+------------+------------+
contrail_api_cli_extra.utils.ip_type(string)

argparse type to validate IP adresses.

contrail_api_cli_extra.utils.md5_type(value)

argparse type to validate a md5 hash.

contrail_api_cli_extra.utils.network_type(string)

argparse type to validate network adresses.

contrail_api_cli_extra.utils.port_type(value)

argparse type to validate port numbers.

contrail_api_cli_extra.utils.server_type(value)

argparse type to validate a server:port option.

Indices and tables