Quellcode durchsuchen

Issue #224: Changing cobbler PXE boot IP to private and test script changes

Signed-off-by: abhishek-s-a <a_sa@dellteam.com>
Lucas A. Wilson vor 4 Jahren
Ursprung
Commit
cc4291b8d7

+ 13 - 13
appliance/roles/common/vars/main.yml

@@ -41,11 +41,11 @@ hostname: github.com
 port_no: 22
 os_name: CentOS
 os_version: '7.9' 
-internet_status: "Failed: No Internet connection.Connect to Internet."
-os_status: "Unsupported OS or OS version.OS must be {{ os_name }} and Version must be {{ os_version }} or more"
+internet_status: "Failed. No Internet connection. Make sure network is up."
+os_status: "Unsupported OS or OS version. OS should be {{ os_name }} and Version should be {{ os_version }} or more"
 selinux_status: "SElinux is not disabled. Disable it in /etc/sysconfig/selinux and reboot the system"
 iso_name: CentOS-7-x86_64-Minimal-2009.iso
-iso_fail: "Iso file absent: Download and copy the iso file in omnia/appliance/roles/provision/files"
+iso_fail: "Iso file not found. Download and copy the iso file to omnia/appliance/roles/provision/files"
 
 # Usage: docker_installation.yml
 docker_repo_url: https://download.docker.com/linux/centos/docker-ce.repo
@@ -61,28 +61,28 @@ docker_volume_name: omnia-storage
 
 # Usage: password_config.yml
 input_config_filename: "appliance_config.yml"
-fail_msg_provision_password: "Failed. Incorrect provision_password format provided in input_config.yml file"
+fail_msg_provision_password: "Failed. Incorrect provision_password format provided in appliance_config.yml file"
 success_msg_provision_password: "provision_password validated"
-fail_msg_awx_password: "Failed. Incorrect awx_password format provided in input_config.yml file"
+fail_msg_awx_password: "Failed. Incorrect awx_password format provided in appliance_config.yml file"
 success_msg_awx_password: "awx_password validated"
-fail_msg_hpc_nic: "Failed. Incorrect hpc_nic format provided in input_config.yml file"
+fail_msg_hpc_nic: "Failed. Incorrect hpc_nic format provided in appliance_config.yml file"
 success_msg_hpc_nic: "hpc_nic validated"
-fail_msg_public_nic: "Failed. Incorrect public_nic format provided in input_config.yml file"
+fail_msg_public_nic: "Failed. Incorrect public_nic format provided in appliance_config.yml file"
 success_msg_public_nic: "public_nic validated"
 success_mapping_file: "mapping_file_exists validated"
-fail_mapping_file: "Failed. Incorrect mapping_file_exists value in input_config.yml. It should be either true or false"
-input_config_failure_msg: "Please provide all the required parameters in input_config.yml"
+fail_mapping_file: "Failed. Incorrect mapping_file_exists value in appliance_config.yml. It should be either true or false"
+input_config_failure_msg: "Please provide all the required parameters in appliance_config.yml"
 success_dhcp_range: "Dhcp_range validated"
-fail_dhcp_range: "Failed: Incorrect range assigned for dhcp"
+fail_dhcp_range: "Failed. Incorrect range assigned for dhcp"
 success_hpc_ip: "IP validated"
-fail_hpc_ip: "Failed: Nic should be configured"
+fail_hpc_ip: "Failed. Nic should be configured"
 min_length: 8
 max_length: 30
 nic_min_length: 3
 vault_filename: .vault_key
 config_filename: "omnia_config.yml"
 config_vaultname: .omnia_vault_key
-fail_msg_mariadb_password: "maria_db password not given in correct format."
+fail_msg_mariadb_password: "Failed. Incorrect mariadb_password format provided in omnia_config.yml file"
 success_msg_mariadb_password: "mariadb_password validated"
 success_msg_k8s_cni: "Kubernetes CNI Validated"
-fail_msg_k8s_cni: "Kubernetes CNI not correct."
+fail_msg_k8s_cni: "Failed. Kubernetes CNI is incorrect in omnia_config.yml"

+ 16 - 2
appliance/roles/provision/files/tftp.yml

@@ -13,7 +13,7 @@
 #  limitations under the License.
 ---
 
-- name: Start tftp
+- name: Start tftp and dhcp
   hosts: localhost
   connection: local
   tasks:
@@ -29,4 +29,18 @@
       command: systemctl start tftp.service
       args:
         warn: no
-      when: "('inactive' in tftp_status.stdout) or ('unknown' in tftp_status.stdout)"
+      when: "('inactive' in tftp_status.stdout) or ('unknown' in tftp_status.stdout)"
+
+    - name: Fetch dhcp status
+      command: systemctl is-active dhcpd
+      args:
+        warn: no
+      register: dhcp_status
+      ignore_errors: yes
+      changed_when: false
+
+    - name: Start dhcp if inactive state
+      command: systemctl start dhcpd.service
+      args:
+        warn: no
+      when: "('inactive' in dhcp_status.stdout) or ('unknown' in dhcp_status.stdout)"

