Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes in intent module to support discovery, provisioning and more operations in swim, site, template and pnp intent modules #140

Merged
merged 74 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
7ab1cbf
Add code for Update Device role, update interface details, create and…
Abhishek-121 Nov 23, 2023
01b4411
fix ansible failed test case of adv for loop
Abhishek-121 Nov 23, 2023
7149eb7
addressed PR review comments on inventory module
Abhishek-121 Nov 23, 2023
ec5e7c5
Adding bulk addition and bulk deletion, along with variable names cha…
abimishr Nov 24, 2023
9f11298
Merge branch 'main' into PNP_Code_Abinash
abimishr Nov 24, 2023
3ff8a3a
Merge branch 'main' of https://github.com/abimishr/dnacenter-ansible …
abimishr Nov 24, 2023
9bdd513
Merge pull request #52 from Abhishek-121/main
madhansansel Nov 27, 2023
e038f97
Merge pull request #53 from abimishr/PNP_Code_Abinash
madhansansel Nov 27, 2023
f021af1
Merge pull request #54 from cisco-en-programmability/main
madhansansel Nov 27, 2023
a497c95
Handle idempotenacy in delete operation and convert variable in snake…
Abhishek-121 Nov 28, 2023
54b26c5
revert floor rfModel number
Abhishek-121 Nov 28, 2023
8898dca
changed variable name in the documentation
Abhishek-121 Nov 29, 2023
0472525
changes log to self.log
Abhishek-121 Nov 30, 2023
f0a2962
Merge pull request #55 from Abhishek-121/main
madhansansel Nov 30, 2023
1c2d5c4
Adding the discovery intent module
abimishr Nov 30, 2023
3a8a942
Adding discovery module
abimishr Nov 30, 2023
560d6bc
Updated Snakes, solved bugs and enhancement
Nov 30, 2023
5c9d682
Updated Snakes, solved bugs and Enhancement
Nov 30, 2023
4fbb2b0
Resolving Sanity issues
abimishr Dec 1, 2023
6853e22
Resolving Sanity issues2
abimishr Dec 1, 2023
9e0243e
Resolving Sanity issues3
abimishr Dec 1, 2023
de42a1d
Resolving Sanity issues4
abimishr Dec 1, 2023
840b0ba
Resolving Sanity issues5
abimishr Dec 1, 2023
d75937e
Making a few corrections
abimishr Dec 1, 2023
5aede28
Distribute and activate image by fetching device based on site and fi…
Abhishek-121 Dec 1, 2023
89629b4
Adding discovery test module
abimishr Dec 6, 2023
34f1a34
Merge pull request #56 from abimishr/PNP_Code_Abinash
madhansansel Dec 6, 2023
ea08338
remove redundant code
Abhishek-121 Dec 6, 2023
9f739f4
Merge pull request #60 from Abhishek-121/main
madhansansel Dec 6, 2023
a909574
Merge pull request #61 from cisco-en-programmability/main
madhansansel Dec 7, 2023
43b3f6b
Addressed the PR comments
Dec 7, 2023
8a5cdb4
Merge branch 'madhansansel:main' into main
MUTHU-RAKESH-27 Dec 7, 2023
c4d2e01
Addressed the PR comments
Dec 7, 2023
8bc0454
Delete entire site in one shot
Abhishek-121 Dec 8, 2023
8f1952a
Merge pull request #63 from MUTHU-RAKESH-27/main
madhansansel Dec 8, 2023
e529be7
optimised code for site deletion
Abhishek-121 Dec 8, 2023
1ce8df3
added code for deleting parent site after deleting all child sites
Abhishek-121 Dec 8, 2023
d80ad3a
Merge pull request #64 from Abhishek-121/main
madhansansel Dec 8, 2023
d47bc0c
Addressed PR comments
Dec 9, 2023
4c53a30
Merge branch 'madhansansel:main' into main
MUTHU-RAKESH-27 Dec 9, 2023
8c39d7e
Addressed PR comments
Dec 9, 2023
3c4b7c2
Addressed PR comments
Dec 9, 2023
119b907
Merge pull request #66 from MUTHU-RAKESH-27/main
madhansansel Dec 10, 2023
6c6b6a0
Addressed the PR comments
Dec 11, 2023
1d613f9
Merge branch 'madhansansel:main' into main
MUTHU-RAKESH-27 Dec 11, 2023
f6b8b7e
Merge pull request #67 from MUTHU-RAKESH-27/main
madhansansel Dec 11, 2023
de71062
Adding docstring in discover intent module
madhansansel Dec 11, 2023
aab6e33
Removing while spaces
madhansansel Dec 11, 2023
e426eed
provsion wired device, reboot AP's, export device list, delete provsi…
Abhishek-121 Dec 12, 2023
302e416
Addressed the PR comments
Dec 12, 2023
e156189
Merge branch 'madhansansel:main' into main
MUTHU-RAKESH-27 Dec 12, 2023
a8ef648
Resolved a bug
Dec 12, 2023
bf22088
Moved the check_string_dictionary function to dnac.py
Dec 13, 2023
002ea9b
validating the input in check string dictionary
Dec 13, 2023
1f61947
Merge pull request #72 from MUTHU-RAKESH-27/main
madhansansel Dec 13, 2023
2d916b4
Add seperate API for Reboot AP, export device list into csv and code …
Abhishek-121 Dec 13, 2023
d9b9249
fix sanity test issue of space around not operator
Abhishek-121 Dec 13, 2023
95d53bb
support multiple operation in single run, seperate API for resync device
Abhishek-121 Dec 14, 2023
dcf3268
Merge pull request #68 from Abhishek-121/main
madhansansel Dec 14, 2023
e594777
Adding code for provisioning (wired is validated)
abimishr Dec 14, 2023
10dc4b3
Adding code for Wired and wireless provisioning
abimishr Dec 18, 2023
42a6382
Merge pull request #73 from abimishr/PNP_Code_Abinash
madhansansel Dec 18, 2023
90a6cde
validate password with regex, export device credential into csv, add …
Abhishek-121 Dec 18, 2023
3a2a535
remove duplicate key device_updated from playbook
Abhishek-121 Dec 18, 2023
9d97067
added coded to return if not HAS_PYZIPPER is True
Abhishek-121 Dec 18, 2023
624688c
Merge pull request #74 from Abhishek-121/main
madhansansel Dec 18, 2023
3842788
Adding changeset in changelog file
madhansansel Dec 18, 2023
a322d07
Adding changes in galaxy file
madhansansel Dec 19, 2023
ff7b6ed
Added a new hierarchy for assign device cred to a site
Dec 19, 2023
c10523b
Added a new hierarchy for assign device cred to a site
Dec 19, 2023
0c0ac62
Merge pull request #76 from MUTHU-RAKESH-27/main
madhansansel Dec 19, 2023
345dfe4
change test_swim_module playbook variable in snakecase
Abhishek-121 Dec 19, 2023
a1ec32c
remove duplicate key from playbook
Abhishek-121 Dec 19, 2023
50bb9b8
Merge pull request #77 from Abhishek-121/main
madhansansel Dec 19, 2023
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
14 changes: 14 additions & 0 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -749,3 +749,17 @@ releases:
release_summary: Changing galaxy.
minor_changes:
- Adding support to ansible.utils ">=2.0.0, <4.00".
6.10.0:
release_date: "2023-12-18"
changes:
release_summary: Changes in intent module to support discovery, provisioning and more operations in swim, site, template and pnp intent modules.
minor_changes:
- Changes in inventory_intent module to support Update Device role, update interface details.
- Changes in inventory_intent module to create and assign Global User defined field to devices, Delete Global UDF, Delete Provisioned/Unprovisioned devices.
- Changes in pnp_intent module to support bulk addition and bulk deletion along with variable names.
- Handling idempotent in delete operation in site_intent module.
- Adding discovery intent module to support discovering the devices.
- Changes in swim intent module to support Distribute and activate image by fetching device based on site and device family details
- Changes in site intent module to support one-shot site deletion
- To Support provisioning wired device, reboot AP's, export device list, delete provisioned devices.
- Change the variable names into snake case in all the intent modules for better readability.
8 changes: 6 additions & 2 deletions galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
---
namespace: cisco
name: dnac
version: 6.9.0
version: 6.10.0
readme: README.md
authors:
- Rafael Campos <[email protected]>
- William Astorga <[email protected]>
- Jose Bogarin <[email protected]>
- Bryan Vargas <[email protected]>
- Francisco Muñoz <[email protected]>
- Madhan Sankaranarayanan (@madhansansel)
- Madhan Sankaranarayanan <[email protected]>
- Rishita Chowdhary (@rishitachowdhary)
- Muthu Rakesh Babu <[email protected]>
- Akash Bhaskaran <[email protected]>
- Abinash Mishra <[email protected]>
- Abhishek Maheshwari <[email protected]>
description: Ansible Modules for Cisco DNA Center
license_file: "LICENSE"
tags:
Expand Down
81 changes: 48 additions & 33 deletions playbooks/PnP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,28 @@

