/logTest
/b64Test
/T1
+/e2Cov
+/RIC-E2-TERMINATION/3rdparty/pistache/
+/CMakeLists.txt.old
+/cmake-modules/
+/e2_coverage.base
+/teste2
cmake_minimum_required(VERSION 3.13)
project(e2)
-set(CMAKE_VERBOSE_MAKEFILE on)
+set(CMAKE_VERBOSE_MAKEFILE off)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEV_PKG=1")
+set(PROJECT_NAME "e2")
+set(PROJECT_TEST_NAME "e2")
-#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DASN_DISABLE_OER_SUPPORT -DASN_PDU_COLLECTION -L. -LRIC-E2-TERMINATION/tracelibcpp/build -ggdb3 -Wall -W -Wpedantic")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DASN_DISABLE_OER_SUPPORT -DASN_PDU_COLLECTION -L. -O3 -L/usr/lib -Wall -Wpedantic")
-#only c code with -O3
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DASN_DISABLE_OER_SUPPORT -DASN_PDU_COLLECTION -L. -O3 -L/usr/lib -Wall -W -Wpedantic")
+if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
+ #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DASN_DISABLE_OER_SUPPORT -DASN_PDU_COLLECTION -L. -LRIC-E2-TERMINATION/tracelibcpp/build -ggdb3 -Wall -W -Wpedantic")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DASN_DISABLE_OER_SUPPORT -DASN_PDU_COLLECTION -L. -O3 -L/usr/lib -Wall -Wpedantic")
+ #only c code with -O3
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DASN_DISABLE_OER_SUPPORT -DASN_PDU_COLLECTION -L. -O3 -L/usr/lib -Wall -W -Wpedantic")
+else ()
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DASN_DISABLE_OER_SUPPORT -DASN_PDU_COLLECTION -L. -ggdb3 --coverage -L/usr/lib -Wall -Wpedantic")
+ #only c code with -O3
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DASN_DISABLE_OER_SUPPORT -DASN_PDU_COLLECTION -L. -ggdb3 -L/usr/lib -Wall -W -Wpedantic")
+
+endif ()
include_directories(RIC-E2-TERMINATION
- RIC-E2-TERMINATION/asn1cFiles
- RIC-E2-TERMINATION/3rdparty)
+ RIC-E2-TERMINATION/3rdparty/asn1cFiles
+ RIC-E2-TERMINATION/3rdparty
+ cmake-modules)
-file(GLOB ASN_MODULE_SRCS "RIC-E2-TERMINATION/asn1cFiles/*.c")
-file(GLOB ASN_MODULE_HDRS "RIC-E2-TERMINATION/asn1cFiles/*.h")
+file(GLOB ASN_MODULE_SRCS "RIC-E2-TERMINATION/3rdparty/asn1cFiles/*.c")
+file(GLOB ASN_MODULE_HDRS "RIC-E2-TERMINATION/3rdparty/asn1cFiles/*.h")
add_library(asn1codec ${ASN_MODULE_SRCS} ${ASN_MODULE_HDRS})
include_directories(RIC-E2-TERMINATION/TEST/e2smTest)
include_directories(RIC-E2-TERMINATION/TEST/T1)
include_directories(RIC-E2-TERMINATION/TEST/T2)
-include_directories(RIC-E2-TERMINATION/base64/include)
-include_directories(RIC-E2-TERMINATION/base64/lib)
+
add_library(e2sm
RIC-E2-TERMINATION/TEST/e2sm.c
link_libraries(nsl
sctp
+ gcov
c
m
dl
RIC-E2-TERMINATION/base64.h
RIC-E2-TERMINATION/TEST/base64/testBase64.cpp)
-#find_package(RapidJSON)
+add_executable(T1
+ RIC-E2-TERMINATION/TEST/T1/E2Builder.h
+ RIC-E2-TERMINATION/TEST/T1/E2Setup.cpp
+ #RIC-E2-TERMINATION/TEST/T1/Test1.cpp
+ #RIC-E2-TERMINATION/TEST/T1/
+ )
+
+
+find_package(RapidJSON)
+
+add_executable(logTest
+ RIC-E2-TERMINATION/TEST/ASN_LOG/LogTest.h
+ RIC-E2-TERMINATION/TEST/ASN_LOG/LogTest.cpp)
+
+add_executable(teste2
+ RIC-E2-TERMINATION/TEST/e2test.h
+ RIC-E2-TERMINATION/TEST/e2test.cpp
+ )
-#add_executable(logTest
-# RIC-E2-TERMINATION/TEST/ASN_LOG/LogTest.h
-# RIC-E2-TERMINATION/TEST/ASN_LOG/LogTest.cpp)
+if (CMAKE_BUILD_TYPE STREQUAL "Debug")
+ LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake_modules")
+ set(CMAKE_BUILD_TYPE "Debug")
+ include(cmake-modules/CodeCoverage.cmake)
+ target_link_libraries(${PROJECT_TEST_NAME} gcov)
+
+ set(LDFLAGS "--coverage -fprofile-arcs")
+
+ # setup_target_for_coverage_lcov(${PROJECT_NAME}_coverage ${PROJECT_TEST_NAME} coverage)
+ set(COVERAGE_LCOV_EXCLUDES ${PROJECT_SOURCE_DIR}/config'
+ ${PROJECT_SOURCE_DIR}/log'
+ '${PROJECT_SOURCE_DIR}/docs'
+ '${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/3rdparty'
+ '${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/asn1cFiles'
+ '${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/TEST'
+ '${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/config')
+
+ set(COVERAGE_EXCLUDES '${PROJECT_SOURCE_DIR}/config'
+ ${PROJECT_SOURCE_DIR}/log'
+ '${PROJECT_SOURCE_DIR}/docs'
+ '${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/3rdparty'
+ '${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/asn1cFiles'
+ '${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/TEST'
+ '${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/config')
+ append_coverage_compiler_flags()
+ SETUP_TARGET_FOR_COVERAGE_LCOV(NAME e2_coverage
+ EXECUTABLE e2
+ DEPENDENCIES e2)
+endif ()
\ No newline at end of file
RUN wget --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr-dev_1.13.0_amd64.deb/download.deb
RUN dpkg -i rmr-dev_1.13.0_amd64.deb
+ARG BUILD_TYPE=Release
+
RUN apt-get install -y autoconf gawk libtool automake pkg-config autoconf-archive \
&& git clone http://gerrit.o-ran-sc.org/r/com/log \
- && cd log \
- && ./autogen.sh && ./configure && make && make install && ldconfig \
+ && cd log && ./autogen.sh && ./configure && make && make install && ldconfig \
&& cd /opt/e2/RIC-E2-TERMINATION/3rdparty && git clone https://github.com/jarro2783/cxxopts.git \
&& cd cxxopts && mkdir build && cd build && cmake .. && make install && ldconfig \
- && 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/Tencent/rapidjson.git \
+ && cd rapidjson && 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 \
- && cd /opt/e2/ && /usr/local/bin/cmake . && make
+ && cd /opt/e2/ && git clone https://github.com/bilke/cmake-modules.git \
+ && cd /opt/e2/ && /usr/local/bin/cmake -D CMAKE_BUILD_TYPE=$BUILD_TYPE . && make
+
+RUN if [$BUILD_TYPE == "Debug"] ; then make e2_coverage ; fi
# && git clone http://gerrit.o-ran-sc.org/r/ric-plt/tracelibcpp \
# && cd tracelibcpp && mkdir build && cd build \
return -1;
}
std::string line;
+ std::string section;
while (std::getline(file,line)) {
- if (!line.length()) { //line empty
+ if (!line.length() || line[0] == '#' || line[0] == ';' || line[0] == '{') {
continue;
- } else if (line[0] == '#') {
- continue;
- } else if (line[0] == ';') {
+ }
+// else if (line[0] == '#') {
+// continue;
+// } else if (line[0] == ';') {
+// continue;
+// }
+
+
+ if (line[0] =='[') { //section
+ auto sectionEnd = line.find(']');
+ if (sectionEnd == std::string::npos) {
+ mdclog_write(MDCLOG_ERR, "Error section definition: %s ", line.c_str());
+ section.clear();
+ return -1;
+// continue;
+ }
+ section = line.substr(1, sectionEnd - 1) + ".";
continue;
}
mdclog_write(MDCLOG_ERR, "problematic entry: %s ", line.c_str());
continue;
}
- auto name = line.substr(0,leftHand);
- trim(name);
+// auto name = line.substr(0,leftHand);
+// trim(name);
+ auto name = section + trim(line.substr(0, leftHand));
+
auto value = line.substr(leftHand+1);
if (value.length() == 0) {
mdclog_write(MDCLOG_ERR, "problematic entry: %s no value ", line.c_str());
private:
std::unordered_map<string, string> entries;
-
inline static std::string& ltrim(std::string& str, const std::string& chars = "\t\n\v\f\r ") {
str.erase(0, str.find_first_not_of(chars));
return str;
return str;
}
- inline static std::string& trim(std::string& str, const std::string& chars = "\t\n\v\f\r ") {
+ inline static std::string& trim(basic_string<char> str, const std::string& chars = "\t\n\v\f\r ") {
return ltrim(rtrim(str, chars), chars);
}
};
assert_that(conf.openConfigFile("config/config.bad") == 0);
}
+Ensure(Cgreen, sectionTest) {
+ ReadConfigFile conf {};
+ assert_that(conf.openConfigFile("config/config.sec") == 0);
+ assert_that(conf.getIntValue("config.nano") == 38000);
+}
+
+Ensure(Cgreen, sectionBadTest) {
+ ReadConfigFile conf {};
+ assert_that(conf.openConfigFile("config/config.secbad") == -1);
+ //assert_that(conf.getIntValue("config.nano") == 38000);
+}
int main(const int argc, char **argv) {
mdclog_severity_t loglevel = MDCLOG_INFO;
add_test_with_context(suite, Cgreen, badParams);
add_test_with_context(suite, Cgreen, wrongType);
add_test_with_context(suite, Cgreen, badValues);
+ add_test_with_context(suite, Cgreen, sectionTest);
+ add_test_with_context(suite, Cgreen, sectionBadTest);
return cgreen::run_test_suite(suite, create_text_reporter());
#include "asn1cFiles/FDD-Info.h"
#include "asn1cFiles/TDD-Info.h"
+#include "asn1cFiles/Neighbour-Information.h"
+
#include "asn1cFiles/constr_TYPE.h"
#include "asn1cFiles/asn_constant.h"
return eutraModeInfo;
}
+
+Neighbour_Information__Member *createNeighbour_Information__Member(ECGI_t *eCGI, long pci, long eARFCN) {
+ printEntry("Neighbour_Information__Member", __func__)
+ auto *nigborInformation = (Neighbour_Information__Member *)calloc(1, sizeof(Neighbour_Information__Member));
+ ASN_STRUCT_RESET(asn_DEF_Neighbour_Information, nigborInformation);
+
+ memcpy(&nigborInformation->eCGI, eCGI, sizeof(ECGI_t));
+ nigborInformation->pCI = pci;
+ nigborInformation->eARFCN = eARFCN;
+
+ if (mdclog_level_get() >= MDCLOG_DEBUG) {
+ checkAndPrint(&asn_DEF_Neighbour_Information, nigborInformation, (char *)"Neighbour_Information__Member", __func__);
+ }
+ return nigborInformation;
+}
+
+void buildNeighbour_InformationVector(Neighbour_Information_t *neighbourInformation, Neighbour_Information__Member *member) {
+ ASN_SEQUENCE_ADD(&neighbourInformation->list, member);
+}
+
//ServedCell-Information ::= SEQUENCE {
// pCI PCI,
// cellId ECGI,
// ...
//}
+/**
+ *
+ * @param pci
+ * @param cellId
+ * @param tac
+ * @param broadcastPLMNs
+ * @param eutranModeInfo
+ * @return
+ */
ServedCell_Information_t *createServedCellInfo(long pci,
ECGI_t *cellId,
TAC_t *tac,
vector<PLMN_Identity_t> &broadcastPLMNs,
EUTRA_Mode_Info_t *eutranModeInfo) {
+
printEntry("ServedCell_Information_t", __func__)
auto servedCellinfo = (ServedCell_Information_t *)calloc(1, sizeof(ServedCell_Information_t));
ASN_STRUCT_RESET(asn_DEF_ServedCell_Information, servedCellinfo);
}
-ServedCells__Member *createServedCellsMember() {
+ServedCells__Member *createServedCellsMember(ServedCell_Information_t *servedCellInfo, Neighbour_Information_t *neighbourInformation) {
printEntry("ServedCells__Member", __func__)
auto servedCellMember = (ServedCells__Member *)calloc(1, sizeof(ServedCells__Member));
- //servedCellMember->servedCellInfo
+ memcpy(&servedCellMember->servedCellInfo, servedCellInfo, sizeof(ServedCell_Information_t));
+ servedCellMember->neighbour_Info = neighbourInformation;
+
if (mdclog_level_get() >= MDCLOG_DEBUG) {
checkAndPrint(&asn_DEF_ServedCells, servedCellMember, (char *)"ServedCells__Member", __func__);
}
return servedCellMember;
}
+void buildServedCells(ServedCells_t *servedCells, ServedCells__Member *member) {
+ ASN_SEQUENCE_ADD(&servedCells->list, member);
+}
+
static void buildInitiatingMessagePDU(E2AP_PDU_t &pdu, InitiatingMessage_t *initMsg) {
pdu.present = E2AP_PDU_PR_initiatingMessage;
break;
}
case X2SetupRequest_IEs__value_PR_ServedCells: {
- memcpy(&x2SetupIE->value.choice.ServedCells, value, sizeof(*value));
+ memcpy(&x2SetupIE->value.choice.ServedCells, value, sizeof(ServedCells_t));
break;
}
case X2SetupRequest_IEs__value_PR_GUGroupIDList: {
- memcpy(&x2SetupIE->value.choice.GUGroupIDList, value, sizeof(*value));
+ memcpy(&x2SetupIE->value.choice.GUGroupIDList, value, sizeof(GUGroupIDList_t));
break;
}
case X2SetupRequest_IEs__value_PR_LHN_ID: {
- memcpy(&x2SetupIE->value.choice.LHN_ID, value, sizeof(*value));
+ memcpy(&x2SetupIE->value.choice.LHN_ID, value, sizeof(LHN_ID_t));
break;
}
case X2SetupRequest_IEs__value_PR_NOTHING:
return x2SetupIE;
}
-void buildE2SetupRequest(X2SetupRequest_t *x2Setup) {
-
+/**
+ *
+ * @param x2Setup
+ * @param member
+ */
+void buildE2SetupRequest(X2SetupRequest_t *x2Setup, vector<X2SetupRequest_IEs_t> &member) {
+ for (auto v : member) {
+ ASN_SEQUENCE_ADD(&x2Setup->protocolIEs.list, &v);
+ }
}
-void init_log()
-{
+void init_log() {
mdclog_attr_t *attr;
mdclog_attr_init(&attr);
- mdclog_attr_set_ident(attr, "e2smTests");
+ mdclog_attr_set_ident(attr, "setup Request");
mdclog_init(attr);
mdclog_attr_destroy(attr);
}
GlobalENB_ID_t *createGlobalENB_ID(PLMN_Identity_t *plmnIdentity, ENB_ID_t *enbId);
/**
*
- * @param plmnIdentity
+ * @param plmnIdent#ifdef __cplusplus
+}
+#endif
+ity
* @param gnb
* @return
*/
--- /dev/null
+/*
+ * Copyright 2019 AT&T Intellectual Property
+ * Copyright 2019 Nokia
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// Created by adi ENZEL on 12/19/19.
+//
+
+#include "e2test.h"
+
+
+
+int main(const int argc, char **argv) {
+
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright 2019 AT&T Intellectual Property
+ * Copyright 2019 Nokia
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// Created by adi ENZEL on 12/19/19.
+//
+
+#ifndef E2_E2TEST_H
+#define E2_E2TEST_H
+
+#include <algorithm>
+
+#include <pistache/net.h>
+#include <pistache/http.h>
+#include <pistache/peer.h>
+#include <pistache/http_headers.h>
+#include <pistache/cookie.h>
+#include <pistache/endpoint.h>
+#include <pistache/common.h>
+#include <pistache/router.h>
+
+
+using namespace Pistache;
+
+class e2test {
+
+ Rest::Router router;
+
+};
+
+
+#endif //E2_E2TEST_H
# 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
+tag: 3.0.5
message.message.messageType = rmrMessageBuffer.sendMessage->mtype = RIC_INDICATION;
snprintf((char *) tx, sizeof tx, "%15ld", transactionCounter++);
rmr_bytes2xact(rmrMessageBuffer.sendMessage, tx, strlen((const char *) tx));
- rmr_bytes2meid(rmrMessageBuffer.sendMessage, (unsigned char *)message.message.enodbName, strlen(message.message.enodbName));
+ rmr_bytes2meid(rmrMessageBuffer.sendMessage,
+ (unsigned char *)message.message.enodbName,
+ strlen(message.message.enodbName));
rmrMessageBuffer.sendMessage->state = 0;
rmrMessageBuffer.sendMessage->sub_id = (int) ie->value.choice.RICrequestID.ricRequestorID;
+ if (mdclog_level_get() >= MDCLOG_DEBUG) {
+ mdclog_write(MDCLOG_DEBUG, "RIC sub id = %d, message type = %d",
+ rmrMessageBuffer.sendMessage->sub_id,
+ rmrMessageBuffer.sendMessage->mtype);
+ }
sendRmrMessage(rmrMessageBuffer, message, &lspan);
messageSent = true;
} else {
(int) message.outLen);
}
-// char buff[256];
-// // build day time to seconds from epoc
-// strftime(buff, sizeof message.message.time, "%D %T", gmtime(&message.message.time.tv_sec));
-// // add nanosecond
-// snprintf(buff, sizeof buff, "%s.%09ld UTC\n", buff, message.message.time.tv_nsec);
-
- message.bufferLen = snprintf(message.buffer, sizeof(message.buffer),
+ snprintf(message.buffer, sizeof(message.buffer),
"{\"header\": {\"ts\": \"%ld.%09ld\","
"\"ranName\": \"%s\","
"\"messageType\": %d,"
long outLen;
unsigned char base64Data[RECEIVE_SCTP_BUFFER_SIZE * 2];
char buffer[RECEIVE_SCTP_BUFFER_SIZE * 8];
- size_t bufferLen;
} ReportingMessages_t;
cxxopts::ParseResult parse(int argc, char *argv[], sctp_params_t &pSctpParams);
--- /dev/null
+[config]
+nano=38000
+loglevel=info
+volume=log
+local-ip=127.0.0.1
+[xxxyyy]
+#trace is start, stop
+trace=start
+external-fqdn=e2t.att.com
\ No newline at end of file
--- /dev/null
+[config]
+nano=38000
+loglevel=info
+volume=log
+local-ip=127.0.0.1
+[xxxyyy
+#trace is start, stop
+trace=start
+external-fqdn=e2t.att.com
\ No newline at end of file