[ONOS-6593]Review and Refactor ONOS startup procedures in TestON

Change-Id: I509a8ee7a26c198957bebf59da5c85a0edb8b995
diff --git a/TestON/tests/FUNC/FUNCflow/FUNCflow.py b/TestON/tests/FUNC/FUNCflow/FUNCflow.py
index 0bb43aa..ca590e6 100644
--- a/TestON/tests/FUNC/FUNCflow/FUNCflow.py
+++ b/TestON/tests/FUNC/FUNCflow/FUNCflow.py
@@ -6,82 +6,68 @@
     def CASE1( self, main ):
         import os
         import imp
-
+        try:
+            from tests.dependencies.ONOSSetup import ONOSSetup
+        except ImportError:
+            main.log.error( "SetUp not found exiting the test" )
+            main.exit()
+        try:
+            main.testSetUp
+        except ( NameError, AttributeError ):
+            main.testSetUp = ONOSSetup()
         """
         - Construct tests variables
         - GIT ( optional )
             - Checkout ONOS master branch
             - Pull latest ONOS code
-        - Building ONOS ( optional )
-            - Install ONOS package
-            - Build ONOS package
         """
-        main.case( "Constructing test variables and building ONOS package" )
-        main.step( "Constructing test variables" )
 
-        # Test variables
-        main.testOnDirectory = os.path.dirname( os.getcwd() )
-        main.cellName = main.params[ 'ENV' ][ 'cellName' ]
-        main.apps = main.params[ 'ENV' ][ 'cellApps' ]
-        gitBranch = main.params[ 'GIT' ][ 'branch' ]
-        gitPull = main.params[ 'GIT' ][ 'pull' ]
-        main.ONOSport = main.params[ 'CTRL' ][ 'port' ]
-        main.dependencyPath = main.testOnDirectory + \
-                              main.params[ 'DEPENDENCY' ][ 'path' ]
-        wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
-        wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
-        main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
-        main.maxNodes = int( main.params[ 'SCALE' ][ 'max' ] )
-        main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
-        main.startMNSleep = int( main.params[ 'SLEEP' ][ 'startMN' ] )
-        main.addFlowSleep = int( main.params[ 'SLEEP' ][ 'addFlow' ] )
-        main.delFlowSleep = int( main.params[ 'SLEEP' ][ 'delFlow' ] )
-        main.debug = main.params[ 'DEBUG' ]
-        main.swDPID = main.params[ 'TEST' ][ 'swDPID' ]
-        main.cellData = {}  # for creating cell file
-        main.CLIs = []
-        main.ONOSip = []
+        main.testSetUp.envSetupDescription()
+        stepResult = main.FALSE
+        try:
+            # Test variables
+            main.cellName = main.params[ 'ENV' ][ 'cellName' ]
+            main.apps = main.params[ 'ENV' ][ 'cellApps' ]
+            main.ONOSport = main.params[ 'CTRL' ][ 'port' ]
+            main.dependencyPath = main.testOnDirectory + \
+                                  main.params[ 'DEPENDENCY' ][ 'path' ]
+            wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
+            wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
+            main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
+            main.maxNodes = int( main.params[ 'SCALE' ][ 'max' ] )
+            main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
+            main.startMNSleep = int( main.params[ 'SLEEP' ][ 'startMN' ] )
+            main.addFlowSleep = int( main.params[ 'SLEEP' ][ 'addFlow' ] )
+            main.delFlowSleep = int( main.params[ 'SLEEP' ][ 'delFlow' ] )
+            main.debug = main.params[ 'DEBUG' ]
+            main.swDPID = main.params[ 'TEST' ][ 'swDPID' ]
 
-        main.debug = True if "on" in main.debug else False
+            main.debug = True if "on" in main.debug else False
 
-        main.ONOSip = main.ONOSbench.getOnosIps()
+            # -- INIT SECTION, ONLY RUNS ONCE -- #
 
-        # Assigning ONOS cli handles to a list
-        for i in range( 1, main.maxNodes + 1 ):
-            main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+            try:
+                from tests.FUNC.FUNCflow.dependencies.checkingFlow import CheckingFlow
+                main.checkingFlow = CheckingFlow()
+            except ImportError as e:
+                print e
+                main.log.error("CheckingFlow not found exiting the test")
+                main.exit()
+            copyResult = main.ONOSbench.scp( main.Mininet1,
+                                             main.dependencyPath + main.topology,
+                                             main.Mininet1.home + '/custom/',
+                                             direction="to" )
 
-        # -- INIT SECTION, ONLY RUNS ONCE -- #
-        main.startUp = imp.load_source( wrapperFile1,
-                                        main.dependencyPath +
-                                        wrapperFile1 +
-                                        ".py" )
+            utilities.assert_equals( expect=main.TRUE,
+                                     actual=copyResult,
+                                     onpass="Successfully copy " + "test variables ",
+                                     onfail="Failed to copy test variables" )
 
-        main.topo = imp.load_source( wrapperFile2,
-                                     main.dependencyPath +
-                                     wrapperFile2 +
-                                     ".py" )
+            stepResult = main.testSetUp.envSetup()
 
-        copyResult = main.ONOSbench.scp( main.Mininet1,
-                                         main.dependencyPath + main.topology,
-                                         main.Mininet1.home + '/custom/',
-                                         direction="to" )
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=copyResult,
-                                 onpass="Successfully copy " + "test variables ",
-                                 onfail="Failed to copy test variables" )
-
-        if main.CLIs:
-            stepResult = main.TRUE
-        else:
-            main.log.error( "Did not properly created list of ONOS CLI handle" )
-            stepResult = main.FALSE
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully construct " + "test variables ",
-                                 onfail="Failed to construct test variables" )
-
+        except Exception as e:
+            main.testSetUp.envSetupException( e )
+        main.testSetUp.evnSetupConclusion( stepResult )
 
 
     def CASE2( self, main ):
@@ -90,127 +76,32 @@
             - Create cell file
             - Set cell file
             - Verify cell file
+        - Building ONOS
+            - Install ONOS package
+            - Build ONOS package
         - Kill ONOS process
         - Uninstall ONOS cluster
         - Verify ONOS start up
         - Install ONOS cluster
         - Connect to cli
         """
-        import time
-
-        main.numCtrls = int( main.maxNodes )
-
-        main.case( "Starting up " + str( main.numCtrls ) +
-                   " node(s) ONOS cluster" )
-
-        #kill off all onos processes
-        main.log.info( "Safety check, killing all ONOS processes" +
-                       " before initiating environment setup" )
-
-        for i in range( main.maxNodes ):
-            main.ONOSbench.onosDie( main.ONOSip[ i ] )
-
-        main.log.info( "NODE COUNT = " + str( main.numCtrls ) )
-
-        tempOnosIp = []
-        for i in range( main.numCtrls ):
-            tempOnosIp.append( main.ONOSip[ i ] )
-
-        main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
-                                       "temp",
-                                       main.Mininet1.ip_address,
-                                       main.apps,
-                                       tempOnosIp, main.ONOScli1.karafUser )
-
-        main.step( "Apply cell to environment" )
-        cellResult = main.ONOSbench.setCell( "temp" )
-        verifyResult = main.ONOSbench.verifyCell()
-        stepResult = cellResult and verifyResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully applied cell to " + "environment",
-                                 onfail="Failed to apply cell to environment " )
-
-        main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.buckBuild()
-        stepResult = packageResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully created ONOS package",
-                                 onfail="Failed to create ONOS package" )
-
-        time.sleep( main.startUpSleep )
-        main.step( "Uninstalling ONOS package" )
-        onosUninstallResult = main.TRUE
-        for ip in main.ONOSip:
-            onosUninstallResult = onosUninstallResult and \
-                    main.ONOSbench.onosUninstall( nodeIp=ip )
-        stepResult = onosUninstallResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully uninstalled ONOS package",
-                                 onfail="Failed to uninstall ONOS package" )
-        time.sleep( main.startUpSleep )
-        main.step( "Installing ONOS package" )
-        onosInstallResult = main.TRUE
-        for i in range( main.numCtrls ):
-            onosInstallResult = onosInstallResult and \
-                    main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
-        stepResult = onosInstallResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully installed ONOS package",
-                                 onfail="Failed to install ONOS package" )
-
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[ i ] )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
-        time.sleep( main.startUpSleep )
-        main.step( "Starting ONOS service" )
-        stopResult = main.TRUE
-        startResult = main.TRUE
-        onosIsUp = main.TRUE
-
-        for i in range( main.numCtrls ):
-            onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
-        if onosIsUp == main.TRUE:
-            main.log.report( "ONOS instance is up and ready" )
-        else:
-            main.log.report( "ONOS instance may not be up, stop and " +
-                             "start ONOS again " )
-            for i in range( main.numCtrls ):
-                stopResult = stopResult and \
-                        main.ONOSbench.onosStop( main.ONOSip[ i ] )
-            for i in range( main.numCtrls ):
-                startResult = startResult and \
-                        main.ONOSbench.onosStart( main.ONOSip[ i ] )
-        stepResult = onosIsUp and stopResult and startResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="ONOS service is ready",
-                                 onfail="ONOS service did not start properly" )
-
-        main.step( "Start ONOS cli" )
-        cliResult = main.TRUE
-        for i in range( main.numCtrls ):
-            cliResult = cliResult and \
-                        main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
-        stepResult = cliResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully start ONOS cli",
-                                 onfail="Failed to start ONOS cli" )
+        main.testSetUp.ONOSSetUp( main.Mininet1 )
 
     def CASE10( self, main ):
         """
             Start Mininet
         """
         import json
+        import time
+        try:
+            from tests.dependencies.topology import Topology
+        except ImportError:
+            main.log.error( "Topology not found exiting the test" )
+            main.exit()
+        try:
+            main.topoRelated
+        except ( NameError, AttributeError ):
+            main.topoRelated = Topology()
 
         main.case( "Setup mininet and compare ONOS topology view to Mininet topology" )
         main.caseExplanation = "Start mininet with custom topology and compare topology " +\
@@ -235,60 +126,7 @@
 
         time.sleep( main.startMNSleep )
 
-        main.step( "Comparing MN topology to ONOS topology" )
-        main.log.info( "Gathering topology information" )
-        devices = main.topo.getAllDevices( main )
-        hosts = main.topo.getAllHosts( main )
-        ports = main.topo.getAllPorts( main )
-        links = main.topo.getAllLinks( main )
-
-        mnSwitches = main.Mininet1.getSwitches()
-        mnLinks = main.Mininet1.getLinks()
-        mnHosts = main.Mininet1.getHosts()
-
-        for controller in range( main.numCtrls ):
-            controllerStr = str( controller + 1 )
-            if devices[ controller ] and ports[ controller ] and\
-                    "Error" not in devices[ controller ] and\
-                    "Error" not in ports[ controller ]:
-
-                currentDevicesResult = main.Mininet1.compareSwitches(
-                        mnSwitches,
-                        json.loads( devices[ controller ] ),
-                        json.loads( ports[ controller ] ) )
-            else:
-                currentDevicesResult = main.FALSE
-            utilities.assert_equals( expect=main.TRUE,
-                                     actual=currentDevicesResult,
-                                     onpass="ONOS" + controllerStr +
-                                            " Switches view is correct",
-                                     onfail="ONOS" + controllerStr +
-                                            " Switches view is incorrect" )
-            if links[ controller ] and "Error" not in links[ controller ]:
-                currentLinksResult = main.Mininet1.compareLinks(
-                        mnSwitches, mnLinks,
-                        json.loads( links[ controller ] ) )
-            else:
-                currentLinksResult = main.FALSE
-            utilities.assert_equals( expect=main.TRUE,
-                                     actual=currentLinksResult,
-                                     onpass="ONOS" + controllerStr +
-                                            " links view is correct",
-                                     onfail="ONOS" + controllerStr +
-                                            " links view is incorrect" )
-
-            if hosts[ controller ] or "Error" not in hosts[ controller ]:
-                currentHostsResult = main.Mininet1.compareHosts(
-                        mnHosts,
-                        json.loads( hosts[ controller ] ) )
-            else:
-                currentHostsResult = main.FALSE
-            utilities.assert_equals( expect=main.TRUE,
-                                     actual=currentHostsResult,
-                                     onpass="ONOS" + controllerStr +
-                                            " hosts exist in Mininet",
-                                     onfail="ONOS" + controllerStr +
-                                            " hosts don't match Mininet" )
+        main.topoRelated.compareTopos( main.Mininet1 )
 
     def CASE66( self, main ):
         """
@@ -532,46 +370,7 @@
         # Giving ONOS time to add the flow
         time.sleep( main.addFlowSleep )
 
-        main.step( "Check flow is in the ADDED state" )
-
-        main.log.info( "Get the flows from ONOS" )
-        try:
-            flows = json.loads( main.ONOSrest.flows() )
-
-            stepResult = main.TRUE
-            for f in flows:
-                if "rest" in f.get( "appId" ):
-                    if "ADDED" not in f.get( "state" ):
-                        stepResult = main.FALSE
-                        main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
-        except TypeError:
-            main.log.error( "No Flows found by the REST API" )
-            stepResult = main.FALSE
-        except ValueError:
-            main.log.error( "Problem getting Flows state from REST API.  Exiting test" )
-            main.cleanup()
-            main.exit()
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="All flows are in the ADDED state",
-                                 onfail="All flows are NOT in the ADDED state" )
-
-        main.step( "Check flows are in Mininet's flow table" )
-
-        # get the flow IDs that were added through rest
-        main.log.info( "Getting the flow IDs from ONOS" )
-        flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
-        # convert the flowIDs to ints then hex and finally back to strings
-        flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
-        main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
-
-        stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="All flows are in mininet",
-                                 onfail="All flows are NOT in mininet" )
+        main.checkingFlow.checkFlow()
 
         main.step( "Send a packet to verify the flow is correct" )
 
@@ -654,46 +453,7 @@
         # Giving ONOS time to add the flow
         time.sleep( main.addFlowSleep )
 
-        main.step( "Check flow is in the ADDED state" )
-
-        main.log.info( "Get the flows from ONOS" )
-        try:
-            flows = json.loads( main.ONOSrest.flows() )
-
-            stepResult = main.TRUE
-            for f in flows:
-                if "rest" in f.get( "appId" ):
-                    if "ADDED" not in f.get( "state" ):
-                        stepResult = main.FALSE
-                        main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
-        except TypeError:
-            main.log.error( "No Flows found by the REST API" )
-            stepResult = main.FALSE
-        except ValueError:
-            main.log.error( "Problem getting Flows state from REST API.  Exiting test" )
-            main.cleanup()
-            main.exit()
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="All flows are in the ADDED state",
-                                 onfail="All flows are NOT in the ADDED state" )
-
-        main.step( "Check flows are in Mininet's flow table" )
-
-        # get the flow IDs that were added through rest
-        main.log.info( "Getting the flow IDs from ONOS" )
-        flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
-        # convert the flowIDs to ints then hex and finally back to strings
-        flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
-        main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
-
-        stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="All flows are in mininet",
-                                 onfail="All flows are NOT in mininet" )
+        main.checkingFlow.checkFlow()
 
         main.step( "Send a packet to verify the flow is correct" )
 
@@ -1015,46 +775,7 @@
         # Giving ONOS time to add the flow
         time.sleep( main.addFlowSleep )
 
-        main.step( "Check flow is in the ADDED state" )
-
-        main.log.info( "Get the flows from ONOS" )
-        try:
-            flows = json.loads( main.ONOSrest.flows() )
-
-            stepResult = main.TRUE
-            for f in flows:
-                if "rest" in f.get( "appId" ):
-                    if "ADDED" not in f.get( "state" ):
-                        stepResult = main.FALSE
-                        main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
-        except TypeError:
-            main.log.error( "No Flows found by the REST API" )
-            stepResult = main.FALSE
-        except ValueError:
-            main.log.error( "Problem getting Flows state from REST API.  Exiting test" )
-            main.cleanup()
-            main.exit()
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="All flows are in the ADDED state",
-                                 onfail="All flows are NOT in the ADDED state" )
-
-        main.step( "Check flows are in Mininet's flow table" )
-
-        # get the flow IDs that were added through rest
-        main.log.info( "Getting the flow IDs from ONOS" )
-        flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
-        # convert the flowIDs to ints then hex and finally back to strings
-        flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
-        main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
-
-        stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="All flows are in mininet",
-                                 onfail="All flows are NOT in mininet" )
+        main.checkingFlow.checkFlow()
 
         main.step( "Send a packet to verify the flow is correct" )
 
@@ -1139,46 +860,7 @@
         # Giving ONOS time to add the flow
         time.sleep( main.addFlowSleep )
 
-        main.step( "Check flow is in the ADDED state" )
-
-        main.log.info( "Get the flows from ONOS" )
-        try:
-            flows = json.loads( main.ONOSrest.flows() )
-
-            stepResult = main.TRUE
-            for f in flows:
-                if "rest" in f.get( "appId" ):
-                    if "ADDED" not in f.get( "state" ):
-                        stepResult = main.FALSE
-                        main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
-        except TypeError:
-            main.log.error( "No Flows found by the REST API" )
-            stepResult = main.FALSE
-        except ValueError:
-            main.log.error( "Problem getting Flows state from REST API.  Exiting test" )
-            main.cleanup()
-            main.exit()
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="All flows are in the ADDED state",
-                                 onfail="All flows are NOT in the ADDED state" )
-
-        main.step( "Check flows are in Mininet's flow table" )
-
-        # get the flow IDs that were added through rest
-        main.log.info( "Getting the flow IDs from ONOS" )
-        flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
-        # convert the flowIDs to ints then hex and finally back to strings
-        flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
-        main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
-
-        stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="All flows are in mininet",
-                                 onfail="All flows are NOT in mininet" )
+        main.checkingFlow.checkFlow()
 
         main.step( "Send a packet to verify the flow is correct" )
 
@@ -1260,46 +942,7 @@
         # Giving ONOS time to add the flow
         time.sleep( main.addFlowSleep )
 
-        main.step( "Check flow is in the ADDED state" )
-
-        main.log.info( "Get the flows from ONOS" )
-        try:
-            flows = json.loads( main.ONOSrest.flows() )
-
-            stepResult = main.TRUE
-            for f in flows:
-                if "rest" in f.get( "appId" ):
-                    if "ADDED" not in f.get( "state" ):
-                        stepResult = main.FALSE
-                        main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
-        except TypeError:
-            main.log.error( "No Flows found by the REST API" )
-            stepResult = main.FALSE
-        except ValueError:
-            main.log.error( "Problem getting Flows state from REST API.  Exiting test" )
-            main.cleanup()
-            main.exit()
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="All flows are in the ADDED state",
-                                 onfail="All flows are NOT in the ADDED state" )
-
-        main.step( "Check flows are in Mininet's flow table" )
-
-        # get the flow IDs that were added through rest
-        main.log.info( "Getting the flow IDs from ONOS" )
-        flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
-        # convert the flowIDs to ints then hex and finally back to strings
-        flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
-        main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
-
-        stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="All flows are in mininet",
-                                 onfail="All flows are NOT in mininet" )
+        main.checkingFlow.checkFlow()
 
         main.step( "Send a packet to verify the flow is correct" )
 
@@ -1381,46 +1024,7 @@
         # Giving ONOS time to add the flow
         time.sleep( main.addFlowSleep )
 
-        main.step( "Check flow is in the ADDED state" )
-
-        main.log.info( "Get the flows from ONOS" )
-        try:
-            flows = json.loads( main.ONOSrest.flows() )
-
-            stepResult = main.TRUE
-            for f in flows:
-                if "rest" in f.get( "appId" ):
-                    if "ADDED" not in f.get( "state" ):
-                        stepResult = main.FALSE
-                        main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
-        except TypeError:
-            main.log.error( "No Flows found by the REST API" )
-            stepResult = main.FALSE
-        except ValueError:
-            main.log.error( "Problem getting Flows state from REST API.  Exiting test" )
-            main.cleanup()
-            main.exit()
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="All flows are in the ADDED state",
-                                 onfail="All flows are NOT in the ADDED state" )
-
-        main.step( "Check flows are in Mininet's flow table" )
-
-        # get the flow IDs that were added through rest
-        main.log.info( "Getting the flow IDs from ONOS" )
-        flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
-        # convert the flowIDs to ints then hex and finally back to strings
-        flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
-        main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
-
-        stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="All flows are in mininet",
-                                 onfail="All flows are NOT in mininet" )
+        main.checkingFlow.checkFlow()
 
         main.step( "Send a packet to verify the flow is correct" )
 
