support multi e2 20/2320/1
authorroot <ronit.shechter@intl.att.com>
Thu, 23 Jan 2020 17:11:52 +0000 (17:11 +0000)
committerroot <ronit.shechter@intl.att.com>
Thu, 23 Jan 2020 17:12:37 +0000 (17:12 +0000)
Change-Id: I9eb25330e2bb08319517408f97231404ac4b2f1d
Signed-off-by: root <ronit.shechter@intl.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
RIC-E2-TERMINATION/startup.sh [new file with mode: 0644]

index 57b9aea..3040ebe 100644 (file)
@@ -75,6 +75,7 @@ RUN apt-get update && apt-get install -y net-tools iputils-ping curl tcpdump &&
 COPY --from=ubuntu /opt/e2/e2 /opt/e2/e2
 COPY --from=ubuntu /opt/e2/RIC-E2-TERMINATION/dockerRouter.txt /opt/e2/dockerRouter.txt
 COPY --from=ubuntu /opt/e2/RIC-E2-TERMINATION/config/config.conf /opt/e2/config/config.conf
+COPY --from=ubuntu /opt/e2/RIC-E2-TERMINATION/startup.sh /opt/e2/startup.sh
 #COPY --from=ubuntu /opt/e2/RIC-E2-TERMINATION/tracelibcpp/build/libtracelibcpp.so /usr/local/lib/libtracelibcpp.so
 #COPY --from=ubuntu /opt/e2/RIC-E2-TERMINATION/tracelibcpp/build/libtracelibcpp.so.0 /usr/local/lib/libtracelibcpp.so.0
 #COPY --from=ubuntu /opt/e2/RIC-E2-TERMINATION/tracelibcpp/build/libtracelibcpp.so.0.0.2 /usr/local/lib/libtracelibcpp.so.0.0.2
@@ -121,5 +122,6 @@ COPY --from=ubuntu /usr/lib/x86_64-linux-gnu/libicudata.so.55.1 /usr/lib/x86_64-
 WORKDIR /opt/e2/
 ENV LD_LIBRARY_PATH=/usr/local/lib
 ENV RMR_SEED_RT=dockerRouter.txt
+RUN chmod +x /opt/e2/startup.sh
 EXPOSE 38000
-CMD ["sh", "-c", "./e2 -p config -f config.conf"]
+CMD ["sh", "-c", "./startup.sh"]
index c7fa17a..27cd21e 100644 (file)
@@ -5,6 +5,6 @@ volume=log
 local-ip=theLocalIP environment
 #trace is start, stop
 trace=start
-external-fqdn=e2t.att.com
+external-fqdn=e2t.com
 #put pointer to the key that point to pod name
-pod_name=kukuriku
\ No newline at end of file
+pod_name=kukuriku
index fd492e5..2b37f13 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.2
+tag: 3.0.4.3
index d339765..31a7e23 100644 (file)
@@ -192,13 +192,6 @@ 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.");
@@ -211,17 +204,6 @@ 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) {
@@ -251,12 +233,10 @@ int main(const int argc, char **argv) {
     }
     mdclog_mdc_clean();
     sctpParams.ka_message_length = snprintf(sctpParams.ka_message, 4096, "{\"address\": \"%s:%d\","
-                                                                         "\"fqdn\": \"%s\","
-                                                                         "\"pod_name\": \"%s\"}",
+                                                                         "\"fqdn\": \"%s\"}",
                                             (const char *)sctpParams.myIP.c_str(),
                                             sctpParams.rmrPort,
-                                            sctpParams.fqdn.c_str(),
-                                            sctpParams.podName.c_str());
+                                            sctpParams.fqdn.c_str());
 
 
     // Files written to the current working directory
@@ -2144,6 +2124,9 @@ 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);
@@ -2157,11 +2140,8 @@ 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, 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);
+                mdclog_write(MDCLOG_ERR, "Failed to send E2_TERM_KEEP_ALIVE_RESP");
             }
-
             break;
         }
         default:
index 26422bf..588f6a8 100644 (file)
@@ -132,7 +132,6 @@ typedef struct sctp_params {
     char volume[VOLUME_URL_SIZE];
     string myIP {};
     string fqdn {};
-    string podName {};
     string configFilePath {};
     string configFileName {};
     bool trace = true;
diff --git a/RIC-E2-TERMINATION/startup.sh b/RIC-E2-TERMINATION/startup.sh
new file mode 100644 (file)
index 0000000..4db8b37
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+#dockerIp=$(ifconfig eth0 | awk '{ print $2}' | grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}")
+#echo "docker ip: $dockerIp"
+serviceName=$(env| grep RMR_SRC_ID | tr -d 'RMR_SRC_ID=' | awk '{split($0,srv,"."); print srv[1]}'| sed -r 's/-/_/g' | tr '[:lower:]' '[:upper:]')
+fullServiceName=${serviceName}_SERVICE_HOST
+echo "environments service name is $fullServiceName"
+serviceIp=$(env | grep $fullServiceName | awk '{split($0,ip,"="); print ip[2]}')
+echo "service ip is $serviceIp"
+sed -i "s/external-fqdn=e2t.com/external-fqdn=$serviceIp/g" "/opt/e2/config/config.conf"
+cat "/opt/e2/config/config.conf"
+./e2 -p config -f config.conf