version 3.0.3 change the e2term init message format to JSON 41/1841/1
authoraa7133@att.com <aa7133@att.com>
Thu, 28 Nov 2019 11:54:23 +0000 (13:54 +0200)
committeraa7133@att.com <aa7133@att.com>
Thu, 28 Nov 2019 11:54:28 +0000 (13:54 +0200)
Change-Id: Ifeb61ec5cae743a95c176fc9b7816f53017bab85
Signed-off-by: aa7133@att.com <aa7133@att.com>
RIC-E2-TERMINATION/config/config.conf
RIC-E2-TERMINATION/container-tag.yaml
RIC-E2-TERMINATION/sctpThread.cpp
RIC-E2-TERMINATION/sctpThread.h

index 0b9dab1..ab7be5e 100644 (file)
@@ -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
index 60ce207..a34401d 100644 (file)
@@ -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
index 70657d8..688f824 100644 (file)
@@ -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);
 }
 
 /**
index 2034452..9602d43 100644 (file)
@@ -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;