Merge pull request #48 from opennetworkinglab/ONOS-Next

Merge ONOS-Next branch into Master
diff --git a/TestON/bin/.pylint b/TestON/bin/.pylint
new file mode 100644
index 0000000..469a744
--- /dev/null
+++ b/TestON/bin/.pylint
@@ -0,0 +1,300 @@
+# lint Python modules using external checkers.
+#
+# This is the main checker controlling the other ones and the reports
+# generation. It is itself both a raw checker and an astng checker in order
+# to:
+# * handle message activation / deactivation at the module level
+# * handle some basic but necessary stats'data (number of classes, methods...)
+#
+[MASTER]
+
+# Specify a configuration file.
+#rcfile=
+
+# Python code to execute, usually for sys.path manipulation such as
+# pygtk.require().
+#init-hook=
+
+# Profiled execution.
+profile=no
+
+# Add <file or directory> to the black list. It should be a base name, not a
+# path. You may set this option multiple times.
+ignore=CVS
+
+# Pickle collected data for later comparisons.
+persistent=yes
+
+# List of plugins (as comma separated values of python modules names) to load,
+# usually to register additional checkers.
+load-plugins=
+
+
+[MESSAGES CONTROL]
+
+# Enable the message, report, category or checker with the given id(s). You can
+# either give multiple identifier separated by comma (,) or put this option
+# multiple time.
+#enable=
+
+# Disable the message, report, category or checker with the given id(s). You
+# can either give multiple identifier separated by comma (,) or put this option
+# multiple time (only on the command line, not in the configuration file where
+# it should appear only once).
+disable=pointless-except, invalid-name, super-init-not-called, fixme, star-args,
+        too-many-instance-attributes, too-few-public-methods, too-many-arguments,
+        too-many-locals, too-many-public-methods, duplicate-code, bad-whitespace,
+        locally-disabled
+
+[REPORTS]
+
+# Set the output format. Available formats are text, parseable, colorized, msvs
+# (visual studio) and html
+output-format=colorized
+msg-template='{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}'
+
+# Include message's id in output
+include-ids=yes
+
+# Put messages in a separate file for each module / package specified on the
+# command line instead of printing them on stdout. Reports (if any) will be
+# written in a file name "pylint_global.[txt|html]".
+files-output=no
+
+# Tells wether to display a full report or only the messages
+reports=no
+
+# Python expression which should return a note less than 10 (10 is the highes
+# note). You have access to the variables errors warning, statement which
+# respectivly contain the number of errors / warnings messages and the total
+# number of statements analyzed. This is used by the global evaluation repor
+# (R0004).
+evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
+
+# Add a comment according to your evaluation note. This is used by the global
+# evaluation report (R0004).
+comment=no
+
+# Enable the report(s) with the given id(s).
+#enable-report=
+
+# Disable the report(s) with the given id(s).
+#disable-report=
+
+
+# checks for :
+# * doc strings
+# * modules / classes / functions / methods / arguments / variables name
+# * number of arguments, local variables, branchs, returns and statements in
+# functions, methods
+# * required module attributes
+# * dangerous default values as arguments
+# * redefinition of function / method / class
+# * uses of the global statemen
+#
+[BASIC]
+
+# Required attributes for module, separated by a comma
+required-attributes=
+
+# Regular expression which should only match functions or classes name which do
+# not require a docstring
+no-docstring-rgx=__.*__
+
+# Regular expression which should only match correct module names
+module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
+
+# Regular expression which should only match correct module level names
+const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$
+
+# Regular expression which should only match correct class names
+class-rgx=[A-Z_][a-zA-Z0-9]+$
+
+# Regular expression which should only match correct function names
+function-rgx=[a-z_][a-z0-9_]{2,30}$
+
+# Regular expression which should only match correct method names
+method-rgx=[a-z_][a-z0-9_]{2,30}$
+
+# Regular expression which should only match correct instance attribute names
+attr-rgx=[a-z_][a-z0-9_]{2,30}$
+
+# Regular expression which should only match correct argument names
+argument-rgx=[a-z_][a-z0-9_]{2,30}$
+
+# Regular expression which should only match correct variable names
+variable-rgx=[a-z_][a-z0-9_]{2,30}$
+
+# Regular expression which should only match correct list comprehension /
+# generator expression variable names
+inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
+
+# Good variable names which should always be accepted, separated by a comma
+good-names=i,j,k,ex,Run,_
+
+# Bad variable names which should always be refused, separated by a comma
+bad-names=foo,bar,baz,toto,tutu,tata
+
+# List of builtins function names that should not be used, separated by a comma
+bad-functions=map,filter,apply,inpu
+
+
+# try to find bugs in the code using type inference
+#
+[TYPECHECK]
+
+# Tells wether missing members accessed in mixin class should be ignored. A
+# mixin class is detected if its name ends with "mixin" (case insensitive).
+ignore-mixin-members=yes
+
+# List of classes names for which member attributes should not be checked
+# (useful for classes with attributes dynamicaly set).
+ignored-classes=SQLObjec
+
+# When zope mode is activated, add a predefined set of Zope acquired attributes
+# to generated-members.
+zope=no
+
+# List of members which are set dynamically and missed by pylint inference
+# system, and so shouldn't trigger E0201 when accessed.
+generated-members=REQUEST,acl_users,aq_paren
+
+
+# checks for
+# * unused variables / imports
+# * undefined variables
+# * redefinition of variable from builtins or from an outer scope
+# * use of variable before assigmen
+#
+[VARIABLES]
+
+# Tells wether we should check for unused import in __init__ files.
+init-import=no
+
+# A regular expression matching names used for dummy variables (i.e. not used).
+dummy-variables-rgx=_|dummy
+
+# List of additional names supposed to be defined in builtins. Remember tha
+# you should avoid to define new builtins when possible.
+additional-builtins=
+
+
+# checks for :
+# * methods without self as first argumen
+# * overridden methods signature
+# * access only to existant members via self
+# * attributes not defined in the __init__ method
+# * supported interfaces implementation
+# * unreachable code
+#
+[CLASSES]
+
+# List of interface methods to ignore, separated by a comma. This is used for
+# instance to not check methods defines in Zope's Interface base class.
+ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
+
+# List of method names used to declare (i.e. assign) instance attributes.
+defining-attr-methods=__init__,__new__,setUp,build
+
+
+# checks for sign of poor/misdesign:
+# * number of methods, attributes, local variables...
+# * size, complexity of functions, methods
+#
+[DESIGN]
+
+# Maximum number of arguments for function / method
+max-args=5
+
+# Maximum number of locals for function / method body
+max-locals=15
+
+# Maximum number of return / yield for function / method body
+max-returns=6
+
+# Maximum number of branch for function / method body
+max-branchs=12
+
+# Maximum number of statements in function / method body
+max-statements=50
+
+# Maximum number of parents for a class (see R0901).
+max-parents=7
+
+# Maximum number of attributes for a class (see R0902).
+max-attributes=7
+
+# Minimum number of public methods for a class (see R0903).
+min-public-methods=2
+
+# Maximum number of public methods for a class (see R0904).
+max-public-methods=20
+
+
+# checks for
+# * external modules dependencies
+# * relative / wildcard imports
+# * cyclic imports
+# * uses of deprecated modules
+#
+[IMPORTS]
+
+# Deprecated modules which should not be used, separated by a comma
+deprecated-modules=regsub,string,TERMIOS,Bastion,rexec
+
+# Create a graph of every (i.e. internal and external) dependencies in the
+# given file (report R0402 must not be disabled)
+import-graph=
+
+# Create a graph of external dependencies in the given file (report R0402 mus
+# not be disabled)
+ext-import-graph=
+
+# Create a graph of internal dependencies in the given file (report R0402 mus
+# not be disabled)
+int-import-graph=
+
+
+# checks for :
+# * unauthorized constructions
+# * strict indentation
+# * line length
+# * use of <> instead of !=
+#
+[FORMAT]
+
+# Maximum number of characters on a single line.
+max-line-length=80
+
+# Maximum number of lines in a module
+max-module-lines=1500
+
+# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
+# tab).
+indent-string='    '
+
+
+# checks for:
+# * warning notes in the code like FIXME, XXX
+# * PEP 263: source code with non ascii character but no encoding declaration
+#
+[MISCELLANEOUS]
+
+# List of note tags to take in consideration, separated by a comma.
+notes=FIXME,XXX,TODO
+
+
+# checks for similarities and duplicated code. This computation may be
+# memory / CPU intensive, so you should disable it if you experiments some
+# problems.
+#
+[SIMILARITIES]
+
+# Minimum lines number of a similarity.
+min-similarity-lines=4
+
+# Ignore comments when computing similarities.
+ignore-comments=yes
+
+# Ignore docstrings when computing similarities.
+ignore-docstrings=yes
diff --git a/TestON/bin/codecheck b/TestON/bin/codecheck
new file mode 100755
index 0000000..1193df8
--- /dev/null
+++ b/TestON/bin/codecheck
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+#These are from the Mininet coding style
+P8IGN=E251,E201,E302,E202,E126,E127,E203,E226,W391
+
+# help text function
+help ()
+{
+    echo "Usage: codecheck [FILE]... [OPTION]..."
+    echo "Simple script that runs some python code check tools on a file or folder"
+    echo "Note that for now, options must come after the file/folder path"
+    echo -e "\nOptions include:"
+    echo -e "   --fix\tRun the automatic style scripts on a file and save the output to FILE.fixed"
+    echo -e "   --reason\tShow a short snippit for each PEP8 violation"
+    echo -e "   --help\tDisplays this help text and exits"
+}
+
+
+if [ -z "$1" ] || [[ "$1" =~ --* ]]; then
+    help
+elif [ "$2" = "--fix" ]; then
+    file=$1.fixed
+    echo "Fixing PEP8 errors. WARNING: This may be harmful to your code."
+    echo "For safety, the new code is written to $file"
+    #autopep8 -a -a $1
+    autopep8 -a -a $1 --ignore=E501 | $(dirname "${BASH_SOURCE}")/unpep8 > $file
+    autopep8 --in-place -a -a $file --ignore=$P8IGN
+elif [ -z "$2" ] || [ "$2" = "--reason" ]; then
+    echo "Running pyflakes..."
+    #Pyflakes is a source checker. It doesn't run the code so it is safer than other programs
+    #ignoring some errors due to TestON
+    pyflakes $1 | grep -v "undefined name 'main'" | grep -v "undefined name 'utilities'"
+    echo "Running pylint..."
+    #Pylint is a static code checker
+    #ignoring some errors due to TestON
+    pylint -E --rcfile=$(dirname "${BASH_SOURCE}")/.pylint $1 | grep -v "Undefined variable 'main'" | grep -v "Undefined variable 'utilities'"
+
+    echo "Running PEP8..."
+    #PEP8 is a the most common python coding style standard
+    if [ -z "$2"]; then
+        pep8 --repeat --show-source --ignore=$P8IGN $1
+    else
+        pep8 --repeat --show-source --show-pep8 --ignore=$P8IGN $1
+    fi
+else
+    help
+fi
+
+
+
diff --git a/TestON/bin/unpep8 b/TestON/bin/unpep8
new file mode 100755
index 0000000..090865a
--- /dev/null
+++ b/TestON/bin/unpep8
@@ -0,0 +1,198 @@
+#!/usr/bin/python
+
+"""
+Translate from PEP8 Python style to Mininet (i.e. Arista-like)
+Python style
+
+usage: unpep8 < old.py > new.py
+
+- Reinstates CapWords for methods and instance variables
+- Gets rid of triple single quotes
+- Eliminates triple quotes on single lines
+- Inserts extra spaces to improve readability
+- Fixes Doxygen (or doxypy) ugliness
+
+Does the following translations:
+
+ClassName.method_name(foo = bar) -> ClassName.methodName( foo=bar )
+
+Triple-single-quotes -> triple-double-quotes
+
+@param foo description -> foo: description
+@return description    -> returns: description
+@author me             -> author: me
+@todo(me)              -> TODO(me)
+
+Bugs/Limitations:
+
+- Hack to restore strings is ugly
+- Multiline strings get mangled
+- Comments are mangled (which is arguably the "right thing" to do, except
+  that, for example, the left hand sides of the above would get translated!)
+- Doesn't eliminate unnecessary backslashes
+- Has no opinion on tab size
+- complicated indented docstrings get flattened
+- We don't (yet) have a filter to generate Doxygen/Doxypy
+- Currently leaves indents on blank comment lines
+- May lead to namespace collisions (e.g. some_thing and someThing)
+
+Bob Lantz, rlantz@cs.stanford.edu
+1/24/2010
+"""
+
+import re, sys
+
+def fixUnderscoreTriplet( match ):
+   "Translate a matched triplet of the form a_b to aB."
+   triplet = match.group()
+   return triplet[ :-2 ] + triplet[ -1 ].capitalize()
+
+def reinstateCapWords( text ):
+   underscoreTriplet = re.compile( r'[A-Za-z0-9]_[A-Za-z0-9]' )
+   return underscoreTriplet.sub( fixUnderscoreTriplet, text )
+ 
+def replaceTripleApostrophes( text ):
+   "Replace triple apostrophes with triple quotes."
+   return text.replace( "'''", '"""')
+
+def simplifyTripleQuotes( text ):
+   "Fix single-line doc strings."
+   r = re.compile( r'"""([^\"\n]+)"""' )
+   return r.sub( r'"\1"', text )
+   
+def insertExtraSpaces( text ):
+   "Insert extra spaces inside of parentheses and brackets/curly braces."
+   lparen = re.compile( r'\((?![\s\)])' )
+   text = lparen.sub( r'( ', text )
+   rparen = re.compile( r'([^\s\(])(?=\))' )
+   text = rparen.sub( r'\1 ', text)
+   # brackets
+   lbrack = re.compile( r'\[(?![\s\]])' )
+   text = lbrack.sub( r'[ ', text )
+   rbrack = re.compile( r'([^\s\[])(?=\])' )
+   text = rbrack.sub( r'\1 ', text)
+   # curly braces
+   lcurly = re.compile( r'\{(?![\s\}])' )
+   text = lcurly.sub( r'{ ', text )
+   rcurly = re.compile( r'([^\s\{])(?=\})' )
+   text = rcurly.sub( r'\1 ', text)   
+   return text
+   
+def fixDoxygen( text ):
+   """Translate @param foo to foo:, @return bar to returns: bar, and
+      @author me to author: me"""
+   param = re.compile( r'@param (\w+)' )
+   text = param.sub( r'\1:', text )
+   returns = re.compile( r'@return' )
+   text = returns.sub( r'returns:', text )
+   author = re.compile( r'@author' )
+   text = author.sub( r'author:', text)
+   # @todo -> TODO
+   text = text.replace( '@todo', 'TODO' )
+   return text
+
+def removeCommentFirstBlankLine( text ):
+   "Remove annoying blank lines after first line in comments."
+   line = re.compile( r'("""[^\n]*\n)\s*\n', re.MULTILINE )
+   return line.sub( r'\1', text )
+   
+def fixArgs( match, kwarg = re.compile( r'(\w+) = ' ) ):
+   "Replace foo = bar with foo=bar."
+   return kwarg.sub( r'\1=', match.group() )
+   
+def fixKeywords( text ):
+   "Change keyword argumentsfrom foo = bar to foo=bar."
+   args = re.compile( r'\(([^\)]+)\)', re.MULTILINE )
+   return args.sub( fixArgs, text )
+
+# Unfortunately, Python doesn't natively support balanced or recursive
+# regular expressions. We could use PyParsing, but that opens another can
+# of worms. For now, we just have a cheap hack to restore strings,
+# so we don't end up accidentally mangling things like messages, search strings,
+# and regular expressions.
+
+def lineIter( text ):
+   "Simple iterator over lines in text."
+   for line in text.splitlines(): yield line
+   
+def stringIter( strList ):
+   "Yield strings in strList."
+   for s in strList: yield s
+
+def restoreRegex( regex, old, new ):
+   "Find regexes in old and restore them into new."
+   oldStrs = regex.findall( old )
+   # Sanity check - count should be the same!
+   newStrs = regex.findall( new )
+   assert len( oldStrs ) == len( newStrs )
+   # Replace newStrs with oldStrs
+   siter = stringIter( oldStrs )
+   reps = lambda dummy: siter.next()
+   return regex.sub( reps, new )
+
+# This is a cheap hack, and it may not work 100%, since
+# it doesn't handle multiline strings.
+# However, it should be mostly harmless...
+   
+def restoreStrings( oldText, newText ):
+   "Restore strings from oldText into newText, returning result."
+   oldLines, newLines = lineIter( oldText ), lineIter( newText )
+   quoteStrings = re.compile( r'("[^"]*")' )
+   tickStrings = re.compile( r"('[^']*')" )
+   result = ''
+   # It would be nice if we could blast the whole file, but for
+   # now it seems to work line-by-line
+   for newLine in newLines:
+      oldLine = oldLines.next()
+      newLine = restoreRegex( quoteStrings, oldLine, newLine )
+      newLine = restoreRegex( tickStrings, oldLine, newLine )
+      result += newLine + '\n'
+   return result
+   
+# This might be slightly controversial, since it uses
+# three spaces to line up multiline comments. However,
+# I much prefer it. Limitations: if you have deeper
+# indents in comments, they will be eliminated. ;-(
+
+def fixComment( match, 
+   indentExp=re.compile( r'\n([ ]*)(?=[^/s])', re.MULTILINE ),
+   trailingQuotes=re.compile( r'\s+"""' ) ):
+   "Re-indent comment, and join trailing quotes."
+   originalIndent = match.group( 1 )
+   comment = match.group( 2 )
+   indent = '\n' + originalIndent
+   # Exception: leave unindented things unindented!
+   if len( originalIndent ) is not 0: indent += '   '
+   comment = indentExp.sub( indent, comment )
+   return originalIndent + trailingQuotes.sub( '"""', comment )
+   
+def fixCommentIndents( text ):
+   "Fix multiline comment indentation."
+   comments = re.compile( r'^([ ]*)("""[^"]*""")$', re.MULTILINE )
+   return comments.sub( fixComment, text )
+ 
+def removeBogusLinefeeds( text ):
+   "Remove extra linefeeds at the end of single-line comments."
+   bogusLfs = re.compile( r'"([^"\n]*)\n"', re.MULTILINE )
+   return bogusLfs.sub( '"\1"', text)
+   
+def convertFromPep8( program ):
+   oldProgram = program
+   # Program text transforms
+   # program = reinstateCapWords( program )  # Turning off for now
+   program = fixKeywords( program )
+   program = insertExtraSpaces( program )
+   # Undo string damage
+   program = restoreStrings( oldProgram, program )
+   # Docstring transforms
+   program = replaceTripleApostrophes( program )
+   program = simplifyTripleQuotes( program )
+   program = fixDoxygen( program )
+   # program = fixCommentIndents( program ) # Turning off as it breaks tests in TestON
+   program = removeBogusLinefeeds( program )
+   # Destructive transforms (these can delete lines)
+   program = removeCommentFirstBlankLine( program )
+   return program
+
+if __name__ == '__main__':
+   print convertFromPep8( sys.stdin.read() )
diff --git a/TestON/core/logger.py b/TestON/core/logger.py
index 44a70b8..80fe0de 100644
--- a/TestON/core/logger.py
+++ b/TestON/core/logger.py
@@ -42,7 +42,7 @@
             
         logmsg = logmsg + "\n\tTest Script :" + path + "Tests/" + main.TEST + ".py"+ ""
         logmsg = logmsg + "\n\tTest Params : " + path + "Tests/" + main.TEST + ".params" + ""
-        logmsg = logmsg + "\n\tTopology : " + path + "Tests/" +main.TEST + ".tpl" + ""
+        logmsg = logmsg + "\n\tTopology : " + path + "Tests/" +main.TEST + ".topo" + ""
         logmsg = logmsg + "\n"+" " * 30+"+" +"-" * 18+"+" +"\n" +"-" * 27+"  { Script Exec Params }  "+"-" * 27 +"\n" +" " * 30 +"+"+"-" * 18 +"+\n";
         values = "\n\t" + str(main.params)
         values = re.sub(",", "\n\t", values)
@@ -110,7 +110,8 @@
            
         main.LogFileName = main.logdir + "/" + main.TEST + "_" +str(currentTime) + ".log"
         main.ReportFileName = main.logdir + "/" + main.TEST + "_" + str(currentTime) + ".rpt"
-                
+        main.JenkinsCSV = main.logdir + "/" + main.TEST + ".csv"
+ 
         #### Add log-level - Report
         logging.addLevelName(9, "REPORT")
         logging.addLevelName(7, "EXACT")
@@ -228,7 +229,17 @@
         #main.log.report(testResult)
         main.testResult = testResult
         main.log.exact(testResult)
-                
+
+        ##CSV output needed for Jenkin's plot plugin
+        #NOTE: the elements were orded based on the colors assigned to the data
+        logfile = open(main.JenkinsCSV ,"w")
+        logfile.write(",".join( ['Tests Failed', 'Tests Passed', 'Tests Planned'] ) + "\n")
+        logfile.write(",".join( [str(int(main.TOTAL_TC_FAIL)), str(int(main.TOTAL_TC_PASS)), str(int(main.TOTAL_TC_PLANNED))] ))
+        logfile.close()
+
+
+
+
     def updateCaseResults(self,main):
         '''
             Update the case result based on the steps execution and asserting each step in the test-case
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index b0752ca..8934e50 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -628,7 +628,7 @@
     try :
         testModule = __import__(main.classPath, globals(), locals(), [main.TEST], -1)
     except(ImportError):
-        print "There is no test like "+main.TEST
+        print "There was an import error, it might mean that there is no test like "+main.TEST
         main.exit()       
 
     testClass = getattr(testModule, main.TEST)
diff --git a/TestON/dependencies/Jenkins_getresult_andrew.py b/TestON/dependencies/Jenkins_getresult_andrew.py
new file mode 100755
index 0000000..0e7ef8d
--- /dev/null
+++ b/TestON/dependencies/Jenkins_getresult_andrew.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+
+import sys
+import os
+import re
+import datetime
+import time
+import argparse
+
+parser = argparse.ArgumentParser()
+parser.add_argument("-n", "--name", help="Comma Separated string of test names. Ex: --name='test1, test2, test3'")
+args = parser.parse_args()
+
+#Pass in test names as a comma separated string argument. 
+#Example: ./Jenkins_getresult.py "Test1,Test2,Test3,Test4"
+name_list = args.name.split(",")
+result_list = map(lambda x: x.strip(), name_list)
+
+#NOTE: testnames list should be in order in which it is run
+testnames = result_list
+output = ''
+testdate = datetime.datetime.now()
+
+output +="<p>**************************************</p>"
+output +=testdate.strftime('Jenkins test result for %H:%M on %b %d, %Y. %Z')
+
+#TestON reporting
+for test in testnames:
+    name = os.popen("ls /home/admin/ONLabTest/TestON/logs/ -rt | grep %s | tail -1" % test).read().split()[0]
+    path = "/home/admin/ONLabTest/TestON/logs/" + name + "/"
+    output +="<p></p>"
+    #output +="   Date: %s, %s %s" % (name.split("_")[2], name.split("_")[1], name.split("_")[3]) + "<br>*******************<br>"
+    #Open the latest log folder 
+    output += "<h2>Test "+str(test)+"</h2><p>************************************</p>"
+
+    f = open(path + name + ".rpt")
+
+    #Parse through each line of logs and look for specific strings to output to wiki.
+    #NOTE: with current implementation, you must specify which output to output to wiki by using
+    #main.log.report("") since it is looking for the [REPORT] tag in the logs
+    for line in f:
+        if re.search("Result summary for Testcase", line):
+            output += "<h3>"+str(line)+"</h3>"
+            #output += "<br>"
+        if re.search("\[REPORT\]", line): 
+            line_split = line.split("] ")
+            #line string is split by bracket, and first two items (log tags) in list are omitted from output
+            #join is used to convert list to string
+            line_str = ''.join(line_split[2:])
+            output += "<p>"
+            output += line_str
+            output += "</p>"
+        if re.search("Result:", line):
+            output += "<p>"
+            output += line
+            output += "</p>"
+    f.close()
+
+    #*********************
+    #include any other phrase specific to case you would like to include in wiki here
+    if test == "IntentPerf":
+        output += "URL to Historical Performance results data: <a href='http://10.128.5.54/perf.html'>Perf Graph</a>"
+    #*********************
+print output
diff --git a/TestON/dependencies/rotate.sh b/TestON/dependencies/rotate.sh
new file mode 100755
index 0000000..0f879b6
--- /dev/null
+++ b/TestON/dependencies/rotate.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+
+# NOTE: Taken fnd modified from onos.sh
+# pack-rotate-log [packname] "[log-filenames]" [max rotations]
+# Note: [packname] and all the log-files specified by [log-filenames]
+#       must reside in same dir
+# Example:
+#  pack="/foo/bar/testlogs"
+#  logfiles="/foo/bar/test1.log /foo/bar/test*.log"
+#  pack-rotate-log $pack "$logfiles" 5
+#   => testlogs.tar.bz2 (will contain test1.log test2.log ...)
+#      testlogs.tar.bz2 -> testlogs.1.tar.bz2
+#      testlogs.1.tar.bz2 -> testlogs.2.tar.bz2
+#      ...
+function pack-rotate-log {
+  local packname=$1
+  local logfiles=$2
+  local nr_max=${3:-10}
+  local suffix=".tar.bz2"
+
+  # rotate
+  for i in `seq $(expr $nr_max - 1) -1 1`; do
+    if [ -f ${packname}.${i}${suffix} ]; then
+      mv -f -- ${packname}.${i}${suffix} ${packname}.`expr $i + 1`${suffix}
+    fi
+  done
+  if [ -f ${packname}${suffix} ]; then
+    mv -- ${packname}${suffix} ${packname}.1${suffix}
+  fi
+
+  # pack
+  local existing_logfiles=$( ls -1 $logfiles  2>/dev/null | xargs -n1  basename 2>/dev/null)
+  if [ ! -z "${existing_logfiles}" ]; then
+    tar cjf ${packname}${suffix} -C `dirname ${packname}` -- ${existing_logfiles}
+    for word in ${existing_logfiles}
+    do
+        rm -- `dirname ${packname}`/${word}
+    done
+   fi
+}
+
+
+
+#Begin script
+#NOTE: This seems to break the TestON summary since it mentions the testname
+#echo "Rotating logs for '${1}' test"
+base_name=$1
+root_dir="/home/admin/packet_captures"
+timestamp=`date +%Y_%B_%d_%H_%M_%S`
+#Maybe this should be an argument? pack-and-rotate supports that
+nr_max=20
+
+pack-rotate-log ${root_dir}'/'${base_name} "${root_dir}/${base_name}*.pcap ${root_dir}/${base_name}*.log" ${nr_max}
diff --git a/TestON/drivers/common/api/find_node2.py b/TestON/drivers/common/api/find_node2.py
deleted file mode 100755
index eeb1504..0000000
--- a/TestON/drivers/common/api/find_node2.py
+++ /dev/null
@@ -1,44 +0,0 @@
-#! /usr/bin/env python
-import json
-import os
-import sys
-
-
-
-def find_host(RestIP,RestPort,RestAPI,hostMAC):
-    retcode = 0
-    url ="http://%s:%s/wm/device/" %(RestIP,RestPort)
-        
-    try:
-        command = "curl -s %s" % (url)
-        result = os.popen(command).read()
-        parsedResult = json.loads(result)
-    except:
-        print "REST IF %s has issue" % command
-        parsedResult = ""  
-
-    if type(parsedResult) == 'dict' and parsedResult.has_key('code'):
-        print "REST %s returned code %s" % (command, parsedResult['code'])
-        parsedResult = ""
-
-
-
-    if parsedResult == "":
-        return (retcode, "Rest API has an error")
-    else:
-        found = [item for item in parsedResult if item['mac'] == [str(hostMAC)]]
-        retcode = 1
-        return (retcode, found)
-
-
-if __name__ == "__main__":
-	ip = "10.128.100.1"
-	port = 8080
-	hostMAC = "00:00:00:00:00:06"
-	RestAPI = "/wm/device/"
-	Reststat,Hoststat = find_host(ip,port,RestAPI,hostMAC)
-	
-	if Reststat == 1:
-		print "Found device with MAC:" + hostMAC +" attached to switch(DPID):" + str(Hoststat[0]['attachmentPoint'][0]['switchDPID'])
-	else:
-		print " Device with MAC:" + hostMAC + " is not found!"
diff --git a/TestON/drivers/common/cli/check_status.py b/TestON/drivers/common/cli/check_status.py
deleted file mode 100755
index 791f1dd..0000000
--- a/TestON/drivers/common/cli/check_status.py
+++ /dev/null
@@ -1,111 +0,0 @@
-#! /usr/bin/env python
-import json
-import os
-import sys
-
-# http://localhost:8080/wm/onos/topology/switches
-# http://localhost:8080/wm/onos/topology/links
-# http://localhost:8080/wm/onos/registry/controllers/json
-# http://localhost:8080/wm/onos/registry/switches/json"
-
-def get_json(url):
-  try:
-    command = "curl -s %s" % (url)
-    result = os.popen(command).read()
-    parsedResult = json.loads(result)
-  except:
-    print "REST IF %s has issue" % command
-    parsedResult = ""
-
-  if type(parsedResult) == 'dict' and parsedResult.has_key('code'):
-    print "REST %s returned code %s" % (command, parsedResult['code'])
-    parsedResult = ""
-
-  return parsedResult 
-
-def check_switch(RestIP,correct_nr_switch ):
-  buf = ""
-  retcode = 0
-  RestPort="8080"
-
-  url="http://%s:%s/wm/onos/topology/switches" % (RestIP, RestPort)
-  parsedResult = get_json(url)
-
-  if parsedResult == "":
-    retcode = 1
-    return (retcode, "Rest API has an issue")
-
-  url = "http://%s:%s/wm/onos/registry/switches/json" % (RestIP, RestPort)
-  registry = get_json(url)
-
-  if registry == "":
-    retcode = 1
-    return (retcode, "Rest API has an issue")
-
-
-  buf += "switch: total %d switches\n" % len(parsedResult)
-  cnt = 0
-  active = 0
-
-  for s in parsedResult:
-    cnt += 1
-
-    if s['state']  == "ACTIVE":
-      active += 1
-
-    if not s['dpid'] in registry:
-      buf += "switch:  dpid %s lost controller\n" % (s['dpid'])
-
-  buf += "switch: network %d : %d switches %d active\n" % (0+1, cnt, active)
-  if correct_nr_switch != cnt:
-    buf += "switch fail: network %d should have %d switches but has %d\n" % (1, correct_nr_switch, cnt)
-    retcode = 1
-
-  if correct_nr_switch != active:
-    buf += "switch fail: network %d should have %d active switches but has %d\n" % (1, correct_nr_switch, active)
-    retcode = 1
-
-  return (retcode, buf)
-
-def check_link(RestIP, nr_links):
-  RestPort = "8080"
-  buf = ""
-  retcode = 0
-
-  url = "http://%s:%s/wm/onos/topology/links" % (RestIP, RestPort)
-  parsedResult = get_json(url)
-
-  if parsedResult == "":
-    retcode = 1
-    return (retcode, "Rest API has an issue")
-
-  buf += "link: total %d links (correct : %d)\n" % (len(parsedResult), nr_links)
-  intra = 0
-  interlink=0
-
-  for s in parsedResult:
-    intra = intra + 1 
-
-  if intra != nr_links:
-    buf += "link fail: network %d should have %d intra links but has %d\n" % (1, nr_links, intra)
-    retcode = 1
-
-  return (retcode, buf)
-
-#if __name__ == "__main__":
-def check_status(ip, numoswitch, numolink):
-
-  switch = check_switch(ip, numoswitch)
-  link = check_link(ip, numolink)
-  value = switch[0]
-  value += link[0]
-  if value != 0:
-    print "FAIL"
-    return 0
-  else: 
-    print "PASS"
-    return 1
-  print "%s" % switch[1]
-  print "%s" % link[1]
- # print "%s" % check_switch_local()[1]
- # print "%s" % check_controllers(8)[1]
diff --git a/TestON/drivers/common/cli/emulator/lincoedriver.py b/TestON/drivers/common/cli/emulator/lincoedriver.py
index 4d2cc01..2cb7c98 100644
--- a/TestON/drivers/common/cli/emulator/lincoedriver.py
+++ b/TestON/drivers/common/cli/emulator/lincoedriver.py
@@ -10,6 +10,7 @@
 list your email here for future contact:
 
     andrew@onlab.us
+    shreya@onlab.us
 
 OCT 20 2014
 '''
@@ -23,6 +24,7 @@
 import re
 import sys
 import core.teston
+import time
 sys.path.append("../")
 from math import pow
 from drivers.common.cli.emulatordriver import Emulator
@@ -60,9 +62,16 @@
         if self.handle :
             main.log.info("Handle successfully created")
             self.home = "~/linc-oe"
+         
             self.handle.sendline("cd "+self.home)
             self.handle.expect("oe$")
-
+          
+            #self.handle.sendline("pgrep -g linc")
+            #self.handle.expect("\$")
+            print "handle = ", self.handle.before            
+            
+            return main.TRUE 
+            ''' 
             main.log.info("Building Linc-OE")
             self.handle.sendline("make rel")
             i = self.handle.expect(["ERROR","linc-oe\$"],timeout=60)
@@ -73,15 +82,15 @@
                 x = self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
                 main.log.info("make rel returned: "+ str(x))
             else: 
-                main.log.info(self.name+": Starting Linc-OE CLI.. This may take a while")
-                time.sleep(30)
-                self.handle.sendline("sudo ./rel/linc/bin/linc console")
-                j = self.handle.expect(["linc@",pexpect.EOF,pexpect.TIMEOUT])
-          
+            
+            main.log.info(self.name+": Starting Linc-OE CLI.. This may take a while")
+            time.sleep(30)
+            self.handle.sendline("sudo ./rel/linc/bin/linc console")
+            j = self.handle.expect(["linc@",pexpect.EOF,pexpect.TIMEOUT])
             if j == 0:
                 main.log.info("Linc-OE CLI started")
                 return main.TRUE
-
+            '''
         else:
             main.log.error(self.name+
                     ": Connection failed to the host "+
@@ -90,6 +99,26 @@
                     ": Failed to connect to Linc-OE")
             return main.FALSE
 
+
+    def start_console(self):
+        import time
+        main.log.info(self.name+": Starting Linc-OE CLI.. This may take a while")
+        time.sleep(30)
+        self.handle.sendline("sudo ./rel/linc/bin/linc console")
+        j = self.handle.expect(["linc@",pexpect.EOF,pexpect.TIMEOUT])
+        start_result = self.handle.before
+        if j == 0:
+            main.log.info("Linc-OE CLI started")
+            return main.TRUE
+        else:
+            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 Linc-OE")
+            return main.FALSE
+
+
+
     def build(self):
         '''
         Build Linc-OE with the specified settings
@@ -132,7 +161,7 @@
         be created. They must be brought up manually
         '''
         try:
-            self.handle.sendline("ifconfig "+str(intf)+" up")
+            self.handle.sendline("ifconfig "+str(intfs)+" up")
             self.handle.expect("linc@")
    
             handle = self.handle.before
@@ -285,18 +314,42 @@
             main.log.info(self.name+" :::::::")
             main.cleanup()
             main.exit()
+    
+    def stopLincOEConsole(self):
+        '''
+        This function is only used for packet optical testing
+        Send disconnect prompt to Linc-OE CLI
+        (CTRL+C) and kill the linc process
+        '''
+        try:
+            cmd = "pgrep -f linc"
+            self.handle.sendline("pgrep -f linc")
+            self.handle.expect("linc") 
+            print "stophandle = ", self.handle.before
+        except pexpect.EOF:
+            main.log.error(self.name+ ": EOF exception")
+            main.log.error(self.name+ ":    " + self.handle.before) 
 
     def disconnect(self):
         '''
         Send disconnect prompt to Linc-OE CLI
-        (CTRL+C)
+        (CTRL+C) and kill the linc process
         '''
         try:
             #Send CTRL+C twice to exit CLI
-            self.handle.sendline("\x03")
-            self.handle.sendline("\x03")
+            self.handle.send("\x03")
+            self.handle.send("\x03")
             self.handle.expect("\$")
-
+            handle1 = self.handle.before
+            cmd = "pgrep -f linc"
+            self.handle.sendline(cmd)
+            self.handle.expect("\$")
+            handle2 = self.handle.before
+            main.log.info("pid's = "+handle2)
+            cmd = "sudo kill -9 `pgrep -f linc`"
+            self.handle.sendline(cmd)
+            self.handle.expect("\$")
+            
         except pexpect.EOF:
             main.log.error(self.name+ ": EOF exception")
             main.log.error(self.name+ ":    " + self.handle.before)
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index ad07d95..c125fca 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -1,1097 +1,1629 @@
 #!/usr/bin/env python
-'''
+"""
 Created on 26-Oct-2012
 
-@author: Anil Kumar (anilkumar.s@paxterrasolutions.com)
+author:: Anil Kumar ( anilkumar.s@paxterrasolutions.com )
 
 
-    TestON is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 2 of the License, or
-    (at your option) any later version.
+TestON is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+( at your option ) any later version.
 
-    TestON is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
+TestON is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
 
-    You should have received a copy of the GNU General Public License
-    along with TestON.  If not, see <http://www.gnu.org/licenses/>.		
+You should have received a copy of the GNU General Public License
+along with TestON.  If not, see <http://www.gnu.org/licenses/>.
 
 
-MininetCliDriver is the basic driver which will handle the Mininet functions
-'''
+MininetCliDriver is the basic driver which will handle the Mininet functions"""
 import traceback
 import pexpect
-import struct
-import fcntl
-import os
-import signal
 import re
 import sys
-import core.teston
-sys.path.append("../")
+sys.path.append( "../" )
 from math import pow
 from drivers.common.cli.emulatordriver import Emulator
-from drivers.common.clidriver import CLI
 
-class MininetCliDriver(Emulator):
-    '''
-    MininetCliDriver is the basic driver which will handle the Mininet functions
-    '''
-    def __init__(self):
-        super(Emulator, self).__init__()
+
+class MininetCliDriver( Emulator ):
+
+    """
+       MininetCliDriver is the basic driver which will handle
+       the Mininet functions"""
+    def __init__( self ):
+        super( Emulator, self ).__init__()
         self.handle = self
-        self.wrapped = sys.modules[__name__]
+        self.wrapped = sys.modules[ __name__ ]
         self.flag = 0
 
-    def connect(self, **connectargs):
-        '''
-        Here the main is the TestON instance after creating all the log handles.
-        '''
+    def connect( self, **connectargs ):
+        """
+           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']
-        self.handle = super(MininetCliDriver, self).connect(user_name = self.user_name, ip_address = self.ip_address,port = None, pwd = self.pwd)
-        
+            vars( self )[ key ] = connectargs[ key ]
+
+        self.name = self.options[ 'name' ]
+        self.handle = super(
+            MininetCliDriver,
+            self ).connect(
+            user_name=self.user_name,
+            ip_address=self.ip_address,
+            port=None,
+            pwd=self.pwd )
+
         self.ssh_handle = self.handle
-        
-        if self.handle :
-            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],120)
-            if i==0:
-                main.log.info(self.name+": Sending sudo password")
-                self.handle.sendline(self.pwd)
-                i=self.handle.expect(['%s:'%(self.user),'\$',pexpect.EOF,pexpect.TIMEOUT],120) 
-            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 MN took too long... " )
- 
-            main.log.info(self.name+": building fresh mininet") 
-            #### for reactive/PARP enabled tests
-            cmdString = "sudo mn " + self.options['arg1'] + " " + self.options['arg2'] +  " --mac --controller " + self.options['controller'] + " " + self.options['arg3']
-            
-            argList = self.options['arg1'].split(",")
+
+        if self.handle:
+            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 ],
+                                    120 )
+            if i == 0:
+                main.log.info( self.name + ": Sending sudo password" )
+                self.handle.sendline( self.pwd )
+                i = self.handle.expect( [ '%s:' % ( self.user ),
+                                          '\$',
+                                          pexpect.EOF,
+                                          pexpect.TIMEOUT ],
+                                        120 )
+            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 MN took too long... " )
+
+            main.log.info( self.name + ": building fresh mininet" )
+            # for reactive/PARP enabled tests
+            cmdString = "sudo mn " + self.options[ 'arg1' ] +\
+                    " " + self.options[ 'arg2' ] +\
+                    " --mac --controller " +\
+                    self.options[ 'controller' ] + " " +\
+                    self.options[ 'arg3' ]
+
+            argList = self.options[ 'arg1' ].split( "," )
             global topoArgList
-            topoArgList = argList[0].split(" ")
-            argList = map(int, argList[1:])
-            topoArgList = topoArgList[1:] + argList
-            
-          #### for proactive flow with static ARP entries
-            #cmdString = "sudo mn " + self.options['arg1'] + " " + self.options['arg2'] +  " --mac --arp --controller " + self.options['controller'] + " " + self.options['arg3']
-            self.handle.sendline(cmdString)
-            self.handle.expect(["sudo mn",pexpect.EOF,pexpect.TIMEOUT])
-            while 1: 
-                i=self.handle.expect(['mininet>','\*\*\*','Exception',pexpect.EOF,pexpect.TIMEOUT],300)
-                if i==0:
-                    main.log.info(self.name+": mininet built") 
+            topoArgList = argList[ 0 ].split( " " )
+            argList = map( int, argList[ 1: ] )
+            topoArgList = topoArgList[ 1: ] + argList
+
+            self.handle.sendline( cmdString )
+            self.handle.expect( [ "sudo mn", pexpect.EOF, pexpect.TIMEOUT ] )
+            while True:
+                i = self.handle.expect( [ 'mininet>',
+                                          '\*\*\*',
+                                          'Exception',
+                                          pexpect.EOF,
+                                          pexpect.TIMEOUT ],
+                                        300 )
+                if i == 0:
+                    main.log.info( self.name + ": mininet built" )
                     return main.TRUE
-                if i==1:
-                    self.handle.expect(["\n",pexpect.EOF,pexpect.TIMEOUT])
-                    main.log.info(self.handle.before)
-                elif i==2:
-                    main.log.error(self.name+": Launching mininet failed...")
+                if i == 1:
+                    self.handle.expect(
+                        [ "\n", pexpect.EOF, pexpect.TIMEOUT ] )
+                    main.log.info( self.handle.before )
+                elif i == 2:
+                    main.log.error(
+                        self.name +
+                        ": Launching mininet failed..." )
                     return main.FALSE
-                elif i==3:
-                    main.log.error(self.name+": Connection timeout")
+                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... " )
+                elif i == 4:  # timeout
+                    main.log.error(
+                        self.name +
+                        ": Something took too long... " )
                     return main.FALSE
-            #if utilities.assert_matches(expect=patterns,actual=resultCommand,onpass="Network is being launched",onfail="Network launching is being failed "):
             return main.TRUE
-        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")
+        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
-                    
-    def num_switches_n_links(self,topoType,depth,fanout):
+
+    def num_switches_n_links( self, topoType, depth, fanout ):
         if topoType == 'tree':
-            if fanout is None:     #In tree topology, if fanout arg is not given, by default it is 2
+            # 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
+            while( k <= depth - 1 ):
+                count = count + pow( fanout, k )
+                k = k + 1
                 num_switches = 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
+            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
             num_links = count * fanout
-            #print "num_switches for %s(%d,%d) = %d and links=%d" %(topoType,depth,fanout,num_switches,num_links)
-        
-        elif topoType =='linear':
-            if fanout is None:     #In linear topology, if fanout or num_hosts_per_sw is not given, by default it is 1
+            # print "num_switches for %s(%d,%d) = %d and links=%d" %(
+            # topoType,depth,fanout,num_switches,num_links )
+
+        elif topoType == 'linear':
+            # In linear topology, if fanout or num_hosts_per_sw is not given,
+            # by default it is 1
+            if fanout is None:
                 fanout = 1
             num_switches = depth
             num_hosts_per_sw = fanout
             total_num_hosts = num_switches * num_hosts_per_sw
-            num_links = total_num_hosts + (num_switches - 1)
-            print "num_switches for %s(%d,%d) = %d and links=%d" %(topoType,depth,fanout,num_switches,num_links) 
+            num_links = total_num_hosts + ( num_switches - 1 )
+            print "num_switches for %s(%d,%d) = %d and links=%d" %\
+                    ( topoType, depth, fanout, num_switches, num_links )
         topoDict = {}
-        topoDict = {"num_switches":int(num_switches), "num_corelinks":int(num_links)}
+        topoDict = {
+            "num_switches": int( num_switches ),
+            "num_corelinks": int( num_links ) }
         return topoDict
 
-
-    def calculate_sw_and_links(self):
-        topoDict = self.num_switches_n_links(*topoArgList)
+    def calculate_sw_and_links( self ):
+        topoDict = self.num_switches_n_links( *topoArgList )
         return topoDict
 
-    def pingall(self):
-        '''
-        Verifies the reachability of the hosts using pingall command.
-        '''
-        if self.handle :
-            main.log.info(self.name+": Checking reachabilty to the hosts using pingall")
+    def pingall( self, timeout=300 ):
+        """
+           Verifies the reachability of the hosts using pingall command.
+           Optional parameter timeout allows you to specify how long to
+           wait for pingall to complete
+           Returns:
+           main.TRUE if pingall completes with no pings dropped
+           otherwise main.FALSE"""
+        if self.handle:
+            main.log.info(
+                self.name +
+                ": Checking reachabilty to the hosts using pingall" )
             try:
-                response = self.execute(cmd="pingall",prompt="mininet>",timeout=120)
-                print "response: " + str(response)
-            except pexpect.EOF:  
-                main.log.error(self.name + ": EOF exception found")
-                main.log.error(self.name + ":     " + self.handle.before)
+                response = self.execute(
+                    cmd="pingall",
+                    prompt="mininet>",
+                    timeout=int( timeout ) )
+            except pexpect.EOF:
+                main.log.error( self.name + ": EOF exception found" )
+                main.log.error( self.name + ":     " + self.handle.before )
                 main.cleanup()
                 main.exit()
-            pattern = 'Results\:\s0\%\sdropped\s'
-            #FIXME:Pending Mininet Pull Request #408
-            #pattern = 'Results\:\s0\.00\%\sdropped\s'
-            #if utilities.assert_matches(expect=pattern,actual=response,onpass="All hosts are reaching",onfail="Unable to reach all the hosts"):
-            if re.search(pattern,response):
-                main.log.info(self.name+": All hosts are reachable")
+            except pexpect.TIMEOUT:
+                # We may not want to kill the test if pexpect times out
+                main.log.error( self.name + ": TIMEOUT exception found" )
+                main.log.error( self.name +
+                                ":     " +
+                                str( self.handle.before ) )
+            # NOTE: mininet's pingall rounds, so we will check the number of
+            # passed and number of failed
+            pattern = "Results\:\s0\%\sdropped\s\(" +\
+                    "(?P<passed>[\d]+)/(?P=passed)"
+            if re.search( pattern, response ):
+                main.log.info( self.name + ": All hosts are reachable" )
                 return main.TRUE
             else:
-                main.log.error(self.name+": Unable to reach all the hosts")
+                main.log.error( self.name + ": Unable to reach all the hosts" )
+                main.log.info( "Pingall ouput: " + str( response ) )
+                # NOTE: Send ctrl-c to make sure pingall is done
+                self.handle.send( "\x03" )
+                self.handle.expect( "Interrupt" )
+                self.handle.expect( "mininet>" )
                 return main.FALSE
-        else :
-            main.log.error(self.name+": Connection failed to the host") 
-            return main.FALSE
-
-    def fpingHost(self,**pingParams):
-        ''' 
-        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") 
-            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
-        
-    def pingHost(self,**pingParams):
-        '''
-        Ping from one mininet host to another
-        Currently the only supported Params: SRC and TARGET
-        '''
-        args = utilities.parse_args(["SRC","TARGET"],**pingParams)
-        #command = args["SRC"] + " ping -" + args["CONTROLLER"] + " " +args ["TARGET"]
-        command = args["SRC"] + " ping "+args ["TARGET"]+" -c 1 -i 1 -W 8"
-        try:
-            main.log.warn("Sending: " + command)
-            #response = self.execute(cmd=command,prompt="mininet",timeout=10 )
-            self.handle.sendline(command)
-            i = self.handle.expect([command,pexpect.TIMEOUT])
-            if i == 1:
-                main.log.error(self.name + ": timeout when waiting for response from mininet")
-                main.log.error("response: " + str(self.handle.before))
-            i = self.handle.expect(["mininet>",pexpect.TIMEOUT])
-            if i == 1:
-                main.log.error(self.name + ": timeout when waiting for response from mininet")
-                main.log.error("response: " + str(self.handle.before))
-            response = self.handle.before
-        except pexpect.EOF:  
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
+        else:
+            main.log.error( self.name + ": Connection failed to the host" )
             main.cleanup()
             main.exit()
-        main.log.info(self.name+": Ping Response: "+ response )
-        #if utilities.assert_matches(expect=',\s0\%\spacket\sloss',actual=response,onpass="No Packet loss",onfail="Host is not reachable"):
-        if re.search(',\s0\%\spacket\sloss',response):
-            main.log.info(self.name+": no packets lost, host is reachable")
-            main.last_result = main.TRUE 
+
+    def fpingHost( self, **pingParams ):
+        """
+           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" )
+            return main.FALSE
+        elif re.search( ":\s\d{1,2}\.\d\d", response ):
+            main.log.info( self.name + ": Ping good!" )
             return main.TRUE
-        else :
-            main.log.error(self.name+": PACKET LOST, HOST IS NOT REACHABLE")
+        main.log.info( self.name + ": Install fping on mininet machine... " )
+        main.log.info( self.name + ": \n---\n" + response )
+        return main.FALSE
+
+    def pingHost( self, **pingParams ):
+        """
+           Ping from one mininet host to another
+           Currently the only supported Params: SRC and TARGET"""
+        args = utilities.parse_args( [ "SRC", "TARGET" ], **pingParams )
+        command = args[ "SRC" ] + " ping " + \
+            args[ "TARGET" ] + " -c 1 -i 1 -W 8"
+        try:
+            main.log.warn( "Sending: " + command )
+            self.handle.sendline( command )
+            i = self.handle.expect( [ command, pexpect.TIMEOUT ] )
+            if i == 1:
+                main.log.error(
+                    self.name +
+                    ": timeout when waiting for response from mininet" )
+                main.log.error( "response: " + str( self.handle.before ) )
+            i = self.handle.expect( [ "mininet>", pexpect.TIMEOUT ] )
+            if i == 1:
+                main.log.error(
+                    self.name +
+                    ": timeout when waiting for response from mininet" )
+                main.log.error( "response: " + str( self.handle.before ) )
+            response = self.handle.before
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            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" )
+            main.last_result = main.TRUE
+            return main.TRUE
+        else:
+            main.log.error(
+                self.name +
+                ": PACKET LOST, HOST IS NOT REACHABLE" )
             main.last_result = main.FALSE
             return main.FALSE
-    
-    def checkIP(self,host):
-        '''
-        Verifies the host's ip configured or not.
-        '''
-        if self.handle :
+
+    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)
+                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 utilities.assert_matches(expect=pattern,actual=response,onpass="Host Ip configured properly",onfail="Host IP not found") :
-            if re.search(pattern,response):
-                main.log.info(self.name+": Host Ip configured properly")
+            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")
+                main.log.error( self.name + ": Host IP not found" )
                 return main.FALSE
-        else :
-            main.log.error(self.name+": Connection failed to the host") 
-            
-    def verifySSH(self,**connectargs):
+        else:
+            main.log.error( self.name + ": Connection failed to the host" )
+
+    def verifySSH( self, **connectargs ):
         try:
-            response = self.execute(cmd="h1 /usr/sbin/sshd -D&",prompt="mininet>",timeout=10)
-            response = self.execute(cmd="h4 /usr/sbin/sshd -D&",prompt="mininet>",timeout=10)
+            response = self.execute(
+                cmd="h1 /usr/sbin/sshd -D&",
+                prompt="mininet>",
+                timeout=10 )
+            response = self.execute(
+                cmd="h4 /usr/sbin/sshd -D&",
+                prompt="mininet>",
+                timeout=10 )
             for key in connectargs:
-                vars(self)[key] = connectargs[key]
-            response = self.execute(cmd="xterm h1 h4 ",prompt="mininet>",timeout=10)
-        except pexpect.EOF:  
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
+                vars( self )[ key ] = connectargs[ key ]
+            response = self.execute(
+                cmd="xterm h1 h4 ",
+                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()
         import time
-        time.sleep(20)
+        time.sleep( 20 )
         if self.flag == 0:
             self.flag = 1
             return main.FALSE
-        else :
+        else:
             return main.TRUE
-    
-    def getMacAddress(self,host):
-        '''
-        Verifies the host's ip configured or not.
-        '''
-        if self.handle :
+
+    def changeIP( self, host, intf, newIP, newNetmask ):
+        """
+           Changes the ip address of a host on the fly
+           Ex: h2 ifconfig h2-eth0 10.0.1.2 netmask 255.255.255.0"""
+        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 = r'HWaddr\s([0-9A-F]{2}[:-]){5}([0-9A-F]{2})'
-            mac_address_search = re.search(pattern, response, re.I)
-            mac_address = mac_address_search.group().split(" ")[1]
-            main.log.info(self.name+": Mac-Address of Host "+ host + " is " + mac_address)
-            return mac_address
-        else :
-            main.log.error(self.name+": Connection failed to the host") 
-
-    def getInterfaceMACAddress(self,host, interface):
-        '''
-            Return the IP address of the interface on the given host
-        '''
-        if self.handle :
-            try:
-                response = self.execute(cmd=host+" ifconfig " + interface,
-                                    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 = r'HWaddr\s([0-9A-F]{2}[:-]){5}([0-9A-F]{2})'
-            mac_address_search = re.search(pattern, response, re.I)
-            if mac_address_search is None:
-                main.log.info("No mac address found in %s" % response)
+                cmd = host + " ifconfig " + intf + " " + \
+                    newIP + " " + 'netmask' + " " + newNetmask
+                self.handle.sendline( cmd )
+                self.handle.expect( "mininet>" )
+                response = self.handle.before
+                main.log.info( "response = " + response )
+                main.log.info(
+                    "Ip of host " +
+                    host +
+                    " changed to new IP " +
+                    newIP )
+                return main.TRUE
+            except pexpect.EOF:
+                main.log.error( self.name + ": EOF exception found" )
+                main.log.error( self.name + ":     " + self.handle.before )
                 return main.FALSE
-            mac_address = mac_address_search.group().split(" ")[1]
-            main.log.info("Mac-Address of "+ host + ":"+ interface + " is " + mac_address)
+
+    def changeDefaultGateway( self, host, newGW ):
+        """
+           Changes the default gateway of a host
+           Ex: h1 route add default gw 10.0.1.2"""
+        if self.handle:
+            try:
+                cmd = host + " route add default gw " + newGW
+                self.handle.sendline( cmd )
+                self.handle.expect( "mininet>" )
+                response = self.handle.before
+                main.log.info( "response = " + response )
+                main.log.info(
+                    "Default gateway of host " +
+                    host +
+                    " changed to " +
+                    newGW )
+                return main.TRUE
+            except pexpect.EOF:
+                main.log.error( self.name + ": EOF exception found" )
+                main.log.error( self.name + ":     " + self.handle.before )
+                return main.FALSE
+
+    def addStaticMACAddress( self, host, GW, macaddr ):
+        """
+           Changes the mac address of a geateway host"""
+        if self.handle:
+            try:
+                # h1  arp -s 10.0.1.254 00:00:00:00:11:11
+                cmd = host + " arp -s " + GW + " " + macaddr
+                self.handle.sendline( cmd )
+                self.handle.expect( "mininet>" )
+                response = self.handle.before
+                main.log.info( "response = " + response )
+                main.log.info(
+                    "Mac adrress of gateway " +
+                    GW +
+                    " changed to " +
+                    macaddr )
+                return main.TRUE
+            except pexpect.EOF:
+                main.log.error( self.name + ": EOF exception found" )
+                main.log.error( self.name + ":     " + self.handle.before )
+                return main.FALSE
+
+    def verifyStaticGWandMAC( self, host ):
+        """
+           Verify if the static gateway and mac address assignment"""
+        if self.handle:
+            try:
+                # h1  arp -an
+                cmd = host + " arp -an "
+                self.handle.sendline( cmd )
+                self.handle.expect( "mininet>" )
+                response = self.handle.before
+                main.log.info( host + " arp -an = " + response )
+                return main.TRUE
+            except pexpect.EOF:
+                main.log.error( self.name + ": EOF exception found" )
+                main.log.error( self.name + ":     " + self.handle.before )
+                return main.FALSE
+
+    def getMacAddress( 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()
+
+            pattern = r'HWaddr\s([0-9A-F]{2}[:-]){5}([0-9A-F]{2})'
+            mac_address_search = re.search( pattern, response, re.I )
+            mac_address = mac_address_search.group().split( " " )[ 1 ]
+            main.log.info(
+                self.name +
+                ": Mac-Address of Host " +
+                host +
+                " is " +
+                mac_address )
             return mac_address
         else:
-            main.log.error("Connection failed to the host")
+            main.log.error( self.name + ": Connection failed to the host" )
 
-    def getIPAddress(self,host):
-        '''
-        Verifies the host's ip configured or not.
-        '''
-        if self.handle :
+    def getInterfaceMACAddress( self, host, interface ):
+        """
+           Return the IP address of the interface on the given host"""
+        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)
+                response = self.execute( cmd=host + " ifconfig " + interface,
+                                         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 = r'HWaddr\s([0-9A-F]{2}[:-]){5}([0-9A-F]{2})'
+            mac_address_search = re.search( pattern, response, re.I )
+            if mac_address_search is None:
+                main.log.info( "No mac address found in %s" % response )
+                return main.FALSE
+            mac_address = mac_address_search.group().split( " " )[ 1 ]
+            main.log.info(
+                "Mac-Address of " +
+                host +
+                ":" +
+                interface +
+                " is " +
+                mac_address )
+            return mac_address
+        else:
+            main.log.error( "Connection failed to the host" )
+
+    def getIPAddress( 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()
 
             pattern = "inet\saddr:(\d+\.\d+\.\d+\.\d+)"
-            ip_address_search = re.search(pattern, response)
-            main.log.info(self.name+": IP-Address of Host "+host +" is "+ip_address_search.group(1))
-            return ip_address_search.group(1)
-        else :
-            main.log.error(self.name+": Connection failed to the host") 
-        
-    def getSwitchDPID(self,switch):
-        '''
-            return the datapath ID of the switch
-        '''
-        if self.handle :
+            ip_address_search = re.search( pattern, response )
+            main.log.info(
+                self.name +
+                ": IP-Address of Host " +
+                host +
+                " is " +
+                ip_address_search.group( 1 ) )
+            return ip_address_search.group( 1 )
+        else:
+            main.log.error( self.name + ": Connection failed to the host" )
+
+    def getSwitchDPID( self, switch ):
+        """
+           return the datapath ID of the switch"""
+        if self.handle:
             cmd = "py %s.dpid" % switch
             try:
-                response = self.execute(cmd=cmd,prompt="mininet>",timeout=10)
-            except pexpect.EOF:  
-                main.log.error(self.name + ": EOF exception found")
-                main.log.error(self.name + ":     " + self.handle.before)
+                response = self.execute(
+                    cmd=cmd,
+                    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 = r'^(?P<dpid>\d)+'
-            result = re.search(pattern, response, re.MULTILINE)
+            pattern = r'^(?P<dpid>\w)+'
+            result = re.search( pattern, response, re.MULTILINE )
             if result is None:
-                main.log.info("Couldn't find DPID for switch '', found: %s" % (switch, response))
+                main.log.info(
+                    "Couldn't find DPID for switch %s, found: %s" %
+                    ( switch, response ) )
                 return main.FALSE
-            return str(result.group(0))
+            return str( result.group( 0 ) ).lower()
         else:
-            main.log.error("Connection failed to the host")
+            main.log.error( "Connection failed to the host" )
 
-    def getDPID(self, switch):
+    def getDPID( self, switch ):
         if self.handle:
-            self.handle.sendline("")
-            self.expect("mininet>")
-            cmd = "py %s.dpid" %switch
+            self.handle.sendline( "" )
+            self.expect( "mininet>" )
+            cmd = "py %s.dpid" % switch
             try:
-                response = self.execute(cmd=cmd,prompt="mininet>",timeout=10)
-                self.handle.expect("mininet>")
+                response = self.execute(
+                    cmd=cmd,
+                    prompt="mininet>",
+                    timeout=10 )
+                self.handle.expect( "mininet>" )
                 response = self.handle.before
                 return response
             except pexpect.EOF:
-                main.log.error(self.name + ": EOF exception found")
-                main.log.error(self.name + ":     " + self.handle.before)
+                main.log.error( self.name + ": EOF exception found" )
+                main.log.error( self.name + ":     " + self.handle.before )
                 main.cleanup()
                 main.exit()
 
-
-    def getInterfaces(self, node):
-        '''
-            return information dict about interfaces connected to the node
-        '''
-        if self.handle :
-            cmd = 'py "\\n".join(["name=%s,mac=%s,ip=%s,enabled=%s" % (i.name, i.MAC(), i.IP(), i.isUp())'
+    def getInterfaces( self, node ):
+        """
+           return information dict about interfaces connected to the node"""
+        if self.handle:
+            cmd = 'py "\\n".join(["name=%s,mac=%s,ip=%s,enabled=%s"' +\
+                    ' % (i.name, i.MAC(), i.IP(), i.isUp())'
             cmd += ' for i in %s.intfs.values()])' % node
             try:
-                response = self.execute(cmd=cmd,prompt="mininet>",timeout=10)
-            except pexpect.EOF:  
-                main.log.error(self.name + ": EOF exception found")
-                main.log.error(self.name + ":     " + self.handle.before)
+                response = self.execute(
+                    cmd=cmd,
+                    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()
             return response
         else:
-            main.log.error("Connection failed to the node")
+            main.log.error( "Connection failed to the node" )
 
-    def dump(self):
-        main.log.info(self.name+": Dump node info")
+    def dump( self ):
+        main.log.info( self.name + ": Dump node info" )
         try:
-            response = self.execute(cmd = 'dump',prompt = 'mininet>',timeout = 10)
-        except pexpect.EOF:  
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
+            response = self.execute(
+                cmd='dump',
+                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()
         return response
-            
-    def intfs(self):
-        main.log.info(self.name+": List interfaces")
+
+    def intfs( self ):
+        main.log.info( self.name + ": List interfaces" )
         try:
-            response = self.execute(cmd = 'intfs',prompt = 'mininet>',timeout = 10)
-        except pexpect.EOF:  
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
+            response = self.execute(
+                cmd='intfs',
+                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()
         return response
-    
-    def net(self):
-        main.log.info(self.name+": List network connections")
+
+    def net( self ):
+        main.log.info( self.name + ": List network connections" )
         try:
-            response = self.execute(cmd = 'net',prompt = 'mininet>',timeout = 10)
-        except pexpect.EOF:  
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
+            response = self.execute( cmd='net', 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()
         return response
-    
-    def iperf(self):
-        main.log.info(self.name+": Simple iperf TCP test between two (optionally specified) hosts")
-        try:
-            response = self.execute(cmd = 'iperf',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()
-        return response
-    
-    def iperfudp(self):
-        main.log.info(self.name+": Simple iperf TCP test between two (optionally specified) hosts")
-        try:
-            response = self.execute(cmd = 'iperfudp',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()
-        return response
-    
-    def nodes(self):
-        main.log.info(self.name+": List all nodes.")
-        try:
-            response = self.execute(cmd = 'nodes',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()
-        return response
-    
-    def pingpair(self):
-        main.log.info(self.name+": Ping between first two hosts")
-        try:
-            response = self.execute(cmd = 'pingpair',prompt = 'mininet>',timeout = 20)
-        except pexpect.EOF:  
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        
-        #if utilities.assert_matches(expect='0% packet loss',actual=response,onpass="No Packet loss",onfail="Hosts not reachable"):
-        if re.search(',\s0\%\spacket\sloss',response):
-            main.log.info(self.name+": Ping between two hosts SUCCESSFUL")
-            main.last_result = main.TRUE 
-            return main.TRUE
-        else :
-            main.log.error(self.name+": PACKET LOST, HOSTS NOT REACHABLE")
-            main.last_result = main.FALSE
-            return main.FALSE
-    
-    def link(self,**linkargs):
-        '''
-        Bring link(s) between two nodes up or down
-        '''
-        args = utilities.parse_args(["END1","END2","OPTION"],**linkargs)
-        end1 = args["END1"] if args["END1"] != None else ""
-        end2 = args["END2"] if args["END2"] != None else ""
-        option = args["OPTION"] if args["OPTION"] != None else ""
-        main.log.info("Bring link between '"+ end1 +"' and '" + end2 + "' '" + option + "'")
-        command = "link "+str(end1) + " " + str(end2)+ " " + str(option)
-        try:
-            #response = self.execute(cmd=command,prompt="mininet>",timeout=10)
-            self.handle.sendline(command)
-            self.handle.expect("mininet>")    
-        except pexpect.EOF:  
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
-            main.cleanup()
-            main.exit()
-        return main.TRUE
-        
 
-    def yank(self,**yankargs):
-	'''
-	yank a mininet switch interface to a host
-	'''
-	main.log.info('Yank the switch interface attached to a host')
-	args = utilities.parse_args(["SW","INTF"],**yankargs)
-	sw = args["SW"] if args["SW"] !=None else ""
-	intf = args["INTF"] if args["INTF"] != None else ""
-	command = "py "+ str(sw) + '.detach("' + str(intf) + '")'
+    def iperf( self, host1, host2 ):
+        main.log.info(
+            self.name +
+            ": Simple iperf TCP test between two hosts" )
         try:
-            response = self.execute(cmd=command,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()
-	return main.TRUE
-
-    def plug(self, **plugargs):
-        '''
-        plug the yanked mininet switch interface to a switch
-        '''
-        main.log.info('Plug the switch interface attached to a switch')
-        args = utilities.parse_args(["SW","INTF"],**plugargs)
-        sw = args["SW"] if args["SW"] !=None else ""
-        intf = args["INTF"] if args["INTF"] != None else ""
-        command = "py "+ str(sw) + '.attach("' + str(intf) + '")'
-        try:
-            response = self.execute(cmd=command,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()
-        return main.TRUE
-
-
-
-    def dpctl(self,**dpctlargs):
-        '''
-        Run dpctl command on all switches.
-        '''
-        main.log.info('Run dpctl command on all switches')
-        args = utilities.parse_args(["CMD","ARGS"],**dpctlargs)
-        cmd = args["CMD"] if args["CMD"] != None else ""
-        cmdargs = args["ARGS"] if args["ARGS"] != None else ""
-        command = "dpctl "+cmd + " " + str(cmdargs)
-        try:
-            response = self.execute(cmd=command,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()
-        return main.TRUE
-   
-        
-    def get_version(self):
-        file_input = path+'/lib/Mininet/INSTALL'
-        version = super(Mininet, self).get_version()
-        pattern = 'Mininet\s\w\.\w\.\w\w*'
-        for line in open(file_input,'r').readlines():
-            result = re.match(pattern, line)
-            if result:
-                version = result.group(0)
-        return version 
-
-    def get_sw_controller_sanity(self, sw):
-        command = "sh ovs-vsctl get-controller "+str(sw)
-        try:
-            response = self.execute(cmd=command,prompt="mininet>",timeout=10)
-            if response:
+            cmd1 = 'iperf ' + host1 + " " + host2
+            self.handle.sendline( cmd1 )
+            self.handle.expect( "mininet>" )
+            response = self.handle.before
+            if re.search( 'Results:', response ):
+                main.log.info( self.name + ": iperf test succssful" )
                 return main.TRUE
             else:
+                main.log.error( self.name + ": iperf test failed" )
                 return main.FALSE
         except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
-        else:
-            main.log.info(response)
 
-    def get_sw_controller(self,sw):
-        command = "sh ovs-vsctl get-controller "+str(sw)
+    def iperfudp( self ):
+        main.log.info(
+            self.name +
+            ": Simple iperf TCP test between two " +
+            "(optionally specified) hosts" )
         try:
-            response = self.execute(cmd=command,prompt="mininet>",timeout=10)
-            print(response)
+            response = self.execute(
+                cmd='iperfudp',
+                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()
+        return response
+
+    def nodes( self ):
+        main.log.info( self.name + ": List all nodes." )
+        try:
+            response = self.execute(
+                cmd='nodes',
+                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()
+        return response
+
+    def pingpair( self ):
+        main.log.info( self.name + ": Ping between first two hosts" )
+        try:
+            response = self.execute(
+                cmd='pingpair',
+                prompt='mininet>',
+                timeout=20 )
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+
+        if re.search( ',\s0\%\spacket\sloss', response ):
+            main.log.info( self.name + ": Ping between two hosts SUCCESSFUL" )
+            main.last_result = main.TRUE
+            return main.TRUE
+        else:
+            main.log.error( self.name + ": PACKET LOST, HOSTS NOT REACHABLE" )
+            main.last_result = main.FALSE
+            return main.FALSE
+
+    def link( self, **linkargs ):
+        """
+           Bring link( s ) between two nodes up or down"""
+        args = utilities.parse_args( [ "END1", "END2", "OPTION" ], **linkargs )
+        end1 = args[ "END1" ] if args[ "END1" ] is not None else ""
+        end2 = args[ "END2" ] if args[ "END2" ] is not None else ""
+        option = args[ "OPTION" ] if args[ "OPTION" ] is not None else ""
+        main.log.info(
+            "Bring link between '" +
+            end1 +
+            "' and '" +
+            end2 +
+            "' '" +
+            option +
+            "'" )
+        command = "link " + \
+            str( end1 ) + " " + str( end2 ) + " " + str( option )
+        try:
+            self.handle.sendline( command )
+            self.handle.expect( "mininet>" )
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
+            main.cleanup()
+            main.exit()
+        return main.TRUE
+
+    def yank( self, **yankargs ):
+        """
+           yank a mininet switch interface to a host"""
+        main.log.info( 'Yank the switch interface attached to a host' )
+        args = utilities.parse_args( [ "SW", "INTF" ], **yankargs )
+        sw = args[ "SW" ] if args[ "SW" ] is not None else ""
+        intf = args[ "INTF" ] if args[ "INTF" ] is not None else ""
+        command = "py " + str( sw ) + '.detach("' + str(intf) + '")'
+        try:
+            response = self.execute(
+                cmd=command,
+                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()
+        return main.TRUE
+
+    def plug( self, **plugargs ):
+        """
+           plug the yanked mininet switch interface to a switch"""
+        main.log.info( 'Plug the switch interface attached to a switch' )
+        args = utilities.parse_args( [ "SW", "INTF" ], **plugargs )
+        sw = args[ "SW" ] if args[ "SW" ] is not None else ""
+        intf = args[ "INTF" ] if args[ "INTF" ] is not None else ""
+        command = "py " + str( sw ) + '.attach("' + str(intf) + '")'
+        try:
+            response = self.execute(
+                cmd=command,
+                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()
+        return main.TRUE
+
+    def dpctl( self, **dpctlargs ):
+        """
+           Run dpctl command on all switches."""
+        main.log.info( 'Run dpctl command on all switches' )
+        args = utilities.parse_args( [ "CMD", "ARGS" ], **dpctlargs )
+        cmd = args[ "CMD" ] if args[ "CMD" ] is not None else ""
+        cmdargs = args[ "ARGS" ] if args[ "ARGS" ] is not None else ""
+        command = "dpctl " + cmd + " " + str( cmdargs )
+        try:
+            response = self.execute(
+                cmd=command,
+                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()
+        return main.TRUE
+
+    def get_version( self ):
+        file_input = path + '/lib/Mininet/INSTALL'
+        version = super( Mininet, self ).get_version()
+        pattern = 'Mininet\s\w\.\w\.\w\w*'
+        for line in open( file_input, 'r' ).readlines():
+            result = re.match( pattern, line )
+            if result:
+                version = result.group( 0 )
+        return version
+
+    def get_sw_controller( self, sw ):
+        """
+        Parameters:
+            sw: The name of an OVS switch. Example "s1"
+        Return:
+            The output of the command from the mininet cli
+            or main.FALSE on timeout"""
+        command = "sh ovs-vsctl get-controller " + str( sw )
+        try:
+            response = self.execute(
+                cmd=command,
+                prompt="mininet>",
+                timeout=10 )
             if response:
-                print("**********************")
                 return response
             else:
                 return main.FALSE
-        except pexpect.EOF:  
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
+        except pexpect.EOF:
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
-        else:
-            main.log.info(response)
 
-    def assign_sw_controller(self,**kwargs):
-        '''
-        count is only needed if there is more than 1 controller
-        '''
-        args = utilities.parse_args(["COUNT"],**kwargs)
-        count = args["COUNT"] if args!={} else 1
+    def assign_sw_controller( self, **kwargs ):
+        """
+           count is only needed if there is more than 1 controller"""
+        args = utilities.parse_args( [ "COUNT" ], **kwargs )
+        count = args[ "COUNT" ] if args != {} else 1
 
         argstring = "SW"
-        for j in range(count):
-            argstring = argstring + ",IP" + str(j+1) + ",PORT" + str(j+1)
-        args = utilities.parse_args(argstring.split(","),**kwargs)
+        for j in range( count ):
+            argstring = argstring + ",IP" + \
+                str( j + 1 ) + ",PORT" + str( j + 1 )
+        args = utilities.parse_args( argstring.split( "," ), **kwargs )
 
-        sw = args["SW"] if args["SW"] != None else ""
-        ptcpA = int(args["PORT1"])+int(sw) if args["PORT1"] != None else ""
-        ptcpB = "ptcp:"+str(ptcpA) if ptcpA != "" else ""
-        
-        command = "sh ovs-vsctl set-controller s" + str(sw) + " " + ptcpB + " "
-        for j in range(count):
-            i=j+1
-            args = utilities.parse_args(["IP"+str(i),"PORT"+str(i)],**kwargs)
-            ip = args["IP"+str(i)] if args["IP"+str(i)] != None else ""
-            port = args["PORT" + str(i)] if args["PORT" + str(i)] != None else ""
-            tcp = "tcp:" + str(ip) + ":" + str(port) + " " if ip != "" else ""
+        sw = args[ "SW" ] if args[ "SW" ] is not None else ""
+        ptcpA = int( args[ "PORT1" ] ) + \
+                    int( sw ) if args[ "PORT1" ] is not None else ""
+        ptcpB = "ptcp:" + str( ptcpA ) if ptcpA != "" else ""
+
+        command = "sh ovs-vsctl set-controller s" + \
+            str( sw ) + " " + ptcpB + " "
+        for j in range( count ):
+            i = j + 1
+            args = utilities.parse_args(
+                [ "IP" + str( i ), "PORT" + str( i ) ], **kwargs )
+            ip = args[
+                "IP" +
+                str( i ) ] if args[
+                "IP" +
+                str( i ) ] is not None else ""
+            port = args[
+                "PORT" +
+                str( i ) ] if args[
+                "PORT" +
+                str( i ) ] is not None else ""
+            tcp = "tcp:" + str( ip ) + ":" + str( port ) + \
+                               " " if ip != "" else ""
             command = command + tcp
         try:
-            self.execute(cmd=command,prompt="mininet>",timeout=5)
+            self.execute( cmd=command, prompt="mininet>", timeout=5 )
         except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
         except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.log.info( self.name + ":" * 50 )
             main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.log.info(":" * 50 )
             main.cleanup()
             main.exit()
 
-    def delete_sw_controller(self,sw):
-        '''
-        Removes the controller target from sw
-        '''
-
-        command = "sh ovs-vsctl del-controller "+str(sw)
+    def delete_sw_controller( self, sw ):
+        """
+           Removes the controller target from sw"""
+        command = "sh ovs-vsctl del-controller " + str( sw )
         try:
-            response = self.execute(cmd=command,prompt="mininet>",timeout=10)
-        except pexpect.EOF:  
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
+            response = self.execute(
+                cmd=command,
+                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()
         else:
-            main.log.info(response)
+            main.log.info( response )
 
+    def add_switch( self, sw, **kwargs ):
+        """
+        adds a switch to the mininet topology
+        NOTE: this uses a custom mn function
+        NOTE: cannot currently specify what type of switch
+        required params:
+            switchname = name of the new switch as a string
+        optional keyvalues:
+            dpid = "dpid"
+        returns: main.FASLE on an error, else main.TRUE
+        """
+        dpid = kwargs.get( 'dpid', '' )
+        command = "addswitch " + str( sw ) + " " + str( dpid )
+        try:
+            response = self.execute(
+                cmd=command,
+                prompt="mininet>",
+                timeout=10 )
+            if re.search( "already exists!", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "Error", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "usage:", response ):
+                main.log.warn( response )
+                return main.FALSE
+            else:
+                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()
 
-    def disconnect(self):
-        main.log.info(self.name+": Disconnecting mininet...")
+    def del_switch( self, sw ):
+        """
+           delete a switch from the mininet topology
+           NOTE: this uses a custom mn function
+           required params:
+            switchname = name of the switch as a string
+           returns: main.FASLE on an error, else main.TRUE"""
+        command = "delswitch " + str( sw )
+        try:
+            response = self.execute(
+                cmd=command,
+                prompt="mininet>",
+                timeout=10 )
+            if re.search( "no switch named", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "Error", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "usage:", response ):
+                main.log.warn( response )
+                return main.FALSE
+            else:
+                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()
+
+    def add_link( self, node1, node2 ):
+        """
+           add a link to the mininet topology
+           NOTE: this uses a custom mn function
+           NOTE: cannot currently specify what type of link
+           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.FASLE on an error, else main.TRUE"""
+        command = "addlink " + str( node1 ) + " " + str( node2 )
+        try:
+            response = self.execute(
+                cmd=command,
+                prompt="mininet>",
+                timeout=10 )
+            if re.search( "doesnt exist!", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "Error", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "usage:", response ):
+                main.log.warn( response )
+                return main.FALSE
+            else:
+                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()
+
+    def del_link( self, node1, node2 ):
+        """
+           delete a link from the mininet topology
+           NOTE: this uses a custom mn function
+           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.FASLE on an error, else main.TRUE"""
+        command = "dellink " + str( node1 ) + " " + str( node2 )
+        try:
+            response = self.execute(
+                cmd=command,
+                prompt="mininet>",
+                timeout=10 )
+            if re.search( "no node named", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "Error", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "usage:", response ):
+                main.log.warn( response )
+                return main.FALSE
+            else:
+                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()
+
+    def add_host( self, hostname, **kwargs ):
+        """
+        Add a host to the mininet topology
+        NOTE: this uses a custom mn function
+        NOTE: cannot currently specify what type of host
+        required params:
+            hostname = the string hostname
+        optional key-value params
+            switch = "switch name"
+            returns: main.FASLE on an error, else main.TRUE
+        """
+        switch = kwargs.get( 'switch', '' )
+        command = "addhost " + str( hostname ) + " " + str( switch )
+        try:
+            response = self.execute(
+                cmd=command,
+                prompt="mininet>",
+                timeout=10 )
+            if re.search( "already exists!", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "doesnt exists!", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "Error", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "usage:", response ):
+                main.log.warn( response )
+                return main.FALSE
+            else:
+                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()
+
+    def del_host( self, hostname ):
+        """
+           delete a host from the mininet topology
+           NOTE: this uses a custom mn function
+           required params:
+           hostname = the string hostname
+           returns: main.FASLE on an error, else main.TRUE"""
+        command = "delhost " + str( hostname )
+        try:
+            response = self.execute(
+                cmd=command,
+                prompt="mininet>",
+                timeout=10 )
+            if re.search( "no host named", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "Error", response ):
+                main.log.warn( response )
+                return main.FALSE
+            elif re.search( "usage:", response ):
+                main.log.warn( response )
+                return main.FALSE
+            else:
+                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()
+
+    def disconnect( self ):
+        main.log.info( self.name + ": Disconnecting mininet..." )
         response = ''
         if self.handle:
             try:
-                response = self.execute(cmd="exit",prompt="(.*)",timeout=120)
-                response = self.execute(cmd="exit",prompt="(.*)",timeout=120)
-                self.handle.sendline("sudo mn -c")
-            except pexpect.EOF:  
-                main.log.error(self.name + ": EOF exception found")
-                main.log.error(self.name + ":     " + self.handle.before)
+                response = self.execute(
+                    cmd="exit",
+                    prompt="(.*)",
+                    timeout=120 )
+                response = self.execute(
+                    cmd="exit",
+                    prompt="(.*)",
+                    timeout=120 )
+                self.handle.sendline( "sudo mn -c" )
+                response = 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()
-        else :
-            main.log.error(self.name+": Connection failed to the host")
+        else:
+            main.log.error( self.name + ": Connection failed to the host" )
             response = main.FALSE
-        return response  
-  
-    def arping(self, src, dest, destmac):
-        self.handle.sendline('')
-        self.handle.expect(["mininet",pexpect.EOF,pexpect.TIMEOUT])
+        return response
 
-        self.handle.sendline(src + ' arping ' + dest)
+    def arping( self, src, dest, destmac ):
+        self.handle.sendline( '' )
+        self.handle.expect( [ "mininet", pexpect.EOF, pexpect.TIMEOUT ] )
+
+        self.handle.sendline( src + ' arping ' + dest )
         try:
-            self.handle.expect([destmac,pexpect.EOF,pexpect.TIMEOUT])
-            main.log.info(self.name+": ARP successful")
-            self.handle.expect(["mininet",pexpect.EOF,pexpect.TIMEOUT])
+            self.handle.expect( [ destmac, pexpect.EOF, pexpect.TIMEOUT ] )
+            main.log.info( self.name + ": ARP successful" )
+            self.handle.expect( [ "mininet", pexpect.EOF, pexpect.TIMEOUT ] )
             return main.TRUE
         except:
-            main.log.warn(self.name+": ARP FAILURE")
-            self.handle.expect(["mininet",pexpect.EOF,pexpect.TIMEOUT])
+            main.log.warn( self.name + ": ARP FAILURE" )
+            self.handle.expect( [ "mininet", pexpect.EOF, pexpect.TIMEOUT ] )
             return main.FALSE
 
-    def decToHex(num):
-        return hex(num).split('x')[1]
-    
-    def getSwitchFlowCount(self, switch):
-        '''
-        return the Flow Count of the switch
-        '''
+    def decToHex( self, num ):
+        return hex( num ).split( 'x' )[ 1 ]
+
+    def getSwitchFlowCount( self, switch ):
+        """
+           return the Flow Count of the switch"""
         if self.handle:
             cmd = "sh ovs-ofctl dump-aggregate %s" % switch
             try:
-                response = self.execute(cmd=cmd, prompt="mininet>", timeout=10)
+                response = self.execute(
+                    cmd=cmd,
+                    prompt="mininet>",
+                    timeout=10 )
             except pexpect.EOF:
-                main.log.error(self.name + ": EOF exception found")
-                main.log.error(self.name + "     " + self.handle.before)
+                main.log.error( self.name + ": EOF exception found" )
+                main.log.error( self.name + "     " + self.handle.before )
                 main.cleanup()
                 main.exit()
             pattern = "flow_count=(\d+)"
-            result = re.search(pattern, response, re.MULTILINE)
+            result = re.search( pattern, response, re.MULTILINE )
             if result is None:
-                main.log.info("Couldn't find flows on switch '', found: %s" % (switch, response))
+                main.log.info(
+                    "Couldn't find flows on switch %s, found: %s" %
+                    ( switch, response ) )
                 return main.FALSE
-            return result.group(1)
+            return result.group( 1 )
         else:
-            main.log.error("Connection failed to the Mininet host")
-    
-    def check_flows(self, sw, dump_format=None):
+            main.log.error( "Connection failed to the Mininet host" )
+
+    def check_flows( self, sw, dump_format=None ):
         if dump_format:
-          command = "sh ovs-ofctl -F " + dump_format + " dump-flows " + str(sw)
+            command = "sh ovs-ofctl -F " + \
+                dump_format + " dump-flows " + str( sw )
         else:
-          command = "sh ovs-ofctl dump-flows "+str(sw)
+            command = "sh ovs-ofctl dump-flows " + str( sw )
         try:
-            response=self.execute(cmd=command,prompt="mininet>",timeout=10)
+            response = self.execute(
+                cmd=command,
+                prompt="mininet>",
+                timeout=10 )
             return response
         except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
         else:
-            main.log.info(response)
+            main.log.info( response )
 
-    def start_tcpdump(self, filename, intf = "eth0", port = "port 6633"):
-        '''
-        Runs tpdump on an intferface and saves the file
-        intf can be specified, or the default eth0 is used
-        '''
+    def start_tcpdump( self, filename, intf="eth0", port="port 6633" ):
+        """
+           Runs tpdump on an intferface and saves the file
+           intf can be specified, or the default eth0 is used"""
         try:
-            self.handle.sendline("")
-            self.handle.expect("mininet>")
-            self.handle.sendline("sh sudo tcpdump -n -i "+ intf + " " + port + " -w " + filename.strip() + "  &")
-            self.handle.sendline("")
-            self.handle.sendline("")
-            i=self.handle.expect(['No\ssuch\device','listening\son',pexpect.TIMEOUT,"mininet>"],timeout=10)
-            main.log.warn(self.handle.before + self.handle.after)
+            self.handle.sendline( "" )
+            self.handle.expect( "mininet>" )
+            self.handle.sendline(
+                "sh sudo tcpdump -n -i " +
+                intf +
+                " " +
+                port +
+                " -w " +
+                filename.strip() +
+                "  &" )
+            self.handle.sendline( "" )
+            i = self.handle.expect( [ 'No\ssuch\device',
+                                      'listening\son',
+                                      pexpect.TIMEOUT,
+                                      "mininet>" ],
+                                    timeout=10 )
+            main.log.warn( self.handle.before + self.handle.after )
+            self.handle.sendline( "" )
+            self.handle.expect( "mininet>" )
             if i == 0:
-                main.log.error(self.name + ": tcpdump - No such device exists. tcpdump attempted on: " + intf)
+                main.log.error(
+                    self.name +
+                    ": tcpdump - No such device exists. " +
+                    "tcpdump attempted on: " +
+                    intf )
                 return main.FALSE
             elif i == 1:
-                main.log.info(self.name + ": tcpdump started on " + intf)
+                main.log.info( self.name + ": tcpdump started on " + intf )
                 return main.TRUE
             elif i == 2:
-                main.log.error(self.name + ": tcpdump command timed out! Check interface name, given interface was: " + intf)
+                main.log.error(
+                    self.name +
+                    ": tcpdump command timed out! Check interface name," +
+                    " given interface was: " +
+                    intf )
                 return main.FALSE
-            elif i ==3: 
-                main.log.info(self.name +": " +  self.handle.before)
+            elif i == 3:
+                main.log.info( self.name + ": " + self.handle.before )
                 return main.TRUE
             else:
-                main.log.error(self.name + ": tcpdump - unexpected response")
+                main.log.error( self.name + ": tcpdump - unexpected response" )
             return main.FALSE
         except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
         except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.log.info( self.name + ":" * 50 )
             main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.log.info(":" * 50 )
             main.cleanup()
             main.exit()
 
-    def stop_tcpdump(self):
+    def stop_tcpdump( self ):
         "pkills tcpdump"
         try:
-            self.handle.sendline("sh sudo pkill tcpdump")
-            self.handle.sendline("")
-            self.handle.sendline("")
-            self.handle.expect("mininet>")
+            self.handle.sendline( "sh sudo pkill tcpdump" )
+            self.handle.expect( "mininet>" )
+            self.handle.sendline( "" )
+            self.handle.expect( "mininet>" )
         except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
         except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.log.info( self.name + ":" * 50 )
             main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.log.info(":" * 50 )
             main.cleanup()
             main.exit()
 
-    def compare_switches(self, topo, switches_json):
-        '''
-        Compare mn and onos switches
-        topo: sts TestONTopology object
-        switches_json: parsed json object from the onos devices api
+    def compare_switches( self, topo, switches_json ):
+        """
+           Compare mn and onos switches
+           topo: sts TestONTopology object
+            switches_json: parsed json object from the onos devices api
 
-        This uses the sts TestONTopology object
-
-        '''
-        import json
-        #main.log.debug("Switches_json string: ", switches_json)
-        output = {"switches":[]}
-        for switch in topo.graph.switches: #iterate through the MN topology and pull out switches and and port info
+           This uses the sts TestONTopology object"""
+        # main.log.debug( "Switches_json string: ", switches_json )
+        output = { "switches": [] }
+        # iterate through the MN topology and pull out switches and and port
+        # info
+        for switch in topo.graph.switches:
             ports = []
             for port in switch.ports.values():
-                ports.append({'of_port': port.port_no, 'mac': str(port.hw_addr).replace('\'',''), 'name': port.name})
-            output['switches'].append({"name": switch.name, "dpid": str(switch.dpid).zfill(16), "ports": ports })
+                ports.append( { 'of_port': port.port_no,
+                                'mac': str( port.hw_addr ).replace( '\'',
+                                                                    ''),
+                                'name': port.name } )
+            output[ 'switches' ].append( {
+                "name": switch.name,
+                "dpid": str( switch.dpid ).zfill( 16 ),
+                "ports": ports } )
 
-        #print "mn"
-        #print json.dumps(output, sort_keys=True,indent=4,separators=(',', ': '))
-        #print "onos"
-        #print json.dumps(switches_json, sort_keys=True,indent=4,separators=(',', ': '))
-
+        # print "mn"
+        # print json.dumps( output,
+        #                   sort_keys=True,
+        #                   indent=4,
+        #                   separators=( ',', ': ' ) )
+        # print "onos"
+        # print json.dumps( switches_json,
+        #                   sort_keys=True,
+        #                   indent=4,
+        #                   separators=( ',', ': ' ) )
 
         # created sorted list of dpid's in MN and ONOS for comparison
-        mnDPIDs=[]
-        for switch in output['switches']:
-            mnDPIDs.append(switch['dpid'])
+        mnDPIDs = []
+        for switch in output[ 'switches' ]:
+            mnDPIDs.append( switch[ 'dpid' ].lower() )
         mnDPIDs.sort()
-        #print "List of Mininet switch DPID's"
-        #print mnDPIDs
-        if switches_json == "":#if rest call fails
-            main.log.error(self.name + ".compare_switches(): Empty JSON object given from ONOS")
+        # print "List of Mininet switch DPID's"
+        # print mnDPIDs
+        if switches_json == "":  # if rest call fails
+            main.log.error(
+                self.name +
+                ".compare_switches(): Empty JSON object given from ONOS" )
             return main.FALSE
-        onos=switches_json
-        onosDPIDs=[]
+        onos = switches_json
+        onosDPIDs = []
         for switch in onos:
-            if switch['available'] == True:
-                onosDPIDs.append(switch['id'].replace(":",'').replace("of",''))
-            #else:
-                #print "Switch is unavailable:"
-                #print switch
+            if switch[ 'available' ]:
+                onosDPIDs.append(
+                    switch[ 'id' ].replace(
+                        ":",
+                        '' ).replace(
+                        "of",
+                        '' ).lower() )
+            # else:
+                # print "Switch is unavailable:"
+                # print switch
         onosDPIDs.sort()
-        #print "List of ONOS switch DPID's"
-        #print onosDPIDs
+        # print "List of ONOS switch DPID's"
+        # print onosDPIDs
 
-        if mnDPIDs!=onosDPIDs:
+        if mnDPIDs != onosDPIDs:
             switch_results = main.FALSE
-            main.log.report( "Switches in MN but not in ONOS:")
-            main.log.report( str([switch for switch in mnDPIDs if switch not in onosDPIDs]))
-            main.log.report( "Switches in ONOS but not in MN:")
-            main.log.report(  str([switch for switch in onosDPIDs if switch not in mnDPIDs]))
-        else:#list of dpid's match in onos and mn
-            #main.log.report("DEBUG: The dpid's of the switches in Mininet and ONOS match")
+            main.log.report( "Switches in MN but not in ONOS:" )
+            list1 = [ switch for switch in mnDPIDs if switch not in onosDPIDs ]
+            main.log.report( str( list1 ) )
+            main.log.report( "Switches in ONOS but not in MN:" )
+            list2 = [ switch for switch in onosDPIDs if switch not in mnDPIDs ]
+            main.log.report(str( list2 ) )
+        else:  # list of dpid's match in onos and mn
             switch_results = main.TRUE
         return switch_results
 
-
-
-    def compare_ports(self, topo, ports_json):
-        '''
+    def compare_ports( self, topo, ports_json ):
+        """
         Compare mn and onos ports
         topo: sts TestONTopology object
         ports_json: parsed json object from the onos ports api
 
-        Dependencies: 
+        Dependencies:
             1. This uses the sts TestONTopology object
             2. numpy - "sudo pip install numpy"
 
-        '''
-        #FIXME: this does not look for extra ports in ONOS, only checks that ONOS has what is in MN
-        import json
+        """
+        # FIXME: this does not look for extra ports in ONOS, only checks that
+        # ONOS has what is in MN
         from numpy import uint64
-        port_results = main.TRUE
-        output = {"switches":[]}
-        for switch in topo.graph.switches: #iterate through the MN topology and pull out switches and and port info
+        ports_results = main.TRUE
+        output = { "switches": [] }
+        # iterate through the MN topology and pull out switches and and port
+        # info
+        for switch in topo.graph.switches:
             ports = []
             for port in switch.ports.values():
-                #print port.hw_addr.toStr(separator = '')
+                # print port.hw_addr.toStr( separator='' )
                 tmp_port = {}
-                tmp_port['of_port'] = port.port_no
-                tmp_port['mac'] = str(port.hw_addr).replace('\'','')
-                tmp_port['name'] = port.name
-                tmp_port['enabled'] = port.enabled
+                tmp_port[ 'of_port' ] = port.port_no
+                tmp_port[ 'mac' ] = str( port.hw_addr ).replace( '\'', '' )
+                tmp_port[ 'name' ] = port.name
+                tmp_port[ 'enabled' ] = port.enabled
 
-                ports.append(tmp_port)
+                ports.append( tmp_port )
             tmp_switch = {}
-            tmp_switch['name'] = switch.name
-            tmp_switch['dpid'] = str(switch.dpid).zfill(16)
-            tmp_switch['ports'] = ports
+            tmp_switch[ 'name' ] = switch.name
+            tmp_switch[ 'dpid' ] = str( switch.dpid ).zfill( 16 )
+            tmp_switch[ 'ports' ] = ports
 
-            output['switches'].append(tmp_switch)
+            output[ 'switches' ].append( tmp_switch )
 
-
-        ################ports#############
-        for mn_switch in output['switches']:
+        # PORTS
+        for mn_switch in output[ 'switches' ]:
             mn_ports = []
             onos_ports = []
-            for port in mn_switch['ports']:
-                if port['enabled'] == True:
-                    mn_ports.append(port['of_port'])
+            switch_result = main.TRUE
+            for port in mn_switch[ 'ports' ]:
+                if port[ 'enabled' ]:
+                    mn_ports.append( port[ 'of_port' ] )
             for onos_switch in ports_json:
-                #print "Iterating through a new switch as seen by ONOS"
-                #print onos_switch
-                if onos_switch['device']['available'] == True:
-                    if onos_switch['device']['id'].replace(':','').replace("of", '') == mn_switch['dpid']:
-                        for port in onos_switch['ports']:
-                            if port['isEnabled']:
-                                #print "Iterating through available ports on the switch"
-                                #print port
-                                onos_ports.append(int(port['port'])) 
-            mn_ports.sort(key=float)
-            onos_ports.sort(key=float)
-            #print "\nPorts for Switch %s:" % (switch['name'])
-            #print "\tmn_ports[] = ", mn_ports
-            #print "\tonos_ports[] = ", onos_ports
-            
-            #NOTE:For OF1.3, the OFP_local port number is 0xfffffffe or 4294967294 instead of 0xfffe or 65534 in OF1.0,
-            #   ONOS topology sees the correct port number, however MN topology as read from line 151 of
-            #   https://github.com/ucb-sts/sts/blob/topology_refactoring2/sts/entities/teston_entities.py 
-            #   is 0xfffe which doesn't work correctly with OF1.3 switches.
-            
-            #NOTE: ONOS is abstracting port numbers to 64bit unsigned number(long). So we will be converting the 
-            #   OF reserved ports to these numbers
+                # print "Iterating through a new switch as seen by ONOS"
+                # print onos_switch
+                if onos_switch[ 'device' ][ 'available' ]:
+                    if onos_switch[ 'device' ][ 'id' ].replace(
+                            ':',
+                            '' ).replace(
+                            "of",
+                            '' ) == mn_switch[ 'dpid' ]:
+                        for port in onos_switch[ 'ports' ]:
+                            if port[ 'isEnabled' ]:
+                                if port[ 'port' ] == 'local':
+                                    # onos_ports.append( 'local' )
+                                    onos_ports.append( long( uint64( -2 ) ) )
+                                else:
+                                    onos_ports.append( int( port[ 'port' ] ) )
+                        break
+            mn_ports.sort( key=float )
+            onos_ports.sort( key=float )
+            # print "\nPorts for Switch %s:" % ( mn_switch[ 'name' ] )
+            # print "\tmn_ports[] = ", mn_ports
+            # print "\tonos_ports[] = ", onos_ports
+            mn_ports_log = mn_ports
+            onos_ports_log = onos_ports
+            mn_ports = [ x for x in mn_ports ]
+            onos_ports = [ x for x in onos_ports ]
 
+            # 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 mn_port in mn_ports_log:
+                if mn_port in onos_ports:
+                    # don't set results to true here as this is just one of
+                    # many checks and it might override a failure
+                    mn_ports.remove( mn_port )
+                    onos_ports.remove( mn_port )
+                # 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 mn_ports:
+                    mn_ports.remove( 65534 )
+                if long( uint64( -2 ) ) in onos_ports:
+                    onos_ports.remove( long( uint64( -2 ) ) )
+            if len( mn_ports ):  # the ports of this switch don't match
+                switch_result = main.FALSE
+                main.log.warn( "Ports in MN but not ONOS: " + str( mn_ports ) )
+            if len( onos_ports ):  # the ports of this switch don't match
+                switch_result = main.FALSE
+                main.log.warn(
+                    "Ports in ONOS but not MN: " +
+                    str( onos_ports ) )
+            if switch_result == main.FALSE:
+                main.log.report(
+                    "The list of ports for switch %s(%s) does not match:" %
+                    ( mn_switch[ 'name' ], mn_switch[ 'dpid' ] ) )
+                main.log.warn( "mn_ports[]  =  " + str( mn_ports_log ) )
+                main.log.warn( "onos_ports[] = " + str( onos_ports_log ) )
+            ports_results = ports_results and switch_result
+        return ports_results
 
-            #TODO: handle other reserved port numbers besides LOCAL
-            for mn_port,onos_port in zip(mn_ports,onos_ports):
-                #print "mn == onos port?"
-                #print mn_port, onos_port
-                if mn_port == onos_port or (mn_port == 65534 and onos_port == long(uint64(-2))):
-                    continue
-                    #don't set results to true here as this is just one of many checks and it might override a failure
-                else:  #the ports of this switch don't match
-                    port_results = main.FALSE
-                    break
-            if port_results == main.FALSE:
-                main.log.report("The list of ports for switch %s(%s) does not match:" % (mn_switch['name'], mn_switch['dpid']) )
-                main.log.report("mn_ports[] = " +  str(mn_ports))
-                main.log.report("onos_ports[] = " + str(onos_ports))
-        return port_results
+    def compare_links( self, topo, links_json ):
+        """
+           Compare mn and onos links
+           topo: sts TestONTopology object
+           links_json: parsed json object from the onos links api
 
-
-
-
-    def compare_links(self, topo, links_json):
-        '''
-        Compare mn and onos links
-        topo: sts TestONTopology object
-        links_json: parsed json object from the onos links api
-
-        This uses the sts TestONTopology object
-
-        '''
-        #FIXME: this does not look for extra links in ONOS, only checks that ONOS has what is in MN
-        import json
+           This uses the sts TestONTopology object"""
+        # FIXME: this does not look for extra links in ONOS, only checks that
+        # ONOS has what is in MN
         link_results = main.TRUE
-        output = {"switches":[]}
+        output = { "switches": [] }
         onos = links_json
-        for switch in topo.graph.switches: #iterate through the MN topology and pull out switches and and port info
+        # iterate through the MN topology and pull out switches and and port
+        # info
+        for switch in topo.graph.switches:
             # print "Iterating though switches as seen by Mininet"
             # print switch
             ports = []
             for port in switch.ports.values():
-                #print port.hw_addr.toStr(separator = '')
-                ports.append({'of_port': port.port_no, 'mac': str(port.hw_addr).replace('\'',''), 'name': port.name})
-            output['switches'].append({"name": switch.name, "dpid": str(switch.dpid).zfill(16), "ports": ports })
-        #######Links########
+                # print port.hw_addr.toStr( separator='' )
+                ports.append( { 'of_port': port.port_no,
+                                'mac': str( port.hw_addr ).replace( '\'',
+                                                                    ''),
+                                'name': port.name } )
+            output[ 'switches' ].append( {
+                "name": switch.name,
+                "dpid": str( switch.dpid ).zfill( 16 ),
+                "ports": ports } )
+        # LINKS
 
-        mn_links = [link for link in topo.patch_panel.network_links if (link.port1.enabled and link.port2.enabled)]
-        #print "mn_links:"
-        #print mn_links
-        if 2*len(mn_links) == len(onos):
+        mn_links = [
+            link for link in topo.patch_panel.network_links if (
+                link.port1.enabled and link.port2.enabled ) ]
+        if 2 * len( mn_links ) == len( onos ):
             link_results = main.TRUE
         else:
             link_results = main.FALSE
-            main.log.report("Mininet has %i bidirectional links and ONOS has %i unidirectional links" % (len(mn_links), len(onos) ))
+            main.log.report(
+                "Mininet has %i bidirectional links and " +
+                "ONOS has %i unidirectional links" %
+                ( len( mn_links ), len( onos ) ) )
 
-
-        # iterate through MN links and check if an ONOS link exists in both directions
-        # NOTE: Will currently only show mn links as down if they are cut through STS. 
-        #       We can either do everything through STS or wait for up_network_links 
-        #       and down_network_links to be fully implemented.
-        for link in mn_links: 
-            #print "Link: %s" % link
-            #TODO: Find a more efficient search method
+        # iterate through MN links and check if an ONOS link exists in
+        # both directions
+        # NOTE: Will currently only show mn links as down if they are
+        #       cut through STS. We can either do everything through STS or
+        #       wait for up_network_links and down_network_links to be
+        #       fully implemented.
+        for link in mn_links:
+            # print "Link: %s" % link
+            # TODO: Find a more efficient search method
             node1 = None
             port1 = None
             node2 = None
             port2 = None
             first_dir = main.FALSE
             second_dir = main.FALSE
-            for switch in output['switches']:
-                #print "Switch: %s" % switch['name']
-                if switch['name'] == link.node1.name:
-                    node1 = switch['dpid']
-                    for port in switch['ports']:
-                        if str(port['name']) == str(link.port1):
-                            port1 = port['of_port'] 
+            for switch in output[ 'switches' ]:
+                # print "Switch: %s" % switch[ 'name' ]
+                if switch[ 'name' ] == link.node1.name:
+                    node1 = switch[ 'dpid' ]
+                    for port in switch[ 'ports' ]:
+                        if str( port[ 'name' ] ) == str( link.port1 ):
+                            port1 = port[ 'of_port' ]
                     if node1 is not None and node2 is not None:
                         break
-                if switch['name'] == link.node2.name:
-                    node2 = switch['dpid']
-                    for port in switch['ports']: 
-                        if str(port['name']) == str(link.port2):
-                            port2 = port['of_port'] 
+                if switch[ 'name' ] == link.node2.name:
+                    node2 = switch[ 'dpid' ]
+                    for port in switch[ 'ports' ]:
+                        if str( port[ 'name' ] ) == str( link.port2 ):
+                            port2 = port[ 'of_port' ]
                     if node1 is not None and node2 is not None:
                         break
 
-
             for onos_link in onos:
-                onos_node1 = onos_link['src']['device'].replace(":",'').replace("of", '')
-                onos_node2 = onos_link['dst']['device'].replace(":",'').replace("of", '')
-                onos_port1 = onos_link['src']['port']
-                onos_port2 = onos_link['dst']['port']
+                onos_node1 = onos_link[ 'src' ][ 'device' ].replace(
+                    ":",
+                    '' ).replace(
+                    "of",
+                    '' )
+                onos_node2 = onos_link[ 'dst' ][ 'device' ].replace(
+                    ":",
+                    '' ).replace(
+                    "of",
+                    '' )
+                onos_port1 = onos_link[ 'src' ][ 'port' ]
+                onos_port2 = onos_link[ 'dst' ][ 'port' ]
 
-                #print "Checking ONOS for link %s/%s -> %s/%s and" % (node1, port1, node2, port2)
-                #print "Checking ONOS for link %s/%s -> %s/%s" % (node2, port2, node1, port1)
                 # check onos link from node1 to node2
-                if str(onos_node1) == str(node1) and str(onos_node2) == str(node2):
-                    if int(onos_port1) == int(port1) and int(onos_port2) == int(port2):
+                if str( onos_node1 ) == str( node1 ) and str(
+                        onos_node2 ) == str( node2 ):
+                    if int( onos_port1 ) == int( port1 ) and int(
+                            onos_port2 ) == int( port2 ):
                         first_dir = main.TRUE
                     else:
-                        main.log.report('The port numbers do not match for ' +str(link) +\
-                                ' between ONOS and MN. When cheking ONOS for link '+\
-                                '%s/%s -> %s/%s' % (node1, port1, node2, port2)+\
-                                ' ONOS has the values %s/%s -> %s/%s' %\
-                                (onos_node1, onos_port1, onos_node2, onos_port2))
+                        main.log.warn(
+                            'The port numbers do not match for ' +
+                            str( link ) +
+                            ' between ONOS and MN. When cheking ONOS for ' +
+                            'link %s/%s -> %s/%s' %
+                            ( node1,
+                              port1,
+                              node2,
+                              port2 ) +
+                            ' ONOS has the values %s/%s -> %s/%s' %
+                            ( onos_node1,
+                              onos_port1,
+                              onos_node2,
+                              onos_port2 ) )
 
                 # check onos link from node2 to node1
-                elif ( str(onos_node1) == str(node2) and str(onos_node2) == str(node1) ):
-                    if ( int(onos_port1) == int(port2) and int(onos_port2) == int(port1) ):
+                elif ( str( onos_node1 ) == str( node2 ) and
+                        str( onos_node2 ) == str( node1 ) ):
+                    if ( int( onos_port1 ) == int( port2 )
+                         and int( onos_port2 ) == int( port1 ) ):
                         second_dir = main.TRUE
                     else:
-                        main.log.report('The port numbers do not match for ' +str(link) +\
-                                ' between ONOS and MN. When cheking ONOS for link '+\
-                                '%s/%s -> %s/%s' % (node2, port2, node1, port1)+\
-                                ' ONOS has the values %s/%s -> %s/%s' %\
-                                (onos_node2, onos_port2, onos_node1, onos_port1))
-                else:#this is not the link you're looking for
+                        main.log.warn(
+                            'The port numbers do not match for ' +
+                            str( link ) +
+                            ' between ONOS and MN. When cheking ONOS for ' +
+                            'link %s/%s -> %s/%s' %
+                            ( node2,
+                              port2,
+                              node1,
+                              port1 ) +
+                            ' ONOS has the values %s/%s -> %s/%s' %
+                            ( onos_node2,
+                              onos_port2,
+                              onos_node1,
+                              onos_port1 ) )
+                else:  # this is not the link you're looking for
                     pass
             if not first_dir:
-                main.log.report('ONOS does not have the link %s/%s -> %s/%s' % (node1, port1, node2, port2))
+                main.log.report(
+                    'ONOS does not have the link %s/%s -> %s/%s' %
+                    ( node1, port1, node2, port2 ) )
             if not second_dir:
-                main.log.report('ONOS does not have the link %s/%s -> %s/%s' % (node2, port2, node1, port1))
+                main.log.report(
+                    'ONOS does not have the link %s/%s -> %s/%s' %
+                    ( node2, port2, node1, port1 ) )
             link_results = link_results and first_dir and second_dir
         return link_results
 
+    def get_hosts( self ):
+        """
+           Returns a list of all hosts
+           Don't ask questions just use it"""
+        self.handle.sendline( "" )
+        self.handle.expect( "mininet>" )
 
-    def get_hosts(self):
-        '''
-        Returns a list of all hosts
-        Don't ask questions just use it
-        '''
-        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>" )
 
         handle_py = self.handle.before
-        handle_py = handle_py.split("]\r\n",1)[1]
+        handle_py = handle_py.split( "]\r\n", 1 )[ 1 ]
         handle_py = handle_py.rstrip()
 
-        self.handle.sendline("")
-        self.handle.expect("mininet>")
+        self.handle.sendline( "" )
+        self.handle.expect( "mininet>" )
 
-        host_str = handle_py.replace("]", "")
-        host_str = host_str.replace("'", "")
-        host_str = host_str.replace("[", "")
-        host_list = host_str.split(",")
+        host_str = handle_py.replace( "]", "" )
+        host_str = host_str.replace( "'", "" )
+        host_str = host_str.replace( "[", "" )
+        host_list = host_str.split( "," )
 
-        return host_list 
+        return host_list
 
+    def update( self ):
+        """
+           updates the port address and status information for
+           each port in mn"""
+        # TODO: Add error checking. currently the mininet command has no output
+        main.log.info( "Updateing MN port information" )
+        try:
+            self.handle.sendline( "" )
+            self.handle.expect( "mininet>" )
 
-    def update(self):
-        '''
-        updates the port address and status information for each port in mn
-        '''
-        #TODO: Add error checking. currently the mininet command has no output
-        main.log.info("Updateing MN port information")
-        self.handle.sendline("")
-        self.handle.expect("mininet>")
-        
-        self.handle.sendline("update")
-        self.handle.expect("mininet>")
+            self.handle.sendline( "update" )
+            self.handle.expect( "update" )
+            self.handle.expect( "mininet>" )
 
-        self.handle.sendline("")
-        self.handle.expect("mininet>")
+            self.handle.sendline( "" )
+            self.handle.expect( "mininet>" )
 
-        return main.TRUE 
-
-        
+            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()
 
 if __name__ != "__main__":
     import sys
-    sys.modules[__name__] = MininetCliDriver()
-
+    sys.modules[ __name__ ] = MininetCliDriver()
diff --git a/TestON/drivers/common/cli/emulator/remotemininetdriver.py b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
index ffb5151..48d3389 100644
--- a/TestON/drivers/common/cli/emulator/remotemininetdriver.py
+++ b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
@@ -16,30 +16,23 @@
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with TestON.  If not, see <http://www.gnu.org/licenses/>.		
+    along with TestON.  If not, see <http://www.gnu.org/licenses/>.
 
 
 MininetCliDriver is the basic driver which will handle the Mininet functions
 '''
 import traceback
 import pexpect
-import struct
-import fcntl
-import os
-import signal
 import re
 import sys
-import core.teston
 sys.path.append("../")
 from drivers.common.cli.emulatordriver import Emulator
-from drivers.common.clidriver import CLI
-from time import time
 
 class RemoteMininetDriver(Emulator):
     '''
     RemoteMininetCliDriver is the basic driver which will handle the Mininet functions
-    The main different between this and the MininetCliDriver is that this one does not build the mininet. 
-    It assumes that there is already a mininet running on the target. 
+    The main different between this and the MininetCliDriver is that this one does not build the mininet.
+    It assumes that there is already a mininet running on the target.
     '''
     def __init__(self):
         super(Emulator, self).__init__()
@@ -51,25 +44,25 @@
         #,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]       
-        
+            vars(self)[key] = connectargs[key]
+
         self.name = self.options['name']
         self.handle = super(RemoteMininetDriver, self).connect(user_name = self.user_name, ip_address = self.ip_address,port = None, pwd = self.pwd)
-        
+
         self.ssh_handle = self.handle
-        
-        # Copying the readme file to process the 
+
+        # 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("Connection failed to the host "+self.user_name+"@"+self.ip_address)
             main.log.error("Failed to connect to the Mininet")
             return main.FALSE
 
 #*********************************************************************************************
 #*********************************************************************************************
-# checkForLoss will determine if any of the pings had any packets lost during the course of 
+# checkForLoss will determine if any of the pings had any packets lost during the course of
 # the pingLong.
 #*********************************************************************************************
 #*********************************************************************************************
@@ -80,7 +73,13 @@
         Returns main.ERROR if "found multiple mininet" is found and
         Returns main.TRUE else
         '''
-        import os
+        #TODO: maybe we want to return the % loss instead? This way we can set an acceptible loss %.
+        #EX: 393 packets transmitted, 380 received, 3% packet loss, time 78519ms
+        # we may need to return a float to get around rounding errors
+
+        self.handle.sendline("")
+        self.handle.expect("\$")
+        #Clear any output waiting in the bg from killing pings
         self.handle.sendline("")
         self.handle.expect("\$")
         self.handle.sendline("cat " + pingList)
@@ -92,22 +91,23 @@
         elif re.search("found multiple mininet",outputs):
             return main.ERROR
         else:
-            print outputs
+            main.log.error("Error, unexpected output in the ping file")
+            main.log.warn( outputs )
             return main.TRUE
 
 
 
     def pingLong(self,**pingParams):
         '''
-        Starts a continuous ping on the mininet host outputing to a file in the /tmp dir. 
+        Starts a continuous ping on the mininet host outputing 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']) + " > /tmp/ping." + args["SRC"] + " &"
-        main.log.info( command ) 
+        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("\$")
@@ -127,40 +127,44 @@
         self.handle.sendline("")
         self.handle.expect("\$")
         if re.search('Unreachable', result ):
-            main.log.info("Unreachable found in ping logs...") 
+            main.log.info("Unreachable found in ping logs...")
             return main.FALSE
-        elif re.search('64\sbytes', result): 
-            main.log.info("Pings look good") 
+        elif re.search('64\sbytes', result):
+            main.log.info("Pings look good")
             return main.TRUE
-        else: 
-            main.log.info("No, or faulty ping data...") 
+        else:
+            main.log.info("No, or faulty ping data...")
             return main.FALSE
-         
+
     def pingKill(self, testONUser, testONIP):
         '''
         Kills all continuous ping processes.
         Then copies all the ping files to the TestStation.
         '''
-        import time
         self.handle.sendline("")
         self.handle.expect("\$")
-        command = "sudo kill -SIGINT `pgrep ping`" 
-        main.log.info( command ) 
+        command = "sudo kill -SIGINT `pgrep ping`"
+        main.log.info( command )
         self.execute(cmd=command,prompt="(.*)",timeout=10)
-        #Commenting out in case TestON and MN are on the same machine. scp overrights the file anyways
-        #main.log.info( "Removing old ping data" )
-        #command = "rm /tmp/ping.*"
-        #os.popen(command) 
-        #time.sleep(2)      
+
         main.log.info( "Transferring ping files to TestStation" )
-        command = "scp /tmp/ping.* "+ str(testONUser) + "@" + str(testONIP) + ":/tmp/" 
+        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("\$")
-        return main.TRUE
-    
+        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
+
     def pingLongKill(self):
-        import time
         self.handle.sendline("")
         self.handle.expect("\$")
         command = "sudo kill -SIGING `pgrep ping`"
@@ -169,32 +173,72 @@
         self.handle.sendline("")
         self.handle.expect("\$")
         return main.TRUE
-        
+
+    def pingHostOptical(self,**pingParams):
+        '''
+        This function is only for Packey Optical related ping
+        Use the next pingHost() function for all normal scenarios)
+        Ping from one mininet host to another
+        Currently the only supported Params: SRC and TARGET
+        '''
+        args = utilities.parse_args(["SRC","TARGET"],**pingParams)
+        #command = args["SRC"] + " ping -" + args["CONTROLLER"] + " " +args ["TARGET"]
+        command = args["SRC"] + " ping "+args ["TARGET"]+" -c 1 -i 1 -W 8"
+        try:
+            main.log.warn("Sending: " + command)
+            #response = self.execute(cmd=command,prompt="mininet",timeout=10 )
+            self.handle.sendline(command)
+            i = self.handle.expect([command,pexpect.TIMEOUT])
+            if i == 1:
+                main.log.error(self.name + ": timeout when waiting for response from mininet")
+                main.log.error("response: " + str(self.handle.before))
+            i = self.handle.expect(["mininet>",pexpect.TIMEOUT])
+            if i == 1:
+                main.log.error(self.name + ": timeout when waiting for response from mininet")
+                main.log.error("response: " + str(self.handle.before))
+            response = self.handle.before
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":     " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        main.log.info(self.name+": Ping Response: "+ response )
+        #if utilities.assert_matches(expect=',\s0\%\spacket\sloss',actual=response,onpass="No Packet loss",onfail="Host is not reachable"):
+        if re.search(',\s0\%\spacket\sloss',response):
+            main.log.info(self.name+": no packets lost, host is reachable")
+            main.last_result = main.TRUE
+            return main.TRUE
+        else :
+            main.log.error(self.name+": PACKET LOST, HOST IS NOT REACHABLE")
+            main.last_result = main.FALSE
+            return main.FALSE
+
     def pingHost(self,**pingParams):
-        ''' 
-        Pings between two hosts on remote mininet  
-        ''' 
+        '''
+        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"
         command = "mininet/util/m " + args["SRC"] + " ping "+args ["TARGET"]+" -c 4 -W 1 -i .2"
-        main.log.info ( command ) 
+        main.log.info ( command )
         response = self.execute(cmd=command,prompt="rtt",timeout=10 )
-        self.handle.sendline("")
-        self.handle.expect("\$")
+        #self.handle.sendline("")
+        #self.handle.expect("\$")
         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.last_result = main.TRUE 
+            main.last_result = main.TRUE
             return main.TRUE
         else :
             main.log.error("PACKET LOST, HOST IS NOT REACHABLE")
             main.last_result = main.FALSE
             return main.FALSE
-        
-    
+
+
     def checknum(self,num):
         '''
-        Verifies the correct number of switches are running 
+        Verifies the correct number of switches are running
         '''
         if self.handle :
             self.handle.sendline("")
@@ -203,7 +247,7 @@
             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.sendline('ps -ef | grep "bash -ms mininet:sw" | grep -v color | wc -l')
             self.handle.expect("color")
             self.handle.expect("\$")
             response2 = self.handle.before
@@ -216,156 +260,16 @@
             else:
                 return main.FALSE
         else :
-            main.log.error("Connection failed to the host") 
+            main.log.error("Connection failed to the host")
 
-    def ctrl_none(self):
+    def start_tcpdump(self, filename, intf = "eth0", port = "port 6633", user="admin"):
         '''
-        Sets all the switches to no controllers. 
-        '''
-        self.execute(cmd="~/ONOS/scripts/test-ctrl-none.sh", prompt="\$",timeout=10)
-
-    def ctrl_one(self, ip):
-        '''
-        Sets all the switches to point to the supplied IP
-        '''
-        self.execute(cmd="~/ONOS/scripts/test-ctrl-one.sh "+ip, prompt="\$",timeout=10)
- 
-    def ctrl_local(self):
-        '''
-        Sets all the switches to point to the Controller on the same machine that they are running on. 
-        '''
-        self.execute(cmd="~/ONOS/scripts/test-ctrl-local.sh ", prompt="\$",timeout=10)
-
- #   def verifySSH(self,**connectargs):
- #       response = self.execute(cmd="h1 /usr/sbin/sshd -D&",prompt="mininet>",timeout=10)
- #       response = self.execute(cmd="h4 /usr/sbin/sshd -D&",prompt="mininet>",timeout=10)
- #       for key in connectargs:
- #           vars(self)[key] = connectargs[key]
- #       response = self.execute(cmd="xterm h1 h4 ",prompt="mininet>",timeout=10)
- #       import time
- #       time.sleep(20)
- #       if self.flag == 0:
- #           self.flag = 1
- #           return main.FALSE
- #       else :
- #           return main.TRUE
- #   
- #   def getMacAddress(self,host):
- #       '''
- #           Verifies the host's ip configured or not.
- #       '''
- #       if self.handle :
- #           response = self.execute(cmd=host+" ifconfig",prompt="mininet>",timeout=10)
-
- #           pattern = "HWaddr\s(((\d|\w)+:)+(\d|\w))"
- #           mac_address_search = re.search(pattern, response)
- #           main.log.info("Mac-Address of Host "+host +" is "+mac_address_search.group(1))
- #           return mac_address_search.group(1)
- #       else :
- #           main.log.error("Connection failed to the host") 
- #   def getIPAddress(self,host):
- #       '''
- #           Verifies the host's ip configured or not.
- #       '''
- #       if self.handle :
- #           response = self.execute(cmd=host+" ifconfig",prompt="mininet>",timeout=10)
-
- #           pattern = "inet\saddr:(\d+\.\d+\.\d+\.\d+)"
- #           ip_address_search = re.search(pattern, response)
- #           main.log.info("IP-Address of Host "+host +" is "+ip_address_search.group(1))
- #           return ip_address_search.group(1)
- #       else :
- #           main.log.error("Connection failed to the host") 
- #       
- #   def dump(self):
- #       main.log.info("Dump node info")
- #       self.execute(cmd = 'dump',prompt = 'mininet>',timeout = 10)
- #       return main.TRUE
- #           
- #   def intfs(self):
- #       main.log.info("List interfaces")
- #       self.execute(cmd = 'intfs',prompt = 'mininet>',timeout = 10)
- #       return main.TRUE
- #   
- #   def net(self):
- #       main.log.info("List network connections")
- #       self.execute(cmd = 'net',prompt = 'mininet>',timeout = 10)
- #       return main.TRUE
- #   
- #   def iperf(self):
- #       main.log.info("Simple iperf TCP test between two (optionally specified) hosts")
- #       self.execute(cmd = 'iperf',prompt = 'mininet>',timeout = 10)
- #       return main.TRUE
- #   
- #   def iperfudp(self):
- #       main.log.info("Simple iperf TCP test between two (optionally specified) hosts")
- #       self.execute(cmd = 'iperfudp',prompt = 'mininet>',timeout = 10)
- #       return main.TRUE
- #   
- #   def nodes(self):
- #       main.log.info("List all nodes.")
- #       self.execute(cmd = 'nodes',prompt = 'mininet>',timeout = 10)    
- #       return main.TRUE
- #   
- #   def pingpair(self):
- #       main.log.infoe("Ping between first two hosts")
- #       self.execute(cmd = 'pingpair',prompt = 'mininet>',timeout = 20)
- #       
- #       if utilities.assert_matches(expect='0% packet loss',actual=response,onpass="No Packet loss",onfail="Hosts not reachable"):
- #           main.log.info("Ping between two hosts SUCCESS")
- #           main.last_result = main.TRUE 
- #           return main.TRUE
- #       else :
- #           main.log.error("PACKET LOST, HOSTS NOT REACHABLE")
- #           main.last_result = main.FALSE
- #           return main.FALSE
- #   
- #   def link(self,**linkargs):
- #       '''
- #       Bring link(s) between two nodes up or down
- #       '''
- #       main.log.info('Bring link(s) between two nodes up or down')
- #       args = utilities.parse_args(["END1","END2","OPTION"],**linkargs)
- #       end1 = args["END1"] if args["END1"] != None else ""
- #       end2 = args["END2"] if args["END2"] != None else ""
- #       option = args["OPTION"] if args["OPTION"] != None else ""
- #       command = "link "+str(end1) + " " + str(end2)+ " " + str(option)
- #       response = self.execute(cmd=command,prompt="mininet>",timeout=10)
- #       return main.TRUE
- #       
-
- #   def dpctl(self,**dpctlargs):
- #       '''
- #        Run dpctl command on all switches.
- #       '''
- #       main.log.info('Run dpctl command on all switches')
- #       args = utilities.parse_args(["CMD","ARGS"],**dpctlargs)
- #       cmd = args["CMD"] if args["CMD"] != None else ""
- #       cmdargs = args["ARGS"] if args["ARGS"] != None else ""
- #       command = "dpctl "+cmd + " " + str(cmdargs)
- #       response = self.execute(cmd=command,prompt="mininet>",timeout=10)
- #       return main.TRUE
- #  
- #       
- #   def get_version(self):
- #       file_input = path+'/lib/Mininet/INSTALL'
- #       version = super(Mininet, self).get_version()
- #       pattern = 'Mininet\s\w\.\w\.\w\w*'
- #       for line in open(file_input,'r').readlines():
- #           result = re.match(pattern, line)
- #           if result:
- #               version = result.group(0)
- #               
- #           
- #       return version    
-    def start_tcpdump(self, filename, intf = "eth0", port = "port 6633"):
-        ''' 
         Runs tpdump on an intferface and saves the file
         intf can be specified, or the default eth0 is used
         '''
         try:
             self.handle.sendline("")
-            self.handle.sendline("sudo tcpdump -n -i "+ intf + " " + port + " -w " + filename.strip() + "  &")
+            self.handle.sendline("sudo tcpdump -n -i "+ intf + " " + port + " -w " + filename.strip() + " -Z " + user + "  &")
             self.handle.sendline("")
             self.handle.sendline("")
             i=self.handle.expect(['No\ssuch\device','listening\son',pexpect.TIMEOUT,"\$"],timeout=10)
@@ -379,7 +283,7 @@
             elif i == 2:
                 main.log.error(self.name + ": tcpdump command timed out! Check interface name, given interface was: " + intf)
                 return main.FALSE
-            elif i ==3: 
+            elif i ==3:
                 main.log.info(self.name +": " +  self.handle.before)
                 return main.TRUE
             else:
@@ -417,65 +321,32 @@
             main.exit()
 
     def run_optical_mn_script(self):
-        self.handle.sendline("")
-        self.handle.expect("\$")
-        self.handle.sendline("cd ~")
-        self.handle.expect("\$")
-        self.handle.sendline("sudo python optical.py")
-        self.handle.expect("\$")
-
-
-    def del_switch(self,sw):
-        self.handle.sendline("")
-        self.handle.expect("\$")
-        self.handle.sendline("sudo ovs-vsctl del-br "+sw)
-        self.handle.expect("\$")
-        return main.TRUE
-
-    def add_switch(self,sw):
-        #FIXME: Remove hardcoded number of ports
-        self.handle.sendline("")
-        self.handle.expect("\$")
-        self.handle.sendline("sudo ovs-vsctl add-br "+sw)
-        self.handle.expect("\$")
-        self.handle.sendline("sudo ovs-vsctl add-port "+sw+" " + sw + "-eth1")
-        self.handle.expect("\$")
-        self.handle.sendline("sudo ovs-vsctl add-port "+sw+" " + sw + "-eth2")
-        self.handle.expect("\$")
-        self.handle.sendline("sudo ovs-vsctl add-port "+sw+" " + sw + "-eth3")
-        self.handle.expect("\$")
-        self.handle.sendline("sudo ovs-vsctl add-port "+sw+" " + sw + "-eth4")
-        self.handle.expect("\$")
-        self.handle.sendline("sudo ovs-vsctl add-port "+sw+" " + sw + "-eth5")
-        self.handle.expect("\$")
-        self.handle.sendline("sudo ovs-vsctl add-port "+sw+" " + sw + "-eth6")
-        self.handle.expect("\$")
-        self.handle.sendline("sudo ovs-vsctl add-port "+sw+" " + sw + "-eth7")
-        self.handle.expect("\$")
-        self.handle.sendline("sudo ovs-vsctl add-port "+sw+" " + sw + "-eth8")
-        self.handle.expect("\$")
-        self.handle.sendline("sudo ovs-vsctl add-port "+sw+" " + sw + "-eth9")
-        self.handle.expect("\$")
-        self.handle.sendline("sudo ovs-vsctl add-port "+sw+" " + sw + "-eth10")
-        self.handle.expect("\$")
-        self.handle.sendline("sudo ovs-vsctl add-port "+sw+" " + sw + "-eth11")
-        self.handle.expect("\$")
-        self.handle.sendline("sudo ovs-vsctl add-port "+sw+" " + sw + "-eth12")
-        self.handle.expect("\$")
-        self.handle.sendline("sudo ovs-vsctl add-port "+sw+" " + sw + "-eth13")
-        self.handle.expect("\$")
-        self.handle.sendline("sudo ovs-vsctl add-port "+sw+" " + sw + "-eth14")
-        self.handle.expect("\$")
-
+        '''
+            This function is only meant for Packet Optical.
+            It runs the python script "optical.py" to create the packet layer(mn)
+            topology
+        '''
+        try:
+            self.handle.sendline("")
+            self.handle.expect("\$")
+            self.handle.sendline("cd ~")
+            self.handle.expect("\$")
+            self.handle.sendline("sudo python optical.py")
+            self.handle.expect(">")
+            return main.TRUE
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":     " + self.handle.before)
+            return main.FALSE
 
     def disconnect(self):
-        '''    
-        Called at the end of the test to disconnect the handle.    
-        '''    
+        '''
+        Called at the end of the test to disconnect the handle.
+        '''
         response = ''
         #print "Disconnecting Mininet"
         if self.handle:
-            self.handle.sendline("exit") 
+            self.handle.sendline("exit")
             self.handle.expect("exit")
             self.handle.expect("(.*)")
             response = self.handle.before
@@ -483,61 +354,44 @@
         else :
             main.log.error("Connection failed to the host")
             response = main.FALSE
-        return response  
+        return response
 
     def get_flowTable(self, protoVersion, sw):
+        #TODO document usage
+        #TODO add option to look at cookies. ignoreing them for now
         self.handle.sendline("cd")
-        #self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-        print "cd expect status: " 
-        print self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
-        #TODO: Write seperate versions of the function for this, possibly a string that tells it which switch is in use?
-        #For 1.0 version of OVS
-        #command = "sudo ovs-ofctl dump-flows " + sw + " | awk '{OFS=\",\" ; print $1 $6 $7 }' |sort -n -k1"
-        #for 1.3 version of OVS
-        #command = "sudo ovs-ofctl dump-flows " + sw + " | awk '{OFS=\",\" ; print $1 $3 $7 $8}' |sort -n -k1"
+        self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
+        #print "get_flowTable(" + str(protoVersion) +" " + str(sw) +")"
         #NOTE: Use format to force consistent flow table output across versions
         if protoVersion==1.0:
-            command = "sudo ovs-ofctl dump-flows " + sw + " -F OpenFlow10-table_id | awk '{OFS=\",\" ; print $1  $3  $6  $7  $8}' |sort -n -k1"
+            command = "sudo ovs-ofctl dump-flows " + sw + " -F OpenFlow10-table_id | awk '{OFS=\",\" ; print $1  $3  $6  $7  $8}' | cut -d ',' -f 2- | sort -n -k1 -r"
             self.handle.sendline(command)
-            self.handle.expect(["sort -n -k1",pexpect.EOF,pexpect.TIMEOUT])
+            self.handle.expect(["k1 -r",pexpect.EOF,pexpect.TIMEOUT])
             self.handle.expect(["OFPST_FLOW",pexpect.EOF,pexpect.TIMEOUT])
             response = self.handle.before
             #print "response=", response
             return response
         elif protoVersion==1.3:
-            command = "sudo ovs-ofctl dump-flows " + sw + " -O OpenFlow13  | awk '{OFS=\",\" ; print $1  $3  $6  $7}' |sort -n -k1" 
+            command = "sudo ovs-ofctl dump-flows " + sw + " -O OpenFlow13  | awk '{OFS=\",\" ; print $1  $3  $6  $7}' | cut -d ',' -f 2- | sort -n -k1 -r"
             self.handle.sendline(command)
-            #print "ovs-vsctl Command sent status."
-            #self.handle.expect(["sort -n -k1",pexpect.EOF,pexpect.TIMEOUT])
-            #print "sort return status: " 
-            #print self.handle.expect(["sort -n -k1",pexpect.EOF,pexpect.TIMEOUT])
-            #print self.handle.before
+            self.handle.expect(["k1 -r",pexpect.EOF,pexpect.TIMEOUT])
             self.handle.expect(["OFPST_FLOW",pexpect.EOF,pexpect.TIMEOUT])
-            #print "OFPST_FLOW expected status: " 
-            #print self.handle.expect(["OFPST_FLOW",pexpect.EOF,pexpect.TIMEOUT])
-            #print self.handle.before
             response = self.handle.before
             #print "response=", response
-            return response 
-        
+            return response
+        else:
+            main.log.error("Unknown  protoVersion in get_flowTable(). given: ("+str(type(protoVersion))+") '"+str(protoVersion)+"'")
+
 
     def flow_comp(self,flow1,flow2):
-        #print "Inside flow compare function"
-        #print "Flow1 Table:"
-        #for flow in flow1:
-            #print flow1
-        #print "Flow2 Table"
-        #for flow in flow2:
-            #print flow2
-
         if flow1==flow2:
             return main.TRUE
         else:
             main.log.info("Flow tables do not match, printing tables:")
-            #main.log.info("Flow Table 1:")
-            #main.log.info(flow1)
-            #main.log.info("Flow Table 2:")
-            #main.log.info(flow2)
+            main.log.info("Flow Table 1:")
+            main.log.info(flow1)
+            main.log.info("Flow Table 2:")
+            main.log.info(flow2)
             return main.FALSE
 
     def setIpTablesOUTPUT(self, dst_ip, dst_port, action='add', packet_type='tcp',rule='DROP'):
@@ -547,8 +401,8 @@
         Usage:
         * specify action ('add' or 'remove')
           when removing, pass in the same argument as you would add. It will
-          delete that specific rule. 
-        * specify the destination ip to block with dst_ip 
+          delete that specific rule.
+        * specify the destination ip to block with dst_ip
         * specify destination port to block to dst_port
         * optional packet type to block (default tcp)
         * optional iptables rule (default DROP)
@@ -579,8 +433,8 @@
             return
         else:
 
-            #If there is no existing rule in the iptables, we will see an 
-            #'iptables:'... message. We expect to see this message. 
+            #If there is no existing rule in the iptables, we will see an
+            #'iptables:'... message. We expect to see this message.
             #Otherwise, if there IS an existing rule, we will get the prompt
             # back, hence why we expect $ for remove type. We want to remove
             # an already existing rule
@@ -588,7 +442,7 @@
             if action_type == 'add':
                 #NOTE: "iptables:" expect is a result of return from the command
                 #      iptables -C ...
-                #      Any changes by the iptables command return string 
+                #      Any changes by the iptables command return string
                 #      will result in failure of the function. (deemed unlikely
                 #      at the time of writing this function)
                 #Check for existing rules on current input
@@ -620,7 +474,7 @@
                 match_result = main.TRUE
             else:
                 match_result = main.FALSE
-            #If match_result is main.TRUE, it means there is no matching rule. 
+            #If match_result is main.TRUE, it means there is no matching rule.
 
             #If tables does not exist and expected prompt is returned, go ahead and
             #add iptables rule
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 90514d0..838e6f4 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -18,13 +18,10 @@
 '''
 
 import sys
-import time
 import pexpect
 import re
 import traceback
-import os.path
-import pydoc
-import re
+#import os.path
 sys.path.append("../")
 from drivers.common.clidriver import CLI
 
@@ -71,9 +68,9 @@
             main.cleanup()
             main.exit()
         except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.log.info(self.name + ":::::::::::::::::::::::")
             main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.log.info(":::::::::::::::::::::::")
             main.cleanup()
             main.exit()
 
@@ -90,7 +87,7 @@
                 self.handle.expect("Confirm")
                 self.handle.sendline("yes")
                 self.handle.expect("\$")
-            self.handle.sendline("\n")
+            self.handle.sendline("")
             self.handle.expect("\$")
             self.handle.sendline("exit")
             self.handle.expect("closed")
@@ -103,6 +100,34 @@
             response = main.FALSE
         return response
 
+    def logout(self):
+        '''
+        Sends 'logout' command to ONOS cli
+        '''
+        try:
+            self.handle.sendline("")
+            i = self.handle.expect([
+                "onos>",
+                "\$"], timeout=10)
+            if i == 0:
+                self.handle.sendline("logout")
+                self.handle.expect("\$")
+            elif i == 1:
+                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:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
     def set_cell(self, cellname):
         '''
         Calls 'cell <name>' to set the environment variables on ONOSbench
@@ -133,7 +158,7 @@
                 return main.TRUE
 
         except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ": eof exception found")
             main.log.error(self.name + ":    " + self.handle.before)
             main.cleanup()
             main.exit()
@@ -144,10 +169,26 @@
             main.cleanup()
             main.exit()
         
-    def start_onos_cli(self, ONOS_ip):
+    def start_onos_cli(self, ONOS_ip, karafTimeout=""):
+        '''
+        karafTimeout is an optional arugument. karafTimeout value passed by user would be used to set the 
+        current karaf shell idle timeout. Note that when ever this property is modified the shell will exit and
+        the subsequent login would reflect new idle timeout.
+        Below is an example to start a session with 60 seconds idle timeout (input value is in milliseconds):
+          
+        tValue = "60000"
+        main.ONOScli1.start_onos_cli(ONOS_ip, karafTimeout=tValue)
+        
+        Note: karafTimeout is left as str so that this could be read and passed to start_onos_cli from PARAMS file as str.
+        '''
         try:
             self.handle.sendline("")
-            self.handle.expect("\$")
+            x = self.handle.expect([
+                "\$", "onos>"], timeout=10)
+
+            if x == 1:
+                main.log.info("ONOS cli is already running")
+                return main.TRUE
 
             #Wait for onos start (-w) and enter onos cli
             self.handle.sendline("onos -w "+str(ONOS_ip))
@@ -157,15 +198,27 @@
 
             if i == 0:
                 main.log.info(str(ONOS_ip)+" CLI Started successfully")
+                if karafTimeout:
+                    self.handle.sendline("config:property-set -p org.apache.karaf.shell sshIdleTimeout "+karafTimeout)
+                    self.handle.expect("\$")
+                    self.handle.sendline("onos -w "+str(ONOS_ip))
+                    self.handle.expect("onos>")
                 return main.TRUE
             else:
                 #If failed, send ctrl+c to process and try again
                 main.log.info("Starting CLI failed. Retrying...")
-                self.handle.sendline("\x03")
+                self.handle.send("\x03")
                 self.handle.sendline("onos -w "+str(ONOS_ip))
                 i = self.handle.expect(["onos>",pexpect.TIMEOUT],
                         timeout=30)
                 if i == 0:
+                    main.log.info(str(ONOS_ip)+" CLI Started "+
+                        "successfully after retry attempt")
+                    if karafTimeout:
+                        self.handle.sendline("config:property-set -p org.apache.karaf.shell sshIdleTimeout "+karafTimeout)
+                        self.handle.expect("\$")
+                        self.handle.sendline("onos -w "+str(ONOS_ip))
+			self.handle.expect("onos>")
                     return main.TRUE
                 else:
                     main.log.error("Connection to CLI "+\
@@ -388,11 +441,15 @@
         except pexpect.EOF:
             main.log.error(self.name + ": EOF exception found")
             main.log.error(self.name + ":    " + self.handle.before)
+            main.log.report("Failed to install feature")
+            main.log.report("Exiting test")
             main.cleanup()
             main.exit()
         except:
             main.log.info(self.name+" ::::::")
             main.log.error( traceback.print_exc())
+            main.log.report("Failed to install feature")
+            main.log.report("Exiting test")
             main.log.info(self.name+" ::::::")
             main.cleanup()
             main.exit()
@@ -422,27 +479,21 @@
             main.log.info(self.name+" ::::::")
             main.cleanup()
             main.exit()
-        
-    def devices(self, json_format=True, grep_str=""):
+
+    def devices(self, json_format=True):
         '''
         Lists all infrastructure devices or switches
         Optional argument:
-            * grep_str - pass in a string to grep
+            * json_format - boolean indicating if you want output in json
         '''
         try:
             self.handle.sendline("")
             self.handle.expect("onos>")
-            
+
             if json_format:
-                if not grep_str:
-                    self.handle.sendline("devices -j")
-                    self.handle.expect("devices -j")
-                    self.handle.expect("onos>")
-                else:
-                    self.handle.sendline("devices -j | grep '"+
-                        str(grep_str)+"'")
-                    self.handle.expect("devices -j | grep '"+str(grep_str)+"'")
-                    self.handle.expect("onos>")
+                self.handle.sendline("devices -j")
+                self.handle.expect("devices -j")
+                self.handle.expect("onos>")
                 handle = self.handle.before
                 '''
                 handle variable here contains some ANSI escape color code sequences at the end which are invisible in the print command output
@@ -458,13 +509,8 @@
                 #print "repr(handle1) = ", repr(handle1)
                 return handle1
             else:
-                if not grep_str:
-                    self.handle.sendline("devices")
-                    self.handle.expect("onos>")
-                else:
-                    self.handle.sendline("devices | grep '"+
-                        str(grep_str)+"'")
-                    self.handle.expect("onos>")
+                self.handle.sendline("devices")
+                self.handle.expect("onos>")
                 handle = self.handle.before
                 #print "handle =",handle
                 return handle
@@ -480,34 +526,55 @@
             main.cleanup()
             main.exit()
 
-    def links(self, json_format=True, grep_str=""):
+       
+    def balance_masters(self):
+        '''
+        This balances the devices across all controllers
+        by issuing command: 'onos> onos:balance-masters'
+        If required this could be extended to return devices balanced output.
+        '''
+        try:
+            self.handle.sendline("")
+            self.handle.expect("onos>")
+
+            self.handle.sendline("onos:balance-masters")
+            self.handle.expect("onos>")
+            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:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def links(self, json_format=True):
         '''
         Lists all core links
         Optional argument:
-            * grep_str - pass in a string to grep
+            * json_format - boolean indicating if you want output in json
         '''
         try:
             self.handle.sendline("")
             self.handle.expect("onos>")
-            
+
             if json_format:
-                if not grep_str:
-                    self.handle.sendline("links -j")
-                    self.handle.expect("links -j")
-                    self.handle.expect("onos>")
-                else:
-                    self.handle.sendline("links -j | grep '"+
-                        str(grep_str)+"'")
-                    self.handle.expect("links -j | grep '"+str(grep_str)+"'")
-                    self.handle.expect("onos>")
+                self.handle.sendline("links -j")
+                self.handle.expect("links -j")
+                self.handle.expect("onos>")
                 handle = self.handle.before
                 '''
                 handle variable here contains some ANSI escape color code sequences at the end which are invisible in the print command output
                 To make that escape sequence visible, use repr() function. The repr(handle) output when printed shows the ANSI escape sequences.
                 In json.loads(somestring), this somestring variable is actually repr(somestring) and json.loads would fail with the escape sequence.
-                So we take off that escape sequence using 
+                So we take off that escape sequence using
                 ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
-                handle1 = ansi_escape.sub('', handle) 
+                handle1 = ansi_escape.sub('', handle)
                 '''
                 #print "repr(handle) =", repr(handle)
                 ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
@@ -515,17 +582,8 @@
                 #print "repr(handle1) = ", repr(handle1)
                 return handle1
             else:
-                if not grep_str:
-                    self.handle.sendline("links")
-                    self.handle.expect("onos>")
-                    self.handle.sendline("")
-                    self.handle.expect("onos>")
-                else:
-                    self.handle.sendline("links | grep '"+
-                        str(grep_str)+"'")
-                    self.handle.expect("onos>")
-                    self.handle.sendline("")
-                    self.handle.expect("onos>")
+                self.handle.sendline("links")
+                self.handle.expect("onos>")
                 handle = self.handle.before
                 #print "handle =",handle
                 return handle
@@ -542,34 +600,28 @@
             main.exit()
 
 
-    def ports(self, json_format=True, grep_str=""):
+    def ports(self, json_format=True):
         '''
         Lists all ports
         Optional argument:
-            * grep_str - pass in a string to grep
+            * json_format - boolean indicating if you want output in json
         '''
         try:
             self.handle.sendline("")
             self.handle.expect("onos>")
-            
+
             if json_format:
-                if not grep_str:
-                    self.handle.sendline("ports -j")
-                    self.handle.expect("ports -j")
-                    self.handle.expect("onos>")
-                else:
-                    self.handle.sendline("ports -j | grep '"+
-                        str(grep_str)+"'")
-                    self.handle.expect("ports -j | grep '"+str(grep_str)+"'")
-                    self.handle.expect("onos>")
+                self.handle.sendline("ports -j")
+                self.handle.expect("ports -j")
+                self.handle.expect("onos>")
                 handle = self.handle.before
                 '''
                 handle variable here contains some ANSI escape color code sequences at the end which are invisible in the print command output
                 To make that escape sequence visible, use repr() function. The repr(handle) output when printed shows the ANSI escape sequences.
                 In json.loads(somestring), this somestring variable is actually repr(somestring) and json.loads would fail with the escape sequence.
-                So we take off that escape sequence using the following commads: 
+                So we take off that escape sequence using the following commads:
                 ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
-                handle1 = ansi_escape.sub('', handle) 
+                handle1 = ansi_escape.sub('', handle)
                 '''
                 #print "repr(handle) =", repr(handle)
                 ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
@@ -578,20 +630,13 @@
                 return handle1
 
             else:
-                if not grep_str:
-                    self.handle.sendline("ports")
-                    self.handle.expect("onos>")
-                    self.handle.sendline("")
-                    self.handle.expect("onos>")
-                else:
-                    self.handle.sendline("ports | grep '"+
-                        str(grep_str)+"'")
-                    self.handle.expect("onos>")
-                    self.handle.sendline("")
-                    self.handle.expect("onos>")
+                self.handle.sendline("ports")
+                self.handle.expect("onos>")
+                self.handle.sendline("")
+                self.handle.expect("onos>")
                 handle = self.handle.before
                 #print "handle =",handle
-                return handle  
+                return handle
         except pexpect.EOF:
             main.log.error(self.name + ": EOF exception found")
             main.log.error(self.name + ":    " + self.handle.before)
@@ -605,34 +650,32 @@
             main.exit()
 
 
-    def roles(self, json_format=True, grep_str=""):
+    def roles(self, json_format=True):
         '''
         Lists all devices and the controllers with roles assigned to them
         Optional argument:
-            * grep_str - pass in a string to grep
+            * json_format - boolean indicating if you want output in json
         '''
         try:
             self.handle.sendline("")
             self.handle.expect("onos>")
-            
+
             if json_format:
-                if not grep_str:
-                    self.handle.sendline("roles -j")
-                    self.handle.expect("roles -j")
-                    self.handle.expect("onos>")
-                else:
-                    self.handle.sendline("roles -j | grep '"+
-                        str(grep_str)+"'")
-                    self.handle.expect("roles -j | grep '"+str(grep_str)+"'")
-                    self.handle.expect("onos>")
+                self.handle.sendline("roles -j")
+                self.handle.expect("roles -j")
+                self.handle.expect("onos>")
                 handle = self.handle.before
                 '''
-                handle variable here contains some ANSI escape color code sequences at the end which are invisible in the print command output
-                To make that escape sequence visible, use repr() function. The repr(handle) output when printed shows the ANSI escape sequences.
-                In json.loads(somestring), this somestring variable is actually repr(somestring) and json.loads would fail with the escape sequence.
-                So we take off that escape sequence using the following commads: 
+                handle variable here contains some ANSI escape color code sequences at the
+                end which are invisible in the print command output. To make that escape
+                sequence visible, use repr() function. The repr(handle) output when printed
+                shows the ANSI escape sequences. In json.loads(somestring), this somestring
+                variable is actually repr(somestring) and json.loads would fail with the escape
+                sequence.
+
+                So we take off that escape sequence using the following commads:
                 ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
-                handle1 = ansi_escape.sub('', handle) 
+                handle1 = ansi_escape.sub('', handle)
                 '''
                 #print "repr(handle) =", repr(handle)
                 ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
@@ -641,20 +684,13 @@
                 return handle1
 
             else:
-                if not grep_str:
-                    self.handle.sendline("roles")
-                    self.handle.expect("onos>")
-                    self.handle.sendline("")
-                    self.handle.expect("onos>")
-                else:
-                    self.handle.sendline("roles | grep '"+
-                        str(grep_str)+"'")
-                    self.handle.expect("onos>")
-                    self.handle.sendline("")
-                    self.handle.expect("onos>")
+                self.handle.sendline("roles")
+                self.handle.expect("onos>")
+                self.handle.sendline("")
+                self.handle.expect("onos>")
                 handle = self.handle.before
                 #print "handle =",handle
-                return handle  
+                return handle
         except pexpect.EOF:
             main.log.error(self.name + ": EOF exception found")
             main.log.error(self.name + ":    " + self.handle.before)
@@ -702,7 +738,38 @@
             main.log.info(self.name+" ::::::")
             main.cleanup()
             main.exit()
-    
+
+    def roles_not_null(self):
+        '''
+        Iterates through each device and checks if there is a master assigned
+        Returns: main.TRUE if each device has a master
+                 main.FALSE any device has no master
+        '''
+        try:
+            import json
+            raw_roles = self.roles()
+            roles_json = json.loads(raw_roles)
+            #search json for the device with id then return the device
+            for device in roles_json:
+                #print device
+                if device['master'] == "none":
+                    main.log.warn("Device has no master: " + str(device) )
+                    return main.FALSE
+            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:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+
     def paths(self, src_id, dst_id):
         '''
         Returns string of paths, and the cost.
@@ -742,35 +809,29 @@
             main.log.info(self.name+" ::::::")
             main.cleanup()
             main.exit()
-    
-    def hosts(self, json_format=True, grep_str=""):
+
+    def hosts(self, json_format=True):
         '''
-        Lists all discovered hosts 
+        Lists all discovered hosts
         Optional argument:
-            * grep_str - pass in a string to grep
+            * json_format - boolean indicating if you want output in json
         '''
         try:
             self.handle.sendline("")
             self.handle.expect("onos>")
-            
+
             if json_format:
-                if not grep_str:
-                    self.handle.sendline("hosts -j")
-                    self.handle.expect("hosts -j")
-                    self.handle.expect("onos>")
-                else:
-                    self.handle.sendline("hosts -j | grep '"+
-                        str(grep_str)+"'")
-                    self.handle.expect("hosts -j | grep '"+str(grep_str)+"'")
-                    self.handle.expect("onos>")
+                self.handle.sendline("hosts -j")
+                self.handle.expect("hosts -j")
+                self.handle.expect("onos>")
                 handle = self.handle.before
                 '''
                 handle variable here contains some ANSI escape color code sequences at the end which are invisible in the print command output
                 To make that escape sequence visible, use repr() function. The repr(handle) output when printed shows the ANSI escape sequences.
                 In json.loads(somestring), this somestring variable is actually repr(somestring) and json.loads would fail with the escape sequence.
-                So we take off that escape sequence using 
+                So we take off that escape sequence using
                 ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
-                handle1 = ansi_escape.sub('', handle) 
+                handle1 = ansi_escape.sub('', handle)
                 '''
                 #print "repr(handle) =", repr(handle)
                 ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
@@ -778,13 +839,8 @@
                 #print "repr(handle1) = ", repr(handle1)
                 return handle1
             else:
-                if not grep_str:
-                    self.handle.sendline("hosts")
-                    self.handle.expect("onos>")
-                else:
-                    self.handle.sendline("hosts | grep '"+
-                        str(grep_str)+"'")
-                    self.handle.expect("onos>")
+                self.handle.sendline("hosts")
+                self.handle.expect("onos>")
                 handle = self.handle.before
                 #print "handle =",handle
                 return handle
@@ -882,24 +938,24 @@
             * host_id_two: ONOS host id for host2
         Description:
             Adds a host-to-host intent (bidrectional) by
-            specifying the two hosts. 
+            specifying the two hosts.
         '''
         try:
             self.handle.sendline("")
             self.handle.expect("onos>")
-            
+
             self.handle.sendline("add-host-intent "+
                     str(host_id_one) + " " + str(host_id_two))
             self.handle.expect("onos>")
 
             handle = self.handle.before
-            print "handle =", handle
+            #print "handle =", handle
 
-            main.log.info("Intent installed between "+
+            main.log.info("Host intent installed between "+
                     str(host_id_one) + " and " + str(host_id_two))
 
             return handle
-        
+
         except pexpect.EOF:
             main.log.error(self.name + ": EOF exception found")
             main.log.error(self.name + ":    " + self.handle.before)
@@ -948,9 +1004,10 @@
             main.cleanup()
             main.exit()
 
-    def add_point_intent(self, ingress_device, port_ingress,
-            egress_device, port_egress, ethType="", ethSrc="",
-            ethDst="", bandwidth="", lambda_alloc=False):
+    def add_point_intent(self, ingress_device, egress_device,
+            port_ingress="", port_egress="", ethType="", ethSrc="",
+            ethDst="", bandwidth="", lambda_alloc=False, 
+            ipProto="", ipSrc="", ipDst="", tcpSrc="", tcpDst=""):
         '''
         Required:
             * ingress_device: device id of ingress device
@@ -962,6 +1019,11 @@
             * bandwidth: specify bandwidth capacity of link
             * lambda_alloc: if True, intent will allocate lambda 
               for the specified intent
+            * ipProto: specify ip protocol 
+            * ipSrc: specify ip source address
+            * ipDst: specify ip destination address
+            * tcpSrc: specify tcp source port
+            * tcpDst: specify tcp destination port
         Description:
             Adds a point-to-point intent (uni-directional) by
             specifying device id's and optional fields
@@ -975,13 +1037,14 @@
 
             #If there are no optional arguments
             if not ethType and not ethSrc and not ethDst\
-                    and not bandwidth and not lambda_alloc:
-                cmd = "add-point-intent "+\
-                        str(ingress_device) + "/" + str(port_ingress) + " " +\
-                        str(egress_device) + "/" + str(port_egress)
-       
+                    and not bandwidth and not lambda_alloc \
+                    and not ipProto and not ipSrc and not ipDst \
+                    and not tcpSrc and not tcpDst:
+                cmd = "add-point-intent"
+      
+
             else:
-                cmd = "add-point-intent "
+                cmd = "add-point-intent"
                 
                 if ethType:
                     cmd += " --ethType " + str(ethType)
@@ -992,24 +1055,55 @@
                 if bandwidth:
                     cmd += " --bandwidth " + str(bandwidth)
                 if lambda_alloc:
-                    cmd += " --lambda " 
+                    cmd += " --lambda "
+                if ipProto:
+                    cmd += " --ipProto " + str(ipProto)
+                if ipSrc:
+                    cmd += " --ipSrc " + str(ipSrc)
+                if ipDst:
+                    cmd += " --ipDst " + str(ipDst)
+                if tcpSrc:
+                    cmd += " --tcpSrc " + str(tcpSrc)
+                if tcpDst:
+                    cmd += " --tcpDst " + str(tcpDst)
 
-                cmd += " "+str(ingress_device) +\
-                    "/" + str(port_ingress) + " " +\
-                    str(egress_device) + "/" + str(port_egress) 
+            #Check whether the user appended the port 
+            #or provided it as an input
+            if "/" in ingress_device:
+                cmd += " "+str(ingress_device) 
+            else:
+                if not port_ingress:
+                    main.log.error("You must specify "+
+                        "the ingress port")
+                    #TODO: perhaps more meaningful return
+                    return main.FALSE
+
+                cmd += " "+ \
+                    str(ingress_device) + "/" +\
+                    str(port_ingress) + " " 
+
+            if "/" in egress_device:
+                cmd += " "+str(egress_device)
+            else:
+                if not port_egress:
+                    main.log.error("You must specify "+
+                        "the egress port")
+                    return main.FALSE
+                
+                cmd += " "+\
+                    str(egress_device) + "/" +\
+                    str(port_egress)  
 
             self.handle.sendline(cmd)
+            
+            main.log.info(cmd + " sent")
             i = self.handle.expect([
                 "Error",
                 "onos>"])
-          
-            self.handle.sendline("intents")
-            self.handle.expect("onos>")
-            Intenthandle = self.handle.before
 
             if i == 0:
                 main.log.error("Error in adding point-to-point intent")
-                return handle
+                return main.FALSE
             else:
                 return main.TRUE
 
@@ -1025,6 +1119,146 @@
             main.cleanup()
             main.exit()
 
+
+    def add_multipoint_to_singlepoint_intent(self, ingress_device1, ingress_device2,egress_device,
+            port_ingress="", port_egress="", ethType="", ethSrc="",
+            ethDst="", bandwidth="", lambda_alloc=False, 
+            ipProto="", ipSrc="", ipDst="", tcpSrc="", tcpDst="", setEthSrc="", setEthDst=""):
+        '''
+        Note:
+            This function assumes that there would be 2 ingress devices and one egress device
+            For more number of ingress devices, this function needs to be modified
+        Required:
+            * ingress_device1: device id of ingress device1
+            * ingress_device2: device id of ingress device2
+            * egress_device: device id of egress device
+        Optional:
+            * ethType: specify ethType
+            * ethSrc: specify ethSrc (i.e. src mac addr)
+            * ethDst: specify ethDst (i.e. dst mac addr)
+            * bandwidth: specify bandwidth capacity of link
+            * lambda_alloc: if True, intent will allocate lambda 
+              for the specified intent
+            * ipProto: specify ip protocol 
+            * ipSrc: specify ip source address
+            * ipDst: specify ip destination address
+            * tcpSrc: specify tcp source port
+            * tcpDst: specify tcp destination port
+            * setEthSrc: action to Rewrite Source MAC Address
+            * setEthDst: action to Rewrite Destination MAC Address
+        Description:
+            Adds a multipoint-to-singlepoint intent (uni-directional) by
+            specifying device id's and optional fields
+
+        NOTE: This function may change depending on the 
+              options developers provide for multipointpoint-to-singlepoint
+              intent via cli
+        '''
+        try:
+            cmd = ""
+
+            #If there are no optional arguments
+            if not ethType and not ethSrc and not ethDst\
+                    and not bandwidth and not lambda_alloc \
+                    and not ipProto and not ipSrc and not ipDst \
+                    and not tcpSrc and not tcpDst and not setEthSrc and not setEthDst:
+                cmd = "add-multi-to-single-intent"
+      
+
+            else:
+                cmd = "add-multi-to-single-intent"
+                
+                if ethType:
+                    cmd += " --ethType " + str(ethType)
+                if ethSrc:
+                    cmd += " --ethSrc " + str(ethSrc) 
+                if ethDst:    
+                    cmd += " --ethDst " + str(ethDst) 
+                if bandwidth:
+                    cmd += " --bandwidth " + str(bandwidth)
+                if lambda_alloc:
+                    cmd += " --lambda "
+                if ipProto:
+                    cmd += " --ipProto " + str(ipProto)
+                if ipSrc:
+                    cmd += " --ipSrc " + str(ipSrc)
+                if ipDst:
+                    cmd += " --ipDst " + str(ipDst)
+                if tcpSrc:
+                    cmd += " --tcpSrc " + str(tcpSrc)
+                if tcpDst:
+                    cmd += " --tcpDst " + str(tcpDst)
+                if setEthSrc:
+                    cmd += " --setEthSrc "+ str(setEthSrc)
+                if setEthDst:
+                    cmd += " --setEthDst "+ str(setEthDst)
+
+            #Check whether the user appended the port 
+            #or provided it as an input
+            if "/" in ingress_device1:
+                cmd += " "+str(ingress_device1) 
+            else:
+                if not port_ingress1:
+                    main.log.error("You must specify "+
+                        "the ingress port1")
+                    #TODO: perhaps more meaningful return
+                    return main.FALSE
+
+                cmd += " "+ \
+                    str(ingress_device1) + "/" +\
+                    str(port_ingress1) + " " 
+
+            if "/" in ingress_device2:
+                cmd += " "+str(ingress_device2)
+            else:
+                if not port_ingress2:
+                    main.log.error("You must specify "+
+                        "the ingress port2")
+                    #TODO: perhaps more meaningful return
+                    return main.FALSE
+
+                cmd += " "+ \
+                    str(ingress_device2) + "/" +\
+                    str(port_ingress2) + " "
+
+            if "/" in egress_device:
+                cmd += " "+str(egress_device)
+            else:
+                if not port_egress:
+                    main.log.error("You must specify "+
+                        "the egress port")
+                    return main.FALSE
+                
+                cmd += " "+\
+                    str(egress_device) + "/" +\
+                    str(port_egress)  
+            print "cmd= ",cmd
+            self.handle.sendline(cmd)
+            
+            main.log.info(cmd + " sent")
+            i = self.handle.expect([
+                "Error",
+                "onos>"])
+
+            if i == 0:
+                main.log.error("Error in adding point-to-point intent")
+                return self.handle
+            else:
+                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:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+
     def remove_intent(self, intent_id):
         '''
         Remove intent for specified intent id
@@ -1058,7 +1292,47 @@
             main.cleanup()
             main.exit()
 
-    def intents(self, json_format = False):
+    # This method should be used after installing application: onos-app-sdnip
+    def routes(self, json_format=False):
+        '''
+        Optional:
+            * json_format: enable output formatting in json
+        Description:
+            Obtain all routes in the system
+        '''
+        try:
+            if json_format:
+                self.handle.sendline("routes -j")
+                self.handle.expect("routes -j")
+                self.handle.expect("onos>")
+                handle_tmp = self.handle.before
+                
+                ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
+                handle = ansi_escape.sub('', handle_tmp)
+
+            else:
+                self.handle.sendline("")
+                self.handle.expect("onos>")
+
+                self.handle.sendline("routes")
+                self.handle.expect("onos>")
+                handle = self.handle.before
+
+            return handle
+
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name + " ::::::")
+            main.log.error(traceback.print_exc())
+            main.log.info(self.name + " ::::::")
+            main.cleanup()
+            main.exit()
+
+    def intents(self, json_format = True):
         '''
         Optional:
             * json_format: enable output formatting in json
@@ -1096,7 +1370,7 @@
             main.cleanup()
             main.exit()
 
-    def flows(self, json_format = False):
+    def flows(self, json_format = True):
         '''
         Optional:
             * json_format: enable output formatting in json
@@ -1109,6 +1383,8 @@
                 self.handle.expect("flows -j")
                 self.handle.expect("onos>")
                 handle = self.handle.before
+                ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
+                handle = ansi_escape.sub('', handle)
 
             else:
                 self.handle.sendline("")
@@ -1116,6 +1392,8 @@
                 self.handle.sendline("flows")
                 self.handle.expect("onos>")
                 handle = self.handle.before
+            if re.search("Error\sexecuting\scommand:", handle):
+                main.log.error(self.name + ".flows() response: " + str(handle))
 
             return handle
 
@@ -1131,6 +1409,76 @@
             main.cleanup()
             main.exit()
 
+    def push_test_intents(self, dpid_src, dpid_dst, num_intents, 
+            num_mult="", app_id="", report=True):
+        '''
+        Description:
+            Push a number of intents in a batch format to 
+            a specific point-to-point intent definition
+        Required:
+            * dpid_src: specify source dpid
+            * dpid_dst: specify destination dpid
+            * num_intents: specify number of intents to push
+        Optional:
+            * num_mult: number multiplier for multiplying
+              the number of intents specified
+            * app_id: specify the application id init to further
+              modularize the intents
+            * report: default True, returns latency information
+        '''
+        try:
+            cmd = "push-test-intents "+\
+                  str(dpid_src)+" "+str(dpid_dst)+" "+\
+                  str(num_intents)
+            
+            if num_mult:
+                cmd += " " + str(num_mult)
+                #If app id is specified, then num_mult 
+                #must exist because of the way this command
+                #takes in arguments
+                if app_id:
+                    cmd += " " + str(app_id)
+            
+            self.handle.sendline(cmd)
+            self.handle.expect(cmd)
+            self.handle.expect("onos>")
+                
+            handle = self.handle.before
+              
+            #Some color thing that we want to escape
+            ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
+            handle = ansi_escape.sub('', handle)
+    
+            if report:
+                lat_result = []
+                main.log.info(handle)
+                #Split result by newline
+                newline = handle.split("\r\r\n")
+                #Ignore the first object of list, which is empty
+                newline = newline[1:]
+                #Some sloppy parsing method to get the latency
+                for result in newline:
+                    result = result.split(": ")
+                    #Append the first result of second parse
+                    lat_result.append(result[1].split(" ")[0])
+
+                main.log.info(lat_result) 
+                return lat_result 
+            else:
+                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:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
     def intents_events_metrics(self, json_format=True):
         '''
         Description:Returns topology metrics 
@@ -1444,7 +1792,7 @@
         onos_node is the ip of one of the onos nodes in the cluster
         role must be either master, standby, or none
 
-        Returns main.TRUE or main.FALSE based argument varification.
+        Returns main.TRUE or main.FALSE based on argument verification.
             When device-role supports errors this should be extended to
             support that output
         '''
@@ -1487,5 +1835,282 @@
             main.cleanup()
             main.exit()
 
+    def clusters(self, json_format=True):
+        '''
+        Lists all clusters
+        Optional argument:
+            * json_format - boolean indicating if you want output in json
+        '''
+        try:
+            self.handle.sendline("")
+            self.handle.expect("onos>")
+
+            if json_format:
+                self.handle.sendline("clusters -j")
+                self.handle.expect("clusters -j")
+                self.handle.expect("onos>")
+                handle = self.handle.before
+                '''
+                handle variable here contains some ANSI escape color code
+                sequences at the end which are invisible in the print command
+                output. To make that escape sequence visible, use repr() function.
+                The repr(handle) output when printed shows the ANSI escape sequences.
+                In json.loads(somestring), this somestring variable is actually
+                repr(somestring) and json.loads would fail with the escape sequence.
+                So we take off that escape sequence using
+                ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
+                handle1 = ansi_escape.sub('', handle)
+                '''
+                #print "repr(handle) =", repr(handle)
+                ansi_escape = re.compile(r'\r\r\n\x1b[^m]*m')
+                handle1 = ansi_escape.sub('', handle)
+                #print "repr(handle1) = ", repr(handle1)
+                return handle1
+            else:
+                self.handle.sendline("clusters")
+                self.handle.expect("onos>")
+                handle = self.handle.before
+                #print "handle =",handle
+                return handle
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def election_test_leader(self):
+        '''
+         * CLI command to get the current leader for the Election test application.
+         #NOTE: Requires installation of the onos-app-election feature
+         Returns: Node IP of the leader if one exists
+                  None if none exists
+                  Main.FALSE on error
+        '''
+        try:
+            self.handle.sendline("election-test-leader")
+            self.handle.expect("election-test-leader")
+            self.handle.expect("onos>")
+            response = self.handle.before
+            #Leader
+            node_search = re.search("The\scurrent\sleader\sfor\sthe\sElection\sapp\sis\s(?P<node>.+)\.", response)
+            if node_search:
+                node = node_search.group('node')
+                main.log.info("Election-test-leader on "+str(self.name)+" found " + node + " as the leader")
+                return node
+            #no leader
+            null_search = re.search("There\sis\scurrently\sno\sleader\selected\sfor\sthe\sElection\sapp", response)
+            if null_search:
+                main.log.info("Election-test-leader found no leader on " + self.name )
+                return None
+            #error
+            if re.search("Command\snot\sfound", response):
+                main.log.error("Election app is not loaded on " + self.name)
+                return main.FALSE
+            else:
+                main.log.error("Error in election_test_leader: unexpected response")
+                main.log.error( repr(response) )
+                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:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def election_test_run(self):
+        '''
+         * CLI command to run for leadership of the Election test application.
+         #NOTE: Requires installation of the onos-app-election feature
+         Returns: Main.TRUE on success
+                  Main.FALSE on error
+        '''
+        try:
+            self.handle.sendline("election-test-run")
+            self.handle.expect("election-test-run")
+            self.handle.expect("onos>")
+            response = self.handle.before
+            #success
+            search = re.search("Entering\sleadership\selections\sfor\sthe\sElection\sapp.", response)
+            if search:
+                main.log.info(self.name + " entering leadership elections for the Election app.")
+                return main.TRUE
+            #error
+            if re.search("Command\snot\sfound", response):
+                main.log.error("Election app is not loaded on " + self.name)
+                return main.FALSE
+            else:
+                main.log.error("Error in election_test_run: unexpected response")
+                main.log.error( repr(response) )
+                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:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def election_test_withdraw(self):
+        '''
+         * CLI command to withdraw the local node from leadership election for
+         * the Election test application.
+         #NOTE: Requires installation of the onos-app-election feature
+         Returns: Main.TRUE on success
+                  Main.FALSE on error
+        '''
+        try:
+            self.handle.sendline("election-test-withdraw")
+            self.handle.expect("election-test-withdraw")
+            self.handle.expect("onos>")
+            response = self.handle.before
+            #success
+            search = re.search("Withdrawing\sfrom\sleadership\selections\sfor\sthe\sElection\sapp.", response)
+            if search:
+                main.log.info(self.name + " withdrawing from leadership elections for the Election app.")
+                return main.TRUE
+            #error
+            if re.search("Command\snot\sfound", response):
+                main.log.error("Election app is not loaded on " + self.name)
+                return main.FALSE
+            else:
+                main.log.error("Error in election_test_withdraw: unexpected response")
+                main.log.error( repr(response) )
+                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:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
 
     #***********************************
+    def getDevicePortsEnabledCount(self,dpid):
+        '''
+        Get the count of all enabled ports on a particular device/switch
+        '''
+        try:
+            dpid = str(dpid)
+            self.handle.sendline("")
+            self.handle.expect("onos>")
+
+            self.handle.sendline("onos:ports -e "+dpid+" | wc -l")
+            i = self.handle.expect([
+                "No such device",
+                "onos>"])
+            
+            #self.handle.sendline("")
+            #self.handle.expect("onos>")
+
+            output = self.handle.before
+
+            if i == 0:
+                main.log.error("Error in getting ports")
+                return (output, "Error")
+            else:
+                result = output
+                return result
+        
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def getDeviceLinksActiveCount(self,dpid):
+        '''
+        Get the count of all enabled ports on a particular device/switch
+        '''
+        try:
+            dpid = str(dpid)
+            self.handle.sendline("")
+            self.handle.expect("onos>")
+
+            self.handle.sendline("onos:links "+dpid+" | grep ACTIVE | wc -l")
+            i = self.handle.expect([
+                "No such device",
+                "onos>"])
+
+            output = self.handle.before
+
+            if i == 0:
+                main.log.error("Error in getting ports")
+                return (output, "Error")
+            else:
+                result = output
+                return result
+        
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+    def getAllIntentIds(self):
+        '''
+        Return a list of all Intent IDs
+        '''
+        try:
+            self.handle.sendline("")
+            self.handle.expect("onos>")
+
+            self.handle.sendline("onos:intents | grep id=")
+            i = self.handle.expect([
+                "Error",
+                "onos>"])
+
+            output = self.handle.before
+
+            if i == 0:
+                main.log.error("Error in getting ports")
+                return (output, "Error")
+            else:
+                result = output
+                return result
+        
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 875707b..c8713e5 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -20,10 +20,8 @@
 import sys
 import time
 import pexpect
-import re
 import traceback
 import os.path
-import pydoc
 sys.path.append("../")
 from drivers.common.clidriver import CLI
 
@@ -82,7 +80,7 @@
         '''
         response = ''
         try:
-            self.handle.sendline("\n")
+            self.handle.sendline("")
             self.handle.expect("\$")
             self.handle.sendline("exit")
             self.handle.expect("closed")
@@ -103,7 +101,7 @@
         try:
             self.handle.sendline("onos-package")
             self.handle.expect("onos-package")
-            self.handle.expect("tar.gz",timeout=10)
+            self.handle.expect("tar.gz",timeout=30)
             handle = str(self.handle.before)
             main.log.info("onos-package command returned: "+
                     handle)
@@ -164,7 +162,7 @@
             self.handle.sendline("cd "+ self.home)
             self.handle.expect("\$")
 
-            self.handle.sendline("\n")
+            self.handle.sendline("")
             self.handle.expect("\$")
             self.handle.sendline("mvn clean install")
             self.handle.expect("mvn clean install")
@@ -195,7 +193,7 @@
                     for line in self.handle.before.splitlines():
                         if "Total time:" in line:
                             main.log.info(line)
-                    self.handle.sendline("\n")
+                    self.handle.sendline("")
                     self.handle.expect("\$", timeout=60)
                     return main.TRUE
                 elif i == 4:
@@ -224,12 +222,12 @@
     def git_pull(self, comp1=""):
         '''
         Assumes that "git pull" works without login
-        
+
         This function will perform a git pull on the ONOS instance.
         If used as git_pull("NODE") it will do git pull + NODE. This is
         for the purpose of pulling from other nodes if necessary.
 
-        Otherwise, this function will perform a git pull in the 
+        Otherwise, this function will perform a git pull in the
         ONOS repository. If it has any problems, it will return main.ERROR
         If it successfully does a git_pull, it will return a 1 (main.TRUE)
         If it has no updates, it will return 3.
@@ -244,14 +242,13 @@
                 self.handle.sendline("git pull")
             else:
                 self.handle.sendline("git pull " + comp1)
-           
-            uptodate = 0
+
             i=self.handle.expect(['fatal',
                 'Username\sfor\s(.*):\s',
                 '\sfile(s*) changed,\s',
                 'Already up-to-date',
                 'Aborting',
-                'You\sare\snot\scurrently\son\sa\sbranch', 
+                'You\sare\snot\scurrently\son\sa\sbranch',
                 'You\sasked\sme\sto\spull\swithout\stelling\sme\swhich\sbranch\syou',
                 'Pull\sis\snot\spossible\sbecause\syou\shave\sunmerged\sfiles',
                 pexpect.TIMEOUT],
@@ -392,10 +389,11 @@
             self.handle.sendline("export TERM=xterm-256color")
             self.handle.expect("xterm-256color")
             self.handle.expect("\$")
-            self.handle.sendline("\n")
+            self.handle.sendline("")
             self.handle.expect("\$")
             self.handle.sendline("cd " + self.home + "; git log -1 --pretty=fuller --decorate=short | grep -A 6 \"commit\" --color=never")
-            self.handle.expect("--color=never")
+            #NOTE: for some reason there are backspaces inserted in this phrase when run from Jenkins on some tests
+            self.handle.expect("never")
             self.handle.expect("\$")
             response=(self.name +": \n"+ str(self.handle.before + self.handle.after))
             self.handle.sendline("cd " + self.home)
@@ -405,13 +403,23 @@
                 print line
             if report:
                 for line in lines[2:-1]:
-                    main.log.report(line)
+                    #Bracket replacement is for Wiki-compliant
+                    #formatting. '<' or '>' are interpreted 
+                    #as xml specific tags that cause errors
+                    line = line.replace("<","[")
+                    line = line.replace(">","]")
+                    main.log.report("\t" + line)
             return lines[2]
         except pexpect.EOF:
             main.log.error(self.name + ": EOF exception found")
             main.log.error(self.name + ":     " + self.handle.before)
             main.cleanup()
             main.exit()
+        except pexpect.TIMEOUT:
+            main.log.error(self.name + ": TIMEOUT exception found")
+            main.log.error(self.name + ":     " + self.handle.before)
+            main.cleanup()
+            main.exit()
         except:
             main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
             main.log.error( traceback.print_exc() )
@@ -445,15 +453,12 @@
         #Create the cell file in the directory for writing (w+)
         cell_file = open(temp_directory+file_name , 'w+')
        
-        comment = ""
-        comment_string = "#"+ comment
         #Feature string is hardcoded environment variables
         #That you may wish to use by default on startup.
         #Note that you  may not want certain features listed
         #on here.
         core_feature_string = "export ONOS_FEATURES=webconsole,onos-api,"+\
-                "onos-cli,onos-openflow,onos-app-mobility,onos-app-tvue,"+\
-                "onos-app-proxyarp,"+extra_feature_string
+                "onos-cli,onos-openflow,"+extra_feature_string
         mn_string = "export OCN="
         onos_string = "export OC"
         temp_count = 1
@@ -615,8 +620,8 @@
 
             handle_before = self.handle.before
             print "handle_before = ", self.handle.before
-            handle_after = str(self.handle.after)
-            
+            #handle_after = str(self.handle.after)
+
             #self.handle.sendline("")
             #self.handle.expect("\$")
             #handle_more = str(self.handle.before)
@@ -655,11 +660,15 @@
         Returns: main.TRUE on success and main.FALSE on failure
         '''
         try:
-            self.handle.sendline("onos-install " + options + " " + node)
+            if options:
+                self.handle.sendline("onos-install " + options + " " + node)
+            else:
+                self.handle.sendline("onos-install "+node)
             self.handle.expect("onos-install ")
             #NOTE: this timeout may need to change depending on the network and size of ONOS
             i=self.handle.expect(["Network\sis\sunreachable",
                 "onos\sstart/running,\sprocess",
+                "ONOS\sis\salready\sinstalled",
                 pexpect.TIMEOUT],timeout=60)
 
             if i == 0:
@@ -668,10 +677,14 @@
             elif i == 1:
                 main.log.info("ONOS was installed on " + node + " and started")
                 return main.TRUE
-            elif i == 2: 
+            elif i == 2:
+                main.log.info("ONOS is already installed on "+node)
+                return main.TRUE
+            elif i == 3: 
                 main.log.info("Installation of ONOS on " + node + " timed out")
                 return main.FALSE
 
+    
         except pexpect.EOF:
             main.log.error(self.name + ": EOF exception found")
             main.log.error(self.name + ":    " + self.handle.before)
@@ -760,8 +773,8 @@
             main.log.info(self.name+" ::::::")
             main.cleanup()
             main.exit()
-
-    def onos_uninstall(self):
+    
+    def onos_uninstall(self, node_ip=""):
         '''
         Calls the command: 'onos-uninstall'
         Uninstalls ONOS from the designated cell machine, stopping 
@@ -770,10 +783,11 @@
         try:
             self.handle.sendline("")
             self.handle.expect("\$")
-            self.handle.sendline("onos-uninstall")
+            self.handle.sendline( "onos-uninstall "+str(node_ip) )
             self.handle.expect("\$")
 
-            main.log.info("ONOS cell machine was uninstalled")
+            main.log.info("ONOS "+node_ip+" was uninstalled")
+
             #onos-uninstall command does not return any text
             return main.TRUE
 
@@ -789,6 +803,40 @@
             main.cleanup()
             main.exit()
 
+    def onos_die(self, node_ip):
+        '''
+        Issues the command 'onos-die <node-ip>'
+        This command calls onos-kill and also stops the node
+        '''
+        try:
+            self.handle.sendline("")
+            self.handle.expect("\$")
+            cmd_str = "onos-kill "+str(node_ip)
+            self.handle.sendline(cmd_str)
+            i = self.handle.expect([
+                "Killing\sONOS",
+                "ONOS\sprocess\sis\snot\srunning",
+                pexpect.TIMEOUT], timeout=20)
+            if i == 0:
+                main.log.info("ONOS instance "+str(node_ip)+
+                    " was killed and stopped")
+                return main.TRUE
+            elif i == 1:
+                main.log.info("ONOS process was not running")
+                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:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
+
     def onos_kill(self, node_ip):
         '''
         Calls the command: 'onos-kill [<node-ip>]'
@@ -832,6 +880,43 @@
             main.cleanup()
             main.exit()
 
+    def onos_remove_raft_logs(self):
+        '''
+        Removes Raft / Copy cat files from ONOS to ensure
+        a cleaner environment.
+
+        Description:
+            Stops all ONOS defined in the cell,
+            wipes the raft / copycat log files
+        '''
+        try:
+            self.handle.sendline("")
+            self.handle.expect("\$")
+            self.handle.sendline("onos-remove-raft-logs")
+            #Sometimes this command hangs
+            i = self.handle.expect(["\$", pexpect.TIMEOUT],
+                    timeout=120)
+            if i == 1:
+                i = self.handle.expect(["\$", pexpect.TIMEOUT],
+                        timeout=120)
+                if i == 1:
+                    return main.FALSE
+            self.handle.sendline("")
+            self.handle.expect("\$")
+            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:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
+
     def onos_start_network(self, mntopo):
         '''
         Calls the command 'onos-start-network [<mininet-topo>]
@@ -883,14 +968,15 @@
             self.handle.sendline("onos-wait-for-start " + node )
             self.handle.expect("onos-wait-for-start")
             #NOTE: this timeout is arbitrary"
-            i = self.handle.expect(["\$", pexpect.TIMEOUT], timeout = 300)
+            i = self.handle.expect(["\$", pexpect.TIMEOUT], timeout = 120)
             if i == 0:
                 main.log.info(self.name + ": " + node + " is up")
                 return main.TRUE
             elif i == 1:
                 #NOTE: since this function won't return until ONOS is ready,
                 #   we will kill it on timeout
-                self.handle.sendline("\003")    #Control-C
+                main.log.error("ONOS has not started yet")
+                self.handle.send("\x03")    #Control-C
                 self.handle.expect("\$")
                 return main.FALSE
         except pexpect.EOF:
@@ -905,6 +991,61 @@
             main.cleanup()
             main.exit()
 
+    def push_test_intents_shell(self, dpid_src, dpid_dst, num_intents,
+            dir_file, onos_ip, num_mult="", app_id="", report=True,
+            options=""):    
+        '''  
+        Description:
+            Use the linux prompt to push test intents to 
+            better parallelize the results than the CLI
+        Required:
+            * dpid_src: specify source dpid
+            * dpid_dst: specify destination dpid
+            * num_intents: specify number of intents to push
+            * dir_file: specify directory and file name to save
+              results
+            * onos_ip: specify the IP of ONOS to install on
+        NOTE: 
+            You must invoke this command at linux shell prompt
+        '''
+        try: 
+            #Create the string to sendline 
+            if options:
+                base_cmd = "onos "+str(onos_ip)+" push-test-intents "+\
+                options+" "
+            else:
+                base_cmd = "onos "+str(onos_ip)+" push-test-intents "
+            
+            add_dpid = base_cmd + str(dpid_src) + " " + str(dpid_dst)  
+            if not num_mult:
+                add_intents = add_dpid + " " + str(num_intents)
+            elif num_mult:
+                add_intents = add_dpid + " " + str(num_intents) + " " +\
+                              str(num_mult)
+                if app_id:
+                    add_app = add_intents + " " + str(app_id) 
+                else:
+                    add_app = add_intents
+
+            if report:
+                send_cmd = add_app + " > " + str(dir_file) + " &" 
+            else:
+                send_cmd = add_app + " &"
+            main.log.info("Send cmd: "+send_cmd)
+
+            self.handle.sendline(send_cmd)
+
+        except pexpect.EOF:
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+            main.cleanup()
+            main.exit()
+        except:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit() 
 
     def get_topology(self,topology_output):
         '''
@@ -926,21 +1067,21 @@
                 if not line.startswith("time="):
                     continue
                 #else
-                print line
+                #print line
                 for var in line.split(","):
                     #print "'"+var+"'"
                     #print "'"+var.strip()+"'"
                     key, value = var.strip().split("=")
                     topology[key] = value
-            print "topology = ", topology
-            devices = topology.get('devices', False)
-            print "devices = ", devices
-            links = topology.get('links', False)
-            print "links = ", links
-            clusters = topology.get('clusters', False)
-            print "clusters = ", clusters
-            paths = topology.get('paths', False)
-            print "paths = ", paths
+            #print "topology = ", topology
+            #devices = topology.get('devices', False)
+            #print "devices = ", devices
+            #links = topology.get('links', False)
+            #print "links = ", links
+            #SCCs = topology.get('SCC(s)', False)
+            #print "SCCs = ", SCCs
+            #paths = topology.get('paths', False)
+            #print "paths = ", paths
 
             return topology
         except pexpect.EOF:
@@ -1032,29 +1173,37 @@
         self.handle.expect("\$")
 
         self.handle.sendline("tshark -i "+str(interface)+
-                " -t e -w "+str(dir_file))
+                " -t e -w "+str(dir_file)+ " &")
+        self.handle.sendline("\r")
         self.handle.expect("Capturing on")
+        self.handle.sendline("\r")
+        self.handle.expect("\$")
 
         main.log.info("Tshark started capturing files on "+
                 str(interface)+ " and saving to directory: "+
-                str(dir_File))
+                str(dir_file))
 
 
-    def run_onos_topo_cfg(self):
+    def run_onos_topo_cfg(self, instance_name, json_file):
         '''
-         On ONOS bench, run this command: ./~/ONOS/tools/test/bin/onos-topo-cfg
+         On ONOS bench, run this command: ./~/ONOS/tools/test/bin/onos-topo-cfg $OC1 filename
             which starts the rest and copies the json file to the onos instance
         '''
-        self.handle.sendline("")
-        self.handle.expect("\$")
-        self.handle.sendline("cd ~/ONOS/tools/test/bin")
-        self.handle.expect("/bin$")
-        self.handle.sendline("./onos-topo-cfg")
-        self.handle.expect("{}admin@onosTestBench")
-        self.handle.sendline("cd ~")
-        self.handle.expect("\$")
-
-
+        try:
+            self.handle.sendline("")
+            self.handle.expect("\$")
+            self.handle.sendline("cd ~/ONOS/tools/test/bin")
+            self.handle.expect("/bin$")
+            cmd = "./onos-topo-cfg " +instance_name +" " +json_file
+            print "cmd = ", cmd
+            self.handle.sendline(cmd)
+            self.handle.expect("\$")
+            self.handle.sendline("cd ~")
+            self.handle.expect("\$")
+            return main.TRUE
+        except:
+            return main.FALSE
+            
     def tshark_grep(self, grep, directory, interface='eth0'):
         '''
         Required:
@@ -1129,4 +1278,117 @@
             main.cleanup()
             main.exit()
 
+    def cp_logs_to_dir(self, log_to_copy, 
+            dest_dir, copy_file_name=""):
+        '''
+        Copies logs to a desired directory. 
+        Current implementation of ONOS deletes its karaf
+        logs on every iteration. For debugging purposes,
+        you may want to use this function to capture 
+        certain karaf logs. (or any other logs if needed)
+        Localtime will be attached to the filename
 
+        Required:
+            * log_to_copy: specify directory and log name to
+              copy.
+              ex) /opt/onos/log/karaf.log.1
+              For copying multiple files, leave copy_file_name
+              empty and only specify dest_dir - 
+              ex) /opt/onos/log/karaf*
+            * dest_dir: specify directory to copy to.
+              ex) /tmp/
+        Optional:   
+            * copy_file_name: If you want to rename the log
+              file, specify copy_file_name. This will not work
+              with multiple file copying
+        '''
+        try:
+            localtime = time.strftime('%x %X')
+            localtime = localtime.replace("/","")
+            localtime = localtime.replace(" ","_")
+            localtime = localtime.replace(":","")
+            if dest_dir[-1:] != "/":
+                dest_dir += "/"
+
+            if copy_file_name:
+                self.handle.sendline("cp "+str(log_to_copy)+
+                        " "+str(dest_dir)+str(copy_file_name)+
+                        localtime)
+                self.handle.expect("cp")
+                self.handle.expect("\$")
+            else:
+                self.handle.sendline("cp "+str(log_to_copy)+
+                        " "+str(dest_dir))
+                self.handle.expect("cp")
+                self.handle.expect("\$")
+                
+            return self.handle.before
+        
+        except pexpect.EOF:
+            main.log.error("Copying files failed")
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+        except:
+            main.log.error("Copying files failed")
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+
+    def check_logs(self, onos_ip):
+        '''
+        runs onos-check-logs on the given onos node
+        returns the response
+        '''
+        try:
+            cmd = "onos-check-logs " + str(onos_ip)
+            self.handle.sendline(cmd)
+            self.handle.expect(cmd)
+            self.handle.expect("\$")
+            response = self.handle.before
+            return response
+        except pexpect.EOF:
+            main.log.error("Lost ssh connection")
+            main.log.error(self.name + ": EOF exception found")
+            main.log.error(self.name + ":    " + self.handle.before)
+        except:
+            main.log.error("Some error in check_logs:")
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+
+    def onos_status(self, node=""):
+        '''
+        Calls onos command: 'onos-service [<node-ip>] status'
+        '''
+
+        try:
+            self.handle.sendline("")
+            self.handle.expect("\$")
+            self.handle.sendline("onos-service "+str(node)+
+                " status")
+            i = self.handle.expect([
+                "start/running",
+                "stop/waiting",
+                pexpect.TIMEOUT],timeout=120)
+
+            if i == 0:
+                main.log.info("ONOS is running")
+                return main.TRUE
+            elif i == 1:
+                main.log.info("ONOS is stopped")
+                return main.FALSE
+            else:
+                main.log.error("ONOS service failed to check the status")
+                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:
+            main.log.info(self.name+" ::::::")
+            main.log.error( traceback.print_exc())
+            main.log.info(self.name+" ::::::")
+            main.cleanup()
+            main.exit()
diff --git a/TestON/drivers/common/cli/quaggaclidriver.py b/TestON/drivers/common/cli/quaggaclidriver.py
index 744d284..8314941 100644
--- a/TestON/drivers/common/cli/quaggaclidriver.py
+++ b/TestON/drivers/common/cli/quaggaclidriver.py
@@ -14,28 +14,62 @@
     def __init__(self):
         super(CLI, self).__init__()
 
+    # TODO: simplify this method
     def connect(self, **connectargs):
         for key in connectargs:
             vars(self)[key] = connectargs[key]
-        
-        self.name = self.options['name']
-        self.handle = super(QuaggaCliDriver,self).connect(user_name = self.user_name, ip_address = self.ip_address,port = self.port, pwd = self.pwd)
 
-        if self.handle: 
-            self.handle.expect("")
-            self.handle.expect("\$")
+        self.name = self.options['name']
+        # self.handle = super(QuaggaCliDriver,self).connect(user_name = self.user_name, ip_address = self.ip_address,port = self.port, pwd = self.pwd)
+        self.handle = super(QuaggaCliDriver, self).connect(user_name=self.user_name, ip_address="1.1.1.1", port=self.port, pwd=self.pwd)
+        main.log.info("connect parameters:" + str(self.user_name) + ";" + str(self.ip_address) + ";" + str(self.port) + ";" + str(self.pwd))
+
+        if self.handle:
+            #self.handle.expect("",timeout=10)
+            #self.handle.expect("\$",timeout=10)
             self.handle.sendline("telnet localhost 2605")
-            self.handle.expect("Password:", timeout = 5)
+            #self.handle.expect("Password:", timeout=5)
+            self.handle.expect("Password:")
             self.handle.sendline("hello")
-            self.handle.expect("bgpd",timeout = 5)
+            #self.handle.expect("bgpd", timeout=5)
+            self.handle.expect("bgpd")
             self.handle.sendline("enable")
-            self.handle.expect("bgpd#", timeout = 5)
+            #self.handle.expect("bgpd#", timeout=5)
+            self.handle.expect("bgpd#")
             return self.handle
         else :
             main.log.info("NO HANDLE")
             return main.FALSE
 
+    def loginQuagga(self, ip_address):
+        self.name = self.options['name']
+        self.handle = super(QuaggaCliDriver, self).connect(
+            user_name=self.user_name, ip_address=ip_address,
+            port=self.port, pwd=self.pwd)
+        main.log.info("connect parameters:" + str(self.user_name) + ";"
+        + str(self.ip_address) + ";" + str(self.port) + ";" + str(self.pwd))
+
+        if self.handle:
+            #self.handle.expect("")
+            #self.handle.expect("\$")
+            self.handle.sendline("telnet localhost 2605")
+            #self.handle.expect("Password:", timeout=5)
+            self.handle.expect("Password:")
+            self.handle.sendline("hello")
+            #self.handle.expect("bgpd", timeout=5)
+            self.handle.expect("bgpd")
+            self.handle.sendline("enable")
+            #self.handle.expect("bgpd#", timeout=5)
+            self.handle.expect("bgpd#")
+            main.log.info("I in quagga on host " + str(ip_address))
+
+            return self.handle
+        else:
+            main.log.info("NO HANDLE")
+            return main.FALSE
+
     def enter_config(self, asn):
+        main.log.info("I am in enter_config method!")
         try:
             self.handle.sendline("")
             self.handle.expect("bgpd#")
@@ -44,14 +78,259 @@
             self.disconnect()
             return main.FALSE
         self.handle.sendline("configure terminal")
-        self.handle.expect("config", timeout = 5)
+        self.handle.expect("config", timeout=5)
         routerAS = "router bgp " + str(asn)
         try:
             self.handle.sendline(routerAS)
-            self.handle.expect("config-router", timeout = 5)
+            self.handle.expect("config-router", timeout=5)
             return main.TRUE
         except:
             return main.FALSE
+
+    def generate_prefixes(self, net, numRoutes):
+        main.log.info("I am in generate_prefixes method!")
+
+        # each IP prefix will be composed by "net" + "." + m + "." + n + "." + x
+        # the length of each IP prefix is 24
+        routes = []
+        routes_gen = 0
+        m = numRoutes / 256
+        n = numRoutes % 256
+
+        for i in range(0, m):
+            for j in range(0, 256):
+                network = str(net) + "." + str(i) + "." + str(j) + ".0/24"
+                routes.append(network)
+                routes_gen = routes_gen + 1
+
+        for j in range(0, n):
+            network = str(net) + "." + str(m) + "." + str(j) + ".0/24"
+            routes.append(network)
+            routes_gen = routes_gen + 1
+
+        if routes_gen == numRoutes:
+            main.log.info("Successfully generated " + str(numRoutes)
+            + " prefixes!")
+            return routes
+        return main.FALSE
+
+    # This method generates a multiple to single point intent(MultiPointToSinglePointIntent) for a given route
+    def generate_expected_singleRouteIntent(self, prefix, nextHop, nextHopMac, sdnip_data):
+
+        ingress = []
+        egress = ""
+        for peer in sdnip_data['bgpPeers']:
+            if peer['ipAddress'] == nextHop:
+                egress = "of:" + str(peer['attachmentDpid']).replace(":", "") + ":" + str(peer['attachmentPort'])
+            else:
+                ingress.append("of:" + str(peer['attachmentDpid']).replace(":", "") + ":" + str(peer['attachmentPort']))
+
+        selector = "ETH_TYPE{ethType=800},IPV4_DST{ip=" + prefix + "}"
+        treatment = "[ETH_DST{mac=" + str(nextHopMac) + "}]"
+
+        intent = egress + "/" + str(sorted(ingress)) + "/" + selector + "/" + treatment
+        return intent
+
+    def generate_expected_onePeerRouteIntents(self, prefixes, nextHop, nextHopMac, sdnip_json_file_path):
+        intents = []
+        sdnip_json_file = open(sdnip_json_file_path).read()
+
+        sdnip_data = json.loads(sdnip_json_file)
+
+        for prefix in prefixes:
+            intents.append(self.generate_expected_singleRouteIntent(prefix, nextHop, nextHopMac, sdnip_data))
+        return sorted(intents)
+
+    # TODO
+    # This method generates all expected route intents for all BGP peers
+    def generate_expected_routeIntents(self):
+        intents = []
+        return intents
+
+    # This method extracts all actual routes from ONOS CLI
+    def extract_actual_routes(self, get_routes_result):
+        routes_json_obj = json.loads(get_routes_result)
+
+        allRoutes_actual = []
+        for route in routes_json_obj:
+            if route['prefix'] == '172.16.10.0/24':
+                continue
+            allRoutes_actual.append(route['prefix'] + "/" + route['nextHop'])
+
+        return sorted(allRoutes_actual)
+
+    # This method extracts all actual route intents from ONOS CLI
+    def extract_actual_routeIntents(self, get_intents_result):
+        intents = []
+        # TODO: delete the line below when change to Mininet demo script
+        # get_intents_result=open("../tests/SdnIpTest/intents.json").read()
+        intents_json_obj = json.loads(get_intents_result)
+
+        for intent in intents_json_obj:
+            if intent['appId'] != "org.onosproject.sdnip" :
+                continue
+            if intent['type'] == "MultiPointToSinglePointIntent" and intent['state'] == 'INSTALLED':
+                egress = str(intent['egress']['device']) + ":" + str(intent['egress']['port'])
+                ingress = []
+                for attachmentPoint in intent['ingress']:
+                    ingress.append(str(attachmentPoint['device']) + ":" + str(attachmentPoint['port']))
+
+                selector = intent['selector'].replace("[" , "").replace("]" , "").replace(" ", "")
+                if str(selector).startswith("IPV4"):
+                    str1, str2 = str(selector).split(",")
+                    selector = str2 + "," + str1
+
+                intent = egress + "/" + str(sorted(ingress)) + "/" + selector + "/" + intent['treatment']
+                intents.append(intent)
+        return sorted(intents)
+
+    # This method extracts all actual BGP intents from ONOS CLI
+    def extract_actual_bgpIntents(self, get_intents_result):
+        intents = []
+        # TODO: delete the line below when change to Mininet demo script
+        # get_intents_result=open("../tests/SdnIpTest/intents.json").read()
+        intents_json_obj = json.loads(get_intents_result)
+
+        for intent in intents_json_obj:
+            if intent['appId'] != "org.onosproject.sdnip":
+                continue
+            if intent['type'] == "PointToPointIntent" and "protocol=6" in str(intent['selector']):
+                ingress = str(intent['ingress']['device']) + ":" + str(intent['ingress']['port'])
+                egress = str(intent['egress']['device']) + ":" + str(intent['egress']['port'])
+                selector = str(intent['selector']).replace(" ", "").replace("[", "").replace("]", "").split(",")
+                intent = ingress + "/" + egress + "/" + str(sorted(selector))
+                intents.append(intent)
+
+        return sorted(intents)
+
+    # This method generates a single point to single point intent(PointToPointIntent) for BGP path
+    def generate_expected_bgpIntents(self, sdnip_json_file_path):
+        from operator import eq
+
+        sdnip_json_file = open(sdnip_json_file_path).read()
+        sdnip_data = json.loads(sdnip_json_file)
+
+        intents = []
+        bgpPeerAttachmentPoint = ""
+        bgpSpeakerAttachmentPoint = "of:" + str(sdnip_data['bgpSpeakers'][0]['attachmentDpid']).replace(":", "") + ":" + str(sdnip_data['bgpSpeakers'][0]['attachmentPort'])
+        for peer in sdnip_data['bgpPeers']:
+            bgpPeerAttachmentPoint = "of:" + str(peer['attachmentDpid']).replace(":", "") + ":" + str(peer['attachmentPort'])
+            # find out the BGP speaker IP address for this BGP peer
+            bgpSpeakerIpAddress = ""
+            for interfaceAddress in sdnip_data['bgpSpeakers'][0]['interfaceAddresses']:
+                # if eq(interfaceAddress['interfaceDpid'],sdnip_data['bgpSpeakers'][0]['attachmentDpid']) and eq(interfaceAddress['interfacePort'], sdnip_data['bgpSpeakers'][0]['attachmentPort']):
+                if eq(interfaceAddress['interfaceDpid'], peer['attachmentDpid']) and eq(interfaceAddress['interfacePort'], peer['attachmentPort']):
+                    bgpSpeakerIpAddress = interfaceAddress['ipAddress']
+                    break
+                else:
+                    continue
+
+            # from bgpSpeakerAttachmentPoint to bgpPeerAttachmentPoint direction
+            selector_str = "IPV4_SRC{ip=" + bgpSpeakerIpAddress + "/32}," + "IPV4_DST{ip=" + peer['ipAddress'] + "/32}," + "IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}"
+            selector = selector_str.replace(" ", "").replace("[", "").replace("]", "").split(",")
+            intent = bgpSpeakerAttachmentPoint + "/" + bgpPeerAttachmentPoint + "/" + str(sorted(selector))
+            intents.append(intent)
+
+            selector_str = "IPV4_SRC{ip=" + bgpSpeakerIpAddress + "/32}," + "IPV4_DST{ip=" + peer['ipAddress'] + "/32}," + "IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_SRC{tcpPort=179}"
+            selector = selector_str.replace(" ", "").replace("[", "").replace("]", "").split(",")
+            intent = bgpSpeakerAttachmentPoint + "/" + bgpPeerAttachmentPoint + "/" + str(sorted(selector))
+            intents.append(intent)
+
+            # from bgpPeerAttachmentPoint to bgpSpeakerAttachmentPoint direction
+            selector_str = "IPV4_SRC{ip=" + peer['ipAddress'] + "/32}," + "IPV4_DST{ip=" + bgpSpeakerIpAddress + "/32}," + "IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}"
+            selector = selector_str.replace(" ", "").replace("[", "").replace("]", "").split(",")
+            intent = bgpPeerAttachmentPoint + "/" + bgpSpeakerAttachmentPoint + "/" + str(sorted(selector))
+            intents.append(intent)
+
+            selector_str = "IPV4_SRC{ip=" + peer['ipAddress'] + "/32}," + "IPV4_DST{ip=" + bgpSpeakerIpAddress + "/32}," + "IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_SRC{tcpPort=179}"
+            selector = selector_str.replace(" ", "").replace("[", "").replace("]", "").split(",")
+            intent = bgpPeerAttachmentPoint + "/" + bgpSpeakerAttachmentPoint + "/" + str(sorted(selector))
+            intents.append(intent)
+
+        return sorted(intents)
+
+    def add_routes(self, routes, routeRate):
+        main.log.info("I am in add_routes method!")
+
+        routes_added = 0
+        try:
+            self.handle.sendline("")
+            # self.handle.expect("config-router")
+            self.handle.expect("config-router", timeout=5)
+        except:
+            main.log.warn("Probably not in config-router mode!")
+            self.disconnect()
+        main.log.info("Start to add routes")
+
+        for i in range(0, len(routes)):
+            routeCmd = "network " + routes[i]
+            try:
+                self.handle.sendline(routeCmd)
+                self.handle.expect("bgpd", timeout=5)
+            except:
+                main.log.warn("Failed to add route")
+                self.disconnect()
+            waitTimer = 1.00 / routeRate
+            time.sleep(waitTimer)
+        if routes_added == len(routes):
+            main.log.info("Finished adding routes")
+            return main.TRUE
+        return main.FALSE
+
+    def delete_routes(self, routes, routeRate):
+        main.log.info("I am in delete_routes method!")
+
+        routes_added = 0
+        try:
+            self.handle.sendline("")
+            # self.handle.expect("config-router")
+            self.handle.expect("config-router", timeout=5)
+        except:
+            main.log.warn("Probably not in config-router mode!")
+            self.disconnect()
+        main.log.info("Start to delete routes")
+
+        for i in range(0, len(routes)):
+            routeCmd = "no network " + routes[i]
+            try:
+                self.handle.sendline(routeCmd)
+                self.handle.expect("bgpd", timeout=5)
+            except:
+                main.log.warn("Failed to add route")
+                self.disconnect()
+            waitTimer = 1.00 / routeRate
+            time.sleep(waitTimer)
+        if routes_added == len(routes):
+            main.log.info("Finished deleting routes")
+            return main.TRUE
+        return main.FALSE
+
+    def ping_test(self, ip_address, ping_test_file, ping_test_result_file):
+        main.log.info("Start the ping test on host:" + str(ip_address))
+
+        self.name = self.options['name']
+        self.handle = super(QuaggaCliDriver, self).connect(
+            user_name=self.user_name, ip_address=ip_address,
+            port=self.port, pwd=self.pwd)
+        main.log.info("connect parameters:" + str(self.user_name) + ";"
+        + str(self.ip_address) + ";" + str(self.port) + ";" + str(self.pwd))
+
+        if self.handle:
+            #self.handle.expect("")
+            #self.handle.expect("\$")
+            main.log.info("I in host " + str(ip_address))
+            main.log.info(ping_test_file + " > " + ping_test_result_file + " &")
+            self.handle.sendline(ping_test_file + " > " + ping_test_result_file + " &")
+            self.handle.expect("\$", timeout=60)
+            handle = self.handle.before
+
+            return handle
+        else:
+            main.log.info("NO HANDLE")
+            return main.FALSE
+
+
+    # Please use the generate_routes plus add_routes instead of this one
     def add_route(self, net, numRoutes, routeRate):
         try:
             self.handle.sendline("")
@@ -59,9 +338,9 @@
         except:
             main.log.warn("Probably not in config-router mode!")
             self.disconnect()
-        main.log.report("Adding Routes")
-        j=0
-        k=0
+        main.log.info("Adding Routes")
+        j = 0
+        k = 0
         while numRoutes > 255:
             numRoutes = numRoutes - 255
             j = j + 1
@@ -69,8 +348,8 @@
         routes_added = 0
         if numRoutes > 255:
             numRoutes = 255
-        for m in range(1,j+1):
-            for n in range(1, numRoutes+1):
+        for m in range(1, j + 1):
+            for n in range(1, numRoutes + 1):
                 network = str(net) + "." + str(m) + "." + str(n) + ".0/24"
                 routeCmd = "network " + network
                 try:
@@ -78,12 +357,12 @@
                     self.handle.expect("bgpd")
                 except:
                     main.log.warn("failed to add route")
-                    self.disconnect() 
-                waitTimer = 1.00/routeRate
+                    self.disconnect()
+                waitTimer = 1.00 / routeRate
                 time.sleep(waitTimer)
                 routes_added = routes_added + 1
-        for d in range(j+1,j+2):
-            for e in range(1,k+1):
+        for d in range(j + 1, j + 2):
+            for e in range(1, k + 1):
                 network = str(net) + "." + str(d) + "." + str(e) + ".0/24"
                 routeCmd = "network " + network
                 try:
@@ -92,12 +371,13 @@
                 except:
                     main.log.warn("failed to add route")
                     self.disconnect
-                waitTimer = 1.00/routeRate
+                waitTimer = 1.00 / routeRate
                 time.sleep(waitTimer)
                 routes_added = routes_added + 1
         if routes_added == numRoutes:
             return main.TRUE
         return main.FALSE
+
     def del_route(self, net, numRoutes, routeRate):
         try:
             self.handle.sendline("")
@@ -105,9 +385,9 @@
         except:
             main.log.warn("Probably not in config-router mode!")
             self.disconnect()
-        main.log.report("Deleting Routes")
-        j=0
-        k=0
+        main.log.info("Deleting Routes")
+        j = 0
+        k = 0
         while numRoutes > 255:
             numRoutes = numRoutes - 255
             j = j + 1
@@ -115,8 +395,8 @@
         routes_deleted = 0
         if numRoutes > 255:
             numRoutes = 255
-        for m in range(1,j+1):
-            for n in range(1, numRoutes+1):
+        for m in range(1, j + 1):
+            for n in range(1, numRoutes + 1):
                 network = str(net) + "." + str(m) + "." + str(n) + ".0/24"
                 routeCmd = "no network " + network
                 try:
@@ -125,11 +405,11 @@
                 except:
                     main.log.warn("Failed to delete route")
                     self.disconnect()
-                waitTimer = 1.00/routeRate
+                waitTimer = 1.00 / routeRate
                 time.sleep(waitTimer)
                 routes_deleted = routes_deleted + 1
-        for d in range(j+1,j+2):
-            for e in range(1,k+1):
+        for d in range(j + 1, j + 2):
+            for e in range(1, k + 1):
                 network = str(net) + "." + str(d) + "." + str(e) + ".0/24"
                 routeCmd = "no network " + network
                 try:
@@ -138,17 +418,18 @@
                 except:
                     main.log.warn("Failed to delete route")
                     self.disconnect()
-                waitTimer = 1.00/routeRate
+                waitTimer = 1.00 / routeRate
                 time.sleep(waitTimer)
                 routes_deleted = routes_deleted + 1
         if routes_deleted == numRoutes:
             return main.TRUE
         return main.FALSE
+
     def check_routes(self, brand, ip, user, pw):
         def pronto(ip, user, passwd):
             print "Connecting to Pronto switch"
             child = pexpect.spawn("telnet " + ip)
-            i = child.expect(["login:", "CLI#",pexpect.TIMEOUT])
+            i = child.expect(["login:", "CLI#", pexpect.TIMEOUT])
             if i == 0:
                 print "Username and password required. Passing login info."
                 child.sendline(user)
@@ -166,7 +447,7 @@
             child.expect("Flow table show")
             count = 0
             while 1:
-                i = child.expect(['17\d\.\d{1,3}\.\d{1,3}\.\d{1,3}','CLI#',pexpect.TIMEOUT])
+                i = child.expect(['17\d\.\d{1,3}\.\d{1,3}\.\d{1,3}', 'CLI#', pexpect.TIMEOUT])
                 if i == 0:
                     count = count + 1
                 elif i == 1:
@@ -174,10 +455,10 @@
                     break
                 else:
                     break
-        def cisco(ip,user,passwd):
+        def cisco(ip, user, passwd):
             print "Establishing Cisco switch connection"
-            child = pexpect.spawn("ssh " +  user + "@" + ip)
-            i = child.expect(["Password:", "CLI#",pexpect.TIMEOUT])
+            child = pexpect.spawn("ssh " + user + "@" + ip)
+            i = child.expect(["Password:", "CLI#", pexpect.TIMEOUT])
             if i == 0:
                 print "Password required. Passing now."
                 child.sendline(passwd)
@@ -188,7 +469,7 @@
             print "Flow table retrieved. Counting flows"
             count = 0
             while 1:
-                i = child.expect(["nw_src=17","#",pexpect.TIMEOUT])
+                i = child.expect(["nw_src=17", "#", pexpect.TIMEOUT])
                 if i == 0:
                     count = count + 1
                 elif i == 1:
@@ -197,9 +478,9 @@
                 else:
                     break
             if brand == "pronto" or brand == "PRONTO":
-                pronto(ip,user,passwd)
-            #elif brand  == "cisco" or brand == "CISCO":
-            #    cisco(ip,user,passwd) 
+                pronto(ip, user, passwd)
+            # elif brand  == "cisco" or brand == "CISCO":
+            #    cisco(ip,user,passwd)
     def disconnect(self):
         '''
         Called when Test is complete to disconnect the Quagga handle.  
diff --git a/TestON/drivers/common/clidriver.py b/TestON/drivers/common/clidriver.py
index 9ae90fb..878839e 100644
--- a/TestON/drivers/common/clidriver.py
+++ b/TestON/drivers/common/clidriver.py
@@ -48,9 +48,9 @@
         ssh_newkey = 'Are you sure you want to continue connecting'
         refused = "ssh: connect to host "+self.ip_address+" port 22: Connection refused"
         if self.port:
-            self.handle =pexpect.spawn('ssh -p '+self.port+' '+self.user_name+'@'+self.ip_address,maxread=50000)
+            self.handle =pexpect.spawn('ssh -p '+self.port+' '+self.user_name+'@'+self.ip_address, env = {"TERM": "vt100"} , maxread=50000)
         else :
-            self.handle =pexpect.spawn('ssh -X '+self.user_name+'@'+self.ip_address,maxread=50000)
+            self.handle =pexpect.spawn('ssh -X '+self.user_name+'@'+self.ip_address,maxread=1000000,timeout=60)
 
         self.handle.logfile = self.logfile_handler
 	i = 5
@@ -76,7 +76,7 @@
 	    elif i==6:
 	        main.log.info("Password not required logged in")
 
-        self.handle.sendline("\n")
+        self.handle.sendline("")
         self.handle.expect('>|#|\$')
         return self.handle
 
@@ -142,7 +142,7 @@
             main.log.info("Found More screen to go , Sending a key to proceed")
             indexMore = self.handle.expect(["^:$", expectPrompt], timeout = timeoutVar)
             while indexMore == 0:
-                main.log.info("Found anoother More screen to go , Sending a key to proceed")
+                main.log.info("Found another More screen to go , Sending a key to proceed")
                 self.handle.sendcontrol("D")
                 indexMore = self.handle.expect(["^:$", expectPrompt], timeout = timeoutVar)
                 self.LASTRSP = self.LASTRSP + self.handle.before
@@ -190,7 +190,9 @@
         '''
         ssh_newkey = 'Are you sure you want to continue connecting'
         refused = "ssh: connect to host "+ip_address+" port 22: Connection refused"
-        self.handle =pexpect.spawn('scp '+user_name+'@'+ip_address+':'+filepath+' '+dst_path)
+        cmd = 'scp '+str(user_name)+'@'+str(ip_address)+':'+str(filepath)+' '+str(dst_path)
+        main.log.info("Sending: " + cmd )
+        self.handle =pexpect.spawn( cmd )
         i=self.handle.expect([ssh_newkey,'password:',pexpect.EOF,pexpect.TIMEOUT,refused],120)
         
         if i==0:    
@@ -212,7 +214,9 @@
             main.log.error("ssh: connect to host "+ip_address+" port 22: Connection refused")
             return main.FALSE
 
-        self.handle.sendline("\r")
+        self.handle.sendline("")
+        self.handle.expect("$")
+        print self.handle.before
         
         return self.handle
     
diff --git a/TestON/tests/ClassTest/ClassTest.params b/TestON/tests/ClassTest/ClassTest.params
new file mode 100644
index 0000000..456881b
--- /dev/null
+++ b/TestON/tests/ClassTest/ClassTest.params
@@ -0,0 +1,4 @@
+<PARAMS>
+    <testcases>1,2</testcases>
+
+</PARAMS>
diff --git a/TestON/tests/ClassTest/ClassTest.py b/TestON/tests/ClassTest/ClassTest.py
new file mode 100644
index 0000000..6d7a153
--- /dev/null
+++ b/TestON/tests/ClassTest/ClassTest.py
@@ -0,0 +1,26 @@
+
+import time
+import os
+import re
+
+class ClassTest:
+    def __init__(self):
+        self.default = ''
+
+    def CASE1(self, main):
+        import time
+        import imp
+
+        init = imp.load_source('ClassInit',
+            '/home/admin/ONLabTest/TestON/tests/ClassTest/Dependency/ClassInit.py')
+
+        ip1_from_class = init.getIp1()  
+        init.printMain(main)
+
+        main.log.info(ip1_from_class)
+
+    def CASE2(self, main):
+
+
+        main.log.info("Case 2")
+
diff --git a/TestON/tests/ClassTest/ClassTest.topo b/TestON/tests/ClassTest/ClassTest.topo
new file mode 100644
index 0000000..4ecb7ed
--- /dev/null
+++ b/TestON/tests/ClassTest/ClassTest.topo
@@ -0,0 +1,26 @@
+<TOPOLOGY>
+    <COMPONENT>
+        <ONOSbench>
+            <host>10.128.174.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOSbench>
+        
+        <Mininet1>
+            <host>10.128.10.90</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS>
+                <arg1> --custom topo-perf-2sw.py </arg1>
+                <arg2> --arp --mac --topo mytopo </arg2>
+                <arg3> </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet1>
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/ClassTest/Dependency/ClassInit.py b/TestON/tests/ClassTest/Dependency/ClassInit.py
new file mode 100644
index 0000000..74ff627
--- /dev/null
+++ b/TestON/tests/ClassTest/Dependency/ClassInit.py
@@ -0,0 +1,11 @@
+
+
+def __init__(self):
+    self._ip1 = '1'
+    self._ip2 = '2'
+
+def getIp1():
+    print 'some ip' 
+
+def printMain(main):
+    print main.log.info("Main from classinit") 
diff --git a/TestON/tests/FuncNext/__init__.py b/TestON/tests/ClassTest/Dependency/__init__.py
similarity index 100%
rename from TestON/tests/FuncNext/__init__.py
rename to TestON/tests/ClassTest/Dependency/__init__.py
diff --git a/TestON/tests/ClassTest/Dependencyc b/TestON/tests/ClassTest/Dependencyc
new file mode 100644
index 0000000..bafe4c9
--- /dev/null
+++ b/TestON/tests/ClassTest/Dependencyc
Binary files differ
diff --git a/TestON/tests/JonTest/__init__.py b/TestON/tests/ClassTest/__init__.py
similarity index 100%
rename from TestON/tests/JonTest/__init__.py
rename to TestON/tests/ClassTest/__init__.py
diff --git a/TestON/tests/FuncNext/FuncNext.py b/TestON/tests/FuncNext/FuncNext.py
deleted file mode 100755
index c0b96d2..0000000
--- a/TestON/tests/FuncNext/FuncNext.py
+++ /dev/null
@@ -1,608 +0,0 @@
-
-#Testing the basic functionality of ONOS Next
-#For sanity and driver functionality excercises only.
-
-import time
-import sys
-import os
-import re
-import time
-import json
-
-time.sleep(1)
-class FuncNext:
-    def __init__(self):
-        self.default = ''
-
-    def CASE1(self, main):
-        '''
-        Startup sequence:
-        git pull
-        mvn clean install
-        onos-package
-        cell <name>
-        onos-verify-cell
-        onos-install -f
-        onos-wait-for-start
-        '''
-        
-        cell_name = main.params['ENV']['cellName']
-        ONOS1_ip = main.params['CTRL']['ip1']
-        ONOS1_port = main.params['CTRL']['port1']
-        
-        main.case("Setting up test environment")
-        
-        main.step("Git checkout and pull master and get version")
-        main.ONOSbench.git_checkout("master")
-        git_pull_result = main.ONOSbench.git_pull()
-        print "git_pull_result = ", git_pull_result
-        version_result = main.ONOSbench.get_version()
-
-        if git_pull_result == 2:
-            main.step("Using mvn clean & install")
-            clean_install_result = main.ONOSbench.clean_install()
-            #clean_install_result = main.TRUE
-
-        main.step("Applying cell variable to environment")
-        cell_result1 = main.ONOSbench.set_cell(cell_name)
-        verify_result = main.ONOSbench.verify_cell()
-        cell_result2 = main.ONOS2.set_cell(cell_name)
-        #verify_result = main.ONOS2.verify_cell()
-        main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
-        
-        cell_result = cell_result1 and cell_result2
-
-        main.step("Creating ONOS package")
-        package_result = main.ONOSbench.onos_package()
-
-        #main.step("Creating a cell")
-        #cell_create_result = main.ONOSbench.create_cell_file(**************)
-
-        main.step("Installing ONOS package")
-        onos_install_result = main.ONOSbench.onos_install()
-        onos1_isup = main.ONOSbench.isup()
-   
-        main.step("Starting ONOS service")
-        start_result = main.ONOSbench.onos_start(ONOS1_ip)
-
-        case1_result = (package_result and\
-                cell_result and verify_result and onos_install_result and\
-                onos1_isup and start_result )
-        utilities.assert_equals(expect=main.TRUE, actual=case1_result,
-                onpass="Test startup successful",
-                onfail="Test startup NOT successful")
-
-    def CASE11(self, main):
-        '''
-        Cleanup sequence:
-        onos-service <node_ip> stop
-        onos-uninstall
-
-        TODO: Define rest of cleanup
-        
-        '''
-
-        ONOS1_ip = main.params['CTRL']['ip1']
-
-        main.case("Cleaning up test environment")
-
-        main.step("Testing ONOS kill function")
-        kill_result = main.ONOSbench.onos_kill(ONOS1_ip)
-
-        main.step("Stopping ONOS service")
-        stop_result = main.ONOSbench.onos_stop(ONOS1_ip)
-
-        main.step("Uninstalling ONOS service") 
-        uninstall_result = main.ONOSbench.onos_uninstall()
-
-    def CASE3(self, main):
-        '''
-        Test 'onos' command and its functionality in driver
-        '''
-        
-        ONOS1_ip = main.params['CTRL']['ip1']
-
-        main.case("Testing 'onos' command")
-
-        main.step("Sending command 'onos -w <onos-ip> system:name'")
-        cmdstr1 = "system:name"
-        cmd_result1 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr1) 
-        main.log.info("onos command returned: "+cmd_result1)
-
-        main.step("Sending command 'onos -w <onos-ip> onos:topology'")
-        cmdstr2 = "onos:topology"
-        cmd_result2 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr2)
-        main.log.info("onos command returned: "+cmd_result2)
-
-
-
-    def CASE4(self, main):
-        import re
-        import time
-        main.case("Pingall Test")
-        main.step("Assigning switches to controllers")
-        for i in range(1,29):
-            if i ==1:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-            elif i>=2 and i<5:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-            elif i>=5 and i<8:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-            elif i>=8 and i<18:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-            elif i>=18 and i<28:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-            else:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-        Switch_Mastership = main.TRUE
-        for i in range (1,29):
-            if i==1:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
-                    Switch_Mastership = Switch_Mastership and main.TRUE
-                else:
-                    Switch_Mastership = main.FALSE
-            elif i>=2 and i<5:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
-                    Switch_Mastership = Switch_Mastership and main.TRUE
-                else:
-                    Switch_Mastership = main.FALSE
-            elif i>=5 and i<8:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
-                    Switch_Mastership = Switch_Mastership and main.TRUE
-                else:
-                    Switch_Mastership = main.FALSE
-            elif i>=8 and i<18:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
-                    Switch_Mastership = Switch_Mastership and main.TRUE
-                else:
-                    Switch_Mastership = main.FALSE
-            elif i>=18 and i<28:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
-                    Switch_Mastership = Switch_Mastership and main.TRUE
-                else:
-                    Switch_Mastership = main.FALSE
-            else:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is" + str(response))
-                if re.search("tcp:" +ONOS1_ip,response):
-                    Switch_Mastership = Switch_Mastership and main.TRUE
-                else:
-                    Switch_Mastership = main.FALSE
-
-        if Switch_Mastership == main.TRUE:
-            main.log.report("MasterControllers assigned correctly")
-        utilities.assert_equals(expect = main.TRUE,actual=Switch_Mastership,
-                onpass="MasterControllers assigned correctly")
-        '''
-        for i in range (1,29):
-            main.Mininet1.assign_sw_controller(sw=str(i),count=5,
-                    ip1=ONOS1_ip,port1=ONOS1_port,
-                    ip2=ONOS2_ip,port2=ONOS2_port,
-                    ip3=ONOS3_ip,port3=ONOS3_port,
-                    ip4=ONOS4_ip,port4=ONOS4_port,
-                    ip5=ONOS5_ip,port5=ONOS5_port)
-        '''
-        #REACTIVE FWD test
-
-        main.step("Get list of hosts from Mininet")
-        host_list = main.Mininet1.get_hosts()
-        main.log.info(host_list)
-
-        main.step("Get host list in ONOS format")
-        host_onos_list = main.ONOS2.get_hosts_id(host_list)
-        main.log.info(host_onos_list)
-        #time.sleep(5)
-
-        #We must use ping from hosts we want to add intents from 
-        #to make the hosts talk
-        #main.Mininet2.handle.sendline("\r")
-        #main.Mininet2.handle.sendline("h4 ping 10.1.1.1 -c 1 -W 1")
-        #time.sleep(3)
-        #main.Mininet2.handle.sendline("h5 ping 10.1.1.1 -c 1 -W 1")
-        #time.sleep(5)
-        
-        main.step("Pingall")
-        ping_result = main.FALSE
-        while ping_result == main.FALSE:
-            time1 = time.time()
-            ping_result = main.Mininet1.pingall()
-            time2 = time.time()
-            print "Time for pingall: %2f seconds" % (time2 - time1)
-      
-        #Start onos cli again because u might have dropped out of onos prompt to the shell prompt
-        #if there was no activity
-        main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
-
-        main.step("Get hosts")
-        main.ONOS2.handle.sendline("hosts")
-        main.ONOS2.handle.expect("onos>")
-        hosts = main.ONOS2.handle.before
-        main.log.info(hosts)
-
-        main.step("Get all devices id")
-        devices_id_list = main.ONOS2.get_all_devices_id()
-        main.log.info(devices_id_list)
-        
-        #ONOS displays the hosts in hex format unlike mininet which does in decimal format
-        #So take care while adding intents
-        
-        main.step("Add host-to-host intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:08/-1", "00:00:00:00:00:12/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:09/-1", "00:00:00:00:00:13/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0A/-1", "00:00:00:00:00:14/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0B/-1", "00:00:00:00:00:15/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0C/-1", "00:00:00:00:00:16/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0D/-1", "00:00:00:00:00:17/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0E/-1", "00:00:00:00:00:18/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0F/-1", "00:00:00:00:00:19/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:10/-1", "00:00:00:00:00:1A/-1") 
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1")
-
- 
-        
-        print "_____________________________________________________________________________________"
-        ''' 
-        main.step("Add point-to-point intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003008", 1, "of:0000000000006018", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006018", 1, "of:0000000000003008", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-       
-        main.step("Add point-to-point intents for mininet hosts h9 and h19 or ONOS hosts h9 and h13")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003009", 1, "of:0000000000006019", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006019", 1, "of:0000000000003009", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-        
-        main.step("Add point-to-point intents for mininet hosts h10 and h20 or ONOS hosts hA and h14")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003010", 1, "of:0000000000006020", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006020", 1, "of:0000000000003010", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-            
-        main.step("Add point-to-point intents for mininet hosts h11 and h21 or ONOS hosts hB and h15")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003011", 1, "of:0000000000006021", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006021", 1, "of:0000000000003011", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-            
-        main.step("Add point-to-point intents for mininet hosts h12 and h22 or ONOS hosts hC and h16")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003012", 1, "of:0000000000006022", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006022", 1, "of:0000000000003012", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-            
-        main.step("Add point-to-point intents for mininet hosts h13 and h23 or ONOS hosts hD and h17")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003013", 1, "of:0000000000006023", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006023", 1, "of:0000000000003013", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-            
-        main.step("Add point-to-point intents for mininet hosts h14 and h24 or ONOS hosts hE and h18")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003014", 1, "of:0000000000006024", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006024", 1, "of:0000000000003014", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-            
-        main.step("Add point-to-point intents for mininet hosts h15 and h25 or ONOS hosts hF and h19")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003015", 1, "of:0000000000006025", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006025", 1, "of:0000000000003015", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-            
-        main.step("Add point-to-point intents for mininet hosts h16 and h26 or ONOS hosts h10 and h1A")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003016", 1, "of:0000000000006026", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006026", 1, "of:0000000000003016", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-        
-        main.step("Add point-to-point intents for mininet hosts h17 and h27 or ONOS hosts h11 and h1B")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003017", 1, "of:0000000000006027", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006027", 1, "of:0000000000003017", 1)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-
-        print("_______________________________________________________________________________________")
-        '''
-
-        #Unistall onos-app-fwd app to disable reactive forwarding
-        appUninstall_result = main.ONOS2.feature_uninstall("onos-app-fwd")
-        main.log.info("onos-app-fwd uninstalled")
-
-        #After reactive forwarding is disabled, the reactive flows on switches timeout in 10-15s
-        #So sleep for 15s
-        time.sleep(15)
-        
-        flowHandle = main.ONOS2.flows()
-        print "flowHandle = ", flowHandle
-
-        count = 1
-        i = 8
-        Ping_Result = main.TRUE
-        #while i<10:
-        while i <18 :
-            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
-            if ping == main.FALSE and count <5:
-                count+=1
-                i = 8
-                Ping_Result = main.FALSE
-                main.log.report("Ping between h" + str(i) + " and h" + str(i+10) + " failed. Making attempt number "+str(count) + " in 2 seconds")
-                time.sleep(2)
-            elif ping==main.FALSE:
-                main.log.report("All ping attempts have failed")
-                i=19
-                Ping_Result = main.FALSE
-            elif ping==main.TRUE:
-                main.log.info("Ping test passed!")
-                i+=1
-                Ping_Result = main.TRUE
-            else:
-                main.log.info("Unknown error")
-                Ping_Result = main.ERROR
-        if Ping_Result==main.FALSE:
-            main.log.report("Intents have not ben installed correctly. Cleaning up")
-            #main.cleanup()
-            #main.exit()
-        if Ping_Result==main.TRUE:
-            main.log.report("Intents have been installed correctly")
-            
-        case4_result = Switch_Mastership and Ping_Result
-        utilities.assert_equals(expect=main.TRUE, actual=case4_result,
-                onpass="Pingall Test successful",
-                onfail="Pingall Test NOT successful")
-
-    def CASE5(self,main) :
-        import json
-        from subprocess import Popen, PIPE
-        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
-        #main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
-        deviceResult = main.ONOS2.devices()
-        linksResult = main.ONOS2.links()
-        portsResult = main.ONOS2.ports()
-        print "**************"
-        main.step("Start continuous pings")
-        main.Mininet2.pingLong(src=main.params['PING']['source1'],
-                            target=main.params['PING']['target1'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source2'],
-                            target=main.params['PING']['target2'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source3'],
-                            target=main.params['PING']['target3'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source4'],
-                            target=main.params['PING']['target4'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source5'],
-                            target=main.params['PING']['target5'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source6'],
-                            target=main.params['PING']['target6'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source7'],
-                            target=main.params['PING']['target7'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source8'],
-                            target=main.params['PING']['target8'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source9'],
-                            target=main.params['PING']['target9'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source10'],
-                            target=main.params['PING']['target10'],pingTime=500)
-
-        main.step("Create TestONTopology object")
-        global ctrls
-        ctrls = []
-        count = 1
-        while True:
-            temp = ()
-            if ('ip' + str(count)) in main.params['CTRL']:
-                temp = temp + (getattr(main,('ONOS' + str(count))),)
-                temp = temp + ("ONOS"+str(count),)
-                temp = temp + (main.params['CTRL']['ip'+str(count)],)
-                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
-                ctrls.append(temp)
-                count = count + 1
-            else:
-                break
-        global MNTopo
-        Topo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
-        MNTopo = Topo
-
-        Topology_Check = main.TRUE
-        main.step("Compare ONOS Topology to MN Topology")
-        devices_json = main.ONOS2.devices()
-        links_json = main.ONOS2.links()
-        ports_json = main.ONOS2.ports()
-        print "devices_json= ", devices_json
-        
-        result1 = main.Mininet1.compare_switches(MNTopo, json.loads(devices_json))
-        print "***********************"
-        result2 = main.Mininet1.compare_links(MNTopo, json.loads(links_json))
-        print "***********************"
-        result3 = main.Mininet1.compare_ports(MNTopo, json.loads(ports_json))
-            
-        result = result1 and result2 and result3
-        print "***********************"
-        if result == main.TRUE:
-            main.log.report("ONOS"+ " Topology matches MN Topology")
-        utilities.assert_equals(expect=main.TRUE,actual=result,
-            onpass="ONOS" + " Topology matches MN Topology",
-            onfail="ONOS" + " Topology does not match MN Topology")
-        Topology_Check = Topology_Check and result
-        utilities.assert_equals(expect=main.TRUE,actual=Topology_Check,
-            onpass="Topology checks passed", onfail="Topology checks failed")
-    
-
-    def CASE7 (self,main):
-       
-        ONOS1_ip = main.params['CTRL']['ip1']
-
-        link_sleep = int(main.params['timers']['LinkDiscovery'])
-
-        main.log.report("Killing a link to ensure that link discovery is consistent")
-        main.case("Killing a link to Ensure that Link Discovery is Working Properly")
-        main.step("Start continuous pings")
-       
-        main.Mininet2.pingLong(src=main.params['PING']['source1'],
-                            target=main.params['PING']['target1'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source2'],
-                            target=main.params['PING']['target2'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source3'],
-                            target=main.params['PING']['target3'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source4'],
-                            target=main.params['PING']['target4'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source5'],
-                            target=main.params['PING']['target5'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source6'],
-                            target=main.params['PING']['target6'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source7'],
-                            target=main.params['PING']['target7'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source8'],
-                            target=main.params['PING']['target8'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source9'],
-                            target=main.params['PING']['target9'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source10'],
-                            target=main.params['PING']['target10'],pingTime=500)
-
-
-        main.step("Determine the current number of switches and links")
-        topology_output = main.ONOS2.topology()
-        topology_result = main.ONOS1.get_topology(topology_output)
-        activeSwitches = topology_result['devices']
-        links = topology_result['links']
-        print "activeSwitches = ", type(activeSwitches)
-        print "links = ", type(links)
-        main.log.info("Currently there are %s switches and %s links"  %(str(activeSwitches), str(links)))
-
-        main.step("Kill Link between s3 and s28")
-        main.Mininet1.link(END1="s3",END2="s28",OPTION="down")
-        time.sleep(link_sleep)
-        topology_output = main.ONOS2.topology()
-        Link_Down = main.ONOS1.check_status(topology_output,activeSwitches,str(int(links)-2))
-        if Link_Down == main.TRUE:
-            main.log.report("Link Down discovered properly")
-        utilities.assert_equals(expect=main.TRUE,actual=Link_Down,
-                onpass="Link Down discovered properly",
-                onfail="Link down was not discovered in "+ str(link_sleep) + " seconds")
-        
-        main.step("Bring link between s3 and s28 back up")
-        Link_Up = main.Mininet1.link(END1="s3",END2="s28",OPTION="up")
-        time.sleep(link_sleep)
-        topology_output = main.ONOS2.topology()
-        Link_Up = main.ONOS1.check_status(topology_output,activeSwitches,str(links))
-        if Link_Up == main.TRUE:
-            main.log.report("Link up discovered properly")
-        utilities.assert_equals(expect=main.TRUE,actual=Link_Up,
-                onpass="Link up discovered properly",
-                onfail="Link up was not discovered in "+ str(link_sleep) + " seconds")
-
-
-
-
-        main.step("Compare ONOS Topology to MN Topology")
-        Topo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
-        MNTopo = Topo
-        Topology_Check = main.TRUE
-        devices_json = main.ONOS2.devices()
-        links_json = main.ONOS2.links()
-        ports_json = main.ONOS2.ports()
-        print "devices_json= ", devices_json
-        
-        result1 = main.Mininet1.compare_switches(MNTopo, json.loads(devices_json))
-        print "***********************"
-        result2 = main.Mininet1.compare_links(MNTopo, json.loads(links_json))
-        print "***********************"
-        result3 = main.Mininet1.compare_ports(MNTopo, json.loads(ports_json))
-            
-        result = result1 and result2 and result3
-        print "***********************"
-        if result == main.TRUE:
-            main.log.report("ONOS"+ " Topology matches MN Topology")
-        utilities.assert_equals(expect=main.TRUE,actual=result,
-            onpass="ONOS" + " Topology matches MN Topology",
-            onfail="ONOS" + " Topology does not match MN Topology")
-        Topology_Check = Topology_Check and result
-        utilities.assert_equals(expect=main.TRUE,actual=Topology_Check,
-            onpass="Topology checks passed", onfail="Topology checks failed")
-    
-        result = Link_Down and Link_Up and Topology_Check
-        utilities.assert_equals(expect=main.TRUE,actual=result,
-                onpass="Link failure is discovered correctly",
-                onfail="Link Discovery failed")
-
-
-
diff --git a/TestON/tests/FuncNext/FuncNext.topo b/TestON/tests/FuncNext/FuncNext.topo
deleted file mode 100755
index 444c605..0000000
--- a/TestON/tests/FuncNext/FuncNext.topo
+++ /dev/null
@@ -1,61 +0,0 @@
-<TOPOLOGY>
-    <COMPONENT>
-
-        <ONOSbench>
-            <host>10.128.60.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOSbench>
-
-        <ONOS1>
-            <host>10.128.60.10</host>
-            <user>sdn</user>
-            <password>sdn</password>
-            <type>OnosDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS1>
-
-        <ONOS2>
-            <host>10.128.60.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS2>
-
-        <Mininet1>
-            <host>10.128.9.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>MininetCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-                #Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
-                <arg2> --topo mytopo </arg2>
-                <arg3> --switch ovs,protocols=OpenFlow10 </arg3>
-                <controller> remote </controller>
-            </COMPONENTS>
-        </Mininet1>
-
-        <Mininet2>
-            <host>10.128.9.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>RemoteMininetDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS>
-                #Specify the Option for mininet
-                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
-                <arg2> --topo mytopo </arg2>
-                <arg3> --switch ovs,protocols=OpenFlow10 </arg3>
-                <controller> remote </controller>
-            </COMPONENTS>
-        </Mininet2>
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/HATestClusterRestart/HATestClusterRestart.params b/TestON/tests/HATestClusterRestart/HATestClusterRestart.params
new file mode 100644
index 0000000..38a9b02
--- /dev/null
+++ b/TestON/tests/HATestClusterRestart/HATestClusterRestart.params
@@ -0,0 +1,64 @@
+<PARAMS>
+    <testcases>1,2,8,3,4,5,14,[6],8,3,7,4,15,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
+    <ENV>
+    <cellName>HA</cellName>
+    </ENV>
+    <Git>False</Git>
+    <num_controllers> 7 </num_controllers>
+
+    <CTRL>
+        <ip1>10.128.30.11</ip1>
+        <port1>6633</port1>
+
+        <ip2>10.128.30.12</ip2>
+        <port2>6633</port2>
+
+        <ip3>10.128.30.13</ip3>
+        <port3>6633</port3>
+
+        <ip4>10.128.30.14</ip4>
+        <port4>6633</port4>
+
+        <ip5>10.128.30.15</ip5>
+        <port5>6633</port5>
+
+        <ip6>10.128.30.16</ip6>
+        <port6>6633</port6>
+
+        <ip7>10.128.30.17</ip7>
+        <port7>6633</port7>
+    </CTRL>
+    <TESTONUSER>admin</TESTONUSER>
+    <TESTONIP>10.128.30.9</TESTONIP>
+    <PING>
+        <source1>h8</source1>
+        <source2>h9</source2>
+        <source3>h10</source3>
+        <source4>h11</source4>
+        <source5>h12</source5>
+        <source6>h13</source6>
+        <source7>h14</source7>
+        <source8>h15</source8>
+        <source9>h16</source9>
+        <source10>h17</source10>
+        <target1>10.0.0.18</target1>
+        <target2>10.0.0.19</target2>
+        <target3>10.0.0.20</target3>
+        <target4>10.0.0.21</target4>
+        <target5>10.0.0.22</target5>
+        <target6>10.0.0.23</target6>
+        <target7>10.0.0.24</target7>
+        <target8>10.0.0.25</target8>
+        <target9>10.0.0.26</target9>
+        <target10>10.0.0.27</target10>
+    </PING>
+    <timers>
+        <LinkDiscovery>.2</LinkDiscovery>
+        <SwitchDiscovery>.2</SwitchDiscovery>
+    </timers>
+    <MNtcpdump>
+        <intf>eth0</intf>
+        <port> </port>
+        <folder>~/packet_captures/</folder>
+    </MNtcpdump>
+</PARAMS>
diff --git a/TestON/tests/HATestClusterRestart/HATestClusterRestart.py b/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
new file mode 100644
index 0000000..b9a07b9
--- /dev/null
+++ b/TestON/tests/HATestClusterRestart/HATestClusterRestart.py
@@ -0,0 +1,1858 @@
+'''
+Description: This test is to determine if ONOS can handle
+    all of it's nodes restarting
+
+List of test cases:
+CASE1: Compile ONOS and push it to the test machines
+CASE2: Assign mastership to controllers
+CASE3: Assign intents
+CASE4: Ping across added host intents
+CASE5: Reading state of ONOS
+CASE6: The Failure case.
+CASE7: Check state after control plane failure
+CASE8: Compare topo
+CASE9: Link s3-s28 down
+CASE10: Link s3-s28 up
+CASE11: Switch down
+CASE12: Switch up
+CASE13: Clean up
+CASE14: start election app on all onos nodes
+CASE15: Check that Leadership Election is still functional
+'''
+class HATestClusterRestart:
+
+    def __init__(self) :
+        self.default = ''
+
+    def CASE1(self,main) :
+        '''
+        CASE1 is to compile ONOS and push it to the test machines
+
+        Startup sequence:
+        git pull
+        mvn clean install
+        onos-package
+        cell <name>
+        onos-verify-cell
+        NOTE: temporary - onos-remove-raft-logs
+        onos-install -f
+        onos-wait-for-start
+        '''
+        import time
+        main.log.report("ONOS HA test: Restart all ONOS nodes - initialization")
+        main.case("Setting up test environment")
+
+        # load some vairables from the params file
+        PULL_CODE = False
+        if main.params['Git'] == 'True':
+            PULL_CODE = True
+        cell_name = main.params['ENV']['cellName']
+
+        #set global variables
+        global ONOS1_ip
+        global ONOS1_port
+        global ONOS2_ip
+        global ONOS2_port
+        global ONOS3_ip
+        global ONOS3_port
+        global ONOS4_ip
+        global ONOS4_port
+        global ONOS5_ip
+        global ONOS5_port
+        global ONOS6_ip
+        global ONOS6_port
+        global ONOS7_ip
+        global ONOS7_port
+        global num_controllers
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS1_port = main.params['CTRL']['port1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS2_port = main.params['CTRL']['port2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+        ONOS3_port = main.params['CTRL']['port3']
+        ONOS4_ip = main.params['CTRL']['ip4']
+        ONOS4_port = main.params['CTRL']['port4']
+        ONOS5_ip = main.params['CTRL']['ip5']
+        ONOS5_port = main.params['CTRL']['port5']
+        ONOS6_ip = main.params['CTRL']['ip6']
+        ONOS6_port = main.params['CTRL']['port6']
+        ONOS7_ip = main.params['CTRL']['ip7']
+        ONOS7_port = main.params['CTRL']['port7']
+        num_controllers = int(main.params['num_controllers'])
+
+
+        main.step("Applying cell variable to environment")
+        cell_result = main.ONOSbench.set_cell(cell_name)
+        verify_result = main.ONOSbench.verify_cell()
+
+        #FIXME:this is short term fix
+        main.log.report("Removing raft logs")
+        main.ONOSbench.onos_remove_raft_logs()
+        main.log.report("Uninstalling ONOS")
+        main.ONOSbench.onos_uninstall(ONOS1_ip)
+        main.ONOSbench.onos_uninstall(ONOS2_ip)
+        main.ONOSbench.onos_uninstall(ONOS3_ip)
+        main.ONOSbench.onos_uninstall(ONOS4_ip)
+        main.ONOSbench.onos_uninstall(ONOS5_ip)
+        main.ONOSbench.onos_uninstall(ONOS6_ip)
+        main.ONOSbench.onos_uninstall(ONOS7_ip)
+
+        clean_install_result = main.TRUE
+        git_pull_result = main.TRUE
+
+        main.step("Compiling the latest version of ONOS")
+        if PULL_CODE:
+            main.step("Git checkout and pull master")
+            main.ONOSbench.git_checkout("master")
+            git_pull_result = main.ONOSbench.git_pull()
+
+            main.step("Using mvn clean & install")
+            clean_install_result = main.TRUE
+            if git_pull_result == main.TRUE:
+                clean_install_result = main.ONOSbench.clean_install()
+            else:
+                main.log.warn("Did not pull new code so skipping mvn "+ \
+                        "clean install")
+        main.ONOSbench.get_version(report=True)
+
+        main.step("Creating ONOS package")
+        package_result = main.ONOSbench.onos_package()
+
+        main.step("Installing ONOS package")
+        onos1_install_result = main.ONOSbench.onos_install(options="-f",
+                node=ONOS1_ip)
+        onos2_install_result = main.ONOSbench.onos_install(options="-f",
+                node=ONOS2_ip)
+        onos3_install_result = main.ONOSbench.onos_install(options="-f",
+                node=ONOS3_ip)
+        onos4_install_result = main.ONOSbench.onos_install(options="-f",
+                node=ONOS4_ip)
+        onos5_install_result = main.ONOSbench.onos_install(options="-f",
+                node=ONOS5_ip)
+        onos6_install_result = main.ONOSbench.onos_install(options="-f",
+                node=ONOS6_ip)
+        onos7_install_result = main.ONOSbench.onos_install(options="-f",
+                node=ONOS7_ip)
+        onos_install_result = onos1_install_result and onos2_install_result\
+                and onos3_install_result and onos4_install_result\
+                and onos5_install_result and onos6_install_result\
+                and onos7_install_result
+        '''
+        #FIXME: work around until onos is less fragile
+        main.ONOSbench.handle.sendline("onos-cluster-install")
+        print main.ONOSbench.handle.expect("\$")
+        onos_install_result = main.TRUE
+        '''
+
+
+        main.step("Checking if ONOS is up yet")
+        #TODO check bundle:list?
+        for i in range(2):
+            onos1_isup = main.ONOSbench.isup(ONOS1_ip)
+            if not onos1_isup:
+                main.log.report("ONOS1 didn't start!")
+            onos2_isup = main.ONOSbench.isup(ONOS2_ip)
+            if not onos2_isup:
+                main.log.report("ONOS2 didn't start!")
+            onos3_isup = main.ONOSbench.isup(ONOS3_ip)
+            if not onos3_isup:
+                main.log.report("ONOS3 didn't start!")
+            onos4_isup = main.ONOSbench.isup(ONOS4_ip)
+            if not onos4_isup:
+                main.log.report("ONOS4 didn't start!")
+            onos5_isup = main.ONOSbench.isup(ONOS5_ip)
+            if not onos5_isup:
+                main.log.report("ONOS5 didn't start!")
+            onos6_isup = main.ONOSbench.isup(ONOS6_ip)
+            if not onos6_isup:
+                main.log.report("ONOS6 didn't start!")
+            onos7_isup = main.ONOSbench.isup(ONOS7_ip)
+            if not onos7_isup:
+                main.log.report("ONOS7 didn't start!")
+            onos_isup_result = onos1_isup and onos2_isup and onos3_isup\
+                    and onos4_isup and onos5_isup and onos6_isup and onos7_isup
+            if onos_isup_result == main.TRUE:
+                break
+        # TODO: if it becomes an issue, we can retry this step  a few times
+
+
+        cli_result1 = main.ONOScli1.start_onos_cli(ONOS1_ip)
+        cli_result2 = main.ONOScli2.start_onos_cli(ONOS2_ip)
+        cli_result3 = main.ONOScli3.start_onos_cli(ONOS3_ip)
+        cli_result4 = main.ONOScli4.start_onos_cli(ONOS4_ip)
+        cli_result5 = main.ONOScli5.start_onos_cli(ONOS5_ip)
+        cli_result6 = main.ONOScli6.start_onos_cli(ONOS6_ip)
+        cli_result7 = main.ONOScli7.start_onos_cli(ONOS7_ip)
+        cli_results = cli_result1 and cli_result2 and cli_result3 and\
+                cli_result4 and cli_result5 and cli_result6 and cli_result7
+
+        main.step("Start Packet Capture MN")
+        main.Mininet2.start_tcpdump(
+                str(main.params['MNtcpdump']['folder'])+str(main.TEST)+"-MN.pcap",
+                intf = main.params['MNtcpdump']['intf'],
+                port = main.params['MNtcpdump']['port'])
+
+
+        case1_result = (clean_install_result and package_result and
+                cell_result and verify_result and onos_install_result and
+                onos_isup_result and cli_results)
+
+        utilities.assert_equals(expect=main.TRUE, actual=case1_result,
+                onpass="Test startup successful",
+                onfail="Test startup NOT successful")
+
+
+        if case1_result==main.FALSE:
+            main.cleanup()
+            main.exit()
+
+    def CASE2(self,main) :
+        '''
+        Assign mastership to controllers
+        '''
+        import time
+        import json
+        import re
+
+        main.log.report("Assigning switches to controllers")
+        main.case("Assigning Controllers")
+        main.step("Assign switches to controllers")
+
+        for i in range (1,29):
+           main.Mininet1.assign_sw_controller(sw=str(i),count=num_controllers,
+                    ip1=ONOS1_ip,port1=ONOS1_port,
+                    ip2=ONOS2_ip,port2=ONOS2_port,
+                    ip3=ONOS3_ip,port3=ONOS3_port,
+                    ip4=ONOS4_ip,port4=ONOS4_port,
+                    ip5=ONOS5_ip,port5=ONOS5_port,
+                    ip6=ONOS6_ip,port6=ONOS6_port,
+                    ip7=ONOS7_ip,port7=ONOS7_port)
+
+        mastership_check = main.TRUE
+        for i in range (1,29):
+            response = main.Mininet1.get_sw_controller("s"+str(i))
+            try:
+                main.log.info(str(response))
+            except:
+                main.log.info(repr(response))
+            if re.search("tcp:"+ONOS1_ip,response)\
+                    and re.search("tcp:"+ONOS2_ip,response)\
+                    and re.search("tcp:"+ONOS3_ip,response)\
+                    and re.search("tcp:"+ONOS4_ip,response)\
+                    and re.search("tcp:"+ONOS5_ip,response)\
+                    and re.search("tcp:"+ONOS6_ip,response)\
+                    and re.search("tcp:"+ONOS7_ip,response):
+                mastership_check = mastership_check and main.TRUE
+            else:
+                mastership_check = main.FALSE
+        if mastership_check == main.TRUE:
+            main.log.report("Switch mastership assigned correctly")
+        utilities.assert_equals(expect = main.TRUE,actual=mastership_check,
+                onpass="Switch mastership assigned correctly",
+                onfail="Switches not assigned correctly to controllers")
+
+        #Manually assign mastership to the controller we want
+        role_call = main.TRUE
+        role_check = main.TRUE
+
+        device_id = main.ONOScli1.get_device("1000")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS1_ip)
+        if ONOS1_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("2800")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS1_ip)
+        if ONOS1_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("2000")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS2_ip)
+        if ONOS2_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3000")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS2_ip)
+        if ONOS2_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("5000")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS3_ip)
+        if ONOS3_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6000")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS3_ip)
+        if ONOS3_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id =  main.ONOScli1.get_device("3004")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS4_ip)
+        if ONOS4_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3008")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3009")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3010")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3011")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3012")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3013")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3014")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3015")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3016")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3017")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6007")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS6_ip)
+        if ONOS6_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6018")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6019")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6020")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6021")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6022")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6023")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6024")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6025")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6026")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6027")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        utilities.assert_equals(expect = main.TRUE,actual=role_call,
+                onpass="Re-assigned switch mastership to designated controller",
+                onfail="Something wrong with device_role calls")
+
+        utilities.assert_equals(expect = main.TRUE,actual=role_check,
+                onpass="Switches were successfully reassigned to designated controller",
+                onfail="Switches were not successfully reassigned")
+        mastership_check = mastership_check and role_call and role_check
+        utilities.assert_equals(expect = main.TRUE,actual=mastership_check,
+                onpass="Switch mastership correctly assigned",
+                onfail="Error in (re)assigning switch mastership")
+
+
+    def CASE3(self,main) :
+        """
+        Assign intents
+
+        """
+        #FIXME: we must reinstall intents until we have a persistant datastore!
+        import time
+        import json
+        import re
+        main.log.report("Adding host intents")
+        main.case("Adding host Intents")
+
+        main.step("Discovering  Hosts( Via pingall for now)")
+        #FIXME: Once we have a host discovery mechanism, use that instead
+
+        #install onos-app-fwd
+        main.log.info("Install reactive forwarding app")
+        main.ONOScli1.feature_install("onos-app-fwd")
+        main.ONOScli2.feature_install("onos-app-fwd")
+        main.ONOScli3.feature_install("onos-app-fwd")
+        main.ONOScli4.feature_install("onos-app-fwd")
+        main.ONOScli5.feature_install("onos-app-fwd")
+        main.ONOScli6.feature_install("onos-app-fwd")
+        main.ONOScli7.feature_install("onos-app-fwd")
+
+        #REACTIVE FWD test
+        ping_result = main.FALSE
+        time1 = time.time()
+        ping_result = main.Mininet1.pingall()
+        time2 = time.time()
+        main.log.info("Time for pingall: %2f seconds" % (time2 - time1))
+
+        #uninstall onos-app-fwd
+        main.log.info("Uninstall reactive forwarding app")
+        main.ONOScli1.feature_uninstall("onos-app-fwd")
+        main.ONOScli2.feature_uninstall("onos-app-fwd")
+        main.ONOScli3.feature_uninstall("onos-app-fwd")
+        main.ONOScli4.feature_uninstall("onos-app-fwd")
+        main.ONOScli5.feature_uninstall("onos-app-fwd")
+        main.ONOScli6.feature_uninstall("onos-app-fwd")
+        main.ONOScli7.feature_uninstall("onos-app-fwd")
+        #timeout for fwd flows
+        time.sleep(10)
+
+        main.step("Add  host intents")
+        #TODO:  move the host numbers to params
+        import json
+        intents_json= json.loads(main.ONOScli1.hosts())
+        intent_add_result = True
+        for i in range(8,18):
+            main.log.info("Adding host intent between h"+str(i)+" and h"+str(i+10))
+            host1 =  "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
+            host2 =  "00:00:00:00:00:" + str(hex(i+10)[2:]).zfill(2).upper()
+            host1_id = main.ONOScli1.get_host(host1)['id']
+            host2_id = main.ONOScli1.get_host(host2)['id']
+            #NOTE: get host can return None
+            if host1_id and host2_id:
+                tmp_result = main.ONOScli1.add_host_intent(host1_id, host2_id )
+            else:
+                main.log.error("Error, get_host() failed")
+                tmp_result = main.FALSE
+            intent_add_result = bool(intent_add_result and tmp_result)
+        utilities.assert_equals(expect=True, actual=intent_add_result,
+                onpass="Switch mastership correctly assigned",
+                onfail="Error in (re)assigning switch mastership")
+        #TODO Check if intents all exist in datastore
+        #NOTE: Do we need to print this once the test is working?
+        #main.log.info(json.dumps(json.loads(main.ONOScli1.intents(json_format=True)),
+        #    sort_keys=True, indent=4, separators=(',', ': ') ) )
+
+    def CASE4(self,main) :
+        """
+        Ping across added host intents
+        """
+        description = " Ping across added host intents"
+        main.log.report(description)
+        main.case(description)
+        Ping_Result = main.TRUE
+        for i in range(8,18):
+            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
+            Ping_Result = Ping_Result and ping
+            if ping==main.FALSE:
+                main.log.warn("Ping failed between h"+str(i)+" and h" + str(i+10))
+            elif ping==main.TRUE:
+                main.log.info("Ping test passed!")
+                Ping_Result = main.TRUE
+        if Ping_Result==main.FALSE:
+            main.log.report("Intents have not been installed correctly, pings failed.")
+        if Ping_Result==main.TRUE:
+            main.log.report("Intents have been installed correctly and verified by pings")
+        utilities.assert_equals(expect = main.TRUE,actual=Ping_Result,
+                onpass="Intents have been installed correctly and pings work",
+                onfail ="Intents have not been installed correctly, pings failed." )
+
+    def CASE5(self,main) :
+        '''
+        Reading state of ONOS
+        '''
+        import time
+        import json
+        from subprocess import Popen, PIPE
+        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
+
+        main.log.report("Setting up and gathering data for current state")
+        main.case("Setting up and gathering data for current state")
+        #The general idea for this test case is to pull the state of (intents,flows, topology,...) from each ONOS node
+        #We can then compare them with eachother and also with past states
+
+        main.step("Get the Mastership of each switch from each controller")
+        global mastership_state
+        mastership_state = []
+
+        #Assert that each device has a master
+        ONOS1_master_not_null = main.ONOScli1.roles_not_null()
+        ONOS2_master_not_null = main.ONOScli2.roles_not_null()
+        ONOS3_master_not_null = main.ONOScli3.roles_not_null()
+        ONOS4_master_not_null = main.ONOScli4.roles_not_null()
+        ONOS5_master_not_null = main.ONOScli5.roles_not_null()
+        ONOS6_master_not_null = main.ONOScli6.roles_not_null()
+        ONOS7_master_not_null = main.ONOScli7.roles_not_null()
+        roles_not_null = ONOS1_master_not_null and ONOS2_master_not_null and\
+                ONOS3_master_not_null and ONOS4_master_not_null and\
+                ONOS5_master_not_null and ONOS6_master_not_null and\
+                ONOS7_master_not_null
+        utilities.assert_equals(expect = main.TRUE,actual=roles_not_null,
+                onpass="Each device has a master",
+                onfail="Some devices don't have a master assigned")
+
+
+        ONOS1_mastership = main.ONOScli1.roles()
+        ONOS2_mastership = main.ONOScli2.roles()
+        ONOS3_mastership = main.ONOScli3.roles()
+        ONOS4_mastership = main.ONOScli4.roles()
+        ONOS5_mastership = main.ONOScli5.roles()
+        ONOS6_mastership = main.ONOScli6.roles()
+        ONOS7_mastership = main.ONOScli7.roles()
+        #print json.dumps(json.loads(ONOS1_mastership), sort_keys=True, indent=4, separators=(',', ': '))
+        if "Error" in ONOS1_mastership or not ONOS1_mastership\
+                or "Error" in ONOS2_mastership or not ONOS2_mastership\
+                or "Error" in ONOS3_mastership or not ONOS3_mastership\
+                or "Error" in ONOS4_mastership or not ONOS4_mastership\
+                or "Error" in ONOS5_mastership or not ONOS5_mastership\
+                or "Error" in ONOS6_mastership or not ONOS6_mastership\
+                or "Error" in ONOS7_mastership or not ONOS7_mastership:
+                    main.log.report("Error in getting ONOS roles")
+                    main.log.warn("ONOS1 mastership response: " + repr(ONOS1_mastership))
+                    main.log.warn("ONOS2 mastership response: " + repr(ONOS2_mastership))
+                    main.log.warn("ONOS3 mastership response: " + repr(ONOS3_mastership))
+                    main.log.warn("ONOS4 mastership response: " + repr(ONOS4_mastership))
+                    main.log.warn("ONOS5 mastership response: " + repr(ONOS5_mastership))
+                    main.log.warn("ONOS6 mastership response: " + repr(ONOS6_mastership))
+                    main.log.warn("ONOS7 mastership response: " + repr(ONOS7_mastership))
+                    consistent_mastership = main.FALSE
+        elif ONOS1_mastership == ONOS2_mastership\
+                and ONOS1_mastership == ONOS3_mastership\
+                and ONOS1_mastership == ONOS4_mastership\
+                and ONOS1_mastership == ONOS5_mastership\
+                and ONOS1_mastership == ONOS6_mastership\
+                and ONOS1_mastership == ONOS7_mastership:
+                    mastership_state = ONOS1_mastership
+                    consistent_mastership = main.TRUE
+                    main.log.report("Switch roles are consistent across all ONOS nodes")
+        else:
+            main.log.warn("ONOS1 roles: ", json.dumps(json.loads(ONOS1_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS2 roles: ", json.dumps(json.loads(ONOS2_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS3 roles: ", json.dumps(json.loads(ONOS3_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS4 roles: ", json.dumps(json.loads(ONOS4_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS5 roles: ", json.dumps(json.loads(ONOS5_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS6 roles: ", json.dumps(json.loads(ONOS6_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS7 roles: ", json.dumps(json.loads(ONOS7_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            consistent_mastership = main.FALSE
+        utilities.assert_equals(expect = main.TRUE,actual=consistent_mastership,
+                onpass="Switch roles are consistent across all ONOS nodes",
+                onfail="ONOS nodes have different views of switch roles")
+
+
+        main.step("Get the intents from each controller")
+        global intent_state
+        intent_state = []
+        ONOS1_intents = main.ONOScli1.intents( json_format=True )
+        ONOS2_intents = main.ONOScli2.intents( json_format=True )
+        ONOS3_intents = main.ONOScli3.intents( json_format=True )
+        ONOS4_intents = main.ONOScli4.intents( json_format=True )
+        ONOS5_intents = main.ONOScli5.intents( json_format=True )
+        ONOS6_intents = main.ONOScli6.intents( json_format=True )
+        ONOS7_intents = main.ONOScli7.intents( json_format=True )
+        intent_check = main.FALSE
+        if "Error" in ONOS1_intents or not ONOS1_intents\
+                or "Error" in ONOS2_intents or not ONOS2_intents\
+                or "Error" in ONOS3_intents or not ONOS3_intents\
+                or "Error" in ONOS4_intents or not ONOS4_intents\
+                or "Error" in ONOS5_intents or not ONOS5_intents\
+                or "Error" in ONOS6_intents or not ONOS6_intents\
+                or "Error" in ONOS7_intents or not ONOS7_intents:
+                    main.log.report("Error in getting ONOS intents")
+                    main.log.warn("ONOS1 intents response: " + repr(ONOS1_intents))
+                    main.log.warn("ONOS2 intents response: " + repr(ONOS2_intents))
+                    main.log.warn("ONOS3 intents response: " + repr(ONOS3_intents))
+                    main.log.warn("ONOS4 intents response: " + repr(ONOS4_intents))
+                    main.log.warn("ONOS5 intents response: " + repr(ONOS5_intents))
+                    main.log.warn("ONOS6 intents response: " + repr(ONOS6_intents))
+                    main.log.warn("ONOS7 intents response: " + repr(ONOS7_intents))
+        elif ONOS1_intents == ONOS2_intents\
+                and ONOS1_intents == ONOS3_intents\
+                and ONOS1_intents == ONOS4_intents\
+                and ONOS1_intents == ONOS5_intents\
+                and ONOS1_intents == ONOS6_intents\
+                and ONOS1_intents == ONOS7_intents:
+                    intent_state = ONOS1_intents
+                    intent_check = main.TRUE
+                    main.log.report("Intents are consistent across all ONOS nodes")
+        else:
+            main.log.warn("ONOS1 intents: ", json.dumps(json.loads(ONOS1_intents),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS2 intents: ", json.dumps(json.loads(ONOS2_intents),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS3 intents: ", json.dumps(json.loads(ONOS3_intents),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS4 intents: ", json.dumps(json.loads(ONOS4_intents),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS5 intents: ", json.dumps(json.loads(ONOS5_intents),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS6 intents: ", json.dumps(json.loads(ONOS6_intents),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS7 intents: ", json.dumps(json.loads(ONOS7_intents),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+        utilities.assert_equals(expect = main.TRUE,actual=intent_check,
+                onpass="Intents are consistent across all ONOS nodes",
+                onfail="ONOS nodes have different views of intents")
+
+
+        main.step("Get the flows from each controller")
+        global flow_state
+        flow_state = []
+        ONOS1_flows = main.ONOScli1.flows( json_format=True )
+        ONOS2_flows = main.ONOScli2.flows( json_format=True )
+        ONOS3_flows = main.ONOScli3.flows( json_format=True )
+        ONOS4_flows = main.ONOScli4.flows( json_format=True )
+        ONOS5_flows = main.ONOScli5.flows( json_format=True )
+        ONOS6_flows = main.ONOScli6.flows( json_format=True )
+        ONOS7_flows = main.ONOScli7.flows( json_format=True )
+        flow_check = main.FALSE
+        if "Error" in ONOS1_flows or not ONOS1_flows\
+                or "Error" in ONOS2_flows or not ONOS2_flows\
+                or "Error" in ONOS3_flows or not ONOS3_flows\
+                or "Error" in ONOS4_flows or not ONOS4_flows\
+                or "Error" in ONOS5_flows or not ONOS5_flows\
+                or "Error" in ONOS6_flows or not ONOS6_flows\
+                or "Error" in ONOS7_flows or not ONOS7_flows:
+                    main.log.report("Error in getting ONOS intents")
+                    main.log.warn("ONOS1 flows repsponse: "+ ONOS1_flows)
+                    main.log.warn("ONOS2 flows repsponse: "+ ONOS2_flows)
+                    main.log.warn("ONOS3 flows repsponse: "+ ONOS3_flows)
+                    main.log.warn("ONOS4 flows repsponse: "+ ONOS4_flows)
+                    main.log.warn("ONOS5 flows repsponse: "+ ONOS5_flows)
+                    main.log.warn("ONOS6 flows repsponse: "+ ONOS6_flows)
+                    main.log.warn("ONOS7 flows repsponse: "+ ONOS7_flows)
+        elif len(json.loads(ONOS1_flows)) == len(json.loads(ONOS2_flows))\
+                and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS3_flows))\
+                and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS4_flows))\
+                and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS5_flows))\
+                and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS6_flows))\
+                and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS7_flows)):
+                #TODO: Do a better check, maybe compare flows on switches?
+                    flow_state = ONOS1_flows
+                    flow_check = main.TRUE
+                    main.log.report("Flow count is consistent across all ONOS nodes")
+        else:
+            main.log.warn("ONOS1 flows: "+ json.dumps(json.loads(ONOS1_flows),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS2 flows: "+ json.dumps(json.loads(ONOS2_flows),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS3 flows: "+ json.dumps(json.loads(ONOS3_flows),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS4 flows: "+ json.dumps(json.loads(ONOS4_flows),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS5 flows: "+ json.dumps(json.loads(ONOS5_flows),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS6 flows: "+ json.dumps(json.loads(ONOS6_flows),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS7 flows: "+ json.dumps(json.loads(ONOS7_flows),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+        utilities.assert_equals(expect = main.TRUE,actual=flow_check,
+                onpass="The flow count is consistent across all ONOS nodes",
+                onfail="ONOS nodes have different flow counts")
+
+
+        main.step("Get the OF Table entries")
+        global flows
+        flows=[]
+        for i in range(1,29):
+            flows.append(main.Mininet2.get_flowTable(1.3, "s"+str(i)))
+
+        #TODO: Compare switch flow tables with ONOS flow tables
+
+        main.step("Start continuous pings")
+        main.Mininet2.pingLong(src=main.params['PING']['source1'],
+                            target=main.params['PING']['target1'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source2'],
+                            target=main.params['PING']['target2'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source3'],
+                            target=main.params['PING']['target3'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source4'],
+                            target=main.params['PING']['target4'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source5'],
+                            target=main.params['PING']['target5'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source6'],
+                            target=main.params['PING']['target6'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source7'],
+                            target=main.params['PING']['target7'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source8'],
+                            target=main.params['PING']['target8'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source9'],
+                            target=main.params['PING']['target9'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source10'],
+                            target=main.params['PING']['target10'],pingTime=500)
+
+        main.step("Create TestONTopology object")
+        ctrls = []
+        count = 1
+        while True:
+            temp = ()
+            if ('ip' + str(count)) in main.params['CTRL']:
+                temp = temp + (getattr(main,('ONOS' + str(count))),)
+                temp = temp + ("ONOS"+str(count),)
+                temp = temp + (main.params['CTRL']['ip'+str(count)],)
+                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
+                ctrls.append(temp)
+                count = count + 1
+            else:
+                break
+        MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+
+        main.step("Collecting topology information from ONOS")
+        devices = []
+        devices.append( main.ONOScli1.devices() )
+        devices.append( main.ONOScli2.devices() )
+        devices.append( main.ONOScli3.devices() )
+        devices.append( main.ONOScli4.devices() )
+        devices.append( main.ONOScli5.devices() )
+        devices.append( main.ONOScli6.devices() )
+        devices.append( main.ONOScli7.devices() )
+        hosts = []
+        hosts.append( main.ONOScli1.hosts() )
+        hosts.append( main.ONOScli2.hosts() )
+        hosts.append( main.ONOScli3.hosts() )
+        hosts.append( main.ONOScli4.hosts() )
+        hosts.append( main.ONOScli5.hosts() )
+        hosts.append( main.ONOScli6.hosts() )
+        hosts.append( main.ONOScli7.hosts() )
+        ports = []
+        ports.append( main.ONOScli1.ports() )
+        ports.append( main.ONOScli2.ports() )
+        ports.append( main.ONOScli3.ports() )
+        ports.append( main.ONOScli4.ports() )
+        ports.append( main.ONOScli5.ports() )
+        ports.append( main.ONOScli6.ports() )
+        ports.append( main.ONOScli7.ports() )
+        links = []
+        links.append( main.ONOScli1.links() )
+        links.append( main.ONOScli2.links() )
+        links.append( main.ONOScli3.links() )
+        links.append( main.ONOScli4.links() )
+        links.append( main.ONOScli5.links() )
+        links.append( main.ONOScli6.links() )
+        links.append( main.ONOScli7.links() )
+        clusters = []
+        clusters.append( main.ONOScli1.clusters() )
+        clusters.append( main.ONOScli2.clusters() )
+        clusters.append( main.ONOScli3.clusters() )
+        clusters.append( main.ONOScli4.clusters() )
+        clusters.append( main.ONOScli5.clusters() )
+        clusters.append( main.ONOScli6.clusters() )
+        clusters.append( main.ONOScli7.clusters() )
+        paths = []
+        temp_topo = main.ONOSbench.get_topology( main.ONOScli1.topology() )
+        paths.append( temp_topo.get('paths', False) )
+        temp_topo = main.ONOSbench.get_topology( main.ONOScli2.topology() )
+        paths.append( temp_topo.get('paths', False) )
+        temp_topo = main.ONOSbench.get_topology( main.ONOScli3.topology() )
+        paths.append( temp_topo.get('paths', False) )
+        temp_topo = main.ONOSbench.get_topology( main.ONOScli4.topology() )
+        paths.append( temp_topo.get('paths', False) )
+        temp_topo = main.ONOSbench.get_topology( main.ONOScli5.topology() )
+        paths.append( temp_topo.get('paths', False) )
+        temp_topo = main.ONOSbench.get_topology( main.ONOScli6.topology() )
+        paths.append( temp_topo.get('paths', False) )
+        temp_topo = main.ONOSbench.get_topology( main.ONOScli7.topology() )
+        paths.append( temp_topo.get('paths', False) )
+
+        #Compare json objects for hosts, dataplane clusters and paths
+
+        #hosts
+        consistent_hosts_result = main.TRUE
+        for controller in range( len( hosts ) ):
+            if not "Error" in hosts[controller]:
+                if hosts[controller] == hosts[0]:
+                    continue
+                else:#hosts not consistent
+                    main.log.report("hosts from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+                    main.log.warn( repr( hosts[controller] ) )
+                    consistent_hosts_result = main.FALSE
+
+            else:
+                main.log.report("Error in getting ONOS hosts from ONOS" + str(controller + 1) )
+                consistent_hosts_result = main.FALSE
+                main.log.warn("ONOS" + str(controller + 1) + " hosts response: " + repr(hosts[controller]) )
+        utilities.assert_equals(expect = main.TRUE,actual=consistent_hosts_result,
+                onpass="Hosts view is consistent across all ONOS nodes",
+                onfail="ONOS nodes have different views of hosts")
+
+        #Strongly connected clusters of devices
+        consistent_clusters_result = main.TRUE
+        for controller in range( len( clusters ) ):
+            if not "Error" in clusters[controller]:
+                if clusters[controller] == clusters[0]:
+                    continue
+                else:#clusters not consistent
+                    main.log.report("clusters from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+                    consistent_clusters_result = main.FALSE
+
+            else:
+                main.log.report("Error in getting dataplane clusters from ONOS" + str(controller + 1) )
+                consistent_clusters_result = main.FALSE
+                main.log.warn("ONOS" + str(controller + 1) + " clusters response: " + repr(clusters[controller]) )
+        utilities.assert_equals(expect = main.TRUE,actual=consistent_clusters_result,
+                onpass="Clusters view is consistent across all ONOS nodes",
+                onfail="ONOS nodes have different views of clusters")
+        num_clusters =  len(json.loads(clusters[0])) #there should always only be one cluster
+        utilities.assert_equals(expect = 1, actual = num_clusters,
+                onpass="ONOS shows 1 SCC",
+                onfail="ONOS shows "+str(num_clusters) +" SCCs")
+
+
+        #paths
+        consistent_paths_result = main.TRUE
+        for controller in range( len( paths ) ):
+            if not "Error" in paths[controller]:
+                if paths[controller] == paths[0]:
+                    continue
+                else:#paths not consistent
+                    main.log.report("paths from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+                    consistent_paths_result = main.FALSE
+
+            else:
+                main.log.report("Error in getting paths from ONOS" + str(controller + 1) )
+                consistent_paths_result = main.FALSE
+                main.log.warn("ONOS" + str(controller + 1) + " paths response: " + repr(paths[controller]) )
+        utilities.assert_equals(expect = main.TRUE,actual=consistent_paths_result,
+                onpass="Paths count is consistent across all ONOS nodes",
+                onfail="ONOS nodes have different counts of paths")
+
+
+        main.step("Comparing ONOS topology to MN")
+        devices_results = main.TRUE
+        ports_results = main.TRUE
+        links_results = main.TRUE
+        for controller in range(num_controllers):
+            if devices[controller] or not "Error" in devices[controller]:
+                current_devices_result =  main.Mininet1.compare_switches(MNTopo, json.loads(devices[controller]))
+            else:
+                current_devices_result = main.FALSE
+            utilities.assert_equals(expect=main.TRUE, actual=current_devices_result,
+                    onpass="ONOS"+str(int(controller+1))+" Switches view is correct",
+                    onfail="ONOS"+str(int(controller+1))+" Switches view is incorrect")
+
+            if ports[controller] or not "Error" in ports[controller]:
+                current_ports_result =  main.Mininet1.compare_ports(MNTopo, json.loads(ports[controller]))
+            else:
+                current_ports_result = main.FALSE
+            utilities.assert_equals(expect=main.TRUE, actual=current_ports_result,
+                    onpass="ONOS"+str(int(controller+1))+" ports view is correct",
+                    onfail="ONOS"+str(int(controller+1))+" ports view is incorrect")
+
+            if links[controller] or not "Error" in links[controller]:
+                current_links_result =  main.Mininet1.compare_links(MNTopo, json.loads(links[controller]))
+            else:
+                current_links_result = main.FALSE
+            utilities.assert_equals(expect=main.TRUE, actual=current_links_result,
+                    onpass="ONOS"+str(int(controller+1))+" links view is correct",
+                    onfail="ONOS"+str(int(controller+1))+" links view is incorrect")
+
+            devices_results = devices_results and current_devices_result
+            ports_results = ports_results and current_ports_result
+            links_results = links_results and current_links_result
+
+        topo_result = devices_results and ports_results and links_results\
+                and consistent_hosts_result and consistent_clusters_result\
+                and consistent_paths_result
+        utilities.assert_equals(expect=main.TRUE, actual=topo_result,
+                onpass="Topology Check Test successful",
+                onfail="Topology Check Test NOT successful")
+
+        final_assert = main.TRUE
+        final_assert = final_assert and topo_result and flow_check \
+                and intent_check and consistent_mastership and roles_not_null
+        utilities.assert_equals(expect=main.TRUE, actual=final_assert,
+                onpass="State check successful",
+                onfail="State check NOT successful")
+
+
+    def CASE6(self,main) :
+        '''
+        The Failure case.
+        '''
+        main.log.report("Restart entire ONOS cluster")
+        main.log.case("Restart entire ONOS cluster")
+        main.ONOSbench.onos_kill(ONOS1_ip)
+        main.ONOSbench.onos_kill(ONOS2_ip)
+        main.ONOSbench.onos_kill(ONOS3_ip)
+        main.ONOSbench.onos_kill(ONOS4_ip)
+        main.ONOSbench.onos_kill(ONOS5_ip)
+        main.ONOSbench.onos_kill(ONOS6_ip)
+        main.ONOSbench.onos_kill(ONOS7_ip)
+
+        main.step("Checking if ONOS is up yet")
+        count = 0
+        onos_isup_result = main.FALSE
+        while onos_isup_result == main.FALSE and count < 10:
+            onos1_isup = main.ONOSbench.isup(ONOS1_ip)
+            onos2_isup = main.ONOSbench.isup(ONOS2_ip)
+            onos3_isup = main.ONOSbench.isup(ONOS3_ip)
+            onos4_isup = main.ONOSbench.isup(ONOS4_ip)
+            onos5_isup = main.ONOSbench.isup(ONOS5_ip)
+            onos6_isup = main.ONOSbench.isup(ONOS6_ip)
+            onos7_isup = main.ONOSbench.isup(ONOS7_ip)
+            onos_isup_result = onos1_isup and onos2_isup and onos3_isup\
+                    and onos4_isup and onos5_isup and onos6_isup and onos7_isup
+            count = count + 1
+        # TODO: if it becomes an issue, we can retry this step  a few times
+
+
+        cli_result1 = main.ONOScli1.start_onos_cli(ONOS1_ip)
+        cli_result2 = main.ONOScli2.start_onos_cli(ONOS2_ip)
+        cli_result3 = main.ONOScli3.start_onos_cli(ONOS3_ip)
+        cli_result4 = main.ONOScli4.start_onos_cli(ONOS4_ip)
+        cli_result5 = main.ONOScli5.start_onos_cli(ONOS5_ip)
+        cli_result6 = main.ONOScli6.start_onos_cli(ONOS6_ip)
+        cli_result7 = main.ONOScli7.start_onos_cli(ONOS7_ip)
+        cli_results = cli_result1 and cli_result2 and cli_result3\
+                and cli_result4 and cli_result5 and cli_result6\
+                and cli_result7
+
+        case_results = main.TRUE and onos_isup_result and cli_results
+        utilities.assert_equals(expect=main.TRUE, actual=case_results,
+                onpass="ONOS restart successful",
+                onfail="ONOS restart NOT successful")
+
+
+    def CASE7(self,main) :
+        '''
+        Check state after ONOS failure
+        '''
+        import os
+        import json
+        main.case("Running ONOS Constant State Tests")
+
+        #Assert that each device has a master
+        ONOS1_master_not_null = main.ONOScli1.roles_not_null()
+        ONOS2_master_not_null = main.ONOScli2.roles_not_null()
+        ONOS3_master_not_null = main.ONOScli3.roles_not_null()
+        ONOS4_master_not_null = main.ONOScli4.roles_not_null()
+        ONOS5_master_not_null = main.ONOScli5.roles_not_null()
+        ONOS6_master_not_null = main.ONOScli6.roles_not_null()
+        ONOS7_master_not_null = main.ONOScli7.roles_not_null()
+        roles_not_null = ONOS1_master_not_null and ONOS2_master_not_null and\
+                ONOS3_master_not_null and ONOS4_master_not_null and\
+                ONOS5_master_not_null and ONOS6_master_not_null and\
+                ONOS7_master_not_null
+        utilities.assert_equals(expect = main.TRUE,actual=roles_not_null,
+                onpass="Each device has a master",
+                onfail="Some devices don't have a master assigned")
+
+
+
+        main.step("Check if switch roles are consistent across all nodes")
+        ONOS1_mastership = main.ONOScli1.roles()
+        ONOS2_mastership = main.ONOScli2.roles()
+        ONOS3_mastership = main.ONOScli3.roles()
+        ONOS4_mastership = main.ONOScli4.roles()
+        ONOS5_mastership = main.ONOScli5.roles()
+        ONOS6_mastership = main.ONOScli6.roles()
+        ONOS7_mastership = main.ONOScli7.roles()
+        #print json.dumps(json.loads(ONOS1_mastership), sort_keys=True, indent=4, separators=(',', ': '))
+        if "Error" in ONOS1_mastership or not ONOS1_mastership\
+                or "Error" in ONOS2_mastership or not ONOS2_mastership\
+                or "Error" in ONOS3_mastership or not ONOS3_mastership\
+                or "Error" in ONOS4_mastership or not ONOS4_mastership\
+                or "Error" in ONOS5_mastership or not ONOS5_mastership\
+                or "Error" in ONOS6_mastership or not ONOS6_mastership\
+                or "Error" in ONOS7_mastership or not ONOS7_mastership:
+                    main.log.error("Error in getting ONOS mastership")
+                    main.log.warn("ONOS1 mastership response: " + repr(ONOS1_mastership))
+                    main.log.warn("ONOS2 mastership response: " + repr(ONOS2_mastership))
+                    main.log.warn("ONOS3 mastership response: " + repr(ONOS3_mastership))
+                    main.log.warn("ONOS4 mastership response: " + repr(ONOS4_mastership))
+                    main.log.warn("ONOS5 mastership response: " + repr(ONOS5_mastership))
+                    main.log.warn("ONOS6 mastership response: " + repr(ONOS6_mastership))
+                    main.log.warn("ONOS7 mastership response: " + repr(ONOS7_mastership))
+                    consistent_mastership = main.FALSE
+        elif ONOS1_mastership == ONOS2_mastership\
+                and ONOS1_mastership == ONOS3_mastership\
+                and ONOS1_mastership == ONOS4_mastership\
+                and ONOS1_mastership == ONOS5_mastership\
+                and ONOS1_mastership == ONOS6_mastership\
+                and ONOS1_mastership == ONOS7_mastership:
+                    consistent_mastership = main.TRUE
+                    main.log.report("Switch roles are consistent across all ONOS nodes")
+        else:
+            main.log.warn("ONOS1 roles: ", json.dumps(json.loads(ONOS1_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS2 roles: ", json.dumps(json.loads(ONOS2_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS3 roles: ", json.dumps(json.loads(ONOS3_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS4 roles: ", json.dumps(json.loads(ONOS4_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS5 roles: ", json.dumps(json.loads(ONOS5_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS6 roles: ", json.dumps(json.loads(ONOS6_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS7 roles: ", json.dumps(json.loads(ONOS7_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            consistent_mastership = main.FALSE
+        utilities.assert_equals(expect = main.TRUE,actual=consistent_mastership,
+                onpass="Switch roles are consistent across all ONOS nodes",
+                onfail="ONOS nodes have different views of switch roles")
+
+
+        description2 = "Compare switch roles from before failure"
+        main.step(description2)
+
+        current_json = json.loads(ONOS1_mastership)
+        old_json = json.loads(mastership_state)
+        mastership_check = main.TRUE
+        for i in range(1,29):
+            switchDPID = str(main.Mininet1.getSwitchDPID(switch="s"+str(i)))
+
+            current = [switch['master'] for switch in current_json if switchDPID in switch['id']]
+            old = [switch['master'] for switch in old_json if switchDPID in switch['id']]
+            if current == old:
+                mastership_check = mastership_check and main.TRUE
+            else:
+                main.log.warn("Mastership of switch %s changed" % switchDPID)
+                mastership_check = main.FALSE
+        if mastership_check == main.TRUE:
+            main.log.report("Mastership of Switches was not changed")
+        utilities.assert_equals(expect=main.TRUE,actual=mastership_check,
+                onpass="Mastership of Switches was not changed",
+                onfail="Mastership of some switches changed")
+        #NOTE: we expect mastership to change on controller failure
+        mastership_check = consistent_mastership
+
+
+
+        main.step("Get the intents and compare across all nodes")
+        ONOS1_intents = main.ONOScli1.intents( json_format=True )
+        ONOS2_intents = main.ONOScli2.intents( json_format=True )
+        ONOS3_intents = main.ONOScli3.intents( json_format=True )
+        ONOS4_intents = main.ONOScli4.intents( json_format=True )
+        ONOS5_intents = main.ONOScli5.intents( json_format=True )
+        ONOS6_intents = main.ONOScli6.intents( json_format=True )
+        ONOS7_intents = main.ONOScli7.intents( json_format=True )
+        intent_check = main.FALSE
+        if "Error" in ONOS1_intents or not ONOS1_intents\
+                or "Error" in ONOS2_intents or not ONOS2_intents\
+                or "Error" in ONOS3_intents or not ONOS3_intents\
+                or "Error" in ONOS4_intents or not ONOS4_intents\
+                or "Error" in ONOS5_intents or not ONOS5_intents\
+                or "Error" in ONOS6_intents or not ONOS6_intents\
+                or "Error" in ONOS7_intents or not ONOS7_intents:
+                    main.log.report("Error in getting ONOS intents")
+                    main.log.warn("ONOS1 intents response: " + repr(ONOS1_intents))
+                    main.log.warn("ONOS2 intents response: " + repr(ONOS2_intents))
+                    main.log.warn("ONOS3 intents response: " + repr(ONOS3_intents))
+                    main.log.warn("ONOS4 intents response: " + repr(ONOS4_intents))
+                    main.log.warn("ONOS5 intents response: " + repr(ONOS5_intents))
+                    main.log.warn("ONOS6 intents response: " + repr(ONOS6_intents))
+                    main.log.warn("ONOS7 intents response: " + repr(ONOS7_intents))
+        elif ONOS1_intents == ONOS2_intents\
+                and ONOS1_intents == ONOS3_intents\
+                and ONOS1_intents == ONOS4_intents\
+                and ONOS1_intents == ONOS5_intents\
+                and ONOS1_intents == ONOS6_intents\
+                and ONOS1_intents == ONOS7_intents:
+                    intent_check = main.TRUE
+                    main.log.report("Intents are consistent across all ONOS nodes")
+        else:
+            main.log.warn("ONOS1 intents: ")
+            print json.dumps(json.loads(ONOS1_intents),
+                sort_keys=True, indent=4, separators=(',', ': '))
+            main.log.warn("ONOS2 intents: ")
+            print json.dumps(json.loads(ONOS2_intents),
+                sort_keys=True, indent=4, separators=(',', ': '))
+            main.log.warn("ONOS3 intents: ")
+            print json.dumps(json.loads(ONOS3_intents),
+                sort_keys=True, indent=4, separators=(',', ': '))
+            main.log.warn("ONOS4 intents: ")
+            print json.dumps(json.loads(ONOS4_intents),
+                sort_keys=True, indent=4, separators=(',', ': '))
+            main.log.warn("ONOS5 intents: ")
+            print json.dumps(json.loads(ONOS5_intents),
+                sort_keys=True, indent=4, separators=(',', ': '))
+            main.log.warn("ONOS6 intents: ")
+            print json.dumps(json.loads(ONOS6_intents),
+                sort_keys=True, indent=4, separators=(',', ': '))
+            main.log.warn("ONOS7 intents: ")
+            print json.dumps(json.loads(ONOS7_intents),
+                sort_keys=True, indent=4, separators=(',', ': '))
+        utilities.assert_equals(expect = main.TRUE,actual=intent_check,
+                onpass="Intents are consistent across all ONOS nodes",
+                onfail="ONOS nodes have different views of intents")
+
+        #NOTE: Hazelcast has no durability, so intents are lost across system restarts
+        '''
+        main.step("Compare current intents with intents before the failure")
+        #NOTE: this requires case 5 to pass for intent_state to be set.
+        #      maybe we should stop the test if that fails?
+        if intent_state == ONOS1_intents:
+            same_intents = main.TRUE
+            main.log.report("Intents are consistent with before failure")
+        #TODO: possibly the states have changed? we may need to figure out what the aceptable states are
+        else:
+            try:
+                main.log.warn("ONOS1 intents: ")
+                print json.dumps(json.loads(ONOS1_intents),
+                    sort_keys=True, indent=4, separators=(',', ': '))
+            except:
+                pass
+            same_intents = main.FALSE
+        utilities.assert_equals(expect = main.TRUE,actual=same_intents,
+                onpass="Intents are consistent with before failure",
+                onfail="The Intents changed during failure")
+        intent_check = intent_check and same_intents
+        '''
+
+
+
+        main.step("Get the OF Table entries and compare to before component failure")
+        Flow_Tables = main.TRUE
+        flows2=[]
+        for i in range(28):
+            main.log.info("Checking flow table on s" + str(i+1))
+            tmp_flows = main.Mininet2.get_flowTable(1.3, "s"+str(i+1))
+            flows2.append(tmp_flows)
+            temp_result = main.Mininet2.flow_comp(flow1=flows[i],flow2=tmp_flows)
+            Flow_Tables = Flow_Tables and temp_result
+            if Flow_Tables == main.FALSE:
+                main.log.info("Differences in flow table for switch: "+str(i+1))
+        if Flow_Tables == main.TRUE:
+            main.log.report("No changes were found in the flow tables")
+        utilities.assert_equals(expect=main.TRUE,actual=Flow_Tables,
+                onpass="No changes were found in the flow tables",
+                onfail="Changes were found in the flow tables")
+
+        main.step("Check the continuous pings to ensure that no packets were dropped during component failure")
+        #FIXME: This check is always failing. Investigate cause
+        #NOTE:  this may be something to do with file permsissions
+        #       or slight change in format
+        main.Mininet2.pingKill(main.params['TESTONUSER'], main.params['TESTONIP'])
+        Loss_In_Pings = main.FALSE 
+        #NOTE: checkForLoss returns main.FALSE with 0% packet loss
+        for i in range(8,18):
+            main.log.info("Checking for a loss in pings along flow from s" + str(i))
+            Loss_In_Pings = main.Mininet2.checkForLoss("/tmp/ping.h"+str(i)) or Loss_In_Pings
+        if Loss_In_Pings == main.TRUE:
+            main.log.info("Loss in ping detected")
+        elif Loss_In_Pings == main.ERROR:
+            main.log.info("There are multiple mininet process running")
+        elif Loss_In_Pings == main.FALSE:
+            main.log.info("No Loss in the pings")
+            main.log.report("No loss of dataplane connectivity")
+        utilities.assert_equals(expect=main.FALSE,actual=Loss_In_Pings,
+                onpass="No Loss of connectivity",
+                onfail="Loss of dataplane connectivity detected")
+        #NOTE: Since intents are not persisted with Hazelcast, we expect this
+        Loss_In_Pings = main.FALSE
+
+
+        #Test of LeadershipElection
+        leader_list = []
+        leader_result = main.TRUE
+        for controller in range(1,num_controllers+1):
+            node = getattr( main, ( 'ONOScli' + str( controller ) ) )#loop through ONOScli handlers
+            leaderN = node.election_test_leader()
+            leader_list.append(leaderN)
+            if leaderN == main.FALSE:
+                #error in  response
+                main.log.report("Something is wrong with election_test_leader function, check the error logs")
+                leader_result = main.FALSE
+            elif leaderN == None:
+                main.log.report("ONOS"+str(controller) + " shows no leader for the election-app was elected after the old one died")
+                leader_result = main.FALSE
+        if len( set( leader_list ) ) != 1:
+            leader_result = main.FALSE
+            main.log.error("Inconsistent view of leader for the election test app")
+            #TODO: print the list
+        if leader_result:
+            main.log.report("Leadership election tests passed(consistent view of leader across listeners and a new leader was re-elected after restart)")
+        utilities.assert_equals(expect=main.TRUE, actual=leader_result,
+                onpass="Leadership election passed",
+                onfail="Something went wrong with Leadership election")
+
+
+        result = mastership_check and intent_check and Flow_Tables and (not Loss_In_Pings) and roles_not_null\
+                and leader_result
+        result = int(result)
+        if result == main.TRUE:
+            main.log.report("Constant State Tests Passed")
+        utilities.assert_equals(expect=main.TRUE,actual=result,
+                onpass="Constant State Tests Passed",
+                onfail="Constant state tests failed")
+
+    def CASE8 (self,main):
+        '''
+        Compare topo
+        '''
+        import sys
+        sys.path.append("/home/admin/sts") # Trying to remove some dependancies, #FIXME add this path to params
+        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
+        import json
+        import time
+
+        description ="Compare ONOS Topology view to Mininet topology"
+        main.case(description)
+        main.log.report(description)
+        main.step("Create TestONTopology object")
+        ctrls = []
+        count = 1
+        while True:
+            temp = ()
+            if ('ip' + str(count)) in main.params['CTRL']:
+                temp = temp + (getattr(main,('ONOS' + str(count))),)
+                temp = temp + ("ONOS"+str(count),)
+                temp = temp + (main.params['CTRL']['ip'+str(count)],)
+                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
+                ctrls.append(temp)
+                count = count + 1
+            else:
+                break
+        MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+
+        main.step("Comparing ONOS topology to MN")
+        devices_results = main.TRUE
+        ports_results = main.TRUE
+        links_results = main.TRUE
+        topo_result = main.FALSE
+        elapsed = 0
+        count = 0
+        main.step("Collecting topology information from ONOS")
+        start_time = time.time()
+        while topo_result == main.FALSE and elapsed < 60:
+            count = count + 1
+            if count > 1:
+                MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+            cli_start = time.time()
+            devices = []
+            devices.append( main.ONOScli1.devices() )
+            devices.append( main.ONOScli2.devices() )
+            devices.append( main.ONOScli3.devices() )
+            devices.append( main.ONOScli4.devices() )
+            devices.append( main.ONOScli5.devices() )
+            devices.append( main.ONOScli6.devices() )
+            devices.append( main.ONOScli7.devices() )
+            hosts = []
+            hosts.append( main.ONOScli1.hosts() )
+            hosts.append( main.ONOScli2.hosts() )
+            hosts.append( main.ONOScli3.hosts() )
+            hosts.append( main.ONOScli4.hosts() )
+            hosts.append( main.ONOScli5.hosts() )
+            hosts.append( main.ONOScli6.hosts() )
+            hosts.append( main.ONOScli7.hosts() )
+            ports = []
+            ports.append( main.ONOScli1.ports() )
+            ports.append( main.ONOScli2.ports() )
+            ports.append( main.ONOScli3.ports() )
+            ports.append( main.ONOScli4.ports() )
+            ports.append( main.ONOScli5.ports() )
+            ports.append( main.ONOScli6.ports() )
+            ports.append( main.ONOScli7.ports() )
+            links = []
+            links.append( main.ONOScli1.links() )
+            links.append( main.ONOScli2.links() )
+            links.append( main.ONOScli3.links() )
+            links.append( main.ONOScli4.links() )
+            links.append( main.ONOScli5.links() )
+            links.append( main.ONOScli6.links() )
+            links.append( main.ONOScli7.links() )
+            clusters = []
+            clusters.append( main.ONOScli1.clusters() )
+            clusters.append( main.ONOScli2.clusters() )
+            clusters.append( main.ONOScli3.clusters() )
+            clusters.append( main.ONOScli4.clusters() )
+            clusters.append( main.ONOScli5.clusters() )
+            clusters.append( main.ONOScli6.clusters() )
+            clusters.append( main.ONOScli7.clusters() )
+            paths = []
+            temp_topo = main.ONOSbench.get_topology( main.ONOScli1.topology() )
+            paths.append( temp_topo.get('paths', False) )
+            temp_topo = main.ONOSbench.get_topology( main.ONOScli2.topology() )
+            paths.append( temp_topo.get('paths', False) )
+            temp_topo = main.ONOSbench.get_topology( main.ONOScli3.topology() )
+            paths.append( temp_topo.get('paths', False) )
+            temp_topo = main.ONOSbench.get_topology( main.ONOScli4.topology() )
+            paths.append( temp_topo.get('paths', False) )
+            temp_topo = main.ONOSbench.get_topology( main.ONOScli5.topology() )
+            paths.append( temp_topo.get('paths', False) )
+            temp_topo = main.ONOSbench.get_topology( main.ONOScli6.topology() )
+            paths.append( temp_topo.get('paths', False) )
+            temp_topo = main.ONOSbench.get_topology( main.ONOScli7.topology() )
+            paths.append( temp_topo.get('paths', False) )
+
+
+            elapsed = time.time() - start_time
+            cli_time = time.time() - cli_start
+            print "CLI time: " + str(cli_time)
+
+            for controller in range(num_controllers):
+                if devices[controller] or not "Error" in devices[controller]:
+                    current_devices_result =  main.Mininet1.compare_switches(MNTopo, json.loads(devices[controller]))
+                else:
+                    current_devices_result = main.FALSE
+                utilities.assert_equals(expect=main.TRUE, actual=current_devices_result,
+                        onpass="ONOS"+str(int(controller+1))+" Switches view is correct",
+                        onfail="ONOS"+str(int(controller+1))+" Switches view is incorrect")
+
+                if ports[controller] or not "Error" in ports[controller]:
+                    current_ports_result =  main.Mininet1.compare_ports(MNTopo, json.loads(ports[controller]))
+                else:
+                    current_ports_result = main.FALSE
+                utilities.assert_equals(expect=main.TRUE, actual=current_ports_result,
+                        onpass="ONOS"+str(int(controller+1))+" ports view is correct",
+                        onfail="ONOS"+str(int(controller+1))+" ports view is incorrect")
+
+                if links[controller] or not "Error" in links[controller]:
+                    current_links_result =  main.Mininet1.compare_links(MNTopo, json.loads(links[controller]))
+                else:
+                    current_links_result = main.FALSE
+                utilities.assert_equals(expect=main.TRUE, actual=current_links_result,
+                        onpass="ONOS"+str(int(controller+1))+" links view is correct",
+                        onfail="ONOS"+str(int(controller+1))+" links view is incorrect")
+            devices_results = devices_results and current_devices_result
+            ports_results = ports_results and current_ports_result
+            links_results = links_results and current_links_result
+
+            #Compare json objects for hosts, dataplane clusters and paths
+
+            #hosts
+            consistent_hosts_result = main.TRUE
+            for controller in range( len( hosts ) ):
+                if not "Error" in hosts[controller]:
+                    if hosts[controller] == hosts[0]:
+                        continue
+                    else:#hosts not consistent
+                        main.log.report("hosts from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+                        main.log.warn( repr( hosts[controller] ) )
+                        consistent_hosts_result = main.FALSE
+
+                else:
+                    main.log.report("Error in getting ONOS hosts from ONOS" + str(controller + 1) )
+                    consistent_hosts_result = main.FALSE
+                    main.log.warn("ONOS" + str(controller + 1) + " hosts response: " + repr(hosts[controller]) )
+            utilities.assert_equals(expect = main.TRUE,actual=consistent_hosts_result,
+                    onpass="Hosts view is consistent across all ONOS nodes",
+                    onfail="ONOS nodes have different views of hosts")
+
+            #Strongly connected clusters of devices
+            consistent_clusters_result = main.TRUE
+            for controller in range( len( clusters ) ):
+                if not "Error" in clusters[controller]:
+                    if clusters[controller] == clusters[0]:
+                        continue
+                    else:#clusters not consistent
+                        main.log.report("clusters from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+                        consistent_clusters_result = main.FALSE
+
+                else:
+                    main.log.report("Error in getting dataplane clusters from ONOS" + str(controller + 1) )
+                    consistent_clusters_result = main.FALSE
+                    main.log.warn("ONOS" + str(controller + 1) + " clusters response: " + repr(clusters[controller]) )
+            utilities.assert_equals(expect = main.TRUE,actual=consistent_clusters_result,
+                    onpass="Clusters view is consistent across all ONOS nodes",
+                    onfail="ONOS nodes have different views of clusters")
+            num_clusters =  len(json.loads(clusters[0])) #there should always only be one cluster
+            utilities.assert_equals(expect = 1, actual = num_clusters,
+                    onpass="ONOS shows 1 SCC",
+                    onfail="ONOS shows "+str(num_clusters) +" SCCs")
+
+
+            #paths
+            consistent_paths_result = main.TRUE
+            for controller in range( len( paths ) ):
+                if not "Error" in paths[controller]:
+                    if paths[controller] == paths[0]:
+                        continue
+                    else:#paths not consistent
+                        main.log.report("paths from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+                        consistent_paths_result = main.FALSE
+
+                else:
+                    main.log.report("Error in getting paths from ONOS" + str(controller + 1) )
+                    consistent_paths_result = main.FALSE
+                    main.log.warn("ONOS" + str(controller + 1) + " paths response: " + repr(paths[controller]) )
+            utilities.assert_equals(expect = main.TRUE,actual=consistent_paths_result,
+                    onpass="Paths count is consistent across all ONOS nodes",
+                    onfail="ONOS nodes have different counts of paths")
+
+
+            topo_result = devices_results and ports_results and links_results\
+                    and consistent_hosts_result and consistent_clusters_result and consistent_paths_result
+
+        topo_result = topo_result and int(count <= 2)
+        note = "note it takes about "+str( int(cli_time) )+" seconds for the test to make all the cli calls to fetch the topology from each ONOS instance"
+        main.log.report("Very crass estimate for topology discovery/convergence("+ str(note) + "): " +\
+                str(elapsed) + " seconds, " + str(count) +" tries" )
+        utilities.assert_equals(expect=main.TRUE, actual=topo_result,
+                onpass="Topology Check Test successful",
+                onfail="Topology Check Test NOT successful")
+        if topo_result == main.TRUE:
+            main.log.report("ONOS topology view matches Mininet topology")
+
+
+    def CASE9 (self,main):
+        '''
+        Link s3-s28 down
+        '''
+        #NOTE: You should probably run a topology check after this
+
+        link_sleep = float(main.params['timers']['LinkDiscovery'])
+
+        description = "Turn off a link to ensure that Link Discovery is working properly"
+        main.log.report(description)
+        main.case(description)
+
+
+        main.step("Kill Link between s3 and s28")
+        Link_Down = main.Mininet1.link(END1="s3",END2="s28",OPTION="down")
+        main.log.info("Waiting " + str(link_sleep) + " seconds for link down to be discovered")
+        time.sleep(link_sleep)
+        utilities.assert_equals(expect=main.TRUE,actual=Link_Down,
+                onpass="Link down succesful",
+                onfail="Failed to bring link down")
+        #TODO do some sort of check here
+
+    def CASE10 (self,main):
+        '''
+        Link s3-s28 up
+        '''
+        #NOTE: You should probably run a topology check after this
+
+        link_sleep = float(main.params['timers']['LinkDiscovery'])
+
+        description = "Restore a link to ensure that Link Discovery is working properly"
+        main.log.report(description)
+        main.case(description)
+
+        main.step("Bring link between s3 and s28 back up")
+        Link_Up = main.Mininet1.link(END1="s3",END2="s28",OPTION="up")
+        main.log.info("Waiting " + str(link_sleep) + " seconds for link up to be discovered")
+        time.sleep(link_sleep)
+        utilities.assert_equals(expect=main.TRUE,actual=Link_Up,
+                onpass="Link up succesful",
+                onfail="Failed to bring link up")
+        #TODO do some sort of check here
+
+
+    def CASE11 (self, main) :
+        '''
+        Switch Down
+        '''
+        #NOTE: You should probably run a topology check after this
+        import time
+
+        switch_sleep = float(main.params['timers']['SwitchDiscovery'])
+
+        description = "Killing a switch to ensure it is discovered correctly"
+        main.log.report(description)
+        main.case(description)
+
+        #TODO: Make this switch parameterizable
+        main.step("Kill s28 ")
+        main.log.report("Deleting s28")
+        main.Mininet1.del_switch("s28")
+        main.log.info("Waiting " + str(switch_sleep) + " seconds for switch down to be discovered")
+        time.sleep(switch_sleep)
+        device = main.ONOScli1.get_device(dpid="0028")
+        #Peek at the deleted switch
+        main.log.warn( str(device) )
+        result = main.FALSE
+        if device and device['available'] == False:
+            result = main.TRUE
+        utilities.assert_equals(expect=main.TRUE,actual=result,
+                onpass="Kill switch succesful",
+                onfail="Failed to kill switch?")
+
+    def CASE12 (self, main) :
+        '''
+        Switch Up
+        '''
+        #NOTE: You should probably run a topology check after this
+        import time
+
+        switch_sleep = float(main.params['timers']['SwitchDiscovery'])
+        description = "Adding a switch to ensure it is discovered correctly"
+        main.log.report(description)
+        main.case(description)
+
+        main.step("Add back s28")
+        main.log.report("Adding back s28")
+        main.Mininet1.add_switch("s28", dpid = '0000000000002800')
+        #TODO: New dpid or same? Ask Thomas?
+        main.Mininet1.add_link('s28', 's3')
+        main.Mininet1.add_link('s28', 's6')
+        main.Mininet1.add_link('s28', 'h28')
+        main.Mininet1.assign_sw_controller(sw="28",count=num_controllers,
+                ip1=ONOS1_ip,port1=ONOS1_port,
+                ip2=ONOS2_ip,port2=ONOS2_port,
+                ip3=ONOS3_ip,port3=ONOS3_port,
+                ip4=ONOS4_ip,port4=ONOS4_port,
+                ip5=ONOS5_ip,port5=ONOS5_port,
+                ip6=ONOS6_ip,port6=ONOS6_port,
+                ip7=ONOS7_ip,port7=ONOS7_port)
+        main.log.info("Waiting " + str(switch_sleep) + " seconds for switch up to be discovered")
+        time.sleep(switch_sleep)
+        device = main.ONOScli1.get_device(dpid="0028")
+        #Peek at the deleted switch
+        main.log.warn( str(device) )
+        result = main.FALSE
+        if device and device['available'] == True:
+            result = main.TRUE
+        utilities.assert_equals(expect=main.TRUE,actual=result,
+                onpass="add switch succesful",
+                onfail="Failed to add switch?")
+
+    def CASE13 (self, main) :
+        '''
+        Clean up
+        '''
+        import os
+        import time
+        #printing colors to terminal
+        colors = {}
+        colors['cyan']   = '\033[96m'
+        colors['purple'] = '\033[95m'
+        colors['blue']   = '\033[94m'
+        colors['green']  = '\033[92m'
+        colors['yellow'] = '\033[93m'
+        colors['red']    = '\033[91m'
+        colors['end']    = '\033[0m'
+        description = "Test Cleanup"
+        main.log.report(description)
+        main.case(description)
+        main.step("Killing tcpdumps")
+        main.Mininet2.stop_tcpdump()
+
+        main.step("Checking ONOS Logs for errors")
+        print colors['purple'] + "Checking logs for errors on ONOS1:" + colors['end']
+        print main.ONOSbench.check_logs(ONOS1_ip)
+        print colors['purple'] + "Checking logs for errors on ONOS2:" + colors['end']
+        print main.ONOSbench.check_logs(ONOS2_ip)
+        print colors['purple'] + "Checking logs for errors on ONOS3:" + colors['end']
+        print main.ONOSbench.check_logs(ONOS3_ip)
+        print colors['purple'] + "Checking logs for errors on ONOS4:" + colors['end']
+        print main.ONOSbench.check_logs(ONOS4_ip)
+        print colors['purple'] + "Checking logs for errors on ONOS5:" + colors['end']
+        print main.ONOSbench.check_logs(ONOS5_ip)
+        print colors['purple'] + "Checking logs for errors on ONOS6:" + colors['end']
+        print main.ONOSbench.check_logs(ONOS6_ip)
+        print colors['purple'] + "Checking logs for errors on ONOS7:" + colors['end']
+        print main.ONOSbench.check_logs(ONOS7_ip)
+
+        main.step("Copying MN pcap and ONOS log files to test station")
+        testname = main.TEST
+        teststation_user = main.params['TESTONUSER']
+        teststation_IP = main.params['TESTONIP']
+        #NOTE: MN Pcap file is being saved to ~/packet_captures
+        #       scp this file as MN and TestON aren't necessarily the same vm
+        #FIXME: scp
+        #####mn files
+        #TODO: Load these from params
+        #NOTE: must end in /
+        log_folder = "/opt/onos/log/"
+        log_files = ["karaf.log", "karaf.log.1"]
+        #NOTE: must end in /
+        dst_dir = "~/packet_captures/"
+        for f in log_files:
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS1_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS1-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS2_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS2-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS3_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS3-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS4_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS4-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS5_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS5-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS6_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS6-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS7_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS7-"+f )
+
+        #std*.log's
+        #NOTE: must end in /
+        log_folder = "/opt/onos/var/"
+        log_files = ["stderr.log", "stdout.log"]
+        #NOTE: must end in /
+        dst_dir = "~/packet_captures/"
+        for f in log_files:
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS1_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS1-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS2_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS2-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS3_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS3-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS4_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS4-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS5_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS5-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS6_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS6-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS7_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS7-"+f )
+
+
+        #sleep so scp can finish
+        time.sleep(10)
+        main.step("Packing and rotating pcap archives")
+        os.system("~/TestON/dependencies/rotate.sh "+ str(testname))
+
+
+        #TODO: actually check something here
+        utilities.assert_equals(expect=main.TRUE, actual=main.TRUE,
+                onpass="Test cleanup successful",
+                onfail="Test cleanup NOT successful")
+
+    def CASE14 ( self, main ) :
+        '''
+        start election app on all onos nodes
+        '''
+        leader_result = main.TRUE
+        #install app on onos 1
+        main.log.info("Install leadership election app")
+        main.ONOScli1.feature_install("onos-app-election")
+        #wait for election
+        #check for leader
+        leader = main.ONOScli1.election_test_leader()
+        #verify leader is ONOS1
+        if leader == ONOS1_ip:
+            #all is well
+            pass
+        elif leader == None:
+            #No leader elected
+            main.log.report("No leader was elected")
+            leader_result = main.FALSE
+        elif leader == main.FALSE:
+            #error in  response
+            #TODO: add check for "Command not found:" in the driver, this means the app isn't loaded
+            main.log.report("Something is wrong with election_test_leader function, check the error logs")
+            leader_result = main.FALSE
+        else:
+            #error in  response
+            main.log.report("Unexpected response from election_test_leader function:'"+str(leader)+"'")
+            leader_result = main.FALSE
+
+
+
+
+        #install on other nodes and check for leader.
+        #Should be onos1 and each app should show the same leader
+        for controller in range(2,num_controllers+1):
+            node = getattr( main, ( 'ONOScli' + str( controller ) ) )#loop through ONOScli handlers
+            node.feature_install("onos-app-election")
+            leaderN = node.election_test_leader()
+            #verify leader is ONOS1
+            if leaderN == ONOS1_ip:
+                #all is well
+                pass
+            elif leaderN == main.FALSE:
+                #error in  response
+                #TODO: add check for "Command not found:" in the driver, this means the app isn't loaded
+                main.log.report("Something is wrong with election_test_leader function, check the error logs")
+                leader_result = main.FALSE
+            elif leader != leaderN:
+                leader_result = main.FALSE
+                main.log.report("ONOS" + str(controller) + " sees "+str(leaderN) +
+                        " as the leader of the election app. Leader should be "+str(leader) )
+        if leader_result:
+            main.log.report("Leadership election tests passed(consistent view of leader across listeners and a leader was elected)")
+        utilities.assert_equals(expect=main.TRUE, actual=leader_result,
+                onpass="Leadership election passed",
+                onfail="Something went wrong with Leadership election")
+
+    def CASE15 ( self, main ) :
+        '''
+        Check that Leadership Election is still functional
+        '''
+        leader_result = main.TRUE
+        description = "Check that Leadership Election is still functional"
+        main.log.report(description)
+        main.case(description)
+        main.step("Find current leader and withdraw")
+        leader = main.ONOScli1.election_test_leader()
+        #TODO: do some sanity checking on leader before using it
+        withdraw_result = main.FALSE
+        if leader == ONOS1_ip:
+            old_leader = getattr( main, "ONOScli1" )
+        elif leader == ONOS2_ip:
+            old_leader = getattr( main, "ONOScli2" )
+        elif leader == ONOS3_ip:
+            old_leader = getattr( main, "ONOScli3" )
+        elif leader == ONOS4_ip:
+            old_leader = getattr( main, "ONOScli4" )
+        elif leader == ONOS5_ip:
+            old_leader = getattr( main, "ONOScli5" )
+        elif leader == ONOS6_ip:
+            old_leader = getattr( main, "ONOScli6" )
+        elif leader == ONOS7_ip:
+            old_leader = getattr( main, "ONOScli7" )
+        elif leader == None or leader == main.FALSE:
+            main.log.report("Leader for the election app should be an ONOS node,"\
+                    +"instead got '"+str(leader)+"'")
+            leader_result = main.FALSE
+        withdraw_result = old_leader.election_test_withdraw()
+
+
+        main.step("Make sure new leader is elected")
+        leader_list = []
+        for controller in range(1,num_controllers+1):
+            node = getattr( main, ( 'ONOScli' + str( controller ) ) )#loop through ONOScli handlers
+            leader_list.append( node.election_test_leader() )
+        for leaderN in leader_list:
+            if leaderN == leader:
+                main.log.report("ONOS"+str(controller)+" still sees " + str(leader) +\
+                        " as leader after they withdrew")
+                leader_result = main.FALSE
+            elif leaderN == main.FALSE:
+                #error in  response
+                #TODO: add check for "Command not found:" in the driver, this means the app isn't loaded
+                main.log.report("Something is wrong with election_test_leader function, check the error logs")
+                leader_result = main.FALSE
+        consistent_leader = main.FALSE
+        if len( set( leader_list ) ) == 1:
+            main.log.info("Each Election-app sees '"+str(leader_list[0])+"' as the leader")
+            consistent_leader = main.TRUE
+        else:
+            main.log.report("Inconsistent responses for leader of Election-app:")
+            for n in range(len(leader_list)):
+                main.log.report("ONOS" + str(n+1) + " response: " + str(leader_list[n]) )
+        if leader_result:
+            main.log.report("Leadership election tests passed(consistent view of leader across listeners and a new leader was elected when the old leader resigned)")
+        utilities.assert_equals(expect=main.TRUE, actual=leader_result,
+                onpass="Leadership election passed",
+                onfail="Something went wrong with Leadership election")
+
+
+        main.step("Run for election on old leader(just so everyone is in the hat)")
+        run_result = old_leader.election_test_run()
+        if consistent_leader == main.TRUE:
+            after_run = main.ONOScli1.election_test_leader()
+            #verify leader didn't just change
+            if after_run == leader_list[0]:
+                leader_result = main.TRUE
+            else:
+                leader_result = main.FALSE
+        #TODO: assert on  run and withdraw results?
+
+        utilities.assert_equals(expect=main.TRUE, actual=leader_result,
+                onpass="Leadership election passed",
+                onfail="Something went wrong with Leadership election after the old leader re-ran for election")
+
diff --git a/TestON/tests/HATestClusterRestart/HATestClusterRestart.topo b/TestON/tests/HATestClusterRestart/HATestClusterRestart.topo
new file mode 100644
index 0000000..4d4156c
--- /dev/null
+++ b/TestON/tests/HATestClusterRestart/HATestClusterRestart.topo
@@ -0,0 +1,173 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOSbench>
+
+        <ONOScli1>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli1>
+
+        <ONOScli2>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli2>
+
+        <ONOScli3>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli3>
+
+
+        <ONOScli4>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli4>
+
+
+        <ONOScli5>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>6</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli5>
+
+
+        <ONOScli6>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>7</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli6>
+
+
+        <ONOScli7>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>8</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli7>
+
+        <ONOS1>
+            <host>10.128.30.11</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>9</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1>
+
+        <ONOS2>
+            <host>10.128.30.12</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>10</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS2>
+
+        <ONOS3>
+            <host>10.128.30.13</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>11</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS3>
+
+        <ONOS4>
+            <host>10.128.30.14</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>12</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS4>
+
+        <ONOS5>
+            <host>10.128.30.15</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>13</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS5>
+
+        <ONOS6>
+            <host>10.128.30.16</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>14</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS6>
+
+        <ONOS7>
+            <host>10.128.30.17</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>15</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS7>
+
+        <Mininet1>
+            <host>10.128.30.9</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>16</connect_order>
+            <COMPONENTS>
+                #Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+                <arg2> --topo mytopo </arg2>
+                <arg3> </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet1>
+
+        <Mininet2>
+            <host>10.128.30.9</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>RemoteMininetDriver</type>
+            <connect_order>17</connect_order>
+            <COMPONENTS>
+                # Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+                <arg2> --topo mytopo --arp</arg2>
+                <controller> remote </controller>
+             </COMPONENTS>
+        </Mininet2>
+
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/HPSwitchTest/__init__.py b/TestON/tests/HATestClusterRestart/__init__.py
similarity index 100%
copy from TestON/tests/HPSwitchTest/__init__.py
copy to TestON/tests/HATestClusterRestart/__init__.py
diff --git a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.params b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.params
new file mode 100644
index 0000000..78e0c83
--- /dev/null
+++ b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.params
@@ -0,0 +1,64 @@
+<PARAMS>
+    <testcases>1,2,8,3,4,5,14,[6],8,7,4,15,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
+    <ENV>
+    <cellName>HA</cellName>
+    </ENV>
+    <Git>False</Git>
+    <num_controllers> 7 </num_controllers>
+
+    <CTRL>
+        <ip1>10.128.30.11</ip1>
+        <port1>6633</port1>
+
+        <ip2>10.128.30.12</ip2>
+        <port2>6633</port2>
+
+        <ip3>10.128.30.13</ip3>
+        <port3>6633</port3>
+
+        <ip4>10.128.30.14</ip4>
+        <port4>6633</port4>
+
+        <ip5>10.128.30.15</ip5>
+        <port5>6633</port5>
+
+        <ip6>10.128.30.16</ip6>
+        <port6>6633</port6>
+
+        <ip7>10.128.30.17</ip7>
+        <port7>6633</port7>
+    </CTRL>
+    <TESTONUSER>admin</TESTONUSER>
+    <TESTONIP>10.128.30.9</TESTONIP>
+    <PING>
+        <source1>h8</source1>
+        <source2>h9</source2>
+        <source3>h10</source3>
+        <source4>h11</source4>
+        <source5>h12</source5>
+        <source6>h13</source6>
+        <source7>h14</source7>
+        <source8>h15</source8>
+        <source9>h16</source9>
+        <source10>h17</source10>
+        <target1>10.0.0.18</target1>
+        <target2>10.0.0.19</target2>
+        <target3>10.0.0.20</target3>
+        <target4>10.0.0.21</target4>
+        <target5>10.0.0.22</target5>
+        <target6>10.0.0.23</target6>
+        <target7>10.0.0.24</target7>
+        <target8>10.0.0.25</target8>
+        <target9>10.0.0.26</target9>
+        <target10>10.0.0.27</target10>
+    </PING>
+    <timers>
+        <LinkDiscovery>.2</LinkDiscovery>
+        <SwitchDiscovery>.2</SwitchDiscovery>
+    </timers>
+    <MNtcpdump>
+        <intf>eth0</intf>
+        <port> </port>
+        <folder>~/packet_captures/</folder>
+    </MNtcpdump>
+</PARAMS>
diff --git a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
new file mode 100644
index 0000000..b9d2925
--- /dev/null
+++ b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.py
@@ -0,0 +1,1859 @@
+'''
+Description: This test is to determine if ONOS can handle
+    a minority of it's nodes restarting
+
+List of test cases:
+CASE1: Compile ONOS and push it to the test machines
+CASE2: Assign mastership to controllers
+CASE3: Assign intents
+CASE4: Ping across added host intents
+CASE5: Reading state of ONOS
+CASE6: The Failure case.
+CASE7: Check state after control plane failure
+CASE8: Compare topo
+CASE9: Link s3-s28 down
+CASE10: Link s3-s28 up
+CASE11: Switch down
+CASE12: Switch up
+CASE13: Clean up
+CASE14: start election app on all onos nodes
+CASE15: Check that Leadership Election is still functional
+'''
+class HATestMinorityRestart:
+
+    def __init__(self) :
+        self.default = ''
+
+    def CASE1(self,main) :
+        '''
+        CASE1 is to compile ONOS and push it to the test machines
+
+        Startup sequence:
+        git pull
+        mvn clean install
+        onos-package
+        cell <name>
+        onos-verify-cell
+        NOTE: temporary - onos-remove-raft-logs
+        onos-install -f
+        onos-wait-for-start
+        '''
+        import time
+        main.log.report("ONOS HA test: Restart minority of ONOS nodes - initialization")
+        main.case("Setting up test environment")
+
+        # load some vairables from the params file
+        PULL_CODE = False
+        if main.params['Git'] == 'True':
+            PULL_CODE = True
+        cell_name = main.params['ENV']['cellName']
+
+        #set global variables
+        global ONOS1_ip
+        global ONOS1_port
+        global ONOS2_ip
+        global ONOS2_port
+        global ONOS3_ip
+        global ONOS3_port
+        global ONOS4_ip
+        global ONOS4_port
+        global ONOS5_ip
+        global ONOS5_port
+        global ONOS6_ip
+        global ONOS6_port
+        global ONOS7_ip
+        global ONOS7_port
+        global num_controllers
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS1_port = main.params['CTRL']['port1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS2_port = main.params['CTRL']['port2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+        ONOS3_port = main.params['CTRL']['port3']
+        ONOS4_ip = main.params['CTRL']['ip4']
+        ONOS4_port = main.params['CTRL']['port4']
+        ONOS5_ip = main.params['CTRL']['ip5']
+        ONOS5_port = main.params['CTRL']['port5']
+        ONOS6_ip = main.params['CTRL']['ip6']
+        ONOS6_port = main.params['CTRL']['port6']
+        ONOS7_ip = main.params['CTRL']['ip7']
+        ONOS7_port = main.params['CTRL']['port7']
+        num_controllers = int(main.params['num_controllers'])
+
+
+        main.step("Applying cell variable to environment")
+        cell_result = main.ONOSbench.set_cell(cell_name)
+        verify_result = main.ONOSbench.verify_cell()
+
+        #FIXME:this is short term fix
+        main.log.report("Removing raft logs")
+        main.ONOSbench.onos_remove_raft_logs()
+        main.log.report("Uninstalling ONOS")
+        main.ONOSbench.onos_uninstall(ONOS1_ip)
+        main.ONOSbench.onos_uninstall(ONOS2_ip)
+        main.ONOSbench.onos_uninstall(ONOS3_ip)
+        main.ONOSbench.onos_uninstall(ONOS4_ip)
+        main.ONOSbench.onos_uninstall(ONOS5_ip)
+        main.ONOSbench.onos_uninstall(ONOS6_ip)
+        main.ONOSbench.onos_uninstall(ONOS7_ip)
+
+        clean_install_result = main.TRUE
+        git_pull_result = main.TRUE
+
+        main.step("Compiling the latest version of ONOS")
+        if PULL_CODE:
+            main.step("Git checkout and pull master")
+            main.ONOSbench.git_checkout("master")
+            git_pull_result = main.ONOSbench.git_pull()
+
+            main.step("Using mvn clean & install")
+            clean_install_result = main.TRUE
+            if git_pull_result == main.TRUE:
+                clean_install_result = main.ONOSbench.clean_install()
+            else:
+                main.log.warn("Did not pull new code so skipping mvn "+ \
+                        "clean install")
+        main.ONOSbench.get_version(report=True)
+
+        main.step("Creating ONOS package")
+        package_result = main.ONOSbench.onos_package()
+
+        main.step("Installing ONOS package")
+        onos1_install_result = main.ONOSbench.onos_install(options="-f",
+                node=ONOS1_ip)
+        onos2_install_result = main.ONOSbench.onos_install(options="-f",
+                node=ONOS2_ip)
+        onos3_install_result = main.ONOSbench.onos_install(options="-f",
+                node=ONOS3_ip)
+        onos4_install_result = main.ONOSbench.onos_install(options="-f",
+                node=ONOS4_ip)
+        onos5_install_result = main.ONOSbench.onos_install(options="-f",
+                node=ONOS5_ip)
+        onos6_install_result = main.ONOSbench.onos_install(options="-f",
+                node=ONOS6_ip)
+        onos7_install_result = main.ONOSbench.onos_install(options="-f",
+                node=ONOS7_ip)
+        onos_install_result = onos1_install_result and onos2_install_result\
+                and onos3_install_result and onos4_install_result\
+                and onos5_install_result and onos6_install_result\
+                and onos7_install_result
+        '''
+        #FIXME: work around until onos is less fragile
+        main.ONOSbench.handle.sendline("onos-cluster-install")
+        print main.ONOSbench.handle.expect("\$")
+        onos_install_result = main.TRUE
+        '''
+
+
+        main.step("Checking if ONOS is up yet")
+        #TODO check bundle:list?
+        for i in range(2):
+            onos1_isup = main.ONOSbench.isup(ONOS1_ip)
+            if not onos1_isup:
+                main.log.report("ONOS1 didn't start!")
+            onos2_isup = main.ONOSbench.isup(ONOS2_ip)
+            if not onos2_isup:
+                main.log.report("ONOS2 didn't start!")
+            onos3_isup = main.ONOSbench.isup(ONOS3_ip)
+            if not onos3_isup:
+                main.log.report("ONOS3 didn't start!")
+            onos4_isup = main.ONOSbench.isup(ONOS4_ip)
+            if not onos4_isup:
+                main.log.report("ONOS4 didn't start!")
+            onos5_isup = main.ONOSbench.isup(ONOS5_ip)
+            if not onos5_isup:
+                main.log.report("ONOS5 didn't start!")
+            onos6_isup = main.ONOSbench.isup(ONOS6_ip)
+            if not onos6_isup:
+                main.log.report("ONOS6 didn't start!")
+            onos7_isup = main.ONOSbench.isup(ONOS7_ip)
+            if not onos7_isup:
+                main.log.report("ONOS7 didn't start!")
+            onos_isup_result = onos1_isup and onos2_isup and onos3_isup\
+                    and onos4_isup and onos5_isup and onos6_isup and onos7_isup
+            if onos_isup_result == main.TRUE:
+                break
+        # TODO: if it becomes an issue, we can retry this step  a few times
+
+
+        cli_result1 = main.ONOScli1.start_onos_cli(ONOS1_ip)
+        cli_result2 = main.ONOScli2.start_onos_cli(ONOS2_ip)
+        cli_result3 = main.ONOScli3.start_onos_cli(ONOS3_ip)
+        cli_result4 = main.ONOScli4.start_onos_cli(ONOS4_ip)
+        cli_result5 = main.ONOScli5.start_onos_cli(ONOS5_ip)
+        cli_result6 = main.ONOScli6.start_onos_cli(ONOS6_ip)
+        cli_result7 = main.ONOScli7.start_onos_cli(ONOS7_ip)
+        cli_results = cli_result1 and cli_result2 and cli_result3 and\
+                cli_result4 and cli_result5 and cli_result6 and cli_result7
+
+
+        main.step("Start Packet Capture MN")
+        main.Mininet2.start_tcpdump(
+                str(main.params['MNtcpdump']['folder'])+str(main.TEST)+"-MN.pcap",
+                intf = main.params['MNtcpdump']['intf'],
+                port = main.params['MNtcpdump']['port'])
+
+
+        case1_result = (clean_install_result and package_result and
+                cell_result and verify_result and onos_install_result and
+                onos_isup_result and cli_results)
+
+        utilities.assert_equals(expect=main.TRUE, actual=case1_result,
+                onpass="Test startup successful",
+                onfail="Test startup NOT successful")
+
+
+        if case1_result==main.FALSE:
+            main.cleanup()
+            main.exit()
+
+    def CASE2(self,main) :
+        '''
+        Assign mastership to controllers
+        '''
+        import time
+        import json
+        import re
+
+        main.log.report("Assigning switches to controllers")
+        main.case("Assigning Controllers")
+        main.step("Assign switches to controllers")
+
+        for i in range (1,29):
+           main.Mininet1.assign_sw_controller(sw=str(i),count=num_controllers,
+                    ip1=ONOS1_ip,port1=ONOS1_port,
+                    ip2=ONOS2_ip,port2=ONOS2_port,
+                    ip3=ONOS3_ip,port3=ONOS3_port,
+                    ip4=ONOS4_ip,port4=ONOS4_port,
+                    ip5=ONOS5_ip,port5=ONOS5_port,
+                    ip6=ONOS6_ip,port6=ONOS6_port,
+                    ip7=ONOS7_ip,port7=ONOS7_port)
+
+        mastership_check = main.TRUE
+        for i in range (1,29):
+            response = main.Mininet1.get_sw_controller("s"+str(i))
+            try:
+                main.log.info(str(response))
+            except:
+                main.log.info(repr(response))
+            if re.search("tcp:"+ONOS1_ip,response)\
+                    and re.search("tcp:"+ONOS2_ip,response)\
+                    and re.search("tcp:"+ONOS3_ip,response)\
+                    and re.search("tcp:"+ONOS4_ip,response)\
+                    and re.search("tcp:"+ONOS5_ip,response)\
+                    and re.search("tcp:"+ONOS6_ip,response)\
+                    and re.search("tcp:"+ONOS7_ip,response):
+                mastership_check = mastership_check and main.TRUE
+            else:
+                mastership_check = main.FALSE
+        if mastership_check == main.TRUE:
+            main.log.report("Switch mastership assigned correctly")
+        utilities.assert_equals(expect = main.TRUE,actual=mastership_check,
+                onpass="Switch mastership assigned correctly",
+                onfail="Switches not assigned correctly to controllers")
+
+        #Manually assign mastership to the controller we want
+        role_call = main.TRUE
+        role_check = main.TRUE
+
+        device_id = main.ONOScli1.get_device("1000")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS1_ip)
+        if ONOS1_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("2800")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS1_ip)
+        if ONOS1_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("2000")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS2_ip)
+        if ONOS2_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3000")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS2_ip)
+        if ONOS2_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("5000")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS3_ip)
+        if ONOS3_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6000")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS3_ip)
+        if ONOS3_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id =  main.ONOScli1.get_device("3004")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS4_ip)
+        if ONOS4_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3008")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3009")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3010")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3011")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3012")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3013")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3014")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3015")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3016")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3017")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6007")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS6_ip)
+        if ONOS6_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6018")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6019")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6020")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6021")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6022")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6023")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6024")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6025")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6026")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6027")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        utilities.assert_equals(expect = main.TRUE,actual=role_call,
+                onpass="Re-assigned switch mastership to designated controller",
+                onfail="Something wrong with device_role calls")
+
+        utilities.assert_equals(expect = main.TRUE,actual=role_check,
+                onpass="Switches were successfully reassigned to designated controller",
+                onfail="Switches were not successfully reassigned")
+        mastership_check = mastership_check and role_call and role_check
+        utilities.assert_equals(expect = main.TRUE,actual=mastership_check,
+                onpass="Switch mastership correctly assigned",
+                onfail="Error in (re)assigning switch mastership")
+
+
+    def CASE3(self,main) :
+        """
+        Assign intents
+
+        """
+        import time
+        import json
+        import re
+        main.log.report("Adding host intents")
+        main.case("Adding host Intents")
+
+        main.step("Discovering  Hosts( Via pingall for now)")
+        #FIXME: Once we have a host discovery mechanism, use that instead
+
+        #install onos-app-fwd
+        main.log.info("Install reactive forwarding app")
+        main.ONOScli1.feature_install("onos-app-fwd")
+        main.ONOScli2.feature_install("onos-app-fwd")
+        main.ONOScli3.feature_install("onos-app-fwd")
+        main.ONOScli4.feature_install("onos-app-fwd")
+        main.ONOScli5.feature_install("onos-app-fwd")
+        main.ONOScli6.feature_install("onos-app-fwd")
+        main.ONOScli7.feature_install("onos-app-fwd")
+
+        #REACTIVE FWD test
+        ping_result = main.FALSE
+        time1 = time.time()
+        ping_result = main.Mininet1.pingall()
+        time2 = time.time()
+        main.log.info("Time for pingall: %2f seconds" % (time2 - time1))
+
+        #uninstall onos-app-fwd
+        main.log.info("Uninstall reactive forwarding app")
+        main.ONOScli1.feature_uninstall("onos-app-fwd")
+        main.ONOScli2.feature_uninstall("onos-app-fwd")
+        main.ONOScli3.feature_uninstall("onos-app-fwd")
+        main.ONOScli4.feature_uninstall("onos-app-fwd")
+        main.ONOScli5.feature_uninstall("onos-app-fwd")
+        main.ONOScli6.feature_uninstall("onos-app-fwd")
+        main.ONOScli7.feature_uninstall("onos-app-fwd")
+        #timeout for fwd flows
+        time.sleep(10)
+
+        main.step("Add  host intents")
+        #TODO:  move the host numbers to params
+        import json
+        intents_json= json.loads(main.ONOScli1.hosts())
+        intent_add_result = True
+        for i in range(8,18):
+            main.log.info("Adding host intent between h"+str(i)+" and h"+str(i+10))
+            host1 =  "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
+            host2 =  "00:00:00:00:00:" + str(hex(i+10)[2:]).zfill(2).upper()
+            host1_id = main.ONOScli1.get_host(host1)['id']
+            host2_id = main.ONOScli1.get_host(host2)['id']
+            #NOTE: get host can return None
+            if host1_id and host2_id:
+                tmp_result = main.ONOScli1.add_host_intent(host1_id, host2_id )
+            else:
+                main.log.error("Error, get_host() failed")
+                tmp_result = main.FALSE
+            intent_add_result = bool(intent_add_result and tmp_result)
+        utilities.assert_equals(expect=True, actual=intent_add_result,
+                onpass="Switch mastership correctly assigned",
+                onfail="Error in (re)assigning switch mastership")
+        #TODO Check if intents all exist in datastore
+        #NOTE: Do we need to print this once the test is working?
+        #main.log.info(json.dumps(json.loads(main.ONOScli1.intents(json_format=True)),
+        #    sort_keys=True, indent=4, separators=(',', ': ') ) )
+
+    def CASE4(self,main) :
+        """
+        Ping across added host intents
+        """
+        description = " Ping across added host intents"
+        main.log.report(description)
+        main.case(description)
+        Ping_Result = main.TRUE
+        for i in range(8,18):
+            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
+            Ping_Result = Ping_Result and ping
+            if ping==main.FALSE:
+                main.log.warn("Ping failed between h"+str(i)+" and h" + str(i+10))
+            elif ping==main.TRUE:
+                main.log.info("Ping test passed!")
+                Ping_Result = main.TRUE
+        if Ping_Result==main.FALSE:
+            main.log.report("Intents have not been installed correctly, pings failed.")
+        if Ping_Result==main.TRUE:
+            main.log.report("Intents have been installed correctly and verified by pings")
+        utilities.assert_equals(expect = main.TRUE,actual=Ping_Result,
+                onpass="Intents have been installed correctly and pings work",
+                onfail ="Intents have not been installed correctly, pings failed." )
+
+    def CASE5(self,main) :
+        '''
+        Reading state of ONOS
+        '''
+        import time
+        import json
+        from subprocess import Popen, PIPE
+        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
+
+        main.log.report("Setting up and gathering data for current state")
+        main.case("Setting up and gathering data for current state")
+        #The general idea for this test case is to pull the state of (intents,flows, topology,...) from each ONOS node
+        #We can then compare them with eachother and also with past states
+
+        main.step("Get the Mastership of each switch from each controller")
+        global mastership_state
+        mastership_state = []
+
+        #Assert that each device has a master
+        ONOS1_master_not_null = main.ONOScli1.roles_not_null()
+        ONOS2_master_not_null = main.ONOScli2.roles_not_null()
+        ONOS3_master_not_null = main.ONOScli3.roles_not_null()
+        ONOS4_master_not_null = main.ONOScli4.roles_not_null()
+        ONOS5_master_not_null = main.ONOScli5.roles_not_null()
+        ONOS6_master_not_null = main.ONOScli6.roles_not_null()
+        ONOS7_master_not_null = main.ONOScli7.roles_not_null()
+        roles_not_null = ONOS1_master_not_null and ONOS2_master_not_null and\
+                ONOS3_master_not_null and ONOS4_master_not_null and\
+                ONOS5_master_not_null and ONOS6_master_not_null and\
+                ONOS7_master_not_null
+        utilities.assert_equals(expect = main.TRUE,actual=roles_not_null,
+                onpass="Each device has a master",
+                onfail="Some devices don't have a master assigned")
+
+
+        ONOS1_mastership = main.ONOScli1.roles()
+        ONOS2_mastership = main.ONOScli2.roles()
+        ONOS3_mastership = main.ONOScli3.roles()
+        ONOS4_mastership = main.ONOScli4.roles()
+        ONOS5_mastership = main.ONOScli5.roles()
+        ONOS6_mastership = main.ONOScli6.roles()
+        ONOS7_mastership = main.ONOScli7.roles()
+        #print json.dumps(json.loads(ONOS1_mastership), sort_keys=True, indent=4, separators=(',', ': '))
+        if "Error" in ONOS1_mastership or not ONOS1_mastership\
+                or "Error" in ONOS2_mastership or not ONOS2_mastership\
+                or "Error" in ONOS3_mastership or not ONOS3_mastership\
+                or "Error" in ONOS4_mastership or not ONOS4_mastership\
+                or "Error" in ONOS5_mastership or not ONOS5_mastership\
+                or "Error" in ONOS6_mastership or not ONOS6_mastership\
+                or "Error" in ONOS7_mastership or not ONOS7_mastership:
+                    main.log.report("Error in getting ONOS roles")
+                    main.log.warn("ONOS1 mastership response: " + repr(ONOS1_mastership))
+                    main.log.warn("ONOS2 mastership response: " + repr(ONOS2_mastership))
+                    main.log.warn("ONOS3 mastership response: " + repr(ONOS3_mastership))
+                    main.log.warn("ONOS4 mastership response: " + repr(ONOS4_mastership))
+                    main.log.warn("ONOS5 mastership response: " + repr(ONOS5_mastership))
+                    main.log.warn("ONOS6 mastership response: " + repr(ONOS6_mastership))
+                    main.log.warn("ONOS7 mastership response: " + repr(ONOS7_mastership))
+                    consistent_mastership = main.FALSE
+        elif ONOS1_mastership == ONOS2_mastership\
+                and ONOS1_mastership == ONOS3_mastership\
+                and ONOS1_mastership == ONOS4_mastership\
+                and ONOS1_mastership == ONOS5_mastership\
+                and ONOS1_mastership == ONOS6_mastership\
+                and ONOS1_mastership == ONOS7_mastership:
+                    mastership_state = ONOS1_mastership
+                    consistent_mastership = main.TRUE
+                    main.log.report("Switch roles are consistent across all ONOS nodes")
+        else:
+            main.log.warn("ONOS1 roles: ", json.dumps(json.loads(ONOS1_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS2 roles: ", json.dumps(json.loads(ONOS2_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS3 roles: ", json.dumps(json.loads(ONOS3_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS4 roles: ", json.dumps(json.loads(ONOS4_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS5 roles: ", json.dumps(json.loads(ONOS5_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS6 roles: ", json.dumps(json.loads(ONOS6_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS7 roles: ", json.dumps(json.loads(ONOS7_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            consistent_mastership = main.FALSE
+        utilities.assert_equals(expect = main.TRUE,actual=consistent_mastership,
+                onpass="Switch roles are consistent across all ONOS nodes",
+                onfail="ONOS nodes have different views of switch roles")
+
+
+        main.step("Get the intents from each controller")
+        global intent_state
+        intent_state = []
+        ONOS1_intents = main.ONOScli1.intents( json_format=True )
+        ONOS2_intents = main.ONOScli2.intents( json_format=True )
+        ONOS3_intents = main.ONOScli3.intents( json_format=True )
+        ONOS4_intents = main.ONOScli4.intents( json_format=True )
+        ONOS5_intents = main.ONOScli5.intents( json_format=True )
+        ONOS6_intents = main.ONOScli6.intents( json_format=True )
+        ONOS7_intents = main.ONOScli7.intents( json_format=True )
+        intent_check = main.FALSE
+        if "Error" in ONOS1_intents or not ONOS1_intents\
+                or "Error" in ONOS2_intents or not ONOS2_intents\
+                or "Error" in ONOS3_intents or not ONOS3_intents\
+                or "Error" in ONOS4_intents or not ONOS4_intents\
+                or "Error" in ONOS5_intents or not ONOS5_intents\
+                or "Error" in ONOS6_intents or not ONOS6_intents\
+                or "Error" in ONOS7_intents or not ONOS7_intents:
+                    main.log.report("Error in getting ONOS intents")
+                    main.log.warn("ONOS1 intents response: " + repr(ONOS1_intents))
+                    main.log.warn("ONOS2 intents response: " + repr(ONOS2_intents))
+                    main.log.warn("ONOS3 intents response: " + repr(ONOS3_intents))
+                    main.log.warn("ONOS4 intents response: " + repr(ONOS4_intents))
+                    main.log.warn("ONOS5 intents response: " + repr(ONOS5_intents))
+                    main.log.warn("ONOS6 intents response: " + repr(ONOS6_intents))
+                    main.log.warn("ONOS7 intents response: " + repr(ONOS7_intents))
+        elif ONOS1_intents == ONOS2_intents\
+                and ONOS1_intents == ONOS3_intents\
+                and ONOS1_intents == ONOS4_intents\
+                and ONOS1_intents == ONOS5_intents\
+                and ONOS1_intents == ONOS6_intents\
+                and ONOS1_intents == ONOS7_intents:
+                    intent_state = ONOS1_intents
+                    intent_check = main.TRUE
+                    main.log.report("Intents are consistent across all ONOS nodes")
+        else:
+            main.log.warn("ONOS1 intents: ", json.dumps(json.loads(ONOS1_intents),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS2 intents: ", json.dumps(json.loads(ONOS2_intents),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS3 intents: ", json.dumps(json.loads(ONOS3_intents),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS4 intents: ", json.dumps(json.loads(ONOS4_intents),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS5 intents: ", json.dumps(json.loads(ONOS5_intents),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS6 intents: ", json.dumps(json.loads(ONOS6_intents),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS7 intents: ", json.dumps(json.loads(ONOS7_intents),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+        utilities.assert_equals(expect = main.TRUE,actual=intent_check,
+                onpass="Intents are consistent across all ONOS nodes",
+                onfail="ONOS nodes have different views of intents")
+
+
+        main.step("Get the flows from each controller")
+        global flow_state
+        flow_state = []
+        ONOS1_flows = main.ONOScli1.flows( json_format=True )
+        ONOS2_flows = main.ONOScli2.flows( json_format=True )
+        ONOS3_flows = main.ONOScli3.flows( json_format=True )
+        ONOS4_flows = main.ONOScli4.flows( json_format=True )
+        ONOS5_flows = main.ONOScli5.flows( json_format=True )
+        ONOS6_flows = main.ONOScli6.flows( json_format=True )
+        ONOS7_flows = main.ONOScli7.flows( json_format=True )
+        flow_check = main.FALSE
+        if "Error" in ONOS1_flows or not ONOS1_flows\
+                or "Error" in ONOS2_flows or not ONOS2_flows\
+                or "Error" in ONOS3_flows or not ONOS3_flows\
+                or "Error" in ONOS4_flows or not ONOS4_flows\
+                or "Error" in ONOS5_flows or not ONOS5_flows\
+                or "Error" in ONOS6_flows or not ONOS6_flows\
+                or "Error" in ONOS7_flows or not ONOS7_flows:
+                    main.log.report("Error in getting ONOS intents")
+                    main.log.warn("ONOS1 flows repsponse: "+ ONOS1_flows)
+                    main.log.warn("ONOS2 flows repsponse: "+ ONOS2_flows)
+                    main.log.warn("ONOS3 flows repsponse: "+ ONOS3_flows)
+                    main.log.warn("ONOS4 flows repsponse: "+ ONOS4_flows)
+                    main.log.warn("ONOS5 flows repsponse: "+ ONOS5_flows)
+                    main.log.warn("ONOS6 flows repsponse: "+ ONOS6_flows)
+                    main.log.warn("ONOS7 flows repsponse: "+ ONOS7_flows)
+        elif len(json.loads(ONOS1_flows)) == len(json.loads(ONOS2_flows))\
+                and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS3_flows))\
+                and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS4_flows))\
+                and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS5_flows))\
+                and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS6_flows))\
+                and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS7_flows)):
+                #TODO: Do a better check, maybe compare flows on switches?
+                    flow_state = ONOS1_flows
+                    flow_check = main.TRUE
+                    main.log.report("Flow count is consistent across all ONOS nodes")
+        else:
+            main.log.warn("ONOS1 flows: "+ json.dumps(json.loads(ONOS1_flows),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS2 flows: "+ json.dumps(json.loads(ONOS2_flows),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS3 flows: "+ json.dumps(json.loads(ONOS3_flows),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS4 flows: "+ json.dumps(json.loads(ONOS4_flows),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS5 flows: "+ json.dumps(json.loads(ONOS5_flows),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS6 flows: "+ json.dumps(json.loads(ONOS6_flows),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS7 flows: "+ json.dumps(json.loads(ONOS7_flows),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+        utilities.assert_equals(expect = main.TRUE,actual=flow_check,
+                onpass="The flow count is consistent across all ONOS nodes",
+                onfail="ONOS nodes have different flow counts")
+
+
+        main.step("Get the OF Table entries")
+        global flows
+        flows=[]
+        for i in range(1,29):
+            flows.append(main.Mininet2.get_flowTable(1.3, "s"+str(i)))
+
+        #TODO: Compare switch flow tables with ONOS flow tables
+
+        main.step("Start continuous pings")
+        main.Mininet2.pingLong(src=main.params['PING']['source1'],
+                            target=main.params['PING']['target1'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source2'],
+                            target=main.params['PING']['target2'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source3'],
+                            target=main.params['PING']['target3'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source4'],
+                            target=main.params['PING']['target4'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source5'],
+                            target=main.params['PING']['target5'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source6'],
+                            target=main.params['PING']['target6'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source7'],
+                            target=main.params['PING']['target7'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source8'],
+                            target=main.params['PING']['target8'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source9'],
+                            target=main.params['PING']['target9'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source10'],
+                            target=main.params['PING']['target10'],pingTime=500)
+
+        main.step("Create TestONTopology object")
+        ctrls = []
+        count = 1
+        while True:
+            temp = ()
+            if ('ip' + str(count)) in main.params['CTRL']:
+                temp = temp + (getattr(main,('ONOS' + str(count))),)
+                temp = temp + ("ONOS"+str(count),)
+                temp = temp + (main.params['CTRL']['ip'+str(count)],)
+                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
+                ctrls.append(temp)
+                count = count + 1
+            else:
+                break
+        MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+
+        main.step("Collecting topology information from ONOS")
+        devices = []
+        devices.append( main.ONOScli1.devices() )
+        devices.append( main.ONOScli2.devices() )
+        devices.append( main.ONOScli3.devices() )
+        devices.append( main.ONOScli4.devices() )
+        devices.append( main.ONOScli5.devices() )
+        devices.append( main.ONOScli6.devices() )
+        devices.append( main.ONOScli7.devices() )
+        hosts = []
+        hosts.append( json.loads( main.ONOScli1.hosts() ) )
+        hosts.append( json.loads( main.ONOScli2.hosts() ) )
+        hosts.append( json.loads( main.ONOScli3.hosts() ) )
+        hosts.append( json.loads( main.ONOScli4.hosts() ) )
+        hosts.append( json.loads( main.ONOScli5.hosts() ) )
+        hosts.append( json.loads( main.ONOScli6.hosts() ) )
+        hosts.append( json.loads( main.ONOScli7.hosts() ) )
+        for controller in range(0, len(hosts) ):
+            for host in hosts[controller]:
+                if host['ips'] == []:
+                    main.log.error("DEBUG:Error with host ips on controller"+str(controller+1)+": " + str(host))
+        ports = []
+        ports.append( main.ONOScli1.ports() )
+        ports.append( main.ONOScli2.ports() )
+        ports.append( main.ONOScli3.ports() )
+        ports.append( main.ONOScli4.ports() )
+        ports.append( main.ONOScli5.ports() )
+        ports.append( main.ONOScli6.ports() )
+        ports.append( main.ONOScli7.ports() )
+        links = []
+        links.append( main.ONOScli1.links() )
+        links.append( main.ONOScli2.links() )
+        links.append( main.ONOScli3.links() )
+        links.append( main.ONOScli4.links() )
+        links.append( main.ONOScli5.links() )
+        links.append( main.ONOScli6.links() )
+        links.append( main.ONOScli7.links() )
+        clusters = []
+        clusters.append( main.ONOScli1.clusters() )
+        clusters.append( main.ONOScli2.clusters() )
+        clusters.append( main.ONOScli3.clusters() )
+        clusters.append( main.ONOScli4.clusters() )
+        clusters.append( main.ONOScli5.clusters() )
+        clusters.append( main.ONOScli6.clusters() )
+        clusters.append( main.ONOScli7.clusters() )
+        paths = []
+        temp_topo = main.ONOSbench.get_topology( main.ONOScli1.topology() )
+        paths.append( temp_topo.get('paths', False) )
+        temp_topo = main.ONOSbench.get_topology( main.ONOScli2.topology() )
+        paths.append( temp_topo.get('paths', False) )
+        temp_topo = main.ONOSbench.get_topology( main.ONOScli3.topology() )
+        paths.append( temp_topo.get('paths', False) )
+        temp_topo = main.ONOSbench.get_topology( main.ONOScli4.topology() )
+        paths.append( temp_topo.get('paths', False) )
+        temp_topo = main.ONOSbench.get_topology( main.ONOScli5.topology() )
+        paths.append( temp_topo.get('paths', False) )
+        temp_topo = main.ONOSbench.get_topology( main.ONOScli6.topology() )
+        paths.append( temp_topo.get('paths', False) )
+        temp_topo = main.ONOSbench.get_topology( main.ONOScli7.topology() )
+        paths.append( temp_topo.get('paths', False) )
+
+        #Compare json objects for hosts, dataplane clusters and paths
+
+        #hosts
+        consistent_hosts_result = main.TRUE
+        for controller in range( len( hosts ) ):
+            if not "Error" in hosts[controller]:
+                if hosts[controller] == hosts[0]:
+                    continue
+                else:#hosts not consistent
+                    main.log.report("hosts from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+                    main.log.warn( repr( hosts[controller] ) )
+                    consistent_hosts_result = main.FALSE
+
+            else:
+                main.log.report("Error in getting ONOS hosts from ONOS" + str(controller + 1) )
+                consistent_hosts_result = main.FALSE
+                main.log.warn("ONOS" + str(controller + 1) + " hosts response: " + repr(hosts[controller]) )
+        utilities.assert_equals(expect = main.TRUE,actual=consistent_hosts_result,
+                onpass="Hosts view is consistent across all ONOS nodes",
+                onfail="ONOS nodes have different views of hosts")
+
+        #Strongly connected clusters of devices
+        consistent_clusters_result = main.TRUE
+        for controller in range( len( clusters ) ):
+            if not "Error" in clusters[controller]:
+                if clusters[controller] == clusters[0]:
+                    continue
+                else:#clusters not consistent
+                    main.log.report("clusters from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+                    consistent_clusters_result = main.FALSE
+
+            else:
+                main.log.report("Error in getting dataplane clusters from ONOS" + str(controller + 1) )
+                consistent_clusters_result = main.FALSE
+                main.log.warn("ONOS" + str(controller + 1) + " clusters response: " + repr(clusters[controller]) )
+        utilities.assert_equals(expect = main.TRUE,actual=consistent_clusters_result,
+                onpass="Clusters view is consistent across all ONOS nodes",
+                onfail="ONOS nodes have different views of clusters")
+        num_clusters =  len(json.loads(clusters[0])) #there should always only be one cluster
+        utilities.assert_equals(expect = 1, actual = num_clusters,
+                onpass="ONOS shows 1 SCC",
+                onfail="ONOS shows "+str(num_clusters) +" SCCs")
+
+
+        #paths
+        consistent_paths_result = main.TRUE
+        for controller in range( len( paths ) ):
+            if not "Error" in paths[controller]:
+                if paths[controller] == paths[0]:
+                    continue
+                else:#paths not consistent
+                    main.log.report("paths from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+                    consistent_paths_result = main.FALSE
+
+            else:
+                main.log.report("Error in getting paths from ONOS" + str(controller + 1) )
+                consistent_paths_result = main.FALSE
+                main.log.warn("ONOS" + str(controller + 1) + " paths response: " + repr(paths[controller]) )
+        utilities.assert_equals(expect = main.TRUE,actual=consistent_paths_result,
+                onpass="Paths count is consistent across all ONOS nodes",
+                onfail="ONOS nodes have different counts of paths")
+
+
+        main.step("Comparing ONOS topology to MN")
+        devices_results = main.TRUE
+        ports_results = main.TRUE
+        links_results = main.TRUE
+        for controller in range(num_controllers):
+            if devices[controller] or not "Error" in devices[controller]:
+                current_devices_result =  main.Mininet1.compare_switches(MNTopo, json.loads(devices[controller]))
+            else:
+                current_devices_result = main.FALSE
+            utilities.assert_equals(expect=main.TRUE, actual=current_devices_result,
+                    onpass="ONOS"+str(int(controller+1))+" Switches view is correct",
+                    onfail="ONOS"+str(int(controller+1))+" Switches view is incorrect")
+
+            if ports[controller] or not "Error" in ports[controller]:
+                current_ports_result =  main.Mininet1.compare_ports(MNTopo, json.loads(ports[controller]))
+            else:
+                current_ports_result = main.FALSE
+            utilities.assert_equals(expect=main.TRUE, actual=current_ports_result,
+                    onpass="ONOS"+str(int(controller+1))+" ports view is correct",
+                    onfail="ONOS"+str(int(controller+1))+" ports view is incorrect")
+
+            if links[controller] or not "Error" in links[controller]:
+                current_links_result =  main.Mininet1.compare_links(MNTopo, json.loads(links[controller]))
+            else:
+                current_links_result = main.FALSE
+            utilities.assert_equals(expect=main.TRUE, actual=current_links_result,
+                    onpass="ONOS"+str(int(controller+1))+" links view is correct",
+                    onfail="ONOS"+str(int(controller+1))+" links view is incorrect")
+
+            devices_results = devices_results and current_devices_result
+            ports_results = ports_results and current_ports_result
+            links_results = links_results and current_links_result
+
+        topo_result = devices_results and ports_results and links_results\
+                and consistent_hosts_result and consistent_clusters_result\
+                and consistent_paths_result
+        utilities.assert_equals(expect=main.TRUE, actual=topo_result,
+                onpass="Topology Check Test successful",
+                onfail="Topology Check Test NOT successful")
+
+        final_assert = main.TRUE
+        final_assert = final_assert and topo_result and flow_check \
+                and intent_check and consistent_mastership and roles_not_null
+        utilities.assert_equals(expect=main.TRUE, actual=final_assert,
+                onpass="State check successful",
+                onfail="State check NOT successful")
+
+
+    def CASE6(self,main) :
+        '''
+        The Failure case.
+        '''
+        import time
+        main.log.report("Killing 3 ONOS nodes")
+        main.log.case("Restart minority of ONOS nodes")
+        #TODO: Randomize these nodes
+        main.ONOSbench.onos_kill(ONOS1_ip)
+        time.sleep(10)
+        main.ONOSbench.onos_kill(ONOS2_ip)
+        time.sleep(10)
+        main.ONOSbench.onos_kill(ONOS3_ip)
+
+        main.step("Checking if ONOS is up yet")
+        count = 0
+        onos_isup_result = main.FALSE
+        while onos_isup_result == main.FALSE and count < 10:
+            onos1_isup = main.ONOSbench.isup(ONOS1_ip)
+            onos2_isup = main.ONOSbench.isup(ONOS2_ip)
+            onos3_isup = main.ONOSbench.isup(ONOS3_ip)
+            onos_isup_result = onos1_isup and onos2_isup and onos3_isup
+            count = count + 1
+        # TODO: if it becomes an issue, we can retry this step  a few times
+
+
+        cli_result1 = main.ONOScli1.start_onos_cli(ONOS1_ip)
+        cli_result2 = main.ONOScli2.start_onos_cli(ONOS2_ip)
+        cli_result3 = main.ONOScli3.start_onos_cli(ONOS3_ip)
+        cli_results = cli_result1 and cli_result2 and cli_result3
+
+        main.log.info("Install leadership election app on restarted node")
+
+        case_results = main.TRUE and onos_isup_result and cli_results
+        utilities.assert_equals(expect=main.TRUE, actual=case_results,
+                onpass="ONOS restart successful",
+                onfail="ONOS restart NOT successful")
+
+
+    def CASE7(self,main) :
+        '''
+        Check state after ONOS failure
+        '''
+        import os
+        import json
+        main.case("Running ONOS Constant State Tests")
+
+        #Assert that each device has a master
+        ONOS1_master_not_null = main.ONOScli1.roles_not_null()
+        ONOS2_master_not_null = main.ONOScli2.roles_not_null()
+        ONOS3_master_not_null = main.ONOScli3.roles_not_null()
+        ONOS4_master_not_null = main.ONOScli4.roles_not_null()
+        ONOS5_master_not_null = main.ONOScli5.roles_not_null()
+        ONOS6_master_not_null = main.ONOScli6.roles_not_null()
+        ONOS7_master_not_null = main.ONOScli7.roles_not_null()
+        roles_not_null = ONOS1_master_not_null and ONOS2_master_not_null and\
+                ONOS3_master_not_null and ONOS4_master_not_null and\
+                ONOS5_master_not_null and ONOS6_master_not_null and\
+                ONOS7_master_not_null
+        utilities.assert_equals(expect = main.TRUE,actual=roles_not_null,
+                onpass="Each device has a master",
+                onfail="Some devices don't have a master assigned")
+
+
+
+        main.step("Check if switch roles are consistent across all nodes")
+        ONOS1_mastership = main.ONOScli1.roles()
+        ONOS2_mastership = main.ONOScli2.roles()
+        ONOS3_mastership = main.ONOScli3.roles()
+        ONOS4_mastership = main.ONOScli4.roles()
+        ONOS5_mastership = main.ONOScli5.roles()
+        ONOS6_mastership = main.ONOScli6.roles()
+        ONOS7_mastership = main.ONOScli7.roles()
+        #print json.dumps(json.loads(ONOS1_mastership), sort_keys=True, indent=4, separators=(',', ': '))
+        if "Error" in ONOS1_mastership or not ONOS1_mastership\
+                or "Error" in ONOS2_mastership or not ONOS2_mastership\
+                or "Error" in ONOS3_mastership or not ONOS3_mastership\
+                or "Error" in ONOS4_mastership or not ONOS4_mastership\
+                or "Error" in ONOS5_mastership or not ONOS5_mastership\
+                or "Error" in ONOS6_mastership or not ONOS6_mastership\
+                or "Error" in ONOS7_mastership or not ONOS7_mastership:
+                    main.log.error("Error in getting ONOS mastership")
+                    main.log.warn("ONOS1 mastership response: " + repr(ONOS1_mastership))
+                    main.log.warn("ONOS2 mastership response: " + repr(ONOS2_mastership))
+                    main.log.warn("ONOS3 mastership response: " + repr(ONOS3_mastership))
+                    main.log.warn("ONOS4 mastership response: " + repr(ONOS4_mastership))
+                    main.log.warn("ONOS5 mastership response: " + repr(ONOS5_mastership))
+                    main.log.warn("ONOS6 mastership response: " + repr(ONOS6_mastership))
+                    main.log.warn("ONOS7 mastership response: " + repr(ONOS7_mastership))
+                    consistent_mastership = main.FALSE
+        elif ONOS1_mastership == ONOS2_mastership\
+                and ONOS1_mastership == ONOS3_mastership\
+                and ONOS1_mastership == ONOS4_mastership\
+                and ONOS1_mastership == ONOS5_mastership\
+                and ONOS1_mastership == ONOS6_mastership\
+                and ONOS1_mastership == ONOS7_mastership:
+                    consistent_mastership = main.TRUE
+                    main.log.report("Switch roles are consistent across all ONOS nodes")
+        else:
+            main.log.warn("ONOS1 roles: ", json.dumps(json.loads(ONOS1_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS2 roles: ", json.dumps(json.loads(ONOS2_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS3 roles: ", json.dumps(json.loads(ONOS3_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS4 roles: ", json.dumps(json.loads(ONOS4_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS5 roles: ", json.dumps(json.loads(ONOS5_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS6 roles: ", json.dumps(json.loads(ONOS6_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS7 roles: ", json.dumps(json.loads(ONOS7_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            consistent_mastership = main.FALSE
+        utilities.assert_equals(expect = main.TRUE,actual=consistent_mastership,
+                onpass="Switch roles are consistent across all ONOS nodes",
+                onfail="ONOS nodes have different views of switch roles")
+
+
+        description2 = "Compare switch roles from before failure"
+        main.step(description2)
+
+        current_json = json.loads(ONOS1_mastership)
+        old_json = json.loads(mastership_state)
+        mastership_check = main.TRUE
+        for i in range(1,29):
+            switchDPID = str(main.Mininet1.getSwitchDPID(switch="s"+str(i)))
+
+            current = [switch['master'] for switch in current_json if switchDPID in switch['id']]
+            old = [switch['master'] for switch in old_json if switchDPID in switch['id']]
+            if current == old:
+                mastership_check = mastership_check and main.TRUE
+            else:
+                main.log.warn("Mastership of switch %s changed" % switchDPID)
+                mastership_check = main.FALSE
+        if mastership_check == main.TRUE:
+            main.log.report("Mastership of Switches was not changed")
+        utilities.assert_equals(expect=main.TRUE,actual=mastership_check,
+                onpass="Mastership of Switches was not changed",
+                onfail="Mastership of some switches changed")
+        #NOTE: we expect mastership to change on controller failure
+        mastership_check = consistent_mastership
+
+
+
+        main.step("Get the intents and compare across all nodes")
+        ONOS1_intents = main.ONOScli1.intents( json_format=True )
+        ONOS2_intents = main.ONOScli2.intents( json_format=True )
+        ONOS3_intents = main.ONOScli3.intents( json_format=True )
+        ONOS4_intents = main.ONOScli4.intents( json_format=True )
+        ONOS5_intents = main.ONOScli5.intents( json_format=True )
+        ONOS6_intents = main.ONOScli6.intents( json_format=True )
+        ONOS7_intents = main.ONOScli7.intents( json_format=True )
+        intent_check = main.FALSE
+        if "Error" in ONOS1_intents or not ONOS1_intents\
+                or "Error" in ONOS2_intents or not ONOS2_intents\
+                or "Error" in ONOS3_intents or not ONOS3_intents\
+                or "Error" in ONOS4_intents or not ONOS4_intents\
+                or "Error" in ONOS5_intents or not ONOS5_intents\
+                or "Error" in ONOS6_intents or not ONOS6_intents\
+                or "Error" in ONOS7_intents or not ONOS7_intents:
+                    main.log.report("Error in getting ONOS intents")
+                    main.log.warn("ONOS1 intents response: " + repr(ONOS1_intents))
+                    main.log.warn("ONOS2 intents response: " + repr(ONOS2_intents))
+                    main.log.warn("ONOS3 intents response: " + repr(ONOS3_intents))
+                    main.log.warn("ONOS4 intents response: " + repr(ONOS4_intents))
+                    main.log.warn("ONOS5 intents response: " + repr(ONOS5_intents))
+                    main.log.warn("ONOS6 intents response: " + repr(ONOS6_intents))
+                    main.log.warn("ONOS7 intents response: " + repr(ONOS7_intents))
+        elif ONOS1_intents == ONOS2_intents\
+                and ONOS1_intents == ONOS3_intents\
+                and ONOS1_intents == ONOS4_intents\
+                and ONOS1_intents == ONOS5_intents\
+                and ONOS1_intents == ONOS6_intents\
+                and ONOS1_intents == ONOS7_intents:
+                    intent_check = main.TRUE
+                    main.log.report("Intents are consistent across all ONOS nodes")
+        else:
+            main.log.warn("ONOS1 intents: ")
+            print json.dumps(json.loads(ONOS1_intents),
+                sort_keys=True, indent=4, separators=(',', ': '))
+            main.log.warn("ONOS2 intents: ")
+            print json.dumps(json.loads(ONOS2_intents),
+                sort_keys=True, indent=4, separators=(',', ': '))
+            main.log.warn("ONOS3 intents: ")
+            print json.dumps(json.loads(ONOS3_intents),
+                sort_keys=True, indent=4, separators=(',', ': '))
+            main.log.warn("ONOS4 intents: ")
+            print json.dumps(json.loads(ONOS4_intents),
+                sort_keys=True, indent=4, separators=(',', ': '))
+            main.log.warn("ONOS5 intents: ")
+            print json.dumps(json.loads(ONOS5_intents),
+                sort_keys=True, indent=4, separators=(',', ': '))
+            main.log.warn("ONOS6 intents: ")
+            print json.dumps(json.loads(ONOS6_intents),
+                sort_keys=True, indent=4, separators=(',', ': '))
+            main.log.warn("ONOS7 intents: ")
+            print json.dumps(json.loads(ONOS7_intents),
+                sort_keys=True, indent=4, separators=(',', ': '))
+        utilities.assert_equals(expect = main.TRUE,actual=intent_check,
+                onpass="Intents are consistent across all ONOS nodes",
+                onfail="ONOS nodes have different views of intents")
+
+        #NOTE: Hazelcast has no durability, so intents are lost across system restarts
+        main.step("Compare current intents with intents before the failure")
+        #NOTE: this requires case 5 to pass for intent_state to be set.
+        #      maybe we should stop the test if that fails?
+        if intent_state == ONOS1_intents:
+            same_intents = main.TRUE
+            main.log.report("Intents are consistent with before failure")
+        #TODO: possibly the states have changed? we may need to figure out what the aceptable states are
+        else:
+            try:
+                main.log.warn("ONOS1 intents: ")
+                print json.dumps(json.loads(ONOS1_intents),
+                    sort_keys=True, indent=4, separators=(',', ': '))
+            except:
+                pass
+            same_intents = main.FALSE
+        utilities.assert_equals(expect = main.TRUE,actual=same_intents,
+                onpass="Intents are consistent with before failure",
+                onfail="The Intents changed during failure")
+        intent_check = intent_check and same_intents
+
+
+
+        main.step("Get the OF Table entries and compare to before component failure")
+        Flow_Tables = main.TRUE
+        flows2=[]
+        for i in range(28):
+            main.log.info("Checking flow table on s" + str(i+1))
+            tmp_flows = main.Mininet2.get_flowTable(1.3, "s"+str(i+1))
+            flows2.append(tmp_flows)
+            temp_result = main.Mininet2.flow_comp(flow1=flows[i],flow2=tmp_flows)
+            Flow_Tables = Flow_Tables and temp_result
+            if Flow_Tables == main.FALSE:
+                main.log.info("Differences in flow table for switch: "+str(i+1))
+        if Flow_Tables == main.TRUE:
+            main.log.report("No changes were found in the flow tables")
+        utilities.assert_equals(expect=main.TRUE,actual=Flow_Tables,
+                onpass="No changes were found in the flow tables",
+                onfail="Changes were found in the flow tables")
+
+        main.step("Check the continuous pings to ensure that no packets were dropped during component failure")
+        #FIXME: This check is always failing. Investigate cause
+        #NOTE:  this may be something to do with file permsissions
+        #       or slight change in format
+        main.Mininet2.pingKill(main.params['TESTONUSER'], main.params['TESTONIP'])
+        Loss_In_Pings = main.FALSE 
+        #NOTE: checkForLoss returns main.FALSE with 0% packet loss
+        for i in range(8,18):
+            main.log.info("Checking for a loss in pings along flow from s" + str(i))
+            Loss_In_Pings = main.Mininet2.checkForLoss("/tmp/ping.h"+str(i)) or Loss_In_Pings
+        if Loss_In_Pings == main.TRUE:
+            main.log.info("Loss in ping detected")
+        elif Loss_In_Pings == main.ERROR:
+            main.log.info("There are multiple mininet process running")
+        elif Loss_In_Pings == main.FALSE:
+            main.log.info("No Loss in the pings")
+            main.log.report("No loss of dataplane connectivity")
+        utilities.assert_equals(expect=main.FALSE,actual=Loss_In_Pings,
+                onpass="No Loss of connectivity",
+                onfail="Loss of dataplane connectivity detected")
+
+
+        #Test of LeadershipElection
+        leader_list = []
+        leader_result = main.TRUE
+        for controller in range(1,num_controllers+1):
+            node = getattr( main, ( 'ONOScli' + str( controller ) ) )#loop through ONOScli handlers
+            leaderN = node.election_test_leader()
+            leader_list.append(leaderN)
+            if leaderN == main.FALSE:
+                #error in  response
+                main.log.report("Something is wrong with election_test_leader function, check the error logs")
+                leader_result = main.FALSE
+            elif leaderN == None:
+                main.log.report("ONOS"+str(controller) + " shows no leader for the election-app was elected after the old one died")
+                leader_result = main.FALSE
+            elif leaderN == ONOS1_ip or leaderN == ONOS2_ip or leaderN == ONOS3_ip:
+                main.log.report("ONOS"+str(controller) + " shows "+str(leaderN)+" as leader for the election-app, but it was restarted")
+                leader_result = main.FALSE
+        if len( set( leader_list ) ) != 1:
+            leader_result = main.FALSE
+            main.log.error("Inconsistent view of leader for the election test app")
+            #TODO: print the list
+        if leader_result:
+            main.log.report("Leadership election tests passed(consistent view of leader across listeners and a new leader was re-elected if applicable)")
+        utilities.assert_equals(expect=main.TRUE, actual=leader_result,
+                onpass="Leadership election passed",
+                onfail="Something went wrong with Leadership election")
+
+
+        result = mastership_check and intent_check and Flow_Tables and (not Loss_In_Pings) and roles_not_null\
+                and leader_result
+        result = int(result)
+        if result == main.TRUE:
+            main.log.report("Constant State Tests Passed")
+        utilities.assert_equals(expect=main.TRUE,actual=result,
+                onpass="Constant State Tests Passed",
+                onfail="Constant state tests failed")
+
+    def CASE8 (self,main):
+        '''
+        Compare topo
+        '''
+        import sys
+        sys.path.append("/home/admin/sts") # Trying to remove some dependancies, #FIXME add this path to params
+        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
+        import json
+        import time
+
+        description ="Compare ONOS Topology view to Mininet topology"
+        main.case(description)
+        main.log.report(description)
+        main.step("Create TestONTopology object")
+        ctrls = []
+        count = 1
+        while True:
+            temp = ()
+            if ('ip' + str(count)) in main.params['CTRL']:
+                temp = temp + (getattr(main,('ONOS' + str(count))),)
+                temp = temp + ("ONOS"+str(count),)
+                temp = temp + (main.params['CTRL']['ip'+str(count)],)
+                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
+                ctrls.append(temp)
+                count = count + 1
+            else:
+                break
+        MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+
+        main.step("Comparing ONOS topology to MN")
+        devices_results = main.TRUE
+        ports_results = main.TRUE
+        links_results = main.TRUE
+        topo_result = main.FALSE
+        elapsed = 0
+        count = 0
+        main.step("Collecting topology information from ONOS")
+        start_time = time.time()
+        while topo_result == main.FALSE and elapsed < 60:
+            count = count + 1
+            if count > 1:
+                MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+            cli_start = time.time()
+            devices = []
+            devices.append( main.ONOScli1.devices() )
+            devices.append( main.ONOScli2.devices() )
+            devices.append( main.ONOScli3.devices() )
+            devices.append( main.ONOScli4.devices() )
+            devices.append( main.ONOScli5.devices() )
+            devices.append( main.ONOScli6.devices() )
+            devices.append( main.ONOScli7.devices() )
+            hosts = []
+            hosts.append( json.loads( main.ONOScli1.hosts() ) )
+            hosts.append( json.loads( main.ONOScli2.hosts() ) )
+            hosts.append( json.loads( main.ONOScli3.hosts() ) )
+            hosts.append( json.loads( main.ONOScli4.hosts() ) )
+            hosts.append( json.loads( main.ONOScli5.hosts() ) )
+            hosts.append( json.loads( main.ONOScli6.hosts() ) )
+            hosts.append( json.loads( main.ONOScli7.hosts() ) )
+            for controller in range(0, len(hosts) ):
+                for host in hosts[controller]:
+                    host
+                    if host['ips'] == []:
+                        main.log.error("DEBUG:Error with host ips on controller"+str(controller+1)+": " + str(host))
+            ports = []
+            ports.append( main.ONOScli1.ports() )
+            ports.append( main.ONOScli2.ports() )
+            ports.append( main.ONOScli3.ports() )
+            ports.append( main.ONOScli4.ports() )
+            ports.append( main.ONOScli5.ports() )
+            ports.append( main.ONOScli6.ports() )
+            ports.append( main.ONOScli7.ports() )
+            links = []
+            links.append( main.ONOScli1.links() )
+            links.append( main.ONOScli2.links() )
+            links.append( main.ONOScli3.links() )
+            links.append( main.ONOScli4.links() )
+            links.append( main.ONOScli5.links() )
+            links.append( main.ONOScli6.links() )
+            links.append( main.ONOScli7.links() )
+            clusters = []
+            clusters.append( main.ONOScli1.clusters() )
+            clusters.append( main.ONOScli2.clusters() )
+            clusters.append( main.ONOScli3.clusters() )
+            clusters.append( main.ONOScli4.clusters() )
+            clusters.append( main.ONOScli5.clusters() )
+            clusters.append( main.ONOScli6.clusters() )
+            clusters.append( main.ONOScli7.clusters() )
+            paths = []
+            temp_topo = main.ONOSbench.get_topology( main.ONOScli1.topology() )
+            paths.append( temp_topo.get('paths', False) )
+            temp_topo = main.ONOSbench.get_topology( main.ONOScli2.topology() )
+            paths.append( temp_topo.get('paths', False) )
+            temp_topo = main.ONOSbench.get_topology( main.ONOScli3.topology() )
+            paths.append( temp_topo.get('paths', False) )
+            temp_topo = main.ONOSbench.get_topology( main.ONOScli4.topology() )
+            paths.append( temp_topo.get('paths', False) )
+            temp_topo = main.ONOSbench.get_topology( main.ONOScli5.topology() )
+            paths.append( temp_topo.get('paths', False) )
+            temp_topo = main.ONOSbench.get_topology( main.ONOScli6.topology() )
+            paths.append( temp_topo.get('paths', False) )
+            temp_topo = main.ONOSbench.get_topology( main.ONOScli7.topology() )
+            paths.append( temp_topo.get('paths', False) )
+
+
+            elapsed = time.time() - start_time
+            cli_time = time.time() - cli_start
+            print "CLI time: " + str(cli_time)
+
+            for controller in range(num_controllers):
+                if devices[controller] or not "Error" in devices[controller]:
+                    current_devices_result =  main.Mininet1.compare_switches(MNTopo, json.loads(devices[controller]))
+                else:
+                    current_devices_result = main.FALSE
+                utilities.assert_equals(expect=main.TRUE, actual=current_devices_result,
+                        onpass="ONOS"+str(int(controller+1))+" Switches view is correct",
+                        onfail="ONOS"+str(int(controller+1))+" Switches view is incorrect")
+
+                if ports[controller] or not "Error" in ports[controller]:
+                    current_ports_result =  main.Mininet1.compare_ports(MNTopo, json.loads(ports[controller]))
+                else:
+                    current_ports_result = main.FALSE
+                utilities.assert_equals(expect=main.TRUE, actual=current_ports_result,
+                        onpass="ONOS"+str(int(controller+1))+" ports view is correct",
+                        onfail="ONOS"+str(int(controller+1))+" ports view is incorrect")
+
+                if links[controller] or not "Error" in links[controller]:
+                    current_links_result =  main.Mininet1.compare_links(MNTopo, json.loads(links[controller]))
+                else:
+                    current_links_result = main.FALSE
+                utilities.assert_equals(expect=main.TRUE, actual=current_links_result,
+                        onpass="ONOS"+str(int(controller+1))+" links view is correct",
+                        onfail="ONOS"+str(int(controller+1))+" links view is incorrect")
+            devices_results = devices_results and current_devices_result
+            ports_results = ports_results and current_ports_result
+            links_results = links_results and current_links_result
+
+            #Compare json objects for hosts, dataplane clusters and paths
+
+            #hosts
+            consistent_hosts_result = main.TRUE
+            for controller in range( len( hosts ) ):
+                if not "Error" in hosts[controller]:
+                    if hosts[controller] == hosts[0]:
+                        continue
+                    else:#hosts not consistent
+                        main.log.report("hosts from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+                        main.log.warn( repr( hosts[controller] ) )
+                        consistent_hosts_result = main.FALSE
+
+                else:
+                    main.log.report("Error in getting ONOS hosts from ONOS" + str(controller + 1) )
+                    consistent_hosts_result = main.FALSE
+            if consistent_hosts_result == main.FALSE:
+                for controller in range( len( hosts ) ):
+                    main.log.warn("ONOS" + str(controller + 1) + " hosts response: " + repr(hosts[controller]) )
+            utilities.assert_equals(expect = main.TRUE,actual=consistent_hosts_result,
+                    onpass="Hosts view is consistent across all ONOS nodes",
+                    onfail="ONOS nodes have different views of hosts")
+
+            #Strongly connected clusters of devices
+            consistent_clusters_result = main.TRUE
+            for controller in range( len( clusters ) ):
+                if not "Error" in clusters[controller]:
+                    if clusters[controller] == clusters[0]:
+                        continue
+                    else:#clusters not consistent
+                        main.log.report("clusters from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+                        consistent_clusters_result = main.FALSE
+
+                else:
+                    main.log.report("Error in getting dataplane clusters from ONOS" + str(controller + 1) )
+                    consistent_clusters_result = main.FALSE
+                    main.log.warn("ONOS" + str(controller + 1) + " clusters response: " + repr(clusters[controller]) )
+            utilities.assert_equals(expect = main.TRUE,actual=consistent_clusters_result,
+                    onpass="Clusters view is consistent across all ONOS nodes",
+                    onfail="ONOS nodes have different views of clusters")
+            num_clusters =  len(json.loads(clusters[0])) #there should always only be one cluster
+            utilities.assert_equals(expect = 1, actual = num_clusters,
+                    onpass="ONOS shows 1 SCC",
+                    onfail="ONOS shows "+str(num_clusters) +" SCCs")
+
+
+            #paths
+            consistent_paths_result = main.TRUE
+            for controller in range( len( paths ) ):
+                if not "Error" in paths[controller]:
+                    if paths[controller] == paths[0]:
+                        continue
+                    else:#paths not consistent
+                        main.log.report("paths from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+                        consistent_paths_result = main.FALSE
+
+                else:
+                    main.log.report("Error in getting paths from ONOS" + str(controller + 1) )
+                    consistent_paths_result = main.FALSE
+                    main.log.warn("ONOS" + str(controller + 1) + " paths response: " + repr(paths[controller]) )
+            utilities.assert_equals(expect = main.TRUE,actual=consistent_paths_result,
+                    onpass="Paths count is consistent across all ONOS nodes",
+                    onfail="ONOS nodes have different counts of paths")
+
+
+            topo_result = devices_results and ports_results and links_results\
+                    and consistent_hosts_result and consistent_clusters_result and consistent_paths_result
+
+        topo_result = topo_result and int(count <= 2)
+        note = "note it takes about "+str( int(cli_time) )+" seconds for the test to make all the cli calls to fetch the topology from each ONOS instance"
+        main.log.report("Very crass estimate for topology discovery/convergence("+ str(note) + "): " +\
+                str(elapsed) + " seconds, " + str(count) +" tries" )
+        utilities.assert_equals(expect=main.TRUE, actual=topo_result,
+                onpass="Topology Check Test successful",
+                onfail="Topology Check Test NOT successful")
+        if topo_result == main.TRUE:
+            main.log.report("ONOS topology view matches Mininet topology")
+
+
+    def CASE9 (self,main):
+        '''
+        Link s3-s28 down
+        '''
+        #NOTE: You should probably run a topology check after this
+
+        link_sleep = float(main.params['timers']['LinkDiscovery'])
+
+        description = "Turn off a link to ensure that Link Discovery is working properly"
+        main.log.report(description)
+        main.case(description)
+
+
+        main.step("Kill Link between s3 and s28")
+        Link_Down = main.Mininet1.link(END1="s3",END2="s28",OPTION="down")
+        main.log.info("Waiting " + str(link_sleep) + " seconds for link down to be discovered")
+        time.sleep(link_sleep)
+        utilities.assert_equals(expect=main.TRUE,actual=Link_Down,
+                onpass="Link down succesful",
+                onfail="Failed to bring link down")
+        #TODO do some sort of check here
+
+    def CASE10 (self,main):
+        '''
+        Link s3-s28 up
+        '''
+        #NOTE: You should probably run a topology check after this
+
+        link_sleep = float(main.params['timers']['LinkDiscovery'])
+
+        description = "Restore a link to ensure that Link Discovery is working properly"
+        main.log.report(description)
+        main.case(description)
+
+        main.step("Bring link between s3 and s28 back up")
+        Link_Up = main.Mininet1.link(END1="s3",END2="s28",OPTION="up")
+        main.log.info("Waiting " + str(link_sleep) + " seconds for link up to be discovered")
+        time.sleep(link_sleep)
+        utilities.assert_equals(expect=main.TRUE,actual=Link_Up,
+                onpass="Link up succesful",
+                onfail="Failed to bring link up")
+        #TODO do some sort of check here
+
+
+    def CASE11 (self, main) :
+        '''
+        Switch Down
+        '''
+        #NOTE: You should probably run a topology check after this
+        import time
+
+        switch_sleep = float(main.params['timers']['SwitchDiscovery'])
+
+        description = "Killing a switch to ensure it is discovered correctly"
+        main.log.report(description)
+        main.case(description)
+
+        #TODO: Make this switch parameterizable
+        main.step("Kill s28 ")
+        main.log.report("Deleting s28")
+        main.Mininet1.del_switch("s28")
+        main.log.info("Waiting " + str(switch_sleep) + " seconds for switch down to be discovered")
+        time.sleep(switch_sleep)
+        device = main.ONOScli1.get_device(dpid="0028")
+        #Peek at the deleted switch
+        main.log.warn( str(device) )
+        result = main.FALSE
+        if device and device['available'] == False:
+            result = main.TRUE
+        utilities.assert_equals(expect=main.TRUE,actual=result,
+                onpass="Kill switch succesful",
+                onfail="Failed to kill switch?")
+
+    def CASE12 (self, main) :
+        '''
+        Switch Up
+        '''
+        #NOTE: You should probably run a topology check after this
+        import time
+
+        switch_sleep = float(main.params['timers']['SwitchDiscovery'])
+        description = "Adding a switch to ensure it is discovered correctly"
+        main.log.report(description)
+        main.case(description)
+
+        main.step("Add back s28")
+        main.log.report("Adding back s28")
+        main.Mininet1.add_switch("s28", dpid = '0000000000002800')
+        #TODO: New dpid or same? Ask Thomas?
+        main.Mininet1.add_link('s28', 's3')
+        main.Mininet1.add_link('s28', 's6')
+        main.Mininet1.add_link('s28', 'h28')
+        main.Mininet1.assign_sw_controller(sw="28",count=num_controllers,
+                ip1=ONOS1_ip,port1=ONOS1_port,
+                ip2=ONOS2_ip,port2=ONOS2_port,
+                ip3=ONOS3_ip,port3=ONOS3_port,
+                ip4=ONOS4_ip,port4=ONOS4_port,
+                ip5=ONOS5_ip,port5=ONOS5_port,
+                ip6=ONOS6_ip,port6=ONOS6_port,
+                ip7=ONOS7_ip,port7=ONOS7_port)
+        main.log.info("Waiting " + str(switch_sleep) + " seconds for switch up to be discovered")
+        time.sleep(switch_sleep)
+        device = main.ONOScli1.get_device(dpid="0028")
+        #Peek at the deleted switch
+        main.log.warn( str(device) )
+        result = main.FALSE
+        if device and device['available'] == True:
+            result = main.TRUE
+        utilities.assert_equals(expect=main.TRUE,actual=result,
+                onpass="add switch succesful",
+                onfail="Failed to add switch?")
+
+    def CASE13 (self, main) :
+        '''
+        Clean up
+        '''
+        import os
+        import time
+        #printing colors to terminal
+        colors = {}
+        colors['cyan']   = '\033[96m'
+        colors['purple'] = '\033[95m'
+        colors['blue']   = '\033[94m'
+        colors['green']  = '\033[92m'
+        colors['yellow'] = '\033[93m'
+        colors['red']    = '\033[91m'
+        colors['end']    = '\033[0m'
+        description = "Test Cleanup"
+        main.log.report(description)
+        main.case(description)
+        main.step("Killing tcpdumps")
+        main.Mininet2.stop_tcpdump()
+
+        main.step("Checking ONOS Logs for errors")
+        print colors['purple'] + "Checking logs for errors on ONOS1:" + colors['end']
+        print main.ONOSbench.check_logs(ONOS1_ip)
+        print colors['purple'] + "Checking logs for errors on ONOS2:" + colors['end']
+        print main.ONOSbench.check_logs(ONOS2_ip)
+        print colors['purple'] + "Checking logs for errors on ONOS3:" + colors['end']
+        print main.ONOSbench.check_logs(ONOS3_ip)
+        print colors['purple'] + "Checking logs for errors on ONOS4:" + colors['end']
+        print main.ONOSbench.check_logs(ONOS4_ip)
+        print colors['purple'] + "Checking logs for errors on ONOS5:" + colors['end']
+        print main.ONOSbench.check_logs(ONOS5_ip)
+        print colors['purple'] + "Checking logs for errors on ONOS6:" + colors['end']
+        print main.ONOSbench.check_logs(ONOS6_ip)
+        print colors['purple'] + "Checking logs for errors on ONOS7:" + colors['end']
+        print main.ONOSbench.check_logs(ONOS7_ip)
+
+        main.step("Copying MN pcap and ONOS log files to test station")
+        testname = main.TEST
+        teststation_user = main.params['TESTONUSER']
+        teststation_IP = main.params['TESTONIP']
+        #NOTE: MN Pcap file is being saved to ~/packet_captures
+        #       scp this file as MN and TestON aren't necessarily the same vm
+        #FIXME: scp
+        #####mn files
+        #TODO: Load these from params
+        #NOTE: must end in /
+        log_folder = "/opt/onos/log/"
+        log_files = ["karaf.log", "karaf.log.1"]
+        #NOTE: must end in /
+        dst_dir = "~/packet_captures/"
+        for f in log_files:
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS1_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS1-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS2_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS2-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS3_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS3-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS4_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS4-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS5_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS5-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS6_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS6-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS7_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS7-"+f )
+
+        #std*.log's
+        #NOTE: must end in /
+        log_folder = "/opt/onos/var/"
+        log_files = ["stderr.log", "stdout.log"]
+        #NOTE: must end in /
+        dst_dir = "~/packet_captures/"
+        for f in log_files:
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS1_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS1-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS2_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS2-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS3_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS3-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS4_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS4-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS5_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS5-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS6_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS6-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS7_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS7-"+f )
+
+
+        #sleep so scp can finish
+        time.sleep(10)
+        main.step("Packing and rotating pcap archives")
+        os.system("~/TestON/dependencies/rotate.sh "+ str(testname))
+
+
+        #TODO: actually check something here
+        utilities.assert_equals(expect=main.TRUE, actual=main.TRUE,
+                onpass="Test cleanup successful",
+                onfail="Test cleanup NOT successful")
+
+    def CASE14 ( self, main ) :
+        '''
+        start election app on all onos nodes
+        '''
+        leader_result = main.TRUE
+        #install app on onos 1
+        main.log.info("Install leadership election app")
+        main.ONOScli1.feature_install("onos-app-election")
+        #wait for election
+        #check for leader
+        leader = main.ONOScli1.election_test_leader()
+        #verify leader is ONOS1
+        if leader == ONOS1_ip:
+            #all is well
+            pass
+        elif leader == None:
+            #No leader elected
+            main.log.report("No leader was elected")
+            leader_result = main.FALSE
+        elif leader == main.FALSE:
+            #error in  response
+            #TODO: add check for "Command not found:" in the driver, this means the app isn't loaded
+            main.log.report("Something is wrong with election_test_leader function, check the error logs")
+            leader_result = main.FALSE
+        else:
+            #error in  response
+            main.log.report("Unexpected response from election_test_leader function:'"+str(leader)+"'")
+            leader_result = main.FALSE
+
+
+
+
+        #install on other nodes and check for leader.
+        #Should be onos1 and each app should show the same leader
+        for controller in range(2,num_controllers+1):
+            node = getattr( main, ( 'ONOScli' + str( controller ) ) )#loop through ONOScli handlers
+            node.feature_install("onos-app-election")
+            leaderN = node.election_test_leader()
+            #verify leader is ONOS1
+            if leaderN == ONOS1_ip:
+                #all is well
+                pass
+            elif leaderN == main.FALSE:
+                #error in  response
+                #TODO: add check for "Command not found:" in the driver, this means the app isn't loaded
+                main.log.report("Something is wrong with election_test_leader function, check the error logs")
+                leader_result = main.FALSE
+            elif leader != leaderN:
+                leader_result = main.FALSE
+                main.log.report("ONOS" + str(controller) + " sees "+str(leaderN) +
+                        " as the leader of the election app. Leader should be "+str(leader) )
+        if leader_result:
+            main.log.report("Leadership election tests passed(consistent view of leader across listeners and a leader was elected)")
+        utilities.assert_equals(expect=main.TRUE, actual=leader_result,
+                onpass="Leadership election passed",
+                onfail="Something went wrong with Leadership election")
+
+    def CASE15 ( self, main ) :
+        '''
+        Check that Leadership Election is still functional
+        '''
+        leader_result = main.TRUE
+        description = "Check that Leadership Election is still functional"
+        main.log.report(description)
+        main.case(description)
+        main.step("Find current leader and withdraw")
+        leader = main.ONOScli1.election_test_leader()
+        #TODO: do some sanity checking on leader before using it
+        withdraw_result = main.FALSE
+        if leader == ONOS1_ip:
+            old_leader = getattr( main, "ONOScli1" )
+        elif leader == ONOS2_ip:
+            old_leader = getattr( main, "ONOScli2" )
+        elif leader == ONOS3_ip:
+            old_leader = getattr( main, "ONOScli3" )
+        elif leader == ONOS4_ip:
+            old_leader = getattr( main, "ONOScli4" )
+        elif leader == ONOS5_ip:
+            old_leader = getattr( main, "ONOScli5" )
+        elif leader == ONOS6_ip:
+            old_leader = getattr( main, "ONOScli6" )
+        elif leader == ONOS7_ip:
+            old_leader = getattr( main, "ONOScli7" )
+        elif leader == None or leader == main.FALSE:
+            main.log.report("Leader for the election app should be an ONOS node,"\
+                    +"instead got '"+str(leader)+"'")
+            leader_result = main.FALSE
+        withdraw_result = old_leader.election_test_withdraw()
+
+
+        main.step("Make sure new leader is elected")
+        leader_list = []
+        for controller in range(1,num_controllers+1):
+            node = getattr( main, ( 'ONOScli' + str( controller ) ) )#loop through ONOScli handlers
+            leader_list.append( node.election_test_leader() )
+        for leaderN in leader_list:
+            if leaderN == leader:
+                main.log.report("ONOS"+str(controller)+" still sees " + str(leader) +\
+                        " as leader after they withdrew")
+                leader_result = main.FALSE
+            elif leaderN == main.FALSE:
+                #error in  response
+                #TODO: add check for "Command not found:" in the driver, this means the app isn't loaded
+                main.log.report("Something is wrong with election_test_leader function, check the error logs")
+                leader_result = main.FALSE
+        consistent_leader = main.FALSE
+        if len( set( leader_list ) ) == 1:
+            main.log.info("Each Election-app sees '"+str(leader_list[0])+"' as the leader")
+            consistent_leader = main.TRUE
+        else:
+            main.log.report("Inconsistent responses for leader of Election-app:")
+            for n in range(len(leader_list)):
+                main.log.report("ONOS" + str(n+1) + " response: " + str(leader_list[n]) )
+        if leader_result:
+            main.log.report("Leadership election tests passed(consistent view of leader across listeners and a new leader was elected when the old leader resigned)")
+        utilities.assert_equals(expect=main.TRUE, actual=leader_result,
+                onpass="Leadership election passed",
+                onfail="Something went wrong with Leadership election")
+
+
+        main.step("Run for election on old leader(just so everyone is in the hat)")
+        run_result = old_leader.election_test_run()
+        if consistent_leader == main.TRUE:
+            after_run = main.ONOScli1.election_test_leader()
+            #verify leader didn't just change
+            if after_run == leader_list[0]:
+                leader_result = main.TRUE
+            else:
+                leader_result = main.FALSE
+        #TODO: assert on  run and withdraw results?
+
+        utilities.assert_equals(expect=main.TRUE, actual=leader_result,
+                onpass="Leadership election passed",
+                onfail="Something went wrong with Leadership election after the old leader re-ran for election")
+
diff --git a/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.topo b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.topo
new file mode 100644
index 0000000..4d4156c
--- /dev/null
+++ b/TestON/tests/HATestMinorityRestart/HATestMinorityRestart.topo
@@ -0,0 +1,173 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOSbench>
+
+        <ONOScli1>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli1>
+
+        <ONOScli2>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli2>
+
+        <ONOScli3>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli3>
+
+
+        <ONOScli4>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli4>
+
+
+        <ONOScli5>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>6</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli5>
+
+
+        <ONOScli6>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>7</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli6>
+
+
+        <ONOScli7>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>8</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli7>
+
+        <ONOS1>
+            <host>10.128.30.11</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>9</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1>
+
+        <ONOS2>
+            <host>10.128.30.12</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>10</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS2>
+
+        <ONOS3>
+            <host>10.128.30.13</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>11</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS3>
+
+        <ONOS4>
+            <host>10.128.30.14</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>12</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS4>
+
+        <ONOS5>
+            <host>10.128.30.15</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>13</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS5>
+
+        <ONOS6>
+            <host>10.128.30.16</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>14</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS6>
+
+        <ONOS7>
+            <host>10.128.30.17</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>15</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS7>
+
+        <Mininet1>
+            <host>10.128.30.9</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>16</connect_order>
+            <COMPONENTS>
+                #Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+                <arg2> --topo mytopo </arg2>
+                <arg3> </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet1>
+
+        <Mininet2>
+            <host>10.128.30.9</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>RemoteMininetDriver</type>
+            <connect_order>17</connect_order>
+            <COMPONENTS>
+                # Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+                <arg2> --topo mytopo --arp</arg2>
+                <controller> remote </controller>
+             </COMPONENTS>
+        </Mininet2>
+
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/HPSwitchTest/__init__.py b/TestON/tests/HATestMinorityRestart/__init__.py
similarity index 100%
copy from TestON/tests/HPSwitchTest/__init__.py
copy to TestON/tests/HATestMinorityRestart/__init__.py
diff --git a/TestON/tests/HATestSanity/HATestSanity.params b/TestON/tests/HATestSanity/HATestSanity.params
new file mode 100644
index 0000000..78e0c83
--- /dev/null
+++ b/TestON/tests/HATestSanity/HATestSanity.params
@@ -0,0 +1,64 @@
+<PARAMS>
+    <testcases>1,2,8,3,4,5,14,[6],8,7,4,15,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
+    <ENV>
+    <cellName>HA</cellName>
+    </ENV>
+    <Git>False</Git>
+    <num_controllers> 7 </num_controllers>
+
+    <CTRL>
+        <ip1>10.128.30.11</ip1>
+        <port1>6633</port1>
+
+        <ip2>10.128.30.12</ip2>
+        <port2>6633</port2>
+
+        <ip3>10.128.30.13</ip3>
+        <port3>6633</port3>
+
+        <ip4>10.128.30.14</ip4>
+        <port4>6633</port4>
+
+        <ip5>10.128.30.15</ip5>
+        <port5>6633</port5>
+
+        <ip6>10.128.30.16</ip6>
+        <port6>6633</port6>
+
+        <ip7>10.128.30.17</ip7>
+        <port7>6633</port7>
+    </CTRL>
+    <TESTONUSER>admin</TESTONUSER>
+    <TESTONIP>10.128.30.9</TESTONIP>
+    <PING>
+        <source1>h8</source1>
+        <source2>h9</source2>
+        <source3>h10</source3>
+        <source4>h11</source4>
+        <source5>h12</source5>
+        <source6>h13</source6>
+        <source7>h14</source7>
+        <source8>h15</source8>
+        <source9>h16</source9>
+        <source10>h17</source10>
+        <target1>10.0.0.18</target1>
+        <target2>10.0.0.19</target2>
+        <target3>10.0.0.20</target3>
+        <target4>10.0.0.21</target4>
+        <target5>10.0.0.22</target5>
+        <target6>10.0.0.23</target6>
+        <target7>10.0.0.24</target7>
+        <target8>10.0.0.25</target8>
+        <target9>10.0.0.26</target9>
+        <target10>10.0.0.27</target10>
+    </PING>
+    <timers>
+        <LinkDiscovery>.2</LinkDiscovery>
+        <SwitchDiscovery>.2</SwitchDiscovery>
+    </timers>
+    <MNtcpdump>
+        <intf>eth0</intf>
+        <port> </port>
+        <folder>~/packet_captures/</folder>
+    </MNtcpdump>
+</PARAMS>
diff --git a/TestON/tests/HATestSanity/HATestSanity.py b/TestON/tests/HATestSanity/HATestSanity.py
new file mode 100644
index 0000000..2d56e90
--- /dev/null
+++ b/TestON/tests/HATestSanity/HATestSanity.py
@@ -0,0 +1,1812 @@
+'''
+Description: This test is to determine if the HA test setup is
+    working correctly. There are no failures so this test should
+    have a 100% pass rate
+
+List of test cases:
+CASE1: Compile ONOS and push it to the test machines
+CASE2: Assign mastership to controllers
+CASE3: Assign intents
+CASE4: Ping across added host intents
+CASE5: Reading state of ONOS
+CASE6: The Failure case. Since this is the Sanity test, we do nothing.
+CASE7: Check state after control plane failure
+CASE8: Compare topo
+CASE9: Link s3-s28 down
+CASE10: Link s3-s28 up
+CASE11: Switch down
+CASE12: Switch up
+CASE13: Clean up
+CASE14: start election app on all onos nodes
+CASE15: Check that Leadership Election is still functional
+'''
+class HATestSanity:
+
+    def __init__(self) :
+        self.default = ''
+
+    def CASE1(self,main) :
+        '''
+        CASE1 is to compile ONOS and push it to the test machines
+
+        Startup sequence:
+        git pull
+        mvn clean install
+        onos-package
+        cell <name>
+        onos-verify-cell
+        NOTE: temporary - onos-remove-raft-logs
+        onos-install -f
+        onos-wait-for-start
+        '''
+        import time
+        main.log.report("ONOS HA Sanity test - initialization")
+        main.case("Setting up test environment")
+        #TODO: save all the timers and output them for plotting
+
+        # load some vairables from the params file
+        PULL_CODE = False
+        if main.params['Git'] == 'True':
+            PULL_CODE = True
+        cell_name = main.params['ENV']['cellName']
+
+        #set global variables
+        global ONOS1_ip
+        global ONOS1_port
+        global ONOS2_ip
+        global ONOS2_port
+        global ONOS3_ip
+        global ONOS3_port
+        global ONOS4_ip
+        global ONOS4_port
+        global ONOS5_ip
+        global ONOS5_port
+        global ONOS6_ip
+        global ONOS6_port
+        global ONOS7_ip
+        global ONOS7_port
+        global num_controllers
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS1_port = main.params['CTRL']['port1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS2_port = main.params['CTRL']['port2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+        ONOS3_port = main.params['CTRL']['port3']
+        ONOS4_ip = main.params['CTRL']['ip4']
+        ONOS4_port = main.params['CTRL']['port4']
+        ONOS5_ip = main.params['CTRL']['ip5']
+        ONOS5_port = main.params['CTRL']['port5']
+        ONOS6_ip = main.params['CTRL']['ip6']
+        ONOS6_port = main.params['CTRL']['port6']
+        ONOS7_ip = main.params['CTRL']['ip7']
+        ONOS7_port = main.params['CTRL']['port7']
+        num_controllers = int(main.params['num_controllers'])
+
+
+        main.step("Applying cell variable to environment")
+        cell_result = main.ONOSbench.set_cell(cell_name)
+        verify_result = main.ONOSbench.verify_cell()
+
+        #FIXME:this is short term fix
+        main.log.report("Removing raft logs")
+        main.ONOSbench.onos_remove_raft_logs()
+        main.log.report("Uninstalling ONOS")
+        main.ONOSbench.onos_uninstall(ONOS1_ip)
+        main.ONOSbench.onos_uninstall(ONOS2_ip)
+        main.ONOSbench.onos_uninstall(ONOS3_ip)
+        main.ONOSbench.onos_uninstall(ONOS4_ip)
+        main.ONOSbench.onos_uninstall(ONOS5_ip)
+        main.ONOSbench.onos_uninstall(ONOS6_ip)
+        main.ONOSbench.onos_uninstall(ONOS7_ip)
+
+        clean_install_result = main.TRUE
+        git_pull_result = main.TRUE
+
+        main.step("Compiling the latest version of ONOS")
+        if PULL_CODE:
+            # Configure branch in params
+            main.step("Git checkout and pull master")
+            main.ONOSbench.git_checkout("master")
+            git_pull_result = main.ONOSbench.git_pull()
+
+            main.step("Using mvn clean & install")
+            clean_install_result = main.TRUE
+            if git_pull_result == main.TRUE:
+                clean_install_result = main.ONOSbench.clean_install()
+            else:
+                main.log.warn("Did not pull new code so skipping mvn "+ \
+                        "clean install")
+        main.ONOSbench.get_version(report=True)
+
+        main.step("Creating ONOS package")
+        package_result = main.ONOSbench.onos_package()
+
+        main.step("Installing ONOS package")
+        onos1_install_result = main.ONOSbench.onos_install(options="-f",
+                node=ONOS1_ip)
+        onos2_install_result = main.ONOSbench.onos_install(options="-f",
+                node=ONOS2_ip)
+        onos3_install_result = main.ONOSbench.onos_install(options="-f",
+                node=ONOS3_ip)
+        onos4_install_result = main.ONOSbench.onos_install(options="-f",
+                node=ONOS4_ip)
+        onos5_install_result = main.ONOSbench.onos_install(options="-f",
+                node=ONOS5_ip)
+        onos6_install_result = main.ONOSbench.onos_install(options="-f",
+                node=ONOS6_ip)
+        onos7_install_result = main.ONOSbench.onos_install(options="-f",
+                node=ONOS7_ip)
+        onos_install_result = onos1_install_result and onos2_install_result\
+                and onos3_install_result and onos4_install_result\
+                and onos5_install_result and onos6_install_result\
+                and onos7_install_result
+        '''
+        #FIXME: work around until onos is less fragile
+        main.ONOSbench.handle.sendline("onos-cluster-install")
+        print main.ONOSbench.handle.expect("\$")
+        onos_install_result = main.TRUE
+        '''
+
+
+        main.step("Checking if ONOS is up yet")
+        #TODO check bundle:list?
+        for i in range(2):
+            onos1_isup = main.ONOSbench.isup(ONOS1_ip)
+            if not onos1_isup:
+                main.log.report("ONOS1 didn't start!")
+            onos2_isup = main.ONOSbench.isup(ONOS2_ip)
+            if not onos2_isup:
+                main.log.report("ONOS2 didn't start!")
+            onos3_isup = main.ONOSbench.isup(ONOS3_ip)
+            if not onos3_isup:
+                main.log.report("ONOS3 didn't start!")
+            onos4_isup = main.ONOSbench.isup(ONOS4_ip)
+            if not onos4_isup:
+                main.log.report("ONOS4 didn't start!")
+            onos5_isup = main.ONOSbench.isup(ONOS5_ip)
+            if not onos5_isup:
+                main.log.report("ONOS5 didn't start!")
+            onos6_isup = main.ONOSbench.isup(ONOS6_ip)
+            if not onos6_isup:
+                main.log.report("ONOS6 didn't start!")
+            onos7_isup = main.ONOSbench.isup(ONOS7_ip)
+            if not onos7_isup:
+                main.log.report("ONOS7 didn't start!")
+            onos_isup_result = onos1_isup and onos2_isup and onos3_isup\
+                    and onos4_isup and onos5_isup and onos6_isup and onos7_isup
+            if onos_isup_result == main.TRUE:
+                break
+
+
+        cli_result1 = main.ONOScli1.start_onos_cli(ONOS1_ip)
+        cli_result2 = main.ONOScli2.start_onos_cli(ONOS2_ip)
+        cli_result3 = main.ONOScli3.start_onos_cli(ONOS3_ip)
+        cli_result4 = main.ONOScli4.start_onos_cli(ONOS4_ip)
+        cli_result5 = main.ONOScli5.start_onos_cli(ONOS5_ip)
+        cli_result6 = main.ONOScli6.start_onos_cli(ONOS6_ip)
+        cli_result7 = main.ONOScli7.start_onos_cli(ONOS7_ip)
+        cli_results = cli_result1 and cli_result2 and cli_result3 and\
+                cli_result4 and cli_result5 and cli_result6 and cli_result7
+
+        main.step("Start Packet Capture MN")
+        main.Mininet2.start_tcpdump(
+                str(main.params['MNtcpdump']['folder'])+str(main.TEST)+"-MN.pcap",
+                intf = main.params['MNtcpdump']['intf'],
+                port = main.params['MNtcpdump']['port'])
+
+
+        case1_result = (clean_install_result and package_result and
+                cell_result and verify_result and onos_install_result and
+                onos_isup_result and cli_results)
+
+        utilities.assert_equals(expect=main.TRUE, actual=case1_result,
+                onpass="Test startup successful",
+                onfail="Test startup NOT successful")
+
+
+        if case1_result==main.FALSE:
+            main.cleanup()
+            main.exit()
+
+    def CASE2(self,main) :
+        '''
+        Assign mastership to controllers
+        '''
+        import time
+        import json
+        import re
+
+        main.log.report("Assigning switches to controllers")
+        main.case("Assigning Controllers")
+        main.step("Assign switches to controllers")
+
+        for i in range (1,29):
+           main.Mininet1.assign_sw_controller(sw=str(i),count=num_controllers,
+                    ip1=ONOS1_ip,port1=ONOS1_port,
+                    ip2=ONOS2_ip,port2=ONOS2_port,
+                    ip3=ONOS3_ip,port3=ONOS3_port,
+                    ip4=ONOS4_ip,port4=ONOS4_port,
+                    ip5=ONOS5_ip,port5=ONOS5_port,
+                    ip6=ONOS6_ip,port6=ONOS6_port,
+                    ip7=ONOS7_ip,port7=ONOS7_port)
+
+        mastership_check = main.TRUE
+        for i in range (1,29):
+            response = main.Mininet1.get_sw_controller("s"+str(i))
+            try:
+                main.log.info(str(response))
+            except:
+                main.log.info(repr(response))
+            if re.search("tcp:"+ONOS1_ip,response)\
+                    and re.search("tcp:"+ONOS2_ip,response)\
+                    and re.search("tcp:"+ONOS3_ip,response)\
+                    and re.search("tcp:"+ONOS4_ip,response)\
+                    and re.search("tcp:"+ONOS5_ip,response)\
+                    and re.search("tcp:"+ONOS6_ip,response)\
+                    and re.search("tcp:"+ONOS7_ip,response):
+                mastership_check = mastership_check and main.TRUE
+            else:
+                mastership_check = main.FALSE
+        if mastership_check == main.TRUE:
+            main.log.report("Switch mastership assigned correctly")
+        utilities.assert_equals(expect = main.TRUE,actual=mastership_check,
+                onpass="Switch mastership assigned correctly",
+                onfail="Switches not assigned correctly to controllers")
+
+        #Manually assign mastership to the controller we want
+        role_call = main.TRUE
+        role_check = main.TRUE
+
+        device_id = main.ONOScli1.get_device("1000")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS1_ip)
+        if ONOS1_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("2800")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS1_ip)
+        if ONOS1_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("2000")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS2_ip)
+        if ONOS2_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3000")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS2_ip)
+        if ONOS2_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("5000")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS3_ip)
+        if ONOS3_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6000")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS3_ip)
+        if ONOS3_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id =  main.ONOScli1.get_device("3004")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS4_ip)
+        if ONOS4_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3008")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3009")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3010")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3011")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3012")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3013")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3014")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3015")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3016")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("3017")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS5_ip)
+        if ONOS5_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6007")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS6_ip)
+        if ONOS6_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6018")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6019")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6020")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6021")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6022")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6023")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6024")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6025")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6026")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        device_id = main.ONOScli1.get_device("6027")['id']
+        role_call = role_call and main.ONOScli1.device_role(device_id, ONOS7_ip)
+        if ONOS7_ip in main.ONOScli1.get_role(device_id)['master']:
+            role_check = role_check and main.TRUE
+        else:
+            role_check = role_check and main.FALSE
+
+        utilities.assert_equals(expect = main.TRUE,actual=role_call,
+                onpass="Re-assigned switch mastership to designated controller",
+                onfail="Something wrong with device_role calls")
+
+        utilities.assert_equals(expect = main.TRUE,actual=role_check,
+                onpass="Switches were successfully reassigned to designated controller",
+                onfail="Switches were not successfully reassigned")
+        mastership_check = mastership_check and role_call and role_check
+        utilities.assert_equals(expect = main.TRUE,actual=mastership_check,
+                onpass="Switch mastership correctly assigned",
+                onfail="Error in (re)assigning switch mastership")
+
+
+    def CASE3(self,main) :
+        """
+        Assign intents
+
+        """
+        import time
+        import json
+        import re
+        main.log.report("Adding host intents")
+        main.case("Adding host Intents")
+
+        main.step("Discovering  Hosts( Via pingall for now)")
+        #FIXME: Once we have a host discovery mechanism, use that instead
+
+        #install onos-app-fwd
+        main.log.info("Install reactive forwarding app")
+        main.ONOScli1.feature_install("onos-app-fwd")
+        main.ONOScli2.feature_install("onos-app-fwd")
+        main.ONOScli3.feature_install("onos-app-fwd")
+        main.ONOScli4.feature_install("onos-app-fwd")
+        main.ONOScli5.feature_install("onos-app-fwd")
+        main.ONOScli6.feature_install("onos-app-fwd")
+        main.ONOScli7.feature_install("onos-app-fwd")
+
+        #REACTIVE FWD test
+        ping_result = main.FALSE
+        time1 = time.time()
+        ping_result = main.Mininet1.pingall()
+        time2 = time.time()
+        main.log.info("Time for pingall: %2f seconds" % (time2 - time1))
+
+        #uninstall onos-app-fwd
+        main.log.info("Uninstall reactive forwarding app")
+        main.ONOScli1.feature_uninstall("onos-app-fwd")
+        main.ONOScli2.feature_uninstall("onos-app-fwd")
+        main.ONOScli3.feature_uninstall("onos-app-fwd")
+        main.ONOScli4.feature_uninstall("onos-app-fwd")
+        main.ONOScli5.feature_uninstall("onos-app-fwd")
+        main.ONOScli6.feature_uninstall("onos-app-fwd")
+        main.ONOScli7.feature_uninstall("onos-app-fwd")
+        #timeout for fwd flows
+        time.sleep(10)
+
+        main.step("Add  host intents")
+        #TODO:  move the host numbers to params
+        import json
+        intents_json= json.loads(main.ONOScli1.hosts())
+        intent_add_result = True
+        for i in range(8,18):
+            main.log.info("Adding host intent between h"+str(i)+" and h"+str(i+10))
+            host1 =  "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
+            host2 =  "00:00:00:00:00:" + str(hex(i+10)[2:]).zfill(2).upper()
+            host1_id = main.ONOScli1.get_host(host1)['id']
+            host2_id = main.ONOScli1.get_host(host2)['id']
+            #NOTE: get host can return None
+            if host1_id and host2_id:
+                tmp_result = main.ONOScli1.add_host_intent(host1_id, host2_id )
+            else:
+                main.log.error("Error, get_host() failed")
+                tmp_result = main.FALSE
+            intent_add_result = bool(intent_add_result and tmp_result)
+        utilities.assert_equals(expect=True, actual=intent_add_result,
+                onpass="Switch mastership correctly assigned",
+                onfail="Error in (re)assigning switch mastership")
+        #TODO Check if intents all exist in datastore
+        #NOTE: Do we need to print this once the test is working?
+        #main.log.info(json.dumps(json.loads(main.ONOScli1.intents(json_format=True)),
+        #    sort_keys=True, indent=4, separators=(',', ': ') ) )
+
+    def CASE4(self,main) :
+        """
+        Ping across added host intents
+        """
+        description = " Ping across added host intents"
+        main.log.report(description)
+        main.case(description)
+        Ping_Result = main.TRUE
+        for i in range(8,18):
+            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
+            Ping_Result = Ping_Result and ping
+            if ping==main.FALSE:
+                main.log.warn("Ping failed between h"+str(i)+" and h" + str(i+10))
+            elif ping==main.TRUE:
+                main.log.info("Ping test passed!")
+                Ping_Result = main.TRUE
+        if Ping_Result==main.FALSE:
+            main.log.report("Intents have not been installed correctly, pings failed.")
+        if Ping_Result==main.TRUE:
+            main.log.report("Intents have been installed correctly and verified by pings")
+        utilities.assert_equals(expect = main.TRUE,actual=Ping_Result,
+                onpass="Intents have been installed correctly and pings work",
+                onfail ="Intents have not been installed correctly, pings failed." )
+
+    def CASE5(self,main) :
+        '''
+        Reading state of ONOS
+        '''
+        import time
+        import json
+        from subprocess import Popen, PIPE
+        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
+
+        main.log.report("Setting up and gathering data for current state")
+        main.case("Setting up and gathering data for current state")
+        #The general idea for this test case is to pull the state of (intents,flows, topology,...) from each ONOS node
+        #We can then compare them with eachother and also with past states
+
+        main.step("Get the Mastership of each switch from each controller")
+        global mastership_state
+        mastership_state = []
+
+        #Assert that each device has a master
+        ONOS1_master_not_null = main.ONOScli1.roles_not_null()
+        ONOS2_master_not_null = main.ONOScli2.roles_not_null()
+        ONOS3_master_not_null = main.ONOScli3.roles_not_null()
+        ONOS4_master_not_null = main.ONOScli4.roles_not_null()
+        ONOS5_master_not_null = main.ONOScli5.roles_not_null()
+        ONOS6_master_not_null = main.ONOScli6.roles_not_null()
+        ONOS7_master_not_null = main.ONOScli7.roles_not_null()
+        roles_not_null = ONOS1_master_not_null and ONOS2_master_not_null and\
+                ONOS3_master_not_null and ONOS4_master_not_null and\
+                ONOS5_master_not_null and ONOS6_master_not_null and\
+                ONOS7_master_not_null
+        utilities.assert_equals(expect = main.TRUE,actual=roles_not_null,
+                onpass="Each device has a master",
+                onfail="Some devices don't have a master assigned")
+
+
+        ONOS1_mastership = main.ONOScli1.roles()
+        ONOS2_mastership = main.ONOScli2.roles()
+        ONOS3_mastership = main.ONOScli3.roles()
+        ONOS4_mastership = main.ONOScli4.roles()
+        ONOS5_mastership = main.ONOScli5.roles()
+        ONOS6_mastership = main.ONOScli6.roles()
+        ONOS7_mastership = main.ONOScli7.roles()
+        #print json.dumps(json.loads(ONOS1_mastership), sort_keys=True, indent=4, separators=(',', ': '))
+        if "Error" in ONOS1_mastership or not ONOS1_mastership\
+                or "Error" in ONOS2_mastership or not ONOS2_mastership\
+                or "Error" in ONOS3_mastership or not ONOS3_mastership\
+                or "Error" in ONOS4_mastership or not ONOS4_mastership\
+                or "Error" in ONOS5_mastership or not ONOS5_mastership\
+                or "Error" in ONOS6_mastership or not ONOS6_mastership\
+                or "Error" in ONOS7_mastership or not ONOS7_mastership:
+                    main.log.report("Error in getting ONOS roles")
+                    main.log.warn("ONOS1 mastership response: " + repr(ONOS1_mastership))
+                    main.log.warn("ONOS2 mastership response: " + repr(ONOS2_mastership))
+                    main.log.warn("ONOS3 mastership response: " + repr(ONOS3_mastership))
+                    main.log.warn("ONOS4 mastership response: " + repr(ONOS4_mastership))
+                    main.log.warn("ONOS5 mastership response: " + repr(ONOS5_mastership))
+                    main.log.warn("ONOS6 mastership response: " + repr(ONOS6_mastership))
+                    main.log.warn("ONOS7 mastership response: " + repr(ONOS7_mastership))
+                    consistent_mastership = main.FALSE
+        elif ONOS1_mastership == ONOS2_mastership\
+                and ONOS1_mastership == ONOS3_mastership\
+                and ONOS1_mastership == ONOS4_mastership\
+                and ONOS1_mastership == ONOS5_mastership\
+                and ONOS1_mastership == ONOS6_mastership\
+                and ONOS1_mastership == ONOS7_mastership:
+                    mastership_state = ONOS1_mastership
+                    consistent_mastership = main.TRUE
+                    main.log.report("Switch roles are consistent across all ONOS nodes")
+        else:
+            main.log.warn("ONOS1 roles: ", json.dumps(json.loads(ONOS1_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS2 roles: ", json.dumps(json.loads(ONOS2_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS3 roles: ", json.dumps(json.loads(ONOS3_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS4 roles: ", json.dumps(json.loads(ONOS4_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS5 roles: ", json.dumps(json.loads(ONOS5_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS6 roles: ", json.dumps(json.loads(ONOS6_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS7 roles: ", json.dumps(json.loads(ONOS7_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            consistent_mastership = main.FALSE
+        utilities.assert_equals(expect = main.TRUE,actual=consistent_mastership,
+                onpass="Switch roles are consistent across all ONOS nodes",
+                onfail="ONOS nodes have different views of switch roles")
+
+
+        main.step("Get the intents from each controller")
+        global intent_state
+        intent_state = []
+        ONOS1_intents = main.ONOScli1.intents( json_format=True )
+        ONOS2_intents = main.ONOScli2.intents( json_format=True )
+        ONOS3_intents = main.ONOScli3.intents( json_format=True )
+        ONOS4_intents = main.ONOScli4.intents( json_format=True )
+        ONOS5_intents = main.ONOScli5.intents( json_format=True )
+        ONOS6_intents = main.ONOScli6.intents( json_format=True )
+        ONOS7_intents = main.ONOScli7.intents( json_format=True )
+        intent_check = main.FALSE
+        if "Error" in ONOS1_intents or not ONOS1_intents\
+                or "Error" in ONOS2_intents or not ONOS2_intents\
+                or "Error" in ONOS3_intents or not ONOS3_intents\
+                or "Error" in ONOS4_intents or not ONOS4_intents\
+                or "Error" in ONOS5_intents or not ONOS5_intents\
+                or "Error" in ONOS6_intents or not ONOS6_intents\
+                or "Error" in ONOS7_intents or not ONOS7_intents:
+                    main.log.report("Error in getting ONOS intents")
+                    main.log.warn("ONOS1 intents response: " + repr(ONOS1_intents))
+                    main.log.warn("ONOS2 intents response: " + repr(ONOS2_intents))
+                    main.log.warn("ONOS3 intents response: " + repr(ONOS3_intents))
+                    main.log.warn("ONOS4 intents response: " + repr(ONOS4_intents))
+                    main.log.warn("ONOS5 intents response: " + repr(ONOS5_intents))
+                    main.log.warn("ONOS6 intents response: " + repr(ONOS6_intents))
+                    main.log.warn("ONOS7 intents response: " + repr(ONOS7_intents))
+        elif ONOS1_intents == ONOS2_intents\
+                and ONOS1_intents == ONOS3_intents\
+                and ONOS1_intents == ONOS4_intents\
+                and ONOS1_intents == ONOS5_intents\
+                and ONOS1_intents == ONOS6_intents\
+                and ONOS1_intents == ONOS7_intents:
+                    intent_state = ONOS1_intents
+                    intent_check = main.TRUE
+                    main.log.report("Intents are consistent across all ONOS nodes")
+        else:
+            main.log.warn("ONOS1 intents: ", json.dumps(json.loads(ONOS1_intents),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS2 intents: ", json.dumps(json.loads(ONOS2_intents),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS3 intents: ", json.dumps(json.loads(ONOS3_intents),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS4 intents: ", json.dumps(json.loads(ONOS4_intents),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS5 intents: ", json.dumps(json.loads(ONOS5_intents),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS6 intents: ", json.dumps(json.loads(ONOS6_intents),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS7 intents: ", json.dumps(json.loads(ONOS7_intents),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+        utilities.assert_equals(expect = main.TRUE,actual=intent_check,
+                onpass="Intents are consistent across all ONOS nodes",
+                onfail="ONOS nodes have different views of intents")
+
+
+        main.step("Get the flows from each controller")
+        global flow_state
+        flow_state = []
+        ONOS1_flows = main.ONOScli1.flows( json_format=True )
+        ONOS2_flows = main.ONOScli2.flows( json_format=True )
+        ONOS3_flows = main.ONOScli3.flows( json_format=True )
+        ONOS4_flows = main.ONOScli4.flows( json_format=True )
+        ONOS5_flows = main.ONOScli5.flows( json_format=True )
+        ONOS6_flows = main.ONOScli6.flows( json_format=True )
+        ONOS7_flows = main.ONOScli7.flows( json_format=True )
+        flow_check = main.FALSE
+        if "Error" in ONOS1_flows or not ONOS1_flows\
+                or "Error" in ONOS2_flows or not ONOS2_flows\
+                or "Error" in ONOS3_flows or not ONOS3_flows\
+                or "Error" in ONOS4_flows or not ONOS4_flows\
+                or "Error" in ONOS5_flows or not ONOS5_flows\
+                or "Error" in ONOS6_flows or not ONOS6_flows\
+                or "Error" in ONOS7_flows or not ONOS7_flows:
+                    main.log.report("Error in getting ONOS intents")
+                    main.log.warn("ONOS1 flows repsponse: "+ ONOS1_flows)
+                    main.log.warn("ONOS2 flows repsponse: "+ ONOS2_flows)
+                    main.log.warn("ONOS3 flows repsponse: "+ ONOS3_flows)
+                    main.log.warn("ONOS4 flows repsponse: "+ ONOS4_flows)
+                    main.log.warn("ONOS5 flows repsponse: "+ ONOS5_flows)
+                    main.log.warn("ONOS6 flows repsponse: "+ ONOS6_flows)
+                    main.log.warn("ONOS7 flows repsponse: "+ ONOS7_flows)
+        elif len(json.loads(ONOS1_flows)) == len(json.loads(ONOS2_flows))\
+                and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS3_flows))\
+                and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS4_flows))\
+                and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS5_flows))\
+                and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS6_flows))\
+                and len(json.loads(ONOS1_flows)) == len(json.loads(ONOS7_flows)):
+                #TODO: Do a better check, maybe compare flows on switches?
+                    flow_state = ONOS1_flows
+                    flow_check = main.TRUE
+                    main.log.report("Flow count is consistent across all ONOS nodes")
+        else:
+            main.log.warn("ONOS1 flows: "+ json.dumps(json.loads(ONOS1_flows),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS2 flows: "+ json.dumps(json.loads(ONOS2_flows),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS3 flows: "+ json.dumps(json.loads(ONOS3_flows),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS4 flows: "+ json.dumps(json.loads(ONOS4_flows),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS5 flows: "+ json.dumps(json.loads(ONOS5_flows),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS6 flows: "+ json.dumps(json.loads(ONOS6_flows),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS7 flows: "+ json.dumps(json.loads(ONOS7_flows),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+        utilities.assert_equals(expect = main.TRUE,actual=flow_check,
+                onpass="The flow count is consistent across all ONOS nodes",
+                onfail="ONOS nodes have different flow counts")
+
+
+        main.step("Get the OF Table entries")
+        global flows
+        flows=[]
+        for i in range(1,29):
+            flows.append(main.Mininet2.get_flowTable(1.3, "s"+str(i)))
+
+        #TODO: Compare switch flow tables with ONOS flow tables
+
+        main.step("Start continuous pings")
+        main.Mininet2.pingLong(src=main.params['PING']['source1'],
+                            target=main.params['PING']['target1'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source2'],
+                            target=main.params['PING']['target2'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source3'],
+                            target=main.params['PING']['target3'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source4'],
+                            target=main.params['PING']['target4'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source5'],
+                            target=main.params['PING']['target5'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source6'],
+                            target=main.params['PING']['target6'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source7'],
+                            target=main.params['PING']['target7'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source8'],
+                            target=main.params['PING']['target8'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source9'],
+                            target=main.params['PING']['target9'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source10'],
+                            target=main.params['PING']['target10'],pingTime=500)
+
+        main.step("Create TestONTopology object")
+        ctrls = []
+        count = 1
+        while True:
+            temp = ()
+            if ('ip' + str(count)) in main.params['CTRL']:
+                temp = temp + (getattr(main,('ONOS' + str(count))),)
+                temp = temp + ("ONOS"+str(count),)
+                temp = temp + (main.params['CTRL']['ip'+str(count)],)
+                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
+                ctrls.append(temp)
+                count = count + 1
+            else:
+                break
+        MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+
+        main.step("Collecting topology information from ONOS")
+        devices = []
+        devices.append( main.ONOScli1.devices() )
+        devices.append( main.ONOScli2.devices() )
+        devices.append( main.ONOScli3.devices() )
+        devices.append( main.ONOScli4.devices() )
+        devices.append( main.ONOScli5.devices() )
+        devices.append( main.ONOScli6.devices() )
+        devices.append( main.ONOScli7.devices() )
+        hosts = []
+        hosts.append( main.ONOScli1.hosts() )
+        hosts.append( main.ONOScli2.hosts() )
+        hosts.append( main.ONOScli3.hosts() )
+        hosts.append( main.ONOScli4.hosts() )
+        hosts.append( main.ONOScli5.hosts() )
+        hosts.append( main.ONOScli6.hosts() )
+        hosts.append( main.ONOScli7.hosts() )
+        ports = []
+        ports.append( main.ONOScli1.ports() )
+        ports.append( main.ONOScli2.ports() )
+        ports.append( main.ONOScli3.ports() )
+        ports.append( main.ONOScli4.ports() )
+        ports.append( main.ONOScli5.ports() )
+        ports.append( main.ONOScli6.ports() )
+        ports.append( main.ONOScli7.ports() )
+        links = []
+        links.append( main.ONOScli1.links() )
+        links.append( main.ONOScli2.links() )
+        links.append( main.ONOScli3.links() )
+        links.append( main.ONOScli4.links() )
+        links.append( main.ONOScli5.links() )
+        links.append( main.ONOScli6.links() )
+        links.append( main.ONOScli7.links() )
+        clusters = []
+        clusters.append( main.ONOScli1.clusters() )
+        clusters.append( main.ONOScli2.clusters() )
+        clusters.append( main.ONOScli3.clusters() )
+        clusters.append( main.ONOScli4.clusters() )
+        clusters.append( main.ONOScli5.clusters() )
+        clusters.append( main.ONOScli6.clusters() )
+        clusters.append( main.ONOScli7.clusters() )
+        paths = []
+        temp_topo = main.ONOSbench.get_topology( main.ONOScli1.topology() )
+        paths.append( temp_topo.get('paths', False) )
+        temp_topo = main.ONOSbench.get_topology( main.ONOScli2.topology() )
+        paths.append( temp_topo.get('paths', False) )
+        temp_topo = main.ONOSbench.get_topology( main.ONOScli3.topology() )
+        paths.append( temp_topo.get('paths', False) )
+        temp_topo = main.ONOSbench.get_topology( main.ONOScli4.topology() )
+        paths.append( temp_topo.get('paths', False) )
+        temp_topo = main.ONOSbench.get_topology( main.ONOScli5.topology() )
+        paths.append( temp_topo.get('paths', False) )
+        temp_topo = main.ONOSbench.get_topology( main.ONOScli6.topology() )
+        paths.append( temp_topo.get('paths', False) )
+        temp_topo = main.ONOSbench.get_topology( main.ONOScli7.topology() )
+        paths.append( temp_topo.get('paths', False) )
+
+        #Compare json objects for hosts, dataplane clusters and paths
+
+        #hosts
+        consistent_hosts_result = main.TRUE
+        for controller in range( len( hosts ) ):
+            if not "Error" in hosts[controller]:
+                if hosts[controller] == hosts[0]:
+                    continue
+                else:#hosts not consistent
+                    main.log.report("hosts from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+                    main.log.warn( repr( hosts[controller] ) )
+                    consistent_hosts_result = main.FALSE
+
+            else:
+                main.log.report("Error in getting ONOS hosts from ONOS" + str(controller + 1) )
+                consistent_hosts_result = main.FALSE
+                main.log.warn("ONOS" + str(controller + 1) + " hosts response: " + repr(hosts[controller]) )
+        utilities.assert_equals(expect = main.TRUE,actual=consistent_hosts_result,
+                onpass="Hosts view is consistent across all ONOS nodes",
+                onfail="ONOS nodes have different views of hosts")
+
+        #Strongly connected clusters of devices
+        consistent_clusters_result = main.TRUE
+        for controller in range( len( clusters ) ):
+            if not "Error" in clusters[controller]:
+                if clusters[controller] == clusters[0]:
+                    continue
+                else:#clusters not consistent
+                    main.log.report("clusters from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+                    consistent_clusters_result = main.FALSE
+
+            else:
+                main.log.report("Error in getting dataplane clusters from ONOS" + str(controller + 1) )
+                consistent_clusters_result = main.FALSE
+                main.log.warn("ONOS" + str(controller + 1) + " clusters response: " + repr(clusters[controller]) )
+        utilities.assert_equals(expect = main.TRUE,actual=consistent_clusters_result,
+                onpass="Clusters view is consistent across all ONOS nodes",
+                onfail="ONOS nodes have different views of clusters")
+        num_clusters =  len(json.loads(clusters[0])) #there should always only be one cluster
+        utilities.assert_equals(expect = 1, actual = num_clusters,
+                onpass="ONOS shows 1 SCC",
+                onfail="ONOS shows "+str(num_clusters) +" SCCs")
+
+
+        #paths
+        consistent_paths_result = main.TRUE
+        for controller in range( len( paths ) ):
+            if not "Error" in paths[controller]:
+                if paths[controller] == paths[0]:
+                    continue
+                else:#paths not consistent
+                    main.log.report("paths from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+                    consistent_paths_result = main.FALSE
+
+            else:
+                main.log.report("Error in getting paths from ONOS" + str(controller + 1) )
+                consistent_paths_result = main.FALSE
+                main.log.warn("ONOS" + str(controller + 1) + " paths response: " + repr(paths[controller]) )
+        utilities.assert_equals(expect = main.TRUE,actual=consistent_paths_result,
+                onpass="Paths count is consistent across all ONOS nodes",
+                onfail="ONOS nodes have different counts of paths")
+
+
+        main.step("Comparing ONOS topology to MN")
+        devices_results = main.TRUE
+        ports_results = main.TRUE
+        links_results = main.TRUE
+        for controller in range(num_controllers):
+            if devices[controller] or not "Error" in devices[controller]:
+                current_devices_result =  main.Mininet1.compare_switches(MNTopo, json.loads(devices[controller]))
+            else:
+                current_devices_result = main.FALSE
+            utilities.assert_equals(expect=main.TRUE, actual=current_devices_result,
+                    onpass="ONOS"+str(int(controller+1))+" Switches view is correct",
+                    onfail="ONOS"+str(int(controller+1))+" Switches view is incorrect")
+
+            if ports[controller] or not "Error" in ports[controller]:
+                current_ports_result =  main.Mininet1.compare_ports(MNTopo, json.loads(ports[controller]))
+            else:
+                current_ports_result = main.FALSE
+            utilities.assert_equals(expect=main.TRUE, actual=current_ports_result,
+                    onpass="ONOS"+str(int(controller+1))+" ports view is correct",
+                    onfail="ONOS"+str(int(controller+1))+" ports view is incorrect")
+
+            if links[controller] or not "Error" in links[controller]:
+                current_links_result =  main.Mininet1.compare_links(MNTopo, json.loads(links[controller]))
+            else:
+                current_links_result = main.FALSE
+            utilities.assert_equals(expect=main.TRUE, actual=current_links_result,
+                    onpass="ONOS"+str(int(controller+1))+" links view is correct",
+                    onfail="ONOS"+str(int(controller+1))+" links view is incorrect")
+
+            devices_results = devices_results and current_devices_result
+            ports_results = ports_results and current_ports_result
+            links_results = links_results and current_links_result
+
+        topo_result = devices_results and ports_results and links_results\
+                and consistent_hosts_result and consistent_clusters_result\
+                and consistent_paths_result
+        utilities.assert_equals(expect=main.TRUE, actual=topo_result,
+                onpass="Topology Check Test successful",
+                onfail="Topology Check Test NOT successful")
+
+        final_assert = main.TRUE
+        final_assert = final_assert and topo_result and flow_check \
+                and intent_check and consistent_mastership and roles_not_null
+        utilities.assert_equals(expect=main.TRUE, actual=final_assert,
+                onpass="State check successful",
+                onfail="State check NOT successful")
+
+
+    def CASE6(self,main) :
+        '''
+        The Failure case. Since this is the Sanity test, we do nothing.
+        '''
+        import time
+        main.log.report("Wait 60 seconds instead of inducing a failure")
+        time.sleep(60)
+        utilities.assert_equals(expect=main.TRUE, actual=main.TRUE,
+                onpass="Sleeping 60 seconds",
+                onfail="Something is terribly wrong with my math")
+
+    def CASE7(self,main) :
+        '''
+        Check state after ONOS failure
+        '''
+        import os
+        import json
+        main.case("Running ONOS Constant State Tests")
+
+        #Assert that each device has a master
+        ONOS1_master_not_null = main.ONOScli1.roles_not_null()
+        ONOS2_master_not_null = main.ONOScli2.roles_not_null()
+        ONOS3_master_not_null = main.ONOScli3.roles_not_null()
+        ONOS4_master_not_null = main.ONOScli4.roles_not_null()
+        ONOS5_master_not_null = main.ONOScli5.roles_not_null()
+        ONOS6_master_not_null = main.ONOScli6.roles_not_null()
+        ONOS7_master_not_null = main.ONOScli7.roles_not_null()
+        roles_not_null = ONOS1_master_not_null and ONOS2_master_not_null and\
+                ONOS3_master_not_null and ONOS4_master_not_null and\
+                ONOS5_master_not_null and ONOS6_master_not_null and\
+                ONOS7_master_not_null
+        utilities.assert_equals(expect = main.TRUE,actual=roles_not_null,
+                onpass="Each device has a master",
+                onfail="Some devices don't have a master assigned")
+
+
+
+        main.step("Check if switch roles are consistent across all nodes")
+        ONOS1_mastership = main.ONOScli1.roles()
+        ONOS2_mastership = main.ONOScli2.roles()
+        ONOS3_mastership = main.ONOScli3.roles()
+        ONOS4_mastership = main.ONOScli4.roles()
+        ONOS5_mastership = main.ONOScli5.roles()
+        ONOS6_mastership = main.ONOScli6.roles()
+        ONOS7_mastership = main.ONOScli7.roles()
+        #print json.dumps(json.loads(ONOS1_mastership), sort_keys=True, indent=4, separators=(',', ': '))
+        if "Error" in ONOS1_mastership or not ONOS1_mastership\
+                or "Error" in ONOS2_mastership or not ONOS2_mastership\
+                or "Error" in ONOS3_mastership or not ONOS3_mastership\
+                or "Error" in ONOS4_mastership or not ONOS4_mastership\
+                or "Error" in ONOS5_mastership or not ONOS5_mastership\
+                or "Error" in ONOS6_mastership or not ONOS6_mastership\
+                or "Error" in ONOS7_mastership or not ONOS7_mastership:
+                    main.log.error("Error in getting ONOS mastership")
+                    main.log.warn("ONOS1 mastership response: " + repr(ONOS1_mastership))
+                    main.log.warn("ONOS2 mastership response: " + repr(ONOS2_mastership))
+                    main.log.warn("ONOS3 mastership response: " + repr(ONOS3_mastership))
+                    main.log.warn("ONOS4 mastership response: " + repr(ONOS4_mastership))
+                    main.log.warn("ONOS5 mastership response: " + repr(ONOS5_mastership))
+                    main.log.warn("ONOS6 mastership response: " + repr(ONOS6_mastership))
+                    main.log.warn("ONOS7 mastership response: " + repr(ONOS7_mastership))
+                    consistent_mastership = main.FALSE
+        elif ONOS1_mastership == ONOS2_mastership\
+                and ONOS1_mastership == ONOS3_mastership\
+                and ONOS1_mastership == ONOS4_mastership\
+                and ONOS1_mastership == ONOS5_mastership\
+                and ONOS1_mastership == ONOS6_mastership\
+                and ONOS1_mastership == ONOS7_mastership:
+                    consistent_mastership = main.TRUE
+                    main.log.report("Switch roles are consistent across all ONOS nodes")
+        else:
+            main.log.warn("ONOS1 roles: ", json.dumps(json.loads(ONOS1_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS2 roles: ", json.dumps(json.loads(ONOS2_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS3 roles: ", json.dumps(json.loads(ONOS3_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS4 roles: ", json.dumps(json.loads(ONOS4_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS5 roles: ", json.dumps(json.loads(ONOS5_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS6 roles: ", json.dumps(json.loads(ONOS6_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            main.log.warn("ONOS7 roles: ", json.dumps(json.loads(ONOS7_mastership),
+                sort_keys=True, indent=4, separators=(',', ': ')))
+            consistent_mastership = main.FALSE
+        utilities.assert_equals(expect = main.TRUE,actual=consistent_mastership,
+                onpass="Switch roles are consistent across all ONOS nodes",
+                onfail="ONOS nodes have different views of switch roles")
+
+
+        description2 = "Compare switch roles from before failure"
+        main.step(description2)
+
+        current_json = json.loads(ONOS1_mastership)
+        old_json = json.loads(mastership_state)
+        mastership_check = main.TRUE
+        for i in range(1,29):
+            switchDPID = str(main.Mininet1.getSwitchDPID(switch="s"+str(i)))
+
+            current = [switch['master'] for switch in current_json if switchDPID in switch['id']]
+            old = [switch['master'] for switch in old_json if switchDPID in switch['id']]
+            if current == old:
+                mastership_check = mastership_check and main.TRUE
+            else:
+                main.log.warn("Mastership of switch %s changed" % switchDPID)
+                mastership_check = main.FALSE
+        if mastership_check == main.TRUE:
+            main.log.report("Mastership of Switches was not changed")
+        utilities.assert_equals(expect=main.TRUE,actual=mastership_check,
+                onpass="Mastership of Switches was not changed",
+                onfail="Mastership of some switches changed")
+        mastership_check = mastership_check and consistent_mastership
+
+
+
+        main.step("Get the intents and compare across all nodes")
+        ONOS1_intents = main.ONOScli1.intents( json_format=True )
+        ONOS2_intents = main.ONOScli2.intents( json_format=True )
+        ONOS3_intents = main.ONOScli3.intents( json_format=True )
+        ONOS4_intents = main.ONOScli4.intents( json_format=True )
+        ONOS5_intents = main.ONOScli5.intents( json_format=True )
+        ONOS6_intents = main.ONOScli6.intents( json_format=True )
+        ONOS7_intents = main.ONOScli7.intents( json_format=True )
+        intent_check = main.FALSE
+        if "Error" in ONOS1_intents or not ONOS1_intents\
+                or "Error" in ONOS2_intents or not ONOS2_intents\
+                or "Error" in ONOS3_intents or not ONOS3_intents\
+                or "Error" in ONOS4_intents or not ONOS4_intents\
+                or "Error" in ONOS5_intents or not ONOS5_intents\
+                or "Error" in ONOS6_intents or not ONOS6_intents\
+                or "Error" in ONOS7_intents or not ONOS7_intents:
+                    main.log.report("Error in getting ONOS intents")
+                    main.log.warn("ONOS1 intents response: " + repr(ONOS1_intents))
+                    main.log.warn("ONOS2 intents response: " + repr(ONOS2_intents))
+                    main.log.warn("ONOS3 intents response: " + repr(ONOS3_intents))
+                    main.log.warn("ONOS4 intents response: " + repr(ONOS4_intents))
+                    main.log.warn("ONOS5 intents response: " + repr(ONOS5_intents))
+                    main.log.warn("ONOS6 intents response: " + repr(ONOS6_intents))
+                    main.log.warn("ONOS7 intents response: " + repr(ONOS7_intents))
+        elif ONOS1_intents == ONOS2_intents\
+                and ONOS1_intents == ONOS3_intents\
+                and ONOS1_intents == ONOS4_intents\
+                and ONOS1_intents == ONOS5_intents\
+                and ONOS1_intents == ONOS6_intents\
+                and ONOS1_intents == ONOS7_intents:
+                    intent_check = main.TRUE
+                    main.log.report("Intents are consistent across all ONOS nodes")
+        else:
+            main.log.warn("ONOS1 intents: ") 
+            print json.dumps(json.loads(ONOS1_intents),
+                sort_keys=True, indent=4, separators=(',', ': '))
+            main.log.warn("ONOS2 intents: ")
+            print json.dumps(json.loads(ONOS2_intents),
+                sort_keys=True, indent=4, separators=(',', ': '))
+            main.log.warn("ONOS3 intents: ")
+            print json.dumps(json.loads(ONOS3_intents),
+                sort_keys=True, indent=4, separators=(',', ': '))
+            main.log.warn("ONOS4 intents: ")
+            print json.dumps(json.loads(ONOS4_intents),
+                sort_keys=True, indent=4, separators=(',', ': '))
+            main.log.warn("ONOS5 intents: ")
+            print json.dumps(json.loads(ONOS5_intents),
+                sort_keys=True, indent=4, separators=(',', ': '))
+            main.log.warn("ONOS6 intents: ")
+            print json.dumps(json.loads(ONOS6_intents),
+                sort_keys=True, indent=4, separators=(',', ': '))
+            main.log.warn("ONOS7 intents: ")
+            print json.dumps(json.loads(ONOS7_intents),
+                sort_keys=True, indent=4, separators=(',', ': '))
+        utilities.assert_equals(expect = main.TRUE,actual=intent_check,
+                onpass="Intents are consistent across all ONOS nodes",
+                onfail="ONOS nodes have different views of intents")
+
+        #NOTE: Hazelcast has no durability, so intents are lost
+        main.step("Compare current intents with intents before the failure")
+        #NOTE: this requires case 5 to pass for intent_state to be set.
+        #      maybe we should stop the test if that fails?
+        if intent_state == ONOS1_intents:
+            same_intents = main.TRUE
+            main.log.report("Intents are consistent with before failure")
+        #TODO: possibly the states have changed? we may need to figure out what the aceptable states are
+        else:
+            same_intents = main.FALSE
+        utilities.assert_equals(expect = main.TRUE,actual=same_intents,
+                onpass="Intents are consistent with before failure",
+                onfail="The Intents changed during failure")
+        intent_check = intent_check and same_intents
+
+
+
+        main.step("Get the OF Table entries and compare to before component failure")
+        Flow_Tables = main.TRUE
+        flows2=[]
+        for i in range(28):
+            main.log.info("Checking flow table on s" + str(i+1))
+            tmp_flows = main.Mininet2.get_flowTable(1.3, "s"+str(i+1))
+            flows2.append(tmp_flows)
+            temp_result = main.Mininet2.flow_comp(flow1=flows[i],flow2=tmp_flows)
+            Flow_Tables = Flow_Tables and temp_result
+            if Flow_Tables == main.FALSE:
+                main.log.info("Differences in flow table for switch: "+str(i+1))
+        if Flow_Tables == main.TRUE:
+            main.log.report("No changes were found in the flow tables")
+        utilities.assert_equals(expect=main.TRUE,actual=Flow_Tables,
+                onpass="No changes were found in the flow tables",
+                onfail="Changes were found in the flow tables")
+
+        main.step("Check the continuous pings to ensure that no packets were dropped during component failure")
+        #FIXME: This check is always failing. Investigate cause
+        #NOTE:  this may be something to do with file permsissions
+        #       or slight change in format
+        main.Mininet2.pingKill(main.params['TESTONUSER'], main.params['TESTONIP'])
+        Loss_In_Pings = main.FALSE 
+        #NOTE: checkForLoss returns main.FALSE with 0% packet loss
+        for i in range(8,18):
+            main.log.info("Checking for a loss in pings along flow from s" + str(i))
+            Loss_In_Pings = main.Mininet2.checkForLoss("/tmp/ping.h"+str(i)) or Loss_In_Pings
+        if Loss_In_Pings == main.TRUE:
+            main.log.info("Loss in ping detected")
+        elif Loss_In_Pings == main.ERROR:
+            main.log.info("There are multiple mininet process running")
+        elif Loss_In_Pings == main.FALSE:
+            main.log.info("No Loss in the pings")
+            main.log.report("No loss of dataplane connectivity")
+        utilities.assert_equals(expect=main.FALSE,actual=Loss_In_Pings,
+                onpass="No Loss of connectivity",
+                onfail="Loss of dataplane connectivity detected")
+
+        #Test of LeadershipElection
+        #NOTE: this only works for the sanity test. In case of failures, leader will likely change
+        leader = ONOS1_ip
+        leader_result = main.TRUE
+        for controller in range(1,num_controllers+1):
+            node = getattr( main, ( 'ONOScli' + str( controller ) ) )#loop through ONOScli handlers
+            leaderN = node.election_test_leader()
+            #verify leader is ONOS1
+            if leaderN == leader:
+                #all is well
+                #NOTE: In failure scenario, this could be a new node, maybe check != ONOS1
+                pass
+            elif leaderN == main.FALSE:
+                #error in  response
+                main.log.report("Something is wrong with election_test_leader function, check the error logs")
+                leader_result = main.FALSE
+            elif leader != leaderN:
+                leader_result = main.FALSE
+                main.log.report("ONOS" + str(controller) + " sees "+str(leaderN) +
+                        " as the leader of the election app. Leader should be "+str(leader) )
+        if leader_result:
+            main.log.report("Leadership election tests passed(consistent view of leader across listeners and a new leader was re-elected if applicable)")
+        utilities.assert_equals(expect=main.TRUE, actual=leader_result,
+                onpass="Leadership election passed",
+                onfail="Something went wrong with Leadership election")
+
+
+        result = mastership_check and intent_check and Flow_Tables and (not Loss_In_Pings) and roles_not_null\
+                and leader_result
+        result = int(result)
+        if result == main.TRUE:
+            main.log.report("Constant State Tests Passed")
+        utilities.assert_equals(expect=main.TRUE,actual=result,
+                onpass="Constant State Tests Passed",
+                onfail="Constant state tests failed")
+
+    def CASE8 (self,main):
+        '''
+        Compare topo
+        '''
+        import sys
+        sys.path.append("/home/admin/sts") # Trying to remove some dependancies, #FIXME add this path to params
+        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
+        import json
+        import time
+
+        description ="Compare ONOS Topology view to Mininet topology"
+        main.case(description)
+        main.log.report(description)
+        main.step("Create TestONTopology object")
+        ctrls = []
+        count = 1
+        while True:
+            temp = ()
+            if ('ip' + str(count)) in main.params['CTRL']:
+                temp = temp + (getattr(main,('ONOS' + str(count))),)
+                temp = temp + ("ONOS"+str(count),)
+                temp = temp + (main.params['CTRL']['ip'+str(count)],)
+                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
+                ctrls.append(temp)
+                count = count + 1
+            else:
+                break
+        MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+
+        main.step("Comparing ONOS topology to MN")
+        devices_results = main.TRUE
+        ports_results = main.TRUE
+        links_results = main.TRUE
+        topo_result = main.FALSE
+        elapsed = 0
+        count = 0
+        main.step("Collecting topology information from ONOS")
+        start_time = time.time()
+        while topo_result == main.FALSE and elapsed < 60:
+            count = count + 1
+            if count > 1:
+                MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+            cli_start = time.time()
+            devices = []
+            devices.append( main.ONOScli1.devices() )
+            devices.append( main.ONOScli2.devices() )
+            devices.append( main.ONOScli3.devices() )
+            devices.append( main.ONOScli4.devices() )
+            devices.append( main.ONOScli5.devices() )
+            devices.append( main.ONOScli6.devices() )
+            devices.append( main.ONOScli7.devices() )
+            hosts = []
+            hosts.append( main.ONOScli1.hosts() )
+            hosts.append( main.ONOScli2.hosts() )
+            hosts.append( main.ONOScli3.hosts() )
+            hosts.append( main.ONOScli4.hosts() )
+            hosts.append( main.ONOScli5.hosts() )
+            hosts.append( main.ONOScli6.hosts() )
+            hosts.append( main.ONOScli7.hosts() )
+            ports = []
+            ports.append( main.ONOScli1.ports() )
+            ports.append( main.ONOScli2.ports() )
+            ports.append( main.ONOScli3.ports() )
+            ports.append( main.ONOScli4.ports() )
+            ports.append( main.ONOScli5.ports() )
+            ports.append( main.ONOScli6.ports() )
+            ports.append( main.ONOScli7.ports() )
+            links = []
+            links.append( main.ONOScli1.links() )
+            links.append( main.ONOScli2.links() )
+            links.append( main.ONOScli3.links() )
+            links.append( main.ONOScli4.links() )
+            links.append( main.ONOScli5.links() )
+            links.append( main.ONOScli6.links() )
+            links.append( main.ONOScli7.links() )
+            clusters = []
+            clusters.append( main.ONOScli1.clusters() )
+            clusters.append( main.ONOScli2.clusters() )
+            clusters.append( main.ONOScli3.clusters() )
+            clusters.append( main.ONOScli4.clusters() )
+            clusters.append( main.ONOScli5.clusters() )
+            clusters.append( main.ONOScli6.clusters() )
+            clusters.append( main.ONOScli7.clusters() )
+            paths = []
+            temp_topo = main.ONOSbench.get_topology( main.ONOScli1.topology() )
+            paths.append( temp_topo.get('paths', False) )
+            temp_topo = main.ONOSbench.get_topology( main.ONOScli2.topology() )
+            paths.append( temp_topo.get('paths', False) )
+            temp_topo = main.ONOSbench.get_topology( main.ONOScli3.topology() )
+            paths.append( temp_topo.get('paths', False) )
+            temp_topo = main.ONOSbench.get_topology( main.ONOScli4.topology() )
+            paths.append( temp_topo.get('paths', False) )
+            temp_topo = main.ONOSbench.get_topology( main.ONOScli5.topology() )
+            paths.append( temp_topo.get('paths', False) )
+            temp_topo = main.ONOSbench.get_topology( main.ONOScli6.topology() )
+            paths.append( temp_topo.get('paths', False) )
+            temp_topo = main.ONOSbench.get_topology( main.ONOScli7.topology() )
+            paths.append( temp_topo.get('paths', False) )
+
+
+            elapsed = time.time() - start_time
+            cli_time = time.time() - cli_start
+            print "CLI time: " + str(cli_time)
+
+            for controller in range(num_controllers):
+                if devices[controller] or not "Error" in devices[controller]:
+                    current_devices_result =  main.Mininet1.compare_switches(MNTopo, json.loads(devices[controller]))
+                else:
+                    current_devices_result = main.FALSE
+                utilities.assert_equals(expect=main.TRUE, actual=current_devices_result,
+                        onpass="ONOS"+str(int(controller+1))+" Switches view is correct",
+                        onfail="ONOS"+str(int(controller+1))+" Switches view is incorrect")
+
+                if ports[controller] or not "Error" in ports[controller]:
+                    current_ports_result =  main.Mininet1.compare_ports(MNTopo, json.loads(ports[controller]))
+                else:
+                    current_ports_result = main.FALSE
+                utilities.assert_equals(expect=main.TRUE, actual=current_ports_result,
+                        onpass="ONOS"+str(int(controller+1))+" ports view is correct",
+                        onfail="ONOS"+str(int(controller+1))+" ports view is incorrect")
+
+                if links[controller] or not "Error" in links[controller]:
+                    current_links_result =  main.Mininet1.compare_links(MNTopo, json.loads(links[controller]))
+                else:
+                    current_links_result = main.FALSE
+                utilities.assert_equals(expect=main.TRUE, actual=current_links_result,
+                        onpass="ONOS"+str(int(controller+1))+" links view is correct",
+                        onfail="ONOS"+str(int(controller+1))+" links view is incorrect")
+            devices_results = devices_results and current_devices_result
+            ports_results = ports_results and current_ports_result
+            links_results = links_results and current_links_result
+
+            #Compare json objects for hosts, dataplane clusters and paths
+
+            #hosts
+            consistent_hosts_result = main.TRUE
+            for controller in range( len( hosts ) ):
+                if not "Error" in hosts[controller]:
+                    if hosts[controller] == hosts[0]:
+                        continue
+                    else:#hosts not consistent
+                        main.log.report("hosts from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+                        main.log.warn( repr( hosts[controller] ) )
+                        consistent_hosts_result = main.FALSE
+
+                else:
+                    main.log.report("Error in getting ONOS hosts from ONOS" + str(controller + 1) )
+                    consistent_hosts_result = main.FALSE
+                    main.log.warn("ONOS" + str(controller + 1) + " hosts response: " + repr(hosts[controller]) )
+            utilities.assert_equals(expect = main.TRUE,actual=consistent_hosts_result,
+                    onpass="Hosts view is consistent across all ONOS nodes",
+                    onfail="ONOS nodes have different views of hosts")
+
+            #Strongly connected clusters of devices
+            consistent_clusters_result = main.TRUE
+            for controller in range( len( clusters ) ):
+                if not "Error" in clusters[controller]:
+                    if clusters[controller] == clusters[0]:
+                        continue
+                    else:#clusters not consistent
+                        main.log.report("clusters from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+                        consistent_clusters_result = main.FALSE
+
+                else:
+                    main.log.report("Error in getting dataplane clusters from ONOS" + str(controller + 1) )
+                    consistent_clusters_result = main.FALSE
+                    main.log.warn("ONOS" + str(controller + 1) + " clusters response: " + repr(clusters[controller]) )
+            utilities.assert_equals(expect = main.TRUE,actual=consistent_clusters_result,
+                    onpass="Clusters view is consistent across all ONOS nodes",
+                    onfail="ONOS nodes have different views of clusters")
+            num_clusters =  len(json.loads(clusters[0])) #there should always only be one cluster
+            utilities.assert_equals(expect = 1, actual = num_clusters,
+                    onpass="ONOS shows 1 SCC",
+                    onfail="ONOS shows "+str(num_clusters) +" SCCs")
+
+
+            #paths
+            consistent_paths_result = main.TRUE
+            for controller in range( len( paths ) ):
+                if not "Error" in paths[controller]:
+                    if paths[controller] == paths[0]:
+                        continue
+                    else:#paths not consistent
+                        main.log.report("paths from ONOS" + str(controller + 1) + " is inconsistent with ONOS1")
+                        consistent_paths_result = main.FALSE
+
+                else:
+                    main.log.report("Error in getting paths from ONOS" + str(controller + 1) )
+                    consistent_paths_result = main.FALSE
+                    main.log.warn("ONOS" + str(controller + 1) + " paths response: " + repr(paths[controller]) )
+            utilities.assert_equals(expect = main.TRUE,actual=consistent_paths_result,
+                    onpass="Paths count is consistent across all ONOS nodes",
+                    onfail="ONOS nodes have different counts of paths")
+
+
+            topo_result = devices_results and ports_results and links_results\
+                    and consistent_hosts_result and consistent_clusters_result and consistent_paths_result
+
+        topo_result = topo_result and int(count <= 2)
+        note = "note it takes about "+str( int(cli_time) )+" seconds for the test to make all the cli calls to fetch the topology from each ONOS instance"
+        main.log.report("Very crass estimate for topology discovery/convergence("+ str(note) + "): " +\
+                str(elapsed) + " seconds, " + str(count) +" tries" )
+        utilities.assert_equals(expect=main.TRUE, actual=topo_result,
+                onpass="Topology Check Test successful",
+                onfail="Topology Check Test NOT successful")
+        if topo_result == main.TRUE:
+            main.log.report("ONOS topology view matches Mininet topology")
+
+
+    def CASE9 (self,main):
+        '''
+        Link s3-s28 down
+        '''
+        #NOTE: You should probably run a topology check after this
+
+        link_sleep = float(main.params['timers']['LinkDiscovery'])
+
+        description = "Turn off a link to ensure that Link Discovery is working properly"
+        main.log.report(description)
+        main.case(description)
+
+
+        main.step("Kill Link between s3 and s28")
+        Link_Down = main.Mininet1.link(END1="s3",END2="s28",OPTION="down")
+        main.log.info("Waiting " + str(link_sleep) + " seconds for link down to be discovered")
+        time.sleep(link_sleep)
+        utilities.assert_equals(expect=main.TRUE,actual=Link_Down,
+                onpass="Link down succesful",
+                onfail="Failed to bring link down")
+        #TODO do some sort of check here
+
+    def CASE10 (self,main):
+        '''
+        Link s3-s28 up
+        '''
+        #NOTE: You should probably run a topology check after this
+
+        link_sleep = float(main.params['timers']['LinkDiscovery'])
+
+        description = "Restore a link to ensure that Link Discovery is working properly"
+        main.log.report(description)
+        main.case(description)
+
+        main.step("Bring link between s3 and s28 back up")
+        Link_Up = main.Mininet1.link(END1="s3",END2="s28",OPTION="up")
+        main.log.info("Waiting " + str(link_sleep) + " seconds for link up to be discovered")
+        time.sleep(link_sleep)
+        utilities.assert_equals(expect=main.TRUE,actual=Link_Up,
+                onpass="Link up succesful",
+                onfail="Failed to bring link up")
+        #TODO do some sort of check here
+
+
+    def CASE11 (self, main) :
+        '''
+        Switch Down
+        '''
+        #NOTE: You should probably run a topology check after this
+        import time
+
+        switch_sleep = float(main.params['timers']['SwitchDiscovery'])
+
+        description = "Killing a switch to ensure it is discovered correctly"
+        main.log.report(description)
+        main.case(description)
+
+        #TODO: Make this switch parameterizable
+        main.step("Kill s28 ")
+        main.log.report("Deleting s28")
+        main.Mininet1.del_switch("s28")
+        main.log.info("Waiting " + str(switch_sleep) + " seconds for switch down to be discovered")
+        time.sleep(switch_sleep)
+        device = main.ONOScli1.get_device(dpid="0028")
+        #Peek at the deleted switch
+        main.log.warn( str(device) )
+        result = main.FALSE
+        if device and device['available'] == False:
+            result = main.TRUE
+        utilities.assert_equals(expect=main.TRUE,actual=result,
+                onpass="Kill switch succesful",
+                onfail="Failed to kill switch?")
+
+    def CASE12 (self, main) :
+        '''
+        Switch Up
+        '''
+        #NOTE: You should probably run a topology check after this
+        import time
+
+        switch_sleep = float(main.params['timers']['SwitchDiscovery'])
+        description = "Adding a switch to ensure it is discovered correctly"
+        main.log.report(description)
+        main.case(description)
+
+        main.step("Add back s28")
+        main.log.report("Adding back s28")
+        main.Mininet1.add_switch("s28", dpid = '0000000000002800')
+        #TODO: New dpid or same? Ask Thomas?
+        main.Mininet1.add_link('s28', 's3')
+        main.Mininet1.add_link('s28', 's6')
+        main.Mininet1.add_link('s28', 'h28')
+        main.Mininet1.assign_sw_controller(sw="28",count=num_controllers,
+                ip1=ONOS1_ip,port1=ONOS1_port,
+                ip2=ONOS2_ip,port2=ONOS2_port,
+                ip3=ONOS3_ip,port3=ONOS3_port,
+                ip4=ONOS4_ip,port4=ONOS4_port,
+                ip5=ONOS5_ip,port5=ONOS5_port,
+                ip6=ONOS6_ip,port6=ONOS6_port,
+                ip7=ONOS7_ip,port7=ONOS7_port)
+        main.log.info("Waiting " + str(switch_sleep) + " seconds for switch up to be discovered")
+        time.sleep(switch_sleep)
+        device = main.ONOScli1.get_device(dpid="0028")
+        #Peek at the deleted switch
+        main.log.warn( str(device) )
+        result = main.FALSE
+        if device and device['available'] == True:
+            result = main.TRUE
+        utilities.assert_equals(expect=main.TRUE,actual=result,
+                onpass="add switch succesful",
+                onfail="Failed to add switch?")
+
+    def CASE13 (self, main) :
+        '''
+        Clean up
+        '''
+        import os
+        import time
+        #printing colors to terminal
+        colors = {}
+        colors['cyan']   = '\033[96m'
+        colors['purple'] = '\033[95m'
+        colors['blue']   = '\033[94m'
+        colors['green']  = '\033[92m'
+        colors['yellow'] = '\033[93m'
+        colors['red']    = '\033[91m'
+        colors['end']    = '\033[0m'
+        description = "Test Cleanup"
+        main.log.report(description)
+        main.case(description)
+        main.step("Killing tcpdumps")
+        main.Mininet2.stop_tcpdump()
+
+        main.step("Checking ONOS Logs for errors")
+        print colors['purple'] + "Checking logs for errors on ONOS1:" + colors['end']
+        print main.ONOSbench.check_logs(ONOS1_ip)
+        print colors['purple'] + "Checking logs for errors on ONOS2:" + colors['end']
+        print main.ONOSbench.check_logs(ONOS2_ip)
+        print colors['purple'] + "Checking logs for errors on ONOS3:" + colors['end']
+        print main.ONOSbench.check_logs(ONOS3_ip)
+        print colors['purple'] + "Checking logs for errors on ONOS4:" + colors['end']
+        print main.ONOSbench.check_logs(ONOS4_ip)
+        print colors['purple'] + "Checking logs for errors on ONOS5:" + colors['end']
+        print main.ONOSbench.check_logs(ONOS5_ip)
+        print colors['purple'] + "Checking logs for errors on ONOS6:" + colors['end']
+        print main.ONOSbench.check_logs(ONOS6_ip)
+        print colors['purple'] + "Checking logs for errors on ONOS7:" + colors['end']
+        print main.ONOSbench.check_logs(ONOS7_ip)
+
+        main.step("Copying MN pcap and ONOS log files to test station")
+        testname = main.TEST
+        teststation_user = main.params['TESTONUSER']
+        teststation_IP = main.params['TESTONIP']
+        #NOTE: MN Pcap file is being saved to ~/packet_captures
+        #       scp this file as MN and TestON aren't necessarily the same vm
+        #FIXME: scp
+        #####mn files
+        #TODO: Load these from params
+        #NOTE: must end in /
+        log_folder = "/opt/onos/log/"
+        log_files = ["karaf.log", "karaf.log.1"]
+        #NOTE: must end in /
+        dst_dir = "~/packet_captures/"
+        for f in log_files:
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS1_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS1-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS2_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS2-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS3_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS3-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS4_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS4-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS5_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS5-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS6_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS6-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS7_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS7-"+f )
+
+        #std*.log's
+        #NOTE: must end in /
+        log_folder = "/opt/onos/var/"
+        log_files = ["stderr.log", "stdout.log"]
+        #NOTE: must end in /
+        dst_dir = "~/packet_captures/"
+        for f in log_files:
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS1_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS1-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS2_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS2-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS3_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS3-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS4_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS4-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS5_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS5-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS6_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS6-"+f )
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS7_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS7-"+f )
+
+
+        #sleep so scp can finish
+        time.sleep(10)
+        main.step("Packing and rotating pcap archives")
+        os.system("~/TestON/dependencies/rotate.sh "+ str(testname))
+
+
+        #TODO: actually check something here
+        utilities.assert_equals(expect=main.TRUE, actual=main.TRUE,
+                onpass="Test cleanup successful",
+                onfail="Test cleanup NOT successful")
+
+    def CASE14 ( self, main ) :
+        '''
+        start election app on all onos nodes
+        '''
+        leader_result = main.TRUE
+        #install app on onos 1
+        main.log.info("Install leadership election app")
+        main.ONOScli1.feature_install("onos-app-election")
+        #wait for election
+        #check for leader
+        leader = main.ONOScli1.election_test_leader()
+        #verify leader is ONOS1
+        if leader == ONOS1_ip:
+            #all is well
+            pass
+        elif leader == None:
+            #No leader elected
+            main.log.report("No leader was elected")
+            leader_result = main.FALSE
+        elif leader == main.FALSE:
+            #error in  response
+            #TODO: add check for "Command not found:" in the driver, this means the app isn't loaded
+            main.log.report("Something is wrong with election_test_leader function, check the error logs")
+            leader_result = main.FALSE
+        else:
+            #error in  response
+            main.log.report("Unexpected response from election_test_leader function:'"+str(leader)+"'")
+            leader_result = main.FALSE
+
+
+
+
+        #install on other nodes and check for leader.
+        #Should be onos1 and each app should show the same leader
+        for controller in range(2,num_controllers+1):
+            node = getattr( main, ( 'ONOScli' + str( controller ) ) )#loop through ONOScli handlers
+            node.feature_install("onos-app-election")
+            leaderN = node.election_test_leader()
+            #verify leader is ONOS1
+            if leaderN == ONOS1_ip:
+                #all is well
+                pass
+            elif leaderN == main.FALSE:
+                #error in  response
+                #TODO: add check for "Command not found:" in the driver, this means the app isn't loaded
+                main.log.report("Something is wrong with election_test_leader function, check the error logs")
+                leader_result = main.FALSE
+            elif leader != leaderN:
+                leader_result = main.FALSE
+                main.log.report("ONOS" + str(controller) + " sees "+str(leaderN) +
+                        " as the leader of the election app. Leader should be "+str(leader) )
+        if leader_result:
+            main.log.report("Leadership election tests passed(consistent view of leader across listeners and a leader was elected)")
+        utilities.assert_equals(expect=main.TRUE, actual=leader_result,
+                onpass="Leadership election passed",
+                onfail="Something went wrong with Leadership election")
+
+    def CASE15 ( self, main ) :
+        '''
+        Check that Leadership Election is still functional
+        '''
+        leader_result = main.TRUE
+        description = "Check that Leadership Election is still functional"
+        main.log.report(description)
+        main.case(description)
+        main.step("Find current leader and withdraw")
+        leader = main.ONOScli1.election_test_leader()
+        #TODO: do some sanity checking on leader before using it
+        withdraw_result = main.FALSE
+        if leader == ONOS1_ip:
+            old_leader = getattr( main, "ONOScli1" )
+        elif leader == ONOS2_ip:
+            old_leader = getattr( main, "ONOScli2" )
+        elif leader == ONOS3_ip:
+            old_leader = getattr( main, "ONOScli3" )
+        elif leader == ONOS4_ip:
+            old_leader = getattr( main, "ONOScli4" )
+        elif leader == ONOS5_ip:
+            old_leader = getattr( main, "ONOScli5" )
+        elif leader == ONOS6_ip:
+            old_leader = getattr( main, "ONOScli6" )
+        elif leader == ONOS7_ip:
+            old_leader = getattr( main, "ONOScli7" )
+        elif leader == None or leader == main.FALSE:
+            main.log.report("Leader for the election app should be an ONOS node,"\
+                    +"instead got '"+str(leader)+"'")
+            leader_result = main.FALSE
+        withdraw_result = old_leader.election_test_withdraw()
+
+
+        main.step("Make sure new leader is elected")
+        leader_list = []
+        for controller in range(1,num_controllers+1):
+            node = getattr( main, ( 'ONOScli' + str( controller ) ) )#loop through ONOScli handlers
+            leader_list.append( node.election_test_leader() )
+        for leaderN in leader_list:
+            if leaderN == leader:
+                main.log.report("ONOS"+str(controller)+" still sees " + str(leader) +\
+                        " as leader after they withdrew")
+                leader_result = main.FALSE
+            elif leaderN == main.FALSE:
+                #error in  response
+                #TODO: add check for "Command not found:" in the driver, this means the app isn't loaded
+                main.log.report("Something is wrong with election_test_leader function, check the error logs")
+                leader_result = main.FALSE
+        consistent_leader = main.FALSE
+        if len( set( leader_list ) ) == 1:
+            main.log.info("Each Election-app sees '"+str(leader_list[0])+"' as the leader")
+            consistent_leader = main.TRUE
+        else:
+            main.log.report("Inconsistent responses for leader of Election-app:")
+            for n in range(len(leader_list)):
+                main.log.report("ONOS" + str(n+1) + " response: " + str(leader_list[n]) )
+        if leader_result:
+            main.log.report("Leadership election tests passed(consistent view of leader across listeners and a new leader was elected when the old leader resigned)")
+        utilities.assert_equals(expect=main.TRUE, actual=leader_result,
+                onpass="Leadership election passed",
+                onfail="Something went wrong with Leadership election")
+
+
+        main.step("Run for election on old leader(just so everyone is in the hat)")
+        run_result = old_leader.election_test_run()
+        if consistent_leader == main.TRUE:
+            after_run = main.ONOScli1.election_test_leader()
+            #verify leader didn't just change
+            if after_run == leader_list[0]:
+                leader_result = main.TRUE
+            else:
+                leader_result = main.FALSE
+        #TODO: assert on  run and withdraw results?
+
+        utilities.assert_equals(expect=main.TRUE, actual=leader_result,
+                onpass="Leadership election passed",
+                onfail="Something went wrong with Leadership election after the old leader re-ran for election")
+
diff --git a/TestON/tests/HATestSanity/HATestSanity.topo b/TestON/tests/HATestSanity/HATestSanity.topo
new file mode 100644
index 0000000..4d4156c
--- /dev/null
+++ b/TestON/tests/HATestSanity/HATestSanity.topo
@@ -0,0 +1,173 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOSbench>
+
+        <ONOScli1>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli1>
+
+        <ONOScli2>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli2>
+
+        <ONOScli3>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli3>
+
+
+        <ONOScli4>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli4>
+
+
+        <ONOScli5>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>6</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli5>
+
+
+        <ONOScli6>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>7</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli6>
+
+
+        <ONOScli7>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>8</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli7>
+
+        <ONOS1>
+            <host>10.128.30.11</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>9</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1>
+
+        <ONOS2>
+            <host>10.128.30.12</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>10</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS2>
+
+        <ONOS3>
+            <host>10.128.30.13</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>11</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS3>
+
+        <ONOS4>
+            <host>10.128.30.14</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>12</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS4>
+
+        <ONOS5>
+            <host>10.128.30.15</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>13</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS5>
+
+        <ONOS6>
+            <host>10.128.30.16</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>14</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS6>
+
+        <ONOS7>
+            <host>10.128.30.17</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>15</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS7>
+
+        <Mininet1>
+            <host>10.128.30.9</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>16</connect_order>
+            <COMPONENTS>
+                #Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+                <arg2> --topo mytopo </arg2>
+                <arg3> </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet1>
+
+        <Mininet2>
+            <host>10.128.30.9</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>RemoteMininetDriver</type>
+            <connect_order>17</connect_order>
+            <COMPONENTS>
+                # Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+                <arg2> --topo mytopo --arp</arg2>
+                <controller> remote </controller>
+             </COMPONENTS>
+        </Mininet2>
+
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/HPSwitchTest/__init__.py b/TestON/tests/HATestSanity/__init__.py
similarity index 100%
rename from TestON/tests/HPSwitchTest/__init__.py
rename to TestON/tests/HATestSanity/__init__.py
diff --git a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.params b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.params
new file mode 100644
index 0000000..95a75d7
--- /dev/null
+++ b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.params
@@ -0,0 +1,64 @@
+<PARAMS>
+    <testcases>1,2,8,3,4,5,14,[6],8,3,7,4,15,9,8,4,10,8,4,11,8,4,12,8,4,13</testcases>
+    <ENV>
+    <cellName>HA</cellName>
+    </ENV>
+    <Git>False</Git>
+    <num_controllers> 1 </num_controllers>
+
+    <CTRL>
+        <ip1>10.128.30.11</ip1>
+        <port1>6633</port1>
+
+        <ip2>10.128.30.12</ip2>
+        <port2>6633</port2>
+
+        <ip3>10.128.30.13</ip3>
+        <port3>6633</port3>
+
+        <ip4>10.128.30.14</ip4>
+        <port4>6633</port4>
+
+        <ip5>10.128.30.15</ip5>
+        <port5>6633</port5>
+
+        <ip6>10.128.30.16</ip6>
+        <port6>6633</port6>
+
+        <ip7>10.128.30.17</ip7>
+        <port7>6633</port7>
+    </CTRL>
+    <TESTONUSER>admin</TESTONUSER>
+    <TESTONIP>10.128.30.9</TESTONIP>
+    <PING>
+        <source1>h8</source1>
+        <source2>h9</source2>
+        <source3>h10</source3>
+        <source4>h11</source4>
+        <source5>h12</source5>
+        <source6>h13</source6>
+        <source7>h14</source7>
+        <source8>h15</source8>
+        <source9>h16</source9>
+        <source10>h17</source10>
+        <target1>10.0.0.18</target1>
+        <target2>10.0.0.19</target2>
+        <target3>10.0.0.20</target3>
+        <target4>10.0.0.21</target4>
+        <target5>10.0.0.22</target5>
+        <target6>10.0.0.23</target6>
+        <target7>10.0.0.24</target7>
+        <target8>10.0.0.25</target8>
+        <target9>10.0.0.26</target9>
+        <target10>10.0.0.27</target10>
+    </PING>
+    <timers>
+        <LinkDiscovery>.2</LinkDiscovery>
+        <SwitchDiscovery>.2</SwitchDiscovery>
+    </timers>
+    <MNtcpdump>
+        <intf>eth0</intf>
+        <port> </port>
+        <folder>~/packet_captures/</folder>
+    </MNtcpdump>
+</PARAMS>
diff --git a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py
new file mode 100644
index 0000000..51ac0f6
--- /dev/null
+++ b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.py
@@ -0,0 +1,970 @@
+'''
+Description: This test is to determine if a single
+    instance ONOS 'cluster' can handle a restart
+
+List of test cases:
+CASE1: Compile ONOS and push it to the test machines
+CASE2: Assign mastership to controllers
+CASE3: Assign intents
+CASE4: Ping across added host intents
+CASE5: Reading state of ONOS
+CASE6: The Failure case. Since this is the Sanity test, we do nothing.
+CASE7: Check state after control plane failure
+CASE8: Compare topo
+CASE9: Link s3-s28 down
+CASE10: Link s3-s28 up
+CASE11: Switch down
+CASE12: Switch up
+CASE13: Clean up
+CASE14: start election app on all onos nodes
+CASE15: Check that Leadership Election is still functional
+'''
+class HATestSingleInstanceRestart:
+
+    def __init__(self) :
+        self.default = ''
+
+    def CASE1(self,main) :
+        '''
+        CASE1 is to compile ONOS and push it to the test machines
+
+        Startup sequence:
+        git pull
+        mvn clean install
+        onos-package
+        cell <name>
+        onos-verify-cell
+        NOTE: temporary - onos-remove-raft-logs
+        onos-install -f
+        onos-wait-for-start
+        '''
+        import time
+        main.log.report("ONOS Single node cluster restart HA test - initialization")
+        main.case("Setting up test environment")
+
+        # load some vairables from the params file
+        PULL_CODE = False
+        if main.params['Git'] == 'True':
+            PULL_CODE = True
+        cell_name = main.params['ENV']['cellName']
+
+        #set global variables
+        global ONOS1_ip
+        global ONOS1_port
+        global ONOS2_ip
+        global ONOS2_port
+        global ONOS3_ip
+        global ONOS3_port
+        global ONOS4_ip
+        global ONOS4_port
+        global ONOS5_ip
+        global ONOS5_port
+        global ONOS6_ip
+        global ONOS6_port
+        global ONOS7_ip
+        global ONOS7_port
+        global num_controllers
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS1_port = main.params['CTRL']['port1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS2_port = main.params['CTRL']['port2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+        ONOS3_port = main.params['CTRL']['port3']
+        ONOS4_ip = main.params['CTRL']['ip4']
+        ONOS4_port = main.params['CTRL']['port4']
+        ONOS5_ip = main.params['CTRL']['ip5']
+        ONOS5_port = main.params['CTRL']['port5']
+        ONOS6_ip = main.params['CTRL']['ip6']
+        ONOS6_port = main.params['CTRL']['port6']
+        ONOS7_ip = main.params['CTRL']['ip7']
+        ONOS7_port = main.params['CTRL']['port7']
+        num_controllers = int(main.params['num_controllers'])
+
+
+        main.step("Applying cell variable to environment")
+        cell_result = main.ONOSbench.set_cell(cell_name)
+        verify_result = main.ONOSbench.verify_cell()
+
+        #FIXME:this is short term fix
+        main.log.report("Removing raft logs")
+        main.ONOSbench.onos_remove_raft_logs()
+        main.log.report("Uninstalling ONOS")
+        main.ONOSbench.onos_uninstall(ONOS1_ip)
+        main.ONOSbench.onos_uninstall(ONOS2_ip)
+        main.ONOSbench.onos_uninstall(ONOS3_ip)
+        main.ONOSbench.onos_uninstall(ONOS4_ip)
+        main.ONOSbench.onos_uninstall(ONOS5_ip)
+        main.ONOSbench.onos_uninstall(ONOS6_ip)
+        main.ONOSbench.onos_uninstall(ONOS7_ip)
+
+        clean_install_result = main.TRUE
+        git_pull_result = main.TRUE
+
+        main.step("Compiling the latest version of ONOS")
+        if PULL_CODE:
+            main.step("Git checkout and pull master")
+            main.ONOSbench.git_checkout("master")
+            git_pull_result = main.ONOSbench.git_pull()
+
+            main.step("Using mvn clean & install")
+            clean_install_result = main.TRUE
+            if git_pull_result == main.TRUE:
+                clean_install_result = main.ONOSbench.clean_install()
+            else:
+                main.log.warn("Did not pull new code so skipping mvn "+ \
+                        "clean install")
+        main.ONOSbench.get_version(report=True)
+
+        cell_result = main.ONOSbench.set_cell("SingleHA")
+        verify_result = main.ONOSbench.verify_cell()
+        main.step("Creating ONOS package")
+        package_result = main.ONOSbench.onos_package()
+
+        main.step("Installing ONOS package")
+        onos1_install_result = main.ONOSbench.onos_install(options="-f",
+                node=ONOS1_ip)
+
+
+        main.step("Checking if ONOS is up yet")
+        #TODO check bundle:list?
+        for i in range(2):
+            onos1_isup = main.ONOSbench.isup(ONOS1_ip)
+            if onos1_isup:
+                break
+        if not onos1_isup:
+            main.log.report("ONOS1 didn't start!")
+
+        # TODO: if it becomes an issue, we can retry this step  a few times
+
+
+        cli_result = main.ONOScli1.start_onos_cli(ONOS1_ip)
+
+        main.step("Start Packet Capture MN")
+        main.Mininet2.start_tcpdump(
+                str(main.params['MNtcpdump']['folder'])+str(main.TEST)+"-MN.pcap",
+                intf = main.params['MNtcpdump']['intf'],
+                port = main.params['MNtcpdump']['port'])
+
+
+        case1_result = (clean_install_result and package_result and
+                cell_result and verify_result and onos1_install_result and
+                onos1_isup and cli_result)
+
+        utilities.assert_equals(expect=main.TRUE, actual=case1_result,
+                onpass="Test startup successful",
+                onfail="Test startup NOT successful")
+
+
+        if case1_result==main.FALSE:
+            main.cleanup()
+            main.exit()
+
+    def CASE2(self,main) :
+        '''
+        Assign mastership to controllers
+        '''
+        import time
+        import json
+        import re
+
+        main.log.report("Assigning switches to controllers")
+        main.case("Assigning Controllers")
+        main.step("Assign switches to controllers")
+
+        for i in range (1,29):
+           main.Mininet1.assign_sw_controller(sw=str(i),
+                    ip1=ONOS1_ip,port1=ONOS1_port)
+
+        mastership_check = main.TRUE
+        for i in range (1,29):
+            response = main.Mininet1.get_sw_controller("s"+str(i))
+            try:
+                main.log.info(str(response))
+            except:
+                main.log.info(repr(response))
+            if re.search("tcp:"+ONOS1_ip,response):
+                mastership_check = mastership_check and main.TRUE
+            else:
+                mastership_check = main.FALSE
+        if mastership_check == main.TRUE:
+            main.log.report("Switch mastership assigned correctly")
+        utilities.assert_equals(expect = main.TRUE,actual=mastership_check,
+                onpass="Switch mastership assigned correctly",
+                onfail="Switches not assigned correctly to controllers")
+
+
+
+    def CASE3(self,main) :
+        """
+        Assign intents
+
+        """
+        #FIXME: we must reinstall intents until we have a persistant datastore!
+        import time
+        import json
+        import re
+        main.log.report("Adding host intents")
+        main.case("Adding host Intents")
+
+        main.step("Discovering  Hosts( Via pingall for now)")
+        #FIXME: Once we have a host discovery mechanism, use that instead
+
+        #install onos-app-fwd
+        main.log.info("Install reactive forwarding app")
+        main.ONOScli1.feature_install("onos-app-fwd")
+
+        #REACTIVE FWD test
+        ping_result = main.FALSE
+        time1 = time.time()
+        ping_result = main.Mininet1.pingall()
+        time2 = time.time()
+        main.log.info("Time for pingall: %2f seconds" % (time2 - time1))
+
+        #uninstall onos-app-fwd
+        main.log.info("Uninstall reactive forwarding app")
+        main.ONOScli1.feature_uninstall("onos-app-fwd")
+        #timeout for fwd flows
+        time.sleep(10)
+
+        main.step("Add  host intents")
+        #TODO:  move the host numbers to params
+        import json
+        intents_json= json.loads(main.ONOScli1.hosts())
+        intent_add_result = True
+        for i in range(8,18):
+            main.log.info("Adding host intent between h"+str(i)+" and h"+str(i+10))
+            host1 =  "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
+            host2 =  "00:00:00:00:00:" + str(hex(i+10)[2:]).zfill(2).upper()
+            host1_id = main.ONOScli1.get_host(host1)['id']
+            host2_id = main.ONOScli1.get_host(host2)['id']
+            #NOTE: get host can return None
+            if host1_id and host2_id:
+                tmp_result = main.ONOScli1.add_host_intent(host1_id, host2_id )
+            else:
+                main.log.error("Error, get_host() failed")
+                tmp_result = main.FALSE
+            intent_add_result = bool(intent_add_result and tmp_result)
+        utilities.assert_equals(expect=True, actual=intent_add_result,
+                onpass="Switch mastership correctly assigned",
+                onfail="Error in (re)assigning switch mastership")
+        #TODO Check if intents all exist in datastore
+        #NOTE: Do we need to print this once the test is working?
+        #main.log.info(json.dumps(json.loads(main.ONOScli1.intents(json_format=True)),
+        #    sort_keys=True, indent=4, separators=(',', ': ') ) )
+
+    def CASE4(self,main) :
+        """
+        Ping across added host intents
+        """
+        description = " Ping across added host intents"
+        main.log.report(description)
+        main.case(description)
+        Ping_Result = main.TRUE
+        for i in range(8,18):
+            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
+            Ping_Result = Ping_Result and ping
+            if ping==main.FALSE:
+                main.log.warn("Ping failed between h"+str(i)+" and h" + str(i+10))
+            elif ping==main.TRUE:
+                main.log.info("Ping test passed!")
+                Ping_Result = main.TRUE
+        if Ping_Result==main.FALSE:
+            main.log.report("Intents have not been installed correctly, pings failed.")
+        if Ping_Result==main.TRUE:
+            main.log.report("Intents have been installed correctly and verified by pings")
+        utilities.assert_equals(expect = main.TRUE,actual=Ping_Result,
+                onpass="Intents have been installed correctly and pings work",
+                onfail ="Intents have not been installed correctly, pings failed." )
+
+    def CASE5(self,main) :
+        '''
+        Reading state of ONOS
+        '''
+        import time
+        import json
+        from subprocess import Popen, PIPE
+        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
+
+        main.log.report("Setting up and gathering data for current state")
+        main.case("Setting up and gathering data for current state")
+        #The general idea for this test case is to pull the state of (intents,flows, topology,...) from each ONOS node
+        #We can then compare them with eachother and also with past states
+
+        main.step("Get the Mastership of each switch from each controller")
+        global mastership_state
+        mastership_state = []
+
+        #Assert that each device has a master
+        roles_not_null = main.ONOScli1.roles_not_null()
+        utilities.assert_equals(expect = main.TRUE,actual=roles_not_null,
+                onpass="Each device has a master",
+                onfail="Some devices don't have a master assigned")
+
+
+        ONOS1_mastership = main.ONOScli1.roles()
+        #print json.dumps(json.loads(ONOS1_mastership), sort_keys=True, indent=4, separators=(',', ': '))
+        #TODO: Make this a meaningful check
+        if "Error" in ONOS1_mastership or not ONOS1_mastership:
+            main.log.report("Error in getting ONOS roles")
+            main.log.warn("ONOS1 mastership response: " + repr(ONOS1_mastership))
+            consistent_mastership = main.FALSE
+        else:
+            mastership_state = ONOS1_mastership
+            consistent_mastership = main.TRUE
+
+
+        main.step("Get the intents from each controller")
+        global intent_state
+        intent_state = []
+        ONOS1_intents = main.ONOScli1.intents( json_format=True )
+        intent_check = main.FALSE
+        if "Error" in ONOS1_intents or not ONOS1_intents:
+            main.log.report("Error in getting ONOS intents")
+            main.log.warn("ONOS1 intents response: " + repr(ONOS1_intents))
+        else:
+            intent_check = main.TRUE
+
+
+        main.step("Get the flows from each controller")
+        global flow_state
+        flow_state = []
+        ONOS1_flows = main.ONOScli1.flows( json_format=True )
+        flow_check = main.FALSE
+        if "Error" in ONOS1_flows or not ONOS1_flows:
+            main.log.report("Error in getting ONOS intents")
+            main.log.warn("ONOS1 flows repsponse: "+ ONOS1_flows)
+        else:
+            #TODO: Do a better check, maybe compare flows on switches?
+            flow_state = ONOS1_flows
+            flow_check = main.TRUE
+
+
+        main.step("Get the OF Table entries")
+        global flows
+        flows=[]
+        for i in range(1,29):
+            flows.append(main.Mininet2.get_flowTable(1.3, "s"+str(i)))
+
+        #TODO: Compare switch flow tables with ONOS flow tables
+
+        main.step("Create TestONTopology object")
+        ctrls = []
+        count = 1
+        temp = ()
+        temp = temp + (getattr(main,('ONOS' + str(count))),)
+        temp = temp + ("ONOS"+str(count),)
+        temp = temp + (main.params['CTRL']['ip'+str(count)],)
+        temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
+        ctrls.append(temp)
+        MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+
+        main.step("Collecting topology information from ONOS")
+        devices = []
+        devices.append( main.ONOScli1.devices() )
+        '''
+        hosts = []
+        hosts.append( main.ONOScli1.hosts() )
+        '''
+        ports = []
+        ports.append( main.ONOScli1.ports() )
+        links = []
+        links.append( main.ONOScli1.links() )
+
+
+        main.step("Comparing ONOS topology to MN")
+        devices_results = main.TRUE
+        ports_results = main.TRUE
+        links_results = main.TRUE
+        for controller in range(num_controllers):
+            if devices[controller] or not "Error" in devices[controller]:
+                current_devices_result =  main.Mininet1.compare_switches(MNTopo, json.loads(devices[controller]))
+            else:
+                current_devices_result = main.FALSE
+            utilities.assert_equals(expect=main.TRUE, actual=current_devices_result,
+                    onpass="ONOS"+str(int(controller+1))+" Switches view is correct",
+                    onfail="ONOS"+str(int(controller+1))+" Switches view is incorrect")
+
+            if ports[controller] or not "Error" in ports[controller]:
+                current_ports_result =  main.Mininet1.compare_ports(MNTopo, json.loads(ports[controller]))
+            else:
+                current_ports_result = main.FALSE
+            utilities.assert_equals(expect=main.TRUE, actual=current_ports_result,
+                    onpass="ONOS"+str(int(controller+1))+" ports view is correct",
+                    onfail="ONOS"+str(int(controller+1))+" ports view is incorrect")
+
+            if links[controller] or not "Error" in links[controller]:
+                current_links_result =  main.Mininet1.compare_links(MNTopo, json.loads(links[controller]))
+            else:
+                current_links_result = main.FALSE
+            utilities.assert_equals(expect=main.TRUE, actual=current_links_result,
+                    onpass="ONOS"+str(int(controller+1))+" links view is correct",
+                    onfail="ONOS"+str(int(controller+1))+" links view is incorrect")
+
+            devices_results = devices_results and current_devices_result
+            ports_results = ports_results and current_ports_result
+            links_results = links_results and current_links_result
+
+        topo_result = devices_results and ports_results and links_results
+        utilities.assert_equals(expect=main.TRUE, actual=topo_result,
+                onpass="Topology Check Test successful",
+                onfail="Topology Check Test NOT successful")
+
+        final_assert = main.TRUE
+        final_assert = final_assert and topo_result and flow_check \
+                and intent_check and consistent_mastership and roles_not_null
+        utilities.assert_equals(expect=main.TRUE, actual=final_assert,
+                onpass="State check successful",
+                onfail="State check NOT successful")
+
+
+    def CASE6(self,main) :
+        '''
+        The Failure case.
+        '''
+        import time
+
+        main.log.report("Restart ONOS node")
+        main.log.case("Restart ONOS node")
+        main.ONOSbench.onos_kill(ONOS1_ip)
+        start = time.time()
+
+        main.step("Checking if ONOS is up yet")
+        count = 0
+        while count < 10:
+            onos1_isup = main.ONOSbench.isup(ONOS1_ip)
+            if onos1_isup == main.TRUE:
+                elapsed = time.time() - start
+                break
+            else:
+                count = count + 1
+
+        cli_result = main.ONOScli1.start_onos_cli(ONOS1_ip)
+
+        case_results = main.TRUE and onos1_isup and cli_result
+        utilities.assert_equals(expect=main.TRUE, actual=case_results,
+                onpass="ONOS restart successful",
+                onfail="ONOS restart NOT successful")
+        main.log.info("ESTIMATE: ONOS took %s seconds to restart" % str(elapsed) )
+        time.sleep(5)
+
+    def CASE7(self,main) :
+        '''
+        Check state after ONOS failure
+        '''
+        import os
+        import json
+        main.case("Running ONOS Constant State Tests")
+
+        #Assert that each device has a master
+        roles_not_null = main.ONOScli1.roles_not_null()
+        utilities.assert_equals(expect = main.TRUE,actual=roles_not_null,
+                onpass="Each device has a master",
+                onfail="Some devices don't have a master assigned")
+
+
+
+        main.step("Check if switch roles are consistent across all nodes")
+        ONOS1_mastership = main.ONOScli1.roles()
+        #FIXME: Refactor this whole case for single instance
+        #print json.dumps(json.loads(ONOS1_mastership), sort_keys=True, indent=4, separators=(',', ': '))
+        if "Error" in ONOS1_mastership or not ONOS1_mastership:
+            main.log.report("Error in getting ONOS mastership")
+            main.log.warn("ONOS1 mastership response: " + repr(ONOS1_mastership))
+            consistent_mastership = main.FALSE
+        else:
+            consistent_mastership = main.TRUE
+            main.log.report("Switch roles are consistent across all ONOS nodes")
+        utilities.assert_equals(expect = main.TRUE,actual=consistent_mastership,
+                onpass="Switch roles are consistent across all ONOS nodes",
+                onfail="ONOS nodes have different views of switch roles")
+
+
+        description2 = "Compare switch roles from before failure"
+        main.step(description2)
+
+        current_json = json.loads(ONOS1_mastership)
+        old_json = json.loads(mastership_state)
+        mastership_check = main.TRUE
+        for i in range(1,29):
+            switchDPID = str(main.Mininet1.getSwitchDPID(switch="s"+str(i)))
+
+            current = [switch['master'] for switch in current_json if switchDPID in switch['id']]
+            old = [switch['master'] for switch in old_json if switchDPID in switch['id']]
+            if current == old:
+                mastership_check = mastership_check and main.TRUE
+            else:
+                main.log.warn("Mastership of switch %s changed" % switchDPID)
+                mastership_check = main.FALSE
+        if mastership_check == main.TRUE:
+            main.log.report("Mastership of Switches was not changed")
+        utilities.assert_equals(expect=main.TRUE,actual=mastership_check,
+                onpass="Mastership of Switches was not changed",
+                onfail="Mastership of some switches changed")
+        mastership_check = mastership_check and consistent_mastership
+
+
+
+        main.step("Get the intents and compare across all nodes")
+        ONOS1_intents = main.ONOScli1.intents( json_format=True )
+        intent_check = main.FALSE
+        if "Error" in ONOS1_intents or not ONOS1_intents:
+            main.log.report("Error in getting ONOS intents")
+            main.log.warn("ONOS1 intents response: " + repr(ONOS1_intents))
+        else:
+            intent_check = main.TRUE
+            main.log.report("Intents are consistent across all ONOS nodes")
+        utilities.assert_equals(expect = main.TRUE,actual=intent_check,
+                onpass="Intents are consistent across all ONOS nodes",
+                onfail="ONOS nodes have different views of intents")
+
+        #NOTE: Hazelcast has no durability, so intents are lost
+        '''
+        main.step("Compare current intents with intents before the failure")
+        if intent_state == ONOS1_intents:
+            same_intents = main.TRUE
+            main.log.report("Intents are consistent with before failure")
+        #TODO: possibly the states have changed? we may need to figure out what the aceptable states are
+        else:
+            same_intents = main.FALSE
+        utilities.assert_equals(expect = main.TRUE,actual=same_intents,
+                onpass="Intents are consistent with before failure",
+                onfail="The Intents changed during failure")
+        intent_check = intent_check and same_intents
+        '''
+
+
+
+        main.step("Get the OF Table entries and compare to before component failure")
+        Flow_Tables = main.TRUE
+        flows2=[]
+        for i in range(28):
+            main.log.info("Checking flow table on s" + str(i+1))
+            tmp_flows = main.Mininet2.get_flowTable(1.3, "s"+str(i+1))
+            flows2.append(tmp_flows)
+            temp_result = main.Mininet2.flow_comp(flow1=flows[i],flow2=tmp_flows)
+            Flow_Tables = Flow_Tables and temp_result
+            if Flow_Tables == main.FALSE:
+                main.log.info("Differences in flow table for switch: "+str(i+1))
+        if Flow_Tables == main.TRUE:
+            main.log.report("No changes were found in the flow tables")
+        utilities.assert_equals(expect=main.TRUE,actual=Flow_Tables,
+                onpass="No changes were found in the flow tables",
+                onfail="Changes were found in the flow tables")
+
+
+        #Test of LeadershipElection
+
+        leader = ONOS1_ip
+        leader_result = main.TRUE
+        for controller in range(1,num_controllers+1):
+            node = getattr( main, ( 'ONOScli' + str( controller ) ) )#loop through ONOScli handlers
+            leaderN = node.election_test_leader()
+            #verify leader is ONOS1
+            #NOTE even though we restarted ONOS, it is the only one so onos 1 must be leader
+            if leaderN == leader:
+                #all is well
+                pass
+            elif leaderN == main.FALSE:
+                #error in  response
+                main.log.report("Something is wrong with election_test_leader function, check the error logs")
+                leader_result = main.FALSE
+            elif leader != leaderN:
+                leader_result = main.FALSE
+                main.log.report("ONOS" + str(controller) + " sees "+str(leaderN) +
+                        " as the leader of the election app. Leader should be "+str(leader) )
+        if leader_result:
+            main.log.report("Leadership election tests passed(consistent view of leader across listeners and a new leader was re-elected if applicable)")
+        utilities.assert_equals(expect=main.TRUE, actual=leader_result,
+                onpass="Leadership election passed",
+                onfail="Something went wrong with Leadership election")
+
+
+        result = mastership_check and intent_check and Flow_Tables and roles_not_null\
+                and leader_result
+        result = int(result)
+        if result == main.TRUE:
+            main.log.report("Constant State Tests Passed")
+        utilities.assert_equals(expect=main.TRUE,actual=result,
+                onpass="Constant State Tests Passed",
+                onfail="Constant state tests failed")
+
+    def CASE8 (self,main):
+        '''
+        Compare topo
+        '''
+        import sys
+        sys.path.append("/home/admin/sts") # Trying to remove some dependancies, #FIXME add this path to params
+        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
+        import json
+        import time
+
+        description ="Compare ONOS Topology view to Mininet topology"
+        main.case(description)
+        main.log.report(description)
+        main.step("Create TestONTopology object")
+        ctrls = []
+        count = 1
+        temp = ()
+        temp = temp + (getattr(main,('ONOS' + str(count))),)
+        temp = temp + ("ONOS"+str(count),)
+        temp = temp + (main.params['CTRL']['ip'+str(count)],)
+        temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
+        ctrls.append(temp)
+        MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+
+        main.step("Comparing ONOS topology to MN")
+        devices_results = main.TRUE
+        ports_results = main.TRUE
+        links_results = main.TRUE
+        topo_result = main.FALSE
+        elapsed = 0
+        count = 0
+        main.step("Collecting topology information from ONOS")
+        start_time = time.time()
+        while topo_result == main.FALSE and elapsed < 60:
+            count = count + 1
+            if count > 1:
+                MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+            cli_start = time.time()
+            devices = []
+            devices.append( main.ONOScli1.devices() )
+            '''
+            hosts = []
+            hosts.append( main.ONOScli1.hosts() )
+            '''
+            ports = []
+            ports.append( main.ONOScli1.ports() )
+            links = []
+            links.append( main.ONOScli1.links() )
+            elapsed = time.time() - start_time
+            print "CLI time: " + str(time.time() - cli_start)
+
+            for controller in range(num_controllers):
+                if devices[controller] or not "Error" in devices[controller]:
+                    current_devices_result =  main.Mininet1.compare_switches(MNTopo, json.loads(devices[controller]))
+                else:
+                    current_devices_result = main.FALSE
+                utilities.assert_equals(expect=main.TRUE, actual=current_devices_result,
+                        onpass="ONOS"+str(int(controller+1))+" Switches view is correct",
+                        onfail="ONOS"+str(int(controller+1))+" Switches view is incorrect")
+
+                if ports[controller] or not "Error" in ports[controller]:
+                    current_ports_result =  main.Mininet1.compare_ports(MNTopo, json.loads(ports[controller]))
+                else:
+                    current_ports_result = main.FALSE
+                utilities.assert_equals(expect=main.TRUE, actual=current_ports_result,
+                        onpass="ONOS"+str(int(controller+1))+" ports view is correct",
+                        onfail="ONOS"+str(int(controller+1))+" ports view is incorrect")
+
+                if links[controller] or not "Error" in links[controller]:
+                    current_links_result =  main.Mininet1.compare_links(MNTopo, json.loads(links[controller]))
+                else:
+                    current_links_result = main.FALSE
+                utilities.assert_equals(expect=main.TRUE, actual=current_links_result,
+                        onpass="ONOS"+str(int(controller+1))+" links view is correct",
+                        onfail="ONOS"+str(int(controller+1))+" links view is incorrect")
+            devices_results = devices_results and current_devices_result
+            ports_results = ports_results and current_ports_result
+            links_results = links_results and current_links_result
+            topo_result = devices_results and ports_results and links_results
+
+        topo_result = topo_result and int(count <= 2)
+        main.log.report("Very crass estimate for topology discovery/convergence(note it takes about 1 seconds to read the topology from each ONOS instance): " +\
+                str(elapsed) + " seconds, " + str(count) +" tries" )
+        if elapsed > 60:
+            main.log.report("Giving up on topology convergence")
+        utilities.assert_equals(expect=main.TRUE, actual=topo_result,
+                onpass="Topology Check Test successful",
+                onfail="Topology Check Test NOT successful")
+        if topo_result == main.TRUE:
+            main.log.report("ONOS topology view matches Mininet topology")
+
+
+    def CASE9 (self,main):
+        '''
+        Link s3-s28 down
+        '''
+        #NOTE: You should probably run a topology check after this
+
+        link_sleep = float(main.params['timers']['LinkDiscovery'])
+
+        description = "Turn off a link to ensure that Link Discovery is working properly"
+        main.log.report(description)
+        main.case(description)
+
+
+        main.step("Kill Link between s3 and s28")
+        Link_Down = main.Mininet1.link(END1="s3",END2="s28",OPTION="down")
+        main.log.info("Waiting " + str(link_sleep) + " seconds for link down to be discovered")
+        time.sleep(link_sleep)
+        utilities.assert_equals(expect=main.TRUE,actual=Link_Down,
+                onpass="Link down succesful",
+                onfail="Failed to bring link down")
+        #TODO do some sort of check here
+
+    def CASE10 (self,main):
+        '''
+        Link s3-s28 up
+        '''
+        #NOTE: You should probably run a topology check after this
+
+        link_sleep = float(main.params['timers']['LinkDiscovery'])
+
+        description = "Restore a link to ensure that Link Discovery is working properly"
+        main.log.report(description)
+        main.case(description)
+
+        main.step("Bring link between s3 and s28 back up")
+        Link_Up = main.Mininet1.link(END1="s3",END2="s28",OPTION="up")
+        main.log.info("Waiting " + str(link_sleep) + " seconds for link up to be discovered")
+        time.sleep(link_sleep)
+        utilities.assert_equals(expect=main.TRUE,actual=Link_Up,
+                onpass="Link up succesful",
+                onfail="Failed to bring link up")
+        #TODO do some sort of check here
+
+
+    def CASE11 (self, main) :
+        '''
+        Switch Down
+        '''
+        #NOTE: You should probably run a topology check after this
+        import time
+
+        switch_sleep = float(main.params['timers']['SwitchDiscovery'])
+
+        description = "Killing a switch to ensure it is discovered correctly"
+        main.log.report(description)
+        main.case(description)
+
+        #TODO: Make this switch parameterizable
+        main.step("Kill s28 ")
+        main.log.report("Deleting s28")
+        main.Mininet1.del_switch("s28")
+        main.log.info("Waiting " + str(switch_sleep) + " seconds for switch down to be discovered")
+        time.sleep(switch_sleep)
+        device = main.ONOScli1.get_device(dpid="0028")
+        #Peek at the deleted switch
+        main.log.warn( str(device) )
+        result = main.FALSE
+        if device and device['available'] == False:
+            result = main.TRUE
+        utilities.assert_equals(expect=main.TRUE,actual=result,
+                onpass="Kill switch succesful",
+                onfail="Failed to kill switch?")
+
+    def CASE12 (self, main) :
+        '''
+        Switch Up
+        '''
+        #NOTE: You should probably run a topology check after this
+        import time
+
+        switch_sleep = float(main.params['timers']['SwitchDiscovery'])
+        description = "Adding a switch to ensure it is discovered correctly"
+        main.log.report(description)
+        main.case(description)
+
+        main.step("Add back s28")
+        main.log.report("Adding back s28")
+        main.Mininet1.add_switch("s28", dpid = '0000000000002800')
+        #TODO: New dpid or same? Ask Thomas?
+        main.Mininet1.add_link('s28', 's3')
+        main.Mininet1.add_link('s28', 's6')
+        main.Mininet1.add_link('s28', 'h28')
+        main.Mininet1.assign_sw_controller(sw="28",
+                ip1=ONOS1_ip,port1=ONOS1_port)
+        main.log.info("Waiting " + str(switch_sleep) + " seconds for switch up to be discovered")
+        time.sleep(switch_sleep)
+        device = main.ONOScli1.get_device(dpid="0028")
+        #Peek at the deleted switch
+        main.log.warn( str(device) )
+        result = main.FALSE
+        if device and device['available'] == True:
+            result = main.TRUE
+        utilities.assert_equals(expect=main.TRUE,actual=result,
+                onpass="add switch succesful",
+                onfail="Failed to add switch?")
+
+    def CASE13 (self, main) :
+        '''
+        Clean up
+        '''
+        import os
+        import time
+        #printing colors to terminal
+        colors = {}
+        colors['cyan']   = '\033[96m'
+        colors['purple'] = '\033[95m'
+        colors['blue']   = '\033[94m'
+        colors['green']  = '\033[92m'
+        colors['yellow'] = '\033[93m'
+        colors['red']    = '\033[91m'
+        colors['end']    = '\033[0m'
+        description = "Test Cleanup"
+        main.log.report(description)
+        main.case(description)
+        main.step("Killing tcpdumps")
+        main.Mininet2.stop_tcpdump()
+
+        main.step("Checking ONOS Logs for errors")
+        print colors['purple'] + "Checking logs for errors on ONOS1:" + colors['end']
+        print main.ONOSbench.check_logs(ONOS1_ip)
+        main.step("Copying MN pcap and ONOS log files to test station")
+        testname = main.TEST
+        teststation_user = main.params['TESTONUSER']
+        teststation_IP = main.params['TESTONIP']
+        #NOTE: MN Pcap file is being saved to ~/packet_captures
+        #       scp this file as MN and TestON aren't necessarily the same vm
+        #FIXME: scp
+        #####mn files
+        #TODO: Load these from params
+        #NOTE: must end in /
+        log_folder = "/opt/onos/log/"
+        log_files = ["karaf.log", "karaf.log.1"]
+        #NOTE: must end in /
+        dst_dir = "~/packet_captures/"
+        for f in log_files:
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS1_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS1-"+f )
+            main.ONOSbench.handle.expect("\$")
+            print main.ONOSbench.handle.before
+
+        #std*.log's
+        #NOTE: must end in /
+        log_folder = "/opt/onos/var/"
+        log_files = ["stderr.log", "stdout.log"]
+        #NOTE: must end in /
+        dst_dir = "~/packet_captures/"
+        for f in log_files:
+            main.ONOSbench.handle.sendline( "scp sdn@"+ONOS1_ip+":"+log_folder+f+" "+
+                    teststation_user +"@"+teststation_IP+":"+\
+                    dst_dir + str(testname) + "-ONOS1-"+f )
+
+
+        #sleep so scp can finish
+        time.sleep(10)
+        main.step("Packing and rotating pcap archives")
+        os.system("~/TestON/dependencies/rotate.sh "+ str(testname))
+
+
+        #TODO: actually check something here
+        utilities.assert_equals(expect=main.TRUE, actual=main.TRUE,
+                onpass="Test cleanup successful",
+                onfail="Test cleanup NOT successful")
+
+    def CASE14 ( self, main ) :
+        '''
+        start election app on all onos nodes
+        '''
+        leader_result = main.TRUE
+        #install app on onos 1
+        main.log.info("Install leadership election app")
+        main.ONOScli1.feature_install("onos-app-election")
+        #wait for election
+        #check for leader
+        leader = main.ONOScli1.election_test_leader()
+        #verify leader is ONOS1
+        if leader == ONOS1_ip:
+            #all is well
+            pass
+        elif leader == None:
+            #No leader elected
+            main.log.report("No leader was elected")
+            leader_result = main.FALSE
+        elif leader == main.FALSE:
+            #error in  response
+            #TODO: add check for "Command not found:" in the driver, this means the app isn't loaded
+            main.log.report("Something is wrong with election_test_leader function, check the error logs")
+            leader_result = main.FALSE
+        else:
+            #error in  response
+            main.log.report("Unexpected response from election_test_leader function:'"+str(leader)+"'")
+            leader_result = main.FALSE
+
+
+
+
+        #install on other nodes and check for leader.
+        #Should be onos1 and each app should show the same leader
+        for controller in range(2,num_controllers+1):
+            node = getattr( main, ( 'ONOScli' + str( controller ) ) )#loop through ONOScli handlers
+            node.feature_install("onos-app-election")
+            leaderN = node.election_test_leader()
+            #verify leader is ONOS1
+            if leaderN == ONOS1_ip:
+                #all is well
+                pass
+            elif leaderN == main.FALSE:
+                #error in  response
+                #TODO: add check for "Command not found:" in the driver, this means the app isn't loaded
+                main.log.report("Something is wrong with election_test_leader function, check the error logs")
+                leader_result = main.FALSE
+            elif leader != leaderN:
+                leader_result = main.FALSE
+                main.log.report("ONOS" + str(controller) + " sees "+str(leaderN) +
+                        " as the leader of the election app. Leader should be "+str(leader) )
+        if leader_result:
+            main.log.report("Leadership election tests passed(consistent view of leader across listeners and a leader was elected)")
+        utilities.assert_equals(expect=main.TRUE, actual=leader_result,
+                onpass="Leadership election passed",
+                onfail="Something went wrong with Leadership election")
+
+    def CASE15 ( self, main ) :
+        '''
+        Check that Leadership Election is still functional
+        '''
+        leader_result = main.TRUE
+        description = "Check that Leadership Election is still functional"
+        main.log.report(description)
+        main.case(description)
+        main.step("Find current leader and withdraw")
+        leader = main.ONOScli1.election_test_leader()
+        #TODO: do some sanity checking on leader before using it
+        withdraw_result = main.FALSE
+        if leader == ONOS1_ip:
+            old_leader = getattr( main, "ONOScli1" )
+        elif leader == None or leader == main.FALSE:
+            main.log.report("Leader for the election app should be an ONOS node,"\
+                    +"instead got '"+str(leader)+"'")
+            leader_result = main.FALSE
+        withdraw_result = old_leader.election_test_withdraw()
+
+
+        main.step("Make sure new leader is elected")
+        leader_list = []
+        leaderN =  main.ONOScli1.election_test_leader() 
+        if leaderN == leader:
+            main.log.report("ONOS"+str(controller)+" still sees " + str(leader) +\
+                    " as leader after they withdrew")
+            leader_result = main.FALSE
+        elif leaderN == main.FALSE:
+            #error in  response
+            #TODO: add check for "Command not found:" in the driver, this means the app isn't loaded
+            main.log.report("Something is wrong with election_test_leader function, check the error logs")
+            leader_result = main.FALSE
+        elif leaderN == None:
+            main.log.info("There is no leader after the app withdrew from election")
+        if leader_result:
+            main.log.report("Leadership election tests passed(There is no leader after the old leader resigned)")
+        utilities.assert_equals(expect=main.TRUE, actual=leader_result,
+                onpass="Leadership election passed",
+                onfail="Something went wrong with Leadership election")
+
+
+        main.step("Run for election on old leader(just so everyone is in the hat)")
+        run_result = old_leader.election_test_run()
+        leader = main.ONOScli1.election_test_leader()
+        #verify leader is ONOS1
+        if leader == ONOS1_ip:
+            leader_result = main.TRUE
+        else:
+            leader_result = main.FALSE
+        #TODO: assert on  run and withdraw results?
+
+        utilities.assert_equals(expect=main.TRUE, actual=leader_result,
+                onpass="Leadership election passed",
+                onfail="ONOS1's election app was not leader after it re-ran for election")
+
diff --git a/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.topo b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.topo
new file mode 100644
index 0000000..4d4156c
--- /dev/null
+++ b/TestON/tests/HATestSingleInstanceRestart/HATestSingleInstanceRestart.topo
@@ -0,0 +1,173 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOSbench>
+
+        <ONOScli1>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli1>
+
+        <ONOScli2>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli2>
+
+        <ONOScli3>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli3>
+
+
+        <ONOScli4>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli4>
+
+
+        <ONOScli5>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>6</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli5>
+
+
+        <ONOScli6>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>7</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli6>
+
+
+        <ONOScli7>
+            <host>10.128.30.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>8</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli7>
+
+        <ONOS1>
+            <host>10.128.30.11</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>9</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1>
+
+        <ONOS2>
+            <host>10.128.30.12</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>10</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS2>
+
+        <ONOS3>
+            <host>10.128.30.13</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>11</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS3>
+
+        <ONOS4>
+            <host>10.128.30.14</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>12</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS4>
+
+        <ONOS5>
+            <host>10.128.30.15</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>13</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS5>
+
+        <ONOS6>
+            <host>10.128.30.16</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>14</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS6>
+
+        <ONOS7>
+            <host>10.128.30.17</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>15</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS7>
+
+        <Mininet1>
+            <host>10.128.30.9</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>16</connect_order>
+            <COMPONENTS>
+                #Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+                <arg2> --topo mytopo </arg2>
+                <arg3> </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet1>
+
+        <Mininet2>
+            <host>10.128.30.9</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>RemoteMininetDriver</type>
+            <connect_order>17</connect_order>
+            <COMPONENTS>
+                # Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+                <arg2> --topo mytopo --arp</arg2>
+                <controller> remote </controller>
+             </COMPONENTS>
+        </Mininet2>
+
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/HPSwitchTest/__init__.py b/TestON/tests/HATestSingleInstanceRestart/__init__.py
similarity index 100%
copy from TestON/tests/HPSwitchTest/__init__.py
copy to TestON/tests/HATestSingleInstanceRestart/__init__.py
diff --git a/TestON/tests/HPSwitchTest/HPSwitchTest.params b/TestON/tests/HPSwitchTest/HPSwitchTest.params
deleted file mode 100644
index 92a5b20..0000000
--- a/TestON/tests/HPSwitchTest/HPSwitchTest.params
+++ /dev/null
@@ -1,4 +0,0 @@
-<PARAMS>
-    <testcases> [1]</testcases>
-    <mail> anil4haart@gmail.com,paxweb@paxterrasolutions.com</mail>
-</PARAMS>
\ No newline at end of file
diff --git a/TestON/tests/HPSwitchTest/HPSwitchTest.py b/TestON/tests/HPSwitchTest/HPSwitchTest.py
deleted file mode 100644
index 9e2e4e7..0000000
--- a/TestON/tests/HPSwitchTest/HPSwitchTest.py
+++ /dev/null
@@ -1,23 +0,0 @@
-'''
-	
- *   TestON is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation, either version 2 of the License, or
- *   (at your option) any later version.
-
- *   TestON is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
-
-
-'''
-class HPSwitchTest :
-
-    def __init__(self) :
-        self.default = ''
-
-    def CASE1(self,main) :
-
-        main.case("HPSwitchTest Sample Test")
-        main.step("HPSwitchTest Sample Test")
diff --git a/TestON/tests/HPSwitchTest/HPSwitchTest.topo b/TestON/tests/HPSwitchTest/HPSwitchTest.topo
deleted file mode 100644
index c6ad886..0000000
--- a/TestON/tests/HPSwitchTest/HPSwitchTest.topo
+++ /dev/null
@@ -1,14 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <HPSwitch>
-            <host>24.6.49.222</host>
-            <user> Paxterra </user>
-            <port> 6500 </port>
-            <password></password>
-            <type>RemoteSysDriver</type>
-            <COMPONENTS>
-            </COMPONENTS>   
-        </HPSwitch>        
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/IntentPerfNext/IntentPerfNext.params b/TestON/tests/IntentPerfNext/IntentPerfNext.params
index 7e1de77..edba27b 100644
--- a/TestON/tests/IntentPerfNext/IntentPerfNext.params
+++ b/TestON/tests/IntentPerfNext/IntentPerfNext.params
@@ -1,5 +1,5 @@
 <PARAMS>
-    <testcases>1,2</testcases>
+    <testcases>1,5,7,2,3</testcases>
 
     <ENV>
         <cellName>intent_perf_test</cellName>
@@ -19,6 +19,10 @@
         <port2>6633</port2>
         <ip3>10.128.174.3</ip3>
         <port3>6633</port3>
+        <ip4>10.128.174.4</ip4>
+        <ip5>10.128.174.5</ip5>
+        <ip6>10.128.174.6</ip6>
+        <ip7>10.128.174.7</ip7>
     </CTRL>
 
     <MN>
@@ -32,7 +36,13 @@
 
     <TEST>
         #Number of times to iterate each case
-        <numIter>5</numIter>
+        <numIter>15</numIter>
+        <numIgnore>3</numIgnore>
+        <numSwitch>9</numSwitch>
+        <batchThresholdMin>0</batchThresholdMin>
+        <batchThresholdMax>1000</batchThresholdMax>
+        <batchIntentSize>200</batchIntentSize>
+        <numMult>1</numMult>
     </TEST>
 
     <JSON>
diff --git a/TestON/tests/IntentPerfNext/IntentPerfNext.py b/TestON/tests/IntentPerfNext/IntentPerfNext.py
index 2fb22dc..5c8bb2f 100644
--- a/TestON/tests/IntentPerfNext/IntentPerfNext.py
+++ b/TestON/tests/IntentPerfNext/IntentPerfNext.py
@@ -14,6 +14,8 @@
         '''
 
         import time
+        global cluster_count
+        cluster_count = 1 
 
         cell_name = main.params['ENV']['cellName']
 
@@ -23,7 +25,19 @@
         ONOS1_ip = main.params['CTRL']['ip1']
         ONOS2_ip = main.params['CTRL']['ip2']
         ONOS3_ip = main.params['CTRL']['ip3']
-        
+        ONOS4_ip = main.params['CTRL']['ip4']
+        ONOS5_ip = main.params['CTRL']['ip5']
+        ONOS6_ip = main.params['CTRL']['ip6']
+        ONOS7_ip = main.params['CTRL']['ip7']
+
+        main.ONOSbench.onos_uninstall(node_ip=ONOS1_ip)
+        main.ONOSbench.onos_uninstall(node_ip=ONOS2_ip)
+        main.ONOSbench.onos_uninstall(node_ip=ONOS3_ip)
+        main.ONOSbench.onos_uninstall(node_ip=ONOS4_ip)
+        main.ONOSbench.onos_uninstall(node_ip=ONOS5_ip)
+        main.ONOSbench.onos_uninstall(node_ip=ONOS6_ip)
+        main.ONOSbench.onos_uninstall(node_ip=ONOS7_ip)
+
         MN1_ip = main.params['MN']['ip1']
         BENCH_ip = main.params['BENCH']['ip']
     
@@ -31,13 +45,18 @@
 
         main.step("Creating cell file")
         cell_file_result = main.ONOSbench.create_cell_file(
-                BENCH_ip, cell_name, MN1_ip, "onos-core",
-                ONOS1_ip, ONOS2_ip, ONOS3_ip)
+                BENCH_ip, cell_name, MN1_ip,
+                "onos-core,onos-app-metrics,onos-gui",
+                #ONOS1_ip, ONOS2_ip, ONOS3_ip)
+                ONOS1_ip)
 
         main.step("Applying cell file to environment")
         cell_apply_result = main.ONOSbench.set_cell(cell_name)
         verify_cell_result = main.ONOSbench.verify_cell()
 
+        main.step("Removing raft logs")
+        main.ONOSbench.onos_remove_raft_logs()
+
         main.step("Git checkout and pull "+checkout_branch)
         if git_pull == 'on':
             checkout_result = \
@@ -53,37 +72,35 @@
             build_result = main.TRUE
             main.log.info("Git pull skipped by configuration")
 
+        main.log.report("Commit information - ")
+        main.ONOSbench.get_version(report=True)
+
         main.step("Creating ONOS package")
         package_result = main.ONOSbench.onos_package()
 
         main.step("Installing ONOS package")
         install1_result = main.ONOSbench.onos_install(node=ONOS1_ip)
-        install2_result = main.ONOSbench.onos_install(node=ONOS2_ip)
-        install3_result = main.ONOSbench.onos_install(node=ONOS3_ip)
+        #install2_result = main.ONOSbench.onos_install(node=ONOS2_ip)
+        #install3_result = main.ONOSbench.onos_install(node=ONOS3_ip)
 
         main.step("Set cell for ONOScli env")
         main.ONOS1cli.set_cell(cell_name)
-        main.ONOS2cli.set_cell(cell_name)
-        main.ONOS3cli.set_cell(cell_name)
+        #main.ONOS2cli.set_cell(cell_name)
+        #main.ONOS3cli.set_cell(cell_name)
 
         time.sleep(5)
 
         main.step("Start onos cli")
         cli1 = main.ONOS1cli.start_onos_cli(ONOS1_ip)
-        cli2 = main.ONOS2cli.start_onos_cli(ONOS2_ip)
-        cli3 = main.ONOS3cli.start_onos_cli(ONOS3_ip)
-
-        main.step("Enable metrics feature")
-        main.ONOS1cli.feature_install("onos-app-metrics")
-        main.ONOS2cli.feature_install("onos-app-metrics")
-        main.ONOS3cli.feature_install("onos-app-metrics")
+        #cli2 = main.ONOS2cli.start_onos_cli(ONOS2_ip)
+        #cli3 = main.ONOS3cli.start_onos_cli(ONOS3_ip)
 
         utilities.assert_equals(expect=main.TRUE,
                 actual = cell_file_result and cell_apply_result and\
                          verify_cell_result and checkout_result and\
                          pull_result and build_result and\
-                         install1_result and install2_result and\
-                         install3_result,
+                         install1_result, #and install2_result and\
+                         #install3_result,
                 onpass="ONOS started successfully",
                 onfail="Failed to start ONOS")
 
@@ -96,6 +113,7 @@
         import json
         import requests
         import os
+        import numpy
 
         ONOS1_ip = main.params['CTRL']['ip1']
         ONOS2_ip = main.params['CTRL']['ip2']
@@ -106,16 +124,34 @@
 
         #number of iterations of case
         num_iter = main.params['TEST']['numIter']
+        num_ignore = int(main.params['TEST']['numIgnore'])
 
         #Timestamp keys for json metrics output
         submit_time = main.params['JSON']['submittedTime']
         install_time = main.params['JSON']['installedTime']
         wdRequest_time = main.params['JSON']['wdRequestTime']
         withdrawn_time = main.params['JSON']['withdrawnTime']
+        
+        intent_add_lat_list = []
+
+        #Assign 'linear' switch format for basic intent testing
+        main.Mininet1.assign_sw_controller(
+                sw="1", ip1=ONOS1_ip,port1=default_sw_port)
+        main.Mininet1.assign_sw_controller(
+                sw="2", ip1=ONOS2_ip,port1=default_sw_port)
+        main.Mininet1.assign_sw_controller(
+                sw="3", ip1=ONOS2_ip,port1=default_sw_port)
+        main.Mininet1.assign_sw_controller(
+                sw="4", ip1=ONOS2_ip,port1=default_sw_port)
+        main.Mininet1.assign_sw_controller(
+                sw="5", ip1=ONOS3_ip,port1=default_sw_port)
+
+        time.sleep(10)
+
+        main.log.report("Single intent add latency test")
 
         devices_json_str = main.ONOS1cli.devices()
         devices_json_obj = json.loads(devices_json_str)
-
         device_id_list = []
 
         #Obtain device id list in ONOS format.
@@ -123,14 +159,11 @@
         for device in devices_json_obj:
             device_id_list.append(device['id'])
 
-        intent_add_lat_list = []
-
         for i in range(0, int(num_iter)):
-            #add_point_intent(ingr_device, ingr_port, 
-            #                 egr_device, egr_port)
+            #add_point_intent(ingr_device,  egr_device,
+            #                 ingr_port,    egr_port)
             main.ONOS1cli.add_point_intent(
-                device_id_list[0], 2,
-                device_id_list[2], 1)
+                device_id_list[0]+"/1", device_id_list[4]+"/1")
         
             #Allow some time for intents to propagate
             time.sleep(5)
@@ -172,10 +205,10 @@
                      intent_install_lat_3 ) / 3
 
             main.log.info("Intent add latency avg for iteration "+str(i)+
-                    ": "+str(intent_install_lat_avg))
+                    ": "+str(intent_install_lat_avg)+" ms")
 
             if intent_install_lat_avg > 0.0 and \
-               intent_install_lat_avg < 1000:
+               intent_install_lat_avg < 1000 and i > num_ignore:
                 intent_add_lat_list.append(intent_install_lat_avg)
             else:
                 main.log.info("Intent add latency exceeded "+
@@ -200,19 +233,614 @@
 
             time.sleep(5)
 
-        intent_add_lat_min = min(intent_add_lat_list)
-        intent_add_lat_max = max(intent_add_lat_list)
         intent_add_lat_avg = sum(intent_add_lat_list) /\
                              len(intent_add_lat_list)
+        intent_add_lat_std = \
+            round(numpy.std(intent_add_lat_list),1)
         #END ITERATION FOR LOOP
-        main.log.report("Single intent add latency - \n"+
-                "Min: "+str(intent_add_lat_min)+" ms\n"+
-                "Max: "+str(intent_add_lat_max)+" ms\n"+
-                "Avg: "+str(intent_add_lat_avg)+" ms\n")
-
+        main.log.report("Single intent add latency - ")
+        main.log.report("Avg: "+str(intent_add_lat_avg)+" ms")
+        main.log.report("Std Deviation: "+str(intent_add_lat_std)+" ms")
 
     def CASE3(self, main):
         '''
-        CASE3 coming soon
+        Intent Reroute latency
         '''
+        import time
+        import json
+        import requests
+        import os
+        import numpy
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+        ONOS_user = main.params['CTRL']['user']
+
+        default_sw_port = main.params['CTRL']['port1']
+
+        #number of iterations of case
+        num_iter = main.params['TEST']['numIter']
+        num_ignore = int(main.params['TEST']['numIgnore'])
+
+        #Timestamp keys for json metrics output
+        submit_time = main.params['JSON']['submittedTime']
+        install_time = main.params['JSON']['installedTime']
+        wdRequest_time = main.params['JSON']['wdRequestTime']
+        withdrawn_time = main.params['JSON']['withdrawnTime']
+
+        devices_json_str = main.ONOS1cli.devices()
+        devices_json_obj = json.loads(devices_json_str)
+
+        device_id_list = []
+
+        #Obtain device id list in ONOS format.
+        #They should already be in order (1,2,3,10,11,12,13, etc)
+        for device in devices_json_obj:
+            device_id_list.append(device['id'])
+
+        intent_reroute_lat_list = []
+
+        for i in range(0, int(num_iter)):
+            #add_point_intent(ingr_device, ingr_port, 
+            #                 egr_device, egr_port)
+            if len(device_id_list) > 0:
+                main.ONOS1cli.add_point_intent(
+                    device_id_list[0]+"/2", device_id_list[4]+"/1")
+            else:
+                main.log.info("Failed to fetch devices from ONOS")
+
+            time.sleep(5)
+
+            intents_str = main.ONOS1cli.intents(json_format=True)
+            intents_obj = json.loads(intents_str)
+            for intent in intents_obj:
+                if intent['state'] == "INSTALLED":
+                    main.log.info("Intent installed successfully")
+                    intent_id = intent['id']
+                else:
+                    #TODO: Add error handling
+                    main.log.info("Intent installation failed")
+                    intent_id = ""
+
+            #NOTE: this interface is specific to
+            #      topo-intentFlower.py topology
+            #      reroute case.
+            main.log.info("Disabling interface s2-eth3")
+            main.Mininet1.handle.sendline(
+                    "sh ifconfig s2-eth3 down")
+            t0_system = time.time()*1000
+                    
+            #TODO: Check for correct intent reroute
+            time.sleep(5)
+
+            #Obtain metrics from ONOS 1, 2, 3
+            intents_json_str_1 = main.ONOS1cli.intents_events_metrics()
+            intents_json_str_2 = main.ONOS2cli.intents_events_metrics()
+            intents_json_str_3 = main.ONOS3cli.intents_events_metrics()
+
+            intents_json_obj_1 = json.loads(intents_json_str_1)
+            intents_json_obj_2 = json.loads(intents_json_str_2)
+            intents_json_obj_3 = json.loads(intents_json_str_3)
+
+            #Parse values from the json object
+            intent_install_1 = \
+                    intents_json_obj_1[install_time]['value']
+            intent_install_2 = \
+                    intents_json_obj_2[install_time]['value']
+            intent_install_3 = \
+                    intents_json_obj_3[install_time]['value']
+
+            intent_reroute_lat_1 = \
+                    int(intent_install_1) - int(t0_system)
+            intent_reroute_lat_2 = \
+                    int(intent_install_2) - int(t0_system)
+            intent_reroute_lat_3 = \
+                    int(intent_install_3) - int(t0_system)
+            
+            intent_reroute_lat_avg = \
+                    (intent_reroute_lat_1 + 
+                     intent_reroute_lat_2 +
+                     intent_reroute_lat_3 ) / 3
+    
+            main.log.info("Intent reroute latency avg for iteration "+
+                    str(i)+": "+str(intent_reroute_lat_avg))
+
+            if intent_reroute_lat_avg > 0.0 and \
+               intent_reroute_lat_avg < 1000 and i > num_ignore:
+                intent_reroute_lat_list.append(intent_reroute_lat_avg)
+            else:
+                main.log.info("Intent reroute latency exceeded "+
+                        "threshold. Skipping iteration "+str(i))
+
+            main.log.info("Removing intents for next iteration")
+            main.ONOS1cli.remove_intent(intent_id)
+            
+            main.log.info("Bringing Mininet interface up for next "+
+                "iteration")
+            main.Mininet1.handle.sendline(
+                    "sh ifconfig s2-eth3 up")
+        
+        intent_reroute_lat_avg = sum(intent_reroute_lat_list) /\
+                             len(intent_reroute_lat_list)
+        intent_reroute_lat_std = \
+            round(numpy.std(intent_reroute_lat_list),1)
+        #END ITERATION FOR LOOP
+        main.log.report("Single intent reroute latency - ")
+        main.log.report("Avg: "+str(intent_reroute_lat_avg)+" ms")
+        main.log.report("Std Deviation: "+str(intent_reroute_lat_std)+" ms")
+        
+    def CASE7(self, main):
+        '''
+        Batch intent reroute latency
+        '''
+        import time
+        import json
+        import requests
+        import os
+        import numpy
+
+        ONOS_ip_list = []
+        for i in range(1, 8):
+            ONOS_ip_list.append(main.params['CTRL']['ip'+str(i)])
+
+        ONOS_user = main.params['CTRL']['user']
+        default_sw_port = main.params['CTRL']['port1']
+    
+        batch_intent_size = main.params['TEST']['batchIntentSize']
+        batch_thresh_min = int(main.params['TEST']['batchThresholdMin'])
+        batch_thresh_max = int(main.params['TEST']['batchThresholdMax'])
+        install_time = main.params['JSON']['installedTime']
+
+        #number of iterations of case
+        num_iter = main.params['TEST']['numIter']
+        num_ignore = int(main.params['TEST']['numIgnore'])
+        num_switch = int(main.params['TEST']['numSwitch'])
+        n_thread = main.params['TEST']['numMult']
+
+        main.log.report("Batch intent installation test of "+
+               batch_intent_size +" intents")
+
+        batch_result_list = []
+
+        #Assign 'linear' switch format for basic intent testing
+        main.Mininet1.assign_sw_controller(
+                sw="1", ip1=ONOS1_ip,port1=default_sw_port)
+        main.Mininet1.assign_sw_controller(
+                sw="2", ip1=ONOS2_ip,port1=default_sw_port)
+        main.Mininet1.assign_sw_controller(
+                sw="3", ip1=ONOS2_ip,port1=default_sw_port)
+        main.Mininet1.assign_sw_controller(
+                sw="4", ip1=ONOS2_ip,port1=default_sw_port)
+        main.Mininet1.assign_sw_controller(
+                sw="5", ip1=ONOS3_ip,port1=default_sw_port)
+
+        time.sleep(10)
+
+        main.log.info("Getting list of available devices")
+        device_id_list = []
+        json_str = main.ONOS1cli.devices()
+        json_obj = json.loads(json_str)
+        for device in json_obj:
+            device_id_list.append(device['id'])
+
+        batch_install_lat = []
+        batch_withdraw_lat = []
+        sleep_time = 10
+        
+        base_dir = "/tmp/"
+        max_install_lat = []
+
+        for i in range(0, int(num_iter)):
+            main.log.info("Pushing "+
+                    str(int(batch_intent_size)*int(n_thread))+
+                    " intents. Iteration "+str(i))
+            
+            main.ONOS1cli.push_test_intents(
+                "of:0000000000000001/1",
+                "of:0000000000000005/1",
+                1000, num_mult="1", app_id="1")
+               
+            #TODO: Check for installation success then proceed
+            time.sleep(30)
+            
+            #NOTE: this interface is specific to
+            #      topo-intentFlower.py topology
+            #      reroute case.
+            main.log.info("Disabling interface s2-eth3")
+            main.Mininet1.handle.sendline(
+                    "sh ifconfig s2-eth3 down")
+            t0_system = time.time()*1000
+
+            #TODO: Wait sufficient time for intents to install
+            time.sleep(10)
+
+            #TODO: get intent installation time
+            
+            #Obtain metrics from ONOS 1, 2, 3
+            intents_json_str_1 = main.ONOS1cli.intents_events_metrics()
+            intents_json_str_2 = main.ONOS2cli.intents_events_metrics()
+            intents_json_str_3 = main.ONOS3cli.intents_events_metrics()
+
+            intents_json_obj_1 = json.loads(intents_json_str_1)
+            intents_json_obj_2 = json.loads(intents_json_str_2)
+            intents_json_obj_3 = json.loads(intents_json_str_3)
+
+            #Parse values from the json object
+            intent_install_1 = \
+                    intents_json_obj_1[install_time]['value']
+            intent_install_2 = \
+                    intents_json_obj_2[install_time]['value']
+            intent_install_3 = \
+                    intents_json_obj_3[install_time]['value']
+
+            intent_reroute_lat_1 = \
+                    int(intent_install_1) - int(t0_system)
+            intent_reroute_lat_2 = \
+                    int(intent_install_2) - int(t0_system)
+            intent_reroute_lat_3 = \
+                    int(intent_install_3) - int(t0_system)
+            
+            intent_reroute_lat_avg = \
+                    (intent_reroute_lat_1 + 
+                     intent_reroute_lat_2 +
+                     intent_reroute_lat_3 ) / 3
+    
+            main.log.info("Intent reroute latency avg for iteration "+
+                    str(i)+": "+str(intent_reroute_lat_avg))
+            #TODO: Remove intents for next iteration
+            
+            time.sleep(5)
+
+            intents_str = main.ONOS1cli.intents()
+            intents_json = json.loads(intents_str)
+            for intents in intents_json:
+                intent_id = intents['id']
+                if intent_id:
+                    main.ONOS1cli.remove_intent(intent_id)
+
+            main.Mininet1.handle.sendline(
+                    "sh ifconfig s2-eth3 up")
+            
+            main.log.info("Intents removed and port back up")
+
+
+    def CASE4(self, main):
+        '''
+        Batch intent install
+        '''
+        
+        import time
+        import json
+        import requests
+        import os
+        import numpy
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+        ONOS4_ip = main.params['CTRL']['ip4']
+        ONOS5_ip = main.params['CTRL']['ip5']
+        ONOS6_ip = main.params['CTRL']['ip6']
+        ONOS7_ip = main.params['CTRL']['ip7']
+       
+        ONOS_ip_list = []
+        for i in range(1, 8):
+            ONOS_ip_list.append(main.params['CTRL']['ip'+str(i)])
+
+        ONOS_user = main.params['CTRL']['user']
+
+        default_sw_port = main.params['CTRL']['port1']
+    
+        batch_intent_size = main.params['TEST']['batchIntentSize']
+        batch_thresh_min = int(main.params['TEST']['batchThresholdMin'])
+        batch_thresh_max = int(main.params['TEST']['batchThresholdMax'])
+
+        #number of iterations of case
+        num_iter = main.params['TEST']['numIter']
+        num_ignore = int(main.params['TEST']['numIgnore'])
+        num_switch = int(main.params['TEST']['numSwitch'])
+        n_thread = main.params['TEST']['numMult']
+        #n_thread = 105
+
+        #*****
+        global cluster_count
+        #*****
+       
+        #Switch assignment NOTE: hardcoded 
+        if cluster_count == 1:
+            for i in range(1, num_switch+1):
+                main.Mininet1.assign_sw_controller(
+                    sw=str(i), 
+                    ip1=ONOS1_ip,
+                    port1=default_sw_port)
+        if cluster_count == 3:
+            for i in range(1, 3):
+                main.Mininet1.assign_sw_controller(
+                    sw=str(i),
+                    ip1=ONOS1_ip,
+                    port1=default_sw_port)
+            for i in range(3, 6):
+                main.Mininet1.assign_sw_controller(
+                    sw=str(i),
+                    ip1=ONOS2_ip,
+                    port1=default_sw_port)
+            for i in range(6, 9):
+                main.Mininet1.assign_sw_controller(
+                    sw=str(i),
+                    ip1=ONOS3_ip,
+                    port1=default_sw_port)
+        if cluster_count == 5:
+            main.Mininet1.assign_sw_controller(
+                    sw="1",
+                    ip1=ONOS1_ip,
+                    port1=default_sw_port)
+            main.Mininet1.assign_sw_controller(
+                    sw="2",
+                    ip1=ONOS2_ip,
+                    port1=default_sw_port)
+            for i in range(3, 6):
+                main.Mininet1.assign_sw_controller(
+                    sw=str(i),
+                    ip1=ONOS3_ip,
+                    port1=default_sw_port)
+            main.Mininet1.assign_sw_controller(
+                    sw="6",
+                    ip1=ONOS4_ip,
+                    port1=default_sw_port)
+            main.Mininet1.assign_sw_controller(
+                    sw="7",
+                    ip1=ONOS5_ip,
+                    port1=default_sw_port)
+            main.Mininet1.assign_sw_controller(
+                    sw="8",
+                    ip1=ONOS5_ip,
+                    port1=default_sw_port)
+        
+        if cluster_count == 7:
+            for i in range(1,9):
+                if i < 8:
+                    main.Mininet1.assign_sw_controller(
+                        sw=str(i),
+                        ip1=ONOS_ip_list[i-1],
+                        port1=default_sw_port)
+                elif i >= 8: 
+                    main.Mininet1.assign_sw_controller(
+                        sw=str(i),
+                        ip1=ONOS_ip_list[6],
+                        port1=default_sw_port)
+
+        time.sleep(30)
+
+        main.log.report("Batch intent installation test of "+
+               batch_intent_size +" intents")
+
+        batch_result_list = []
+
+        main.log.info("Getting list of available devices")
+        device_id_list = []
+        json_str = main.ONOS1cli.devices()
+        json_obj = json.loads(json_str)
+        for device in json_obj:
+            device_id_list.append(device['id'])
+
+        batch_install_lat = []
+        batch_withdraw_lat = []
+        sleep_time = 10
+        
+        base_dir = "/tmp/"
+        max_install_lat = []
+
+        for i in range(0, int(num_iter)):
+            main.log.info("Pushing "+
+                    str(int(batch_intent_size)*int(n_thread))+
+                    " intents. Iteration "+str(i))
+               
+            for node in range(1, cluster_count+1):
+                save_dir = base_dir + "batch_intent_"+str(node)+".txt" 
+                main.ONOSbench.push_test_intents_shell(
+                "of:0000000000000001/"+str(node),
+                "of:0000000000000008/"+str(node),
+                int(batch_intent_size),
+                save_dir, ONOS_ip_list[node-1],
+                num_mult=n_thread, app_id=node)
+         
+            #Wait sufficient time for intents to start
+            #installing
+           
+            time.sleep(sleep_time)
+            print sleep_time 
+
+            intent = ""
+            counter = 300
+            while len(intent) > 0 and counter > 0:
+                main.ONOS1cli.handle.sendline(
+                    "intents | wc -l")
+                main.ONOS1cli.handle.expect(
+                    "intents | wc -l")
+                main.ONOS1cli.handle.expect(
+                    "onos>")
+                intent_temp = main.ONOS1cli.handle.before()
+                print intent_temp
+
+                intent = main.ONOS1cli.intents()
+                intent = json.loads(intent)
+                counter = counter-1
+                time.sleep(1)
+
+            time.sleep(5)
+
+            for node in range(1, cluster_count+1):
+                save_dir = base_dir + "batch_intent_"+str(node)+".txt"
+                with open(save_dir) as f_onos:
+                    line_count = 0
+                    for line in f_onos:
+                        line = line[1:]
+                        line = line.split(": ")
+                        result = line[1].split(" ")[0]
+                        #TODO: add parameters before appending latency
+                        if line_count == 0:
+                            batch_install_lat.append(int(result))
+                        elif line_count == 1:
+                            batch_withdraw_lat.append(int(result))
+                        line_count += 1
+                main.log.info("Batch install latency for ONOS"+
+                    str(node)+" with "+\
+                    str(batch_intent_size) + "intents: "+\
+                    str(batch_install_lat))
+            
+            if len(batch_install_lat) > 0 and int(i) > num_ignore:
+                max_install_lat.append(max(batch_install_lat))
+            elif len(batch_install_lat) == 0:
+                #If I failed to read anything from the file,
+                #increase the wait time before checking intents
+                sleep_time += 30
+            batch_install_lat = []
+
+            #Sleep in between iterations
+            time.sleep(5)
+
+        main.log.report("Avg of batch installation latency "+
+            ": "+
+            str(sum(max_install_lat) / len(max_install_lat)))
+        main.log.report("Std Deviation of batch installation latency "+
+            ": "+
+            str(numpy.std(max_install_lat)))
+
+    def CASE5(self,main):
+        '''
+        Increase number of nodes and initiate CLI
+        '''
+        import time
+        import json
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+        ONOS4_ip = main.params['CTRL']['ip4']
+        ONOS5_ip = main.params['CTRL']['ip5']
+        ONOS6_ip = main.params['CTRL']['ip6']
+        ONOS7_ip = main.params['CTRL']['ip7']
+
+        global cluster_count
+        cluster_count += 2
+        main.log.report("Increasing cluster size to "+
+                str(cluster_count))
+
+        install_result = main.FALSE
+
+        if cluster_count == 3:
+            install_result1 = \
+                main.ONOSbench.onos_install(node=ONOS2_ip)
+            install_result2 = \
+                main.ONOSbench.onos_install(node=ONOS3_ip)
+            time.sleep(5)
+
+            main.log.info("Starting ONOS CLI")
+            main.ONOS2cli.start_onos_cli(ONOS2_ip)
+            main.ONOS3cli.start_onos_cli(ONOS3_ip)
+
+            install_result = install_result1 and install_result2
+
+        if cluster_count == 5:
+            main.log.info("Installing ONOS on node 4 and 5")
+            install_result1 = \
+                main.ONOSbench.onos_install(node=ONOS4_ip)
+            install_result2 = \
+                main.ONOSbench.onos_install(node=ONOS5_ip)
+
+            main.log.info("Starting ONOS CLI")
+            main.ONOS4cli.start_onos_cli(ONOS4_ip)
+            main.ONOS5cli.start_onos_cli(ONOS5_ip)
+
+            install_result = install_result1 and install_result2
+
+        if cluster_count == 7:
+            main.log.info("Installing ONOS on node 6 and 7")
+            install_result1 = \
+                main.ONOSbench.onos_install(node=ONOS6_ip)
+            install_result2 = \
+                main.ONOSbench.onos_install(node=ONOS7_ip)
+
+            main.log.info("Starting ONOS CLI")
+            main.ONOS6cli.start_onos_cli(ONOS6_ip)
+            main.ONOS7cli.start_onos_cli(ONOS7_ip)
+
+            install_result = install_result1 and install_result2
+
+        time.sleep(5)
+
+        if install_result == main.TRUE:
+            assertion = main.TRUE
+        else:
+            assertion = main.FALSE
+
+        utilities.assert_equals(expect=main.TRUE, actual=assertion,
+            onpass="Scale out to "+str(cluster_count)+\
+                   " nodes successful",
+            onfail="Scale out to "+str(cluster_count)+\
+                   " nodes failed")
+
+    def CASE9(self, main):
+        count = 0
+        sw_num1 = 1 
+        sw_num2 = 1
+        appid = 0
+        port_num1 = 1
+        port_num2 = 1
+       
+        time.sleep(30)
+
+        while True:
+            #main.ONOS1cli.push_test_intents(
+                    #"of:0000000000001001/1",
+                #"of:0000000000002001/1",
+                #    100, num_mult="10", app_id="1")
+            #main.ONOS2cli.push_test_intents(
+            #    "of:0000000000001002/1",
+            #    "of:0000000000002002/1",
+            #    100, num_mult="10", app_id="2")
+            #main.ONOS2cli.push_test_intents(
+            #    "of:0000000000001003/1",
+            #    "of:0000000000002003/1",
+            #    100, num_mult="10", app_id="3")
+            count += 1
+           
+            if count >= 100:
+                main.ONOSbench.handle.sendline(
+                    "onos 10.128.174.1 intents-events-metrics >>"+\
+                    " /tmp/metrics_intents_temp.txt &")
+                count = 0
+
+            arg1 = "of:000000000000100"+str(sw_num1)+"/"+str(port_num1)
+            arg2 = "of:000000000000200"+str(sw_num2)+"/"+str(port_num2)
+            
+            sw_num1 += 1
+
+            if sw_num1 > 7:
+                sw_num1 = 1
+                sw_num2 += 1
+                if sw_num2 > 7:
+                    appid += 1
+
+            if sw_num2 > 7:
+                sw_num2 = 1
+            
+            main.ONOSbench.push_test_intents_shell(
+                arg1,
+                arg2, 
+                100, "/tmp/temp.txt", "10.128.174.1",
+                num_mult="10", app_id=appid,report=False)
+            #main.ONOSbench.push_test_intents_shell(
+            #    "of:0000000000001002/1",
+            #    "of:0000000000002002/1",
+            #    133, "/tmp/temp2.txt", "10.128.174.2",
+            #    num_mult="6", app_id="2",report=False)
+            #main.ONOSbench.push_test_intents_shell(
+            #    "of:0000000000001003/1",
+            #    "of:0000000000002003/1",
+            #    133, "/tmp/temp3.txt", "10.128.174.3",
+            #    num_mult="6", app_id="3",report=False)
+   
+            time.sleep(0.2)
 
diff --git a/TestON/tests/IntentPerfNext/IntentPerfNext.topo b/TestON/tests/IntentPerfNext/IntentPerfNext.topo
index fbde0e1..048695d 100644
--- a/TestON/tests/IntentPerfNext/IntentPerfNext.topo
+++ b/TestON/tests/IntentPerfNext/IntentPerfNext.topo
@@ -36,6 +36,42 @@
             <connect_order>2</connect_order>
             <COMPONENTS> </COMPONENTS>
         </ONOS3cli>
+        
+        <ONOS4cli>
+            <host>10.128.174.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS4cli>
+        
+        <ONOS5cli>
+            <host>10.128.174.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS5cli>
+        
+        <ONOS6cli>
+            <host>10.128.174.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS6cli>
+        
+        <ONOS7cli>
+            <host>10.128.174.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS7cli>
 
         <ONOS1>
             <host>10.128.174.1</host>
@@ -54,9 +90,9 @@
             <connect_order>4</connect_order>
             <COMPONENTS>
                 <arg1> --custom topo-intentFlower.py </arg1>
-                <arg2> --arp --mac --topo mytopo</arg2>
+                <arg2> --arp --mac --topo mytopo </arg2>
                 <arg3> </arg3>
-                <controller> remote,ip=10.128.174.1 </controller>
+                <controller> remote </controller>
             </COMPONENTS>
         </Mininet1>
 
diff --git a/TestON/tests/JonTest/JonTest.params b/TestON/tests/JonTest/JonTest.params
deleted file mode 100755
index 4bb85e6..0000000
--- a/TestON/tests/JonTest/JonTest.params
+++ /dev/null
@@ -1,18 +0,0 @@
-<PARAMS>
-    
-    <testcases>1,4,3,7,8,9,7,8</testcases>
-    
-    <Git>True</Git>
-    #Environment variables
-    <ENV>
-        <cellName>multi</cellName>
-    </ENV>
-
-    <CTRL>
-        <ip1>10.128.30.11</ip1>
-        <port1>6633</port1>
-        <ip2>10.128.30.12</ip2>
-        <port2>6633</port2>
-    </CTRL>
-
-</PARAMS>
diff --git a/TestON/tests/JonTest/JonTest.py b/TestON/tests/JonTest/JonTest.py
deleted file mode 100755
index 8e53fd2..0000000
--- a/TestON/tests/JonTest/JonTest.py
+++ /dev/null
@@ -1,431 +0,0 @@
-
-#Testing the basic functionality of ONOS Next
-#For sanity and driver functionality excercises only.
-
-import time
-import sys
-import os
-import re
-
-class JonTest:
-    def __init__(self):
-        self.default = ''
-
-    def CASE1(self, main):
-        '''
-        Startup sequence:
-        git pull
-        mvn clean install
-        onos-package
-        cell <name>
-        onos-verify-cell
-        onos-install -f
-        onos-wait-for-start
-        '''
-        import time
-        
-        PULL_CODE = False
-        if main.params['Git'] == 'True':
-            PULL_CODE = True
-        cell_name = main.params['ENV']['cellName']
-        ONOS1_ip = main.params['CTRL']['ip1']
-        ONOS1_port = main.params['CTRL']['port1']
-        ONOS2_ip = main.params['CTRL']['ip2']
-        ONOS2_port = main.params['CTRL']['port2']
-        
-        main.case("Setting up test environment")
-        
-        main.step("Applying cell variable to environment")
-        cell_result = main.ONOSbench.set_cell(cell_name)
-        #cell_result = main.ONOSbench.set_cell("temp_cell_2")
-        verify_result = main.ONOSbench.verify_cell()
-
-        if PULL_CODE:
-            main.step("Git checkout and pull master")
-            #main.log.report("Skipping git pull")
-            main.ONOSbench.git_checkout("master")
-            git_pull_result = main.ONOSbench.git_pull()
-            main.log.report(main.ONOSbench.get_version())
-
-            main.step("Using mvn clean & install")
-            clean_install_result = main.FALSE
-            if git_pull_result == main.TRUE:
-                clean_install_result = main.ONOSbench.clean_install()
-            else:
-                main.log.report("did not pull new code so skipping mvn clean install")
-
-        main.step("Creating ONOS package")
-        package_result = main.ONOSbench.onos_package()
-
-        main.step("Installing ONOS package")
-        onos1_install_result = main.ONOSbench.onos_install(options="-f", node=ONOS1_ip)
-        onos2_install_result = main.ONOSbench.onos_install(options="-f", node=ONOS2_ip)
-        onos1_isup = main.ONOSbench.isup(ONOS1_ip)
-        onos2_isup = main.ONOSbench.isup(ONOS2_ip)
-   
-        main.step("Starting ONOS service")
-        start_result = main.TRUE
-        #start_result = main.ONOSbench.onos_start(ONOS1_ip)
-
-        main.ONOScli1.start_onos_cli(ONOS1_ip)
-        main.ONOScli2.start_onos_cli(ONOS2_ip)
-
-        case1_result = (clean_install_result and package_result and\
-                cell_result and verify_result and onos1_install_result and\
-                onos2_install_result and onos1_isup and onos2_isup )
-        utilities.assert_equals(expect=main.TRUE, actual=case1_result,
-                onpass="Test startup successful",
-                onfail="Test startup NOT successful")
-
-
-    def CASE11(self, main):
-        '''
-        Cleanup sequence:
-        onos-service <node_ip> stop
-        onos-uninstall
-
-        TODO: Define rest of cleanup
-        
-        '''
-
-        ONOS1_ip = main.params['CTRL']['ip1']
-
-        main.case("Cleaning up test environment")
-
-        main.step("Testing ONOS kill function")
-        kill_result = main.ONOSbench.onos_kill(ONOS1_ip)
-
-        main.step("Stopping ONOS service")
-        stop_result = main.ONOSbench.onos_stop(ONOS1_ip)
-
-        main.step("Uninstalling ONOS service") 
-        uninstall_result = main.ONOSbench.onos_uninstall()
-
-    def CASE3(self, main):
-        '''
-        Test 'onos' command and its functionality in driver
-        '''
-        
-        ONOS1_ip = main.params['CTRL']['ip1']
-
-        main.case("Testing 'onos' command")
-
-        main.step("Sending command 'onos -w <onos-ip> system:name'")
-        cmdstr1 = "system:name"
-        cmd_result1 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr1) 
-        main.log.info("onos command returned: "+cmd_result1)
-
-        main.step("Sending command 'onos -w <onos-ip> onos:topology'")
-        cmdstr2 = "onos:topology"
-        cmd_result2 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr2)
-        main.log.info("onos command returned: "+cmd_result2)
-        
-        main.step("Testing check_status")
-        check_status_results = main.FALSE
-        topology_result = main.ONOScli1.topology()
-        check_status_results =  main.ONOSbench.check_status(topology_result, 4, 6)
-        main.log.info("Results of check_status " + str(check_status_results))
-
-        main.step("Sending command 'onos -w <onos-ip> bundle:list'")
-        cmdstr3 = "bundle:list"
-        cmd_result3 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr3)
-        main.log.info("onos command returned: "+cmd_result3)
-        case3_result = (cmd_result1 and cmd_result2 and\
-                check_status_results and cmd_result3 )
-        utilities.assert_equals(expect=main.TRUE, actual=case3_result,
-                onpass="Test case 3 successful",
-                onfail="Test case 3 NOT successful")
-
-    def CASE4(self, main):
-        import re
-        import time
-        main.case("Pingall Test(No intents are added)")
-        main.step("Assigning switches to controllers")
-        for i in range(1,5): #1 to (num of switches +1)
-            main.Mininet1.assign_sw_controller(sw=str(i),count=2, 
-                    ip1=ONOS1_ip, port1=ONOS1_port,
-                    ip2=ONOS2_ip, port2=ONOS2_port)
-
-        switch_mastership = main.TRUE
-        for i in range (1,5):
-            response = main.Mininet1.get_sw_controller("s"+str(i))
-            print("Response is " + str(response))
-            if re.search("tcp:"+ONOS1_ip,response):
-                switch_mastership = switch_mastership and main.TRUE
-            else:
-                switch_mastership = main.FALSE
-
-
-        #REACTIVE FWD test
-        main.step("Pingall")
-        ping_result = main.FALSE
-        time1 = time.time()
-        ping_result = main.Mininet1.pingall()
-        time2 = time.time()
-        print "Time for pingall: %2f seconds" % (time2 - time1)
-      
-        case4_result = switch_mastership and ping_result
-        utilities.assert_equals(expect=main.TRUE, actual=case4_result,
-                onpass="Pingall Test successful",
-                onfail="Pingall Test NOT successful")
-
-    def CASE5(self, main):
-        '''
-        Test the ONOS-cli functionality
-        
-        Below are demonstrations of what the 
-        ONOS cli driver functions can be used for.
-        '''
-        import time
-        import json
-
-        cell_name = main.params['ENV']['cellName']
-        ONOS1_ip = main.params['CTRL']['ip1']
-        
-        main.case("Testing the ONOS-cli")
-        
-        main.step("Set cell for ONOS-cli environment")
-        main.ONOScli.set_cell(cell_name)
-
-        main.step("Start ONOS-cli")
-        main.ONOScli.start_onos_cli(ONOS1_ip)
-
-        main.step("issue command: onos:topology")
-        topology_obj = main.ONOScli.topology()
-
-        main.step("issue various feature:install <str> commands")
-        #main.ONOScli.feature_install("onos-app-fwd")
-        #main.ONOScli.feature_install("onos-rest")
-
-        main.step("Add a bad node")
-        node_result = main.ONOScli.add_node("111", "10.128.20.")
-        if node_result == main.TRUE:
-            main.log.info("Node successfully added")
-
-        main.step("Add a correct node")
-        node_result = main.ONOScli.add_node("111", "10.128.20.12")
-
-        main.step("Assign switches and list devices")
-        for i in range(1,8):
-            main.Mininet1.handle.sendline("sh ovs-vsctl set-controller s"+str(i)+
-                    " tcp:10.128.20.11")
-            main.Mininet1.handle.expect("mininet>")
-        #Need to sleep to allow switch add processing
-        time.sleep(5)
-        list_result = main.ONOScli.devices()
-        main.log.info(list_result)
-
-        main.step("Get all devices id")
-        devices_id_list = main.ONOScli.get_all_devices_id()
-        main.log.info(devices_id_list)
-
-        main.step("Get path and cost between device 1 and 7")
-        (path, cost) = main.ONOScli.paths(devices_id_list[0], devices_id_list[6])
-        main.log.info("Path: "+str(path))
-        main.log.info("Cost: "+str(cost))
-
-        main.step("Get nodes currently visible")
-        nodes_str = main.ONOScli.nodes()
-        main.log.info(nodes_str)
-
-        main.step("Get all nodes id's")
-        node_id_list = main.ONOScli.get_all_nodes_id()
-        main.log.info(node_id_list)
-
-        main.step("Set device "+str(devices_id_list[0])+" to role: standby")
-        device_role_result = main.ONOScli.device_role(
-                devices_id_list[0], node_id_list[0], "standby")
-        if device_role_result == main.TRUE:
-            main.log.report("Device role successfully set")
-
-        main.step("Revert device role to master")
-        device_role = main.ONOScli.device_role(
-                devices_id_list[0], node_id_list[0], "master")
-
-        main.step("Check devices / role again")
-        dev_result = main.ONOScli.devices()
-        main.log.info(dev_result)
-       
-        #Sample steps to push intents ***********
-        # * Obtain host id in ONOS format 
-        # * Push intents
-        main.step("Get list of hosts from Mininet")
-        host_list = main.Mininet2.get_hosts()
-        main.log.info(host_list)
-
-        main.step("Get host list in ONOS format")
-        host_onos_list = main.ONOScli.get_hosts_id(host_list)
-        main.log.info(host_onos_list)
-
-        main.step("Ensure that reactive forwarding is installed")
-        feature_result = main.ONOScli.feature_install("onos-app-fwd")
-
-        time.sleep(5)
-
-        main.Mininet2.handle.sendline("\r")
-        main.Mininet2.handle.sendline("h4 ping h5 -c 1")
-
-        time.sleep(5)
-
-        main.step("Get hosts")
-        main.ONOScli.handle.sendline("hosts")
-        main.ONOScli.handle.expect("onos>")
-        hosts = main.ONOScli.handle.before
-        main.log.info(hosts)
-
-        main.step("Install host-to-host-intents between h4 and h5")
-        intent_install = main.ONOScli.add_host_intent(
-                host_onos_list[3], host_onos_list[4])
-        main.log.info(intent_install)
-
-        main.step("Uninstall reactive forwarding to test host-to-host intent")
-        main.ONOScli.feature_uninstall("onos-app-fwd")
-
-        main.step("Get intents installed on ONOS")
-        get_intent_result = main.ONOScli.intents()
-        main.log.info(get_intent_result)
-        #****************************************
-
-
-    def CASE7(self, main):
-        '''
-        Test compare topo functions
-        '''
-        import sys
-        sys.path.append("/home/admin/sts") # Trying to remove some dependancies, #FIXME add this path to params
-        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
-        import json
-
-        main.step("Create TestONTopology object")
-        ctrls = []
-        count = 1
-        while True:
-            temp = ()
-            if ('ip' + str(count)) in main.params['CTRL']:
-                temp = temp + (getattr(main,('ONOS' + str(count))),)
-                temp = temp + ("ONOS"+str(count),)
-                temp = temp + (main.params['CTRL']['ip'+str(count)],)
-                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
-                ctrls.append(temp)
-                count = count + 1
-            else:
-                break
-        MNTopo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
-
-        ONOS1_ip = main.params['CTRL']['ip1']
-        ONOS2_ip = main.params['CTRL']['ip2']
-
-    
-        main.step("Collecting topology information from ONOS")
-        devices1 = main.ONOScli1.devices()
-        devices2 = main.ONOScli2.devices()
-        switch1 = main.ONOScli1.get_device("0000000000000001")
-        hosts1 = main.ONOScli1.hosts()
-        hosts2 = main.ONOScli2.hosts()
-        host1 = main.ONOScli1.get_host("00:00:00:00:00:01")
-        #print json.dumps(json.loads(hosts1), sort_keys=True,indent=4,separators=(',', ': '))
-        #print json.dumps(json.loads(hosts2), sort_keys=True,indent=4,separators=(',', ': '))
-        #print json.dumps(host1, sort_keys=True,indent=4,separators=(',', ': '))
-        ports1 = main.ONOScli1.ports()
-        ports2 = main.ONOScli2.ports()
-        links1 = main.ONOScli1.links()
-        links2 = main.ONOScli2.links()
-
-
-        main.step("Comparing ONOS topology to MN")
-        #results =  main.Mininet1.compare_topo(MNTopo, json.loads(devices))
-        switches_results1 =  main.Mininet1.compare_switches(MNTopo, json.loads(devices1))
-        utilities.assert_equals(expect=main.TRUE, actual=switches_results1,
-                onpass="ONOS1 Switches view is correct",
-                onfail="ONOS1 Switches view is incorrect")
-
-        switches_results2 =  main.Mininet1.compare_switches(MNTopo, json.loads(devices2))
-        utilities.assert_equals(expect=main.TRUE, actual=switches_results2,
-                onpass="ONOS2 Switches view is correct",
-                onfail="ONOS2 Switches view is incorrect")
-
-
-        ports_results1 =  main.Mininet1.compare_ports(MNTopo, json.loads(ports1))
-        utilities.assert_equals(expect=main.TRUE, actual=ports_results1,
-                onpass="ONOS1 Ports view is correct",
-                onfail="ONOS1 Ports view is incorrect")
-
-        ports_results2 =  main.Mininet1.compare_ports(MNTopo, json.loads(ports2))
-        utilities.assert_equals(expect=main.TRUE, actual=ports_results2,
-                onpass="ONOS2 Ports view is correct",
-                onfail="ONOS2 Ports view is incorrect")
-
-        links_results1 =  main.Mininet1.compare_links(MNTopo, json.loads(links1))
-        utilities.assert_equals(expect=main.TRUE, actual=links_results1,
-                onpass="ONOS1 Links view is correct",
-                onfail="ONOS1 Links view is incorrect")
-
-        links_results2 =  main.Mininet1.compare_links(MNTopo, json.loads(links2))
-        utilities.assert_equals(expect=main.TRUE, actual=links_results2,
-                onpass="ONOS2 Links view is correct",
-                onfail="ONOS2 Links view is incorrect")
-
-        topo_result = switches_results1 and switches_results2 \
-                and ports_results1 and ports_results2\
-                and links_results1 and links_results2
-        utilities.assert_equals(expect=main.TRUE, actual=topo_result,
-                onpass="Topology Check Test successful",
-                onfail="Topology Check Test NOT successful")
-
-    def CASE8(self, main):
-        '''
-        try doing some role assignments
-        '''
-        import time
-        print main.ONOScli1.devices()
-        print main.ONOScli1.device_role("of:0000000000000001", "    ", "none")
-        time.sleep(1)
-        roles = main.ONOScli1.roles()
-        roles2 = main.ONOScli2.roles()
-        print roles
-        print roles2
-        print main.ONOScli1.get_role("00001")
-
-        print main.ONOScli1.devices()
-        print main.ONOScli1.device_role("of:0000000000000001", "10.128.30.11", "master")
-        time.sleep(1)
-        roles = main.ONOScli1.roles()
-        roles2 = main.ONOScli2.roles()
-        print roles
-        print roles2
-        print main.ONOScli1.get_role("00001")
-
-        print main.ONOScli1.devices()
-        print main.ONOScli1.device_role("of:0000000000000001", "10.128.30.11", "standby")
-        time.sleep(1)
-        roles = main.ONOScli1.roles()
-        roles2 = main.ONOScli2.roles()
-        print roles
-        print roles2
-        print main.ONOScli1.get_role("00001")
-
-        print main.ONOScli1.devices()
-        print main.ONOScli1.device_role("of:0000000000000001", "10.128.30.11", "MASTER")
-        time.sleep(1)
-        roles = main.ONOScli1.roles()
-        roles2 = main.ONOScli2.roles()
-        print roles
-        print roles2
-        print main.ONOScli1.get_role("00001")
-        print main.ONOScli1.devices()
-
-    def CASE9(self, main):
-        '''
-        Bring Links down
-        '''
-        main.Mininet1.link(END1="s1", END2="s2", OPTION="down")
-        main.Mininet1.link(END1="s1", END2="s3", OPTION="down")
-        main.Mininet1.link(END1="s1", END2="s4", OPTION="down")
-
-
-
-
-######
-#jhall@onlab.us
-#andrew@onlab.us
-######
diff --git a/TestON/tests/MininetSlicing/MininetSlicing.ospk b/TestON/tests/MininetSlicing/MininetSlicing.ospk
deleted file mode 100644
index 8e2f32f..0000000
--- a/TestON/tests/MininetSlicing/MininetSlicing.ospk
+++ /dev/null
@@ -1,64 +0,0 @@
-CASE 1
-    NAME "Verifying 'SSH protocol' based slicing" 
-    
-    STEP "Deleting flowspace using 'removeFlowSpace'"
-    STORE ON FlowVisor1 DO removeFlowSpace USING "all" IN removeflowspace_result
-    ASSERT removeflowspace_result EQUALS main.TRUE ONPASS "Removed FlowSpace Successfully" ONFAIL "Failed to remove FlowSpace" 
-    
-    STEP "Showing connected devices using 'listDevices'"
-    STORE ON FlowVisor1 DO listDevices IN listdevices_result
-    ASSERT listdevices_result EQUALS main.TRUE ONPASS "Listed devices Successfully" ONFAIL "Failed to list the devices"
-
-    STEP "Verifying hosts reachability through ICMP traffic"
-    STORE ON Mininet1 DO pingHost USING src AS 'h1',target AS 'h4' IN ping_result
-    ASSERT ping_result EQUALS main.TRUE ONPASS "NO PACKET LOSS, HOST IS REACHABLE" ONFAIL "PACKET LOST, HOST IS NOT REACHABLE"  
-    
-    STEP "Showing the flowSpace USING 'listFlowSpace'"
-    STORE ON FlowVisor1 DO listFlowSpace IN listflowspace_result
-    STORE ON Mininet1 DO pingHost USING src AS 'h1',target AS 'h4' IN ping_result
-    ASSERT main.TRUE EQUALS main.TRUE ONPASS "Listed FlowSpace" ONFAIL "Failed to list the FlowSpace"
-   
-    STEP "Adding FlowSpace to create the slice of the Network"
-    INFO " Geeting the IP-Addresses of Hosts"
-    STORE ON Mininet1 DO getIPAddress USING 'h1' IN h1_ipaddress
-    STORE ON Mininet1 DO getIPAddress USING 'h4' IN h4_ipaddress 
-    
-    INFO " Geeting the MAC-Addresses of Hosts"  
-    STORE ON Mininet1 DO getMacAddress USING 'h1' IN h1_macaddress
-    STORE ON Mininet1 DO getMacAddress USING 'h4' IN h4_macaddress
-    
-    STORE ON FlowVisor1 DO addFlowSpace USING dl_src AS h1_macaddress,nw_dst AS h4_ipaddress IN addflowspace_result_1
-    ASSERT addflowspace_result_1 EQUALS main.TRUE ONPASS "Added FlowSpace Successfully" ONFAIL "Failed to add FlowSpace" 
-    
-    STORE ON FlowVisor1 DO addFlowSpace USING dl_src AS h4_macaddress,nw_dst AS h1_ipaddress IN addflowspace_result_2 
-    ASSERT addflowspace_result_2 EQUALS main.TRUE ONPASS "Added FlowSpace Successfully" ONFAIL "Failed to add FlowSpace" 
-    
-    STORE ON FlowVisor1 DO addFlowSpace USING nw_src AS h1_ipaddress IN addflowspace_result_3
-    STORE ON FlowVisor1 DO addFlowSpace USING nw_src AS h4_ipaddress IN addflowspace_result_3
-    
-    STORE ON FlowVisor1 DO addFlowSpace USING nw_src AS h1_ipaddress, tp_dst AS '22' IN addflowspace_result_3
-    ASSERT addflowspace_result_3 EQUALS main.TRUE ONPASS "Added FlowSpace Successfully" ONFAIL "Failed to add FlowSpace"
-    
-    STORE ON FlowVisor1 DO addFlowSpace USING nw_src AS h4_ipaddress,tp_dst AS '22' IN addflowspace_result_4
-    ASSERT addflowspace_result_4 EQUALS main.TRUE ONPASS "Added FlowSpace Successfully" ONFAIL "Failed to add FlowSpace" 
-    
-    STORE ON FlowVisor1 DO addFlowSpace USING nw_src AS h1_ipaddress,tp_src AS '22' IN addflowspace_result_5
-    ASSERT addflowspace_result_5 EQUALS main.TRUE ONPASS "Added FlowSpace Successfully" ONFAIL "Failed to add FlowSpace" 
-    
-    STORE ON FlowVisor1 DO addFlowSpace USING nw_src AS h4_ipaddress,tp_src AS '22' IN addflowspace_result_6
-    ASSERT addflowspace_result_6 EQUALS main.TRUE ONPASS "Added FlowSpace Successfully" ONFAIL "Failed to add FlowSpace"
-      
-    INFO "Showing the flowSpace USING 'listFlowSpace'"
-    STORE ON FlowVisor1 DO listFlowSpace IN listflowspace_result    
-
-    STEP "Verifying hosts reachability through ICMP traffic and Connectivity through SSH service"
-    STORE ON Mininet1 DO pingHost USING src AS 'h1',target AS 'h4' IN ping_result
-    ASSERT ping_result EQUALS main.TRUE ONPASS "NO PACKET LOSS, HOST IS REACHABLE" ONFAIL "PACKET LOST, HOST IS NOT REACHABLE"  
-
-    STORE ON Mininet1 DO verifySSH USING user_name AS CASE['destination_username'],ip_address AS CASE['destination_host'], pwd AS CASE['destination_password'], port AS CASE['destination_port'] IN ssh_result
-    ASSERT ssh_result EQUALS main.TRUE ONPASS "Failed to connect remote host throgh SSH" ONFAIL "Remote host connected throgh SSH "  
-     
-
-
-
-
diff --git a/TestON/tests/MininetSlicing/MininetSlicing.params b/TestON/tests/MininetSlicing/MininetSlicing.params
deleted file mode 100644
index c18e650..0000000
--- a/TestON/tests/MininetSlicing/MininetSlicing.params
+++ /dev/null
@@ -1,18 +0,0 @@
-<PARAMS>
-    <testcases> 1</testcases>
-    <mail> paxweb@paxterrasolutions.com</mail>
-    <CASE1>
-    
-        <dl_type> 0x800 </dl_type> 
-        <nw_proto> 6 </nw_proto>
-        <nw_src> 10.0.0.2 </nw_src>
-        <tp_dst> 22 </tp_dst>
-        <slice> SSH </slice> 
-        <permissions> 4 </permissions>
-        
-        <destination_host> 10.0.0.4 </destination_host>
-        <destination_username> openflow </destination_username>
-        <destination_password> openflow </destination_password>
-        <destination_port> 22 </destination_port>
-    </CASE1>
-</PARAMS>
\ No newline at end of file
diff --git a/TestON/tests/MininetSlicing/MininetSlicing.py b/TestON/tests/MininetSlicing/MininetSlicing.py
deleted file mode 100644
index 86b3ddc..0000000
--- a/TestON/tests/MininetSlicing/MininetSlicing.py
+++ /dev/null
@@ -1,71 +0,0 @@
-
-class MininetSlicing :
-
-    def __init__(self) :
-        self.default = ''
-
-    def CASE1(self,main) :
-
-        main.case("Verifying 'SSH protocol' based slicing")
-    
-        main.step("Deleting flowspace using 'removeFlowSpace'")
-        removeflowspace_result = main.FlowVisor1.removeFlowSpace("all")
-        utilities.assert_equals(expect=main.TRUE,actual=removeflowspace_result,onpass="Removed FlowSpace Successfully",onfail="Failed to remove FlowSpace")
-    
-        main.step("Showing connected devices using 'listDevices'")
-        listdevices_result = main.FlowVisor1.listDevices()
-        utilities.assert_equals(expect=main.TRUE,actual=listdevices_result,onpass="Listed devices Successfully",onfail="Failed to list the devices")
-    
-        main.step("Verifying hosts reachability through ICMP traffic")
-        ping_result = main.Mininet1.pingHost(src='h1',target='h4')
-        utilities.assert_equals(expect=main.TRUE,actual=ping_result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-    
-        main.step("Showing the flowSpace USING 'listFlowSpace'")
-        listflowspace_result = main.FlowVisor1.listFlowSpace()
-        ping_result = main.Mininet1.pingHost(src='h1',target='h4')
-    
-    
-        main.step("Adding FlowSpace to create the slice of the Network")
-        main.log.info(" Geeting the IP-Addresses of Hosts")
-        h1_ipaddress = main.Mininet1.getIPAddress('h1')
-        h4_ipaddress  = main.Mininet1.getIPAddress('h4')
-    
-        main.log.info(" Geeting the MAC-Addresses of Hosts"  )
-        h1_macaddress = main.Mininet1.getMacAddress('h1')
-        h4_macaddress = main.Mininet1.getMacAddress('h4')
-    
-        addflowspace_result_1 = main.FlowVisor1.addFlowSpace(dl_src=h1_macaddress,nw_dst=h4_ipaddress)
-        utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_1,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
-    
-        addflowspace_result_2  = main.FlowVisor1.addFlowSpace(dl_src=h4_macaddress,nw_dst=h1_ipaddress)
-        utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_2,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
-    
-        addflowspace_result_3 = main.FlowVisor1.addFlowSpace(nw_src=h1_ipaddress)
-        addflowspace_result_3 = main.FlowVisor1.addFlowSpace(nw_src=h4_ipaddress)
-    
-        addflowspace_result_3 = main.FlowVisor1.addFlowSpace(nw_src=h1_ipaddress, tp_dst='22')
-        utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_3,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
-    
-        addflowspace_result_4 = main.FlowVisor1.addFlowSpace(nw_src=h4_ipaddress,tp_dst='22')
-        utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_4,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
-    
-        addflowspace_result_5 = main.FlowVisor1.addFlowSpace(nw_src=h1_ipaddress,tp_src='22')
-        utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_5,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
-    
-        addflowspace_result_6 = main.FlowVisor1.addFlowSpace(nw_src=h4_ipaddress,tp_src='22')
-        utilities.assert_equals(expect=main.TRUE,actual=addflowspace_result_6,onpass="Added FlowSpace Successfully",onfail="Failed to add FlowSpace")
-    
-        main.log.info("Showing the flowSpace USING 'listFlowSpace'")
-        listflowspace_result     = main.FlowVisor1.listFlowSpace()
-    
-        main.step("Verifying hosts reachability through ICMP traffic and Connectivity through SSH service")
-        ping_result = main.Mininet1.pingHost(src='h1',target='h4')
-        utilities.assert_equals(expect=main.TRUE,actual=ping_result,onpass="NO PACKET LOSS, HOST IS REACHABLE",onfail="PACKET LOST, HOST IS NOT REACHABLE")
-    
-        ssh_result = main.Mininet1.verifySSH(user_name=main.params['CASE1']['destination_username'],ip_address=main.params['CASE1']['destination_host'], pwd=main.params['CASE1']['destination_password'], port=main.params['CASE1']['destination_port'])
-        utilities.assert_equals(expect=main.TRUE,actual=ssh_result,onpass="Failed to connect remote host throgh SSH",onfail="Remote host connected throgh SSH ")
-    
-    
-    
-    
-    
\ No newline at end of file
diff --git a/TestON/tests/MininetSlicing/MininetSlicing.topo b/TestON/tests/MininetSlicing/MininetSlicing.topo
deleted file mode 100644
index 7a181d7..0000000
--- a/TestON/tests/MininetSlicing/MininetSlicing.topo
+++ /dev/null
@@ -1,43 +0,0 @@
-<TOPOLOGY>
-    <COMPONENT>          
-        <FlowVisor1>
-            <host>192.168.56.101</host>
-            <user> openflow </user>
-            <fvadmin_pwd></fvadmin_pwd>
-            <password>openflow</password>
-            <type>FlowVisorDriver</type>
-            <COMPONENTS>
-            </COMPONENTS>
-               
-        </FlowVisor1>   
-        
-        <Mininet1>
-            <host>192.168.56.101</host>
-            <user> openflow</user>
-            <password> openflow</password>
-            <type>MininetCliDriver</type>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <topo> single</topo>
-                <topocount>3</topocount>
-                <switch> ovsk </switch>
-                <controller> remote </controller>
-             </COMPONENTS>   
-        </Mininet1>        
-        
-        <POX2>
-            <host> 192.168.56.102 </host>
-            <user>  openflow </user>
-            <password> openflow </password>
-            <type> PoxCliDriver </type>
-            <test_target> 1 </test_target>
-            <COMPONENTS>
-                <pox_lib_location> /home/openflow/pox/  </pox_lib_location>
-                <samples.of_tutorial></samples.of_tutorial>
-            </COMPONENTS>
-        </POX2>
-    
-               
-    </COMPONENT>
-    
-</TOPOLOGY>
\ No newline at end of file
diff --git a/TestON/tests/MininetSlicing/__init__.py b/TestON/tests/MininetSlicing/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/MininetSlicing/__init__.py
+++ /dev/null
diff --git a/TestON/tests/MininetTest/MininetTest.params b/TestON/tests/MininetTest/MininetTest.params
deleted file mode 100644
index 0f798b1..0000000
--- a/TestON/tests/MininetTest/MininetTest.params
+++ /dev/null
@@ -1,23 +0,0 @@
-<PARAMS>
-    <testcases>[1,2]</testcases>
-    <mail>anilkumar.s@paxterrasolutions.com,raghavkashyap@paxterrasolutions.com</mail>
-    <CASE1> 
-        <destination> h2</destination>
-        <STEP1>
-            <host> h2 </host>
-        </STEP1>
-    </CASE1>
-    <SET1>
-        <begin>
-            <one>s1</one>
-            <two>s1</two>
-            <three>s3</three> 
-        </begin>
-        <end>
-            <one>s2</one>
-            <two>s3</two>
-            <three>s4</three> 
-        </end>
-    </SET1>
-        
-</PARAMS>      
diff --git a/TestON/tests/MininetTest/MininetTest.py b/TestON/tests/MininetTest/MininetTest.py
deleted file mode 100644
index 72fab6e..0000000
--- a/TestON/tests/MininetTest/MininetTest.py
+++ /dev/null
@@ -1,24 +0,0 @@
-
-class MininetTest :
-
-    def __init__(self) :
-        self.default = ''
-
-    def CASE1(self,main) :
-
-        main.case("Testing the configuration of the host")
-        main.step("Host IP Checking using checkIP")
-        main.ONOS1.start()
-        result = main.Mininet1.checkIP(main.params['CASE1']['destination'])
-        main.step("Verifying the result")
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Host h2 IP address configured",onfail="Host h2 IP address didn't configured")
-    
-    def CASE2(self,main) :
-
-        main.case("Testing Reachabilty of all the hosts")
-        main.step("Checking Hosts reachability by using pingall")
-        result = main.Mininet1.pingall()
-        main.step("Verifying the result")
-        for source in  main.params['SET1']['begin']:
-            main.log.info(str(main.params['SET1']['begin'][source]))
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="All hosts are reacchable",onfail="Hosts are not reachable")
diff --git a/TestON/tests/MininetTest/MininetTest.topo b/TestON/tests/MininetTest/MininetTest.topo
deleted file mode 100644
index 21d54de..0000000
--- a/TestON/tests/MininetTest/MininetTest.topo
+++ /dev/null
@@ -1,81 +0,0 @@
-<TOPOLOGY>
-    <COMPONENT>
-        <Zookeeper1>
-            <host>10.128.100.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>ZookeeperCliDriver</type>
-            <connect_order>1</connect_order>
-        </Zookeeper1>
-
-        <Cassandra1>
-            <host>10.128.100.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>2</connect_order>
-        </Cassandra1>
-        <Cassandra2>
-            <host>10.128.100.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>3</connect_order>
-        </Cassandra2>
-        <Cassandra3>
-            <host>10.128.100.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>4</connect_order>
-        </Cassandra3>
-        <Cassandra4>
-            <host>10.128.100.6</host>
-            <user>admin</user>
-            <password></password>
-            <type>CassandraCliDriver</type>
-            <connect_order>5</connect_order>
-        </Cassandra4>
-
-        <ONOS1>
-            <host>10.128.100.1</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>6</connect_order>
-        </ONOS1>
-        <ONOS2>
-            <host>10.128.100.4</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>7</connect_order>
-        </ONOS2>
-        <ONOS3>
-            <host>10.128.100.5</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>8</connect_order>
-        </ONOS3>
-        <ONOS4>
-            <host>10.128.100.6</host>
-            <user>admin</user>
-            <password></password>
-            <type>OnosCliDriver</type>
-            <connect_order>9</connect_order>
-        </ONOS4>
-        <Mininet1>
-            <host>10.128.100.11</host>
-            <user>admin</user>
-            <password></password>
-            <type>MininetCliDriver</type>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <arg1> </arg1>
-                <arg2> </arg2>
-                <controller> none  </controller>
-             </COMPONENTS>
-        </Mininet1>
-   </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/MininetTest/__init__.py b/TestON/tests/MininetTest/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/MininetTest/__init__.py
+++ /dev/null
diff --git a/TestON/tests/MultiProd/MultiProd.params b/TestON/tests/MultiProd/MultiProd.params
new file mode 100755
index 0000000..8bf1600
--- /dev/null
+++ b/TestON/tests/MultiProd/MultiProd.params
@@ -0,0 +1,65 @@
+<PARAMS>
+    
+    <testcases>1,4,10,5,6,7,8,6,8,9,31,32,8,33</testcases>    
+
+    #Environment variables
+    <ENV>
+        <cellName>multi_test</cellName>
+    </ENV>
+
+    <CTRL>
+        <ip1>10.128.20.11</ip1>
+	    <ip2>10.128.20.12</ip2>
+	    <ip3>10.128.20.13</ip3>
+        <port1>6633</port1>
+        <port2>6633</port2>
+        <port3>6633</port3>
+    </CTRL>
+
+    <SDNIP>
+        <ethType>IPV4</ethType>
+        <tcpProto>6</tcpProto>
+        <icmpProto>1</icmpProto>
+        <srcPort>5001</srcPort>
+        <dstPort>5001</dstPort>
+    </SDNIP>
+
+    <MULTIPOINT_INTENT>
+        <device1>of:0000000000003008/1 </device1>
+        <device2>of:0000000000003009/1 </device2>
+        <device3>of:0000000000003010/1 </device3>
+        <mac1>00:00:00:00:00:0A </mac1>
+        <mac2>00:00:00:00:00:08 </mac2>
+        <ip1>10.0.3.0/24 </ip1>
+        <ip2>10.0.1.0/24 </ip2>
+    </MULTIPOINT_INTENT>
+
+    <PING>
+        <source1>h8</source1>
+        <source2>h9</source2>
+        <source3>h10</source3>
+        <source4>h11</source4>
+        <source5>h12</source5>
+        <source6>h13</source6>
+        <source7>h14</source7>
+        <source8>h15</source8>
+        <source9>h16</source9>
+        <source10>h17</source10>
+        <target1>10.0.0.18</target1>
+        <target2>10.0.0.19</target2>
+        <target3>10.0.0.20</target3>
+        <target4>10.0.0.21</target4>
+        <target5>10.0.0.22</target5>
+        <target6>10.0.0.23</target6>
+        <target7>10.0.0.24</target7>
+        <target8>10.0.0.25</target8>
+        <target9>10.0.0.26</target9>
+        <target10>10.0.0.27</target10>
+    </PING>
+
+    <timers>
+        <LinkDiscovery>5</LinkDiscovery>
+        <SwitchDiscovery>31</SwitchDiscovery>
+    </timers>
+
+</PARAMS>
diff --git a/TestON/tests/MultiProd/MultiProd.py b/TestON/tests/MultiProd/MultiProd.py
new file mode 100755
index 0000000..dda3ad4
--- /dev/null
+++ b/TestON/tests/MultiProd/MultiProd.py
@@ -0,0 +1,1163 @@
+
+#Testing the basic functionality of ONOS Next
+#For sanity and driver functionality excercises only.
+
+import time
+import sys
+import os
+import re
+import time
+import json
+
+time.sleep(1)
+class MultiProd:
+    def __init__(self):
+        self.default = ''
+
+    def CASE1(self, main):
+        '''
+        Startup sequence:
+        cell <name>
+        onos-verify-cell
+        onos-remove-raft-logs        
+        git pull
+        mvn clean install
+        onos-package
+        onos-install -f
+        onos-wait-for-start
+        '''
+        
+        cell_name = main.params['ENV']['cellName']
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+        ONOS1_port = main.params['CTRL']['port1']
+        ONOS2_port = main.params['CTRL']['port2']
+        ONOS3_port = main.params['CTRL']['port3']   
+       
+        main.case("Setting up test environment")
+        main.log.report("This testcase is testing setting up test environment") 
+        main.log.report("__________________________________")
+ 
+        main.step("Applying cell variable to environment")
+        cell_result1 = main.ONOSbench.set_cell(cell_name)
+        #cell_result2 = main.ONOScli1.set_cell(cell_name)
+        #cell_result3 = main.ONOScli2.set_cell(cell_name)
+        #cell_result4 = main.ONOScli3.set_cell(cell_name)
+        verify_result = main.ONOSbench.verify_cell() 
+        cell_result = cell_result1
+
+        main.step("Removing raft logs before a clen installation of ONOS")
+        remove_log_Result = main.ONOSbench.onos_remove_raft_logs()        
+
+        main.step("Git checkout and pull master and get version")
+        main.ONOSbench.git_checkout("master")
+        git_pull_result = main.ONOSbench.git_pull()
+        print "git_pull_result = ", git_pull_result
+        version_result = main.ONOSbench.get_version(report=True)
+
+        if git_pull_result == 1:
+            main.step("Using mvn clean & install")
+            clean_install_result = main.ONOSbench.clean_install()
+            #clean_install_result = main.TRUE 
+
+        main.step("Creating ONOS package")
+        package_result = main.ONOSbench.onos_package()
+
+        #main.step("Creating a cell")
+        #cell_create_result = main.ONOSbench.create_cell_file(**************)
+
+        main.step("Installing ONOS package")
+        onos1_install_result = main.ONOSbench.onos_install(options="-f", node=ONOS1_ip)
+        onos2_install_result = main.ONOSbench.onos_install(options="-f", node=ONOS2_ip)
+        onos3_install_result = main.ONOSbench.onos_install(options="-f", node=ONOS3_ip)
+        onos_install_result = onos1_install_result and onos2_install_result and onos3_install_result        
+        if onos_install_result == main.TRUE:
+            main.log.report("Installing ONOS package successful")
+        else:
+            main.log.report("Installing ONOS package failed")
+        	
+        onos1_isup = main.ONOSbench.isup(ONOS1_ip)
+        onos2_isup = main.ONOSbench.isup(ONOS2_ip)
+        onos3_isup = main.ONOSbench.isup(ONOS3_ip)
+        onos_isup = onos1_isup and onos2_isup and onos3_isup
+        if onos_isup == main.TRUE:
+            main.log.report("ONOS instances are up and ready")
+        else:
+            main.log.report("ONOS instances may not be up")          
+
+        main.step("Starting ONOS service")
+        start_result = main.TRUE
+        #start_result = main.ONOSbench.onos_start(ONOS1_ip)
+        startcli1 = main.ONOScli1.start_onos_cli(ONOS_ip = ONOS1_ip)
+        startcli2 = main.ONOScli2.start_onos_cli(ONOS_ip = ONOS2_ip)
+        startcli3 = main.ONOScli3.start_onos_cli(ONOS_ip = ONOS3_ip)
+        print startcli1
+        print startcli2
+        print startcli3
+            
+        case1_result = (package_result and\
+                cell_result and verify_result and onos_install_result and\
+                onos_isup and start_result )
+        utilities.assert_equals(expect=main.TRUE, actual=case1_result,
+                onpass="Test startup successful",
+                onfail="Test startup NOT successful")
+
+    def CASE11(self, main):
+        '''
+        Cleanup sequence:
+        onos-service <node_ip> stop
+        onos-uninstall
+
+        TODO: Define rest of cleanup
+        
+        '''
+
+      	ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+	
+        main.case("Cleaning up test environment")
+
+        main.step("Testing ONOS kill function")
+        kill_result1 = main.ONOSbench.onos_kill(ONOS1_ip)
+        kill_result2 = main.ONOSbench.onos_kill(ONOS2_ip)
+        kill_result3 = main.ONOSbench.onos_kill(ONOS3_ip)
+	
+        main.step("Stopping ONOS service")
+        stop_result1 = main.ONOSbench.onos_stop(ONOS1_ip)
+        stop_result2 = main.ONOSbench.onos_stop(ONOS2_ip)
+        stop_result3 = main.ONOSbench.onos_stop(ONOS3_ip)
+
+        main.step("Uninstalling ONOS service") 
+        uninstall_result = main.ONOSbench.onos_uninstall()
+
+    def CASE3(self, main):
+        '''
+        Test 'onos' command and its functionality in driver
+        '''
+       
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS3_ip = main.params['CTRL']['ip3']	
+
+        main.case("Testing 'onos' command")
+
+        main.step("Sending command 'onos -w <onos-ip> system:name'")
+        cmdstr1 = "system:name"
+        cmd_result1 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr1) 
+        main.log.info("onos command returned: "+cmd_result1)
+        cmd_result2 = main.ONOSbench.onos_cli(ONOS2_ip, cmdstr1)
+        main.log.info("onos command returned: "+cmd_result2)
+        cmd_result3 = main.ONOSbench.onos_cli(ONOS3_ip, cmdstr1)
+        main.log.info("onos command returned: "+cmd_result3)
+
+        main.step("Sending command 'onos -w <onos-ip> onos:topology'")
+        cmdstr2 = "onos:topology"
+        cmd_result4 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr2)
+        main.log.info("onos command returned: "+cmd_result4)
+        cmd_result5 = main.ONOSbench.onos_cli(ONOS2_ip, cmdstr2)
+        main.log.info("onos command returned: "+cmd_result5)
+        cmd_result6 = main.ONOSbench.onos_cli(ONOS6_ip, cmdstr2)
+        main.log.info("onos command returned: "+cmd_result6)
+
+
+    def CASE4(self, main):
+        import re
+        import time
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+        ONOS1_port = main.params['CTRL']['port1']
+        ONOS2_port = main.params['CTRL']['port2']
+        ONOS3_port = main.params['CTRL']['port3']
+        
+        main.log.report("This testcase is testing the assignment of all the switches to all controllers and discovering the hosts in reactive mode")
+        main.log.report("__________________________________")        
+        main.case("Pingall Test(No intents are added)")
+        main.step("Assigning switches to controllers")
+        for i in range(1,29): #1 to (num of switches +1)
+            main.Mininet1.assign_sw_controller(sw=str(i),count=3, 
+                    ip1=ONOS1_ip, port1=ONOS1_port,
+                    ip2=ONOS2_ip, port2=ONOS2_port,
+		            ip3=ONOS3_ip, port3=ONOS3_port)
+
+        switch_mastership = main.TRUE
+        for i in range (1,29):
+            response = main.Mininet1.get_sw_controller("s"+str(i))
+            print("Response is " + str(response))
+            if re.search("tcp:"+ONOS1_ip,response):
+                switch_mastership = switch_mastership and main.TRUE
+            else:
+                switch_mastership = main.FALSE
+
+        if switch_mastership == main.TRUE:
+            main.log.report("Controller assignment successfull")
+        else:
+             main.log.report("Controller assignment failed")
+        #REACTIVE FWD test
+        main.step("Pingall")
+        ping_result = main.FALSE
+        time1 = time.time()
+        ping_result = main.Mininet1.pingall()
+        time2 = time.time()
+        print "Time for pingall: %2f seconds" % (time2 - time1)
+      
+        case4_result = switch_mastership and ping_result
+        if ping_result == main.TRUE:
+            main.log.report("Pingall Test in reactive mode to discover the hosts successful")
+        else:
+            main.log.report("Pingall Test in reactive mode to discover the hosts failed")
+
+        utilities.assert_equals(expect=main.TRUE, actual=case4_result,onpass="Controller assignment and Pingall Test successful",onfail="Controller assignment and Pingall Test NOT successful")
+
+    
+
+    def CASE5(self,main) :
+        import json
+        from subprocess import Popen, PIPE
+        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+        
+        main.log.report("This testcase is testing if all ONOS nodes are in topology sync with mininet and its peer ONOS nodes")
+        main.log.report("__________________________________")        
+        main.case ("Testing Mininet topology with the topology of multi instances ONOS") 
+        main.step("Collecting topology information from ONOS")
+        devices1 = main.ONOScli1.devices()
+        devices2 = main.ONOScli2.devices()
+        devices3 = main.ONOScli3.devices()
+        #print "devices1 = ", devices1
+        #print "devices2 = ", devices2
+        #print "devices3 = ", devices3
+        hosts1 = main.ONOScli1.hosts()
+        hosts2 = main.ONOScli2.hosts()
+        hosts3 = main.ONOScli3.hosts()
+        #print "hosts1 = ", hosts1
+        #print "hosts2 = ", hosts2
+        #print "hosts3 = ", hosts3
+        ports1 = main.ONOScli1.ports()
+        ports2 = main.ONOScli2.ports()
+        ports3 = main.ONOScli3.ports()
+        #print "ports1 = ", ports1
+        #print "ports2 = ", ports2    
+        #print "ports3 = ", ports3
+        links1 = main.ONOScli1.links()
+        links2 = main.ONOScli2.links()
+        links3 = main.ONOScli3.links()
+        #print "links1 = ", links1
+        #print "links2 = ", links2
+        #print "links3 = ", links3
+        
+        print "**************"
+        
+        main.step("Start continuous pings")
+        main.Mininet2.pingLong(src=main.params['PING']['source1'],
+                            target=main.params['PING']['target1'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source2'],
+                            target=main.params['PING']['target2'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source3'],
+                            target=main.params['PING']['target3'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source4'],
+                            target=main.params['PING']['target4'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source5'],
+                            target=main.params['PING']['target5'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source6'],
+                            target=main.params['PING']['target6'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source7'],
+                            target=main.params['PING']['target7'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source8'],
+                            target=main.params['PING']['target8'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source9'],
+                            target=main.params['PING']['target9'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source10'],
+                            target=main.params['PING']['target10'],pingTime=500)
+
+        main.step("Create TestONTopology object")
+        global ctrls
+        ctrls = []
+        count = 1
+        while True:
+            temp = ()
+            if ('ip' + str(count)) in main.params['CTRL']:
+                temp = temp + (getattr(main,('ONOS' + str(count))),)
+                temp = temp + ("ONOS"+str(count),)
+                temp = temp + (main.params['CTRL']['ip'+str(count)],)
+                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
+                ctrls.append(temp)
+                count = count + 1
+            else:
+                break
+        global MNTopo
+        Topo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+        MNTopo = Topo
+
+        Topology_Check = main.TRUE
+        main.step("Compare ONOS Topology to MN Topology")
+        
+        switches_results1 =  main.Mininet1.compare_switches(MNTopo, json.loads(devices1))
+        print "switches_Result1 = ", switches_results1
+        utilities.assert_equals(expect=main.TRUE, actual=switches_results1,
+                onpass="ONOS1 Switches view is correct",
+                onfail="ONOS1 Switches view is incorrect")
+
+        switches_results2 =  main.Mininet1.compare_switches(MNTopo, json.loads(devices2))
+        utilities.assert_equals(expect=main.TRUE, actual=switches_results2,
+                onpass="ONOS2 Switches view is correct",
+                onfail="ONOS2 Switches view is incorrect")
+    
+        switches_results3 =  main.Mininet1.compare_switches(MNTopo, json.loads(devices3))
+        utilities.assert_equals(expect=main.TRUE, actual=switches_results3,
+                onpass="ONOS3 Switches view is correct",
+                onfail="ONOS3 Switches view is incorrect")
+
+        '''
+        ports_results1 =  main.Mininet1.compare_ports(MNTopo, json.loads(ports1))
+        utilities.assert_equals(expect=main.TRUE, actual=ports_results1,
+                onpass="ONOS1 Ports view is correct",
+                onfail="ONOS1 Ports view is incorrect")
+
+        ports_results2 =  main.Mininet1.compare_ports(MNTopo, json.loads(ports2))
+        utilities.assert_equals(expect=main.TRUE, actual=ports_results2,
+                onpass="ONOS2 Ports view is correct",
+                onfail="ONOS2 Ports view is incorrect")
+
+        ports_results3 =  main.Mininet1.compare_ports(MNTopo, json.loads(ports3))
+        utilities.assert_equals(expect=main.TRUE, actual=ports_results3,
+                onpass="ONOS3 Ports view is correct",
+                onfail="ONOS3 Ports view is incorrect")
+        '''        
+
+        links_results1 =  main.Mininet1.compare_links(MNTopo, json.loads(links1))
+        utilities.assert_equals(expect=main.TRUE, actual=links_results1,
+                onpass="ONOS1 Links view is correct",
+                onfail="ONOS1 Links view is incorrect")
+
+        links_results2 =  main.Mininet1.compare_links(MNTopo, json.loads(links2))
+        utilities.assert_equals(expect=main.TRUE, actual=links_results2,
+                onpass="ONOS2 Links view is correct",
+                onfail="ONOS2 Links view is incorrect")
+
+        links_results3 =  main.Mininet1.compare_links(MNTopo, json.loads(links3))
+        utilities.assert_equals(expect=main.TRUE, actual=links_results3,
+                onpass="ONOS2 Links view is correct",
+                onfail="ONOS2 Links view is incorrect")
+
+        #topo_result = switches_results1 and switches_results2 and switches_results3\
+                #and ports_results1 and ports_results2 and ports_results3\
+                #and links_results1 and links_results2 and links_results3
+        
+        topo_result = switches_results1 and switches_results2 and switches_results3\
+                and links_results1 and links_results2 and links_results3
+
+        if topo_result == main.TRUE:
+            main.log.report("Topology Check Test with mininet and ONOS instances successful")
+        else:
+            main.log.report("Topology Check Test with mininet and ONOS instances failed")
+
+        utilities.assert_equals(expect=main.TRUE, actual=topo_result,
+                onpass="Topology Check Test successful",
+                onfail="Topology Check Test NOT successful")
+
+
+
+
+    def CASE10(self):
+        main.log.report("This testcase uninstalls the reactive forwarding app")
+        main.log.report("__________________________________")
+        main.case("Uninstalling reactive forwarding app")
+        #Unistall onos-app-fwd app to disable reactive forwarding
+        appUninstall_result1 = main.ONOScli1.feature_uninstall("onos-app-fwd")
+        appUninstall_result2 = main.ONOScli2.feature_uninstall("onos-app-fwd")
+        appUninstall_result3 = main.ONOScli3.feature_uninstall("onos-app-fwd")
+        main.log.info("onos-app-fwd uninstalled")
+
+        #After reactive forwarding is disabled, the reactive flows on switches timeout in 10-15s
+        #So sleep for 15s
+        time.sleep(15)
+        
+        hosts = main.ONOScli1.hosts()
+        main.log.info(hosts)
+        
+        case10_result = appUninstall_result1 and appUninstall_result2 and appUninstall_result3
+        utilities.assert_equals(expect=main.TRUE, actual=case10_result,onpass="Reactive forwarding app uninstallation successful",onfail="Reactive forwarding app uninstallation failed")
+
+
+    def CASE6(self):
+        main.log.report("This testcase is testing the addition of host intents and then doing pingall")
+        main.log.report("__________________________________")        
+        main.case("Obtaining hostsfor adding host intents")
+        main.step("Get hosts")
+        hosts = main.ONOScli1.hosts()
+        main.log.info(hosts)
+
+        main.step("Get all devices id")
+        devices_id_list = main.ONOScli1.get_all_devices_id()
+        main.log.info(devices_id_list) 
+
+        #ONOS displays the hosts in hex format unlike mininet which does in decimal format
+        #So take care while adding intents
+        
+        '''
+        main.step("Add host intents for mn hosts(h8-h18,h9-h19,h10-h20,h11-h21,h12-h22,h13-h23,h14-h24,h15-h25,h16-h26,h17-h27)")
+        hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:08/-1", "00:00:00:00:00:12/-1")
+        hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:09/-1", "00:00:00:00:00:13/-1")
+        hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:0A/-1", "00:00:00:00:00:14/-1")
+        hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:0B/-1", "00:00:00:00:00:15/-1")
+        hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:0C/-1", "00:00:00:00:00:16/-1")
+        hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:0D/-1", "00:00:00:00:00:17/-1")
+        hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:0E/-1", "00:00:00:00:00:18/-1")
+        hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:0F/-1", "00:00:00:00:00:19/-1")
+        hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:10/-1", "00:00:00:00:00:1A/-1")
+        hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1") 
+        '''
+
+        for i in range(8,18):
+            main.log.info("Adding host intent between h"+str(i)+" and h"+str(i+10))
+            host1 =  "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
+            host2 =  "00:00:00:00:00:" + str(hex(i+10)[2:]).zfill(2).upper()
+            #NOTE: get host can return None
+            #TODO: handle this
+            host1_id = main.ONOScli1.get_host(host1)['id']
+            host2_id = main.ONOScli1.get_host(host2)['id']
+            tmp_result = main.ONOScli1.add_host_intent(host1_id, host2_id )
+
+        flowHandle = main.ONOScli1.flows()
+        #print "flowHandle = ", flowHandle
+        main.log.info("flows:" +flowHandle)
+
+        count = 1
+        i = 8
+        Ping_Result = main.TRUE
+        while i <18 :
+            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
+            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
+            if ping == main.FALSE and count <5:
+                count+=1
+                #i = 8
+                Ping_Result = main.FALSE
+                main.log.report("Ping between h" + str(i) + " and h" + str(i+10) + " failed. Making attempt number "+str(count) + " in 2 seconds")
+                time.sleep(2)
+            elif ping==main.FALSE:
+                main.log.report("All ping attempts between h" + str(i) + " and h" + str(i+10) +"have failed")
+                i=19
+                Ping_Result = main.FALSE
+            elif ping==main.TRUE:
+                main.log.info("Ping test between h" + str(i) + " and h" + str(i+10) + "passed!")
+                i+=1
+                Ping_Result = main.TRUE
+            else:
+                main.log.info("Unknown error")
+                Ping_Result = main.ERROR
+        if Ping_Result==main.FALSE:
+            main.log.report("Host intents have not ben installed correctly. Cleaning up")
+            #main.cleanup()
+            #main.exit()
+        if Ping_Result==main.TRUE:
+            main.log.report("Host intents have been installed correctly")
+
+        case6_result = Ping_Result
+        utilities.assert_equals(expect=main.TRUE, actual=case6_result,
+                onpass="Host intent addition and Pingall Test successful",
+                onfail="Host intent addition and Pingall Test NOT successful")
+
+
+    def CASE7 (self,main):
+       
+        ONOS1_ip = main.params['CTRL']['ip1']
+
+        link_sleep = int(main.params['timers']['LinkDiscovery'])
+
+        main.log.report("This testscase is killing a link to ensure that link discovery is consistent")
+        main.log.report("__________________________________")        
+        main.case("Killing a link to Ensure that Link Discovery is Working Properly")
+        main.step("Start continuous pings")
+       
+        main.Mininet2.pingLong(src=main.params['PING']['source1'],
+                            target=main.params['PING']['target1'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source2'],
+                            target=main.params['PING']['target2'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source3'],
+                            target=main.params['PING']['target3'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source4'],
+                            target=main.params['PING']['target4'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source5'],
+                            target=main.params['PING']['target5'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source6'],
+                            target=main.params['PING']['target6'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source7'],
+                            target=main.params['PING']['target7'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source8'],
+                            target=main.params['PING']['target8'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source9'],
+                            target=main.params['PING']['target9'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source10'],
+                            target=main.params['PING']['target10'],pingTime=500)
+
+
+        main.step("Determine the current number of switches and links")
+        topology_output = main.ONOScli1.topology()
+        topology_result = main.ONOSbench.get_topology(topology_output)
+        activeSwitches = topology_result['devices']
+        links = topology_result['links']
+        print "activeSwitches = ", type(activeSwitches)
+        print "links = ", type(links)
+        main.log.info("Currently there are %s switches and %s links"  %(str(activeSwitches), str(links)))
+
+        main.step("Kill Link between s3 and s28")
+        main.Mininet1.link(END1="s3",END2="s28",OPTION="down")
+        time.sleep(link_sleep)
+        topology_output = main.ONOScli2.topology()
+        Link_Down = main.ONOSbench.check_status(topology_output,activeSwitches,str(int(links)-2))
+        if Link_Down == main.TRUE:
+            main.log.report("Link Down discovered properly")
+        utilities.assert_equals(expect=main.TRUE,actual=Link_Down,
+                onpass="Link Down discovered properly",
+                onfail="Link down was not discovered in "+ str(link_sleep) + " seconds")
+        
+        main.step("Bring link between s3 and s28 back up")
+        Link_Up = main.Mininet1.link(END1="s3",END2="s28",OPTION="up")
+        time.sleep(link_sleep)
+        topology_output = main.ONOScli2.topology()
+        Link_Up = main.ONOSbench.check_status(topology_output,activeSwitches,str(links))
+        if Link_Up == main.TRUE:
+            main.log.report("Link up discovered properly")
+        utilities.assert_equals(expect=main.TRUE,actual=Link_Up,
+                onpass="Link up discovered properly",
+                onfail="Link up was not discovered in "+ str(link_sleep) + " seconds")
+
+        main.step("Compare ONOS Topology to MN Topology")
+        main.case ("Testing Mininet topology with the topology of multi instances ONOS") 
+        main.step("Collecting topology information from ONOS")
+        devices1 = main.ONOScli1.devices()
+        devices2 = main.ONOScli2.devices()
+        devices3 = main.ONOScli3.devices()
+        print "devices1 = ", devices1
+        print "devices2 = ", devices2
+        print "devices3 = ", devices3
+        hosts1 = main.ONOScli1.hosts()
+        hosts2 = main.ONOScli2.hosts()
+        hosts3 = main.ONOScli3.hosts()
+        #print "hosts1 = ", hosts1
+        #print "hosts2 = ", hosts2
+        #print "hosts3 = ", hosts3
+        ports1 = main.ONOScli1.ports()
+        ports2 = main.ONOScli2.ports()
+        ports3 = main.ONOScli3.ports()
+        #print "ports1 = ", ports1
+        #print "ports2 = ", ports2    
+        #print "ports3 = ", ports3
+        links1 = main.ONOScli1.links()
+        links2 = main.ONOScli2.links()
+        links3 = main.ONOScli3.links()
+        #print "links1 = ", links1
+        #print "links2 = ", links2
+        #print "links3 = ", links3
+        
+        print "**************"
+        
+        main.step("Start continuous pings")
+        main.Mininet2.pingLong(src=main.params['PING']['source1'],
+                            target=main.params['PING']['target1'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source2'],
+                            target=main.params['PING']['target2'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source3'],
+                            target=main.params['PING']['target3'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source4'],
+                            target=main.params['PING']['target4'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source5'],
+                            target=main.params['PING']['target5'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source6'],
+                            target=main.params['PING']['target6'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source7'],
+                            target=main.params['PING']['target7'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source8'],
+                            target=main.params['PING']['target8'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source9'],
+                            target=main.params['PING']['target9'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source10'],
+                            target=main.params['PING']['target10'],pingTime=500)
+
+        main.step("Create TestONTopology object")
+        global ctrls
+        ctrls = []
+        count = 1
+        while True:
+            temp = ()
+            if ('ip' + str(count)) in main.params['CTRL']:
+                temp = temp + (getattr(main,('ONOS' + str(count))),)
+                temp = temp + ("ONOS"+str(count),)
+                temp = temp + (main.params['CTRL']['ip'+str(count)],)
+                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
+                ctrls.append(temp)
+                count = count + 1
+            else:
+                break
+        global MNTopo
+        Topo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+        MNTopo = Topo
+
+        Topology_Check = main.TRUE
+        main.step("Compare ONOS Topology to MN Topology")
+        
+        switches_results1 =  main.Mininet1.compare_switches(MNTopo, json.loads(devices1))
+        print "switches_Result1 = ", switches_results1
+        utilities.assert_equals(expect=main.TRUE, actual=switches_results1,
+                onpass="ONOS1 Switches view is correct",
+                onfail="ONOS1 Switches view is incorrect")
+
+        switches_results2 =  main.Mininet1.compare_switches(MNTopo, json.loads(devices2))
+        utilities.assert_equals(expect=main.TRUE, actual=switches_results2,
+                onpass="ONOS2 Switches view is correct",
+                onfail="ONOS2 Switches view is incorrect")
+    
+        switches_results3 =  main.Mininet1.compare_switches(MNTopo, json.loads(devices3))
+        utilities.assert_equals(expect=main.TRUE, actual=switches_results3,
+                onpass="ONOS3 Switches view is correct",
+                onfail="ONOS3 Switches view is incorrect")
+
+        '''
+        ports_results1 =  main.Mininet1.compare_ports(MNTopo, json.loads(ports1))
+        utilities.assert_equals(expect=main.TRUE, actual=ports_results1,
+                onpass="ONOS1 Ports view is correct",
+                onfail="ONOS1 Ports view is incorrect")
+
+        ports_results2 =  main.Mininet1.compare_ports(MNTopo, json.loads(ports2))
+        utilities.assert_equals(expect=main.TRUE, actual=ports_results2,
+                onpass="ONOS2 Ports view is correct",
+                onfail="ONOS2 Ports view is incorrect")
+
+        ports_results3 =  main.Mininet1.compare_ports(MNTopo, json.loads(ports3))
+        utilities.assert_equals(expect=main.TRUE, actual=ports_results3,
+                onpass="ONOS3 Ports view is correct",
+                onfail="ONOS3 Ports view is incorrect")
+        '''        
+
+        links_results1 =  main.Mininet1.compare_links(MNTopo, json.loads(links1))
+        utilities.assert_equals(expect=main.TRUE, actual=links_results1,
+                onpass="ONOS1 Links view is correct",
+                onfail="ONOS1 Links view is incorrect")
+
+        links_results2 =  main.Mininet1.compare_links(MNTopo, json.loads(links2))
+        utilities.assert_equals(expect=main.TRUE, actual=links_results2,
+                onpass="ONOS2 Links view is correct",
+                onfail="ONOS2 Links view is incorrect")
+
+        links_results3 =  main.Mininet1.compare_links(MNTopo, json.loads(links3))
+        utilities.assert_equals(expect=main.TRUE, actual=links_results3,
+                onpass="ONOS2 Links view is correct",
+                onfail="ONOS2 Links view is incorrect")
+               
+        #topo_result = switches_results1 and switches_results2 and switches_results3\
+                #and ports_results1 and ports_results2 and ports_results3\
+                #and links_results1 and links_results2 and links_results3
+        
+        topo_result = switches_results1 and switches_results2 and switches_results3\
+                and links_results1 and links_results2 and links_results3
+
+        utilities.assert_equals(expect=main.TRUE, actual=topo_result and Link_Up and Link_Down,
+                onpass="Topology Check Test successful",
+                onfail="Topology Check Test NOT successful")
+
+
+    def CASE8(self):
+        '''
+        Intent removal
+        ''' 
+        main.log.report("This testcase removes host any previously added intents")
+        main.log.report("__________________________________")        
+        main.log.info("Removing any previously installed intents")
+        main.case("Removing intents")
+        main.step("Obtain the intent id's")
+        intent_result = main.ONOScli1.intents(json_format = False)
+        
+        intent_linewise = intent_result.split("\n")
+        intentList = []
+        for line in intent_linewise:
+            if line.startswith("id="):
+                intentList.append(line)
+
+        intentids = []
+        for line in intentList:
+            intentids.append(line.split(",")[0].split("=")[1])
+        for id in intentids:
+            main.log.info("id = " +id)
+
+        main.step("Iterate through the intentids list and remove each intent")
+        for id in intentids:
+            main.ONOScli1.remove_intent(intent_id = id)
+
+        intent_result = main.ONOScli1.intents(json_format = False)
+        main.log.info("intent_result = " +intent_result)
+        case8_result = main.TRUE
+        
+        i = 8
+        Ping_Result = main.TRUE
+        while i <18 :
+            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
+            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
+            if ping==main.TRUE:
+                i = 19
+                Ping_Result = main.TRUE
+            elif ping==main.FALSE:
+                i+=1
+                Ping_Result = main.FALSE
+            else:
+                main.log.info("Unknown error")
+                Ping_Result = main.ERROR
+        
+        #Note: If the ping result failed, that means the intents have been withdrawn correctly.
+        if Ping_Result==main.TRUE:
+            main.log.report("Host intents have not been withdrawn correctly")
+            #main.cleanup()
+            #main.exit()
+        if Ping_Result==main.FALSE:
+            main.log.report("Host intents have been withdrawn correctly")
+
+        case8_result = case8_result and Ping_Result
+
+        if case8_result == main.FALSE:
+            main.log.report("Intent removal successful")
+        else:
+            main.log.report("Intent removal failed")
+                        
+        utilities.assert_equals(expect=main.FALSE, actual=case8_result,
+                onpass="Intent removal test failed",
+                onfail="Intent removal test successful")
+             
+
+    def CASE9(self):
+        '''
+        This test case adds point intents. Make sure you run test case 8 which is host intent removal before executing this test case.
+        Else the host intent's flows will persist on switches and the pings would work even if there is some issue with the point intent's flows
+        '''
+        main.log.report("This testcase adds point intents and then does pingall")
+        main.log.report("__________________________________")        
+        main.log.info("Adding point intents")
+        main.case("Adding bidirectional point for mn hosts(h8-h18,h9-h19,h10-h20,h11-h21,h12-h22,h13-h23,h14-h24,h15-h25,h16-h26,h17-h27)") 
+        main.step("Add point-to-point intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12")
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003008/1", "of:0000000000006018/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006018/1", "of:0000000000003008/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        main.step("Add point-to-point intents for mininet hosts h9 and h19 or ONOS hosts h9 and h13")
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003009/1", "of:0000000000006019/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006019/1", "of:0000000000003009/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+        
+        main.step("Add point-to-point intents for mininet hosts h10 and h20 or ONOS hosts hA and h14")
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003010/1", "of:0000000000006020/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006020/1", "of:0000000000003010/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+
+        main.step("Add point-to-point intents for mininet hosts h11 and h21 or ONOS hosts hB and h15")
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003011/1", "of:0000000000006021/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006021/1", "of:0000000000003011/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+            
+        main.step("Add point-to-point intents for mininet hosts h12 and h22 or ONOS hosts hC and h16")
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003012/1", "of:0000000000006022/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006022/1", "of:0000000000003012/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+            
+        main.step("Add point-to-point intents for mininet hosts h13 and h23 or ONOS hosts hD and h17")
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003013/1", "of:0000000000006023/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006023/1", "of:0000000000003013/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+
+        main.step("Add point-to-point intents for mininet hosts h14 and h24 or ONOS hosts hE and h18")
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003014/1", "of:0000000000006024/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006024/1", "of:0000000000003014/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+            
+        main.step("Add point-to-point intents for mininet hosts h15 and h25 or ONOS hosts hF and h19")
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003015/1", "of:0000000000006025/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006025/1", "of:0000000000003015/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+            
+        main.step("Add point-to-point intents for mininet hosts h16 and h26 or ONOS hosts h10 and h1A")
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003016/1", "of:0000000000006026/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006026/1", "of:0000000000003016/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+
+
+        main.step("Add point-to-point intents for mininet hosts h17 and h27 or ONOS hosts h11 and h1B")
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003017/1", "of:0000000000006027/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006027/1", "of:0000000000003017/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+
+        print("_______________________________________________________________________________________")
+
+        flowHandle = main.ONOScli1.flows()
+        #print "flowHandle = ", flowHandle
+        main.log.info("flows :" + flowHandle)        
+
+        count = 1
+        i = 8
+        Ping_Result = main.TRUE
+        while i <18 :
+            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
+            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
+            if ping == main.FALSE and count <5:
+                count+=1
+                #i = 8
+                Ping_Result = main.FALSE
+                main.log.report("Ping between h" + str(i) + " and h" + str(i+10) + " failed. Making attempt number "+str(count) + " in 2 seconds")
+                time.sleep(2)
+            elif ping==main.FALSE:
+                main.log.report("All ping attempts between h" + str(i) + " and h" + str(i+10) +"have failed")
+                i=19
+                Ping_Result = main.FALSE
+            elif ping==main.TRUE:
+                main.log.info("Ping test between h" + str(i) + " and h" + str(i+10) + "passed!")
+                i+=1
+                Ping_Result = main.TRUE
+            else:
+                main.log.info("Unknown error")
+                Ping_Result = main.ERROR
+        if Ping_Result==main.FALSE:
+            main.log.report("Ping all test after Point intents addition failed. Cleaning up")
+            #main.cleanup()
+            #main.exit()
+        if Ping_Result==main.TRUE:
+            main.log.report("Ping all test after Point intents addition successful")
+
+        case8_result = Ping_Result
+        utilities.assert_equals(expect=main.TRUE, actual=case8_result,
+                onpass="Ping all test after Point intents addition successful",
+                onfail="Ping all test after Point intents addition failed")
+
+    def CASE31(self):
+        ''' 
+            This test case adds point intent related to SDN-IP matching on ICMP (ethertype=IPV4, ipProto=1)
+        '''
+        import json
+
+        main.log.report("This test case adds point intent related to SDN-IP matching on ICMP")
+        main.case("Adding bidirectional point intent related to SDN-IP matching on ICMP")
+        main.step("Adding bidirectional point intent")
+        #add-point-intent --ipSrc=10.0.0.8/32 --ipDst=10.0.0.18/32 --ethType=IPV4 --ipProto=1  of:0000000000003008/1 of:0000000000006018/1
+        
+        hosts_json = json.loads(main.ONOScli1.hosts())
+        for  i in range(8,11):
+            main.log.info("Adding point intent between h"+str(i)+" and h"+str(i+10))
+            host1 =  "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
+            host2 =  "00:00:00:00:00:" + str(hex(i+10)[2:]).zfill(2).upper()
+            host1_id = main.ONOScli1.get_host(host1)['id']
+            host2_id = main.ONOScli1.get_host(host2)['id']
+            for host in hosts_json:
+                if host['id'] == host1_id:
+                    ip1 = host['ips'][0]
+                    ip1 = str(ip1+"/32")
+                    device1 = host['location']['device']
+                    device1 = str(device1+"/1")
+                elif host['id'] == host2_id:
+                    ip2 = str(host['ips'][0])+"/32"
+                    device2 = host['location']["device"]
+                    device2 = str(device2+"/1")
+                
+            p_intent_result1 = main.ONOScli1.add_point_intent(ingress_device=device1, egress_device=device2, ipSrc=ip1, ipDst=ip2,
+                                  ethType=main.params['SDNIP']['ethType'], ipProto=main.params['SDNIP']['icmpProto'])
+            
+            get_intent_result = main.ONOScli1.intents(json_format = False)
+            main.log.info(get_intent_result)
+ 
+            p_intent_result2 = main.ONOScli1.add_point_intent(ingress_device=device2, egress_device=device1, ipSrc=ip2, ipDst=ip1, 
+                                  ethType=main.params['SDNIP']['ethType'], ipProto=main.params['SDNIP']['icmpProto']) 
+            
+            get_intent_result = main.ONOScli1.intents(json_format = False)
+            main.log.info(get_intent_result)
+            if (p_intent_result1 and p_intent_result2) == main.TRUE:
+                #get_intent_result = main.ONOScli1.intents()
+                #main.log.info(get_intent_result)
+                main.log.info("Point intent related to SDN-IP matching on ICMP install successful")
+       
+        time.sleep(15) 
+        get_intent_result = main.ONOScli1.intents(json_format = False)
+        main.log.info("intents = "+ get_intent_result)
+        get_flows_result = main.ONOScli1.flows()
+        main.log.info("flows = " + get_flows_result)
+        
+        count = 1
+        i = 8
+        Ping_Result = main.TRUE
+        while i <11 :
+            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
+            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
+            if ping == main.FALSE and count <3:
+                count+=1
+                #i = 8
+                Ping_Result = main.FALSE
+                main.log.report("Ping between h" + str(i) + " and h" + str(i+10) + " failed. Making attempt number "+str(count) + " in 2 seconds")
+                time.sleep(2)
+            elif ping==main.FALSE:
+                main.log.report("All ping attempts between h" + str(i) + " and h" + str(i+10) +"have failed")
+                i=19
+                Ping_Result = main.FALSE
+            elif ping==main.TRUE:
+                main.log.info("Ping test between h" + str(i) + " and h" + str(i+10) + "passed!")
+                i+=1
+                Ping_Result = main.TRUE
+            else:
+                main.log.info("Unknown error")
+                Ping_Result = main.ERROR
+        if Ping_Result==main.FALSE:
+            main.log.report("Ping test after Point intents related to SDN-IP matching on ICMP failed.")
+            #main.cleanup()
+            #main.exit()
+        if Ping_Result==main.TRUE:
+            main.log.report("Ping all test after Point intents related to SDN-IP matching on ICMP successful")
+                   
+        case31_result = Ping_Result and p_intent_result1 and p_intent_result2
+        utilities.assert_equals(expect=main.TRUE, actual=case31_result,
+                onpass="Point intent related to SDN-IP matching on ICMP and ping test successful",
+                onfail="Point intent related to SDN-IP matching on ICMP and ping test failed")
+   
+    def CASE32(self):
+        ''' 
+            This test case adds point intent related to SDN-IP matching on TCP (ethertype=IPV4, ipProto=6, DefaultPort for iperf=5001)
+            Note: Although BGP port is 179, we are using 5001 because iperf is used for verifying and iperf's default port is 5001
+        '''
+        import json
+
+        main.log.report("This test case adds point intent related to SDN-IP matching on TCP")
+        main.case("Adding bidirectional point intent related to SDN-IP matching on TCP")
+        main.step("Adding bidirectional point intent")
+        """
+        add-point-intent --ipSrc=10.0.0.8/32 --ipDst=10.0.0.18/32 --ethType=IPV4 --ipProto=6 --tcpDst=5001  of:0000000000003008/1 of:0000000000006018/1
+
+        add-point-intent --ipSrc=10.0.0.18/32 --ipDst=10.0.0.8/32 --ethType=IPV4 --ipProto=6 --tcpDst=5001  of:0000000000006018/1 of:0000000000003008/1
+    
+        add-point-intent --ipSrc=10.0.0.8/32 --ipDst=10.0.0.18/32 --ethType=IPV4 --ipProto=6 --tcpSrc=5001  of:0000000000003008/1 of:0000000000006018/1
+
+        add-point-intent --ipSrc=10.0.0.18/32 --ipDst=10.0.0.8/32 --ethType=IPV4 --ipProto=6 --tcpSrc=5001  of:0000000000006018/1 of:0000000000003008/1
+
+        """           
+    
+        hosts_json = json.loads(main.ONOScli1.hosts())
+        for  i in range(8,9):
+            main.log.info("Adding point intent between h"+str(i)+" and h"+str(i+10))
+            host1 =  "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
+            host2 =  "00:00:00:00:00:" + str(hex(i+10)[2:]).zfill(2).upper()
+            host1_id = main.ONOScli1.get_host(host1)['id']
+            host2_id = main.ONOScli1.get_host(host2)['id']
+            for host in hosts_json:
+                if host['id'] == host1_id:
+                    ip1 = host['ips'][0]
+                    ip1 = str(ip1+"/32")
+                    device1 = host['location']['device']
+                    device1 = str(device1+"/1")
+                elif host['id'] == host2_id:
+                    ip2 = str(host['ips'][0])+"/32"
+                    device2 = host['location']["device"]
+                    device2 = str(device2+"/1")
+                
+            p_intent_result1 = main.ONOScli1.add_point_intent(ingress_device=device1, egress_device=device2, ipSrc=ip1, ipDst=ip2,
+                                  ethType=main.params['SDNIP']['ethType'], ipProto=main.params['SDNIP']['tcpProto'], tcpDst=main.params['SDNIP']['dstPort']) 
+            p_intent_result2 = main.ONOScli1.add_point_intent(ingress_device=device2, egress_device=device1, ipSrc=ip2, ipDst=ip1, 
+                                  ethType=main.params['SDNIP']['ethType'], ipProto=main.params['SDNIP']['tcpProto'], tcpDst=main.params['SDNIP']['dstPort'])
+
+            p_intent_result3 = main.ONOScli1.add_point_intent(ingress_device=device1, egress_device=device2, ipSrc=ip1, ipDst=ip2,
+                                  ethType=main.params['SDNIP']['ethType'], ipProto=main.params['SDNIP']['tcpProto'], tcpSrc=main.params['SDNIP']['srcPort'])
+            p_intent_result4 = main.ONOScli1.add_point_intent(ingress_device=device2, egress_device=device1, ipSrc=ip2, ipDst=ip1,
+                                  ethType=main.params['SDNIP']['ethType'], ipProto=main.params['SDNIP']['tcpProto'], tcpSrc=main.params['SDNIP']['srcPort']) 
+
+            p_intent_result = p_intent_result1 and p_intent_result2 and p_intent_result3 and p_intent_result4
+            if p_intent_result ==main.TRUE:
+                get_intent_result = main.ONOScli1.intents(json_format = False)
+                main.log.info(get_intent_result)
+                main.log.info("Point intent related to SDN-IP matching on TCP install successful")
+        
+        iperf_result = main.Mininet1.iperf('h8', 'h18') 
+        if iperf_result == main.TRUE:
+            main.log.report("iperf test successful")
+        else:
+            main.log.report("iperf test failed")
+
+
+        case32_result = p_intent_result and iperf_result
+        utilities.assert_equals(expect=main.TRUE, actual=case32_result,
+                onpass="Ping all test after Point intents addition related to SDN-IP on TCP match successful",
+                onfail="Ping all test after Point intents addition related to SDN-IP on TCP match failed")
+
+
+    def CASE33(self):
+        ''' 
+            This test case adds multipoint to singlepoint  intent related to SDN-IP matching on destination ip and the action is to rewrite the mac address 
+            Here the mac address to be rewritten is the mac address of the egress device
+        '''
+        import json
+        import time
+
+        main.log.report("This test case adds multipoint to singlepoint intent related to SDN-IP matching on destination ip and rewrite mac address action")
+        main.case("Adding multipoint to singlepoint intent related to SDN-IP matching on destination ip")
+        main.step("Adding bidirectional multipoint to singlepoint intent")
+        """
+        add-multi-to-single-intent --ipDst=10.0.3.0/24 --setEthDst=00:00:00:00:00:12 of:0000000000003008/1 0000000000003009/1 of:0000000000006018/1
+        
+        add-multi-to-single-intent --ipDst=10.0.1.0/24 --setEthDst=00:00:00:00:00:08 of:0000000000006018/1 0000000000003009/1 of:0000000000003008/1 
+        """    
+        
+        main.case("Installing multipoint to single point intent with rewrite mac address")
+        main.step("Uninstalling proxy arp app")
+        #Unistall onos-app-proxyarp app to disable reactive forwarding
+        appUninstall_result1 = main.ONOScli1.feature_uninstall("onos-app-proxyarp")
+        appUninstall_result2 = main.ONOScli2.feature_uninstall("onos-app-proxyarp")
+        appUninstall_result3 = main.ONOScli3.feature_uninstall("onos-app-proxyarp")
+        main.log.info("onos-app-proxyarp uninstalled") 
+
+        main.step("Changing ipaddress of hosts h8,h9 and h18")
+        main.Mininet1.changeIP(host='h8', intf='h8-eth0', newIP='10.0.1.1', newNetmask='255.255.255.0') 
+        main.Mininet1.changeIP(host='h9', intf='h9-eth0', newIP='10.0.2.1', newNetmask='255.255.255.0')
+        main.Mininet1.changeIP(host='h10', intf='h10-eth0', newIP='10.0.3.1', newNetmask='255.255.255.0')
+
+        main.step("Changing default gateway of hosts h8,h9 and h18")
+        main.Mininet1.changeDefaultGateway(host='h8', newGW='10.0.1.254')
+        main.Mininet1.changeDefaultGateway(host='h9', newGW='10.0.2.254')
+        main.Mininet1.changeDefaultGateway(host='h10', newGW='10.0.3.254')
+
+        main.step("Assigning random mac address to the default gateways since proxyarp app is uninstalled")
+        main.Mininet1.addStaticMACAddress(host='h8', GW='10.0.1.254', macaddr='00:00:00:00:11:11')
+        main.Mininet1.addStaticMACAddress(host='h9', GW='10.0.2.254', macaddr='00:00:00:00:22:22')
+        main.Mininet1.addStaticMACAddress(host='h10', GW='10.0.3.254', macaddr='00:00:00:00:33:33')
+         
+        main.step("Verify static gateway and MAC address assignment")
+        main.Mininet1.verifyStaticGWandMAC(host='h8')
+        main.Mininet1.verifyStaticGWandMAC(host='h9')
+        main.Mininet1.verifyStaticGWandMAC(host='h10')
+        
+        main.step("Adding multipoint to singlepoint intent")               
+        p_intent_result1 = main.ONOScli1.add_multipoint_to_singlepoint_intent(ingress_device1=main.params['MULTIPOINT_INTENT']['device1'], ingress_device2=main.params['MULTIPOINT_INTENT']['device2'],
+                                 egress_device=main.params['MULTIPOINT_INTENT']['device3'], ipDst=main.params['MULTIPOINT_INTENT']['ip1'], setEthDst=main.params['MULTIPOINT_INTENT']['mac1']) 
+        
+        p_intent_result2 = main.ONOScli1.add_multipoint_to_singlepoint_intent(ingress_device1=main.params['MULTIPOINT_INTENT']['device3'], ingress_device2=main.params['MULTIPOINT_INTENT']['device2'],                            
+                                egress_device=main.params['MULTIPOINT_INTENT']['device1'], ipDst=main.params['MULTIPOINT_INTENT']['ip2'], setEthDst=main.params['MULTIPOINT_INTENT']['mac2'])    
+
+
+        get_intent_result = main.ONOScli1.intents(json_format = False)
+        main.log.info("intents = "+ get_intent_result)
+        
+        time.sleep(10)
+        get_flows_result = main.ONOScli1.flows(json_format = False)
+        main.log.info("flows = " + get_flows_result) 
+
+        count = 1
+        i = 8
+        Ping_Result = main.TRUE
+       
+        main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+2))
+        ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+2))
+        if ping == main.FALSE and count <3:
+            count+=1
+            Ping_Result = main.FALSE
+            main.log.report("Ping between h" + str(i) + " and h" + str(i+2) + " failed. Making attempt number "+str(count) + " in 2 seconds")
+            time.sleep(2)
+        elif ping==main.FALSE:
+            main.log.report("All ping attempts between h" + str(i) + " and h" + str(i+10) +"have failed")
+            Ping_Result = main.FALSE
+        elif ping==main.TRUE:
+            main.log.info("Ping test between h" + str(i) + " and h" + str(i+2) + "passed!")
+            Ping_Result = main.TRUE
+        else:
+            main.log.info("Unknown error")
+            Ping_Result = main.ERROR
+        
+        if Ping_Result==main.FALSE:
+            main.log.report("Ping test failed.")
+            #main.cleanup()
+            #main.exit()
+        if Ping_Result==main.TRUE:
+            main.log.report("Ping all successful")
+
+
+        p_intent_result = p_intent_result1 and p_intent_result2
+        if p_intent_result ==main.TRUE:
+            main.log.info("Multi point intent with rewrite mac address installation successful")
+        else:
+            main.log.info("Multi point intent with rewrite mac address installation failed")
+      
+        case33_result = p_intent_result and Ping_Result
+        utilities.assert_equals(expect=main.TRUE, actual=case33_result,
+                onpass="Ping all test after multipoint to single point intent addition with rewrite mac address successful",
+                onfail="Ping all test after multipoint to single point intent addition with rewrite mac address failed")  
diff --git a/TestON/tests/MultiProd/MultiProd.topo b/TestON/tests/MultiProd/MultiProd.topo
new file mode 100755
index 0000000..28dfa92
--- /dev/null
+++ b/TestON/tests/MultiProd/MultiProd.topo
@@ -0,0 +1,98 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOSbench>
+
+        <ONOScli1>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli1>
+
+	 <ONOScli2>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli2>
+
+	 <ONOScli3>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli3>
+
+        <ONOS1>
+            <host>10.128.10.11</host>
+            <user>sdn</user>
+            <password>sdn</password>
+            <type>OnosCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1>
+
+	<ONOS2>
+            <host>10.128.10.11</host>
+            <user>sdn</user>
+            <password>sdn</password>
+            <type>OnosCliDriver</type>
+            <connect_order>6</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS2>
+	
+	<ONOS3>
+            <host>10.128.10.11</host>
+            <user>sdn</user>
+            <password>sdn</password>
+            <type>OnosCliDriver</type>
+            <connect_order>7</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS3>
+
+	
+        <Mininet1>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>8</connect_order>
+            <COMPONENTS>
+                #Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+                <arg2> --topo mytopo </arg2>
+                <arg3> --switch ovs,protocols=OpenFlow10 </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet1>
+
+        <Mininet2>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>RemoteMininetDriver</type>
+            <connect_order>9</connect_order>
+            <COMPONENTS>
+                #Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+                <arg2> --topo mytopo </arg2>
+                <arg3> --switch ovs,protocols=OpenFlow10 </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet2>
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/MultiProd13/MultiProd13.params b/TestON/tests/MultiProd13/MultiProd13.params
new file mode 100755
index 0000000..8bf1600
--- /dev/null
+++ b/TestON/tests/MultiProd13/MultiProd13.params
@@ -0,0 +1,65 @@
+<PARAMS>
+    
+    <testcases>1,4,10,5,6,7,8,6,8,9,31,32,8,33</testcases>    
+
+    #Environment variables
+    <ENV>
+        <cellName>multi_test</cellName>
+    </ENV>
+
+    <CTRL>
+        <ip1>10.128.20.11</ip1>
+	    <ip2>10.128.20.12</ip2>
+	    <ip3>10.128.20.13</ip3>
+        <port1>6633</port1>
+        <port2>6633</port2>
+        <port3>6633</port3>
+    </CTRL>
+
+    <SDNIP>
+        <ethType>IPV4</ethType>
+        <tcpProto>6</tcpProto>
+        <icmpProto>1</icmpProto>
+        <srcPort>5001</srcPort>
+        <dstPort>5001</dstPort>
+    </SDNIP>
+
+    <MULTIPOINT_INTENT>
+        <device1>of:0000000000003008/1 </device1>
+        <device2>of:0000000000003009/1 </device2>
+        <device3>of:0000000000003010/1 </device3>
+        <mac1>00:00:00:00:00:0A </mac1>
+        <mac2>00:00:00:00:00:08 </mac2>
+        <ip1>10.0.3.0/24 </ip1>
+        <ip2>10.0.1.0/24 </ip2>
+    </MULTIPOINT_INTENT>
+
+    <PING>
+        <source1>h8</source1>
+        <source2>h9</source2>
+        <source3>h10</source3>
+        <source4>h11</source4>
+        <source5>h12</source5>
+        <source6>h13</source6>
+        <source7>h14</source7>
+        <source8>h15</source8>
+        <source9>h16</source9>
+        <source10>h17</source10>
+        <target1>10.0.0.18</target1>
+        <target2>10.0.0.19</target2>
+        <target3>10.0.0.20</target3>
+        <target4>10.0.0.21</target4>
+        <target5>10.0.0.22</target5>
+        <target6>10.0.0.23</target6>
+        <target7>10.0.0.24</target7>
+        <target8>10.0.0.25</target8>
+        <target9>10.0.0.26</target9>
+        <target10>10.0.0.27</target10>
+    </PING>
+
+    <timers>
+        <LinkDiscovery>5</LinkDiscovery>
+        <SwitchDiscovery>31</SwitchDiscovery>
+    </timers>
+
+</PARAMS>
diff --git a/TestON/tests/MultiProd13/MultiProd13.py b/TestON/tests/MultiProd13/MultiProd13.py
new file mode 100755
index 0000000..1276d33
--- /dev/null
+++ b/TestON/tests/MultiProd13/MultiProd13.py
@@ -0,0 +1,1163 @@
+
+#Testing the basic functionality of ONOS Next
+#For sanity and driver functionality excercises only.
+
+import time
+import sys
+import os
+import re
+import time
+import json
+
+time.sleep(1)
+class MultiProd13:
+    def __init__(self):
+        self.default = ''
+
+    def CASE1(self, main):
+        '''
+        Startup sequence:
+        cell <name>
+        onos-verify-cell
+        onos-remove-raft-logs        
+        git pull
+        mvn clean install
+        onos-package
+        onos-install -f
+        onos-wait-for-start
+        '''
+        
+        cell_name = main.params['ENV']['cellName']
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+        ONOS1_port = main.params['CTRL']['port1']
+        ONOS2_port = main.params['CTRL']['port2']
+        ONOS3_port = main.params['CTRL']['port3']   
+       
+        main.case("Setting up test environment")
+        main.log.report("This testcase is testing setting up test environment") 
+        main.log.report("__________________________________")
+ 
+        main.step("Applying cell variable to environment")
+        cell_result1 = main.ONOSbench.set_cell(cell_name)
+        #cell_result2 = main.ONOScli1.set_cell(cell_name)
+        #cell_result3 = main.ONOScli2.set_cell(cell_name)
+        #cell_result4 = main.ONOScli3.set_cell(cell_name)
+        verify_result = main.ONOSbench.verify_cell() 
+        cell_result = cell_result1
+
+        main.step("Removing raft logs before a clen installation of ONOS")
+        remove_log_Result = main.ONOSbench.onos_remove_raft_logs()        
+
+        main.step("Git checkout and pull master and get version")
+        main.ONOSbench.git_checkout("master")
+        git_pull_result = main.ONOSbench.git_pull()
+        print "git_pull_result = ", git_pull_result
+        version_result = main.ONOSbench.get_version(report=True)
+
+        if git_pull_result == 1:
+            main.step("Using mvn clean & install")
+            clean_install_result = main.ONOSbench.clean_install()
+            #clean_install_result = main.TRUE 
+
+        main.step("Creating ONOS package")
+        package_result = main.ONOSbench.onos_package()
+
+        #main.step("Creating a cell")
+        #cell_create_result = main.ONOSbench.create_cell_file(**************)
+
+        main.step("Installing ONOS package")
+        onos1_install_result = main.ONOSbench.onos_install(options="-f", node=ONOS1_ip)
+        onos2_install_result = main.ONOSbench.onos_install(options="-f", node=ONOS2_ip)
+        onos3_install_result = main.ONOSbench.onos_install(options="-f", node=ONOS3_ip)
+        onos_install_result = onos1_install_result and onos2_install_result and onos3_install_result        
+        if onos_install_result == main.TRUE:
+            main.log.report("Installing ONOS package successful")
+        else:
+            main.log.report("Installing ONOS package failed")
+        	
+        onos1_isup = main.ONOSbench.isup(ONOS1_ip)
+        onos2_isup = main.ONOSbench.isup(ONOS2_ip)
+        onos3_isup = main.ONOSbench.isup(ONOS3_ip)
+        onos_isup = onos1_isup and onos2_isup and onos3_isup
+        if onos_isup == main.TRUE:
+            main.log.report("ONOS instances are up and ready")
+        else:
+            main.log.report("ONOS instances may not be up")          
+
+        main.step("Starting ONOS service")
+        start_result = main.TRUE
+        #start_result = main.ONOSbench.onos_start(ONOS1_ip)
+        startcli1 = main.ONOScli1.start_onos_cli(ONOS_ip = ONOS1_ip)
+        startcli2 = main.ONOScli2.start_onos_cli(ONOS_ip = ONOS2_ip)
+        startcli3 = main.ONOScli3.start_onos_cli(ONOS_ip = ONOS3_ip)
+        print startcli1
+        print startcli2
+        print startcli3
+            
+        case1_result = (package_result and\
+                cell_result and verify_result and onos_install_result and\
+                onos_isup and start_result )
+        utilities.assert_equals(expect=main.TRUE, actual=case1_result,
+                onpass="Test startup successful",
+                onfail="Test startup NOT successful")
+
+    def CASE11(self, main):
+        '''
+        Cleanup sequence:
+        onos-service <node_ip> stop
+        onos-uninstall
+
+        TODO: Define rest of cleanup
+        
+        '''
+
+      	ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+	
+        main.case("Cleaning up test environment")
+
+        main.step("Testing ONOS kill function")
+        kill_result1 = main.ONOSbench.onos_kill(ONOS1_ip)
+        kill_result2 = main.ONOSbench.onos_kill(ONOS2_ip)
+        kill_result3 = main.ONOSbench.onos_kill(ONOS3_ip)
+	
+        main.step("Stopping ONOS service")
+        stop_result1 = main.ONOSbench.onos_stop(ONOS1_ip)
+        stop_result2 = main.ONOSbench.onos_stop(ONOS2_ip)
+        stop_result3 = main.ONOSbench.onos_stop(ONOS3_ip)
+
+        main.step("Uninstalling ONOS service") 
+        uninstall_result = main.ONOSbench.onos_uninstall()
+
+    def CASE3(self, main):
+        '''
+        Test 'onos' command and its functionality in driver
+        '''
+       
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS3_ip = main.params['CTRL']['ip3']	
+
+        main.case("Testing 'onos' command")
+
+        main.step("Sending command 'onos -w <onos-ip> system:name'")
+        cmdstr1 = "system:name"
+        cmd_result1 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr1) 
+        main.log.info("onos command returned: "+cmd_result1)
+        cmd_result2 = main.ONOSbench.onos_cli(ONOS2_ip, cmdstr1)
+        main.log.info("onos command returned: "+cmd_result2)
+        cmd_result3 = main.ONOSbench.onos_cli(ONOS3_ip, cmdstr1)
+        main.log.info("onos command returned: "+cmd_result3)
+
+        main.step("Sending command 'onos -w <onos-ip> onos:topology'")
+        cmdstr2 = "onos:topology"
+        cmd_result4 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr2)
+        main.log.info("onos command returned: "+cmd_result4)
+        cmd_result5 = main.ONOSbench.onos_cli(ONOS2_ip, cmdstr2)
+        main.log.info("onos command returned: "+cmd_result5)
+        cmd_result6 = main.ONOSbench.onos_cli(ONOS6_ip, cmdstr2)
+        main.log.info("onos command returned: "+cmd_result6)
+
+
+    def CASE4(self, main):
+        import re
+        import time
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+        ONOS1_port = main.params['CTRL']['port1']
+        ONOS2_port = main.params['CTRL']['port2']
+        ONOS3_port = main.params['CTRL']['port3']
+        
+        main.log.report("This testcase is testing the assignment of all the switches to all controllers and discovering the hosts in reactive mode")
+        main.log.report("__________________________________")        
+        main.case("Pingall Test(No intents are added)")
+        main.step("Assigning switches to controllers")
+        for i in range(1,29): #1 to (num of switches +1)
+            main.Mininet1.assign_sw_controller(sw=str(i),count=3, 
+                    ip1=ONOS1_ip, port1=ONOS1_port,
+                    ip2=ONOS2_ip, port2=ONOS2_port,
+		            ip3=ONOS3_ip, port3=ONOS3_port)
+
+        switch_mastership = main.TRUE
+        for i in range (1,29):
+            response = main.Mininet1.get_sw_controller("s"+str(i))
+            print("Response is " + str(response))
+            if re.search("tcp:"+ONOS1_ip,response):
+                switch_mastership = switch_mastership and main.TRUE
+            else:
+                switch_mastership = main.FALSE
+
+        if switch_mastership == main.TRUE:
+            main.log.report("Controller assignment successfull")
+        else:
+             main.log.report("Controller assignment failed")
+        #REACTIVE FWD test
+        main.step("Pingall")
+        ping_result = main.FALSE
+        time1 = time.time()
+        ping_result = main.Mininet1.pingall()
+        time2 = time.time()
+        print "Time for pingall: %2f seconds" % (time2 - time1)
+      
+        case4_result = switch_mastership and ping_result
+        if ping_result == main.TRUE:
+            main.log.report("Pingall Test in reactive mode to discover the hosts successful")
+        else:
+            main.log.report("Pingall Test in reactive mode to discover the hosts failed")
+
+        utilities.assert_equals(expect=main.TRUE, actual=case4_result,onpass="Controller assignment and Pingall Test successful",onfail="Controller assignment and Pingall Test NOT successful")
+
+    
+
+    def CASE5(self,main) :
+        import json
+        from subprocess import Popen, PIPE
+        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+        
+        main.log.report("This testcase is testing if all ONOS nodes are in topology sync with mininet and its peer ONOS nodes")
+        main.log.report("__________________________________")        
+        main.case ("Testing Mininet topology with the topology of multi instances ONOS") 
+        main.step("Collecting topology information from ONOS")
+        devices1 = main.ONOScli1.devices()
+        devices2 = main.ONOScli2.devices()
+        devices3 = main.ONOScli3.devices()
+        #print "devices1 = ", devices1
+        #print "devices2 = ", devices2
+        #print "devices3 = ", devices3
+        hosts1 = main.ONOScli1.hosts()
+        hosts2 = main.ONOScli2.hosts()
+        hosts3 = main.ONOScli3.hosts()
+        #print "hosts1 = ", hosts1
+        #print "hosts2 = ", hosts2
+        #print "hosts3 = ", hosts3
+        ports1 = main.ONOScli1.ports()
+        ports2 = main.ONOScli2.ports()
+        ports3 = main.ONOScli3.ports()
+        #print "ports1 = ", ports1
+        #print "ports2 = ", ports2    
+        #print "ports3 = ", ports3
+        links1 = main.ONOScli1.links()
+        links2 = main.ONOScli2.links()
+        links3 = main.ONOScli3.links()
+        #print "links1 = ", links1
+        #print "links2 = ", links2
+        #print "links3 = ", links3
+        
+        print "**************"
+        
+        main.step("Start continuous pings")
+        main.Mininet2.pingLong(src=main.params['PING']['source1'],
+                            target=main.params['PING']['target1'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source2'],
+                            target=main.params['PING']['target2'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source3'],
+                            target=main.params['PING']['target3'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source4'],
+                            target=main.params['PING']['target4'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source5'],
+                            target=main.params['PING']['target5'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source6'],
+                            target=main.params['PING']['target6'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source7'],
+                            target=main.params['PING']['target7'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source8'],
+                            target=main.params['PING']['target8'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source9'],
+                            target=main.params['PING']['target9'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source10'],
+                            target=main.params['PING']['target10'],pingTime=500)
+
+        main.step("Create TestONTopology object")
+        global ctrls
+        ctrls = []
+        count = 1
+        while True:
+            temp = ()
+            if ('ip' + str(count)) in main.params['CTRL']:
+                temp = temp + (getattr(main,('ONOS' + str(count))),)
+                temp = temp + ("ONOS"+str(count),)
+                temp = temp + (main.params['CTRL']['ip'+str(count)],)
+                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
+                ctrls.append(temp)
+                count = count + 1
+            else:
+                break
+        global MNTopo
+        Topo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+        MNTopo = Topo
+
+        Topology_Check = main.TRUE
+        main.step("Compare ONOS Topology to MN Topology")
+        
+        switches_results1 =  main.Mininet1.compare_switches(MNTopo, json.loads(devices1))
+        print "switches_Result1 = ", switches_results1
+        utilities.assert_equals(expect=main.TRUE, actual=switches_results1,
+                onpass="ONOS1 Switches view is correct",
+                onfail="ONOS1 Switches view is incorrect")
+
+        switches_results2 =  main.Mininet1.compare_switches(MNTopo, json.loads(devices2))
+        utilities.assert_equals(expect=main.TRUE, actual=switches_results2,
+                onpass="ONOS2 Switches view is correct",
+                onfail="ONOS2 Switches view is incorrect")
+    
+        switches_results3 =  main.Mininet1.compare_switches(MNTopo, json.loads(devices3))
+        utilities.assert_equals(expect=main.TRUE, actual=switches_results3,
+                onpass="ONOS3 Switches view is correct",
+                onfail="ONOS3 Switches view is incorrect")
+
+        '''
+        ports_results1 =  main.Mininet1.compare_ports(MNTopo, json.loads(ports1))
+        utilities.assert_equals(expect=main.TRUE, actual=ports_results1,
+                onpass="ONOS1 Ports view is correct",
+                onfail="ONOS1 Ports view is incorrect")
+
+        ports_results2 =  main.Mininet1.compare_ports(MNTopo, json.loads(ports2))
+        utilities.assert_equals(expect=main.TRUE, actual=ports_results2,
+                onpass="ONOS2 Ports view is correct",
+                onfail="ONOS2 Ports view is incorrect")
+
+        ports_results3 =  main.Mininet1.compare_ports(MNTopo, json.loads(ports3))
+        utilities.assert_equals(expect=main.TRUE, actual=ports_results3,
+                onpass="ONOS3 Ports view is correct",
+                onfail="ONOS3 Ports view is incorrect")
+        '''        
+
+        links_results1 =  main.Mininet1.compare_links(MNTopo, json.loads(links1))
+        utilities.assert_equals(expect=main.TRUE, actual=links_results1,
+                onpass="ONOS1 Links view is correct",
+                onfail="ONOS1 Links view is incorrect")
+
+        links_results2 =  main.Mininet1.compare_links(MNTopo, json.loads(links2))
+        utilities.assert_equals(expect=main.TRUE, actual=links_results2,
+                onpass="ONOS2 Links view is correct",
+                onfail="ONOS2 Links view is incorrect")
+
+        links_results3 =  main.Mininet1.compare_links(MNTopo, json.loads(links3))
+        utilities.assert_equals(expect=main.TRUE, actual=links_results3,
+                onpass="ONOS2 Links view is correct",
+                onfail="ONOS2 Links view is incorrect")
+
+        #topo_result = switches_results1 and switches_results2 and switches_results3\
+                #and ports_results1 and ports_results2 and ports_results3\
+                #and links_results1 and links_results2 and links_results3
+        
+        topo_result = switches_results1 and switches_results2 and switches_results3\
+                and links_results1 and links_results2 and links_results3
+
+        if topo_result == main.TRUE:
+            main.log.report("Topology Check Test with mininet and ONOS instances successful")
+        else:
+            main.log.report("Topology Check Test with mininet and ONOS instances failed")
+
+        utilities.assert_equals(expect=main.TRUE, actual=topo_result,
+                onpass="Topology Check Test successful",
+                onfail="Topology Check Test NOT successful")
+
+
+
+
+    def CASE10(self):
+        main.log.report("This testcase uninstalls the reactive forwarding app")
+        main.log.report("__________________________________")
+        main.case("Uninstalling reactive forwarding app")
+        #Unistall onos-app-fwd app to disable reactive forwarding
+        appUninstall_result1 = main.ONOScli1.feature_uninstall("onos-app-fwd")
+        appUninstall_result2 = main.ONOScli2.feature_uninstall("onos-app-fwd")
+        appUninstall_result3 = main.ONOScli3.feature_uninstall("onos-app-fwd")
+        main.log.info("onos-app-fwd uninstalled")
+
+        #After reactive forwarding is disabled, the reactive flows on switches timeout in 10-15s
+        #So sleep for 15s
+        time.sleep(15)
+        
+        hosts = main.ONOScli1.hosts()
+        main.log.info(hosts)
+        
+        case10_result = appUninstall_result1 and appUninstall_result2 and appUninstall_result3
+        utilities.assert_equals(expect=main.TRUE, actual=case10_result,onpass="Reactive forwarding app uninstallation successful",onfail="Reactive forwarding app uninstallation failed")
+
+
+    def CASE6(self):
+        main.log.report("This testcase is testing the addition of host intents and then doing pingall")
+        main.log.report("__________________________________")        
+        main.case("Obtaining hostsfor adding host intents")
+        main.step("Get hosts")
+        hosts = main.ONOScli1.hosts()
+        main.log.info(hosts)
+
+        main.step("Get all devices id")
+        devices_id_list = main.ONOScli1.get_all_devices_id()
+        main.log.info(devices_id_list) 
+
+        #ONOS displays the hosts in hex format unlike mininet which does in decimal format
+        #So take care while adding intents
+        
+        '''
+        main.step("Add host intents for mn hosts(h8-h18,h9-h19,h10-h20,h11-h21,h12-h22,h13-h23,h14-h24,h15-h25,h16-h26,h17-h27)")
+        hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:08/-1", "00:00:00:00:00:12/-1")
+        hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:09/-1", "00:00:00:00:00:13/-1")
+        hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:0A/-1", "00:00:00:00:00:14/-1")
+        hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:0B/-1", "00:00:00:00:00:15/-1")
+        hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:0C/-1", "00:00:00:00:00:16/-1")
+        hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:0D/-1", "00:00:00:00:00:17/-1")
+        hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:0E/-1", "00:00:00:00:00:18/-1")
+        hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:0F/-1", "00:00:00:00:00:19/-1")
+        hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:10/-1", "00:00:00:00:00:1A/-1")
+        hth_intent_result = main.ONOScli1.add_host_intent("00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1") 
+        '''
+
+        for i in range(8,18):
+            main.log.info("Adding host intent between h"+str(i)+" and h"+str(i+10))
+            host1 =  "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
+            host2 =  "00:00:00:00:00:" + str(hex(i+10)[2:]).zfill(2).upper()
+            #NOTE: get host can return None
+            #TODO: handle this
+            host1_id = main.ONOScli1.get_host(host1)['id']
+            host2_id = main.ONOScli1.get_host(host2)['id']
+            tmp_result = main.ONOScli1.add_host_intent(host1_id, host2_id )
+
+        flowHandle = main.ONOScli1.flows()
+        #print "flowHandle = ", flowHandle
+        main.log.info("flows:" +flowHandle)
+
+        count = 1
+        i = 8
+        Ping_Result = main.TRUE
+        while i <18 :
+            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
+            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
+            if ping == main.FALSE and count <5:
+                count+=1
+                #i = 8
+                Ping_Result = main.FALSE
+                main.log.report("Ping between h" + str(i) + " and h" + str(i+10) + " failed. Making attempt number "+str(count) + " in 2 seconds")
+                time.sleep(2)
+            elif ping==main.FALSE:
+                main.log.report("All ping attempts between h" + str(i) + " and h" + str(i+10) +"have failed")
+                i=19
+                Ping_Result = main.FALSE
+            elif ping==main.TRUE:
+                main.log.info("Ping test between h" + str(i) + " and h" + str(i+10) + "passed!")
+                i+=1
+                Ping_Result = main.TRUE
+            else:
+                main.log.info("Unknown error")
+                Ping_Result = main.ERROR
+        if Ping_Result==main.FALSE:
+            main.log.report("Host intents have not ben installed correctly. Cleaning up")
+            #main.cleanup()
+            #main.exit()
+        if Ping_Result==main.TRUE:
+            main.log.report("Host intents have been installed correctly")
+
+        case6_result = Ping_Result
+        utilities.assert_equals(expect=main.TRUE, actual=case6_result,
+                onpass="Host intent addition and Pingall Test successful",
+                onfail="Host intent addition and Pingall Test NOT successful")
+
+
+    def CASE7 (self,main):
+       
+        ONOS1_ip = main.params['CTRL']['ip1']
+
+        link_sleep = int(main.params['timers']['LinkDiscovery'])
+
+        main.log.report("This testscase is killing a link to ensure that link discovery is consistent")
+        main.log.report("__________________________________")        
+        main.case("Killing a link to Ensure that Link Discovery is Working Properly")
+        main.step("Start continuous pings")
+       
+        main.Mininet2.pingLong(src=main.params['PING']['source1'],
+                            target=main.params['PING']['target1'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source2'],
+                            target=main.params['PING']['target2'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source3'],
+                            target=main.params['PING']['target3'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source4'],
+                            target=main.params['PING']['target4'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source5'],
+                            target=main.params['PING']['target5'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source6'],
+                            target=main.params['PING']['target6'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source7'],
+                            target=main.params['PING']['target7'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source8'],
+                            target=main.params['PING']['target8'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source9'],
+                            target=main.params['PING']['target9'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source10'],
+                            target=main.params['PING']['target10'],pingTime=500)
+
+
+        main.step("Determine the current number of switches and links")
+        topology_output = main.ONOScli1.topology()
+        topology_result = main.ONOSbench.get_topology(topology_output)
+        activeSwitches = topology_result['devices']
+        links = topology_result['links']
+        print "activeSwitches = ", type(activeSwitches)
+        print "links = ", type(links)
+        main.log.info("Currently there are %s switches and %s links"  %(str(activeSwitches), str(links)))
+
+        main.step("Kill Link between s3 and s28")
+        main.Mininet1.link(END1="s3",END2="s28",OPTION="down")
+        time.sleep(link_sleep)
+        topology_output = main.ONOScli2.topology()
+        Link_Down = main.ONOSbench.check_status(topology_output,activeSwitches,str(int(links)-2))
+        if Link_Down == main.TRUE:
+            main.log.report("Link Down discovered properly")
+        utilities.assert_equals(expect=main.TRUE,actual=Link_Down,
+                onpass="Link Down discovered properly",
+                onfail="Link down was not discovered in "+ str(link_sleep) + " seconds")
+        
+        main.step("Bring link between s3 and s28 back up")
+        Link_Up = main.Mininet1.link(END1="s3",END2="s28",OPTION="up")
+        time.sleep(link_sleep)
+        topology_output = main.ONOScli2.topology()
+        Link_Up = main.ONOSbench.check_status(topology_output,activeSwitches,str(links))
+        if Link_Up == main.TRUE:
+            main.log.report("Link up discovered properly")
+        utilities.assert_equals(expect=main.TRUE,actual=Link_Up,
+                onpass="Link up discovered properly",
+                onfail="Link up was not discovered in "+ str(link_sleep) + " seconds")
+
+        main.step("Compare ONOS Topology to MN Topology")
+        main.case ("Testing Mininet topology with the topology of multi instances ONOS") 
+        main.step("Collecting topology information from ONOS")
+        devices1 = main.ONOScli1.devices()
+        devices2 = main.ONOScli2.devices()
+        devices3 = main.ONOScli3.devices()
+        print "devices1 = ", devices1
+        print "devices2 = ", devices2
+        print "devices3 = ", devices3
+        hosts1 = main.ONOScli1.hosts()
+        hosts2 = main.ONOScli2.hosts()
+        hosts3 = main.ONOScli3.hosts()
+        #print "hosts1 = ", hosts1
+        #print "hosts2 = ", hosts2
+        #print "hosts3 = ", hosts3
+        ports1 = main.ONOScli1.ports()
+        ports2 = main.ONOScli2.ports()
+        ports3 = main.ONOScli3.ports()
+        #print "ports1 = ", ports1
+        #print "ports2 = ", ports2    
+        #print "ports3 = ", ports3
+        links1 = main.ONOScli1.links()
+        links2 = main.ONOScli2.links()
+        links3 = main.ONOScli3.links()
+        #print "links1 = ", links1
+        #print "links2 = ", links2
+        #print "links3 = ", links3
+        
+        print "**************"
+        
+        main.step("Start continuous pings")
+        main.Mininet2.pingLong(src=main.params['PING']['source1'],
+                            target=main.params['PING']['target1'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source2'],
+                            target=main.params['PING']['target2'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source3'],
+                            target=main.params['PING']['target3'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source4'],
+                            target=main.params['PING']['target4'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source5'],
+                            target=main.params['PING']['target5'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source6'],
+                            target=main.params['PING']['target6'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source7'],
+                            target=main.params['PING']['target7'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source8'],
+                            target=main.params['PING']['target8'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source9'],
+                            target=main.params['PING']['target9'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source10'],
+                            target=main.params['PING']['target10'],pingTime=500)
+
+        main.step("Create TestONTopology object")
+        global ctrls
+        ctrls = []
+        count = 1
+        while True:
+            temp = ()
+            if ('ip' + str(count)) in main.params['CTRL']:
+                temp = temp + (getattr(main,('ONOS' + str(count))),)
+                temp = temp + ("ONOS"+str(count),)
+                temp = temp + (main.params['CTRL']['ip'+str(count)],)
+                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
+                ctrls.append(temp)
+                count = count + 1
+            else:
+                break
+        global MNTopo
+        Topo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+        MNTopo = Topo
+
+        Topology_Check = main.TRUE
+        main.step("Compare ONOS Topology to MN Topology")
+        
+        switches_results1 =  main.Mininet1.compare_switches(MNTopo, json.loads(devices1))
+        print "switches_Result1 = ", switches_results1
+        utilities.assert_equals(expect=main.TRUE, actual=switches_results1,
+                onpass="ONOS1 Switches view is correct",
+                onfail="ONOS1 Switches view is incorrect")
+
+        switches_results2 =  main.Mininet1.compare_switches(MNTopo, json.loads(devices2))
+        utilities.assert_equals(expect=main.TRUE, actual=switches_results2,
+                onpass="ONOS2 Switches view is correct",
+                onfail="ONOS2 Switches view is incorrect")
+    
+        switches_results3 =  main.Mininet1.compare_switches(MNTopo, json.loads(devices3))
+        utilities.assert_equals(expect=main.TRUE, actual=switches_results3,
+                onpass="ONOS3 Switches view is correct",
+                onfail="ONOS3 Switches view is incorrect")
+
+        '''
+        ports_results1 =  main.Mininet1.compare_ports(MNTopo, json.loads(ports1))
+        utilities.assert_equals(expect=main.TRUE, actual=ports_results1,
+                onpass="ONOS1 Ports view is correct",
+                onfail="ONOS1 Ports view is incorrect")
+
+        ports_results2 =  main.Mininet1.compare_ports(MNTopo, json.loads(ports2))
+        utilities.assert_equals(expect=main.TRUE, actual=ports_results2,
+                onpass="ONOS2 Ports view is correct",
+                onfail="ONOS2 Ports view is incorrect")
+
+        ports_results3 =  main.Mininet1.compare_ports(MNTopo, json.loads(ports3))
+        utilities.assert_equals(expect=main.TRUE, actual=ports_results3,
+                onpass="ONOS3 Ports view is correct",
+                onfail="ONOS3 Ports view is incorrect")
+        '''        
+
+        links_results1 =  main.Mininet1.compare_links(MNTopo, json.loads(links1))
+        utilities.assert_equals(expect=main.TRUE, actual=links_results1,
+                onpass="ONOS1 Links view is correct",
+                onfail="ONOS1 Links view is incorrect")
+
+        links_results2 =  main.Mininet1.compare_links(MNTopo, json.loads(links2))
+        utilities.assert_equals(expect=main.TRUE, actual=links_results2,
+                onpass="ONOS2 Links view is correct",
+                onfail="ONOS2 Links view is incorrect")
+
+        links_results3 =  main.Mininet1.compare_links(MNTopo, json.loads(links3))
+        utilities.assert_equals(expect=main.TRUE, actual=links_results3,
+                onpass="ONOS2 Links view is correct",
+                onfail="ONOS2 Links view is incorrect")
+               
+        #topo_result = switches_results1 and switches_results2 and switches_results3\
+                #and ports_results1 and ports_results2 and ports_results3\
+                #and links_results1 and links_results2 and links_results3
+        
+        topo_result = switches_results1 and switches_results2 and switches_results3\
+                and links_results1 and links_results2 and links_results3
+
+        utilities.assert_equals(expect=main.TRUE, actual=topo_result and Link_Up and Link_Down,
+                onpass="Topology Check Test successful",
+                onfail="Topology Check Test NOT successful")
+
+
+    def CASE8(self):
+        '''
+        Intent removal
+        ''' 
+        main.log.report("This testcase removes host any previously added intents")
+        main.log.report("__________________________________")        
+        main.log.info("Removing any previously installed intents")
+        main.case("Removing intents")
+        main.step("Obtain the intent id's")
+        intent_result = main.ONOScli1.intents(json_format = False)
+        
+        intent_linewise = intent_result.split("\n")
+        intentList = []
+        for line in intent_linewise:
+            if line.startswith("id="):
+                intentList.append(line)
+
+        intentids = []
+        for line in intentList:
+            intentids.append(line.split(",")[0].split("=")[1])
+        for id in intentids:
+            main.log.info("id = " +id)
+
+        main.step("Iterate through the intentids list and remove each intent")
+        for id in intentids:
+            main.ONOScli1.remove_intent(intent_id = id)
+
+        intent_result = main.ONOScli1.intents(json_format = False)
+        main.log.info("intent_result = " +intent_result)
+        case8_result = main.TRUE
+        
+        i = 8
+        Ping_Result = main.TRUE
+        while i <18 :
+            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
+            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
+            if ping==main.TRUE:
+                i = 19
+                Ping_Result = main.TRUE
+            elif ping==main.FALSE:
+                i+=1
+                Ping_Result = main.FALSE
+            else:
+                main.log.info("Unknown error")
+                Ping_Result = main.ERROR
+        
+        #Note: If the ping result failed, that means the intents have been withdrawn correctly.
+        if Ping_Result==main.TRUE:
+            main.log.report("Host intents have not been withdrawn correctly")
+            #main.cleanup()
+            #main.exit()
+        if Ping_Result==main.FALSE:
+            main.log.report("Host intents have been withdrawn correctly")
+
+        case8_result = case8_result and Ping_Result
+
+        if case8_result == main.FALSE:
+            main.log.report("Intent removal successful")
+        else:
+            main.log.report("Intent removal failed")
+                        
+        utilities.assert_equals(expect=main.FALSE, actual=case8_result,
+                onpass="Intent removal test failed",
+                onfail="Intent removal test successful")
+             
+
+    def CASE9(self):
+        '''
+        This test case adds point intents. Make sure you run test case 8 which is host intent removal before executing this test case.
+        Else the host intent's flows will persist on switches and the pings would work even if there is some issue with the point intent's flows
+        '''
+        main.log.report("This testcase adds point intents and then does pingall")
+        main.log.report("__________________________________")        
+        main.log.info("Adding point intents")
+        main.case("Adding bidirectional point for mn hosts(h8-h18,h9-h19,h10-h20,h11-h21,h12-h22,h13-h23,h14-h24,h15-h25,h16-h26,h17-h27)") 
+        main.step("Add point-to-point intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12")
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003008/1", "of:0000000000006018/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006018/1", "of:0000000000003008/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        main.step("Add point-to-point intents for mininet hosts h9 and h19 or ONOS hosts h9 and h13")
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003009/1", "of:0000000000006019/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006019/1", "of:0000000000003009/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+        
+        main.step("Add point-to-point intents for mininet hosts h10 and h20 or ONOS hosts hA and h14")
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003010/1", "of:0000000000006020/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006020/1", "of:0000000000003010/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+
+        main.step("Add point-to-point intents for mininet hosts h11 and h21 or ONOS hosts hB and h15")
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003011/1", "of:0000000000006021/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006021/1", "of:0000000000003011/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+            
+        main.step("Add point-to-point intents for mininet hosts h12 and h22 or ONOS hosts hC and h16")
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003012/1", "of:0000000000006022/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006022/1", "of:0000000000003012/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+            
+        main.step("Add point-to-point intents for mininet hosts h13 and h23 or ONOS hosts hD and h17")
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003013/1", "of:0000000000006023/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006023/1", "of:0000000000003013/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+
+        main.step("Add point-to-point intents for mininet hosts h14 and h24 or ONOS hosts hE and h18")
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003014/1", "of:0000000000006024/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006024/1", "of:0000000000003014/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+            
+        main.step("Add point-to-point intents for mininet hosts h15 and h25 or ONOS hosts hF and h19")
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003015/1", "of:0000000000006025/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006025/1", "of:0000000000003015/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+            
+        main.step("Add point-to-point intents for mininet hosts h16 and h26 or ONOS hosts h10 and h1A")
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003016/1", "of:0000000000006026/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006026/1", "of:0000000000003016/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+
+
+        main.step("Add point-to-point intents for mininet hosts h17 and h27 or ONOS hosts h11 and h1B")
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000003017/1", "of:0000000000006027/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOScli1.add_point_intent("of:0000000000006027/1", "of:0000000000003017/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOScli1.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+
+        print("_______________________________________________________________________________________")
+
+        flowHandle = main.ONOScli1.flows()
+        #print "flowHandle = ", flowHandle
+        main.log.info("flows :" + flowHandle)        
+
+        count = 1
+        i = 8
+        Ping_Result = main.TRUE
+        while i <18 :
+            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
+            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
+            if ping == main.FALSE and count <5:
+                count+=1
+                #i = 8
+                Ping_Result = main.FALSE
+                main.log.report("Ping between h" + str(i) + " and h" + str(i+10) + " failed. Making attempt number "+str(count) + " in 2 seconds")
+                time.sleep(2)
+            elif ping==main.FALSE:
+                main.log.report("All ping attempts between h" + str(i) + " and h" + str(i+10) +"have failed")
+                i=19
+                Ping_Result = main.FALSE
+            elif ping==main.TRUE:
+                main.log.info("Ping test between h" + str(i) + " and h" + str(i+10) + "passed!")
+                i+=1
+                Ping_Result = main.TRUE
+            else:
+                main.log.info("Unknown error")
+                Ping_Result = main.ERROR
+        if Ping_Result==main.FALSE:
+            main.log.report("Ping all test after Point intents addition failed. Cleaning up")
+            #main.cleanup()
+            #main.exit()
+        if Ping_Result==main.TRUE:
+            main.log.report("Ping all test after Point intents addition successful")
+
+        case8_result = Ping_Result
+        utilities.assert_equals(expect=main.TRUE, actual=case8_result,
+                onpass="Ping all test after Point intents addition successful",
+                onfail="Ping all test after Point intents addition failed")
+
+    def CASE31(self):
+        ''' 
+            This test case adds point intent related to SDN-IP matching on ICMP (ethertype=IPV4, ipProto=1)
+        '''
+        import json
+
+        main.log.report("This test case adds point intent related to SDN-IP matching on ICMP")
+        main.case("Adding bidirectional point intent related to SDN-IP matching on ICMP")
+        main.step("Adding bidirectional point intent")
+        #add-point-intent --ipSrc=10.0.0.8/32 --ipDst=10.0.0.18/32 --ethType=IPV4 --ipProto=1  of:0000000000003008/1 of:0000000000006018/1
+        
+        hosts_json = json.loads(main.ONOScli1.hosts())
+        for  i in range(8,11):
+            main.log.info("Adding point intent between h"+str(i)+" and h"+str(i+10))
+            host1 =  "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
+            host2 =  "00:00:00:00:00:" + str(hex(i+10)[2:]).zfill(2).upper()
+            host1_id = main.ONOScli1.get_host(host1)['id']
+            host2_id = main.ONOScli1.get_host(host2)['id']
+            for host in hosts_json:
+                if host['id'] == host1_id:
+                    ip1 = host['ips'][0]
+                    ip1 = str(ip1+"/32")
+                    device1 = host['location']['device']
+                    device1 = str(device1+"/1")
+                elif host['id'] == host2_id:
+                    ip2 = str(host['ips'][0])+"/32"
+                    device2 = host['location']["device"]
+                    device2 = str(device2+"/1")
+                
+            p_intent_result1 = main.ONOScli1.add_point_intent(ingress_device=device1, egress_device=device2, ipSrc=ip1, ipDst=ip2,
+                                  ethType=main.params['SDNIP']['ethType'], ipProto=main.params['SDNIP']['icmpProto'])
+            
+            get_intent_result = main.ONOScli1.intents(json_format = False)
+            main.log.info(get_intent_result)
+ 
+            p_intent_result2 = main.ONOScli1.add_point_intent(ingress_device=device2, egress_device=device1, ipSrc=ip2, ipDst=ip1, 
+                                  ethType=main.params['SDNIP']['ethType'], ipProto=main.params['SDNIP']['icmpProto']) 
+            
+            get_intent_result = main.ONOScli1.intents(json_format = False)
+            main.log.info(get_intent_result)
+            if (p_intent_result1 and p_intent_result2) == main.TRUE:
+                #get_intent_result = main.ONOScli1.intents()
+                #main.log.info(get_intent_result)
+                main.log.info("Point intent related to SDN-IP matching on ICMP install successful")
+       
+        time.sleep(15) 
+        get_intent_result = main.ONOScli1.intents(json_format = False)
+        main.log.info("intents = "+ get_intent_result)
+        get_flows_result = main.ONOScli1.flows()
+        main.log.info("flows = " + get_flows_result)
+        
+        count = 1
+        i = 8
+        Ping_Result = main.TRUE
+        while i <11 :
+            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
+            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
+            if ping == main.FALSE and count <3:
+                count+=1
+                #i = 8
+                Ping_Result = main.FALSE
+                main.log.report("Ping between h" + str(i) + " and h" + str(i+10) + " failed. Making attempt number "+str(count) + " in 2 seconds")
+                time.sleep(2)
+            elif ping==main.FALSE:
+                main.log.report("All ping attempts between h" + str(i) + " and h" + str(i+10) +"have failed")
+                i=19
+                Ping_Result = main.FALSE
+            elif ping==main.TRUE:
+                main.log.info("Ping test between h" + str(i) + " and h" + str(i+10) + "passed!")
+                i+=1
+                Ping_Result = main.TRUE
+            else:
+                main.log.info("Unknown error")
+                Ping_Result = main.ERROR
+        if Ping_Result==main.FALSE:
+            main.log.report("Ping test after Point intents related to SDN-IP matching on ICMP failed.")
+            #main.cleanup()
+            #main.exit()
+        if Ping_Result==main.TRUE:
+            main.log.report("Ping all test after Point intents related to SDN-IP matching on ICMP successful")
+                   
+        case31_result = Ping_Result and p_intent_result1 and p_intent_result2
+        utilities.assert_equals(expect=main.TRUE, actual=case31_result,
+                onpass="Point intent related to SDN-IP matching on ICMP and ping test successful",
+                onfail="Point intent related to SDN-IP matching on ICMP and ping test failed")
+   
+    def CASE32(self):
+        ''' 
+            This test case adds point intent related to SDN-IP matching on TCP (ethertype=IPV4, ipProto=6, DefaultPort for iperf=5001)
+            Note: Although BGP port is 179, we are using 5001 because iperf is used for verifying and iperf's default port is 5001
+        '''
+        import json
+
+        main.log.report("This test case adds point intent related to SDN-IP matching on TCP")
+        main.case("Adding bidirectional point intent related to SDN-IP matching on TCP")
+        main.step("Adding bidirectional point intent")
+        """
+        add-point-intent --ipSrc=10.0.0.8/32 --ipDst=10.0.0.18/32 --ethType=IPV4 --ipProto=6 --tcpDst=5001  of:0000000000003008/1 of:0000000000006018/1
+
+        add-point-intent --ipSrc=10.0.0.18/32 --ipDst=10.0.0.8/32 --ethType=IPV4 --ipProto=6 --tcpDst=5001  of:0000000000006018/1 of:0000000000003008/1
+    
+        add-point-intent --ipSrc=10.0.0.8/32 --ipDst=10.0.0.18/32 --ethType=IPV4 --ipProto=6 --tcpSrc=5001  of:0000000000003008/1 of:0000000000006018/1
+
+        add-point-intent --ipSrc=10.0.0.18/32 --ipDst=10.0.0.8/32 --ethType=IPV4 --ipProto=6 --tcpSrc=5001  of:0000000000006018/1 of:0000000000003008/1
+
+        """           
+    
+        hosts_json = json.loads(main.ONOScli1.hosts())
+        for  i in range(8,9):
+            main.log.info("Adding point intent between h"+str(i)+" and h"+str(i+10))
+            host1 =  "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
+            host2 =  "00:00:00:00:00:" + str(hex(i+10)[2:]).zfill(2).upper()
+            host1_id = main.ONOScli1.get_host(host1)['id']
+            host2_id = main.ONOScli1.get_host(host2)['id']
+            for host in hosts_json:
+                if host['id'] == host1_id:
+                    ip1 = host['ips'][0]
+                    ip1 = str(ip1+"/32")
+                    device1 = host['location']['device']
+                    device1 = str(device1+"/1")
+                elif host['id'] == host2_id:
+                    ip2 = str(host['ips'][0])+"/32"
+                    device2 = host['location']["device"]
+                    device2 = str(device2+"/1")
+                
+            p_intent_result1 = main.ONOScli1.add_point_intent(ingress_device=device1, egress_device=device2, ipSrc=ip1, ipDst=ip2,
+                                  ethType=main.params['SDNIP']['ethType'], ipProto=main.params['SDNIP']['tcpProto'], tcpDst=main.params['SDNIP']['dstPort']) 
+            p_intent_result2 = main.ONOScli1.add_point_intent(ingress_device=device2, egress_device=device1, ipSrc=ip2, ipDst=ip1, 
+                                  ethType=main.params['SDNIP']['ethType'], ipProto=main.params['SDNIP']['tcpProto'], tcpDst=main.params['SDNIP']['dstPort'])
+
+            p_intent_result3 = main.ONOScli1.add_point_intent(ingress_device=device1, egress_device=device2, ipSrc=ip1, ipDst=ip2,
+                                  ethType=main.params['SDNIP']['ethType'], ipProto=main.params['SDNIP']['tcpProto'], tcpSrc=main.params['SDNIP']['srcPort'])
+            p_intent_result4 = main.ONOScli1.add_point_intent(ingress_device=device2, egress_device=device1, ipSrc=ip2, ipDst=ip1,
+                                  ethType=main.params['SDNIP']['ethType'], ipProto=main.params['SDNIP']['tcpProto'], tcpSrc=main.params['SDNIP']['srcPort']) 
+
+            p_intent_result = p_intent_result1 and p_intent_result2 and p_intent_result3 and p_intent_result4
+            if p_intent_result ==main.TRUE:
+                get_intent_result = main.ONOScli1.intents(json_format = False)
+                main.log.info(get_intent_result)
+                main.log.info("Point intent related to SDN-IP matching on TCP install successful")
+        
+        iperf_result = main.Mininet1.iperf('h8', 'h18') 
+        if iperf_result == main.TRUE:
+            main.log.report("iperf test successful")
+        else:
+            main.log.report("iperf test failed")
+
+
+        case32_result = p_intent_result and iperf_result
+        utilities.assert_equals(expect=main.TRUE, actual=case32_result,
+                onpass="Ping all test after Point intents addition related to SDN-IP on TCP match successful",
+                onfail="Ping all test after Point intents addition related to SDN-IP on TCP match failed")
+
+
+    def CASE33(self):
+        ''' 
+            This test case adds multipoint to singlepoint  intent related to SDN-IP matching on destination ip and the action is to rewrite the mac address 
+            Here the mac address to be rewritten is the mac address of the egress device
+        '''
+        import json
+        import time
+
+        main.log.report("This test case adds multipoint to singlepoint intent related to SDN-IP matching on destination ip and rewrite mac address action")
+        main.case("Adding multipoint to singlepoint intent related to SDN-IP matching on destination ip")
+        main.step("Adding bidirectional multipoint to singlepoint intent")
+        """
+        add-multi-to-single-intent --ipDst=10.0.3.0/24 --setEthDst=00:00:00:00:00:12 of:0000000000003008/1 0000000000003009/1 of:0000000000006018/1
+        
+        add-multi-to-single-intent --ipDst=10.0.1.0/24 --setEthDst=00:00:00:00:00:08 of:0000000000006018/1 0000000000003009/1 of:0000000000003008/1 
+        """    
+        
+        main.case("Installing multipoint to single point intent with rewrite mac address")
+        main.step("Uninstalling proxy arp app")
+        #Unistall onos-app-proxyarp app to disable reactive forwarding
+        appUninstall_result1 = main.ONOScli1.feature_uninstall("onos-app-proxyarp")
+        appUninstall_result2 = main.ONOScli2.feature_uninstall("onos-app-proxyarp")
+        appUninstall_result3 = main.ONOScli3.feature_uninstall("onos-app-proxyarp")
+        main.log.info("onos-app-proxyarp uninstalled") 
+
+        main.step("Changing ipaddress of hosts h8,h9 and h18")
+        main.Mininet1.changeIP(host='h8', intf='h8-eth0', newIP='10.0.1.1', newNetmask='255.255.255.0') 
+        main.Mininet1.changeIP(host='h9', intf='h9-eth0', newIP='10.0.2.1', newNetmask='255.255.255.0')
+        main.Mininet1.changeIP(host='h10', intf='h10-eth0', newIP='10.0.3.1', newNetmask='255.255.255.0')
+
+        main.step("Changing default gateway of hosts h8,h9 and h18")
+        main.Mininet1.changeDefaultGateway(host='h8', newGW='10.0.1.254')
+        main.Mininet1.changeDefaultGateway(host='h9', newGW='10.0.2.254')
+        main.Mininet1.changeDefaultGateway(host='h10', newGW='10.0.3.254')
+
+        main.step("Assigning random mac address to the default gateways since proxyarp app is uninstalled")
+        main.Mininet1.addStaticMACAddress(host='h8', GW='10.0.1.254', macaddr='00:00:00:00:11:11')
+        main.Mininet1.addStaticMACAddress(host='h9', GW='10.0.2.254', macaddr='00:00:00:00:22:22')
+        main.Mininet1.addStaticMACAddress(host='h10', GW='10.0.3.254', macaddr='00:00:00:00:33:33')
+         
+        main.step("Verify static gateway and MAC address assignment")
+        main.Mininet1.verifyStaticGWandMAC(host='h8')
+        main.Mininet1.verifyStaticGWandMAC(host='h9')
+        main.Mininet1.verifyStaticGWandMAC(host='h10')
+        
+        main.step("Adding multipoint to singlepoint intent")               
+        p_intent_result1 = main.ONOScli1.add_multipoint_to_singlepoint_intent(ingress_device1=main.params['MULTIPOINT_INTENT']['device1'], ingress_device2=main.params['MULTIPOINT_INTENT']['device2'],
+                                 egress_device=main.params['MULTIPOINT_INTENT']['device3'], ipDst=main.params['MULTIPOINT_INTENT']['ip1'], setEthDst=main.params['MULTIPOINT_INTENT']['mac1']) 
+        
+        p_intent_result2 = main.ONOScli1.add_multipoint_to_singlepoint_intent(ingress_device1=main.params['MULTIPOINT_INTENT']['device3'], ingress_device2=main.params['MULTIPOINT_INTENT']['device2'],                            
+                                egress_device=main.params['MULTIPOINT_INTENT']['device1'], ipDst=main.params['MULTIPOINT_INTENT']['ip2'], setEthDst=main.params['MULTIPOINT_INTENT']['mac2'])    
+
+
+        get_intent_result = main.ONOScli1.intents(json_format = False)
+        main.log.info("intents = "+ get_intent_result)
+        
+        time.sleep(10)
+        get_flows_result = main.ONOScli1.flows(json_format = False)
+        main.log.info("flows = " + get_flows_result) 
+
+        count = 1
+        i = 8
+        Ping_Result = main.TRUE
+       
+        main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+2))
+        ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+2))
+        if ping == main.FALSE and count <3:
+            count+=1
+            Ping_Result = main.FALSE
+            main.log.report("Ping between h" + str(i) + " and h" + str(i+2) + " failed. Making attempt number "+str(count) + " in 2 seconds")
+            time.sleep(2)
+        elif ping==main.FALSE:
+            main.log.report("All ping attempts between h" + str(i) + " and h" + str(i+10) +"have failed")
+            Ping_Result = main.FALSE
+        elif ping==main.TRUE:
+            main.log.info("Ping test between h" + str(i) + " and h" + str(i+2) + "passed!")
+            Ping_Result = main.TRUE
+        else:
+            main.log.info("Unknown error")
+            Ping_Result = main.ERROR
+        
+        if Ping_Result==main.FALSE:
+            main.log.report("Ping test failed.")
+            #main.cleanup()
+            #main.exit()
+        if Ping_Result==main.TRUE:
+            main.log.report("Ping all successful")
+
+
+        p_intent_result = p_intent_result1 and p_intent_result2
+        if p_intent_result ==main.TRUE:
+            main.log.info("Multi point intent with rewrite mac address installation successful")
+        else:
+            main.log.info("Multi point intent with rewrite mac address installation failed")
+      
+        case33_result = p_intent_result and Ping_Result
+        utilities.assert_equals(expect=main.TRUE, actual=case33_result,
+                onpass="Ping all test after multipoint to single point intent addition with rewrite mac address successful",
+                onfail="Ping all test after multipoint to single point intent addition with rewrite mac address failed")  
diff --git a/TestON/tests/MultiProd13/MultiProd13.topo b/TestON/tests/MultiProd13/MultiProd13.topo
new file mode 100755
index 0000000..a4fad91
--- /dev/null
+++ b/TestON/tests/MultiProd13/MultiProd13.topo
@@ -0,0 +1,98 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOSbench>
+
+        <ONOScli1>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli1>
+
+	 <ONOScli2>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli2>
+
+	 <ONOScli3>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli3>
+
+        <ONOS1>
+            <host>10.128.10.11</host>
+            <user>sdn</user>
+            <password>sdn</password>
+            <type>OnosCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1>
+
+	<ONOS2>
+            <host>10.128.10.11</host>
+            <user>sdn</user>
+            <password>sdn</password>
+            <type>OnosCliDriver</type>
+            <connect_order>6</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS2>
+	
+	<ONOS3>
+            <host>10.128.10.11</host>
+            <user>sdn</user>
+            <password>sdn</password>
+            <type>OnosCliDriver</type>
+            <connect_order>7</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS3>
+
+	
+        <Mininet1>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>8</connect_order>
+            <COMPONENTS>
+                #Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+                <arg2> --topo mytopo </arg2>
+                <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet1>
+
+        <Mininet2>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>RemoteMininetDriver</type>
+            <connect_order>9</connect_order>
+            <COMPONENTS>
+                #Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+                <arg2> --topo mytopo </arg2>
+                <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet2>
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/ONOSNextTest/ONOSNextTest.params b/TestON/tests/ONOSNextTest/ONOSNextTest.params
deleted file mode 100755
index d600eae..0000000
--- a/TestON/tests/ONOSNextTest/ONOSNextTest.params
+++ /dev/null
@@ -1,20 +0,0 @@
-<PARAMS>
-    
-    <testcases>1,5</testcases>
-
-    #Environment variables
-    <ENV>
-        <cellName>driver_test</cellName>
-    </ENV>
-
-    <CTRL>
-        <ip1>10.128.174.1</ip1>
-        <port1>6633</port1>
-    </CTRL>
-
-    <GIT>
-        <autoPull>off</autoPull>
-        <checkout>master</checkout>
-    </GIT>
-
-</PARAMS>
diff --git a/TestON/tests/ONOSNextTest/ONOSNextTest.py b/TestON/tests/ONOSNextTest/ONOSNextTest.py
deleted file mode 100755
index 3496771..0000000
--- a/TestON/tests/ONOSNextTest/ONOSNextTest.py
+++ /dev/null
@@ -1,335 +0,0 @@
-
-#Testing the basic functionality of ONOS Next
-#For sanity and driver functionality excercises only.
-
-import time
-import sys
-import os
-import re
-
-class ONOSNextTest:
-    def __init__(self):
-        self.default = ''
-
-    def CASE1(self, main):
-        '''
-        Startup sequence:
-        git pull
-        mvn clean install
-        onos-package
-        cell <name>
-        onos-verify-cell
-        onos-install -f
-        onos-wait-for-start
-        '''
-        import time
-
-        cell_name = main.params['ENV']['cellName']
-
-        ONOS1_ip = main.params['CTRL']['ip1']
-        ONOS1_port = main.params['CTRL']['port1']
-        
-        git_pull_trigger = main.params['GIT']['autoPull']
-        git_checkout_branch = main.params['GIT']['checkout']
-
-        main.case("Setting up test environment")
-        
-        main.step("Creating cell file")
-        #params: (bench ip, cell name, mininet ip, *onos ips)
-        cell_file_result = main.ONOSbench.create_cell_file(
-                "10.128.20.10", "temp_cell_2", "10.128.10.90",
-                "onos-core-trivial,onos-app-fwd",
-                "10.128.174.1")
-
-        main.step("Applying cell variable to environment")
-        #cell_result = main.ONOSbench.set_cell(cell_name)
-        cell_result = main.ONOSbench.set_cell("temp_cell_2")
-        verify_result = main.ONOSbench.verify_cell()
-       
-        if git_pull_trigger == 'on':
-            main.step("Git checkout and pull master")
-            main.ONOSbench.git_checkout(git_checkout_branch)
-            git_pull_result = main.ONOSbench.git_pull()
-        else:
-            main.log.info("Git checkout and pull skipped by config")
-            git_pull_result = main.TRUE
-
-        main.step("Using mvn clean & install")
-        #clean_install_result = main.ONOSbench.clean_install()
-        clean_install_result = main.TRUE
-
-        main.step("Creating ONOS package")
-        package_result = main.ONOSbench.onos_package()
-
-        main.step("Installing ONOS package")
-        onos_install_result = main.ONOSbench.onos_install()
-        onos1_isup = main.ONOSbench.isup()
-   
-        main.step("Starting ONOS service")
-        start_result = main.ONOSbench.onos_start(ONOS1_ip)
-
-        case1_result = (clean_install_result and package_result and\
-                cell_result and verify_result and onos_install_result and\
-                onos1_isup and start_result )
-        utilities.assert_equals(expect=main.TRUE, actual=case1_result,
-                onpass="Test startup successful",
-                onfail="Test startup NOT successful")
-
-        time.sleep(10)
-
-    def CASE11(self, main):
-        '''
-        Cleanup sequence:
-        onos-service <node_ip> stop
-        onos-uninstall
-
-        TODO: Define rest of cleanup
-        
-        '''
-
-        ONOS1_ip = main.params['CTRL']['ip1']
-
-        main.case("Cleaning up test environment")
-
-        main.step("Testing ONOS kill function")
-        kill_result = main.ONOSbench.onos_kill(ONOS1_ip)
-
-        main.step("Stopping ONOS service")
-        stop_result = main.ONOSbench.onos_stop(ONOS1_ip)
-
-        main.step("Uninstalling ONOS service") 
-        uninstall_result = main.ONOSbench.onos_uninstall()
-
-    def CASE3(self, main):
-        '''
-        Test 'onos' command and its functionality in driver
-        '''
-        
-        ONOS1_ip = main.params['CTRL']['ip1']
-
-        main.case("Testing 'onos' command")
-
-        main.step("Sending command 'onos -w <onos-ip> system:name'")
-        cmdstr1 = "system:name"
-        cmd_result1 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr1) 
-        main.log.info("onos command returned: "+cmd_result1)
-
-        main.step("Sending command 'onos -w <onos-ip> onos:topology'")
-        cmdstr2 = "onos:topology"
-        cmd_result2 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr2)
-        main.log.info("onos command returned: "+cmd_result2)
-        
-        main.step("Testing check_status")
-        check_status_results =  main.ONOSbench.check_status(ONOS1_ip, 4, 6)
-        main.log.info("Results of check_status " + str(check_status_results))
-
-        main.step("Sending command 'onos -w <onos-ip> bundle:list'")
-        cmdstr3 = "bundle:list"
-        cmd_result3 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr3)
-        main.log.info("onos command returned: "+cmd_result3)
-        case3_result = (cmd_result1 and cmd_result2 and\
-                check_status_results and cmd_result3 )
-        utilities.assert_equals(expect=main.TRUE, actual=case3_result,
-                onpass="Test case 3 successful",
-                onfail="Test case 3 NOT successful")
-
-    def CASE4(self, main):
-        import re
-        import time
-        main.case("Pingall Test(No intents are added)")
-        main.step("Assigning switches to controllers")
-        for i in range(1,5): #1 to (num of switches +1)
-            main.Mininet1.assign_sw_controller(sw=str(i), 
-                    ip1=ONOS1_ip, port1=ONOS1_port)
-        switch_mastership = main.TRUE
-        for i in range (1,5):
-            response = main.Mininet1.get_sw_controller("s"+str(i))
-            print("Response is " + str(response))
-            if re.search("tcp:"+ONOS1_ip,response):
-                switch_mastership = switch_mastership and main.TRUE
-            else:
-                switch_mastership = main.FALSE
-
-        #REACTIVE FWD test
-        main.step("Pingall")
-        ping_result = main.FALSE
-        while ping_result == main.FALSE:
-            time1 = time.time()
-            ping_result = main.Mininet1.pingall()
-            time2 = time.time()
-            print "Time for pingall: %2f seconds" % (time2 - time1)
-      
-        case4_result = switch_mastership and ping_result
-        utilities.assert_equals(expect=main.TRUE, actual=case4_result,
-                onpass="Pingall Test successful",
-                onfail="Pingall Test NOT successful")
-
-    def CASE5(self, main):
-        '''
-        Test the ONOS-cli functionality
-        
-        Below are demonstrations of what the 
-        ONOS cli driver functions can be used for.
-        '''
-        import time
-        import json
-
-        cell_name = main.params['ENV']['cellName']
-        ONOS1_ip = main.params['CTRL']['ip1']
-        
-        main.case("Testing the ONOS-cli")
-        
-        main.step("Set cell for ONOS-cli environment")
-        #main.ONOScli.set_cell(cell_name)
-        main.ONOScli.set_cell("temp_cell_2")
-
-        main.step("Start ONOS-cli")
-        main.ONOScli.start_onos_cli(ONOS1_ip)
-
-        main.step("issue command: onos:topology")
-        topology_obj = main.ONOScli.topology()
-
-        main.step("issue various feature:install <str> commands")
-        #main.ONOScli.feature_install("onos-app-fwd")
-        #main.ONOScli.feature_install("onos-rest")
-
-        main.step("Add a bad node")
-        node_result = main.ONOScli.add_node("111", "10.128.20.")
-        if node_result == main.TRUE:
-            main.log.info("Node successfully added")
-
-        main.step("Add a correct node")
-        node_result = main.ONOScli.add_node("111", "10.128.174.2")
-
-        main.step("Assign switches and list devices")
-        for i in range(1,8):
-            main.Mininet2.handle.sendline("sh ovs-vsctl set-controller s"+str(i)+
-                    " tcp:10.128.174.1")
-            main.Mininet2.handle.expect("mininet>")
-        #Need to sleep to allow switch add processing
-        time.sleep(5)
-        list_result = main.ONOScli.devices(json_format=False)
-        main.log.info(list_result)
-
-        main.step("Get all devices id")
-        devices_id_list = main.ONOScli.get_all_devices_id()
-        main.log.info(devices_id_list)
-
-        main.step("Get path and cost between device 1 and 7")
-        (path, cost) = main.ONOScli.paths(devices_id_list[0], devices_id_list[6])
-        main.log.info("Path: "+str(path))
-        main.log.info("Cost: "+str(cost))
-
-        main.step("Get nodes currently visible")
-        nodes_str = main.ONOScli.nodes()
-        main.log.info(nodes_str)
-
-        main.step("Get all nodes id's")
-        node_id_list = main.ONOScli.get_all_nodes_id()
-        main.log.info(node_id_list)
-
-        main.step("Set device "+str(devices_id_list[0])+" to role: standby")
-        device_role_result = main.ONOScli.device_role(
-                devices_id_list[0], node_id_list[0], "standby")
-        if device_role_result == main.TRUE:
-            main.log.report("Device role successfully set")
-
-        main.step("Revert device role to master")
-        device_role = main.ONOScli.device_role(
-                devices_id_list[0], node_id_list[0], "master")
-
-        main.step("Check devices / role again")
-        dev_result = main.ONOScli.devices(json_format=False)
-        main.log.info(dev_result)
-       
-        #Sample steps to push intents ***********
-        # * Obtain host id in ONOS format 
-        # * Push intents
-        main.step("Get list of hosts from Mininet")
-        host_list = main.Mininet2.get_hosts()
-        main.log.info(host_list)
-
-        main.step("Get host list in ONOS format")
-        host_onos_list = main.ONOScli.get_hosts_id(host_list)
-        main.log.info(host_onos_list)
-
-        time.sleep(5)
-
-        #We must use ping from hosts we want to add intents from 
-        #to make the hosts talk
-        #main.Mininet2.handle.sendline("\r")
-        #main.Mininet2.handle.sendline("h4 ping 10.1.1.1 -c 1 -W 1")
-        #time.sleep(3)
-        #main.Mininet2.handle.sendline("h5 ping 10.1.1.1 -c 1 -W 1")
-        #time.sleep(5)
-
-        main.ONOScli.feature_install("onos-app-fwd")
-        
-        main.Mininet2.pingall()
-
-        time.sleep(5)
-
-        main.step("Get hosts")
-        main.ONOScli.handle.sendline("hosts")
-        main.ONOScli.handle.expect("onos>")
-        hosts = main.ONOScli.handle.before
-        main.log.info(hosts)
-
-        main.step("Install host-to-host-intents")
-        intent_install1 = main.ONOScli.add_host_intent(
-                host_onos_list[0], host_onos_list[1])
-        intent_install2 = main.ONOScli.add_host_intent(
-                host_onos_list[2], host_onos_list[3])
-        intent_install3 = main.ONOScli.add_host_intent(
-                host_onos_list[4], host_onos_list[5])
-
-        main.log.info(intent_install1)
-        main.log.info(intent_install2)
-        main.log.info(intent_install3)
-
-        main.step("Get intents installed on ONOS")
-        get_intent_result = main.ONOScli.intents()
-        main.log.info(get_intent_result)
-        #****************************************
-
-        #Sample steps to delete intents ********
-        main.step("Get all intent id's")
-        intent_id = main.ONOScli.get_all_intents_id()
-        main.log.info(intent_id)
-
-        main.step("Remove specified intent id: "+str(intent_id[0]))
-        intent_result = main.ONOScli.remove_intent(intent_id[0])
-        main.log.info(intent_result)
-
-        main.step("Check installed intents again")
-        get_intent_result = main.ONOScli.intents()
-        main.log.info(get_intent_result)
-        #***************************************
-
-        #Sample steps to add point-to-point intents*
-        main.step("Add point-to-point intents")
-        ptp_intent_result = main.ONOScli.add_point_intent(
-                devices_id_list[0], 1, devices_id_list[1], 2)
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOScli.intents()
-            main.log.info("Point to point intent install successful")
-            main.log.info(get_intent_result)
-        #*******************************************
-
-        main.step("Print intents in json format")
-        intents = main.ONOScli.intents(json_format = True)
-        main.log.info(intents)
-
-        main.step("Add eth options in point-to-point intent")
-        ptp_eth = main.ONOScli.add_point_intent(
-                devices_id_list[2], 1, devices_id_list[3], 2,
-                ethSrc = "00:02", ethDst = "00:03")
-        main.log.info(ptp_eth)
-
-        main.step("Print intents with eth options")
-        intents = main.ONOScli.intents()
-        main.log.info(intents)
-######
-#jhall@onlab.us
-#andrew@onlab.us
-######
diff --git a/TestON/tests/ONOSNextTest/ONOSNextTest.topo b/TestON/tests/ONOSNextTest/ONOSNextTest.topo
deleted file mode 100755
index 0c84cc7..0000000
--- a/TestON/tests/ONOSNextTest/ONOSNextTest.topo
+++ /dev/null
@@ -1,61 +0,0 @@
-<TOPOLOGY>
-    <COMPONENT>
-
-        <ONOSbench>
-            <host>10.128.20.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosDriver</type>
-            <connect_order>1</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOSbench>
-
-        <ONOScli>
-            <host>10.128.20.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOScli>
-
-        <ONOS1>
-            <host>10.128.174.1</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS1>
-
-        <Mininet1>
-            <host>10.128.10.90</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>MininetCliDriver</type>
-            <connect_order>4</connect_order>
-            <COMPONENTS>
-                #Specify the Option for mininet
-                <arg1> --topo tree,2,3</arg1>
-                <arg2> </arg2>
-                <arg3> </arg3>
-                <controller> remote </controller>
-            </COMPONENTS>
-        </Mininet1>
-
-        <Mininet2>
-            <host>10.128.10.91</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>MininetCliDriver</type>
-            <connect_order>5</connect_order>
-            <COMPONENTS> 
-                <arg1> --custom topo-intentTPtest.py </arg1>
-                <arg2> --arp --mac</arg2>
-                <arg3> --topo mytopo</arg3>
-                <controller> remote </controller>
-            </COMPONENTS>
-        </Mininet2>
-
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/OnosCHO/OnosCHO.params b/TestON/tests/OnosCHO/OnosCHO.params
new file mode 100644
index 0000000..7856a28
--- /dev/null
+++ b/TestON/tests/OnosCHO/OnosCHO.params
@@ -0,0 +1,69 @@
+<PARAMS>
+    #CHO sequence : 1,2,3,[4,5,6,5,7,8,5,10,5,9,5,7,8,5,10,5]*2
+    # 1. ONOS brinup Test case
+    # 2. Assign and Balance all Mininet switches across controllers
+    # 3. Collect reference toplogy for topo compare
+    # 4. Enable Reactive forwarding, Verify ping all and disable onos-app-fwd
+    # 5. Compare curent topoology with reference
+    # 6. Install 300 host intents and verify ping all
+    # 7. Randomly bring some core links down and verify pingall
+    # 8. Bring core links Up that were down and verify pingall
+    # 9. Install 114 point intents and verify ping all
+    # 10. Remove all intents on ONOS
+    # 1,2,3,[4,5,6,5,7,8,5,10,5,9,5,7,8,5,10,5]*2
+
+    <testcases>1,2,3,9</testcases>
+    <ENV>
+        <cellName>choTest5</cellName>
+    </ENV>
+    <GIT>
+        #autoPull 'on' or 'off'
+        <autoPull>on</autoPull>
+        <branch>master</branch>
+    </GIT>
+    <CTRL>
+	<numCtrl>5</numCtrl>
+        <ip1>10.128.40.41</ip1>
+	<port1>6633</port1>
+	<ip2>10.128.40.42</ip2>
+	<port2>6633</port2>
+	<ip3>10.128.40.43</ip3>
+	<port3>6633</port3>
+        <ip4>10.128.40.44</ip4>
+	<port4>6633</port4>
+	<ip5>10.128.40.45</ip5>
+	<port5>6633</port5>
+    </CTRL>
+    <HOSTS>
+	<startMAC>00:00:00:00:00:01</startMAC>
+	<endMAC>00:00:00:00:00:19</endMAC>
+    </HOSTS>
+    <ONOSTOPO>
+	<numDevices>25</numDevices>
+	<numLinks>114</numLinks>
+	<numHosts>25</numHosts>
+	<numIntents>300</numIntents>
+	<numPaths>1360</numPaths>
+    </ONOSTOPO>
+    <CORELINKS>
+        <toggleLinks>3</toggleLinks>
+	
+	<linkS3a>s3</linkS3a>
+	<linkS3b>s1,s4,s7,s10,s16,s17,s18,s21,s22</linkS3b>
+	#######s1,s4,s7,s10,s16,s17,s18,s21,s22########
+	
+	<linkS14a>s14</linkS14a>
+	<linkS14b>s6,s9,s10,s11,s12,s13,s16,s17,s23</linkS14b>
+	########s6,s9,s10,s11,s12,s13,s16,s17,s18,s23########
+	
+	<linkS18a>s18</linkS18a>
+	<linkS18b>s14,s16,s17,s19,s20,s21,s22,s23</linkS18b>
+	#######s3,s14,s16,s17,s19,s20,s21,s22,s23########
+    </CORELINKS>
+
+    <timers>
+        <LinkDiscovery>5</LinkDiscovery>
+        <SwitchDiscovery>31</SwitchDiscovery>
+    </timers>
+
+</PARAMS>
diff --git a/TestON/tests/OnosCHO/OnosCHO.py b/TestON/tests/OnosCHO/OnosCHO.py
new file mode 100644
index 0000000..3a838fa
--- /dev/null
+++ b/TestON/tests/OnosCHO/OnosCHO.py
@@ -0,0 +1,596 @@
+import time
+import sys
+import os
+import re
+import time
+import json
+import itertools
+
+class OnosCHO:
+    def __init__(self):
+        self.default = ''
+        global deviceDPIDs
+        global hostMACs
+        global deviceLinks
+        global deviceActiveLinksCount
+        global devicePortsEnabledCount
+        global installedIntents
+        global randomLink1, randomLink2, randomLink3, numSwitches, numLinks
+    def CASE1(self, main):
+        '''
+        Startup sequence:
+        git pull
+        mvn clean install
+        onos-package
+        cell <name>
+        onos-verify-cell
+        onos-install -f
+        onos-wait-for-start
+        '''
+        import time
+        cell_name = main.params['ENV']['cellName']
+        git_pull = main.params['GIT']['autoPull']
+        numCtrls = main.params['CTRL']['numCtrl']
+        git_branch = main.params['GIT']['branch']
+
+        main.case("Set up test environment")
+        main.log.report("Set up test environment")
+        main.log.report("_______________________")
+                
+        main.step("Git checkout and pull "+git_branch)
+        if git_pull == 'on':
+            checkout_result = main.ONOSbench.git_checkout(git_branch)
+            pull_result = main.ONOSbench.git_pull()
+            cp_result = (checkout_result and pull_result)
+        else:
+            checkout_result = main.TRUE
+            pull_result = main.TRUE
+            main.log.info("Skipped git checkout and pull")
+            cp_result = (checkout_result and pull_result)
+        utilities.assert_equals(expect=main.TRUE, actual=cp_result,
+                onpass="Test step PASS",
+                onfail="Test step FAIL")
+		
+        main.step("mvn clean & install")
+        mvn_result = main.ONOSbench.clean_install()
+        utilities.assert_equals(expect=main.TRUE, actual=mvn_result,
+                onpass="Test step PASS",
+                onfail="Test step FAIL")
+
+        main.ONOSbench.get_version(report=True)
+
+        main.step("Apply Cell environment for ONOS")
+        cell_result = main.ONOSbench.set_cell(cell_name)
+        utilities.assert_equals(expect=main.TRUE, actual=cell_result,
+                onpass="Test step PASS",
+                onfail="Test step FAIL")
+
+        main.step("Create ONOS package")
+        packageResult = main.ONOSbench.onos_package()
+        utilities.assert_equals(expect=main.TRUE, actual=packageResult,
+                onpass="Test step PASS",
+                onfail="Test step FAIL")
+
+        main.step("Uninstall ONOS package on all Nodes")
+        uninstallResult=main.TRUE
+        for i in range(1,int(numCtrls)+1):
+            ONOS_ip = main.params['CTRL']['ip'+str(i)]
+            main.log.info("Unintsalling package on ONOS Node IP: "+ONOS_ip)
+            u_result= main.ONOSbench.onos_uninstall(ONOS_ip)
+            utilities.assert_equals(expect=main.TRUE, actual=u_result,
+                onpass="Test step PASS",
+                onfail="Test step FAIL")
+            uninstallResult=(uninstallResult and u_result)
+
+        main.step("Removing copy-cat logs from ONOS nodes")
+        main.ONOSbench.onos_remove_raft_logs()
+
+        main.step("Install ONOS package on all Nodes")
+        installResult=main.TRUE
+        for i in range(1,int(numCtrls)+1):
+            ONOS_ip = main.params['CTRL']['ip'+str(i)]
+            main.log.info("Intsalling package on ONOS Node IP: "+ONOS_ip)
+            i_result= main.ONOSbench.onos_install(node=ONOS_ip)
+            utilities.assert_equals(expect=main.TRUE, actual=i_result,
+                onpass="Test step PASS",
+                onfail="Test step FAIL")
+            installResult=(installResult and i_result)
+
+        main.step("Verify ONOS nodes UP status")
+        statusResult=main.TRUE
+        for i in range(1,int(numCtrls)+1):
+            ONOS_ip = main.params['CTRL']['ip'+str(i)]
+            main.log.info("ONOS Node "+ONOS_ip+" status:")
+            onos_status = main.ONOSbench.onos_status(node=ONOS_ip)
+            utilities.assert_equals(expect=main.TRUE, actual=onos_status,
+                onpass="Test step PASS",
+                onfail="Test step FAIL")
+            statusResult=(statusResult and onos_status)   
+
+        main.step("Start ONOS CLI on all nodes")
+        cliResult = main.TRUE
+        time.sleep(15) # need to wait here for sometime. This will be removed once ONOS is stable enough
+        for i in range(1,int(numCtrls)+1):
+            ONOS_ip = main.params['CTRL']['ip'+str(i)]
+            ONOScli = 'ONOScli'+str(i)
+            main.log.info("ONOS Node "+ONOS_ip+" cli start:")
+            exec "startcli=main."+ONOScli+".start_onos_cli(ONOS_ip)"
+            utilities.assert_equals(expect=main.TRUE, actual=startcli,
+                onpass="Test step PASS",
+                onfail="Test step FAIL")
+            cliResult = (cliResult and startcli) 
+
+        case1Result = (cp_result and cell_result 
+                and packageResult and installResult and statusResult and cliResult)
+        utilities.assert_equals(expect=main.TRUE, actual=case1Result,
+                onpass="Set up test environment PASS",
+                onfail="Set up test environment FAIL")
+
+    def CASE2(self, main):
+        ''' 
+        This test script still needs more refactoring
+        '''
+        import re
+        import time
+        import copy
+        numCtrls = main.params['CTRL']['numCtrl']
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+        ONOS4_ip = main.params['CTRL']['ip4']
+        ONOS5_ip = main.params['CTRL']['ip5']
+        ONOS1_port = main.params['CTRL']['port1']
+        ONOS2_port = main.params['CTRL']['port2']
+        ONOS3_port = main.params['CTRL']['port3']
+        ONOS4_port = main.params['CTRL']['port4']
+        ONOS5_port = main.params['CTRL']['port5']
+
+        numCtrls = main.params['CTRL']['numCtrl']
+        main.log.report("Assign and Balance all Mininet switches across controllers")
+        main.log.report("_________________________________________________________")
+        time.sleep(15) # need to wait here for sometime. This will be removed once ONOS is stable enough
+        main.case("Assign and Balance all Mininet switches across controllers")
+        main.step("Assign switches to controllers")
+        for i in range(1,26): #1 to (num of switches +1)
+            main.Mininet1.assign_sw_controller(sw=str(i),count=int(numCtrls), 
+                    ip1=ONOS1_ip, port1=ONOS1_port,
+                    ip2=ONOS2_ip, port2=ONOS2_port,
+		            ip3=ONOS3_ip, port3=ONOS3_port, ip4=ONOS4_ip, port4=ONOS4_port, 
+			    ip5=ONOS5_ip, port5=ONOS5_port)
+
+        switch_mastership = main.TRUE
+        for i in range (1,26):
+            response = main.Mininet1.get_sw_controller("s"+str(i))
+            print("Response is " + str(response))
+            if re.search("tcp:"+ONOS1_ip,response):
+                switch_mastership = switch_mastership and main.TRUE
+            else:
+                switch_mastership = main.FALSE
+
+        if switch_mastership == main.TRUE:
+            main.log.report("Controller assignment successfull")
+        else:
+             main.log.report("Controller assignment failed")
+        time.sleep(5)
+
+        main.step("Balance devices across controllers")
+        for i in range(int(numCtrls)):
+            balanceResult = main.ONOScli1.balance_masters()
+            time.sleep(3) # giving some breathing time for ONOS to complete re-balance
+
+        utilities.assert_equals(expect=main.TRUE, actual=balanceResult,
+                onpass="Assign and Balance devices test PASS",
+                onfail="Assign and Balance devices test FAIL")
+
+    def CASE3(self,main) :
+        ''' 
+        This Test case will be extended to collect and store more data related
+        ONOS state.
+        '''
+        import re
+        import copy
+        deviceDPIDs = []
+        hostMACs = []
+        deviceLinks = []
+        deviceActiveLinksCount = []
+        devicePortsEnabledCount = []
+
+        main.log.report("Collect and Store topology details from ONOS before running any Tests")
+        main.log.report("____________________________________________________________________")        
+        main.case ("Collect and Store Topology Deatils from ONOS")
+
+        main.step("Collect and store current number of switches and links")
+        topology_output = main.ONOScli1.topology()
+        topology_result = main.ONOSbench.get_topology(topology_output)
+        numSwitches = topology_result['devices']
+        numLinks = topology_result['links']
+        main.log.info("Currently there are %s switches and %s links"  %(str(numSwitches), str(numLinks)))
+
+        main.step("Store Device DPIDs")
+        for i in range(1,26):
+            deviceDPIDs.append("of:00000000000000"+format(i, '02x'))
+        print "Device DPIDs in Store: \n", str(deviceDPIDs)
+
+        main.step("Store Host MACs")
+        for i in range(1,26):
+            hostMACs.append("00:00:00:00:00:"+format(i, '02x')+"/-1")
+        print "Host MACs in Store: \n", str(hostMACs)
+
+        main.step("Collect and store all Devices Links")
+        linksResult = main.ONOScli1.links(json_format=False)
+        ansi_escape = re.compile(r'\x1b[^m]*m')
+        linksResult = ansi_escape.sub('', linksResult)
+        linksResult = linksResult.replace(" links","").replace("\r\r","")
+        linksResult=linksResult.splitlines()
+        linksResult = linksResult[1:]
+        deviceLinks = copy.copy(linksResult)
+        print "Device Links Stored: \n", str(deviceLinks)
+        print "Length of Links Store", len(deviceLinks) # this will be asserted to check with the params provided count of links
+
+        main.step("Collect and store each Device ports enabled Count")
+        for i in range(1,26):
+            portResult = main.ONOScli1.getDevicePortsEnabledCount("of:00000000000000"+format(i, '02x'))
+            portTemp = re.split(r'\t+', portResult)
+            portCount = portTemp[1].replace("\r\r\n\x1b[32m","")
+            devicePortsEnabledCount.append(portCount)
+        print "Device Enabled Port Counts Stored: \n", str(devicePortsEnabledCount)
+
+        main.step("Collect and store each Device active links Count")
+        for i in range(1,26):
+            linkCountResult = main.ONOScli1.getDeviceLinksActiveCount("of:00000000000000"+format(i, '02x'))
+            linkCountTemp = re.split(r'\t+', linkCountResult)
+            linkCount = linkCountTemp[1].replace("\r\r\n\x1b[32m","")
+            deviceActiveLinksCount.append(linkCount)
+        print "Device Active Links Count Stored: \n", str(deviceActiveLinksCount)
+
+        caseResult = main.TRUE  # just returning TRUE for now as this one just collects data
+        utilities.assert_equals(expect=main.TRUE, actual=case1Result,
+                onpass="Saving ONOS topology data test PASS",
+                onfail="Saving ONOS topology data test FAIL")
+
+    def CASE4(self,main) :
+        ''' 
+        Enable onos-app-fwd, Verify Reactive forwarding through ping all and Disable it 
+        '''
+        import re
+        import copy
+        import time
+        numCtrls = main.params['CTRL']['numCtrl']
+        main.log.report("Enable Reactive forwarding and Verify ping all")
+        main.log.report("______________________________________________")        
+        main.case ("Enable Reactive forwarding and Verify ping all")
+        main.step("Enable Reactive forwarding")
+        installResult = main.TRUE
+        for i in range(1,int(numCtrls)+1):
+            onosFeature = 'onos-app-fwd'
+            ONOS_ip = main.params['CTRL']['ip'+str(i)]
+            ONOScli = 'ONOScli'+str(i)
+            main.log.info("Enabling Reactive mode on ONOS Node "+ONOS_ip)
+            exec "inResult=main."+ONOScli+".feature_install(onosFeature)"
+            installResult = inResult and installResult
+
+        time.sleep(5)
+
+        main.step("Verify Pingall")
+        ping_result = main.FALSE
+        time1 = time.time()
+        ping_result = main.Mininet1.pingall()
+        time2 = time.time()
+        timeDiff = round((time2-time1),2)
+        main.log.report("Time taken for Ping All: "+str(timeDiff)+" seconds")
+
+        if ping_result == main.TRUE:
+            main.log.report("Pingall Test in Reactive mode successful")
+        else:
+            main.log.report("Pingall Test in Reactive mode failed")
+
+        main.step("Disable Reactive forwarding")
+        uninstallResult = main.TRUE
+        for i in range(1,int(numCtrls)+1):
+            onosFeature = 'onos-app-fwd'
+            ONOS_ip = main.params['CTRL']['ip'+str(i)]
+            ONOScli = 'ONOScli'+str(i)
+            main.log.info("Disabling Reactive mode on ONOS Node "+ONOS_ip)
+            exec "unResult=main."+ONOScli+".feature_uninstall(onosFeature)"
+            uninstallResult = unResult and uninstallResult
+
+        #Waiting for reative flows to be cleared.
+        time.sleep(10)
+
+        case3Result = installResult and ping_result and uninstallResult
+        utilities.assert_equals(expect=main.TRUE, actual=case3Result,
+                onpass="Reactive Mode Pingall test PASS",
+                onfail="Reactive Mode Pingall test FAIL")
+
+    def CASE5(self,main) :
+        '''
+        Compare current ONOS topology with reference data
+        '''  
+        import re
+        devicesDPID_tmp = []
+        hostMACs_tmp = []
+        deviceLinks_tmp = []
+        deviceActiveLinksCount_tmp = []
+        devicePortsEnabledCount_tmp = []
+
+        main.log.report("Compare ONOS topology with reference data in Stores")
+        main.log.report("__________________________________________________")        
+        main.case ("Compare ONOS topology with reference data")
+	     
+        main.step("Compare current Device ports enabled with reference")
+        for i in range(1,26):
+            portResult = main.ONOScli1.getDevicePortsEnabledCount("of:00000000000000"+format(i, '02x'))
+            portTemp = re.split(r'\t+', portResult)
+            portCount = portTemp[1].replace("\r\r\n\x1b[32m","")
+            devicePortsEnabledCount_tmp.append(portCount)
+            time.sleep(2)
+        print ("Device Enabled ports EXPECTED: \n"+ str(devicePortsEnabledCount))
+        print ("Device Enabled ports ACTUAL: \n"+ str(devicePortsEnabledCount_tmp))
+        if (cmp(devicePortsEnabledCount,devicePortsEnabledCount_tmp)==0):
+            stepResult1 = main.TRUE
+        else:
+            stepResult1 = main.FALSE
+
+        main.step("Compare Device active links with reference")
+        for i in range(1,26):
+            linkResult = main.ONOScli1.getDeviceLinksActiveCount("of:00000000000000"+format(i, '02x'))
+            linkTemp = re.split(r'\t+', linkResult)
+            linkCount = linkTemp[1].replace("\r\r\n\x1b[32m","")
+            deviceActiveLinksCount_tmp.append(linkCount)
+            time.sleep(3)
+        print ("Device Active links EXPECTED: \n"+str(deviceActiveLinksCount))
+        print ("Device Active links ACTUAL: \n"+str(deviceActiveLinksCount_tmp))
+        if (cmp(deviceActiveLinksCount,deviceActiveLinksCount_tmp)==0):
+            stepResult2 = main.TRUE
+        else:
+            stepResult2 = main.FALSE
+
+        '''
+        place holder for comparing devices, hosts and paths if required. 
+        Links and ports data would be incorrect with out devices anyways.
+        '''
+
+        caseResult=(stepResult1 and stepResult2)
+        utilities.assert_equals(expect=main.TRUE, actual=case1Result,
+                onpass="Compare Topology test PASS",
+                onfail="Compare Topology test FAIL")
+        if caseResult == main.TRUE:
+            main.log.report("Compare Topology test Pass")
+
+    def CASE6(self):
+        '''
+        Install 300 host intents and verify ping all
+        '''
+        main.log.report("Add 300 host intents and verify pingall")
+        main.log.report("_______________________________________")
+        import itertools
+        main.case("Install 300 host intents")
+        main.step("Add host Intents")
+        intentResult=main.TRUE
+        hostCombos = list(itertools.combinations(hostMACs, 2))
+        for i in range(len(hostCombos)):
+            iResult = main.ONOScli1.add_host_intent(hostCombos[i][0],hostCombos[i][1])
+            intentResult=(intentResult and iResult)
+
+        main.step("Verify Ping across all hosts")
+        pingResult = main.FALSE
+        time1 = time.time()
+        pingResult = main.Mininet1.pingall()
+        time2 = time.time()
+        timeDiff = round((time2-time1),2)
+        main.log.report("Time taken for Ping All: "+str(timeDiff)+" seconds")
+        utilities.assert_equals(expect=main.TRUE, actual=pingResult,
+                onpass="PING ALL PASS",
+                onfail="PING ALL FAIL")
+
+        case4Result=(intentResult and pingResult)
+        utilities.assert_equals(expect=main.TRUE, actual=case4Result,
+                onpass="Install 300 Host Intents and Ping All test PASS",
+                onfail="Install 300 Host Intents and Ping All test FAIL")
+
+    def CASE7(self,main):
+        '''
+        Randomly bring some core links down and verify ping all
+        '''
+        import random
+        ONOS1_ip = main.params['CTRL']['ip1']
+        link1End1 = main.params['CORELINKS']['linkS3a']
+        link1End2 = main.params['CORELINKS']['linkS3b'].split(',')
+        link2End1 = main.params['CORELINKS']['linkS14a']
+        link2End2 = main.params['CORELINKS']['linkS14b'].split(',')
+        link3End1 = main.params['CORELINKS']['linkS18a']
+        link3End2 = main.params['CORELINKS']['linkS18b'].split(',')
+        switchLinksToToggle = main.params['CORELINKS']['toggleLinks']
+        link_sleep = int(main.params['timers']['LinkDiscovery'])
+
+        main.log.report("Randomly bring some core links down and verify ping all")
+        main.log.report("____________________________________________________")        
+        main.case("Randomly bring some core links down and verify ping all")
+        main.step("Verify number of Switch links to toggle on each Core Switch are between 1 - 5")
+        if (int(switchLinksToToggle) == 0 or int(switchLinksToToggle) > 5):
+            main.log.info("Please check you PARAMS file. Valid range for number of switch links to toggle is between 1 to 5")
+            main.cleanup()
+            main.exit()
+        else:
+            main.log.info("User provided Core switch links range to toggle is correct, proceeding to run the test")
+
+        main.step("Cut links on Core devices using user provided range")
+        randomLink1 = random.sample(link1End2,int(switchLinksToToggle))
+        randomLink2 = random.sample(link2End2,int(switchLinksToToggle))
+        randomLink3 = random.sample(link3End2,int(switchLinksToToggle))
+        for i in range(int(switchLinksToToggle)):
+            main.Mininet1.link(END1=link1End1,END2=randomLink1[i],OPTION="down")
+            main.Mininet1.link(END1=link2End1,END2=randomLink2[i],OPTION="down")
+            main.Mininet1.link(END1=link3End1,END2=randomLink3[i],OPTION="down")
+        time.sleep(link_sleep)
+
+        topology_output = main.ONOScli2.topology()
+        linkDown = main.ONOSbench.check_status(topology_output,numSwitches,str(int(numLinks)-int(switchLinksToToggle)*6))
+        utilities.assert_equals(expect=main.TRUE,actual=linkDown,
+                onpass="Link Down discovered properly",
+                onfail="Link down was not discovered in "+ str(link_sleep) + " seconds")
+
+        main.step("Verify Ping across all hosts")
+        pingResultLinkDown = main.FALSE
+        time1 = time.time()
+        pingResultLinkDown = main.Mininet1.pingall()
+        time2 = time.time()
+        timeDiff = round((time2-time1),2)
+        main.log.report("Time taken for Ping All: "+str(timeDiff)+" seconds")
+        utilities.assert_equals(expect=main.TRUE, actual=pingResultLinkDown,
+                onpass="PING ALL PASS",
+                onfail="PING ALL FAIL")
+
+        caseResult7 = linkDown and pingResultLinkDown
+        utilities.assert_equals(expect=main.TRUE, actual=caseResult7,
+                onpass="Random Link cut Test PASS",
+                onfail="Random Link cut Test FAIL")
+
+    def CASE8(self,main):
+        '''
+        Bring the core links up that are down and verify ping all
+        '''
+        import random
+        ONOS1_ip = main.params['CTRL']['ip1']
+        link1End1 = main.params['CORELINKS']['linkS3a']
+        link2End1 = main.params['CORELINKS']['linkS14a']
+        link3End1 = main.params['CORELINKS']['linkS18a']
+        link_sleep = int(main.params['timers']['LinkDiscovery'])
+        switchLinksToToggle = main.params['CORELINKS']['toggleLinks']
+
+        main.log.report("Bring the core links up that are down and verify ping all")
+        main.log.report("_____________________________________________________")        
+        main.case("Bring the core links up that are down and verify ping all")
+        main.step("Bring randomly cut links on Core devices up")
+        for i in range(int(switchLinksToToggle)): 
+            main.Mininet1.link(END1=link1End1,END2=randomLink1[i],OPTION="up")
+            main.Mininet1.link(END1=link2End1,END2=randomLink2[i],OPTION="up")
+            main.Mininet1.link(END1=link3End1,END2=randomLink3[i],OPTION="up")
+        time.sleep(link_sleep)
+
+        topology_output = main.ONOScli2.topology()
+        linkUp = main.ONOSbench.check_status(topology_output,numSwitches,str(numLinks))
+        utilities.assert_equals(expect=main.TRUE,actual=linkUp,
+                onpass="Link up discovered properly",
+                onfail="Link up was not discovered in "+ str(link_sleep) + " seconds")
+
+        main.step("Verify Ping across all hosts")
+        pingResultLinkUp = main.FALSE
+        time1 = time.time()
+        pingResultLinkUp = main.Mininet1.pingall()
+        time2 = time.time()
+        timeDiff = round((time2-time1),2)
+        main.log.report("Time taken for Ping All: "+str(timeDiff)+" seconds")
+        utilities.assert_equals(expect=main.TRUE, actual=pingResultLinkUp,
+                onpass="PING ALL PASS",
+                onfail="PING ALL FAIL")
+
+        caseResult8 = linkUp and pingResultLinkUp
+        utilities.assert_equals(expect=main.TRUE, actual=caseResult8,
+                onpass="Link Up Test PASS",
+                onfail="Link Up Test FAIL")    
+
+    def CASE9(self):
+        '''
+        Install 114 point intents and verify Ping all works
+        '''
+        import copy
+        main.log.report("Install 114 point intents and verify Ping all")
+        main.log.report("___________________________________________")        
+        main.case("Install 114 point intents and Ping all")
+        deviceLinks_copy = copy.copy(deviceLinks)
+        main.step("Install 114 point intents")
+        for i in range(len(deviceLinks_copy)):
+            pointLink = str(deviceLinks_copy[i]).replace("src=","").replace("dst=","").split(',')
+            point1 = pointLink[0].split('/')
+            point2 = pointLink[1].split('/')
+            installResult = main.ONOScli1.add_point_intent(point1[0],point2[0],int(point1[1]),int(point2[1]))
+            if installResult == main.TRUE:
+                print "Installed Point intent between :",point1[0], int(point1[1]), point2[0], int(point2[1])
+
+        main.step("Obtain the intent id's")
+        intentsList = main.ONOScli1.getAllIntentIds()
+        ansi_escape = re.compile(r'\x1b[^m]*m')
+        intentsList = ansi_escape.sub('', intentsList)
+        intentsList = intentsList.replace(" onos:intents | grep id=","").replace("id=","").replace("\r\r","")
+        intentsList=intentsList.splitlines()
+        intentsList = intentsList[1:]
+        intentIdList = []
+        for i in range(len(intentsList)):
+            intentsTemp = intentsList[i].split(',')
+            intentIdList.append(intentsTemp[0])
+        print "Intent IDs: ", intentIdList
+        print "Total Intents installed: ", len(intentIdList)
+
+        main.step("Verify Ping across all hosts")
+        pingResult = main.FALSE
+        time1 = time.time()
+        pingResult = main.Mininet1.pingall()
+        time2 = time.time()
+        timeDiff = round((time2-time1),2)
+        main.log.report("Time taken for Ping All: "+str(timeDiff)+" seconds")
+        utilities.assert_equals(expect=main.TRUE, actual=pingResult,
+                onpass="PING ALL PASS",
+                onfail="PING ALL FAIL")
+
+        case8_result = installResult and pingResult
+        utilities.assert_equals(expect=main.TRUE, actual=case8_result,
+                onpass="Ping all test after Point intents addition successful",
+                onfail="Ping all test after Point intents addition failed")
+
+    def CASE10(self):
+        '''
+         Remove all Intents
+        ''' 
+        main.log.report("Remove all intents that were installed previously")
+        main.log.report("______________________________________________")        
+        main.log.info("Remove all intents")
+        main.case("Removing intents")
+        main.step("Obtain the intent id's first")
+        intentsList = main.ONOScli1.getAllIntentIds()
+        ansi_escape = re.compile(r'\x1b[^m]*m')
+        intentsList = ansi_escape.sub('', intentsList)
+        intentsList = intentsList.replace(" onos:intents | grep id=","").replace("id=","").replace("\r\r","")
+        intentsList=intentsList.splitlines()
+        intentsList = intentsList[1:]
+        intentIdList = []
+        step1Result = main.TRUE
+        if (len(intentsList) > 1):
+            for i in range(len(intentsList)):
+                intentsTemp = intentsList[i].split(',')
+                intentIdList.append(intentsTemp[0])
+            print "Intent IDs: ", intentIdList
+            for id in range(len(intentIdList)):
+                print "Removing intent id (round 1) :", intentIdList[id]
+                main.ONOScli1.remove_intent(intent_id = intentIdList[id])
+                time.sleep(1)
+
+            main.log.info("Verify all intents are removed and if any leftovers try remove one more time")
+            intentsList1 = main.ONOScli1.getAllIntentIds()
+            ansi_escape = re.compile(r'\x1b[^m]*m')
+            intentsList1 = ansi_escape.sub('', intentsList1)
+            intentsList1 = intentsList1.replace(" onos:intents | grep id=","").replace(" state=","").replace("\r\r","")
+            intentsList1=intentsList1.splitlines()
+            intentsList1 = intentsList1[1:]
+            print "Round 2 (leftover) intents to remove: ", intentsList1
+            intentIdList1 = []
+            if (len(intentsList1) > 1):
+                for i in range(len(intentsList1)):
+                    intentsTemp1 = intentsList[i].split(',')
+                    intentIdList1.append(intentsTemp1[0])
+                print "Leftover Intent IDs: ", intentIdList1
+                for id in range(len(intentIdList1)):
+                    print "Removing intent id (round 2):", intentIdList1[id]
+                    main.ONOScli1.remove_intent(intent_id = intentIdList1[id])
+                    time.sleep(2)
+            else:
+                print "There are no more intents that need to be removed"
+                step1Result = main.TRUE
+        else:
+            print "No Intent IDs found in Intents list: ", intentsList
+            step1Result = main.FALSE
+
+        caseResult7 = step1Result
+        utilities.assert_equals(expect=main.TRUE, actual=caseResult7,
+                onpass="Intent removal test successful",
+                onfail="Intent removal test failed")
\ No newline at end of file
diff --git a/TestON/tests/OnosCHO/OnosCHO.topo b/TestON/tests/OnosCHO/OnosCHO.topo
new file mode 100644
index 0000000..2a79611
--- /dev/null
+++ b/TestON/tests/OnosCHO/OnosCHO.topo
@@ -0,0 +1,133 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>10.128.40.40</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOSbench>
+
+        <ONOScli1>
+            <host>10.128.40.40</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli1>
+
+	 <ONOScli2>
+            <host>10.128.40.40</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli2>
+
+	 <ONOScli3>
+            <host>10.128.40.40</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli3>
+
+        <ONOScli4>
+            <host>10.128.40.40</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli4>
+
+	 <ONOScli5>
+            <host>10.128.40.40</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>6</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli5>
+	
+        <ONOS1>
+            <host>10.128.40.40</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>7</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1>
+
+	<ONOS2>
+            <host>10.128.40.40</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>8</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS2>
+	
+	<ONOS3>
+            <host>10.128.40.40</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>9</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS3>
+
+        <ONOS4>
+            <host>10.128.40.40</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>10</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS4>
+
+	<ONOS5>
+            <host>10.128.40.40</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>11</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS5>
+	
+        <Mininet1>
+            <host>10.128.40.40</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>12</connect_order>
+            <COMPONENTS>
+                #Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/att-mpls-topo.py </arg1>
+                <arg2> --topo att </arg2>
+                <arg3> --link tc --switch ovs,protocols=OpenFlow13 </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet1>
+
+        <Mininet2>
+            <host>10.128.40.40</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>RemoteMininetDriver</type>
+            <connect_order>13</connect_order>
+            <COMPONENTS>
+                #Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/att-mpls-topo.py </arg1>
+                <arg2> --topo att </arg2>
+                <arg3> --link tc --switch ovs,protocols=OpenFlow13 </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet2>
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/JonTest/__init__.py b/TestON/tests/OnosCHO/__init__.py
similarity index 100%
copy from TestON/tests/JonTest/__init__.py
copy to TestON/tests/OnosCHO/__init__.py
diff --git a/TestON/tests/PingallExample/PingallExample.params b/TestON/tests/PingallExample/PingallExample.params
new file mode 100644
index 0000000..aecaab6
--- /dev/null
+++ b/TestON/tests/PingallExample/PingallExample.params
@@ -0,0 +1,12 @@
+<PARAMS>
+    <testcases>1,2,3</testcases>
+    <ENV>
+        <cellName>HA</cellName>
+    </ENV>
+    <Git>True</Git>
+
+    <CTRL>
+        <ip1>10.128.30.11</ip1>
+        <port1>6633</port1>
+    </CTRL>
+</PARAMS>
diff --git a/TestON/tests/PingallExample/PingallExample.py b/TestON/tests/PingallExample/PingallExample.py
new file mode 100644
index 0000000..faf374f
--- /dev/null
+++ b/TestON/tests/PingallExample/PingallExample.py
@@ -0,0 +1,162 @@
+"""
+Description: This test is an example of a simple single node ONOS test
+
+List of test cases:
+CASE1: Compile ONOS and push it to the test machine
+CASE2: Assign mastership to controller
+CASE3: Pingall
+"""
+class PingallExample:
+
+    def __init__( self ) :
+        self.default = ''
+
+    def CASE1( self, main ) :
+        """
+           CASE1 is to compile ONOS and push it to the test machines
+
+           Startup sequence:
+           git pull
+           mvn clean install
+           onos-package
+           cell <name>
+           onos-verify-cell
+           onos-install -f
+           onos-wait-for-start
+        """
+        desc = "ONOS Single node cluster restart HA test - initialization"
+        main.log.report( desc )
+        main.case( "Setting up test environment" )
+
+        # load some vairables from the params file
+        PULL_CODE = False
+        if main.params[ 'Git' ] == 'True':
+            PULL_CODE = True
+        cell_name = main.params[ 'ENV' ][ 'cellName' ]
+
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+
+        main.step( "Applying cell variable to environment" )
+        cell_result = main.ONOSbench.set_cell( cell_name )
+        verify_result = main.ONOSbench.verify_cell()
+
+        main.log.report( "Uninstalling ONOS" )
+        main.ONOSbench.onos_uninstall( ONOS1_ip )
+
+        clean_install_result = main.TRUE
+        git_pull_result = main.TRUE
+
+        main.step( "Compiling the latest version of ONOS" )
+        if PULL_CODE:
+            main.step( "Git checkout and pull master" )
+            main.ONOSbench.git_checkout( "master" )
+            git_pull_result = main.ONOSbench.git_pull()
+
+            main.step( "Using mvn clean & install" )
+            clean_install_result = main.TRUE
+            if git_pull_result == main.TRUE:
+                clean_install_result = main.ONOSbench.clean_install()
+            else:
+                main.log.warn( "Did not pull new code so skipping mvn " +
+                               "clean install" )
+        main.ONOSbench.get_version( report=True )
+
+        cell_result = main.ONOSbench.set_cell( cell_name )
+        verify_result = main.ONOSbench.verify_cell()
+        main.step( "Creating ONOS package" )
+        package_result = main.ONOSbench.onos_package()
+
+        main.step( "Installing ONOS package" )
+        onos1_install_result = main.ONOSbench.onos_install( options="-f",
+                                                            node=ONOS1_ip )
+
+        main.step( "Checking if ONOS is up yet" )
+        for i in range( 2 ):
+            onos1_isup = main.ONOSbench.isup( ONOS1_ip )
+            if onos1_isup:
+                break
+        if not onos1_isup:
+            main.log.report( "ONOS1 didn't start!" )
+
+        # TODO: if it becomes an issue, we can retry this step  a few times
+
+        cli_result = main.ONOScli1.start_onos_cli( ONOS1_ip )
+
+        case1_result = ( clean_install_result and package_result and
+                         cell_result and verify_result and
+                         onos1_install_result and
+                         onos1_isup and cli_result )
+
+        utilities.assert_equals( expect=main.TRUE, actual=case1_result,
+                                 onpass="Test startup successful",
+                                 onfail="Test startup NOT successful" )
+
+        if case1_result == main.FALSE:
+            main.cleanup()
+            main.exit()
+
+    def CASE2( self, main ) :
+        """
+           Assign mastership to controller
+        """
+        import re
+
+        main.log.report( "Assigning switches to controller" )
+        main.case( "Assigning Controller" )
+        main.step( "Assign switches to controller" )
+
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS1_port = main.params[ 'CTRL' ][ 'port1' ]
+
+        for i in range( 1, 14 ):
+            main.Mininet1.assign_sw_controller(
+                sw=str( i ),
+                ip1=ONOS1_ip,
+                port1=ONOS1_port )
+
+        mastership_check = main.TRUE
+        for i in range( 1, 14 ):
+            response = main.Mininet1.get_sw_controller( "s" + str( i ) )
+            try:
+                main.log.info( str( response ) )
+            except:
+                main.log.info( repr( response ) )
+            if re.search( "tcp:" + ONOS1_ip, response ):
+                mastership_check = mastership_check and main.TRUE
+            else:
+                mastership_check = main.FALSE
+        if mastership_check == main.TRUE:
+            main.log.report( "Switch mastership assigned correctly" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=mastership_check,
+            onpass="Switch mastership assigned correctly",
+            onfail="Switches not assigned correctly to controllers" )
+
+    def CASE3( self, main ) :
+        """
+           Assign intents
+        """
+        import time
+
+        main.log.report( "Run Pingall" )
+        main.case( "Run Pingall" )
+
+        # install onos-app-fwd
+        main.log.info( "Install reactive forwarding app" )
+        main.ONOScli1.feature_install( "onos-app-fwd" )
+
+        # REACTIVE FWD test
+        ping_result = main.FALSE
+        time1 = time.time()
+        ping_result = main.Mininet1.pingall()
+        time2 = time.time()
+        main.log.info( "Time for pingall: %2f seconds" % ( time2 - time1 ) )
+
+        # uninstall onos-app-fwd
+        main.log.info( "Uninstall reactive forwarding app" )
+        main.ONOScli1.feature_uninstall( "onos-app-fwd" )
+
+        utilities.assert_equals( expect=main.TRUE, actual=ping_result,
+                                 onpass="All hosts are reachable",
+                                 onfail="Some pings failed" )
diff --git a/TestON/tests/JonTest/JonTest.topo b/TestON/tests/PingallExample/PingallExample.topo
old mode 100755
new mode 100644
similarity index 60%
rename from TestON/tests/JonTest/JonTest.topo
rename to TestON/tests/PingallExample/PingallExample.topo
index bf8cb18..1712756
--- a/TestON/tests/JonTest/JonTest.topo
+++ b/TestON/tests/PingallExample/PingallExample.topo
@@ -4,7 +4,7 @@
         <ONOSbench>
             <host>10.128.30.10</host>
             <user>admin</user>
-            <password>onos_test</password>
+            <password></password>
             <type>OnosDriver</type>
             <connect_order>1</connect_order>
             <COMPONENTS> </COMPONENTS>
@@ -13,21 +13,12 @@
         <ONOScli1>
             <host>10.128.30.10</host>
             <user>admin</user>
-            <password>onos_test</password>
+            <password></password>
             <type>OnosCliDriver</type>
             <connect_order>2</connect_order>
             <COMPONENTS> </COMPONENTS>
         </ONOScli1>
 
-        <ONOScli2>
-            <host>10.128.30.10</host>
-            <user>admin</user>
-            <password>onos_test</password>
-            <type>OnosCliDriver</type>
-            <connect_order>2</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOScli2>
-
         <ONOS1>
             <host>10.128.30.11</host>
             <user>sdn</user>
@@ -37,24 +28,15 @@
             <COMPONENTS> </COMPONENTS>
         </ONOS1>
 
-        <ONOS2>
-            <host>10.128.30.12</host>
-            <user>sdn</user>
-            <password>rocks</password>
-            <type>OnosDriver</type>
-            <connect_order>3</connect_order>
-            <COMPONENTS> </COMPONENTS>
-        </ONOS2>
-
         <Mininet1>
-            <host>10.128.11.11</host>
+            <host>10.128.30.9</host>
             <user>admin</user>
-            <password>onos_test</password>
+            <password></password>
             <type>MininetCliDriver</type>
             <connect_order>4</connect_order>
             <COMPONENTS>
                 #Specify the Option for mininet
-                <arg1> --topo tree,2,3</arg1>
+                <arg1> --topo=tree,3,3 </arg1>
                 <arg2> </arg2>
                 <arg3> </arg3>
                 <controller> remote </controller>
diff --git a/TestON/tests/PoxTest/__init__.py b/TestON/tests/PingallExample/__init__.py
similarity index 100%
rename from TestON/tests/PoxTest/__init__.py
rename to TestON/tests/PingallExample/__init__.py
diff --git a/TestON/tests/PoxTest/.svn/entries b/TestON/tests/PoxTest/.svn/entries
deleted file mode 100644
index b51d7ac..0000000
--- a/TestON/tests/PoxTest/.svn/entries
+++ /dev/null
@@ -1,171 +0,0 @@
-9
-
-dir
-65
-svn://192.168.150.61/OpenFlow/tests/PoxTest
-svn://192.168.150.61/OpenFlow
-
-
-
-2012-12-05T18:46:42.405397Z
-65
-paxterra
-
-
-svn:special svn:externals svn:needs-lock
-
-
-
-
-
-
-
-
-
-
-
-8b1d8634-a80c-44fc-ab7b-cc53e6f68013
-
-
-
-
-
-
-0
-
-PoxTest.params
-file
-
-
-
-
-2012-12-05T16:08:24.000000Z
-e79bef68fc6f00acd8bf2028a7e2cab0
-2012-12-05T18:46:42.405397Z
-65
-paxterra
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-326
-
-PoxTest.py
-file
-
-
-
-
-2012-12-05T16:08:24.000000Z
-4a2b2aaeb2a2eeed4b70f1adebca7231
-2012-12-05T18:46:42.405397Z
-65
-paxterra
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-637
-
-PoxTest.topo
-file
-
-
-
-
-2012-12-05T16:08:24.000000Z
-827eb99b5a13c33d371ffc6aca740464
-2012-12-05T18:46:42.405397Z
-65
-paxterra
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-805
-
-__init__.py
-file
-
-
-
-
-2012-12-05T16:08:24.000000Z
-d41d8cd98f00b204e9800998ecf8427e
-2012-12-05T18:46:42.405397Z
-65
-paxterra
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-0
-
diff --git a/TestON/tests/PoxTest/.svn/format b/TestON/tests/PoxTest/.svn/format
deleted file mode 100644
index ec63514..0000000
--- a/TestON/tests/PoxTest/.svn/format
+++ /dev/null
@@ -1 +0,0 @@
-9
diff --git a/TestON/tests/PoxTest/.svn/text-base/PoxTest.params.svn-base b/TestON/tests/PoxTest/.svn/text-base/PoxTest.params.svn-base
deleted file mode 100644
index bbadcaa..0000000
--- a/TestON/tests/PoxTest/.svn/text-base/PoxTest.params.svn-base
+++ /dev/null
@@ -1,12 +0,0 @@
-[PARAMS]
-    'testcases' = '[1]'
-    'mail' = 'anilkumar.s@paxterrasolutions.com,paxweb@paxterrasolutions.com'
-    #'log_dir' = '/home/user/Desktop/openflow_logs/'
-    [[CASE1]]
-        'destination' = 'h2'
-        'src' = 'h2'
-        'target'= 'h3'
-        'controller' = 'c1'
-        [[[STEP1]]]
-            'host' = 'h2'
-
diff --git a/TestON/tests/PoxTest/.svn/text-base/PoxTest.py.svn-base b/TestON/tests/PoxTest/.svn/text-base/PoxTest.py.svn-base
deleted file mode 100644
index 49e63af..0000000
--- a/TestON/tests/PoxTest/.svn/text-base/PoxTest.py.svn-base
+++ /dev/null
@@ -1,15 +0,0 @@
-class PoxTest:
-    '''
-    Testing Basic Pox Functionalities
-    '''
-    def __init__(self):
-        self.default = ""
-
-    def CASE1(self,main):
-        main.case("Checking the control flow of POX")
-        main.step("Checking the host reachability using pingHost ")
-        
-        result = main.Mininet1.pingHost(src=main.params['CASE1']['src'],
-                                        target=main.params['CASE1']['target'],
-                                        controller=main.params['CASE1']['controller'])
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Ping executed successfully",onfail="Ping Failed")
diff --git a/TestON/tests/PoxTest/.svn/text-base/PoxTest.topo.svn-base b/TestON/tests/PoxTest/.svn/text-base/PoxTest.topo.svn-base
deleted file mode 100644
index b4560cb..0000000
--- a/TestON/tests/PoxTest/.svn/text-base/PoxTest.topo.svn-base
+++ /dev/null
@@ -1,25 +0,0 @@
-[TOPOLOGY]
-
-    [[COMPONENT]]
-        [[["Mininet1"]]]
-            'host' = '192.168.56.101'
-            'user' = 'openflow'
-            'password' = 'openflow'
-            'type' = "Mininet"
-            [[[["COMPONENTS"]]]]
-                # Specify the Option for mininet
-                'topo' = 'single'
-                'topocount' = '3'
-                'switch' = 'ovsk'
-                'controller' = 'remote'
-        [[["POX2"]]]
-            'host' = '192.168.56.101'
-            'user' = 'openflow'
-            'password' = 'openflow'
-            'type' = 'POX'
-            'test_target' = '1'
-            'no-cli' = '1' #or '0' if want to run in cli mode
-            [[[["COMPONENTS"]]]]
-                'pox_lib_location' = "/home/openflow/pox/"
-                [[[[["samples.of_tutorial"]]]]]
-
diff --git a/TestON/tests/PoxTest/.svn/text-base/__init__.py.svn-base b/TestON/tests/PoxTest/.svn/text-base/__init__.py.svn-base
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/PoxTest/.svn/text-base/__init__.py.svn-base
+++ /dev/null
diff --git a/TestON/tests/PoxTest/PoxTest.ospk b/TestON/tests/PoxTest/PoxTest.ospk
deleted file mode 100644
index cadc43e..0000000
--- a/TestON/tests/PoxTest/PoxTest.ospk
+++ /dev/null
@@ -1,7 +0,0 @@
-CASE 1
-    NAME "Checking the control flow of POX"
-    STEP "Checking the host reachability using pingHost"
-    ON Mininet1 DO pingHost USING src AS CASE["src"], target AS CASE["target"], controller AS CASE["controller"] AND STORE LAST_RESULT IN result
-    ASSERT result EQUALS main.TRUE ONPASS "Ping executed successfully" ONFAIL "Ping failed"
-
-
diff --git a/TestON/tests/PoxTest/PoxTest.params b/TestON/tests/PoxTest/PoxTest.params
deleted file mode 100644
index dfff20e..0000000
--- a/TestON/tests/PoxTest/PoxTest.params
+++ /dev/null
@@ -1,13 +0,0 @@
-<PARAMS>
-    <testcases> [1]</testcases>
-    <mail> anil4haart@gmail.com,paxweb@paxterrasolutions.com</mail>
-    <CASE1>
-        <destination> h2</destination>
-        <src>h2</src>
-        <target> h3 </target>
-        <controller> c1 </controller>
-        <STEP1>
-            <host> h2</host>
-        </STEP1> 
-    </CASE1>
-</PARAMS>
diff --git a/TestON/tests/PoxTest/PoxTest.py b/TestON/tests/PoxTest/PoxTest.py
deleted file mode 100644
index f9e4722..0000000
--- a/TestON/tests/PoxTest/PoxTest.py
+++ /dev/null
@@ -1,29 +0,0 @@
-'''
-	
- *   TestON is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation, either version 2 of the License, or
- *   (at your option) any later version.
-
- *   TestON is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
-
-
-'''
-
-class PoxTest :
-
-    def __init__(self) :
-        self.default = ''
-
-    def CASE1(self,main) :
-
-        main.case("Checking the control flow of POX")
-        main.step("Checking the host reachability using pingHost")
-        main.Mininet1.pingHost(src=main.params['CASE1']['src'], target=main.params['CASE1']['target'], controller=main.params['CASE1']['controller'])
-        result = main.last_result
-        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Ping executed successfully",onfail="Ping failed")
-    
-    
diff --git a/TestON/tests/PoxTest/PoxTest.topo b/TestON/tests/PoxTest/PoxTest.topo
deleted file mode 100644
index e42a300..0000000
--- a/TestON/tests/PoxTest/PoxTest.topo
+++ /dev/null
@@ -1,31 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <Mininet1>
-            <host>192.168.56.101</host>
-            <user> openflow</user>
-            <password> openflow</password>
-            <type>MininetCliDriver</type>
-            <COMPONENTS>
-                # Specify the Option for mininet
-                <topo> single</topo>
-                <topocount>3</topocount>
-                <switch> ovsk </switch>
-                <controller> remote </controller>
-             </COMPONENTS>   
-        </Mininet1>        
-        <POX2>
-            <host> 192.168.56.101 </host>
-            <user>  openflow </user>
-            <password> openflow </password>
-            <type> PoxCliDriver </type>
-            <test_target> 1 </test_target>
-            <COMPONENTS>
-                <pox_lib_location> /home/openflow/pox/  </pox_lib_location>
-                <samples.of_tutorial></samples.of_tutorial>
-            </COMPONENTS>
-        </POX2>
-
-        
-    </COMPONENT>
-</TOPOLOGY>
\ No newline at end of file
diff --git a/TestON/tests/FuncNext/FuncNext.params b/TestON/tests/ProdFunc/ProdFunc.params
similarity index 77%
rename from TestON/tests/FuncNext/FuncNext.params
rename to TestON/tests/ProdFunc/ProdFunc.params
index 34d8a56..5de8118 100755
--- a/TestON/tests/FuncNext/FuncNext.params
+++ b/TestON/tests/ProdFunc/ProdFunc.params
@@ -1,6 +1,6 @@
 <PARAMS>
     
-    <testcases>1,4,5,7,3</testcases>
+    <testcases>1,4,10,5,6,7,8,9,2,8,20,21,22,10,23,24</testcases>
 
     #Environment variables
     <ENV>
@@ -8,7 +8,7 @@
     </ENV>
 
     <CTRL>
-        <ip1>10.128.60.11</ip1>
+        <ip1>10.128.20.11</ip1>
         <port1>6633</port1>
     </CTRL>
 
@@ -37,7 +37,13 @@
 
     <timers>
         <LinkDiscovery>5</LinkDiscovery>
-        <SwitchDiscovery>31</SwitchDiscovery>
+        <SwitchDiscovery>15</SwitchDiscovery>
     </timers>
 
+    <OPTICAL>
+        <jsonfile> /home/admin/ONOS/tools/test/topos/oe-nonlinear-4.json </jsonfile>
+    </OPTICAL>    
+
+
+
 </PARAMS>
diff --git a/TestON/tests/ProdFunc/ProdFunc.py b/TestON/tests/ProdFunc/ProdFunc.py
new file mode 100755
index 0000000..b786e8b
--- /dev/null
+++ b/TestON/tests/ProdFunc/ProdFunc.py
@@ -0,0 +1,1100 @@
+
+#Testing the basic functionality of ONOS Next
+#For sanity and driver functionality excercises only.
+
+import time
+import sys
+import os
+import re
+import json
+
+time.sleep(1)
+class ProdFunc:
+    def __init__(self):
+        self.default = ''
+
+    def CASE1(self, main):
+        '''
+        Startup sequence:
+        cell <name>
+        onos-verify-cell
+        onos-remove-raft-log
+        git pull
+        mvn clean install
+        onos-package
+        onos-install -f
+        onos-wait-for-start
+        '''
+        
+        cell_name = main.params['ENV']['cellName']
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS1_port = main.params['CTRL']['port1']
+        
+        main.case("Setting up test environment")
+        main.log.report("This testcase is testing setting up test environment")
+        main.log.report("__________________________________") 
+
+        main.step("Applying cell variable to environment")
+        cell_result = main.ONOSbench.set_cell(cell_name)
+        verify_result = main.ONOSbench.verify_cell()
+        
+        main.step("Removing raft logs before a clen installation of ONOS")
+        main.ONOSbench.onos_remove_raft_logs()
+
+        main.step("Git checkout and pull master and get version")
+        main.ONOSbench.git_checkout("master")
+        git_pull_result = main.ONOSbench.git_pull()
+        main.log.info("git_pull_result = " +git_pull_result)
+        version_result = main.ONOSbench.get_version(report=True)
+    
+        if git_pull_result == 1:
+            main.step("Using mvn clean & install")
+            clean_install_result = main.ONOSbench.clean_install()
+            #clean_install_result = main.TRUE
+        elif git_pull_result == 0:
+            main.log.report("Git Pull Failed, look into logs for detailed reason")
+            main.cleanup()
+            main.exit() 
+         
+        main.step("Creating ONOS package")
+        package_result = main.ONOSbench.onos_package()
+
+
+        main.step("Installing ONOS package")
+        onos_install_result = main.ONOSbench.onos_install()
+        if onos_install_result == main.TRUE:
+            main.log.report("Installing ONOS package successful")
+        else:
+            main.log.report("Installing ONOS package failed")
+
+        onos1_isup = main.ONOSbench.isup()
+        if onos1_isup == main.TRUE:
+            main.log.report("ONOS instance is up and ready")  
+        else:
+            main.log.report("ONOS instance may not be up")  
+       
+        main.step("Starting ONOS service")
+        start_result = main.ONOSbench.onos_start(ONOS1_ip)
+        
+        main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])        
+
+        case1_result = (package_result and\
+                cell_result and verify_result and onos_install_result and\
+                onos1_isup and start_result )
+        utilities.assert_equals(expect=main.TRUE, actual=case1_result,
+                onpass="Test startup successful",
+                onfail="Test startup NOT successful")
+
+    def CASE2(self, main) :
+        '''  
+        Switch Down
+        '''
+        #NOTE: You should probably run a topology check after this
+        import time 
+        import json
+ 
+        main.case("Switch down discovery")
+        main.log.report("This testcase is testing a switch down discovery")
+        main.log.report("__________________________________")
+
+        switch_sleep = int(main.params['timers']['SwitchDiscovery'])
+
+        description = "Killing a switch to ensure it is discovered correctly"
+        main.log.report(description)
+        main.case(description)
+
+        #TODO: Make this switch parameterizable
+        main.step("Kill s28 ")
+        main.log.report("Deleting s28")
+        #FIXME: use new dynamic topo functions
+        main.Mininet1.del_switch("s28")
+        main.log.info("Waiting " + str(switch_sleep) + " seconds for switch down to be discovered")
+        time.sleep(switch_sleep)
+        #Peek at the deleted switch
+        device = main.ONOS2.get_device(dpid="0028")
+        print "device = ", device
+        if device[u'available'] == 'False':
+            case2_result = main.FALSE
+        else:
+            case2_result = main.TRUE
+        utilities.assert_equals(expect=main.TRUE, actual=case2_result,
+                onpass="Switch down discovery successful",
+                onfail="Switch down discovery failed")
+
+    def CASE11(self, main):
+        '''
+        Cleanup sequence:
+        onos-service <node_ip> stop
+        onos-uninstall
+
+        TODO: Define rest of cleanup
+        
+        '''
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+
+        main.case("Cleaning up test environment")
+
+        main.step("Testing ONOS kill function")
+        kill_result = main.ONOSbench.onos_kill(ONOS1_ip)
+
+        main.step("Stopping ONOS service")
+        stop_result = main.ONOSbench.onos_stop(ONOS1_ip)
+
+        main.step("Uninstalling ONOS service") 
+        uninstall_result = main.ONOSbench.onos_uninstall()
+
+    def CASE3(self, main):
+        '''
+        Test 'onos' command and its functionality in driver
+        '''
+        
+        ONOS1_ip = main.params['CTRL']['ip1']
+
+        main.case("Testing 'onos' command")
+
+        main.step("Sending command 'onos -w <onos-ip> system:name'")
+        cmdstr1 = "system:name"
+        cmd_result1 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr1) 
+        main.log.info("onos command returned: "+cmd_result1)
+
+        main.step("Sending command 'onos -w <onos-ip> onos:topology'")
+        cmdstr2 = "onos:topology"
+        cmd_result2 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr2)
+        main.log.info("onos command returned: "+cmd_result2)
+
+
+    def CASE20(self):
+        '''
+            Exit from mininet cli
+            reinstall ONOS
+        '''
+        cell_name = main.params['ENV']['cellName']
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS1_port = main.params['CTRL']['port1']
+        
+        main.log.report("This testcase exits the mininet cli and reinstalls ONOS to switch over to Packet Optical topology")
+        main.log.report("_____________________________________________")
+        main.case("Disconnecting mininet and restarting ONOS")
+        main.step("Disconnecting mininet and restarting ONOS")
+        mininet_disconnect = main.Mininet1.disconnect()
+
+        main.step("Removing raft logs before a clen installation of ONOS")
+        main.ONOSbench.onos_remove_raft_logs()
+
+        main.step("Applying cell variable to environment")
+        cell_result = main.ONOSbench.set_cell(cell_name)
+        verify_result = main.ONOSbench.verify_cell()
+
+        onos_install_result = main.ONOSbench.onos_install()
+        if onos_install_result == main.TRUE:
+            main.log.report("Installing ONOS package successful")
+        else:
+            main.log.report("Installing ONOS package failed")
+
+        onos1_isup = main.ONOSbench.isup()
+        if onos1_isup == main.TRUE:
+            main.log.report("ONOS instance is up and ready")
+        else:
+            main.log.report("ONOS instance may not be up")
+
+        main.step("Starting ONOS service")
+        start_result = main.ONOSbench.onos_start(ONOS1_ip)
+      
+        main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1']) 
+        print "mininet_disconnect =", mininet_disconnect
+        print "onos_install_result =", onos_install_result
+        print "onos1_isup =", onos1_isup
+        print "start_result =", start_result
+ 
+        case20_result = mininet_disconnect and cell_result and onos_install_result and onos1_isup and start_result
+        utilities.assert_equals(expect=main.TRUE, actual=case20_result,
+                onpass="Exiting functionality mininet topology and reinstalling ONOS successful",
+                onfail="Exiting functionality mininet topology and reinstalling ONOS failed") 
+
+    def CASE21(self, main):
+        import time
+        '''
+            On ONOS bench, run this command: ./~/ONOS/tools/test/bin/onos-topo-cfg
+            which starts the rest and copies the links json file to the onos instance
+            Note that in case of Packet Optical, the links are not learnt from the topology, instead the links are learnt 
+            from the json config file
+        ''' 
+        main.log.report("This testcase starts the packet layer topology and REST")
+        main.log.report("_____________________________________________")
+        main.case("Starting LINC-OE and other components")
+        main.step("Starting LINC-OE and other components")
+        start_console_result = main.LincOE1.start_console()
+        optical_mn_script = main.LincOE2.run_optical_mn_script()
+        onos_topo_cfg_result = main.ONOSbench.run_onos_topo_cfg(instance_name = main.params['CTRL']['ip1'], json_file = main.params['OPTICAL']['jsonfile'])
+            
+        print "start_console_result =",start_console_result 
+        print "optical_mn_script = ",optical_mn_script 
+        print "onos_topo_cfg_result =",onos_topo_cfg_result 
+
+        case21_result = start_console_result and optical_mn_script and onos_topo_cfg_result
+        utilities.assert_equals(expect=main.TRUE, actual=case21_result,
+                onpass="Packet optical topology spawned successsfully",
+                onfail="Packet optical topology spawning failed") 
+
+
+    def CASE22(self, main):
+        '''
+            Curretly we use, 4 linear switch optical topology and 2 packet layer mininet switches each with one host.
+             Therefore, the roadmCount variable = 4, packetLayerSWCount variable = 2, hostCount =2
+            and this is hardcoded in the testcase. If the topology changes, these hardcoded values need to be changed
+        '''
+
+        main.log.report("This testcase compares the optical+packet topology against what is expected")
+        main.case("Topology comparision")
+        main.step("Topology comparision")
+        main.ONOS3.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
+        devices_result = main.ONOS3.devices(json_format = False)
+
+        print "devices_result = ", devices_result
+        devices_linewise = devices_result.split("\n")
+        devices_linewise = devices_linewise[1:-1]
+        roadmCount = 0
+        packetLayerSWCount = 0
+        for line in devices_linewise:
+            components = line.split(",")
+            availability = components[1].split("=")[1]
+            type = components[3].split("=")[1]
+            if availability == 'true' and type == 'ROADM':
+                roadmCount += 1
+            elif availability == 'true' and type =='SWITCH':
+                packetLayerSWCount += 1
+        if roadmCount == 4:
+            print "Number of Optical Switches = %d and is correctly detected" %roadmCount
+            main.log.info ("Number of Optical Switches = " +str(roadmCount) +" and is correctly detected")
+            opticalSW_result = main.TRUE
+        else:
+            print "Number of Optical Switches = %d and is wrong" %roadCount
+            main.log.info ("Number of Optical Switches = " +str(roadmCount) +" and is wrong")
+            opticalSW_result = main.FALSE
+
+        if packetLayerSWCount == 2:
+            print "Number of Packet layer or mininet Switches = %d and is correctly detected" %packetLayerSWCount
+            main.log.info("Number of Packet layer or mininet Switches = " +str(packetLayerSWCount) + " and is correctly detected")
+            packetSW_result = main.TRUE
+        else:
+            print "Number of Packet layer or mininet Switches = %d and is wrong" %packetLayerSWCount
+            main.log.info("Number of Packet layer or mininet Switches = " +str(packetLayerSWCount) + " and is wrong")
+            packetSW_result = main.FALSE
+        print "_________________________________"
+        
+        links_result = main.ONOS3.links(json_format = False)
+        print "links_result = ", links_result
+        print "_________________________________"
+        
+        #NOTE:Since only point intents are added, there is no requirement to discover the hosts
+                #Therfore, the below portion of the code is commented.
+        '''
+        #Discover hosts using pingall
+        pingall_result = main.LincOE2.pingall()    
+    
+        hosts_result = main.ONOS3.hosts(json_format = False)
+        main.log.info("hosts_result = "+hosts_result)   
+        main.log.info("_________________________________")
+        hosts_linewise = hosts_result.split("\n")
+        hosts_linewise = hosts_linewise[1:-1]
+        hostCount = 0
+        for line in hosts_linewise:
+            hostid = line.split(",")[0].split("=")[1]
+            hostCount +=1
+        if hostCount ==2:
+            print "Number of hosts = %d and is correctly detected" %hostCount
+            main.log.info("Number of hosts = " + str(hostCount) +" and is correctly detected")
+            hostDiscovery = main.TRUE
+        else:
+            print "Number of hosts = %d and is wrong" %hostCount
+            main.log.info("Number of hosts = " + str(hostCount) +" and is wrong")
+            hostDiscovery = main.FALSE
+        '''
+
+        case22_result = opticalSW_result and packetSW_result
+        utilities.assert_equals(expect=main.TRUE, actual=case22_result,
+                onpass="Packet optical topology discovery successful",
+                onfail="Packet optical topology discovery failed")
+
+    def CASE23(self, main):
+        import time
+        '''
+            Add bidirectional point intents between 2 packet layer(mininet) devices and 
+            ping mininet hosts
+        '''
+        main.log.report("This testcase adds bidirectional point intents between 2 packet layer(mininet) devices and ping mininet hosts")
+        main.case("Topology comparision")
+        main.step("Adding point intents")
+        ptp_intent_result = main.ONOS3.add_point_intent("of:0000ffffffff0001/1", "of:0000ffffffff0002/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS3.intents(json_format = False)
+            main.log.info("Point to point intent install successful")
+
+        ptp_intent_result = main.ONOS3.add_point_intent("of:0000ffffffff0002/1", "of:0000ffffffff0001/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS3.intents(json_format = False)
+            main.log.info("Point to point intent install successful")
+
+        time.sleep(10)
+        flowHandle = main.ONOS3.flows()
+        main.log.info("flows :" + flowHandle)
+
+        # Sleep for 30 seconds to provide time for the intent state to change
+        time.sleep(30)
+        intentHandle = main.ONOS3.intents(json_format = False)        
+        main.log.info("intents :" + intentHandle)        
+ 
+        Ping_Result = main.TRUE
+        count = 1
+        main.log.info("\n\nh1 is Pinging h2")
+        ping = main.LincOE2.pingHostOptical(src="h1", target="h2")
+        #ping = main.LincOE2.pinghost()
+        if ping == main.FALSE and count<5:
+            count+=1
+            Ping_Result = main.FALSE
+            main.log.info("Ping between h1 and h2  failed. Making attempt number "+str(count) + " in 2 seconds")
+            time.sleep(2)
+        elif ping==main.FALSE:
+            main.log.info("All ping attempts between h1 and h2 have failed")
+            Ping_Result = main.FALSE
+        elif ping==main.TRUE:
+            main.log.info("Ping test between h1 and h2 passed!")
+            Ping_Result = main.TRUE
+        else:
+            main.log.info("Unknown error")
+            Ping_Result = main.ERROR
+        
+        if Ping_Result==main.FALSE:
+            main.log.report("Point intents for packet optical have not ben installed correctly. Cleaning up")
+        if Ping_Result==main.TRUE:
+            main.log.report("Point Intents for packet optical have been installed correctly")
+
+        case23_result = Ping_Result
+        utilities.assert_equals(expect=main.TRUE, actual=case23_result,
+                onpass="Point intents addition for packet optical and Pingall Test successful",
+                onfail="Point intents addition for packet optical and Pingall Test NOT successful")
+
+
+
+    def CASE24(self, main):
+        import time
+        import json
+        '''
+            Test Rerouting of Packet Optical by bringing a port down (port 22) of a switch(switchID=1), so that link (between switch1 port22 - switch4-port30) is inactive
+            and do a ping test. If rerouting is successful, ping should pass. also check the flows
+        '''
+        main.log.report("This testcase tests rerouting and pings mininet hosts")
+        main.case("Test rerouting and pings mininet hosts")
+        main.step("Bring a port down and verify the link state")
+        main.LincOE1.port_down(sw_id="1", pt_id="22") 
+        links_nonjson = main.ONOS3.links(json_format = False)
+        main.log.info("links = " +links_nonjson)
+
+        links = main.ONOS3.links()
+        main.log.info("links = " +links)
+        
+        links_result = json.loads(links)
+        links_state_result = main.FALSE
+        for item in links_result:
+            if item['src']['device'] == "of:0000ffffffffff01" and item['src']['port'] == "22":
+                if item['dst']['device'] == "of:0000ffffffffff04" and item['dst']['port'] == "30":
+                    links_state = item['state']
+                    if links_state == "INACTIVE":
+                        main.log.info("Links state is inactive as expected due to one of the ports being down")
+                        main.log.report("Links state is inactive as expected due to one of the ports being down")
+                        links_state_result = main.TRUE
+                        break
+                    else:
+                        main.log.info("Links state is not inactive as expected")
+                        main.log.report("Links state is not inactive as expected")
+                        links_state_result = main.FALSE
+
+        print "links_state_result = ", links_state_result
+        time.sleep(10)
+        flowHandle = main.ONOS3.flows()
+        main.log.info("flows :" + flowHandle)
+
+        main.step("Verify Rerouting by a ping test")
+        Ping_Result = main.TRUE
+        count = 1        
+        main.log.info("\n\nh1 is Pinging h2")
+        ping = main.LincOE2.pingHostOptical(src="h1", target="h2")
+        #ping = main.LincOE2.pinghost()
+        if ping == main.FALSE and count<5:
+            count+=1
+            Ping_Result = main.FALSE
+            main.log.info("Ping between h1 and h2  failed. Making attempt number "+str(count) + " in 2 seconds")
+            time.sleep(2)
+        elif ping==main.FALSE:
+            main.log.info("All ping attempts between h1 and h2 have failed")
+            Ping_Result = main.FALSE
+        elif ping==main.TRUE:
+            main.log.info("Ping test between h1 and h2 passed!")
+            Ping_Result = main.TRUE
+        else:
+            main.log.info("Unknown error")
+            Ping_Result = main.ERROR
+
+        if Ping_Result==main.TRUE:
+            main.log.report("Ping test successful ")
+        if Ping_Result==main.FALSE:
+            main.log.report("Ping test failed")
+
+        case24_result = Ping_Result and links_state_result
+        utilities.assert_equals(expect=main.TRUE, actual=case24_result,
+                onpass="Packet optical rerouting successful",
+                onfail="Packet optical rerouting failed")
+
+    def CASE4(self, main):
+        import re
+        import time
+        main.log.report("This testcase is testing the assignment of all the switches to all the controllers and discovering the hosts in reactive mode")
+        main.log.report("__________________________________")
+        main.case("Pingall Test")
+        main.step("Assigning switches to controllers")
+        for i in range(1,29):
+            if i ==1:
+                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
+            elif i>=2 and i<5:
+                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
+            elif i>=5 and i<8:
+                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
+            elif i>=8 and i<18:
+                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
+            elif i>=18 and i<28:
+                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
+            else:
+                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
+        Switch_Mastership = main.TRUE
+        for i in range (1,29):
+            if i==1:
+                response = main.Mininet1.get_sw_controller("s"+str(i))
+                print("Response is " + str(response))
+                if re.search("tcp:"+ONOS1_ip,response):
+                    Switch_Mastership = Switch_Mastership and main.TRUE
+                else:
+                    Switch_Mastership = main.FALSE
+            elif i>=2 and i<5:
+                response = main.Mininet1.get_sw_controller("s"+str(i))
+                print("Response is " + str(response))
+                if re.search("tcp:"+ONOS1_ip,response):
+                    Switch_Mastership = Switch_Mastership and main.TRUE
+                else:
+                    Switch_Mastership = main.FALSE
+            elif i>=5 and i<8:
+                response = main.Mininet1.get_sw_controller("s"+str(i))
+                print("Response is " + str(response))
+                if re.search("tcp:"+ONOS1_ip,response):
+                    Switch_Mastership = Switch_Mastership and main.TRUE
+                else:
+                    Switch_Mastership = main.FALSE
+            elif i>=8 and i<18:
+                response = main.Mininet1.get_sw_controller("s"+str(i))
+                print("Response is " + str(response))
+                if re.search("tcp:"+ONOS1_ip,response):
+                    Switch_Mastership = Switch_Mastership and main.TRUE
+                else:
+                    Switch_Mastership = main.FALSE
+            elif i>=18 and i<28:
+                response = main.Mininet1.get_sw_controller("s"+str(i))
+                print("Response is " + str(response))
+                if re.search("tcp:"+ONOS1_ip,response):
+                    Switch_Mastership = Switch_Mastership and main.TRUE
+                else:
+                    Switch_Mastership = main.FALSE
+            else:
+                response = main.Mininet1.get_sw_controller("s"+str(i))
+                print("Response is" + str(response))
+                if re.search("tcp:" +ONOS1_ip,response):
+                    Switch_Mastership = Switch_Mastership and main.TRUE
+                else:
+                    Switch_Mastership = main.FALSE
+
+        if Switch_Mastership == main.TRUE:
+            main.log.report("Controller assignmnet successful")
+        else:
+            main.log.report("Controller assignmnet failed")
+        utilities.assert_equals(expect = main.TRUE,actual=Switch_Mastership,
+                onpass="MasterControllers assigned correctly")
+        '''
+        for i in range (1,29):
+            main.Mininet1.assign_sw_controller(sw=str(i),count=5,
+                    ip1=ONOS1_ip,port1=ONOS1_port,
+                    ip2=ONOS2_ip,port2=ONOS2_port,
+                    ip3=ONOS3_ip,port3=ONOS3_port,
+                    ip4=ONOS4_ip,port4=ONOS4_port,
+                    ip5=ONOS5_ip,port5=ONOS5_port)
+        '''
+        #REACTIVE FWD test
+
+        main.step("Get list of hosts from Mininet")
+        host_list = main.Mininet1.get_hosts()
+        main.log.info(host_list)
+
+        main.step("Get host list in ONOS format")
+        host_onos_list = main.ONOS2.get_hosts_id(host_list)
+        main.log.info(host_onos_list)
+        #time.sleep(5)
+        
+        main.step("Pingall")
+        ping_result = main.FALSE
+        while ping_result == main.FALSE:
+            time1 = time.time()
+            ping_result = main.Mininet1.pingall()
+            time2 = time.time()
+            print "Time for pingall: %2f seconds" % (time2 - time1)
+      
+        #Start onos cli again because u might have dropped out of onos prompt to the shell prompt
+        #if there was no activity
+        main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
+
+        case4_result = Switch_Mastership and ping_result
+        if ping_result == main.TRUE:
+            main.log.report("Pingall Test in reactive mode to discover the hosts successful") 
+        else:
+            main.log.report("Pingall Test in reactive mode to discover the hosts failed")
+
+        utilities.assert_equals(expect=main.TRUE, actual=case4_result,onpass="Controller assignment and Pingall Test successful",onfail="Controller assignment and Pingall Test NOT successful")   
+
+    def CASE10(self):
+        main.log.report("This testcase uninstalls the reactive forwarding app")
+        main.log.report("__________________________________")
+        main.case("Uninstalling reactive forwarding app")
+        #Unistall onos-app-fwd app to disable reactive forwarding
+        appUninstall_result = main.ONOS2.feature_uninstall("onos-app-fwd")
+        main.log.info("onos-app-fwd uninstalled")
+
+        #After reactive forwarding is disabled, the reactive flows on switches timeout in 10-15s
+        #So sleep for 15s
+        time.sleep(15)
+
+        flows = main.ONOS2.flows()
+        main.log.info(flows)
+
+        case10_result = appUninstall_result
+        utilities.assert_equals(expect=main.TRUE, actual=case10_result,onpass="Reactive forwarding app uninstallation successful",onfail="Reactive forwarding app uninstallation failed") 
+
+    
+    def CASE6(self):
+        main.log.report("This testcase is testing the addition of host intents and then does pingall")
+        main.log.report("__________________________________")
+        main.case("Obtaining host id's")
+        main.step("Get hosts")
+        hosts = main.ONOS2.hosts()
+        #main.log.info(hosts)
+
+        main.step("Get all devices id")
+        devices_id_list = main.ONOS2.get_all_devices_id()
+        #main.log.info(devices_id_list)
+        
+        #ONOS displays the hosts in hex format unlike mininet which does in decimal format
+        #So take care while adding intents
+        '''
+        main.step("Add host-to-host intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:08/-1", "00:00:00:00:00:12/-1")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:09/-1", "00:00:00:00:00:13/-1")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0A/-1", "00:00:00:00:00:14/-1")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0B/-1", "00:00:00:00:00:15/-1")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0C/-1", "00:00:00:00:00:16/-1")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0D/-1", "00:00:00:00:00:17/-1")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0E/-1", "00:00:00:00:00:18/-1")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0F/-1", "00:00:00:00:00:19/-1")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:10/-1", "00:00:00:00:00:1A/-1") 
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1")
+        print "_____________________________________________________________________________________"
+        '''
+        
+        for i in range(8,18):
+            main.log.info("Adding host intent between h"+str(i)+" and h"+str(i+10))
+            host1 =  "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
+            host2 =  "00:00:00:00:00:" + str(hex(i+10)[2:]).zfill(2).upper()
+            #NOTE: get host can return None
+            #TODO: handle this
+            host1_id = main.ONOS2.get_host(host1)['id']
+            host2_id = main.ONOS2.get_host(host2)['id']
+            tmp_result = main.ONOS2.add_host_intent(host1_id, host2_id )        
+
+        time.sleep(10)
+        h_intents = main.ONOS2.intents(json_format = False)
+        main.log.info("intents:" +h_intents)
+        flowHandle = main.ONOS2.flows()
+        #main.log.info("flow:" +flowHandle)
+
+        count = 1
+        i = 8
+        Ping_Result = main.TRUE
+        #while i<10:
+        while i <18 :
+            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
+            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
+            if ping == main.FALSE and count <5:
+                count+=1
+                #i = 8
+                Ping_Result = main.FALSE
+                main.log.report("Ping between h" + str(i) + " and h" + str(i+10) + " failed. Making attempt number "+str(count) + " in 2 seconds")
+                time.sleep(2)
+            elif ping==main.FALSE:
+                main.log.report("All ping attempts between h" + str(i) + " and h" + str(i+10) +"have failed")
+                i=19
+                Ping_Result = main.FALSE
+            elif ping==main.TRUE:
+                main.log.info("Ping test between h" + str(i) + " and h" + str(i+10) + "passed!")
+                i+=1
+                Ping_Result = main.TRUE
+            else:
+                main.log.info("Unknown error")
+                Ping_Result = main.ERROR
+        if Ping_Result==main.FALSE:
+            main.log.report("Ping all test after Host intent addition failed. Cleaning up")
+            #main.cleanup()
+            #main.exit()
+        if Ping_Result==main.TRUE:
+            main.log.report("Ping all test after Host intent addition successful")
+            
+        case6_result = Ping_Result
+        utilities.assert_equals(expect=main.TRUE, actual=case6_result,
+                onpass="Pingall Test after Host intents addition successful",
+                onfail="Pingall Test after Host intents addition failed")
+
+
+    def CASE5(self,main) :
+        import json
+        from subprocess import Popen, PIPE
+        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
+        #main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
+        deviceResult = main.ONOS2.devices()
+        linksResult = main.ONOS2.links()
+        #portsResult = main.ONOS2.ports()
+        print "**************"
+
+        main.log.report("This testcase is testing if all ONOS nodes are in topology sync with mininet")
+        main.log.report("__________________________________")
+        main.case("Comparing Mininet topology with the topology of ONOS")
+        main.step("Start continuous pings")
+        main.Mininet2.pingLong(src=main.params['PING']['source1'],
+                            target=main.params['PING']['target1'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source2'],
+                            target=main.params['PING']['target2'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source3'],
+                            target=main.params['PING']['target3'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source4'],
+                            target=main.params['PING']['target4'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source5'],
+                            target=main.params['PING']['target5'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source6'],
+                            target=main.params['PING']['target6'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source7'],
+                            target=main.params['PING']['target7'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source8'],
+                            target=main.params['PING']['target8'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source9'],
+                            target=main.params['PING']['target9'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source10'],
+                            target=main.params['PING']['target10'],pingTime=500)
+
+        main.step("Create TestONTopology object")
+        global ctrls
+        ctrls = []
+        count = 1
+        while True:
+            temp = ()
+            if ('ip' + str(count)) in main.params['CTRL']:
+                temp = temp + (getattr(main,('ONOS' + str(count))),)
+                temp = temp + ("ONOS"+str(count),)
+                temp = temp + (main.params['CTRL']['ip'+str(count)],)
+                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
+                ctrls.append(temp)
+                count = count + 1
+            else:
+                break
+        global MNTopo
+        Topo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+        MNTopo = Topo
+
+        Topology_Check = main.TRUE
+        main.step("Compare ONOS Topology to MN Topology")
+        devices_json = main.ONOS2.devices()
+        links_json = main.ONOS2.links()
+        #ports_json = main.ONOS2.ports()
+        print "devices_json= ", devices_json
+        
+        result1 = main.Mininet1.compare_switches(MNTopo, json.loads(devices_json))
+        result2 = main.Mininet1.compare_links(MNTopo, json.loads(links_json))
+        #result3 = main.Mininet1.compare_ports(MNTopo, json.loads(ports_json))
+            
+        #result = result1 and result2 and result3
+        result = result1 and result2
+        
+        print "***********************"
+        if result == main.TRUE:
+            main.log.report("ONOS"+ " Topology matches MN Topology")
+        else:
+            main.log.report("ONOS"+ " Topology does not match MN Topology") 
+
+        utilities.assert_equals(expect=main.TRUE,actual=result,
+            onpass="ONOS" + " Topology matches MN Topology",
+            onfail="ONOS" + " Topology does not match MN Topology")
+        
+        Topology_Check = Topology_Check and result
+        utilities.assert_equals(expect=main.TRUE,actual=Topology_Check,
+            onpass="Topology checks passed", onfail="Topology checks failed")
+    
+
+    def CASE7 (self,main):
+       
+        ONOS1_ip = main.params['CTRL']['ip1']
+
+        link_sleep = int(main.params['timers']['LinkDiscovery'])
+
+        main.log.report("This testscase is killing a link to ensure that link discovery is consistent")
+        main.log.report("__________________________________")
+        main.log.report("Killing a link to ensure that link discovery is consistent")
+        main.case("Killing a link to Ensure that Link Discovery is Working Properly")
+        '''
+        main.step("Start continuous pings")
+       
+        main.Mininet2.pingLong(src=main.params['PING']['source1'],
+                            target=main.params['PING']['target1'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source2'],
+                            target=main.params['PING']['target2'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source3'],
+                            target=main.params['PING']['target3'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source4'],
+                            target=main.params['PING']['target4'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source5'],
+                            target=main.params['PING']['target5'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source6'],
+                            target=main.params['PING']['target6'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source7'],
+                            target=main.params['PING']['target7'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source8'],
+                            target=main.params['PING']['target8'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source9'],
+                            target=main.params['PING']['target9'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source10'],
+                            target=main.params['PING']['target10'],pingTime=500)
+        '''
+
+        main.step("Determine the current number of switches and links")
+        topology_output = main.ONOS2.topology()
+        topology_result = main.ONOS1.get_topology(topology_output)
+        activeSwitches = topology_result['devices']
+        links = topology_result['links']
+        print "activeSwitches = ", type(activeSwitches)
+        print "links = ", type(links)
+        main.log.info("Currently there are %s switches and %s links"  %(str(activeSwitches), str(links)))
+
+        main.step("Kill Link between s3 and s28")
+        main.Mininet1.link(END1="s3",END2="s28",OPTION="down")
+        time.sleep(link_sleep)
+        topology_output = main.ONOS2.topology()
+        Link_Down = main.ONOS1.check_status(topology_output,activeSwitches,str(int(links)-2))
+        if Link_Down == main.TRUE:
+            main.log.report("Link Down discovered properly")
+        utilities.assert_equals(expect=main.TRUE,actual=Link_Down,
+                onpass="Link Down discovered properly",
+                onfail="Link down was not discovered in "+ str(link_sleep) + " seconds")
+       
+        #Check ping result here..add code for it
+         
+        main.step("Bring link between s3 and s28 back up")
+        Link_Up = main.Mininet1.link(END1="s3",END2="s28",OPTION="up")
+        time.sleep(link_sleep)
+        topology_output = main.ONOS2.topology()
+        Link_Up = main.ONOS1.check_status(topology_output,activeSwitches,str(links))
+        if Link_Up == main.TRUE:
+            main.log.report("Link up discovered properly")
+        utilities.assert_equals(expect=main.TRUE,actual=Link_Up,
+                onpass="Link up discovered properly",
+                onfail="Link up was not discovered in "+ str(link_sleep) + " seconds")
+            
+        #NOTE Check ping result here..add code for it
+        
+        
+        main.step("Compare ONOS Topology to MN Topology")
+        Topo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+        MNTopo = Topo
+        Topology_Check = main.TRUE
+        
+        devices_json = main.ONOS2.devices()
+        links_json = main.ONOS2.links()
+        ports_json = main.ONOS2.ports()
+        print "devices_json= ", devices_json
+        
+        result1 = main.Mininet1.compare_switches(MNTopo, json.loads(devices_json))
+        result2 = main.Mininet1.compare_links(MNTopo, json.loads(links_json))
+        #result3 = main.Mininet1.compare_ports(MNTopo, json.loads(ports_json))
+            
+        #result = result1 and result2 and result3
+        result = result1 and result2
+        print "***********************"
+        
+        if result == main.TRUE:
+            main.log.report("ONOS"+ " Topology matches MN Topology")
+        utilities.assert_equals(expect=main.TRUE,actual=result,
+            onpass="ONOS" + " Topology matches MN Topology",
+            onfail="ONOS" + " Topology does not match MN Topology")
+        
+        Topology_Check = Topology_Check and result
+        utilities.assert_equals(expect=main.TRUE,actual=Topology_Check,
+            onpass="Topology checks passed", onfail="Topology checks failed")
+    
+        result = Link_Down and Link_Up and Topology_Check
+        utilities.assert_equals(expect=main.TRUE,actual=result,
+                onpass="Link failure is discovered correctly",
+                onfail="Link Discovery failed")
+
+
+    def CASE8(self):
+        '''
+        Host intents removal
+        ''' 
+        main.log.report("This testcase removes host intents before adding the same intents or point intents")
+        main.log.report("__________________________________")        
+        main.log.info("Host intents removal")
+        main.case("Removing host intents")
+        main.step("Obtain the intent id's")
+        intent_result = main.ONOS2.intents(json_format = False)
+        main.log.info("intent_result = " +intent_result)        
+ 
+        intent_linewise = intent_result.split("\n")
+        intentList = []
+        for line in intent_linewise:
+            if line.startswith("id="):
+                intentList.append(line)
+        
+        intentids = []
+        for line in intentList:
+            intentids.append(line.split(",")[0].split("=")[1])
+        for id in intentids:
+            print "id = ", id
+        
+        main.step("Iterate through the intentids list and remove each intent")
+        for id in intentids:
+            main.ONOS2.remove_intent(intent_id = id)
+        
+        intent_result = main.ONOS2.intents(json_format = False)
+        main.log.info("intent_result = " +intent_result)        
+
+        case8_result = main.TRUE
+        if case8_result == main.TRUE:
+            main.log.report("Intent removal successful")
+        else:
+            main.log.report("Intent removal failed")
+       
+        Ping_Result = main.TRUE
+        if case8_result == main.TRUE:
+            i = 8
+            while i <18 :
+                main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
+                ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
+                if ping==main.TRUE:
+                    i = 19
+                    Ping_Result = Ping_Result and main.TRUE
+                elif ping==main.FALSE:
+                    i+=1
+                    Ping_Result = Ping_Result and main.FALSE
+                else:
+                    main.log.info("Unknown error")
+                    Ping_Result = main.ERROR
+
+            #Note: If the ping result failed, that means the intents have been withdrawn correctly.
+        if Ping_Result==main.TRUE:
+            main.log.report("Host intents have not been withdrawn correctly")
+            #main.cleanup()
+            #main.exit()
+        if Ping_Result==main.FALSE:
+            main.log.report("Host intents have been withdrawn correctly")
+
+        case8_result = case8_result and Ping_Result
+
+        if case8_result == main.FALSE:
+            main.log.report("Intent removal successful")
+        else:
+            main.log.report("Intent removal failed")
+
+        utilities.assert_equals(expect=main.FALSE, actual=case8_result,
+                onpass="Intent removal test failed",
+                onfail="Intent removal test passed")
+
+
+    def CASE9(self):
+        main.log.report("This testcase adds point intents and then does pingall")
+        main.log.report("__________________________________") 
+        main.log.info("Adding point intents")
+        main.case("Adding bidirectional point for mn hosts(h8-h18,h9-h19,h10-h20,h11-h21,h12-h22,h13-h23,h14-h24,h15-h25,h16-h26,h17-h27)") 
+        main.step("Add point-to-point intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003008/1", "of:0000000000006018/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006018/1", "of:0000000000003008/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        main.step("Add point-to-point intents for mininet hosts h9 and h19 or ONOS hosts h9 and h13")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003009/1", "of:0000000000006019/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006019/1", "of:0000000000003009/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+        
+        main.step("Add point-to-point intents for mininet hosts h10 and h20 or ONOS hosts hA and h14")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003010/1", "of:0000000000006020/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006020/1", "of:0000000000003010/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+
+        main.step("Add point-to-point intents for mininet hosts h11 and h21 or ONOS hosts hB and h15")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003011/1", "of:0000000000006021/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006021/1", "of:0000000000003011/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+            
+        main.step("Add point-to-point intents for mininet hosts h12 and h22 or ONOS hosts hC and h16")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003012/1", "of:0000000000006022/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006022/1", "of:0000000000003012/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+            
+        main.step("Add point-to-point intents for mininet hosts h13 and h23 or ONOS hosts hD and h17")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003013/1", "of:0000000000006023/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006023/1", "of:0000000000003013/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+
+        main.step("Add point-to-point intents for mininet hosts h14 and h24 or ONOS hosts hE and h18")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003014/1", "of:0000000000006024/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006024/1", "of:0000000000003014/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+            
+        main.step("Add point-to-point intents for mininet hosts h15 and h25 or ONOS hosts hF and h19")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003015/1", "of:0000000000006025/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006025/1", "of:0000000000003015/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+            
+        main.step("Add point-to-point intents for mininet hosts h16 and h26 or ONOS hosts h10 and h1A")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003016/1", "of:0000000000006026/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006026/1", "of:0000000000003016/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+
+
+        main.step("Add point-to-point intents for mininet hosts h17 and h27 or ONOS hosts h11 and h1B")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003017/1", "of:0000000000006027/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006027/1", "of:0000000000003017/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+
+        print("_______________________________________________________________________________________")
+
+        flowHandle = main.ONOS2.flows()
+        #print "flowHandle = ", flowHandle
+        main.log.info("flows :" + flowHandle)        
+
+        count = 1
+        i = 8
+        Ping_Result = main.TRUE
+        while i <18 :
+            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
+            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
+            if ping == main.FALSE and count <5:
+                count+=1
+                #i = 8
+                Ping_Result = main.FALSE
+                main.log.report("Ping between h" + str(i) + " and h" + str(i+10) + " failed. Making attempt number "+str(count) + " in 2 seconds")
+                time.sleep(2)
+            elif ping==main.FALSE:
+                main.log.report("All ping attempts between h" + str(i) + " and h" + str(i+10) +"have failed")
+                i=19
+                Ping_Result = main.FALSE
+            elif ping==main.TRUE:
+                main.log.info("Ping test between h" + str(i) + " and h" + str(i+10) + "passed!")
+                i+=1
+                Ping_Result = main.TRUE
+            else:
+                main.log.info("Unknown error")
+                Ping_Result = main.ERROR
+
+        if Ping_Result==main.FALSE:
+            main.log.report("Point intents have not ben installed correctly. Cleaning up")
+            #main.cleanup()
+            #main.exit()
+        if Ping_Result==main.TRUE:
+            main.log.report("Point Intents have been installed correctly")
+
+        case9_result = Ping_Result
+        utilities.assert_equals(expect=main.TRUE, actual=case9_result,
+                onpass="Point intents addition and Pingall Test successful",
+                onfail="Point intents addition and Pingall Test NOT successful")
+
+
diff --git a/TestON/tests/ProdFunc/ProdFunc.topo b/TestON/tests/ProdFunc/ProdFunc.topo
new file mode 100755
index 0000000..7dff686
--- /dev/null
+++ b/TestON/tests/ProdFunc/ProdFunc.topo
@@ -0,0 +1,103 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOSbench>
+
+        <ONOS1>
+            <host>10.128.10.11</host>
+            <user>sdn</user>
+            <password>sdn</password>
+            <type>OnosDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1>
+
+        <ONOS2>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS2>
+
+         <ONOS3>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS3>
+       
+
+        <Mininet1>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS>
+                #Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+                <arg2> --topo mytopo </arg2>
+                <arg3> --switch ovs,protocols=OpenFlow10 </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet1>
+
+        <Mininet2>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>RemoteMininetDriver</type>
+            <connect_order>6</connect_order>
+            <COMPONENTS>
+                #Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+                <arg2> --topo mytopo </arg2>
+                <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet2>
+
+        <LincOE1>
+            <host>10.128.20.30</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>LincOEDriver</type>
+            <connect_order>7</connect_order>
+            <COMPONENTS>
+                <arg1> </arg1>
+            </COMPONENTS>
+        </LincOE1>
+
+        <LincOE2>
+            <host>10.128.20.30</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>RemoteMininetDriver</type>
+            <connect_order>8</connect_order>
+            <COMPONENTS>
+                <arg1> sudo python /home/admin/optical.py </arg1>
+                <arg2> </arg2>
+            </COMPONENTS>
+        </LincOE2>
+
+        <LincOE3>
+            <host>10.128.20.30</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>LincOEDriver</type>
+            <connect_order>9</connect_order>
+        </LincOE3>
+ 
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/FuncNext/FuncNext.params b/TestON/tests/ProdFunc13/ProdFunc13.params
similarity index 77%
copy from TestON/tests/FuncNext/FuncNext.params
copy to TestON/tests/ProdFunc13/ProdFunc13.params
index 34d8a56..bb3c11c 100755
--- a/TestON/tests/FuncNext/FuncNext.params
+++ b/TestON/tests/ProdFunc13/ProdFunc13.params
@@ -1,6 +1,6 @@
 <PARAMS>
     
-    <testcases>1,4,5,7,3</testcases>
+    <testcases>1,4,10,5,6,7,8,9,2,20,21,22,10,23,24</testcases>
 
     #Environment variables
     <ENV>
@@ -8,7 +8,7 @@
     </ENV>
 
     <CTRL>
-        <ip1>10.128.60.11</ip1>
+        <ip1>10.128.20.11</ip1>
         <port1>6633</port1>
     </CTRL>
 
@@ -37,7 +37,13 @@
 
     <timers>
         <LinkDiscovery>5</LinkDiscovery>
-        <SwitchDiscovery>31</SwitchDiscovery>
+        <SwitchDiscovery>15</SwitchDiscovery>
     </timers>
 
+    <OPTICAL>
+        <jsonfile> /home/admin/ONOS/tools/test/topos/oe-nonlinear-4.json </jsonfile>
+    </OPTICAL>    
+
+
+
 </PARAMS>
diff --git a/TestON/tests/ProdFunc13/ProdFunc13.py b/TestON/tests/ProdFunc13/ProdFunc13.py
new file mode 100755
index 0000000..babf853
--- /dev/null
+++ b/TestON/tests/ProdFunc13/ProdFunc13.py
@@ -0,0 +1,1100 @@
+
+#Testing the basic functionality of ONOS Next
+#For sanity and driver functionality excercises only.
+
+import time
+import sys
+import os
+import re
+import json
+
+time.sleep(1)
+class ProdFunc13:
+    def __init__(self):
+        self.default = ''
+
+    def CASE1(self, main):
+        '''
+        Startup sequence:
+        cell <name>
+        onos-verify-cell
+        onos-remove-raft-log
+        git pull
+        mvn clean install
+        onos-package
+        onos-install -f
+        onos-wait-for-start
+        '''
+        
+        cell_name = main.params['ENV']['cellName']
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS1_port = main.params['CTRL']['port1']
+        
+        main.case("Setting up test environment")
+        main.log.report("This testcase is testing setting up test environment")
+        main.log.report("__________________________________") 
+
+        main.step("Applying cell variable to environment")
+        cell_result = main.ONOSbench.set_cell(cell_name)
+        verify_result = main.ONOSbench.verify_cell()
+        
+        main.step("Removing raft logs before a clen installation of ONOS")
+        main.ONOSbench.onos_remove_raft_logs()
+
+        main.step("Git checkout and pull master and get version")
+        main.ONOSbench.git_checkout("master")
+        git_pull_result = main.ONOSbench.git_pull()
+        main.log.info("git_pull_result = " +git_pull_result)
+        version_result = main.ONOSbench.get_version(report=True)
+    
+        if git_pull_result == 1:
+            main.step("Using mvn clean & install")
+            clean_install_result = main.ONOSbench.clean_install()
+            #clean_install_result = main.TRUE
+        elif git_pull_result == 0:
+            main.log.report("Git Pull Failed, look into logs for detailed reason")
+            main.cleanup()
+            main.exit() 
+         
+        main.step("Creating ONOS package")
+        package_result = main.ONOSbench.onos_package()
+
+
+        main.step("Installing ONOS package")
+        onos_install_result = main.ONOSbench.onos_install()
+        if onos_install_result == main.TRUE:
+            main.log.report("Installing ONOS package successful")
+        else:
+            main.log.report("Installing ONOS package failed")
+
+        onos1_isup = main.ONOSbench.isup()
+        if onos1_isup == main.TRUE:
+            main.log.report("ONOS instance is up and ready")  
+        else:
+            main.log.report("ONOS instance may not be up")  
+       
+        main.step("Starting ONOS service")
+        start_result = main.ONOSbench.onos_start(ONOS1_ip)
+        
+        main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])        
+
+        case1_result = (package_result and\
+                cell_result and verify_result and onos_install_result and\
+                onos1_isup and start_result )
+        utilities.assert_equals(expect=main.TRUE, actual=case1_result,
+                onpass="Test startup successful",
+                onfail="Test startup NOT successful")
+
+    def CASE2(self, main) :
+        '''  
+        Switch Down
+        '''
+        #NOTE: You should probably run a topology check after this
+        import time 
+        import json
+ 
+        main.case("Switch down discovery")
+        main.log.report("This testcase is testing a switch down discovery")
+        main.log.report("__________________________________")
+
+        switch_sleep = int(main.params['timers']['SwitchDiscovery'])
+
+        description = "Killing a switch to ensure it is discovered correctly"
+        main.log.report(description)
+        main.case(description)
+
+        #TODO: Make this switch parameterizable
+        main.step("Kill s28 ")
+        main.log.report("Deleting s28")
+        #FIXME: use new dynamic topo functions
+        main.Mininet1.del_switch("s28")
+        main.log.info("Waiting " + str(switch_sleep) + " seconds for switch down to be discovered")
+        time.sleep(switch_sleep)
+        #Peek at the deleted switch
+        device = main.ONOS2.get_device(dpid="0028")
+        print "device = ", device
+        if device[u'available'] == 'False':
+            case2_result = main.FALSE
+        else:
+            case2_result = main.TRUE
+        utilities.assert_equals(expect=main.TRUE, actual=case2_result,
+                onpass="Switch down discovery successful",
+                onfail="Switch down discovery failed")
+
+    def CASE11(self, main):
+        '''
+        Cleanup sequence:
+        onos-service <node_ip> stop
+        onos-uninstall
+
+        TODO: Define rest of cleanup
+        
+        '''
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+
+        main.case("Cleaning up test environment")
+
+        main.step("Testing ONOS kill function")
+        kill_result = main.ONOSbench.onos_kill(ONOS1_ip)
+
+        main.step("Stopping ONOS service")
+        stop_result = main.ONOSbench.onos_stop(ONOS1_ip)
+
+        main.step("Uninstalling ONOS service") 
+        uninstall_result = main.ONOSbench.onos_uninstall()
+
+    def CASE3(self, main):
+        '''
+        Test 'onos' command and its functionality in driver
+        '''
+        
+        ONOS1_ip = main.params['CTRL']['ip1']
+
+        main.case("Testing 'onos' command")
+
+        main.step("Sending command 'onos -w <onos-ip> system:name'")
+        cmdstr1 = "system:name"
+        cmd_result1 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr1) 
+        main.log.info("onos command returned: "+cmd_result1)
+
+        main.step("Sending command 'onos -w <onos-ip> onos:topology'")
+        cmdstr2 = "onos:topology"
+        cmd_result2 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr2)
+        main.log.info("onos command returned: "+cmd_result2)
+
+
+    def CASE20(self):
+        '''
+            Exit from mininet cli
+            reinstall ONOS
+        '''
+        cell_name = main.params['ENV']['cellName']
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS1_port = main.params['CTRL']['port1']
+        
+        main.log.report("This testcase exits the mininet cli and reinstalls ONOS to switch over to Packet Optical topology")
+        main.log.report("_____________________________________________")
+        main.case("Disconnecting mininet and restarting ONOS")
+        main.step("Disconnecting mininet and restarting ONOS")
+        mininet_disconnect = main.Mininet1.disconnect()
+
+        main.step("Removing raft logs before a clen installation of ONOS")
+        main.ONOSbench.onos_remove_raft_logs()
+
+        main.step("Applying cell variable to environment")
+        cell_result = main.ONOSbench.set_cell(cell_name)
+        verify_result = main.ONOSbench.verify_cell()
+
+        onos_install_result = main.ONOSbench.onos_install()
+        if onos_install_result == main.TRUE:
+            main.log.report("Installing ONOS package successful")
+        else:
+            main.log.report("Installing ONOS package failed")
+
+        onos1_isup = main.ONOSbench.isup()
+        if onos1_isup == main.TRUE:
+            main.log.report("ONOS instance is up and ready")
+        else:
+            main.log.report("ONOS instance may not be up")
+
+        main.step("Starting ONOS service")
+        start_result = main.ONOSbench.onos_start(ONOS1_ip)
+      
+        main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1']) 
+        print "mininet_disconnect =", mininet_disconnect
+        print "onos_install_result =", onos_install_result
+        print "onos1_isup =", onos1_isup
+        print "start_result =", start_result
+ 
+        case20_result = mininet_disconnect and cell_result and onos_install_result and onos1_isup and start_result
+        utilities.assert_equals(expect=main.TRUE, actual=case20_result,
+                onpass="Exiting functionality mininet topology and reinstalling ONOS successful",
+                onfail="Exiting functionality mininet topology and reinstalling ONOS failed") 
+
+    def CASE21(self, main):
+        import time
+        '''
+            On ONOS bench, run this command: ./~/ONOS/tools/test/bin/onos-topo-cfg
+            which starts the rest and copies the links json file to the onos instance
+            Note that in case of Packet Optical, the links are not learnt from the topology, instead the links are learnt 
+            from the json config file
+        ''' 
+        main.log.report("This testcase starts the packet layer topology and REST")
+        main.log.report("_____________________________________________")
+        main.case("Starting LINC-OE and other components")
+        main.step("Starting LINC-OE and other components")
+        start_console_result = main.LincOE1.start_console()
+        optical_mn_script = main.LincOE2.run_optical_mn_script()
+        onos_topo_cfg_result = main.ONOSbench.run_onos_topo_cfg(instance_name = main.params['CTRL']['ip1'], json_file = main.params['OPTICAL']['jsonfile'])
+            
+        print "start_console_result =",start_console_result 
+        print "optical_mn_script = ",optical_mn_script 
+        print "onos_topo_cfg_result =",onos_topo_cfg_result 
+
+        case21_result = start_console_result and optical_mn_script and onos_topo_cfg_result
+        utilities.assert_equals(expect=main.TRUE, actual=case21_result,
+                onpass="Packet optical topology spawned successsfully",
+                onfail="Packet optical topology spawning failed") 
+
+
+    def CASE22(self, main):
+        '''
+            Curretly we use, 4 linear switch optical topology and 2 packet layer mininet switches each with one host.
+             Therefore, the roadmCount variable = 4, packetLayerSWCount variable = 2, hostCount =2
+            and this is hardcoded in the testcase. If the topology changes, these hardcoded values need to be changed
+        '''
+
+        main.log.report("This testcase compares the optical+packet topology against what is expected")
+        main.case("Topology comparision")
+        main.step("Topology comparision")
+        main.ONOS3.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
+        devices_result = main.ONOS3.devices(json_format = False)
+
+        print "devices_result = ", devices_result
+        devices_linewise = devices_result.split("\n")
+        devices_linewise = devices_linewise[1:-1]
+        roadmCount = 0
+        packetLayerSWCount = 0
+        for line in devices_linewise:
+            components = line.split(",")
+            availability = components[1].split("=")[1]
+            type = components[3].split("=")[1]
+            if availability == 'true' and type == 'ROADM':
+                roadmCount += 1
+            elif availability == 'true' and type =='SWITCH':
+                packetLayerSWCount += 1
+        if roadmCount == 4:
+            print "Number of Optical Switches = %d and is correctly detected" %roadmCount
+            main.log.info ("Number of Optical Switches = " +str(roadmCount) +" and is correctly detected")
+            opticalSW_result = main.TRUE
+        else:
+            print "Number of Optical Switches = %d and is wrong" %roadCount
+            main.log.info ("Number of Optical Switches = " +str(roadmCount) +" and is wrong")
+            opticalSW_result = main.FALSE
+
+        if packetLayerSWCount == 2:
+            print "Number of Packet layer or mininet Switches = %d and is correctly detected" %packetLayerSWCount
+            main.log.info("Number of Packet layer or mininet Switches = " +str(packetLayerSWCount) + " and is correctly detected")
+            packetSW_result = main.TRUE
+        else:
+            print "Number of Packet layer or mininet Switches = %d and is wrong" %packetLayerSWCount
+            main.log.info("Number of Packet layer or mininet Switches = " +str(packetLayerSWCount) + " and is wrong")
+            packetSW_result = main.FALSE
+        print "_________________________________"
+        
+        links_result = main.ONOS3.links(json_format = False)
+        print "links_result = ", links_result
+        print "_________________________________"
+        
+        #NOTE:Since only point intents are added, there is no requirement to discover the hosts
+                #Therfore, the below portion of the code is commented.
+        '''
+        #Discover hosts using pingall
+        pingall_result = main.LincOE2.pingall()    
+    
+        hosts_result = main.ONOS3.hosts(json_format = False)
+        main.log.info("hosts_result = "+hosts_result)   
+        main.log.info("_________________________________")
+        hosts_linewise = hosts_result.split("\n")
+        hosts_linewise = hosts_linewise[1:-1]
+        hostCount = 0
+        for line in hosts_linewise:
+            hostid = line.split(",")[0].split("=")[1]
+            hostCount +=1
+        if hostCount ==2:
+            print "Number of hosts = %d and is correctly detected" %hostCount
+            main.log.info("Number of hosts = " + str(hostCount) +" and is correctly detected")
+            hostDiscovery = main.TRUE
+        else:
+            print "Number of hosts = %d and is wrong" %hostCount
+            main.log.info("Number of hosts = " + str(hostCount) +" and is wrong")
+            hostDiscovery = main.FALSE
+        '''
+
+        case22_result = opticalSW_result and packetSW_result
+        utilities.assert_equals(expect=main.TRUE, actual=case22_result,
+                onpass="Packet optical topology discovery successful",
+                onfail="Packet optical topology discovery failed")
+
+    def CASE23(self, main):
+        import time
+        '''
+            Add bidirectional point intents between 2 packet layer(mininet) devices and 
+            ping mininet hosts
+        '''
+        main.log.report("This testcase adds bidirectional point intents between 2 packet layer(mininet) devices and ping mininet hosts")
+        main.case("Topology comparision")
+        main.step("Adding point intents")
+        ptp_intent_result = main.ONOS3.add_point_intent("of:0000ffffffff0001/1", "of:0000ffffffff0002/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS3.intents(json_format = False)
+            main.log.info("Point to point intent install successful")
+
+        ptp_intent_result = main.ONOS3.add_point_intent("of:0000ffffffff0002/1", "of:0000ffffffff0001/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS3.intents(json_format = False)
+            main.log.info("Point to point intent install successful")
+
+        time.sleep(10)
+        flowHandle = main.ONOS3.flows()
+        main.log.info("flows :" + flowHandle)
+
+        # Sleep for 30 seconds to provide time for the intent state to change
+        time.sleep(30)
+        intentHandle = main.ONOS3.intents(json_format = False)        
+        main.log.info("intents :" + intentHandle)        
+ 
+        Ping_Result = main.TRUE
+        count = 1
+        main.log.info("\n\nh1 is Pinging h2")
+        ping = main.LincOE2.pingHostOptical(src="h1", target="h2")
+        #ping = main.LincOE2.pinghost()
+        if ping == main.FALSE and count<5:
+            count+=1
+            Ping_Result = main.FALSE
+            main.log.info("Ping between h1 and h2  failed. Making attempt number "+str(count) + " in 2 seconds")
+            time.sleep(2)
+        elif ping==main.FALSE:
+            main.log.info("All ping attempts between h1 and h2 have failed")
+            Ping_Result = main.FALSE
+        elif ping==main.TRUE:
+            main.log.info("Ping test between h1 and h2 passed!")
+            Ping_Result = main.TRUE
+        else:
+            main.log.info("Unknown error")
+            Ping_Result = main.ERROR
+        
+        if Ping_Result==main.FALSE:
+            main.log.report("Point intents for packet optical have not ben installed correctly. Cleaning up")
+        if Ping_Result==main.TRUE:
+            main.log.report("Point Intents for packet optical have been installed correctly")
+
+        case23_result = Ping_Result
+        utilities.assert_equals(expect=main.TRUE, actual=case23_result,
+                onpass="Point intents addition for packet optical and Pingall Test successful",
+                onfail="Point intents addition for packet optical and Pingall Test NOT successful")
+
+
+
+    def CASE24(self, main):
+        import time
+        import json
+        '''
+            Test Rerouting of Packet Optical by bringing a port down (port 22) of a switch(switchID=1), so that link (between switch1 port22 - switch4-port30) is inactive
+            and do a ping test. If rerouting is successful, ping should pass. also check the flows
+        '''
+        main.log.report("This testcase tests rerouting and pings mininet hosts")
+        main.case("Test rerouting and pings mininet hosts")
+        main.step("Bring a port down and verify the link state")
+        main.LincOE1.port_down(sw_id="1", pt_id="22") 
+        links_nonjson = main.ONOS3.links(json_format = False)
+        main.log.info("links = " +links_nonjson)
+
+        links = main.ONOS3.links()
+        main.log.info("links = " +links)
+        
+        links_result = json.loads(links)
+        links_state_result = main.FALSE
+        for item in links_result:
+            if item['src']['device'] == "of:0000ffffffffff01" and item['src']['port'] == "22":
+                if item['dst']['device'] == "of:0000ffffffffff04" and item['dst']['port'] == "30":
+                    links_state = item['state']
+                    if links_state == "INACTIVE":
+                        main.log.info("Links state is inactive as expected due to one of the ports being down")
+                        main.log.report("Links state is inactive as expected due to one of the ports being down")
+                        links_state_result = main.TRUE
+                        break
+                    else:
+                        main.log.info("Links state is not inactive as expected")
+                        main.log.report("Links state is not inactive as expected")
+                        links_state_result = main.FALSE
+
+        print "links_state_result = ", links_state_result
+        time.sleep(10)
+        flowHandle = main.ONOS3.flows()
+        main.log.info("flows :" + flowHandle)
+
+        main.step("Verify Rerouting by a ping test")
+        Ping_Result = main.TRUE
+        count = 1        
+        main.log.info("\n\nh1 is Pinging h2")
+        ping = main.LincOE2.pingHostOptical(src="h1", target="h2")
+        #ping = main.LincOE2.pinghost()
+        if ping == main.FALSE and count<5:
+            count+=1
+            Ping_Result = main.FALSE
+            main.log.info("Ping between h1 and h2  failed. Making attempt number "+str(count) + " in 2 seconds")
+            time.sleep(2)
+        elif ping==main.FALSE:
+            main.log.info("All ping attempts between h1 and h2 have failed")
+            Ping_Result = main.FALSE
+        elif ping==main.TRUE:
+            main.log.info("Ping test between h1 and h2 passed!")
+            Ping_Result = main.TRUE
+        else:
+            main.log.info("Unknown error")
+            Ping_Result = main.ERROR
+
+        if Ping_Result==main.TRUE:
+            main.log.report("Ping test successful ")
+        if Ping_Result==main.FALSE:
+            main.log.report("Ping test failed")
+
+        case24_result = Ping_Result and links_state_result
+        utilities.assert_equals(expect=main.TRUE, actual=case24_result,
+                onpass="Packet optical rerouting successful",
+                onfail="Packet optical rerouting failed")
+
+    def CASE4(self, main):
+        import re
+        import time
+        main.log.report("This testcase is testing the assignment of all the switches to all the controllers and discovering the hosts in reactive mode")
+        main.log.report("__________________________________")
+        main.case("Pingall Test")
+        main.step("Assigning switches to controllers")
+        for i in range(1,29):
+            if i ==1:
+                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
+            elif i>=2 and i<5:
+                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
+            elif i>=5 and i<8:
+                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
+            elif i>=8 and i<18:
+                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
+            elif i>=18 and i<28:
+                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
+            else:
+                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
+        Switch_Mastership = main.TRUE
+        for i in range (1,29):
+            if i==1:
+                response = main.Mininet1.get_sw_controller("s"+str(i))
+                print("Response is " + str(response))
+                if re.search("tcp:"+ONOS1_ip,response):
+                    Switch_Mastership = Switch_Mastership and main.TRUE
+                else:
+                    Switch_Mastership = main.FALSE
+            elif i>=2 and i<5:
+                response = main.Mininet1.get_sw_controller("s"+str(i))
+                print("Response is " + str(response))
+                if re.search("tcp:"+ONOS1_ip,response):
+                    Switch_Mastership = Switch_Mastership and main.TRUE
+                else:
+                    Switch_Mastership = main.FALSE
+            elif i>=5 and i<8:
+                response = main.Mininet1.get_sw_controller("s"+str(i))
+                print("Response is " + str(response))
+                if re.search("tcp:"+ONOS1_ip,response):
+                    Switch_Mastership = Switch_Mastership and main.TRUE
+                else:
+                    Switch_Mastership = main.FALSE
+            elif i>=8 and i<18:
+                response = main.Mininet1.get_sw_controller("s"+str(i))
+                print("Response is " + str(response))
+                if re.search("tcp:"+ONOS1_ip,response):
+                    Switch_Mastership = Switch_Mastership and main.TRUE
+                else:
+                    Switch_Mastership = main.FALSE
+            elif i>=18 and i<28:
+                response = main.Mininet1.get_sw_controller("s"+str(i))
+                print("Response is " + str(response))
+                if re.search("tcp:"+ONOS1_ip,response):
+                    Switch_Mastership = Switch_Mastership and main.TRUE
+                else:
+                    Switch_Mastership = main.FALSE
+            else:
+                response = main.Mininet1.get_sw_controller("s"+str(i))
+                print("Response is" + str(response))
+                if re.search("tcp:" +ONOS1_ip,response):
+                    Switch_Mastership = Switch_Mastership and main.TRUE
+                else:
+                    Switch_Mastership = main.FALSE
+
+        if Switch_Mastership == main.TRUE:
+            main.log.report("Controller assignmnet successful")
+        else:
+            main.log.report("Controller assignmnet failed")
+        utilities.assert_equals(expect = main.TRUE,actual=Switch_Mastership,
+                onpass="MasterControllers assigned correctly")
+        '''
+        for i in range (1,29):
+            main.Mininet1.assign_sw_controller(sw=str(i),count=5,
+                    ip1=ONOS1_ip,port1=ONOS1_port,
+                    ip2=ONOS2_ip,port2=ONOS2_port,
+                    ip3=ONOS3_ip,port3=ONOS3_port,
+                    ip4=ONOS4_ip,port4=ONOS4_port,
+                    ip5=ONOS5_ip,port5=ONOS5_port)
+        '''
+        #REACTIVE FWD test
+
+        main.step("Get list of hosts from Mininet")
+        host_list = main.Mininet1.get_hosts()
+        main.log.info(host_list)
+
+        main.step("Get host list in ONOS format")
+        host_onos_list = main.ONOS2.get_hosts_id(host_list)
+        main.log.info(host_onos_list)
+        #time.sleep(5)
+        
+        main.step("Pingall")
+        ping_result = main.FALSE
+        while ping_result == main.FALSE:
+            time1 = time.time()
+            ping_result = main.Mininet1.pingall()
+            time2 = time.time()
+            print "Time for pingall: %2f seconds" % (time2 - time1)
+      
+        #Start onos cli again because u might have dropped out of onos prompt to the shell prompt
+        #if there was no activity
+        main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
+
+        case4_result = Switch_Mastership and ping_result
+        if ping_result == main.TRUE:
+            main.log.report("Pingall Test in reactive mode to discover the hosts successful") 
+        else:
+            main.log.report("Pingall Test in reactive mode to discover the hosts failed")
+
+        utilities.assert_equals(expect=main.TRUE, actual=case4_result,onpass="Controller assignment and Pingall Test successful",onfail="Controller assignment and Pingall Test NOT successful")   
+
+    def CASE10(self):
+        main.log.report("This testcase uninstalls the reactive forwarding app")
+        main.log.report("__________________________________")
+        main.case("Uninstalling reactive forwarding app")
+        #Unistall onos-app-fwd app to disable reactive forwarding
+        appUninstall_result = main.ONOS2.feature_uninstall("onos-app-fwd")
+        main.log.info("onos-app-fwd uninstalled")
+
+        #After reactive forwarding is disabled, the reactive flows on switches timeout in 10-15s
+        #So sleep for 15s
+        time.sleep(15)
+
+        flows = main.ONOS2.flows()
+        main.log.info(flows)
+
+        case10_result = appUninstall_result
+        utilities.assert_equals(expect=main.TRUE, actual=case10_result,onpass="Reactive forwarding app uninstallation successful",onfail="Reactive forwarding app uninstallation failed") 
+
+    
+    def CASE6(self):
+        main.log.report("This testcase is testing the addition of host intents and then does pingall")
+        main.log.report("__________________________________")
+        main.case("Obtaining host id's")
+        main.step("Get hosts")
+        hosts = main.ONOS2.hosts()
+        #main.log.info(hosts)
+
+        main.step("Get all devices id")
+        devices_id_list = main.ONOS2.get_all_devices_id()
+        #main.log.info(devices_id_list)
+        
+        #ONOS displays the hosts in hex format unlike mininet which does in decimal format
+        #So take care while adding intents
+        '''
+        main.step("Add host-to-host intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:08/-1", "00:00:00:00:00:12/-1")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:09/-1", "00:00:00:00:00:13/-1")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0A/-1", "00:00:00:00:00:14/-1")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0B/-1", "00:00:00:00:00:15/-1")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0C/-1", "00:00:00:00:00:16/-1")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0D/-1", "00:00:00:00:00:17/-1")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0E/-1", "00:00:00:00:00:18/-1")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0F/-1", "00:00:00:00:00:19/-1")
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:10/-1", "00:00:00:00:00:1A/-1") 
+        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1")
+        print "_____________________________________________________________________________________"
+        '''
+        
+        for i in range(8,18):
+            main.log.info("Adding host intent between h"+str(i)+" and h"+str(i+10))
+            host1 =  "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
+            host2 =  "00:00:00:00:00:" + str(hex(i+10)[2:]).zfill(2).upper()
+            #NOTE: get host can return None
+            #TODO: handle this
+            host1_id = main.ONOS2.get_host(host1)['id']
+            host2_id = main.ONOS2.get_host(host2)['id']
+            tmp_result = main.ONOS2.add_host_intent(host1_id, host2_id )        
+
+        time.sleep(10)
+        h_intents = main.ONOS2.intents(json_format = False)
+        main.log.info("intents:" +h_intents)
+        flowHandle = main.ONOS2.flows()
+        #main.log.info("flow:" +flowHandle)
+
+        count = 1
+        i = 8
+        Ping_Result = main.TRUE
+        #while i<10:
+        while i <18 :
+            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
+            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
+            if ping == main.FALSE and count <5:
+                count+=1
+                #i = 8
+                Ping_Result = main.FALSE
+                main.log.report("Ping between h" + str(i) + " and h" + str(i+10) + " failed. Making attempt number "+str(count) + " in 2 seconds")
+                time.sleep(2)
+            elif ping==main.FALSE:
+                main.log.report("All ping attempts between h" + str(i) + " and h" + str(i+10) +"have failed")
+                i=19
+                Ping_Result = main.FALSE
+            elif ping==main.TRUE:
+                main.log.info("Ping test between h" + str(i) + " and h" + str(i+10) + "passed!")
+                i+=1
+                Ping_Result = main.TRUE
+            else:
+                main.log.info("Unknown error")
+                Ping_Result = main.ERROR
+        if Ping_Result==main.FALSE:
+            main.log.report("Ping all test after Host intent addition failed. Cleaning up")
+            #main.cleanup()
+            #main.exit()
+        if Ping_Result==main.TRUE:
+            main.log.report("Ping all test after Host intent addition successful")
+            
+        case6_result = Ping_Result
+        utilities.assert_equals(expect=main.TRUE, actual=case6_result,
+                onpass="Pingall Test after Host intents addition successful",
+                onfail="Pingall Test after Host intents addition failed")
+
+
+    def CASE5(self,main) :
+        import json
+        from subprocess import Popen, PIPE
+        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
+        #main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
+        deviceResult = main.ONOS2.devices()
+        linksResult = main.ONOS2.links()
+        #portsResult = main.ONOS2.ports()
+        print "**************"
+
+        main.log.report("This testcase is testing if all ONOS nodes are in topology sync with mininet")
+        main.log.report("__________________________________")
+        main.case("Comparing Mininet topology with the topology of ONOS")
+        main.step("Start continuous pings")
+        main.Mininet2.pingLong(src=main.params['PING']['source1'],
+                            target=main.params['PING']['target1'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source2'],
+                            target=main.params['PING']['target2'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source3'],
+                            target=main.params['PING']['target3'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source4'],
+                            target=main.params['PING']['target4'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source5'],
+                            target=main.params['PING']['target5'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source6'],
+                            target=main.params['PING']['target6'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source7'],
+                            target=main.params['PING']['target7'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source8'],
+                            target=main.params['PING']['target8'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source9'],
+                            target=main.params['PING']['target9'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source10'],
+                            target=main.params['PING']['target10'],pingTime=500)
+
+        main.step("Create TestONTopology object")
+        global ctrls
+        ctrls = []
+        count = 1
+        while True:
+            temp = ()
+            if ('ip' + str(count)) in main.params['CTRL']:
+                temp = temp + (getattr(main,('ONOS' + str(count))),)
+                temp = temp + ("ONOS"+str(count),)
+                temp = temp + (main.params['CTRL']['ip'+str(count)],)
+                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
+                ctrls.append(temp)
+                count = count + 1
+            else:
+                break
+        global MNTopo
+        Topo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+        MNTopo = Topo
+
+        Topology_Check = main.TRUE
+        main.step("Compare ONOS Topology to MN Topology")
+        devices_json = main.ONOS2.devices()
+        links_json = main.ONOS2.links()
+        #ports_json = main.ONOS2.ports()
+        print "devices_json= ", devices_json
+        
+        result1 = main.Mininet1.compare_switches(MNTopo, json.loads(devices_json))
+        result2 = main.Mininet1.compare_links(MNTopo, json.loads(links_json))
+        #result3 = main.Mininet1.compare_ports(MNTopo, json.loads(ports_json))
+            
+        #result = result1 and result2 and result3
+        result = result1 and result2
+        
+        print "***********************"
+        if result == main.TRUE:
+            main.log.report("ONOS"+ " Topology matches MN Topology")
+        else:
+            main.log.report("ONOS"+ " Topology does not match MN Topology") 
+
+        utilities.assert_equals(expect=main.TRUE,actual=result,
+            onpass="ONOS" + " Topology matches MN Topology",
+            onfail="ONOS" + " Topology does not match MN Topology")
+        
+        Topology_Check = Topology_Check and result
+        utilities.assert_equals(expect=main.TRUE,actual=Topology_Check,
+            onpass="Topology checks passed", onfail="Topology checks failed")
+    
+
+    def CASE7 (self,main):
+       
+        ONOS1_ip = main.params['CTRL']['ip1']
+
+        link_sleep = int(main.params['timers']['LinkDiscovery'])
+
+        main.log.report("This testscase is killing a link to ensure that link discovery is consistent")
+        main.log.report("__________________________________")
+        main.log.report("Killing a link to ensure that link discovery is consistent")
+        main.case("Killing a link to Ensure that Link Discovery is Working Properly")
+        '''
+        main.step("Start continuous pings")
+       
+        main.Mininet2.pingLong(src=main.params['PING']['source1'],
+                            target=main.params['PING']['target1'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source2'],
+                            target=main.params['PING']['target2'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source3'],
+                            target=main.params['PING']['target3'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source4'],
+                            target=main.params['PING']['target4'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source5'],
+                            target=main.params['PING']['target5'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source6'],
+                            target=main.params['PING']['target6'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source7'],
+                            target=main.params['PING']['target7'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source8'],
+                            target=main.params['PING']['target8'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source9'],
+                            target=main.params['PING']['target9'],pingTime=500)
+        main.Mininet2.pingLong(src=main.params['PING']['source10'],
+                            target=main.params['PING']['target10'],pingTime=500)
+        '''
+
+        main.step("Determine the current number of switches and links")
+        topology_output = main.ONOS2.topology()
+        topology_result = main.ONOS1.get_topology(topology_output)
+        activeSwitches = topology_result['devices']
+        links = topology_result['links']
+        print "activeSwitches = ", type(activeSwitches)
+        print "links = ", type(links)
+        main.log.info("Currently there are %s switches and %s links"  %(str(activeSwitches), str(links)))
+
+        main.step("Kill Link between s3 and s28")
+        main.Mininet1.link(END1="s3",END2="s28",OPTION="down")
+        time.sleep(link_sleep)
+        topology_output = main.ONOS2.topology()
+        Link_Down = main.ONOS1.check_status(topology_output,activeSwitches,str(int(links)-2))
+        if Link_Down == main.TRUE:
+            main.log.report("Link Down discovered properly")
+        utilities.assert_equals(expect=main.TRUE,actual=Link_Down,
+                onpass="Link Down discovered properly",
+                onfail="Link down was not discovered in "+ str(link_sleep) + " seconds")
+       
+        #Check ping result here..add code for it
+         
+        main.step("Bring link between s3 and s28 back up")
+        Link_Up = main.Mininet1.link(END1="s3",END2="s28",OPTION="up")
+        time.sleep(link_sleep)
+        topology_output = main.ONOS2.topology()
+        Link_Up = main.ONOS1.check_status(topology_output,activeSwitches,str(links))
+        if Link_Up == main.TRUE:
+            main.log.report("Link up discovered properly")
+        utilities.assert_equals(expect=main.TRUE,actual=Link_Up,
+                onpass="Link up discovered properly",
+                onfail="Link up was not discovered in "+ str(link_sleep) + " seconds")
+            
+        #NOTE Check ping result here..add code for it
+        
+        
+        main.step("Compare ONOS Topology to MN Topology")
+        Topo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+        MNTopo = Topo
+        Topology_Check = main.TRUE
+        
+        devices_json = main.ONOS2.devices()
+        links_json = main.ONOS2.links()
+        ports_json = main.ONOS2.ports()
+        print "devices_json= ", devices_json
+        
+        result1 = main.Mininet1.compare_switches(MNTopo, json.loads(devices_json))
+        result2 = main.Mininet1.compare_links(MNTopo, json.loads(links_json))
+        #result3 = main.Mininet1.compare_ports(MNTopo, json.loads(ports_json))
+            
+        #result = result1 and result2 and result3
+        result = result1 and result2
+        print "***********************"
+        
+        if result == main.TRUE:
+            main.log.report("ONOS"+ " Topology matches MN Topology")
+        utilities.assert_equals(expect=main.TRUE,actual=result,
+            onpass="ONOS" + " Topology matches MN Topology",
+            onfail="ONOS" + " Topology does not match MN Topology")
+        
+        Topology_Check = Topology_Check and result
+        utilities.assert_equals(expect=main.TRUE,actual=Topology_Check,
+            onpass="Topology checks passed", onfail="Topology checks failed")
+    
+        result = Link_Down and Link_Up and Topology_Check
+        utilities.assert_equals(expect=main.TRUE,actual=result,
+                onpass="Link failure is discovered correctly",
+                onfail="Link Discovery failed")
+
+
+    def CASE8(self):
+        '''
+        Host intents removal
+        ''' 
+        main.log.report("This testcase removes host intents before adding the same intents or point intents")
+        main.log.report("__________________________________")        
+        main.log.info("Host intents removal")
+        main.case("Removing host intents")
+        main.step("Obtain the intent id's")
+        intent_result = main.ONOS2.intents(json_format = False)
+        main.log.info("intent_result = " +intent_result)        
+ 
+        intent_linewise = intent_result.split("\n")
+        intentList = []
+        for line in intent_linewise:
+            if line.startswith("id="):
+                intentList.append(line)
+        
+        intentids = []
+        for line in intentList:
+            intentids.append(line.split(",")[0].split("=")[1])
+        for id in intentids:
+            print "id = ", id
+        
+        main.step("Iterate through the intentids list and remove each intent")
+        for id in intentids:
+            main.ONOS2.remove_intent(intent_id = id)
+        
+        intent_result = main.ONOS2.intents(json_format = False)
+        main.log.info("intent_result = " +intent_result)        
+
+        case8_result = main.TRUE
+        if case8_result == main.TRUE:
+            main.log.report("Intent removal successful")
+        else:
+            main.log.report("Intent removal failed")
+       
+        Ping_Result = main.TRUE
+        if case8_result == main.TRUE:
+            i = 8
+            while i <18 :
+                main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
+                ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
+                if ping==main.TRUE:
+                    i = 19
+                    Ping_Result = Ping_Result and main.TRUE
+                elif ping==main.FALSE:
+                    i+=1
+                    Ping_Result = Ping_Result and main.FALSE
+                else:
+                    main.log.info("Unknown error")
+                    Ping_Result = main.ERROR
+
+            #Note: If the ping result failed, that means the intents have been withdrawn correctly.
+        if Ping_Result==main.TRUE:
+            main.log.report("Host intents have not been withdrawn correctly")
+            #main.cleanup()
+            #main.exit()
+        if Ping_Result==main.FALSE:
+            main.log.report("Host intents have been withdrawn correctly")
+
+        case8_result = case8_result and Ping_Result
+
+        if case8_result == main.FALSE:
+            main.log.report("Intent removal successful")
+        else:
+            main.log.report("Intent removal failed")
+
+        utilities.assert_equals(expect=main.FALSE, actual=case8_result,
+                onpass="Intent removal test failed",
+                onfail="Intent removal test passed")
+
+
+    def CASE9(self):
+        main.log.report("This testcase adds point intents and then does pingall")
+        main.log.report("__________________________________") 
+        main.log.info("Adding point intents")
+        main.case("Adding bidirectional point for mn hosts(h8-h18,h9-h19,h10-h20,h11-h21,h12-h22,h13-h23,h14-h24,h15-h25,h16-h26,h17-h27)") 
+        main.step("Add point-to-point intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003008/1", "of:0000000000006018/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006018/1", "of:0000000000003008/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        main.step("Add point-to-point intents for mininet hosts h9 and h19 or ONOS hosts h9 and h13")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003009/1", "of:0000000000006019/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006019/1", "of:0000000000003009/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+        
+        main.step("Add point-to-point intents for mininet hosts h10 and h20 or ONOS hosts hA and h14")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003010/1", "of:0000000000006020/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006020/1", "of:0000000000003010/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+
+        main.step("Add point-to-point intents for mininet hosts h11 and h21 or ONOS hosts hB and h15")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003011/1", "of:0000000000006021/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006021/1", "of:0000000000003011/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+            
+        main.step("Add point-to-point intents for mininet hosts h12 and h22 or ONOS hosts hC and h16")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003012/1", "of:0000000000006022/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006022/1", "of:0000000000003012/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+            
+        main.step("Add point-to-point intents for mininet hosts h13 and h23 or ONOS hosts hD and h17")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003013/1", "of:0000000000006023/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006023/1", "of:0000000000003013/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+
+        main.step("Add point-to-point intents for mininet hosts h14 and h24 or ONOS hosts hE and h18")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003014/1", "of:0000000000006024/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006024/1", "of:0000000000003014/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+            
+        main.step("Add point-to-point intents for mininet hosts h15 and h25 or ONOS hosts hF and h19")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003015/1", "of:0000000000006025/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006025/1", "of:0000000000003015/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+            
+        main.step("Add point-to-point intents for mininet hosts h16 and h26 or ONOS hosts h10 and h1A")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003016/1", "of:0000000000006026/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006026/1", "of:0000000000003016/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+
+
+        main.step("Add point-to-point intents for mininet hosts h17 and h27 or ONOS hosts h11 and h1B")
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003017/1", "of:0000000000006027/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+       
+        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006027/1", "of:0000000000003017/1")
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info("Point to point intent install successful")
+            #main.log.info(get_intent_result)
+
+        print("_______________________________________________________________________________________")
+
+        flowHandle = main.ONOS2.flows()
+        #print "flowHandle = ", flowHandle
+        main.log.info("flows :" + flowHandle)        
+
+        count = 1
+        i = 8
+        Ping_Result = main.TRUE
+        while i <18 :
+            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
+            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
+            if ping == main.FALSE and count <5:
+                count+=1
+                #i = 8
+                Ping_Result = main.FALSE
+                main.log.report("Ping between h" + str(i) + " and h" + str(i+10) + " failed. Making attempt number "+str(count) + " in 2 seconds")
+                time.sleep(2)
+            elif ping==main.FALSE:
+                main.log.report("All ping attempts between h" + str(i) + " and h" + str(i+10) +"have failed")
+                i=19
+                Ping_Result = main.FALSE
+            elif ping==main.TRUE:
+                main.log.info("Ping test between h" + str(i) + " and h" + str(i+10) + "passed!")
+                i+=1
+                Ping_Result = main.TRUE
+            else:
+                main.log.info("Unknown error")
+                Ping_Result = main.ERROR
+
+        if Ping_Result==main.FALSE:
+            main.log.report("Point intents have not ben installed correctly. Cleaning up")
+            #main.cleanup()
+            #main.exit()
+        if Ping_Result==main.TRUE:
+            main.log.report("Point Intents have been installed correctly")
+
+        case9_result = Ping_Result
+        utilities.assert_equals(expect=main.TRUE, actual=case9_result,
+                onpass="Point intents addition and Pingall Test successful",
+                onfail="Point intents addition and Pingall Test NOT successful")
+
+
diff --git a/TestON/tests/ProdFunc13/ProdFunc13.topo b/TestON/tests/ProdFunc13/ProdFunc13.topo
new file mode 100755
index 0000000..c592e18
--- /dev/null
+++ b/TestON/tests/ProdFunc13/ProdFunc13.topo
@@ -0,0 +1,103 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOSbench>
+
+        <ONOS1>
+            <host>10.128.10.11</host>
+            <user>sdn</user>
+            <password>sdn</password>
+            <type>OnosDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1>
+
+        <ONOS2>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS2>
+
+         <ONOS3>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS3>
+       
+
+        <Mininet1>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS>
+                #Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+                <arg2> --topo mytopo </arg2>
+                <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet1>
+
+        <Mininet2>
+            <host>10.128.10.11</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>RemoteMininetDriver</type>
+            <connect_order>6</connect_order>
+            <COMPONENTS>
+                #Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/topo-HA.py </arg1>
+                <arg2> --topo mytopo </arg2>
+                <arg3> --switch ovs,protocols=OpenFlow13 </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet2>
+
+        <LincOE1>
+            <host>10.128.20.30</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>LincOEDriver</type>
+            <connect_order>7</connect_order>
+            <COMPONENTS>
+                <arg1> </arg1>
+            </COMPONENTS>
+        </LincOE1>
+
+        <LincOE2>
+            <host>10.128.20.30</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>RemoteMininetDriver</type>
+            <connect_order>8</connect_order>
+            <COMPONENTS>
+                <arg1> sudo python /home/admin/optical.py </arg1>
+                <arg2> </arg2>
+            </COMPONENTS>
+        </LincOE2>
+
+        <LincOE3>
+            <host>10.128.20.30</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>LincOEDriver</type>
+            <connect_order>9</connect_order>
+        </LincOE3>
+ 
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/SdnIpTest/SdnIpTest.params b/TestON/tests/SdnIpTest/SdnIpTest.params
new file mode 100755
index 0000000..bb5826d
--- /dev/null
+++ b/TestON/tests/SdnIpTest/SdnIpTest.params
@@ -0,0 +1,25 @@
+<PARAMS>
+    
+    <testcases>1,2</testcases>
+
+    #Environment variables
+    <ENV>
+        <cellName>sdnip_single_instance</cellName>
+    </ENV>
+
+    <CTRL>
+        <ip1>10.128.4.52</ip1>
+        <port1>6633</port1>
+    </CTRL>
+
+    <GIT>
+        <autoPull>off</autoPull>
+        <checkout>master</checkout>
+    </GIT>
+
+    <JSON>
+        <prefix>prefix</prefix>
+        <nextHop>nextHop</nextHop>
+    </JSON>
+
+</PARAMS>
diff --git a/TestON/tests/SdnIpTest/SdnIpTest.py b/TestON/tests/SdnIpTest/SdnIpTest.py
new file mode 100755
index 0000000..4f55c02
--- /dev/null
+++ b/TestON/tests/SdnIpTest/SdnIpTest.py
@@ -0,0 +1,463 @@
+# from cupshelpers.config import prefix
+
+# Testing the basic functionality of SDN-IP
+
+class SdnIpTest:
+    def __init__(self):
+        self.default = ''
+
+    def CASE1(self, main):
+
+        '''
+        Test the SDN-IP functionality
+        allRoutes_expected: all expected routes for all BGP peers
+        routeIntents_expected: all expected MultiPointToSinglePointIntent intents
+        bgpIntents_expected: expected PointToPointIntent intents
+        allRoutes_actual: all routes from ONOS LCI
+        routeIntents_actual: actual MultiPointToSinglePointIntent intents from ONOS CLI
+        bgpIntents_actual: actual PointToPointIntent intents from ONOS CLI
+        '''
+        import time
+        import json
+        from operator import eq
+        # from datetime import datetime
+        from time import localtime, strftime
+
+        main.case("The test case is to help to setup the TestON environment and test new drivers")
+        SDNIP_JSON_FILE_PATH = "../tests/SdnIpTest/sdnip.json"
+        # all expected routes for all BGP peers
+        allRoutes_expected = []
+        main.step("Start to generate routes for all BGP peers")
+        # bgpPeerHosts = []
+        # for i in range(3, 5):
+        #    bgpPeerHosts.append("host" + str(i))
+        # main.log.info("BGP Peer Hosts are:" + bgpPeerHosts)
+
+        # for i in range(3, 5):
+         #   QuaggaCliHost = "QuaggaCliHost" + str(i)
+          #  prefixes = main.QuaggaCliHost.generate_prefixes(3, 10)
+
+           # main.log.info(prefixes)
+            # allRoutes_expected.append(prefixes)
+        main.log.info("Generate prefixes for host3")
+        prefixes_host3 = main.QuaggaCliHost3.generate_prefixes(3, 10)
+        main.log.info(prefixes_host3)
+        # generate route with next hop
+        for prefix in prefixes_host3:
+            allRoutes_expected.append(prefix + "/" + "192.168.20.1")
+        routeIntents_expected_host3 = main.QuaggaCliHost3.generate_expected_onePeerRouteIntents(prefixes_host3, "192.168.20.1", "00:00:00:00:02:02", SDNIP_JSON_FILE_PATH)
+
+        main.log.info("Generate prefixes for host4")
+        prefixes_host4 = main.QuaggaCliHost4.generate_prefixes(4, 10)
+        main.log.info(prefixes_host4)
+        # generate route with next hop
+        for prefix in prefixes_host4:
+            allRoutes_expected.append(prefix + "/" + "192.168.30.1")
+        routeIntents_expected_host4 = main.QuaggaCliHost4.generate_expected_onePeerRouteIntents(prefixes_host4, "192.168.30.1", "00:00:00:00:03:01", SDNIP_JSON_FILE_PATH)
+
+        routeIntents_expected = routeIntents_expected_host3 + routeIntents_expected_host4
+
+
+        cell_name = main.params['ENV']['cellName']
+        ONOS1_ip = main.params['CTRL']['ip1']
+        main.step("Set cell for ONOS-cli environment")
+        main.ONOScli.set_cell(cell_name)
+        verify_result = main.ONOSbench.verify_cell()
+        main.log.report("Removing raft logs")
+        main.ONOSbench.onos_remove_raft_logs()
+        main.log.report("Uninstalling ONOS")
+        main.ONOSbench.onos_uninstall(ONOS1_ip)
+        main.step("Creating ONOS package")
+        package_result = main.ONOSbench.onos_package()
+
+        main.step("Starting ONOS service")
+        # TODO: start ONOS from Mininet Script
+        # start_result = main.ONOSbench.onos_start("127.0.0.1")
+        main.step("Installing ONOS package")
+        onos1_install_result = main.ONOSbench.onos_install(options="-f", node=ONOS1_ip)
+
+        main.step("Checking if ONOS is up yet")
+        time.sleep(60)
+        onos1_isup = main.ONOSbench.isup(ONOS1_ip)
+        if not onos1_isup:
+            main.log.report("ONOS1 didn't start!")
+
+        main.step("Start ONOS-cli")
+        # TODO: change the hardcode in start_onos_cli method in ONOS CLI driver
+
+        main.ONOScli.start_onos_cli(ONOS1_ip)
+
+        main.step("Get devices in the network")
+        list_result = main.ONOScli.devices(json_format=False)
+        main.log.info(list_result)
+        time.sleep(10)
+        main.log.info("Installing sdn-ip feature")
+        main.ONOScli.feature_install("onos-app-sdnip")
+        time.sleep(10)
+        main.step("Login all BGP peers and add routes into peers")
+        main.log.info("Login Quagga CLI on host3")
+        main.QuaggaCliHost3.loginQuagga("1.168.30.2")
+        main.log.info("Enter configuration model of Quagga CLI on host3")
+        main.QuaggaCliHost3.enter_config(64514)
+        main.log.info("Add routes to Quagga on host3")
+        main.QuaggaCliHost3.add_routes(prefixes_host3, 1)
+
+        main.log.info("Login Quagga CLI on host4")
+        main.QuaggaCliHost4.loginQuagga("1.168.30.3")
+        main.log.info("Enter configuration model of Quagga CLI on host4")
+        main.QuaggaCliHost4.enter_config(64516)
+        main.log.info("Add routes to Quagga on host4")
+        main.QuaggaCliHost4.add_routes(prefixes_host4, 1)
+        time.sleep(60)
+
+        # get all routes inside SDN-IP
+        get_routes_result = main.ONOScli.routes(json_format=True)
+
+        # parse routes from ONOS CLI
+        allRoutes_actual = main.QuaggaCliHost3.extract_actual_routes(get_routes_result)
+
+        allRoutes_str_expected = str(sorted(allRoutes_expected))
+        allRoutes_str_actual = str(allRoutes_actual).replace('u', "")
+        main.step("Check routes installed")
+        main.log.info("Routes expected:")
+        main.log.info(allRoutes_str_expected)
+        main.log.info("Routes get from ONOS CLI:")
+        main.log.info(allRoutes_str_actual)
+        utilities.assert_equals(expect=allRoutes_str_expected, actual=allRoutes_str_actual,
+                                onpass="***Routes in SDN-IP are correct!***",
+                                onfail="***Routes in SDN-IP are wrong!***")
+        if(eq(allRoutes_str_expected, allRoutes_str_actual)):
+            main.log.report("***Routes in SDN-IP after adding routes are correct!***")
+        else:
+            main.log.report("***Routes in SDN-IP after adding routes are wrong!***")
+
+        time.sleep(20)
+        get_intents_result = main.ONOScli.intents(json_format=True)
+
+
+        main.step("Check MultiPointToSinglePointIntent intents installed")
+        # route_intents_expected are generated when generating routes
+        # get rpoute intents from ONOS CLI
+        routeIntents_actual = main.QuaggaCliHost3.extract_actual_routeIntents(get_intents_result)
+        routeIntents_str_expected = str(sorted(routeIntents_expected))
+        routeIntents_str_actual = str(routeIntents_actual).replace('u', "")
+        main.log.info("MultiPointToSinglePoint intents expected:")
+        main.log.info(routeIntents_str_expected)
+        main.log.info("MultiPointToSinglePoint intents get from ONOS CLI:")
+        main.log.info(routeIntents_str_actual)
+        utilities.assert_equals(expect=True, actual=eq(routeIntents_str_expected, routeIntents_str_actual),
+                                onpass="***MultiPointToSinglePoint Intents in SDN-IP are correct!***",
+                                onfail="***MultiPointToSinglePoint Intents in SDN-IP are wrong!***")
+
+        if(eq(routeIntents_str_expected, routeIntents_str_actual)):
+            main.log.report("***MultiPointToSinglePoint Intents before deleting routes correct!***")
+        else:
+            main.log.report("***MultiPointToSinglePoint Intents before deleting routes wrong!***")
+
+        main.step("Check BGP PointToPointIntent intents installed")
+        # bgp intents expected
+        bgpIntents_expected = main.QuaggaCliHost3.generate_expected_bgpIntents(SDNIP_JSON_FILE_PATH)
+        # get BGP intents from ONOS CLI
+        bgpIntents_actual = main.QuaggaCliHost3.extract_actual_bgpIntents(get_intents_result)
+
+        bgpIntents_str_expected = str(bgpIntents_expected).replace('u', "")
+        bgpIntents_str_actual = str(bgpIntents_actual)
+        main.log.info("PointToPointIntent intents expected:")
+        main.log.info(bgpIntents_str_expected)
+        main.log.info("PointToPointIntent intents get from ONOS CLI:")
+        main.log.info(bgpIntents_str_actual)
+
+        utilities.assert_equals(expect=True, actual=eq(bgpIntents_str_expected, bgpIntents_str_actual),
+                                onpass="***PointToPointIntent Intents in SDN-IP are correct!***",
+                                onfail="***PointToPointIntent Intents in SDN-IP are wrong!***")
+
+
+        if (eq(bgpIntents_str_expected, bgpIntents_str_actual)):
+            main.log.report("***PointToPointIntent Intents in SDN-IP are correct!***")
+        else:
+            main.log.report("***PointToPointIntent Intents in SDN-IP are wrong!***")
+
+
+
+        #============================= Ping Test ========================
+        # wait until all MultiPointToSinglePoint
+        time.sleep(20)
+        ping_test_script = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
+        ping_test_results_file = "~/SDNIP/SdnIpIntentDemo/log/CASE1-ping-results-before-delete-routes-" + strftime("%Y-%m-%d_%H:%M:%S", localtime()) + ".txt"
+        ping_test_results = main.QuaggaCliHost.ping_test("1.168.30.100", ping_test_script, ping_test_results_file)
+        main.log.info(ping_test_results)
+
+        # ping test
+
+        #============================= Deleting Routes ==================
+        main.step("Check deleting routes installed")
+        main.QuaggaCliHost3.delete_routes(prefixes_host3, 1)
+        main.QuaggaCliHost4.delete_routes(prefixes_host4, 1)
+
+        # main.log.info("main.ONOScli.get_routes_num() = " )
+        # main.log.info(main.ONOScli.get_routes_num())
+        # utilities.assert_equals(expect = "Total SDN-IP routes = 1", actual= main.ONOScli.get_routes_num(),
+        get_routes_result = main.ONOScli.routes(json_format=True)
+        allRoutes_actual = main.QuaggaCliHost3.extract_actual_routes(get_routes_result)
+        main.log.info("allRoutes_actual = ")
+        main.log.info(allRoutes_actual)
+
+        utilities.assert_equals(expect="[]", actual=str(allRoutes_actual),
+                                onpass="***Route number in SDN-IP is 0, correct!***",
+                                onfail="***Routes number in SDN-IP is not 0, wrong!***")
+
+        if(eq(allRoutes_str_expected, allRoutes_str_actual)):
+            main.log.report("***Routes in SDN-IP after deleting correct!***")
+        else:
+            main.log.report("***Routes in SDN-IP after deleting wrong!***")
+
+        main.step("Check intents after deleting routes")
+        get_intents_result = main.ONOScli.intents(json_format=True)
+        routeIntents_actual = main.QuaggaCliHost3.extract_actual_routeIntents(get_intents_result)
+        main.log.info("main.ONOScli.intents()= ")
+        main.log.info(routeIntents_actual)
+        utilities.assert_equals(expect="[]", actual=str(routeIntents_actual),
+                                onpass="***MultiPointToSinglePoint Intents number in SDN-IP is 0, correct!***",
+                                onfail="***MultiPointToSinglePoint Intents number in SDN-IP is 0, wrong!***")
+
+        if(eq(routeIntents_str_expected, routeIntents_str_actual)):
+            main.log.report("***MultiPointToSinglePoint Intents after deleting routes correct!***")
+        else:
+            main.log.report("***MultiPointToSinglePoint Intents after deleting routes wrong!***")
+
+        time.sleep(20)
+        ping_test_script = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
+        ping_test_results_file = "~/SDNIP/SdnIpIntentDemo/log/CASE1-ping-results-after-delete-routes-" + strftime("%Y-%m-%d_%H:%M:%S", localtime()) + ".txt"
+        ping_test_results = main.QuaggaCliHost.ping_test("1.168.30.100", ping_test_script, ping_test_results_file)
+        main.log.info(ping_test_results)
+        time.sleep(30)
+
+        # main.step("Test whether Mininet is started")
+        # main.Mininet2.handle.sendline("xterm host1")
+        # main.Mininet2.handle.expect("mininet>")
+
+
+    def CASE2(self, main):
+
+        '''
+        Test the SDN-IP functionality
+        allRoutes_expected: all expected routes for all BGP peers
+        routeIntents_expected: all expected MultiPointToSinglePointIntent intents
+        bgpIntents_expected: expected PointToPointIntent intents
+        allRoutes_actual: all routes from ONOS LCI
+        routeIntents_actual: actual MultiPointToSinglePointIntent intents from ONOS CLI
+        bgpIntents_actual: actual PointToPointIntent intents from ONOS CLI
+        '''
+        import time
+        import json
+        from operator import eq
+        from time import localtime, strftime
+
+        main.case("The test case is to help to setup the TestON environment and test new drivers")
+        SDNIP_JSON_FILE_PATH = "../tests/SdnIpTest/sdnip.json"
+        # all expected routes for all BGP peers
+        allRoutes_expected = []
+        main.step("Start to generate routes for all BGP peers")
+
+        main.log.info("Generate prefixes for host3")
+        prefixes_host3 = main.QuaggaCliHost3.generate_prefixes(3, 10)
+        main.log.info(prefixes_host3)
+        # generate route with next hop
+        for prefix in prefixes_host3:
+            allRoutes_expected.append(prefix + "/" + "192.168.20.1")
+        routeIntents_expected_host3 = main.QuaggaCliHost3.generate_expected_onePeerRouteIntents(prefixes_host3, "192.168.20.1", "00:00:00:00:02:02", SDNIP_JSON_FILE_PATH)
+
+        main.log.info("Generate prefixes for host4")
+        prefixes_host4 = main.QuaggaCliHost4.generate_prefixes(4, 10)
+        main.log.info(prefixes_host4)
+        # generate route with next hop
+        for prefix in prefixes_host4:
+            allRoutes_expected.append(prefix + "/" + "192.168.30.1")
+        routeIntents_expected_host4 = main.QuaggaCliHost4.generate_expected_onePeerRouteIntents(prefixes_host4, "192.168.30.1", "00:00:00:00:03:01", SDNIP_JSON_FILE_PATH)
+
+        routeIntents_expected = routeIntents_expected_host3 + routeIntents_expected_host4
+
+        main.log.report("Removing raft logs")
+        main.ONOSbench.onos_remove_raft_logs()
+        main.log.report("Uninstalling ONOS")
+        main.ONOSbench.onos_uninstall(ONOS1_ip)
+
+        cell_name = main.params['ENV']['cellName']
+        ONOS1_ip = main.params['CTRL']['ip1']
+        main.step("Set cell for ONOS-cli environment")
+        main.ONOScli.set_cell(cell_name)
+        verify_result = main.ONOSbench.verify_cell()
+        #main.log.report("Removing raft logs")
+        #main.ONOSbench.onos_remove_raft_logs()
+        #main.log.report("Uninstalling ONOS")
+        #main.ONOSbench.onos_uninstall(ONOS1_ip)
+        main.step("Creating ONOS package")
+        package_result = main.ONOSbench.onos_package()
+
+        main.step("Installing ONOS package")
+        onos1_install_result = main.ONOSbench.onos_install(options="-f", node=ONOS1_ip)
+
+        main.step("Checking if ONOS is up yet")
+        time.sleep(60)
+        onos1_isup = main.ONOSbench.isup(ONOS1_ip)
+        if not onos1_isup:
+            main.log.report("ONOS1 didn't start!")
+
+        main.step("Start ONOS-cli")
+        main.ONOScli.start_onos_cli(ONOS1_ip)
+
+        main.step("Get devices in the network")
+        list_result = main.ONOScli.devices(json_format=False)
+        main.log.info(list_result)
+        time.sleep(10)
+        main.log.info("Installing sdn-ip feature")
+        main.ONOScli.feature_install("onos-app-sdnip")
+        time.sleep(10)
+
+
+        main.step("Check BGP PointToPointIntent intents installed")
+        # bgp intents expected
+        bgpIntents_expected = main.QuaggaCliHost3.generate_expected_bgpIntents(SDNIP_JSON_FILE_PATH)
+        # get BGP intents from ONOS CLI
+        get_intents_result = main.ONOScli.intents(json_format=True)
+        bgpIntents_actual = main.QuaggaCliHost3.extract_actual_bgpIntents(get_intents_result)
+
+        bgpIntents_str_expected = str(bgpIntents_expected).replace('u', "")
+        bgpIntents_str_actual = str(bgpIntents_actual)
+        main.log.info("PointToPointIntent intents expected:")
+        main.log.info(bgpIntents_str_expected)
+        main.log.info("PointToPointIntent intents get from ONOS CLI:")
+        main.log.info(bgpIntents_str_actual)
+
+        utilities.assert_equals(expect=True, actual=eq(bgpIntents_str_expected, bgpIntents_str_actual),
+                                onpass="***PointToPointIntent Intents in SDN-IP are correct!***",
+                                onfail="***PointToPointIntent Intents in SDN-IP are wrong!***")
+
+        if (eq(bgpIntents_str_expected, bgpIntents_str_actual)):
+            main.log.report("***PointToPointIntent Intents in SDN-IP are correct!***")
+        else:
+            main.log.report("***PointToPointIntent Intents in SDN-IP are wrong!***")
+
+
+        allRoutes_str_expected = str(sorted(allRoutes_expected))
+        routeIntents_str_expected = str(sorted(routeIntents_expected))
+        ping_test_script = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
+        # round_num = 0;
+        # while(True):
+        for round_num in range(1, 6):
+            # round = round + 1;
+            main.log.report("The Round " + str(round_num) + " test starts........................................")
+
+            main.step("Login all BGP peers and add routes into peers")
+            main.log.info("Login Quagga CLI on host3")
+            main.QuaggaCliHost3.loginQuagga("1.168.30.2")
+            main.log.info("Enter configuration model of Quagga CLI on host3")
+            main.QuaggaCliHost3.enter_config(64514)
+            main.log.info("Add routes to Quagga on host3")
+            main.QuaggaCliHost3.add_routes(prefixes_host3, 1)
+
+            main.log.info("Login Quagga CLI on host4")
+            main.QuaggaCliHost4.loginQuagga("1.168.30.3")
+            main.log.info("Enter configuration model of Quagga CLI on host4")
+            main.QuaggaCliHost4.enter_config(64516)
+            main.log.info("Add routes to Quagga on host4")
+            main.QuaggaCliHost4.add_routes(prefixes_host4, 1)
+            time.sleep(60)
+
+            # get all routes inside SDN-IP
+            get_routes_result = main.ONOScli.routes(json_format=True)
+
+            # parse routes from ONOS CLI
+            allRoutes_actual = main.QuaggaCliHost3.extract_actual_routes(get_routes_result)
+
+            # allRoutes_str_expected = str(sorted(allRoutes_expected))
+            allRoutes_str_actual = str(allRoutes_actual).replace('u', "")
+            main.step("Check routes installed")
+            main.log.info("Routes expected:")
+            main.log.info(allRoutes_str_expected)
+            main.log.info("Routes get from ONOS CLI:")
+            main.log.info(allRoutes_str_actual)
+            utilities.assert_equals(expect=allRoutes_str_expected, actual=allRoutes_str_actual,
+                                    onpass="***Routes in SDN-IP are correct!***",
+                                    onfail="***Routes in SDN-IP are wrong!***")
+            if(eq(allRoutes_str_expected, allRoutes_str_actual)):
+                main.log.report("***Routes in SDN-IP after adding correct!***")
+            else:
+                main.log.report("***Routes in SDN-IP after adding wrong!***")
+
+            time.sleep(20)
+            get_intents_result = main.ONOScli.intents(json_format=True)
+
+
+            main.step("Check MultiPointToSinglePointIntent intents installed")
+            # route_intents_expected are generated when generating routes
+            # get route intents from ONOS CLI
+            routeIntents_actual = main.QuaggaCliHost3.extract_actual_routeIntents(get_intents_result)
+            # routeIntents_str_expected = str(sorted(routeIntents_expected))
+            routeIntents_str_actual = str(routeIntents_actual).replace('u', "")
+            main.log.info("MultiPointToSinglePoint intents expected:")
+            main.log.info(routeIntents_str_expected)
+            main.log.info("MultiPointToSinglePoint intents get from ONOS CLI:")
+            main.log.info(routeIntents_str_actual)
+            utilities.assert_equals(expect=True, actual=eq(routeIntents_str_expected, routeIntents_str_actual),
+                                    onpass="***MultiPointToSinglePoint Intents in SDN-IP are correct!***",
+                                    onfail="***MultiPointToSinglePoint Intents in SDN-IP are wrong!***")
+
+            if(eq(routeIntents_str_expected, routeIntents_str_actual)):
+                main.log.report("***MultiPointToSinglePoint Intents after adding routes correct!***")
+            else:
+                main.log.report("***MultiPointToSinglePoint Intents after adding routes wrong!***")
+
+            #============================= Ping Test ========================
+            # wait until all MultiPointToSinglePoint
+            time.sleep(20)
+            # ping_test_script = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
+            ping_test_results_file = "~/SDNIP/SdnIpIntentDemo/log/CASE2-Round" + str(round_num) + "-ping-results-before-delete-routes-" + strftime("%Y-%m-%d_%H:%M:%S", localtime()) + ".txt"
+            ping_test_results = main.QuaggaCliHost.ping_test("1.168.30.100", ping_test_script, ping_test_results_file)
+            main.log.info(ping_test_results)
+            # ping test
+
+            #============================= Deleting Routes ==================
+            main.step("Check deleting routes installed")
+            main.log.info("Delete routes to Quagga on host3")
+            main.QuaggaCliHost3.delete_routes(prefixes_host3, 1)
+            main.log.info("Delete routes to Quagga on host4")
+            main.QuaggaCliHost4.delete_routes(prefixes_host4, 1)
+
+            get_routes_result = main.ONOScli.routes(json_format=True)
+            allRoutes_actual = main.QuaggaCliHost3.extract_actual_routes(get_routes_result)
+            main.log.info("allRoutes_actual = ")
+            main.log.info(allRoutes_actual)
+
+            utilities.assert_equals(expect="[]", actual=str(allRoutes_actual),
+                                    onpass="***Route number in SDN-IP is 0, correct!***",
+                                    onfail="***Routes number in SDN-IP is not 0, wrong!***")
+
+            if(eq(allRoutes_str_expected, allRoutes_str_actual)):
+                main.log.report("***Routes in SDN-IP after deleting correct!***")
+            else:
+                main.log.report("***Routes in SDN-IP after deleting wrong!***")
+
+            main.step("Check intents after deleting routes")
+            get_intents_result = main.ONOScli.intents(json_format=True)
+            routeIntents_actual = main.QuaggaCliHost3.extract_actual_routeIntents(get_intents_result)
+            main.log.info("main.ONOScli.intents()= ")
+            main.log.info(routeIntents_actual)
+            utilities.assert_equals(expect="[]", actual=str(routeIntents_actual),
+                                    onpass="***MultiPointToSinglePoint Intents number in SDN-IP is 0, correct!***",
+                                    onfail="***MultiPointToSinglePoint Intents number in SDN-IP is 0, wrong!***")
+
+            if(eq(routeIntents_str_expected, routeIntents_str_actual)):
+                main.log.report("***MultiPointToSinglePoint Intents after deleting routes correct!***")
+            else:
+                main.log.report("***MultiPointToSinglePoint Intents after deleting routes wrong!***")
+
+            time.sleep(20)
+            # ping_test_script = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
+            ping_test_results_file = "~/SDNIP/SdnIpIntentDemo/log/CASE2-Round" + str(round_num) + "-ping-results-after-delete-routes-" + strftime("%Y-%m-%d_%H:%M:%S", localtime()) + ".txt"
+            ping_test_results = main.QuaggaCliHost.ping_test("1.168.30.100", ping_test_script, ping_test_results_file)
+            main.log.info(ping_test_results)
+            time.sleep(30)
+
+
+
diff --git a/TestON/tests/SdnIpTest/SdnIpTest.topo b/TestON/tests/SdnIpTest/SdnIpTest.topo
new file mode 100755
index 0000000..6df1975
--- /dev/null
+++ b/TestON/tests/SdnIpTest/SdnIpTest.topo
@@ -0,0 +1,57 @@
+<TOPOLOGY>
+    <COMPONENT>
+
+        <ONOSbench>
+            <host>127.0.0.1</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOSbench>
+
+        <ONOScli>
+            <host>127.0.0.1</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOScli>
+
+        <ONOS1>
+            <host>10.128.4.52</host>
+            <user>sdn</user>
+            <password>rocks</password>
+            <type>OnosDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1>
+
+        <QuaggaCliHost3>
+            <host>127.0.0.1</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>QuaggaCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </QuaggaCliHost3>
+        <QuaggaCliHost4>
+            <host>127.0.0.1</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>QuaggaCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </QuaggaCliHost4>
+        <QuaggaCliHost>
+            <host>127.0.0.1</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>QuaggaCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </QuaggaCliHost>
+
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/JonTest/__init__.py b/TestON/tests/SdnIpTest/__init__.py
similarity index 100%
copy from TestON/tests/JonTest/__init__.py
copy to TestON/tests/SdnIpTest/__init__.py
diff --git a/TestON/tests/SdnIpTest/addresses.json b/TestON/tests/SdnIpTest/addresses.json
new file mode 100644
index 0000000..f7eb983
--- /dev/null
+++ b/TestON/tests/SdnIpTest/addresses.json
@@ -0,0 +1,36 @@
+{
+    "addresses" : [
+		{
+		    "dpid" : "00:00:00:00:00:00:00:a3",
+		    "port" : "1",
+		    "ips" : ["192.168.10.0/24"],
+                    "mac" : "00:00:00:00:00:01"
+			
+		},
+		{
+		    "dpid" : "00:00:00:00:00:00:00:a5",
+		    "port" : "1",
+		    "ips" : ["192.168.20.0/24"],
+		    "mac" : "00:00:00:00:00:01"
+		},
+		{
+		    "dpid" : "00:00:00:00:00:00:00:a2",
+		    "port" : "1",
+		    "ips" : ["192.168.30.0/24"],
+		    "mac" : "00:00:00:00:00:01"
+		},
+		{
+		    "dpid" : "00:00:00:00:00:00:00:a6",
+		    "port" : "1",
+		    "ips" : ["192.168.40.0/24"],
+		    "mac" : "00:00:00:00:00:01"
+		},
+		{
+		    "dpid" : "00:00:00:00:00:00:00:a4",
+		    "port" : "4",
+		    "ips" : ["192.168.60.0/24"],
+		    "mac" : "00:00:00:00:00:01"
+		}
+
+    ]
+}
\ No newline at end of file
diff --git a/TestON/tests/SdnIpTest/intents.json b/TestON/tests/SdnIpTest/intents.json
new file mode 100644
index 0000000..d17715f
--- /dev/null
+++ b/TestON/tests/SdnIpTest/intents.json
@@ -0,0 +1,1468 @@
+[  
+   {  
+      "id":"0xffffffffcb2cb6ec",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.10.101/32}, IPV4_DST{ip=192.168.10.1/32}, IP_PROTO{protocol=1}, ETH_TYPE{ethType=800}]",
+      "ingress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a3",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0x140a3304",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a3, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.10.101/32}, IPV4_DST{ip=192.168.10.1/32}, IP_PROTO{protocol=1}, ETH_TYPE{ethType=800}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a3, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0xffffffffcb2d9828",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.10.1/32}, IPV4_DST{ip=192.168.10.101/32}, IP_PROTO{protocol=1}, ETH_TYPE{ethType=800}]",
+      "ingress":{  
+         "device":"of:00000000000000a3",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0x1a89f138",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a3, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.10.1/32}, IPV4_DST{ip=192.168.10.101/32}, IP_PROTO{protocol=1}, ETH_TYPE{ethType=800}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a3, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0xffffffffd1418988",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.30.101/32}, IPV4_DST{ip=192.168.30.1/32}, IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}]",
+      "ingress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a2",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0x2cd85684",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a2, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a2, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.30.101/32}, IPV4_DST{ip=192.168.30.1/32}, IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a2, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a2, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0x3122a56b",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.40.101/32}, IPV4_DST{ip=192.168.40.1/32}, IP_PROTO{protocol=1}, ETH_TYPE{ethType=800}]",
+      "ingress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a6",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0x5874487",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a5, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a5, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a6, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a6, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.40.101/32}, IPV4_DST{ip=192.168.40.1/32}, IP_PROTO{protocol=1}, ETH_TYPE{ethType=800}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a5, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a5, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a6, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a6, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0x6ae96523",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.10.101/32}, IPV4_DST{ip=192.168.10.1/32}, IP_PROTO{protocol=6}, TCP_SRC{tcpPort=179}, ETH_TYPE{ethType=800}]",
+      "ingress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a3",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0x217361ed",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a3, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.10.101/32}, IPV4_DST{ip=192.168.10.1/32}, IP_PROTO{protocol=6}, TCP_SRC{tcpPort=179}, ETH_TYPE{ethType=800}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a3, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0xffffffffaee31428",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.30.1/32}, IPV4_DST{ip=192.168.30.101/32}, IP_PROTO{protocol=6}, TCP_SRC{tcpPort=179}, ETH_TYPE{ethType=800}]",
+      "ingress":{  
+         "device":"of:00000000000000a2",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0x68cad35c",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a2, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a2, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.30.1/32}, IPV4_DST{ip=192.168.30.101/32}, IP_PROTO{protocol=6}, TCP_SRC{tcpPort=179}, ETH_TYPE{ethType=800}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a2, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a2, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0xffffffffed2b21fa",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.20.1/32}, IPV4_DST{ip=192.168.20.101/32}, IP_PROTO{protocol=1}, ETH_TYPE{ethType=800}]",
+      "ingress":{  
+         "device":"of:00000000000000a5",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0xffffffffa5dbcf50",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a5, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a5, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.20.1/32}, IPV4_DST{ip=192.168.20.101/32}, IP_PROTO{protocol=1}, ETH_TYPE{ethType=800}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a5, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a5, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0x373774a3",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.60.101/32}, IPV4_DST{ip=192.168.60.1/32}, IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}]",
+      "ingress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a4",
+         "port":"4"
+      },
+      "installable":[  
+         {  
+            "id":"0x5a75d509",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a2, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a2, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a4, portNumber=1}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a4, portNumber=4}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.60.101/32}, IPV4_DST{ip=192.168.60.1/32}, IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a2, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a2, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a4, portNumber=1}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a4, portNumber=4}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0xffffffff8d492c5d",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.10.1/32}, IPV4_DST{ip=192.168.10.101/32}, IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}]",
+      "ingress":{  
+         "device":"of:00000000000000a3",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0xffffffffef408263",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a3, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.10.1/32}, IPV4_DST{ip=192.168.10.101/32}, IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a3, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0xffffffff8ce7d031",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.20.1/32}, IPV4_DST{ip=192.168.20.101/32}, IP_PROTO{protocol=6}, TCP_SRC{tcpPort=179}, ETH_TYPE{ethType=800}]",
+      "ingress":{  
+         "device":"of:00000000000000a5",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0xffffffffb344fe39",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a5, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a5, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.20.1/32}, IPV4_DST{ip=192.168.20.101/32}, IP_PROTO{protocol=6}, TCP_SRC{tcpPort=179}, ETH_TYPE{ethType=800}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a5, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a5, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0xf2665f1",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.30.1/32}, IPV4_DST{ip=192.168.30.101/32}, IP_PROTO{protocol=1}, ETH_TYPE{ethType=800}]",
+      "ingress":{  
+         "device":"of:00000000000000a2",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0x5b61a473",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a2, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a2, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.30.1/32}, IPV4_DST{ip=192.168.30.101/32}, IP_PROTO{protocol=1}, ETH_TYPE{ethType=800}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a2, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a2, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0xffffffffd0e186b8",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.40.1/32}, IPV4_DST{ip=192.168.40.101/32}, IP_PROTO{protocol=6}, TCP_SRC{tcpPort=179}, ETH_TYPE{ethType=800}]",
+      "ingress":{  
+         "device":"of:00000000000000a6",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0x4d8d4942",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a6, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a6, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a4, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a4, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.40.1/32}, IPV4_DST{ip=192.168.40.101/32}, IP_PROTO{protocol=6}, TCP_SRC{tcpPort=179}, ETH_TYPE{ethType=800}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a6, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a6, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a4, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a4, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0x3738d163",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.60.1/32}, IPV4_DST{ip=192.168.60.101/32}, IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}]",
+      "ingress":{  
+         "device":"of:00000000000000a4",
+         "port":"4"
+      },
+      "egress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0xffffffff993b0fc9",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a4, portNumber=4}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a4, portNumber=1}, dst=ConnectPoint{elementId=of:00000000000000a2, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a2, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.60.1/32}, IPV4_DST{ip=192.168.60.101/32}, IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a4, portNumber=4}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a4, portNumber=1}, dst=ConnectPoint{elementId=of:00000000000000a2, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a2, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0xfffffffff33e39a0",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.40.101/32}, IPV4_DST{ip=192.168.40.1/32}, IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}]",
+      "ingress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a6",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0xffffffffda3dd5b2",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a5, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a5, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a6, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a6, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.40.101/32}, IPV4_DST{ip=192.168.40.1/32}, IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a5, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a5, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a6, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a6, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0xffffffff8ce60db9",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.20.101/32}, IPV4_DST{ip=192.168.20.1/32}, IP_PROTO{protocol=6}, TCP_SRC{tcpPort=179}, ETH_TYPE{ethType=800}]",
+      "ingress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a5",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0xfeca8b9",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a5, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a5, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.20.101/32}, IPV4_DST{ip=192.168.20.1/32}, IP_PROTO{protocol=6}, TCP_SRC{tcpPort=179}, ETH_TYPE{ethType=800}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a5, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a5, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0x3124d881",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.40.1/32}, IPV4_DST{ip=192.168.40.101/32}, IP_PROTO{protocol=1}, ETH_TYPE{ethType=800}]",
+      "ingress":{  
+         "device":"of:00000000000000a6",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0x40241a59",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a6, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a6, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a4, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a4, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.40.1/32}, IPV4_DST{ip=192.168.40.101/32}, IP_PROTO{protocol=1}, ETH_TYPE{ethType=800}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a6, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a6, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a4, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a4, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0xffffffffd141fa26",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.30.1/32}, IPV4_DST{ip=192.168.30.101/32}, IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}]",
+      "ingress":{  
+         "device":"of:00000000000000a2",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0x3018359e",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a2, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a2, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.30.1/32}, IPV4_DST{ip=192.168.30.101/32}, IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a2, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a2, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0xffffffffaee2a38a",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.30.101/32}, IPV4_DST{ip=192.168.30.1/32}, IP_PROTO{protocol=6}, TCP_SRC{tcpPort=179}, ETH_TYPE{ethType=800}]",
+      "ingress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a2",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0x658af442",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a2, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a2, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.30.101/32}, IPV4_DST{ip=192.168.30.1/32}, IP_PROTO{protocol=6}, TCP_SRC{tcpPort=179}, ETH_TYPE{ethType=800}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a2, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a2, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0xffffffffaf46b62f",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.20.1/32}, IPV4_DST{ip=192.168.20.101/32}, IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}]",
+      "ingress":{  
+         "device":"of:00000000000000a5",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0x7a92607b",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a5, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a5, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.20.1/32}, IPV4_DST{ip=192.168.20.101/32}, IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a5, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a5, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0xffffffff8d484b21",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.10.101/32}, IPV4_DST{ip=192.168.10.1/32}, IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}]",
+      "ingress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a3",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0xffffffffe8c0c42f",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a3, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.10.101/32}, IPV4_DST{ip=192.168.10.1/32}, IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a3, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0xffffffffed295f82",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.20.101/32}, IPV4_DST{ip=192.168.20.1/32}, IP_PROTO{protocol=1}, ETH_TYPE{ethType=800}]",
+      "ingress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a5",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0x28379d0",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a5, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a5, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.20.101/32}, IPV4_DST{ip=192.168.20.1/32}, IP_PROTO{protocol=1}, ETH_TYPE{ethType=800}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a5, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a5, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },  
+   {  
+      "id":"0xffffffffdba23bce",
+      "type":"MultiPointToSinglePointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_DST{ip=172.16.30.0/24}, ETH_TYPE{ethType=800}]",
+      "treatment":"[ETH_DST{mac=00:00:00:00:03:01}]",
+      "ingress":[  
+         {  
+            "device":"of:00000000000000a3",
+            "port":"1"
+         },
+         {  
+            "device":"of:00000000000000a4",
+            "port":"4"
+         },
+         {  
+            "device":"of:00000000000000a6",
+            "port":"1"
+         },
+         {  
+            "device":"of:00000000000000a5",
+            "port":"1"
+         }
+      ],
+      "egress":{  
+         "device":"of:00000000000000a2",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0x5e70036",
+            "type":"LinkCollectionIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a4, portNumber=1}, dst=ConnectPoint{elementId=of:00000000000000a2, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a5, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a6, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a4, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a4, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_DST{ip=172.16.30.0/24}, ETH_TYPE{ethType=800}]",
+            "treatment":"[ETH_DST{mac=00:00:00:00:03:01}]",
+            "links":[  
+               {  
+                  "src":{  
+                     "device":"of:00000000000000a4",
+                     "port":"1"
+                  },
+                  "dst":{  
+                     "device":"of:00000000000000a2",
+                     "port":"3"
+                  },
+                  "type":"DIRECT",
+                  "state":"ACTIVE",
+                  "annotations":{  
+
+                  }
+               },
+               {  
+                  "src":{  
+                     "device":"of:00000000000000a5",
+                     "port":"2"
+                  },
+                  "dst":{  
+                     "device":"of:00000000000000a3",
+                     "port":"4"
+                  },
+                  "type":"DIRECT",
+                  "state":"ACTIVE",
+                  "annotations":{  
+
+                  }
+               },
+               {  
+                  "src":{  
+                     "device":"of:00000000000000a6",
+                     "port":"3"
+                  },
+                  "dst":{  
+                     "device":"of:00000000000000a4",
+                     "port":"3"
+                  },
+                  "type":"DIRECT",
+                  "state":"ACTIVE",
+                  "annotations":{  
+
+                  }
+               },
+               {  
+                  "src":{  
+                     "device":"of:00000000000000a3",
+                     "port":"3"
+                  },
+                  "dst":{  
+                     "device":"of:00000000000000a4",
+                     "port":"2"
+                  },
+                  "type":"DIRECT",
+                  "state":"ACTIVE",
+                  "annotations":{  
+
+                  }
+               }
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0xffffffffaf44f3b7",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.20.101/32}, IPV4_DST{ip=192.168.20.1/32}, IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}]",
+      "ingress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a5",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0xffffffffd73a0afb",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a5, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a5, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.20.101/32}, IPV4_DST{ip=192.168.20.1/32}, IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a5, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a5, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0x751d3d2e",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.60.1/32}, IPV4_DST{ip=192.168.60.101/32}, IP_PROTO{protocol=1}, ETH_TYPE{ethType=800}]",
+      "ingress":{  
+         "device":"of:00000000000000a4",
+         "port":"4"
+      },
+      "egress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0xffffffffc4847e9e",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a4, portNumber=4}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a4, portNumber=1}, dst=ConnectPoint{elementId=of:00000000000000a2, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a2, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.60.1/32}, IPV4_DST{ip=192.168.60.101/32}, IP_PROTO{protocol=1}, ETH_TYPE{ethType=800}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a4, portNumber=4}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a4, portNumber=1}, dst=ConnectPoint{elementId=of:00000000000000a2, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a2, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0x3fb23806",
+      "type":"MultiPointToSinglePointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_DST{ip=2.0.0.0/24}, ETH_TYPE{ethType=800}]",
+      "treatment":"[ETH_DST{mac=00:00:00:00:03:01}]",
+      "ingress":[  
+         {  
+            "device":"of:00000000000000a3",
+            "port":"1"
+         },
+         {  
+            "device":"of:00000000000000a4",
+            "port":"4"
+         },
+         {  
+            "device":"of:00000000000000a6",
+            "port":"1"
+         },
+         {  
+            "device":"of:00000000000000a5",
+            "port":"1"
+         }
+      ],
+      "egress":{  
+         "device":"of:00000000000000a2",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0x23d68afe",
+            "type":"LinkCollectionIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a4, portNumber=1}, dst=ConnectPoint{elementId=of:00000000000000a2, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a5, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a6, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a4, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a4, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_DST{ip=2.0.0.0/24}, ETH_TYPE{ethType=800}]",
+            "treatment":"[ETH_DST{mac=00:00:00:00:03:01}]",
+            "links":[  
+               {  
+                  "src":{  
+                     "device":"of:00000000000000a4",
+                     "port":"1"
+                  },
+                  "dst":{  
+                     "device":"of:00000000000000a2",
+                     "port":"3"
+                  },
+                  "type":"DIRECT",
+                  "state":"ACTIVE",
+                  "annotations":{  
+
+                  }
+               },
+               {  
+                  "src":{  
+                     "device":"of:00000000000000a5",
+                     "port":"2"
+                  },
+                  "dst":{  
+                     "device":"of:00000000000000a3",
+                     "port":"4"
+                  },
+                  "type":"DIRECT",
+                  "state":"ACTIVE",
+                  "annotations":{  
+
+                  }
+               },
+               {  
+                  "src":{  
+                     "device":"of:00000000000000a6",
+                     "port":"3"
+                  },
+                  "dst":{  
+                     "device":"of:00000000000000a4",
+                     "port":"3"
+                  },
+                  "type":"DIRECT",
+                  "state":"ACTIVE",
+                  "annotations":{  
+
+                  }
+               },
+               {  
+                  "src":{  
+                     "device":"of:00000000000000a3",
+                     "port":"3"
+                  },
+                  "dst":{  
+                     "device":"of:00000000000000a4",
+                     "port":"2"
+                  },
+                  "type":"DIRECT",
+                  "state":"ACTIVE",
+                  "annotations":{  
+
+                  }
+               }
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0x751be06e",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.60.101/32}, IPV4_DST{ip=192.168.60.1/32}, IP_PROTO{protocol=1}, ETH_TYPE{ethType=800}]",
+      "ingress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a4",
+         "port":"4"
+      },
+      "installable":[  
+         {  
+            "id":"0xffffffff85bf43de",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a2, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a2, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a4, portNumber=1}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a4, portNumber=4}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.60.101/32}, IPV4_DST{ip=192.168.60.1/32}, IP_PROTO{protocol=1}, ETH_TYPE{ethType=800}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a2, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a2, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a4, portNumber=1}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a4, portNumber=4}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0x6aea465f",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.10.1/32}, IPV4_DST{ip=192.168.10.101/32}, IP_PROTO{protocol=6}, TCP_SRC{tcpPort=179}, ETH_TYPE{ethType=800}]",
+      "ingress":{  
+         "device":"of:00000000000000a3",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0x27f32021",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a3, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.10.1/32}, IPV4_DST{ip=192.168.10.101/32}, IP_PROTO{protocol=6}, TCP_SRC{tcpPort=179}, ETH_TYPE{ethType=800}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a3, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0xf25f553",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.30.101/32}, IPV4_DST{ip=192.168.30.1/32}, IP_PROTO{protocol=1}, ETH_TYPE{ethType=800}]",
+      "ingress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a2",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0x5821c559",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a2, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a2, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.30.101/32}, IPV4_DST{ip=192.168.30.1/32}, IP_PROTO{protocol=1}, ETH_TYPE{ethType=800}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a2, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a2, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0xfffffffff3406cb6",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.40.1/32}, IPV4_DST{ip=192.168.40.101/32}, IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}]",
+      "ingress":{  
+         "device":"of:00000000000000a6",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0x14daab84",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a6, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a6, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a4, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a4, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.40.1/32}, IPV4_DST{ip=192.168.40.101/32}, IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a6, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a6, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a4, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a4, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0xffffffffd7d10b27",
+      "type":"MultiPointToSinglePointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_DST{ip=1.0.0.0/24}, ETH_TYPE{ethType=800}]",
+      "treatment":"[ETH_DST{mac=00:00:00:00:03:01}]",
+      "ingress":[  
+         {  
+            "device":"of:00000000000000a3",
+            "port":"1"
+         },
+         {  
+            "device":"of:00000000000000a4",
+            "port":"4"
+         },
+         {  
+            "device":"of:00000000000000a6",
+            "port":"1"
+         },
+         {  
+            "device":"of:00000000000000a5",
+            "port":"1"
+         }
+      ],
+      "egress":{  
+         "device":"of:00000000000000a2",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0xffffffff8f921bfd",
+            "type":"LinkCollectionIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a4, portNumber=1}, dst=ConnectPoint{elementId=of:00000000000000a2, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a5, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a6, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a4, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a4, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_DST{ip=1.0.0.0/24}, ETH_TYPE{ethType=800}]",
+            "treatment":"[ETH_DST{mac=00:00:00:00:03:01}]",
+            "links":[  
+               {  
+                  "src":{  
+                     "device":"of:00000000000000a4",
+                     "port":"1"
+                  },
+                  "dst":{  
+                     "device":"of:00000000000000a2",
+                     "port":"3"
+                  },
+                  "type":"DIRECT",
+                  "state":"ACTIVE",
+                  "annotations":{  
+
+                  }
+               },
+               {  
+                  "src":{  
+                     "device":"of:00000000000000a5",
+                     "port":"2"
+                  },
+                  "dst":{  
+                     "device":"of:00000000000000a3",
+                     "port":"4"
+                  },
+                  "type":"DIRECT",
+                  "state":"ACTIVE",
+                  "annotations":{  
+
+                  }
+               },
+               {  
+                  "src":{  
+                     "device":"of:00000000000000a6",
+                     "port":"3"
+                  },
+                  "dst":{  
+                     "device":"of:00000000000000a4",
+                     "port":"3"
+                  },
+                  "type":"DIRECT",
+                  "state":"ACTIVE",
+                  "annotations":{  
+
+                  }
+               },
+               {  
+                  "src":{  
+                     "device":"of:00000000000000a3",
+                     "port":"3"
+                  },
+                  "dst":{  
+                     "device":"of:00000000000000a4",
+                     "port":"2"
+                  },
+                  "type":"DIRECT",
+                  "state":"ACTIVE",
+                  "annotations":{  
+
+                  }
+               }
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0xffffffffa79364e5",
+      "type":"MultiPointToSinglePointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_DST{ip=3.0.0.0/24}, ETH_TYPE{ethType=800}]",
+      "treatment":"[ETH_DST{mac=00:00:00:00:03:01}]",
+      "ingress":[  
+         {  
+            "device":"of:00000000000000a3",
+            "port":"1"
+         },
+         {  
+            "device":"of:00000000000000a4",
+            "port":"4"
+         },
+         {  
+            "device":"of:00000000000000a6",
+            "port":"1"
+         },
+         {  
+            "device":"of:00000000000000a5",
+            "port":"1"
+         }
+      ],
+      "egress":{  
+         "device":"of:00000000000000a2",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0xffffffffb81af9ff",
+            "type":"LinkCollectionIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a4, portNumber=1}, dst=ConnectPoint{elementId=of:00000000000000a2, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a5, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a6, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a4, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a4, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_DST{ip=3.0.0.0/24}, ETH_TYPE{ethType=800}]",
+            "treatment":"[ETH_DST{mac=00:00:00:00:03:01}]",
+            "links":[  
+               {  
+                  "src":{  
+                     "device":"of:00000000000000a4",
+                     "port":"1"
+                  },
+                  "dst":{  
+                     "device":"of:00000000000000a2",
+                     "port":"3"
+                  },
+                  "type":"DIRECT",
+                  "state":"ACTIVE",
+                  "annotations":{  
+
+                  }
+               },
+               {  
+                  "src":{  
+                     "device":"of:00000000000000a5",
+                     "port":"2"
+                  },
+                  "dst":{  
+                     "device":"of:00000000000000a3",
+                     "port":"4"
+                  },
+                  "type":"DIRECT",
+                  "state":"ACTIVE",
+                  "annotations":{  
+
+                  }
+               },
+               {  
+                  "src":{  
+                     "device":"of:00000000000000a6",
+                     "port":"3"
+                  },
+                  "dst":{  
+                     "device":"of:00000000000000a4",
+                     "port":"3"
+                  },
+                  "type":"DIRECT",
+                  "state":"ACTIVE",
+                  "annotations":{  
+
+                  }
+               },
+               {  
+                  "src":{  
+                     "device":"of:00000000000000a3",
+                     "port":"3"
+                  },
+                  "dst":{  
+                     "device":"of:00000000000000a4",
+                     "port":"2"
+                  },
+                  "type":"DIRECT",
+                  "state":"ACTIVE",
+                  "annotations":{  
+
+                  }
+               }
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0x14d9eb65",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.60.1/32}, IPV4_DST{ip=192.168.60.101/32}, IP_PROTO{protocol=6}, TCP_SRC{tcpPort=179}, ETH_TYPE{ethType=800}]",
+      "ingress":{  
+         "device":"of:00000000000000a4",
+         "port":"4"
+      },
+      "egress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0xffffffffd1edad87",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a4, portNumber=4}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a4, portNumber=1}, dst=ConnectPoint{elementId=of:00000000000000a2, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a2, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.60.1/32}, IPV4_DST{ip=192.168.60.101/32}, IP_PROTO{protocol=6}, TCP_SRC{tcpPort=179}, ETH_TYPE{ethType=800}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a4, portNumber=4}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a4, portNumber=1}, dst=ConnectPoint{elementId=of:00000000000000a2, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a2, portNumber=2}, dst=ConnectPoint{elementId=of:00000000000000a1, portNumber=3}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a1, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0x14d88ea5",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.60.101/32}, IPV4_DST{ip=192.168.60.1/32}, IP_PROTO{protocol=6}, TCP_SRC{tcpPort=179}, ETH_TYPE{ethType=800}]",
+      "ingress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a4",
+         "port":"4"
+      },
+      "installable":[  
+         {  
+            "id":"0xffffffff932872c7",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a2, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a2, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a4, portNumber=1}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a4, portNumber=4}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.60.101/32}, IPV4_DST{ip=192.168.60.1/32}, IP_PROTO{protocol=6}, TCP_SRC{tcpPort=179}, ETH_TYPE{ethType=800}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a2, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a2, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a4, portNumber=1}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a4, portNumber=4}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   },
+   {  
+      "id":"0xffffffffd0df53a2",
+      "type":"PointToPointIntent",
+      "appId":"org.onlab.onos.sdnip",
+      "state":"INSTALLED",
+      "selector":"[IPV4_SRC{ip=192.168.40.101/32}, IPV4_DST{ip=192.168.40.1/32}, IP_PROTO{protocol=6}, TCP_SRC{tcpPort=179}, ETH_TYPE{ethType=800}]",
+      "ingress":{  
+         "device":"of:00000000000000a1",
+         "port":"1"
+      },
+      "egress":{  
+         "device":"of:00000000000000a6",
+         "port":"1"
+      },
+      "installable":[  
+         {  
+            "id":"0x12f07370",
+            "type":"PathIntent",
+            "appId":"org.onlab.onos.sdnip",
+            "resources":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a5, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a5, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a6, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a6, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ],
+            "selector":"[IPV4_SRC{ip=192.168.40.101/32}, IPV4_DST{ip=192.168.40.1/32}, IP_PROTO{protocol=6}, TCP_SRC{tcpPort=179}, ETH_TYPE{ethType=800}]",
+            "path":[  
+               "DefaultEdgeLink{src=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, dst=HostLocation{elementId=of:00000000000000a1, portNumber=1}, type=EDGE, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a1, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a3, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a3, portNumber=4}, dst=ConnectPoint{elementId=of:00000000000000a5, portNumber=2}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultLink{src=ConnectPoint{elementId=of:00000000000000a5, portNumber=3}, dst=ConnectPoint{elementId=of:00000000000000a6, portNumber=4}, type=DIRECT, state=ACTIVE, durable=false}",
+               "DefaultEdgeLink{src=HostLocation{elementId=of:00000000000000a6, portNumber=1}, dst=ConnectPoint{elementId=00:00:00:00:00:00/-1, portNumber=0}, type=EDGE, state=ACTIVE, durable=false}"
+            ]
+         }
+      ]
+   }
+]
\ No newline at end of file
diff --git a/TestON/tests/SdnIpTest/sdnip.json b/TestON/tests/SdnIpTest/sdnip.json
new file mode 100644
index 0000000..a5d1867
--- /dev/null
+++ b/TestON/tests/SdnIpTest/sdnip.json
@@ -0,0 +1,69 @@
+{
+   
+    "bgpPeers" : [
+		{
+		    "attachmentDpid" : "00:00:00:00:00:00:00:a3",
+		    "attachmentPort" : "1",
+		    "ipAddress" : "192.168.10.1"
+		},
+		{
+		    "attachmentDpid" : "00:00:00:00:00:00:00:a5",
+		    "attachmentPort" : "1",
+		    "ipAddress" : "192.168.20.1"
+		},
+		{
+		    "attachmentDpid" : "00:00:00:00:00:00:00:a2",
+		    "attachmentPort" : "1",
+		    "ipAddress" : "192.168.30.1"
+		},
+		{
+		    "attachmentDpid" : "00:00:00:00:00:00:00:a6",
+		    "attachmentPort" : "1",
+		    "ipAddress" : "192.168.40.1"
+		},
+		{
+		    "attachmentDpid" : "00:00:00:00:00:00:00:a4",
+		    "attachmentPort" : "4",
+		    "ipAddress" : "192.168.60.1"
+		}
+
+    ],
+    "bgpSpeakers" : [
+	    {
+	    	 "name" : "bgpSpeaker1",
+	    	 "attachmentDpid" : "00:00:00:00:00:00:00:a1",
+	         "attachmentPort" : "1",
+	         "macAddress" : "00:00:00:00:00:01",
+	         "interfaceAddresses" : [
+				{
+				    "interfaceDpid" : "00:00:00:00:00:00:00:a3",
+		  		    "interfacePort" : "1",
+				    "ipAddress" : "192.168.10.101"
+				},
+				{
+				    "interfaceDpid" : "00:00:00:00:00:00:00:a5",
+		       		    "interfacePort" : "1",
+				    "ipAddress" : "192.168.20.101"
+				},
+				{
+				    "interfaceDpid" : "00:00:00:00:00:00:00:a2",
+		       		    "interfacePort" : "1",
+				    "ipAddress" : "192.168.30.101"
+				},
+				{
+				    "interfaceDpid" : "00:00:00:00:00:00:00:a6",
+		       		    "interfacePort" : "1",
+				    "ipAddress" : "192.168.40.101"
+				},
+				{
+				    "interfaceDpid" : "00:00:00:00:00:00:00:a4",
+		       		    "interfacePort" : "4",
+				    "ipAddress" : "192.168.60.101"
+				}
+		
+		    ]
+	         
+	    }
+   	
+    ]
+}
\ No newline at end of file
diff --git a/TestON/tests/TopoConvNext/TopoConvNext.params b/TestON/tests/TopoConvNext/TopoConvNext.params
new file mode 100644
index 0000000..198befb
--- /dev/null
+++ b/TestON/tests/TopoConvNext/TopoConvNext.params
@@ -0,0 +1,69 @@
+<PARAMS>
+    <testcases>1,2,3,2,3,2,3,2,4,2,3,2,3,2,3,2</testcases>
+
+    <ENV>
+        <cellName>topo_conv_test</cellName>
+    </ENV>
+
+    <GIT>
+        #autoPull 'on' or 'off'
+        <autoPull>off</autoPull>
+        <checkout>master</checkout>
+    </GIT>
+
+    <CTRL>
+        <user>admin</user>
+        <ip1>10.128.174.1</ip1>
+        <port1>6633</port1>
+        <ip2>10.128.174.2</ip2>
+        <port2>6633</port2>
+        <ip3>10.128.174.3</ip3>
+        <port3>6633</port3>
+        <ip4>10.128.174.4</ip4>
+        <port4>6633</port4>
+        <ip5>10.128.174.5</ip5>
+        <port5>6633</port5>
+        <ip6>10.128.174.6</ip6>
+        <port6>6633</port6>
+        <ip7>10.128.174.7</ip7>
+        <port7>6633</port7>
+    </CTRL>
+
+    <MN>
+        <ip1>10.128.10.90</ip1>
+        <ip2>10.128.10.91</ip2>
+    </MN>
+
+    <BENCH>
+        <ip>10.128.174.10</ip>
+    </BENCH>
+
+    <TEST>
+        <onosLogFile>/opt/onos/log/karaf*</onosLogFile>
+
+        #Number of times to iterate each case
+        <numIter>3</numIter>
+        <numSwitch1>500</numSwitch1>
+        <numSwitch2>400</numSwitch2>
+        <numSwitch3>200</numSwitch3>
+        <numSwitch4>300</numSwitch4>
+        #Number of iterations to ignore initially
+        <iterIgnore>1</iterIgnore>
+
+        <topo_accumulator_config>
+        large_topo_event_accumulator.cfg
+        </topo_accumulator_config>
+        <topo_config_name>
+        org.onlab.onos.net.topology.impl.DefaultTopologyProvider.cfg
+        </topo_config_name>
+
+        <swDisc100Threshold>0,100000</swDisc100Threshold>
+    </TEST>
+
+    <JSON>
+        <deviceTimestamp>topologyDeviceEventTimestamp</deviceTimestamp>
+        <hostTimestamp>topologyHostEventTimestamp</hostTimestamp>
+        <linkTimestamp>topologyLinkEventTimestamp</linkTimestamp>
+        <graphTimestamp>topologyGraphEventTimestamp</graphTimestamp>
+    </JSON>
+</PARAMS>
diff --git a/TestON/tests/TopoConvNext/TopoConvNext.py b/TestON/tests/TopoConvNext/TopoConvNext.py
new file mode 100644
index 0000000..68d7b5d
--- /dev/null
+++ b/TestON/tests/TopoConvNext/TopoConvNext.py
@@ -0,0 +1,1278 @@
+#TopoPerfNext
+#
+#Topology Convergence scale-out test for ONOS-next
+#NOTE: This test supports up to 7 nodes scale-out scenario
+#
+#NOTE: Ensure that you have 'tablet.json' file 
+#      in the onos/tools/package/config directory
+#NOTE: You must start this test initially with 3 nodes
+#
+#andrew@onlab.us
+
+import time
+import sys
+import os
+import re
+
+class TopoConvNext:
+    def __init__(self):
+        self.default = ''
+
+    def CASE1(self, main):
+        '''
+        ONOS startup sequence
+        '''
+        import time
+
+        #******
+        #Global cluster count for scale-out purposes
+        global cluster_count 
+        global topo_iteration
+        topo_iteration = 1
+        cluster_count = 1 
+        #******
+        cell_name = main.params['ENV']['cellName']
+
+        git_pull = main.params['GIT']['autoPull']
+        checkout_branch = main.params['GIT']['checkout']
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+        ONOS4_ip = main.params['CTRL']['ip4']
+        ONOS5_ip = main.params['CTRL']['ip5']
+        ONOS6_ip = main.params['CTRL']['ip6']
+        ONOS7_ip = main.params['CTRL']['ip7']
+        MN1_ip = main.params['MN']['ip1']
+        BENCH_ip = main.params['BENCH']['ip']
+
+        main.case("Setting up test environment")
+        main.log.info("copying topology event accumulator config file"+\
+                " to ONOS package/etc/ directory")
+        topo_config_name = main.params['TEST']['topo_config_name']
+        topo_config =\
+                main.params['TEST']['topo_accumulator_config']
+        main.ONOSbench.handle.sendline("cp ~/"+topo_config+\
+            " ~/ONOS/tools/package/etc/"+\
+            topo_config_name)
+        main.ONOSbench.handle.expect("\$")
+
+        main.log.info("Uninstalling previous instances")
+        #main.ONOSbench.onos_uninstall(node_ip = ONOS1_ip)
+        main.ONOSbench.onos_uninstall(node_ip = ONOS2_ip)
+        main.ONOSbench.onos_uninstall(node_ip = ONOS3_ip)
+        main.ONOSbench.onos_uninstall(node_ip = ONOS4_ip)
+        main.ONOSbench.onos_uninstall(node_ip = ONOS5_ip)
+        main.ONOSbench.onos_uninstall(node_ip = ONOS6_ip)
+        main.ONOSbench.onos_uninstall(node_ip = ONOS7_ip)
+      
+        main.log.report("Setting up test environment")
+
+        main.step("Creating cell file")
+        cell_file_result = main.ONOSbench.create_cell_file(
+                BENCH_ip, cell_name, MN1_ip, 
+                "onos-core,onos-app-metrics", 
+                #ONOS1_ip, ONOS2_ip, ONOS3_ip)
+                ONOS1_ip)
+                    
+        main.step("Applying cell file to environment")
+        cell_apply_result = main.ONOSbench.set_cell(cell_name)
+        verify_cell_result = main.ONOSbench.verify_cell()
+        
+        main.step("Removing raft logs")
+        main.ONOSbench.onos_remove_raft_logs()
+        time.sleep(10)
+
+        main.step("Git checkout and pull "+checkout_branch)
+        if git_pull == 'on':
+            checkout_result = \
+                    main.ONOSbench.git_checkout(checkout_branch)
+            pull_result = main.ONOSbench.git_pull()
+        else:
+            checkout_result = main.TRUE
+            pull_result = main.TRUE
+            main.log.info("Skipped git checkout and pull")
+
+        main.log.report("Commit information - ")
+        main.ONOSbench.get_version()
+
+        main.step("Using mvn clean & install")
+        #mvn_result = main.ONOSbench.clean_install()
+        mvn_result = main.TRUE
+
+        main.step("Set cell for ONOS cli env")
+        main.ONOS1cli.set_cell(cell_name)
+        #main.ONOS2cli.set_cell(cell_name)
+        #main.ONOS3cli.set_cell(cell_name)
+    
+        main.step("Creating ONOS package")
+        package_result = main.ONOSbench.onos_package()
+
+        #Start test with single node only
+        main.step("Installing ONOS package")
+        install1_result = main.ONOSbench.onos_install(node=ONOS1_ip)
+        #install2_result = main.ONOSbench.onos_install(node=ONOS2_ip)
+        #install3_result = main.ONOSbench.onos_install(node=ONOS3_ip)
+
+        time.sleep(10)
+
+        main.step("Start onos cli")
+        cli1 = main.ONOS1cli.start_onos_cli(ONOS1_ip)
+        #cli2 = main.ONOS2cli.start_onos_cli(ONOS2_ip)
+        #cli3 = main.ONOS3cli.start_onos_cli(ONOS3_ip)
+
+        main.step("Enable metrics feature")
+        #main.ONOS1cli.feature_install("onos-app-metrics")
+
+        utilities.assert_equals(expect=main.TRUE,
+                actual= cell_file_result and cell_apply_result and\
+                        verify_cell_result and checkout_result and\
+                        pull_result and mvn_result and\
+                        install1_result, #and install2_result and\
+                        #install3_result,
+                onpass="Test Environment setup successful",
+                onfail="Failed to setup test environment")
+    
+    def CASE2(self, main):
+        '''
+        100 Switch discovery latency
+
+        Important:
+            This test case can be potentially dangerous if 
+            your machine has previously set iptables rules.
+            One of the steps of the test case will flush
+            all existing iptables rules.
+        Note:
+            You can specify the number of switches in the 
+            params file to adjust the switch discovery size
+            (and specify the corresponding topology in Mininet1 
+            .topo file)
+        '''
+        import time
+        import subprocess
+        import os
+        import requests
+        import json
+        import numpy
+
+        ONOS_ip_list = []
+        ONOS_ip_list.append('0')
+        ONOS_ip_list.append(main.params['CTRL']['ip1'])
+        ONOS_ip_list.append(main.params['CTRL']['ip2'])
+        ONOS_ip_list.append(main.params['CTRL']['ip3'])
+        ONOS_ip_list.append(main.params['CTRL']['ip4'])
+        ONOS_ip_list.append(main.params['CTRL']['ip5'])
+        ONOS_ip_list.append(main.params['CTRL']['ip6'])
+        ONOS_ip_list.append(main.params['CTRL']['ip7'])
+        MN1_ip = main.params['MN']['ip1']
+        ONOS_user = main.params['CTRL']['user']
+
+        default_sw_port = main.params['CTRL']['port1']
+       
+        #Number of iterations of case
+        num_iter = main.params['TEST']['numIter']
+        iter_ignore = int(main.params['TEST']['iterIgnore'])
+
+        #***********
+        #Global number of switches that change 
+        #throughout the test
+        global num_sw
+        global topo_iteration    
+        global cluster_count
+        if topo_iteration == 1:
+            num_sw = main.params['TEST']['numSwitch1']
+        elif topo_iteration == 2:
+            num_sw = main.params['TEST']['numSwitch2']
+        elif topo_iteration == 3:
+            num_sw = main.params['TEST']['numSwitch3']
+        elif topo_iteration == 4:
+            num_sw = main.params['TEST']['numSwitch4']
+        #***********
+
+        #Timestamp 'keys' for json metrics output.
+        #These are subject to change, hence moved into params
+        deviceTimestamp = main.params['JSON']['deviceTimestamp']
+        graphTimestamp = main.params['JSON']['graphTimestamp']
+        
+        #Threshold for this test case
+        sw_disc_threshold_str = main.params['TEST']['swDisc100Threshold']
+        sw_disc_threshold_obj = sw_disc_threshold_str.split(",")
+        sw_disc_threshold_min = int(sw_disc_threshold_obj[0])
+        sw_disc_threshold_max = int(sw_disc_threshold_obj[1])
+
+        assertion = main.TRUE
+        sw_discovery_lat_list = []
+        syn_ack_delta_list = []
+
+        main.case(str(num_sw)+" switches distributed across "+
+                str(cluster_count)+" nodes convergence latency")
+       
+        main.log.report("Large topology convergence and scale-out test")
+        main.log.report("Currently active ONOS node(s): ")
+        report_str = "Node "
+        for node in range(1, cluster_count+1):
+            report_str += (str(node) + " ") 
+        main.log.report(report_str)
+        main.log.report("Topology size: "+str(num_sw)+" switches")
+
+        main.step("Distributing "+num_sw+" switches to each ONOS")
+        index = 1 
+        for node in range(1, cluster_count+1):
+            for i in range(index, (int(num_sw)/cluster_count)+index):
+                main.Mininet1.assign_sw_controller(
+                        sw=str(i),
+                        ip1=ONOS_ip_list[node],
+                        port1=default_sw_port)
+            index = i+1 
+        #for i in range(1, int(num_sw)+1):
+            #main.Mininet1.assign_sw_controller(
+                    #sw=str(i),
+                    #ip1="10.128.174.1",
+                    #            port1="6633")
+
+        main.log.info("Please check ptpd configuration to ensure "+\
+                "all nodes' system times are in sync")
+
+        time.sleep(10)
+
+        for i in range(0, int(num_iter)):
+            main.step("Set iptables rule to block sw connections")
+               
+            #INPUT rules
+            main.ONOS1.handle.sendline(
+                    "sudo iptables -A INPUT -p tcp -s "+
+                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+            main.ONOS2.handle.sendline(
+                    "sudo iptables -A INPUT -p tcp -s "+
+                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+            main.ONOS3.handle.sendline(
+                    "sudo iptables -A INPUT -p tcp -s "+
+                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+            main.ONOS4.handle.sendline(
+                    "sudo iptables -A INPUT -p tcp -s "+
+                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+            main.ONOS5.handle.sendline(
+                    "sudo iptables -A INPUT -p tcp -s "+
+                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+            main.ONOS6.handle.sendline(
+                    "sudo iptables -A INPUT -p tcp -s "+
+                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+            main.ONOS7.handle.sendline(
+                    "sudo iptables -A INPUT -p tcp -s "+
+                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+               
+            #OUTPUT rules
+            main.ONOS1.handle.sendline(
+                    "sudo iptables -A OUTPUT -p tcp -s "+
+                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+            main.ONOS2.handle.sendline(
+                    "sudo iptables -A OUTPUT -p tcp -s "+
+                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+            main.ONOS3.handle.sendline(
+                    "sudo iptables -A OUTPUT -p tcp -s "+
+                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+            main.ONOS4.handle.sendline(
+                    "sudo iptables -A OUTPUT -p tcp -s "+
+                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+            main.ONOS5.handle.sendline(
+                    "sudo iptables -A OUTPUT -p tcp -s "+
+                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+            main.ONOS6.handle.sendline(
+                    "sudo iptables -A OUTPUT -p tcp -s "+
+                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+            main.ONOS7.handle.sendline(
+                    "sudo iptables -A OUTPUT -p tcp -s "+
+                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+
+            main.log.info("Please wait for switch connection to timeout")
+           
+
+            #time.sleep(60)
+            #if cluster_count >= 3:
+            #    time.sleep(60)
+            #if cluster_count >= 5:
+            #    time.sleep(30)
+            #if cluster_count >= 6:
+            #    time.sleep(30)
+
+            if cluster_count >= 3:
+                main.ONOS1.handle.sendline("tshark -i eth0 -t e | "+
+                    "grep 'SYN, ACK' | grep '6633' >"+
+                    "/tmp/syn_ack_onos1_iter"+str(i)+".txt &")
+                main.ONOS2.handle.sendline("tshark -i eth0 -t e | "+
+                    "grep 'SYN, ACK' | grep '6633' >"+
+                    "/tmp/syn_ack_onos2_iter"+str(i)+".txt &")
+                main.ONOS3.handle.sendline("tshark -i eth0 -t e | "+
+                    "grep 'SYN, ACK' | grep '6633' >"+
+                    "/tmp/syn_ack_onos3_iter"+str(i)+".txt &")
+            if cluster_count >= 4:
+                main.ONOS4.handle.sendline("tshark -i eth0 -t e | "+
+                    "grep 'SYN, ACK' | grep '6633' >"+
+                    "/tmp/syn_ack_onos4_iter"+str(i)+".txt &")
+            if cluster_count >= 5:
+                main.ONOS5.handle.sendline("tshark -i eth0 -t e | "+
+                    "grep 'SYN, ACK' | grep '6633' >"+
+                    "/tmp/syn_ack_onos5_iter"+str(i)+".txt &")
+            if cluster_count >= 6:
+                main.ONOS6.handle.sendline("tshark -i eth0 -t e | "+
+                    "grep 'SYN, ACK' | grep '6633' >"+
+                    "/tmp/syn_ack_onos6_iter"+str(i)+".txt &")
+            if cluster_count == 7:
+                main.ONOS7.handle.sendline("tshark -i eth0 -t e | "+
+                    "grep 'SYN, ACK' | grep '6633' >"+
+                    "/tmp/syn_ack_onos6_iter"+str(i)+".txt &")
+         
+            #NOTE:
+            #       Delay before checking devices to 
+            #       help prevent timing out from CLI
+            #       due to multiple command issuing 
+            time.sleep(20)
+
+            loop = True
+            loop_count = 0
+            device_count = 0
+            while loop_count < 60 and loop: 
+                main.log.info("Checking devices for device down")
+                
+                temp_len = 0
+                device_str1 = main.ONOS1cli.devices(
+                    node_ip=ONOS_ip_list[1])
+                device_json1 = json.loads(device_str1)
+                json_len = len(device_json1) 
+                
+                #NOTE: May want to check the rest of 
+                #      the ONOS instances for device down as well
+
+                for device1 in device_json1: 
+                    temp_len = temp_len + 1
+                    if device1['available'] == True:
+                        loop = True
+                        break
+                    #if I'm on the last json object and I still haven't
+                    #broken out of the loop, it means there were
+                    #no available devices
+                    elif temp_len == json_len-1:
+                        main.log.info("Temp length: "+str(temp_len))
+                        main.step("Flushing iptables and obtaining t0")
+                        t0_system = time.time()*1000
+                        
+                        main.ONOS1.handle.sendline("sudo iptables -F")
+                        main.ONOS2.handle.sendline("sudo iptables -F")
+                        main.ONOS3.handle.sendline("sudo iptables -F")
+                        main.ONOS4.handle.sendline("sudo iptables -F")
+                        main.ONOS5.handle.sendline("sudo iptables -F")
+                        main.ONOS6.handle.sendline("sudo iptables -F")
+                        main.ONOS7.handle.sendline("sudo iptables -F")
+                    
+                        loop = False
+                        break
+                
+                loop_count += 1
+                time.sleep(1)
+
+            main.log.info("System time t0: "+str(t0_system))
+
+            counter_loop = 0
+            counter_avail1 = 0
+            counter_avail2 = 0
+            counter_avail3 = 0
+            counter_avail4 = 0
+            counter_avail5 = 0
+            counter_avail6 = 0
+            counter_avail7 = 0
+            onos1_dev = False
+            onos2_dev = False
+            onos3_dev = False
+            onos4_dev = False
+            onos5_dev = False
+            onos6_dev = False
+            onos7_dev = False
+
+            #TODO: Think of a more elegant way to check all 
+            #      switches across all nodes
+            #Goodluck debugging this loop
+            while counter_loop < 60:
+                for node in range(1, cluster_count+1):
+                    if node == 1 and not onos1_dev:
+                        main.log.info("Checking node 1 for device "+
+                            "discovery")
+                        device_str_obj1 = main.ONOS1cli.devices(
+                            node_ip=ONOS_ip_list[1])
+                        device_json1 = json.loads(device_str_obj1)
+                        for device1 in device_json1:
+                            if device1['available'] == True:
+                                counter_avail1 += 1
+                                if counter_avail1 == int(num_sw):
+                                    onos1_dev = True
+                                    main.log.info("All devices have been"+
+                                            " discovered on ONOS1")
+                            else:
+                                counter_avail1 = 0
+                    if node == 2 and not onos2_dev:
+                        main.log.info("Checking node 2 for device "+
+                            "discovery")
+                        device_str_obj2 = main.ONOS2cli.devices(
+                            node_ip=ONOS_ip_list[2])
+                        device_json2 = json.loads(device_str_obj2)
+                        for device2 in device_json2:
+                            if device2['available'] == True:
+                                counter_avail2 += 1
+                                if counter_avail2 == int(num_sw):
+                                    onos2_dev = True
+                                    main.log.info("All devices have been"+
+                                            " discovered on ONOS2")
+                            else:
+                                counter_avail2 = 0
+                    if node == 3 and not onos3_dev:
+                        main.log.info("Checking node 3 for device "+
+                            "discovery")
+                        device_str_obj3 = main.ONOS3cli.devices(
+                            node_ip=ONOS_ip_list[3])
+                        device_json3 = json.loads(device_str_obj3)
+                        for device3 in device_json3:
+                            if device3['available'] == True:
+                                counter_avail3 += 1
+                                if counter_avail3 == int(num_sw):
+                                    onos3_dev = True
+                                    main.log.info("All devices have been"+
+                                            " discovered on ONOS3")
+                            else:
+                                counter_avail3 = 0
+                    if node == 4 and not onos4_dev:
+                        main.log.info("Checking node 4 for device "+
+                            "discovery")
+                        device_str_obj4 = main.ONOS4cli.devices(
+                            node_ip=ONOS_ip_list[4])
+                        device_json4 = json.loads(device_str_obj4)
+                        for device4 in device_json4:
+                            if device4['available'] == True:
+                                counter_avail4 += 1
+                                if counter_avail4 == int(num_sw):
+                                    onos4_dev = True
+                                    main.log.info("All devices have been"+
+                                            " discovered on ONOS4")
+                            else:
+                                counter_avail4 = 0
+                    if node == 5 and not onos5_dev:
+                        main.log.info("Checking node 5 for device "+
+                            "discovery")
+                        device_str_obj5 = main.ONOS5cli.devices(
+                            node_ip=ONOS_ip_list[5])
+                        device_json5 = json.loads(device_str_obj5)
+                        for device5 in device_json5:
+                            if device5['available'] == True:
+                                counter_avail5 += 1
+                                if counter_avail5 == int(num_sw):
+                                    onos5_dev = True
+                                    main.log.info("All devices have been"+
+                                            " discovered on ONOS5")
+                            else:
+                                counter_avail5 = 0
+                    if node == 6 and not onos6_dev:
+                        main.log.info("Checking node 6 for device "+
+                            "discovery")
+                        device_str_obj6 = main.ONOS6cli.devices(
+                            node_ip=ONOS_ip_list[6])
+                        device_json6 = json.loads(device_str_obj6)
+                        for device6 in device_json6:
+                            if device6['available'] == True:
+                                counter_avail6 += 1
+                                if counter_avail6 == int(num_sw):
+                                    onos6_dev = True
+                                    main.log.info("All devices have been"+
+                                            " discovered on ONOS6")
+                            else:
+                                counter_avail6 = 0
+                    if node == 7 and not onos7_dev:
+                        main.log.info("Checking node 7 for device "+
+                            "discovery")
+                        device_str_obj7 = main.ONOS7cli.devices(
+                            node_ip=ONOS_ip_list[7])
+                        device_json7 = json.loads(device_str_obj7)
+                        for device7 in device_json7:
+                            if device7['available'] == True:
+                                counter_avail7 += 1
+                                if counter_avail7 == int(num_sw):
+                                    onos7_dev = True
+                                    main.log.info("All devices have been"+
+                                            " discovered on ONOS7")
+                            else:
+                                counter_avail7 = 0
+                    #END node loop
+              
+                #TODO: clean up this mess of an if statements if possible
+                #Treat each if as a separate test case with the given
+                #     cluster count. Hence when the cluster count changes
+                #     the desired calculations will be made
+                if cluster_count == 1:
+                    if onos1_dev:
+                        main.log.info("All devices have been discovered"+
+                            " on all ONOS instances")
+                        time.sleep(5)
+                        json_str_metrics_1 =\
+                            main.ONOS1cli.topology_events_metrics()
+                        json_obj_1 = json.loads(json_str_metrics_1)
+                        graph_timestamp_1 =\
+                            json_obj_1[graphTimestamp]['value']
+                        
+                        graph_lat_1 = \
+                            int(graph_timestamp_1) - int(t0_system)
+                       
+                        main.log.info("Graph Timestamp ONOS1: "+
+                            str(graph_timestamp_1))
+
+                        if graph_lat_1 > sw_disc_threshold_min\
+                            and graph_lat_1 < sw_disc_threshold_max\
+                            and int(i) > iter_ignore:
+                            sw_discovery_lat_list.append(
+                                    graph_lat_1)
+                            main.log.info("Sw discovery latency of "+
+                                str(cluster_count)+" node(s): "+
+                                str(graph_lat_1)+" ms")
+                        else:
+                            main.log.info("Switch discovery latency "+
+                                "exceeded the threshold.")
+                            main.log.info(str(graph_lat_1)+" ms")
+                        #Break while loop 
+                        break
+                if cluster_count == 2:
+                    if onos1_dev and onos2_dev:
+                        main.log.info("All devices have been discovered"+
+                            " on all "+str(cluster_count)+
+                            " ONOS instances")
+                        time.sleep(5)
+
+                        json_str_metrics_1 =\
+                            main.ONOS1cli.topology_events_metrics()
+                        json_str_metrics_2 =\
+                            main.ONOS2cli.topology_events_metrics()
+                        json_obj_1 = json.loads(json_str_metrics_1)
+                        json_obj_2 = json.loads(json_str_metrics_2)
+                        graph_timestamp_1 =\
+                            json_obj_1[graphTimestamp]['value']
+                        graph_timestamp_2 =\
+                            json_obj_2[graphTimestamp]['value']
+                        
+                        graph_lat_1 = \
+                            int(graph_timestamp_1) - int(t0_system)
+                        graph_lat_2 = \
+                            int(graph_timestamp_2) - int(t0_system)
+                        
+                        main.log.info("Graph Timestamp ONOS1: "+
+                            str(graph_timestamp_1))
+                        main.log.info("Graph Timestamp ONOS2: "+
+                            str(graph_timestamp_2))
+
+                        max_graph_lat = max(graph_lat_1, 
+                            graph_lat_2, graph_lat_3)
+
+                        if max_graph_lat > sw_disc_threshold_min\
+                            and max_graph_lat < sw_disc_threshold_max\
+                            and int(i) > iter_ignore:
+                            sw_discovery_lat_list.append(
+                                    max_graph_lat)
+                            main.log.info("Sw discovery latency of "+
+                                str(cluster_count)+" node(s): "+
+                                str(max_graph_lat)+" ms")
+                        else:
+                            main.log.info("Switch discovery latency "+
+                                "exceeded the threshold.")
+                            main.log.info(str(max_graph_lat)+" ms")
+                        break
+                if cluster_count == 3:
+                    if onos1_dev and onos2_dev and onos3_dev:
+                        main.log.info("All devices have been discovered"+
+                            " on all "+str(cluster_count)+
+                            " ONOS instances")
+                        
+                        #TODO: Investigate this sleep
+                        #      added to 'pad' the results with 
+                        #      plenty of time to 'catch up'
+                        time.sleep(5)
+
+                        json_str_metrics_1 =\
+                            main.ONOS1cli.topology_events_metrics()
+                        json_str_metrics_2 =\
+                            main.ONOS2cli.topology_events_metrics()
+                        json_str_metrics_3 =\
+                            main.ONOS3cli.topology_events_metrics()
+                        json_obj_1 = json.loads(json_str_metrics_1)
+                        json_obj_2 = json.loads(json_str_metrics_2)
+                        json_obj_3 = json.loads(json_str_metrics_3)
+                        graph_timestamp_1 =\
+                            json_obj_1[graphTimestamp]['value']
+                        graph_timestamp_2 =\
+                            json_obj_2[graphTimestamp]['value']
+                        graph_timestamp_3 =\
+                            json_obj_3[graphTimestamp]['value']
+                        
+                        graph_lat_1 = \
+                            int(graph_timestamp_1) - int(t0_system)
+                        graph_lat_2 = \
+                            int(graph_timestamp_2) - int(t0_system)
+                        graph_lat_3 = \
+                            int(graph_timestamp_3) - int(t0_system)
+
+                        main.log.info("Graph Timestamp ONOS1: "+
+                            str(graph_timestamp_1))
+                        main.log.info("Graph Timestamp ONOS2: "+
+                            str(graph_timestamp_2))
+                        main.log.info("Graph Timestamp ONOS3: "+
+                            str(graph_timestamp_3))
+
+                        max_graph_lat = max(graph_lat_1, 
+                                graph_lat_2,
+                                graph_lat_3)
+
+                        if max_graph_lat > sw_disc_threshold_min\
+                            and max_graph_lat < sw_disc_threshold_max\
+                            and int(i) > iter_ignore:
+                            sw_discovery_lat_list.append(
+                                    max_graph_lat)
+                            main.log.info("Sw discovery latency of "+
+                                str(cluster_count)+" node(s): "+
+                                str(max_graph_lat)+" ms")
+                        else:
+                            main.log.info("Switch discovery latency "+
+                                "exceeded the threshold.")
+                            main.log.info(str(max_graph_lat)+" ms")
+                        
+                        break
+                if cluster_count == 4:
+                    if onos1_dev and onos2_dev and onos3_dev and\
+                       onos4_dev:
+                        main.log.info("All devices have been discovered"+
+                            " on all ONOS instances")
+                        json_str_metrics_1 =\
+                            main.ONOS1cli.topology_events_metrics()
+                        json_str_metrics_2 =\
+                            main.ONOS2cli.topology_events_metrics()
+                        json_str_metrics_3 =\
+                            main.ONOS3cli.topology_events_metrics()
+                        json_str_metrics_4 =\
+                            main.ONOS4cli.topology_events_metrics()
+                        json_obj_1 = json.loads(json_str_metrics_1)
+                        json_obj_2 = json.loads(json_str_metrics_2)
+                        json_obj_3 = json.loads(json_str_metrics_3)
+                        json_obj_4 = json.loads(json_str_metrics_4)
+                        graph_timestamp_1 =\
+                            json_obj_1[graphTimestamp]['value']
+                        graph_timestamp_2 =\
+                            json_obj_2[graphTimestamp]['value']
+                        graph_timestamp_3 =\
+                            json_obj_3[graphTimestamp]['value']
+                        graph_timestamp_4 =\
+                            json_obj_4[graphTimestamp]['value']
+                        
+                        graph_lat_1 = \
+                            int(graph_timestamp_1) - int(t0_system)
+                        graph_lat_2 = \
+                            int(graph_timestamp_2) - int(t0_system)
+                        graph_lat_3 = \
+                            int(graph_timestamp_3) - int(t0_system)
+                        graph_lat_4 = \
+                            int(graph_timestamp_4) - int(t0_system)
+                        
+                        main.log.info("Graph Timestamp ONOS1: "+
+                            str(graph_timestamp_1))
+                        main.log.info("Graph Timestamp ONOS2: "+
+                            str(graph_timestamp_2))
+                        main.log.info("Graph Timestamp ONOS3: "+
+                            str(graph_timestamp_3))
+                        main.log.info("Graph Timestamp ONOS4: "+
+                            str(graph_timestamp_4))
+
+                        max_graph_lat = max(graph_lat_1,
+                                graph_lat_2,
+                                graph_lat_3,
+                                graph_lat_4)
+                        
+                        if max_graph_lat > sw_disc_threshold_min\
+                            and max_graph_lat < sw_disc_threshold_max\
+                            and int(i) > iter_ignore:
+                            sw_discovery_lat_list.append(
+                                    max_graph_lat)
+                            main.log.info("Sw discovery latency of "+
+                                str(cluster_count)+" node(s): "+
+                                str(max_graph_lat)+" ms")
+                        else:
+                            main.log.info("Switch discovery latency "+
+                                "exceeded the threshold.")
+                            main.log.info(str(max_graph_lat)+" ms")
+                
+                        break
+                if cluster_count == 5:
+                    if onos1_dev and onos2_dev and onos3_dev and\
+                       onos4_dev and onos5_dev:
+                        main.log.info("All devices have been discovered"+
+                            " on all ONOS instances")
+                        
+                        #TODO: Investigate this sleep
+                        #      added to 'pad' the results with 
+                        #      plenty of time to 'catch up'
+                        time.sleep(5)
+                        
+                        json_str_metrics_1 =\
+                            main.ONOS1cli.topology_events_metrics()
+                        json_str_metrics_2 =\
+                            main.ONOS2cli.topology_events_metrics()
+                        json_str_metrics_3 =\
+                            main.ONOS3cli.topology_events_metrics()
+                        json_str_metrics_4 =\
+                            main.ONOS4cli.topology_events_metrics()
+                        json_str_metrics_5 =\
+                            main.ONOS5cli.topology_events_metrics()
+                        json_obj_1 = json.loads(json_str_metrics_1)
+                        json_obj_2 = json.loads(json_str_metrics_2)
+                        json_obj_3 = json.loads(json_str_metrics_3)
+                        json_obj_4 = json.loads(json_str_metrics_4)
+                        json_obj_5 = json.loads(json_str_metrics_5)
+                        graph_timestamp_1 =\
+                            json_obj_1[graphTimestamp]['value']
+                        graph_timestamp_2 =\
+                            json_obj_2[graphTimestamp]['value']
+                        graph_timestamp_3 =\
+                            json_obj_3[graphTimestamp]['value']
+                        graph_timestamp_4 =\
+                            json_obj_4[graphTimestamp]['value']
+                        graph_timestamp_5 =\
+                            json_obj_5[graphTimestamp]['value']
+                        
+                        graph_lat_1 = \
+                            int(graph_timestamp_1) - int(t0_system)
+                        graph_lat_2 = \
+                            int(graph_timestamp_2) - int(t0_system)
+                        graph_lat_3 = \
+                            int(graph_timestamp_3) - int(t0_system)
+                        graph_lat_4 = \
+                            int(graph_timestamp_4) - int(t0_system)
+                        graph_lat_5 = \
+                            int(graph_timestamp_5) - int(t0_system)
+                        
+                        main.log.info("Graph Timestamp ONOS1: "+
+                            str(graph_timestamp_1))
+                        main.log.info("Graph Timestamp ONOS2: "+
+                            str(graph_timestamp_2))
+                        main.log.info("Graph Timestamp ONOS3: "+
+                            str(graph_timestamp_3))
+                        main.log.info("Graph Timestamp ONOS4: "+
+                            str(graph_timestamp_4))
+                        main.log.info("Graph Timestamp ONOS5: "+
+                            str(graph_timestamp_5))
+
+                        max_graph_lat = max(graph_lat_1,
+                                graph_lat_2,
+                                graph_lat_3,
+                                graph_lat_4,
+                                graph_lat_5)
+                        
+                        if max_graph_lat > sw_disc_threshold_min\
+                            and max_graph_lat < sw_disc_threshold_max\
+                            and int(i) > iter_ignore:
+                            sw_discovery_lat_list.append(
+                                    max_graph_lat)
+                            main.log.info("Sw discovery latency of "+
+                                str(cluster_count)+" node(s): "+
+                                str(max_graph_lat)+" ms")
+                        else:
+                            main.log.info("Switch discovery latency "+
+                                "exceeded the threshold.")
+                            main.log.info(str(max_graph_lat)+" ms")
+                
+                        break
+                if cluster_count == 6:
+                    if onos1_dev and onos2_dev and onos3_dev and\
+                       onos4_dev and onos5_dev and onos6_dev:
+                        main.log.info("All devices have been discovered"+
+                            " on all ONOS instances")
+                        json_str_metrics_1 =\
+                            main.ONOS1cli.topology_events_metrics()
+                        json_str_metrics_2 =\
+                            main.ONOS2cli.topology_events_metrics()
+                        json_str_metrics_3 =\
+                            main.ONOS3cli.topology_events_metrics()
+                        json_str_metrics_4 =\
+                            main.ONOS4cli.topology_events_metrics()
+                        json_str_metrics_5 =\
+                            main.ONOS5cli.topology_events_metrics()
+                        json_str_metrics_6 =\
+                            main.ONOS6cli.topology_events_metrics()
+                        json_obj_1 = json.loads(json_str_metrics_1)
+                        json_obj_2 = json.loads(json_str_metrics_2)
+                        json_obj_3 = json.loads(json_str_metrics_3)
+                        json_obj_4 = json.loads(json_str_metrics_4)
+                        json_obj_5 = json.loads(json_str_metrics_5)
+                        json_obj_6 = json.loads(json_str_metrics_6)
+                        graph_timestamp_1 =\
+                            json_obj_1[graphTimestamp]['value']
+                        graph_timestamp_2 =\
+                            json_obj_2[graphTimestamp]['value']
+                        graph_timestamp_3 =\
+                            json_obj_3[graphTimestamp]['value']
+                        graph_timestamp_4 =\
+                            json_obj_4[graphTimestamp]['value']
+                        graph_timestamp_5 =\
+                            json_obj_5[graphTimestamp]['value']
+                        graph_timestamp_6 =\
+                            json_obj_6[graphTimestamp]['value']
+                        
+                        graph_lat_1 = \
+                            int(graph_timestamp_1) - int(t0_system)
+                        graph_lat_2 = \
+                            int(graph_timestamp_2) - int(t0_system)
+                        graph_lat_3 = \
+                            int(graph_timestamp_3) - int(t0_system)
+                        graph_lat_4 = \
+                            int(graph_timestamp_4) - int(t0_system)
+                        graph_lat_5 = \
+                            int(graph_timestamp_5) - int(t0_system)
+                        graph_lat_6 = \
+                            int(graph_timestamp_6) - int(t0_system)
+                        
+                        main.log.info("Graph Timestamp ONOS1: "+
+                            str(graph_timestamp_1))
+                        main.log.info("Graph Timestamp ONOS2: "+
+                            str(graph_timestamp_2))
+                        main.log.info("Graph Timestamp ONOS3: "+
+                            str(graph_timestamp_3))
+                        main.log.info("Graph Timestamp ONOS4: "+
+                            str(graph_timestamp_4))
+                        main.log.info("Graph Timestamp ONOS5: "+
+                            str(graph_timestamp_5))
+                        main.log.info("Graph Timestamp ONOS6: "+
+                            str(graph_timestamp_6))
+
+                        max_graph_lat = max(graph_lat_1,
+                                graph_lat_2,
+                                graph_lat_3,
+                                graph_lat_4,
+                                graph_lat_5,
+                                graph_lat_6)
+                        
+                        if max_graph_lat > sw_disc_threshold_min\
+                            and max_graph_lat < sw_disc_threshold_max\
+                            and int(i) > iter_ignore:
+                            sw_discovery_lat_list.append(
+                                    max_graph_lat)
+                            main.log.info("Sw discovery latency of "+
+                                str(cluster_count)+" node(s): "+
+                                str(max_graph_lat)+" ms")
+                        else:
+                            main.log.info("Switch discovery latency "+
+                                "exceeded the threshold.")
+                            main.log.info(str(max_graph_lat)+" ms")
+                        
+                        break
+                if cluster_count == 7:
+                    if onos1_dev and onos2_dev and onos3_dev and\
+                       onos4_dev and onos5_dev and onos6_dev and\
+                       onos7_dev:
+                        main.log.info("All devices have been discovered"+
+                            " on all ONOS instances")
+                        
+                        #TODO: Investigate this sleep
+                        #      added to 'pad' the results with 
+                        #      plenty of time to 'catch up'
+                        time.sleep(5)
+                        
+                        json_str_metrics_1 =\
+                            main.ONOS1cli.topology_events_metrics()
+                        json_str_metrics_2 =\
+                            main.ONOS2cli.topology_events_metrics()
+                        json_str_metrics_3 =\
+                            main.ONOS3cli.topology_events_metrics()
+                        json_str_metrics_4 =\
+                            main.ONOS4cli.topology_events_metrics()
+                        json_str_metrics_5 =\
+                            main.ONOS5cli.topology_events_metrics()
+                        json_str_metrics_6 =\
+                            main.ONOS6cli.topology_events_metrics()
+                        json_str_metrics_7 =\
+                            main.ONOS7cli.topology_events_metrics()
+                        json_obj_1 = json.loads(json_str_metrics_1)
+                        json_obj_2 = json.loads(json_str_metrics_2)
+                        json_obj_3 = json.loads(json_str_metrics_3)
+                        json_obj_4 = json.loads(json_str_metrics_4)
+                        json_obj_5 = json.loads(json_str_metrics_5)
+                        json_obj_6 = json.loads(json_str_metrics_6)
+                        json_obj_7 = json.loads(json_str_metrics_7)
+                        graph_timestamp_1 =\
+                            json_obj_1[graphTimestamp]['value']
+                        graph_timestamp_2 =\
+                            json_obj_2[graphTimestamp]['value']
+                        graph_timestamp_3 =\
+                            json_obj_3[graphTimestamp]['value']
+                        graph_timestamp_4 =\
+                            json_obj_4[graphTimestamp]['value']
+                        graph_timestamp_5 =\
+                            json_obj_5[graphTimestamp]['value']
+                        graph_timestamp_6 =\
+                            json_obj_6[graphTimestamp]['value']
+                        graph_timestamp_7 =\
+                            json_obj_7[graphTimestamp]['value']
+                        
+                        graph_lat_1 = \
+                            int(graph_timestamp_1) - int(t0_system)
+                        graph_lat_2 = \
+                            int(graph_timestamp_2) - int(t0_system)
+                        graph_lat_3 = \
+                            int(graph_timestamp_3) - int(t0_system)
+                        graph_lat_4 = \
+                            int(graph_timestamp_4) - int(t0_system)
+                        graph_lat_5 = \
+                            int(graph_timestamp_5) - int(t0_system)
+                        graph_lat_6 = \
+                            int(graph_timestamp_6) - int(t0_system)
+                        graph_lat_7 = \
+                            int(graph_timestamp_7) - int(t0_system)
+
+                        main.log.info("Graph Timestamp ONOS1: "+
+                            str(graph_timestamp_1))
+                        main.log.info("Graph Timestamp ONOS2: "+
+                            str(graph_timestamp_2))
+                        main.log.info("Graph Timestamp ONOS3: "+
+                            str(graph_timestamp_3))
+                        main.log.info("Graph Timestamp ONOS4: "+
+                            str(graph_timestamp_4))
+                        main.log.info("Graph Timestamp ONOS5: "+
+                            str(graph_timestamp_5))
+                        main.log.info("Graph Timestamp ONOS6: "+
+                            str(graph_timestamp_6))
+                        main.log.info("Graph Timestamp ONOS7: "+
+                            str(graph_timestamp_7))
+
+                        max_graph_lat = max(graph_lat_1,
+                                graph_lat_2,
+                                graph_lat_3,
+                                graph_lat_4,
+                                graph_lat_5,
+                                graph_lat_6,
+                                graph_lat_7)
+                        
+                        if max_graph_lat > sw_disc_threshold_min\
+                            and max_graph_lat < sw_disc_threshold_max\
+                            and int(i) > iter_ignore:
+                            sw_discovery_lat_list.append(
+                                    max_graph_lat)
+                            main.log.info("Sw discovery latency of "+
+                                str(cluster_count)+" node(s): "+
+                                str(max_graph_lat)+" ms")
+                        else:
+                            main.log.info("Switch discovery latency "+
+                                "exceeded the threshold.")
+                            main.log.info(str(max_graph_lat)+" ms")
+                        
+                        break
+                
+                counter_loop += 1
+                time.sleep(3)
+                #END WHILE LOOP            
+          
+            #Below is used for reporting SYN / ACK timing
+            #of all switches 
+            main.ONOS1.tshark_stop()
+            syn_ack_timestamp_list = []
+            if cluster_count < 3:
+                #TODO: capture synack on nodes less than 3
+                syn_ack_timestamp_list.append(0)
+
+            if cluster_count >= 3:
+                main.ONOS2.tshark_stop() 
+                main.ONOS3.tshark_stop()
+                time.sleep(5)
+                os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
+                    "/tmp/syn_ack_onos1_iter"+str(i)+".txt /tmp/")
+                os.system("scp "+ONOS_user+"@"+ONOS2_ip+":"+
+                    "/tmp/syn_ack_onos2_iter"+str(i)+".txt /tmp/")
+                os.system("scp "+ONOS_user+"@"+ONOS3_ip+":"+
+                    "/tmp/syn_ack_onos3_iter"+str(i)+".txt /tmp/")
+                time.sleep(5)
+                #Read each of the files and append all
+                #SYN / ACK timestamps to the list
+                with open("/tmp/syn_ack_onos1_iter"+str(i)+".txt") as\
+                     f_onos1:
+                    for line in f_onos1:
+                        line = line.split(" ")
+                        try:
+                            float(line[1])
+                            syn_ack_timestamp_list.append(line[1])
+                        except ValueError:
+                            main.log.info("String cannot be converted")
+                with open("/tmp/syn_ack_onos2_iter"+str(i)+".txt") as\
+                     f_onos2:
+                    for line in f_onos2:
+                        line = line.split(" ")
+                        try:
+                            float(line[1])
+                            syn_ack_timestamp_list.append(line[1])
+                        except ValueError:
+                            main.log.info("String cannot be converted")
+                with open("/tmp/syn_ack_onos3_iter"+str(i)+".txt") as\
+                     f_onos3:
+                    for line in f_onos3:
+                        line = line.split(" ")
+                        try:
+                            float(line[1])
+                            syn_ack_timestamp_list.append(line[1])
+                        except ValueError:
+                            main.log.info("String cannot be converted")
+            if cluster_count >= 4:
+                main.ONOS4.tshark_stop() 
+                time.sleep(5)
+                os.system("scp "+ONOS_user+"@"+ONOS4_ip+":"+
+                    "/tmp/syn_ack_onos4_iter"+str(i)+".txt /tmp/")
+                time.sleep(5)
+                with open("/tmp/syn_ack_onos4_iter"+str(i)+".txt") as\
+                     f_onos4:
+                    for line in f_onos4:
+                        line = line.split(" ")
+                        try:
+                            float(line[1])
+                            syn_ack_timestamp_list.append(line[1])
+                        except ValueError:
+                            main.log.info("String cannot be converted")
+            if cluster_count >= 5:
+                main.ONOS5.tshark_stop()
+                time.sleep(5)
+                os.system("scp "+ONOS_user+"@"+ONOS5_ip+":"+
+                    "/tmp/syn_ack_onos5_iter"+str(i)+".txt /tmp/")
+                time.sleep(5)
+                with open("/tmp/syn_ack_onos5_iter"+str(i)+".txt") as\
+                     f_onos5:
+                    for line in f_onos5:
+                        line = line.split(" ")
+                        try:
+                            float(line[1])
+                            syn_ack_timestamp_list.append(line[1])
+                        except ValueError:
+                            main.log.info("String cannot be converted")
+            if cluster_count >= 6:
+                main.ONOS6.tshark_stop()
+                time.sleep(5)
+                os.system("scp "+ONOS_user+"@"+ONOS6_ip+":"+
+                    "/tmp/syn_ack_onos6_iter"+str(i)+".txt /tmp/")
+                time.sleep(5)
+                with open("/tmp/syn_ack_onos6_iter"+str(i)+".txt") as\
+                     f_onos6:
+                    for line in f_onos6:
+                        line = line.split(" ")
+                        try:
+                            float(line[1])
+                            syn_ack_timestamp_list.append(line[1])
+                        except ValueError:
+                            main.log.info("String cannot be converted")
+            if cluster_count == 7:
+                main.ONOS7.tshark_stop()
+                time.sleep(5)
+                os.system("scp "+ONOS_user+"@"+ONOS7_ip+":"+
+                    "/tmp/syn_ack_onos7_iter"+str(i)+".txt /tmp/")
+                time.sleep(5)
+                with open("/tmp/syn_ack_onos7_iter"+str(i)+".txt") as\
+                     f_onos7:
+                    for line in f_onos7:
+                        line = line.split(" ")
+                        try:
+                            float(line[1])
+                            syn_ack_timestamp_list.append(line[1])
+                        except ValueError:
+                            main.log.info("String cannot be converted")
+          
+            #Sort the list by timestamp
+            syn_ack_timestamp_list = sorted(syn_ack_timestamp_list)
+            print "syn_ack_-1  " + str(syn_ack_timestamp_list)
+
+            syn_ack_delta =\
+                    int(float(syn_ack_timestamp_list[-1])*1000) -\
+                    int(float(syn_ack_timestamp_list[0])*1000) 
+
+            main.log.info("Switch connection attempt delta iteration "+
+                    str(i)+": "+str(syn_ack_delta))
+            syn_ack_delta_list.append(syn_ack_delta)
+            #END ITERATION LOOP
+        #REPORT HERE 
+
+        if len(sw_discovery_lat_list) > 0:
+            sw_lat_avg = sum(sw_discovery_lat_list) / \
+                     len(sw_discovery_lat_list)
+            sw_lat_dev = numpy.std(sw_discovery_lat_list)
+        else:
+            sw_lat_avg = 0
+            sw_lat_dev = 0
+            assertion = main.FALSE
+        
+        main.log.report("Switch connection attempt time avg "+
+            "(last sw SYN/ACK time - first sw SYN/ACK time) "+
+            str(sum(syn_ack_delta_list)/len(syn_ack_delta_list)) +
+            " ms")
+        main.log.report(str(num_sw)+" Switch discovery lat for "+\
+            str(cluster_count)+" instance(s): ")
+        main.log.report("Avg: "+str(sw_lat_avg)+" ms  "+
+            "Std Deviation: "+str(round(sw_lat_dev,1))+" ms")
+
+        utilities.assert_equals(expect=main.TRUE, actual=assertion,
+                onpass="Switch discovery convergence latency" +\
+                        " for "+str(cluster_count)+" nodes successful",
+                onfail="Switch discovery convergence latency" +\
+                        " test failed")
+        
+    def CASE3(self, main):
+        '''
+        Increase number of nodes and initiate CLI
+        '''
+        import time
+        import subprocess
+        import os
+        import requests
+        import json
+       
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+        ONOS4_ip = main.params['CTRL']['ip4']
+        ONOS5_ip = main.params['CTRL']['ip5']
+        ONOS6_ip = main.params['CTRL']['ip6']
+        ONOS7_ip = main.params['CTRL']['ip7']
+        
+        cell_name = main.params['ENV']['cellName']
+        
+        MN1_ip = main.params['MN']['ip1']
+        BENCH_ip = main.params['BENCH']['ip']
+
+        #NOTE:We start with cluster_count at 3. The first 
+        #case already initialized ONOS1. Increase the
+        #cluster count and start from 3.
+        #You can optionally change the increment to
+        #test steps of node sizes, such as 3,5,7
+       
+        global cluster_count
+        cluster_count += 2 
+        main.log.report("Increasing cluster size to "+
+            str(cluster_count))
+
+        install_result = main.FALSE
+        #Supports up to 7 node configuration
+        #TODO: Cleanup this ridiculous repetitive code 
+        if cluster_count == 3:
+            install_result = \
+                main.ONOSbench.onos_install(node=ONOS2_ip)
+            install_result = \
+                main.ONOSbench.onos_install(node=ONOS3_ip)
+            time.sleep(5)
+            main.log.info("Starting CLI")
+            main.ONOS2cli.start_onos_cli(ONOS2_ip)
+            main.ONOS3cli.start_onos_cli(ONOS3_ip)
+            main.ONOS1cli.add_node(ONOS2_ip, ONOS2_ip)
+            main.ONOS1cli.add_node(ONOS3_ip, ONOS3_ip)
+            
+        if cluster_count == 4:
+            main.log.info("Installing ONOS on node 4")
+            install_result = \
+                main.ONOSbench.onos_install(node=ONOS4_ip)
+            time.sleep(5)
+            main.log.info("Starting CLI")
+            main.ONOS4cli.start_onos_cli(ONOS4_ip)
+            main.ONOS1cli.add_node(ONOS4_ip, ONOS4_ip)
+        
+        elif cluster_count == 5:
+            main.log.info("Installing ONOS on nodes 4 and 5")
+            install_result2 = \
+                main.ONOSbench.onos_install(options="",node=ONOS4_ip)
+            install_result3 = \
+                main.ONOSbench.onos_install(options="",node=ONOS5_ip)
+            time.sleep(5)
+            main.log.info("Starting CLI")
+            main.ONOS4cli.start_onos_cli(ONOS4_ip)
+            main.ONOS5cli.start_onos_cli(ONOS5_ip)
+            main.ONOS1cli.add_node(ONOS4_ip, ONOS4_ip)
+            main.ONOS1cli.add_node(ONOS5_ip, ONOS5_ip)
+            install_result = install_result2 and install_result3
+
+        elif cluster_count == 6:
+            main.log.info("Installing ONOS on nodes 4, 5,and 6")
+            install_result1 = \
+                main.ONOSbench.onos_install(options="",node=ONOS4_ip)
+            install_result2 = \
+                main.ONOSbench.onos_install(options="",node=ONOS5_ip)
+            install_result3 = \
+                main.ONOSbench.onos_install(node=ONOS6_ip)
+            time.sleep(5)
+            main.log.info("Starting CLI")
+            main.ONOS4cli.start_onos_cli(ONOS4_ip)
+            main.ONOS5cli.start_onos_cli(ONOS5_ip)
+            main.ONOS6cli.start_onos_cli(ONOS6_ip)
+            main.ONOS1cli.add_node(ONOS4_ip, ONOS4_ip)
+            main.ONOS1cli.add_node(ONOS5_ip, ONOS5_ip)
+            main.ONOS1cli.add_node(ONOS6_ip, ONOS6_ip)
+            install_result = install_result1 and install_result2 and\
+                    install_result3
+
+        elif cluster_count == 7:
+            main.log.info("Installing ONOS on nodes 4, 5, 6,and 7")
+            install_result3 = \
+                main.ONOSbench.onos_install(node=ONOS6_ip)
+            install_result4 = \
+                main.ONOSbench.onos_install(node=ONOS7_ip)
+            main.log.info("Starting CLI")
+            main.ONOS4cli.start_onos_cli(ONOS4_ip)
+            main.ONOS5cli.start_onos_cli(ONOS5_ip)
+            main.ONOS6cli.start_onos_cli(ONOS6_ip)
+            main.ONOS7cli.start_onos_cli(ONOS7_ip) 
+            main.ONOS1cli.add_node(ONOS4_ip, ONOS4_ip)
+            main.ONOS1cli.add_node(ONOS5_ip, ONOS5_ip)
+            main.ONOS1cli.add_node(ONOS6_ip, ONOS6_ip)
+            main.ONOS1cli.add_node(ONOS7_ip, ONOS7_ip)
+
+            install_result = \
+                    install_result3 and install_result4
+
+        time.sleep(5)
+
+        if install_result == main.TRUE:
+            assertion = main.TRUE
+        else:
+            assertion = main.FALSE
+        
+        utilities.assert_equals(expect=main.TRUE, actual=assertion,
+                onpass="Scale out to "+str(cluster_count)+\
+                       " nodes successful",
+                onfail="Scale out to "+str(cluster_count)+\
+                       " nodes failed")
+
+
+    def CASE4(self, main):
+        '''
+        Cleanup ONOS nodes and Increase topology size
+        '''
+        #TODO: use meaningful assertion
+        assertion=main.TRUE
+
+        ONOS1_ip = main.params['CTRL']['ip1']
+        ONOS2_ip = main.params['CTRL']['ip2']
+        ONOS3_ip = main.params['CTRL']['ip3']
+        ONOS4_ip = main.params['CTRL']['ip4']
+        ONOS5_ip = main.params['CTRL']['ip5']
+        ONOS6_ip = main.params['CTRL']['ip6']
+        ONOS7_ip = main.params['CTRL']['ip7']
+        MN1_ip = main.params['MN']['ip1']
+        BENCH_ip = main.params['BENCH']['ip']
+
+        main.log.info("Uninstalling previous instances")
+        main.ONOSbench.onos_uninstall(node_ip = ONOS2_ip)
+        main.ONOSbench.onos_uninstall(node_ip = ONOS3_ip)
+        main.ONOSbench.onos_uninstall(node_ip = ONOS4_ip)
+        main.ONOSbench.onos_uninstall(node_ip = ONOS5_ip)
+        main.ONOSbench.onos_uninstall(node_ip = ONOS6_ip)
+        main.ONOSbench.onos_uninstall(node_ip = ONOS7_ip)
+        
+        global topo_iteration
+        global cluster_count
+        cluster_count = 1  
+        topo_iteration += 1
+
+        main.log.report("Increasing topology size")
+        utilities.assert_equals(expect=main.TRUE, actual=assertion,
+            onpass="Topology size increased successfully",
+            onfail="Topology size was not increased")
+
+
+
diff --git a/TestON/tests/TopoConvNext/TopoConvNext.topo b/TestON/tests/TopoConvNext/TopoConvNext.topo
new file mode 100644
index 0000000..b7e9e96
--- /dev/null
+++ b/TestON/tests/TopoConvNext/TopoConvNext.topo
@@ -0,0 +1,163 @@
+<TOPOLOGY>
+    <COMPONENT>
+        
+        <ONOSbench>
+            <host>10.128.174.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOSbench>
+
+        <ONOS1cli>
+            <host>10.128.174.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1cli>
+
+        <ONOS2cli>
+            <host>10.128.174.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS2cli>
+        
+        <ONOS3cli>
+            <host>10.128.174.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS3cli>
+        
+        <ONOS4cli>
+            <host>10.128.174.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS4cli>
+        
+        <ONOS5cli>
+            <host>10.128.174.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>6</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS5cli>
+        
+        <ONOS6cli>
+            <host>10.128.174.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>7</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS6cli>
+        
+        <ONOS7cli>
+            <host>10.128.174.10</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosCliDriver</type>
+            <connect_order>8</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS7cli>
+
+        <ONOS1>
+            <host>10.128.174.1</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>9</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS1>
+
+        <ONOS2>
+            <host>10.128.174.2</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>10</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS2>
+
+        <ONOS3>
+            <host>10.128.174.3</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>11</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS3>
+        
+        <ONOS4>
+            <host>10.128.174.4</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>12</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS4>
+
+        <ONOS5>
+            <host>10.128.174.5</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>13</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS5>
+    
+        <ONOS6>
+            <host>10.128.174.6</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>14</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS6>
+        
+        <ONOS7>
+            <host>10.128.174.7</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>OnosDriver</type>
+            <connect_order>15</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </ONOS7>
+
+        <Mininet1>
+            <host>10.128.10.90</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>MininetCliDriver</type>
+            <connect_order>16</connect_order>
+            <COMPONENTS>
+                <arg1> --custom topo-500sw.py </arg1>
+                <arg2> --arp --mac --topo mytopo</arg2>
+                <arg3> </arg3>
+                <controller> remote </controller>
+            </COMPONENTS>
+        </Mininet1>
+
+        <Mininet2>
+            <host>10.128.10.90</host>
+            <user>admin</user>
+            <password>onos_test</password>
+            <type>RemoteMininetDriver</type>
+            <connect_order>17</connect_order>
+            <COMPONENTS> </COMPONENTS>
+        </Mininet2>
+
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/TopoPerfNext/TopoPerfNext.params b/TestON/tests/TopoPerfNext/TopoPerfNext.params
index 01334c9..851522c 100644
--- a/TestON/tests/TopoPerfNext/TopoPerfNext.params
+++ b/TestON/tests/TopoPerfNext/TopoPerfNext.params
@@ -1,5 +1,5 @@
 <PARAMS>
-    <testcases>1,2,3,4,5</testcases>
+    <testcases>1,2,3</testcases>
 
     <ENV>
         <cellName>topo_perf_test</cellName>
@@ -35,19 +35,31 @@
         #If on, logging will be more verbose and
         #tshark pcap will be enabled
         #pcap file located at /tmp/'capture_name'
-        <debugMode>on</debugMode>
+        <debugMode>off</debugMode>
+        <onosLogFile>/opt/onos/log/karaf*</onosLogFile>
+
+        <topo_config_file>
+        single_topo_event_accumulator.cfg
+        </topo_config_file>
+        <topo_config_name>
+        org.onlab.onos.net.topology.impl.DefaultTopologyProvider.cfg
+        </topo_config_name>
 
         #Number of times to iterate each case
-        <numIter>5</numIter>
-        <numSwitch>100</numSwitch>         
-    
+        <numIter>20</numIter>
+        <numSwitch>2</numSwitch>
+        #Number of iterations to ignore initially
+        <iterIgnore>2</iterIgnore>
+
         <singleSwThreshold>0,1000</singleSwThreshold>
         <portUpThreshold>0,1000</portUpThreshold>
         <portDownThreshold>0,1000</portDownThreshold>
         <linkUpThreshold>0,10000</linkUpThreshold>
         <linkDownThreshold>0,10000</linkDownThreshold>
         <swDisc100Threshold>0,10000</swDisc100Threshold>
-    </TEST>
+    
+        <tabletFile>tablets_3node.json</tabletFile>
+   </TEST>
 
     <JSON>
         <deviceTimestamp>topologyDeviceEventTimestamp</deviceTimestamp>
diff --git a/TestON/tests/TopoPerfNext/TopoPerfNext.py b/TestON/tests/TopoPerfNext/TopoPerfNext.py
index 9dd828e..65bc7a9 100644
--- a/TestON/tests/TopoPerfNext/TopoPerfNext.py
+++ b/TestON/tests/TopoPerfNext/TopoPerfNext.py
@@ -3,6 +3,10 @@
 #Topology Performance test for ONOS-next
 #
 #andrew@onlab.us
+#
+#If your machine does not come with numpy
+#run the following command:
+#sudo apt-get install python-numpy python-scipy 
 
 import time
 import sys
@@ -27,20 +31,52 @@
         ONOS1_ip = main.params['CTRL']['ip1']
         ONOS2_ip = main.params['CTRL']['ip2']
         ONOS3_ip = main.params['CTRL']['ip3']
+        
+        #### Hardcoded ONOS nodes particular to my env ####
+        ONOS4_ip = "10.128.174.4"
+        ONOS5_ip = "10.128.174.5"
+        ONOS6_ip = "10.128.174.6"
+        ONOS7_ip = "10.128.174.7"
+        #### ####
+
         MN1_ip = main.params['MN']['ip1']
         BENCH_ip = main.params['BENCH']['ip']
 
+        topo_cfg_file = main.params['TEST']['topo_config_file']
+        topo_cfg_name = main.params['TEST']['topo_config_name']
+        
         main.case("Setting up test environment")
+        main.log.info("Copying topology event accumulator config"+\
+            " to ONOS /package/etc")
+        main.ONOSbench.handle.sendline("cp ~/"+\
+            topo_cfg_file+\
+            " ~/ONOS/tools/package/etc/"+\
+            topo_cfg_name)
+        main.ONOSbench.handle.expect("\$")
+
+        main.log.report("Setting up test environment")
+
+        main.step("Cleaning previously installed ONOS if any")
+        main.ONOSbench.onos_uninstall(node_ip=ONOS4_ip)
+        main.ONOSbench.onos_uninstall(node_ip=ONOS5_ip)
+        main.ONOSbench.onos_uninstall(node_ip=ONOS6_ip)
+        main.ONOSbench.onos_uninstall(node_ip=ONOS7_ip)
 
         main.step("Creating cell file")
         cell_file_result = main.ONOSbench.create_cell_file(
-                BENCH_ip, cell_name, MN1_ip, "onos-core",
+                BENCH_ip, cell_name, MN1_ip, "onos-core,onos-app-metrics",
                 ONOS1_ip, ONOS2_ip, ONOS3_ip)
 
         main.step("Applying cell file to environment")
         cell_apply_result = main.ONOSbench.set_cell(cell_name)
         verify_cell_result = main.ONOSbench.verify_cell()
         
+        #NOTE: This step may be removed after proper 
+        #      copy cat log functionality
+        main.step("Removing raft/copy-cat logs from ONOS nodes")
+        main.ONOSbench.onos_remove_raft_logs()
+        time.sleep(30)
+
         main.step("Git checkout and pull "+checkout_branch)
         if git_pull == 'on':
             checkout_result = \
@@ -51,10 +87,19 @@
             pull_result = main.TRUE
             main.log.info("Skipped git checkout and pull")
 
+        #TODO: Uncomment when wiki posting works
+        #main.log.report("Commit information - ")
+        #main.ONOSbench.get_version(report=True)
+
         main.step("Using mvn clean & install")
         #mvn_result = main.ONOSbench.clean_install()
         mvn_result = main.TRUE
 
+        main.step("Set cell for ONOS cli env")
+        main.ONOS1cli.set_cell(cell_name)
+        main.ONOS2cli.set_cell(cell_name)
+        main.ONOS3cli.set_cell(cell_name)
+
         main.step("Creating ONOS package")
         package_result = main.ONOSbench.onos_package()
 
@@ -63,15 +108,6 @@
         install2_result = main.ONOSbench.onos_install(node=ONOS2_ip)
         install3_result = main.ONOSbench.onos_install(node=ONOS3_ip)
 
-        #NOTE: This step may be unnecessary
-        #main.step("Starting ONOS service")
-        #start_result = main.ONOSbench.onos_start(ONOS1_ip)
-
-        main.step("Set cell for ONOS cli env")
-        main.ONOS1cli.set_cell(cell_name)
-        main.ONOS2cli.set_cell(cell_name)
-        main.ONOS3cli.set_cell(cell_name)
-
         time.sleep(10)
 
         main.step("Start onos cli")
@@ -79,19 +115,14 @@
         cli2 = main.ONOS2cli.start_onos_cli(ONOS2_ip)
         cli3 = main.ONOS3cli.start_onos_cli(ONOS3_ip)
 
-        main.step("Enable metrics feature")
-        main.ONOS1cli.feature_install("onos-app-metrics-topology")
-        main.ONOS2cli.feature_install("onos-app-metrics-topology")
-        main.ONOS3cli.feature_install("onos-app-metrics-topology")
-
         utilities.assert_equals(expect=main.TRUE,
                 actual= cell_file_result and cell_apply_result and\
                         verify_cell_result and checkout_result and\
                         pull_result and mvn_result and\
                         install1_result and install2_result and\
                         install3_result,
-                onpass="ONOS started successfully",
-                onfail="Failed to start ONOS")
+                onpass="Test Environment setup successful",
+                onfail="Failed to setup test environment")
 
     def CASE2(self, main):
         '''
@@ -115,6 +146,7 @@
         import json
         import requests
         import os
+        import numpy
 
         ONOS1_ip = main.params['CTRL']['ip1']
         ONOS2_ip = main.params['CTRL']['ip2']
@@ -125,13 +157,16 @@
        
         #Number of iterations of case
         num_iter = main.params['TEST']['numIter']
-       
+        #Number of first 'x' iterations to ignore:
+        iter_ignore = int(main.params['TEST']['iterIgnore'])
+
         #Timestamp 'keys' for json metrics output.
         #These are subject to change, hence moved into params
         deviceTimestamp = main.params['JSON']['deviceTimestamp']
         graphTimestamp = main.params['JSON']['graphTimestamp']
 
         debug_mode = main.params['TEST']['debugMode']
+        onos_log = main.params['TEST']['onosLogFile']
 
         #Threshold for the test
         threshold_str = main.params['TEST']['singleSwThreshold']
@@ -145,6 +180,7 @@
         latency_ofp_to_graph_list = []
         latency_ofp_to_device_list = []
         latency_t0_to_device_list = []
+        latency_tcp_to_ofp_list = []
 
         #Directory/file to store tshark results
         tshark_of_output = "/tmp/tshark_of_topo.txt"
@@ -158,11 +194,19 @@
         assertion = main.TRUE
       
         local_time = time.strftime('%x %X')
+        local_time = local_time.replace("/","")
+        local_time = local_time.replace(" ","_")
+        local_time = local_time.replace(":","")
         if debug_mode == 'on':
             main.ONOS1.tshark_pcap("eth0",
-                    "/tmp/single_sw_lat_pcap"+local_time) 
+                    "/tmp/single_sw_lat_pcap_"+local_time) 
 
-        main.log.report("Latency of adding one switch")
+            main.log.info("TEST")
+
+        main.log.report("Latency of adding one switch to controller")
+        main.log.report("First "+str(iter_ignore)+" iterations ignored"+
+                " for jvm warmup time")
+        main.log.report("Total iterations of test: "+str(num_iter))
 
         for i in range(0, int(num_iter)):
             main.log.info("Starting tshark capture")
@@ -287,11 +331,12 @@
                      int(delta_device_3)) / 3
 
             #Ensure avg delta meets the threshold before appending
-            if avg_delta_device > 0.0 and avg_delta_device < 10000:
+            if avg_delta_device > 0.0 and avg_delta_device < 10000\
+                    and int(i) > iter_ignore:
                 latency_t0_to_device_list.append(avg_delta_device)
             else:
                 main.log.info("Results for t0-to-device ignored"+\
-                        "due to excess in threshold")
+                        "due to excess in threshold / warmup iteration.")
 
             #t0 to graph processing latency (end-to-end)
             delta_graph_1 = int(graph_timestamp_1) - int(t0_tcp)
@@ -305,7 +350,8 @@
                      int(delta_graph_3)) / 3
 
             #Ensure avg delta meets the threshold before appending
-            if avg_delta_graph > 0.0 and avg_delta_graph < 10000:
+            if avg_delta_graph > 0.0 and avg_delta_graph < 10000\
+                    and int(i) > iter_ignore:
                 latency_end_to_end_list.append(avg_delta_graph)
             else:
                 main.log.info("Results for end-to-end ignored"+\
@@ -322,8 +368,20 @@
                      int(delta_ofp_graph_3)) / 3
             
             if avg_delta_ofp_graph > threshold_min \
-                    and avg_delta_ofp_graph < threshold_max:
+                    and avg_delta_ofp_graph < threshold_max\
+                    and int(i) > iter_ignore:
                 latency_ofp_to_graph_list.append(avg_delta_ofp_graph)
+            elif avg_delta_ofp_graph > (-10) and \
+                    avg_delta_ofp_graph < 0.0 and\
+                    int(i) > iter_ignore:
+                main.log.info("Sub-millisecond result likely; "+
+                    "negative result was rounded to 0")
+                #NOTE: Current metrics framework does not 
+                #support sub-millisecond accuracy. Therefore,
+                #if the result is negative, we can reasonably
+                #conclude sub-millisecond results and just 
+                #append the best rounded effort - 0 ms. 
+                latency_ofp_to_graph_list.append(0)
             else:
                 main.log.info("Results for ofp-to-graph "+\
                         "ignored due to excess in threshold")
@@ -336,12 +394,21 @@
             avg_delta_ofp_device = \
                     (float(delta_ofp_device_1)+\
                      float(delta_ofp_device_2)+\
-                     float(delta_ofp_device_3)) / 3.0
+                     float(delta_ofp_device_3)) / 3
             
             #NOTE: ofp - delta measurements are occasionally negative
             #      due to system time misalignment.
             latency_ofp_to_device_list.append(avg_delta_ofp_device)
 
+            delta_ofp_tcp = int(t0_ofp) - int(t0_tcp)
+            if delta_ofp_tcp > threshold_min \
+                    and delta_ofp_tcp < threshold_max and\
+                    int(i) > iter_ignore:
+                latency_tcp_to_ofp_list.append(delta_ofp_tcp)
+            else:
+                main.log.info("Results fo tcp-to-ofp "+\
+                        "ignored due to excess in threshold")
+
             #TODO:
             #Fetch logs upon threshold excess
 
@@ -365,7 +432,9 @@
                     str(delta_device_2) + " ms")
             main.log.info("ONOS3 delta device - t0: "+
                     str(delta_device_3) + " ms")
-          
+         
+            main.log.info("TCP to OFP delta: "+
+                    str(delta_ofp_tcp) + " ms")
             #main.log.info("ONOS1 delta OFP - device: "+
             #        str(delta_ofp_device_1) + " ms")
             #main.log.info("ONOS2 delta OFP - device: "+
@@ -385,7 +454,8 @@
         if len(latency_end_to_end_list) > 0 and\
            len(latency_ofp_to_graph_list) > 0 and\
            len(latency_ofp_to_device_list) > 0 and\
-           len(latency_t0_to_device_list) > 0:
+           len(latency_t0_to_device_list) > 0 and\
+           len(latency_tcp_to_ofp_list) > 0:
             assertion = main.TRUE
         elif len(latency_end_to_end_list) == 0:
             #The appending of 0 here is to prevent 
@@ -402,6 +472,9 @@
         elif len(latency_t0_to_device_list) == 0:
             latency_t0_to_device_list.append(0)
             assertion = main.FALSE
+        elif len(latency_tcp_to_ofp_list) == 0:
+            latency_tcp_to_ofp_list.append(0)
+            assertion = main.FALSE
 
         #Calculate min, max, avg of latency lists
         latency_end_to_end_max = \
@@ -411,7 +484,9 @@
         latency_end_to_end_avg = \
                 (int(sum(latency_end_to_end_list)) / \
                  len(latency_end_to_end_list))
-   
+        latency_end_to_end_std_dev = \
+                str(round(numpy.std(latency_end_to_end_list),1))
+
         latency_ofp_to_graph_max = \
                 int(max(latency_ofp_to_graph_list))
         latency_ofp_to_graph_min = \
@@ -419,6 +494,8 @@
         latency_ofp_to_graph_avg = \
                 (int(sum(latency_ofp_to_graph_list)) / \
                  len(latency_ofp_to_graph_list))
+        latency_ofp_to_graph_std_dev = \
+                str(round(numpy.std(latency_ofp_to_graph_list),1))
 
         latency_ofp_to_device_max = \
                 int(max(latency_ofp_to_device_list))
@@ -427,27 +504,44 @@
         latency_ofp_to_device_avg = \
                 (int(sum(latency_ofp_to_device_list)) / \
                  len(latency_ofp_to_device_list))
+        latency_ofp_to_device_std_dev = \
+                str(round(numpy.std(latency_ofp_to_device_list),1))
 
         latency_t0_to_device_max = \
-                float(max(latency_t0_to_device_list))
+                int(max(latency_t0_to_device_list))
         latency_t0_to_device_min = \
-                float(min(latency_t0_to_device_list))
+                int(min(latency_t0_to_device_list))
         latency_t0_to_device_avg = \
-                (float(sum(latency_t0_to_device_list)) / \
-                 len(latency_ofp_to_device_list))
+                (int(sum(latency_t0_to_device_list)) / \
+                 len(latency_t0_to_device_list))
+        latency_ofp_to_device_std_dev = \
+                str(round(numpy.std(latency_t0_to_device_list),1))
 
-        main.log.report("Switch add - End-to-end latency: \n"+\
-                "Min: "+str(latency_end_to_end_min)+" mx\n"+\
-                "Max: "+str(latency_end_to_end_max)+" ms\n"+\
-                "Avg: "+str(latency_end_to_end_avg)+" ms")
-        main.log.report("Switch add - OFP-to-Graph latency: \n"+\
-                "Min: "+str(latency_ofp_to_graph_min)+" ms \n"+\
-                "Max: "+str(latency_ofp_to_graph_max)+" ms\n"+\
-                "Avg: "+str(latency_ofp_to_graph_avg)+" ms")
-        main.log.report("Switch add - t0-to-Device latency: \n"+\
-                "Min: "+str(latency_t0_to_device_min)+" ms\n"+\
-                "Max: "+str(latency_t0_to_device_max)+" ms\n"+\
-                "Avg: "+str(latency_t0_to_device_avg)+" ms")
+        latency_tcp_to_ofp_max = \
+                int(max(latency_tcp_to_ofp_list))
+        latency_tcp_to_ofp_min = \
+                int(min(latency_tcp_to_ofp_list))
+        latency_tcp_to_ofp_avg = \
+                (int(sum(latency_tcp_to_ofp_list)) / \
+                 len(latency_tcp_to_ofp_list))
+        latency_tcp_to_ofp_std_dev = \
+                str(round(numpy.std(latency_tcp_to_ofp_list),1))
+
+        main.log.report("Switch add - End-to-end latency: "+\
+                "Avg: "+str(latency_end_to_end_avg)+" ms "+
+                "Std Deviation: "+latency_end_to_end_std_dev+" ms")
+        main.log.report("Switch add - OFP-to-Graph latency: "+\
+                "Note: results are not accurate to sub-millisecond. "+
+                "Any sub-millisecond results are rounded to 0 ms. ")
+        main.log.report("Avg: "+str(latency_ofp_to_graph_avg)+" ms "+
+                "Std Deviation: "+latency_ofp_to_graph_std_dev+" ms")
+        main.log.report("Switch add - TCP-to-OFP latency: "+\
+                "Avg: "+str(latency_tcp_to_ofp_avg)+" ms "+
+                "Std Deviation: "+latency_tcp_to_ofp_std_dev+" ms")
+
+        if debug_mode == 'on':
+            main.ONOS1.cp_logs_to_dir("/opt/onos/log/karaf.log",
+                    "/tmp/", copy_file_name="sw_lat_karaf")
 
         utilities.assert_equals(expect=main.TRUE, actual=assertion,
                 onpass="Switch latency test successful",
@@ -467,6 +561,7 @@
         import os
         import requests
         import json
+        import numpy
 
         ONOS1_ip = main.params['CTRL']['ip1']
         ONOS2_ip = main.params['CTRL']['ip2']
@@ -487,13 +582,17 @@
         debug_mode = main.params['TEST']['debugMode']
 
         local_time = time.strftime('%x %X')
+        local_time = local_time.replace("/","")
+        local_time = local_time.replace(" ","_")
+        local_time = local_time.replace(":","")
         if debug_mode == 'on':
             main.ONOS1.tshark_pcap("eth0",
-                    "/tmp/port_lat_pcap"+local_time) 
+                    "/tmp/port_lat_pcap_"+local_time) 
 
         #Threshold for this test case
         up_threshold_str = main.params['TEST']['portUpThreshold']
         down_threshold_str = main.params['TEST']['portDownThreshold']
+        
         up_threshold_obj = up_threshold_str.split(",")
         down_threshold_obj = down_threshold_str.split(",")
 
@@ -513,6 +612,8 @@
         interface_config = "s1-eth1"
 
         main.log.report("Port enable / disable latency")
+        main.log.report("Simulated by ifconfig up / down")
+        main.log.report("Total iterations of test: "+str(num_iter))
 
         main.step("Assign switches s1 and s2 to controller 1")
         main.Mininet1.assign_sw_controller(sw="1",ip1=ONOS1_ip,
@@ -523,16 +624,7 @@
         #Give enough time for metrics to propagate the 
         #assign controller event. Otherwise, these events may
         #carry over to our measurements
-        time.sleep(10)
-
-        main.step("Verify switch is assigned correctly")
-        result_s1 = main.Mininet1.get_sw_controller(sw="s1")
-        result_s2 = main.Mininet1.get_sw_controller(sw="s2")
-        if result_s1 == main.FALSE or result_s2 == main.FALSE:
-            main.log.info("Switch s1 was not assigned correctly")
-            assertion = main.FALSE
-        else:
-            main.log.info("Switch s1 was assigned correctly")
+        time.sleep(15)
 
         port_up_device_to_ofp_list = []
         port_up_graph_to_ofp_list = []
@@ -544,17 +636,25 @@
             main.ONOS1.tshark_grep(tshark_port_status,
                     tshark_port_down)
             
-            time.sleep(10)
+            time.sleep(5)
 
             #Disable interface that is connected to switch 2
             main.step("Disable port: "+interface_config)
-            main.Mininet2.handle.sendline("sudo ifconfig "+
+            main.Mininet1.handle.sendline("sh ifconfig "+
                     interface_config+" down")
-            main.Mininet2.handle.expect("\$")
-            time.sleep(10)
+            main.Mininet1.handle.expect("mininet>")
 
+            time.sleep(3)
             main.ONOS1.tshark_stop()
-            time.sleep(5)
+            
+            main.step("Obtain t1 by metrics call")
+            json_str_up_1 = main.ONOS1cli.topology_events_metrics()
+            json_str_up_2 = main.ONOS2cli.topology_events_metrics()
+            json_str_up_3 = main.ONOS3cli.topology_events_metrics()
+
+            json_obj_1 = json.loads(json_str_up_1)
+            json_obj_2 = json.loads(json_str_up_2)
+            json_obj_3 = json.loads(json_str_up_3)
             
             #Copy tshark output file from ONOS to TestON instance
             #/tmp directory
@@ -566,7 +666,7 @@
             f_line = f_port_down.readline()
             obj_down = f_line.split(" ")
             if len(f_line) > 0:
-                timestamp_begin_pt_down = int(float(obj_down[1]))*1000
+                timestamp_begin_pt_down = int(float(obj_down[1])*1000)
                 main.log.info("Port down begin timestamp: "+
                         str(timestamp_begin_pt_down))
             else:
@@ -578,18 +678,7 @@
 
             main.log.info("TEST tshark obj: "+str(obj_down))
 
-            main.step("Obtain t1 by REST call")
-            json_str_1 = main.ONOS1cli.topology_events_metrics()
-            json_str_2 = main.ONOS2cli.topology_events_metrics()
-            json_str_3 = main.ONOS3cli.topology_events_metrics()
-
-            main.log.info("TEST json_str 1: "+str(json_str_1))
-
-            json_obj_1 = json.loads(json_str_1)
-            json_obj_2 = json.loads(json_str_2)
-            json_obj_3 = json.loads(json_str_3)
-           
-            time.sleep(5)
+            time.sleep(3)
 
             #Obtain graph timestamp. This timestsamp captures
             #the epoch time at which the topology graph was updated.
@@ -600,6 +689,9 @@
             graph_timestamp_3 = \
                     json_obj_3[graphTimestamp]['value']
 
+            main.log.info("TEST graph timestamp ONOS1: "+
+                    str(graph_timestamp_1))
+
             #Obtain device timestamp. This timestamp captures
             #the epoch time at which the device event happened
             device_timestamp_1 = \
@@ -629,14 +721,14 @@
             pt_down_graph_to_ofp_avg =\
                     (int(pt_down_graph_to_ofp_1) +
                      int(pt_down_graph_to_ofp_2) + 
-                     int(pt_down_graph_to_ofp_3)) / 3.0
+                     int(pt_down_graph_to_ofp_3)) / 3
             pt_down_device_to_ofp_avg = \
                     (int(pt_down_device_to_ofp_1) + 
                      int(pt_down_device_to_ofp_2) +
-                     int(pt_down_device_to_ofp_3)) / 3.0
+                     int(pt_down_device_to_ofp_3)) / 3
 
-            if pt_down_graph_to_ofp_avg > 0.0 and \
-                    pt_down_graph_to_ofp_avg < 1000:
+            if pt_down_graph_to_ofp_avg > down_threshold_min and \
+                    pt_down_graph_to_ofp_avg < down_threshold_max:
                 port_down_graph_to_ofp_list.append(
                     pt_down_graph_to_ofp_avg)
                 main.log.info("Port down: graph to ofp avg: "+
@@ -660,16 +752,29 @@
             #Port up events 
             main.step("Enable port and obtain timestamp")
             main.step("Starting wireshark capture for port status up")
-            main.ONOS1.tshark_grep("OFP 130 Port Status", tshark_port_up)
+            main.ONOS1.tshark_grep(tshark_port_status, tshark_port_up)
             time.sleep(5)
 
-            main.Mininet2.handle.sendline("sudo ifconfig "+
+            main.Mininet1.handle.sendline("sh ifconfig "+
                     interface_config+" up")
-            main.Mininet2.handle.expect("\$")
-            time.sleep(10)
+            main.Mininet1.handle.expect("mininet>")
             
+            #Allow time for tshark to capture event
+            time.sleep(3)
             main.ONOS1.tshark_stop()
 
+            #Obtain metrics shortly afterwards
+            #This timestsamp captures
+            #the epoch time at which the topology graph was updated.
+            main.step("Obtain t1 by REST call")
+            json_str_up_1 = main.ONOS1cli.topology_events_metrics()
+            json_str_up_2 = main.ONOS2cli.topology_events_metrics()
+            json_str_up_3 = main.ONOS3cli.topology_events_metrics()
+            
+            json_obj_1 = json.loads(json_str_up_1)
+            json_obj_2 = json.loads(json_str_up_2)
+            json_obj_3 = json.loads(json_str_up_3)
+
             os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
                     tshark_port_up+" /tmp/")
 
@@ -677,7 +782,7 @@
             f_line = f_port_up.readline()
             obj_up = f_line.split(" ")
             if len(f_line) > 0:
-                timestamp_begin_pt_up = int(float(obj_up[1]))*1000
+                timestamp_begin_pt_up = int(float(obj_up[1])*1000)
                 main.log.info("Port up begin timestamp: "+
                         str(timestamp_begin_pt_up))
             else:
@@ -687,17 +792,6 @@
             
             f_port_up.close()
 
-            main.step("Obtain t1 by REST call")
-            json_str_1 = main.ONOS1cli.topology_events_metrics()
-            json_str_2 = main.ONOS2cli.topology_events_metrics()
-            json_str_3 = main.ONOS3cli.topology_events_metrics()
-
-            json_obj_1 = json.loads(json_str_1)
-            json_obj_2 = json.loads(json_str_2)
-            json_obj_3 = json.loads(json_str_3)
-
-            #Obtain graph timestamp. This timestsamp captures
-            #the epoch time at which the topology graph was updated.
             graph_timestamp_1 = \
                     json_obj_1[graphTimestamp]['value']
             graph_timestamp_2 = \
@@ -730,15 +824,23 @@
             pt_up_device_to_ofp_3 = int(device_timestamp_3) -\
                     int(timestamp_begin_pt_up)
 
+            main.log.info("ONOS1 delta G2O: "+str(pt_up_graph_to_ofp_1))
+            main.log.info("ONOS2 delta G2O: "+str(pt_up_graph_to_ofp_2))
+            main.log.info("ONOS3 delta G2O: "+str(pt_up_graph_to_ofp_3))
+
+            main.log.info("ONOS1 delta D2O: "+str(pt_up_device_to_ofp_1))
+            main.log.info("ONOS2 delta D2O: "+str(pt_up_device_to_ofp_2)) 
+            main.log.info("ONOS3 delta D2O: "+str(pt_up_device_to_ofp_3)) 
+
             pt_up_graph_to_ofp_avg = \
-                    (float(pt_up_graph_to_ofp_1) + 
-                     float(pt_up_graph_to_ofp_2) +
-                     float(pt_up_graph_to_ofp_3)) / 3
+                    (int(pt_up_graph_to_ofp_1) + 
+                     int(pt_up_graph_to_ofp_2) +
+                     int(pt_up_graph_to_ofp_3)) / 3
 
             pt_up_device_to_ofp_avg = \
-                    (float(pt_up_device_to_ofp_1) + 
-                     float(pt_up_device_to_ofp_2) +
-                     float(pt_up_device_to_ofp_3)) / 3
+                    (int(pt_up_device_to_ofp_1) + 
+                     int(pt_up_device_to_ofp_2) +
+                     int(pt_up_device_to_ofp_3)) / 3
 
             if pt_up_graph_to_ofp_avg > up_threshold_min and \
                     pt_up_graph_to_ofp_avg < up_threshold_max: 
@@ -775,44 +877,48 @@
         port_down_graph_to_ofp_avg = \
                 (sum(port_down_graph_to_ofp_list) / 
                  len(port_down_graph_to_ofp_list))
+        port_down_graph_to_ofp_std_dev = \
+                str(round(numpy.std(port_down_graph_to_ofp_list),1))
         
-        main.log.report("Port down graph-to-ofp \nMin: "+
-                str(port_down_graph_to_ofp_min)+" ms  \nMax: "+
-                str(port_down_graph_to_ofp_max)+" ms  \nAvg: "+
-                str(port_down_graph_to_ofp_avg)+" ms")
+        main.log.report("Port down graph-to-ofp "+
+                "Avg: "+str(port_down_graph_to_ofp_avg)+" ms "+
+                "Std Deviation: "+port_down_graph_to_ofp_std_dev+" ms")
         
         port_down_device_to_ofp_min = min(port_down_device_to_ofp_list)
         port_down_device_to_ofp_max = max(port_down_device_to_ofp_list)
         port_down_device_to_ofp_avg = \
                 (sum(port_down_device_to_ofp_list) /\
                  len(port_down_device_to_ofp_list))
+        port_down_device_to_ofp_std_dev = \
+                str(round(numpy.std(port_down_device_to_ofp_list),1))
         
-        main.log.report("Port down device-to-ofp \nMin: "+
-                str(port_down_device_to_ofp_min)+" ms  \nMax: "+
-                str(port_down_device_to_ofp_max)+" ms  \nAvg: "+
-                str(port_down_device_to_ofp_avg)+" ms")
+        main.log.report("Port down device-to-ofp "+
+                "Avg: "+str(port_down_device_to_ofp_avg)+" ms "+
+                "Std Deviation: "+port_down_device_to_ofp_std_dev+" ms")
         
         port_up_graph_to_ofp_min = min(port_up_graph_to_ofp_list)
         port_up_graph_to_ofp_max = max(port_up_graph_to_ofp_list)
         port_up_graph_to_ofp_avg = \
                 (sum(port_up_graph_to_ofp_list) /\
                  len(port_up_graph_to_ofp_list))
+        port_up_graph_to_ofp_std_dev = \
+                str(round(numpy.std(port_up_graph_to_ofp_list),1))
         
-        main.log.report("Port up graph-to-ofp \nMin: "+
-                str(port_up_graph_to_ofp_min)+" ms  \nMax: "+
-                str(port_up_graph_to_ofp_max)+" ms  \nAvg: "+
-                str(port_up_graph_to_ofp_avg)+" ms")
+        main.log.report("Port up graph-to-ofp "+
+                "Avg: "+str(port_up_graph_to_ofp_avg)+" ms "+
+                "Std Deviation: "+port_up_graph_to_ofp_std_dev+" ms")
           
         port_up_device_to_ofp_min = min(port_up_device_to_ofp_list)
         port_up_device_to_ofp_max = max(port_up_device_to_ofp_list)
         port_up_device_to_ofp_avg = \
                 (sum(port_up_device_to_ofp_list) /\
                  len(port_up_device_to_ofp_list))
+        port_up_device_to_ofp_std_dev = \
+                str(round(numpy.std(port_up_device_to_ofp_list),1))
         
-        main.log.report("Port up device-to-ofp \nMin: "+
-                str(port_up_device_to_ofp_min)+" ms  \nMax: "+
-                str(port_up_device_to_ofp_max)+" ms  \nAvg: "+
-                str(port_up_device_to_ofp_avg)+" ms")
+        main.log.report("Port up device-to-ofp "+
+                "Avg: "+str(port_up_device_to_ofp_avg)+" ms "+
+                "Std Deviation: "+port_up_device_to_ofp_std_dev+" ms")
 
         utilities.assert_equals(expect=main.TRUE, actual=assertion,
                 onpass="Port discovery latency calculation successful",
@@ -832,7 +938,8 @@
         import os
         import requests
         import json
-
+        import numpy 
+    
         ONOS1_ip = main.params['CTRL']['ip1']
         ONOS2_ip = main.params['CTRL']['ip2']
         ONOS3_ip = main.params['CTRL']['ip3']
@@ -852,9 +959,12 @@
         debug_mode = main.params['TEST']['debugMode']
 
         local_time = time.strftime('%x %X')
+        local_time = local_time.replace("/","")
+        local_time = local_time.replace(" ","_")
+        local_time = local_time.replace(":","")
         if debug_mode == 'on':
             main.ONOS1.tshark_pcap("eth0",
-                    "/tmp/link_lat_pcap"+local_time) 
+                    "/tmp/link_lat_pcap_"+local_time) 
 
         #Threshold for this test case
         up_threshold_str = main.params['TEST']['linkUpThreshold']
@@ -877,8 +987,11 @@
         link_down_graph_to_system_list = []
         link_up_graph_to_system_list = [] 
 
-        main.log.report("Add / remove link latency between "+
+        main.log.report("Link up / down discovery latency between "+
                 "two switches")
+        main.log.report("Simulated by setting loss-rate 100%")
+        main.log.report("'tc qdisc add dev <intfs> root netem loss 100%'") 
+        main.log.report("Total iterations of test: "+str(num_iter))
 
         main.step("Assign all switches")
         main.Mininet1.assign_sw_controller(sw="1",
@@ -927,17 +1040,17 @@
                 for obj1 in json_obj1:
                     if '01' not in obj1['src']['device']:
                         link_down1 = True
-                        main.log.report("Link down from "+
+                        main.log.info("Link down from "+
                                 "s1 -> s2 on ONOS1 detected")
                 for obj2 in json_obj2:
                     if '01' not in obj2['src']['device']:
                         link_down2 = True
-                        main.log.report("Link down from "+
+                        main.log.info("Link down from "+
                                 "s1 -> s2 on ONOS2 detected")
                 for obj3 in json_obj3:
                     if '01' not in obj3['src']['device']:
                         link_down3 = True
-                        main.log.report("Link down from "+
+                        main.log.info("Link down from "+
                                 "s1 -> s2 on ONOS3 detected")
                 
                 loop_count += 1
@@ -992,18 +1105,18 @@
                         graph_timestamp_3 and link_timestamp_1 and\
                         link_timestamp_2 and link_timestamp_3:
                     link_down_lat_graph1 = int(graph_timestamp_1) -\
-                            timestamp_link_down_t0
+                            int(timestamp_link_down_t0)
                     link_down_lat_graph2 = int(graph_timestamp_2) -\
-                            timestamp_link_down_t0
+                            int(timestamp_link_down_t0)
                     link_down_lat_graph3 = int(graph_timestamp_3) -\
-                            timestamp_link_down_t0
+                            int(timestamp_link_down_t0)
                 
                     link_down_lat_link1 = int(link_timestamp_1) -\
-                            timestamp_link_down_t0
+                            int(timestamp_link_down_t0)
                     link_down_lat_link2 = int(link_timestamp_2) -\
-                            timestamp_link_down_t0
+                            int(timestamp_link_down_t0)
                     link_down_lat_link3 = int(link_timestamp_3) -\
-                            timestamp_link_down_t0
+                            int(timestamp_link_down_t0)
                 else:
                     main.log.error("There was an error calculating"+
                         " the delta for link down event")
@@ -1015,23 +1128,23 @@
                     link_down_lat_device2 = 0
                     link_down_lat_device3 = 0
         
-            main.log.report("Link down latency ONOS1 iteration "+
+            main.log.info("Link down latency ONOS1 iteration "+
                     str(i)+" (end-to-end): "+
                     str(link_down_lat_graph1)+" ms")
-            main.log.report("Link down latency ONOS2 iteration "+
+            main.log.info("Link down latency ONOS2 iteration "+
                     str(i)+" (end-to-end): "+
                     str(link_down_lat_graph2)+" ms")
-            main.log.report("Link down latency ONOS3 iteration "+
+            main.log.info("Link down latency ONOS3 iteration "+
                     str(i)+" (end-to-end): "+
                     str(link_down_lat_graph3)+" ms")
             
-            main.log.report("Link down latency ONOS1 iteration "+
+            main.log.info("Link down latency ONOS1 iteration "+
                     str(i)+" (link-event-to-system-timestamp): "+
                     str(link_down_lat_link1)+" ms")
-            main.log.report("Link down latency ONOS2 iteration "+
+            main.log.info("Link down latency ONOS2 iteration "+
                     str(i)+" (link-event-to-system-timestamp): "+
                     str(link_down_lat_link2)+" ms")
-            main.log.report("Link down latency ONOS3 iteration "+
+            main.log.info("Link down latency ONOS3 iteration "+
                     str(i)+" (link-event-to-system-timestamp): "+
                     str(link_down_lat_link3))
       
@@ -1039,11 +1152,11 @@
             link_down_lat_graph_avg =\
                     (link_down_lat_graph1 +
                      link_down_lat_graph2 +
-                     link_down_lat_graph3) / 3.0
+                     link_down_lat_graph3) / 3
             link_down_lat_link_avg =\
                     (link_down_lat_link1 +
                      link_down_lat_link2 +
-                     link_down_lat_link3) / 3.0
+                     link_down_lat_link3) / 3
 
             #Set threshold and append latency to list
             if link_down_lat_graph_avg > down_threshold_min and\
@@ -1092,17 +1205,17 @@
                 for obj1 in json_obj1:
                     if '01' in obj1['src']['device']:
                         link_down1 = False 
-                        main.log.report("Link up from "+
+                        main.log.info("Link up from "+
                             "s1 -> s2 on ONOS1 detected")
                 for obj2 in json_obj2:
                     if '01' in obj2['src']['device']:
                         link_down2 = False 
-                        main.log.report("Link up from "+
+                        main.log.info("Link up from "+
                             "s1 -> s2 on ONOS2 detected")
                 for obj3 in json_obj3:
                     if '01' in obj3['src']['device']:
                         link_down3 = False 
-                        main.log.report("Link up from "+
+                        main.log.info("Link up from "+
                             "s1 -> s2 on ONOS3 detected")
                 
                 loop_count += 1
@@ -1149,18 +1262,18 @@
                         graph_timestamp_3 and link_timestamp_1 and\
                         link_timestamp_2 and link_timestamp_3:
                     link_up_lat_graph1 = int(graph_timestamp_1) -\
-                            timestamp_link_up_t0
+                            int(timestamp_link_up_t0)
                     link_up_lat_graph2 = int(graph_timestamp_2) -\
-                            timestamp_link_up_t0
+                            int(timestamp_link_up_t0)
                     link_up_lat_graph3 = int(graph_timestamp_3) -\
-                            timestamp_link_up_t0
+                            int(timestamp_link_up_t0)
                 
                     link_up_lat_link1 = int(link_timestamp_1) -\
-                            timestamp_link_up_t0
+                            int(timestamp_link_up_t0)
                     link_up_lat_link2 = int(link_timestamp_2) -\
-                            timestamp_link_up_t0
+                            int(timestamp_link_up_t0)
                     link_up_lat_link3 = int(link_timestamp_3) -\
-                            timestamp_link_up_t0
+                            int(timestamp_link_up_t0)
                 else:
                     main.log.error("There was an error calculating"+
                         " the delta for link down event")
@@ -1197,11 +1310,11 @@
             link_up_lat_graph_avg =\
                     (link_up_lat_graph1 +
                      link_up_lat_graph2 +
-                     link_up_lat_graph3) / 3.0
+                     link_up_lat_graph3) / 3
             link_up_lat_link_avg =\
                     (link_up_lat_link1 +
                      link_up_lat_link2 +
-                     link_up_lat_link3) / 3.0
+                     link_up_lat_link3) / 3
 
             #Set threshold and append latency to list
             if link_up_lat_graph_avg > up_threshold_min and\
@@ -1230,15 +1343,17 @@
         link_up_max = max(link_up_graph_to_system_list)
         link_up_avg = sum(link_up_graph_to_system_list) / \
                         len(link_up_graph_to_system_list)
+        link_down_std_dev = \
+                str(round(numpy.std(link_down_graph_to_system_list),1))
+        link_up_std_dev = \
+                str(round(numpy.std(link_up_graph_to_system_list),1))
 
-        main.log.report("Link down latency - \nMin: "+
-                str(link_down_min)+" ms  \nMax: "+
-                str(link_down_max)+" ms  \nAvg: "+
-                str(link_down_avg)+" ms")
-        main.log.report("Link up latency - \nMin: "+
-                str(link_up_min)+" ms  \nMax: "+
-                str(link_up_max)+" ms  \nAvg: "+
-                str(link_up_avg)+" ms")
+        main.log.report("Link down latency " +
+                "Avg: "+str(link_down_avg)+" ms "+
+                "Std Deviation: "+link_down_std_dev+" ms")
+        main.log.report("Link up latency "+
+                "Avg: "+str(link_up_avg)+" ms "+
+                "Std Deviation: "+link_up_std_dev+" ms")
 
         utilities.assert_equals(expect=main.TRUE, actual=assertion,
                 onpass="Link discovery latency calculation successful",
@@ -1284,10 +1399,13 @@
         
         debug_mode = main.params['TEST']['debugMode']
 
-        local_time = time.strftime('%x %X')
+        local_time = time.strftime('%X')
+        local_time = local_time.replace("/","")
+        local_time = local_time.replace(" ","_")
+        local_time = local_time.replace(":","")
         if debug_mode == 'on':
             main.ONOS1.tshark_pcap("eth0",
-                    "/tmp/100_sw_lat_pcap"+local_time) 
+                    "/tmp/100_sw_lat_pcap_"+local_time) 
  
         #Threshold for this test case
         sw_disc_threshold_str = main.params['TEST']['swDisc100Threshold']
@@ -1489,9 +1607,9 @@
         sw_lat_avg = sum(sw_discovery_lat_list) /\
                      len(sw_discovery_lat_list)
 
-        main.log.report("100 Switch discovery lat - \n"+\
-                "Min: "+str(sw_lat_min)+" ms\n"+\
-                "Max: "+str(sw_lat_max)+" ms\n"+\
-                "Avg: "+str(sw_lat_avg)+" ms\n")
+        main.log.report("100 Switch discovery lat "+\
+                "Min: "+str(sw_lat_min)+" ms"+\
+                "Max: "+str(sw_lat_max)+" ms"+\
+                "Avg: "+str(sw_lat_avg)+" ms")
 
 
diff --git a/TestON/tests/TopoPerfNext/TopoPerfNext.topo b/TestON/tests/TopoPerfNext/TopoPerfNext.topo
index 5010fcc..4ee44e2 100644
--- a/TestON/tests/TopoPerfNext/TopoPerfNext.topo
+++ b/TestON/tests/TopoPerfNext/TopoPerfNext.topo
@@ -71,7 +71,7 @@
             <type>MininetCliDriver</type>
             <connect_order>4</connect_order>
             <COMPONENTS>
-                <arg1> --custom topo-100sw.py </arg1>
+                <arg1> --custom topo-perf-2sw.py </arg1>
                 <arg2> --arp --mac --topo mytopo</arg2>
                 <arg3> </arg3>
                 <controller> remote </controller>
diff --git a/TestON/tests/VyattaTest/VyattaTest.params b/TestON/tests/VyattaTest/VyattaTest.params
deleted file mode 100644
index 92a5b20..0000000
--- a/TestON/tests/VyattaTest/VyattaTest.params
+++ /dev/null
@@ -1,4 +0,0 @@
-<PARAMS>
-    <testcases> [1]</testcases>
-    <mail> anil4haart@gmail.com,paxweb@paxterrasolutions.com</mail>
-</PARAMS>
\ No newline at end of file
diff --git a/TestON/tests/VyattaTest/VyattaTest.py b/TestON/tests/VyattaTest/VyattaTest.py
deleted file mode 100644
index 7d4017b..0000000
--- a/TestON/tests/VyattaTest/VyattaTest.py
+++ /dev/null
@@ -1,95 +0,0 @@
-'''
-	
- *   TestON is free software: you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation, either version 2 of the License, or
- *   (at your option) any later version.
-
- *   TestON is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
-
-
-'''
-
-class VyattaTest :
-
-    def __init__(self) :
-        self.default = ''
-
-    def CASE1(self,main) :
-
-        main.case("VyattaTest Sample Test")
-        main.step("VyattaTest Sample Test")
-        config_result = main.Vyatta.configure()
-        main.log.info(config_result)
-        
-        command_details = main.Vyatta.get_details("show")
-        main.log.info("show \n command_details\n\t"+ str(command_details))
-        
-        command_details = main.Vyatta.get_details("show interfaces")
-        main.log.info("show interfaces \n command_details\n\t"+ str(command_details))
-                
-        command_details = main.Vyatta.get_details("show interfaces ethernet")
-        main.log.info("show interfaces ethernet \n command_details\n\t"+ str(command_details))
-                
-        command_details = main.Vyatta.get_details("show interfaces ethernet eth1")
-        main.log.info("show interfaces ethernet eth1 \n command_details\n\t"+ str(command_details))
-        
-        command_details = main.Vyatta.get_details("show interfaces ethernet eth1 address")
-        main.log.info("show interfaces ethernet eth1 address \n command_details\n\t"+ str(command_details))
-        
-        
-        '''
-        main.Vyatta.handle.expect("\$")
-        
-        resultCommand = main.Vyatta.execute(cmd="configure",prompt='\#',timeout=10)
-        
-        resultCommand = main.Vyatta.execute(cmd="show interfaces ?",prompt='\#',timeout=10)
-        
-        print "Possible Options \t\t"
-        print main.last_response
-        print " ->"*10+"\n"*4
-        import re
-        match = re.findall("\n\s*.\s+(\w+)", main.last_response, 0)
-        print match
-        
-        resultCommand = main.Vyatta.execute(cmd="XYZ",prompt='\#',timeout=10)
-        
-        print "Command result Upto here \t\t"
-        print main.last_response
-        print " ->"*10+"\n"*4
-        import re
-        match = re.findall("\n\s*.\s+(\w+)", main.last_response, 0)
-        print match
-        
-        
-        resultCommand = main.Vyatta.execute(cmd="XYZ",prompt='\#',timeout=10)
-        
-        print "Command result Upto here \t\t"
-        print main.last_response
-        print " ->"*10+"\n"*4
-        import re
-        match = re.findall("\n\s*.\s+(\w+)", main.last_response, 0)
-        print match
-        
-        
-        resultCommand = main.Vyatta.execute(cmd="show interfaces ethernet ?",prompt='\#',timeout=10)
-        
-        print "Possible Options \t\t"
-        print main.last_response
-        print " ->"*10+"\n"*4
-        import re
-        match = re.findall("\n\s*.\s+(\w+)", main.last_response, 0)
-        print match
-        
-        resultCommand = main.Vyatta.execute(cmd="XYZ",prompt='\#',timeout=10)
-        
-        print "Command result Upto here \t\t"
-        print main.last_response
-        print " ->"*10+"\n"*4
-        import re
-        match = re.findall("\n\s*.\s+(\w+)", main.last_response, 0)
-        print match
-        '''
diff --git a/TestON/tests/VyattaTest/VyattaTest.topo b/TestON/tests/VyattaTest/VyattaTest.topo
deleted file mode 100644
index 3b13543..0000000
--- a/TestON/tests/VyattaTest/VyattaTest.topo
+++ /dev/null
@@ -1,14 +0,0 @@
-<TOPOLOGY>
-
-    <COMPONENT>
-        <Vyatta>
-            <host>192.168.56.81</host>
-            <user> vyatta </user>
-            
-            <password>vyatta</password>
-            <type>RemoteSysDriver</type>
-            <COMPONENTS>
-            </COMPONENTS>   
-        </Vyatta>        
-    </COMPONENT>
-</TOPOLOGY>
diff --git a/TestON/tests/VyattaTest/__init__.py b/TestON/tests/VyattaTest/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/TestON/tests/VyattaTest/__init__.py
+++ /dev/null