test: statd: Add unittest for ietf-{hardware,system}

This commit is contained in:
Tobias Waldekranz
2025-01-20 13:44:14 +01:00
parent 9879e8b685
commit f4c9a57bb5
13 changed files with 288 additions and 0 deletions
+2
View File
@@ -3,3 +3,5 @@
name: "containers"
- case: interfaces-all/test
name: "interfaces-all"
- case: system/test
name: "system"
+4
View File
@@ -0,0 +1,4 @@
USB PORTS 
NAME STATE 
USB unlocked
USB2 unlocked
+4
View File
@@ -0,0 +1,4 @@
ADDRESS MODE STATE STRATUM POLL-INTERVAL
192.168.1.1 server candidate 1 6
192.168.2.1 server candidate 1 6
192.168.3.1 server selected 1 6
+6
View File
@@ -0,0 +1,6 @@
BOOT ORDER
primary secondary net
NAME STATE VERSION DATE 
secondary inactive 94cd526 2025-01-15T10:00:56Z
primary booted 94cd526 2025-01-15T10:00:56Z
+26
View File
@@ -0,0 +1,26 @@
{
"ietf-hardware:hardware": {
"component": [
{
"name": "product",
"infix-hardware:vpd-data": {}
},
{
"state": {
"admin-state": "unlocked",
"oper-state": "enabled"
},
"name": "USB",
"class": "infix-hardware:usb"
},
{
"state": {
"admin-state": "unlocked",
"oper-state": "enabled"
},
"name": "USB2",
"class": "infix-hardware:usb"
}
]
}
}
+98
View File
@@ -0,0 +1,98 @@
{
"ietf-system:system-state": {
"infix-system:software": {
"compatible": "infix-x86_64",
"variant": "",
"booted": "primary",
"boot-order": [
"primary",
"secondary",
"net"
],
"slot": [
{
"name": "rootfs.1",
"bootname": "secondary",
"class": "rootfs",
"state": "inactive",
"bundle": {
"compatible": "infix-x86_64",
"version": "94cd526"
},
"size": "126205952",
"sha256": "6cc0272f46b1a014f91693dc6218ce2f9a4b58bea727c492f6689c3ab102acca",
"installed": {
"datetime": "2025-01-15T10:00:56Z",
"count": 1
},
"activated": {
"datetime": "2025-01-15T10:00:56Z",
"count": 1
}
},
{
"name": "rootfs.0",
"bootname": "primary",
"class": "rootfs",
"state": "booted",
"bundle": {
"compatible": "infix-x86_64",
"version": "94cd526"
},
"size": "126205952",
"sha256": "6cc0272f46b1a014f91693dc6218ce2f9a4b58bea727c492f6689c3ab102acca",
"installed": {
"datetime": "2025-01-15T10:00:56Z",
"count": 1
},
"activated": {
"datetime": "2025-01-15T10:00:56Z",
"count": 1
}
},
{
"name": "net.0",
"bootname": "net",
"class": "net",
"state": "inactive",
"bundle": {},
"installed": {},
"activated": {}
}
],
"installer": {
"operation": "idle",
"progress": {
"percentage": 0
}
}
},
"infix-system:ntp": {
"sources": {
"source": [
{
"address": "192.168.1.1",
"mode": "server",
"state": "candidate",
"stratum": 1,
"poll": 6
},
{
"address": "192.168.2.1",
"mode": "server",
"state": "candidate",
"stratum": 1,
"poll": 6
},
{
"address": "192.168.3.1",
"mode": "server",
"state": "selected",
"stratum": 1,
"poll": 6
}
]
}
}
}
}
+122
View File
@@ -0,0 +1,122 @@
{
"ietf-hardware:hardware": {
"component": [
{
"infix-hardware:vpd-data": {},
"name": "product"
},
{
"class": "infix-hardware:usb",
"name": "USB",
"state": {
"admin-state": "unlocked",
"oper-state": "enabled"
}
},
{
"class": "infix-hardware:usb",
"name": "USB2",
"state": {
"admin-state": "unlocked",
"oper-state": "enabled"
}
}
]
},
"ietf-system:system-state": {
"infix-system:ntp": {
"sources": {
"source": [
{
"address": "192.168.1.1",
"mode": "server",
"poll": 6,
"state": "candidate",
"stratum": 1
},
{
"address": "192.168.2.1",
"mode": "server",
"poll": 6,
"state": "candidate",
"stratum": 1
},
{
"address": "192.168.3.1",
"mode": "server",
"poll": 6,
"state": "selected",
"stratum": 1
}
]
}
},
"infix-system:software": {
"boot-order": [
"primary",
"secondary",
"net"
],
"booted": "primary",
"compatible": "infix-x86_64",
"installer": {
"operation": "idle",
"progress": {
"percentage": 0
}
},
"slot": [
{
"activated": {
"count": 1,
"datetime": "2025-01-15T10:00:56Z"
},
"bootname": "secondary",
"bundle": {
"compatible": "infix-x86_64",
"version": "94cd526"
},
"class": "rootfs",
"installed": {
"count": 1,
"datetime": "2025-01-15T10:00:56Z"
},
"name": "rootfs.1",
"sha256": "6cc0272f46b1a014f91693dc6218ce2f9a4b58bea727c492f6689c3ab102acca",
"size": "126205952",
"state": "inactive"
},
{
"activated": {
"count": 1,
"datetime": "2025-01-15T10:00:56Z"
},
"bootname": "primary",
"bundle": {
"compatible": "infix-x86_64",
"version": "94cd526"
},
"class": "rootfs",
"installed": {
"count": 1,
"datetime": "2025-01-15T10:00:56Z"
},
"name": "rootfs.0",
"sha256": "6cc0272f46b1a014f91693dc6218ce2f9a4b58bea727c492f6689c3ab102acca",
"size": "126205952",
"state": "booted"
},
{
"activated": {},
"bootname": "net",
"bundle": {},
"class": "net",
"installed": {},
"name": "net.0",
"state": "inactive"
}
],
"variant": ""
}
}
}
@@ -0,0 +1 @@
{"vendor": "QEMU", "product-name": "VM", "part-number": null, "serial-number": null, "mac-address": "00:a0:85:00:03:00", "factory-password-hash": "$5$mI/zpOAqZYKLC2WU$i7iPzZiIjOjrBF3NyftS9CCq8dfYwHwrmUK097Jca9A", "vpd": {"product": {"board": "product", "available": false, "trusted": true, "data": {}}}, "usb-ports": [{"name": "USB", "path": "/sys/bus/usb/devices/usb1/authorized"}, {"name": "USB", "path": "/sys/bus/usb/devices/usb1/authorized_default"}, {"name": "USB2", "path": "/sys/bus/usb/devices/usb2/authorized"}, {"name": "USB2", "path": "/sys/bus/usb/devices/usb2/authorized_default"}]}
@@ -0,0 +1,3 @@
^,+,192.168.1.1,1,6,7,3,0.000038081,0.000504333,0.002931096
^,+,192.168.2.1,1,6,7,3,0.000066315,0.000532567,0.002930348
^,*,192.168.3.1,1,6,7,3,-0.000002138,0.000464114,0.002930853
@@ -0,0 +1,7 @@
ORDER=primary secondary net
primary_OK=1
secondary_OK=1
net_OK=1
primary_TRY=0
secondary_TRY=0
net_TRY=0
@@ -0,0 +1 @@
{"operation": "idle", "progress": {"percentage": "0", "message": ""}}
@@ -0,0 +1 @@
{"compatible":"infix-x86_64","variant":"","booted":"primary","boot_primary":"rootfs.0","slots":[{"rootfs.1":{"class":"rootfs","device":"/dev/disk/by-partlabel/secondary","type":"raw","bootname":"secondary","state":"inactive","parent":null,"mountpoint":null,"boot_status":"good","slot_status":{"bundle":{"compatible":"infix-x86_64","version":"94cd526"},"checksum":{"sha256":"6cc0272f46b1a014f91693dc6218ce2f9a4b58bea727c492f6689c3ab102acca","size":126205952},"installed":{"timestamp":"2025-01-15T10:00:56Z","count":1},"activated":{"timestamp":"2025-01-15T10:00:56Z","count":1},"status":"ok"}}},{"rootfs.0":{"class":"rootfs","device":"/dev/disk/by-partlabel/primary","type":"raw","bootname":"primary","state":"booted","parent":null,"mountpoint":null,"boot_status":"good","slot_status":{"bundle":{"compatible":"infix-x86_64","version":"94cd526"},"checksum":{"sha256":"6cc0272f46b1a014f91693dc6218ce2f9a4b58bea727c492f6689c3ab102acca","size":126205952},"installed":{"timestamp":"2025-01-15T10:00:56Z","count":1},"activated":{"timestamp":"2025-01-15T10:00:56Z","count":1},"status":"ok"}}},{"net.0":{"class":"net","device":"/dev/ram0","type":"raw","bootname":"net","state":"inactive","parent":null,"mountpoint":null,"boot_status":"good","slot_status":{"bundle":{"compatible":null}}}}]}
+13
View File
@@ -0,0 +1,13 @@
#!/bin/sh
yang_models="ietf-system ietf-hardware"
gen_test=ietf_system/ntp_client/test.py
gen_iface=d3a
cli_commands="show-ntp"
cli_commands="$cli_commands show-software"
cli_commands="$cli_commands show-hardware"
. $(readlink -f $(dirname $0)/../test.sh)
main "$@"