From cc879d5ba05ad391f28bf8eb3878437d168873ef Mon Sep 17 00:00:00 2001 From: "Quiring Paul (ETAS-ECM/XPC-Fe2)" Date: Thu, 26 Mar 2026 14:28:30 +0100 Subject: [PATCH 1/2] Remove deadline and logical supervisions from launch manager daemon --- .../expected_output/hm_demo.json | 2 - .../health_monitor_lib/BUILD | 2 - .../health_monitor_lib/config/hm_flatcfg.fbs | 47 +- .../config/hm_flatcfg_generated.h | 525 +----------------- .../config/hmcore_flatcfg.fbs | 6 +- .../config/hmcore_flatcfg_generated.h | 52 +- .../src/score/lcm/saf/daemon/PhmDaemon.cpp | 2 - .../score/lcm/saf/daemon/SwClusterHandler.cpp | 25 +- .../score/lcm/saf/daemon/SwClusterHandler.hpp | 8 - .../score/lcm/saf/factory/FlatCfgFactory.cpp | 277 +-------- .../score/lcm/saf/factory/FlatCfgFactory.hpp | 14 +- .../src/score/lcm/saf/factory/IPhmFactory.hpp | 25 +- .../lcm/saf/factory/MachineConfigFactory.cpp | 6 - .../lcm/saf/factory/MachineConfigFactory.hpp | 4 - .../score/lcm/saf/factory/StaticConfig.hpp | 4 - .../score/lcm/saf/supervision/Deadline.cpp | 465 ---------------- .../score/lcm/saf/supervision/Deadline.hpp | 267 --------- .../src/score/lcm/saf/supervision/Local.cpp | 12 - .../src/score/lcm/saf/supervision/Local.hpp | 12 - .../src/score/lcm/saf/supervision/Logical.cpp | 433 --------------- .../src/score/lcm/saf/supervision/Logical.hpp | 376 ------------- 21 files changed, 23 insertions(+), 2541 deletions(-) delete mode 100644 src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/supervision/Deadline.cpp delete mode 100644 src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/supervision/Deadline.hpp delete mode 100644 src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/supervision/Logical.cpp delete mode 100644 src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/supervision/Logical.hpp diff --git a/scripts/config_mapping/tests/empty_health_config_test/expected_output/hm_demo.json b/scripts/config_mapping/tests/empty_health_config_test/expected_output/hm_demo.json index 8e559853..99401745 100644 --- a/scripts/config_mapping/tests/empty_health_config_test/expected_output/hm_demo.json +++ b/scripts/config_mapping/tests/empty_health_config_test/expected_output/hm_demo.json @@ -5,8 +5,6 @@ "hmMonitorInterface": [], "hmSupervisionCheckpoint": [], "hmAliveSupervision": [], - "hmDeadlineSupervision": [], - "hmLogicalSupervision": [], "hmLocalSupervision": [], "hmGlobalSupervision": [], "hmRecoveryNotification": [] diff --git a/src/launch_manager_daemon/health_monitor_lib/BUILD b/src/launch_manager_daemon/health_monitor_lib/BUILD index 3c238818..626c0d51 100644 --- a/src/launch_manager_daemon/health_monitor_lib/BUILD +++ b/src/launch_manager_daemon/health_monitor_lib/BUILD @@ -203,12 +203,10 @@ cc_library_with_common_opts( name = "supervision", srcs = [ "src/score/lcm/saf/supervision/Alive.cpp", - "src/score/lcm/saf/supervision/Deadline.cpp", "src/score/lcm/saf/supervision/Global.cpp", "src/score/lcm/saf/supervision/ICheckpointSupervision.cpp", "src/score/lcm/saf/supervision/ISupervision.cpp", "src/score/lcm/saf/supervision/Local.cpp", - "src/score/lcm/saf/supervision/Logical.cpp", "src/score/lcm/saf/supervision/ProcessStateTracker.cpp", ], hdrs = glob([ diff --git a/src/launch_manager_daemon/health_monitor_lib/config/hm_flatcfg.fbs b/src/launch_manager_daemon/health_monitor_lib/config/hm_flatcfg.fbs index ba3f5acd..2c6b8f4f 100644 --- a/src/launch_manager_daemon/health_monitor_lib/config/hm_flatcfg.fbs +++ b/src/launch_manager_daemon/health_monitor_lib/config/hm_flatcfg.fbs @@ -18,11 +18,9 @@ table HMEcuCfg { hmMonitorInterface: [HmMonitorInterface] (id:3); hmSupervisionCheckpoint: [HmSupervisionCheckpoint] (id:4); hmAliveSupervision: [HmAliveSupervision] (id:5); - hmDeadlineSupervision: [HmDeadlineSupervision] (id:6); - hmLogicalSupervision: [HmLogicalSupervision] (id:7); - hmLocalSupervision: [HmLocalSupervision] (id:8); - hmGlobalSupervision: [HmGlobalSupervision] (id:9); - hmRecoveryNotification: [RecoveryNotification] (id:10); + hmLocalSupervision: [HmLocalSupervision] (id:6); + hmGlobalSupervision: [HmGlobalSupervision] (id:7); + hmRecoveryNotification: [RecoveryNotification] (id:8); } table Process { @@ -81,40 +79,10 @@ table HmAliveSupervision { refProcessGroupStates: [HmRefProcessGroupStates] (id:9); } -table HmDeadlineSupervision { - ruleContextKey: string (id:0); - maxDeadline: double (id:1); - minDeadline: double (id:2); - checkpointTransition: HmCheckpointTransition (id:3); - refProcessIndices: [uint32] (id:4); - refProcessGroupStates: [HmRefProcessGroupStates] (id:5); -} - -table HmLogicalSupervision { - ruleContextKey: string (id:0); - checkpoints: [HmLogicalCheckpoint] (id:1); - transitions: [HmLogicalTransition] (id:2); - refProcessIndices: [uint32] (id:3); - refProcessGroupStates: [HmRefProcessGroupStates] (id:4); -} - -table HmLogicalCheckpoint { - refCheckPointIndex: uint32 (id:0); - isInitial: bool (id:1); - isFinal: bool (id:2); -} - -table HmLogicalTransition { - checkpointSourceIdx: uint32 (id:0); - checkpointTargetIdx: uint32 (id:1); -} - table HmLocalSupervision { ruleContextKey: string (id:0); infoRefInterfacePath: string (id:1); hmRefAliveSupervision: [HmRefAliveSupervision] (id:2); - hmRefDeadlineSupervision: [HmRefDeadlineSupervision] (id:3); - hmRefLogicalSupervision: [HmRefLogicalSupervision] (id:4); } table HmRefAliveSupervision { @@ -122,15 +90,6 @@ table HmRefAliveSupervision { refAliveSupervisionIdx: uint32 (id:1); } -table HmRefDeadlineSupervision { - ruleContextKey: int (id:0); - refDeadlineSupervisionIdx: uint32 (id:1); -} - -table HmRefLogicalSupervision { - refLogicalSupervisionIdx: uint32 (id:0); -} - table HmGlobalSupervision { ruleContextKey: string (id:0); isSeverityCritical: bool (id:1); diff --git a/src/launch_manager_daemon/health_monitor_lib/config/hm_flatcfg_generated.h b/src/launch_manager_daemon/health_monitor_lib/config/hm_flatcfg_generated.h index 5a3f1957..67ad437b 100644 --- a/src/launch_manager_daemon/health_monitor_lib/config/hm_flatcfg_generated.h +++ b/src/launch_manager_daemon/health_monitor_lib/config/hm_flatcfg_generated.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation + * Copyright (c) 2026 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -54,30 +54,12 @@ struct HmCheckpointTransitionBuilder; struct HmAliveSupervision; struct HmAliveSupervisionBuilder; -struct HmDeadlineSupervision; -struct HmDeadlineSupervisionBuilder; - -struct HmLogicalSupervision; -struct HmLogicalSupervisionBuilder; - -struct HmLogicalCheckpoint; -struct HmLogicalCheckpointBuilder; - -struct HmLogicalTransition; -struct HmLogicalTransitionBuilder; - struct HmLocalSupervision; struct HmLocalSupervisionBuilder; struct HmRefAliveSupervision; struct HmRefAliveSupervisionBuilder; -struct HmRefDeadlineSupervision; -struct HmRefDeadlineSupervisionBuilder; - -struct HmRefLogicalSupervision; -struct HmRefLogicalSupervisionBuilder; - struct HmGlobalSupervision; struct HmGlobalSupervisionBuilder; @@ -132,11 +114,9 @@ struct HMEcuCfg FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { VT_HMMONITORINTERFACE = 10, VT_HMSUPERVISIONCHECKPOINT = 12, VT_HMALIVESUPERVISION = 14, - VT_HMDEADLINESUPERVISION = 16, - VT_HMLOGICALSUPERVISION = 18, - VT_HMLOCALSUPERVISION = 20, - VT_HMGLOBALSUPERVISION = 22, - VT_HMRECOVERYNOTIFICATION = 24 + VT_HMLOCALSUPERVISION = 16, + VT_HMGLOBALSUPERVISION = 18, + VT_HMRECOVERYNOTIFICATION = 20 }; int32_t versionMajor() const { return GetField(VT_VERSIONMAJOR, 0); @@ -156,12 +136,6 @@ struct HMEcuCfg FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { const ::flatbuffers::Vector<::flatbuffers::Offset> *hmAliveSupervision() const { return GetPointer> *>(VT_HMALIVESUPERVISION); } - const ::flatbuffers::Vector<::flatbuffers::Offset> *hmDeadlineSupervision() const { - return GetPointer> *>(VT_HMDEADLINESUPERVISION); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *hmLogicalSupervision() const { - return GetPointer> *>(VT_HMLOGICALSUPERVISION); - } const ::flatbuffers::Vector<::flatbuffers::Offset> *hmLocalSupervision() const { return GetPointer> *>(VT_HMLOCALSUPERVISION); } @@ -187,12 +161,6 @@ struct HMEcuCfg FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { VerifyOffset(verifier, VT_HMALIVESUPERVISION) && verifier.VerifyVector(hmAliveSupervision()) && verifier.VerifyVectorOfTables(hmAliveSupervision()) && - VerifyOffset(verifier, VT_HMDEADLINESUPERVISION) && - verifier.VerifyVector(hmDeadlineSupervision()) && - verifier.VerifyVectorOfTables(hmDeadlineSupervision()) && - VerifyOffset(verifier, VT_HMLOGICALSUPERVISION) && - verifier.VerifyVector(hmLogicalSupervision()) && - verifier.VerifyVectorOfTables(hmLogicalSupervision()) && VerifyOffset(verifier, VT_HMLOCALSUPERVISION) && verifier.VerifyVector(hmLocalSupervision()) && verifier.VerifyVectorOfTables(hmLocalSupervision()) && @@ -228,12 +196,6 @@ struct HMEcuCfgBuilder { void add_hmAliveSupervision(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> hmAliveSupervision) { fbb_.AddOffset(HMEcuCfg::VT_HMALIVESUPERVISION, hmAliveSupervision); } - void add_hmDeadlineSupervision(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> hmDeadlineSupervision) { - fbb_.AddOffset(HMEcuCfg::VT_HMDEADLINESUPERVISION, hmDeadlineSupervision); - } - void add_hmLogicalSupervision(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> hmLogicalSupervision) { - fbb_.AddOffset(HMEcuCfg::VT_HMLOGICALSUPERVISION, hmLogicalSupervision); - } void add_hmLocalSupervision(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> hmLocalSupervision) { fbb_.AddOffset(HMEcuCfg::VT_HMLOCALSUPERVISION, hmLocalSupervision); } @@ -262,8 +224,6 @@ inline ::flatbuffers::Offset CreateHMEcuCfg( ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> hmMonitorInterface = 0, ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> hmSupervisionCheckpoint = 0, ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> hmAliveSupervision = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> hmDeadlineSupervision = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> hmLogicalSupervision = 0, ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> hmLocalSupervision = 0, ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> hmGlobalSupervision = 0, ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> hmRecoveryNotification = 0) { @@ -271,8 +231,6 @@ inline ::flatbuffers::Offset CreateHMEcuCfg( builder_.add_hmRecoveryNotification(hmRecoveryNotification); builder_.add_hmGlobalSupervision(hmGlobalSupervision); builder_.add_hmLocalSupervision(hmLocalSupervision); - builder_.add_hmLogicalSupervision(hmLogicalSupervision); - builder_.add_hmDeadlineSupervision(hmDeadlineSupervision); builder_.add_hmAliveSupervision(hmAliveSupervision); builder_.add_hmSupervisionCheckpoint(hmSupervisionCheckpoint); builder_.add_hmMonitorInterface(hmMonitorInterface); @@ -290,8 +248,6 @@ inline ::flatbuffers::Offset CreateHMEcuCfgDirect( const std::vector<::flatbuffers::Offset> *hmMonitorInterface = nullptr, const std::vector<::flatbuffers::Offset> *hmSupervisionCheckpoint = nullptr, const std::vector<::flatbuffers::Offset> *hmAliveSupervision = nullptr, - const std::vector<::flatbuffers::Offset> *hmDeadlineSupervision = nullptr, - const std::vector<::flatbuffers::Offset> *hmLogicalSupervision = nullptr, const std::vector<::flatbuffers::Offset> *hmLocalSupervision = nullptr, const std::vector<::flatbuffers::Offset> *hmGlobalSupervision = nullptr, const std::vector<::flatbuffers::Offset> *hmRecoveryNotification = nullptr) { @@ -299,8 +255,6 @@ inline ::flatbuffers::Offset CreateHMEcuCfgDirect( auto hmMonitorInterface__ = hmMonitorInterface ? _fbb.CreateVector<::flatbuffers::Offset>(*hmMonitorInterface) : 0; auto hmSupervisionCheckpoint__ = hmSupervisionCheckpoint ? _fbb.CreateVector<::flatbuffers::Offset>(*hmSupervisionCheckpoint) : 0; auto hmAliveSupervision__ = hmAliveSupervision ? _fbb.CreateVector<::flatbuffers::Offset>(*hmAliveSupervision) : 0; - auto hmDeadlineSupervision__ = hmDeadlineSupervision ? _fbb.CreateVector<::flatbuffers::Offset>(*hmDeadlineSupervision) : 0; - auto hmLogicalSupervision__ = hmLogicalSupervision ? _fbb.CreateVector<::flatbuffers::Offset>(*hmLogicalSupervision) : 0; auto hmLocalSupervision__ = hmLocalSupervision ? _fbb.CreateVector<::flatbuffers::Offset>(*hmLocalSupervision) : 0; auto hmGlobalSupervision__ = hmGlobalSupervision ? _fbb.CreateVector<::flatbuffers::Offset>(*hmGlobalSupervision) : 0; auto hmRecoveryNotification__ = hmRecoveryNotification ? _fbb.CreateVector<::flatbuffers::Offset>(*hmRecoveryNotification) : 0; @@ -312,8 +266,6 @@ inline ::flatbuffers::Offset CreateHMEcuCfgDirect( hmMonitorInterface__, hmSupervisionCheckpoint__, hmAliveSupervision__, - hmDeadlineSupervision__, - hmLogicalSupervision__, hmLocalSupervision__, hmGlobalSupervision__, hmRecoveryNotification__); @@ -998,353 +950,12 @@ inline ::flatbuffers::Offset CreateHmAliveSupervisionDirect( refProcessGroupStates__); } -struct HmDeadlineSupervision FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef HmDeadlineSupervisionBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_RULECONTEXTKEY = 4, - VT_MAXDEADLINE = 6, - VT_MINDEADLINE = 8, - VT_CHECKPOINTTRANSITION = 10, - VT_REFPROCESSINDICES = 12, - VT_REFPROCESSGROUPSTATES = 14 - }; - const ::flatbuffers::String *ruleContextKey() const { - return GetPointer(VT_RULECONTEXTKEY); - } - double maxDeadline() const { - return GetField(VT_MAXDEADLINE, 0.0); - } - double minDeadline() const { - return GetField(VT_MINDEADLINE, 0.0); - } - const HMFlatBuffer::HmCheckpointTransition *checkpointTransition() const { - return GetPointer(VT_CHECKPOINTTRANSITION); - } - const ::flatbuffers::Vector *refProcessIndices() const { - return GetPointer *>(VT_REFPROCESSINDICES); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *refProcessGroupStates() const { - return GetPointer> *>(VT_REFPROCESSGROUPSTATES); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_RULECONTEXTKEY) && - verifier.VerifyString(ruleContextKey()) && - VerifyField(verifier, VT_MAXDEADLINE, 8) && - VerifyField(verifier, VT_MINDEADLINE, 8) && - VerifyOffset(verifier, VT_CHECKPOINTTRANSITION) && - verifier.VerifyTable(checkpointTransition()) && - VerifyOffset(verifier, VT_REFPROCESSINDICES) && - verifier.VerifyVector(refProcessIndices()) && - VerifyOffset(verifier, VT_REFPROCESSGROUPSTATES) && - verifier.VerifyVector(refProcessGroupStates()) && - verifier.VerifyVectorOfTables(refProcessGroupStates()) && - verifier.EndTable(); - } -}; - -struct HmDeadlineSupervisionBuilder { - typedef HmDeadlineSupervision Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_ruleContextKey(::flatbuffers::Offset<::flatbuffers::String> ruleContextKey) { - fbb_.AddOffset(HmDeadlineSupervision::VT_RULECONTEXTKEY, ruleContextKey); - } - void add_maxDeadline(double maxDeadline) { - fbb_.AddElement(HmDeadlineSupervision::VT_MAXDEADLINE, maxDeadline, 0.0); - } - void add_minDeadline(double minDeadline) { - fbb_.AddElement(HmDeadlineSupervision::VT_MINDEADLINE, minDeadline, 0.0); - } - void add_checkpointTransition(::flatbuffers::Offset checkpointTransition) { - fbb_.AddOffset(HmDeadlineSupervision::VT_CHECKPOINTTRANSITION, checkpointTransition); - } - void add_refProcessIndices(::flatbuffers::Offset<::flatbuffers::Vector> refProcessIndices) { - fbb_.AddOffset(HmDeadlineSupervision::VT_REFPROCESSINDICES, refProcessIndices); - } - void add_refProcessGroupStates(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> refProcessGroupStates) { - fbb_.AddOffset(HmDeadlineSupervision::VT_REFPROCESSGROUPSTATES, refProcessGroupStates); - } - explicit HmDeadlineSupervisionBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } -}; - -inline ::flatbuffers::Offset CreateHmDeadlineSupervision( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::String> ruleContextKey = 0, - double maxDeadline = 0.0, - double minDeadline = 0.0, - ::flatbuffers::Offset checkpointTransition = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> refProcessIndices = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> refProcessGroupStates = 0) { - HmDeadlineSupervisionBuilder builder_(_fbb); - builder_.add_minDeadline(minDeadline); - builder_.add_maxDeadline(maxDeadline); - builder_.add_refProcessGroupStates(refProcessGroupStates); - builder_.add_refProcessIndices(refProcessIndices); - builder_.add_checkpointTransition(checkpointTransition); - builder_.add_ruleContextKey(ruleContextKey); - return builder_.Finish(); -} - -inline ::flatbuffers::Offset CreateHmDeadlineSupervisionDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const char *ruleContextKey = nullptr, - double maxDeadline = 0.0, - double minDeadline = 0.0, - ::flatbuffers::Offset checkpointTransition = 0, - const std::vector *refProcessIndices = nullptr, - const std::vector<::flatbuffers::Offset> *refProcessGroupStates = nullptr) { - auto ruleContextKey__ = ruleContextKey ? _fbb.CreateString(ruleContextKey) : 0; - auto refProcessIndices__ = refProcessIndices ? _fbb.CreateVector(*refProcessIndices) : 0; - auto refProcessGroupStates__ = refProcessGroupStates ? _fbb.CreateVector<::flatbuffers::Offset>(*refProcessGroupStates) : 0; - return HMFlatBuffer::CreateHmDeadlineSupervision( - _fbb, - ruleContextKey__, - maxDeadline, - minDeadline, - checkpointTransition, - refProcessIndices__, - refProcessGroupStates__); -} - -struct HmLogicalSupervision FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef HmLogicalSupervisionBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_RULECONTEXTKEY = 4, - VT_CHECKPOINTS = 6, - VT_TRANSITIONS = 8, - VT_REFPROCESSINDICES = 10, - VT_REFPROCESSGROUPSTATES = 12 - }; - const ::flatbuffers::String *ruleContextKey() const { - return GetPointer(VT_RULECONTEXTKEY); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *checkpoints() const { - return GetPointer> *>(VT_CHECKPOINTS); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *transitions() const { - return GetPointer> *>(VT_TRANSITIONS); - } - const ::flatbuffers::Vector *refProcessIndices() const { - return GetPointer *>(VT_REFPROCESSINDICES); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *refProcessGroupStates() const { - return GetPointer> *>(VT_REFPROCESSGROUPSTATES); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_RULECONTEXTKEY) && - verifier.VerifyString(ruleContextKey()) && - VerifyOffset(verifier, VT_CHECKPOINTS) && - verifier.VerifyVector(checkpoints()) && - verifier.VerifyVectorOfTables(checkpoints()) && - VerifyOffset(verifier, VT_TRANSITIONS) && - verifier.VerifyVector(transitions()) && - verifier.VerifyVectorOfTables(transitions()) && - VerifyOffset(verifier, VT_REFPROCESSINDICES) && - verifier.VerifyVector(refProcessIndices()) && - VerifyOffset(verifier, VT_REFPROCESSGROUPSTATES) && - verifier.VerifyVector(refProcessGroupStates()) && - verifier.VerifyVectorOfTables(refProcessGroupStates()) && - verifier.EndTable(); - } -}; - -struct HmLogicalSupervisionBuilder { - typedef HmLogicalSupervision Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_ruleContextKey(::flatbuffers::Offset<::flatbuffers::String> ruleContextKey) { - fbb_.AddOffset(HmLogicalSupervision::VT_RULECONTEXTKEY, ruleContextKey); - } - void add_checkpoints(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> checkpoints) { - fbb_.AddOffset(HmLogicalSupervision::VT_CHECKPOINTS, checkpoints); - } - void add_transitions(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> transitions) { - fbb_.AddOffset(HmLogicalSupervision::VT_TRANSITIONS, transitions); - } - void add_refProcessIndices(::flatbuffers::Offset<::flatbuffers::Vector> refProcessIndices) { - fbb_.AddOffset(HmLogicalSupervision::VT_REFPROCESSINDICES, refProcessIndices); - } - void add_refProcessGroupStates(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> refProcessGroupStates) { - fbb_.AddOffset(HmLogicalSupervision::VT_REFPROCESSGROUPSTATES, refProcessGroupStates); - } - explicit HmLogicalSupervisionBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } -}; - -inline ::flatbuffers::Offset CreateHmLogicalSupervision( - ::flatbuffers::FlatBufferBuilder &_fbb, - ::flatbuffers::Offset<::flatbuffers::String> ruleContextKey = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> checkpoints = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> transitions = 0, - ::flatbuffers::Offset<::flatbuffers::Vector> refProcessIndices = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> refProcessGroupStates = 0) { - HmLogicalSupervisionBuilder builder_(_fbb); - builder_.add_refProcessGroupStates(refProcessGroupStates); - builder_.add_refProcessIndices(refProcessIndices); - builder_.add_transitions(transitions); - builder_.add_checkpoints(checkpoints); - builder_.add_ruleContextKey(ruleContextKey); - return builder_.Finish(); -} - -inline ::flatbuffers::Offset CreateHmLogicalSupervisionDirect( - ::flatbuffers::FlatBufferBuilder &_fbb, - const char *ruleContextKey = nullptr, - const std::vector<::flatbuffers::Offset> *checkpoints = nullptr, - const std::vector<::flatbuffers::Offset> *transitions = nullptr, - const std::vector *refProcessIndices = nullptr, - const std::vector<::flatbuffers::Offset> *refProcessGroupStates = nullptr) { - auto ruleContextKey__ = ruleContextKey ? _fbb.CreateString(ruleContextKey) : 0; - auto checkpoints__ = checkpoints ? _fbb.CreateVector<::flatbuffers::Offset>(*checkpoints) : 0; - auto transitions__ = transitions ? _fbb.CreateVector<::flatbuffers::Offset>(*transitions) : 0; - auto refProcessIndices__ = refProcessIndices ? _fbb.CreateVector(*refProcessIndices) : 0; - auto refProcessGroupStates__ = refProcessGroupStates ? _fbb.CreateVector<::flatbuffers::Offset>(*refProcessGroupStates) : 0; - return HMFlatBuffer::CreateHmLogicalSupervision( - _fbb, - ruleContextKey__, - checkpoints__, - transitions__, - refProcessIndices__, - refProcessGroupStates__); -} - -struct HmLogicalCheckpoint FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef HmLogicalCheckpointBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_REFCHECKPOINTINDEX = 4, - VT_ISINITIAL = 6, - VT_ISFINAL = 8 - }; - uint32_t refCheckPointIndex() const { - return GetField(VT_REFCHECKPOINTINDEX, 0); - } - bool isInitial() const { - return GetField(VT_ISINITIAL, 0) != 0; - } - bool isFinal() const { - return GetField(VT_ISFINAL, 0) != 0; - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_REFCHECKPOINTINDEX, 4) && - VerifyField(verifier, VT_ISINITIAL, 1) && - VerifyField(verifier, VT_ISFINAL, 1) && - verifier.EndTable(); - } -}; - -struct HmLogicalCheckpointBuilder { - typedef HmLogicalCheckpoint Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_refCheckPointIndex(uint32_t refCheckPointIndex) { - fbb_.AddElement(HmLogicalCheckpoint::VT_REFCHECKPOINTINDEX, refCheckPointIndex, 0); - } - void add_isInitial(bool isInitial) { - fbb_.AddElement(HmLogicalCheckpoint::VT_ISINITIAL, static_cast(isInitial), 0); - } - void add_isFinal(bool isFinal) { - fbb_.AddElement(HmLogicalCheckpoint::VT_ISFINAL, static_cast(isFinal), 0); - } - explicit HmLogicalCheckpointBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } -}; - -inline ::flatbuffers::Offset CreateHmLogicalCheckpoint( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t refCheckPointIndex = 0, - bool isInitial = false, - bool isFinal = false) { - HmLogicalCheckpointBuilder builder_(_fbb); - builder_.add_refCheckPointIndex(refCheckPointIndex); - builder_.add_isFinal(isFinal); - builder_.add_isInitial(isInitial); - return builder_.Finish(); -} - -struct HmLogicalTransition FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef HmLogicalTransitionBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_CHECKPOINTSOURCEIDX = 4, - VT_CHECKPOINTTARGETIDX = 6 - }; - uint32_t checkpointSourceIdx() const { - return GetField(VT_CHECKPOINTSOURCEIDX, 0); - } - uint32_t checkpointTargetIdx() const { - return GetField(VT_CHECKPOINTTARGETIDX, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_CHECKPOINTSOURCEIDX, 4) && - VerifyField(verifier, VT_CHECKPOINTTARGETIDX, 4) && - verifier.EndTable(); - } -}; - -struct HmLogicalTransitionBuilder { - typedef HmLogicalTransition Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_checkpointSourceIdx(uint32_t checkpointSourceIdx) { - fbb_.AddElement(HmLogicalTransition::VT_CHECKPOINTSOURCEIDX, checkpointSourceIdx, 0); - } - void add_checkpointTargetIdx(uint32_t checkpointTargetIdx) { - fbb_.AddElement(HmLogicalTransition::VT_CHECKPOINTTARGETIDX, checkpointTargetIdx, 0); - } - explicit HmLogicalTransitionBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } -}; - -inline ::flatbuffers::Offset CreateHmLogicalTransition( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t checkpointSourceIdx = 0, - uint32_t checkpointTargetIdx = 0) { - HmLogicalTransitionBuilder builder_(_fbb); - builder_.add_checkpointTargetIdx(checkpointTargetIdx); - builder_.add_checkpointSourceIdx(checkpointSourceIdx); - return builder_.Finish(); -} - struct HmLocalSupervision FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { typedef HmLocalSupervisionBuilder Builder; enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { VT_RULECONTEXTKEY = 4, VT_INFOREFINTERFACEPATH = 6, - VT_HMREFALIVESUPERVISION = 8, - VT_HMREFDEADLINESUPERVISION = 10, - VT_HMREFLOGICALSUPERVISION = 12 + VT_HMREFALIVESUPERVISION = 8 }; const ::flatbuffers::String *ruleContextKey() const { return GetPointer(VT_RULECONTEXTKEY); @@ -1355,12 +966,6 @@ struct HmLocalSupervision FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table const ::flatbuffers::Vector<::flatbuffers::Offset> *hmRefAliveSupervision() const { return GetPointer> *>(VT_HMREFALIVESUPERVISION); } - const ::flatbuffers::Vector<::flatbuffers::Offset> *hmRefDeadlineSupervision() const { - return GetPointer> *>(VT_HMREFDEADLINESUPERVISION); - } - const ::flatbuffers::Vector<::flatbuffers::Offset> *hmRefLogicalSupervision() const { - return GetPointer> *>(VT_HMREFLOGICALSUPERVISION); - } bool Verify(::flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyOffset(verifier, VT_RULECONTEXTKEY) && @@ -1370,12 +975,6 @@ struct HmLocalSupervision FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table VerifyOffset(verifier, VT_HMREFALIVESUPERVISION) && verifier.VerifyVector(hmRefAliveSupervision()) && verifier.VerifyVectorOfTables(hmRefAliveSupervision()) && - VerifyOffset(verifier, VT_HMREFDEADLINESUPERVISION) && - verifier.VerifyVector(hmRefDeadlineSupervision()) && - verifier.VerifyVectorOfTables(hmRefDeadlineSupervision()) && - VerifyOffset(verifier, VT_HMREFLOGICALSUPERVISION) && - verifier.VerifyVector(hmRefLogicalSupervision()) && - verifier.VerifyVectorOfTables(hmRefLogicalSupervision()) && verifier.EndTable(); } }; @@ -1393,12 +992,6 @@ struct HmLocalSupervisionBuilder { void add_hmRefAliveSupervision(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> hmRefAliveSupervision) { fbb_.AddOffset(HmLocalSupervision::VT_HMREFALIVESUPERVISION, hmRefAliveSupervision); } - void add_hmRefDeadlineSupervision(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> hmRefDeadlineSupervision) { - fbb_.AddOffset(HmLocalSupervision::VT_HMREFDEADLINESUPERVISION, hmRefDeadlineSupervision); - } - void add_hmRefLogicalSupervision(::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> hmRefLogicalSupervision) { - fbb_.AddOffset(HmLocalSupervision::VT_HMREFLOGICALSUPERVISION, hmRefLogicalSupervision); - } explicit HmLocalSupervisionBuilder(::flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); @@ -1414,12 +1007,8 @@ inline ::flatbuffers::Offset CreateHmLocalSupervision( ::flatbuffers::FlatBufferBuilder &_fbb, ::flatbuffers::Offset<::flatbuffers::String> ruleContextKey = 0, ::flatbuffers::Offset<::flatbuffers::String> infoRefInterfacePath = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> hmRefAliveSupervision = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> hmRefDeadlineSupervision = 0, - ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> hmRefLogicalSupervision = 0) { + ::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset>> hmRefAliveSupervision = 0) { HmLocalSupervisionBuilder builder_(_fbb); - builder_.add_hmRefLogicalSupervision(hmRefLogicalSupervision); - builder_.add_hmRefDeadlineSupervision(hmRefDeadlineSupervision); builder_.add_hmRefAliveSupervision(hmRefAliveSupervision); builder_.add_infoRefInterfacePath(infoRefInterfacePath); builder_.add_ruleContextKey(ruleContextKey); @@ -1430,21 +1019,15 @@ inline ::flatbuffers::Offset CreateHmLocalSupervisionDirect( ::flatbuffers::FlatBufferBuilder &_fbb, const char *ruleContextKey = nullptr, const char *infoRefInterfacePath = nullptr, - const std::vector<::flatbuffers::Offset> *hmRefAliveSupervision = nullptr, - const std::vector<::flatbuffers::Offset> *hmRefDeadlineSupervision = nullptr, - const std::vector<::flatbuffers::Offset> *hmRefLogicalSupervision = nullptr) { + const std::vector<::flatbuffers::Offset> *hmRefAliveSupervision = nullptr) { auto ruleContextKey__ = ruleContextKey ? _fbb.CreateString(ruleContextKey) : 0; auto infoRefInterfacePath__ = infoRefInterfacePath ? _fbb.CreateString(infoRefInterfacePath) : 0; auto hmRefAliveSupervision__ = hmRefAliveSupervision ? _fbb.CreateVector<::flatbuffers::Offset>(*hmRefAliveSupervision) : 0; - auto hmRefDeadlineSupervision__ = hmRefDeadlineSupervision ? _fbb.CreateVector<::flatbuffers::Offset>(*hmRefDeadlineSupervision) : 0; - auto hmRefLogicalSupervision__ = hmRefLogicalSupervision ? _fbb.CreateVector<::flatbuffers::Offset>(*hmRefLogicalSupervision) : 0; return HMFlatBuffer::CreateHmLocalSupervision( _fbb, ruleContextKey__, infoRefInterfacePath__, - hmRefAliveSupervision__, - hmRefDeadlineSupervision__, - hmRefLogicalSupervision__); + hmRefAliveSupervision__); } struct HmRefAliveSupervision FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { @@ -1498,98 +1081,6 @@ inline ::flatbuffers::Offset CreateHmRefAliveSupervision( return builder_.Finish(); } -struct HmRefDeadlineSupervision FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef HmRefDeadlineSupervisionBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_RULECONTEXTKEY = 4, - VT_REFDEADLINESUPERVISIONIDX = 6 - }; - int32_t ruleContextKey() const { - return GetField(VT_RULECONTEXTKEY, 0); - } - uint32_t refDeadlineSupervisionIdx() const { - return GetField(VT_REFDEADLINESUPERVISIONIDX, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_RULECONTEXTKEY, 4) && - VerifyField(verifier, VT_REFDEADLINESUPERVISIONIDX, 4) && - verifier.EndTable(); - } -}; - -struct HmRefDeadlineSupervisionBuilder { - typedef HmRefDeadlineSupervision Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_ruleContextKey(int32_t ruleContextKey) { - fbb_.AddElement(HmRefDeadlineSupervision::VT_RULECONTEXTKEY, ruleContextKey, 0); - } - void add_refDeadlineSupervisionIdx(uint32_t refDeadlineSupervisionIdx) { - fbb_.AddElement(HmRefDeadlineSupervision::VT_REFDEADLINESUPERVISIONIDX, refDeadlineSupervisionIdx, 0); - } - explicit HmRefDeadlineSupervisionBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } -}; - -inline ::flatbuffers::Offset CreateHmRefDeadlineSupervision( - ::flatbuffers::FlatBufferBuilder &_fbb, - int32_t ruleContextKey = 0, - uint32_t refDeadlineSupervisionIdx = 0) { - HmRefDeadlineSupervisionBuilder builder_(_fbb); - builder_.add_refDeadlineSupervisionIdx(refDeadlineSupervisionIdx); - builder_.add_ruleContextKey(ruleContextKey); - return builder_.Finish(); -} - -struct HmRefLogicalSupervision FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { - typedef HmRefLogicalSupervisionBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_REFLOGICALSUPERVISIONIDX = 4 - }; - uint32_t refLogicalSupervisionIdx() const { - return GetField(VT_REFLOGICALSUPERVISIONIDX, 0); - } - bool Verify(::flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_REFLOGICALSUPERVISIONIDX, 4) && - verifier.EndTable(); - } -}; - -struct HmRefLogicalSupervisionBuilder { - typedef HmRefLogicalSupervision Table; - ::flatbuffers::FlatBufferBuilder &fbb_; - ::flatbuffers::uoffset_t start_; - void add_refLogicalSupervisionIdx(uint32_t refLogicalSupervisionIdx) { - fbb_.AddElement(HmRefLogicalSupervision::VT_REFLOGICALSUPERVISIONIDX, refLogicalSupervisionIdx, 0); - } - explicit HmRefLogicalSupervisionBuilder(::flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ::flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = ::flatbuffers::Offset(end); - return o; - } -}; - -inline ::flatbuffers::Offset CreateHmRefLogicalSupervision( - ::flatbuffers::FlatBufferBuilder &_fbb, - uint32_t refLogicalSupervisionIdx = 0) { - HmRefLogicalSupervisionBuilder builder_(_fbb); - builder_.add_refLogicalSupervisionIdx(refLogicalSupervisionIdx); - return builder_.Finish(); -} - struct HmGlobalSupervision FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { typedef HmGlobalSupervisionBuilder Builder; enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { diff --git a/src/launch_manager_daemon/health_monitor_lib/config/hmcore_flatcfg.fbs b/src/launch_manager_daemon/health_monitor_lib/config/hmcore_flatcfg.fbs index 98fa036a..9cf8826c 100644 --- a/src/launch_manager_daemon/health_monitor_lib/config/hmcore_flatcfg.fbs +++ b/src/launch_manager_daemon/health_monitor_lib/config/hmcore_flatcfg.fbs @@ -26,10 +26,8 @@ table HmConfig { periodicity: uint32 (id:0); bufferSizeMonitor: uint16 (id:1); bufferSizeAliveSupervision: uint16 (id:2); - bufferSizeDeadlineSupervision: uint16 (id:3); - bufferSizeLogicalSupervision: uint16 (id:4); - bufferSizeLocalSupervision: uint16 (id:5); - bufferSizeGlobalSupervision: uint16 (id:6); + bufferSizeLocalSupervision: uint16 (id:3); + bufferSizeGlobalSupervision: uint16 (id:4); } root_type HMCOREEcuCfg; diff --git a/src/launch_manager_daemon/health_monitor_lib/config/hmcore_flatcfg_generated.h b/src/launch_manager_daemon/health_monitor_lib/config/hmcore_flatcfg_generated.h index 1b282f67..4d3fb96d 100644 --- a/src/launch_manager_daemon/health_monitor_lib/config/hmcore_flatcfg_generated.h +++ b/src/launch_manager_daemon/health_monitor_lib/config/hmcore_flatcfg_generated.h @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation + * Copyright (c) 2026 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -255,22 +255,12 @@ inline ::flatbuffers::Offset CreateWatchdogDirect( struct HmConfig FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { typedef HmConfigBuilder Builder; enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ENABLETERMINATIONREQUEST = 4, - VT_HASVALUEENABLETERMINATIONREQUEST = 6, - VT_PERIODICITY = 8, - VT_BUFFERSIZEMONITOR = 10, - VT_BUFFERSIZEALIVESUPERVISION = 12, - VT_BUFFERSIZEDEADLINESUPERVISION = 14, - VT_BUFFERSIZELOGICALSUPERVISION = 16, - VT_BUFFERSIZELOCALSUPERVISION = 18, - VT_BUFFERSIZEGLOBALSUPERVISION = 20 + VT_PERIODICITY = 4, + VT_BUFFERSIZEMONITOR = 6, + VT_BUFFERSIZEALIVESUPERVISION = 8, + VT_BUFFERSIZELOCALSUPERVISION = 10, + VT_BUFFERSIZEGLOBALSUPERVISION = 12 }; - bool enableTerminationRequest() const { - return GetField(VT_ENABLETERMINATIONREQUEST, 0) != 0; - } - bool hasValueEnableTerminationRequest() const { - return GetField(VT_HASVALUEENABLETERMINATIONREQUEST, 0) != 0; - } uint32_t periodicity() const { return GetField(VT_PERIODICITY, 0); } @@ -280,12 +270,6 @@ struct HmConfig FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { uint16_t bufferSizeAliveSupervision() const { return GetField(VT_BUFFERSIZEALIVESUPERVISION, 0); } - uint16_t bufferSizeDeadlineSupervision() const { - return GetField(VT_BUFFERSIZEDEADLINESUPERVISION, 0); - } - uint16_t bufferSizeLogicalSupervision() const { - return GetField(VT_BUFFERSIZELOGICALSUPERVISION, 0); - } uint16_t bufferSizeLocalSupervision() const { return GetField(VT_BUFFERSIZELOCALSUPERVISION, 0); } @@ -294,13 +278,9 @@ struct HmConfig FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table { } bool Verify(::flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && - VerifyField(verifier, VT_ENABLETERMINATIONREQUEST, 1) && - VerifyField(verifier, VT_HASVALUEENABLETERMINATIONREQUEST, 1) && VerifyField(verifier, VT_PERIODICITY, 4) && VerifyField(verifier, VT_BUFFERSIZEMONITOR, 2) && VerifyField(verifier, VT_BUFFERSIZEALIVESUPERVISION, 2) && - VerifyField(verifier, VT_BUFFERSIZEDEADLINESUPERVISION, 2) && - VerifyField(verifier, VT_BUFFERSIZELOGICALSUPERVISION, 2) && VerifyField(verifier, VT_BUFFERSIZELOCALSUPERVISION, 2) && VerifyField(verifier, VT_BUFFERSIZEGLOBALSUPERVISION, 2) && verifier.EndTable(); @@ -311,12 +291,6 @@ struct HmConfigBuilder { typedef HmConfig Table; ::flatbuffers::FlatBufferBuilder &fbb_; ::flatbuffers::uoffset_t start_; - void add_enableTerminationRequest(bool enableTerminationRequest) { - fbb_.AddElement(HmConfig::VT_ENABLETERMINATIONREQUEST, static_cast(enableTerminationRequest), 0); - } - void add_hasValueEnableTerminationRequest(bool hasValueEnableTerminationRequest) { - fbb_.AddElement(HmConfig::VT_HASVALUEENABLETERMINATIONREQUEST, static_cast(hasValueEnableTerminationRequest), 0); - } void add_periodicity(uint32_t periodicity) { fbb_.AddElement(HmConfig::VT_PERIODICITY, periodicity, 0); } @@ -326,12 +300,6 @@ struct HmConfigBuilder { void add_bufferSizeAliveSupervision(uint16_t bufferSizeAliveSupervision) { fbb_.AddElement(HmConfig::VT_BUFFERSIZEALIVESUPERVISION, bufferSizeAliveSupervision, 0); } - void add_bufferSizeDeadlineSupervision(uint16_t bufferSizeDeadlineSupervision) { - fbb_.AddElement(HmConfig::VT_BUFFERSIZEDEADLINESUPERVISION, bufferSizeDeadlineSupervision, 0); - } - void add_bufferSizeLogicalSupervision(uint16_t bufferSizeLogicalSupervision) { - fbb_.AddElement(HmConfig::VT_BUFFERSIZELOGICALSUPERVISION, bufferSizeLogicalSupervision, 0); - } void add_bufferSizeLocalSupervision(uint16_t bufferSizeLocalSupervision) { fbb_.AddElement(HmConfig::VT_BUFFERSIZELOCALSUPERVISION, bufferSizeLocalSupervision, 0); } @@ -351,25 +319,17 @@ struct HmConfigBuilder { inline ::flatbuffers::Offset CreateHmConfig( ::flatbuffers::FlatBufferBuilder &_fbb, - bool enableTerminationRequest = false, - bool hasValueEnableTerminationRequest = false, uint32_t periodicity = 0, uint16_t bufferSizeMonitor = 0, uint16_t bufferSizeAliveSupervision = 0, - uint16_t bufferSizeDeadlineSupervision = 0, - uint16_t bufferSizeLogicalSupervision = 0, uint16_t bufferSizeLocalSupervision = 0, uint16_t bufferSizeGlobalSupervision = 0) { HmConfigBuilder builder_(_fbb); builder_.add_periodicity(periodicity); builder_.add_bufferSizeGlobalSupervision(bufferSizeGlobalSupervision); builder_.add_bufferSizeLocalSupervision(bufferSizeLocalSupervision); - builder_.add_bufferSizeLogicalSupervision(bufferSizeLogicalSupervision); - builder_.add_bufferSizeDeadlineSupervision(bufferSizeDeadlineSupervision); builder_.add_bufferSizeAliveSupervision(bufferSizeAliveSupervision); builder_.add_bufferSizeMonitor(bufferSizeMonitor); - builder_.add_hasValueEnableTerminationRequest(hasValueEnableTerminationRequest); - builder_.add_enableTerminationRequest(enableTerminationRequest); return builder_.Finish(); } diff --git a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/daemon/PhmDaemon.cpp b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/daemon/PhmDaemon.cpp index b74650eb..782ddaea 100644 --- a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/daemon/PhmDaemon.cpp +++ b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/daemon/PhmDaemon.cpp @@ -16,10 +16,8 @@ #include "score/lcm/saf/factory/FlatCfgFactory.hpp" #include "score/lcm/saf/ifappl/MonitorIfDaemon.hpp" #include "score/lcm/saf/supervision/Alive.hpp" -#include "score/lcm/saf/supervision/Deadline.hpp" #include "score/lcm/saf/supervision/Global.hpp" #include "score/lcm/saf/supervision/Local.hpp" -#include "score/lcm/saf/supervision/Logical.hpp" #include "score/lcm/saf/timers/Timers_OsClock.hpp" namespace score diff --git a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/daemon/SwClusterHandler.cpp b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/daemon/SwClusterHandler.cpp index b9a30506..8ed7de8e 100644 --- a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/daemon/SwClusterHandler.cpp +++ b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/daemon/SwClusterHandler.cpp @@ -17,10 +17,8 @@ #include "score/lcm/saf/ifappl/Checkpoint.hpp" #include "score/lcm/saf/ifappl/MonitorIfDaemon.hpp" #include "score/lcm/saf/supervision/Alive.hpp" -#include "score/lcm/saf/supervision/Deadline.hpp" #include "score/lcm/saf/supervision/Global.hpp" #include "score/lcm/saf/supervision/Local.hpp" -#include "score/lcm/saf/supervision/Logical.hpp" namespace score { @@ -39,8 +37,6 @@ SwClusterHandler::SwClusterHandler(const std::string& f_swClusterName_r) : monitorInterfaces{}, checkpoints{}, aliveSupervisions{}, - deadlineSupervisions{}, - logicalSupervisions{}, localSupervisions{}, globalSupervisions{}, recoveryNotifications{} @@ -87,16 +83,7 @@ bool SwClusterHandler::constructWorkers(std::shared_ptr aliveSupervisions; - /// Vector of Deadline Supervisions - std::vector deadlineSupervisions; - - /// Vector of Logical Supervisions - std::vector logicalSupervisions; - /// Vector of Local Supervisions std::vector localSupervisions; diff --git a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/factory/FlatCfgFactory.cpp b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/factory/FlatCfgFactory.cpp index ea8cbf3c..c43054ef 100644 --- a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/factory/FlatCfgFactory.cpp +++ b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/factory/FlatCfgFactory.cpp @@ -26,10 +26,8 @@ #include "score/lcm/saf/logging/PhmLogger.hpp" #include "score/lcm/saf/recovery/Notification.hpp" #include "score/lcm/saf/supervision/Alive.hpp" -#include "score/lcm/saf/supervision/Deadline.hpp" #include "score/lcm/saf/supervision/Global.hpp" #include "score/lcm/saf/supervision/Local.hpp" -#include "score/lcm/saf/supervision/Logical.hpp" #include "score/lcm/saf/supervision/SupervisionCfg.hpp" #include "score/lcm/saf/timers/TimeConversion.hpp" #include "score/lcm/saf/timers/Timers_OsClock.hpp" @@ -497,261 +495,10 @@ bool FlatCfgFactory::createAliveSupervisions(std::vector& f_ return isSuccess; } -bool FlatCfgFactory::createLogicalSupervisions(std::vector& f_logical_r, - std::vector& f_checkpoints_r, - std::vector& f_processStates_r) -{ - bool isSuccess{true}; - - // If PhmLogicalSupervision is not configured in configuration files, nullptr is returned by - // PhmLogicalSupervision(). It is valid to have empty (zero) PhmLogicalSupervision in the configuration. - if (flatBuffer_p->hmLogicalSupervision() != nullptr) - { - try - { - f_logical_r.reserve(static_cast(flatBuffer_p->hmLogicalSupervision()->size())); - for (auto* supervision_p : *flatBuffer_p->hmLogicalSupervision()) - { - // Collect referenced ProcessGroupStates - - std::vector states{}; - - // coverity[cert_exp34_c_violation] PHM.ecucfgdsl PhmLogicalSupervision.refProcessGroupStates MANDATORY - // coverity[dereference] PHM.ecucfgdsl PhmLogicalSupervision.refProcessGroupStates MANDATORY - states.reserve(static_cast(supervision_p->refProcessGroupStates()->size())); - for (auto* state_p : *supervision_p->refProcessGroupStates()) - { - // coverity[cert_exp34_c_violation] PHM.ecucfgdsl PhmRefProcessGroupStates.identifier MANDATORY - // coverity[dereference] PHM.ecucfgdsl PhmRefProcessGroupStates.identifier MANDATORY - states.emplace_back(state_p->identifier()->c_str()); - } - - const auto result{getProcessGroupStateIds(states)}; - std::vector stateIds{std::move(*result)}; - - // Collect referenced Processes - - std::vector refProcesses{}; - - // coverity[cert_exp34_c_violation] PHM.ecucfgdsl PhmLogicalSupervision.refProcessIndices MANDATORY - // coverity[dereference] PHM.ecucfgdsl PhmLogicalSupervision.refProcessIndices MANDATORY - refProcesses.reserve(static_cast(supervision_p->refProcessIndices()->size())); - for (const auto refProcessIdx : *supervision_p->refProcessIndices()) - { - refProcesses.push_back(&f_processStates_r.at(static_cast(refProcessIdx))); - } - - supervision::LogicalSupervisionCfg cfg{stateIds, refProcesses}; - // NOTE: Tooling ensures that supervision_p->ruleContextKey() return a valid pointer -> no check - // necessary! - cfg.cfgName_p = supervision_p->ruleContextKey()->c_str(); - cfg.checkpointBufferSize = bufferConfig_r.bufferSizeLogicalSupervision; - // Construct Logical Supervision - f_logical_r.emplace_back(cfg); - - // NOTE: As elements of "graphEntries" are pointing to elements of - // "graph", "graph" elements shall not be moved once they are created! - std::vector graph{}; - std::vector graphEntries{}; - - // Create the nodes of the graph - - // coverity[cert_exp34_c_violation] PHM.ecucfgdsl PhmLogicalSupervision.checkpoints MANDATORY - // coverity[dereference] PHM.ecucfgdsl PhmLogicalSupervision.checkpoints MANDATORY - graph.reserve(static_cast(supervision_p->checkpoints()->size())); - for (auto* checkpoint_p : *supervision_p->checkpoints()) - { - graph.emplace_back(f_checkpoints_r.at(static_cast(checkpoint_p->refCheckPointIndex())), - checkpoint_p->isFinal()); - if (checkpoint_p->isInitial()) - { - graphEntries.emplace_back(&(graph.back())); - } - } - - // Create the graph edges between the nodes - - // NOTE: Tooling ensures that supervision_p->transitions() return a valid pointer -> no check - // necessary! - for (auto* transition_p : *supervision_p->transitions()) - { - graph[static_cast(transition_p->checkpointSourceIdx())].addValidNextGraphElement( - graph[static_cast(transition_p->checkpointTargetIdx())]); - } - - // Add graph data to the created Logical Supervision - f_logical_r.back().addGraph(graphEntries, graph); - - // Subscribe created Logical Supervision to ProcessState classes - - // NOTE: Tooling ensures that supervision_p->refProcessIndices() return a valid pointer -> no check - // necessary! - for (const auto refProcessIdx : *supervision_p->refProcessIndices()) - { - f_processStates_r.at(static_cast(refProcessIdx)).attachObserver(f_logical_r.back()); - } - - logger_r.LogDebug() << kLogPrefix << "Successfully created logical supervision worker object:" - << f_logical_r.back().getConfigName(); - } - } - catch (const std::exception& f_exception_r) - { - isSuccess = false; - logger_r.LogError() << kLogPrefix - << "Could not create all necessary logical supervision " - "worker objects, due to exception:" - << f_exception_r.what(); - } - } - - if (isSuccess) - { - logger_r.LogDebug() << kLogPrefix << "Number of constructed logical supervisions:" - << static_cast(f_logical_r.size()); - } - else - { - f_logical_r.clear(); - logger_r.LogError() << kLogPrefix << "Could not create all necessary logical supervision worker objects"; - } - - return isSuccess; -} - -bool FlatCfgFactory::createDeadlineSupervisions(std::vector& f_deadline_r, - std::vector& f_checkpoints_r, - std::vector& f_processStates_r) -{ - bool isDeadlineSupCfgSuccess{true}; - - // If PhmDeadlineSupervision is not configured in configuration files, nullptr is returned by - // PhmDeadlineSupervision(). It is valid to have empty (zero) PhmDeadlineSupervision in the configuration. - if (flatBuffer_p->hmDeadlineSupervision() != nullptr) - { - auto numberOfDeadlineSup{flatBuffer_p->hmDeadlineSupervision()->size()}; - try - { - f_deadline_r.reserve(static_cast(numberOfDeadlineSup)); - - for (auto hmDeadlineSupervision_p : *flatBuffer_p->hmDeadlineSupervision()) - { - // Collect Deadline Supervision configuration - const char* nameCfgDeadline_p{hmDeadlineSupervision_p->ruleContextKey()->c_str()}; - score::lcm::saf::timers::NanoSecondType minDeadlineTemp{0U}; - score::lcm::saf::timers::NanoSecondType maxDeadlineTemp{0U}; - bool flagMinCheckDisabled{false}; - bool flagMaxCheckDisabled{false}; - - minDeadlineTemp = - timers::TimeConversion::convertMilliSecToNanoSec(hmDeadlineSupervision_p->minDeadline()); - if (minDeadlineTemp == 0U) - { - flagMinCheckDisabled = true; - } - - if (std::isfinite(hmDeadlineSupervision_p->maxDeadline())) - { - maxDeadlineTemp = - timers::TimeConversion::convertMilliSecToNanoSec(hmDeadlineSupervision_p->maxDeadline()); - } - else - { - maxDeadlineTemp = UINT64_MAX; - flagMaxCheckDisabled = true; - } - - // Collect referenced ProcessGroupStates for Deadline Supervision - std::vector refProcessGroupStates{}; - - // coverity[cert_exp34_c_violation] PHM.ecucfgdsl PhmDeadlineSupervision.refProcessGroupStates - // coverity[dereference] PHM.ecucfgdsl PhmDeadlineSupervision.refProcessGroupStates MANDATORY - refProcessGroupStates.reserve( - static_cast(hmDeadlineSupervision_p->refProcessGroupStates()->size())); - - for (auto refProcessGroupState_p : *hmDeadlineSupervision_p->refProcessGroupStates()) - { - // coverity[cert_exp34_c_violation] PHM.ecucfgdsl PhmRefProcessGroupStates.identifier MANDATORY - // coverity[dereference] PHM.ecucfgdsl PhmRefProcessGroupStates.identifier MANDATORY - refProcessGroupStates.push_back(refProcessGroupState_p->identifier()->c_str()); - } - - const auto result{getProcessGroupStateIds(refProcessGroupStates)}; - std::vector refProcessGroupStateIds{std::move(*result)}; - - // Collect referenced Processes for Deadline Supervision - std::vector refProcesses{}; - - // coverity[cert_exp34_c_violation] PHM.ecucfgdsl PhmDeadlineSupervision.refProcesses MANDATORY - // coverity[dereference] PHM.ecucfgdsl PhmDeadlineSupervision.refProcesses MANDATORY - refProcesses.reserve(static_cast(hmDeadlineSupervision_p->refProcessIndices()->size())); - - for (auto refProcessIdx : *hmDeadlineSupervision_p->refProcessIndices()) - { - refProcesses.push_back(&f_processStates_r.at(static_cast(refProcessIdx))); - } - - // Construct Deadline Supervision - // coverity[cert_exp34_c_violation] PHM.ecucfgdsl PhmCheckpointTransition.refSourceCPIndex MANDATORY - // coverity[dereference] PHM.ecucfgdsl PhmCheckpointTransition.refSourceCPIndex MANDATORY - uint32_t f_indexSourceCP_r{hmDeadlineSupervision_p->checkpointTransition()->refSourceCPIndex()}; - // coverity[cert_exp34_c_violation] PHM.ecucfgdsl PhmCheckpointTransition.refTargetCPIndex MANDATORY - // coverity[dereference] PHM.ecucfgdsl PhmCheckpointTransition.refTargetCPIndex MANDATORY - uint32_t f_indexTargetCP_r{hmDeadlineSupervision_p->checkpointTransition()->refTargetCPIndex()}; - - supervision::DeadlineSupervisionCfg deadlineSupCfg{ - f_checkpoints_r.at(static_cast(f_indexSourceCP_r)), - f_checkpoints_r.at(static_cast(f_indexTargetCP_r)), refProcessGroupStateIds, refProcesses}; - deadlineSupCfg.cfgName_p = nameCfgDeadline_p; - deadlineSupCfg.minDeadline = minDeadlineTemp; - deadlineSupCfg.maxDeadline = maxDeadlineTemp; - deadlineSupCfg.isMinCheckDisabled = flagMinCheckDisabled; - deadlineSupCfg.isMaxCheckDisabled = flagMaxCheckDisabled; - deadlineSupCfg.checkpointBufferSize = bufferConfig_r.bufferSizeDeadlineSupervision; - - f_deadline_r.emplace_back(deadlineSupCfg); - - // Subscribe created Deadline Supervision to ProcessState classes - for (auto refProcessIdx : *hmDeadlineSupervision_p->refProcessIndices()) - { - f_processStates_r.at(static_cast(refProcessIdx)) - .attachObserver(f_deadline_r.back()); - } - - logger_r.LogDebug() << kLogPrefix << "Successfully created deadline supervision worker object:" - << f_deadline_r.back().getConfigName(); - } - } - catch (const std::exception& f_exception_r) - { - isDeadlineSupCfgSuccess = false; - logger_r.LogError() << kLogPrefix - << "Could not create all necessary deadline supervision " - "worker objects, due to exception:" - << f_exception_r.what(); - } - } - - if (isDeadlineSupCfgSuccess) - { - logger_r.LogDebug() << kLogPrefix << "Number of constructed deadline supervisions:" - << static_cast(f_deadline_r.size()); - } - else - { - f_deadline_r.clear(); - logger_r.LogError() << kLogPrefix << "Could not create all necessary deadline supervision worker objects"; - } - - return isDeadlineSupCfgSuccess; -} - /* RULECHECKER_comment(0, 5, check_max_parameters, "The 4 parameters is better handled individually instead of further\ combining under a data structure", true_no_defect) */ bool FlatCfgFactory::createLocalSupervisions(std::vector& f_local_r, - std::vector& f_alive_r, - std::vector& f_deadline_r, - std::vector& f_logical_r) + std::vector& f_alive_r) { bool isSuccess{true}; @@ -786,28 +533,6 @@ bool FlatCfgFactory::createLocalSupervisions(std::vector& f_ f_local_r.back().registerCheckpointSupervision(alive_r); } } - // Subscribe created Local Supervision to Deadline Supervisions - if (hmLocalSupervision_p->hmRefDeadlineSupervision() != nullptr) - { - for (auto* phmRefDeadline_p : *hmLocalSupervision_p->hmRefDeadlineSupervision()) - { - uint32_t refDeadlineIndex{phmRefDeadline_p->refDeadlineSupervisionIdx()}; - supervision::Deadline& deadline_r{f_deadline_r.at(static_cast(refDeadlineIndex))}; - deadline_r.attachObserver(f_local_r.back()); - f_local_r.back().registerCheckpointSupervision(deadline_r); - } - } - // Subscribe created Local Supervision to Logical Supervisions - if (hmLocalSupervision_p->hmRefLogicalSupervision() != nullptr) - { - for (auto* phmRefLogical_p : *hmLocalSupervision_p->hmRefLogicalSupervision()) - { - uint32_t refLogicalIndex{phmRefLogical_p->refLogicalSupervisionIdx()}; - supervision::Logical& logical_r{f_logical_r.at(static_cast(refLogicalIndex))}; - logical_r.attachObserver(f_local_r.back()); - f_local_r.back().registerCheckpointSupervision(logical_r); - } - } logger_r.LogDebug() << kLogPrefix << "Successfully created local supervision:" << f_local_r.back().getConfigName(); } diff --git a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/factory/FlatCfgFactory.hpp b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/factory/FlatCfgFactory.hpp index e2f75b34..b6302b7f 100644 --- a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/factory/FlatCfgFactory.hpp +++ b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/factory/FlatCfgFactory.hpp @@ -100,21 +100,9 @@ class FlatCfgFactory : public IPhmFactory std::vector& f_checkpoints_r, std::vector& f_processStates_r) override; - /// Refer to the description of the base class (IPhmFactory) - bool createDeadlineSupervisions(std::vector& f_deadline_r, - std::vector& f_checkpoints_r, - std::vector& f_processStates_r) override; - - /// Refer to the description of the base class (IPhmFactory) - bool createLogicalSupervisions(std::vector& f_logical_r, - std::vector& f_checkpoints_r, - std::vector& f_processStates_r) override; - /// Refer to the description of the base class (IPhmFactory) bool createLocalSupervisions(std::vector& f_local_r, - std::vector& f_alive_r, - std::vector& f_deadline_r, - std::vector& f_logical_r) override; + std::vector& f_alive_r) override; /// Refer to the description of the base class (IPhmFactory) bool createGlobalSupervisions(std::vector& f_global_r, diff --git a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/factory/IPhmFactory.hpp b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/factory/IPhmFactory.hpp index 7f5a1cb6..c49596cc 100644 --- a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/factory/IPhmFactory.hpp +++ b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/factory/IPhmFactory.hpp @@ -47,8 +47,6 @@ class Checkpoint; namespace supervision { class Alive; -class Deadline; -class Logical; class Local; class Global; } // namespace supervision @@ -123,25 +121,6 @@ class IPhmFactory std::vector& f_checkpoints_r, std::vector& f_processStates_r) = 0; - /// @brief Create deadline supervision worker objects - /// @details Create all required deadline supervision worker objects - /// @param [out] f_deadline_r Vector of created deadline supervision worker - /// @param [in,out] f_checkpoints_r Vector of Supervision Checkpoints - /// @param [in,out] f_processStates_r Vector of Process States - /// @return Object creation successful (true), otherwise failed (false) - virtual bool createDeadlineSupervisions(std::vector& f_deadline_r, - std::vector& f_checkpoints_r, - std::vector& f_processStates_r) = 0; - - /// @brief Create logical supervision worker objects - /// @param [out] f_logical_r Vector of created logical supervision worker - /// @param [in,out] f_checkpoints_r Vector of Supervision Checkpoints - /// @param [in,out] f_processStates_r Vector of Process States - /// @return Object creation successful (true), otherwise failed (false) - virtual bool createLogicalSupervisions(std::vector& f_logical_r, - std::vector& f_checkpoints_r, - std::vector& f_processStates_r) = 0; - /// @brief Create local supervision worker objects /// @details Create all required local supervision worker objects from configuration /// @param [out] f_local_r Vector of created local supervision worker @@ -150,9 +129,7 @@ class IPhmFactory /// @param [in,out] f_logical_r Vector of logical supervision worker /// @return Object creation successful (true), otherwise failed (false) virtual bool createLocalSupervisions(std::vector& f_local_r, - std::vector& f_alive_r, - std::vector& f_deadline_r, - std::vector& f_logical_r) = 0; + std::vector& f_alive_r) = 0; /// @brief Create global supervision worker objects /// @details Create all required global supervision worker objects from configuration diff --git a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/factory/MachineConfigFactory.cpp b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/factory/MachineConfigFactory.cpp index a20c14b3..1b95c22e 100644 --- a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/factory/MachineConfigFactory.cpp +++ b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/factory/MachineConfigFactory.cpp @@ -141,8 +141,6 @@ void MachineConfigFactory::loadHmSettings(const HMCOREFlatBuffer::HMCOREEcuCfg& { const auto* config{configContainer->Get(0U)}; updateNonDefaultValue(supBufferCfg.bufferSizeAliveSupervision, config->bufferSizeAliveSupervision()); - updateNonDefaultValue(supBufferCfg.bufferSizeDeadlineSupervision, config->bufferSizeDeadlineSupervision()); - updateNonDefaultValue(supBufferCfg.bufferSizeLogicalSupervision, config->bufferSizeLogicalSupervision()); updateNonDefaultValue(supBufferCfg.bufferSizeLocalSupervision, config->bufferSizeLocalSupervision()); updateNonDefaultValue(supBufferCfg.bufferSizeGlobalSupervision, config->bufferSizeGlobalSupervision()); updateNonDefaultValue(supBufferCfg.bufferSizeMonitor, config->bufferSizeMonitor()); @@ -185,10 +183,6 @@ void MachineConfigFactory::logConfiguration() noexcept(true) { /* RULECHECKER_comment(0, 18, check_conditional_as_sub_expression, "Ternary operation is very simple", true_no_defect) */ logger_r.LogDebug() << kLogPrefix << "Alive Supervision buffer size:" << supBufferCfg.bufferSizeAliveSupervision; - logger_r.LogDebug() << kLogPrefix - << "Deadline Supervision buffer size:" << supBufferCfg.bufferSizeDeadlineSupervision; - logger_r.LogDebug() << kLogPrefix - << "Logical Supervision buffer size:" << supBufferCfg.bufferSizeLogicalSupervision; logger_r.LogDebug() << kLogPrefix << "Local Supervision buffer size:" << supBufferCfg.bufferSizeLocalSupervision; logger_r.LogDebug() << kLogPrefix << "Global Supervision buffer size:" << supBufferCfg.bufferSizeGlobalSupervision; logger_r.LogDebug() << kLogPrefix << "Monitor buffer size:" << supBufferCfg.bufferSizeMonitor; diff --git a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/factory/MachineConfigFactory.hpp b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/factory/MachineConfigFactory.hpp index be905f7b..a7a37c32 100644 --- a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/factory/MachineConfigFactory.hpp +++ b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/factory/MachineConfigFactory.hpp @@ -54,10 +54,6 @@ class MachineConfigFactory : public watchdog::IDeviceConfigFactory { /// @brief Configured buffer size for alive supervisions std::uint16_t bufferSizeAliveSupervision{StaticConfig::k_DefaultAliveSupCheckpointBufferElements}; - /// @brief Configured buffer size for deadline supervisions - std::uint16_t bufferSizeDeadlineSupervision{StaticConfig::k_DefaultDeadlineSupCheckpointBufferElements}; - /// @brief Configured buffer size for logical supervisions - std::uint16_t bufferSizeLogicalSupervision{StaticConfig::k_DefaultLogicalSupCheckpointBufferElements}; /// @brief Configured buffer size for local supervisions std::uint16_t bufferSizeLocalSupervision{StaticConfig::k_DefaultLocalSupStatusUpdateBufferElements}; /// @brief Configured buffer size for global supervisions diff --git a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/factory/StaticConfig.hpp b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/factory/StaticConfig.hpp index 6f930b7d..1f19bf14 100644 --- a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/factory/StaticConfig.hpp +++ b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/factory/StaticConfig.hpp @@ -37,10 +37,6 @@ class StaticConfig public: /// Default buffer size of Alive Supervision checkpoint buffer static constexpr uint16_t k_DefaultAliveSupCheckpointBufferElements{100U}; - /// Default buffer size of Deadline Supervision checkpoint buffer - static constexpr uint16_t k_DefaultDeadlineSupCheckpointBufferElements{100U}; - /// Default buffer size of Logical Supervision checkpoint buffer - static constexpr uint16_t k_DefaultLogicalSupCheckpointBufferElements{100U}; /// Default buffer size of Local Supervision buffer static constexpr uint16_t k_DefaultLocalSupStatusUpdateBufferElements{100U}; /// Default buffer size of Global Supervision buffer diff --git a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/supervision/Deadline.cpp b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/supervision/Deadline.cpp deleted file mode 100644 index af590743..00000000 --- a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/supervision/Deadline.cpp +++ /dev/null @@ -1,465 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -#include "score/lcm/saf/supervision/Deadline.hpp" - -#include -#include - -#include "score/lcm/saf/common/Types.hpp" -#include "score/lcm/saf/ifexm/ProcessState.hpp" -#include "score/lcm/saf/timers/TimeConversion.hpp" - -namespace score -{ -namespace lcm -{ -namespace saf -{ -namespace supervision -{ - -Deadline::Deadline(const DeadlineSupervisionCfg& f_deadlineCfg_r) : - ICheckpointSupervision(f_deadlineCfg_r), - Observable(), - k_minDeadline(f_deadlineCfg_r.minDeadline), - k_maxDeadline(f_deadlineCfg_r.maxDeadline), - k_isMinCheckDisabled(f_deadlineCfg_r.isMinCheckDisabled), - k_isMaxCheckDisabled(f_deadlineCfg_r.isMaxCheckDisabled), - failureInfo(), - source_r(f_deadlineCfg_r.source_r), - target_r(f_deadlineCfg_r.target_r), - logger_r(logging::PhmLogger::getLogger(logging::PhmLogger::EContext::supervision)), - timeSortingUpdateEventBuffer( - common::TimeSortingBuffer(f_deadlineCfg_r.checkpointBufferSize)), - processTracker(f_deadlineCfg_r.refFuntionGroupStates_r, f_deadlineCfg_r.refProcesses_r) -{ - source_r.attachObserver(*this); - target_r.attachObserver(*this); - - assert((deadlineStatus == EStatus::deactivated) && - ("Deadline Supervision must start in deactivated state, see SWS_PHM_00204")); -} - -Deadline::~Deadline() -{ - source_r.detachObserver(*this); - target_r.detachObserver(*this); -} - -// coverity[exn_spec_violation:FALSE] std::length_error is not thrown from push() which uses fixed-size-vector -void Deadline::updateData(const ifappl::Checkpoint& f_observable_r) noexcept(true) -{ - timers::NanoSecondType timestamp{f_observable_r.getTimestamp()}; - if (f_observable_r.getDataLossEvent()) - { - isDataLossEvent = true; - deadlineAdvState = EDeadlineAdvState::ring_buffer_overflow; - eventTimestamp = lastSyncTimestamp; - } - else - { - CheckpointSnapshot checkpointSnapshot{&f_observable_r, timestamp}; - if (!timeSortingUpdateEventBuffer.push(checkpointSnapshot, timestamp)) - { - isDataLossEvent = true; - deadlineAdvState = EDeadlineAdvState::history_buffer_overflow; - eventTimestamp = lastSyncTimestamp; - } - } -} - -// coverity[exn_spec_violation:FALSE] std::length_error is not thrown from push() which uses fixed-size-vector -void Deadline::updateData(const ifexm::ProcessState& f_observable_r) noexcept(true) -{ - const ifexm::ProcessState::EProcState state{f_observable_r.getState()}; - - if (processTracker.isProcessStateRelevant(state)) - { - const common::ProcessGroupId pgStateId{f_observable_r.getProcessGroupState()}; - const timers::NanoSecondType timestamp{f_observable_r.getTimestamp()}; - const ifexm::ProcessCfg::ProcessExecutionError executionError{f_observable_r.getProcessExecutionError()}; - - ProcessStateTracker::ProcessStateSnapshot processSnapshot{&f_observable_r, state, pgStateId, timestamp, - executionError}; - if (!(timeSortingUpdateEventBuffer.push(processSnapshot, timestamp))) - { - isDataLossEvent = true; - deadlineAdvState = EDeadlineAdvState::history_buffer_overflow; - eventTimestamp = lastSyncTimestamp; - } - } -} - -Deadline::EStatus Deadline::getStatus(void) const noexcept(true) -{ - return deadlineStatus; -} - -timers::NanoSecondType Deadline::getTimestamp(void) const noexcept(true) -{ - return eventTimestamp; -} - -void Deadline::evaluate(const timers::NanoSecondType f_syncTimestamp) -{ - if (isDataLossEvent) - { - handleDataLossReaction(); - lastSyncTimestamp = f_syncTimestamp; - return; - } - - // Scan individual checkpoint/event from history buffer and update deadline status - TimeSortedUpdateEvent* sortedUpdateEvent_p{timeSortingUpdateEventBuffer.getNextElement()}; - - while (sortedUpdateEvent_p != nullptr) - { - checkTransitions(*sortedUpdateEvent_p, f_syncTimestamp); - sortedUpdateEvent_p = timeSortingUpdateEventBuffer.getNextElement(); - } - - // Since supervisions are never updated beyond the syncTimestamp, the SyncEvent - // will always be the last element - no need to sort this into the buffer. - const TimeSortedUpdateEvent syncEvent{SyncSnapshot{f_syncTimestamp}}; - checkTransitions(syncEvent, f_syncTimestamp); - - timeSortingUpdateEventBuffer.clear(); - lastSyncTimestamp = f_syncTimestamp; -} - -void Deadline::checkTransitions(const TimeSortedUpdateEvent& f_sortedUpdateEvent_r, - const timers::NanoSecondType f_syncTimestamp) -{ - timers::NanoSecondType timestampOfUpdateEvent{getTimestampOfUpdateEvent(f_sortedUpdateEvent_r)}; - assert((timestampOfUpdateEvent <= f_syncTimestamp) && - "Deadline supervision: Checkpoint events are reported beyond syncTimestamp."); - (void)f_syncTimestamp; - - ICheckpointSupervision::EUpdateEventType currentUpdateType{getEventType(processTracker, f_sortedUpdateEvent_r)}; - - switch (deadlineStatus) - { - case Deadline::EStatus::deactivated: - { - checkTransitionsOutOfDeactivated(currentUpdateType, timestampOfUpdateEvent); - break; - } - - case Deadline::EStatus::ok: - { - checkTransitionsOutOfOk(currentUpdateType, timestampOfUpdateEvent, f_sortedUpdateEvent_r); - break; - } - - case Deadline::EStatus::expired: - { - // Deadline::EStatus::expired can only be exited with a switch to deactivated. - // A common switch to deactivation is handled in the end, therefore nothing additionally has to be - // done for this state. - break; - } - - default: - { - eventTimestamp = lastSyncTimestamp; - deadlineAdvState = EDeadlineAdvState::data_error; - switchToExpired(); - break; - } - } - - // Check if recovery transition is triggered in this iteration, if not check for deactivation transition. - // Both can not appear in same iteration. - if (!checkForRecoveryTransition(currentUpdateType, timestampOfUpdateEvent)) - { - checkTransitionsToDeactivated(currentUpdateType, timestampOfUpdateEvent); - } -} - -void Deadline::handleDataLossReaction(void) noexcept -{ - // In case of data loss event, state transition from deactivated to expired is accepted. - if (Deadline::EStatus::expired != deadlineStatus) - { - switchToExpired(); - } - timeSortingUpdateEventBuffer.clear(); - processTracker.setAllProcessesActive(); - isDataLossEvent = false; -} - -void Deadline::checkTransitionsOutOfDeactivated(const ICheckpointSupervision::EUpdateEventType f_updateEventType, - const timers::NanoSecondType f_updateEventTimestamp) noexcept -{ - if (f_updateEventType == ICheckpointSupervision::EUpdateEventType::kActivation) - { - eventTimestamp = f_updateEventTimestamp; - switchToOk(); - } -} - -void Deadline::checkTransitionsToDeactivated(const ICheckpointSupervision::EUpdateEventType f_updateEventType, - const timers::NanoSecondType f_updateEventTimestamp) noexcept -{ - if ((f_updateEventType == ICheckpointSupervision::EUpdateEventType::kDeactivation) && - (deadlineStatus != Deadline::EStatus::deactivated)) - { - eventTimestamp = f_updateEventTimestamp; - switchToDeactivated(); - } -} - -bool Deadline::checkForRecoveryTransition(const ICheckpointSupervision::EUpdateEventType f_updateEventType, - const timers::NanoSecondType f_updateEventTimestamp) noexcept(true) -{ - if (f_updateEventType == ICheckpointSupervision::EUpdateEventType::kRecoveredFromCrash) - { - logger_r.LogDebug() << "Deadline Supervision (" << getConfigName() << ") about to recover from crash"; - assert(deadlineStatus != Deadline::EStatus::deactivated); - switchToDeactivated(); - checkTransitionsOutOfDeactivated(ICheckpointSupervision::EUpdateEventType::kActivation, f_updateEventTimestamp); - return true; - } - return false; -} - -void Deadline::checkTransitionsOutOfOk(const ICheckpointSupervision::EUpdateEventType f_updateEventType, - const timers::NanoSecondType f_updateEventTimestamp, - const TimeSortedUpdateEvent f_updateEvent) noexcept -{ - // Accept only deadline source/target checkpoint or sync event. - // Deactivation event is handled at the end of evaluate function. - if (f_updateEventType == ICheckpointSupervision::EUpdateEventType::kCheckpoint) - { - assert(std::holds_alternative(f_updateEvent)); - // coverity[autosar_cpp14_a8_5_2_violation:FALSE] type auto shall not be initialized with {} AUTOSAR.8.5.3A - // coverity[cert_exp34_c_violation] CheckpointSnapshot is stored in case of f_updateEventType==kCheckpoint - // coverity[dereference] CheckpointSnapshot is stored in case of f_updateEventType==kCheckpoint - const auto checkpoint_p = std::get(f_updateEvent).identifier_p; - - if (checkpoint_p == &source_r) - { - evaluateSource(f_updateEventTimestamp); - } - else if (checkpoint_p == &target_r) - { - evaluateTarget(f_updateEventTimestamp); - } - else - { - // ignore - } - } - else - { - evaluateMissingTarget(f_updateEventTimestamp); - } - - if (deadlineAdvState != EDeadlineAdvState::ok) - { - switchToExpired(); - } -} - -void Deadline::evaluateSource(const timers::NanoSecondType f_updateEventTimestamp) noexcept -{ - if (sourceTimestamp != 0U) - { - deadlineAdvState = EDeadlineAdvState::consecutive_source_error; - eventTimestamp = f_updateEventTimestamp; - resetTimestamps(); - } - else - { - sourceTimestamp = f_updateEventTimestamp; - } -} - -void Deadline::evaluateTarget(const timers::NanoSecondType f_updateEventTimestamp) noexcept -{ - timers::NanoSecondType timeDifference{0U}; - - targetTimestamp = f_updateEventTimestamp; - // coverity[autosar_cpp14_a4_7_1_violation] target timestamp is always greater than source timestamp - timeDifference = static_cast(targetTimestamp - sourceTimestamp); - - eventTimestamp = f_updateEventTimestamp; - if (sourceTimestamp == 0U) - { - // Target was reported without source. - // This case shall be ignored. Reset targetTimestamp. - targetTimestamp = 0U; - } - else - { - evaluateDeadline(timeDifference); - } -} - -void Deadline::evaluateMissingTarget(const timers::NanoSecondType f_updateEventTimestamp) noexcept -{ - if (sourceTimestamp != 0U) - { - timers::NanoSecondType timeDifference{ - // coverity[autosar_cpp14_a4_7_1_violation] Events are sorted in rising order, sourceTimestamp is smaller - static_cast(f_updateEventTimestamp - sourceTimestamp)}; - // Check if maxDeadline was exceeded - evaluateDeadline(timeDifference, false /*no target checkpoint received*/); - } -} - -void Deadline::evaluateDeadline(const saf::timers::NanoSecondType f_timeLapsed, - bool f_targetCheckpointReceived) noexcept -{ - if ((k_isMaxCheckDisabled == false) && (f_timeLapsed > k_maxDeadline)) - { - deadlineAdvState = EDeadlineAdvState::max_deadline_error; - eventTimestamp = static_cast(sourceTimestamp + k_maxDeadline + 1U); - resetTimestamps(); - } - // Note: if Target was never reported, minDeadline is not evaluated - else if (f_targetCheckpointReceived) - { - if ((k_isMinCheckDisabled == false) && (f_timeLapsed < k_minDeadline)) - { - deadlineAdvState = EDeadlineAdvState::min_deadline_error; - } - else - { - deadlineAdvState = EDeadlineAdvState::ok; - } - resetTimestamps(); - } - else - { - // Satisfy MISRA (else case for if else() must be present) - // Target not yet reported and MaxDeadline not yet exceeded. - } - - if ((deadlineAdvState == EDeadlineAdvState::min_deadline_error) || - (deadlineAdvState == EDeadlineAdvState::max_deadline_error)) - { - failureInfo = DeadlineFailureInfo(); - failureInfo.sourceTargetDiffTime = f_timeLapsed; - failureInfo.targetCheckpointReceived = f_targetCheckpointReceived; - } -} - -void Deadline::resetTimestamps(void) noexcept -{ - // Reset deadline supervision for next evaluation - sourceTimestamp = 0U; - targetTimestamp = 0U; -} - -void Deadline::switchToDeactivated(void) noexcept -{ - deadlineStatus = Deadline::EStatus::deactivated; - deadlineAdvState = EDeadlineAdvState::deactivated; - - logger_r.LogDebug() << "Deadline Supervision (" << getConfigName() << ") switched to DEACTIVATED."; - - resetTimestamps(); - pushResultToObservers(); -} - -void Deadline::switchToOk(void) noexcept -{ - deadlineStatus = Deadline::EStatus::ok; - deadlineAdvState = EDeadlineAdvState::ok; - - logger_r.LogInfo() << "Deadline Supervision (" << getConfigName() << ") switched to OK."; - - pushResultToObservers(); -} - -void Deadline::switchToExpired() noexcept -{ - lastProcessExecutionError = ifexm::ProcessCfg::kDefaultProcessExecutionError; - - switch (deadlineAdvState) - { - case EDeadlineAdvState::consecutive_source_error: - logger_r.LogWarn() << "Deadline Supervision (" << getConfigName() - << ") switched to EXPIRED, due to two source checkpoints were reported consecutively."; - - lastProcessExecutionError = getProcessExecutionErrorForProcess(source_r.getProcess()); - break; - - case EDeadlineAdvState::max_deadline_error: - { - const uint64_t maxDeadlineInMs{ - static_cast(timers::TimeConversion::convertNanoSecToMilliSec(k_maxDeadline))}; - const uint64_t diffInMs{static_cast(std::ceil(timers::TimeConversion::convertNanoSecToMilliSec( - failureInfo.sourceTargetDiffTime))) - - maxDeadlineInMs}; - if (failureInfo.targetCheckpointReceived) - { - logger_r.LogWarn() << "Deadline Supervision (" << getConfigName() - << ") switched to EXPIRED, due to target checkpoint reported" << diffInMs - << "ms after the maximum deadline"; - } - else - { - logger_r.LogWarn() - << "Deadline Supervision (" << getConfigName() - << ") switched to EXPIRED, due to target checkpoint not reported before the maximum deadline"; - } - - lastProcessExecutionError = getProcessExecutionErrorForProcess(target_r.getProcess()); - break; - } - - case EDeadlineAdvState::min_deadline_error: - { - const uint64_t minDeadlineInMs{ - static_cast(timers::TimeConversion::convertNanoSecToMilliSec(k_minDeadline))}; - const uint64_t diffInMs{minDeadlineInMs - - static_cast(std::floor(timers::TimeConversion::convertNanoSecToMilliSec( - failureInfo.sourceTargetDiffTime)))}; - logger_r.LogWarn() << "Deadline Supervision (" << getConfigName() - << ") switched to EXPIRED, due to target checkpoint reported" << diffInMs - << "ms before the minimum deadline"; - - lastProcessExecutionError = getProcessExecutionErrorForProcess(target_r.getProcess()); - break; - } - - case EDeadlineAdvState::ring_buffer_overflow: - logger_r.LogWarn() << "Deadline Supervision (" << getConfigName() - << ") switched to EXPIRED, due to data loss (Ring Buffer Overflow)."; - break; - - case EDeadlineAdvState::history_buffer_overflow: - logger_r.LogWarn() << "Deadline Supervision (" << getConfigName() - << ") switched to EXPIRED, due to data loss (History Buffer Overflow)."; - break; - - default: - logger_r.LogWarn() << "Deadline Supervision (" << getConfigName() - << ") switched to EXPIRED, due to data corruption."; - break; - } - - deadlineStatus = Deadline::EStatus::expired; - isDataLossEvent = false; - failureInfo = DeadlineFailureInfo(); - resetTimestamps(); - pushResultToObservers(); -} - -} // namespace supervision -} // namespace saf -} // namespace lcm -} // namespace score diff --git a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/supervision/Deadline.hpp b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/supervision/Deadline.hpp deleted file mode 100644 index 31252cf2..00000000 --- a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/supervision/Deadline.hpp +++ /dev/null @@ -1,267 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -#ifndef DEADLINE_HPP_INCLUDED -#define DEADLINE_HPP_INCLUDED - -#ifndef PHM_PRIVATE -# define PHM_PRIVATE private -#endif - -#include - -#include "score/lcm/saf/common/TimeSortingBuffer.hpp" -#include "score/lcm/saf/ifappl/Checkpoint.hpp" -#include "score/lcm/saf/logging/PhmLogger.hpp" -#include "score/lcm/saf/supervision/ICheckpointSupervision.hpp" -#include "score/lcm/saf/supervision/ProcessStateTracker.hpp" -#include "score/lcm/saf/supervision/SupervisionCfg.hpp" -#include "score/lcm/saf/timers/Timers_OsClock.hpp" - -namespace score -{ -namespace lcm -{ -namespace saf -{ -namespace ifexm -{ -class ProcessState; -} -namespace supervision -{ - -/// @brief Deadline Supervision -/// @details Deadline Supervision contains the logic for health monitoring - Deadline supervision -/* RULECHECKER_comment(0, 12, check_source_character_set, "Special character in comment is mandatory\ - due to sphinx-need syntax.", false) */ -/// @verbatim embed:rst:leading-slashes -/// The Deadline Supervision state machine implementation is a combination of Adaptive Autosar -/// Deadline Supervision (correct, incorrect) and Local Supervision requirements (de/activation). -/// The resulting state machine is documented here: -/// -/// - :ref:`Deadline Supervision - State Machine` -/// - :ref:`Deadline timing diagram for running process` -/// - :ref:`Deadline timing diagram for restarted process (error)` -/// - :ref:`Deadline timing diagram for restarted process (ok)` -/// - :ref:`Deadline timing diagram for multiple processes` -/// -/// @endverbatim -/* RULECHECKER_comment(0, 3, check_multiple_non_interface_bases, "Observable and Observer are tolerated\ - exceptions of this rule.", false) */ -class Deadline : public ICheckpointSupervision, public saf::common::Observable -{ -public: - /// @brief No default constructor - Deadline() = delete; - - /// @brief Default Move Constructor - /* RULECHECKER_comment(0, 7, check_min_instructions, "Default constructor is not provided with\ - a function body", true_no_defect) */ - /* RULECHECKER_comment(0, 5, check_incomplete_data_member_construction, "Default constructor is not provided with\ - the member initializer", false) */ - /* RULECHECKER_comment(0, 3, check_copy_in_move_constructor, "Default constructor is not provided with\ - the member initializer", false) */ - Deadline(Deadline&&) = default; - /// @brief No Move Assignment - Deadline& operator=(Deadline&&) = delete; - /// @brief No Copy Constructor - Deadline(const Deadline&) = delete; - /// @brief No Copy Assignment - Deadline& operator=(const Deadline&) = delete; - - /// @brief Constructor - /// @param [in] f_deadlineCfg_r Deadline Supervision configuration structure - /// @warning Constructor may throw std::exceptions - explicit Deadline(const DeadlineSupervisionCfg& f_deadlineCfg_r) noexcept(false); - - /// @brief Destructor - /// @details Unregisters observer of source/target checkpoint - ~Deadline() override; - - /// @copydoc ICheckpointSupervision::updateData(const ifappl::Checkpoint&) - void updateData(const saf::ifappl::Checkpoint& f_observable_r) noexcept(true) override; - - /// @copydoc ICheckpointSupervision::updateData(const ifexm::ProcessState&) - void updateData(const ifexm::ProcessState& f_observable_r) noexcept(true) override; - - /// @copydoc ICheckpointSupervision::getStatus() - EStatus getStatus(void) const noexcept(true) override; - - /// @copydoc ICheckpointSupervision::getTimestamp() - timers::NanoSecondType getTimestamp(void) const noexcept(true) override; - - /// @copydoc ISupervision::evaluate() - void evaluate(const timers::NanoSecondType f_syncTimestamp) override; - -PHM_PRIVATE: - /// @brief Evaluate Source Checkpoint - /// @details Update sourceTimestamp and check if 2 consecutive source checkpoints received - /// @param [in] f_updateEventTimestamp Timestamp of sorted checkpoint from buffer - void - evaluateSource(const timers::NanoSecondType f_updateEventTimestamp) noexcept; - - /// @brief Evaluate Target Checkpoint - /// @details Evaluate if received target is within min/max deadline range - /// @param [in] f_updateEventTimestamp Timestamp of sorted checkpoint from buffer - void evaluateTarget(const timers::NanoSecondType f_updateEventTimestamp) noexcept; - - /// @brief Evaluate for Missing Target Checkpoint - /// @details Evaluate if target is missing - /// @param [in] f_updateEventTimestamp Timestamp of sorted checkpoint from buffer - void evaluateMissingTarget(const timers::NanoSecondType f_updateEventTimestamp) noexcept; - - /// @brief Evaluate deadline supervision using timestamps - /// @details Checks if a given timestamp for deadline is within the min/max range - /// @param [in] f_timeLapsed Time lapsed after source checkpoint - /// @param [in] f_targetCheckpointReceived True if a target checkpoint was received, else false - void evaluateDeadline(const timers::NanoSecondType f_timeLapsed, bool f_targetCheckpointReceived = true) noexcept; - - /// @brief Reset Deadline - /// @details resets the source & target timestamps for the next evaluation cycle - void resetTimestamps(void) noexcept; - - /// @brief Evaluate transisions for given update event - /// @param[in] f_sortedUpdateEvent_r The next update event from the buffer - /// @param[in] f_syncTimestamp The sync timestamp - void checkTransitions(const TimeSortedUpdateEvent& f_sortedUpdateEvent_r, - const timers::NanoSecondType f_syncTimestamp); - - /// @brief Check and trigger transition out of state Deactivated - /// @param [in] f_updateEventType Type of update event (e.g, Activation, Deactivation, Checkpoint, ...) - /// @param [in] f_updateEventTimestamp Timestamp of sorted checkpoint from buffer - void checkTransitionsOutOfDeactivated(const ICheckpointSupervision::EUpdateEventType f_updateEventType, - const timers::NanoSecondType f_updateEventTimestamp) noexcept; - - /// @brief Check and trigger common transitions to state Deactivated - /// @param [in] f_updateEventType Type of update event (e.g, Activation, Deactivation, Checkpoint, ...) - /// @param [in] f_updateEventTimestamp Timestamp of sorted checkpoint from buffer - void checkTransitionsToDeactivated(const ICheckpointSupervision::EUpdateEventType f_updateEventType, - const timers::NanoSecondType f_updateEventTimestamp) noexcept; - - /// @brief Check and trigger recovery transition - /// @details The recovery transition is triggered if a crashed process has been restarted (kRecoveredFromCrash) - /// If the recovery transition is triggered, the supervision is switched to deactivated and afterwards to - /// ok. - /// @param [in] f_updateEventType Type of update event (e.g, Activation, Deactivation, Checkpoint, ...) - /// @param [in] f_updateEventTimestamp Timestamp of update event - /// @return True: if recovery transition was triggered, False: otherwise - bool checkForRecoveryTransition(const ICheckpointSupervision::EUpdateEventType f_updateEventType, - const timers::NanoSecondType f_updateEventTimestamp) noexcept(true); - - /// @brief Check and trigger transition out of state Ok - /// @param [in] f_updateEventType Type of update event (e.g, Activation, Deactivation, Checkpoint, ...) - /// @param [in] f_updateEventTimestamp Timestamp of sorted checkpoint from buffer - /// @param [in] f_updateEvent Update event object (e.g, Activation, Deactivation, Checkpoint, ...) - void checkTransitionsOutOfOk(const ICheckpointSupervision::EUpdateEventType f_updateEventType, - const timers::NanoSecondType f_updateEventTimestamp, - const TimeSortedUpdateEvent f_updateEvent) noexcept; - - /// @brief Handle data loss reaction - void handleDataLossReaction(void) noexcept; - - /// @brief Switch to state Deactivate - void switchToDeactivated(void) noexcept; - - /// @brief Switch to state Ok - void switchToOk(void) noexcept; - - /// @brief Switch to state Expired - void switchToExpired(void) noexcept; - - /// @brief Minimum Deadline in [nano seconds] - const saf::timers::NanoSecondType k_minDeadline; - - /// @brief Maximum Deadline in [nano seconds] - const saf::timers::NanoSecondType k_maxDeadline; - - /// @brief Disabled status for checking minimum deadline - const bool k_isMinCheckDisabled; - - /// @brief Disabled status for checking maximum deadline - const bool k_isMaxCheckDisabled; - - /// @brief Data loss event marker - bool isDataLossEvent{false}; - - /// @brief Status of deadline supervision - EStatus deadlineStatus{EStatus::deactivated}; - - /// @brief Enumeration of advanced deadline states - enum class EDeadlineAdvState : int8_t - { - data_error = -1, - deactivated = 0, - ok = 1, - ring_buffer_overflow = 2, - history_buffer_overflow = 3, - consecutive_source_error = 4, - max_deadline_error = 5, - min_deadline_error = 6 - }; - - /// @brief Advanced status of deadline supervision - EDeadlineAdvState deadlineAdvState{EDeadlineAdvState::deactivated}; - - /// @brief Captures additional failure information - struct DeadlineFailureInfo - { - /// @brief The time difference between the source and target checkpoints timestamps - /// @note This may be left 0, if no target checkpoint was received - score::lcm::saf::timers::NanoSecondType sourceTargetDiffTime{0U}; - /// @brief Flag is true in case target checkpoint was received, else false - // cppcheck-suppress unusedStructMember - bool targetCheckpointReceived{false}; - }; - - /// @brief Additional failure info for logging - DeadlineFailureInfo failureInfo; - - /// @brief Reference to source checkpoint observer object - saf::ifappl::Checkpoint& source_r; - - /// @brief Reference to target checkpoint observer object - saf::ifappl::Checkpoint& target_r; - - /// @brief Timestamp in which source checkpoint was reported in [nano seconds] - saf::timers::NanoSecondType sourceTimestamp{0U}; - - /// @brief Timestamp in which target checkpoint was reported in [nano seconds] - saf::timers::NanoSecondType targetTimestamp{0U}; - - /// @brief Logger - logging::PhmLogger& logger_r; - - /// @brief Timestamp in which state change is detected in [nano seconds] - /// @details This timestamp is updated whenever assessment is done or data loss has occurred. - saf::timers::NanoSecondType eventTimestamp{0U}; - - /// @brief Sync timestamp from current evaluation [nano seconds] - /// @details This is required for eventTimestamp in case of data loss - saf::timers::NanoSecondType lastSyncTimestamp{0U}; - - /// @brief Time sorting checkpoint buffer - /// @details The buffer enables the deadline supervision that multiple source and target checkpoint can be received - /// from different Monitor interfaces in a given time frame e.g. two PHM Daemon cycles - score::lcm::saf::common::TimeSortingBuffer timeSortingUpdateEventBuffer; - - /// @brief Keeps track of all relevant processes - ProcessStateTracker processTracker; -}; - -} // namespace supervision -} // namespace saf -} // namespace lcm -} // namespace score - -#endif diff --git a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/supervision/Local.cpp b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/supervision/Local.cpp index d96456f6..1467ff27 100644 --- a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/supervision/Local.cpp +++ b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/supervision/Local.cpp @@ -30,8 +30,6 @@ namespace supervision Local::Local(const LocalSupervisionCfg f_localCfg) : ISupervision(f_localCfg.cfgName_p), Observer(), - Observer(), - Observer(), Observable(), logger_r(logging::PhmLogger::getLogger(logging::PhmLogger::EContext::supervision)), timeSortingCheckpointSupEvent( @@ -58,16 +56,6 @@ void Local::updateData(const Alive& f_observable_r) noexcept(true) updateDataGeneralized(f_observable_r, ICheckpointSupervision::EType::aliveSupervision); } -void Local::updateData(const Deadline& f_observable_r) noexcept(true) -{ - updateDataGeneralized(f_observable_r, ICheckpointSupervision::EType::deadlineSupervision); -} - -void Local::updateData(const Logical& f_observable_r) noexcept(true) -{ - updateDataGeneralized(f_observable_r, ICheckpointSupervision::EType::logicalSupervision); -} - // coverity[exn_spec_violation:FALSE] std::length_error is not thrown from push() which uses fixed-size-vector void Local::updateDataGeneralized(const ICheckpointSupervision& f_observable_r, const ICheckpointSupervision::EType f_type) noexcept(true) diff --git a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/supervision/Local.hpp b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/supervision/Local.hpp index 7ccbcdcd..dde175ec 100644 --- a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/supervision/Local.hpp +++ b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/supervision/Local.hpp @@ -28,10 +28,8 @@ #include "score/lcm/saf/common/TimeSortingBuffer.hpp" #include "score/lcm/saf/logging/PhmLogger.hpp" #include "score/lcm/saf/supervision/Alive.hpp" -#include "score/lcm/saf/supervision/Deadline.hpp" #include "score/lcm/saf/supervision/ICheckpointSupervision.hpp" #include "score/lcm/saf/supervision/ISupervision.hpp" -#include "score/lcm/saf/supervision/Logical.hpp" #include "score/lcm/saf/supervision/SupervisionCfg.hpp" namespace score @@ -75,8 +73,6 @@ struct CheckpointSupervisionEvent final with a pure virtual function, hence the rule is followed.", false) */ class Local : public ISupervision, public common::Observer, - public common::Observer, - public common::Observer, public common::Observable { public: @@ -117,14 +113,6 @@ class Local : public ISupervision, /// @param [in] f_observable_r Checkpoint Supervision object which has sent the update void updateData(const Alive& f_observable_r) noexcept(true) override; - /// @brief Update data received from Deadline supervisions - /// @param [in] f_observable_r Checkpoint Supervision object which has sent the update - void updateData(const Deadline& f_observable_r) noexcept(true) override; - - /// @brief Update data received from Logical supervisions - /// @param [in] f_observable_r Checkpoint Supervision object which has sent the update - void updateData(const Logical& f_observable_r) noexcept(true) override; - /// @copydoc ISupervision::evaluate() void evaluate(const timers::NanoSecondType f_syncTimestamp) override; diff --git a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/supervision/Logical.cpp b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/supervision/Logical.cpp deleted file mode 100644 index 79760eee..00000000 --- a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/supervision/Logical.cpp +++ /dev/null @@ -1,433 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -#include "score/lcm/saf/supervision/Logical.hpp" - -#include - -#include "score/lcm/saf/common/Types.hpp" -#include "score/lcm/saf/ifappl/Checkpoint.hpp" -#include "score/lcm/saf/ifexm/ProcessState.hpp" -#include "score/lcm/saf/timers/Timers_OsClock.hpp" - -namespace score -{ -namespace lcm -{ -namespace saf -{ -namespace supervision -{ - -Logical::GraphElement::GraphElement(ifappl::Checkpoint& f_checkpoint_r, const bool f_isFinal) noexcept : - k_isFinalCheckpoint(f_isFinal), trackedCheckpoint_r(f_checkpoint_r) -{ - // Satisfy Misra for minimum number of instructions - static_cast(0); -} - -void Logical::GraphElement::GraphElement::addValidNextGraphElement(GraphElement& f_element_r) noexcept(false) -{ - validNextElements.push_back(&f_element_r); -} - -ifappl::Checkpoint* Logical::GraphElement::getTrackedCheckpoint(void) const noexcept -{ - return &trackedCheckpoint_r; -} - -bool Logical::GraphElement::isFinal(void) const noexcept -{ - return k_isFinalCheckpoint; -} - -Logical::GraphElement::EResult Logical::GraphElement::getNextElement( - GraphElement*& f_returnElement_pr, const ifappl::Checkpoint& f_checkpoint_r) const noexcept -{ - EResult result{Logical::GraphElement::EResult::error}; - - for (auto& validNextGraphElement : validNextElements) - { - if (validNextGraphElement->getTrackedCheckpoint() == &f_checkpoint_r) - { - f_returnElement_pr = validNextGraphElement; - if (f_returnElement_pr->isFinal()) - { - result = Logical::GraphElement::EResult::validFinal; - } - else - { - result = Logical::GraphElement::EResult::valid; - } - } - } - - return result; -} - -Logical::Graph::Graph(std::vector& f_entries_r, - std::vector& f_graphElements_r) noexcept : - elements(std::move(f_graphElements_r)), entries(std::move(f_entries_r)) -{ -} - -bool Logical::Graph::isValidTransition(const ifappl::Checkpoint& f_checkpoint_r) noexcept -{ - bool isValid{true}; - if (!isGraphActive) - { - if (isValidEntry(f_checkpoint_r)) - { - isGraphActive = true; - } - else - { - isValid = false; - } - } - else - { - Logical::GraphElement::EResult result{ - currentGraphPosition_p->getNextElement(currentGraphPosition_p, f_checkpoint_r)}; - if (Logical::GraphElement::EResult::validFinal == result) - { - isGraphActive = false; - } - else if (Logical::GraphElement::EResult::error == result) - { - isValid = false; - } - else - { - // transition was valid - } - } - - return isValid; -} - -void Logical::Graph::resetGraph(void) noexcept -{ - isGraphActive = false; - currentGraphPosition_p = nullptr; -} - -bool Logical::Graph::isActive() const noexcept -{ - return isGraphActive; -} - -const Logical::GraphElement* Logical::Graph::getCurrentGraphPosition() const noexcept -{ - return currentGraphPosition_p; -} - -bool Logical::Graph::isValidEntry(const ifappl::Checkpoint& f_checkpoint_r) noexcept -{ - bool isEntry{false}; - - for (auto& entry : entries) - { - if (entry->getTrackedCheckpoint() == &f_checkpoint_r) - { - isEntry = true; - currentGraphPosition_p = entry; - break; - } - } - return isEntry; -} - -Logical::Logical(const LogicalSupervisionCfg& f_logicalCfg_r) noexcept(false) : - ICheckpointSupervision(f_logicalCfg_r), - Observable(), - failureInfo(), - logger_r(logging::PhmLogger::getLogger(logging::PhmLogger::EContext::supervision)), - timeSortingUpdateEventBuffer(common::TimeSortingBuffer(f_logicalCfg_r.checkpointBufferSize)), - processTracker(f_logicalCfg_r.refFuntionGroupStates_r, f_logicalCfg_r.refProcesses_r) -{ - assert((logicalStatus == EStatus::deactivated) && - ("Logical Supervision must start in deactivated state, see SWS_PHM_00204")); -} - -void Logical::addGraph(std::vector& f_graphEntries_r, - std::vector& f_graphElements_r) noexcept(false) -{ - for (auto& graphElement : f_graphElements_r) - { - graphElement.getTrackedCheckpoint()->attachObserver(*this); - } - graph_p = std::make_unique(f_graphEntries_r, f_graphElements_r); -} - -// coverity[exn_spec_violation:FALSE] std::length_error is not thrown from push() which uses fixed-size-vector -void Logical::updateData(const ifappl::Checkpoint& f_observable_r) noexcept(true) -{ - timers::NanoSecondType timestamp{f_observable_r.getTimestamp()}; - if (f_observable_r.getDataLossEvent()) - { - isDataLossEvent = true; - // If clock error is detected, last syncTimestamp is used as event timestamp. - eventTimestamp = ((timestamp == 0U) ? lastSyncTimestamp : timestamp); - } - else - { - CheckpointSnapshot checkpointSnapshot{&f_observable_r, timestamp}; - if (!timeSortingUpdateEventBuffer.push(checkpointSnapshot, timestamp)) - { - isDataLossEvent = true; - eventTimestamp = lastSyncTimestamp; - } - } -} - -// coverity[exn_spec_violation:FALSE] std::length_error is not thrown from push() which uses fixed-size-vector -void Logical::updateData(const ifexm::ProcessState& f_observable_r) noexcept(true) -{ - const ifexm::ProcessState::EProcState state{f_observable_r.getState()}; - - if (processTracker.isProcessStateRelevant(state)) - { - const common::ProcessGroupId pgStateId{f_observable_r.getProcessGroupState()}; - const timers::NanoSecondType timestamp{f_observable_r.getTimestamp()}; - const ifexm::ProcessCfg::ProcessExecutionError executionError{f_observable_r.getProcessExecutionError()}; - - ProcessStateTracker::ProcessStateSnapshot process{&f_observable_r, state, pgStateId, timestamp, executionError}; - if (!(timeSortingUpdateEventBuffer.push(process, timestamp))) - { - isDataLossEvent = true; - eventTimestamp = lastSyncTimestamp; - } - } -} - -void Logical::evaluate(const timers::NanoSecondType f_syncTimestamp) -{ - if (isDataLossEvent) - { - // In case of data loss event, state transition from deactivated to expired is accepted. - if (Logical::EStatus::expired != logicalStatus) - { - switchToExpired(EReason::kDataLoss); - } - timeSortingUpdateEventBuffer.clear(); - processTracker.setAllProcessesActive(); - isDataLossEvent = false; - lastSyncTimestamp = f_syncTimestamp; - return; - } - - // Scan individual checkpoint/event from history buffer and update logical status - TimeSortedUpdateEvent* sortedUpdateEvent_p{timeSortingUpdateEventBuffer.getNextElement()}; - - while (sortedUpdateEvent_p != nullptr) - { - timers::NanoSecondType timestampOfUpdateEvent{getTimestampOfUpdateEvent(*sortedUpdateEvent_p)}; - assert((timestampOfUpdateEvent <= f_syncTimestamp) && - "Logical supervision: Checkpoint events are reported beyond syncTimestamp."); - - ICheckpointSupervision::EUpdateEventType currentUpdateType{getEventType(processTracker, *sortedUpdateEvent_p)}; - - switch (logicalStatus) - { - case Logical::EStatus::deactivated: - { - checkTransitionsOutOfDeactivated(currentUpdateType, timestampOfUpdateEvent); - break; - } - - case Logical::EStatus::ok: - { - checkTransitionsOutOfOk(currentUpdateType, timestampOfUpdateEvent, *sortedUpdateEvent_p); - break; - } - - case Logical::EStatus::expired: - { - // Logical::EStatus::expired can only be exited with a switch to deactivated. - // A common switch to deactivation is handled in the end, therefore nothing additionally has to be - // done for this state. - break; - } - - default: - { - eventTimestamp = lastSyncTimestamp; - switchToExpired(EReason::kDataCorruption); - break; - } - } - - // Check if recovery transition is triggered in this iteration, if not check for deactivation transition. - // Both can not appear in same iteration. - if (!checkForRecoveryTransition(currentUpdateType, timestampOfUpdateEvent)) - { - checkTransitionsToDeactivated(currentUpdateType, timestampOfUpdateEvent); - } - - sortedUpdateEvent_p = timeSortingUpdateEventBuffer.getNextElement(); - } - - timeSortingUpdateEventBuffer.clear(); - lastSyncTimestamp = f_syncTimestamp; -} - -Logical::EStatus Logical::getStatus(void) const noexcept(true) -{ - return logicalStatus; -} - -timers::NanoSecondType Logical::getTimestamp(void) const noexcept(true) -{ - return eventTimestamp; -} - -void Logical::checkTransitionsOutOfDeactivated(const ICheckpointSupervision::EUpdateEventType f_updateEventType, - const timers::NanoSecondType f_updateEventTimestamp) noexcept -{ - if (f_updateEventType == ICheckpointSupervision::EUpdateEventType::kActivation) - { - eventTimestamp = f_updateEventTimestamp; - switchToOk(); - } -} - -void Logical::checkTransitionsToDeactivated(const ICheckpointSupervision::EUpdateEventType f_updateEventType, - const timers::NanoSecondType f_updateEventTimestamp) noexcept -{ - if ((f_updateEventType == ICheckpointSupervision::EUpdateEventType::kDeactivation) && - (logicalStatus != Logical::EStatus::deactivated)) - { - eventTimestamp = f_updateEventTimestamp; - switchToDeactivated(); - } -} - -bool Logical::checkForRecoveryTransition(const ICheckpointSupervision::EUpdateEventType f_updateEventType, - const timers::NanoSecondType f_updateEventTimestamp) noexcept(true) -{ - if (f_updateEventType == ICheckpointSupervision::EUpdateEventType::kRecoveredFromCrash) - { - logger_r.LogDebug() << "Logical Supervision (" << getConfigName() << ") about to recover from crash"; - assert(logicalStatus != Logical::EStatus::deactivated); - switchToDeactivated(); - checkTransitionsOutOfDeactivated(ICheckpointSupervision::EUpdateEventType::kActivation, f_updateEventTimestamp); - return true; - } - return false; -} - -void Logical::checkTransitionsOutOfOk(const ICheckpointSupervision::EUpdateEventType f_updateEventType, - const timers::NanoSecondType f_updateEventTimestamp, - const TimeSortedUpdateEvent f_updateEvent) noexcept -{ - // Accept only logical checkpoint - // Deactivation event is handled at the end of evaluate function. - if (f_updateEventType == ICheckpointSupervision::EUpdateEventType::kCheckpoint) - { - assert(std::holds_alternative(f_updateEvent)); - // coverity[autosar_cpp14_a8_5_2_violation:FALSE] type auto shall not be initialized with {} AUTOSAR.8.5.3A - // coverity[cert_exp34_c_violation] CheckpointSnapshot is stored in case of f_updateEventType==kCheckpoint - // coverity[dereference] CheckpointSnapshot is stored in case of f_updateEventType==kCheckpoint - const auto checkpoint_p = std::get(f_updateEvent).identifier_p; - eventTimestamp = f_updateEventTimestamp; - - if (!isValidGraphTransition(*checkpoint_p)) - { - failureInfo = ExpiredFailureInfo(); - if (graph_p && graph_p->isActive()) - { - // invalid graph transition received - failureInfo.currentCheckpointId = graph_p->getCurrentGraphPosition()->getTrackedCheckpoint()->getId(); - } - else - { - // inactive and reported checkpoint was no valid entrypoint - // no current graph position exists - } - failureInfo.reportedCheckpointId = checkpoint_p->getId(); - failureInfo.processReportedInvalidCp = checkpoint_p->getProcess(); - switchToExpired(EReason::kInvalidTransition); - } - } -} - -void Logical::switchToDeactivated(void) noexcept -{ - logger_r.LogDebug() << "Logical Supervision (" << getConfigName() << ") switched to DEACTIVATED."; - logicalStatus = Logical::EStatus::deactivated; - if (graph_p) - { - graph_p->resetGraph(); - } - pushResultToObservers(); -} - -void Logical::switchToOk(void) noexcept -{ - logger_r.LogInfo() << "Logical Supervision (" << getConfigName() << ") switched to OK."; - logicalStatus = Logical::EStatus::ok; - pushResultToObservers(); -} - -void Logical::switchToExpired(EReason reason) noexcept -{ - lastProcessExecutionError = ifexm::ProcessCfg::kDefaultProcessExecutionError; - switch (reason) - { - case EReason::kDataLoss: - logger_r.LogWarn() << "Logical Supervision (" << getConfigName() - << ") switched to EXPIRED, due to data loss"; - break; - case EReason::kInvalidTransition: - { - lastProcessExecutionError = getProcessExecutionErrorForProcess(failureInfo.processReportedInvalidCp); - if (graph_p && graph_p->isActive()) - { - logger_r.LogWarn() - << "Logical Supervision (" << getConfigName() - << ") switched to EXPIRED due to invalid graph transition. There is no transition from checkpoint" - << failureInfo.currentCheckpointId << "to" << failureInfo.reportedCheckpointId; - } - else - { - logger_r.LogWarn() << "Logical Supervision (" << getConfigName() - << ") switched to EXPIRED due to invalid graph entry. Reported checkpoint" - << failureInfo.reportedCheckpointId << "is no initial checkpoint"; - } - break; - } - default: - logger_r.LogWarn() << "Logical Supervision (" << getConfigName() - << ") switched to EXPIRED, due to data corruption"; - break; - } - - logicalStatus = Logical::EStatus::expired; - pushResultToObservers(); -} - -bool Logical::isValidGraphTransition(const ifappl::Checkpoint& f_checkpoint_r) const noexcept -{ - bool isValid{false}; - if (graph_p) - { - isValid = graph_p->isValidTransition(f_checkpoint_r); - } - return isValid; -} - -} // namespace supervision -} // namespace saf -} // namespace lcm -} // namespace score diff --git a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/supervision/Logical.hpp b/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/supervision/Logical.hpp deleted file mode 100644 index c0c508fe..00000000 --- a/src/launch_manager_daemon/health_monitor_lib/src/score/lcm/saf/supervision/Logical.hpp +++ /dev/null @@ -1,376 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -#ifndef LOGICAL_HPP_INCLUDED -#define LOGICAL_HPP_INCLUDED - -#ifndef PHM_PRIVATE -# define PHM_PRIVATE private -#endif - -#include - -#include -#include "score/lcm/saf/common/Observer.hpp" -#include "score/lcm/saf/common/TimeSortingBuffer.hpp" -#include "score/lcm/saf/ifappl/Checkpoint.hpp" -#include "score/lcm/saf/logging/PhmLogger.hpp" -#include "score/lcm/saf/supervision/ICheckpointSupervision.hpp" -#include "score/lcm/saf/supervision/ProcessStateTracker.hpp" -#include "score/lcm/saf/supervision/SupervisionCfg.hpp" - -namespace score -{ -namespace lcm -{ -namespace saf -{ -namespace ifexm -{ -class ProcessState; -} -namespace supervision -{ - -/// @brief Logical Supervision -/// @details Logical Supervision contains the logic for health monitoring - Logical supervision -/* RULECHECKER_comment(0, 38, check_source_character_set, "Special character in comment is mandatory\ - due to sphinx-need syntax.", false) */ -/// @verbatim embed:rst:leading-slashes -/// The Logical Supervision class contains a sub class GraphElement to create a Checkpoint Graph. -/// -/// .. uml:: -/// -/// class GraphElement { -/// - ifappl::Checkpoint& trackedCheckpoint_r -/// - std::vector validNextElements -/// - bool k_isFinalCheckpoint -/// + void addValidNextGraphElement(GraphElement &f_element_r) -/// + Checkpoint* getTrackedCheckpoint(void) -/// + bool isFinal(void) -/// + EResult getNextElement(GraphElement*& f_returnElement_pr, const Checkpoint& f_checkpoint_r) -/// } -/// GraphElement -> GraphElement -/// -/// This way a Checkpoint Graph can be created in two steps: -/// 1. Create all GraphElements (each GraphElement represents one Checkpoint) -/// 2. Connect GraphElements via addValidNextGraphElement() method -/// -/// Example for a configured Graph: -/// -/// - :ref:`Logical graph example` -/// -/// Once a Graph is set up the transitions can then be checked via getNextGraphElement(), -/// which tries to get the next Graph position via a Checkpoint. Either the next position can be found -/// or an error occured. -/// -/// The Logical Supervision state machine implementation is a combination of Adaptive Autosar -/// Logical Supervision (correct, incorrect) and Local Supervision requirements (de/activation). -/// The resulting state machine is documented here: -/// -/// - :ref:`Logical Supervision - State Machine` -/// - :ref:`Logical timing diagram for running process` -/// - :ref:`Logical timing diagram for restarted process` -/// - :ref:`Logical timing diagram for multiple processes` -/// -/// @endverbatim -/* RULECHECKER_comment(0, 3, check_multiple_non_interface_bases, "Observable and Observer are tolerated\ - exceptions of this rule.", false) */ -class Logical : public ICheckpointSupervision, public saf::common::Observable -{ -public: - /// @brief Graph Element - class GraphElement - { - public: - /// @brief No Default Constructor - GraphElement() = delete; - - /// @brief Constructor - /// @param [in] f_checkpoint_r Tracked Checkpoint - /// @param [in] f_isFinal Is Final Checkpoint - GraphElement(ifappl::Checkpoint& f_checkpoint_r, const bool f_isFinal) noexcept; - - /// @brief Default Move Constructor - /* RULECHECKER_comment(0, 3, check_incomplete_data_member_construction, "Default move constructor is\ - moving all members", false) */ - GraphElement(GraphElement&&) noexcept = default; - - /// @brief No Move Assignment - GraphElement& operator=(GraphElement&&) = delete; - /// @brief No Copy Constructor - GraphElement(const GraphElement&) = delete; - /// @brief No Copy Assignment - GraphElement& operator=(const GraphElement&) = delete; - - /// @brief Default Destructor - virtual ~GraphElement() = default; - - /// @brief Add a valid "next" Graph Element which represents a valid transition. - /// @param [in] f_element_r Graph Element to be considered as valid next Graph Element - void addValidNextGraphElement(GraphElement& f_element_r) noexcept(false); - - ///@brief Get tracked Checkpoint - ///@return Pointer to tracked Checkpoint - ifappl::Checkpoint* getTrackedCheckpoint(void) const noexcept; - - /// @brief Is Final Checkpoint - /// @return True Is Final Checkpoint - /// False Not Final Checkpoint - bool isFinal(void) const noexcept; - - /// @brief Result possibilities for check graph transition - enum class EResult : uint8_t - { - valid = 0, // Valid - validFinal = 1, // Valid and Final Checkpoint reached (end of Graph) - error = 2, // Error - }; - - /// @brief Get next Graph Element - /// @param [inout] f_returnElement_pr Pointer of next Graph Element - /// @param [in] f_checkpoint_r Checkpoint for Graph transition - /// @return error No valid Graph transition found f_returnElement_pr not modified - /// valid Valid Graph transition found f_returnElement_pr contains next Element - /// validFinal Valid Graph transition to Final Checkpoint found f_returnElement_pr - /// contains Element which represents a Final Checkpoint - EResult getNextElement(GraphElement*& f_returnElement_pr, - const ifappl::Checkpoint& f_checkpoint_r) const noexcept; - - PHM_PRIVATE: - /// @brief Is Final Checkpoint - const bool k_isFinalCheckpoint{false}; - - /// @brief Tracked Checkpoint - ifappl::Checkpoint& trackedCheckpoint_r; - - /// @brief Valid next Graph Elements - std::vector validNextElements{}; - }; - - /// @brief Logical Supervision Graph - class Graph - { - public: - /// @brief No Default Constructor - Graph() = delete; - - /// @brief Constructor - /// @details Both the f_entries_r and f_graphElements_r vector will be moved into the Graph class. - /// @param [in] f_entries_r Graph entry points (which reference to Initial Checkpoints) - /// @param [in] f_graphElements_r Full Graph - Graph(std::vector& f_entries_r, - std::vector& f_graphElements_r) noexcept; - - /// @brief Default Move Constructor - Graph(Graph&&) noexcept = default; - - /// @brief No Move Assignment - Graph& operator=(Graph&&) = delete; - /// @brief No Copy Constructor - Graph(const Graph&) = delete; - /// @brief No Copy Assignment - Graph& operator=(const Graph&) = delete; - - /// @brief Default Destructor - virtual ~Graph() = default; - - /// @brief Check if transition to given checkpoint is valid - /// @param [in] f_checkpoint_r Checkpoint for Graph transition - /// @return True: valid transition otherwise False - bool isValidTransition(const ifappl::Checkpoint& f_checkpoint_r) noexcept; - - /// @brief Get latest valid reported checkpoint - /// @note May be nullptr if graph is not active, check with isActive() - /// @return Pointer to current graph element - const GraphElement* getCurrentGraphPosition() const noexcept; - - /// @brief Reset Graph - /// @details Reset the Graph to initial state (inactive) - void resetGraph(void) noexcept; - - /// @brief Check if the graph is active, i.e. a valid entrypoint was reported before - /// @return True if graph is active, false otherwise - bool isActive() const noexcept; - - PHM_PRIVATE: - /// @brief Check if given checkpoint is a valid graph entry - /// @param f_checkpoint_r Checkpoint for graph entry - /// @return True: valid entry of graph otherwise False - bool - isValidEntry(const ifappl::Checkpoint& f_checkpoint_r) noexcept; - - /// @brief Vector of Graph elements - std::vector elements{}; - - /// @brief Vector of valid Graph entries - std::vector entries{}; - - /// @brief Graph active status - bool isGraphActive{false}; - - /// @brief Current Graph position - GraphElement* currentGraphPosition_p{nullptr}; - }; - - /// @brief Constructor - /// @param [in] f_logicalCfg_r Logical Supervision Configuration - explicit Logical(const LogicalSupervisionCfg& f_logicalCfg_r) noexcept(false); - - /// @brief Default Move Constructor - /* RULECHECKER_comment(0, 6, check_copy_in_move_constructor, "There are some const members in the subclasses\ - which leads to invocation of their appropriate copy constructors when move-construct a Logical instance",\ - true_no_defect) */ - /* RULECHECKER_comment(0, 3, check_incomplete_data_member_construction, "Default move constructor is\ - moving all members", false) */ - Logical(Logical&&) = default; - - /// @brief No Move Assignment - Logical& operator=(Logical&&) = delete; - /// @brief No Copy Constructor - Logical(const Logical&) = delete; - /// @brief No Copy Assignment - Logical& operator=(const Logical&) = delete; - - /// @brief Destructor - ~Logical() override = default; - - /// @brief Add Checkpoint Graph - /// @details Both the f_graphEntries_r and f_graphElements_r vector will be moved into the Logical Supervision. - /// @param [in] f_graphEntries_r Graph entry points (which reference to Initial Checkpoints) - /// @param [in] f_graphElements_r Full Graph - void addGraph(std::vector& f_graphEntries_r, - std::vector& f_graphElements_r) noexcept(false); - - /// @copydoc ICheckpointSupervision::updateData(const ifappl::Checkpoint&) - void updateData(const ifappl::Checkpoint& f_observable_r) noexcept(true) override; - - /// @copydoc ICheckpointSupervision::updateData(const ifexm::ProcessState&) - void updateData(const ifexm::ProcessState& f_observable_r) noexcept(true) override; - - /// @copydoc ISupervision::evaluate() - void evaluate(const timers::NanoSecondType f_syncTimestamp) override; - - /// @copydoc ICheckpointSupervision::getStatus() - EStatus getStatus(void) const noexcept(true) override; - - /// @copydoc ICheckpointSupervision::getTimestamp() - timers::NanoSecondType getTimestamp(void) const noexcept(true) override; - -PHM_PRIVATE: - /// @brief Check and trigger transition out of state Deactivated - /// @param [in] f_updateEventType Type of update event (e.g, Activation, Deactivation, Checkpoint, ...) - /// @param [in] f_updateEventTimestamp Timestamp of sorted checkpoint from buffer - void - checkTransitionsOutOfDeactivated(const ICheckpointSupervision::EUpdateEventType f_updateEventType, - const timers::NanoSecondType f_updateEventTimestamp) noexcept; - - /// @brief Check and trigger common transitions to state Deactivated - /// @param [in] f_updateEventType Type of update event (e.g, Activation, Deactivation, Checkpoint, ...) - /// @param [in] f_updateEventTimestamp Timestamp of sorted checkpoint from buffer - void checkTransitionsToDeactivated(const ICheckpointSupervision::EUpdateEventType f_updateEventType, - const timers::NanoSecondType f_updateEventTimestamp) noexcept; - - /// @brief Check and trigger recovery transition - /// @details The recovery transition is triggered if a crashed process has been restarted (kRecoveredFromCrash) - /// If the recovery transition is triggered, the supervision is switched to deactivated and afterwards to - /// ok. - /// @param [in] f_updateEventType Type of update event (e.g, Activation, Deactivation, Checkpoint, ...) - /// @param [in] f_updateEventTimestamp Timestamp of update event - /// @return True: if recovery transition was triggered, False: otherwise - bool checkForRecoveryTransition(const ICheckpointSupervision::EUpdateEventType f_updateEventType, - const timers::NanoSecondType f_updateEventTimestamp) noexcept(true); - - /// @brief Check and trigger transition out of state Ok - /// @param [in] f_updateEventType Type of update event (e.g, Activation, Deactivation, Checkpoint, ...) - /// @param [in] f_updateEventTimestamp Timestamp of sorted checkpoint from buffer - /// @param [in] f_updateEvent Update event object (e.g, Activation, Deactivation, Checkpoint, ...) - void checkTransitionsOutOfOk(const ICheckpointSupervision::EUpdateEventType f_updateEventType, - const timers::NanoSecondType f_updateEventTimestamp, - const TimeSortedUpdateEvent f_updateEvent) noexcept; - - /// @brief Switch to state Deactivate - void switchToDeactivated(void) noexcept; - - /// @brief Switch to state Ok - void switchToOk(void) noexcept; - - /// @brief Reason for switching internal state - enum class EReason : std::uint8_t - { - kDataLoss, ///< Checkpoint data was lost due to buffer overrun - kDataCorruption, ///< Data corruption occured - kInvalidTransition ///< No valid transition to next checkpoint - }; - - /// @brief Store failure information for better error messages when going to EXPIRED state - struct ExpiredFailureInfo - { - /// @brief The currently last valid reported checkpoint - std::uint32_t currentCheckpointId{0U}; - /// @brief The newly reported invalid checkpoint - std::uint32_t reportedCheckpointId{0U}; - /// @brief The process that reported the invalid checkpoint - // cppcheck-suppress unusedStructMember - const ifexm::ProcessState* processReportedInvalidCp{nullptr}; - }; - - /// @brief Storing failure information when transitioning to EXPIRED - ExpiredFailureInfo failureInfo; - - /// @brief Switch to state Expired - /// @param [in] reason Reason for switch to Expired - void switchToExpired(EReason reason) noexcept; - - /// @brief Is valid Graph Transition - /// @details Check if a given Checkpoint is a valid transition from the current - /// @param [in] f_checkpoint_r Checkpoint used for checking a valid Graph Transition - /// @return True Valid Graph Transition was found - /// False Invalid Graph Transition - bool isValidGraphTransition(const ifappl::Checkpoint& f_checkpoint_r) const noexcept; - - /// @brief Monitored Checkpoint Graph - std::unique_ptr graph_p{}; - - /// @brief Data loss event marker - bool isDataLossEvent{false}; - - /// @brief Logical Supervision status - EStatus logicalStatus{EStatus::deactivated}; - - /// @brief Logger - logging::PhmLogger& logger_r; - - /// @brief Timestamp in which state change is detected in [nano seconds] - /// @details This timestamp is updated whenever assessment is done or data loss has occurred. - saf::timers::NanoSecondType eventTimestamp{0U}; - - /// @brief Sync timestamp from current evaluation [nano seconds] - /// @details This is required for eventTimestamp in case of data loss - saf::timers::NanoSecondType lastSyncTimestamp{0U}; - - /// @brief Time sorting checkpoint buffer - /// @details The buffer enables the logical supervision that checkpoint can be received - /// from different Monitor interfaces in a given time frame e.g. two PHM Daemon cycles - score::lcm::saf::common::TimeSortingBuffer timeSortingUpdateEventBuffer; - - /// @brief Keeps track of all relevant processes - ProcessStateTracker processTracker; -}; - -} // namespace supervision -} // namespace saf -} // namespace lcm -} // namespace score - -#endif From 71fbdd9a74a32dd79c4a549b67e98540900eb921 Mon Sep 17 00:00:00 2001 From: "Quiring Paul (ETAS-ECM/XPC-Fe2)" Date: Fri, 27 Mar 2026 13:40:17 +0100 Subject: [PATCH 2/2] Apply suggestions from review --- scripts/config_mapping/lifecycle_config.py | 2 -- .../tests/basic_test/expected_output/hm_demo.json | 2 -- .../tests/empty_lm_config_test/expected_output/hm_demo.json | 2 -- .../tests/health_config_test/expected_output/hm_demo.json | 2 -- .../tests/lm_config_test/expected_output/hm_demo.json | 2 -- 5 files changed, 10 deletions(-) diff --git a/scripts/config_mapping/lifecycle_config.py b/scripts/config_mapping/lifecycle_config.py index 73f238b5..c64312f1 100644 --- a/scripts/config_mapping/lifecycle_config.py +++ b/scripts/config_mapping/lifecycle_config.py @@ -227,8 +227,6 @@ def get_all_refProcessGroupStates(run_targets): hm_config["hmMonitorInterface"] = [] hm_config["hmSupervisionCheckpoint"] = [] hm_config["hmAliveSupervision"] = [] - hm_config["hmDeadlineSupervision"] = [] - hm_config["hmLogicalSupervision"] = [] hm_config["hmLocalSupervision"] = [] hm_config["hmGlobalSupervision"] = [] hm_config["hmRecoveryNotification"] = [] diff --git a/scripts/config_mapping/tests/basic_test/expected_output/hm_demo.json b/scripts/config_mapping/tests/basic_test/expected_output/hm_demo.json index 4186ddd9..3dee12b3 100644 --- a/scripts/config_mapping/tests/basic_test/expected_output/hm_demo.json +++ b/scripts/config_mapping/tests/basic_test/expected_output/hm_demo.json @@ -198,8 +198,6 @@ ] } ], - "hmDeadlineSupervision": [], - "hmLogicalSupervision": [], "hmLocalSupervision": [ { "ruleContextKey": "someip-daemon_local_supervision", diff --git a/scripts/config_mapping/tests/empty_lm_config_test/expected_output/hm_demo.json b/scripts/config_mapping/tests/empty_lm_config_test/expected_output/hm_demo.json index 8e559853..99401745 100644 --- a/scripts/config_mapping/tests/empty_lm_config_test/expected_output/hm_demo.json +++ b/scripts/config_mapping/tests/empty_lm_config_test/expected_output/hm_demo.json @@ -5,8 +5,6 @@ "hmMonitorInterface": [], "hmSupervisionCheckpoint": [], "hmAliveSupervision": [], - "hmDeadlineSupervision": [], - "hmLogicalSupervision": [], "hmLocalSupervision": [], "hmGlobalSupervision": [], "hmRecoveryNotification": [] diff --git a/scripts/config_mapping/tests/health_config_test/expected_output/hm_demo.json b/scripts/config_mapping/tests/health_config_test/expected_output/hm_demo.json index 589bf217..186c040b 100644 --- a/scripts/config_mapping/tests/health_config_test/expected_output/hm_demo.json +++ b/scripts/config_mapping/tests/health_config_test/expected_output/hm_demo.json @@ -198,8 +198,6 @@ ] } ], - "hmDeadlineSupervision": [], - "hmLogicalSupervision": [], "hmLocalSupervision": [ { "ruleContextKey": "state_manager_local_supervision", diff --git a/scripts/config_mapping/tests/lm_config_test/expected_output/hm_demo.json b/scripts/config_mapping/tests/lm_config_test/expected_output/hm_demo.json index 619e3082..fc472337 100644 --- a/scripts/config_mapping/tests/lm_config_test/expected_output/hm_demo.json +++ b/scripts/config_mapping/tests/lm_config_test/expected_output/hm_demo.json @@ -261,8 +261,6 @@ ] } ], - "hmDeadlineSupervision": [], - "hmLogicalSupervision": [], "hmLocalSupervision": [ { "ruleContextKey": "test_app2_local_supervision",