Commit a04fcde6 authored by Elemer Lelik's avatar Elemer Lelik
Browse files

Titan DIAMETER_ProtocolModule_Generator PM Initial Contribution

parent 253ef315
/******************************************************************************
* Copyright (c) 2004, 2014 Ericsson AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Gabor Szalai - initial implementation and initial documentation
******************************************************************************/
module DIAMETER_Demo
{
//=========================================================================
// Import Part
//=========================================================================
import from DIAMETER_Types all;
// import from TCPasp_Types all;
import from TCPasp_PortType all;
// import from SCTPasp_Types all;
import from SCTPasp_PortType all;
import from DIAMETER_Mapping all;
//=========================================================================
// Component Types
//=========================================================================
type component MTC_CT {};
type component DIA_SCT
{
port TCPasp_PT TCP_PCO;
port SCTPasp_PT SCTP_PCO;
}
//=========================================================================
// Templates
//=========================================================================
// Please note, that the messages doesn't contain any meaningful data,
// they are solely for demonstartional purposes.
template PDU_DIAMETER t_DIAMETER_CER (
octetstring p_hopbyhop,
octetstring p_endtoend) :=
{
version := 1,
message_length := 0,
RPETxxxx := '10000000'B,
command_code := Capabilities_Exchange,
application_id := '00000000'O,
hop_by_hop_id := p_hopbyhop,
end_to_end_id := p_endtoend,
avps := {
{
avp := {
avp_header := {
avp_code := c_AVP_Code_BASE_NONE_Origin_Host,
VMPxxxxx := '01000000'B,
avp_length := 0,
vendor_id := omit
},
avp_data := {
avp_BASE_NONE_Origin_Host := "ccf1.ccf.ericsson.se"
}
}
},
{
avp := {
avp_header := {
avp_code := c_AVP_Code_BASE_NONE_Origin_Realm,
VMPxxxxx := '01000000'B,
avp_length := 0,
vendor_id := omit
},
avp_data := {
avp_BASE_NONE_Origin_Realm := "ccf.ericsson.se"
}
}
},
{
avp := {
avp_header := {
avp_code := c_AVP_Code_BASE_NONE_Host_IP_Address,
VMPxxxxx := '01000000'B,
avp_length := 0,
vendor_id := omit
},
avp_data := {
avp_BASE_NONE_Host_IP_Address := {
address_type := IP,
address_data := '7F000002'O
}
}
}
},
{
avp := {
avp_header := {
avp_code := c_AVP_Code_BASE_NONE_Vendor_Id,
VMPxxxxx := '01000000'B,
avp_length := 0,
vendor_id := omit
},
avp_data := {
avp_BASE_NONE_Vendor_Id := '000028AF'O
}
}
}
}
}
template PDU_DIAMETER tr_DIAMETER_CEA :=
{
version := 1,
message_length := ?,
RPETxxxx := '00000000'B,
command_code := Capabilities_Exchange,
application_id := '00000000'O,
hop_by_hop_id := ?,
end_to_end_id := ?,
avps := ?
}
//=========================================================================
// Functions
//=========================================================================
// Using this function the mapping user component can subscribe for
// notifications at the mapping component
function f_RegisterClient() runs on DIAMETER_CT
{
DIA_PCO.send(ASP_DIA_Mapping_Registration:REGISTER);
alt
{
[] DIA_PCO.receive(ASP_DIA_Mapping_Registration:REGISTER_ACK) {}
[] DIA_PCO.receive {repeat;}
}
}
// Using this function the mapping user component can unsubscribe for
// notifications at the mapping component
function f_DeRegisterClient() runs on DIAMETER_CT
{
DIA_PCO.send(ASP_DIA_Mapping_Registration:DEREGISTER);
alt
{
[] DIA_PCO.receive(ASP_DIA_Mapping_Registration:DEREGISTER_ACK) {}
[] DIA_PCO.receive {repeat;}
}
}
function f_WaitForConnectionUp() runs on DIAMETER_CT
{
alt
{
[] DIA_PCO.receive(t_notification(CONNECTION_IS_UP, omit, omit)) {}
[] DIA_PCO.receive {repeat;}
}
}
// Main client function that runs on the DIAMETER_CT mapping user component
function f_DIAMETER_Client() runs on DIAMETER_CT
{
var PDU_DIAMETER vl_dia;
var ASP_DIA_Mapping_Notification vl_notif;
var integer i;
f_RegisterClient();
f_WaitForConnectionUp();
for (i:=0; i<20; i:=i+1) {
// Sending DIAMETER message:
DIA_PCO.send(t_DIAMETER_CER(
f_DIAMETER_genHopByHop(),
f_DIAMETER_genEndToEnd()
));
alt
{
[] DIA_PCO.receive(PDU_DIAMETER:tr_DIAMETER_CEA) -> value vl_dia
{
setverdict(pass);
}
[] DIA_PCO.receive(ASP_DIA_Mapping_Notification:?) -> value vl_notif
{
log("DIAMETER_Client: Notification arrived: ", vl_notif);
repeat;
}
[] DIA_PCO.receive
{
log("Unexpected message arrived from port: dropping");
repeat;
}
}
}
f_DeRegisterClient();
}
// Main server function that runs on the DIAMETER_CT mapping user component
function f_DIAMETER_Server() runs on DIAMETER_CT
{
var PDU_DIAMETER_Server vl_dia;
var ASP_DIA_Mapping_Notification vl_notif;
alt
{
[] DIA_PCO.receive(PDU_DIAMETER_Server:?) -> value vl_dia
{
log("DIAMETER_Server: Message arrived: ", vl_dia);
vl_dia.data.RPETxxxx := '00000000'B;
DIA_PCO.send(vl_dia);
repeat;
}
[] DIA_PCO.receive(ASP_DIA_Mapping_Notification:?) -> value vl_notif
{
log("DIAMETER_Server: Notification arrived: ", vl_notif);
repeat;
}
[] DIA_PCO.receive
{
log("Unexpected message arrived from port: dropping");
repeat;
}
}
}
//=========================================================================
// Testcases
//=========================================================================
// Testcase for Diameter client over SCTP
testcase tc_DIAMETER_SCTP_Client_Demo() runs on MTC_CT system DIA_SCT
{
const integer cl_num := 10;
var DIAMETER_CT Client[cl_num];
var DIAMETER_Mapping_CT Mapping;
var integer i;
Mapping := DIAMETER_Mapping_CT.create;
map(Mapping:SCTP_PCO, system:SCTP_PCO);
for (i:=0; i<cl_num; i:=i+1) {
Client[i] := DIAMETER_CT.create;
connect(Mapping:DIA_PCO, Client[i]:DIA_PCO);
}
Mapping.start(f_DIA_SCTP_Mapping_Client());
for (i:=0; i<cl_num; i:=i+1) {
Client[i].start(f_DIAMETER_Client());
}
for (i:=0; i<cl_num; i:=i+1) {
Client[i].done;
}
}
// Testcase for Diameter server over SCTP
testcase tc_DIAMETER_SCTP_Server_Demo() runs on MTC_CT system DIA_SCT
{
var DIAMETER_CT Server;
var DIAMETER_Mapping_CT Mapping;
Mapping := DIAMETER_Mapping_CT.create;
map(Mapping:SCTP_PCO, system:SCTP_PCO);
Server := DIAMETER_CT.create;
connect(Mapping:DIA_PCO, Server:DIA_PCO);
Mapping.start(f_DIA_SCTP_Mapping_Server());
Server.start(f_DIAMETER_Server());
Server.done;
}
// Testcase for Diameter client over TCP
testcase tc_DIAMETER_TCP_Client_Demo() runs on MTC_CT system DIA_SCT
{
const integer cl_num := 10;
var DIAMETER_CT Client[cl_num];
var DIAMETER_Mapping_CT Mapping;
var integer i;
Mapping := DIAMETER_Mapping_CT.create;
map(Mapping:TCP_PCO, system:TCP_PCO);
for (i:=0; i<cl_num; i:=i+1) {
Client[i] := DIAMETER_CT.create;
connect(Mapping:DIA_PCO, Client[i]:DIA_PCO);
}
Mapping.start(f_DIA_TCP_Mapping_Client());
for (i:=0; i<cl_num; i:=i+1) {
Client[i].start(f_DIAMETER_Client());
}
for (i:=0; i<cl_num; i:=i+1) {
Client[i].done;
}
}
// Testcase for Diameter server over TCP
testcase tc_DIAMETER_TCP_Server_Demo() runs on MTC_CT system DIA_SCT
{
var DIAMETER_CT Server;
var DIAMETER_Mapping_CT Mapping;
Mapping := DIAMETER_Mapping_CT.create;
map(Mapping:TCP_PCO, system:TCP_PCO);
Server := DIAMETER_CT.create;
connect(Mapping:DIA_PCO, Server:DIA_PCO);
Mapping.start(f_DIA_TCP_Mapping_Server());
Server.start(f_DIAMETER_Server());
Server.done;
}
}
This diff is collapsed.
/******************************************************************************
* Copyright (c) 2004, 2014 Ericsson AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Gabor Szalai - initial implementation and initial documentation
******************************************************************************/
[LOGGING]
FileMask := LOG_ALL | DEBUG
ConsoleMask := ERROR | WARNING | STATISTICS
[MODULE_PARAMETERS]
tsp_hostname := "159.107.197.130";
tsp_portnumber := 50001;
[TESTPORT_PARAMETERS]
*.SCTP_PCO.server_mode := "no"
[EXECUTE]
DIAMETER_Demo.tc_DIAMETER_SCTP_Client_Demo
/******************************************************************************
* Copyright (c) 2004, 2014 Ericsson AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Gabor Szalai - initial implementation and initial documentation
******************************************************************************/
[LOGGING]
FileMask := LOG_ALL | DEBUG
ConsoleMask := ERROR | WARNING | STATISTICS
[MODULE_PARAMETERS]
[TESTPORT_PARAMETERS]
*.SCTP_PCO.server_mode := "yes"
*.SCTP_PCO.local_IP_address := "159.107.197.130"
*.SCTP_PCO.local_port := "50001"
[EXECUTE]
DIAMETER_Demo.tc_DIAMETER_SCTP_Server_Demo
/******************************************************************************
* Copyright (c) 2004, 2014 Ericsson AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Gabor Szalai - initial implementation and initial documentation
******************************************************************************/
[LOGGING]
FileMask := LOG_ALL | DEBUG
ConsoleMask := ERROR | WARNING | STATISTICS
[MODULE_PARAMETERS]
tsp_hostname := "159.107.197.130";
tsp_portnumber := 50001;
[TESTPORT_PARAMETERS]
*.TCP_PCO.use_connection_ASPs := "yes"
*.TCP_PCO.server_mode := "no"
*.TCP_PCO.halt_on_connection_reset := "no"
*.TCP_PCO.client_TCP_reconnect := "yes"
*.TCP_PCO.packet_hdr_length_offset := "1"
*.TCP_PCO.packet_hdr_nr_bytes_in_length := "3"
*.TCP_PCO.packet_hdr_byte_order := "MSB"
[EXECUTE]
DIAMETER_Demo.tc_DIAMETER_TCP_Client_Demo
/******************************************************************************
* Copyright (c) 2004, 2014 Ericsson AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Gabor Szalai - initial implementation and initial documentation
******************************************************************************/
[LOGGING]
FileMask := LOG_ALL | DEBUG
ConsoleMask := ERROR | WARNING | STATISTICS
[MODULE_PARAMETERS]
tsp_hostname := "159.107.197.130";
tsp_portnumber := 50001;
[TESTPORT_PARAMETERS]
*.TCP_PCO.use_connection_ASPs := "yes"
*.TCP_PCO.server_mode := "yes"
*.TCP_PCO.halt_on_connection_reset := "no"
*.TCP_PCO.packet_hdr_length_offset := "1"
*.TCP_PCO.packet_hdr_nr_bytes_in_length := "3"
*.TCP_PCO.packet_hdr_byte_order := "MSB"
[EXECUTE]
DIAMETER_Demo.tc_DIAMETER_TCP_Server_Demo
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2014 Ericsson
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
-->
<TITAN_Project_File_Information version="1.0">
<ProjectName>DIAMETER_demo</ProjectName>
<ReferencedProjects>
<ReferencedProject name="SCTPasp_CNL113469" projectLocationURI="../../../TestPorts/SCTPasp_CNL113469/SCTPasp_CNL113469.tpd"/>
<ReferencedProject name="TCPasp_CNL113347" projectLocationURI="../../../TestPorts/TCPasp_CNL113347/TCPasp_CNL113347.tpd"/>
</ReferencedProjects>
<Files>
<FileResource projectRelativePath="DIAMETER_EncDec.cc" relativeURI="../src/DIAMETER_EncDec.cc"/>
<FileResource projectRelativePath="DIAMETER_Demo.ttcn" relativeURI="DIAMETER_Demo.ttcn"/>
<FileResource projectRelativePath="DIAMETER_Mapping.ttcn" relativeURI="DIAMETER_Mapping.ttcn"/>
<FileResource projectRelativePath="DIAMETER_SCTP_Client_Demo.cfg" relativeURI="DIAMETER_SCTP_Client_Demo.cfg"/>
<FileResource projectRelativePath="DIAMETER_SCTP_Server_Demo.cfg" relativeURI="DIAMETER_SCTP_Server_Demo.cfg"/>
<FileResource projectRelativePath="DIAMETER_TCP_Client_Demo.cfg" relativeURI="DIAMETER_TCP_Client_Demo.cfg"/>
<FileResource projectRelativePath="DIAMETER_TCP_Server_Demo.cfg" relativeURI="DIAMETER_TCP_Server_Demo.cfg"/>
<FileResource projectRelativePath="DIAMETER_Types.ttcn" relativeURI="DIAMETER_Types.ttcn"/>
<FileResource projectRelativePath="demo_note.txt" relativeURI="demo_note.txt"/>
</Files>
<ActiveConfiguration>Default</ActiveConfiguration>
<Configurations>
<Configuration name="Default">
<ProjectProperties>
<MakefileSettings>
<generateInternalMakefile>true</generateInternalMakefile>
<GNUMake>true</GNUMake>
<incrementalDependencyRefresh>true</incrementalDependencyRefresh>
<targetExecutable>bin/DIAMETER_demo</targetExecutable>
</MakefileSettings>
<LocalBuildSettings>
<workingDirectory>bin</workingDirectory>
</LocalBuildSettings>
<NamingCoventions>
<enableProjectSpecificSettings>true</enableProjectSpecificSettings>
<globalConstant>.*</globalConstant>
<externalConstant>.*</externalConstant>
<function>.*</function>
<externalFunction>.*</externalFunction>
<moduleParameter>.*</moduleParameter>
<globalPort>.*</globalPort>
<globalTimer>.*</globalTimer>
<localVariable>.*</localVariable>
<formalParameter>.*</formalParameter>
<componentConstant>.*</componentConstant>
<componentVariable>.*</componentVariable>
<componentTimer>.*</componentTimer>
</NamingCoventions>
</ProjectProperties>
</Configuration>
</Configurations>
</TITAN_Project_File_Information>
/******************************************************************************
* Copyright (c) 2004, 2014 Ericsson AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Gabor Szalai - initial implementation and initial documentation
******************************************************************************/
This demo shows how to use create DIAMETER server or client uding TCP or SCTP
test port and the generated DIAMETER_types.ttcn
/******************************************************************************
* Copyright (c) 2004, 2014 Ericsson AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Roland Gecse - initial implementation and initial documentation
* Akos Pernek
* Antal Wuh.Hen.Chang
* Attila Fulop
* Balazs Barcsik
* Bence Molnar
* Csaba Koppany
* David Juhasz
* Eduard Czimbalmos
* Elemer Lelik
* Endre Kiss
* Endre Kulcsar
* Gabor Szalai
* Gabor Tatarka
* Gergely Futo
* Istvan Sandor
* Krisztian Pandi
* Kulcsr Endre
* Laszlo Tamas Zeke
* Norbert Pinter
* Roland Gecse
* Tibor Bende
* Tibor Szabo
* Timea Moder
* Zoltan Medve
* Zsolt Nandor Torok
* Zsolt Szalai
******************************************************************************/
//
// File: AAAInterface_3GPP_TS29272_940.ddf
// Description: DDF for S6a/S6d and S13 Interfaces according to 3GPP TS 29.272 V9.4.0
// Rev: R29A
// Prodnr: CNL 113 462
///////////////////////////////////////////////
// APPLICATION-NAME: AAA
// APPLICATION-REVISION: V9_4_0
// AVP implementations according to:
// 3GPP TS 29.272 V9.4.0 - Evolved Packet System (EPS); Mobility Management Entity (MME) and Serving GPRS Support Node (SGSN) related interfaces based on Diameter protocol
// 3GPP TS 29.272 V9.4.0
// 7.3.27
// AVP: Context-Identifier (1423) 3GPP (10415)
type AVP_Unsigned32 Context_Identifier
// 3GPP TS 29.272 V9.4.0
// 7.3.37
// AVP: EPS-Subscribed-QoS-Profile (1431) 3GPP (10415)
type AVP_Grouped EPS_Subscribed_QoS_Profile
// 3GPP TS 29.272 V9.4.0
// 7.3.41
// AVP: AMBR (1435) 3GPP (10415)
type AVP_Grouped AMBR
// 3GPP TS 29.272 V9.4.0
// 7.3.62
// AVP: PDN-Type (1456) 3GPP (10415)
type enumerated PDN_Type
{
IPv4 (0),
IPv6 (1),
IPv4v6 (2),
IPv4_OR_IPv6 (3)
}
/******************************************************************************
* Copyright (c) 2004, 2014 Ericsson AB
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Roland Gecse - initial implementation and initial documentation
* Akos Pernek
* Antal Wuh.Hen.Chang
* Attila Fulop
* Balazs Barcsik
* Bence Molnar
* Csaba Koppany
* David Juhasz
* Eduard Czimbalmos
* Elemer Lelik
* Endre Kiss
* Endre Kulcsar
* Gabor Szalai
* Gabor Tatarka
* Gergely Futo
* Istvan Sandor
* Krisztian Pandi
* Kulcsr Endre
* Laszlo Tamas Zeke
* Norbert Pinter
* Roland Gecse
* Tibor Bende
* Tibor Szabo
* Timea Moder
* Zoltan Medve