Merge pull request #144 from opennetworkinglab/devl/assignSwUpdate

Updated all tests that uses assignSwController
diff --git a/TestON/tests/IntentPerfNext/IntentPerfNext.py b/TestON/tests/IntentPerfNext/IntentPerfNext.py
index cb226e7..7807daf 100644
--- a/TestON/tests/IntentPerfNext/IntentPerfNext.py
+++ b/TestON/tests/IntentPerfNext/IntentPerfNext.py
@@ -144,8 +144,9 @@
         for i in range( 1, 9 ):
             if clusterCount == 1:
                 main.Mininet1.assignSwController(
-                    sw=str( i ), ip1=ONOSIpList[ 0 ],
-                    port1=defaultSwPort
+                    sw="s" + str( i ),
+                    ip=ONOSIpList[ 0 ],
+                    port=defaultSwPort
                 )
             elif clusterCount == 3:
                 if i < 3:
@@ -155,8 +156,9 @@
                 else:
                     index = 2
                 main.Mininet1.assignSwController(
-                    sw=str( i ), ip1=ONOSIpList[ index ],
-                    port1=defaultSwPort
+                    sw="s" + str( i ),
+                    ip=ONOSIpList[ index ],
+                    port=defaultSwPort
                 )
             elif clusterCount == 5:
                 if i < 3:
@@ -170,8 +172,9 @@
                 else:
                     index = 4
                 main.Mininet1.assignSwController(
-                    sw=str( i ), ip1=ONOSIpList[ index ],
-                    port1=defaultSwPort
+                    sw="s" + str( i ),
+                    ip=ONOSIpList[ index ],
+                    port=defaultSwPort
                 )
             elif clusterCount == 7:
                 if i < 6:
@@ -179,8 +182,9 @@
                 else:
                     index = 6
                 main.Mininet1.assignSwController(
-                    sw=str( i ), ip1=ONOSIpList[ index ],
-                    port1=defaultSwPort
+                    sw="s" + str( i ),
+                    ip=ONOSIpList[ index ],
+                    port=defaultSwPort
                 )
 
         time.sleep( 10 )
@@ -400,8 +404,9 @@
         for i in range( 1, 9 ):
             if clusterCount == 1:
                 main.Mininet1.assignSwController(
-                    sw=str( i ), ip1=ONOSIpList[ 0 ],
-                    port1=defaultSwPort
+                    sw="s" + str( i ),
+                    ip=ONOSIpList[ 0 ],
+                    port=defaultSwPort
                 )
             elif clusterCount == 3:
                 if i < 3:
@@ -411,8 +416,9 @@
                 else:
                     index = 2
                 main.Mininet1.assignSwController(
-                    sw=str( i ), ip1=ONOSIpList[ index ],
-                    port1=defaultSwPort
+                    sw="s" + str( i ),
+                    ip=ONOSIpList[ index ],
+                    port=defaultSwPort
                 )
             elif clusterCount == 5:
                 if i < 3:
@@ -426,8 +432,9 @@
                 else:
                     index = 4
                 main.Mininet1.assignSwController(
-                    sw=str( i ), ip1=ONOSIpList[ index ],
-                    port1=defaultSwPort
+                    sw="s" + str( i ),
+                    ip=ONOSIpList[ index ],
+                    port=defaultSwPort
                 )
             elif clusterCount == 7:
                 if i < 6:
@@ -435,8 +442,9 @@
                 else:
                     index = 6
                 main.Mininet1.assignSwController(
-                    sw=str( i ), ip1=ONOSIpList[ index ],
-                    port1=defaultSwPort
+                    sw="s" + str( i ),
+                    ip=ONOSIpList[ index ],
+                    port=defaultSwPort
                 )
 
         time.sleep(10)
