123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- # 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.
- ---
- # Testcase OMNIA_DIO_US_CDIP_TC_001
- # Execute provison role in management station with os installed centos 7
- - name: OMNIA_DIO_US_CDIP_TC_001
- hosts: localhost
- connection: local
- vars_files:
- - test_vars/test_provision_vars.yml
- - ../roles/provision/vars/main.yml
- tasks:
- - name: Delete the cobbler container if exits
- docker_container:
- name: "{{ docker_container_name }}"
- state: absent
- tags: TC_001
- - name: Delete docker image if exists
- docker_image:
- name: "{{ docker_image_name }}"
- tag: "{{ docker_image_tag }}"
- state: absent
- tags: TC_001
- - block:
- - name: Call common role
- include_role:
- name: ../roles/common
- vars:
- input_config_filename: "{{ test_input_config_filename }}"
- - name: Call provision role
- include_role:
- name: ../roles/provision
- tasks_from: "{{ item }}"
- with_items:
- - "{{ cobbler_image_files }}"
- tags: TC_001
- - name: Inspect cobbler docker image
- docker_image_info:
- name: "{{ docker_image_name }}"
- register: cobbler_image_status
- tags: TC_001,VERIFY_001
- - name: Validate cobbler docker image
- assert:
- that:
- - cobbler_image_status.images
- fail_msg: "{{ cobbler_img_fail_msg }}"
- success_msg: "{{ cobbler_img_success_msg }}"
- tags: TC_001,VERIFY_001
- - name: Inspect cobbler container
- docker_container_info:
- name: "{{ docker_container_name }}"
- register: cobbler_cnt_status
- tags: TC_001,VERIFY_001
- - name: Validate cobbler docker container
- assert:
- that:
- - cobbler_cnt_status.exists
- fail_msg: "{{ cobbler_cnt_fail_msg }}"
- success_msg: "{{ cobbler_cnt_success_msg }}"
- tags: TC_001,VERIFY_001
- - name: Validate first NIC is not assigned to public internet
- shell: |
- set -o pipefail
- ip route get 8.8.8.8 | awk '{print $5}'
- register: nic_output
- args:
- executable: /bin/bash
- failed_when: first_nic in nic_output.stdout
- changed_when: false
- tags: TC_001,VERIFY_001
- - name: "Validate NIC-1 is assigned to IP {{ nic1_ip_address }}"
- assert:
- that: "'{{ nic1_ip_address }}' in ansible_em1.ipv4.address"
- fail_msg: "{{ nic_check_fail_msg }}"
- success_msg: "{{ nic_check_success_msg }}"
- tags: TC_001,VERIFY_001
- # Testcase OMNIA_DIO_US_CDIP_TC_002
- # Execute provison role in management station where cobbler container and image already created
- - name: OMNIA_DIO_US_CDIP_TC_002
- hosts: localhost
- connection: local
- vars_files:
- - test_vars/test_provision_vars.yml
- - ../roles/provision/vars/main.yml
- tasks:
- - block:
- - name: Call common role
- include_role:
- name: ../roles/common
- vars:
- input_config_filename: "{{ test_input_config_filename }}"
- - name: Call provision role
- include_role:
- name: ../roles/provision
- tags: TC_002
- - name: Inspect cobbler docker image
- docker_image_info:
- name: "{{ docker_image_name }}"
- register: cobbler_image_status
- tags: TC_002,VERIFY_002
- - name: Validate cobbler docker image
- assert:
- that:
- - cobbler_image_status.images
- fail_msg: "{{ cobbler_img_fail_msg }}"
- success_msg: "{{ cobbler_img_success_msg }}"
- tags: TC_002,VERIFY_002
- - name: Inspect cobbler container
- docker_container_info:
- name: "{{ docker_container_name }}"
- register: cobbler_cnt_status
- tags: TC_002,VERIFY_002
- - name: Validate cobbler docker container
- assert:
- that:
- - cobbler_cnt_status.exists
- fail_msg: "{{ cobbler_cnt_fail_msg }}"
- success_msg: "{{ cobbler_cnt_success_msg }}"
- tags: TC_002,VERIFY_002
- - name: Validate first NIC is not assigned to public internet
- shell: |
- set -o pipefail
- ip route get 8.8.8.8 | awk '{print $5}'
- register: nic_output
- args:
- executable: /bin/bash
- failed_when: first_nic in nic_output.stdout
- changed_when: false
- tags: TC_002,VERIFY_002
- - name: "Validate NIC-1 is assigned to IP {{ nic1_ip_address }}"
- assert:
- that: "'{{ nic1_ip_address }}' in ansible_em1.ipv4.address"
- fail_msg: "{{ nic_check_fail_msg }}"
- success_msg: "{{ nic_check_success_msg }}"
- tags: TC_002,VERIFY_002
- # Testcase OMNIA_DIO_US_CDIP_TC_003
- # Execute provison role in management station where docker service not running
- - name: OMNIA_DIO_US_CDIP_TC_003
- hosts: localhost
- connection: local
- vars_files:
- - test_vars/test_provision_vars.yml
- - ../roles/provision/vars/main.yml
- tasks:
- - name: Delete the cobbler container if exits
- docker_container:
- name: "{{ docker_container_name }}"
- state: absent
- tags: TC_003
- - name: Delete docker image if exists
- docker_image:
- name: "{{ docker_image_name }}"
- tag: "{{ docker_image_tag }}"
- state: absent
- tags: TC_003
- - name: Stop docker service
- service:
- name: docker
- state: stopped
- tags: TC_003
- - block:
- - name: Call common role
- include_role:
- name: ../roles/common
- vars:
- input_config_filename: "{{ test_input_config_filename }}"
- - name: Call provision role
- include_role:
- name: ../roles/provision
- - name: Docker service stopped usecase success message
- debug:
- msg: "{{ docker_check_success_msg }}"
- rescue:
- - name: Docker service stopped usecase fail message
- fail:
- msg: "{{ docker_check_fail_msg }}"
- always:
- - name: Start docker service
- service:
- name: docker
- state: started
- tags: TC_003
|