123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- # Copyright 2021 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.
- ---
- # Testcase OMNIA_1.1_IB_TC_007
- # Execute infiniband.yml with both valid Global and valid interface configs in ib_config.yml
- - name: OMNIA_1.1_IB_TC_007
- hosts: infiniband
- gather_facts: false
- tags: VERIFY_OMNIA_01
- connection: local
- vars_files:
- - test_vars/test_infiniband_vars.yml
- - ../roles/webui_awx/vars/main.yml
- - ../input_params/base_vars.yml
- tasks:
- - name: Executing network_ib role
- vars:
- inventory_name: "{{ ib_inventory_name }}"
- host_name: "{{ ib_host_name }}"
- template_name: "{{ template_value }}"
- job_template_name: "{{ job_name }}"
- playbook_path: "{{ ib_playbook_path }}"
- delete_status: true
- include_tasks: "{{ awx_script_path }}"
-
- - block:
- - name: Validate default flow
- assert:
- that:
- - ib_success_msg in job_status.status
- success_msg: "{{ success_message }}"
- fail_msg: "{{ fail_case }}"
- changed_when: false
-
- - name: Backup of ib_vars.yml
- copy:
- src: "{{ ib_vars_dir }}"
- dest: "{{ ib_vars_backup_dir }}"
- mode: "{{ file_perm }}"
- - name: Set MTU of port {{ port_num }}
- lineinfile:
- dest: "{{ ib_vars_dir }}"
- insertbefore: "{{ search_line }}"
- line: "{{ line_to_add }}"
- - name: Execute network_ib role after setting MTU
- vars:
- inventory_name: "{{ ib_inventory_name }}"
- host_name: "{{ ib_host_name }}"
- template_name: "{{ template_value }}"
- job_template_name: "{{ job_name }}"
- playbook_path: "{{ ib_playbook_path }}"
- delete_status: true
- include_tasks: "{{ awx_script_path }}"
- - name: Get MTU of port {{ port_num }}
- command: ansible-playbook -i "{{ inventory_dir }}" "{{ ib_mtu_path }}" --tags 'mtu'
- register: mtuvalue
- changed_when: false
- - block:
- - name: Validate MTU
- assert:
- that:
- - 'var_check in mtuvalue.stdout'
- success_msg: "{{ success_message }}"
- fail_msg: "{{ fail_case }}"
-
- # Testcase OMNIA_1.1_IB_TC_005
- # set save_changes_to_startup to false
- - name: OMNIA_1.1_IB_TC_005
- hosts: infiniband
- gather_facts: false
- tags: TC_005
- connection: local
- vars_files:
- - test_vars/test_infiniband_vars.yml
- - ../roles/webui_awx/vars/main.yml
- - ../input_params/base_vars.yml
- tasks:
- - name: Reload IB switch
- command: ansible-playbook -i "{{ inventory_dir }}" "{{ ib_mtu_path }}" --tags 'reboot'
- changed_when: false
- - name: Pausing for IB switch to come up
- pause:
- minutes: "{{ time_to_pause }}"
-
- - name: Get MTU of port {{ port_num }}
- command: ansible-playbook -i "{{ inventory_dir }}" "{{ ib_mtu_path }}" --tags 'mtu'
- register: mtuvalue
- changed_when: false
-
- - block:
- - name: Validate that MTU is changed
- assert:
- that:
- - 'var_check not in mtuvalue.stdout'
- success_msg: "{{ success_message }}"
- fail_msg: "{{ fail_case }}"
-
- # Testcase OMNIA_1.1_IB_TC_006
- # set save_changes_to_startup to True
- - name: OMNIA_1.1_IB_TC_006
- hosts: infiniband
- gather_facts: false
- tags: TC_006
- connection: local
- vars_files:
- - test_vars/test_infiniband_vars.yml
- - ../roles/webui_awx/vars/main.yml
- - ../input_params/base_vars.yml
- tasks:
- - name: Set save_changes_to_startup to True
- ansible.builtin.replace:
- dest: "{{ ib_vars_dir }}"
- regexp: 'save_changes_to_startup: false'
- replace: 'save_changes_to_startup: True'
-
- - name: Execute network_ib role as port {{ port_num }} has mtu set in ib_Vars
- vars:
- inventory_name: "{{ ib_inventory_name }}"
- host_name: "{{ ib_host_name }}"
- template_name: "{{ template_value }}"
- job_template_name: "{{ job_name }}"
- playbook_path: "{{ ib_playbook_path }}"
- delete_status: true
- include_tasks: "{{ awx_script_path }}"
-
- - name: Reload IB switch
- command: ansible-playbook -i "{{ inventory_dir }}" "{{ ib_mtu_path }}" --tags 'reboot'
- changed_when: false
-
- - name: Pausing for IB switch to come up
- pause:
- minutes: "{{ time_to_pause }}"
-
- - name: Get MTU of port {{ port_num }}
- command: ansible-playbook -i "{{ inventory_dir }}" "{{ ib_mtu_path }}" --tags 'mtu'
- register: mtuvalue
- changed_when: false
-
- - block:
- - name: Validate that MTU is not changed
- assert:
- that:
- - 'var_check in mtuvalue.stdout'
- success_msg: "{{ success_message }}"
- fail_msg: "{{ fail_case }}"
-
- # Testcase OMNIA_1.1_IB_TC_010
- # Execute infiniband.yml with valid interface and incorrect Global configs in ib_config.yml
- - name: OMNIA_1.1_IB_TC_010
- hosts: infiniband
- gather_facts: false
- tags: TC_010
- connection: local
- vars_files:
- - test_vars/test_infiniband_vars.yml
- - ../roles/webui_awx/vars/main.yml
- - ../input_params/base_vars.yml
- tasks:
- - name: Making gobal config incorrect
- lineinfile:
- dest: "{{ ib_vars_dir }}"
- insertafter: 'mellanox_switch_config:'
- line: "gibberish inserted"
-
- - name: Executing network_ib role
- vars:
- inventory_name: "{{ ib_inventory_name }}"
- host_name: "{{ ib_host_name }}"
- template_name: "{{ template_value }}"
- job_template_name: "{{ job_name }}"
- playbook_path: "{{ ib_playbook_path }}"
- delete_status: true
- include_tasks: "{{ awx_script_path }}"
- - block:
- - name: Validate role exec output
- assert:
- that:
- - ib_fail_msg in job_status.status
- success_msg: "{{ success_message }}"
- fail_msg: "{{ fail_case }}"
-
- # Testcase OMNIA_1.1_IB_TC_009
- # Execute infiniband.yml with only interface and no Global configs in ib_config.yml
- - name: OMNIA_1.1_IB_TC_009
- hosts: infiniband
- gather_facts: false
- tags: TC_009
- connection: local
- vars_files:
- - test_vars/test_infiniband_vars.yml
- - ../roles/webui_awx/vars/main.yml
- - ../input_params/base_vars.yml
- tasks:
- - name: Removing global config from ib_vars.yml
- lineinfile:
- dest: "{{ ib_vars_dir }}"
- state: absent
- regexp: "^gibberish inserted"
-
- - name: Executing network_ib role
- vars:
- inventory_name: "{{ ib_inventory_name }}"
- host_name: "{{ ib_host_name }}"
- template_name: "{{ template_value }}"
- job_template_name: "{{ job_name }}"
- playbook_path: "{{ ib_playbook_path }}"
- delete_status: true
- include_tasks: "{{ awx_script_path }}"
- - name: Validate role exec output
- assert:
- that:
- - ib_success_msg in job_status.status
- success_msg: "{{ success_message }}"
- fail_msg: "{{ fail_case }}"
- changed_when: false
-
- # Testcase OMNIA_1.1_IB_TC_011
- # Execute infiniband.yml with valid Global and incorrect interface configs in ib_config.yml
- - name: OMNIA_1.1_IB_TC_011
- hosts: infiniband
- gather_facts: false
- tags: TC_011
- connection: local
- vars_files:
- - test_vars/test_infiniband_vars.yml
- - ../roles/webui_awx/vars/main.yml
- - ../input_params/base_vars.yml
- tasks:
- - name: Make interface config incorrect
- lineinfile:
- dest: "{{ ib_vars_dir }}"
- insertafter: "{{ line_to_search }}"
- line: "gibberish inserted"
-
- - name: Executing network_ib role
- vars:
- inventory_name: "{{ ib_inventory_name }}"
- host_name: "{{ ib_host_name }}"
- template_name: "{{ template_value }}"
- job_template_name: "{{ job_name }}"
- playbook_path: "{{ ib_playbook_path }}"
- delete_status: true
- include_tasks: "{{ awx_script_path }}"
-
- - name: Validate role exec output
- assert:
- that:
- - ib_fail_msg in job_status.status
- success_msg: "{{ success_message }}"
- fail_msg: "{{ fail_case }}"
-
- # Testcase OMNIA_1.1_IB_TC_008
- # Execute infiniband.yml with only Global and no interface configs in ib_config.yml
- - name: OMNIA_1.1_IB_TC_008
- hosts: infiniband
- gather_facts: false
- tags: TC_008
- connection: local
- vars_files:
- - test_vars/test_infiniband_vars.yml
- - ../roles/webui_awx/vars/main.yml
- - ../input_params/base_vars.yml
- tasks:
- - name: Removing interface config
- ansible.builtin.command: sed -i '49,196d' "{{ ib_vars_dir }}"
- args:
- warn: no
- changed_when: false
-
- - name: Executing network_ib role
- vars:
- inventory_name: "{{ ib_inventory_name }}"
- host_name: "{{ ib_host_name }}"
- template_name: "{{ template_value }}"
- job_template_name: "{{ job_name }}"
- playbook_path: "{{ ib_playbook_path }}"
- delete_status: true
- include_tasks: "{{ awx_script_path }}"
- - name: Validate role exec output
- assert:
- that:
- - ib_success_msg in job_status.status
- success_msg: "{{ success_message }}"
- fail_msg: "{{ fail_case }}"
- changed_when: false
- - name: Restore orginal ib_vars file
- copy:
- src: "{{ ib_vars_backup_dir }}"
- dest: "{{ ib_vars_dir }}"
- mode: "{{ file_perm }}"
-
- - name: Set save_changes_to_startup to True
- ansible.builtin.replace:
- dest: "{{ ib_vars_dir }}"
- regexp: 'save_changes_to_startup: false'
- replace: 'save_changes_to_startup: True'
-
- - name: Execute network_ib role to set default IB config as is
- vars:
- inventory_name: "{{ ib_inventory_name }}"
- host_name: "{{ ib_host_name }}"
- template_name: "{{ template_value }}"
- job_template_name: "{{ job_name }}"
- playbook_path: "{{ ib_playbook_path }}"
- delete_status: true
- include_tasks: "{{ awx_script_path }}"
-
- - name: Set save_changes_to_startup back to false
- ansible.builtin.replace:
- dest: "{{ ib_vars_dir }}"
- regexp: 'save_changes_to_startup: True'
- replace: 'save_changes_to_startup: false'
|