Fix and simplify regex to match ONOS 2.x CLI prompt
For some reason, some of the special terminal characters of the ONOS
2.2.1 prompt changed, and the current regex does not match it. The new
approach provides two regexs, the old one for ONOS 1.x, and a new much
simpler one for ONOS 2.x (karaf@root >), which does not consider special
terminal characters.
Change-Id: If2cd1bb297c5333d6353904420228eaebe608cf2
diff --git a/tests/atests/common/testCaseUtils.py b/tests/atests/common/testCaseUtils.py
index 124b4e0..e9784bb 100755
--- a/tests/atests/common/testCaseUtils.py
+++ b/tests/atests/common/testCaseUtils.py
@@ -82,9 +82,12 @@
child = pexpect.spawn('ssh -p 30115 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no karaf@%s' % host)
child.expect('[pP]assword:')
child.sendline('karaf')
- child.expect('(\\x1b\[\d*;?\d+m){1,2}(onos>|karaf@root >) (\\x1b\[\d*;?\d+m){1,2}')
+ # Expected prompt:
+ # onos> (ONOS 1.x)
+ # karaf@root > (ONOS 2.x)
+ child.expect(['(\\x1b\[\d*;?\d+m){1,2}onos> (\\x1b\[\d*;?\d+m){1,2}', 'karaf@root >'])
child.sendline(cmd)
- child.expect('(\\x1b\[\d*;?\d+m){1,2}(onos>|karaf@root >) (\\x1b\[\d*;?\d+m){1,2}')
+ child.expect(['(\\x1b\[\d*;?\d+m){1,2}onos> (\\x1b\[\d*;?\d+m){1,2}', 'karaf@root >'])
output.write(child.before)