Skip to content

RDKCOM-5638: RDKBDEV-3490 common-library support for IP Diagnostics upload download speedtest - #134

Open
SatishKaluvalapalli wants to merge 2 commits into
rdkcentral:developfrom
SatishKaluvalapalli:RDKBDEV-3490-ip-diagnostics-upload-download-speedtest
Open

SatishKaluvalapalli wants to merge 2 commits into
rdkcentral:developfrom
SatishKaluvalapalli:RDKBDEV-3490-ip-diagnostics-upload-download-speedtest

Conversation

@SatishKaluvalapalli

@SatishKaluvalapalli SatishKaluvalapalli commented Sep 4, 2026 •

Copy link
Copy Markdown

RDKBDEV-3490: common-library support for IP Diagnostics upload/download test

Reason for change: Add common-library dependencies required by RDKBDEV-3490 IP Diagnostics upload/download speedtest improvements in test-and-diagnostic: microsecond precision in UserGetSystemTime, TR-143 diagnostic struct defaults with Canceled/Error_Internal states, TR-181 unsignedLong datatype support end-to-end across DSLH, SLAP, and message-bus layers, and Notify_change() in ccsp_base_api (USE_NOTIFY_COMPONENT) so test-and-diagnostic can publish UploadDownloadSpeedStatus and DiagnosticsState via Device.NotifyComponent.SetNotifi_ParamName through notify_comp to WebPA/PAM.

Test Procedure: Build and deploy with matching test-and-diagnostic PR. Trigger upload/download speed tests and verify TimeBasedTestDuration reports millisecond precision, byte counters handle values above 32-bit range, Error_Internal diagnostic state is available when interface counters are invalid, and notify_comp receives UploadDownloadSpeedStatus / DiagnosticsState updates.

Risks: Low — datatype, timing, and notify-component helper changes are shared library updates; must be merged before or with test-and-diagnostic PR.

Dependency:
rdkcentral/test-and-diagnostic#242
rdkcentral/provisioning-and-management#355

Priority: P2

Copilot AI lite review requested due to automatic review settings September 4, 2026 07:27
@SatishKaluvalapalli
SatishKaluvalapalli requested review from a team as code owners September 4, 2026 07:27
@SatishKaluvalapalli

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new unsignedLong path is currently vulnerable to incorrect/truncated value rendering and there are correctness issues in the new notify/time helpers that should be fixed before merge.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates common-library to support IP Diagnostics upload/download speedtest enhancements by improving timestamp precision, adding TR-143 diagnostic defaults/states, and enabling TR-181 unsignedLong propagation through DSLH/SLAP/message-bus layers (including an optional notify-component helper).

Changes:

  • Add microsecond precision to UserGetSystemTime() and extend USER_SYSTEM_TIME with a MicroSecond field.
  • Introduce TR-181 unsignedLong datatype support end-to-end via new CWMP datatype + SLAP ContentType tagging and message-bus handling.
  • Add optional Notify_change() helper (guarded by USE_NOTIFY_COMPONENT) to publish notify-component updates.
