Update Cluster Driver

Change-Id: I8a3a57e19637ff210548e57d41178e6f194cf694
diff --git a/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.params b/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.params
index 033c05f..081ebdb 100644
--- a/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.params
+++ b/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.params
@@ -41,7 +41,12 @@
         # timeout for pexpect
         <timeout>300</timeout>
     </SLEEP>
-
+    <CFG>
+        <intentManager>org.onosproject.net.intent.impl.IntentManager</intentManager>
+        <intentConfigRegi>org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator</intentConfigRegi>
+        <nullProvider>org.onosproject.provider.nil.NullProviders</nullProvider>
+        <linkCollectionIntent>org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler</linkCollectionIntent>
+    </CFG>
     <CTRL>
         <USER>sdn</USER>
 
@@ -65,7 +70,6 @@
 
         <ip7>OC7</ip7>
         <port7>6653</port7>
-
     </CTRL>
 
     <MN>
diff --git a/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py b/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
index a7f7368..f58e715 100644
--- a/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
+++ b/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.py
@@ -65,6 +65,10 @@
             main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
             main.installSleep = int( main.params[ 'SLEEP' ][ 'install' ] )
             main.verifySleep = int( main.params[ 'SLEEP' ][ 'verify' ] )
+            main.intentManagerCfg = main.params[ 'CFG' ][ 'intentManager' ]
+            main.intentConfigRegiCfg = main.params[ 'CFG' ][ 'intentConfigRegi' ]
+            main.nullProviderCfg = main.params[ 'CFG' ][ 'nullProvider' ]
+            main.linkCollectionIntentCfg = main.params[ 'CFG' ][ 'linkCollectionIntent' ]
             main.verifyAttempts = int( main.params[ 'ATTEMPTS' ][ 'verify' ] )
             main.sampleSize = int( main.params[ 'TEST' ][ 'sampleSize' ] )
             main.warmUp = int( main.params[ 'TEST' ][ 'warmUp' ] )
@@ -84,7 +88,7 @@
             for i in range( 0, len( main.intentsList ) ):
                 main.intentsList[ i ] = int( main.intentsList[ i ] )
 
-            stepResult = main.testSetUp.gitPulling()
+            stepResult = main.testSetUp.envSetup()
             # Create DataBase file
             main.log.info( "Create Database file " + main.dbFileName )
             resultsDB = open( main.dbFileName, "w+" )
@@ -98,27 +102,29 @@
         import time
 
         main.maxNumBatch = 0
-        main.testSetUp.getNumCtrls( True )
-        main.testSetUp.envSetup( includeGitPull=False, makeMaxNodes=False )
-        main.testSetUp.ONOSSetUp( main.MN1Ip, True,
-                                  cellName=main.cellName, killRemoveMax=False,
-                                  CtrlsSet=False )
+        main.testSetUp.ONOSSetUp( main.MN1Ip, main.Cluster, True,
+                                  cellName=main.cellName, killRemoveMax=False )
 
         # configure apps
-        main.CLIs[ 0 ].setCfg( "org.onosproject.provider.nil.NullProviders", "deviceCount", value=7 )
-        main.CLIs[ 0 ].setCfg( "org.onosproject.provider.nil.NullProviders", "topoShape", value="linear" )
-        main.CLIs[ 0 ].setCfg( "org.onosproject.provider.nil.NullProviders", "enabled", value="true" )
-        main.CLIs[ 0 ].setCfg( "org.onosproject.net.intent.impl.IntentManager", "skipReleaseResourcesOnWithdrawal", value="true" )
+        main.Cluster.active( 0 ).CLI.setCfg( main.nullProviderCfg,
+                                             "deviceCount", value=7 )
+        main.Cluster.active( 0 ).CLI.setCfg( main.nullProviderCfg,
+                                             "topoShape", value="linear" )
+        main.Cluster.active( 0 ).CLI.setCfg( main.nullProviderCfg,
+                                             "enabled", value="true" )
+        main.Cluster.active( 0 ).CLI.setCfg( main.intentManagerCfg,
+                                             "skipReleaseResourcesOnWithdrawal",
+                                             value="true" )
         if main.flowObj:
