[ONOS-7915] Run CHO test on Flex POD

Change-Id: Id8e59e044361a7781bed39f0878df97c2a67af8f
(cherry picked from commit c61aaa231a325558580fc55b774408a91a4dc0c1)
diff --git a/TestON/tests/CHOTestMonkey/CHOTestMonkey.params b/TestON/tests/CHOTestMonkey/CHOTestMonkey.params
index 1452741..b45d70f 100644
--- a/TestON/tests/CHOTestMonkey/CHOTestMonkey.params
+++ b/TestON/tests/CHOTestMonkey/CHOTestMonkey.params
@@ -34,6 +34,7 @@
     <TEST>
         <topo>1</topo>
         <IPv6>on</IPv6>
+        <restartCluster>True</restartCluster>
         <dataPlaneConnectivity>False</dataPlaneConnectivity>
         <numCtrl>3</numCtrl>
         <pauseTest>off</pauseTest>
@@ -407,7 +408,7 @@
         </topo4>
         <mininetArgs></mininetArgs>
         <loadTopoSleep>5</loadTopoSleep>
-        <excludeSwitches></excludeSwitches>
+        <excludeNodes></excludeNodes>
     </TOPO>
 
     <CASE1>
@@ -435,13 +436,16 @@
 
     <CASE70>
         <sleepSec>2</sleepSec>
-        <addHostIntentWeight>3</addHostIntentWeight>
-        <addPointIntentWeight>3</addPointIntentWeight>
-        <linkDownWeight>3</linkDownWeight>
-        <deviceDownWeight>2</deviceDownWeight>
-        <portDownWeight>0</portDownWeight>
-        <onosDownWeight>1</onosDownWeight>
-        <toggleFlowObj>0</toggleFlowObj>
+        <eventWeight>
+            <add-host-intent>3</add-host-intent>
+            <add-point-intent>3</add-point-intent>
+            <link-down>3</link-down>
+            <device-down>2</device-down>
+            <onos-down>1</onos-down>
+            <toggle-flowobj>0</toggle-flowobj>
+        </eventWeight>
+        <skipSwitches></skipSwitches>
+        <skipLinks></skipLinks>
     </CASE70>
 
     <CASE80>
diff --git a/TestON/tests/CHOTestMonkey/CHOTestMonkey.params.trellis b/TestON/tests/CHOTestMonkey/CHOTestMonkey.params.trellis
index f6aa628..ae54287 100644
--- a/TestON/tests/CHOTestMonkey/CHOTestMonkey.params.trellis
+++ b/TestON/tests/CHOTestMonkey/CHOTestMonkey.params.trellis
@@ -12,7 +12,7 @@
     # 100. Do nothing
 
     <testcases>
-        0,2,4,5,6,7,10,70,100
+        0,2,4,5,6,7,10,70
     </testcases>
 
     <GIT>
@@ -23,6 +23,7 @@
     <TEST>
         <topo>10</topo>
         <IPv6>on</IPv6>
+        <restartCluster>True</restartCluster>
         <dataPlaneConnectivity>True</dataPlaneConnectivity>
         <numCtrl>3</numCtrl>
         <pauseTest>on</pauseTest>
@@ -52,7 +53,7 @@
             <CLI>null</CLI>
             <CLIParamNum>0</CLIParamNum>
             <rerunInterval>5</rerunInterval>
-            <maxRerunNum>5</maxRerunNum>
+            <maxRerunNum>3</maxRerunNum>
         </Event>
 
         <TestPause>
@@ -87,28 +88,6 @@
             <CLIParamNum>0</CLIParamNum>
         </TestDebug>
 
-        <IntentCheck>
-            <status>off</status>
-            <typeIndex>10</typeIndex>
-            <typeString>CHECK_INTENT</typeString>
-            <CLI>check-intent</CLI>
-            <CLIParamNum>0</CLIParamNum>
-            <rerunInterval>5</rerunInterval>
-            <maxRerunNum>5</maxRerunNum>
-        </IntentCheck>
-
-        <FlowCheck>
-            <status>off</status>
-            <typeIndex>11</typeIndex>
-            <typeString>CHECK_FLOW</typeString>
-            <CLI>check-flow</CLI>
-            <CLIParamNum>0</CLIParamNum>
-            <rerunInterval>5</rerunInterval>
-            <maxRerunNum>5</maxRerunNum>
-            <coreFlowNum>3</coreFlowNum>
-            <coreFlowNum6>5</coreFlowNum6>
-        </FlowCheck>
-
         <TrafficCheck>
             <status>on</status>
             <typeIndex>12</typeIndex>
@@ -116,7 +95,7 @@
             <CLI>check-traffic</CLI>
             <CLIParamNum>0</CLIParamNum>
             <rerunInterval>10</rerunInterval>
-            <maxRerunNum>5</maxRerunNum>
+            <maxRerunNum>3</maxRerunNum>
             <pingWait>1</pingWait>
             <pingTimeout>10</pingTimeout>
         </TrafficCheck>
@@ -128,7 +107,7 @@
             <CLI>check-topo</CLI>
             <CLIParamNum>0</CLIParamNum>
             <rerunInterval>5</rerunInterval>
-            <maxRerunNum>5</maxRerunNum>
+            <maxRerunNum>3</maxRerunNum>
         </TopoCheck>
 
         <ONOSCheck>
@@ -138,7 +117,7 @@
             <CLI>check-onos</CLI>
             <CLIParamNum>0</CLIParamNum>
             <rerunInterval>10</rerunInterval>
-            <maxRerunNum>5</maxRerunNum>
+            <maxRerunNum>3</maxRerunNum>
         </ONOSCheck>
 
         <RaftLogSizeCheck>
@@ -204,7 +183,7 @@
             <CLI>onos-down</CLI>
             <CLIParamNum>1</CLIParamNum>
             <rerunInterval>5</rerunInterval>
-            <maxRerunNum>5</maxRerunNum>
+            <maxRerunNum>3</maxRerunNum>
         </ONOSDown>
 
         <ONOSUp>
@@ -214,7 +193,7 @@
             <CLI>onos-up</CLI>
             <CLIParamNum>1</CLIParamNum>
             <rerunInterval>5</rerunInterval>
-            <maxRerunNum>5</maxRerunNum>
+            <maxRerunNum>3</maxRerunNum>
         </ONOSUp>
 
         <SetCfg>
@@ -224,7 +203,7 @@
             <CLI>set-cfg</CLI>
             <CLIParamNum>3</CLIParamNum>
             <rerunInterval>5</rerunInterval>
-            <maxRerunNum>5</maxRerunNum>
+            <maxRerunNum>3</maxRerunNum>
         </SetCfg>
 
         <BalanceMasters>
@@ -234,7 +213,7 @@
             <CLI>balance-masters</CLI>
             <CLIParamNum>0</CLIParamNum>
             <rerunInterval>5</rerunInterval>
-            <maxRerunNum>5</maxRerunNum>
+            <maxRerunNum>3</maxRerunNum>
         </BalanceMasters>
 
         <addAllChecks>
@@ -244,51 +223,6 @@
             <CLI>check-all</CLI>
             <CLIParamNum>0</CLIParamNum>
         </addAllChecks>
-
-        <randomLinkToggle>
-            <status>on</status>
-            <typeIndex>120</typeIndex>
-            <typeString>NETWORK_LINK_RANDOM_TOGGLE</typeString>
-            <CLI>link-toggle-random</CLI>
-            <CLIParamNum>1</CLIParamNum>
-            <sleepBeforeCheck>10</sleepBeforeCheck>
-        </randomLinkToggle>
-
-        <randomLinkGroupToggle>
-            <status>on</status>
-            <typeIndex>121</typeIndex>
-            <typeString>NETWORK_LINK_GROUP_RANDOM_TOGGLE</typeString>
-            <CLI>link-group-toggle-random</CLI>
-            <CLIParamNum>3</CLIParamNum>
-            <sleepBeforeCheck>10</sleepBeforeCheck>
-        </randomLinkGroupToggle>
-
-        <randomDeviceToggle>
-            <status>on</status>
-            <typeIndex>122</typeIndex>
-            <typeString>NETWORK_DEVICE_RANDOM_TOGGLE</typeString>
-            <CLI>device-toggle-random</CLI>
-            <CLIParamNum>1</CLIParamNum>
-            <sleepBeforeCheck>10</sleepBeforeCheck>
-        </randomDeviceToggle>
-
-        <randomDeviceGroupToggle>
-            <status>on</status>
-            <typeIndex>123</typeIndex>
-            <typeString>NETWORK_DEVICE_GROUP_RANDOM_TOGGLE</typeString>
-            <CLI>device-group-toggle-random</CLI>
-            <CLIParamNum>3</CLIParamNum>
-            <sleepBeforeCheck>10</sleepBeforeCheck>
-        </randomDeviceGroupToggle>
-
-        <randomONOSToggle>
-            <status>on</status>
-            <typeIndex>140</typeIndex>
-            <typeString>ONOS_ONOS_RANDOM_TOGGLE</typeString>
-            <CLI>onos-toggle-random</CLI>
-            <CLIParamNum>1</CLIParamNum>
-            <sleepBeforeCheck>10</sleepBeforeCheck>
-        </randomONOSToggle>
     </EVENT>
 
     <SCHEDULER>
@@ -308,7 +242,7 @@
         </topo10>
         <mininetArgs>--dhcp=1 --routers=1 --ipv6=1 --ipv4=1</mininetArgs>
         <loadTopoSleep>120</loadTopoSleep>
-        <excludeSwitches>leaf5</excludeSwitches>
+        <excludeNodes>cs0,cs1,r1,r2,nat,bgp1,bgp2,dhcp,dhcp6</excludeNodes>
     </TOPO>
 
     <CASE2>
@@ -323,18 +257,18 @@
 
     <CASE70>
         <sleepSec>60</sleepSec>
-        <addHostIntentWeight>0</addHostIntentWeight>
-        <addPointIntentWeight>0</addPointIntentWeight>
-        <linkDownWeight>0</linkDownWeight>
-        <deviceDownWeight>2</deviceDownWeight>
-        <portDownWeight>3</portDownWeight>
-        <onosDownWeight>1</onosDownWeight>
-        <toggleFlowObj>0</toggleFlowObj>
+        <eventWeight>
+            <port-down>3</port-down>
+            <device-down>2</device-down>
+            <onos-down>1</onos-down>
+        </eventWeight>
+        <skipSwitches>leaf5</skipSwitches>
+        <skipLinks>spine103,spine104,leaf1,leaf6</skipLinks>
     </CASE70>
 
     <CASE80>
         <filePath>/home/sdn/log-for-replay</filePath>
-        <sleepTime>10</sleepTime>
+        <sleepTime>5</sleepTime>
         <skipChecks>on</skipChecks>
     </CASE80>
 </PARAMS>