@@ -653,64 +661,64 @@
         if clusterCount == 1:
             for i in range( 1, numSwitch + 1 ):
                 main.Mininet1.assignSwController(
-                    sw=str( i ),
-                    ip1=ONOS1Ip,
-                    port1=defaultSwPort )
+                    sw="s" + str( i ),
+                    ip=ONOS1Ip,
+                    port=defaultSwPort )
         if clusterCount == 3:
             for i in range( 1, 3 ):
                 main.Mininet1.assignSwController(
-                    sw=str( i ),
-                    ip1=ONOS1Ip,
-                    port1=defaultSwPort )
+                    sw="s" + str( i ),
+                    ip=ONOS1Ip,
+                    port=defaultSwPort )
             for i in range( 3, 6 ):
                 main.Mininet1.assignSwController(
-                    sw=str( i ),
-                    ip1=ONOS2Ip,
-                    port1=defaultSwPort )
+                    sw="s" + str( i ),
+                    ip=ONOS2Ip,
+                    port=defaultSwPort )
             for i in range( 6, 9 ):
                 main.Mininet1.assignSwController(
-                    sw=str( i ),
-                    ip1=ONOS3Ip,
-                    port1=defaultSwPort )
+                    sw="s" + str( i ),
+                    ip=ONOS3Ip,
+                    port=defaultSwPort )
         if clusterCount == 5:
             main.Mininet1.assignSwController(
-                sw="1",
-                ip1=ONOS1Ip,
-                port1=defaultSwPort )
+                sw="s1",
+                ip=ONOS1Ip,
+                port=defaultSwPort )
             main.Mininet1.assignSwController(
-                sw="2",
-                ip1=ONOS2Ip,
-                port1=defaultSwPort )
+                sw="s2",
+                ip=ONOS1Ip,
+                port=defaultSwPort )
             for i in range( 3, 6 ):
                 main.Mininet1.assignSwController(
-                    sw=str( i ),
-                    ip1=ONOS3Ip,
-                    port1=defaultSwPort )
+                    sw="s" + str( i ),
+                    ip=ONOS3Ip,
+                    port=defaultSwPort )
             main.Mininet1.assignSwController(
-                sw="6",
-                ip1=ONOS4Ip,
-                port1=defaultSwPort )
+                sw="s6",
+                ip=ONOS4Ip,
+                port=defaultSwPort )
             main.Mininet1.assignSwController(
-                sw="7",
-                ip1=ONOS5Ip,
-                port1=defaultSwPort )
+                sw="s7",
+                ip=ONOS5Ip,
+                port=defaultSwPort )
             main.Mininet1.assignSwController(
-                sw="8",
-                ip1=ONOS5Ip,
-                port1=defaultSwPort )
+                sw="s8",
+                ip=ONOS5Ip,
+                port=defaultSwPort )
 
         if clusterCount == 7:
             for i in range( 1, 9 ):
                 if i < 8:
                     main.Mininet1.assignSwController(
-                        sw=str( i ),
-                        ip1=ONOSIpList[ i - 1 ],
-                        port1=defaultSwPort )
+                        sw="s" + str( i ),
+                        ip=ONOSIpList[ i - 1 ],
+                        port=defaultSwPort )
                 elif i >= 8:
                     main.Mininet1.assignSwController(
-                        sw=str( i ),
-                        ip1=ONOSIpList[ 6 ],
-                        port1=defaultSwPort )
+                        sw="s" + str( i ),
+                        ip=ONOSIpList[ 6 ],
+                        port=defaultSwPort )
 
         time.sleep( 20 )
 
diff --git a/TestON/tests/IntentPerfNextBM/IntentPerfNextBM.py b/TestON/tests/IntentPerfNextBM/IntentPerfNextBM.py
index 32477a6..7ddc70f 100644
--- a/TestON/tests/IntentPerfNextBM/IntentPerfNextBM.py
+++ b/TestON/tests/IntentPerfNextBM/IntentPerfNextBM.py
@@ -116,40 +116,40 @@
         
         if clusterCount == 1:
             for i in range(1, numSwitch + 1):
