From 495875d22afcf8acced113887d8077ec58c0eaf5 Mon Sep 17 00:00:00 2001 From: "aa7133@att.com" Date: Sun, 19 Jan 2020 10:49:01 +0200 Subject: [PATCH] 3.0.4.2 add error in keep alive add pod name in KA and INIT Change-Id: Ic62de597edb94592a61c910c8b6ce4dd26d42480 Signed-off-by: aa7133@att.com --- RIC-E2-TERMINATION/Dockerfile | 2 +- RIC-E2-TERMINATION/config/config.conf | 7 +++++-- RIC-E2-TERMINATION/container-tag.yaml | 2 +- RIC-E2-TERMINATION/sctpThread.cpp | 32 ++++++++++++++++++++++++++------ RIC-E2-TERMINATION/sctpThread.h | 1 + 5 files changed, 34 insertions(+), 10 deletions(-) diff --git a/RIC-E2-TERMINATION/Dockerfile b/RIC-E2-TERMINATION/Dockerfile index 5604fcb..f24328f 100644 --- a/RIC-E2-TERMINATION/Dockerfile +++ b/RIC-E2-TERMINATION/Dockerfile @@ -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 \ diff --git a/RIC-E2-TERMINATION/config/config.conf b/RIC-E2-TERMINATION/config/config.conf index ab7be5e..c7fa17a 100644 --- a/RIC-E2-TERMINATION/config/config.conf +++ b/RIC-E2-TERMINATION/config/config.conf @@ -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 diff --git a/RIC-E2-TERMINATION/container-tag.yaml b/RIC-E2-TERMINATION/container-tag.yaml index e69aab4..fd492e5 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.4.1 +tag: 3.0.4.2 diff --git a/RIC-E2-TERMINATION/sctpThread.cpp b/RIC-E2-TERMINATION/sctpThread.cpp index 31a7e23..d339765 100644 --- a/RIC-E2-TERMINATION/sctpThread.cpp +++ b/RIC-E2-TERMINATION/sctpThread.cpp @@ -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: diff --git a/RIC-E2-TERMINATION/sctpThread.h b/RIC-E2-TERMINATION/sctpThread.h index 588f6a8..26422bf 100644 --- a/RIC-E2-TERMINATION/sctpThread.h +++ b/RIC-E2-TERMINATION/sctpThread.h @@ -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; -- 2.16.6