@@ -1537,46 +1141,7 @@
         # Giving ONOS time to add the flow
         time.sleep( main.addFlowSleep )
 
-        main.step( "Check flow is in the ADDED state" )
-
-        main.log.info( "Get the flows from ONOS" )
-        try:
-            flows = json.loads( main.ONOSrest.flows() )
-
-            stepResult = main.TRUE
-            for f in flows:
-                if "rest" in f.get( "appId" ):
-                    if "ADDED" not in f.get( "state" ):
-                        stepResult = main.FALSE
-                        main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
-        except TypeError:
-            main.log.error( "No Flows found by the REST API" )
-            stepResult = main.FALSE
-        except ValueError:
-            main.log.error( "Problem getting Flows state from REST API.  Exiting test" )
-            main.cleanup()
-            main.exit()
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="All flows are in the ADDED state",
-                                 onfail="All flows are NOT in the ADDED state" )
-
-        main.step( "Check flows are in Mininet's flow table" )
-
-        # get the flow IDs that were added through rest
-        main.log.info( "Getting the flow IDs from ONOS" )
-        flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
-        # convert the flowIDs to ints then hex and finally back to strings
-        flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
-        main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
-
-        stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="All flows are in mininet",
-                                 onfail="All flows are NOT in mininet" )
+        main.checkingFlow.checkFlow()
 
         main.step( "Send a packet to verify the flow is correct" )
 
@@ -1657,46 +1222,7 @@
         # Giving ONOS time to add the flow
         time.sleep( main.addFlowSleep )
 
-        main.step( "Check flow is in the ADDED state" )
-
-        main.log.info( "Get the flows from ONOS" )
-        try:
-            flows = json.loads( main.ONOSrest.flows() )
-
-            stepResult = main.TRUE
-            for f in flows:
-                if "rest" in f.get( "appId" ):
-                    if "ADDED" not in f.get( "state" ):
-                        stepResult = main.FALSE
-                        main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
-        except TypeError:
-            main.log.error( "No Flows found by the REST API" )
-            stepResult = main.FALSE
-        except ValueError:
-            main.log.error( "Problem getting Flows state from REST API.  Exiting test" )
-            main.cleanup()
-            main.exit()
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="All flows are in the ADDED state",
-                                 onfail="All flows are NOT in the ADDED state" )
-
-        main.step( "Check flows are in Mininet's flow table" )
-
-        # get the flow IDs that were added through rest
-        main.log.info( "Getting the flow IDs from ONOS" )
-        flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
-        # convert the flowIDs to ints then hex and finally back to strings
-        flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
-        main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
-
-        stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="All flows are in mininet",
-                                 onfail="All flows are NOT in mininet" )
+        main.checkingFlow.checkFlow()
 
         main.step( "Send a packet to verify the flow is correct" )
 
diff --git a/TestON/tests/FUNC/FUNCflow/dependencies/__init__.py b/TestON/tests/FUNC/FUNCflow/dependencies/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/FUNC/FUNCflow/dependencies/__init__.py
diff --git a/TestON/tests/FUNC/FUNCflow/dependencies/checkingFlow.py b/TestON/tests/FUNC/FUNCflow/dependencies/checkingFlow.py
new file mode 100644
index 0000000..5a5537c
--- /dev/null
+++ b/TestON/tests/FUNC/FUNCflow/dependencies/checkingFlow.py
@@ -0,0 +1,47 @@
+import json
+import time
+class CheckingFlow:
+
+    def __init__( self ):
+        self.default = ''
+
+    def checkFlow( self ):
+        main.step("Check flow is in the ADDED state")
+        main.log.info( "Get the flows from ONOS" )
+        try:
+            flows = json.loads( main.ONOSrest.flows() )
+
+            stepResult = main.TRUE
+            for f in flows:
+                if "rest" in f.get( "appId" ):
+                    if "ADDED" not in f.get( "state" ):
+                        stepResult = main.FALSE
+                        main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
+        except TypeError:
+            main.log.error( "No Flows found by the REST API" )
+            stepResult = main.FALSE
+        except ValueError:
+            main.log.error( "Problem getting Flows state from REST API.  Exiting test" )
+            main.cleanup()
+            main.exit()
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="All flows are in the ADDED state",
+                                 onfail="All flows are NOT in the ADDED state" )
+
+        main.step( "Check flows are in Mininet's flow table" )
+
+        # get the flow IDs that were added through rest
+        main.log.info( "Getting the flow IDs from ONOS" )
+        flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
+        # convert the flowIDs to ints then hex and finally back to strings
+        flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
+        main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
+
+        stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="All flows are in mininet",
+                                 onfail="All flows are NOT in mininet" )
diff --git a/TestON/tests/FUNC/FUNCflow/dependencies/startUp.py b/TestON/tests/FUNC/FUNCflow/dependencies/startUp.py
deleted file mode 100644
index a9becf9..0000000
--- a/TestON/tests/FUNC/FUNCflow/dependencies/startUp.py
+++ /dev/null
@@ -1,33 +0,0 @@
-"""
-    This wrapper function is use for starting up onos instance
-"""
-import time
-import os
-import json
-
-
-def onosBuild( main, gitBranch ):
-    """
-        This includes pulling ONOS and building it using maven install
-    """
-    buildResult = main.FALSE
-
-    # Git checkout a branch of ONOS
-    checkOutResult = main.ONOSbench.gitCheckout( gitBranch )
-    # Does the git pull on the branch that was checked out
-    if not checkOutResult:
-        main.log.warn( "Failed to checked out " + gitBranch +
-                                           " branch" )
-    else:
-        main.log.info( "Successfully checked out " + gitBranch +
-                                           " branch" )
-    gitPullResult = main.ONOSbench.gitPull()
-    if gitPullResult == main.ERROR:
-        main.log.error( "Error pulling git branch" )
-    else:
-        main.log.info( "Successfully pulled " + gitBranch + " branch" )
-
-    # buck build
-    buildResult = main.ONOSbench.buckBuild()
-
-    return buildResult
diff --git a/TestON/tests/FUNC/FUNCflow/dependencies/topo.py b/TestON/tests/FUNC/FUNCflow/dependencies/topo.py
deleted file mode 100644
index 7217d4d..0000000
--- a/TestON/tests/FUNC/FUNCflow/dependencies/topo.py
+++ /dev/null
@@ -1,102 +0,0 @@
-"""
-    These functions can be used for topology comparisons
-"""
-import time
-import os
-import json
-
-
-def getAllDevices( main ):
-    """
-        Return a list containing the devices output from each ONOS node
-    """
-    devices = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].devices,
-                         name="devices-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        devices.append( t.result )
-    return devices
-
-
-def getAllHosts( main ):
-    """
-        Return a list containing the hosts output from each ONOS node
-    """
-    hosts = []
-    ipResult = main.TRUE
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].hosts,
-                         name="hosts-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        hosts.append( t.result )
-    return hosts
-
-
-def getAllPorts( main ):
-    """
-        Return a list containing the ports output from each ONOS node
-    """
-    ports = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].ports,
-                         name="ports-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        ports.append( t.result )
-    return ports
-
-
-def getAllLinks( main ):
-    """
-        Return a list containing the links output from each ONOS node
-    """
-    links = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].links,
-                         name="links-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        links.append( t.result )
-    return links
-
-
-def getAllClusters( main ):
-    """
-        Return a list containing the clusters output from each ONOS node
-    """
-    clusters = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].clusters,
-                         name="clusters-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        clusters.append( t.result )
-    return clusters
diff --git a/TestON/tests/FUNC/FUNCgroup/FUNCgroup.params b/TestON/tests/FUNC/FUNCgroup/FUNCgroup.params
index 585eca3..ca223bd 100644
--- a/TestON/tests/FUNC/FUNCgroup/FUNCgroup.params
+++ b/TestON/tests/FUNC/FUNCgroup/FUNCgroup.params
@@ -10,7 +10,7 @@
     # 7    - Testing GROUP with type "INDIRECT"
     # 8    - Deleting the group and flow
     # 100  - Check logs for Errors and Warnings
-    <testcases>1,2,3,5,6,7,8,100</testcases>
+    <testcases>1,2,3,5,6,7,6,100</testcases>
 
     <SCALE>
         <max>1</max>
diff --git a/TestON/tests/FUNC/FUNCgroup/FUNCgroup.py b/TestON/tests/FUNC/FUNCgroup/FUNCgroup.py
index 4c80ee0..f50e7c5 100644
--- a/TestON/tests/FUNC/FUNCgroup/FUNCgroup.py
+++ b/TestON/tests/FUNC/FUNCgroup/FUNCgroup.py
@@ -6,7 +6,6 @@
     def CASE1( self, main ):
         import os
         import imp
-
         """
         - Construct tests variables
         - GIT ( optional )
@@ -16,90 +15,71 @@
             - Install ONOS package
             - Build ONOS package
         """
-        main.case( "Constructing test variables and building ONOS package" )
-        main.step( "Constructing test variables" )
+        try:
+            from tests.dependencies.ONOSSetup import ONOSSetup
+            main.testSetUp = ONOSSetup()
+        except ImportError:
+            main.log.error( "ONOSSetup not found. exiting the test" )
+            main.exit()
+        main.testSetUp.envSetupDescription()
+        stepResult = main.FALSE
 
-        # Test variables
-        main.testOnDirectory = os.path.dirname( os.getcwd() )
-        main.cellName = main.params[ 'ENV' ][ 'cellName' ]
-        main.apps = main.params[ 'ENV' ][ 'cellApps' ]
-        gitBranch = main.params[ 'GIT' ][ 'branch' ]
-        gitPull = main.params[ 'GIT' ][ 'pull' ]
-        main.ONOSport = main.params[ 'CTRL' ][ 'port' ]
-        main.dependencyPath = main.testOnDirectory + \
-                              main.params[ 'DEPENDENCY' ][ 'path' ]
-        wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
-        wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
-        main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
-        bucket = main.params[ 'DEPENDENCY' ][ 'bucket' ]
-        main.maxNodes = int( main.params[ 'SCALE' ][ 'max' ] )
-        main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
-        main.startMNSleep = int( main.params[ 'SLEEP' ][ 'startMN' ] )
-        main.addFlowSleep = int( main.params[ 'SLEEP' ][ 'addFlow' ] )
-        main.delFlowSleep = int( main.params[ 'SLEEP' ][ 'delFlow' ] )
-        main.addGroupSleep = int( main.params[ 'SLEEP' ][ 'addGroup' ] )
-        main.delGroupSleep = int( main.params[ 'SLEEP' ][ 'delGroup' ] )
-        main.debug = main.params[ 'DEBUG' ]
-        main.swDPID = main.params[ 'TEST' ][ 'swDPID' ]
-        egressPort1 = main.params[ 'TEST' ][ 'egressPort1' ]
-        egressPort2 = main.params[ 'TEST' ][ 'egressPort2' ]
-        egressPort3 = main.params[ 'TEST' ][ 'egressPort3' ]
-        ingressPort = main.params[ 'TEST' ][ 'ingressPort' ]
-        appCookie = main.params[ 'TEST' ][ 'appCookie' ]
-        type1 = main.params[ 'TEST' ][ 'type1' ]
-        type2 = main.params[ 'TEST' ][ 'type2' ]
-        groupId = main.params[ 'TEST' ][ 'groupId' ]
-        priority = main.params[ 'TEST' ][ 'priority' ]
-        deviceId = main.params[ 'TEST' ][ 'swDPID' ]
+        try:
+            # Test variables
+            main.cellName = main.params['ENV']['cellName']
+            main.apps = main.params['ENV']['cellApps']
+            main.ONOSport = main.params['CTRL']['port']
+            main.dependencyPath = main.testOnDirectory + \
+                                  main.params['DEPENDENCY']['path']
+            wrapperFile1 = main.params['DEPENDENCY']['wrapper1']
+            wrapperFile2 = main.params['DEPENDENCY']['wrapper2']
+            main.topology = main.params['DEPENDENCY']['topology']
+            bucket = main.params['DEPENDENCY']['bucket']
+            main.maxNodes = int(main.params['SCALE']['max'])
+            main.startUpSleep = int(main.params['SLEEP']['startup'])
+            main.startMNSleep = int(main.params['SLEEP']['startMN'])
+            main.addFlowSleep = int(main.params['SLEEP']['addFlow'])
+            main.delFlowSleep = int(main.params['SLEEP']['delFlow'])
+            main.addGroupSleep = int(main.params['SLEEP']['addGroup'])
+            main.delGroupSleep = int(main.params['SLEEP']['delGroup'])
+            main.debug = main.params['DEBUG']
+            main.swDPID = main.params['TEST']['swDPID']
+            egressPort1 = main.params['TEST']['egressPort1']
+            egressPort2 = main.params['TEST']['egressPort2']
+            egressPort3 = main.params['TEST']['egressPort3']
+            ingressPort = main.params['TEST']['ingressPort']
+            appCookie = main.params['TEST']['appCookie']
+            type1 = main.params['TEST']['type1']
+            type2 = main.params['TEST']['type2']
+            groupId = main.params['TEST']['groupId']
+            priority = main.params['TEST']['priority']
+            deviceId = main.params['TEST']['swDPID']
 
-        main.cellData = {}  # for creating cell file
-        main.CLIs = []
-        main.ONOSip = []
+            main.debug = True if "on" in main.debug else False
+            # -- INIT SECTION, ONLY RUNS ONCE -- #
 
-        main.debug = True if "on" in main.debug else False
+            main.buckets = imp.load_source(bucket,
+                                           main.dependencyPath +
+                                           bucket +
+                                           ".py")
 
-        main.ONOSip = main.ONOSbench.getOnosIps()
+            copyResult = main.ONOSbench.scp(main.Mininet1,
+                                            main.dependencyPath + main.topology,
+                                            main.Mininet1.home + '/custom/',
+                                            direction="to")
 
-        # Assigning ONOS cli handles to a list
-        for i in range( 1, main.maxNodes + 1 ):
-            main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+            utilities.assert_equals(expect=main.TRUE,
+                                    actual=copyResult,
+                                    onpass="Successfully copy " + "test variables ",
+                                    onfail="Failed to copy test variables")
+            stepResult = main.testSetUp.envSetup()
 
-        # -- INIT SECTION, ONLY RUNS ONCE -- #
-        main.startUp = imp.load_source( wrapperFile1,
-                                        main.dependencyPath +
-                                        wrapperFile1 +
-                                        ".py" )
+        except Exception as e:
+            main.testSetUp.envSetupException( e )
 
-        main.topo = imp.load_source( wrapperFile2,
-                                     main.dependencyPath +
-                                     wrapperFile2 +
-                                     ".py" )
+        main.testSetUp.evnSetupConclusion( stepResult )
 
-        main.buckets = imp.load_source( bucket,
-                                        main.dependencyPath +
-                                        bucket +
-                                        ".py" )
 
-        copyResult = main.ONOSbench.scp( main.Mininet1,
-                                         main.dependencyPath + main.topology,
-                                         main.Mininet1.home + '/custom/',
-                                         direction="to" )
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=copyResult,
-                                 onpass="Successfully copy " + "test variables ",
-                                 onfail="Failed to copy test variables" )
-
-        if main.CLIs:
-            stepResult = main.TRUE
-        else:
-            main.log.error( "Did not properly created list of ONOS CLI handle" )
-            stepResult = main.FALSE
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully construct " + "test variables ",
-                                 onfail="Failed to construct test variables" )
 
     def CASE2( self, main ):
         """
@@ -113,121 +93,23 @@
         - Install ONOS cluster
         - Connect to cli
         """
-        import time
-
-        main.numCtrls = int( main.maxNodes )
-
-        main.case( "Starting up " + str( main.numCtrls ) +
-                   " node(s) ONOS cluster" )
-
-        #kill off all onos processes
-        main.log.info( "Safety check, killing all ONOS processes" +
-                       " before initiating environment setup" )
-
-        for i in range( main.maxNodes ):
-            main.ONOSbench.onosDie( main.ONOSip[ i ] )
-
-        main.log.info( "NODE COUNT = " + str( main.numCtrls ) )
-
-        tempOnosIp = []
-        for i in range( main.numCtrls ):
-            tempOnosIp.append( main.ONOSip[ i ] )
-
-        main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
-                                       "temp",
-                                       main.Mininet1.ip_address,
-                                       main.apps,
-                                       tempOnosIp, main.ONOScli1.karafUser )
-
-        main.step( "Apply cell to environment" )
-        cellResult = main.ONOSbench.setCell( "temp" )
-        verifyResult = main.ONOSbench.verifyCell()
-        stepResult = cellResult and verifyResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully applied cell to " + "environment",
-                                 onfail="Failed to apply cell to environment " )
-
-        main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.buckBuild()
-        stepResult = packageResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully created ONOS package",
-                                 onfail="Failed to create ONOS package" )
-
-        time.sleep( main.startUpSleep )
-        main.step( "Uninstalling ONOS package" )
-        onosUninstallResult = main.TRUE
-        for ip in main.ONOSip:
-            onosUninstallResult = onosUninstallResult and \
-                    main.ONOSbench.onosUninstall( nodeIp=ip )
-        stepResult = onosUninstallResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully uninstalled ONOS package",
-                                 onfail="Failed to uninstall ONOS package" )
-        time.sleep( main.startUpSleep )
-        main.step( "Installing ONOS package" )
-        onosInstallResult = main.TRUE
-        for i in range( main.numCtrls ):
-            onosInstallResult = onosInstallResult and \
-                    main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
-        stepResult = onosInstallResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully installed ONOS package",
-                                 onfail="Failed to install ONOS package" )
-
-        time.sleep( main.startUpSleep )
-        main.step( "Starting ONOS service" )
-        stopResult = main.TRUE
-        startResult = main.TRUE
-        onosIsUp = main.TRUE
-
-        for i in range( main.numCtrls ):
-            onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
-        if onosIsUp == main.TRUE:
-            main.log.report( "ONOS instance is up and ready" )
-        else:
-            main.log.report( "ONOS instance may not be up, stop and " +
-                             "start ONOS again " )
-            for i in range( main.numCtrls ):
-                stopResult = stopResult and \
-                        main.ONOSbench.onosStop( main.ONOSip[ i ] )
-            for i in range( main.numCtrls ):
-                startResult = startResult and \
-                        main.ONOSbench.onosStart( main.ONOSip[ i ] )
-        stepResult = onosIsUp and stopResult and startResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="ONOS service is ready",
-                                 onfail="ONOS service did not start properly" )
-
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[ i ] )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
-        main.step( "Start ONOS cli" )
-        cliResult = main.TRUE
-        for i in range( main.numCtrls ):
-            cliResult = cliResult and \
-                        main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
-        stepResult = cliResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully start ONOS cli",
-                                 onfail="Failed to start ONOS cli" )
+        main.testSetUp.ONOSSetUp( main.Mininet1 )
 
     def CASE3( self, main ):
         """
             Start Mininet
         """
         import json
+        import time
+        try:
+            from tests.dependencies.topology import Topology
+        except ImportError:
+            main.log.error( "Topology not found exiting the test" )
+            main.exit()
+        try:
+            main.topoRelated
+        except ( NameError, AttributeError ):
+            main.topoRelated = Topology()
 
         main.case( "Setup mininet and compare ONOS topology view to Mininet topology" )
         main.caseExplanation = "Start mininet with custom topology and compare topology " +\
@@ -252,60 +134,7 @@
 
         time.sleep( main.startMNSleep )
 
