Merge pull request #132 from opennetworkinglab/devl/functionality

Update git pull to be a params variable
diff --git a/TestON/tests/MultiProd/MultiProd.params b/TestON/tests/MultiProd/MultiProd.params
index f08257b..3767ab9 100755
--- a/TestON/tests/MultiProd/MultiProd.params
+++ b/TestON/tests/MultiProd/MultiProd.params
@@ -1,11 +1,15 @@
 <PARAMS>
-    
+
     <testcases>1,4,10,5,6,7,8,6,8,9,8,31,32,8,33,8,20,21,22,10,23,24</testcases>
     #Environment variables
     <ENV>
         <cellName>multi_test</cellName>
     </ENV>
 
+    <GIT>
+        <pull>False</pull>
+    </GIT>
+
     <CTRL>
         <ip1>10.128.20.11</ip1>
         <ip2>10.128.20.12</ip2>
diff --git a/TestON/tests/MultiProd/MultiProd.py b/TestON/tests/MultiProd/MultiProd.py
index 44a828c..6bf405b 100644
--- a/TestON/tests/MultiProd/MultiProd.py
+++ b/TestON/tests/MultiProd/MultiProd.py
@@ -35,6 +35,7 @@
         ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
         ONOS2Port = main.params[ 'CTRL' ][ 'port2' ]
         ONOS3Port = main.params[ 'CTRL' ][ 'port3' ]
