Merge "add some values into SCPFintentReroute.param"
diff --git a/TestON/drivers/common/api/controller/onosrestdriver.py b/TestON/drivers/common/api/controller/onosrestdriver.py
index 082ab17..15e1e88 100755
--- a/TestON/drivers/common/api/controller/onosrestdriver.py
+++ b/TestON/drivers/common/api/controller/onosrestdriver.py
@@ -1842,12 +1842,12 @@
             else:
                 main.log.error( "Error with REST request, response was: " +
                                     str( response ) )
-                return main.FALSE
+                return main.FALSE, response
         except NotImplementedError as e:
             raise e  # Inform the caller
         except ( AttributeError, TypeError ):
             main.log.exception( self.name + ": Object not as expected" )
-            return None
+            return None, None
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanup()
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index d46e99a..4df23ab 100755
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -388,8 +388,6 @@
                     # Prompt returned
                     break
             main.log.debug( output )
-            # FIXME: This is a workaround for a bug in buck see ONOS-5320
-            self.buckPackage( )
             return ret
         except pexpect.TIMEOUT:
             main.log.exception( self.name + ": TIMEOUT exception found" )
@@ -405,53 +403,6 @@
             main.cleanup()
             main.exit()
 
-    def buckPackage( self, timeout=180 ):
-        """
-        Package onos using buck. This will not build the source and this rule
-        should be automatically run when building onos.
-        """
-        try:
-            ret = main.TRUE
-            self.handle.sendline( "buck build package" )
-            self.handle.expect( "buck build package" )
-            output = ""
-            while True:
-                i = self.handle.expect( [ "This does not appear to be the root of a Buck project.",
-                                          "\n",
-                                          "BUILD FAILED",
-                                          "\$" ],
-                                        timeout=timeout )
-                output += str( self.handle.before + self.handle.after )
-                if i == 0:
-                    main.log.error( "Wrong location" )
-                    ret = main.FALSE
-                elif i == 1:
-                    # end of a line, buck is still printing output
-                    pass
-                elif i == 2:
-                    # Build failed
-                    main.log.error( "Build failed" )
-                    ret = main.FALSE
-                elif i == 3:
-                    # Prompt returned
-                    break
-            main.log.debug( output )
-            return ret
-        except pexpect.TIMEOUT:
-            main.log.exception( self.name + ": TIMEOUT exception found" )
-            main.log.error( self.name + ":    " + self.handle.before )
-            return main.FALSE
-        except pexpect.EOF:
-            main.log.error( self.name + ": EOF exception found" )
-            main.log.error( self.name + ":    " + self.handle.before )
-            main.cleanup()
-            main.exit()
-        except Exception:
-            main.log.exception( "Failed to package ONOS" )
-            main.cleanup()
-            main.exit()
-
-
     def gitPull( self, comp1="", fastForward=True ):
         """
         Assumes that "git pull" works without login
@@ -2425,11 +2376,9 @@
         except Exception:
             main.log.exception( "Uncaught exception" )
 
-    def startBasicONOS(self, nodeList, opSleep = 60, onosStartupSleep = 60):
-
+    def startBasicONOS( self, nodeList, opSleep=60, onosStartupSleep=60 ):
         '''
         Start onos cluster with defined nodes, but only with drivers app
-
         '''
         import time
 
@@ -2444,7 +2393,7 @@
         verifyResult = self.verifyCell()
 
         main.log.info( self.name + ": Creating ONOS package" )
-        packageResult = self.onosPackage( opTimeout=opSleep )
+        packageResult = self.buckBuild( timeout=opSleep )
 
         main.log.info( self.name + ": Installing ONOS package" )
         for nd in nodeList:
diff --git a/TestON/drivers/common/cli/ovsdbdriver.py b/TestON/drivers/common/cli/ovsdbdriver.py
index 5921dc8..150e5fa 100644
--- a/TestON/drivers/common/cli/ovsdbdriver.py
+++ b/TestON/drivers/common/cli/ovsdbdriver.py
@@ -44,7 +44,7 @@
                     pwd=self.pwd)
 
             if self.handle:
-                main.log.onfo( "Connection successful to the ovsdb node " +
+                main.log.info( "Connection successful to the ovsdb node " +
                                 self.name )
                 return self.handle
             else:
@@ -396,4 +396,4 @@
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
-            main.exit()
\ No newline at end of file
+            main.exit()
diff --git a/TestON/tests/CHOTestMonkey/CHOTestMonkey.params b/TestON/tests/CHOTestMonkey/CHOTestMonkey.params
index 85b2e0e..d9063cd 100644
--- a/TestON/tests/CHOTestMonkey/CHOTestMonkey.params
+++ b/TestON/tests/CHOTestMonkey/CHOTestMonkey.params
@@ -36,7 +36,7 @@
         <ipv4Prefix>10.1.</ipv4Prefix>
         <karafCliTimeout>7200000</karafCliTimeout>
         <testDuration>86400</testDuration>
-        <package>off</package>
+        <package>on</package>
         <autoPull>off</autoPull>
         <branch>master</branch>
     </TEST>
@@ -94,8 +94,8 @@
             <CLIParamNum>0</CLIParamNum>
             <rerunInterval>5</rerunInterval>
             <maxRerunNum>5</maxRerunNum>
-            <coreFlowNum>4</coreFlowNum>
-            <coreFlowNum6>6</coreFlowNum6>
+            <coreFlowNum>3</coreFlowNum>
+            <coreFlowNum6>5</coreFlowNum6>
         </FlowCheck>
 
         <TrafficCheck>
@@ -392,6 +392,7 @@
         <addPointIntentWeight>3</addPointIntentWeight>
         <linkDownWeight>3</linkDownWeight>
         <deviceDownWeight>2</deviceDownWeight>
+        <toggleFlowObj>0</toggleFlowObj>
     </CASE70>
 
     <CASE80>
diff --git a/TestON/tests/CHOTestMonkey/CHOTestMonkey.py b/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
index e6606d4..0dc7a33 100644
--- a/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
+++ b/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
@@ -781,9 +781,12 @@
         pointIntentNum = 0
         downDeviceNum = 0
         downLinkNum = 0
+        flowObj = False
         upControllers = [ 1, 2, 3 ]
         while True:
             events = []
+            for i in range( int( main.params[ 'CASE70' ][ 'toggleFlowObj' ] ) ):
+                events.append( 'toggle-flowobj' )
             for i in range( int( main.params[ 'CASE70' ][ 'addHostIntentWeight' ] ) ):
                 events.append( 'add-host-intent' )
             for i in range( int( main.params[ 'CASE70' ][ 'addPointIntentWeight' ] ) ):
@@ -838,6 +841,12 @@
             elif event == 'device-up':
                 main.eventGenerator.triggerEvent( EventType().NETWORK_DEVICE_UP, EventScheduleMethod().RUN_BLOCK, 'random' )
                 downDeviceNum -= 1
+            elif event == 'toggle-flowobj':
+                if flowObj == False:
+                    main.eventGenerator.triggerEvent( EventType().ONOS_SET_FLOWOBJ, EventScheduleMethod().RUN_BLOCK, 'true' )
+                else:
+                    main.eventGenerator.triggerEvent( EventType().ONOS_SET_FLOWOBJ, EventScheduleMethod().RUN_BLOCK, 'false' )
+                flowObj = not flowObj
             else:
                 pass
             main.eventGenerator.triggerEvent( EventType().CHECK_TOPO, EventScheduleMethod().RUN_NON_BLOCK )
diff --git a/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py b/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py
index f1ffb9b..183a3e6 100755
--- a/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py
+++ b/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py
@@ -344,15 +344,20 @@
         main.addedBatchList = []
         q = Queue()
         tAllAdded = 0
+        main.postFailed = False
 
         def postWorker(id):
             while True:
                 item = q.get()
                 #print json.dumps(item)
                 status,response = main.ONOSrest.sendFlowBatch(batch = item)
-                main.log.info("Thread {} is working on posting. ".format(id))
-                #print json.dumps(response)
-                main.addedBatchList.append(response[1])
+                if status == main.TRUE:
+                    main.log.info("Thread {} is working on posting. ".format(id))
+                    #print json.dumps(response)
+                    main.addedBatchList.append(response[1])
+                else:
+                    main.log.error( "Thread {} failed to post.".format(id) )
+                    main.postFailed = True
                 q.task_done()
 
         for i in range( int( main.params['CASE2100']['numThreads'])):
@@ -367,6 +372,10 @@
 
         q.join()
         tLastPostEnd = time.time()
+        if main.postFailed:
+            main.log.error( "Flow batch posting failed, exit test" )
+            main.cleanup()
+            main.exit()
 
         main.step("Check to ensure all flows are in added state.")
         #pprint(main.addedBatchList)
diff --git a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params
index 9af6dae..930aaf8 100755
--- a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params
+++ b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params
@@ -23,7 +23,7 @@
     </DATABASE>
 
     <ENV>
-        <cellApps>drivers,openflow</cellApps>
+        <cellApps>drivers</cellApps>
     </ENV>
 
     <SearchTerm>
@@ -63,7 +63,7 @@
 
     <TOPOLOGY>
         <topology>torus</topology>
-        <scale>5,10,20,30,35,40,50,55,60</scale>
+        <scale>5,10,20,30,35,40,45,50,55,60</scale>
         <host>True</host>
     </TOPOLOGY>
 
diff --git a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
index 815d772..86a99fd 100644
--- a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
+++ b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
@@ -278,6 +278,8 @@
                                     " topology failed to start" )
 
         time.sleep( main.MNSleep )
+        main.CLIs[ 0 ].activateApp( "org.onosproject.openflow" )
+        time.sleep( main.MNSleep )
 
     def CASE11( self, main ):
         """