GetCiscoISEActiveInstance
Determines which configured Cisco ISE instance is in active/primary state and returns the name of the instance.
- Type
- python
- Pack
- PaloAltoNetworks_IoT3rdParty
Source
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
def get_cisco_ise_active_instance_or_err_msg():
"""
Get ise node details for all configured instances and determine
which on is active/primary. All gather error messages if possible
for nodes that are not in active state or have connnectivity issues.
"""
err_msg = []
active_instance = None
# run common on all configured Cisco ISE nodes
response = demisto.executeCommand("cisco-ise-get-nodes", {})
for resp in response:
local_instance = resp["ModuleName"]
if isError(resp):
err = resp["Contents"]
err_msg.append(f'{err.split("-")[0]} , instance name = {local_instance}')
else:
# Check if the output has any node that matches the local instance
# and is also a primary or is in standalone mode
for node_data in resp["Contents"]["CiscoISE.NodesData"]:
if (
node_data["isLocalIstance"]
and node_data["inDeployment"] is False
or (node_data["inDeployment"] is True and node_data["primaryPapNode"] is True)
):
active_instance = local_instance
return active_instance, err_msg
def main():
try:
active_instance, err_msg = get_cisco_ise_active_instance_or_err_msg()
except Exception as ex:
return_error(str(ex))
if active_instance is None:
readable_status = f"No Primary/Active Cisco ISE node found = {err_msg}"
results = CommandResults(
readable_output=readable_status, outputs_prefix="PaloAltoIoTIntegrationBase.NodeErrorStatus", outputs=readable_status
)
# Write data to context and display result in war room
return_results(results)
# Also return error, so we can detect it in the playbook
return_error(err_msg)
else:
readable_status = f"Found active Cisco ISE node = {active_instance}"
results = CommandResults(
readable_output=readable_status,
outputs_prefix="PaloAltoIoTIntegrationBase.ActiveNodeInstance",
outputs=active_instance,
)
return_results(results)
if __name__ in ("__main__", "__builtin__", "builtins"):
main()
README
Determines which configured Cisco ISE instance is in active/primary state and returns the name of the instance.
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
| Tags | PANW IoT 3rd Party Integration, Cisco ISE |
| Cortex XSOAR Version | 6.0.0 |
Used In
This script is used in the following playbooks and scripts.
- Bulk Export to Cisco ISE - PANW IoT 3rd Party Integration
- Un-quarantine Device in Cisco ISE - PANW IoT 3rd Party Integration
- Quarantine Device in Cisco ISE - PANW IoT 3rd Party Integration
- Incremental Export to Cisco ISE - PANW IoT 3rd Party Integration
Dependencies
This script uses the following commands and scripts.
- cisco-ise-get-nodes
This Scripts uses the following commands:
‘cisco-ise-get-nodes’ - Gets data for all Cisco ISE nodes in the current deployment
Inputs
There are no inputs for this script.
Outputs
| Path | Description | Type |
|---|---|---|
| PaloAltoIoTIntegrationBase.ActiveNodeInstance | Returns instance name of the active Cisco ISE node. | unknown |
| PaloAltoIoTIntegrationBase.NodeErrorStatus | Returns the nodes error status if no active Cisco ISE nodes are found. | unknown |