Merge "Remove unneeded path ammendment and imports"
diff --git a/TestON/tests/CHOtest/CHOtest.params b/TestON/tests/CHOtest/CHOtest.params
index 31b4e08..44a9858 100644
--- a/TestON/tests/CHOtest/CHOtest.params
+++ b/TestON/tests/CHOtest/CHOtest.params
@@ -26,7 +26,7 @@
     </CTRL>
 
     <TOPO1>
-        <topo>~/mininet/custom/topoAtt.py</topo>
+        <topo>~/TestON/tests/CHOtest/Dependencies/topoAtt.py</topo>
         <numSwitches>25</numSwitches>
         <numHosts>25</numHosts>
         <numLinks>114</numLinks>
@@ -34,7 +34,7 @@
     </TOPO1>
 
     <TOPO2>
-        <topo>~/mininet/custom/topoChordal.py</topo>
+        <topo>~/TestON/tests/CHOtest/Dependencies/topoChordal.py</topo>
         <numSwitches>25</numSwitches>
         <numHosts>25</numHosts>
         <numLinks>600</numLinks>
@@ -42,7 +42,7 @@
     </TOPO2>
 
     <TOPO3>
-        <topo>~/mininet/custom/topoSpine.py</topo>
+        <topo>~/TestON/tests/CHOtest/Dependencies/topoSpine.py</topo>
         <numSwitches>78</numSwitches>
         <numHosts>68</numHosts>
         <numLinks>284</numLinks>
@@ -84,4 +84,4 @@
         <SwitchDiscovery>10</SwitchDiscovery>
     </timers>
 
-</PARAMS>
\ No newline at end of file
+</PARAMS>
diff --git a/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py b/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py
index 545aca9..11ca425 100644
--- a/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py
+++ b/TestON/tests/FUNCintent/Dependency/FuncIntentFunction.py
@@ -1122,3 +1122,39 @@
 
     return main.TRUE
 
+def checkLeaderChange( leaders1 , leaders2 ):
+    """
+        Checks for a change in intent partition leadership.
+
+        Takes the output of leaders -c in json string format before and after
+        a potential change as input
+
+        Returns main.TRUE if no mismatches are detected
+        Returns main.FALSE if there is a mismatch or on error loading the input
+    """
+    try:
+        leaders1 = json.loads( leaders1 )
+        leaders2 = json.loads( leaders2 )
+    except ( AttributeError, TypeError):
+        main.log.exception( self.name + ": Object not as expected" )
+        return main.FALSE
+    except Exception:
+        main.log.exception( self.name + ": Uncaught exception!" )
+        main.cleanup()
+        main.exit()
+    main.log.info( "Checking Intent Paritions for Change in Leadership" )
+    mismatch = False
+    for dict1 in leaders1:
+        if "intent" in dict1.get( "topic", [] ):
+            for dict2 in leaders2:
+                if dict1.get( "topic", 0 ) == dict2.get( "topic", 0 ) and \
+                    dict1.get( "leader", 0 ) != dict2.get( "leader", 0 ):
+                    mismatch = True
+                    main.log.error( "{0} changed leader from {1} to {2}".\
+                        format( dict1.get( "topic", "no-topic" ),\
+                            dict1.get( "leader", "no-leader" ),\
+                            dict2.get( "leader", "no-leader" ) ) )
+    if mismatch:
+        return main.FALSE
+    else:
+        return main.TRUE
diff --git a/TestON/tests/FUNCintent/FUNCintent.py b/TestON/tests/FUNCintent/FUNCintent.py
index 1e10db3..fbf12a5 100644
--- a/TestON/tests/FUNCintent/FUNCintent.py
+++ b/TestON/tests/FUNCintent/FUNCintent.py
@@ -97,6 +97,7 @@
         else:
             main.log.warn( "Did not pull new code so skipping mvn " +
                            "clean install" )
+        main.ONOSbench.getVersion( report=True )
 
     def CASE2( self, main ):
         """
@@ -347,6 +348,8 @@
         assert main.numSwitch, "Placed the total number of switch topology in \
                                 main.numSwitch"
 
+        intentLeadersOld = main.CLIs[ 0 ].leaderCandidates()
+
         main.case( "Add host intents between 2 host" )
 
         main.step( "IPV4: Add host intents between h1 and h9" )
@@ -446,6 +449,11 @@
                                  onfail="VLAN2: Add inter vlan host" +
                                         " intent failed" )
 
+
+        intentLeadersNew = main.CLIs[ 0 ].leaderCandidates()
+        main.intentFunction.checkLeaderChange( intentLeadersOld,
+                                                intentLeadersNew )
+
     def CASE2000( self, main ):
         """
             Add point intents between 2 hosts:
@@ -638,7 +646,7 @@
                                  actual=stepResult,
                                  onpass="DUALSTACK1: Add point intent" +
                                         " successful",
-                                 onfail="DUALSTACK1: Add point intent failed" ) 
+                                 onfail="DUALSTACK1: Add point intent failed" )
 
         main.step( "VLAN: Add point intents between h5 and h21" )
         stepResult = main.TRUE
@@ -803,7 +811,7 @@
                                  onpass="VLAN: Successfully added single point"
                                         + " to multi point intents",
                                  onfail="VLAN: Failed to add single point" +
-                                        " to multi point intents" ) 
+                                        " to multi point intents" )
 
     def CASE4000( self, main ):
         """