Merge "Add check for Flow Duration to FUNCintent and FUNCintentRest   in order to make sure that flows aren't being overwritten   by the installed intent."
diff --git a/TestON/README.md b/TestON/README.md
index fdb9200..5335503 100644
--- a/TestON/README.md
+++ b/TestON/README.md
@@ -45,7 +45,7 @@
 
        resides into "TestON-master" directory as following:
 
-            paxterra@paxterra-desktop:~/TestON/bin$ ./cli.py
+            sdn@test-station:~/TestON/bin$ ./cli.py
             teston>run MininetTest
 
   2. TAI (Test Authoring Interface) UI based :
@@ -61,7 +61,7 @@
 --------
 For more examples, refer 'examples' directory.
 Please find the below link for examples:
-     https://github.com/Paxterra/TestON/tree/TestOn-1.0.0/examples
+     https://github.com/opennetworkinglab/OnosSystemTest/tree/master/TestON/examples
 
 
 
diff --git a/TestON/bin/.teston_completion b/TestON/bin/.teston_completion
new file mode 100644
index 0000000..766306d
--- /dev/null
+++ b/TestON/bin/.teston_completion
@@ -0,0 +1,34 @@
+_teston-cases()
+{
+    local dir=~/TestON
+    if [ ! -e $dir ]
+    then
+        echo
+        echo "ERROR: $dir does not exist"
+        return 1
+    fi
+    local cur=${COMP_WORDS[COMP_CWORD]}
+    COMPREPLY=( $(compgen -o dirnames -W "$(find $dir/tests -name "*.params" | grep -v __init | grep -v dependencies | xargs dirname | xargs -0 | tr '\n' '\0' | xargs -l -0 basename)" -- $cur) )
+    return 0
+}
+_teston()
+{
+    local dir=~/TestON
+    COMPREPLY=()
+    local cur=${COMP_WORDS[COMP_CWORD]}
+    local prev=${COMP_WORDS[COMP_CWORD-1]}
+
+    case "$prev" in
+    run)
+            _teston-cases
+            return $?;;
+    teston | */cli.py )
+            COMPREPLY=( $( compgen -W 'run' -- $cur ) )
+            return 0;;
+    esac
+    return 0
+}
+
+
+complete -F _teston "./cli.py"
+complete -F _teston "teston"
diff --git a/TestON/bin/cli.py b/TestON/bin/cli.py
index f29a8ec..13423a5 100755
--- a/TestON/bin/cli.py
+++ b/TestON/bin/cli.py
@@ -1,10 +1,11 @@
 #!/usr/bin/env python
 '''
 Created on 20-Dec-2012
+Modified 2016 by ON.Lab
 
-@author: Anil Kumar (anilkumar.s@paxterrasolutions.com)
-
-
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
     TestON is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -261,20 +262,24 @@
         '''
         options = self.initOptions(options)
         try :
-            for index, option in enumerate(args):
+            index = 0
+            while index < len( args ):
+                option = args[index]
                 if index > 0 :
-                    if re.match("logdir|mail|example|testdir|testcases|onoscell", option, flags = 0):
-                        index = index+1
-                        options[option] = args[index]
-                        options = self.testcasesInRange(index,option,args,options)
-                    elif re.match("--params", option, flags=0):
+                    if re.match("--params", option, flags=0):
                         # check if there is a params
-                        index = index + 1
-                        options['params'].append(args[index])
+                        options['params'].append(args[index+1])
+                    elif re.match("logdir|mail|example|testdir|testcases|onoscell", option, flags = 0):
+                        options[option] = args[index+1]
+                        options = self.testcasesInRange(index+1,option,args,options)
+                    index += 2
                 else :
                     options['testname'] = option
+                    index += 1
         except IndexError as e:
-            print e
+            print (e)
+            main.cleanup()
+            main.exit()
 
         return options
 
diff --git a/TestON/core/graph.py b/TestON/core/graph.py
index 936a286..e8c8a7a 100644
--- a/TestON/core/graph.py
+++ b/TestON/core/graph.py
@@ -1,4 +1,13 @@
 #!/usr/bin/env python
+"""
+Created 2016 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
+"""
+
+
 import time
 import random
 
diff --git a/TestON/core/logger.py b/TestON/core/logger.py
index 05693ba..79f7c7f 100644
--- a/TestON/core/logger.py
+++ b/TestON/core/logger.py
@@ -1,8 +1,11 @@
 #/usr/bin/env python
 '''
 Created on 07-Jan-2013
+Modified 2015 by ON.Lab
 
-@author: Raghav Kashyap(raghavkashyap@paxterrasolutions.com)
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
     TestON is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
diff --git a/TestON/core/openspeak.py b/TestON/core/openspeak.py
index 3794910..b98c68b 100644
--- a/TestON/core/openspeak.py
+++ b/TestON/core/openspeak.py
@@ -1,9 +1,11 @@
 #/usr/bin/env python
 '''
 Created on 20-Dec-2012
+Modified 2015 by ON.Lab
 
-@author: Raghav Kashyap(raghavkashyap@paxterrasolutions.com)
-
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
     TestON is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index a770490..e3b50a5 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -1,9 +1,11 @@
 #!/usr/bin/env python
 '''
 Created on 22-Oct-2012
+Modified 2016 by ON.Lab
 
-@author: Anil Kumar (anilkumar.s@paxterrasolutions.com)
-
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
     TestON is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -412,7 +414,7 @@
         argument is given.
 
         Optional Arguments:
-            result: Case insensite string. Can be 'PASS' or 'FAIL' and will set
+            result: Case insensitive string. Can be 'PASS' or 'FAIL' and will set
                     the case result accordingly.
             msg: Message to be printed when the case is skipped in the reports.
         """
@@ -949,7 +951,7 @@
             if not re.search( ".=.", param ):
                 print( "Error when parsing params: params should follow key=value format" )
                 continue
-            # Split the param string to netest keys and value
+            # Split the param string to catch nested keys and the value
             [ keys, value ] = param.split( "=" )
             # Split the nested keys according to its hierarchy
             keyList = keys.split( "/" )
diff --git a/TestON/core/testparser.py b/TestON/core/testparser.py
index aab4388..904ebc0 100644
--- a/TestON/core/testparser.py
+++ b/TestON/core/testparser.py
@@ -1,9 +1,11 @@
 #!/usr/bin/env python
 '''
 Created on 26-Dec-2012
+Modified 2015 by ON.Lab
 
-@author: Anil Kumar (anilkumar.s@paxterrasolutions.com)
-
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
     TestON is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
diff --git a/TestON/core/utilities.py b/TestON/core/utilities.py
index ce502cb..43d56dc 100644
--- a/TestON/core/utilities.py
+++ b/TestON/core/utilities.py
@@ -1,11 +1,11 @@
 #!/usr/bin/env python
 '''
 Created on 23-Oct-2012
+Modified 2015 by ON.Lab
 
-@authors: Anil Kumar (anilkumar.s@paxterrasolutions.com),
-          Raghav Kashyap(raghavkashyap@paxterrasolutions.com)
-
-
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
     TestON is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
diff --git a/TestON/core/xmldict.py b/TestON/core/xmldict.py
index 8d1dcf4..0746f3a 100644
--- a/TestON/core/xmldict.py
+++ b/TestON/core/xmldict.py
@@ -1,5 +1,10 @@
 '''
 Created on 03-Dec-2012
+Modified 2015 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
 @author: Anil Kumar (anilkumar.s@paxterrasolutions.com)
 
diff --git a/TestON/core/xmlparser.py b/TestON/core/xmlparser.py
index f12f69c..e639d57 100644
--- a/TestON/core/xmlparser.py
+++ b/TestON/core/xmlparser.py
@@ -1,6 +1,11 @@
 #/usr/bin/env python
 '''
 Created on 07-Jan-2013
+Modified 2015 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
 @author: Raghav Kashyap(raghavkashyap@paxterrasolutions.com)
 
diff --git a/TestON/drivers/common/api/controller/onosrestdriver.py b/TestON/drivers/common/api/controller/onosrestdriver.py
old mode 100644
new mode 100755
index abda81e..979b0b6
--- a/TestON/drivers/common/api/controller/onosrestdriver.py
+++ b/TestON/drivers/common/api/controller/onosrestdriver.py
@@ -1,6 +1,11 @@
 #!/usr/bin/env python
 """
 Created on 07-08-2015
+Modified 2016 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
     TestON is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -1182,6 +1187,7 @@
                  udpDst="",
                  udpSrc="",
                  mpls="",
+                 priority=100,
                  ip="DEFAULT",
                  port="DEFAULT",
                  debug=False ):
@@ -1212,7 +1218,7 @@
             of the ONOS node
         """
         try:
-            flowJson = { "priority":100,
+            flowJson = {   "priority":priority,
                            "isPermanent":"true",
                            "timeout":0,
                            "deviceId":deviceId,
diff --git a/TestON/drivers/common/api/controllerdriver.py b/TestON/drivers/common/api/controllerdriver.py
index 1c3b3b8..6cda814 100644
--- a/TestON/drivers/common/api/controllerdriver.py
+++ b/TestON/drivers/common/api/controllerdriver.py
@@ -1,6 +1,11 @@
 #!/usr/bin/env python
 """
 Created on 29-Nov-2012
+Modified 2015 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
 author:: Anil Kumar ( anilkumar.s@paxterrasolutions.com )
 
diff --git a/TestON/drivers/common/api/dockerapidriver.py b/TestON/drivers/common/api/dockerapidriver.py
index 4a874c6..10743da 100644
--- a/TestON/drivers/common/api/dockerapidriver.py
+++ b/TestON/drivers/common/api/dockerapidriver.py
@@ -1,4 +1,11 @@
 #!/usr/bin/env python
+"""
+Modified 2016 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
+"""
 
 import json
 import os
@@ -201,7 +208,7 @@
         """
         rmResult = main.TRUE
 
-        if self.dockerClient.images() is []: 
+        if self.dockerClient.images() is []:
             main.log.info( "No docker image found with RepoTags: " + image )
             return rmResult
         else:
diff --git a/TestON/drivers/common/api/fvtapidriver.py b/TestON/drivers/common/api/fvtapidriver.py
index 892eef9..f861f7d 100644
--- a/TestON/drivers/common/api/fvtapidriver.py
+++ b/TestON/drivers/common/api/fvtapidriver.py
@@ -1,6 +1,11 @@
 #!/usr/bin/env python
 """
 Created on 26-Oct-2012
+Modified 2015 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
 author:: Anil Kumar ( anilkumar.s@paxterrasolutions.com )
 
diff --git a/TestON/drivers/common/apidriver.py b/TestON/drivers/common/apidriver.py
index af66d98..166211e 100644
--- a/TestON/drivers/common/apidriver.py
+++ b/TestON/drivers/common/apidriver.py
@@ -1,6 +1,11 @@
 #!/usr/bin/env python
 """
 Created on 22-Nov-2012
+Modified 2015 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
 author:: Anil Kumar ( anilkumar.s@paxterrasolutions.com )
 
diff --git a/TestON/drivers/common/cli/dpclidriver.py b/TestON/drivers/common/cli/dpclidriver.py
index 23214b8..f3ea3e5 100644
--- a/TestON/drivers/common/cli/dpclidriver.py
+++ b/TestON/drivers/common/cli/dpclidriver.py
@@ -1,5 +1,10 @@
 """
 Driver for blank dataplane VMs. Created for SDNIP test.
+Modified 2015 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 """
 import pexpect
 from drivers.common.clidriver import CLI
diff --git a/TestON/drivers/common/cli/emulator/flowvisordriver.py b/TestON/drivers/common/cli/emulator/flowvisordriver.py
index 6ec2ee6..35c0bbf 100644
--- a/TestON/drivers/common/cli/emulator/flowvisordriver.py
+++ b/TestON/drivers/common/cli/emulator/flowvisordriver.py
@@ -1,6 +1,11 @@
 #!/usr/bin/env python
 """
 Created on 26-Mar-2013
+Modified 2015 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
 author:: Anil Kumar ( anilkumar.s@paxterrasolutions.com )
 
diff --git a/TestON/drivers/common/cli/emulator/lincoedriver.py b/TestON/drivers/common/cli/emulator/lincoedriver.py
index ae3eef9..5024f17 100644
--- a/TestON/drivers/common/cli/emulator/lincoedriver.py
+++ b/TestON/drivers/common/cli/emulator/lincoedriver.py
@@ -13,6 +13,11 @@
     shreya@onlab.us
 
 OCT 20 2014
+Modified 2015 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 """
 
 import pexpect
diff --git a/TestON/drivers/common/cli/emulator/lincoemininetdriver.py b/TestON/drivers/common/cli/emulator/lincoemininetdriver.py
index 7dfcb1e..bcdbf33 100644
--- a/TestON/drivers/common/cli/emulator/lincoemininetdriver.py
+++ b/TestON/drivers/common/cli/emulator/lincoemininetdriver.py
@@ -16,7 +16,14 @@
 
 
 LincOEMininetDriver is an extension of the mininetclidriver to handle linc oe
+
+Modified 2016 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 """
+
 import pexpect
 import re
 import sys
@@ -77,6 +84,10 @@
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":     " + self.handle.before )
             return main.FALSE
+        except Exception:
+            main.log.exception(self.name + ": Uncaught exception!")
+            main.cleanup()
+            return main.FALSE
 
     def pingHostOptical( self, **pingParams ):
         """
@@ -109,6 +120,10 @@
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
+        except Exception:
+            main.log.exception(self.name + ": Uncaught exception!")
+            main.cleanup()
+            main.exit()
         main.log.info( self.name + ": Ping Response: " + response )
         if re.search( ',\s0\%\spacket\sloss', response ):
             main.log.info( self.name + ": no packets lost, host is reachable" )
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 1632fee..ac3a9a2 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -1,9 +1,11 @@
 #!/usr/bin/env python
 """
 Created on 26-Oct-2012
+Modified 2016 by ON.Lab
 
-author: Anil Kumar ( anilkumar.s@paxterrasolutions.com )
-
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
 TestON is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -137,156 +139,180 @@
                 main.TRUE if the mininet starts successfully, main.FALSE
                 otherwise
         """
-        if self.handle:
-            # make sure old networks are cleaned up
-            main.log.info( self.name +
-                           ": Clearing any residual state or processes" )
-            self.handle.sendline( "sudo mn -c" )
-            i = self.handle.expect( [ 'password\sfor\s',
-                                      'Cleanup\scomplete',
-                                      pexpect.EOF,
-                                      pexpect.TIMEOUT ],
-                                    timeout )
-            if i == 0:
-                # Sudo asking for password
-                main.log.info( self.name + ": Sending sudo password" )
-                self.handle.sendline( self.pwd )
-                i = self.handle.expect( [ '%s:' % self.user,
-                                          '\$',
-                                          pexpect.EOF,
-                                          pexpect.TIMEOUT ],
-                                        timeout )
-            if i == 1:
-                main.log.info( self.name + ": Clean" )
-            elif i == 2:
-                main.log.error( self.name + ": Connection terminated" )
-            elif i == 3:  # timeout
-                main.log.error( self.name + ": Something while cleaning " +
-                                "Mininet took too long... " )
-            # Craft the string to start mininet
-            cmdString = "sudo "
-            if not mnCmd:
-                if topoFile is None or topoFile == '':  # If no file is given
-                    main.log.info( self.name + ": building fresh Mininet" )
-                    cmdString += "mn "
-                    if args is None or args == '':
-                        # If no args given, use args from .topo file
-                        args = self.options[ 'arg1' ] +\
-                                " " + self.options[ 'arg2' ] +\
-                                " --mac --controller " +\
-                                self.options[ 'controller' ] + " " +\
-                                self.options[ 'arg3' ]
-                    else:  # else only use given args
-                        pass
-                        # TODO: allow use of topo args and method args?
-                else:  # Use given topology file
-                    main.log.info(
-                        "Starting Mininet from topo file " +
-                        topoFile )
-                    cmdString +=  "-E python " + topoFile + " "
-                    if args is None:
-                        args = ''
-                        # TODO: allow use of args from .topo file?
-                cmdString += args
-            else:
-                main.log.info( "Starting Mininet topology using '" + mnCmd +
-                               "' command" )
-                cmdString += mnCmd
-            # Send the command and check if network started
-            self.handle.sendline( "" )
-            self.handle.expect( '\$' )
-            main.log.info( "Sending '" + cmdString + "' to " + self.name )
-            self.handle.sendline( cmdString )
-            while True:
-                i = self.handle.expect( [ 'mininet>',
-                                          'Exception',
-                                          '\*\*\*',
+        try:
+            if self.handle:
+                # make sure old networks are cleaned up
+                main.log.info( self.name +
+                               ": Clearing any residual state or processes" )
+                self.handle.sendline( "sudo mn -c" )
+                i = self.handle.expect( [ 'password\sfor\s',
+                                          'Cleanup\scomplete',
                                           pexpect.EOF,
                                           pexpect.TIMEOUT ],
                                         timeout )
                 if i == 0:
-                    main.log.info( self.name + ": Mininet built" )
-                    return main.TRUE
-                elif i == 1:
-                    response = str( self.handle.before +
-                                    self.handle.after )
-                    self.handle.expect( '\$' )
-                    response += str( self.handle.before +
-                                     self.handle.after )
-                    main.log.error(
-                        self.name +
-                        ": Launching Mininet failed: " + response )
-                    return main.FALSE
+                    # Sudo asking for password
+                    main.log.info( self.name + ": Sending sudo password" )
+                    self.handle.sendline( self.pwd )
+                    i = self.handle.expect( [ '%s:' % self.user,
+                                              '\$',
+                                              pexpect.EOF,
+                                              pexpect.TIMEOUT ],
+                                            timeout )
+                if i == 1:
+                    main.log.info( self.name + ": Clean" )
                 elif i == 2:
-                    self.handle.expect( [ "\n",
-                                          pexpect.EOF,
-                                          pexpect.TIMEOUT ],
-                                        timeout )
-                    main.log.info( self.handle.before )
-                elif i == 3:
-                    main.log.error( self.name + ": Connection timeout" )
-                    return main.FALSE
-                elif i == 4:  # timeout
-                    main.log.error(
-                        self.name +
-                        ": Something took too long... " )
-                    return main.FALSE
-            # Why did we hit this part?
-            main.log.error( "startNet did not return correctly" )
-            return main.FASLE
-        else:  # if no handle
-            main.log.error( self.name + ": Connection failed to the host " +
-                            self.user_name + "@" + self.ip_address )
-            main.log.error( self.name + ": Failed to connect to the Mininet" )
+                    main.log.error( self.name + ": Connection terminated" )
+                elif i == 3:  # timeout
+                    main.log.error( self.name + ": Something while cleaning " +
+                                    "Mininet took too long... " )
+                # Craft the string to start mininet
+                cmdString = "sudo "
+                if not mnCmd:
+                    if topoFile is None or topoFile == '':  # If no file is given
+                        main.log.info( self.name + ": building fresh Mininet" )
+                        cmdString += "mn "
+                        if args is None or args == '':
+                            # If no args given, use args from .topo file
+                            args = self.options[ 'arg1' ] +\
+                                    " " + self.options[ 'arg2' ] +\
+                                    " --mac --controller " +\
+                                    self.options[ 'controller' ] + " " +\
+                                    self.options[ 'arg3' ]
+                        else:  # else only use given args
+                            pass
+                            # TODO: allow use of topo args and method args?
+                    else:  # Use given topology file
+                        main.log.info(
+                            "Starting Mininet from topo file " +
+                            topoFile )
+                        cmdString +=  "-E python " + topoFile + " "
+                        if args is None:
+                            args = ''
+                            # TODO: allow use of args from .topo file?
+                    cmdString += args
+                else:
+                    main.log.info( "Starting Mininet topology using '" + mnCmd +
+                                   "' command" )
+                    cmdString += mnCmd
+                # Send the command and check if network started
+                self.handle.sendline( "" )
+                self.handle.expect( '\$' )
+                main.log.info( "Sending '" + cmdString + "' to " + self.name )
+                self.handle.sendline( cmdString )
+                while True:
+                    i = self.handle.expect( [ 'mininet>',
+                                              'Exception',
+                                              '\*\*\*',
+                                              pexpect.EOF,
+                                              pexpect.TIMEOUT ],
+                                            timeout )
+                    if i == 0:
+                        main.log.info( self.name + ": Mininet built" )
+                        return main.TRUE
+                    elif i == 1:
+                        response = str( self.handle.before +
+                                        self.handle.after )
+                        self.handle.expect( '\$' )
+                        response += str( self.handle.before +
+                                         self.handle.after )
+                        main.log.error(
+                            self.name +
+                            ": Launching Mininet failed: " + response )
+                        return main.FALSE
+                    elif i == 2:
+                        self.handle.expect( [ "\n",
+                                              pexpect.EOF,
+                                              pexpect.TIMEOUT ],
+                                            timeout )
+                        main.log.info( self.handle.before )
+                    elif i == 3:
+                        main.log.error( self.name + ": Connection timeout" )
+                        return main.FALSE
+                    elif i == 4:  # timeout
+                        main.log.error(
+                            self.name +
+                            ": Something took too long... " )
+                        return main.FALSE
+                # Why did we hit this part?
+                main.log.error( "startNet did not return correctly" )
+                return main.FASLE
+            else:  # if no handle
+                main.log.error( self.name + ": Connection failed to the host " +
+                                self.user_name + "@" + self.ip_address )
+                main.log.error( self.name + ": Failed to connect to the Mininet" )
+                return main.FALSE
+        except pexpect.TIMEOUT:
+            main.log.exception( self.name + ": TIMEOUT exception found while starting Mininet" )
+            main.log.error( self.name + ":    " + self.handle.before )
             return main.FALSE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def numSwitchesNlinks( self, topoType, depth, fanout ):
-        if topoType == 'tree':
-            # In tree topology, if fanout arg is not given, by default it is 2
-            if fanout is None:
-                fanout = 2
-            k = 0
-            count = 0
-            while( k <= depth - 1 ):
-                count = count + pow( fanout, k )
-                k = k + 1
-                numSwitches = count
-            while( k <= depth - 2 ):
-                # depth-2 gives you only core links and not considering
-                # edge links as seen by ONOS. If all the links including
-                # edge links are required, do depth-1
-                count = count + pow( fanout, k )
-                k = k + 1
-            numLinks = count * fanout
-            # print "num_switches for %s(%d,%d) = %d and links=%d" %(
-            # topoType,depth,fanout,numSwitches,numLinks )
+        try:
+            if topoType == 'tree':
+                # In tree topology, if fanout arg is not given, by default it is 2
+                if fanout is None:
+                    fanout = 2
+                k = 0
+                count = 0
+                while( k <= depth - 1 ):
+                    count = count + pow( fanout, k )
+                    k = k + 1
+                    numSwitches = count
+                while( k <= depth - 2 ):
+                    # depth-2 gives you only core links and not considering
+                    # edge links as seen by ONOS. If all the links including
+                    # edge links are required, do depth-1
+                    count = count + pow( fanout, k )
+                    k = k + 1
+                numLinks = count * fanout
+                # print "num_switches for %s(%d,%d) = %d and links=%d" %(
+                # topoType,depth,fanout,numSwitches,numLinks )
 
-        elif topoType == 'linear':
-            # In linear topology, if fanout or numHostsPerSw is not given,
-            # by default it is 1
-            if fanout is None:
-                fanout = 1
-            numSwitches = depth
-            numHostsPerSw = fanout
-            totalNumHosts = numSwitches * numHostsPerSw
-            numLinks = totalNumHosts + ( numSwitches - 1 )
-            print "num_switches for %s(%d,%d) = %d and links=%d" %\
-                ( topoType, depth, fanout, numSwitches, numLinks )
-        topoDict = { "num_switches": int( numSwitches ),
-                     "num_corelinks": int( numLinks ) }
-        return topoDict
+            elif topoType == 'linear':
+                # In linear topology, if fanout or numHostsPerSw is not given,
+                # by default it is 1
+                if fanout is None:
+                    fanout = 1
+                numSwitches = depth
+                numHostsPerSw = fanout
+                totalNumHosts = numSwitches * numHostsPerSw
+                numLinks = totalNumHosts + ( numSwitches - 1 )
+                print "num_switches for %s(%d,%d) = %d and links=%d" %\
+                    ( topoType, depth, fanout, numSwitches, numLinks )
+            topoDict = { "num_switches": int( numSwitches ),
+                         "num_corelinks": int( numLinks ) }
+            return topoDict
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def calculateSwAndLinks( self ):
         """
             Calculate the number of switches and links in a topo."""
         # TODO: combine this function and numSwitchesNlinks
-        argList = self.options[ 'arg1' ].split( "," )
-        topoArgList = argList[ 0 ].split( " " )
-        argList = map( int, argList[ 1: ] )
-        topoArgList = topoArgList[ 1: ] + argList
+        try:
+            argList = self.options[ 'arg1' ].split( "," )
+            topoArgList = argList[ 0 ].split( " " )
+            argList = map( int, argList[ 1: ] )
+            topoArgList = topoArgList[ 1: ] + argList
 
-        topoDict = self.numSwitchesNlinks( *topoArgList )
-        return topoDict
+            topoDict = self.numSwitchesNlinks( *topoArgList )
+            return topoDict
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def pingall( self, protocol="IPv4", timeout=300, shortCircuit=False, acceptableFailed=0 ):
         """
@@ -394,23 +420,29 @@
         """
            Uses the fping package for faster pinging...
            *requires fping to be installed on machine running mininet"""
-        args = utilities.parse_args( [ "SRC", "TARGET" ], **pingParams )
-        command = args[ "SRC" ] + \
-            " fping -i 100 -t 20 -C 1 -q " + args[ "TARGET" ]
-        self.handle.sendline( command )
-        self.handle.expect(
-            [ args[ "TARGET" ], pexpect.EOF, pexpect.TIMEOUT ] )
-        self.handle.expect( [ "mininet", pexpect.EOF, pexpect.TIMEOUT ] )
-        response = self.handle.before
-        if re.search( ":\s-", response ):
-            main.log.info( self.name + ": Ping fail" )
+        try:
+            args = utilities.parse_args( [ "SRC", "TARGET" ], **pingParams )
+            command = args[ "SRC" ] + \
+                " fping -i 100 -t 20 -C 1 -q " + args[ "TARGET" ]
+            self.handle.sendline( command )
+            self.handle.expect(
+                [ args[ "TARGET" ], pexpect.EOF, pexpect.TIMEOUT ] )
+            self.handle.expect( [ "mininet", pexpect.EOF, pexpect.TIMEOUT ] )
+            response = self.handle.before
+            if re.search( ":\s-", response ):
+                main.log.info( self.name + ": Ping fail" )
+                return main.FALSE
+            elif re.search( ":\s\d{1,2}\.\d\d", response ):
+                main.log.info( self.name + ": Ping good!" )
+                return main.TRUE
+            main.log.info( self.name + ": Install fping on mininet machine... " )
+            main.log.info( self.name + ": \n---\n" + response )
             return main.FALSE
-        elif re.search( ":\s\d{1,2}\.\d\d", response ):
-            main.log.info( self.name + ": Ping good!" )
-            return main.TRUE
-        main.log.info( self.name + ": Install fping on mininet machine... " )
-        main.log.info( self.name + ": \n---\n" + response )
-        return main.FALSE
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
 
     def pingallHosts( self, hostList, wait=1 ):
         """
@@ -676,34 +708,39 @@
     def checkIP( self, host ):
         """
            Verifies the host's ip configured or not."""
-        if self.handle:
-            try:
-                response = self.execute(
-                    cmd=host +
-                    " ifconfig",
-                    prompt="mininet>",
-                    timeout=10 )
-            except pexpect.EOF:
-                main.log.error( self.name + ": EOF exception found" )
-                main.log.error( self.name + ":     " + self.handle.before )
-                main.cleanup()
-                main.exit()
+        try:
+            if self.handle:
+                try:
+                    response = self.execute(
+                        cmd=host +
+                        " ifconfig",
+                        prompt="mininet>",
+                        timeout=10 )
+                except pexpect.EOF:
+                    main.log.error( self.name + ": EOF exception found" )
+                    main.log.error( self.name + ":     " + self.handle.before )
+                    main.cleanup()
+                    main.exit()
 
-            pattern = "inet\s(addr|Mask):([0-1]{1}[0-9]{1,2}|" +\
-                "2[0-4][0-9]|25[0-5]|[0-9]{1,2}).([0-1]{1}" +\
-                "[0-9]{1,2}|2[0-4][0-9]|25[0-5]|[0-9]{1,2})." +\
-                "([0-1]{1}[0-9]{1,2}|2[0-4][0-9]|25[0-5]|" +\
-                "[0-9]{1,2}).([0-1]{1}[0-9]{1,2}|2[0-4]" +\
-                "[0-9]|25[0-5]|[0-9]{1,2})"
-            # pattern = "inet addr:10.0.0.6"
-            if re.search( pattern, response ):
-                main.log.info( self.name + ": Host Ip configured properly" )
-                return main.TRUE
+                pattern = "inet\s(addr|Mask):([0-1]{1}[0-9]{1,2}|" +\
+                    "2[0-4][0-9]|25[0-5]|[0-9]{1,2}).([0-1]{1}" +\
+                    "[0-9]{1,2}|2[0-4][0-9]|25[0-5]|[0-9]{1,2})." +\
+                    "([0-1]{1}[0-9]{1,2}|2[0-4][0-9]|25[0-5]|" +\
+                    "[0-9]{1,2}).([0-1]{1}[0-9]{1,2}|2[0-4]" +\
+                    "[0-9]|25[0-5]|[0-9]{1,2})"
+                # pattern = "inet addr:10.0.0.6"
+                if re.search( pattern, response ):
+                    main.log.info( self.name + ": Host Ip configured properly" )
+                    return main.TRUE
+                else:
+                    main.log.error( self.name + ": Host IP not found" )
+                    return main.FALSE
             else:
-                main.log.error( self.name + ": Host IP not found" )
-                return main.FALSE
-        else:
-            main.log.error( self.name + ": Connection failed to the host" )
+                main.log.error( self.name + ": Connection failed to the host" )
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def verifySSH( self, **connectargs ):
         # FIXME: Who uses this and what is the purpose? seems very specific
@@ -735,7 +772,7 @@
         else:
             return main.TRUE
 
-    def moveHost( self, host, oldSw, newSw, ):
+    def moveHost( self, host, oldSw, newSw ):
         """
            Moves a host from one switch to another on the fly
            Note: The intf between host and oldSw when detached
@@ -823,12 +860,21 @@
                 print "ifconfig o/p = ", self.handle.before
 
                 return main.TRUE
+
+            except pexpect.TIMEOUT:
+                main.log.error(self.name + ": TIMEOUT exception found")
+                main.log.error(self.name + ":     " + self.handle.before)
+                main.cleanup()
+                main.exit()
             except pexpect.EOF:
                 main.log.error( self.name + ": EOF exception found" )
                 main.log.error( self.name + ":     " + self.handle.before )
                 return main.FALSE
+            except Exception:
+                main.log.exception( self.name + ": Uncaught exception!" )
+                return main.FALSE
 
-    def moveHostv6( self, host, oldSw, newSw, ):
+    def moveHostv6( self, host, oldSw, newSw ):
         """
            Moves a host from one switch to another on the fly
            Note: The intf between host and oldSw when detached
@@ -930,10 +976,18 @@
                 print "ifconfig o/p = ", self.handle.before
 
                 return main.TRUE
+            except pexpect.TIMEOUT:
+                main.log.error(self.name + ": TIMEOUT exception found")
+                main.log.error(self.name + ":     " + self.handle.before)
+                main.cleanup()
+                main.exit()
             except pexpect.EOF:
                 main.log.error( self.name + ": EOF exception found" )
                 main.log.error( self.name + ":     " + self.handle.before )
                 return main.FALSE
+            except Exception:
+                main.log.exception( self.name + ": Uncaught exception!" )
+                return main.FALSE
 
     def changeIP( self, host, intf, newIP, newNetmask ):
         """
@@ -953,10 +1007,19 @@
                     " changed to new IP " +
                     newIP )
                 return main.TRUE
+            except pexpect.TIMEOUT:
+                main.log.error(self.name + ": TIMEOUT exception found")
+                main.log.error(self.name + ":     " + self.handle.before)
+                main.cleanup()
+                main.exit()
             except pexpect.EOF:
                 main.log.error( self.name + ": EOF exception found" )
                 main.log.error( self.name + ":     " + self.handle.before )
                 return main.FALSE
+            except Exception:
+                main.log.exception( self.name + ": Uncaught exception!" )
+                main.cleanup()
+                main.exit()
 
     def changeDefaultGateway( self, host, newGW ):
         """
@@ -975,10 +1038,19 @@
                     " changed to " +
                     newGW )
                 return main.TRUE
+            except pexpect.TIMEOUT:
+                main.log.error(self.name + ": TIMEOUT exception found")
+                main.log.error(self.name + ":     " + self.handle.before)
+                main.cleanup()
+                main.exit()
             except pexpect.EOF:
                 main.log.error( self.name + ": EOF exception found" )
                 main.log.error( self.name + ":     " + self.handle.before )
                 return main.FALSE
+            except Exception:
+                main.log.exception( self.name + ": Uncaught exception!" )
+                main.cleanup()
+                main.exit()
 
     def addStaticMACAddress( self, host, GW, macaddr ):
         """
@@ -997,10 +1069,19 @@
                     " changed to " +
                     macaddr )
                 return main.TRUE
+            except pexpect.TIMEOUT:
+                main.log.error(self.name + ": TIMEOUT exception found")
+                main.log.error(self.name + ":     " + self.handle.before)
+                main.cleanup()
+                main.exit()
             except pexpect.EOF:
                 main.log.error( self.name + ": EOF exception found" )
                 main.log.error( self.name + ":     " + self.handle.before )
                 return main.FALSE
+            except Exception:
+                main.log.exception( self.name + ": Uncaught exception!" )
+                main.cleanup()
+                main.exit()
 
     def verifyStaticGWandMAC( self, host ):
         """
@@ -1014,10 +1095,19 @@
                 response = self.handle.before
                 main.log.info( host + " arp -an = " + response )
                 return main.TRUE
+            except pexpect.TIMEOUT:
+                main.log.error(self.name + ": TIMEOUT exception found")
+                main.log.error(self.name + ":     " + self.handle.before)
+                main.cleanup()
+                main.exit()
             except pexpect.EOF:
                 main.log.error( self.name + ": EOF exception found" )
                 main.log.error( self.name + ":     " + self.handle.before )
                 return main.FALSE
+            except Exception:
+                main.log.exception( self.name + ": Uncaught exception!" )
+                main.cleanup()
+                main.exit()
 
     def getMacAddress( self, host ):
         """
@@ -1034,6 +1124,10 @@
                 main.log.error( self.name + ":     " + self.handle.before )
                 main.cleanup()
                 main.exit()
+            except Exception:
+                main.log.exception( self.name + ": Uncaught exception!" )
+                main.cleanup()
+                main.exit()
 
             pattern = r'HWaddr\s([0-9A-F]{2}[:-]){5}([0-9A-F]{2})'
             macAddressSearch = re.search( pattern, response, re.I )
@@ -1060,6 +1154,10 @@
                 main.log.error( self.name + ":     " + self.handle.before )
                 main.cleanup()
                 main.exit()
+            except Exception:
+                main.log.exception( self.name + ": Uncaught exception!" )
+                main.cleanup()
+                main.exit()
 
             pattern = r'HWaddr\s([0-9A-F]{2}[:-]){5}([0-9A-F]{2})'
             macAddressSearch = re.search( pattern, response, re.I )
@@ -1093,6 +1191,10 @@
                 main.log.error( self.name + ":     " + self.handle.before )
                 main.cleanup()
                 main.exit()
+            except Exception:
+                main.log.exception( self.name + ": Uncaught exception!" )
+                main.cleanup()
+                main.exit()
 
             pattern = ''
             if proto == 'IPV4':
@@ -1125,6 +1227,10 @@
                 main.log.error( self.name + ":     " + self.handle.before )
                 main.cleanup()
                 main.exit()
+            except Exception:
+                main.log.exception( self.name + ": Uncaught exception!" )
+                main.cleanup()
+                main.exit()
             pattern = r'^(?P<dpid>\w)+'
             result = re.search( pattern, response, re.MULTILINE )
             if result is None:
@@ -1149,11 +1255,20 @@
                 self.handle.expect( "mininet>" )
                 response = self.handle.before
                 return response
+            except pexpect.TIMEOUT:
+                main.log.error(self.name + ": TIMEOUT exception found")
+                main.log.error(self.name + ":     " + self.handle.before)
+                main.cleanup()
+                main.exit()
             except pexpect.EOF:
                 main.log.error( self.name + ": EOF exception found" )
                 main.log.error( self.name + ":     " + self.handle.before )
                 main.cleanup()
                 main.exit()
+            except Exception:
+                main.log.exception( self.name + ": Uncaught exception!" )
+                main.cleanup()
+                main.exit()
 
     def getInterfaces( self, node ):
         """
@@ -1172,6 +1287,10 @@
                 main.log.error( self.name + ":     " + self.handle.before )
                 main.cleanup()
                 main.exit()
+            except Exception:
+                main.log.exception( self.name + ": Uncaught exception!" )
+                main.cleanup()
+                main.exit()
             return response
         else:
             main.log.error( "Connection failed to the node" )
@@ -1188,6 +1307,10 @@
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
         return response
 
     def intfs( self ):
@@ -1202,6 +1325,10 @@
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
         return response
 
     def net( self ):
@@ -1213,6 +1340,10 @@
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
         return response
 
     def links( self, timeout=20 ):
@@ -1225,6 +1356,10 @@
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
         return response
 
     def iperftcpAll(self, hosts, timeout=6):
@@ -1235,11 +1370,16 @@
             timeout: The defualt timeout is 6 sec to allow enough time for a successful test to complete,
              and short enough to stop an unsuccessful test from quiting and cleaning up mininet.
         '''