-        main.step( "Comparing MN topology to ONOS topology" )
-        main.log.info( "Gathering topology information" )
-        devices = main.topo.getAllDevices( main )
-        hosts = main.topo.getAllHosts( main )
-        ports = main.topo.getAllPorts( main )
-        links = main.topo.getAllLinks( main )
-
-        mnSwitches = main.Mininet1.getSwitches()
-        mnLinks = main.Mininet1.getLinks()
-        mnHosts = main.Mininet1.getHosts()
-
-        for controller in range( main.numCtrls ):
-            controllerStr = str( controller + 1 )
-            if devices[ controller ] and ports[ controller ] and\
-                    "Error" not in devices[ controller ] and\
-                    "Error" not in ports[ controller ]:
-
-                currentDevicesResult = main.Mininet1.compareSwitches(
-                        mnSwitches,
-                        json.loads( devices[ controller ] ),
-                        json.loads( ports[ controller ] ) )
-            else:
-                currentDevicesResult = main.FALSE
-            utilities.assert_equals( expect=main.TRUE,
-                                     actual=currentDevicesResult,
-                                     onpass="ONOS" + controllerStr +
-                                            " Switches view is correct",
-                                     onfail="ONOS" + controllerStr +
-                                            " Switches view is incorrect" )
-            if links[ controller ] and "Error" not in links[ controller ]:
-                currentLinksResult = main.Mininet1.compareLinks(
-                        mnSwitches, mnLinks,
-                        json.loads( links[ controller ] ) )
-            else:
-                currentLinksResult = main.FALSE
-            utilities.assert_equals( expect=main.TRUE,
-                                     actual=currentLinksResult,
-                                     onpass="ONOS" + controllerStr +
-                                            " links view is correct",
-                                     onfail="ONOS" + controllerStr +
-                                            " links view is incorrect" )
-
-            if hosts[ controller ] or "Error" not in hosts[ controller ]:
-                currentHostsResult = main.Mininet1.compareHosts(
-                        mnHosts,
-                        json.loads( hosts[ controller ] ) )
-            else:
-                currentHostsResult = main.FALSE
-            utilities.assert_equals( expect=main.TRUE,
-                                     actual=currentHostsResult,
-                                     onpass="ONOS" + controllerStr +
-                                            " hosts exist in Mininet",
-                                     onfail="ONOS" + controllerStr +
-                                            " hosts don't match Mininet" )
+        main.topoRelated.compareTopos( main.Mininet1 )
 
     def CASE4( self, main ):
         """
@@ -459,7 +288,7 @@
         """
         Sends a packet using  scapy
         """
-        main.step( "Testing Group by sending packet using  Scapy" )
+        main.step( "Testing Group by sending packet using Scapy" )
         main.log.info( "Creating host components" )
         main.Scapy.createHostComponent( "h1" )
         main.Scapy.createHostComponent( "h2" )
@@ -640,7 +469,7 @@
         """
         Sends a packet using scapy
         """
-        main.step( "Testing Group by sending packet using  Scapy" )
+        main.step( "Testing Group by sending packet using Scapy" )
         main.log.info( "Creating host components" )
         main.Scapy.createHostComponent( "h1" )
         main.Scapy.createHostComponent( "h2" )
@@ -676,47 +505,6 @@
                                  onpass="Packet sent to port 1 is received at port 2 successfully!!!",
                                  onfail="Failure!!!Packet sent to port 1 is not received at port 2" )
 
-    def CASE8( self, main ):
-        """
-         Deleting the Group and Flow
-        """
-        import json
-        import time
-        respFlowId = 1
-
-        main.case( "Delete the Group and Flow added through Rest api " )
-        main.step( "Deleting Group and Flows" )
-
-        #Getting Flow ID
-        response = main.ONOSrest.getFlows( deviceId=deviceId )
-        responsejson = json.loads( response )
-        for item in responsejson:
-            if item[ "priority" ] == int( priority ):
-                respFlowId = item[ "id" ]
-
-        main.step( "Deleting the created flow by deviceId and flowId" )
-        flowResponse = main.ONOSrest.removeFlow( deviceId=deviceId,
-                                                 flowId=respFlowId )
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=flowResponse,
-                                 onpass="Deleting flow is successful!!!",
-                                 onfail="Deleting flow is failure!!!" )
-
-        # Giving ONOS time to delete the flow
-        time.sleep( main.delFlowSleep )
-
-        groupResponse = main.ONOSrest.removeGroup( deviceId=deviceId,
-                                                   appCookie=appCookie )
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=groupResponse,
-                                 onpass="Deleting Group is successful!!!",
-                                 onfail="Deleting Group is failure!!!" )
-
-        # Giving ONOS time to delete the group
-        time.sleep( main.delGroupSleep )
-
     def CASE100( self, main ):
         """
             Report errors/warnings/exceptions
diff --git a/TestON/tests/FUNC/FUNCgroup/dependencies/startUp.py b/TestON/tests/FUNC/FUNCgroup/dependencies/startUp.py
deleted file mode 100644
index a9becf9..0000000
--- a/TestON/tests/FUNC/FUNCgroup/dependencies/startUp.py
+++ /dev/null
@@ -1,33 +0,0 @@
-"""
-    This wrapper function is use for starting up onos instance
-"""
-import time
-import os
-import json
-
-
-def onosBuild( main, gitBranch ):
-    """
-        This includes pulling ONOS and building it using maven install
-    """
-    buildResult = main.FALSE
-
-    # Git checkout a branch of ONOS
-    checkOutResult = main.ONOSbench.gitCheckout( gitBranch )
-    # Does the git pull on the branch that was checked out
-    if not checkOutResult:
-        main.log.warn( "Failed to checked out " + gitBranch +
-                                           " branch" )
-    else:
-        main.log.info( "Successfully checked out " + gitBranch +
-                                           " branch" )
-    gitPullResult = main.ONOSbench.gitPull()
-    if gitPullResult == main.ERROR:
-        main.log.error( "Error pulling git branch" )
-    else:
-        main.log.info( "Successfully pulled " + gitBranch + " branch" )
-
-    # buck build
-    buildResult = main.ONOSbench.buckBuild()
-
-    return buildResult
diff --git a/TestON/tests/FUNC/FUNCgroup/dependencies/topo.py b/TestON/tests/FUNC/FUNCgroup/dependencies/topo.py
deleted file mode 100644
index 7217d4d..0000000
--- a/TestON/tests/FUNC/FUNCgroup/dependencies/topo.py
+++ /dev/null
@@ -1,102 +0,0 @@
-"""
-    These functions can be used for topology comparisons
-"""
-import time
-import os
-import json
-
-
-def getAllDevices( main ):
-    """
-        Return a list containing the devices output from each ONOS node
-    """
-    devices = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].devices,
-                         name="devices-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        devices.append( t.result )
-    return devices
-
-
-def getAllHosts( main ):
-    """
-        Return a list containing the hosts output from each ONOS node
-    """
-    hosts = []
-    ipResult = main.TRUE
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].hosts,
-                         name="hosts-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        hosts.append( t.result )
-    return hosts
-
-
-def getAllPorts( main ):
-    """
-        Return a list containing the ports output from each ONOS node
-    """
-    ports = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].ports,
-                         name="ports-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        ports.append( t.result )
-    return ports
-
-
-def getAllLinks( main ):
-    """
-        Return a list containing the links output from each ONOS node
-    """
-    links = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].links,
-                         name="links-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        links.append( t.result )
-    return links
-
-
-def getAllClusters( main ):
-    """
-        Return a list containing the clusters output from each ONOS node
-    """
-    clusters = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].clusters,
-                         name="clusters-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        clusters.append( t.result )
-    return clusters
diff --git a/TestON/tests/FUNC/FUNCintent/FUNCintent.py b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
index cfca916..77ad5f9 100644
--- a/TestON/tests/FUNC/FUNCintent/FUNCintent.py
+++ b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
@@ -9,7 +9,6 @@
     def CASE1( self, main ):
         import imp
         import re
-
         """
         - Construct tests variables
         - GIT ( optional )
@@ -19,26 +18,24 @@
             - Install ONOS package
             - Build ONOS package
         """
-        main.case( "Constructing test variables and building ONOS package" )
-        main.step( "Constructing test variables" )
-        main.caseExplanation = "This test case is mainly for loading " +\
-                               "from params file, and pull and build the " +\
-                               " latest ONOS package"
+
+        try:
+            from tests.dependencies.ONOSSetup import ONOSSetup
+            main.testSetUp = ONOSSetup()
+        except ImportError:
+            main.log.error( "ONOSSetup not found. exiting the test" )
+            main.exit()
+        main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
 
         # Test variables
         try:
-            main.testOnDirectory = re.sub( "(/tests)$", "", main.testDir )
             main.apps = main.params[ 'ENV' ][ 'cellApps' ]
-            gitBranch = main.params[ 'GIT' ][ 'branch' ]
             main.dependencyPath = main.testOnDirectory + \
                                   main.params[ 'DEPENDENCY' ][ 'path' ]
             main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
             main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
-            if main.ONOSbench.maxNodes:
-                main.maxNodes = int( main.ONOSbench.maxNodes )
-            else:
-                main.maxNodes = 0
+
             wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
             wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
             wrapperFile3 = main.params[ 'DEPENDENCY' ][ 'wrapper3' ]
@@ -53,63 +50,31 @@
             main.checkIntentPointSleep = int( main.params[ 'SLEEP' ][ 'checkIntentPoint' ] )
             main.checkTopoAttempts = int( main.params[ 'SLEEP' ][ 'topoAttempts' ] )
             main.flowDurationSleep = int( main.params[ 'SLEEP' ][ 'flowDuration' ] )
-            gitPull = main.params[ 'GIT' ][ 'pull' ]
             main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
             main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
-            main.cellData = {}  # for creating cell file
             main.hostsData = {}
-            main.CLIs = []
-            main.ONOSip = []
             main.scapyHostNames = main.params[ 'SCAPY' ][ 'HOSTNAMES' ].split( ',' )
             main.scapyHosts = []  # List of scapy hosts for iterating
             main.assertReturnString = ''  # Assembled assert return string
             main.cycle = 0  # How many times FUNCintent has run through its tests
 
-            main.ONOSip = main.ONOSbench.getOnosIps()
-            main.log.debug( "Found ONOS ips: {}".format( main.ONOSip ) )
-
-            # Assigning ONOS cli handles to a list
-            for i in range( 1, main.maxNodes + 1 ):
-                main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
-
             # -- INIT SECTION, ONLY RUNS ONCE -- #
-            main.startUp = imp.load_source( wrapperFile1,
-                                            main.dependencyPath +
-                                            wrapperFile1 +
-                                            ".py" )
 
             main.intents = imp.load_source( wrapperFile2,
                                             main.dependencyPath +
                                             wrapperFile2 +
                                             ".py" )
 
-            main.topo = imp.load_source( wrapperFile3,
-                                         main.dependencyPath +
-                                         wrapperFile3 +
-                                         ".py" )
-
             copyResult1 = main.ONOSbench.scp( main.Mininet1,
                                               main.dependencyPath +
                                               main.topology,
                                               main.Mininet1.home + "custom/",
                                               direction="to" )
-            if main.CLIs:
-                stepResult = main.TRUE
-            else:
-                main.log.error( "Did not properly created list of ONOS CLI handle" )
-                stepResult = main.FALSE
+
+            stepResult = main.testSetUp.envSetup( True )
         except Exception as e:
-            main.log.exception( e )
-            main.cleanup()
-            main.exit()
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully construct " +
-                                        "test variables ",
-                                 onfail="Failed to construct test variables" )
-
-        main.ONOSbench.getVersion( report=True )
+            main.testSetUp.envSetupException( e )
+        main.testSetUp.evnSetupConclusion( stepResult )
 
     def CASE2( self, main ):
         """
@@ -123,245 +88,26 @@
         - Install ONOS cluster
         - Connect to cli
         """
-        import time
-        main.cycle += 1
 
-        # main.scale[ 0 ] determines the current number of ONOS controller
-        main.numCtrls = int( main.scale[ 0 ] )
         main.flowCompiler = "Flow Rules"
-        main.initialized = main.TRUE
-
-        main.case( "Starting up " + str( main.numCtrls ) +
-                   " node(s) ONOS cluster" )
-        main.caseExplanation = "Set up ONOS with " + str( main.numCtrls ) +\
-                                " node(s) ONOS cluster"
-
-        #kill off all onos processes
-        main.log.info( "Safety check, killing all ONOS processes" +
-                       " before initiating environment setup" )
-
-        main.step( "Uninstalling ONOS package" )
-        onosUninstallResult = main.TRUE
-        for ip in main.ONOSip:
-            onosUninstallResult = onosUninstallResult and \
-                    main.ONOSbench.onosUninstall( nodeIp=ip )
-        stepResult = onosUninstallResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully uninstalled ONOS package",
-                                 onfail="Failed to uninstall ONOS package" )
-        for i in range( main.maxNodes ):
-            main.ONOSbench.onosDie( main.ONOSip[ i ] )
-
-        main.log.debug( "NODE COUNT = " + str( main.numCtrls ) )
-
-        tempOnosIp = []
-        for i in range( main.numCtrls ):
-            tempOnosIp.append( main.ONOSip[ i ] )
-
-        main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
-                                       "temp", main.Mininet1.ip_address,
-                                       main.apps, tempOnosIp, main.ONOScli1.karafUser )
-
-        main.step( "Apply cell to environment" )
-        cellResult = main.ONOSbench.setCell( "temp" )
-        verifyResult = main.ONOSbench.verifyCell()
-        stepResult = cellResult and verifyResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully applied cell to " +
-                                        "environment",
-                                 onfail="Failed to apply cell to environment " )
-
-        main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.buckBuild()
-        stepResult = packageResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully created ONOS package",
-                                 onfail="Failed to create ONOS package" )
-
-        main.step( "Installing ONOS package" )
-        onosInstallResult = main.TRUE
-        for i in range( main.numCtrls ):
-            onosInstallResult = onosInstallResult and \
-                    main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
-        stepResult = onosInstallResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully installed ONOS package",
-                                 onfail="Failed to install ONOS package" )
-
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[ i ] )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
-        main.log.info( "Sleeping {} seconds".format( main.startUpSleep ) )
-        time.sleep( main.startUpSleep )
-        main.step( "Checking ONOS is running" )
-        stopResult = main.TRUE
-        startResult = main.TRUE
-        onosIsUp = main.TRUE
-
-        for i in range( main.numCtrls ):
-            isUp = main.ONOSbench.isup( main.ONOSip[ i ] )
-            onosIsUp = onosIsUp and isUp
-            if isUp == main.TRUE:
-                main.log.report( "ONOS instance {0} is up and ready".format( i + 1 ) )
-            else:
-                main.log.report( "ONOS instance {0} may not be up, stop and ".format( i + 1 ) +
-                                 "start ONOS again " )
-                stopResult = stopResult and main.ONOSbench.onosStop( main.ONOSip[ i ] )
-                startResult = startResult and main.ONOSbench.onosStart( main.ONOSip[ i ] )
-                if not startResult or stopResult:
-                    main.log.report( "ONOS instance {0} did not start correctly.".format( i + 1 ) )
-        stepResult = onosIsUp and stopResult and startResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="ONOS service is ready on all nodes",
-                                 onfail="ONOS service did not start properly on all nodes" )
-
-        main.step( "Start ONOS cli" )
-        cliResult = main.TRUE
-        for i in range( main.numCtrls ):
-            cliResult = cliResult and \
-                        main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
-        stepResult = cliResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully start ONOS cli",
-                                 onfail="Failed to start ONOS cli" )
-        if not stepResult:
-            main.initialized = main.FALSE
-
-        # Remove the first element in main.scale list
-        main.scale.remove( main.scale[ 0 ] )
-
+        main.initialized = main.testSetUp.ONOSSetUp( main.Mininet1, True )
         main.intents.report( main )
 
     def CASE8( self, main ):
         """
         Compare ONOS Topology to Mininet Topology
         """
-        import json
-
-        main.case( "Compare ONOS Topology view to Mininet topology" )
-        main.caseExplanation = "Compare topology elements between Mininet" +\
-                                " and ONOS"
-
-        main.log.info( "Gathering topology information from Mininet" )
-        devicesResults = main.FALSE  # Overall Boolean for device correctness
-        linksResults = main.FALSE  # Overall Boolean for link correctness
-        hostsResults = main.FALSE  # Overall Boolean for host correctness
-        deviceFails = []  # Nodes where devices are incorrect
-        linkFails = []  # Nodes where links are incorrect
-        hostFails = []  # Nodes where hosts are incorrect
-        attempts = main.checkTopoAttempts  # Remaining Attempts
-
-        mnSwitches = main.Mininet1.getSwitches()
-        mnLinks = main.Mininet1.getLinks()
-        mnHosts = main.Mininet1.getHosts()
-
-        main.step( "Comparing Mininet topology to ONOS topology" )
-
-        while ( attempts >= 0 ) and\
-                ( not devicesResults or not linksResults or not hostsResults ):
-            main.log.info( "Sleeping {} seconds".format( 2 ) )
-            time.sleep( 2 )
-            if not devicesResults:
-                devices = main.topo.getAllDevices( main )
-                ports = main.topo.getAllPorts( main )
-                devicesResults = main.TRUE
-                deviceFails = []  # Reset for each failed attempt
-            if not linksResults:
-                links = main.topo.getAllLinks( main )
-                linksResults = main.TRUE
-                linkFails = []  # Reset for each failed attempt
-            if not hostsResults:
-                hosts = main.topo.getAllHosts( main )
-                hostsResults = main.TRUE
-                hostFails = []  # Reset for each failed attempt
-
-            #  Check for matching topology on each node
-            for controller in range( main.numCtrls ):
-                controllerStr = str( controller + 1 )  # ONOS node number
-                # Compare Devices
-                if devices[ controller ] and ports[ controller ] and\
-                        "Error" not in devices[ controller ] and\
-                        "Error" not in ports[ controller ]:
-
-                    try:
-                        deviceData = json.loads( devices[ controller ] )
-                        portData = json.loads( ports[ controller ] )
-                    except( TypeError, ValueError ):
-                        main.log.error( "Could not load json: {0} or {1}".format( str( devices[ controller ] ), str( ports[ controller ] ) ) )
-                        currentDevicesResult = main.FALSE
-                    else:
-                        currentDevicesResult = main.Mininet1.compareSwitches(
-                            mnSwitches, deviceData, portData )
-                else:
-                    currentDevicesResult = main.FALSE
-                if not currentDevicesResult:
-                    deviceFails.append( controllerStr )
-                devicesResults = devicesResults and currentDevicesResult
-                # Compare Links
-                if links[ controller ] and "Error" not in links[ controller ]:
-                    try:
-                        linkData = json.loads( links[ controller ] )
-                    except( TypeError, ValueError ):
-                        main.log.error( "Could not load json:" + str( links[ controller ] ) )
-                        currentLinksResult = main.FALSE
-                    else:
-                        currentLinksResult = main.Mininet1.compareLinks(
-                            mnSwitches, mnLinks, linkData )
-                else:
-                    currentLinksResult = main.FALSE
-                if not currentLinksResult:
-                    linkFails.append( controllerStr )
-                linksResults = linksResults and currentLinksResult
-                # Compare Hosts
-                if hosts[ controller ] and "Error" not in hosts[ controller ]:
-                    try:
-                        hostData = json.loads( hosts[ controller ] )
-                    except( TypeError, ValueError ):
-                        main.log.error( "Could not load json:" + str( hosts[ controller ] ) )
-                        currentHostsResult = main.FALSE
-                    else:
-                        currentHostsResult = main.Mininet1.compareHosts(
-                                mnHosts, hostData )
-                else:
-                    currentHostsResult = main.FALSE
-                if not currentHostsResult:
-                    hostFails.append( controllerStr )
-                hostsResults = hostsResults and currentHostsResult
-            # Decrement Attempts Remaining
-            attempts -= 1
-
-        utilities.assert_equals( expect=[],
-                                 actual=deviceFails,
-                                 onpass="ONOS correctly discovered all devices",
-                                 onfail="ONOS incorrectly discovered devices on nodes: " +
-                                 str( deviceFails ) )
-        utilities.assert_equals( expect=[],
-                                 actual=linkFails,
-                                 onpass="ONOS correctly discovered all links",
-                                 onfail="ONOS incorrectly discovered links on nodes: " +
-                                 str( linkFails ) )
-        utilities.assert_equals( expect=[],
-                                 actual=hostFails,
-                                 onpass="ONOS correctly discovered all hosts",
-                                 onfail="ONOS incorrectly discovered hosts on nodes: " +
-                                 str( hostFails ) )
-        topoResults = hostsResults and linksResults and devicesResults
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=topoResults,
-                                 onpass="ONOS correctly discovered the topology",
-                                 onfail="ONOS incorrectly discovered the topology" )
-
+        import time
+        try:
+            from tests.dependencies.topology import Topology
+        except ImportError:
+            main.log.error( "Topology not found exiting the test" )
+            main.exit()
+        try:
+            main.topoRelated
+        except ( NameError, AttributeError ):
+            main.topoRelated = Topology()
+        main.topoRelated.compareTopos( main.Mininet1, main.checkTopoAttempts )
     def CASE10( self, main ):
         """
             Start Mininet topology with OF 1.0 switches
@@ -619,6 +365,15 @@
         """
             Stop mininet and remove scapy host
         """
+        try:
+            from tests.dependencies.utils import Utils
+        except ImportError:
+            main.log.error( "Utils not found exiting the test" )
+            main.exit()
+        try:
+            main.Utils
+        except ( NameError, AttributeError ):
+            main.Utils = Utils()
         main.log.report( "Stop Mininet and Scapy" )
         main.case( "Stop Mininet and Scapy" )
         main.caseExplanation = "Stopping the current mininet topology " +\
@@ -641,13 +396,7 @@
                                  onpass="Successfully stopped scapy and removed host components",
                                  onfail="Failed to stop mininet and scapy" )
 
-        main.step( "Stopping Mininet Topology" )
-        mininetResult = main.Mininet1.stopNet()
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=mininetResult,
-                                 onpass="Successfully stopped mininet and scapy",
-                                 onfail="Failed to stop mininet and scapy" )
+        mininetResult = main.Utils.mininetCleanup( main.Mininet1 )
         # Exit if topology did not load properly
         if not ( mininetResult and scapyResult ):
             main.cleanup()
@@ -657,33 +406,16 @@
         """
             Copy the karaf.log files after each testcase cycle
         """
-        main.log.report( "Copy karaf logs" )
-        main.case( "Copy karaf logs" )
-        main.caseExplanation = "Copying the karaf logs to preserve them through" +\
-                               "reinstalling ONOS"
-        main.step( "Copying karaf logs" )
-        stepResult = main.TRUE
-        scpResult = main.TRUE
-        copyResult = main.TRUE
-        for i in range( main.numCtrls ):
-            main.node = main.CLIs[ i ]
-            ip = main.ONOSip[ i ]
-            main.node.ip_address = ip
-            scpResult = scpResult and main.ONOSbench.scp( main.node,
-                                                          "/opt/onos/log/karaf.log",
-                                                          "/tmp/karaf.log",
-                                                          direction="from" )
-            copyResult = copyResult and main.ONOSbench.cpLogsToDir( "/tmp/karaf.log", main.logdir,
-                                                                    copyFileName=( "karaf.log.node{0}.cycle{1}".format( str( i + 1 ), str( main.cycle ) ) ) )
-            if scpResult and copyResult:
-                stepResult = main.TRUE and stepResult
-            else:
-                stepResult = main.FALSE and stepResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully copied remote ONOS logs",
-                                 onfail="Failed to copy remote ONOS logs" )
-
+        try:
+            from tests.dependencies.utils import Utils
+        except ImportError:
+            main.log.error( "Utils not found exiting the test" )
+            main.exit()
+        try:
+            main.Utils
+        except ( NameError, AttributeError ):
+            main.Utils = Utils()
+        main.Utils.copyKarafLog()
     def CASE1000( self, main ):
         """
             Add host intents between 2 host:
