Compare commits

...

6 Commits

Author SHA1 Message Date
Sadhyama Vengilat
6952647ce3 Subscribe to CurrentActiveInterfaceEvent before initial cloud connection 2023-02-24 12:39:41 +05:30
shilpa24balaji
c1fc8d877b Merge pull request #409 from shilpa24balaji/rbus
Use rdkcentral RBUS repo & resolve dependencies
2022-12-06 23:10:36 +05:30
Shilpa Seshadri
581d7fc966 Unit test fixes 2022-11-18 18:28:40 +05:30
Shilpa Seshadri
0673d2624e Use rdkcentral RBUS repo & resolve dependencies 2022-11-11 21:08:03 +05:30
shilpa24balaji
0f82e7c2d9 Merge pull request #408 from vasuki01/seriallog
Serial-number configuration incorrect in parodus log
2022-11-03 16:51:10 +05:30
Vasuki
4acf7f63ba Serial-number configuration incorrect in parodus log 2022-11-02 15:10:57 +05:30
7 changed files with 36 additions and 71 deletions

View File

@@ -44,10 +44,7 @@ include_directories(${INCLUDE_DIR}
)
if (ENABLE_WEBCFGBIN)
include_directories(${INCLUDE_DIR}/rbus
${INCLUDE_DIR}/rbus-core
${INCLUDE_DIR}/rtmessage
)
include_directories(${INCLUDE_DIR}/rbus)
endif (ENABLE_WEBCFGBIN)
# Get git commit hash
@@ -237,46 +234,21 @@ include_directories(${INCLUDE_DIR}
endif (FEATURE_DNS_QUERY)
if (ENABLE_WEBCFGBIN)
# rtMessage external dependency
#-------------------------------------------------------------------------------
ExternalProject_Add(rtMessage
DEPENDS cJSON
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/_prefix/rtMessage
GIT_REPOSITORY https://github.com/rdkcmf/rdk-rtmessage.git
GIT_TAG rdk-next
CMAKE_ARGS += -DBUILD_RTMESSAGE_LIB=ON
-DBUILD_RTMESSAGE_SAMPLE_APP=ON
-DBUILD_FOR_DESKTOP=OFF
-DCJSON_BUILD=OFF
-DBUILD_DATAPROVIDER_LIB=ON
-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DBUILD_TESTING=OFF
)
add_library(librtMessage STATIC SHARED IMPORTED)
add_dependencies(librtMessage rtMessage)
# rbus-core external dependency
#-------------------------------------------------------------------------------
ExternalProject_Add(rbus-core
DEPENDS rtMessage
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/_prefix/rbus-core
GIT_REPOSITORY https://github.com/rdkcmf/rbuscore.git
GIT_TAG rdk-next
CMAKE_ARGS += -DBUILD_FOR_DESKTOP=ON -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}
-DBUILD_TESTING=OFF
)
add_library(librbus-core STATIC SHARED IMPORTED)
add_dependencies(librbus-core rbus-core)
# rbus external dependency
#-------------------------------------------------------------------------------
ExternalProject_Add(rbus
DEPENDS rtMessage rbus-core
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/_prefix/rbus
GIT_REPOSITORY https://github.com/rdkcmf/rbus.git
GIT_TAG rdk-next
GIT_REPOSITORY https://github.com/rdkcentral/rbus.git
GIT_TAG main
CMAKE_ARGS += -DBUILD_FOR_DESKTOP=ON -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DBUILD_TESTING=OFF
)
add_library(librbuscore STATIC SHARED IMPORTED)
add_dependencies(librbuscore rbuscore)
add_library(librtMessage STATIC SHARED IMPORTED)
add_dependencies(librtMessage rtMessage)
add_library(librbus STATIC SHARED IMPORTED)
add_dependencies(librbus rbus)
endif (ENABLE_WEBCFGBIN)

View File

@@ -63,6 +63,6 @@ target_link_libraries (parodus -llibseshat)
endif (ENABLE_SESHAT)
if (ENABLE_WEBCFGBIN)
target_link_libraries (parodus -lrbus -lrbus-core -lrtMessage)
target_link_libraries (parodus -lrbus)
endif (ENABLE_WEBCFGBIN)
install (TARGETS parodus DESTINATION bin)

View File

