Mininet startup and controller assignment is implemented

Change-Id: I1d32999ab02c2998fde2290200cdc3cecdb4d8e1
diff --git a/TestON/tests/FUNCflow/FUNCflow.params b/TestON/tests/FUNCflow/FUNCflow.params
index 6649295..e12ee6c 100755
--- a/TestON/tests/FUNCflow/FUNCflow.params
+++ b/TestON/tests/FUNCflow/FUNCflow.params
@@ -5,15 +5,14 @@
     # 2 - install ONOS
     # 8 - Compare topology
     # 9 - Report logs
-    # 10 - Start mininet
-    # 11 - Assign switches to controller
+    # 10 - Start mininet and assign switches to controller
     # 1000 - Add flows
     # 2000 - Delete flows
     # 3000 - Modify flow rule selectors
     # 4000 - Modify flow rule treatments
     # 5000 - flow rule controller
     # 100 - Compare switch flow table with ONOS
-    <testcases>1,2</testcases>
+    <testcases>1,2,10</testcases>
 
     <SCALE>
         <max>3</max>
@@ -22,9 +21,15 @@
     <DEPENDENCY>
         <path>/tests/FUNCflow/Dependency/</path>
         <wrapper1>startUp</wrapper1>
-        <topology>single.py</topology>
+        <topology>flow-2sw.py</topology>
     </DEPENDENCY>
 
+    <TOPO>
+        <numSwitches>2</numSwitches>
+        <numHosts>4</numHosts>
+        <numLinks>10</numLinks>
+    </TOPO>
+
     <ENV>
         <cellName>productionCell</cellName>
         <cellApps>drivers,openflow,proxyarp,mobility</cellApps>
diff --git a/TestON/tests/FUNCflow/FUNCflow.py b/TestON/tests/FUNCflow/FUNCflow.py
index 357b58c..c2ee323 100644
--- a/TestON/tests/FUNCflow/FUNCflow.py
+++ b/TestON/tests/FUNCflow/FUNCflow.py
@@ -32,6 +32,9 @@
         main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
         main.maxNodes = int( main.params[ 'SCALE' ][ 'max' ] )
         main.ONOSport = main.params[ 'CTRL' ][ 'port' ]
+        main.numSwitches = int( main.params[ 'TOPO' ][ 'numSwitches' ] )
+        main.numHosts = int( main.params[ 'TOPO' ][ 'numHosts' ] )
+        main.numLinks = int( main.params[ 'TOPO' ][ 'numLinks' ] )
         wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
         main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
         gitPull = main.params[ 'GIT' ][ 'pull' ]
@@ -52,6 +55,11 @@
                                         wrapperFile1 +
                                         ".py" )
 
+        copyResult = main.ONOSbench.scp( main.Mininet1,
+                                         main.dependencyPath+main.topology,
+                                         main.Mininet1.home+'/custom/',
+                                         direction="to" )
+
         if main.CLIs:
             stepResult = main.TRUE
         else:
@@ -210,13 +218,35 @@
 
     def CASE10( self, main ):
         '''
-            Start Mininet with Openflow 1.3
+            Start Mininet with
         '''
+        main.case( "Setup mininet and assign switches to controllers" )
+        main.step( "Setup Mininet Topology" )
+        topology = main.Mininet1.home + '/custom/' + main.topology
+        stepResult1 = main.Mininet1.startNet( topoFile=topology )
 
-    def CASE11( self, main ):
-        '''
-            Assign switches to controller
-        '''
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult1,
+                                 onpass="Successfully loaded topology",
+                                 onfail="Failed to load topology" )
+
+        main.step( "Assign switches to controllers" )
+        for i in range( main.numSwitches ):
+            stepResult2 = main.Mininet1.assignSwController(
+                                            sw="s" + str( i+1 ),
+                                            ip=main.ONOSip )
+            if not stepResult2:
+                break
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult2,
+                                 onpass="Controller assignment successfull",
+                                 onfail="Controller assignment failed" )
+
+        caseResult = stepResult1 and stepResult2
+        if not caseResult:
+            main.cleanup()
+            main.exit()
 
     def CASE1000( self, main ):
         '''