-        for host1 in hosts:
-            for host2 in hosts:
-                if host1 != host2:
-                    if self.iperftcp(host1, host2, timeout) == main.FALSE:
-                        main.log.error(self.name + ": iperftcp test failed for " + host1 + " and " + host2)
+        try:
+            for host1 in hosts:
+                for host2 in hosts:
+                    if host1 != host2:
+                        if self.iperftcp(host1, host2, timeout) == main.FALSE:
+                            main.log.error(self.name + ": iperftcp test failed for " + host1 + " and " + host2)
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def iperftcp(self, host1="h1", host2="h2", timeout=6):
         '''
@@ -1298,6 +1438,10 @@
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def iperftcpipv6(self, host1="h1", host2="h2", timeout=50):
         main.log.info( self.name + ": Simple iperf TCP test between two hosts" )
@@ -1331,6 +1475,10 @@
             main.log.error( self.name + ": " + self.handle.before )
             main.cleanup()
             main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def iperfudpAll(self, hosts, bandwidth="10M"):
         '''
@@ -1340,11 +1488,19 @@
         @param:
             bandwidth: the targeted bandwidth, in megabits ('M')
         '''
-        for host1 in hosts:
-            for host2 in hosts:
-                if host1 != host2:
-                    if self.iperfudp(host1, host2, bandwidth) == main.FALSE:
-                        main.log.error(self.name + ": iperfudp test failed for " + host1 + " and " + host2)
+        try:
+            for host1 in hosts:
+                for host2 in hosts:
+                    if host1 != host2:
+                        if self.iperfudp(host1, host2, bandwidth) == main.FALSE:
+                            main.log.error(self.name + ": iperfudp test failed for " + host1 + " and " + host2)
+        except TypeError:
+            main.log.exception(self.name + ": Object not as expected")
+            return main.FALSE
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def iperfudp( self, bandwidth="10M", host1="h1", host2="h2"):
 
@@ -1393,11 +1549,20 @@
                     main.log.error(self.name + ": invalid iperfudp results")
                     return main.FALSE
 
+        except pexpect.TIMEOUT:
+            main.log.error(self.name + ": TIMEOUT exception found")
+            main.log.error(self.name + ":     " + self.handle.before)
+            main.cleanup()
+            main.exit()
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def nodes( self ):
         main.log.info( self.name + ": List all nodes." )
@@ -1411,6 +1576,10 @@
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
         return response
 
     def pingpair( self ):
@@ -1425,6 +1594,10 @@
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
         if re.search( ',\s0\%\spacket\sloss', response ):
             main.log.info( self.name + ": Ping between two hosts SUCCESSFUL" )
@@ -1476,7 +1649,8 @@
             self.handle.sendline( command )
             self.handle.expect( "mininet>" )
         except pexpect.TIMEOUT:
-            main.log.error( self.name + ": pexpect.TIMEOUT found" )
+            main.log.error(self.name + ": TIMEOUT exception found")
+            main.log.error(self.name + ":     " + self.handle.before)
             main.cleanup()
             main.exit()
         except pexpect.EOF:
@@ -1505,10 +1679,6 @@
             if re.search( "Permission denied", response ):
                 main.log.warn( response )
                 return main.FALSE
-        except pexpect.TIMEOUT:
-            main.log.error( self.name + ": pexpect.TIMEOUT found" )
-            main.cleanup()
-            main.exit()
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":     " + self.handle.before )
@@ -1536,6 +1706,10 @@
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
         return main.TRUE
 
     def plug( self, **plugargs ):
@@ -1556,6 +1730,10 @@
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
         return main.TRUE
 
     def dpctl( self, **dpctlargs ):
@@ -1576,19 +1754,28 @@
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
         return main.TRUE
 
     def getVersion( self ):
         # FIXME: What uses this? This should be refactored to get
         #       version from MN and not some other file
-        fileInput = path + '/lib/Mininet/INSTALL'
-        version = super( Mininet, self ).getVersion()
-        pattern = 'Mininet\s\w\.\w\.\w\w*'
-        for line in open( fileInput, 'r' ).readlines():
-            result = re.match( pattern, line )
-            if result:
-                version = result.group( 0 )
-        return version
+        try:
+            fileInput = path + '/lib/Mininet/INSTALL'
+            version = super( Mininet, self ).getVersion()
+            pattern = 'Mininet\s\w\.\w\.\w\w*'
+            for line in open( fileInput, 'r' ).readlines():
+                result = re.match( pattern, line )
+                if result:
+                    version = result.group( 0 )
+            return version
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def getSwController( self, sw ):
         """
@@ -1612,6 +1799,10 @@
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def assignSwController( self, sw, ip, port="6653", ptcp="" ):
         """
@@ -1740,6 +1931,11 @@
                     main.cleanup()
                     main.exit()
             return main.TRUE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanup()
@@ -1759,6 +1955,10 @@
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
         else:
             main.log.info( response )
 
@@ -1797,6 +1997,10 @@
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def delSwitch( self, sw ):
         """
@@ -1828,6 +2032,10 @@
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def getSwitchRandom( self, timeout=60, nonCut=True ):
         """
@@ -1927,6 +2135,10 @@
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def delLink( self, node1, node2 ):
         """
@@ -1936,7 +2148,8 @@
            required params:
            node1 = the string node name of the first endpoint of the link
            node2 = the string node name of the second endpoint of the link
-           returns: main.FALSE on an error, else main.TRUE"""
+           returns: main.FALSE on an error, else main.TRUE
+        """
         command = "dellink " + str( node1 ) + " " + str( node2 )
         try:
             response = self.execute(
@@ -1959,6 +2172,10 @@
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def getLinkRandom( self, timeout=60, nonCut=True ):
         """
@@ -2067,6 +2284,10 @@
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def delHost( self, hostname ):
         """
@@ -2099,28 +2320,42 @@
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def disconnect( self ):
         """
         Called at the end of the test to stop the mininet and
         disconnect the handle.
         """
-        self.handle.sendline( '' )
-        i = self.handle.expect( [ 'mininet>', pexpect.EOF, pexpect.TIMEOUT ],
-                                timeout=2 )
-        response = main.TRUE
-        if i == 0:
-            response = self.stopNet()
-        elif i == 1:
-            return main.TRUE
-        # print "Disconnecting Mininet"
-        if self.handle:
-            self.handle.sendline( "exit" )
-            self.handle.expect( "exit" )
-            self.handle.expect( "(.*)" )
-        else:
-            main.log.error( "Connection failed to the host" )
-        return response
+        try:
+            self.handle.sendline( '' )
+            i = self.handle.expect( [ 'mininet>', pexpect.EOF, pexpect.TIMEOUT ],
+                                    timeout=2 )
+            response = main.TRUE
+            if i == 0:
+                response = self.stopNet()
+            elif i == 1:
+                return main.TRUE
+            # print "Disconnecting Mininet"
+            if self.handle:
+                self.handle.sendline( "exit" )
+                self.handle.expect( "exit" )
+                self.handle.expect( "(.*)" )
+            else:
+                main.log.error( "Connection failed to the host" )
+            return response
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def stopNet( self, fileName="", timeout=5 ):
         """
@@ -2166,11 +2401,20 @@
                         "sudo kill -9 \`ps -ef | grep \"" +
                         fileName +
                         "\" | grep -v grep | awk '{print $2}'\`" )
+            except pexpect.TIMEOUT:
+                main.log.error(self.name + ": TIMEOUT exception found")
+                main.log.error(self.name + ":     " + self.handle.before)
+                main.cleanup()
+                main.exit()
             except pexpect.EOF:
                 main.log.error( self.name + ": EOF exception found" )
                 main.log.error( self.name + ":     " + self.handle.before )
                 main.cleanup()
                 main.exit()
+            except Exception:
+                main.log.exception( self.name + ": Uncaught exception!" )
+                main.cleanup()
+                main.exit()
         else:
             main.log.error( self.name + ": Connection failed to the host" )
             response = main.FALSE
@@ -2215,6 +2459,10 @@
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def decToHex( self, num ):
         return hex( num ).split( 'x' )[ 1 ]
@@ -2234,6 +2482,10 @@
                 main.log.error( self.name + "     " + self.handle.before )
                 main.cleanup()
                 main.exit()
+            except Exception:
+                main.log.exception( self.name + ": Uncaught exception!" )
+                main.cleanup()
+                main.exit()
             pattern = "flow_count=(\d+)"
             result = re.search( pattern, response, re.MULTILINE )
             if result is None:
@@ -2262,6 +2514,10 @@
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def flowTableComp( self, flowTable1, flowTable2 ):
         # This function compares the selctors and treatments of each flow
@@ -2381,6 +2637,11 @@
         except IndexError:
             main.log.exception( self.name + ": IndexError found" )
             return None
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanup()
@@ -2429,9 +2690,6 @@
 
             return self.parseFlowTable( flows, version, debug )
 
-        except pexpect.TIMEOUT:
-            main.log.exception( self.name + ": Command timed out" )
-            return None
         except pexpect.EOF:
             main.log.exception( self.name + ": connection closed." )
             main.cleanup()
@@ -2487,6 +2745,11 @@
 
             return main.TRUE if result else main.FALSE
 
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanup()
@@ -2558,6 +2821,11 @@
             self.handle.expect( "mininet>" )
             self.handle.sendline( "" )
             self.handle.expect( "mininet>" )
+        except pexpect.TIMEOUT:
+            main.log.error(self.name + ": TIMEOUT exception found")
+            main.log.error(self.name + ":     " + self.handle.before)
+            main.cleanup()
+            main.exit()
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":     " + self.handle.before )
@@ -2575,43 +2843,53 @@
         Returns a json structure containing information about the
         ports of the given switch.
         """
-        response = self.getInterfaces( nodeName )
-        # TODO: Sanity check on response. log if no such switch exists
-        ports = []
-        for line in response.split( "\n" ):
-            if not line.startswith( "name=" ):
-                continue
-            portVars = {}
-            for var in line.split( "," ):
-                key, value = var.split( "=" )
-                portVars[ key ] = value
-            isUp = portVars.pop( 'enabled', "True" )
-            isUp = "True" in isUp
-            if verbose:
-                main.log.info( "Reading switch port %s(%s)" %
-                               ( portVars[ 'name' ], portVars[ 'mac' ] ) )
-            mac = portVars[ 'mac' ]
-            if mac == 'None':
-                mac = None
-            ips = []
-            ip = portVars[ 'ip' ]
-            if ip == 'None':
-                ip = None
-            ips.append( ip )
-            name = portVars[ 'name' ]
-            if name == 'None':
-                name = None
-            portRe = r'[^\-]\d\-eth(?P<port>\d+)'
-            if name == 'lo':
-                portNo = 0xfffe  # TODO: 1.0 value - Should we just return lo?
-            else:
-                portNo = re.search( portRe, name ).group( 'port' )
-            ports.append( { 'of_port': portNo,
-                            'mac': str( mac ).replace( '\'', '' ),
-                            'name': name,
-                            'ips': ips,
-                            'enabled': isUp } )
-        return ports
+        try:
+            response = self.getInterfaces( nodeName )
+            # TODO: Sanity check on response. log if no such switch exists
+            ports = []
+            for line in response.split( "\n" ):
+                if not line.startswith( "name=" ):
+                    continue
+                portVars = {}
+                for var in line.split( "," ):
+                    key, value = var.split( "=" )
+                    portVars[ key ] = value
+                isUp = portVars.pop( 'enabled', "True" )
+                isUp = "True" in isUp
+                if verbose:
+                    main.log.info( "Reading switch port %s(%s)" %
+                                   ( portVars[ 'name' ], portVars[ 'mac' ] ) )
+                mac = portVars[ 'mac' ]
+                if mac == 'None':
+                    mac = None
+                ips = []
+                ip = portVars[ 'ip' ]
+                if ip == 'None':
+                    ip = None
+                ips.append( ip )
+                name = portVars[ 'name' ]
+                if name == 'None':
+                    name = None
+                portRe = r'[^\-]\d\-eth(?P<port>\d+)'
+                if name == 'lo':
+                    portNo = 0xfffe  # TODO: 1.0 value - Should we just return lo?
+                else:
+                    portNo = re.search( portRe, name ).group( 'port' )
+                ports.append( { 'of_port': portNo,
+                                'mac': str( mac ).replace( '\'', '' ),
+                                'name': name,
+                                'ips': ips,
+                                'enabled': isUp } )
+            return ports
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def getOVSPorts( self, nodeName ):
         """
@@ -2672,33 +2950,43 @@
         # <OVSSwitchNS s1: lo:127.0.0.1,s1-eth1:None,s1-eth2:None,s1-eth3:None pid=22550>
         # <OVSBridge s1: lo:127.0.0.1,s1-eth1:None,s1-eth2:None pid=26830>
         # <UserSwitch s1: lo:127.0.0.1,s1-eth1:None,s1-eth2:None pid=14737>
-        switchClasses = r"(OVSSwitch)|(OVSBridge)|(OVSSwitchNS)|(IVSSwitch)|(LinuxBridge)|(UserSwitch)"
-        swRE = r"<(?P<class>" + switchClasses + r")" +\
-               r"(?P<options>\{.*\})?\s" +\
-               r"(?P<name>[^:]+)\:\s" +\
-               r"(?P<ports>([^,]+,)*[^,\s]+)" +\
-               r"\spid=(?P<pid>(\d)+)"
-        # Update mn port info
-        self.update()
-        output = {}
-        dump = self.dump().split( "\n" )
-        for line in dump:
-            result = re.search( swRE, line, re.I )
-            if result:
-                name = result.group( 'name' )
-                dpid = str( self.getSwitchDPID( name ) ).zfill( 16 )
-                pid = result.group( 'pid' )
-                swClass = result.group( 'class' )
-                options = result.group( 'options' )
-                if verbose:
-                    main.log.info( "Reading switch %s(%s)" % ( name, dpid ) )
-                ports = self.getPorts( name )
-                output[ name ] = { "dpid": dpid,
-                                   "ports": ports,
-                                   "swClass": swClass,
-                                   "pid": pid,
-                                   "options": options }
-        return output
+        try:
+            switchClasses = r"(OVSSwitch)|(OVSBridge)|(OVSSwitchNS)|(IVSSwitch)|(LinuxBridge)|(UserSwitch)"
+            swRE = r"<(?P<class>" + switchClasses + r")" +\
+                   r"(?P<options>\{.*\})?\s" +\
+                   r"(?P<name>[^:]+)\:\s" +\
+                   r"(?P<ports>([^,]+,)*[^,\s]+)" +\
+                   r"\spid=(?P<pid>(\d)+)"
+            # Update mn port info
+            self.update()
+            output = {}
+            dump = self.dump().split( "\n" )
+            for line in dump:
+                result = re.search( swRE, line, re.I )
+                if result:
+                    name = result.group( 'name' )
+                    dpid = str( self.getSwitchDPID( name ) ).zfill( 16 )
+                    pid = result.group( 'pid' )
+                    swClass = result.group( 'class' )
+                    options = result.group( 'options' )
+                    if verbose:
+                        main.log.info( "Reading switch %s(%s)" % ( name, dpid ) )
+                    ports = self.getPorts( name )
+                    output[ name ] = { "dpid": dpid,
+                                       "ports": ports,
+                                       "swClass": swClass,
+                                       "pid": pid,
+                                       "options": options }
+            return output
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def getHosts( self, verbose=False ):
         """
@@ -2716,50 +3004,60 @@
         # NOTE: Does not correctly match hosts with multi-links
         #       <Host h2: h2-eth0:10.0.0.2,h2-eth1:10.0.1.2 pid=14386>
         # FIXME: Fix that
-        hostRE = r"Host\s(?P<name>[^:]+)\:((\s(?P<ifname>[^:]+)\:" +\
-            "(?P<ip>[^\s]+))|(\s)\spid=(?P<pid>[^>]+))"
-        # update mn port info
-        self.update()
-        # Get mininet dump
-        dump = self.dump().split( "\n" )
-        hosts = {}
-        for line in dump:
-            if "Host" in line :
-                result = re.search( hostRE, line )
-                name = result.group( 'name' )
-                interfaces = []
-                response = self.getInterfaces( name )
-                # Populate interface info
-                for line in response.split( "\n" ):
-                    if line.startswith( "name=" ):
-                        portVars = {}
-                        for var in line.split( "," ):
-                            key, value = var.split( "=" )
-                            portVars[ key ] = value
-                        isUp = portVars.pop( 'enabled', "True" )
-                        isUp = "True" in isUp
-                        if verbose:
-                            main.log.info( "Reading host port %s(%s)" %
-                                           ( portVars[ 'name' ],
-                                             portVars[ 'mac' ] ) )
-                        mac = portVars[ 'mac' ]
-                        if mac == 'None':
-                            mac = None
-                        ips = []
-                        ip = portVars[ 'ip' ]
-                        if ip == 'None':
-                            ip = None
-                        ips.append( ip )
-                        intfName = portVars[ 'name' ]
-                        if name == 'None':
-                            name = None
-                        interfaces.append( {
-                            "name": intfName,
-                            "ips": ips,
-                            "mac": str( mac ),
-                            "isUp": isUp } )
-                hosts[ name ] = { "interfaces": interfaces }
-        return hosts
+        try:
+            hostRE = r"Host\s(?P<name>[^:]+)\:((\s(?P<ifname>[^:]+)\:" +\
+                "(?P<ip>[^\s]+))|(\s)\spid=(?P<pid>[^>]+))"
+            # update mn port info
+            self.update()
+            # Get mininet dump
+            dump = self.dump().split( "\n" )
+            hosts = {}
+            for line in dump:
+                if "Host" in line :
+                    result = re.search( hostRE, line )
+                    name = result.group( 'name' )
+                    interfaces = []
+                    response = self.getInterfaces( name )
+                    # Populate interface info
+                    for line in response.split( "\n" ):
+                        if line.startswith( "name=" ):
+                            portVars = {}
+                            for var in line.split( "," ):
+                                key, value = var.split( "=" )
+                                portVars[ key ] = value
+                            isUp = portVars.pop( 'enabled', "True" )
+                            isUp = "True" in isUp
+                            if verbose:
+                                main.log.info( "Reading host port %s(%s)" %
+                                               ( portVars[ 'name' ],
+                                                 portVars[ 'mac' ] ) )
+                            mac = portVars[ 'mac' ]
+                            if mac == 'None':
+                                mac = None
+                            ips = []
+                            ip = portVars[ 'ip' ]
+                            if ip == 'None':
+                                ip = None
+                            ips.append( ip )
+                            intfName = portVars[ 'name' ]
+                            if name == 'None':
+                                name = None
+                            interfaces.append( {
+                                "name": intfName,
+                                "ips": ips,
+                                "mac": str( mac ),
+                                "isUp": isUp } )
+                    hosts[ name ] = { "interfaces": interfaces }
+            return hosts
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def getLinks( self, timeout=20 ):
         """
@@ -2777,27 +3075,38 @@
               number. In Mininet, for OVS switch, these should be the same. For
               hosts, this is just the eth#.
         """
-        self.update()
-        response = self.links(timeout=timeout).split( '\n' )
+        try:
+            self.update()
+            response = self.links(timeout=timeout).split( '\n' )
 
-        # Examples:
-        # s1-eth3<->s2-eth1 (OK OK)
-        # s13-eth3<->h27-eth0 (OK OK)
-        linkRE = "(?P<node1>[\w]+)\-eth(?P<port1>[\d]+)\<\-\>" +\
-                 "(?P<node2>[\w]+)\-eth(?P<port2>[\d]+)"
-        links = []
-        for line in response:
-            match = re.search( linkRE, line )
-            if match:
-                node1 = match.group( 'node1' )
-                node2 = match.group( 'node2' )
-                port1 = match.group( 'port1' )
-                port2 = match.group( 'port2' )
-                links.append( { 'node1': node1,
-                                'node2': node2,
-                                'port1': port1,
-                                'port2': port2 } )
-        return links
+            # Examples:
+            # s1-eth3<->s2-eth1 (OK OK)
+            # s13-eth3<->h27-eth0 (OK OK)
+            linkRE = "(?P<node1>[\w]+)\-eth(?P<port1>[\d]+)\<\-\>" +\
+                     "(?P<node2>[\w]+)\-eth(?P<port2>[\d]+)"
+            links = []
+            for line in response:
+                match = re.search( linkRE, line )
+                if match:
+                    node1 = match.group( 'node1' )
+                    node2 = match.group( 'node2' )
+                    port1 = match.group( 'port1' )
+                    port2 = match.group( 'port2' )
+                    links.append( { 'node1': node1,
+                                    'node2': node2,
+                                    'port1': port1,
+                                    'port2': port2 } )
+            return links
+
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def compareSwitches( self, switches, switchesJson, portsJson ):
         """
@@ -2809,109 +3118,119 @@
         """
         from numpy import uint64
         # created sorted list of dpid's in MN and ONOS for comparison
-        mnDPIDs = []
-        for swName, switch in switches.iteritems():
-            mnDPIDs.append( switch[ 'dpid' ].lower() )
-        mnDPIDs.sort()
-        if switchesJson == "":  # if rest call fails
-            main.log.error(
-                self.name +
-                ".compareSwitches(): Empty JSON object given from ONOS" )
-            return main.FALSE
-        onos = switchesJson
-        onosDPIDs = []
-        for switch in onos:
-            if switch[ 'available' ]:
-                onosDPIDs.append(
-                    switch[ 'id' ].replace(
-                        ":",
-                        '' ).replace(
-                        "of",
-                        '' ).lower() )
-        onosDPIDs.sort()
-
-        if mnDPIDs != onosDPIDs:
-            switchResults = main.FALSE
-            main.log.error( "Switches in MN but not in ONOS:" )
-            list1 = [ switch for switch in mnDPIDs if switch not in onosDPIDs ]
-            main.log.error( str( list1 ) )
-            main.log.error( "Switches in ONOS but not in MN:" )
-            list2 = [ switch for switch in onosDPIDs if switch not in mnDPIDs ]
-            main.log.error( str( list2 ) )
-        else:  # list of dpid's match in onos and mn
-            switchResults = main.TRUE
-        finalResults = switchResults
-
-        # FIXME: this does not look for extra ports in ONOS, only checks that
-        # ONOS has what is in MN
-        portsResults = main.TRUE
-
-        # PORTS
-        for name, mnSwitch in switches.iteritems():
-            mnPorts = []
-            onosPorts = []
-            switchResult = main.TRUE
-            for port in mnSwitch[ 'ports' ]:
-                if port[ 'enabled' ]:
-                    mnPorts.append( int( port[ 'of_port' ] ) )
-            for onosSwitch in portsJson:
-                if onosSwitch[ 'device' ][ 'available' ]:
-                    if onosSwitch[ 'device' ][ 'id' ].replace(
-                            ':',
+        try:
+            mnDPIDs = []
+            for swName, switch in switches.iteritems():
+                mnDPIDs.append( switch[ 'dpid' ].lower() )
+            mnDPIDs.sort()
+            if switchesJson == "":  # if rest call fails
+                main.log.error(
+                    self.name +
+                    ".compareSwitches(): Empty JSON object given from ONOS" )
+                return main.FALSE
+            onos = switchesJson
+            onosDPIDs = []
+            for switch in onos:
+                if switch[ 'available' ]:
+                    onosDPIDs.append(
+                        switch[ 'id' ].replace(
+                            ":",
                             '' ).replace(
                             "of",
-                            '' ) == mnSwitch[ 'dpid' ]:
-                        for port in onosSwitch[ 'ports' ]:
-                            if port[ 'isEnabled' ]:
-                                if port[ 'port' ] == 'local':
-                                    # onosPorts.append( 'local' )
-                                    onosPorts.append( long( uint64( -2 ) ) )
-                                else:
-                                    onosPorts.append( int( port[ 'port' ] ) )
-                        break
-            mnPorts.sort( key=float )
-            onosPorts.sort( key=float )
+                            '' ).lower() )
+            onosDPIDs.sort()
 
-            mnPortsLog = mnPorts
-            onosPortsLog = onosPorts
-            mnPorts = [ x for x in mnPorts ]
-            onosPorts = [ x for x in onosPorts ]
+            if mnDPIDs != onosDPIDs:
+                switchResults = main.FALSE
+                main.log.error( "Switches in MN but not in ONOS:" )
+                list1 = [ switch for switch in mnDPIDs if switch not in onosDPIDs ]
+                main.log.error( str( list1 ) )
+                main.log.error( "Switches in ONOS but not in MN:" )
+                list2 = [ switch for switch in onosDPIDs if switch not in mnDPIDs ]
+                main.log.error( str( list2 ) )
+            else:  # list of dpid's match in onos and mn
+                switchResults = main.TRUE
+            finalResults = switchResults
 
-            # TODO: handle other reserved port numbers besides LOCAL
-            # NOTE: Reserved ports
-            # Local port: -2 in Openflow, ONOS shows 'local', we store as
-            # long( uint64( -2 ) )
-            for mnPort in mnPortsLog:
-                if mnPort in onosPorts:
-                    # don't set results to true here as this is just one of
-                    # many checks and it might override a failure
-                    mnPorts.remove( mnPort )
-                    onosPorts.remove( mnPort )
+            # FIXME: this does not look for extra ports in ONOS, only checks that
+            # ONOS has what is in MN
+            portsResults = main.TRUE
 
-                # NOTE: OVS reports this as down since there is no link
-                #      So ignoring these for now
-                # TODO: Come up with a better way of handling these
-                if 65534 in mnPorts:
-                    mnPorts.remove( 65534 )
-                if long( uint64( -2 ) ) in onosPorts:
-                    onosPorts.remove( long( uint64( -2 ) ) )
-            if len( mnPorts ):  # the ports of this switch don't match
-                switchResult = main.FALSE
-                main.log.warn( "Ports in MN but not ONOS: " + str( mnPorts ) )
-            if len( onosPorts ):  # the ports of this switch don't match
-                switchResult = main.FALSE
-                main.log.warn(
-                    "Ports in ONOS but not MN: " +
-                    str( onosPorts ) )
-            if switchResult == main.FALSE:
-                main.log.error(
-                    "The list of ports for switch %s(%s) does not match:" %
-                    ( name, mnSwitch[ 'dpid' ] ) )
-                main.log.warn( "mn_ports[]  =  " + str( mnPortsLog ) )
-                main.log.warn( "onos_ports[] = " + str( onosPortsLog ) )
-            portsResults = portsResults and switchResult
-        finalResults = finalResults and portsResults
-        return finalResults
+            # PORTS
+            for name, mnSwitch in switches.iteritems():
+                mnPorts = []
+                onosPorts = []
+                switchResult = main.TRUE
+                for port in mnSwitch[ 'ports' ]:
+                    if port[ 'enabled' ]:
+                        mnPorts.append( int( port[ 'of_port' ] ) )
+                for onosSwitch in portsJson:
+                    if onosSwitch[ 'device' ][ 'available' ]:
+                        if onosSwitch[ 'device' ][ 'id' ].replace(
+                                ':',
+                                '' ).replace(
+                                "of",
+                                '' ) == mnSwitch[ 'dpid' ]:
+                            for port in onosSwitch[ 'ports' ]:
+                                if port[ 'isEnabled' ]:
+                                    if port[ 'port' ] == 'local':
+                                        # onosPorts.append( 'local' )
+                                        onosPorts.append( long( uint64( -2 ) ) )
+                                    else:
+                                        onosPorts.append( int( port[ 'port' ] ) )
+                            break
+                mnPorts.sort( key=float )
+                onosPorts.sort( key=float )
+
+                mnPortsLog = mnPorts
+                onosPortsLog = onosPorts
+                mnPorts = [ x for x in mnPorts ]
+                onosPorts = [ x for x in onosPorts ]
+
+                # TODO: handle other reserved port numbers besides LOCAL
+                # NOTE: Reserved ports
+                # Local port: -2 in Openflow, ONOS shows 'local', we store as
+                # long( uint64( -2 ) )
+                for mnPort in mnPortsLog:
+                    if mnPort in onosPorts:
+                        # don't set results to true here as this is just one of
+                        # many checks and it might override a failure
+                        mnPorts.remove( mnPort )
+                        onosPorts.remove( mnPort )
+
+                    # NOTE: OVS reports this as down since there is no link
+                    #      So ignoring these for now
+                    # TODO: Come up with a better way of handling these
+                    if 65534 in mnPorts:
+                        mnPorts.remove( 65534 )
+                    if long( uint64( -2 ) ) in onosPorts:
+                        onosPorts.remove( long( uint64( -2 ) ) )
+                if len( mnPorts ):  # the ports of this switch don't match
+                    switchResult = main.FALSE
+                    main.log.warn( "Ports in MN but not ONOS: " + str( mnPorts ) )
+                if len( onosPorts ):  # the ports of this switch don't match
+                    switchResult = main.FALSE
+                    main.log.warn(
+                        "Ports in ONOS but not MN: " +
+                        str( onosPorts ) )
+                if switchResult == main.FALSE:
+                    main.log.error(
+                        "The list of ports for switch %s(%s) does not match:" %
+                        ( name, mnSwitch[ 'dpid' ] ) )
+                    main.log.warn( "mn_ports[]  =  " + str( mnPortsLog ) )
+                    main.log.warn( "onos_ports[] = " + str( onosPortsLog ) )
+                portsResults = portsResults and switchResult
+            finalResults = finalResults and portsResults
+            return finalResults
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def compareLinks( self, switches, links, linksJson ):
         """
@@ -2921,110 +3240,120 @@
         """
         # FIXME: this does not look for extra links in ONOS, only checks that
         #        ONOS has what is in MN
-        onos = linksJson
+        try:
+            onos = linksJson
 
-        mnLinks = []
-        for l in links:
-            try:
-                node1 = switches[ l[ 'node1' ] ]
-                node2 = switches[ l[ 'node2' ] ]
-                enabled = True
-                for port in node1[ 'ports' ]:
-                    if port[ 'of_port' ] == l[ 'port1' ]:
-                        enabled = enabled and port[ 'enabled' ]
-                for port in node2[ 'ports' ]:
-                    if port[ 'of_port' ] == l[ 'port2' ]:
-                        enabled = enabled and port[ 'enabled' ]
-                if enabled:
-                    mnLinks.append( l )
-            except KeyError:
-                pass
-        if 2 * len( mnLinks ) == len( onos ):
-            linkResults = main.TRUE
-        else:
-            linkResults = main.FALSE
-            main.log.error(
-                "Mininet has " + str( len( mnLinks ) ) +
-                " bidirectional links and ONOS has " +
-                str( len( onos ) ) + " unidirectional links" )
-
-        # iterate through MN links and check if an ONOS link exists in
-        # both directions
-        for link in mnLinks:
-            # TODO: Find a more efficient search method
-            node1 = None
-            port1 = None
-            node2 = None
-            port2 = None
-            firstDir = main.FALSE
-            secondDir = main.FALSE
-            for swName, switch in switches.iteritems():
-                if swName == link[ 'node1' ]:
-                    node1 = switch[ 'dpid' ]
-                    for port in switch[ 'ports' ]:
-                        if str( port[ 'of_port' ] ) == str( link[ 'port1' ] ):
-                            port1 = port[ 'of_port' ]
-                    if node1 is not None and node2 is not None:
-                        break
-                if swName == link[ 'node2' ]:
-                    node2 = switch[ 'dpid' ]
-                    for port in switch[ 'ports' ]:
-                        if str( port[ 'of_port' ] ) == str( link[ 'port2' ] ):
-                            port2 = port[ 'of_port' ]
-                    if node1 is not None and node2 is not None:
-                        break
-
-            for onosLink in onos:
-                onosNode1 = onosLink[ 'src' ][ 'device' ].replace(
-                    ":", '' ).replace( "of", '' )
-                onosNode2 = onosLink[ 'dst' ][ 'device' ].replace(
-                    ":", '' ).replace( "of", '' )
-                onosPort1 = onosLink[ 'src' ][ 'port' ]
-                onosPort2 = onosLink[ 'dst' ][ 'port' ]
-
-                # check onos link from node1 to node2
-                if str( onosNode1 ) == str( node1 ) and str(
-                        onosNode2 ) == str( node2 ):
-                    if int( onosPort1 ) == int( port1 ) and int(
-                            onosPort2 ) == int( port2 ):
-                        firstDir = main.TRUE
-                    else:
-                        main.log.warn(
-                            'The port numbers do not match for ' +
-                            str( link ) +
-                            ' between ONOS and MN. When checking ONOS for ' +
-                            'link %s/%s -> %s/%s' %
-                            ( node1, port1, node2, port2 ) +
-                            ' ONOS has the values %s/%s -> %s/%s' %
-                            ( onosNode1, onosPort1, onosNode2, onosPort2 ) )
-
-                # check onos link from node2 to node1
-                elif ( str( onosNode1 ) == str( node2 ) and
-                        str( onosNode2 ) == str( node1 ) ):
-                    if ( int( onosPort1 ) == int( port2 )
-                            and int( onosPort2 ) == int( port1 ) ):
-                        secondDir = main.TRUE
-                    else:
-                        main.log.warn(
-                            'The port numbers do not match for ' +
-                            str( link ) +
-                            ' between ONOS and MN. When checking ONOS for ' +
-                            'link %s/%s -> %s/%s' %
-                            ( node1, port1, node2, port2 ) +
-                            ' ONOS has the values %s/%s -> %s/%s' %
-                            ( onosNode2, onosPort2, onosNode1, onosPort1 ) )
-                else:  # this is not the link you're looking for
+            mnLinks = []
+            for l in links:
+                try:
+                    node1 = switches[ l[ 'node1' ] ]
+                    node2 = switches[ l[ 'node2' ] ]
+                    enabled = True
+                    for port in node1[ 'ports' ]:
+                        if port[ 'of_port' ] == l[ 'port1' ]:
+                            enabled = enabled and port[ 'enabled' ]
+                    for port in node2[ 'ports' ]:
+                        if port[ 'of_port' ] == l[ 'port2' ]:
+                            enabled = enabled and port[ 'enabled' ]
+                    if enabled:
+                        mnLinks.append( l )
+                except KeyError:
                     pass
-            if not firstDir:
+            if 2 * len( mnLinks ) == len( onos ):
+                linkResults = main.TRUE
+            else:
+                linkResults = main.FALSE
                 main.log.error(
-                    'ONOS does not have the link %s/%s -> %s/%s' %
-                    ( node1, port1, node2, port2 ) )
-            if not secondDir:
-                main.log.error(
-                    'ONOS does not have the link %s/%s -> %s/%s' %
-                    ( node2, port2, node1, port1 ) )
-            linkResults = linkResults and firstDir and secondDir
-        return linkResults
+                    "Mininet has " + str( len( mnLinks ) ) +
+                    " bidirectional links and ONOS has " +
+                    str( len( onos ) ) + " unidirectional links" )
+
+            # iterate through MN links and check if an ONOS link exists in
+            # both directions
+            for link in mnLinks:
+                # TODO: Find a more efficient search method
+                node1 = None
+                port1 = None
+                node2 = None
+                port2 = None
+                firstDir = main.FALSE
+                secondDir = main.FALSE
+                for swName, switch in switches.iteritems():
+                    if swName == link[ 'node1' ]:
+                        node1 = switch[ 'dpid' ]
+                        for port in switch[ 'ports' ]:
+                            if str( port[ 'of_port' ] ) == str( link[ 'port1' ] ):
+                                port1 = port[ 'of_port' ]
+                        if node1 is not None and node2 is not None:
+                            break
+                    if swName == link[ 'node2' ]:
+                        node2 = switch[ 'dpid' ]
+                        for port in switch[ 'ports' ]:
+                            if str( port[ 'of_port' ] ) == str( link[ 'port2' ] ):
+                                port2 = port[ 'of_port' ]
+                        if node1 is not None and node2 is not None:
+                            break
+
+                for onosLink in onos:
+                    onosNode1 = onosLink[ 'src' ][ 'device' ].replace(
+                        ":", '' ).replace( "of", '' )
+                    onosNode2 = onosLink[ 'dst' ][ 'device' ].replace(
+                        ":", '' ).replace( "of", '' )
+                    onosPort1 = onosLink[ 'src' ][ 'port' ]
+                    onosPort2 = onosLink[ 'dst' ][ 'port' ]
+
+                    # check onos link from node1 to node2
+                    if str( onosNode1 ) == str( node1 ) and str(
+                            onosNode2 ) == str( node2 ):
+                        if int( onosPort1 ) == int( port1 ) and int(
+                                onosPort2 ) == int( port2 ):
+                            firstDir = main.TRUE
+                        else:
+                            main.log.warn(
+                                'The port numbers do not match for ' +
+                                str( link ) +
+                                ' between ONOS and MN. When checking ONOS for ' +
+                                'link %s/%s -> %s/%s' %
+                                ( node1, port1, node2, port2 ) +
+                                ' ONOS has the values %s/%s -> %s/%s' %
+                                ( onosNode1, onosPort1, onosNode2, onosPort2 ) )
+
+                    # check onos link from node2 to node1
+                    elif ( str( onosNode1 ) == str( node2 ) and
+                            str( onosNode2 ) == str( node1 ) ):
+                        if ( int( onosPort1 ) == int( port2 )
+                                and int( onosPort2 ) == int( port1 ) ):
+                            secondDir = main.TRUE
+                        else:
+                            main.log.warn(
+                                'The port numbers do not match for ' +
+                                str( link ) +
+                                ' between ONOS and MN. When checking ONOS for ' +
+                                'link %s/%s -> %s/%s' %
+                                ( node1, port1, node2, port2 ) +
+                                ' ONOS has the values %s/%s -> %s/%s' %
+                                ( onosNode2, onosPort2, onosNode1, onosPort1 ) )
+                    else:  # this is not the link you're looking for
+                        pass
+                if not firstDir:
+                    main.log.error(
+                        'ONOS does not have the link %s/%s -> %s/%s' %
+                        ( node1, port1, node2, port2 ) )
+                if not secondDir:
+                    main.log.error(
+                        'ONOS does not have the link %s/%s -> %s/%s' %
+                        ( node2, port2, node1, port1 ) )
+                linkResults = linkResults and firstDir and secondDir
+            return linkResults
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def compareHosts( self, hosts, hostsJson ):
         """
@@ -3038,109 +3367,149 @@
         Returns:
         """
         import json
-        hostResults = main.TRUE
-        for onosHost in hostsJson:
-            onosMAC = onosHost[ 'mac' ].lower()
-            match = False
-            for mnHost, info in hosts.iteritems():
-                for mnIntf in info[ 'interfaces' ]:
-                    if onosMAC == mnIntf[ 'mac' ].lower():
-                        match = True
-                        for ip in mnIntf[ 'ips' ]:
-                            if ip in onosHost[ 'ipAddresses' ]:
-                                pass  # all is well
-                            else:
-                                # misssing ip
-                                main.log.error( "ONOS host " +
-                                                onosHost[ 'id' ] +
-                                                " has a different IP(" +
-                                                str( onosHost[ 'ipAddresses' ] ) +
-                                                ") than the Mininet host(" +
-                                                str( ip ) +
-                                                ")." )
-                                output = json.dumps(
-                                    onosHost,
-                                    sort_keys=True,
-                                    indent=4,
-                                    separators=( ',', ': ' ) )
-                                main.log.info( output )
-                                hostResults = main.FALSE
-            if not match:
-                hostResults = main.FALSE
-                main.log.error( "ONOS host " + onosHost[ 'id' ] + " has no " +
-                                "corresponding Mininet host." )
-                output = json.dumps( onosHost,
-                                     sort_keys=True,
-                                     indent=4,
-                                     separators=( ',', ': ' ) )
-                main.log.info( output )
-        return hostResults
+        try:
+            hostResults = main.TRUE
+            for onosHost in hostsJson:
+                onosMAC = onosHost[ 'mac' ].lower()
+                match = False
+                for mnHost, info in hosts.iteritems():
+                    for mnIntf in info[ 'interfaces' ]:
+                        if onosMAC == mnIntf[ 'mac' ].lower():
+                            match = True
+                            for ip in mnIntf[ 'ips' ]:
+                                if ip in onosHost[ 'ipAddresses' ]:
+                                    pass  # all is well
+                                else:
+                                    # misssing ip
+                                    main.log.error( "ONOS host " +
+                                                    onosHost[ 'id' ] +
+                                                    " has a different IP(" +
+                                                    str( onosHost[ 'ipAddresses' ] ) +
+                                                    ") than the Mininet host(" +
+                                                    str( ip ) +
+                                                    ")." )
+                                    output = json.dumps(
+                                        onosHost,
+                                        sort_keys=True,
+                                        indent=4,
+                                        separators=( ',', ': ' ) )
+                                    main.log.info( output )
+                                    hostResults = main.FALSE
+                if not match:
+                    hostResults = main.FALSE
+                    main.log.error( "ONOS host " + onosHost[ 'id' ] + " has no " +
+                                    "corresponding Mininet host." )
+                    output = json.dumps( onosHost,
+                                         sort_keys=True,
+                                         indent=4,
+                                         separators=( ',', ': ' ) )
+                    main.log.info( output )
+            return hostResults
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":     " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception(self.name + ": Uncaught exception!")
+            main.cleanup()
+            main.exit()
 
     def getHostsOld( self ):
         """
            Returns a list of all hosts
            Don't ask questions just use it"""
-        self.handle.sendline( "" )
-        self.handle.expect( "mininet>" )
+        try:
+            self.handle.sendline( "" )
+            self.handle.expect( "mininet>" )
 
-        self.handle.sendline( "py [ host.name for host in net.hosts ]" )
-        self.handle.expect( "mininet>" )
+            self.handle.sendline( "py [ host.name for host in net.hosts ]" )
+            self.handle.expect( "mininet>" )
 
-        handlePy = self.handle.before
-        handlePy = handlePy.split( "]\r\n", 1 )[ 1 ]
-        handlePy = handlePy.rstrip()
+            handlePy = self.handle.before
+            handlePy = handlePy.split( "]\r\n", 1 )[ 1 ]
+            handlePy = handlePy.rstrip()
 
-        self.handle.sendline( "" )
-        self.handle.expect( "mininet>" )
+            self.handle.sendline( "" )
+            self.handle.expect( "mininet>" )
 
-        hostStr = handlePy.replace( "]", "" )
-        hostStr = hostStr.replace( "'", "" )
-        hostStr = hostStr.replace( "[", "" )
-        hostStr = hostStr.replace( " ", "" )
-        hostList = hostStr.split( "," )
+            hostStr = handlePy.replace( "]", "" )
+            hostStr = hostStr.replace( "'", "" )
+            hostStr = hostStr.replace( "[", "" )
+            hostStr = hostStr.replace( " ", "" )
+            hostList = hostStr.split( "," )
 
-        return hostList
+            return hostList
+        except pexpect.TIMEOUT:
+            main.log.error(self.name + ": TIMEOUT exception found")
+            main.log.error(self.name + ":     " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def getSwitch( self ):
         """
             Returns a list of all switches
             Again, don't ask question just use it...
         """
-        # get host list...
-        hostList = self.getHosts()
-        # Make host set
-        hostSet = set( hostList )
+        try:
+            # get host list...
+            hostList = self.getHosts()
+            # Make host set
+            hostSet = set( hostList )
 
-        # Getting all the nodes in mininet
-        self.handle.sendline( "" )
-        self.handle.expect( "mininet>" )
+            # Getting all the nodes in mininet
+            self.handle.sendline( "" )
+            self.handle.expect( "mininet>" )
 
-        self.handle.sendline( "py [ node.name for node in net.values() ]" )
-        self.handle.expect( "mininet>" )
+            self.handle.sendline( "py [ node.name for node in net.values() ]" )
+            self.handle.expect( "mininet>" )
 
-        handlePy = self.handle.before
-        handlePy = handlePy.split( "]\r\n", 1 )[ 1 ]
-        handlePy = handlePy.rstrip()
+            handlePy = self.handle.before
+            handlePy = handlePy.split( "]\r\n", 1 )[ 1 ]
+            handlePy = handlePy.rstrip()
 
-        self.handle.sendline( "" )
-        self.handle.expect( "mininet>" )
+            self.handle.sendline( "" )
+            self.handle.expect( "mininet>" )
 
-        nodesStr = handlePy.replace( "]", "" )
-        nodesStr = nodesStr.replace( "'", "" )
-        nodesStr = nodesStr.replace( "[", "" )
-        nodesStr = nodesStr.replace( " ", "" )
-        nodesList = nodesStr.split( "," )
+            nodesStr = handlePy.replace( "]", "" )
+            nodesStr = nodesStr.replace( "'", "" )
+            nodesStr = nodesStr.replace( "[", "" )
+            nodesStr = nodesStr.replace( " ", "" )
+            nodesList = nodesStr.split( "," )
 
-        nodesSet = set( nodesList )
-        # discarding default controller(s) node
-        nodesSet.discard( 'c0' )
-        nodesSet.discard( 'c1' )
-        nodesSet.discard( 'c2' )
+            nodesSet = set( nodesList )
+            # discarding default controller(s) node
+            nodesSet.discard( 'c0' )
+            nodesSet.discard( 'c1' )
+            nodesSet.discard( 'c2' )
 
-        switchSet = nodesSet - hostSet
-        switchList = list( switchSet )
+            switchSet = nodesSet - hostSet
+            switchList = list( switchSet )
 
-        return switchList
+            return switchList
+        except pexpect.TIMEOUT:
+            main.log.error(self.name + ": TIMEOUT exception found")
+            main.log.error(self.name + ":     " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def getGraphDict( self, timeout=60, useId=True, includeHost=False ):
         """
@@ -3232,6 +3601,11 @@
         except AssertionError:
             main.log.exception( self.name + ": AssertionError exception found" )
             return None
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception" )
             return None
@@ -3254,11 +3628,20 @@
             self.handle.expect( "mininet>" )
 
             return main.TRUE
+        except pexpect.TIMEOUT:
+            main.log.error(self.name + ": TIMEOUT exception found")
+            main.log.error(self.name + ":     " + self.handle.before)
+            main.cleanup()
+            main.exit()
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def assignVLAN( self, host, intf, vlan ):
         """
@@ -3309,10 +3692,18 @@
                 main.log.info( "====> %s ", response )
 
                 return main.TRUE
+            except pexpect.TIMEOUT:
+                main.log.error(self.name + ": TIMEOUT exception found")
+                main.log.error(self.name + ":     " + self.handle.before)
+                main.cleanup()
+                main.exit()
             except pexpect.EOF:
                 main.log.error( self.name + ": EOF exception found" )
                 main.log.error( self.name + ":     " + self.handle.before )
                 return main.FALSE
+            except Exception:
+                main.log.exception( self.name + ": Uncaught exception!" )
+                return main.FALSE
 
     def createHostComponent( self, name ):
         """
@@ -3333,6 +3724,11 @@
             main.componentDictionary[name] = main.componentDictionary[self.name].copy()
             main.componentDictionary[name]['connect_order'] = str( int( main.componentDictionary[name]['connect_order'] ) + 1 )
             main.componentInit( name )
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanup()
@@ -3363,6 +3759,11 @@
             delattr( main, name )
             # Delete component from ComponentDictionary
             del( main.componentDictionary[name] )
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanup()
diff --git a/TestON/drivers/common/cli/emulator/poxclidriver.py b/TestON/drivers/common/cli/emulator/poxclidriver.py
index 2d92139..02c43b1 100644
--- a/TestON/drivers/common/cli/emulator/poxclidriver.py
+++ b/TestON/drivers/common/cli/emulator/poxclidriver.py
@@ -1,6 +1,11 @@
 #!/usr/bin/env python
 """
 Created on 26-Oct-2012
+Modified 2015 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
 author:: Raghav Kashyap( raghavkashyap@paxterrasolutions.com )
 
diff --git a/TestON/drivers/common/cli/emulator/remotemininetdriver.py b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
index cc75755..f4adb81 100644
--- a/TestON/drivers/common/cli/emulator/remotemininetdriver.py
+++ b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
@@ -1,9 +1,11 @@
 #!/usr/bin/env python
 """
 Created on 26-Oct-2012
+Modified 2016 by ON.Lab
 
-author:: Anil Kumar ( anilkumar.s@paxterrasolutions.com )
-
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
     TestON is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -47,46 +49,51 @@
         """,user_name, ip_address, pwd,options ):
          Here the main is the TestON instance after creating all the log
          handles."""
-        for key in connectargs:
-            vars( self )[ key ] = connectargs[ key ]
-
-        self.name = self.options[ 'name' ]
-
         try:
-            if os.getenv( str( self.ip_address ) ) != None:
-                self.ip_address = os.getenv( str( self.ip_address ) )
+            for key in connectargs:
+                vars( self )[ key ] = connectargs[ key ]
+
+            self.name = self.options[ 'name' ]
+
+            try:
+                if os.getenv( str( self.ip_address ) ) != None:
+                    self.ip_address = os.getenv( str( self.ip_address ) )
+                else:
+                    main.log.info( self.name +
+                                   ": Trying to connect to " +
+                                   self.ip_address )
+
+            except KeyError:
+                main.log.info( "Invalid host name," +
+                               " connecting to local host instead" )
+                self.ip_address = 'localhost'
+            except Exception as inst:
+                main.log.error( "Uncaught exception: " + str( inst ) )
+
+            self.handle = super(
+                RemoteMininetDriver,
+                self ).connect(
+                user_name=self.user_name,
+                ip_address=self.ip_address,
+                port=None,
+                pwd=self.pwd )
+
+            # Copying the readme file to process the
+            if self.handle:
+                return main.TRUE
+
             else:
-                main.log.info( self.name +
-                               ": Trying to connect to " +
-                               self.ip_address )
-
-        except KeyError:
-            main.log.info( "Invalid host name," +
-                           " connecting to local host instead" )
-            self.ip_address = 'localhost'
-        except Exception as inst:
-            main.log.error( "Uncaught exception: " + str( inst ) )
-
-        self.handle = super(
-            RemoteMininetDriver,
-            self ).connect(
-            user_name=self.user_name,
-            ip_address=self.ip_address,
-            port=None,
-            pwd=self.pwd )
-
-        # Copying the readme file to process the
-        if self.handle:
-            return main.TRUE
-
-        else:
-            main.log.error(
-                "Connection failed to the host " +
-                self.user_name +
-                "@" +
-                self.ip_address )
-            main.log.error( "Failed to connect to the Mininet" )
-            return main.FALSE
+                main.log.error(
+                    "Connection failed to the host " +
+                    self.user_name +
+                    "@" +
+                    self.ip_address )
+                main.log.error( "Failed to connect to the Mininet" )
+                return main.FALSE
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def checkForLoss( self, pingList ):
         """
@@ -94,107 +101,185 @@
         Returns main.ERROR if "found multiple mininet" is found and
         Returns main.TRUE else
         """
-        self.handle.sendline( "" )
-        self.handle.expect( "\$" )
-        self.handle.sendline( "" )
-        self.handle.expect( "\$" )
-        self.handle.sendline( "cat " + pingList )
-        self.handle.expect( pingList )
-        self.handle.expect( "\$" )
-        outputs = self.handle.before + self.handle.after
-        if re.search( " 0% packet loss", outputs ):
+        try:
+            self.handle.sendline( "" )
+            self.handle.expect( "\$" )
+            self.handle.sendline( "" )
+            self.handle.expect( "\$" )
+            self.handle.sendline( "cat " + pingList )
+            self.handle.expect( pingList )
+            self.handle.expect( "\$" )
+            outputs = self.handle.before + self.handle.after
+            if re.search( " 0% packet loss", outputs ):
+                return main.FALSE
+            elif re.search( "found multiple mininet", outputs ):
+                return main.ERROR
+            else:
+                # TODO: Parse for failed pings, give some truncated output
+                main.log.error( "Error, unexpected output in the ping file" )
+                main.log.warn( outputs )
+                return main.TRUE
+        except pexpect.TIMEOUT:
+            main.log.exception( self.name + ": TIMEOUT exception found in checkForLoss" )
+            main.log.error( self.name + ":    " + self.handle.before )
             return main.FALSE
-        elif re.search( "found multiple mininet", outputs ):
-            return main.ERROR
-        else:
-            # TODO: Parse for failed pings, give some truncated output
-            main.log.error( "Error, unexpected output in the ping file" )
-            main.log.warn( outputs )
-            return main.TRUE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def pingLong( self, **pingParams ):
         """
         Starts a continuous ping on the mininet host outputting
         to a file in the /tmp dir.
         """
-        self.handle.sendline( "" )
-        self.handle.expect( "\$" )
-        args = utilities.parse_args(
-            [ "SRC", "TARGET", "PINGTIME" ], **pingParams )
-        precmd = "sudo rm /tmp/ping." + args[ "SRC" ]
-        self.execute( cmd=precmd, prompt="(.*)", timeout=10 )
-        command = "sudo mininet/util/m " + args[ "SRC" ] + " ping " +\
-                  args[ "TARGET" ] + " -i .2 -w " +\
-                  str( args[ 'PINGTIME' ] ) + " -D > /tmp/ping." +\
-                  args[ "SRC" ] + " &"
-        main.log.info( command )
-        self.execute( cmd=command, prompt="(.*)", timeout=10 )
-        self.handle.sendline( "" )
-        self.handle.expect( "\$" )
-        return main.TRUE
+        try:
+            self.handle.sendline( "" )
+            self.handle.expect( "\$" )
+            args = utilities.parse_args(
+                [ "SRC", "TARGET", "PINGTIME" ], **pingParams )
+            precmd = "sudo rm /tmp/ping." + args[ "SRC" ]
+            self.execute( cmd=precmd, prompt="(.*)", timeout=10 )
+            command = "sudo mininet/util/m " + args[ "SRC" ] + " ping " +\
+                      args[ "TARGET" ] + " -i .2 -w " +\
+                      str( args[ 'PINGTIME' ] ) + " -D > /tmp/ping." +\
+                      args[ "SRC" ] + " &"
+            main.log.info( command )
+            self.execute( cmd=command, prompt="(.*)", timeout=10 )
+            self.handle.sendline( "" )
+            self.handle.expect( "\$" )
+            return main.TRUE
+        except TypeError:
+            main.log.exception(self.name + ": Object not as expected")
+            return main.FALSE
+        except pexpect.TIMEOUT:
+            main.log.exception( self.name + ": TIMEOUT exception found in pingLong" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            return main.FALSE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
+
 
     def pingstatus( self, **pingParams ):
         """
         Tails the respective ping output file and check that
         there is a moving "64 bytes"
         """
-        self.handle.sendline( "" )
-        self.handle.expect( "\$" )
-        args = utilities.parse_args( [ "SRC" ], **pingParams )
-        self.handle.sendline( "tail /tmp/ping." + args[ "SRC" ] )
-        self.handle.expect( "tail" )
-        self.handle.expect( "\$" )
-        result = self.handle.before + self.handle.after
-        self.handle.sendline( "" )
-        self.handle.expect( "\$" )
-        if re.search( 'Unreachable', result ):
-            main.log.info( "Unreachable found in ping logs..." )
+        try:
+            self.handle.sendline( "" )
+            self.handle.expect( "\$" )
+            args = utilities.parse_args( [ "SRC" ], **pingParams )
+            self.handle.sendline( "tail /tmp/ping." + args[ "SRC" ] )
+            self.handle.expect( "tail" )
+            self.handle.expect( "\$" )
+            result = self.handle.before + self.handle.after
+            self.handle.sendline( "" )
+            self.handle.expect( "\$" )
+            if re.search( 'Unreachable', result ):
+                main.log.info( "Unreachable found in ping logs..." )
+                return main.FALSE
+            elif re.search( '64\sbytes', result ):
+                main.log.info( "Pings look good" )
+                return main.TRUE
+            else:
+                main.log.info( "No, or faulty ping data..." )
+                return main.FALSE
+        except TypeError:
+            main.log.exception( self.name + ": Object not as expected" )
             return main.FALSE
-        elif re.search( '64\sbytes', result ):
-            main.log.info( "Pings look good" )
-            return main.TRUE
-        else:
-            main.log.info( "No, or faulty ping data..." )
+        except pexpect.TIMEOUT:
+            main.log.exception( self.name + ": TIMEOUT exception found in pingstatus" )
+            main.log.error( self.name + ":    " + self.handle.before )
             return main.FALSE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception(self.name + ": Uncaught exception!")
+            main.cleanup()
+            main.exit()
 
     def pingKill( self, testONUser, testONIP ):
         """
         Kills all continuous ping processes.
         Then copies all the ping files to the TestStation.
         """
-        self.handle.sendline( "" )
-        self.handle.expect( "\$" )
-        command = "sudo kill -SIGINT `pgrep ping`"
-        main.log.info( command )
-        self.execute( cmd=command, prompt="(.*)", timeout=10 )
+        try:
+            self.handle.sendline( "" )
+            self.handle.expect( "\$" )
+            command = "sudo kill -SIGINT `pgrep ping`"
+            main.log.info( command )
+            self.execute( cmd=command, prompt="(.*)", timeout=10 )
 
-        main.log.info( "Transferring ping files to TestStation" )
-        command = "scp /tmp/ping.* " + \
-            str( testONUser ) + "@" + str( testONIP ) + ":/tmp/"
-        self.execute( cmd=command, prompt="100%", timeout=20 )
-        # Make sure the output is cleared
-        self.handle.sendline( "" )
-        self.handle.expect( "\$" )
-        self.handle.sendline( "" )
-        self.handle.expect( "\$" )
-        self.handle.sendline( "" )
-        i = self.handle.expect( [ "password", "\$" ] )
-        if i == 0:
-            main.log.error( "Error, sudo asking for password" )
-            main.log.error( self.handle.before )
-            return main.FALSE
-        else:
-            return main.TRUE
+            main.log.info( "Transferring ping files to TestStation" )
+            command = "scp /tmp/ping.* " + \
+                str( testONUser ) + "@" + str( testONIP ) + ":/tmp/"
+            self.execute( cmd=command, prompt="100%", timeout=20 )
+            # Make sure the output is cleared
+            self.handle.sendline( "" )
+            self.handle.expect( "\$" )
+            self.handle.sendline( "" )
+            self.handle.expect( "\$" )
+            self.handle.sendline( "" )
+            i = self.handle.expect( [ "password", "\$" ] )
+            if i == 0:
+                main.log.error( "Error, sudo asking for password" )
+                main.log.error( self.handle.before )
+                return main.FALSE
+            else:
+                return main.TRUE
+        except pexpect.TIMEOUT:
+            main.log.error( self.name + ": TIMEOUT exception found in pingKill" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def pingLongKill( self ):
-        self.handle.sendline( "" )
-        self.handle.expect( "\$" )
-        command = "sudo kill -SIGING `pgrep ping`"
-        main.log.info( command )
-        self.execute( cmd=command, prompt="(.*)", timeout=10 )
-        self.handle.sendline( "" )
-        self.handle.expect( "\$" )
-        return main.TRUE
+        try:
+            self.handle.sendline( "" )
+            self.handle.expect( "\$" )
+            command = "sudo kill -SIGING `pgrep ping`"
+            main.log.info( command )
+            self.execute( cmd=command, prompt="(.*)", timeout=10 )
+            self.handle.sendline( "" )
+            self.handle.expect( "\$" )
+            return main.TRUE
+        except pexpect.TIMEOUT:
+            main.log.exception( self.name + ": TIMEOUT exception found in pingLongKill" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            return main.FALSE
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception(self.name + ": Uncaught exception!")
+            main.cleanup()
+            main.exit()
 
     def pingHostOptical( self, **pingParams ):
         """
@@ -243,52 +328,76 @@
         """
         Pings between two hosts on remote mininet
         """
-        self.handle.sendline( "" )
-        self.handle.expect( "\$" )
-        args = utilities.parse_args( [ "SRC", "TARGET" ], **pingParams )
-        command = "mininet/util/m " + \
-            args[ "SRC" ] + " ping " + args[ "TARGET" ] + " -c 4 -W 1 -i .2"
-        main.log.info( command )
-        response = self.execute( cmd=command, prompt="rtt", timeout=10 )
-        if utilities.assert_matches(
-                expect=',\s0\%\spacket\sloss',
-                actual=response,
-                onpass="No Packet loss",
-                onfail="Host is not reachable" ):
-            main.log.info( "NO PACKET LOSS, HOST IS REACHABLE" )
-            main.lastResult = main.TRUE
-            return main.TRUE
-        else:
-            main.log.error( "PACKET LOST, HOST IS NOT REACHABLE" )
-            main.lastResult = main.FALSE
-            return main.FALSE
+        try:
+            self.handle.sendline( "" )
+            self.handle.expect( "\$" )
+            args = utilities.parse_args( [ "SRC", "TARGET" ], **pingParams )
+            command = "mininet/util/m " + \
+                args[ "SRC" ] + " ping " + args[ "TARGET" ] + " -c 4 -W 1 -i .2"
+            main.log.info( command )
+            response = self.execute( cmd=command, prompt="rtt", timeout=10 )
+            if utilities.assert_matches(
+                    expect=',\s0\%\spacket\sloss',
+                    actual=response,
+                    onpass="No Packet loss",
+                    onfail="Host is not reachable" ):
+                main.log.info( "NO PACKET LOSS, HOST IS REACHABLE" )
+                main.lastResult = main.TRUE
+                return main.TRUE
+            else:
+                main.log.error( "PACKET LOST, HOST IS NOT REACHABLE" )
+                main.lastResult = main.FALSE
+                return main.FALSE
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception(self.name + ": Uncaught exception!")
+            main.cleanup()
+            main.exit()
 
     def checknum( self, num ):
         """
         Verifies the correct number of switches are running
         """
-        if self.handle:
-            self.handle.sendline( "" )
-            self.handle.expect( "\$" )
-            self.handle.sendline( 'ifconfig -a | grep "sw.. " | wc -l' )
-            self.handle.expect( "wc" )
-            self.handle.expect( "\$" )
-            response = self.handle.before
-            self.handle.sendline(
-                'ps -ef | grep "bash -ms mininet:sw" | grep -v color | wc -l' )
-            self.handle.expect( "color" )
-            self.handle.expect( "\$" )
-            response2 = self.handle.before
+        try:
+            if self.handle:
+                self.handle.sendline( "" )
+                self.handle.expect( "\$" )
+                self.handle.sendline( 'ifconfig -a | grep "sw.. " | wc -l' )
+                self.handle.expect( "wc" )
+                self.handle.expect( "\$" )
+                response = self.handle.before
+                self.handle.sendline(
+                    'ps -ef | grep "bash -ms mininet:sw" | grep -v color | wc -l' )
+                self.handle.expect( "color" )
+                self.handle.expect( "\$" )
+                response2 = self.handle.before
 
-            if re.search( num, response ):
-                if re.search( num, response2 ):
-                    return main.TRUE
+                if re.search( num, response ):
+                    if re.search( num, response2 ):
+                        return main.TRUE
+                    else:
+                        return main.FALSE
                 else:
                     return main.FALSE
             else:
-                return main.FALSE
-        else:
-            main.log.error( "Connection failed to the host" )
+                main.log.error( "Connection failed to the host" )
+        except pexpect.TIMEOUT:
+            main.log.exception( self.name + ": TIMEOUT exception found in checknum" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            return main.FALSE
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup()
+            main.exit()
 
     def startTcpdump(
             self,
@@ -435,25 +544,39 @@
         """
         Called at the end of the test to disconnect the handle.
         """
-        if self.handle:
-            # Close the ssh connection
-            self.handle.sendline( "" )
-            # self.handle.expect( "\$" )
-            i = self.handle.expect( [ '\$', 'mininet>', pexpect.TIMEOUT,
-                                      pexpect.EOF ], timeout=2 )
-            if i == 0:
-                self.handle.sendline( "exit" )
-                self.handle.expect( "closed" )
-            elif i == 1:
-                self.handle.sendline( "exit" )
-                self.handle.expect( "exit" )
-                self.handle.expect('\$')
-                self.handle.sendline( "exit" )
-                self.handle.expect( "exit" )
-                self.handle.expect( "closed" )
-        else:
-            main.log.error( "Connection failed to the host" )
-        return main.TRUE
+        try:
+            if self.handle:
+                # Close the ssh connection
+                self.handle.sendline( "" )
+                # self.handle.expect( "\$" )
+                i = self.handle.expect( [ '\$', 'mininet>', pexpect.TIMEOUT,
+                                          pexpect.EOF ], timeout=2 )
+                if i == 0:
+                    self.handle.sendline( "exit" )
+                    self.handle.expect( "closed" )
+                elif i == 1:
+                    self.handle.sendline( "exit" )
+                    self.handle.expect( "exit" )
+                    self.handle.expect('\$')
+                    self.handle.sendline( "exit" )
+                    self.handle.expect( "exit" )
+                    self.handle.expect( "closed" )
+            else:
+                main.log.error( "Connection failed to the host" )
+            return main.TRUE
+        except pexpect.TIMEOUT:
+            main.log.exception( self.name + ": TIMEOUT exception found in disconnect" )
+            main.log.error( self.name + ":    " + self.handle.before )
+            return main.FALSE
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except Exception:
+            main.log.exception(self.name + ": Uncaught exception!")
+            main.cleanup()
+            main.exit()
 
     def setIpTablesOUTPUT( self, dstIp, dstPort, action='add',
                            packetType='tcp', rule='DROP' ):
diff --git a/TestON/drivers/common/cli/emulator/scapyclidriver.py b/TestON/drivers/common/cli/emulator/scapyclidriver.py
index 39c5c4d..f1457ea 100644
--- a/TestON/drivers/common/cli/emulator/scapyclidriver.py
+++ b/TestON/drivers/common/cli/emulator/scapyclidriver.py
@@ -1,6 +1,11 @@
 #!/usr/bin/env python
 """
 2015-2016
+Modified 2016 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
 TestON is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -619,7 +624,132 @@
             main.cleanup()
             main.exit()
 
-    def buildICMP( self, **kwargs ):
+    def buildSCTP( self, ipVersion=4, **kwargs ):
+        """
+        Build an SCTP frame
+
+        Will create a frame class with the given options. If a field is
+        left blank it will default to the below value unless it is
+        overwritten by the next frame.
+
+        NOTE: Some arguments require quotes around them. It's up to you to
+        know which ones and to add them yourself. Arguments with an asterisk
+        do not need quotes.
+
+        Options:
+        ipVersion - Either 4 (default) or 6, indicates what Internet Protocol
+                    frame to use to encapsulate into
+        Default frame:
+        ###[ SCTP ]###
+          sport= domain *
+          dport= domain *
+          tag = None
+          chksum = None
+
+        Returns main.TRUE or main.FALSE on error
+        """
+        try:
+            # Set the SCTP frame
+            cmd = 'sctp = SCTP( '
+            options = [ ]
+            for key, value in kwargs.iteritems( ):
+                options.append( str( key ) + "=" + str( value ) )
+            cmd += ", ".join( options )
+            cmd += ' )'
+            self.handle.sendline( cmd )
+            self.handle.expect( self.scapyPrompt )
+            if "Traceback" in self.handle.before:
+                # KeyError, SyntaxError, ...
+                main.log.error( "Error in sending command: " + self.handle.before )
+                return main.FALSE
+            if str( ipVersion ) is '4':
+                self.handle.sendline( "packet = ether/ip/sctp" )
+            elif str( ipVersion ) is '6':
+                self.handle.sendline( "packet = ether/ipv6/sctp" )
+            else:
+                main.log.error( "Unrecognized option for ipVersion, given " +
+                               repr( ipVersion ) )
+                return main.FALSE
+            self.handle.expect( self.scapyPrompt )
+            if "Traceback" in self.handle.before:
+                # KeyError, SyntaxError, ...
+                main.log.error( "Error in sending command: " + self.handle.before )
+                return main.FALSE
+            return main.TRUE
+        except pexpect.TIMEOUT:
+            main.log.exception( self.name + ": Command timed out" )
+            return main.FALSE
+        except pexpect.EOF:
+            main.log.exception( self.name + ": connection closed." )
+            main.cleanup( )
+            main.exit( )
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup( )
+            main.exit( )
+
+    def buildARP( self, **kwargs ):
+        """
+        Build an ARP frame
+
+        Will create a frame class with the given options. If a field is
+        left blank it will default to the below value unless it is
+        overwritten by the next frame.
+
+        NOTE: Some arguments require quotes around them. It's up to you to
+        know which ones and to add them yourself. Arguments with an asterisk
+        do not need quotes.
+
+        Default frame:
+        ###[ ARP ]###
+        hwtype     : XShortField          = (1)
+        ptype      : XShortEnumField      = (2048)
+        hwlen      : ByteField            = (6)
+        plen       : ByteField            = (4)
+        op         : ShortEnumField       = (1)
+        hwsrc      : ARPSourceMACField    = (None)
+        psrc       : SourceIPField        = (None)
+        hwdst      : MACField             = ('00:00:00:00:00:00')
+        pdst       : IPField              = ('0.0.0.0')
+
+        Returns main.TRUE or main.FALSE on error
+        """
+        try:
+            # Set the ARP frame
+            cmd = 'arp = ARP( '
+            options = []
+            for key, value in kwargs.iteritems( ):
+                if isinstance( value, str ):
+                    value = '"' + value + '"'
+                options.append( str( key ) + "=" + str( value ) )
+            cmd += ", ".join( options )
+            cmd += ' )'
+            self.handle.sendline( cmd )
+            self.handle.expect( self.scapyPrompt )
+            if "Traceback" in self.handle.before:
+                # KeyError, SyntaxError, ...
+                main.log.error( "Error in sending command: " + self.handle.before )
+                return main.FALSE
+            self.handle.sendline( "packet = ether/arp" )
+            self.handle.expect( self.scapyPrompt )
+            if "Traceback" in self.handle.before:
+                # KeyError, SyntaxError, ...
+                main.log.error( "Error in sending command: " + self.handle.before )
+                return main.FALSE
+            return main.TRUE
+        except pexpect.TIMEOUT:
+            main.log.exception( self.name + ": Command timed out" )
+            return main.FALSE
+        except pexpect.EOF:
+            main.log.exception( self.name + ": connection closed." )
+            main.cleanup( )
+            main.exit( )
+        except Exception:
+            main.log.exception( self.name + ": Uncaught exception!" )
+            main.cleanup( )
+            main.exit( )
+
+    def buildICMP( self, ipVersion=4, **kwargs ):
         """
         Build an ICMP frame
 
@@ -634,13 +764,24 @@
           id= 0x0
           seq= 0x0
 
+        Options:
+        ipVersion - Either 4 (default) or 6, indicates what Internet Protocol
+                    frame to use to encapsulate into
+
         Returns main.TRUE or main.FALSE on error
         """
         try:
             # Set the ICMP frame
-            cmd = 'icmp = ICMP( '
+            if str( ipVersion ) is '4':
+                cmd = 'icmp = ICMP( '
+            elif str( ipVersion ) is '6':
+                cmd = 'icmp6 = ICMPv6EchoReply( '
+            else:
+                main.log.error( "Unrecognized option for ipVersion, given " +
+                                repr( ipVersion ) )
+                return main.FALSE
             options = []
-            for key, value in kwargs.iteritems():
+            for key, value in kwargs.iteritems( ):
                 if isinstance( value, str ):
                     value = '"' + value + '"'
                 options.append( str( key ) + "=" + str( value ) )
@@ -652,7 +793,15 @@
                 # KeyError, SyntaxError, ...
                 main.log.error( "Error in sending command: " + self.handle.before )
                 return main.FALSE
-            self.handle.sendline( "packet = ether/ip/icmp" )
+
+            if str( ipVersion ) is '4':
+                self.handle.sendline( "packet = ether/ip/icmp" )
+            elif str( ipVersion ) is '6':
+                self.handle.sendline( "packet = ether/ipv6/icmp6" )
+            else:
+                main.log.error( "Unrecognized option for ipVersion, given " +
+                               repr( ipVersion ) )
+                return main.FALSE
             self.handle.expect( self.scapyPrompt )
             if "Traceback" in self.handle.before:
                 # KeyError, SyntaxError, ...
@@ -664,12 +813,12 @@
             return main.FALSE
         except pexpect.EOF:
             main.log.exception( self.name + ": connection closed." )
-            main.cleanup()
-            main.exit()
+            main.cleanup( )
+            main.exit( )
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            main.cleanup( )
+            main.exit( )
 
     def sendPacket( self, iface=None, packet=None, timeout=1 ):
         """
@@ -817,12 +966,15 @@
             main.exit()
         return self.handle.before
 
-    def updateSelf( self ):
+    def updateSelf( self, IPv6=False ):
         """
         Updates local MAC and IP fields
         """
         self.hostMac = self.getMac()
-        self.hostIp = self.getIp()
+        if IPv6:
+            self.hostIp = self.getIp( IPv6=True )
+        else:
+            self.hostIp = self.getIp()
 
     def getMac( self, ifaceName=None ):
         """
@@ -852,24 +1004,33 @@
             main.cleanup()
             main.exit()
 
-    def getIp( self, ifaceName=None ):
+    def getIp( self, ifaceName=None, IPv6=False ):
         """
         Save host's IP address
 
         Returns the IP of the first interface that is not a loopback device.
         If no IP could be found then it will return 0.0.0.0.
+
+        If IPv6 is equal to True, returns IPv6 of the first interface that is not a loopback device.
+        If no IPv6 could be found then it will return :: .
+
         """
         def getIPofInterface( ifaceName ):
             cmd = 'get_if_addr("' + str( ifaceName ) + '")'
+            if IPv6:
+                cmd = 'get_if_raw_addr6("' + str( ifaceName ) + '")'
             self.handle.sendline( cmd )
             self.handle.expect( self.scapyPrompt )
 
             pattern = r'(((2[0-5]|1[0-9]|[0-9])?[0-9]\.){3}((2[0-5]|1[0-9]|[0-9])?[0-9]))'
+            if IPv6:
+                pattern = r'(\\x([0-9]|[a-f]|[A-F])([0-9]|[a-f]|[A-F])){16}'
             match = re.search( pattern, self.handle.before )
             if match:
                 # NOTE: The command will return 0.0.0.0 if the iface doesn't exist
-                if match.group() == '0.0.0.0':
-                    main.log.warn( 'iface {0} has no IPv4 address'.format( ifaceName ) )
+                if IPv6 != True:
+                    if match.group() == '0.0.0.0':
+                        main.log.warn( 'iface {0} has no IPv4 address'.format( ifaceName ) )
                 return match.group()
             else:
                 return None
@@ -877,13 +1038,33 @@
             if not ifaceName:
                 # Get list of interfaces
                 ifList = self.getIfList()
-                for ifaceName in ifList:
-                    if ifaceName == "lo":
-                        continue
-                    ip = getIPofInterface( ifaceName )
-                    if ip != "0.0.0.0":
-                        return ip
-                return "0.0.0.0"
+                if IPv6:
+                    for ifaceName in ifList:
+                        if ifaceName == "lo":
+                            continue
+                        ip = getIPofInterface( ifaceName )
+                        if ip != None:
+                            newip =ip
+                            tmp = newip.split( "\\x" )
+                            ip = ""
+                            counter = 0
+                            for i in tmp:
+                                if i != "":
+                                    counter = counter + 1;
+                                    if counter % 2 == 0 and counter < 16:
+                                        ip = ip + i + ":"
+                                    else:
+                                        ip = ip + i
+                            return ip
+                    return "::"
+                else:
+                    for ifaceName in ifList:
+                        if ifaceName == "lo":
+                            continue
+                        ip = getIPofInterface( ifaceName )
+                        if ip != "0.0.0.0":
+                            return ip
+                    return "0.0.0.0"
             else:
                 return getIPofInterface( ifaceName )
 
diff --git a/TestON/drivers/common/cli/emulatordriver.py b/TestON/drivers/common/cli/emulatordriver.py
index fa0309e..fb7a80d 100644
--- a/TestON/drivers/common/cli/emulatordriver.py
+++ b/TestON/drivers/common/cli/emulatordriver.py
@@ -1,6 +1,11 @@
 #!/usr/bin/env python
 """
 Created on 26-Oct-2012
+Modified 2015 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
 author:: Anil Kumar ( anilkumar.s@paxterrasolutions.com )
 
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index cd9f2f8..5ed20ef 100755
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -14,6 +14,11 @@
 shreya@onlab.us
 
 OCT 13 2014
+Modified 2016 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
 """
 import pexpect
@@ -441,7 +446,7 @@
         the onos> prompt. Use this function if you have
         a very specific command to send.
 
-        if noExit is True, TestON will not exit, but clean up
+        if noExit is True, TestON will not exit, and return None
 
         Warning: There are no sanity checking to commands
         sent using this method.
@@ -460,8 +465,11 @@
                         main.log.info( self.name + ": onos cli session reconnected." )
                     else:
                         main.log.error( self.name + ": reconnection failed." )
-                        main.cleanup()
-                        main.exit()
+                        if noExit:
+                            return None
+                        else:
+                            main.cleanup()
+                            main.exit()
                 else:
                     main.cleanup()
                     main.exit()
@@ -529,7 +537,6 @@
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":    " + self.handle.before )
             if noExit:
-                main.cleanup()
                 return None
             else:
                 main.cleanup()
@@ -537,7 +544,6 @@
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
             if noExit:
-                main.cleanup()
                 return None
             else:
                 main.cleanup()
@@ -2229,12 +2235,13 @@
             main.cleanup()
             main.exit()
 
-    def checkIntentSummary( self, timeout=60 ):
+    def checkIntentSummary( self, timeout=60, noExit=True ):
         """
         Description:
             Check the number of installed intents.
         Optional:
             timeout - the timeout for pexcept
+            noExit - If noExit, TestON will not exit if any except.
         Return:
             Returns main.TRUE only if the number of all installed intents are the same as total intents number
             , otherwise, returns main.FALSE.
@@ -2244,7 +2251,7 @@
             cmd = "intents -s -j"
 
             # Check response if something wrong
-            response = self.sendline( cmd, timeout=timeout )
+            response = self.sendline( cmd, timeout=timeout, noExit=noExit )
             if response == None:
                 return main.FALSE
             response = json.loads( response )
@@ -2263,12 +2270,18 @@
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":    " + self.handle.before )
-            main.cleanup()
-            main.exit()
+            if noExit:
+                return main.FALSE
+            else:
+                main.cleanup()
+                main.exit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            if noExit:
+                return main.FALSE
+            else:
+                main.cleanup()
+                main.exit()
         except pexpect.TIMEOUT:
             main.log.error( self.name + ": ONOS timeout" )
             return None
@@ -2314,7 +2327,8 @@
             main.exit()
 
     def checkFlowCount(self, min=0, timeout=60 ):
-        count = int(self.getTotalFlowsNum( timeout=timeout ))
+        count = self.getTotalFlowsNum( timeout=timeout )
+        count = int (count) if count else 0
         return count if (count > min) else False
 
     def checkFlowsState( self, isPENDING=True, timeout=60,noExit=False ):
@@ -2450,71 +2464,55 @@
             Get the number of ADDED flows.
         Return:
             The number of ADDED flows
+            Or return None if any exceptions
         """
 
         try:
             # get total added flows number
-            cmd = "flows -s|grep ADDED|wc -l"
-            totalFlows = self.sendline( cmd, timeout=timeout, noExit=noExit )
-
-            if totalFlows == None:
-                # if timeout, we will get total number of all flows, and subtract other states
-                states = ["PENDING_ADD", "PENDING_REMOVE", "REMOVED", "FAILED"]
-                checkedStates = []
+            cmd = "flows -c added"
+            rawFlows = self.sendline( cmd, timeout=timeout, noExit=noExit )
+            if rawFlows:
+                rawFlows = rawFlows.split("\n")
                 totalFlows = 0
-                statesCount = [0, 0, 0, 0]
-
-                # get total flows from summary
-                response = json.loads( self.sendline( "summary -j", timeout=timeout, noExit=noExit ) )
-                totalFlows = int( response.get("flows") )
-
-                for s in states:
-                    rawFlows = self.flows( state=s, timeout = timeout )
-                    if rawFlows == None:
-                        # if timeout, return the total flows number from summary command
-                        return totalFlows
-                    checkedStates.append( json.loads( rawFlows ) )
-
-                # Calculate ADDED flows number, equal total subtracts others
-                for i in range( len( states ) ):
-                    for c in checkedStates[i]:
-                        try:
-                            statesCount[i] += int( c.get( "flowCount" ) )
-                        except TypeError:
-                            main.log.exception( "Json object not as expected" )
-                    totalFlows = totalFlows - int( statesCount[i] )
-                    main.log.info( states[i] + " flows: " + str( statesCount[i] ) )
-
-                return totalFlows
-
-            return int(totalFlows)
+                for l in rawFlows:
+                    totalFlows += int(l.split("Count=")[1])
+            else:
+                main.log.error("Response not as expected!")
+                return None
+            return totalFlows
 
         except ( TypeError, ValueError ):
-            main.log.exception( "{}: Object not as expected: {!r}".format( self.name, rawFlows ) )
+            main.log.exception( "{}: Object not as expected!".format( self.name ) )
             return None
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":    " + self.handle.before )
-            main.cleanup()
-            main.exit()
+            if not noExit:
+                main.cleanup()
+                main.exit()
+            return None
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            if not noExit:
+                main.cleanup()
+                main.exit()
+            return None
         except pexpect.TIMEOUT:
             main.log.error( self.name + ": ONOS timeout" )
             return None
 
-    def getTotalIntentsNum( self, timeout=60 ):
+    def getTotalIntentsNum( self, timeout=60, noExit = False ):
         """
         Description:
             Get the total number of intents, include every states.
+        Optional:
+            noExit - If noExit, TestON will not exit if any except.
         Return:
             The number of intents
         """
         try:
             cmd = "summary -j"
-            response = self.sendline( cmd, timeout=timeout )
+            response = self.sendline( cmd, timeout=timeout, noExit=noExit )
             if response == None:
                 return  -1
             response = json.loads( response )
@@ -2525,12 +2523,18 @@
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":    " + self.handle.before )
-            main.cleanup()
-            main.exit()
+            if noExit:
+                return -1
+            else:
+                main.cleanup()
+                main.exit()
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.cleanup()
-            main.exit()
+            if noExit:
+                return -1
+            else:
+                main.cleanup()
+                main.exit()
 
     def intentsEventsMetrics( self, jsonFormat=True ):
         """
@@ -2812,9 +2816,13 @@
         """
         import json
         try:
+            summary = self.summary()
+            summary = json.loads( summary )
+        except ( TypeError, ValueError ):
+            main.log.exception( "{}: Object not as expected: {!r}".format( self.name, summary ) )
+            return main.ERROR
+        try:
             topology = self.getTopology( self.topology() )
-            summary = json.loads( self.summary() )
-
             if topology == {} or topology == None or summary == {} or summary == None:
                 return main.ERROR
             output = ""
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index e749ce2..635178e 100755
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -14,6 +14,11 @@
 andrew@onlab.us
 
 OCT 9 2014
+Modified 2016 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
 """
 import time
@@ -2364,4 +2369,4 @@
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanup()
-            main.exit()
\ No newline at end of file
+            main.exit()
diff --git a/TestON/drivers/common/cli/quaggaclidriver.py b/TestON/drivers/common/cli/quaggaclidriver.py
index e89047e..721ae6a 100644
--- a/TestON/drivers/common/cli/quaggaclidriver.py
+++ b/TestON/drivers/common/cli/quaggaclidriver.py
@@ -1,4 +1,11 @@
 #!/usr/bin/env python
+"""
+Modified 2015 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
+"""
 
 import time
 import pexpect
diff --git a/TestON/drivers/common/cli/remotesysdriver.py b/TestON/drivers/common/cli/remotesysdriver.py
index 963b8f4..a56f644 100644
--- a/TestON/drivers/common/cli/remotesysdriver.py
+++ b/TestON/drivers/common/cli/remotesysdriver.py
@@ -1,6 +1,11 @@
 #!/usr/bin/env python
 """
 Created on 26-Oct-2012
+Modified 2015 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
 author:: Anil Kumar ( anilkumar.s@paxterrasolutions.com )
 
diff --git a/TestON/drivers/common/cli/remotetestbed/floodlightclidriver.py b/TestON/drivers/common/cli/remotetestbed/floodlightclidriver.py
index a000806..4f55a90 100644
--- a/TestON/drivers/common/cli/remotetestbed/floodlightclidriver.py
+++ b/TestON/drivers/common/cli/remotetestbed/floodlightclidriver.py
@@ -1,6 +1,11 @@
 #!/usr/bin/env python
 """
 Created on 12-Feb-2013
+Modified 2015 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
 author:: Anil Kumar ( anilkumar.s@paxterrasolutions.com )
 
diff --git a/TestON/drivers/common/cli/remotetestbed/necswitchdriver.py b/TestON/drivers/common/cli/remotetestbed/necswitchdriver.py
index 07fb668..aea470d 100644
--- a/TestON/drivers/common/cli/remotetestbed/necswitchdriver.py
+++ b/TestON/drivers/common/cli/remotetestbed/necswitchdriver.py
@@ -1,3 +1,11 @@
+"""
+Modified 2015 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
+"""
+
 class NEC:
 
     def __init__( self ):
diff --git a/TestON/drivers/common/cli/remotetestbed/remotepoxdriver.py b/TestON/drivers/common/cli/remotetestbed/remotepoxdriver.py
index 6f2f90c..50100c9 100644
--- a/TestON/drivers/common/cli/remotetestbed/remotepoxdriver.py
+++ b/TestON/drivers/common/cli/remotetestbed/remotepoxdriver.py
@@ -1,6 +1,11 @@
 #!/usr/bin/env python
 """
 Created on 12-Feb-2013
+Modified 2015 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
 author:: Anil Kumar ( anilkumar.s@paxterrasolutions.com )
 
diff --git a/TestON/drivers/common/cli/remotetestbed/remotevmdriver.py b/TestON/drivers/common/cli/remotetestbed/remotevmdriver.py
index 892d998..f4a1f1a 100644
--- a/TestON/drivers/common/cli/remotetestbed/remotevmdriver.py
+++ b/TestON/drivers/common/cli/remotetestbed/remotevmdriver.py
@@ -1,6 +1,11 @@
 #!/usr/bin/env python
 """
 Created on 12-Feb-2013
+Modified 2015 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
 author:: Anil Kumar ( anilkumar.s@paxterrasolutions.com )
 
diff --git a/TestON/drivers/common/cli/remotetestbeddriver.py b/TestON/drivers/common/cli/remotetestbeddriver.py
index acb9ccc..ebf8fbe 100644
--- a/TestON/drivers/common/cli/remotetestbeddriver.py
+++ b/TestON/drivers/common/cli/remotetestbeddriver.py
@@ -1,6 +1,11 @@
 #!/usr/bin/env python
 """
 Created on 26-Oct-2012
+Modified 2015 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
 author:: Anil Kumar ( anilkumar.s@paxterrasolutions.com )
 
diff --git a/TestON/drivers/common/cli/tool/dpctlclidriver.py b/TestON/drivers/common/cli/tool/dpctlclidriver.py
index 504567c..683f16e 100644
--- a/TestON/drivers/common/cli/tool/dpctlclidriver.py
+++ b/TestON/drivers/common/cli/tool/dpctlclidriver.py
@@ -1,6 +1,11 @@
 #/usr/bin/env python
 """
 Created on 26-Nov-2012
+Modified 2015 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
 author:: Raghav Kashyap( raghavkashyap@paxterrasolutions.com )
 
diff --git a/TestON/drivers/common/cli/toolsdriver.py b/TestON/drivers/common/cli/toolsdriver.py
index 775902f..c96cb4f 100644
--- a/TestON/drivers/common/cli/toolsdriver.py
+++ b/TestON/drivers/common/cli/toolsdriver.py
@@ -1,6 +1,11 @@
 #!/usr/bin/env python
 """
 Created on 26-Nov-2012
+Modified 2015 by ON.Lab
+
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
 author:: Raghav Kashyap( raghavkashyap@paxterrasolutions.com )
 
diff --git a/TestON/drivers/common/clidriver.py b/TestON/drivers/common/clidriver.py
index a7404fa..283088d 100644
--- a/TestON/drivers/common/clidriver.py
+++ b/TestON/drivers/common/clidriver.py
@@ -1,10 +1,11 @@
 #!/usr/bin/env python
 """
 Created on 24-Oct-2012
+Modified 2016 by ON.Lab
 
-author:s: Anil Kumar ( anilkumar.s@paxterrasolutions.com ),
-          Raghav Kashyap( raghavkashyap@paxterrasolutions.com )
-
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
     TestON is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -18,9 +19,6 @@
 
     You should have received a copy of the GNU General Public License
     along with TestON.  If not, see <http://www.gnu.org/licenses/>.
-
-
-
 """
 import pexpect
 import re
diff --git a/TestON/drivers/component.py b/TestON/drivers/component.py
index b8a66e9..fc17d47 100644
--- a/TestON/drivers/component.py
+++ b/TestON/drivers/component.py
@@ -1,10 +1,11 @@
 #!/usr/bin/env python
 """
 Created on 24-Oct-2012
+Modified 2015 by ON.Lab
 
-author:s: Anil Kumar ( anilkumar.s@paxterrasolutions.com ),
-          Raghav Kashyap( raghavkashyap@paxterrasolutions.com )
-
+Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
+the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
+or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
 
     TestON is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -18,9 +19,6 @@
 
     You should have received a copy of the GNU General Public License
     along with TestON.  If not, see <http://www.gnu.org/licenses/>.
-
-
-
 """
 import logging
 
diff --git a/TestON/install.sh b/TestON/install.sh
index dee85c9..0327ca7 100755
--- a/TestON/install.sh
+++ b/TestON/install.sh
@@ -8,89 +8,234 @@
 # Fail on unset var usage
 set -o nounset
 
-# Identify Linux release
-DIST=Unknown
-RELEASE=Unknown
-CODENAME=Unknown
+function init {
+    # Identify Linux release
+    DIST=Unknown
+    RELEASE=Unknown
+    CODENAME=Unknown
 
-ARCH=`uname -m`
-if [ "$ARCH" = "x86_64" ]; then ARCH="amd64"; fi
-if [ "$ARCH" = "i686" ]; then ARCH="i386"; fi
+    ARCH=`uname -m`
+    if [ "$ARCH" = "x86_64" ]; then ARCH="amd64"; fi
+    if [ "$ARCH" = "i686" ]; then ARCH="i386"; fi
 
-if [ -e /etc/debian_version ]; then DIST="Debian"; fi
-if [ -e /etc/fedora-release ]; then DIST="Debian"; fi
-grep Ubuntu /etc/lsb-release &> /dev/null && DIST="Ubuntu"
+    if [ -e /etc/debian_version ]; then DIST="Debian"; fi
+    if [ -e /etc/fedora-release ]; then DIST="Debian"; fi
+    grep Ubuntu /etc/lsb-release &> /dev/null && DIST="Ubuntu"
 
-if [ "$DIST" = "Ubuntu" ] || [ "$DIST" = "Debian" ]; then
-    install='sudo apt-get -y install'
-    remove='sudo apt-get -y remove'
-    pipinstall='sudo pip install'
-    # Prereqs for this script
-    if ! which lsb_release &> /dev/null; then
-        $install lsb-release
+    if [ "$DIST" = "Ubuntu" ] || [ "$DIST" = "Debian" ]; then
+        install='sudo apt-get -y install'
+        remove='sudo apt-get -y remove'
+        pipinstall='sudo pip install'
+        # Prereqs for this script
+        if ! which lsb_release &> /dev/null; then
+            $install lsb-release
+        fi
     fi
-fi
 
-if [ "$DIST" = "Fedora" ]; then
-    install='sudo yum -y install'
-    remove='sudo yum -y erase'
-    pipinstall='sudo pip install'
-    # Prereqs for this script
-    if ! which lsb_release &> /dev/null; then
-        $install redhat-lsb-core
+    if [ "$DIST" = "Fedora" ]; then
+        install='sudo yum -y install'
+        remove='sudo yum -y erase'
+        pipinstall='sudo pip install'
+        # Prereqs for this script
+        if ! which lsb_release &> /dev/null; then
+            $install redhat-lsb-core
+        fi
     fi
-fi
-if which lsb_release &> /dev/null; then
-    DIST=`lsb_release -is`
-    RELEASE=`lsb_release -rs`
-    CODENAME=`lsb_release -cs`
-fi
-echo "Detected Linux distribution: $DIST $RELEASE $CODENAME $ARCH"
+    if which lsb_release &> /dev/null; then
+        DIST=`lsb_release -is`
+        RELEASE=`lsb_release -rs`
+        CODENAME=`lsb_release -cs`
+    fi
+    echo "Detected Linux distribution: $DIST $RELEASE $CODENAME $ARCH"
 
-if ! echo $DIST | egrep 'Ubuntu|Debian|Fedora'; then
-    echo "Install.sh currently only supports Ubuntu, Debian and Fedora."
-    exit 1
-fi
+    if ! echo $DIST | egrep 'Ubuntu|Debian|Fedora'; then
+        echo "Install.sh currently only supports Ubuntu, Debian and Fedora."
+        exit 1
+    fi
 
-# Check OnosSystemTest is cloned in home directory.
-if [ ! -d ~/OnosSystemTest ]; then
-    echo "Could not find OnosSystemTest in your home directory."
-    echo "Exiting from running install script."
-    exit 1
-fi
+    #Get location of TestON dir
+    SOURCE="${BASH_SOURCE[0]}"
+    while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
+        DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+        SOURCE="$(readlink "$SOURCE")"
+        [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
+    done
+    DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+    echo "Found TestON at $DIR"
+}
 
-# Install TestON dependencies
-echo "Installing TestON dependencies"
-if [ "$DIST" = "Fedora" ]; then
-    # Fedora may have vlan enabled by default. Still need to confirm and update later
-    $install python-pip build-essential python-dev pep8 arping python3-requests
-    $pipinstall pexpect==3.2 configobj==4.7.2 numpy
+function requirements {
+    system_reqs
+    python_reqs
+}
+
+function system_reqs {
+    # Specify a specific command with $1
+    set +o nounset
+    if [ -z $1 ]
+    then
+        cmd=$install
+    else
+        cmd=$1
+    fi
+    set -o nounset
+    # Install TestON dependencies
+    echo "Installing TestON dependencies"
+    if [ "$DIST" = "Fedora" ]; then
+        # Fedora may have vlan enabled by default. Still need to confirm and update later
+        $cmd python-pip build-essential python-dev pep8 python3-requests
+    else
+        $cmd python-pip build-essential python-dev pep8 vlan python3-requests
+    fi
+
+    # Some Distos have this already from another package
+    if which arping > /dev/null ; then
+        echo "Arping command detected, skipping package installation."
+    else
+        $cmd arping
+    fi
+}
+
+function python_reqs {
+    # Specify a specific pip command with $1
+    set +o nounset
+    if [ -z $1 ]
+    then
+        cmd=$pipinstall
+    else
+        cmd=$1' install'
+    fi
+    set -o nounset
+    $cmd -r requirements.txt
+}
+
+function symlinks {
+    set +e
+    # Add symbolic link to main TestON folder in Home dir
+    pushd ~
+    sudo ln -s $DIR && echo "Added symbolic link to TestON folder in HOME directory."
+    popd
+
+    # Add symbolic link to TestON cli in /usr/local/bin
+    pushd /usr/local/bin
+    sudo ln -s $DIR/bin/cli.py teston && echo "Added symbolic link to TestON CLI in /usr/local/bin."
+    popd
+
+    # Add symlink to get bash completion
+    pushd /etc/bash_completion.d
+    sudo cp $DIR/bin/.teston_completion teston_completion
+    echo "Bash completion will now be enabled for new shells"
+    popd
+    set -e
+}
+
+function git {
+    # OnosSystemTest git pre-commit hooks
+    pushd $DIR/..
+    cp .git/hooks/pre-commit.sample .git/hooks/pre-commit
+    popd
+}
+
+function get_pypy {
+    echo "Getting pypy"
+    pushd ~
+    if [ ! -e pypy2-v5.3.1-linux64.tar.bz2 ]
+    then
+        wget https://bitbucket.org/pypy/pypy/downloads/pypy2-v5.3.1-linux64.tar.bz2
+    fi
+    tar xf pypy2-v5.3.1-linux64.tar.bz2
+    python_impl=~/pypy2-v5.3.1-linux64/bin/pypy
+    popd
+    venv $python_impl "venv-teston-pypy"
+}
+
+# Optionally install in virtual env
+function venv {
+    # $1 is the path to python implementation, $2 is the venv-name
+    echo "Installing virtual env for TestON..."
+    pushd $DIR
+    set +o nounset
+    if [ -z "$2" ]
+    then
+        venv_name="venv-teston"
+    else
+        venv_name=$2
+    fi
+    pip install virtualenv
+
+    # Setup virtual env
+    if [ -z "$1" ]; then
+        echo "No python implementation specified for virtual env, using default."
+        virtualenv $venv_name
+    else
+        python_impl=$1
+        echo "Using $python_impl for python in virtual env."
+        virtualenv -p $python_impl $venv_name
+    fi
+    python_reqs $venv_name/bin/pip
+    set -o nounset
+    popd
+}
+
+
+function default {
+    requirements
+    symlinks
+    git
+}
+
+function finished {
+    echo ""
+    echo "Completed running install.sh script"
+    echo "Run TestON CLI by typing teston at bash prompt"
+    echo "Example: teston run <TestSuite Name>"
+}
+
+# TODO Add log rotation configuration for TestON logs here (place holder)
+# TODO Add bash tab completion script to this
+
+function usage {
+    printf "Usage: $(basename $0) [-dgprsv] \n"
+    printf "Usage: $(basename $0) -y [PATH] \n\n"
+    printf "This install script attempts to install deoendencies needed to run teston\n"
+    printf "and any tests included in the official repository. If a test still does \n"
+    printf "not run after running this script, you can try looking at the test's README\n"
+    printf "or the driver files used by the tests. There are some software components\n"
+    printf "such as software switches that this script does not attempt to install as\n"
+    printf "they are more complicated.\n\n"
+
+    printf "Options:\n"
+    printf "\t -d (default) requirements, symlinks and git hooks\n"
+    printf "\t -g install git hooks\n"
+    printf "\t -p install pypy in a virtual env\n"
+    printf "\t -r install requirements for TestON/tests\n"
+    printf "\t -s install symlinks\n"
+    printf "\t -v install a python virtual environment for teston using the default python implementation\n"
+    printf "\t -y <PATH> install a python virtual environment for testonusing a specific python implementation at PATH.\n"
+
+}
+
+if [ $# -eq 0 ]
+then
+    default
+elif [ $1 == "--help" ]
+then
+    usage
 else
-    $install python-pip build-essential python-dev pep8 vlan arping python3-requests
-    $pipinstall pexpect==3.2 configobj==4.7.2 numpy
+    init
+    while getopts 'dgprsvy:' OPTION
+    do
+      case $OPTION in
+      d)    default;;
+      g)    git;;
+      p)    get_pypy;;
+      r)    requirements;;
+      s)    symlinks;;
+      v)    venv;;
+      y)    venv  $OPTARG;;
+      ?)    usage;;
+      esac
+  done
+  shift $(($OPTIND -1))
+  finished
 fi
-
-# Add check here to make sure OnosSystemTest is cloned into home directory (place holder)
-
-# Add symbolic link to main TestON folder in Home dir
-pushd ~
-sudo ln -s ~/OnosSystemTest/TestON TestON
-echo "Added symbolic link to TestON folder in HOME directory."
-popd
-
-# OnosSystemTest git pre-commit hooks
-pushd ~/OnosSystemTest
-cp .git/hooks/pre-commit.sample .git/hooks/pre-commit
-popd
-
-# Add symbolic link to TestON cli in /usr/local/bin
-pushd /usr/local/bin
-sudo ln -s $HOME/OnosSystemTest/TestON/bin/cli.py teston
-echo "Added symbolic link to TestON CLI in /usr/local/bin."
-popd
-
-# Add log rotation configuration for TestON logs here (place holder)
-
-echo "Completed running install.sh script"
-echo "Run TestON CLI by typing teston at bash prompt"
-echo "Example: teston run <TestSuite Name>"
diff --git a/TestON/requirements.txt b/TestON/requirements.txt
new file mode 100644
index 0000000..86c8741
--- /dev/null
+++ b/TestON/requirements.txt
@@ -0,0 +1,13 @@
+astroid==1.0.1
+autopep8==1.1
+configobj==4.7.2
+epydoc==3.0.1
+flake8==2.4.1
+numpy==1.9.1
+pep8==1.5.7
+pep8-naming==0.3.3
+pexpect==3.2
+pyflakes==0.8.1
+pylint==1.1.0
+requests==2.2.1
+scapy==2.3.1
diff --git a/TestON/tests/CHOTestMonkey/CHOTestMonkey.params b/TestON/tests/CHOTestMonkey/CHOTestMonkey.params
index 848e4cc..6c9ef4b 100644
--- a/TestON/tests/CHOTestMonkey/CHOTestMonkey.params
+++ b/TestON/tests/CHOTestMonkey/CHOTestMonkey.params
@@ -15,12 +15,13 @@
     # 50. Set FlowObjective to True
     # 51. Set FlowObjective to False
     # 60. Rebalance devices across controllers
-    # 70. Randomly generate events
+    # 70. Run randomly generated events
+    # 80. Replay events from log file
     # 90. Sleep for some time
-    # 100. Do something else
+    # 100. Do nothing
     # Sample sequence: 0,1,2,3,[10,30,21,31,10,32,21,33,50,10,30,21,31,10,32,21,33,51,40,60,10,30,21,31,10,32,21,33,50,10,30,21,31,10,32,21,33,51,41,60]*500,100
     <testcases>
-        0,1,2,3,70,[30,21,31,32,21,33]*500,100
+        0,1,2,3,70
     </testcases>
 
     <TEST>
@@ -391,6 +392,12 @@
         <deviceDownWeight>2</deviceDownWeight>
     </CASE70>
 
+    <CASE80>
+        <filePath>/home/admin/log-for-replay</filePath>
+        <sleepTime>0.1</sleepTime>
+        <skipChecks>on</skipChecks>
+    </CASE80>
+
     <CASE90>
         <sleepSec>60</sleepSec>
     </CASE90>
diff --git a/TestON/tests/CHOTestMonkey/CHOTestMonkey.py b/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
index 11459b3..8937a4a 100644
--- a/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
+++ b/TestON/tests/CHOTestMonkey/CHOTestMonkey.py
@@ -794,7 +794,7 @@
                 events.append( 'device-down' )
             for i in range( int( pow( hostIntentNum, 1.5 ) / 100 ) ):
                 events.append( 'del-host-intent' )
-            for i in range( int( pow( pointIntentNum/2, 1.5 ) / 100 ) ):
+            for i in range( int( pow( pointIntentNum, 1.5 ) / 100 ) ):
                 events.append( 'del-point-intent' )
             for i in range( pow( 2, downLinkNum ) - 1 ):
                 events.append( 'link-up' )
@@ -806,30 +806,26 @@
                 n = random.randint( 5, 50 )
                 for i in range( n ):
                     cliIndex = random.sample( upControllers, 1 )[ 0 ]
-                    main.eventGenerator.triggerEvent( EventType().APP_INTENT_HOST_ADD, EventScheduleMethod().RUN_NON_BLOCK, 'random', 'random', cliIndex )
+                    main.eventGenerator.triggerEvent( EventType().APP_INTENT_HOST_ADD, EventScheduleMethod().RUN_BLOCK, 'random', 'random', cliIndex )
                     hostIntentNum += 1
-                main.eventGenerator.triggerEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
             elif event == 'del-host-intent':
                 n = random.randint( 5, hostIntentNum )
                 for i in range( n ):
                     cliIndex = random.sample( upControllers, 1 )[ 0 ]
-                    main.eventGenerator.triggerEvent( EventType().APP_INTENT_HOST_DEL, EventScheduleMethod().RUN_NON_BLOCK, 'random', 'random', cliIndex )
+                    main.eventGenerator.triggerEvent( EventType().APP_INTENT_HOST_DEL, EventScheduleMethod().RUN_BLOCK, 'random', 'random', cliIndex )
                     hostIntentNum -= 1
-                main.eventGenerator.triggerEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
             elif event == 'add-point-intent':
                 n = random.randint( 5, 50 )
                 for i in range( n ):
                     cliIndex = random.sample( upControllers, 1 )[ 0 ]
-                    main.eventGenerator.triggerEvent( EventType().APP_INTENT_POINT_ADD, EventScheduleMethod().RUN_NON_BLOCK, 'random', 'random', cliIndex, 'bidirectional' )
-                    pointIntentNum += 1
-                main.eventGenerator.triggerEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
+                    main.eventGenerator.triggerEvent( EventType().APP_INTENT_POINT_ADD, EventScheduleMethod().RUN_BLOCK, 'random', 'random', cliIndex, 'bidirectional' )
+                    pointIntentNum += 2
             elif event == 'del-point-intent':
-                n = random.randint( 5, pointIntentNum )
+                n = random.randint( 5, pointIntentNum / 2 )
                 for i in range( n ):
                     cliIndex = random.sample( upControllers, 1 )[ 0 ]
-                    main.eventGenerator.triggerEvent( EventType().APP_INTENT_POINT_DEL, EventScheduleMethod().RUN_NON_BLOCK, 'random', 'random', cliIndex, 'bidirectional' )
-                    pointIntentNum -= 1
-                main.eventGenerator.triggerEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
+                    main.eventGenerator.triggerEvent( EventType().APP_INTENT_POINT_DEL, EventScheduleMethod().RUN_BLOCK, 'random', 'random', cliIndex, 'bidirectional' )
+                    pointIntentNum -= 2
             elif event == 'link-down':
                 main.eventGenerator.triggerEvent( EventType().NETWORK_LINK_DOWN, EventScheduleMethod().RUN_BLOCK, 'random', 'random' )
                 downLinkNum += 1
@@ -849,7 +845,6 @@
             main.eventGenerator.triggerEvent( EventType().CHECK_TRAFFIC, EventScheduleMethod().RUN_NON_BLOCK )
             main.eventGenerator.triggerEvent( EventType().CHECK_FLOW, EventScheduleMethod().RUN_NON_BLOCK )
             main.eventGenerator.triggerEvent( EventType().CHECK_INTENT, EventScheduleMethod().RUN_NON_BLOCK )
-            main.eventGenerator.triggerEvent( EventType().NULL, EventScheduleMethod().RUN_BLOCK )
             with main.eventScheduler.idleCondition:
                 while not main.eventScheduler.isIdle():
                     main.eventScheduler.idleCondition.wait()
@@ -860,6 +855,45 @@
                                  onfail="Randomly generate events test failed" )
         time.sleep( main.caseSleep )
 
+    def CASE80( self, main ):
+        """
+        Replay events from log file
+        """
+        import time
+        from tests.CHOTestMonkey.dependencies.events.Event import EventType
+        from tests.CHOTestMonkey.dependencies.EventScheduler import EventScheduleMethod
+
+        main.log.report( "Replay events from log file" )
+        main.log.report( "__________________________________________________" )
+        main.case( "Replay events from log file" )
+        main.step( "Replay events from log file" )
+        main.caseResult = main.TRUE
+        try:
+            f = open( main.params[ 'CASE80' ][ 'filePath' ], 'r' )
+            for line in f.readlines():
+                if 'CHOTestMonkey' in line and 'Event recorded' in line:
+                    line = line.split()
+                    eventIndex = int( line[ 9 ] )
+                    eventName = line[ 10 ]
+                    args = line[ 11: ]
+                    assert eventName.startswith( 'CHECK' )\
+                    or eventName.startswith( 'NETWORK' )\
+                    or eventName.startswith( 'APP' )\
+                    or eventName.startswith( 'ONOS' )
+                    if main.params[ 'CASE80' ][ 'skipChecks' ] == 'on' and eventName.startswith( 'CHECK' ):
+                        continue
+                    with main.eventScheduler.idleCondition:
+                        while not main.eventScheduler.isIdle():
+                            main.eventScheduler.idleCondition.wait()
+                    main.eventGenerator.triggerEvent( eventIndex, EventScheduleMethod().RUN_BLOCK, *args )
+                    time.sleep( float( main.params[ 'CASE80' ][ 'sleepTime' ] ) )
+        except Exception as e:
+            print e
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=main.caseResult,
+                                 onpass="Replay from log file passed",
+                                 onfail="Replay from log file failed" )
+
     def CASE90( self, main ):
         """
         Sleep for some time
diff --git a/TestON/tests/CHOTestMonkey/dependencies/EventTrigger.py b/TestON/tests/CHOTestMonkey/dependencies/EventTrigger.py
index 0c3e0e0..27b8166 100644
--- a/TestON/tests/CHOTestMonkey/dependencies/EventTrigger.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/EventTrigger.py
@@ -15,7 +15,7 @@
     address = ( host, port )
     conn = Client( address )
     request = []
-    request.append( 2 )
+    request.append( 1 )
     request.append( type )
     request.append( scheduleMethod )
     for arg in args:
@@ -23,7 +23,9 @@
     conn.send( request )
     response = conn.recv()
     while response == 11:
+        conn.close()
         time.sleep( 1 )
+        conn = Client( address )
         conn.send( request )
         response = conn.recv()
     if response == 10:
@@ -64,5 +66,19 @@
         else:
             pass
 
+def replayFromFile( filePath='/home/admin/event-list', sleepTime=1 ):
+    try:
+        f = open( filePath, 'r' )
+        for line in f.readlines():
+            event = line.split()
+            if event[ 3 ].startswith( 'CHECK' ):
+                continue
+            triggerEvent( event[ 3 ], 'RUN_BLOCK', *event[ 4: ] )
+            time.sleep( sleepTime )
+        f.close()
+    except Exception as e:
+        print e
+
 if __name__ == '__main__':
-    testLoop( 2 )
+    #testLoop( 2 )
+    replayFromFile()
diff --git a/TestON/tests/CHOTestMonkey/dependencies/elements/ONOSElement.py b/TestON/tests/CHOTestMonkey/dependencies/elements/ONOSElement.py
index 17e9e73..e9dff29 100644
--- a/TestON/tests/CHOTestMonkey/dependencies/elements/ONOSElement.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/elements/ONOSElement.py
@@ -58,7 +58,6 @@
 
     def setWithdrawn( self ):
         self.expectedState = 'WITHDRAWN'
-        # TODO: should we check whether hostA and hostB are made correspondents by other intents/flows?
         if self.hostB in self.hostA.correspondents:
             self.hostA.correspondents.remove( self.hostB )
         if self.hostA in self.hostB.correspondents:
@@ -66,17 +65,12 @@
 
     def setFailed( self ):
         self.expectedState = 'FAILED'
-        # TODO: should we check whether hostA and hostB are made correspondents by other intents/flows?
-        if self.hostB in self.hostA.correspondents:
-            self.hostA.correspondents.remove( self.hostB )
-        if self.hostA in self.hostB.correspondents:
-            self.hostB.correspondents.remove( self.hostA )
 
     def setInstalled( self ):
+        if self.expectedState == 'UNKNOWN':
+            self.hostA.correspondents.append( self.hostB )
+            self.hostB.correspondents.append( self.hostA )
         self.expectedState = 'INSTALLED'
-        # TODO: should we check whether hostA and hostB are already correspondents?
-        self.hostA.correspondents.append( self.hostB )
-        self.hostB.correspondents.append( self.hostA )
 
     def __str__( self ):
         return "ID: " + self.id
@@ -97,16 +91,13 @@
 
     def setFailed( self ):
         self.expectedState = 'FAILED'
-        for hostA in self.deviceA.hosts:
-            for hostB in self.deviceB.hosts:
-                if hostB in hostA.correspondents:
-                    hostA.correspondents.remove( hostB )
 
     def setInstalled( self ):
+        if self.expectedState == 'UNKNOWN':
+            for hostA in self.deviceA.hosts:
+                for hostB in self.deviceB.hosts:
+                    hostA.correspondents.append( hostB )
         self.expectedState = 'INSTALLED'
-        for hostA in self.deviceA.hosts:
-            for hostB in self.deviceB.hosts:
-                hostA.correspondents.append( hostB )
 
     def __str__( self ):
         return "ID: " + self.id
diff --git a/TestON/tests/CHOTestMonkey/dependencies/events/AppEvent.py b/TestON/tests/CHOTestMonkey/dependencies/events/AppEvent.py
index 07c8cb6..4283ff6 100644
--- a/TestON/tests/CHOTestMonkey/dependencies/events/AppEvent.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/events/AppEvent.py
@@ -63,7 +63,7 @@
 
     def startEvent( self, args ):
         with self.eventLock:
-            main.log.info( "%s - starting event" % ( self.typeString ) )
+            #main.log.info( "%s - starting event" % ( self.typeString ) )
             if self.typeIndex == EventType().APP_INTENT_HOST_ADD or self.typeIndex == EventType().APP_INTENT_HOST_DEL:
                 if len( args ) < 3:
                     main.log.warn( "%s - Not enough arguments: %s" % ( self.typeString, args ) )
@@ -138,6 +138,7 @@
                 intent.hostB == self.hostA and intent.hostA == self.hostB:
                     main.log.warn( self.typeString + " - find an exiting intent for the host pair, abort installation" )
                     return EventStates().ABORT
+            main.log.info( "Event recorded: {} {} {} {} {}".format( self.typeIndex, self.typeString, self.hostA.name, self.hostB.name, self.CLIIndex ) )
             controller = main.controllers[ self.CLIIndex - 1 ]
             with controller.CLILock:
                 id = controller.CLI.addHostIntent( self.hostA.id, self.hostB.id )
@@ -179,6 +180,7 @@
             if targetIntent == None:
                 main.log.warn( self.typeString + " - intent does not exist" )
                 return EventStates().FAIL
+            main.log.info( "Event recorded: {} {} {} {} {}".format( self.typeIndex, self.typeString, self.hostA.name, self.hostB.name, self.CLIIndex ) )
             controller = main.controllers[ self.CLIIndex - 1 ]
             with controller.CLILock:
                 result = controller.CLI.removeIntent( targetIntent.id, purge=True )
@@ -204,7 +206,7 @@
 
     def startEvent( self, args ):
         with self.eventLock:
-            main.log.info( "%s - starting event" % ( self.typeString ) )
+            #main.log.info( "%s - starting event" % ( self.typeString ) )
             if self.typeIndex == EventType().APP_INTENT_POINT_ADD or self.typeIndex == EventType().APP_INTENT_POINT_DEL:
                 if len( args ) < 3:
                     main.log.warn( "%s - Not enough arguments: %s" % ( self.typeString, args ) )
@@ -290,6 +292,7 @@
                 if intent.deviceA == self.deviceA and intent.deviceB == self.deviceB:
                     main.log.warn( self.typeString + " - find an exiting intent for the device pair, abort installation" )
                     return EventStates().ABORT
+            main.log.info( "Event recorded: {} {} {} {} {}".format( self.typeIndex, self.typeString, self.deviceA.name, self.deviceB.name, self.CLIIndex ) )
             controller = main.controllers[ self.CLIIndex - 1 ]
             with controller.CLILock:
                 srcMAC = ""
@@ -336,6 +339,7 @@
             if targetIntent == None:
                 main.log.warn( self.typeString + " - intent does not exist" )
                 return EventStates().FAIL
+            main.log.info( "Event recorded: {} {} {} {} {}".format( self.typeIndex, self.typeString, self.deviceA.name, self.deviceB.name, self.CLIIndex ) )
             controller = main.controllers[ self.CLIIndex - 1 ]
             with controller.CLILock:
                 result = controller.CLI.removeIntent( targetIntent.id, purge=True )
diff --git a/TestON/tests/CHOTestMonkey/dependencies/events/CheckEvent.py b/TestON/tests/CHOTestMonkey/dependencies/events/CheckEvent.py
index fcbf23d..fa42e12 100755
--- a/TestON/tests/CHOTestMonkey/dependencies/events/CheckEvent.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/events/CheckEvent.py
@@ -13,7 +13,7 @@
 
     def startEvent( self, args ):
         with self.eventLock:
-            main.log.info( "%s - starting event" % ( self.typeString ) )
+            main.log.info( "Event recorded: {} {}".format( self.typeIndex, self.typeString ) )
             result = self.startCheckEvent()
             return result
 
diff --git a/TestON/tests/CHOTestMonkey/dependencies/events/NetworkEvent.py b/TestON/tests/CHOTestMonkey/dependencies/events/NetworkEvent.py
index 8ec62a1..ccab8a1 100644
--- a/TestON/tests/CHOTestMonkey/dependencies/events/NetworkEvent.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/events/NetworkEvent.py
@@ -19,7 +19,7 @@
         args are the names of the two link ends, e.g. ['s1', 's2']
         """
         with self.eventLock:
-            main.log.info( "%s - starting event" % ( self.typeString ) )
+            #main.log.info( "%s - starting event" % ( self.typeString ) )
             if len( args ) < 2:
                 main.log.warn( "%s - Not enough arguments: %s" % ( self.typeString, args ) )
                 return EventStates().ABORT
@@ -84,6 +84,7 @@
             elif self.linkA.isRemoved() or self.linkB.isRemoved():
                 main.log.warn( "Link Down - link has been removed" )
                 return EventStates().ABORT
+        main.log.info( "Event recorded: {} {} {} {}".format( self.typeIndex, self.typeString, self.linkA.deviceA.name, self.linkA.deviceB.name ) )
         with main.mininetLock:
             '''
             result = main.Mininet1.link( END1=self.linkA.deviceA.name,
@@ -118,6 +119,7 @@
             if self.linkA.isRemoved() or self.linkB.isRemoved():
                 main.log.warn( "Link Up - link has been removed" )
                 return EventStates().ABORT
+        main.log.info( "Event recorded: {} {} {} {}".format( self.typeIndex, self.typeString, self.linkA.deviceA.name, self.linkA.deviceB.name ) )
         with main.mininetLock:
             '''
             result = main.Mininet1.link( END1=self.linkA.deviceA.name,
@@ -147,7 +149,7 @@
         args are the names of the device, e.g. 's1'
         """
         with self.eventLock:
-            main.log.info( "%s - starting event" % ( self.typeString ) )
+            #main.log.info( "%s - starting event" % ( self.typeString ) )
             if len( args ) < 1:
                 main.log.warn( "%s - Not enough arguments: %s" % ( self.typeString, args ) )
                 return EventStates().ABORT
@@ -199,6 +201,7 @@
             if self.device.isRemoved():
                 main.log.warn( "Device Down - device has been removed" )
                 return EventStates().ABORT
+        main.log.info( "Event recorded: {} {} {}".format( self.typeIndex, self.typeString, self.device.name ) )
         with main.mininetLock:
             result = main.Mininet1.delSwitch( self.device.name )
         if not result:
@@ -232,6 +235,7 @@
                 main.log.warn( "Device Up - device already up" )
                 return EventStates().ABORT
         # Re-add the device
+        main.log.info( "Event recorded: {} {} {}".format( self.typeIndex, self.typeString, self.device.name ) )
         with main.mininetLock:
             result = main.Mininet1.addSwitch( self.device.name, dpid=self.device.dpid[3:] )
         if not result:
diff --git a/TestON/tests/CHOTestMonkey/dependencies/events/ONOSEvent.py b/TestON/tests/CHOTestMonkey/dependencies/events/ONOSEvent.py
index f4e2a89..28960d2 100644
--- a/TestON/tests/CHOTestMonkey/dependencies/events/ONOSEvent.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/events/ONOSEvent.py
@@ -11,7 +11,7 @@
 
     def startEvent( self, args ):
         with self.eventLock:
-            main.log.info( "%s - starting event" % ( self.typeString ) )
+            #main.log.info( "%s - starting event" % ( self.typeString ) )
             result = EventStates().PASS
             if self.typeIndex == EventType().ONOS_ONOS_DOWN or self.typeIndex == EventType().ONOS_ONOS_UP:
                 if len( args ) < 1:
@@ -42,6 +42,7 @@
             if not main.controllers[ self.ONOSIndex - 1 ].isUp():
                 main.log.warn( "ONOS Down - ONOS already down" )
                 return EventStates().ABORT
+        main.log.info( "Event recorded: {} {} {}".format( self.typeIndex, self.typeString, self.ONOSIndex ) )
         with main.ONOSbenchLock:
             result = main.ONOSbench.onosStop( main.controllers[ self.ONOSIndex - 1 ].ip )
         if not result:
@@ -63,6 +64,7 @@
             if main.controllers[ self.ONOSIndex - 1 ].isUp():
                 main.log.warn( "ONOS Up - ONOS already up" )
                 return EventStates().ABORT
+        main.log.info( "Event recorded: {} {} {}".format( self.typeIndex, self.typeString, self.ONOSIndex ) )
         with main.ONOSbenchLock:
             startResult = main.ONOSbench.onosStart( main.controllers[ self.ONOSIndex - 1 ].ip )
         if not startResult:
@@ -92,7 +94,7 @@
 
     def startEvent( self, args ):
         with self.eventLock:
-            main.log.info( "%s - starting event" % ( self.typeString ) )
+            #main.log.info( "%s - starting event" % ( self.typeString ) )
             result = self.startCfgEvent( args )
             return result
 
@@ -121,6 +123,7 @@
         if index == -1:
             main.log.warn( "%s - No available controllers" %s ( self.typeString ) )
             return EventStates().ABORT
+        main.log.info( "Event recorded: {} {} {} {} {}".format( self.typeIndex, self.typeString, self.component, self.propName, self.value ) )
         controller = main.controllers[ index - 1 ]
         with controller.CLILock:
             result = controller.CLI.setCfg( component=self.component,
@@ -158,6 +161,7 @@
         if index == -1:
             main.log.warn( "%s - No available controllers" %s ( self.typeString ) )
             return EventStates().ABORT
+        main.log.info( "Event recorded: {} {} {} {} {}".format( self.typeIndex, self.typeString, self.component, self.propName, self.value ) )
         controller = main.controllers[ index - 1 ]
         with controller.CLILock:
             result = controller.CLI.setCfg( component=self.component,
@@ -184,6 +188,7 @@
             if index == -1:
                 main.log.warn( "%s - No available controllers" %s ( self.typeString ) )
                 return EventStates().ABORT
+            main.log.info( "Event recorded: {} {}".format( self.typeIndex, self.typeString ) )
             controller = main.controllers[ index - 1 ]
             with controller.CLILock:
                 result = controller.CLI.balanceMasters()
diff --git a/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.params b/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.params
index 34dba48..89202a5 100755
--- a/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.params
+++ b/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.params
@@ -5,14 +5,15 @@
 #CASE1: Compile ONOS and push it to the test machines
 #CASE2: Discovery the topology using BGPLS
 #CASE3: Addition of new Node to existing topology
-#CASE4: Deletion of Node
-#Case5: Uninstalling the app
+#CASE4: Verification of Links thats is discovered"
+#CASE5: Deletion of Links
+#Case6: Uninstalling the app
 
 
-    <testcases>1,2,3,4,5</testcases>
+    <testcases>1,2,3,4,5,6</testcases>
 
     <DEPENDENCY>
-        <path>/tests/FUNCbgpls/Dependencies/</path>
+        <path>/tests/FUNC/FUNCbgpls/Dependencies/</path>
     </DEPENDENCY>
 
     <ENV>
diff --git a/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py b/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py
index a56c5c4..db60aad 100755
--- a/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py
+++ b/TestON/tests/FUNC/FUNCbgpls/FUNCbgpls.py
@@ -8,8 +8,9 @@
 CASE1: Compile ONOS and push it to the test machines
 CASE2: Discovery the topology using BGPLS
 CASE3: Addition of new Node to existing topology
-CASE4: Deletion of Node
-Case5: Uninstalling the app
+CASE4: Verification of Links thats is discovered"
+CASE5: Deletion of Links
+Case6: Uninstalling the app
 
 
 """
@@ -275,7 +276,7 @@
         bgplsConfig.Comments()
 
         main.Scapy1.handle.sendline( "\x03" )
-        time.sleep(90) #This Sleep time gives time for the socket to close.
+        time.sleep( 90 ) #This Sleep time gives time for the socket to close.
 
 
 
@@ -365,24 +366,23 @@
             stepResult = main.FALSE
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
-                                 onpass="Node " + str( Ne_id[1][3] ) + " update  sucess",
-                                 onfail="Node " + str( Ne_id[1][3]) + " update failed" )
+                                 onpass="Node " + str( Ne_id[ 1 ][ 3 ] ) + " update  sucess",
+                                 onfail="Node " + str( Ne_id[ 1 ][ 3 ] ) + " update failed" )
         bgplsConfig.Comments()
         main.log.info( "Kill Scapy process" )
         bgplsConfig.Comments()
         main.Scapy1.handle.sendline( "\x03" )
-
+        time.sleep( 90 ) #This Sleep time gives time for the socket to close.
 
 
     def CASE4( self, main ):
         """
-        Deletion of  Node
+        Verification of Links in existing topology
         """
-        import os , sys
-        import re
+        import json
         import time
-        main.case( "TestCase 4: Deletion of Node from existing Topology" )
-
+        import os
+        main.case( "Testcase 4: Verification of Links thats is discovered" )
         try:
             from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs
         except ImportError:
@@ -392,30 +392,14 @@
             main.exit()
 
         bgplsConfig = BgpLs()
-        Ne_id = bgplsConfig.Constants()
         app = bgplsConfig.apps()
         main.CLIs = []
         main.nodes = []
         main.numCtrls= 1
-
-        bgplsConfig.Comments()
-        main.log.info( "Blocked due to this defect : ONOS-3920 " )
-        bgplsConfig.Comments()
-
-        '''
         ipList = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
         scapy_ip = os.getenv(main.params ['SCAPY'] ['HOSTNAMES'] )
-        cellName = main.params[ 'ENV' ][ 'cellName' ]
-        cellAppString= main.params[ 'ENV' ][ 'cellApps' ]
-        httpport = main.params['HTTP']['port']
-        path = main.params['HTTP']['path']
-        bgplsConfig = BgpLs()
         bgplsConfig.ipValue(ipList,scapy_ip)
 
-        main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
-                                       scapy_ip,
-                                       cellAppString, ipList , onosUser="karaf" )
-
         for i in range( 1, main.numCtrls + 1 ):
             try:
                 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