diff --git a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
index 9159e4d..d08154e 100644
--- a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
@@ -1911,7 +1911,16 @@
         Confirms that all ONOS nodes have discovered all scapy hosts
     """
     import collections
-    hosts = main.topo.getAllHosts( main )  # Get host data from each ONOS node
+    try:
+        from tests.dependencies.topology import Topology
+    except Exception:
+        main.log.error( "Topology not found exiting the test" )
+        main.exit()
+    try:
+        main.topoRelated
+    except Exception:
+        main.topoRelated = Topology()
+    hosts = main.topoRelated.getAllHosts( main.numCtrls, False )  # Get host data from each ONOS node
     hostFails = []  # Reset for each failed attempt
 
     #  Check for matching hosts on each node
diff --git a/TestON/tests/FUNC/FUNCintent/dependencies/startUp.py b/TestON/tests/FUNC/FUNCintent/dependencies/startUp.py
deleted file mode 100644
index ad92fb9..0000000
--- a/TestON/tests/FUNC/FUNCintent/dependencies/startUp.py
+++ /dev/null
@@ -1,33 +0,0 @@
-"""
-    This wrapper function is use for starting up onos instance
-"""
-import time
-import os
-import json
-
-
-def onosBuild( main, gitBranch ):
-    """
-        This includes pulling ONOS and building it using maven install
-    """
-    buildResult = main.FALSE
-
-    # Git checkout a branch of ONOS
-    checkOutResult = main.ONOSbench.gitCheckout( gitBranch )
-    # Does the git pull on the branch that was checked out
-    if not checkOutResult:
-        main.log.warn( "Failed to checked out " + gitBranch +
-                                           " branch" )
-    else:
-        main.log.info( "Successfully checked out " + gitBranch +
-                                           " branch" )
-    gitPullResult = main.ONOSbench.gitPull()
-    if gitPullResult == main.ERROR:
-        main.log.error( "Error pulling git branch" )
-    else:
-        main.log.info( "Successfully pulled " + gitBranch + " branch" )
-
-    # buck Build
-    buildResult = main.ONOSbench.buckBuild()
-
-    return buildResult
diff --git a/TestON/tests/FUNC/FUNCintent/dependencies/topo.py b/TestON/tests/FUNC/FUNCintent/dependencies/topo.py
deleted file mode 100644
index 7217d4d..0000000
--- a/TestON/tests/FUNC/FUNCintent/dependencies/topo.py
+++ /dev/null
@@ -1,102 +0,0 @@
-"""
-    These functions can be used for topology comparisons
-"""
-import time
-import os
-import json
-
-
-def getAllDevices( main ):
-    """
-        Return a list containing the devices output from each ONOS node
-    """
-    devices = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].devices,
-                         name="devices-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        devices.append( t.result )
-    return devices
-
-
-def getAllHosts( main ):
-    """
-        Return a list containing the hosts output from each ONOS node
-    """
-    hosts = []
-    ipResult = main.TRUE
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].hosts,
-                         name="hosts-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        hosts.append( t.result )
-    return hosts
-
-
-def getAllPorts( main ):
-    """
-        Return a list containing the ports output from each ONOS node
-    """
-    ports = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].ports,
-                         name="ports-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        ports.append( t.result )
-    return ports
-
-
-def getAllLinks( main ):
-    """
-        Return a list containing the links output from each ONOS node
-    """
-    links = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].links,
-                         name="links-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        links.append( t.result )
-    return links
-
-
-def getAllClusters( main ):
-    """
-        Return a list containing the clusters output from each ONOS node
-    """
-    clusters = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].clusters,
-                         name="clusters-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        clusters.append( t.result )
-    return clusters
diff --git a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
index e1d26b0..0e96d69 100644
--- a/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
+++ b/TestON/tests/FUNC/FUNCintentRest/FUNCintentRest.py
@@ -19,7 +19,6 @@
         import time
         import imp
         import re
-
         """
         - Construct tests variables
         - GIT ( optional )
@@ -29,26 +28,22 @@
             - Install ONOS package
             - Build ONOS package
         """
-        main.case( "Constructing test variables and building ONOS package" )
-        main.step( "Constructing test variables" )
-        main.caseExplanation = "This test case is mainly for loading " +\
-                               "from params file, and pull and build the " +\
-                               " latest ONOS package"
+        try:
+            from tests.dependencies.ONOSSetup import ONOSSetup
+            main.testSetUp = ONOSSetup()
+        except ImportError:
+            main.log.error( "ONOSSetup not found. exiting the test" )
+            main.exit()
+        main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
 
         # Test variables
         try:
-            main.testOnDirectory = re.sub( "(/tests)$", "", main.testDir )
             main.apps = main.params[ 'ENV' ][ 'cellApps' ]
-            gitBranch = main.params[ 'GIT' ][ 'branch' ]
             main.dependencyPath = main.testOnDirectory + \
                                   main.params[ 'DEPENDENCY' ][ 'path' ]
             main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
             main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
-            if main.ONOSbench.maxNodes:
-                main.maxNodes = int( main.ONOSbench.maxNodes )
-            else:
-                main.maxNodes = 0
             wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
             wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
             wrapperFile3 = main.params[ 'DEPENDENCY' ][ 'wrapper3' ]
@@ -60,73 +55,30 @@
             main.addIntentSleep = int( main.params[ 'SLEEP' ][ 'addIntent' ] )
             main.checkTopoAttempts = int( main.params[ 'SLEEP' ][ 'topoAttempts' ] )
             main.flowDurationSleep = int( main.params[ 'SLEEP' ][ 'flowDuration' ] )
-            gitPull = main.params[ 'GIT' ][ 'pull' ]
             main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
             main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
-            main.cellData = {}  # for creating cell file
             main.hostsData = {}
-            main.RESTs = []
-            main.CLIs = []
-            main.ONOSip = []
             main.scapyHostNames = main.params[ 'SCAPY' ][ 'HOSTNAMES' ].split( ',' )
             main.scapyHosts = []  # List of scapy hosts for iterating
             main.assertReturnString = ''  # Assembled assert return string
             main.cycle = 0  # How many times FUNCintent has run through its tests
 
-            main.ONOSip = main.ONOSbench.getOnosIps()
-            print main.ONOSip
-
-            # Assigning ONOS cli handles to a list
-            try:
-                for i in range( 1, main.maxNodes + 1 ):
-                    main.RESTs.append( getattr( main, 'ONOSrest' + str( i ) ) )
-                    main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
-            except AttributeError:
-                main.log.warn( "A " + str( main.maxNodes ) + " node cluster " +
-                               "was defined in env variables, but only " +
-                               str( len( main.RESTs ) ) +
-                               " nodes were defined in the .topo file. " +
-                               "Using " + str( len( main.RESTs ) ) +
-                               " nodes for the test." )
-
             # -- INIT SECTION, ONLY RUNS ONCE -- #
-            main.startUp = imp.load_source( wrapperFile1,
-                                            main.dependencyPath +
-                                            wrapperFile1 +
-                                            ".py" )
 
             main.intentFunction = imp.load_source( wrapperFile2,
                                                    main.dependencyPath +
                                                    wrapperFile2 +
                                                    ".py" )
 
-            main.topo = imp.load_source( wrapperFile3,
-                                         main.dependencyPath +
-                                         wrapperFile3 +
-                                         ".py" )
-
             copyResult1 = main.ONOSbench.scp( main.Mininet1,
                                               main.dependencyPath +
                                               main.topology,
                                               main.Mininet1.home + "custom/",
                                               direction="to" )
-            if main.RESTs and main.CLIs:
-                stepResult = main.TRUE
-            else:
-                main.log.error( "Did not properly created list of ONOS CLI handle" )
-                stepResult = main.FALSE
+            stepResult = main.testSetUp.envSetup( True, True )
         except Exception as e:
-            main.log.exception( e )
-            main.cleanup()
-            main.exit()
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully construct " +
-                                        "test variables ",
-                                 onfail="Failed to construct test variables" )
-
-        main.ONOSbench.getVersion( report=True )
+            main.testSetUp.envSetupException(e)
+        main.testSetUp.evnSetupConclusion( stepResult )
 
     def CASE2( self, main ):
         """
@@ -140,327 +92,21 @@
         - Install ONOS cluster
         - Connect to cli
         """
-        main.cycle += 1
-
-        # main.scale[ 0 ] determines the current number of ONOS controller
-        main.numCtrls = int( main.scale[ 0 ] )
         main.flowCompiler = "Flow Rules"
-        main.initialized = main.TRUE
-
-        main.case( "Starting up " + str( main.numCtrls ) +
-                   " node(s) ONOS cluster" )
-        main.caseExplanation = "Set up ONOS with " + str( main.numCtrls ) +\
-                                " node(s) ONOS cluster"
-
-        #kill off all onos processes
-        main.log.info( "Safety check, killing all ONOS processes" +
-                       " before initiating environment setup" )
-
-        time.sleep( main.startUpSleep )
-
-        main.step( "Uninstalling ONOS package" )
-        onosUninstallResult = main.TRUE
-        for ip in main.ONOSip:
-            onosUninstallResult = onosUninstallResult and \
-                    main.ONOSbench.onosUninstall( nodeIp=ip )
-        stepResult = onosUninstallResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully uninstalled ONOS package",
-                                 onfail="Failed to uninstall ONOS package" )
-
-        time.sleep( main.startUpSleep )
-
-        for i in range( main.maxNodes ):
-            main.ONOSbench.onosDie( main.ONOSip[ i ] )
-
-        print "NODE COUNT = ", main.numCtrls
-
-        tempOnosIp = []
-        for i in range( main.numCtrls ):
-            tempOnosIp.append( main.ONOSip[ i ] )
-
-        main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
-                                       "temp", main.Mininet1.ip_address,
-                                       main.apps, tempOnosIp, main.ONOScli1.karafUser )
-
-        main.step( "Apply cell to environment" )
-        cellResult = main.ONOSbench.setCell( "temp" )
-        verifyResult = main.ONOSbench.verifyCell()
-        stepResult = cellResult and verifyResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully applied cell to " +
-                                        "environment",
-                                 onfail="Failed to apply cell to environment " )
-
-        main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.buckBuild()
-        stepResult = packageResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully created ONOS package",
-                                 onfail="Failed to create ONOS package" )
-
-        time.sleep( main.startUpSleep )
-        main.step( "Installing ONOS package" )
-        onosInstallResult = main.TRUE
-        for i in range( main.numCtrls ):
-            onosInstallResult = onosInstallResult and \
-                    main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
-        stepResult = onosInstallResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully installed ONOS package",
-                                 onfail="Failed to install ONOS package" )
-
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[ i ] )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
-        time.sleep( main.startUpSleep )
-        main.step( "Starting ONOS service" )
-        stopResult = main.TRUE
-        startResult = main.TRUE
-        onosIsUp = main.TRUE
-
-        for i in range( main.numCtrls ):
-            onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
-            if onosIsUp == main.TRUE:
-                main.log.report( "ONOS instance {0} is up and ready".format( i + 1 ) )
-            else:
-                main.log.report( "ONOS instance {0} may not be up, stop and ".format( i + 1 ) +
-                                 "start ONOS again " )
-                stopResult = stopResult and main.ONOSbench.onosStop( main.ONOSip[ i ] )
-                startResult = startResult and main.ONOSbench.onosStart( main.ONOSip[ i ] )
-                if not startResult or stopResult:
-                    main.log.report( "ONOS instance {0} did not start correctly.".format( i + 1 ) )
-        stepResult = onosIsUp and stopResult and startResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="ONOS service is ready",
-                                 onfail="ONOS service did not start properly" )
-        if not stepResult:
-            main.initialized = main.FALSE
-
-        # Start an ONOS cli to provide functionality that is not currently
-        # supported by the Rest API remove this when Leader Checking is supported
-        # by the REST API
-
-        main.step( "Start ONOS cli" )
-        cliResult = main.TRUE
-        for i in range( main.numCtrls ):
-            cliResult = cliResult and \
-                        main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
-        stepResult = cliResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully start ONOS cli",
-                                 onfail="Failed to start ONOS cli" )
-        if not stepResult:
-            main.initialized = main.FALSE
-
-        # Remove the first element in main.scale list
-        main.scale.remove( main.scale[ 0 ] )
-
+        main.initialized = main.testSetUp.ONOSSetUp( main.Mininet1, True )
         main.intentFunction.report( main )
 
     def CASE8( self, main ):
-        # OLD FUNCintentRest CASE 8
-        # This remains here for archiving and reference purposes and will be
-        # removed when the new FUNCintentRest is verified to work.
-        # """
-        # Compare Topo
-        # """
-        # import json
-
-        # main.case( "Compare ONOS Topology view to Mininet topology" )
-        # main.caseExplanation = "Compare topology elements between Mininet" +\
-        #                         " and ONOS"
-
-        # main.step( "Gathering topology information" )
-        # # TODO: add a paramaterized sleep here
-        # devicesResults = main.TRUE  # Overall Boolean for device correctness
-        # linksResults = main.TRUE  # Overall Boolean for link correctness
-        # hostsResults = main.TRUE  # Overall Boolean for host correctness
-        # devices = main.topo.getAllDevices( main )
-        # hosts = main.topo.getAllHosts( main )
-        # ports = main.topo.getAllPorts( main )
-        # links = main.topo.getAllLinks( main )
-        # clusters = main.topo.getAllClusters( main )
-
-        # mnSwitches = main.Mininet1.getSwitches()
-        # mnLinks = main.Mininet1.getLinks()
-        # mnHosts = main.Mininet1.getHosts()
-
-        # main.step( "Comparing MN topology to ONOS topology" )
-        # for controller in range( main.numCtrls ):
-        #     controllerStr = str( controller + 1 )
-        #     if devices[ controller ] and ports[ controller ] and\
-        #         "Error" not in devices[ controller ] and\
-        #         "Error" not in ports[ controller ]:
-
-        #         currentDevicesResult = main.Mininet1.compareSwitches(
-        #                 mnSwitches,
-        #                 json.loads( devices[ controller ] ),
-        #                 json.loads( ports[ controller ] ) )
-        #     else:
-        #         currentDevicesResult = main.FALSE
-        #     utilities.assert_equals( expect=main.TRUE,
-        #                              actual=currentDevicesResult,
-        #                              onpass="ONOS" + controllerStr +
-        #                              " Switches view is correct",
-        #                              onfail="ONOS" + controllerStr +
-        #                              " Switches view is incorrect" )
-
-        #     if links[ controller ] and "Error" not in links[ controller ]:
-        #         currentLinksResult = main.Mininet1.compareLinks(
-        #                 mnSwitches, mnLinks,
-        #                 json.loads( links[ controller ] ) )
-        #     else:
-        #         currentLinksResult = main.FALSE
-        #     utilities.assert_equals( expect=main.TRUE,
-        #                              actual=currentLinksResult,
-        #                              onpass="ONOS" + controllerStr +
-        #                              " links view is correct",
-        #                              onfail="ONOS" + controllerStr +
-        #                              " links view is incorrect" )
-
-        #     if hosts[ controller ] or "Error" not in hosts[ controller ]:
-        #         currentHostsResult = main.Mininet1.compareHosts(
-        #                 mnHosts,
-        #                 json.loads( hosts[ controller ] ) )
-        #     else:
-        #         currentHostsResult = main.FALSE
-        #     utilities.assert_equals( expect=main.TRUE,
-        #                              actual=currentHostsResult,
-        #                              onpass="ONOS" + controllerStr +
-        #                              " hosts exist in Mininet",
-        #                              onfail="ONOS" + controllerStr +
-        #                              " hosts don't match Mininet" )
-
-        # NEW FUNCintentRest Case 8 as based off of the CASE 8 from FUNCintent
-        """
-        Compare ONOS Topology to Mininet Topology
-        """
-        import json
-
-        main.case( "Compare ONOS Topology view to Mininet topology" )
-        main.caseExplanation = "Compare topology elements between Mininet" +\
-                                " and ONOS"
-
-        main.log.info( "Gathering topology information from Mininet" )
-        devicesResults = main.FALSE  # Overall Boolean for device correctness
-        linksResults = main.FALSE  # Overall Boolean for link correctness
-        hostsResults = main.FALSE  # Overall Boolean for host correctness
-        deviceFails = []  # Nodes where devices are incorrect
-        linkFails = []  # Nodes where links are incorrect
-        hostFails = []  # Nodes where hosts are incorrect
-        attempts = main.checkTopoAttempts  # Remaining Attempts
-
-        mnSwitches = main.Mininet1.getSwitches()
-        mnLinks = main.Mininet1.getLinks()
-        mnHosts = main.Mininet1.getHosts()
-
-        main.step( "Comparing Mininet topology to ONOS topology" )
-
-        while ( attempts >= 0 ) and\
-                ( not devicesResults or not linksResults or not hostsResults ):
-            time.sleep( 2 )
-            if not devicesResults:
-                devices = main.topo.getAllDevices( main )
-                ports = main.topo.getAllPorts( main )
-                devicesResults = main.TRUE
-                deviceFails = []  # Reset for each failed attempt
-            if not linksResults:
-                links = main.topo.getAllLinks( main )
-                linksResults = main.TRUE
-                linkFails = []  # Reset for each failed attempt
-            if not hostsResults:
-                hosts = main.topo.getAllHosts( main )
-                hostsResults = main.TRUE
-                hostFails = []  # Reset for each failed attempt
-
-            #  Check for matching topology on each node
-            for controller in range( main.numCtrls ):
-                controllerStr = str( controller + 1 )  # ONOS node number
-                # Compare Devices
-                if devices[ controller ] and ports[ controller ] and\
-                        "Error" not in devices[ controller ] and\
-                        "Error" not in ports[ controller ]:
-
-                    try:
-                        deviceData = json.loads( devices[ controller ] )
-                        portData = json.loads( ports[ controller ] )
-                    except ( TypeError, ValueError ):
-                        main.log.error( "Could not load json: {0} or {1}".format( str( devices[ controller ] ),
-                                                                                  str( ports[ controller ] ) ) )
-                        currentDevicesResult = main.FALSE
-                    else:
-                        currentDevicesResult = main.Mininet1.compareSwitches(
-                            mnSwitches, deviceData, portData )
-                else:
-                    currentDevicesResult = main.FALSE
-                if not currentDevicesResult:
-                    deviceFails.append( controllerStr )
-                devicesResults = devicesResults and currentDevicesResult
-                # Compare Links
-                if links[ controller ] and "Error" not in links[ controller ]:
-                    try:
-                        linkData = json.loads( links[ controller ] )
-                    except ( TypeError, ValueError ):
-                        main.log.error( "Could not load json:" + str( links[ controller ] ) )
-                        currentLinksResult = main.FALSE
-                    else:
-                        currentLinksResult = main.Mininet1.compareLinks(
-                            mnSwitches, mnLinks, linkData )
-                else:
-                    currentLinksResult = main.FALSE
-                if not currentLinksResult:
-                    linkFails.append( controllerStr )
-                linksResults = linksResults and currentLinksResult
-                # Compare Hosts
-                if hosts[ controller ] and "Error" not in hosts[ controller ]:
-                    try:
-                        hostData = json.loads( hosts[ controller ] )
-                    except ( TypeError, ValueError ):
-                        main.log.error( "Could not load json:" + str( hosts[ controller ] ) )
-                        currentHostsResult = main.FALSE
-                    else:
-                        currentHostsResult = main.Mininet1.compareHosts(
-                                mnHosts, hostData )
-                else:
-                    currentHostsResult = main.FALSE
-                if not currentHostsResult:
-                    hostFails.append( controllerStr )
-                hostsResults = hostsResults and currentHostsResult
-            # Decrement Attempts Remaining
-            attempts -= 1
-
-        utilities.assert_equals( expect=[],
-                                 actual=deviceFails,
-                                 onpass="ONOS correctly discovered all devices",
-                                 onfail="ONOS incorrectly discovered devices on nodes: " +
-                                 str( deviceFails ) )
-        utilities.assert_equals( expect=[],
-                                 actual=linkFails,
-                                 onpass="ONOS correctly discovered all links",
-                                 onfail="ONOS incorrectly discovered links on nodes: " +
-                                 str( linkFails ) )
-        utilities.assert_equals( expect=[],
-                                 actual=hostFails,
-                                 onpass="ONOS correctly discovered all hosts",
-                                 onfail="ONOS incorrectly discovered hosts on nodes: " +
-                                 str( hostFails ) )
-        topoResults = hostsResults and linksResults and devicesResults
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=topoResults,
-                                 onpass="ONOS correctly discovered the topology",
-                                 onfail="ONOS incorrectly discovered the topology" )
+        try:
+            from tests.dependencies.topology import Topology
+        except ImportError:
+            main.log.error( "Topology not found exiting the test" )
+            main.exit()
+        try:
+            main.topoRelated
+        except ( NameError, AttributeError ):
+            main.topoRelated = Topology()
+        main.topoRelated.compareTopos( main.Mininet1, main.checkTopoAttempts )
 
     def CASE9( self, main ):
         """
@@ -643,7 +289,7 @@
             main.initialized = main.FALSE
 
     def CASE15( self, main ):
-        """
+        """main.topo.
             Discover all hosts with scapy arp packets and store its data to a dictionary
         """
         if main.initialized == main.FALSE:
