diff --git a/TestON/core/logger.py b/TestON/core/logger.py
index 1dfe6bf..a2c5aa7 100644
--- a/TestON/core/logger.py
+++ b/TestON/core/logger.py
@@ -1,7 +1,7 @@
 #/usr/bin/env python
 '''
 Created on 07-Jan-2013
-       
+
 @author: Raghav Kashyap(raghavkashyap@paxterrasolutions.com)
 
     TestON is free software: you can redistribute it and/or modify
@@ -15,7 +15,7 @@
     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/>.
 
 
 '''
@@ -27,7 +27,7 @@
 class Logger:
     '''
         Add continuous logs and reports of the test.
-        
+
         @author: Raghav Kashyap(raghavkashyap@paxterrasolutions.com)
     '''
     def _printHeader(self,main) :
@@ -39,7 +39,7 @@
         logmsg = logmsg + "\n\tReport Log File : " + main.ReportFileName + ""
         for component in main.componentDictionary.keys():
             logmsg = logmsg + "\n\t"+component+" Session Log : " + main.logdir+"/"+component+".session" + ""
-            
+
         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 + ".topo" + ""
@@ -49,11 +49,10 @@
         values = re.sub("{", "\n\t", values)
         values = re.sub("}", "\n\t", values)
         logmsg = logmsg + values
-        
         logmsg = logmsg + "\n\n"+" " * 31+"+---------------+\n" +"-" * 29+" { Components Used }  " +"-" * 29+"\n"+" " * 31+"+---------------+\n"
         component_list = []
         component_list.append(None)
-        
+
         # Listing the components in the order of test_target component should be first.
         if type(main.componentDictionary) == dict:
             for key in main.componentDictionary.keys():
@@ -61,64 +60,67 @@
                     component_list[0] = key+"-Test Target"
                 else :
                     component_list.append(key)
-                        
+
         for index in range(len(component_list)) :
             if index==0:
                 if component_list[index]:
                     logmsg+="\t"+component_list[index]+"\n"
             elif index > 0 :
                 logmsg+="\t"+str(component_list[index])+"\n"
-                
-            
-            
+
         logmsg = logmsg + "\n\n"+" " * 30+"+--------+\n" +"-" * 28+" { Topology }  "+"-" * 28 +"\n" +" " * 30+"+--------+\n"
         values = "\n\t" + str(main.topology['COMPONENT'])
         values = re.sub(",", "\n\t", values)
         values = re.sub("{", "\n\t", values)
         values = re.sub("}", "\n\t", values)
         logmsg = logmsg + values
-        
         logmsg = logmsg + "\n"+"-" * 60+"\n"
-        
+
         # enter into log file all headers
         logfile = open(main.LogFileName,"w+")
         logfile.write (logmsg)
         print logmsg
         main.logHeader = logmsg
-
         logfile.close()
-        
+
         #enter into report file all headers
         main.reportFile = open(main.ReportFileName,"w+")
         main.reportFile.write(logmsg)
         main.reportFile.close()
-        
+
+        #wiki file header
+        currentTime = str( main.STARTTIME.strftime("%d %b %Y %H:%M:%S") )
+        main.wikiFile = open( main.WikiFileName, "w+" )
+        main.wikiFile.write( main.TEST + " at " + currentTime + "\n" )
+        main.wikiFile.close()
+
     def initlog(self,main):
         '''
             Initialise all the log handles.
         '''
         main._getTest()
-        main.STARTTIME = datetime.datetime.now() 
+        main.STARTTIME = datetime.datetime.now()
 
         currentTime = re.sub("-|\s|:|\.", "_", str(main.STARTTIME.strftime("%d %b %Y %H:%M:%S")))
         if main.logdir:
             main.logdir = main.logdir+ "/"+main.TEST + "_" + currentTime
         else:
             main.logdir = main.logs_path + main.TEST + "_" + currentTime
-            
+
         os.mkdir(main.logdir)
-           
+
         main.LogFileName = main.logdir + "/" + main.TEST + "_" +str(currentTime) + ".log"
         main.ReportFileName = main.logdir + "/" + main.TEST + "_" + str(currentTime) + ".rpt"
+        main.WikiFileName = main.logdir + "/" + main.TEST + ".txt"
         main.JenkinsCSV = main.logdir + "/" + main.TEST + ".csv"
- 
+
         #### Add log-level - Report
         logging.addLevelName(9, "REPORT")
         logging.addLevelName(7, "EXACT")
         logging.addLevelName(11, "CASE")
         logging.addLevelName(12, "STEP")
         main.log = logging.getLogger(main.TEST)
-        def report (msg):
+        def report(msg):
             '''
                 Will append the report message to the logs.
             '''
@@ -130,11 +132,21 @@
             main.reportFile = open(main.ReportFileName,"a+")
             main.reportFile.write(newmsg)
             main.reportFile.close()
-            
-            
-        main.log.report = report 
-        
-        def exact (exmsg):
+
+        main.log.report = report
+
+        def wiki( msg ):
+            '''
+                Will append the message to the txt file for the wiki.
+            '''
+            main.log._log(6,msg,"OpenFlowAutoMattion","OFAutoMation")
+            main.wikiFile = open(main.WikiFileName,"a+")
+            main.wikiFile.write(msg+"\n")
+            main.wikiFile.close()
+
+        main.log.wiki = wiki
+
+        def exact(exmsg):
             '''
                Will append the raw formatted message to the logs
             '''
@@ -146,10 +158,9 @@
             logfile.write("\n"+ str(exmsg) +"\n")
             logfile.close()
             print exmsg
-            
-        main.log.exact = exact 
-       
-        
+
+        main.log.exact = exact
+
         def case(msg):
             '''
                Format of the case type log defined here.
@@ -161,10 +172,10 @@
             logfile.write("\n"+ str(newmsg) +"\n")
             logfile.close()
             print newmsg
-                        
+
         main.log.case = case 
-        
-        def step (msg):
+
+        def step(msg):
             '''
                 Format of the step type log defined here.
             '''
@@ -175,9 +186,9 @@
             logfile.write("\n"+ str(newmsg) +"\n")
             logfile.close()
             print newmsg
-                        
-        main.log.step = step 
-        
+
+        main.log.step = step
+
         main.LogFileHandler = logging.FileHandler(main.LogFileName)
         self._printHeader(main)
 
@@ -185,7 +196,7 @@
         main.log.setLevel(logging.INFO)
         main.log.setLevel(logging.DEBUG) # Temporary
         main.LogFileHandler.setLevel(logging.INFO)
-       
+
         # create console handler with a higher log level
         main.ConsoleHandler = logging.StreamHandler()
         main.ConsoleHandler.setLevel(logging.INFO)
@@ -225,7 +236,7 @@
         # add the handlers to logger
         main.log.addHandler(main.ConsoleHandler)
         main.log.addHandler(main.LogFileHandler)
-        
+
     def testSummary(self,main):
         '''
             testSummary will take care about the Summary of test.
@@ -237,12 +248,10 @@
             main.TOTAL_TC_SUCCESS = 0
         else:
             main.TOTAL_TC_SUCCESS = str((main.TOTAL_TC_PASS*100)/main.TOTAL_TC_RUN)
-            
         if (main.TOTAL_TC_RUN == 0) :
             main.TOTAL_TC_EXECPERCENT = 0
         else :
             main.TOTAL_TC_EXECPERCENT = str((main.TOTAL_TC_RUN*100)/main.TOTAL_TC_PLANNED)
-        
         testResult = "\n\n"+"*" * 37+"\n" + "\tTest Execution Summary\n" + "\n"+"*" * 37+" \n"
         testResult =  testResult + "\n Test Start           : " + str(main.STARTTIME.strftime("%d %b %Y %H:%M:%S"))
         testResult =  testResult + "\n Test End             : " + str(main.ENDTIME.strftime("%d %b %Y %H:%M:%S"))
@@ -254,7 +263,7 @@
         testResult =  testResult + "\n Total No Result      : " + str(main.TOTAL_TC_NORESULT)
         testResult =  testResult + "\n Success Percentage   : " + str(main.TOTAL_TC_SUCCESS) + "%"
         testResult =  testResult + "\n Execution Result     : " + str(main.TOTAL_TC_EXECPERCENT) + "%"
-        
+
         #main.log.report(testResult)
         main.testResult = testResult
         main.log.exact(testResult)
@@ -266,24 +275,25 @@
         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
         '''
         case = str(main.CurrentTestCaseNumber)
-        
+
         if main.testCaseResult[case] == 2:
             main.TOTAL_TC_RUN  = main.TOTAL_TC_RUN + 1
             main.TOTAL_TC_NORESULT = main.TOTAL_TC_NORESULT + 1
             main.log.exact("\n "+"*" * 29+"\n" + "\n Result: No Assertion Called \n"+"*" * 29+"\n")
+            main.log.wiki("Case "+case+": "+main.CurrentTestCase+" - No Result")
         elif main.testCaseResult[case] == 1:
             main.TOTAL_TC_RUN  = main.TOTAL_TC_RUN  + 1
             main.TOTAL_TC_PASS =  main.TOTAL_TC_PASS + 1
             main.log.exact("\n"+"*" * 29+"\n Result: Pass \n"+"*" * 29+"\n")
+            main.log.wiki("Case "+case+": "+main.CurrentTestCase+" - PASSED")
         elif main.testCaseResult[case] == 0:
             main.TOTAL_TC_RUN  = main.TOTAL_TC_RUN  + 1
             main.TOTAL_TC_FAIL = main.TOTAL_TC_FAIL + 1
             main.log.exact("\n"+"*" * 29+"\n Result: Failed \n"+"*" * 29+"\n")
+            main.log.wiki("Case "+case+": "+main.CurrentTestCase+" - FAILED")
+
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index 961e824..0da4cee 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -52,21 +52,17 @@
 
 class TestON:
     '''
-    
-    TestON will initiate the specified test. 
-    The main tasks are : 
-    * Initiate the required Component handles for the test. 
+    TestON will initiate the specified test.
+    The main tasks are :
+    * Initiate the required Component handles for the test.
     * Create Log file  Handles.
-    
     '''
     def __init__(self,options):
         '''
            Initialise the component handles specified in the topology file of the specified test.
-          
         '''
         # Initialization of the variables.
         __builtin__.main = self
-        
         __builtin__.path = path
         __builtin__.utilities = Utilities()
         self.TRUE = 1
@@ -77,7 +73,10 @@
         self.CASERESULT = self.TRUE
         self.init_result = self.TRUE
         self.testResult = "Summary"
-        self.stepName =""
+        self.stepName = ""
+        self.wikiCache = ""
+        # make this into two lists? one for step names, one for results?
+        # this way, the case result could be a true AND of these results
         self.EXPERIMENTAL_MODE = False
         self.test_target = None
         self.lastcommand = None
@@ -127,7 +126,6 @@
             #Ordering components based on the connect order.
             ordered_component_list =sorted(components_connect_order, key=lambda key: components_connect_order[key])
             print ordered_component_list
-            
             for component in ordered_component_list:
                 self.componentInit(component)
 
@@ -143,7 +141,7 @@
                 return self.configDict
             except Exception:
                 print "There is no such file to parse " + self.configFile
-                        
+
     def componentInit(self,component):
         '''
         This method will initialize specified component
@@ -157,12 +155,12 @@
         driver_options['name']=component
         driverName = self.componentDictionary[component]['type']
         driver_options ['type'] = driverName
-        
+
         classPath = self.getDriverPath(driverName.lower())
         driverModule = importlib.import_module(classPath)
         driverClass = getattr(driverModule, driverName)
         driverObject = driverClass()
-         
+
         connect_result = driverObject.connect(user_name = self.componentDictionary[component]['user'] if ('user' in self.componentDictionary[component].keys()) else getpass.getuser(),
                                               ip_address= self.componentDictionary[component]['host'] if ('host' in self.componentDictionary[component].keys()) else 'localhost',
                                               pwd = self.componentDictionary[component]['password'] if ('password' in self.componentDictionary[component].keys()) else 'changeme',
@@ -171,17 +169,16 @@
         if not connect_result:
             self.log.error("Exiting form the test execution because the connecting to the "+component+" component failed.")
             self.exit()
-            
+
         vars(self)[component] = driverObject
-                        
+
     def run(self):
         '''
-           The Execution of the test script's cases listed in the Test params file will be done here. 
-           And Update each test case result. 
-           This method will return TRUE if it executed all the test cases successfully, 
+           The Execution of the test script's cases listed in the Test params file will be done here.
+           And Update each test case result.
+           This method will return TRUE if it executed all the test cases successfully,
            else will retun FALSE
         '''
-        
         self.testCaseResult = {}
         self.TOTAL_TC = 0
         self.TOTAL_TC_RUN = 0
@@ -192,7 +189,7 @@
         self.TEST_ITERATION = 0
         self.stepCount = 0
         self.CASERESULT = self.TRUE
-        
+
         import testparser
         testFile = self.tests_path + "/"+self.TEST + "/"+self.TEST + ".py"
         test = testparser.TestParser(testFile)
@@ -200,16 +197,18 @@
         self.code = test.getStepCode()
         repeat= int(self.params['repeat']) if ('repeat' in self.params) else 1
         self.TOTAL_TC_PLANNED = len(self.testcases_list)*repeat
-        
+
         result = self.TRUE
         while(repeat):
             for self.CurrentTestCaseNumber in self.testcases_list:
                 result = self.runCase(self.CurrentTestCaseNumber)
             repeat-=1
         return result
-    
+
     def runCase(self,testCaseNumber):
         self.CurrentTestCaseNumber = testCaseNumber
+        self.CurrentTestCase = ""
+        self.stepName = ""
         result = self.TRUE
         self.stepCount = 0
         self.EXPERIMENTAL_MODE = self.FALSE
@@ -221,7 +220,7 @@
         except KeyError:
             self.log.error("There is no Test-Case "+ self.testCaseNumber)
             return self.FALSE
-        
+
         self.stepCount = 0
         while self.stepCount < len(self.code[self.testCaseNumber].keys()):
             result = self.runStep(self.stepList,self.code,self.testCaseNumber)
@@ -229,18 +228,39 @@
                 break
             elif result == self.TRUE:
                 continue
-            
         if not stopped :
             self.testCaseResult[str(self.CurrentTestCaseNumber)] = self.CASERESULT
             self.logger.updateCaseResults(self)
+            self.log.wiki(self.wikiCache)
+            self.wikiCache = ""
         return result
-    
+
     def runStep(self,stepList,code,testCaseNumber):
         if not cli.pause:
             try :
                 step = stepList[self.stepCount]
                 exec code[testCaseNumber][step] in module.__dict__
                 self.stepCount = self.stepCount + 1
+                if step > 0:  # FIXME: step 0 is from previous case - Why is it doing this?
+                    #FIXME are we losing results because of this?
+                    #       Maybe we should be updating stepName sooner?
+                    self.wikiCache += "\t"+str(testCaseNumber)+"."+str(step)+" "+self.stepName+" - "
+                    if self.CASERESULT == self.TRUE:
+                        self.wikiCache += "PASSED\n"
+                    elif self.CASERESULT == self.FALSE:
+                        self.wikiCache += "FAILED\n"
+                    else:
+                        self.wikiCache += "No Result\n"
+                '''
+                else:  # FIXME : DEBUG
+                    self.wikiCache += "DEBUG\t"+str(testCaseNumber)+"."+str(step)+" "+self.stepName+" - "
+                    if self.CASERESULT == self.TRUE:
+                        self.wikiCache += "PASSED\n"
+                    elif self.CASERESULT == self.FALSE:
+                        self.wikiCache += "FAILED\n"
+                    else:
+                        self.wikiCache += "No Result\n"
+                '''
             except TypeError,e:
                 print "Exception in the following section of code: Test Step " +\
                       str(testCaseNumber) + "." + str(step) + " ):"
@@ -250,7 +270,6 @@
                 self.cleanup()
                 self.exit()
             return main.TRUE
-        
         if cli.stop:
             cli.stop = False
             stopped = True
@@ -259,21 +278,21 @@
             self.logger.updateCaseResults(self)
             result = self.cleanup()
             return main.FALSE
-        
+
     def addCaseHeader(self):
         caseHeader = "\n"+"*" * 30+"\n Result summary for Testcase"+str(self.CurrentTestCaseNumber)+"\n"+"*" * 30+"\n"
         self.log.exact(caseHeader)
         caseHeader = "\n"+"*" * 40 +"\nStart of Test Case"+str(self.CurrentTestCaseNumber)+" : "
         for driver in self.componentDictionary.keys():
             vars(self)[driver+'log'].info(caseHeader)
-    
+
     def addCaseFooter(self):
         if self.stepCount-1 > 0 :
             previousStep = " "+str(self.CurrentTestCaseNumber)+"."+str(self.stepCount-1)+": "+ str(self.stepName) + ""
             stepHeader = "\n"+"*" * 40+"\nEnd of Step "+previousStep+"\n"+"*" * 40+"\n"
-            
+
         caseFooter = "\n"+"*" * 40+"\nEnd of Test case "+str(self.CurrentTestCaseNumber)+"\n"+"*" * 40+"\n"
-            
+
         for driver in self.driversList:
             vars(self)[driver].write(stepHeader+"\n"+caseFooter)
 
@@ -289,7 +308,6 @@
 
         #self.reportFile.close()
 
-
         #utilities.send_mail()
         for component in self.componentDictionary.keys():
             try :
@@ -314,12 +332,11 @@
         This function will pause the test's execution, and will continue after user provide 'resume' command.
         '''
         __builtin__.testthread.pause()
-    
+
     def onfail(self,*components):
         '''
-        When test step failed, calling all the components onfail. 
+        When test step failed, calling all the components onfail.
         '''
-         
         if not components:
             try :
                 for component in self.componentDictionary.keys():
@@ -328,7 +345,6 @@
             except(Exception),e:
                 print str(e)
                 result = self.FALSE
-                
         else:
             try :
                 for component in components:
@@ -337,8 +353,7 @@
             except(Exception),e:
                 print str(e)
                 result = self.FALSE
-    
-    
+
     def getDriverPath(self,driverName):
         '''
            Based on the component 'type' specified in the params , this method will find the absolute path ,
@@ -348,23 +363,22 @@
 
         cmd = "find "+drivers_path+" -name "+driverName+".py"
         result = commands.getoutput(cmd)
-        
+
         result_array = str(result).split('\n')
         result_count = 0
-        
+
         for drivers_list in result_array:
             result_count = result_count+1
         if result_count > 1 :
             print "found "+driverName+" "+ str(result_count) + "  times"+str(result_array)
             self.exit()
-            
+
         result = re.sub("(.*)drivers","",result)
         result = re.sub("\.py","",result)
         result = re.sub("\.pyc","",result)
         result = re.sub("\/",".",result)
         result = "drivers"+result
         return result
-    
 
     def step(self,stepDesc):
         '''
@@ -379,16 +393,16 @@
                 stepName = " INIT : Initializing the test case :"+self.CurrentTestCase
         except AttributeError:
                 stepName = " INIT : Initializing the test case :"+str(self.CurrentTestCaseNumber)
-            
+
         self.log.step(stepName)
         stepHeader = ""
         if self.stepCount > 1 :
             stepHeader = "\n"+"-"*45+"\nEnd of Step "+previousStep+"\n"+"-"*45+"\n"
-        
+
         stepHeader += "\n"+"-"*45+"\nStart of Step"+stepName+"\n"+"-"*45+"\n"
         for driver in self.componentDictionary.keys():
             vars(self)[driver+'log'].info(stepHeader)
-            
+
     def case(self,testCaseName):
         '''
            Test's each test-case information will append to the logs.
@@ -399,14 +413,14 @@
         caseHeader = testCaseName+"\n"+"*" * 40+"\n"
         for driver in self.componentDictionary.keys():
             vars(self)[driver+'log'].info(caseHeader)
-        
+
     def testDesc(self,description):
         '''
            Test description will append to the logs.
         '''
         description = "Test Description : " + str (description) + ""
         self.log.info(description)
-        
+
     def _getTest(self):
         '''
            This method will parse the test script to find required test information.
@@ -422,17 +436,15 @@
             if lineMatch:
                 counter  = counter + 1
                 self.TC_PLANNED = len(self.testcases_list)
-        
-                
+
     def response_parser(self,response, return_format):
         ''' It will load the default response parser '''
         response_dict = {}
         response_dict = self.response_to_dict(response, return_format)
         return_format_string = self.dict_to_return_format(response,return_format,response_dict)
         return return_format_string
-    
+
     def response_to_dict(self,response,return_format):
-        
         response_dict = {}
         json_match = re.search('^\s*{', response)
         xml_match = re.search('^\s*\<', response)
@@ -440,12 +452,10 @@
         if json_match :
             self.log.info(" Response is in 'JSON' format and Converting to '"+return_format+"' format")
             # Formatting the json string
-            
             response = re.sub(r"{\s*'?(\w)", r'{"\1', response)
             response = re.sub(r",\s*'?(\w)", r',"\1', response)
             response = re.sub(r"(\w)'?\s*:", r'\1":', response)
             response = re.sub(r":\s*'(\w)'\s*([,}])", r':"\1"\2', response)
-            
             try :
                 import json
                 response_dict = json.loads(response)
@@ -453,7 +463,6 @@
                 self.log.exception( e )
                 self.log.error("Json Parser is unable to parse the string")
             return response_dict
-        
         elif ini_match :
             self.log.info(" Response is in 'INI' format and Converting to '"+return_format+"' format")
             from configobj import ConfigObj
@@ -462,7 +471,6 @@
             response_file.close()
             response_dict = ConfigObj("respnse_file.temp")
             return response_dict
-            
         elif xml_match :
             self.log.info(" Response is in 'XML' format and Converting to '"+return_format+"' format")
             try :
@@ -470,16 +478,15 @@
             except Exception, e:
                 self.log.exception( e )
             return response_dict
-        
+
     def dict_to_return_format(self,response,return_format,response_dict):
-        
         if return_format =='table' :
             ''' Will return in table format'''
             to_do = "Call the table output formatter"
             global response_table
             response_table = '\n'
             response_table = response_table +'\t'.join(response_dict)+"\n"
-            
+
             def get_table(value_to_convert):
                 ''' This will parse the dictionary recusrsively and print as table format'''
                 table_data = ""
@@ -490,16 +497,12 @@
                 else :
                     table_data = table_data + str(value_to_convert) +"\t"
                 return table_data
-            
+
             for value in response_dict.values() :
                 response_table =  response_table + get_table(value)
-                
-
-                
             # response_table = response_table + '\t'.join(response_dict.values())
-                
             return response_table
-        
+
         elif return_format =='config':
             ''' Will return in config format'''
             to_do = 'Call dict to config coverter'
@@ -511,24 +514,22 @@
             response_config = re.sub("}", "\n", response_config)
             response_config = re.sub(":", " =", response_config)
             return "[response]\n\t "+response_config
-            
         elif return_format == 'xml':
             ''' Will return in xml format'''
             response_xml = xmldict.dict_to_xml(response_dict)
             response_xml = re.sub(">\s*<", ">\n<", response_xml)
             return "\n"+response_xml
-        
         elif return_format == 'json':
             ''' Will return in json format'''
             to_do = 'Call dict to xml coverter'
             import json
             response_json = json.dumps(response_dict)
             return response_json
-    
+
     def get_random(self):
         self.random_order = self.random_order + 1
         return self.random_order
-        
+
     def exit(self):
         __builtin__.testthread = None
         sys.exit()
@@ -567,14 +568,14 @@
         main.testDir = path+'/examples/'
         main.tests_path = path+"/examples/"
         main.classPath = "examples."+main.TEST+"."+main.TEST
-               
+
 def verifyLogdir(options):
     # Verifying Log directory option
     if options.logdir:
         main.logdir = options.logdir
     else :
         main.logdir = main.FALSE
-        
+
 def verifyMail(options):
     # Checking the mailing list
     if options.mail:
@@ -611,7 +612,7 @@
         else :
             print "testcases not specifed in params, please provide in params file or 'testcases' commandline argument"
             sys.exit()
-                  
+
 def verifyTestScript(options):
     '''
     Verifyies test script.
@@ -627,7 +628,6 @@
         print "\nThere is no :\""+main.TEST+"\" test, Please Provide OpenSpeak Script/ test script"
         __builtin__.testthread = None
         main.exit()
-              
     try :
         testModule = __import__(main.classPath, globals(), locals(), [main.TEST], -1)
     except(ImportError):
@@ -639,20 +639,19 @@
     load_parser()
     main.params = main.parser.parseParams(main.classPath)
     main.topology = main.parser.parseTopology(main.classPath)
-    
+
 def verifyParams():
     try :
         main.params = main.params['PARAMS']
     except(KeyError):
         print "Error with the params file: Either the file not specified or the format is not correct"
         main.exit()
-    
     try :
         main.topology = main.topology['TOPOLOGY']
     except(KeyError):
         print "Error with the Topology file: Either the file not specified or the format is not correct"
         main.exit()
-        
+
 def load_parser() :
     '''
     It facilitates the loading customised parser for topology and params file.
@@ -674,11 +673,9 @@
                     main.parser = parsingClass()
                     #hashobj = main.parser.parseParams(main.classPath)
                     if hasattr(main.parser,"parseParams") and hasattr(main.parser,"parseTopology") and hasattr(main.parser,"parse") :
-                        
                         pass
                     else:
                         main.exit()
-
                 except ImportError:
                     print sys.exc_info()[1]
                     main.exit()
@@ -709,7 +706,6 @@
     except ImportError:
         print sys.exc_info()[1]
 
-
 def load_logger() :
     '''
     It facilitates the loading customised parser for topology and params file.
@@ -773,8 +769,5 @@
         print sys.exc_info()[1]
         main.exit()
 
-
-
-
 def _echo(self):
     print "THIS IS ECHO"
diff --git a/TestON/tests/IpOptical/IpOptical.py b/TestON/tests/IpOptical/IpOptical.py
index c290ac9..af88686 100644
--- a/TestON/tests/IpOptical/IpOptical.py
+++ b/TestON/tests/IpOptical/IpOptical.py
@@ -555,7 +555,7 @@
         flows = main.ONOS2.flows()
         main.log.info( flows )
 
-        case10Result = step1Result 
+        case10Result = step1Result
         utilities.assert_equals(
             expect=main.TRUE,
             actual=case10Result,
@@ -571,7 +571,7 @@
         main.log.report( "Adding host intents between 2 optical layer host" )
         main.case( "Test add host intents between optical layer host" )
 
-        main.log.step( "Discover host using arping" )
+        main.step( "Discover host using arping" )
         step1Result = main.TRUE
         main.hostMACs = []
         main.hostId = []
@@ -597,7 +597,7 @@
             onpass="Hosts discovered",
             onfail="Failed to discover hosts")
 
-        main.log.step( "Adding host intents to h1 and h2" )
+        main.step( "Adding host intents to h1 and h2" )
         step2Result = main.TRUE
         intentsId = []
         intent1 = main.ONOS3.addHostIntent( hostIdOne = host1,
@@ -622,19 +622,40 @@
                                         "INSTALLED state " )
 
         # pinging h1 to h2 and then ping h2 to h1
-        main.log.step( "Pinging h1 and h2" )
+        main.step( "Pinging h1 and h2" )
         step3Result = main.TRUE
         pingResult = main.TRUE
         pingResult = main.LincOE2.pingHostOptical( src="h1", target="h2" )
         pingResult = pingResult and main.LincOE2.pingHostOptical( src="h2",
                                                                   target="h1" )
-        step2Result = pingResult
+        step3Result = pingResult
         utilities.assert_equals( expect=main.TRUE,
-                                 actual=step2Result,
+                                 actual=step3Result,
                                  onpass="Pinged successfully between h1 and h2",
                                  onfail="Pinged failed between h1 and h2" )
-
-        case25Result = step1Result and step2Result and step3Result
-        utilities.assert_equals( expect=main.TRUE, actual=case25Result,
+        # Removed all added host intents
+        main.step( "Removing host intents" )
+        step4Result = main.TRUE
+        removeResult = main.TRUE
+        # Check remaining intents
+        intentsJson = json.loads( main.ONOS3.intents() )
+        main.ONOS3.removeIntent( intentId=intent1, purge=True )
+        main.ONOS3.removeIntent( intentId=intent2, purge=True )
+        for intents in intentsJson:
+            main.ONOS3.removeIntent( intentId=intents.get( 'id' ),
+                                     app='org.onosproject.optical',
+                                     purge=True )
+        print json.loads( main.ONOS3.intents() )
+        if len( json.loads( main.ONOS3.intents() ) ):
+            removeResult = main.FALSE
+        step4Result = removeResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=step4Result,
+                                 onpass="Successfully removed host intents",
+                                 onfail="Failed to remove host intents" )
+        case25Result = step1Result and step2Result and step3Result and \
+                       step4Result
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=case25Result,
                                  onpass="Add host intent successful",
                                  onfail="Add host intent failed" )
diff --git a/TestON/tests/IpOpticalMulti/IpOpticalMulti.params b/TestON/tests/IpOpticalMulti/IpOpticalMulti.params
index f3fa343..2aa477d 100755
--- a/TestON/tests/IpOpticalMulti/IpOpticalMulti.params
+++ b/TestON/tests/IpOpticalMulti/IpOpticalMulti.params
@@ -1,6 +1,6 @@
 <PARAMS>
     
