Skip to content

RDKEMW-17125 - Subscribe to NWMgr plugin events from systimemgr#72

Merged
tdeva14 merged 78 commits into
developfrom
topic/NWStatusMonitor
May 14, 2026
Merged

RDKEMW-17125 - Subscribe to NWMgr plugin events from systimemgr#72
tdeva14 merged 78 commits into
developfrom
topic/NWStatusMonitor

Conversation

@sindhu-krishnan
Copy link
Copy Markdown
Contributor

@sindhu-krishnan sindhu-krishnan commented Apr 30, 2026

To manage the Deepsleep and Network Outage events in chronyd, it is essential to monitor the Network Up event, as it is relevant to all network-related events.
Subscribe to the "onInternetStatusChange" event of the NetworkMgr plugin and handle the cases according to the specific requirements.

Test Results available in - https://ccp.sys.comcast.net/browse/RDKEMW-17125

sindhu-krishnan and others added 30 commits April 22, 2026 14:01
- Fix missing WPEFramework includes that caused 'not a namespace-name'
  and 'JsonObject does not name a type' errors
- Move WPEFramework includes exclusively to .cpp to avoid include path
  issues when header is included from other translation units
- Move internal state (controller, thunder_client, m_networkeventsubscribed)
  to file-scope statics with internal linkage
- Convert internal helper functions (subscribeToInternetEvent,
  unsubscribeFromInternetEvent, plugin_statechange) to static free
  functions - not part of the class interface
- Remove global thunder_ret, use local variable instead
- Remove explicit constructor declaration - compiler-generated default
  is sufficient; destructor handles RAII cleanup on process exit
Two bugs fixed:

1. Use versioned callsign for thunder_client
   NETWORK_MANAGER_CALLSIGN ('org.rdk.NetworkManager') was used to
   create the LinkType for subscribing to onInternetStatusChange, but
   the versioned callsign NETWORK_MANAGER_PLUGIN ('org.rdk.NetworkManager.1')
   is required for JSONRPC endpoint resolution. Using the unversioned
   callsign caused ERROR_TIMEDOUT (11) on every subscription attempt.

2. Attempt immediate subscription at startup
   After subscribing to the controller statechange event, try
   subscribeToInternetEvent() immediately. If NetworkManager is already
   active when systimemgr starts or restarts, no statechange event is
   fired, so the callback-driven subscription never happens. The
   immediate attempt handles this case; if it fails (plugin not up yet),
   the statechange callback will retry on the next activation.
…ents

Add consistent 'CHRONY:' prefix to all RDK_LOG statements in
networkstatussrc.cpp for easy log filtering with:
  grep CHRONY /opt/logs/systimemgr.log

Also remove stale debug log that printed internetStatus before it
was populated, which always printed an empty string.
Comment thread systimerfactory/networkstatussrc.cpp Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.

Comment thread test/functional-tests/tests/test_systimemgr_nwstatus.py
Comment thread systimerfactory/networkstatussrc.cpp
Comment thread systimerfactory/networkstatussrc.cpp
Comment thread systimemgr.cpp
@github-actions
Copy link
Copy Markdown

Code Coverage Summary

                                        Total:|75.5%   759|85.5%  62|    -    0

Comment thread systimerfactory/networkstatussrc.cpp Outdated
Comment thread systimerfactory/networkstatussrc.cpp Outdated
* after the last NetworkStatusSrc destructor runs. */
NetworkStatusSrc::NetworkStatusSrc()
{
sharedState(); /* force initialisation — return value intentionally unused */
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.

Coverity Issue - Useless call

Calling "sharedState()" is only useful for its return value, which is ignored.

Medium Impact, CWE-none
USELESS_CALL

@github-actions
Copy link
Copy Markdown

Code Coverage Summary

                                        Total:|75.5%   759|85.5%  62|    -    0

Comment thread systimerfactory/networkstatussrc.cpp Outdated
* always blocking for the full ACTIVATION_RETRY_INTERVAL_MS. */
{
std::unique_lock<std::mutex> lock(sharedState().mutex);
sharedState().cv.wait_for(lock,
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.

Coverity Issue - Data race condition

A wait is performed without a loop. If there is a spurious wakeup, the condition may not be satisfied. [Note: The source code implementation of the function has been overridden by a builtin model.]

Medium Impact, CWE-none
BAD_CHECK_OF_WAIT_COND

How to fix

Check the wait condition in a loop, with the lock held. The lock must not be released between the condition and the wait.

Comment thread systimerfactory/networkstatussrc.cpp Outdated
* after the last NetworkStatusSrc destructor runs. */
NetworkStatusSrc::NetworkStatusSrc()
{
sharedState(); /* force initialisation — return value intentionally unused */
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.

Coverity Issue - Useless call

Calling "sharedState()" is only useful for its return value, which is ignored.

Medium Impact, CWE-none
USELESS_CALL

Copilot AI review requested due to automatic review settings May 14, 2026 06:30
@github-actions
Copy link
Copy Markdown

Code Coverage Summary

                                        Total:|75.5%   759|85.5%  62|    -    0

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.

Comment thread systimerfactory/Makefile.am
Comment thread test/functional-tests/tests/test_systimemgr_nwstatus.py
Comment thread test/functional-tests/tests/test_systimemgr_nwstatus.py
Comment thread systimerfactory/networkstatussrc.cpp Outdated
Comment thread cov_build.sh Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 14, 2026 06:43
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

Code Coverage Summary

                                        Total:|75.5%   759|85.5%  62|    -    0

1 similar comment
@github-actions
Copy link
Copy Markdown

Code Coverage Summary

                                        Total:|75.5%   759|85.5%  62|    -    0

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Comment thread test/functional-tests/tests/test_systimemgr_nwstatus.py
Comment thread systimerfactory/networkstatussrc.cpp Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 14, 2026 11:32
@github-actions
Copy link
Copy Markdown

Code Coverage Summary

                                        Total:|75.5%   759|85.5%  62|    -    0

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Comment thread test/functional-tests/tests/test_systimemgr_nwstatus.py
Comment thread systimerfactory/networkstatussrc.cpp
Copy link
Copy Markdown
Contributor

@tdeva14 tdeva14 left a comment

Choose a reason for hiding this comment

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

LGTM

@tdeva14 tdeva14 merged commit 82e5dea into develop May 14, 2026
16 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants