Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » Eclipse Titan product structure part 3(protocol daemon, SCTP, SCTP daemon , SCTP client, SCTP server)
Eclipse Titan product structure part 3 [message #1824118] Wed, 08 April 2020 08:41
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Dear all,

this post is rooted in the series of posts about SCTP support as well as in the series about Titan product structure as
it will demonstrate the usage of an SCTP daemon, a new type of product not yet discussed in this forum.
For further details please consult the product documentation and the demo included.

There are three steps necessary to demonstrate the usage of the SCTP daemon:

1) first, we'll start an SCTP server using NCAT (see also series of posts about SCTP support):
ncat -l --sctp -vv -p 5202

2) next, we will start the SCTP daemon proper; the daemon will create an SCTP association to the SCTP listener
previously started, connecting as a client, and simultaneously will open a TCP listener socket, waiting for the user
protocol to connect. In our demo, the daemon will be fully and statically configured from the config file, so the dynamic reconfiguration
capabilities of the daemon will not be used. The daemon will be built in single mode as there is no need of multi-component execution.

3) finally , the test execution is started; the test suite will connect to the daemon over TCP and send user protocol messages to it;
these will be extracted and relayed over to the SUT (simulated with NCAT). At the end of execution, the test suite terminates, but the daemon
will stay resident. The test suite can be re-run as many times as needed. (Due to practical reasons, the daemon will terminate after a number of
seconds of inactivity, set by
float tsp_SDD_InactivityTimer := 60.0;
value that can be overwritten in the config file)

The daemon uses the IPL4asp test port for both legs (SCTP and TCP) of the communication. Also it refers to some of the
function published in the TCCUsefulFunctions library.

The source code of the daemon can be downloaded from:
http://git.eclipse.org/c/titan/titan.Servers.SCTP_Daemon_Dynamic

and will require the below dependencies:
https://github.com/eclipse/titan.TestPorts.IPL4asp
https://github.com/eclipse/titan.TestPorts.Common_Components.Socket-API
https://github.com/eclipse/titan.Libraries.TCCUsefulFunctions

For details, see the install.script files in the attached archives.

All right then, let's go through the steps outlined above, with some more detail.
First , you will need to download the two attached archives SCTP_Test-XXXXXX-YYYY.tgz and
SCTP_Daemon-XXXXXX-YYYY.tgz , extract them in two sepaate folders, say bin1 and bin2,
and compile them (make). All the needed Make- and config files are contained in the archives, together
with the log files of the executions, log files that can be analysed for details.
You will also need three different terminals , one for NCAT, one for the daemon and one for the test suite.

1) start the NCAT SCTP listener in the first terminal:
 
ncat -l --sctp -vv -p 5202
Ncat: Version 7.31 ( https://nmap.org/ncat )
Ncat: Listening on :::5202
Ncat: Listening on 0.0.0.0:5202



2) start the previously built SCTP daemon in the second terminal:

./SCTP_Daemon SCTP_Daemon.cfg
TTCN-3 Test Executor (single mode), version CRL 113 200/6 R6B
Using configuration file: `SCTP_Daemon.cfg'
Test case tc_SDD started.
Listening on port (TCP)1314
Result received
v_index: -1
v_index: -1
Association of server: 0
Result received


The connection parameters are statically set in the configuration file SCTP_Daemon.cfg:

 
:
[MODULE_PARAMETERS]
tsp_SDD_AssociationList := 
{
  {
    serverAssociation   := true, // true := server, false: client
    autoReconnect       := false,
    localInterface      := 
    {
      hostNameLength  := 0,
      hostName        := "127.0.0.1",
      portNumber      := 1314//(1..65535)
    },
    remoteInterface     := omit
  },
  {
    serverAssociation   := false, // true := server, false: client
    autoReconnect       := false,
    localInterface      := 
    {
      hostNameLength  := 0,
      hostName        := "127.0.0.1",
      portNumber      := 60000//(1..65535)
    },
    remoteInterface     :=
    {
      hostNameLength  := 0,
      hostName        := "127.0.0.1",
      portNumber      := 5202//(1..65535)
    }
  }
};

:


which should be interpreted as such:
the daemon will connect to the SCTP server at IP address 127.0.0.1 , port number 5202, from the local source port
number 60000; it will also start to listen to local TCP port 1314 for incoming connections.

Apparition of the SCTP client will be noted on the server side:

 
 ncat -l --sctp -vv -p 5202
Ncat: Version 7.31 ( https://nmap.org/ncat )
Ncat: Listening on :::5202
Ncat: Listening on 0.0.0.0:5202
Ncat: Connection from 127.0.0.1.
Ncat: Connection from 127.0.0.1:60000.


If the damon will not see any incoming connection attempt on the TCP side, it will time out after 60 seconds:

 

./SCTP_Daemon SCTP_Daemon.cfg
TTCN-3 Test Executor (single mode), version CRL 113 200/6 R6B
Using configuration file: `SCTP_Daemon.cfg'
Test case tc_SDD started.
Listening on port (TCP)1314
Result received
v_index: -1
v_index: -1
Association of server: 0
Result received
*** SDD QUIT due to 60.000000 seconds of inactivity.
*** Please restart SDD if you need it again.
Test case tc_SDD finished. Verdict: none
Verdict statistics: 1 none (100.00 %), 0 pass (0.00 %), 0 inconc (0.00 %), 0 fail (0.00 %), 0 error (0.00 %).
Test execution summary: 1 test case was executed. Overall verdict: none




3) start the (previously built ) test suite.
The test case to be executed looks as below:

