Skip to content

Commit 718798b

Browse files
authored
Merge branch 'main' into flexible_reports
2 parents 4734421 + 9a5fe0a commit 718798b

24 files changed

+23566
-15084
lines changed

playbooks/fabric_devices_info_workflow_manager.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
config_verify: true
2020
dnac_api_task_timeout: 1000
2121
dnac_task_poll_interval: 1
22-
state: merged
22+
state: gathered
2323
config:
2424
- fabric_devices:
2525
- fabric_site_hierarchy: "Global/rishipat_area/Fabric-area-1" # Mandatory parameter

playbooks/network_devices_info_workflow_manager.yml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,23 @@
1919
config_verify: false
2020
dnac_api_task_timeout: 1000
2121
dnac_task_poll_interval: 1
22-
state: queried
22+
state: gathered
2323
config:
2424
- network_devices:
25-
- management_ip_address: ["91.1.1.6"]
26-
mac_address: ["cc:70:ed:e1:c3:00"]
27-
hostname: ["SJ-Border2-9500.cisco.com"]
28-
serial_number: ["FCW2243F199"]
29-
os_type: ["IOS-XE"]
30-
software_version: ["17.15.2"]
31-
role: ["BORDER ROUTER"]
32-
device_type: ["Cisco Catalyst 9500 Switch"]
33-
family: ["Switches and Hubs"]
34-
site_hierarchy: ["Global/USA/SAN JOSE/BLD23"]
35-
timeout: 10
36-
retries: 1
37-
interval: 1
25+
- site_hierarchy: Global/USA/SAN JOSE
26+
device_type: "Cisco Catalyst 9300 Switch"
27+
device_role: "ACCESS"
28+
device_family: "Switches and Hubs"
29+
software_version: "17.12.1"
30+
os_type: "IOS-XE"
31+
device_identifier:
32+
- ip_address: ["204.1.2.1"]
33+
- serial_number: ["FCW2137L0SB"]
34+
- hostname: ["SJ-BN-9300.cisco.local"]
35+
- mac_address: ["90:88:55:90:26:00"]
36+
timeout: 60
37+
retries: 3
38+
interval: 10
3839
requested_info:
3940
- device_info
4041
- interface_info
@@ -51,7 +52,7 @@
5152
- device_stack_info
5253
- device_link_mismatch_info
5354
output_file_info:
54-
file_path: /Users/karthick/Downloads/testing
55+
file_path: /Users/priyadharshini/Downloads/info
5556
file_format: json
56-
file_mode: a
57+
file_mode: w
5758
timestamp: true

plugins/modules/application_policy_workflow_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@
889889

890890
RETURN = r"""
891891
# Case 1: Successful creation of application queuing profile
892-
creation _of_application_queuing_profile_response_task_execution:
892+
creation_of_application_queuing_profile_response_task_execution:
893893
description: A dictionary with details for successful task execution.
894894
returned: always
895895
type: dict
@@ -1059,7 +1059,7 @@
10591059
"status": "success"
10601060
}
10611061
# Case 19: update not required for application policy
1062-
update_not_required_ for_application_policy_response_task_execution:
1062+
update_not_required_for_application_policy_response_task_execution:
10631063
description: With task id get details for successful task execution
10641064
returned: always
10651065
type: dict

plugins/modules/fabric_devices_info_workflow_manager.py

Lines changed: 322 additions & 43 deletions
Large diffs are not rendered by default.

plugins/modules/ise_radius_integration_workflow_manager.py

Lines changed: 88 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from __future__ import absolute_import, division, print_function
77

88
__metaclass__ = type
9-
__author__ = ["Muthu Rakesh, Madhan Sankaranarayanan"]
9+
__author__ = ["Muthu Rakesh, Madhan Sankaranarayanan, Archit Soni"]
1010
DOCUMENTATION = r"""
1111
---
1212
module: ise_radius_integration_workflow_manager
@@ -24,7 +24,7 @@
2424
extends_documentation_fragment:
2525
- cisco.dnac.workflow_manager_params
2626
author: Muthu Rakesh (@MUTHU-RAKESH-27) Madhan Sankaranarayanan
27-
(@madhansansel)
27+
(@madhansansel) Archit Soni (@koderchit)
2828
options:
2929
config_verify:
3030
description: Set to True to verify the Cisco Catalyst
@@ -1390,16 +1390,21 @@ def get_want(self, config):
13901390
self.status = "success"
13911391
return self
13921392

