Skip to content

Commit

Permalink
Fix nasa#2175, Apply consistent naming to common Event IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
thnkslprpt committed Mar 31, 2023
1 parent 7af467e commit 4885bd1
Show file tree
Hide file tree
Showing 32 changed files with 172 additions and 156 deletions.
18 changes: 18 additions & 0 deletions docs/cFS_IdentifierNamingConvention.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,24 @@ Some general rules/recommendations to follow for cFS identifiers:
__NOTE__: a sufficient number of terms must always be used in order to ensure uniqueness
and avoid ambiguity.

8. Event IDs in cFE (and across the other cFS components/apps) should be capitalized and use
a consistent abbreviated naming pattern in the following order:
<APPLICATION\_NAME>\_<EVENT>\_<EVENT\_TYPE>\_<EID>
<br>
For example:
| Event ID | Application | Command/Event Description | Event Type | Event ID Suffix |
| :---: | :---: | :---: | :---: | :---: |
| CFE_EVS_NOOP_INF_EID | CFE Event Service | NOOP Command | Informational | Event ID |
| HS_CR_PIPE_ERR_EID | Health & Safety | Create Pipe Error | Error | Event ID |

Common events should be named consistently across applications for ease of recognition.
<br>
Common command/event descriptions include:
\_MID\_ERR\_EID: Invalid Message ID Received
\_NOOP\_INF\_EID: No-op Command Success
\_INIT\_INF\_EID: Applicaiton Initialization Success
\_RESET\_INF\_EID: Reset Command Counters Command Success


## Applicability to Actions / Commands

Expand Down
2 changes: 1 addition & 1 deletion docs/src/cfe_es.dox
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@
message length embedded within the header (from `CFE_MSG_GetSize()`) matches the expected
length of that message, based on the size of the C structure defining that command.
If there is any discrepancy between the expected and actual message size, ES will generate
the #CFE_ES_LEN_ERR_EID event, increment the command error counter (\ES_CMDEC), and the
the #CFE_ES_CMD_LEN_ERR_EID event, increment the command error counter (\ES_CMDEC), and the
command will _not_ be accepted for processing.

The following is a list of commands that are processed by the cFE Executive Services Task.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/cfe_evs.dox
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@
** message length embedded within the header (from `CFE_MSG_GetSize()`) matches the expected
** length of that message, based on the size of the C structure defining that command.
** If there is any discrepancy between the expected and actual message size, EVS will generate
** the #CFE_EVS_LEN_ERR_EID event, increment the command error counter (\EVS_CMDEC), and the
** the #CFE_EVS_CMD_LEN_ERR_EID event, increment the command error counter (\EVS_CMDEC), and the
** command will _not_ be accepted for processing.
**
** The following is a list of commands that are processed by the cFE Event Services Task.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/cfe_sb.dox
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@
** message length embedded within the header (from `CFE_MSG_GetSize()`) matches the expected
** length of that message, based on the size of the C structure defining that command.
** If there is any discrepancy between the expected and actual message size, SB will generate
** the #CFE_SB_LEN_ERR_EID event, increment the command error counter (\SB_CMDEC), and the
** the #CFE_SB_CMD_LEN_ERR_EID event, increment the command error counter (\SB_CMDEC), and the
** command will _not_ be accepted for processing.
**
** The following is a list of commands that are processed by the cFE Software Bus Task.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/cfe_tbl.dox
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@
** message length embedded within the header (from `CFE_MSG_GetSize()`) matches the expected
** length of that message, based on the size of the C structure defining that command.
** If there is any discrepancy between the expected and actual message size, TBL will generate
** the #CFE_TBL_LEN_ERR_EID event, increment the command error counter (\TBL_CMDEC), and the
** the #CFE_TBL_CMD_LEN_ERR_EID event, increment the command error counter (\TBL_CMDEC), and the
** command will _not_ be accepted for processing.
**
** The following is a list of commands that are processed by the cFE Table Services Task.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/cfe_time.dox
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@
** message length embedded within the header (from `CFE_MSG_GetSize()`) matches the expected
** length of that message, based on the size of the C structure defining that command.
** If there is any discrepancy between the expected and actual message size, TIME will generate
** the #CFE_TIME_LEN_ERR_EID event, increment the command error counter (\TIME_CMDEC), and the
** the #CFE_TIME_CMD_LEN_ERR_EID event, increment the command error counter (\TIME_CMDEC), and the
** command will _not_ be accepted for processing.
**
** The following is a list of commands that are processed by the cFE Time Services Task.
Expand Down
4 changes: 2 additions & 2 deletions modules/es/eds/cfe_es.xml
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@

