Skip to content

Release/2.2.0#41

Closed
tdeva14 wants to merge 3 commits into
mainfrom
release/2.2.0
Closed

Release/2.2.0#41
tdeva14 wants to merge 3 commits into
mainfrom
release/2.2.0

Conversation

@tdeva14
Copy link
Copy Markdown
Contributor

@tdeva14 tdeva14 commented Apr 25, 2026

No description provided.

Copilot AI review requested due to automatic review settings April 25, 2026 02:22
Copy link
Copy Markdown
Contributor

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

This PR migrates reboot-reason “bootup” processing from the legacy reboot-checker.sh/systemd flow into C, and replaces RBUS-based RFC parameter access with RFCAPI helpers across the reboot-manager components.

Changes:

  • Add bootup_reason_checker.c to implement previous-log discovery + legacy log parsing + PreviousReboot* field update in C, and wire it into rebootreason_main.c.
  • Replace RBUS TR-181 access with RFCAPI-backed helpers (rfc_get_* / rfc_set_*) and remove RBUS interface code/tests/build dependencies.
  • Update unit/functional tests and build scripts to reflect removed flags/scripts and the new RFC path.

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
unittest/system_cleanup_gtest.cpp Removes Bluetooth-service branch tests and related system() simulation flags.
unittest/rfc_interface_gtest.cpp Adds new gtest suite validating RFC helper wrappers implemented in utils.c.
unittest/reboot_main_gtest.cpp Updates stubs from RBUS param helpers to RFCAPI (getRFCParameter/setRFCParameter) mocks.
unittest/reboot_log_parser_gtest.cpp Updates device-property parsing expectations and adds unit tests for previous-log discovery + legacy parsing.
unittest/rbus_interface_gtest.cpp Removes RBUS interface unit tests (file deleted).
unittest/mocks/rfcapi_stub.c Adds RFCAPI stub for tests that need link-time getRFCParameter/setRFCParameter.
unittest/mocks/rfc_mock_types.h Adds minimal RFCAPI type definitions for unit-test builds.
unittest/mocks/rbus_mock_types.h Removes RBUS mock types header (file deleted).
unittest/cyclic_reboot_gtest.cpp Renames mocked param access from rbus_* to rfc_* for cyclic reboot tests.
unittest/Makefile.am Switches test programs to RFC, forces include of RFC mock types, updates sources and link inputs.
unit_test.sh Removes RBUS gtest execution (but currently does not add RFC gtest execution).
tests/functional_tests/test/test_scenario_update_prev_reboot_skips_when_flags_missing.py Updates functional scenario to remove checks for invocation/updated flags.
tests/functional_tests/test/test_scenario_update_prev_reboot_service_flow_after_stt_flag.py Removes assertions for removed flags; keeps previousreboot file assertion.
tests/functional_tests/test/test_scenario_update_prev_reboot_generates_previous_files_and_flags.py Removes assertions for removed flags; validates output files only.
tests/functional_tests/test/reboot_reason_test_common.py Removes exported constants for removed flags.
tests/functional_tests/test/conftest.py Simplifies flag setup/cleanup to only use /tmp/stt_received.
services/reboot-reason-logger.service Removes the legacy systemd oneshot service (file deleted).
scripts/reboot-checker.sh Removes the legacy reboot-checker shell script (file deleted).
reboot-reason-fetcher/src/rebootreason_main.c Adds call to update PreviousReboot* fields and removes invocation-flag creation.
reboot-reason-fetcher/src/log_parser.c Removes PLATCO/LLAMA flags and removes in-file legacy log parsing (moved).
reboot-reason-fetcher/src/bootup_reason_checker.c New C implementation of previous-log discovery, legacy log parsing, and PreviousReboot* update.
reboot-reason-fetcher/include/update-reboot-info.h Removes PLATCO/LLAMA fields and adds declarations for new bootup checker helpers.
reboot-helper/src/utils.c Adds RFCAPI-backed TR-181 helper functions (rfc_get_*/rfc_set_*).
reboot-helper/src/system_cleanup.c Drops RBUS include dependency.
reboot-helper/src/rebootmgr_rbus_interface.c Removes RBUS interface implementation (file deleted).
reboot-helper/src/reboot_main.c Removes RBUS init/cleanup, switches manageable notification to RFC helpers, and changes parodus file write behavior.
reboot-helper/src/cyclic_reboot.c Switches cyclic reboot RFC reads/writes from RBUS to RFC helpers.
reboot-helper/src/Makefile.am Removes RBUS sources/libs and links against -lrfcapi; includes new bootup checker in update-prev-reboot-info build.
reboot-helper/include/rebootmgr_rbus_interface.h Removes RBUS interface header (file deleted).
reboot-helper/include/reboot.h Adds RFC parameter constants and declares RFC helper APIs; includes rfcapi.h in non-test builds.
docs/reboot-reason-fetcher/Reboot_checker_mig.md Adds migration documentation for reboot-checker.sh bootup logic to C.
docs/reboot-reason-fetcher/HLD.md Updates HLD to reflect new modules, dataflow, and bootup checker implementation details.
Makefile.am Removes RBUS interface header from installed include headers.
CHANGELOG.md Adds 2.2.0 entry describing reboot-checker migration and RBUS/shell dependency removal.
Comments suppressed due to low confidence (1)

unit_test.sh:39

  • unit_test.sh no longer runs the newly built reboot_rfc_gtest binary (Makefile.am switched from reboot_rbus_gtest to reboot_rfc_gtest). This means RFC helper tests won’t execute in the unit-test runner; add ./reboot_rfc_gtest to the test loop to keep coverage parity.
for test in \
  ./reboot_utils_gtest \
  ./reboot_cyclic_gtest \
  ./reboot_system_gtest \
  ./reboot_main_gtest \
  ./reboot_json_gtest \
  ./reboot_parodus_gtest \
  ./reboot_log_parser_gtest \
  ./reboot_classify_gtest \
  ./rebootreason_main_gtest

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}
}

if (update_previous_reboot_log_fields(has_reboot_info ? PREVIOUS_REBOOT_INFO_FILE : NULL, &rebootInfo) != SUCCESS) {
Comment on lines +454 to +471
if (jsonPath && access(jsonPath, F_OK) == 0) {
RDK_LOG(RDK_LOG_DEBUG, "LOG.RDK.REBOOTINFO", "Reading previous boot info from JSON: %s\n", jsonPath);
json_fp = fopen(jsonPath, "r");
if (json_fp) {
size_t n = fread(buf, 1, sizeof(buf) - 1, json_fp);
fclose(json_fp);
buf[n] = '\0';

// Extract JSON values from PREVIOUS boot's reboot info
extract_json_value(buf, "timestamp", infoToUse.timestamp, sizeof(infoToUse.timestamp));
extract_json_value(buf, "source", infoToUse.source, sizeof(infoToUse.source));
extract_json_value(buf, "reason", infoToUse.reason, sizeof(infoToUse.reason));
extract_json_value(buf, "customReason", infoToUse.customReason, sizeof(infoToUse.customReason));
extract_json_value(buf, "otherReason", infoToUse.otherReason, sizeof(infoToUse.otherReason));

RDK_LOG(RDK_LOG_INFO, "LOG.RDK.REBOOTINFO", "Loaded previous boot info - Source: %s, Reason: %s\n",
infoToUse.source, infoToUse.reason);
loaded_previous_info = true;
Comment on lines +481 to +513
if (!loaded_previous_info) {
if (find_previous_reboot_log(prev_log_path, sizeof(prev_log_path)) == SUCCESS) {
if (parse_legacy_log(prev_log_path, &infoToUse) == SUCCESS) {
loaded_previous_info = true;
RDK_LOG(RDK_LOG_INFO, "LOG.RDK.REBOOTINFO", "Loaded previous boot info from legacy log: %s\n", prev_log_path);
} else {
RDK_LOG(RDK_LOG_WARN, "LOG.RDK.REBOOTINFO", "Failed to parse legacy reboot log: %s\n", prev_log_path);
}
} else {
RDK_LOG(RDK_LOG_DEBUG, "LOG.RDK.REBOOTINFO", "No previous reboot log available for fallback\n");
}
}

if (load_previous_reboot_reason_line(previousReason, sizeof(previousReason)) != SUCCESS) {
previousReason[0] = '\0';
}

fp = fopen(REBOOT_INFO_LOG_FILE, "w");
if (!fp) {
RDK_LOG(RDK_LOG_ERROR, "LOG.RDK.REBOOTINFO", "Failed to open %s for PreviousReboot fields: %s\n", REBOOT_INFO_LOG_FILE, strerror(errno));
return ERROR_GENERAL;
}

(void)write_previous_line(fp, "PreviousRebootReason", previousReason);
(void)write_previous_line(fp, "PreviousRebootInitiatedBy", infoToUse.source);
(void)write_previous_line(fp, "PreviousRebootTime", infoToUse.timestamp);
(void)write_previous_line(fp, "PreviousCustomReason", infoToUse.customReason);
(void)write_previous_line(fp, "PreviousOtherReason", infoToUse.otherReason);
fflush(fp);
fclose(fp);

RDK_LOG(RDK_LOG_INFO, "LOG.RDK.REBOOTINFO", "Updated PreviousReboot* fields in %s\n", REBOOT_INFO_LOG_FILE);
return SUCCESS;
@tdeva14 tdeva14 closed this Apr 25, 2026
@tdeva14 tdeva14 deleted the release/2.2.0 branch April 25, 2026 05:52
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 25, 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.

4 participants