-    <testcases>1,21,22,25,10,23,24</testcases>
+    <testcases>20,21,22,25,10,23,24</testcases>
     #Environment variables
     <ENV>
         <cellName>multi_test</cellName>
diff --git a/TestON/tests/IpOpticalMulti/IpOpticalMulti.py b/TestON/tests/IpOpticalMulti/IpOpticalMulti.py
index d00410f..31a4cfb 100644
--- a/TestON/tests/IpOpticalMulti/IpOpticalMulti.py
+++ b/TestON/tests/IpOpticalMulti/IpOpticalMulti.py
@@ -113,39 +113,12 @@
                                 onpass="Test startup successful",
                                 onfail="Test startup NOT successful" )
 
-    def CASE10( self ):
-        import time
-        main.log.report(
-            "This testcase uninstalls the reactive forwarding app" )
-        main.log.report( "__________________________________" )
-        main.case( "Uninstalling reactive forwarding app" )
-        # Unistall onos-app-fwd app to disable reactive forwarding
-        appInstallResult = main.ONOScli1.deactivateApp( "org.onosproject.fwd" )
-        appCheck = main.ONOScli1.appToIDCheck()
-        if appCheck != main.TRUE:
-            main.log.warn( main.ONOScli1.apps() )
-            main.log.warn( main.ONOScli1.appIDs() )
-        main.log.info( "onos-app-fwd uninstalled" )
-
-        # After reactive forwarding is disabled,
-        # the reactive flows on switches timeout in 10-15s
-        # So sleep for 15s
-        time.sleep( 15 )
-
-        hosts = main.ONOScli1.hosts()
-        main.log.info( hosts )
-        case10Result = appInstallResult
-        utilities.assertEquals(
-            expect=main.TRUE,
-            actual=case10Result,
-            onpass="Reactive forwarding app uninstallation successful",
-            onfail="Reactive forwarding app uninstallation failed" )
-
     def CASE20( self ):
         """
             Exit from mininet cli
             reinstall ONOS
         """
+        import time
         cellName = main.params[ 'ENV' ][ 'cellName' ]
         ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
         ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
@@ -154,23 +127,61 @@
         ONOS2Port = main.params[ 'CTRL' ][ 'port2' ]
         ONOS3Port = main.params[ 'CTRL' ][ 'port3' ]
 
+
         main.log.report( "This testcase exits the mininet cli and reinstalls" +
                          "ONOS to switch over to Packet Optical topology" )
         main.log.report( "_____________________________________________" )
         main.case( "Disconnecting mininet and restarting ONOS" )
+
         main.step( "Disconnecting mininet and restarting ONOS" )
+        step1Result = main.TRUE
         mininetDisconnect = main.Mininet1.disconnect()
         print "mininetDisconnect = ", mininetDisconnect
-
-        main.step( "Removing raft logs before a clen installation of ONOS" )
-        main.ONOSbench.onosRemoveRaftLogs()
-
+        step1Result = mininetDisconnect
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Mininet disconnect successfully",
+            onfail="Mininet failed to disconnect")
+        """
+        main.step( "Removing raft logs before a clean installation of ONOS" )
+        step2Result = main.TRUE
+        removeRaftLogsResult = main.ONOSbench.onosRemoveRaftLogs()
+        step2Result = removeRaftLogsResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Raft logs removed successfully",
+            onfail="Failed to remove raft logs")
+        """
         main.step( "Applying cell variable to environment" )
-        cellResult = main.ONOSbench.setCell( cellName )
-        verifyResult = main.ONOSbench.verifyCell()
+        step3Result = main.TRUE
+        setCellResult = main.ONOSbench.setCell( cellName )
+        verifyCellResult = main.ONOSbench.verifyCell()
+        step3Result = setCellResult and verifyCellResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step3Result,
+            onpass="Cell applied successfully",
+            onfail="Failed to apply cell")
 
+        main.step( "Uninstalling ONOS package" )
+        step4Result = main.TRUE
+        onos1UninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOS1Ip)
+        onos2UninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOS2Ip)
+        onos3UninstallResult = main.ONOSbench.onosUninstall( nodeIp = ONOS3Ip)
+        onosUninstallResult = onos1UninstallResult and onos2UninstallResult \
+                              and onos3UninstallResult
+        step4Result = onosUninstallResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step4Result,
+            onpass="Successfully uninstalled ONOS",
+            onfail="Failed to uninstall ONOS")
 
+        time.sleep( 5 )
         main.step( "Installing ONOS package" )
+        step5Result = main.TRUE
         onos1InstallResult = main.ONOSbench.onosInstall(
             options="-f",
             node=ONOS1Ip )
@@ -182,32 +193,48 @@
             node=ONOS3Ip )
         onosInstallResult = onos1InstallResult and onos2InstallResult and\
                 onos3InstallResult
-        if onosInstallResult == main.TRUE:
-            main.log.report( "Installing ONOS package successful" )
-        else:
-            main.log.report( "Installing ONOS package failed" )
 
         onos1Isup = main.ONOSbench.isup( ONOS1Ip )
         onos2Isup = main.ONOSbench.isup( ONOS2Ip )
         onos3Isup = main.ONOSbench.isup( ONOS3Ip )
-        onosIsup = onos1Isup and onos2Isup and onos3Isup
-        if onosIsup == main.TRUE:
+        onosIsUp = onos1Isup and onos2Isup and onos3Isup
+        if onosIsUp == main.TRUE:
             main.log.report( "ONOS instances are up and ready" )
         else:
             main.log.report( "ONOS instances may not be up" )
+        step5Result = onosInstallResult and onosIsUp
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step5Result,
+            onpass="Successfully installed ONOS",
+            onfail="Failed to install ONOS")
 
         main.step( "Starting ONOS service" )
-        startResult = main.TRUE
-        # startResult = main.ONOSbench.onosStart( ONOS1Ip )
+        step6Result = main.TRUE
+        startResult = main.ONOSbench.onosStart( ONOS1Ip )
+        step6Result = startResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step6Result,
+            onpass="Successfully started ONOS",
+            onfail="Failed to start ONOS")
+
+        main.step( "Starting ONOS cli" )
+        step7Result = main.TRUE
         startcli1 = main.ONOScli1.startOnosCli( ONOSIp=ONOS1Ip )
         startcli2 = main.ONOScli2.startOnosCli( ONOSIp=ONOS2Ip )
         startcli3 = main.ONOScli3.startOnosCli( ONOSIp=ONOS3Ip )
         startResult = startcli1 and startcli2 and startcli3
-        if startResult == main.TRUE:
-            main.log.report( "ONOS cli starts properly" )
-        case20Result = mininetDisconnect and cellResult and verifyResult \
-            and onosInstallResult and onosIsup and startResult
+        step7Result = startResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step7Result,
+            onpass="Successfully started ONOS cli",
+            onfail="Failed to start ONOS cli")
 
