Skip to content

Commit

Permalink
Final part of Feature Templates
Browse files Browse the repository at this point in the history
  • Loading branch information
cicharka committed May 13, 2024
1 parent afdabc3 commit 7aa84d2
Show file tree
Hide file tree
Showing 12 changed files with 289 additions and 264 deletions.
2 changes: 2 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ mock_modules:
- cisco.catalystwan.devices_controllers
- cisco.catalystwan.devices_info
- cisco.catalystwan.devices_wan_edges
- cisco.catalystwan.feature_templates
- cisco.catalystwan.feature_templates_info
- cisco.catalystwan.health_checks
- cisco.catalystwan.server_info
- cisco.catalystwan.software_repository
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ playbooks/tests/configuration_file_dev_vars.yml
playbooks/tests/ansible_catalystwan.log
playbooks/tests/ansible_catalystwan_module.log
playbooks/tests/catalystwan.log
playbooks/tests/payload*
playbooks/tests/response*
109 changes: 45 additions & 64 deletions playbooks/tests/test_feature_templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@
template_name: "ComprehensiveAAATemplate"
template_description: "AAA Template with both TACACS+ and RADIUS servers"
debug: true
# device_models:
# - vedge-C8000V
device_models:
- vedge-C8000V
cisco_aaa:
user:
- name: "local_admin"
password: "admin_password"
secret: "admin_secret"
privilege: "15"
pubkey_chain:
- key_string: "AAAAB3NzaC1yc2EAAAADAQABAAABAQC3myRj5L6ZFLdRnOEZdUd+4Qq0XPLW9RfO6qD7DJ2t4ZzLh6Oz+IUJg8d8bJDfxO9zGKs5uUQ9f2H5yTGX5G8Z5kKp8QDp1MkDVqwGJ4UM7JqH8s8kD7xcl8SyPc5TjzK4s4W+8LPNOPXmIKtHh1Qlvkp5N7w3M/Rm5ZVX5/3+Hk8Ib5syigQQd/5u5xJj9k3i2x3m3LZ7v5e7YlCpRdCQGf6ZCwvbVQHdJp5nlU0HxJbqjOTL4IcDj09G3Dq2C5JnohKJb7E7HVCUl7F5vYpC/4iNjges65GgdzaFJsT9qA8CgxyF+7J3PpLk5qPAQDT5OjArJj4x9Bw3j3lZdH [email protected]"
- key_string: "AAAAB3NzaC1yc2EAAAADAQABAAABAQC3myRj5L6ZFLdRnOEZdUd+4Qq0XPLW9RfO6qD7DJ2t4ZzLh6Oz+IUJg8d8bJDfxO9zGKs5uUQ9f2H5yTGX5G8Z5kKp8QDp1MkDVqwGJ4UM7JqH8s8kD7xcl8SyPc5TjzK4s4W+8LPNOPXmIKtHh1Qlvkp5N7w3M/Rm5ZVX5/3+Hk8Ib5syigQQd/5u5xJj9k3i2x3m3LZ7v5e7YlCpRdCQGf6ZCwvbVQHdJp5nlU0HxJbqjOTL4IcDj09G3Dq2C5JnohKJb7E7HVCUl7F5vYpC/4iNjges65GgdzaFJsT9qA8CgxyF+7J3PpLk5qPAQDT5OjArJj4x9Bw3j3lZdH [email protected]" # noqa yaml[line-length]
key_type: "ssh-rsa"
authentication_group: true
accounting_group: true
Expand Down Expand Up @@ -110,7 +110,7 @@
timeout: 10
key: "tacacs_key"
secret_key: "tacacs_secret"
key_enum: "key_enum_value"
key_enum: "key_enum_value"
manager_credentials:
<<: *manager_authentication

