mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-02 05:43:02 +02:00
@@ -1407,6 +1407,7 @@ static int auth_cb(sr_session_ctx_t *session, uint32_t sub_id, const char *modul
|
||||
lyd_new_path(*parent, NULL, xpath, spwd->sp_pwdp, 0, 0);
|
||||
}
|
||||
|
||||
endspent();
|
||||
return SR_ERR_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
=== OSPF with multiple areas
|
||||
==== Description
|
||||
This test test alot of features inside OSPF using 3 areas (one NSSA area)
|
||||
This test test alot of features inside OSPF using 3 areas (one NSSA area, with no summary)
|
||||
to test the distribution of routes is deterministic (using cost), also test
|
||||
link breaks using BFD (not implemented in infamy though)
|
||||
|
||||
This test also verify broadcast and point-to-point interface type on /30 network and
|
||||
explicit router-id.
|
||||
|
||||
==== Topology
|
||||
ifdef::topdoc[]
|
||||
image::../../test/case/ietf_routing/ospf_multiarea/topology.png[OSPF with multiple areas topology]
|
||||
@@ -21,6 +24,8 @@ endif::topdoc[]
|
||||
. Wait for all neighbor to peer
|
||||
. Wait for routes from OSPF on all routers
|
||||
. Verify Area 0.0.0.1 on R3 is NSSA area
|
||||
. Verify R1:ring2 is of type point-to-point
|
||||
. Verify R4:ring1 is of type point-to-point
|
||||
. Verify on R3, there are no routes beyond 10.0.23.1, just a default route
|
||||
. Testing connectivitiy through NSSA area, from PC:data3 to 11.0.8.1
|
||||
. Verify that the route to 10.0.0.3 from PC:data4, go through 10.0.41.2
|
||||
|
||||
@@ -28,9 +28,12 @@
|
||||
"""
|
||||
OSPF with multiple areas
|
||||
|
||||
This test test alot of features inside OSPF using 3 areas (one NSSA area)
|
||||
This test test alot of features inside OSPF using 3 areas (one NSSA area, with no summary)
|
||||
to test the distribution of routes is deterministic (using cost), also test
|
||||
link breaks using BFD (not implemented in infamy though)
|
||||
|
||||
This test also verify broadcast and point-to-point interface type on /30 network and
|
||||
explicit router-id.
|
||||
"""
|
||||
import infamy
|
||||
|
||||
@@ -137,7 +140,8 @@ def config_target1(target, ring1, ring2, cross):
|
||||
},
|
||||
"name": ring2,
|
||||
"hello-interval": 1,
|
||||
"enabled": True
|
||||
"enabled": True,
|
||||
"interface-type": "point-to-point"
|
||||
},
|
||||
{
|
||||
"name": "lo",
|
||||
@@ -239,7 +243,7 @@ def config_target2(target, ring1, ring2, cross):
|
||||
"type": "infix-routing:ospfv2",
|
||||
"name": "default",
|
||||
"ospf": {
|
||||
"explicit-router-id": "10.0.0.2",
|
||||
"explicit-router-id": "1.1.1.1",
|
||||
"areas": {
|
||||
"area": [{
|
||||
"area-id": "0.0.0.0",
|
||||
@@ -471,7 +475,8 @@ def config_target4(target, ring1, cross, link):
|
||||
},
|
||||
"name": ring1,
|
||||
"hello-interval": 1,
|
||||
"enabled": True
|
||||
"enabled": True,
|
||||
"interface-type": "point-to-point"
|
||||
}, {
|
||||
"bfd": {
|
||||
"enabled": True
|
||||
@@ -536,7 +541,7 @@ with infamy.Test() as test:
|
||||
|
||||
with test.step("Wait for all neighbor to peer"):
|
||||
print("Waiting for neighbors to peer")
|
||||
until(lambda: route.ospf_get_neighbor(R1, "0.0.0.0", R1ring1, "10.0.0.2"), attempts=200)
|
||||
until(lambda: route.ospf_get_neighbor(R1, "0.0.0.0", R1ring1, "1.1.1.1"), attempts=200)
|
||||
until(lambda: route.ospf_get_neighbor(R1, "0.0.0.1", R1cross, "10.0.0.3"), attempts=200)
|
||||
until(lambda: route.ospf_get_neighbor(R2, "0.0.0.1", R2ring1, "10.0.0.3"), attempts=200)
|
||||
until(lambda: route.ospf_get_neighbor(R2, "0.0.0.0", R2ring2, "10.0.0.1"), attempts=200)
|
||||
@@ -559,6 +564,12 @@ with infamy.Test() as test:
|
||||
with test.step("Verify Area 0.0.0.1 on R3 is NSSA area"):
|
||||
assert(route.ospf_is_area_nssa(R3, "0.0.0.1"))
|
||||
|
||||
with test.step("Verify R1:ring2 is of type point-to-point"):
|
||||
assert(route.ospf_get_interface_type(R1, "0.0.0.2", R1ring2) == "point-to-point")
|
||||
|
||||
with test.step("Verify R4:ring1 is of type point-to-point"):
|
||||
assert(route.ospf_get_interface_type(R4, "0.0.0.2", R4ring1) == "point-to-point")
|
||||
|
||||
with test.step("Verify on R3, there are no routes beyond 10.0.23.1, just a default route"):
|
||||
# Should be only default route out of the area.
|
||||
parallel(until(lambda: route.ipv4_route_exist(R3, "0.0.0.0/0"), attempts=200),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
=== Add/delete user
|
||||
==== Description
|
||||
Verify that it is possible to add/delete a user.
|
||||
Verify that it is possible to add/delete a user. The user password is hashed
|
||||
with yescrypt.
|
||||
|
||||
==== Topology
|
||||
ifdef::topdoc[]
|
||||
@@ -15,8 +16,12 @@ 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
|
||||
. Verify user 'newuser01' can login with SSH
|
||||
. Delete user 'newuser01'
|
||||
. Verify erasure of user 'newuser01'
|
||||
. Verify that 'newuser01' is removed from /etc/passwd
|
||||
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
"""
|
||||
Add/delete user
|
||||
|
||||
Verify that it is possible to add/delete a user.
|
||||
Verify that it is possible to add/delete a user. The user password is hashed
|
||||
with yescrypt.
|
||||
"""
|
||||
import infamy
|
||||
import copy
|
||||
from passlib.hash import sha256_crypt
|
||||
import random
|
||||
import string
|
||||
import re
|
||||
@@ -15,16 +15,14 @@ import infamy.util as util
|
||||
|
||||
username = "newuser01"
|
||||
password = "newuser01password"
|
||||
|
||||
hashed_password = "$y$j9T$SALT$gx4K1wugXsm3JDLwYZtnbr37FGGvljotXwIBGOxaGf2"
|
||||
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")
|
||||
|
||||
with test.step("Add new user 'newuser01' with password 'newuser01password'"):
|
||||
hashed_password = sha256_crypt.using(rounds=5000).hash(password)
|
||||
|
||||
target.put_config_dict("ietf-system", {
|
||||
"system": {
|
||||
"authentication": {
|
||||
@@ -39,7 +37,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 +48,14 @@ with infamy.Test() as test:
|
||||
break
|
||||
assert user_found, f"User 'newuser01' not found"
|
||||
|
||||
with test.step(f"Delete user 'newuser01'"):
|
||||
with test.step("Verify user 'newuser01' can login with SSH"):
|
||||
newssh = env.attach("target", "mgmt", "ssh", None, username, password)
|
||||
util.until(lambda: newssh.run("ls").returncode == 0, attempts=200)
|
||||
|
||||
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