end-to-end test success
Some checks failed
Rust/sat-rs/pipeline/pr-main There was a failure building this commit
Some checks failed
Rust/sat-rs/pipeline/pr-main There was a failure building this commit
This commit is contained in:
parent
0b4a88837c
commit
cf26b81a22
@ -4,11 +4,12 @@ import dataclasses
|
|||||||
import enum
|
import enum
|
||||||
import struct
|
import struct
|
||||||
|
|
||||||
from spacepackets.ecss.tc import PacketId, PacketType
|
|
||||||
|
|
||||||
EXAMPLE_PUS_APID = 0x02
|
class Apid(enum.IntEnum):
|
||||||
EXAMPLE_PUS_PACKET_ID_TM = PacketId(PacketType.TM, True, EXAMPLE_PUS_APID)
|
SCHED = 1
|
||||||
TM_PACKET_IDS = [EXAMPLE_PUS_PACKET_ID_TM]
|
GENERIC_PUS = 2
|
||||||
|
ACS = 3
|
||||||
|
CFDP = 4
|
||||||
|
|
||||||
|
|
||||||
class EventSeverity(enum.IntEnum):
|
class EventSeverity(enum.IntEnum):
|
||||||
@ -36,13 +37,6 @@ class EventU32:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class Apid(enum.IntEnum):
|
|
||||||
SCHED = 1
|
|
||||||
GENERIC_PUS = 2
|
|
||||||
ACS = 3
|
|
||||||
CFDP = 4
|
|
||||||
|
|
||||||
|
|
||||||
class AcsId(enum.IntEnum):
|
class AcsId(enum.IntEnum):
|
||||||
MGM_0 = 0
|
MGM_0 = 0
|
||||||
|
|
||||||
|
@ -3,10 +3,11 @@
|
|||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from typing import Optional
|
from typing import Any, Optional
|
||||||
from prompt_toolkit.history import History
|
from prompt_toolkit.history import History
|
||||||
from prompt_toolkit.history import FileHistory
|
from prompt_toolkit.history import FileHistory
|
||||||
|
|
||||||
|
from spacepackets.ccsds import PacketId, PacketType
|
||||||
import tmtccmd
|
import tmtccmd
|
||||||
from spacepackets.ecss import PusTelemetry, PusVerificator
|
from spacepackets.ecss import PusTelemetry, PusVerificator
|
||||||
from spacepackets.ecss.pus_17_test import Service17Tm
|
from spacepackets.ecss.pus_17_test import Service17Tm
|
||||||
@ -16,7 +17,7 @@ from spacepackets.ccsds.time import CdsShortTimestamp
|
|||||||
from tmtccmd import TcHandlerBase, ProcedureParamsWrapper
|
from tmtccmd import TcHandlerBase, ProcedureParamsWrapper
|
||||||
from tmtccmd.core.base import BackendRequest
|
from tmtccmd.core.base import BackendRequest
|
||||||
from tmtccmd.pus import VerificationWrapper
|
from tmtccmd.pus import VerificationWrapper
|
||||||
from tmtccmd.tmtc import CcsdsTmHandler, SpecificApidHandlerBase
|
from tmtccmd.tmtc import CcsdsTmHandler, GenericApidHandlerBase
|
||||||
from tmtccmd.com import ComInterface
|
from tmtccmd.com import ComInterface
|
||||||
from tmtccmd.config import (
|
from tmtccmd.config import (
|
||||||
CmdTreeNode,
|
CmdTreeNode,
|
||||||
@ -46,7 +47,7 @@ from tmtccmd.util.obj_id import ObjectIdDictT
|
|||||||
|
|
||||||
|
|
||||||
import pus_tc
|
import pus_tc
|
||||||
from common import EXAMPLE_PUS_APID, TM_PACKET_IDS, EventU32
|
from common import Apid, EventU32
|
||||||
|
|
||||||
_LOGGER = logging.getLogger()
|
_LOGGER = logging.getLogger()
|
||||||
|
|
||||||
@ -62,10 +63,13 @@ class SatRsConfigHook(HookBase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert self.cfg_path is not None
|
assert self.cfg_path is not None
|
||||||
|
packet_id_list = []
|
||||||
|
for apid in Apid:
|
||||||
|
packet_id_list.append(PacketId(PacketType.TM, True, apid))
|
||||||
cfg = create_com_interface_cfg_default(
|
cfg = create_com_interface_cfg_default(
|
||||||
com_if_key=com_if_key,
|
com_if_key=com_if_key,
|
||||||
json_cfg_path=self.cfg_path,
|
json_cfg_path=self.cfg_path,
|
||||||
space_packet_ids=TM_PACKET_IDS,
|
space_packet_ids=packet_id_list,
|
||||||
)
|
)
|
||||||
assert cfg is not None
|
assert cfg is not None
|
||||||
return create_com_interface_default(cfg)
|
return create_com_interface_default(cfg)
|
||||||
@ -85,19 +89,19 @@ class SatRsConfigHook(HookBase):
|
|||||||
return get_core_object_ids()
|
return get_core_object_ids()
|
||||||
|
|
||||||
|
|
||||||
class PusHandler(SpecificApidHandlerBase):
|
class PusHandler(GenericApidHandlerBase):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
file_logger: logging.Logger,
|
file_logger: logging.Logger,
|
||||||
verif_wrapper: VerificationWrapper,
|
verif_wrapper: VerificationWrapper,
|
||||||
raw_logger: RawTmtcTimedLogWrapper,
|
raw_logger: RawTmtcTimedLogWrapper,
|
||||||
):
|
):
|
||||||
super().__init__(EXAMPLE_PUS_APID, None)
|
super().__init__(None)
|
||||||
self.file_logger = file_logger
|
self.file_logger = file_logger
|
||||||
self.raw_logger = raw_logger
|
self.raw_logger = raw_logger
|
||||||
self.verif_wrapper = verif_wrapper
|
self.verif_wrapper = verif_wrapper
|
||||||
|
|
||||||
def handle_tm(self, packet: bytes, _user_args: any):
|
def handle_tm(self, apid: int, packet: bytes, _user_args: Any):
|
||||||
try:
|
try:
|
||||||
pus_tm = PusTelemetry.unpack(packet, time_reader=CdsShortTimestamp.empty())
|
pus_tm = PusTelemetry.unpack(packet, time_reader=CdsShortTimestamp.empty())
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
@ -177,7 +181,7 @@ class TcHandler(TcHandlerBase):
|
|||||||
tc_sched_timestamp_len=CdsShortTimestamp.TIMESTAMP_SIZE,
|
tc_sched_timestamp_len=CdsShortTimestamp.TIMESTAMP_SIZE,
|
||||||
seq_cnt_provider=seq_count_provider,
|
seq_cnt_provider=seq_count_provider,
|
||||||
pus_verificator=self.verif_wrapper.pus_verificator,
|
pus_verificator=self.verif_wrapper.pus_verificator,
|
||||||
default_pus_apid=EXAMPLE_PUS_APID,
|
default_pus_apid=None,
|
||||||
)
|
)
|
||||||
|
|
||||||
def send_cb(self, send_params: SendCbParams):
|
def send_cb(self, send_params: SendCbParams):
|
||||||
@ -221,7 +225,6 @@ def main():
|
|||||||
post_args_wrapper.set_params_without_prompts(proc_wrapper)
|
post_args_wrapper.set_params_without_prompts(proc_wrapper)
|
||||||
else:
|
else:
|
||||||
post_args_wrapper.set_params_with_prompts(proc_wrapper)
|
post_args_wrapper.set_params_with_prompts(proc_wrapper)
|
||||||
params.apid = EXAMPLE_PUS_APID
|
|
||||||
setup_args = SetupWrapper(
|
setup_args = SetupWrapper(
|
||||||
hook_obj=hook_obj, setup_params=params, proc_param_wrapper=proc_wrapper
|
hook_obj=hook_obj, setup_params=params, proc_param_wrapper=proc_wrapper
|
||||||
)
|
)
|
||||||
@ -233,8 +236,9 @@ def main():
|
|||||||
verification_wrapper = VerificationWrapper(verificator, _LOGGER, file_logger)
|
verification_wrapper = VerificationWrapper(verificator, _LOGGER, file_logger)
|
||||||
# Create primary TM handler and add it to the CCSDS Packet Handler
|
# Create primary TM handler and add it to the CCSDS Packet Handler
|
||||||
tm_handler = PusHandler(file_logger, verification_wrapper, raw_logger)
|
tm_handler = PusHandler(file_logger, verification_wrapper, raw_logger)
|
||||||
ccsds_handler = CcsdsTmHandler(generic_handler=None)
|
ccsds_handler = CcsdsTmHandler(generic_handler=tm_handler)
|
||||||
ccsds_handler.add_apid_handler(tm_handler)
|
# TODO: We could add the CFDP handler for the CFDP APID at a later stage.
|
||||||
|
# ccsds_handler.add_apid_handler(tm_handler)
|
||||||
|
|
||||||
# Create TC handler
|
# Create TC handler
|
||||||
seq_count_provider = PusFileSeqCountProvider()
|
seq_count_provider = PusFileSeqCountProvider()
|
||||||
|
@ -10,7 +10,7 @@ from tmtccmd.tmtc import DefaultPusQueueHelper
|
|||||||
from tmtccmd.pus.s11_tc_sched import create_time_tagged_cmd
|
from tmtccmd.pus.s11_tc_sched import create_time_tagged_cmd
|
||||||
from tmtccmd.pus.s200_fsfw_mode import Subservice as ModeSubservice
|
from tmtccmd.pus.s200_fsfw_mode import Subservice as ModeSubservice
|
||||||
|
|
||||||
from common import EXAMPLE_PUS_APID, AcsId, Apid
|
from common import AcsId, Apid
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -87,10 +87,14 @@ def pack_pus_telecommands(q: DefaultPusQueueHelper, cmd_path: str):
|
|||||||
assert len(cmd_path_list) >= 2
|
assert len(cmd_path_list) >= 2
|
||||||
if cmd_path_list[1] == "ping":
|
if cmd_path_list[1] == "ping":
|
||||||
q.add_log_cmd("Sending PUS ping telecommand")
|
q.add_log_cmd("Sending PUS ping telecommand")
|
||||||
return q.add_pus_tc(PusTelecommand(service=17, subservice=1))
|
return q.add_pus_tc(
|
||||||
|
PusTelecommand(apid=Apid.GENERIC_PUS, service=17, subservice=1)
|
||||||
|
)
|
||||||
elif cmd_path_list[1] == "trigger_event":
|
elif cmd_path_list[1] == "trigger_event":
|
||||||
q.add_log_cmd("Triggering test event")
|
q.add_log_cmd("Triggering test event")
|
||||||
return q.add_pus_tc(PusTelecommand(service=17, subservice=128))
|
return q.add_pus_tc(
|
||||||
|
PusTelecommand(apid=Apid.GENERIC_PUS, service=17, subservice=128)
|
||||||
|
)
|
||||||
if cmd_path_list[0] == "scheduler":
|
if cmd_path_list[0] == "scheduler":
|
||||||
assert len(cmd_path_list) >= 2
|
assert len(cmd_path_list) >= 2
|
||||||
if cmd_path_list[1] == "schedule_ping_10_secs_ahead":
|
if cmd_path_list[1] == "schedule_ping_10_secs_ahead":
|
||||||
@ -102,7 +106,7 @@ def pack_pus_telecommands(q: DefaultPusQueueHelper, cmd_path: str):
|
|||||||
create_time_tagged_cmd(
|
create_time_tagged_cmd(
|
||||||
time_stamp,
|
time_stamp,
|
||||||
PusTelecommand(service=17, subservice=1),
|
PusTelecommand(service=17, subservice=1),
|
||||||
apid=EXAMPLE_PUS_APID,
|
apid=Apid.SCHED,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if cmd_path_list[0] == "acs":
|
if cmd_path_list[0] == "acs":
|
||||||
|
@ -129,8 +129,10 @@ impl<TmSender: EcssTmSenderCore> PusReceiver<TmSender> {
|
|||||||
if let Ok(custom_service) = CustomPusServiceId::try_from(e.number) {
|
if let Ok(custom_service) = CustomPusServiceId::try_from(e.number) {
|
||||||
match custom_service {
|
match custom_service {
|
||||||
CustomPusServiceId::Mode => {
|
CustomPusServiceId::Mode => {
|
||||||
// TODO: Fix mode service.
|
self.pus_router.mode_tc_sender.send(EcssTcAndToken {
|
||||||
//self.handle_mode_service(pus_tc, accepted_token)
|
tc_in_memory,
|
||||||
|
token: Some(accepted_token.into()),
|
||||||
|
})?
|
||||||
}
|
}
|
||||||
CustomPusServiceId::Health => {}
|
CustomPusServiceId::Health => {}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ use satrs::pus::verification::{
|
|||||||
};
|
};
|
||||||
use satrs::pus::{ActiveRequestProvider, EcssTmSenderCore, GenericRoutingError, PusRequestRouter};
|
use satrs::pus::{ActiveRequestProvider, EcssTmSenderCore, GenericRoutingError, PusRequestRouter};
|
||||||
use satrs::queue::GenericSendError;
|
use satrs::queue::GenericSendError;
|
||||||
use satrs::request::{GenericMessage, MessageMetadata};
|
use satrs::request::{GenericMessage, MessageMetadata, UniqueApidTargetId};
|
||||||
use satrs::spacepackets::ecss::tc::PusTcReader;
|
use satrs::spacepackets::ecss::tc::PusTcReader;
|
||||||
use satrs::spacepackets::ecss::PusPacket;
|
use satrs::spacepackets::ecss::PusPacket;
|
||||||
use satrs::ComponentId;
|
use satrs::ComponentId;
|
||||||
@ -61,6 +61,9 @@ impl GenericRequestRouter {
|
|||||||
.expect("token is not in accepted state");
|
.expect("token is not in accepted state");
|
||||||
match error {
|
match error {
|
||||||
GenericRoutingError::UnknownTargetId(id) => {
|
GenericRoutingError::UnknownTargetId(id) => {
|
||||||
|
let apid_target_id = UniqueApidTargetId::from(id);
|
||||||
|
warn!("Target APID for request: {}", apid_target_id.apid);
|
||||||
|
warn!("Target Unique ID for request: {}", apid_target_id.unique_id);
|
||||||
let mut fail_data: [u8; 8] = [0; 8];
|
let mut fail_data: [u8; 8] = [0; 8];
|
||||||
fail_data.copy_from_slice(&id.to_be_bytes());
|
fail_data.copy_from_slice(&id.to_be_bytes());
|
||||||
verif_reporter
|
verif_reporter
|
||||||
|
Loading…
Reference in New Issue
Block a user