Kaynağa Gözat

Issue #265: Test automation script updates due to appliance_config.yml changes

Signed-off-by: shubhangi_srivastava <shubhangi_srivastava@dell.com>
Shubhangi-dell 4 yıl önce
ebeveyn
işleme
788791e068

+ 10 - 3
appliance/test/appliance_config_empty.yml

@@ -32,11 +32,18 @@ hpc_nic: "em1"
 # Default value of nic is em2
 public_nic: "em2"
 
+# This is the  path where user has kept the iso image that needs to be provisioned in target nodes.
+# The iso file should be CentOS7-2009-minimal edition.
+# Other iso file not supported.
+iso_file_path: ""
+
 # 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: ""
+# A template for mapping file exists in omnia/examples and is named as mapping_file.csv.
+# This depicts the path where user has kept the mapping file for DHCP configurations.
+mapping_file_path: ""
 
-# The dhcp range for assigning the IP address to the baremetal nodes.
+# The dhcp range for assigning the IPv4 address to the baremetal nodes.
+# Example: 10.1.23.1
 dhcp_start_ip_range: ""
 dhcp_end_ip_range: ""

+ 11 - 4
appliance/test/appliance_config_test.yml

@@ -32,11 +32,18 @@ hpc_nic: "em1"
 # Default value of nic is em2
 public_nic: "em2"
 
+# This is the  path where user has kept the iso image that needs to be provisioned in target nodes.
+# The iso file should be CentOS7-2009-minimal edition.
+# Other iso file not supported.
+iso_file_path: "/root/CentOS-7-x86_64-Minimal-2009.iso"
+
 # 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"
+# A template for mapping file exists in omnia/examples and is named as mapping_file.csv.
+# This depicts the path where user has kept the mapping file for DHCP configurations.
+mapping_file_path: ""
 
-# The dhcp range for assigning the IP address to the baremetal nodes.
-dhcp_start_ip_range: "172.17.0.20"
+# The dhcp range for assigning the IPv4 address to the baremetal nodes.
+# Example: 10.1.23.1
+dhcp_start_ip_range: "172.17.0.10"
 dhcp_end_ip_range: "172.17.0.100"

+ 45 - 34
appliance/test/test_common.yml

