Bug fixes for CHO test

Change-Id: I19c25e4469f8b28f1cfa47f8fa5c5738d7801dea
diff --git a/TestON/tests/CHOTestMonkey/CHOTestMonkey.py b/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
index 78bed55..9d8e0d6 100644
--- a/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
+++ b/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
@@ -44,9 +44,12 @@
         main.enableIPv6 = main.params[ 'TEST' ][ 'IPv6' ]
         main.enableIPv6 = True if main.enableIPv6 == "on" else False
         main.caseSleep = int( main.params[ 'TEST' ][ 'caseSleep' ] )
-        main.numCtrls = main.params[ 'TEST' ][ 'numCtrl' ]
+        main.numCtrls = int( main.params[ 'TEST' ][ 'numCtrl' ] )
+        main.ONOSip = []
+        main.AllONOSip = main.ONOSbench.getOnosIps()
         main.controllers = []
-        for i in range( 1, int( main.numCtrls ) + 1 ):
+        for i in range( 1, main.numCtrls + 1 ):
+            main.ONOSip.append( main.AllONOSip[ i-1 ] )
             newController = Controller( i )
             newController.setCLI( getattr( main, 'ONOScli' + str( i ) ) )
             main.controllers.append( newController )
@@ -127,9 +130,9 @@
 
         main.step( "Uninstall ONOS package on all Nodes" )
         uninstallResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            main.log.info( "Uninstalling package on ONOS Node IP: " + main.onosIPs[i] )
-            uResult = main.ONOSbench.onosUninstall( main.onosIPs[i] )
+        for i in range( main.numCtrls ):
+            main.log.info( "Uninstalling package on ONOS Node IP: " + main.ONOSip[i] )
+            uResult = main.ONOSbench.onosUninstall( main.ONOSip[i] )
             utilities.assert_equals( expect=main.TRUE,
                                      actual=uResult,
                                      onpass="Test step PASS",
@@ -138,9 +141,9 @@
 
         main.step( "Install ONOS package on all Nodes" )
         installResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            main.log.info( "Installing package on ONOS Node IP: " + main.onosIPs[i] )
-            iResult = main.ONOSbench.onosInstall( node=main.onosIPs[i] )
+        for i in range( main.numCtrls ):
+            main.log.info( "Installing package on ONOS Node IP: " + main.ONOSip[i] )
+            iResult = main.ONOSbench.onosInstall( node=main.ONOSip[i] )
             utilities.assert_equals( expect=main.TRUE,
                                      actual=iResult,
                                      onpass="Test step PASS",
@@ -149,8 +152,8 @@
 
         main.step( "Set up ONOS secure SSH" )
         secureSshResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.onosIPs[i] )
+        for i in range( main.numCtrls ):
+            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
         utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
                                  onpass="Test step PASS",
                                  onfail="Test step FAIL" )
@@ -289,10 +292,10 @@
         main.step( "Assign switches to controllers" )
         switchMastership = main.TRUE
         for switchName in main.mininetSwitches.keys():
-            main.Mininet1.assignSwController( sw=switchName, ip=main.onosIPs )
+            main.Mininet1.assignSwController( sw=switchName, ip=main.ONOSip )
             response = main.Mininet1.getSwController( switchName )
             print( "Response is " + str( response ) )
-            if re.search( "tcp:" + main.onosIPs[ 0 ], response ):
+            if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
                 switchMastership = switchMastership and main.TRUE
             else:
                 switchMastership = main.FALSE
diff --git a/TestON/tests/CHOTestMonkey/dependencies/elements/ONOSElement.py b/TestON/tests/CHOTestMonkey/dependencies/elements/ONOSElement.py
index e9dff29..aa3a7a3 100644
--- a/TestON/tests/CHOTestMonkey/dependencies/elements/ONOSElement.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/elements/ONOSElement.py
@@ -8,7 +8,7 @@
     def __init__( self, index ):
         self.default = ''
         self.index = index
-        self.ip = main.onosIPs[ index - 1 ]
+        self.ip = main.ONOSip[ index - 1 ]
         self.CLI = None
         self.CLILock = Lock()
         self.status = 'up'
diff --git a/TestON/tests/CHOTestMonkey/dependencies/events/NetworkEvent.py b/TestON/tests/CHOTestMonkey/dependencies/events/NetworkEvent.py
index ccab8a1..f6e13cc 100644
--- a/TestON/tests/CHOTestMonkey/dependencies/events/NetworkEvent.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/events/NetworkEvent.py
@@ -273,7 +273,7 @@
                             intent.setInstalled()
         # Re-assign mastership for the device
         with main.mininetLock:
-            main.Mininet1.assignSwController( sw=self.device.name, ip=main.onosIPs )
+            main.Mininet1.assignSwController( sw=self.device.name, ip=main.ONOSip )
         # Re-discover hosts
         for host in self.device.hosts:
             correspondent = None