+ 1 - 0
appliance/roles/provision/tasks/check_prerequisites.yml

@@ -61,6 +61,7 @@
   command: docker exec cobbler cobbler profile list
   changed_when: false
   register: cobbler_profile_list
+  ignore_errors: true
   when: cobbler_container_status == true
 
 - name: Check crontab list

+ 1 - 1
appliance/roles/provision/tasks/provision_password.yml

@@ -50,7 +50,7 @@
   replace:
     path: "{{ role_path }}/files/centos7.ks"
     regexp: '^url --url http://ip/cblr/links/CentOS7-x86_64/'
-    replace: url --url http://{{ public_ip }}/cblr/links/CentOS7-x86_64/
+    replace: url --url http://{{ hpc_ip }}/cblr/links/CentOS7-x86_64/
   tags: install
 
 - name: Random phrase generation

+ 4 - 4
appliance/roles/provision/vars/main.yml

@@ -17,13 +17,13 @@
 
 #Usage: mapping_file.yml
 mapping_file_name: mapping_file.csv
-mapping_file_fail: "Mapping file absent: Copy the mapping file in omnia/appliance/roles/provision/files"
-fail_hostname_duplicate:  "Duplicate hostname exists. Please check"
+mapping_file_fail: "Mapping file not found. Copy the mapping_file.csv to omnia/appliance/roles/provision/files"
+fail_hostname_duplicate:  "Duplicate hostname exists. Please verify mapping file again."
 remove_header: awk 'NR > 1 { print }' {{ role_path }}/files/new_mapping_file.csv
 
 #Usage: check_prerequisite.yml
 iso_name: CentOS-7-x86_64-Minimal-2009.iso
-iso_fail: "Iso file absent: Download and copy the iso file in omnia/appliance/roles/provision/files"
+iso_fail: "Iso file not found. Download and copy the iso file to omnia/appliance/roles/provision/files"
 
 # Usage: provision_password.yml
 provision_encrypted_dest: ../files/
@@ -35,7 +35,7 @@ docker_image_tag: latest
 cobbler_run_command: docker run -itd --privileged --net=host --restart=always -v {{ mount_path }}:/root/omnia  -v cobbler_www:/var/www/cobbler:Z -v cobbler_backup:/var/lib/cobbler/backup:Z -v /mnt/iso:/mnt:Z -p 69:69/udp -p 81:80 -p 443:443 -p 25151:25151 --name cobbler  cobbler:latest  /sbin/init
 
 # Usage: main.yml
-message_skipped: "Installation Skipped: Cobbler instance is already running on your system"
+message_skipped: "Installation Skipped: Cobbler instance is already running in your system"
 message_installed: "Installation Successful"
 
 # Usage: mount_iso.yml

+ 14 - 11
appliance/test/input_config_empty.yml

@@ -14,26 +14,29 @@
 ---
 
 # Password used while deploying OS on bare metal servers and for Cobbler UI.
-# The Length of the password should be more than 7.
+# The Length of the password should be atleast 8.
 # The password must not contain -,\, ',"
 provision_password: ""
 
 # Password used for the AWX UI.
-# The Length of the password should be more than 7.
+# The Length of the password should be atleast 8.
 # The password must not contain -,\, ',"
 awx_password: ""
 
-# Password used for Slurm database.
-# The Length of the password should be more than 7.
-# The password must not contain -,\, ',"
-mariadb_password: ""
-
 # The nic/ethernet card that needs to be connected to the HPC switch.
 # This nic will be configured by Omnia for the DHCP server.
 # Default value of nic is em1.
 hpc_nic: "em1"
 
-# The nic card that needs to be connected to the public internet.
-# The public_nic should be em2, em1 or em3
-# Default value of nic is em2.
-public_nic: "em2"
+# The nic/ethernet card that will be connected to the public internet.
+# Default value of nic is em2
+public_nic: "em2"
+
+# The mapping file consists of the MAC address and its respective IP address and hostname.
+# If user wants to provide a mapping file, set this value to "true"
+# The format of mapping file should be MAC,hostname,IP and must be a CSV file.
+mapping_file_exists: ""
+
+# The dhcp range for assigning the IP address to the baremetal nodes.
+dhcp_start_ip_range: ""
+dhcp_end_ip_range: ""

+ 15 - 12
appliance/test/input_config_test.yml

@@ -1,4 +1,4 @@
-#  Copyright 2020 Dell Inc. or its subsidiaries. All Rights Reserved.
+# 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.
@@ -14,26 +14,29 @@
 ---
 
 # Password used while deploying OS on bare metal servers and for Cobbler UI.
-# The Length of the password should be more than 7.
+# The Length of the password should be atleast 8.
 # The password must not contain -,\, ',"
 provision_password: "omnia@123"
 
 # Password used for the AWX UI.