tasks:

- name: Add a new device only
- name: Import devices in bulk
cisco.dnac.pnp_intent:
<<: *dnac_login
dnac_log: True
state: merged
config:
- deviceInfo:
add_device_method: Single
serialNumber: FJC2330E0IK
hostname: Test-9300-6
state: Unclaimed
pid: c9300-24P
isSudiRequired: True
- device_info:
- serial_number: FKC2310E0HB
hostname: 1-5
state: Unclaimed
pid: c9300-24P
is_sudi_required: False

- serial_number: FTC2320E0HB
hostname: 1-6
state: Unclaimed
pid: c9300-24P

- serial_number: ETC2320E0HB
hostname: 1-7
state: Unclaimed
pid: c9300-24P

- name: Add a new device and claim it
cisco.dnac.pnp_intent:
Expand All @@ -40,13 +49,12 @@
state: merged
config:
- site_name: Global/USA/San Francisco/BGL_18
deviceInfo:
add_device_method: Single
serialNumber: FJC2330E0IK
hostname: Test-9300-6
state: Unclaimed
pid: c9300-24P
isSudiRequired: True
device_info:
- serial_number: FJC2330E0BB
hostname: Test-9300-10
state: Unclaimed
pid: c9300-24P
is_sudi_required: True

- name: Claim an added Switch with template and image upgrade to a site only
cisco.dnac.pnp_intent:
Expand All @@ -58,11 +66,14 @@
template_name: "Ansible_PNP_Switch"
image_name: cat9k_iosxe_npe.17.03.07.SPA.bin
project_name: Onboarding Configuration
deviceInfo:
serialNumber: FJC271924EQ
hostname: Switch
state: Unclaimed
pid: C9300-48UXM
template_details:
hostname: SJC-Switch-1
interface: TwoGigabitEthernet1/0/2
device_info:
- serial_number: FJC271924EQ
hostname: Switch
state: Unclaimed
pid: C9300-48UXM