+        case20Result = step1Result and step3Result and\
+                       step4Result and step5Result and step6Result and\
+                       step7Result
         utilities.assert_equals(
             expect=main.TRUE,
             actual=case20Result,
@@ -219,32 +246,46 @@
     def CASE21( self, main ):
         """
             On ONOS bench, run this command:
-            sudo -E python ~/onos/tools/test/topos/opticalTest.py -OC1 <Ctrls>
+            sudo -E python ~/onos/tools/test/topos/opticalTest.py -OC1
             which spawns packet optical topology and copies the links
             json file to the onos instance.
             Note that in case of Packet Optical, the links are not learnt
             from the topology, instead the links are learnt
             from the json config file
         """
+        import time
         main.log.report(
             "This testcase starts the packet layer topology and REST" )
         main.log.report( "_____________________________________________" )
         main.case( "Starting LINC-OE and other components" )
-        main.step( "Starting LINC-OE and other components" )
-        main.log.info( "Activate optical app" )
-        appInstallResult = main.ONOScli1.activateApp( "org.onosproject.optical" )
-        appCheck = main.ONOScli1.appToIDCheck()
-        appCheck = appCheck and main.ONOScli2.appToIDCheck()
-        appCheck = appCheck and main.ONOScli3.appToIDCheck()
-        if appCheck != main.TRUE:
-            main.log.warn( "Checking ONOS application unsuccesful" )
 
-        ctrllerIP = []
-        ctrllerIP.append( main.params[ 'CTRL' ][ 'ip1' ] )
-        #ctrllerIP.append( main.params[ 'CTRL' ][ 'ip2' ] )
-        #ctrllerIP.append( main.params[ 'CTRL' ][ 'ip3' ] )
-        opticalMnScript = main.LincOE2.runOpticalMnScript( ctrllerIP = ctrllerIP )
-        case21Result = opticalMnScript and appInstallResult
+        main.step( "Activate optical app" )
+        step1Result = main.TRUE
+        activateOpticalResult = main.ONOScli2.activateApp( "org.onosproject.optical" )
+        step1Result = activateOpticalResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully activated optical app",
+            onfail="Failed to activate optical app")
+
+        appCheck = main.ONOScli2.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOScli2.apps() )
+            main.log.warn( main.ONOScli2.appIDs() )
+
+        main.step( "Starting mininet and LINC-OE" )
+        step2Result = main.TRUE
+        time.sleep( 10 )
+        opticalMnScript = main.LincOE2.runOpticalMnScript(ctrllerIP = main.params[ 'CTRL' ][ 'ip1' ])
+        step2Result = opticalMnScript
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Started the topology successfully ",
+            onfail="Failed to start the topology")
+
+        case21Result = step1Result and step2Result
         utilities.assert_equals(
             expect=main.TRUE,
             actual=case21Result,
@@ -261,14 +302,27 @@
             All this is hardcoded in the testcase. If the topology changes,
             these hardcoded values need to be changed
         """
+        import time
         main.log.report(
             "This testcase compares the optical+packet topology against what" +
             " is expected" )
         main.case( "Topology comparision" )
-        main.step( "Topology comparision" )
-        devicesResult = main.ONOScli3.devices( jsonFormat=False )
 
-        print "devices_result = ", devicesResult
+        main.step( "Starts new ONOS cli" )
+        step1Result = main.TRUE
+        cliResult = main.ONOScli1.startOnosCli( ONOSIp=main.params[ 'CTRL' ]\
+                                                               [ 'ip1' ] )
+        step1Result = cliResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully starts a new cli",
+            onfail="Failed to start new cli" )
+
+        main.step( "Compare topology" )
+        step2Result = main.TRUE
+        devicesResult = main.ONOScli1.devices( jsonFormat=False )
+        print "devices_result :\n", devicesResult
         devicesLinewise = devicesResult.split( "\n" )
         roadmCount = 0
         packetLayerSWCount = 0
@@ -295,7 +349,6 @@
                 str( roadmCount ) +
                 " and is wrong" )
             opticalSWResult = main.FALSE
-
         if packetLayerSWCount == 6:
             print "Number of Packet layer or mininet Switches = %d "\
                     % packetLayerSWCount + "and is correctly detected"
@@ -312,12 +365,13 @@
                 str( packetLayerSWCount ) +
                 " and is wrong" )
             packetSWResult = main.FALSE
+        # sleeps for sometime so the state of the switches will be active
+        time.sleep( 30 )
         print "_________________________________"
-
-        linksResult = main.ONOScli3.links( jsonFormat=False )
+        linksResult = main.ONOScli1.links( jsonFormat=False )
         print "links_result = ", linksResult
         print "_________________________________"
-        linkActiveCount = linksResult.count("state=ACTIVE") 
+        linkActiveCount = linksResult.count("state=ACTIVE")
         main.log.info( "linkActiveCount = " + str( linkActiveCount ))
         if linkActiveCount == 42:
             linkActiveResult = main.TRUE
@@ -327,11 +381,18 @@
             linkActiveResult = main.FALSE
             main.log.info(
                 "Number of links in ACTIVE state are wrong")
-
-        case22Result = opticalSWResult and packetSWResult and \
+        step2Result = opticalSWResult and packetSWResult and \
                         linkActiveResult
         utilities.assert_equals(
             expect=main.TRUE,
+            actual=step2Result,
+            onpass="Successfully loaded packet optical topology",
+            onfail="Failed to load packet optical topology" )
+
+        case22Result = step1Result and step2Result
+
+        utilities.assert_equals(
+            expect=main.TRUE,
             actual=case22Result,
             onpass="Packet optical topology discovery successful",
             onfail="Packet optical topology discovery failed" )
@@ -346,83 +407,65 @@
         main.log.report(
             "This testcase adds bidirectional point intents between 2 " +
             "packet layer( mininet ) devices and ping mininet hosts" )
-        main.case( "Topology comparision" )
+        main.case( "Install point intents between 2 packet layer device and " +
+                   "ping the hosts" )
+
         main.step( "Adding point intents" )
-        ptpIntentResult = main.ONOScli1.addPointIntent(
+        step1Result = main.TRUE
+        intentsId = []
+        pIntent1 = main.ONOScli1.addPointIntent(
             "of:0000ffffffff0001/1",
             "of:0000ffffffff0005/1" )
-        if ptpIntentResult == main.TRUE:
-            main.ONOScli1.intents( jsonFormat=False )
-            main.log.info( "Point to point intent install successful" )
-
-        ptpIntentResult = main.ONOScli1.addPointIntent(
+        pIntent2 = main.ONOScli1.addPointIntent(
             "of:0000ffffffff0005/1",
             "of:0000ffffffff0001/1" )
-        if ptpIntentResult == main.TRUE:
-            main.ONOScli1.intents( jsonFormat=False )
-            main.log.info( "Point to point intent install successful" )
-
+        intentsId.append( pIntent1 )
+        intentsId.append( pIntent2 )
+        main.log.info( "Checking intents state")
+        checkStateResult = main.ONOScli1.checkIntentState( intentsId = intentsId )
         time.sleep( 30 )
-        flowHandle = main.ONOScli1.flows()
-        main.log.info( "flows :" + flowHandle )
-
+        main.log.info( "Checking flows state")
+        checkFlowResult = main.ONOScli1.checkFlowsState()
         # Sleep for 30 seconds to provide time for the intent state to change
-        time.sleep( 60 )
-        intentHandle = main.ONOScli1.intents( jsonFormat=False )
-        main.log.info( "intents :" + intentHandle )
+        time.sleep( 30 )
+        main.log.info( "Checking intents state one more time")
+        checkStateResult = main.ONOScli1.checkIntentState( intentsId = intentsId )
+        step1Result = checkStateResult and checkFlowResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully added point intents",
+            onfail="Failed to add point intents")
 
-        PingResult = main.TRUE
-        count = 1
+        main.step( "Ping h1 and h5" )
+        step2Result = main.TRUE
         main.log.info( "\n\nh1 is Pinging h5" )
-        ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
-        # ping = main.LincOE2.pinghost()
-        if ping == main.FALSE and count < 5:
-            count += 1
-            PingResult = main.FALSE
-            main.log.info(
-                "Ping between h1 and h5  failed. Making attempt number " +
-                str( count ) +
-                " in 2 seconds" )
-            time.sleep( 2 )
-        elif ping == main.FALSE:
-            main.log.info( "All ping attempts between h1 and h5 have failed" )
-            PingResult = main.FALSE
-        elif ping == main.TRUE:
-            main.log.info( "Ping test between h1 and h5 passed!" )
-            PingResult = main.TRUE
-        else:
-            main.log.info( "Unknown error" )
-            PingResult = main.ERROR
+        pingResult = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+        step2Result = pingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Successfully pinged h1 and h5",
+            onfail="Failed to ping between h1 and h5")
 
-        if PingResult == main.FALSE:
-            main.log.report(
-                "Point intents for packet optical have not ben installed" +
-                " correctly. Cleaning up" )
-        if PingResult == main.TRUE:
-            main.log.report(
-                "Point Intents for packet optical have been " +
-                "installed correctly" )
-
-        case23Result = PingResult
+        case23Result = step1Result and step2Result
         utilities.assert_equals(
             expect=main.TRUE,
             actual=case23Result,
-            onpass= "Point intents addition for packet optical and" +
-                    "Pingall Test successful",
-            onfail= "Point intents addition for packet optical and" +
-                    "Pingall Test NOT successful" )
+            onpass="Point intents are installed properly",
+            onfail="Failed to install point intents" )
 
     def CASE24( self, main ):
         import time
         import json
         """
             LINC uses its own switch IDs. You can use the following
-            command on the LINC console to find the mapping between
+            command on the LINC console to find the mapping between 
             DPIDs and LINC IDs.
             rp(application:get_all_key(linc)).
-
+            
             Test Rerouting of Packet Optical by bringing a port down
-            ( port 20 ) of a switch( switchID=1, or LincOE switchID =9 ),
+            ( port 20 ) of a switch( switchID=1, or LincOE switchID =9 ), 
             so that link
             ( between switch1 port20 - switch5 port50 ) is inactive
             and do a ping test. If rerouting is successful,
@@ -431,16 +474,23 @@
         main.log.report(
             "This testcase tests rerouting and pings mininet hosts" )
         main.case( "Test rerouting and pings mininet hosts" )
+
         main.step( "Attach to the Linc-OE session" )
+        step1Result = main.TRUE
         attachConsole = main.LincOE1.attachLincOESession()
-        print "attachConsole = ", attachConsole
+        step1Result = attachConsole
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully attached Linc-OE session",
+            onfail="Failed to attached Linc-OE session")
 
         main.step( "Bring a port down and verify the link state" )
+        step2Result = main.TRUE
         main.LincOE1.portDown( swId="9", ptId="20" )
-        linksNonjson = main.ONOScli3.links( jsonFormat=False )
+        linksNonjson = main.ONOScli1.links( jsonFormat=False )
         main.log.info( "links = " + linksNonjson )
-
-        linkInactiveCount = linksNonjson.count("state=INACTIVE")
+        linkInactiveCount = linksNonjson.count( "state=INACTIVE" )
         main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
         if linkInactiveCount == 2:
             main.log.info(
@@ -448,10 +498,8 @@
         else:
             main.log.info(
                 "Number of links in INACTIVE state are wrong")
-        
-        links = main.ONOScli3.links()
+        links = main.ONOScli1.links()
         main.log.info( "links = " + links )
-
         linksResult = json.loads( links )
         linksStateResult = main.FALSE
         for item in linksResult:
@@ -475,53 +523,98 @@
                         main.log.report(
                             "Links state is not inactive as expected" )
                         linksStateResult = main.FALSE
-
-        print "links_state_result = ", linksStateResult
         time.sleep( 10 )
-        flowHandle = main.ONOScli3.flows()
-        main.log.info( "flows :" + flowHandle )
+        checkFlowsState = main.ONOScli1.checkFlowsState()
+        step2Result = linksStateResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step2Result,
+            onpass="Successfuly brought down a link",
+            onfail="Failed to bring down a link")
 
         main.step( "Verify Rerouting by a ping test" )
-        PingResult = main.TRUE
-        count = 1
+        step3Result = main.TRUE
         main.log.info( "\n\nh1 is Pinging h5" )
