Add changes for validation pipeline.

The changes allow to validate the cloud.

Change-Id: I745601f9e7dcd790f284333dc82633edc144b07e
diff --git a/validate-cloud.groovy b/validate-cloud.groovy
new file mode 100644
index 0000000..6c25071
--- /dev/null
+++ b/validate-cloud.groovy
@@ -0,0 +1,61 @@
+/**
+ *
+ * Launch validation of the cloud
+ *
+ * Expected parameters:
+ *   SALT_MASTER_URL             URL of Salt master
+ *   SALT_MASTER_CREDENTIALS     Credentials to the Salt API
+ *
+ *   TEST_IMAGE                  Docker image link
+ *   TARGET_NODE                 Salt target for tempest node
+ *   TEMPEST_TEST_SET            If not false, run tests matched to pattern only
+ *   RUN_TEMPEST_TESTS           If not false, run Tempest tests
+ *   RUN_RALLY_TESTS             If not false, run Rally tests
+ *
+ */
+
+common = new com.mirantis.mk.Common()
+salt = new com.mirantis.mk.Salt()
+validate = new com.mirantis.mcp.Validate()
+
+def saltMaster
+def artifacts_dir = 'validation_artifacts/'
+
+node() {
+    try{
+        stage('Initialization') {
+            saltMaster = salt.connection(SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
+        }
+
+        stage('Configure') {
+            validate.installDocker(saltMaster, TARGET_NODE)
+            sh "mkdir -p ${artifacts_dir}"
+            validate.runContainerConfiguration(saltMaster, TEST_IMAGE, TARGET_NODE, artifacts_dir)
+        }
+
+        stage('Run Tempest tests') {
+            if (RUN_TEMPEST_TESTS.toBoolean() == true) {
+                validate.runTempestTests(saltMaster, TARGET_NODE, artifacts_dir, TEMPEST_TEST_SET)
+            } else {
+                common.infoMsg("Skipping Tempest tests")
+            }
+        }
+
+        stage('Run Rally tests') {
+            if (RUN_RALLY_TESTS.toBoolean() == true) {
+                validate.runRallyTests(saltMaster, TARGET_NODE, artifacts_dir)
+            } else {
+                common.infoMsg("Skipping Rally tests")
+            }
+        }
+        stage('Collect results') {
+            archiveArtifacts artifacts: "${artifacts_dir}/*"
+        }
+    } catch (Throwable e) {
+        // If there was an error or exception thrown, the build failed
+        currentBuild.result = "FAILURE"
+        throw e
+    } finally {
+        validate.runCleanup(saltMaster, TARGET_NODE, artifacts_dir)
+    }
+}