Update Cluster Driver

Change-Id: I8a3a57e19637ff210548e57d41178e6f194cf694
diff --git a/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py b/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py
index 5e3059c..798c800 100644
--- a/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py
+++ b/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py
@@ -83,7 +83,7 @@
                                                     wrapperFile2 +
                                                     ".py" )
 
-            stepResult = main.testSetUp.envSetup( True, True )
+            stepResult = main.testSetUp.envSetup()
             # Uncomment out the following if a mininet topology is added
             # copyResult1 = main.ONOSbench.scp( main.Mininet1,
             #                                   main.dependencyPath +
@@ -107,7 +107,7 @@
         - Install ONOS cluster
         - Connect to cli
         """
-        main.testSetUp.ONOSSetUp( main.Mininet1, True )
+        main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster, True )
 
     def CASE19( self, main ):
         """
@@ -122,19 +122,16 @@
             main.Utils
         except ( NameError, AttributeError ):
             main.Utils = Utils()
-        main.Utils.copyKarafLog()
+        main.Utils.copyKarafLog( "cycle" + str( main.cycle ) )
     def CASE100( self, main ):
         """
             Start NETCONF app and OFC-Server or make sure that they are already running
         """
         assert main, "There is no main"
-        assert main.RESTs, "There is no main.RESTs"
-        assert main.numCtrls, "Placed the total number of switch topology in \
-                                main.numCtrls"
 
         testResult = main.FALSE
         main.testName = "Start up NETCONF app in all nodes"
-        main.case( main.testName + " Test - " + str( main.numCtrls ) +
+        main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
                    " NODE(S)" )
         main.step( "Starting NETCONF app" )
         main.assertReturnString = "Assertion result for starting NETCONF app"
@@ -161,12 +158,9 @@
                 -The file is built from information loaded from the .params file
         """
         assert main, "There is no main"
-        assert main.RESTs, "There is no main.RESTs"
-        assert main.numCtrls, "Placed the total number of switch topology in \
-                                main.numCtrls"
 
         main.testName = "Assemble the configuration"
-        main.case( main.testName + " Test - " + str( main.numCtrls ) +
+        main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
                    " NODES(S)" )
         main.step( "Assembling configuration file" )
         main.assertReturnString = "Assertion result for assembling configuration file"
@@ -184,12 +178,9 @@
             Push a configuration and bring up a switch
         """
         assert main, "There is no main"
-        assert main.RESTs, "There is no main.RESTs"
-        assert main.numCtrls, "Placed the total number of switch topology in \
-                                main.numCtrls"
 
         main.testName = "Uploading the configuration"
-        main.case( main.testName + " Test - " + str( main.numCtrls ) +
+        main.case( main.testName + " Test - " + str( main.Cluster.numCtrls ) +
                    " NODES(S)" )
         main.step( "Sending the configuration file" )
         main.assertReturnString = "Assertion result for sending the configuration file"
diff --git a/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.topo b/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.topo
index 57676b1..a662af5 100644
--- a/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.topo
+++ b/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.topo
@@ -1,95 +1,32 @@
 <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>
-                <nodes>3</nodes>
-                <prompt></prompt>
-            </COMPONENTS>
-        </ONOSbench>
-
-        <ONOSrest1>
-            <host>OC1</host>
-            <port>8181</port>
-            <user>onos</user>
-            <password>rocks</password>
-            <type>OnosRestDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS>
-                <prompt></prompt>
-            </COMPONENTS>
-        </ONOSrest1>
-
-        <ONOSrest2>
-            <host>OC2</host>
-            <port>8181</port>
-            <user>onos</user>
-            <password>rocks</password>
-            <type>OnosRestDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS>
-                <prompt></prompt>
-            </COMPONENTS>
-        </ONOSrest2>
-
-        <ONOSrest3>
-            <host>OC3</host>
-            <port>8181</port>
-            <user>onos</user>
-            <password>rocks</password>
-            <type>OnosRestDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-                <prompt></prompt>
-            </COMPONENTS>
-        </ONOSrest3>
-
-        <ONOScli1>
-            <host>localhost</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosCliDriver</type>
-            <connect_order>5</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 for 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> 3 </nodes>  # number of nodes in the cluster
             </COMPONENTS>
-        </ONOScli1>
-
-        <ONOScli2>
-            <host>localhost</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosCliDriver</type>
-            <connect_order>6</connect_order>
-            <COMPONENTS>
-                <prompt></prompt>
-            </COMPONENTS>
-        </ONOScli2>
-
-         <ONOScli3>
-            <host>localhost</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosCliDriver</type>
-            <connect_order>7</connect_order>
-            <COMPONENTS>
-                <prompt></prompt>
-            </COMPONENTS>
-        </ONOScli3>
+        </ONOScell>
 
         <Mininet1>
             <host>OCN</host>
             <user>sdn</user>
             <password>rocks</password>
             <type>MininetCliDriver</type>
-            <connect_order>8</connect_order>
+            <connect_order>2</connect_order>
             <COMPONENTS>
                 <home>~/mininet/</home>
                 <prompt></prompt>
diff --git a/TestON/tests/FUNC/FUNCnetconf/dependencies/netconf.py b/TestON/tests/FUNC/FUNCnetconf/dependencies/netconf.py
index 4ee8fcb..bed1670 100644
--- a/TestON/tests/FUNC/FUNCnetconf/dependencies/netconf.py
+++ b/TestON/tests/FUNC/FUNCnetconf/dependencies/netconf.py
@@ -38,7 +38,7 @@
         the OF-Config server is running on the node to be configured
     """
     startResult = main.FALSE
-    startResult = main.RESTs[ 0 ].activateApp( appName="org.onosproject.netconf" )
+    startResult = main.Cluster.active( 0 ).REST.activateApp( appName="org.onosproject.netconf" )
     return startResult
 
 
@@ -116,7 +116,7 @@
     method = "POST"
     data = main.cfgJson
     configResult = main.FALSE
-    sendResult = main.RESTs[ 0 ].send( url=url, method=method, data=data )
+    sendResult = main.Cluster.active( 0 ).REST.send( url=url, method=method, data=data )
     main.log.info( "Device configuration request response code: " + str( sendResult[ 0 ] ) )
     if ( 200 <= sendResult[ 0 ] <= 299 ):
         configResult = main.TRUE
@@ -137,8 +137,8 @@
     addressResult = main.FALSE
     driverResult = main.FALSE
     try:
-        apiResult = main.RESTs[ 0 ].devices()
-        cliResult = main.CLIs[ 0 ].devices()
+        apiResult = main.Cluster.active( 0 ).REST.devices()
+        cliResult = main.Cluster.active( 0 ).CLI.devices()
 
         apiDict = json.loads( apiResult )
         cliDict = json.loads( cliResult )