123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709 |
- # Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
- #
- # Licensed under the Apache License, Version 2.0 (the "License");
- # you may not use this file except in compliance with the License.
- # You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- ---
- # Testase OMNIA_1.1_MS_TC_001
- # Test Case to validate the execution of control_plane.yml with valid inputs -- Default Test Case
- - name: OMNIA_1.1_MS_TC_001
- hosts: localhost
- connection: local
- vars_files:
- - ../roles/control_plane_common/vars/main.yml
- - test_vars/test_control_plane_vars.yml
-
- gather_subset:
- - 'min'
- tags: VERIFY_OMNIA_01
-
- tasks:
- - name: Check OS Version
- assert:
- that:
- - 'ansible_distribution == "{{ os_name }}"'
- - 'ansible_distribution_version == "{{ os_version }}"'
- success_msg: "{{ check_os_success_msg }}"
- fail_msg: "{{ check_os_fail_msg }}"
- tags: Check_OS
-
- - name: Replace input parameters folder
- copy:
- src: "{{ item }}"
- dest: "{{ input_params_folder }}"
- force: yes
- mode: '0644'
- with_items:
- - "{{ input_files_tc01 }}"
- tags: Replace_input
-
- - block:
- - name: Execute control_plane.yml playbook
- command: ansible-playbook control_plane.yml
- args:
- chdir: "{{ control_plane_dir }}"
- tags: Execute_control_plane
-
- - block:
- - name: Execute default validation script
- include_tasks: "{{ control_plane_validation_script_path }}"
- tags: Execute_Validation_Script
- # Testcase OMNIA_1.1_MS_TC_002
- # Test Case to validate the execution of control_place.yml with no input
- - name: OMNIA_1.1_MS_TC_002
- hosts: localhost
- connection: local
- vars_files:
- - ../roles/control_plane_common/vars/main.yml
- - test_vars/test_control_plane_vars.yml
-
- gather_subset:
- - 'min'
- tags: TC_002
- tasks:
- - name: Check OS Version
- assert:
- that:
- - 'ansible_distribution == "{{ os_name }}"'
- - 'ansible_distribution_version == "{{ os_version }}"'
- success_msg: "{{ check_os_success_msg }}"
- fail_msg: "{{ check_os_fail_msg }}"
- tags: Check_OS
-
- - name: Replace input parameters folder
- copy:
- src: "{{ item }}"
- dest: "{{ input_params_folder }}"
- force: yes
- mode: '0644'
- with_items:
- - "{{ input_files_tc02 }}"
- tags: Replace_input
-
- - block:
- - name: Execute control_plane_common role
- include_role:
- name: ../roles/control_plane_common
- vars:
- base_vars_filename: ../input_params/base_vars.yml
- rescue:
- - name: Validate error
- assert:
- that: input_base_failure_msg in ansible_failed_result.msg
- success_msg: "{{ input_config_check_success_msg }}"
- fail_msg: "{{ input_config_check_fail_msg }}"
- tags: Execute_common_role
-
- # Testcase OMNIA_1.1_MS_TC_003 and OMNIA_1.1_MS_TC_004
- # Test Case to validate the execution of control_plane.yml with NFS share already present
- - name: OMNIA_1.1_MS_TC_003
- hosts: localhost
- connection: local
- vars_files:
- - ../roles/control_plane_common/vars/main.yml
- - test_vars/test_control_plane_vars.yml
-
- gather_subset:
- - 'min'
- tags: TC_003,TC_004
-
- tasks:
- - name: Check OS Version
- assert:
- that:
- - 'ansible_distribution == "{{ os_name }}"'
- - 'ansible_distribution_version == "{{ os_version }}"'
- success_msg: "{{ check_os_success_msg }}"
- fail_msg: "{{ check_os_fail_msg }}"
- tags: Check_OS
-
- - name: Replace input parameters folder
- copy:
- src: "{{ item }}"
- dest: "{{ input_params_folder }}"
- force: yes
- mode: '0644'
- with_items:
- - "{{ input_files_tc01 }}"
- tags: Replace_input
-
- - name: Creating new control_plane.yml
- copy:
- dest: "../test_control_plane.yml"
- content: |
- - name: Executing omnia roles
- hosts: localhost
- connection: local
- roles:
- - control_plane_common
- - control_plane_repo
- mode: '0644'
- tags: Replace_control_plane
-
- - block:
- - name: Execute control_plane.yml playbook
- command: ansible-playbook test_control_plane.yml
- args:
- chdir: "{{ control_plane_dir }}"
- tags: Execute_control_plane
-
- - block:
- - name: Execute validation script
- include_tasks: "{{ control_plane_validation_script_path }}"
- tags: Execute_Validation_Script
-
- - name: Delete newly created control_plane.yml
- file:
- state: absent
- path: ../test_control_plane.yml
- when: foo_stat.stat.exists
- tags: Delete_test_control_plane
- # Testcase OMNIA_1.1_MS_TC_005
- # Test Case to validate the execution of control_plane.yml after a successful run and validate k8s pods along with services after reboot.
- - name: OMNIA_1.1_MS_TC_005
- hosts: localhost
- connection: local
- vars_files:
- - ../roles/control_plane_common/vars/main.yml
- - test_vars/test_control_plane_vars.yml
-
- gather_subset:
- - 'min'
- tags: TC_005
-
- tasks:
- - name: Check OS Version
- assert:
- that:
- - 'ansible_distribution == "{{ os_name }}"'
- - 'ansible_distribution_version == "{{ os_version }}"'
- success_msg: "{{ check_os_success_msg }}"
- fail_msg: "{{ check_os_fail_msg }}"
- tags: Check_OS
-
- - name: Check uptime
- command: uptime -p
- register: system_uptime
- changed_when: false
- tags: Check_Uptime
-
- - name: Extracting data from system_uptime
- set_fact:
- uptime_number: "{{ system_uptime.stdout.split()[1] }}"
- uptime_min: "{{ system_uptime.stdout.split()[2] }}"
-
- - name: Replace input parameters folder
- copy:
- src: "{{ item }}"
- dest: "{{ input_params_folder }}"
- force: yes
- mode: '0644'
- with_items:
- - "{{ input_files_tc01 }}"
- when: uptime_number|int > 15
- tags: Replace_input
-
- - block:
- - name: Execute control_plane.yml playbook
- command: ansible-playbook control_plane.yml
- args:
- chdir: "{{ control_plane_dir }}"
- when: uptime_number|int > 15
- tags: Execute_control_plane
-
- - name: Reboot system
- command: reboot
- when: uptime_number|int > 15
- tags: Reboot_System
-
- - block:
- - name: Wait for 30sec for kubectl to get things ready
- pause:
- seconds: 200
- when: (uptime_number| int <= 15) and (uptime_min == "minutes")
- - name: Execute default validation script
- include_tasks: "{{ control_plane_validation_script_path }}"
- when: (uptime_number| int <= 15) and (uptime_min == "minutes")
- tags: Execute_Validation_Script
- # Testcase OMNIA_1.1_MS_TC_006 and OMNIA_1.1_MS_TC_007
- # Test Case to validate the execution of control_plane.yml and after a successful run the user deletes/stops all pods
- - name: OMNIA_1.1_MS_TC_006
- hosts: localhost
- connection: local
- vars_files:
- - ../roles/control_plane_common/vars/main.yml
- - test_vars/test_control_plane_vars.yml
-
- gather_subset:
- - 'min'
- tags: TC_006,TC_007
-
- tasks:
- - name: Check OS Version
- assert:
- that:
- - 'ansible_distribution == "{{ os_name }}"'
- - 'ansible_distribution_version == "{{ os_version }}"'
- success_msg: "{{ check_os_success_msg }}"
- fail_msg: "{{ check_os_fail_msg }}"
- tags: Check_OS
-
- - name: Replace input parameters folder
- copy:
- src: "{{ item }}"
- dest: "{{ input_params_folder }}"
- force: yes
- mode: "0644"
- with_items:
- - "{{ input_files_tc01 }}"
- tags: Replace_input
-
- - block:
- - name: Execute control_plane.yml playbook
- command: ansible-playbook control_plane.yml
- args:
- chdir: "{{ control_plane_dir }}"
- tags: Execute_control_plane
-
- - name: Delete all containers
- command: kubectl delete --all namespaces
- changed_when: false
- tags: Delete_Pods
-
- - block:
- - name: Execute control_plane.yml playbook
- command: ansible-playbook control_plane.yml
- args:
- chdir: "{{ control_plane_dir }}"
- tags: Execute_control_plane
-
- - block:
- - name: Execute default validation script
- include_tasks: "{{ control_plane_validation_script_path }}"
- tags: Execute_Validation_Script
- # Testcase OMNIA_1.1_MS_TC_008
- # Test Case to validate the execution of control_plane.yml with infiniband=false, powervault=true and ethernet=true
- - name: OMNIA_1.1_MS_TC_008
- hosts: localhost
- connection: local
- vars_files:
- - ../roles/control_plane_common/vars/main.yml
- - test_vars/test_control_plane_vars.yml
-
- gather_subset:
- - 'min'
- tags: TC_008
-
- tasks:
- - name: Check OS Version
- assert:
- that:
- - 'ansible_distribution == "{{ os_name }}"'
- - 'ansible_distribution_version == "{{ os_version }}"'
- success_msg: "{{ check_os_success_msg }}"
- fail_msg: "{{ check_os_fail_msg }}"
- tags: Check_OS
-
- - name: Replace input parameters folder
- copy:
- src: "{{ item }}"
- dest: "{{ input_params_folder }}"
- force: yes
- mode: '0644'
- with_items:
- - "{{ input_files_tc01 }}"
- tags: Replace_input
-
- - name: Editing base_vars.yml for powervault to true
- replace:
- path: ../input_params/base_vars.yml
- regexp: "{{ powervault_false }}"
- replace: "{{ powervault_true }}"
- tags: Edit_base_vars
-
- - name: Editing base_vars.yml for ethernet to true
- replace:
- path: ../input_params/base_vars.yml
- regexp: "{{ ethernet_false }}"
- replace: "{{ ethernet_true }}"
- tags: Edit_base_vars
-
- - name: Editing base_vars.yml for infiniband to false
- replace:
- path: ../input_params/base_vars.yml
- regexp: "{{ infiniband_true }}"
- replace: "{{ infiniband_false }}"
- tags: Edit_base_vars
-
- - block:
- - name: Execute control_plane.yml playbook
- command: ansible-playbook control_plane.yml
- args:
- chdir: "{{ control_plane_dir }}"
- tags: Execute_control_plane
-
- - block:
- - name: Execute default validation script
- include_tasks: "{{ control_plane_validation_script_path }}"
- tags: Execute_Validation_Script
- # Testcase OMNIA_1.1_MS_TC_009
- # Test Case to validate the execution of control_plane.yml with infiniband=true, powervault=false and ethernet=true
- - name: OMNIA_1.1_MS_TC_009
- hosts: localhost
- connection: local
- vars_files:
- - ../roles/control_plane_common/vars/main.yml
- - test_vars/test_control_plane_vars.yml
-
- gather_subset:
- - 'min'
- tags: TC_009
-
- tasks:
- - name: Check OS Version
- assert:
- that:
- - 'ansible_distribution == "{{ os_name }}"'
- - 'ansible_distribution_version == "{{ os_version }}"'
- success_msg: "{{ check_os_success_msg }}"
- fail_msg: "{{ check_os_fail_msg }}"
- tags: Check_OS
-
- - name: Replace input parameters folder
- copy:
- src: "{{ item }}"
- dest: "{{ input_params_folder }}"
- force: yes
- mode: '0644'
- with_items:
- - "{{ input_files_tc01 }}"
- tags: Replace_input
-
- - name: Editing base_vars.yml for powervault to false
- replace:
- path: ../input_params/base_vars.yml
- regexp: "{{ powervault_true }}"
- replace: "{{ powervault_false }}"
- tags: Edit_base_vars
-
- - name: Editing base_vars.yml for ethernet to true
- replace:
- path: ../input_params/base_vars.yml
- regexp: "{{ ethernet_false }}"
- replace: "{{ ethernet_true }}"
- tags: Edit_base_vars
-
- - name: Editing base_vars.yml for infiniband to true
- replace:
- path: ../input_params/base_vars.yml
- regexp: "{{ infiniband_false }}"
- replace: "{{ infiniband_true }}"
- tags: Edit_base_vars
-
- - block:
- - name: Execute control_plane.yml playbook
- command: ansible-playbook control_plane.yml
- args:
- chdir: "{{ control_plane_dir }}"
- tags: Execute_control_plane
-
- - block:
- - name: Execute default validation script
- include_tasks: "{{ control_plane_validation_script_path }}"
- tags: Execute_Validation_Script
- # Testcase OMNIA_1.1_MS_TC_010
- # Test Case to validate the execution of control_plane.yml with infiniband=true, powervault=true and ethernet=false
- - name: OMNIA_1.1_MS_TC_010
- hosts: localhost
- connection: local
- vars_files:
- - ../roles/control_plane_common/vars/main.yml
- - test_vars/test_control_plane_vars.yml
-
- gather_subset:
- - 'min'
- tags: TC_010
- tasks:
- - name: Check OS Version
- assert:
- that:
- - 'ansible_distribution == "{{ os_name }}"'
- - 'ansible_distribution_version == "{{ os_version }}"'
- success_msg: "{{ check_os_success_msg }}"
- fail_msg: "{{ check_os_fail_msg }}"
- tags: Check_OS
-
- - name: Replace input parameters folder
- copy:
- src: "{{ item }}"
- dest: "{{ input_params_folder }}"
- force: yes
- mode: '0644'
- with_items:
- - "{{ input_files_tc01 }}"
- tags: Replace_input
-
- - name: Editing base_vars.yml for powervault to true
- replace:
- path: ../input_params/base_vars.yml
- regexp: "{{ powervault_false }}"
- replace: "{{ powervault_true }}"
- tags: Edit_base_vars
-
- - name: Editing base_vars.yml for ethernet to false
- replace:
- path: ../input_params/base_vars.yml
- regexp: "{{ ethernet_true }}"
- replace: "{{ ethernet_false }}"
- tags: Edit_base_vars
-
- - name: Editing base_vars.yml for infiniband to true
- replace:
- path: ../input_params/base_vars.yml
- regexp: "{{ infiniband_false }}"
- replace: "{{ infiniband_true }}"
- tags: Edit_base_vars
-
- - block:
- - name: Execute control_plane.yml playbook
- command: ansible-playbook control_plane.yml
- args:
- chdir: "{{ control_plane_dir }}"
- tags: Execute_control_plane
-
- - block:
- - name: Execute default validation script
- include_tasks: "{{ control_plane_validation_script_path }}"
- tags: Execute_Validation_Script
- # Testcase OMNIA_1.1_MS_TC_011
- # Test Case to validate the execution of control_plane.yml with firmware update set to False
- - name: OMNIA_1.1_MS_TC_011
- hosts: localhost
- connection: local
- vars_files:
- - ../roles/control_plane_common/vars/main.yml
- - test_vars/test_control_plane_vars.yml
-
- gather_subset:
- - 'min'
- tags: TC_011
-
- tasks:
- - name: Check OS Version
- assert:
- that:
- - 'ansible_distribution == "{{ os_name }}"'
- - 'ansible_distribution_version == "{{ os_version }}"'
- success_msg: "{{ check_os_success_msg }}"
- fail_msg: "{{ check_os_fail_msg }}"
- tags: Check_OS
-
- - name: Set firmware update to false
- replace:
- path: ../input_params/idrac_vars.yml
- regexp: "{{ fw_update_true }}"
- replace: "{{ fw_update_false }}"
- tags: Set_FW_Update
-
- - name: Replace input parameters folder
- copy:
- src: "{{ item }}"
- dest: "{{ input_params_folder }}"
- force: yes
- mode: '0644'
- with_items:
- - "{{ input_files_tc01 }}"
- tags: Replace_input
-
- - block:
- - name: Execute control_plane.yml playbook
- command: ansible-playbook control_plane.yml
- args:
- chdir: "{{ control_plane_dir }}"
- tags: Execute_control_plane
-
- - block:
- - name: Execute default validation script
- include_tasks: "{{ control_plane_validation_script_path }}"
- tags: Execute_Validation_Script
-
- - name: Check if firmware updates folder exists
- stat:
- path: /var/nfs_repo/dellupdates
- register: fw_update_dir
- tags: Set_FW_Update
-
- - name: Verify firmware updates were downloaded
- assert:
- that:
- - not fw_update_dir.stat.exists
- success_msg: "{{ fw_success_validation }}"
- fail_msg: "{{ fw_fail_validation }}"
- tags: Set_FW_Update
-
- # Testcase OMNIA_1.1_MS_TC_012
- # Test Case to validate the execution of control_plane.yml with firmware update set to true
- - name: OMNIA_1.1_MS_TC_012
- hosts: localhost
- connection: local
- vars_files:
- - ../roles/control_plane_common/vars/main.yml
- - test_vars/test_control_plane_vars.yml
-
- gather_subset:
- - 'min'
- tags: TC_012
-
- tasks:
- - name: Check OS Version
- assert:
- that:
- - 'ansible_distribution == "{{ os_name }}"'
- - 'ansible_distribution_version == "{{ os_version }}"'
- success_msg: "{{ check_os_success_msg }}"
- fail_msg: "{{ check_os_fail_msg }}"
- tags: Check_OS
-
- - name: Set firmware update to true
- replace:
- path: ../input_params/idrac_vars.yml
- regexp: "{{ fw_update_false }}"
- replace: "{{ fw_update_true }}"
- tags: Set_FW_Update
-
- - name: Replace input parameters folder
- copy:
- src: "{{ item }}"
- dest: "{{ input_params_folder }}"
- force: yes
- mode: '0644'
- with_items:
- - "{{ input_files_tc01 }}"
- tags: Replace_input
-
- - block:
- - name: Execute control_plane.yml playbook
- command: ansible-playbook control_plane.yml
- args:
- chdir: "{{ control_plane_dir }}"
- tags: Execute_control_plane
-
- - block:
- - name: Execute default validation script
- include_tasks: "{{ control_plane_validation_script_path }}"
- tags: Execute_Validation_Script
-
- - name: Check if firmware updates folder exists
- stat:
- path: /var/nfs_repo/dellupdates
- register: fw_update_dir
- tags: Set_FW_Update
-
- - name: Verify firmware updates were downloaded
- assert:
- that:
- - fw_update_dir.stat.exists
- success_msg: "{{ fw_success_validation }}"
- fail_msg: "{{ fw_fail_validation }}"
- tags: Set_FW_Update
- # Testcase OMNIA_1.1_MS_TC_013
- # Test Case to validate the execution of control_plane.yml with docker login credential
- - name: OMNIA_1.1_MS_TC_013
- hosts: localhost
- connection: local
- vars_files:
- - ../roles/control_plane_common/vars/main.yml
- - test_vars/test_control_plane_vars.yml
-
- gather_subset:
- - 'min'
- tags: TC_013
-
- tasks:
- - name: Check OS Version
- assert:
- that:
- - 'ansible_distribution == "{{ os_name }}"'
- - 'ansible_distribution_version == "{{ os_version }}"'
- success_msg: "{{ check_os_success_msg }}"
- fail_msg: "{{ check_os_fail_msg }}"
- tags: Check_OS
-
- - name: Replace input parameters folder
- copy:
- src: "{{ item }}"
- dest: "{{ input_params_folder }}"
- force: yes
- mode: '0644'
- with_items:
- - "{{ input_files_tc01 }}"
- tags: Replace_input
-
- - name: Change docker params in omnia_config.yml
- replace:
- path: ../../omnia_config.yml
- regexp: "docker_username: .*$"
- replace: 'docker_username: "{{ docker_user }}"'
- tags: Set_Docker_Creds
-
- - name: Assert if the credentials are valid in test_control_plane_vars.yml
- assert:
- that:
- - 'docker_user != "User"'
- - 'docker_password != "Password"'
- success_msg: "{{ valid_docker_creds }}"
- fail_msg: "{{ invalid_docker_creds }}"
- tags: Set_Docker_Creds
-
- - name: Change docker params in omnia_config.yml
- replace:
- path: ../../omnia_config.yml
- regexp: "docker_password: .*$"
- replace: 'docker_password: "{{ docker_password }}"'
- tags: Set_Docker_Creds
-
- - block:
- - name: Execute control_plane.yml playbook
- command: ansible-playbook control_plane.yml
- args:
- chdir: "{{ control_plane_dir }}"
- tags: Execute_control_plane
-
- - block:
- - name: Execute default validation script
- include_tasks: "{{ control_plane_validation_script_path }}"
- tags: Execute_Validation_Script
-
- - name: Fetch docker info
- shell: docker login & sleep 3
- register: new
- changed_when: false
- tags: Set_Docker_Creds
- - name: Assert that docker was used to pull images
- assert:
- that:
- - "'Login did not succeed' in new.stderr"
- success_msg: "{{ docker_success_validation }}"
- fail_msg: "{{ docker_fail_validation }}"
- tags: Set_Docker_Creds
|