Move rebooting HW node before the booting cfg node

MOSSUST-109

Change-Id: Ic9c27851098837ee1be45d108fdec9e2489b2b97
diff --git a/jobs/pipelines/deploy-cicd-and-run-tests.groovy b/jobs/pipelines/deploy-cicd-and-run-tests.groovy
index 10536c7..24f65a7 100644
--- a/jobs/pipelines/deploy-cicd-and-run-tests.groovy
+++ b/jobs/pipelines/deploy-cicd-and-run-tests.groovy
@@ -131,11 +131,24 @@
   node ("${NODE_NAME}") {
     env.slave_workdir = pwd()
     try {
+        if (env.IPMI_CREDS) {
+            withCredentials([
+               [$class          : 'UsernamePasswordMultiBinding',
+               credentialsId   : "${IPMI_CREDS}",
+               passwordVariable: 'IPMI_PASS',
+               usernameVariable: 'IPMI_USER']
+                ]) {
+                env.IPMI_PASS = IPMI_PASS
+                env.IPMI_USER = IPMI_USER
+                shared.reboot_hardware_nodes("${IPMI_CREDS}")
+            }
+        }
 
         // run deploy stages
         deploy(shared, common, steps, env_manager, batch_size, dist_upgrade_nodes, upgrade_saltstack)
         // run test stages
         test(shared, common, steps, env_manager)
+
     } catch (e) {
         common.printMsg("Job is failed: " + e.message, "purple")
         throw e
diff --git a/jobs/templates/bm-cicd-pike-ovs-maas.yml b/jobs/templates/bm-cicd-pike-ovs-maas.yml
index cd44b20..8a51c81 100644
--- a/jobs/templates/bm-cicd-pike-ovs-maas.yml
+++ b/jobs/templates/bm-cicd-pike-ovs-maas.yml
@@ -180,12 +180,9 @@
         description: ''
         name: UPDATE_VERSION
         trim: 'false'
-    - password:
-        name: IPMI_USER
-        default: 'engineer'
-    - password:
-        name: IPMI_PASS
-        default: 'KBwdcRqwed3w2'
+    - string:
+        name: IPMI_CREDS
+        default: 'lab_engineer'
     - string:
         default: ''
         description: ''
diff --git a/jobs/templates/bm-cicd-queens-ovs-maas.yml b/jobs/templates/bm-cicd-queens-ovs-maas.yml
index b8f2ccc..be5b487 100644
--- a/jobs/templates/bm-cicd-queens-ovs-maas.yml
+++ b/jobs/templates/bm-cicd-queens-ovs-maas.yml
@@ -180,12 +180,9 @@
         description: ''
         name: UPDATE_VERSION
         trim: 'false'
-    - password:
-        name: IPMI_USER
-        default: 'engineer'
-    - password:
-        name: IPMI_PASS
-        default: 'KBwdcRqwed3w2'
+    - string:
+        name: IPMI_CREDS
+        default: 'lab_engineer'
     - string:
         default: ''
         description: ''
diff --git a/jobs/templates/bm-e7-cicd-pike-ovs-maas.yml b/jobs/templates/bm-e7-cicd-pike-ovs-maas.yml
index c85ff11..668b189 100644
--- a/jobs/templates/bm-e7-cicd-pike-ovs-maas.yml
+++ b/jobs/templates/bm-e7-cicd-pike-ovs-maas.yml
@@ -180,12 +180,9 @@
         description: ''
         name: UPDATE_VERSION
         trim: 'false'
-    - password:
-        name: IPMI_USER
-        default: 'engineer'
-    - password:
-        name: IPMI_PASS
-        default: 'K7wy5Y39g6Ii'
+    - string:
+        name: IPMI_CREDS
+        default: 'e_lab_engineer'
     - string:
         default: ''
         description: ''
diff --git a/jobs/templates/heat-bm-cicd-pike-contrail-sl.yml b/jobs/templates/heat-bm-cicd-pike-contrail-sl.yml
index ba5b6da..c52d71e 100644
--- a/jobs/templates/heat-bm-cicd-pike-contrail-sl.yml
+++ b/jobs/templates/heat-bm-cicd-pike-contrail-sl.yml
@@ -187,12 +187,9 @@
         description: ''
         name: UPDATE_VERSION
         trim: 'false'
-    - password:
-        name: IPMI_USER
-        default: 'engineer'
-    - password:
-        name: IPMI_PASS
-        default: 'KBwdcRqwed3w2'
+    - string:
+        name: IPMI_CREDS
+        default: 'lab_engineer'
     - string:
         default: ''
         description: ''
diff --git a/jobs/templates/heat-bm-cicd-queens-contrail-sl.yml b/jobs/templates/heat-bm-cicd-queens-contrail-sl.yml
index a46b7c1..1d7c0bc 100644
--- a/jobs/templates/heat-bm-cicd-queens-contrail-sl.yml
+++ b/jobs/templates/heat-bm-cicd-queens-contrail-sl.yml
@@ -188,12 +188,9 @@
         description: ''
         name: UPDATE_VERSION
         trim: 'false'
-    - password:
-        name: IPMI_USER
-        default: 'engineer'
-    - password:
-        name: IPMI_PASS
-        default: 'KBwdcRqwed3w2'
+    - string:
+        name: IPMI_CREDS
+        default: 'lab_engineer'
     - string:
         default: ''
         description: ''