Merge branch 'ONOS-Next' of https://github.com/OPENNETWORKINGLAB/ONLabTest into ONOS-Next
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index 419ee06..9875064 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -866,6 +866,7 @@
2. numpy - "sudo pip install numpy"
'''
+ #FIXME: this does not look for extra ports in ONOS, only checks that ONOS has what is in MN
import json
from numpy import uint64
port_results = main.TRUE
@@ -932,6 +933,7 @@
This uses the sts TestONTopology object
'''
+ #FIXME: this does not look for extra links in ONOS, only checks that ONOS has what is in MN
import json
link_results = main.TRUE
output = {"switches":[]}
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index eeb379f..4d4a417 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -1348,4 +1348,45 @@
main.log.info(self.name+" ::::::")
main.cleanup()
main.exit()
+
+ def device_role(self, device_id, onos_node, role="master"):
+ '''
+ Calls the device-role cli command.
+ device_id must be the id of a device as seen in the onos devices command
+ onos_node is the ip of one of the onos nodes in the cluster
+ role must be either master, standby, or none
+
+ Returns main.TRUE or main.FALSE based argument varification.
+ When device-role supports errors this should be extended to
+ support that output
+ '''
+ #TODO: handle error messages from device-role
+ try:
+ print "beginning device_role... \n\tdevice_id:" + device_id
+ print "\tonos_node: " + onos_node
+ print "\trole: "+ role
+ if role.lower() == "master" or \
+ role.lower() == "standby" or \
+ role.lower() == "none":
+ self.handle.sendline("")
+ self.handle.expect("onos>")
+ self.handle.sendline("device-role " + device_id + " " + onos_node + " " + role)
+ self.handle.expect("onos>")
+ return main.TRUE
+ else:
+ return main.FALSE
+
+ except pexpect.EOF:
+ main.log.error(self.name + ": EOF exception found")
+ main.log.error(self.name + ": " + self.handle.before)
+ main.cleanup()
+ main.exit()
+ except:
+ main.log.info(self.name+" ::::::")
+ main.log.error( traceback.print_exc())
+ main.log.info(self.name+" ::::::")
+ main.cleanup()
+ main.exit()
+
+
#***********************************
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 2fd113e..c8b974f 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -201,8 +201,8 @@
Otherwise, this function will perform a git pull in the
ONOS repository. If it has any problems, it will return main.ERROR
- If it successfully does a git_pull, it will return a 1.
- If it has no updates, it will return a 0.
+ If it successfully does a git_pull, it will return a 1 (main.TRUE)
+ If it has no updates, it will return 3.
'''
try:
@@ -237,10 +237,10 @@
elif i==2:
main.log.info(self.name + ": Git Pull - pulling repository now")
self.handle.expect("ONOS\$", 120)
- return i # So that only when git pull is done, we do mvn clean compile
+ return main.TRUE # So that only when git pull is done, we do mvn clean compile
elif i==3:
main.log.info(self.name + ": Git Pull - Already up to date")
- return main.TRUE
+ return i
elif i==4:
main.log.info(self.name + ": Git Pull - Aborting... Are there conflicting git files?")
return main.ERROR