Merge "Implemented mininet driver functions to run iperftcp and iperfudp across a given set of hosts"
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index e4dbf9d..3b89282 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -35,6 +35,7 @@
 import threading
 module = new.module("test")
 import openspeak
+import subprocess
 global path, drivers_path, core_path, tests_path,logs_path
 path = re.sub("(core|bin)$", "", os.getcwd())
 drivers_path = path+"drivers/"
@@ -167,6 +168,9 @@
         driverClass = getattr(driverModule, driverName)
         driverObject = driverClass()
 
+        if ( "OCN" in self.componentDictionary[component]['host'] and main.onoscell ):
+            self.componentDictionary[component]['host'] = main.mnIP
+
         connect_result = driverObject.connect(user_name = self.componentDictionary[component]['user'] if ('user' in self.componentDictionary[component].keys()) else getpass.getuser(),
                                               ip_address= self.componentDictionary[component]['host'] if ('host' in self.componentDictionary[component].keys()) else 'localhost',
                                               pwd = self.componentDictionary[component]['password'] if ('password' in self.componentDictionary[component].keys()) else 'changeme',
@@ -683,9 +687,22 @@
             sys.exit()
 
 def verifyOnosCell(options):
-    # Verifying onoscell option. This could be extended to do even more from here.
+    # Verifying onoscell option
     if options.onoscell:
         main.onoscell = options.onoscell
+        main.onosIPs = []
+        main.mnIP = ""
+        cellCMD = ". ~/.profile; cell "+main.onoscell
+        output=subprocess.check_output( ["bash", '-c', cellCMD] )
+        splitOutput = output.splitlines()
+        for i in range( len(splitOutput) ):
+            if( re.match( "OCN", splitOutput[i] ) ):
+                mnNode=splitOutput[i].split("=")
+                main.mnIP = mnNode[1]
+            # cell already sorts OC variables in bash, so no need to sort in TestON
+            if( re.match( "OC[1-9]", splitOutput[i] ) ):
+                onosNodes = splitOutput[i].split("=")
+                main.onosIPs.append( onosNodes[1] )
     else :
         main.onoscell = main.FALSE
 
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 8e9b3e0..e602a71 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -2116,51 +2116,7 @@
                     main.log.info(outputString) 
                 
         main.log.info("================================================================\n")
-        return totalHits 
-
-    def getOnosIPfromCell(self):
-        '''
-            Returns the ONOS node names and their IP addresses as defined in the cell and applied to shell environment
-            Example output return: ['10.128.40.41','10.128.40.42','10.128.40.43']. This will work even if the Mininet is
-            not part of the cell definition and also if there are multiple mininets, just by using static hostname  
-            in TOPO file.
-        '''
-        import re
-        try:
-            # Clean handle by sending empty and expecting $
-            self.handle.sendline( "" )
-            self.handle.expect( "\$" )
-            self.handle.sendline( "cell" )
-            self.handle.expect( "\$" )
-            handleBefore = self.handle.before
-            handleAfter = self.handle.after
-            # Get the rest of the handle
-            self.handle.sendline( "" )
-            self.handle.expect( "\$" )
-            handleMore = self.handle.before
-            ipList = []
-            cellOutput = handleBefore + handleAfter + handleMore
-            cellOutput = cellOutput.replace("\r\r","")
-            cellOutput = cellOutput.splitlines()
-            for i in range( len(cellOutput) ):
-                if( re.match( "OC", cellOutput[i] ) ):
-                    if( re.match( "OCI", cellOutput[i] ) or re.match( "OCN", cellOutput[i] ) ):
-                        continue
-                    else:
-                        onosIP = cellOutput[i].split("=")
-                        ipList.append(onosIP[1])
-            return ipList
-        except pexpect.ExceptionPexpect as e:
-            main.log.error( self.name + ": Pexpect exception found of type " +
-                            str( type( e ) ) )
-            main.log.error ( e.get_trace() )
-            main.log.error( self.name + ":    " + self.handle.before )
-            main.cleanup()
-            main.exit()
-        except Exception:
-            main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+        return totalHits
 
     def copyMininetFile( self, fileName, localPath, userName, ip,
                          mnPath='~/mininet/custom/', timeout = 60 ):
diff --git a/TestON/tests/CHOtest/CHOtest.py b/TestON/tests/CHOtest/CHOtest.py
index 20daf09..994a710 100644
--- a/TestON/tests/CHOtest/CHOtest.py
+++ b/TestON/tests/CHOtest/CHOtest.py
@@ -34,7 +34,6 @@
         karafTimeout = main.params['CTRL']['karafCliTimeout']
         main.newTopo = ""
         main.CLIs = []
-        main.onosIPs = []
 
         for i in range( 1, int(main.numCtrls) + 1 ):
             main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
@@ -47,8 +46,6 @@
         if ( main.onoscell ):
             cellName = main.onoscell
             cell_result = main.ONOSbench.setCell( cellName )
-            onosNodes = main.ONOSbench.getOnosIPfromCell()
-            main.onosIPs = onosNodes
             utilities.assert_equals( expect=main.TRUE, actual=cell_result,
                                  onpass="Test step PASS",
                                  onfail="Test step FAIL" )
diff --git a/TestON/tests/CHOtest/CHOtest.topo b/TestON/tests/CHOtest/CHOtest.topo
index 8b596e7..8053e31 100644
--- a/TestON/tests/CHOtest/CHOtest.topo
+++ b/TestON/tests/CHOtest/CHOtest.topo
@@ -5,11 +5,9 @@
             <host>localhost</host>
             <user>admin</user>
             <password></password>
-			<type>OnosDriver</type>
-			<connect_order>1</connect_order>
-            <COMPONENTS>
-                <home>~/ONOS</home>
-            </COMPONENTS>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
         </ONOSbench>
 
         <ONOScli1>