Skip to content

Commit

Permalink
Merge pull request #32 from madhansansel/main
Browse files Browse the repository at this point in the history
latest changes 03/13/2024
  • Loading branch information
rukapse authored Mar 13, 2024
2 parents ffcedb6 + 8c88ac2 commit e8862e5
Show file tree
Hide file tree
Showing 15 changed files with 442 additions and 113 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/sanity_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ jobs:
strategy:
matrix:
ansible:
- stable-2.12
- stable-2.13
- stable-2.14
- stable-2.15
- devel
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The following table shows the supported versions.
| 2.2.2.3 | 3.3.1 | 2.3.3 |
| 2.2.3.3 | 6.4.0 | 2.4.11 |
| 2.3.3.0 | 6.6.4 | 2.5.5 |
| 2.3.5.3 | 6.11.0 | 2.6.0 |
| 2.3.5.3 | 6.13.0 | 2.6.0 |

If your Ansible collection is older please consider updating it first.

Expand Down
8 changes: 8 additions & 0 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -827,3 +827,11 @@ releases:
attributes 'clear_mac_address_table', 'device_ip', 'resync_retry_count', 'resync_retry_interval',
'reprovision_wired_device', 'provision_wireless_device' were added.
Renamed argument from 'ip_address' to 'ip_address_list'.
- pnp_workflow_manager - Adding fix for Stackswitch getting changed to normal switch post editing the device's info.
- pnp_intent - Adding fix for Stackswitch getting changed to normal switch post editing the device's info.
6.13.0:
release_date: "2024-03-12"
changes:
release_summary: Changes the minimum supported version of Ansible to v2.14.0
minor_changes:
- Changes the minimum supported version from Ansible v2.9.10 to v2.14.0
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: dnac
version: 6.12.0
version: 6.13.0
readme: README.md
authors:
- Rafael Campos <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion meta/runtime.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
requires_ansible: '>=2.9.10'
requires_ansible: '>=2.14.0'
6 changes: 3 additions & 3 deletions playbooks/discovery_intent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
discovery_type: "SINGLE"
ip_address_list:
- 204.1.2.5
use_global_credentials: False
discovery_specific_credentials:
cli_credentials_list:
- username: cisco
Expand All @@ -123,10 +124,9 @@
privacy_type: AES256
privacy_password: Lablab#1234
global_cli_len: 3
use_global_cred: False
protocol_order: ssh

- name: Execute discovery devices using MULTI RANGE with various discovery specific credentials
- name: Execute discovery devices using MULTI RANGE with various discovery specific credentials and all global credentials (max 5 allowed)
cisco.dnac.discovery_intent:
<<: *dnac_login
state: merged
Expand Down Expand Up @@ -164,7 +164,7 @@
records_to_return: 1000
snmp_version: v2

- name: Execute discovery devices using CDP/LLDP/CIDR
- name: Execute discovery devices using CDP/LLDP/CIDR leveraging discovery specific credentials and all the global credentials
cisco.dnac.discovery_intent:
<<: *dnac_login
state: merged
Expand Down
6 changes: 3 additions & 3 deletions playbooks/discovery_workflow_manager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
discovery_type: "SINGLE"
ip_address_list:
- 204.1.2.5
use_global_credentials: False
discovery_specific_credentials:
cli_credentials_list:
- username: cisco
Expand All @@ -123,10 +124,9 @@
privacy_type: AES256
privacy_password: Lablab#1234
global_cli_len: 3
use_global_cred: False
protocol_order: ssh

- name: Execute discovery devices using MULTI RANGE with various discovery specific credentials
- name: Execute discovery devices using MULTI RANGE with various discovery specific credentials and all global credentials (max 5 allowed)
cisco.dnac.discovery_workflow_manager:
<<: *dnac_login
state: merged
Expand Down Expand Up @@ -164,7 +164,7 @@
records_to_return: 1000
snmp_version: v2

