Skip to content

Commit

Permalink
Merge pull request #140 from madhansansel/main
Browse files Browse the repository at this point in the history
Changes in intent module to support discovery, provisioning and more operations in swim, site, template and pnp intent modules
  • Loading branch information
fmunozmiranda authored Dec 19, 2023
2 parents 20a8c6e + 50bb9b8 commit df3cf82
Show file tree
Hide file tree
Showing 24 changed files with 7,148 additions and 2,427 deletions.
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

0 comments on commit df3cf82

Please sign in to comment.