version 4.0.6 71/3071/1
authoraa7133@att.com <aa7133@att.com>
Tue, 31 Mar 2020 10:35:06 +0000 (13:35 +0300)
committeraa7133@att.com <aa7133@att.com>
Tue, 31 Mar 2020 10:35:25 +0000 (13:35 +0300)
added routing to docker router and added E2SM paramters to the setupRequest testing
Add fix to thedocker file

Change-Id: Icbab3ef73094ceed5cb3bbec4cf4d88b8409e71e
Signed-off-by: aa7133@att.com <aa7133@att.com>
RIC-E2-TERMINATION/Dockerfile
RIC-E2-TERMINATION/TEST/T1/E2Builder.h
RIC-E2-TERMINATION/TEST/testAsn/setUpMessages/SetUpMessages.cpp
RIC-E2-TERMINATION/dockerRouter.txt

index f341268..46d9c29 100644 (file)
@@ -76,14 +76,7 @@ RUN if [$BUILD_TYPE == "Debug"] ; then make e2_coverage ; fi
 #    && find / -type f -name "libopentracing.a" -exec cp {} libopentracing.a \; && cd /opt/e2/RIC-E2-TERMINATION && ls nlohmann  \
 
 FROM ubuntu:18.04
-
-RUN apt-get update && apt-get install -y \
-  net-tools \
-  iputils-ping \
-  curl \
-  tcpdump
-  
-RUN mkdir -p /opt/e2/config
+RUN apt-get update && apt-get install -y net-tools iputils-ping curl tcpdump && mkdir -p /opt/e2/config
 
 COPY --from=ubuntu /opt/e2/e2 /opt/e2/e2
 COPY --from=ubuntu /opt/e2/rmr.verbose /tmp/rmr.verbose
@@ -154,4 +147,3 @@ ENV E2TERM_POD_NAME=e2term
 RUN chmod +x /opt/e2/startup.sh
 EXPOSE 38000
 CMD ["sh", "-c", "./startup.sh"]
-
index c8f6f39..039f7c5 100644 (file)
@@ -29,6 +29,9 @@
 #include <sys/types.h>
 #include <error.h>
 #include <algorithm>
+#include <3rdparty/oranE2SM/E2SM-gNB-NRT-RANfunction-Definition.h>
+#include <3rdparty/oranE2SM/RIC-InsertStyle-List.h>
+#include <3rdparty/oranE2SM/RANparameterDef-Item.h>
 
 
 //#include <mdclog/mdclog.h>