-            main.CLIs[ 0 ].setCfg( "org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
-                                "useFlowObjectives", value="true" )
-            main.CLIs[ 0 ].setCfg( "org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
-                                "defaultFlowObjectiveCompiler",
-                                value='org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler' )
+            main.Cluster.active( 0 ).CLI.setCfg( main.intentConfigRegiCfg,
+                                                 "useFlowObjectives", value="true" )
+            main.Cluster.active( 0 ).CLI.setCfg( main.intentConfigRegiCfg,
+                                                 "defaultFlowObjectiveCompiler",
+                                                 value=main.linkCollectionIntentCfg )
         time.sleep( main.startUpSleep )
 
         # balanceMasters
-        main.CLIs[ 0 ].balanceMasters()
+        main.Cluster.active( 0 ).CLI.balanceMasters()
         time.sleep( main.startUpSleep )
 
     def CASE2( self, main ):
@@ -143,9 +149,13 @@
                     main.log.info( "====================Warm Up=====================" )
 
                 # push intents
-                installResult = main.CLIs[ 0 ].pushTestIntents( main.ingress, main.egress, batchSize,
-                                                             offset=1, options="-i", timeout=main.timeout,
-                                                             getResponse=True )
+                installResult = main.Cluster.active( 0 ).CLI.pushTestIntents( main.ingress,
+                                                                              main.egress,
+                                                                              batchSize,
+                                                                              offset=1,
+                                                                              options="-i",
+                                                                              timeout=main.timeout,
+                                                                              getResponse=True )
                 if type( installResult ) is str:
                     if "Failure" in installResult:
                         main.log.error( "Install Intents failure, ignore this iteration." )
@@ -177,9 +187,13 @@
                     continue
                 time.sleep( 2 )
                 # Withdraw Intents
-                withdrawResult = main.CLIs[ 0 ].pushTestIntents( main.ingress, main.egress, batchSize,
-                                                              offset=1, options="-w", timeout=main.timeout,
-                                                              getResponse=True )
+                withdrawResult = main.Cluster.active( 0 ).CLI.pushTestIntents( main.ingress,
+                                                                               main.egress,
+                                                                               batchSize,
+                                                                               offset=1,
+                                                                               options="-w",
+                                                                               timeout=main.timeout,
+                                                                               getResponse=True )
 
                 if type( withdrawResult ) is str:
                     if "Failure" in withdrawResult:
@@ -211,7 +225,7 @@
                     invalidrun += 1
                     continue
                 time.sleep( 2 )
-                main.CLIs[ 0 ].purgeWithdrawnIntents()
+                main.Cluster.active( 0 ).CLI.purgeWithdrawnIntents()
                 validrun += 1
             installave = numpy.average( main.installLatList )
             installstd = numpy.std( main.installLatList )
@@ -219,7 +233,7 @@
             withdrawstd = numpy.std( main.withdrawLatList )
             # log report
             main.log.report( "----------------------------------------------------" )
-            main.log.report( "Scale: " + str( main.numCtrls ) )
+            main.log.report( "Scale: " + str( main.Cluster.numCtrls ) )
             main.log.report( "Intent batch: " + str( batchSize ) )
             main.log.report( "Install average: {}    std: {}".format( installave, installstd ) )
             main.log.report( "Withdraw average: {}   std: {}".format( withdrawave, withdrawstd ) )
@@ -227,7 +241,7 @@
             if not ( numpy.isnan( installave ) or numpy.isnan( installstd ) or\
                     numpy.isnan( withdrawstd ) or numpy.isnan( withdrawave ) ):
                 databaseString = "'" + main.commit + "',"
-                databaseString += str( main.numCtrls ) + ","
+                databaseString += str( main.Cluster.numCtrls ) + ","
                 databaseString += str( batchSize ) + ","
                 databaseString += str( installave ) + ","
                 databaseString += str( installstd ) + ","
diff --git a/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.topo b/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.topo
index 236d55d..93e1e9d 100644
--- a/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.topo
+++ b/TestON/tests/SCPF/SCPFintentInstallWithdrawLat/SCPFintentInstallWithdrawLat.topo
@@ -1,178 +1,25 @@
 <TOPOLOGY>
