diff --git a/TestON/drivers/common/cli/emulator/remotemininetdriver.py b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
index 3b0b01b..c2c011a 100644
--- a/TestON/drivers/common/cli/emulator/remotemininetdriver.py
+++ b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
@@ -410,7 +410,6 @@
                 cmd = "sudo -E python opticalTest.py " + controller
                 main.log.info( self.name + ": cmd = " + cmd )
                 self.handle.sendline( cmd )
-                self.handle.expect( "Press ENTER to push Topology.json" )
                 time.sleep(30)
                 self.handle.sendline( "" )
                 self.handle.sendline( "" )
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index bb30335..a85214e 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -174,11 +174,14 @@
             main.cleanup()
             main.exit()
 
-    def cleanInstall( self, mciTimeout=600 ):
+    def cleanInstall( self, skipTest=False, mciTimeout=600 ):
         """
         Runs mvn clean install in the root of the ONOS directory.
         This will clean all ONOS artifacts then compile each module
-
+        Optional:
+            skipTest - Does "-DskipTests -Dcheckstyle.skip -U -T 1C" which
+                       skip the test. This will make the building faster.
+                       Disregarding the credibility of the build
         Returns: main.TRUE on success
         On Failure, exits the test
         """
@@ -191,8 +194,15 @@
 
             self.handle.sendline( "" )
             self.handle.expect( "\$" )
-            self.handle.sendline( "mvn clean install" )
-            self.handle.expect( "mvn clean install" )
+
+            if not skipTest:
+                self.handle.sendline( "mvn clean install" )
+                self.handle.expect( "mvn clean install" )
+            else:
+                self.handle.sendline( "mvn clean install -DskipTests" +
+                                      " -Dcheckstyle.skip -U -T 1C" )
+                self.handle.expect( "mvn clean install -DskipTests" +
+                                      " -Dcheckstyle.skip -U -T 1C" )
             while True:
                 i = self.handle.expect( [
                     'There\sis\sinsufficient\smemory\sfor\sthe\sJava\s' +
diff --git a/TestON/tests/IpOptical/IpOptical.params b/TestON/tests/IpOptical/IpOptical.params
new file mode 100755
index 0000000..62e44a8
--- /dev/null
+++ b/TestON/tests/IpOptical/IpOptical.params
@@ -0,0 +1,41 @@
+<PARAMS>
+    #20,21,22,25,10,23,24
+    <testcases>20,21,22,10,25,23,24</testcases>
+    #Environment variables
+    <ENV>
+        <cellName>driver_test</cellName>
+    </ENV>
+
+    <CTRL>
+        <ip1>10.128.20.11</ip1>
+        <port1>6633</port1>
+    </CTRL>
+
+    <PING>
+        <source1>h8</source1>
+        <source2>h9</source2>
+        <source3>h10</source3>
+        <source4>h11</source4>
+        <source5>h12</source5>
+        <source6>h13</source6>
+        <source7>h14</source7>
+        <source8>h15</source8>
+        <source9>h16</source9>
+        <source10>h17</source10>
+        <target1>10.0.0.18</target1>
+        <target2>10.0.0.19</target2>
+        <target3>10.0.0.20</target3>
+        <target4>10.0.0.21</target4>
+        <target5>10.0.0.22</target5>
+        <target6>10.0.0.23</target6>
+        <target7>10.0.0.24</target7>
+        <target8>10.0.0.25</target8>
+        <target9>10.0.0.26</target9>
+        <target10>10.0.0.27</target10>
+    </PING>
+
+    <timers>
+        <LinkDiscovery>5</LinkDiscovery>
+        <SwitchDiscovery>15</SwitchDiscovery>
+    </timers>
+</PARAMS>
diff --git a/TestON/tests/IpOptical/IpOptical.py b/TestON/tests/IpOptical/IpOptical.py
new file mode 100644
index 0000000..c4a4eb6
--- /dev/null
+++ b/TestON/tests/IpOptical/IpOptical.py
@@ -0,0 +1,630 @@
+
+# Testing the basic functionality of ONOS Next
+# For sanity and driver functionality excercises only.
+
+import time
+# import sys
+# import os
+# import re
+import json
+
+time.sleep( 1 )
+
+class IpOptical:
+
+    def __init__( self ):
+        self.default = ''
+
+    def CASE1( self, main ):
+        import time
+        """
+        Startup sequence:
+        cell <name>
+        onos-verify-cell
+        onos-remove-raft-log
+        git pull
+        mvn clean install
+        onos-package
+        onos-install -f
+        onos-wait-for-start
+        """
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+        main.case( "Setting up test environment" )
+        main.log.report(
+            "This testcase is testing setting up test environment" )
+        main.log.report( "__________________________________" )
+
+        main.step( "Applying cell variable to environment" )
+        cellResult = main.ONOSbench.setCell( cellName )
+        verifyResult = main.ONOSbench.verifyCell()
+
+        main.step( "Removing raft logs before a clen installation of ONOS" )
+        main.ONOSbench.onosRemoveRaftLogs()
+
+        main.step( "Git checkout and get version" )
+        #main.ONOSbench.gitCheckout( "master" )
+        gitPullResult = main.ONOSbench.gitPull()
+        main.log.info( "git_pull_result = " + str( gitPullResult ))
+        main.ONOSbench.getVersion( report=True )
+
+        if gitPullResult == 100:
+            main.step( "Using mvn clean & install" )
+            main.ONOSbench.cleanInstall()
+        elif gitPullResult == 0:
+            main.log.report(
+                "Git Pull Failed, look into logs for detailed reason" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Creating ONOS package" )
+        packageResult = main.ONOSbench.onosPackage()
+
+        main.step( "Uninstalling ONOS package" )
+        ONOSip1 = main.params[ 'CTRL' ][ 'ip1' ]
+        onosUninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOSip1)
+        if onosUninstallResult:
+            main.log.report( "Uninstalling ONOS package successful" )
+        else:
+            main.log.report( "Uninstalled ONOS package unsucessful" )
+        time.sleep( 5 )
+        main.step( "Installing ONOS package" )
+        onosInstallResult = main.ONOSbench.onosInstall( node = ONOSip1 )
+        if onosInstallResult == main.TRUE:
+            main.log.report( "Installing ONOS package successful" )
+        else:
+            main.log.report( "Installing ONOS package failed" )
+
+        onos1Isup = main.ONOSbench.isup()
+        if onos1Isup == main.TRUE:
+            main.log.report( "ONOS instance is up and ready" )
+        else:
+            main.log.report( "ONOS instance may not be up" )
+
+        main.step( "Starting ONOS service" )
+        startResult = main.ONOSbench.onosStart( ONOS1Ip )
+
+        main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+        main.step( "Starting Mininet CLI..." )
+        
+    def CASE20( self ):
+        """
+            Exit from mininet cli
+            reinstall ONOS
+        """
+        import time
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+        main.log.report( "This testcase exits the mininet cli and reinstalls" +
+                         "ONOS to switch over to Packet Optical topology" )
+        main.log.report( "_____________________________________________" )
+        main.case( "Disconnecting mininet and restarting ONOS" )
+
+        main.step( "Disconnecting mininet and restarting ONOS" )
+        step1Result = main.TRUE
+        mininetDisconnect = main.Mininet1.disconnect()
+        print "mininetDisconnect = ", mininetDisconnect
+        step1Result = mininetDisconnect
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Mininet disconnect successfully",
+            onfail="Mininet failed to disconnect")
+        """
+        main.step( "Removing raft logs before a clean installation of ONOS" )
+        step2Result = main.TRUE
+        removeRaftLogsResult = main.ONOSbench.onosRemoveRaftLogs()
+        step2Result = removeRaftLogsResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Raft logs removed successfully",
+            onfail="Failed to remove raft logs")
+        """
+        main.step( "Applying cell variable to environment" )
+        step3Result = main.TRUE
+        setCellResult = main.ONOSbench.setCell( cellName )
+        verifyCellResult = main.ONOSbench.verifyCell()
+        step3Result = setCellResult and verifyCellResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step3Result,
+            onpass="Cell applied successfully",
+            onfail="Failed to apply cell")
+
+        main.step( "Uninstalling ONOS package" )
+        step4Result = main.TRUE
+        ONOSip1 = main.params[ 'CTRL' ][ 'ip1' ]
+        onosUninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOSip1)
+        step4Result = onosUninstallResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step4Result,
+            onpass="Successfully uninstalled ONOS",
+            onfail="Failed to uninstall ONOS")
+
+        time.sleep( 5 )
+        main.step( "Installing ONOS package" )
+        step5Result = main.TRUE
+        onosInstallResult = main.ONOSbench.onosInstall( node = ONOSip1 )
+        step5Result = onosInstallResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step5Result,
+            onpass="Successfully installed ONOS",
+            onfail="Failed to install ONOS")
+
+        onos1Isup = main.ONOSbench.isup()
+        if onos1Isup == main.TRUE:
+            main.log.report( "ONOS instance is up and ready" )
+        else:
+            main.log.report( "ONOS instance may not be up" )
+
+        main.step( "Starting ONOS service" )
+        step6Result = main.TRUE
+        startResult = main.ONOSbench.onosStart( ONOS1Ip )
+        step6Result = startResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step6Result,
+            onpass="Successfully started ONOS",
+            onfail="Failed to start ONOS")
+
+        main.step( "Starting ONOS cli" )
+        step7Result = main.TRUE
+        cliResult = main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+        step7Result = cliResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step7Result,
+            onpass="Successfully started ONOS cli",
+            onfail="Failed to start ONOS cli")
+
+    def CASE21( self, main ):
+        """
+            On ONOS bench, run this command:
+            sudo -E python ~/onos/tools/test/topos/opticalTest.py -OC1
+            which spawns packet optical topology and copies the links
+            json file to the onos instance.
+            Note that in case of Packet Optical, the links are not learnt
+            from the topology, instead the links are learnt
+            from the json config file
+        """
+        import time
+        main.log.report(
+            "This testcase starts the packet layer topology and REST" )
+        main.log.report( "_____________________________________________" )
+        main.case( "Starting LINC-OE and other components" )
+
+        main.step( "Activate optical app" )
+        step1Result = main.TRUE
+        activateOpticalResult = main.ONOS2.activateApp( "org.onosproject.optical" )
+        step1Result = activateOpticalResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully activated optical app",
+            onfail="Failed to activate optical app")
+
+        appCheck = main.ONOS2.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOS2.apps() )
+            main.log.warn( main.ONOS2.appIDs() )
+
+        main.step( "Starting mininet and LINC-OE" )
+        step2Result = main.TRUE
+        time.sleep( 10 )
+        opticalMnScript = main.LincOE2.runOpticalMnScript(ctrllerIP = main.params[ 'CTRL' ][ 'ip1' ])
+        step2Result = opticalMnScript
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Started the topology successfully ",
+            onfail="Failed to start the topology")
+
+    def CASE22( self, main ):
+        """
+            Curretly we use, 10 optical switches(ROADM's) and
+            6 packet layer mininet switches each with one host.
+            Therefore, the roadmCount variable = 10,
+            packetLayerSWCount variable = 6, hostCount=6 and
+            links=46.
+            All this is hardcoded in the testcase. If the topology changes,
+            these hardcoded values need to be changed
+        """
+        import time
+        main.log.report(
+            "This testcase compares the optical+packet topology against what" +
+            " is expected" )
+        main.case( "Topology comparision" )
+
+        main.step( "Starts new ONOS cli" )
+        step1Result = main.TRUE
+        cliResult = main.ONOS3.startOnosCli( ONOSIp=main.params[ 'CTRL' ]\
+                                                               [ 'ip1' ] )
+        step1Result = cliResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully starts a new cli",
+            onfail="Failed to start new cli" )
+
+        main.step( "Compare topology" )
+        step2Result = main.TRUE
+        devicesResult = main.ONOS3.devices( jsonFormat=False )
+        print "devices_result :\n", devicesResult
+        devicesLinewise = devicesResult.split( "\n" )
+        roadmCount = 0
+        packetLayerSWCount = 0
+        for line in devicesLinewise:
+            components = line.split( "," )
+            availability = components[ 1 ].split( "=" )[ 1 ]
+            type = components[ 3 ].split( "=" )[ 1 ]
+            if availability == 'true' and type == 'ROADM':
+                roadmCount += 1
+            elif availability == 'true' and type == 'SWITCH':
+                packetLayerSWCount += 1
+        if roadmCount == 10:
+            print "Number of Optical Switches = %d and is" % roadmCount +\
+                  " correctly detected"
+            main.log.info(
+                "Number of Optical Switches = " +
+                str( roadmCount ) +
+                " and is correctly detected" )
+            opticalSWResult = main.TRUE
+        else:
+            print "Number of Optical Switches = %d and is wrong" % roadmCount
+            main.log.info(
+                "Number of Optical Switches = " +
+                str( roadmCount ) +
+                " and is wrong" )
+            opticalSWResult = main.FALSE
+        if packetLayerSWCount == 6:
+            print "Number of Packet layer or mininet Switches = %d "\
+                    % packetLayerSWCount + "and is correctly detected"
+            main.log.info(
+                "Number of Packet layer or mininet Switches = " +
+                str( packetLayerSWCount ) +
+                " and is correctly detected" )
+            packetSWResult = main.TRUE
+        else:
+            print "Number of Packet layer or mininet Switches = %d and"\
+                    % packetLayerSWCount + " is wrong"
+            main.log.info(
+                "Number of Packet layer or mininet Switches = " +
+                str( packetLayerSWCount ) +
+                " and is wrong" )
+            packetSWResult = main.FALSE
+        # sleeps for sometime so the state of the switches will be active
+        time.sleep( 30 )
+        print "_________________________________"
+        linksResult = main.ONOS3.links( jsonFormat=False )
+        print "links_result = ", linksResult
+        print "_________________________________"
+        linkActiveCount = linksResult.count("state=ACTIVE")
+        main.log.info( "linkActiveCount = " + str( linkActiveCount ))
+        if linkActiveCount == 46:
+            linkActiveResult = main.TRUE
+            main.log.info(
+                "Number of links in ACTIVE state are correct")
+        else:
+            linkActiveResult = main.FALSE
+            main.log.info(
+                "Number of links in ACTIVE state are wrong")
+        step2Result = opticalSWResult and packetSWResult and \
+                        linkActiveResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Successfully loaded packet optical topology",
+            onfail="Failed to load packet optical topology" )
+
+    def CASE23( self, main ):
+        import time
+        """
+            Add bidirectional point intents between 2 packet layer( mininet )
+            devices and
+            ping mininet hosts
+        """
+        main.log.report(
+            "This testcase adds bidirectional point intents between 2 " +
+            "packet layer( mininet ) devices and ping mininet hosts" )
+        main.case( "Install point intents between 2 packet layer device and " +
+                   "ping the hosts" )
+
+        main.step( "Adding point intents" )
+        checkFlowResult = main.TRUE
+        step1Result = main.TRUE
+        main.pIntentsId = []
+        pIntent1 = main.ONOS3.addPointIntent(
+            "of:0000ffffffff0001/1",
+            "of:0000ffffffff0005/1" )
+        time.sleep( 10 )
+        pIntent2 = main.ONOS3.addPointIntent(
+            "of:0000ffffffff0005/1",
+            "of:0000ffffffff0001/1" )
+        main.pIntentsId.append( pIntent1 )
+        main.pIntentsId.append( pIntent2 )
+        time.sleep( 10 )
+        main.log.info( "Checking intents state")
+        checkStateResult = main.ONOS3.checkIntentState(
+                                                  intentsId = main.pIntentsId )
+        time.sleep( 10 )
+        main.log.info( "Checking flows state")
+        checkFlowResult = main.ONOS3.checkFlowsState()
+        # Sleep for 30 seconds to provide time for the intent state to change
+        time.sleep( 10 )
+        main.log.info( "Checking intents state one more time")
+        checkStateResult = main.ONOS3.checkIntentState(
+                                                  intentsId = main.pIntentsId )
+        step1Result = checkStateResult and checkFlowResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully added point intents",
+            onfail="Failed to add point intents")
+
+        print main.ONOS3.intents()
+
+        main.step( "Ping h1 and h5" )
+        step2Result = main.TRUE
+        main.log.info( "\n\nh1 is Pinging h5" )
+        pingResult = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+        step2Result = pingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Successfully pinged h1 and h5",
+            onfail="Failed to ping between h1 and h5")
+
+    def CASE24( self, main ):
+        import time
+        import json
+        """
+            LINC uses its own switch IDs. You can use the following
+            command on the LINC console to find the mapping between 
+            DPIDs and LINC IDs.
+            rp(application:get_all_key(linc)).
+            
+            Test Rerouting of Packet Optical by bringing a port down
+            ( port 20 ) of a switch( switchID=1, or LincOE switchID =9 ), 
+            so that link
+            ( between switch1 port20 - switch5 port50 ) is inactive
+            and do a ping test. If rerouting is successful,
+            ping should pass. also check the flows
+        """
+        main.log.report(
+            "This testcase tests rerouting and pings mininet hosts" )
+        main.case( "Test rerouting and pings mininet hosts" )
+
+        main.step( "Attach to the Linc-OE session" )
+        step1Result = main.TRUE
+        attachConsole = main.LincOE1.attachLincOESession()
+        step1Result = attachConsole
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully attached Linc-OE session",
+            onfail="Failed to attached Linc-OE session")
+
+        main.step( "Bring a port down and verify the link state" )
+        step2Result = main.TRUE
+        main.LincOE1.portDown( swId="9", ptId="20" )
+        linksNonjson = main.ONOS3.links( jsonFormat=False )
+        main.log.info( "links = " + linksNonjson )
+        linkInactiveCount = linksNonjson.count( "state=INACTIVE" )
+        main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+        if linkInactiveCount == 2:
+            main.log.info(
+                "Number of links in INACTIVE state are correct")
+        else:
+            main.log.info(
+                "Number of links in INACTIVE state are wrong")
+        links = main.ONOS3.links()
+        main.log.info( "links = " + links )
+        linksResult = json.loads( links )
+        linksStateResult = main.FALSE
+        for item in linksResult:
+            if item[ 'src' ][ 'device' ] == "of:0000ffffffffff01" and item[
+                    'src' ][ 'port' ] == "20":
+                if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff05" and item[
+                        'dst' ][ 'port' ] == "50":
+                    linksState = item[ 'state' ]
+                    if linksState == "INACTIVE":
+                        main.log.info(
+                            "Links state is inactive as expected due to one" +
+                            " of the ports being down" )
+                        main.log.report(
+                            "Links state is inactive as expected due to one" +
+                            " of the ports being down" )
+                        linksStateResult = main.TRUE
+                        break
+                    else:
+                        main.log.info(
+                            "Links state is not inactive as expected" )
+                        main.log.report(
+                            "Links state is not inactive as expected" )
+                        linksStateResult = main.FALSE
+        time.sleep( 10 )
+        #checkFlowsState = main.ONOS3.checkFlowsState()
+        step2Result = linksStateResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Successfuly brought down a link",
+            onfail="Failed to bring down a link")
+
+        main.step( "Verify Rerouting by a ping test" )
+        step3Result = main.TRUE
+        main.log.info( "\n\nh1 is Pinging h5" )
+        pingResult = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+        step3Result = pingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step3Result,
+            onpass="Successfully pinged h1 and h5",
+            onfail="Failed to ping between h1 and h5")
+
+        main.step( "Bring the downed port up and verify the link state" )
+        step4Result = main.TRUE
+        main.LincOE1.portUp( swId="9", ptId="20" )
+        linksNonjson = main.ONOS3.links( jsonFormat=False )
+        main.log.info( "links = " + linksNonjson )
+        linkInactiveCount = linksNonjson.count( "state=INACTIVE" )
+        time.sleep( 30 )
+        main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+        if linkInactiveCount == 0:
+            main.log.info(
+                "Number of links in INACTIVE state are correct")
+        else:
+            main.log.info(
+                "Number of links in INACTIVE state are wrong")
+            step4Result = main.FALSE
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step4Result,
+            onpass="Successfully brought the port up",
+            onfail="Failed to bring the port up")
+        """
+        main.step( "Removing host intents" )
+        step5Result = main.TRUE
+        removeResult = main.TRUE
+        # Check remaining intents
+        intentsJson = json.loads( main.ONOS3.intents() )
+        main.ONOS3.removeIntent( intentId=intent1, purge=True )
+        main.ONOS3.removeIntent( intentId=intent2, purge=True )
+        for intents in intentsJson:
+            main.ONOS3.removeIntent( intentId=intents.get( 'id' ),
+                                     app='org.onosproject.optical',
+                                     purge=True )
+        print json.loads( main.ONOS3.intents() )
+        if len( json.loads( main.ONOS3.intents() ) ):
+            removeResult = main.FALSE
+        step5Result = removeResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=step5Result,
+                                 onpass="Successfully removed host intents",
+                                 onfail="Failed to remove host intents" )
+        """
+    def CASE10( self ):
+        main.log.report(
+            "This testcase uninstalls the reactive forwarding app" )
+        main.log.report( "__________________________________" )
+        main.case( "Uninstalling reactive forwarding app" )
+        main.step( "Uninstalling reactive forwarding app" )
+        step1Result = main.TRUE
+        # Unistall onos-app-fwd app to disable reactive forwarding
+        main.log.info( "deactivate reactive forwarding app" )
+        appUninstallResult = main.ONOS2.deactivateApp( "org.onosproject.fwd" )
+        appCheck = main.ONOS2.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOS2.apps() )
+            main.log.warn( main.ONOS2.appIDs() )
+        step1Result = appUninstallResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully deactivate reactive forwarding app",
+            onfail="Failed to deactivate reactive forwarding app")
+        # After reactive forwarding is disabled, the reactive flows on
+        # switches timeout in 10-15s
+        # So sleep for 15s
+        time.sleep( 15 )
+        flows = main.ONOS2.flows()
+        main.log.info( flows )
+
+    def CASE25( self ):
+        """
+            Add host intents between 2 packet layer host
+        """
+        import time
+        import json
+        main.log.report( "Adding host intents between 2 optical layer host" )
+        main.case( "Test add host intents between optical layer host" )
+
+        main.step( "Discover host using arping" )
+        step1Result = main.TRUE
+        main.hostMACs = []
+        main.hostId = []
+        #Listing host MAC addresses
+        for i in range( 1 , 7 ):
+            main.hostMACs.append( "00:00:00:00:00:" +
+                                str( hex( i )[ 2: ] ).zfill( 2 ).upper() )
+        for macs in main.hostMACs:
+            main.hostId.append( macs + "/-1" )
+        host1 = main.hostId[ 0 ]
+        host2 = main.hostId[ 1 ]
+        # Use arping to discover the hosts
+        main.LincOE2.arping( host = "h1" )
+        main.LincOE2.arping( host = "h2" )
+        time.sleep( 5 )
+        hostsDict = main.ONOS3.hosts()
+        if not len( hostsDict ):
+            step1Result = main.FALSE
+        # Adding host intent
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Hosts discovered",
+            onfail="Failed to discover hosts")
+
+        main.step( "Adding host intents to h1 and h2" )
+        step2Result = main.TRUE
+        intentsId = []
+        intent1 = main.ONOS3.addHostIntent( hostIdOne = host1,
+                                            hostIdTwo = host2 )
+        intentsId.append( intent1 )
+        """
+        intent2 = main.ONOS3.addHostIntent( hostIdOne = host2,
+                                            hostIdTwo = host1 )
+        intentsId.append( intent2 )
+        """
+        # Checking intents state before pinging
+        main.log.info( "Checking intents state" )
+        time.sleep( 15 )
+        intentResult = main.ONOS3.checkIntentState( intentsId = intentsId )
+        #check intent state again if intents are not in installed state
+        print main.ONOS3.intents()
+        if not intentResult:
+           intentResult = main.ONOS3.checkIntentState( intentsId = intentsId )
+        step2Result = intentResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=step2Result,
+                                 onpass="All intents are in INSTALLED state ",
+                                 onfail="Some of the intents are not in " +
+                                        "INSTALLED state " )
+
+        # pinging h1 to h2 and then ping h2 to h1
+        main.step( "Pinging h1 and h2" )
+        step3Result = main.TRUE
+        pingResult = main.TRUE
+        pingResult = main.LincOE2.pingHostOptical( src="h1", target="h2" )
+        pingResult = pingResult and main.LincOE2.pingHostOptical( src="h2",
+                                                                  target="h1" )
+        step3Result = pingResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=step3Result,
+                                 onpass="Pinged successfully between h1 and h2",
+                                 onfail="Pinged failed between h1 and h2" )
+        # Removed all added host intents
+        main.step( "Removing host intents" )
+        step4Result = main.TRUE
+        removeResult = main.TRUE
+        # Check remaining intents
+        intentsJson = json.loads( main.ONOS3.intents() )
+        main.ONOS3.removeIntent( intentId=intent1, purge=True )
+        #main.ONOS3.removeIntent( intentId=intent2, purge=True )
+        for intents in intentsJson:
+            main.ONOS3.removeIntent( intentId=intents.get( 'id' ),
+                                     app='org.onosproject.optical',
+                                     purge=True )
+        print json.loads( main.ONOS3.intents() )
+        if len( json.loads( main.ONOS3.intents() ) ):
+            removeResult = main.FALSE
+        step4Result = removeResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=step4Result,
+                                 onpass="Successfully removed host intents",
+                                 onfail="Failed to remove host intents" )
diff --git a/TestON/tests/IpOptical/IpOptical.topo b/TestON/tests/IpOptical/IpOptical.topo
new file mode 100755
index 0000000..9cef3f7
--- /dev/null
+++ b/TestON/tests/IpOptical/IpOptical.topo
@@ -0,0 +1,92 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOSbench>
+
+        <ONOS1>
+            <host>10.128.10.11</host>
+            <user>sdn</user>
+            <password>sdn</password>
+            <type>OnosDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1>
+
+        <ONOS2>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS2>
+
+         <ONOS3>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS3>
+       
+
+        <Mininet1>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS>
+                #Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+                <arg2> --topo mytopo </arg2>
+                <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet1>
+
+        <Mininet2>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>RemoteMininetDriver</type>
+            <connect_order>6</connect_order>
+            <COMPONENTS>
+                #Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+                <arg2> --topo mytopo </arg2>
+                <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet2>
+
+        <LincOE1>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>LincOEDriver</type>
+            <connect_order>7</connect_order>
+            <COMPONENTS>
+            </COMPONENTS>
+        </LincOE1>
+
+        <LincOE2>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>RemoteMininetDriver</type>
+            <connect_order>8</connect_order>
+            <COMPONENTS>
+            </COMPONENTS>
+        </LincOE2>
+
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/IpOptical/__init__.py b/TestON/tests/IpOptical/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/IpOptical/__init__.py
diff --git a/TestON/tests/IpOpticalMulti/IpOpticalMulti.params b/TestON/tests/IpOpticalMulti/IpOpticalMulti.params
new file mode 100755
index 0000000..c17bf21
--- /dev/null
+++ b/TestON/tests/IpOpticalMulti/IpOpticalMulti.params
@@ -0,0 +1,64 @@
+<PARAMS>
+    
+    <testcases>20,21,22,10,25,23,24</testcases>
+    #Environment variables
+    <ENV>
+        <cellName>multi_test</cellName>
+    </ENV>
+
+    <CTRL>
+        <ip1>10.128.20.11</ip1>
+        <ip2>10.128.20.12</ip2>
+        <ip3>10.128.20.13</ip3>
+        <port1>6633</port1>
+        <port2>6633</port2>
+        <port3>6633</port3>
+    </CTRL>
+
+    <SDNIP>
+        <ethType>IPV4</ethType>
+        <tcpProto>6</tcpProto>
+        <icmpProto>1</icmpProto>
+        <srcPort>5001</srcPort>
+        <dstPort>5001</dstPort>
+    </SDNIP>
+
+    <MULTIPOINT_INTENT>
+        <device1>of:0000000000003008/1 </device1>
+        <device2>of:0000000000003009/1 </device2>
+        <device3>of:0000000000003010/1 </device3>
+        <mac1>00:00:00:00:00:0A </mac1>
+        <mac2>00:00:00:00:00:08 </mac2>
+        <ip1>10.0.3.0/24 </ip1>
+        <ip2>10.0.1.0/24 </ip2>
+    </MULTIPOINT_INTENT>
+
+    <PING>
+        <source1>h8</source1>
+        <source2>h9</source2>
+        <source3>h10</source3>
+        <source4>h11</source4>
+        <source5>h12</source5>
+        <source6>h13</source6>
+        <source7>h14</source7>
+        <source8>h15</source8>
+        <source9>h16</source9>
+        <source10>h17</source10>
+        <target1>10.0.0.18</target1>
+        <target2>10.0.0.19</target2>
+        <target3>10.0.0.20</target3>
+        <target4>10.0.0.21</target4>
+        <target5>10.0.0.22</target5>
+        <target6>10.0.0.23</target6>
+        <target7>10.0.0.24</target7>
+        <target8>10.0.0.25</target8>
+        <target9>10.0.0.26</target9>
+        <target10>10.0.0.27</target10>
+    </PING>
+
+    <timers>
+        <LinkDiscovery>5</LinkDiscovery>
+        <SwitchDiscovery>31</SwitchDiscovery>
+    </timers>
+
+</PARAMS>
diff --git a/TestON/tests/IpOpticalMulti/IpOpticalMulti.py b/TestON/tests/IpOpticalMulti/IpOpticalMulti.py
new file mode 100644
index 0000000..ff09766
--- /dev/null
+++ b/TestON/tests/IpOpticalMulti/IpOpticalMulti.py
@@ -0,0 +1,703 @@
+
+# Testing the basic functionality of ONOS Next
+# For sanity and driver functionality excercises only.
+
+import time
+import sys
+import os
+import re
+import time
+import json
+
+time.sleep( 1 )
+
+class IpOpticalMulti:
+
+    def __init__( self ):
+        self.default = ''
+
+    def CASE1( self, main ):
+        """
+        Startup sequence:
+        cell <name>
+        onos-verify-cell
+        onos-remove-raft-logs
+        git pull
+        mvn clean install
+        onos-package
+        onos-install -f
+        onos-wait-for-start
+        """
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
+        ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
+        ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
+        ONOS2Port = main.params[ 'CTRL' ][ 'port2' ]
+        ONOS3Port = main.params[ 'CTRL' ][ 'port3' ]
+
+        main.case( "Setting up test environment" )
+        main.log.report(
+            "This testcase is testing setting up test environment" )
+        main.log.report( "__________________________________" )
+
+        main.step( "Applying cell variable to environment" )
+        cellResult1 = main.ONOSbench.setCell( cellName )
+        # cellResult2 = main.ONOScli1.setCell( cellName )
+        # cellResult3 = main.ONOScli2.setCell( cellName )
+        # cellResult4 = main.ONOScli3.setCell( cellName )
+        verifyResult = main.ONOSbench.verifyCell()
+        cellResult = cellResult1
+
+        main.step( "Removing raft logs before a clen installation of ONOS" )
+        removeLogResult = main.ONOSbench.onosRemoveRaftLogs()
+
+        main.step( "Git checkout, pull and get version" )
+        #main.ONOSbench.gitCheckout( "master" )
+        gitPullResult = main.ONOSbench.gitPull()
+        main.log.info( "git_pull_result = " + str( gitPullResult ))
+        versionResult = main.ONOSbench.getVersion( report=True )
+
+        if gitPullResult == 100:
+            main.step( "Using mvn clean & install" )
+            cleanInstallResult = main.ONOSbench.cleanInstall()
+            # cleanInstallResult = main.TRUE
+
+        main.step( "Creating ONOS package" )
+        packageResult = main.ONOSbench.onosPackage()
+
+        # main.step( "Creating a cell" )
+        # cellCreateResult = main.ONOSbench.createCellFile( **************
+        # )
+
+        main.step( "Installing ONOS package" )
+        onos1InstallResult = main.ONOSbench.onosInstall(
+            options="-f",
+            node=ONOS1Ip )
+        onos2InstallResult = main.ONOSbench.onosInstall(
+            options="-f",
+            node=ONOS2Ip )
+        onos3InstallResult = main.ONOSbench.onosInstall(
+            options="-f",
+            node=ONOS3Ip )
+        onosInstallResult = onos1InstallResult and onos2InstallResult and\
+                onos3InstallResult
+        if onosInstallResult == main.TRUE:
+            main.log.report( "Installing ONOS package successful" )
+        else:
+            main.log.report( "Installing ONOS package failed" )
+
+        onos1Isup = main.ONOSbench.isup( ONOS1Ip )
+        onos2Isup = main.ONOSbench.isup( ONOS2Ip )
+        onos3Isup = main.ONOSbench.isup( ONOS3Ip )
+        onosIsup = onos1Isup and onos2Isup and onos3Isup
+        if onosIsup == main.TRUE:
+            main.log.report( "ONOS instances are up and ready" )
+        else:
+            main.log.report( "ONOS instances may not be up" )
+
+        main.step( "Starting ONOS service" )
+        startResult = main.TRUE
+        # startResult = main.ONOSbench.onosStart( ONOS1Ip )
+        startcli1 = main.ONOScli1.startOnosCli( ONOSIp=ONOS1Ip )
+        startcli2 = main.ONOScli2.startOnosCli( ONOSIp=ONOS2Ip )
+        startcli3 = main.ONOScli3.startOnosCli( ONOSIp=ONOS3Ip )
+        print startcli1
+        print startcli2
+        print startcli3
+
+        case1Result = ( packageResult and
+                        cellResult and verifyResult and onosInstallResult and
+                        onosIsup and startResult )
+        utilities.assertEquals( expect=main.TRUE, actual=case1Result,
+                                onpass="Test startup successful",
+                                onfail="Test startup NOT successful" )
+
+    def CASE20( self ):
+        """
+            Exit from mininet cli
+            reinstall ONOS
+        """
+        import time
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
+        ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
+        ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
+        ONOS2Port = main.params[ 'CTRL' ][ 'port2' ]
+        ONOS3Port = main.params[ 'CTRL' ][ 'port3' ]
+
+
+        main.log.report( "This testcase exits the mininet cli and reinstalls" +
+                         "ONOS to switch over to Packet Optical topology" )
+        main.log.report( "_____________________________________________" )
+        main.case( "Disconnecting mininet and restarting ONOS" )
+
+        main.step( "Disconnecting mininet and restarting ONOS" )
+        step1Result = main.TRUE
+        mininetDisconnect = main.Mininet1.disconnect()
+        print "mininetDisconnect = ", mininetDisconnect
+        step1Result = mininetDisconnect
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Mininet disconnect successfully",
+            onfail="Mininet failed to disconnect")
+        """
+        main.step( "Removing raft logs before a clean installation of ONOS" )
+        step2Result = main.TRUE
+        removeRaftLogsResult = main.ONOSbench.onosRemoveRaftLogs()
+        step2Result = removeRaftLogsResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Raft logs removed successfully",
+            onfail="Failed to remove raft logs")
+        """
+        main.step( "Applying cell variable to environment" )
+        step3Result = main.TRUE
+        setCellResult = main.ONOSbench.setCell( cellName )
+        verifyCellResult = main.ONOSbench.verifyCell()
+        step3Result = setCellResult and verifyCellResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step3Result,
+            onpass="Cell applied successfully",
+            onfail="Failed to apply cell")
+
+        main.step( "Uninstalling ONOS package" )
+        step4Result = main.TRUE
+        onos1UninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOS1Ip)
+        onos2UninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOS2Ip)
+        onos3UninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOS3Ip)
+        onosUninstallResult = onos1UninstallResult and onos2UninstallResult \
+                              and onos3UninstallResult
+        step4Result = onosUninstallResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step4Result,
+            onpass="Successfully uninstalled ONOS",
+            onfail="Failed to uninstall ONOS")
+
+        time.sleep( 5 )
+        main.step( "Installing ONOS package" )
+        step5Result = main.TRUE
+        onos1InstallResult = main.ONOSbench.onosInstall(
+            options="-f",
+            node=ONOS1Ip )
+        onos2InstallResult = main.ONOSbench.onosInstall(
+            options="-f",
+            node=ONOS2Ip )
+        onos3InstallResult = main.ONOSbench.onosInstall(
+            options="-f",
+            node=ONOS3Ip )
+        onosInstallResult = onos1InstallResult and onos2InstallResult and\
+                onos3InstallResult
+
+        onos1Isup = main.ONOSbench.isup( ONOS1Ip )
+        onos2Isup = main.ONOSbench.isup( ONOS2Ip )
+        onos3Isup = main.ONOSbench.isup( ONOS3Ip )
+        onosIsUp = onos1Isup and onos2Isup and onos3Isup
+        if onosIsUp == main.TRUE:
+            main.log.report( "ONOS instances are up and ready" )
+        else:
+            main.log.report( "ONOS instances may not be up" )
+        step5Result = onosInstallResult and onosIsUp
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step5Result,
+            onpass="Successfully installed ONOS",
+            onfail="Failed to install ONOS")
+
+        main.step( "Starting ONOS service" )
+        step6Result = main.TRUE
+        startResult = main.ONOSbench.onosStart( ONOS1Ip )
+        step6Result = startResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step6Result,
+            onpass="Successfully started ONOS",
+            onfail="Failed to start ONOS")
+
+        main.step( "Starting ONOS cli" )
+        step7Result = main.TRUE
+        startcli1 = main.ONOScli1.startOnosCli( ONOSIp=ONOS1Ip )
+        startcli2 = main.ONOScli2.startOnosCli( ONOSIp=ONOS2Ip )
+        startcli3 = main.ONOScli3.startOnosCli( ONOSIp=ONOS3Ip )
+        startResult = startcli1 and startcli2 and startcli3
+        step7Result = startResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step7Result,
+            onpass="Successfully started ONOS cli",
+            onfail="Failed to start ONOS cli")
+
+        case20Result = step1Result and step3Result and\
+                       step4Result and step5Result and step6Result and\
+                       step7Result
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case20Result,
+            onpass= "Exiting functionality mininet topology and reinstalling" +
+                    " ONOS successful",
+            onfail= "Exiting functionality mininet topology and reinstalling" +
+                    " ONOS failed" )
+
+    def CASE21( self, main ):
+        """
+            On ONOS bench, run this command:
+            sudo -E python ~/onos/tools/test/topos/opticalTest.py -OC1
+            which spawns packet optical topology and copies the links
+            json file to the onos instance.
+            Note that in case of Packet Optical, the links are not learnt
+            from the topology, instead the links are learnt
+            from the json config file
+        """
+        import time
+        main.log.report(
+            "This testcase starts the packet layer topology and REST" )
+        main.log.report( "_____________________________________________" )
+        main.case( "Starting LINC-OE and other components" )
+
+        main.step( "Activate optical app" )
+        step1Result = main.TRUE
+        activateOpticalResult = main.ONOScli2.activateApp( "org.onosproject.optical" )
+        step1Result = activateOpticalResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully activated optical app",
+            onfail="Failed to activate optical app")
+
+        appCheck = main.ONOScli2.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOScli2.apps() )
+            main.log.warn( main.ONOScli2.appIDs() )
+
+        main.step( "Starting mininet and LINC-OE" )
+        step2Result = main.TRUE
+        time.sleep( 10 )
+        opticalMnScript = main.LincOE2.runOpticalMnScript(ctrllerIP = main.params[ 'CTRL' ][ 'ip1' ])
+        step2Result = opticalMnScript
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Started the topology successfully ",
+            onfail="Failed to start the topology")
+
+        case21Result = step1Result and step2Result
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case21Result,
+            onpass="Packet optical topology spawned successsfully",
+            onfail="Packet optical topology spawning failed" )
+
+    def CASE22( self, main ):
+        """
+            Curretly we use, 10 optical switches(ROADM's) and
+            6 packet layer mininet switches each with one host.
+            Therefore, the roadmCount variable = 10,
+            packetLayerSWCount variable = 6, hostCount=6 and
+            links=46.
+            All this is hardcoded in the testcase. If the topology changes,
+            these hardcoded values need to be changed
+        """
+        import time
+        main.log.report(
+            "This testcase compares the optical+packet topology against what" +
+            " is expected" )
+        main.case( "Topology comparision" )
+
+        main.step( "Starts new ONOS cli" )
+        step1Result = main.TRUE
+        cliResult = main.ONOScli1.startOnosCli( ONOSIp=main.params[ 'CTRL' ]\
+                                                               [ 'ip1' ] )
+        step1Result = cliResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully starts a new cli",
+            onfail="Failed to start new cli" )
+
+        main.step( "Compare topology" )
+        step2Result = main.TRUE
+        devicesResult = main.ONOScli1.devices( jsonFormat=False )
+        print "devices_result :\n", devicesResult
+        devicesLinewise = devicesResult.split( "\n" )
+        roadmCount = 0
+        packetLayerSWCount = 0
+        for line in devicesLinewise:
+            components = line.split( "," )
+            availability = components[ 1 ].split( "=" )[ 1 ]
+            type = components[ 3 ].split( "=" )[ 1 ]
+            if availability == 'true' and type == 'ROADM':
+                roadmCount += 1
+            elif availability == 'true' and type == 'SWITCH':
+                packetLayerSWCount += 1
+        if roadmCount == 10:
+            print "Number of Optical Switches = %d and is" % roadmCount +\
+                  " correctly detected"
+            main.log.info(
+                "Number of Optical Switches = " +
+                str( roadmCount ) +
+                " and is correctly detected" )
+            opticalSWResult = main.TRUE
+        else:
+            print "Number of Optical Switches = %d and is wrong" % roadmCount
+            main.log.info(
+                "Number of Optical Switches = " +
+                str( roadmCount ) +
+                " and is wrong" )
+            opticalSWResult = main.FALSE
+        if packetLayerSWCount == 6:
+            print "Number of Packet layer or mininet Switches = %d "\
+                    % packetLayerSWCount + "and is correctly detected"
+            main.log.info(
+                "Number of Packet layer or mininet Switches = " +
+                str( packetLayerSWCount ) +
+                " and is correctly detected" )
+            packetSWResult = main.TRUE
+        else:
+            print "Number of Packet layer or mininet Switches = %d and"\
+                    % packetLayerSWCount + " is wrong"
+            main.log.info(
+                "Number of Packet layer or mininet Switches = " +
+                str( packetLayerSWCount ) +
+                " and is wrong" )
+            packetSWResult = main.FALSE
+        # sleeps for sometime so the state of the switches will be active
+        time.sleep( 30 )
+        print "_________________________________"
+        linksResult = main.ONOScli1.links( jsonFormat=False )
+        print "links_result = ", linksResult
+        print "_________________________________"
+        linkActiveCount = linksResult.count("state=ACTIVE")
+        main.log.info( "linkActiveCount = " + str( linkActiveCount ))
+        if linkActiveCount == 46:
+            linkActiveResult = main.TRUE
+            main.log.info(
+                "Number of links in ACTIVE state are correct")
+        else:
+            linkActiveResult = main.FALSE
+            main.log.info(
+                "Number of links in ACTIVE state are wrong")
+        step2Result = opticalSWResult and packetSWResult and \
+                        linkActiveResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Successfully loaded packet optical topology",
+            onfail="Failed to load packet optical topology" )
+
+        case22Result = step1Result and step2Result
+
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case22Result,
+            onpass="Packet optical topology discovery successful",
+            onfail="Packet optical topology discovery failed" )
+
+    def CASE23( self, main ):
+        import time
+        """
+            Add bidirectional point intents between 2 packet layer( mininet )
+            devices and
+            ping mininet hosts
+        """
+        main.log.report(
+            "This testcase adds bidirectional point intents between 2 " +
+            "packet layer( mininet ) devices and ping mininet hosts" )
+        main.case( "Install point intents between 2 packet layer device and " +
+                   "ping the hosts" )
+
+        main.step( "Adding point intents" )
+        step1Result = main.TRUE
+        intentsId = []
+        pIntent1 = main.ONOScli1.addPointIntent(
+            "of:0000ffffffff0001/1",
+            "of:0000ffffffff0005/1" )
+        pIntent2 = main.ONOScli1.addPointIntent(
+            "of:0000ffffffff0005/1",
+            "of:0000ffffffff0001/1" )
+        intentsId.append( pIntent1 )
+        intentsId.append( pIntent2 )
+        main.log.info( "Checking intents state")
+        checkStateResult = main.ONOScli1.checkIntentState( intentsId = intentsId )
+        time.sleep( 30 )
+        main.log.info( "Checking flows state")
+        checkFlowResult = main.ONOScli1.checkFlowsState()
+        # Sleep for 30 seconds to provide time for the intent state to change
+        time.sleep( 30 )
+        main.log.info( "Checking intents state one more time")
+        checkStateResult = main.ONOScli1.checkIntentState( intentsId = intentsId )
+        step1Result = checkStateResult and checkFlowResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully added point intents",
+            onfail="Failed to add point intents")
+
+        main.step( "Ping h1 and h5" )
+        step2Result = main.TRUE
+        main.log.info( "\n\nh1 is Pinging h5" )
+        pingResult = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+        step2Result = pingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Successfully pinged h1 and h5",
+            onfail="Failed to ping between h1 and h5")
+
+        case23Result = step1Result and step2Result
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case23Result,
+            onpass="Point intents are installed properly",
+            onfail="Failed to install point intents" )
+
+    def CASE24( self, main ):
+        import time
+        import json
+        """
+            LINC uses its own switch IDs. You can use the following
+            command on the LINC console to find the mapping between 
+            DPIDs and LINC IDs.
+            rp(application:get_all_key(linc)).
+            
+            Test Rerouting of Packet Optical by bringing a port down
+            ( port 20 ) of a switch( switchID=1, or LincOE switchID =9 ), 
+            so that link
+            ( between switch1 port20 - switch5 port50 ) is inactive
+            and do a ping test. If rerouting is successful,
+            ping should pass. also check the flows
+        """
+        main.log.report(
+            "This testcase tests rerouting and pings mininet hosts" )
+        main.case( "Test rerouting and pings mininet hosts" )
+
+        main.step( "Attach to the Linc-OE session" )
+        step1Result = main.TRUE
+        attachConsole = main.LincOE1.attachLincOESession()
+        step1Result = attachConsole
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully attached Linc-OE session",
+            onfail="Failed to attached Linc-OE session")
+
+        main.step( "Bring a port down and verify the link state" )
+        step2Result = main.TRUE
+        main.LincOE1.portDown( swId="9", ptId="20" )
+        linksNonjson = main.ONOScli1.links( jsonFormat=False )
+        main.log.info( "links = " + linksNonjson )
+        linkInactiveCount = linksNonjson.count( "state=INACTIVE" )
+        main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+        if linkInactiveCount == 2:
+            main.log.info(
+                "Number of links in INACTIVE state are correct")
+        else:
+            main.log.info(
+                "Number of links in INACTIVE state are wrong")
+        links = main.ONOScli1.links()
+        main.log.info( "links = " + links )
+        linksResult = json.loads( links )
+        linksStateResult = main.FALSE
+        for item in linksResult:
+            if item[ 'src' ][ 'device' ] == "of:0000ffffffffff01" and item[
+                    'src' ][ 'port' ] == "20":
+                if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff05" and item[
+                        'dst' ][ 'port' ] == "50":
+                    linksState = item[ 'state' ]
+                    if linksState == "INACTIVE":
+                        main.log.info(
+                            "Links state is inactive as expected due to one" +
+                            " of the ports being down" )
+                        main.log.report(
+                            "Links state is inactive as expected due to one" +
+                            " of the ports being down" )
+                        linksStateResult = main.TRUE
+                        break
+                    else:
+                        main.log.info(
+                            "Links state is not inactive as expected" )
+                        main.log.report(
+                            "Links state is not inactive as expected" )
+                        linksStateResult = main.FALSE
+        time.sleep( 10 )
+        checkFlowsState = main.ONOScli1.checkFlowsState()
+        step2Result = linksStateResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Successfuly brought down a link",
+            onfail="Failed to bring down a link")
+
+        main.step( "Verify Rerouting by a ping test" )
+        step3Result = main.TRUE
+        main.log.info( "\n\nh1 is Pinging h5" )
+        pingResult = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+        step3Result = pingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step3Result,
+            onpass="Successfully pinged h1 and h5",
+            onfail="Failed to ping between h1 and h5")
+
+        main.step( "Bring the downed port up and verify the link state" )
+        step4Result = main.TRUE
+        main.LincOE1.portUp( swId="9", ptId="20" )
+        linksNonjson = main.ONOScli1.links( jsonFormat=False )
+        main.log.info( "links = " + linksNonjson )
+        linkInactiveCount = linksNonjson.count( "state=INACTIVE" )
+        main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+        if linkInactiveCount == 0:
+            main.log.info(
+                "Number of links in INACTIVE state are correct")
+        else:
+            main.log.info(
+                "Number of links in INACTIVE state are wrong")
+            step4Result = main.FALSE
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step4Result,
+            onpass="Successfully brought the port up",
+            onfail="Failed to bring the port up")
+
+        case24Result = step1Result and step2Result and step3Result \
+                       and step4Result
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=case24Result,
+                                 onpass="Packet optical rerouting successful",
+                                 onfail="Packet optical rerouting failed" )
+
+    def CASE10( self ):
+        main.log.report(
+            "This testcase uninstalls the reactive forwarding app" )
+        main.log.report( "__________________________________" )
+        main.case( "Uninstalling reactive forwarding app" )
+        main.step( "Uninstalling reactive forwarding app" )
+        step1Result = main.TRUE
+        # Unistall onos-app-fwd app to disable reactive forwarding
+        main.log.info( "deactivate reactive forwarding app" )
+        appUninstallResult = main.ONOScli2.deactivateApp( "org.onosproject.fwd" )
+        appCheck = main.ONOScli2.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOScli2.apps() )
+            main.log.warn( main.ONOScli2.appIDs() )
+        step1Result = appUninstallResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully deactivate reactive forwarding app",
+            onfail="Failed to deactivate reactive forwarding app")
+        # After reactive forwarding is disabled, the reactive flows on
+        # switches timeout in 10-15s
+        # So sleep for 15s
+        time.sleep( 15 )
+        flows = main.ONOScli2.flows()
+        main.log.info( flows )
+
+        case10Result = step1Result
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case10Result,
+            onpass="Reactive forwarding app uninstallation successful",
+            onfail="Reactive forwarding app uninstallation failed" )
+
+    def CASE25( self ):
+        """
+            Add host intents between 2 packet layer host
+        """
+        import time
+        import json
+        main.log.report( "Adding host intents between 2 optical layer host" )
+        main.case( "Test add host intents between optical layer host" )
+
+        main.step( "Discover host using arping" )
+        step1Result = main.TRUE
+        main.hostMACs = []
+        main.hostId = []
+        #Listing host MAC addresses
+        for i in range( 1 , 7 ):
+            main.hostMACs.append( "00:00:00:00:00:" +
+                                str( hex( i )[ 2: ] ).zfill( 2 ).upper() )
+        for macs in main.hostMACs:
+            main.hostId.append( macs + "/-1" )
+        host1 = main.hostId[ 0 ]
+        host2 = main.hostId[ 1 ]
+        # Use arping to discover the hosts
+        main.LincOE2.arping( host = "h1" )
+        main.LincOE2.arping( host = "h2" )
+        time.sleep( 5 )
+        hostsDict = main.ONOScli1.hosts()
+        if not len( hostsDict ):
+            step1Result = main.FALSE
+        # Adding host intent
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Hosts discovered",
+            onfail="Failed to discover hosts")
+
+        main.step( "Adding host intents to h1 and h2" )
+        step2Result = main.TRUE
+        intentsId = []
+        intent1 = main.ONOScli1.addHostIntent( hostIdOne = host1,
+                                            hostIdTwo = host2 )
+        intentsId.append( intent1 )
+        time.sleep( 5 )
+        intent2 = main.ONOScli1.addHostIntent( hostIdOne = host2,
+                                            hostIdTwo = host1 )
+        intentsId.append( intent2 )
+        # Checking intents state before pinging
+        main.log.info( "Checking intents state" )
+        time.sleep( 30 )
+        intentResult = main.ONOScli1.checkIntentState( intentsId = intentsId )
+        #check intent state again if intents are not in installed state
+        if not intentResult:
+           intentResult = main.ONOScli1.checkIntentState( intentsId = intentsId )
+        step2Result = intentResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=step2Result,
+                                 onpass="All intents are in INSTALLED state ",
+                                 onfail="Some of the intents are not in " +
+                                        "INSTALLED state " )
+
+        # pinging h1 to h2 and then ping h2 to h1
+        main.step( "Pinging h1 and h2" )
+        step3Result = main.TRUE
+        pingResult = main.TRUE
+        pingResult = main.LincOE2.pingHostOptical( src="h1", target="h2" )
+        pingResult = pingResult and main.LincOE2.pingHostOptical( src="h2",
+                                                                  target="h1" )
+        step3Result = pingResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=step3Result,
+                                 onpass="Pinged successfully between h1 and h2",
+                                 onfail="Pinged failed between h1 and h2" )
+        # Removed all added host intents
+        main.step( "Removing host intents" )
+        step4Result = main.TRUE
+        removeResult = main.TRUE
+        # Check remaining intents
+        intentsJson = json.loads( main.ONOScli1.intents() )
+        main.ONOScli1.removeIntent( intentId=intent1, purge=True )
+        main.ONOScli1.removeIntent( intentId=intent2, purge=True )
+        for intents in intentsJson:
+            main.ONOScli1.removeIntent( intentId=intents.get( 'id' ),
+                                     app='org.onosproject.optical',
+                                     purge=True )
+        print json.loads( main.ONOScli1.intents() )
+        if len( json.loads( main.ONOScli1.intents() ) ):
+            removeResult = main.FALSE
+        step4Result = removeResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=step4Result,
+                                 onpass="Successfully removed host intents",
+                                 onfail="Failed to remove host intents" )
+        case25Result = step1Result and step2Result and step3Result and \
+                       step4Result
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=case25Result,
+                                 onpass="Add host intent successful",
+                                 onfail="Add host intent failed" )
diff --git a/TestON/tests/IpOpticalMulti/IpOpticalMulti.topo b/TestON/tests/IpOpticalMulti/IpOpticalMulti.topo
new file mode 100755
index 0000000..4b1ab12
--- /dev/null
+++ b/TestON/tests/IpOpticalMulti/IpOpticalMulti.topo
@@ -0,0 +1,118 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOSbench>
+
+        <ONOScli1>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli1>
+
+	 <ONOScli2>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli2>
+
+	 <ONOScli3>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli3>
+
+        <ONOS1>
+            <host>10.128.10.11</host>
+            <user>sdn</user>
+            <password>sdn</password>
+            <type>OnosCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1>
+
+	<ONOS2>
+            <host>10.128.10.11</host>
+            <user>sdn</user>
+            <password>sdn</password>
+            <type>OnosCliDriver</type>
+            <connect_order>6</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS2>
+	
+	<ONOS3>
+            <host>10.128.10.11</host>
+            <user>sdn</user>
+            <password>sdn</password>
+            <type>OnosCliDriver</type>
+            <connect_order>7</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS3>
+
+	
+        <Mininet1>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>8</connect_order>
+            <COMPONENTS>
+                #Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+                <arg2> --topo mytopo </arg2>
+                <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet1>
+
+        <Mininet2>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>RemoteMininetDriver</type>
+            <connect_order>9</connect_order>
+            <COMPONENTS>
+                #Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+                <arg2> --topo mytopo </arg2>
+                <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet2>
+
+        <LincOE1>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>LincOEDriver</type>
+            <connect_order>7</connect_order>
+            <COMPONENTS>
+            </COMPONENTS>
+        </LincOE1>
+
+        <LincOE2>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>RemoteMininetDriver</type>
+            <connect_order>8</connect_order>
+            <COMPONENTS>
+            </COMPONENTS>
+        </LincOE2>
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/IpOpticalMulti/IpOpticalMultiOld.py b/TestON/tests/IpOpticalMulti/IpOpticalMultiOld.py
new file mode 100644
index 0000000..d00410f
--- /dev/null
+++ b/TestON/tests/IpOpticalMulti/IpOpticalMultiOld.py
@@ -0,0 +1,572 @@
+
+# Testing the basic functionality of ONOS Next
+# For sanity and driver functionality excercises only.
+
+import time
+import sys
+import os
+import re
+import time
+import json
+
+time.sleep( 1 )
+
+class IpOpticalMulti:
+
+    def __init__( self ):
+        self.default = ''
+
+    def CASE1( self, main ):
+        """
+        Startup sequence:
+        cell <name>
+        onos-verify-cell
+        onos-remove-raft-logs
+        git pull
+        mvn clean install
+        onos-package
+        onos-install -f
+        onos-wait-for-start
+        """
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
+        ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
+        ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
+        ONOS2Port = main.params[ 'CTRL' ][ 'port2' ]
+        ONOS3Port = main.params[ 'CTRL' ][ 'port3' ]
+
+        main.case( "Setting up test environment" )
+        main.log.report(
+            "This testcase is testing setting up test environment" )
+        main.log.report( "__________________________________" )
+
+        main.step( "Applying cell variable to environment" )
+        cellResult1 = main.ONOSbench.setCell( cellName )
+        # cellResult2 = main.ONOScli1.setCell( cellName )
+        # cellResult3 = main.ONOScli2.setCell( cellName )
+        # cellResult4 = main.ONOScli3.setCell( cellName )
+        verifyResult = main.ONOSbench.verifyCell()
+        cellResult = cellResult1
+
+        main.step( "Removing raft logs before a clen installation of ONOS" )
+        removeLogResult = main.ONOSbench.onosRemoveRaftLogs()
+
+        main.step( "Git checkout, pull and get version" )
+        #main.ONOSbench.gitCheckout( "master" )
+        gitPullResult = main.ONOSbench.gitPull()
+        main.log.info( "git_pull_result = " + str( gitPullResult ))
+        versionResult = main.ONOSbench.getVersion( report=True )
+
+        if gitPullResult == 1:
+            main.step( "Using mvn clean & install" )
+            cleanInstallResult = main.ONOSbench.cleanInstall()
+            # cleanInstallResult = main.TRUE
+
+        main.step( "Creating ONOS package" )
+        packageResult = main.ONOSbench.onosPackage()
+
+        # main.step( "Creating a cell" )
+        # cellCreateResult = main.ONOSbench.createCellFile( **************
+        # )
+
+        main.step( "Installing ONOS package" )
+        onos1InstallResult = main.ONOSbench.onosInstall(
+            options="-f",
+            node=ONOS1Ip )
+        onos2InstallResult = main.ONOSbench.onosInstall(
+            options="-f",
+            node=ONOS2Ip )
+        onos3InstallResult = main.ONOSbench.onosInstall(
+            options="-f",
+            node=ONOS3Ip )
+        onosInstallResult = onos1InstallResult and onos2InstallResult and\
+                onos3InstallResult
+        if onosInstallResult == main.TRUE:
+            main.log.report( "Installing ONOS package successful" )
+        else:
+            main.log.report( "Installing ONOS package failed" )
+
+        onos1Isup = main.ONOSbench.isup( ONOS1Ip )
+        onos2Isup = main.ONOSbench.isup( ONOS2Ip )
+        onos3Isup = main.ONOSbench.isup( ONOS3Ip )
+        onosIsup = onos1Isup and onos2Isup and onos3Isup
+        if onosIsup == main.TRUE:
+            main.log.report( "ONOS instances are up and ready" )
+        else:
+            main.log.report( "ONOS instances may not be up" )
+
+        main.step( "Starting ONOS service" )
+        startResult = main.TRUE
+        # startResult = main.ONOSbench.onosStart( ONOS1Ip )
+        startcli1 = main.ONOScli1.startOnosCli( ONOSIp=ONOS1Ip )
+        startcli2 = main.ONOScli2.startOnosCli( ONOSIp=ONOS2Ip )
+        startcli3 = main.ONOScli3.startOnosCli( ONOSIp=ONOS3Ip )
+        print startcli1
+        print startcli2
+        print startcli3
+
+        case1Result = ( packageResult and
+                        cellResult and verifyResult and onosInstallResult and
+                        onosIsup and startResult )
+        utilities.assertEquals( expect=main.TRUE, actual=case1Result,
+                                onpass="Test startup successful",
+                                onfail="Test startup NOT successful" )
+
+    def CASE10( self ):
+        import time
+        main.log.report(
+            "This testcase uninstalls the reactive forwarding app" )
+        main.log.report( "__________________________________" )
+        main.case( "Uninstalling reactive forwarding app" )
+        # Unistall onos-app-fwd app to disable reactive forwarding
+        appInstallResult = main.ONOScli1.deactivateApp( "org.onosproject.fwd" )
+        appCheck = main.ONOScli1.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOScli1.apps() )
+            main.log.warn( main.ONOScli1.appIDs() )
+        main.log.info( "onos-app-fwd uninstalled" )
+
+        # After reactive forwarding is disabled,
+        # the reactive flows on switches timeout in 10-15s
+        # So sleep for 15s
+        time.sleep( 15 )
+
+        hosts = main.ONOScli1.hosts()
+        main.log.info( hosts )
+        case10Result = appInstallResult
+        utilities.assertEquals(
+            expect=main.TRUE,
+            actual=case10Result,
+            onpass="Reactive forwarding app uninstallation successful",
+            onfail="Reactive forwarding app uninstallation failed" )
+
+    def CASE20( self ):
+        """
+            Exit from mininet cli
+            reinstall ONOS
+        """
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
+        ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
+        ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
+        ONOS2Port = main.params[ 'CTRL' ][ 'port2' ]
+        ONOS3Port = main.params[ 'CTRL' ][ 'port3' ]
+
+        main.log.report( "This testcase exits the mininet cli and reinstalls" +
+                         "ONOS to switch over to Packet Optical topology" )
+        main.log.report( "_____________________________________________" )
+        main.case( "Disconnecting mininet and restarting ONOS" )
+        main.step( "Disconnecting mininet and restarting ONOS" )
+        mininetDisconnect = main.Mininet1.disconnect()
+        print "mininetDisconnect = ", mininetDisconnect
+
+        main.step( "Removing raft logs before a clen installation of ONOS" )
+        main.ONOSbench.onosRemoveRaftLogs()
+
+        main.step( "Applying cell variable to environment" )
+        cellResult = main.ONOSbench.setCell( cellName )
+        verifyResult = main.ONOSbench.verifyCell()
+
+
+        main.step( "Installing ONOS package" )
+        onos1InstallResult = main.ONOSbench.onosInstall(
+            options="-f",
+            node=ONOS1Ip )
+        onos2InstallResult = main.ONOSbench.onosInstall(
+            options="-f",
+            node=ONOS2Ip )
+        onos3InstallResult = main.ONOSbench.onosInstall(
+            options="-f",
+            node=ONOS3Ip )
+        onosInstallResult = onos1InstallResult and onos2InstallResult and\
+                onos3InstallResult
+        if onosInstallResult == main.TRUE:
+            main.log.report( "Installing ONOS package successful" )
+        else:
+            main.log.report( "Installing ONOS package failed" )
+
+        onos1Isup = main.ONOSbench.isup( ONOS1Ip )
+        onos2Isup = main.ONOSbench.isup( ONOS2Ip )
+        onos3Isup = main.ONOSbench.isup( ONOS3Ip )
+        onosIsup = onos1Isup and onos2Isup and onos3Isup
+        if onosIsup == main.TRUE:
+            main.log.report( "ONOS instances are up and ready" )
+        else:
+            main.log.report( "ONOS instances may not be up" )
+
+        main.step( "Starting ONOS service" )
+        startResult = main.TRUE
+        # startResult = main.ONOSbench.onosStart( ONOS1Ip )
+        startcli1 = main.ONOScli1.startOnosCli( ONOSIp=ONOS1Ip )
+        startcli2 = main.ONOScli2.startOnosCli( ONOSIp=ONOS2Ip )
+        startcli3 = main.ONOScli3.startOnosCli( ONOSIp=ONOS3Ip )
+        startResult = startcli1 and startcli2 and startcli3
+        if startResult == main.TRUE:
+            main.log.report( "ONOS cli starts properly" )
+        case20Result = mininetDisconnect and cellResult and verifyResult \
+            and onosInstallResult and onosIsup and startResult
+
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case20Result,
+            onpass= "Exiting functionality mininet topology and reinstalling" +
+                    " ONOS successful",
+            onfail= "Exiting functionality mininet topology and reinstalling" +
+                    " ONOS failed" )
+
+    def CASE21( self, main ):
+        """
+            On ONOS bench, run this command:
+            sudo -E python ~/onos/tools/test/topos/opticalTest.py -OC1 <Ctrls>
+            which spawns packet optical topology and copies the links
+            json file to the onos instance.
+            Note that in case of Packet Optical, the links are not learnt
+            from the topology, instead the links are learnt
+            from the json config file
+        """
+        main.log.report(
+            "This testcase starts the packet layer topology and REST" )
+        main.log.report( "_____________________________________________" )
+        main.case( "Starting LINC-OE and other components" )
+        main.step( "Starting LINC-OE and other components" )
+        main.log.info( "Activate optical app" )
+        appInstallResult = main.ONOScli1.activateApp( "org.onosproject.optical" )
+        appCheck = main.ONOScli1.appToIDCheck()
+        appCheck = appCheck and main.ONOScli2.appToIDCheck()
+        appCheck = appCheck and main.ONOScli3.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( "Checking ONOS application unsuccesful" )
+
+        ctrllerIP = []
+        ctrllerIP.append( main.params[ 'CTRL' ][ 'ip1' ] )
+        #ctrllerIP.append( main.params[ 'CTRL' ][ 'ip2' ] )
+        #ctrllerIP.append( main.params[ 'CTRL' ][ 'ip3' ] )
+        opticalMnScript = main.LincOE2.runOpticalMnScript( ctrllerIP = ctrllerIP )
+        case21Result = opticalMnScript and appInstallResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case21Result,
+            onpass="Packet optical topology spawned successsfully",
+            onfail="Packet optical topology spawning failed" )
+
+    def CASE22( self, main ):
+        """
+            Curretly we use, 10 optical switches(ROADM's) and
+            6 packet layer mininet switches each with one host.
+            Therefore, the roadmCount variable = 10,
+            packetLayerSWCount variable = 6, hostCount=6 and
+            links=42.
+            All this is hardcoded in the testcase. If the topology changes,
+            these hardcoded values need to be changed
+        """
+        main.log.report(
+            "This testcase compares the optical+packet topology against what" +
+            " is expected" )
+        main.case( "Topology comparision" )
+        main.step( "Topology comparision" )
+        devicesResult = main.ONOScli3.devices( jsonFormat=False )
+
+        print "devices_result = ", devicesResult
+        devicesLinewise = devicesResult.split( "\n" )
+        roadmCount = 0
+        packetLayerSWCount = 0
+        for line in devicesLinewise:
+            components = line.split( "," )
+            availability = components[ 1 ].split( "=" )[ 1 ]
+            type = components[ 3 ].split( "=" )[ 1 ]
+            if availability == 'true' and type == 'ROADM':
+                roadmCount += 1
+            elif availability == 'true' and type == 'SWITCH':
+                packetLayerSWCount += 1
+        if roadmCount == 10:
+            print "Number of Optical Switches = %d and is" % roadmCount +\
+                  " correctly detected"
+            main.log.info(
+                "Number of Optical Switches = " +
+                str( roadmCount ) +
+                " and is correctly detected" )
+            opticalSWResult = main.TRUE
+        else:
+            print "Number of Optical Switches = %d and is wrong" % roadmCount
+            main.log.info(
+                "Number of Optical Switches = " +
+                str( roadmCount ) +
+                " and is wrong" )
+            opticalSWResult = main.FALSE
+
+        if packetLayerSWCount == 6:
+            print "Number of Packet layer or mininet Switches = %d "\
+                    % packetLayerSWCount + "and is correctly detected"
+            main.log.info(
+                "Number of Packet layer or mininet Switches = " +
+                str( packetLayerSWCount ) +
+                " and is correctly detected" )
+            packetSWResult = main.TRUE
+        else:
+            print "Number of Packet layer or mininet Switches = %d and"\
+                    % packetLayerSWCount + " is wrong"
+            main.log.info(
+                "Number of Packet layer or mininet Switches = " +
+                str( packetLayerSWCount ) +
+                " and is wrong" )
+            packetSWResult = main.FALSE
+        print "_________________________________"
+
+        linksResult = main.ONOScli3.links( jsonFormat=False )
+        print "links_result = ", linksResult
+        print "_________________________________"
+        linkActiveCount = linksResult.count("state=ACTIVE") 
+        main.log.info( "linkActiveCount = " + str( linkActiveCount ))
+        if linkActiveCount == 42:
+            linkActiveResult = main.TRUE
+            main.log.info(
+                "Number of links in ACTIVE state are correct")
+        else:
+            linkActiveResult = main.FALSE
+            main.log.info(
+                "Number of links in ACTIVE state are wrong")
+
+        case22Result = opticalSWResult and packetSWResult and \
+                        linkActiveResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case22Result,
+            onpass="Packet optical topology discovery successful",
+            onfail="Packet optical topology discovery failed" )
+
+    def CASE23( self, main ):
+        import time
+        """
+            Add bidirectional point intents between 2 packet layer( mininet )
+            devices and
+            ping mininet hosts
+        """
+        main.log.report(
+            "This testcase adds bidirectional point intents between 2 " +
+            "packet layer( mininet ) devices and ping mininet hosts" )
+        main.case( "Topology comparision" )
+        main.step( "Adding point intents" )
+        ptpIntentResult = main.ONOScli1.addPointIntent(
+            "of:0000ffffffff0001/1",
+            "of:0000ffffffff0005/1" )
+        if ptpIntentResult == main.TRUE:
+            main.ONOScli1.intents( jsonFormat=False )
+            main.log.info( "Point to point intent install successful" )
+
+        ptpIntentResult = main.ONOScli1.addPointIntent(
+            "of:0000ffffffff0005/1",
+            "of:0000ffffffff0001/1" )
+        if ptpIntentResult == main.TRUE:
+            main.ONOScli1.intents( jsonFormat=False )
+            main.log.info( "Point to point intent install successful" )
+
+        time.sleep( 30 )
+        flowHandle = main.ONOScli1.flows()
+        main.log.info( "flows :" + flowHandle )
+
+        # Sleep for 30 seconds to provide time for the intent state to change
+        time.sleep( 60 )
+        intentHandle = main.ONOScli1.intents( jsonFormat=False )
+        main.log.info( "intents :" + intentHandle )
+
+        PingResult = main.TRUE
+        count = 1
+        main.log.info( "\n\nh1 is Pinging h5" )
+        ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+        # ping = main.LincOE2.pinghost()
+        if ping == main.FALSE and count < 5:
+            count += 1
+            PingResult = main.FALSE
+            main.log.info(
+                "Ping between h1 and h5  failed. Making attempt number " +
+                str( count ) +
+                " in 2 seconds" )
+            time.sleep( 2 )
+        elif ping == main.FALSE:
+            main.log.info( "All ping attempts between h1 and h5 have failed" )
+            PingResult = main.FALSE
+        elif ping == main.TRUE:
+            main.log.info( "Ping test between h1 and h5 passed!" )
+            PingResult = main.TRUE
+        else:
+            main.log.info( "Unknown error" )
+            PingResult = main.ERROR
+
+        if PingResult == main.FALSE:
+            main.log.report(
+                "Point intents for packet optical have not ben installed" +
+                " correctly. Cleaning up" )
+        if PingResult == main.TRUE:
+            main.log.report(
+                "Point Intents for packet optical have been " +
+                "installed correctly" )
+
+        case23Result = PingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case23Result,
+            onpass= "Point intents addition for packet optical and" +
+                    "Pingall Test successful",
+            onfail= "Point intents addition for packet optical and" +
+                    "Pingall Test NOT successful" )
+
+    def CASE24( self, main ):
+        import time
+        import json
+        """
+            LINC uses its own switch IDs. You can use the following
+            command on the LINC console to find the mapping between
+            DPIDs and LINC IDs.
+            rp(application:get_all_key(linc)).
+
+            Test Rerouting of Packet Optical by bringing a port down
+            ( port 20 ) of a switch( switchID=1, or LincOE switchID =9 ),
+            so that link
+            ( between switch1 port20 - switch5 port50 ) is inactive
+            and do a ping test. If rerouting is successful,
+            ping should pass. also check the flows
+        """
+        main.log.report(
+            "This testcase tests rerouting and pings mininet hosts" )
+        main.case( "Test rerouting and pings mininet hosts" )
+        main.step( "Attach to the Linc-OE session" )
+        attachConsole = main.LincOE1.attachLincOESession()
+        print "attachConsole = ", attachConsole
+
+        main.step( "Bring a port down and verify the link state" )
+        main.LincOE1.portDown( swId="9", ptId="20" )
+        linksNonjson = main.ONOScli3.links( jsonFormat=False )
+        main.log.info( "links = " + linksNonjson )
+
+        linkInactiveCount = linksNonjson.count("state=INACTIVE")
+        main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+        if linkInactiveCount == 2:
+            main.log.info(
+                "Number of links in INACTIVE state are correct")
+        else:
+            main.log.info(
+                "Number of links in INACTIVE state are wrong")
+        
+        links = main.ONOScli3.links()
+        main.log.info( "links = " + links )
+
+        linksResult = json.loads( links )
+        linksStateResult = main.FALSE
+        for item in linksResult:
+            if item[ 'src' ][ 'device' ] == "of:0000ffffffffff01" and item[
+                    'src' ][ 'port' ] == "20":
+                if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff05" and item[
+                        'dst' ][ 'port' ] == "50":
+                    linksState = item[ 'state' ]
+                    if linksState == "INACTIVE":
+                        main.log.info(
+                            "Links state is inactive as expected due to one" +
+                            " of the ports being down" )
+                        main.log.report(
+                            "Links state is inactive as expected due to one" +
+                            " of the ports being down" )
+                        linksStateResult = main.TRUE
+                        break
+                    else:
+                        main.log.info(
+                            "Links state is not inactive as expected" )
+                        main.log.report(
+                            "Links state is not inactive as expected" )
+                        linksStateResult = main.FALSE
+
+        print "links_state_result = ", linksStateResult
+        time.sleep( 10 )
+        flowHandle = main.ONOScli3.flows()
+        main.log.info( "flows :" + flowHandle )
+
+        main.step( "Verify Rerouting by a ping test" )
+        PingResult = main.TRUE
+        count = 1
+        main.log.info( "\n\nh1 is Pinging h5" )
+        ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+        # ping = main.LincOE2.pinghost()
+        if ping == main.FALSE and count < 5:
+            count += 1
+            PingResult = main.FALSE
+            main.log.info(
+                "Ping between h1 and h5  failed. Making attempt number " +
+                str( count ) +
+                " in 2 seconds" )
+            time.sleep( 2 )
+        elif ping == main.FALSE:
+            main.log.info( "All ping attempts between h1 and h5 have failed" )
+            PingResult = main.FALSE
+        elif ping == main.TRUE:
+            main.log.info( "Ping test between h1 and h5 passed!" )
+            PingResult = main.TRUE
+        else:
+            main.log.info( "Unknown error" )
+            PingResult = main.ERROR
+
+        if PingResult == main.TRUE:
+            main.log.report( "Ping test successful " )
+        if PingResult == main.FALSE:
+            main.log.report( "Ping test failed" )
+
+        case24Result = PingResult and linksStateResult
+        utilities.assert_equals( expect=main.TRUE, actual=case24Result,
+                                 onpass="Packet optical rerouting successful",
+                                 onfail="Packet optical rerouting failed" )
+
+    def CASE25( self ):
+        """
+            Add host intents between 2 packet layer host
+        """
+        import time
+        import json
+        main.log.report( "Adding host intents between 2 packet layer host" )
+        main.hostMACs = []
+        main.hostId = []
+        #Listing host MAC addresses
+        for i in range( 1 , 7 ):
+            main.hostMACs.append( "00:00:00:00:00:" +
+                                str( hex( i )[ 2: ] ).zfill( 2 ).upper() )
+        for macs in main.hostMACs:
+            main.hostId.append( macs + "/-1" )
+
+        host1 = main.hostId[ 0 ]
+        host2 = main.hostId[ 1 ]
+        intentsId = []
+        # Use arping to discover the hosts
+        main.LincOE2.arping( host = "h1" )
+        main.LincOE2.arping( host = "h2" )
+        # Adding host intent
+        main.log.step( "Adding host intents to h1 and h2" )
+        intent1 = main.ONOScli1.addHostIntent( hostIdOne = host1,
+                                            hostIdTwo = host2 )
+        intentsId.append( intent1 )
+        time.sleep( 5 )
+        intent2 = main.ONOScli1.addHostIntent( hostIdOne = host2,
+                                            hostIdTwo = host1 )
+        intentsId.append( intent2 )
+        # Checking intents state before pinging
+        main.log.step( "Checking intents state" )
+        time.sleep( 10 )
+        intentResult = main.ONOScli1.checkIntentState( intentsId = intentsId )
+        utilities.assert_equals( expect=main.TRUE, actual=intentResult,
+                                 onpass="All intents are in INSTALLED state ",
+                                 onfail="Some of the intents are not in " +
+                                        "INSTALLED state " )
+
+        # pinging h1 to h2 and then ping h2 to h1
+        main.log.step( "Pinging h1 and h2" )
+        pingResult = main.TRUE
+        pingResult = main.LincOE2.pingHostOptical( src="h1", target="h2" )
+        pingResult = pingResult and main.LincOE2.pingHostOptical( src="h2",
+                                                                  target="h1" )
+
+        utilities.assert_equals( expect=main.TRUE, actual=pingResult,
+                                 onpass="Pinged successfully between h1 and h2",
+                                 onfail="Pinged failed between h1 and h2" )
+
+        case25Result = pingResult
+        utilities.assert_equals( expect=main.TRUE, actual=case25Result,
+                                 onpass="Add host intent successful",
+                                 onfail="Add host intent failed" )
diff --git a/TestON/tests/IpOpticalMulti/__init__.py b/TestON/tests/IpOpticalMulti/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/IpOpticalMulti/__init__.py
diff --git a/TestON/tests/MultiProd/MultiProd.params b/TestON/tests/MultiProd/MultiProd.params
index 4818d09..f08257b 100755
--- a/TestON/tests/MultiProd/MultiProd.params
+++ b/TestON/tests/MultiProd/MultiProd.params
@@ -1,6 +1,6 @@
 <PARAMS>
     
-    <testcases>1,4,10,5,6,7,8,6,8,9,8,31,32,8,33,8</testcases>
+    <testcases>1,4,10,5,6,7,8,6,8,9,8,31,32,8,33,8,20,21,22,10,23,24</testcases>
     #Environment variables
     <ENV>
         <cellName>multi_test</cellName>
@@ -8,8 +8,8 @@
 
     <CTRL>
         <ip1>10.128.20.11</ip1>
-	    <ip2>10.128.20.12</ip2>
-	    <ip3>10.128.20.13</ip3>
+        <ip2>10.128.20.12</ip2>
+        <ip3>10.128.20.13</ip3>
         <port1>6633</port1>
         <port2>6633</port2>
         <port3>6633</port3>
diff --git a/TestON/tests/MultiProd/MultiProd.py b/TestON/tests/MultiProd/MultiProd.py
index aac631f..44a828c 100644
--- a/TestON/tests/MultiProd/MultiProd.py
+++ b/TestON/tests/MultiProd/MultiProd.py
@@ -53,18 +53,19 @@
         removeLogResult = main.ONOSbench.onosRemoveRaftLogs()
 
         main.step( "Git checkout, pull and get version" )
-        #main.ONOSbench.gitCheckout( "master" )
+        main.ONOSbench.gitCheckout( "master" )
         gitPullResult = main.ONOSbench.gitPull()
         main.log.info( "git_pull_result = " + str( gitPullResult ))
         versionResult = main.ONOSbench.getVersion( report=True )
 
-        if gitPullResult == 1:
+        packageResult = main.TRUE
+        if gitPullResult == 100:
             main.step( "Using mvn clean & install" )
             cleanInstallResult = main.ONOSbench.cleanInstall()
+            main.step( "Creating ONOS package" )
+            packageResult = main.ONOSbench.onosPackage()
             # cleanInstallResult = main.TRUE
 
-        main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.onosPackage()
 
         # main.step( "Creating a cell" )
         # cellCreateResult = main.ONOSbench.createCellFile( **************
@@ -215,6 +216,14 @@
             main.log.report( "Controller assignment successfull" )
         else:
             main.log.report( "Controller assignment failed" )
+        appInstallResult = main.TRUE
+        main.log.info( "Activating reactive forwarding app" )
+        appInstallResult = main.ONOScli1.activateApp( "org.onosproject.fwd" )
+        appCheck = main.ONOScli1.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOScli1.apps() )
+            main.log.warn( main.ONOScli1.appIDs() )
+        time.sleep( 30 )
         # REACTIVE FWD test
         main.step( "Pingall" )
         pingResult = main.FALSE
@@ -371,7 +380,6 @@
                                 onpass="ONOS3 Switches view is correct",
                                 onfail="ONOS3 Switches view is incorrect" )
 
-        """
         portsResults1 =  main.Mininet1.comparePorts( MNTopo,
         json.loads( ports1 ) )
         utilities.assertEquals( expect=main.TRUE, actual=portsResults1,
@@ -389,7 +397,7 @@
         utilities.assertEquals( expect=main.TRUE, actual=portsResults3,
                 onpass="ONOS3 Ports view is correct",
                 onfail="ONOS3 Ports view is incorrect" )
-        """
+
         linksResults1 = main.Mininet1.compareLinks(
             MNTopo,
             json.loads( links1 ) )
@@ -433,17 +441,17 @@
                                 onfail="Topology Check Test NOT successful" )
 
     def CASE10( self ):
+        import time
         main.log.report(
             "This testcase uninstalls the reactive forwarding app" )
         main.log.report( "__________________________________" )
         main.case( "Uninstalling reactive forwarding app" )
         # Unistall onos-app-fwd app to disable reactive forwarding
-        appUninstallResult1 = main.ONOScli1.featureUninstall(
-            "onos-app-fwd" )
-        appUninstallResult2 = main.ONOScli2.featureUninstall(
-            "onos-app-fwd" )
-        appUninstallResult3 = main.ONOScli3.featureUninstall(
-            "onos-app-fwd" )
+        appInstallResult = main.ONOScli1.deactivateApp( "org.onosproject.fwd" )
+        appCheck = main.ONOScli1.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOScli1.apps() )
+            main.log.warn( main.ONOScli1.appIDs() )
         main.log.info( "onos-app-fwd uninstalled" )
 
         # After reactive forwarding is disabled,
@@ -453,9 +461,7 @@
 
         hosts = main.ONOScli1.hosts()
         main.log.info( hosts )
-
-        case10Result = appUninstallResult1 and\
-                appUninstallResult2 and appUninstallResult3
+        case10Result = appInstallResult
         utilities.assertEquals(
             expect=main.TRUE,
             actual=case10Result,
@@ -504,6 +510,7 @@
         hthIntentResult = main.ONOScli1.addHostIntent( "00:00:00:00:00:11/-1",
         "00:00:00:00:00:1B/-1" )
         """
+        intentsId = []
         for i in range( 8, 18 ):
             main.log.info(
                 "Adding host intent between h" + str( i ) +
@@ -517,8 +524,14 @@
             host1Id = main.ONOScli1.getHost( host1 )[ 'id' ]
             host2Id = main.ONOScli1.getHost( host2 )[ 'id' ]
             tmpResult = main.ONOScli1.addHostIntent( host1Id, host2Id )
+            intentsId.append( tmpResult )
+
+        checkIntent1 = main.ONOScli1.checkIntentState( intentsId )
+        checkIntent2 = main.ONOScli2.checkIntentState( intentsId )
+        checkIntent3 = main.ONOScli3.checkIntentState( intentsId )
 
         flowHandle = main.ONOScli1.flows()
+
         main.log.info( "flows:" + flowHandle )
 
         count = 1
@@ -571,6 +584,10 @@
         if PingResult == main.TRUE:
             main.log.report( "Host intents have been installed correctly" )
 
+        checkIntent1 = main.ONOScli1.checkIntentState( intentsId )
+        checkIntent2 = main.ONOScli2.checkIntentState( intentsId )
+        checkIntent3 = main.ONOScli3.checkIntentState( intentsId )
+
         case6Result = PingResult
         utilities.assertEquals(
             expect=main.TRUE,
@@ -637,8 +654,8 @@
         main.step( "Determine the current number of switches and links" )
         topologyOutput = main.ONOScli1.topology()
         topologyResult = main.ONOSbench.getTopology( topologyOutput )
-        activeSwitches = topologyResult[ 'deviceCount' ]
-        links = topologyResult[ 'linkCount' ]
+        activeSwitches = topologyResult[ 'devices' ]
+        links = topologyResult[ 'links' ]
         main.log.info(
             "Currently there are %s switches and %s links" %
             ( str( activeSwitches ), str( links ) ) )
@@ -881,14 +898,20 @@
         main.step(
             "Iterate through the intentids list and remove each intent" )
         for id in intentids:
-            main.ONOScli1.removeIntent( intentId=id )
+            main.ONOScli1.removeIntent( intentId=id ,purge=True )
 
-        intentResult = main.ONOScli1.intents( jsonFormat=False )
-        main.log.info( "intent_result = " + intentResult )
+        remainingIntent = main.ONOScli1.intents( jsonFormat=False )
+        main.log.info( "Remaining intents  " + remainingIntent )
+
         case8Result = main.TRUE
-
+        intentResult = main.TRUE
+        if remainingIntent:
+            main.log.error( "There are still remaining intent" )
+            intentResult = main.FALSE
         i = 8
+
         PingResult = main.TRUE
+        """
         while i < 18:
             main.log.info(
                 "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
@@ -903,7 +926,6 @@
             else:
                 main.log.info( "Unknown error" )
                 PingResult = main.ERROR
-
         # Note: If the ping result failed, that means the intents have been
         # withdrawn correctly.
         if PingResult == main.TRUE:
@@ -912,17 +934,17 @@
             # main.exit()
         if PingResult == main.FALSE:
             main.log.report( "Host intents have been withdrawn correctly" )
+        """
+        case8Result = intentResult
 
-        case8Result = case8Result and PingResult
-
-        if case8Result == main.FALSE:
+        if case8Result == main.TRUE:
             main.log.report( "Intent removal successful" )
         else:
             main.log.report( "Intent removal failed" )
 
-        utilities.assertEquals( expect=main.FALSE, actual=case8Result,
-                                onpass="Intent removal test failed",
-                                onfail="Intent removal test successful" )
+        utilities.assertEquals( expect=main.TRUE, actual=case8Result,
+                                onpass="Intent removal test successful",
+                                onfail="Intent removal test failed" )
 
     def CASE9( self ):
         """
@@ -941,28 +963,38 @@
         main.step(
             "Add point-to-point intents for mininet hosts" +
             " h8 and h18 or ONOS hosts h8 and h12" )
+        macsDict = {}
+        for i in range( 1,29 ):
+            macsDict[ 'h' + str( i ) ]= main.Mininet1.getMacAddress( host='h'+ str( i ) )
+        print macsDict
+        # main.step(var1)
         ptpIntentResult = main.ONOScli1.addPointIntent(
-            "of:0000000000003008/1",
-            "of:0000000000006018/1" )
+            ingressDevice="of:0000000000003008/1",
+            egressDevice="of:0000000000006018/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h8' ))
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
             # main.log.info( getIntentResult )
 
         ptpIntentResult = main.ONOScli1.addPointIntent(
-            "of:0000000000006018/1",
-            "of:0000000000003008/1" )
+            ingressDevice="of:0000000000006018/1",
+            egressDevice="of:0000000000003008/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h18' ))
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
             # main.log.info( getIntentResult )
 
-        main.step(
-            "Add point-to-point intents for mininet hosts" +
-            " h9 and h19 or ONOS hosts h9 and h13" )
+        var2 = "Add point intents for mn hosts h9&h19 or ONOS hosts h9&h13"
+        main.step(var2)
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000003009/1",
-            "of:0000000000006019/1" )
+            "of:0000000000006019/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h9' ))
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
@@ -970,18 +1002,22 @@
 
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000006019/1",
-            "of:0000000000003009/1" )
+            "of:0000000000003009/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h19' ))
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
             # main.log.info( getIntentResult )
 
-        main.step(
-            "Add point-to-point intents for mininet" +
-            " hosts h10 and h20 or ONOS hosts hA and h14" )
+        var3 = "Add point intents for MN hosts h10&h20 or ONOS hosts hA&h14"
+        main.step(var3)
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000003010/1",
-            "of:0000000000006020/1" )
+            "of:0000000000006020/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h10' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
@@ -989,18 +1025,24 @@
 
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000006020/1",
-            "of:0000000000003010/1" )
+            "of:0000000000003010/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h20' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
             # main.log.info( getIntentResult )
 
-        main.step(
-            "Add point-to-point intents for mininet" +
-            " hosts h11 and h21 or ONOS hosts hB and h15" )
+        var4 = "Add point intents for mininet hosts h11 and h21 or" +\
+               " ONOS hosts hB and h15"
+        main.case(var4)
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000003011/1",
-            "of:0000000000006021/1" )
+            "of:0000000000006021/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h11' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1008,18 +1050,24 @@
 
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000006021/1",
-            "of:0000000000003011/1" )
+            "of:0000000000003011/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h21' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
             # main.log.info( getIntentResult )
 
-        main.step(
-            "Add point-to-point intents for mininet" +
-            " hosts h12 and h22 or ONOS hosts hC and h16" )
+        var5 = "Add point intents for mininet hosts h12 and h22 " +\
+               "ONOS hosts hC and h16"
+        main.case(var5)
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000003012/1",
-            "of:0000000000006022/1" )
+            "of:0000000000006022/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h12' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1027,18 +1075,24 @@
 
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000006022/1",
-            "of:0000000000003012/1" )
+            "of:0000000000003012/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h22' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
             # main.log.info( getIntentResult )
 
-        main.step(
-            "Add point-to-point intents for mininet " +
-            "hosts h13 and h23 or ONOS hosts hD and h17" )
+        var6 = "Add point intents for mininet hosts h13 and h23 or" +\
+               " ONOS hosts hD and h17"
+        main.case(var6)
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000003013/1",
-            "of:0000000000006023/1" )
+            "of:0000000000006023/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h13' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1046,18 +1100,24 @@
 
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000006023/1",
-            "of:0000000000003013/1" )
+            "of:0000000000003013/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h23' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
             # main.log.info( getIntentResult )
 
-        main.step(
-            "Add point-to-point intents for mininet hosts" +
-            " h14 and h24 or ONOS hosts hE and h18" )
+        var7 = "Add point intents for mininet hosts h14 and h24 or" +\
+               " ONOS hosts hE and h18"
+        main.case(var7)
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000003014/1",
-            "of:0000000000006024/1" )
+            "of:0000000000006024/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h14' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1065,18 +1125,24 @@
 
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000006024/1",
-            "of:0000000000003014/1" )
+            "of:0000000000003014/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h24' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
             # main.log.info( getIntentResult )
 
-        main.step(
-            "Add point-to-point intents for mininet hosts" +
-            " h15 and h25 or ONOS hosts hF and h19" )
+        var8 = "Add point intents for mininet hosts h15 and h25 or" +\
+               " ONOS hosts hF and h19"
+        main.case(var8)
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000003015/1",
-            "of:0000000000006025/1" )
+            "of:0000000000006025/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h15' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1084,18 +1150,24 @@
 
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000006025/1",
-            "of:0000000000003015/1" )
+            "of:0000000000003015/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h25' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
             # main.log.info( getIntentResult )
 
-        main.step(
-            "Add point-to-point intents for mininet hosts" +
-            " h16 and h26 or ONOS hosts h10 and h1A" )
+        var9 = "Add intents for mininet hosts h16 and h26 or" +\
+               " ONOS hosts h10 and h1A"
+        main.case(var9)
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000003016/1",
-            "of:0000000000006026/1" )
+            "of:0000000000006026/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h16' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1103,37 +1175,41 @@
 
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000006026/1",
-            "of:0000000000003016/1" )
+            "of:0000000000003016/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h26' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
             # main.log.info( getIntentResult )
 
-        main.step(
-            "Add point-to-point intents for mininet hosts h17" +
-            " and h27 or ONOS hosts h11 and h1B" )
+        var10 = "Add point intents for mininet hosts h17 and h27 or" +\
+                " ONOS hosts h11 and h1B"
+        main.case(var10)
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000003017/1",
-            "of:0000000000006027/1" )
+            "of:0000000000006027/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h17' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
+            #main.log.info( getIntentResult )
 
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000006027/1",
-            "of:0000000000003017/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOScli1.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
+            "of:0000000000003017/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h27' ))
 
         print(
             "_______________________________________________________" +
             "________________________________" )
 
         flowHandle = main.ONOScli1.flows()
-        # print "flowHandle = ", flowHandle
+        print "flowHandle = ", flowHandle
         main.log.info( "flows :" + flowHandle )
 
         count = 1
@@ -1226,13 +1302,13 @@
             host2Id = main.ONOScli1.getHost( host2 )[ 'id' ]
             for host in hostsJson:
                 if host[ 'id' ] == host1Id:
-                    ip1 = host[ 'ips' ][ 0 ]
+                    ip1 = host[ 'ipAddresses' ][ 0 ]
                     ip1 = str( ip1 + "/32" )
-                    device1 = host[ 'location' ][ 'device' ]
+                    device1 = host[ 'location' ][ 'elementId' ]
                     device1 = str( device1 + "/1" )
                 elif host[ 'id' ] == host2Id:
-                    ip2 = str( host[ 'ips' ][ 0 ] ) + "/32"
-                    device2 = host[ 'location' ][ "device" ]
+                    ip2 = str( host[ 'ipAddresses' ][ 0 ] ) + "/32"
+                    device2 = host[ 'location' ][ 'elementId' ]
                     device2 = str( device2 + "/1" )
 
             pIntentResult1 = main.ONOScli1.addPointIntent(
@@ -1241,7 +1317,7 @@
                 ipSrc=ip1,
                 ipDst=ip2,
                 ethType=main.params[ 'SDNIP' ][ 'ethType' ],
-                ipProto=main.params[ 'SDNIP' ][ 'icmpProto' ] )
+                ipProto=main.params[ 'SDNIP' ][ 'icmpProto' ], )
 
             getIntentResult = main.ONOScli1.intents( jsonFormat=False )
             main.log.info( getIntentResult )
@@ -1256,7 +1332,7 @@
 
             getIntentResult = main.ONOScli1.intents( jsonFormat=False )
             main.log.info( getIntentResult )
-            if ( pIntentResult1 and pIntentResult2 ) == main.TRUE:
+            if ( pIntentResult1 and pIntentResult2 ) :
                 # getIntentResult = main.ONOScli1.intents()
                 # main.log.info( getIntentResult )
                 main.log.info(
@@ -1322,7 +1398,7 @@
                 "Ping all test after Point intents related to" +
                 " SDN-IP matching on ICMP successful" )
 
-        case31Result = PingResult and pIntentResult1 and pIntentResult2
+        case31Result = PingResult
         utilities.assertEquals(
             expect=main.TRUE,
             actual=case31Result,
@@ -1378,13 +1454,13 @@
             host2Id = main.ONOScli1.getHost( host2 )[ 'id' ]
             for host in hostsJson:
                 if host[ 'id' ] == host1Id:
-                    ip1 = host[ 'ips' ][ 0 ]
+                    ip1 = host[ 'ipAddresses' ][ 0 ]
                     ip1 = str( ip1 + "/32" )
-                    device1 = host[ 'location' ][ 'device' ]
+                    device1 = host[ 'location' ][ 'elementId' ]
                     device1 = str( device1 + "/1" )
                 elif host[ 'id' ] == host2Id:
-                    ip2 = str( host[ 'ips' ][ 0 ] ) + "/32"
-                    device2 = host[ 'location' ][ "device" ]
+                    ip2 = str( host[ 'ipAddresses' ][ 0 ] ) + "/32"
+                    device2 = host[ 'location' ][ 'elementId' ]
                     device2 = str( device2 + "/1" )
 
             pIntentResult1 = main.ONOScli1.addPointIntent(
@@ -1421,11 +1497,10 @@
                 ipProto=main.params[ 'SDNIP' ][ 'tcpProto' ],
                 tcpSrc=main.params[ 'SDNIP' ][ 'srcPort' ] )
 
-            pIntentResult = pIntentResult1 and pIntentResult2 and\
-                    pIntentResult3 and pIntentResult4
-            if pIntentResult == main.TRUE:
-                getIntentResult = main.ONOScli1.intents( jsonFormat=False )
-                main.log.info( getIntentResult )
+            getIntentResult = main.ONOScli1.intents( jsonFormat=False )
+            main.log.info( getIntentResult )
+            pIntentResult = main.TRUE
+            if getIntentResult:
                 main.log.report(
                     "Point intent related to SDN-IP matching" +
                     " on TCP install successful" )
@@ -1433,6 +1508,7 @@
                 main.log.report(
                     "Point intent related to SDN-IP matching" +
                     " on TCP install failed" )
+                pIntentResult = main.FALSE
 
         iperfResult = main.Mininet1.iperf( 'h8', 'h18' )
         if iperfResult == main.TRUE:
@@ -1481,14 +1557,14 @@
             "Installing multipoint to single point " +
             "intent with rewrite mac address" )
         main.step( "Uninstalling proxy arp app" )
-        # Unistall onos-app-proxyarp app to disable reactive forwarding
-        appUninstallResult1 = main.ONOScli1.featureUninstall(
-            "onos-app-proxyarp" )
-        appUninstallResult2 = main.ONOScli2.featureUninstall(
-            "onos-app-proxyarp" )
-        appUninstallResult3 = main.ONOScli3.featureUninstall(
-            "onos-app-proxyarp" )
-        main.log.info( "onos-app-proxyarp uninstalled" )
+        # deactivating proxyarp app
+        appInstallResult = main.ONOScli1.deactivateApp( "org.onosproject.proxyarp" )
+        appCheck = main.ONOScli1.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOScli1.apps() )
+            main.log.warn( main.ONOScli1.appIDs() )
+        time.sleep( 30 )
+        main.log.info( "onos-app-proxyarp deactivated" )
 
         main.step( "Changing ipaddress of hosts h8,h9 and h18" )
         main.Mininet1.changeIP(
@@ -1603,7 +1679,7 @@
                            " and h" +
                            str( i +
                                 2 ) +
-                           "passed!" )
+                           " passed!" )
                 PingResult = main.TRUE
             else:
                 main.log.info( "Unknown error" )
@@ -1629,3 +1705,388 @@
             " intent addition with rewrite mac address successful",
             onfail="Ping all test after multipoint to single point intent" +
             " addition with rewrite mac address failed" )
+
+    def CASE20( self ):
+        """
+            Exit from mininet cli
+            reinstall ONOS
+        """
+        import time
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
+        ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
+        ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
+        ONOS2Port = main.params[ 'CTRL' ][ 'port2' ]
+        ONOS3Port = main.params[ 'CTRL' ][ 'port3' ]
+
+        main.log.report( "This testcase exits the mininet cli and reinstalls" +
+                         "ONOS to switch over to Packet Optical topology" )
+        main.log.report( "_____________________________________________" )
+        main.case( "Disconnecting mininet and restarting ONOS" )
+        main.step( "Disconnecting mininet and restarting ONOS" )
+        mininetDisconnect = main.Mininet1.disconnect()
+        print "mininetDisconnect = ", mininetDisconnect
+
+        main.step( "Removing raft logs before a clen installation of ONOS" )
+        main.ONOSbench.onosRemoveRaftLogs()
+
+        main.step( "Applying cell variable to environment" )
+        cellResult = main.ONOSbench.setCell( cellName )
+        verifyResult = main.ONOSbench.verifyCell()
+
+        time.sleep( 5 )
+        main.step( "Uninstalling ONOS package" )
+        onos1UninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOS1Ip)
+        onos2UninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOS2Ip)
+        onos3UninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOS3Ip)
+        onosUninstallResult = onos1UninstallResult and onos2UninstallResult \
+                              and onos3UninstallResult
+        time.sleep( 15 )
+        main.step( "Installing ONOS package" )
+        onos1InstallResult = main.ONOSbench.onosInstall(
+            options="-f",
+            node=ONOS1Ip )
+        onos2InstallResult = main.ONOSbench.onosInstall(
+            options="-f",
+            node=ONOS2Ip )
+        onos3InstallResult = main.ONOSbench.onosInstall(
+            options="-f",
+            node=ONOS3Ip )
+        onosInstallResult = onos1InstallResult and onos2InstallResult and\
+                onos3InstallResult
+        if onosInstallResult == main.TRUE:
+            main.log.report( "Installing ONOS package successful" )
+        else:
+            main.log.report( "Installing ONOS package failed" )
+
+        time.sleep( 10 )
+        onos1Isup = main.ONOSbench.isup( ONOS1Ip )
+        onos2Isup = main.ONOSbench.isup( ONOS2Ip )
+        onos3Isup = main.ONOSbench.isup( ONOS3Ip )
+        onosIsup = onos1Isup and onos2Isup and onos3Isup
+        if onosIsup == main.TRUE:
+            main.log.report( "ONOS instances are up and ready" )
+        else:
+            main.log.report( "ONOS instances may not be up" )
+
+        main.step( "Starting ONOS service" )
+        time.sleep( 10 )
+        startResult = main.TRUE
+        # startResult = main.ONOSbench.onosStart( ONOS1Ip )
+        startcli1 = main.ONOScli1.startOnosCli( ONOSIp=ONOS1Ip )
+        startcli2 = main.ONOScli2.startOnosCli( ONOSIp=ONOS2Ip )
+        startcli3 = main.ONOScli3.startOnosCli( ONOSIp=ONOS3Ip )
+        startResult = startcli1 and startcli2 and startcli3
+        if startResult == main.TRUE:
+            main.log.report( "ONOS cli starts properly" )
+        case20Result = mininetDisconnect and cellResult and verifyResult \
+            and onosInstallResult and onosIsup and startResult
+
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case20Result,
+            onpass= "Exiting functionality mininet topology and reinstalling" +
+                    " ONOS successful",
+            onfail= "Exiting functionality mininet topology and reinstalling" +
+                    " ONOS failed" )
+
+    def CASE21( self, main ):
+        """
+            On ONOS bench, run this command:
+            sudo -E python ~/onos/tools/test/topos/opticalTest.py -OC1 <Ctrls>
+            which spawns packet optical topology and copies the links
+            json file to the onos instance.
+            Note that in case of Packet Optical, the links are not learnt
+            from the topology, instead the links are learnt
+            from the json config file
+        """
+        main.log.report(
+            "This testcase starts the packet layer topology and REST" )
+        main.log.report( "_____________________________________________" )
+        main.case( "Starting LINC-OE and other components" )
+        main.step( "Starting LINC-OE and other components" )
+        main.log.info( "Activate optical app" )
+        appInstallResult = main.ONOScli1.activateApp( "org.onosproject.optical" )
+        appCheck = main.ONOScli1.appToIDCheck()
+        appCheck = appCheck and main.ONOScli2.appToIDCheck()
+        appCheck = appCheck and main.ONOScli3.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( "Checking ONOS application unsuccesful" )
+
+        ctrllerIP = []
+        ctrllerIP.append( main.params[ 'CTRL' ][ 'ip1' ] )
+        #ctrllerIP.append( main.params[ 'CTRL' ][ 'ip2' ] )
+        #ctrllerIP.append( main.params[ 'CTRL' ][ 'ip3' ] )
+        opticalMnScript = main.LincOE2.runOpticalMnScript( ctrllerIP = ctrllerIP )
+        case21Result = opticalMnScript and appInstallResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case21Result,
+            onpass="Packet optical topology spawned successsfully",
+            onfail="Packet optical topology spawning failed" )
+
+    def CASE22( self, main ):
+        """
+            Curretly we use, 10 optical switches(ROADM's) and
+            6 packet layer mininet switches each with one host.
+            Therefore, the roadmCount variable = 10,
+            packetLayerSWCount variable = 6, hostCount=6 and
+            links=46.
+            All this is hardcoded in the testcase. If the topology changes,
+            these hardcoded values need to be changed
+        """
+        import time
+        main.log.report(
+            "This testcase compares the optical+packet topology against what" +
+            " is expected" )
+        main.case( "Topology comparision" )
+        main.step( "Topology comparision" )
+        devicesResult = main.ONOScli3.devices( jsonFormat=False )
+        time.sleep( 15 )
+        print "devices_result = ", devicesResult
+        devicesLinewise = devicesResult.split( "\n" )
+        roadmCount = 0
+        packetLayerSWCount = 0
+        for line in devicesLinewise:
+            components = line.split( "," )
+            availability = components[ 1 ].split( "=" )[ 1 ]
+            type = components[ 3 ].split( "=" )[ 1 ]
+            if availability == 'true' and type == 'ROADM':
+                roadmCount += 1
+            elif availability == 'true' and type == 'SWITCH':
+                packetLayerSWCount += 1
+        if roadmCount == 10:
+            print "Number of Optical Switches = %d and is" % roadmCount +\
+                  " correctly detected"
+            main.log.info(
+                "Number of Optical Switches = " +
+                str( roadmCount ) +
+                " and is correctly detected" )
+            opticalSWResult = main.TRUE
+        else:
+            print "Number of Optical Switches = %d and is wrong" % roadmCount
+            main.log.info(
+                "Number of Optical Switches = " +
+                str( roadmCount ) +
+                " and is wrong" )
+            opticalSWResult = main.FALSE
+
+        if packetLayerSWCount == 6:
+            print "Number of Packet layer or mininet Switches = %d "\
+                    % packetLayerSWCount + "and is correctly detected"
+            main.log.info(
+                "Number of Packet layer or mininet Switches = " +
+                str( packetLayerSWCount ) +
+                " and is correctly detected" )
+            packetSWResult = main.TRUE
+        else:
+            print "Number of Packet layer or mininet Switches = %d and"\
+                    % packetLayerSWCount + " is wrong"
+            main.log.info(
+                "Number of Packet layer or mininet Switches = " +
+                str( packetLayerSWCount ) +
+                " and is wrong" )
+            packetSWResult = main.FALSE
+        print "_________________________________"
+
+        linksResult = main.ONOScli3.links( jsonFormat=False )
+        print "links_result = ", linksResult
+        print "_________________________________"
+        linkActiveCount = linksResult.count("state=ACTIVE") 
+        main.log.info( "linkActiveCount = " + str( linkActiveCount ))
+        if linkActiveCount == 46:
+            linkActiveResult = main.TRUE
+            main.log.info(
+                "Number of links in ACTIVE state are correct")
+        else:
+            linkActiveResult = main.FALSE
+            main.log.info(
+                "Number of links in ACTIVE state are wrong")
+
+        case22Result = opticalSWResult and packetSWResult and \
+                        linkActiveResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case22Result,
+            onpass="Packet optical topology discovery successful",
+            onfail="Packet optical topology discovery failed" )
+
+    def CASE23( self, main ):
+        import time
+        """
+            Add bidirectional point intents between 2 packet layer( mininet )
+            devices and
+            ping mininet hosts
+        """
+        main.log.report(
+            "This testcase adds bidirectional point intents between 2 " +
+            "packet layer( mininet ) devices and ping mininet hosts" )
+        main.case( "Topology comparision" )
+        main.step( "Adding point intents" )
+        ptpIntentResult = main.ONOScli1.addPointIntent(
+            "of:0000ffffffff0001/1",
+            "of:0000ffffffff0005/1" )
+        if ptpIntentResult == main.TRUE:
+            main.ONOScli1.intents( jsonFormat=False )
+            main.log.info( "Point to point intent install successful" )
+
+        ptpIntentResult = main.ONOScli1.addPointIntent(
+            "of:0000ffffffff0005/1",
+            "of:0000ffffffff0001/1" )
+        if ptpIntentResult == main.TRUE:
+            main.ONOScli1.intents( jsonFormat=False )
+            main.log.info( "Point to point intent install successful" )
+
+        time.sleep( 30 )
+        #flowHandle = main.ONOScli1.flows()
+        #main.log.info( "flows :" + flowHandle )
+
+        # Sleep for 30 seconds to provide time for the intent state to change
+        time.sleep( 60 )
+        intentHandle = main.ONOScli1.intents( jsonFormat=False )
+        main.log.info( "intents :" + intentHandle )
+
+        PingResult = main.TRUE
+        count = 1
+        main.log.info( "\n\nh1 is Pinging h5" )
+        ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+        # ping = main.LincOE2.pinghost()
+        if ping == main.FALSE and count < 5:
+            count += 1
+            PingResult = main.FALSE
+            main.log.info(
+                "Ping between h1 and h5  failed. Making attempt number " +
+                str( count ) +
+                " in 2 seconds" )
+            time.sleep( 2 )
+        elif ping == main.FALSE:
+            main.log.info( "All ping attempts between h1 and h5 have failed" )
+            PingResult = main.FALSE
+        elif ping == main.TRUE:
+            main.log.info( "Ping test between h1 and h5 passed!" )
+            PingResult = main.TRUE
+        else:
+            main.log.info( "Unknown error" )
+            PingResult = main.ERROR
+
+        if PingResult == main.FALSE:
+            main.log.report(
+                "Point intents for packet optical have not ben installed" +
+                " correctly. Cleaning up" )
+        if PingResult == main.TRUE:
+            main.log.report(
+                "Point Intents for packet optical have been " +
+                "installed correctly" )
+
+        case23Result = PingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case23Result,
+            onpass= "Point intents addition for packet optical and" +
+                    "Pingall Test successful",
+            onfail= "Point intents addition for packet optical and" +
+                    "Pingall Test NOT successful" )
+
+    def CASE24( self, main ):
+        import time
+        import json
+        """
+            LINC uses its own switch IDs. You can use the following
+            command on the LINC console to find the mapping between
+            DPIDs and LINC IDs.
+            rp(application:get_all_key(linc)).
+
+            Test Rerouting of Packet Optical by bringing a port down
+            ( port 20 ) of a switch( switchID=1, or LincOE switchID =9 ),
+            so that link
+            ( between switch1 port20 - switch5 port50 ) is inactive
+            and do a ping test. If rerouting is successful,
+            ping should pass. also check the flows
+        """
+        main.log.report(
+            "This testcase tests rerouting and pings mininet hosts" )
+        main.case( "Test rerouting and pings mininet hosts" )
+        main.step( "Attach to the Linc-OE session" )
+        attachConsole = main.LincOE1.attachLincOESession()
+        print "attachConsole = ", attachConsole
+
+        main.step( "Bring a port down and verify the link state" )
+        main.LincOE1.portDown( swId="9", ptId="20" )
+        linksNonjson = main.ONOScli3.links( jsonFormat=False )
+        main.log.info( "links = " + linksNonjson )
+
+        linkInactiveCount = linksNonjson.count("state=INACTIVE")
+        main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+        if linkInactiveCount == 2:
+            main.log.info(
+                "Number of links in INACTIVE state are correct")
+        else:
+            main.log.info(
+                "Number of links in INACTIVE state are wrong")
+        
+        links = main.ONOScli3.links()
+        main.log.info( "links = " + links )
+
+        linksResult = json.loads( links )
+        linksStateResult = main.FALSE
+        for item in linksResult:
+            if item[ 'src' ][ 'device' ] == "of:0000ffffffffff01" and item[
+                    'src' ][ 'port' ] == "20":
+                if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff05" and item[
+                        'dst' ][ 'port' ] == "50":
+                    linksState = item[ 'state' ]
+                    if linksState == "INACTIVE":
+                        main.log.info(
+                            "Links state is inactive as expected due to one" +
+                            " of the ports being down" )
+                        main.log.report(
+                            "Links state is inactive as expected due to one" +
+                            " of the ports being down" )
+                        linksStateResult = main.TRUE
+                        break
+                    else:
+                        main.log.info(
+                            "Links state is not inactive as expected" )
+                        main.log.report(
+                            "Links state is not inactive as expected" )
+                        linksStateResult = main.FALSE
+
+        print "links_state_result = ", linksStateResult
+        time.sleep( 10 )
+        #flowHandle = main.ONOScli3.flows()
+        #main.log.info( "flows :" + flowHandle )
+
+        main.step( "Verify Rerouting by a ping test" )
+        PingResult = main.TRUE
+        count = 1
+        main.log.info( "\n\nh1 is Pinging h5" )
+        ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+        # ping = main.LincOE2.pinghost()
+        if ping == main.FALSE and count < 5:
+            count += 1
+            PingResult = main.FALSE
+            main.log.info(
+                "Ping between h1 and h5  failed. Making attempt number " +
+                str( count ) +
+                " in 2 seconds" )
+            time.sleep( 2 )
+        elif ping == main.FALSE:
+            main.log.info( "All ping attempts between h1 and h5 have failed" )
+            PingResult = main.FALSE
+        elif ping == main.TRUE:
+            main.log.info( "Ping test between h1 and h5 passed!" )
+            PingResult = main.TRUE
+        else:
+            main.log.info( "Unknown error" )
+            PingResult = main.ERROR
+
+        if PingResult == main.TRUE:
+            main.log.report( "Ping test successful " )
+        if PingResult == main.FALSE:
+            main.log.report( "Ping test failed" )
+
+        case24Result = PingResult and linksStateResult
+        utilities.assert_equals( expect=main.TRUE, actual=case24Result,
+                                 onpass="Packet optical rerouting successful",
+                                 onfail="Packet optical rerouting failed" )
diff --git a/TestON/tests/MultiProd/MultiProd.topo b/TestON/tests/MultiProd/MultiProd.topo
index 28dfa92..040ec67 100755
--- a/TestON/tests/MultiProd/MultiProd.topo
+++ b/TestON/tests/MultiProd/MultiProd.topo
@@ -94,5 +94,25 @@
                 <controller> remote </controller>
             </COMPONENTS>
         </Mininet2>
+
+        <LincOE1>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>LincOEDriver</type>
+            <connect_order>7</connect_order>
+            <COMPONENTS>
+            </COMPONENTS>
+        </LincOE1>
+
+        <LincOE2>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>RemoteMininetDriver</type>
+            <connect_order>8</connect_order>
+            <COMPONENTS>
+            </COMPONENTS>
+        </LincOE2>
     </COMPONENT>
 </TOPOLOGY>
diff --git a/TestON/tests/MultiProd13/MultiProd13.params b/TestON/tests/MultiProd13/MultiProd13.params
index 6e5c85e..f08257b 100755
--- a/TestON/tests/MultiProd13/MultiProd13.params
+++ b/TestON/tests/MultiProd13/MultiProd13.params
@@ -1,7 +1,6 @@
 <PARAMS>
     
-    <testcases>1,4,10,5,6,7,8,6,8,9,8,31,32,8,33,8</testcases>    
-
+    <testcases>1,4,10,5,6,7,8,6,8,9,8,31,32,8,33,8,20,21,22,10,23,24</testcases>
     #Environment variables
     <ENV>
         <cellName>multi_test</cellName>
@@ -9,8 +8,8 @@
 
     <CTRL>
         <ip1>10.128.20.11</ip1>
-	    <ip2>10.128.20.12</ip2>
-	    <ip3>10.128.20.13</ip3>
+        <ip2>10.128.20.12</ip2>
+        <ip3>10.128.20.13</ip3>
         <port1>6633</port1>
         <port2>6633</port2>
         <port3>6633</port3>
diff --git a/TestON/tests/MultiProd13/MultiProd13.py b/TestON/tests/MultiProd13/MultiProd13.py
index 6c0b8d7..93df4c2 100644
--- a/TestON/tests/MultiProd13/MultiProd13.py
+++ b/TestON/tests/MultiProd13/MultiProd13.py
@@ -53,18 +53,19 @@
         removeLogResult = main.ONOSbench.onosRemoveRaftLogs()
 
         main.step( "Git checkout, pull and get version" )
-        #main.ONOSbench.gitCheckout( "master" )
+        main.ONOSbench.gitCheckout( "master" )
         gitPullResult = main.ONOSbench.gitPull()
         main.log.info( "git_pull_result = " + str( gitPullResult ))
         versionResult = main.ONOSbench.getVersion( report=True )
 
-        if gitPullResult == 1:
+        packageResult = main.TRUE
+        if gitPullResult == 100:
             main.step( "Using mvn clean & install" )
             cleanInstallResult = main.ONOSbench.cleanInstall()
+            main.step( "Creating ONOS package" )
+            packageResult = main.ONOSbench.onosPackage()
             # cleanInstallResult = main.TRUE
 
-        main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.onosPackage()
 
         # main.step( "Creating a cell" )
         # cellCreateResult = main.ONOSbench.createCellFile( **************
@@ -215,6 +216,14 @@
             main.log.report( "Controller assignment successfull" )
         else:
             main.log.report( "Controller assignment failed" )
+        appInstallResult = main.TRUE
+        main.log.info( "Activating reactive forwarding app" )
+        appInstallResult = main.ONOScli1.activateApp( "org.onosproject.fwd" )
+        appCheck = main.ONOScli1.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOScli1.apps() )
+            main.log.warn( main.ONOScli1.appIDs() )
+        time.sleep( 30 )
         # REACTIVE FWD test
         main.step( "Pingall" )
         pingResult = main.FALSE
@@ -248,7 +257,7 @@
         ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
 
         main.log.report(
-            "This testcase is testing if all ONOS nodes are in topologyi" +
+            "This testcase is testing if all ONOS nodes are in topology" +
             " sync with mininet and its peer ONOS nodes" )
         main.log.report( "__________________________________" )
         main.case(
@@ -371,7 +380,6 @@
                                 onpass="ONOS3 Switches view is correct",
                                 onfail="ONOS3 Switches view is incorrect" )
 
-        """
         portsResults1 =  main.Mininet1.comparePorts( MNTopo,
         json.loads( ports1 ) )
         utilities.assertEquals( expect=main.TRUE, actual=portsResults1,
@@ -389,7 +397,7 @@
         utilities.assertEquals( expect=main.TRUE, actual=portsResults3,
                 onpass="ONOS3 Ports view is correct",
                 onfail="ONOS3 Ports view is incorrect" )
-        """
+
         linksResults1 = main.Mininet1.compareLinks(
             MNTopo,
             json.loads( links1 ) )
@@ -433,17 +441,17 @@
                                 onfail="Topology Check Test NOT successful" )
 
     def CASE10( self ):
+        import time
         main.log.report(
             "This testcase uninstalls the reactive forwarding app" )
         main.log.report( "__________________________________" )
         main.case( "Uninstalling reactive forwarding app" )
         # Unistall onos-app-fwd app to disable reactive forwarding
-        appUninstallResult1 = main.ONOScli1.featureUninstall(
-            "onos-app-fwd" )
-        appUninstallResult2 = main.ONOScli2.featureUninstall(
-            "onos-app-fwd" )
-        appUninstallResult3 = main.ONOScli3.featureUninstall(
-            "onos-app-fwd" )
+        appInstallResult = main.ONOScli1.deactivateApp( "org.onosproject.fwd" )
+        appCheck = main.ONOScli1.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOScli1.apps() )
+            main.log.warn( main.ONOScli1.appIDs() )
         main.log.info( "onos-app-fwd uninstalled" )
 
         # After reactive forwarding is disabled,
@@ -453,9 +461,7 @@
 
         hosts = main.ONOScli1.hosts()
         main.log.info( hosts )
-
-        case10Result = appUninstallResult1 and\
-                appUninstallResult2 and appUninstallResult3
+        case10Result = appInstallResult
         utilities.assertEquals(
             expect=main.TRUE,
             actual=case10Result,
@@ -504,6 +510,7 @@
         hthIntentResult = main.ONOScli1.addHostIntent( "00:00:00:00:00:11/-1",
         "00:00:00:00:00:1B/-1" )
         """
+        intentsId = []
         for i in range( 8, 18 ):
             main.log.info(
                 "Adding host intent between h" + str( i ) +
@@ -517,8 +524,14 @@
             host1Id = main.ONOScli1.getHost( host1 )[ 'id' ]
             host2Id = main.ONOScli1.getHost( host2 )[ 'id' ]
             tmpResult = main.ONOScli1.addHostIntent( host1Id, host2Id )
+            intentsId.append( tmpResult )
+
+        checkIntent1 = main.ONOScli1.checkIntentState( intentsId )
+        checkIntent2 = main.ONOScli2.checkIntentState( intentsId )
+        checkIntent3 = main.ONOScli3.checkIntentState( intentsId )
 
         flowHandle = main.ONOScli1.flows()
+
         main.log.info( "flows:" + flowHandle )
 
         count = 1
@@ -571,6 +584,10 @@
         if PingResult == main.TRUE:
             main.log.report( "Host intents have been installed correctly" )
 
+        checkIntent1 = main.ONOScli1.checkIntentState( intentsId )
+        checkIntent2 = main.ONOScli2.checkIntentState( intentsId )
+        checkIntent3 = main.ONOScli3.checkIntentState( intentsId )
+
         case6Result = PingResult
         utilities.assertEquals(
             expect=main.TRUE,
@@ -637,8 +654,8 @@
         main.step( "Determine the current number of switches and links" )
         topologyOutput = main.ONOScli1.topology()
         topologyResult = main.ONOSbench.getTopology( topologyOutput )
-        activeSwitches = topologyResult[ 'deviceCount' ]
-        links = topologyResult[ 'linkCount' ]
+        activeSwitches = topologyResult[ 'devices' ]
+        links = topologyResult[ 'links' ]
         main.log.info(
             "Currently there are %s switches and %s links" %
             ( str( activeSwitches ), str( links ) ) )
@@ -881,14 +898,20 @@
         main.step(
             "Iterate through the intentids list and remove each intent" )
         for id in intentids:
-            main.ONOScli1.removeIntent( intentId=id )
+            main.ONOScli1.removeIntent( intentId=id ,purge=True )
 
-        intentResult = main.ONOScli1.intents( jsonFormat=False )
-        main.log.info( "intent_result = " + intentResult )
+        remainingIntent = main.ONOScli1.intents( jsonFormat=False )
+        main.log.info( "Remaining intents  " + remainingIntent )
+
         case8Result = main.TRUE
-
+        intentResult = main.TRUE
+        if remainingIntent:
+            main.log.error( "There are still remaining intent" )
+            intentResult = main.FALSE
         i = 8
+
         PingResult = main.TRUE
+        """
         while i < 18:
             main.log.info(
                 "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
@@ -903,7 +926,6 @@
             else:
                 main.log.info( "Unknown error" )
                 PingResult = main.ERROR
-
         # Note: If the ping result failed, that means the intents have been
         # withdrawn correctly.
         if PingResult == main.TRUE:
@@ -912,17 +934,17 @@
             # main.exit()
         if PingResult == main.FALSE:
             main.log.report( "Host intents have been withdrawn correctly" )
+        """
+        case8Result = intentResult
 
-        case8Result = case8Result and PingResult
-
-        if case8Result == main.FALSE:
+        if case8Result == main.TRUE:
             main.log.report( "Intent removal successful" )
         else:
             main.log.report( "Intent removal failed" )
 
-        utilities.assertEquals( expect=main.FALSE, actual=case8Result,
-                                onpass="Intent removal test failed",
-                                onfail="Intent removal test successful" )
+        utilities.assertEquals( expect=main.TRUE, actual=case8Result,
+                                onpass="Intent removal test successful",
+                                onfail="Intent removal test failed" )
 
     def CASE9( self ):
         """
@@ -941,28 +963,38 @@
         main.step(
             "Add point-to-point intents for mininet hosts" +
             " h8 and h18 or ONOS hosts h8 and h12" )
+        macsDict = {}
+        for i in range( 1,29 ):
+            macsDict[ 'h' + str( i ) ]= main.Mininet1.getMacAddress( host='h'+ str( i ) )
+        print macsDict
+        # main.step(var1)
         ptpIntentResult = main.ONOScli1.addPointIntent(
-            "of:0000000000003008/1",
-            "of:0000000000006018/1" )
+            ingressDevice="of:0000000000003008/1",
+            egressDevice="of:0000000000006018/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h8' ))
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
             # main.log.info( getIntentResult )
 
         ptpIntentResult = main.ONOScli1.addPointIntent(
-            "of:0000000000006018/1",
-            "of:0000000000003008/1" )
+            ingressDevice="of:0000000000006018/1",
+            egressDevice="of:0000000000003008/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h18' ))
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
             # main.log.info( getIntentResult )
 
-        main.step(
-            "Add point-to-point intents for mininet hosts" +
-            " h9 and h19 or ONOS hosts h9 and h13" )
+        var2 = "Add point intents for mn hosts h9&h19 or ONOS hosts h9&h13"
+        main.step(var2)
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000003009/1",
-            "of:0000000000006019/1" )
+            "of:0000000000006019/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h9' ))
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
@@ -970,18 +1002,22 @@
 
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000006019/1",
-            "of:0000000000003009/1" )
+            "of:0000000000003009/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h19' ))
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
             # main.log.info( getIntentResult )
 
-        main.step(
-            "Add point-to-point intents for mininet" +
-            " hosts h10 and h20 or ONOS hosts hA and h14" )
+        var3 = "Add point intents for MN hosts h10&h20 or ONOS hosts hA&h14"
+        main.step(var3)
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000003010/1",
-            "of:0000000000006020/1" )
+            "of:0000000000006020/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h10' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
@@ -989,18 +1025,24 @@
 
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000006020/1",
-            "of:0000000000003010/1" )
+            "of:0000000000003010/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h20' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
             # main.log.info( getIntentResult )
 
-        main.step(
-            "Add point-to-point intents for mininet" +
-            " hosts h11 and h21 or ONOS hosts hB and h15" )
+        var4 = "Add point intents for mininet hosts h11 and h21 or" +\
+               " ONOS hosts hB and h15"
+        main.case(var4)
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000003011/1",
-            "of:0000000000006021/1" )
+            "of:0000000000006021/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h11' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1008,18 +1050,24 @@
 
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000006021/1",
-            "of:0000000000003011/1" )
+            "of:0000000000003011/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h21' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
             # main.log.info( getIntentResult )
 
-        main.step(
-            "Add point-to-point intents for mininet" +
-            " hosts h12 and h22 or ONOS hosts hC and h16" )
+        var5 = "Add point intents for mininet hosts h12 and h22 " +\
+               "ONOS hosts hC and h16"
+        main.case(var5)
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000003012/1",
-            "of:0000000000006022/1" )
+            "of:0000000000006022/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h12' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1027,18 +1075,24 @@
 
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000006022/1",
-            "of:0000000000003012/1" )
+            "of:0000000000003012/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h22' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
             # main.log.info( getIntentResult )
 
-        main.step(
-            "Add point-to-point intents for mininet " +
-            "hosts h13 and h23 or ONOS hosts hD and h17" )
+        var6 = "Add point intents for mininet hosts h13 and h23 or" +\
+               " ONOS hosts hD and h17"
+        main.case(var6)
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000003013/1",
-            "of:0000000000006023/1" )
+            "of:0000000000006023/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h13' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1046,18 +1100,24 @@
 
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000006023/1",
-            "of:0000000000003013/1" )
+            "of:0000000000003013/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h23' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
             # main.log.info( getIntentResult )
 
-        main.step(
-            "Add point-to-point intents for mininet hosts" +
-            " h14 and h24 or ONOS hosts hE and h18" )
+        var7 = "Add point intents for mininet hosts h14 and h24 or" +\
+               " ONOS hosts hE and h18"
+        main.case(var7)
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000003014/1",
-            "of:0000000000006024/1" )
+            "of:0000000000006024/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h14' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1065,18 +1125,24 @@
 
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000006024/1",
-            "of:0000000000003014/1" )
+            "of:0000000000003014/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h24' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
             # main.log.info( getIntentResult )
 
-        main.step(
-            "Add point-to-point intents for mininet hosts" +
-            " h15 and h25 or ONOS hosts hF and h19" )
+        var8 = "Add point intents for mininet hosts h15 and h25 or" +\
+               " ONOS hosts hF and h19"
+        main.case(var8)
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000003015/1",
-            "of:0000000000006025/1" )
+            "of:0000000000006025/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h15' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1084,18 +1150,24 @@
 
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000006025/1",
-            "of:0000000000003015/1" )
+            "of:0000000000003015/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h25' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
             # main.log.info( getIntentResult )
 
-        main.step(
-            "Add point-to-point intents for mininet hosts" +
-            " h16 and h26 or ONOS hosts h10 and h1A" )
+        var9 = "Add intents for mininet hosts h16 and h26 or" +\
+               " ONOS hosts h10 and h1A"
+        main.case(var9)
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000003016/1",
-            "of:0000000000006026/1" )
+            "of:0000000000006026/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h16' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1103,37 +1175,41 @@
 
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000006026/1",
-            "of:0000000000003016/1" )
+            "of:0000000000003016/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h26' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
             # main.log.info( getIntentResult )
 
-        main.step(
-            "Add point-to-point intents for mininet hosts h17" +
-            " and h27 or ONOS hosts h11 and h1B" )
+        var10 = "Add point intents for mininet hosts h17 and h27 or" +\
+                " ONOS hosts h11 and h1B"
+        main.case(var10)
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000003017/1",
-            "of:0000000000006027/1" )
+            "of:0000000000006027/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h17' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOScli1.intents()
             main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
+            #main.log.info( getIntentResult )
 
         ptpIntentResult = main.ONOScli1.addPointIntent(
             "of:0000000000006027/1",
-            "of:0000000000003017/1" )
-        if ptpIntentResult == main.TRUE:
-            getIntentResult = main.ONOScli1.intents()
-            main.log.info( "Point to point intent install successful" )
-            # main.log.info( getIntentResult )
+            "of:0000000000003017/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h27' ))
 
         print(
             "_______________________________________________________" +
             "________________________________" )
 
         flowHandle = main.ONOScli1.flows()
-        # print "flowHandle = ", flowHandle
+        print "flowHandle = ", flowHandle
         main.log.info( "flows :" + flowHandle )
 
         count = 1
@@ -1226,13 +1302,13 @@
             host2Id = main.ONOScli1.getHost( host2 )[ 'id' ]
             for host in hostsJson:
                 if host[ 'id' ] == host1Id:
-                    ip1 = host[ 'ips' ][ 0 ]
+                    ip1 = host[ 'ipAddresses' ][ 0 ]
                     ip1 = str( ip1 + "/32" )
-                    device1 = host[ 'location' ][ 'device' ]
+                    device1 = host[ 'location' ][ 'elementId' ]
                     device1 = str( device1 + "/1" )
                 elif host[ 'id' ] == host2Id:
-                    ip2 = str( host[ 'ips' ][ 0 ] ) + "/32"
-                    device2 = host[ 'location' ][ "device" ]
+                    ip2 = str( host[ 'ipAddresses' ][ 0 ] ) + "/32"
+                    device2 = host[ 'location' ][ 'elementId' ]
                     device2 = str( device2 + "/1" )
 
             pIntentResult1 = main.ONOScli1.addPointIntent(
@@ -1241,7 +1317,7 @@
                 ipSrc=ip1,
                 ipDst=ip2,
                 ethType=main.params[ 'SDNIP' ][ 'ethType' ],
-                ipProto=main.params[ 'SDNIP' ][ 'icmpProto' ] )
+                ipProto=main.params[ 'SDNIP' ][ 'icmpProto' ], )
 
             getIntentResult = main.ONOScli1.intents( jsonFormat=False )
             main.log.info( getIntentResult )
@@ -1256,7 +1332,7 @@
 
             getIntentResult = main.ONOScli1.intents( jsonFormat=False )
             main.log.info( getIntentResult )
-            if ( pIntentResult1 and pIntentResult2 ) == main.TRUE:
+            if ( pIntentResult1 and pIntentResult2 ) :
                 # getIntentResult = main.ONOScli1.intents()
                 # main.log.info( getIntentResult )
                 main.log.info(
@@ -1322,7 +1398,7 @@
                 "Ping all test after Point intents related to" +
                 " SDN-IP matching on ICMP successful" )
 
-        case31Result = PingResult and pIntentResult1 and pIntentResult2
+        case31Result = PingResult
         utilities.assertEquals(
             expect=main.TRUE,
             actual=case31Result,
@@ -1378,13 +1454,13 @@
             host2Id = main.ONOScli1.getHost( host2 )[ 'id' ]
             for host in hostsJson:
                 if host[ 'id' ] == host1Id:
-                    ip1 = host[ 'ips' ][ 0 ]
+                    ip1 = host[ 'ipAddresses' ][ 0 ]
                     ip1 = str( ip1 + "/32" )
-                    device1 = host[ 'location' ][ 'device' ]
+                    device1 = host[ 'location' ][ 'elementId' ]
                     device1 = str( device1 + "/1" )
                 elif host[ 'id' ] == host2Id:
-                    ip2 = str( host[ 'ips' ][ 0 ] ) + "/32"
-                    device2 = host[ 'location' ][ "device" ]
+                    ip2 = str( host[ 'ipAddresses' ][ 0 ] ) + "/32"
+                    device2 = host[ 'location' ][ 'elementId' ]
                     device2 = str( device2 + "/1" )
 
             pIntentResult1 = main.ONOScli1.addPointIntent(
@@ -1421,11 +1497,10 @@
                 ipProto=main.params[ 'SDNIP' ][ 'tcpProto' ],
                 tcpSrc=main.params[ 'SDNIP' ][ 'srcPort' ] )
 
-            pIntentResult = pIntentResult1 and pIntentResult2 and\
-                    pIntentResult3 and pIntentResult4
-            if pIntentResult == main.TRUE:
-                getIntentResult = main.ONOScli1.intents( jsonFormat=False )
-                main.log.info( getIntentResult )
+            getIntentResult = main.ONOScli1.intents( jsonFormat=False )
+            main.log.info( getIntentResult )
+            pIntentResult = main.TRUE
+            if getIntentResult:
                 main.log.report(
                     "Point intent related to SDN-IP matching" +
                     " on TCP install successful" )
@@ -1433,6 +1508,7 @@
                 main.log.report(
                     "Point intent related to SDN-IP matching" +
                     " on TCP install failed" )
+                pIntentResult = main.FALSE
 
         iperfResult = main.Mininet1.iperf( 'h8', 'h18' )
         if iperfResult == main.TRUE:
@@ -1481,14 +1557,14 @@
             "Installing multipoint to single point " +
             "intent with rewrite mac address" )
         main.step( "Uninstalling proxy arp app" )
-        # Unistall onos-app-proxyarp app to disable reactive forwarding
-        appUninstallResult1 = main.ONOScli1.featureUninstall(
-            "onos-app-proxyarp" )
-        appUninstallResult2 = main.ONOScli2.featureUninstall(
-            "onos-app-proxyarp" )
-        appUninstallResult3 = main.ONOScli3.featureUninstall(
-            "onos-app-proxyarp" )
-        main.log.info( "onos-app-proxyarp uninstalled" )
+        # deactivating proxyarp app
+        appInstallResult = main.ONOScli1.deactivateApp( "org.onosproject.proxyarp" )
+        appCheck = main.ONOScli1.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOScli1.apps() )
+            main.log.warn( main.ONOScli1.appIDs() )
+        time.sleep( 30 )
+        main.log.info( "onos-app-proxyarp deactivated" )
 
         main.step( "Changing ipaddress of hosts h8,h9 and h18" )
         main.Mininet1.changeIP(
@@ -1603,7 +1679,7 @@
                            " and h" +
                            str( i +
                                 2 ) +
-                           "passed!" )
+                           " passed!" )
                 PingResult = main.TRUE
             else:
                 main.log.info( "Unknown error" )
@@ -1629,3 +1705,388 @@
             " intent addition with rewrite mac address successful",
             onfail="Ping all test after multipoint to single point intent" +
             " addition with rewrite mac address failed" )
+
+    def CASE20( self ):
+        """
+            Exit from mininet cli
+            reinstall ONOS
+        """
+        import time
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
+        ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
+        ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
+        ONOS2Port = main.params[ 'CTRL' ][ 'port2' ]
+        ONOS3Port = main.params[ 'CTRL' ][ 'port3' ]
+
+        main.log.report( "This testcase exits the mininet cli and reinstalls" +
+                         "ONOS to switch over to Packet Optical topology" )
+        main.log.report( "_____________________________________________" )
+        main.case( "Disconnecting mininet and restarting ONOS" )
+        main.step( "Disconnecting mininet and restarting ONOS" )
+        mininetDisconnect = main.Mininet1.disconnect()
+        print "mininetDisconnect = ", mininetDisconnect
+
+        main.step( "Removing raft logs before a clen installation of ONOS" )
+        main.ONOSbench.onosRemoveRaftLogs()
+
+        main.step( "Applying cell variable to environment" )
+        cellResult = main.ONOSbench.setCell( cellName )
+        verifyResult = main.ONOSbench.verifyCell()
+
+        time.sleep( 5 )
+        main.step( "Uninstalling ONOS package" )
+        onos1UninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOS1Ip)
+        onos2UninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOS2Ip)
+        onos3UninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOS3Ip)
+        onosUninstallResult = onos1UninstallResult and onos2UninstallResult \
+                              and onos3UninstallResult
+        time.sleep( 15 )
+        main.step( "Installing ONOS package" )
+        onos1InstallResult = main.ONOSbench.onosInstall(
+            options="-f",
+            node=ONOS1Ip )
+        onos2InstallResult = main.ONOSbench.onosInstall(
+            options="-f",
+            node=ONOS2Ip )
+        onos3InstallResult = main.ONOSbench.onosInstall(
+            options="-f",
+            node=ONOS3Ip )
+        onosInstallResult = onos1InstallResult and onos2InstallResult and\
+                onos3InstallResult
+        if onosInstallResult == main.TRUE:
+            main.log.report( "Installing ONOS package successful" )
+        else:
+            main.log.report( "Installing ONOS package failed" )
+
+        time.sleep( 10 )
+        onos1Isup = main.ONOSbench.isup( ONOS1Ip )
+        onos2Isup = main.ONOSbench.isup( ONOS2Ip )
+        onos3Isup = main.ONOSbench.isup( ONOS3Ip )
+        onosIsup = onos1Isup and onos2Isup and onos3Isup
+        if onosIsup == main.TRUE:
+            main.log.report( "ONOS instances are up and ready" )
+        else:
+            main.log.report( "ONOS instances may not be up" )
+
+        main.step( "Starting ONOS service" )
+        time.sleep( 10 )
+        startResult = main.TRUE
+        # startResult = main.ONOSbench.onosStart( ONOS1Ip )
+        startcli1 = main.ONOScli1.startOnosCli( ONOSIp=ONOS1Ip )
+        startcli2 = main.ONOScli2.startOnosCli( ONOSIp=ONOS2Ip )
+        startcli3 = main.ONOScli3.startOnosCli( ONOSIp=ONOS3Ip )
+        startResult = startcli1 and startcli2 and startcli3
+        if startResult == main.TRUE:
+            main.log.report( "ONOS cli starts properly" )
+        case20Result = mininetDisconnect and cellResult and verifyResult \
+            and onosInstallResult and onosIsup and startResult
+
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case20Result,
+            onpass= "Exiting functionality mininet topology and reinstalling" +
+                    " ONOS successful",
+            onfail= "Exiting functionality mininet topology and reinstalling" +
+                    " ONOS failed" )
+
+    def CASE21( self, main ):
+        """
+            On ONOS bench, run this command:
+            sudo -E python ~/onos/tools/test/topos/opticalTest.py -OC1 <Ctrls>
+            which spawns packet optical topology and copies the links
+            json file to the onos instance.
+            Note that in case of Packet Optical, the links are not learnt
+            from the topology, instead the links are learnt
+            from the json config file
+        """
+        main.log.report(
+            "This testcase starts the packet layer topology and REST" )
+        main.log.report( "_____________________________________________" )
+        main.case( "Starting LINC-OE and other components" )
+        main.step( "Starting LINC-OE and other components" )
+        main.log.info( "Activate optical app" )
+        appInstallResult = main.ONOScli1.activateApp( "org.onosproject.optical" )
+        appCheck = main.ONOScli1.appToIDCheck()
+        appCheck = appCheck and main.ONOScli2.appToIDCheck()
+        appCheck = appCheck and main.ONOScli3.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( "Checking ONOS application unsuccesful" )
+
+        ctrllerIP = []
+        ctrllerIP.append( main.params[ 'CTRL' ][ 'ip1' ] )
+        #ctrllerIP.append( main.params[ 'CTRL' ][ 'ip2' ] )
+        #ctrllerIP.append( main.params[ 'CTRL' ][ 'ip3' ] )
+        opticalMnScript = main.LincOE2.runOpticalMnScript( ctrllerIP = ctrllerIP )
+        case21Result = opticalMnScript and appInstallResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case21Result,
+            onpass="Packet optical topology spawned successsfully",
+            onfail="Packet optical topology spawning failed" )
+
+    def CASE22( self, main ):
+        """
+            Curretly we use, 10 optical switches(ROADM's) and
+            6 packet layer mininet switches each with one host.
+            Therefore, the roadmCount variable = 10,
+            packetLayerSWCount variable = 6, hostCount=6 and
+            links=46.
+            All this is hardcoded in the testcase. If the topology changes,
+            these hardcoded values need to be changed
+        """
+        import time
+        main.log.report(
+            "This testcase compares the optical+packet topology against what" +
+            " is expected" )
+        main.case( "Topology comparision" )
+        main.step( "Topology comparision" )
+        devicesResult = main.ONOScli3.devices( jsonFormat=False )
+        time.sleep( 15 )
+        print "devices_result = ", devicesResult
+        devicesLinewise = devicesResult.split( "\n" )
+        roadmCount = 0
+        packetLayerSWCount = 0
+        for line in devicesLinewise:
+            components = line.split( "," )
+            availability = components[ 1 ].split( "=" )[ 1 ]
+            type = components[ 3 ].split( "=" )[ 1 ]
+            if availability == 'true' and type == 'ROADM':
+                roadmCount += 1
+            elif availability == 'true' and type == 'SWITCH':
+                packetLayerSWCount += 1
+        if roadmCount == 10:
+            print "Number of Optical Switches = %d and is" % roadmCount +\
+                  " correctly detected"
+            main.log.info(
+                "Number of Optical Switches = " +
+                str( roadmCount ) +
+                " and is correctly detected" )
+            opticalSWResult = main.TRUE
+        else:
+            print "Number of Optical Switches = %d and is wrong" % roadmCount
+            main.log.info(
+                "Number of Optical Switches = " +
+                str( roadmCount ) +
+                " and is wrong" )
+            opticalSWResult = main.FALSE
+
+        if packetLayerSWCount == 6:
+            print "Number of Packet layer or mininet Switches = %d "\
+                    % packetLayerSWCount + "and is correctly detected"
+            main.log.info(
+                "Number of Packet layer or mininet Switches = " +
+                str( packetLayerSWCount ) +
+                " and is correctly detected" )
+            packetSWResult = main.TRUE
+        else:
+            print "Number of Packet layer or mininet Switches = %d and"\
+                    % packetLayerSWCount + " is wrong"
+            main.log.info(
+                "Number of Packet layer or mininet Switches = " +
+                str( packetLayerSWCount ) +
+                " and is wrong" )
+            packetSWResult = main.FALSE
+        print "_________________________________"
+
+        linksResult = main.ONOScli3.links( jsonFormat=False )
+        print "links_result = ", linksResult
+        print "_________________________________"
+        linkActiveCount = linksResult.count("state=ACTIVE") 
+        main.log.info( "linkActiveCount = " + str( linkActiveCount ))
+        if linkActiveCount == 46:
+            linkActiveResult = main.TRUE
+            main.log.info(
+                "Number of links in ACTIVE state are correct")
+        else:
+            linkActiveResult = main.FALSE
+            main.log.info(
+                "Number of links in ACTIVE state are wrong")
+
+        case22Result = opticalSWResult and packetSWResult and \
+                        linkActiveResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case22Result,
+            onpass="Packet optical topology discovery successful",
+            onfail="Packet optical topology discovery failed" )
+
+    def CASE23( self, main ):
+        import time
+        """
+            Add bidirectional point intents between 2 packet layer( mininet )
+            devices and
+            ping mininet hosts
+        """
+        main.log.report(
+            "This testcase adds bidirectional point intents between 2 " +
+            "packet layer( mininet ) devices and ping mininet hosts" )
+        main.case( "Topology comparision" )
+        main.step( "Adding point intents" )
+        ptpIntentResult = main.ONOScli1.addPointIntent(
+            "of:0000ffffffff0001/1",
+            "of:0000ffffffff0005/1" )
+        if ptpIntentResult == main.TRUE:
+            main.ONOScli1.intents( jsonFormat=False )
+            main.log.info( "Point to point intent install successful" )
+
+        ptpIntentResult = main.ONOScli1.addPointIntent(
+            "of:0000ffffffff0005/1",
+            "of:0000ffffffff0001/1" )
+        if ptpIntentResult == main.TRUE:
+            main.ONOScli1.intents( jsonFormat=False )
+            main.log.info( "Point to point intent install successful" )
+
+        time.sleep( 30 )
+        #flowHandle = main.ONOScli1.flows()
+        #main.log.info( "flows :" + flowHandle )
+
+        # Sleep for 30 seconds to provide time for the intent state to change
+        time.sleep( 60 )
+        intentHandle = main.ONOScli1.intents( jsonFormat=False )
+        main.log.info( "intents :" + intentHandle )
+
+        PingResult = main.TRUE
+        count = 1
+        main.log.info( "\n\nh1 is Pinging h5" )
+        ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+        # ping = main.LincOE2.pinghost()
+        if ping == main.FALSE and count < 5:
+            count += 1
+            PingResult = main.FALSE
+            main.log.info(
+                "Ping between h1 and h5  failed. Making attempt number " +
+                str( count ) +
+                " in 2 seconds" )
+            time.sleep( 2 )
+        elif ping == main.FALSE:
+            main.log.info( "All ping attempts between h1 and h5 have failed" )
+            PingResult = main.FALSE
+        elif ping == main.TRUE:
+            main.log.info( "Ping test between h1 and h5 passed!" )
+            PingResult = main.TRUE
+        else:
+            main.log.info( "Unknown error" )
+            PingResult = main.ERROR
+
+        if PingResult == main.FALSE:
+            main.log.report(
+                "Point intents for packet optical have not ben installed" +
+                " correctly. Cleaning up" )
+        if PingResult == main.TRUE:
+            main.log.report(
+                "Point Intents for packet optical have been " +
+                "installed correctly" )
+
+        case23Result = PingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case23Result,
+            onpass= "Point intents addition for packet optical and" +
+                    "Pingall Test successful",
+            onfail= "Point intents addition for packet optical and" +
+                    "Pingall Test NOT successful" )
+
+    def CASE24( self, main ):
+        import time
+        import json
+        """
+            LINC uses its own switch IDs. You can use the following
+            command on the LINC console to find the mapping between
+            DPIDs and LINC IDs.
+            rp(application:get_all_key(linc)).
+
+            Test Rerouting of Packet Optical by bringing a port down
+            ( port 20 ) of a switch( switchID=1, or LincOE switchID =9 ),
+            so that link
+            ( between switch1 port20 - switch5 port50 ) is inactive
+            and do a ping test. If rerouting is successful,
+            ping should pass. also check the flows
+        """
+        main.log.report(
+            "This testcase tests rerouting and pings mininet hosts" )
+        main.case( "Test rerouting and pings mininet hosts" )
+        main.step( "Attach to the Linc-OE session" )
+        attachConsole = main.LincOE1.attachLincOESession()
+        print "attachConsole = ", attachConsole
+
+        main.step( "Bring a port down and verify the link state" )
+        main.LincOE1.portDown( swId="9", ptId="20" )
+        linksNonjson = main.ONOScli3.links( jsonFormat=False )
+        main.log.info( "links = " + linksNonjson )
+
+        linkInactiveCount = linksNonjson.count("state=INACTIVE")
+        main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+        if linkInactiveCount == 2:
+            main.log.info(
+                "Number of links in INACTIVE state are correct")
+        else:
+            main.log.info(
+                "Number of links in INACTIVE state are wrong")
+        
+        links = main.ONOScli3.links()
+        main.log.info( "links = " + links )
+
+        linksResult = json.loads( links )
+        linksStateResult = main.FALSE
+        for item in linksResult:
+            if item[ 'src' ][ 'device' ] == "of:0000ffffffffff01" and item[
+                    'src' ][ 'port' ] == "20":
+                if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff05" and item[
+                        'dst' ][ 'port' ] == "50":
+                    linksState = item[ 'state' ]
+                    if linksState == "INACTIVE":
+                        main.log.info(
+                            "Links state is inactive as expected due to one" +
+                            " of the ports being down" )
+                        main.log.report(
+                            "Links state is inactive as expected due to one" +
+                            " of the ports being down" )
+                        linksStateResult = main.TRUE
+                        break
+                    else:
+                        main.log.info(
+                            "Links state is not inactive as expected" )
+                        main.log.report(
+                            "Links state is not inactive as expected" )
+                        linksStateResult = main.FALSE
+
+        print "links_state_result = ", linksStateResult
+        time.sleep( 10 )
+        #flowHandle = main.ONOScli3.flows()
+        #main.log.info( "flows :" + flowHandle )
+
+        main.step( "Verify Rerouting by a ping test" )
+        PingResult = main.TRUE
+        count = 1
+        main.log.info( "\n\nh1 is Pinging h5" )
+        ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+        # ping = main.LincOE2.pinghost()
+        if ping == main.FALSE and count < 5:
+            count += 1
+            PingResult = main.FALSE
+            main.log.info(
+                "Ping between h1 and h5  failed. Making attempt number " +
+                str( count ) +
+                " in 2 seconds" )
+            time.sleep( 2 )
+        elif ping == main.FALSE:
+            main.log.info( "All ping attempts between h1 and h5 have failed" )
+            PingResult = main.FALSE
+        elif ping == main.TRUE:
+            main.log.info( "Ping test between h1 and h5 passed!" )
+            PingResult = main.TRUE
+        else:
+            main.log.info( "Unknown error" )
+            PingResult = main.ERROR
+
+        if PingResult == main.TRUE:
+            main.log.report( "Ping test successful " )
+        if PingResult == main.FALSE:
+            main.log.report( "Ping test failed" )
+
+        case24Result = PingResult and linksStateResult
+        utilities.assert_equals( expect=main.TRUE, actual=case24Result,
+                                 onpass="Packet optical rerouting successful",
+                                 onfail="Packet optical rerouting failed" )
diff --git a/TestON/tests/MultiProd13/MultiProd13.topo b/TestON/tests/MultiProd13/MultiProd13.topo
index a4fad91..4b1ab12 100755
--- a/TestON/tests/MultiProd13/MultiProd13.topo
+++ b/TestON/tests/MultiProd13/MultiProd13.topo
@@ -94,5 +94,25 @@
                 <controller> remote </controller>
             </COMPONENTS>
         </Mininet2>
+
+        <LincOE1>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>LincOEDriver</type>
+            <connect_order>7</connect_order>
+            <COMPONENTS>
+            </COMPONENTS>
+        </LincOE1>
+
+        <LincOE2>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>RemoteMininetDriver</type>
+            <connect_order>8</connect_order>
+            <COMPONENTS>
+            </COMPONENTS>
+        </LincOE2>
     </COMPONENT>
 </TOPOLOGY>
diff --git a/TestON/tests/ProdFunc/ProdFunc.params b/TestON/tests/ProdFunc/ProdFunc.params
index 4367bf4..5f1ec30 100755
--- a/TestON/tests/ProdFunc/ProdFunc.params
+++ b/TestON/tests/ProdFunc/ProdFunc.params
@@ -1,5 +1,5 @@
 <PARAMS>
-    
+    #1,4,10,5,6,7,8,9,8,11,8,20,21,22,10,23,24
     <testcases>1,4,10,5,6,7,8,9,8,11,8,2,20,21,22,10,23,24</testcases>
     #Environment variables
     <ENV>
diff --git a/TestON/tests/ProdFunc/ProdFunc.py b/TestON/tests/ProdFunc/ProdFunc.py
index f779b6b..9c2c271 100644
--- a/TestON/tests/ProdFunc/ProdFunc.py
+++ b/TestON/tests/ProdFunc/ProdFunc.py
@@ -41,44 +41,53 @@
         cellResult = main.ONOSbench.setCell( cellName )
         verifyResult = main.ONOSbench.verifyCell()
 
-        main.step( "Removing raft logs before a clen installation of ONOS" )
-        main.ONOSbench.onosRemoveRaftLogs()
-
         main.step( "Git checkout and get version" )
-        #main.ONOSbench.gitCheckout( "master" )
+        main.ONOSbench.gitCheckout( "master" )
         gitPullResult = main.ONOSbench.gitPull()
         main.log.info( "git_pull_result = " + str( gitPullResult ))
         main.ONOSbench.getVersion( report=True )
 
+        packageResult = main.TRUE
         if gitPullResult == 1:
             main.step( "Using mvn clean & install" )
             main.ONOSbench.cleanInstall()
+            main.step( "Creating ONOS package" )
+            packageResult = main.ONOSbench.onosPackage()
         elif gitPullResult == 0:
             main.log.report(
                 "Git Pull Failed, look into logs for detailed reason" )
             main.cleanup()
             main.exit()
 
-        main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.onosPackage()
 
+        main.step( "Uninstalling ONOS package" )
+        onosInstallResult = main.ONOSbench.onosUninstall( ONOS1Ip )
+        if onosInstallResult == main.TRUE:
+            main.log.report( "Uninstalling ONOS package successful" )
+        else:
+            main.log.report( "Uninstalling ONOS package failed" )
+
+        time.sleep( 20 )
         main.step( "Installing ONOS package" )
-        onosInstallResult = main.ONOSbench.onosInstall()
+        onosInstallResult = main.ONOSbench.onosInstall( ONOS1Ip )
+        print onosInstallResult
         if onosInstallResult == main.TRUE:
             main.log.report( "Installing ONOS package successful" )
         else:
             main.log.report( "Installing ONOS package failed" )
 
+        time.sleep( 20 )
         onos1Isup = main.ONOSbench.isup()
         if onos1Isup == main.TRUE:
             main.log.report( "ONOS instance is up and ready" )
         else:
             main.log.report( "ONOS instance may not be up" )
 
-        main.step( "Starting ONOS service" )
-        startResult = main.ONOSbench.onosStart( ONOS1Ip )
+        startResult = main.TRUE
+        #main.step( "Starting ONOS service" )
+        #startResult = main.ONOSbench.onosStart( ONOS1Ip )
 
-        main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+        main.ONOS2.startOnosCli( ONOS1Ip )
         main.step( "Starting Mininet CLI..." )
         
         # Starting the mininet using the old way
@@ -183,6 +192,7 @@
             Exit from mininet cli
             reinstall ONOS
         """
+        import time
         cellName = main.params[ 'ENV' ][ 'cellName' ]
         ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
 
@@ -190,22 +200,60 @@
                          "ONOS to switch over to Packet Optical topology" )
         main.log.report( "_____________________________________________" )
         main.case( "Disconnecting mininet and restarting ONOS" )
+
         main.step( "Disconnecting mininet and restarting ONOS" )
+        step1Result = main.TRUE
         mininetDisconnect = main.Mininet1.disconnect()
-        print "mininetDisconnect = ", mininetDisconnect        
-
-        main.step( "Removing raft logs before a clen installation of ONOS" )
-        main.ONOSbench.onosRemoveRaftLogs()
-
+        print "mininetDisconnect = ", mininetDisconnect
+        step1Result = mininetDisconnect
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Mininet disconnect successfully",
+            onfail="Mininet failed to disconnect")
+        """
+        main.step( "Removing raft logs before a clean installation of ONOS" )
+        step2Result = main.TRUE
+        removeRaftLogsResult = main.ONOSbench.onosRemoveRaftLogs()
+        step2Result = removeRaftLogsResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Raft logs removed successfully",
+            onfail="Failed to remove raft logs")
+        """
         main.step( "Applying cell variable to environment" )
-        cellResult = main.ONOSbench.setCell( cellName )
-        verifyResult = main.ONOSbench.verifyCell()
+        step3Result = main.TRUE
+        setCellResult = main.ONOSbench.setCell( cellName )
+        verifyCellResult = main.ONOSbench.verifyCell()
+        step3Result = setCellResult and verifyCellResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step3Result,
+            onpass="Cell applied successfully",
+            onfail="Failed to apply cell")
 
-        onosInstallResult = main.ONOSbench.onosInstall()
-        if onosInstallResult == main.TRUE:
-            main.log.report( "Installing ONOS package successful" )
-        else:
-            main.log.report( "Installing ONOS package failed" )
+        main.step( "Uninstalling ONOS package" )
+        step4Result = main.TRUE
+        ONOSip1 = main.params[ 'CTRL' ][ 'ip1' ]
+        onosUninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOSip1)
+        step4Result = onosUninstallResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step4Result,
+            onpass="Successfully uninstalled ONOS",
+            onfail="Failed to uninstall ONOS")
+
+        time.sleep( 5 )
+        main.step( "Installing ONOS package" )
+        step5Result = main.TRUE
+        onosInstallResult = main.ONOSbench.onosInstall( node = ONOSip1 )
+        step5Result = onosInstallResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step5Result,
+            onpass="Successfully installed ONOS",
+            onfail="Failed to install ONOS")
 
         onos1Isup = main.ONOSbench.isup()
         if onos1Isup == main.TRUE:
@@ -214,19 +262,24 @@
             main.log.report( "ONOS instance may not be up" )
 
         main.step( "Starting ONOS service" )
+        step6Result = main.TRUE
         startResult = main.ONOSbench.onosStart( ONOS1Ip )
-
-        main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
-        case20Result = mininetDisconnect and cellResult and verifyResult \
-            and onosInstallResult and onos1Isup and \
-            startResult
+        step6Result = startResult
         utilities.assert_equals(
             expect=main.TRUE,
-            actual=case20Result,
-            onpass= "Exiting functionality mininet topology and reinstalling" +
-                    " ONOS successful",
-            onfail= "Exiting functionality mininet topology and reinstalling" +
-                    " ONOS failed" )
+            actual=step6Result,
+            onpass="Successfully started ONOS",
+            onfail="Failed to start ONOS")
+
+        main.step( "Starting ONOS cli" )
+        step7Result = main.TRUE
+        cliResult = main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+        step7Result = cliResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step7Result,
+            onpass="Successfully started ONOS cli",
+            onfail="Failed to start ONOS cli")
 
     def CASE21( self, main ):
         """
@@ -238,20 +291,37 @@
             from the topology, instead the links are learnt
             from the json config file
         """
+        import time
         main.log.report(
             "This testcase starts the packet layer topology and REST" )
         main.log.report( "_____________________________________________" )
         main.case( "Starting LINC-OE and other components" )
-        main.step( "Starting LINC-OE and other components" )
-        appInstallResult = main.ONOS2.featureInstall( "onos-app-optical" )
-        opticalMnScript = main.LincOE2.runOpticalMnScript(ctrllerIP = main.params[ 'CTRL' ][ 'ip1' ])
 
-        case21Result = opticalMnScript and appInstallResult
+        main.step( "Activate optical app" )
+        step1Result = main.TRUE
+        activateOpticalResult = main.ONOS2.activateApp( "org.onosproject.optical" )
+        step1Result = activateOpticalResult
         utilities.assert_equals(
             expect=main.TRUE,
-            actual=case21Result,
-            onpass="Packet optical topology spawned successsfully",
-            onfail="Packet optical topology spawning failed" )
+            actual=step1Result,
+            onpass="Successfully activated optical app",
+            onfail="Failed to activate optical app")
+
+        appCheck = main.ONOS2.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOS2.apps() )
+            main.log.warn( main.ONOS2.appIDs() )
+
+        main.step( "Starting mininet and LINC-OE" )
+        step2Result = main.TRUE
+        time.sleep( 10 )
+        opticalMnScript = main.LincOE2.runOpticalMnScript(ctrllerIP = main.params[ 'CTRL' ][ 'ip1' ])
+        step2Result = opticalMnScript
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Started the topology successfully ",
+            onfail="Failed to start the topology")
 
     def CASE22( self, main ):
         """
@@ -259,21 +329,32 @@
             6 packet layer mininet switches each with one host.
             Therefore, the roadmCount variable = 10,
             packetLayerSWCount variable = 6, hostCount=6 and
-            links=42.
+            links=46.
             All this is hardcoded in the testcase. If the topology changes,
             these hardcoded values need to be changed
         """
+        import time
         main.log.report(
             "This testcase compares the optical+packet topology against what" +
             " is expected" )
         main.case( "Topology comparision" )
-        main.step( "Topology comparision" )
-        main.ONOS3.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
-        devicesResult = main.ONOS3.devices( jsonFormat=False )
 
-        print "devices_result = ", devicesResult
+        main.step( "Starts new ONOS cli" )
+        step1Result = main.TRUE
+        cliResult = main.ONOS3.startOnosCli( ONOSIp=main.params[ 'CTRL' ]\
+                                                               [ 'ip1' ] )
+        step1Result = cliResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully starts a new cli",
+            onfail="Failed to start new cli" )
+
+        main.step( "Compare topology" )
+        step2Result = main.TRUE
+        devicesResult = main.ONOS3.devices( jsonFormat=False )
+        print "devices_result :\n", devicesResult
         devicesLinewise = devicesResult.split( "\n" )
-        devicesLinewise = devicesLinewise[ 1: ]
         roadmCount = 0
         packetLayerSWCount = 0
         for line in devicesLinewise:
@@ -299,7 +380,6 @@
                 str( roadmCount ) +
                 " and is wrong" )
             opticalSWResult = main.FALSE
-
         if packetLayerSWCount == 6:
             print "Number of Packet layer or mininet Switches = %d "\
                     % packetLayerSWCount + "and is correctly detected"
@@ -316,14 +396,15 @@
                 str( packetLayerSWCount ) +
                 " and is wrong" )
             packetSWResult = main.FALSE
+        # sleeps for sometime so the state of the switches will be active
+        time.sleep( 30 )
         print "_________________________________"
-
         linksResult = main.ONOS3.links( jsonFormat=False )
         print "links_result = ", linksResult
         print "_________________________________"
-        linkActiveCount = linksResult.count("state=ACTIVE") 
+        linkActiveCount = linksResult.count("state=ACTIVE")
         main.log.info( "linkActiveCount = " + str( linkActiveCount ))
-        if linkActiveCount == 42:
+        if linkActiveCount == 46:
             linkActiveResult = main.TRUE
             main.log.info(
                 "Number of links in ACTIVE state are correct")
@@ -331,41 +412,13 @@
             linkActiveResult = main.FALSE
             main.log.info(
                 "Number of links in ACTIVE state are wrong")
-
-        # NOTE:Since only point intents are added, there is no
-        # requirement to discover the hosts
-        # Therfore, the below portion of the code is commented.
-        """
-        #Discover hosts using pingall
-        pingallResult = main.LincOE2.pingall()
-
-        hostsResult = main.ONOS3.hosts( jsonFormat=False )
-        main.log.info( "hosts_result = "+hostsResult )
-        main.log.info( "_________________________________" )
-        hostsLinewise = hostsResult.split( "\n" )
-        hostsLinewise = hostsLinewise[ 1:-1 ]
-        hostCount = 0
-        for line in hostsLinewise:
-            hostid = line.split( "," )[ 0 ].split( "=" )[ 1 ]
-            hostCount +=1
-        if hostCount ==2:
-            print "Number of hosts = %d and is correctly detected" %hostCount
-            main.log.info( "Number of hosts = " + str( hostCount ) +" and \
-                            is correctly detected" )
-            hostDiscovery = main.TRUE
-        else:
-            print "Number of hosts = %d and is wrong" %hostCount
-            main.log.info( "Number of hosts = " + str( hostCount ) +" and \
-                            is wrong" )
-            hostDiscovery = main.FALSE
-        """
-        case22Result = opticalSWResult and packetSWResult and \
+        step2Result = opticalSWResult and packetSWResult and \
                         linkActiveResult
         utilities.assert_equals(
             expect=main.TRUE,
-            actual=case22Result,
-            onpass="Packet optical topology discovery successful",
-            onfail="Packet optical topology discovery failed" )
+            actual=step2Result,
+            onpass="Successfully loaded packet optical topology",
+            onfail="Failed to load packet optical topology" )
 
     def CASE23( self, main ):
         import time
@@ -377,71 +430,50 @@
         main.log.report(
             "This testcase adds bidirectional point intents between 2 " +
             "packet layer( mininet ) devices and ping mininet hosts" )
-        main.case( "Topology comparision" )
+        main.case( "Install point intents between 2 packet layer device and " +
+                   "ping the hosts" )
+
         main.step( "Adding point intents" )
-        ptpIntentResult = main.ONOS3.addPointIntent(
+        checkFlowResult = main.TRUE
+        step1Result = main.TRUE
+        main.pIntentsId = []
+        pIntent1 = main.ONOS3.addPointIntent(
             "of:0000ffffffff0001/1",
             "of:0000ffffffff0005/1" )
-        if ptpIntentResult == main.TRUE:
-            main.ONOS3.intents( jsonFormat=False )
-            main.log.info( "Point to point intent install successful" )
-
-        ptpIntentResult = main.ONOS3.addPointIntent(
+        pIntent2 = main.ONOS3.addPointIntent(
             "of:0000ffffffff0005/1",
             "of:0000ffffffff0001/1" )
-        if ptpIntentResult == main.TRUE:
-            main.ONOS3.intents( jsonFormat=False )
-            main.log.info( "Point to point intent install successful" )
-
-        time.sleep( 30 )
-        flowHandle = main.ONOS3.flows()
-        main.log.info( "flows :" + flowHandle )
-
+        main.pIntentsId.append( pIntent1 )
+        main.pIntentsId.append( pIntent2 )
+        time.sleep( 10 )
+        main.log.info( "Checking intents state")
+        checkStateResult = main.ONOS3.checkIntentState(
+                                                  intentsId = main.pIntentsId )
+        time.sleep( 10 )
+        main.log.info( "Checking flows state")
+        checkFlowResult = main.ONOS3.checkFlowsState()
         # Sleep for 30 seconds to provide time for the intent state to change
-        time.sleep( 60 )
-        intentHandle = main.ONOS3.intents( jsonFormat=False )
-        main.log.info( "intents :" + intentHandle )
-
-        PingResult = main.TRUE
-        count = 1
-        main.log.info( "\n\nh1 is Pinging h5" )
-        ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
-        # ping = main.LincOE2.pinghost()
-        if ping == main.FALSE and count < 5:
-            count += 1
-            PingResult = main.FALSE
-            main.log.info(
-                "Ping between h1 and h5  failed. Making attempt number " +
-                str( count ) +
-                " in 2 seconds" )
-            time.sleep( 2 )
-        elif ping == main.FALSE:
-            main.log.info( "All ping attempts between h1 and h5 have failed" )
-            PingResult = main.FALSE
-        elif ping == main.TRUE:
-            main.log.info( "Ping test between h1 and h5 passed!" )
-            PingResult = main.TRUE
-        else:
-            main.log.info( "Unknown error" )
-            PingResult = main.ERROR
-
-        if PingResult == main.FALSE:
-            main.log.report(
-                "Point intents for packet optical have not ben installed" +
-                " correctly. Cleaning up" )
-        if PingResult == main.TRUE:
-            main.log.report(
-                "Point Intents for packet optical have been " +
-                "installed correctly" )
-
-        case23Result = PingResult
+        time.sleep( 10 )
+        main.log.info( "Checking intents state one more time")
+        checkStateResult = main.ONOS3.checkIntentState(
+                                                  intentsId = main.pIntentsId )
+        step1Result = checkStateResult and checkFlowResult
         utilities.assert_equals(
             expect=main.TRUE,
-            actual=case23Result,
-            onpass= "Point intents addition for packet optical and" +
-                    "Pingall Test successful",
-            onfail= "Point intents addition for packet optical and" +
-                    "Pingall Test NOT successful" )
+            actual=step1Result,
+            onpass="Successfully added point intents",
+            onfail="Failed to add point intents")
+
+        main.step( "Ping h1 and h5" )
+        step2Result = main.TRUE
+        main.log.info( "\n\nh1 is Pinging h5" )
+        pingResult = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+        step2Result = pingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Successfully pinged h1 and h5",
+            onfail="Failed to ping between h1 and h5")
 
     def CASE24( self, main ):
         import time
@@ -462,16 +494,23 @@
         main.log.report(
             "This testcase tests rerouting and pings mininet hosts" )
         main.case( "Test rerouting and pings mininet hosts" )
+
         main.step( "Attach to the Linc-OE session" )
-        attachConsole = main.LincOE1.attachLincOESession() 
-        print "attachConsole = ", attachConsole
+        step1Result = main.TRUE
+        attachConsole = main.LincOE1.attachLincOESession()
+        step1Result = attachConsole
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully attached Linc-OE session",
+            onfail="Failed to attached Linc-OE session")
 
         main.step( "Bring a port down and verify the link state" )
+        step2Result = main.TRUE
         main.LincOE1.portDown( swId="9", ptId="20" )
         linksNonjson = main.ONOS3.links( jsonFormat=False )
         main.log.info( "links = " + linksNonjson )
-
-        linkInactiveCount = linksNonjson.count("state=INACTIVE")
+        linkInactiveCount = linksNonjson.count( "state=INACTIVE" )
         main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
         if linkInactiveCount == 2:
             main.log.info(
@@ -479,10 +518,8 @@
         else:
             main.log.info(
                 "Number of links in INACTIVE state are wrong")
-        
         links = main.ONOS3.links()
         main.log.info( "links = " + links )
-
         linksResult = json.loads( links )
         linksStateResult = main.FALSE
         for item in linksResult:
@@ -506,45 +543,184 @@
                         main.log.report(
                             "Links state is not inactive as expected" )
                         linksStateResult = main.FALSE
-
-        print "links_state_result = ", linksStateResult
         time.sleep( 10 )
-        flowHandle = main.ONOS3.flows()
-        main.log.info( "flows :" + flowHandle )
+        checkFlowsState = main.ONOS3.checkFlowsState()
+        step2Result = linksStateResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Successfuly brought down a link",
+            onfail="Failed to bring down a link")
 
         main.step( "Verify Rerouting by a ping test" )
-        PingResult = main.TRUE
-        count = 1
+        step3Result = main.TRUE
         main.log.info( "\n\nh1 is Pinging h5" )
-        ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
-        # ping = main.LincOE2.pinghost()
-        if ping == main.FALSE and count < 5:
-            count += 1
-            PingResult = main.FALSE
+        pingResult = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+        step3Result = pingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step3Result,
+            onpass="Successfully pinged h1 and h5",
+            onfail="Failed to ping between h1 and h5")
+
+        main.step( "Bring the downed port up and verify the link state" )
+        step4Result = main.TRUE
+        main.LincOE1.portUp( swId="9", ptId="20" )
+        linksNonjson = main.ONOS3.links( jsonFormat=False )
+        main.log.info( "links = " + linksNonjson )
+        linkInactiveCount = linksNonjson.count( "state=INACTIVE" )
+        main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+        if linkInactiveCount == 0:
             main.log.info(
-                "Ping between h1 and h5  failed. Making attempt number " +
-                str( count ) +
-                " in 2 seconds" )
-            time.sleep( 2 )
-        elif ping == main.FALSE:
-            main.log.info( "All ping attempts between h1 and h5 have failed" )
-            PingResult = main.FALSE
-        elif ping == main.TRUE:
-            main.log.info( "Ping test between h1 and h5 passed!" )
-            PingResult = main.TRUE
+                "Number of links in INACTIVE state are correct")
         else:
-            main.log.info( "Unknown error" )
-            PingResult = main.ERROR
+            main.log.info(
+                "Number of links in INACTIVE state are wrong")
+            step4Result = main.FALSE
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step4Result,
+            onpass="Successfully brought the port up",
+            onfail="Failed to bring the port up")
+        """
+        main.step( "Removing host intents" )
+        step5Result = main.TRUE
+        removeResult = main.TRUE
+        # Check remaining intents
+        intentsJson = json.loads( main.ONOS3.intents() )
+        main.ONOS3.removeIntent( intentId=intent1, purge=True )
+        main.ONOS3.removeIntent( intentId=intent2, purge=True )
+        for intents in intentsJson:
+            main.ONOS3.removeIntent( intentId=intents.get( 'id' ),
+                                     app='org.onosproject.optical',
+                                     purge=True )
+        print json.loads( main.ONOS3.intents() )
+        if len( json.loads( main.ONOS3.intents() ) ):
+            removeResult = main.FALSE
+        step5Result = removeResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=step5Result,
+                                 onpass="Successfully removed host intents",
+                                 onfail="Failed to remove host intents" )
+        """
+    def CASE10( self ):
+        main.log.report(
+            "This testcase uninstalls the reactive forwarding app" )
+        main.log.report( "__________________________________" )
+        main.case( "Uninstalling reactive forwarding app" )
+        main.step( "Uninstalling reactive forwarding app" )
+        step1Result = main.TRUE
+        # Unistall onos-app-fwd app to disable reactive forwarding
+        main.log.info( "deactivate reactive forwarding app" )
+        appUninstallResult = main.ONOS2.deactivateApp( "org.onosproject.fwd" )
+        appCheck = main.ONOS2.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOS2.apps() )
+            main.log.warn( main.ONOS2.appIDs() )
+        step1Result = appUninstallResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully deactivate reactive forwarding app",
+            onfail="Failed to deactivate reactive forwarding app")
+        # After reactive forwarding is disabled, the reactive flows on
+        # switches timeout in 10-15s
+        # So sleep for 15s
+        time.sleep( 15 )
+        flows = main.ONOS2.flows()
+        main.log.info( flows )
 
-        if PingResult == main.TRUE:
-            main.log.report( "Ping test successful " )
-        if PingResult == main.FALSE:
-            main.log.report( "Ping test failed" )
+    def CASE25( self ):
+        """
+            Add host intents between 2 packet layer host
+        """
+        import time
+        import json
+        main.log.report( "Adding host intents between 2 optical layer host" )
+        main.case( "Test add host intents between optical layer host" )
 
-        case24Result = PingResult and linksStateResult
-        utilities.assert_equals( expect=main.TRUE, actual=case24Result,
-                                 onpass="Packet optical rerouting successful",
-                                 onfail="Packet optical rerouting failed" )
+        main.step( "Discover host using arping" )
+        step1Result = main.TRUE
+        main.hostMACs = []
+        main.hostId = []
+        #Listing host MAC addresses
+        for i in range( 1 , 7 ):
+            main.hostMACs.append( "00:00:00:00:00:" +
+                                str( hex( i )[ 2: ] ).zfill( 2 ).upper() )
+        for macs in main.hostMACs:
+            main.hostId.append( macs + "/-1" )
+        host1 = main.hostId[ 0 ]
+        host2 = main.hostId[ 1 ]
+        # Use arping to discover the hosts
+        main.LincOE2.arping( host = "h1" )
+        main.LincOE2.arping( host = "h2" )
+        time.sleep( 5 )
+        hostsDict = main.ONOS3.hosts()
+        if not len( hostsDict ):
+            step1Result = main.FALSE
+        # Adding host intent
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Hosts discovered",
+            onfail="Failed to discover hosts")
+
+        main.step( "Adding host intents to h1 and h2" )
+        step2Result = main.TRUE
+        intentsId = []
+        intent1 = main.ONOS3.addHostIntent( hostIdOne = host1,
+                                            hostIdTwo = host2 )
+        intentsId.append( intent1 )
+        time.sleep( 5 )
+        intent2 = main.ONOS3.addHostIntent( hostIdOne = host2,
+                                            hostIdTwo = host1 )
+        intentsId.append( intent2 )
+        # Checking intents state before pinging
+        main.log.info( "Checking intents state" )
+        time.sleep( 15 )
+        intentResult = main.ONOS3.checkIntentState( intentsId = intentsId )
+        #check intent state again if intents are not in installed state
+        if not intentResult:
+           intentResult = main.ONOS3.checkIntentState( intentsId = intentsId )
+        step2Result = intentResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=step2Result,
+                                 onpass="All intents are in INSTALLED state ",
+                                 onfail="Some of the intents are not in " +
+                                        "INSTALLED state " )
+
+        # pinging h1 to h2 and then ping h2 to h1
+        main.step( "Pinging h1 and h2" )
+        step3Result = main.TRUE
+        pingResult = main.TRUE
+        pingResult = main.LincOE2.pingHostOptical( src="h1", target="h2" )
+        pingResult = pingResult and main.LincOE2.pingHostOptical( src="h2",
+                                                                  target="h1" )
+        step3Result = pingResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=step3Result,
+                                 onpass="Pinged successfully between h1 and h2",
+                                 onfail="Pinged failed between h1 and h2" )
+        # Removed all added host intents
+        main.step( "Removing host intents" )
+        step4Result = main.TRUE
+        removeResult = main.TRUE
+        # Check remaining intents
+        intentsJson = json.loads( main.ONOS3.intents() )
+        main.ONOS3.removeIntent( intentId=intent1, purge=True )
+        main.ONOS3.removeIntent( intentId=intent2, purge=True )
+        for intents in intentsJson:
+            main.ONOS3.removeIntent( intentId=intents.get( 'id' ),
+                                     app='org.onosproject.optical',
+                                     purge=True )
+        print json.loads( main.ONOS3.intents() )
+        if len( json.loads( main.ONOS3.intents() ) ):
+            removeResult = main.FALSE
+        step4Result = removeResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=step4Result,
+                                 onpass="Successfully removed host intents",
+                                 onfail="Failed to remove host intents" )
 
     def CASE4( self, main ):
         import re
@@ -553,6 +729,7 @@
                          " all the switches to all the controllers and" +
                          " discovering the hosts in reactive mode" )
         main.log.report( "__________________________________" )
+
         main.case( "Pingall Test" )
         main.step( "Assigning switches to controllers" )
         ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
@@ -651,6 +828,13 @@
                     ip5=ONOS5Ip,port5=ONOS5Port )
         """
         # REACTIVE FWD test
+        main.log.info( "Activate fwd app" )
+        appInstallResult = main.ONOS2.activateApp( "org.onosproject.fwd" )
+        appCheck = main.ONOS2.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOS2.apps() )
+            main.log.warn( main.ONOS2.appIDs() )
+        time.sleep( 10 )
 
         main.step( "Get list of hosts from Mininet" )
         hostList = main.Mininet1.getHosts()
@@ -687,31 +871,6 @@
             onpass="Controller assignment and Pingall Test successful",
             onfail="Controller assignment and Pingall Test NOT successful" )
 
-    def CASE10( self ):
-        main.log.report(
-            "This testcase uninstalls the reactive forwarding app" )
-        main.log.report( "__________________________________" )
-        main.case( "Uninstalling reactive forwarding app" )
-        # Unistall onos-app-fwd app to disable reactive forwarding
-        appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
-        main.log.info( "onos-app-fwd uninstalled" )
-
-        # After reactive forwarding is disabled, the reactive flows on
-        # switches timeout in 10-15s
-        # So sleep for 15s
-        time.sleep( 15 )
-
-        flows = main.ONOS2.flows()
-        main.log.info( flows )
-
-        case10Result = appUninstallResult
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=case10Result,
-            onpass="Reactive forwarding app uninstallation successful",
-            onfail="Reactive forwarding app uninstallation failed" )
-
-
     def CASE11( self ):
         # NOTE: This testcase require reactive forwarding mode enabled
         # NOTE: in the beginning and then uninstall it before adding 
@@ -727,26 +886,40 @@
         main.step( "Moving host h9 from device s9 and attach it to s8" )
         main.Mininet1.moveHost(host = 'h9', oldSw = 's9', newSw = 's8')
 
-        time.sleep(15) #Time delay to have all the flows ready
+        main.log.info( "Activate fwd app" )
+        appInstallResult = main.ONOS2.activateApp( "org.onosproject.fwd" )
+        appCheck = main.ONOS2.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOS2.apps() )
+            main.log.warn( main.ONOS2.appIDs() )
+
+        time.sleep(25) #Time delay to have all the flows ready
         main.step( "Pingall" )
         pingResult = main.FALSE
         time1 = time.time()
-        pingResult = main.Mininet1.pingall()
+        pingResult = main.Mininet1.pingall( timeout=120,
+                                            shortCircuit=True,
+                                            acceptableFailed=20 )
         time2 = time.time()
         print "Time for pingall: %2f seconds" % ( time2 - time1 )
 
         hosts = main.ONOS2.hosts( jsonFormat = False )
         main.log.info( hosts )
         
-        main.case( "Uninstalling reactive forwarding app" )
-        # Unistall onos-app-fwd app to disable reactive forwarding
-        appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
-        main.log.info( "onos-app-fwd uninstalled" )
+        main.log.info( "deactivate reactive forwarding app" )
+        appUninstallResult = main.ONOS2.deactivateApp( "org.onosproject.fwd" )
+        appCheck = main.ONOS2.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOS2.apps() )
+            main.log.warn( main.ONOS2.appIDs() )
 
         main.step( "Add point intents between hosts on the same device")
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003008/1",
-            "of:0000000000003008/3" )
+            "of:0000000000003008/3",
+            ethType='IPV4',
+            ethSrc='00:00:00:00:00:08',
+            ethDst='00:00:00:00:00:09' )
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -754,7 +927,10 @@
 
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003008/3",
-            "of:0000000000003008/1" )
+            "of:0000000000003008/1",
+            ethType='IPV4',
+            ethSrc='00:00:00:00:00:09',
+            ethDst='00:00:00:00:00:08' )
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -779,7 +955,7 @@
                 "Point intents for hosts on same devices" +
                 "installed correctly. Cleaning up" )
 
-        case11Result = ping and pingResult
+        case11Result = ping
         utilities.assert_equals(
             expect = main.TRUE,
             actual = case11Result,
@@ -788,7 +964,6 @@
             onfail = "Point intents for hosts on same devices" +
                     "Ping Test NOT successful" )
 
-
     def CASE12( self ):
         """
         Verify the default flows on each switch in proactive mode
@@ -855,6 +1030,7 @@
                             "00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1" )
         print "______________________________________________________"
         """
+        intentsId = []
         for i in range( 8, 18 ):
             main.log.info(
                 "Adding host intent between h" + str( i ) +
@@ -869,8 +1045,9 @@
             if host2:
                 host2Id = main.ONOS2.getHost( host2 )[ 'id' ]
             if host1Id and host2Id:
-                main.ONOS2.addHostIntent( host1Id, host2Id )
+                intentsId.append( main.ONOS2.addHostIntent( host1Id, host2Id ) )
 
+        checkIntentResult = main.ONOS2.checkIntentState( intentsId )
         time.sleep( 10 )
         hIntents = main.ONOS2.intents( jsonFormat=False )
         main.log.info( "intents:" + hIntents )
@@ -929,6 +1106,8 @@
             main.log.report(
                 "Ping all test after Host intent addition successful" )
 
+        checkIntentResult = main.ONOS2.checkIntentState( intentsId )
+
         case6Result = PingResult
         utilities.assert_equals(
             expect=main.TRUE,
@@ -1016,7 +1195,7 @@
         main.step( "Compare ONOS Topology to MN Topology" )
         devicesJson = main.ONOS2.devices()
         linksJson = main.ONOS2.links()
-        # portsJson = main.ONOS2.ports()
+        portsJson = main.ONOS2.ports()
 
         result1 = main.Mininet1.compareSwitches(
             MNTopo,
@@ -1024,9 +1203,8 @@
         result2 = main.Mininet1.compareLinks(
             MNTopo,
             json.loads( linksJson ) )
-        # result3 = main.Mininet1.comparePorts(
-        # MNTopo, json.loads( portsJson ) )
 
+        result3 = main.Mininet1.comparePorts( MNTopo, json.loads( portsJson ) )
         # result = result1 and result2 and result3
         result = result1 and result2
 
@@ -1105,8 +1283,8 @@
         main.step( "Determine the current number of switches and links" )
         topologyOutput = main.ONOS2.topology()
         topologyResult = main.ONOS1.getTopology( topologyOutput )
-        activeSwitches = topologyResult[ 'deviceCount' ]
-        links = topologyResult[ 'linkCount' ]
+        activeSwitches = topologyResult[ 'devices' ]
+        links = topologyResult[ 'links' ]
         print "activeSwitches = ", type( activeSwitches )
         print "links = ", type( links )
         main.log.info(
@@ -1169,8 +1347,7 @@
         result2 = main.Mininet1.compareLinks(
             MNTopo,
             json.loads( linksJson ) )
-        # result3 = main.Mininet1.comparePorts(
-        # MNTopo, json.loads( portsJson ) )
+        result3 = main.Mininet1.comparePorts( MNTopo, json.loads( portsJson ) )
 
         # result = result1 and result2 and result3
         result = result1 and result2
@@ -1209,9 +1386,9 @@
         main.log.info( "intent removal" )
         main.case( "Removing installed intents" )
         main.step( "Obtain the intent id's" )
-        intentResult = main.ONOS2.intents( jsonFormat=False )
-        main.log.info( "intent_result = " + intentResult )
-        intentLinewise = intentResult.split( "\n" )
+        currentIntents = main.ONOS2.intents( jsonFormat=False )
+        main.log.info( "intent_result = " + currentIntents )
+        intentLinewise = currentIntents.split( "\n" )
 
         intentList = [line for line in intentLinewise \
             if line.startswith( "id=")]
@@ -1223,30 +1400,31 @@
         main.step(
             "Iterate through the intentids list and remove each intent" )
         for id in intentids:
-            main.ONOS2.removeIntent( intentId=id )
+            main.ONOS2.removeIntent( intentId=id ,purge=True)
 
-        intentResult = main.ONOS2.intents( jsonFormat=False )
-        main.log.info( "intent_result = " + intentResult )
-        
-        intentList = [line for line in intentResult.split( "\n" ) \
+        remainingIntents = main.ONOS2.intents( jsonFormat=False )
+        main.log.info( "intent_result = " + remainingIntents )
+        if remainingIntents:
+            main.log.info( "There are still remaining intents " )
+            intentResult = main.FALSE
+        else:
+            intentResult = main.TRUE
+
+        intentList = [line for line in remainingIntents.split( "\n" ) \
             if line.startswith( "id=")]
         intentState = [line.split( "," )[ 1 ].split( "=" )[ 1 ] for line in \
             intentList]
         for state in intentState:
             print state
         
-        case8Result = main.TRUE        
+        case8Result = main.TRUE
         for state in intentState:
             if state != 'WITHDRAWN':
                 case8Result = main.FALSE
                 break
-                
-        if case8Result == main.TRUE:
-            main.log.report( "Intent removal successful" )
-        else:
-            main.log.report( "Intent removal failed" )
 
         PingResult = main.TRUE
+        """
         if case8Result == main.TRUE:
             i = 8
             while i < 18:
@@ -1263,7 +1441,7 @@
                 else:
                     main.log.info( "Unknown error" )
                     PingResult = main.ERROR
-
+        
             # Note: If the ping result failed, that means the intents have been
             # withdrawn correctly.
         if PingResult == main.TRUE:
@@ -1272,15 +1450,14 @@
             # main.exit()
         if PingResult == main.FALSE:
             main.log.report( "Installed intents have been withdrawn correctly" )
+        """
 
-        case8Result = case8Result and PingResult
-
-        if case8Result == main.FALSE:
+        if case8Result:
             main.log.report( "Intent removal successful" )
         else:
             main.log.report( "Intent removal failed" )
 
-        utilities.assert_equals( expect=main.FALSE, actual=case8Result,
+        utilities.assert_equals( expect=main.TRUE, actual=case8Result,
                                  onpass="Intent removal test passed",
                                  onfail="Intent removal test failed" )
 
@@ -1296,21 +1473,28 @@
             "Adding bidirectional point for mn hosts" +
             "( h8-h18, h9-h19, h10-h20, h11-h21, h12-h22, " +
             "h13-h23, h14-h24, h15-h25, h16-h26, h17-h27 )" )
-
+        macsDict = {}
+        for i in range( 1,29 ):
+            macsDict[ 'h' + str( i ) ]= main.Mininet1.getMacAddress( host='h'+ str( i ) )
+        print macsDict
         main.step( "Add point intents for mn hosts h8 and h18 or" +
                    "ONOS hosts h8 and h12" )
         # main.step(var1)
         ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003008/1",
-            "of:0000000000006018/1" )
+            ingressDevice="of:0000000000003008/1",
+            egressDevice="of:0000000000006018/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h8' ))
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
             # main.log.info( getIntentResult )
 
         ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000006018/1",
-            "of:0000000000003008/1" )
+            ingressDevice="of:0000000000006018/1",
+            egressDevice="of:0000000000003008/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h18' ))
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1320,7 +1504,9 @@
         main.step(var2)
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003009/1",
-            "of:0000000000006019/1" )
+            "of:0000000000006019/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h9' ))
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1328,7 +1514,9 @@
 
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006019/1",
-            "of:0000000000003009/1" )
+            "of:0000000000003009/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h19' ))
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1338,7 +1526,10 @@
         main.step(var3)
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003010/1",
-            "of:0000000000006020/1" )
+            "of:0000000000006020/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h10' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1346,7 +1537,10 @@
 
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006020/1",
-            "of:0000000000003010/1" )
+            "of:0000000000003010/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h20' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1357,7 +1551,10 @@
         main.case(var4)
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003011/1",
-            "of:0000000000006021/1" )
+            "of:0000000000006021/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h11' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1365,7 +1562,10 @@
 
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006021/1",
-            "of:0000000000003011/1" )
+            "of:0000000000003011/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h21' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1376,7 +1576,10 @@
         main.case(var5)
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003012/1",
-            "of:0000000000006022/1" )
+            "of:0000000000006022/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h12' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1384,7 +1587,10 @@
 
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006022/1",
-            "of:0000000000003012/1" )
+            "of:0000000000003012/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h22' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1395,7 +1601,10 @@
         main.case(var6)
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003013/1",
-            "of:0000000000006023/1" )
+            "of:0000000000006023/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h13' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1403,7 +1612,10 @@
 
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006023/1",
-            "of:0000000000003013/1" )
+            "of:0000000000003013/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h23' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1414,7 +1626,10 @@
         main.case(var7)
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003014/1",
-            "of:0000000000006024/1" )
+            "of:0000000000006024/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h14' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1422,7 +1637,10 @@
 
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006024/1",
-            "of:0000000000003014/1" )
+            "of:0000000000003014/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h24' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1433,7 +1651,10 @@
         main.case(var8)
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003015/1",
-            "of:0000000000006025/1" )
+            "of:0000000000006025/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h15' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1441,7 +1662,10 @@
 
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006025/1",
-            "of:0000000000003015/1" )
+            "of:0000000000003015/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h25' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1452,7 +1676,10 @@
         main.case(var9)
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003016/1",
-            "of:0000000000006026/1" )
+            "of:0000000000006026/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h16' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1460,7 +1687,10 @@
 
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006026/1",
-            "of:0000000000003016/1" )
+            "of:0000000000003016/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h26' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1471,7 +1701,10 @@
         main.case(var10)
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003017/1",
-            "of:0000000000006027/1" )
+            "of:0000000000006027/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h17' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1479,7 +1712,10 @@
 
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006027/1",
-            "of:0000000000003017/1" )
+            "of:0000000000003017/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h27' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
diff --git a/TestON/tests/ProdFunc/ProdFunc.py.save b/TestON/tests/ProdFunc/ProdFunc.py.save
new file mode 100644
index 0000000..00b895c
--- /dev/null
+++ b/TestON/tests/ProdFunc/ProdFunc.py.save
@@ -0,0 +1,1518 @@
+
+# Testing the basic functionality of ONOS Next
+# For sanity and driver functionality excercises only.
+
+import time
+# import sys
+# import os
+# import re
+import json
+
+time.sleep( 1 )
+
+
+class ProdFunc:
+
+    def __init__( self ):
+        self.default = ''
+
+    def CASE1( self, main ):
+        import time
+        """
+        Startup sequence:
+        cell <name>
+        onos-verify-cell
+        onos-remove-raft-log
+        git pull
+        mvn clean install
+        onos-package
+        onos-install -f
+        onos-wait-for-start
+        """
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+        main.case( "Setting up test environment" )
+        main.log.report(
+            "This testcase is testing setting up test environment" )
+        main.log.report( "__________________________________" )
+
+        main.step( "Applying cell variable to environment" )
+        cellResult = main.ONOSbench.setCell( cellName )
+        verifyResult = main.ONOSbench.verifyCell()
+
+        main.step( "Removing raft logs before a clen installation of ONOS" )
+        main.ONOSbench.onosRemoveRaftLogs()
+
+        main.step( "Git checkout and get version" )
+        #main.ONOSbench.gitCheckout( "master" )
+        gitPullResult = main.ONOSbench.gitPull()
+        main.log.info( "git_pull_result = " + str( gitPullResult ))
+        main.ONOSbench.getVersion( report=True )
+
+        if gitPullResult == 1:
+            main.step( "Using mvn clean & install" )
+            main.ONOSbench.cleanInstall()
+        elif gitPullResult == 0:
+            main.log.report(
+                "Git Pull Failed, look into logs for detailed reason" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Creating ONOS package" )
+        packageResult = main.ONOSbench.onosPackage()
+
+        main.step( "Installing ONOS package" )
+        onosInstallResult = main.ONOSbench.onosInstall()
+        if onosInstallResult == main.TRUE:
+            main.log.report( "Installing ONOS package successful" )
+        else:
+            main.log.report( "Installing ONOS package failed" )
+
+        onos1Isup = main.ONOSbench.isup()
+        if onos1Isup == main.TRUE:
+            main.log.report( "ONOS instance is up and ready" )
+        else:
+            main.log.report( "ONOS instance may not be up" )
+
+        main.step( "Starting ONOS service" )
+        startResult = main.ONOSbench.onosStart( ONOS1Ip )
+
+        main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+        main.step( "Starting Mininet CLI..." )
+        
+        # Starting the mininet using the old way
+        main.step( "Starting Mininet ..." )
+        netIsUp = main.Mininet1.startNet()
+        if netIsUp:
+            main.log.info("Mininet CLI is up")
+        
+        case1Result = ( packageResult and
+                        cellResult and verifyResult
+                        and onosInstallResult and
+                        onos1Isup and startResult )
+        utilities.assert_equals( expect=main.TRUE, actual=case1Result,
+                                 onpass="Test startup successful",
+                                 onfail="Test startup NOT successful" )
+
+    def CASE2( self, main ):
+        """
+        Switch Down
+        """
+        # NOTE: You should probably run a topology check after this
+        import time
+
+        main.case( "Switch down discovery" )
+        main.log.report( "This testcase is testing a switch down discovery" )
+        main.log.report( "__________________________________" )
+
+        switchSleep = int( main.params[ 'timers' ][ 'SwitchDiscovery' ] )
+
+        description = "Killing a switch to ensure it is discovered correctly"
+        main.log.report( description )
+        main.case( description )
+
+        # TODO: Make this switch parameterizable
+        main.step( "Kill s28 " )
+        main.log.report( "Deleting s28" )
+        # FIXME: use new dynamic topo functions
+        main.Mininet1.delSwitch( "s28" )
+        main.log.info(
+            "Waiting " +
+            str( switchSleep ) +
+            " seconds for switch down to be discovered" )
+        time.sleep( switchSleep )
+        # Peek at the deleted switch
+        device = main.ONOS2.getDevice( dpid="0028" )
+        print "device = ", device
+        if device[ u'available' ] == 'False':
+            case2Result = main.FALSE
+        else:
+            case2Result = main.TRUE
+        utilities.assert_equals( expect=main.TRUE, actual=case2Result,
+                                 onpass="Switch down discovery successful",
+                                 onfail="Switch down discovery failed" )
+
+    def CASE101( self, main ):
+        """
+        Cleanup sequence:
+        onos-service <nodeIp> stop
+        onos-uninstall
+
+        TODO: Define rest of cleanup
+
+        """
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+        main.case( "Cleaning up test environment" )
+
+        main.step( "Testing ONOS kill function" )
+        killResult = main.ONOSbench.onosKill( ONOS1Ip )
+
+        main.step( "Stopping ONOS service" )
+        stopResult = main.ONOSbench.onosStop( ONOS1Ip )
+
+        main.step( "Uninstalling ONOS service" )
+        uninstallResult = main.ONOSbench.onosUninstall()
+
+        case11Result = killResult and stopResult and uninstallResult
+        utilities.assert_equals( expect=main.TRUE, actual=case11Result,
+                                 onpass="Cleanup successful",
+                                 onfail="Cleanup failed" )
+
+    def CASE3( self, main ):
+        """
+        Test 'onos' command and its functionality in driver
+        """
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+        main.case( "Testing 'onos' command" )
+
+        main.step( "Sending command 'onos -w <onos-ip> system:name'" )
+        cmdstr1 = "system:name"
+        cmdResult1 = main.ONOSbench.onosCli( ONOS1Ip, cmdstr1 )
+        main.log.info( "onos command returned: " + cmdResult1 )
+
+        main.step( "Sending command 'onos -w <onos-ip> onos:topology'" )
+        cmdstr2 = "onos:topology"
+        cmdResult2 = main.ONOSbench.onosCli( ONOS1Ip, cmdstr2 )
+        main.log.info( "onos command returned: " + cmdResult2 )
+
+    def CASE20( self ):
+        """
+            Exit from mininet cli
+            reinstall ONOS
+        """
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+        main.log.report( "This testcase exits the mininet cli and reinstalls" +
+                         "ONOS to switch over to Packet Optical topology" )
+        main.log.report( "_____________________________________________" )
+        main.case( "Disconnecting mininet and restarting ONOS" )
+        main.step( "Disconnecting mininet and restarting ONOS" )
+        mininetDisconnect = main.Mininet1.disconnect()
+        print "mininetDisconnect = ", mininetDisconnect        
+
+        main.step( "Removing raft logs before a clen installation of ONOS" )
+        main.ONOSbench.onosRemoveRaftLogs()
+
+        main.step( "Applying cell variable to environment" )
+        cellResult = main.ONOSbench.setCell( cellName )
+        verifyResult = main.ONOSbench.verifyCell()
+
+        onosInstallResult = main.ONOSbench.onosInstall()
+        if onosInstallResult == main.TRUE:
+            main.log.report( "Installing ONOS package successful" )
+        else:
+            main.log.report( "Installing ONOS package failed" )
+
+        onos1Isup = main.ONOSbench.isup()
+        if onos1Isup == main.TRUE:
+            main.log.report( "ONOS instance is up and ready" )
+        else:
+            main.log.report( "ONOS instance may not be up" )
+
+        main.step( "Starting ONOS service" )
+        startResult = main.ONOSbench.onosStart( ONOS1Ip )
+
+        main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+        case20Result = mininetDisconnect and cellResult and verifyResult \
+            and onosInstallResult and onos1Isup and \
+            startResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case20Result,
+            onpass= "Exiting functionality mininet topology and reinstalling" +
+                    " ONOS successful",
+            onfail= "Exiting functionality mininet topology and reinstalling" +
+                    " ONOS failed" )
+
+    def CASE21( self, main ):
+        """
+            On ONOS bench, run this command:
+             ./~/ONOS/tools/test/bin/onos-topo-cfg
+            which starts the rest and copies the links
+            json file to the onos instance.
+            Note that in case of Packet Optical, the links are not learnt
+            from the topology, instead the links are learnt
+            from the json config file
+        """
+        main.log.report(
+            "This testcase starts the packet layer topology and REST" )
+        main.log.report( "_____________________________________________" )
+        main.case( "Starting LINC-OE and other components" )
+        main.step( "Starting LINC-OE and other components" )
+        startConsoleResult = main.LincOE1.startConsole()
+        opticalMnScript = main.LincOE2.runOpticalMnScript()
+        onosTopoCfgResult = main.ONOSbench.runOnosTopoCfg(
+            instanceName=main.params[ 'CTRL' ][ 'ip1' ],
+            jsonFile=main.params[ 'OPTICAL' ][ 'jsonfile' ] )
+
+        print "start_console_result =", startConsoleResult
+        print "optical_mn_script = ", opticalMnScript
+        print "onos_topo_cfg_result =", onosTopoCfgResult
+
+        case21Result = startConsoleResult and opticalMnScript and \
+            onosTopoCfgResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case21Result,
+            onpass="Packet optical topology spawned successsfully",
+            onfail="Packet optical topology spawning failed" )
+
+    def CASE22( self, main ):
+        """
+            Curretly we use, 4 linear switch optical topology and
+            2 packet layer mininet switches each with one host.
+            Therefore, the roadmCount variable = 4,
+            packetLayerSWCount variable = 2 and hostCount = 2
+            and this is hardcoded in the testcase. If the topology changes,
+            these hardcoded values need to be changed
+        """
+        main.log.report(
+            "This testcase compares the optical+packet topology against what" +
+            " is expected" )
+        main.case( "Topology comparision" )
+        main.step( "Topology comparision" )
+        main.ONOS3.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+        devicesResult = main.ONOS3.devices( jsonFormat=False )
+
+        print "devices_result = ", devicesResult
+        devicesLinewise = devicesResult.split( "\n" )
+        devicesLinewise = devicesLinewise[ 1: ]
+        roadmCount = 0
+        packetLayerSWCount = 0
+        for line in devicesLinewise:
+            components = line.split( "," )
+            availability = components[ 1 ].split( "=" )[ 1 ]
+            type = components[ 3 ].split( "=" )[ 1 ]
+            if availability == 'true' and type == 'ROADM':
+                roadmCount += 1
+            elif availability == 'true' and type == 'SWITCH':
+                packetLayerSWCount += 1
+        if roadmCount == 4:
+            print "Number of Optical Switches = %d and is" % roadmCount +\
+                  " correctly detected"
+            main.log.info(
+                "Number of Optical Switches = " +
+                str( roadmCount ) +
+                " and is correctly detected" )
+            opticalSWResult = main.TRUE
+        else:
+            print "Number of Optical Switches = %d and is wrong" % roadmCount
+            main.log.info(
+                "Number of Optical Switches = " +
+                str( roadmCount ) +
+                " and is wrong" )
+            opticalSWResult = main.FALSE
+
+        if packetLayerSWCount == 2:
+            print "Number of Packet layer or mininet Switches = %d "\
+                    % packetLayerSWCount + "and is correctly detected"
+            main.log.info(
+                "Number of Packet layer or mininet Switches = " +
+                str( packetLayerSWCount ) +
+                " and is correctly detected" )
+            packetSWResult = main.TRUE
+        else:
+            print "Number of Packet layer or mininet Switches = %d and"\
+                    % packetLayerSWCount + " is wrong"
+            main.log.info(
+                "Number of Packet layer or mininet Switches = " +
+                str( packetLayerSWCount ) +
+                " and is wrong" )
+            packetSWResult = main.FALSE
+        print "_________________________________"
+
+        linksResult = main.ONOS3.links( jsonFormat=False )
+        print "links_result = ", linksResult
+        print "_________________________________"
+
+        # NOTE:Since only point intents are added, there is no
+        # requirement to discover the hosts
+        # Therfore, the below portion of the code is commented.
+        """
+        #Discover hosts using pingall
+        pingallResult = main.LincOE2.pingall()
+
+        hostsResult = main.ONOS3.hosts( jsonFormat=False )
+        main.log.info( "hosts_result = "+hostsResult )
+        main.log.info( "_________________________________" )
+        hostsLinewise = hostsResult.split( "\n" )
+        hostsLinewise = hostsLinewise[ 1:-1 ]
+        hostCount = 0
+        for line in hostsLinewise:
+            hostid = line.split( "," )[ 0 ].split( "=" )[ 1 ]
+            hostCount +=1
+        if hostCount ==2:
+            print "Number of hosts = %d and is correctly detected" %hostCount
+            main.log.info( "Number of hosts = " + str( hostCount ) +" and \
+                            is correctly detected" )
+            hostDiscovery = main.TRUE
+        else:
+            print "Number of hosts = %d and is wrong" %hostCount
+            main.log.info( "Number of hosts = " + str( hostCount ) +" and \
+                            is wrong" )
+            hostDiscovery = main.FALSE
+        """
+        case22Result = opticalSWResult and packetSWResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case22Result,
+            onpass="Packet optical topology discovery successful",
+            onfail="Packet optical topology discovery failed" )
+
+    def CASE23( self, main ):
+        import time
+        """
+            Add bidirectional point intents between 2 packet layer( mininet )
+            devices and
+            ping mininet hosts
+        """
+        main.log.report(
+            "This testcase adds bidirectional point intents between 2 " +
+            "packet layer( mininet ) devices and ping mininet hosts" )
+        main.case( "Topology comparision" )
+        main.step( "Adding point intents" )
+        ptpIntentResult = main.ONOS3.addPointIntent(
+            "of:0000ffffffff0001/1",
+            "of:0000ffffffff0002/1" )
+        if ptpIntentResult == main.TRUE:
+            main.ONOS3.intents( jsonFormat=False )
+            main.log.info( "Point to point intent install successful" )
+
+        ptpIntentResult = main.ONOS3.addPointIntent(
+            "of:0000ffffffff0002/1",
+            "of:0000ffffffff0001/1" )
+        if ptpIntentResult == main.TRUE:
+            main.ONOS3.intents( jsonFormat=False )
+            main.log.info( "Point to point intent install successful" )
+
+        time.sleep( 10 )
+        flowHandle = main.ONOS3.flows()
+        main.log.info( "flows :" + flowHandle )
+
+        # Sleep for 30 seconds to provide time for the intent state to change
+        time.sleep( 30 )
+        intentHandle = main.ONOS3.intents( jsonFormat=False )
+        main.log.info( "intents :" + intentHandle )
+
+        PingResult = main.TRUE
+        count = 1
+        main.log.info( "\n\nh1 is Pinging h2" )
+        ping = main.LincOE2.pingHostOptical( src="h1", target="h2" )
+        # ping = main.LincOE2.pinghost()
+        if ping == main.FALSE and count < 5:
+            count += 1
+            PingResult = main.FALSE
+            main.log.info(
+                "Ping between h1 and h2  failed. Making attempt number " +
+                str( count ) +
+                " in 2 seconds" )
+            time.sleep( 2 )
+        elif ping == main.FALSE:
+            main.log.info( "All ping attempts between h1 and h2 have failed" )
+            PingResult = main.FALSE
+        elif ping == main.TRUE:
+            main.log.info( "Ping test between h1 and h2 passed!" )
+            PingResult = main.TRUE
+        else:
+            main.log.info( "Unknown error" )
+            PingResult = main.ERROR
+
+        if PingResult == main.FALSE:
+            main.log.report(
+                "Point intents for packet optical have not ben installed" +
+                " correctly. Cleaning up" )
+        if PingResult == main.TRUE:
+            main.log.report(
+                "Point Intents for packet optical have been " +
+                "installed correctly" )
+
+        case23Result = PingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case23Result,
+            onpass= "Point intents addition for packet optical and" +
+                    "Pingall Test successful",
+            onfail= "Point intents addition for packet optical and" +
+                    "Pingall Test NOT successful" )
+
+    def CASE24( self, main ):
+        import time
+        import json
+        """
+            Test Rerouting of Packet Optical by bringing a port down
+            ( port 22 ) of a switch( switchID=1 ), so that link
+            ( between switch1 port22 - switch4-port30 ) is inactive
+            and do a ping test. If rerouting is successful,
+            ping should pass. also check the flows
+        """
+        main.log.report(
+            "This testcase tests rerouting and pings mininet hosts" )
+        main.case( "Test rerouting and pings mininet hosts" )
+        main.step( "Bring a port down and verify the link state" )
+        main.LincOE1.portDown( swId="1", ptId="22" )
+        linksNonjson = main.ONOS3.links( jsonFormat=False )
+        main.log.info( "links = " + linksNonjson )
+
+        links = main.ONOS3.links()
+        main.log.info( "links = " + links )
+
+        linksResult = json.loads( links )
+        linksStateResult = main.FALSE
+        for item in linksResult:
+            if item[ 'src' ][ 'device' ] == "of:0000ffffffffff01" and item[
+                    'src' ][ 'port' ] == "22":
+                if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff04" and item[
+                        'dst' ][ 'port' ] == "30":
+                    linksState = item[ 'state' ]
+                    if linksState == "INACTIVE":
+                        main.log.info(
+                            "Links state is inactive as expected due to one" +
+                            " of the ports being down" )
+                        main.log.report(
+                            "Links state is inactive as expected due to one" +
+                            " of the ports being down" )
+                        linksStateResult = main.TRUE
+                        break
+                    else:
+                        main.log.info(
+                            "Links state is not inactive as expected" )
+                        main.log.report(
+                            "Links state is not inactive as expected" )
+                        linksStateResult = main.FALSE
+
+        print "links_state_result = ", linksStateResult
+        time.sleep( 10 )
+        flowHandle = main.ONOS3.flows()
+        main.log.info( "flows :" + flowHandle )
+
+        main.step( "Verify Rerouting by a ping test" )
+        PingResult = main.TRUE
+        count = 1
+        main.log.info( "\n\nh1 is Pinging h2" )
+        ping = main.LincOE2.pingHostOptical( src="h1", target="h2" )
+        # ping = main.LincOE2.pinghost()
+        if ping == main.FALSE and count < 5:
+            count += 1
+            PingResult = main.FALSE
+            main.log.info(
+                "Ping between h1 and h2  failed. Making attempt number " +
+                str( count ) +
+                " in 2 seconds" )
+            time.sleep( 2 )
+        elif ping == main.FALSE:
+            main.log.info( "All ping attempts between h1 and h2 have failed" )
+            PingResult = main.FALSE
+        elif ping == main.TRUE:
+            main.log.info( "Ping test between h1 and h2 passed!" )
+            PingResult = main.TRUE
+        else:
+            main.log.info( "Unknown error" )
+            PingResult = main.ERROR
+
+        if PingResult == main.TRUE:
+            main.log.report( "Ping test successful " )
+        if PingResult == main.FALSE:
+            main.log.report( "Ping test failed" )
+
+        case24Result = PingResult and linksStateResult
+        utilities.assert_equals( expect=main.TRUE, actual=case24Result,
+                                 onpass="Packet optical rerouting successful",
+                                 onfail="Packet optical rerouting failed" )
+
+    def CASE4( self, main ):
+        import re
+        import time
+        main.log.report( "This testcase is testing the assignment of" +
+                         " all the switches to all the controllers and" +
+                         " discovering the hosts in reactive mode" )
+        main.log.report( "__________________________________" )
+        main.case( "Pingall Test" )
+        main.step( "Assigning switches to controllers" )
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
+        for i in range( 1, 29 ):
+            if i == 1:
+                main.Mininet1.assignSwController(
+                    sw=str( i ),
+                    ip1=ONOS1Ip,
+                    port1=ONOS1Port )
+            elif i >= 2 and i < 5:
+                main.Mininet1.assignSwController(
+                    sw=str( i ),
+                    ip1=ONOS1Ip,
+                    port1=ONOS1Port )
+            elif i >= 5 and i < 8:
+                main.Mininet1.assignSwController(
+                    sw=str( i ),
+                    ip1=ONOS1Ip,
+                    port1=ONOS1Port )
+            elif i >= 8 and i < 18:
+                main.Mininet1.assignSwController(
+                    sw=str( i ),
+                    ip1=ONOS1Ip,
+                    port1=ONOS1Port )
+            elif i >= 18 and i < 28:
+                main.Mininet1.assignSwController(
+                    sw=str( i ),
+                    ip1=ONOS1Ip,
+                    port1=ONOS1Port )
+            else:
+                main.Mininet1.assignSwController(
+                    sw=str( i ),
+                    ip1=ONOS1Ip,
+                    port1=ONOS1Port )
+        SwitchMastership = main.TRUE
+        for i in range( 1, 29 ):
+            if i == 1:
+                response = main.Mininet1.getSwController( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1Ip, response ):
+                    SwitchMastership = SwitchMastership and main.TRUE
+                else:
+                    SwitchMastership = main.FALSE
+            elif i >= 2 and i < 5:
+                response = main.Mininet1.getSwController( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1Ip, response ):
+                    SwitchMastership = SwitchMastership and main.TRUE
+                else:
+                    SwitchMastership = main.FALSE
+            elif i >= 5 and i < 8:
+                response = main.Mininet1.getSwController( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1Ip, response ):
+                    SwitchMastership = SwitchMastership and main.TRUE
+                else:
+                    SwitchMastership = main.FALSE
+            elif i >= 8 and i < 18:
+                response = main.Mininet1.getSwController( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1Ip, response ):
+                    SwitchMastership = SwitchMastership and main.TRUE
+                else:
+                    SwitchMastership = main.FALSE
+            elif i >= 18 and i < 28:
+                response = main.Mininet1.getSwController( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1Ip, response ):
+                    SwitchMastership = SwitchMastership and main.TRUE
+                else:
+                    SwitchMastership = main.FALSE
+            else:
+                response = main.Mininet1.getSwController( "s" + str( i ) )
+                print( "Response is" + str( response ) )
+                if re.search( "tcp:" + ONOS1Ip, response ):
+                    SwitchMastership = SwitchMastership and main.TRUE
+                else:
+                    SwitchMastership = main.FALSE
+
+        if SwitchMastership == main.TRUE:
+            main.log.report( "Controller assignmnet successful" )
+        else:
+            main.log.report( "Controller assignmnet failed" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=SwitchMastership,
+            onpass="MasterControllers assigned correctly" )
+        """
+        for i in range ( 1,29 ):
+            main.Mininet1.assignSwController( sw=str( i ),count=5,
+                    ip1=ONOS1Ip,port1=ONOS1Port,
+                    ip2=ONOS2Ip,port2=ONOS2Port,
+                    ip3=ONOS3Ip,port3=ONOS3Port,
+                    ip4=ONOS4Ip,port4=ONOS4Port,
+                    ip5=ONOS5Ip,port5=ONOS5Port )
+        """
+        # REACTIVE FWD test
+
+        main.step( "Get list of hosts from Mininet" )
+        hostList = main.Mininet1.getHosts()
+        main.log.info( hostList )
+
+        main.step( "Get host list in ONOS format" )
+        hostOnosList = main.ONOS2.getHostsId( hostList )
+        main.log.info( hostOnosList )
+        # time.sleep( 5 )
+
+        main.step( "Pingall" )
+        pingResult = main.FALSE
+        time1 = time.time()
+        pingResult = main.Mininet1.pingall()
+        time2 = time.time()
+        print "Time for pingall: %2f seconds" % ( time2 - time1 )
+
+        # Start onos cli again because u might have dropped out of
+        # onos prompt to the shell prompt
+        # if there was no activity
+        main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+
+        case4Result = SwitchMastership and pingResult
+        if pingResult == main.TRUE:
+            main.log.report( "Pingall Test in reactive mode to" +
+                             " discover the hosts successful" )
+        else:
+            main.log.report( "Pingall Test in reactive mode to" +
+                             " discover the hosts failed" )
+
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case4Result,
+            onpass="Controller assignment and Pingall Test successful",
+            onfail="Controller assignment and Pingall Test NOT successful" )
+
+    def CASE10( self ):
+        main.log.report(
+            "This testcase uninstalls the reactive forwarding app" )
+        main.log.report( "__________________________________" )
+        main.case( "Uninstalling reactive forwarding app" )
+        # Unistall onos-app-fwd app to disable reactive forwarding
+        appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
+        main.log.info( "onos-app-fwd uninstalled" )
+
+        # After reactive forwarding is disabled, the reactive flows on
+        # switches timeout in 10-15s
+        # So sleep for 15s
+        time.sleep( 15 )
+
+        flows = main.ONOS2.flows()
+        main.log.info( flows )
+
+        case10Result = appUninstallResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case10Result,
+            onpass="Reactive forwarding app uninstallation successful",
+            onfail="Reactive forwarding app uninstallation failed" )
+
+
+    def CASE11( self ):
+        # NOTE: This testcase require reactive forwarding mode enabled
+        # NOTE: in the beginning and then uninstall it before adding 
+        # NOTE: point intents. Again the app is installed so that 
+        # NOTE: testcase 10 can be ran successively
+        import time
+        main.log.report(
+            "This testcase moves a host from one switch to another to add" +
+            "point intents between them and then perform ping" )
+        main.log.report( "__________________________________" )
+        main.log.info( "Moving host from one switch to another" )
+        main.case( "Moving host from a device and attach it to another device" )
+        main.step( "Moving host h9 from device s9 and attach it to s8" )
+        main.Mininet1.moveHost(host = 'h9', oldSw = 's9', newSw = 's8')
+
+        time.sleep(15) #Time delay to have all the flows ready
+        main.step( "Pingall" )
+        pingResult = main.FALSE
+        time1 = time.time()
+        pingResult = main.Mininet1.pingall()
+        time2 = time.time()
+        print "Time for pingall: %2f seconds" % ( time2 - time1 )
+
+        hosts = main.ONOS2.hosts( jsonFormat = False )
+        main.log.info( hosts )
+        
+        main.case( "Uninstalling reactive forwarding app" )
+        # Unistall onos-app-fwd app to disable reactive forwarding
+        appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
+        main.log.info( "onos-app-fwd uninstalled" )
+
+        main.step( "Add point intents between hosts on the same device")
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003008/1",
+            "of:0000000000003008/3" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003008/3",
+            "of:0000000000003008/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        main.case( "Ping hosts on the same devices" )
+        ping = main.Mininet1.pingHost( src = 'h8', target = 'h9' )
+
+        '''
+        main.case( "Installing reactive forwarding app" )
+        # Install onos-app-fwd app to enable reactive forwarding
+        appUninstallResult = main.ONOS2.featureInstall( "onos-app-fwd" )
+        main.log.info( "onos-app-fwd installed" )
+        '''
+
+        if ping == main.FALSE:
+            main.log.report(
+                "Point intents for hosts on same devices haven't" +
+                " been installed correctly. Cleaning up" )
+        if ping == main.TRUE:
+            main.log.report(
+                "Point intents for hosts on same devices" +
+                "installed correctly. Cleaning up" )
+
+        case11Result = ping and pingResult
+        utilities.assert_equals(
+            expect = main.TRUE,
+            actual = case11Result,
+            onpass = "Point intents for hosts on same devices" +
+                    "Ping Test successful",
+            onfail = "Point intents for hosts on same devices" +
+                    "Ping Test NOT successful" )
+
+
+    def CASE12( self ):
+        """
+        Verify the default flows on each switch in proactive mode
+        """
+        main.log.report( "This testcase is verifying num of default" +
+                         " flows on each switch" )
+        main.log.report( "__________________________________" )
+        main.case( "Verify num of default flows on each switch" )
+        main.step( "Obtaining the device id's and flowrule count on them" )
+
+        case12Result = main.TRUE
+        idList = main.ONOS2.getAllDevicesId()
+        for id in idList:
+            count = main.ONOS2.FlowAddedCount( id )
+            main.log.info("count = " +count)
+            if int(count) != 3:
+                case12Result = main.FALSE
+                break
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case12Result,
+            onpass = "Expected default num of flows exist",
+            onfail = "Expected default num of flows do not exist")
+    
+    
+        
+
+    def CASE6( self ):
+        import time
+        main.log.report( "This testcase is testing the addition of" +
+                         " host intents and then does pingall" )
+        main.log.report( "__________________________________" )
+        main.case( "Obtaining host id's" )
+        main.step( "Get hosts" )
+        hosts = main.ONOS2.hosts()
+        main.log.info( hosts )
+
+        main.step( "Get all devices id" )
+        devicesIdList = main.ONOS2.getAllDevicesId()
+        main.log.info( devicesIdList )
+
+        # ONOS displays the hosts in hex format unlike mininet which does
+        # in decimal format
+        # So take care while adding intents
+        """
+        main.step( "Add host-to-host intents for mininet hosts h8 and h18 or
+                    ONOS hosts h8 and h12" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:08/-1", "00:00:00:00:00:12/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:09/-1", "00:00:00:00:00:13/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:0A/-1", "00:00:00:00:00:14/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:0B/-1", "00:00:00:00:00:15/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:0C/-1", "00:00:00:00:00:16/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:0D/-1", "00:00:00:00:00:17/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:0E/-1", "00:00:00:00:00:18/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:0F/-1", "00:00:00:00:00:19/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:10/-1", "00:00:00:00:00:1A/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1" )
+        print "______________________________________________________"
+        """
+        for i in range( 8, 18 ):
+            main.log.info(
+                "Adding host intent between h" + str( i ) +
+                " and h" + str( i + 10 ) )
+            host1 = "00:00:00:00:00:" + \
+                str( hex( i )[ 2: ] ).zfill( 2 ).upper()
+            host2 = "00:00:00:00:00:" + \
+                str( hex( i + 10 )[ 2: ] ).zfill( 2 ).upper()
+            # NOTE: get host can return None
+            # TODO: handle this
+            host1Id = main.ONOS2.getHost( host1 )[ 'id' ]
+      
+            host2Id = main.ONOS2.getHost( host2 )[ 'id' ]
+            main.ONOS2.addHostIntent( host1Id, host2Id )
+
+        time.sleep( 10 )
+        hIntents = main.ONOS2.intents( jsonFormat=False )
+        main.log.info( "intents:" + hIntents )
+        flows = main.ONOS2.flows()
+        main.log.info( "flows:" + flows )     
+
+        count = 1
+        i = 8
+        PingResult = main.TRUE
+        # while i<10:
+        while i < 18:
+            main.log.info(
+                "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
+            ping = main.Mininet1.pingHost(
+                src="h" + str( i ), target="h" + str( i + 10 ) )
+            if ping == main.FALSE and count < 5:
+                count += 1
+                # i = 8
+                PingResult = main.FALSE
+                main.log.report( "Ping between h" +
+                                 str( i ) +
+                                 " and h" +
+                                 str( i +
+                                      10 ) +
+                                 " failed. Making attempt number " +
+                                 str( count ) +
+                                 " in 2 seconds" )
+                time.sleep( 2 )
+            elif ping == main.FALSE:
+                main.log.report( "All ping attempts between h" +
+                                 str( i ) +
+                                 " and h" +
+                                 str( i +
+                                      10 ) +
+                                 "have failed" )
+                i = 19
+                PingResult = main.FALSE
+            elif ping == main.TRUE:
+                main.log.info( "Ping test between h" +
+                               str( i ) +
+                               " and h" +
+                               str( i +
+                                    10 ) +
+                               "passed!" )
+                i += 1
+                PingResult = main.TRUE
+            else:
+                main.log.info( "Unknown error" )
+                PingResult = main.ERROR
+        if PingResult == main.FALSE:
+            main.log.report(
+                "Ping all test after Host intent addition failed.Cleaning up" )
+            # main.cleanup()
+            # main.exit()
+        if PingResult == main.TRUE:
+            main.log.report(
+                "Ping all test after Host intent addition successful" )
+
+        case6Result = PingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case6Result,
+            onpass="Pingall Test after Host intents addition successful",
+            onfail="Pingall Test after Host intents addition failed" )
+
+    def CASE5( self, main ):
+        import json
+        # assumes that sts is already in you PYTHONPATH
+        from sts.topology.teston_topology import TestONTopology
+        # main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+        main.log.report( "This testcase is testing if all ONOS nodes" +
+                         " are in topology sync with mininet" )
+        main.log.report( "__________________________________" )
+        main.case( "Comparing Mininet topology with the topology of ONOS" )
+        main.step( "Start continuous pings" )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source1' ],
+            target=main.params[ 'PING' ][ 'target1' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source2' ],
+            target=main.params[ 'PING' ][ 'target2' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source3' ],
+            target=main.params[ 'PING' ][ 'target3' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source4' ],
+            target=main.params[ 'PING' ][ 'target4' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source5' ],
+            target=main.params[ 'PING' ][ 'target5' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source6' ],
+            target=main.params[ 'PING' ][ 'target6' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source7' ],
+            target=main.params[ 'PING' ][ 'target7' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source8' ],
+            target=main.params[ 'PING' ][ 'target8' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source9' ],
+            target=main.params[ 'PING' ][ 'target9' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source10' ],
+            target=main.params[ 'PING' ][ 'target10' ],
+            pingTime=500 )
+
+        main.step( "Create TestONTopology object" )
+        global ctrls
+        ctrls = []
+        count = 1
+        while True:
+            temp = ()
+            if ( 'ip' + str( count ) ) in main.params[ 'CTRL' ]:
+                temp = temp + ( getattr( main, ( 'ONOS' + str( count ) ) ), )
+                temp = temp + ( "ONOS" + str( count ), )
+                temp = temp + ( main.params[ 'CTRL' ][ 'ip' + str( count ) ], )
+                temp = temp + \
+                    ( eval( main.params[ 'CTRL' ][ 'port' + str( count ) ] ), )
+                ctrls.append( temp )
+                count = count + 1
+            else:
+                break
+        global MNTopo
+        Topo = TestONTopology(
+            main.Mininet1,
+            ctrls )  # can also add Intent API info for intent operations
+        MNTopo = Topo
+
+        TopologyCheck = main.TRUE
+        main.step( "Compare ONOS Topology to MN Topology" )
+        devicesJson = main.ONOS2.devices()
+        linksJson = main.ONOS2.links()
+        # portsJson = main.ONOS2.ports()
+
+        result1 = main.Mininet1.compareSwitches(
+            MNTopo,
+            json.loads( devicesJson ) )
+        result2 = main.Mininet1.compareLinks(
+            MNTopo,
+            json.loads( linksJson ) )
+        # result3 = main.Mininet1.comparePorts(
+        # MNTopo, json.loads( portsJson ) )
+
+        # result = result1 and result2 and result3
+        result = result1 and result2
+
+        print "***********************"
+pr        if result == main.TRUE:
+            main.log.report( "ONOS" + " Topology matches MN Topology" )
+        else:
+            main.log.report( "ONOS" + " Topology does not match MN Topology" )
+
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=result,
+            onpass="ONOS" +
+            " Topology matches MN Topology",
+            onfail="ONOS" +
+            " Topology does not match MN Topology" )
+
+        TopologyCheck = TopologyCheck and result
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=TopologyCheck,
+            onpass="Topology checks passed",
+            onfail="Topology checks failed" )
+
+    def CASE7( self, main ):
+        from sts.topology.teston_topology import TestONTopology
+
+        linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
+
+        main.log.report( "This testscase is killing a link to ensure that" +
+                         " link discovery is consistent" )
+        main.log.report( "__________________________________" )
+        main.log.report( "Killing a link to ensure that link discovery" +
+                         " is consistent" )
+        main.case( "Killing a link to Ensure that Link Discovery" +
+                   "is Working Properly" )
+        """
+        main.step( "Start continuous pings" )
+
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source1' ],
+                               target=main.params[ 'PING' ][ 'target1' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source2' ],
+                               target=main.params[ 'PING' ][ 'target2' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source3' ],
+                               target=main.params[ 'PING' ][ 'target3' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source4' ],
+                               target=main.params[ 'PING' ][ 'target4' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source5' ],
+                               target=main.params[ 'PING' ][ 'target5' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source6' ],
+                               target=main.params[ 'PING' ][ 'target6' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source7' ],
+                               target=main.params[ 'PING' ][ 'target7' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source8' ],
+                               target=main.params[ 'PING' ][ 'target8' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source9' ],
+                               target=main.params[ 'PING' ][ 'target9' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source10' ],
+                               target=main.params[ 'PING' ][ 'target10' ],
+                               pingTime=500 )
+        """
+        main.step( "Determine the current number of switches and links" )
+        topologyOutput = main.ONOS2.topology()
+        topologyResult = main.ONOS1.getTopology( topologyOutput )
+        activeSwitches = topologyResult[ 'deviceCount' ]
+        links = topologyResult[ 'linkCount' ]
+        print "activeSwitches = ", type( activeSwitches )
+        print "links = ", type( links )
+        main.log.info(
+            "Currently there are %s switches and %s links" %
+            ( str( activeSwitches ), str( links ) ) )
+
+        main.step( "Kill Link between s3 and s28" )
+        main.Mininet1.link( END1="s3", END2="s28", OPTION="down" )
+        time.sleep( linkSleep )
+        topologyOutput = main.ONOS2.topology()
+        LinkDown = main.ONOS1.checkStatus(
+            topologyOutput, activeSwitches, str(
+                int( links ) - 2 ) )
+        if LinkDown == main.TRUE:
+            main.log.report( "Link Down discovered properly" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=LinkDown,
+            onpass="Link Down discovered properly",
+            onfail="Link down was not discovered in " +
+            str( linkSleep ) +
+            " seconds" )
+
+        # Check ping result here..add code for it
+
+        main.step( "Bring link between s3 and s28 back up" )
+        LinkUp = main.Mininet1.link( END1="s3", END2="s28", OPTION="up" )
+        time.sleep( linkSleep )
+        topologyOutput = main.ONOS2.topology()
+        LinkUp = main.ONOS1.checkStatus(
+            topologyOutput,
+            activeSwitches,
+            str( links ) )
+        if LinkUp == main.TRUE:
+            main.log.report( "Link up discovered properly" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=LinkUp,
+            onpass="Link up discovered properly",
+            onfail="Link up was not discovered in " +
+            str( linkSleep ) +
+            " seconds" )
+
+        # NOTE Check ping result here..add code for it
+
+        main.step( "Compare ONOS Topology to MN Topology" )
+        Topo = TestONTopology(
+            main.Mininet1,
+            ctrls )  # can also add Intent API info for intent operations
+        MNTopo = Topo
+        TopologyCheck = main.TRUE
+
+        devicesJson = main.ONOS2.devices()
+        linksJson = main.ONOS2.links()
+        portsJson = main.ONOS2.ports()
+
+        result1 = main.Mininet1.compareSwitches(
+            MNTopo,
+            json.loads( devicesJson ) )
+        result2 = main.Mininet1.compareLinks(
+            MNTopo,
+            json.loads( linksJson ) )
+        # result3 = main.Mininet1.comparePorts(
+        # MNTopo, json.loads( portsJson ) )
+
+        # result = result1 and result2 and result3
+        result = result1 and result2
+        print "***********************"
+
+        if result == main.TRUE:
+            main.log.report( "ONOS" + " Topology matches MN Topology" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=result,
+            onpass="ONOS" +
+            " Topology matches MN Topology",
+            onfail="ONOS" +
+            " Topology does not match MN Topology" )
+
+        TopologyCheck = TopologyCheck and result
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=TopologyCheck,
+            onpass="Topology checks passed",
+            onfail="Topology checks failed" )
+
+        result = LinkDown and LinkUp and TopologyCheck
+        utilities.assert_equals( expect=main.TRUE, actual=result,
+                                 onpass="Link failure is discovered correctly",
+                                 onfail="Link Discovery failed" )
+
+    def CASE8( self ):
+        """
+        Intent removal
+        """
+        import time
+        main.log.report( "This testcase removes any previously added intents" +
+                         " before adding any new set of intents" )
+        main.log.report( "__________________________________" )
+        main.log.info( "intent removal" )
+        main.case( "Removing installed intents" )
+        main.step( "Obtain the intent id's" )
+        intentResult = main.ONOS2.intents( jsonFormat=False )
+        main.log.info( "intent_result = " + intentResult )
+        intentLinewise = intentResult.split( "\n" )
+
+        intentList = [line for line in intentLinewise \
+            if line.startswith( "id=")]
+        intentids = [line.split( "," )[ 0 ].split( "=" )[ 1 ] for line in \
+            intentList]
+        for id in intentids:
+            print "id = ", id
+
+        main.step(
+            "Iterate through the intentids list and remove each intent" )
+        for id in intentids:
+            main.ONOS2.removeIntent( intentId=id )
+
+        intentResult = main.ONOS2.intents( jsonFormat=False )
+        main.log.info( "intent_result = " + intentResult )
+        
+        intentList = [line for line in intentResult.split( "\n" ) \
+            if line.startswith( "id=")]
+        intentState = [line.split( "," )[ 1 ].split( "=" )[ 1 ] for line in \
+            intentList]
+        for state in intentState:
+            print state
+        
+        case8Result = main.TRUE        
+        for state in intentState:
+            if state != 'WITHDRAWN':
+                case8Result = main.FALSE
+                break
+                
+        if case8Result == main.TRUE:
+            main.log.report( "Intent removal successful" )
+        else:
+            main.log.report( "Intent removal failed" )
+
+        PingResult = main.TRUE
+        if case8Result == main.TRUE:
+            i = 8
+            while i < 18:
+                main.log.info(
+                    "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
+                ping = main.Mininet1.pingHost(
+                    src="h" + str( i ), target="h" + str( i + 10 ) )
+                if ping == main.TRUE:
+                    i = 19
+                    PingResult = PingResult and main.TRUE
+                elif ping == main.FALSE:
+                    i += 1
+                    PingResult = PingResult and main.FALSE
+                else:
+                    main.log.info( "Unknown error" )
+                    PingResult = main.ERROR
+
+            # Note: If the ping result failed, that means the intents have been
+            # withdrawn correctly.
+        if PingResult == main.TRUE:
+            main.log.report( "Installed intents have not been withdrawn correctly" )
+            # main.cleanup()
+            # main.exit()
+        if PingResult == main.FALSE:
+            main.log.report( "Installed intents have been withdrawn correctly" )
+
+        case8Result = case8Result and PingResult
+
+        if case8Result == main.FALSE:
+            main.log.report( "Intent removal successful" )
+        else:
+            main.log.report( "Intent removal failed" )
+
+        utilities.assert_equals( expect=main.FALSE, actual=case8Result,
+                                 onpass="Intent removal test passed",
+                                 onfail="Intent removal test failed" )
+
+    def CASE9( self ):
+        main.log.report(
+            "This testcase adds point intents and then does pingall" )
+        main.log.report( "__________________________________" )
+        main.log.info( "Adding point intents" )
+        main.case(
+            "Adding bidirectional point for mn hosts" +
+            "( h8-h18, h9-h19, h10-h20, h11-h21, h12-h22, " +
+            "h13-h23, h14-h24, h15-h25, h16-h26, h17-h27 )" )
+
+        main.step( "Add point intents for mn hosts h8 and h18 or" +
+                   "ONOS hosts h8 and h12" )
+        # main.step(var1)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003008/1",
+            "of:0000000000006018/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006018/1",
+            "of:0000000000003008/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var2 = "Add point intents for mn hosts h9&h19 or ONOS hosts h9&h13"
+        main.step(var2)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003009/1",
+            "of:0000000000006019/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006019/1",
+            "of:0000000000003009/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var3 = "Add point intents for MN hosts h10&h20 or ONOS hosts hA&h14"
+        main.step(var3)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003010/1",
+            "of:0000000000006020/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006020/1",
+            "of:0000000000003010/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var4 = "Add point intents for mininet hosts h11 and h21 or" +\
+               " ONOS hosts hB and h15"
+        main.case(var4)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003011/1",
+            "of:0000000000006021/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006021/1",
+            "of:0000000000003011/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var5 = "Add point intents for mininet hosts h12 and h22 " +\
+               "ONOS hosts hC and h16"
+        main.case(var5)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003012/1",
+            "of:0000000000006022/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006022/1",
+            "of:0000000000003012/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var6 = "Add point intents for mininet hosts h13 and h23 or" +\
+               " ONOS hosts hD and h17"
+        main.case(var6)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003013/1",
+            "of:0000000000006023/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006023/1",
+            "of:0000000000003013/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var7 = "Add point intents for mininet hosts h14 and h24 or" +\
+               " ONOS hosts hE and h18"
+        main.case(var7)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003014/1",
+            "of:0000000000006024/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006024/1",
+            "of:0000000000003014/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var8 = "Add point intents for mininet hosts h15 and h25 or" +\
+               " ONOS hosts hF and h19"
+        main.case(var8)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003015/1",
+            "of:0000000000006025/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006025/1",
+            "of:0000000000003015/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var9 = "Add intents for mininet hosts h16 and h26 or" +\
+               " ONOS hosts h10 and h1A"
+        main.case(var9)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003016/1",
+            "of:0000000000006026/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006026/1",
+            "of:0000000000003016/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var10 = "Add point intents for mininet hosts h17 and h27 or" +\
+                " ONOS hosts h11 and h1B"
+        main.case(var10)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003017/1",
+            "of:0000000000006027/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            #main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006027/1",
+            "of:0000000000003017/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            #main.log.info( getIntentResult )
+
+        print(
+            "___________________________________________________________" )
+
+        flowHandle = main.ONOS2.flows()
+        #main.log.info( "flows :" + flowHandle )
+
+        count = 1
+        i = 8
+        PingResult = main.TRUE
+        while i < 18:
+            main.log.info(
+                "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
+            ping = main.Mininet1.pingHost(
+                src="h" + str( i ), target="h" + str( i + 10 ) )
+            if ping == main.FALSE and count < 5:
+                count += 1
+                # i = 8
+                PingResult = main.FALSE
+                main.log.report( "Ping between h" +
+                                 str( i ) +
+                                 " and h" +
+                                 str( i +
+                                      10 ) +
+                                 " failed. Making attempt number " +
+                                 str( count ) +
+                                 " in 2 seconds" )
+                time.sleep( 2 )
+            elif ping == main.FALSE:
+                main.log.report( "All ping attempts between h" +
+                                 str( i ) +
+                                 " and h" +
+                                 str( i +
+                                      10 ) +
+                                 "have failed" )
+                i = 19
+                PingResult = main.FALSE
+            elif ping == main.TRUE:
+                main.log.info( "Ping test between h" +
+                               str( i ) +
+                               " and h" +
+                               str( i +
+                                    10 ) +
+                               "passed!" )
+                i += 1
+                PingResult = main.TRUE
+            else:
+                main.log.info( "Unknown error" )
+                PingResult = main.ERROR
+
+        if PingResult == main.FALSE:
+            main.log.report(
+                "Point intents have not ben installed correctly. Cleaning up" )
+            # main.cleanup()
+            # main.exit()
+        if PingResult == main.TRUE:
+            main.log.report( "Point Intents have been installed correctly" )
+
+        case9Result = PingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case9Result,
+            onpass="Point intents addition and Pingall Test successful",
+            onfail="Point intents addition and Pingall Test NOT successful" )
diff --git a/TestON/tests/ProdFunc/ProdFunc.topo b/TestON/tests/ProdFunc/ProdFunc.topo
index 3f3323e..292a8a4 100755
--- a/TestON/tests/ProdFunc/ProdFunc.topo
+++ b/TestON/tests/ProdFunc/ProdFunc.topo
@@ -64,6 +64,7 @@
                 <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
                 <arg2> --topo mytopo </arg2>
                 <arg3> --switch ovs,protocols=OpenFlow10 </arg3>
+                <arg4> --mac </arg4>
                 <controller> remote </controller>
             </COMPONENTS>
         </Mininet2>
diff --git a/TestON/tests/ProdFunc/ProdFunc2.py b/TestON/tests/ProdFunc/ProdFunc2.py
new file mode 100644
index 0000000..2cd04c1
--- /dev/null
+++ b/TestON/tests/ProdFunc/ProdFunc2.py
@@ -0,0 +1,1542 @@
+
+# Testing the basic functionality of ONOS Next
+# For sanity and driver functionality excercises only.
+
+import time
+# import sys
+# import os
+# import re
+import json
+
+time.sleep( 1 )
+
+
+class ProdFunc:
+
+    def __init__( self ):
+        self.default = ''
+
+    def CASE1( self, main ):
+        import time
+        """
+        Startup sequence:
+        cell <name>
+        onos-verify-cell
+        onos-remove-raft-log
+        git pull
+        mvn clean install
+        onos-package
+        onos-install -f
+        onos-wait-for-start
+        """
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+        main.case( "Setting up test environment" )
+        main.log.report(
+            "This testcase is testing setting up test environment" )
+        main.log.report( "__________________________________" )
+
+        main.step( "Applying cell variable to environment" )
+        cellResult = main.ONOSbench.setCell( cellName )
+        verifyResult = main.ONOSbench.verifyCell()
+
+        main.step( "Removing raft logs before a clen installation of ONOS" )
+        main.ONOSbench.onosRemoveRaftLogs()
+
+        main.step( "Git checkout and get version" )
+        #main.ONOSbench.gitCheckout( "master" )
+        gitPullResult = main.ONOSbench.gitPull()
+        main.log.info( "git_pull_result = " + str( gitPullResult ))
+        main.ONOSbench.getVersion( report=True )
+
+        if gitPullResult == 1:
+            main.step( "Using mvn clean & install" )
+            main.ONOSbench.cleanInstall()
+        elif gitPullResult == 0:
+            main.log.report(
+                "Git Pull Failed, look into logs for detailed reason" )
+            main.cleanup()
+            main.exit()
+
+        main.step( "Creating ONOS package" )
+        packageResult = main.ONOSbench.onosPackage()
+
+        main.step( "Installing ONOS package" )
+        onosInstallResult = main.ONOSbench.onosInstall()
+        if onosInstallResult == main.TRUE:
+            main.log.report( "Installing ONOS package successful" )
+        else:
+            main.log.report( "Installing ONOS package failed" )
+
+        onos1Isup = main.ONOSbench.isup()
+        if onos1Isup == main.TRUE:
+            main.log.report( "ONOS instance is up and ready" )
+        else:
+            main.log.report( "ONOS instance may not be up" )
+
+        main.step( "Starting ONOS service" )
+        startResult = main.ONOSbench.onosStart( ONOS1Ip )
+
+        main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+        main.step( "Starting Mininet CLI..." )
+        
+        # Starting the mininet using the old way
+        main.step( "Starting Mininet ..." )
+        netIsUp = main.Mininet1.startNet()
+        if netIsUp:
+            main.log.info("Mininet CLI is up")
+        
+        case1Result = ( packageResult and
+                        cellResult and verifyResult
+                        and onosInstallResult and
+                        onos1Isup and startResult )
+        utilities.assert_equals( expect=main.TRUE, actual=case1Result,
+                                 onpass="Test startup successful",
+                                 onfail="Test startup NOT successful" )
+
+    def CASE2( self, main ):
+        """
+        Switch Down
+        """
+        # NOTE: You should probably run a topology check after this
+        import time
+
+        main.case( "Switch down discovery" )
+        main.log.report( "This testcase is testing a switch down discovery" )
+        main.log.report( "__________________________________" )
+
+        switchSleep = int( main.params[ 'timers' ][ 'SwitchDiscovery' ] )
+
+        description = "Killing a switch to ensure it is discovered correctly"
+        main.log.report( description )
+        main.case( description )
+
+        # TODO: Make this switch parameterizable
+        main.step( "Kill s28 " )
+        main.log.report( "Deleting s28" )
+        # FIXME: use new dynamic topo functions
+        main.Mininet1.delSwitch( "s28" )
+        main.log.info(
+            "Waiting " +
+            str( switchSleep ) +
+            " seconds for switch down to be discovered" )
+        time.sleep( switchSleep )
+        # Peek at the deleted switch
+        device = main.ONOS2.getDevice( dpid="0028" )
+        print "device = ", device
+        if device[ u'available' ] == 'False':
+            case2Result = main.FALSE
+        else:
+            case2Result = main.TRUE
+        utilities.assert_equals( expect=main.TRUE, actual=case2Result,
+                                 onpass="Switch down discovery successful",
+                                 onfail="Switch down discovery failed" )
+
+    def CASE101( self, main ):
+        """
+        Cleanup sequence:
+        onos-service <nodeIp> stop
+        onos-uninstall
+
+        TODO: Define rest of cleanup
+
+        """
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+        main.case( "Cleaning up test environment" )
+
+        main.step( "Testing ONOS kill function" )
+        killResult = main.ONOSbench.onosKill( ONOS1Ip )
+
+        main.step( "Stopping ONOS service" )
+        stopResult = main.ONOSbench.onosStop( ONOS1Ip )
+
+        main.step( "Uninstalling ONOS service" )
+        uninstallResult = main.ONOSbench.onosUninstall()
+
+        case11Result = killResult and stopResult and uninstallResult
+        utilities.assert_equals( expect=main.TRUE, actual=case11Result,
+                                 onpass="Cleanup successful",
+                                 onfail="Cleanup failed" )
+
+    def CASE3( self, main ):
+        """
+        Test 'onos' command and its functionality in driver
+        """
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+        main.case( "Testing 'onos' command" )
+
+        main.step( "Sending command 'onos -w <onos-ip> system:name'" )
+        cmdstr1 = "system:name"
+        cmdResult1 = main.ONOSbench.onosCli( ONOS1Ip, cmdstr1 )
+        main.log.info( "onos command returned: " + cmdResult1 )
+
+        main.step( "Sending command 'onos -w <onos-ip> onos:topology'" )
+        cmdstr2 = "onos:topology"
+        cmdResult2 = main.ONOSbench.onosCli( ONOS1Ip, cmdstr2 )
+        main.log.info( "onos command returned: " + cmdResult2 )
+
+    def CASE20( self ):
+        """
+            Exit from mininet cli
+            reinstall ONOS
+        """
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+        main.log.report( "This testcase exits the mininet cli and reinstalls" +
+                         "ONOS to switch over to Packet Optical topology" )
+        main.log.report( "_____________________________________________" )
+        main.case( "Disconnecting mininet and restarting ONOS" )
+        main.step( "Disconnecting mininet and restarting ONOS" )
+        mininetDisconnect = main.Mininet1.disconnect()
+        print "mininetDisconnect = ", mininetDisconnect        
+
+        main.step( "Removing raft logs before a clen installation of ONOS" )
+        main.ONOSbench.onosRemoveRaftLogs()
+
+        main.step( "Applying cell variable to environment" )
+        cellResult = main.ONOSbench.setCell( cellName )
+        verifyResult = main.ONOSbench.verifyCell()
+
+        onosInstallResult = main.ONOSbench.onosInstall()
+        if onosInstallResult == main.TRUE:
+            main.log.report( "Installing ONOS package successful" )
+        else:
+            main.log.report( "Installing ONOS package failed" )
+
+        onos1Isup = main.ONOSbench.isup()
+        if onos1Isup == main.TRUE:
+            main.log.report( "ONOS instance is up and ready" )
+        else:
+            main.log.report( "ONOS instance may not be up" )
+
+        main.step( "Starting ONOS service" )
+        startResult = main.ONOSbench.onosStart( ONOS1Ip )
+
+        main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+        case20Result = mininetDisconnect and cellResult and verifyResult \
+            and onosInstallResult and onos1Isup and \
+            startResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case20Result,
+            onpass= "Exiting functionality mininet topology and reinstalling" +
+                    " ONOS successful",
+            onfail= "Exiting functionality mininet topology and reinstalling" +
+                    " ONOS failed" )
+
+    def CASE21( self, main ):
+        """
+            On ONOS bench, run this command:
+            sudo -E python ~/onos/tools/test/topos/opticalTest.py -OC1
+            which spawns packet optical topology and copies the links
+            json file to the onos instance.
+            Note that in case of Packet Optical, the links are not learnt
+            from the topology, instead the links are learnt
+            from the json config file
+        """
+        main.log.report(
+            "This testcase starts the packet layer topology and REST" )
+        main.log.report( "_____________________________________________" )
+        main.case( "Starting LINC-OE and other components" )
+        main.step( "Starting LINC-OE and other components" )
+        appInstallResult = main.ONOS2.featureInstall( "onos-app-optical" )
+        opticalMnScript = main.LincOE2.runOpticalMnScript()
+
+        case21Result = opticalMnScript and appInstallResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case21Result,
+            onpass="Packet optical topology spawned successsfully",
+            onfail="Packet optical topology spawning failed" )
+
+    def CASE22( self, main ):
+        """
+            Curretly we use, 10 optical switches(ROADM's) and
+            6 packet layer mininet switches each with one host.
+            Therefore, the roadmCount variable = 10,
+            packetLayerSWCount variable = 6, hostCount=6 and
+            links=42.
+            All this is hardcoded in the testcase. If the topology changes,
+            these hardcoded values need to be changed
+        """
+        main.log.report(
+            "This testcase compares the optical+packet topology against what" +
+            " is expected" )
+        main.case( "Topology comparision" )
+        main.step( "Topology comparision" )
+        main.ONOS3.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+        devicesResult = main.ONOS3.devices( jsonFormat=False )
+
+        print "devices_result = ", devicesResult
+        devicesLinewise = devicesResult.split( "\n" )
+        devicesLinewise = devicesLinewise[ 1: ]
+        roadmCount = 0
+        packetLayerSWCount = 0
+        for line in devicesLinewise:
+            components = line.split( "," )
+            availability = components[ 1 ].split( "=" )[ 1 ]
+            type = components[ 3 ].split( "=" )[ 1 ]
+            if availability == 'true' and type == 'ROADM':
+                roadmCount += 1
+            elif availability == 'true' and type == 'SWITCH':
+                packetLayerSWCount += 1
+        if roadmCount == 10:
+            print "Number of Optical Switches = %d and is" % roadmCount +\
+                  " correctly detected"
+            main.log.info(
+                "Number of Optical Switches = " +
+                str( roadmCount ) +
+                " and is correctly detected" )
+            opticalSWResult = main.TRUE
+        else:
+            print "Number of Optical Switches = %d and is wrong" % roadmCount
+            main.log.info(
+                "Number of Optical Switches = " +
+                str( roadmCount ) +
+                " and is wrong" )
+            opticalSWResult = main.FALSE
+
+        if packetLayerSWCount == 6:
+            print "Number of Packet layer or mininet Switches = %d "\
+                    % packetLayerSWCount + "and is correctly detected"
+            main.log.info(
+                "Number of Packet layer or mininet Switches = " +
+                str( packetLayerSWCount ) +
+                " and is correctly detected" )
+            packetSWResult = main.TRUE
+        else:
+            print "Number of Packet layer or mininet Switches = %d and"\
+                    % packetLayerSWCount + " is wrong"
+            main.log.info(
+                "Number of Packet layer or mininet Switches = " +
+                str( packetLayerSWCount ) +
+                " and is wrong" )
+            packetSWResult = main.FALSE
+        print "_________________________________"
+
+        linksResult = main.ONOS3.links( jsonFormat=False )
+        print "links_result = ", linksResult
+        print "_________________________________"
+        linkActiveCount = linksResult.count("state=ACTIVE") 
+        main.log.info( "linkActiveCount = " + str( linkActiveCount ))
+        if linkActiveCount == 42:
+            linkActiveResult = main.TRUE
+            main.log.info(
+                "Number of links in ACTIVE state are correct")
+        else:
+            linkActiveResult = main.FALSE
+            main.log.info(
+                "Number of links in ACTIVE state are wrong")
+
+        # NOTE:Since only point intents are added, there is no
+        # requirement to discover the hosts
+        # Therfore, the below portion of the code is commented.
+        """
+        #Discover hosts using pingall
+        pingallResult = main.LincOE2.pingall()
+
+        hostsResult = main.ONOS3.hosts( jsonFormat=False )
+        main.log.info( "hosts_result = "+hostsResult )
+        main.log.info( "_________________________________" )
+        hostsLinewise = hostsResult.split( "\n" )
+        hostsLinewise = hostsLinewise[ 1:-1 ]
+        hostCount = 0
+        for line in hostsLinewise:
+            hostid = line.split( "," )[ 0 ].split( "=" )[ 1 ]
+            hostCount +=1
+        if hostCount ==2:
+            print "Number of hosts = %d and is correctly detected" %hostCount
+            main.log.info( "Number of hosts = " + str( hostCount ) +" and \
+                            is correctly detected" )
+            hostDiscovery = main.TRUE
+        else:
+            print "Number of hosts = %d and is wrong" %hostCount
+            main.log.info( "Number of hosts = " + str( hostCount ) +" and \
+                            is wrong" )
+            hostDiscovery = main.FALSE
+        """
+        case22Result = opticalSWResult and packetSWResult and \
+                        linkActiveResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case22Result,
+            onpass="Packet optical topology discovery successful",
+            onfail="Packet optical topology discovery failed" )
+
+    def CASE23( self, main ):
+        import time
+        """
+            Add bidirectional point intents between 2 packet layer( mininet )
+            devices and
+            ping mininet hosts
+        """
+        main.log.report(
+            "This testcase adds bidirectional point intents between 2 " +
+            "packet layer( mininet ) devices and ping mininet hosts" )
+        main.case( "Topology comparision" )
+        main.step( "Adding point intents" )
+        ptpIntentResult = main.ONOS3.addPointIntent(
+            "of:0000ffffffff0001/1",
+            "of:0000ffffffff0005/1" )
+        if ptpIntentResult == main.TRUE:
+            main.ONOS3.intents( jsonFormat=False )
+            main.log.info( "Point to point intent install successful" )
+
+        ptpIntentResult = main.ONOS3.addPointIntent(
+            "of:0000ffffffff0005/1",
+            "of:0000ffffffff0001/1" )
+        if ptpIntentResult == main.TRUE:
+            main.ONOS3.intents( jsonFormat=False )
+            main.log.info( "Point to point intent install successful" )
+
+        time.sleep( 30 )
+        flowHandle = main.ONOS3.flows()
+        main.log.info( "flows :" + flowHandle )
+
+        # Sleep for 30 seconds to provide time for the intent state to change
+        time.sleep( 60 )
+        intentHandle = main.ONOS3.intents( jsonFormat=False )
+        main.log.info( "intents :" + intentHandle )
+
+        PingResult = main.TRUE
+        count = 1
+        main.log.info( "\n\nh1 is Pinging h5" )
+        ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+        # ping = main.LincOE2.pinghost()
+        if ping == main.FALSE and count < 5:
+            count += 1
+            PingResult = main.FALSE
+            main.log.info(
+                "Ping between h1 and h5  failed. Making attempt number " +
+                str( count ) +
+                " in 2 seconds" )
+            time.sleep( 2 )
+        elif ping == main.FALSE:
+            main.log.info( "All ping attempts between h1 and h5 have failed" )
+            PingResult = main.FALSE
+        elif ping == main.TRUE:
+            main.log.info( "Ping test between h1 and h5 passed!" )
+            PingResult = main.TRUE
+        else:
+            main.log.info( "Unknown error" )
+            PingResult = main.ERROR
+
+        if PingResult == main.FALSE:
+            main.log.report(
+                "Point intents for packet optical have not ben installed" +
+                " correctly. Cleaning up" )
+        if PingResult == main.TRUE:
+            main.log.report(
+                "Point Intents for packet optical have been " +
+                "installed correctly" )
+
+        case23Result = PingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case23Result,
+            onpass= "Point intents addition for packet optical and" +
+                    "Pingall Test successful",
+            onfail= "Point intents addition for packet optical and" +
+                    "Pingall Test NOT successful" )
+
+    def CASE24( self, main ):
+        import time
+        import json
+        """
+            LINC uses its own switch IDs. You can use the following
+            command on the LINC console to find the mapping between 
+            DPIDs and LINC IDs.
+            rp(application:get_all_key(linc)).
+            
+            Test Rerouting of Packet Optical by bringing a port down
+            ( port 20 ) of a switch( switchID=1, or LincOE switchID =9 ), 
+            so that link
+            ( between switch1 port20 - switch5 port50 ) is inactive
+            and do a ping test. If rerouting is successful,
+            ping should pass. also check the flows
+        """
+        main.log.report(
+            "This testcase tests rerouting and pings mininet hosts" )
+        main.case( "Test rerouting and pings mininet hosts" )
+        main.step( "Attach to the Linc-OE session" )
+        attachConsole = main.LincOE1.attachLincOESession() 
+        print "attachConsole = ", attachConsole
+
+        main.step( "Bring a port down and verify the link state" )
+        main.LincOE1.portDown( swId="9", ptId="20" )
+        linksNonjson = main.ONOS3.links( jsonFormat=False )
+        main.log.info( "links = " + linksNonjson )
+
+        linkInactiveCount = linksNonjson.count("state=INACTIVE")
+        main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+        if linkInactiveCount == 2:
+            main.log.info(
+                "Number of links in INACTIVE state are correct")
+        else:
+            main.log.info(
+                "Number of links in INACTIVE state are wrong")
+        
+        links = main.ONOS3.links()
+        main.log.info( "links = " + links )
+
+        linksResult = json.loads( links )
+        linksStateResult = main.FALSE
+        for item in linksResult:
+            if item[ 'src' ][ 'device' ] == "of:0000ffffffffff01" and item[
+                    'src' ][ 'port' ] == "20":
+                if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff05" and item[
+                        'dst' ][ 'port' ] == "50":
+                    linksState = item[ 'state' ]
+                    if linksState == "INACTIVE":
+                        main.log.info(
+                            "Links state is inactive as expected due to one" +
+                            " of the ports being down" )
+                        main.log.report(
+                            "Links state is inactive as expected due to one" +
+                            " of the ports being down" )
+                        linksStateResult = main.TRUE
+                        break
+                    else:
+                        main.log.info(
+                            "Links state is not inactive as expected" )
+                        main.log.report(
+                            "Links state is not inactive as expected" )
+                        linksStateResult = main.FALSE
+
+        print "links_state_result = ", linksStateResult
+        time.sleep( 10 )
+        flowHandle = main.ONOS3.flows()
+        main.log.info( "flows :" + flowHandle )
+
+        main.step( "Verify Rerouting by a ping test" )
+        PingResult = main.TRUE
+        count = 1
+        main.log.info( "\n\nh1 is Pinging h5" )
+        ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+        # ping = main.LincOE2.pinghost()
+        if ping == main.FALSE and count < 5:
+            count += 1
+            PingResult = main.FALSE
+            main.log.info(
+                "Ping between h1 and h5  failed. Making attempt number " +
+                str( count ) +
+                " in 2 seconds" )
+            time.sleep( 2 )
+        elif ping == main.FALSE:
+            main.log.info( "All ping attempts between h1 and h5 have failed" )
+            PingResult = main.FALSE
+        elif ping == main.TRUE:
+            main.log.info( "Ping test between h1 and h5 passed!" )
+            PingResult = main.TRUE
+        else:
+            main.log.info( "Unknown error" )
+            PingResult = main.ERROR
+
+        if PingResult == main.TRUE:
+            main.log.report( "Ping test successful " )
+        if PingResult == main.FALSE:
+            main.log.report( "Ping test failed" )
+
+        case24Result = PingResult and linksStateResult
+        utilities.assert_equals( expect=main.TRUE, actual=case24Result,
+                                 onpass="Packet optical rerouting successful",
+                                 onfail="Packet optical rerouting failed" )
+
+    def CASE4( self, main ):
+        import re
+        import time
+        main.log.report( "This testcase is testing the assignment of" +
+                         " all the switches to all the controllers and" +
+                         " discovering the hosts in reactive mode" )
+        main.log.report( "__________________________________" )
+        main.case( "Pingall Test" )
+        main.step( "Assigning switches to controllers" )
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
+        for i in range( 1, 29 ):
+            if i == 1:
+                main.Mininet1.assignSwController(
+                    sw=str( i ),
+                    ip1=ONOS1Ip,
+                    port1=ONOS1Port )
+            elif i >= 2 and i < 5:
+                main.Mininet1.assignSwController(
+                    sw=str( i ),
+                    ip1=ONOS1Ip,
+                    port1=ONOS1Port )
+            elif i >= 5 and i < 8:
+                main.Mininet1.assignSwController(
+                    sw=str( i ),
+                    ip1=ONOS1Ip,
+                    port1=ONOS1Port )
+            elif i >= 8 and i < 18:
+                main.Mininet1.assignSwController(
+                    sw=str( i ),
+                    ip1=ONOS1Ip,
+                    port1=ONOS1Port )
+            elif i >= 18 and i < 28:
+                main.Mininet1.assignSwController(
+                    sw=str( i ),
+                    ip1=ONOS1Ip,
+                    port1=ONOS1Port )
+            else:
+                main.Mininet1.assignSwController(
+                    sw=str( i ),
+                    ip1=ONOS1Ip,
+                    port1=ONOS1Port )
+        SwitchMastership = main.TRUE
+        for i in range( 1, 29 ):
+            if i == 1:
+                response = main.Mininet1.getSwController( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1Ip, response ):
+                    SwitchMastership = SwitchMastership and main.TRUE
+                else:
+                    SwitchMastership = main.FALSE
+            elif i >= 2 and i < 5:
+                response = main.Mininet1.getSwController( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1Ip, response ):
+                    SwitchMastership = SwitchMastership and main.TRUE
+                else:
+                    SwitchMastership = main.FALSE
+            elif i >= 5 and i < 8:
+                response = main.Mininet1.getSwController( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1Ip, response ):
+                    SwitchMastership = SwitchMastership and main.TRUE
+                else:
+                    SwitchMastership = main.FALSE
+            elif i >= 8 and i < 18:
+                response = main.Mininet1.getSwController( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1Ip, response ):
+                    SwitchMastership = SwitchMastership and main.TRUE
+                else:
+                    SwitchMastership = main.FALSE
+            elif i >= 18 and i < 28:
+                response = main.Mininet1.getSwController( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1Ip, response ):
+                    SwitchMastership = SwitchMastership and main.TRUE
+                else:
+                    SwitchMastership = main.FALSE
+            else:
+                response = main.Mininet1.getSwController( "s" + str( i ) )
+                print( "Response is" + str( response ) )
+                if re.search( "tcp:" + ONOS1Ip, response ):
+                    SwitchMastership = SwitchMastership and main.TRUE
+                else:
+                    SwitchMastership = main.FALSE
+
+        if SwitchMastership == main.TRUE:
+            main.log.report( "Controller assignmnet successful" )
+        else:
+            main.log.report( "Controller assignmnet failed" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=SwitchMastership,
+            onpass="MasterControllers assigned correctly" )
+        """
+        for i in range ( 1,29 ):
+            main.Mininet1.assignSwController( sw=str( i ),count=5,
+                    ip1=ONOS1Ip,port1=ONOS1Port,
+                    ip2=ONOS2Ip,port2=ONOS2Port,
+                    ip3=ONOS3Ip,port3=ONOS3Port,
+                    ip4=ONOS4Ip,port4=ONOS4Port,
+                    ip5=ONOS5Ip,port5=ONOS5Port )
+        """
+        # REACTIVE FWD test
+
+        main.step( "Get list of hosts from Mininet" )
+        hostList = main.Mininet1.getHosts()
+        main.log.info( hostList )
+
+        main.step( "Get host list in ONOS format" )
+        hostOnosList = main.ONOS2.getHostsId( hostList )
+        main.log.info( hostOnosList )
+        # time.sleep( 5 )
+
+        main.step( "Pingall" )
+        pingResult = main.FALSE
+        time1 = time.time()
+        pingResult = main.Mininet1.pingall()
+        time2 = time.time()
+        print "Time for pingall: %2f seconds" % ( time2 - time1 )
+
+        # Start onos cli again because u might have dropped out of
+        # onos prompt to the shell prompt
+        # if there was no activity
+        main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+
+        case4Result = SwitchMastership and pingResult
+        if pingResult == main.TRUE:
+            main.log.report( "Pingall Test in reactive mode to" +
+                             " discover the hosts successful" )
+        else:
+            main.log.report( "Pingall Test in reactive mode to" +
+                             " discover the hosts failed" )
+
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case4Result,
+            onpass="Controller assignment and Pingall Test successful",
+            onfail="Controller assignment and Pingall Test NOT successful" )
+
+    def CASE10( self ):
+        main.log.report(
+            "This testcase uninstalls the reactive forwarding app" )
+        main.log.report( "__________________________________" )
+        main.case( "Uninstalling reactive forwarding app" )
+        # Unistall onos-app-fwd app to disable reactive forwarding
+        appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
+        main.log.info( "onos-app-fwd uninstalled" )
+
+        # After reactive forwarding is disabled, the reactive flows on
+        # switches timeout in 10-15s
+        # So sleep for 15s
+        time.sleep( 15 )
+
+        flows = main.ONOS2.flows()
+        main.log.info( flows )
+
+        case10Result = appUninstallResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case10Result,
+            onpass="Reactive forwarding app uninstallation successful",
+            onfail="Reactive forwarding app uninstallation failed" )
+
+
+    def CASE11( self ):
+        # NOTE: This testcase require reactive forwarding mode enabled
+        # NOTE: in the beginning and then uninstall it before adding 
+        # NOTE: point intents. Again the app is installed so that 
+        # NOTE: testcase 10 can be ran successively
+        import time
+        main.log.report(
+            "This testcase moves a host from one switch to another to add" +
+            "point intents between them and then perform ping" )
+        main.log.report( "__________________________________" )
+        main.log.info( "Moving host from one switch to another" )
+        main.case( "Moving host from a device and attach it to another device" )
+        main.step( "Moving host h9 from device s9 and attach it to s8" )
+        main.Mininet1.moveHost(host = 'h9', oldSw = 's9', newSw = 's8')
+
+        time.sleep(15) #Time delay to have all the flows ready
+        main.step( "Pingall" )
+        pingResult = main.FALSE
+        time1 = time.time()
+        pingResult = main.Mininet1.pingall()
+        time2 = time.time()
+        print "Time for pingall: %2f seconds" % ( time2 - time1 )
+
+        hosts = main.ONOS2.hosts( jsonFormat = False )
+        main.log.info( hosts )
+        
+        main.case( "Uninstalling reactive forwarding app" )
+        # Unistall onos-app-fwd app to disable reactive forwarding
+        appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
+        main.log.info( "onos-app-fwd uninstalled" )
+
+        main.step( "Add point intents between hosts on the same device")
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003008/1",
+            "of:0000000000003008/3" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003008/3",
+            "of:0000000000003008/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        main.case( "Ping hosts on the same devices" )
+        ping = main.Mininet1.pingHost( src = 'h8', target = 'h9' )
+
+        '''
+        main.case( "Installing reactive forwarding app" )
+        # Install onos-app-fwd app to enable reactive forwarding
+        appUninstallResult = main.ONOS2.featureInstall( "onos-app-fwd" )
+        main.log.info( "onos-app-fwd installed" )
+        '''
+
+        if ping == main.FALSE:
+            main.log.report(
+                "Point intents for hosts on same devices haven't" +
+                " been installed correctly. Cleaning up" )
+        if ping == main.TRUE:
+            main.log.report(
+                "Point intents for hosts on same devices" +
+                "installed correctly. Cleaning up" )
+
+        case11Result = ping and pingResult
+        utilities.assert_equals(
+            expect = main.TRUE,
+            actual = case11Result,
+            onpass = "Point intents for hosts on same devices" +
+                    "Ping Test successful",
+            onfail = "Point intents for hosts on same devices" +
+                    "Ping Test NOT successful" )
+
+
+    def CASE12( self ):
+        """
+        Verify the default flows on each switch in proactive mode
+        """
+        main.log.report( "This testcase is verifying num of default" +
+                         " flows on each switch" )
+        main.log.report( "__________________________________" )
+        main.case( "Verify num of default flows on each switch" )
+        main.step( "Obtaining the device id's and flowrule count on them" )
+
+        case12Result = main.TRUE
+        idList = main.ONOS2.getAllDevicesId()
+        for id in idList:
+            count = main.ONOS2.FlowAddedCount( id )
+            main.log.info("count = " +count)
+            if int(count) != 3:
+                case12Result = main.FALSE
+                break
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case12Result,
+            onpass = "Expected default num of flows exist",
+            onfail = "Expected default num of flows do not exist")
+    
+    
+        
+
+    def CASE6( self ):
+        import time
+        main.log.report( "This testcase is testing the addition of" +
+                         " host intents and then does pingall" )
+        main.log.report( "__________________________________" )
+        main.case( "Obtaining host id's" )
+        main.step( "Get hosts" )
+        hosts = main.ONOS2.hosts()
+        main.log.info( hosts )
+
+        main.step( "Get all devices id" )
+        devicesIdList = main.ONOS2.getAllDevicesId()
+        main.log.info( devicesIdList )
+
+        # ONOS displays the hosts in hex format unlike mininet which does
+        # in decimal format
+        # So take care while adding intents
+        """
+        main.step( "Add host-to-host intents for mininet hosts h8 and h18 or
+                    ONOS hosts h8 and h12" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:08/-1", "00:00:00:00:00:12/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:09/-1", "00:00:00:00:00:13/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:0A/-1", "00:00:00:00:00:14/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:0B/-1", "00:00:00:00:00:15/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:0C/-1", "00:00:00:00:00:16/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:0D/-1", "00:00:00:00:00:17/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:0E/-1", "00:00:00:00:00:18/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:0F/-1", "00:00:00:00:00:19/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:10/-1", "00:00:00:00:00:1A/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1" )
+        print "______________________________________________________"
+        """
+        for i in range( 8, 18 ):
+            main.log.info(
+                "Adding host intent between h" + str( i ) +
+                " and h" + str( i + 10 ) )
+            host1 = "00:00:00:00:00:" + \
+                str( hex( i )[ 2: ] ).zfill( 2 ).upper()
+            host2 = "00:00:00:00:00:" + \
+                str( hex( i + 10 )[ 2: ] ).zfill( 2 ).upper()
+            # NOTE: get host can return None
+            if host1:
+                host1Id = main.ONOS2.getHost( host1 )[ 'id' ]
+            if host2:
+                host2Id = main.ONOS2.getHost( host2 )[ 'id' ]
+            if host1Id and host2Id:
+                main.ONOS2.addHostIntent( host1Id, host2Id )
+
+        time.sleep( 10 )
+        hIntents = main.ONOS2.intents( jsonFormat=False )
+        main.log.info( "intents:" + hIntents )
+        flows = main.ONOS2.flows()
+        main.log.info( "flows:" + flows )     
+
+        count = 1
+        i = 8
+        PingResult = main.TRUE
+        # while i<10:
+        while i < 18:
+            main.log.info(
+                "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
+            ping = main.Mininet1.pingHost(
+                src="h" + str( i ), target="h" + str( i + 10 ) )
+            if ping == main.FALSE and count < 5:
+                count += 1
+                # i = 8
+                PingResult = main.FALSE
+                main.log.report( "Ping between h" +
+                                 str( i ) +
+                                 " and h" +
+                                 str( i +
+                                      10 ) +
+                                 " failed. Making attempt number " +
+                                 str( count ) +
+                                 " in 2 seconds" )
+                time.sleep( 2 )
+            elif ping == main.FALSE:
+                main.log.report( "All ping attempts between h" +
+                                 str( i ) +
+                                 " and h" +
+                                 str( i +
+                                      10 ) +
+                                 "have failed" )
+                i = 19
+                PingResult = main.FALSE
+            elif ping == main.TRUE:
+                main.log.info( "Ping test between h" +
+                               str( i ) +
+                               " and h" +
+                               str( i +
+                                    10 ) +
+                               "passed!" )
+                i += 1
+                PingResult = main.TRUE
+            else:
+                main.log.info( "Unknown error" )
+                PingResult = main.ERROR
+        if PingResult == main.FALSE:
+            main.log.report(
+                "Ping all test after Host intent addition failed.Cleaning up" )
+            # main.cleanup()
+            # main.exit()
+        if PingResult == main.TRUE:
+            main.log.report(
+                "Ping all test after Host intent addition successful" )
+
+        case6Result = PingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case6Result,
+            onpass="Pingall Test after Host intents addition successful",
+            onfail="Pingall Test after Host intents addition failed" )
+
+    def CASE5( self, main ):
+        import json
+        # assumes that sts is already in you PYTHONPATH
+        from sts.topology.teston_topology import TestONTopology
+        # main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+        main.log.report( "This testcase is testing if all ONOS nodes" +
+                         " are in topology sync with mininet" )
+        main.log.report( "__________________________________" )
+        main.case( "Comparing Mininet topology with the topology of ONOS" )
+        main.step( "Start continuous pings" )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source1' ],
+            target=main.params[ 'PING' ][ 'target1' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source2' ],
+            target=main.params[ 'PING' ][ 'target2' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source3' ],
+            target=main.params[ 'PING' ][ 'target3' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source4' ],
+            target=main.params[ 'PING' ][ 'target4' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source5' ],
+            target=main.params[ 'PING' ][ 'target5' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source6' ],
+            target=main.params[ 'PING' ][ 'target6' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source7' ],
+            target=main.params[ 'PING' ][ 'target7' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source8' ],
+            target=main.params[ 'PING' ][ 'target8' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source9' ],
+            target=main.params[ 'PING' ][ 'target9' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source10' ],
+            target=main.params[ 'PING' ][ 'target10' ],
+            pingTime=500 )
+
+        main.step( "Create TestONTopology object" )
+        global ctrls
+        ctrls = []
+        count = 1
+        while True:
+            temp = ()
+            if ( 'ip' + str( count ) ) in main.params[ 'CTRL' ]:
+                temp = temp + ( getattr( main, ( 'ONOS' + str( count ) ) ), )
+                temp = temp + ( "ONOS" + str( count ), )
+                temp = temp + ( main.params[ 'CTRL' ][ 'ip' + str( count ) ], )
+                temp = temp + \
+                    ( eval( main.params[ 'CTRL' ][ 'port' + str( count ) ] ), )
+                ctrls.append( temp )
+                count = count + 1
+            else:
+                break
+        global MNTopo
+        Topo = TestONTopology(
+            main.Mininet1,
+            ctrls )  # can also add Intent API info for intent operations
+        MNTopo = Topo
+
+        TopologyCheck = main.TRUE
+        main.step( "Compare ONOS Topology to MN Topology" )
+        devicesJson = main.ONOS2.devices()
+        linksJson = main.ONOS2.links()
+        # portsJson = main.ONOS2.ports()
+
+        result1 = main.Mininet1.compareSwitches(
+            MNTopo,
+            json.loads( devicesJson ) )
+        result2 = main.Mininet1.compareLinks(
+            MNTopo,
+            json.loads( linksJson ) )
+        # result3 = main.Mininet1.comparePorts(
+        # MNTopo, json.loads( portsJson ) )
+
+        # result = result1 and result2 and result3
+        result = result1 and result2
+
+        print "***********************"
+        if result == main.TRUE:
+            main.log.report( "ONOS" + " Topology matches MN Topology" )
+        else:
+            main.log.report( "ONOS" + " Topology does not match MN Topology" )
+
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=result,
+            onpass="ONOS" +
+            " Topology matches MN Topology",
+            onfail="ONOS" +
+            " Topology does not match MN Topology" )
+
+        TopologyCheck = TopologyCheck and result
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=TopologyCheck,
+            onpass="Topology checks passed",
+            onfail="Topology checks failed" )
+
+    def CASE7( self, main ):
+        from sts.topology.teston_topology import TestONTopology
+
+        linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
+
+        main.log.report( "This testscase is killing a link to ensure that" +
+                         " link discovery is consistent" )
+        main.log.report( "__________________________________" )
+        main.log.report( "Killing a link to ensure that link discovery" +
+                         " is consistent" )
+        main.case( "Killing a link to Ensure that Link Discovery" +
+                   "is Working Properly" )
+        """
+        main.step( "Start continuous pings" )
+
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source1' ],
+                               target=main.params[ 'PING' ][ 'target1' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source2' ],
+                               target=main.params[ 'PING' ][ 'target2' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source3' ],
+                               target=main.params[ 'PING' ][ 'target3' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source4' ],
+                               target=main.params[ 'PING' ][ 'target4' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source5' ],
+                               target=main.params[ 'PING' ][ 'target5' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source6' ],
+                               target=main.params[ 'PING' ][ 'target6' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source7' ],
+                               target=main.params[ 'PING' ][ 'target7' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source8' ],
+                               target=main.params[ 'PING' ][ 'target8' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source9' ],
+                               target=main.params[ 'PING' ][ 'target9' ],
+                               pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source10' ],
+                               target=main.params[ 'PING' ][ 'target10' ],
+                               pingTime=500 )
+        """
+        main.step( "Determine the current number of switches and links" )
+        topologyOutput = main.ONOS2.topology()
+        topologyResult = main.ONOS1.getTopology( topologyOutput )
+        activeSwitches = topologyResult[ 'deviceCount' ]
+        links = topologyResult[ 'linkCount' ]
+        print "activeSwitches = ", type( activeSwitches )
+        print "links = ", type( links )
+        main.log.info(
+            "Currently there are %s switches and %s links" %
+            ( str( activeSwitches ), str( links ) ) )
+
+        main.step( "Kill Link between s3 and s28" )
+        main.Mininet1.link( END1="s3", END2="s28", OPTION="down" )
+        time.sleep( linkSleep )
+        topologyOutput = main.ONOS2.topology()
+        LinkDown = main.ONOS1.checkStatus(
+            topologyOutput, activeSwitches, str(
+                int( links ) - 2 ) )
+        if LinkDown == main.TRUE:
+            main.log.report( "Link Down discovered properly" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=LinkDown,
+            onpass="Link Down discovered properly",
+            onfail="Link down was not discovered in " +
+            str( linkSleep ) +
+            " seconds" )
+
+        # Check ping result here..add code for it
+
+        main.step( "Bring link between s3 and s28 back up" )
+        LinkUp = main.Mininet1.link( END1="s3", END2="s28", OPTION="up" )
+        time.sleep( linkSleep )
+        topologyOutput = main.ONOS2.topology()
+        LinkUp = main.ONOS1.checkStatus(
+            topologyOutput,
+            activeSwitches,
+            str( links ) )
+        if LinkUp == main.TRUE:
+            main.log.report( "Link up discovered properly" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=LinkUp,
+            onpass="Link up discovered properly",
+            onfail="Link up was not discovered in " +
+            str( linkSleep ) +
+            " seconds" )
+
+        # NOTE Check ping result here..add code for it
+
+        main.step( "Compare ONOS Topology to MN Topology" )
+        Topo = TestONTopology(
+            main.Mininet1,
+            ctrls )  # can also add Intent API info for intent operations
+        MNTopo = Topo
+        TopologyCheck = main.TRUE
+
+        devicesJson = main.ONOS2.devices()
+        linksJson = main.ONOS2.links()
+        portsJson = main.ONOS2.ports()
+
+        result1 = main.Mininet1.compareSwitches(
+            MNTopo,
+            json.loads( devicesJson ) )
+        result2 = main.Mininet1.compareLinks(
+            MNTopo,
+            json.loads( linksJson ) )
+        # result3 = main.Mininet1.comparePorts(
+        # MNTopo, json.loads( portsJson ) )
+
+        # result = result1 and result2 and result3
+        result = result1 and result2
+        print "***********************"
+
+        if result == main.TRUE:
+            main.log.report( "ONOS" + " Topology matches MN Topology" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=result,
+            onpass="ONOS" +
+            " Topology matches MN Topology",
+            onfail="ONOS" +
+            " Topology does not match MN Topology" )
+
+        TopologyCheck = TopologyCheck and result
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=TopologyCheck,
+            onpass="Topology checks passed",
+            onfail="Topology checks failed" )
+
+        result = LinkDown and LinkUp and TopologyCheck
+        utilities.assert_equals( expect=main.TRUE, actual=result,
+                                 onpass="Link failure is discovered correctly",
+                                 onfail="Link Discovery failed" )
+
+    def CASE8( self ):
+        """
+        Intent removal
+        """
+        import time
+        main.log.report( "This testcase removes any previously added intents" +
+                         " before adding any new set of intents" )
+        main.log.report( "__________________________________" )
+        main.log.info( "intent removal" )
+        main.case( "Removing installed intents" )
+        main.step( "Obtain the intent id's" )
+        intentResult = main.ONOS2.intents( jsonFormat=False )
+        main.log.info( "intent_result = " + intentResult )
+        intentLinewise = intentResult.split( "\n" )
+
+        intentList = [line for line in intentLinewise \
+            if line.startswith( "id=")]
+        intentids = [line.split( "," )[ 0 ].split( "=" )[ 1 ] for line in \
+            intentList]
+        for id in intentids:
+            print "id = ", id
+
+        main.step(
+            "Iterate through the intentids list and remove each intent" )
+        for id in intentids:
+            main.ONOS2.removeIntent( intentId=id )
+
+        intentResult = main.ONOS2.intents( jsonFormat=False )
+        main.log.info( "intent_result = " + intentResult )
+        
+        intentList = [line for line in intentResult.split( "\n" ) \
+            if line.startswith( "id=")]
+        intentState = [line.split( "," )[ 1 ].split( "=" )[ 1 ] for line in \
+            intentList]
+        for state in intentState:
+            print state
+        
+        case8Result = main.TRUE        
+        for state in intentState:
+            if state != 'WITHDRAWN':
+                case8Result = main.FALSE
+                break
+                
+        if case8Result == main.TRUE:
+            main.log.report( "Intent removal successful" )
+        else:
+            main.log.report( "Intent removal failed" )
+
+        PingResult = main.TRUE
+        if case8Result == main.TRUE:
+            i = 8
+            while i < 18:
+                main.log.info(
+                    "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
+                ping = main.Mininet1.pingHost(
+                    src="h" + str( i ), target="h" + str( i + 10 ) )
+                if ping == main.TRUE:
+                    i = 19
+                    PingResult = PingResult and main.TRUE
+                elif ping == main.FALSE:
+                    i += 1
+                    PingResult = PingResult and main.FALSE
+                else:
+                    main.log.info( "Unknown error" )
+                    PingResult = main.ERROR
+
+            # Note: If the ping result failed, that means the intents have been
+            # withdrawn correctly.
+        if PingResult == main.TRUE:
+            main.log.report( "Installed intents have not been withdrawn correctly" )
+            # main.cleanup()
+            # main.exit()
+        if PingResult == main.FALSE:
+            main.log.report( "Installed intents have been withdrawn correctly" )
+
+        case8Result = case8Result and PingResult
+
+        if case8Result == main.FALSE:
+            main.log.report( "Intent removal successful" )
+        else:
+            main.log.report( "Intent removal failed" )
+
+        utilities.assert_equals( expect=main.FALSE, actual=case8Result,
+                                 onpass="Intent removal test passed",
+                                 onfail="Intent removal test failed" )
+
+    def CASE9( self ):
+        main.log.report(
+            "This testcase adds point intents and then does pingall" )
+        main.log.report( "__________________________________" )
+        main.log.info( "Adding point intents" )
+        main.case(
+            "Adding bidirectional point for mn hosts" +
+            "( h8-h18, h9-h19, h10-h20, h11-h21, h12-h22, " +
+            "h13-h23, h14-h24, h15-h25, h16-h26, h17-h27 )" )
+
+        main.step( "Add point intents for mn hosts h8 and h18 or" +
+                   "ONOS hosts h8 and h12" )
+        # main.step(var1)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003008/1",
+            "of:0000000000006018/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006018/1",
+            "of:0000000000003008/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var2 = "Add point intents for mn hosts h9&h19 or ONOS hosts h9&h13"
+        main.step(var2)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003009/1",
+            "of:0000000000006019/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006019/1",
+            "of:0000000000003009/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var3 = "Add point intents for MN hosts h10&h20 or ONOS hosts hA&h14"
+        main.step(var3)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003010/1",
+            "of:0000000000006020/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006020/1",
+            "of:0000000000003010/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var4 = "Add point intents for mininet hosts h11 and h21 or" +\
+               " ONOS hosts hB and h15"
+        main.case(var4)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003011/1",
+            "of:0000000000006021/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006021/1",
+            "of:0000000000003011/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var5 = "Add point intents for mininet hosts h12 and h22 " +\
+               "ONOS hosts hC and h16"
+        main.case(var5)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003012/1",
+            "of:0000000000006022/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006022/1",
+            "of:0000000000003012/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var6 = "Add point intents for mininet hosts h13 and h23 or" +\
+               " ONOS hosts hD and h17"
+        main.case(var6)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003013/1",
+            "of:0000000000006023/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006023/1",
+            "of:0000000000003013/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var7 = "Add point intents for mininet hosts h14 and h24 or" +\
+               " ONOS hosts hE and h18"
+        main.case(var7)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003014/1",
+            "of:0000000000006024/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006024/1",
+            "of:0000000000003014/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var8 = "Add point intents for mininet hosts h15 and h25 or" +\
+               " ONOS hosts hF and h19"
+        main.case(var8)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003015/1",
+            "of:0000000000006025/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006025/1",
+            "of:0000000000003015/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var9 = "Add intents for mininet hosts h16 and h26 or" +\
+               " ONOS hosts h10 and h1A"
+        main.case(var9)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003016/1",
+            "of:0000000000006026/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006026/1",
+            "of:0000000000003016/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( getIntentResult )
+
+        var10 = "Add point intents for mininet hosts h17 and h27 or" +\
+                " ONOS hosts h11 and h1B"
+        main.case(var10)
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000003017/1",
+            "of:0000000000006027/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            #main.log.info( getIntentResult )
+
+        ptpIntentResult = main.ONOS2.addPointIntent(
+            "of:0000000000006027/1",
+            "of:0000000000003017/1" )
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            #main.log.info( getIntentResult )
+
+        print(
+            "___________________________________________________________" )
+
+        flowHandle = main.ONOS2.flows()
+        #main.log.info( "flows :" + flowHandle )
+
+        count = 1
+        i = 8
+        PingResult = main.TRUE
+        while i < 18:
+            main.log.info(
+                "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
+            ping = main.Mininet1.pingHost(
+                src="h" + str( i ), target="h" + str( i + 10 ) )
+            if ping == main.FALSE and count < 5:
+                count += 1
+                # i = 8
+                PingResult = main.FALSE
+                main.log.report( "Ping between h" +
+                                 str( i ) +
+                                 " and h" +
+                                 str( i +
+                                      10 ) +
+                                 " failed. Making attempt number " +
+                                 str( count ) +
+                                 " in 2 seconds" )
+                time.sleep( 2 )
+            elif ping == main.FALSE:
+                main.log.report( "All ping attempts between h" +
+                                 str( i ) +
+                                 " and h" +
+                                 str( i +
+                                      10 ) +
+                                 "have failed" )
+                i = 19
+                PingResult = main.FALSE
+            elif ping == main.TRUE:
+                main.log.info( "Ping test between h" +
+                               str( i ) +
+                               " and h" +
+                               str( i +
+                                    10 ) +
+                               "passed!" )
+                i += 1
+                PingResult = main.TRUE
+            else:
+                main.log.info( "Unknown error" )
+                PingResult = main.ERROR
+
+        if PingResult == main.FALSE:
+            main.log.report(
+                "Point intents have not ben installed correctly. Cleaning up" )
+            # main.cleanup()
+            # main.exit()
+        if PingResult == main.TRUE:
+            main.log.report( "Point Intents have been installed correctly" )
+
+        case9Result = PingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case9Result,
+            onpass="Point intents addition and Pingall Test successful",
+            onfail="Point intents addition and Pingall Test NOT successful" )
diff --git a/TestON/tests/ProdFunc13/ProdFunc13.py b/TestON/tests/ProdFunc13/ProdFunc13.py
index a4d819c..b3e456b 100644
--- a/TestON/tests/ProdFunc13/ProdFunc13.py
+++ b/TestON/tests/ProdFunc13/ProdFunc13.py
@@ -41,29 +41,35 @@
         cellResult = main.ONOSbench.setCell( cellName )
         verifyResult = main.ONOSbench.verifyCell()
 
-        main.step( "Removing raft logs before a clen installation of ONOS" )
-        main.ONOSbench.onosRemoveRaftLogs()
-
         main.step( "Git checkout and get version" )
-        #main.ONOSbench.gitCheckout( "master" )
+        main.ONOSbench.gitCheckout( "master" )
         gitPullResult = main.ONOSbench.gitPull()
         main.log.info( "git_pull_result = " + str( gitPullResult ))
         main.ONOSbench.getVersion( report=True )
 
-        if gitPullResult == 1:
+        packageResult = main.TRUE
+        if gitPullResult == 100:
             main.step( "Using mvn clean & install" )
             main.ONOSbench.cleanInstall()
+            main.step( "Creating ONOS package" )
+            packageResult = main.ONOSbench.onosPackage()
         elif gitPullResult == 0:
             main.log.report(
                 "Git Pull Failed, look into logs for detailed reason" )
             main.cleanup()
             main.exit()
 
-        main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.onosPackage()
+
+        main.step( "Uninstalling ONOS package" )
+        onosInstallResult = main.ONOSbench.onosUninstall( ONOS1Ip )
+        if onosInstallResult == main.TRUE:
+            main.log.report( "Uninstalling ONOS package successful" )
+        else:
+            main.log.report( "Uninstalling ONOS package failed" )
 
         main.step( "Installing ONOS package" )
-        onosInstallResult = main.ONOSbench.onosInstall()
+        onosInstallResult = main.ONOSbench.onosInstall( ONOS1Ip )
+        print onosInstallResult
         if onosInstallResult == main.TRUE:
             main.log.report( "Installing ONOS package successful" )
         else:
@@ -75,10 +81,11 @@
         else:
             main.log.report( "ONOS instance may not be up" )
 
-        main.step( "Starting ONOS service" )
-        startResult = main.ONOSbench.onosStart( ONOS1Ip )
+        startResult = main.TRUE
+        #main.step( "Starting ONOS service" )
+        #startResult = main.ONOSbench.onosStart( ONOS1Ip )
 
-        main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+        main.ONOS2.startOnosCli( ONOS1Ip )
         main.step( "Starting Mininet CLI..." )
         
         # Starting the mininet using the old way
@@ -183,6 +190,7 @@
             Exit from mininet cli
             reinstall ONOS
         """
+        import time
         cellName = main.params[ 'ENV' ][ 'cellName' ]
         ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
 
@@ -190,22 +198,60 @@
                          "ONOS to switch over to Packet Optical topology" )
         main.log.report( "_____________________________________________" )
         main.case( "Disconnecting mininet and restarting ONOS" )
+
         main.step( "Disconnecting mininet and restarting ONOS" )
+        step1Result = main.TRUE
         mininetDisconnect = main.Mininet1.disconnect()
-        print "mininetDisconnect = ", mininetDisconnect        
-
-        main.step( "Removing raft logs before a clen installation of ONOS" )
-        main.ONOSbench.onosRemoveRaftLogs()
-
+        print "mininetDisconnect = ", mininetDisconnect
+        step1Result = mininetDisconnect
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Mininet disconnect successfully",
+            onfail="Mininet failed to disconnect")
+        """
+        main.step( "Removing raft logs before a clean installation of ONOS" )
+        step2Result = main.TRUE
+        removeRaftLogsResult = main.ONOSbench.onosRemoveRaftLogs()
+        step2Result = removeRaftLogsResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Raft logs removed successfully",
+            onfail="Failed to remove raft logs")
+        """
         main.step( "Applying cell variable to environment" )
-        cellResult = main.ONOSbench.setCell( cellName )
-        verifyResult = main.ONOSbench.verifyCell()
+        step3Result = main.TRUE
+        setCellResult = main.ONOSbench.setCell( cellName )
+        verifyCellResult = main.ONOSbench.verifyCell()
+        step3Result = setCellResult and verifyCellResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step3Result,
+            onpass="Cell applied successfully",
+            onfail="Failed to apply cell")
 
-        onosInstallResult = main.ONOSbench.onosInstall()
-        if onosInstallResult == main.TRUE:
-            main.log.report( "Installing ONOS package successful" )
-        else:
-            main.log.report( "Installing ONOS package failed" )
+        main.step( "Uninstalling ONOS package" )
+        step4Result = main.TRUE
+        ONOSip1 = main.params[ 'CTRL' ][ 'ip1' ]
+        onosUninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOSip1)
+        step4Result = onosUninstallResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step4Result,
+            onpass="Successfully uninstalled ONOS",
+            onfail="Failed to uninstall ONOS")
+
+        time.sleep( 5 )
+        main.step( "Installing ONOS package" )
+        step5Result = main.TRUE
+        onosInstallResult = main.ONOSbench.onosInstall( node = ONOSip1 )
+        step5Result = onosInstallResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step5Result,
+            onpass="Successfully installed ONOS",
+            onfail="Failed to install ONOS")
 
         onos1Isup = main.ONOSbench.isup()
         if onos1Isup == main.TRUE:
@@ -214,19 +260,24 @@
             main.log.report( "ONOS instance may not be up" )
 
         main.step( "Starting ONOS service" )
+        step6Result = main.TRUE
         startResult = main.ONOSbench.onosStart( ONOS1Ip )
-
-        main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
-        case20Result = mininetDisconnect and cellResult and verifyResult \
-            and onosInstallResult and onos1Isup and \
-            startResult
+        step6Result = startResult
         utilities.assert_equals(
             expect=main.TRUE,
-            actual=case20Result,
-            onpass= "Exiting functionality mininet topology and reinstalling" +
-                    " ONOS successful",
-            onfail= "Exiting functionality mininet topology and reinstalling" +
-                    " ONOS failed" )
+            actual=step6Result,
+            onpass="Successfully started ONOS",
+            onfail="Failed to start ONOS")
+
+        main.step( "Starting ONOS cli" )
+        step7Result = main.TRUE
+        cliResult = main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+        step7Result = cliResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step7Result,
+            onpass="Successfully started ONOS cli",
+            onfail="Failed to start ONOS cli")
 
     def CASE21( self, main ):
         """
@@ -238,20 +289,37 @@
             from the topology, instead the links are learnt
             from the json config file
         """
+        import time
         main.log.report(
             "This testcase starts the packet layer topology and REST" )
         main.log.report( "_____________________________________________" )
         main.case( "Starting LINC-OE and other components" )
-        main.step( "Starting LINC-OE and other components" )
-        appInstallResult = main.ONOS2.featureInstall( "onos-app-optical" )
-        opticalMnScript = main.LincOE2.runOpticalMnScript(ctrllerIP = main.params[ 'CTRL' ][ 'ip1' ])
 
-        case21Result = opticalMnScript and appInstallResult
+        main.step( "Activate optical app" )
+        step1Result = main.TRUE
+        activateOpticalResult = main.ONOS2.activateApp( "org.onosproject.optical" )
+        step1Result = activateOpticalResult
         utilities.assert_equals(
             expect=main.TRUE,
-            actual=case21Result,
-            onpass="Packet optical topology spawned successsfully",
-            onfail="Packet optical topology spawning failed" )
+            actual=step1Result,
+            onpass="Successfully activated optical app",
+            onfail="Failed to activate optical app")
+
+        appCheck = main.ONOS2.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOS2.apps() )
+            main.log.warn( main.ONOS2.appIDs() )
+
+        main.step( "Starting mininet and LINC-OE" )
+        step2Result = main.TRUE
+        time.sleep( 10 )
+        opticalMnScript = main.LincOE2.runOpticalMnScript(ctrllerIP = main.params[ 'CTRL' ][ 'ip1' ])
+        step2Result = opticalMnScript
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Started the topology successfully ",
+            onfail="Failed to start the topology")
 
     def CASE22( self, main ):
         """
@@ -259,21 +327,32 @@
             6 packet layer mininet switches each with one host.
             Therefore, the roadmCount variable = 10,
             packetLayerSWCount variable = 6, hostCount=6 and
-            links=42.
+            links=46.
             All this is hardcoded in the testcase. If the topology changes,
             these hardcoded values need to be changed
         """
+        import time
         main.log.report(
             "This testcase compares the optical+packet topology against what" +
             " is expected" )
         main.case( "Topology comparision" )
-        main.step( "Topology comparision" )
-        main.ONOS3.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
-        devicesResult = main.ONOS3.devices( jsonFormat=False )
 
-        print "devices_result = ", devicesResult
+        main.step( "Starts new ONOS cli" )
+        step1Result = main.TRUE
+        cliResult = main.ONOS3.startOnosCli( ONOSIp=main.params[ 'CTRL' ]\
+                                                               [ 'ip1' ] )
+        step1Result = cliResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully starts a new cli",
+            onfail="Failed to start new cli" )
+
+        main.step( "Compare topology" )
+        step2Result = main.TRUE
+        devicesResult = main.ONOS3.devices( jsonFormat=False )
+        print "devices_result :\n", devicesResult
         devicesLinewise = devicesResult.split( "\n" )
-        devicesLinewise = devicesLinewise[ 1: ]
         roadmCount = 0
         packetLayerSWCount = 0
         for line in devicesLinewise:
@@ -299,7 +378,6 @@
                 str( roadmCount ) +
                 " and is wrong" )
             opticalSWResult = main.FALSE
-
         if packetLayerSWCount == 6:
             print "Number of Packet layer or mininet Switches = %d "\
                     % packetLayerSWCount + "and is correctly detected"
@@ -316,14 +394,15 @@
                 str( packetLayerSWCount ) +
                 " and is wrong" )
             packetSWResult = main.FALSE
+        # sleeps for sometime so the state of the switches will be active
+        time.sleep( 30 )
         print "_________________________________"
-
         linksResult = main.ONOS3.links( jsonFormat=False )
         print "links_result = ", linksResult
         print "_________________________________"
-        linkActiveCount = linksResult.count("state=ACTIVE") 
+        linkActiveCount = linksResult.count("state=ACTIVE")
         main.log.info( "linkActiveCount = " + str( linkActiveCount ))
-        if linkActiveCount == 42:
+        if linkActiveCount == 46:
             linkActiveResult = main.TRUE
             main.log.info(
                 "Number of links in ACTIVE state are correct")
@@ -331,41 +410,13 @@
             linkActiveResult = main.FALSE
             main.log.info(
                 "Number of links in ACTIVE state are wrong")
-
-        # NOTE:Since only point intents are added, there is no
-        # requirement to discover the hosts
-        # Therfore, the below portion of the code is commented.
-        """
-        #Discover hosts using pingall
-        pingallResult = main.LincOE2.pingall()
-
-        hostsResult = main.ONOS3.hosts( jsonFormat=False )
-        main.log.info( "hosts_result = "+hostsResult )
-        main.log.info( "_________________________________" )
-        hostsLinewise = hostsResult.split( "\n" )
-        hostsLinewise = hostsLinewise[ 1:-1 ]
-        hostCount = 0
-        for line in hostsLinewise:
-            hostid = line.split( "," )[ 0 ].split( "=" )[ 1 ]
-            hostCount +=1
-        if hostCount ==2:
-            print "Number of hosts = %d and is correctly detected" %hostCount
-            main.log.info( "Number of hosts = " + str( hostCount ) +" and \
-                            is correctly detected" )
-            hostDiscovery = main.TRUE
-        else:
-            print "Number of hosts = %d and is wrong" %hostCount
-            main.log.info( "Number of hosts = " + str( hostCount ) +" and \
-                            is wrong" )
-            hostDiscovery = main.FALSE
-        """
-        case22Result = opticalSWResult and packetSWResult and \
+        step2Result = opticalSWResult and packetSWResult and \
                         linkActiveResult
         utilities.assert_equals(
             expect=main.TRUE,
-            actual=case22Result,
-            onpass="Packet optical topology discovery successful",
-            onfail="Packet optical topology discovery failed" )
+            actual=step2Result,
+            onpass="Successfully loaded packet optical topology",
+            onfail="Failed to load packet optical topology" )
 
     def CASE23( self, main ):
         import time
@@ -377,71 +428,50 @@
         main.log.report(
             "This testcase adds bidirectional point intents between 2 " +
             "packet layer( mininet ) devices and ping mininet hosts" )
-        main.case( "Topology comparision" )
+        main.case( "Install point intents between 2 packet layer device and " +
+                   "ping the hosts" )
+
         main.step( "Adding point intents" )
-        ptpIntentResult = main.ONOS3.addPointIntent(
+        checkFlowResult = main.TRUE
+        step1Result = main.TRUE
+        main.pIntentsId = []
+        pIntent1 = main.ONOS3.addPointIntent(
             "of:0000ffffffff0001/1",
             "of:0000ffffffff0005/1" )
-        if ptpIntentResult == main.TRUE:
-            main.ONOS3.intents( jsonFormat=False )
-            main.log.info( "Point to point intent install successful" )
-
-        ptpIntentResult = main.ONOS3.addPointIntent(
+        pIntent2 = main.ONOS3.addPointIntent(
             "of:0000ffffffff0005/1",
             "of:0000ffffffff0001/1" )
-        if ptpIntentResult == main.TRUE:
-            main.ONOS3.intents( jsonFormat=False )
-            main.log.info( "Point to point intent install successful" )
-
-        time.sleep( 30 )
-        flowHandle = main.ONOS3.flows()
-        main.log.info( "flows :" + flowHandle )
-
+        main.pIntentsId.append( pIntent1 )
+        main.pIntentsId.append( pIntent2 )
+        time.sleep( 10 )
+        main.log.info( "Checking intents state")
+        checkStateResult = main.ONOS3.checkIntentState(
+                                                  intentsId = main.pIntentsId )
+        time.sleep( 10 )
+        main.log.info( "Checking flows state")
+        checkFlowResult = main.ONOS3.checkFlowsState()
         # Sleep for 30 seconds to provide time for the intent state to change
-        time.sleep( 60 )
-        intentHandle = main.ONOS3.intents( jsonFormat=False )
-        main.log.info( "intents :" + intentHandle )
-
-        PingResult = main.TRUE
-        count = 1
-        main.log.info( "\n\nh1 is Pinging h5" )
-        ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
-        # ping = main.LincOE2.pinghost()
-        if ping == main.FALSE and count < 5:
-            count += 1
-            PingResult = main.FALSE
-            main.log.info(
-                "Ping between h1 and h5  failed. Making attempt number " +
-                str( count ) +
-                " in 2 seconds" )
-            time.sleep( 2 )
-        elif ping == main.FALSE:
-            main.log.info( "All ping attempts between h1 and h5 have failed" )
-            PingResult = main.FALSE
-        elif ping == main.TRUE:
-            main.log.info( "Ping test between h1 and h5 passed!" )
-            PingResult = main.TRUE
-        else:
-            main.log.info( "Unknown error" )
-            PingResult = main.ERROR
-
-        if PingResult == main.FALSE:
-            main.log.report(
-                "Point intents for packet optical have not ben installed" +
-                " correctly. Cleaning up" )
-        if PingResult == main.TRUE:
-            main.log.report(
-                "Point Intents for packet optical have been " +
-                "installed correctly" )
-
-        case23Result = PingResult
+        time.sleep( 10 )
+        main.log.info( "Checking intents state one more time")
+        checkStateResult = main.ONOS3.checkIntentState(
+                                                  intentsId = main.pIntentsId )
+        step1Result = checkStateResult and checkFlowResult
         utilities.assert_equals(
             expect=main.TRUE,
-            actual=case23Result,
-            onpass= "Point intents addition for packet optical and" +
-                    "Pingall Test successful",
-            onfail= "Point intents addition for packet optical and" +
-                    "Pingall Test NOT successful" )
+            actual=step1Result,
+            onpass="Successfully added point intents",
+            onfail="Failed to add point intents")
+
+        main.step( "Ping h1 and h5" )
+        step2Result = main.TRUE
+        main.log.info( "\n\nh1 is Pinging h5" )
+        pingResult = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+        step2Result = pingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Successfully pinged h1 and h5",
+            onfail="Failed to ping between h1 and h5")
 
     def CASE24( self, main ):
         import time
@@ -462,16 +492,23 @@
         main.log.report(
             "This testcase tests rerouting and pings mininet hosts" )
         main.case( "Test rerouting and pings mininet hosts" )
+
         main.step( "Attach to the Linc-OE session" )
-        attachConsole = main.LincOE1.attachLincOESession() 
-        print "attachConsole = ", attachConsole
+        step1Result = main.TRUE
+        attachConsole = main.LincOE1.attachLincOESession()
+        step1Result = attachConsole
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully attached Linc-OE session",
+            onfail="Failed to attached Linc-OE session")
 
         main.step( "Bring a port down and verify the link state" )
+        step2Result = main.TRUE
         main.LincOE1.portDown( swId="9", ptId="20" )
         linksNonjson = main.ONOS3.links( jsonFormat=False )
         main.log.info( "links = " + linksNonjson )
-
-        linkInactiveCount = linksNonjson.count("state=INACTIVE")
+        linkInactiveCount = linksNonjson.count( "state=INACTIVE" )
         main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
         if linkInactiveCount == 2:
             main.log.info(
@@ -479,10 +516,8 @@
         else:
             main.log.info(
                 "Number of links in INACTIVE state are wrong")
-        
         links = main.ONOS3.links()
         main.log.info( "links = " + links )
-
         linksResult = json.loads( links )
         linksStateResult = main.FALSE
         for item in linksResult:
@@ -506,45 +541,184 @@
                         main.log.report(
                             "Links state is not inactive as expected" )
                         linksStateResult = main.FALSE
-
-        print "links_state_result = ", linksStateResult
         time.sleep( 10 )
-        flowHandle = main.ONOS3.flows()
-        main.log.info( "flows :" + flowHandle )
+        checkFlowsState = main.ONOS3.checkFlowsState()
+        step2Result = linksStateResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Successfuly brought down a link",
+            onfail="Failed to bring down a link")
 
         main.step( "Verify Rerouting by a ping test" )
-        PingResult = main.TRUE
-        count = 1
+        step3Result = main.TRUE
         main.log.info( "\n\nh1 is Pinging h5" )
-        ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
-        # ping = main.LincOE2.pinghost()
-        if ping == main.FALSE and count < 5:
-            count += 1
-            PingResult = main.FALSE
+        pingResult = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+        step3Result = pingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step3Result,
+            onpass="Successfully pinged h1 and h5",
+            onfail="Failed to ping between h1 and h5")
+
+        main.step( "Bring the downed port up and verify the link state" )
+        step4Result = main.TRUE
+        main.LincOE1.portUp( swId="9", ptId="20" )
+        linksNonjson = main.ONOS3.links( jsonFormat=False )
+        main.log.info( "links = " + linksNonjson )
+        linkInactiveCount = linksNonjson.count( "state=INACTIVE" )
+        main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+        if linkInactiveCount == 0:
             main.log.info(
-                "Ping between h1 and h5  failed. Making attempt number " +
-                str( count ) +
-                " in 2 seconds" )
-            time.sleep( 2 )
-        elif ping == main.FALSE:
-            main.log.info( "All ping attempts between h1 and h5 have failed" )
-            PingResult = main.FALSE
-        elif ping == main.TRUE:
-            main.log.info( "Ping test between h1 and h5 passed!" )
-            PingResult = main.TRUE
+                "Number of links in INACTIVE state are correct")
         else:
-            main.log.info( "Unknown error" )
-            PingResult = main.ERROR
+            main.log.info(
+                "Number of links in INACTIVE state are wrong")
+            step4Result = main.FALSE
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step4Result,
+            onpass="Successfully brought the port up",
+            onfail="Failed to bring the port up")
+        """
+        main.step( "Removing host intents" )
+        step5Result = main.TRUE
+        removeResult = main.TRUE
+        # Check remaining intents
+        intentsJson = json.loads( main.ONOS3.intents() )
+        main.ONOS3.removeIntent( intentId=intent1, purge=True )
+        main.ONOS3.removeIntent( intentId=intent2, purge=True )
+        for intents in intentsJson:
+            main.ONOS3.removeIntent( intentId=intents.get( 'id' ),
+                                     app='org.onosproject.optical',
+                                     purge=True )
+        print json.loads( main.ONOS3.intents() )
+        if len( json.loads( main.ONOS3.intents() ) ):
+            removeResult = main.FALSE
+        step5Result = removeResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=step5Result,
+                                 onpass="Successfully removed host intents",
+                                 onfail="Failed to remove host intents" )
+        """
+    def CASE10( self ):
+        main.log.report(
+            "This testcase uninstalls the reactive forwarding app" )
+        main.log.report( "__________________________________" )
+        main.case( "Uninstalling reactive forwarding app" )
+        main.step( "Uninstalling reactive forwarding app" )
+        step1Result = main.TRUE
+        # Unistall onos-app-fwd app to disable reactive forwarding
+        main.log.info( "deactivate reactive forwarding app" )
+        appUninstallResult = main.ONOS2.deactivateApp( "org.onosproject.fwd" )
+        appCheck = main.ONOS2.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOS2.apps() )
+            main.log.warn( main.ONOS2.appIDs() )
+        step1Result = appUninstallResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully deactivate reactive forwarding app",
+            onfail="Failed to deactivate reactive forwarding app")
+        # After reactive forwarding is disabled, the reactive flows on
+        # switches timeout in 10-15s
+        # So sleep for 15s
+        time.sleep( 15 )
+        flows = main.ONOS2.flows()
+        main.log.info( flows )
 
-        if PingResult == main.TRUE:
-            main.log.report( "Ping test successful " )
-        if PingResult == main.FALSE:
-            main.log.report( "Ping test failed" )
+    def CASE25( self ):
+        """
+            Add host intents between 2 packet layer host
+        """
+        import time
+        import json
+        main.log.report( "Adding host intents between 2 optical layer host" )
+        main.case( "Test add host intents between optical layer host" )
 
-        case24Result = PingResult and linksStateResult
-        utilities.assert_equals( expect=main.TRUE, actual=case24Result,
-                                 onpass="Packet optical rerouting successful",
-                                 onfail="Packet optical rerouting failed" )
+        main.step( "Discover host using arping" )
+        step1Result = main.TRUE
+        main.hostMACs = []
+        main.hostId = []
+        #Listing host MAC addresses
+        for i in range( 1 , 7 ):
+            main.hostMACs.append( "00:00:00:00:00:" +
+                                str( hex( i )[ 2: ] ).zfill( 2 ).upper() )
+        for macs in main.hostMACs:
+            main.hostId.append( macs + "/-1" )
+        host1 = main.hostId[ 0 ]
+        host2 = main.hostId[ 1 ]
+        # Use arping to discover the hosts
+        main.LincOE2.arping( host = "h1" )
+        main.LincOE2.arping( host = "h2" )
+        time.sleep( 5 )
+        hostsDict = main.ONOS3.hosts()
+        if not len( hostsDict ):
+            step1Result = main.FALSE
+        # Adding host intent
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Hosts discovered",
+            onfail="Failed to discover hosts")
+
+        main.step( "Adding host intents to h1 and h2" )
+        step2Result = main.TRUE
+        intentsId = []
+        intent1 = main.ONOS3.addHostIntent( hostIdOne = host1,
+                                            hostIdTwo = host2 )
+        intentsId.append( intent1 )
+        time.sleep( 5 )
+        intent2 = main.ONOS3.addHostIntent( hostIdOne = host2,
+                                            hostIdTwo = host1 )
+        intentsId.append( intent2 )
+        # Checking intents state before pinging
+        main.log.info( "Checking intents state" )
+        time.sleep( 15 )
+        intentResult = main.ONOS3.checkIntentState( intentsId = intentsId )
+        #check intent state again if intents are not in installed state
+        if not intentResult:
+           intentResult = main.ONOS3.checkIntentState( intentsId = intentsId )
+        step2Result = intentResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=step2Result,
+                                 onpass="All intents are in INSTALLED state ",
+                                 onfail="Some of the intents are not in " +
+                                        "INSTALLED state " )
+
+        # pinging h1 to h2 and then ping h2 to h1
+        main.step( "Pinging h1 and h2" )
+        step3Result = main.TRUE
+        pingResult = main.TRUE
+        pingResult = main.LincOE2.pingHostOptical( src="h1", target="h2" )
+        pingResult = pingResult and main.LincOE2.pingHostOptical( src="h2",
+                                                                  target="h1" )
+        step3Result = pingResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=step3Result,
+                                 onpass="Pinged successfully between h1 and h2",
+                                 onfail="Pinged failed between h1 and h2" )
+        # Removed all added host intents
+        main.step( "Removing host intents" )
+        step4Result = main.TRUE
+        removeResult = main.TRUE
+        # Check remaining intents
+        intentsJson = json.loads( main.ONOS3.intents() )
+        main.ONOS3.removeIntent( intentId=intent1, purge=True )
+        main.ONOS3.removeIntent( intentId=intent2, purge=True )
+        for intents in intentsJson:
+            main.ONOS3.removeIntent( intentId=intents.get( 'id' ),
+                                     app='org.onosproject.optical',
+                                     purge=True )
+        print json.loads( main.ONOS3.intents() )
+        if len( json.loads( main.ONOS3.intents() ) ):
+            removeResult = main.FALSE
+        step4Result = removeResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=step4Result,
+                                 onpass="Successfully removed host intents",
+                                 onfail="Failed to remove host intents" )
 
     def CASE4( self, main ):
         import re
@@ -553,6 +727,7 @@
                          " all the switches to all the controllers and" +
                          " discovering the hosts in reactive mode" )
         main.log.report( "__________________________________" )
+
         main.case( "Pingall Test" )
         main.step( "Assigning switches to controllers" )
         ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
@@ -651,6 +826,13 @@
                     ip5=ONOS5Ip,port5=ONOS5Port )
         """
         # REACTIVE FWD test
+        main.log.info( "Activate fwd app" )
+        appInstallResult = main.ONOS2.activateApp( "org.onosproject.fwd" )
+        appCheck = main.ONOS2.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOS2.apps() )
+            main.log.warn( main.ONOS2.appIDs() )
+        time.sleep( 10 )
 
         main.step( "Get list of hosts from Mininet" )
         hostList = main.Mininet1.getHosts()
@@ -687,31 +869,6 @@
             onpass="Controller assignment and Pingall Test successful",
             onfail="Controller assignment and Pingall Test NOT successful" )
 
-    def CASE10( self ):
-        main.log.report(
-            "This testcase uninstalls the reactive forwarding app" )
-        main.log.report( "__________________________________" )
-        main.case( "Uninstalling reactive forwarding app" )
-        # Unistall onos-app-fwd app to disable reactive forwarding
-        appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
-        main.log.info( "onos-app-fwd uninstalled" )
-
-        # After reactive forwarding is disabled, the reactive flows on
-        # switches timeout in 10-15s
-        # So sleep for 15s
-        time.sleep( 15 )
-
-        flows = main.ONOS2.flows()
-        main.log.info( flows )
-
-        case10Result = appUninstallResult
-        utilities.assert_equals(
-            expect=main.TRUE,
-            actual=case10Result,
-            onpass="Reactive forwarding app uninstallation successful",
-            onfail="Reactive forwarding app uninstallation failed" )
-
-
     def CASE11( self ):
         # NOTE: This testcase require reactive forwarding mode enabled
         # NOTE: in the beginning and then uninstall it before adding 
@@ -727,26 +884,40 @@
         main.step( "Moving host h9 from device s9 and attach it to s8" )
         main.Mininet1.moveHost(host = 'h9', oldSw = 's9', newSw = 's8')
 
-        time.sleep(15) #Time delay to have all the flows ready
+        main.log.info( "Activate fwd app" )
+        appInstallResult = main.ONOS2.activateApp( "org.onosproject.fwd" )
+        appCheck = main.ONOS2.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOS2.apps() )
+            main.log.warn( main.ONOS2.appIDs() )
+
+        time.sleep(25) #Time delay to have all the flows ready
         main.step( "Pingall" )
         pingResult = main.FALSE
         time1 = time.time()
-        pingResult = main.Mininet1.pingall()
+        pingResult = main.Mininet1.pingall( timeout=120,
+                                            shortCircuit=True,
+                                            acceptableFailed=20 )
         time2 = time.time()
         print "Time for pingall: %2f seconds" % ( time2 - time1 )
 
         hosts = main.ONOS2.hosts( jsonFormat = False )
         main.log.info( hosts )
         
-        main.case( "Uninstalling reactive forwarding app" )
-        # Unistall onos-app-fwd app to disable reactive forwarding
-        appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
-        main.log.info( "onos-app-fwd uninstalled" )
+        main.log.info( "deactivate reactive forwarding app" )
+        appUninstallResult = main.ONOS2.deactivateApp( "org.onosproject.fwd" )
+        appCheck = main.ONOS2.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOS2.apps() )
+            main.log.warn( main.ONOS2.appIDs() )
 
         main.step( "Add point intents between hosts on the same device")
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003008/1",
-            "of:0000000000003008/3" )
+            "of:0000000000003008/3",
+            ethType='IPV4',
+            ethSrc='00:00:00:00:00:08',
+            ethDst='00:00:00:00:00:09' )
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -754,7 +925,10 @@
 
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003008/3",
-            "of:0000000000003008/1" )
+            "of:0000000000003008/1",
+            ethType='IPV4',
+            ethSrc='00:00:00:00:00:09',
+            ethDst='00:00:00:00:00:08' )
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -779,7 +953,7 @@
                 "Point intents for hosts on same devices" +
                 "installed correctly. Cleaning up" )
 
-        case11Result = ping and pingResult
+        case11Result = ping
         utilities.assert_equals(
             expect = main.TRUE,
             actual = case11Result,
@@ -788,7 +962,6 @@
             onfail = "Point intents for hosts on same devices" +
                     "Ping Test NOT successful" )
 
-
     def CASE12( self ):
         """
         Verify the default flows on each switch in proactive mode
@@ -812,9 +985,6 @@
             actual=case12Result,
             onpass = "Expected default num of flows exist",
             onfail = "Expected default num of flows do not exist")
-    
-    
-        
 
     def CASE6( self ):
         import time
@@ -858,6 +1028,7 @@
                             "00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1" )
         print "______________________________________________________"
         """
+        intentsId = []
         for i in range( 8, 18 ):
             main.log.info(
                 "Adding host intent between h" + str( i ) +
@@ -872,8 +1043,9 @@
             if host2:
                 host2Id = main.ONOS2.getHost( host2 )[ 'id' ]
             if host1Id and host2Id:
-                main.ONOS2.addHostIntent( host1Id, host2Id )
+                intentsId.append( main.ONOS2.addHostIntent( host1Id, host2Id ) )
 
+        checkIntentResult = main.ONOS2.checkIntentState( intentsId )
         time.sleep( 10 )
         hIntents = main.ONOS2.intents( jsonFormat=False )
         main.log.info( "intents:" + hIntents )
@@ -932,6 +1104,8 @@
             main.log.report(
                 "Ping all test after Host intent addition successful" )
 
+        checkIntentResult = main.ONOS2.checkIntentState( intentsId )
+
         case6Result = PingResult
         utilities.assert_equals(
             expect=main.TRUE,
@@ -940,6 +1114,9 @@
             onfail="Pingall Test after Host intents addition failed" )
 
     def CASE5( self, main ):
+        """
+            Check ONOS topology matches with mininet
+        """
         import json
         # assumes that sts is already in you PYTHONPATH
         from sts.topology.teston_topology import TestONTopology
@@ -1016,7 +1193,7 @@
         main.step( "Compare ONOS Topology to MN Topology" )
         devicesJson = main.ONOS2.devices()
         linksJson = main.ONOS2.links()
-        # portsJson = main.ONOS2.ports()
+        portsJson = main.ONOS2.ports()
 
         result1 = main.Mininet1.compareSwitches(
             MNTopo,
@@ -1024,8 +1201,7 @@
         result2 = main.Mininet1.compareLinks(
             MNTopo,
             json.loads( linksJson ) )
-        # result3 = main.Mininet1.comparePorts(
-        # MNTopo, json.loads( portsJson ) )
+        result3 = main.Mininet1.comparePorts( MNTopo, json.loads( portsJson ) )
 
         # result = result1 and result2 and result3
         result = result1 and result2
@@ -1052,6 +1228,11 @@
             onfail="Topology checks failed" )
 
     def CASE7( self, main ):
+        """
+            Link discovery test case. Checks if ONOS can discover a link
+            down or up properly.
+        """
+
         from sts.topology.teston_topology import TestONTopology
 
         linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
@@ -1100,8 +1281,8 @@
         main.step( "Determine the current number of switches and links" )
         topologyOutput = main.ONOS2.topology()
         topologyResult = main.ONOS1.getTopology( topologyOutput )
-        activeSwitches = topologyResult[ 'deviceCount' ]
-        links = topologyResult[ 'linkCount' ]
+        activeSwitches = topologyResult[ 'devices' ]
+        links = topologyResult[ 'links' ]
         print "activeSwitches = ", type( activeSwitches )
         print "links = ", type( links )
         main.log.info(
@@ -1164,8 +1345,7 @@
         result2 = main.Mininet1.compareLinks(
             MNTopo,
             json.loads( linksJson ) )
-        # result3 = main.Mininet1.comparePorts(
-        # MNTopo, json.loads( portsJson ) )
+        result3 = main.Mininet1.comparePorts( MNTopo, json.loads( portsJson ) )
 
         # result = result1 and result2 and result3
         result = result1 and result2
@@ -1204,9 +1384,9 @@
         main.log.info( "intent removal" )
         main.case( "Removing installed intents" )
         main.step( "Obtain the intent id's" )
-        intentResult = main.ONOS2.intents( jsonFormat=False )
-        main.log.info( "intent_result = " + intentResult )
-        intentLinewise = intentResult.split( "\n" )
+        currentIntents = main.ONOS2.intents( jsonFormat=False )
+        main.log.info( "intent_result = " + currentIntents )
+        intentLinewise = currentIntents.split( "\n" )
 
         intentList = [line for line in intentLinewise \
             if line.startswith( "id=")]
@@ -1218,30 +1398,31 @@
         main.step(
             "Iterate through the intentids list and remove each intent" )
         for id in intentids:
-            main.ONOS2.removeIntent( intentId=id )
+            main.ONOS2.removeIntent( intentId=id ,purge=True)
 
-        intentResult = main.ONOS2.intents( jsonFormat=False )
-        main.log.info( "intent_result = " + intentResult )
-        
-        intentList = [line for line in intentResult.split( "\n" ) \
+        remainingIntents = main.ONOS2.intents( jsonFormat=False )
+        main.log.info( "intent_result = " + remainingIntents )
+        if remainingIntents:
+            main.log.info( "There are still remaining intents " )
+            intentResult = main.FALSE
+        else:
+            intentResult = main.TRUE
+
+        intentList = [line for line in remainingIntents.split( "\n" ) \
             if line.startswith( "id=")]
         intentState = [line.split( "," )[ 1 ].split( "=" )[ 1 ] for line in \
             intentList]
         for state in intentState:
             print state
         
-        case8Result = main.TRUE        
+        case8Result = main.TRUE
         for state in intentState:
             if state != 'WITHDRAWN':
                 case8Result = main.FALSE
                 break
-                
-        if case8Result == main.TRUE:
-            main.log.report( "Intent removal successful" )
-        else:
-            main.log.report( "Intent removal failed" )
 
         PingResult = main.TRUE
+        """
         if case8Result == main.TRUE:
             i = 8
             while i < 18:
@@ -1258,7 +1439,7 @@
                 else:
                     main.log.info( "Unknown error" )
                     PingResult = main.ERROR
-
+        
             # Note: If the ping result failed, that means the intents have been
             # withdrawn correctly.
         if PingResult == main.TRUE:
@@ -1267,42 +1448,51 @@
             # main.exit()
         if PingResult == main.FALSE:
             main.log.report( "Installed intents have been withdrawn correctly" )
+        """
 
-        case8Result = case8Result and PingResult
-
-        if case8Result == main.FALSE:
+        if case8Result:
             main.log.report( "Intent removal successful" )
         else:
             main.log.report( "Intent removal failed" )
 
-        utilities.assert_equals( expect=main.FALSE, actual=case8Result,
+        utilities.assert_equals( expect=main.TRUE, actual=case8Result,
                                  onpass="Intent removal test passed",
                                  onfail="Intent removal test failed" )
 
     def CASE9( self ):
+        """
+            Testing Point intents
+        """
         main.log.report(
-            "This testcase adds point intents and then does pingall" )
+            "This test case adds point intents and then does pingall" )
         main.log.report( "__________________________________" )
         main.log.info( "Adding point intents" )
         main.case(
             "Adding bidirectional point for mn hosts" +
             "( h8-h18, h9-h19, h10-h20, h11-h21, h12-h22, " +
             "h13-h23, h14-h24, h15-h25, h16-h26, h17-h27 )" )
-
+        macsDict = {}
+        for i in range( 1,29 ):
+            macsDict[ 'h' + str( i ) ]= main.Mininet1.getMacAddress( host='h'+ str( i ) )
+        print macsDict
         main.step( "Add point intents for mn hosts h8 and h18 or" +
                    "ONOS hosts h8 and h12" )
         # main.step(var1)
         ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000003008/1",
-            "of:0000000000006018/1" )
+            ingressDevice="of:0000000000003008/1",
+            egressDevice="of:0000000000006018/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h8' ))
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
             # main.log.info( getIntentResult )
 
         ptpIntentResult = main.ONOS2.addPointIntent(
-            "of:0000000000006018/1",
-            "of:0000000000003008/1" )
+            ingressDevice="of:0000000000006018/1",
+            egressDevice="of:0000000000003008/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h18' ))
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1312,7 +1502,9 @@
         main.step(var2)
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003009/1",
-            "of:0000000000006019/1" )
+            "of:0000000000006019/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h9' ))
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1320,7 +1512,9 @@
 
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006019/1",
-            "of:0000000000003009/1" )
+            "of:0000000000003009/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h19' ))
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1330,7 +1524,10 @@
         main.step(var3)
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003010/1",
-            "of:0000000000006020/1" )
+            "of:0000000000006020/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h10' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1338,7 +1535,10 @@
 
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006020/1",
-            "of:0000000000003010/1" )
+            "of:0000000000003010/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h20' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1349,7 +1549,10 @@
         main.case(var4)
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003011/1",
-            "of:0000000000006021/1" )
+            "of:0000000000006021/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h11' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1357,7 +1560,10 @@
 
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006021/1",
-            "of:0000000000003011/1" )
+            "of:0000000000003011/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h21' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1368,7 +1574,10 @@
         main.case(var5)
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003012/1",
-            "of:0000000000006022/1" )
+            "of:0000000000006022/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h12' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1376,7 +1585,10 @@
 
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006022/1",
-            "of:0000000000003012/1" )
+            "of:0000000000003012/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h22' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1387,7 +1599,10 @@
         main.case(var6)
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003013/1",
-            "of:0000000000006023/1" )
+            "of:0000000000006023/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h13' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1395,7 +1610,10 @@
 
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006023/1",
-            "of:0000000000003013/1" )
+            "of:0000000000003013/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h23' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1406,7 +1624,10 @@
         main.case(var7)
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003014/1",
-            "of:0000000000006024/1" )
+            "of:0000000000006024/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h14' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1414,7 +1635,10 @@
 
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006024/1",
-            "of:0000000000003014/1" )
+            "of:0000000000003014/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h24' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1425,7 +1649,10 @@
         main.case(var8)
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003015/1",
-            "of:0000000000006025/1" )
+            "of:0000000000006025/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h15' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1433,7 +1660,10 @@
 
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006025/1",
-            "of:0000000000003015/1" )
+            "of:0000000000003015/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h25' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1444,7 +1674,10 @@
         main.case(var9)
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003016/1",
-            "of:0000000000006026/1" )
+            "of:0000000000006026/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h16' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1452,7 +1685,10 @@
 
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006026/1",
-            "of:0000000000003016/1" )
+            "of:0000000000003016/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h26' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1463,7 +1699,10 @@
         main.case(var10)
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003017/1",
-            "of:0000000000006027/1" )
+            "of:0000000000006027/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h17' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
@@ -1471,7 +1710,10 @@
 
         ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006027/1",
-            "of:0000000000003017/1" )
+            "of:0000000000003017/1",
+            ethType='IPV4',
+            ethSrc=macsDict.get( 'h27' ))
+
         if ptpIntentResult == main.TRUE:
             getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
diff --git a/TestON/tests/ProdFunc13/ProdFunc13.topo b/TestON/tests/ProdFunc13/ProdFunc13.topo
index 9cef3f7..2605b2e 100755
--- a/TestON/tests/ProdFunc13/ProdFunc13.topo
+++ b/TestON/tests/ProdFunc13/ProdFunc13.topo
@@ -49,6 +49,7 @@
                 <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
                 <arg2> --topo mytopo </arg2>
                 <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
+                <arg4> --mac </arg4>
                 <controller> remote </controller>
             </COMPONENTS>
         </Mininet1>