@@ -424,93 +408,120 @@
             except AttributeError:
                 break
 
-        main.step( "Apply cell to environment" )
         bgplsConfig.Comments()
-        cellResult = main.ONOSbench.setCell( cellName )
-
-        bgplsConfig.Comments()
-        main.log.info( "Sending BGPLS information " )
+        main.log.info( "Sending BGPLS Link information Packet " )
         bgplsConfig.Comments()
 
-
-        main.Scapy1.handle.sendline( "sudo python  OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Deletion_Node.py" )
-        #main.Scapy1.handle.expect( "sdn:" )
-        #main.Scapy1.handle.sendline( "rocks" )
-
-
+        main.Scapy1.handle.sendline( "sudo python  OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Link_Update_Node.py" )
         bgplsConfig.Comments()
         main.log.info( "Enable BGPlS plugin in ONOS" )
         bgplsConfig.Comments()
 
+        main.step( "UnInstall onos-app-bgp" )
+        installResults = main.ONOScli1.deactivateApp( app[ 0 ] )
+        utilities.assert_equals( expect=main.TRUE, actual=installResults,
+                                 onpass="Uninstall  onos-app-bgp successful",
+                                 onfail="Uninstall  onos-app-bgp failed" )
 
-        cliResults = main.ONOScli1.startOnosCli( main.nodes[0].ip_address)
-
-        main.step( "Getting connected to ONOS" )
-        utilities.assert_equals( expect=main.TRUE, actual=cliResults,
-                                 onpass="ONOS cli startup successful",
-                                 onfail="ONOS cli startup failed" )
-        installResults = main.ONOScli1.activateApp( app[0])
-
+        installResults = main.ONOScli1.activateApp( app[ 0 ])
         main.step( "Install onos-app-bgp" )
         utilities.assert_equals( expect=main.TRUE, actual=installResults,
                                  onpass="Install onos-app-bgp successful",
                                  onfail="Install onos-app-bgp failed" )