-                main.Mininet1.assignSwController(sw=str(i),
-                        ip1=ONOS1Ip, port1=defaultSwPort)
+                main.Mininet1.assignSwController(sw="s" + str(i),
+                        ip=ONOS1Ip, port=defaultSwPort)
         if clusterCount == 3:
             for i in range(1, 3):
-                main.Mininet1.assignSwController(sw=str(i),
-                        ip1=ONOS1Ip, port1=defaultSwPort)
+                main.Mininet1.assignSwController(sw="s" + str(i),
+                        ip=ONOS1Ip, port=defaultSwPort)
             for i in range(3, 6):
-                main.Mininet1.assignSwController(sw=str(i),
-                        ip1=ONOS2Ip, port1=defaultSwPort)
+                main.Mininet1.assignSwController(sw="s" + str(i),
+                        ip=ONOS2Ip, port=defaultSwPort)
             for i in range(6, 9):
-                main.Mininet1.assignSwController(sw=str(i),
-                        ip1=ONOS3Ip, port1=defaultSwPort)
+                main.Mininet1.assignSwController(sw="s" + str(i),
+                        ip=ONOS3Ip, port=defaultSwPort)
         if clusterCount == 5:
-            main.Mininet1.assignSwController(sw='1',
-                    ip1=ONOS1Ip, port1=defaultSwPort)
-            main.Mininet1.assignSwController(sw='2',
-                    ip1=ONOS2Ip, port1=defaultSwPort)
+            main.Mininet1.assignSwController(sw='s1',
+                    ip=ONOS1Ip, port=defaultSwPort)
+            main.Mininet1.assignSwController(sw='s2',
+                    ip=ONOS2Ip, port=defaultSwPort)
             for i in range(3, 6):
-                main.Mininet1.assignSwController(sw=str(i),
-                        ip1=ONOS3Ip, port1=defaultSwPort)
-            main.Mininet1.assignSwController(sw='6',
-                    ip1=ONOS4Ip, port1=defaultSwPort)
-            main.Mininet1.assignSwController(sw='7', 
-                    ip1=ONOS5Ip, port1=defaultSwPort)
-            main.Mininet1.assignSwController(sw='8',
-                    ip1=ONOS5Ip, port1=defaultSwPort)
+                main.Mininet1.assignSwController(sw="s" + str(i),
+                        ip=ONOS3Ip, port=defaultSwPort)
+            main.Mininet1.assignSwController(sw='s6',
+                    ip=ONOS4Ip, port=defaultSwPort)
+            main.Mininet1.assignSwController(sw='s7', 
+                    ip=ONOS5Ip, port=defaultSwPort)
+            main.Mininet1.assignSwController(sw='s8',
+                    ip=ONOS5Ip, port=defaultSwPort)
         if clusterCount == 7:
             for i in range(1, 9):
                 if i < 8:
-                    main.Mininet1.assignSwController(sw=str(i),
-                            ip1=ONOSIpList[i - 1], port1=defaultSwPort)
+                    main.Mininet1.assignSwController(sw="s" + str(i),
+                            ip=ONOSIpList[i - 1], port=defaultSwPort)
                 elif i >= 8:
-                    main.Mininet1.assignSwController(sw=str(i),
-                            ip1=ONOSIpList[6], port1=defaultSwPort)
+                    main.Mininet1.assignSwController(sw="s" + str(i),
+                            ip=ONOSIpList[6], port=defaultSwPort)
 
         time.sleep(20)
         
@@ -376,40 +376,40 @@
         
         if clusterCount == 1:
             for i in range(1, numSwitch + 1):
-                main.Mininet1.assignSwController(sw=str(i),
-                        ip1=ONOS1Ip, port1=defaultSwPort)
+                main.Mininet1.assignSwController(sw="s" + str(i),
+                        ip=ONOS1Ip, port=defaultSwPort)
         if clusterCount == 3:
             for i in range(1, 3):