@@ -733,6 +379,15 @@
         """
             Stop mininet and remove scapy hosts
         """
+        try:
+            from tests.dependencies.utils import Utils
+        except ImportError:
+            main.log.error( "Utils not found exiting the test" )
+            main.exit()
+        try:
+            main.Utils
+        except ( NameError, AttributeError ):
+            main.Utils = Utils()
         main.log.report( "Stop Mininet and Scapy" )
         main.case( "Stop Mininet and Scapy" )
         main.caseExplanation = "Stopping the current mininet topology " +\
@@ -756,13 +411,7 @@
                                  onpass="Successfully stopped scapy and removed host components",
                                  onfail="Failed to stop mininet and scapy" )
 
-        main.step( "Stopping Mininet Topology" )
-        mininetResult = main.Mininet1.stopNet()
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully stop mininet",
-                                 onfail="Failed to stop mininet" )
+        mininetResult = main.Utils.mininetCleanup( main.Mininet1 )
         # Exit if topology did not load properly
         if not ( mininetResult and scapyResult ):
             main.cleanup()
@@ -772,34 +421,16 @@
         """
             Copy the karaf.log files after each testcase cycle
         """
-        main.log.report( "Copy karaf logs" )
-        main.case( "Copy karaf logs" )
-        main.caseExplanation = "Copying the karaf logs to preserve them through" +\
-                               "reinstalling ONOS"
-        main.step( "Copying karaf logs" )
-        stepResult = main.TRUE
-        scpResult = main.TRUE
-        copyResult = main.TRUE
-        for i in range( main.numCtrls ):
-            main.node = main.CLIs[ i ]
-            ip = main.ONOSip[ i ]
-            main.node.ip_address = ip
-            scpResult = scpResult and main.ONOSbench.scp( main.node,
-                                                          "/opt/onos/log/karaf.log",
-                                                          "/tmp/karaf.log",
-                                                          direction="from" )
-            copyResult = copyResult and main.ONOSbench.cpLogsToDir( "/tmp/karaf.log", main.logdir,
-                                                                    copyFileName=( "karaf.log.node{0}.cycle{1}".format(
-                                                                        str( i + 1 ), str( main.cycle ) ) ) )
-            if scpResult and copyResult:
-                stepResult = main.TRUE and stepResult
-            else:
-                stepResult = main.FALSE and stepResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully copied remote ONOS logs",
-                                 onfail="Failed to copy remote ONOS logs" )
-
+        try:
+            from tests.dependencies.utils import Utils
+        except ImportError:
+            main.log.error( "Utils not found exiting the test" )
+            main.exit()
+        try:
+            main.Utils
+        except ( NameError, AttributeError ):
+            main.Utils = Utils()
+        main.Utils.copyKarafLog()
     def CASE1000( self, main ):
         """
             Add host intents between 2 host:
diff --git a/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
index 38861b6..b99fb42 100644
--- a/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintentRest/dependencies/FuncIntentFunction.py
@@ -1490,7 +1490,16 @@
     """
     import collections
     scapyHostCount = len( main.scapyHosts )
-    hosts = main.topo.getAllHosts( main )  # Get host data from each ONOS node
+    try:
+        from tests.dependencies.topology import Topology
+    except Exception:
+        main.log.error( "Topology not found exiting the test" )
+        main.exit()
+    try:
+        main.topoRelated
+    except ( NameError, AttributeError ):
+        main.topoRelated = Topology()
+    hosts = main.topoRelated.getAllHosts( main.numCtrls, False )  # Get host data from each ONOS node
     hostFails = []  # Reset for each failed attempt
 
     #  Check for matching hosts on each node
diff --git a/TestON/tests/FUNC/FUNCintentRest/dependencies/startUp.py b/TestON/tests/FUNC/FUNCintentRest/dependencies/startUp.py
deleted file mode 100644
index ad92fb9..0000000
--- a/TestON/tests/FUNC/FUNCintentRest/dependencies/startUp.py
+++ /dev/null
@@ -1,33 +0,0 @@
-"""
-    This wrapper function is use for starting up onos instance
-"""
-import time
-import os
-import json
-
-
-def onosBuild( main, gitBranch ):
-    """
-        This includes pulling ONOS and building it using maven install
-    """
-    buildResult = main.FALSE
-
-    # Git checkout a branch of ONOS
-    checkOutResult = main.ONOSbench.gitCheckout( gitBranch )
-    # Does the git pull on the branch that was checked out
-    if not checkOutResult:
-        main.log.warn( "Failed to checked out " + gitBranch +
-                                           " branch" )
-    else:
-        main.log.info( "Successfully checked out " + gitBranch +
-                                           " branch" )
-    gitPullResult = main.ONOSbench.gitPull()
-    if gitPullResult == main.ERROR:
-        main.log.error( "Error pulling git branch" )
-    else:
-        main.log.info( "Successfully pulled " + gitBranch + " branch" )
-
-    # buck Build
-    buildResult = main.ONOSbench.buckBuild()
-
-    return buildResult
diff --git a/TestON/tests/FUNC/FUNCintentRest/dependencies/topo.py b/TestON/tests/FUNC/FUNCintentRest/dependencies/topo.py
deleted file mode 100644
index 7217d4d..0000000
--- a/TestON/tests/FUNC/FUNCintentRest/dependencies/topo.py
+++ /dev/null
@@ -1,102 +0,0 @@
-"""
-    These functions can be used for topology comparisons
-"""
-import time
-import os
-import json
-
-
-def getAllDevices( main ):
-    """
-        Return a list containing the devices output from each ONOS node
-    """
-    devices = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].devices,
-                         name="devices-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        devices.append( t.result )
-    return devices
-
-
-def getAllHosts( main ):
-    """
-        Return a list containing the hosts output from each ONOS node
-    """
-    hosts = []
-    ipResult = main.TRUE
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].hosts,
-                         name="hosts-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        hosts.append( t.result )
-    return hosts
-
-
-def getAllPorts( main ):
-    """
-        Return a list containing the ports output from each ONOS node
-    """
-    ports = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].ports,
-                         name="ports-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        ports.append( t.result )
-    return ports
-
-
-def getAllLinks( main ):
-    """
-        Return a list containing the links output from each ONOS node
-    """
-    links = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].links,
-                         name="links-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        links.append( t.result )
-    return links
-
-
-def getAllClusters( main ):
-    """
-        Return a list containing the clusters output from each ONOS node
-    """
-    clusters = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].clusters,
-                         name="clusters-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        clusters.append( t.result )
-    return clusters
diff --git a/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.py b/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.py
index 148f52d..2e933db 100644
--- a/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.py
+++ b/TestON/tests/FUNC/FUNCipv6Intent/FUNCipv6Intent.py
@@ -9,7 +9,6 @@
     def CASE1( self, main ):
         import imp
         import re
-
         """
         - Construct tests variables
         - GIT ( optional )
@@ -19,25 +18,21 @@
             - Install ONOS package
             - Build ONOS package
         """
-        main.case( "Constructing test variables and building ONOS package" )
-        main.step( "Constructing test variables" )
-        main.caseExplanation = "This test case is mainly for loading " +\
-                               "from params file, and pull and build the " +\
-                               " latest ONOS package"
+        try:
+            from tests.dependencies.ONOSSetup import ONOSSetup
+            main.testSetUp = ONOSSetup()
+        except ImportError:
+            main.log.error( "ONOSSetup not found. exiting the test" )
+            main.exit()
+        main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
         # Test variables
         try:
-            main.testOnDirectory = re.sub( "(/tests)$", "", main.testDir )
             main.apps = main.params[ 'ENV' ][ 'cellApps' ]
-            gitBranch = main.params[ 'GIT' ][ 'branch' ]
             main.dependencyPath = main.testOnDirectory + \
                                   main.params[ 'DEPENDENCY' ][ 'path' ]
             main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
             main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
-            if main.ONOSbench.maxNodes:
-                main.maxNodes = int( main.ONOSbench.maxNodes )
-            else:
-                main.maxNodes = 0
             wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
             wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
             wrapperFile3 = main.params[ 'DEPENDENCY' ][ 'wrapper3' ]
@@ -47,60 +42,27 @@
             main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] )
             main.fwdSleep = int( main.params[ 'SLEEP' ][ 'fwd' ] )
             main.checkTopoAttempts = int( main.params[ 'SLEEP' ][ 'topoAttempts' ] )
-            gitPull = main.params[ 'GIT' ][ 'pull' ]
             main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
             main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
-            main.cellData = {}  # for creating cell file
             main.hostsData = {}
-            main.CLIs = []
-            main.ONOSip = []
             main.assertReturnString = ''  # Assembled assert return string
 
-            main.ONOSip = main.ONOSbench.getOnosIps()
-            print main.ONOSip
-
-            # Assigning ONOS cli handles to a list
-            for i in range( 1, main.maxNodes + 1 ):
-                main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
-
             # -- INIT SECTION, ONLY RUNS ONCE -- #
-            main.startUp = imp.load_source( wrapperFile1,
-                                            main.dependencyPath +
-                                            wrapperFile1 +
-                                            ".py" )
 
             main.intentFunction = imp.load_source( wrapperFile2,
                                                    main.dependencyPath +
                                                    wrapperFile2 +
                                                    ".py" )
 
-            main.topo = imp.load_source( wrapperFile3,
-                                         main.dependencyPath +
-                                         wrapperFile3 +
-                                         ".py" )
-
             copyResult1 = main.ONOSbench.scp( main.Mininet1,
                                               main.dependencyPath +
                                               main.topology,
                                               main.Mininet1.home,
                                               direction="to" )
-            if main.CLIs:
-                stepResult = main.TRUE
-            else:
-                main.log.error( "Did not properly created list of ONOS CLI handle" )
-                stepResult = main.FALSE
+            stepResult = main.testSetUp.envSetup( True )
         except Exception as e:
-            main.log.exception( e )
-            main.cleanup()
-            main.exit()
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully construct " +
-                                        "test variables ",
-                                 onfail="Failed to construct test variables" )
-
-        main.ONOSbench.getVersion( report=True )
+            main.testSetUp.envSetupException( e )
+        main.testSetUp.evnSetupConclusion( stepResult )
 
     def CASE2( self, main ):
         """
@@ -115,122 +77,13 @@
         - Connect to cli
         """
         import time
-        # main.scale[ 0 ] determines the current number of ONOS controller
-        main.numCtrls = int( main.scale[ 0 ] )
 
-        main.case( "Starting up " + str( main.numCtrls ) +
-                   " node(s) ONOS cluster" )
-        main.caseExplanation = "Set up ONOS with " + str( main.numCtrls ) +\
-                                " node(s) ONOS cluster"
-
-        #kill off all onos processes
-        main.log.info( "Safety check, killing all ONOS processes" +
-                       " before initiating environment setup" )
-
-        for i in range( main.maxNodes ):
-            main.ONOSbench.onosDie( main.ONOSip[ i ] )
-
-        print "NODE COUNT = ", main.numCtrls
-
-        tempOnosIp = []
-        for i in range( main.numCtrls ):
-            tempOnosIp.append( main.ONOSip[ i ] )
-
-        main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
-                                       "temp", main.Mininet1.ip_address,
-                                       main.apps, tempOnosIp, main.ONOScli1.karafUser )
-
-        main.step( "Apply cell to environment" )
-        cellResult = main.ONOSbench.setCell( "temp" )
-        verifyResult = main.ONOSbench.verifyCell()
-        stepResult = cellResult and verifyResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully applied cell to " +
-                                        "environment",
-                                 onfail="Failed to apply cell to environment " )
-
-        main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.buckBuild()
-        stepResult = packageResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully created ONOS package",
-                                 onfail="Failed to create ONOS package" )
-
-        time.sleep( main.startUpSleep )
-        main.step( "Uninstalling ONOS package" )
-        onosUninstallResult = main.TRUE
-        for ip in main.ONOSip:
-            onosUninstallResult = onosUninstallResult and \
-                    main.ONOSbench.onosUninstall( nodeIp=ip )
-        stepResult = onosUninstallResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully uninstalled ONOS package",
-                                 onfail="Failed to uninstall ONOS package" )
-
-        time.sleep( main.startUpSleep )
-        main.step( "Installing ONOS package" )
-        onosInstallResult = main.TRUE
-        for i in range( main.numCtrls ):
-            onosInstallResult = onosInstallResult and \
-                    main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
-        stepResult = onosInstallResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully installed ONOS package",
-                                 onfail="Failed to install ONOS package" )
-
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[ i ] )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
-        time.sleep( main.startUpSleep )
-        main.step( "Starting ONOS service" )
-        stopResult = main.TRUE
-        startResult = main.TRUE
-        onosIsUp = main.TRUE
-
-        for i in range( main.numCtrls ):
-            onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
-        if onosIsUp == main.TRUE:
-            main.log.report( "ONOS instance is up and ready" )
-        else:
-            main.log.report( "ONOS instance may not be up, stop and " +
-                             "start ONOS again " )
-
-            for i in range( main.numCtrls ):
-                stopResult = stopResult and \
-                        main.ONOSbench.onosStop( main.ONOSip[ i ] )
-            for i in range( main.numCtrls ):
-                startResult = startResult and \
-                        main.ONOSbench.onosStart( main.ONOSip[ i ] )
-        stepResult = onosIsUp and stopResult and startResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="ONOS service is ready",
-                                 onfail="ONOS service did not start properly" )
-
-        main.step( "Start ONOS cli" )
-        cliResult = main.TRUE
-        for i in range( main.numCtrls ):
-            cliResult = cliResult and \
-                        main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
-        stepResult = cliResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully start ONOS cli",
-                                 onfail="Failed to start ONOS cli" )
+        main.initialized = main.testSetUp.ONOSSetUp( main.Mininet1, True )
 
         main.step( "Checking that ONOS is ready" )
         for i in range( 3 ):
             ready = True
-            for i in range( int( main.scale[ 0 ] ) ):
+            for i in range ( main.numCtrls ):
                 output = main.CLIs[ i ].summary()
                 if not output:
                     ready = False
@@ -250,9 +103,6 @@
                                  onpass="ipv6NeighborDiscovery cfg is set to true",
                                  onfail="Failed to cfg set ipv6NeighborDiscovery" )
 
-        # Remove the first element in main.scale list
-        main.scale.remove( main.scale[ 0 ] )
-
         main.intentFunction.report( main )
 
     def CASE11( self, main ):
@@ -357,18 +207,17 @@
         """
             Stop mininet
         """
-        main.log.report( "Stop Mininet topology" )
-        main.case( "Stop Mininet topology" )
-        main.caseExplanation = "Stopping the current mininet topology " +\
-                                "to start up fresh"
-
-        main.step( "Stopping Mininet Topology" )
-        topoResult = main.Mininet1.stopNet()
-        stepResult = topoResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully stop mininet",
-                                 onfail="Failed to stop mininet" )
+        try:
+            from tests.dependencies.utils import Utils
+        except ImportError:
+            main.log.error( "Utils not found exiting the test" )
+            main.exit()
+        try:
+            main.Utils
+        except ( NameError, AttributeError ):
+            main.Utils = Utils()
+        main.Utils.mininetCleanIntro()
+        topoResult = main.Utils.mininetCleanup( main.Mininet1 )
         # Exit if topology did not load properly
         if not topoResult:
             main.cleanup()
