Merged conflicts
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 914ce45..93e1895 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -398,6 +398,48 @@
handle_after + handle_more)
return main.TRUE
+ 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()
+
+
+ def onos_install(self, options="-f", node = ""):
+ '''
+ Installs ONOS bits on the designated cell machine.
+ If -f option is provided, it also forces an uninstall.
+ Presently, install also includes onos-push-bits and
+ onos-config within.
+ The node option allows you to selectively only push the jar
+ files to certain onos nodes
+
+ Returns: main.TRUE on success and main.FALSE on failure
+ '''
+ try:
+ self.handle.sendline("onos-install " + options + " " + node)
+ self.handle.expect("onos-install ")
+ #NOTE: this timeout may need to change depending on the network and size of ONOS
+ i=self.handle.expect(["Network\sis\sunreachable",
+ "onos\sstart/running,\sprocess",
+ pexpect.TIMEOUT],timeout=60)
+
+
+ if i == 0:
+ main.log.warn("Network is unreachable")
+ return main.FALSE
+ elif i == 1:
+ main.log.info("ONOS was installed on the VM and started")
+ return main.TRUE
+ elif i == 2:
+ main.log.info("Installation of ONOS on the VM timed out")
+ return main.FALSE
except pexpect.EOF:
main.log.error(self.name + ": EOF exception found")
@@ -437,7 +479,6 @@
main.log.error("ONOS service failed to start")
main.cleanup()
main.exit()
-
except pexpect.EOF:
main.log.error(self.name + ": EOF exception found")
main.log.error(self.name + ": " + self.handle.before)
@@ -450,7 +491,34 @@
main.cleanup()
main.exit()
+ def isup(self, node = ""):
+ '''
+ Run's onos-wait-for-start which only returns once ONOS is at run level 100(ready for use)
-
-
-
+ Returns: main.TRUE if ONOS is running and main.FALSE on timeout
+ '''
+ try:
+ self.handle.sendline("onos-wait-for-start " + node )
+ self.handle.expect("onos-wait-for-start")
+ #NOTE: this timeout is arbitrary"
+ i = self.handle.expect(["\$", pexpect.TIMEOUT], timeout = 120)
+ if i == 0:
+ main.log.info(self.name + ": " + node + " is up")
+ return main.TRUE
+ elif i == 1:
+ #NOTE: since this function won't return until ONOS is ready,
+ # we will kill it on timeout
+ self.handle.sendline("\003") #Control-C
+ self.handle.expect("\$")
+ 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/tests/ONOSNextTest/ONOSNextTest.py b/TestON/tests/ONOSNextTest/ONOSNextTest.py
index 9e790a5..a49a73d 100755
--- a/TestON/tests/ONOSNextTest/ONOSNextTest.py
+++ b/TestON/tests/ONOSNextTest/ONOSNextTest.py
@@ -24,11 +24,11 @@
cell_name = main.params['ENV']['cellName']
ONOS1_ip = main.params['CTRL']['ip1']
-
+
main.case("Setting up test environment")
main.step("Using mvn clean & compile")
- install_result = main.ONOSbench.clean_install()
+ clean_install_result = main.ONOSbench.clean_install()
main.step("Creating ONOS package")
package_result = main.ONOSbench.onos_package()
@@ -36,14 +36,17 @@
main.step("Applying cell variable to environment")
cell_result = main.ONOSbench.set_cell(cell_name)
verify_result = main.ONOSbench.verify_cell()
+
+ main.step("Installing ONOS package")
+ onos_install_result = main.ONOSbench.onos_install()
+ onos1_isup = main.ONOSbench.isup()
main.step("Starting ONOS service")
start_result = main.ONOSbench.onos_start(ONOS1_ip)
-
-
- case1_result = (install_result and package_result and\
- cell_result and verify_result and start_result)
+ case1_result = (clean_install_result and package_result and\
+ cell_result and verify_result and onos_install_result\
+ and onos1_isup and start_result)
utilities.assert_equals(expect=main.TRUE, actual=case1_result,
onpass="Test startup successful",
onfail="Test startup NOT successful")