Skip to content

Commit

Permalink
Merge pull request #247 from CiscoDevNet/3.4.0
Browse files Browse the repository at this point in the history
Release  3.4.0
  • Loading branch information
praveenramoorthy authored Aug 16, 2023
2 parents 917ed0b + a285487 commit 0d791f9
Show file tree
Hide file tree
Showing 32 changed files with 2,574 additions and 273 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Added

* Support to configure muliple interfaces for vrf_lite on a vrf
* Support to configure multiple interfaces for vrf_lite on a vrf
* Added support for more switch roles in inventory module.

### Fixed
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ You can also include it in a `requirements.yml` file and install it with `ansibl
---
collections:
- name: cisco.dcnm
version: 3.3.1
version: 3.4.0
```
## Using this collection
Expand Down Expand Up @@ -140,6 +140,7 @@ ansible_ssh_pass=dcnm_password
ansible_network_os=cisco.dcnm.dcnm
ansible_httpapi_validate_certs=False
ansible_httpapi_use_ssl=True
ansible_httpapi_login_domain=local
```

* Ansible YAML Format
Expand All @@ -152,6 +153,7 @@ all:
ansible_python_interpreter: python
ansible_httpapi_validate_certs: False
ansible_httpapi_use_ssl: True
ansible_httpapi_login_domain: local
children:
dcnm_controllers:
hosts:
Expand Down Expand Up @@ -195,5 +197,3 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


36 changes: 36 additions & 0 deletions docs/cisco.dcnm.dcnm_httpapi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,42 @@ Synopsis



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>Configuration</th>
<th width="100%">Comments</th>
</tr>
<tr>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>login_domain</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>
<b>Default:</b><br/><div style="color: blue">"local"</div>
</td>
<td>
<div>env:ANSIBLE_HTTPAPI_LOGIN_DOMAIN</div>
<div>var: ansible_httpapi_login_domain</div>
</td>
<td>
<div>The login domain name to use for user authentication</div>
<div>Only needed for NDFC</div>
</td>
</tr>
</table>
<br/>




Expand Down
22 changes: 22 additions & 0 deletions docs/cisco.dcnm.dcnm_interface_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2431,6 +2431,28 @@ Parameters
</td>
</tr>

<tr>
<td colspan="3">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>deploy</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">boolean</span>
</div>
</td>
<td>
<ul style="margin: 0; padding: 0"><b>Choices:</b>
<li>no</li>
<li><div style="color: blue"><b>yes</b>&nbsp;&larr;</div></li>
</ul>
</td>
<td>
<div>Flag indicating if the configuration must be pushed to the switch. This flag is used to decide the deploy behavior in &#x27;deleted&#x27; and &#x27;overridden&#x27; states as mentioned below</div>
<div>In &#x27;overridden&#x27; state this flag will be used to deploy deleted interfaces.</div>
<div>In &#x27;deleted&#x27; state this flag will be used to deploy deleted interfaces when a specific &#x27;config&#x27; block is not included.</div>
<div>The &#x27;deploy&#x27; flags included with individual interface configuration elements under the &#x27;config&#x27; block will take precedence over this global flag.</div>
</td>
</tr>
<tr>
<td colspan="3">
<div class="ansibleOptionAnchor" id="parameter-"></div>
Expand Down
106 changes: 106 additions & 0 deletions docs/cisco.dcnm.dcnm_inventory_module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,40 @@ Parameters
<div>For other supported config data please refer to NDFC/DCNM configuration guide.</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td class="elbow-placeholder"></td>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>discovery_password</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>
</td>
<td>
<div>Password for device discovery during POAP and RMA discovery</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td class="elbow-placeholder"></td>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>discovery_username</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>
</td>
<td>
<div>Username for device discovery during POAP and RMA discovery</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td class="elbow-placeholder"></td>
Expand Down Expand Up @@ -317,6 +351,40 @@ Parameters
<div>For other supported config data please refer to NDFC/DCNM configuration guide.</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td class="elbow-placeholder"></td>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>discovery_password</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>
</td>
<td>
<div>Password for device discovery during POAP and RMA discovery</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td class="elbow-placeholder"></td>
<td colspan="1">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>discovery_username</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>
</td>
<td>
<div>Username for device discovery during POAP and RMA discovery</div>
</td>
</tr>
<tr>
<td class="elbow-placeholder"></td>
<td class="elbow-placeholder"></td>
Expand Down Expand Up @@ -475,6 +543,25 @@ Parameters
</td>
</tr>

<tr>
<td colspan="3">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>deploy</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">boolean</span>
</div>
</td>
<td>
<ul style="margin: 0; padding: 0"><b>Choices:</b>
<li>no</li>
<li><div style="color: blue"><b>yes</b>&nbsp;&larr;</div></li>
</ul>
</td>
<td>
<div>Deploy the pending configuration of the fabric after inventory is updated</div>
</td>
</tr>
<tr>
<td colspan="3">
<div class="ansibleOptionAnchor" id="parameter-"></div>
Expand Down Expand Up @@ -510,6 +597,25 @@ Parameters
<div>Query for Bootstrap(POAP) capable switches available.</div>
</td>
</tr>
<tr>
<td colspan="3">
<div class="ansibleOptionAnchor" id="parameter-"></div>
<b>save</b>
<a class="ansibleOptionLink" href="#parameter-" title="Permalink to this option"></a>
<div style="font-size: small">
<span style="color: purple">boolean</span>
</div>
</td>
<td>
<ul style="margin: 0; padding: 0"><b>Choices:</b>
<li>no</li>
<li><div style="color: blue"><b>yes</b>&nbsp;&larr;</div></li>
</ul>
</td>
<td>
<div>Save/Recalculate the configuration of the fabric after the inventory is updated</div>
</td>
</tr>
<tr>
<td colspan="3">
<div class="ansibleOptionAnchor" id="parameter-"></div>
Expand Down
2 changes: 1 addition & 1 deletion galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
namespace: cisco
name: dcnm
version: 3.3.1
version: 3.4.0
readme: README.md
authors:
- Shrishail Kariyappanavar <nkshrishail>
Expand Down
36 changes: 23 additions & 13 deletions plugins/httpapi/dcnm.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@
a connection to the DCNM controller, send API requests and process the
respsonse from the controller.
version_added: "0.9.0"
options:
login_domain:
description:
- The login domain name to use for user authentication
- Only needed for NDFC
type: string
default: local
env:
- name: ANSIBLE_HTTPAPI_LOGIN_DOMAIN
vars:
- name: ansible_httpapi_login_domain
"""

import json
Expand Down Expand Up @@ -85,14 +96,12 @@ def _login_old(self, username, password, method, path):
)
)

def _login_latestv1(self, username, password, method, path):
def _login_latestv1(self, username, password, login_domain, method, path):
"""Nexus Dashboard NDFC Helper Function to login to NDFC version 12 or later."""
login_domain = "DefaultAuth"
# login_domain = 'local'
payload = {
"username": self.connection.get_option("remote_user"),
"password": self.connection.get_option("password"),
"domain": login_domain,
"username": username,
"password": password,
"domain": login_domain
}
data = json.dumps(payload)
try:
Expand Down Expand Up @@ -123,14 +132,12 @@ def _login_latestv1(self, username, password, method, path):
)
)

def _login_latestv2(self, username, password, method, path):
def _login_latestv2(self, username, password, login_domain, method, path):
"""Nexus Dashboard NDFC Helper Function to login to NDFC version 12 or later."""
login_domain = "DefaultAuth"
# login_domain = 'local'
payload = {
"userName": self.connection.get_option("remote_user"),
"userPasswd": self.connection.get_option("password"),
"domain": login_domain,
"userName": username,
"userPasswd": password,
"domain": login_domain
}
data = json.dumps(payload)
try:
Expand Down Expand Up @@ -168,6 +175,7 @@ def login(self, username, password):
"""
self.login_succeeded = False
self.login_fail_msg = []
login_domain = "local" # default login domain of Nexus Dashboard
method = "POST"
path = {"dcnm": "/rest/logon", "ndfc": "/login"}
login12Func = [self._login_latestv2, self._login_latestv1]
Expand All @@ -176,9 +184,11 @@ def login(self, username, password):
self._login_old(username, password, method, path["dcnm"])

# If login attempt failed then try NDFC version 12
if self.get_option("login_domain") is not None:
login_domain = self.get_option("login_domain")
if not self.login_succeeded:
for func in login12Func:
func(username, password, method, path["ndfc"])
func(username, password, login_domain, method, path["ndfc"])
if self.login_succeeded:
break

Expand Down
Loading

0 comments on commit 0d791f9

Please sign in to comment.