add null provider test setup case

Change-Id: I5502e06b6d710e2b6ac5eeb14d81cd888ce59be4
diff --git a/TestON/drivers/common/api/controller/onosrestdriver.py b/TestON/drivers/common/api/controller/onosrestdriver.py
index 61284d6..0d335c1 100644
--- a/TestON/drivers/common/api/controller/onosrestdriver.py
+++ b/TestON/drivers/common/api/controller/onosrestdriver.py
@@ -1575,7 +1575,7 @@
                            "treatment":{"instructions":[]},
                            "selector": {"criteria":[]}}
 
-            main.log.info("fl: " + str(fl))
+            #main.log.info("fl: " + str(fl))
             if dev <= numSw:
                 deviceId = deviceIdpreFix + "{0:0{1}x}".format(dev,16)
                 #print deviceId
diff --git a/TestON/tests/COMPflow/COMPflow.params b/TestON/tests/COMPflow/COMPflow.params
index b07779f..c31cd64 100755
--- a/TestON/tests/COMPflow/COMPflow.params
+++ b/TestON/tests/COMPflow/COMPflow.params
@@ -9,7 +9,8 @@
     # 10 - Start mininet and verify topology
 
 
-    <testcases>1,10,100,1000,100,2000,100,110</testcases>
+    # <!-- <testcases>1,10,100,1000,100,2000,100,110</testcases> -->
+    <testcases>1,2,10,100,1000,100,2000,100,110</testcases>
 
     <SCALE>
         <max>1</max>
@@ -17,16 +18,10 @@
 
     <DEBUG>on</DEBUG>
 
-    <DEPENDENCY>
-        <path>/tests/COMPflow/Dependency/</path>
-        <wrapper1>startUp</wrapper1>
-        <wrapper2>topo</wrapper2>
-        <topology>topo-flow.py</topology>
-    </DEPENDENCY>
 
     <ENV>
-        <cellName>productionCell</cellName>
-        <cellApps>drivers,openflow-base</cellApps>
+        <cellName>temp</cellName>
+        <cellApps>drivers</cellApps>
     </ENV>
 
     <GIT>
@@ -39,10 +34,16 @@
     </CTRL>
 
     <CASE10>
-        <numSw>15</numSw>
-        <mnArgs> --topo linear,15 --switch ovsk,protocols=OpenFlow13 --controller remote</mnArgs>
+        <numSw>63</numSw>
+        <mnArgs> --topo linear,63 --switch ovsk,protocols=OpenFlow13 --controller remote</mnArgs>
     </CASE10>
 
+    <CASE11>
+        <numSw>63</numSw>
+        <nullTopo>linear</nullTopo>
+        <nullStart>true</nullStart>
+    </CASE11>
+
     <CASE1000>
         <batchSize>200</batchSize>
         <batches>500</batches>
@@ -50,9 +51,10 @@
 
     <SLEEP>
         <startup>15</startup>
-        <startMN>5</startMN>
+        <startMN>15</startMN>
         <addFlow>10</addFlow>
         <delFlow>10</delFlow>
+        <chkFlow>1</chkFlow>
     </SLEEP>
 
 </PARAMS>
diff --git a/TestON/tests/COMPflow/COMPflow.py b/TestON/tests/COMPflow/COMPflow.py
index 4cd02b7..7b91431 100644
--- a/TestON/tests/COMPflow/COMPflow.py
+++ b/TestON/tests/COMPflow/COMPflow.py
@@ -104,6 +104,7 @@
         for i in range( main.numCtrls ):
             tempOnosIp.append( main.ONOSip[i] )
 
+        main.log.info("Apps in cell file: " + main.apps)
         main.ONOSbench.createCellFile( main.ONOSbench.ip_address, "temp", main.Mininet1.ip_address, main.apps, tempOnosIp )
 
         main.step( "Apply cell to environment" )
@@ -117,7 +118,7 @@
                                  onfail="Failed to apply cell to environment " )
 
         main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.onosPackage(opTimeout=120)
+        packageResult = main.ONOSbench.onosPackage(opTimeout=240)
         stepResult = packageResult
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
@@ -178,13 +179,19 @@
         '''
             Start Mininet
         '''
-        import json
+        import time
 
         main.numSw = int(main.params['CASE10']['numSw'])
-        main.case( "Setup mininet and compare ONOS topology view to Mininet topology" )
+        main.case( "Enable openflow-base on onos and start Mininet." )
         main.caseExplanation = "Start mininet with custom topology and compare topology " +\
                 "elements between Mininet and ONOS"
 
+        main.step("Activate openflow-base App")
+        stepResult = main.ONOSbench.onosCli( ONOSIp = main.ONOSip[0],  cmdstr = "app activate org.onosproject.openflow-base" )
+        time.sleep(10)
+        print stepResult
+        time.sleep(5)
+
         main.step( "Setup Mininet Linear Topology with " + str(main.numSw) + " switches" )
         stepResult = main.Mininet1.startNet( args = main.params['CASE10']['mnArgs'] )
 
@@ -193,6 +200,7 @@
                                  onpass="Successfully loaded topology",
                                  onfail="Failed to load topology" )
 