File summaries
File Description
source/util_api/ccsp_msg_bus/ccsp_base_api.c Adds optional Notify_change() helper using CCSP base set-parameter API.
source/ccsp/include/ccsp_base_api.h Exposes Notify_change() API in public header.
source/util_api/ansc/include/user_time.h Extends USER_SYSTEM_TIME with MicroSecond.
source/cosa/include/linux/user_time.h Mirrors USER_SYSTEM_TIME update for Linux COSA include.
source/util_api/ansc/AnscPlatform/user_time.c Implements sub-second timing in UserGetSystemTime() using clock_gettime.
source/util_api/ansc/AnscPlatform/user_runtime.c Adds _ansc_ultoa() utility for ULONG to string conversion.
source/cosa/include/linux/user_runtime.h Declares _ansc_ultoa() for Linux builds.
source/cosa/package/slap/include/slap_definitions.h Adds SLAP_CONTENT_TYPE_UNSIGNED_LONG tag for TR-181 unsignedLong/StatsCounter64.
source/ccsp/components/include/dslh_definitions_database.h Adds CWMP datatype/name for unsignedLong.
source/ccsp/components/common/DataModel/dml/components/DslhWmpDatabase/dslh_wmpdo_utilities.c Parses unsignedLong and sets range defaults for format constraints.
source/ccsp/components/common/DataModel/dml/components/DslhWmpDatabase/dslh_wmpdo_mprif.c Tags unsignedLong params with SLAP unsigned-long ContentType.
source/ccsp/components/common/DataModel/dml/components/DslhWmpDatabase/dslh_wmpdo_mpaif.c Allows setting both unsignedInt and unsignedLong parameter types.
source/ccsp/components/common/DataModel/dml/components/DslhVarRecord/dslh_varro_access.c Allows unsignedLong ContentType to follow numeric (non-string) conversion paths.
source/ccsp/components/common/DataModel/dml/components/DslhCpeController/dslh_cpeco_control.c Maps CWMP unsignedLong strings to ccsp_unsignedLong.
source/ccsp/components/common/MessageBusHelper/helper/messagebus_interface_helper.c Updates get/set paths for ccsp_unsignedLong and validation supporting >32-bit on LP64.
source/ccsp/components/common/MessageBusHelper/helper/messagebus_interface_utility.c Updates parameter-change signal typing for unsignedLong.
source/ccsp/components/include/dslh_definitions_tr143.h Adds TR-143 diagnostic state constants and struct defaults for time-based testing fields.
Review details

Suppressed comments (1)