- name: Claim an added Wireless Controller with template and image upgrade to a site only
cisco.dnac.pnp_intent:
Expand All @@ -71,25 +82,29 @@
state: merged
config:
- site_name: Global/USA/San Francisco/BGL_18
pnp_type: CatalystWLC
pnp_type: catalyst_wlc
template_name: "Ansible_PNP_WLC"
image_name: C9800-40-universalk9_wlc.17.12.01.SPA.bin
deviceInfo:
serialNumber: FOX2639PAY7
hostname: WLC
state: Unclaimed
pid: C9800-CL-K9
template_params:
hostname: IAC-EWLC-Claimed
device_info:
- serial_number: FOX2639PAY7
hostname: WLC
state: Unclaimed
pid: C9800-CL-K9
gateway: 204.192.101.1
ipInterfaceName: TenGigabitEthernet0/0/0
staticIP: 204.192.101.10
subnetMask: 255.255.255.0
vlanId: 1101
ip_interface_name: TenGigabitEthernet0/0/0
static_ip: 204.192.101.10
subnet_mask: 255.255.255.0
vlan_id: 1101

- name: Delete an added device from the Pnp dashboard
- name: Delete multiple devices from the Pnp dashboard #If device is not present it won't fail
cisco.dnac.pnp_intent:
<<: *dnac_login
dnac_log: True
state: deleted
config:
- deviceInfo:
serialNumber: FJC2330E0IK
- device_info:
- serial_number: FKC2310E0HK
- serial_number: FTC2320E0HA
- serial_number: FKC2310E0HB
118 changes: 76 additions & 42 deletions playbooks/device_credential_intent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,67 +19,101 @@
dnac_log: True
state: merged
config:
- GlobalCredentialDetails:
cliCredential:
- description: CLI
username: cli
- global_credential_details:
cli_credential:
- description: CLI1
username: cli1
password: "12345"
enablePassword: "12345"
enable_password: "12345"
# old_description:
# old_username:
# id: e448ea13-4de0-406b-bc6e-f72b57ed6746 # Use this for updation or deletion
snmpV2cRead:
- description: SNMPv2c Read # use this for deletion
readCommunity: "12345"
snmp_v2c_read:
- description: SNMPv2c Read1 # use this for deletion
read_community: "123456"
# old_description: # use this for updating the description
# id: 0ee7d677-8804-43f2-8b6c-599c5f18348f # Use this for updation or deletion
snmpV2cWrite:
- description: SNMPv2c Write # use this for deletion
writeCommunity: "12345"
snmp_v2c_write:
- description: SNMPv2c Write1 # use this for deletion
write_community: "123456"
# old_description: # use this for updating the description
# id: a96abc1b-1fd6-41f1-8a6d-a5569c17262d # Use this for updation or deletion
snmpV3:
- authPassword: "12345678" # Atleast 8 characters
authType: SHA # [SHA, MD5] (SHA is recommended)
snmpMode: AUTHPRIV # [AUTHPRIV, AUTHNOPRIV, NOAUTHNOPRIV]
privacyPassword: "12345678" # Atleast 8 characters
privacyType: AES128 # [AE128, AE192, AE256]
username: snmpV3
description: snmpV3
snmp_v3:
- auth_password: "12345678" # Atleast 8 characters
auth_type: SHA # [SHA, MD5] (SHA is recommended)
snmp_mode: AUTHPRIV # [AUTHPRIV, AUTHNOPRIV, NOAUTHNOPRIV]
privacy_password: "12345678" # Atleast 8 characters
privacy_type: AES128 # [AE128, AE192, AE256]
username: snmpV31
description: snmpV31
# old_description:
# id: d8974823-250a-41b0-8c9b-b27b2ae01472 # Use this for updation or deletion
httpsRead:
- description: HTTP Read
username: HTTP_Read
https_read:
- description: HTTP Read1
username: HTTP_Read1
password: "12345"
port: 443
# old_description:
# old_username:
# id: a7ef9995-e404-4240-94ca-b5f37f65c19d # Use this for updation or deletion
httpsWrite:
- description: HTTP Write
username: HTTP_Write
https_write:
- description: HTTP Write1
username: HTTP_Write1
password: "12345"
port: 443
# old_description:
# old_username:
# id: bec9818e-30cd-468b-bf75-292beefc2e20 # Use this for updation or deletion
AssignCredentialsToSite:
# cliDescription:
# cliUsername:
cliId: e448ea13-4de0-406b-bc6e-f72b57ed6746
# snmpV2ReadDescription:
snmpV2ReadId: 0ee7d677-8804-43f2-8b6c-599c5f18348f
# snmpV2WriteDescription:
snmpV2WriteId: a96abc1b-1fd6-41f1-8a6d-a5569c17262d
# snmpV3Description:
snmpV3Id: d8974823-250a-41b0-8c9b-b27b2ae01472
# httpReadDescription:
# httpReadUsername:
httpRead: d5d7af00-5a38-4ac1-9f55-03338d00c415
# httpWriteDescription:
# httpWriteUsername:
httpWrite: bec9818e-30cd-468b-bf75-292beefc2e20
siteName:
assign_credentials_to_site:
cli_credential:
# description: CLI
# username: cli
id: e448ea13-4de0-406b-bc6e-f72b57ed6746
snmp_v2c_read:
# description: SNMPv2c Read
id: 0ee7d677-8804-43f2-8b6c-599c5f18348f
snmp_v2c_write:
# description: SNMPv2c Write
id: a96abc1b-1fd6-41f1-8a6d-a5569c17262d
snmp_v3:
# description: snmpV3
id: d8974823-250a-41b0-8c9b-b27b2ae01472
https_read:
# description: HTTP Read
# username: HTTP_Read
id: d5d7af00-5a38-4ac1-9f55-03338d00c415
https_write:
# description: HTTP Write
# username: HTTP_Write
id: bec9818e-30cd-468b-bf75-292beefc2e20
site_name:
- Global/Chennai/Trill
- Global/Chennai/Tidel