@@ -527,16 +530,80 @@ void buildSetupRequestWithFunc(E2AP_PDU_t *pdu, int mcc, int mnc) {
     auto *itemIes = (RANfunction_ItemIEs_t *)calloc(1, sizeof(RANfunction_ItemIEs_t));
     ASN_STRUCT_RESET(asn_DEF_RANfunction_ItemIEs, itemIes);
 
-    uint8_t buf[3] = {0x33, 0x44, 0x55};
+
+    E2SM_gNB_NRT_RANfunction_Definition_t ranFunDef;
+    uint8_t funcDes[] = "asdfghjklpoiuytrewq\0";
+    ranFunDef.ranFunction_Name.ranFunction_Description.buf = (uint8_t *)calloc(1, strlen((char *)funcDes));
+    ranFunDef.ranFunction_Name.ranFunction_Description.size = strlen((char *)funcDes);
+    memcpy(ranFunDef.ranFunction_Name.ranFunction_Description.buf, funcDes, strlen((char *)funcDes));
+
+    uint8_t funcOID[] = "ABCDEFGHIJ1234567890\0";
+    ranFunDef.ranFunction_Name.ranFunction_E2SM_OID.buf = (uint8_t *)calloc(1, strlen((char *)funcOID));
+    ranFunDef.ranFunction_Name.ranFunction_E2SM_OID.size = strlen((char *)funcOID);
+    memcpy(ranFunDef.ranFunction_Name.ranFunction_E2SM_OID.buf, funcOID, strlen((char *)funcOID));
+
+    uint8_t shortName[] = "Nothing to declare\0";
+    ranFunDef.ranFunction_Name.ranFunction_ShortName.buf = (uint8_t *)calloc(1, strlen((char *)shortName));
+    ranFunDef.ranFunction_Name.ranFunction_ShortName.size = strlen((char *)shortName);
+    memcpy(ranFunDef.ranFunction_Name.ranFunction_ShortName.buf, shortName, strlen((char *)shortName));
+
+
+    RIC_InsertStyle_List_t insertStyleList;
+    insertStyleList.ric_CallProcessIDFormat_Type = 28l;
+    insertStyleList.ric_IndicationHeaderFormat_Type = 29;
+    insertStyleList.ric_IndicationMessageFormat_Type = 30;
+    insertStyleList.ric_InsertActionFormat_Type = 31l;
+
+    uint8_t styleName[] = "What a style\0";
+
+    insertStyleList.ric_InsertStyle_Name.buf = (uint8_t *)calloc(1, strlen((char *)styleName));
+    insertStyleList.ric_InsertStyle_Name.size = strlen((char *)styleName);
+    memcpy(insertStyleList.ric_InsertStyle_Name.buf, styleName, strlen((char *)styleName));
+
+
+    insertStyleList.ric_InsertStyle_Type = 23;
+
+    RANparameterDef_Item_t raNparameterDefItem;
+    raNparameterDefItem.ranParameter_ID = 8;
+    raNparameterDefItem.ranParameter_Type = 12;
+
+    uint8_t ItemName[] = "What a style\0";
+    raNparameterDefItem.ranParameter_Name.buf = (uint8_t *)calloc(1, strlen((char *)ItemName));
+    raNparameterDefItem.ranParameter_Name.size = strlen((char *)ItemName);
+    memcpy(raNparameterDefItem.ranParameter_Name.buf, ItemName, strlen((char *)ItemName));
+
+    ASN_SEQUENCE_ADD(&insertStyleList.ric_InsertRanParameterDef_List.list, &raNparameterDefItem);
+
+    ASN_SEQUENCE_ADD(&ranFunDef.ric_InsertStyle_List->list, &insertStyleList);
+    //ranFunDef.ric_InsertStyle_List.
+
+    uint8_t buffer[8192];
+    size_t buffer_size = 8192;
+    auto *ranDef = &itemIes->value.choice.RANfunction_Item.ranFunctionDefinition;
+
+    auto er = asn_encode_to_buffer(nullptr, ATS_ALIGNED_BASIC_PER, &asn_DEF_E2SM_gNB_NRT_RANfunction_Definition, &ranFunDef, buffer, buffer_size);
+    if (er.encoded == -1) {
+        cerr << "encoding of " << asn_DEF_E2SM_gNB_NRT_RANfunction_Definition.name << " failed, " << strerror(errno) << endl;
+        exit(-1);
+    } else if (er.encoded > (ssize_t) buffer_size) {
+        cerr << "Buffer of size " << buffer_size << " is to small for " << asn_DEF_E2SM_gNB_NRT_RANfunction_Definition.name << endl;
+        exit(-1);
+    } else {
+        ranDef->buf = (uint8_t *)calloc(1, er.encoded);
+        ranDef->size = er.encoded;
+        memcpy(ranDef->buf, buffer, ranDef->size);
+    }
+
+
 
     itemIes->id = ProtocolIE_ID_id_RANfunction_Item;
     itemIes->criticality = Criticality_reject;
     itemIes->value.present = RANfunction_ItemIEs__value_PR_RANfunction_Item;
     itemIes->value.choice.RANfunction_Item.ranFunctionID = 1;
-    auto *ranDef = &itemIes->value.choice.RANfunction_Item.ranFunctionDefinition;
-    ranDef->size = 3;
-    ranDef->buf = (uint8_t *)calloc(1, ranDef->size);
-    memcpy(ranDef->buf, buf, ranDef->size);
+//    auto *ranDef = &itemIes->value.choice.RANfunction_Item.ranFunctionDefinition;
+//    ranDef->size = 3;
+//    ranDef->buf = (uint8_t *)calloc(1, ranDef->size);
+//    memcpy(ranDef->buf, buf, ranDef->size);
 
     ASN_SEQUENCE_ADD(&ranFlistIEs->value.choice.RANfunctions_List.list, itemIes);
 
@@ -547,9 +614,11 @@ void buildSetupRequestWithFunc(E2AP_PDU_t *pdu, int mcc, int mnc) {
     itemIes1->value.present = RANfunction_ItemIEs__value_PR_RANfunction_Item;
     itemIes1->value.choice.RANfunction_Item.ranFunctionID = 7;
     ranDef = &itemIes1->value.choice.RANfunction_Item.ranFunctionDefinition;
-    ranDef->size = 3;
-    ranDef->buf = (uint8_t *)calloc(1, ranDef->size);
-    memcpy(ranDef->buf, buf, ranDef->size);
+
+    ranDef->buf = (uint8_t *)calloc(1, er.encoded);
+    ranDef->size = er.encoded;
+    memcpy(ranDef->buf, buffer, ranDef->size);
+
     ASN_SEQUENCE_ADD(&ranFlistIEs->value.choice.RANfunctions_List.list, itemIes1);
 
 
index 542e16f..7137401 100644 (file)
@@ -68,41 +68,76 @@ void extractPdu(E2AP_PDU_t *pdu, unsigned char *buffer, int buffer_size) {
     } else {
         cout << "XML result = " << buffer << endl;
     }
-
 }
 
-unsigned char setupBuffer[309] = {
-        0x00, 0x01, 0x00, 0x82, 0x64, 0x00, 0x00, 0x02, 0x00, 0x03,
-        0x00, 0x08, 0x00, 0x02, 0xf8, 0x21, 0x03, 0x03, 0x03, 0x00,
-        0x00, 0xa0, 0x08, 0x25, 0x00, 0x00, 0x30, 0x00, 0x84, 0x08,
-        0x0d, 0xf0, 0x00, 0x00, 0x18, 0x0d, 0x87, 0x90, 0x28, 0x06,
-        0x74, 0xe4, 0x22, 0xd5, 0x83, 0x20, 0x00, 0x02, 0x03, 0x12,
-        0xe3, 0x32, 0xe3, 0x62, 0xe3, 0x12, 0xe3, 0x42, 0xe3, 0x12,
-        0xe3, 0x23, 0x83, 0x43, 0x53, 0x82, 0xe3, 0x93, 0x92, 0xe3,
-        0x02, 0xe3, 0x23, 0x12, 0xe3, 0x32, 0xe3, 0x32, 0xe3, 0x12,
-        0xe3, 0x20, 0xb8, 0x06, 0x74, 0xe4, 0x22, 0x05, 0x83, 0x22,
-        0x04, 0xe6, 0x57, 0x47, 0x76, 0xf7, 0x26, 0xb2, 0x04, 0x96,
-        0xe7, 0x46, 0x57, 0x26, 0x66, 0x16, 0x36, 0x50, 0x10, 0x00,
-        0x00, 0x10, 0x10, 0x80, 0x04, 0xd6, 0x57, 0x37, 0x36, 0x16,
-        0x76, 0x52, 0x05, 0x47, 0x97, 0x06, 0x52, 0x06, 0xf6, 0xe6,
-        0xc7, 0x90, 0x10, 0x10, 0x00, 0x10, 0x10, 0x78, 0x04, 0x36,
-        0xf6, 0xd7, 0x06, 0xc6, 0x57, 0x46, 0x52, 0x06, 0xd6, 0x57,
-        0x37, 0x36, 0x16, 0x76, 0x50, 0x10, 0x10, 0x00, 0x00, 0x10,
-        0x58, 0x04, 0x16, 0x46, 0x45, 0x46, 0x96, 0xd6, 0x57, 0x37,
-        0x46, 0x16, 0xd7, 0x02, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00,
-        0x10, 0x10, 0x78, 0x04, 0x36, 0xf6, 0xd7, 0x06, 0xc6, 0x57,
-        0x46, 0x52, 0x06, 0xd6, 0x57, 0x37, 0x36, 0x16, 0x76, 0x50,
-        0x10, 0x10, 0x00, 0x00, 0x10, 0x58, 0x04, 0x16, 0x46, 0x45,
-        0x46, 0x96, 0xd6, 0x57, 0x37, 0x46, 0x16, 0xd7, 0x02, 0x00,
-        0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x78,
-        0x04, 0x36, 0xf6, 0xd7, 0x06, 0xc6, 0x57, 0x46, 0x52, 0x06,
-        0xd6, 0x57, 0x37, 0x36, 0x16, 0x76, 0x50, 0x10, 0x10, 0x10,
-        0x10, 0x10, 0x10, 0x00, 0x10, 0x00, 0x84, 0x08, 0x0a, 0xc0,
-        0x00, 0x00, 0x28, 0x0a, 0x56, 0x80, 0x30, 0x06, 0x74, 0xe4,
-        0x22, 0xd4, 0xe5, 0x25, 0x40, 0x00, 0x02, 0x03, 0x12, 0xe3,
-        0x32, 0xe3, 0x62, 0xe3, 0x12, 0xe3, 0x42, 0xe3, 0x12, 0xe3,
-        0x23, 0x83, 0x43, 0x53, 0x82, 0xe3, 0x93, 0x92, 0xe3, 0x02,
-        0xe3, 0x23, 0x12, 0xe3, 0x32, 0xe3, 0x32, 0xe3, 0};
+
+std::string otherXml = "<E2AP-PDU>\n"
+                       "    <successfulOutcome>\n"
+                       "        <procedureCode>1</procedureCode>\n"
+                       "        <criticality><reject/></criticality>\n"
+                       "        <value>\n"
+                       "            <E2setupResponse>\n"
+                       "                <protocolIEs>\n"
+                       "                    <E2setupResponseIEs>\n"
+                       "                        <id>4</id>\n"
+                       "                        <criticality><reject/></criticality>\n"
+                       "                        <value>\n"
+                       "                            <GlobalRIC-ID>\n"
+                       "                                <pLMN-Identity>13 10 14</pLMN-Identity>\n"
+                       "                                <ric-ID>\n"
+                       "                                    10011001101010101011"
+                       "                                </ric-ID>\n"
+                       "                            </GlobalRIC-ID>\n"
+                       "                        </value>\n"
+                       "                    </E2setupResponseIEs>\n"
+                       "                    <E2setupResponseIEs>\n"
+                       "                        <id>9</id>\n"
+                       "                        <criticality><reject/></criticality>\n"
+                       "                        <value>\n"
+                       "                            <RANfunctionsID-List>\n"
+                       "                                <ProtocolIE-SingleContainer>\n"
+                       "                                    <id>6</id>\n"
+                       "                                    <criticality><ignore/></criticality>\n"
+                       "                                    <value>\n"
+                       "                                        <RANfunctionID-Item>\n"
+                       "                                            <ranFunctionID>1</ranFunctionID>\n"
+                       "                                            <ranFunctionRevision>1</ranFunctionRevision>\n"
+                       "                                        </RANfunctionID-Item>\n"
+                       "                                    </value>\n"
+                       "                                </ProtocolIE-SingleContainer>\n"
+                       "                                <ProtocolIE-SingleContainer>\n"
+                       "                                    <id>6</id>\n"
+                       "                                    <criticality><ignore/></criticality>\n"
+                       "                                    <value>\n"
+                       "                                        <RANfunctionID-Item>\n"
+                       "                                            <ranFunctionID>2</ranFunctionID>\n"
+                       "                                            <ranFunctionRevision>1</ranFunctionRevision>\n"
+                       "                                        </RANfunctionID-Item>\n"
+                       "                                    </value>\n"
+                       "                                </ProtocolIE-SingleContainer>\n"
+                       "                                <ProtocolIE-SingleContainer>\n"
+                       "                                    <id>6</id>\n"
+                       "                                    <criticality><ignore/></criticality>\n"
+                       "                                    <value>\n"
+                       "                                        <RANfunctionID-Item>\n"
+                       "                                            <ranFunctionID>3</ranFunctionID>\n"
+                       "                                            <ranFunctionRevision>1</ranFunctionRevision>\n"
+                       "                                        </RANfunctionID-Item>\n"
+                       "                                    </value>\n"
+                       "                                </ProtocolIE-SingleContainer>\n"
+                       "                            </RANfunctionsID-List>\n"
+                       "                        </value>\n"
+                       "                    </E2setupResponseIEs>\n"
+                       "                </protocolIEs>\n"
+                       "            </E2setupResponse>\n"
+                       "        </value>\n"
+                       "    </successfulOutcome>\n"
+                       "</E2AP-PDU>\n";
+
+
+
+std::string newXml =
+        "<E2AP-PDU><successfulOutcome><procedureCode>1</procedureCode><criticality><reject/></criticality><value><E2setupResponse><protocolIEs><E2setupResponseIEs><id>4</id><criticality><reject/></criticality><value><GlobalRIC-ID><pLMN-Identity>13 10 14</pLMN-Identity><ric-ID>10101010110011001110</ric-ID></GlobalRIC-ID></value></E2setupResponseIEs><E2setupResponseIEs><id>9</id><criticality><reject/></criticality><value><RANfunctionsID-List><ProtocolIE-SingleContainer><id>6</id><criticality><ignore/></criticality><value><RANfunctionID-Item><ranFunctionID>1</ranFunctionID><ranFunctionRevision>1</ranFunctionRevision></RANfunctionID-Item></value></ProtocolIE-SingleContainer><ProtocolIE-SingleContainer><id>6</id><criticality><ignore/></criticality><value><RANfunctionID-Item><ranFunctionID>2</ranFunctionID><ranFunctionRevision>1</ranFunctionRevision></RANfunctionID-Item></value></ProtocolIE-SingleContainer><ProtocolIE-SingleContainer><id>6</id><criticality><ignore/></criticality><value><RANfunctionID-Item><ranFunctionID>3</ranFunctionID><ranFunctionRevision>1</ranFunctionRevision></RANfunctionID-Item></value></ProtocolIE-SingleContainer></RANfunctionsID-List></value></E2setupResponseIEs></protocolIEs></E2setupResponse></value></successfulOutcome></E2AP-PDU>";
 
 auto main(const int argc, char **argv) -> int {
     E2AP_PDU_t pdu;
@@ -112,6 +147,19 @@ auto main(const int argc, char **argv) -> int {
     auto buffer_size =  8192;
     unsigned char buffer[8192] = {};
 
+    E2AP_PDU_t *XERpdu  = nullptr;
+    auto rval = asn_decode(nullptr, ATS_BASIC_XER, &asn_DEF_E2AP_PDU, (void **) &XERpdu,
+                           newXml.c_str(), newXml.length());
+    if (rval.code != RC_OK) {
+        cout <<  "Error " << rval.code << " (unpack) setup response " << endl;
+        //return -1;
+    }
+
+    asn_fprint(stream, &asn_DEF_E2AP_PDU, XERpdu);
+    cout << "Encoding E2AP PDU of size  " << size << endl << printBuffer << endl;
+    fseek(stream,0,SEEK_SET);
+
+//    cout << "=========================" << endl << otherXml << endl << "========================" << endl;
 
     buildSetupRequest(&pdu, 311, 410);
     asn_fprint(stream, &asn_DEF_E2AP_PDU, &pdu);
@@ -144,6 +192,7 @@ auto main(const int argc, char **argv) -> int {
 
     extractPdu(&pdu, buffer, buffer_size);
 
+
     cout << "Failure outcome" << endl;
     ASN_STRUCT_RESET(asn_DEF_E2AP_PDU, &pdu);
     memset(buffer, 0, buffer_size);
index 46f5b05..f14a197 100644 (file)
@@ -22,7 +22,5 @@ rte|10091|10.0.2.15:4801
 rte|10092|10.0.2.15:4801
 rte|1101|10.0.2.15:38000
 rte|1102|10.0.2.15:3801
-rte|12001|10.0.2.15:3801        
+rte|12001|10.0.2.15:3801
 newrt|end
-
-