From 57ffceb42ae040049ad1c57c64dfeb26b9c7efd0 Mon Sep 17 00:00:00 2001 From: PRIYADHARSHINI BALAKUMAR Date: Sun, 12 Apr 2026 21:41:05 -0700 Subject: [PATCH 1/2] Customer_repo_update_inprogress --- .../README.md | 859 +++++++++++++++++- ...health_score_settings_config_generator.yml | 12 +- ...ce_health_score_settings_config_schema.yml | 173 +++- ...ce_health_score_settings_config_inputs.yml | 60 +- 4 files changed, 1019 insertions(+), 85 deletions(-) diff --git a/workflows/assurance_device_health_score_settings_config_generator/README.md b/workflows/assurance_device_health_score_settings_config_generator/README.md index 52f096dd..3af5212c 100644 --- a/workflows/assurance_device_health_score_settings_config_generator/README.md +++ b/workflows/assurance_device_health_score_settings_config_generator/README.md @@ -3,7 +3,6 @@ ## Table of Contents - [User Flow (3 Steps)](#user-flow-3-steps) - - [Overview](#overview) - [Features](#features) - [Prerequisites](#prerequisites) @@ -11,7 +10,8 @@ - [Schema Parameters](#schema-parameters) - [Getting Started](#getting-started) - [Operations](#operations) -- [Examples](#examples)--- +- [Examples](#examples) +--- ## Overview @@ -28,7 +28,7 @@ The Assurance Device Health Score Settings config generator automates YAML playb - **Component Filtering**: Generate `device_health_score_settings` selectively. - **Family Filtering**: Filter by device family list. - **Flexible Output**: Supports custom `file_path` and `file_mode` (`overwrite` / `append`). -- **Brownfield Discovery**: Omit `config` (or use workflow convenience flag) to generate all configured device health score settings. +- **Brownfield Discovery**: Omit `config` to generate all configured device health score settings. --- @@ -47,7 +47,7 @@ The Assurance Device Health Score Settings config generator automates YAML playb ### Required Collections ```bash -ansible-galaxy collection install cisco.dnac +ansible-galaxy collection install cisco.dnac # >= 6.44.0 ansible-galaxy collection install ansible.utils pip install dnacentersdk pip install yamale @@ -82,10 +82,10 @@ assurance_device_health_score_settings_config_generator/ | Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| -| `generate_all_configurations` | boolean | No | false | Workflow convenience flag. When true, playbook omits module `config` | | `file_path` | string | No | auto-generated | Output file path for generated YAML | | `file_mode` | string | No | `overwrite` | File write mode: `overwrite` or `append` | -| `component_specific_filters` | dict | No | omitted | Component and filters passed to module `config` | +| `config` | dict | No | omitted | Optional module config wrapper. Omit it to gather all settings | +| `component_specific_filters` | dict | Yes if `config` is provided | none | Component filter block inside `config` | ### Supported Components @@ -93,12 +93,28 @@ assurance_device_health_score_settings_config_generator/ ### Device Family Filter Values -- `ROUTER` -- `SWITCH_AND_HUB` -- `WIRELESS_CONTROLLER` -- `UNIFIED_AP` -- `WIRELESS_CLIENT` -- `WIRED_CLIENT` +| Filter Value | Description | +|-------------|-------------| +| `ROUTER` | Router devices | +| `SWITCH_AND_HUB` | Switches and hubs | +| `WIRELESS_CONTROLLER` | Wireless controllers | +| `UNIFIED_AP` | Unified access points | +| `WIRELESS_CLIENT` | Wireless client devices | +| `WIRED_CLIENT` | Wired client devices | + +### Filter Specifications + +#### components_list +- **Type**: List of strings +- **Allowed Values**: `["device_health_score_settings"]` +- **Case-sensitive**: Must match exactly +- **Behavior**: Specifies which component type to generate + +#### device_families +- **Type**: List of strings +- **Allowed Values**: `ROUTER`, `SWITCH_AND_HUB`, `WIRELESS_CONTROLLER`, `UNIFIED_AP`, `WIRELESS_CLIENT`, `WIRED_CLIENT` +- **Case-sensitive**: Must match exactly +- **Behavior**: Returns health score settings for only the specified device families --- @@ -148,45 +164,826 @@ ansible-playbook -i ./inventory/demo_lab/hosts.yaml ./workflows/assurance_device ### Generate Operations (state: gathered) -1. **Generate all device health score settings** -- Set `generate_all_configurations: true`. +Use `assurance_device_health_score_settings_config_generator.yml` for generating YAML playbook configuration operations. + +#### Generate All Device Health Score Settings + +**Description**: Retrieves all device health score KPI threshold settings from Catalyst Center. Omit `config` to trigger full generation mode. -2. **Generate component output only** -- Set `component_specific_filters.components_list: ["device_health_score_settings"]`. +```yaml +assurance_device_health_score_settings_config: + - file_path: "/tmp/assurance_device_health_score_settings_complete_config.yml" + file_mode: "overwrite" +``` + +#### Generate Component Output Only + +**Description**: Generates device health score settings with component filter specified but no device family filter. + +```yaml +assurance_device_health_score_settings_config: + - file_path: "/tmp/assurance_device_health_score_settings_component.yml" + file_mode: "overwrite" + config: + component_specific_filters: + components_list: ["device_health_score_settings"] +``` -3. **Generate settings for selected device families** -- Set `component_specific_filters.device_health_score_settings.device_families`. +#### Filter by Device Families + +**Description**: Generates health score settings for specific device families only. + +```yaml +assurance_device_health_score_settings_config: + - file_path: "/tmp/assurance_device_health_score_settings_family_filter.yml" + file_mode: "overwrite" + config: + component_specific_filters: + components_list: ["device_health_score_settings"] + device_health_score_settings: + device_families: + - "UNIFIED_AP" + - "ROUTER" + - "SWITCH_AND_HUB" +``` + +#### Append Mode Generation + +**Description**: Appends generated output to an existing file instead of overwriting. + +```yaml +assurance_device_health_score_settings_config: + - file_path: "/tmp/assurance_device_health_score_settings_aggregate.yml" + file_mode: "append" + config: + component_specific_filters: + components_list: ["device_health_score_settings"] + device_health_score_settings: + device_families: + - "WIRELESS_CONTROLLER" + - "WIRED_CLIENT" +``` -4. **Append generated output** -- Set `file_mode: append`. +**Validate and Execute:** + +```bash +# Validate +./tools/validate.sh -s workflows/assurance_device_health_score_settings_config_generator/schema/assurance_device_health_score_settings_config_schema.yml \ + -d workflows/assurance_device_health_score_settings_config_generator/vars/assurance_device_health_score_settings_config_inputs.yml +``` +**Return result validate:** +```bash +(pyats-priya) [pbalaku2@st-ds-4 dnac_ansible_workflows]$ ./tools/validate.sh -s workflows/assurance_device_health_score_settings_config_generator/schema/assurance_device_health_score_settings_config_schema.yml \ +> -d workflows/assurance_device_health_score_settings_config_generator/vars/assurance_device_health_score_settings_config_inputs.yml +workflows/assurance_device_health_score_settings_config_generator/schema/assurance_device_health_score_settings_config_schema.yml +workflows/assurance_device_health_score_settings_config_generator/vars/assurance_device_health_score_settings_config_inputs.yml +yamale -s workflows/assurance_device_health_score_settings_config_generator/schema/assurance_device_health_score_settings_config_schema.yml workflows/assurance_device_health_score_settings_config_generator/vars/assurance_device_health_score_settings_config_inputs.yml +Validating workflows/assurance_device_health_score_settings_config_generator/vars/assurance_device_health_score_settings_config_inputs.yml... +Validation success! 👍 +``` + +```bash +# Execute +ansible-playbook -i inventory/demo_lab/hosts.yaml \ + workflows/assurance_device_health_score_settings_config_generator/playbook/assurance_device_health_score_settings_config_generator.yml \ + --extra-vars VARS_FILE_PATH=../vars/assurance_device_health_score_settings_config_inputs.yml +``` + +**Expected Terminal Output:** + +1. **Generate All Device Health Score Settings** + +```code + file_path: /tmp/assurance_device_health_score_settings_complete_config.yml + file_mode: overwrite + msg: + YAML config generation Task succeeded for module 'assurance_device_health_score_settings'.: + file_path: /tmp/assurance_device_health_score_settings_complete_config.yml + response: + YAML config generation Task succeeded for module 'assurance_device_health_score_settings'.: + file_path: /tmp/assurance_device_health_score_settings_complete_config.yml + status: success +``` + +2. **Component Output Only:** + +```code + config: + component_specific_filters: + components_list: + - device_health_score_settings + file_path: /tmp/assurance_device_health_score_settings_component.yml + msg: + YAML config generation Task succeeded for module 'assurance_device_health_score_settings'.: + file_path: /tmp/assurance_device_health_score_settings_component.yml + response: + YAML config generation Task succeeded for module 'assurance_device_health_score_settings'.: + file_path: /tmp/assurance_device_health_score_settings_component.yml + status: success +``` + +3. **Device Family Filtered Generation:** + +```code + config: + component_specific_filters: + components_list: + - device_health_score_settings + device_health_score_settings: + device_families: + - UNIFIED_AP + - ROUTER + - SWITCH_AND_HUB + file_path: /tmp/assurance_device_health_score_settings_family_filter.yml + msg: + YAML config generation Task succeeded for module 'assurance_device_health_score_settings'.: + file_path: /tmp/assurance_device_health_score_settings_family_filter.yml + response: + YAML config generation Task succeeded for module 'assurance_device_health_score_settings'.: + file_path: /tmp/assurance_device_health_score_settings_family_filter.yml + status: success +``` + +4. **Append Mode Generation:** + +```code + config: + component_specific_filters: + components_list: + - device_health_score_settings + device_health_score_settings: + device_families: + - WIRELESS_CONTROLLER + - WIRED_CLIENT + file_path: /tmp/assurance_device_health_score_settings_aggregate.yml + file_mode: append + msg: + YAML config generation Task succeeded for module 'assurance_device_health_score_settings'.: + file_path: /tmp/assurance_device_health_score_settings_aggregate.yml + response: + YAML config generation Task succeeded for module 'assurance_device_health_score_settings'.: + file_path: /tmp/assurance_device_health_score_settings_aggregate.yml + status: success +``` --- ## Examples -### Example 1: Generate all assurance device health score settings +### Example 1: Generate ALL device health score settings ```yaml assurance_device_health_score_settings_config: - - generate_all_configurations: true - file_path: "/tmp/assurance_device_health_score_settings_complete_config.yml" + - file_path: "/tmp/assurance_device_health_score_settings_complete_config.yml" + file_mode: "overwrite" ``` +**Sample Generated Output**: + +Below is a sample YAML configuration file generated by the module when `config` is omitted: + +```yaml +--- +config: +- device_health_score: + - device_family: ROUTER + kpi_name: CPU Utilization + include_for_overall_health: true + threshold_value: 95.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: Memory Utilization + include_for_overall_health: true + threshold_value: 95.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: Link Error + include_for_overall_health: true + threshold_value: 1.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: Link Discard + include_for_overall_health: true + threshold_value: 10.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: Fabric Control Plane Reachability + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: Fabric Multicast RP Reachability + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: LISP Session Status + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: LISP Session from Border to Transit Site Control Plane + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: Pub-Sub Session Status + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: Pub-Sub Session from Border to Transit Site Control Plane + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: Pub-Sub Session Status for INFRA VN + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: Extended Node Connectivity + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: Inter-device Link Availability + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: Link Utilization + include_for_overall_health: true + threshold_value: 90.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: Internet Availability + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: BGP Session from Border to Control Plane (BGP) + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: BGP Session to Spine + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: BGP Session from Border to Peer Node + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: VNI Status + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: Peer Status + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: BGP Session from Border to Control Plane (PubSub) + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: BGP Session from Border to Transit Control Plane + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: BGP Session from Border to Peer Node for INFRA VN + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: Cisco TrustSec environment data download status + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: Remote Internet Availability + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: CPU Utilization + include_for_overall_health: true + threshold_value: 95.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: Memory Utilization + include_for_overall_health: true + threshold_value: 95.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: Link Error + include_for_overall_health: true + threshold_value: 1.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: Link Discard + include_for_overall_health: true + threshold_value: 10.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: Fabric Control Plane Reachability + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: Fabric Multicast RP Reachability + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: AAA server reachability + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: LISP Session Status + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: LISP Session from Border to Transit Site Control Plane + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: Pub-Sub Session Status + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: Pub-Sub Session from Border to Transit Site Control Plane + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: Pub-Sub Session Status for INFRA VN + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: Extended Node Connectivity + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: Inter-device Link Availability + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: Internet Availability + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: BGP Session from Border to Control Plane (BGP) + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: BGP Session to Spine + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: BGP Session from Border to Peer Node + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: VNI Status + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: Peer Status + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: BGP Session from Border to Control Plane (PubSub) + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: BGP Session from Border to Transit Control Plane + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: BGP Session from Border to Peer Node for INFRA VN + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: Cisco TrustSec environment data download status + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: Remote Internet Availability + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: UNIFIED_AP + kpi_name: CPU Utilization + include_for_overall_health: true + threshold_value: 90.0 + synchronize_to_issue_threshold: false + - device_family: UNIFIED_AP + kpi_name: Memory Utilization + include_for_overall_health: true + threshold_value: 90.0 + synchronize_to_issue_threshold: false + - device_family: UNIFIED_AP + kpi_name: Link Error + include_for_overall_health: true + threshold_value: 1.0 + synchronize_to_issue_threshold: false + - device_family: UNIFIED_AP + kpi_name: Interference 2.4 GHz + include_for_overall_health: true + threshold_value: 50.0 + synchronize_to_issue_threshold: false + - device_family: UNIFIED_AP + kpi_name: Interference 5 GHz + include_for_overall_health: true + threshold_value: 20.0 + synchronize_to_issue_threshold: false + - device_family: UNIFIED_AP + kpi_name: Interference 6 GHz + include_for_overall_health: true + threshold_value: 20.0 + synchronize_to_issue_threshold: false + - device_family: UNIFIED_AP + kpi_name: Noise 2.4 GHz + include_for_overall_health: true + threshold_value: -81.0 + synchronize_to_issue_threshold: false + - device_family: UNIFIED_AP + kpi_name: Noise 5 GHz + include_for_overall_health: true + threshold_value: -83.0 + synchronize_to_issue_threshold: false + - device_family: UNIFIED_AP + kpi_name: Noise 6 GHz + include_for_overall_health: true + threshold_value: -83.0 + synchronize_to_issue_threshold: false + - device_family: UNIFIED_AP + kpi_name: RF Utilization 2.4 GHz + include_for_overall_health: true + threshold_value: 70.0 + synchronize_to_issue_threshold: false + - device_family: UNIFIED_AP + kpi_name: RF Utilization 5 GHz + include_for_overall_health: true + threshold_value: 70.0 + synchronize_to_issue_threshold: false + - device_family: UNIFIED_AP + kpi_name: RF Utilization 6 GHz + include_for_overall_health: true + threshold_value: 70.0 + synchronize_to_issue_threshold: false + - device_family: UNIFIED_AP + kpi_name: Air Quality 2.4 GHz + include_for_overall_health: true + threshold_value: 60.0 + synchronize_to_issue_threshold: false + - device_family: UNIFIED_AP + kpi_name: Air Quality 5 GHz + include_for_overall_health: true + threshold_value: 75.0 + synchronize_to_issue_threshold: false + - device_family: UNIFIED_AP + kpi_name: Air Quality 6 GHz + include_for_overall_health: true + threshold_value: 75.0 + synchronize_to_issue_threshold: false + - device_family: WIRED_CLIENT + kpi_name: Link Error + include_for_overall_health: true + threshold_value: 10.0 + synchronize_to_issue_threshold: false + - device_family: WIRELESS_CLIENT + kpi_name: Connectivity RSSI + include_for_overall_health: true + threshold_value: -72.0 + synchronize_to_issue_threshold: false + - device_family: WIRELESS_CLIENT + kpi_name: Connectivity SNR + include_for_overall_health: true + threshold_value: 9.0 + synchronize_to_issue_threshold: false + - device_family: WIRELESS_CONTROLLER + kpi_name: Fabric Control Plane Reachability + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: WIRELESS_CONTROLLER + kpi_name: Memory Utilization + include_for_overall_health: true + threshold_value: 95.0 + synchronize_to_issue_threshold: false + - device_family: WIRELESS_CONTROLLER + kpi_name: Link Error + include_for_overall_health: true + threshold_value: 1.0 + synchronize_to_issue_threshold: false + - device_family: WIRELESS_CONTROLLER + kpi_name: LISP Session Status + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: WIRELESS_CONTROLLER + kpi_name: Free Timer + include_for_overall_health: true + threshold_value: 20.0 + synchronize_to_issue_threshold: false + - device_family: WIRELESS_CONTROLLER + kpi_name: Free Mbuf + include_for_overall_health: true + threshold_value: 20.0 + synchronize_to_issue_threshold: false + - device_family: WIRELESS_CONTROLLER + kpi_name: WQE Pool + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false + - device_family: WIRELESS_CONTROLLER + kpi_name: Packet Pool + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false +``` + +### Example 2: Filter by Selected Device Families -### Example 2: Filter by selected device families +Extract health score settings for specific device families only. ```yaml assurance_device_health_score_settings_config: - file_path: "/tmp/assurance_device_health_score_settings_family_filter.yml" - component_specific_filters: - components_list: ["device_health_score_settings"] - device_health_score_settings: - device_families: ["UNIFIED_AP", "ROUTER", "SWITCH_AND_HUB"] + file_mode: "overwrite" + config: + component_specific_filters: + components_list: ["device_health_score_settings"] + device_health_score_settings: + device_families: + - "UNIFIED_AP" + - "ROUTER" + - "SWITCH_AND_HUB" +``` +**Sample Generated Output**: + +Below is a sample YAML configuration file generated by the module when `device_families` filter is used: + +```yaml +--- +config: +- device_health_score: + - device_family: ROUTER + kpi_name: CPU Utilization + include_for_overall_health: true + threshold_value: 95.0 + synchronize_to_issue_threshold: false + - device_family: ROUTER + kpi_name: Memory Utilization + include_for_overall_health: true + threshold_value: 95.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: CPU Utilization + include_for_overall_health: true + threshold_value: 95.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: Memory Utilization + include_for_overall_health: true + threshold_value: 95.0 + synchronize_to_issue_threshold: false + - device_family: UNIFIED_AP + kpi_name: CPU Utilization + include_for_overall_health: true + threshold_value: 90.0 + synchronize_to_issue_threshold: false + - device_family: UNIFIED_AP + kpi_name: Air Quality 5 GHz + include_for_overall_health: true + threshold_value: 75.0 + synchronize_to_issue_threshold: false +``` + +> **Note:** Only the specified device families (`UNIFIED_AP`, `ROUTER`, `SWITCH_AND_HUB`) are extracted. Each family includes its associated KPI threshold settings as configured in Catalyst Center. + +### Example 3: Wireless Device Families Only + +Extract health score settings for wireless-related device families. + +```yaml +assurance_device_health_score_settings_config: + - file_path: "/tmp/wireless_device_health_scores.yml" + file_mode: "overwrite" + config: + component_specific_filters: + components_list: ["device_health_score_settings"] + device_health_score_settings: + device_families: + - "WIRELESS_CONTROLLER" + - "UNIFIED_AP" + - "WIRELESS_CLIENT" +``` + +**Sample Generated Output**: + +```yaml +--- +config: +- device_health_score: + - device_family: UNIFIED_AP + kpi_name: CPU Utilization + include_for_overall_health: true + threshold_value: 90.0 + synchronize_to_issue_threshold: false + - device_family: UNIFIED_AP + kpi_name: RF Utilization 5 GHz + include_for_overall_health: true + threshold_value: 70.0 + synchronize_to_issue_threshold: false + - device_family: WIRELESS_CLIENT + kpi_name: Connectivity RSSI + include_for_overall_health: true + threshold_value: -72.0 + synchronize_to_issue_threshold: false + - device_family: WIRELESS_CLIENT + kpi_name: Connectivity SNR + include_for_overall_health: true + threshold_value: 9.0 + synchronize_to_issue_threshold: false + - device_family: WIRELESS_CONTROLLER + kpi_name: Memory Utilization + include_for_overall_health: true + threshold_value: 95.0 + synchronize_to_issue_threshold: false + - device_family: WIRELESS_CONTROLLER + kpi_name: Packet Pool + include_for_overall_health: true + threshold_value: 0.0 + synchronize_to_issue_threshold: false +``` + +### Example 4: Append Multiple Exports to Single File + +Generate settings for different device families and append them to one file. + +```yaml +assurance_device_health_score_settings_config: + # First export — overwrite with router and switch settings + - file_path: "/tmp/assurance_device_health_score_settings_aggregate.yml" + file_mode: "overwrite" + config: + component_specific_filters: + components_list: ["device_health_score_settings"] + device_health_score_settings: + device_families: + - "ROUTER" + - "SWITCH_AND_HUB" + + # Second export — append wireless controller and wired client + - file_path: "/tmp/assurance_device_health_score_settings_aggregate.yml" + file_mode: "append" + config: + component_specific_filters: + components_list: ["device_health_score_settings"] + device_health_score_settings: + device_families: + - "WIRELESS_CONTROLLER" + - "WIRED_CLIENT" +``` + +**Sample Generated Output**: + +After the first run (`overwrite`), the file contains router and switch settings. After the second run (`append`), wireless controller and wired client settings are appended. + +```yaml +--- +config: +- device_health_score: + - device_family: ROUTER + kpi_name: CPU Utilization + include_for_overall_health: true + threshold_value: 95.0 + synchronize_to_issue_threshold: false + - device_family: SWITCH_AND_HUB + kpi_name: CPU Utilization + include_for_overall_health: true + threshold_value: 95.0 + synchronize_to_issue_threshold: false +--- +config: +- device_health_score: + - device_family: WIRELESS_CONTROLLER + kpi_name: Memory Utilization + include_for_overall_health: true + threshold_value: 95.0 + synchronize_to_issue_threshold: false + - device_family: WIRED_CLIENT + kpi_name: Link Error + include_for_overall_health: true + threshold_value: 10.0 + synchronize_to_issue_threshold: false +``` + +### Example 5: Multiple Generation Tasks + +```yaml +assurance_device_health_score_settings_config: + # Generate all settings + - file_path: "/tmp/all_health_scores.yml" + file_mode: "overwrite" + + # Generate router-only settings + - file_path: "/tmp/router_health_scores.yml" + file_mode: "overwrite" + config: + component_specific_filters: + components_list: ["device_health_score_settings"] + device_health_score_settings: + device_families: + - "ROUTER" + + # Generate AP-only settings + - file_path: "/tmp/ap_health_scores.yml" + file_mode: "overwrite" + config: + component_specific_filters: + components_list: ["device_health_score_settings"] + device_health_score_settings: + device_families: + - "UNIFIED_AP" + + # Generate all families with component filter + - file_path: "/tmp/all_families_component_filter.yml" + file_mode: "overwrite" + config: + component_specific_filters: + components_list: ["device_health_score_settings"] + device_health_score_settings: + device_families: + - "ROUTER" + - "SWITCH_AND_HUB" + - "WIRELESS_CONTROLLER" + - "UNIFIED_AP" + - "WIRELESS_CLIENT" + - "WIRED_CLIENT" +``` + +**Sample Generated Output**: + +Each task generates a YAML file containing the same `device_health_score` list structure, with the content narrowed to the selected device families for that task. + +### Example 6: Auto-generated File Path + +When no file path is specified, the module auto-generates a timestamped filename. + +```yaml +assurance_device_health_score_settings_config: + - config: + component_specific_filters: + components_list: ["device_health_score_settings"] + device_health_score_settings: + device_families: + - "ROUTER" + - "SWITCH_AND_HUB" +# Output: assurance_device_health_score_settings_playbook_config_2026-04-08_14-30-45.yml ``` --- ## Notes -- `assurance_device_health_score_settings_playbook_config_generator` expects `config` as a dictionary when filters are used. -- This workflow omits `config` when filters are absent, which triggers full generation mode. -- Device family names are case-sensitive and should match module-supported values. +- `assurance_device_health_score_settings_playbook_config_generator` expects filters under `config.component_specific_filters`. +- Omit `config` to run the module in full discovery mode — all device health score settings are retrieved. +- When `config` is provided, `component_specific_filters` is mandatory. +- Device family names are case-sensitive and must match module-supported values exactly. +- If `device_health_score_settings` is provided without `components_list`, the module can auto-add `device_health_score_settings` internally. + +--- + +## Additional Resources + +- [Cisco Catalyst Center Documentation](https://www.cisco.com/c/en/us/support/cloud-systems-management/dna-center/series.html) +- [Cisco DNA Center SDK](https://dnacentersdk.readthedocs.io/) +- [Ansible Documentation](https://docs.ansible.com/) +- [Assurance Device Health Score Settings Workflow Manager Module](https://galaxy.ansible.com/ui/repo/published/cisco/dnac/) + diff --git a/workflows/assurance_device_health_score_settings_config_generator/playbook/assurance_device_health_score_settings_config_generator.yml b/workflows/assurance_device_health_score_settings_config_generator/playbook/assurance_device_health_score_settings_config_generator.yml index d3da8332..75f74284 100644 --- a/workflows/assurance_device_health_score_settings_config_generator/playbook/assurance_device_health_score_settings_config_generator.yml +++ b/workflows/assurance_device_health_score_settings_config_generator/playbook/assurance_device_health_score_settings_config_generator.yml @@ -59,16 +59,8 @@ <<: *catalyst_center_login state: "{{ state }}" file_path: "{{ item.file_path | default(omit) }}" - file_mode: "{{ item.file_mode | default('overwrite') }}" - config: >- - {{ - omit - if ( - item.generate_all_configurations | default(false) - or (item.component_specific_filters is not defined) - ) - else {'component_specific_filters': item.component_specific_filters} - }} + file_mode: "{{ item.file_mode | default(omit) }}" + config: "{{ item.config | default(omit) }}" loop: "{{ assurance_device_health_score_settings_config }}" when: - assurance_device_health_score_settings_config is defined diff --git a/workflows/assurance_device_health_score_settings_config_generator/schema/assurance_device_health_score_settings_config_schema.yml b/workflows/assurance_device_health_score_settings_config_generator/schema/assurance_device_health_score_settings_config_schema.yml index 6b129134..0d5d835a 100644 --- a/workflows/assurance_device_health_score_settings_config_generator/schema/assurance_device_health_score_settings_config_schema.yml +++ b/workflows/assurance_device_health_score_settings_config_generator/schema/assurance_device_health_score_settings_config_schema.yml @@ -1,9 +1,148 @@ -# Cisco Catalyst Center Assurance Device Health Score Settings Config Generator Schema -# ====================================================================================== +# Catalyst Center Assurance Device Health Score Settings Config Generator Schema +# =================================================================================== # # This schema defines the configuration structure for generating YAML playbook # configurations from existing assurance device health score settings in Cisco # Catalyst Center using the assurance_device_health_score_settings_playbook_config_generator module. +# +# SCHEMA OVERVIEW: +# --------------- +# The schema supports configuration generation operations for: +# 1. Device Health Score Settings - Extract existing KPI threshold settings +# 2. Component Filtering - Selective extraction of device_health_score_settings component +# 3. Device Family Filtering - Filter settings by device family type +# 4. Append Mode - Aggregate multiple exports into a single file +# 5. Full Discovery - Omit config to retrieve all device health score settings +# +# USAGE: +# ------ +# This schema validates YAML configuration files for automating the extraction +# and generation of device health score KPI threshold configurations from existing +# Catalyst Center deployments (brownfield scenarios). +# +# TOP-LEVEL PARAMETERS: +# ------------------- +# catalyst_center_version: Catalyst Center version (optional, overrides host file) +# catalyst_center_verify: SSL certificate verification (optional, default: false) +# catalyst_center_api_task_timeout: API task timeout in seconds (optional, default: 1200) +# catalyst_center_debug: Enable debug mode (optional, default: false) +# catalyst_center_log: Enable logging (optional, default: false) +# catalyst_center_log_append: Append to log file (optional, default: true) +# catalyst_center_log_file_path: Log file path (optional, default: 'dnac.log') +# catalyst_center_log_level: Log level (CRITICAL, ERROR, WARNING, INFO, DEBUG) +# catalyst_center_config_verify: Configuration verification (optional, default: false) +# +# assurance_device_health_score_settings_config SECTION: +# ------------------------------------------------ +# Contains configuration for generating YAML configurations from existing infrastructure: +# +# 1. FILE_PATH: +# - Type: string (optional) +# - Description: Output path where the YAML configuration file will be saved +# - If not provided, auto-generates filename with timestamp +# - Format: _playbook_config_.yml +# - Example: assurance_device_health_score_settings_playbook_config_2026-04-08_14-30-45.yml +# - Supports absolute and relative paths +# - Creates directory structure if it doesn't exist +# +# 2. FILE_MODE: +# - Type: string (optional, default: overwrite) +# - Description: Determines how generated YAML is written when file_path is provided +# - Supported values: overwrite, append +# - overwrite replaces existing file content +# - append adds new content to the existing file +# +# 3. CONFIG: +# - Type: dictionary (optional) +# - Description: Optional filter configuration +# - If omitted, the module retrieves all device health score settings (full discovery mode) +# - If provided, component_specific_filters is mandatory +# +# 4. COMPONENT_SPECIFIC_FILTERS: +# - Type: dictionary (inside config) +# - Description: Component-level filters to specify which settings to include +# +# Sub-options: +# - COMPONENTS_LIST: +# - Type: list of strings (optional) +# - Description: List of component types to generate +# - Allowed values: ["device_health_score_settings"] +# - Currently supports only one component type +# - If device_health_score_settings sub-filter is provided without components_list, +# the module can auto-add device_health_score_settings internally +# +# - DEVICE_HEALTH_SCORE_SETTINGS: +# - Type: dictionary (optional) +# - Description: Sub-filter for device health score settings component +# +# Sub-options: +# - DEVICE_FAMILIES: +# - Type: list of strings (optional) +# - Description: List of device families to filter health score settings +# - Allowed values: +# - ROUTER : Router devices +# - SWITCH_AND_HUB : Switches and hubs +# - WIRELESS_CONTROLLER : Wireless controllers +# - UNIFIED_AP : Unified access points +# - WIRELESS_CLIENT : Wireless client devices +# - WIRED_CLIENT : Wired client devices +# - Case-sensitive and must be exact matches +# - Min: 1, Max: 6 entries +# - Returns health score settings for only the specified device families +# +# GENERATED OUTPUT STRUCTURE: +# -------------------------- +# The generated YAML file will contain a 'config' section with the following structure: +# +# config: +# - device_health_score: +# - device_family: ROUTER +# kpi_name: CPU Utilization +# include_for_overall_health: true +# threshold_value: 95.0 +# synchronize_to_issue_threshold: false +# - device_family: ROUTER +# kpi_name: Memory Utilization +# include_for_overall_health: true +# threshold_value: 95.0 +# synchronize_to_issue_threshold: false +# +# OPERATION WORKFLOWS: +# ------------------- +# 1. Full Discovery (All Device Health Score Settings): +# a. Omit config entirely +# b. Optionally specify file_path and file_mode +# c. All existing device health score settings will be extracted +# +# 2. Component-Based Generation: +# a. Use config.component_specific_filters with components_list +# b. Specify components_list: ["device_health_score_settings"] +# c. All settings for that component type will be extracted +# +# 3. Device Family Filtered Generation: +# a. Use config.component_specific_filters with device_health_score_settings +# b. Specify device_families list +# c. Only settings for the specified device families will be extracted +# +# 4. Append Mode: +# a. Set file_mode to "append" +# b. New content will be added to the existing file +# c. Useful for aggregating multiple filtered exports into one file +# +# 5. Custom Output Path: +# a. Specify file_path parameter +# b. Can use absolute or relative paths +# c. Directory structure will be created if needed +# +# 6. Default Behavior: +# a. If config is omitted, module retrieves all device health score settings +# b. If no file_path specified, auto-generates filename with timestamp +# c. Generated in current working directory or specified path +# +# EXAMPLES: +# -------- +# See the vars/ directory for comprehensive example configuration files demonstrating +# different usage patterns and scenarios. # Schema Definition assurance_device_health_score_settings_config: list(include('assurance_device_health_score_settings_config_generator_type'), min=1, max=100, required=True) @@ -22,30 +161,30 @@ catalyst_center_config_verify: bool(required=False) --- # Assurance Device Health Score Settings Config Generator Entry Schema assurance_device_health_score_settings_config_generator_type: - generate_all_configurations: bool(required=False) + # Output file path file_path: str(required=False) + + # File write mode: "overwrite" (default) replaces the file; "append" adds to it. file_mode: enum('overwrite', 'append', required=False) - component_specific_filters: include('assurance_device_health_score_component_filters_type', required=False) + + # Optional config block. Omit to gather all device health score settings. + config: include('assurance_device_health_score_settings_config_wrapper_type', required=False) + +--- +# Assurance Device Health Score Settings Config Wrapper Schema +assurance_device_health_score_settings_config_wrapper_type: + component_specific_filters: include('assurance_device_health_score_component_filters_type', required=True) --- # Assurance Device Health Score Settings Component Filters Schema assurance_device_health_score_component_filters_type: + # Components list - currently supports: device_health_score_settings components_list: list(enum('device_health_score_settings'), min=1, max=1, required=False) + + # Device health score settings sub-filter device_health_score_settings: include('device_health_score_settings_filter_type', required=False) --- # Device health score settings filter schema device_health_score_settings_filter_type: - device_families: list( - enum( - 'ROUTER', - 'SWITCH_AND_HUB', - 'WIRELESS_CONTROLLER', - 'UNIFIED_AP', - 'WIRELESS_CLIENT', - 'WIRED_CLIENT' - ), - min=1, - max=6, - required=False - ) + device_families: list(enum('ROUTER', 'SWITCH_AND_HUB', 'WIRELESS_CONTROLLER', 'UNIFIED_AP', 'WIRELESS_CLIENT', 'WIRED_CLIENT'), min=1, max=6, required=False) diff --git a/workflows/assurance_device_health_score_settings_config_generator/vars/assurance_device_health_score_settings_config_inputs.yml b/workflows/assurance_device_health_score_settings_config_generator/vars/assurance_device_health_score_settings_config_inputs.yml index 150c334b..481c90ca 100644 --- a/workflows/assurance_device_health_score_settings_config_generator/vars/assurance_device_health_score_settings_config_inputs.yml +++ b/workflows/assurance_device_health_score_settings_config_generator/vars/assurance_device_health_score_settings_config_inputs.yml @@ -3,9 +3,9 @@ # ============================================================================ # # Usage: -# ansible-playbook -i inventory/demo_lab/hosts.yaml \ -# workflows/assurance_device_health_score_settings_config_generator/playbook/assurance_device_health_score_settings_config_generator.yml \ -# --extra-vars VARS_FILE_PATH=./workflows/assurance_device_health_score_settings_config_generator/vars/assurance_device_health_score_settings_config_inputs.yml + # ansible-playbook -i inventory/demo_lab/hosts.yaml \ + # workflows/assurance_device_health_score_settings_config_generator/playbook/assurance_device_health_score_settings_config_generator.yml \ + # --extra-vars VARS_FILE_PATH=../vars/assurance_device_health_score_settings_config_inputs.yml # # Module used: # cisco.dnac.assurance_device_health_score_settings_playbook_config_generator @@ -13,39 +13,45 @@ assurance_device_health_score_settings_config: # 1) Generate all device health score settings - - generate_all_configurations: true - file_path: "/tmp/assurance_device_health_score_settings_complete_config.yml" + - file_path: "assurance_device_health_score/assurance_device_health_score_settings_complete_config.yml" + file_mode: "overwrite" # 2) Generate device health score settings component only - - file_path: "/tmp/assurance_device_health_score_settings_component.yml" - component_specific_filters: - components_list: ["device_health_score_settings"] + - file_path: "assurance_device_health_score/assurance_device_health_score_settings_component.yml" + file_mode: "overwrite" + config: + component_specific_filters: + components_list: ["device_health_score_settings"] # 3) Filter by selected device families - - file_path: "/tmp/assurance_device_health_score_settings_family_filter.yml" - component_specific_filters: - components_list: ["device_health_score_settings"] - device_health_score_settings: - device_families: - - "UNIFIED_AP" - - "ROUTER" - - "SWITCH_AND_HUB" + - file_path: "assurance_device_health_score/assurance_device_health_score_settings_family_filter.yml" + file_mode: "overwrite" + config: + component_specific_filters: + components_list: ["device_health_score_settings"] + device_health_score_settings: + device_families: + - "UNIFIED_AP" + - "ROUTER" + - "SWITCH_AND_HUB" # 4) Append another filtered export - - file_path: "/tmp/assurance_device_health_score_settings_aggregate.yml" + - file_path: "assurance_device_health_score/assurance_device_health_score_settings_aggregate.yml" file_mode: "append" - component_specific_filters: - components_list: ["device_health_score_settings"] - device_health_score_settings: - device_families: - - "WIRELESS_CONTROLLER" - - "WIRED_CLIENT" + config: + component_specific_filters: + components_list: ["device_health_score_settings"] + device_health_score_settings: + device_families: + - "WIRELESS_CONTROLLER" + - "WIRED_CLIENT" # ============================================================================ # Notes # ============================================================================ -# - If component_specific_filters is omitted, the workflow omits module config -# and runs in full discovery mode. -# - If device_health_score_settings filter is provided without components_list, -# the module can auto-add device_health_score_settings internally. +# - Omit `config` to run the module in full discovery mode. +# - When `config` is provided, `component_specific_filters` is mandatory. +# - If `device_health_score_settings` is provided without `components_list`, +# the module can auto-add `device_health_score_settings` internally. # ============================================================================ + From c256276d924744a18cdea9a9ff92d1c1be873b1e Mon Sep 17 00:00:00 2001 From: PRIYADHARSHINI BALAKUMAR Date: Mon, 13 Apr 2026 01:57:20 -0700 Subject: [PATCH 2/2] Aligned all files according to phase2 changes --- .../assurance_device_health_score_settings_config_generator.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflows/assurance_device_health_score_settings_config_generator/playbook/assurance_device_health_score_settings_config_generator.yml b/workflows/assurance_device_health_score_settings_config_generator/playbook/assurance_device_health_score_settings_config_generator.yml index 75f74284..d5e51786 100644 --- a/workflows/assurance_device_health_score_settings_config_generator/playbook/assurance_device_health_score_settings_config_generator.yml +++ b/workflows/assurance_device_health_score_settings_config_generator/playbook/assurance_device_health_score_settings_config_generator.yml @@ -59,7 +59,7 @@ <<: *catalyst_center_login state: "{{ state }}" file_path: "{{ item.file_path | default(omit) }}" - file_mode: "{{ item.file_mode | default(omit) }}" + file_mode: "{{ item.file_mode | default('overwrite') }}" config: "{{ item.config | default(omit) }}" loop: "{{ assurance_device_health_score_settings_config }}" when: