3.0.4.2 add error in keep alive 66/2266/1
authoraa7133@att.com <aa7133@att.com>
Sun, 19 Jan 2020 08:49:01 +0000 (10:49 +0200)
committeraa7133@att.com <aa7133@att.com>
Sun, 19 Jan 2020 08:49:17 +0000 (10:49 +0200)
add pod name in KA and INIT

Change-Id: Ic62de597edb94592a61c910c8b6ce4dd26d42480
Signed-off-by: aa7133@att.com <aa7133@att.com>
RIC-E2-TERMINATION/Dockerfile
RIC-E2-TERMINATION/config/config.conf
RIC-E2-TERMINATION/container-tag.yaml
RIC-E2-TERMINATION/sctpThread.cpp
RIC-E2-TERMINATION/sctpThread.h

index 5604fcb..f24328f 100644 (file)
@@ -48,7 +48,7 @@ RUN apt-get install -y autoconf gawk libtool automake pkg-config autoconf-archiv
     && cd /opt/e2/RIC-E2-TERMINATION/3rdparty && git clone https://github.com/Tencent/rapidjson.git \
     && cd rapidjson && mkdir build && cd build && cmake .. && make install && ldconfig \
     && cd /opt/e2/RIC-E2-TERMINATION/3rdparty && git clone https://github.com/oktal/pistache.git\
-    && cd pistache && mkdir build && cd build && cmake .. && make install && ldconfig\
+    && cd pistache && git submodule update --init && mkdir build && cd build && cmake .. && make install && ldconfig\
     && cd /opt/e2/RIC-E2-TERMINATION/3rdparty \
     && wget --content-disposition https://github.com/cgreen-devs/cgreen/releases/download/1.2.0/cgreen_1.2.0_amd64.deb \
     && dpkg -i cgreen_1.2.0_amd64.deb \
index ab7be5e..c7fa17a 100644 (file)
@@ -1,7 +1,10 @@
 nano=38000
 loglevel=info
 volume=log
-local-ip=127.0.0.1
+#the key name of the environment holds the local ip address
+local-ip=theLocalIP environment
 #trace is start, stop
 trace=start
-external-fqdn=e2t.att.com
\ No newline at end of file
+external-fqdn=e2t.att.com
+#put pointer to the key that point to pod name
+pod_name=kukuriku
\ No newline at end of file
index e69aab4..fd492e5 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.4.1
+tag: 3.0.4.2
index 31a7e23..d339765 100644 (file)
@@ -192,6 +192,13 @@ int main(const int argc, char **argv) {
     // define the file name in the tmp directory under the volume
     strcat(tmpLogFilespec,"/tmp/E2Term_%Y-%m-%d_%H-%M-%S.%N.tmpStr");
 
+//    std::string localIP = conf.getStringValue("local-ip");
+//    if (localIP.length() == 0) {
+//        mdclog_write(MDCLOG_ERR, "illigal local-ip. environment variable");
+//        exit(-1);
+//    }
+
+    //sctpParams.myIP.assign(getenv(localIP.c_str()));
     sctpParams.myIP = conf.getStringValue("local-ip");
     if (sctpParams.myIP.length() == 0) {
         mdclog_write(MDCLOG_ERR, "illigal local-ip.");
@@ -204,6 +211,17 @@ int main(const int argc, char **argv) {
         exit(-1);
     }
 
+    std::string pod = conf.getStringValue("pod_name");
+    if (pod.length() == 0) {
+        mdclog_write(MDCLOG_ERR, "illigal pod_name");
+        exit(-1);
+    }
+    sctpParams.podName.assign(getenv(sctpParams.podName.c_str()));
+    if (sctpParams.podName.length() == 0) {
+        mdclog_write(MDCLOG_ERR, "illigal pod_name");
+        exit(-1);
+    }
+
     tmpStr = conf.getStringValue("trace");
     transform(tmpStr.begin(), tmpStr.end(), tmpStr.begin(), ::tolower);
     if ((tmpStr.compare("start")) == 0) {
@@ -233,10 +251,12 @@ int main(const int argc, char **argv) {
     }
     mdclog_mdc_clean();
     sctpParams.ka_message_length = snprintf(sctpParams.ka_message, 4096, "{\"address\": \"%s:%d\","
-                                                                         "\"fqdn\": \"%s\"}",
+                                                                         "\"fqdn\": \"%s\","
+                                                                         "\"pod_name\": \"%s\"}",
                                             (const char *)sctpParams.myIP.c_str(),
                                             sctpParams.rmrPort,
-                                            sctpParams.fqdn.c_str());
+                                            sctpParams.fqdn.c_str(),
+                                            sctpParams.podName.c_str());
 
 
     // Files written to the current working directory
@@ -2124,9 +2144,6 @@ int receiveXappMessages(int epoll_fd,
         }
         case E2_TERM_KEEP_ALIVE_REQ: {
             // send message back
-            if (mdclog_level_get() >= MDCLOG_INFO) {
-                mdclog_write(MDCLOG_INFO, "Got Keep Alive Request send : %s", rmrMessageBuffer.ka_message);
-            }
             rmr_bytes2payload(rmrMessageBuffer.sendMessage,
                     (unsigned char *)rmrMessageBuffer.ka_message,
                     rmrMessageBuffer.ka_message_len);
@@ -2140,8 +2157,11 @@ int receiveXappMessages(int epoll_fd,
                 rmrMessageBuffer.sendMessage = rmr_alloc_msg(rmrMessageBuffer.rmrCtx, RECEIVE_XAPP_BUFFER_SIZE);
                 mdclog_write(MDCLOG_ERR, "Failed to send E2_TERM_KEEP_ALIVE_RESP");
             } else if (rmrMessageBuffer.sendMessage->state != 0)  {
-                mdclog_write(MDCLOG_ERR, "Failed to send E2_TERM_KEEP_ALIVE_RESP");
+                mdclog_write(MDCLOG_ERR, "Failed to send E2_TERM_KEEP_ALIVE_RESP, on RMR state = %d", rmrMessageBuffer.sendMessage->state);
+            } else if (mdclog_level_get() >= MDCLOG_INFO) {
+                mdclog_write(MDCLOG_INFO, "Got Keep Alive Request send : %s", rmrMessageBuffer.ka_message);
             }
+
             break;
         }
         default:
index 588f6a8..26422bf 100644 (file)
@@ -132,6 +132,7 @@ typedef struct sctp_params {
     char volume[VOLUME_URL_SIZE];
     string myIP {};
     string fqdn {};
+    string podName {};
     string configFilePath {};
     string configFileName {};
     bool trace = true;