Merge branch 'master' of https://github.com/OPENNETWORKINGLAB/ONLabTest
diff --git a/TestON/drivers/common/cli/emulator/remotemininetdriver.py b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
index 5647536..1bf7b89 100644
--- a/TestON/drivers/common/cli/emulator/remotemininetdriver.py
+++ b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
@@ -66,15 +66,34 @@
             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 
+# the pingLong.
+#*********************************************************************************************
+#*********************************************************************************************
+
+    def checkForLoss(self, fileName):
+        import os
+        if os.stat(fileName)[6]==0:
+            return main.TRUE
+        pingFile= open(fileName,'r')
+        pingList = pingFile.read()
+        
+        if re.search("0% packet loss",pingList):
+            return main.FALSE
+        return main.TRUE
+
+
     def pingLong(self,**pingParams):
         '''
         Starts a continuous ping on the mininet host outputing to a file in the /tmp dir. 
         '''
-        args = utilities.parse_args(["SRC","TARGET"],**pingParams)
+        args = utilities.parse_args(["SRC","TARGET","PINGTIME"],**pingParams)
         precmd = "rm /tmp/ping." + args["SRC"]
         self.execute(cmd=precmd,prompt="(.*)",timeout=10)
-        command = "mininet/util/m " + args["SRC"] + " ping "+args ["TARGET"]+" -i 1 -W 1 > /tmp/ping." + args["SRC"] + " &"
+        command = "mininet/util/m " + args["SRC"] + " ping "+args ["TARGET"]+" -i .2 -w " + str(args['PINGTIME']) + " > /tmp/ping." + args["SRC"] + " &"
         main.log.info( command ) 
         self.execute(cmd=command,prompt="(.*)",timeout=10)
         return main.TRUE
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index d7f57d3..d2761f0 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -337,8 +337,68 @@
             main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
             main.cleanup()
             main.exit()
+#**********************************************************************************************
+#**********************************************************************************************
+# The purpose of comp_intents is to find if the high level intents have changed. preIntents
+# and postIntents should be the output of curl of the intents. preIntents being the original
+# and postIntents being the later. We are looking at the intents with the same id from both
+# and comparing the dst and src DPIDs and macs, and the state. If any of these are changed
+# we print that there are changes, then return a list of the intents that have changes`
+#**********************************************************************************************
+#**********************************************************************************************
+    def comp_intents(self,preIntents,postIntents):
+        import json
+        preDecoded = json.loads(preIntents)
+        postDecoded = json.loads(postIntents)
+        changes = []
+        if not preDecoded:
+            if postDecoded:
+                print "THERE ARE CHANGES TO THE HIGH LEVEL INTENTS!!!!"
+                return postDecoded
+        for k in preDecoded:
+            for l in postDecoded:
+                if l['id']==k['id']:
+                    if k['dstSwitchDpid']==l['dstSwitchDpid'] and k['srcMac']==l['srcMac'] and k['dstMac']==l['dstMac'] and k['srcSwitchDpid']==l['srcSwitchDpid'] and k['state']==l['state']:
+                        postDecoded.remove(l)
+                    else:
+                        changes.append(k)
+                        print ("THERE ARE CHANGES TO THE HIGH LEVEL INTENTS!!!")
+        return changes
     
