From 17026ffce615ea45727c4fcf6632e9c1ffe23c08 Mon Sep 17 00:00:00 2001 From: udaykrishnag <33549128+udaykrishnag@users.noreply.github.com> Date: Tue, 7 Oct 2025 11:25:01 -0400 Subject: [PATCH] RDK-58220 : [RDKE] Migrate Functionality In TR-69Hostif And NTP Scripts To Core Modules (#276) * RDK-58220 Migrate Functionality In TR-69Hostif Scripts To Core Modules * RDK-58220 Migrate Functionality In TR-69Hostif Scripts To Core Modules * RDK-58220 : [RDKE] Migrate Functionality In TR-69Hostif And NTP Scripts To Core Modules --------- Co-authored-by: Garpathi, Uday Krishna --- run_l2.sh | 2 +- src/hostif/src/hostIf_main.cpp | 23 ++--------------------- tr69hostif.service | 3 +-- tr69hostif_no_new_http_server.service | 3 +-- 4 files changed, 5 insertions(+), 26 deletions(-) diff --git a/run_l2.sh b/run_l2.sh index 66d582680..10cd51fb3 100644 --- a/run_l2.sh +++ b/run_l2.sh @@ -62,7 +62,7 @@ if [ ! -z "$pid" ]; then kill -9 `pidof tr69hostif` fi -/usr/local/bin/tr69hostif -c /etc/mgrlist.conf -d /etc/debug.ini -p 10999 -s 11999 | tee /opt/logs/tr69hostIf.log.0 & +/usr/local/bin/tr69hostif -c /etc/mgrlist.conf -p 10999 -s 11999 | tee /opt/logs/tr69hostIf.log.0 & pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/bootup_sequence.json test/functional-tests/tests/test_bootup_sequence.py pytest --json-report --json-report-summary --json-report-file $RESULT_DIR/handlers_communications.json test/functional-tests/tests/test_handlers_communications.py diff --git a/src/hostif/src/hostIf_main.cpp b/src/hostif/src/hostIf_main.cpp index 1d1e6e1dc..94f0aadd2 100644 --- a/src/hostif/src/hostIf_main.cpp +++ b/src/hostif/src/hostIf_main.cpp @@ -220,8 +220,6 @@ int main(int argc, char *argv[]) #ifdef WEBPA_RFC_ENABLED bool retVal=false; #endif - const char* debugConfigFile = NULL; - const char* webpaNotifyConfigFile = NULL; //------------------------------------------------------------------------------ // Signal handlers: //------------------------------------------------------------------------------ @@ -240,8 +238,6 @@ int main(int argc, char *argv[]) #ifndef NEW_HTTP_SERVER_DISABLE {"httpserverport", required_argument, 0, 's'}, #endif - {"debugconfig", required_argument, 0, 'd'}, - {"notifyconfig", required_argument, 0, 'w'}, {0, 0, 0, 0} }; @@ -273,19 +269,6 @@ int main(int argc, char *argv[]) } break; - case 'd': - if(optarg) - { - debugConfigFile = optarg; - } - break; - case 'w': - if(optarg) - { - webpaNotifyConfigFile = optarg; - } - break; - case 'p': if(optarg) { @@ -310,7 +293,7 @@ int main(int argc, char *argv[]) } /* Enable RDK logger.*/ - if(rdk_logger_init(debugConfigFile) == 0) rdk_logger_enabled = 1; + if(rdk_logger_init(0 == access("/opt/debug.ini", R_OK) ? "/opt/debug.ini" : "/etc/debug.ini") == 0) rdk_logger_enabled = 1; #ifdef T2_EVENT_ENABLED t2_init(const_cast("tr69hostif")); #endif @@ -381,8 +364,6 @@ int main(int argc, char *argv[]) RDK_LOG(RDK_LOG_ERROR,LOG_TR69HOSTIF,"g_thread NOT supported\n"); } #endif - /* Enable RDK logger.*/ - if(rdk_logger_init(debugConfigFile) == 0) rdk_logger_enabled = 1; #if defined(USE_WIFI_PROFILE) /* Perform the necessary operations to initialise the WiFi device */ @@ -496,7 +477,7 @@ int main(int argc, char *argv[]) //------------------------------------------------------------------------------ RDK_LOG(RDK_LOG_DEBUG,LOG_TR69HOSTIF,"Starting WEBPA Parodus Connections\n"); - libpd_set_notifyConfigFile(webpaNotifyConfigFile); + libpd_set_notifyConfigFile(0 == access("/opt/notify_webpa_cfg.json", R_OK) ? "/opt/notify_webpa_cfg.json" : "/etc/notify_webpa_cfg.json"); if(0 == pthread_create(&parodus_init_tid, NULL, libpd_client_mgr, NULL)) { RDK_LOG(RDK_LOG_INFO,LOG_TR69HOSTIF,"Initiating Connection with PARODUS success.. \n"); diff --git a/tr69hostif.service b/tr69hostif.service index 243bac9cc..ffac64af2 100644 --- a/tr69hostif.service +++ b/tr69hostif.service @@ -25,8 +25,7 @@ Type=notify SyslogIdentifier="tr69hostif" EnvironmentFile=/etc/device.properties ExecStartPre=/bin/mkdir -p /opt/tr-181 -ExecStartPre=/bin/sh -c '/lib/rdk/opt-override.sh' -ExecStart=/usr/bin/tr69hostif -c /etc/mgrlist.conf -p 10999 -s 11999 -d $DEBUGINIFILE -w $WEBPANOTIFYINCFG +ExecStart=/usr/bin/tr69hostif -c /etc/mgrlist.conf -p 10999 -s 11999 ExecStop=/bin/kill -15 $MAINPID RestartSec=10s Restart=always diff --git a/tr69hostif_no_new_http_server.service b/tr69hostif_no_new_http_server.service index e6b6e25a2..d78a0f3bc 100644 --- a/tr69hostif_no_new_http_server.service +++ b/tr69hostif_no_new_http_server.service @@ -26,8 +26,7 @@ Type=notify SyslogIdentifier="tr69hostif" EnvironmentFile=/etc/device.properties ExecStartPre=/bin/mkdir -p /opt/tr-181 -ExecStartPre=/bin/sh -c '/lib/rdk/opt-override.sh' -ExecStart=/usr/bin/tr69hostif -c /etc/mgrlist.conf -p 10999 -d $DEBUGINIFILE -w $WEBPANOTIFYINCFG +ExecStart=/usr/bin/tr69hostif -c /etc/mgrlist.conf -p 10999 ExecStop=/bin/kill -15 $MAINPID Restart=always