fprime/Ref/test/int/test_cmd_parameter.py
chuynh4duarte 8b9ac2197d
Add reusable InT test scripts (#3923)
* add deployment function

* update file to use config json file

* remove unuse function

* fix typos

* fixed spelling

* update to use get_mnemonic

* rm shellcmd from fileManager and add health & systemResources testcase

* check memory usage and number of CPUs

* remove Ref.PingReceiver and fixed typos

* fixed spelling fileDownlink,health,systemResources and add config.json file

* Update config.json

* replace ActiveLogger to EventManager

* Updated config.json use lowercase CdhCore and FileHandling(fileDownlink,fileManager,prmDb) and ComCcsds(cmdSeq) etc

* update test_cmd_version to compare version of telemetry channel vs. evr version

* extend max_delay to work with Raspberry pi

* rename config.json to int_config.json

* delete Ref/config.json new file name int_config.json

* add time.sleep between AppendFile cmd to work with rasberry Pi

* fix int_config.json and add new Int DpMgr, DpWriter and DpCatalog

* add comments to confirm /tmp/1MiB.txt and /tmp/test_seq.seq exist before execute script

* add send uplink files

* Rename config.json, fix spelling

* python formatting

---------

Co-authored-by: Cindy T Huynh <chuynh@jpl.nasa.gov>
Co-authored-by: M Starch <LeStarch@googlemail.com>
Co-authored-by: Thomas Boyer-Chammard <49786685+thomas-bc@users.noreply.github.com>
Co-authored-by: Kevin F. Ortega <kevin.f.ortega@jpl.nasa.gov>
2025-08-29 10:29:39 -07:00

119 lines
4.1 KiB
Python

"""test_parameter.py:
Test the command dispatcher with basic integration tests.
"""
def test_send_parameter(fprime_test_api):
"""Test that commands may be sent
Tests command send, dispatch, and receipt using send_and_assert command with a pair of CmdDispatcher commands.
recvBuffComp.PARAMETER1_PRM_SET (call telemetry confirm value)
recvBuffComp.PARAMETER1_PRM_SAVE
recvBuffComp.PARAMETER2_PRM_SET (call telemetry confirm value)
recvBuffComp.PARAMETER2_PRM_SAVE
sendBuffComp.PARAMETER3_PRM_SET (call telemetry confirm value)
sendBuffComp.PARAMETER3_PRM_SAVE
sendBuffComp.PARAMETER4_PRM_SET (call telemetry confirm value)
sendBuffComp.PARAMETER4_PRM_SAVE
Notes: send a parameterX_set,value=current telemetry channel.
the function assert_telemetry will fail because no_change
"""
## setup default-value
fprime_test_api.send_and_assert_command(
fprime_test_api.get_mnemonic("Ref.RecvBuff") + "." + "PARAMETER1_PRM_SET",
[1],
max_delay=5,
)
fprime_test_api.send_and_assert_command(
fprime_test_api.get_mnemonic("Ref.RecvBuff") + "." + "PARAMETER2_PRM_SET",
[2],
max_delay=5,
)
fprime_test_api.send_and_assert_command(
fprime_test_api.get_mnemonic("Ref.SendBuff") + "." + "PARAMETER3_PRM_SET",
[3],
max_delay=5,
)
fprime_test_api.send_and_assert_command(
fprime_test_api.get_mnemonic("Ref.SendBuff") + "." + "PARAMETER4_PRM_SET",
[4],
max_delay=5,
)
# Only work if send command PARAMETER1_PRM_SET then check telemetry. Unsigned integer 0..4294967295)
fprime_test_api.send_and_assert_command(
fprime_test_api.get_mnemonic("Ref.RecvBuff") + "." + "PARAMETER1_PRM_SET",
[10],
max_delay=5,
)
# Check Telem only will not work
param1_change = fprime_test_api.get_telemetry_pred(
fprime_test_api.get_mnemonic("Ref.RecvBuff") + "." + "Parameter1", 10
)
fprime_test_api.assert_telemetry(param1_change, timeout=5)
# Send PARAMETER1_PRM_SAVE
fprime_test_api.send_and_assert_command(
fprime_test_api.get_mnemonic("Ref.RecvBuff") + "." + "PARAMETER1_PRM_SAVE",
max_delay=1,
)
# Send PARAMETER2_PRM_SET (confirm new value / SAVE ) signed integer -32867 and 32767
fprime_test_api.send_and_assert_command(
fprime_test_api.get_mnemonic("Ref.RecvBuff") + "." + "PARAMETER2_PRM_SET",
[20],
max_delay=5,
)
param2_change = fprime_test_api.get_telemetry_pred(
fprime_test_api.get_mnemonic("Ref.RecvBuff") + "." + "Parameter2", 20
)
fprime_test_api.assert_telemetry(param2_change, timeout=5)
fprime_test_api.send_and_assert_command(
fprime_test_api.get_mnemonic("Ref.RecvBuff") + "." + "PARAMETER2_PRM_SAVE",
max_delay=5,
)
# Send PARAMETER3_PRM_SET (confirm new value / SAVE ) unsigned integer 0..255
fprime_test_api.send_and_assert_command(
fprime_test_api.get_mnemonic("Ref.SendBuff") + "." + "PARAMETER3_PRM_SET",
[30],
max_delay=5,
)
param3_change = fprime_test_api.get_telemetry_pred(
fprime_test_api.get_mnemonic("Ref.SendBuff") + "." + "Parameter3", 30
)
fprime_test_api.assert_telemetry(param3_change, timeout=5)
fprime_test_api.send_and_assert_command(
fprime_test_api.get_mnemonic("Ref.SendBuff") + "." + "PARAMETER3_PRM_SAVE",
max_delay=5,
)
# Send PARAMETER4_PRM_SET (confirm new value / SAVE ) float
fprime_test_api.send_and_assert_command(
fprime_test_api.get_mnemonic("Ref.SendBuff") + "." + "PARAMETER4_PRM_SET",
[40],
max_delay=5,
)
param4_change = fprime_test_api.get_telemetry_pred(
fprime_test_api.get_mnemonic("Ref.SendBuff") + "." + "Parameter4", 40
)
fprime_test_api.assert_telemetry(param4_change, timeout=5)
fprime_test_api.send_and_assert_command(
fprime_test_api.get_mnemonic("Ref.SendBuff") + "." + "PARAMETER4_PRM_SAVE",
max_delay=5,
)
# Notes: send a xxx_set,value=current will not update telemetry channel. call assert_telemetry will fail