add library/PFCP_*, deps/PFCP

Will soon be used by new subdir 'upf' (test osmo-upf),
and by 'hnbgw' (test GTP mapping via UPF).

Related: SYS#5599
Change-Id: I0723b931b3f755ea291bffa2f27c34ba446c2f2f
This commit is contained in:
Neels Hofmeyr 2022-01-20 23:11:38 +01:00 committed by neels
parent 13b83db5db
commit a2d1d7a211
7 changed files with 926 additions and 0 deletions

2
deps/Makefile vendored
View File

@ -47,6 +47,7 @@ ECLIPSEGITLAB_REPOS= titan.Libraries.TCCUsefulFunctions \
titan.ProtocolModules.NS_v7.3.0 \
titan.ProtocolModules.SGsAP_13.2.0 \
titan.ProtocolModules.SNDCP_v7.0.0 \
titan.ProtocolModules.PFCP_v15.1.0 \
titan.TestPorts.Common_Components.Socket-API \
titan.TestPorts.Common_Components.Abstract_Socket \
titan.TestPorts.HTTPmsg \
@ -111,6 +112,7 @@ titan.ProtocolModules.SNDCP_v7.0.0_commit= R.2.A-5-gd0f0ce6
titan.ProtocolModules.SUA_commit= R.5.A-5-gcf1137a
titan.ProtocolModules.TCP_commit= R.3.A-5-g39e5f45
titan.ProtocolModules.UDP_commit= R.4.A-5-geea8aa3
titan.ProtocolModules.PFCP_v15.1.0_commit= d550ad9ddb6f9c823c9a555254cd76cf0e738d18
titan.TestPorts.AF_PACKET_commit= 0.1-5-g89ebea6
titan.TestPorts.Common_Components.Socket-API_commit= R.6.A-6-gf4380d0
titan.TestPorts.Common_Components.Abstract_Socket_commit= R.9.B-4-gbd41994

View File

@ -286,6 +286,7 @@ group SimpleRAWEncodedTypes {
type integer LIN2_BO_LAST (0..65535) with { variant "FIELDLENGTH(16), COMP(nosign), BYTEORDER(last)" };
type integer LIN3_BO_LAST (0..16777215) with { variant "FIELDLENGTH(24), COMP(nosign), BYTEORDER(last)" };
type integer LIN4_BO_LAST (0..4294967295) with { variant "FIELDLENGTH(32), COMP(nosign), BYTEORDER(last)" };
type integer LIN8_BO_LAST (0..18446744073709551616) with { variant "FIELDLENGTH(64), COMP(nosign), BYTEORDER(last)" };
//integer with fixed bit number
type integer INT1b (0..1) with { variant "FIELDLENGTH(1)" };

View File

@ -0,0 +1,56 @@
/* dual-faced port sitting on top of IPL4_asp UDP to encode/decode PFCP
*
* (C) 2022 sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
* All rights reserved.
*
* Released under the terms of GNU General Public License, Version 2 or
* (at your option) any later version.
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
module PFCP_CodecPort {
import from IPL4asp_PortType all;
import from IPL4asp_Types all;
import from PFCP_Types all;
/* identifies a remote peer (sender or receiver) */
type record PFCP_Peer {
ConnectionId conn_id,
HostName remote_name,
PortNumber remote_port
}
type record PFCP_Unitdata {
PFCP_Peer peer,
PDU_PFCP pdu
}
/* Translation port on top of IPL4asp; ASP_Event passed through transparently */
type port PFCP_PT message {
out PFCP_Unitdata;
in PFCP_Unitdata,
ASP_ConnId_ReadyToRelease,
ASP_Event;
} with { extension "user IPL4asp_PT
out(PFCP_Unitdata -> ASP_SendTo: function(f_enc_pfcp_unitdata))
in(ASP_RecvFrom -> PFCP_Unitdata: function(f_dec_pfcp_unitdata);
ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
ASP_Event -> ASP_Event: simple)" }
private function f_enc_pfcp_unitdata(in PFCP_Unitdata in_ud, out ASP_SendTo out_ud) {
out_ud.connId := in_ud.peer.conn_id;
out_ud.remName := in_ud.peer.remote_name;
out_ud.remPort := in_ud.peer.remote_port;
out_ud.proto := { udp := {} };
out_ud.msg := enc_PDU_PFCP(in_ud.pdu);
} with { extension "prototype(fast)" };
private function f_dec_pfcp_unitdata(in ASP_RecvFrom in_ud, out PFCP_Unitdata out_ud) {
out_ud.peer.conn_id := in_ud.connId;
out_ud.peer.remote_name := in_ud.remName;
out_ud.peer.remote_port := in_ud.remPort;
out_ud.pdu := dec_PDU_PFCP(in_ud.msg);
} with { extension "prototype(fast)" };
}

View File

@ -0,0 +1,43 @@
module PFCP_CodecPort_CtrlFunct {
import from PFCP_CodecPort all;
import from IPL4asp_Types all;
external function f_IPL4_listen(
inout PFCP_PT portRef,
in HostName locName,
in PortNumber locPort,
in ProtoTuple proto,
in OptionList options := {}
) return Result;
external function f_IPL4_connect(
inout PFCP_PT portRef,
in HostName remName,
in PortNumber remPort,
in HostName locName,
in PortNumber locPort,
in ConnectionId connId,
in ProtoTuple proto,
in OptionList options := {}
) return Result;
external function f_IPL4_close(
inout PFCP_PT portRef,
in ConnectionId id,
in ProtoTuple proto := { unspecified := {} }
) return Result;
external function f_IPL4_setUserData(
inout PFCP_PT portRef,
in ConnectionId id,
in UserData userData
) return Result;
external function f_IPL4_getUserData(
inout PFCP_PT portRef,
in ConnectionId id,
out UserData userData
) return Result;
}

View File

@ -0,0 +1,55 @@
#include "IPL4asp_PortType.hh"
#include "IPL4asp_PT.hh"
#include "PFCP_CodecPort.hh"
namespace PFCP__CodecPort__CtrlFunct {
IPL4asp__Types::Result f__IPL4__listen(
PFCP__CodecPort::PFCP__PT& portRef,
const IPL4asp__Types::HostName& locName,
const IPL4asp__Types::PortNumber& locPort,
const IPL4asp__Types::ProtoTuple& proto,
const IPL4asp__Types::OptionList& options)
{
return f__IPL4__PROVIDER__listen(portRef, locName, locPort, proto, options);
}
IPL4asp__Types::Result f__IPL4__connect(
PFCP__CodecPort::PFCP__PT& portRef,
const IPL4asp__Types::HostName& remName,
const IPL4asp__Types::PortNumber& remPort,
const IPL4asp__Types::HostName& locName,
const IPL4asp__Types::PortNumber& locPort,
const IPL4asp__Types::ConnectionId& connId,
const IPL4asp__Types::ProtoTuple& proto,
const IPL4asp__Types::OptionList& options)
{
return f__IPL4__PROVIDER__connect(portRef, remName, remPort,
locName, locPort, connId, proto, options);
}
IPL4asp__Types::Result f__IPL4__close(
PFCP__CodecPort::PFCP__PT& portRef,
const IPL4asp__Types::ConnectionId& connId,
const IPL4asp__Types::ProtoTuple& proto)
{
return f__IPL4__PROVIDER__close(portRef, connId, proto);
}
IPL4asp__Types::Result f__IPL4__setUserData(
PFCP__CodecPort::PFCP__PT& portRef,
const IPL4asp__Types::ConnectionId& connId,
const IPL4asp__Types::UserData& userData)
{
return f__IPL4__PROVIDER__setUserData(portRef, connId, userData);
}
IPL4asp__Types::Result f__IPL4__getUserData(
PFCP__CodecPort::PFCP__PT& portRef,
const IPL4asp__Types::ConnectionId& connId,
IPL4asp__Types::UserData& userData)
{
return f__IPL4__PROVIDER__getUserData(portRef, connId, userData);
}
}

202
library/PFCP_Emulation.ttcn Normal file
View File

@ -0,0 +1,202 @@
/* PFCP Emulation in TTCN-3
*
* (C) 2022 sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
* All rights reserved.
*
* Released under the terms of GNU General Public License, Version 2 or
* (at your option) any later version.
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
module PFCP_Emulation {
import from IPL4asp_Types all;
import from General_Types all;
import from Osmocom_Types all;
import from PFCP_Types all;
import from PFCP_CodecPort all;
import from PFCP_CodecPort_CtrlFunct all;
/***********************************************************************
* Main Emulation Component
***********************************************************************/
const integer PFCP_PORT := 8805;
type enumerated PFCP_Role {
CPF,
UPF
};
type record PFCP_Emulation_Cfg {
HostName pfcp_bind_ip,
PortNumber pfcp_bind_port,
HostName pfcp_remote_ip,
PortNumber pfcp_remote_port,
PFCP_Role role
};
type component PFCP_Emulation_CT {
/* Communication with underlying PFCP CodecPort */
port PFCP_PT PFCP;
/* Communication with Clients */
port PFCPEM_PT CLIENT;
port PFCPEM_PROC_PT CLIENT_PROC;
/* Configuration by the user */
var PFCP_Emulation_Cfg g_pfcp_cfg;
/* State */
var integer g_pfcp_conn_id;
var integer g_recovery_timestamp;
var PFCPEM_conns g_conns;
var integer g_next_sequence_nr_state;
};
private function f_PFCPEM_next_sequence_nr() runs on PFCP_Emulation_CT return integer {
g_next_sequence_nr_state := g_next_sequence_nr_state + 1;
if (g_next_sequence_nr_state > 16777215) {
g_next_sequence_nr_state := 1;
}
return g_next_sequence_nr_state;
}
type record PFCPEM_conn {
PFCP_ConnHdlr vc_conn,
OCT8 seid optional,
LIN3_BO_LAST pfcp_msg_sequence_number optional
};
type record of PFCPEM_conn PFCPEM_conns;
private function f_PFCPEM_conn_by_seid_or_seqnr(OCT8 seid, LIN3_BO_LAST seqnr) runs on PFCP_Emulation_CT return PFCP_ConnHdlr {
log("looking for seid ", seid, " seqnr ", seqnr, " in conns ", g_conns);
for (var integer i := 0; i < lengthof(g_conns); i := i + 1) {
if (isbound(g_conns[i].pfcp_msg_sequence_number)
and seqnr == g_conns[i].pfcp_msg_sequence_number) {
return g_conns[i].vc_conn;
}
if (isbound(g_conns[i].seid)
and seid == g_conns[i].seid) {
return g_conns[i].vc_conn;
}
}
return null;
};
private function f_PFCPEM_add_conn(PFCP_ConnHdlr vc_conn) runs on PFCP_Emulation_CT {
for (var integer i := 0; i < lengthof(g_conns); i := i + 1) {
if (g_conns[i].vc_conn == vc_conn) {
return;
}
}
/* Not in the list yet, add. */
var PFCPEM_conn conn := { vc_conn := vc_conn };
g_conns := g_conns & { conn };
}
private function f_init(PFCP_Emulation_Cfg cfg) runs on PFCP_Emulation_CT {
var Result res;
map(self:PFCP, system:PFCP);
res := PFCP_CodecPort_CtrlFunct.f_IPL4_listen(PFCP, cfg.pfcp_bind_ip, cfg.pfcp_bind_port, {udp:={}});
g_pfcp_conn_id := res.connId;
g_recovery_timestamp := f_rnd_int(4294967296);
g_pfcp_cfg := cfg;
g_conns := {};
g_next_sequence_nr_state := (1 + f_rnd_int(1000)) * 10000;
}
function main(PFCP_Emulation_Cfg cfg) runs on PFCP_Emulation_CT {
var PFCP_ConnHdlr vc_conn;
var PFCP_Unitdata ud;
var PDU_PFCP pdu;
f_init(cfg);
while (true) {
alt {
[] PFCP.receive(PFCP_Unitdata:?) -> value ud {
log("PFCP_Emulation main() PFCP.receive: ", ud);
vc_conn := null;
if (ud.pdu.s_flag == '1'B) {
/* There is a SEID */
vc_conn := f_PFCPEM_conn_by_seid_or_seqnr(ud.pdu.seid, ud.pdu.sequence_number);
}
if (vc_conn != null) {
log("found destination ", vc_conn);
CLIENT.send(ud.pdu) to vc_conn;
} else {
log("sending to all conns: ", g_conns);
for (var integer i := 0; i < lengthof(g_conns); i := i + 1) {
CLIENT.send(ud.pdu) to g_conns[i].vc_conn;
}
}
}
[] CLIENT.receive(PDU_PFCP:?) -> value pdu sender vc_conn {
log("PFCP_Emulation main() CLIENT.receive from ", vc_conn, ": ", pdu);
if (pdu.sequence_number == 0) {
pdu.sequence_number := f_PFCPEM_next_sequence_nr();
}
ud := {
peer := {
conn_id := g_pfcp_conn_id,
remote_name := g_pfcp_cfg.pfcp_remote_ip,
remote_port := g_pfcp_cfg.pfcp_remote_port
},
pdu := pdu
};
f_PFCPEM_add_conn(vc_conn);
PFCP.send(ud);
}
[] CLIENT_PROC.getcall(PFCPEM_register:{}) -> sender vc_conn {
log("PFCP_Emulation main() CLIENT_PROC.getcall(PFCPEM_register)");
f_PFCPEM_add_conn(vc_conn);
CLIENT_PROC.reply(PFCPEM_register:{}) to vc_conn;
}
}
}
}
/***********************************************************************
* Interaction between Main and Client Components
***********************************************************************/
type port PFCPEM_PT message {
inout PDU_PFCP;
} with { extension "internal" };
signature PFCPEM_register();
type port PFCPEM_PROC_PT procedure {
inout PFCPEM_register;
} with { extension "internal" };
/***********************************************************************
* Client Compoennt
***********************************************************************/
type component PFCP_ConnHdlr {
port PFCPEM_PT PFCP;
port PFCPEM_PROC_PT PFCP_PROC;
var PFCP_Emulation_CT vc_PFCP;
};
function f_pfcp_register() runs on PFCP_ConnHdlr {
PFCP_PROC.call(PFCPEM_register:{}) {
[] PFCP_PROC.getreply(PFCPEM_register:{});
}
}
}

