-
Notifications
You must be signed in to change notification settings - Fork 2
Feature/appbundle #188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Feature/appbundle #188
Changes from all commits
54e1baf
a8879ff
1939deb
35d0332
624b115
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -24,6 +24,12 @@ jobs: | |||||
| username: ${{ github.actor }} | ||||||
| password: ${{ secrets.GITHUB_TOKEN }} | ||||||
|
|
||||||
| - name: Check out dependent repostiories | ||||||
| uses: actions/checkout@v4 | ||||||
| with: | ||||||
| repository: 'rdkcentral/rdm-agent' | ||||||
| path: rdm-agent | ||||||
|
Comment on lines
+27
to
+31
|
||||||
|
|
||||||
| - name: Set up Docker Buildx | ||||||
| uses: docker/setup-buildx-action@v1 | ||||||
|
|
||||||
|
|
@@ -36,10 +42,18 @@ jobs: | |||||
| run: | | ||||||
| docker run -d --name mockxconf -p 50050:50050 -p 50051:50051 -p 50052:50052 -e ENABLE_MTLS=true -v ${{ github.workspace }}:/mnt/L2_CONTAINER_SHARED_VOLUME ghcr.io/rdkcentral/docker-device-mgt-service-test/mockxconf:latest | ||||||
|
|
||||||
| - name: Copy unknown-accountid-xconf-rfc-response json to mockxconf service | ||||||
|
||||||
| - name: Copy unknown-accountid-xconf-rfc-response json to mockxconf service | |
| - name: Copy xconf-certbundle-response json to mockxconf service |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,5 +1,5 @@ | ||||||||||||||||||||||||||||||
| # Copyright 2023 Comcast Cable Communications Management, LLC | ||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||||||||||||||||
| # you may not use this file except in compliance with the License. | ||||||||||||||||||||||||||||||
| # You may obtain a copy of the License at | ||||||||||||||||||||||||||||||
|
|
@@ -45,7 +45,7 @@ fi | |||||||||||||||||||||||||||||
| #./cov_build.sh | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Compile Test binary for mfrutils | ||||||||||||||||||||||||||||||
| cc -o /usr/bin/mfr_util test/functional-tests/tests/mfrutils.c | ||||||||||||||||||||||||||||||
| cc -o /usr/bin/mfr_util test/functional-tests/tests/mfrutils.c | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| rbuscli setv Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.SWDLSpLimit.Enable boolean true | ||||||||||||||||||||||||||||||
| rbuscli setv Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.SWDLSpLimit.TopSpeed int 1280000 | ||||||||||||||||||||||||||||||
|
|
@@ -117,3 +117,8 @@ echo "==========================================" | |||||||||||||||||||||||||||||
| echo "Image tests report: $RESULT_DIR/rdkfwupdater_image_tests.json" | ||||||||||||||||||||||||||||||
| echo "D-Bus tests report: $RESULT_DIR/rdkfwupdater_dbus_tests.json" | ||||||||||||||||||||||||||||||
| echo "==========================================" | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| cat /opt/logs/swupdate.txt.0 | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| cat /opt/logs/rdm_status.log | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Comment on lines
+121
to
+124
|
||||||||||||||||||||||||||||||
| cat /opt/logs/swupdate.txt.0 | |
| cat /opt/logs/rdm_status.log | |
| if [ -f /opt/logs/swupdate.txt.0 ]; then | |
| cat /opt/logs/swupdate.txt.0 | |
| else | |
| echo "Log file /opt/logs/swupdate.txt.0 not found." | |
| fi | |
| if [ -f /opt/logs/rdm_status.log ]; then | |
| cat /opt/logs/rdm_status.log | |
| else | |
| echo "Log file /opt/logs/rdm_status.log not found." | |
| fi |
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -187,7 +187,7 @@ size_t GetPDRIFileName( char *pPDRIFilename, size_t szBufSize ) | |||||||
| RETURN - number of characters copied to the output buffer. | ||||||||
| */ | ||||||||
|
|
||||||||
| size_t GetInstalledBundles(char *pBundles, size_t szBufSize) | ||||||||
| size_t GetInstalledBundles(char *pBundles, size_t szBufSize, const char *bundleType) | ||||||||
| { | ||||||||
| JSON *pJsonTop; | ||||||||
| JSON *pJson; | ||||||||
|
|
@@ -199,7 +199,8 @@ size_t GetInstalledBundles(char *pBundles, size_t szBufSize) | |||||||
| if (pBundles != NULL) | ||||||||
| { | ||||||||
| *pBundles = 0; | ||||||||
| installedBundleListNode = getInstalledBundleFileList(); | ||||||||
| SWLOG_INFO("GetInstalledBundles: Invoking getInstalledBundleFileList to get %s bundle list ",bundleType); | ||||||||
|
||||||||
| SWLOG_INFO("GetInstalledBundles: Invoking getInstalledBundleFileList to get %s bundle list ",bundleType); | |
| SWLOG_INFO("GetInstalledBundles: Invoking getInstalledBundleFileList to get %s bundle list ", | |
| (bundleType ? bundleType : "<null>")); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -143,9 +143,11 @@ size_t GetPDRIFileName(char *pPDRIFilename, size_t szBufSize); | |
|
|
||
| szBufSize - the size of the character buffer in argument 1. | ||
|
|
||
| bundleType - type of the bundle. | ||
|
|
||
| RETURN - number of characters copied to the output buffer. | ||
| */ | ||
| size_t GetInstalledBundles(char *pBundles, size_t szBufSize); | ||
| size_t GetInstalledBundles(char *pBundles, size_t szBufSize, const char *bundleType); | ||
|
Comment on lines
143
to
+150
|
||
| /* function GetPartnerId - gets the partner ID of the device. | ||
|
|
||
| Usage: size_t GetPartnerId <char *pPartnerId> <size_t szBufSize> | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -42,11 +42,15 @@ int v_secure_pclose(FILE *fp); | |||||||||
| #include <dirent.h> | ||||||||||
|
|
||||||||||
| #ifndef GTEST_ENABLE | ||||||||||
| #define BUNDLE_METADATA_NVM_PATH "/media/apps/etc/certs" | ||||||||||
| #define BUNDLE_METADATA_RFS_PATH "/etc/certs" | ||||||||||
| #define BUNDLE_METADATA_NVM_CERT_PATH "/media/apps/etc/certs" | ||||||||||
| #define BUNDLE_METADATA_RFS_CERT_PATH "/etc/certs" | ||||||||||
| #define BUNDLE_METADATA_NVM_APPS_PATH "/media/apps/etc/apps" | ||||||||||
| #define BUNDLE_METADATA_RFS_APPS_PATH "/etc/apps" | ||||||||||
| #else | ||||||||||
| #define BUNDLE_METADATA_NVM_PATH "/tmp/certs" | ||||||||||
| #define BUNDLE_METADATA_RFS_PATH "/tmp/rfc/certs" | ||||||||||
| #define BUNDLE_METADATA_NVM_CERT_PATH "/tmp/certs" | ||||||||||
| #define BUNDLE_METADATA_RFS_CERT_PATH "/tmp/rfc/certs" | ||||||||||
| #define BUNDLE_METADATA_NVM_APPS_PATH "/media/apps/etc/apps" | ||||||||||
| #define BUNDLE_METADATA_RFS_APPS_PATH "/etc/apps" | ||||||||||
|
Comment on lines
+52
to
+53
|
||||||||||
| #define BUNDLE_METADATA_NVM_APPS_PATH "/media/apps/etc/apps" | |
| #define BUNDLE_METADATA_RFS_APPS_PATH "/etc/apps" | |
| #define BUNDLE_METADATA_NVM_APPS_PATH "/tmp/apps" | |
| #define BUNDLE_METADATA_RFS_APPS_PATH "/tmp/rfc/apps" |
Copilot
AI
Feb 23, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dlAppBundle handling is introduced here, but current unit tests only cover cert bundle discovery/parsing. Please add/extend gtests to cover dlAppBundle path selection and metadata parsing (NVM/RFS) and unknown bundleType handling.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -208,14 +208,22 @@ size_t createJsonString( char *pPostFieldOut, size_t szPostFieldOut ) | |
| remainlen = szPostFieldOut - totlen; | ||
| totlen += snprintf( (pTmpPost + totlen), remainlen, "localtime=%s", tmpbuf ); | ||
| } | ||
| len = GetInstalledBundles( tmpbuf, sizeof(tmpbuf) ); | ||
| len = GetInstalledBundles( tmpbuf, sizeof(tmpbuf), "dlCertBundle" ); | ||
| if( totlen ) | ||
| { | ||
| *(pTmpPost + totlen) = '&'; | ||
| ++totlen; | ||
| } | ||
| remainlen = szPostFieldOut - totlen; | ||
| totlen += snprintf( (pTmpPost + totlen), remainlen, "dlCertBundle=%s", tmpbuf ); | ||
| len = GetInstalledBundles( tmpbuf, sizeof(tmpbuf), "dlAppBundle" ); | ||
| if( totlen ) | ||
| { | ||
| *(pTmpPost + totlen) = '&'; | ||
| ++totlen; | ||
| } | ||
| remainlen = szPostFieldOut - totlen; | ||
| totlen += snprintf( (pTmpPost + totlen), remainlen, "dlAppBundle=%s", tmpbuf ); | ||
|
Comment on lines
+219
to
+226
|
||
| len = GetRdmManifestVersion( tmpbuf, sizeof(tmpbuf) ); | ||
| if( totlen ) | ||
| { | ||
|
|
@@ -272,6 +280,7 @@ int getXconfRespData( XCONFRES *pResponse, char *pJsonStr ) | |
| GetJsonValContaining( pJson, "remCtrl", pResponse->peripheralFirmwares, sizeof(pResponse->peripheralFirmwares) ); | ||
| t2ValNotify("SYST_INFO_PRXR_Ver_split", pResponse->peripheralFirmwares); | ||
| GetJsonVal( pJson, "dlCertBundle", pResponse->dlCertBundle, sizeof(pResponse->dlCertBundle) ); | ||
| GetJsonVal( pJson, "dlAppBundle", pResponse->dlAppBundle, sizeof(pResponse->dlAppBundle) ); | ||
| strncmp(pResponse->dlCertBundle, "lxyupdate-bundle:", 17)?1:t2ValNotify("lxybundleversion_split", pResponse->dlCertBundle + 17); | ||
| GetJsonVal( pJson, "rdmCatalogueVersion", pResponse->rdmCatalogueVersion, sizeof(pResponse->rdmCatalogueVersion) ); | ||
| GetJsonVal( pJson, "ipv6FirmwareLocation", pResponse->ipv6cloudFWLocation, sizeof(pResponse->ipv6cloudFWLocation) ); | ||
|
|
@@ -334,6 +343,7 @@ int processJsonResponse(XCONFRES *response, const char *myfwversion, const char | |
| SWLOG_INFO("cloudImmediateRebootFlag: %s\n", response->cloudImmediateRebootFlag); | ||
| SWLOG_INFO("peripheralFirmwares: %s\n", response->peripheralFirmwares); | ||
| SWLOG_INFO("dlCertBundle: %s\n", response->dlCertBundle); | ||
| SWLOG_INFO("dlAppBundle: %s\n", response->dlAppBundle); | ||
| SWLOG_INFO("cloudPDRIVersion: %s\n", response->cloudPDRIVersion); | ||
| SWLOG_INFO("rdmCatalogueVersion: %s\n", response->rdmCatalogueVersion); | ||
|
|
||
|
|
@@ -350,17 +360,41 @@ int processJsonResponse(XCONFRES *response, const char *myfwversion, const char | |
| fprintf( fp, "%s\n", response->rdmCatalogueVersion ); | ||
| fclose( fp ); | ||
| } | ||
| if (response->dlCertBundle[0] != 0) { | ||
| if (response->dlCertBundle[0] != 0 || response->dlAppBundle[0] != '\0') { | ||
| SWLOG_INFO("Calling rdm Versioned_app download to process bundle update\n"); | ||
| if (access("/usr/bin/rdm", F_OK) == 0) { | ||
|
|
||
| char dlBundle[1024] = {0}; | ||
| size_t available = sizeof(dlBundle); | ||
|
|
||
| if (response->dlCertBundle[0] != '\0') { | ||
| int retval = snprintf(dlBundle, available, "dlCertBundle=%s", response->dlCertBundle); | ||
| if (retval < 0 || retval >= available) { | ||
| SWLOG_ERROR("dlCertBundle string too long, truncation occurred\n"); | ||
| return ret; | ||
| } | ||
| } | ||
|
|
||
| if (response->dlAppBundle[0] != '\0') { | ||
| size_t current_len = strlen(dlBundle); | ||
| available = sizeof(dlBundle) - current_len; | ||
|
|
||
| int retval; | ||
| if (dlBundle[0] != '\0') { | ||
| retval = snprintf(dlBundle + current_len, available, "|dlAppBundle=%s", response->dlAppBundle); | ||
| } else { | ||
| retval = snprintf(dlBundle + current_len, available, "dlAppBundle=%s", response->dlAppBundle); | ||
| } | ||
|
|
||
| if (retval < 0 || retval >= available) { | ||
| SWLOG_ERROR("dlAppBundle string too long, truncation occurred\n"); | ||
| return ret; | ||
| } | ||
| } | ||
|
|
||
| if ((access("/usr/bin/rdm", F_OK) == 0) && (strlen(dlBundle) > 0)) { | ||
| // file exists | ||
| SWLOG_INFO("RDM binary is present\n"); | ||
| v_secure_system("rdm -v \"%s\" >> /opt/logs/rdm_status.log 2>&1", response->dlCertBundle); | ||
| SWLOG_INFO("RDM Versioned app Download started and completed\n"); | ||
| } else if (access("/etc/rdm/rdmBundleMgr.sh", F_OK) == 0) { | ||
| // Script file exist | ||
| SWLOG_INFO("RDM binary is not present, using scripts\n"); | ||
| v_secure_system("sh /etc/rdm/rdmBundleMgr.sh '%s' '%s' >> /opt/logs/rdm_status.log 2>&1", response->dlCertBundle, response->cloudFWLocation); | ||
| v_secure_system("rdm -v \"%s\" >> /opt/logs/rdm_status.log 2>&1", dlBundle); | ||
| SWLOG_INFO("RDM Versioned app Download started and completed\n"); | ||
|
Comment on lines
+394
to
398
|
||
| } else { | ||
| // file doesn't exist | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {"additionalFwVerInfo":"ABCD_PDRI_firmware_test","firmwareDownloadProtocol":"http","firmwareFilename":"ABCD_firmware_test.bin","firmwareLocation":"https://mockxconf:50052/getfirmwarefile/","firmwareVersion":"ABCD_firmware_test","rebootImmediately":false,"remCtrlAB11-20":"AB11-20_firmware_5103.3.4","dlCertBundle":"ca-store-update-bundle:0.1","dlAppBundle" : "XApp:1.0, YApp:2.0"} |
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -205,7 +205,7 @@ extern "C" size_t GetUTCTime( char *pUTCTime, size_t szBufSize ) | |||||||||||||||
| return g_DeviceStatusMock->GetUTCTime(pUTCTime, szBufSize); | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| extern "C" size_t GetInstalledBundles(char *pBundles, size_t szBufSize) | ||||||||||||||||
| extern "C" size_t GetInstalledBundles(char *pBundles, size_t szBufSize, const char *bundleType) | ||||||||||||||||
| { | ||||||||||||||||
| if (!g_DeviceStatusMock) | ||||||||||||||||
| { | ||||||||||||||||
|
|
@@ -214,7 +214,7 @@ extern "C" size_t GetInstalledBundles(char *pBundles, size_t szBufSize) | |||||||||||||||
| } | ||||||||||||||||
|
||||||||||||||||
| } | |
| } | |
| if (!pBundles || szBufSize == 0) | |
| { | |
| cout << "GetInstalledBundles invalid buffer" << endl; | |
| return 0; | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling: step name says "repostiories". Rename it to "repositories" to avoid confusion in workflow logs.