Merge "Use json output in when getting intent ids"
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index ecf1b03..47baeb0 100755
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -2407,7 +2407,7 @@
         except Exception:
             main.log.exception( "Uncaught exception" )
 
-    def startBasicONOS( self, nodeList, opSleep=60, onosStartupSleep=60 ):
+    def startBasicONOS( self, nodeList, opSleep=60, onosStartupSleep=30 ):
         '''
         Start onos cluster with defined nodes, but only with drivers app
         '''
@@ -2426,9 +2426,17 @@
         main.log.info( self.name + ": Creating ONOS package" )
         packageResult = self.buckBuild( timeout=opSleep )
 
+        main.log.info( self.name + ": Uninstalling ONOS" )
+        for nd in nodeList:
+            self.onosUninstall( nodeIp=nd )
+
         main.log.info( self.name + ": Installing ONOS package" )
         for nd in nodeList:
-                    self.onosInstall( node=nd )
+            self.onosInstall( node=nd )
+
+        main.log.info( self.name + ": Set up ONOS secure SSH" )
+        for nd in nodeList:
+            self.onosSecureSSH( node=nd )
 
         main.log.info( self.name + ": Starting ONOS service" )
         time.sleep( onosStartupSleep )
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.params b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.params
index ef2a46a..f35fb67 100755
--- a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.params
+++ b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.params
@@ -32,7 +32,7 @@
     </CASE0>
 
     <CASE1>
-        <NodeList>OC1,OC2,OC3</NodeList>
+        <NodeList>OC1</NodeList>
         <SleepTimers>
             <onosStartup>60</onosStartup>
             <onosCfg>5</onosCfg>
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py
index 3ad2f30..ce01cdd 100644
--- a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py
+++ b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py
@@ -68,33 +68,23 @@
         main.onosCfgSleep = float( main.params['CASE1']['SleepTimers']['onosCfg'] )
         main.mnStartupSleep = float( main.params['CASE1']['SleepTimers']['mnStartup'] )
         main.mnCfgSleep = float( main.params['CASE1']['SleepTimers']['mnCfg'] )
+        main.numCtrls = int( main.params['CASE10']['numNodes'] )
+        main.AllONOSip = main.ONOSbench.getOnosIps()
+        main.ONOSip = []
+        for i in range( main.numCtrls ):
+            main.ONOSip.append( main.AllONOSip[i] )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=main.TRUE,
                                  onpass="Successfully construct " +
                                         "test variables ",
                                  onfail="Failed to construct test variables" )
 
-
-
-        main.step( "Uninstall all onos nodes in the env.")
-        stepResult = main.TRUE
-        for node in main.nodeList:
-            nodeResult = main.ONOSbench.onosUninstall( nodeIp = "$" + node )
-            stepResult = stepResult & nodeResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully uninstall onos on all nodes in env.",
-                                 onfail="Failed to uninstall onos on all nodes in env!" )
-        if not stepResult:
-            main.log.error( "Failure to clean test env. Exiting test..." )
-            main.exit()
-
     def CASE2( self, main ):
         '''
             Report errors/warnings/exceptions
         '''
         main.log.info("Error report: \n" )
-        main.ONOSbench.logReport( main.ONOScli1.ip_address,
+        main.ONOSbench.logReport( main.ONOSip[0],
                                   [ "INFO",
                                     "FOLLOWER",
                                     "WARN",
@@ -113,16 +103,9 @@
 
         import time
 
-        numNodes = int( main.params['CASE10']['numNodes'] )
-        main.case( "Start up " + str( numNodes ) + "-node onos cluster.")
-
+        main.case( "Start up " + str( main.numCtrls ) + "-node onos cluster.")
         main.step( "Start ONOS cluster with basic (drivers) app.")
-        onosClusterIPs = []
-        for n in range( 1, numNodes + 1 ):
-            handle = "main.ONOScli" + str( n )
-            onosClusterIPs.append( eval( handle ).ip_address )
-
-        stepResult = main.ONOSbench.startBasicONOS(nodeList = onosClusterIPs, opSleep = 200 )
+        stepResult = main.ONOSbench.startBasicONOS( nodeList=main.ONOSip, opSleep=200 )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
                                  onpass="Successfully started basic ONOS cluster ",
@@ -130,9 +113,9 @@
 
         main.step( "Establishing Handles on ONOS CLIs.")
         cliResult = main.TRUE
-        for n in range( 1, numNodes + 1 ):
+        for n in range( 1, main.numCtrls + 1 ):
             handle = "main.ONOScli" + str( n )
-            cliResult = cliResult & ( eval( handle ).startCellCli() )
+            cliResult = cliResult & ( eval( handle ).startOnosCli( main.ONOSip[ n-1 ] ) )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=cliResult,
                                  onpass="Successfully started onos cli's ",
@@ -196,10 +179,9 @@
 
         main.step( "Assign switches to controllers.")
         assignResult = main.TRUE
-        onosNodes = [ main.ONOScli1.ip_address ]
         for i in range(1, 8):
             assignResult = assignResult & main.Mininet1.assignSwController( sw="s" + str( i ),
-                                                         ip=onosNodes,
+                                                         ip=main.ONOSip,
                                                          port='6653' )
         time.sleep(main.mnCfgSleep)
         utilities.assert_equals( expect=main.TRUE,
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.topo b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.topo
index 4fee9ff..cda1ed6 100755
--- a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.topo
+++ b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.topo
@@ -17,7 +17,7 @@
         </ONOSbench>
 
         <ONOScli1>
-            <host>OC1</host>
+            <host>localhost</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosCliDriver</type>
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
index 90bfb14..3673622 100644
--- a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
+++ b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
@@ -68,33 +68,23 @@
         main.onosCfgSleep = float( main.params['CASE1']['SleepTimers']['onosCfg'] )
         main.mnStartupSleep = float( main.params['CASE1']['SleepTimers']['mnStartup'] )
         main.mnCfgSleep = float( main.params['CASE1']['SleepTimers']['mnCfg'] )
+        main.numCtrls = int( main.params['CASE10']['numNodes'] )
+        main.AllONOSip = main.ONOSbench.getOnosIps()
+        main.ONOSip = []
+        for i in range( main.numCtrls ):
+            main.ONOSip.append( main.AllONOSip[i] )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=main.TRUE,
                                  onpass="Successfully construct " +
                                         "test variables ",
                                  onfail="Failed to construct test variables" )
 
-
-
-        main.step( "Uninstall all onos nodes in the env.")
-        stepResult = main.TRUE
-        for node in main.nodeList:
-            nodeResult = main.ONOSbench.onosUninstall( nodeIp = "$" + node )
-            stepResult = stepResult & nodeResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully uninstall onos on all nodes in env.",
-                                 onfail="Failed to uninstall onos on all nodes in env!" )
-        if not stepResult:
-            main.log.error( "Failure to clean test env. Exiting test..." )
-            main.exit()
-
     def CASE2( self, main ):
         '''
             Report errors/warnings/exceptions
         '''
         main.log.info("Error report: \n" )
-        main.ONOSbench.logReport( main.ONOScli1.ip_address,
+        main.ONOSbench.logReport( main.ONOSip[0],
                                   [ "INFO",
                                     "FOLLOWER",
                                     "WARN",
@@ -113,16 +103,9 @@
 
         import time
 
-        numNodes = int( main.params['CASE10']['numNodes'] )
-        main.case( "Start up " + str( numNodes ) + "-node onos cluster.")
-
+        main.case( "Start up " + str( main.numCtrls ) + "-node onos cluster.")
         main.step( "Start ONOS cluster with basic (drivers) app.")
-        onosClusterIPs = []
-        for n in range( 1, numNodes + 1 ):
-            handle = "main.ONOScli" + str( n )
-            onosClusterIPs.append( eval( handle ).ip_address )
-
-        stepResult = main.ONOSbench.startBasicONOS(nodeList = onosClusterIPs, opSleep = 200 )
+        stepResult = main.ONOSbench.startBasicONOS( nodeList=main.ONOSip, opSleep=200 )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
                                  onpass="Successfully started basic ONOS cluster ",
@@ -130,9 +113,9 @@
 
         main.step( "Establishing Handles on ONOS CLIs.")
         cliResult = main.TRUE
-        for n in range( 1, numNodes + 1 ):
+        for n in range( 1, main.numCtrls + 1 ):
             handle = "main.ONOScli" + str( n )
-            cliResult = cliResult & ( eval( handle ).startCellCli() )
+            cliResult = cliResult & ( eval( handle ).startOnosCli( main.ONOSip[ n-1 ] ) )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=cliResult,
                                  onpass="Successfully started onos cli's ",
@@ -196,10 +179,9 @@
 
         main.step( "Assign switches to controllers.")
         assignResult = main.TRUE
-        onosNodes = [ main.ONOScli1.ip_address, main.ONOScli2.ip_address, main.ONOScli3.ip_address ]
         for i in range(1, 8):
             assignResult = assignResult & main.Mininet1.assignSwController( sw="s" + str( i ),
-                                                         ip=onosNodes,
+                                                         ip=main.ONOSip,
                                                          port='6653' )
         time.sleep(main.mnCfgSleep)
         utilities.assert_equals( expect=main.TRUE,
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.topo b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.topo
index c01bb0a..367633b 100755
--- a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.topo
+++ b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.topo
@@ -17,7 +17,7 @@
         </ONOSbench>
 
         <ONOScli1>
-            <host>OC1</host>
+            <host>localhost</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosCliDriver</type>
@@ -27,7 +27,7 @@
         </ONOScli1>
 
         <ONOScli2>
-            <host>OC2</host>
+            <host>localhost</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosCliDriver</type>
@@ -37,7 +37,7 @@
         </ONOScli2>
 
          <ONOScli3>
-            <host>OC3</host>
+            <host>localhost</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>OnosCliDriver</type>