1393-
def check_ise_server_integration_status(self, ip_address):
1393+
def wait_for_ise_integration_status(self, ip_address):
13941394
"""
1395-
Check whether the Cisco ISE server is ready for the accepting the user authentication certificate.
1395+
Wait for the Cisco ISE server to complete its integration with Cisco Catalyst Center.
1396+
1397+
This method continuously polls the Cisco ISE server integration status until it reaches
1398+
a terminal state (`WAITING_USER_INPUT` or `COMPLETE`). If the process exceeds the
1399+
allowed timeout period (30 seconds) or an exception occurs during status retrieval,
1400+
the method logs the failure and terminates execution using `fail_and_exit()`.
13961401
13971402
Parameters:
1398-
ip_address (str) - The IP address of the Cisco ISE server.
1399-
self - The current object with updated desired Authentication Policy Server information.
1403+
ip_address (str): The IP address of the Cisco ISE server being integrated.
14001404
14011405
Returns:
1402-
self - The current object with updated desired Authentication Policy Server information.
1406+
str: The final integration status of the Cisco ISE server (WAITING_USER_INPUT or COMPLETE).
1407+
The function does not return if it fails — it calls `fail_and_exit()` to fail and exit the module.
14031408
"""
14041409

14051410
start_time = time.time()
@@ -1410,32 +1415,34 @@ def check_ise_server_integration_status(self, ip_address):
14101415
function="cisco_ise_server_integration_status",
14111416
op_modifies=True,
14121417
)
1418+
overall_status = cisco_ise_status.get("overallStatus")
14131419
except Exception as msg:
1414-
self.msg = "Exception occurred while checking the status of the Cisco ISE server with IP address '{ip}'.".format(
1415-
ip=ip_address
1420+
self.msg = (
1421+
f"Exception occurred while checking the status of the Cisco ISE server "
1422+
f"with IP address '{ip_address}'. Error: {msg}"
14161423
)
1424+
self.fail_and_exit(self.msg)
1425+
1426+
self.log(f"Current ISE server status: '{overall_status}'", "WARNING")
14171427

1418-
overall_status = cisco_ise_status.get("overallStatus")
1419-
statuses = ["WAITING_USER_INPUT", "COMPLETE"]
1420-
if overall_status in statuses:
1428+
if overall_status in ["WAITING_USER_INPUT", "COMPLETE"]:
14211429
self.log(
1422-
"The status of the Cisco ISE server is '{status}'".format(
1423-
status=overall_status
1424-
)
1430+
f"The Cisco ISE server status is '{overall_status}'. Breaking the loop.",
1431+
"INFO",
14251432
)
14261433
break
14271434

1428-
if (time.time() - start_time) >= 10:
1435+
if (time.time() - start_time) >= 30:
14291436
self.msg = (
1430-
"The Cisco Catalyst Center took more than 10 seconds to accept "
1431-
"the PxGrid certificate of the Cisco ISE server with ."
1437+
f"The Cisco Catalyst Center took more than 10 seconds to accept "
1438+
f"the PxGrid certificate of the Cisco ISE server with IP '{ip_address}'."
14321439
)
1433-
self.status = "failed"
1434-
break
1440+
self.fail_and_exit(self.msg)
14351441

14361442
time.sleep(1)
14371443

1438-
return self
1444+
self.log(f"Final ISE server status: '{overall_status}'", "INFO")
1445+
return overall_status
14391446

14401447
def accept_cisco_ise_server_certificate(self, ipAddress, trusted_server):
14411448
"""
@@ -1470,6 +1477,11 @@ def accept_cisco_ise_server_certificate(self, ipAddress, trusted_server):
14701477
self.status = "failed"
14711478
return self
14721479

1480+
self.log(
1481+
"Calling 'accept_cisco_ise_server_certificate_for_cisco_ise_server_integration' API with payload - "
1482+
f"id: {cisco_ise_id}, isCertAcceptedByUser: {trusted_server}",
1483+
"INFO",
1484+
)
14731485
response = self.dnac._exec(
14741486
family="system_settings",
14751487
function="accept_cisco_ise_server_certificate_for_cisco_ise_server_integration",
@@ -1703,7 +1715,7 @@ def update_auth_policy_server(self, authentication_policy_server):
17031715
]
17041716
self.log(
17051717
"Desired State for Authentication and Policy Server for the IP '{0}' (want): {1}".format(
1706-
ip_address, auth_server_params
1718+
ip_address, self.pprint(auth_server_params)
17071719
),
17081720
"DEBUG",
17091721
)
@@ -1738,8 +1750,31 @@ def update_auth_policy_server(self, authentication_policy_server):
17381750

17391751
if is_ise_server:
17401752
trusted_server = self.want.get("trusted_server")
1741-
self.check_ise_server_integration_status(ip_address)
1742-
self.accept_cisco_ise_server_certificate(ip_address, trusted_server)
1753+
ise_radius_integration_status = (
1754+
self.wait_for_ise_integration_status(ip_address)
1755+
)
1756+
if ise_radius_integration_status == "WAITING_USER_INPUT":
1757+
self.log(
1758+
"Cisco ISE server is waiting for user input to accept the certificate.",
1759+
"INFO",
1760+
)
1761+
self.log(
1762+
f"Calling API to accept Cisco ISE server certificate for IP '{ip_address}' with trusted_server={trusted_server}",
1763+
"INFO",
1764+
)
1765+
self.accept_cisco_ise_server_certificate(
1766+
ip_address, trusted_server
1767+
)
1768+
1769+
elif ise_radius_integration_status == "COMPLETE":
1770+
self.log(
1771+
"Cisco ISE server integration is already complete. No user certificate acceptance required.",
1772+
"INFO",
1773+
)
1774+
else:
1775+
self.msg = f"Unexpected Cisco ISE server integration status '{ise_radius_integration_status}' for IP '{ip_address}'."
1776+
self.fail_and_exit(self.msg)
1777+
17431778
ise_integration_wait_time = self.want.get(
17441779
"ise_integration_wait_time"
17451780
)
@@ -1920,11 +1955,38 @@ def update_auth_policy_server(self, authentication_policy_server):
19201955

19211956
trusted_server_msg = ""
19221957
if is_ise_server_enabled:
1958+
self.log(
1959+
"Cisco ISE server is enabled. Checking if it certificate acceptance processing.",
1960+
"DEBUG",
1961+
)
19231962
trusted_server = self.want.get("trusted_server")
19241963
state = have_auth_server_details.get("state")
19251964
if state != "ACTIVE":
1926-
self.check_ise_server_integration_status(ip_address)
1927-
self.accept_cisco_ise_server_certificate(ip_address, trusted_server)
1965+
ise_radius_integration_status = (
1966+
self.wait_for_ise_integration_status(ip_address)
1967+
)
1968+
if ise_radius_integration_status == "WAITING_USER_INPUT":
1969+
self.log(
1970+
"Cisco ISE server is waiting for user input to accept the certificate.",
1971+
"INFO",
1972+
)
1973+
self.log(
1974+
f"Calling API to accept Cisco ISE server certificate for IP '{ip_address}' with trusted_server={trusted_server}",
1975+
"INFO",
1976+
)
1977+
self.accept_cisco_ise_server_certificate(
1978+
ip_address, trusted_server
1979+
)
1980+
1981+
elif ise_radius_integration_status == "COMPLETE":
1982+
self.log(
1983+
"Cisco ISE server integration is already complete. No user certificate acceptance required.",
1984+
"INFO",
1985+
)
1986+
else:
1987+
self.msg = f"Unexpected Cisco ISE server integration status '{ise_radius_integration_status}' for IP '{ip_address}'."
1988+
self.fail_and_exit(self.msg)
1989+
19281990
ise_integration_wait_time = self.want.get(
19291991
"ise_integration_wait_time"
19301992
)

0 commit comments

Comments
 (0)