Two command line tools are provided to interface to the Regional Controller via the bash command line:
rc_cli - which allows you to perform individual API calls
rc_loaddata - used to do batch initialization of the RC database
Both tools require Python 3 be installed on your machine.
RC_CLI - Perform individual API calls
The options and arguments to the rc_cli command may be displayed by invoking it with –help:
rc_cli will first login to the RC using the host/user/password combination you specify, and then will perform the operation (specified by op) on the object (obj) listed. The user must have the appropriate permissions in the database to perform the requested operation. For example, in order to run the pod create command, the user must have a user role that includes the create-pod or create-* role attributes.
Objects correspond to the objects that the RC controls; e.g. blueprint, edgesite, hardware, node, pod, and region. Operations are create, delete, list, and show.
The create operation takes as arguments the names of one or more YAML files containing the objects to be created. For successfully created objects, it will print the URL of the newly created object, which contains the object’s UUID. The YAML files provided must contain only YAML descriptions of the appropriate type specified on the command line. The format of these YAML objects can be determined by referencing Regional Controller API Documentation.
delete takes as arguments a list of UUIDs of the objects to be deleted. If the specified objects are deleted, it produces no output.
list takes no arguments and just lists all objects of the specified type in the RC. The returned list will be sorted based on UUID, unless a different sort column is passed (via the -s sort option). The list operation will not display the YAML column of any object that has a YAML column unless the -Y option is provided.
show takes as arguments a list of UUIDs of the objects to show the details of.
RC_LOADDATA - Batch Load Data into the RC DB
The options and arguments to the rc_loaddata command may be displayed by invoking it with –help:
The purpose of rc_loaddata is to perform operations on large number of RC objects at once. The operation to perform is specified by the -A/-D/-M options, only one of which may be provided.
-A - add all entries in the YAML files to the RC database.
-D - delete all entries in the YAML files from the RC database.
-M - match entries between the YAML files and the RC database. That is, make the RC database identical to the contents of the catenated YAML files.
You can restrict the objects that the above operations are performed against by specifying one or more -s section options. Normally all sections are scanned.
When adding objects to the RC, the objects are added in a “bottom up” order; that is: ‘hardware’, ‘regions’, ‘nodes’, ‘edgesites’, ‘blueprints’, and finally ‘pods’. When deleting objects, the reverse order (top down) is used.
As with rc_cli, rc_loaddata will first login to the RC using the host/user/password combination you specify.
The YAML files themselves consists of stanzas for any of the six sections needed, followed by named objects describing the objects of each type to be added/deleted/matched. For example: