Package: ironic-oneview-cli
[![PyPI version](https://badge.fury.io/py/ironic-oneview-cli.svg)](https://badge.fury.io/py/ironic-oneview-cli)
[![Build Status](https://travis-ci.org/HewlettPackard/ironic-oneview-cli.svg?branch=master)](https://travis-ci.org/HewlettPackard/ironic-oneview-cli)
[![Coverage Status](https://codecov.io/gh/HewlettPackard/ironic-oneview-cli/branch/master/graphs/badge.svg)](https://codecov.io/gh/HewlettPackard/ironic-oneview-cli)Ironic-OneView CLIOverviewIronic-OneView CLI is a command line interface tool for easing the use of the OneView Drivers for Ironic. It allows the user to easily manage:Ironic nodes compatible with OneView Server Hardware objects;Nova flavors matching available Ironic nodes that use OneView drivers;Ironic ports mapping Server Hardware ports.>note>
> This tool works with OpenStack Identity API v2.0 and v3.>note>
> This tool works with OpenStack Ironic API microversion ‘1.31’.For more information onHPE OneViewentities, see [here](https://www.hpe.com/us/en/integrated-systems/software.html).InstallationTo install Ironic-OneView CLI from PyPI, use the following command:$ pip install ironic-oneview-cli>note>
> Ocata/Newton users, we recommend using version 0.6.0ConfigurationIronic-Oneview CLI uses credentials loaded into environment variables by theOpenStack RCfile (downloaded from OpenStack Horizon), and the Ironic OneView CLI RC file, which sample file can be generated using the followinggenrcsubcommand:$ ironic-oneview genrc > ironic-oneviewrc.shOnce theironic-oneviewrc.shis populated with OneView credentials using any text editor, it can be loaded by running the following:$ source ironic-oneviewrc.shCredentials can be passed alternatively as command line parameters. A help message informing of which parameters should be used is shown by running the command the following:$ ironic-oneview helpFor more information how to obtain and load theOpenStack RCfile, see [here](http://docs.openstack.org/user-guide/common/cli_set_environment_variables_using_openstack_rc.html).UsageOnce the necessary environment variables and command line parameters are set, Ironic OneView CLI is ready to be used. The current version of Ironic-OneView CLI provides the following interactive subcommands:<table>
<col width=”23%” />
<col width=”76%” />
<tbody>
<tr class=”odd”>
<td align=”left”><blockquote>
<p>node-create</p>
</blockquote></td>
<td align=”left”>Creates Ironic nodes based on available HPE OneView Server Hardware.</td>
</tr>
<tr class=”even”>
<td align=”left”><blockquote>
<p>flavor-create</p>
</blockquote></td>
<td align=”left”>Creates Nova flavors based on available Ironic nodes.</td>
</tr>
<tr class=”odd”>
<td align=”left”><blockquote>
<p>port-create</p>
</blockquote></td>
<td align=”left”>Creates a Ironic Port based on available Ironic nodes.</td>
</tr>
<tr class=”even”>
<td align=”left”><blockquote>
<p>server-profile-template-list</p>
</blockquote></td>
<td align=”left”>Lists HPE OneView Server Profile Templates.</td>
</tr>
<tr class=”odd”>
<td align=”left”><blockquote>
<p>server-hardware-list</p>
</blockquote></td>
<td align=”left”>Lists HPE OneView Server Hardware.</td>
</tr>
<tr class=”even”>
<td align=”left”><blockquote>
<p>node-delete</p>
</blockquote></td>
<td align=”left”>Deletes multiple Ironic nodes.</td>
</tr>
<tr class=”odd”>
<td align=”left”><blockquote>
<p>genrc</p>
</blockquote></td>
<td align=”left”>Generates a sample Ironic-OneView CLI RC file.</td>
</tr>
<tr class=”even”>
<td align=”left”><blockquote>
<p>help</p>
</blockquote></td>
<td align=”left”>Displays help about this program or one of its subcommands.</td>
</tr>
</tbody>
</table>Any ironic-oneview-cli subcommand can be run in debugging mode with the –debug parameter, as in the following command:$ ironic-oneview –debug node-createFeatures### Node creationTo create Ironic nodes based on available HPE OneViewServer Hardwareobjects, use the following command:$ ironic-oneview node-createThe tool retrieves all server profile templates previously created in OneView. It builds a list with the Name, Enclosure Group Name and Server Hardware Type Name (as shown in the table), and assigns an id that should be used by the administrator to select whichServer Profile Templateshould be used for node creation:IdNameEnclosure Group NameServer Hardware Type Name1
2template-dcs-virt-enc3
template-dcs-virt-enc4virt-enclosure-group
virt-enclosure-groupBL460c Gen8 3
BL660c Gen9 1Once the user has chosen a validServer Profile Template, the tool lists the availableServer Hardwarematching it as shown in the following table:IdNameCPUsMemory MBLocal GBEnclosure Group NameServer Hardware Type Name1
2VIRT-enl, bay 5
VIRT-enl, bay 88
832768
32768120
120virt-enclosure-group
virt-enclosure-groupBL460c Gen8 3
BL460c Gen8 3Notice that multiple Ironic nodes can be created at once. That can be achieved, by selecting multipleServer HardwareIDs separated by blank spaces. The created Ironic nodes will be in theenrollprovisioning state.This command also creates an Ironic port to be used by the node, the port is created in the same way as the port-create command (see below) with the parameter–macalso optional.>note>
> Ifos_inspection_enabled = True, the created node will not have the hardware properties (cpus,memory_mb,local_gb,cpu_arch) set in the node properties. This will be discovered during the Ironic Hardware Inspection.Alternatively, theServer Profile TemplateandServer Hardwarecan be specified using the parameters–server-profile-templateand–server-hardware-uuidrespectively, as shown in the following command:$ ironic-oneview node-create [–server-profile-template | -t <spt>] [–server-hardware-uuid | -s <server_hardware>]A collection of nodes sharing the sameServer Profile Templatecan be set up in a batch by using the following command:$ ironic-oneview node-create [–number | -n <number>]>note>
> You can use both arguments at once.In order to enableNetworking OneView ML2 Driver, the following command to create a node with this information set to its driver_info field:$ ironic-oneview node-create –use-oneview-ml2-driverFor more information onNetworking OneView ML2 Driver, see [here](https://github.com/HewlettPackard/ironic-driver-oneview/tree/master/networking-oneview).With the Driver composition reform, the default behavior is to create a node using a hardware type. With this feature, specific hardware type compatible interfaces can be dynamically set to the node, such as:OpenStack Power Interface,OpenStack Management Interface,OpenStack Inspect Interface,OpenStack Deploy Interface. Use the following command to create a node with this hardware type and interfaces:$ ironic-oneview node-create –os-driver <hardware_type> –os-power-interface <power_interface>–os-management-interface <management_interface> –os-inspect-interface <inspect_interface>
–os-deploy-interface <deploy_interface>If you want to create the node using the classic driver, use the following command:$ ironic-oneview node-create –classicFor more information on theDriver composition reform, see [here](https://specs.openstack.org/openstack/ironic-specs/specs/approved/driver-composition-reform.html).To list all nodes in Ironic, use the following command:$ openstack baremetal node listFor more information about the created Ironic node, use the following command:$ openstack baremetal node show <node>### Flavor creationIn order to launch bare metal instances, the user needs to specify a flavor compatible with an available Ironic Node, which maps directly to an availableServer Hardware. The following interactive command can be used to create Nova flavors:$ ironic-oneview flavor-createThe tool will prompt with a list of possible new flavors, according to the configuration of enrolled Ironic nodes:IdCPUsDisk GBMemory MBServer Profile TemplateServer Hardware TypeEnclosure Group Name181208192second-virt-server-profile-templateBL460c Gen9 1virtual-enclosure-groupAfter choosing a valid configuration, the user can optionally specify a name for the new flavor. If left blank, a default name will be used. Additional information from Server Hardware Type, Enclosure Group and Server Profile Template is automatically added by default to the flavor metadata. Use Horizon to delete the Enclosure Group info, for example, so that a flavor matches Server Hardware in all available enclosures.Alternatively, you can set a Ironicnode, and optionally flavornamethrough the command:$ ironic-oneview flavor-create [–node <node>] [–name <name>]To list all flavors in Nova, use the command:$ openstack flavor listFor more information about the created Nova flavor, use the command:$ openstack flavor show <flavor>### Port creationCreates a port for an existing Ironic node. The following interactive command can be used to create Ironic ports:$ ironic-oneview port-create [–mac | -m <mac>] <node>In the case when the user does not specify a port, the result will be an Ironic port for the first-aavailable port at theServer Hardwareused by ironic-node.To list all ports in Ironic, use the command:$ openstack baremetal port listFor more information about the created Ironic port, use the following command:$ openstack baremetal port show <port>### Server Profile Template ListThe tool offers a command to listServer Profile Templates. For that use the following command:$ ironic-oneview server-profile-template-list### Server Hardware ListThe tool offers a command to listServer Hardwarecompatible with a specificServer Profile Template. For that use the following command:$ ironic-oneview server-hardware-list### Node deleteThe tool also offers the option to delete a specific number of Ironic nodes. For that use the following command:$ ironic-oneview node-delete –number <number>To delete all Ironic nodes, use the following command:$ ironic-oneview node-delete –all### ContributingFork it, branch it, change it, commit it, and pull-request it. We are passionate about improving this project, and are glad to accept help to make it better. However, keep the following in mind: We reserve the right to reject changes that we feel do not fit the scope of this project. For feature additions, please open an issue to discuss your ideas before doing the work.### Feature RequestsIf you have a need not being met by the current implementation, please let us know (via a new issue). This feedback is crucial for us to deliver a useful product. Do not assume that we have already thought of everything, because we assure you that is not the case.### TestingWe have already packaged everything you need to do to verify if the code is passing the tests. The tox script wraps the unit tests execution against Python 2.7, 3.5 and pep8 validations. Run the following command:$ tox