Skip to content

Commit

Permalink
Merge pull request #48 from madhansansel/main
Browse files Browse the repository at this point in the history
latest changes 04/15/2024
  • Loading branch information
rukapse authored Apr 15, 2024
2 parents a0d7eaa + 0997322 commit 7894c97
Show file tree
Hide file tree
Showing 4 changed files with 845 additions and 616 deletions.
58 changes: 34 additions & 24 deletions playbooks/network_settings_workflow_manager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
dnac_verify: "{{ dnac_verify }}"
dnac_debug: "{{ dnac_debug }}"
dnac_log: True
dnac_log_level: "{{ dnac_log_level }}"
dnac_log_level: DEBUG
dnac_log_append: True
dnac_log_file_path: "{{ dnac_log_file_path }}"
state: merged
Expand All @@ -23,58 +23,70 @@
settings:
ip_pool:
- name: Global_Pool2
gateway: '' #use this for updating
pool_type: Generic
ip_address_space: IPv6 #required when we are creating
cidr: 2001:db8::/64 #required when we are creating
gateway: '' #use this for updating
dhcp_server_ips: [] #use this for updating
dns_server_ips: [] #use this for updating
# prev_name: Global_Pool2
- name: Global_Pool3
pool_type: Generic
ip_address_space: IPv4 #required when we are creating
cidr: 10.0.0.0/8 #required when we are creating
gateway: '' #use this for updating
dhcp_server_ips: [] #use this for updating
dns_server_ips: [] #use this for updating
# prev_name: Global_Pool2
reserve_pool_details:
- site_name: Global/Chennai/Trill
name: IP_Pool_3
pool_type: LAN
ipv6_address_space: True
ipv4_global_pool: 100.0.0.0/8
# ipv4_global_pool: 100.0.0.0/8
ipv4_global_pool_name: Global_Pool1
ipv4_prefix: True
ipv4_prefix_length: 9
ipv4_subnet: 100.128.0.0
ipv4_gateway: 100.128.0.1
# ipv4_dns_servers: [100.128.0.1]
name: IP_Pool_3
ipv4_dns_servers: []
ipv6_prefix: True
ipv6_prefix_length: 64
ipv6_global_pool: 2001:db8::/64
# ipv6_global_pool_name: Global_Pool2
ipv6_subnet: '2001:db8::'
site_name: Global/Chennai/Trill
slaac_support: True
# prev_name: IP_Pool_4
pool_type: LAN
network_management_details:
site_name: Global/Chennai
settings:
dhcp_server:
- 10.0.0.1
dns_server:
domain_name: cisco.com
primary_ip_address: 10.0.0.2
secondary_ip_address: 10.0.0.3
network_aaa: #works only if we system settigns is set
ip_address: 10.0.0.21 #Mandatory for ISE, sec ip for AAA
network: 10.0.0.20
protocol: TACACS
servers: AAA
# shared_secret: string #ISE
client_and_endpoint_aaa: #works only if we system settigns is set
ip_address: 10.197.156.42 #Mandatory for ISE, sec ip for AAA
network: 10.0.0.20
protocol: RADIUS
servers: AAA
# shared_secret: string #ISE
dhcp_server:
- 10.0.0.1
dns_server:
domain_name: cisco.com
primary_ip_address: 10.0.0.2
secondary_ip_address: 10.0.0.3
ntp_server:
- 10.0.0.5
timezone: GMT
message_of_the_day:
banner_message: hello
retain_existing_banner: 'true'
netflow_collector:
ip_address: 10.0.0.4
port: 443
network_aaa: #works only if we system settigns is set
ip_address: 10.0.0.21 #Mandatory for ISE, sec ip for AAA
network: 10.0.0.20
protocol: TACACS
servers: AAA
# shared_secret: string #ISE
ntp_server:
- 10.0.0.5
snmp_server:
configure_dnac_ip: false
# ip_addresses:
Expand All @@ -83,8 +95,6 @@
configure_dnac_ip: false
# ip_addresses:
# - 10.0.0.7
timezone: GMT
site_name: Global/Chennai

