diff --git a/gnd/cosmos/install_cosmos_plugin.sh b/gnd/cosmos/install_cosmos_plugin.sh index 60d8c0d..cf90d42 100755 --- a/gnd/cosmos/install_cosmos_plugin.sh +++ b/gnd/cosmos/install_cosmos_plugin.sh @@ -26,6 +26,8 @@ adamant_assembly_name=${adamant_assembly_model%.assembly.yaml} adamant_assembly_name=${adamant_assembly_name##*/} adamant_assembly_dir=`dirname $adamant_assembly_model` cosmos_plugin_dir=`realpath $cosmos_plugin_dir` +adamant_script_dir=`realpath $adamant_assembly_dir/../../../test/scripts` +cosmos_script_dir=`realpath $cosmos_plugin_dir/../plugins/DEFAULT/targets_modified` # Get build directory: adamant_assembly_name_short=(${adamant_assembly_name//_/ }) @@ -53,5 +55,10 @@ do_copy() { do_copy "$adamant_assembly_cmdtlm_dir/${adamant_assembly_name}_ccsds_cosmos_commands.txt" $cosmos_plugin_dir/targets/$adamant_assembly_name_upper/cmd_tlm/cmd.txt do_copy "$adamant_assembly_cmdtlm_dir/${adamant_assembly_name}_ccsds_cosmos_telemetry.txt" $cosmos_plugin_dir/targets/$adamant_assembly_name_upper/cmd_tlm/tlm.txt do_copy "$adamant_assembly_plugin_dir/plugin.txt" $cosmos_plugin_dir/plugin.txt +do_copy "$adamant_script_dir/update-param-sys.py" $cosmos_script_dir/update-param-sys.py +do_copy "$adamant_script_dir/validate-param-sys.py" $cosmos_script_dir/validate-param-sys.py +do_copy "$adamant_script_dir/test_setup.py" $cosmos_script_dir/test_setup.py +do_copy "$adamant_script_dir/crc_16.py" $cosmos_script_dir/crc_16.py echo "Success." echo "Plugin files copied to $cosmos_plugin_dir." +echo "Script files copied to $cosmos_script_dir." diff --git a/test/scripts/update-param-sys.py b/test/scripts/update-param-sys.py index 7f1b3c6..19760b5 100644 --- a/test/scripts/update-param-sys.py +++ b/test/scripts/update-param-sys.py @@ -25,10 +25,21 @@ Test_Packed_Table += bytearray(struct.pack(">f", -5.00)) # Osc_B_Off Test_Packed_Table += bytearray(struct.pack(">f", -2.50)) + table_length = len(Test_Packed_Table) + # Version + #Test_Packed_Table += bytearray(struct.pack(">f", 0.0)) + # Crc_Table + #Test_Packed_Table += bytearray(struct.pack(">h", 0)) + # Buffer_Length + #Test_Packed_Table += bytearray(struct.pack(">h", 0)) + + #test_crc = crc_16.crc_16(Test_Packed_Table) + #int_crc = int.from_bytes(test_crc, 'big') + #print(int_crc) # Remove if CRC fully functional # Send nominal Update_Parameter_Table command expecting success: cmd("Linux_Example", "Parameter_Manager_Instance-Update_Parameter_Table", { - "Header.Table_Buffer_Length": len(Test_Packed_Table), + "Header.Table_Buffer_Length": table_length, "Header.Crc_Table": 19692, "Table_Buffer": list(Test_Packed_Table) }) @@ -40,7 +51,7 @@ # Send test Update_Parameter_Table command with bad CRC expecting Memory_Region_Crc_Invalid, Parameter_Table_Copy_Failure, # Working_Table_Update_Failure, and Command_Execution_Failure: cmd("Linux_Example", "Parameter_Manager_Instance-Update_Parameter_Table", { - "Header.Table_Buffer_Length": len(Test_Packed_Table), + "Header.Table_Buffer_Length": table_length, "Header.Crc_Table": 0, "Table_Buffer": list(Test_Packed_Table) }) @@ -54,7 +65,7 @@ # Send test Update_Parameter_Table command with bad length expecting Memory_Region_Length_Mismatch, Parameter_Table_Copy_Failure, # Working_Table_Update_Failure, and Command_Execution_Failure: cmd("Linux_Example", "Parameter_Manager_Instance-Update_Parameter_Table", { - "Header.Table_Buffer_Length": len(Test_Packed_Table) + 1, + "Header.Table_Buffer_Length": table_length + 1, "Header.Crc_Table": 19692, "Table_Buffer": list(Test_Packed_Table) }) diff --git a/test/scripts/validate-param-sys.py b/test/scripts/validate-param-sys.py index 847e790..1bcff06 100644 --- a/test/scripts/validate-param-sys.py +++ b/test/scripts/validate-param-sys.py @@ -25,10 +25,21 @@ Test_Packed_Table += bytearray(struct.pack(">f", -5.00)) # Osc_B_Off Test_Packed_Table += bytearray(struct.pack(">f", -2.50)) + table_length = len(Test_Packed_Table) + # Version + #Test_Packed_Table += bytearray(struct.pack(">f", 0.0)) + # Crc_Table + #Test_Packed_Table += bytearray(struct.pack(">h", 0)) + # Buffer_Length + #Test_Packed_Table += bytearray(struct.pack(">h", 0)) + + #test_crc = crc_16.crc_16(Test_Packed_Table) + #int_crc = int.from_bytes(test_crc, 'big') + #print(int_crc) # Remove if CRC fully functional # Send nominal Validate_Parameter_Table command expecting success: cmd("Linux_Example", "Parameter_Manager_Instance-Validate_Parameter_Table", { - "Header.Table_Buffer_Length": len(Test_Packed_Table), + "Header.Table_Buffer_Length": table_length, "Header.Crc_Table": 19692, "Table_Buffer": list(Test_Packed_Table) }) @@ -40,7 +51,7 @@ # Send test Validate_Parameter_Table command with bad CRC expecting Memory_Region_Crc_Invalid, Table_Validation_Failure, and # Command_Execution_Failure: cmd("Linux_Example", "Parameter_Manager_Instance-Validate_Parameter_Table", { - "Header.Table_Buffer_Length": len(Test_Packed_Table), + "Header.Table_Buffer_Length": table_length, "Header.Crc_Table": 0, "Table_Buffer": list(Test_Packed_Table) }) @@ -54,7 +65,7 @@ # Send test Validate_Parameter_Table command with bad length expecting Memory_Region_Length_Mismatch, Table_Validation_Failure, and # Command_Execution_Failure: cmd("Linux_Example", "Parameter_Manager_Instance-Validate_Parameter_Table", { - "Header.Table_Buffer_Length": len(Test_Packed_Table) + 1, + "Header.Table_Buffer_Length": table_length + 1, "Header.Crc_Table": 19692, "Table_Buffer": list(Test_Packed_Table) }) @@ -80,6 +91,7 @@ Test_Packed_Table += bytearray(struct.pack(">f", -5.00)) # Osc_B_Off Test_Packed_Table += bytearray(struct.pack(">f", -2.50)) + table_length = len(Test_Packed_Table) # Version #Test_Packed_Table += bytearray(struct.pack(">f", 0.0)) # Crc_Table @@ -88,7 +100,7 @@ #Test_Packed_Table += bytearray(struct.pack(">h", 55)) cmd("Linux_Example", "Parameter_Manager_Instance-Validate_Parameter_Table", { - "Header.Table_Buffer_Length": len(Test_Packed_Table), + "Header.Table_Buffer_Length": table_length, "Header.Crc_Table": 65043, "Table_Buffer": list(Test_Packed_Table) })