Skip to content

Add OSAL hooks for persistent group membership storage#50

Open
mzella-ll wants to merge 1 commit into
CiscoDevNet:mainfrom
mzella-ll:feature/add-group-persistence-hooks
Open

Add OSAL hooks for persistent group membership storage#50
mzella-ll wants to merge 1 commit into
CiscoDevNet:mainfrom
mzella-ll:feature/add-group-persistence-hooks

Conversation

@mzella-ll

Copy link
Copy Markdown

Summary

This PR adds OSAL-level hooks for storing and restoring CSMP group membership information.

The CSMP Internet-Draft specifies:

Group membership information MUST be stored in persistent storage so that once a device has been assigned any group it is remembered across reboots.

This PR prepares the codebase for that requirement by adding the OSAL interface and calling it from the relevant CSMP group handling code paths.

Changes

  • Add osal_read_groups() and osal_write_groups() to the OSAL interface.
  • Add stub implementations for the existing OSAL backends:
    • Linux
    • FreeRTOS
    • EFR32 Wi-SUN
  • Load group information during CSMP service startup.
  • Write group information when a group assignment changes.

Motivation

Group membership information should be persisted according to the CSMP specification.

The CSMP layer should not implement platform-specific storage directly. By adding OSAL hooks, each platform can later provide its own persistent storage implementation while keeping the CSMP logic portable.

Out of scope

This PR does not implement actual persistent storage for the existing platforms.

The current backend functions return OSAL_FAILURE as stubs. Platform-specific storage support can be added in follow-up PRs.

Related issue

Fixes #49

@mzella-ll mzella-ll force-pushed the feature/add-group-persistence-hooks branch from af9b5c6 to f37f587 Compare April 28, 2026 22:53
- Add OSAL API for group membership storage
- Add stub group storage functions to OSAL backends
- Call group storage hooks from CSMP group handling
@mzella-ll mzella-ll force-pushed the feature/add-group-persistence-hooks branch from f37f587 to 7c1ac3f Compare June 2, 2026 01:16
Comment thread src/csmpapi/csmpservice.c
if((devconfig == NULL) || (csmp_handle == NULL))
return -2;

initGroups();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All app initialization are currently done in sample_data_init().
csmpservice.c is focused on handling csmp service and not recommended to do data inits for TLVs. Pls move this to sample_data_init() as discussed in the review discussion.

Comment thread src/csmpagent/csmpagent.h
*
* @return int 0 is success
*/
int initGroups();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls move this to sample_data_init() as discussed in the review discussion.

static uint32_t m_GroupIds[CSMP_GROUP_NUM_TYPES] = {0};
static bool m_bLastMatchValid;

int initGroups()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls perform initialization in sample_data_init() as discussed in the review discussion.

Comment thread osal/osal.h
*****************************************************************************/
osal_basetype_t osal_copy_firmware(uint8_t source_slotid, uint8_t dest_slotid, Csmp_Slothdr *slots);

/****************************************************************************

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR primarily intends to define dummy OSAL APIs proposed to persist group information for Group management TLVs (viz., 55,56,57,58) for all platforms.

Note: Per current agent design, platform specific implementation for TLV handlers are made under sample/tlvs/linux_tlvs.c/currenttime_get() - for Linux CurrentTime_TLV18 GET for example.

OSAL APIs are typically defined for abstracting platform infra related operations. There could be exceptions for some APIs consumed by TLV handlers as well.

Please give the current approach a thought of whether an OSAL API will be defined or platform specific TLV handlers will be defined to persist group information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add OSAL hooks for persistent CSMP group membership storage

2 participants