summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-12-27 20:14:35 +0200
committerChristian Poessinger <christian@poessinger.com>2019-12-27 20:14:35 +0200
commit237f8a05ffa9bd5a360749b256b3e6318907e5e6 (patch)
treeb9effc71fa9310af059d94232e2ebf3f9e170faf /scripts
parente62250029efd737cce0407ef855d10cdd56f67a0 (diff)
downloadvyos-build-237f8a05ffa9bd5a360749b256b3e6318907e5e6.tar.gz
vyos-build-237f8a05ffa9bd5a360749b256b3e6318907e5e6.zip
Testsuite: add basic configuration/operation mode testcase
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/check-qemu-install24
1 files changed, 10 insertions, 14 deletions
diff --git a/scripts/check-qemu-install b/scripts/check-qemu-install
index dc53108c..ef1a0f13 100755
--- a/scripts/check-qemu-install
+++ b/scripts/check-qemu-install
@@ -32,7 +32,6 @@
# [--silent] only print on errors
# [--debug] print all communication with the device
-
import pexpect
import sys
import os
@@ -49,7 +48,6 @@ from datetime import datetime
EXCEPTION = 0
now = datetime.now()
-
parser = argparse.ArgumentParser(description='Install and start a test VyOS vm.')
parser.add_argument('iso', help='ISO file to install')
parser.add_argument('disk', help='name of disk image file',
@@ -102,7 +100,7 @@ log = logging.getLogger()
log.setLevel(logging.DEBUG)
stl = StreamToLogger(log)
-formatter = logging.Formatter('- %(levelname)5s - %(message)s')
+formatter = logging.Formatter('%(levelname)5s - %(message)s')
handler = logging.StreamHandler(sys.stdout)
if args.silent:
@@ -115,15 +113,12 @@ else:
handler.setFormatter(formatter)
log.addHandler(handler)
-
if args.logfile:
filehandler = logging.FileHandler(args.logfile)
filehandler.setLevel(logging.DEBUG)
filehandler.setFormatter(formatter)
log.addHandler(filehandler)
-
-
if args.silent:
output = BytesIO()
else:
@@ -143,7 +138,6 @@ else:
kvm=True
# Creating diskimage!!
-
if not os.path.isfile(args.disk):
log.info("Creating Disk image {}".format(args.disk))
c = subprocess.check_output(["qemu-img", "create", args.disk, "2G"])
@@ -151,8 +145,6 @@ if not os.path.isfile(args.disk):
else:
log.info("Diskimage already exists, using the existing one")
-
-
try:
#################################################
# Installing image to disk
@@ -192,7 +184,6 @@ try:
c.expect(r'vyos@vyos:~\$')
log.info('Logged in!')
-
#################################################
# Installing into VyOS system
#################################################
@@ -242,7 +233,6 @@ try:
log.error("VM Did not shut down after 300sec, killing")
c.close()
-
#################################################
# Booting installed system
#################################################
@@ -281,7 +271,15 @@ try:
c.expect(r'vyos@vyos:~\$')
log.info('Logged in!')
-
+ #################################################
+ # Basic Configmode/Opmode switch
+ #################################################
+ log.info("Basic CLI configuration mode test")
+ c.sendline('configure')
+ c.expect(r'vyos@vyos#')
+ c.sendline('run show version')
+ c.sendline('exit')
+ c.expect(r'vyos@vyos:~\$')
#################################################
# Executing test-suite
@@ -342,8 +340,6 @@ except Exception:
traceback.print_exc()
EXCEPTION = 1
-
-
#################################################
# Cleaning up
#################################################