-
-        main.step( "Install onos-app-bgpflow" )
-        installResults = main.ONOScli1.activateApp( app[1] )
-        utilities.assert_equals( expect=main.TRUE, actual=installResults,
-                                 onpass="Install onos-app-bgpflow successful",
-                                 onfail="Install onos-app-bgpflow failed" )
-
-
-        bgpls_post = bgplsConfig.DictoJson()
-
         bgplsConfig.Comments()
-        main.log.info( "BGPLS RestConf input" )
+        main.log.info( "Checking the Link Discovery Status" )
         bgplsConfig.Comments()
+        time.sleep( 120 )   # Time taken to discovery the links
+        response = main.ONOScli1.links()
+        linksResp = json.loads( response )
+        check_link = bgplsConfig.checkLinks( linksResp )
 
-        print (bgpls_post)
-        main.ONOSrest.user_name = "karaf"
-        main.ONOSrest.pwd = "karaf"
-        Poststatus, result = main.ONOSrest.send( ipList,httpport,'', path + 'v1/network/configuration/',
-                                                 'POST', None, bgpls_post, debug=True )
-
-        main.step( "Configure BGP through RESTCONF" )
-        utilities.assert_equals(
-                expect='200',
-                actual=Poststatus,
-                onpass="Post Port Success",
-                onfail="Post Port Failed " + str( Poststatus ) + "," + str( result ) )
-
-
-        bgplsConfig.Comments()
-        main.log.info( "Check Network devices is deleted from  ONOS " )
-        bgplsConfig.Comments()
-        time.sleep(15)
-
-        response = main.ONOScli1.devices()
-
-        main.step( "Check whehther Node is deleted successfully" )
-
-        if response.find(Ne_id[3]) != -1:
-            stepResult = main.TRUE
-        else:
-            stepResult = main.FALSE
-        utilities.assert_equals( expect=main.FALSE,
-                                 actual=stepResult,
-                                 onpass="Node " + str( Ne_id[3] ) + " Deletion sucess",
-                                 onfail="Node " + str( Ne_id[3] ) + " Deletion  failed" )
-
+        if check_link == True:
+            reply_Check_Link = main.TRUE
+        utilities.assert_equals( expect= main.TRUE,
+                                     actual=reply_Check_Link ,
+                                     onpass="Link  Discovery Success.",
+                                     onfail="Link  Discovery Failed." )
         bgplsConfig.Comments()
         main.log.info( "Kill Scapy process" )
         bgplsConfig.Comments()