- name: Execute discovery devices using CDP/LLDP/CIDR
- name: Execute discovery devices using CDP/LLDP/CIDR leveraging discovery specific credentials and all the global credentials
cisco.dnac.discovery_workflow_manager:
<<: *dnac_login
state: merged
Expand Down
125 changes: 106 additions & 19 deletions plugins/modules/discovery_intent.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,26 +262,20 @@
snmp_v2_read_credential_list:
description:
- List of Global SNMP V2 Read credentials to be used during device discovery.
- It's recommended to create device credentials with both a unique username and a clear description for easy identification.
- It's recommended to create device credentials with a clear description for easy identification.
type: list
elements: dict
suboptions:
username:
description: Username for SNMP Read authentication, mandatory when using global SNMP credentials.
type: str
description:
description: Name of the SNMP Read credential, mandatory when using global SNMP credentials.
type: str
snmp_v2_write_credential_list:
description:
- List of Global SNMP V2 Write credentials to be used during device discovery.
- It's recommended to create device credentials with both a unique username and a clear description for easy identification.
- It's recommended to create device credentials with a clear description for easy identification.
type: list
elements: dict
suboptions:
username:
description: Username for SNMP Write authentication, mandatory when using global SNMP credentials.
type: str
description:
description: Name of the SNMP Write credential, mandatory when using global SNMP credentials.
type: str
Expand Down Expand Up @@ -361,7 +355,7 @@
"""

EXAMPLES = r"""
- name: Execute discovery devices with both global credentials and discovery specific credentials
- name: Execute discovery of devices with both global credentials and discovery specific credentials
cisco.dnac.discovery_intent:
dnac_host: "{{dnac_host}}"
dnac_username: "{{dnac_username}}"
Expand Down Expand Up @@ -426,10 +420,8 @@
username: string
snmp_v2_read_credential_list:
- description: string
username: string
snmp_v2_write_credential_list:
- description: string
username: string
net_conf_port_list:
- description: string
start_index: integer
Expand All @@ -438,7 +430,7 @@
retry: integer
timeout: integer
- name: Execute discovery devices with discovery specific credentials only
- name: Execute discovery of devices with discovery specific credentials only
cisco.dnac.discovery_intent:
dnac_host: "{{dnac_host}}"
dnac_username: "{{dnac_username}}"
Expand Down Expand Up @@ -495,6 +487,80 @@
retry: integer
timeout: integer
- name: Execute discovery of devices with global credentials only
cisco.dnac.discovery_intent:
dnac_host: "{{dnac_host}}"
dnac_username: "{{dnac_username}}"
dnac_password: "{{dnac_password}}"
dnac_verify: "{{dnac_verify}}"
dnac_port: "{{dnac_port}}"
dnac_version: "{{dnac_version}}"
dnac_debug: "{{dnac_debug}}"
dnac_log: True
dnac_log_level: "{{dnac_log_level}}"
state: merged
config_verify: True
config:
- discovery_name: string
discovery_type: string
ip_address_list: list
ip_filter_list: list
cdp_level: string
lldp_level: string
prefered_mgmt_ip_method: string
global_credentials:
cli_credentials_list:
- description: string
username: string
http_read_credential_list:
- description: string
username: string
http_write_credential_list:
- description: string
username: string
snmp_v3_credential_list:
- description: string
username: string
snmp_v2_read_credential_list:
- description: string
snmp_v2_write_credential_list:
- description: string
net_conf_port_list:
- description: string
start_index: integer
records_to_return: integer
protocol_order: string
retry: integer
timeout: integer
- name: Execute discovery of devices with all the global credentials (max 5 allowed)
cisco.dnac.discovery_intent:
dnac_host: "{{dnac_host}}"
dnac_username: "{{dnac_username}}"
dnac_password: "{{dnac_password}}"
dnac_verify: "{{dnac_verify}}"
dnac_port: "{{dnac_port}}"
dnac_version: "{{dnac_version}}"
dnac_debug: "{{dnac_debug}}"
dnac_log: True
dnac_log_level: "{{dnac_log_level}}"
state: merged
config_verify: True
config:
- discovery_name: string
discovery_type: string
ip_address_list: list
ip_filter_list: list
cdp_level: string
lldp_level: string
prefered_mgmt_ip_method: string
start_index: integer
records_to_return: integer
protocol_order: string
retry: integer
timeout: integer
use_global_credentials: True
- name: Delete disovery by name
cisco.dnac.discovery_intent:
dnac_host: "{{dnac_host}}"
Expand Down Expand Up @@ -690,6 +756,9 @@ def handle_global_credentials(self, response=None):
if not isinstance(cli_credentials_list, list):
msg = "Global CLI credentials must be passed as a list"
self.discovery_specific_cred_failure(msg=msg)
if response.get("cliCredential") is None:
msg = "Global CLI credentials are not present in the Cisco Catalyst Center"
self.discovery_specific_cred_failure(msg=msg)
if len(cli_credentials_list) > 0:
global_credentials_all["cliCredential"] = []
cred_len = len(cli_credentials_list)
Expand All @@ -710,6 +779,9 @@ def handle_global_credentials(self, response=None):
if not isinstance(http_read_credential_list, list):
msg = "Global HTTP read credentials must be passed as a list"
self.discovery_specific_cred_failure(msg=msg)
if response.get("httpsRead") is None:
msg = "Global HTTP read credentials are not present in the Cisco Catalyst Center"
self.discovery_specific_cred_failure(msg=msg)
if len(http_read_credential_list) > 0:
global_credentials_all["httpsRead"] = []
cred_len = len(http_read_credential_list)
Expand All @@ -730,6 +802,9 @@ def handle_global_credentials(self, response=None):
if not isinstance(http_write_credential_list, list):
msg = "Global HTTP write credentials must be passed as a list"
self.discovery_specific_cred_failure(msg=msg)
if response.get("httpsWrite") is None:
msg = "Global HTTP write credentials are not present in the Cisco Catalyst Center"
self.discovery_specific_cred_failure(msg=msg)
if len(http_write_credential_list) > 0:
global_credentials_all["httpsWrite"] = []
cred_len = len(http_write_credential_list)
Expand All @@ -748,7 +823,10 @@ def handle_global_credentials(self, response=None):
snmp_v2_read_credential_list = global_credentials.get('snmp_v2_read_credential_list')
if snmp_v2_read_credential_list:
if not isinstance(snmp_v2_read_credential_list, list):
msg = "Global SNMPV2 read credentials must be passed as a list"
msg = "Global SNMPv2 read credentials must be passed as a list"
self.discovery_specific_cred_failure(msg=msg)
if response.get("snmpV2cRead") is None:
msg = "Global SNMPv2 read credentials are not present in the Cisco Catalyst Center"
self.discovery_specific_cred_failure(msg=msg)
if len(snmp_v2_read_credential_list) > 0:
global_credentials_all["snmpV2cRead"] = []
Expand All @@ -762,14 +840,17 @@ def handle_global_credentials(self, response=None):
global_credentials_all["snmpV2cRead"].append(snmp.get("id"))
global_credentials_all["snmpV2cRead"] = global_credentials_all["snmpV2cRead"][:cred_len]
else:
msg = "Kindly ensure you include both the description and the username for the Global SNMPV2 Read \
msg = "Kindly ensure you include the description for the Global SNMPv2 Read \
credential to discover the devices"
self.discovery_specific_cred_failure(msg=msg)