-
     <COMPONENT>
 
-        <ONOSbench>
-            <host>localhost</host>
+        <ONOScell>
+            <host>localhost</host>  # ONOS "bench" machine
             <user>sdn</user>
             <password>rocks</password>
-            <type>OnosDriver</type>
+            <type>OnosClusterDriver</type>
             <connect_order>1</connect_order>
             <COMPONENTS>
-                <home>~/onos</home>
-                <nodes>7</nodes>
-                <prompt></prompt>
-            </COMPONENTS>
-        </ONOSbench>
-
-        <ONOScli1>
-            <host>localhost</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
+                <cluster_name></cluster_name>  # Used as a prefix for cluster components. Defaults to 'ONOS'
+                <diff_clihost></diff_clihost>  # if it has different host other than localhost for CLI. True or empty. OC# will be used if True.
                 <karaf_username></karaf_username>
                 <karaf_password></karaf_password>
-                <prompt></prompt>
+                <web_user></web_user>
+                <web_pass></web_pass>
+                <rest_port></rest_port>
+                <prompt></prompt>  # TODO: we technically need a few of these, one per component
+                <onos_home></onos_home>  # defines where onos home is
+                <nodes> 7 </nodes>  # number of nodes in the cluster
             </COMPONENTS>
-        </ONOScli1>
-
-        <ONOScli2>
-            <host>localhost</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-                <prompt></prompt>
-            </COMPONENTS>
-        </ONOScli2>
-
-        <ONOScli3>
-            <host>localhost</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-                <prompt></prompt>
-            </COMPONENTS>
-        </ONOScli3>
-
-        <ONOScli4>
-            <host>localhost</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-                <prompt></prompt>
-            </COMPONENTS>
-        </ONOScli4>
-
-        <ONOScli5>
-            <host>localhost</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS>
-                <prompt></prompt>
-            </COMPONENTS>
-        </ONOScli5>
-
-        <ONOScli6>
-            <host>localhost</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS>
-                <prompt></prompt>
-            </COMPONENTS>
-        </ONOScli6>
-
-        <ONOScli7>
-            <host>localhost</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosCliDriver</type>
-            <connect_order>8</connect_order>
-            <COMPONENTS>
-                <prompt></prompt>
-            </COMPONENTS>
-        </ONOScli7>
-
-        <ONOS1>
-            <host>OC1</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosDriver</type>
-            <connect_order>9</connect_order>
-            <COMPONENTS>
-                <prompt></prompt>
-            </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>OC2</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosDriver</type>
-            <connect_order>10</connect_order>
-            <COMPONENTS>
-                <prompt></prompt>
-            </COMPONENTS>
-        </ONOS2>
-
-        <ONOS3>
-            <host>OC3</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosDriver</type>
-            <connect_order>11</connect_order>
-            <COMPONENTS>
-                <prompt></prompt>
-            </COMPONENTS>
-        </ONOS3>
-
-        <ONOS4>
-            <host>OC4</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosDriver</type>
-            <connect_order>12</connect_order>
-            <COMPONENTS>
-                <prompt></prompt>
-            </COMPONENTS>
-        </ONOS4>
-
-    
-        <ONOS5>
-            <host>OC5</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosDriver</type>
-            <connect_order>13</connect_order>
-            <COMPONENTS>
-                <prompt></prompt>
-            </COMPONENTS>
-        </ONOS5>
-
-        <ONOS6>
-            <host>OC6</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosDriver</type>
-            <connect_order>14</connect_order>
-            <COMPONENTS>
-                <prompt></prompt>
-            </COMPONENTS>
-        </ONOS6>
-
-        <ONOS7>
-            <host>OC7</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosDriver</type>
-            <connect_order>15</connect_order>
-            <COMPONENTS>
-                <prompt></prompt>
-            </COMPONENTS>
-        </ONOS7>
+        </ONOScell>
 
     </COMPONENT>
-
-</TOPOLOGY>
- 
+</TOPOLOGY>
\ No newline at end of file