-        ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
-        # ping = main.LincOE2.pinghost()
-        if ping == main.FALSE and count < 5:
-            count += 1
-            PingResult = main.FALSE
+        pingResult = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+        step3Result = pingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step3Result,
+            onpass="Successfully pinged h1 and h5",
+            onfail="Failed to ping between h1 and h5")
+
+        main.step( "Bring the downed port up and verify the link state" )
+        step4Result = main.TRUE
+        main.LincOE1.portUp( swId="9", ptId="20" )
+        linksNonjson = main.ONOScli1.links( jsonFormat=False )
+        main.log.info( "links = " + linksNonjson )
+        linkInactiveCount = linksNonjson.count( "state=INACTIVE" )
+        main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+        if linkInactiveCount == 0:
             main.log.info(
-                "Ping between h1 and h5  failed. Making attempt number " +
-                str( count ) +
-                " in 2 seconds" )
-            time.sleep( 2 )
-        elif ping == main.FALSE:
-            main.log.info( "All ping attempts between h1 and h5 have failed" )
-            PingResult = main.FALSE
-        elif ping == main.TRUE:
-            main.log.info( "Ping test between h1 and h5 passed!" )
-            PingResult = main.TRUE
+                "Number of links in INACTIVE state are correct")
         else:
-            main.log.info( "Unknown error" )
-            PingResult = main.ERROR
+            main.log.info(
+                "Number of links in INACTIVE state are wrong")
+            step4Result = main.FALSE
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step4Result,
+            onpass="Successfully brought the port up",
+            onfail="Failed to bring the port up")
 
-        if PingResult == main.TRUE:
-            main.log.report( "Ping test successful " )
-        if PingResult == main.FALSE:
-            main.log.report( "Ping test failed" )
-
-        case24Result = PingResult and linksStateResult
-        utilities.assert_equals( expect=main.TRUE, actual=case24Result,
+        case24Result = step1Result and step2Result and step3Result \
+                       and step4Result
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=case24Result,
                                  onpass="Packet optical rerouting successful",
                                  onfail="Packet optical rerouting failed" )
 
+    def CASE10( self ):
+        main.log.report(
+            "This testcase uninstalls the reactive forwarding app" )
+        main.log.report( "__________________________________" )
+        main.case( "Uninstalling reactive forwarding app" )
+        main.step( "Uninstalling reactive forwarding app" )
+        step1Result = main.TRUE
+        # Unistall onos-app-fwd app to disable reactive forwarding
+        main.log.info( "deactivate reactive forwarding app" )
+        appUninstallResult = main.ONOScli2.deactivateApp( "org.onosproject.fwd" )
+        appCheck = main.ONOScli2.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOScli2.apps() )
+            main.log.warn( main.ONOScli2.appIDs() )
+        step1Result = appUninstallResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Successfully deactivate reactive forwarding app",
+            onfail="Failed to deactivate reactive forwarding app")
+        # After reactive forwarding is disabled, the reactive flows on
+        # switches timeout in 10-15s
+        # So sleep for 15s
+        time.sleep( 15 )
+        flows = main.ONOScli2.flows()
+        main.log.info( flows )
+
+        case10Result = step1Result
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case10Result,
+            onpass="Reactive forwarding app uninstallation successful",
+            onfail="Reactive forwarding app uninstallation failed" )
+
     def CASE25( self ):
         """
             Add host intents between 2 packet layer host
         """
         import time
         import json
-        main.log.report( "Adding host intents between 2 packet layer host" )
+        main.log.report( "Adding host intents between 2 optical layer host" )
+        main.case( "Test add host intents between optical layer host" )
+
+        main.step( "Discover host using arping" )
+        step1Result = main.TRUE
         main.hostMACs = []
         main.hostId = []
         #Listing host MAC addresses
@@ -530,15 +623,25 @@
                                 str( hex( i )[ 2: ] ).zfill( 2 ).upper() )
         for macs in main.hostMACs:
             main.hostId.append( macs + "/-1" )
-
         host1 = main.hostId[ 0 ]
         host2 = main.hostId[ 1 ]
-        intentsId = []
         # Use arping to discover the hosts
         main.LincOE2.arping( host = "h1" )
         main.LincOE2.arping( host = "h2" )
+        time.sleep( 5 )
+        hostsDict = main.ONOScli1.hosts()
+        if not len( hostsDict ):
+            step1Result = main.FALSE
         # Adding host intent
-        main.log.step( "Adding host intents to h1 and h2" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=step1Result,
+            onpass="Hosts discovered",
+            onfail="Failed to discover hosts")
+
+        main.step( "Adding host intents to h1 and h2" )
+        step2Result = main.TRUE
+        intentsId = []
         intent1 = main.ONOScli1.addHostIntent( hostIdOne = host1,
                                             hostIdTwo = host2 )
         intentsId.append( intent1 )
@@ -547,26 +650,54 @@
                                             hostIdTwo = host1 )
         intentsId.append( intent2 )
         # Checking intents state before pinging
-        main.log.step( "Checking intents state" )
-        time.sleep( 10 )
+        main.log.info( "Checking intents state" )
+        time.sleep( 30 )
         intentResult = main.ONOScli1.checkIntentState( intentsId = intentsId )
-        utilities.assert_equals( expect=main.TRUE, actual=intentResult,
+        #check intent state again if intents are not in installed state
+        if not intentResult:
+           intentResult = main.ONOScli1.checkIntentState( intentsId = intentsId )
+        step2Result = intentResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=step2Result,
                                  onpass="All intents are in INSTALLED state ",
                                  onfail="Some of the intents are not in " +
                                         "INSTALLED state " )
 
         # pinging h1 to h2 and then ping h2 to h1
-        main.log.step( "Pinging h1 and h2" )
+        main.step( "Pinging h1 and h2" )
+        step3Result = main.TRUE
         pingResult = main.TRUE
         pingResult = main.LincOE2.pingHostOptical( src="h1", target="h2" )
         pingResult = pingResult and main.LincOE2.pingHostOptical( src="h2",
                                                                   target="h1" )
-
-        utilities.assert_equals( expect=main.TRUE, actual=pingResult,
+        step3Result = pingResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=step3Result,
                                  onpass="Pinged successfully between h1 and h2",
                                  onfail="Pinged failed between h1 and h2" )
-
-        case25Result = pingResult
-        utilities.assert_equals( expect=main.TRUE, actual=case25Result,
+        # Removed all added host intents
+        main.step( "Removing host intents" )
+        step4Result = main.TRUE
+        removeResult = main.TRUE
+        # Check remaining intents
+        intentsJson = json.loads( main.ONOScli1.intents() )
+        main.ONOScli1.removeIntent( intentId=intent1, purge=True )
+        main.ONOScli1.removeIntent( intentId=intent2, purge=True )
+        for intents in intentsJson:
+            main.ONOScli1.removeIntent( intentId=intents.get( 'id' ),
+                                     app='org.onosproject.optical',
+                                     purge=True )
+        print json.loads( main.ONOScli1.intents() )
+        if len( json.loads( main.ONOScli1.intents() ) ):
+            removeResult = main.FALSE
+        step4Result = removeResult
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=step4Result,
+                                 onpass="Successfully removed host intents",
+                                 onfail="Failed to remove host intents" )
+        case25Result = step1Result and step2Result and step3Result and \
+                       step4Result
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=case25Result,
                                  onpass="Add host intent successful",
                                  onfail="Add host intent failed" )
