Skip to content

Commit

Permalink
Integration test cases for ISE integration workflow manager module (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
madhansansel authored Dec 18, 2024
2 parents 66b40e4 + 96da6b6 commit 97de41a
Show file tree
Hide file tree
Showing 7 changed files with 384 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
testcase: "*"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dependencies: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
- name: collect ccc test cases
find:
paths: "{{ role_path }}/tests"
patterns: "{{ testcase }}.yml"
connection: local
register: ccc_cases
tags: sanity

- debug:
msg: "CCC Cases: {{ ccc_cases }}"

- set_fact:
test_cases:
files: "{{ ccc_cases.files }}"
tags: sanity

- debug:
msg: "Test Cases: {{ test_cases }}"

- name: set test_items
set_fact:
test_items: "{{ test_cases.files | map(attribute='path') | list }}"
tags: sanity

- debug:
msg: "Test Items: {{ test_items }}"

- name: run test cases (connection=httpapi)
include_tasks: "{{ test_case_to_run }}"
loop: "{{ test_items }}"
loop_control:
loop_var: test_case_to_run
tags: sanity
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
---
- debug: msg="Starting AAA server management test"
- debug: msg="Role Path {{ role_path }}"

- block:
- name: Load vars and declare dnac vars
include_vars:
file: "{{ role_path }}/vars/vars_aaa_server.yml"
name: vars_map
vars:
dnac_login: &dnac_login
dnac_host: "{{ dnac_host }}"
dnac_username: "{{ dnac_username }}"
dnac_password: "{{ dnac_password }}"
dnac_verify: "{{ dnac_verify }}"
dnac_port: "{{ dnac_port }}"
dnac_version: "{{ dnac_version }}"
dnac_debug: "{{ dnac_debug }}"
dnac_log: true
dnac_log_level: DEBUG
config_verify: true

# - debug:
# msg: "{{ vars_map.create_aaa_server_details }}"

# - debug:
# msg: "{{ vars_map.update_aaa_server_details }}"

# - debug:
# msg: "{{ vars_map.delete_aaa_server_details }}"

#############################################
# Pre Tests Clean Up #
#############################################

- name: Clean up AAA server before test
block:
- name: Clean up AAA server before test
cisco.dnac.ise_radius_integration_workflow_manager:
<<: *dnac_login
state: deleted
config:
- "{{ item }}"
loop: "{{ vars_map.delete_aaa_server_details }}"

- name: Pause for 5 seconds after each deletion
pause:
seconds: 5

#############################################
# CREATE AAA SERVER #
#############################################

- name: Create AAA server
block:
- name: Create AAA server from create_aaa_server_details config
cisco.dnac.ise_radius_integration_workflow_manager:
<<: *dnac_login
state: merged
config:
- "{{ item }}"
register: result_create_aaa_server
loop: "{{ vars_map.create_aaa_server_details }}"
tags: merged

- name: Pause for 5 seconds after each creation
pause:
seconds: 5

# - name: Debug item
# debug:
# var: item
# loop: "{{ result_create_aaa_server.results }}"
# when: result_create_aaa_server is defined

- name: Assert AAA server creation
assert:
that:
- item.changed == true
- item.response[0].authenticationPolicyServer.Validation == "Success"
- "'Created Successfully' in item.response[0].authenticationPolicyServer.msg['10.0.0.40']"
loop: "{{ result_create_aaa_server.results }}"
when: result_create_aaa_server is defined

#############################################
# UPDATE AAA SERVER #
#############################################

- name: Update AAA server
block:
- name: Update AAA server from update_aaa_server_details config
cisco.dnac.ise_radius_integration_workflow_manager:
<<: *dnac_login
state: merged
config:
- "{{ item }}"
with_list: "{{ vars_map.update_aaa_server_details }}"
tags: merged
register: result_update_aaa_server

- name: Pause for 5 seconds after each updation
pause:
seconds: 5

# - name: Debug item
# debug:
# var: item
# loop: "{{ result_update_aaa_server.results }}"
# when: result_update_aaa_server is defined

- name: Assert AAA server updation
assert:
that:
- item.changed == true
- item.response[0].authenticationPolicyServer.Validation == "Success"
- "'Updated Successfully' in item.response[0].authenticationPolicyServer.msg['10.0.0.40']"
loop: "{{ result_update_aaa_server.results }}"
when: result_update_aaa_server is defined

#############################################
# DELETE AAA SERVER #
#############################################

- name: Delete AAA server
block:
- name: Delete AAA server from delete_aaa_server_details config
cisco.dnac.ise_radius_integration_workflow_manager:
<<: *dnac_login
state: deleted
config:
- "{{ item }}"
register: result_delete_aaa_server
loop: "{{ vars_map.delete_aaa_server_details }}"
tags: deleted

# - name: Debug item
# debug:
# var: item
# loop: "{{ result_delete_aaa_server.results }}"
# when: result_delete_aaa_server is defined

- name: Assert AAA server deletion
assert:
that:
- item.changed == true
- item.response[0].authenticationPolicyServer.Validation == "Success"
- "'deleted successfully' in item.response[0].authenticationPolicyServer.msg['10.0.0.40']"
loop: "{{ result_delete_aaa_server.results }}"
when: result_delete_aaa_server is defined
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# ---
# - debug: msg="Starting Cisco ISE server management test"
# - debug: msg="Role Path {{ role_path }}"

# - block:
# - name: Load vars and declare dnac vars
# include_vars:
# file: "{{ role_path }}/vars/vars_ise_server.yml"
# name: vars_map
# vars:
# dnac_login: &dnac_login
# dnac_host: "{{ dnac_host }}"
# dnac_username: "{{ dnac_username }}"
# dnac_password: "{{ dnac_password }}"
# dnac_verify: "{{ dnac_verify }}"
# dnac_port: "{{ dnac_port }}"
# dnac_version: "{{ dnac_version }}"
# dnac_debug: "{{ dnac_debug }}"
# dnac_log: true
# dnac_log_level: DEBUG
# config_verify: true

# # - debug:
# # msg: "{{ vars_map.create_ise_server_details }}"

# # - debug:
# # msg: "{{ vars_map.update_ise_server_details }}"

# # - debug:
# # msg: "{{ vars_map.delete_ise_server_details }}"

# # #############################################
# # # Pre Tests Clean Up #
# # #############################################

# # - name: Clean up Cisco ISE server before test
# # cisco.dnac.ise_radius_integration_workflow_manager:
# # <<: *dnac_login
# # state: deleted
# # config:
# # - "{{ item }}"
# # loop: "{{ vars_map.delete_ise_server_details }}"

# #############################################
# # CREATE ISE SERVER #
# #############################################

# - name: Create Cisco ISE server from create_ise_server_details config
# cisco.dnac.ise_radius_integration_workflow_manager:
# <<: *dnac_login
# state: merged
# config:
# - "{{ item }}"
# register: result_create_ise_server
# loop: "{{ vars_map.create_ise_server_details }}"
# tags: merged

# # - name: Debug item
# # debug:
# # var: item
# # loop: "{{ result_create_ise_server.results }}"
# # when: result_create_ise_server is defined

# # - name: Assert Cisco ISE server creation
# # assert:
# # that:
# # - item.changed == true
# # - item.response[0].authenticationPolicyServer.Validation == "Success"
# # - "'Created Successfully' in item.response[0].authenticationPolicyServer.msg['172.23.241.229']"
# # loop: "{{ result_create_ise_server.results }}"
# # when: result_create_ise_server is defined

# #############################################
# # UPDATE ISE SERVER #
# #############################################

# - name: Update Cisco ISE server from update_ise_server_details config
# cisco.dnac.ise_radius_integration_workflow_manager:
# <<: *dnac_login
# state: merged
# config:
# - "{{ item }}"
# with_list: "{{ vars_map.update_ise_server_details }}"
# tags: merged
# register: result_update_ise_server

# # - name: Debug item
# # debug:
# # var: item
# # loop: "{{ result_update_ise_server.results }}"
# # when: result_update_ise_server is defined

# - name: Assert Cisco ISE server updation
# assert:
# that:
# - item.changed == true
# - item.response[0].authenticationPolicyServer.Validation == "Success"
# - "'Updated Successfully' in item.response[0].authenticationPolicyServer.msg['172.23.241.229']"
# loop: "{{ result_update_ise_server.results }}"
# when: result_update_ise_server is defined

# # #############################################
# # # DELETE ISE SERVER #
# # #############################################

# # - name: Delete Cisco ISE server from delete_ise_server_details config
# # cisco.dnac.ise_radius_integration_workflow_manager:
# # <<: *dnac_login
# # state: deleted
# # config:
# # - "{{ item }}"
# # register: result_delete_ise_server
# # loop: "{{ vars_map.delete_ise_server_details }}"
# # tags: deleted

# # # - name: Debug item
# # # debug:
# # # var: item
# # # loop: "{{ result_delete_ise_server.results }}"
# # # when: result_delete_ise_server is defined

# # - name: Assert Cisco ISE server deletion
# # assert:
# # that:
# # - item.changed == true
# # - item.response[0].authenticationPolicyServer.Validation == "Success"
# # - "'deleted successfully' in item.response[0].authenticationPolicyServer.msg['172.23.241.229']"
# # loop: "{{ result_delete_ise_server.results }}"
# # when: result_delete_ise_server is defined
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
create_aaa_server_details:
- authentication_policy_server:
- server_type: AAA
server_ip_address: 10.0.0.40
shared_secret: cisco
protocol: RADIUS_TACACS
encryption_scheme: KEYWRAP
encryption_key: 1234123412341234
message_authenticator_code_key: dnacisesolutions1234
authentication_port: 1800
accounting_port: 1700
retries: 3
timeout: 4
role: secondary

update_aaa_server_details:
- authentication_policy_server:
- server_type: AAA
server_ip_address: 10.0.0.40
retries: 2
timeout: 5

delete_aaa_server_details:
- authentication_policy_server:
- server_ip_address: 10.0.0.40
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
create_ise_server_details:
- authentication_policy_server:
- server_type: ISE
server_ip_address: 10.195.243.31
shared_secret: cisco
protocol: RADIUS_TACACS
encryption_scheme: KEYWRAP
encryption_key: dnacsolutions123
message_authenticator_code_key: dnacisesolutions1234
authentication_port: 1800
accounting_port: 1700
retries: 3
timeout: 4
role: primary
pxgrid_enabled: False
use_dnac_cert_for_pxgrid: False
cisco_ise_dtos:
- user_name: admin
password: Lablab123
fqdn: IBSTE-ISE1.cisco.com
ip_address: 10.195.243.31
subscriber_name: ersadmin
description: CISCO ISE
trusted_server: True
ise_integration_wait_time: 30

update_ise_server_details:
- authentication_policy_server:
- server_type: ISE
server_ip_address: 10.195.243.31
retries: 2
timeout: 5
pxgrid_enabled: True
cisco_ise_dtos:
- user_name: admin
password: Lablab123
ip_address: 10.195.243.31
description: CISCO ISE

delete_ise_server_details:
- authentication_policy_server:
- server_ip_address: 10.195.243.31

0 comments on commit 97de41a

Please sign in to comment.