-
         main.Scapy1.handle.sendline( "\x03" )
-        '''
-
+        time.sleep( 90 )
 
     def CASE5( self, main ):
         """
+        Deletion of  links
+        """
+        import json
+        import time
+        import os
+        main.case( "Testcase 5: Deletion of Link in existing topology" )
+        try:
+            from tests.FUNC.FUNCbgpls.dependencies.Nbdata import BgpLs
+        except ImportError:
+            main.log.exception( "Something wrong with import file or code error." )
+            main.log.info( "Import Error, please check!" )
+            main.cleanup()
+            main.exit()
+
+        bgplsConfig = BgpLs()
+        app = bgplsConfig.apps()
+        main.CLIs = []
+        main.nodes = []
+        main.numCtrls= 1
+        ipList = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
+        scapy_ip = os.getenv(main.params [ 'SCAPY' ] [ 'HOSTNAMES' ] )
+        bgplsConfig.ipValue(ipList,scapy_ip)
+
+        for i in range( 1, main.numCtrls + 1 ):
+            try:
+                main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
+                main.nodes.append( getattr( main, 'ONOS' + str( i ) ) )
+                ipList.append( main.nodes[ -1 ].ip_address )
+            except AttributeError:
+                break
+
+        bgplsConfig.Comments()
+        main.log.info( "Sending BGPLS Delete Link Packet " )
+        bgplsConfig.Comments()
+
+        main.Scapy1.handle.sendline( "sudo python  OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Deletion_Node.py" )
+        bgplsConfig.Comments()
+        main.log.info( "Enable BGPlS plugin in ONOS" )
+        bgplsConfig.Comments()
+
+        main.step( "UnInstall onos-app-bgp" )
+        installResults = main.ONOScli1.deactivateApp( app[ 0 ] )
+        utilities.assert_equals( expect=main.TRUE, actual=installResults,
+                                 onpass="Uninstall  onos-app-bgp successful",
+                                 onfail="Uninstall  onos-app-bgp failed" )
+
+        installResults = main.ONOScli1.activateApp( app[ 0 ])
+        main.step( "Install onos-app-bgp" )
+        utilities.assert_equals( expect=main.TRUE, actual=installResults,
+                                 onpass="Install onos-app-bgp successful",
+                                 onfail="Install onos-app-bgp failed" )
+        bgplsConfig.Comments()
+        main.log.info( "Checking whether the links is deleted" )
+        bgplsConfig.Comments()
+        time.sleep( 120 )  # Time taken to discovery the links
+        response = main.ONOScli1.links()
+        linksResp = json.loads( response )
+        check_link = bgplsConfig.checkLinks( linksResp )
+        if check_link == False:
+            reply_Check_Link = main.TRUE
+        utilities.assert_equals( expect= main.TRUE,
+                                     actual=reply_Check_Link ,
+                                     onpass="Link  is Deleted Successfully.",
+                                     onfail="Link  is Deletion Failed." )
+        bgplsConfig.Comments()
+        main.log.info( "Kill Scapy process" )
+        bgplsConfig.Comments()
+        main.Scapy1.handle.sendline( "\x03" )
+        time.sleep( 90 )
+
+    def CASE6( self, main ):
+        """
         Uninstalling the app
         """
         import os,sys
@@ -542,7 +553,7 @@
         bgplsConfig.ipValue(ipList,scapy_ip)
         main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
                                        scapy_ip,
-                                       cellAppString, ipList , onosUser="karaf" )
+                                       cellAppString, ipList )
 
         for i in range( 1, main.numCtrls + 1 ):
             try:
@@ -574,5 +585,9 @@
                                  onpass="Uninstall  onos-app-bgp successful",
                                  onfail="Uninstall  onos-app-bgp failed" )
 
-
-
+        main.log.info( "Check for Errors or Exception End of the Script" )
+        errorLog = main.ONOSbench.logReport( main.nodes[0].ip_address, ["ERROR",\
+                                            "EXCEPT"] )
+        utilities.assert_equals( expect= 0, actual=errorLog,
+                                 onpass="No Exception or Error occured",
+                                 onfail="Exception or Error occured" )
\ No newline at end of file
diff --git a/TestON/tests/FUNC/FUNCbgpls/README b/TestON/tests/FUNC/FUNCbgpls/README
index 2ecb554..8974506 100755
--- a/TestON/tests/FUNC/FUNCbgpls/README
+++ b/TestON/tests/FUNC/FUNCbgpls/README
@@ -28,7 +28,7 @@
 1] We use Scapy tool, to send the BGPLS packet to ONOS.
 2] The packets are already pre-captured.
 3] ONOS reads those packet and displays the topology.
-4] We query the devices information in ONOS to check the devices/links are learn
+4] We query the devices information in ONOS to check the devices/links are learned
 
 
 Steps :
diff --git a/TestON/tests/FUNC/FUNCbgpls/dependencies/Bgpls_packets/Topo_pkts.pcap b/TestON/tests/FUNC/FUNCbgpls/dependencies/Bgpls_packets/Topo_pkts.pcap
deleted file mode 100755
index 2021f22..0000000
--- a/TestON/tests/FUNC/FUNCbgpls/dependencies/Bgpls_packets/Topo_pkts.pcap
+++ /dev/null
Binary files differ
diff --git a/TestON/tests/FUNC/FUNCbgpls/dependencies/Bgpls_packets/bgpls.pcap b/TestON/tests/FUNC/FUNCbgpls/dependencies/Bgpls_packets/bgpls.pcap
new file mode 100644
index 0000000..8e3db7d
--- /dev/null
+++ b/TestON/tests/FUNC/FUNCbgpls/dependencies/Bgpls_packets/bgpls.pcap
Binary files differ
diff --git a/TestON/tests/FUNC/FUNCbgpls/dependencies/Nbdata.py b/TestON/tests/FUNC/FUNCbgpls/dependencies/Nbdata.py
index 8a83748..5661cb8 100755
--- a/TestON/tests/FUNC/FUNCbgpls/dependencies/Nbdata.py
+++ b/TestON/tests/FUNC/FUNCbgpls/dependencies/Nbdata.py
@@ -78,3 +78,47 @@
         self.app_bgpflow = 'org.onosproject.bgpflow'
         self.list1 = [self.app_bgp,self.app_bgpflow]
         return self.list1
+
+    def checkLinks(self,linksResp):
+        #Declaring the links values
+        links = {'link1_src' : "1650.5555.0055", 'link1_dst' : "1660.6666.0066",
+             'link2_src' : "1630.3333.0033", 'link2_dst' : "1620.2222.0022",
+             'link3_src' : "1660.6666.0066", 'link3_dst' : "1650.5555.0055",
+             'link4_src' : "1630.3333.0033", 'link4_dst' : "1650.5555.0055",
+             'link5_src' : "1640.4444.0044", 'link5_dst' : "1610.1111.0011",
+             'link6_src' : "1650.5555.0055", 'link4_dst' : "1630.3333.0033",
+             'link7_src' : "1620.2222.0022", 'link4_dst' : "1630.3333.0033",
+             'link8_src' : "1620.2222.0022", 'link4_dst' : "1610.1111.0011",
+             'link9_src' : "1630.3333.0033", 'link4_dst' : "1640.4444.0044",
+             'link10_src' : "1650.5555.0055", 'link4_dst' : "1640.4444.0044",
+             'link11_src' : "1610.1111.0011", 'link4_dst' : "1640.4444.0044",
+             'link12_src' : "1640.4444.0044", 'link4_dst' : "1620.2222.0022",
+             'link13_src' : "1660.6666.0066", 'link4_dst' : "1630.3333.0033",
+             'link14_src' : "1640.4444.0044", 'link4_dst' : "1660.6666.0066",
+             'link15_src' : "1640.4444.0044", 'link4_dst' : "1630.3333.0033",
+             'link16_src' : "1610.1111.0011", 'link4_dst' : "1630.3333.0033",
+             'link17_src' : "1630.3333.0033", 'link4_dst' : "1610.1111.0011",
+             'link18_src' : "1610.1111.0011", 'link4_dst' : "1620.2222.0022",
+             'link19_src' : "1620.2222.0022", 'link4_dst' : "1640.4444.0044",
+             'link20_src' : "1630.3333.0033", 'link4_dst' : "1660.6666.0066",
+             'link21_src' : "1640.4444.0044", 'link4_dst' : "1650.5555.0055",
+             'link22_src' : "1660.6666.0066", 'link4_dst' : "1640.4444.0044"
+        }
+
+        #Comparing the Links
+        for x in xrange(22):
+            link_src_info = linksResp[x]['src']['device']
+            link_dst_info = linksResp[x]['dst']['device']
+            link_src_split = link_src_info.split("=")
+            link_src = link_src_split[4]
+            link_dst_split = link_dst_info.split("=")
+            link_dst = link_dst_split[4]
+            y = x+1
+            link_src_ref = links['link'+str(y)+'_src']
+            link_dst_ref = links['link'+str(y)+'_dst']
+            if (link_src == link_src_ref) and (link_dst == (link_dst_ref) and \
+                linksResp[x]['type'] == 'DIRECT' and linksResp[x]['state'] == \
+                'ACTIVE'):
+                return True
+            else:
+                return False
diff --git a/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Deletion_Node.py b/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Deletion_Node.py
index abd1cfc..259f846 100755
--- a/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Deletion_Node.py
+++ b/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Deletion_Node.py
@@ -18,36 +18,35 @@
 host = peerIp # Get local machine name
 port = 179                # Reserve a port for your service.
 s.bind((host, port))        # Bind to the port
-pkts = rdpcap(path + "/OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/dependencies/Bgpls_packets/bgpls_all.pcap")
-pkts[69][BGPOpen].bgp_id = peerIp
+pkts = rdpcap(path + "/OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/dependencies/Bgpls_packets/bgpls.pcap")
+time.sleep(15)
+pkts[759][BGPOpen].bgp_id = peerIp
 
 s.listen(5)                   # Now wait for client connection.
 
 print("starting Connecting to ONOS peer")
 c, addr = s.accept()     # Establish connection with client.
 print 'Got connection from ONOS :', addr
-c.send(str(pkts[69][BGPHeader])) # OPEN MESSAGE
+c.send(str(pkts[759][BGPHeader])) # OPEN MESSAGE
 c.recv(4096)
-c.send(str(pkts[71][BGPHeader]))# KEEPALIVE MESSAGE
+c.send(str(pkts[765][BGPHeader]))# KEEPALIVE MESSAGE
 c.recv(4096)
-c.send(str(pkts[72][BGPHeader]))   # UPDATE MESSAGES
-c.send(str(pkts[74][BGPHeader]))
-c.send(str(pkts[71][BGPHeader]))
+c.send(str(pkts[768][BGPHeader]))   # UPDATE MESSAGES
+c.send(str(pkts[771][BGPHeader]))
+c.send(str(pkts[773][BGPHeader]))
+c.send(str(pkts[775][BGPHeader]))
+c.send(str(pkts[778][BGPHeader]))
+c.send(str(pkts[765][BGPHeader]))
 
-time.sleep(10)               # Waiting for 120 seconds for update message.
-
-c.send(str(pkts[298][BGPHeader]))
-c.send(str(pkts[860][BGPHeader]))   # UPDATE MESSAGES with new node
-c.send(str(pkts[865][BGPHeader]))
-print ("New Node update msg sent")
-
-time.sleep(5)
-c.send(str(pkts[890][BGPHeader]))
+time.sleep(15)
+c.send(str(pkts[1168][BGPHeader]))
+c.send(str(pkts[1250][BGPHeader]))
+c.send(str(pkts[1354][BGPHeader]))
 print ("Node Delete msg sent")
 
 
 while True:
     c.recv(4096)
-    c.send(str(pkts[71][BGPHeader]))
+    c.send(str(pkts[765][BGPHeader]))
 
   # c.close()                # Close the connection
diff --git a/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Link_Update_Node.py b/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Link_Update_Node.py
new file mode 100755
index 0000000..03a5653
--- /dev/null
+++ b/TestON/tests/FUNC/FUNCbgpls/dependencies/Scapyfiles/Link_Update_Node.py
@@ -0,0 +1,45 @@
+#!/usr/bin/python           # This is server.py file
+from scapy.all import *
+import socket               # Import socket module
+import time                 # Import Time module
+import sys
+import os
+
+path = os.getcwd()
+sys.path.append('OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/dependencies')   #Setting the path for BgpLS
+from Nbdata import BgpLs
+
+obj = BgpLs()
+returnlist = obj.Constants()
+peerIp = returnlist[0][0]
+
+load_contrib('bgp')
+s = socket.socket()         # Create a socket object
+host = peerIp # Get local machine name
+port = 179                # Reserve a port for your service.
+s.bind((host, port))        # Bind to the port
+pkts = rdpcap(path + "/OnosSystemTest/TestON/tests/FUNC/FUNCbgpls/dependencies/Bgpls_packets/bgpls.pcap")
+time.sleep(15)
+pkts[759][BGPOpen].bgp_id = peerIp
+
+s.listen(5)                   # Now wait for client connection.
+
+print("starting Connecting to ONOS peer")
+c, addr = s.accept()     # Establish connection with client.
+print 'Got connection from ONOS :', addr
+c.send(str(pkts[759][BGPHeader])) # OPEN MESSAGE
+c.recv(4096)
+c.send(str(pkts[765][BGPHeader]))# KEEPALIVE MESSAGE
+c.recv(4096)
+c.send(str(pkts[768][BGPHeader]))   # UPDATE MESSAGES
+c.send(str(pkts[771][BGPHeader]))
+c.send(str(pkts[773][BGPHeader]))
+c.send(str(pkts[775][BGPHeader]))
+c.send(str(pkts[778][BGPHeader]))
+c.send(str(pkts[765][BGPHeader]))
+
+while True:
+    c.recv(4096)
+    c.send(str(pkts[765][BGPHeader]))
+
+  # c.close()                # Close the connection
diff --git a/TestON/tests/FUNC/FUNCflow/FUNCflow.params b/TestON/tests/FUNC/FUNCflow/FUNCflow.params
index aa7c358..c0ce79f 100755
--- a/TestON/tests/FUNC/FUNCflow/FUNCflow.params
+++ b/TestON/tests/FUNC/FUNCflow/FUNCflow.params
@@ -1,21 +1,27 @@
 
 <PARAMS>
     # CASE - Descritpion
-    # 1,2,10,1000,1100,2000,1200,2000,100
+    # Openflow 1.0: 1,2,10,1000,3000,1100,3000,1400,3000,1600,3000,1700,100
+    # Openflow 1.3: 1,2,10,1000,3000,1100,3000,1200,3000,1300,3000,1400,3000,1500,3000,1600,3000,1700,3000,1800,3000,1900,3000,2000,100
     # 1 - Variable initialization and optional pull and build ONOS package
     # 2 - install ONOS
     # 10 - Start mininet and verify topology
     # 66 - Testing Scapy
     # 100 - Check logs for Errors and Warnings
     # 1000 - Add flows with MAC selector
-    # 1100 - Add flows with IPv4 selector
-    # 1200 - Add flows with VLAN selector
+    # 1100 - Add flows with VLAN selector
+    # 1200 - Add flows with ARP selector
     # 1300 - Add flows with MPLS selector
-    # 1400 - Add flows with TCP selectors
-    # 1500 - Add flows with UDP selectors
-    # 2000 - Delete flows
+    # 1400 - Add flows with IPv4 selector
+    # 1500 - Add flows with IPv6 selector
+    # 1600 - Add flows with UDP selector
+    # 1700 - Add flows with TCP selector
+    # 1800 - Add flows with SCTP selector
+    # 1900 - Add flows with ICMPv4 selector
+    # 2000 - Add flows with ICMPv6 selector
+    # 3000 - Delete flows
 
-    <testcases>1,2,10,1000,2000,1100,2000,1200,2000,1300,2000,1400,2000,1500,100</testcases>
+    <testcases>1,2,10,1000,3000,1100,3000,1200,3000,1300,3000,1400,3000,1500,3000,1600,3000,1700,3000,1800,3000,1900,3000,2000,100</testcases>
 
     <SCALE>
         <max>1</max>
@@ -49,9 +55,16 @@
         <mpls>22</mpls>
         <tcpDst>40001</tcpDst>
         <udpDst>40051</udpDst>
+        <sctpDst>40001</sctpDst>
         <ip4Type>2048</ip4Type>
+        <ip6Type>34525</ip6Type>
+        <arpType>2054</arpType>
         <tcpProto>6</tcpProto>
         <udpProto>17</udpProto>
+        <sctpProto>132</sctpProto>
+        <icmpProto>1</icmpProto>
+        <icmp6Proto>58</icmp6Proto>
+        <sctpProto>132</sctpProto>
         <vlanType>33024</vlanType>
         <mplsType>34887</mplsType>
         <swDPID>of:0000000000000001</swDPID>
diff --git a/TestON/tests/FUNC/FUNCflow/FUNCflow.py b/TestON/tests/FUNC/FUNCflow/FUNCflow.py
index eeed451..80bd618 100644
--- a/TestON/tests/FUNC/FUNCflow/FUNCflow.py
+++ b/TestON/tests/FUNC/FUNCflow/FUNCflow.py
@@ -4,7 +4,6 @@
         self.default = ''
 
     def CASE1( self, main ):
-        import time
         import os
         import imp
 
@@ -20,7 +19,6 @@
 
         main.case( "Constructing test variables and building ONOS package" )
         main.step( "Constructing test variables" )
-        stepResult = main.FALSE
 
         # Test variables
         main.testOnDirectory = os.path.dirname( os.getcwd ( ) )
@@ -39,15 +37,15 @@
         main.startMNSleep = int( main.params[ 'SLEEP' ][ 'startMN' ] )
         main.addFlowSleep = int( main.params[ 'SLEEP' ][ 'addFlow' ] )
         main.delFlowSleep = int( main.params[ 'SLEEP' ][ 'delFlow' ] )
-        main.debug = main.params['DEBUG']
+        main.debug = main.params[ 'DEBUG' ]
         main.swDPID = main.params[ 'TEST' ][ 'swDPID' ]
-        main.cellData = {} # for creating cell file
-        main.CLIs = []
-        main.ONOSip = []
+        main.cellData = { } # for creating cell file
+        main.CLIs = [ ]
+        main.ONOSip = [ ]
 
         main.debug = True if "on" in main.debug else False
 
-        main.ONOSip = main.ONOSbench.getOnosIps()
+        main.ONOSip = main.ONOSbench.getOnosIps( )
 
         # Assigning ONOS cli handles to a list
         for i in range( 1,  main.maxNodes + 1 ):
@@ -66,10 +64,16 @@
 
 
         copyResult = main.ONOSbench.scp( main.Mininet1,
-                                         main.dependencyPath+main.topology,
-                                         main.Mininet1.home+'/custom/',
+                                         main.dependencyPath + main.topology,
+                                         main.Mininet1.home + '/custom/',
                                          direction="to" )
 
+        utilities.assert_equals( expect=main.TRUE,
+                                actual=copyResult,
+                                onpass="Successfully copy " + "test variables ",
+                                onfail="Failed to copy test variables" )
+
+
         if main.CLIs:
             stepResult = main.TRUE
         else:
@@ -78,8 +82,7 @@
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
-                                 onpass="Successfully construct " +
-                                        "test variables ",
+                                 onpass="Successfully construct " + "test variables ",
                                  onfail="Failed to construct test variables" )
 
         if gitPull == 'True':
@@ -88,10 +91,8 @@
             stepResult = onosBuildResult
             utilities.assert_equals( expect=main.TRUE,
                                      actual=stepResult,
-                                     onpass="Successfully compiled " +
-                                            "latest ONOS",
-                                     onfail="Failed to compile " +
-                                            "latest ONOS" )
+                                     onpass="Successfully compiled " + "latest ONOS",
+                                     onfail="Failed to compile " + "latest ONOS" )
         else:
             main.log.warn( "Did not pull new code so skipping mvn " +
                            "clean install" )
@@ -108,6 +109,7 @@
         - Install ONOS cluster
         - Connect to cli
         """
+        import time
 
         main.numCtrls = int( main.maxNodes )
 
@@ -123,9 +125,9 @@
 
         main.log.info( "NODE COUNT = " + str( main.numCtrls ) )
 
-        tempOnosIp = []
+        tempOnosIp = [ ]
         for i in range( main.numCtrls ):
-            tempOnosIp.append( main.ONOSip[i] )
+            tempOnosIp.append( main.ONOSip[ i ] )
 
         main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
                                        "temp",
@@ -135,16 +137,15 @@
 
         main.step( "Apply cell to environment" )
         cellResult = main.ONOSbench.setCell( "temp" )
-        verifyResult = main.ONOSbench.verifyCell()
+        verifyResult = main.ONOSbench.verifyCell( )
         stepResult = cellResult and verifyResult
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
-                                 onpass="Successfully applied cell to " + \
-                                        "environment",
+                                 onpass="Successfully applied cell to " + "environment",
                                  onfail="Failed to apply cell to environment " )
 
         main.step( "Creating ONOS package" )
-        packageResult = main.ONOSbench.onosPackage()
+        packageResult = main.ONOSbench.onosPackage( )
         stepResult = packageResult
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
@@ -156,7 +157,7 @@
         onosUninstallResult = main.TRUE
         for ip in main.ONOSip:
             onosUninstallResult = onosUninstallResult and \
-                    main.ONOSbench.onosUninstall( nodeIp=ip )
+                    main.ONOSbench.onosUninstall( nodeIp = ip )
         stepResult = onosUninstallResult
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
@@ -167,7 +168,7 @@
         onosInstallResult = main.TRUE
         for i in range( main.numCtrls ):
             onosInstallResult = onosInstallResult and \
-                    main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
+                    main.ONOSbench.onosInstall( node = main.ONOSip[ i ] )
         stepResult = onosInstallResult
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
@@ -222,7 +223,7 @@
 
         main.step( "Setup Mininet Topology" )
         topology = main.Mininet1.home + '/custom/' + main.topology
-        stepResult = main.Mininet1.startNet( topoFile=topology )
+        stepResult = main.Mininet1.startNet( topoFile = topology )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
@@ -241,18 +242,14 @@
 
         main.step( "Comparing MN topology to ONOS topology" )
         main.log.info( "Gathering topology information" )
-        devicesResults = main.TRUE
-        linksResults = main.TRUE
-        hostsResults = main.TRUE
         devices = main.topo.getAllDevices( main )
         hosts = main.topo.getAllHosts( main )
         ports = main.topo.getAllPorts( main )
         links = main.topo.getAllLinks( main )
-        clusters = main.topo.getAllClusters( main )
 
-        mnSwitches = main.Mininet1.getSwitches()
-        mnLinks = main.Mininet1.getLinks()
-        mnHosts = main.Mininet1.getHosts()
+        mnSwitches = main.Mininet1.getSwitches( )
+        mnLinks = main.Mininet1.getLinks( )
+        mnHosts = main.Mininet1.getHosts( )
 
         for controller in range( main.numCtrls ):
             controllerStr = str( controller + 1 )
@@ -307,32 +304,32 @@
         main.step( "Creating Host1 component" )
         main.Scapy.createHostComponent( "h1" )
         main.Scapy.createHostComponent( "h2" )
-        hosts = [main.h1, main.h2]
+        hosts = [ main.h1, main.h2 ]
         for host in hosts:
-            host.startHostCli()
-            host.startScapy()
-            host.updateSelf()
+            host.startHostCli( )
+            host.startScapy( )
+            host.updateSelf( )
             main.log.debug( host.name )
             main.log.debug( host.hostIp )
             main.log.debug( host.hostMac )
 
         main.step( "Sending/Receiving Test packet - Filter doesn't match" )
         main.log.info( "Starting Filter..." )
-        main.h2.startFilter()
+        main.h2.startFilter( )
         main.log.info( "Building Ether frame..." )
         main.h1.buildEther( dst=main.h2.hostMac )
         main.log.info( "Sending Packet..." )
         main.h1.sendPacket( )
         main.log.info( "Checking Filter..." )
-        finished = main.h2.checkFilter()
+        finished = main.h2.checkFilter( )
         main.log.debug( finished )
         i = ""
         if finished:
-            a = main.h2.readPackets()
-            for i in a.splitlines():
+            a = main.h2.readPackets( )
+            for i in a.splitlines( ):
                 main.log.info( i )
         else:
-            kill = main.h2.killFilter()
+            kill = main.h2.killFilter( )
             main.log.debug( kill )
             main.h2.handle.sendline( "" )
             main.h2.handle.expect( main.h2.scapyPrompt )
@@ -343,18 +340,18 @@
                                  onfail="Fail" )
 
         main.step( "Sending/Receiving Test packet - Filter matches" )
-        main.h2.startFilter()
+        main.h2.startFilter( )
         main.h1.buildEther( dst=main.h2.hostMac )
         main.h1.buildIP( dst=main.h2.hostIp )
         main.h1.sendPacket( )
-        finished = main.h2.checkFilter()
+        finished = main.h2.checkFilter( )
         i = ""
         if finished:
-            a = main.h2.readPackets()
-            for i in a.splitlines():
+            a = main.h2.readPackets( )
+            for i in a.splitlines( ):
                 main.log.info( i )
         else:
-            kill = main.h2.killFilter()
+            kill = main.h2.killFilter( )
             main.log.debug( kill )
             main.h2.handle.sendline( "" )
             main.h2.handle.expect( main.h2.scapyPrompt )
@@ -368,9 +365,9 @@
 
         main.step( "Clean up host components" )
         for host in hosts:
-            host.stopScapy()
-        main.Mininet1.removeHostComponent("h1")
-        main.Mininet1.removeHostComponent("h2")
+            host.stopScapy( )
+        main.Mininet1.removeHostComponent( "h1" )
+        main.Mininet1.removeHostComponent( "h2" )
 
     def CASE1000( self, main ):
         '''
