Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Ciena WaveserverAi Collection Release Notes

## v1.2.0
### Added
- waveserverai_command module for executing CLI commands over SSH
- Support for the ``network_cli`` connection via a new cliconf plugin
- Terminal plugin to recognise Waveserver Ai prompts when using SSH transport

## v1.1.0
### Added
- Added support for Waveserver Ai 2.5.0
Expand Down
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ PEP440 is the schema used to describe the versions of Ansible.

### Supported connections

Supports ``netconf`` connections.
Supports ``netconf`` and ``network_cli`` connections.

## Included content

Expand All @@ -30,9 +30,20 @@ Name | Description
--- | ---
[ciena.waveserverai.waveserverai](https://github.com/ciena/ciena.waveserverai/blob/master/docs/ciena.waveserverai.waveserverai_netconf.rst)|Use waveserverai netconf plugin to run netconf commands on Ciena waveserverai platform

### Cliconf plugins
Name | Description
--- | ---
[ciena.waveserverai.waveserverai](https://github.com/ciena/ciena.waveserverai/blob/master/plugins/cliconf/waveserverai.py)|Low level CLI transport for running commands on Waveserver Ai

### Terminal plugins
Name | Description
--- | ---
[ciena.waveserverai.waveserverai](https://github.com/ciena/ciena.waveserverai/blob/master/plugins/terminal/waveserverai.py)|Prompt handling definitions for Waveserver Ai CLI sessions

### Modules
Name | Description
--- | ---
[ciena.waveserverai.waveserverai_command](https://github.com/ciena/ciena.waveserverai/blob/master/docs/ciena.waveserverai.waveserverai_command_module.rst)|Run commands on remote devices running Ciena Waveserver Ai
[ciena.waveserverai.waveserverai_facts](https://github.com/ciena/ciena.waveserverai/blob/master/docs/ciena.waveserverai.waveserverai_facts_module.rst)|Get facts about waveserverai devices.
[ciena.waveserverai.waveserverai_ports](https://github.com/ciena/ciena.waveserverai/blob/master/docs/ciena.waveserverai.waveserverai_ports_module.rst)|Waveserver port configuration and operational data.Manage the ports ports configuration of a Ciena waveserverai device
[ciena.waveserverai.waveserverai_ptps](https://github.com/ciena/ciena.waveserverai/blob/master/docs/ciena.waveserverai.waveserverai_ptps_module.rst)|Waveserver Physical Termination Point (PTP) configuration and operational data.Manage the ptps ptps configuration of a Ciena waveserverai device
Expand Down Expand Up @@ -113,6 +124,3 @@ ansible-playbook -e rm_dest=$PATH_TO_ANSIBLE_COLLECTIONS_DIR \
See [LICENSE](LICENSE) to see the full text.





237 changes: 237 additions & 0 deletions docs/ciena.waveserverai.waveserverai_command_module.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
.. _ciena.waveserverai.waveserverai_command_module:


***************************
ciena.waveserverai.waveserverai_command
***************************

**Run commands on remote devices running Ciena Waveserver Ai**


Version added: 1.2.0

.. contents::
:local:
:depth: 1


Synopsis
--------
- Sends arbitrary commands to a Waveserver Ai node and returns the results read from the device. This module includes an argument that will cause the module to wait for a specific condition before returning or timing out if the condition is not met.




Parameters
----------

.. raw:: html

<table border=0 cellpadding=0 class="documentation-table">
<tr>
<th colspan="1">Parameter</th>
<th>Choices/<font color="blue">Defaults</font></th>
<th width="100%">Comments</th>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>commands</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">list</span>
/ <span style="color: purple">elements=raw</span>
/ <span style="color: red">required</span>
</div>
</td>
<td>
</td>
<td>
<div>List of commands to send to the remote Waveserver Ai device over the configured provider. The resulting output from the command is returned. If the <em>wait_for</em> argument is provided, the module is not returned until the condition is satisfied or the number of retries has expired. If a command sent to the device requires answering a prompt, it is possible to pass a dict containing <em>command</em>, <em>answer</em> and <em>prompt</em>. Common answers are &#x27;y&#x27; or &quot;\r&quot; (carriage return, must be double quotes). See examples.</div>
</td>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>interval</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">integer</span>
</div>
</td>
<td>
<b>Default:</b><br/><div style="color: blue">1</div>
</td>
<td>
<div>Configures the interval in seconds to wait between retries of the command. If the command does not pass the specified conditions, the interval indicates how long to wait before trying the command again.</div>
</td>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>match</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">string</span>
</div>
</td>
<td>
<ul style="margin: 0; padding: 0"><b>Choices:</b>
<li>any</li>
<li><div style="color: blue"><b>all</b>&nbsp;&larr;</div></li>
</ul>
</td>
<td>
<div>The <em>match</em> argument is used in conjunction with the <em>wait_for</em> argument to specify the match policy. Valid values are <code>all</code> or <code>any</code>. If the value is set to <code>all</code> then all conditionals in the wait_for must be satisfied. If the value is set to <code>any</code> then only one of the values must be satisfied.</div>
</td>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>retries</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">integer</span>
</div>
</td>
<td>
<b>Default:</b><br/><div style="color: blue">10</div>
</td>
<td>
<div>Specifies the number of retries a command should by tried before it is considered failed. The command is run on the target device every retry and evaluated against the <em>wait_for</em> conditions.</div>
</td>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>wait_for</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">list</span>
/ <span style="color: purple">elements=string</span>
</div>
</td>
<td>
</td>
<td>
<div>List of conditions to evaluate against the output of the command. The task will wait for each condition to be true before moving forward. If the conditional is not true within the configured number of retries, the task fails. See examples.</div>
<div style="font-size: small; color: darkgreen"><br/>aliases: waitfor</div>
</td>
</tr>
</table>
<br/>


Notes
-----

.. note::
- Requires ``ansible_connection=network_cli`` (SSH).



Examples
--------

.. code-block:: yaml

- name: run software show on remote devices
ciena.waveserverai.waveserverai_command:
commands: software show

- name: run software show and check to see if output contains Installed
ciena.waveserverai.waveserverai_command:
commands: software show
wait_for: result[0] contains Installed

- name: run multiple commands on remote nodes
ciena.waveserverai.waveserverai_command:
commands:
- software show
- xcvr show

- name: run multiple commands and evaluate the output
ciena.waveserverai.waveserverai_command:
commands:
- software show
- xcvr show
wait_for:
- result[0] contains Installed
- result[1] contains Port


Return Values
-------------
Common return values are documented `here <https://docs.ansible.com/ansible/latest/reference_appendices/common_return_values.html#common-return-values>`_, the following are the fields unique to this module:

.. raw:: html

<table border=0 cellpadding=0 class="documentation-table">
<tr>
<th colspan="1">Key</th>
<th>Returned</th>
<th width="100%">Description</th>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="return-"></div>
<b>failed_conditions</b>
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
<div style="font-size: small">
<span style="color: purple">list</span>
</div>
</td>
<td>failed</td>
<td>
<div>The list of conditionals that have failed</div>
<br/>
<div style="font-size: smaller"><b>Sample:</b></div>
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[&#x27;...&#x27;, &#x27;...&#x27;]</div>
</td>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="return-"></div>
<b>stdout</b>
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
<div style="font-size: small">
<span style="color: purple">list</span>
</div>
</td>
<td>always apart from low level errors (such as action plugin)</td>
<td>
<div>The set of responses from the commands</div>
<br/>
<div style="font-size: smaller"><b>Sample:</b></div>
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[&#x27;...&#x27;, &#x27;...&#x27;]</div>
</td>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="return-"></div>
<b>stdout_lines</b>
<a class="ansibleOptionLink" href="#return-" title="Permalink to this return value"></a>
<div style="font-size: small">
<span style="color: purple">list</span>
</div>
</td>
<td>always apart from low level errors (such as action plugin)</td>
<td>
<div>The value of stdout split into a list</div>
<br/>
<div style="font-size: smaller"><b>Sample:</b></div>
<div style="font-size: smaller; color: blue; word-wrap: break-word; word-break: break-all;">[[&#x27;...&#x27;, &#x27;...&#x27;], [&#x27;...&#x27;], [&#x27;...&#x27;]]</div>
</td>
</tr>
</table>
<br/><br/>


Status
------


Authors
~~~~~~~

- Ciena
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
version: 1.1.0
version: 1.2.0
authors:
- Santiago Echevarria (sechevar@ciena.com)
- Jeff Groom (jgroom@ciena.com)
Expand Down
2 changes: 2 additions & 0 deletions meta/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ plugin_routing:
action:
facts:
redirect: ciena.waveserverai.waveserverai_facts
command:
redirect: ciena.waveserverai.waveserverai_command
ports:
redirect: ciena.waveserverai.waveserverai_ports
ptps:
Expand Down
Empty file added plugins/cliconf/__init__.py
Empty file.
Loading