@@ -361,7 +361,7 @@
         replace: "{{ item.replace }}"
       with_items:
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { 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
@@ -417,7 +417,7 @@
         replace: "{{ item.replace }}"
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { 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
@@ -444,7 +444,7 @@
       tags: TC_009
 
 # Testcase OMNIA_DIO_US_DVC_TC_010
-# Execute common role in management station with mapping_file_exists as empty
+# Execute common role in management station with iso_file_path as empty
 - name: OMNIA_DIO_US_DVC_TC_010
   hosts: localhost
   connection: local
@@ -488,7 +488,7 @@
       rescue:
         - name: Validate error
           assert:
-            that: fail_mapping_file in mapping_file_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_010
@@ -530,7 +530,7 @@
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ long_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { 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
@@ -587,7 +587,7 @@
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ white_space_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { 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
@@ -644,7 +644,7 @@
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ special_character_password1 }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { 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
@@ -701,7 +701,7 @@
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ special_character_password2 }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { 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
@@ -758,7 +758,7 @@
       with_items:
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ long_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { 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
@@ -815,7 +815,7 @@
       with_items:
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ white_space_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { 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
@@ -872,7 +872,7 @@
       with_items:
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ special_character_password1 }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { 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
@@ -929,7 +929,7 @@
       with_items:
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ special_character_password2 }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { 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
@@ -956,7 +956,7 @@
       tags: TC_018
 
 # Testcase OMNIA_DIO_US_DVC_TC_019
-# Execute common role in management station with mapping_file_exists status as true
+# Execute common role in management station with valid iso_file_path
 - name: OMNIA_DIO_US_DVC_TC_019
   hosts: localhost
   connection: local
@@ -986,7 +986,7 @@
       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: \"true\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { 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
@@ -1001,7 +1001,7 @@
       always:
         - name: Validate success message
           assert:
-            that: success_mapping_file in mapping_file_check.msg
+            that: result_path_iso_file.stat.exists == true
             success_msg: "{{ input_config_check_success_msg }}"
             fail_msg: "{{ input_config_check_fail_msg }}"
       tags: TC_019
@@ -1013,7 +1013,7 @@
       tags: TC_019
 
 # Testcase OMNIA_DIO_US_DVC_TC_020
-# Execute common role in management station with mapping_file_exists status other than true or false
+# Execute common role in management station with wrong iso_file_path
 - name: OMNIA_DIO_US_DVC_TC_020
   hosts: localhost
   connection: local
@@ -1043,7 +1043,7 @@
       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: \"test\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ wrong_iso_path }}\"" }
         - { 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
@@ -1056,9 +1056,14 @@
           vars:
             input_config_filename: "{{ new_input_config_filename }}"
       rescue:
+        - name: Check log file
+          command: tail /var/log/omnia.log
+          register: iso_fail_log_check
+          changed_when: false
+            
         - name: Validate error
           assert:
-            that: fail_mapping_file in mapping_file_check.msg
+            that: invalid_iso_file_path in iso_fail_log_check.stdout
             success_msg: "{{ input_config_check_success_msg }}"
             fail_msg: "{{ input_config_check_fail_msg }}"
       tags: TC_020
@@ -1100,7 +1105,7 @@
       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: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_end_ip_range: \"\"", replace: "dhcp_end_ip_range: \"{{ valid_dhcp_end_range }}\"" }
       tags: TC_021
 
@@ -1156,7 +1161,7 @@
       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: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { regexp: "dhcp_start_ip_range: \"\"", replace: "dhcp_start_ip_range: \"{{ valid_dhcp_start_range }}\"" }
       tags: TC_022
 
@@ -1182,7 +1187,7 @@
       tags: TC_022
 
 # Testcase OMNIA_DIO_US_DVC_TC_023
-# Execute common role in management station with mapping_file_exists status as false
+# Execute common role in management station with mapping_file_path provided
 - name: OMNIA_DIO_US_DVC_TC_023
   hosts: localhost
   connection: local
@@ -1212,7 +1217,8 @@
       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: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
+        - { regexp: "mapping_file_path: \"\"", replace: "mapping_file_path: \"{{ valid_mapping_file_path }}\"" }
         - { 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
@@ -1225,9 +1231,14 @@
           vars:
             input_config_filename: "{{ new_input_config_filename }}"
       always:
+        - name: Check log file
+          command: tail -100 /var/log/omnia.log
+          register: mapping_success_log_check
+          changed_when: false
+          
         - name: Validate success message
           assert:
-            that: success_mapping_file in mapping_file_check.msg
+            that: success_mapping_file in mapping_success_log_check.stdout
             success_msg: "{{ input_config_check_success_msg }}"
             fail_msg: "{{ input_config_check_fail_msg }}"
       tags: TC_023
@@ -1269,7 +1280,7 @@
       with_items:
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ max_length_password }}\"" }
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { 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
@@ -1326,7 +1337,7 @@
       with_items:
         - { regexp: "provision_password: \"\"", replace: "provision_password: \"{{ max_length_password }}\"" }
         - { regexp: "awx_password: \"\"", replace: "awx_password: \"{{ min_length_password }}\"" }
-        - { regexp: "mapping_file_exists: \"\"", replace: "mapping_file_exists: \"false\"" }
+        - { regexp: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { 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
@@ -1383,7 +1394,7 @@
       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: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { 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\"" }
@@ -1441,7 +1452,7 @@
       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: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { 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: \"\"" }
@@ -1499,7 +1510,7 @@
       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: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { 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: \"\"" }
@@ -1557,7 +1568,7 @@
       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: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { 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\"" }
@@ -1615,7 +1626,7 @@
       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: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { 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\"" }
@@ -1673,7 +1684,7 @@
       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: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { 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
@@ -1730,7 +1741,7 @@
       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: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { 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
@@ -1787,7 +1798,7 @@
       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: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { 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
@@ -1844,7 +1855,7 @@
       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: "iso_file_path: \"\"", replace: "iso_file_path: \"{{ valid_iso_path }}\"" }
         - { 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

+ 2 - 0
appliance/test/test_mapping_file

@@ -0,0 +1,2 @@
+Mac,Hostname,IP
+xx:yy:zz:aa:bb,validation-host1,172.20.0.21

+ 2 - 55
appliance/test/test_provision_cc.yml

@@ -21,10 +21,11 @@
   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 }}/{{ iso_name }}"
+        path: "{{ iso_file_path }}"
       register: iso_status
       tags: TC_004
 
@@ -605,57 +606,3 @@
         fail_msg: "{{ cobbler_reboot_fail_msg }}"
         success_msg: "{{ cobbler_reboot_success_msg }}"
       tags: TC_007,VERIFY_007
-
-# Testcase OMNIA_DIO_US_CC_TC_008
-# Execute provison role in management station with centos iso file not present in files folder of provision role
-- name: OMNIA_DIO_US_CC_TC_008
-  hosts: localhost
-  connection: local
-  vars_files:
-    - test_vars/test_provision_vars.yml
-    - ../roles/provision/vars/main.yml
-  tasks:
-    - name: Check the iso file is present
-      stat:
-        path: "{{ iso_file_path }}/{{ iso_name }}"
-      register: iso_status
-      tags: TC_008
-
-    - name: Copy iso file to different name
-      copy:
-        src: "{{ iso_file_path }}/{{ iso_name }}"
-        dest: "{{ iso_file_path }}/{{ temp_iso_name }}"
-      when: iso_status.stat.exists == true
-      tags: TC_008
-
-    - name: Delete iso file
-      file:
-        path: "{{ iso_file_path }}/{{ iso_name }}"
-        state: "absent"
-      when: iso_status.stat.exists == true
-      tags: TC_008
-
-    - 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
-      rescue:
-        - name: Validate iso missing error
-          assert:
-            that: iso_fail in iso_file_check.msg
-            success_msg: "{{ iso_check_success_msg }}"
-            fail_msg: "{{ iso_check_fail_msg }}"
-      tags: TC_008
-
-    - name: Copy iso file to old name
-      copy:
-        src: "{{ iso_file_path }}/{{ temp_iso_name }}"
-        dest: "{{ iso_file_path }}/{{ iso_name }}"
-      when: iso_status.stat.exists == true
-      tags: TC_008

+ 3 - 0
appliance/test/test_vars/test_common_vars.yml

@@ -29,6 +29,9 @@ 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"
+valid_iso_path: "/root/CentOS-7-x86_64-Minimal-2009.iso"
+wrong_iso_path: "/root/testfile"
+valid_mapping_file_path: "test_mapping_file"
 
 docker_volume_success_msg: "Docker volume omnia-storage exists"
 docker_volume_fail_msg: "Docker volume omnia-storage does not exist"

+ 0 - 25
appliance/tools/provision_host_report.j2

@@ -1,25 +0,0 @@
-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 }}

+ 40 - 42
appliance/tools/provision_report.yml

@@ -18,7 +18,14 @@
 
 # Command to execute: ansible-playbook provision_report.yml -i ../roles/inventory/files/provisioned_hosts.yml
 
-- name: Find reachable hosts
+- name: Fetch provision_password
+  hosts: localhost
+  connection: local
+  gather_facts: no
+  roles:
+    - fetch_password
+
+- name: Find reachable hosts using ping
   hosts: all
   gather_facts: false
   ignore_unreachable: true
@@ -31,53 +38,44 @@
       ignore_errors: yes
       changed_when: false
 
+    - name: Refresh ssh keys
+      command: ssh-keygen -R {{ inventory_hostname }}
+      delegate_to: localhost
+      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
+- name: Find reachable hosts using ssh
+  hosts: reachable
+  gather_facts: False
+  ignore_unreachable: true
+  remote_user: "root"
+  vars:
+    ansible_password: "{{ hostvars['127.0.0.1']['cobbler_password'] }}"
+    ansible_become_pass: "{{ hostvars['127.0.0.1']['cobbler_password'] }}"
+    ansible_ssh_common_args: '-o StrictHostKeyChecking=no'
   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: Check ssh status
+      command: hostname
+      register: ssh_status
+      ignore_errors: yes
 
-    - name: Copy host information to file
-      template:
-        src: provision_host_report.j2
-        dest: provision_host_report.txt
+    - name: Group unreachable ssh hosts
+      group_by:
+        key: "unreachable_ssh"
+      when: ssh_status.unreachable is defined and ssh_status.unreachable == true
 
-    - name: Read provision host report
-      command: cat provision_host_report.txt
-      register: host_report
-      changed_when: false
+    - name: Group reachable ssh hosts
+      group_by:
+        key: "reachable_ssh"
+      when: (ssh_status.unreachable is defined and ssh_status.unreachable == false) or (ssh_status.rc is defined and ssh_status.rc == 0)
 
-    - name: Display provision host report
-      debug:
-        var: host_report.stdout_lines
+- name: Display hosts list
+  hosts: localhost
+  connection: local
+  gather_facts: false
+  roles:
+    - hpc_cluster_report

+ 3 - 1
appliance/tools/roles/fetch_password/tasks/main.yml

@@ -30,11 +30,13 @@
 
 - name: Include variable file appliance_config.yml
   include_vars: "{{ role_path }}/../../../{{ input_config_filename }}"
+  no_log: true
 
 - name: Save input variables from file
   set_fact:
     cobbler_password: "{{ provision_password }}"
-
+  no_log: true
+  
 - name: Encrypt input config file
   command: >-
     ansible-vault encrypt {{ role_path }}/../../../{{ input_config_filename }}

+ 91 - 0
appliance/tools/roles/hpc_cluster_report/tasks/main.yml

@@ -0,0 +1,91 @@
+# 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.
+---
+
+- name: Initialize reachable and unreachable host number
+  set_fact:
+    reachable_host_number: 0
+    unreachable_host_number: 0
+    unreachable_ssh_host_number: 0
+    unreachable_ping_host_number: 0
+
+- name: Set reachable host number
+  set_fact:
+    reachable_host_number: "{{ groups['reachable_ssh'] | length}}"
+  when: groups['reachable_ssh'] is defined
+
+- name: Set unreachable host number
+  set_fact:
+    unreachable_host_number: "{{ groups['ungrouped'] | length | int + groups['unreachable_ssh'] | length | int }}"
+    unreachable_ssh_host_number: "{{ groups['unreachable_ssh'] | length }}"
+    unreachable_ping_host_number: "{{ groups['ungrouped'] | length }}"
+  when: groups['unreachable_ssh'] is defined
+
+- name: Set unreachable host number
+  set_fact:
+    unreachable_host_number: "{{ groups['ungrouped'] | length }}"
+    unreachable_ping_host_number: "{{ groups['ungrouped'] | length }}"
+  when: groups['unreachable_ssh'] is not defined
+            
+- name: Create files folder
+  file:
+    path: "{{ role_path}}/files"
+    state: directory
+    
+- name: Copy dhcpd.leases from cobbler
+  command: docker cp cobbler:/var/lib/dhcpd/dhcpd.leases {{ role_path}}/files/dhcpd.leases
+  changed_when: true
+
+- name: Fetch ethernet details of unreachable hosts
+  shell: sed -n '/{{ item }}/,/ethernet/p' {{ role_path}}/files/dhcpd.leases | grep "ethernet" | awk '{ print $3 }' | uniq
+  register: ethernet_detail_unreachable_ping
+  changed_when: false
+  args:
+    warn: no
+  with_items:
+    - "{{ groups['ungrouped'] }}"
+
+- name: Fetch ethernet details of unreachable hosts
+  shell: sed -n '/{{ item }}/,/ethernet/p' {{ role_path}}/files/dhcpd.leases | grep "ethernet" | awk '{ print $3 }' | uniq
+  register: ethernet_detail_unreachable_ssh
+  changed_when: false
+  args:
+    warn: no
+  when: groups['unreachable_ssh'] is defined
+  with_items:
+    - "{{ groups['unreachable_ssh'] }}"
+
+- name: Fetch ethernet details of reachable hosts
+  shell: sed -n '/{{ item }}/,/ethernet/p' {{ role_path}}/files/dhcpd.leases | grep "ethernet" | awk '{ print $3 }' | uniq
+  register: ethernet_detail_reachable
+  changed_when: false
+  args:
+    warn: no
+  when: groups['reachable_ssh'] is defined
+  with_items:
+    - "{{ groups['reachable_ssh'] }}"
+
+- name: Copy host information to file
+  template:
+    src: provision_host_report.j2
+    dest: "{{ role_path}}/files/provision_host_report.txt"
+
+- name: Read provision host report
+  command: cat {{ role_path}}/files/provision_host_report.txt
+  register: host_report
+  changed_when: false
+
+- name: Display provision host report
+  debug:
+    var: host_report.stdout_lines

+ 38 - 0
appliance/tools/roles/hpc_cluster_report/templates/provision_host_report.j2

@@ -0,0 +1,38 @@
+HPC Cluster
+-----------
+Reachable Hosts:
+{% if reachable_host_number > 0 %}
+{% for host in groups['reachable_ssh'] %}
+{% if reachable_host_number == 1 %}
+  inet={{ host }}, link/ether={{ ethernet_detail_reachable.stdout | replace(';','')}}
+{% elif reachable_host_number > 1 %}
+{% if ethernet_detail_reachable.results[loop.index|int - 1].stdout | length > 1 %}
+  inet={{ host }}, link/ether={{ ethernet_detail_reachable.results[loop.index|int - 1].stdout | replace(';','')}}
+{% else %}
+  inet={{ host }}, link/ether=Refer to mapping file provided
+{% endif %}
+{% endif %}
+{% endfor %}
+{% endif %}
+Total reachable hosts: {{ reachable_host_number }}
+
+Unreachable Hosts:
+{% if unreachable_ping_host_number > 0 %}
+{% for host in groups['ungrouped'] %}
+{% if unreachable_ping_host_number == 1 %}
+  inet={{ host }}, link/ether={{ ethernet_detail_unreachable_ping.stdout | replace(';','')}}
+{% elif unreachable_ping_host_number > 1 %}
+  inet={{ host }}, link/ether={{ ethernet_detail_unreachable_ping.results[loop.index|int - 1].stdout | replace(';','')}}
+{% endif %}
+{% endfor %}
+{% endif %}
+{% if unreachable_ssh_host_number > 0 %}
+{% for host in groups['unreachable_ssh'] %}
+{% if unreachable_ssh_host_number == 1 %}
+  inet={{ host }}, link/ether={{ ethernet_detail_unreachable_ssh.stdout | replace(';','')}}
+{% elif unreachable_ssh_host_number > 1 %}
+  inet={{ host }}, link/ether={{ ethernet_detail_unreachable_ssh.results[loop.index|int - 1].stdout | replace(';','')}}
+{% endif %}
+{% endfor %}
+{% endif %}
+Total unreachable hosts: {{ unreachable_host_number }}