From 96da6b6fb2b7dbc58c840234dd05a804d3faf96c Mon Sep 17 00:00:00 2001 From: MUTHU-RAKESH-27 <19cs127@psgitech.ac.in> Date: Wed, 18 Dec 2024 07:36:12 +0530 Subject: [PATCH] Integration test cases for ISE integration workflow manager module --- .../defaults/main.yml | 2 + .../ccc_aaa_server_management/meta/main.yml | 1 + .../ccc_aaa_server_management/tasks/main.yml | 34 ++++ .../tests/test_aaa_server.yml | 149 ++++++++++++++++++ .../tests/test_ise_server.yml | 129 +++++++++++++++ .../vars/vars_aaa_server.yml | 26 +++ .../vars/vars_ise_server.yml | 43 +++++ 7 files changed, 384 insertions(+) create mode 100644 tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/defaults/main.yml create mode 100644 tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/meta/main.yml create mode 100644 tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/tasks/main.yml create mode 100644 tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/tests/test_aaa_server.yml create mode 100644 tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/tests/test_ise_server.yml create mode 100644 tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/vars/vars_aaa_server.yml create mode 100644 tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/vars/vars_ise_server.yml diff --git a/tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/defaults/main.yml b/tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/defaults/main.yml new file mode 100644 index 0000000000..55a93fc23d --- /dev/null +++ b/tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/defaults/main.yml @@ -0,0 +1,2 @@ +--- +testcase: "*" \ No newline at end of file diff --git a/tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/meta/main.yml b/tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/meta/main.yml new file mode 100644 index 0000000000..5514b6a40c --- /dev/null +++ b/tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/meta/main.yml @@ -0,0 +1 @@ +dependencies: [] \ No newline at end of file diff --git a/tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/tasks/main.yml b/tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/tasks/main.yml new file mode 100644 index 0000000000..09e0832ca2 --- /dev/null +++ b/tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/tasks/main.yml @@ -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 \ No newline at end of file diff --git a/tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/tests/test_aaa_server.yml b/tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/tests/test_aaa_server.yml new file mode 100644 index 0000000000..d5fc522eb3 --- /dev/null +++ b/tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/tests/test_aaa_server.yml @@ -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 diff --git a/tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/tests/test_ise_server.yml b/tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/tests/test_ise_server.yml new file mode 100644 index 0000000000..927e1a6147 --- /dev/null +++ b/tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/tests/test_ise_server.yml @@ -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 diff --git a/tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/vars/vars_aaa_server.yml b/tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/vars/vars_aaa_server.yml new file mode 100644 index 0000000000..6a382a15e9 --- /dev/null +++ b/tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/vars/vars_aaa_server.yml @@ -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 diff --git a/tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/vars/vars_ise_server.yml b/tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/vars/vars_ise_server.yml new file mode 100644 index 0000000000..543933e19f --- /dev/null +++ b/tests/integration/ccc_aaa_server_management/ccc_aaa_server_management/vars/vars_ise_server.yml @@ -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