Home » Eclipse Projects » Eclipse Titan » make error in LTE test of coding by asn1c
|
Re: make error in LTE test of coding by asn1c [message #1763322 is a reply to message #1761375] |
Fri, 12 May 2017 15:33 |
|
Hi Coco,
Now, here's the thing:
I suppose you have downloaded the code from ETSI or 3GPP; the code published there is abstract meaning that
test ports, codecs etc. are not included as these are not standardized.
It is assumed that the implementation that will compile and execute this code will add these.
Implementations will solve the problem of encoding/decoding differently: Titan expects that encoding is invoked explicitly , either from the TTCN-3 code , or
from the C++ code of the test ports or other appropriate part of the code; other implementations will do this implicitly , for instance
when a message of a certain type is sent to a port, the implementation implies, based on the indications from the code ( 'with {encode "XXXX" }' instructions )
that the message has to be encoded a certain way.
This means that you will have to identify the points in the code where encoding/decoding has to be performed and invoke your codecs explicitly by calling the appropriate encoding/decoding functions.
(Remember, all your ASN.1 types will have to be encoded with BER , and the transcoded to PER whenever PER is implied- that's the whole idea of EnDec.cc )
If you send me your code I can assemble an example for one of the types described in ASN.1 , example that you can then propagate through your code.
Also please read through this post
Error in encvalue while compiling TTCN
https://www.eclipse.org/forums/index.php/t/1072021/
and maybe other posts by murli sharma, as he was working on something similar, and we discussed similar problems.
The answer to your second question is simpler:
you need to refer to types with the same name but originating from different modules by prefixing them with the module name:
EUTRA_RRC_ASN1_Definitions.DL-CCCH-Message
and
UTRAN_RRC_ASN1_Definitions.DL-CCCH-Message
respectively.
I hope this helps
Best regards
Elemer
|
|
| |
Re: make error in LTE test of coding by asn1c [message #1763368 is a reply to message #1763365] |
Sun, 14 May 2017 12:06 |
|
Hi Coco,
OK, let's proceed step by step.
First , I have verified if the source and header files generated by asn1c compile on their own.
For this, I have generated a Makefile (in EUTRA EncDec) that contains only these:
I have also added -I. to the CPPFLAGS to include the local directory in search:
# Flags for the C++ preprocessor (and makedepend as well):
CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)/include -I.
Compilation ends in an error:
AbsoluteTimeInfo-r10.c:123:4: error: 'APC_UNCONSTRAINED' was not declared in this scope
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
^
AbsoluteTimeInfo-r10.c:124:4: error: 'APC_CONSTRAINED' was not declared in this scope
{ APC_CONSTRAINED, 0, 0, 48, 48 } /* (SIZE(48..48)) */,
^
make: *** [AbsoluteTimeInfo-r10.o] Error 1
The reason for error is that you did not consider the changes that are explained in
https://www.eclipse.org/forums/index.php/t/1070344/
to make the code generated by asn1c C++ compatible (see toward the end of the post).
Please make the necessary changes and make sure that the code generated by asn1c and modified according to the above compiles.
We'll continue from here.
Best regards
Elemer
|
|
|
Re: make error in LTE test of coding by asn1c [message #1763393 is a reply to message #1763368] |
Mon, 15 May 2017 07:57 |
Coco Wang Messages: 6 Registered: February 2017 |
Junior Member |
|
|
Hi Elemer:
Thank you for your reply.
I have noticed that the asn1c generates code not entirely compatible with g++. When I read the userguide of asn1c, I noticed it has its own 'Makefile.am.sample'. I tried to use it to generate *.c/*.h of the asn files. And it did work during I tested my DL_CCCH_Message EncDec. Here is my project.
Since the whole project is too big, I 'make clean' the /bin. The .o files in /bin were generated by asn1c and copied in this file.
cd bin
make
./testcodec testcodec.cfg
The test suite can run and show 'pass'. Of course, to simplify my test, I have made little change for the EUTRA_RRC_ASN1.ttcn. I changed the 'messageExtension' to an INTEGER.
DL-CCCH-MessageType ::= CHOICE {
c1 CHOICE {
rrcConnectionReestablishment RRCConnectionReestablishment,
rrcConnectionReestablishmentReject RRCConnectionReestablishmentReject,
rrcConnectionReject RRCConnectionReject,
rrcConnectionSetup RRCConnectionSetup
},
[b]-- messageClassExtension SEQUENCE {}[/b]
[b]pVersion INTEGER(0..512)[/b]
}
For this reason, I doubt if I can 'make' the LTE_suite of 3GPP without change the *.c/*.h made by asn1c.
|
|
|
Re: make error in LTE test of coding by asn1c [message #1763453 is a reply to message #1763393] |
Tue, 16 May 2017 10:55 |
|
Hi Coco,
that's a smart move;
however , the result might be inconvenient as a "make clean' will erase the *.o files which have to be copied again and again.
So I propose to create a library instead of object files.
This is how to create a static library from the asn1c generated sources:
Edit the generated Makefile.am.sample, add the following lines:
LIBNAME = librrc.a
lib: ${OBJS}
ar -rcs ${LIBNAME} $^
The
make -f Makefile.am.sample lib
command will create the librrc.a static library.
now create two directories /include and /lib:
the /lib will contain the librrc.a static archive
and the /include all the header files generated by asn1c
Now edit the Titan Makefile and remove all asn1c generated source files from the USER_SOURCES and USER_HEADERS variable.
Next, modify the following rule:
$(EXECUTABLE): $(OBJECTS)
if $(CXX) $(LDFLAGS) -o $@ $(OBJECTS) \
-L$(TTCN3_DIR)/lib -l$(TTCN3_LIB) \
-L$(OPENSSL_DIR)/lib -lcrypto \
-L$(XMLDIR)/lib $($(PLATFORM)_LIBS) \
-lrrc -L../lib; \
then : ; else $(TTCN3_DIR)/bin/titanver $(OBJECTS); exit 1; fi
and add the /include directory to CPPFLAGS:
# Flags for the C++ preprocessor (and makedepend as well):
CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)/include -I../include
and one more thing:
to make the project more transportable, either use relative symlinks or
(as I have done) create a file that creates the symlinks.
See the attached compressed file. After unpacking,
you need first to edit file2 to adapt it to your directory structure,
then
cd bin
#create symlinks
../file2
#compile
make
#execute
./testcodec testcodec.cfg
should work.
Next , I will look into your question regarding errors about encoding/decoding.
Best regards
Elemer
[Updated on: Wed, 17 May 2017 07:02] Report message to a moderator
|
|
|
Re: make error in LTE test of coding by asn1c [message #1763458 is a reply to message #1763453] |
Tue, 16 May 2017 11:50 |
|
Hi Coco,
the reason for errors like below:
UTRAN_RRC_ASN1_Definitions.asn:1839: error: Cannot determine the encoding rules for type `@UTRAN-RRC-ASN1-Definitions.HandoverToUTRANCommand'. No encoding external functions found
UTRAN_RRC_ASN1_Definitions.asn:2859: error: Cannot determine the decoding rules for type `@UTRAN-RRC-ASN1-Definitions.InterRATHandoverInfo'. No decoding external functions found
NAS_24008TypeDefs.ttcn:775.6-778.1: error: Cannot determine the decoding rules for type `@NAS_24008TypeDefs.MS_RadioAccessCap_V'. No decoding external functions found
IMS_ASP_TypeDefs.ttcn:30.8-44.3: error: Cannot determine the decoding rules for type `@IMS_ASP_TypeDefs.IMS_Request_Type'. No decoding external functions found
LibSip_SIPTypesAndValues.ttcn:1795.12-1801.7: error: Cannot determine the decoding rules for type `@LibSip_SIPTypesAndValues.Response'. No decoding external functions found
LibSip_SIPTypesAndValues.ttcn:1795.12-1801.7: error: Cannot determine the encoding rules for type `@LibSip_SIPTypesAndValues.Response'. No encoding external functions found
is that somewhere in the code encvalue() or decvalue() is invoked for a TTCN-3 or ASN.1 type and Titan cannot find the appropriate codec.
This can made visible for instance for NAS_CommonTypeDefs.ttcn:
originally this error is present:
NAS_CommonTypeDefs.ttcn:287.6-310.1: error: Cannot determine the decoding rules for type `@NAS_CommonTypeDefs.MS_Clsmk2'. No decoding external functions found
NAS_CommonTypeDefs.ttcn:318.6-408.1: error: Cannot determine the decoding rules for type `@NAS_CommonTypeDefs.MS_Clsmk3'. No decoding external functions found
NAS_CommonTypeDefs.ttcn has a final encoding instruction:
module NAS_CommonTypeDefs {
:
} with { encode "NAS Types" }
that tells Titan it should look for an external function that can encode/decode NAS_Types, something like:
external function enc_NAS_Types ( in NAS_Types pdu) return octetstring
with { extension "prototype(convert) encode(NAS_Types)" };
external function dec_NAS_Types ( inout octetstring stream, out NAS_Types pdu ) return integer
with { extension "prototype(sliding) decode(NAS_Types)" };
but no such function exists.
If we remove the final encoding instruction
module NAS_CommonTypeDefs {
:
} //with { encode "NAS Types" }
then a new error appears , revealing the root cause :
GERAN_CapabilityFunctions.ttcn:108.30-95: In the parameters of decvalue():
NAS_CommonTypeDefs.ttcn:287.6-310.1: error: No coding rule specified for type '@NAS_CommonTypeDefs.MS_Clsmk2'
As solutions are a bit different for ASN.1 and TTCN-3 , I will treat them separately.
In case of ASN.1 , the only natively supported codec is BER; if your protocol is BER -encoded (which is not the case here, I just mention this for completeness) than you need to declare external functions for BER as below:
external function enc_SomeType(in SomeType pdu) return octetstring
with { extension "prototype(convert) encode(BER:BER_ENCODE_DER)" };
external function dec_SomeType(in octetstring stream) return SomeType
with { extension "prototype(convert) decode(BER:BER_ACCEPT_ALL)" };
Titan will automatically generate the BER codecs, so there is nothing further to be done.
In our case we need PER codecs, so you will have to declare a PER codec pair (encode/decoder) for each type that appears in the error log:
For example:
module EUTRA_Types
{
import from EUTRA_RRC_ASN1_Definitions language "ASN.1:1997" all;
external function enc_DCC_PDU( in DL_CCCH_Message pdu) return bitstring
with { extension "prototype(convert) encode(PER)" };
external function dec_DCC_PDU (inout bitstring stream, out DL_CCCH_Message pdu) return integer
with { extension "prototype(sliding) decode(PER)" };
external function enc_DL_DCCH( in DL_DCCH_Message pdu) return bitstring
with { extension "prototype(convert) encode(PER)" };
external function dec_DL_DCCH( inout bitstring stream, out DL_DCCH_Message pdu ) return integer
with { extension "prototype(sliding) decode(PER)" };
external function enc_UE_EUTRA_Capability( in UE_EUTRA_Capability pdu) return bitstring
with { extension "prototype(convert) encode(PER)" };
external function dec_UE_EUTRA_Capability( inout bitstring stream, out UE_EUTRA_Capability pdu ) return integer
with { extension "prototype(sliding) decode(PER)" };
:
:
//and so on
}
and of course each of these functions will have to have a corresponding entry in EUTRA_EncDec.cc.
If you want to avoid writing all these functions , you can create a union of all types , a CHOICE in ASN.1 , and then one function needs to be written only ; however the downside of this is that encvalue/decvalue references will have to be modified throughout the code as they refer to "Type" and not "ChoiceType.Type".
OK, now for TTCN-3 types I recommend first you remove all encoding instructions such as 'with {encode "SomeString"}' .
Next you need to understand what kind of encoding is needed for each module; I'm guessing it will be either RAW or XML. Subsequently, each module will have to have an appropriate final
'with {encode "RAW"}'
or
'with {encode "XER"}'
encoding instruction.
(see earlier posts about XML and RAW encoding)
Next , these external functions will have to be declared.
When these are declared, the afore-mentioned errors will disappear,
but new errors will appear when linking, as Titan may not find the code that corresponds to these declarations.
Good news is , Titan will auto-generate the codec functions ; bad news is , for this the RAW -encoded types will have to be decorated with appropriate instructions; For XML , it's simpler , as the instructions can be generated from the Schema (XSD file) from which the types originate.
OK, this is quite a lot to digest , so I'll stop here; please ask me if you have further questions or anything is unclear.
Best regards
Elemer
[Updated on: Tue, 16 May 2017 11:57] Report message to a moderator
|
|
| |
Re: make error in LTE test of coding by asn1c [message #1764051 is a reply to message #1764042] |
Wed, 24 May 2017 11:08 |
|
Hi Coco,
the answer to your first question is simple:
change
var bitstring v_Bitstring := f_enc_DL_CCCH_Message(p_CCCH_Message);
to
var bitstring v_Bitstring := f_enc_DL_CCCH_Message(valueof(p_CCCH_Message));
For the test port , please look into chapter 2 of the Titan API guide ,
and also into the code of already published test ports in github.
If your communication is based on UDP you can probably re-use the UDP test port either as code or e.g. in a translation port /dual-faced port setup (see forum for posts on these topics).
Best regards
Elemer
|
|
| | | | |
Re: make error in LTE test of coding by asn1c [message #1764239 is a reply to message #1764234] |
Sat, 27 May 2017 05:48 |
|
Hi Coco,
yes, we noticed this problem before:
what happens is that MTC starts a new PTC here:
v_echo_CT.start(f_echo())
f_echo itself contains a map operation:
function f_echo() runs on Echo_SNMP_CT
{
var ASP_UDP v_ASP_UDP_r, v_ASP_UDP
map(self:UDP_PCO, system:UDP_PCO);
:
:
and this part (starting a parallel component, starting the function on it, mapping) executes slower on virtual machines than on physical machines;
so what happens is that MTC sends the SNMP message to the PTC before the PTC is ready to receive, and in consequence receives no answer.
Again this seems to happen on virtual machines only.
The simple remedy is to add a short delay(1 sec should be sufficient):
:
v_echo_CT.start(f_echo())
timer T1 := 1.0;
T1.start;T1.timeout;
map(self:UDP_PCO_DF, system:UDP_PCO_DF);
var integer v_Id := f_Test_openConnection(tsp_connectionParams,-1);
//SNMP V1
UDP_PCO_DF.send(t_snmp_v1_getrequest_msg(5,{}));
:
but the problem itself is more complex and comes back to synchronization between asynchronous events.
I think I'll write a separate post about it.
BTW, You'll notice that in the translation port example published recently we have added this delay.
I hope this helps
BR
Elemer
|
|
|
Re: make error in LTE test of coding by asn1c [message #1769027 is a reply to message #1763393] |
Tue, 25 July 2017 23:06 |
taqi raza Messages: 3 Registered: July 2017 |
Junior Member |
|
|
Dear Coco,
I am also new TTCN and TITAN and thought to use your example to compile.
I have downloaded your code, file named "LTE_Small.zip" [ as your source code file RRC_ASN_Test.tar.gz has broken links in /bin]. Unzipped it, and made following changes to Makefile.am.sample" within EUTRA_EncDec folder.
CFLAGS += -I.
..
$(TARGET): ${OBJS}
$(CC) $(CFLAGS) -DPDU=DL-CCCH-Message -o $(TARGET) ${OBJS} $(LDFLAGS) $(LIBS)
..
.c.o:
$(CC) $(CFLAGS) -DPDU=DL-CCCH-Message -o $@ -c $<
and then run "make -f Makefile.am.sample" within EUTRA_EncDec folder. The code compiled successfully (no errors).
But when I run "make" within /bin folder, i get following errors:
error: Cannot recognize file `RRC_ConnEst.ttcn' as an ASN.1 or TTCN-3 module. Use the command-line switch `-A' or `-T' to set its type.
error: Cannot recognize file `RRC_ConnRel_C2K.ttcn' as an ASN.1 or TTCN-3 module. Use the command-line switch `-A' or `-T' to set its type.
... and so on.
can you please let me know where did I make mistake.
thank you.
taqi
[Updated on: Thu, 27 July 2017 23:47] Report message to a moderator
|
|
| |
Re: make error in LTE test of coding by asn1c [message #1776876 is a reply to message #1776872] |
Wed, 22 November 2017 12:50 |
|
Hi JC,
sorry, it's not clear which .tgz you are referring to.
Is it the above RRC_ASN_mod.tgz ?
(https://www.eclipse.org/forums/index.php?t=getfile&id=29358&) ?
Which Titan version you are using? You have downloaded the binary or built it for your self?
It appears that it has problems with the newly introduced OER codec;
try to switch OER codec generation off by using -O in the Makefile by using -O;
also, use the -e flag in the Makefile to switch off multiple encoding:
# Flags for the TTCN-3 and ASN.1 compiler:
COMPILER_FLAGS = -L .... -e -O
and let me know the result.
BR
Elemer
|
|
|
Re: make error in LTE test of coding by asn1c [message #1776877 is a reply to message #1776872] |
Wed, 22 November 2017 12:50 |
|
Hi JC,
sorry, it's not clear which .tgz you are referring to.
Is it the above RRC_ASN_mod.tgz ?
(https://www.eclipse.org/forums/index.php?t=getfile&id=29358&) ?
Which Titan version you are using? You have downloaded the binary or built it for your self?
It appears that it has problems with the newly introduced OER codec;
try to switch OER codec generation off by using -O in the Makefile by using -O;
also, use the -e flag in the Makefile to switch off multiple encoding:
# Flags for the TTCN-3 and ASN.1 compiler:
COMPILER_FLAGS = -L .... -e -O
and let me know the result.
BR
Elemer
|
|
|
Re: make error in LTE test of coding by asn1c [message #1776889 is a reply to message #1776877] |
Wed, 22 November 2017 14:43 |
JC Yang Messages: 8 Registered: June 2017 |
Junior Member |
|
|
Hi Elemer,
1.
I use the RRC_ASN_mod.tgz downloaded from (https://www.eclipse.org/forums/index.php?t=getfile&id=29358&).
2.
Titan env. is as below, and source make & install.
TTCN-3 and ASN.1 Compiler for the TTCN-3 Test Executor
Product number: CRL 113 200/6 R3A
Compiled with: GCC 6.3.0
Using OpenSSL 1.0.2g 1 Mar 2016
3.
# Flags for the TTCN-3 and ASN.1 compiler:
COMPILER_FLAGS = -L .... -e -O
Using your suggestion compiling flag can pass above code line number, and with new error stuck as below:
Compiling stuck in
======
EUTRA_RRC_ASN1_Definitions.cc: In member function 'boolean EUTRA__RRC__ASN1__Definitions::CSFBParametersResponseCDMA2000_criticalExtensions_template::match(const EUTRA__RRC__ASN1__Definitions::CSFBParametersResponseCDMA2000_criticalExtensions&, boolean) const':
EUTRA_RRC_ASN1_Definitions.cc:494712:0: note: -Wmisleading-indentation is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers
switch (template_selection) {
======
boolean CSFBParametersResponseCDMA2000_criticalExtensions_template::match(const CSFBParametersResponseCDMA2000_criticalExtensions& other_value, boolean legacy) const
{
if (!other_value.is_bound()) return FALSE;
switch (template_selection) { /* <== EUTRA_RRC_ASN1_Definitions.cc:494712 */
case ANY_VALUE:
case ANY_OR_OMIT:
return TRUE;
case OMIT_VALUE:
return FALSE;
case SPECIFIC_VALUE:
{
CSFBParametersResponseCDMA2000_criticalExtensions::union_selection_type value_selection = other_value.get_selection();
if (value_selection == CSFBParametersResponseCDMA2000_criticalExtensions::UNBOUND_VALUE) return FALSE;
if (value_selection != single_value.union_selection) return FALSE;
switch (value_selection) {
case CSFBParametersResponseCDMA2000_criticalExtensions::ALT_csfbParametersResponseCDMA2000__r8:
return single_value.field_csfbParametersResponseCDMA2000__r8->match(other_value.csfbParametersResponseCDMA2000__r8(), legacy);
case CSFBParametersResponseCDMA2000_criticalExtensions::ALT_criticalExtensionsFuture:
return single_value.field_criticalExtensionsFuture->match(other_value.criticalExtensionsFuture(), legacy);
default:
TTCN_error("Internal error: Invalid selector in a specific value when matching a template of union type @EUTRA-RRC-ASN1-Definitions.CSFBParametersResponseCDMA2000.criticalExtensions.");
}
}
case VALUE_LIST:
case COMPLEMENTED_LIST:
for (unsigned int list_count = 0; list_count < value_list.n_values; list_count++)
if (value_list.list_value[list_count].match(other_value, legacy)) return template_selection == VALUE_LIST;
return template_selection == COMPLEMENTED_LIST;
default:
TTCN_error ("Matching an uninitialized template of union type @EUTRA-RRC-ASN1-Definitions.CSFBParametersResponseCDMA2000.criticalExtensions.");
}
return FALSE;
}
If you can give more suggestion, I can try to compile if succeed or not.
Thanks
JC
|
|
| | | | | |
Goto Forum:
Current Time: Tue Sep 24 16:42:49 GMT 2024
Powered by FUDForum. Page generated in 0.06300 seconds
|