add null provider test setup case

Change-Id: I5502e06b6d710e2b6ac5eeb14d81cd888ce59be4
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