Skip to content
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

Fix DPS docker containers log configuration #642

Merged
merged 1 commit into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docker-build-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
file: docker/apps/Dockerfile.dps-cloud-server
- name: dps-cloud-server-debug
build_type: Debug
build_args: -DOC_DEBUG_ENABLED=ON -DOC_LOG_MAXIMUM_LOG_LEVEL=DEBUG -DPLGD_DEV_DEVICE_PROVISIONING_TEST_PROPERTIES_ENABLED=ON
build_args: -DOC_DEBUG_ENABLED=ON -DOC_LOG_MAXIMUM_LOG_LEVEL=DEBUG -DPLGD_DEV_DEVICE_PROVISIONING_MAXIMUM_LOG_LEVEL=DEBUG -DPLGD_DPS_CLOUD_SERVER_DBG_ENABLED=ON -DPLGD_DEV_DEVICE_PROVISIONING_TEST_PROPERTIES_ENABLED=ON
file: docker/apps/Dockerfile.dps-cloud-server
uses: ./.github/workflows/docker-build-publish-with-cfg.yml
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/plgd-dps-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
uses: ./.github/workflows/plgd-dps-test-with-cfg.yml
with:
args: ${{ matrix.args || '' }}
build_args: -DOC_DEBUG_ENABLED=ON -DPLGD_DPS_MAXIMUM_LOG_LEVEL=TRACE -DPLGD_DPS_CLOUD_SERVER_DBG_ENABLED=ON ${{ matrix.build_args }}
build_args: -DOC_DEBUG_ENABLED=ON -DPLGD_DEV_DEVICE_PROVISIONING_MAXIMUM_LOG_LEVEL=TRACE -DPLGD_DEV_DEVICE_PROVISIONING_TEST_PROPERTIES_ENABLED=ON -DPLGD_DPS_CLOUD_SERVER_DBG_ENABLED=ON ${{ matrix.build_args }}
build_type: ${{ (github.event_name == 'workflow_dispatch' && inputs.build_type) || 'Debug' }}
docker_file: ${{ matrix.docker_file || 'docker/apps/Dockerfile.dps-cloud-server-debug' }}
skip: ${{ matrix.skip || false }}
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,11 @@ if(PLGD_DEV_DEVICE_PROVISIONING_ENABLED)
endif()
list(APPEND PUBLIC_COMPILE_DEFINITIONS "PLGD_DEV_DEVICE_PROVISIONING")

set(PLGD_DPS_MAXIMUM_LOG_LEVEL "DISABLED" CACHE STRING "Maximum supported Plgd DPS log level in compile time.")
set(PLGD_DPS_MAXIMUM_LOG_LEVEL_INT)
oc_set_maximum_log_level("${PLGD_DPS_MAXIMUM_LOG_LEVEL}" PLGD_DPS_MAXIMUM_LOG_LEVEL_INT)
list(APPEND PRIVATE_COMPILE_DEFINITIONS "PLGD_DPS_LOG_MAXIMUM_LEVEL=(${PLGD_DPS_MAXIMUM_LOG_LEVEL_INT})")
list(APPEND TEST_COMPILE_DEFINITIONS "PLGD_DPS_LOG_MAXIMUM_LEVEL=(${PLGD_DPS_MAXIMUM_LOG_LEVEL_INT})")
set(PLGD_DEV_DEVICE_PROVISIONING_MAXIMUM_LOG_LEVEL "DISABLED" CACHE STRING "Maximum supported Plgd DPS log level in compile time.")
set(PLGD_DEV_DEVICE_PROVISIONING_MAXIMUM_LOG_LEVEL_INT)
oc_set_maximum_log_level("${PLGD_DEV_DEVICE_PROVISIONING_MAXIMUM_LOG_LEVEL}" PLGD_DEV_DEVICE_PROVISIONING_MAXIMUM_LOG_LEVEL_INT)
list(APPEND PRIVATE_COMPILE_DEFINITIONS "PLGD_DPS_LOG_MAXIMUM_LEVEL=(${PLGD_DEV_DEVICE_PROVISIONING_MAXIMUM_LOG_LEVEL_INT})")
list(APPEND TEST_COMPILE_DEFINITIONS "PLGD_DPS_LOG_MAXIMUM_LEVEL=(${PLGD_DEV_DEVICE_PROVISIONING_MAXIMUM_LOG_LEVEL_INT})")
endif()