testcase tc_SCTP() runs on MAIN_CT {
  map(mtc:daemonPort, system:daemonPort);
  
  f_Connect_to_SDD();
  f_Init_SCTP_Client(tsp_serverInterface, tsp_serverPort);
  
  //Send some payload
for (var integer i:=0;i<=9;i:=i+1)  { 
  f_sendDataFromClient( char2oct(int2str(i)&"  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ\n\r"))
 } 
 f_sendDataFromClient(char2oct("Client waiting for 1 second"&"\n\r")) ; 
 
  
  timer t_wait := 1.0; t_wait.start; t_wait.timeout;
  
  unmap(mtc:daemonPort, system:daemonPort);
}



After mapping the TCP ports , the test suite connects to the daemon over TCP and intiates an SCTP client to server connection
unless this is already active. In our case it will always be active due to the static configuration so this check is superfluous
(and it's the result of me trying to simplify the original demo test case).
After that, some dummy user data is sent to the daemon, then the port is unmapped and the execution terminates.

This is how the above appears in the console log:
ttcn3_start ./SCTP_Test SCTP_Test.cfg
ttcn3_start: Starting the test suite
spawn /home/james00/titan.core/Install/bin/mctr_cli SCTP_Test.cfg

*************************************************************************
* TTCN-3 Test Executor - Main Controller 2                              *
* Version: CRL 113 200/6 R6B                                            *
* Copyright (c) 2000-2019 Ericsson Telecom AB                           *
* All rights reserved. This program and the accompanying materials      *
* are made available under the terms of the Eclipse Public License v2.0 *
* which accompanies this distribution, and is available at              *
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html            *
*************************************************************************

Using configuration file: SCTP_Test.cfg
MC@GlobalWarning1: Unix server socket created successfully.
MC@GlobalWarning1: Listening on TCP port 37567.
GlobalWarning1 is the default
MC2> spawn ././SCTP_Test GlobalWarning1 37567
TTCN-3 Host Controller (parallel mode), version CRL 113 200/6 R6B
MC@GlobalWarning1: New HC connected from localhost [127.0.0.1]. GlobalWarning1: Linux 4.15.0-88-generic on x86_64.
cmtc
MC@GlobalWarning1: Downloading configuration file to all HCs.
MC@GlobalWarning1: Configuration file was processed on all HCs.
MC@GlobalWarning1: Creating MTC on host localhost.
MC@GlobalWarning1: MTC is created.
MC2> smtc
Executing all items of [EXECUTE] section.
MC2> MTC@GlobalWarning1: Execution of control part in module SCTP_Dynamic_Daemon_Test started.
MTC@GlobalWarning1: Test case tc_SCTP started.
MTC@GlobalWarning1: "Connected to the SCTP Daemon2 on 127.0.0.1:1314"
MTC@GlobalWarning1: INFO: dropping this message.
MTC@GlobalWarning1: *** INFO: Client association is already defined, subscribing to it...
MTC@GlobalWarning1: vc_clientAssociationId: 1
MTC@GlobalWarning1: vc_connectedClientAssociationId: -1
MTC@GlobalWarning1: Test case tc_SCTP finished. Verdict: none
MTC@GlobalWarning1: Execution of control part in module SCTP_Dynamic_Daemon_Test finished.
MC@GlobalWarning1: Test execution finished.
Execution of [EXECUTE] section finished.
emtc
MC@GlobalWarning1: Terminating MTC.
MTC@GlobalWarning1: Verdict statistics: 1 none (100.00 %), 0 pass (0.00 %), 0 inconc (0.00 %), 0 fail (0.00 %), 0 error (0.00 %).
MTC@GlobalWarning1: Test execution summary: 1 test case was executed. Overall verdict: none
MC@GlobalWarning1: MTC terminated.
MC2> exit
MC@GlobalWarning1: Shutting down session.
MC@GlobalWarning1: Shutdown complete.


in the console log of the daemon:

 ./SCTP_Daemon SCTP_Daemon.cfg
TTCN-3 Test Executor (single mode), version CRL 113 200/6 R6B
Using configuration file: `SCTP_Daemon.cfg'
Test case tc_SDD started.
Listening on port (TCP)1314
Result received
v_index: -1
v_index: -1
Association of server: 0
Result received


and in the log of the simulated server:

 

ncat -l --sctp -vv -p 5202
Ncat: Version 7.31 ( https://nmap.org/ncat )
Ncat: Listening on :::5202
Ncat: Listening on 0.0.0.0:5202
Ncat: Connection from 127.0.0.1.
Ncat: Connection from 127.0.0.1:60000.
0  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
1  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
2  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
3  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
4  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
5  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
6  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
7  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
8  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
9  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
Client waiting for 1 second



As the daemon persists, the test suite can be executed several times subsequently:

 
ncat -l --sctp -vv -p 5202
Ncat: Version 7.31 ( https://nmap.org/ncat )
Ncat: Listening on :::5202
Ncat: Listening on 0.0.0.0:5202
Ncat: Connection from 127.0.0.1.
Ncat: Connection from 127.0.0.1:60000.
0  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
1  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
2  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
3  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
4  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
5  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
6  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
7  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
8  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
9  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
Client waiting for 1 second
0  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
1  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
2  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
3  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
4  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
5  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
6  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
7  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
8  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
9  :AABBCCDDEEFFGGHHIIJJKKLLMMNNOOPPQQRRSSTTVVWWXXYYZZ
Client waiting for 1 second



The other daemons published, the GTP Tunnel daemon, and the IP daemon work along the same principles.



Best regards
Elemer

Previous Topic:Eclipse Titan product structure part 2
Next Topic:xsd2ttcn on RFC5874
Goto Forum:
  


Current Time: Thu Apr 18 09:48:44 GMT 2024

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

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

Back to the top