Expand All @@ -120,8 +120,8 @@
template_name: "CiscoBannerConfigTemplate"
template_description: "Banner configuration for login and MOTD"
debug: true
# device_models:
# - "vedge-C8000V"
device_models:
- "vedge-C8000V"
cisco_banner:
login_banner: |
****************************************************************
Expand All @@ -148,8 +148,8 @@
template_name: "CiscoBFDFeatureTemplate"
template_description: "Comprehensive BFD configuration"
debug: true
# device_models:
# - "vedge-C8000V"
device_models:
- "vedge-C8000V"
cisco_bfd:
multiplier: "3"
poll_interval: "500"
Expand Down Expand Up @@ -184,8 +184,8 @@
template_name: "CiscoLoggingFeatureTemplate"
template_description: "Comprehensive Logging Configuration"
debug: true
# device_models:
# - "vedge-C8000V"
device_models:
- "vedge-C8000V"
cisco_logging:
enable: true
size: "20"
Expand Down Expand Up @@ -238,8 +238,8 @@
template_name: "CiscoNTPFeatureTemplate"
template_description: "Comprehensive NTP Configuration"
debug: true
# device_models:
# - "vedge-C8000V"
device_models:
- "vedge-C8000V"
cisco_ntp:
server:
- name: "0.pool.ntp.org"
Expand Down Expand Up @@ -274,8 +274,8 @@
template_name: "CiscoOMPFeatureTemplate"
template_description: "Comprehensive OMP Configuration"
debug: true
# device_models:
# - "vsmart"
device_models:
- "vsmart"
cisco_omp:
graceful_restart: true
overlay_as: "65000"
Expand Down Expand Up @@ -319,8 +319,8 @@
template_name: "CiscoOSPFeatureTemplate"
template_description: "Comprehensive OSPF Configuration"
debug: true
# device_models:
# - "vedge-C8000V"
device_models:
- "vedge-C8000V"
cisco_ospf:
router_id: "1.1.1.1"
reference_bandwidth: "10000"
Expand Down Expand Up @@ -369,16 +369,16 @@
cost: "100"
no_advertise: true
manager_credentials:
<<: *manager_authentication
<<: *manager_authentication

- name: "Configure Secure Internet Gateway feature template"
cisco.catalystwan.feature_templates:
state: present
template_name: "CiscoSecureInternetGatewayFeatureTemplate"
template_description: "Comprehensive CiscoSecureInternetGateway Configuration"
debug: true
# device_models:
# - "vedge-C8000V"
device_models:
- "vedge-C8000V"
cisco_secure_internet_gateway:
vpn_id: 10
child_org_id: "example_org"
Expand Down Expand Up @@ -455,6 +455,7 @@
cisco.catalystwan.feature_templates:
state: present
template_name: "CiscoSNMPFeatureTemplate"
debug: true
template_description: "Comprehensive Cisco SNMP Configuration"
cisco_snmp:
shutdown: false
Expand Down Expand Up @@ -505,8 +506,8 @@
template_name: "ComprehensiveCiscoSystemTemplate"
template_description: "Cisco System template"
debug: true
# device_models:
# - "vedge-C8000V"
device_models:
- "vedge-C8000V"
cisco_system:
timezone: "UTC"
description: "Example desc"
Expand Down Expand Up @@ -595,7 +596,7 @@
vrf:
- vrf_id: 1
gateway_preference:
- 4
- 4
- 5
- vrf_id: 2
gateway_preference:
Expand All @@ -621,8 +622,8 @@
template_name: "ComprehensiveCiscoVPNInterfaceTemplate"
template_description: "Cisco VPN Interface template"
debug: true
# device_models:
# - "vedge-C8000V"
device_models:
- "vedge-C8000V"
cisco_vpn_interface:
if_name: "GigabitEthernet0/0"
interface_description: "WAN interface"
Expand Down Expand Up @@ -808,8 +809,8 @@
template_name: "ComprehensiveCiscoVPNTemplate"
template_description: "Cisco VPN template"
debug: true
# device_models:
# - "vedge-C8000V"
device_models:
- "vedge-C8000V"
cisco_vpn:
vpn_id: 10
vpn_name: "CorporateVPN"
Expand Down Expand Up @@ -969,7 +970,7 @@
template_name: "OMPvSmartConfigTemplate"
template_description: "Apply OMP settings for vSmart controller"
debug: true
device_models: vsmart
device_models: "vsmart"
omp_vsmart:
graceful_restart: true
graceful_restart_timer: 120
Expand Down Expand Up @@ -1040,40 +1041,20 @@
manager_credentials:
<<: *manager_authentication