diff --git a/TestON/tests/CHOTestMonkey/CHOTestMonkey.params.trellis.flex b/TestON/tests/CHOTestMonkey/CHOTestMonkey.params.trellis.flex
new file mode 100644
index 0000000..9f2f22b
--- /dev/null
+++ b/TestON/tests/CHOTestMonkey/CHOTestMonkey.params.trellis.flex
@@ -0,0 +1,248 @@
+<PARAMS>
+    # 0. Initialize CHOTestMonkey
+    # 1. Set IPv6 configure
+    # 2. Load network configuration files
+    # 4. Copy topology libs and config files to Mininet
+    # 5. Load topology and balances all switches
+    # 6. Collect and store device and link data from ONOS
+    # 7. Collect and store host data from ONOS
+    # 10. Run all enabled checks
+    # 70. Run randomly generated events
+    # 80. Replay events from log file
+    # 100. Do nothing
+
+    <testcases>
+        0,2,5,6,7,10,70
+    </testcases>
+
+    <GIT>
+        <pull>False</pull>
+        <branch>master</branch>
+    </GIT>
+
+    <TEST>
+        <IPv6>off</IPv6>
+        <restartCluster>False</restartCluster>
+        <dataPlaneConnectivity>True</dataPlaneConnectivity>
+        <numCtrl>3</numCtrl>
+        <pauseTest>on</pauseTest>
+        <caseSleep>0</caseSleep>
+        <ipv6Regex>10[0-9]+::[0-9]+</ipv6Regex>
+        <ipv4Regex>10\.0\.[0-9]+\.[0-9]+</ipv4Regex>
+        <karafCliTimeout>7200000</karafCliTimeout>
+        <testDuration>86400</testDuration>
+        <package>on</package>
+    </TEST>
+
+    <GRAPH>
+        <nodeCluster>CHO</nodeCluster>
+        <builds>20</builds>
+    </GRAPH>
+
+    <ENV>
+        <cellName>choFlexCell</cellName>
+        <cellApps>drivers,openflow,segmentrouting,fpm,dhcprelay,netcfghostprovider,routeradvertisement,t3,hostprobingprovider</cellApps>
+    </ENV>
+
+    <EVENT>
+        <Event>
+            <status>on</status>
+            <typeIndex>0</typeIndex>
+            <typeString>NULL</typeString>
+            <CLI>null</CLI>
+            <CLIParamNum>0</CLIParamNum>
+            <rerunInterval>5</rerunInterval>
+            <maxRerunNum>3</maxRerunNum>
+        </Event>
+
+        <TestPause>
+            <status>on</status>
+            <typeIndex>1</typeIndex>
+            <typeString>TEST_PAUSE</typeString>
+            <CLI>pause-test</CLI>
+            <CLIParamNum>0</CLIParamNum>
+        </TestPause>
+
+        <TestResume>
+            <status>on</status>
+            <typeIndex>2</typeIndex>
+            <typeString>TEST_RESUME</typeString>
+            <CLI>resume-test</CLI>
+            <CLIParamNum>0</CLIParamNum>
+        </TestResume>
+
+        <TestSleep>
+            <status>on</status>
+            <typeIndex>3</typeIndex>
+            <typeString>TEST_SLEEP</typeString>
+            <CLI>sleep</CLI>
+            <CLIParamNum>1</CLIParamNum>
+        </TestSleep>
+
+        <TestDebug>
+            <status>on</status>
+            <typeIndex>4</typeIndex>
+            <typeString>TEST_DEBUG</typeString>
+            <CLI>debug-test</CLI>
+            <CLIParamNum>0</CLIParamNum>
+        </TestDebug>
+
+        <TrafficCheck>
+            <status>on</status>
+            <typeIndex>12</typeIndex>
+            <typeString>CHECK_TRAFFIC</typeString>
+            <CLI>check-traffic</CLI>
+            <CLIParamNum>0</CLIParamNum>
+            <rerunInterval>10</rerunInterval>
+            <maxRerunNum>3</maxRerunNum>
+            <pingWait>1</pingWait>
+            <pingTimeout>10</pingTimeout>
+        </TrafficCheck>
+
+        <TopoCheck>
+            <status>on</status>
+            <typeIndex>13</typeIndex>
+            <typeString>CHECK_TOPO</typeString>
+            <CLI>check-topo</CLI>
+            <CLIParamNum>0</CLIParamNum>
+            <rerunInterval>5</rerunInterval>
+            <maxRerunNum>3</maxRerunNum>
+        </TopoCheck>
+
+        <ONOSCheck>
+            <status>on</status>
+            <typeIndex>14</typeIndex>
+            <typeString>CHECK_ONOS</typeString>
+            <CLI>check-onos</CLI>
+            <CLIParamNum>0</CLIParamNum>
+            <rerunInterval>10</rerunInterval>
+            <maxRerunNum>3</maxRerunNum>
+        </ONOSCheck>
+
+        <RaftLogSizeCheck>
+            <status>on</status>
+            <typeIndex>15</typeIndex>
+            <typeString>CHECK_RAFT_LOG_SIZE</typeString>
+            <CLI>check-raft-size</CLI>
+            <CLIParamNum>0</CLIParamNum>
+        </RaftLogSizeCheck>
+
+        <DeviceDown>
+            <status>on</status>
+            <typeIndex>22</typeIndex>
+            <typeString>NETWORK_DEVICE_DOWN</typeString>
+            <CLI>device-down</CLI>
+            <CLIParamNum>1</CLIParamNum>
+        </DeviceDown>
+
+        <DeviceUp>
+            <status>on</status>
+            <typeIndex>23</typeIndex>
+            <typeString>NETWORK_DEVICE_UP</typeString>
+            <CLI>device-up</CLI>
+            <CLIParamNum>1</CLIParamNum>
+        </DeviceUp>
+
+        <PortDown>
+            <status>on</status>
+            <typeIndex>24</typeIndex>
+            <typeString>NETWORK_PORT_DOWN</typeString>
+            <CLI>port-down</CLI>
+            <CLIParamNum>2</CLIParamNum>
+        </PortDown>
+
+        <PortUp>
+            <status>on</status>
+            <typeIndex>25</typeIndex>
+            <typeString>NETWORK_PORT_UP</typeString>
+            <CLI>port-up</CLI>
+            <CLIParamNum>2</CLIParamNum>
+        </PortUp>
+
+        <ONOSDown>
+            <status>on</status>
+            <typeIndex>40</typeIndex>
+            <typeString>ONOS_ONOS_DOWN</typeString>
+            <CLI>onos-down</CLI>
+            <CLIParamNum>1</CLIParamNum>
+            <rerunInterval>5</rerunInterval>
+            <maxRerunNum>3</maxRerunNum>
+        </ONOSDown>
+
+        <ONOSUp>
+            <status>on</status>
+            <typeIndex>41</typeIndex>
+            <typeString>ONOS_ONOS_UP</typeString>
+            <CLI>onos-up</CLI>
+            <CLIParamNum>1</CLIParamNum>
+            <rerunInterval>5</rerunInterval>
+            <maxRerunNum>3</maxRerunNum>
+        </ONOSUp>
+
+        <SetCfg>
+            <status>on</status>
+            <typeIndex>42</typeIndex>
+            <typeString>ONOS_SET_CFG</typeString>
+            <CLI>set-cfg</CLI>
+            <CLIParamNum>3</CLIParamNum>
+            <rerunInterval>5</rerunInterval>
+            <maxRerunNum>3</maxRerunNum>
+        </SetCfg>
+
+        <BalanceMasters>
+            <status>on</status>
+            <typeIndex>44</typeIndex>
+            <typeString>ONOS_BALANCE_MASTERS</typeString>
+            <CLI>balance-masters</CLI>
+            <CLIParamNum>0</CLIParamNum>
+            <rerunInterval>5</rerunInterval>
+            <maxRerunNum>3</maxRerunNum>
+        </BalanceMasters>
+
+        <addAllChecks>
+            <status>on</status>
+            <typeIndex>110</typeIndex>
+            <typeString>CHECK_ALL</typeString>
+            <CLI>check-all</CLI>
+            <CLIParamNum>0</CLIParamNum>
+        </addAllChecks>
+    </EVENT>
+
+    <SCHEDULER>
+        <pendingEventsCapacity>1</pendingEventsCapacity>
+        <runningEventsCapacity>10</runningEventsCapacity>
+        <scheduleLoopSleep>0.1</scheduleLoopSleep>
+    </SCHEDULER>
+
+    <GENERATOR>
+        <listenerPort>6000</listenerPort>
+        <insertEventRetryInterval>1</insertEventRetryInterval>
+    </GENERATOR>
+
+    <TOPO>
+        <loadTopoSleep>60</loadTopoSleep>
+        <excludeNodes></excludeNodes>
+    </TOPO>
+
+    <CASE2>
+        <fileName>flex.json</fileName>
+        <hostFileName>flex.host</hostFileName>
+    </CASE2>
+
+    <CASE70>
+        <sleepSec>60</sleepSec>
+        <eventWeight>
+            <port-down>2</port-down>
+            <device-down>2</device-down>
+            <onos-down>1</onos-down>
+        </eventWeight>
+        <skipSwitches>s201,s228</skipSwitches>
+        <skipLinks></skipLinks>
+    </CASE70>
+
+    <CASE80>
+        <filePath>/home/sdn/log-for-replay</filePath>
+        <sleepTime>5</sleepTime>
+        <skipChecks>off</skipChecks>
+    </CASE80>
+</PARAMS>
diff --git a/TestON/tests/CHOTestMonkey/CHOTestMonkey.py b/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
index 000dfe3..bc6f249 100644
--- a/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
+++ b/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
@@ -45,7 +45,6 @@
         onos-uninstall
         onos-install
         onos-start-cli
-        Set IPv6 cfg parameters for Neighbor Discovery
         start event scheduler
         start event listener
         """
@@ -64,6 +63,9 @@
             main.cleanAndExit()
         main.testSetUp.envSetupDescription()
 
+        from tests.dependencies.Network import Network
+        main.Network = Network()
+
         try:
             onosPackage = main.params[ 'TEST' ][ 'package' ]
             karafTimeout = main.params[ 'TEST' ][ 'karafCliTimeout' ]
@@ -71,12 +73,19 @@
             main.caseSleep = int( main.params[ 'TEST' ][ 'caseSleep' ] )
             main.onosCell = main.params[ 'ENV' ][ 'cellName' ]
             main.apps = main.params[ 'ENV' ][ 'cellApps' ]
+            main.restartCluster = main.params[ 'TEST' ][ 'restartCluster' ] == "True"
+            main.excludeNodes = main.params[ 'TOPO' ][ 'excludeNodes' ].split( ',' ) \
+                                if main.params[ 'TOPO' ][ 'excludeNodes' ] else []
+            main.skipSwitches = main.params[ 'CASE70' ][ 'skipSwitches' ].split( ',' ) \
+                                if main.params[ 'CASE70' ][ 'skipSwitches' ] else []
+            main.skipLinks = main.params[ 'CASE70' ][ 'skipLinks' ].split( ',' ) \
+                             if main.params[ 'CASE70' ][ 'skipLinks' ] else []
             main.controllers = []
-
             main.devices = []
             main.links = []
             main.hosts = []
             main.intents = []
+            main.flowObj = False
             main.enabledEvents = {}
             for eventName in main.params[ 'EVENT' ].keys():
                 if main.params[ 'EVENT' ][ eventName ][ 'status' ] == 'on':
@@ -85,7 +94,7 @@
             main.eventScheduler = EventScheduler()
             main.eventGenerator = EventGenerator()
             main.variableLock = Lock()
-            main.mininetLock = Lock()
+            main.networkLock = Lock()
             main.ONOSbenchLock = Lock()
             main.threadID = 0
             main.eventID = 0
@@ -97,7 +106,8 @@
         main.testSetUp.evnSetupConclusion( stepResult )
 
         setupResult = main.testSetUp.ONOSSetUp( main.Cluster,
-                                                cellName=main.onosCell )
+                                                cellName=main.onosCell,
+                                                restartCluster=main.restartCluster )
         for i in range( 1, main.Cluster.numCtrls + 1 ):
             newController = Controller( i )
             newController.setCLI( main.Cluster.runningNodes[ i - 1 ].CLI )
@@ -225,71 +235,92 @@
 
     def CASE5( self, main ):
         """
