Avoid adding overlapping intents in CHOTestMonkey

Change-Id: I5bedabb47ed44ad1083c3e40631ed818f787dbaf
diff --git a/TestON/tests/CHOTestMonkey/dependencies/elements/ONOSElement.py b/TestON/tests/CHOTestMonkey/dependencies/elements/ONOSElement.py
index 17e9e73..e9dff29 100644
--- a/TestON/tests/CHOTestMonkey/dependencies/elements/ONOSElement.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/elements/ONOSElement.py
@@ -58,7 +58,6 @@
 
     def setWithdrawn( self ):
         self.expectedState = 'WITHDRAWN'
-        # TODO: should we check whether hostA and hostB are made correspondents by other intents/flows?
         if self.hostB in self.hostA.correspondents:
             self.hostA.correspondents.remove( self.hostB )
         if self.hostA in self.hostB.correspondents:
@@ -66,17 +65,12 @@
 
     def setFailed( self ):
         self.expectedState = 'FAILED'
-        # TODO: should we check whether hostA and hostB are made correspondents by other intents/flows?
-        if self.hostB in self.hostA.correspondents:
-            self.hostA.correspondents.remove( self.hostB )
-        if self.hostA in self.hostB.correspondents:
-            self.hostB.correspondents.remove( self.hostA )
 
     def setInstalled( self ):
+        if self.expectedState == 'UNKNOWN':
+            self.hostA.correspondents.append( self.hostB )
+            self.hostB.correspondents.append( self.hostA )
         self.expectedState = 'INSTALLED'
-        # TODO: should we check whether hostA and hostB are already correspondents?
-        self.hostA.correspondents.append( self.hostB )
-        self.hostB.correspondents.append( self.hostA )
 
     def __str__( self ):
         return "ID: " + self.id
@@ -97,16 +91,13 @@
 
     def setFailed( self ):
         self.expectedState = 'FAILED'
-        for hostA in self.deviceA.hosts:
-            for hostB in self.deviceB.hosts:
-                if hostB in hostA.correspondents:
-                    hostA.correspondents.remove( hostB )
 
     def setInstalled( self ):
+        if self.expectedState == 'UNKNOWN':
+            for hostA in self.deviceA.hosts:
+                for hostB in self.deviceB.hosts:
+                    hostA.correspondents.append( hostB )
         self.expectedState = 'INSTALLED'
-        for hostA in self.deviceA.hosts:
-            for hostB in self.deviceB.hosts:
-                hostA.correspondents.append( hostB )
 
     def __str__( self ):
         return "ID: " + self.id