Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…talyst-center-ansible-intg into site_workflow_2353_validation
  • Loading branch information
skesali committed Dec 9, 2024
2 parents 65d09fe + 034bead commit 71a483c
Show file tree
Hide file tree
Showing 14 changed files with 396 additions and 287 deletions.
9 changes: 2 additions & 7 deletions changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1107,16 +1107,11 @@ releases:
- Changes in site_workflow_manager
- Modifications due to documentation errors
6.25.1:
release_date: "2024-12-04"
changes:
release_summary: application of unapplied changes.
minor_changes:
- application of the changes made in pull request 207
6.25.2:
release_date: "2024-12-05"
changes:
release_summary: Alias implementation.
release_summary: application of unapplied changes and Alias implementation
minor_changes:
- application of the changes made in pull request 207
- Bug fixes in accesspoint_workflow_manager module
- Changes in sda_fabric_devices_workflow_manager module
- Bug fixes in [sda_fabric_sites_zones_workflow_manager module
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: dnac
version: 6.25.2
version: 6.25.1
readme: README.md
authors:
- Rafael Campos <rcampos@altus.cr>
Expand Down
88 changes: 44 additions & 44 deletions playbooks/inventory_workflow_manager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,47 +21,47 @@
config_verify: true
state: merged
config:
- username: "{{item.username}}"
password: "{{item.password}}"
enable_password: "{{item.enable_password}}"
ip_address_list: "{{item.ip_address_list}}"
cli_transport: "{{item.cli_transport}}"
snmp_auth_passphrase: "{{item.snmp_auth_passphrase}}"
snmp_auth_protocol: "{{item.snmp_auth_protocol}}"
snmp_mode: "{{item.snmp_mode}}"
snmp_priv_passphrase: "{{item.snmp_priv_passphrase}}"
snmp_priv_protocol: "{{item.snmp_priv_protocol}}"
snmp_ro_community: "{{item.snmp_ro_community}}"
snmp_rw_community: "{{item.snmp_rw_community}}"
snmp_username: "{{item.snmp_username}}"
credential_update: "{{item.credential_update}}"
clean_config: "{{item.clean_config}}"
type: "{{item.type}}"
device_resync: "{{item.device_resync}}"
reboot_device: "{{item.reboot_device}}"
role: "{{item.role}}"
add_user_defined_field:
- name: Test123
description: "Added first udf for testing"
value: "value123"
- name: Test321
description: "Added second udf for testing"
value: "value321"
provision_wired_device:
- device_ip: "1.1.1.1"
site_name: "Global/USA/San Francisco/BGL_18/floor_pnp"
resync_retry_count: 200
resync_interval: 2
- device_ip: "2.2.2.2"
site_name: "Global/USA/San Francisco/BGL_18/floor_test"
resync_retry_count: 200
resync_retry_interval: 2
update_interface_details:
description: "{{item.update_interface_details.description}}"
interface_name: "{{item.interface_name}}"
export_device_list:
password: "{{item.export_device_list.password}}"
with_items: "{{ device_details }}"
tags:
- inventory_device
- username: "{{item.username}}"
password: "{{item.password}}"
enable_password: "{{item.enable_password}}"
ip_address_list: "{{item.ip_address_list}}"
cli_transport: "{{item.cli_transport}}"
snmp_auth_passphrase: "{{item.snmp_auth_passphrase}}"
snmp_auth_protocol: "{{item.snmp_auth_protocol}}"
snmp_mode: "{{item.snmp_mode}}"
snmp_priv_passphrase: "{{item.snmp_priv_passphrase}}"
snmp_priv_protocol: "{{item.snmp_priv_protocol}}"
snmp_ro_community: "{{item.snmp_ro_community}}"
snmp_rw_community: "{{item.snmp_rw_community}}"
snmp_username: "{{item.snmp_username}}"
credential_update: "{{item.credential_update}}"
clean_config: "{{item.clean_config}}"
type: "{{item.type}}"
device_resync: "{{item.device_resync}}"
reboot_device: "{{item.reboot_device}}"
role: "{{item.role}}"
add_user_defined_field:
- name: Test123
description: "Added first udf for testing"
value: "value123"
- name: Test321
description: "Added second udf for testing"
value: "value321"
provision_wired_device:
- device_ip: "1.1.1.1"
site_name: "Global/USA/San Francisco/BGL_18/floor_pnp"
resync_retry_count: 200
resync_interval: 2
- device_ip: "2.2.2.2"
site_name: "Global/USA/San Francisco/BGL_18/floor_test"
resync_retry_count: 200
resync_retry_interval: 2
update_interface_details:
description: "{{item.update_interface_details.description}}"
interface_name: "{{item.interface_name}}"
export_device_list:
password: "{{item.export_device_list.password}}"

with_items: "{{ device_details }}"
tags:
- inventory_device
112 changes: 66 additions & 46 deletions playbooks/sda_fabric_devices_workflow_manager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,40 +20,40 @@
state: merged
config_verify: true
config:
- fabric_devices:
fabric_name: Global/USA/SAN-JOSE
device_config:
- device_ip: 10.0.0.1
device_roles: [CONTROL_PLANE_NODE, EDGE_NODE]
borders_settings:
layer3_settings:
local_autonomous_system_number: 213
is_default_exit: true
import_external_routes: true
border_priority: 1
prepend_autonomous_system_count: 1
- fabric_devices:
fabric_name: Global/USA/SAN-JOSE
device_config:
- device_ip: 10.0.0.1
device_roles: [CONTROL_PLANE_NODE, EDGE_NODE]
borders_settings:
layer3_settings:
local_autonomous_system_number: 213
is_default_exit: true
import_external_routes: true
border_priority: 1
prepend_autonomous_system_count: 1

layer3_handoff_ip_transit:
- transit_network_name: IP_TRANSIT_1
interface_name: FortyGigabitEthernet1/1/1
external_connectivity_ip_pool_name: reserved_pool_1
virtual_network_name: L3VN1
vlan_id: 333
tcp_mss_adjustment: 510
layer3_handoff_ip_transit:
- transit_network_name: IP_TRANSIT_1
interface_name: FortyGigabitEthernet1/1/1
external_connectivity_ip_pool_name: reserved_pool_1
virtual_network_name: L3VN1
vlan_id: 333
tcp_mss_adjustment: 510

layer3_handoff_sda_transit:
transit_network_name: SDA_PUB_SUB_TRANSIT
affinity_id_prime: 2
affinity_id_decider: 2
connected_to_internet: true
is_multicast_over_transit_enabled: true
layer3_handoff_sda_transit:
transit_network_name: SDA_PUB_SUB_TRANSIT
affinity_id_prime: 2
affinity_id_decider: 2
connected_to_internet: true
is_multicast_over_transit_enabled: true

layer2_handoff:
- interface_name: FortyGigabitEthernet1/1/1
internal_vlan_id: 443
external_vlan_id: 444
layer2_handoff:
- interface_name: FortyGigabitEthernet1/1/1
internal_vlan_id: 443
external_vlan_id: 444

- name: Delete the SDA fabric device and remove L2 and L3 handoff configurations
- name: Delete the SDA fabric device's L2 and L3 handoff configurations
cisco.dnac.sda_fabric_devices_workflow_manager:
dnac_host: "{{ dnac_host }}"
dnac_port: "{{ dnac_port }}"
Expand All @@ -66,23 +66,43 @@
dnac_log_level: DEBUG
dnac_log_append: true
dnac_log_file_path: "{{ dnac_log_file_path }}"
state: merged
state: deleted
config_verify: true
config:
- fabric_devices:
fabric_name: Global/USA/SAN-JOSE
device_config:
- device_ip: 10.0.0.1
delete_fabric_device: true
borders_settings:
layer3_handoff_ip_transit:
- transit_network_name: IP_TRANSIT_1
interface_name: FortyGigabitEthernet1/1/1
virtual_network_name: L3VN1
- fabric_devices:
fabric_name: Global/USA/SAN-JOSE
device_config:
- device_ip: 10.0.0.1
borders_settings:
layer3_handoff_ip_transit:
- transit_network_name: IP_TRANSIT_1
interface_name: FortyGigabitEthernet1/1/1
virtual_network_name: L3VN1

layer3_handoff_sda_transit:
- transit_network_name: SDA_PUB_SUB_TRANSIT

layer3_handoff_sda_transit:
- transit_network_name: SDA_PUB_SUB_TRANSIT
layer2_handoff:
- interface_name: FortyGigabitEthernet1/1/1
internal_vlan_id: 443

layer2_handoff:
- interface_name: FortyGigabitEthernet1/1/1
internal_vlan_id: 443
- name: Delete the SDA fabric device
cisco.dnac.sda_fabric_devices_workflow_manager:
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_version: "{{ dnac_version }}"
dnac_log: true
dnac_log_level: DEBUG
dnac_log_append: true
dnac_log_file_path: "{{ dnac_log_file_path }}"
state: deleted
config_verify: true
config:
- fabric_devices:
fabric_name: Global/USA/SAN-JOSE
device_config:
- device_ip: 10.0.0.1
20 changes: 20 additions & 0 deletions plugins/module_utils/dnac.py
Original file line number Diff line number Diff line change
Expand Up @@ -2161,12 +2161,32 @@ def fn_comp_key(k, dict1, dict2):
return dnac_compare_equality(dict1.get(k), dict2.get(k))


def normalize_ipv6_address(ipv6):
"""
Normalize an IPv6 address for consistent comparison.
"""
if not isinstance(ipv6, str):
raise TypeError("Input must be a string representing an IPv6 address.")

try:
normalized_address = str(ipaddress.IPv6Address(ipv6))
return normalized_address
except ValueError:
# self.log("Invalid IPv6 address: {}".format(ipv6))
return ipv6 # Return as-is if it's not a valid IPv6 address


def dnac_compare_equality(current_value, requested_value):
# print("dnac_compare_equality", current_value, requested_value)
if requested_value is None:
return True
if current_value is None:
return True
if isinstance(current_value, str) and isinstance(requested_value, str):
if ":" in current_value and ":" in requested_value: # Possible IPv6 addresses
current_value = normalize_ipv6_address(current_value)
requested_value = normalize_ipv6_address(requested_value)
return current_value == requested_value
if isinstance(current_value, dict) and isinstance(requested_value, dict):
all_dict_params = list(current_value.keys()) + list(requested_value.keys())
return not any((not fn_comp_key(param, current_value, requested_value) for param in all_dict_params))
Expand Down
8 changes: 8 additions & 0 deletions plugins/modules/accesspoint_workflow_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -3259,6 +3259,7 @@ def compare_radio_config(self, current_radio, want_radio):

temp_dtos = {}
unmatch_count = 0
self.keymap["power_level"] = "powerlevel"
dtos_keys = list(want_radio.keys())
slot_id_key = "_" + str(current_radio["slot_id"])
self.log("Comparing keys for slot ID: {}".format(current_radio["slot_id"]), "INFO")
Expand Down Expand Up @@ -3289,6 +3290,13 @@ def compare_radio_config(self, current_radio, want_radio):
elif dto_key == "radio_band":
temp_dtos[self.keymap[dto_key]] = want_radio[dto_key]
self.log("Radio band set to: {0}".format(want_radio[dto_key]), "INFO")
elif dto_key == "power_level":
if want_radio[dto_key] != current_radio[self.keymap[dto_key]]:
temp_dtos[self.keymap[dto_key]] = want_radio[dto_key]
self.log("Unmatched key {0}: current value {1}, desired value {2}"
.format(dto_key, current_radio[self.keymap[dto_key]],
want_radio[dto_key]), "INFO")
unmatch_count = unmatch_count + 1
else:
if want_radio[dto_key] != current_radio[dto_key]:
temp_dtos[self.keymap[dto_key]] = want_radio[dto_key]
Expand Down
Loading

0 comments on commit 71a483c

Please sign in to comment.