@@ -389,12 +386,11 @@
         main.log.info( "Creating host components" )
         main.Scapy.createHostComponent( "h1" )
         main.Scapy.createHostComponent( "h2" )
-        hosts = [main.h1, main.h2]
-        stepResult = main.TRUE
+        hosts = [ main.h1, main.h2 ]
         for host in hosts:
-            host.startHostCli()
-            host.startScapy()
-            host.updateSelf()
+            host.startHostCli( )
+            host.startScapy( )
+            host.updateSelf( )
 
         # Add a flow that connects host1 on port1 to host2 on port2
         # send output on port2
@@ -424,21 +420,21 @@
 
         main.log.info( "Get the flows from ONOS" )
         try:
-            flows = json.loads( main.ONOSrest.flows() )
+            flows = json.loads( main.ONOSrest.flows( ) )
 
             stepResult = main.TRUE
             for f in flows:
-                if "rest" in f.get("appId"):
-                    if "ADDED" not in f.get("state"):
+                if "rest" in f.get( "appId" ):
+                    if "ADDED" not in f.get( "state" ):
                         stepResult = main.FALSE
-                        main.log.error( "Flow: %s in state: %s" % (f.get("id"), f.get("state")) )
+                        main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
         except TypeError:
             main.log.error( "No Flows found by the REST API" )
             stepResult = main.FALSE
         except ValueError:
             main.log.error( "Problem getting Flows state from REST API.  Exiting test" )
-            main.cleanup()
-            main.exit()
+            main.cleanup( )
+            main.exit( )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
@@ -449,10 +445,10 @@
 
         # get the flow IDs that were added through rest
         main.log.info( "Getting the flow IDs from ONOS" )
-        flowIds = [ f.get("id") for f in flows if "rest" in f.get("appId") ]
+        flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
         # convert the flowIDs to ints then hex and finally back to strings
-        flowIds = [str(hex(int(x))) for x in flowIds]
-        main.log.info( "ONOS flow IDs: {}".format(flowIds) )
+        flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
+        main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
 
         stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
 
@@ -472,29 +468,30 @@
         # NOTE: I believe it doesn't matter which host name it is,
         # as long as the src and dst are both specified
         main.log.info( "Starting filter on host2" )
-        main.h2.startFilter( pktFilter="ether host %s" % main.h1.hostMac)
+        main.h2.startFilter( pktFilter="ether host %s" % main.h1.hostMac )
 
         main.log.info( "Sending packet to host2" )
         main.h1.sendPacket()
 
         main.log.info( "Checking filter for our packet" )
-        stepResult = main.h2.checkFilter()
+        stepResult = main.h2.checkFilter( )
         if stepResult:
-            main.log.info( "Packet: %s" % main.h2.readPackets() )
-        else: main.h2.killFilter()
+            main.log.info( "Packet: %s" % main.h2.readPackets( ) )
+        else:
+            main.h2.killFilter( )
 
         main.log.info( "Clean up host components" )
         for host in hosts:
-            host.stopScapy()
-        main.Mininet1.removeHostComponent("h1")
-        main.Mininet1.removeHostComponent("h2")
+            host.stopScapy( )
+        main.Mininet1.removeHostComponent( "h1" )
+        main.Mininet1.removeHostComponent( "h2" )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
                                  onpass="Successfully sent a packet",
                                  onfail="Failed to send a packet" )
 
-    def CASE1100( self, main ):
+    def CASE1400( self, main ):
         '''
             Add flows with IPv4 selectors and verify the flows
         '''
@@ -503,7 +500,7 @@
 
         main.case( "Verify flow IP selectors are correctly compiled" )
         main.caseExplanation = "Install two flows with only IP selectors " +\
-                "specified, then verify flows are added in ONOS, finally "+\
+                "specified, then verify flows are added in ONOS, finally " +\
                 "send a packet that only specifies the IP src and dst."
 
         main.step( "Add flows with IPv4 addresses as the only selectors" )
@@ -511,12 +508,11 @@
         main.log.info( "Creating host components" )
         main.Scapy.createHostComponent( "h1" )
         main.Scapy.createHostComponent( "h2" )
-        hosts = [main.h1, main.h2]
-        stepResult = main.TRUE
+        hosts = [ main.h1, main.h2 ]
         for host in hosts:
-            host.startHostCli()
-            host.startScapy()
-            host.updateSelf()
+            host.startHostCli( )
+            host.startScapy( )
+            host.updateSelf( )
 
         # Add a flow that connects host1 on port1 to host2 on port2
         # send output on port2
@@ -524,16 +520,16 @@
         egress = 2
         ingress = 1
         # IPv4 etherType = 0x800
-        IPv4=2048
+        ethType = main.params[ 'TEST' ][ 'ip4Type' ]
 
         # Add flows that connects host1 to host2
         main.log.info( "Add flow with port ingress 1 to port egress 2" )
         stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID,
                                             egressPort=egress,
                                             ingressPort=ingress,
-                                            ethType=IPv4,
-                                            ipSrc=("IPV4_SRC", main.h1.hostIp+"/32"),
-                                            ipDst=("IPV4_DST", main.h2.hostIp+"/32"),
+                                            ethType=ethType,
+                                            ipSrc=( "IPV4_SRC", main.h1.hostIp+"/32" ),
+                                            ipDst=( "IPV4_DST", main.h2.hostIp+"/32" ),
                                             debug=main.debug )
 
         utilities.assert_equals( expect=main.TRUE,
@@ -548,21 +544,21 @@
 
         main.log.info( "Get the flows from ONOS" )
         try:
-            flows = json.loads( main.ONOSrest.flows() )
+            flows = json.loads( main.ONOSrest.flows( ) )
 
             stepResult = main.TRUE
             for f in flows:
-                if "rest" in f.get("appId"):
-                    if "ADDED" not in f.get("state"):
+                if "rest" in f.get( "appId" ):
+                    if "ADDED" not in f.get( "state" ):
                         stepResult = main.FALSE
-                        main.log.error( "Flow: %s in state: %s" % (f.get("id"), f.get("state")) )
+                        main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
         except TypeError:
             main.log.error( "No Flows found by the REST API" )
             stepResult = main.FALSE
         except ValueError:
             main.log.error( "Problem getting Flows state from REST API.  Exiting test" )
-            main.cleanup()
-            main.exit()
+            main.cleanup( )
+            main.exit( )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
@@ -573,10 +569,10 @@
 
         # get the flow IDs that were added through rest
         main.log.info( "Getting the flow IDs from ONOS" )
-        flowIds = [ f.get("id") for f in flows if "rest" in f.get("appId") ]
+        flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
         # convert the flowIDs to ints then hex and finally back to strings
-        flowIds = [str(hex(int(x))) for x in flowIds]
-        main.log.info( "ONOS flow IDs: {}".format(flowIds) )
+        flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
+        main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
 
         stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
 
@@ -594,29 +590,151 @@
 
         main.log.info( "Starting filter on host2" )
         # Defaults to ip
-        main.h2.startFilter()
+        main.h2.startFilter( )
 
         main.log.info( "Sending packet to host2" )
-        main.h1.sendPacket()
+        main.h1.sendPacket( )
 
         main.log.info( "Checking filter for our packet" )
-        stepResult = main.h2.checkFilter()
+        stepResult = main.h2.checkFilter( )
         if stepResult:
-            main.log.info( "Packet: %s" % main.h2.readPackets() )
-        else: main.h2.killFilter()
+            main.log.info( "Packet: %s" % main.h2.readPackets( ) )
+        else: main.h2.killFilter( )
 
         main.log.info( "Clean up host components" )
         for host in hosts:
-            host.stopScapy()
-        main.Mininet1.removeHostComponent("h1")
-        main.Mininet1.removeHostComponent("h2")
+            host.stopScapy( )
+        main.Mininet1.removeHostComponent( "h1" )
+        main.Mininet1.removeHostComponent( "h2" )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
                                  onpass="Successfully sent a packet",
                                  onfail="Failed to send a packet" )
 
-    def CASE1200( self, main ):
+    def CASE1500 (self, main ):
+        """
+        Add flow with IPv6 selector and verify the flow
+        """
+        import json
+        import time
+        main.case( "Verify IPv6 selector is correctly compiled" )
+        main.caseExplanation = "Install two flows with only IP selectors " + \
+                               "specified, then verify flows are added in ONOS, finally " + \
+                               "send a packet that only specifies the IP src and dst."
+
+        main.step( "Add flows with IPv6 addresses as the only selectors" )
+
+        main.log.info( "Creating host components" )
+        main.Scapy.createHostComponent( "h5" )
+        main.Scapy.createHostComponent( "h6" )
+        hosts = [ main.h5, main.h6 ]
+
+        for host in hosts:
+            host.startHostCli( )
+            host.startScapy( )
+            host.updateSelf( IPv6=True )
+
+        # Add a flow that connects host1 on port1 to host2 on port2
+        # send output on port2
+        # recieve input on port1
+        egress = 6
+        ingress = 5
+        # IPv6 etherType = 0x86DD
+        ethType = main.params[ 'TEST' ][ 'ip6Type' ]
+
+        # Add flows that connects host1 to host2
+        main.log.info( "Add flow with port ingress 5 to port egress 6" )
+        stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID,
+                                            egressPort=egress,
+                                            ingressPort=ingress,
+                                            ethType=ethType,
+                                            ipSrc=( "IPV6_SRC", main.h5.hostIp + "/128" ),
+                                            ipDst=( "IPV6_DST", main.h6.hostIp + "/128" ),
+                                            debug=main.debug )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully added flows",
+                                 onfail="Failed add flows" )
+
+        # Giving ONOS time to add the flow
+        time.sleep( main.addFlowSleep )
+
+        main.step( "Check flow is in the ADDED state" )
+
+        main.log.info( "Get the flows from ONOS" )
+        try:
+            flows = json.loads( main.ONOSrest.flows( ) )
+
+            stepResult = main.TRUE
+            for f in flows:
+                if "rest" in f.get( "appId" ):
+                    if "ADDED" not in f.get( "state" ):
+                        stepResult = main.FALSE
+                        main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
+        except TypeError:
+            main.log.error( "No Flows found by the REST API" )
+            stepResult = main.FALSE
+        except ValueError:
+            main.log.error( "Problem getting Flows state from REST API.  Exiting test" )
+            main.cleanup( )
+            main.exit( )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="All flows are in the ADDED state",
+                                 onfail="All flows are NOT in the ADDED state" )
+
+        main.step( "Check flows are in Mininet's flow table" )
+
+        # get the flow IDs that were added through rest
+        main.log.info( "Getting the flow IDs from ONOS" )
+        flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
+        # convert the flowIDs to ints then hex and finally back to strings
+        flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
+        main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
+
+        stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="All flows are in mininet",
+                                 onfail="All flows are NOT in mininet" )
+
+        main.step( "Send a packet to verify the flow is correct" )
+
+        main.log.info( "Constructing packet" )
+        # No need for the MAC src dst
+        main.h5.buildEther( dst=main.h6.hostMac )
+        main.h5.buildIPv6( src=main.h5.hostIp, dst=main.h6.hostIp )
+
+        main.log.info( "Starting filter on host6" )
+        # Defaults to ip
+        main.h6.startFilter( pktFilter="ip6" )
+        main.log.info( "Sending packet to host6" )
+        main.h5.sendPacket( )
+
+        main.log.info( "Checking filter for our packet" )
+        stepResult = main.h6.checkFilter( )
+        if stepResult:
+            main.log.info( "Packet: %s" % main.h6.readPackets( ) )
+        else:
+            main.h6.killFilter( )
+
+        main.log.info( "Clean up host components" )
+        for host in hosts:
+            host.stopScapy( )
+        main.Mininet1.removeHostComponent( "h5" )
+        main.Mininet1.removeHostComponent( "h6" )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully sent a packet",
+                                 onfail="Failed to send a packet" )
+
+
+    def CASE1100( self, main ):
         '''
             Add flow with VLAN selector and verify the flow
         '''
@@ -632,12 +750,11 @@
         main.log.info( "Creating host components" )
         main.Scapy.createHostComponent( "h3" )
         main.Scapy.createHostComponent( "h4" )
-        hosts = [main.h3, main.h4]
-        stepResult = main.TRUE
+        hosts = [ main.h3, main.h4 ]
         for host in hosts:
-            host.startHostCli()
-            host.startScapy()
-            host.updateSelf()
+            host.startHostCli( )
+            host.startScapy( )
+            host.updateSelf( )
 
 
         main.step( "Add a flow with the VLAN tag as the only selector" )
@@ -648,7 +765,7 @@
         egress = 4
         ingress = 3
         # VLAN ethType = 0x8100
-        ethType = 33024
+        ethType = main.params[ 'TEST' ][ 'vlanType' ]
 
         # Add only one flow because we don't need a response
         main.log.info( "Add flow with port ingress 1 to port egress 2" )
@@ -672,21 +789,21 @@
 
         main.log.info( "Get the flows from ONOS" )
         try:
-            flows = json.loads( main.ONOSrest.flows() )
+            flows = json.loads( main.ONOSrest.flows( ) )
 
             stepResult = main.TRUE
             for f in flows:
-                if "rest" in f.get("appId"):
-                    if "ADDED" not in f.get("state"):
+                if "rest" in f.get( "appId" ):
+                    if "ADDED" not in f.get( "state" ):
                         stepResult = main.FALSE
-                        main.log.error( "Flow: %s in state: %s" % (f.get("id"), f.get("state")) )
+                        main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
         except TypeError:
             main.log.error( "No Flows found by the REST API" )
             stepResult = main.FALSE
         except ValueError:
             main.log.error( "Problem getting Flows state from REST API.  Exiting test" )
-            main.cleanup()
-            main.exit()
+            main.cleanup( )
+            main.exit( )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
@@ -697,10 +814,10 @@
 
         # get the flow IDs that were added through rest
         main.log.info( "Getting the flow IDs from ONOS" )
-        flowIds = [ f.get("id") for f in flows if "rest" in f.get("appId") ]
+        flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
         # convert the flowIDs to ints then hex and finally back to strings
-        flowIds = [str(hex(int(x))) for x in flowIds]
-        main.log.info( "ONOS flow IDs: {}".format(flowIds) )
+        flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
+        main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
 
         stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
 
@@ -712,29 +829,29 @@
         main.step( "Send a packet to verify the flow are correct" )
 
         # The receiving interface
-        recIface = "{}-eth0.{}".format(main.h4.name, vlan)
+        recIface = "{}-eth0.{}".format( main.h4.name, vlan )
         main.log.info( "Starting filter on host2" )
         # Filter is setup to catch any packet on the vlan interface with the correct vlan tag
-        main.h4.startFilter( ifaceName=recIface, pktFilter="" )
+        main.h4.startFilter( ifaceName=recIface, pktFilter = "" )
 
         # Broadcast the packet on the vlan interface. We only care if the flow forwards
         # the packet with the correct vlan tag, not if the mac addr is correct
-        sendIface = "{}-eth0.{}".format(main.h3.name, vlan)
+        sendIface = "{}-eth0.{}".format( main.h3.name, vlan )
         main.log.info( "Broadcasting the packet with a vlan tag" )
         main.h3.sendPacket( iface=sendIface,
-                            packet="Ether()/Dot1Q(vlan={})".format(vlan) )
+                            packet="Ether()/Dot1Q(vlan={})".format( vlan ) )
 
         main.log.info( "Checking filter for our packet" )
-        stepResult = main.h4.checkFilter()
+        stepResult = main.h4.checkFilter( )
         if stepResult:
-            main.log.info( "Packet: %s" % main.h4.readPackets() )
-        else: main.h4.killFilter()
+            main.log.info( "Packet: %s" % main.h4.readPackets( ) )
+        else: main.h4.killFilter( )
 
         main.log.info( "Clean up host components" )
         for host in hosts:
-            host.stopScapy()
-        main.Mininet1.removeHostComponent("h3")
-        main.Mininet1.removeHostComponent("h4")
+            host.stopScapy( )
+        main.Mininet1.removeHostComponent( "h3" )
+        main.Mininet1.removeHostComponent( "h4" )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
@@ -750,7 +867,7 @@
 
         main.case( "Verify the MPLS selector is correctly compiled on the flow." )
         main.caseExplanation = "Install one flow with an MPLS selector, " +\
-                               "verify the flow is added in ONOS, and finally "+\
+                               "verify the flow is added in ONOS, and finally " +\
                                "send a packet via scapy that has a MPLS label."
 
         main.step( "Add a flow with a MPLS selector" )
@@ -758,12 +875,11 @@
         main.log.info( "Creating host components" )
         main.Scapy.createHostComponent( "h1" )
         main.Scapy.createHostComponent( "h2" )
-        hosts = [main.h1, main.h2]
-        stepResult = main.TRUE
+        hosts = [ main.h1, main.h2 ]
         for host in hosts:
-            host.startHostCli()
+            host.startHostCli( )
             host.startScapy( main.dependencyPath )
-            host.updateSelf()
+            host.updateSelf( )
 
         # ports
         egress = 2
@@ -794,21 +910,21 @@
 
         main.log.info( "Get the flows from ONOS" )
         try:
-            flows = json.loads( main.ONOSrest.flows() )
+            flows = json.loads( main.ONOSrest.flows( ) )
 
             stepResult = main.TRUE
             for f in flows:
-                if "rest" in f.get("appId"):
-                    if "ADDED" not in f.get("state"):
+                if "rest" in f.get( "appId" ):
+                    if "ADDED" not in f.get( "state" ):
                         stepResult = main.FALSE
-                        main.log.error( "Flow: %s in state: %s" % (f.get("id"), f.get("state")) )
+                        main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
         except TypeError:
             main.log.error( "No Flows found by the REST API" )
             stepResult = main.FALSE
         except ValueError:
             main.log.error( "Problem getting Flows state from REST API.  Exiting test" )
-            main.cleanup()
-            main.exit()
+            main.cleanup( )
+            main.exit( )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
@@ -819,10 +935,10 @@
 
         # get the flow IDs that were added through rest
         main.log.info( "Getting the flow IDs from ONOS" )
-        flowIds = [ f.get("id") for f in flows if "rest" in f.get("appId") ]
+        flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
         # convert the flowIDs to ints then hex and finally back to strings
-        flowIds = [str(hex(int(x))) for x in flowIds]
-        main.log.info( "ONOS flow IDs: {}".format(flowIds) )
+        flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
+        main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
 
         stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=True )
 
@@ -838,26 +954,26 @@
 
         main.log.info( "Constructing packet" )
         main.log.info( "Sending packet to host2" )
-        main.h1.sendPacket( packet='Ether()/MPLS(label={})'.format(mplsLabel) )
+        main.h1.sendPacket( packet='Ether()/MPLS(label={})'.format( mplsLabel ) )
 
         main.log.info( "Checking filter for our packet" )
-        stepResult = main.h2.checkFilter()
+        stepResult = main.h2.checkFilter( )
         if stepResult:
-            main.log.info( "Packet: %s" % main.h2.readPackets() )
-        else: main.h2.killFilter()
+            main.log.info( "Packet: %s" % main.h2.readPackets( ) )
+        else: main.h2.killFilter( )
 
         main.log.info( "Clean up host components" )
         for host in hosts:
-            host.stopScapy()
-        main.Mininet1.removeHostComponent("h1")
-        main.Mininet1.removeHostComponent("h2")
+            host.stopScapy( )
+        main.Mininet1.removeHostComponent( "h1" )
+        main.Mininet1.removeHostComponent( "h2" )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
                                  onpass="Successfully sent a packet",
                                  onfail="Failed to send a packet" )
 
-    def CASE1400( self, main ):
+    def CASE1700( self, main ):
         '''
             Add flows with a TCP selector and verify the flow
         '''
@@ -866,7 +982,7 @@
 
         main.case( "Verify the TCP selector is correctly compiled on the flow" )
         main.caseExplanation = "Install a flow with only the TCP selector " +\
-                "specified, verify the flow is added in ONOS, and finally "+\
+                "specified, verify the flow is added in ONOS, and finally " +\
                 "send a TCP packet to verify the TCP selector is compiled correctly."
 
         main.step( "Add a flow with a TCP selector" )
@@ -874,12 +990,11 @@
         main.log.info( "Creating host components" )
         main.Scapy.createHostComponent( "h1" )
         main.Scapy.createHostComponent( "h2" )
-        hosts = [main.h1, main.h2]
-        stepResult = main.TRUE
+        hosts = [ main.h1, main.h2 ]
         for host in hosts:
-            host.startHostCli()
-            host.startScapy()
-            host.updateSelf()
+            host.startHostCli( )
+            host.startScapy( )
+            host.updateSelf( )
 
         # Add a flow that connects host1 on port1 to host2 on port2
         egress = 2
@@ -912,21 +1027,21 @@
 
         main.log.info( "Get the flows from ONOS" )
         try:
-            flows = json.loads( main.ONOSrest.flows() )
+            flows = json.loads( main.ONOSrest.flows( ) )
 
             stepResult = main.TRUE
             for f in flows:
-                if "rest" in f.get("appId"):
-                    if "ADDED" not in f.get("state"):
+                if "rest" in f.get( "appId" ):
+                    if "ADDED" not in f.get( "state" ):
                         stepResult = main.FALSE
-                        main.log.error( "Flow: %s in state: %s" % (f.get("id"), f.get("state")) )
+                        main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
         except TypeError:
             main.log.error( "No Flows found by the REST API" )
             stepResult = main.FALSE
         except ValueError:
             main.log.error( "Problem getting Flows state from REST API.  Exiting test" )
-            main.cleanup()
-            main.exit()
+            main.cleanup( )
+            main.exit( )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
@@ -937,10 +1052,10 @@
 
         # get the flow IDs that were added through rest
         main.log.info( "Getting the flow IDs from ONOS" )
-        flowIds = [ f.get("id") for f in flows if "rest" in f.get("appId") ]
+        flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
         # convert the flowIDs to ints then hex and finally back to strings
-        flowIds = [str(hex(int(x))) for x in flowIds]
-        main.log.info( "ONOS flow IDs: {}".format(flowIds) )
+        flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
+        main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
 
         stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
 
@@ -962,26 +1077,26 @@
         main.h2.startFilter( pktFilter="tcp" )
 
         main.log.info( "Sending packet to host2" )
-        main.h1.sendPacket()
+        main.h1.sendPacket( )
 
         main.log.info( "Checking filter for our packet" )
-        stepResult = main.h2.checkFilter()
+        stepResult = main.h2.checkFilter( )
         if stepResult:
-            main.log.info( "Packet: %s" % main.h2.readPackets() )
-        else: main.h2.killFilter()
+            main.log.info( "Packet: %s" % main.h2.readPackets( ) )
+        else: main.h2.killFilter( )
 
         main.log.info( "Clean up host components" )
         for host in hosts:
-            host.stopScapy()
-        main.Mininet1.removeHostComponent("h1")
-        main.Mininet1.removeHostComponent("h2")
+            host.stopScapy( )
+        main.Mininet1.removeHostComponent( "h1" )
+        main.Mininet1.removeHostComponent( "h2" )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
                                  onpass="Successfully sent a packet",
                                  onfail="Failed to send a packet" )
 
-    def CASE1500( self, main ):
+    def CASE1600( self, main ):
         '''
             Add flows with a UDP selector and verify the flow
         '''
@@ -990,7 +1105,7 @@
 
         main.case( "Verify the UDP selector is correctly compiled on the flow" )
         main.caseExplanation = "Install a flow with only the UDP selector " +\
-                "specified, verify the flow is added in ONOS, and finally "+\
+                "specified, verify the flow is added in ONOS, and finally " +\
                 "send a UDP packet to verify the UDP selector is compiled correctly."
 
         main.step( "Add a flow with a UDP selector" )
@@ -998,12 +1113,11 @@
         main.log.info( "Creating host components" )
         main.Scapy.createHostComponent( "h1" )
         main.Scapy.createHostComponent( "h2" )
-        hosts = [main.h1, main.h2]
-        stepResult = main.TRUE
+        hosts = [ main.h1, main.h2 ]
         for host in hosts:
-            host.startHostCli()
-            host.startScapy()
-            host.updateSelf()
+            host.startHostCli( )
+            host.startScapy( )
+            host.updateSelf( )
 
         # Add a flow that connects host1 on port1 to host2 on port2
         egress = 2
@@ -1036,21 +1150,21 @@
 
         main.log.info( "Get the flows from ONOS" )
         try:
-            flows = json.loads( main.ONOSrest.flows() )
+            flows = json.loads( main.ONOSrest.flows( ) )
 
             stepResult = main.TRUE
             for f in flows:
-                if "rest" in f.get("appId"):
-                    if "ADDED" not in f.get("state"):
+                if "rest" in f.get( "appId" ):
+                    if "ADDED" not in f.get( "state" ):
                         stepResult = main.FALSE
-                        main.log.error( "Flow: %s in state: %s" % (f.get("id"), f.get("state")) )
+                        main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
         except TypeError:
             main.log.error( "No Flows found by the REST API" )
             stepResult = main.FALSE
         except ValueError:
             main.log.error( "Problem getting Flows state from REST API.  Exiting test" )
-            main.cleanup()
-            main.exit()
+            main.cleanup( )
+            main.exit( )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
@@ -1061,10 +1175,10 @@
 
         # get the flow IDs that were added through rest
         main.log.info( "Getting the flow IDs from ONOS" )
-        flowIds = [ f.get("id") for f in flows if "rest" in f.get("appId") ]
+        flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
         # convert the flowIDs to ints then hex and finally back to strings
-        flowIds = [str(hex(int(x))) for x in flowIds]
-        main.log.info( "ONOS flow IDs: {}".format(flowIds) )
+        flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
+        main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
 
         stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
 
@@ -1086,48 +1200,290 @@
         main.h2.startFilter( pktFilter="udp" )
 
         main.log.info( "Sending packet to host2" )
-        main.h1.sendPacket()
+        main.h1.sendPacket( )
 
         main.log.info( "Checking filter for our packet" )
-        stepResult = main.h2.checkFilter()
+        stepResult = main.h2.checkFilter( )
         if stepResult:
-            main.log.info( "Packet: %s" % main.h2.readPackets() )
-        else: main.h2.killFilter()
+            main.log.info( "Packet: %s" % main.h2.readPackets( ) )
+        else: main.h2.killFilter( )
 
         main.log.info( "Clean up host components" )
         for host in hosts:
-            host.stopScapy()
-        main.Mininet1.removeHostComponent("h1")
-        main.Mininet1.removeHostComponent("h2")
+            host.stopScapy( )
+        main.Mininet1.removeHostComponent( "h1" )
+        main.Mininet1.removeHostComponent( "h2" )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
                                  onpass="Successfully sent a packet",
                                  onfail="Failed to send a packet" )
 
-
-    def CASE2000( self, main ):
+    def CASE1900( self, main ):
+        '''
+            Add flows with a ICMPv4 selector and verify the flow
+        '''
         import json
+        import time
 
-        main.case( "Delete flows that were added through rest" )
-        main.step("Deleting flows")
+        main.case( "Verify the ICMPv4 selector is correctly compiled on the flow" )
+        main.caseExplanation = "Install a flow with only the ICMPv4 selector " +\
+                "specified, verify the flow is added in ONOS, and finally " +\
+                "send a IMCPv4 packet to verify the ICMPv4 selector is compiled correctly."
 
-        main.log.info( "Getting flows" )
+        main.step( "Add a flow with a ICMPv4 selector" )
+
+        main.log.info( "Creating host components" )
+        main.Scapy.createHostComponent( "h1" )
+        main.Scapy.createHostComponent( "h2" )
+        hosts = [ main.h1, main.h2 ]
+        for host in hosts:
+            host.startHostCli( )
+            host.startScapy( )
+            host.updateSelf( )
+
+        # Add a flow that connects host1 on port1 to host2 on port2
+        egress = 2
+        ingress = 1
+        # IPv4 etherType
+        ethType = main.params[ 'TEST' ][ 'ip4Type' ]
+        # IP protocol
+        ipProto = main.params[ 'TEST' ][ 'icmpProto' ]
+
+        main.log.info( "Add a flow that connects host1 on port1 to host2 on port2" )
+        stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID,
+                                            egressPort=egress,
+                                            ingressPort=ingress,
+                                            ethType=ethType,
+                                            ipProto=ipProto,
+                                            debug=main.debug )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully added flows",
+                                 onfail="Failed add flows" )
+
+        # Giving ONOS time to add the flow
+        time.sleep( main.addFlowSleep )
+
+        main.step( "Check flow is in the ADDED state" )
+
+        main.log.info( "Get the flows from ONOS" )
         try:
-            flows = json.loads( main.ONOSrest.flows() )
+            flows = json.loads( main.ONOSrest.flows( ) )
 
             stepResult = main.TRUE
             for f in flows:
-                if "rest" in f.get("appId"):
-                    if main.debug: main.log.debug( "Flow to be deleted:\n{}".format( main.ONOSrest.pprint(f) ) )
-                    stepResult = stepResult and main.ONOSrest.removeFlow( f.get("deviceId"), f.get("id") )
+                if "rest" in f.get( "appId" ):
+                    if "ADDED" not in f.get( "state" ):
+                        stepResult = main.FALSE
+                        main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
         except TypeError:
             main.log.error( "No Flows found by the REST API" )
             stepResult = main.FALSE
         except ValueError:
             main.log.error( "Problem getting Flows state from REST API.  Exiting test" )
-            main.cleanup()
-            main.exit()
+            main.cleanup( )
+            main.exit( )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="All flows are in the ADDED state",
+                                 onfail="All flows are NOT in the ADDED state" )
+
+        main.step( "Check flows are in Mininet's flow table" )
+
+        # get the flow IDs that were added through rest
+        main.log.info( "Getting the flow IDs from ONOS" )
+        flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
+        # convert the flowIDs to ints then hex and finally back to strings
+        flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
+        main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
+
+        stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="All flows are in mininet",
+                                 onfail="All flows are NOT in mininet" )
+
+        main.step( "Send a packet to verify the flow is correct" )
+
+        main.log.info( "Constructing packet" )
+        # No need for the MAC src dst
+        main.h1.buildEther( dst=main.h2.hostMac )
+        main.h1.buildIP( dst=main.h2.hostIp )
+        main.h1.buildICMP( )
+
+        main.log.info( "Starting filter on host2" )
+        # Defaults to ip
+        main.h2.startFilter( pktFilter="icmp" )
+
+        main.log.info( "Sending packet to host2" )
+        main.h1.sendPacket( )
+
+        main.log.info( "Checking filter for our packet" )
+        stepResult = main.h2.checkFilter( )
+        if stepResult:
+            main.log.info( "Packet: %s" % main.h2.readPackets( ) )
+        else: main.h2.killFilter( )
+
+        main.log.info( "Clean up host components" )
+        for host in hosts:
+            host.stopScapy( )
+        main.Mininet1.removeHostComponent( "h1" )
+        main.Mininet1.removeHostComponent( "h2" )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully sent a packet",
+                                 onfail="Failed to send a packet" )
+
+    def CASE2000( self, main ):
+        '''
+            Add flows with a ICMPv6 selector and verify the flow
+        '''
+        import json
+        import time
+
+        main.case( "Verify the ICMPv6 selector is correctly compiled on the flow" )
+        main.caseExplanation = "Install a flow with only the ICMPv6 selector " +\
+                "specified, verify the flow is added in ONOS, and finally " +\
+                "send a IMCPv6 packet to verify the ICMPv6 selector is compiled correctly."
+
+        main.step( "Add a flow with a ICMPv6 selector" )
+
+        main.log.info( "Creating host components" )
+        main.Scapy.createHostComponent( "h5" )
+        main.Scapy.createHostComponent( "h6" )
+        hosts =[ main.h5, main.h6 ]
+        for host in hosts:
+            host.startHostCli( )
+            host.startScapy( )
+            host.updateSelf( IPv6=True )
+
+        # Add a flow that connects host1 on port1 to host2 on port2
+        egress =6
+        ingress =5
+        # IPv6 etherType
+        ethType = main.params[ 'TEST' ][ 'ip6Type' ]
+        # IP protocol
+        ipProto = main.params[ 'TEST' ][ 'icmp6Proto' ]
+
+        main.log.info( "Add a flow that connects host1 on port1 to host2 on port2" )
+        stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID,
+                                            egressPort=egress,
+                                            ingressPort=ingress,
+                                            ethType=ethType,
+                                            ipProto=ipProto,
+                                            debug=main.debug )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully added flows",
+                                 onfail="Failed add flows" )
+
+        # Giving ONOS time to add the flow
+        time.sleep( main.addFlowSleep )
+
+        main.step( "Check flow is in the ADDED state" )
+
+        main.log.info( "Get the flows from ONOS" )
+        try:
+            flows = json.loads( main.ONOSrest.flows( ) )
+
+            stepResult = main.TRUE
+            for f in flows:
+                if "rest" in f.get( "appId" ):
+                    if "ADDED" not in f.get( "state" ):
+                        stepResult = main.FALSE
+                        main.log.error( "Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
+        except TypeError:
+            main.log.error( "No Flows found by the REST API" )
+            stepResult = main.FALSE
+        except ValueError:
+            main.log.error( "Problem getting Flows state from REST API.  Exiting test" )
+            main.cleanup( )
+            main.exit( )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="All flows are in the ADDED state",
+                                 onfail="All flows are NOT in the ADDED state" )
+
+        main.step( "Check flows are in Mininet's flow table" )
+
+        # get the flow IDs that were added through rest
+        main.log.info( "Getting the flow IDs from ONOS" )
+        flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
+        # convert the flowIDs to ints then hex and finally back to strings
+        flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
+        main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
+
+        stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="All flows are in mininet",
+                                 onfail="All flows are NOT in mininet" )
+
+        main.step( "Send a packet to verify the flow is correct" )
+
+        main.log.info( "Constructing packet" )
+        # No need for the MAC src dst
+        main.h5.buildEther( dst=main.h6.hostMac )
+        main.h5.buildIPv6( dst=main.h6.hostIp )
+        main.h5.buildICMP( ipVersion=6 )
+
+        main.log.info( "Starting filter on host2" )
+        # Defaults to ip
+        main.h6.startFilter( pktFilter="icmp6" )
+
+        main.log.info( "Sending packet to host2" )
+        main.h5.sendPacket( )
+
+        main.log.info( "Checking filter for our packet" )
+        stepResult = main.h6.checkFilter( )
+        if stepResult:
+            main.log.info( "Packet: %s" % main.h6.readPackets( ) )
+        else: main.h6.killFilter( )
+
+        main.log.info( "Clean up host components" )
+        for host in hosts:
+            host.stopScapy( )
+        main.Mininet1.removeHostComponent( "h5" )
+        main.Mininet1.removeHostComponent( "h6" )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully sent a packet",
+                                 onfail="Failed to send a packet" )
+
+    def CASE3000( self, main ):
+        '''
+            Delete flow
+        '''
+        import json
+
+        main.case( "Delete flows that were added through rest" )
+        main.step( "Deleting flows" )
+
+        main.log.info( "Getting flows" )
+        try:
+            flows = json.loads( main.ONOSrest.flows( ) )
+
+            stepResult = main.TRUE
+            for f in flows:
+                if "rest" in f.get( "appId" ):
+                    if main.debug: main.log.debug( "Flow to be deleted:\n{}".format( main.ONOSrest.pprint( f ) ) )
+                    stepResult = stepResult and main.ONOSrest.removeFlow( f.get( "deviceId" ), f.get( "id" ) )
+        except TypeError:
+            main.log.error( "No Flows found by the REST API" )
+            stepResult = main.FALSE
+        except ValueError:
+            main.log.error( "Problem getting Flows state from REST API.  Exiting test" )
+            main.cleanup( )
+            main.exit( )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
@@ -1136,11 +1492,254 @@
 
         time.sleep( main.delFlowSleep )
 