+        gitPull = main.params[ 'GIT' ][ 'pull' ]
 
         main.case( "Setting up test environment" )
         main.log.report(
@@ -52,20 +53,25 @@
         main.step( "Removing raft logs before a clen installation of ONOS" )
         removeLogResult = main.ONOSbench.onosRemoveRaftLogs()
 
-        main.step( "Git checkout, pull and get version" )
+        main.step( "Git checkout and get version" )
         main.ONOSbench.gitCheckout( "master" )
-        gitPullResult = main.ONOSbench.gitPull()
-        main.log.info( "git_pull_result = " + str( gitPullResult ))
-        versionResult = main.ONOSbench.getVersion( report=True )
-
+        if gitPull == 'True':
+            gitPullResult = main.ONOSbench.gitPull()
+            if gitPullResult == 1:
+                main.step( "Using mvn clean & install" )
+                main.ONOSbench.cleanInstall()
+                main.step( "Creating ONOS package" )
+                packageResult = main.ONOSbench.onosPackage()
+            elif gitPullResult == 0:
+                main.log.report(
+                    "Git Pull Failed, look into logs for detailed reason" )
+                main.cleanup()
+                main.exit()
+            main.log.info( "git_pull_result = " + str( gitPullResult ))
+        else:
+            main.log.info( "Skipping git pull" )
+        main.ONOSbench.getVersion( report=True )
         packageResult = main.TRUE
-        if gitPullResult == 100:
-            main.step( "Using mvn clean & install" )
-            cleanInstallResult = main.ONOSbench.cleanInstall()
-            main.step( "Creating ONOS package" )
-            packageResult = main.ONOSbench.onosPackage()
-            # cleanInstallResult = main.TRUE
-
 
         # main.step( "Creating a cell" )
         # cellCreateResult = main.ONOSbench.createCellFile( **************
diff --git a/TestON/tests/MultiProd13/MultiProd13.params b/TestON/tests/MultiProd13/MultiProd13.params
index f08257b..3767ab9 100755
--- a/TestON/tests/MultiProd13/MultiProd13.params
+++ b/TestON/tests/MultiProd13/MultiProd13.params
@@ -1,11 +1,15 @@
 <PARAMS>
-    
+
     <testcases>1,4,10,5,6,7,8,6,8,9,8,31,32,8,33,8,20,21,22,10,23,24</testcases>
     #Environment variables
     <ENV>
         <cellName>multi_test</cellName>
     </ENV>
 
+    <GIT>
+        <pull>False</pull>
+    </GIT>
+
     <CTRL>
         <ip1>10.128.20.11</ip1>
         <ip2>10.128.20.12</ip2>
diff --git a/TestON/tests/MultiProd13/MultiProd13.py b/TestON/tests/MultiProd13/MultiProd13.py
index 93df4c2..ee62ce7 100644
--- a/TestON/tests/MultiProd13/MultiProd13.py
+++ b/TestON/tests/MultiProd13/MultiProd13.py
@@ -35,6 +35,7 @@
         ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
         ONOS2Port = main.params[ 'CTRL' ][ 'port2' ]
         ONOS3Port = main.params[ 'CTRL' ][ 'port3' ]
+        gitPull = main.params[ 'GIT' ][ 'pull' ]
 
         main.case( "Setting up test environment" )
         main.log.report(
@@ -52,20 +53,25 @@
         main.step( "Removing raft logs before a clen installation of ONOS" )
         removeLogResult = main.ONOSbench.onosRemoveRaftLogs()
 
-        main.step( "Git checkout, pull and get version" )
+        main.step( "Git checkout and get version" )
         main.ONOSbench.gitCheckout( "master" )
-        gitPullResult = main.ONOSbench.gitPull()
-        main.log.info( "git_pull_result = " + str( gitPullResult ))
-        versionResult = main.ONOSbench.getVersion( report=True )
-
+        if gitPull == 'True':
+            gitPullResult = main.ONOSbench.gitPull()
+            if gitPullResult == 1:
+                main.step( "Using mvn clean & install" )
+                main.ONOSbench.cleanInstall()
+                main.step( "Creating ONOS package" )
+                packageResult = main.ONOSbench.onosPackage()
+            elif gitPullResult == 0:
+                main.log.report(
+                    "Git Pull Failed, look into logs for detailed reason" )
+                main.cleanup()
+                main.exit()
+            main.log.info( "git_pull_result = " + str( gitPullResult ))
+        else:
+            main.log.info( "Skipping git pull" )
+        main.ONOSbench.getVersion( report=True )
         packageResult = main.TRUE
-        if gitPullResult == 100:
-            main.step( "Using mvn clean & install" )
-            cleanInstallResult = main.ONOSbench.cleanInstall()
-            main.step( "Creating ONOS package" )
-            packageResult = main.ONOSbench.onosPackage()
-            # cleanInstallResult = main.TRUE
-
 
         # main.step( "Creating a cell" )
         # cellCreateResult = main.ONOSbench.createCellFile( **************
diff --git a/TestON/tests/ProdFunc/ProdFunc.params b/TestON/tests/ProdFunc/ProdFunc.params
index 5f1ec30..c8e125b 100755
--- a/TestON/tests/ProdFunc/ProdFunc.params
+++ b/TestON/tests/ProdFunc/ProdFunc.params
@@ -5,7 +5,9 @@
     <ENV>
         <cellName>driver_test</cellName>
     </ENV>
-
+    <GIT>
+        <pull>True</pull>
+    </GIT>
     <CTRL>
         <ip1>10.128.20.11</ip1>
         <port1>6633</port1>
diff --git a/TestON/tests/ProdFunc/ProdFunc.py b/TestON/tests/ProdFunc/ProdFunc.py
index 9c2c271..adbdb24 100644
--- a/TestON/tests/ProdFunc/ProdFunc.py
+++ b/TestON/tests/ProdFunc/ProdFunc.py
@@ -31,6 +31,7 @@
         """
         cellName = main.params[ 'ENV' ][ 'cellName' ]
         ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+        gitPull = main.params[ 'GIT' ][ 'pull' ]
 
         main.case( "Setting up test environment" )
         main.log.report(
@@ -43,22 +44,23 @@
 
         main.step( "Git checkout and get version" )
         main.ONOSbench.gitCheckout( "master" )
-        gitPullResult = main.ONOSbench.gitPull()
-        main.log.info( "git_pull_result = " + str( gitPullResult ))
+        if gitPull == 'True':
+            gitPullResult = main.ONOSbench.gitPull()
+            if gitPullResult == 1:
+                main.step( "Using mvn clean & install" )
+                main.ONOSbench.cleanInstall()
+                main.step( "Creating ONOS package" )
+                packageResult = main.ONOSbench.onosPackage()
+            elif gitPullResult == 0:
+                main.log.report(
+                    "Git Pull Failed, look into logs for detailed reason" )
+                main.cleanup()
+                main.exit()
+            main.log.info( "git_pull_result = " + str( gitPullResult ))
+        else:
+            main.log.info( "Skipping git pull" )
         main.ONOSbench.getVersion( report=True )
-
         packageResult = main.TRUE
-        if gitPullResult == 1:
-            main.step( "Using mvn clean & install" )
-            main.ONOSbench.cleanInstall()
-            main.step( "Creating ONOS package" )
-            packageResult = main.ONOSbench.onosPackage()
-        elif gitPullResult == 0:
-            main.log.report(
-                "Git Pull Failed, look into logs for detailed reason" )
-            main.cleanup()
-            main.exit()
-
 
         main.step( "Uninstalling ONOS package" )
         onosInstallResult = main.ONOSbench.onosUninstall( ONOS1Ip )
diff --git a/TestON/tests/ProdFunc13/ProdFunc13.params b/TestON/tests/ProdFunc13/ProdFunc13.params
index 4367bf4..b926dad 100755
--- a/TestON/tests/ProdFunc13/ProdFunc13.params
+++ b/TestON/tests/ProdFunc13/ProdFunc13.params
@@ -1,11 +1,13 @@
 <PARAMS>
-    
+    #1,4,10,5,6,7,8,9,8,11,8,20,21,22,10,23,24
     <testcases>1,4,10,5,6,7,8,9,8,11,8,2,20,21,22,10,23,24</testcases>
     #Environment variables
     <ENV>
         <cellName>driver_test</cellName>
     </ENV>
-
+    <GIT>
+        <pull>False</pull>
+    </GIT>
     <CTRL>
         <ip1>10.128.20.11</ip1>
         <port1>6633</port1>
diff --git a/TestON/tests/ProdFunc13/ProdFunc13.py b/TestON/tests/ProdFunc13/ProdFunc13.py
index b3e456b..ade6d07 100644
--- a/TestON/tests/ProdFunc13/ProdFunc13.py
+++ b/TestON/tests/ProdFunc13/ProdFunc13.py
@@ -31,6 +31,7 @@
         """
         cellName = main.params[ 'ENV' ][ 'cellName' ]
         ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+        gitPull = main.params[ 'GIT' ][ 'pull' ]
 
         main.case( "Setting up test environment" )
         main.log.report(
@@ -43,22 +44,23 @@
 
         main.step( "Git checkout and get version" )
         main.ONOSbench.gitCheckout( "master" )
-        gitPullResult = main.ONOSbench.gitPull()
-        main.log.info( "git_pull_result = " + str( gitPullResult ))
+        if gitPull == 'True':
+            gitPullResult = main.ONOSbench.gitPull()
+            if gitPullResult == 1:
+                main.step( "Using mvn clean & install" )
+                main.ONOSbench.cleanInstall()
+                main.step( "Creating ONOS package" )
+                packageResult = main.ONOSbench.onosPackage()
+            elif gitPullResult == 0:
+                main.log.report(
+                    "Git Pull Failed, look into logs for detailed reason" )
+                main.cleanup()
+                main.exit()
+            main.log.info( "git_pull_result = " + str( gitPullResult ))
+        else:
+            main.log.info( "Skipping git pull" )
         main.ONOSbench.getVersion( report=True )
-
         packageResult = main.TRUE
-        if gitPullResult == 100:
-            main.step( "Using mvn clean & install" )
-            main.ONOSbench.cleanInstall()
-            main.step( "Creating ONOS package" )
-            packageResult = main.ONOSbench.onosPackage()
-        elif gitPullResult == 0:
-            main.log.report(
-                "Git Pull Failed, look into logs for detailed reason" )
-            main.cleanup()
-            main.exit()
-
 
         main.step( "Uninstalling ONOS package" )
         onosInstallResult = main.ONOSbench.onosUninstall( ONOS1Ip )
@@ -67,6 +69,7 @@
         else:
             main.log.report( "Uninstalling ONOS package failed" )
 
+        time.sleep( 20 )
         main.step( "Installing ONOS package" )
         onosInstallResult = main.ONOSbench.onosInstall( ONOS1Ip )
         print onosInstallResult
@@ -75,6 +78,7 @@
         else:
             main.log.report( "Installing ONOS package failed" )
 
+        time.sleep( 20 )
         onos1Isup = main.ONOSbench.isup()
         if onos1Isup == main.TRUE:
             main.log.report( "ONOS instance is up and ready" )
@@ -1201,8 +1205,8 @@
         result2 = main.Mininet1.compareLinks(
             MNTopo,
             json.loads( linksJson ) )
-        result3 = main.Mininet1.comparePorts( MNTopo, json.loads( portsJson ) )
 
+        result3 = main.Mininet1.comparePorts( MNTopo, json.loads( portsJson ) )
         # result = result1 and result2 and result3
         result = result1 and result2