-# The Length of the password should be more than 7.
+# The Length of the password should be atleast 8.
 # The password must not contain -,\, ',"
 awx_password: "omnia@123"
 
-# Password used for Slurm database.
-# The Length of the password should be more than 7.
-# The password must not contain -,\, ',"
-mariadb_password: "omnia@123"
-
 # The nic/ethernet card that needs to be connected to the HPC switch.
 # This nic will be configured by Omnia for the DHCP server.
 # Default value of nic is em1.
 hpc_nic: "em1"
 
-# The nic card that needs to be connected to the public internet.
-# The public_nic should be em2, em1 or em3
-# Default value of nic is em2.
-public_nic: "em2"
+# The nic/ethernet card that will be connected to the public internet.
+# Default value of nic is em2
+public_nic: "em2"
+
+# The mapping file consists of the MAC address and its respective IP address and hostname.
+# If user wants to provide a mapping file, set this value to "true"
+# The format of mapping file should be MAC,hostname,IP and must be a CSV file.
+mapping_file_exists: "false"
+
+# The dhcp range for assigning the IP address to the baremetal nodes.
+dhcp_start_ip_range: "172.17.0.20"
+dhcp_end_ip_range: "172.17.0.100"

+ 370 - 42
appliance/test/test_common.yml

@@ -361,7 +361,9 @@
         replace: "{{ item.replace }}"
       with_items:
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mariadb_password: \"\"", replace: "mariadb_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_008
 
     - block:
@@ -415,7 +417,9 @@
         replace: "{{ item.replace }}"
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mariadb_password: \"\"", replace: "mariadb_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_009
 
     - block:
@@ -440,7 +444,7 @@
       tags: TC_009
 
 # Testcase OMNIA_DIO_US_DVC_TC_010
-# Execute common role in management station with mariadb_password as empty
+# Execute common role in management station with mapping_file_exists as empty
 - name: OMNIA_DIO_US_DVC_TC_010
   hosts: localhost
   connection: local
@@ -470,6 +474,8 @@
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_010
 
     - block:
@@ -482,7 +488,7 @@
       rescue:
         - name: Validate error
           assert:
-            that: input_config_failure_msg in input_config_check.msg
+            that: fail_mapping_file in mapping_file_check.msg
             success_msg: "{{ input_config_check_success_msg }}"
             fail_msg: "{{ input_config_check_fail_msg }}"
       tags: TC_010
@@ -524,7 +530,9 @@
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ long_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mariadb_password: \"\"", replace: "mariadb_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_011
 
     - block:
@@ -579,7 +587,9 @@
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ white_space_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mariadb_password: \"\"", replace: "mariadb_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_012
 
     - block:
@@ -634,7 +644,9 @@
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ special_character_password1 }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mariadb_password: \"\"", replace: "mariadb_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_013
 
     - block:
@@ -689,7 +701,9 @@
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ special_character_password2 }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mariadb_password: \"\"", replace: "mariadb_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_014
 
     - block:
@@ -744,7 +758,9 @@
       with_items:
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ long_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mariadb_password: \"\"", replace: "mariadb_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_015
 
     - block:
@@ -799,7 +815,9 @@
       with_items:
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ white_space_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mariadb_password: \"\"", replace: "mariadb_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_016
 
     - block:
@@ -854,7 +872,9 @@
       with_items:
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ special_character_password1 }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mariadb_password: \"\"", replace: "mariadb_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_017
 
     - block:
@@ -909,7 +929,9 @@
       with_items:
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ special_character_password2 }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mariadb_password: \"\"", replace: "mariadb_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_018
 
     - block:
@@ -934,7 +956,7 @@
       tags: TC_018
 
 # Testcase OMNIA_DIO_US_DVC_TC_019
-# Execute common role in management station with mariadb_password of more than 31 characters
+# Execute common role in management station with mapping_file_exists status as true
 - name: OMNIA_DIO_US_DVC_TC_019
   hosts: localhost
   connection: local
@@ -962,9 +984,11 @@
         regexp: "{{ item.regexp }}"
         replace: "{{ item.replace }}"
       with_items:
