From 237f8a05ffa9bd5a360749b256b3e6318907e5e6 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Fri, 27 Dec 2019 20:14:35 +0200 Subject: Testsuite: add basic configuration/operation mode testcase --- scripts/check-qemu-install | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'scripts/check-qemu-install') 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 ################################################# -- cgit v1.2.3