adding all stages in pipeline code

Change-Id: I347977bf858e82481b4cd5db99037dda7c98aebe
diff --git a/Jenkinsfile-mcord-new-build-vms b/Jenkinsfile-mcord-new-build-vms
index 48b0d44..b2ec767 100644
--- a/Jenkinsfile-mcord-new-build-vms
+++ b/Jenkinsfile-mcord-new-build-vms
@@ -11,68 +11,81 @@
 // 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.
-
 node("intel-102") {
-  timeout (120) {
+  timeout (240) {
     try {
-      stage("Cleanup") {
-        sh returnStdout: true, script: """
-        ssh c3po-mme1 "killall mme-app"
-        """
-        // TODO add kill and cleanup steps
-      }
       stage("Lisitng the VM") {
-        sh returnStdout: true, script: """
-        virsh list --all
-        """
         timeout(1) {
           waitUntil {
             running_vms = sh returnStdout: true, script: """
-            virsh list --all | grep "c3po-mme1\|c3po-hss1\|ngic-cp1\|ngic-dp1\|c3po-dbn1" | grep -i running | wc -l
+            virsh list --all
             """
+            echo "Running VMs: ${running_vms}"
+            return true
+          }
+        }
+        timeout(1) {
+          waitUntil {
+            running_vms = sh returnStdout: true, script: """
+            virsh list --all | grep "c3po-mme1\\|c3po-hss1\\|ngic-cp1\\|ngic-dp1\\|c3po-dbn1" | grep -i running | wc -l
+            """
+            echo "Running VMs: ${running_vms}"
             return running_vms.toInteger() >= 5
           }
         }
       }
-      stage("Connecting to ngic-dp1") {
-        sh returnStdout: true, script: """
-        ssh ngic-dp1 "test.sh"
-        """
-      }
       stage("Connecting to ngic-cp1") {
         sh returnStdout: true, script: """
-        sleep 10;
-        ssh ngic-cp1 "test.sh"
+        ssh ngic-cp1 'if pgrep -f [n]gic_controlplane; then pkill -f [n]gic_controlplane; fi'
+        ssh ngic-cp1 'cd /home/ngic-rtc/cp && (./run.sh > /dev/null 2>&1 &)'
+        sleep 1;
+        ssh ngic-cp1 'pgrep -f ngic_controlplane'
         """
       }
-      stage("Connecting to c3po-hss1") {
+      stage("Connecting to ngic-dp1") {
         sh returnStdout: true, script: """
-        ssh c3po-hss1 "test.sh"
+        ssh ngic-dp1 'if pgrep -f [n]gic_dataplane; then pkill -f [n]gic_dataplane; fi'
+        ssh ngic-dp1 'cd /home/ngic-rtc/dp && (./run.sh > /dev/null 2>&1 &)'
+        sleep 10;
+        ssh ngic-dp1 'cd /home/ngic-rtc/kni_ifcfg && ./kni-SGIdevcfg.sh'
+        ssh ngic-dp1 'cd /home/ngic-rtc/kni_ifcfg && ./kni-S1Udevcfg.sh'
+        ssh ngic-dp1 'pgrep -f ngic_dataplane'
         """
       }
       stage("Connecting to c3po-mme1") {
         sh returnStdout: true, script: """
-        ssh c3po-mme1 "test.sh"
+        ssh c3po-mme1 'if pgrep -f [m]me-app; then pkill -f [m]me-app; fi'
+        ssh c3po-mme1 'if pgrep -f [s]1ap-app; then pkill -f [s]1ap-app; fi'
+        ssh c3po-mme1 'if pgrep -f [s]11-app; then pkill -f [s]11-app; fi'
+        ssh c3po-mme1 'if pgrep -f [s]6a-app; then pkill -f [s]6a-app; fi'
+        sleep 1;
+        ssh c3po-mme1 'cd /home/openmme/src/mme-app && export LD_LIBRARY_PATH=../common/ && (./mme-app > /dev/null 2>&1 &)'
+        ssh c3po-mme1 'cd /home/openmme/src/s1ap && export LD_LIBRARY_PATH=../common/ && (./s1ap-app > /dev/null 2>&1 &)'
+        ssh c3po-mme1 'cd /home/openmme/src/s11 && export LD_LIBRARY_PATH=../common/ && (./s11-app > /dev/null 2>&1 &)'
+        ssh c3po-mme1 'cd /home/openmme/src/s6a && export LD_LIBRARY_PATH=../common/ && (./s6a-app > /dev/null 2>&1 &)'
+        sleep 2;
+        ssh c3po-mme1 'pgrep mme-app && pgrep s1ap-app && pgrep s11-app && pgrep s6a-app'
         """
       }
       stage("Connecting to Polaris") {
-        sh returnStdout: true, script: """
-        ssh polaris "> test-output.log"
-        ssh polaris "test.sh > test-output.log"
-        """
         timeout(10) {
           waitUntil {
             test_output = sh returnStdout: true, script: """
-            ssh polaris "cat test-output.log | grep -i SUCCESS | wc -l"
+            ssh polaris 'cd /root/LTELoadTester && nettest -emulator 127.0.0.1:5678:enb,127.0.0.1:6789:ipte Attach-Detach-wdata.tcl > test-output.log'
+            ssh polaris 'cd /root/LTELoadTester && cat test-output.log'
             """
-            return test_output.toInteger() >= 1
+            echo "Polaris log: ${test_output}"
+            return true
           }
         }
+
+        sh returnStdout: true, script: """
+        ssh polaris 'cd /root/LTELoadTester && grep -P -o "Test pass percentage.*?100%" test-output.log'
+        """
       }
       currentBuild.result = 'SUCCESS'
     } catch (err) {
       currentBuild.result = 'FAILURE'
-      step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false])
     }
     echo "RESULT: ${currentBuild.result}"
   }