-        Load Mininet topology and balances all switches
+        Load Mininet or physical network topology and balances switch mastership
         """
         import time
         import re
-        main.log.report( "Load Mininet topology and Balance all Mininet switches across controllers" )
+        main.log.report( "Load Mininet or physical network topology and Balance switch mastership" )
         main.log.report( "________________________________________________________________________" )
-        main.case( "Assign and Balance all Mininet switches across controllers" )
+        main.case( "Load Mininet or physical network topology and Balance switch mastership" )
 
-        main.step( "Copy Mininet topology files" )
-        main.topoIndex = "topo" + str( main.params[ 'TEST' ][ 'topo' ] )
-        topoFileName = main.params[ 'TOPO' ][ main.topoIndex ][ 'fileName' ]
-        topoFile = main.testDir + "/dependencies/topologies/" + topoFileName
-        copyResult = main.ONOSbench.scp( main.Mininet1, topoFile, main.Mininet1.home + "/custom", direction="to" )
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=copyResult,
-                                 onpass="Successfully copied topo files",
-                                 onfail="Failed to copy topo files" )
+        if hasattr( main, 'Mininet1' ):
+            main.step( "Copy Mininet topology files" )
+            main.topoIndex = "topo" + str( main.params[ 'TEST' ][ 'topo' ] )
+            topoFileName = main.params[ 'TOPO' ][ main.topoIndex ][ 'fileName' ]
+            topoFile = main.testDir + "/dependencies/topologies/" + topoFileName
+            copyResult = main.ONOSbench.scp( main.Mininet1, topoFile, main.Mininet1.home + "/custom", direction="to" )
+            utilities.assert_equals( expect=main.TRUE,
+                                     actual=copyResult,
+                                     onpass="Successfully copied topo files",
+                                     onfail="Failed to copy topo files" )
 
-        main.step( "Start Mininet topology" )
-        startStatus = main.Mininet1.startNet( topoFile=main.Mininet1.home + "/custom/" + topoFileName,
-                                              args=main.params[ 'TOPO' ][ 'mininetArgs' ] )
-        main.mininetSwitches = main.Mininet1.getSwitches( switchClasses=r"(OVSSwitch)" )
+        main.step( "Load topology" )
+        if hasattr( main, 'Mininet1' ):
+            topoResult = main.Mininet1.startNet( topoFile=main.Mininet1.home + "/custom/" + topoFileName,
+                                                  args=main.params[ 'TOPO' ][ 'mininetArgs' ] )
+        else:
+            topoResult = main.NetworkBench.connectToNet()
         utilities.assert_equals( expect=main.TRUE,
-                                 actual=startStatus,
-                                 onpass="Start Mininet topology test PASS",
-                                 onfail="Start Mininet topology test FAIL" )
+                                 actual=topoResult,
+                                 onpass="Successfully loaded topology",
+                                 onfail="Failed to load topology" )
+        # Exit if topology did not load properly
+        if not topoResult:
+            main.cleanAndExit()
 
         main.step( "Assign switches to controllers" )
-        switchMastership = main.TRUE
-        for switchName in main.mininetSwitches.keys():
+        if hasattr( main, 'Mininet1' ):
+            main.networkSwitches = main.Network.getSwitches( excludeNodes=main.excludeNodes )
+        else:
+            main.networkSwitches = main.Network.getSwitches( excludeNodes=main.excludeNodes,
+                                                             includeStopped=True )
+        assignResult = main.TRUE
+        for name in main.networkSwitches.keys():
             ips = main.Cluster.getIps()
-            main.Mininet1.assignSwController( sw=switchName, ip=ips )
-            response = main.Mininet1.getSwController( switchName )
-            main.log.debug( "Response is " + str( response ) )
-            if re.search( "tcp:" + main.Cluster.active( 0 ).ipAddress, response ):
-                switchMastership = switchMastership and main.TRUE
-            else:
-                switchMastership = main.FALSE
+            assignResult = assignResult and main.Network.assignSwController( sw=name, ip=ips )
         utilities.assert_equals( expect=main.TRUE,
-                                 actual=switchMastership,
-                                 onpass="Assign switches to controllers test PASS",
-                                 onfail="Assign switches to controllers test FAIL" )
+                                 actual=assignResult,
+                                 onpass="Successfully assign switches to controllers",
+                                 onfail="Failed to assign switches to controllers" )
+
         # Waiting here to make sure topology converges across all nodes
         sleep = int( main.params[ 'TOPO' ][ 'loadTopoSleep' ] )
         time.sleep( sleep )
 
         main.step( "Balance devices across controllers" )
         balanceResult = main.Cluster.active( 0 ).CLI.balanceMasters()
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=balanceResult,
+                                 onpass="Successfully balanced mastership",
+                                 onfail="Faild to balance mastership" )
         # giving some breathing time for ONOS to complete re-balance
         time.sleep( 5 )
 
-        # Get mininet hosts and links
-        main.mininetHosts = main.Mininet1.getHosts()
-        if hasattr( main, "expectedHosts" ):
-            main.mininetHosts = { key: value for key, value in main.mininetHosts.items() if key in main.expectedHosts[ "network" ].keys() }
-        main.mininetLinks = main.Mininet1.getLinks( timeout=60 )
-        main.mininetLinks = [ link for link in main.mininetLinks if
-                              link[ 'node1' ] in main.mininetHosts.keys() + main.mininetSwitches.keys() and
-                              link[ 'node2' ] in main.mininetHosts.keys() + main.mininetSwitches.keys() ]
+        # Connecting to hosts that only have data plane connectivity
+        if hasattr( main, 'NetworkBench' ):
+            main.step( "Connecting inband hosts" )
+            hostResult = main.NetworkBench.connectInbandHosts()
+            utilities.assert_equals( expect=main.TRUE,
+                                     actual=hostResult,
+                                     onpass="Successfully connected inband hosts",
+                                     onfail="Failed to connect inband hosts" )
+        else:
+            hostResult = main.TRUE
 
-        caseResult = ( startStatus and switchMastership and balanceResult )
+        # Get network hosts and links
+        main.networkHosts = main.Network.getHosts()
+        if hasattr( main, "expectedHosts" ):
+            main.networkHosts = { key: value for key, value in main.networkHosts.items() if key in main.expectedHosts[ "network" ].keys() }
+        main.networkLinks = main.Network.getLinks()
+        main.networkLinks = [ link for link in main.networkLinks if
+                              link[ 'node1' ] in main.networkHosts.keys() + main.networkSwitches.keys() and
+                              link[ 'node2' ] in main.networkHosts.keys() + main.networkSwitches.keys() ]
+
+        caseResult = ( topoResult and assignResult and balanceResult and hostResult )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=caseResult,
-                                 onpass="Starting new Att topology test PASS",
-                                 onfail="Starting new Att topology test FAIL" )
+                                 onpass="Starting new topology test PASS",
+                                 onfail="Starting new topology test FAIL" )
 
     def CASE6( self, main ):
         """
@@ -307,13 +338,16 @@
         topologyResult = main.Cluster.active( 0 ).CLI.getTopology( topologyOutput )
         ONOSDeviceNum = int( topologyResult[ 'devices' ] )
         ONOSLinkNum = int( topologyResult[ 'links' ] )
-        mininetSwitchNum = len( main.mininetSwitches )
-        mininetLinkNum = ( len( main.mininetLinks ) - len( main.mininetHosts ) ) * 2
-        if mininetSwitchNum == ONOSDeviceNum and mininetLinkNum == ONOSLinkNum:
+        networkSwitchNum = len( main.networkSwitches )
+        if hasattr( main, 'Mininet1' ):
+            networkLinkNum = ( len( main.networkLinks ) - len( main.networkHosts ) ) * 2
+        else:
+            networkLinkNum = len( main.networkLinks ) * 2
+        if networkSwitchNum == ONOSDeviceNum and networkLinkNum == ONOSLinkNum:
             main.step( "Collect and store device data" )
             stepResult = main.TRUE
             dpidToName = {}
-            for key, value in main.mininetSwitches.items():
+            for key, value in main.networkSwitches.items():
                 dpidToName[ 'of:' + str( value[ 'dpid' ] ) ] = key
             main.devicesRaw = main.Cluster.active( 0 ).CLI.devices()
             devices = json.loads( main.devicesRaw )
@@ -364,7 +398,7 @@
                                      onpass="Successfully collected and stored link data",
                                      onfail="Failed to collect and store link data" )
         else:
-            main.log.info( "Devices (expected): %s, Links (expected): %s" % ( mininetSwitchNum, mininetLinkNum ) )
+            main.log.info( "Devices (expected): %s, Links (expected): %s" % ( networkSwitchNum, networkLinkNum ) )
             main.log.info( "Devices (actual): %s, Links (actual): %s" % ( ONOSDeviceNum, ONOSLinkNum ) )
             topoResult = main.FALSE
 
@@ -404,9 +438,9 @@
                                      onfail="Failed to enable reactive forwarding" )
 
             main.step( "Discover hosts using pingall" )
-            main.Mininet1.pingall()
+            main.Network.pingall()
             if main.enableIPv6:
-                ping6Result = main.Mininet1.pingall( protocol="IPv6" )
+                ping6Result = main.Network.pingall( protocol="IPv6" )
 
             main.step( "Disable Reactive forwarding" )
             appResult = main.Cluster.active( 0 ).CLI.deactivateApp( "org.onosproject.fwd" )
@@ -422,7 +456,7 @@
         hosts = json.loads( main.hostsRaw )
         if hasattr( main, "expectedHosts" ):
             hosts = [ host for host in hosts if host[ 'id' ] in main.expectedHosts[ 'onos' ].keys() ]
