X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=ntsimulator%2Fntsim-ng%2Ffeatures%2Fves_file_ready%2Fves_file_ready.c;h=d7f340e27f1705bee26f5bcb6b005d6567f95cc1;hb=6d03d77e2110c880c63c8716385d2b936ccc4b78;hp=d973827aabc497df5d3dfb2ad13c744725f533a1;hpb=92903642ea9a10306817529ca546ea2432c741a1;p=sim%2Fo1-interface.git diff --git a/ntsimulator/ntsim-ng/features/ves_file_ready/ves_file_ready.c b/ntsimulator/ntsim-ng/features/ves_file_ready/ves_file_ready.c index d973827..d7f340e 100644 --- a/ntsimulator/ntsim-ng/features/ves_file_ready/ves_file_ready.c +++ b/ntsimulator/ntsim-ng/features/ves_file_ready/ves_file_ready.c @@ -30,14 +30,11 @@ #include "core/framework.h" #include "core/session.h" - -#define FILE_READY_RPC_SCHEMA_XPATH "/nts-network-function:invoke-ves-pm-file-ready" +#include "core/xpath.h" static int ves_file_ready_invoke_pm_cb(sr_session_ctx_t *session, const char *path, const sr_val_t *input, const size_t input_cnt, sr_event_t event, uint32_t request_id, sr_val_t **output, size_t *output_cnt, void *private_data); static int ves_file_ready_send_message(sr_session_ctx_t *session, const char *file_location, int port); static cJSON* ves_create_file_ready_fields(const char* file_location); -static void ves_file_ready_vsftp_daemon_init(void); -static void ves_file_ready_vsftp_daemon_deinit(void); static sr_subscription_ctx_t *ves_file_ready_subscription = 0; @@ -50,13 +47,14 @@ int ves_file_ready_feature_start(sr_session_ctx_t *current_session) { assert_session(); if(ves_file_ready_subscription == 0) { - int rc = sr_rpc_subscribe(current_session, FILE_READY_RPC_SCHEMA_XPATH, ves_file_ready_invoke_pm_cb, 0, 0, SR_SUBSCR_CTX_REUSE, &ves_file_ready_subscription); + int rc = sr_rpc_subscribe(current_session, NTS_NF_RPC_FILE_READY_SCHEMA_XPATH, ves_file_ready_invoke_pm_cb, 0, 0, SR_SUBSCR_CTX_REUSE, &ves_file_ready_subscription); if(rc != SR_ERR_OK) { log_error("error from sr_rpc_subscribe: %s\n", sr_strerror(rc)); return NTS_ERR_FAILED; } - ves_file_ready_vsftp_daemon_init(); + sftp_daemon_init(); + vsftp_daemon_init(); } return NTS_ERR_OK; @@ -72,21 +70,14 @@ int ves_file_ready_feature_stop(void) { return NTS_ERR_FAILED; } - ves_file_ready_vsftp_daemon_deinit(); + vsftp_daemon_deinit(); + sftp_daemon_deinit(); ves_file_ready_subscription = 0; } return NTS_ERR_OK; } -static void ves_file_ready_vsftp_daemon_init(void) { - system("/usr/sbin/vsftpd &"); -} - -static void ves_file_ready_vsftp_daemon_deinit(void) { - system("killall -9 vsftpd"); -} - static int ves_file_ready_invoke_pm_cb(sr_session_ctx_t *session, const char *path, const sr_val_t *input, const size_t input_cnt, sr_event_t event, uint32_t request_id, sr_val_t **output, size_t *output_cnt, void *private_data) { int ssh_base_port = 0; int tls_base_port = 0; @@ -138,7 +129,7 @@ static int ves_file_ready_invoke_pm_cb(sr_session_ctx_t *session, const char *pa return rc; } - rc = sr_val_set_xpath(output[0], FILE_READY_RPC_SCHEMA_XPATH"/status"); + rc = sr_val_set_xpath(output[0], NTS_NF_RPC_FILE_READY_SCHEMA_XPATH"/status"); if(SR_ERR_OK != rc) { return rc; }