+
+    def CASE1200(self, main ):
+        '''
+            Add flows with a ARP selector and verify the flow
+        '''
+        import json
+        import time
+
+        main.case( "Verify flow IP selectors are correctly compiled" )
+        main.caseExplanation = "Install two flows with only IP selectors " + \
+                               "specified, then verify flows are added in ONOS, finally " + \
+                               "send a packet that only specifies the IP src and dst."
+
+        main.step( "Add flows with ARP addresses as the only selectors" )
+
+        main.log.info( "Creating host components" )
+        main.Scapy.createHostComponent( "h1" )
+        main.Scapy.createHostComponent( "h2" )
+        hosts = [ main.h1, main.h2 ]
+        for host in hosts:
+            host.startHostCli( )
+            host.startScapy( )
+            host.updateSelf( )
+
+        # Add a flow that connects host1 on port1 to host2 on port2
+        # send output on port2
+        # recieve input on port1
+        egress = 2
+        ingress = 1
+        # ARP etherType = 0x0806
+        ethType = main.params[ 'TEST' ][ 'arpType' ]
+
+        # Add flows that connects host1 to host2
+        main.log.info( "Add flow with port ingress 1 to port egress 2" )
+        stepResult = main.ONOSrest.addFlow(deviceId=main.swDPID,
+                                           egressPort=egress,
+                                           ingressPort=ingress,
+                                           ethType=ethType,
+                                           priority=40001,
+                                           debug=main.debug )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully added flows",
+                                 onfail="Failed add flows" )
+
+        # Giving ONOS time to add the flow
+        time.sleep( main.addFlowSleep )
+
+        main.step( "Check flow is in the ADDED state" )
+
+        main.log.info( "Get the flows from ONOS" )
+        try:
+            flows = json.loads( main.ONOSrest.flows( ) )
+
+            stepResult = main.TRUE
+            for f in flows:
+                if "rest" in f.get( "appId" ):
+                    if "ADDED" not in f.get( "state" ):
+                        stepResult = main.FALSE
+                        main.log.error("Flow: %s in state: %s" % ( f.get("id"), f.get( "state" ) ) )
+        except TypeError:
+            main.log.error( "No Flows found by the REST API" )
+            stepResult = main.FALSE
+        except ValueError:
+            main.log.error( "Problem getting Flows state from REST API.  Exiting test" )
+            main.cleanup( )
+            main.exit( )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="All flows are in the ADDED state",
+                                 onfail="All flows are NOT in the ADDED state" )
+
+        main.step( "Check flows are in Mininet's flow table" )
+
+        # get the flow IDs that were added through rest
+        main.log.info( "Getting the flow IDs from ONOS" )
+        flowIds = [f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
+        # convert the flowIDs to ints then hex and finally back to strings
+        flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
+        main.log.info("ONOS flow IDs: {}".format( flowIds ) )
+
+        stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="All flows are in mininet",
+                                 onfail="All flows are NOT in mininet" )
+
+        main.step( "Send a packet to verify the flow is correct" )
+
+        main.log.info( "Constructing packet" )
+        # No need for the MAC src dst
+        main.h1.buildEther( src=main.h1.hostMac, dst=main.h2.hostMac )
+        main.h1.buildARP( pdst=main.h2.hostIp )
+
+        main.log.info( "Starting filter on host2" )
+        # Defaults to ip
+        main.h2.startFilter( pktFilter="arp" )
+
+        main.log.info( "Sending packet to host2" )
+        main.h1.sendPacket( )
+
+        main.log.info( "Checking filter for our packet" )
+        stepResult = main.h2.checkFilter( )
+        if stepResult:
+            main.log.info( "Packet: %s" % main.h2.readPackets( ) )
+        else:
+            main.h2.killFilter( )
+
+        main.log.info( "Clean up host components" )
+        for host in hosts:
+            host.stopScapy( )
+        main.Mininet1.removeHostComponent( "h1" )
+        main.Mininet1.removeHostComponent( "h2" )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully sent a packet",
+                                 onfail="Failed to send a packet" )
+
+    def CASE1800( self, main ):
+        '''
+           Add flows with a SCTP selector and verify the flow
+        '''
+        import json
+        import time
+
+        main.case( "Verify the UDP selector is correctly compiled on the flow" )
+        main.caseExplanation = "Install a flow with only the UDP selector " + \
+                               "specified, verify the flow is added in ONOS, and finally " + \
+                               "send a UDP packet to verify the UDP selector is compiled correctly."
+
+        main.step( "Add a flow with a SCTP selector" )
+
+        main.log.info( "Creating host components" )
+        main.Scapy.createHostComponent( "h1" )
+        main.Scapy.createHostComponent( "h2" )
+        hosts = [ main.h1, main.h2 ]
+        for host in hosts:
+            host.startHostCli( )
+            host.startScapy( )
+            host.updateSelf( )
+
+        # Add a flow that connects host1 on port1 to host2 on port2
+        egress = 2
+        ingress = 1
+        # IPv4 etherType
+        ethType = main.params[ 'TEST' ][ 'ip4Type' ]
+        # IP protocol
+        ipProto = main.params[ 'TEST' ][ 'sctpProto' ]
+
+        main.log.info("Add a flow that connects host1 on port1 to host2 on port2")
+        stepResult = main.ONOSrest.addFlow( deviceId=main.swDPID,
+                                            egressPort=egress,
+                                            ingressPort=ingress,
+                                            ethType=ethType,
+                                            ipProto=ipProto,
+                                            debug=main.debug )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully added flows",
+                                 onfail="Failed add flows" )
+
+        # Giving ONOS time to add the flow
+        time.sleep( main.addFlowSleep )
+
+        main.step( "Check flow is in the ADDED state" )
+
+        main.log.info( "Get the flows from ONOS" )
+        try:
+            flows = json.loads( main.ONOSrest.flows( ) )
+
+            stepResult = main.TRUE
+            for f in flows:
+                if "rest" in f.get( "appId" ):
+                    if "ADDED" not in f.get( "state" ):
+                        stepResult = main.FALSE
+                        main.log.error("Flow: %s in state: %s" % ( f.get( "id" ), f.get( "state" ) ) )
+        except TypeError:
+            main.log.error( "No Flows found by the REST API" )
+            stepResult = main.FALSE
+        except ValueError:
+            main.log.error( "Problem getting Flows state from REST API.  Exiting test" )
+            main.cleanup( )
+            main.exit( )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="All flows are in the ADDED state",
+                                 onfail="All flows are NOT in the ADDED state" )
+
+        main.step( "Check flows are in Mininet's flow table" )
+
+        # get the flow IDs that were added through rest
+        main.log.info( "Getting the flow IDs from ONOS" )
+        flowIds = [ f.get( "id" ) for f in flows if "rest" in f.get( "appId" ) ]
+        # convert the flowIDs to ints then hex and finally back to strings
+        flowIds = [ str( hex( int( x ) ) ) for x in flowIds ]
+        main.log.info( "ONOS flow IDs: {}".format( flowIds ) )
+
+        stepResult = main.Mininet1.checkFlowId( "s1", flowIds, debug=False )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="All flows are in mininet",
+                                 onfail="All flows are NOT in mininet" )
+
+        main.step( "Send a packet to verify the flow is correct" )
+
+        main.log.info( "Constructing packet" )
+        # No need for the MAC src dst
+        main.h1.buildEther( dst=main.h2.hostMac )
+        main.h1.buildIP( dst=main.h2.hostIp )
+        main.h1.buildSCTP( )
+
+        main.log.info( "Starting filter on host2" )
+        # Defaults to ip
+        main.h2.startFilter( pktFilter="sctp" )
+
+        main.log.info( "Sending packet to host2" )
+        main.h1.sendPacket( )
+
+        main.log.info( "Checking filter for our packet" )
+        stepResult = main.h2.checkFilter( )
+        if stepResult:
+            main.log.info( "Packet: %s" % main.h2.readPackets( ) )
+        else:
+            main.h2.killFilter( )
+
+        main.log.info( "Clean up host components" )
+        for host in hosts:
+            host.stopScapy( )
+        main.Mininet1.removeHostComponent( "h1" )
+        main.Mininet1.removeHostComponent( "h2" )
+
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=stepResult,
+                                 onpass="Successfully sent a packet",
+                                 onfail="Failed to send a packet" )
+
     def CASE100( self, main ):
         '''
             Report errors/warnings/exceptions
         '''
-        main.log.info("Error report: \n" )
+        main.log.info( "Error report: \n" )
         main.ONOSbench.logReport( main.ONOSip[ 0 ],
                                   [ "INFO",
                                     "FOLLOWER",
diff --git a/TestON/tests/FUNC/FUNCflow/dependencies/flow-2sw.py b/TestON/tests/FUNC/FUNCflow/dependencies/flow-2sw.py
deleted file mode 100755
index 2299d9e..0000000
--- a/TestON/tests/FUNC/FUNCflow/dependencies/flow-2sw.py
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/python
-
-"""
-Custom topology for Mininet
-"""
-from mininet.topo import Topo
-from mininet.net import Mininet
-from mininet.node import Host, RemoteController
-from mininet.node import Node
-from mininet.node import CPULimitedHost
-from mininet.link import TCLink
-from mininet.cli import CLI
-from mininet.log import setLogLevel
-from mininet.util import dumpNodeConnections
-from mininet.node import ( UserSwitch, OVSSwitch, IVSSwitch )
-
-class MyTopo( Topo ):
-
-    def __init__( self ):
-        # Initialize topology
-        Topo.__init__( self )
-        # Switch S5 Hosts
-        host1=self.addHost( 'h1', ip='10.1.0.1/24' )
-        host2=self.addHost( 'h2', ip='10.1.0.2/24' )
-        #host3=self.addHost( 'h3', ip='10.1.0.3/24', v6Addr='1000::3/64' )
-        #host4=self.addHost( 'h4', ip='10.1.0.4/24', v6Addr='1000::4/64' )
-
-        s1 = self.addSwitch( 's1' )
-        #s2 = self.addSwitch( 's2' )
-
-        self.addLink(s1, host1)
-        self.addLink(s1, host2)
-        #self.addLink(s1, host3)
-        #self.addLink(s1, host4)
-
-
-        topos = { 'mytopo': ( lambda: MyTopo() ) }
-
-def setupNetwork():
-    "Create network"
-    topo = MyTopo()
-    network = Mininet(topo=topo, autoSetMacs=True, controller=None)
-    network.start()
-    CLI( network )
-    network.stop()
-
-if __name__ == '__main__':
-    setLogLevel('info')
-    #setLogLevel('debug')
-    setupNetwork()
diff --git a/TestON/tests/FUNC/FUNCflow/dependencies/topo-flow.py b/TestON/tests/FUNC/FUNCflow/dependencies/topo-flow.py
index f9d58c1..6222d75 100755
--- a/TestON/tests/FUNC/FUNCflow/dependencies/topo-flow.py
+++ b/TestON/tests/FUNC/FUNCflow/dependencies/topo-flow.py
@@ -48,6 +48,9 @@
         host3=self.addHost( 'h3', ip='10.0.0.3/24', cls=VLANHost, vlan=10 )
         host4=self.addHost( 'h4', ip='10.0.0.4/24', cls=VLANHost, vlan=10 )
 
+        #IPv6 hosts
+        host5=self.addHost( 'h5', ip='10.0.0.5/24', cls=IPv6Host, v6Addr='1000::5/64')
+        host6=self.addHost( 'h6', ip='10.0.0.6/24', cls=IPv6Host, v6Addr='1000::6/64')
 
         s1 = self.addSwitch( 's1' )
 
@@ -55,6 +58,8 @@
         self.addLink(s1, host2)
         self.addLink(s1, host3)
         self.addLink(s1, host4)
+        self.addLink(s1, host5)
+        self.addLink(s1, host6)
 
 
         topos = { 'mytopo': ( lambda: MyTopo() ) }
diff --git a/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py b/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py
index 967dea5..9135daf 100644
--- a/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py
+++ b/TestON/tests/FUNC/FUNCnetconf/FUNCnetconf.py
@@ -270,7 +270,7 @@
         scpResult = main.TRUE
         copyResult = main.TRUE
         for i in range( main.numCtrls ):
-            main.node = main.CLIs[ i ]
+            main.node = main.CLIs2[ i ]
             ip = main.ONOSip[ i ]
             main.node.ip_address = ip
             scpResult = scpResult and main.ONOSbench.scp( main.node ,
diff --git a/TestON/tests/HA/HAclusterRestart/HAclusterRestart.params b/TestON/tests/HA/HAclusterRestart/HAclusterRestart.params
index a77e100..71c964d 100644
--- a/TestON/tests/HA/HAclusterRestart/HAclusterRestart.params
+++ b/TestON/tests/HA/HAclusterRestart/HAclusterRestart.params
@@ -22,8 +22,11 @@
     <apps></apps>
     <ONOS_Configuration>
         <org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
-            <useFlowObjectives>true</useFlowObjectives>
+            <useFlowObjectives>false</useFlowObjectives>
         </org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
+        <org.onosproject.store.flow.impl.DistributedFlowRuleStore>
+            <backupCount>3</backupCount>
+        </org.onosproject.store.flow.impl.DistributedFlowRuleStore>
     </ONOS_Configuration>
     <ENV>
         <cellName>HA</cellName>
diff --git a/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py b/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py
index 6ff14ce..94d5515 100644
--- a/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py
+++ b/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py
@@ -1858,6 +1858,8 @@
                 output = cli.summary()
                 if not output:
                     ready = False
+            if ready:
+                break
             time.sleep( 30 )
         utilities.assert_equals( expect=True, actual=ready,
                                  onpass="ONOS summary command succeded",
@@ -2627,6 +2629,10 @@
                     main.CLIs[i].name,
                     main.CLIs[i].sendline( "scr:list | grep -v ACTIVE" ) ) )
 
+        if not topoResult:
+            main.cleanup()
+            main.exit()
+
     def CASE9( self, main ):
         """
         Link s3-s28 down
diff --git a/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.params b/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.params
index eb758d2..f79b913 100644
--- a/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.params
+++ b/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.params
@@ -24,8 +24,11 @@
     <apps></apps>
     <ONOS_Configuration>
         <org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
-            <useFlowObjectives>true</useFlowObjectives>
+            <useFlowObjectives>false</useFlowObjectives>
         </org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
+        <org.onosproject.store.flow.impl.DistributedFlowRuleStore>
+            <backupCount>3</backupCount>
+        </org.onosproject.store.flow.impl.DistributedFlowRuleStore>
     </ONOS_Configuration>
     <ENV>
         <cellName>HA</cellName>
diff --git a/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py b/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py
index 1b83edf..0da776c 100644
--- a/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py
+++ b/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py
@@ -1793,6 +1793,8 @@
             main.log.debug( "Checking logs for errors on " + node.name + ":" )
             main.log.warn( main.ONOSbench.checkLogs( node.ip_address ) )
 
+        main.log.debug( main.CLIs[0].roles( jsonFormat=False ) )
+
         n = len( main.nodes )  # Number of nodes
         p = ( ( n + 1 ) / 2 ) + 1  # Number of partitions
         main.partition = [ 0 ]  # ONOS node to partition, listed by index in main.nodes
@@ -1870,6 +1872,27 @@
             main.cleanup()
             main.exit()
 
+        main.step( "Checking ONOS nodes" )
+        nodeResults = utilities.retry( main.HA.nodesCheck,
+                                       False,
+                                       args=[main.activeNodes],
+                                       sleep=15,
+                                       attempts=5 )
+
+        utilities.assert_equals( expect=True, actual=nodeResults,
+                                 onpass="Nodes check successful",
+                                 onfail="Nodes check NOT successful" )
+
+        if not nodeResults:
+            for i in main.activeNodes:
+                cli = main.CLIs[i]
+                main.log.debug( "{} components not ACTIVE: \n{}".format(
+                    cli.name,
+                    cli.sendline( "scr:list | grep -v ACTIVE" ) ) )
+            main.log.error( "Failed to start ONOS, stopping test" )
+            main.cleanup()
+            main.exit()
+
     def CASE7( self, main ):
         """
         Check state after ONOS failure
@@ -2611,6 +2634,10 @@
                     main.CLIs[i].name,
                     main.CLIs[i].sendline( "scr:list | grep -v ACTIVE" ) ) )
 
+        if not topoResult:
+            main.cleanup()
+            main.exit()
+
     def CASE9( self, main ):
         """
         Link s3-s28 down
diff --git a/TestON/tests/HA/HAkillNodes/HAkillNodes.params b/TestON/tests/HA/HAkillNodes/HAkillNodes.params
index dd035f5..a83e878 100644
--- a/TestON/tests/HA/HAkillNodes/HAkillNodes.params
+++ b/TestON/tests/HA/HAkillNodes/HAkillNodes.params
@@ -24,8 +24,11 @@
     <apps></apps>
     <ONOS_Configuration>
         <org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
-            <useFlowObjectives>true</useFlowObjectives>
+            <useFlowObjectives>false</useFlowObjectives>
         </org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
+        <org.onosproject.store.flow.impl.DistributedFlowRuleStore>
+            <backupCount>3</backupCount>
+        </org.onosproject.store.flow.impl.DistributedFlowRuleStore>
     </ONOS_Configuration>
     <ENV>
         <cellName>HA</cellName>
diff --git a/TestON/tests/HA/HAkillNodes/HAkillNodes.py b/TestON/tests/HA/HAkillNodes/HAkillNodes.py
index c6aa669..c8df1f9 100644
--- a/TestON/tests/HA/HAkillNodes/HAkillNodes.py
+++ b/TestON/tests/HA/HAkillNodes/HAkillNodes.py
@@ -1829,6 +1829,27 @@
                                  onpass="ONOS nodes killed successfully",
                                  onfail="ONOS nodes NOT successfully killed" )
 
+        main.step( "Checking ONOS nodes" )
+        nodeResults = utilities.retry( main.HA.nodesCheck,
+                                       False,
+                                       args=[main.activeNodes],
+                                       sleep=15,
+                                       attempts=5 )
+
+        utilities.assert_equals( expect=True, actual=nodeResults,
+                                 onpass="Nodes check successful",
+                                 onfail="Nodes check NOT successful" )
+
+        if not nodeResults:
+            for i in main.activeNodes:
+                cli = main.CLIs[i]
+                main.log.debug( "{} components not ACTIVE: \n{}".format(
+                    cli.name,
+                    cli.sendline( "scr:list | grep -v ACTIVE" ) ) )
+            main.log.error( "Failed to start ONOS, stopping test" )
+            main.cleanup()
+            main.exit()
+
     def CASE62( self, main ):
         """
         The bring up stopped nodes
@@ -1888,7 +1909,27 @@
         main.restartTime = time.time() - restartTime
         main.log.debug( "Restart time: " + str( main.restartTime ) )
         # TODO: MAke this configurable. Also, we are breaking the above timer
-        time.sleep( 60 )
+        main.step( "Checking ONOS nodes" )
+        nodeResults = utilities.retry( main.HA.nodesCheck,
+                                       False,
+                                       args=[main.activeNodes],
+                                       sleep=15,
+                                       attempts=5 )
+
+        utilities.assert_equals( expect=True, actual=nodeResults,
+                                 onpass="Nodes check successful",
+                                 onfail="Nodes check NOT successful" )
+
+        if not nodeResults:
+            for i in main.activeNodes:
+                cli = main.CLIs[i]
+                main.log.debug( "{} components not ACTIVE: \n{}".format(
+                    cli.name,
+                    cli.sendline( "scr:list | grep -v ACTIVE" ) ) )
+            main.log.error( "Failed to start ONOS, stopping test" )
+            main.cleanup()
+            main.exit()
+
         node = main.activeNodes[0]
         main.log.debug( main.CLIs[node].nodes( jsonFormat=False ) )
         main.log.debug( main.CLIs[node].leaders( jsonFormat=False ) )
@@ -2646,6 +2687,10 @@
                     main.CLIs[i].name,
                     main.CLIs[i].sendline( "scr:list | grep -v ACTIVE" ) ) )
 
+        if not topoResult:
+            main.cleanup()
+            main.exit()
+
     def CASE9( self, main ):
         """
         Link s3-s28 down
diff --git a/TestON/tests/HA/HAsanity/HAsanity.params b/TestON/tests/HA/HAsanity/HAsanity.params
index 8c8b0f5..1821ff1 100644
--- a/TestON/tests/HA/HAsanity/HAsanity.params
+++ b/TestON/tests/HA/HAsanity/HAsanity.params
@@ -23,8 +23,11 @@
     <apps></apps>
     <ONOS_Configuration>
         <org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
-            <useFlowObjectives>true</useFlowObjectives>
+            <useFlowObjectives>false</useFlowObjectives>
         </org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
+        <org.onosproject.store.flow.impl.DistributedFlowRuleStore>
+            <backupCount>3</backupCount>
+        </org.onosproject.store.flow.impl.DistributedFlowRuleStore>
     </ONOS_Configuration>
     <ENV>
         <cellName>HA</cellName>
diff --git a/TestON/tests/HA/HAsanity/HAsanity.py b/TestON/tests/HA/HAsanity/HAsanity.py
index b18cce8..c8ae7d9 100644
--- a/TestON/tests/HA/HAsanity/HAsanity.py
+++ b/TestON/tests/HA/HAsanity/HAsanity.py
@@ -586,6 +586,9 @@
                    "one or more ping pairs failed" )
         main.log.info( "Time for pingall: %2f seconds" %
                        ( time2 - time1 ) )
+        if not pingResult:
+            main.cleanup()
+            main.exit()
         # timeout for fwd flows
         time.sleep( 11 )
         # uninstall onos-app-fwd
@@ -2547,6 +2550,10 @@
                     main.CLIs[i].name,
                     main.CLIs[i].sendline( "scr:list | grep -v ACTIVE" ) ) )
 
+        if not topoResult:
+            main.cleanup()
+            main.exit()
+
     def CASE9( self, main ):
         """
         Link s3-s28 down
diff --git a/TestON/tests/HA/HAscaling/HAscaling.params b/TestON/tests/HA/HAscaling/HAscaling.params
index 388f432..74adfaa 100644
--- a/TestON/tests/HA/HAscaling/HAscaling.params
+++ b/TestON/tests/HA/HAscaling/HAscaling.params
@@ -27,8 +27,11 @@
     <apps></apps>
     <ONOS_Configuration>
         <org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
-            <useFlowObjectives>true</useFlowObjectives>
+            <useFlowObjectives>false</useFlowObjectives>
         </org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
+        <org.onosproject.store.flow.impl.DistributedFlowRuleStore>
+            <backupCount>3</backupCount>
+        </org.onosproject.store.flow.impl.DistributedFlowRuleStore>
     </ONOS_Configuration>
     <ENV>
         <cellName>HA</cellName>
diff --git a/TestON/tests/HA/HAscaling/HAscaling.py b/TestON/tests/HA/HAscaling/HAscaling.py
index 04000ba..b0bc126 100644
--- a/TestON/tests/HA/HAscaling/HAscaling.py
+++ b/TestON/tests/HA/HAscaling/HAscaling.py
@@ -2686,6 +2686,10 @@
                     main.CLIs[i].name,
                     main.CLIs[i].sendline( "scr:list | grep -v ACTIVE" ) ) )
 
+        if not topoResult:
+            main.cleanup()
+            main.exit()
+
     def CASE9( self, main ):
         """
         Link s3-s28 down
diff --git a/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.params b/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.params
index 4e47832..d7ac493 100644
--- a/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.params
+++ b/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.params
@@ -19,8 +19,11 @@
     <apps></apps>
     <ONOS_Configuration>
         <org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
-            <useFlowObjectives>true</useFlowObjectives>
+            <useFlowObjectives>false</useFlowObjectives>
         </org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
+        <org.onosproject.store.flow.impl.DistributedFlowRuleStore>
+            <backupCount>3</backupCount>
+        </org.onosproject.store.flow.impl.DistributedFlowRuleStore>
     </ONOS_Configuration>
     <ENV>
         <cellName>HA</cellName>
diff --git a/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py b/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py
index c13b910..bd581ae 100644
--- a/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py
+++ b/TestON/tests/HA/HAsingleInstanceRestart/HAsingleInstanceRestart.py
@@ -1854,6 +1854,10 @@
                     main.CLIs[i].name,
                     main.CLIs[i].sendline( "scr:list | grep -v ACTIVE" ) ) )
 
+        if not topoResult:
+            main.cleanup()
+            main.exit()
+
     def CASE9( self, main ):
         """
         Link s3-s28 down
diff --git a/TestON/tests/HA/HAstopNodes/HAstopNodes.params b/TestON/tests/HA/HAstopNodes/HAstopNodes.params
index dd035f5..a83e878 100644
--- a/TestON/tests/HA/HAstopNodes/HAstopNodes.params
+++ b/TestON/tests/HA/HAstopNodes/HAstopNodes.params
@@ -24,8 +24,11 @@
     <apps></apps>
     <ONOS_Configuration>
         <org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
-            <useFlowObjectives>true</useFlowObjectives>
+            <useFlowObjectives>false</useFlowObjectives>
         </org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
+        <org.onosproject.store.flow.impl.DistributedFlowRuleStore>
+            <backupCount>3</backupCount>
+        </org.onosproject.store.flow.impl.DistributedFlowRuleStore>
     </ONOS_Configuration>
     <ENV>
         <cellName>HA</cellName>
diff --git a/TestON/tests/HA/HAstopNodes/HAstopNodes.py b/TestON/tests/HA/HAstopNodes/HAstopNodes.py
index 7617a7a..9b0f7a7 100644
--- a/TestON/tests/HA/HAstopNodes/HAstopNodes.py
+++ b/TestON/tests/HA/HAstopNodes/HAstopNodes.py
@@ -1808,6 +1808,27 @@
                                  onpass="ONOS nodes stopped successfully",
                                  onfail="ONOS nodes NOT successfully stopped" )
 
+        main.step( "Checking ONOS nodes" )
+        nodeResults = utilities.retry( main.HA.nodesCheck,
+                                       False,
+                                       args=[main.activeNodes],
+                                       sleep=15,
+                                       attempts=5 )
+
+        utilities.assert_equals( expect=True, actual=nodeResults,
+                                 onpass="Nodes check successful",
+                                 onfail="Nodes check NOT successful" )
+
+        if not nodeResults:
+            for i in main.activeNodes:
+                cli = main.CLIs[i]
+                main.log.debug( "{} components not ACTIVE: \n{}".format(
+                    cli.name,
+                    cli.sendline( "scr:list | grep -v ACTIVE" ) ) )
+            main.log.error( "Failed to start ONOS, stopping test" )
+            main.cleanup()
+            main.exit()
+
     def CASE62( self, main ):
         """
         The bring up stopped nodes
@@ -1866,8 +1887,27 @@
         # protocol has had time to work
         main.restartTime = time.time() - restartTime
         main.log.debug( "Restart time: " + str( main.restartTime ) )
-        # TODO: MAke this configurable. Also, we are breaking the above timer
-        time.sleep( 60 )
+
+        main.step( "Checking ONOS nodes" )
+        nodeResults = utilities.retry( main.HA.nodesCheck,
+                                       False,
+                                       args=[main.activeNodes],
+                                       sleep=15,
+                                       attempts=5 )
+
+        utilities.assert_equals( expect=True, actual=nodeResults,
+                                 onpass="Nodes check successful",
+                                 onfail="Nodes check NOT successful" )
+
+        if not nodeResults:
+            for i in main.activeNodes:
+                cli = main.CLIs[i]
+                main.log.debug( "{} components not ACTIVE: \n{}".format(
+                    cli.name,
+                    cli.sendline( "scr:list | grep -v ACTIVE" ) ) )
+            main.log.error( "Failed to start ONOS, stopping test" )
+            main.cleanup()
+            main.exit()
         node = main.activeNodes[0]
         main.log.debug( main.CLIs[node].nodes( jsonFormat=False ) )
         main.log.debug( main.CLIs[node].leaders( jsonFormat=False ) )
@@ -2623,6 +2663,10 @@
                     main.CLIs[i].name,
                     main.CLIs[i].sendline( "scr:list | grep -v ACTIVE" ) ) )
 
+        if not topoResult:
+            main.cleanup()
+            main.exit()
+
     def CASE9( self, main ):
         """
         Link s3-s28 down
diff --git a/TestON/tests/HA/HAswapNodes/HAswapNodes.params b/TestON/tests/HA/HAswapNodes/HAswapNodes.params
index d3729a4..6cee74a 100644
--- a/TestON/tests/HA/HAswapNodes/HAswapNodes.params
+++ b/TestON/tests/HA/HAswapNodes/HAswapNodes.params
@@ -17,7 +17,7 @@
     #CASE15: Check that Leadership Election is still functional
     #CASE16: Install Distributed Primitives app
     #CASE17: Check for basic functionality with distributed primitives
-    <testcases>1,[2,8,21,3,8,4,5,14,16,17]*1,6,8,3,7,4,15,17,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
+    <testcases>1,[2,8,21,3,8,4,5,14,16,17]*1,6,[8,3,7,4,15,17,9,8,4,10,8,4,11,8,4,12,8,4]*1,13</testcases>
 
     <server>
         <port>8000</port>
@@ -26,8 +26,11 @@
     <apps></apps>
     <ONOS_Configuration>
         <org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
-            <useFlowObjectives>true</useFlowObjectives>
+            <useFlowObjectives>false</useFlowObjectives>
         </org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator>
+        <org.onosproject.store.flow.impl.DistributedFlowRuleStore>
+            <backupCount>3</backupCount>
+        </org.onosproject.store.flow.impl.DistributedFlowRuleStore>
     </ONOS_Configuration>
     <ENV>
         <cellName>HA</cellName>
diff --git a/TestON/tests/HA/HAswapNodes/HAswapNodes.py b/TestON/tests/HA/HAswapNodes/HAswapNodes.py
index 1ced5a2..0065ecf 100644
--- a/TestON/tests/HA/HAswapNodes/HAswapNodes.py
+++ b/TestON/tests/HA/HAswapNodes/HAswapNodes.py
@@ -2682,6 +2682,10 @@
                     main.CLIs[i].name,
                     main.CLIs[i].sendline( "scr:list | grep -v ACTIVE" ) ) )
 