- name: Delete Credentials
cisco.dnac.device_credential_intent:
dnac_host: "{{ dnac_host }}"
dnac_port: "{{ dnac_port }}"
dnac_username: "{{ dnac_username }}"
dnac_password: "{{ dnac_password }}"
dnac_verify: "{{ dnac_verify }}"
dnac_debug: "{{ dnac_debug }}"
dnac_log: True
state: deleted
config:
- global_credential_details:
cli_credential:
- description: CLI1
username: cli1
snmp_v2c_read:
- description: SNMPv2c Read1 # use this for deletion
snmp_v2c_write:
- description: SNMPv2c Write1 # use this for deletion
snmp_v3:
- description: snmpV31
https_read:
- description: HTTP Read1
username: HTTP_Read1
https_write:
- description: HTTP Write1
username: HTTP_Write1
49 changes: 32 additions & 17 deletions playbooks/device_details.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,38 @@ template_details:
type: "IOS-XE"
variant: "XE"
temp_name: "temp_cat9k-1"
description: "Test Template 1"
- proj_name: "Onboarding Configuration"
device_config: "hostname cat9k-2\n"
language: "velocity"
family: "Switches and Hubs"
type: "IOS-XE"
variant: "XE"
temp_name: "temp_cat9k-2"
description: "Test Template 2"
- proj_name: "Onboarding Configuration"
device_config: "hostname cat9k-3\n"
language: "velocity"
family: "Switches and Hubs"
type: "IOS-XE"
variant: "XE"
temp_name: "temp_cat9k-3"
description: "Test Template 3"
description: "Test Template"
export_project:
- "Cloud DayN Templates"
export_template:
- project_name: "Cloud DayN Templates"
template_name: "DMVPN Spoke for Branch Router - System Default"
import_project:
do_version: false
payload:
- name: "Onboarding Configuration2"
import_template:
do_version: false
project_name: "Onboarding Configuration"
payload:
- name: "Platinum-Onboarding-Template-J21"
device_types:
- product_family: "Switches and Hubs"
productSeries: "Cisco Catalyst 9300 Series Switches"
software_type: "IOS"
language: "JINJA"
- name: "Platinum-Onboarding-Template-J22"
device_types:
- product_family: "Switches and Hubs"
productSeries: "Cisco Catalyst 9300 Series Switches"
software_type: "IOS"
language: "JINJA"
- name: "Platinum-Onboarding-Template-J23"
device_types:
- product_family: "Switches and Hubs"
productSeries: "Cisco Catalyst 9300 Series Switches"
software_type: "IOS"
language: "JINJA"

device_details:
- site_name: "Global/Chennai/Trill"
Expand Down
30 changes: 30 additions & 0 deletions playbooks/device_provision.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
- name: Provision and Re-provision wired and wireless devices
hosts: localhost
connection: local
gather_facts: no

vars_files:
- "{{ CLUSTERFILE }}"

vars:
dnac_login: &dnac_login
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 }}"

tasks:
- name: Provision a wired device to a site
cisco.dnac.provision_intent:
<<: *dnac_login
dnac_log: True
state: merged
config:
- site_name: Global/USA/San Francisco/BGL_18
management_ip_address: 204.1.2.2


Loading