-                main.Mininet1.assignSwController(sw=str(i),
-                        ip1=ONOS1Ip, port1=defaultSwPort)
+                main.Mininet1.assignSwController(sw="s" + str(i),
+                        ip=ONOS1Ip, port=defaultSwPort)
             for i in range(3, 6):
-                main.Mininet1.assignSwController(sw=str(i),
-                        ip1=ONOS2Ip, port1=defaultSwPort)
+                main.Mininet1.assignSwController(sw="s" + str(i),
+                        ip=ONOS2Ip, port=defaultSwPort)
             for i in range(6, 9):
-                main.Mininet1.assignSwController(sw=str(i),
-                        ip1=ONOS3Ip, port1=defaultSwPort)
+                main.Mininet1.assignSwController(sw="s" + str(i),
+                        ip=ONOS3Ip, port=defaultSwPort)
         if clusterCount == 5:
-            main.Mininet1.assignSwController(sw='1',
-                    ip1=ONOS1Ip, port1=defaultSwPort)
-            main.Mininet1.assignSwController(sw='2',
-                    ip1=ONOS2Ip, port1=defaultSwPort)
+            main.Mininet1.assignSwController(sw='s1',
+                    ip=ONOS1Ip, port=defaultSwPort)
+            main.Mininet1.assignSwController(sw='s2',
+                    ip=ONOS2Ip, port=defaultSwPort)
             for i in range(3, 6):
-                main.Mininet1.assignSwController(sw=str(i),
-                        ip1=ONOS3Ip, port1=defaultSwPort)
-            main.Mininet1.assignSwController(sw='6', 
-                    ip1=ONOS4Ip, port1=defaultSwPort)
-            main.Mininet1.assignSwController(sw='7',
-                    ip1=ONOS5Ip, port1=defaultSwPort)
-            main.Mininet1.assignSwController(sw='8',
-                    ip1=ONOS5Ip, port1=defaultSwPort)
+                main.Mininet1.assignSwController(sw="s" + str(i),
+                        ip=ONOS3Ip, port=defaultSwPort)
+            main.Mininet1.assignSwController(sw='s6', 
+                    ip=ONOS4Ip, port=defaultSwPort)
+            main.Mininet1.assignSwController(sw='s7',
+                    ip=ONOS5Ip, port=defaultSwPort)
+            main.Mininet1.assignSwController(sw='s8',
+                    ip=ONOS5Ip, port=defaultSwPort)
         if clusterCount == 7:
             for i in range(1, 9):
                 if i < 8:
-                    main.Mininet1.assignSwController(sw=str(i),
-                            ip1=ONOSIpList[i - 1], port1=defaultSwPort)
+                    main.Mininet1.assignSwController(sw="s" + str(i),
+                            ip=ONOSIpList[i - 1], port=defaultSwPort)
                 elif i >= 8:
-                    main.Mininet1.assignSwController(sw=str(i),
-                            ip1=ONOSIpList[6], port1=defaultSwPort)
+                    main.Mininet1.assignSwController(sw="s" + str(i),
+                            ip=ONOSIpList[6], port=defaultSwPort)
 
         main.log.report('Batch intent reroute test ')
 
diff --git a/TestON/tests/OnosCHO/OnosCHO.py b/TestON/tests/OnosCHO/OnosCHO.py
index 8c58d04..27aa450 100644
--- a/TestON/tests/OnosCHO/OnosCHO.py
+++ b/TestON/tests/OnosCHO/OnosCHO.py
@@ -192,16 +192,21 @@
         startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
         time.sleep(45)
         main.step( "Assign switches to controllers" )