+        if not topoResult:
+            main.cleanup()
+            main.exit()
+
     def CASE9( self, main ):
         """
         Link s3-s28 down
diff --git a/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py b/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py
index 4aff74d..d47b317 100755
--- a/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py
+++ b/TestON/tests/MISC/SCPFbatchFlowResp/SCPFbatchFlowResp.py
@@ -372,7 +372,7 @@
         #pprint(main.addedBatchList)
         resp = main.FALSE
         while resp != main.TRUE and ( tAllAdded - tLastPostEnd < int (main.params['CASE2100']['chkFlowTO']) ):
-            if main.params['CASE2100']['RESTchkFlow'] == main.TRUE:
+            if main.params['CASE2100']['RESTchkFlow'] == 'main.TRUE':
                 resp = main.ONOSrest.checkFlowsState()
             else:
                 handle = main.CLIs[0].flows(state = " |grep PEND|wc -l", jsonFormat=False)
@@ -443,7 +443,7 @@
         #pprint(main.addedBatchList)
         resp = main.FALSE
         while resp != main.TRUE and ( tAllRemoved - tLastDeleteEnd < int (main.params['CASE3100']['chkFlowTO']) ):
-            if main.params['CASE3100']['RESTchkFlow'] == main.TRUE:
+            if main.params['CASE3100']['RESTchkFlow'] == 'main.TRUE':
                 resp = main.ONOSrest.checkFlowsState()
             else:
                 handle = main.CLIs[0].flows(state = " |grep PEND|wc -l", jsonFormat=False)
diff --git a/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.params b/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.params
index 7dbda89..7c69450 100644
--- a/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.params
+++ b/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.params
@@ -15,6 +15,7 @@
         <warmUp>5</warmUp>
         <sampleSize>20</sampleSize>
         <intents>1,100,1000</intents>                       #list format, will be split on ','
+        <FObjintents>1,100</FObjintents>
         <ingress>null:0000000000000001/0</ingress>
         <egress>null:0000000000000007/0</egress>
         <debug>False</debug>
diff --git a/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py b/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py
index b282ebf..93c467c 100644
--- a/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py
+++ b/TestON/tests/SCPF/SCPFintentRerouteLat/SCPFintentRerouteLat.py
@@ -77,7 +77,6 @@
         main.verifyAttempts = int(main.params['ATTEMPTS']['verify'])
         main.sampleSize = int(main.params['TEST']['sampleSize'])
         main.warmUp = int(main.params['TEST']['warmUp'])
-        main.intentsList = (main.params['TEST']['intents']).split(",")
         main.ingress = main.params['TEST']['ingress']
         main.egress = main.params['TEST']['egress']
         main.debug = main.params['TEST']['debug']
@@ -86,9 +85,11 @@
         if main.flowObj == "True":
             main.flowObj = True
             main.dbFileName = main.params['DATABASE']['dbFlowObj']
+            main.intentsList = (main.params['TEST']['FObjintents']).split(",")
         else:
             main.flowObj = False
             main.dbFileName = main.params['DATABASE']['dbName']
+            main.intentsList = (main.params['TEST']['intents']).split(",")
 
         for i in range(0, len(main.intentsList)):
             main.intentsList[i] = int(main.intentsList[i])
diff --git a/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.params b/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.params
index 8510204..4485f0f 100644
--- a/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.params
+++ b/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.params
@@ -64,10 +64,10 @@
     <NULL>
         # CASE20
         <PUSH>
-            <batch_size>1000</batch_size>
-            <min_intents>10000</min_intents>
-            <max_intents>70000</max_intents>
-            <check_interval>10000</check_interval>
+            <batch_size>500</batch_size>
+            <min_intents>2500</min_intents>
+            <max_intents>1000000</max_intents>
+            <check_interval>2500</check_interval>
         </PUSH>
 
         # if reroute is true
@@ -83,10 +83,10 @@
     <OVS>
         # CASE20
         <PUSH>
-            <batch_size>1000</batch_size>
-            <min_intents>10000</min_intents>
-            <max_intents>500000</max_intents>
-            <check_interval>10000</check_interval>
+            <batch_size>500</batch_size>
+            <min_intents>2500</min_intents>
+            <max_intents>1000000</max_intents>
+            <check_interval>2500</check_interval>
         </PUSH>
 
         # if reroute is true
diff --git a/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py b/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
index c688207..00f28b1 100644
--- a/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
+++ b/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
@@ -7,9 +7,9 @@
 Push test Intents to onos
 CASE10: set up Null Provider
 CASE11: set up Open Flows
+Check flows number, if flows number is not as except, finished this test iteration
 Scale up when reach the Limited
 Start from 1 nodes, 8 devices. Then Scale up to 3,5,7 nodes
-Recommand batch size: 100, check interval: 100
 '''
 class SCPFscalingMaxIntents:
     def __init__( self ):
@@ -429,6 +429,7 @@
         # make sure the checkInterval divisible batchSize
         main.checkInterval = int( int( main.checkInterval / main.batchSize ) * main.batchSize )
         flowTemp=0
+        intentVerifyTemp = 0
         totalFlows=0
         for i in range(limit):
 
@@ -467,32 +468,53 @@
                 main.log.info("Verify Intents states")
                 # k is a control variable for verify retry attempts
                 k = 1
-
                 while k <= main.verifyAttempts:
-                    # while loop for check intents by using REST api
+                    # while loop for check intents by using CLI driver
                     time.sleep(5)
-                    temp = 0
-                    intentsState = main.CLIs[0].checkIntentSummary(timeout=600)
+                    intentsState = main.CLIs[0].checkIntentSummary(timeout=600, noExit=True)
                     if intentsState:
-                        verifyTotalIntents = main.CLIs[0].getTotalIntentsNum(timeout=600)
-                        if temp < verifyTotalIntents:
-                            temp = verifyTotalIntents 
+                        verifyTotalIntents = main.CLIs[0].getTotalIntentsNum(timeout=600, noExit=True)
+                        if intentVerifyTemp < verifyTotalIntents:
+                            intentVerifyTemp = verifyTotalIntents
                         else:
-                            verifytotalIntents = temp
-                        main.log.info("Total Intents: {}".format( verifyTotalIntents ) )
+                            verifyTotalIntents = intentVerifyTemp
+                            intentsState = False
+                        main.log.info("Total Installed Intents: {}".format( verifyTotalIntents ) )
                         break
                     k = k+1
 
-                totalFlows = main.CLIs[0].getTotalFlowsNum( timeout=600, noExit=True )
-                if flowTemp < totalFlows:
-                    flowTemp = totalFlows
-                else:
-                    totalFlows = flowTemp 
+                k = 1
+                flowVerify = True
+                while k <= main.verifyAttempts:
+                    time.sleep(5)
+                    totalFlows = main.CLIs[0].getTotalFlowsNum( timeout=600, noExit=True )
+                    expectFlows = totalIntents * 7 + main.defaultFlows
+                    if totalFlows == expectFlows:
+                        main.log.info("Total Flows Added: {}".format(totalFlows))
+                        break
+                    else:
+                        main.log.info("Some Flows are not added, retry...")
+                        main.log.info("Total Flows Added: {} Expect Flows: {}".format(totalFlows, expectFlows))
+                        flowVerify = False
 
-                if not intentsState:
+                    k += 1
+                    if flowTemp < totalFlows:
+                        flowTemp = totalFlows
+                    else:
+                        totalFlows = flowTemp
+
+                if not intentsState or not flowVerify:
                     # If some intents are not installed, grep the previous flows list, and finished this test case
-                    main.log.warn( "Some intens did not install" )
-                    verifyTotalIntents = main.CLIs[0].getTotalIntentsNum(timeout=600)
+                    main.log.warn( "Intents or flows are not installed" )
+                    verifyTotalIntents = main.CLIs[0].getTotalIntentsNum(timeout=600, noExit=True)
+                    if intentVerifyTemp < verifyTotalIntents:
+                        intentVerifyTemp = verifyTotalIntents
+                    else:
+                        verifyTotalIntents = intentVerifyTemp
+                    if flowTemp < totalFlows:
+                        flowTemp = totalFlows
+                    else:
+                        totalFlows = flowTemp
                     main.log.info("Total Intents: {}".format( verifyTotalIntents) )
                     break
 
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamic/README.md b/TestON/tests/USECASE/SegmentRouting/SRDynamic/README.md
new file mode 100755
index 0000000..e84af0b
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamic/README.md
@@ -0,0 +1,22 @@
+This test verifies connectivity in face of dynamic configuration and Onos failures using SegmentRouting
+
+It consists of
+
+1) Configure and Install ONOS
+2) Start Mininet and check flow state
+3) Connectivity test
+4) Add Hosts dynamically
+5) Connectivity test
+6) Onos Failure
+7) Remove host configuration
+
+Requirements
+
+ - An updated version of the CPQD switch has to be running to make sure it supports group chaining.
+
+The test is executed using the netcfg subsystem:
+    1) APPS=openflow-base,netcfghostprovider,netcfglinksprovider
+The test runs for different topologies:
+ - 2x2 Leaf-Spine and 3-node ONOS cluster
+ - 4x4 Leaf-Spine and 3-node ONOS cluster
+ - Single switch and 3-node ONOS cluster
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamic/SRDynamic.params b/TestON/tests/USECASE/SegmentRouting/SRDynamic/SRDynamic.params
new file mode 100755
index 0000000..a757a48
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamic/SRDynamic.params
@@ -0,0 +1,46 @@
+<PARAMS>
+
+    <testcases>1,2,3,4,5,6</testcases>
+
+    <SCALE>
+        <size>3</size>
+        <max>3</max>
+    </SCALE>
+
+    <DEPENDENCY>
+        <wrapper1>startUp</wrapper1>
+        <topology>cord_fabric.py</topology>
+    </DEPENDENCY>
+
+    <ENV>
+        <cellName>productionCell</cellName>
+        <cellApps>drivers,segmentrouting</cellApps>
+        <diffApps>openflow-base,netcfghostprovider,netcfglinksprovider</diffApps>
+        <cellUser>sdn</cellUser>
+    </ENV>
+
+    <GIT>
+        <pull>False</pull>
+        <branch>master</branch>
+    </GIT>
+
+    <CTRL>
+        <port>6653</port>
+    </CTRL>
+
+    <timers>
+        <LinkDiscovery>12</LinkDiscovery>
+        <SwitchDiscovery>12</SwitchDiscovery>
+    </timers>
+
+    <kill>
+        <switch> spine101 </switch>
+        <dpid> 000000000101 </dpid>
+        <links> leaf1 leaf2 </links>
+    </kill>
+
+    <SLEEP>
+        <startup>10</startup>
+    </SLEEP>
+
+</PARAMS>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamic/SRDynamic.py b/TestON/tests/USECASE/SegmentRouting/SRDynamic/SRDynamic.py
new file mode 100755
index 0000000..9d84bb4
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamic/SRDynamic.py
@@ -0,0 +1,173 @@
+# CASE1: 2x2 Leaf-Spine topo and test IP connectivity
+# CASE2: 4x4 topo + IP connectivity test
+# CASE3: Single switch topo + IP connectivity test
+# CASE4: 2x2 topo + 3-node ONOS CLUSTER + IP connectivity test
+# CASE5: 4x4 topo + 3-node ONOS CLUSTER + IP connectivity test
+# CASE6: Single switch + 3-node ONOS CLUSTER + IP connectivity test
+
+class SRDynamic:
+    def __init__( self ):
+        self.default = ''
+
+    def CASE1( self, main ):
+        """
+        Sets up 1-node Onos-cluster
+        Start 2x2 Leaf-Spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+            Testcaselib as run
+        if not hasattr( main, 'apps' ):
+            run.initTest( main )
+
+        description = "Bridging and Routing sanity test with 2x2 Leaf-spine "
+        main.case( description )
+
+        main.cfgName = '2x2'
+        main.numCtrls = 1
+        run.installOnos( main, vlanCfg=False )
+        run.startMininet( main, 'cord_fabric.py' )
+        # pre-configured routing and bridging test
+        run.checkFlows( main, minFlowCount=116 )
+        run.pingAll( main, dumpflows=False, )
+        run.addHostCfg( main )
+        run.checkFlows( main, minFlowCount=140, dumpflows=False )
+        run.pingAll( main, "CASE1" )
+        run.cleanup( main )
+
+    def CASE2( self, main ):
+        """
+        Sets up 1-node Onos-cluster
+        Start 4x4 Leaf-Spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+            Testcaselib as run
+        if not hasattr( main, 'apps' ):
+            run.initTest( main )
+        description = "Bridging and Routing sanity test with 4x4 Leaf-spine "
+        main.case( description )
+        main.cfgName = '4x4'
+        main.numCtrls = 1
+        run.installOnos( main, vlanCfg=False )
+        run.startMininet( main, 'cord_fabric.py',
+                          args="--leaf=4 --spine=4" )
+        # pre-configured routing and bridging test
+        run.checkFlows( main, minFlowCount=350 )
+        run.pingAll( main, dumpflows=False )
+        run.addHostCfg( main )
+        run.checkFlows( main, minFlowCount=380, dumpflows=False )
+        run.pingAll( main, 'CASE2' )
+        run.cleanup( main )
+
+    def CASE3( self, main ):
+        """
+        Sets up 1-node Onos-cluster
+        Start single switch topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+            Testcaselib as run
+        if not hasattr( main, 'apps' ):
+            run.initTest( main )
+        description = "Bridging and Routing sanity test with single switch "
+        main.case( description )
+        main.cfgName = '0x1'
+        main.numCtrls = 1
+        run.installOnos( main, vlanCfg=False )
+        run.startMininet( main, 'cord_fabric.py',
+                          args="--leaf=1 --spine=0" )
+        # pre-configured routing and bridging test
+        run.checkFlows( main, minFlowCount=15 )
+        run.pingAll( main, dumpflows=False )
+        run.addHostCfg( main )
+        run.checkFlows( main, minFlowCount=18, dumpflows=False )
+        run.pingAll( main, 'CASE3' )
+        run.cleanup( main )
+
+    def CASE4( self, main ):
+        """
+        Sets up 3-node Onos-cluster
+        Start 2x2 Leaf-Spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+            Testcaselib as run
+        if not hasattr( main, 'apps' ):
+            run.initTest( main )
+        description = "Bridging and Routing sanity test with 2x2 Leaf-spine "
+        main.case( description )
+
+        main.cfgName = '2x2'
+        main.numCtrls = 3
+        run.installOnos( main, vlanCfg=False )
+        run.startMininet( main, 'cord_fabric.py' )
+        # pre-configured routing and bridging test
+        run.checkFlows( main, minFlowCount=116 )
+        run.pingAll( main, dumpflows=False )
+        run.addHostCfg( main )
+        run.checkFlows( main, minFlowCount=140, dumpflows=False )
+        run.pingAll( main, "CASE4" )
+        run.killOnos( main, [ 0 ], '4', '8', '2' )
+        run.delHostCfg( main )
+        run.checkFlows( main, minFlowCount=116, dumpflows=False )
+        run.pingAll( main, "CASE4_after" )
+        run.cleanup( main )
+
+    def CASE5( self, main ):
+        """
+        Sets up 3-node Onos-cluster
+        Start 4x4 Leaf-Spine topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+            Testcaselib as run
+        if not hasattr( main, 'apps' ):
+            run.initTest( main )
+        description = "Bridging and Routing sanity test with 4x4 Leaf-spine "
+        main.case( description )
+        main.cfgName = '4x4'
+        main.numCtrls = 3
+        run.installOnos( main, vlanCfg=False )
+        run.startMininet( main, 'cord_fabric.py',
+                          args="--leaf=4 --spine=4" )
+        # pre-configured routing and bridging test
+        run.checkFlows( main, minFlowCount=350 )
+        run.pingAll( main, dumpflows=False )
+        run.addHostCfg( main )
+        run.checkFlows( main, minFlowCount=380, dumpflows=False )
+        run.pingAll( main, 'CASE5' )
+        run.killOnos( main, [ 0 ], '8', '32', '2' )
+        run.delHostCfg( main )
+        run.checkFlows( main, minFlowCount=350, dumpflows=False )
+        run.pingAll( main, "CASE5_After" )
+        run.cleanup( main )
+
+    def CASE6( self, main ):
+        """
+        Sets up 3-node Onos-cluster
+        Start single switch topology
+        Pingall
+        """
+        from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
+            Testcaselib as run
+        if not hasattr( main, 'apps' ):
+            run.initTest( main )
+        description = "Bridging and Routing sanity test with single switch "
+        main.case( description )
+        main.cfgName = '0x1'
+        main.numCtrls = 3
+        run.installOnos( main, vlanCfg=False )
+        run.startMininet( main, 'cord_fabric.py',
+                          args="--leaf=1 --spine=0" )
+        # pre-configured routing and bridging test
+        run.checkFlows( main, minFlowCount=15 )
+        run.pingAll( main, dumpflows=False )
+        run.addHostCfg( main )
+        run.checkFlows( main, minFlowCount=20, dumpflows=False )
+        run.pingAll( main, 'CASE6' )
+        run.killOnos( main, [ 0 ], '1', '0', '2' )
+        run.delHostCfg( main )
+        run.checkFlows( main, minFlowCount=15, dumpflows=False )
+        run.pingAll( main, "CASE6_After" )
+        run.cleanup( main )
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamic/SRDynamic.topo b/TestON/tests/USECASE/SegmentRouting/SRDynamic/SRDynamic.topo
new file mode 100755
index 0000000..c531f7d
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamic/SRDynamic.topo
@@ -0,0 +1,90 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>localhost</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS>
+                <nodes>1</nodes>
+            </COMPONENTS>
+        </ONOSbench>
+
+        <ONOScli1>
+            <host>OC1</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS>
+            </COMPONENTS>
+        </ONOScli1>
+        
+        <ONOScli2>
+            <host>OC2</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosCliDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS>
+            </COMPONENTS>
+        </ONOScli2>
+
+        <ONOScli3>
+            <host>OC3</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS>
+            </COMPONENTS>
+        </ONOScli3>
+
+        <ONOSrest1>
+            <host>OC1</host>
+            <port>8181</port>
+            <user>onos</user>
+            <password>rocks</password>
+            <type>OnosRestDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS>
+            </COMPONENTS>
+        </ONOSrest1>
+
+        <ONOSrest2>
+            <host>OC2</host>
+            <port>8181</port>
+            <user>onos</user>
+            <password>rocks</password>
+            <type>OnosRestDriver</type>
+            <connect_order>6</connect_order>
+            <COMPONENTS>
+            </COMPONENTS>
+        </ONOSrest2>
+
+        <ONOSrest3>
+            <host>OC3</host>
+            <port>8181</port>
+            <user>onos</user>
+            <password>rocks</password>
+            <type>OnosRestDriver</type>
+            <connect_order>6</connect_order>
+            <COMPONENTS>
+            </COMPONENTS>
+        </ONOSrest3>
+
+        <Mininet1>
+            <host>OCN</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>MininetCliDriver</type>
+            <connect_order>7</connect_order>
+            <COMPONENTS>
+                <home>~/mininet/custom/</home>
+            </COMPONENTS>
+        </Mininet1>
+
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/USECASE/SegmentRouting/SRDynamic/__init__.py b/TestON/tests/USECASE/SegmentRouting/SRDynamic/__init__.py
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/SRDynamic/__init__.py
diff --git a/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/SRSwitchFailure.py b/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/SRSwitchFailure.py
index b516cc0..19ee08c 100755
--- a/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/SRSwitchFailure.py
+++ b/TestON/tests/USECASE/SegmentRouting/SRSwitchFailure/SRSwitchFailure.py
@@ -55,6 +55,7 @@
         """
         from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
             Testcaselib as run
+        import time
         if not hasattr( main, 'apps' ):
             run.initTest( main )
         description = "Bridging and Routing sanity test with 4x4 Leaf-spine "
@@ -69,6 +70,7 @@
         # switch failure
         switch = main.params[ 'kill' ][ 'switch' ]
         run.killSwitch( main, switch, switches='7', links='24' )
+        time.sleep( main.switchSleep )
         run.pingAll( main, "CASE2_Failure" )
         run.recoverSwitch( main, switch, switches='8', links='32' )
         run.checkFlows( main, minFlowCount=350 )
@@ -125,6 +127,7 @@
         """
         from tests.USECASE.SegmentRouting.dependencies.Testcaselib import \
             Testcaselib as run
+        import time
         if not hasattr( main, 'apps' ):
             run.initTest( main )
         description = "Bridging and Routing sanity test with 4x4 Leaf-spine "
@@ -139,6 +142,7 @@
         # switch failure
         switch = main.params[ 'kill' ][ 'switch' ]
         run.killSwitch( main, switch, switches='7', links='24' )
+        time.sleep( main.switchSleep )
         run.pingAll( main, "CASE4_Failure" )
         run.recoverSwitch( main, switch, switches='8', links='32' )
         run.checkFlows( main, minFlowCount=350 )
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
index c1efd93..38e013e 100755
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
@@ -2,7 +2,7 @@
 import imp

 import time

 import json

-

+import urllib

 from core import utilities

 

 

@@ -66,7 +66,7 @@
                                  onfail="Failed to construct test variables" )

 

     @staticmethod

-    def installOnos( main ):

+    def installOnos( main, vlanCfg=True ):

         """

         - Set up cell

             - Create cell file

@@ -87,6 +87,7 @@
         print "NODE COUNT = ", main.numCtrls

         print main.ONOSip

         tempOnosIp = [ ]

+        main.dynamicHosts = [ 'in1', 'out1' ]

         for i in range( main.numCtrls ):

             tempOnosIp.append( main.ONOSip[ i ] )

         onosUser = main.params[ 'ENV' ][ 'cellUser' ]

@@ -167,9 +168,12 @@
                                  onpass="ONOS summary command succeded",

                                  onfail="ONOS summary command failed" )

 

-        with open( main.dependencyPath + "/" + main.cfgName + ".json" ) as cfg:

+        with open( "%s/json/%s.json" % (

+                main.dependencyPath, main.cfgName) ) as cfg:

             main.RESTs[ main.active ].setNetCfg( json.load( cfg ) )

-

+        with open( "%s/json/%s.chart" % (

+                main.dependencyPath, main.cfgName) ) as chart:

+            main.pingChart = json.load( chart )

         if not ready:

             main.log.error( "ONOS startup failed!" )

             main.cleanup( )

@@ -200,7 +204,7 @@
             main.exit( )

 

     @staticmethod

-    def checkFlows( main, minFlowCount ):

+    def checkFlows( main, minFlowCount, dumpflows=True ):

         main.step(

                 " Check whether the flow count is bigger than %s" % minFlowCount )

         count = utilities.retry( main.CLIs[ main.active ].checkFlowCount,

@@ -218,36 +222,34 @@
         flowCheck = utilities.retry( main.CLIs[ main.active ].checkFlowsState,

                                      main.FALSE,

                                      kwargs={ 'isPENDING': False },

-                                     attempts=10,

+                                     attempts=2,

                                      sleep=10 )

         utilities.assertEquals( \

                 expect=main.TRUE,

                 actual=flowCheck,

                 onpass="Flow status is correct!",

                 onfail="Flow status is wrong!" )

-        main.ONOSbench.dumpFlows( main.ONOSip[ main.active ],

-                                  main.logdir, "flowsBefore" + main.cfgName )

-        main.ONOSbench.dumpGroups( main.ONOSip[ 0 ],

-                                   main.logdir, "groupsBefore" + main.cfgName )

+        if dumpflows:

+            main.ONOSbench.dumpFlows( main.ONOSip[ main.active ],

+                                      main.logdir,

+                                      "flowsBefore" + main.cfgName )

+            main.ONOSbench.dumpGroups( main.ONOSip[ main.active ],

+                                       main.logdir,

+                                       "groupsBefore" + main.cfgName )

 

     @staticmethod

     def pingAll( main, tag="", dumpflows=True ):

         main.log.report( "Check full connectivity" )

-        main.step("Check IP connectivity %s" %tag)

-        hosts = main.Mininet1.getHosts().keys()

-        vlan10 = [ '%s10' % s for s in [ 'olt', 'vsg' ] ]

-        vlan5 = [ '%s5' % s for s in [ 'olt', 'vsg' ] ]

-        IPHosts = [ host for host in hosts if host not in ( vlan10 + vlan5 ) ]

-        pa = main.Mininet1.pingallHosts(IPHosts)

-        utilities.assert_equals( expect=main.TRUE, actual=pa,

-                                 onpass="IP connectivity successfully tested",

-                                 onfail="IP connectivity failed" )

-        main.step("Check VLAN  connectivity %s" %tag)

-        p1 = main.Mininet1.pingallHosts(vlan5)

-        p2 = main.Mininet1.pingallHosts(vlan10)

-        utilities.assert_equals( expect=main.TRUE, actual=p1&p2,

-                             onpass="Vlan connectivity successfully tested",

-                             onfail="Vlan connectivity failed" )

+        print main.pingChart

+        for entry in main.pingChart.itervalues( ):

+            print entry

+            hosts, expect = entry[ 'hosts' ], entry[ 'expect' ]

+            expect = main.TRUE if expect else main.FALSE

+            main.step( "Connectivity for %s %s" % (str( hosts ), tag) )

+            pa = main.Mininet1.pingallHosts( hosts )

+            utilities.assert_equals( expect=expect, actual=pa,

+                                     onpass="IP connectivity successfully tested",

+                                     onfail="IP connectivity failed" )

         if dumpflows:

             main.ONOSbench.dumpFlows( main.ONOSip[ main.active ],

                                       main.logdir, "flowsOn" + tag )

@@ -439,7 +441,6 @@
         utilities.assert_equals( expect=main.TRUE, actual=topology,

                                  onpass="ONOS Instance down successful",

                                  onfail="Failed to turn off ONOS Instance" )

-

         for i in range( 10 ):

             ready = True

             output = main.CLIs[ main.active ].summary( )

@@ -455,3 +456,72 @@
             main.log.error( "ONOS startup failed!" )

             main.cleanup( )

             main.exit( )

+

+    @staticmethod

+    def addHostCfg( main ):

+        """

+        Adds Host Configuration to ONOS

+        Updates expected state of the network (pingChart)

+        """

+        import json

+        hostCfg = { }

+        with open( main.dependencyPath + "/json/extra.json" ) as template:

+            hostCfg = json.load( template )

+        main.pingChart[ 'ip' ][ 'hosts' ] += [ 'in1' ]

+        main.step( "Pushing new configuration" )

+        mac, cfg = hostCfg[ 'hosts' ].popitem( )

+        main.RESTs[ main.active ].setNetCfg( cfg[ 'basic' ],

+                                             subjectClass="hosts",

+                                             subjectKey=urllib.quote( mac,

+                                                                      safe='' ),

+                                             configKey="basic" )

+        main.pingChart[ 'ip' ][ 'hosts' ] += [ 'out1' ]

+        main.step( "Pushing new configuration" )

+        mac, cfg = hostCfg[ 'hosts' ].popitem( )

+        main.RESTs[ main.active ].setNetCfg( cfg[ 'basic' ],

+                                             subjectClass="hosts",

+                                             subjectKey=urllib.quote( mac,

+                                                                      safe='' ),

+                                             configKey="basic" )

+        main.pingChart.update( { 'vlan1': { "expect": "True",

+                                            "hosts": [ "olt1", "vsg1" ] } } )

+        main.pingChart[ 'vlan5' ][ 'expect' ] = 0

+        main.pingChart[ 'vlan10' ][ 'expect' ] = 0

+        ports = "[%s,%s]" % (5, 6)

+        cfg = '{"of:0000000000000001":[{"vlan":1,"ports":%s,"name":"OLT 1"}]}' % ports

+        main.RESTs[ main.active ].setNetCfg( json.loads( cfg ),

+                                             subjectClass="apps",

+                                             subjectKey="org.onosproject.segmentrouting",

+                                             configKey="xconnect" )

+

+    @staticmethod

+    def delHostCfg( main ):

+        """

+        Removest Host Configuration from ONOS

+        Updates expected state of the network (pingChart)

+        """

+        import json

+        hostCfg = { }

+        with open( main.dependencyPath + "/json/extra.json" ) as template:

+            hostCfg = json.load( template )

+        main.step( "Removing host configuration" )

+        main.pingChart[ 'ip' ][ 'expect' ] = 0

+        mac, cfg = hostCfg[ 'hosts' ].popitem( )

+        main.RESTs[ main.active ].removeNetCfg( subjectClass="hosts",

+                                                subjectKey=urllib.quote(

+                                                        mac,

+                                                        safe='' ),

+                                                configKey="basic" )

+        main.step( "Removing configuration" )

+        main.pingChart[ 'ip' ][ 'expect' ] = 0

+        mac, cfg = hostCfg[ 'hosts' ].popitem( )

+        main.RESTs[ main.active ].removeNetCfg( subjectClass="hosts",

+                                                subjectKey=urllib.quote(

+                                                        mac,

+                                                        safe='' ),

+                                                configKey="basic" )

+        main.step( "Removing vlan configuration" )

+        main.pingChart[ 'vlan1' ][ 'expect' ] = 0

+        main.RESTs[ main.active ].removeNetCfg( subjectClass="apps",

+                                                subjectKey="org.onosproject.segmentrouting",

+                                                configKey="xconnect" )

diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/cord_fabric.py b/TestON/tests/USECASE/SegmentRouting/dependencies/cord_fabric.py
index 4f52689..6348632 100755
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/cord_fabric.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/cord_fabric.py
@@ -1,6 +1,7 @@
 #!/usr/bin/python
 
 import os
+import re
 from optparse import OptionParser
 
 from mininet.net import Mininet
@@ -23,6 +24,8 @@
                        help='number of hosts per leaf switch, default=2' )
     parser.add_option( '--onos', dest='onos', type='int', default=0,
                        help='number of ONOS Instances, default=0, 0 means localhost, 1 will use OC1 and so on' )
+    parser.add_option( '--vlan', dest='vlan', type='int', default=-1,
+                       help='vid of cross connect, default=-1, -1 means utilize default value' )
     (options, args) = parser.parse_args( )
     return options, args
 
@@ -46,10 +49,6 @@
         for ls in range( leaf ):
             leafs[ ls ] = self.addSwitch( 'leaf%s' % (ls + 1),
                                           dpid="00000000000%s" % (1 + ls) )
-            # Connect leaf to all spines
-            for s in range( spine ):
-                switch = spines[ s ]
-                self.addLink( leafs[ ls ], switch, **linkopts )
             # Add hosts under a leaf, fanout hosts per leaf switch
             for f in range( fanout ):
                 host = self.addHost( 'h%s' % (ls * fanout + f + 1),
@@ -58,23 +57,34 @@
                                      gateway='10.0.%s.254' % (ls + 1) )
                 self.addLink( host, leafs[ ls ], **linkopts )
                 # Add Xconnect simulation
-        br1 = self.addSwitch( 'br1', cls=OVSBridge )
-        self.addLink( br1, leafs[ 0 ], **linkopts )
-        for vid in [ 5, 10 ]:
-            olt = self.addHost( 'olt%s' % vid, cls=VLANHost, vlan=vid,
-                                ip="10.%s.0.1/24" % vid
-                                , mac="00:00:%02d:00:00:01" % vid )
-            vsg = self.addHost( 'vsg%s' % vid, cls=VLANHost, vlan=vid,
-                                ip="10.%s.0.2/24" % vid
-                                , mac="00:00:%02d:00:00:02" % vid )
-            self.addLink( olt, leafs[ 0 ], **linkopts )
-            self.addLink( vsg, br1, **linkopts )
-
+            if ls is 0:
+                in1 = self.addHost( 'in1', cls=IpHost, ip='10.0.1.9/24', mac="00:00:00:00:00:09" )
+                self.addLink( in1, leafs[0], **linkopts )
+                out1 = self.addHost( 'out1', cls=IpHost, ip='10.0.9.1/24', mac="00:00:00:00:09:01" )
+                self.addLink( out1, leafs[0], **linkopts )
+                br1 = self.addSwitch( 'br1', cls=OVSBridge )
+                self.addLink( br1, leafs[ 0 ], **linkopts )
+                vlans = [ 1, 5, 10 ]
+                for vid in vlans:
+                    olt = self.addHost( 'olt%s' % vid, cls=VLANHost, vlan=vid,
+                                        ip="10.%s.0.1/24" % vid
+                                        , mac="00:00:%02d:00:00:01" % vid )
+                    vsg = self.addHost( 'vsg%s' % vid, cls=VLANHost, vlan=vid,
+                                        ip="10.%s.0.2/24" % vid
+                                        , mac="00:00:%02d:00:00:02" % vid )
+                    self.addLink( olt, leafs[ 0 ], **linkopts )
+                    self.addLink( vsg, br1, **linkopts )
+            # Connect leaf to all spines
+            for s in range( spine ):
+                switch = spines[ s ]
+                self.addLink( leafs[ ls ], switch, **linkopts )
 
 class IpHost( Host ):
-    def __init__( self, name, gateway, *args, **kwargs ):
+    def __init__( self, name, *args, **kwargs ):
         super( IpHost, self ).__init__( name, *args, **kwargs )
-        self.gateway = gateway
+        gateway = re.split('\.|/', kwargs['ip'])
+        gateway[3] = '254'
+        self.gateway = '.'.join(gateway[0:4])
 
     def config( self, **kwargs ):
         Host.config( self, **kwargs )
@@ -105,15 +115,43 @@
         # add VLAN interface to host's name to intf map
         self.nameToIntf[ newName ] = intf
 
+class ExtendedCLI( CLI ):
+    """
+    Extends mininet CLI with the following commands:
+    addvlanhost
+    addiphost
+    """
+    def do_addhost( self, line ):
+        #Parsing args from CLI
+        args = line.split( )
+        if len( args ) < 3 or len( args ) :
+            "usage: addhost hostname switch **params"
+        hostname, switch = args[0],  args[1]
+        params = eval(line.split( ' ', 3 )[2])
+        if 'cls' in params:
+            params['cls'] = eval( params[ 'cls' ] )
+        if hostname in self.mn:
+            #error( '%s already exists!\n' % hostname )
+            return
+        if switch not in self.mn:
+            #error( '%s does not exist!\n' % switch )
+            return
+        print params
+        host = self.mn.addHostCfg( hostname, **params )
+        #switch.attach( link.intf2 )
+        #host.config()
+        link = self.mn.addLink( host, switch )
+        host.config(**params)
 
 def config( opts ):
     spine = opts.spine
     leaf = opts.leaf
     fanout = opts.fanout
+    vlan = opts.vlan
     controllers = [ os.environ[ 'OC%s' % i ] for i in
                     range( 1, opts.onos + 1 ) ] if (opts.onos) else [
         '127.0.0.1' ]
-    topo = LeafAndSpine( spine=spine, leaf=leaf, fanout=fanout )
+    topo = LeafAndSpine( spine=spine, leaf=leaf, fanout=fanout, vlan=vlan )
     net = Mininet( topo=topo, link=TCLink, build=False,
                    switch=UserSwitch, controller=None, autoSetMacs=True )
     i = 0
@@ -122,7 +160,9 @@
         i += 1;
     net.build( )
     net.start( )
-    CLI( net )
+    out1 = net.get( 'out1' )
+    out1.cmd( "arp -s 10.0.9.254 10:00:00:00:00:01 -i %s " % (out1.intf()) )
+    CLI(net)
     net.stop( )
 
 
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/0x1.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/0x1.chart
new file mode 100755
index 0000000..0714893
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/0x1.chart
@@ -0,0 +1,8 @@
+{

+  "ip": {"expect": "True",

+    "hosts":["h1", "h2"]},

+  "vlan5": {"expect":"True",

+    "hosts":["olt5", "vsg5"]},

+  "vlan10": {"expect":"True",

+    "hosts":["olt10", "vsg10"]}

+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/0x1.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/0x1.json
similarity index 62%
rename from TestON/tests/USECASE/SegmentRouting/dependencies/0x1.json
rename to TestON/tests/USECASE/SegmentRouting/dependencies/json/0x1.json
index 867785a..36955e1 100755
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/0x1.json
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/0x1.json
@@ -13,6 +13,20 @@
             "ips" : [ "10.0.1.254/24" ]
         }
         ]
+    },
+    "of:0000000000000001/3" : {
+      "interfaces" : [
+        {
+          "ips" : [ "10.0.1.254/24" ]
+        }
+      ]
+    },
+    "of:0000000000000001/4" : {
+      "interfaces" : [
+        {
+          "ips" : [ "10.0.1.254/24" ]
+        }
+      ]
     }
     },
     "devices" : {
@@ -44,21 +58,20 @@
     },
     "apps": {
         "org.onosproject.segmentrouting": {
-          "xconnect": {
-            "of:0000000000000001": [
-              {
-                "vlan": 5,
-                "ports": [3, 4],
-                "name": "OLT 1"
-              },
-              {
-                "vlan": 10,
-                "ports": [3, 5],
-                "name": "OLT 2"
-              }
-            ]
-          }
+            "xconnect": {
+                "of:0000000000000001": [
+                    {
+                        "vlan": 5,
+                        "ports": [5, 7],
+                        "name": "OLT 1"
+                    },
+                    {
+                        "vlan": 10,
+                        "ports": [5, 8],
+                        "name": "OLT 2"
+                    }
+                ]
+            }
         }
     }
-
 }
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/2x2.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/2x2.chart
new file mode 100755
index 0000000..572f85a
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/2x2.chart
@@ -0,0 +1,8 @@
+{

+  "ip": {"expect": "True",

+    "hosts":["h1", "h2", "h3", "h4"]},

+  "vlan5": {"expect":"True",

+    "hosts":["olt5", "vsg5"]},

+  "vlan10": {"expect":"True",

+    "hosts":["olt10", "vsg10"]}

+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/2x2.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/2x2.json
similarity index 73%
rename from TestON/tests/USECASE/SegmentRouting/dependencies/2x2.json
rename to TestON/tests/USECASE/SegmentRouting/dependencies/json/2x2.json
index d4fa3fb..433b594 100755
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/2x2.json
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/2x2.json
@@ -1,5 +1,19 @@
 {
     "ports" : {
+    "of:0000000000000001/1" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.1.254/24" ]
+        }
+        ]
+    },
+    "of:0000000000000001/2" : {
+        "interfaces" : [
+        {
+            "ips" : [ "10.0.1.254/24" ]
+        }
+        ]
+    },
     "of:0000000000000001/3" : {
         "interfaces" : [
         {
@@ -14,14 +28,14 @@
         }
         ]
     },
-    "of:0000000000000002/3" : {
+    "of:0000000000000002/1" : {
         "interfaces" : [
         {
             "ips" : [ "10.0.2.254/24" ]
         }
         ]
     },
-    "of:0000000000000002/4" : {
+    "of:0000000000000002/2" : {
         "interfaces" : [
         {
             "ips" : [ "10.0.2.254/24" ]
@@ -79,44 +93,44 @@
         "00:00:00:00:00:01/-1" : {
             "basic": {
                 "ips": ["10.0.1.1"],
-                "location": "of:0000000000000001/3"
+                "location": "of:0000000000000001/1"
             }
         },
         "00:00:00:00:00:02/-1" : {
             "basic": {
                 "ips": ["10.0.1.2"],
-                "location": "of:0000000000000001/4"
+                "location": "of:0000000000000001/2"
             }
         },
         "00:00:00:00:00:03/-1" : {
             "basic": {
                 "ips": ["10.0.2.1"],
-                "location": "of:0000000000000002/3"
+                "location": "of:0000000000000002/1"
             }
         },
         "00:00:00:00:00:04/-1" : {
             "basic": {
                 "ips": ["10.0.2.2"],
-                "location": "of:0000000000000002/4"
+                "location": "of:0000000000000002/2"
             }
         }
     },
     "apps": {
         "org.onosproject.segmentrouting": {
-          "xconnect": {
-            "of:0000000000000001": [
-              {
-                "vlan": 5,
-                "ports": [5, 6],
-                "name": "OLT 1"
-              },
-              {
-                "vlan": 10,
-                "ports": [5, 7],
-                "name": "OLT 2"
-              }
-            ]
-          }
+            "xconnect": {
+                "of:0000000000000001": [
+                    {
+                        "vlan": 5,
+                        "ports": [5,7],
+                        "name": "OLT 1"
+                    },
+                    {
+                        "vlan": 10,
+                        "ports": [5,8],
+                        "name": "OLT 2"
+                    }
+                ]
+            }
         }
     }
 }
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/4x4.chart b/TestON/tests/USECASE/SegmentRouting/dependencies/json/4x4.chart
new file mode 100755
index 0000000..31fada0
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/4x4.chart
@@ -0,0 +1,8 @@
+{

+  "ip": {"expect": "True",

+    "hosts":["h1", "h2", "h3", "h4", "h5", "h6", "h7", "h8"]},

+  "vlan5": {"expect":"True",

+    "hosts":["olt5", "vsg5"]},

+  "vlan10": {"expect":"True",

+    "hosts":["olt10", "vsg10"]}

+}
\ No newline at end of file
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/4x4.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/4x4.json
similarity index 78%
rename from TestON/tests/USECASE/SegmentRouting/dependencies/4x4.json
rename to TestON/tests/USECASE/SegmentRouting/dependencies/json/4x4.json
index 55f3225..8230261 100755
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/4x4.json
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/4x4.json
@@ -1,55 +1,69 @@
 {
     "ports" : {
-    "of:0000000000000001/5" : {
+    "of:0000000000000001/1" : {
         "interfaces" : [
         {
             "ips" : [ "10.0.1.254/24" ]
         }
         ]
     },
-    "of:0000000000000001/6" : {
+    "of:0000000000000001/2" : {
         "interfaces" : [
         {
             "ips" : [ "10.0.1.254/24" ]
         }
         ]
     },
-    "of:0000000000000002/5" : {
+    "of:0000000000000001/3" : {
+        "interfaces" : [
+            {
+                "ips" : [ "10.0.1.254/24" ]
+            }
+        ]
+    },
+    "of:0000000000000001/4" : {
+        "interfaces" : [
+            {
+                "ips" : [ "10.0.1.254/24" ]
+            }
+        ]
+    },
+    "of:0000000000000002/1" : {
         "interfaces" : [
         {
             "ips" : [ "10.0.2.254/24" ]
         }
         ]
     },
-    "of:0000000000000002/6" : {
+    "of:0000000000000002/2" : {
         "interfaces" : [
         {
             "ips" : [ "10.0.2.254/24" ]
         }
         ]
     },
-    "of:0000000000000003/5" : {
+    "of:0000000000000003/1" : {
         "interfaces" : [
         {
             "ips" : [ "10.0.3.254/24" ]
         }
         ]
     },
-    "of:0000000000000003/6" : {
+    "of:0000000000000003/2" : {
         "interfaces" : [
         {
             "ips" : [ "10.0.3.254/24" ]
         }
         ]
     },
-    "of:0000000000000004/5" : {
+    "of:0000000000000004/1" : {
         "interfaces" : [
         {
             "ips" : [ "10.0.4.254/24" ]
         }
         ]
     },
-    "of:0000000000000004/6" : {
+    "of:0000000000000004/2" : {
         "interfaces" : [
         {
             "ips" : [ "10.0.4.254/24"]
@@ -151,68 +165,68 @@
         "00:00:00:00:00:01/-1" : {
             "basic": {
                 "ips": ["10.0.1.1"],
-                "location": "of:0000000000000001/5"
+                "location": "of:0000000000000001/1"
             }
         },
         "00:00:00:00:00:02/-1" : {
             "basic": {
                 "ips": ["10.0.1.2"],
-                "location": "of:0000000000000001/6"
+                "location": "of:0000000000000001/2"
             }
         },
         "00:00:00:00:00:03/-1" : {
             "basic": {
                 "ips": ["10.0.2.1"],
-                "location": "of:0000000000000002/5"
+                "location": "of:0000000000000002/1"
             }
         },
         "00:00:00:00:00:04/-1" : {
             "basic": {
                 "ips": ["10.0.2.2"],
-                "location": "of:0000000000000002/6"
+                "location": "of:0000000000000002/2"
             }
         },
         "00:00:00:00:00:05/-1" : {
             "basic": {
                 "ips": ["10.0.3.1"],
-                "location": "of:0000000000000003/5"
+                "location": "of:0000000000000003/1"
             }
         },
         "00:00:00:00:00:06/-1" : {
             "basic": {
                 "ips": ["10.0.3.2"],
-                "location": "of:0000000000000003/6"
+                "location": "of:0000000000000003/2"
             }
         },
         "00:00:00:00:00:07/-1" : {
             "basic": {
                 "ips": ["10.0.4.1"],
-                "location": "of:0000000000000004/5"
+                "location": "of:0000000000000004/1"
             }
         },
         "00:00:00:00:00:08/-1" : {
             "basic": {
                 "ips": ["10.0.4.2"],
-                "location": "of:0000000000000004/6"
+                "location": "of:0000000000000004/2"
             }
         }
     },
     "apps": {
         "org.onosproject.segmentrouting": {
-          "xconnect": {
-            "of:0000000000000001": [
-              {
-                "vlan": 5,
-                "ports": [7, 8],
-                "name": "OLT 1"
-              },
-              {
-                "vlan": 10,
-                "ports": [7, 9],
-                "name": "OLT 2"
-              }
-            ]
-          }
+            "xconnect": {
+                "of:0000000000000001": [
+                    {
+                        "vlan": 5,
+                        "ports": [5,7],
+                        "name": "OLT 1"
+                    },
+                    {
+                        "vlan": 10,
+                        "ports": [5,8],
+                        "name": "OLT 2"
+                    }
+                ]
+            }
         }
     }
 }
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/json/extra.json b/TestON/tests/USECASE/SegmentRouting/dependencies/json/extra.json
new file mode 100755
index 0000000..992a04c
--- /dev/null
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/json/extra.json
@@ -0,0 +1,16 @@
+{
+    "hosts" : {
+        "00:00:00:00:00:09/-1" : {
+            "basic": {
+                "ips": ["10.0.1.9"],
+                "location": "of:0000000000000001/3"
+            }
+        },
+        "00:00:00:00:09:01/-1" : {
+            "basic": {
+                "ips": ["10.0.9.1"],
+                "location": "of:0000000000000001/4"
+            }
+        }
+    }
+}