diff --git a/TestON/tests/FUNC/FUNCipv6Intent/dependencies/startUp.py b/TestON/tests/FUNC/FUNCipv6Intent/dependencies/startUp.py
deleted file mode 100644
index a9becf9..0000000
--- a/TestON/tests/FUNC/FUNCipv6Intent/dependencies/startUp.py
+++ /dev/null
@@ -1,33 +0,0 @@
-"""
-    This wrapper function is use for starting up onos instance
-"""
-import time
-import os
-import json
-
-
-def onosBuild( main, gitBranch ):
-    """
-        This includes pulling ONOS and building it using maven install
-    """
-    buildResult = main.FALSE
-
-    # Git checkout a branch of ONOS
-    checkOutResult = main.ONOSbench.gitCheckout( gitBranch )
-    # Does the git pull on the branch that was checked out
-    if not checkOutResult:
-        main.log.warn( "Failed to checked out " + gitBranch +
-                                           " branch" )
-    else:
-        main.log.info( "Successfully checked out " + gitBranch +
-                                           " branch" )
-    gitPullResult = main.ONOSbench.gitPull()
-    if gitPullResult == main.ERROR:
-        main.log.error( "Error pulling git branch" )
-    else:
-        main.log.info( "Successfully pulled " + gitBranch + " branch" )
-
-    # buck build
-    buildResult = main.ONOSbench.buckBuild()
-
-    return buildResult
diff --git a/TestON/tests/FUNC/FUNCipv6Intent/dependencies/topo.py b/TestON/tests/FUNC/FUNCipv6Intent/dependencies/topo.py
deleted file mode 100644
index 7217d4d..0000000
--- a/TestON/tests/FUNC/FUNCipv6Intent/dependencies/topo.py
+++ /dev/null
@@ -1,102 +0,0 @@
-"""
-    These functions can be used for topology comparisons
-"""
-import time
-import os
-import json
-
-
-def getAllDevices( main ):
-    """
-        Return a list containing the devices output from each ONOS node
-    """
-    devices = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].devices,
-                         name="devices-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        devices.append( t.result )
-    return devices
-
-
-def getAllHosts( main ):
-    """
-        Return a list containing the hosts output from each ONOS node
-    """
-    hosts = []
-    ipResult = main.TRUE
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].hosts,
-                         name="hosts-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        hosts.append( t.result )
-    return hosts
-
-
-def getAllPorts( main ):
-    """
-        Return a list containing the ports output from each ONOS node
-    """
-    ports = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].ports,
-                         name="ports-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        ports.append( t.result )
-    return ports
-
-
-def getAllLinks( main ):
-    """
-        Return a list containing the links output from each ONOS node
-    """
-    links = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].links,
-                         name="links-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        links.append( t.result )
-    return links
-
-
-def getAllClusters( main ):
-    """
-        Return a list containing the clusters output from each ONOS node
-    """
-    clusters = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].clusters,
-                         name="clusters-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        clusters.append( t.result )
-    return clusters
diff --git a/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.py b/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.py
index 4895b3b..65a5477 100644
--- a/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.py
+++ b/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.py
@@ -10,93 +10,47 @@
     def CASE1( self, main ):
         import imp
         import re
-
         """
         - Construct tests variables
         - GIT ( optional )
             - Checkout ONOS master branch
             - Pull latest ONOS code
         """
-        main.case( "Constructing test variables and building ONOS package" )
-        main.step( "Constructing test variables" )
-        main.caseExplanation = "This test case is mainly for loading " +\
-                               "from params file, and pull and build the " +\
-                               " latest ONOS package"
+
+        try:
+            from tests.dependencies.ONOSSetup import ONOSSetup
+            main.testSetUp = ONOSSetup()
+        except ImportError:
+            main.log.error( "ONOSSetup not found. exiting the test" )
+            main.exit()
+        main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
 
         # Test variables
         try:
-            main.testOnDirectory = re.sub( "(/tests)$", "", main.testDir )
             main.apps = main.params[ 'ENV' ][ 'cellApps' ]
-            gitBranch = main.params[ 'GIT' ][ 'branch' ]
             main.dependencyPath = main.testOnDirectory + \
                                   main.params[ 'DEPENDENCY' ][ 'path' ]
-            if main.ONOSbench.maxNodes:
-                main.maxNodes = int( main.ONOSbench.maxNodes )
-            else:
-                main.maxNodes = 0
             wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
             wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
             wrapperFile3 = main.params[ 'DEPENDENCY' ][ 'wrapper3' ]
             main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
             main.gossipTime = int( main.params[ 'SLEEP' ][ 'cfgGossip' ] )
             main.SetNetCfgSleep = int( main.params[ 'SLEEP' ][ 'SetNetCfgSleep' ] )
-            gitPull = main.params[ 'GIT' ][ 'pull' ]
-            main.cellData = {}  # for creating cell file
             main.hostsData = {}
-            main.nodes = []
-            main.ONOSip = []
             main.retrytimes = int( main.params[ 'RETRY' ] )
             main.retrysleep = int( main.params[ 'RetrySleep' ] )
-            main.ONOSip = main.ONOSbench.getOnosIps()
-
-            # Assigning ONOS cli handles to a list
-            try:
-                for i in range( 1, main.maxNodes + 1 ):
-                    main.nodes.append( getattr( main, 'ONOSrest' + str( i ) ) )
-            except AttributeError:
-                main.log.warn( "A " + str( main.maxNodes ) + " node cluster " +
-                               "was defined in env variables, but only " +
-                               str( len( main.nodes ) ) +
-                               " nodes were defined in the .topo file. " +
-                               "Using " + str( len( main.nodes ) ) +
-                               " nodes for the test." )
-
-            main.numCtrls = len( main.nodes )
 
             # -- INIT SECTION, SHOULD ONLY BE RUN ONCE -- #
-            main.startUp = imp.load_source( wrapperFile1,
-                                            main.dependencyPath +
-                                            wrapperFile1 +
-                                            ".py" )
-
             main.netCfg = imp.load_source( wrapperFile2,
                                            main.dependencyPath +
                                            wrapperFile2 +
                                            ".py" )
 
-            main.topo = imp.load_source( wrapperFile3,
-                                         main.dependencyPath +
-                                         wrapperFile3 +
-                                         ".py" )
-
-            if main.nodes:
-                stepResult = main.TRUE
-            else:
-                main.log.error( "Did not properly created list of ONOS handle" )
-                stepResult = main.FALSE
+            stepResult = main.testSetUp.envSetup( hasRest=True, hasCli=False )
         except Exception as e:
-            main.log.exception( e )
-            main.cleanup()
-            main.exit()
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully construct " +
-                                        "test variables ",
-                                 onfail="Failed to construct test variables" )
-
-        main.ONOSbench.getVersion( report=True )
+            main.testSetUp.envSetupException( e )
+        main.testSetUp.evnSetupConclusion( stepResult )
 
     def CASE2( self, main ):
         """
@@ -111,170 +65,22 @@
         - Connect to cli
         """
         import time
-        main.case( "Starting up " + str( main.numCtrls ) +
-                   " node(s) ONOS cluster" )
-        main.caseExplanation = "Set up ONOS with " + str( main.numCtrls ) +\
-                                " node(s) ONOS cluster"
-
-        # kill off all onos processes
-        main.log.info( "Safety check, killing all ONOS processes" +
-                       " before initiating environment setup" )
-
-        for i in range( main.maxNodes ):
-            main.ONOSbench.onosStop( main.ONOSip[ i ] )
-            main.ONOSbench.onosDie( main.ONOSip[ i ] )
-
-        tempOnosIp = []
-        for i in range( main.numCtrls ):
-            tempOnosIp.append( main.ONOSip[ i ] )
-
-        main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
-                                       "temp", main.Mininet1.ip_address,
-                                       main.apps, tempOnosIp, main.ONOScli1.karafUser )
-
-        main.step( "Apply cell to environment" )
-        cellResult = main.ONOSbench.setCell( "temp" )
-        verifyResult = main.ONOSbench.verifyCell()
-        stepResult = cellResult and verifyResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully applied cell to environment",
-                                 onfail="Failed to apply cell to environment " )
-
-        main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.buckBuild()
-        stepResult = packageResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully created ONOS package",
-                                 onfail="Failed to create ONOS package" )
-
-        main.step( "Uninstalling ONOS package" )
-        onosUninstallResult = main.TRUE
-        for ip in main.ONOSip:
-            onosUninstallResult = onosUninstallResult and \
-                    main.ONOSbench.onosUninstall( nodeIp=ip )
-        stepResult = onosUninstallResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully uninstalled ONOS package",
-                                 onfail="Failed to uninstall ONOS package" )
-
-        time.sleep( main.startUpSleep )
-        main.step( "Installing ONOS package" )
-        onosInstallResult = main.TRUE
-        for i in range( main.numCtrls ):
-            onosInstallResult = onosInstallResult and \
-                    main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
-        stepResult = onosInstallResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully installed ONOS package",
-                                 onfail="Failed to install ONOS package" )
-
-        time.sleep( main.startUpSleep )
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[ i ] )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
-        time.sleep( main.startUpSleep )
-        main.step( "Starting ONOS service" )
-        stopResult = main.TRUE
-        startResult = main.TRUE
-        onosIsUp = main.TRUE
-
-        for i in range( main.numCtrls ):
-            isUp = main.ONOSbench.isup( main.ONOSip[ i ] )
-            onosIsUp = onosIsUp and isUp
-            if isUp == main.TRUE:
-                main.log.report( "ONOS instance {0} is up and ready".format( i + 1 ) )
-            else:
-                main.log.report( "ONOS instance {0} may not be up, stop and ".format( i + 1 ) +
-                                 "start ONOS again " )
-                stopResult = stopResult and \
-                        main.ONOSbench.onosStop( main.ONOSip[ i ] )
-                startResult = startResult and \
-                        main.ONOSbench.onosStart( main.ONOSip[ i ] )
-            stepResult = onosIsUp and stopResult and startResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="ONOS service is ready",
-                                 onfail="ONOS service did not start properly" )
+        main.testSetUp.ONOSSetUp( main.Mininet1, hasCli=False )
 
     def CASE8( self, main ):
         """
         Compare Topo
         """
-        import json
-
-        main.case( "Compare ONOS Topology view to Mininet topology" )
-        main.caseExplanation = "Compare topology elements between Mininet" +\
-                                " and ONOS"
-
-        main.step( "Gathering topology information" )
-        # TODO: add a parameterized sleep here
-        devicesResults = main.TRUE
-        linksResults = main.TRUE
-        hostsResults = main.TRUE
-        devices = main.topo.getAllDevices( main )
-        hosts = main.topo.getAllHosts( main )
-        ports = main.topo.getAllPorts( main )
-        links = main.topo.getAllLinks( main )
-        clusters = main.topo.getAllClusters( main )
-
-        mnSwitches = main.Mininet1.getSwitches()
-        mnLinks = main.Mininet1.getLinks()
-        mnHosts = main.Mininet1.getHosts()
-
-        main.step( "Comparing MN topology to ONOS topology" )
-        for controller in range( main.numCtrls ):
-            controllerStr = str( controller + 1 )
-            if devices[ controller ] and ports[ controller ] and\
-               "Error" not in devices[ controller ] and\
-               "Error" not in ports[ controller ]:
-
-                currentDevicesResult = main.Mininet1.compareSwitches(
-                        mnSwitches,
-                        json.loads( devices[ controller ] ),
-                        json.loads( ports[ controller ] ) )
-            else:
-                currentDevicesResult = main.FALSE
-            utilities.assert_equals( expect=main.TRUE,
-                                     actual=currentDevicesResult,
-                                     onpass="ONOS" + controllerStr +
-                                     " Switches view is correct",
-                                     onfail="ONOS" + controllerStr +
-                                     " Switches view is incorrect" )
-
-            if links[ controller ] and "Error" not in links[ controller ]:
-                currentLinksResult = main.Mininet1.compareLinks(
-                        mnSwitches, mnLinks,
-                        json.loads( links[ controller ] ) )
-            else:
-                currentLinksResult = main.FALSE
-            utilities.assert_equals( expect=main.TRUE,
-                                     actual=currentLinksResult,
-                                     onpass="ONOS" + controllerStr +
-                                     " links view is correct",
-                                     onfail="ONOS" + controllerStr +
-                                     " links view is incorrect" )
-
-            if hosts[ controller ] or "Error" not in hosts[ controller ]:
-                currentHostsResult = main.Mininet1.compareHosts(
-                        mnHosts,
-                        json.loads( hosts[ controller ] ) )
-            else:
-                currentHostsResult = main.FALSE
-            utilities.assert_equals( expect=main.TRUE,
-                                     actual=currentHostsResult,
-                                     onpass="ONOS" + controllerStr +
-                                     " hosts exist in Mininet",
-                                     onfail="ONOS" + controllerStr +
-                                     " hosts don't match Mininet" )
+        try:
+            from tests.dependencies.topology import Topology
+        except ImportError:
+            main.log.error( "Topology not found exiting the test" )
+            main.exit()
+        try:
+            main.topoRelated
+        except ( NameError, AttributeError ):
+            main.topoRelated = Topology()
+        main.topoRelated.compareTopos( main.Mininet1 )
 
     def CASE9( self, main ):
         """
@@ -373,18 +179,17 @@
         """
             Stop mininet
         """
-        main.log.report( "Stop Mininet topology" )
-        main.case( "Stop Mininet topology" )
-        main.caseExplanation = "Stopping the current mininet topology " +\
-                                "to start up fresh"
-
-        main.step( "Stopping Mininet Topology" )
-        topoResult = main.Mininet1.stopNet()
-        stepResult = topoResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully stop mininet",
-                                 onfail="Failed to stop mininet" )
+        try:
+            from tests.dependencies.utils import Utils
+        except ImportError:
+            main.log.error( "Utils not found exiting the test" )
+            main.exit()
+        try:
+            main.Utils
+        except ( NameError, AttributeError ):
+            main.Utils = Utils()
+        main.Utils.mininetCleanIntro()
+        topoResult = main.Utils.mininetCleanup( main.Mininet1 )
         # Exit if topology did not load properly
         if not topoResult:
             main.cleanup()
@@ -404,7 +209,7 @@
                                ", the other disallowed."
 
 
-        pprint = main.nodes[ 0 ].pprint
+        pprint = main.RESTs[ 0 ].pprint
 
         main.step( "Add Net Cfg for switch1" )
 
@@ -558,7 +363,7 @@
         main.caseExplanation = "Add Network Configurations for discovered " +\
                                "devices. One device is allowed" +\
                                ", the other disallowed."
-        pprint = main.nodes[ 0 ].pprint
+        pprint = main.RESTs[ 0 ].pprint
 
         main.step( "Add Net Cfg for switch2" )
         try:
@@ -884,7 +689,7 @@
 
         """
         import json