567
library/PFCP_Templates.ttcn Normal file
View File

@ -0,0 +1,567 @@
/* PFCP Templates in TTCN-3
* (C) 2022 sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
* All rights reserved.
*
* Released under the terms of GNU General Public License, Version 2 or
* (at your option) any later version.
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
module PFCP_Templates {
import from General_Types all;
import from Native_Functions all;
import from Osmocom_Types all;
import from PFCP_Types all;
type enumerated e_PFCP_Cause {
RESERVED (0),
REQUEST_ACCEPTED (1),
MORE_USAGE_REPORT_TO_SEND (2),
REQUEST_REJECTED (64),
SESSION_CTX_NOT_FOUND (65),
MANDATORY_IE_MISSING (66),
CONDITIONAL_IE_MISSING (67),
INVALID_LENGTH (68),
MANDATORY_IE_INCORRECT (69),
INVALID_FORW_POLICY (70),
INVALID_F_TEID_ALLOC_OPTION (71),
NO_ESTABLISHED_PFCP_ASSOC (72),
RULE_CREATION_MOD_FAILURE (73),
PFCP_ENTITY_IN_CONGESTION (74),
NO_RESOURCES_AVAILABLE (75),
SERVICE_NOT_SUPPORTED (76),
SYSTEM_FAILURE (77),
REDIRECTION_REQUESTED (78),
ALL_DYNAMIC_ADDRESSES_ARE_OCCUPIED (79)
};
template (value) Cause ts_PFCP_Cause(e_PFCP_Cause cause) := {
elementIdentifier := 19,
lengthIndicator := 0,
causeValue := int2oct(enum2int(cause), 1)
};
template (present) Cause tr_PFCP_Cause(e_PFCP_Cause cause) := {
elementIdentifier := 19,
lengthIndicator := ?,
causeValue := int2oct(enum2int(cause), 1)
};
const INT4b PFCP_Node_ID_IPv4 := 0;
const INT4b PFCP_Node_ID_IPv6 := 1;
const INT4b PFCP_Node_ID_FQDN := 2;
template (value) Node_ID ts_PFCP_Node_ID(INT4b id_type, octetstring id_value) := {
elementIdentifier := 60,
lengthIndicator := 0,
node_id_type := id_type,
spare := '0000'B,
node_id_value := id_value
};
template (present) Node_ID tr_PFCP_Node_ID(template (present) INT4b id_type := ?,
template (present) octetstring id_value := ?) := {
elementIdentifier := 60,
lengthIndicator := ?,
node_id_type := id_type,
spare := ?,
node_id_value := id_value
};
/* t_PFCP_Node_ID_IPv4(f_inet_addr("127.0.0.1")) */
template (value) Node_ID ts_PFCP_Node_ID_ipv4(OCT4 ip_value) := ts_PFCP_Node_ID(PFCP_Node_ID_IPv4, ip_value);
template (value) Node_ID ts_PFCP_Node_ID_fqdn(charstring fqdn) := ts_PFCP_Node_ID(PFCP_Node_ID_FQDN, char2oct(fqdn));
template (value) Recovery_Time_Stamp ts_PFCP_Recovery_Timestamp(LIN4_BO_LAST time_value) := {
elementIdentifier := 96,
lengthIndicator := 0,
time_value := time_value
};
template (present) Recovery_Time_Stamp tr_PFCP_Recovery_Timestamp(template (present) LIN4_BO_LAST time_value := ?) := {
elementIdentifier := 96,
lengthIndicator := ?,
time_value := time_value
};
template (value) PDU_PFCP ts_PDU_PFCP_ := {
s_flag := '0'B,
mp := '0'B,
spare := '000'B,
version := 1,
message_type := 0,
lengthIndicator := 0,
seid := omit,
sequence_number := 0,
spare2 := '0000'B,
mp_or_spare := '0000'B,
message_body := -
};
template (present) PDU_PFCP tr_PDU_PFCP_ := {
s_flag := ?,
mp := ?,
spare := ?,
version := 1,
message_type := ?,
lengthIndicator := ?,
seid := *,
sequence_number := ?,
spare2 := ?,
mp_or_spare := ?,
message_body := ?
};
template (value) PDU_PFCP ts_PDU_PFCP(LIN3_BO_LAST sequence_number := 0, template (omit) OCT8 seid := omit)
modifies ts_PDU_PFCP_ := {
seid := seid,
sequence_number := sequence_number
};
template (present) PDU_PFCP tr_PDU_PFCP(template OCT8 seid := *)
modifies tr_PDU_PFCP_ := {
seid := seid
};
template (value) PDU_PFCP ts_PFCP_Assoc_Setup_Req(template (value) Node_ID node_id, LIN4_BO_LAST recovery_timestamp)
modifies ts_PDU_PFCP_ := {
message_body := {
pfcp_association_setup_request := {
node_id := node_id,
time_stamp := ts_PFCP_Recovery_Timestamp(recovery_timestamp),
up_function_features := omit,
cp_function_features := omit,
UP_IP_resource_list := omit
}
}
};
function tr_PFCP_Assoc_Setup_Req(template (present) Node_ID node_id := ?) return template (present) PDU_PFCP {
var template PDU_PFCP t := tr_PDU_PFCP();
t.message_body := {
pfcp_association_setup_request := {
node_id := node_id,
time_stamp := ?,
up_function_features := *,
cp_function_features := *,
UP_IP_resource_list := *
}
};
return t;
};
template (value) PDU_PFCP ts_PFCP_Assoc_Setup_Resp(LIN3_BO_LAST sequence_number,
template (value) Node_ID node_id,
template (value) Cause cause,
LIN4_BO_LAST recovery_timestamp)
modifies ts_PDU_PFCP_ := {
sequence_number := sequence_number,
message_body := {
pfcp_association_setup_response := {
node_id := node_id,
cause := cause,
time_stamp := ts_PFCP_Recovery_Timestamp(recovery_timestamp),
up_function_features := omit,
cp_function_features := omit,
UP_IP_resource_list := omit
}
}
};
function tr_PFCP_Assoc_Setup_Resp(template (present) Node_ID node_id := ?,
template (present) Cause cause := ?) return template (present) PDU_PFCP {
var template PDU_PFCP t := tr_PDU_PFCP();
t.message_body := {
pfcp_association_setup_response := {
node_id := node_id,
cause := cause,
time_stamp := ?,
up_function_features := *,
cp_function_features := *,
UP_IP_resource_list := *
}
};
return t;
};
function ts_PFCP_Assoc_Release_Req(template (value) Node_ID node_id) return template (value) PDU_PFCP {
var template (value) PDU_PFCP t := ts_PDU_PFCP();
t.message_body := {
pfcp_association_release_request := {
node_id := node_id
}
};
return t;
};
function tr_PFCP_Assoc_Release_Resp(template (present) Node_ID node_id := ?, template (present) Cause cause := ?)
return template (present) PDU_PFCP {
var template PDU_PFCP t := tr_PDU_PFCP();
t.message_body := {
pfcp_association_release_response := {
node_id := node_id,
cause := cause
}
};
return t;
};
template (value) F_SEID ts_PFCP_F_SEID_ipv4(charstring addr_v4, OCT8 seid) := {
elementIdentifier := 57,
lengthIndicator := 0,
v6 := '0'B,
v4 := '1'B,
spare := '000000'B,
seid := seid,
ipv4_address := f_inet_addr(addr_v4),
ipv6_address := omit
}
type enumerated e_PFCP_Src_Iface {
ACCESS (0),
CORE (1),
SGI_LAN_N6_LAN (2),
CP_FUNCTION (3),
x_5G_VN_INTERNAL (4)
};
template (value) Source_Interface ts_PFCP_Src_Iface(e_PFCP_Src_Iface iface) := {
elementIdentifier := 20,
lengthIndicator := 0,
interfacevalue := enum2int(iface),
spare := '0000'B
}
template (value) UE_IP_Address ts_PFCP_UE_IP_Address_v4(charstring addr_v4, boolean is_destination := true) := {
elementIdentifier := 93,
lengthIndicator := 0,
v6 := '0'B,
v4 := '1'B,
sd := bool2bit(is_destination),
spare := '00000'B,
ipv4_address := f_inet_addr(addr_v4),
ipv6_address := omit
}
template (value) F_TEID ts_PFCP_F_TEID_ipv4(OCT4 teid, charstring addr_v4) := {
elementIdentifier := 21,
lengthIndicator := 0,
v4 := '1'B,
v6 := '0'B,
ch := '0'B,
chid := '0'B,
spare := '0000'B,
teid := teid,
ipv4_address := f_inet_addr(addr_v4),
ipv6_address := omit,
choose_id := omit
}
template (value) F_TEID ts_PFCP_F_TEID_choose_v4(template (omit) OCT1 choose_id := omit) := {
elementIdentifier := 21,
lengthIndicator := 0,
v4 := '1'B,
v6 := '0'B,
ch := '1'B,
chid := '0'B,
spare := '0000'B,
teid := omit,
ipv4_address := omit,
ipv6_address := omit,
choose_id := choose_id
}
template (value) PDI_IE ts_PFCP_PDI(e_PFCP_Src_Iface src_iface,
template (omit) F_TEID local_F_TEID := omit,
template (omit) UE_IP_Address ue_addr_v4 := omit) := {
elementIdentifier := 2,
lengthIndicator := 0,
grouped_ie := {
source_interface := ts_PFCP_Src_Iface(src_iface),
local_F_TEID := local_F_TEID,
pdn_instance := omit,
ue_ip_address := ue_addr_v4,
traffic_endpoint_id := omit,
sdf_filter_list := omit,
application_id := omit,
ethernet_packet_filter_list := omit,
qfi_list := omit
}
}
template (value) Apply_Action ts_PFCP_Apply_Action(BIT1 forw := '0'B, BIT1 drop := '0'B, BIT1 buff := '0'B) := {
elementIdentifier := 44,
lengthIndicator := 0,
drop := drop,
forw := forw,
buff := buff,
nocp := '0'B,
dupl := '0'B,
spare := '000'B
}
function ts_PFCP_Apply_Action_FORW() return template (value) Apply_Action {
return ts_PFCP_Apply_Action(forw := '1'B);
}
template (value) Apply_Action ts_PFCP_Apply_Action_DROP := ts_PFCP_Apply_Action(drop := '1'B);
template (value) Apply_Action ts_PFCP_Apply_Action_BUFF := ts_PFCP_Apply_Action(buff := '1'B);
type enumerated e_PFCP_Dest_Iface {
ACCESS (0),
CORE (1),
SGI_LAN_N6_LAN (2),
CP_FUNCTION (3),
LI_FUNCTION (4),
x_5G_VN_INTERNAL (5)
};
template (value) Destination_Interface ts_PFCP_Destination_Interface(e_PFCP_Dest_Iface di) := {
elementIdentifier := 42,
lengthIndicator := 0,
interface_value := enum2int(di),
spare := '0000'B
}
template (value) Outer_Header_Creation ts_PFCP_Outer_Header_Creation_GTP_ipv4(OCT4 remote_teid, charstring remote_addr_v4) := {
elementIdentifier := 84,
lengthIndicator := 0,
ohc_description_oct5 := '00000001'B,
ohc_description_oct6 := '00000000'B,
teid := remote_teid,
ipv4 := f_inet_addr(remote_addr_v4),
ipv6 := omit,
udp_port := omit
}
type enumerated e_PFCP_Outer_Header_Removal {
GTP_U_UDP_IPV4 (0),
GTP_U_UDP_IPV6 (1),
UDP_IPV4 (2),
UDP_IPV6 (3),
IPV4 (4),
IPV6 (5),
GTP_U_UDP_IP (6),
VLAN_S_TAG (7),
S_TAG_AND_C_TAG (8)
};
template (value) Outer_Header_Removal ts_PFCP_Outer_Header_Removal(e_PFCP_Outer_Header_Removal ohr) := {
elementIdentifier := 95,
lengthIndicator := 0,
ohc_description := enum2int(ohr)
}
template (value) Forwarding_Parameters ts_PFCP_Forwarding_Parameters(
e_PFCP_Dest_Iface dest_iface,
template (omit) Outer_Header_Creation outer_header_creation := omit
) := {
elementIdentifier := 4,
lengthIndicator := 0,
grouped_ie := {
destination_interface := ts_PFCP_Destination_Interface(dest_iface),
pdn_Instance := omit,
redirect_information := omit,
outer_header_creation := outer_header_creation,
transport_level_marking := omit,
forwarding_policy := omit,
header_enrichment := omit,
traffic_endpoint_ID := omit
}
}
template (value) FAR_ID ts_PFCP_FAR_ID(LIN4_BO_LAST far_id) := {
elementIdentifier := 108,
lengthIndicator := 0,
id_value := far_id
}
template (value) Create_FAR ts_PFCP_Create_FAR(LIN4_BO_LAST far_id, template (value) Apply_Action aa, Forwarding_Parameters fp) := {
elementIdentifier := 3,
lengthIndicator := 0,
grouped_ie := {
far_id := ts_PFCP_FAR_ID(far_id),
apply_action := aa,
forwarding_parameters := fp,
duplicating_parameters := omit,
bar_id := omit
}
}
template (value) PDR_ID ts_PFCP_PDR_ID(OCT2 pdr_id) := {
elementIdentifier := 56,
lengthIndicator := 0,
rule_id := pdr_id
}
template (value) Precedence ts_PFCP_Precedence(LIN4_BO_LAST val) := {
elementIdentifier := 29,
lengthIndicator := 0,
precedence_value := val
}
template (value) Create_PDR ts_PFCP_Create_PDR(integer pdr_id, template (value) PDI_IE pdi,
template (omit) Outer_Header_Removal outer_header_removal := omit,
LIN4_BO_LAST far_id) := {
elementIdentifier := 1,
lengthIndicator := 0,
grouped_ie := {
pdr_id := ts_PFCP_PDR_ID(int2oct(pdr_id, 2)),
precedence := ts_PFCP_Precedence(0),
pdi := pdi,
outer_header_removal := outer_header_removal,
FAR_ID_list := { ts_PFCP_FAR_ID(far_id) },
uRR_ID_list := omit,
qER_ID_list := omit,
activate_predefined_rules := omit
}
}
function ts_PFCP_Session_Est_Req(charstring node_id, OCT8 cp_seid, Create_PDR_list create_pdr, Create_FAR_list create_far)
return template (value) PDU_PFCP {
var template (value) PDU_PFCP t := ts_PDU_PFCP();
t.message_body := {
pfcp_session_establishment_request := {
node_id := ts_PFCP_Node_ID_ipv4(f_inet_addr(node_id)),
CP_F_SEID := ts_PFCP_F_SEID_ipv4(node_id, cp_seid),
create_PDR_list := create_pdr,
create_FAR_list := create_far,
create_URR_list := omit,
create_QER_list := omit,
create_BAR := omit,
create_traffic_endpoint_list := omit,
pdn_type := omit,
node_list := omit,
up_inactivity_timer := omit
}
};
return t;
}
function tr_PFCP_Session_Est_Req() return template (present) PDU_PFCP {
var template PDU_PFCP t := tr_PDU_PFCP(?);
t.message_body := {
pfcp_session_establishment_request := {
node_id := ?
}
};
return t;
}
template (value) Created_PDR ts_PFCP_Created_PDR(PDR_ID pdr_id, template (value) F_TEID local_F_TEID) := {
elementIdentifier := 8,
lengthIndicator := 0,
grouped_ie := {
pdr_id := pdr_id,
local_F_TEID := local_F_TEID
}
}
function ts_PFCP_Session_Est_Resp(LIN3_BO_LAST seq_nr, template (value) Node_ID node_id, OCT8 seid)
return template (value) PDU_PFCP {
var template (value) PDU_PFCP t := ts_PDU_PFCP(seq_nr, seid);
t.sequence_number := seq_nr;
t.message_body := {
pfcp_session_establishment_response := {
node_id := node_id,
cause := ts_PFCP_Cause(REQUEST_ACCEPTED)
}
};
return t;
}
function tr_PFCP_Session_Est_Resp(template (present) OCT8 hdr_seid := ?) return template (present) PDU_PFCP {
var template PDU_PFCP t := tr_PDU_PFCP(hdr_seid);
t.message_body := {
pfcp_session_establishment_response := {
node_id := ?,
cause := tr_PFCP_Cause(REQUEST_ACCEPTED),
offending_ie := *,
UP_F_SEID := ?,
created_PDR_list := ?,
load_control_information := *,
overload_control_information := *,
node_list := *,
failed_rule_id := *,
created_traffic_endpoint_list := *
}
};
return t;
}
function tr_PFCP_Session_Mod_Req(template (present) OCT8 seid := ?) return template (present) PDU_PFCP {
var template PDU_PFCP t := tr_PDU_PFCP(seid);
t.message_body := {
pfcp_session_modification_request := ?
};
return t;
}
function ts_PFCP_Session_Mod_Resp(LIN3_BO_LAST seq_nr, OCT8 seid) return template (value) PDU_PFCP {
var template (value) PDU_PFCP t := ts_PDU_PFCP(seq_nr, seid);
t.message_body := {
pfcp_session_modification_response := {
cause := ts_PFCP_Cause(REQUEST_ACCEPTED),
offending_IE := omit,
created_PDR := omit,
load_control_information := omit,
overload_control_information := omit,
usage_report := omit,
failed_rule_id := omit,
additional_usage_reports_information := omit,
created_updated_traffic_endpoint := omit
}
};
return t;
}
function ts_PFCP_Session_Del_Req(OCT8 seid) return template (value) PDU_PFCP {
var template (value) PDU_PFCP t := ts_PDU_PFCP(seid := seid);
t.message_body := {
pfcp_session_deletion_request := { }
};
return t;
}
function tr_PFCP_Session_Del_Req(template (present) OCT8 seid := ?) return template (present) PDU_PFCP {
var template PDU_PFCP t := tr_PDU_PFCP(seid);
t.message_body := {
pfcp_session_deletion_request := ?
};
return t;
}
function ts_PFCP_Session_Del_Resp(LIN3_BO_LAST seq_nr, OCT8 seid, e_PFCP_Cause cause := REQUEST_ACCEPTED)
return template (value) PDU_PFCP {
var template (value) PDU_PFCP t := ts_PDU_PFCP(seq_nr, seid);
t.message_body := {
pfcp_session_deletion_response := {
cause := ts_PFCP_Cause(cause),
offending_IE := omit,
load_control_information := omit,
overload_control_information := omit,
usage_report := omit
}
};
return t;
}
function tr_PFCP_Session_Del_Resp(template (present) OCT8 seid := ?,
template (present) Cause cause := tr_PFCP_Cause(REQUEST_ACCEPTED))
return template (present) PDU_PFCP {
var template PDU_PFCP t := tr_PDU_PFCP(seid);
t.message_body := {
pfcp_session_deletion_response := {
cause := cause,
offending_IE := *,
load_control_information := *,
overload_control_information := *,
usage_report := *
}
};
return t;
}
}