snmp_v2_write_credential_list = global_credentials.get('snmp_v2_write_credential_list')
if snmp_v2_write_credential_list:
if not isinstance(snmp_v2_write_credential_list, list):
msg = "Global SNMPV2 write credentials must be passed as a list"
msg = "Global SNMPv2 write credentials must be passed as a list"
self.discovery_specific_cred_failure(msg=msg)
if response.get("snmpV2cWrite") is None:
msg = "Global SNMPv2 write credentials are not present in the Cisco Catalyst Center"
self.discovery_specific_cred_failure(msg=msg)
if len(snmp_v2_write_credential_list) > 0:
global_credentials_all["snmpV2cWrite"] = []
Expand All @@ -783,13 +864,16 @@ def handle_global_credentials(self, response=None):
global_credentials_all["snmpV2cWrite"].append(snmp.get("id"))
global_credentials_all["snmpV2cWrite"] = global_credentials_all["snmpV2cWrite"][:cred_len]
else:
msg = "Kindly ensure you include both the description and the username for the Global SNMPV2 credential to discover the devices"
msg = "Kindly ensure you include the description for the Global SNMPV2 write credential to discover the devices"
self.discovery_specific_cred_failure(msg=msg)

snmp_v3_credential_list = global_credentials.get('snmp_v3_credential_list')
if snmp_v3_credential_list:
if not isinstance(snmp_v3_credential_list, list):
msg = "Global SNMPV3 write credentials must be passed as a list"
msg = "Global SNMPv3 write credentials must be passed as a list"
self.discovery_specific_cred_failure(msg=msg)
if response.get("snmpV3") is None:
msg = "Global SNMPv3 credentials are not present in the Cisco Catalyst Center"
self.discovery_specific_cred_failure(msg=msg)
if len(snmp_v3_credential_list) > 0:
global_credentials_all["snmpV3"] = []
Expand All @@ -803,7 +887,7 @@ def handle_global_credentials(self, response=None):
global_credentials_all["snmpV3"].append(snmp.get("id"))
global_credentials_all["snmpV3"] = global_credentials_all["snmpV3"][:cred_len]
else:
msg = "Kindly ensure you include both the description and the username for the Global SNMPV3 \
msg = "Kindly ensure you include both the description and the username for the Global SNMPv3 \
to discover the devices"
self.discovery_specific_cred_failure(msg=msg)

Expand All @@ -812,6 +896,9 @@ def handle_global_credentials(self, response=None):
if not isinstance(net_conf_port_list, list):
msg = "Global net Conf Ports be passed as a list"
self.discovery_specific_cred_failure(msg=msg)
if response.get("netconfCredential") is None:
msg = "Global netconf ports are not present in the Cisco Catalyst Center"
self.discovery_specific_cred_failure(msg=msg)
if len(net_conf_port_list) > 0:
global_credentials_all["netconfCredential"] = []
cred_len = len(net_conf_port_list)
Expand All @@ -824,7 +911,7 @@ def handle_global_credentials(self, response=None):
global_credentials_all["netconfCredential"].append(netconf.get("id"))
global_credentials_all["netconfCredential"] = global_credentials_all["netconfCredential"][:cred_len]
else:
msg = "Please provide description of the Global Netconf port to be used"
msg = "Please provide valid description of the Global Netconf port to be used"
self.discovery_specific_cred_failure(msg=msg)

self.log("Fetched Global credentials IDs are {0}".format(global_credentials_all), "INFO")
Expand Down
Loading

0 comments on commit e8862e5

Please sign in to comment.