Created zookeeper driver func findMaster to determine the master controller for a switch - James
diff --git a/TestON/drivers/common/cli/zookeeperclidriver.py b/TestON/drivers/common/cli/zookeeperclidriver.py
index abfcb69..5d9396e 100644
--- a/TestON/drivers/common/cli/zookeeperclidriver.py
+++ b/TestON/drivers/common/cli/zookeeperclidriver.py
@@ -50,6 +50,8 @@
for key in connectargs:
vars(self)[key] = connectargs[key]
self.home = "~/ONOS"
+ self.zkhome = "~/zookeeper-3.4.6"
+ self.clustername = "sanity-rc-onos"
#self.home = "~/zookeeper-3.4.5"
for key in self.options:
if key == "home":
@@ -129,6 +131,28 @@
main.log.error(self.name + ": Connection failed to the host")
response = main.FALSE
return response
+
+ def findMaster(self, switchDPID, ip="localhost"):
+ 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)
+ 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!"
def isup(self):
'''
diff --git a/TestON/tests/JamesTest/JamesTest.py b/TestON/tests/JamesTest/JamesTest.py
index 72f4a44..e4fabda 100644
--- a/TestON/tests/JamesTest/JamesTest.py
+++ b/TestON/tests/JamesTest/JamesTest.py
@@ -769,6 +769,13 @@
else:
break
+#*****************************************************************************************
+#*****************************************************************************************
+# CASE101:
+# This case is designed to test the intents framework
+# It will cover Installation, Deletion, Rerouting, and Calling of Intents
+#*****************************************************************************************
+#*****************************************************************************************
def CASE101(self,main) :
@@ -896,6 +903,7 @@
srcDPID= '00:00:00:00:00:00:20:' +str(i+25)
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
+ main.ONOS1.show_intent(intentIP=intentIP,intentPort=intentPort,intentURL=intentURL)
result = main.TRUE
response = main.Mininet1.check_flows(sw="s1")
print(response)
@@ -964,7 +972,7 @@
main.log.error("Intent was not deleted correctly")
result = main.FALSE
else:
- main.log.info("So far so good, attempting "+str(4-count) + " more times")
+ main.log.info("So far so good, attempting "+str(2-count) + " more times")
if result == main.TRUE:
main.log.report("\tIntent Deleted!")
else:
@@ -984,8 +992,14 @@
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)
+ time.sleep(2)
+ response = main.ONOS1.show_intent(intentIP=intentIP,intentPort=intentPort,intentURL=intentURL,intent_id=200)
+ if re.search("INTENT_NOT_FOUND",response):
+ main.log.report("Intent Removed Properly!")
+ else:
+ main.log.report("ERROR REMOVING INTENT")