diff --git a/TestON/tests/IpOpticalMulti/IpOpticalMultiOld.py b/TestON/tests/IpOpticalMulti/IpOpticalMultiOld.py
new file mode 100644
index 0000000..d00410f
--- /dev/null
+++ b/TestON/tests/IpOpticalMulti/IpOpticalMultiOld.py
@@ -0,0 +1,572 @@
+
+# Testing the basic functionality of ONOS Next
+# For sanity and driver functionality excercises only.
+
+import time
+import sys
+import os
+import re
+import time
+import json
+
+time.sleep( 1 )
+
+class IpOpticalMulti:
+
+    def __init__( self ):
+        self.default = ''
+
+    def CASE1( self, main ):
+        """
+        Startup sequence:
+        cell <name>
+        onos-verify-cell
+        onos-remove-raft-logs
+        git pull
+        mvn clean install
+        onos-package
+        onos-install -f
+        onos-wait-for-start
+        """
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
+        ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
+        ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
+        ONOS2Port = main.params[ 'CTRL' ][ 'port2' ]
+        ONOS3Port = main.params[ 'CTRL' ][ 'port3' ]
+
+        main.case( "Setting up test environment" )
+        main.log.report(
+            "This testcase is testing setting up test environment" )
+        main.log.report( "__________________________________" )
+
+        main.step( "Applying cell variable to environment" )
+        cellResult1 = main.ONOSbench.setCell( cellName )
+        # cellResult2 = main.ONOScli1.setCell( cellName )
+        # cellResult3 = main.ONOScli2.setCell( cellName )
+        # cellResult4 = main.ONOScli3.setCell( cellName )
+        verifyResult = main.ONOSbench.verifyCell()
+        cellResult = cellResult1
+
+        main.step( "Removing raft logs before a clen installation of ONOS" )
+        removeLogResult = main.ONOSbench.onosRemoveRaftLogs()
+
+        main.step( "Git checkout, pull and get version" )
+        #main.ONOSbench.gitCheckout( "master" )
+        gitPullResult = main.ONOSbench.gitPull()
+        main.log.info( "git_pull_result = " + str( gitPullResult ))
+        versionResult = main.ONOSbench.getVersion( report=True )
+
+        if gitPullResult == 1:
+            main.step( "Using mvn clean & install" )
+            cleanInstallResult = main.ONOSbench.cleanInstall()
+            # cleanInstallResult = main.TRUE
+
+        main.step( "Creating ONOS package" )
+        packageResult = main.ONOSbench.onosPackage()
+
+        # main.step( "Creating a cell" )
+        # cellCreateResult = main.ONOSbench.createCellFile( **************
+        # )
+
+        main.step( "Installing ONOS package" )
+        onos1InstallResult = main.ONOSbench.onosInstall(
+            options="-f",
+            node=ONOS1Ip )
+        onos2InstallResult = main.ONOSbench.onosInstall(
+            options="-f",
+            node=ONOS2Ip )
+        onos3InstallResult = main.ONOSbench.onosInstall(
+            options="-f",
+            node=ONOS3Ip )
+        onosInstallResult = onos1InstallResult and onos2InstallResult and\
+                onos3InstallResult
+        if onosInstallResult == main.TRUE:
+            main.log.report( "Installing ONOS package successful" )
+        else:
+            main.log.report( "Installing ONOS package failed" )
+
+        onos1Isup = main.ONOSbench.isup( ONOS1Ip )
+        onos2Isup = main.ONOSbench.isup( ONOS2Ip )
+        onos3Isup = main.ONOSbench.isup( ONOS3Ip )
+        onosIsup = onos1Isup and onos2Isup and onos3Isup
+        if onosIsup == main.TRUE:
+            main.log.report( "ONOS instances are up and ready" )
+        else:
+            main.log.report( "ONOS instances may not be up" )
+
+        main.step( "Starting ONOS service" )
+        startResult = main.TRUE
+        # startResult = main.ONOSbench.onosStart( ONOS1Ip )
+        startcli1 = main.ONOScli1.startOnosCli( ONOSIp=ONOS1Ip )
+        startcli2 = main.ONOScli2.startOnosCli( ONOSIp=ONOS2Ip )
+        startcli3 = main.ONOScli3.startOnosCli( ONOSIp=ONOS3Ip )
+        print startcli1
+        print startcli2
+        print startcli3
+
+        case1Result = ( packageResult and
+                        cellResult and verifyResult and onosInstallResult and
+                        onosIsup and startResult )
+        utilities.assertEquals( expect=main.TRUE, actual=case1Result,
+                                onpass="Test startup successful",
+                                onfail="Test startup NOT successful" )
+
+    def CASE10( self ):
+        import time
+        main.log.report(
+            "This testcase uninstalls the reactive forwarding app" )
+        main.log.report( "__________________________________" )
+        main.case( "Uninstalling reactive forwarding app" )
+        # Unistall onos-app-fwd app to disable reactive forwarding
+        appInstallResult = main.ONOScli1.deactivateApp( "org.onosproject.fwd" )
+        appCheck = main.ONOScli1.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( main.ONOScli1.apps() )
+            main.log.warn( main.ONOScli1.appIDs() )
+        main.log.info( "onos-app-fwd uninstalled" )
+
+        # After reactive forwarding is disabled,
+        # the reactive flows on switches timeout in 10-15s
+        # So sleep for 15s
+        time.sleep( 15 )
+
+        hosts = main.ONOScli1.hosts()
+        main.log.info( hosts )
+        case10Result = appInstallResult
+        utilities.assertEquals(
+            expect=main.TRUE,
+            actual=case10Result,
+            onpass="Reactive forwarding app uninstallation successful",
+            onfail="Reactive forwarding app uninstallation failed" )
+
+    def CASE20( self ):
+        """
+            Exit from mininet cli
+            reinstall ONOS
+        """
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
+        ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
+        ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
+        ONOS2Port = main.params[ 'CTRL' ][ 'port2' ]
+        ONOS3Port = main.params[ 'CTRL' ][ 'port3' ]
+
+        main.log.report( "This testcase exits the mininet cli and reinstalls" +
+                         "ONOS to switch over to Packet Optical topology" )
+        main.log.report( "_____________________________________________" )
+        main.case( "Disconnecting mininet and restarting ONOS" )
+        main.step( "Disconnecting mininet and restarting ONOS" )
+        mininetDisconnect = main.Mininet1.disconnect()
+        print "mininetDisconnect = ", mininetDisconnect
+
+        main.step( "Removing raft logs before a clen installation of ONOS" )
+        main.ONOSbench.onosRemoveRaftLogs()
+
+        main.step( "Applying cell variable to environment" )
+        cellResult = main.ONOSbench.setCell( cellName )
+        verifyResult = main.ONOSbench.verifyCell()
+
+
+        main.step( "Installing ONOS package" )
+        onos1InstallResult = main.ONOSbench.onosInstall(
+            options="-f",
+            node=ONOS1Ip )
+        onos2InstallResult = main.ONOSbench.onosInstall(
+            options="-f",
+            node=ONOS2Ip )
+        onos3InstallResult = main.ONOSbench.onosInstall(
+            options="-f",
+            node=ONOS3Ip )
+        onosInstallResult = onos1InstallResult and onos2InstallResult and\
+                onos3InstallResult
+        if onosInstallResult == main.TRUE:
+            main.log.report( "Installing ONOS package successful" )
+        else:
+            main.log.report( "Installing ONOS package failed" )
+
+        onos1Isup = main.ONOSbench.isup( ONOS1Ip )
+        onos2Isup = main.ONOSbench.isup( ONOS2Ip )
+        onos3Isup = main.ONOSbench.isup( ONOS3Ip )
+        onosIsup = onos1Isup and onos2Isup and onos3Isup
+        if onosIsup == main.TRUE:
+            main.log.report( "ONOS instances are up and ready" )
+        else:
+            main.log.report( "ONOS instances may not be up" )
+
+        main.step( "Starting ONOS service" )
+        startResult = main.TRUE
+        # startResult = main.ONOSbench.onosStart( ONOS1Ip )
+        startcli1 = main.ONOScli1.startOnosCli( ONOSIp=ONOS1Ip )
+        startcli2 = main.ONOScli2.startOnosCli( ONOSIp=ONOS2Ip )
+        startcli3 = main.ONOScli3.startOnosCli( ONOSIp=ONOS3Ip )
+        startResult = startcli1 and startcli2 and startcli3
+        if startResult == main.TRUE:
+            main.log.report( "ONOS cli starts properly" )
+        case20Result = mininetDisconnect and cellResult and verifyResult \
+            and onosInstallResult and onosIsup and startResult
+
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case20Result,
+            onpass= "Exiting functionality mininet topology and reinstalling" +
+                    " ONOS successful",
+            onfail= "Exiting functionality mininet topology and reinstalling" +
+                    " ONOS failed" )
+
+    def CASE21( self, main ):
+        """
+            On ONOS bench, run this command:
+            sudo -E python ~/onos/tools/test/topos/opticalTest.py -OC1 <Ctrls>
+            which spawns packet optical topology and copies the links
+            json file to the onos instance.
+            Note that in case of Packet Optical, the links are not learnt
+            from the topology, instead the links are learnt
+            from the json config file
+        """
+        main.log.report(
+            "This testcase starts the packet layer topology and REST" )
+        main.log.report( "_____________________________________________" )
+        main.case( "Starting LINC-OE and other components" )
+        main.step( "Starting LINC-OE and other components" )
+        main.log.info( "Activate optical app" )
+        appInstallResult = main.ONOScli1.activateApp( "org.onosproject.optical" )
+        appCheck = main.ONOScli1.appToIDCheck()
+        appCheck = appCheck and main.ONOScli2.appToIDCheck()
+        appCheck = appCheck and main.ONOScli3.appToIDCheck()
+        if appCheck != main.TRUE:
+            main.log.warn( "Checking ONOS application unsuccesful" )
+
+        ctrllerIP = []
+        ctrllerIP.append( main.params[ 'CTRL' ][ 'ip1' ] )
+        #ctrllerIP.append( main.params[ 'CTRL' ][ 'ip2' ] )
+        #ctrllerIP.append( main.params[ 'CTRL' ][ 'ip3' ] )
+        opticalMnScript = main.LincOE2.runOpticalMnScript( ctrllerIP = ctrllerIP )
+        case21Result = opticalMnScript and appInstallResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case21Result,
+            onpass="Packet optical topology spawned successsfully",
+            onfail="Packet optical topology spawning failed" )
+
+    def CASE22( self, main ):
+        """
+            Curretly we use, 10 optical switches(ROADM's) and
+            6 packet layer mininet switches each with one host.
+            Therefore, the roadmCount variable = 10,
+            packetLayerSWCount variable = 6, hostCount=6 and
+            links=42.
+            All this is hardcoded in the testcase. If the topology changes,
+            these hardcoded values need to be changed
+        """
+        main.log.report(
+            "This testcase compares the optical+packet topology against what" +
+            " is expected" )
+        main.case( "Topology comparision" )
+        main.step( "Topology comparision" )
+        devicesResult = main.ONOScli3.devices( jsonFormat=False )
+
+        print "devices_result = ", devicesResult
+        devicesLinewise = devicesResult.split( "\n" )
+        roadmCount = 0
+        packetLayerSWCount = 0
+        for line in devicesLinewise:
+            components = line.split( "," )
+            availability = components[ 1 ].split( "=" )[ 1 ]
+            type = components[ 3 ].split( "=" )[ 1 ]
+            if availability == 'true' and type == 'ROADM':
+                roadmCount += 1
+            elif availability == 'true' and type == 'SWITCH':
+                packetLayerSWCount += 1
+        if roadmCount == 10:
+            print "Number of Optical Switches = %d and is" % roadmCount +\
+                  " correctly detected"
+            main.log.info(
+                "Number of Optical Switches = " +
+                str( roadmCount ) +
+                " and is correctly detected" )
+            opticalSWResult = main.TRUE
+        else:
+            print "Number of Optical Switches = %d and is wrong" % roadmCount
+            main.log.info(
+                "Number of Optical Switches = " +
+                str( roadmCount ) +
+                " and is wrong" )
+            opticalSWResult = main.FALSE
+
+        if packetLayerSWCount == 6:
+            print "Number of Packet layer or mininet Switches = %d "\
+                    % packetLayerSWCount + "and is correctly detected"
+            main.log.info(
+                "Number of Packet layer or mininet Switches = " +
+                str( packetLayerSWCount ) +
+                " and is correctly detected" )
+            packetSWResult = main.TRUE
+        else:
+            print "Number of Packet layer or mininet Switches = %d and"\
+                    % packetLayerSWCount + " is wrong"
+            main.log.info(
+                "Number of Packet layer or mininet Switches = " +
+                str( packetLayerSWCount ) +
+                " and is wrong" )
+            packetSWResult = main.FALSE
+        print "_________________________________"
+
+        linksResult = main.ONOScli3.links( jsonFormat=False )
+        print "links_result = ", linksResult
+        print "_________________________________"
+        linkActiveCount = linksResult.count("state=ACTIVE") 
+        main.log.info( "linkActiveCount = " + str( linkActiveCount ))
+        if linkActiveCount == 42:
+            linkActiveResult = main.TRUE
+            main.log.info(
+                "Number of links in ACTIVE state are correct")
+        else:
+            linkActiveResult = main.FALSE
+            main.log.info(
+                "Number of links in ACTIVE state are wrong")
+
+        case22Result = opticalSWResult and packetSWResult and \
+                        linkActiveResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case22Result,
+            onpass="Packet optical topology discovery successful",
+            onfail="Packet optical topology discovery failed" )
+
+    def CASE23( self, main ):
+        import time
+        """
+            Add bidirectional point intents between 2 packet layer( mininet )
+            devices and
+            ping mininet hosts
+        """
+        main.log.report(
+            "This testcase adds bidirectional point intents between 2 " +
+            "packet layer( mininet ) devices and ping mininet hosts" )
+        main.case( "Topology comparision" )
+        main.step( "Adding point intents" )
+        ptpIntentResult = main.ONOScli1.addPointIntent(
+            "of:0000ffffffff0001/1",
+            "of:0000ffffffff0005/1" )
+        if ptpIntentResult == main.TRUE:
+            main.ONOScli1.intents( jsonFormat=False )
+            main.log.info( "Point to point intent install successful" )
+
+        ptpIntentResult = main.ONOScli1.addPointIntent(
+            "of:0000ffffffff0005/1",
+            "of:0000ffffffff0001/1" )
+        if ptpIntentResult == main.TRUE:
+            main.ONOScli1.intents( jsonFormat=False )
+            main.log.info( "Point to point intent install successful" )
+
+        time.sleep( 30 )
+        flowHandle = main.ONOScli1.flows()
+        main.log.info( "flows :" + flowHandle )
+
+        # Sleep for 30 seconds to provide time for the intent state to change
+        time.sleep( 60 )
+        intentHandle = main.ONOScli1.intents( jsonFormat=False )
+        main.log.info( "intents :" + intentHandle )
+
+        PingResult = main.TRUE
+        count = 1
+        main.log.info( "\n\nh1 is Pinging h5" )
+        ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+        # ping = main.LincOE2.pinghost()
+        if ping == main.FALSE and count < 5:
+            count += 1
+            PingResult = main.FALSE
+            main.log.info(
+                "Ping between h1 and h5  failed. Making attempt number " +
+                str( count ) +
+                " in 2 seconds" )
+            time.sleep( 2 )
+        elif ping == main.FALSE:
+            main.log.info( "All ping attempts between h1 and h5 have failed" )
+            PingResult = main.FALSE
+        elif ping == main.TRUE:
+            main.log.info( "Ping test between h1 and h5 passed!" )
+            PingResult = main.TRUE
+        else:
+            main.log.info( "Unknown error" )
+            PingResult = main.ERROR
+
+        if PingResult == main.FALSE:
+            main.log.report(
+                "Point intents for packet optical have not ben installed" +
+                " correctly. Cleaning up" )
+        if PingResult == main.TRUE:
+            main.log.report(
+                "Point Intents for packet optical have been " +
+                "installed correctly" )
+
+        case23Result = PingResult
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case23Result,
+            onpass= "Point intents addition for packet optical and" +
+                    "Pingall Test successful",
+            onfail= "Point intents addition for packet optical and" +
+                    "Pingall Test NOT successful" )
+
+    def CASE24( self, main ):
+        import time
+        import json
+        """
+            LINC uses its own switch IDs. You can use the following
+            command on the LINC console to find the mapping between
+            DPIDs and LINC IDs.
+            rp(application:get_all_key(linc)).
+
+            Test Rerouting of Packet Optical by bringing a port down
+            ( port 20 ) of a switch( switchID=1, or LincOE switchID =9 ),
+            so that link
+            ( between switch1 port20 - switch5 port50 ) is inactive
+            and do a ping test. If rerouting is successful,
+            ping should pass. also check the flows
+        """
+        main.log.report(
+            "This testcase tests rerouting and pings mininet hosts" )
+        main.case( "Test rerouting and pings mininet hosts" )
+        main.step( "Attach to the Linc-OE session" )
+        attachConsole = main.LincOE1.attachLincOESession()
+        print "attachConsole = ", attachConsole
+
+        main.step( "Bring a port down and verify the link state" )
+        main.LincOE1.portDown( swId="9", ptId="20" )
+        linksNonjson = main.ONOScli3.links( jsonFormat=False )
+        main.log.info( "links = " + linksNonjson )
+
+        linkInactiveCount = linksNonjson.count("state=INACTIVE")
+        main.log.info( "linkInactiveCount = " + str( linkInactiveCount ))
+        if linkInactiveCount == 2:
+            main.log.info(
+                "Number of links in INACTIVE state are correct")
+        else:
+            main.log.info(
+                "Number of links in INACTIVE state are wrong")
+        
+        links = main.ONOScli3.links()
+        main.log.info( "links = " + links )
+
+        linksResult = json.loads( links )
+        linksStateResult = main.FALSE
+        for item in linksResult:
+            if item[ 'src' ][ 'device' ] == "of:0000ffffffffff01" and item[
+                    'src' ][ 'port' ] == "20":
+                if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff05" and item[
+                        'dst' ][ 'port' ] == "50":
+                    linksState = item[ 'state' ]
+                    if linksState == "INACTIVE":
+                        main.log.info(
+                            "Links state is inactive as expected due to one" +
+                            " of the ports being down" )
+                        main.log.report(
+                            "Links state is inactive as expected due to one" +
+                            " of the ports being down" )
+                        linksStateResult = main.TRUE
+                        break
+                    else:
+                        main.log.info(
+                            "Links state is not inactive as expected" )
+                        main.log.report(
+                            "Links state is not inactive as expected" )
+                        linksStateResult = main.FALSE
+
+        print "links_state_result = ", linksStateResult
+        time.sleep( 10 )
+        flowHandle = main.ONOScli3.flows()
+        main.log.info( "flows :" + flowHandle )
+
+        main.step( "Verify Rerouting by a ping test" )
+        PingResult = main.TRUE
+        count = 1
+        main.log.info( "\n\nh1 is Pinging h5" )
+        ping = main.LincOE2.pingHostOptical( src="h1", target="h5" )
+        # ping = main.LincOE2.pinghost()
+        if ping == main.FALSE and count < 5:
+            count += 1
+            PingResult = main.FALSE
+            main.log.info(
+                "Ping between h1 and h5  failed. Making attempt number " +
+                str( count ) +
+                " in 2 seconds" )
+            time.sleep( 2 )
+        elif ping == main.FALSE:
+            main.log.info( "All ping attempts between h1 and h5 have failed" )
+            PingResult = main.FALSE
+        elif ping == main.TRUE:
+            main.log.info( "Ping test between h1 and h5 passed!" )
+            PingResult = main.TRUE
+        else:
+            main.log.info( "Unknown error" )
+            PingResult = main.ERROR
+
+        if PingResult == main.TRUE:
+            main.log.report( "Ping test successful " )
+        if PingResult == main.FALSE:
+            main.log.report( "Ping test failed" )
+
+        case24Result = PingResult and linksStateResult
+        utilities.assert_equals( expect=main.TRUE, actual=case24Result,
+                                 onpass="Packet optical rerouting successful",
+                                 onfail="Packet optical rerouting failed" )
+
+    def CASE25( self ):
+        """
+            Add host intents between 2 packet layer host
+        """
+        import time
+        import json
+        main.log.report( "Adding host intents between 2 packet layer host" )
+        main.hostMACs = []
+        main.hostId = []
+        #Listing host MAC addresses
+        for i in range( 1 , 7 ):
+            main.hostMACs.append( "00:00:00:00:00:" +
+                                str( hex( i )[ 2: ] ).zfill( 2 ).upper() )
+        for macs in main.hostMACs:
+            main.hostId.append( macs + "/-1" )
+
+        host1 = main.hostId[ 0 ]
+        host2 = main.hostId[ 1 ]
+        intentsId = []
+        # Use arping to discover the hosts
+        main.LincOE2.arping( host = "h1" )
+        main.LincOE2.arping( host = "h2" )
+        # Adding host intent
+        main.log.step( "Adding host intents to h1 and h2" )
+        intent1 = main.ONOScli1.addHostIntent( hostIdOne = host1,
+                                            hostIdTwo = host2 )
+        intentsId.append( intent1 )
+        time.sleep( 5 )
+        intent2 = main.ONOScli1.addHostIntent( hostIdOne = host2,
+                                            hostIdTwo = host1 )
+        intentsId.append( intent2 )
+        # Checking intents state before pinging
+        main.log.step( "Checking intents state" )
+        time.sleep( 10 )
+        intentResult = main.ONOScli1.checkIntentState( intentsId = intentsId )
+        utilities.assert_equals( expect=main.TRUE, actual=intentResult,
+                                 onpass="All intents are in INSTALLED state ",
+                                 onfail="Some of the intents are not in " +
+                                        "INSTALLED state " )
+
+        # pinging h1 to h2 and then ping h2 to h1
+        main.log.step( "Pinging h1 and h2" )
+        pingResult = main.TRUE
+        pingResult = main.LincOE2.pingHostOptical( src="h1", target="h2" )
+        pingResult = pingResult and main.LincOE2.pingHostOptical( src="h2",
+                                                                  target="h1" )
+
+        utilities.assert_equals( expect=main.TRUE, actual=pingResult,
+                                 onpass="Pinged successfully between h1 and h2",
+                                 onfail="Pinged failed between h1 and h2" )
+
+        case25Result = pingResult
+        utilities.assert_equals( expect=main.TRUE, actual=case25Result,
+                                 onpass="Add host intent successful",
+                                 onfail="Add host intent failed" )