-        - { regexp: "mariadb_password: \"\"", replace: "mariadb_password: \"{{ long_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"true\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_019
 
     - block:
@@ -974,10 +998,10 @@
             tasks_from: "{{ password_config_file }}"
           vars:
             input_config_filename: "{{ new_input_config_filename }}"
-      rescue:
-        - name: Validate error
+      always:
+        - name: Validate success message
           assert:
-            that: fail_msg_mariadb_password in mariadb_password_check.msg
+            that: success_mapping_file in mapping_file_check.msg
             success_msg: "{{ input_config_check_success_msg }}"
             fail_msg: "{{ input_config_check_fail_msg }}"
       tags: TC_019
@@ -989,7 +1013,7 @@
       tags: TC_019
 
 # Testcase OMNIA_DIO_US_DVC_TC_020
-# Execute common role in management station with mariadb_password as string contains white spaces
+# Execute common role in management station with mapping_file_exists status other than true or false
 - name: OMNIA_DIO_US_DVC_TC_020
   hosts: localhost
   connection: local
@@ -1017,9 +1041,11 @@
         regexp: "{{ item.regexp }}"
         replace: "{{ item.replace }}"
       with_items:
-        - { regexp: "mariadb_password: \"\"", replace: "mariadb_password: \"{{ white_space_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"test\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_020
 
     - block:
@@ -1029,10 +1055,10 @@
             tasks_from: "{{ password_config_file }}"
           vars:
             input_config_filename: "{{ new_input_config_filename }}"
-      always:
-        - name: Validate success message
+      rescue:
+        - name: Validate error
           assert:
-            that: success_msg_mariadb_password in mariadb_password_check.msg
+            that: fail_mapping_file in mapping_file_check.msg
             success_msg: "{{ input_config_check_success_msg }}"
             fail_msg: "{{ input_config_check_fail_msg }}"
       tags: TC_020
@@ -1044,7 +1070,7 @@
       tags: TC_020
 
 # Testcase OMNIA_DIO_US_DVC_TC_021
-# Execute common role in management station with mariadb_password as string contains characters like '/' and '-'
+# Execute common role in management station with dhcp_start_ip_range as empty
 - name: OMNIA_DIO_US_DVC_TC_021
   hosts: localhost
   connection: local
@@ -1072,9 +1098,10 @@
         regexp: "{{ item.regexp }}"
         replace: "{{ item.replace }}"
       with_items:
-        - { regexp: "mariadb_password: \"\"", replace: "mariadb_password: \"{{ special_character_password1 }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_021
 
     - block:
@@ -1087,7 +1114,7 @@
       rescue:
         - name: Validate error
           assert:
-            that: fail_msg_mariadb_password in mariadb_password_check.msg
+            that: input_config_failure_msg in input_config_check.msg
             success_msg: "{{ input_config_check_success_msg }}"
             fail_msg: "{{ input_config_check_fail_msg }}"
       tags: TC_021
@@ -1099,7 +1126,7 @@
       tags: TC_021
 
 # Testcase OMNIA_DIO_US_DVC_TC_022
-# Execute common role in management station with mariadb_password as string contains special characters other than '-', '/'
+# Execute common role in management station with dhcp_end_ip_range as empty
 - name: OMNIA_DIO_US_DVC_TC_022
   hosts: localhost
   connection: local
@@ -1127,9 +1154,10 @@
         regexp: "{{ item.regexp }}"
         replace: "{{ item.replace }}"
       with_items:
-        - { regexp: "mariadb_password: \"\"", replace: "mariadb_password: \"{{ special_character_password2 }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
       tags: TC_022
 
     - block:
@@ -1139,10 +1167,10 @@
             tasks_from: "{{ password_config_file }}"
           vars:
             input_config_filename: "{{ new_input_config_filename }}"
-      always:
-        - name: Validate success message
+      rescue:
+        - name: Validate error
           assert:
-            that: success_msg_mariadb_password in mariadb_password_check.msg
+            that: input_config_failure_msg in input_config_check.msg
             success_msg: "{{ input_config_check_success_msg }}"
             fail_msg: "{{ input_config_check_fail_msg }}"
       tags: TC_022
@@ -1154,7 +1182,7 @@
       tags: TC_022
 
 # Testcase OMNIA_DIO_US_DVC_TC_023
-# Execute common role in management station with mariadb_password of 30 characters
+# Execute common role in management station with mapping_file_exists status as false
 - name: OMNIA_DIO_US_DVC_TC_023
   hosts: localhost
   connection: local
@@ -1182,9 +1210,11 @@
         regexp: "{{ item.regexp }}"
         replace: "{{ item.replace }}"
       with_items:
-        - { regexp: "mariadb_password: \"\"", replace: "mariadb_password: \"{{ max_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_023
 
     - block:
@@ -1197,7 +1227,7 @@
       always:
         - name: Validate success message
           assert:
-            that: success_msg_mariadb_password in mariadb_password_check.msg
+            that: success_mapping_file in mapping_file_check.msg
             success_msg: "{{ input_config_check_success_msg }}"
             fail_msg: "{{ input_config_check_fail_msg }}"
       tags: TC_023
@@ -1239,7 +1269,9 @@
       with_items:
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ max_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mariadb_password: \"\"", replace: "mariadb_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_024
 
     - block:
@@ -1294,7 +1326,9 @@
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ max_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mariadb_password: \"\"", replace: "mariadb_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_025
 
     - block:
@@ -1349,7 +1383,9 @@
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mariadb_password: \"\"", replace: "mariadb_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "hpc_nic: \"em1\"", replace: "hpc_nic: \"em2\"" }
       tags: TC_026
 
@@ -1405,7 +1441,9 @@
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mariadb_password: \"\"", replace: "mariadb_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "hpc_nic: \"em1\"", replace: "hpc_nic: \"\"" }
       tags: TC_027
 
@@ -1461,7 +1499,9 @@
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mariadb_password: \"\"", replace: "mariadb_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "public_nic: \"em2\"", replace: "public_nic: \"\"" }
       tags: TC_028
 
@@ -1487,7 +1527,7 @@
       tags: TC_028
 
 # Testcase OMNIA_DIO_US_DVC_TC_029
-# Execute common role in management station with public_nic other than em1, em2 or em3
+# Execute common role in management station with public_nic not present in device
 - name: OMNIA_DIO_US_DVC_TC_029
   hosts: localhost
   connection: local
@@ -1517,7 +1557,9 @@
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mariadb_password: \"\"", replace: "mariadb_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
         - { regexp: "public_nic: \"em2\"", replace: "public_nic: \"em5\"" }
       tags: TC_029
 
@@ -1531,7 +1573,7 @@
       rescue:
         - name: Validate error
           assert:
-            that: fail_msg_public_nic in public_nic_check.msg
+            that: fail_hpc_ip in public_ip_check.msg
             success_msg: "{{ input_config_check_success_msg }}"
             fail_msg: "{{ input_config_check_fail_msg }}"
       tags: TC_029
@@ -1540,4 +1582,290 @@
       file:
         path: "{{ new_input_config_filename }}"
         state: absent
-      tags: TC_029
+      tags: TC_029
+
+# Testcase OMNIA_DIO_US_DVC_TC_030
+# Execute common role in management station with hpc_nic not present in device
+- name: OMNIA_DIO_US_DVC_TC_030
+  hosts: localhost
+  connection: local
+  gather_subset:
+    - 'min'
+  vars_files:
+    - test_vars/test_common_vars.yml
+    - ../roles/common/vars/main.yml
+  tasks:
+    - name: Delete "{{ new_input_config_filename }}"
+      file:
+        path: "{{ new_input_config_filename }}"
+        state: absent
+      tags: TC_030
+
+    - name: Copy "{{ empty_input_config_filename }}" to new file
+      copy:
+        src: "{{ empty_input_config_filename }}"
+        dest: "{{ new_input_config_filename }}"
+      tags: TC_030
+
+    - name: Edit "{{ new_input_config_filename }}"
+      replace:
+        path: "{{ new_input_config_filename }}"
+        regexp: "{{ item.regexp }}"
+        replace: "{{ item.replace }}"
+      with_items:
+        - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
+        - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
+        - { regexp: "hpc_nic: \"em1\"", replace: "hpc_nic: \"em5\"" }
+      tags: TC_030
+
+    - block:
+        - name: Call common role
+          include_role:
+            name: ../roles/common
+            tasks_from: "{{ password_config_file }}"
+          vars:
+            input_config_filename: "{{ new_input_config_filename }}"
+      rescue:
+        - name: Validate error
+          assert:
+            that: fail_hpc_ip in hpc_ip_check.msg
+            success_msg: "{{ input_config_check_success_msg }}"
+            fail_msg: "{{ input_config_check_fail_msg }}"
+      tags: TC_030
+
+    - name: Delete "{{ new_input_config_filename }}"
+      file:
+        path: "{{ new_input_config_filename }}"
+        state: absent
+      tags: TC_030
+
+# Testcase OMNIA_DIO_US_DVC_TC_031
+# Execute common role with dhcp_start_ip_range in wrong ip range
+- name: OMNIA_DIO_US_DVC_TC_031
+  hosts: localhost
+  connection: local
+  gather_subset:
+    - 'min'
+  vars_files:
+    - test_vars/test_common_vars.yml
+    - ../roles/common/vars/main.yml
+  tasks:
+    - name: Delete "{{ new_input_config_filename }}"
+      file:
+        path: "{{ new_input_config_filename }}"
+        state: absent
+      tags: TC_031
+
+    - name: Copy "{{ empty_input_config_filename }}" to new file
+      copy:
+        src: "{{ empty_input_config_filename }}"
+        dest: "{{ new_input_config_filename }}"
+      tags: TC_031
+
+    - name: Edit "{{ new_input_config_filename }}"
+      replace:
+        path: "{{ new_input_config_filename }}"
+        regexp: "{{ item.regexp }}"
+        replace: "{{ item.replace }}"
+      with_items:
+        - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
+        - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ invalid_dhcp_ip }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
+      tags: TC_031
+
+    - block:
+        - name: Call common role
+          include_role:
+            name: ../roles/common
+            tasks_from: "{{ password_config_file }}"
+          vars:
+            input_config_filename: "{{ new_input_config_filename }}"
+      rescue:
+        - name: Validate error
+          assert:
+            that: fail_dhcp_range in dhcp_start_ip_check.msg
+            success_msg: "{{ input_config_check_success_msg }}"
+            fail_msg: "{{ input_config_check_fail_msg }}"
+      tags: TC_031
+
+    - name: Delete "{{ new_input_config_filename }}"
+      file:
+        path: "{{ new_input_config_filename }}"
+        state: absent
+      tags: TC_031
+
+# Testcase OMNIA_DIO_US_DVC_TC_032
+# Execute common role with dhcp_start_ip_range in wrong format
+- name: OMNIA_DIO_US_DVC_TC_032
+  hosts: localhost
+  connection: local
+  gather_subset:
+    - 'min'
+  vars_files:
+    - test_vars/test_common_vars.yml
+    - ../roles/common/vars/main.yml
+  tasks:
+    - name: Delete "{{ new_input_config_filename }}"
+      file:
+        path: "{{ new_input_config_filename }}"
+        state: absent
+      tags: TC_032
+
+    - name: Copy "{{ empty_input_config_filename }}" to new file
+      copy:
+        src: "{{ empty_input_config_filename }}"
+        dest: "{{ new_input_config_filename }}"
+      tags: TC_032
+
+    - name: Edit "{{ new_input_config_filename }}"
+      replace:
+        path: "{{ new_input_config_filename }}"
+        regexp: "{{ item.regexp }}"
+        replace: "{{ item.replace }}"
+      with_items:
+        - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
+        - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ wrong_dhcp_ip }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
+      tags: TC_032
+
+    - block:
+        - name: Call common role
+          include_role:
+            name: ../roles/common
+            tasks_from: "{{ password_config_file }}"
+          vars:
+            input_config_filename: "{{ new_input_config_filename }}"
+      rescue:
+        - name: Validate error
+          assert:
+            that: fail_dhcp_range in dhcp_start_ip_check.msg
+            success_msg: "{{ input_config_check_success_msg }}"
+            fail_msg: "{{ input_config_check_fail_msg }}"
+      tags: TC_032
+
+    - name: Delete "{{ new_input_config_filename }}"
+      file:
+        path: "{{ new_input_config_filename }}"
+        state: absent
+      tags: TC_032
+
+# Testcase OMNIA_DIO_US_DVC_TC_033
+#Execute common role with dhcp_end_ip_range in wrong format
+- name: OMNIA_DIO_US_DVC_TC_033
+  hosts: localhost
+  connection: local
+  gather_subset:
+    - 'min'
+  vars_files:
+    - test_vars/test_common_vars.yml
+    - ../roles/common/vars/main.yml
+  tasks:
+    - name: Delete "{{ new_input_config_filename }}"
+      file:
+        path: "{{ new_input_config_filename }}"
+        state: absent
+      tags: TC_033
+
+    - name: Copy "{{ empty_input_config_filename }}" to new file
+      copy:
+        src: "{{ empty_input_config_filename }}"
+        dest: "{{ new_input_config_filename }}"
+      tags: TC_033
+
+    - name: Edit "{{ new_input_config_filename }}"
+      replace:
+        path: "{{ new_input_config_filename }}"
+        regexp: "{{ item.regexp }}"
+        replace: "{{ item.replace }}"
+      with_items:
+        - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
+        - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ wrong_dhcp_ip }}\"" }
+      tags: TC_033
+
+    - block:
+        - name: Call common role
+          include_role:
+            name: ../roles/common
+            tasks_from: "{{ password_config_file }}"
+          vars:
+            input_config_filename: "{{ new_input_config_filename }}"
+      rescue:
+        - name: Validate error
+          assert:
+            that: fail_dhcp_range in dhcp_start_ip_check.msg
+            success_msg: "{{ input_config_check_success_msg }}"
+            fail_msg: "{{ input_config_check_fail_msg }}"
+      tags: TC_033
+
+    - name: Delete "{{ new_input_config_filename }}"
+      file:
+        path: "{{ new_input_config_filename }}"
+        state: absent
+      tags: TC_033
+
+# Testcase OMNIA_DIO_US_DVC_TC_034
+#Execute common role with dhcp_end_ip_range in wrong ip range
+- name: OMNIA_DIO_US_DVC_TC_034
+  hosts: localhost
+  connection: local
+  gather_subset:
+    - 'min'
+  vars_files:
+    - test_vars/test_common_vars.yml
+    - ../roles/common/vars/main.yml
+  tasks:
+    - name: Delete "{{ new_input_config_filename }}"
+      file:
+        path: "{{ new_input_config_filename }}"
+        state: absent
+      tags: TC_034
+
+    - name: Copy "{{ empty_input_config_filename }}" to new file
+      copy:
+        src: "{{ empty_input_config_filename }}"
+        dest: "{{ new_input_config_filename }}"
+      tags: TC_034
+
+    - name: Edit "{{ new_input_config_filename }}"
+      replace:
+        path: "{{ new_input_config_filename }}"
+        regexp: "{{ item.regexp }}"
+        replace: "{{ item.replace }}"
+      with_items:
+        - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
+        - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
+        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
+        - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ invalid_dhcp_ip }}\"" }
+      tags: TC_034
+
+    - block:
+        - name: Call common role
+          include_role:
+            name: ../roles/common
+            tasks_from: "{{ password_config_file }}"
+          vars:
+            input_config_filename: "{{ new_input_config_filename }}"
+      rescue:
+        - name: Validate error
+          assert:
+            that: fail_dhcp_range in dhcp_start_ip_check.msg
+            success_msg: "{{ input_config_check_success_msg }}"
+            fail_msg: "{{ input_config_check_fail_msg }}"
+      tags: TC_034
+
+    - name: Delete "{{ new_input_config_filename }}"
+      file:
+        path: "{{ new_input_config_filename }}"
+        state: absent
+      tags: TC_034

