123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609 |
- # 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_CC_TC_004
- # Execute provision role in management station and verify cobbler configuration
- - name: OMNIA_DIO_US_CC_TC_004
- hosts: localhost
- connection: local
- vars_files:
- - test_vars/test_provision_vars.yml
- - ../roles/provision/vars/main.yml
- - "{{ test_input_config_filename }}"
- tasks:
- - name: Check the iso file is present
- stat:
- path: "{{ iso_file_path }}"
- register: iso_status
- tags: TC_004
- - name: Fail if iso file is missing
- fail:
- msg: "{{ iso_fail }}"
- when: iso_status.stat.exists == false
- tags: TC_004
- - name: Delete the cobbler container if exits
- docker_container:
- name: "{{ docker_container_name }}"
- state: absent
- tags: TC_004
- - name: Delete docker image if exists
- docker_image:
- name: "{{ docker_image_name }}"
- tag: "{{ docker_image_tag }}"
- state: absent
- tags: TC_004
- - 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_004
- - name: Check the connection to cobbler UI and it returns a status 200
- uri:
- url: https://localhost/cobbler_web
- status_code: 200
- return_content: yes
- validate_certs: no
- tags: TC_004,VERIFY_004
- - name: Fetch cobbler version in cobbler container
- command: docker exec {{ docker_container_name }} cobbler version
- changed_when: false
- register: cobbler_version
- tags: TC_004,VERIFY_004
- - name: Verify cobbler version
- assert:
- that:
- - "'Cobbler' in cobbler_version.stdout"
- - "'Error' not in cobbler_version.stdout"
- fail_msg: "{{ cobbler_version_fail_msg }}"
- success_msg: "{{ cobbler_version_success_msg }}"
- tags: TC_004,VERIFY_004
- - name: Run cobbler check command in cobbler container
- command: docker exec {{ docker_container_name }} cobbler check
- changed_when: false
- register: cobbler_check
- tags: TC_004,VERIFY_004
- - name: Verify cobbler check command output
- assert:
- that:
- - "'The following are potential configuration items that you may want to fix' not in cobbler_check.stdout"
- - "'Error' not in cobbler_check.stdout"
- fail_msg: "{{ cobbler_check_fail_msg }}"
- success_msg: "{{ cobbler_check_success_msg }}"
- ignore_errors: yes
- tags: TC_004,VERIFY_004
- - name: Run cobbler sync command in cobbler container
- command: docker exec {{ docker_container_name }} cobbler sync
- changed_when: false
- register: cobbler_sync
- tags: TC_004,VERIFY_004
- - name: Verify cobbler sync command output
- assert:
- that:
- - "'TASK COMPLETE' in cobbler_sync.stdout"
- - "'Fail' not in cobbler_sync.stdout"
- - "'Error' not in cobbler_sync.stdout"
- fail_msg: "{{ cobbler_sync_fail_msg }}"
- success_msg: "{{ cobbler_sync_success_msg }}"
- tags: TC_004,VERIFY_004
- - name: Fetch cobbler distro list
- command: docker exec {{ docker_container_name }} cobbler distro list
- changed_when: false
- register: cobbler_distro_list
- tags: TC_004,VERIFY_004
- - name: Verify cobbler distro list
- assert:
- that:
- - "'CentOS' in cobbler_distro_list.stdout"
- fail_msg: "{{ cobbler_distro_list_fail_msg }}"
- success_msg: "{{ cobbler_distro_list_success_msg }}"
- tags: TC_004,VERIFY_004
- - name: Fetch cobbler profile list
- command: docker exec cobbler cobbler profile list
- changed_when: false
- register: cobbler_profile_list
- tags: TC_004,VERIFY_004
- - name: Verify cobbler profile list
- assert:
- that:
- - "'CentOS' in cobbler_profile_list.stdout"
- fail_msg: "{{ cobbler_profile_list_fail_msg }}"
- success_msg: "{{ cobbler_profile_list_success_msg }}"
- tags: TC_004,VERIFY_004
- - name: Check kickstart file
- shell: |
- docker exec {{ docker_container_name }} [ -f /var/lib/cobbler/kickstarts/{{ kickstart_filename }} ] && echo "File exist" || echo "File does not exist"
- changed_when: false
- register: kickstart_file_status
- tags: TC_004,VERIFY_004
- - name: Verify kickstart file present
- assert:
- that:
- - "'File exist' in kickstart_file_status.stdout"
- fail_msg: "{{ kickstart_file_fail_msg }}"
- success_msg: "{{ kickstart_file_success_msg }}"
- tags: TC_004,VERIFY_004
- - name: Check crontab list
- command: docker exec cobbler crontab -l
- changed_when: false
- register: crontab_list
- tags: TC_004,VERIFY_004
- - name: Verify crontab list
- assert:
- that:
- - "'* * * * * ansible-playbook /root/tftp.yml' in crontab_list.stdout"
- - "'5 * * * * ansible-playbook /root/inventory_creation.yml' in crontab_list.stdout"
- fail_msg: "{{ crontab_list_fail_msg }}"
- success_msg: "{{ crontab_list_success_msg }}"
- tags: TC_004,VERIFY_004
- - name: Check tftp,dhcpd,xinetd,cobblerd service is running
- command: docker exec cobbler systemctl is-active {{ item }}
- changed_when: false
- ignore_errors: yes
- register: cobbler_service_check
- with_items: "{{ cobbler_services }}"
- tags: TC_004,VERIFY_004
- - name: Verify tftp,dhcpd,xinetd,cobblerd service is running
- assert:
- that:
- - "'active' in cobbler_service_check.results[{{ item }}].stdout"
- - "'inactive' not in cobbler_service_check.results[{{ item }}].stdout"
- - "'unknown' not in cobbler_service_check.results[{{ item }}].stdout"
- fail_msg: "{{ cobbler_service_check_fail_msg }}"
- success_msg: "{{ cobbler_service_check_success_msg }}"
- with_sequence: start=0 end=3
- tags: TC_004,VERIFY_004
- # Testcase OMNIA_DIO_US_CDIP_TC_005
- # Execute provison role in management station where cobbler container is configured
- - name: OMNIA_DIO_US_CDIP_TC_005
- 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_005
- - name: Check the connection to cobbler UI and it returns a status 200
- uri:
- url: https://localhost/cobbler_web
- status_code: 200
- return_content: yes
- validate_certs: no
- tags: TC_005,VERIFY_005
- - name: Fetch cobbler version in cobbler container
- command: docker exec {{ docker_container_name }} cobbler version
- changed_when: false
- register: cobbler_version
- tags: TC_005,VERIFY_005
- - name: Verify cobbler version
- assert:
- that:
- - "'Cobbler' in cobbler_version.stdout"
- - "'Error' not in cobbler_version.stdout"
- fail_msg: "{{ cobbler_version_fail_msg }}"
- success_msg: "{{ cobbler_version_success_msg }}"
- tags: TC_005,VERIFY_005
- - name: Run cobbler check command in cobbler container
- command: docker exec {{ docker_container_name }} cobbler check
- changed_when: false
- register: cobbler_check
- tags: TC_005,VERIFY_005
- - name: Verify cobbler check command output
- assert:
- that:
- - "'The following are potential configuration items that you may want to fix' not in cobbler_check.stdout"
- - "'Error' not in cobbler_check.stdout"
- fail_msg: "{{ cobbler_check_fail_msg }}"
- success_msg: "{{ cobbler_check_success_msg }}"
- ignore_errors: yes
- tags: TC_005,VERIFY_005
- - name: Run cobbler sync command in cobbler container
- command: docker exec {{ docker_container_name }} cobbler sync
- changed_when: false
- register: cobbler_sync
- tags: TC_005,VERIFY_005
- - name: Verify cobbler sync command output
- assert:
- that:
- - "'TASK COMPLETE' in cobbler_sync.stdout"
- - "'Fail' not in cobbler_sync.stdout"
- - "'Error' not in cobbler_sync.stdout"
- fail_msg: "{{ cobbler_sync_fail_msg }}"
- success_msg: "{{ cobbler_sync_success_msg }}"
- tags: TC_005,VERIFY_005
- - name: Fetch cobbler distro list
- command: docker exec {{ docker_container_name }} cobbler distro list
- changed_when: false
- register: cobbler_distro_list
- tags: TC_005,VERIFY_005
- - name: Verify cobbler distro list
- assert:
- that:
- - "'CentOS' in cobbler_distro_list.stdout"
- fail_msg: "{{ cobbler_distro_list_fail_msg }}"
- success_msg: "{{ cobbler_distro_list_success_msg }}"
- tags: TC_005,VERIFY_005
- - name: Fetch cobbler profile list
- command: docker exec cobbler cobbler profile list
- changed_when: false
- register: cobbler_profile_list
- tags: TC_005,VERIFY_005
- - name: Verify cobbler profile list
- assert:
- that:
- - "'CentOS' in cobbler_profile_list.stdout"
- fail_msg: "{{ cobbler_profile_list_fail_msg }}"
- success_msg: "{{ cobbler_profile_list_success_msg }}"
- tags: TC_005,VERIFY_005
- - name: Check kickstart file
- shell: |
- docker exec {{ docker_container_name }} [ -f /var/lib/cobbler/kickstarts/{{ kickstart_filename }} ] && echo "File exist" || echo "File does not exist"
- changed_when: false
- register: kickstart_file_status
- tags: TC_005,VERIFY_005
- - name: Verify kickstart file present
- assert:
- that:
- - "'File exist' in kickstart_file_status.stdout"
- fail_msg: "{{ kickstart_file_fail_msg }}"
- success_msg: "{{ kickstart_file_success_msg }}"
- tags: TC_005,VERIFY_005
- - name: Check crontab list
- command: docker exec cobbler crontab -l
- changed_when: false
- register: crontab_list
- tags: TC_005,VERIFY_005
- - name: Verify crontab list
- assert:
- that:
- - "'* * * * * ansible-playbook /root/tftp.yml' in crontab_list.stdout"
- - "'5 * * * * ansible-playbook /root/inventory_creation.yml' in crontab_list.stdout"
- fail_msg: "{{ crontab_list_fail_msg }}"
- success_msg: "{{ crontab_list_success_msg }}"
- tags: TC_005,VERIFY_005
- - name: Check tftp,dhcpd,xinetd,cobblerd service is running
- command: docker exec cobbler systemctl is-active {{ item }}
- changed_when: false
- ignore_errors: yes
- register: cobbler_service_check
- with_items: "{{ cobbler_services }}"
- tags: TC_005,VERIFY_005
- - name: Verify tftp,dhcpd,xinetd,cobblerd service is running
- assert:
- that:
- - "'active' in cobbler_service_check.results[{{ item }}].stdout"
- - "'inactive' not in cobbler_service_check.results[{{ item }}].stdout"
- - "'unknown' not in cobbler_service_check.results[{{ item }}].stdout"
- fail_msg: "{{ cobbler_service_check_fail_msg }}"
- success_msg: "{{ cobbler_service_check_success_msg }}"
- with_sequence: start=0 end=3
- tags: TC_005,VERIFY_005
- # Testcase OMNIA_DIO_US_CC_TC_006
- # Execute provision role in management station where already one container present
- - name: OMNIA_DIO_US_CC_TC_006
- 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_006
- - name: Delete docker image if exists
- docker_image:
- name: "{{ docker_image_name }}"
- tag: "{{ docker_image_tag }}"
- state: absent
- tags: TC_006
- - name: Create docker image
- docker_image:
- name: ubuntu
- tag: latest
- source: pull
- tags: TC_006
- - name: Create docker container
- command: docker run -dit ubuntu
- register: create_docker_container
- changed_when: true
- args:
- warn: false
- tags: TC_006
- - 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_006
- - name: Check the connection to cobbler UI and it returns a status 200
- uri:
- url: https://localhost/cobbler_web
- status_code: 200
- return_content: yes
- validate_certs: no
- tags: TC_006,VERIFY_006
- - name: Fetch cobbler version in cobbler container
- command: docker exec {{ docker_container_name }} cobbler version
- changed_when: false
- register: cobbler_version
- tags: TC_006,VERIFY_006
- - name: Verify cobbler version
- assert:
- that:
- - "'Cobbler' in cobbler_version.stdout"
- - "'Error' not in cobbler_version.stdout"
- fail_msg: "{{ cobbler_version_fail_msg }}"
- success_msg: "{{ cobbler_version_success_msg }}"
- tags: TC_006,VERIFY_006
- - name: Run cobbler check command in cobbler container
- command: docker exec {{ docker_container_name }} cobbler check
- changed_when: false
- register: cobbler_check
- tags: TC_006,VERIFY_006
- - name: Verify cobbler check command output
- assert:
- that:
- - "'The following are potential configuration items that you may want to fix' not in cobbler_check.stdout"
- - "'Error' not in cobbler_check.stdout"
- fail_msg: "{{ cobbler_check_fail_msg }}"
- success_msg: "{{ cobbler_check_success_msg }}"
- ignore_errors: yes
- tags: TC_006,VERIFY_006
- - name: Run cobbler sync command in cobbler container
- command: docker exec {{ docker_container_name }} cobbler sync
- changed_when: false
- register: cobbler_sync
- tags: TC_006,VERIFY_006
- - name: Verify cobbler sync command output
- assert:
- that:
- - "'TASK COMPLETE' in cobbler_sync.stdout"
- - "'Fail' not in cobbler_sync.stdout"
- - "'Error' not in cobbler_sync.stdout"
- fail_msg: "{{ cobbler_sync_fail_msg }}"
- success_msg: "{{ cobbler_sync_success_msg }}"
- tags: TC_006,VERIFY_006
- - name: Fetch cobbler distro list
- command: docker exec {{ docker_container_name }} cobbler distro list
- changed_when: false
- register: cobbler_distro_list
- tags: TC_006,VERIFY_006
- - name: Verify cobbler distro list
- assert:
- that:
- - "'CentOS' in cobbler_distro_list.stdout"
- fail_msg: "{{ cobbler_distro_list_fail_msg }}"
- success_msg: "{{ cobbler_distro_list_success_msg }}"
- tags: TC_006,VERIFY_006
- - name: Fetch cobbler profile list
- command: docker exec cobbler cobbler profile list
- changed_when: false
- register: cobbler_profile_list
- tags: TC_006,VERIFY_006
- - name: Verify cobbler profile list
- assert:
- that:
- - "'CentOS' in cobbler_profile_list.stdout"
- fail_msg: "{{ cobbler_profile_list_fail_msg }}"
- success_msg: "{{ cobbler_profile_list_success_msg }}"
- tags: TC_006,VERIFY_006
- - name: Check kickstart file
- shell: |
- docker exec {{ docker_container_name }} [ -f /var/lib/cobbler/kickstarts/{{ kickstart_filename }} ] && echo "File exist" || echo "File does not exist"
- changed_when: false
- register: kickstart_file_status
- tags: TC_006,VERIFY_006
- - name: Verify kickstart file present
- assert:
- that:
- - "'File exist' in kickstart_file_status.stdout"
- fail_msg: "{{ kickstart_file_fail_msg }}"
- success_msg: "{{ kickstart_file_success_msg }}"
- tags: TC_006,VERIFY_006
- - name: Check crontab list
- command: docker exec cobbler crontab -l
- changed_when: false
- register: crontab_list
- tags: TC_006,VERIFY_006
- - name: Verify crontab list
- assert:
- that:
- - "'* * * * * ansible-playbook /root/tftp.yml' in crontab_list.stdout"
- - "'5 * * * * ansible-playbook /root/inventory_creation.yml' in crontab_list.stdout"
- fail_msg: "{{ crontab_list_fail_msg }}"
- success_msg: "{{ crontab_list_success_msg }}"
- tags: TC_006,VERIFY_006
- - name: Check tftp,dhcpd,xinetd,cobblerd service is running
- command: docker exec cobbler systemctl is-active {{ item }}
- changed_when: false
- ignore_errors: yes
- register: cobbler_service_check
- with_items: "{{ cobbler_services }}"
- tags: TC_006,VERIFY_006
- - name: Verify tftp,dhcpd,xinetd,cobblerd service is running
- assert:
- that:
- - "'active' in cobbler_service_check.results[{{ item }}].stdout"
- - "'inactive' not in cobbler_service_check.results[{{ item }}].stdout"
- - "'unknown' not in cobbler_service_check.results[{{ item }}].stdout"
- fail_msg: "{{ cobbler_service_check_fail_msg }}"
- success_msg: "{{ cobbler_service_check_success_msg }}"
- with_sequence: start=0 end=3
- tags: TC_006,VERIFY_006
- - name: Delete the ubuntu container
- docker_container:
- name: "{{ create_docker_container.stdout }}"
- state: absent
- tags: TC_006
- - name: Delete the ubuntu umage
- docker_image:
- name: ubuntu
- state: absent
- tags: TC_006
- # Testcase OMNIA_DIO_US_CC_TC_007
- # Execute provision role in management station and reboot management station
- - name: OMNIA_DIO_US_CC_TC_007
- hosts: localhost
- connection: local
- vars_files:
- - test_vars/test_provision_vars.yml
- - ../roles/provision/vars/main.yml
- tasks:
- - name: Check last uptime of the server
- command: uptime -s
- register: uptime_status
- changed_when: false
- ignore_errors: yes
- tags: TC_007
- - name: Check current date
- command: date +"%Y-%m-%d %H"
- register: current_time
- changed_when: false
- ignore_errors: yes
- tags: TC_007
- - name: Delete the cobbler container if exits
- docker_container:
- name: "{{ docker_container_name }}"
- state: absent
- when: current_time.stdout not in uptime_status.stdout
- tags: TC_007
- - name: Delete docker image if exists
- docker_image:
- name: "{{ docker_image_name }}"
- tag: "{{ docker_image_tag }}"
- state: absent
- when: current_time.stdout not in uptime_status.stdout
- tags: TC_007
- - 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
- when: current_time.stdout not in uptime_status.stdout
- tags: TC_007
- - name: Reboot localhost
- command: reboot
- when: current_time.stdout not in uptime_status.stdout
- tags: TC_007
- - name: Inspect cobbler container
- docker_container_info:
- name: "{{ docker_container_name }}"
- register: cobbler_cnt_status
- tags: TC_007,VERIFY_007
- - name: Verify cobbler container is running after reboot
- assert:
- that: "'running' in cobbler_cnt_status.container.State.Status"
- fail_msg: "{{ cobbler_reboot_fail_msg }}"
- success_msg: "{{ cobbler_reboot_success_msg }}"
- tags: TC_007,VERIFY_007
|