ci: cram: add test to cover tr181-cpu plugin (PCF-2064)

Problem: Cram tests should be added to cover tr181-cpu plugin

References: PCF-2064
Signed-off-by: Benamor Imene <imene.benamor_ext@softathome.com>
This commit is contained in:
Benamor Imene 2025-09-25 09:54:43 +01:00 committed by FAOUZI YAHYA
parent 785a443e59
commit ef0d026319
6 changed files with 315 additions and 0 deletions

View File

@ -1175,6 +1175,22 @@ Check that obuspa has expected datamodel available (minus the platform specific
Device.Firewall.X_PRPLWARE-COM_WANAccess.BlockList.{i}.Tags proto::tr181-firewall
Device.Firewall.X_PRPLWARE-COM_WANAccess.BlockListNumberOfEntries proto::tr181-firewall
Device.Hardware.
Device.Hardware.CPUs. proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}. proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.Alias proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.DVFS. proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.DVFS.CurrentFrequency proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.DVFS.Enable proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.DVFS.MaxFrequency proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.DVFS.MinFrequency proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.DVFS.ScalingAvailableFrequencies proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.DVFS.ScalingAvailableGovernors proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.DVFS.ScalingGovernor proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.DVFS.ScalingMaxFrequency proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.DVFS.ScalingMinFrequency proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.DVFS.Status proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.DVFS.Supported proto::tr181-cpu
Device.Hardware.CPUs.CPUNumberOfEntries proto::tr181-cpu
Device.Hardware.X_PRPLWARE-COM_FlashDevice.{i}. proto::tr181-flashmonitor
Device.Hardware.X_PRPLWARE-COM_FlashDevice.{i}.Alias proto::tr181-flashmonitor
Device.Hardware.X_PRPLWARE-COM_FlashDevice.{i}.FlashType proto::tr181-flashmonitor
@ -6210,6 +6226,22 @@ Check that obuspa provides the same datamodel again (minus the platform specific
Device.Firewall.X_PRPLWARE-COM_WANAccess.BlockList.{i}.Tags proto::tr181-firewall
Device.Firewall.X_PRPLWARE-COM_WANAccess.BlockListNumberOfEntries proto::tr181-firewall
Device.Hardware.
Device.Hardware.CPUs. proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}. proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.Alias proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.DVFS. proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.DVFS.CurrentFrequency proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.DVFS.Enable proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.DVFS.MaxFrequency proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.DVFS.MinFrequency proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.DVFS.ScalingAvailableFrequencies proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.DVFS.ScalingAvailableGovernors proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.DVFS.ScalingGovernor proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.DVFS.ScalingMaxFrequency proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.DVFS.ScalingMinFrequency proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.DVFS.Status proto::tr181-cpu
Device.Hardware.CPUs.CPU.{i}.DVFS.Supported proto::tr181-cpu
Device.Hardware.CPUs.CPUNumberOfEntries proto::tr181-cpu
Device.Hardware.X_PRPLWARE-COM_FlashDevice.{i}. proto::tr181-flashmonitor
Device.Hardware.X_PRPLWARE-COM_FlashDevice.{i}.Alias proto::tr181-flashmonitor
Device.Hardware.X_PRPLWARE-COM_FlashDevice.{i}.FlashType proto::tr181-flashmonitor

View File

@ -14,6 +14,8 @@ Check that ubus has expected datamodels available:
Buttons
Buttons.Action
Buttons.Button
CPUs
CPUs.CPU
CaptivePortal
CaptivePortal.LANInterface
ConMon
@ -90,6 +92,7 @@ Check that ubus has expected datamodels available:
Device.Ethernet
Device.Firewall
Device.Hardware
Device.Hardware.CPUs
Device.Hardware.X_PRPLWARE-COM_FlashDevice
Device.HomePlug
Device.Hosts

View File

@ -773,6 +773,7 @@ Assure expected build configuration (PCF-1413):
CONFIG_PACKAGE_tr181-captiveportal=y
CONFIG_PACKAGE_tr181-conmon=y
CONFIG_PACKAGE_tr181-conntrack-query=y
CONFIG_PACKAGE_tr181-cpu=y
CONFIG_PACKAGE_tr181-device=y
CONFIG_PACKAGE_tr181-dhcpv4client=y
CONFIG_PACKAGE_tr181-dhcpv6client=y
@ -924,6 +925,11 @@ Assure expected build configuration (PCF-1413):
CONFIG_SAH_AMX_TR181_CONMON_STOP_ORDER=78
CONFIG_SAH_AMX_TR181_CONNTRACK_QUERY=y
CONFIG_SAH_AMX_TR181_CONNTRACK_QUERY_ORDER=25
CONFIG_SAH_AMX_TR181_CPU=y
CONFIG_SAH_AMX_TR181_CPU_RUN_AS_GROUP="tr181_app"
CONFIG_SAH_AMX_TR181_CPU_RUN_AS_USER="tr181_app"
CONFIG_SAH_AMX_TR181_CPU_START_ORDER=99
CONFIG_SAH_AMX_TR181_CPU_STOP_ORDER=1
CONFIG_SAH_AMX_TR181_DEVICE=y
CONFIG_SAH_AMX_TR181_DEVICEINFO=y
CONFIG_SAH_AMX_TR181_DEVICEINFO_NUMBER_OF_EXTRA_MAC_ADDRESSES="7"

View File

@ -0,0 +1,105 @@
Create R alias:
$ alias R="${CRAM_REMOTE_COMMAND:-}"
Verify CPUs — Data Model of OSPv2 Board:
$ R "ba-cli -lj CPUs.?" | jq .
[
{
"CPUs.CPU.2.DVFS.": {
"CurrentFrequency": \d+, (re)
"ScalingGovernor": "powersave",
"Status": "Disabled",
"Supported": 1,
"ScalingAvailableGovernors": "performance,powersave",
"ScalingMaxFrequency": 1716000,
"Enable": 0,
"MaxFrequency": 1716000,
"ScalingAvailableFrequencies": "624000,780000,936000,1092000,1248000,1404000,1560000,1716000",
"ScalingMinFrequency": 624000,
"MinFrequency": 624000
},
"CPUs.CPU.1.DVFS.": {
"CurrentFrequency": \d+, (re)
"ScalingGovernor": "powersave",
"Status": "Disabled",
"Supported": 1,
"ScalingAvailableGovernors": "performance,powersave",
"ScalingMaxFrequency": 1716000,
"Enable": 0,
"MaxFrequency": 1716000,
"ScalingAvailableFrequencies": "624000,780000,936000,1092000,1248000,1404000,1560000,1716000",
"ScalingMinFrequency": 624000,
"MinFrequency": 624000
},
"CPUs.CPU.1.": {
"Alias": "cpe-cpu0"
},
"CPUs.": {
"CPUNumberOfEntries": 2
},
"CPUs.CPU.2.": {
"Alias": "cpe-cpu1"
}
}
]
Enable the Dynamic Voltage and Frequency Scaling (DVFS) feature:
$ R 'ba-cli CPUs.CPU.1.DVFS.Enable=1'| sed -n '3p'
CPUs.CPU.1.DVFS.Enable=1
Change governor to performance:
$ R 'ba-cli CPUs.CPU.1.DVFS.ScalingGovernor="performance"'| sed -n '3p'
CPUs.CPU.1.DVFS.ScalingGovernor="performance"
Check that the governor was changed to performance in datamodel:
$ R "ba-cli CPUs.CPU.*.DVFS.ScalingGovernor?" | tail -n+2 | LC_ALL=C sort
CPUs.CPU.1.DVFS.ScalingGovernor="performance"
CPUs.CPU.2.DVFS.ScalingGovernor="powersave"
Check that the governor was changed in sysfs:
$ R "cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor"
performance
powersave
Change governor back to powersave:
$ R 'ba-cli CPUs.CPU.1.DVFS.ScalingGovernor="powersave"'| sed -n '3p'
CPUs.CPU.1.DVFS.ScalingGovernor="powersave"
Check that the governor was changed back to powersave in datamodel:
$ R "ba-cli CPUs.CPU.*.DVFS.ScalingGovernor?" | tail -n+2 | LC_ALL=C sort
CPUs.CPU.1.DVFS.ScalingGovernor="powersave"
CPUs.CPU.2.DVFS.ScalingGovernor="powersave"
Check that the governor was changed back to powersave in sysfs:
$ R "cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor"
powersave
powersave
Check that its not possible to use unavailable conservative governor:
$ R 'ba-cli CPUs.CPU.1.DVFS.ScalingGovernor="Test"'| sed -n '2p'
ERROR: set CPUs.CPU.1.DVFS.ScalingGovernor failed (10 - invalid value)
Check that the governor is still set to powersave in datamodel:
$ R "ba-cli CPUs.CPU.*.DVFS.ScalingGovernor?" | tail -n+2 | LC_ALL=C sort
CPUs.CPU.1.DVFS.ScalingGovernor="powersave"
CPUs.CPU.2.DVFS.ScalingGovernor="powersave"
Check that the governor was is still set to powersave in sysfs:
$ R "cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor"
powersave
powersave