-    
+#**********************************************************************************************
+#**********************************************************************************************
+# the purpose of comp_low is to find if the low level intents have changed. The main idea
+# is to determine if the path has changed. Again, like with the comp_intents function, the
+# pre and post Intents variables are the json dumps of wm/onos/intent/low. The variables
+# that will be compared are the state, and the path.
+#**********************************************************************************************
+#**********************************************************************************************
+    def comp_low(self, preIntents,postIntents):
+        import json
+        preDecoded = json.loads(preIntents)
+        postDecoded = json.loads(postIntents)
+        changes = []
+        if not preDecoded:
+            if postDecoded:
+                print "THERE ARE CHANGES TO THE LOW LEVEL INTENTS!!!"
+                return postDecoded
+        for k in preDecoded:
+            for l in postDecoded:
+                if l['id']==k['id']:
+                    if l['path']!=k['path']:
+                        changes.append(l)
+                        print "\n\n\n\nTHERE ARE CHANGES TO THE LOW LEVEL INTENTS!!!"
+                    else:
+                        if k['state']!=l['state']:
+                            changes.append(l)
+                            print "\n\n\n\nTHERE ARE CHANGES TO THE LOW LEVEL INTENTS!!!"
+                        else:
+                            print "NO CHANGES SO FAR\n\n\n"
+
+
+        return changes
+
+
     def rest_stop(self):
         '''
         Runs ./start-rest.sh stop to stop ONOS rest server
@@ -1278,6 +1338,7 @@
             i = self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT],timeout=120)
             #main.log.warn("third expect response: " +str(i))
             response = self.handle.before
+            print response
             count = 0
             print response
             for line in response.splitlines():
diff --git a/TestON/drivers/common/cli/zookeeperclidriver.py b/TestON/drivers/common/cli/zookeeperclidriver.py
index 5d9396e..79f06ee 100644
--- a/TestON/drivers/common/cli/zookeeperclidriver.py
+++ b/TestON/drivers/common/cli/zookeeperclidriver.py
@@ -131,28 +131,27 @@
             main.log.error(self.name + ": Connection failed to the host")
             response = main.FALSE
         return response 
-    
-    def findMaster(self, switchDPID, ip="localhost"):
+   
+#**********************************************************************************************
+#**********************************************************************************************
+# findMaster is used to determine the master controller of a switch. 
+# it uses the switchList which is a json dict, and finds the first controller of 
+# each switch
+#**********************************************************************************************
+#**********************************************************************************************
+
+
+    def findMaster(self, switchDPID, switchList):
         import json
-        time.sleep(1)
-        command = "curl "+ip+":8080/wm/onos/registry/switches/json > master.txt"
-        response = self.execute(cmd=command,prompt="\$",timeout=10)
-        self.handle.sendline("cat master.txt")
-        response = self.execute(cmd=command,prompt="\$",timeout=10)
-        self.handle.expect(["cat master.txt",pexpect.EOF,pexpect.TIMEOUT])
-        self.handle.expect(["admin",pexpect.EOF,pexpect.TIMEOUT])
-        response = self.handle.before
-        decoded = json.loads(response)
+        decoded = json.loads(switchList)
         for k in decoded.iteritems():
             k2 = json.dumps(k)
             if re.search(switchDPID,k2):
                 k3 = k2.split(',')
                 k4 = k3[1].split()
                 k5 = k4[1].split('"')
-                print k5[1]
                 return k5[1]
-            else:
-                return "NO SWITCH WITH THIS DPID!"
+        return "NO SWITCH FOUND"
 
     def isup(self):
         '''