+ 1 - 37
appliance/test/test_provision_cdip.yml

@@ -78,24 +78,6 @@
         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
@@ -145,24 +127,6 @@
         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
@@ -216,4 +180,4 @@
           service:
             name: docker
             state: started
-      tags: TC_003
+      tags: TC_003

+ 9 - 5
appliance/test/test_vars/test_common_vars.yml

@@ -15,9 +15,9 @@
 
 # vars file for test_common.yml file
 centos_version: '7.8'
-test_input_config_filename: "input_config_test.yml"
-empty_input_config_filename: "input_config_empty.yml"
-new_input_config_filename: "input_config_new.yml"
+test_input_config_filename: "appliance_config_test.yml"
+empty_input_config_filename: "appliance_config_empty.yml"
+new_input_config_filename: "appliance_config_new.yml"
 password_config_file: "password_config"
 min_length_password: "testpass"
 max_length_password: "helloworld123helloworld12hello"
@@ -25,6 +25,10 @@ long_password: "helloworld123hellowordl12hello3"
 white_space_password: "hello world 123"
 special_character_password1: "hello-world/"
 special_character_password2: "hello@$%!world"
+valid_dhcp_start_range: "172.17.0.10"
+valid_dhcp_end_range: "172.17.0.200"
+invalid_dhcp_ip: "1720.1700.1000.1000"
+wrong_dhcp_ip: "d6:dh1:dsj:10"
 
 docker_volume_success_msg: "Docker volume omnia-storage exists"
 docker_volume_fail_msg: "Docker volume omnia-storage does not exist"
@@ -38,7 +42,7 @@ different_user_check_success_msg: "Different user execution check passed"
 different_user_check_fail_msg: "Different user execution check failed"
 selinux_check_success_msg: "selinux check passed"
 selinux_check_fail_msg: "selinux check failed"
-input_config_check_success_msg: "input_config.yml validation passed"
-input_config_check_fail_msg: "input_config.yml validation failed"
+input_config_check_success_msg: "appliance_config.yml validation passed"
+input_config_check_fail_msg: "appliance_config.yml validation failed"
 install_package_success_msg: "Installation of package is successful"
 install_package_fail_msg: "Installation of package is failed"

+ 4 - 4
appliance/test/test_vars/test_provision_vars.yml

@@ -25,14 +25,14 @@ 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
+ - dhcp_configure
  - cobbler_image
 password_config_file: "password_config"
-test_input_config_filename: "input_config_test.yml"
+test_input_config_filename: "appliance_config_test.yml"
 
 # Usage: test_provision_cc.yml
 docker_check_success_msg: "Docker service stopped usescase validation successful"
@@ -57,8 +57,8 @@ crontab_list_fail_msg: "Crontab list validation failed"
 crontab_list_success_msg: "Crontab list validation successful"
 iso_check_fail_msg: "centos iso file check validation failed"
 iso_check_success_msg: "centos iso file check validation successful"