-        pprint = main.nodes[ 0 ].pprint
+        pprint = main.RESTs[ 0 ].pprint
         main.case( "Posting network configurations to the top level web resource" )
         main.step( "Get json object from Net Cfg" )
         getinfo = utilities.retry( f=main.ONOSrest1.getNetCfg,
diff --git a/TestON/tests/FUNC/FUNCnetCfg/dependencies/netCfg.py b/TestON/tests/FUNC/FUNCnetCfg/dependencies/netCfg.py
index b2e4f56..9e5404a 100644
--- a/TestON/tests/FUNC/FUNCnetCfg/dependencies/netCfg.py
+++ b/TestON/tests/FUNC/FUNCnetCfg/dependencies/netCfg.py
@@ -11,7 +11,7 @@
     """
     main.step( "Check net config" )
     if gossipTime:
-        time.sleep( gossipTime * len( main.nodes ) )
+        time.sleep( gossipTime * len( main.RESTs ) )
     responses = []
     result = utilities.retry( f=checkNodeResponses,
                               retValue=False,
@@ -26,7 +26,7 @@
 
 def checkNodeResponses ( main, responses ):
     numberOfFailedNodes = 0  # Tracks the number of nodes that failed to get net configuration
-    for node in main.nodes:
+    for node in main.RESTs:
         response = node.getNetCfg( )
         responses.append( node.pprint( response ) )
         if response == main.FALSE:
diff --git a/TestON/tests/FUNC/FUNCnetCfg/dependencies/startUp.py b/TestON/tests/FUNC/FUNCnetCfg/dependencies/startUp.py
deleted file mode 100644
index 9ebeb60..0000000
--- a/TestON/tests/FUNC/FUNCnetCfg/dependencies/startUp.py
+++ /dev/null
@@ -1,31 +0,0 @@
-"""
-    This wrapper function is use for starting up onos instance
-"""
-import time
-
-
-def onosBuild( main, gitBranch ):
-    """
-        This includes pulling ONOS and building it using maven install
-    """
-    buildResult = main.FALSE
-
-    # Git checkout a branch of ONOS
-    checkOutResult = main.ONOSbench.gitCheckout( gitBranch )
-    # Does the git pull on the branch that was checked out
-    if not checkOutResult:
-        main.log.warn( "Failed to checked out " + gitBranch +
-                                           " branch" )
-    else:
-        main.log.info( "Successfully checked out " + gitBranch +
-                                           " branch" )
-    gitPullResult = main.ONOSbench.gitPull()
-    if gitPullResult == main.ERROR:
-        main.log.error( "Error pulling git branch" )
-    else:
-        main.log.info( "Successfully pulled " + gitBranch + " branch" )
-
-    # buck build
-    buildResult = main.ONOSbench.buckBuild()
-
-    return buildResult
diff --git a/TestON/tests/FUNC/FUNCnetCfg/dependencies/topo.py b/TestON/tests/FUNC/FUNCnetCfg/dependencies/topo.py
deleted file mode 100644
index 7217d4d..0000000
--- a/TestON/tests/FUNC/FUNCnetCfg/dependencies/topo.py
+++ /dev/null
@@ -1,102 +0,0 @@
-"""
-    These functions can be used for topology comparisons
-"""
-import time
-import os
-import json
-
-
-def getAllDevices( main ):
-    """
-        Return a list containing the devices output from each ONOS node
-    """
-    devices = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].devices,
-                         name="devices-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        devices.append( t.result )
-    return devices
-
-
-def getAllHosts( main ):
-    """
-        Return a list containing the hosts output from each ONOS node
-    """
-    hosts = []
-    ipResult = main.TRUE
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].hosts,
-                         name="hosts-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        hosts.append( t.result )
-    return hosts
-
-
-def getAllPorts( main ):
-    """
-        Return a list containing the ports output from each ONOS node
-    """
-    ports = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].ports,
-                         name="ports-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        ports.append( t.result )
-    return ports
-
-
-def getAllLinks( main ):
-    """
-        Return a list containing the links output from each ONOS node
-    """
-    links = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].links,
-                         name="links-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        links.append( t.result )
-    return links
-
-
-def getAllClusters( main ):
-    """
-        Return a list containing the clusters output from each ONOS node
-    """
-    clusters = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].clusters,
-                         name="clusters-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        clusters.append( t.result )
-    return clusters
diff --git a/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py b/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py
index 09867a3..5e40d18 100644
--- a/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py
+++ b/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py
@@ -10,7 +10,6 @@
         import time
         import imp
         import re
-
         """
         - Construct tests variables
         - GIT ( optional )
@@ -20,26 +19,22 @@
             - Install ONOS package
             - Build ONOS package
         """
-        main.case( "Constructing test variables and building ONOS package" )
-        main.step( "Constructing test variables" )
-        main.caseExplanation = "This test case is mainly for loading " +\
-                               "from params file, and pull and build the " +\
-                               " latest ONOS package"
+        try:
+            from tests.dependencies.ONOSSetup import ONOSSetup
+            main.testSetUp = ONOSSetup()
+        except ImportError:
+            main.log.error( "ONOSSetup not found. exiting the test" )
+            main.exit()
+        main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
 
         # Test variables
         try:
-            main.testOnDirectory = re.sub( "(/tests)$", "", main.testDir )
             main.apps = main.params[ 'ENV' ][ 'cellApps' ]
-            gitBranch = main.params[ 'GIT' ][ 'branch' ]
             main.dependencyPath = main.testOnDirectory + \
                                   main.params[ 'DEPENDENCY' ][ 'path' ]
             # main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
             main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
-            if main.ONOSbench.maxNodes:
-                main.maxNodes = int( main.ONOSbench.maxNodes )
-            else:
-                main.maxNodes = 0
             wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
             wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
             wrapperFile3 = main.params[ 'DEPENDENCY' ][ 'wrapper3' ]
@@ -57,62 +52,27 @@
             main.configPort = main.params[ 'CONFIGURE' ][ 'cfgAppPort' ]
             main.cycle = 0  # How many times FUNCintent has run through its tests
 
-            gitPull = main.params[ 'GIT' ][ 'pull' ]
-            main.cellData = {}  # for creating cell file
             main.hostsData = {}
-            main.CLIs = []
-            main.CLIs2 = []
-            main.ONOSip = []
             main.assertReturnString = ''  # Assembled assert return string
 
-            main.ONOSip = main.ONOSbench.getOnosIps()
-            print main.ONOSip
-
-            # Assigning ONOS cli handles to a list
-            for i in range( 1, main.maxNodes + 1 ):
-                main.CLIs.append( getattr( main, 'ONOSrest' + str( i ) ) )
-                main.CLIs2.append( getattr( main, 'ONOScli' + str( i ) ) )
-
             # -- INIT SECTION, ONLY RUNS ONCE -- #
-            main.startUp = imp.load_source( wrapperFile1,
-                                            main.dependencyPath +
-                                            wrapperFile1 +
-                                            ".py" )
 
             main.netconfFunction = imp.load_source( wrapperFile2,
                                                     main.dependencyPath +
                                                     wrapperFile2 +
                                                     ".py" )
 
-            main.topo = imp.load_source( wrapperFile3,
-                                         main.dependencyPath +
-                                         wrapperFile3 +
-                                         ".py" )
-
+            stepResult = main.testSetUp.envSetup( True, True )
             # Uncomment out the following if a mininet topology is added
             # copyResult1 = main.ONOSbench.scp( main.Mininet1,
             #                                   main.dependencyPath +
             #                                   main.topology,
             #                                   main.Mininet1.home + "custom/",
             #                                   direction="to" )
-
-            if main.CLIs and main.CLIs2:
-                stepResult = main.TRUE
-            else:
-                main.log.error( "Did not properly created list of ONOS CLI handle" )
-                stepResult = main.FALSE
         except Exception as e:
-            main.log.exception( e )
-            main.cleanup()
-            main.exit()
+            main.testSetUp.envSetupException( e )
+        main.testSetUp.evnSetupConclusion( stepResult )
 
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully construct " +
-                                        "test variables ",
-                                 onfail="Failed to construct test variables" )
-
-        main.ONOSbench.getVersion( report=True )
 
     def CASE2( self, main ):
         """
@@ -126,164 +86,28 @@
         - Install ONOS cluster
         - Connect to cli
         """
-        main.cycle += 1
-
-        # main.scale[ 0 ] determines the current number of ONOS controller
-        main.numCtrls = int( main.scale[ 0 ] )
-
-        main.case( "Starting up " + str( main.numCtrls ) +
-                   " node(s) ONOS cluster" )
-        main.caseExplanation = "Set up ONOS with " + str( main.numCtrls ) +\
-                                " node(s) ONOS cluster"
-
-        #kill off all onos processes
-        main.log.info( "Safety check, killing all ONOS processes" +
-                       " before initiating environment setup" )
-
-        time.sleep( main.startUpSleep )
-        main.step( "Uninstalling ONOS package" )
-        onosUninstallResult = main.TRUE
-        for ip in main.ONOSip:
-            onosUninstallResult = onosUninstallResult and \
-                    main.ONOSbench.onosUninstall( nodeIp=ip )
-        stepResult = onosUninstallResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully uninstalled ONOS package",
-                                 onfail="Failed to uninstall ONOS package" )
-
-        for i in range( main.maxNodes ):
-            main.ONOSbench.onosDie( main.ONOSip[ i ] )
-
-        main.log.info( "NODE COUNT = " + str( main.numCtrls ) )
-
-        tempOnosIp = []
-        for i in range( main.numCtrls ):
-            tempOnosIp.append( main.ONOSip[ i ] )
-
-        main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
-                                       "temp", main.Mininet1.ip_address,
-                                       main.apps, tempOnosIp, main.ONOScli1.karafUser )
-
-        main.step( "Apply cell to environment" )
-        cellResult = main.ONOSbench.setCell( "temp" )
-        verifyResult = main.ONOSbench.verifyCell()
-        stepResult = cellResult and verifyResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully applied cell to " +
-                                        "environment",
-                                 onfail="Failed to apply cell to environment " )
-
-        main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.buckBuild()
-        stepResult = packageResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully created ONOS package",
-                                 onfail="Failed to create ONOS package" )
-
-        time.sleep( main.startUpSleep )
-        main.step( "Installing ONOS package" )
-        onosInstallResult = main.TRUE
-        for i in range( main.numCtrls ):
-            onosInstallResult = onosInstallResult and \
-                    main.ONOSbench.onosInstall( node=main.ONOSip[ i ], options="" )
-        stepResult = onosInstallResult
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully installed ONOS package",
-                                 onfail="Failed to install ONOS package" )
-
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[ i ] )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
-        time.sleep( main.startUpSleep )
-        main.step( "Starting ONOS service" )
-        stopResult = main.TRUE
-        startResult = main.TRUE
-        onosIsUp = main.TRUE
-
-        for i in range( main.numCtrls ):
-            onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
-        if onosIsUp == main.TRUE:
-            main.log.report( "ONOS instance is up and ready" )
-        else:
-            main.log.report( "ONOS instance may not be up, stop and " +
-                             "start ONOS again " )
-            for i in range( main.numCtrls ):
-                stopResult = stopResult and \
-                        main.ONOSbench.onosStop( main.ONOSip[ i ] )
-            for i in range( main.numCtrls ):
-                startResult = startResult and \
-                        main.ONOSbench.onosStart( main.ONOSip[ i ] )
-        stepResult = onosIsUp and stopResult and startResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="ONOS service is ready",
-                                 onfail="ONOS service did not start properly" )
-
-        # Start an ONOS cli to provide functionality that is not currently
-        # supported by the Rest API remove this when Leader Checking is supported
-        # by the REST API
-
-        main.step( "Start ONOS cli" )
-        cliResult = main.TRUE
-        for i in range( main.numCtrls ):
-            cliResult = cliResult and \
-                        main.CLIs2[ i ].startOnosCli( main.ONOSip[ i ] )
-        stepResult = cliResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully start ONOS cli",
-                                 onfail="Failed to start ONOS cli" )
-
-        # Remove the first element in main.scale list
-        main.scale.remove( main.scale[ 0 ] )
+        main.testSetUp.ONOSSetUp( main.Mininet1, True )
 
     def CASE19( self, main ):
         """
             Copy the karaf.log files after each testcase cycle
         """
-        main.log.report( "Copy karaf logs" )
-        main.case( "Copy karaf logs" )
-        main.caseExplanation = "Copying the karaf logs to preserve them through" +\
-                               "reinstalling ONOS"
-        main.step( "Copying karaf logs" )
-        stepResult = main.TRUE
-        scpResult = main.TRUE
-        copyResult = main.TRUE
-        for i in range( main.numCtrls ):
-            main.node = main.CLIs2[ i ]
-            ip = main.ONOSip[ i ]
-            main.node.ip_address = ip
-            scpResult = scpResult and main.ONOSbench.scp( main.node,
-                                                          "/opt/onos/log/karaf.log",
-                                                          "/tmp/karaf.log",
-                                                          direction="from" )
-            copyResult = copyResult and main.ONOSbench.cpLogsToDir( "/tmp/karaf.log", main.logdir,
-                                                                    copyFileName=( "karaf.log.node{0}.cycle{1}".format( str( i + 1 ), str( main.cycle ) ) ) )
-            if scpResult and copyResult:
-                stepResult = main.TRUE and stepResult
-            else:
-                stepResult = main.FALSE and stepResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully copied remote ONOS logs",
-                                 onfail="Failed to copy remote ONOS logs" )
-
+        try:
+            from tests.dependencies.utils import Utils
+        except ImportError:
+            main.log.error( "Utils not found exiting the test" )
+            main.exit()
+        try:
+            main.Utils
+        except ( NameError, AttributeError ):
+            main.Utils = Utils()
+        main.Utils.copyKarafLog()
     def CASE100( self, main ):
         """
             Start NETCONF app and OFC-Server or make sure that they are already running
         """
         assert main, "There is no main"
-        assert main.CLIs, "There is no main.CLIs"
+        assert main.RESTs, "There is no main.RESTs"
         assert main.numCtrls, "Placed the total number of switch topology in \
                                 main.numCtrls"
 
@@ -316,7 +140,7 @@
                 -The file is built from information loaded from the .params file
         """
         assert main, "There is no main"
-        assert main.CLIs, "There is no main.CLIs"
+        assert main.RESTs, "There is no main.RESTs"
         assert main.numCtrls, "Placed the total number of switch topology in \
                                 main.numCtrls"
 
@@ -339,7 +163,7 @@
             Push a configuration and bring up a switch
         """
         assert main, "There is no main"
-        assert main.CLIs, "There is no main.CLIs"
+        assert main.RESTs, "There is no main.RESTs"
         assert main.numCtrls, "Placed the total number of switch topology in \
                                 main.numCtrls"
 
diff --git a/TestON/tests/FUNC/FUNCnetconf/dependencies/netconf.py b/TestON/tests/FUNC/FUNCnetconf/dependencies/netconf.py
index 7cc2258..b67a5f7 100644
--- a/TestON/tests/FUNC/FUNCnetconf/dependencies/netconf.py
+++ b/TestON/tests/FUNC/FUNCnetconf/dependencies/netconf.py
@@ -18,7 +18,7 @@
         the OF-Config server is running on the node to be configured
     """
     startResult = main.FALSE
-    startResult = main.CLIs[ 0 ].activateApp( appName="org.onosproject.netconf" )
+    startResult = main.RESTs[ 0 ].activateApp( appName="org.onosproject.netconf" )
     return startResult
 
 
@@ -96,7 +96,7 @@
     method = "POST"
     data = main.cfgJson
     configResult = main.FALSE
-    sendResult = main.CLIs[ 0 ].send( url=url, method=method, data=data )
+    sendResult = main.RESTs[ 0 ].send( url=url, method=method, data=data )
     main.log.info( "Device configuration request response code: " + str( sendResult[ 0 ] ) )
     if ( 200 <= sendResult[ 0 ] <= 299 ):
         configResult = main.TRUE
@@ -117,8 +117,8 @@
     addressResult = main.FALSE
     driverResult = main.FALSE
     try:
-        apiResult = main.CLIs[ 0 ].devices()
-        cliResult = main.CLIs2[ 0 ].devices()
+        apiResult = main.RESTs[ 0 ].devices()
+        cliResult = main.CLIs[ 0 ].devices()
 
         apiDict = json.loads( apiResult )
         cliDict = json.loads( cliResult )
diff --git a/TestON/tests/FUNC/FUNCnetconf/dependencies/startUp.py b/TestON/tests/FUNC/FUNCnetconf/dependencies/startUp.py
deleted file mode 100644
index a9becf9..0000000
--- a/TestON/tests/FUNC/FUNCnetconf/dependencies/startUp.py
+++ /dev/null
@@ -1,33 +0,0 @@
-"""
-    This wrapper function is use for starting up onos instance
-"""
-import time
-import os
-import json
-
-
-def onosBuild( main, gitBranch ):
-    """
-        This includes pulling ONOS and building it using maven install
-    """
-    buildResult = main.FALSE
-
-    # Git checkout a branch of ONOS
-    checkOutResult = main.ONOSbench.gitCheckout( gitBranch )
-    # Does the git pull on the branch that was checked out
-    if not checkOutResult:
-        main.log.warn( "Failed to checked out " + gitBranch +
-                                           " branch" )
-    else:
-        main.log.info( "Successfully checked out " + gitBranch +
-                                           " branch" )
-    gitPullResult = main.ONOSbench.gitPull()
-    if gitPullResult == main.ERROR:
-        main.log.error( "Error pulling git branch" )
-    else:
-        main.log.info( "Successfully pulled " + gitBranch + " branch" )
-
-    # buck build
-    buildResult = main.ONOSbench.buckBuild()
-
-    return buildResult
diff --git a/TestON/tests/FUNC/FUNCnetconf/dependencies/topo.py b/TestON/tests/FUNC/FUNCnetconf/dependencies/topo.py
deleted file mode 100644
index 7217d4d..0000000
--- a/TestON/tests/FUNC/FUNCnetconf/dependencies/topo.py
+++ /dev/null
@@ -1,102 +0,0 @@
-"""
-    These functions can be used for topology comparisons
-"""
-import time
-import os
-import json
-
-
-def getAllDevices( main ):
-    """
-        Return a list containing the devices output from each ONOS node
-    """
-    devices = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].devices,
-                         name="devices-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        devices.append( t.result )
-    return devices
-
-
-def getAllHosts( main ):
-    """
-        Return a list containing the hosts output from each ONOS node
-    """
-    hosts = []
-    ipResult = main.TRUE
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].hosts,
-                         name="hosts-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        hosts.append( t.result )
-    return hosts
-
-
-def getAllPorts( main ):
-    """
-        Return a list containing the ports output from each ONOS node
-    """
-    ports = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].ports,
-                         name="ports-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        ports.append( t.result )
-    return ports
-
-
-def getAllLinks( main ):
-    """
-        Return a list containing the links output from each ONOS node
-    """
-    links = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].links,
-                         name="links-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        links.append( t.result )
-    return links
-
-
-def getAllClusters( main ):
-    """
-        Return a list containing the clusters output from each ONOS node
-    """
-    clusters = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].clusters,
-                         name="clusters-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        clusters.append( t.result )
-    return clusters
diff --git a/TestON/tests/FUNC/FUNCoptical/FUNCoptical.py b/TestON/tests/FUNC/FUNCoptical/FUNCoptical.py
index c7ae463..9d800a7 100644
--- a/TestON/tests/FUNC/FUNCoptical/FUNCoptical.py
+++ b/TestON/tests/FUNC/FUNCoptical/FUNCoptical.py
@@ -7,219 +7,75 @@
         self.default = ''
 
     def CASE1( self, main ):
-        import time
         import imp
+        import time
         import re
-
         """
-        - Construct tests variables
-        - GIT ( optional )
-            - Checkout ONOS master branch
-            - Pull latest ONOS code
-        - Building ONOS ( optional )
-            - Install ONOS package
-            - Build ONOS package
+           - Construct tests variables
+           - GIT ( optional )
+               - Checkout ONOS master branch
+               - Pull latest ONOS code
+           - Building ONOS ( optional )
+               - Install ONOS package
+               - Build ONOS package
         """
-        main.case( "Constructing test variables and building ONOS package" )
-        main.step( "Constructing test variables" )
-        main.caseExplanation = "This test case is mainly for loading " +\
-                               "from params file, and pull and build the " +\
-                               " latest ONOS package"
+        try:
+            from tests.dependencies.ONOSSetup import ONOSSetup
+            main.testSetUp = ONOSSetup()
+        except ImportError:
+            main.log.error( "ONOSSetup not found. exiting the test" )
+            main.exit()
+        main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
-
         # Test variables
         try:
-            main.testOnDirectory = re.sub( "(/tests)$", "", main.testDir )
             main.apps = main.params[ 'ENV' ][ 'cellApps' ]
-            gitBranch = main.params[ 'GIT' ][ 'branch' ]
             main.dependencyPath = main.testOnDirectory + \
                                   main.params[ 'DEPENDENCY' ][ 'path' ]
             main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
-            if main.ONOSbench.maxNodes:
-                main.maxNodes = int( main.ONOSbench.maxNodes )
-            else:
-                main.maxNodes = 0
             wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
             main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
             main.checkIntentSleep = int( main.params[ 'SLEEP' ][ 'checkintent' ] )
             main.checkTopoAttempts = int( main.params[ 'SLEEP' ][ 'topoAttempts' ] )
-            gitPull = main.params[ 'GIT' ][ 'pull' ]
             main.switches = int( main.params[ 'MININET' ][ 'switch' ] )
             main.links = int( main.params[ 'MININET' ][ 'links' ] )
             main.hosts = int( main.params[ 'MININET' ][ 'hosts' ] )
             main.opticalTopo = main.params[ 'MININET' ][ 'toponame' ]
-            main.cellData = {}  # For creating cell file
             main.hostsData = {}
-            main.CLIs = []
-            main.ONOSip = []  # List of IPs of active ONOS nodes. CASE 2
             main.activeONOSip = []
             main.assertReturnString = ''  # Assembled assert return string
             main.cycle = 0  # How many times FUNCintent has run through its tests
 
-            main.ONOSip = main.ONOSbench.getOnosIps()
-
-            # Assigning ONOS cli handles to a list
-            for i in range( 1, main.maxNodes + 1 ):
-                main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
-
             # -- INIT SECTION, ONLY RUNS ONCE -- #
-            main.topo = imp.load_source( wrapperFile1,
-                                         main.dependencyPath +
-                                         wrapperFile1 +
-                                         ".py" )
-            if main.CLIs:
-                stepResult = main.TRUE
-            else:
-                main.log.error( "Did not properly created list of ONOS CLI handle" )
-                stepResult = main.FALSE
+            stepResult = main.testSetUp.envSetup( True )
         except Exception as e:
-            main.log.exception( e )
-            main.cleanup()
-            main.exit()
-
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully construct " +
-                                        "test variables ",
-                                 onfail="Failed to construct test variables" )
-
-        main.ONOSbench.getVersion( report=True )
+            main.testSetUp.envSetupException( e )
+        main.testSetUp.evnSetupConclusion( stepResult )
 
     def CASE2( self, main ):
         """
-        - Set up cell
-            - Create cell file
-            - Set cell file
-            - Verify cell file
-        - Kill ONOS process
-        - Uninstall ONOS cluster
-        - Verify ONOS start up
-        - Install ONOS cluster
-        - Connect to cli
+            - Set up cell
+                - Create cell file
+                - Set cell file
+                - Verify cell file
+            - Kill ONOS process
+            - Uninstall ONOS cluster
+            - Verify ONOS start up
+            - Install ONOS cluster
+            - Connect to cli
         """
-        main.cycle += 1
-
-        # main.scale[ 0 ] determines the current number of ONOS controller
-        main.numCtrls = int( main.scale[ 0 ] )
         main.flowCompiler = "Flow Rules"
-
-        main.case( "Starting up " + str( main.numCtrls ) +
-                   " node(s) ONOS cluster" )
-        main.caseExplanation = "Set up ONOS with " + str( main.numCtrls ) +\
-                                " node(s) ONOS cluster"
-
-        #kill off all onos processes
-        main.log.info( "Safety check, killing all ONOS processes" +
-                       " before initiating environment setup" )
-
-        for i in range( main.maxNodes ):
-            main.ONOSbench.onosDie( main.ONOSip[ i ] )
-
-        print "NODE COUNT = ", main.numCtrls
-
-        tempOnosIp = []
-        for i in range( main.numCtrls ):
-            tempOnosIp.append( main.ONOSip[ i ] )
-
-        main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
-                                       "temp", main.Mininet1.ip_address,
-                                       main.apps, tempOnosIp, main.ONOScli1.karafUser )
-
-        main.step( "Apply cell to environment" )
-        cellResult = main.ONOSbench.setCell( "temp" )
-        verifyResult = main.ONOSbench.verifyCell()
-        stepResult = cellResult and verifyResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully applied cell to " +
-                                        "environment",
-                                 onfail="Failed to apply cell to environment " )
-
-        main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.buckBuild()
-        stepResult = packageResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully created ONOS package",
-                                 onfail="Failed to create ONOS package" )
-
-        time.sleep( main.startUpSleep )
-        main.step( "Uninstalling ONOS package" )
-        onosUninstallResult = main.TRUE
-        for ip in main.ONOSip:
-            onosUninstallResult = onosUninstallResult and \
-                    main.ONOSbench.onosUninstall( nodeIp=ip )
-        stepResult = onosUninstallResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully uninstalled ONOS package",
-                                 onfail="Failed to uninstall ONOS package" )
-
-        time.sleep( main.startUpSleep )
-        main.step( "Installing ONOS package" )
-        onosInstallResult = main.TRUE
-        del main.activeONOSip[:]
-        for i in range( main.numCtrls ):
-            onosInstallResult = onosInstallResult and \
-                    main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
-            # Populate activeONOSip
-            main.activeONOSip.append( main.ONOSip[ i ] )
-        stepResult = onosInstallResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully installed ONOS package",
-                                 onfail="Failed to install ONOS package" )
-
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[ i ] )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
-        time.sleep( main.startUpSleep )
-        main.step( "Starting ONOS service" )
-        stopResult = main.TRUE
-        startResult = main.TRUE
-        onosIsUp = main.TRUE
-
-        for i in range( main.numCtrls ):
-            isUp = main.ONOSbench.isup( main.ONOSip[ i ] )
-            onosIsUp = onosIsUp and isUp
-            if isUp == main.TRUE:
-                main.log.report( "ONOS instance {0} is up and ready".format( i + 1 ) )
-            else:
-                main.log.report( "ONOS instance {0} may not be up, stop and ".format( i + 1 ) +
-                                 "start ONOS again " )
-                stopResult = stopResult and main.ONOSbench.onosStop( main.ONOSip[ i ] )
-                startResult = startResult and main.ONOSbench.onosStart( main.ONOSip[ i ] )
-                if not startResult or stopResult:
-                    main.log.report( "ONOS instance {0} did not start correctly.".format( i + 1 ) )
-        stepResult = onosIsUp and stopResult and startResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="ONOS service is ready on all nodes",
-                                 onfail="ONOS service did not start properly on all nodes" )
-
-        main.step( "Start ONOS cli" )
-        cliResult = main.TRUE
-        for i in range( main.numCtrls ):
-            cliResult = cliResult and \
-                        main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
-        stepResult = cliResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully start ONOS cli",
-                                 onfail="Failed to start ONOS cli" )
-
-        # Remove the first element in main.scale list
-        main.scale.remove( main.scale[ 0 ] )
+        main.testSetUp.ONOSSetUp( main.LincOE, True )
 
     def CASE10( self, main ):
         """
             Start Mininet opticalTest Topology
         """
