浏览代码

Merge branch 'devel' into devel

Lucas A. Wilson 4 年之前
父节点
当前提交
a6d9f5df1e

+ 3 - 0
appliance/test/cobbler_inventory

@@ -0,0 +1,3 @@
+[cobbler_servers]
+172.17.0.10
+100.98.24.231

+ 1 - 1
appliance/test/test_common.yml

@@ -222,4 +222,4 @@
     - name: Disable selinux
       selinux:
         state: disabled
-      tags: TC_006
+      tags: TC_006

+ 363 - 0
appliance/test/test_provision_cc.yml

@@ -0,0 +1,363 @@
+#  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_010
+# Execute provision role in management station and verify cobbler configuration
+- name: OMNIA_DIO_US_CC_TC_010
+  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_010
+
+    - name: Delete docker image if exists
+      docker_image:
+        name: "{{ docker_image_name }}"
+        tag: "{{ docker_image_tag }}"
+        state: absent
+      tags: TC_010
+
+    - block:
+        - name: Call provision role
+          include_role:
+            name: ../roles/provision
+          vars:
+            no_prompt: true
+            admin_password: "{{ boundary_password }}"
+            admin_password_confirm: "{{ boundary_password }}"
+      tags: TC_010
+
+    - 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_010
+
+    - name: Fetch cobbler version in cobbler container
+      command: docker exec {{ docker_container_name }} cobbler version
+      changed_when: false
+      register: cobbler_version
+      tags: TC_010
+
+    - 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_010
+
+    - name: Run cobbler check command in cobbler container
+      command: docker exec {{ docker_container_name }} cobbler check
+      changed_when: false
+      register: cobbler_check
+      tags: TC_010
+
+    - 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_010
+
+    - name: Run cobbler sync command in cobbler container
+      command: docker exec {{ docker_container_name }} cobbler sync
+      changed_when: false
+      register: cobbler_sync
+      tags: TC_010
+
+    - 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_010
+
+    - name: Fetch cobbler distro list
+      command: docker exec {{ docker_container_name }} cobbler distro list
+      changed_when: false
+      register: cobbler_distro_list
+      tags: TC_010
+
+    - 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_010
+
+    - name: Fetch cobbler profile list
+      command: docker exec cobbler cobbler profile list
+      changed_when: false
+      register: cobbler_profile_list
+      tags: TC_010
+
+    - 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_010
+
+    - 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_010
+
+    - 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_010
+
+# Testcase OMNIA_DIO_US_CC_TC_011
+# Execute provision role in management station where already one container present
+- name: OMNIA_DIO_US_CC_TC_011
+  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_011
+
+    - name: Delete docker image if exists
+      docker_image:
+        name: "{{ docker_image_name }}"
+        tag: "{{ docker_image_tag }}"
+        state: absent
+      tags: TC_011
+
+    - name: Create docker image
+      docker_image:
+        name: ubuntu
+        tag: latest
+        source: pull
+      tags: TC_011
+
+    - name: Create docker container
+      command: docker run -dit ubuntu
+      register: create_docker_container
+      changed_when: true
+      args:
+        warn: false
+      tags: TC_011
+
+    - block:
+        - name: Call provision role
+          include_role:
+            name: ../roles/provision
+          vars:
+            no_prompt: true
+            admin_password: "{{ boundary_password }}"
+            admin_password_confirm: "{{ boundary_password }}"
+      tags: TC_011
+
+    - 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_011
+
+    - name: Fetch cobbler version in cobbler container
+      command: docker exec {{ docker_container_name }} cobbler version
+      changed_when: false
+      register: cobbler_version
+      tags: TC_011
+
+    - 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_011
+
+    - name: Run cobbler check command in cobbler container
+      command: docker exec {{ docker_container_name }} cobbler check
+      changed_when: false
+      register: cobbler_check
+      tags: TC_011
+
+    - 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_011
+
+    - name: Run cobbler sync command in cobbler container
+      command: docker exec {{ docker_container_name }} cobbler sync
+      changed_when: false
+      register: cobbler_sync
+      tags: TC_011
+
+    - 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_011
+
+    - name: Fetch cobbler distro list
+      command: docker exec {{ docker_container_name }} cobbler distro list
+      changed_when: false
+      register: cobbler_distro_list
+      tags: TC_011
+
+    - 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_011
+
+    - name: Fetch cobbler profile list
+      command: docker exec cobbler cobbler profile list
+      changed_when: false
+      register: cobbler_profile_list
+      tags: TC_011
+
+    - 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_011
+
+    - 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_011
+
+    - 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_011
+
+    - name: Delete the ubuntu container
+      docker_container:
+        name: "{{ create_docker_container.stdout }}"
+        state: absent
+      tags: TC_011
+
+    - name: Delete the ubuntu umage
+      docker_image:
+        name: ubuntu
+        state: absent
+      tags: TC_011
+
+# Testcase OMNIA_DIO_US_CC_TC_012
+# Execute provision role in management station and reboot management station
+- name: OMNIA_DIO_US_CC_TC_012
+  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
+      shell: |
+        current_time=$(date +"%Y-%m-%d %H")
+        uptime -s | grep "$current_time"
+      register: uptime_status
+      changed_when: false
+      ignore_errors: yes
+      tags: TC_012
+
+    - name: Delete the cobbler container if exits
+      docker_container:
+        name: "{{ docker_container_name }}"
+        state: absent
+      when: uptime_status.stdout|length < 1
+      tags: TC_012
+
+    - name: Delete docker image if exists
+      docker_image:
+        name: "{{ docker_image_name }}"
+        tag: "{{ docker_image_tag }}"
+        state: absent
+      when: uptime_status.stdout|length < 1
+      tags: TC_012
+
+    - block:
+        - name: Call provision role
+          include_role:
+            name: ../roles/provision
+          vars:
+            no_prompt: true
+            admin_password: "{{ boundary_password }}"
+            admin_password_confirm: "{{ boundary_password }}"
+      when: uptime_status.stdout|length < 1
+      tags: TC_012
+
+    - name: Reboot localhost
+      command: reboot
+      when: uptime_status.stdout|length < 1
+      tags: TC_012
+
+    - name: Inspect cobbler container
+      docker_container_info:
+        name: "{{ docker_container_name }}"
+      register: cobbler_cnt_status
+      tags: TC_012
+
+    - 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_012