if(PLGD_DEV_DEVICE_PROVISIONING_TEST_PROPERTIES_ENABLED)
Expand Down
4 changes: 3 additions & 1 deletion api/plgd/device-provisioning-client/plgd_dps_apis.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "util/oc_macros_internal.h"

#include <assert.h>
#include <inttypes.h>
#include <string.h>

bool
Expand Down Expand Up @@ -82,7 +83,8 @@ dps_reset_delayed_callback_ms(void *cb_data, oc_trigger_t callback,
#define MILLISECONDS_IN_SECONDS 1000
#define OC_CLOCK_MILLISECOND (OC_CLOCK_SECOND / MILLISECONDS_IN_SECONDS)
if (oc_clock_time_max / OC_CLOCK_MILLISECOND < milliseconds) {
DPS_DBG("delayed callback interval truncated to %lu", oc_clock_time_max);
DPS_DBG("delayed callback interval truncated to %" PRIu64,
oc_clock_time_max);
milliseconds = oc_clock_time_max / OC_CLOCK_MILLISECOND;
}
oc_clock_time_t interval = milliseconds * OC_CLOCK_MILLISECOND;
Expand Down
6 changes: 3 additions & 3 deletions api/plgd/device-provisioning-client/plgd_dps_pki.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ dps_pki_validate_certificate(dps_pki_configuration_t cfg, uint64_t valid_from,
}

uint64_t now_s = now / OC_CLOCK_SECOND;
DPS_DBG(
"\tcheck certificate validity: now=%lu from=%lu to=%lu expiring_limit:%u",
now_s, valid_from, valid_to, (unsigned)cfg.expiring_limit);
DPS_DBG("\tcheck certificate validity: now=%" PRIu64 " from=%" PRIu64
" to=%" PRIu64 " expiring_limit:%u",
now_s, valid_from, valid_to, (unsigned)cfg.expiring_limit);
if (now_s < valid_from) {
return DPS_CERTIFICATE_NOT_YET_VALID;
}
Expand Down
4 changes: 3 additions & 1 deletion api/plgd/device-provisioning-client/plgd_dps_security.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "security/oc_tls_internal.h"

#include <assert.h>
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
Expand Down Expand Up @@ -388,7 +389,8 @@ dps_check_credentials(const plgd_dps_context_t *ctx,
if (!all_valid || !has_identity || !has_trust_anchor) {
return false;
}
DPS_DBG("earliest expiring certificate(valid-from: %lu, valid-to: %lu)",
DPS_DBG("earliest expiring certificate(valid-from: %" PRIu64
", valid-to: %" PRIu64 ")",
valid_from, valid_to);
if (min_validity != NULL) {
min_validity->valid_from = valid_from;
Expand Down
3 changes: 1 addition & 2 deletions docker/apps/Dockerfile.dps-cloud-server-debug
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ RUN mkdir build && \
cd build && \
cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DOC_CLOUD_ENABLED=ON \
-DOC_COLLECTIONS_IF_CREATE_ENABLED=ON -DOC_OSCORE_ENABLED=OFF -DOC_DISCOVERY_RESOURCE_OBSERVABLE_ENABLED=ON \
-DOC_DEBUG_ENABLED=ON -DPLGD_DEV_TIME_ENABLED=ON -DPLGD_DEV_DEVICE_PROVISIONING_ENABLED=ON \
-DPLGD_DEV_DEVICE_PROVISIONING_TEST_PROPERTIES_ENABLED=ON -DBUILD_TESTING=ON ${BUILD_ARGS} .. && \
-DPLGD_DEV_TIME_ENABLED=ON -DPLGD_DEV_DEVICE_PROVISIONING_ENABLED=ON -DBUILD_TESTING=ON ${BUILD_ARGS} .. && \
cmake --build . --target mbedtls mbedx509 mbedcrypto && \
cmake --build . -j$(nproc) --target dps_cloud_server && \
cp /device-provisioning-client/build/apps/dps_cloud_server /dps/
Expand Down
Loading