View File

@ -554,6 +554,7 @@ Assure expected build configuration (PCF-1413):
CONFIG_PACKAGE_tr181-captiveportal=y
CONFIG_PACKAGE_tr181-conmon=y
CONFIG_PACKAGE_tr181-conntrack-query=y
CONFIG_PACKAGE_tr181-cpu=y
CONFIG_PACKAGE_tr181-device=y
CONFIG_PACKAGE_tr181-dhcpv4client=y
CONFIG_PACKAGE_tr181-dhcpv6client=y
@ -698,6 +699,11 @@ Assure expected build configuration (PCF-1413):
CONFIG_SAH_AMX_TR181_CONMON_STOP_ORDER=78
CONFIG_SAH_AMX_TR181_CONNTRACK_QUERY=y
CONFIG_SAH_AMX_TR181_CONNTRACK_QUERY_ORDER=25
CONFIG_SAH_AMX_TR181_CPU=y
CONFIG_SAH_AMX_TR181_CPU_RUN_AS_GROUP="tr181_app"
CONFIG_SAH_AMX_TR181_CPU_RUN_AS_USER="tr181_app"
CONFIG_SAH_AMX_TR181_CPU_START_ORDER=99
CONFIG_SAH_AMX_TR181_CPU_STOP_ORDER=1
CONFIG_SAH_AMX_TR181_DEVICE=y
CONFIG_SAH_AMX_TR181_DEVICEINFO=y
CONFIG_SAH_AMX_TR181_DEVICEINFO_NUMBER_OF_EXTRA_MAC_ADDRESSES="7"

View File

@ -0,0 +1,163 @@
Create R alias:
$ alias R="${CRAM_REMOTE_COMMAND:-}"
Verify CPUs — Data Model of Freedom Board:
$ R "ba-cli -lj CPUs.?" | jq .
[
{
"CPUs.CPU.3.": {
"Alias": "cpe-cpu2"
},
"CPUs.CPU.1.DVFS.": {
"CurrentFrequency": \d+, (re)
"ScalingGovernor": "performance",
"Status": "Disabled",
"Supported": 1,
"ScalingAvailableGovernors": "conservative,ondemand,userspace,powersave,performance",
"ScalingMaxFrequency": 2208000,
"Enable": 0,
"MaxFrequency": 2208000,
"ScalingAvailableFrequencies": "936000,1104000,1416000,1488000,1800000,2208000",
"ScalingMinFrequency": 936000,
"MinFrequency": 936000
},
"CPUs.CPU.4.DVFS.": {
"CurrentFrequency": \d+, (re)
"ScalingGovernor": "performance",
"Status": "Disabled",
"Supported": 1,
"ScalingAvailableGovernors": "conservative,ondemand,userspace,powersave,performance",
"ScalingMaxFrequency": 2208000,
"Enable": 0,
"MaxFrequency": 2208000,
"ScalingAvailableFrequencies": "936000,1104000,1416000,1488000,1800000,2208000",
"ScalingMinFrequency": 936000,
"MinFrequency": 936000
},
"CPUs.CPU.2.": {
"Alias": "cpe-cpu1"
},
"CPUs.CPU.2.DVFS.": {
"CurrentFrequency": \d+, (re)
"ScalingGovernor": "performance",
"Status": "Disabled",
"Supported": 1,
"ScalingAvailableGovernors": "conservative,ondemand,userspace,powersave,performance",
"ScalingMaxFrequency": 2208000,
"Enable": 0,
"MaxFrequency": 2208000,
"ScalingAvailableFrequencies": "936000,1104000,1416000,1488000,1800000,2208000",
"ScalingMinFrequency": 936000,
"MinFrequency": 936000
},
"CPUs.CPU.4.": {
"Alias": "cpe-cpu3"
},
"CPUs.CPU.3.DVFS.": {
"CurrentFrequency": \d+, (re)
"ScalingGovernor": "performance",
"Status": "Disabled",
"Supported": 1,
"ScalingAvailableGovernors": "conservative,ondemand,userspace,powersave,performance",
"ScalingMaxFrequency": 2208000,
"Enable": 0,
"MaxFrequency": 2208000,
"ScalingAvailableFrequencies": "936000,1104000,1416000,1488000,1800000,2208000",
"ScalingMinFrequency": 936000,
"MinFrequency": 936000
},
"CPUs.CPU.1.": {
"Alias": "cpe-cpu0"
},
"CPUs.": {
"CPUNumberOfEntries": 4
}
}
]
Enable the Dynamic Voltage and Frequency Scaling (DVFS) feature:
$ R 'ba-cli CPUs.CPU.1.DVFS.Enable=1'| sed -n '3p'
CPUs.CPU.1.DVFS.Enable=1
Change governor to performance:
$ R 'ba-cli CPUs.CPU.1.DVFS.ScalingGovernor="performance"'| sed -n '3p'
CPUs.CPU.1.DVFS.ScalingGovernor="performance"
Check that the governor was changed to performance in datamodel:
$ R "ba-cli CPUs.CPU.*.DVFS.ScalingGovernor?" | tail -n+2 | LC_ALL=C sort
CPUs.CPU.1.DVFS.ScalingGovernor="performance"
CPUs.CPU.2.DVFS.ScalingGovernor="performance"
CPUs.CPU.3.DVFS.ScalingGovernor="performance"
CPUs.CPU.4.DVFS.ScalingGovernor="performance"
Check that the governor was changed in sysfs:
$ R "cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor"
performance
performance
performance
performance
Change governor back to powersave:
$ R 'ba-cli CPUs.CPU.1.DVFS.ScalingGovernor="powersave"'| sed -n '3p'
CPUs.CPU.1.DVFS.ScalingGovernor="powersave"
Check that the governor was changed back to powersave in datamodel:
$ R "ba-cli CPUs.CPU.*.DVFS.ScalingGovernor?" | tail -n+2 | LC_ALL=C sort
CPUs.CPU.1.DVFS.ScalingGovernor="powersave"
CPUs.CPU.2.DVFS.ScalingGovernor="powersave"
CPUs.CPU.3.DVFS.ScalingGovernor="powersave"
CPUs.CPU.4.DVFS.ScalingGovernor="powersave"
Check that the governor was changed back to powersave in sysfs:
$ R "cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor"
powersave
powersave
powersave
powersave
Check that its not possible to use unavailable conservative governor:
$ R 'ba-cli CPUs.CPU.1.DVFS.ScalingGovernor="Test"'| sed -n '2p'
ERROR: set CPUs.CPU.1.DVFS.ScalingGovernor failed (10 - invalid value)
Check that the governor is still set to powersave in datamodel:
$ R "ba-cli CPUs.CPU.*.DVFS.ScalingGovernor?" | tail -n+2 | LC_ALL=C sort
CPUs.CPU.1.DVFS.ScalingGovernor="powersave"
CPUs.CPU.2.DVFS.ScalingGovernor="powersave"
CPUs.CPU.3.DVFS.ScalingGovernor="powersave"
CPUs.CPU.4.DVFS.ScalingGovernor="powersave"
Check that the governor was is still set to powersave in sysfs:
$ R "cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor"
powersave
powersave
powersave
powersave
Set the governor back to performance to avoid affecting other tests:
$ R 'ba-cli CPUs.CPU.1.DVFS.ScalingGovernor="performance"'| sed -n '3p'
CPUs.CPU.1.DVFS.ScalingGovernor="performance"
Check that the governor was changed to performance in datamodel:
$ R "ba-cli CPUs.CPU.*.DVFS.ScalingGovernor?" | tail -n+2 | LC_ALL=C sort
CPUs.CPU.1.DVFS.ScalingGovernor="performance"
CPUs.CPU.2.DVFS.ScalingGovernor="performance"
CPUs.CPU.3.DVFS.ScalingGovernor="performance"
CPUs.CPU.4.DVFS.ScalingGovernor="performance"