+ 458 - 0
appliance/test/test_provision_cdip.yml

@@ -0,0 +1,458 @@
+#  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 cobbler as empty
+- 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: Test cobbler password with empty string
+          include_role:
+            name: ../roles/provision
+            tasks_from: "{{ item }}"
+          with_items:
+           - "{{ cobbler_image_files }}"
+          vars:
+            no_prompt: true
+            admin_password: "{{ empty_password }}"
+            admin_password_confirm: "{{ empty_password }}"
+      rescue:
+        - name: Validate failure message
+          assert:
+            that: fail_msg_pwd_format in msg_pwd_format.msg
+            success_msg: "{{ validate_password_success_msg }}"
+            fail_msg: "{{ validate_password_fail_msg }}"
+      tags: TC_001
+
+# Testcase OMNIA_DIO_US_CDIP_TC_002
+# Execute provison role in management station with cobbler password of length 8 characters
+- 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:
+    - name: Delete the cobbler container if exits
+      docker_container:
+        name: "{{ docker_container_name }}"
+        state: absent
+      tags: TC_002
+
+    - name: Delete docker image if exists
+      docker_image:
+        name: "{{ docker_image_name }}"
+        tag: "{{ docker_image_tag }}"
+        state: absent
+      tags: TC_002
+
+    - block:
+        - name: Test cobbler password with 8 characters
+          include_role:
+            name: ../roles/provision
+            tasks_from: "{{ item }}"
+          with_items:
+           - "{{ cobbler_image_files }}"
+          vars:
+            no_prompt: true
+            admin_password: "{{ boundary_password }}"
+            admin_password_confirm: "{{ boundary_password }}"
+      always:
+        - name: Validate success message
+          assert:
+            that:  success_msg_pwd_format in msg_pwd_format.msg
+            success_msg: "{{ validate_password_success_msg }}"
+            fail_msg: "{{ validate_password_fail_msg }}"
+      tags: TC_002
+
+# Testcase OMNIA_DIO_US_CDIP_TC_003
+# Execute provison role in management station with cobbler password of length greather than 15 characters
+- 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
+
+    - block:
+        - name: Test cobbler password with lengthy string
+          include_role:
+             name: ../roles/provision
+             tasks_from: "{{ item }}"
+          with_items:
+           - "{{ cobbler_image_files }}"
+          vars:
+            no_prompt: true
+            admin_password: "{{ lengthy_password }}"
+            admin_password_confirm: "{{ lengthy_password }}"
+      always:
+        - name: Validate success message
+          assert:
+            that:  success_msg_pwd_format in msg_pwd_format.msg
+            success_msg: "{{ validate_password_success_msg }}"
+            fail_msg: "{{ validate_password_fail_msg }}"
+      tags: TC_003
+
+# Testcase OMNIA_DIO_US_CDIP_TC_004
+# Execute provison role in management station with cobbler password contains white spaces
+- name: OMNIA_DIO_US_CDIP_TC_004
+  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_004
+
+    - name: Delete docker image if exists
+      docker_image:
+        name: "{{ docker_image_name }}"
+        tag: "{{ docker_image_tag }}"
+        state: absent
+      tags: TC_004
+
+    - block:
+        - name: Test cobbler password with string contains white space
+          include_role:
+            name: ../roles/provision
+            tasks_from: "{{ item }}"
+          with_items:
+           - "{{ cobbler_image_files }}"
+          vars:
+            no_prompt: true
+            admin_password: "{{ whitespace_password }}"
+            admin_password_confirm: "{{ whitespace_password }}"
+      always:
+        - name: Validate success message
+          assert:
+            that:  success_msg_pwd_format in msg_pwd_format.msg
+            success_msg: "{{ validate_password_success_msg }}"
+            fail_msg: "{{ validate_password_fail_msg }}"
+      tags: TC_004
+
+# Testcase OMNIA_DIO_US_CDIP_TC_005
+# Execute provison role in management station with cobbler password as string with special characters
+- 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:
+    - name: Delete the cobbler container if exits
+      docker_container:
+        name: "{{ docker_container_name }}"
+        state: absent
+      tags: TC_005
+
+    - name: Delete docker image if exists
+      docker_image:
+        name: "{{ docker_image_name }}"
+        tag: "{{ docker_image_tag }}"
+        state: absent
+      tags: TC_005
+
+    - block:
+        - name: Test cobbler password with string contains special characters
+          include_role:
+            name: ../roles/provision
+            tasks_from: "{{ item }}"
+          with_items:
+           - "{{ cobbler_image_files }}"
+          vars:
+            no_prompt: true
+            admin_password: "{{ special_character_password }}"
+            admin_password_confirm: "{{ special_character_password }}"
+      always:
+        - name: Validate success message
+          assert:
+            that:  success_msg_pwd_format in msg_pwd_format.msg
+            success_msg: "{{ validate_password_success_msg }}"
+            fail_msg: "{{ validate_password_success_msg }}"
+      tags: TC_005
+
+# Testcase OMNIA_DIO_US_CDIP_TC_006
+# Execute provison role in management station with cobbler password and cobbler password confirm having unequal values
+- name: OMNIA_DIO_US_CDIP_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
+
+    - block:
+        - name: Test cobbler password with unequal values
+          include_role:
+            name: ../roles/provision
+            tasks_from: "{{ item }}"
+          with_items:
+           - "{{ cobbler_image_files }}"
+          vars:
+            no_prompt: true
+            admin_password: "{{ boundary_password }}"
+            admin_password_confirm: "{{ lengthy_password }}"
+      rescue:
+        - name: Validate failure message
+          assert:
+            that:  fail_msg_pwd_confirm in msg_pwd_confirm.msg
+            success_msg: "{{ validate_password_success_msg }}"
+            fail_msg: "{{ validate_password_success_msg }}"
+      tags: TC_006
+
+# Testcase OMNIA_DIO_US_CDIP_TC_007
+# Execute provison role in management station where docker service not running
+- name: OMNIA_DIO_US_CDIP_TC_007
+  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_007
+
+    - name: Delete docker image if exists
+      docker_image:
+        name: "{{ docker_image_name }}"
+        tag: "{{ docker_image_tag }}"
+        state: absent
+      tags: TC_007
+
+    - name: Stop docker service
+      service:
+        name: docker
+        state: stopped
+      tags: TC_007
+
+    - block:
+        - name: Call provision role
+          include_role:
+            name: ../roles/provision
+          vars:
+            no_prompt: true
+            admin_password: "{{ boundary_password }}"
+            admin_password_confirm: "{{ boundary_password }}"
+
+        - name: Docker service stopped usecase fail message
+          fail:
+            msg: "{{ docker_check_fail_msg }}"
+      rescue:
+        - name: Docker service stopped usecase success message
+          debug:
+            msg: "{{ docker_check_success_msg }}"
+      always:
+        - name: Start docker service
+          service:
+            name: docker
+            state: started
+      tags: TC_007
+
+# Testcase OMNIA_DIO_US_CDIP_TC_008
+# Execute provison role in management station with os installed centos 8.2
+- name: OMNIA_DIO_US_CDIP_TC_008
+  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_008
+
+    - name: Delete docker image if exists
+      docker_image:
+        name: "{{ docker_image_name }}"
+        tag: "{{ docker_image_tag }}"
+        state: absent
+      tags: TC_008
+
+    - block:
+        - name: Call provision role
+          include_role:
+            name: ../roles/provision
+            tasks_from: "{{ item }}"
+          with_items:
+           - "{{ cobbler_image_files }}"
+          vars:
+            no_prompt: true
+            admin_password: "{{ boundary_password }}"
+            admin_password_confirm: "{{ boundary_password }}"
+      tags: TC_008
+
+    - name: Inspect cobbler docker image
+      docker_image_info:
+        name: "{{ docker_image_name }}"
+      register: cobbler_image_status
+      tags: TC_008
+
+    - 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_008
+
+    - name: Inspect cobbler container
+      docker_container_info:
+        name: "{{ docker_container_name }}"
+      register: cobbler_cnt_status
+      tags: TC_008
+
+    - 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_008
+
+    - 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_008
+
+    - name: "Validate NIC-1 is assigned to IP {{ nic1_ip_address }}"
+      assert:
+        that: "'{{ nic1_ip_address }}' in ansible_eno1.ipv4.address"
+        fail_msg: "{{ nic_check_fail_msg }}"
+        success_msg: "{{ nic_check_success_msg }}"
+      tags: TC_008
+
+# Testcase OMNIA_DIO_US_CDIP_TC_009
+# Execute provison role in management station where cobbler container and image already created
+- name: OMNIA_DIO_US_CDIP_TC_009
+  hosts: localhost
+  connection: local
+  vars_files:
+    - test_vars/test_provision_vars.yml
+    - ../roles/provision/vars/main.yml
+  tasks:
+    - block:
+        - name: Call provision role
+          include_role:
+            name: ../roles/provision
+          vars:
+            no_prompt: true
+            username: "{{ cobbler_username }}"
+            admin_password: "{{ boundary_password }}"
+            admin_password_confirm: "{{ boundary_password }}"
+      tags: TC_009
+
+    - name: Inspect cobbler docker image
+      docker_image_info:
+        name: "{{ docker_image_name }}"
+      register: cobbler_image_status
+      tags: TC_009
+
+    - 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_009
+
+    - name: Inspect cobbler container
+      docker_container_info:
+        name: "{{ docker_container_name }}"
+      register: cobbler_cnt_status
+      tags: TC_009
+
+    - 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_009
+
+    - 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_009
+
+    - name: "Validate NIC-1 is assigned to IP {{ nic1_ip_address }}"
+      assert:
+        that: "'{{ nic1_ip_address }}' in ansible_eno1.ipv4.address"
+        fail_msg: "{{ nic_check_fail_msg }}"
+        success_msg: "{{ nic_check_success_msg }}"
+      tags: TC_009

