mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-02 05:43:02 +02:00
Add new test start_from_startup.py to just see that the device can boot from startup config
Useful to run in a loop.
This commit is contained in:
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import infamy
|
||||
from infamy.util import wait_boot
|
||||
import copy
|
||||
|
||||
def remove_config(target):
|
||||
running = target.get_config_dict("/ietf-hardware:hardware")
|
||||
new = copy.deepcopy(running)
|
||||
new["hardware"].clear()
|
||||
target.put_diff_dicts("ietf-hardware",running,new)
|
||||
|
||||
with infamy.Test() as test:
|
||||
with test.step("Initialize"):
|
||||
env = infamy.Env(infamy.std_topology("1x1"))
|
||||
target = env.attach("target", "mgmt")
|
||||
|
||||
with test.step("Configure"):
|
||||
target.put_config_dict("ietf-system", {
|
||||
"system": {
|
||||
"hostname": "test"
|
||||
}
|
||||
})
|
||||
remove_config(target)
|
||||
target.copy("running", "startup")
|
||||
with test.step("Reboot and wait for the unit to come back"):
|
||||
target.copy("running", "startup")
|
||||
target.reboot()
|
||||
if wait_boot(target) == False:
|
||||
test.fail()
|
||||
target = env.attach("target", "mgmt", factory_default = False)
|
||||
|
||||
with test.step("Verify hostname"):
|
||||
data = target.get_dict("/ietf-system:system/hostname")
|
||||
print(data)
|
||||
assert(data["system"]["hostname"] == "test")
|
||||
|
||||
test.succeed()
|
||||
Reference in New Issue
Block a user