-        if not len( hosts ) == len( main.mininetHosts ):
+        if not len( hosts ) == len( main.networkHosts ):
             stepResult = main.FALSE
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
@@ -435,7 +469,7 @@
         main.step( "Collect and store host data" )
         stepResult = main.TRUE
         macToName = {}
-        for key, value in main.mininetHosts.items():
+        for key, value in main.networkHosts.items():
             macToName[ value[ 'interfaces' ][ 0 ][ 'mac' ].upper() ] = key
         dpidToDevice = {}
         for device in main.devices:
@@ -472,12 +506,16 @@
                                  onfail="Failed to collect and store host data" )
 
         main.step( "Create one host component for each host and then start host cli" )
-        startCLIResult = main.TRUE
+        hostResult = main.TRUE
         for host in main.hosts:
-            main.Mininet1.createHostComponent( host.name )
+            main.Network.createHostComponent( host.name )
             hostHandle = getattr( main, host.name )
-            main.log.info( "Starting CLI on host " + str( host.name ) )
-            startCLIResult = startCLIResult and hostHandle.startHostCli()
+            if hasattr( main, "Mininet1" ):
+                main.log.info( "Starting CLI on host " + str( host.name ) )
+                hostResult = hostResult and hostHandle.startHostCli()
+            else:
+                main.log.info( "Connecting inband host " + str( host.name ) )
+                hostResult = hostResult and hostHandle.connectInband()
             host.setHandle( hostHandle )
             if main.params[ 'TEST' ][ 'dataPlaneConnectivity' ] == 'True':
                 # Hosts should already be able to ping each other
@@ -486,9 +524,9 @@
                 if host in main.ipv6Hosts:
                     host.correspondents += main.ipv6Hosts
         utilities.assert_equals( expect=main.TRUE,
-                                 actual=startCLIResult,
-                                 onpass="Host CLI started",
-                                 onfail="Failed to start host CLI" )
+                                 actual=hostResult,
+                                 onpass="Host components created",
+                                 onfail="Failed to create host components" )
 
     def CASE10( self, main ):
         """
@@ -808,43 +846,26 @@
         main.step( "Randomly generate events" )
         main.caseResult = main.TRUE
         sleepSec = int( main.params[ 'CASE70' ][ 'sleepSec' ] )
-        hostIntentNum = 0
-        pointIntentNum = 0
-        downDeviceNum = 0
-        downLinkNum = 0
-        downPortNum = 0
-        downOnosNum = 0
-        flowObj = False
-        upControllers = range( 1, int( main.params[ 'TEST' ][ 'numCtrl' ] ) + 1 )
+        allControllers = range( 1, int( main.params[ 'TEST' ][ 'numCtrl' ] ) + 1 )
         while True:
+            upControllers = [ i for i in allControllers if main.controllers[ i - 1 ].isUp() ]
+            downOnosNum = len( allControllers ) - len( upControllers )
+            hostIntentNum = len( [ intent for intent in main.intents if intent.type == 'INTENT_HOST' ] )
+            pointIntentNum = len( [ intent for intent in main.intents if intent.type == 'INTENT_POINT' ] )
+            downDeviceNum = len( [ device for device in main.devices if device.isDown() or device.isRemoved() ] )
+            downLinkNum = len( [ link for link in main.links if link.isDown() ] ) / 2
+            downPortNum = sum( [ len( device.downPorts ) for device in main.devices ] )
             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' ] ) ):
-                events.append( 'add-point-intent' )
-            for i in range( int( main.params[ 'CASE70' ][ 'linkDownWeight' ] ) ):
-                events.append( 'link-down' )
-            for i in range( int( main.params[ 'CASE70' ][ 'deviceDownWeight' ] ) ):
-                events.append( 'device-down' )
-            for i in range( int( main.params[ 'CASE70' ][ 'portDownWeight' ] ) ):
-                events.append( 'port-down' )
-            if downOnosNum == 0:
-                for i in range( int( main.params[ 'CASE70' ][ 'onosDownWeight' ] ) ):
-                    events.append( 'onos-down' )
-            for i in range( int( pow( hostIntentNum, 1.5 ) / 100 ) ):
-                events.append( 'del-host-intent' )
-            for i in range( int( pow( pointIntentNum, 1.5 ) / 100 ) ):
-                events.append( 'del-point-intent' )
-            for i in range( pow( 4, downLinkNum ) - 1 ):
-                events.append( 'link-up' )
-            for i in range( pow( 4, downDeviceNum ) - 1 ):
-                events.append( 'device-up' )
-            for i in range( pow( 4, downPortNum ) - 1 ):
-                events.append( 'port-up' )
-            for i in range( pow( 4, downOnosNum ) - 1 ):
-                events.append( 'onos-up' )
+            for event, weight in main.params[ 'CASE70' ][ 'eventWeight' ].items():
+                events += [ event ] * int( weight )
+            events += [ 'del-host-intent' ] * int( pow( hostIntentNum, 1.5 ) / 100 )
+            events += [ 'del-point-intent' ] * int( pow( pointIntentNum, 1.5 ) / 100 )
+            events += [ 'device-up' ] * int( pow( 4, downDeviceNum ) - 1 )
+            if 'link-down' in main.params[ 'CASE70' ][ 'eventWeight' ].keys():
+                events += [ 'link-up' ] * int( pow( 4, downLinkNum ) - 1 )
+            if 'port-down' in main.params[ 'CASE70' ][ 'eventWeight' ].keys():
+                events += [ 'port-up' ] * int( pow( 4, downPortNum ) - 1 )
+            events += [ 'onos-up' ] * int( pow( 4, downOnosNum ) - 1 )
             main.log.debug( events )
             event = random.sample( events, 1 )[ 0 ]
             if event == 'add-host-intent':
@@ -852,64 +873,43 @@
                 for i in range( n ):
                     cliIndex = random.sample( upControllers, 1 )[ 0 ]
                     main.eventGenerator.triggerEvent( EventType().APP_INTENT_HOST_ADD, EventScheduleMethod().RUN_BLOCK, 'random', 'random', cliIndex )
-                    hostIntentNum += 1
             elif event == 'del-host-intent':
                 n = random.randint( 5, hostIntentNum )
                 for i in range( n ):
                     cliIndex = random.sample( upControllers, 1 )[ 0 ]
                     main.eventGenerator.triggerEvent( EventType().APP_INTENT_HOST_DEL, EventScheduleMethod().RUN_BLOCK, 'random', 'random', cliIndex )
-                    hostIntentNum -= 1
             elif event == 'add-point-intent':
                 n = random.randint( 5, 50 )
                 for i in range( n ):
                     cliIndex = random.sample( upControllers, 1 )[ 0 ]
                     main.eventGenerator.triggerEvent( EventType().APP_INTENT_POINT_ADD, EventScheduleMethod().RUN_BLOCK, 'random', 'random', cliIndex, 'bidirectional' )
-                    pointIntentNum += 2
             elif event == 'del-point-intent':
                 n = random.randint( 5, pointIntentNum / 2 )
                 for i in range( n ):
                     cliIndex = random.sample( upControllers, 1 )[ 0 ]
                     main.eventGenerator.triggerEvent( EventType().APP_INTENT_POINT_DEL, EventScheduleMethod().RUN_BLOCK, 'random', 'random', cliIndex, 'bidirectional' )
-                    pointIntentNum -= 2
             elif event == 'link-down':
                 main.eventGenerator.triggerEvent( EventType().NETWORK_LINK_DOWN, EventScheduleMethod().RUN_BLOCK, 'random', 'random' )
-                downLinkNum += 1
             elif event == 'link-up':
                 main.eventGenerator.triggerEvent( EventType().NETWORK_LINK_UP, EventScheduleMethod().RUN_BLOCK, 'random', 'random' )
-                downLinkNum -= 1
             elif event == 'device-down':
                 main.eventGenerator.triggerEvent( EventType().NETWORK_DEVICE_DOWN, EventScheduleMethod().RUN_BLOCK, 'random' )
-                downDeviceNum += 1
             elif event == 'device-up':
                 main.eventGenerator.triggerEvent( EventType().NETWORK_DEVICE_UP, EventScheduleMethod().RUN_BLOCK, 'random' )
-                downDeviceNum -= 1
             elif event == 'port-down':
                 main.eventGenerator.triggerEvent( EventType().NETWORK_PORT_DOWN, EventScheduleMethod().RUN_BLOCK, 'random', 'random' )
-                downPortNum += 1
             elif event == 'port-up':
                 main.eventGenerator.triggerEvent( EventType().NETWORK_PORT_UP, EventScheduleMethod().RUN_BLOCK, 'random', 'random' )
-                downPortNum -= 1
-            elif event == 'onos-down':
+            elif event == 'onos-down' and downOnosNum == 0:
                 main.eventGenerator.triggerEvent( EventType().ONOS_ONOS_DOWN, EventScheduleMethod().RUN_BLOCK, 1 )
-                downOnosNum += 1
             elif event == 'onos-up':
                 main.eventGenerator.triggerEvent( EventType().ONOS_ONOS_UP, EventScheduleMethod().RUN_BLOCK, 1 )
-                downOnosNum -= 1
                 main.eventGenerator.triggerEvent( EventType().ONOS_BALANCE_MASTERS, EventScheduleMethod().RUN_BLOCK )
             elif event == 'toggle-flowobj':
-                if not flowObj:
-                    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
+                main.eventGenerator.triggerEvent( EventType().ONOS_SET_FLOWOBJ, EventScheduleMethod().RUN_BLOCK, 'false' if main.flowObj else 'true' )
             else:
                 pass
-            main.eventGenerator.triggerEvent( EventType().CHECK_TOPO, EventScheduleMethod().RUN_NON_BLOCK )
-            main.eventGenerator.triggerEvent( EventType().CHECK_ONOS, EventScheduleMethod().RUN_NON_BLOCK )
-            main.eventGenerator.triggerEvent( EventType().CHECK_TRAFFIC, EventScheduleMethod().RUN_NON_BLOCK )
-            main.eventGenerator.triggerEvent( EventType().CHECK_FLOW, EventScheduleMethod().RUN_NON_BLOCK )
-            main.eventGenerator.triggerEvent( EventType().CHECK_INTENT, EventScheduleMethod().RUN_NON_BLOCK )
-            main.eventGenerator.triggerEvent( EventType().CHECK_RAFT_LOG_SIZE, EventScheduleMethod().RUN_NON_BLOCK )
+            main.eventGenerator.triggerEvent( EventType().CHECK_ALL, EventScheduleMethod().RUN_NON_BLOCK )
             with main.eventScheduler.idleCondition:
                 while not main.eventScheduler.isIdle():
                     main.eventScheduler.idleCondition.wait()
diff --git a/TestON/tests/CHOTestMonkey/CHOTestMonkey.topo.flex b/TestON/tests/CHOTestMonkey/CHOTestMonkey.topo.flex
new file mode 100644
index 0000000..e3ad276
--- /dev/null
+++ b/TestON/tests/CHOTestMonkey/CHOTestMonkey.topo.flex
@@ -0,0 +1,455 @@
+<TOPOLOGY>
+    <COMPONENT>
+        <ONOScell>
+            <host>localhost</host>  # ONOS "bench" machine
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosClusterDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS>
+                <cluster_name></cluster_name>  # Used as a prefix for cluster components. Defaults to 'ONOS'
+                <diff_clihost></diff_clihost> # if it has different host other than localhost for CLI. True or empty. OC# will be used if True.
+                <karaf_username>ubuntu</karaf_username>
+                <karaf_password>ubuntu</karaf_password>
+                <web_user></web_user>
+                <web_pass></web_pass>
+                <rest_port></rest_port>
+                <prompt></prompt>  # TODO: we technically need a few of these, one per component
+                <onos_home></onos_home>  # defines where onos home is
+                <nodes> 3 </nodes>  # number of nodes in the cluster
+            </COMPONENTS>
+        </ONOScell>
+
+        <OFDPASwitchLeaf201>
+            <host>10.192.21.22</host>
+            <user>root</user>
+            <password></password>
+            <type>OFDPASwitchDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS>
+                <shortName>s201</shortName>
+                <dpid>0x201</dpid>
+                <confDir>/etc/ofdpa/</confDir>
+                <link1>
+                    <node2>OFDPASwitchLeaf226</node2>
+                    <port2>29</port2>
+                    <port1>49</port1>
+                </link1>
+                <link2>
+                    <node2>OFDPASwitchLeaf226</node2>
+                    <port2>30</port2>
+                    <port1>50</port1>
+                </link2>
+                <link3>
+                    <node2>OFDPASwitchLeaf225</node2>
+                    <port2>29</port2>
+                    <port1>51</port1>
+                </link3>
+                <link4>
+                    <node2>OFDPASwitchLeaf225</node2>
+                    <port2>30</port2>
+                    <port1>52</port1>
+                </link4>
+                <link5>
+                    <node2>OFDPASwitchLeaf202</node2>
+                    <port2>20</port2>
+                    <port1>20</port1>
+                </link5>
+            </COMPONENTS>
+        </OFDPASwitchLeaf201>
+
+        <OFDPASwitchLeaf202>
+            <host>10.192.21.23</host>
+            <user>root</user>
+            <password></password>
+            <type>OFDPASwitchDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS>
+                <shortName>s202</shortName>
+                <dpid>0x202</dpid>
+                <confDir>/etc/ofdpa/</confDir>
+                <link1>
+                    <node2>OFDPASwitchLeaf225</node2>
+                    <port2>26</port2>
+                    <port1>49</port1>
+                </link1>
+                <link2>
+                    <node2>OFDPASwitchLeaf226</node2>
+                    <port2>28</port2>
+                    <port1>50</port1>
+                </link2>
+                <link3>
+                    <node2>OFDPASwitchLeaf226</node2>
+                    <port2>27</port2>
+                    <port1>51</port1>
+                </link3>
+                <link4>
+                    <node2>OFDPASwitchLeaf201</node2>
+                    <port2>20</port2>
+                    <port1>20</port1>
+                </link4>
+            </COMPONENTS>
+        </OFDPASwitchLeaf202>
+
+        <OFDPASwitchLeaf203>
+            <host>10.192.21.24</host>
+            <user>root</user>
+            <password></password>
+            <type>OFDPASwitchDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS>
+                <shortName>s203</shortName>
+                <dpid>0x203</dpid>
+                <confDir>/etc/ofdpa/</confDir>
+                <link1>
+                    <node2>OFDPASwitchLeaf225</node2>
+                    <port2>23</port2>
+                    <port1>49</port1>
+                </link1>
+                <link2>
+                    <node2>OFDPASwitchLeaf226</node2>
+                    <port2>25</port2>
+                    <port1>50</port1>
+                </link2>
+                <link3>
+                    <node2>OFDPASwitchLeaf226</node2>
+                    <port2>26</port2>
+                    <port1>51</port1>
+                </link3>
+                <link4>
+                    <node2>OFDPASwitchLeaf225</node2>
+                    <port2>24</port2>
+                    <port1>52</port1>
+                </link4>
+                <link5>
+                    <node2>OFDPASwitchLeaf204</node2>
+                    <port2>20</port2>
+                    <port1>20</port1>
+                </link5>
+            </COMPONENTS>
+        </OFDPASwitchLeaf203>
+
+        <OFDPASwitchLeaf204>
+            <host>10.192.21.25</host>
+            <user>root</user>
+            <password></password>
+            <type>OFDPASwitchDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS>
+                <shortName>s204</shortName>
+                <dpid>0x204</dpid>
+                <confDir>/etc/ofdpa/</confDir>
+                <link1>
+                    <node2>OFDPASwitchLeaf226</node2>
+                    <port2>32</port2>
+                    <port1>50</port1>
+                </link1>
+                <link2>
+                    <node2>OFDPASwitchLeaf225</node2>
+                    <port2>31</port2>
+                    <port1>51</port1>
+                </link2>
+                <link3>
+                    <node2>OFDPASwitchLeaf225</node2>
+                    <port2>32</port2>
+                    <port1>52</port1>
+                </link3>
+                <link4>
+                    <node2>OFDPASwitchLeaf203</node2>
+                    <port2>20</port2>
+                    <port1>20</port1>
+                </link4>
+            </COMPONENTS>
+        </OFDPASwitchLeaf204>
+
+        <OFDPASwitchLeaf205>
+            <host>10.192.21.29</host>
+            <user>root</user>
+            <password></password>
+            <type>OFDPASwitchDriver</type>
+            <connect_order>6</connect_order>
+            <COMPONENTS>
+                <shortName>s205</shortName>
+                <dpid>0x205</dpid>
+                <confDir>/etc/ofdpa/</confDir>
+                <link1>
+                    <node2>OFDPASwitchLeaf227</node2>
+                    <port2>25</port2>
+                    <port1>49</port1>
+                </link1>
+                <link2>
+                    <node2>OFDPASwitchLeaf228</node2>
+                    <port2>25</port2>
+                    <port1>51</port1>
+                </link2>
+            </COMPONENTS>
+        </OFDPASwitchLeaf205>
+
+        <OFDPASwitchLeaf206>
+            <host>10.192.21.30</host>
+            <user>root</user>
+            <password></password>
+            <type>OFDPASwitchDriver</type>
+            <connect_order>7</connect_order>
+            <COMPONENTS>
+                <shortName>s206</shortName>
+                <dpid>0x206</dpid>
+                <confDir>/etc/ofdpa/</confDir>
+                <link1>
+                    <node2>OFDPASwitchLeaf227</node2>
+                    <port2>27</port2>
+                    <port1>49</port1>
+                </link1>
+                <link2>
+                    <node2>OFDPASwitchLeaf228</node2>
+                    <port2>27</port2>
+                    <port1>51</port1>
+                </link2>
+            </COMPONENTS>
+        </OFDPASwitchLeaf206>
+
+        <OFDPASwitchLeaf225>
+            <host>10.192.21.21</host>
+            <user>root</user>
+            <password></password>
+            <type>OFDPASwitchDriver</type>
+            <connect_order>8</connect_order>
+            <COMPONENTS>
+                <shortName>s225</shortName>
+                <dpid>0x225</dpid>
+                <confDir>/etc/ofdpa/</confDir>
+                <link1>
+                    <node2>OFDPASwitchLeaf227</node2>
+                    <port2>16</port2>
+                    <port1>16</port1>
+                </link1>
+                <link2>
+                    <node2>OFDPASwitchLeaf203</node2>
+                    <port2>49</port2>
+                    <port1>23</port1>
+                </link2>
+                <link3>
+                    <node2>OFDPASwitchLeaf203</node2>
+                    <port2>52</port2>
+                    <port1>24</port1>
+                </link3>
+                <link4>
+                    <node2>OFDPASwitchLeaf202</node2>
+                    <port2>49</port2>
+                    <port1>26</port1>
+                </link4>
+                <link5>
+                    <node2>OFDPASwitchLeaf201</node2>
+                    <port2>51</port2>
+                    <port1>29</port1>
+                </link5>
+                <link6>
+                    <node2>OFDPASwitchLeaf201</node2>
+                    <port2>52</port2>
+                    <port1>30</port1>
+                </link6>
+                <link7>
+                    <node2>OFDPASwitchLeaf204</node2>
+                    <port2>51</port2>
+                    <port1>31</port1>
+                </link7>
+                <link8>
+                    <node2>OFDPASwitchLeaf204</node2>
+                    <port2>52</port2>
+                    <port1>32</port1>
+                </link8>
+            </COMPONENTS>
+        </OFDPASwitchLeaf225>
+
+        <OFDPASwitchLeaf226>
+            <host>10.192.21.26</host>
+            <user>root</user>
+            <password></password>
+            <type>OFDPASwitchDriver</type>
+            <connect_order>9</connect_order>
+            <COMPONENTS>
+                <shortName>s226</shortName>
+                <dpid>0x226</dpid>
+                <confDir>/etc/ofdpa/</confDir>
+                <link1>
+                    <node2>OFDPASwitchLeaf228</node2>
+                    <port2>16</port2>
+                    <port1>16</port1>
+                </link1>
+                <link2>
+                    <node2>OFDPASwitchLeaf203</node2>
+                    <port2>50</port2>
+                    <port1>25</port1>
+                </link2>
+                <link3>
+                    <node2>OFDPASwitchLeaf203</node2>
+                    <port2>51</port2>
+                    <port1>26</port1>
+                </link3>
+                <link4>
+                    <node2>OFDPASwitchLeaf202</node2>
+                    <port2>51</port2>
+                    <port1>27</port1>
+                </link4>
+                <link5>
+                    <node2>OFDPASwitchLeaf202</node2>
+                    <port2>50</port2>
+                    <port1>28</port1>
+                </link5>
+                <link6>
+                    <node2>OFDPASwitchLeaf201</node2>
+                    <port2>49</port2>
+                    <port1>29</port1>
+                </link6>
+                <link7>
+                    <node2>OFDPASwitchLeaf201</node2>
+                    <port2>50</port2>
+                    <port1>30</port1>
+                </link7>
+                <link8>
+                    <node2>OFDPASwitchLeaf204</node2>
+                    <port2>50</port2>
+                    <port1>32</port1>
+                </link8>
+            </COMPONENTS>
+        </OFDPASwitchLeaf226>
+
+        <OFDPASwitchLeaf227>
+            <host>10.192.21.28</host>
+            <user>root</user>
+            <password></password>
+            <type>OFDPASwitchDriver</type>
+            <connect_order>10</connect_order>
+            <COMPONENTS>
+                <shortName>s227</shortName>
+                <dpid>0x227</dpid>
+                <confDir>/etc/ofdpa/</confDir>
+                <link1>
+                    <node2>OFDPASwitchLeaf225</node2>
+                    <port2>16</port2>
+                    <port1>16</port1>
+                </link1>
+                <link2>
+                    <node2>OFDPASwitchLeaf205</node2>
+                    <port2>49</port2>
+                    <port1>25</port1>
+                </link2>
+                <link3>
+                    <node2>OFDPASwitchLeaf206</node2>
+                    <port2>49</port2>
+                    <port1>27</port1>
+                </link3>
+            </COMPONENTS>
+        </OFDPASwitchLeaf227>
+
+        <OFDPASwitchLeaf228>
+            <host>10.192.21.31</host>
+            <user>root</user>
+            <password></password>
+            <type>OFDPASwitchDriver</type>
+            <connect_order>11</connect_order>
+            <COMPONENTS>
+                <shortName>s228</shortName>
+                <dpid>0x228</dpid>
+                <confDir>/etc/ofdpa/</confDir>
+                <link1>
+                    <node2>OFDPASwitchLeaf226</node2>
+                    <port2>16</port2>
+                    <port1>16</port1>
+                </link1>
+                <link2>
+                    <node2>OFDPASwitchLeaf205</node2>
+                    <port2>51</port2>
+                    <port1>25</port1>
+                </link2>
+                <link3>
+                    <node2>OFDPASwitchLeaf206</node2>
+                    <port2>51</port2>
+                    <port1>27</port1>
+                </link3>
+            </COMPONENTS>
+        </OFDPASwitchLeaf228>
+
+        <Host4v4>
+            <host>10.192.21.61</host>
+            <user>vyatta</user>
+            <password>vyatta</password>
+            <type>HostDriver</type>
+            <connect_order>13</connect_order>
+            <COMPONENTS>
+                <ip>10.0.202.7</ip>
+                <ip6></ip6>
+                <shortName>h4v4</shortName>
+                <mac>0A:5E:0D:F3:EC:D4</mac>
+                <ifaceName>bond0</ifaceName>
+                <inband>True</inband>
+                <username>ubuntu</username>
+                <password>ubuntu</password>
+            </COMPONENTS>
+        </Host4v4>
+
+        <Host5v4>
+            <host>10.192.21.61</host>
+            <user>vyatta</user>
+            <password>vyatta</password>
+            <type>HostDriver</type>
+            <connect_order>14</connect_order>
+            <COMPONENTS>
+                <ip>10.0.202.8</ip>
+                <ip6></ip6>
+                <shortName>h5v4</shortName>
+                <mac>12:1C:B7:5C:69:68</mac>
+                <ifaceName>bond0</ifaceName>
+                <inband>True</inband>
+                <username>ubuntu</username>
+                <password>ubuntu</password>
+            </COMPONENTS>
+        </Host5v4>
+
+        <Host9v4>
+            <host>10.192.21.61</host>
+            <user>vyatta</user>
+            <password>vyatta</password>
+            <type>HostDriver</type>
+            <connect_order>15</connect_order>
+            <COMPONENTS>
+                <ip>10.0.204.7</ip>
+                <ip6></ip6>
+                <shortName>h9v4</shortName>
+                <mac>EA:DA:19:1E:CB:7D</mac>
+                <ifaceName>bond0</ifaceName>
+                <inband>True</inband>
+                <username>ubuntu</username>
+                <password>ubuntu</password>
+            </COMPONENTS>
+        </Host9v4>
+
+        <Host10v4>
+            <host>10.192.21.61</host>
+            <user>vyatta</user>
+            <password>vyatta</password>
+            <type>HostDriver</type>
+            <connect_order>16</connect_order>
+            <COMPONENTS>
+                <ip>10.0.204.8</ip>
+                <ip6></ip6>
+                <shortName>h10v4</shortName>
+                <mac>A2:9B:16:E8:2A:52</mac>
+                <ifaceName>bond0</ifaceName>
+                <inband>True</inband>
+                <username>ubuntu</username>
+                <password>ubuntu</password>
+            </COMPONENTS>
+        </Host10v4>
+
+        <NetworkBench>
+            <host>localhost</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>NetworkDriver</type>
+            <connect_order>20</connect_order>
+            <COMPONENTS>
+            </COMPONENTS>
+        </NetworkBench>
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/CHOTestMonkey/dependencies/events/AppEvent.py b/TestON/tests/CHOTestMonkey/dependencies/events/AppEvent.py
index 8d347c1..35bad28 100644
--- a/TestON/tests/CHOTestMonkey/dependencies/events/AppEvent.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/events/AppEvent.py
@@ -314,7 +314,6 @@
     def startPointIntentEvent( self ):
         try:
             assert self.deviceA is not None and self.deviceB is not None
-            controller = main.controllers[ self.CLIIndex - 1 ]
             # TODO: support multiple hosts under one device
             # Check whether there already exists some intent for the device pair
             # For now we should avoid installing overlapping intents
diff --git a/TestON/tests/CHOTestMonkey/dependencies/events/CheckEvent.py b/TestON/tests/CHOTestMonkey/dependencies/events/CheckEvent.py
index 22380cf..9614696 100644
--- a/TestON/tests/CHOTestMonkey/dependencies/events/CheckEvent.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/events/CheckEvent.py
@@ -109,8 +109,8 @@
                     switchList = []
                     for device in main.devices:
                         switchList.append( device.name )
-                    with main.mininetLock:
-                        flowCompareResult = main.Mininet1.checkFlowId( switchList, flowIDList, debug=False )
+                    with main.networkLock:
+                        flowCompareResult = main.Network.checkFlowId( switchList, flowIDList, debug=False )
                     if not flowCompareResult:
                         main.log.warn( "Flow Check - flows on ONOS%s do not match that in Mininet" % ( controller.index ) )
                         checkResult = EventStates().FAIL
@@ -149,16 +149,16 @@
         # Verify host IPs
         if hasattr( main, "expectedHosts" ):
             for host in upHostList:
-                ipResult = main.Mininet1.verifyHostIp( hostList=[ host.name ],
+                ipResult = main.Network.verifyHostIp( hostList=[ host.name ],
                                                        prefix=main.expectedHosts[ 'network' ][ host.name ],
                                                        update=False )
                 if not ipResult:
                     checkResult = EventStates().FAIL
                     main.log.warn( "Topo Check - Failed to verify IP address on host %s" % ( host.name ) )
         '''
-        with main.mininetLock:
-            graphDictMininet = main.Mininet1.getGraphDict( useId=True, switchClasses=r"(OVSSwitch)",
-                                                           excludeNodes=[ 'bgp', 'cs', 'nat', 'dhcp', 'r' ] )
+        with main.networkLock:
+            graphDictMininet = main.Network.getGraphDict( useId=True,
+                                                          excludeNodes=main.excludeNodes )
         '''
         for controller in main.controllers:
             if controller.isUp():
diff --git a/TestON/tests/CHOTestMonkey/dependencies/events/NetworkEvent.py b/TestON/tests/CHOTestMonkey/dependencies/events/NetworkEvent.py
index 7a2e84f..90f74a9 100644
--- a/TestON/tests/CHOTestMonkey/dependencies/events/NetworkEvent.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/events/NetworkEvent.py
@@ -50,9 +50,9 @@
                 return EventStates().ABORT
             if args[ 0 ] == 'random' or args[ 1 ] == 'random':
                 if self.typeIndex == EventType().NETWORK_LINK_DOWN:
-                    with main.mininetLock:
-                        linkRandom = main.Mininet1.getLinkRandom( switchClasses=r"(OVSSwitch)",
-                                                                  excludeNodes=[ 'bgp', 'cs', 'nat', 'dhcp', 'r' ] )
+                    with main.networkLock:
+                        linkRandom = main.Network.getLinkRandom( excludeNodes=main.excludeNodes,
+                                                                 skipLinks=main.skipLinks )
                     if linkRandom is None:
                         main.log.warn( "No link available, aborting event" )
                         return EventStates().ABORT
@@ -110,14 +110,14 @@
                 main.log.warn( "Link Down - link has been removed" )
                 return EventStates().ABORT
         main.log.info( "Event recorded: {} {} {} {}".format( self.typeIndex, self.typeString, self.linkA.deviceA.name, self.linkA.deviceB.name ) )
-        with main.mininetLock:
+        with main.networkLock:
             """
-            result = main.Mininet1.link( END1=self.linkA.deviceA.name,
-                                         END2=self.linkA.deviceB.name,
-                                         OPTION="down" )
+            result = main.Network.link( END1=self.linkA.deviceA.name,
+                                        END2=self.linkA.deviceB.name,
+                                        OPTION="down" )
             """
-            result = main.Mininet1.delLink( self.linkA.deviceA.name,
-                                            self.linkA.deviceB.name )
+            result = main.Network.delLink( self.linkA.deviceA.name,
+                                           self.linkA.deviceB.name )
         if not result:
             main.log.warn( "%s - failed to bring down link" % ( self.typeString ) )
             return EventStates().FAIL
@@ -147,14 +147,14 @@
                 main.log.warn( "Link Up - link has been removed" )
                 return EventStates().ABORT
         main.log.info( "Event recorded: {} {} {} {}".format( self.typeIndex, self.typeString, self.linkA.deviceA.name, self.linkA.deviceB.name ) )
-        with main.mininetLock:
+        with main.networkLock:
             """
-            result = main.Mininet1.link( END1=self.linkA.deviceA.name,
-                                         END2=self.linkA.deviceB.name,
-                                         OPTION="up" )
+            result = main.Network.link( END1=self.linkA.deviceA.name,
+                                        END2=self.linkA.deviceB.name,
+                                        OPTION="up" )
             """
-            result = main.Mininet1.addLink( self.linkA.deviceA.name,
-                                            self.linkA.deviceB.name )
+            result = main.Network.addLink( self.linkA.deviceA.name,
+                                           self.linkA.deviceB.name )
         if not result:
             main.log.warn( "%s - failed to bring up link" % ( self.typeString ) )
             return EventStates().FAIL
@@ -188,14 +188,9 @@
             if args[ 0 ] == 'random':
                 import random
                 if self.typeIndex == EventType().NETWORK_DEVICE_DOWN:
-                    if main.params[ 'TOPO' ][ 'excludeSwitches' ]:
-                        excludeSwitches = main.params[ 'TOPO' ][ 'excludeSwitches' ].split( ',' )
-                    else:
-                        excludeSwitches = []
-                    with main.mininetLock:
-                        switchRandom = main.Mininet1.getSwitchRandom( switchClasses=r"(OVSSwitch)",
-                                                                      excludeNodes=[ 'bgp', 'cs', 'nat', 'dhcp', 'r' ],
-                                                                      excludeSwitches=excludeSwitches )
+                    with main.networkLock:
+                        switchRandom = main.Network.getSwitchRandom( excludeNodes=main.excludeNodes,
+                                                                     skipSwitches=main.skipSwitches )
                     if switchRandom is None:
                         main.log.warn( "No switch available, aborting event" )
                         return EventStates().ABORT
@@ -240,14 +235,14 @@
                 return EventStates().ABORT
         main.log.info( "Event recorded: {} {} {}".format( self.typeIndex, self.typeString, self.device.name ) )
         result = main.TRUE
-        with main.mininetLock:
+        with main.networkLock:
             # Disable ports toward dual-homed hosts
             for host, port in self.device.hosts.items():
                 if host.isDualHomed:
                     main.log.info( "Disable port {}/{} which connects to a dual-homed host before bringing down this device".format( self.device.dpid, port ) )
                     result = result and main.Cluster.active( 0 ).CLI.portstate( dpid=self.device.dpid, port=port, state="disable" )
-            # result = main.Mininet1.delSwitch( self.device.name )
-            result = result and main.Mininet1.switch( SW=self.device.name, OPTION="stop" )
+            # result = main.Network.delSwitch( self.device.name )
+            result = result and main.Network.switch( SW=self.device.name, OPTION="stop" )
         if not result:
             main.log.warn( "%s - failed to bring down device" % ( self.typeString ) )
             return EventStates().FAIL
@@ -282,53 +277,29 @@
                 return EventStates().ABORT
         # Re-add the device
         main.log.info( "Event recorded: {} {} {}".format( self.typeIndex, self.typeString, self.device.name ) )
-        with main.mininetLock:
-            # result = main.Mininet1.addSwitch( self.device.name, dpid=self.device.dpid[ 3: ] )
-            result = main.Mininet1.switch( SW=self.device.name, OPTION='start' )
-        if not result:
-            main.log.warn( "%s - failed to re-add device" % ( self.typeString ) )
-            return EventStates().FAIL
+        if hasattr( main, 'Mininet1' ):
+            with main.networkLock:
+                # result = main.Network.addSwitch( self.device.name, dpid=self.device.dpid[ 3: ] )
+                result = main.Network.switch( SW=self.device.name, OPTION='start' )
+            if not result:
+                main.log.warn( "%s - failed to re-add device" % ( self.typeString ) )
+                return EventStates().FAIL
+        # Re-assign mastership for the device
+        with main.networkLock:
+            result = main.Network.assignSwController( sw=self.device.name, ip=main.Cluster.getIps() )
+            if not result:
+                main.log.warn( "%s - failed to assign device to controller" % ( self.typeString ) )
+                return EventStates().FAIL
         with main.variableLock:
             self.device.bringUp()
-        '''
-        # Re-add links
-        # We add host-device links first since we did the same in mininet topology file
-        # TODO: a more rubust way is to add links according to the port info of the device
-        for host in self.device.hosts:
-            # Add host-device link
-            with main.mininetLock:
-                result = main.Mininet1.addLink( self.device.name, host.name )
-            if not result:
-                main.log.warn( "%s - failed to re-connect host %s to device" % ( self.typeString, host.name ) )
-                return EventStates().FAIL
         for link in self.device.outgoingLinks:
             neighbor = link.deviceB
             # Skip bringing up any link that connecting this device to a removed neighbor
             if neighbor.isRemoved():
                 continue
-            with main.mininetLock:
-                result = main.Mininet1.addLink( self.device.name, neighbor.name )
-            if not result:
-                main.log.warn( "%s - failed to re-add link to %s" % ( self.typeString, neighbor.name ) )
-                return EventStates().FAIL
-            with main.variableLock:
-                link.bringUp()
-                link.backwardLink.bringUp()
-                for intent in main.intents:
-                    if intent.isFailed():
-                        if intent.deviceA == self.device and intent.deviceB.isUp() or\
-                                intent.deviceB == self.device and intent.deviceA.isUp():
-                            intent.setInstalled()
-        '''
-        # Re-assign mastership for the device
-        with main.mininetLock:
-            ips = main.Cluster.getIps()
-            main.Mininet1.assignSwController( sw=self.device.name, ip=ips )
-        for link in self.device.outgoingLinks:
-            neighbor = link.deviceB
-            # Skip bringing up any link that connecting this device to a removed neighbor
-            if neighbor.isRemoved():
-                continue
+            # FIXME: remove this temporary hack for CORD-3240
+            if neighbor.name == 's225':
+                main.NetworkBench.switches[ 's225' ].setPortSpeed( index=link.portB )
             # Bring down again any link that was brought down before the device was down
             if int( link.portB ) in link.deviceB.downPorts:
                 with main.variableLock:
@@ -340,7 +311,7 @@
                     link.backwardLink.bringUp()
         # Re-discover hosts
         if self.device.hosts:
-            main.Mininet1.discoverHosts( hostList=[ host.name for host in self.device.hosts ] )
+            main.Network.discoverHosts( hostList=[ host.name for host in self.device.hosts ] )
         for host in self.device.hosts:
             with main.variableLock:
                 host.bringUp()
@@ -373,9 +344,9 @@
                 return EventStates().ABORT
             if args[ 0 ] == 'random' or args[ 1 ] == 'random':
                 if self.typeIndex == EventType().NETWORK_PORT_DOWN:
-                    with main.mininetLock:
-                        linkRandom = main.Mininet1.getLinkRandom( switchClasses=r"(OVSSwitch)",
-                                                                  excludeNodes=[ 'bgp', 'cs', 'nat', 'dhcp', 'r' ])
+                    with main.networkLock:
+                        linkRandom = main.Network.getLinkRandom( excludeNodes=main.excludeNodes,
+                                                                 skipLinks=main.skipLinks )
                     if linkRandom is None:
                         main.log.warn( "No link available, aborting event" )
                         return EventStates().ABORT
@@ -443,7 +414,7 @@
             main.log.warn( "port Down - link has been removed" )
             return EventStates().ABORT
         main.log.info( "Event recorded: {} {} {} {}".format( self.typeIndex, self.typeString, self.device.name, self.port ) )
-        with main.mininetLock:
+        with main.networkLock:
             result = main.Cluster.active( 0 ).CLI.portstate( dpid=self.device.dpid, port=self.port, state="disable" )
         if not result:
             main.log.warn( "%s - failed to bring down port" % ( self.typeString ) )
@@ -474,11 +445,14 @@
             main.log.warn( "port up - link has been removed" )
             return EventStates().ABORT
         main.log.info( "Event recorded: {} {} {} {}".format( self.typeIndex, self.typeString, self.device.name, self.port ) )
-        with main.mininetLock:
+        with main.networkLock:
             result = main.Cluster.active( 0 ).CLI.portstate( dpid=self.device.dpid, port=self.port, state="enable" )
         if not result:
             main.log.warn( "%s - failed to bring up port " % ( self.typeString ) )
             return EventStates().FAIL
+        # FIXME: remove this temporary hack for CORD-3240
+        if self.link.deviceB.name == 's225':
+            main.NetworkBench.switches[ 's225' ].setPortSpeed( index=self.link.portB )
         with main.variableLock:
             self.device.downPorts.remove( self.port )
             self.link.bringUp()
diff --git a/TestON/tests/CHOTestMonkey/dependencies/events/ONOSEvent.py b/TestON/tests/CHOTestMonkey/dependencies/events/ONOSEvent.py
index 0fa7f25..00c58c5 100644
--- a/TestON/tests/CHOTestMonkey/dependencies/events/ONOSEvent.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/events/ONOSEvent.py
@@ -202,6 +202,7 @@
         if not result:
             main.log.warn( "%s - failed to set configuration" % ( self.typeString ) )
             return EventStates().FAIL
+        main.flowObj = True if self.value == 'true' else False
         return EventStates().PASS
 
 
diff --git a/TestON/tests/CHOTestMonkey/dependencies/topologies/host/flex.host b/TestON/tests/CHOTestMonkey/dependencies/topologies/host/flex.host
new file mode 100644
index 0000000..0ccf382
--- /dev/null
+++ b/TestON/tests/CHOTestMonkey/dependencies/topologies/host/flex.host
@@ -0,0 +1,16 @@
+{
+    "onos":
+    {
+        "0A:5E:0D:F3:EC:D4/None": "10.0.202.7",
+        "12:1C:B7:5C:69:68/None": "10.0.202.8",
+        "EA:DA:19:1E:CB:7D/None": "10.0.204.7",
+        "A2:9B:16:E8:2A:52/None": "10.0.204.8"
+    },
+    "network":
+    {
+        "h4v4": "10.0.202.7",
+        "h5v4": "10.0.202.8",
+        "h9v4": "10.0.204.7",
+        "h10v4": "10.0.204.8"
+    }
+}
diff --git a/TestON/tests/CHOTestMonkey/dependencies/topologies/json/flex.json b/TestON/tests/CHOTestMonkey/dependencies/topologies/json/flex.json
new file mode 100644
index 0000000..c8f1ff2
--- /dev/null
+++ b/TestON/tests/CHOTestMonkey/dependencies/topologies/json/flex.json
@@ -0,0 +1,460 @@
+{
+    "ports" : {
+        "of:0000000000000205/1" : {
+    	    "interfaces" : [{
+    		    "ips" : [ "10.0.205.254/24" ],
+    		    "vlan-untagged": 205
+    	    }]
+    	},
+        "of:0000000000000205/2" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.205.254/24" ],
+                "vlan-untagged": 205
+            }]
+        },
+        "of:0000000000000206/1" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.206.254/24" ],
+                "vlan-untagged": 206
+            }]
+        },
+        "of:0000000000000206/2" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.206.254/24" ],
+                "vlan-untagged": 206
+            }]
+        },
+        "of:0000000000000203/1" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.204.254/24" ],
+                "vlan-untagged": 204
+            }]
+        },
+        "of:0000000000000203/2" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.204.254/24" ],
+                "vlan-untagged": 204
+            }]
+        },
+        "of:0000000000000203/3" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.204.254/24" ],
+                "vlan-untagged": 204
+            }]
+        },
+        "of:0000000000000203/4" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.204.254/24" ],
+                "vlan-untagged": 204
+            }]
+        },
+        "of:0000000000000203/5" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.204.254/24" ],
+                "vlan-untagged": 204
+            }]
+        },
+        "of:0000000000000203/6" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.204.254/24" ],
+                "vlan-untagged": 204
+            }]
+        },
+        "of:0000000000000203/7" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.204.254/24" ],
+                "vlan-untagged": 204
+            }]
+        },
+        "of:0000000000000203/8" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.204.254/24" ],
+                "vlan-untagged": 204
+            }]
+        },
+        "of:0000000000000203/20" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.204.254/24" ],
+                "vlan-tagged": [204]
+            }]
+        },
+        "of:0000000000000204/1" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.204.254/24" ],
+                "vlan-untagged": 204
+            }]
+        },
+        "of:0000000000000204/2" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.204.254/24" ],
+                "vlan-untagged": 204
+            }]
+        },
+        "of:0000000000000204/3" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.204.254/24" ],
+                "vlan-untagged": 204
+            }]
+        },
+        "of:0000000000000204/4" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.204.254/24" ],
+                "vlan-untagged": 204
+            }]
+        },
+        "of:0000000000000204/5" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.204.254/24" ],
+                "vlan-untagged": 204
+            }]
+        },
+        "of:0000000000000204/6" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.204.254/24" ],
+                "vlan-untagged": 204
+            }]
+        },
+        "of:0000000000000204/7" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.204.254/24" ],
+                "vlan-untagged": 204
+            }]
+        },
+        "of:0000000000000204/8" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.204.254/24" ],
+                "vlan-untagged": 204
+            }]
+        },
+        "of:0000000000000204/20" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.204.254/24" ],
+                "vlan-tagged": [204]
+            }]
+        },
+        "of:0000000000000201/1" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.202.254/24" ],
+                "vlan-untagged": 202
+            }]
+        },
+        "of:0000000000000201/2" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.202.254/24" ],
+                "vlan-untagged": 202
+            }]
+        },
+        "of:0000000000000201/3" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.202.254/24" ],
+                "vlan-untagged": 202
+            }]
+        },
+        "of:0000000000000201/4" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.202.254/24" ],
+                "vlan-untagged": 202
+            }]
+        },
+        "of:0000000000000201/5" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.202.254/24" ],
+                "vlan-untagged": 202
+            }]
+        },
+        "of:0000000000000201/6" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.202.254/24" ],
+                "vlan-untagged": 202
+            }]
+        },
+        "of:0000000000000201/7" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.202.254/24" ],
+                "vlan-untagged": 202
+            }]
+        },
+        "of:0000000000000201/8" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.202.254/24" ],
+                "vlan-untagged": 202
+            }]
+        },
+        "of:0000000000000201/17" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.101.254/24" ],
+                "vlan-untagged": 101
+            }]
+        },
+        "of:0000000000000201/18" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.101.254/24" ],
+                "vlan-untagged": 101
+            }]
+        },
+        "of:0000000000000201/20" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.202.254/24" ],
+                "vlan-tagged": [202]
+            }]
+        },
+        "of:0000000000000202/1" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.202.254/24" ],
+                "vlan-untagged": 202
+            }]
+        },
+        "of:0000000000000202/2" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.202.254/24" ],
+                "vlan-untagged": 202
+            }]
+        },
+        "of:0000000000000202/3" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.202.254/24" ],
+                "vlan-untagged": 202
+            }]
+        },
+        "of:0000000000000202/4" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.202.254/24" ],
+                "vlan-untagged": 202
+            }]
+        },
+        "of:0000000000000202/5" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.202.254/24" ],
+                "vlan-untagged": 202
+            }]
+        },
+        "of:0000000000000202/6" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.202.254/24" ],
+                "vlan-untagged": 202
+            }]
+        },
+        "of:0000000000000202/7" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.202.254/24" ],
+                "vlan-untagged": 202
+            }]
+        },
+        "of:0000000000000202/8" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.202.254/24" ],
+                "vlan-untagged": 202
+            }]
+        },
+        "of:0000000000000202/17" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.102.254/24" ],
+                "vlan-untagged": 102
+            }]
+        },
+        "of:0000000000000202/18" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.102.254/24" ],
+                "vlan-untagged": 102
+            }]
+        },
+        "of:0000000000000202/20" : {
+            "interfaces" : [{
+                "ips" : [ "10.0.202.254/24" ],
+                "vlan-tagged": [202]
+            }]
+        }
+    },
+    "devices" : {
+        "of:0000000000000201" : {
+	        "basic" : {
+	    	    "name": "201-qmx",
+	    	    "latitude" : 34,
+	    	    "longitude": -95
+	        },
+            "segmentrouting" : {
+                "ipv4NodeSid" : 201,
+                "ipv4Loopback" : "192.168.0.201",
+                "ipv6NodeSid" : 201,
+                "ipv6Loopback" : "2000::c0a8:0201",
+                "routerMac" : "00:00:02:01:02:02",
+	    	    "pairDeviceId" : "of:0000000000000202",
+	    	    "pairLocalPort" : 20,
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+                }
+            },
+	    "of:0000000000000202" : {
+	        "basic" : {
+	    	    "name": "202-qmx",
+	    	    "latitude" : 34,
+	    	    "longitude": -90
+	        },
+	        "segmentrouting" : {
+                "ipv4NodeSid" : 202,
+                "ipv4Loopback" : "192.168.0.202",
+                "ipv6NodeSid" : 202,
+                "ipv6Loopback" : "2000::c0a8:0202",
+                "routerMac" : "00:00:02:01:02:02",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000201",
+                "pairLocalPort" : 20,
+	    	    "adjacencySids" : []
+            }
+        },
+        "of:0000000000000203" : {
+	        "basic" : {
+	            "name": "203-qmx",
+	            "latitude" : 34,
+	            "longitude": -108
+	        },
+            "segmentrouting" : {
+                "name" : "Leaf2-R1",
+                "ipv4NodeSid" : 203,
+                "ipv4Loopback" : "192.168.0.203",
+                "ipv6NodeSid" : 203,
+                "ipv6Loopback" : "2000::c0a8:0203",
+                "routerMac" : "00:00:02:03:02:04",
+                "isEdgeRouter" : true,
+                "pairDeviceId" : "of:0000000000000204",
+                "pairLocalPort" : 20,
+                "adjacencySids" : []
+            }
+        },
+        "of:0000000000000204" : {
+	        "basic" : {
+	            "name": "204-qmx",
+	            "latitude" : 34,
+	            "longitude": -103
+	        },
+            "segmentrouting" : {
+                "name" : "Leaf1-R1",
+                "ipv4NodeSid" : 204,
+                "ipv4Loopback" : "192.168.0.204",
+                "ipv6NodeSid" : 204,
+                "ipv6Loopback" : "2000::c0a8:0204",
+                "routerMac" : "00:00:02:03:02:04",
+                "pairDeviceId" : "of:0000000000000203",
+                "pairLocalPort" : 20,
+                "isEdgeRouter" : true,
+                "adjacencySids" : []
+            }
+        },
+   	    "of:0000000000000225" : {
+	        "basic" : {
+	    	    "name": "225-t2",
+	    	    "latitude" : 42,
+	    	    "longitude": -100
+	        },
+        	"segmentrouting" : {
+                "name" : "SpineToma-0",
+                "ipv4NodeSid" : 225,
+                "ipv4Loopback" : "192.168.0.225",
+	    	    "ipv6NodeSid" : 225,
+                "ipv6Loopback" : "2000::c0a8:0225",
+                "routerMac" : "00:00:02:25:00:01",
+                "isEdgeRouter" : false,
+	    	    "adjacencySids" : []
+            }
+        },
+        "of:0000000000000226" : {
+	        "basic" : {
+	    	    "name": "226-tmhk",
+	    	    "latitude" : 42,
+	    	    "longitude": -95
+	        },
+            "segmentrouting" : {
+                "name" : "Spine1",
+                "ipv4NodeSid" : 226,
+                "ipv4Loopback" : "192.168.0.226",
+                "ipv6NodeSid" : 226,
+                "ipv6Loopback" : "2000::c0a8:0226",
+                "routerMac" : "00:00:02:26:00:01",
+                "isEdgeRouter" : false,
+                "adjacencySids" : []
+            }
+        },
+        "of:0000000000000205":{
+            "basic":{
+                "name":"205-qmx",
+                "latitude":34,
+                "longitude":-120
+            },
+            "segmentrouting":{
+                "name":"Leaf1",
+                "ipv4NodeSid":205,
+                "ipv4Loopback":"192.168.0.205",
+                "ipv6NodeSid":205,
+                "ipv6Loopback":"2000::c0a8:0205",
+                "routerMac":"00:00:02:05:06:01",
+                "isEdgeRouter":true,
+                "adjacencySids":[
+                ]
+            }
+        },
+        "of:0000000000000206":{
+            "basic":{
+                "name":"206-qmx",
+                "latitude":34,
+                "longitude":-115
+            },
+            "segmentrouting":{
+                "name":"Leaf2",
+                "ipv4NodeSid":206,
+                "ipv4Loopback":"192.168.0.206",
+                "ipv6NodeSid":206,
+                "ipv6Loopback":"2000::c0a8:0206",
+                "routerMac":"00:00:02:06:06:01",
+                "isEdgeRouter":true,
+                "adjacencySids":[
+                ]
+            }
+        },
+        "of:0000000000000227":{
+            "basic":{
+                "name":"227-tmhk",
+                "latitude":38,
+                "longitude":-119
+            },
+            "segmentrouting":{
+                "name":"Spine1",
+                "ipv4NodeSid":227,
+                "ipv4Loopback":"192.168.0.227",
+                "ipv6NodeSid":227,
+                "ipv6Loopback":"2000::c0a8:0227",
+                "routerMac":"00:00:02:27:00:01",
+                "isEdgeRouter":false,
+                "adjacencySids":[
+                ]
+            }
+        },
+        "of:0000000000000228":{
+            "basic":{
+                "name":"228-t2",
+                "latitude":38,
+                "longitude":-116
+            },
+            "segmentrouting":{
+                "name":"Spine2",
+                "ipv4NodeSid":228,
+                "ipv4Loopback":"192.168.0.228",
+                "ipv6NodeSid":228,
+                "ipv6Loopback":"2000::c0a8:0228",
+                "routerMac":"00:00:02:28:00:01",
+                "isEdgeRouter":false,
+                "adjacencySids":[
+                ]
+            }
+        }
+    },
+    "apps" : {
+            "org.onosproject.dhcprelay" : {
+    	    "default" : [
+    		    {
+                    "dhcpServerConnectPoint": "of:0000000000000204/8",
+                    "serverIps": ["10.0.204.8"]
+    		    }
+    	    ]
+        }
+    }
+}
diff --git a/TestON/tests/dependencies/ONOSSetup.py b/TestON/tests/dependencies/ONOSSetup.py
index 6368e7c..8371e0b 100644
--- a/TestON/tests/dependencies/ONOSSetup.py
+++ b/TestON/tests/dependencies/ONOSSetup.py
@@ -479,7 +479,7 @@
             else:
                 functions( *args ) if args is not None else functions()
 
-    def ONOSSetUp( self, cluster, hasMultiNodeRounds=False, startOnos=True, newCell=True,
+    def ONOSSetUp( self, cluster, hasMultiNodeRounds=False, startOnosCli=True, newCell=True,
                    cellName="temp", cellApps="drivers", appPrefix="org.onosproject.",
                    mininetIp="", extraApply=None, applyArgs=None,
                    extraClean=None, cleanArgs=None, skipPack=False, installMax=False,
@@ -505,7 +505,7 @@
             * cluster - the cluster driver that will be used.
         Optional Arguments:
             * hasMultiNodeRounds - True if the test is testing different set of nodes
-            * startOnos - True if wish to start onos.
+            * startOnosCli - True if wish to start onos CLI.
             * newCell - True for making a new cell and False for not making it.
             * cellName - Name of the cell that will be used.
             * cellApps - The cell apps string. Will be overwritten by main.apps if it exists
@@ -591,7 +591,7 @@
         onosServiceResult = self.checkOnosService( cluster )
 
         onosCliResult = main.TRUE
-        if startOnos:
+        if startOnosCli:
             onosCliResult = self.startOnosClis( cluster )
 
         onosNodesResult = self.checkOnosNodes( cluster )