Evidence of failure may be found in the following telemetry:
- \b \c \ES_CMDEC - command error counter will increment
- the #CFE_ES_LEN_ERR_EID error event message will be generated
- the #CFE_ES_CMD_LEN_ERR_EID error event message will be generated

\par Criticality
None
Expand Down Expand Up @@ -863,7 +863,7 @@

Evidence of failure may be found in the following telemetry:
- \b \c \ES_CMDEC - command error counter will increment
- the #CFE_ES_LEN_ERR_EID error event message will be generated
- the #CFE_ES_CMD_LEN_ERR_EID error event message will be generated

\par Criticality

Expand Down
4 changes: 2 additions & 2 deletions modules/es/fsw/inc/cfe_es_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@
*
* Invalid command code for message ID #CFE_ES_CMD_MID received on the ES message pipe.
*/
#define CFE_ES_CC1_ERR_EID 22
#define CFE_ES_CC_ERR_EID 22

/**
* \brief ES Invalid Command Length Event ID
Expand All @@ -280,7 +280,7 @@
*
* Invalid length for the command code in message ID #CFE_ES_CMD_MID received on the ES message pipe.
*/
#define CFE_ES_LEN_ERR_EID 23
#define CFE_ES_CMD_LEN_ERR_EID 23

/**
* \brief ES Restart Command Invalid Restart Type Event ID
Expand Down
2 changes: 1 addition & 1 deletion modules/es/fsw/inc/cfe_es_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
**
** Evidence of failure may be found in the following telemetry:
** - \b \c \ES_CMDEC - command error counter will increment
** - the #CFE_ES_LEN_ERR_EID error event message will be generated
** - the #CFE_ES_CMD_LEN_ERR_EID error event message will be generated
**
** \par Criticality
** None
Expand Down
4 changes: 2 additions & 2 deletions modules/es/fsw/src/cfe_es_dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ bool CFE_ES_VerifyCmdLength(const CFE_MSG_Message_t *MsgPtr, size_t ExpectedLeng
CFE_MSG_GetMsgId(MsgPtr, &MsgId);
CFE_MSG_GetFcnCode(MsgPtr, &FcnCode);

CFE_EVS_SendEvent(CFE_ES_LEN_ERR_EID, CFE_EVS_EventType_ERROR,
CFE_EVS_SendEvent(CFE_ES_CMD_LEN_ERR_EID, CFE_EVS_EventType_ERROR,
"Invalid msg length: ID = 0x%X, CC = %u, Len = %u, Expected = %u",
(unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)FcnCode, (unsigned int)ActualLength,
(unsigned int)ExpectedLength);
Expand Down Expand Up @@ -267,7 +267,7 @@ void CFE_ES_TaskPipe(const CFE_SB_Buffer_t *SBBufPtr)
break;

default:
CFE_EVS_SendEvent(CFE_ES_CC1_ERR_EID, CFE_EVS_EventType_ERROR,
CFE_EVS_SendEvent(CFE_ES_CC_ERR_EID, CFE_EVS_EventType_ERROR,
"Invalid ground command code: ID = 0x%X, CC = %d",
(unsigned int)CFE_SB_MsgIdToValue(MessageID), (int)CommandCode);
CFE_ES_Global.TaskData.CommandErrorCounter++;
Expand Down
42 changes: 21 additions & 21 deletions modules/es/ut-coverage/es_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -3217,7 +3217,7 @@ void TestTask(void)
*/
ES_ResetUnitTest();
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_CLEAR_ER_LOG_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID);
CFE_UtAssert_EVENTSENT(CFE_ES_CMD_LEN_ERR_EID);

/* Test resetting and setting the max for the processor reset count */
ES_ResetUnitTest();
Expand Down Expand Up @@ -3332,22 +3332,22 @@ void TestTask(void)
/* Test the command pipe message process with an invalid command */
ES_ResetUnitTest();
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, sizeof(CmdBuf.NoopCmd), UT_TPID_CFE_ES_CMD_INVALID_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_CC1_ERR_EID);
CFE_UtAssert_EVENTSENT(CFE_ES_CC_ERR_EID);

/* Test sending a no-op command with an invalid command length */
ES_ResetUnitTest();
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_NOOP_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID);
CFE_UtAssert_EVENTSENT(CFE_ES_CMD_LEN_ERR_EID);

/* Test sending a reset counters command with an invalid command length */
ES_ResetUnitTest();
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_RESET_COUNTERS_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID);
CFE_UtAssert_EVENTSENT(CFE_ES_CMD_LEN_ERR_EID);

/* Test sending a cFE restart command with an invalid command length */
ES_ResetUnitTest();
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_RESTART_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID);
CFE_UtAssert_EVENTSENT(CFE_ES_CMD_LEN_ERR_EID);

/* Test cFE restart with a power on reset */
ES_ResetUnitTest();
Expand All @@ -3361,7 +3361,7 @@ void TestTask(void)
*/
ES_ResetUnitTest();
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_START_APP_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID);
CFE_UtAssert_EVENTSENT(CFE_ES_CMD_LEN_ERR_EID);

/* Test start application command with a processor restart on application
* exception
Expand All @@ -3386,63 +3386,63 @@ void TestTask(void)
*/
ES_ResetUnitTest();
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_STOP_APP_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID);
CFE_UtAssert_EVENTSENT(CFE_ES_CMD_LEN_ERR_EID);

/* Test sending a restart application command with an invalid command
* length
*/
ES_ResetUnitTest();
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_RESTART_APP_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID);
CFE_UtAssert_EVENTSENT(CFE_ES_CMD_LEN_ERR_EID);

/* Test sending a reload application command with an invalid command
* length
*/
ES_ResetUnitTest();
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_RELOAD_APP_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID);
CFE_UtAssert_EVENTSENT(CFE_ES_CMD_LEN_ERR_EID);

/* Test sending a write request for a single application with an
* invalid command length
*/
ES_ResetUnitTest();
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_QUERY_ONE_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID);
CFE_UtAssert_EVENTSENT(CFE_ES_CMD_LEN_ERR_EID);

/* Test sending a write request for all applications with an
* invalid command length
*/
ES_ResetUnitTest();
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_QUERY_ALL_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID);
CFE_UtAssert_EVENTSENT(CFE_ES_CMD_LEN_ERR_EID);

/* Test sending a write request for all tasks with an
* invalid command length
*/
ES_ResetUnitTest();
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_QUERY_ALL_TASKS_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID);
CFE_UtAssert_EVENTSENT(CFE_ES_CMD_LEN_ERR_EID);

/* Test sending a request to clear the system log with an
* invalid command length
*/
ES_ResetUnitTest();
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_CLEAR_SYSLOG_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID);
CFE_UtAssert_EVENTSENT(CFE_ES_CMD_LEN_ERR_EID);

/* Test sending a request to overwrite the system log with an
* invalid command length
*/
ES_ResetUnitTest();
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_OVER_WRITE_SYSLOG_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID);
CFE_UtAssert_EVENTSENT(CFE_ES_CMD_LEN_ERR_EID);

/* Test sending a request to write the system log with an
* invalid command length
*/
ES_ResetUnitTest();
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_WRITE_SYSLOG_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID);
CFE_UtAssert_EVENTSENT(CFE_ES_CMD_LEN_ERR_EID);

/* Test successful overwriting of the system log using overwrite mode */
ES_ResetUnitTest();
Expand All @@ -3457,35 +3457,35 @@ void TestTask(void)
*/
ES_ResetUnitTest();
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_WRITE_ER_LOG_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID);
CFE_UtAssert_EVENTSENT(CFE_ES_CMD_LEN_ERR_EID);

/* Test sending a request to reset the processor reset count with an
* invalid command length
*/
ES_ResetUnitTest();
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_RESET_PR_COUNT_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID);
CFE_UtAssert_EVENTSENT(CFE_ES_CMD_LEN_ERR_EID);

/* Test sending a request to set the maximum processor reset count with
* an invalid command length
*/
ES_ResetUnitTest();
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_SET_MAX_PR_COUNT_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID);
CFE_UtAssert_EVENTSENT(CFE_ES_CMD_LEN_ERR_EID);

/* Test sending a request to delete the CDS with an invalid command
* length
*/
ES_ResetUnitTest();
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_DELETE_CDS_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID);
CFE_UtAssert_EVENTSENT(CFE_ES_CMD_LEN_ERR_EID);

/* Test sending a telemetry pool statistics retrieval command with an
* invalid command length
*/
ES_ResetUnitTest();
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_SEND_MEM_POOL_STATS_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID);
CFE_UtAssert_EVENTSENT(CFE_ES_CMD_LEN_ERR_EID);

/* Test successful dump of CDS to file using a specified dump file name */
ES_ResetUnitTest();
Expand All @@ -3502,7 +3502,7 @@ void TestTask(void)
/* Dump CDS command with invalid length */
ES_ResetUnitTest();
UT_CallTaskPipe(CFE_ES_TaskPipe, &CmdBuf.Msg, 0, UT_TPID_CFE_ES_CMD_DUMP_CDS_REGISTRY_CC);
CFE_UtAssert_EVENTSENT(CFE_ES_LEN_ERR_EID);
CFE_UtAssert_EVENTSENT(CFE_ES_CMD_LEN_ERR_EID);

/* Test error when sending Build Info event */
ES_ResetUnitTest();
Expand Down
4 changes: 2 additions & 2 deletions modules/evs/eds/cfe_evs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@
\par Command Verification
Successful execution of this command may be verified with the following telemetry:
- \b \c \EVS_CMDPC - command execution counter will increment
- The #CFE_EVS_NOOP_EID informational event message will be generated
- The #CFE_EVS_NOOP_INF_EID informational event message will be generated

\par Error Conditions
There are no error conditions for this command. If the Event
Expand Down Expand Up @@ -379,7 +379,7 @@
the following telemetry:
- \b \c \EVS_CMDPC - command execution counter will
increment
- The #CFE_EVS_RSTCNT_EID debug event message will be
- The #CFE_EVS_RESET_INF_EID debug event message will be
generated

\par Error Conditions
Expand Down
12 changes: 6 additions & 6 deletions modules/evs/fsw/inc/cfe_evs_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*
* \link #CFE_EVS_NOOP_CC EVS NO-OP command \endlink success.
*/
#define CFE_EVS_NOOP_EID 0
#define CFE_EVS_NOOP_INF_EID 0

/**
* \brief EVS Initialization Event ID
Expand All @@ -50,7 +50,7 @@
*
* Event Services Task initialization complete.
*/
#define CFE_EVS_STARTUP_EID 1
#define CFE_EVS_INIT_INF_EID 1

/**
* \brief EVS Write Event Log Command File Write Entry Failed Event ID
Expand Down Expand Up @@ -85,7 +85,7 @@
*
* Invalid message ID received on the EVS message pipe.
*/
#define CFE_EVS_ERR_MSGID_EID 5
#define CFE_EVS_MID_ERR_EID 5

/**
* \brief EVS Command Event Not Registered For Filtering Event ID
Expand Down Expand Up @@ -188,7 +188,7 @@
*
* Invalid command code for message ID #CFE_EVS_CMD_MID received on the EVS message pipe.
*/
#define CFE_EVS_ERR_CC_EID 15
#define CFE_EVS_CC_ERR_EID 15

/**
* \brief EVS Reset Counters Command Success Event ID
Expand All @@ -199,7 +199,7 @@
*
* \link #CFE_EVS_RESET_COUNTERS_CC EVS Reset Counters Command \endlink success.
*/
#define CFE_EVS_RSTCNT_EID 16
#define CFE_EVS_RESET_INF_EID 16

/**
* \brief EVS Set Filter Command Success Event ID
Expand Down Expand Up @@ -465,7 +465,7 @@
*
* Invalid length for the command code in message ID #CFE_EVS_CMD_MID received on the EVS message pipe.
*/
#define CFE_EVS_LEN_ERR_EID 43
#define CFE_EVS_CMD_LEN_ERR_EID 43

/**
* \brief EVS Events Squelched Error Event ID
Expand Down
4 changes: 2 additions & 2 deletions modules/evs/fsw/inc/cfe_evs_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
** following telemetry:
** - \b \c \EVS_CMDPC - command execution counter will
** increment
** - The #CFE_EVS_NOOP_EID informational event message will
** - The #CFE_EVS_NOOP_INF_EID informational event message will
** be generated
**
** \par Error Conditions
Expand Down Expand Up @@ -96,7 +96,7 @@
** will be reset to 0
** - \b \c \EVS_CMDEC - command error counter
** will be reset to 0
** - The #CFE_EVS_RSTCNT_EID debug event message will be
** - The #CFE_EVS_RESET_INF_EID debug event message will be
** generated
**
** \par Error Conditions
Expand Down
Loading

0 comments on commit 4885bd1

Please sign in to comment.