Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » Porting the ETSI IPv6 test suite to Titan part I
Porting the ETSI IPv6 test suite to Titan part I [message #1782776] Thu, 01 March 2018 10:06 Go to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Dear all,

as promised (https://www.eclipse.org/forums/index.php/t/1091853/), we will look into compiling the ETSI IPV6 test suite
( available here http://www.ttcn-3.org/index.php/downloads/publicts/publicts-etsi/25-publicts-ipv6)
with Titan.
I will do this step by step, analyzing the errors encountered; it's probably a boring read unless you download the code yourself and
closely follow. Impatient readers can skip this and go straight to the attached package which is compilable; but not functional, for the reasons I will explain below.
The compiler used is the binary built from the latest source.
The output of the exercise will be a bunch of code that compiles , but will not execute, for the following reasons:
as explained in https://www.eclipse.org/forums/index.php/t/1087046/ , large areas of a TTCN-3 code are not standardized,
namely external functions, test ports and codec, so when migrating from one tool to another these will have to be adjusted.

OK so after downloading and unzipping the compressed package , this is the resulting directory structure:


tree          
.                                                           
|-- EtsiAts                                                 
|   `-- AtsIpv6                                             
|       |-- AtsCommon                                       
|       |   |-- AtsIpv6_Common_Functions.ttcn               
|       |   |-- AtsIpv6_Defaults.ttcn                       
|       |   |-- AtsIpv6_ModuleParameters.ttcn               
|       |   |-- AtsIpv6_Postambles.ttcn                     
|       |   |-- AtsIpv6_Preambles.ttcn                      
|       |   |-- AtsIpv6_TestConfiguration.ttcn              
|       |   |-- AtsIpv6_TestConfiguration_TypesAndValues.ttcn
|       |   `-- AtsIpv6_TestSystem.ttcn                      
|       `-- AtsCore                                          
|           |-- AtsIpv6_Core_TestControl.ttcn                
|           |-- AtsIpv6_Core_Tp_Functions.ttcn               
|           |-- AtsIpv6_GenerateIpv6Packets_Testcases.ttcn   
|           |-- AtsIpv6_Icmpv6Functions_Testcases.ttcn       
|           |-- AtsIpv6_Initialize_Testcases.ttcn            
|           |-- AtsIpv6_Jumbograms_Testcases.ttcn            
|           |-- AtsIpv6_NeighborDiscovery_Testcases.ttcn     
|           `-- AtsIpv6_ProcessIpv6Packets_Testcases.ttcn    
|-- EtsiLibrary                                              
|   |-- LibCommon                                            
|   |   |-- LibCommon_AbstractData.ttcn                      
|   |   |-- LibCommon_BasicTypesAndValues.ttcn               
|   |   |-- LibCommon_DataStrings.ttcn                       
|   |   |-- LibCommon_Sync.ttcn                              
|   |   |-- LibCommon_SyncExamples.ttcn                      
|   |   |-- LibCommon_TextStrings.ttcn                       
|   |   |-- LibCommon_Time.ttcn                              
|   |   `-- LibCommon_VerdictControl.ttcn                    
|   |-- LibIpv6                                              
|   |   |-- LibCommonRfcs                                    
|   |   |   |-- LibIpv6_CommonRfcs_Functions.ttcn            
|   |   |   |-- LibIpv6_CommonRfcs_Templates.ttcn            
|   |   |   |-- LibIpv6_CommonRfcs_TypesAndValues.ttcn       
|   |   |   |-- LibIpv6_ExternalFunctions.ttcn               
|   |   |   |-- LibIpv6_Interface_Functions.ttcn             
|   |   |   |-- LibIpv6_Interface_Templates.ttcn             
|   |   |   |-- LibIpv6_Interface_TypesAndValues.ttcn        
|   |   |   `-- LibIpv6_ModuleParameters.ttcn                
|   |   |-- LibCore                                          
|   |   |   |-- LibIpv6_Rfc2461NeighborDiscovery_Functions.ttcn
|   |   |   |-- LibIpv6_Rfc2461NeighborDiscovery_Templates.ttcn
|   |   |   |-- LibIpv6_Rfc2461NeighborDiscovery_TypesAndValues.ttcn
|   |   |   |-- LibIpv6_Rfc2462StatelessAddressAutoconf_Functions.ttcn
|   |   |   |-- LibIpv6_Rfc2462StatelessAddressAutoconf_Templates.ttcn
|   |   |   |-- LibIpv6_Rfc2462StatelessAddressAutoconf_TypesAndValues.ttcn
|   |   |   |-- LibIpv6_Rfc2463Icmpv6_Functions.ttcn                       
|   |   |   |-- LibIpv6_Rfc2463Icmpv6_Templates.ttcn                       
|   |   |   |-- LibIpv6_Rfc2463Icmpv6_TypesAndValues.ttcn                  
|   |   |   |-- LibIpv6_Rfc2894RouterRenumbering_Functions.ttcn            
|   |   |   `-- LibIpv6_Rfc2894RouterRenumbering_TypesAndValues.ttcn       
|   |   |-- LibMobility                                                    
|   |   |   |-- LibIpv6_Rfc3775Mipv6_Functions.ttcn                        
|   |   |   |-- LibIpv6_Rfc3775Mipv6_Templates.ttcn                        
|   |   |   |-- LibIpv6_Rfc3775Mipv6_TypesAndValues.ttcn                   
|   |   |   |-- LibIpv6_Rfc4068FastHandovers_Functions.ttcn                
|   |   |   |-- LibIpv6_Rfc4068FastHandovers_Templates.ttcn                
|   |   |   `-- LibIpv6_Rfc4068FastHandovers_TypesAndValues.ttcn           
|   |   |-- LibMultiRfcs                                                   
|   |   |   `-- LibIpv6_MultiRfcs_Functions.ttcn                           
|   |   |-- LibSec                                                         
|   |   |   |-- LibIpv6_Rfc4306Ikev2_Functions.ttcn                        
|   |   |   |-- LibIpv6_Rfc4306Ikev2_Templates.ttcn                        
|   |   |   `-- LibIpv6_Rfc4306Ikev2_TypesAndValues.ttcn                   
|   |   |-- LibTransitioning                                               
|   |   |   |-- LibIpv6_CommonTrans_Functions.ttcn                         
|   |   |   |-- LibIpv6_Rfc792Icmpv4_Functions.ttcn                        
|   |   |   |-- LibIpv6_Rfc792Icmpv4_Templates.ttcn                        
|   |   |   |-- LibIpv6_Rfc792Icmpv4_TypesAndValues.ttcn                   
|   |   |   |-- LibIpv6_Rfc826Arp_Functions.ttcn                           
|   |   |   |-- LibIpv6_Rfc826Arp_Templates.ttcn                           
|   |   |   `-- LibIpv6_Rfc826Arp_TypesAndValues.ttcn                      
|   |   `-- LibUdp                                                         
|   |       |-- LibIpv6_Rfc0768Udp_Templates.ttcn                          
|   |       `-- LibIpv6_Rfc0768Udp_TypesAndValues.ttcn                     
|   `-- LibScop                                                            
|       |-- LibScop_Codec.ttcn                                             
|       |-- LibScop_CodecTests.ttcn                                        
|       |-- LibScop_Functions.ttcn                                         
|       |-- LibScop_Interface.ttcn                                         
|       |-- LibScop_Templates.ttcn                                         
|       `-- LibScop_TypesAndValues.ttcn                          




As there is an import hierarchy , I will start from the bottom, with LibCommon. I have created a separate directory bin, where I will create symlinks using a script install.script As I advance, I will add more files to this script and regenerate the Makefile with makefilegen -f *.ttcn ;
I will also add -w to the compiler flags to obscure warnings;

The first script is:

 #!/bin/bash

ln -s ../EtsiLibrary/LibCommon/LibCommon_AbstractData.ttcn     .
ln -s ../EtsiLibrary/LibCommon/LibCommon_BasicTypesAndValues.ttcn     .
ln -s ../EtsiLibrary/LibCommon/LibCommon_DataStrings.ttcn     .
ln -s ../EtsiLibrary/LibCommon/LibCommon_SyncExamples.ttcn     .
ln -s ../EtsiLibrary/LibCommon/LibCommon_Sync.ttcn     .
ln -s ../EtsiLibrary/LibCommon/LibCommon_TextStrings.ttcn     .
ln -s ../EtsiLibrary/LibCommon/LibCommon_Time.ttcn     .
ln -s ../EtsiLibrary/LibCommon/LibCommon_VerdictControl.ttcn     . 


this will be run from bin:

../install.script  

a Makefile will be generated:

makefilegen -f *.ttcn

and then a compilation is attempted with

make

there will be a bunch of errors displayed;

1. the first one is :


LibCommon_Sync.ttcn: In TTCN-3 module `LibCommon_Sync':
 LibCommon_Sync.ttcn:163.4-170.4: In function definition `f_connect4SelfOrClientSync':
  LibCommon_Sync.ttcn:167.7-169.5: In else statement:
   LibCommon_Sync.ttcn:168.6-27: In function instance:
    LibCommon_Sync.ttcn:168.6-27: error: Runs on clause mismatch: A definition that runs on component type `@LibCommon_Sync.SelfSyncComp' cannot call function `@LibCommon_Sync.f_connect4ClientSync', which runs on `@LibCommon_Sync.ClientSyncComp'

followed by others similar.

The error sheds light on one of the idiosynchrasies of Titan:

although the standard defines an implicit component type compatibility, Titan does not support this:

In LibCommon_Sync.ttcn


				type component ClientSyncComp {
					var StringStack v_stateStack:= c_initStringStack;
					port SyncPort syncPort;
					timer tc_sync := PX_TSYNC_TIME_LIMIT;
				}


				type component SelfSyncComp {
					var StringStack v_stateStack:= c_initStringStack;
					port SyncPort syncSendPort;
					port SyncPort syncPort;
					timer tc_sync := PX_TSYNC_TIME_LIMIT;
				}
 

component ClientSyncComp should be compatible with SelfSyncComp, but Titan expects an explicit declaration of compatibility, either in form
of a type alias (possible when the declarations on the two components are exactly the same) or in the form of component extension.

So to handle the error we have to declare SelfSyncComp as a child of ClientSyncComp:

type component SelfSyncComp extends ClientSyncComp {
				//	var StringStack v_stateStack:= c_initStringStack;
					port SyncPort syncSendPort;
				//	port SyncPort syncPort;
				//	timer tc_sync := PX_TSYNC_TIME_LIMIT;
				} 
 

declarations already existing in ClientSyncComp declaration have been removed.

2. the next error is similar:

 LibCommon_SyncExamples.ttcn: In TTCN-3 module `LibCommon_SyncExamples':
 LibCommon_SyncExamples.ttcn:133.3-159.3: In testcase definition `tc_selfSyncOk':
  LibCommon_SyncExamples.ttcn:137.16-51: In variable definition `v_def':
   LibCommon_SyncExamples.ttcn:137.25-51: In `activate()' operation:
    LibCommon_SyncExamples.ttcn:137.34-50: error: Runs on clause mismatch: A definition that runs on component type `@LibCommon_SyncExamples.ExampleComp' cannot activate altstep `@LibCommon_Sync.a_dummyShutDown', which runs on `@LibCommon_Sync.SelfSyncComp'
 


in LibCommon_SyncExamples


	  	type component ExampleComp
	    {
			// parts needed for Client/SelfSyncComp type compatibility
			var StringStack v_stateStack:= c_initStringStack;
			port SyncPort syncSendPort;
			port SyncPort syncPort;
			timer tc_sync := PX_TSYNC_TIME_LIMIT;

			// here could follow additional port, variable, 
			// and timer definitions of any kind
		} 

has to be made explicitly compatible with LibCommon_Sync.SelfSyncComp

as the declarations are the same , we will use alias this time:

type SelfSyncComp  ExampleComp;  //alias 

3. next error thrown is:

In file included from LibCommon_SyncExamples.hh:20:0,
                 from LibCommon_SyncExamples.cc:11:
LibCommon_Sync.hh:720:23: fatal error: SyncPort.hh: No such file or directory
compilation terminated.


Now what happens here is that Titan is looking for the C/C++ code of the test ports declared in the TTCN-3 code.
There are two categories of test ports : internal , which will connect two components, and external which will map a component to the system.
Internal ports ( declared "with {extension "internal"}" will not need external C/C++ code. I will make all port declarations internal
to permit compilation , but in the end those meant to be external will have to be written appropriate C/C++ code.

in LibCommon_Sync

				type port SyncPort message { inout SyncCmd } with {extension "internal" };


Now LibCommon should compile.


We can move to the next step and add LibScop



	 
 #!/bin/bash

ln -s ../EtsiLibrary/LibCommon/LibCommon_AbstractData.ttcn     .
ln -s ../EtsiLibrary/LibCommon/LibCommon_BasicTypesAndValues.ttcn     .
ln -s ../EtsiLibrary/LibCommon/LibCommon_DataStrings.ttcn     .
ln -s ../EtsiLibrary/LibCommon/LibCommon_SyncExamples.ttcn     .
ln -s ../EtsiLibrary/LibCommon/LibCommon_Sync.ttcn     .
ln -s ../EtsiLibrary/LibCommon/LibCommon_TextStrings.ttcn     .
ln -s ../EtsiLibrary/LibCommon/LibCommon_Time.ttcn     .
ln -s ../EtsiLibrary/LibCommon/LibCommon_VerdictControl.ttcn     .


ln -s ../EtsiLibrary/LibScop/LibScop_CodecTests.ttcn  .
ln -s ../EtsiLibrary/LibScop/LibScop_Codec.ttcn  .
ln -s ../EtsiLibrary/LibScop/LibScop_Functions.ttcn  .
ln -s ../EtsiLibrary/LibScop/LibScop_Interface.ttcn  .
ln -s ../EtsiLibrary/LibScop/LibScop_Templates.ttcn  .
ln -s ../EtsiLibrary/LibScop/LibScop_TypesAndValues.ttcn  .
 


First error thrown:

LibScop_Codec.ttcn: In TTCN-3 module `LibScop_Codec':
 LibScop_Codec.ttcn:26.5-59.2: In function definition `f_encodeScop':
  LibScop_Codec.ttcn:29.3-33: In variable assignment:
   LibScop_Codec.ttcn:29.15-33: In the operand of operation `str2oct()':
    LibScop_Codec.ttcn:29.23-32: error: The operand of operation `str2oct()' can contain only valid hexadecimal digits (position 0 is `S')
 






in LibScop_Codec.ttcn

function f_encodeScop ( in ScopMsg p_scopMsg, out octetstring p_encMsg ) 
	return FncRetCode {
		var FncRetCode v_ret := e_success;
		p_encMsg := char2oct("SCOP/1.0"); 



Now this is a misuse of the char2oct function, which according to the standard

C.1.28 Character string to octetstring
str2oct(in charstring invalue) return octetstring
This function converts a string of the type charstring to an octetstring. The string invalue shall contain the "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e" "f", "A", "B", "C", "D", "E" or "F" graphical characters only.

The right function to use here is str2oct. After replacing char2oct with str2oct LibCommon and LIbScope compiles together.

Now there's a morale here: it appears that this test suite was never executed by ETSI , probably all they have done to verify it
was to compile it with a tool that possibly overlooked this fault.



To be continued.

Best regards

Elemer






  • Attachment: IPV6.tgz
    (Size: 225.69KB, Downloaded 115 times)

[Updated on: Fri, 02 March 2018 04:59]

Report message to a moderator

Re: Porting the ETSI IPv6 test suite to Titan part I [message #1782838 is a reply to message #1782776] Fri, 02 March 2018 11:17 Go to previous messageGo to next message
Harald Welte is currently offline Harald WelteFriend
Messages: 140
Registered: July 2017
Location: Berlin, Germany
Senior Member

I really appreciate this post and am looking forward to the follow-up. While there is TITAN with good documentation and the TTCN-3 language spec out there, there's not an awful lot of other resources such as comprehensive test suites that actually compile/work with TITAN. Having some more-than-trivial examples for protocols that "everyone" should understand (like IPv6) will be a perfect addition.

I suggest that you start a git repo with a plain import of the ETSI IPv6 test suite, followed by commits as you go [at least one per post you make here, possibly more], resolving the individual compile errors step by step. I think that would make it very easy to look at the unified diff step by step in the commit history. But that's of course just a suggestion, it's all up to you ;)
Re: Porting the ETSI IPv6 test suite to Titan part I [message #1782870 is a reply to message #1782838] Fri, 02 March 2018 17:20 Go to previous message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Thank you, Harald

My intention is to demonstrate that any TTCN-3 code can be ported to Titan with some effort.
BTW I have bureaucratic reasons not to do this in git.


Best regards
Elemer

[Updated on: Fri, 02 March 2018 17:20]

Report message to a moderator

Previous Topic:RAW coder and arrays in records
Next Topic:test component sends messages to already disconnected component on shutdown
Goto Forum:
  


Current Time: Sat Apr 27 02:31:15 GMT 2024

Powered by FUDForum. Page generated in 0.03608 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top