source/ccsp/components/common/MessageBusHelper/helper/messagebus_interface_utility.c:229

  • newValue is always rendered via SlapVcoUint32ToString(), which truncates to 32-bit; for SLAP_CONTENT_TYPE_UNSIGNED_LONG this defeats the purpose of advertising ccsp_unsignedLong. Render unsigned-long values with a 64-bit-capable format/buffer.
        if ( pNewValue->Syntax == SLAP_VAR_SYNTAX_uint32 )
        {
            pParamSignal->newValue = SlapVcoUint32ToString(NULL, pNewValue->Variant.varUint32);
            if ( pNewValue->ContentType == SLAP_CONTENT_TYPE_UNSIGNED_LONG )
            {
                pParamSignal->type = ccsp_unsignedLong;
            }
  • Files reviewed: 17/17 changed files
  • Comments generated: 6
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread source/util_api/ansc/AnscPlatform/user_runtime.c
Comment thread source/util_api/ansc/AnscPlatform/user_time.c
Comment thread source/util_api/ccsp_msg_bus/ccsp_base_api.c
Comment thread source/util_api/ccsp_msg_bus/ccsp_base_api.c
Copilot AI review requested due to automatic review settings September 4, 2026 07:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new unsignedLong plumbing currently formats values via a 32-bit string conversion path (truncating >2^32 values) and there are additional correctness/API issues in the newly added helpers.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (6)

source/ccsp/components/common/MessageBusHelper/helper/messagebus_interface_helper.c:336

  • SLAP_CONTENT_TYPE_UNSIGNED_LONG values are converted with SlapVcoUint32ToString(), which truncates to 32 bits (casts to unsigned int) and cannot represent values > 2^32-1 correctly; this breaks the new unsignedLong/StatsCounter64 plumbing.
                else if ( pParamValueArray[i].Value->ContentType == SLAP_CONTENT_TYPE_UNSIGNED_LONG )
                {
                    ppReturnVal[i]->parameterValue = SlapVcoUint32ToString(NULL, pParamValueArray[i].Value->Variant.varUint32);
                    ppReturnVal[i]->type           = ccsp_unsignedLong;
                }

source/util_api/ansc/AnscPlatform/user_time.c:221

  • UserGetSystemTime() mixes seconds from UserGetNtpTime(time()) with sub-second data from clock_gettime(); if the second rolls over between calls, the returned (Second, MilliSecond/MicroSecond) can be inconsistent. Use a single clock_gettime() result for both seconds and nanoseconds.
    time_t          timeNow;
    struct tm       Tm          = {0};
    struct tm       *ptm        = NULL;
    struct timespec elapseTime  = {0};

source/ccsp/components/common/MessageBusHelper/helper/messagebus_interface_utility.c:185

  • For SLAP_CONTENT_TYPE_UNSIGNED_LONG, oldValue is converted via SlapVcoUint32ToString(), which truncates to 32 bits; notifications will publish the wrong value for counters > 2^32-1.
            else if ( pOldValue->ContentType == SLAP_CONTENT_TYPE_UNSIGNED_LONG )
            {
                pParamSignal->oldValue = SlapVcoUint32ToString(NULL, pOldValue->Variant.varUint32);
                pParamSignal->type     = ccsp_unsignedLong;
            }

source/ccsp/components/common/MessageBusHelper/helper/messagebus_interface_utility.c:227

  • For SLAP_CONTENT_TYPE_UNSIGNED_LONG, newValue is converted via SlapVcoUint32ToString(), which truncates to 32 bits; value-change signals will carry incorrect values for counters > 2^32-1.
        if ( pNewValue->Syntax == SLAP_VAR_SYNTAX_uint32 )
        {
            pParamSignal->newValue = SlapVcoUint32ToString(NULL, pNewValue->Variant.varUint32);
            if ( pNewValue->ContentType == SLAP_CONTENT_TYPE_UNSIGNED_LONG )
            {

source/util_api/ansc/AnscPlatform/user_runtime.c:143

  • _ansc_ultoa() divides/modulos by radix without validating it (radix<=1 can crash), and maps digits by adding '0' which produces incorrect output for radix>10 (e.g., hex digits 10-15 become ':'..'?' instead of 'a'..'f').
    while ( result )
    {
        result = result / radix;
        counter++;
    }

source/util_api/ccsp_msg_bus/ccsp_base_api.c:1046

  • Notify_change() takes new_value as void* but formats it with "%s" (string), so non-string callers will crash; also the sprintf_s() return handling is not robust across safeclib vs SAFEC_DUMMY_API implementations (positive error codes in real safeclib won’t be caught).
void Notify_change(char *event_name, void *new_value)
{
    char str[512] = {0};
    parameterValStruct_t notif_val[1];
    char param_name[256] = "Device.NotifyComponent.SetNotifi_ParamName";
  • Files reviewed: 17/17 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment thread source/ccsp/include/ccsp_base_api.h
Comment thread source/util_api/ansc/AnscPlatform/user_time.c
@pradeeptakdas pradeeptakdas changed the title RDKBDEV-3490: common-library support for IP Diagnostics upload download speedtest RDKCOM-5638: RDKBDEV-3490 common-library support for IP Diagnostics upload download speedtest Sep 4, 2026
@AkhilaReddyK7 AkhilaReddyK7 added the community-contribution Contribution from community label Sep 9, 2026
Copilot AI review requested due to automatic review settings September 25, 2026 17:25
@SatishKaluvalapalli
SatishKaluvalapalli force-pushed the RDKBDEV-3490-ip-diagnostics-upload-download-speedtest branch from 888acad to c53ed54 Compare September 25, 2026 17:25
@rdkcmf-jenkins

Copy link
Copy Markdown
Contributor

b'## Blackduck scan failure details

Summary: 0 violations, 0 files pending approval, 1 file pending identification.

  • Protex Server Path: /home/blackduck/github/common-library/134/rdkb/components/opensource/ccsp/CcspCommonLibrary

  • Commit: c53ed54

Report detail: gist'

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment thread source/cosa/include/linux/user_time.h
Comment thread source/util_api/ansc/AnscPlatform/user_runtime.c
Comment thread source/util_api/ansc/include/user_time.h
Comment thread source/cosa/package/slap/include/slap_definitions.h
SatishKaluvalapalli added a commit to SatishKaluvalapalli/common-library that referenced this pull request Sep 25, 2026
Summary: Align USER_SYSTEM_TIME MicroSecond copies, use one clock sample
for system time, initialize LocalTime MicroSecond, radix-guard _ansc_ultoa,
and provide Notify_change stub when USE_NOTIFY_COMPONENT is off.

Problem Description: Copilot review on common-library PR rdkcentral#134 flagged ABI
mismatch on duplicate USER_SYSTEM_TIME headers, second-boundary skew in
UserGetSystemTime, uninitialized MicroSecond in UserGetLocalTime,
Notify_change declared without a non-notify definition, and unsafe
_ansc_ultoa radix handling.

Root Cause: MicroSecond was added only in util/cosa headers; time helpers
mixed two clock samples; Notify_change was ifdef-only; _ansc_ultoa did not
validate radix.

Fix Description:
- Add MicroSecond to debug_api USER_SYSTEM_TIME headers
- Use one clock_gettime sample for calendar + sub-second fields
- Initialize MicroSecond in UserGetLocalTime
- Provide no-op Notify_change stub when USE_NOTIFY_COMPONENT is off
- Reject non-decimal radix in _ansc_ultoa
- Keep Notify_change sprintf_s check as rc < EOK (SAFEC_DUMMY / file style)

Testing Performed: Local code review against callers and safec_lib_common.h;
no functional impact for decimal ULONG path or USE_NOTIFY_COMPONENT builds.

Risk/Known Limitations: Low.

Dependencies/Prerequisites: None beyond existing RDKBDEV-3490 stack.

Security Impact: None.

Jira/References: RDKBDEV-3490, RDKCOM-5638,
rdkcentral#134

MR Link: rdkcentral#134
Copilot AI review requested due to automatic review settings September 25, 2026 18:47
@rdkcmf-jenkins

Copy link
Copy Markdown
Contributor

b'## Blackduck scan failure details

Summary: 0 violations, 0 files pending approval, 1 file pending identification.

  • Protex Server Path: /home/blackduck/github/common-library/134/rdkb/components/opensource/ccsp/CcspCommonLibrary

  • Commit: b53e159

Report detail: gist'

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Unresolved critical ABI-compatibility and uint64 transport issues, plus additional correctness gaps, block approval.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 4 High severity · 4 Medium severity

Open (8)
Resolved since last review (7)
Previously missed (2)

In code that hasn't changed since last review

Medium severity Validate unsigned int against the full uint32 range

source/​ccsp/​components/​common/​MessageBusHelper/​helper/​messagebus_interface_helper.c:162

CcspCcMbi_ValidateINT(..., 0) is used for ccsp_unsignedInt, and the later set path still stores a 32-bit SLAP_VAR_SYNTAX_uint32. Parsing through ULONG therefore rejects valid values above LONG_MAX on ILP32, while accepting values above UINT32_MAX on LP64 and letting the subsequent uint32 conversion truncate them. Validate against the 32-bit unsigned range before this conversion.

Medium severity Add uint64 handling to DSLH parameter setters

source/​cosa/​package/​slap/​services/​dslh/​SlapDslhParamTree/​slap_dslh_paramto_access.c:747

The new getter now produces SLAP_VAR_SYNTAX_uint64, but SlapDslhParamtoSetParamValue still has no SLAP_VAR_SYNTAX_uint64 case and returns its failure status for that value. Consequently, writable unsignedLong parameters sent through this DSLH parameter-tree path cannot be set. Add a uint64/ccsp_unsignedLong serialization case to the setter switch as well.

Comment thread source/ccsp/components/include/dslh_ifo_rvq.h
Comment thread source/ccsp/components/include/dslh_ifo_tr69.h
Comment thread source/cosa/package/slap/include/slap_definitions.h
Comment thread source/util_api/slap/components/SlapVarHelper/slap_vho_variable.c
@rdkcmf-jenkins

Copy link
Copy Markdown
Contributor

b'## WARNING: A Blackduck scan failure has been waived

A prior failure has been upvoted

  • Upvote reason: Approved as match in existing code but BD-1323 for eventual fix

  • Commit: b53e159
    '

…ad speedtest

Reason for change:
Add common-library dependencies required by RDKBDEV-3490 IP Diagnostics
upload/download speedtest improvements in test-and-diagnostic, and complete
the TR-181 unsignedLong → uint64 path so byte counters and related
unsignedLong parameters do not truncate above 4 GB (ILP32) and stay correct
on LP64.

Includes:
- Microsecond precision in UserGetSystemTime
- TR-143 diagnostic struct defaults with Canceled/Error_Internal states
- End-to-end unsignedLong via SLAP uint64 / ULONG64 across DSLH, SLAP,
  and message-bus (StringToUint64 / uint64 set validation where required)
- dm_pack Uint64 accessors (Get/Set/TestParamUint64Value as 30/31/32)
- Notify_change() in ccsp_base_api (USE_NOTIFY_COMPONENT) for
  UploadDownloadSpeedStatus / DiagnosticsState via notify_comp

Conflict resolution (onto RDKBDEV-3490):
Kept RDKBDEV-3490 speedtest helpers; applied datatype/path widening only.
No new product features and no removal of existing speedtest support.

Test Procedure:
Build and deploy with matching test-and-diagnostic and PandM changes.
Trigger upload/download speed tests; verify millisecond TimeBasedTestDuration,
byte counters above 32-bit range, Error_Internal when interface counters are
invalid, and notify_comp receives status updates. dm_pack XML referencing
Uint64 funcs regenerates without KeyError.

Risks:
Low to Medium — shared library datatype/timing/notify updates; must merge
with matching TAD and PandM PRs.

Priority: P2

Signed-off-by: Satish Kaluvalapalli <kaluvalapalli.satish@telekom-digital.com>
Summary: Align USER_SYSTEM_TIME MicroSecond copies, use one clock sample
for system time, initialize LocalTime MicroSecond, radix-guard _ansc_ultoa,
and provide Notify_change stub when USE_NOTIFY_COMPONENT is off.

Problem Description: Copilot review on common-library PR rdkcentral#134 flagged ABI
mismatch on duplicate USER_SYSTEM_TIME headers, second-boundary skew in
UserGetSystemTime, uninitialized MicroSecond in UserGetLocalTime,
Notify_change declared without a non-notify definition, and unsafe
_ansc_ultoa radix handling.

Root Cause: MicroSecond was added only in util/cosa headers; time helpers
mixed two clock samples; Notify_change was ifdef-only; _ansc_ultoa did not
validate radix.

Fix Description:
- Add MicroSecond to debug_api USER_SYSTEM_TIME headers
- Use one clock_gettime sample for calendar + sub-second fields
- Initialize MicroSecond in UserGetLocalTime
- Provide no-op Notify_change stub when USE_NOTIFY_COMPONENT is off
- Reject non-decimal radix in _ansc_ultoa
- Keep Notify_change sprintf_s check as rc < EOK (SAFEC_DUMMY / file style)

Testing Performed: Local code review against callers and safec_lib_common.h;
no functional impact for decimal ULONG path or USE_NOTIFY_COMPONENT builds.

Risk/Known Limitations: Low.

Dependencies/Prerequisites: None beyond existing RDKBDEV-3490 stack.

Security Impact: None.

Jira/References: RDKBDEV-3490, RDKCOM-5638,
rdkcentral#134

MR Link: rdkcentral#134
@tinaelizabeth84
tinaelizabeth84 force-pushed the RDKBDEV-3490-ip-diagnostics-upload-download-speedtest branch from b53e159 to 4973bfc Compare September 28, 2026 16:17
@rdkcmf-jenkins

Copy link
Copy Markdown
Contributor

b'## Blackduck scan failure details

Summary: 0 violations, 0 files pending approval, 1 file pending identification.

  • Protex Server Path: /home/blackduck/github/common-library/134/rdkb/components/opensource/ccsp/CcspCommonLibrary

  • Commit: 4973bfc

Report detail: gist'

@rdkcmf-jenkins

Copy link
Copy Markdown
Contributor

b'## WARNING: A Blackduck scan failure has been waived

A prior failure has been upvoted

  • Upvote reason: As before

  • Commit: 4973bfc
    '

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

Labels

community-contribution Contribution from community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants