Loading
This commit addresses issues #33 and #34 by refactoring the oneM2M Application Entity (AE) creation and interaction logic within meep-iot and meep-sss, alongside implementing missing update operations and resolving nil-pointer panics. Resolves #33: The meep-iot service previously hardcoded the global iotPlatformId directly into the Resource Name (rn) field when creating AEs on the oneM2M CSE. This prevented multiple MEPs from registering to the same centralized CSE simultaneously, as the CSE would reject duplicate rn attributes with a 409 Conflict. The static assignment has been decoupled to support dynamic originators. Resolves #34: The meep-sss-mgr discarded the assigned Application Entity Identifier (aei) returned by the CSE upon AE creation. Consequently, subsequent protocol operations (GET, PUT, DELETE) failed with a 403 Forbidden because they defaulted to a hardcoded "Admin" or iotPlatformId for the X-M2M-Origin header. The codebase now accurately deserializes the aei attribute, persists it inside the SensorDiscoveryInfo and IotPlatformInfo structures, and dynamically maps it to the from parameter in the SssMgrBindingProtocolContext for downstream requests. Additional Technical Implementation Details: - Dynamic Originator Injection: Introduced the MEEP_IOT_ORIGINATOR environment variable via Helm charts (values-template.yaml and deployment.yaml). This configuration is parsed by meep-iot.go, stored in the SbiCfg, and passed down to iot-mgr.go for overriding standard request originators when required. - Resource Update Operations: Implemented the PUT /registered_iot_platforms/{iotPlatformId} and PUT /registered_devices/{deviceId} handlers across the server, SBI, and manager tiers (meep-iot.go, iot-sbi.go, iot-mgr.go), enabling runtime modifications to platform and device states. - Safety and Panic Resolutions: - Resolved an interface conversion panic in onem2m-mgr.go:populateSensors() by validating the existence and correct type of the m2m:uril object prior to slice iteration. - Mitigated nil-pointer dereferences in meep-sss subscription handlers (subscriptionsPOST for Discovery, Status, and Data) by validating payload structs before assignment. - Hardened the meep-sss background discovery ticker with slice length validations against CustomServicesTransportInfo prior to index access.