- name: Delete Global Pool and Release Pool Reservation
cisco.dnac.network_settings_workflow_manager:
Expand All @@ -104,5 +114,5 @@
ip_pool:
- name: Global_Pool2
reserve_pool_details:
- site_name: Global/Chennai/Trill
name: IP_Pool_3
site_name: Global/Chennai/Trill
16 changes: 11 additions & 5 deletions plugins/modules/inventory_intent.py
Original file line number Diff line number Diff line change
Expand Up @@ -3032,6 +3032,7 @@ def get_diff_merged(self, config):
devices_to_update_role = self.get_device_ips_from_config_priority()
device_role = self.config[0].get('role')
role_update_count = 0
role_updated_list = []
for device_ip in devices_to_update_role:
device_id = self.get_device_ids([device_ip])

Expand Down Expand Up @@ -3076,10 +3077,8 @@ def get_diff_merged(self, config):

if 'successfully' in progress or 'succesfully' in progress:
self.status = "success"
self.result['changed'] = True
self.msg = "Device(s) '{0}' role updated successfully to '{1}'".format(str(devices_to_update_role), device_role)
self.result['response'] = self.msg
self.log(self.msg, "INFO")
self.log("Device '{0}' role updated successfully to '{1}'".format(device_ip, device_role), "INFO")
role_updated_list.append(device_ip)
break
elif execution_details.get("isError"):
self.status = "failed"
Expand All @@ -3100,10 +3099,17 @@ def get_diff_merged(self, config):
self.status = "success"
self.result['changed'] = False
self.msg = """The device role '{0}' is already set in Cisco Catalyst Center, no device role update is needed for the
devices {1}.""".format(device_role, str(devices_to_update_role))
device(s) {1}.""".format(device_role, str(devices_to_update_role))
self.log(self.msg, "INFO")
self.result['response'] = self.msg

if role_updated_list:
self.status = "success"
self.result['changed'] = True
self.msg = "Device(s) '{0}' role updated successfully to '{1}'".format(str(role_updated_list), device_role)
self.result['response'] = self.msg
self.log(self.msg, "INFO")

if credential_update:
device_to_update = self.get_device_ips_from_config_priority()
# Update Device details and credentails
Expand Down
16 changes: 11 additions & 5 deletions plugins/modules/inventory_workflow_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -3023,6 +3023,7 @@ def get_diff_merged(self, config):
devices_to_update_role = self.get_device_ips_from_config_priority()
device_role = self.config[0].get('role')
role_update_count = 0
role_updated_list = []
for device_ip in devices_to_update_role:
device_id = self.get_device_ids([device_ip])

Expand Down Expand Up @@ -3067,10 +3068,8 @@ def get_diff_merged(self, config):

if 'successfully' in progress or 'succesfully' in progress:
self.status = "success"
self.result['changed'] = True
self.msg = "Device(s) '{0}' role updated successfully to '{1}'".format(str(devices_to_update_role), device_role)
self.result['response'] = self.msg
self.log(self.msg, "INFO")
self.log("Device '{0}' role updated successfully to '{1}'".format(device_ip, device_role), "INFO")
role_updated_list.append(device_ip)
break
elif execution_details.get("isError"):
self.status = "failed"
Expand All @@ -3091,10 +3090,17 @@ def get_diff_merged(self, config):
self.status = "success"
self.result['changed'] = False
self.msg = """The device role '{0}' is already set in Cisco Catalyst Center, no device role update is needed for the
devices {1}.""".format(device_role, str(devices_to_update_role))
device(s) {1}.""".format(device_role, str(devices_to_update_role))
self.log(self.msg, "INFO")
self.result['response'] = self.msg

if role_updated_list:
self.status = "success"
self.result['changed'] = True
self.msg = "Device(s) '{0}' role updated successfully to '{1}'".format(str(role_updated_list), device_role)
self.result['response'] = self.msg
self.log(self.msg, "INFO")

if credential_update:
device_to_update = self.get_device_ips_from_config_priority()

Expand Down
Loading

0 comments on commit 7894c97

Please sign in to comment.