mirror of
https://github.com/vyos/vyos-build.git
synced 2025-10-01 20:28:40 +02:00
Testsuite: add basic configuration/operation mode testcase
This commit is contained in:
parent
e62250029e
commit
237f8a05ff
@ -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
|
||||
#################################################
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user