From: aa7133@att.com Date: Thu, 28 Nov 2019 11:54:23 +0000 (+0200) Subject: version 3.0.3 change the e2term init message format to JSON X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=4512757f1b54afc3fe44be0199bf4142e2801cf6;p=ric-plt%2Fe2.git version 3.0.3 change the e2term init message format to JSON Change-Id: Ifeb61ec5cae743a95c176fc9b7816f53017bab85 Signed-off-by: aa7133@att.com --- diff --git a/RIC-E2-TERMINATION/config/config.conf b/RIC-E2-TERMINATION/config/config.conf index 0b9dab1..ab7be5e 100644 --- a/RIC-E2-TERMINATION/config/config.conf +++ b/RIC-E2-TERMINATION/config/config.conf @@ -4,3 +4,4 @@ volume=log local-ip=127.0.0.1 #trace is start, stop trace=start +external-fqdn=e2t.att.com \ No newline at end of file diff --git a/RIC-E2-TERMINATION/container-tag.yaml b/RIC-E2-TERMINATION/container-tag.yaml index 60ce207..a34401d 100644 --- a/RIC-E2-TERMINATION/container-tag.yaml +++ b/RIC-E2-TERMINATION/container-tag.yaml @@ -1,3 +1,3 @@ # The Jenkins job requires a tag to build the Docker image. # Global-JJB script assumes this file is in the repo root. -tag: 3.0.2 +tag: 3.0.3 diff --git a/RIC-E2-TERMINATION/sctpThread.cpp b/RIC-E2-TERMINATION/sctpThread.cpp index 70657d8..688f824 100644 --- a/RIC-E2-TERMINATION/sctpThread.cpp +++ b/RIC-E2-TERMINATION/sctpThread.cpp @@ -169,6 +169,12 @@ int main(const int argc, char **argv) { exit(-1); } + sctpParams.myIP = conf.getStringValue("external-fqdn"); + if (sctpParams.myIP.length() == 0) { + mdclog_write(MDCLOG_ERR, "illigal external-fqdn."); + exit(-1); + } + tmpStr = conf.getStringValue("trace"); transform(tmpStr.begin(), tmpStr.end(), tmpStr.begin(), ::tolower); if ((tmpStr.compare("start")) == 0) { @@ -295,10 +301,13 @@ void handleTermInit(sctp_params_t &sctpParams) { void sendTermInit(sctp_params_t &sctpParams) { auto term_init = false; - - char *buff = (char *)calloc(1, sctpParams.myIP.length()); - auto len = snprintf(buff, sctpParams.myIP.length(), "%s:%d", (const char *)sctpParams.myIP.c_str(),sctpParams.rmrPort); - rmr_mbuf_t *msg = rmr_alloc_msg(sctpParams.rmrCtx, sctpParams.myIP.length()); + char buff[4096]; + auto len = snprintf(buff, 4096, "{\"address\": \"%s:%d\"," + "\"fqdn\": \"%s\"}", + (const char *)sctpParams.myIP.c_str(), + sctpParams.rmrPort, + sctpParams.fqdn.c_str()); + rmr_mbuf_t *msg = rmr_alloc_msg(sctpParams.rmrCtx, len); auto count = 0; while (!term_init) { msg->mtype = E2_TERM_INIT; @@ -323,7 +332,6 @@ void sendTermInit(sctp_params_t &sctpParams) { count++; } - free(buff); } /** diff --git a/RIC-E2-TERMINATION/sctpThread.h b/RIC-E2-TERMINATION/sctpThread.h index 2034452..9602d43 100644 --- a/RIC-E2-TERMINATION/sctpThread.h +++ b/RIC-E2-TERMINATION/sctpThread.h @@ -123,6 +123,7 @@ typedef struct sctp_params { mdclog_severity_t logLevel = MDCLOG_INFO; char volume[VOLUME_URL_SIZE]; string myIP {}; + string fqdn {}; string configFilePath {}; string configFileName {}; bool trace = true;