mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-31 21:13:00 +02:00
tests: Update some typos in test steps
Also add missing ipv4_autoconf test from specification
This commit is contained in:
@@ -9,6 +9,8 @@ include::ipv4_address/Readme.adoc[]
|
||||
|
||||
include::ipv6_address/Readme.adoc[]
|
||||
|
||||
include::ipv4_autoconf/Readme.adoc[]
|
||||
|
||||
include::iface_phys_address/Readme.adoc[]
|
||||
|
||||
include::routing_basic/Readme.adoc[]
|
||||
|
||||
@@ -18,7 +18,8 @@ endif::topdoc[]
|
||||
. Initialize
|
||||
. Set custom MAC address to '02:01:00:c0:ff:ee' on target:mgmt
|
||||
. Verify target:mgmt has MAC address '02:01:00:c0:ff:ee'
|
||||
. Verify that target:mgmt has its origil MAC address again
|
||||
. Remove custom MAC address '02:01:00:c0:ff:ee'
|
||||
. Verify that target:mgmt has the original MAC address again
|
||||
|
||||
|
||||
<<<
|
||||
|
||||
@@ -36,11 +36,11 @@ with infamy.Test() as test:
|
||||
print(f"Target iface {tport} current mac: {mac}")
|
||||
assert mac == cmac
|
||||
|
||||
with test.step(f"Remove custom MAC address '02:01:00:c0:ff:ee'"):
|
||||
with test.step("Remove custom MAC address '02:01:00:c0:ff:ee'"):
|
||||
xpath=iface.get_iface_xpath(tport, "phys-address")
|
||||
target.delete_xpath(xpath)
|
||||
|
||||
with test.step("Verify that target:mgmt has its origil MAC address again"):
|
||||
with test.step("Verify that target:mgmt has the original MAC address again"):
|
||||
until(lambda: iface.get_phys_address(target, tport) == pmac)
|
||||
|
||||
test.succeed()
|
||||
|
||||
@@ -15,9 +15,10 @@ image::topology.png[Interface with IPv4 topology]
|
||||
endif::testgroup[]
|
||||
endif::topdoc[]
|
||||
==== Test sequence
|
||||
. Connect to target
|
||||
. Set up topology and attach to target DUT
|
||||
. Configure IPv4 address 10.10.10.20/24 on target:mgmt
|
||||
. Verify '10.10.10.20/24' exist on target:mgmt
|
||||
. Remove all IPv4 addresses from target:mgmt
|
||||
. Verify target:mgmt no longer has the address 10.10.10.20
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ new_ip_address = "10.10.10.20"
|
||||
new_prefix_length = 24
|
||||
|
||||
with infamy.Test() as test:
|
||||
with test.step("Connect to target"):
|
||||
with test.step("Set up topology and attach to target DUT"):
|
||||
env = infamy.Env()
|
||||
target = env.attach("target", "mgmt")
|
||||
_, interface_name = env.ltop.xlate("target", "mgmt")
|
||||
@@ -42,8 +42,9 @@ with infamy.Test() as test:
|
||||
with test.step("Verify '10.10.10.20/24' exist on target:mgmt"):
|
||||
until(lambda: iface.address_exist(target, interface_name, new_ip_address, proto='static'))
|
||||
|
||||
with test.step(f"Remove all IPv4 addresses from target:mgmt"):
|
||||
with test.step("Remove all IPv4 addresses from target:mgmt"):
|
||||
target.delete_xpath(f"/ietf-interfaces:interfaces/interface[name='{interface_name}']/ietf-ip:ipv4")
|
||||
|
||||
with test.step("Verify target:mgmt no longer has the address 10.10.10.20"):
|
||||
until(lambda: iface.address_exist(target, interface_name, new_ip_address) == False)
|
||||
|
||||
|
||||
@@ -17,12 +17,13 @@ image::topology.png[IPv4 link-local topology]
|
||||
endif::testgroup[]
|
||||
endif::topdoc[]
|
||||
==== Test sequence
|
||||
. Initialize
|
||||
. Configure an interface with IPv4 ZeroConf IP
|
||||
. Verify link local address exist on target:mgmt
|
||||
. Set up topology and attach to target DUT
|
||||
. Configure interface target:mgmt with IPv4 ZeroConf IP
|
||||
. Verify link-local address exist on target:mgmt
|
||||
. Configure target:mgmt with a specific IPv4 ZeroConf IP
|
||||
. Verify target:mgmt has link local address 169.254.42.42
|
||||
. Verify target:mgmt has link-local address 169.254.42.42
|
||||
. Remove IPv4 link-local addresses from target:mgmt
|
||||
. Verify link-local addresses has been removed from target:mgmt
|
||||
|
||||
|
||||
<<<
|
||||
|
||||
@@ -45,11 +45,11 @@ def no_linklocal(target, iface):
|
||||
|
||||
|
||||
with infamy.Test() as test:
|
||||
with test.step("Initialize"):
|
||||
with test.step("Set up topology and attach to target DUT"):
|
||||
env = infamy.Env()
|
||||
target = env.attach("target", "mgmt")
|
||||
|
||||
with test.step("Configure an interface with IPv4 ZeroConf IP"):
|
||||
with test.step("Configure interface target:mgmt with IPv4 ZeroConf IP"):
|
||||
_, tport = env.ltop.xlate("target", "data")
|
||||
|
||||
target.put_config_dict("ietf-interfaces", {
|
||||
@@ -68,7 +68,7 @@ with infamy.Test() as test:
|
||||
}
|
||||
})
|
||||
|
||||
with test.step("Verify link local address exist on target:mgmt"):
|
||||
with test.step("Verify link-local address exist on target:mgmt"):
|
||||
until(lambda: has_linklocal(target, tport), attempts=30)
|
||||
|
||||
with test.step("Configure target:mgmt with a specific IPv4 ZeroConf IP"):
|
||||
@@ -91,7 +91,7 @@ with infamy.Test() as test:
|
||||
}
|
||||
})
|
||||
|
||||
with test.step("Verify target:mgmt has link local address 169.254.42.42"):
|
||||
with test.step("Verify target:mgmt has link-local address 169.254.42.42"):
|
||||
until(lambda: has_linklocal(target, tport, request="169.254.42.42"),
|
||||
attempts=30)
|
||||
|
||||
@@ -99,6 +99,8 @@ with infamy.Test() as test:
|
||||
xpath = f"/ietf-interfaces:interfaces/interface[name='{tport}']" \
|
||||
"/ietf-ip:ipv4/infix-ip:autoconf"
|
||||
target.delete_xpath(xpath)
|
||||
|
||||
with test.step("Verify link-local addresses has been removed from target:mgmt"):
|
||||
until(lambda: no_linklocal(target, tport), attempts=30)
|
||||
|
||||
test.succeed()
|
||||
|
||||
@@ -15,8 +15,11 @@ image::topology.png[Add/delete user topology]
|
||||
endif::testgroup[]
|
||||
endif::topdoc[]
|
||||
==== Test sequence
|
||||
. Connect to device
|
||||
. Set up topology and attach to target DUT
|
||||
. Add new user 'newuser01' with password 'newuser01password'
|
||||
. Verify user 'newuser01' exist in operational
|
||||
. Delete user 'newuser01'
|
||||
. Verify erasure of user 'newuser01'
|
||||
. Verify that 'newuser01' is removed from /etc/passwd
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ username = "newuser01"
|
||||
password = "newuser01password"
|
||||
|
||||
with infamy.Test() as test:
|
||||
with test.step("Connect to device"):
|
||||
with test.step("Set up topology and attach to target DUT"):
|
||||
env = infamy.Env()
|
||||
target = env.attach("target", "mgmt")
|
||||
tgtssh = env.attach("target", "mgmt", "ssh")
|
||||
@@ -39,7 +39,7 @@ with infamy.Test() as test:
|
||||
}
|
||||
})
|
||||
|
||||
with test.step(f"Verify user 'newuser01' exist in operational"):
|
||||
with test.step("Verify user 'newuser01' exist in operational"):
|
||||
running = target.get_config_dict("/ietf-system:system")
|
||||
users = running["system"]["authentication"]["user"]
|
||||
user_found = False
|
||||
@@ -50,10 +50,10 @@ with infamy.Test() as test:
|
||||
break
|
||||
assert user_found, f"User 'newuser01' not found"
|
||||
|
||||
with test.step(f"Delete user 'newuser01'"):
|
||||
with test.step("Delete user 'newuser01'"):
|
||||
target.delete_xpath(f"/ietf-system:system/authentication/user[name='{username}']")
|
||||
|
||||
with test.step(f"Verify erasure of user 'newuser01'"):
|
||||
with test.step("Verify erasure of user 'newuser01'"):
|
||||
running = target.get_config_dict("/ietf-system:system")
|
||||
users = running["system"]["authentication"]["user"]
|
||||
for user in users:
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
=== Set hostname
|
||||
==== Description
|
||||
Verify that it is possible to change hostname.
|
||||
Verify that it is possible to change hostname both normal
|
||||
and using format %h-%m.
|
||||
|
||||
The format exapnds to <default hostname>-<MAC>,
|
||||
where MAC is the last three bytes of the base MAC address.
|
||||
|
||||
e.g. ix-01-01-01.
|
||||
|
||||
==== Topology
|
||||
ifdef::topdoc[]
|
||||
@@ -15,8 +21,12 @@ image::topology.png[Set hostname topology]
|
||||
endif::testgroup[]
|
||||
endif::topdoc[]
|
||||
==== Test sequence
|
||||
. Connect to device
|
||||
. Set up topology and attach to target DUT
|
||||
. Set hostname to 'h0stn4m3'
|
||||
. Verify new hostname 'h0stn4m3'
|
||||
. Set hostname to to '%h-%m'
|
||||
. Verify hostname is %h-%m in running configuration
|
||||
. Verify hostname format in operational, according to format
|
||||
|
||||
|
||||
<<<
|
||||
|
||||
@@ -2,7 +2,13 @@
|
||||
"""
|
||||
Set hostname
|
||||
|
||||
Verify that it is possible to change hostname.
|
||||
Verify that it is possible to change hostname both normal
|
||||
and using format %h-%m.
|
||||
|
||||
The format exapnds to <default hostname>-<MAC>,
|
||||
where MAC is the last three bytes of the base MAC address.
|
||||
|
||||
e.g. ix-01-01-01.
|
||||
"""
|
||||
import random
|
||||
import string
|
||||
@@ -10,7 +16,7 @@ import re
|
||||
import infamy
|
||||
|
||||
with infamy.Test() as test:
|
||||
with test.step("Connect to device"):
|
||||
with test.step("Set up topology and attach to target DUT"):
|
||||
env = infamy.Env()
|
||||
target = env.attach("target", "mgmt")
|
||||
tgtssh = env.attach("target", "mgmt", "ssh")
|
||||
@@ -24,27 +30,26 @@ with infamy.Test() as test:
|
||||
}
|
||||
})
|
||||
|
||||
with test.step(f"Verify new hostname 'h0stn4m3'"):
|
||||
with test.step("Verify new hostname 'h0stn4m3'"):
|
||||
running = target.get_config_dict("/ietf-system:system")
|
||||
assert running["system"]["hostname"] == new
|
||||
|
||||
with test.step(f"Set hostname format: %h-%m"):
|
||||
with test.step("Set hostname to to '%h-%m'"):
|
||||
target.put_config_dict("ietf-system", {
|
||||
"system": {
|
||||
"hostname": fmt,
|
||||
}
|
||||
})
|
||||
|
||||
with test.step(f"Verify hostname format in running: %h-%m"):
|
||||
with test.step("Verify hostname is %h-%m in running configuration"):
|
||||
running = target.get_config_dict("/ietf-system:system")
|
||||
if running["system"]["hostname"] != fmt:
|
||||
test.fail()
|
||||
|
||||
with test.step("Verify hostname format in operational, according to format"):
|
||||
cmd = tgtssh.runsh("sed -n s/^DEFAULT_HOSTNAME=//p /etc/os-release")
|
||||
default = cmd.stdout.rstrip()
|
||||
|
||||
with test.step(f"Verify hostname format in operational, according to format"):
|
||||
|
||||
oper = target.get_data("/ietf-system:system")
|
||||
name = oper["system"]["hostname"]
|
||||
pattern = rf'^{default}-([0-9a-fA-F]{{2}}-){{2}}[0-9a-fA-F]{{2}}$'
|
||||
|
||||
@@ -15,7 +15,7 @@ image::topology.png[Set timezone topology]
|
||||
endif::testgroup[]
|
||||
endif::topdoc[]
|
||||
==== Test sequence
|
||||
. Connect to device
|
||||
. Set up topology and attach to target DUT
|
||||
. Set timezone to Australia/Perth
|
||||
. Verify current time offset is +08:00
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import time
|
||||
import infamy
|
||||
import lxml
|
||||
with infamy.Test() as test:
|
||||
with test.step("Connect to device"):
|
||||
with test.step("Set up topology and attach to target DUT"):
|
||||
env = infamy.Env()
|
||||
target = env.attach("target", "mgmt")
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ image::topology.png[Set timezone with UTC offset topology]
|
||||
endif::testgroup[]
|
||||
endif::topdoc[]
|
||||
==== Test sequence
|
||||
. Connect to device
|
||||
. Set up topology and attach to target DUT
|
||||
. Set timezone UTC offset to +12
|
||||
. Verify current time offset is +12:00
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import infamy
|
||||
import lxml
|
||||
|
||||
with infamy.Test() as test:
|
||||
with test.step("Connect to device"):
|
||||
with test.step("Set up topology and attach to target DUT"):
|
||||
env = infamy.Env()
|
||||
target = env.attach("target", "mgmt")
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@ image::topology.png[Upgrade topology]
|
||||
endif::testgroup[]
|
||||
endif::topdoc[]
|
||||
==== Test sequence
|
||||
. Connect to device
|
||||
. Set up topology and attach to target DUT
|
||||
. Start installation of selected package
|
||||
. Wait for upgrade to finish
|
||||
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class FileServer(http.server.HTTPServer):
|
||||
self.__tp.shutdown()
|
||||
|
||||
with infamy.Test() as test:
|
||||
with test.step("Connect to device"):
|
||||
with test.step("Set up topology and attach to target DUT"):
|
||||
env = infamy.Env()
|
||||
if not env.args.package:
|
||||
print("No package supplied")
|
||||
@@ -68,7 +68,7 @@ with infamy.Test() as test:
|
||||
|
||||
with FileServer(("::", SRVPORT), BUNDLEDIR):
|
||||
|
||||
with test.step(f"Start installation of selected package"):
|
||||
with test.step("Start installation of selected package"):
|
||||
print(f"Installing {os.path.basename(env.args.package)}")
|
||||
target.call_dict("infix-system", {
|
||||
"install-bundle": {
|
||||
|
||||
@@ -16,8 +16,17 @@ image::topology.png[Add admin user topology]
|
||||
endif::testgroup[]
|
||||
endif::topdoc[]
|
||||
==== Test sequence
|
||||
. Connect to device
|
||||
. Add new user
|
||||
. Set up topology and attach to target DUT
|
||||
. Add new user 'jacky' with no NACM access
|
||||
. Verify regular user jacky exists
|
||||
. Verify user jacky is not in wheel group
|
||||
. Verify user jacky password is set correctly
|
||||
. Add user jacky to admin group in NACM
|
||||
. Verify user jacky is now in wheel group
|
||||
. Verify user jacky shell now is Bash
|
||||
. Change user jacky to $factory$ password ...
|
||||
. Verify user jacky exists and has new password
|
||||
. Verify user jacky can log in with SSH
|
||||
|
||||
|
||||
<<<
|
||||
|
||||
@@ -12,14 +12,14 @@ import infamy.util as util
|
||||
from passlib.hash import sha256_crypt
|
||||
|
||||
with infamy.Test() as test:
|
||||
with test.step("Connect to device"):
|
||||
with test.step("Set up topology and attach to target DUT"):
|
||||
env = infamy.Env()
|
||||
target = env.attach("target", "mgmt")
|
||||
tgtssh = env.attach("target", "mgmt", "ssh")
|
||||
factory = env.get_password("target")
|
||||
address = target.get_mgmt_ip()
|
||||
|
||||
with test.step("Add new user"):
|
||||
with test.step("Add new user 'jacky' with no NACM access"):
|
||||
USER = "jacky"
|
||||
PASS = "$1$3aR7Bq2u$G9kV.8AALtKkCnaAXFyu6/"
|
||||
|
||||
@@ -39,21 +39,21 @@ with infamy.Test() as test:
|
||||
running = target.get_config_dict("/ietf-system:system")
|
||||
users = running["system"]["authentication"]["user"]
|
||||
|
||||
with test.step(f"Verify regular user jacky exists"):
|
||||
with test.step("Verify regular user jacky exists"):
|
||||
jacky = next((user for user in users if user['name'] == USER), None)
|
||||
if not any(user['name'] == USER for user in users):
|
||||
test.fail()
|
||||
|
||||
with test.step(f"Verify user jacky is not in wheel group"):
|
||||
with test.step("Verify user jacky is not in wheel group"):
|
||||
wheel = tgtssh.runsh("grep wheel /etc/group").stdout
|
||||
if USER in wheel:
|
||||
test.fail()
|
||||
|
||||
with test.step(f"Verify user jacky password is set correctly"):
|
||||
with test.step("Verify user jacky password is set correctly"):
|
||||
if not tgtssh.runsh(f"sudo grep ':{PASS}:' /etc/shadow"):
|
||||
test.fail()
|
||||
|
||||
with test.step(f"Add user jacky to admin group"):
|
||||
with test.step("Add user jacky to admin group in NACM"):
|
||||
# Don't presume 'admin' user exists, only group
|
||||
nacm = target.get_config_dict("/ietf-netconf-acm:nacm")
|
||||
for group in nacm["nacm"]["groups"]["group"]:
|
||||
@@ -62,16 +62,16 @@ with infamy.Test() as test:
|
||||
group["user-name"].append(USER)
|
||||
target.put_config_dict("ietf-netconf-acm", nacm)
|
||||
|
||||
with test.step(f"Verify user jacky is now in wheel group"):
|
||||
with test.step("Verify user jacky is now in wheel group"):
|
||||
if not tgtssh.runsh(f"grep wheel /etc/group | grep '{USER}'"):
|
||||
test.fail()
|
||||
|
||||
with test.step(f"Verify user jacky shell now is Bash"):
|
||||
with test.step("Verify user jacky shell now is Bash"):
|
||||
user = tgtssh.runsh(f"grep {USER} /etc/passwd").stdout
|
||||
if "bash" not in user:
|
||||
test.fail()
|
||||
|
||||
with test.step(f"Change user jacky to $factory$ password ..."):
|
||||
with test.step("Change user jacky to $factory$ password ..."):
|
||||
running = target.get_config_dict("/ietf-system:system")
|
||||
users = running["system"]["authentication"]["user"]
|
||||
|
||||
@@ -81,7 +81,7 @@ with infamy.Test() as test:
|
||||
break
|
||||
target.put_config_dict("ietf-system", running)
|
||||
|
||||
with test.step(f"Verify user jacky exists and has new password"):
|
||||
with test.step("Verify user jacky exists and has new password"):
|
||||
operational = target.get_data("/ietf-system:system/authentication")
|
||||
users = operational["system"]["authentication"]["user"]
|
||||
|
||||
@@ -98,7 +98,7 @@ with infamy.Test() as test:
|
||||
if found['password'] == PASS:
|
||||
test.fail()
|
||||
|
||||
with test.step(f"Verify user jacky can log in with SSH"):
|
||||
with test.step("Verify user jacky can log in with SSH"):
|
||||
testssh=ssh.Device("target", ssh.Location(address, USER, factory))
|
||||
util.until(lambda: testssh.runsh("ls").returncode == 0)
|
||||
test.succeed()
|
||||
|
||||
Reference in New Issue
Block a user