+ 245 - 0
appliance/test/test_provision_ndod.yml

@@ -0,0 +1,245 @@
+#  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.
+---
+
+# OMNIA_DIO_US_NDOD_TC_013
+# Execute provison role in management station and  PXE boot one compute node 
+- name: OMNIA_DIO_US_NDOD_TC_013
+  hosts: localhost
+  connection: local
+  gather_subset:
+    - 'min'
+  vars_files:
+    - test_vars/test_provision_vars.yml
+  tasks:
+    - name: Set ip address of the compute node
+      set_fact:
+        single_node_ip_address: "{{ groups[cobbler_groupname][0] }}"
+      tags: TC_013
+
+    - name: Delete inventory if exists
+      file:
+        path: inventory
+        state: absent
+      tags: TC_013
+
+    - name: Create inventory file
+      lineinfile:
+        path: inventory
+        line: "{{ single_node_ip_address }} ansible_user=root ansible_password={{ boundary_password }} ansible_ssh_common_args='-o StrictHostKeyChecking=no'"
+        create: yes
+        mode: '{{ file_permission }}'
+      tags: TC_013
+
+    - meta: refresh_inventory
+      tags: TC_013
+
+    - name: Validate authentication of username and password
+      command: ansible {{ single_node_ip_address }} -m ping -i inventory
+      register: validate_login
+      changed_when: false
+      ignore_errors: yes
+      tags: TC_013
+
+    - name: Validate the authentication output
+      assert:
+        that:
+          - "'pong' in validate_login.stdout"
+          - "'SUCCESS' in validate_login.stdout"
+          - "'UNREACHABLE' not in validate_login.stdout"
+        fail_msg: "{{ authentication_fail_msg }}"
+        success_msg: "{{ authentication_success_msg }}"
+      tags: TC_013
+
+    - name: Check hostname
+      command: ansible {{ single_node_ip_address }} -m shell -a hostname -i inventory
+      register: validate_hostname
+      changed_when: false
+      ignore_errors: yes
+      tags: TC_013
+
+    - name: Validate the hostname
+      assert:
+        that: "'localhost' not in validate_hostname.stdout"
+        fail_msg: "{{ hostname_fail_msg }}"
+        success_msg: "{{ hostname_success_msg }}"
+      tags: TC_013
+
+    - name: Delete inventory if exists
+      file:
+        path: inventory
+        state: absent
+      tags: TC_013
+
+# OMNIA_DIO_US_NDOD_TC_014
+# Execute provison role in management station and PXE boot two compute node
+- name: OMNIA_DIO_US_NDOD_TC_014
+  hosts: localhost
+  connection: local
+  gather_subset:
+    - 'min'
+  vars_files:
+    - test_vars/test_provision_vars.yml
+    - ../roles/provision/vars/main.yml
+  tasks:
+    - name: Delete inventory if exists
+      file:
+        path: inventory
+        state: absent
+      tags: TC_014
+
+    - name: Create inventory file
+      lineinfile:
+        path: inventory
+        line: "[nodes]"
+        create: yes
+        mode: '{{ file_permission }}'
+      tags: TC_014
+
+    - name: Edit inventory file
+      lineinfile:
+        path: inventory
+        line: "{{ item }} ansible_user=root ansible_password={{ boundary_password }} ansible_ssh_common_args='-o StrictHostKeyChecking=no'"
+      with_items:
+        - "{{ groups[cobbler_groupname] }}"
+      tags: TC_014
+
+    - meta: refresh_inventory
+      tags: TC_014
+
+    - name: Validate ip address is different for both servers
+      assert:
+        that: groups[cobbler_groupname][0] != groups[cobbler_groupname][1]
+        fail_msg: "{{ ip_address_fail_msg }}"
+        success_msg: "{{ ip_address_success_msg }}"
+      delegate_to: localhost
+      run_once: yes
+      tags: TC_014
+
+    - name: Check hostname of both servers
+      command: ansible nodes -m shell -a hostname -i inventory
+      register: node_hostname
+      changed_when: false
+      ignore_errors: yes
+      tags: TC_014
+
+    - name: Validate hostname is different for both servers
+      assert:
+        that:
+          - node_hostname.stdout_lines[1] != node_hostname.stdout_lines[3]
+          - "'localhost' not in node_hostname.stdout_lines[1]"
+          - "'localhost' not in node_hostname.stdout_lines[3]"
+        fail_msg: "{{ hostname_fail_msg }}"
+        success_msg: "{{ hostname_success_msg }}"
+      delegate_to: localhost
+      run_once: yes
+      tags: TC_014
+
+    - name: Delete inventory if exists
+      file:
+        path: inventory
+        state: absent
+      delegate_to: localhost
+      run_once: yes
+      tags: TC_014
+
+# OMNIA_DIO_US_NDOD_TC_015
+# Validate passwordless ssh connection established or not with compute nodes
+- name: OMNIA_DIO_US_NDOD_TC_015
+  hosts: localhost
+  gather_subset:
+    - 'min'
+  vars_files:
+    - test_vars/test_provision_vars.yml
+    - ../roles/provision/vars/main.yml
+  tasks:
+    - name: Validate authentication of username and password
+      command: "ansible {{ cobbler_groupname }} -m ping -i cobbler_inventory"
+      register: validate_login
+      changed_when: false
+      ignore_errors: yes
+      tags: TC_015
+
+    - name: Validate the passwordless SSH connection
+      assert:
+        that:
+          - "'pong' in validate_login.stdout"
+          - "'SUCCESS' in validate_login.stdout"
+          - "'UNREACHABLE' not in validate_login.stdout"
+        success_msg: "{{ authentication_success_msg }}"
+        fail_msg: "{{ authentication_fail_msg }}"
+      tags: TC_015
+
+# OMNIA_DIO_US_NDOD_TC_016
+# Execute provison role in management station and reboot compute node after os provision again
+- name: OMNIA_DIO_US_NDOD_TC_016
+  hosts: localhost
+  connection: local
+  gather_subset:
+    - 'min'
+  vars_files:
+    - test_vars/test_provision_vars.yml
+  tasks:
+    - name: Set ip address of the compute node
+      set_fact:
+        single_node_ip_address: "{{ groups[cobbler_groupname][0] }}"
+      tags: TC_016
+
+    - name: Delete inventory if exists
+      file:
+        path: inventory
+        state: absent
+      tags: TC_016
+
+    - name: Create inventory file
+      lineinfile:
+        path: inventory
+        line: "[nodes]"
+        create: yes
+        mode: '{{ file_permission }}'
+      tags: TC_016
+
+    - name: Edit inventory file
+      lineinfile:
+        path: inventory
+        line: "{{ single_node_ip_address }} ansible_user=root ansible_password={{ boundary_password }} ansible_ssh_common_args='-o StrictHostKeyChecking=no'"
+      tags: TC_016
+
+    - meta: refresh_inventory
+      tags: TC_016
+
+    - name: Reboot servers
+      command: ansible nodes -m command -a reboot -i inventory
+      ignore_errors: yes
+      changed_when: true
+      tags: TC_016
+
+    - name: Wait for 10 minutes
+      pause:
+        minutes: 10
+      tags: TC_016
+
+    - name: Check ip address of servers
+      command: ansible nodes -m command -a 'ip a' -i inventory
+      ignore_errors: yes
+      changed_when: false
+      register: ip_address_after_reboot
+      tags: TC_016
+
+    - name: Validate ip address is same after reboot
+      assert:
+        that: "'{{ single_node_ip_address }}' in ip_address_after_reboot.stdout"
+        fail_msg: "{{ ip_address_fail_msg }}"
+        success_msg: "{{ ip_address_success_msg }}"
+      tags: TC_016