diff --git a/TestON/tests/HATest1/HATest1.params b/TestON/tests/HATest1/HATest1.params
new file mode 100644
index 0000000..dfda24b
--- /dev/null
+++ b/TestON/tests/HATest1/HATest1.params
@@ -0,0 +1,15 @@
+<PARAMS>
+    <testcases>2,3</testcases>
+    <CTRL>
+        <ip1>10.128.9.1</ip1>
+        <ip2>10.128.9.2</ip2>
+        <ip3>10.128.9.3</ip3>
+        <ip4>10.128.9.4</ip4>
+        <ip5>10.128.9.5</ip5>
+        <port1>6633</port1>
+    </CTRL>
+    <INTENTS>
+        <intentPort>8080</intentPort>
+        <intentURL>wm/onos/intent</intentURL>
+    </INTENTS>
+</PARAMS>
diff --git a/TestON/tests/HATest1/HATest1.py b/TestON/tests/HATest1/HATest1.py
new file mode 100644
index 0000000..61b7c29
--- /dev/null
+++ b/TestON/tests/HATest1/HATest1.py
@@ -0,0 +1,186 @@
+
+class HATest1:
+
+    
+    def __init__(self) :
+        self.default = ''
+
+    '''
+    CASE1 is to close any existing instances of ONOS, clean out the 
+    RAMCloud database, and start up ONOS instances. 
+    '''
+    def CASE1(self,main) :
+        main.case("Initial Startup")
+        main.step("Stop ONOS")
+        if not main.ONOS1.status():
+            main.ONOS1.stop_all()
+        if not main.ONOS1.status():
+            main.ONOS2.stop_all()
+        if not main.ONOS1.status():
+            main.ONOS3.stop_all()
+        if not main.ONOS1.status():
+            main.ONOS4.stop_all()
+        main.ONOS1.stop_rest()
+        main.ONOS2.stop_rest()
+        main.ONOS3.stop_rest()
+        main.ONOS4.stop_rest()
+        result = main.ONOS1.status() or main.ONOS2.status() \
+                or main.ONOS3.status() or main.ONOS4.status()
+        utilities.assert_equals(expect=main.FALSE,actual=result,onpass="ONOS stopped successfully",onfail="ONOS WAS NOT KILLED PROPERLY")
+        main.step("Startup Zookeeper")
+        main.ZK1.start()
+        main.ZK2.start()
+        main.ZK3.start()
+        main.ZK4.start()
+        result = main.ZK1.isup() and main.ZK2.isup()\
+                and main.ZK3.isup() and main.ZK4.isup
+        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Zookeeper started successfully",onfail="ZOOKEEPER FAILED TO START")
+        main.step("Cleaning RC Database and Starting All")
+        main.RC1.deldb()
+        main.RC2.deldb()
+        main.RC3.deldb()
+        main.RC4.deldb()
+        main.ONOS1.start_all()
+        main.ONOS2.start_all()
+        main.ONOS3.start_all()
+        main.ONOS4.start_all()
+        main.ONOS1.start_rest()
+        main.step("Testing Startup")
+        result1 = main.ONOS1.rest_status()
+        vm1 = main.RC1.status_coor and main.RC1.status_serv and \
+                main.ONOS1.isup()
+        vm2 = main.RC2.status_coor and main.ONOS2.isup()
+        vm3 = main.RC3.status_coor and main.ONOS3.isup()
+        vm4 = main.RC4.status_coor and main.ONOS4.isup()
+        result = result1 and vm1 and vm2 and vm3 and vm4
+        utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Everything started successfully",onfail="EVERYTHING FAILED TO START")
+
+    '''
+    CASE2
+    '''
+    def CASE2(self,main) :
+        import time
+        import json
+        import re
+        main.log.report("Assigning Controllers")
+        main.case("Assigning Controllers")
+        main.step("Assign Master Controllers")
+        for i in range(1,28):
+            if i ==1:
+                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
+            elif i>=2 and i<5:
+                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip2'],port1=main.params['CTRL']['port1'])
+            elif i>=5 and i<8:
+                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip3'],port1=main.params['CTRL']['port1'])
+            elif i>=8 and i<18:
+                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip4'],port1=main.params['CTRL']['port1'])
+            elif i>=18 and i<28:
+                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip5'],port1=main.params['CTRL']['port1'])
+            else:
+                main.Mininet1.assign_sw_controller(sw=str(i),ip1=main.params['CTRL']['ip1'],port1=main.params['CTRL']['port1'])
+        
+        result = main.TRUE
+        for i in range (1,28):
+            if i==1:
+                response = main.Mininet1.get_sw_controller("s"+str(i))
+                print("Response is " + str(response))
+                if re.search("tcp:"+main.params['CTRL']['ip1'],response):
+                    result = result and main.TRUE
+                else:
+                    result = 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:"+main.params['CTRL']['ip2'],response):
+                    result = result and main.TRUE
+                else:
+                    result = 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:"+main.params['CTRL']['ip3'],response):
+                    result = result and main.TRUE
+                else:
+                    result = 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:"+main.params['CTRL']['ip4'],response):
+                    result = result and main.TRUE
+                else:
+                    result = 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:"+main.params['CTRL']['ip5'],response):
+                    result = result and main.TRUE
+                else:
+                    result = main.FALSE
+            else:
+                response = main.Mininet1.get_sw_controller("s"+str(i))
+                print("Response is" + str(response))
+                if re.search("tcp:" +main.params['CTRL']['ip1'],response):
+                    result = result and main.TRUE
+                else:
+                    result = main.FALSE
+        utilities.assert_equals(expect = main.TRUE,actual=result,onpass="MasterControllers assigned correctly")
+        time.sleep(30)
+
+    def CASE3(self,main) :
+        import time
+        import json
+        import re
+        main.case("Adding Intents")
+        intentIP = main.params['CTRL']['ip1']
+        intentPort=main.params['INTENTS']['intentPort']
+        intentURL=main.params['INTENTS']['intentURL']
+        count = 1
+        for i in range(8,18):
+            srcMac = '00:00:00:00:00:' + str(hex(i)[2:]).zfill(2)
+            dstMac = '00:00:00:00:00:'+str(hex(i+10)[2:])
+            srcDPID = '00:00:00:00:00:00:30:'+str(i).zfill(2)
+            dstDPID= '00:00:00:00:00:00:60:' +str(i+10)
+            main.ONOS1.add_intent(intent_id=str(count),src_dpid=srcDPID,dst_dpid=dstDPID,src_mac=srcMac,dst_mac=dstMac,intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
+            count+=1
+            dstDPID = '00:00:00:00:00:00:30:'+str(i).zfill(2)
+            srcDPID= '00:00:00:00:00:00:60:' +str(i+10)
+            dstMac = '00:00:00:00:00:' + str(hex(i)[2:]).zfill(2)
+            srcMac = '00:00:00:00:00:'+str(hex(i+10)[2:])
+            main.ONOS1.add_intent(intent_id=str(count),src_dpid=srcDPID,dst_dpid=dstDPID,src_mac=srcMac,dst_mac=dstMac,intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
+            count+=1
+        time.sleep(400)
+        count = 1
+        i = 8
+        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 <9:
+                count+=1
+                i = 8
+                result = main.FALSE
+                main.log.info("Ping FAILED! Making attempt number "+str(count) + "in 2 seconds")
+                time.sleep(2)
+            elif ping==main.FALSE:
+                main.log.info("PINGS FAILED! MAX RETRIES REACHED!")
+                i=19
+                result = main.FALSE
+            elif ping==main.TRUE:
+                main.log.info("Ping passed!")
+                i+=1
+                result = main.TRUE
+            else:
+                main.log.info("ERROR!!")
+                result = main.ERROR
+        if result==main.FALSE:
+            main.log.info("INTENTS HAVE NOT BEEN INSTALLED CORRECTLY!! EXITING!!!")
+            main.cleanup()
+            main.exit()
+        
+
+    def CASE4(self,main) :
+        main.case("Setting up and Gathering data for current state")
+        
+
+
+
diff --git a/TestON/tests/HATest1/HATest1.topo b/TestON/tests/HATest1/HATest1.topo
new file mode 100644
index 0000000..9ccdb17
--- /dev/null
+++ b/TestON/tests/HATest1/HATest1.topo
@@ -0,0 +1,183 @@
+<TOPOLOGY>
+
+    <COMPONENT>
+        <ZK1>
+            <host>10.128.9.1</host>
+            <user>admin</user>
+            <password></password>
+            <type>ZookeeperCliDriver</type>
+            <connect_order>1</connect_order>
+            <COMPONENTS>
+             </COMPONENTS>
+        </ZK1>
+
+        <ZK2>
+            <host>10.128.9.2</host>
+            <user>admin</user>
+            <password></password>
+            <type>ZookeeperCliDriver</type>
+            <connect_order>2</connect_order>
+            <COMPONENTS>
+             </COMPONENTS>
+        </ZK2>
+
+        <ZK3>
+            <host>10.128.9.3</host>
+            <user>admin</user>
+            <password></password>
+            <type>ZookeeperCliDriver</type>
+            <connect_order>3</connect_order>
+            <COMPONENTS>
+             </COMPONENTS>
+        </ZK3>
+       
+        <ZK4>
+            <host>10.128.9.4</host>
+            <user>admin</user>
+            <password></password>
+            <type>ZookeeperCliDriver</type>
+            <connect_order>4</connect_order>
+            <COMPONENTS>
+             </COMPONENTS>
+        </ZK4>
+
+        <ZK5>
+            <host>10.128.9.5</host>
+            <user>admin</user>
+            <password></password>
+            <type>ZookeeperCliDriver</type>
+            <connect_order>5</connect_order>
+            <COMPONENTS>
+             </COMPONENTS>
+        </ZK5>
+
+        <RC1>
+            <host>10.128.9.1</host>
+            <user>admin</user>
+            <password></password>
+            <type>RamCloudCliDriver</type>
+            <connect_order>6</connect_order>
+            <COMPONENTS>
+             </COMPONENTS>
+        </RC1>
+
+        <RC2>
+            <host>10.128.9.2</host>
+            <user>admin</user>
+            <password></password>
+            <type>RamCloudCliDriver</type>
+            <connect_order>7</connect_order>
+            <COMPONENTS>
+             </COMPONENTS>
+        </RC2>
+       
+        <RC3>
+            <host>10.128.9.3</host>
+            <user>admin</user>
+            <password></password>
+            <type>RamCloudCliDriver</type>
+            <connect_order>8</connect_order>
+            <COMPONENTS>
+             </COMPONENTS>
+        </RC3>
+       
+        <RC4>
+            <host>10.128.9.4</host>
+            <user>admin</user>
+            <password></password>
+            <type>RamCloudCliDriver</type>
+            <connect_order>9</connect_order>
+            <COMPONENTS>
+             </COMPONENTS>
+        </RC4>
+
+        <RC5>
+            <host>10.128.9.5</host>
+            <user>admin</user>
+            <password></password>
+            <type>RamCloudCliDriver</type>
+            <connect_order>10</connect_order>
+            <COMPONENTS>
+             </COMPONENTS>
+        </RC5>
+
+        <ONOS1>
+            <host>10.128.9.1</host>
+            <user>admin</user>
+            <password></password>
+            <type>OnosCliDriver</type>
+            <connect_order>11</connect_order>
+            <COMPONENTS>
+             </COMPONENTS>
+        </ONOS1>
+
+        <ONOS2>
+            <host>10.128.9.2</host>
+            <user>admin</user>
+            <password></password>
+            <type>OnosCliDriver</type>
+            <connect_order>12</connect_order>
+            <COMPONENTS>
+             </COMPONENTS>
+        </ONOS2>
+
+        <ONOS3>
+            <host>10.128.9.3</host>
+            <user>admin</user>
+            <password></password>
+            <type>OnosCliDriver</type>
+            <connect_order>13</connect_order>
+            <COMPONENTS>
+             </COMPONENTS>
+        </ONOS3>
+       
+        <ONOS4>
+            <host>10.128.9.4</host>
+            <user>admin</user>
+            <password></password>
+            <type>OnosCliDriver</type>
+            <connect_order>14</connect_order>
+            <COMPONENTS>
+             </COMPONENTS>
+        </ONOS4>
+
+        <ONOS5>
+            <host>10.128.9.5</host>
+            <user>admin</user>
+            <password></password>
+            <type>OnosCliDriver</type>
+            <connect_order>15</connect_order>
+            <COMPONENTS>
+             </COMPONENTS>
+        </ONOS5>
+
+        <Mininet1>
+            <host>10.128.9.10</host>
+            <user>admin</user>
+            <password></password>
+            <type>MininetCliDriver</type>
+            <connect_order>13</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>
+        </Mininet1>
+
+        <Mininet2>
+            <host>10.128.9.10</host>
+            <user>admin</user>
+            <password></password>
+            <type>RemoteMininetDriver</type>
+            <connect_order>14</connect_order>
+            <COMPONENTS>
+                # Specify the Option for mininet
+                <arg1> --custom ~/mininet/custom/topo-onos4node.py </arg1>
+                <arg2> --topo mytopo --arp</arg2>
+                <controller> remote </controller>
+             </COMPONENTS>
+        </Mininet2>
+
+    </COMPONENT>
+</TOPOLOGY>
diff --git a/TestON/tests/JamesTest/JamesTest.params b/TestON/tests/JamesTest/JamesTest.params
index f9540c3..be749b4 100644
--- a/TestON/tests/JamesTest/JamesTest.params
+++ b/TestON/tests/JamesTest/JamesTest.params
@@ -1,5 +1,5 @@
 <PARAMS>
-    <testcases>101,66,10</testcases>
+    <testcases>2,3,66</testcases>
     <tcpdump> 
         <intf>eth0</intf>
         <port>port 6633</port>
@@ -42,6 +42,28 @@
         <ip4>10.128.4.154</ip4>
         <port4>6633</port4>
     </CTRL>
+    <PING>
+        <source1>h6</source1>
+        <source2>h7</source2>
+        <source3>h8</source3>
+        <source4>h9</source4>
+        <source5>h10</source5>
+        <source6>h11</source6>
+        <source7>h12</source7>
+        <source8>h13</source8>
+        <source9>h14</source9>
+        <source10>h15</source10>
+        <target1>10.0.0.16</target1>
+        <target2>10.0.0.17</target2>
+        <target3>10.0.0.18</target3>
+        <target4>10.0.0.19</target4>
+        <target5>10.0.0.20</target5>
+        <target6>10.0.0.21</target6>
+        <target7>10.0.0.22</target7>
+        <target8>10.0.0.23</target8>
+        <target9>10.0.0.24</target9>
+        <target10>10.0.0.25</target10>
+    </PING>
     <INTENTREST>
         <intentIP>10.128.4.151</intentIP>
         <intentPort>8080</intentPort>
diff --git a/TestON/tests/JamesTest/JamesTest.py b/TestON/tests/JamesTest/JamesTest.py
index e4fabda..dcb03f3 100644
--- a/TestON/tests/JamesTest/JamesTest.py
+++ b/TestON/tests/JamesTest/JamesTest.py
@@ -154,16 +154,64 @@
     def CASE3(self,main) :    #Delete any remnant flows, then add flows, and time how long it takes flow tables to update
         main.log.report("Delete any flows from previous tests, then add flows from FLOWDEF file, then wait for switch flow tables to update")
         import time
+        from subprocess import Popen, PIPE
         main.case("Taking care of these flows!") 
         main.step("Cleaning out any leftover flows...")
+        masterSwitches = []
+        masterSwitches2 = []
+        hello = main.Mininet2.checkForLoss(fileName='/tmp/ping.h10')
+        if hello==main.FALSE:
+            main.log.info("CRAP")
+        else:
+            main.log.info("YAY")
+        for i in range(25): 
+            if i < 15:
+                j=i+1
+            else:
+                j=i+16
+            (stdout, stderr) = Popen(["curl",main.params['RESTCALL']['restIP1']+":"+main.params['RESTCALL']['restPort']+"/wm/onos/registry/switches/json"],stdout=PIPE).communicate()
+            switchDPID1 = main.Mininet1.getSwitchDPID(switch="s"+str(j))
+            sDPID1 = str(switchDPID1)
+            switchDPID2 = sDPID1[:2]+":"+sDPID1[2:4]+":"+sDPID1[4:6]+":"+sDPID1[6:8]+":"+sDPID1[8:10]+":"+sDPID1[10:12]+":"+sDPID1[12:14]+":"+sDPID1[14:]
+            master=main.Zookeeper1.findMaster(switchDPID = switchDPID2, switchList=stdout)
+            masterSwitches.append("s"+str(j)+" " + master)
+
+        for i in range(25): 
+            if i < 15:
+                j=i+1
+            else:
+                j=i+16
+            print j
+            (stdout, stderr) = Popen(["curl",main.params['RESTCALL']['restIP1']+":"+main.params['RESTCALL']['restPort']+"/wm/onos/registry/switches/json"],stdout=PIPE).communicate()
+            switchDPID1 = main.Mininet1.getSwitchDPID(switch="s"+str(j))
+            sDPID1 = str(switchDPID1)
+            switchDPID2 = sDPID1[:2]+":"+sDPID1[2:4]+":"+sDPID1[4:6]+":"+sDPID1[6:8]+":"+sDPID1[8:10]+":"+sDPID1[10:12]+":"+sDPID1[12:14]+":"+sDPID1[14:]
+            master=main.Zookeeper1.findMaster(switchDPID = switchDPID2, switchList=stdout)
+            masterSwitches2.append("s"+str(j)+" " + master)
+       
+
+
+
+        print masterSwitches
+        print "\n\n\n"
+        print masterSwitches2
+        print masterSwitches == masterSwitches2
         #main.ONOS1.delete_flow("all")
         strtTime = time.time()
         main.ONOS1.rm_intents()
-        print("world")
+        (stdout,stderr) = Popen(["curl",main.params['RESTCALL']['restIP1']+":"+main.params['RESTCALL']['restPort']+"/wm/onos/intent/high"],stdout=PIPE).communicate()
+        intent1 = stdout
+        print intent1 + "\n\n\n Intent 1 \n\n\n"
         main.ONOS1.add_intents()
         time.sleep(2)
-        main.ONOS1.add_intents()
-        print("hello")
+        (stdout,stderr) = Popen(["curl",main.params['RESTCALL']['restIP1']+":"+main.params['RESTCALL']['restPort']+"/wm/onos/intent/high"],stdout=PIPE).communicate()
+        intent2 = stdout
+        print intent2 + "\n\n\n Intent 2 \n\n\n"
+        changesMade = main.ONOS1.comp_intents(preIntents=intent1,postIntents=intent2)
+        print changesMade
+        if not changesMade:
+            print "Intents were Constant"
+            print changesMade
        # main.ONOS1.add_flow(main.params['FLOWDEF']['testONip'],main.params['FLOWDEF']['user'],main.params['FLOWDEF']['password'],main.params['FLOWDEF']['flowDef'])
         main.case("Checking flows")
        
@@ -194,6 +242,38 @@
         main.step("Verifying the result")
         utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Flow check PASS",onfail="Flow check FAIL")
 
+
+        main.Mininet2.pingLong(src=main.params['PING']['source1'],target=main.params['PING']['target1'],pingTime=5)
+        main.Mininet2.pingLong(src=main.params['PING']['source2'],target=main.params['PING']['target2'],pingTime=5)
+        main.Mininet2.pingLong(src=main.params['PING']['source3'],target=main.params['PING']['target3'],pingTime=5)
+        main.Mininet2.pingLong(src=main.params['PING']['source4'],target=main.params['PING']['target4'],pingTime=5)
+        main.Mininet2.pingLong(src=main.params['PING']['source5'],target=main.params['PING']['target5'],pingTime=5)
+        main.Mininet2.pingLong(src=main.params['PING']['source6'],target=main.params['PING']['target6'],pingTime=5)
+        main.Mininet2.pingLong(src=main.params['PING']['source7'],target=main.params['PING']['target7'],pingTime=5)
+        main.Mininet2.pingLong(src=main.params['PING']['source8'],target=main.params['PING']['target8'],pingTime=5)
+        main.Mininet2.pingLong(src=main.params['PING']['source9'],target=main.params['PING']['target9'],pingTime=5)
+        main.Mininet2.pingLong(src=main.params['PING']['source10'],target=main.params['PING']['target10'],pingTime=5)
+        main.step("Check that the pings are going") 
+        result = main.Mininet2.pingstatus(src=main.params['PING']['source1'])
+        result = result & main.Mininet2.pingstatus(src=main.params['PING']['source2'])
+        result = result & main.Mininet2.pingstatus(src=main.params['PING']['source3'])
+        result = result & main.Mininet2.pingstatus(src=main.params['PING']['source4'])
+        result = result & main.Mininet2.pingstatus(src=main.params['PING']['source5'])
+        result = result & main.Mininet2.pingstatus(src=main.params['PING']['source6'])
+        result = result & main.Mininet2.pingstatus(src=main.params['PING']['source7'])
+        result = result & main.Mininet2.pingstatus(src=main.params['PING']['source8'])
+        result = result & main.Mininet2.pingstatus(src=main.params['PING']['source9'])
+        result = result & main.Mininet2.pingstatus(src=main.params['PING']['source10'])
+        time.sleep(20)
+        main.Mininet2.pingKill()
+        if main.Mininet2.checkForLoss(fileName="/tmp/ping.h10"):
+            main.log.info("LOSS FOUND!!!")
+        else:
+            main.log.info("No Loss of Packets!!!")
+
+
+         
+        
 #**********************************************************************************************************************************************************************************************
 #This test case removes Controllers 2,3, and 4 then performs a ping test.
 #The assign controller is used because the ovs-vsctl module deletes all current controllers when a new controller is assigned.
@@ -978,7 +1058,19 @@
         else:
             main.log.report("\tINTENT FAILED TO BE DELETED")
         utilities.assert_equals(expect=main.TRUE,actual=result,onpass="Intent Deleted Properly - Step Passed",onfail="INTENT NOT DELETED - STEP FAILED")
-        main.ONOS1.del_intent(intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
+        #main.ONOS1.del_intent(intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
+        main.ONOS1.add_intent(intent_id=str(10),src_dpid="00:00:00:00:00:00:10:67",dst_dpid="00:00:00:00:00:32:21:10",src_mac="00:00:00:01:11:11",dst_mac="00:12:12:12:12:12",intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
+
+
+
+#*****************************************************************************************
+#*****************************************************************************************
+# Delete all intents, and ensure that all flows were deleted
+# Will delete, then call for intents.
+# Lastly try a ping test to check that all flows are deleted. 
+#*****************************************************************************************
+#*****************************************************************************************
+        main.step("Deleting all flows and check that they are all gone")
 
 
 #*****************************************************************************************
@@ -993,7 +1085,7 @@
         main.step("Installing incorrect intent and checking for deletion")
         main.ONOS1.add_intent(intent_id=str(200),src_dpid="00:00:00:00:00:00:45:67",dst_dpid="00:00:00:00:00:32:21:10",src_mac="00:00:00:01:11:11",dst_mac="00:12:12:12:12:12",intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
         main.ONOS1.show_intent(intent_id=str(200),intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
-        main.ONOS1.del_intent(intent_id=str(200),intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
+        main.ONOS1.del_intent(intent_id="intent_id=200",intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
         time.sleep(2)
         response = main.ONOS1.show_intent(intentIP=intentIP,intentPort=intentPort,intentURL=intentURL,intent_id=200)
         if re.search("INTENT_NOT_FOUND",response):
diff --git a/TestON/tests/JamesTest/intentsHigh.txt b/TestON/tests/JamesTest/intentsHigh.txt
new file mode 100644
index 0000000..2d0136d
--- /dev/null
+++ b/TestON/tests/JamesTest/intentsHigh.txt
@@ -0,0 +1 @@
+[{"id":"1:21","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:20:36","srcPortNumber":"1","srcMac":"00:00:00:00:00:15","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:10:11","dstPortNumber":"1","dstMac":"00:00:00:00:00:0b","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342954989518098","setState, oldState:CREATED, newState:INST_REQ, time:342954990247919","setState, oldState:INST_REQ, newState:INST_ACK, time:342955016855087","setState, oldState:INST_ACK, newState:INST_ACK, time:342955029936391"]},{"id":"1:12","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:10:12","srcPortNumber":"1","srcMac":"00:00:00:00:00:0c","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:20:37","dstPortNumber":"1","dstMac":"00:00:00:00:00:16","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342955001880348","setState, oldState:CREATED, newState:INST_REQ, time:342955001942196","setState, oldState:INST_REQ, newState:INST_ACK, time:342955066469194"]},{"id":"1:13","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:10:13","srcPortNumber":"1","srcMac":"00:00:00:00:00:0d","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:20:38","dstPortNumber":"1","dstMac":"00:00:00:00:00:17","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342955037009378","setState, oldState:CREATED, newState:INST_REQ, time:342955057204350","setState, oldState:INST_REQ, newState:INST_ACK, time:342955109843115"]},{"id":"1:22","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:20:37","srcPortNumber":"1","srcMac":"00:00:00:00:00:16","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:10:12","dstPortNumber":"1","dstMac":"00:00:00:00:00:0c","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342955017825966","setState, oldState:CREATED, newState:INST_REQ, time:342955020827141","setState, oldState:INST_REQ, newState:INST_ACK, time:342955036958151","setState, oldState:INST_ACK, newState:INST_ACK, time:342955067089568"]},{"id":"1:23","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:20:38","srcPortNumber":"1","srcMac":"00:00:00:00:00:17","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:10:13","dstPortNumber":"1","dstMac":"00:00:00:00:00:0d","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342955078657886","setState, oldState:CREATED, newState:INST_REQ, time:342955078719125","setState, oldState:INST_REQ, newState:INST_ACK, time:342955151788326","setState, oldState:INST_ACK, newState:INST_ACK, time:342955172199848"]},{"id":"1:10","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:10:10","srcPortNumber":"1","srcMac":"00:00:00:00:00:0a","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:20:35","dstPortNumber":"1","dstMac":"00:00:00:00:00:14","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342954934875925","setState, oldState:CREATED, newState:INST_REQ, time:342954934944636","setState, oldState:INST_REQ, newState:INST_ACK, time:342954962841723"]},{"id":"1:24","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:20:39","srcPortNumber":"1","srcMac":"00:00:00:00:00:18","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:10:14","dstPortNumber":"1","dstMac":"00:00:00:00:00:0e","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342955193091906","setState, oldState:CREATED, newState:INST_REQ, time:342955193170354","setState, oldState:INST_REQ, newState:INST_ACK, time:342955217289973","setState, oldState:INST_ACK, newState:INST_ACK, time:342955240396703"]},{"id":"1:11","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:10:11","srcPortNumber":"1","srcMac":"00:00:00:00:00:0b","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:20:36","dstPortNumber":"1","dstMac":"00:00:00:00:00:15","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342954970890675","setState, oldState:CREATED, newState:INST_REQ, time:342954972623090","setState, oldState:INST_REQ, newState:INST_ACK, time:342954990005267"]},{"id":"1:25","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:20:40","srcPortNumber":"1","srcMac":"00:00:00:00:00:19","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:10:15","dstPortNumber":"1","dstMac":"00:00:00:00:00:0f","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342955219610331","setState, oldState:CREATED, newState:INST_REQ, time:342955229618793","setState, oldState:INST_REQ, newState:INST_ACK, time:342955255256696","setState, oldState:INST_ACK, newState:INST_ACK, time:342955321503127"]},{"id":"1:16","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:20:31","srcPortNumber":"1","srcMac":"00:00:00:00:00:10","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:10:06","dstPortNumber":"1","dstMac":"00:00:00:00:00:06","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342954777534217","setState, oldState:CREATED, newState:INST_REQ, time:342954777610189","setState, oldState:INST_REQ, newState:INST_ACK, time:342954799456100","setState, oldState:INST_ACK, newState:INST_ACK, time:342954805786438"]},{"id":"1:17","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:20:32","srcPortNumber":"1","srcMac":"00:00:00:00:00:11","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:10:07","dstPortNumber":"1","dstMac":"00:00:00:00:00:07","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342954818753786","setState, oldState:CREATED, newState:INST_REQ, time:342954818825415","setState, oldState:INST_REQ, newState:INST_ACK, time:342954837494403","setState, oldState:INST_ACK, newState:INST_ACK, time:342954849744029"]},{"id":"1:14","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:10:14","srcPortNumber":"1","srcMac":"00:00:00:00:00:0e","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:20:39","dstPortNumber":"1","dstMac":"00:00:00:00:00:18","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342955119250545","setState, oldState:CREATED, newState:INST_REQ, time:342955119327278","setState, oldState:INST_REQ, newState:INST_ACK, time:342955212539535"]},{"id":"1:15","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:10:15","srcPortNumber":"1","srcMac":"00:00:00:00:00:0f","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:20:40","dstPortNumber":"1","dstMac":"00:00:00:00:00:19","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342955206543145","setState, oldState:CREATED, newState:INST_REQ, time:342955206598632","setState, oldState:INST_REQ, newState:INST_ACK, time:342955244230667"]},{"id":"1:8","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:10:08","srcPortNumber":"1","srcMac":"00:00:00:00:00:08","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:20:33","dstPortNumber":"1","dstMac":"00:00:00:00:00:12","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342954840432768","setState, oldState:CREATED, newState:INST_REQ, time:342954841963557","setState, oldState:INST_REQ, newState:INST_ACK, time:342954885578977"]},{"id":"1:7","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:10:07","srcPortNumber":"1","srcMac":"00:00:00:00:00:07","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:20:32","dstPortNumber":"1","dstMac":"00:00:00:00:00:11","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342954794382192","setState, oldState:CREATED, newState:INST_REQ, time:342954794456241","setState, oldState:INST_REQ, newState:INST_ACK, time:342954829521040"]},{"id":"1:6","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:10:06","srcPortNumber":"1","srcMac":"00:00:00:00:00:06","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:20:31","dstPortNumber":"1","dstMac":"00:00:00:00:00:10","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342954756676678","setState, oldState:CREATED, newState:INST_REQ, time:342954756754118","setState, oldState:INST_REQ, newState:INST_ACK, time:342954791322748"]},{"id":"1:20","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:20:35","srcPortNumber":"1","srcMac":"00:00:00:00:00:14","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:10:10","dstPortNumber":"1","dstMac":"00:00:00:00:00:0a","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342954950472615","setState, oldState:CREATED, newState:INST_REQ, time:342954950548932","setState, oldState:INST_REQ, newState:INST_ACK, time:342954969685306","setState, oldState:INST_ACK, newState:INST_ACK, time:342954977191044"]},{"id":"1:9","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:10:09","srcPortNumber":"1","srcMac":"00:00:00:00:00:09","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:20:34","dstPortNumber":"1","dstMac":"00:00:00:00:00:13","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342954887372916","setState, oldState:CREATED, newState:INST_REQ, time:342954887444460","setState, oldState:INST_REQ, newState:INST_ACK, time:342954945549202"]},{"id":"1:19","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:20:34","srcPortNumber":"1","srcMac":"00:00:00:00:00:13","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:10:09","dstPortNumber":"1","dstMac":"00:00:00:00:00:09","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342954916765288","setState, oldState:CREATED, newState:INST_REQ, time:342954918481103","setState, oldState:INST_REQ, newState:INST_ACK, time:342954943450046","setState, oldState:INST_ACK, newState:INST_ACK, time:342954959114541"]},{"id":"1:18","state":"INST_ACK","pathFrozen":"false","srcSwitchDpid":"00:00:00:00:00:00:20:33","srcPortNumber":"1","srcMac":"00:00:00:00:00:12","srcIp":"0.0.0.0","dstSwitchDpid":"00:00:00:00:00:00:10:08","dstPortNumber":"1","dstMac":"00:00:00:00:00:08","dstIp":"0.0.0.0","idleTimeout":"0","hardTimeout":"0","firstSwitchIdleTimeout":"0","firstSwitchHardTimeout":"0","logs":["created, time:342954872490248","setState, oldState:CREATED, newState:INST_REQ, time:342954874209159","setState, oldState:INST_REQ, newState:INST_ACK, time:342954915646785","setState, oldState:INST_ACK, newState:INST_ACK, time:342954927676302"]}]
\ No newline at end of file