-cobbler_service_check_fail_msg: "TFTP service validation failed"
-cobbler_service_check_success_msg: "TFTP service validation successful"
+cobbler_service_check_fail_msg: "cobbler service validation failed"
+cobbler_service_check_success_msg: "cobbler service validation successful"
 kickstart_filename: "centos7.ks"
 iso_file_path: "../roles/provision/files"
 temp_iso_name: "temp_centos.iso"

+ 25 - 0
appliance/tools/provision_host_report.j2

@@ -0,0 +1,25 @@
+HPC Cluster
+-----------
+Reachable Hosts:
+{% if reachable_host_number > 0 %}
+{% for host in groups['reachable'] %}
+{% if reachable_host_number == 1 %}
+  inet={{ host }}, link/ether={{ ethernet_detail_reachable.stdout | replace(';','')}}
+{% elif reachable_host_number > 1 %}
+  inet={{ host }}, link/ether={{ ethernet_detail_reachable.results[loop.index|int - 1].stdout | replace(';','')}}
+{% endif %}
+{% endfor %}
+{% endif %}
+Total reachable hosts: {{ reachable_host_number }}
+
+Unreachable Hosts:
+{% if unreachable_host_number > 0 %}
+{% for host in groups['ungrouped'] %}
+{% if unreachable_host_number == 1 %}
+  inet={{ host }}, link/ether={{ ethernet_detail_unreachable.stdout | replace(';','')}}
+{% elif unreachable_host_number > 1 %}
+  inet={{ host }}, link/ether={{ ethernet_detail_unreachable.results[loop.index|int - 1].stdout | replace(';','')}}
+{% endif %}
+{% endfor %}
+{% endif %}
+Total unreachable hosts: {{ unreachable_host_number }}