+        time.sleep(int(main.params['SLEEP']['startMN']))
         main.step( "Assign switches to controller" )
         for i in range(1, main.numSw + 1):
             main.Mininet1.assignSwController( "s" + str(i), main.ONOSip[0] )
@@ -202,8 +210,39 @@
                                  onpass="Successfully assigned switch to controller",
                                  onfail="Failed to assign switch to controller" )
 
+        main.deviceIdPrefix = "of:"
+
         time.sleep( main.startMNSleep )
 
+    def CASE11( self, main ):
+        '''
+            Start Null Provider
+        '''
+        import time
+
+        main.numSw = int(main.params['CASE11']['numSw'])
+
+        main.case("Activate Null Provider App")
+        stepResult = main.ONOSbench.onosCli( ONOSIp = main.ONOSip[0],  cmdstr = "app activate org.onosproject.null" )
+        time.sleep(10)
+        print stepResult
+        time.sleep(5)
+
+        main.case( "Setup Null Provider for linear Topology" )
+        main.step( "Setup Null Provider Linear Topology with " + str(main.numSw) + " devices." )
+        main.ONOSbench.onosCfgSet( main.ONOSip[0], "org.onosproject.provider.nil.NullProviders", "deviceCount " + str(main.numSw))
+        main.ONOSbench.onosCfgSet( main.ONOSip[0], "org.onosproject.provider.nil.NullProviders", "topoShape " + main.params['CASE11']['nullTopo'] )
+        main.ONOSbench.onosCfgSet( main.ONOSip[0], "org.onosproject.provider.nil.NullProviders", "enabled " + main.params['CASE11']['nullStart'])
+        time.sleep(5)
+
+        main.log.info("Check to make sure null providers are configured correctly.")
+        main.ONOSbench.handle.sendline("onos $OC1 summary")
+        stepResult = main.ONOSbench.handle.expect(":~")
+        main.log.info("ONOS Summary: " + main.ONOSbench.handle.before)
+
+        main.deviceIdPrefix = "null:"
+
+        time.sleep( main.startMNSleep )
 
 
 
@@ -239,6 +278,7 @@
                                                            swIndex = ind,
                                                            batchSize = main.batchSize,
                                                            batchIndex = index,
+                                                           deviceIdpreFix=main.deviceIdPrefix,
                                                            ingressPort = 2,
                                                            egressPort = 3)
             main.flowJsonBatchList.append(flowJsonBatch)
@@ -260,11 +300,11 @@
         tLastPostEnd = time.time()
 
         main.step("Check to ensure all flows are in added state.")
-        pprint(main.addedBatchList)
+        #pprint(main.addedBatchList)
         resp = main.FALSE
         while resp != main.TRUE:
             resp = main.ONOSrest.checkFlowsState()
-            time.sleep(0.5)
+            time.sleep( float(main.params['SLEEP']['chkFlow']) )
         tAllAdded = time.time()
 
         main.numFlows = int(main.params['CASE1000']['batches']) *\
@@ -277,7 +317,7 @@
         duration = tAllAdded - tLastPostEnd
         main.log.info("Elapse time from end of last REST POST to Flows in ADDED state: " +\
                       str(duration))
-        main.log.info("Rate of Batch Flow add is (flows/sec): " + str( main.numFlows / duration))
+        main.log.info("Rate of Confirmed Batch Flow ADD is (flows/sec): " + str( main.numFlows / duration))
 
     def CASE2000(self, main):
         import time
@@ -307,16 +347,15 @@
         tAllRemoved = time.time()
 
         main.log.info("Total number of flows: " + str (int(main.params['CASE1000']['batches']) *\
-                                                    int(main.params['CASE1000']['batchSize']) *\
-                                                    int(main.params['CASE10']['numSw'])) )
+                                                    int(main.params['CASE1000']['batchSize']) ))
         main.log.info("Sum of each DELETE elapse time: " + str(numpy.sum(rmTimes)) )
         main.log.info("Total DELETE elapse time: " + str(tLastRemoveEnd-tStartRemove))
-        main.log.info("Rate of DELETE Controller response: " + str(main.numFlows / (tLastRemoveEnd - tStartRemove)))
+        main.log.info("Rate of DELETE Controller response (flows/sec): " + str(main.numFlows / (tLastRemoveEnd - tStartRemove)))
 
         duration = tAllRemoved - tLastRemoveEnd
         main.log.info("Elapse time from end of last REST DELETE to Flows in REMOVED state: " +\
                       str(duration))
-        main.log.info("Rate of Batch Flow DELETE is (flows/sec): " + str( main.numFlows / duration))
+        main.log.info("Rate of Confirmed Batch Flow DELETE is (flows/sec): " + str( main.numFlows / duration))
 
     def CASE100(self,main):
         from pprint import pprint
diff --git a/TestON/tests/COMPflow/COMPflow.topo b/TestON/tests/COMPflow/COMPflow.topo
index e72bf1b..f49c994 100755
--- a/TestON/tests/COMPflow/COMPflow.topo
+++ b/TestON/tests/COMPflow/COMPflow.topo
@@ -8,6 +8,7 @@
             <type>OnosDriver</type>
             <connect_order>1</connect_order>
             <COMPONENTS>
+                <home>~/Projects/onos</home>
             </COMPONENTS>
         </ONOSbench>