+        onosIps = []
+        onosPort = []
+        onosIps.append( ONOS1_ip )
+        onosIps.append( ONOS2_ip )
+        onosIps.append( ONOS3_ip )
+        onosPort.append( ONOS1_port )
+        onosPort.append( ONOS2_port )
+        onosPort.append( ONOS3_port )
+
         for i in range( 1, ( main.numMNswitches + 1 ) ):  # 1 to ( num of switches +1 )
             main.Mininet1.assignSwController(
-                sw=str( i ),
+                sw="s" + str( i ),
                 count=int( main.numCtrls ),
-                ip1=main.ONOS1_ip,
-                port1=main.ONOS1_port,
-                ip2=main.ONOS2_ip,
-                port2=main.ONOS2_port,
-                ip3=main.ONOS3_ip,
-                port3=main.ONOS3_port )
+                ip=onosIps,
+                port=onosPort )
 
         switch_mastership = main.TRUE
         for i in range( 1, ( main.numMNswitches + 1 ) ):
@@ -278,16 +283,21 @@
         startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
         time.sleep(15)
         main.step( "Assign switches to controllers" )
+        onosIps = []
+        onosPort = []
+        onosIps.append( ONOS1_ip )
+        onosIps.append( ONOS2_ip )
+        onosIps.append( ONOS3_ip )
+        onosPort.append( ONOS1_port )
+        onosPort.append( ONOS2_port )
+        onosPort.append( ONOS3_port )
+
         for i in range( 1, ( main.numMNswitches + 1 ) ):  # 1 to ( num of switches +1 )
             main.Mininet1.assignSwController(
-                sw=str( i ),
+                sw="s" + str( i ),
                 count=int( main.numCtrls ),
-                ip1=main.ONOS1_ip,
-                port1=main.ONOS1_port,
-                ip2=main.ONOS2_ip,
-                port2=main.ONOS2_port,
-                ip3=main.ONOS3_ip,
-                port3=main.ONOS3_port )
+                ip=onosIps,
+                port=onosPort )
 
         switch_mastership = main.TRUE
         for i in range( 1, ( main.numMNswitches + 1 ) ):
@@ -345,16 +355,21 @@
         startStatus = main.Mininet1.startNet(topoFile = main.newTopo)
         time.sleep(60)
         main.step( "Assign switches to controllers" )
+        onosIps = []
+        onosPort = []
+        onosIps.append( ONOS1_ip )
+        onosIps.append( ONOS2_ip )
+        onosIps.append( ONOS3_ip )
+        onosPort.append( ONOS1_port )
+        onosPort.append( ONOS2_port )
+        onosPort.append( ONOS3_port )
+
         for i in range( 1, ( main.numMNswitches + 1 ) ):  # 1 to ( num of switches +1 )
             main.Mininet1.assignSwController(
-                sw=str( i ),
-                count=int( main.numCtrls ), 
-                ip1=main.ONOS1_ip,
-                port1=main.ONOS1_port,
-                ip2=main.ONOS2_ip,
-                port2=main.ONOS2_port,
-                ip3=main.ONOS3_ip,
-                port3=main.ONOS3_port )
+                sw="s" + str( i ),
+                count=int( main.numCtrls ),
+                ip=onosIps,
+                port=onosPort )
 
         switch_mastership = main.TRUE
         for i in range( 1, ( main.numMNswitches + 1 ) ):
diff --git a/TestON/tests/PingallExample/PingallExample.py b/TestON/tests/PingallExample/PingallExample.py
index c03b0f1..914f48e 100644
--- a/TestON/tests/PingallExample/PingallExample.py
+++ b/TestON/tests/PingallExample/PingallExample.py
@@ -118,9 +118,9 @@
 
         for i in range( 1, 14 ):
             main.Mininet1.assignSwController(
-                sw=str( i ),
-                ip1=ONOS1Ip,
-                port1=ONOS1Port )
+                sw="s" + str( i ),
+                ip=ONOS1Ip,
+                port=ONOS1Port )
 
         mastershipCheck = main.TRUE
         for i in range( 1, 14 ):