# # # Example of devices specific variables - this works in Feature Templates, need to check Device Templates
# # - name: Create Cisco Banner Feature Template
# # cisco.catalystwan.feature_templates:
# # state: present
# # template_name: "CiscoBannerConfigTemplate"
# # template_description: "Banner configuration for login and MOTD"
# # debug: true
# # device_specific_variables:
# # login_banner: "var_name_1"
# # motd_banner: "var_name_2"
# # device_models:
# # - "vedge-C8000V"
# # cisco_banner:
# # login_banner: device_specific_variable
# # motd_banner: device_specific_variable
# # manager_credentials:
# # <<: *manager_authentication



# """
# By default it should use default Feature Template

# But if user want to change it, they have choice and they should do it explicitly



# Change create -> add for Feature Template

# """
# - name: "Create Comprehensive OMP vSmart Template"
# cisco.catalystwan.device_templates:
# state: attached
# template_name: "OMPvSmartConfigTemplate"
# template_description: "Apply OMP settings for vSmart controller"
# debug: true
# device_models: ""
# Example of devices specific variables - this works in Feature Templates, need to check Device Templates
- name: Create Cisco Banner Feature Template
cisco.catalystwan.feature_templates:
state: present
template_name: "CiscoBannerConfigTemplateDSV"
template_description: "Banner configuration for login and MOTD with DSV"
debug: true
device_specific_variables:
login_banner: "var_name_1"
motd_banner: "var_name_2"
device_models:
- "vedge-C8000V"
cisco_banner:
login_banner: device_specific_variable
motd_banner: device_specific_variable
manager_credentials:
<<: *manager_authentication
7 changes: 4 additions & 3 deletions plugins/doc_fragments/feature_template_cisco_snmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


class ModuleDocFragment(object):
DOCUMENTATION = r'''
DOCUMENTATION = r"""
options:
cisco_snmp:
description: Cisco SNMP Feature Template configuration
Expand Down Expand Up @@ -161,11 +161,12 @@ class ModuleDocFragment(object):
priv:
description:
- The privacy (encryption) protocol used
required: true
required: false
default: null
type: str
choices:
- aes-cfb-128
- aes-256-cfb-128
priv_password:
description:
- The password for privacy
Expand Down Expand Up @@ -222,4 +223,4 @@ class ModuleDocFragment(object):
required: false
default: null
type: str
'''
"""
10 changes: 5 additions & 5 deletions plugins/doc_fragments/feature_template_cisco_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


class ModuleDocFragment(object):
DOCUMENTATION = r'''
DOCUMENTATION = r"""
options:
cisco_system:
description: Cisco System configuration settings for SD-WAN devices.
Expand Down Expand Up @@ -455,7 +455,7 @@ class ModuleDocFragment(object):
suboptions:
name:
description:
- null
- Device Specific Variables names
required: true
default: null
type: str
Expand Down Expand Up @@ -533,7 +533,7 @@ class ModuleDocFragment(object):
suboptions:
name:
description:
- null
- Device Specific Variables names
required: true
default: null
type: str
Expand Down Expand Up @@ -662,7 +662,7 @@ class ModuleDocFragment(object):
suboptions:
name:
description:
- null
- Name for the Tracker
required: true
default: null
type: str
Expand Down Expand Up @@ -940,4 +940,4 @@ class ModuleDocFragment(object):
- aggressive
- moderate
- conservative
'''
"""
Loading

0 comments on commit 7aa84d2

Please sign in to comment.