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
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"]
// 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.");
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) {
}
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
}
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);
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:
--- /dev/null
+#!/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