+ 72 - 0
appliance/test/test_vars/test_provision_vars.yml

@@ -0,0 +1,72 @@
+#  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.
+---
+
+# Usage: test_provision_cdip.yml
+empty_password: ""
+lengthy_password: "a1b2c3d4e5f6g7h8i9j10k11"
+whitespace_password: "hello world 123"
+special_character_password: "hello@123#%"
+first_nic: "eno1"
+nic1_ip_address: 172.17.0.1
+validate_password_success_msg: "Password validation successful"
+validate_password_fail_msg: "Password validation failed"
+cobbler_img_fail_msg: "Docker image cobbler does not exist"
+cobbler_img_success_msg: "Docker image cobbler exists"
+cobbler_cnt_fail_msg: "Docker container cobbler does not exist"
+cobbler_cnt_success_msg: "Docker container cobbler exists"
+nic_check_fail_msg: "NIC-1 ip address validation failed"
+nic_check_success_msg: "NIC-1 ip address validation successful"
+cobbler_image_files:
+ - configure_nic
+ - check_prerequisites
+ - mount_iso
+ - firewall_settings
+ - provision_password
+ - cobbler_image
+
+# Usage: test_provision_cc.yml
+docker_check_success_msg: "Docker service stopped usescase validation successful"
+docker_check_fail_msg: "Docker service stopped usescase validation failed"
+docker_ip_fail_msg: "Docker IP validation failed"
+docker_ip_success_msg: "Docker IP validation successful"
+cobbler_version_fail_msg: "Cobbler version validation failed"
+cobbler_version_success_msg: "Cobbler version validation successful"
+cobbler_check_fail_msg: "Cobbler check validation failed"
+cobbler_check_success_msg: "Cobbler check validation successful"
+cobbler_sync_fail_msg: "Cobbler sync validation failed"
+cobbler_sync_success_msg: "Cobbler sync validation successful"
+cobbler_distro_list_fail_msg: "Cobbler distro list validation failed"
+cobbler_distro_list_success_msg: "Cobbler distro list validation successful"
+cobbler_profile_list_fail_msg: "Cobbler profile list validation failed"
+cobbler_profile_list_success_msg: "Cobbler profile list validation successful"
+kickstart_file_fail_msg: "Kickstart file validation failed"
+kickstart_file_success_msg: "Kickstart file validation successful"
+cobbler_reboot_fail_msg: "Cobbler container failed to start after reboot"
+cobbler_reboot_success_msg: "Cobbler container started successfully after reboot"
+kickstart_filename: "centos8.ks"
+
+# Usage: test_provision_cdip.yml, test_provision_cc.yml, test_provision_ndod.yml
+docker_container_name: "cobbler"
+boundary_password: "testpass"
+
+# Usage: test_provision_ndod.yml
+hostname_fail_msg: "Hostname validation failed"
+hostname_success_msg: "Hostname validation successful"
+authentication_fail_msg: "Server authentication validation failed"
+authentication_success_msg: "Server authentication validation successful"
+ip_address_fail_msg: "IP address validation failed"
+ip_address_success_msg: "IP address validation successful"
+cobbler_groupname: "cobbler_servers"
+file_permission: 0644