@@ -41,7 +41,6 @@ pthread_cond_t cloud_status_cond=PTHREAD_COND_INITIALIZER;
char webpa_interface[64]={'\0'};
char cloud_status[32]={'\0'};
static ParodusCfg parodusCfg;
static unsigned int rsa_algorithms =
(1<<alg_rs256) | (1<<alg_rs384) | (1<<alg_rs512);
@@ -94,10 +93,14 @@ void set_cloud_status(char *status)
char *get_cloud_status(void)
{
char *status = NULL;
pthread_mutex_lock(&config_mut);
parStrncpy(cloud_status, get_parodus_cfg()->cloud_status, sizeof(cloud_status));
pthread_mutex_unlock(&config_mut);
return cloud_status;
if(NULL != get_parodus_cfg()->cloud_status)
{
status = get_parodus_cfg()->cloud_status;
}
pthread_mutex_unlock(&config_mut);
return status;
}
const char *get_tok (const char *src, int delim, char *result, int resultsize)
@@ -498,7 +501,7 @@ int parseCommandLine(int argc,char **argv,ParodusCfg * cfg)
case 's':
if(parse_serial_num(cfg->hw_serial_number, optarg) == 0)
ParodusInfo ("hw_serial-number is %s\n",cfg->hw_serial_number);
ParodusInfo ("hw_serial_number is %s\n",cfg->hw_serial_number);
break;
case 'f':

View File

@@ -99,7 +99,9 @@ void createSocketConnection(void (* initKeypress)())
#endif
EventHandler();
#ifdef WAN_FAILOVER_SUPPORTED
subscribeCurrentActiveInterfaceEvent();
#endif
set_server_list_null (&server_list);
create_conn_rtn = createNopollConnection(ctx, &server_list);
if(!create_conn_rtn)
@@ -113,9 +115,6 @@ void createSocketConnection(void (* initKeypress)())
UpStreamMsgQ = NULL;
StartThread(handle_upstream, &upstream_tid);
StartThread(processUpstreamMessage, &upstream_msg_tid);
#ifdef WAN_FAILOVER_SUPPORTED
subscribeCurrentActiveInterfaceEvent();
#endif
ParodusMsgQ = NULL;
StartThread(messageHandlerTask, &downstream_tid);
StartThread(serviceAliveTask, &svc_alive_tid);

View File

