Merge pull request 'allow consecutive tcp and udp server' (#331) from mueller_consecutive_tmtc_server into develop
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

Reviewed-on: #331
This commit is contained in:
Robin Müller 2022-12-02 18:03:38 +01:00
commit ace8900ca4
10 changed files with 121 additions and 56 deletions

View File

@ -102,11 +102,8 @@
/** CMake Defines */
/*******************************************************************/
// Use TCP instead of UDP for the TMTC bridge. This allows using the TMTC client locally
// because UDP packets are not allowed in the VPN
// This will cause the OBSW to initialize the TMTC bridge responsible for exchanging data with the
// CCSDS IP Cores.
#define OBSW_USE_TMTC_TCP_BRIDGE 0
#define OBSW_ADD_TMTC_UDP_SERVER 1
#define OBSW_ADD_TMTC_TCP_SERVER 1
#cmakedefine EIVE_BUILD_GPSD_GPS_HANDLER

View File

@ -15,10 +15,11 @@
#include "fsfw_tests/integration/task/TestTask.h"
#include "tmtc/pusIds.h"
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
#if OBSW_ADD_TMTC_UDP_SERVER == 1
#include "fsfw/osal/common/UdpTcPollingTask.h"
#include "fsfw/osal/common/UdpTmTcBridge.h"
#else
#endif
#if OBSW_ADD_TMTC_TCP_SERVER == 1
#include "fsfw/osal/common/TcpTmTcBridge.h"
#include "fsfw/osal/common/TcpTmTcServer.h"
#endif

View File

@ -68,14 +68,24 @@ void scheduling::initTasks() {
if (result != returnvalue::OK) {
sif::error << "Object add component failed" << std::endl;
}
result = tmtcDistributor->addComponent(objects::TMTC_BRIDGE);
result = tmtcDistributor->addComponent(objects::UDP_TMTC_SERVER);
if (result != returnvalue::OK) {
sif::error << "Add component UDP Unix Bridge failed" << std::endl;
}
result = tmtcDistributor->addComponent(objects::TCP_TMTC_SERVER);
if (result != returnvalue::OK) {
sif::error << "Add component UDP Unix Bridge failed" << std::endl;
}
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
"UDP_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask(
"UDP_POLLING", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = udpPollingTask->addComponent(objects::UDP_TMTC_POLLING_TASK);
if (result != returnvalue::OK) {
sif::error << "Add component UDP Polling failed" << std::endl;
}
PeriodicTaskIF* tcpPollingTask = factory->createPeriodicTask(
"TCP_POLLING", 70, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = tcpPollingTask->addComponent(objects::TCP_TMTC_POLLING_TASK);
if (result != returnvalue::OK) {
sif::error << "Add component UDP Polling failed" << std::endl;
}
@ -138,15 +148,6 @@ void scheduling::initTasks() {
PeriodicTaskIF* thermalTask = factory->createPeriodicTask(
"THERMAL_CTL_TASK", 40, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
result = thermalTask->addComponent(objects::RTD_0_IC3_PLOC_HEATSPREADER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("RTD_0_dummy", objects::RTD_0_IC3_PLOC_HEATSPREADER);
}
result = thermalTask->addComponent(objects::SUS_0_N_LOC_XFYFZM_PT_XF);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("SUS_0_dummy", objects::SUS_0_N_LOC_XFYFZM_PT_XF);
}
result = thermalTask->addComponent(objects::CORE_CONTROLLER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("Core controller dummy", objects::CORE_CONTROLLER);
@ -183,9 +184,41 @@ void scheduling::initTasks() {
}
#endif /* OBSW_ADD_TEST_CODE == 1 */
PeriodicTaskIF* dummyTask = factory->createPeriodicTask(
"DUMMY_TASK", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, missedDeadlineFunc);
dummyTask->addComponent(objects::SUS_0_N_LOC_XFYFZM_PT_XF);
dummyTask->addComponent(objects::SUS_1_N_LOC_XBYFZM_PT_XB);
dummyTask->addComponent(objects::SUS_2_N_LOC_XFYBZB_PT_YB);
dummyTask->addComponent(objects::SUS_3_N_LOC_XFYBZF_PT_YF);
dummyTask->addComponent(objects::SUS_4_N_LOC_XMYFZF_PT_ZF);
dummyTask->addComponent(objects::SUS_5_N_LOC_XFYMZB_PT_ZB);
dummyTask->addComponent(objects::SUS_6_R_LOC_XFYBZM_PT_XF);
dummyTask->addComponent(objects::SUS_7_R_LOC_XBYBZM_PT_XB);
dummyTask->addComponent(objects::SUS_8_R_LOC_XBYBZB_PT_YB);
dummyTask->addComponent(objects::SUS_9_R_LOC_XBYBZB_PT_YF);
dummyTask->addComponent(objects::SUS_10_N_LOC_XMYBZF_PT_ZF);
dummyTask->addComponent(objects::SUS_11_R_LOC_XBYMZB_PT_ZB);
dummyTask->addComponent(objects::RTD_0_IC3_PLOC_HEATSPREADER);
dummyTask->addComponent(objects::RTD_1_IC4_PLOC_MISSIONBOARD);
dummyTask->addComponent(objects::RTD_2_IC5_4K_CAMERA);
dummyTask->addComponent(objects::RTD_3_IC6_DAC_HEATSPREADER);
dummyTask->addComponent(objects::RTD_4_IC7_STARTRACKER);
dummyTask->addComponent(objects::RTD_5_IC8_RW1_MX_MY);
dummyTask->addComponent(objects::RTD_6_IC9_DRO);
dummyTask->addComponent(objects::RTD_7_IC10_SCEX);
dummyTask->addComponent(objects::RTD_8_IC11_X8);
dummyTask->addComponent(objects::RTD_9_IC12_HPA);
dummyTask->addComponent(objects::RTD_10_IC13_PL_TX);
dummyTask->addComponent(objects::RTD_11_IC14_MPA);
dummyTask->addComponent(objects::RTD_12_IC15_ACU);
dummyTask->addComponent(objects::RTD_13_IC16_PLPCDU_HEATSPREADER);
dummyTask->addComponent(objects::RTD_14_IC17_TCS_BOARD);
dummyTask->addComponent(objects::RTD_15_IC18_IMTQ);
sif::info << "Starting tasks.." << std::endl;
tmtcDistributor->startTask();
tmtcPollingTask->startTask();
udpPollingTask->startTask();
tcpPollingTask->startTask();
pusVerification->startTask();
eventHandling->startTask();
@ -195,6 +228,7 @@ void scheduling::initTasks() {
pstTask->startTask();
thermalTask->startTask();
dummyTask->startTask();
#if OBSW_ADD_PLOC_SUPERVISOR == 1
supvHelperTask->startTask();
#endif

View File

@ -124,7 +124,8 @@
// because UDP packets are not allowed in the VPN
// This will cause the OBSW to initialize the TMTC bridge responsible for exchanging data with the
// CCSDS IP Cores.
#define OBSW_USE_TMTC_TCP_BRIDGE 1
#define OBSW_ADD_TMTC_TCP_SERVER 1
#define OBSW_ADD_TMTC_UDP_SERVER 1
#cmakedefine EIVE_BUILD_GPSD_GPS_HANDLER

View File

@ -10,9 +10,10 @@
#include "fsfw/timemanager/Stopwatch.h"
#include "fsfw/version.h"
#include "watchdog/definitions.h"
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
#if OBSW_ADD_TMTC_UDP_SERVER == 1
#include "fsfw/osal/common/UdpTmTcBridge.h"
#else
#endif
#if OBSW_ADD_TMTC_TCP_SERVER == 1
#include "fsfw/osal/common/TcpTmTcServer.h"
#endif
#include <fcntl.h>

View File

@ -92,11 +92,19 @@ void scheduling::initTasks() {
/* TMTC Distribution */
PeriodicTaskIF* tmTcDistributor = factory->createPeriodicTask(
"DIST", 45, PeriodicTaskIF::MINIMUM_STACK_SIZE, 0.2, missedDeadlineFunc);
#if OBSW_ADD_TCPIP_BRIDGE == 1
result = tmTcDistributor->addComponent(objects::TMTC_BRIDGE);
#if OBSW_ADD_TCPIP_SERVERS == 1
#if OBSW_ADD_TMTC_UDP_SERVER == 1
result = tmTcDistributor->addComponent(objects::UDP_TMTC_SERVER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("TMTC_BRIDGE", objects::TMTC_BRIDGE);
scheduling::printAddObjectError("UDP_TMTC_SERVER", objects::UDP_TMTC_SERVER);
}
#endif
#if OBSW_ADD_TMTC_TCP_SERVER == 1
result = tmTcDistributor->addComponent(objects::TCP_TMTC_SERVER);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("TCP_TMTC_SERVER", objects::TCP_TMTC_SERVER);
}
#endif
#endif
result = tmTcDistributor->addComponent(objects::CCSDS_PACKET_DISTRIBUTOR);
if (result != returnvalue::OK) {
@ -115,14 +123,24 @@ void scheduling::initTasks() {
scheduling::printAddObjectError("TM_FUNNEL", objects::TM_FUNNEL);
}
#if OBSW_ADD_TCPIP_BRIDGE == 1
PeriodicTaskIF* tmtcPollingTask = factory->createPeriodicTask(
"TMTC_POLLING", 80, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = tmtcPollingTask->addComponent(objects::TMTC_POLLING_TASK);
#if OBSW_ADD_TCPIP_SERVERS == 1
#if OBSW_ADD_TMTC_UDP_SERVER == 1
PeriodicTaskIF* udpPollingTask = factory->createPeriodicTask(
"UDP_TMTC_POLLING", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = udpPollingTask->addComponent(objects::UDP_TMTC_POLLING_TASK);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("UDP_POLLING", objects::TMTC_POLLING_TASK);
scheduling::printAddObjectError("UDP_POLLING", objects::UDP_TMTC_POLLING_TASK);
}
#endif
#if OBSW_ADD_TMTC_TCP_SERVER == 1
PeriodicTaskIF* tcpPollingTask = factory->createPeriodicTask(
"TCP_TMTC_POLLING", 65, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, missedDeadlineFunc);
result = tcpPollingTask->addComponent(objects::TCP_TMTC_POLLING_TASK);
if (result != returnvalue::OK) {
scheduling::printAddObjectError("UDP_POLLING", objects::TCP_TMTC_POLLING_TASK);
}
#endif
#endif
#if OBSW_ADD_CCSDS_IP_CORES == 1
PeriodicTaskIF* ccsdsHandlerTask = factory->createPeriodicTask(
@ -349,8 +367,13 @@ void scheduling::initTasks() {
sif::info << "Starting tasks.." << std::endl;
tmTcDistributor->startTask();
#if OBSW_ADD_TCPIP_BRIDGE == 1
tmtcPollingTask->startTask();
#if OBSW_ADD_TCPIP_SERVERS == 1
#if OBSW_ADD_TMTC_UDP_SERVER == 1
udpPollingTask->startTask();
#endif
#if OBSW_ADD_TMTC_TCP_SERVER == 1
tcpPollingTask->startTask();
#endif
#endif
#if OBSW_ADD_CCSDS_IP_CORES == 1

View File

@ -17,7 +17,7 @@ debugging. */
#define OBSW_ADD_LWGPS_TEST 0
// Disable this for mission code. It allows exchanging TMTC packets via the Ethernet port
#define OBSW_ADD_TCPIP_BRIDGE 1
#define OBSW_ADD_TCPIP_SERVERS 1
#define OBSW_ADD_CFDP_COMPONENTS 1

View File

@ -8,8 +8,10 @@ enum commonObjects : uint32_t {
/* First Byte 0x50-0x52 reserved for PUS Services **/
CCSDS_PACKET_DISTRIBUTOR = 0x50000100,
PUS_PACKET_DISTRIBUTOR = 0x50000200,
TMTC_BRIDGE = 0x50000300,
TMTC_POLLING_TASK = 0x50000400,
TCP_TMTC_SERVER = 0x50000300,
UDP_TMTC_SERVER = 0x50000301,
TCP_TMTC_POLLING_TASK = 0x50000400,
UDP_TMTC_POLLING_TASK = 0x50000401,
FILE_SYSTEM_HANDLER = 0x50000500,
SDC_MANAGER = 0x50000550,
PTME = 0x50000600,

View File

@ -33,12 +33,13 @@
#include "objects/systemObjectList.h"
#include "tmtc/pusIds.h"
#if OBSW_ADD_TCPIP_BRIDGE == 1
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
#if OBSW_ADD_TCPIP_SERVERS == 1
#if OBSW_ADD_TMTC_UDP_SERVER == 1
// UDP server includes
#include "fsfw/osal/common/UdpTcPollingTask.h"
#include "fsfw/osal/common/UdpTmTcBridge.h"
#else
#endif
#if OBSW_ADD_TMTC_TCP_SERVER == 1
// TCP server includes
#include "fsfw/osal/common/TcpTmTcBridge.h"
#include "fsfw/osal/common/TcpTmTcServer.h"
@ -97,24 +98,23 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun
new PoolManager(objects::IPC_STORE, poolCfg);
}
#if OBSW_ADD_TCPIP_BRIDGE == 1
#if OBSW_USE_TMTC_TCP_BRIDGE == 0
auto tmtcBridge = new UdpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
new UdpTcPollingTask(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
#if OBSW_ADD_TCPIP_SERVERS == 1
#if OBSW_ADD_TMTC_UDP_SERVER == 1
auto udpBridge = new UdpTmTcBridge(objects::UDP_TMTC_SERVER, objects::CCSDS_PACKET_DISTRIBUTOR);
new UdpTcPollingTask(objects::UDP_TMTC_POLLING_TASK, objects::UDP_TMTC_SERVER);
sif::info << "Created UDP server for TMTC commanding with listener port "
<< tmtcBridge->getUdpPort() << std::endl;
#else
auto tmtcBridge = new TcpTmTcBridge(objects::TMTC_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR);
auto tcpServer = new TcpTmTcServer(objects::TMTC_POLLING_TASK, objects::TMTC_BRIDGE);
<< udpBridge->getUdpPort() << std::endl;
udpBridge->setMaxNumberOfPacketsStored(150);
#endif
#if OBSW_ADD_TMTC_TCP_SERVER == 1
auto tcpBridge = new TcpTmTcBridge(objects::TCP_TMTC_SERVER, objects::CCSDS_PACKET_DISTRIBUTOR);
auto tcpServer = new TcpTmTcServer(objects::TCP_TMTC_POLLING_TASK, objects::TCP_TMTC_SERVER);
// TCP is stream based. Use packet ID as start marker when parsing for space packets
tcpServer->setSpacePacketParsingOptions({common::PUS_PACKET_ID, common::CFDP_PACKET_ID});
sif::info << "Created TCP server for TMTC commanding with listener port "
<< tcpServer->getTcpPort() << std::endl;
#if OBSW_TCP_SERVER_WIRETAPPING == 1
tcpServer->enableWiretapping(true);
#endif /* OBSW_TCP_SERVER_WIRETAPPING == 1 */
tcpBridge->setMaxNumberOfPacketsStored(150);
#endif /* OBSW_USE_TMTC_TCP_BRIDGE == 0 */
tmtcBridge->setMaxNumberOfPacketsStored(150);
#endif /* OBSW_ADD_TCPIP_BRIDGE == 1 */
auto* ccsdsDistrib =
@ -123,9 +123,15 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun
*cfdpFunnel = new CfdpTmFunnel(objects::CFDP_TM_FUNNEL, config::EIVE_CFDP_APID, *tmStore, 50);
*pusFunnel = new PusTmFunnel(objects::PUS_TM_FUNNEL, *timeStamper, *tmStore, 80);
#if OBSW_ADD_TCPIP_BRIDGE == 1
(*cfdpFunnel)->addDestination(*tmtcBridge, 0);
(*pusFunnel)->addDestination(*tmtcBridge, 0);
#if OBSW_ADD_TCPIP_SERVERS == 1
#if OBSW_ADD_TMTC_UDP_SERVER == 1
(*cfdpFunnel)->addDestination(*udpBridge, 0);
(*pusFunnel)->addDestination(*udpBridge, 0);
#endif
#if OBSW_ADD_TMTC_TCP_SERVER == 1
(*cfdpFunnel)->addDestination(*tcpBridge, 0);
(*pusFunnel)->addDestination(*tcpBridge, 0);
#endif
#endif
// Every TM packet goes through this funnel
new TmFunnelHandler(objects::TM_FUNNEL, **pusFunnel, **cfdpFunnel);

2
tmtc

@ -1 +1 @@
Subproject commit d9fc58abed9df476a68d5dd4c798da6012fc597e
Subproject commit 56d0f26cbffbfbf4e790d3a19858162291104934