+ 83 - 0
appliance/tools/provision_report.yml

@@ -0,0 +1,83 @@
+# 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.
+---
+
+# This file used to generate a report of reachable and unreachable host of hpc cluster
+# This file can be executed only if provisioned_hosts.yml is created inside the path omnia/appliance/roles/inventory/files/provisioned_hosts.yml
+
+# Command to execute: ansible-playbook provision_report.yml -i ../roles/inventory/files/provisioned_hosts.yml
+
+- name: Find reachable hosts
+  hosts: all
+  gather_facts: false
+  ignore_unreachable: true
+  ignore_errors: true
+  tasks:
+    - name: Check for reachable nodes
+      command: ping -c1 {{ inventory_hostname }}
+      delegate_to: localhost
+      register: ping_result
+      ignore_errors: yes
+      changed_when: false
+
+    - name: Group reachable hosts
+      group_by:
+        key: "reachable"
+      when: "'100% packet loss' not in ping_result.stdout"
+
+- name: Display hosts list
+  hosts: localhost
+  connection: local
+  gather_facts: false
+  tasks:
+    - name: Set reachable and unreachable host number
+      set_fact:
+        reachable_host_number: "{{ groups['reachable'] | length}}"
+        unreachable_host_number: "{{ groups['ungrouped'] | length}}"
+
+    - name: Copy dhcpd.leases from cobbler
+      command: docker cp cobbler:/var/lib/dhcpd/dhcpd.leases dhcpd.leases
+      changed_when: true
+
+    - name: Fetch ethernet details of unreachable hosts
+      shell: sed -n '/{{ item }}/,/ethernet/p' dhcpd.leases | grep "ethernet" | awk '{ print $3 }' | uniq
+      register: ethernet_detail_unreachable
+      changed_when: false
+      args:
+        warn: no
+      with_items:
+        - "{{ groups['ungrouped'] }}"
+
+    - name: Fetch ethernet details of reachable hosts
+      shell: sed -n '/{{ item }}/,/ethernet/p' dhcpd.leases | grep "ethernet" | awk '{ print $3 }' | uniq
+      register: ethernet_detail_reachable
+      changed_when: false
+      args:
+        warn: no
+      with_items:
+        - "{{ groups['reachable'] }}"
+
+    - name: Copy host information to file
+      template:
+        src: provision_host_report.j2
+        dest: provision_host_report.txt
+
+    - name: Read provision host report
+      command: cat provision_host_report.txt
+      register: host_report
+      changed_when: false
+
+    - name: Display provision host report
+      debug:
+        var: host_report.stdout_lines

+ 6 - 6
omnia.yml

@@ -118,9 +118,9 @@
     - slurm_start_services
   tags: slurm
 
-#- name: Install slurm exporter
-# hosts: manager
-# gather_facts: false
-# roles:
-#   - slurm_exporter
-# tags: slurm
+- name: Install slurm exporter
+  hosts: manager
+  gather_facts: false
+  roles:
+    - slurm_exporter
+  tags: slurm

+ 27 - 2
roles/slurm_exporter/tasks/configure_prometheus_pod.yml

@@ -13,6 +13,31 @@
 #  limitations under the License.
 ---
 
+- name: Copy the slurm exporter config file
+  copy:
+    src: "{{ slurm_config_file }}"
+    dest: "{{ installation_dir }}"
+    owner: root
+    group: root
+    mode: "{{ file_permission }}"
+
+- name: Add the host IP to config file
+  lineinfile:
+    dest: "{{ installation_dir }}/{{ slurm_config_file }}"
+    regexp: "http:"
+    insertafter: "- targets"
+    line: "        - http://{{ inventory_hostname }}:8080/metrics"
+    state: present
+    backup: yes
+    backrefs: yes
+
+- name: Verify if slurm exporter is already configured
+  command: kubectl get service prometheus-slurmexporter-metrics-2
+  register: service_status
+  changed_when: False
+  ignore_errors: yes
+
 - name: Apply slurm exporter configuration to prometheus
-  command: kubectl apply -f "{{ role_path }}/files/{{ slurm_config_file }}" --validate=false
-  changed_when: False
+  command: kubectl apply -f "{{ installation_dir }}/{{ slurm_config_file }}" --validate=false
+  changed_when: true
+  when: "'Error from server (NotFound)' in service_status.stderr"

+ 1 - 0
roles/slurm_manager/vars/main.yml

@@ -25,6 +25,7 @@ slurm_packages:
    - perl-DBI
    - perl-Switch
    - libibumad
+   - git
 
 dev_tools:
    - rrdtool-devel