@@ -73,7 +73,7 @@ void subscribeRBUSevent()
int subscribeCurrentActiveInterfaceEvent()
{
int rc = RBUS_ERROR_SUCCESS;
ParodusPrint("Subscribing to Device.X_RDK_WanManager.CurrentActiveInterface Event\n");
ParodusInfo("Subscribing to Device.X_RDK_WanManager.CurrentActiveInterface Event\n");
rc = rbusEvent_SubscribeAsync(rbus_Handle,WEBPA_INTERFACE,eventReceiveHandler,subscribeAsyncHandler,"parodusInterface",10*20);
if(rc != RBUS_ERROR_SUCCESS)
{

View File

@@ -33,7 +33,7 @@ set (PARODUS_COMMON_LIBS ${PARODUS_COMMON_LIBS} -lucresolv -lresolv)
endif (FEATURE_DNS_QUERY)
if (ENABLE_WEBCFGBIN)
set (PARODUS_COMMON_LIBS ${PARODUS_COMMON_LIBS} -lrbus -lrbus-core)
set (PARODUS_COMMON_LIBS ${PARODUS_COMMON_LIBS} -lrbus)
endif (ENABLE_WEBCFGBIN)
if(NOT DISABLE_VALGRIND)
@@ -61,7 +61,10 @@ target_link_libraries (test_close_retry ${PARODUS_COMMON_LIBS} -lcmocka)
#-------------------------------------------------------------------------------
add_test(NAME test_mutex COMMAND ${MEMORY_CHECK} ./test_mutex)
add_executable(test_mutex test_mutex.c ../src/mutex.c)
target_link_libraries (test_mutex ${PARODUS_COMMON_LIBS} -lcmocka)
target_link_libraries (test_mutex gcov -lcunit -lcimplog -lwrp-c
-luuid -lmsgpackc -lnopoll -lnanomsg -lpthread
-Wl,--no-as-needed -lcjson -lcjwt -ltrower-base64
-lssl -lcrypto -lrt -lm -lcmocka)
#-------------------------------------------------------------------------------
# test_networking
@@ -74,8 +77,8 @@ target_link_libraries (test_networking ${PARODUS_COMMON_LIBS})
# test_nopoll_helpers
#-------------------------------------------------------------------------------
add_test(NAME test_nopoll_helpers COMMAND ${MEMORY_CHECK} ./test_nopoll_helpers)
add_executable(test_nopoll_helpers test_nopoll_helpers.c ../src/nopoll_helpers.c)
target_link_libraries (test_nopoll_helpers -Wl,--no-as-needed -lrt -lcmocka -lcimplog -lnopoll)
add_executable(test_nopoll_helpers test_nopoll_helpers.c ../src/nopoll_helpers.c ../src/string_helpers.c ../src/config.c)
target_link_libraries (test_nopoll_helpers -Wl,--no-as-needed -lrt -lcmocka -lcimplog -lnopoll ${PARODUS_COMMON_LIBS})
#-------------------------------------------------------------------------------
# test_time

View File

@@ -24,6 +24,9 @@
#include "../src/parodus_log.h"
#include "../src/nopoll_helpers.h"
#include "../src/config.h"
#include <cjwt/cjwt.h>
#include "../src/connection.h"
#include "../src/ParodusInternal.h"
/*----------------------------------------------------------------------------*/
/* Macros */
@@ -34,7 +37,6 @@
/* File Scoped Variables */
/*----------------------------------------------------------------------------*/
static noPollConn *conn = NULL;
static ParodusCfg cfg;
/*----------------------------------------------------------------------------*/
/* Mocks */
@@ -57,12 +59,6 @@ nopoll_bool nopoll_conn_is_ready( noPollConn *conn )
return (nopoll_bool)mock();
}
ParodusCfg *get_parodus_cfg(void)
{
function_called();
return &cfg;
}
int __nopoll_conn_send_common (noPollConn * conn, const char * content, long length, nopoll_bool has_fin, long sleep_in_header, noPollOpCode frame_type)
{
UNUSED(has_fin); UNUSED(sleep_in_header); UNUSED(frame_type); UNUSED(content);
@@ -131,10 +127,6 @@ bool get_interface_down_event()
return false;
}
char *get_cloud_status(void)
{
return NULL;
}
/*----------------------------------------------------------------------------*/
/* Tests */
@@ -226,8 +218,7 @@ void test_sendMessage()
{
int len = strlen("Hello Parodus!");
cfg.cloud_status = CLOUD_STATUS_ONLINE;
expect_function_calls (get_parodus_cfg, 1);
get_parodus_cfg()->cloud_status = CLOUD_STATUS_ONLINE;
expect_value(__nopoll_conn_send_common, (intptr_t)conn, (intptr_t)conn);
expect_value(__nopoll_conn_send_common, length, len);
@@ -241,8 +232,7 @@ void test_sendMessageOffline()
{
int len = strlen("Hello Parodus!");
cfg.cloud_status = CLOUD_STATUS_OFFLINE;
expect_function_calls (get_parodus_cfg, 1);
get_parodus_cfg()->cloud_status = CLOUD_STATUS_OFFLINE;
sendMessage(conn, "Hello Parodus!", len);
}
@@ -251,8 +241,7 @@ void err_sendMessage()
{
int len = strlen("Hello Parodus!");
cfg.cloud_status = CLOUD_STATUS_ONLINE;
expect_function_calls (get_parodus_cfg, 1);
get_parodus_cfg()->cloud_status = CLOUD_STATUS_ONLINE;
expect_value(__nopoll_conn_send_common, (intptr_t)conn,(intptr_t) conn);
expect_value(__nopoll_conn_send_common, length, len);
@@ -271,8 +260,7 @@ void err_sendMessageConnNull()
{
int len = strlen("Hello Parodus!");
cfg.cloud_status = CLOUD_STATUS_ONLINE;
expect_function_calls (get_parodus_cfg, 1);
get_parodus_cfg()->cloud_status = CLOUD_STATUS_ONLINE;
expect_value(__nopoll_conn_send_common, (intptr_t)conn, NULL);
expect_value(__nopoll_conn_send_common, length, len);