+        del main.activeONOSip[:]
+        for i in range( main.numCtrls ):
+            # Populate activeONOSip
+            main.activeONOSip.append( main.ONOSip[ i ] )
+
         main.case( "Mininet with Linc-OE startup" )
         main.step( "Push TopoDDriver.json to ONOS through onos-netcfg" )
         topoResult = main.ONOSbench.onosNetCfg( controllerIps=main.activeONOSip, path=main.dependencyPath,
@@ -234,7 +90,7 @@
         time.sleep( 10 )
         controllerIPs = ','.join( main.activeONOSip )
         cIps = ""
-        for i in range(0,4):
+        for i in range( 0, 4 ):
             cIps += controllerIPs + ' '
         opticalMnScript = main.LincOE.runOpticalMnScript( ctrllerIP=cIps, topology=main.opticalTopo )
         topoResult = opticalMnScript
@@ -248,17 +104,17 @@
         """
             Stop mininet
         """
-        main.log.report( "Stop Mininet topology" )
-        main.case( "Stop Mininet topology" )
-        main.caseExplanation = "Stopping the current mininet topology " +\
-                                "to start up fresh"
-
-        main.step( "Stopping Mininet Topology" )
-        topoResult = main.LincOE.stopNet( timeout=180 )
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=topoResult,
-                                 onpass="Successfully stopped mininet",
-                                 onfail="Failed to stopped mininet" )
+        try:
+            from tests.dependencies.utils import Utils
+        except ImportError:
+            main.log.error( "Utils not found exiting the test" )
+            main.exit()
+        try:
+            main.Utils
+        except ( NameError, AttributeError ):
+            main.Utils = Utils()
+        main.Utils.mininetCleanIntro()
+        topoResult = main.Utils.mininetCleanup( main.LincOE, timeout=180 )
         # Exit if topology did not load properly
         if not topoResult:
             main.cleanup()
@@ -307,33 +163,16 @@
         """
             Copy the karaf.log files after each testcase cycle
         """
-        main.log.report( "Copy karaf logs" )
-        main.case( "Copy karaf logs" )
-        main.caseExplanation = "Copying the karaf logs to preserve them through" +\
-                               "reinstalling ONOS"
-        main.step( "Copying karaf logs" )
-        stepResult = main.TRUE
-        scpResult = main.TRUE
-        copyResult = main.TRUE
-        for i in range( main.numCtrls ):
-            main.node = main.CLIs[ i ]
-            ip = main.ONOSip[ i ]
-            main.node.ip_address = ip
-            scpResult = scpResult and main.ONOSbench.scp( main.node,
-                                                          "/opt/onos/log/karaf.log",
-                                                          "/tmp/karaf.log",
-                                                          direction="from" )
-            copyResult = copyResult and main.ONOSbench.cpLogsToDir( "/tmp/karaf.log", main.logdir,
-                                                                    copyFileName=( "karaf.log.node{0}.cycle{1}".format( str( i + 1 ), str( main.cycle ) ) ) )
-            if scpResult and copyResult:
-                stepResult = main.TRUE and stepResult
-            else:
-                stepResult = main.FALSE and stepResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully copied remote ONOS logs",
-                                 onfail="Failed to copy remote ONOS logs" )
-
+        try:
+            from tests.dependencies.utils import Utils
+        except ImportError:
+            main.log.error( "Utils not found exiting the test" )
+            main.exit()
+        try:
+            main.Utils
+        except ( NameError, AttributeError ):
+            main.Utils = Utils()
+        main.Utils.copyKarafLog()
     def CASE21( self, main ):
         """
             Run pingall to discover all hosts
@@ -379,7 +218,15 @@
         Compare ONOS Topology to Mininet Topology
         """
         import json
-
+        try:
+            from tests.dependencies.topology import Topology
+        except ImportError:
+            main.log.error( "Topology not found exiting the test" )
+            main.exit()
+        try:
+            main.topoRelated
+        except ( NameError, AttributeError ):
+            main.topoRelated = Topology()
         main.case( "Compare ONOS Topology view to Mininet topology" )
         main.caseExplanation = "Compare topology elements between Mininet" +\
                                 " and ONOS"
@@ -403,16 +250,16 @@
                 ( not devicesResults or not linksResults or not hostsResults ):
             time.sleep( 2 )
             if not devicesResults:
-                devices = main.topo.getAllDevices( main )
-                ports = main.topo.getAllPorts( main )
+                devices = main.topoRelated.getAllDevices( main.numCtrls, False )
+                ports = main.topoRelated.getAllPorts( main.numCtrls, False )
                 devicesResults = main.TRUE
                 deviceFails = []  # Reset for each attempt
             if not linksResults:
-                links = main.topo.getAllLinks( main )
+                links = main.topoRelated.getAllLinks( main.numCtrls, False )
                 linksResults = main.TRUE
                 linkFails = []  # Reset for each attempt
             if not hostsResults:
-                hosts = main.topo.getAllHosts( main )
+                hosts = main.topoRelated.getAllHosts( main.numCtrls, False )
                 hostsResults = main.TRUE
                 hostFails = []  # Reset for each attempt
 
@@ -507,6 +354,7 @@
                                  onpass="ONOS correctly discovered the topology",
                                  onfail="ONOS incorrectly discovered the topology" )
 
+
     def CASE31( self, main ):
         import time
         """
diff --git a/TestON/tests/FUNC/FUNCoptical/dependencies/topo.py b/TestON/tests/FUNC/FUNCoptical/dependencies/topo.py
deleted file mode 100644
index 7217d4d..0000000
--- a/TestON/tests/FUNC/FUNCoptical/dependencies/topo.py
+++ /dev/null
@@ -1,102 +0,0 @@
-"""
-    These functions can be used for topology comparisons
-"""
-import time
-import os
-import json
-
-
-def getAllDevices( main ):
-    """
-        Return a list containing the devices output from each ONOS node
-    """
-    devices = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].devices,
-                         name="devices-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        devices.append( t.result )
-    return devices
-
-
-def getAllHosts( main ):
-    """
-        Return a list containing the hosts output from each ONOS node
-    """
-    hosts = []
-    ipResult = main.TRUE
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].hosts,
-                         name="hosts-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        hosts.append( t.result )
-    return hosts
-
-
-def getAllPorts( main ):
-    """
-        Return a list containing the ports output from each ONOS node
-    """
-    ports = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].ports,
-                         name="ports-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        ports.append( t.result )
-    return ports
-
-
-def getAllLinks( main ):
-    """
-        Return a list containing the links output from each ONOS node
-    """
-    links = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].links,
-                         name="links-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        links.append( t.result )
-    return links
-
-
-def getAllClusters( main ):
-    """
-        Return a list containing the clusters output from each ONOS node
-    """
-    clusters = []
-    threads = []
-    for i in range( main.numCtrls ):
-        t = main.Thread( target=main.CLIs[ i ].clusters,
-                         name="clusters-" + str( i ),
-                         args=[] )
-        threads.append( t )
-        t.start()
-
-    for t in threads:
-        t.join()
-        clusters.append( t.result )
-    return clusters
diff --git a/TestON/tests/FUNC/FUNCovsdbtest/FUNCovsdbtest.py b/TestON/tests/FUNC/FUNCovsdbtest/FUNCovsdbtest.py
index 0737e63..c5f7415 100644
--- a/TestON/tests/FUNC/FUNCovsdbtest/FUNCovsdbtest.py
+++ b/TestON/tests/FUNC/FUNCovsdbtest/FUNCovsdbtest.py
@@ -37,123 +37,32 @@
         import os
         import time
         main.log.info( "ONOS Single node start ovsdb test - initialization" )
-        main.case( "Setting up test environment" )
-        main.caseExplanation = "Setup the test environment including " +\
-                                "installing ONOS, start ONOS."
+        try:
+            from tests.dependencies.ONOSSetup import ONOSSetup
+            main.testSetUp = ONOSSetup()
+        except ImportError:
+            main.log.error( "ONOSSetup not found. exiting the test" )
+            main.exit()
+        main.testSetUp.envSetupDescription()
+        stepResult = main.FALSE
 
-        # load some variables from the params file
-        main.step( "Constructing test variables" )
-        gitPull = main.params[ 'GIT' ][ 'pull' ]
-        gitBranch = main.params[ 'GIT' ][ 'branch' ]
-        cellName = main.params[ 'ENV' ][ 'cellName' ]
-        ipList = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
-        main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
-        cellAppString = main.params[ 'ENV' ][ 'cellApps' ]
+        try:
+            # load some variables from the params file
+            main.step( "Constructing test variables" )
+            cellName = main.params[ 'ENV' ][ 'cellName' ]
+            main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
+            main.apps = main.params[ 'ENV' ][ 'cellApps' ]
 
-        main.ONOSbench.getVersion( report=True )
+            main.maxNodes = 1
 
-        main.log.info( "Safety check, killing all ONOS processes" +
-                       " before initiating environment setup" )
+            stepResult = main.testSetUp.envSetup( hasNode=True )
 
-        main.log.info( "Removing raft logs" )
-        main.ONOSbench.onosRemoveRaftLogs()
+        except Exception as e:
+            main.testSetUp.envSetupException( e )
+        main.testSetUp.evnSetupConclusion( stepResult )
 
-        main.CLIs = []
-        main.nodes = []
-        main.numCtrls = 1
 
-        for i in range( 1, main.numCtrls + 1 ):
-            try:
-                main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
-                main.nodes.append( getattr( main, 'ONOS' + str( i ) ) )
-                ipList.append( main.nodes[ -1 ].ip_address )
-            except AttributeError:
-                break
-
-        main.step( "Uninstalling ONOS package" )
-        onosUninstallResult = main.TRUE
-        for node in main.nodes:
-            onosUninstallResult = onosUninstallResult and main.ONOSbench.onosUninstall( node.ip_address )
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=onosUninstallResult,
-                                 onpass="Successfully uninstalled ONOS package",
-                                 onfail="Failed to uninstall ONOS package" )
-        time.sleep( main.startUpSleep )
-
-        # Make sure ONOS process is not running
-        main.log.info( "Killing any ONOS processes" )
-        killResults = main.TRUE
-        for node in main.nodes:
-            killed = main.ONOSbench.onosKill( node.ip_address )
-            killResults = killResults and killed
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=onosUninstallResult,
-                                 onpass="Successfully kill all ONOS processes",
-                                 onfail="Failed to kill all ONOS processes" )
-
-        main.step( "Create cell file" )
-        main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
-                                       main.OVSDB1.ip_address,
-                                       cellAppString, ipList, main.ONOScli1.karafUser )
-
-        main.step( "Apply cell to environment" )
-        cellResult = main.ONOSbench.setCell( cellName )
-        verifyResult = main.ONOSbench.verifyCell()
-        stepResult = cellResult and verifyResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully applied cell to environment",
-                                 onfail="Failed to apply cell to environment" )
-
-        main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.buckBuild()
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=packageResult,
-                                 onpass="Successfully created ONOS package",
-                                 onfail="Failed to create ONOS package" )
-
-        time.sleep( main.startUpSleep )
-        main.step( "Installing ONOS package" )
-        onosInstallResult = main.ONOSbench.onosInstall( options="-f", node=main.nodes[ 0 ].ip_address )
-        utilities.assert_equals( expect=main.TRUE, actual=onosInstallResult,
-                                 onpass="Successfully installed ONOS package",
-                                 onfail="Failed to install ONOS package" )
-
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.TRUE
-        for i in range( int( main.numCtrls ) ):
-            secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.nodes[ i ].ip_address )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
-        time.sleep( main.startUpSleep )
-        main.step( "Starting ONOS service" )
-        stopResult = main.TRUE
-        startResult = main.TRUE
-        onos1Isup = main.TRUE
-        for i in range( 2 ):
-            Isup = main.ONOSbench.isup( main.nodes[ 0 ].ip_address )
-            onos1Isup = onos1Isup and Isup
-            if onos1Isup:
-                main.log.report( "ONOS instance {0} is up and ready".format( i + 1 ) )
-            else:
-                main.log.report( "ONOS instance {0} may not be up, stop and ".format( i + 1 ) +
-                                 "start ONOS again" )
-                stopResult = stopResult and main.ONOSbench.onosStop( main.ONOSip[ i ] )
-                startResult = startResult and main.ONOSbench.onosStart( main.ONOSip[ i ] )
-                if not startResult or stopResult:
-                    main.log.report( "ONOS instance {0} did not start correctly.".format( i + 1 ) )
-        stepResult = onos1Isup and stopResult and startResult
-        utilities.assert_equals( expect=main.TRUE, actual=stepResult,
-                                 onpass="ONOS service is ready on all nodes",
-                                 onfail="ONOS service did not start properly on all nodes" )
-
-        main.step( "Starting ONOS CLI sessions" )
-        cliResults = main.ONOScli1.startOnosCli( main.nodes[ 0 ].ip_address )
-        utilities.assert_equals( expect=main.TRUE, actual=cliResults,
-                                 onpass="Successfully start ONOS cli",
-                                 onfail="Failed to start ONOS cli" )
+        cliResults = main.testSetUp.ONOSSetUp( main.OVSDB1, cellName=cellName, removeLog=True )
 
         if cliResults == main.FALSE:
             main.log.error( "Failed to start ONOS, stopping test" )
diff --git a/TestON/tests/FUNC/FUNCvirNetNB/FUNCvirNetNB.py b/TestON/tests/FUNC/FUNCvirNetNB/FUNCvirNetNB.py
index 7734bdd..bdfe044 100644
--- a/TestON/tests/FUNC/FUNCvirNetNB/FUNCvirNetNB.py
+++ b/TestON/tests/FUNC/FUNCvirNetNB/FUNCvirNetNB.py
@@ -48,114 +48,31 @@
         import os
         main.log.info( "ONOS Single node Start " +
                        "VirtualNet Northbound test - initialization" )
-        main.case( "Setting up test environment" )
-        main.caseExplanation  = "Setup the test environment including " +\
-                                "installing ONOS,start ONOS."
+        try:
+            from tests.dependencies.ONOSSetup import ONOSSetup
+            main.testSetUp = ONOSSetup()
+        except ImportError:
+            main.log.error( "ONOSSetup not found. exiting the test" )
+            main.exit()
+        main.testSetUp.envSetupDescription()
+        stepResult = main.FALSE
+        try:
+            main.apps = main.params['ENV']['cellApps']
+            cellName = main.params['ENV']['cellName']
+            main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
+            stepResult = main.testSetUp.envSetup( hasNode=True )
+        except Exception as e:
+            main.testSetUp.envSetupException( e )
+        main.testSetUp.evnSetupConclusion( stepResult )
 
-        # load some variables from the params file
-        PULLCODE = False
-        if main.params[ 'GIT' ][ 'pull' ] == 'True':
-            PULLCODE = True
-        gitBranch = main.params[ 'GIT' ][ 'branch' ]
-        cellName = main.params[ 'ENV' ][ 'cellName' ]
-        ipList = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
+        main.maxNodes = 1
 
-        main.step( "Create cell file and apply to environment" )
-        cellAppString = main.params[ 'ENV' ][ 'cellApps' ]
-        main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
-                                       main.Mininet1.ip_address,
-                                       cellAppString, ipList, main.ONOScli1.karafUser )
+        cliResults = main.testSetUp.ONOSSetUp( main.Mininet1, cellName=cellName, removeLog=True )
 
-        cellResult = main.ONOSbench.setCell( cellName )
-        verifyResult = main.ONOSbench.verifyCell()
-
-        stepResult = cellResult and verifyResult
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=stepResult,
-                                 onpass="Successfully applied cell to " +
-                                        "environment",
-                                 onfail="Failed to apply cell to environment " )
-
-        #FIXME:this is short term fix
-        main.log.info( "Removing raft logs" )
-        main.ONOSbench.onosRemoveRaftLogs()
-
-        main.CLIs = []
-        main.nodes = []
-        main.numCtrls = 1
-        main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
-
-        for i in range( 1, main.numCtrls + 1 ):
-            try:
-                main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
-                main.nodes.append( getattr( main, 'ONOS' + str( i ) ) )
-                ipList.append( main.nodes[ -1 ].ip_address )
-            except AttributeError:
-                break
-
-        main.log.info( "Uninstalling ONOS" )
-        for node in main.nodes:
-            main.ONOSbench.onosUninstall( node.ip_address )
-
-        #Make sure ONOS is DEAD
-        main.log.info( "Killing any ONOS processes" )
-        killResults = main.TRUE
-        for node in main.nodes:
-            killed = main.ONOSbench.onosKill( node.ip_address )
-            killResults = killResults and killed
-
-        gitPullResult = main.TRUE
-        main.log.info( "Git checkout and pull " + gitBranch )
-        if PULLCODE:
-            main.ONOSbench.gitCheckout( gitBranch )
-            gitPullResult = main.ONOSbench.gitPull()
-            # values of 1 or 3 are good
-            utilities.assert_lesser( expect=0, actual=gitPullResult,
-                                      onpass="Git pull successful",
-                                      onfail="Git pull failed" )
-        main.ONOSbench.getVersion( report=True )
-
-        main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.buckBuild()
-        utilities.assert_equals( expect=main.TRUE,
-                                 actual=packageResult,
-                                 onpass="Successfully created ONOS package",
-                                 onfail="Failed to create ONOS package " )
-        time.sleep( main.startUpSleep )
-
-        main.step( "Installing ONOS package" )
-        onosInstallResult = main.ONOSbench.onosInstall(
-            options="-f", node=main.nodes[ 0 ].ip_address )
-        utilities.assert_equals( expect=main.TRUE, actual=onosInstallResult,
-                                 onpass="ONOS install successful",
-                                 onfail="ONOS install failed" )
-        time.sleep( main.startUpSleep )
-
-        main.step( "Set up ONOS secure SSH" )
-        secureSshResult = main.ONOSbench.onosSecureSSH( node=main.nodes[ 0 ].ip_address )
-        utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
-                                 onpass="Test step PASS",
-                                 onfail="Test step FAIL" )
-
-        main.step( "Checking if ONOS is up yet" )
-
-        for i in range( 2 ):
-            onos1Isup = main.ONOSbench.isup( main.nodes[ 0 ].ip_address )
-            if onos1Isup:
-                break
-        utilities.assert_equals( expect=main.TRUE, actual=onos1Isup,
-                                 onpass="ONOS startup successful",
-                                 onfail="ONOS startup failed" )
-        time.sleep( main.startUpSleep )
-
-        main.step( "Starting ONOS CLI sessions" )
-
-        print main.nodes[ 0 ].ip_address
-        cliResults = main.ONOScli1.startOnosCli( main.nodes[ 0 ].ip_address )
-        utilities.assert_equals( expect=main.TRUE, actual=cliResults,
-                                 onpass="ONOS cli startup successful",
-                                 onfail="ONOS cli startup failed" )
-        time.sleep( main.startUpSleep )
+        if cliResults == main.FALSE:
+            main.log.error( "Failed to start ONOS, stopping test" )
+            main.cleanup()
+            main.exit()
 
         main.step( "App Ids check" )
         appCheck = main.ONOScli1.appToIDCheck()
@@ -166,11 +83,6 @@
                                  onpass="App Ids seem to be correct",
                                  onfail="Something is wrong with app Ids" )
 
-        if cliResults == main.FALSE:
-            main.log.error( "Failed to start ONOS, stopping test" )
-            main.cleanup()
-            main.exit()
-
         main.step( "Install org.onosproject.vtn app" )
         installResults = main.ONOScli1.activateApp( "org.onosproject.vtn" )
         utilities.assert_equals( expect=main.TRUE, actual=installResults,