NS_Emulation: Introduce NS_Provider underneath NS_Emulation
This is a step to prepare the NS_Emulation for operating on top of Frame Relay, not just UDP/IP. We replace the NS_CodecPort (mapping to a IPL4asp) with a newly introduced NS_Provider_CT, specifically a NS_Provider_IPL4_CT. This change removes any IP specific bits from NS_Emulation and moves it into the newly-created NS_ProvideR_IPL4. Change-Id: I4d0b7ad0ed9447a038dd3eeee2b975146d10fba0
This commit is contained in:
parent
07cb87a90c
commit
013d65af1e
|
@ -1,5 +1,5 @@
|
||||||
/* GPRS-NS Emulation in TTCN-3
|
/* GPRS-NS Emulation in TTCN-3
|
||||||
* (C) 2018 Harald Welte <laforge@gnumonks.org>
|
* (C) 2018-2020 Harald Welte <laforge@gnumonks.org>
|
||||||
* contributions by sysmocom - s.f.m.c. GmbH
|
* contributions by sysmocom - s.f.m.c. GmbH
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -13,8 +13,7 @@ module NS_Emulation {
|
||||||
import from NS_Types all;
|
import from NS_Types all;
|
||||||
import from BSSGP_Types all;
|
import from BSSGP_Types all;
|
||||||
import from Osmocom_Gb_Types all;
|
import from Osmocom_Gb_Types all;
|
||||||
import from NS_CodecPort all;
|
import from NS_Provider_IPL4 all;
|
||||||
import from NS_CodecPort_CtrlFunct all;
|
|
||||||
import from IPL4asp_Types all;
|
import from IPL4asp_Types all;
|
||||||
import from PCUIF_Types all;
|
import from PCUIF_Types all;
|
||||||
|
|
||||||
|
@ -72,8 +71,7 @@ module NS_Emulation {
|
||||||
type port NS_SP_PT message {
|
type port NS_SP_PT message {
|
||||||
in NsUnitdataRequest;
|
in NsUnitdataRequest;
|
||||||
out NsUnitdataIndication,
|
out NsUnitdataIndication,
|
||||||
NsStatusIndication,
|
NsStatusIndication;
|
||||||
ASP_Event;
|
|
||||||
} with { extension "internal" };
|
} with { extension "internal" };
|
||||||
|
|
||||||
/* port from the user point of view */
|
/* port from the user point of view */
|
||||||
|
@ -92,15 +90,12 @@ module NS_Emulation {
|
||||||
|
|
||||||
private function f_init() runs on NS_CT {
|
private function f_init() runs on NS_CT {
|
||||||
var Result res;
|
var Result res;
|
||||||
|
|
||||||
/* Connect the UDP socket */
|
/* Connect the UDP socket */
|
||||||
res := f_IPL4_connect(NSCP, config.remote_ip, config.remote_udp_port, config.local_ip, config.local_udp_port, 0, { udp := {}});
|
vc_NSP_IP := NS_Provider_IPL4_CT.create;
|
||||||
if (not ispresent(res.connId)) {
|
connect(self:NSCP, vc_NSP_IP:NSE);
|
||||||
setverdict(fail, "Could not connect NS UDP socket from " &
|
vc_NSP_IP.start(NS_Provider_IPL4.main(config));
|
||||||
config.local_ip & ":" & int2str(config.local_udp_port) &
|
|
||||||
" to " & config.remote_ip & ":" & int2str(config.remote_udp_port));
|
|
||||||
mtc.stop;
|
|
||||||
}
|
|
||||||
g_conn_id := res.connId;
|
|
||||||
f_change_state(NSE_S_DEAD_BLOCKED);
|
f_change_state(NSE_S_DEAD_BLOCKED);
|
||||||
/* Send the first NS-ALIVE to test the connection */
|
/* Send the first NS-ALIVE to test the connection */
|
||||||
if (not config.role_sgsn) {
|
if (not config.role_sgsn) {
|
||||||
|
@ -108,16 +103,28 @@ module NS_Emulation {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type component NS_Provider_CT {
|
||||||
|
/* upper port, facing to NS_Emulation:NSCP */
|
||||||
|
port NS_PROVIDER_PT NSE;
|
||||||
|
/* lower layer ports (UDP/IP, Frame Relay) are added in derived components */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* port between NS_Provider and NS_CT */
|
||||||
|
type port NS_PROVIDER_PT message {
|
||||||
|
inout PDU_NS;
|
||||||
|
} with { extension "internal" };
|
||||||
|
|
||||||
type component NS_CT {
|
type component NS_CT {
|
||||||
/* UDP port towards the bottom (IUT) */
|
/* UDP port towards the bottom (IUT) */
|
||||||
port NS_CODEC_PT NSCP;
|
port NS_PROVIDER_PT NSCP;
|
||||||
|
var NS_Provider_IPL4_CT vc_NSP_IP;
|
||||||
|
|
||||||
/* NS-User SAP towards the user */
|
/* NS-User SAP towards the user */
|
||||||
port NS_SP_PT NS_SP;
|
port NS_SP_PT NS_SP;
|
||||||
|
|
||||||
var NSConfiguration config;
|
var NSConfiguration config;
|
||||||
|
|
||||||
var NseState g_state := NSE_S_DEAD_BLOCKED;
|
var NseState g_state := NSE_S_DEAD_BLOCKED;
|
||||||
var ConnectionId g_conn_id := -1;
|
|
||||||
|
|
||||||
timer Tns_alive := 3.0;
|
timer Tns_alive := 3.0;
|
||||||
timer Tns_test := 10.0;
|
timer Tns_test := 10.0;
|
||||||
|
@ -144,32 +151,32 @@ module NS_Emulation {
|
||||||
}
|
}
|
||||||
|
|
||||||
private function f_sendReset() runs on NS_CT {
|
private function f_sendReset() runs on NS_CT {
|
||||||
NSCP.send(t_NS_Send(g_conn_id, ts_NS_RESET(NS_CAUSE_OM_INTERVENTION, config.nsvci, config.nsei)));
|
NSCP.send(ts_NS_RESET(NS_CAUSE_OM_INTERVENTION, config.nsvci, config.nsei));
|
||||||
g_state := NSE_S_WAIT_RESET;
|
g_state := NSE_S_WAIT_RESET;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function f_sendAlive() runs on NS_CT {
|
private function f_sendAlive() runs on NS_CT {
|
||||||
NSCP.send(t_NS_Send(g_conn_id, t_NS_ALIVE));
|
NSCP.send(t_NS_ALIVE);
|
||||||
Tns_alive.start;
|
Tns_alive.start;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function f_sendUnblock() runs on NS_CT {
|
private function f_sendUnblock() runs on NS_CT {
|
||||||
NSCP.send(t_NS_Send(g_conn_id, t_NS_UNBLOCK));
|
NSCP.send(t_NS_UNBLOCK);
|
||||||
Tns_block.start;
|
Tns_block.start;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function f_sendBlock(NsCause cause) runs on NS_CT {
|
private function f_sendBlock(NsCause cause) runs on NS_CT {
|
||||||
NSCP.send(t_NS_Send(g_conn_id, ts_NS_BLOCK(cause, config.nsvci)));
|
NSCP.send(ts_NS_BLOCK(cause, config.nsvci));
|
||||||
Tns_block.start;
|
Tns_block.start;
|
||||||
}
|
}
|
||||||
|
|
||||||
altstep as_allstate() runs on NS_CT {
|
altstep as_allstate() runs on NS_CT {
|
||||||
var NS_RecvFrom rf;
|
var PDU_NS rf;
|
||||||
var ASP_Event evt;
|
var ASP_Event evt;
|
||||||
|
|
||||||
/* transition to DEAD if t_alive times out */
|
/* transition to DEAD if t_alive times out */
|
||||||
[Tns_alive.running] Tns_alive.timeout {
|
[Tns_alive.running] Tns_alive.timeout {
|
||||||
log("Tns-alive expired: changing to DEAD_BLOCKED + starting Tns-test");
|
log("Tns-aeive expired: changing to DEAD_BLOCKED + starting Tns-test");
|
||||||
f_change_state(NSE_S_DEAD_BLOCKED);
|
f_change_state(NSE_S_DEAD_BLOCKED);
|
||||||
Tns_test.start;
|
Tns_test.start;
|
||||||
}
|
}
|
||||||
|
@ -180,31 +187,31 @@ module NS_Emulation {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stop t_alive when receiving ALIVE-ACK */
|
/* Stop t_alive when receiving ALIVE-ACK */
|
||||||
[] NSCP.receive(t_NS_RecvFrom(t_NS_ALIVE_ACK)) {
|
[] NSCP.receive(t_NS_ALIVE_ACK) {
|
||||||
log("NS-ALIVE-ACK received: stopping Tns-alive; starting Tns-test");
|
log("NS-ALIVE-ACK received: stopping Tns-alive; starting Tns-test");
|
||||||
Tns_alive.stop;
|
Tns_alive.stop;
|
||||||
Tns_test.start;
|
Tns_test.start;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* respond to NS-ALIVE with NS-ALIVE-ACK */
|
/* respond to NS-ALIVE with NS-ALIVE-ACK */
|
||||||
[] NSCP.receive(t_NS_RecvFrom(t_NS_ALIVE)) {
|
[] NSCP.receive(t_NS_ALIVE) {
|
||||||
NSCP.send(t_NS_Send(g_conn_id, t_NS_ALIVE_ACK));
|
NSCP.send(t_NS_ALIVE_ACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Respond to BLOCK for wrong NSVCI */
|
/* Respond to BLOCK for wrong NSVCI */
|
||||||
[] NSCP.receive(t_NS_RecvFrom(tr_NS_BLOCK(?, ?))) -> value rf {
|
[] NSCP.receive(tr_NS_BLOCK(?, ?)) -> value rf {
|
||||||
log("Rx NS-BLOCK for unknown NSVCI");
|
log("Rx NS-BLOCK for unknown NSVCI");
|
||||||
/* FIXME */
|
/* FIXME */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Respond to RESET with correct NSEI/NSVCI */
|
/* Respond to RESET with correct NSEI/NSVCI */
|
||||||
[] NSCP.receive(t_NS_RecvFrom(tr_NS_RESET(?, config.nsvci, config.nsei))) -> value rf {
|
[] NSCP.receive(tr_NS_RESET(?, config.nsvci, config.nsei)) -> value rf {
|
||||||
f_change_state(NSE_S_ALIVE_BLOCKED);
|
f_change_state(NSE_S_ALIVE_BLOCKED);
|
||||||
NSCP.send(t_NS_Send(g_conn_id, ts_NS_RESET_ACK(config.nsvci, config.nsei)));
|
NSCP.send(ts_NS_RESET_ACK(config.nsvci, config.nsei));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Respond to RESET with wrong NSEI/NSVCI */
|
/* Respond to RESET with wrong NSEI/NSVCI */
|
||||||
[] NSCP.receive(t_NS_RecvFrom(tr_NS_RESET(?, ?, ?))) -> value rf {
|
[] NSCP.receive(tr_NS_RESET(?, ?, ?)) -> value rf {
|
||||||
log("Rx NS-RESET for unknown NSEI/NSVCI");
|
log("Rx NS-RESET for unknown NSEI/NSVCI");
|
||||||
/* FIXME */
|
/* FIXME */
|
||||||
}
|
}
|
||||||
|
@ -212,49 +219,47 @@ module NS_Emulation {
|
||||||
[config.role_sgsn and config.handle_sns] as_sns_sgsn();
|
[config.role_sgsn and config.handle_sns] as_sns_sgsn();
|
||||||
|
|
||||||
/* default case of handling unknown PDUs */
|
/* default case of handling unknown PDUs */
|
||||||
[] NSCP.receive(t_NS_RecvFrom(?)) -> value rf {
|
[] NSCP.receive(PDU_NS: ?) -> value rf {
|
||||||
log("Rx Unexpected NS PDU ", rf.msg," in state ", g_state);
|
log("Rx Unexpected NS PDU ", rf," in state ", g_state);
|
||||||
NSCP.send(t_NS_Send(g_conn_id, ts_NS_STATUS(NS_CAUSE_PDU_NOT_COMPATIBLE_WITH_PROTOCOL_STATE, rf.msg)));
|
NSCP.send(ts_NS_STATUS(NS_CAUSE_PDU_NOT_COMPATIBLE_WITH_PROTOCOL_STATE, rf));
|
||||||
}
|
}
|
||||||
/* Forwarding of ASP_Evet to user */
|
|
||||||
[] NSCP.receive(ASP_Event:?) -> value evt { NS_SP.send(evt); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* simple IP Sub-Network Service responder for the SGSN side. This is not a full implementation
|
/* simple IP Sub-Network Service responder for the SGSN side. This is not a full implementation
|
||||||
* of the protocol, merely sufficient to make the PCU/BSS side happy to proceed */
|
* of the protocol, merely sufficient to make the PCU/BSS side happy to proceed */
|
||||||
altstep as_sns_sgsn() runs on NS_CT {
|
altstep as_sns_sgsn() runs on NS_CT {
|
||||||
var NS_RecvFrom rf;
|
var PDU_NS rf;
|
||||||
[] NSCP.receive(t_NS_RecvFrom(tr_SNS_SIZE(config.nsei))) -> value rf {
|
[] NSCP.receive(tr_SNS_SIZE(config.nsei)) -> value rf {
|
||||||
/* blindly acknowledge whatever the PCU sends */
|
/* blindly acknowledge whatever the PCU sends */
|
||||||
NSCP.send(t_NS_Send(g_conn_id, ts_SNS_SIZE_ACK(config.nsei, omit)));
|
NSCP.send(ts_SNS_SIZE_ACK(config.nsei, omit));
|
||||||
}
|
}
|
||||||
[] NSCP.receive(t_NS_RecvFrom(tr_SNS_SIZE(?))) {
|
[] NSCP.receive(tr_SNS_SIZE(?)) {
|
||||||
setverdict(fail, "SNS-SIZE from unexpected NSEI");
|
setverdict(fail, "SNS-SIZE from unexpected NSEI");
|
||||||
self.stop;
|
self.stop;
|
||||||
}
|
}
|
||||||
[] NSCP.receive(t_NS_RecvFrom(tr_SNS_CONFIG(config.nsei, true,
|
[] NSCP.receive(tr_SNS_CONFIG(config.nsei, true,
|
||||||
{tr_SNS_IPv4(config.remote_ip, config.remote_udp_port)}))) -> value rf {
|
{tr_SNS_IPv4(config.remote_ip, config.remote_udp_port)})) -> value rf {
|
||||||
/* blindly acknowledge whatever the PCU sends */
|
/* blindly acknowledge whatever the PCU sends */
|
||||||
NSCP.send(t_NS_Send(g_conn_id, ts_SNS_CONFIG_ACK(config.nsei, omit)));
|
NSCP.send(ts_SNS_CONFIG_ACK(config.nsei, omit));
|
||||||
/* send a SNS-CONFIG in response and expect a SNS-CONFIG-ACK */
|
/* send a SNS-CONFIG in response and expect a SNS-CONFIG-ACK */
|
||||||
var IP4_Elements v4 := { valueof(ts_SNS_IPv4(config.local_ip, config.local_udp_port)) };
|
var IP4_Elements v4 := { valueof(ts_SNS_IPv4(config.local_ip, config.local_udp_port)) };
|
||||||
NSCP.send(t_NS_Send(g_conn_id, ts_SNS_CONFIG(config.nsei, true, v4)));
|
NSCP.send(ts_SNS_CONFIG(config.nsei, true, v4));
|
||||||
alt {
|
alt {
|
||||||
[] NSCP.receive(t_NS_RecvFrom(tr_SNS_CONFIG_ACK(config.nsei, omit))) {
|
[] NSCP.receive(tr_SNS_CONFIG_ACK(config.nsei, omit)) {
|
||||||
/* success */
|
/* success */
|
||||||
}
|
}
|
||||||
[] NSCP.receive(t_NS_RecvFrom(tr_SNS_CONFIG_ACK(config.nsei, ?))) {
|
[] NSCP.receive(tr_SNS_CONFIG_ACK(config.nsei, ?)) {
|
||||||
setverdict(fail, "Unexpected SNS-CONFIG-NACK");
|
setverdict(fail, "Unexpected SNS-CONFIG-NACK");
|
||||||
self.stop;
|
self.stop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[] NSCP.receive(t_NS_RecvFrom(tr_SNS_CONFIG(config.nsei, false, ?))) { /* ignore */}
|
[] NSCP.receive(tr_SNS_CONFIG(config.nsei, false, ?)) { /* ignore */}
|
||||||
[] NSCP.receive(t_NS_RecvFrom(tr_SNS_CONFIG(config.nsei, true, ?))) {
|
[] NSCP.receive(tr_SNS_CONFIG(config.nsei, true, ?)) {
|
||||||
setverdict(fail, "Unexpected SNS-CONFIG content");
|
setverdict(fail, "Unexpected SNS-CONFIG content");
|
||||||
self.stop;
|
self.stop;
|
||||||
}
|
}
|
||||||
[] NSCP.receive(t_NS_RecvFrom(tr_SNS_CONFIG(?, ?, ?))) {
|
[] NSCP.receive(tr_SNS_CONFIG(?, ?, ?)) {
|
||||||
setverdict(fail, "SNS-CONFIG from unexpected NSEI");
|
setverdict(fail, "SNS-CONFIG from unexpected NSEI");
|
||||||
self.stop;
|
self.stop;
|
||||||
}
|
}
|
||||||
|
@ -262,7 +267,7 @@ module NS_Emulation {
|
||||||
|
|
||||||
private function f_ScanEvents() runs on NS_CT {
|
private function f_ScanEvents() runs on NS_CT {
|
||||||
var NsUnitdataRequest ud_req;
|
var NsUnitdataRequest ud_req;
|
||||||
var NS_RecvFrom rf;
|
var PDU_NS rf;
|
||||||
var default d;
|
var default d;
|
||||||
|
|
||||||
d := activate(as_allstate());
|
d := activate(as_allstate());
|
||||||
|
@ -274,7 +279,7 @@ module NS_Emulation {
|
||||||
}
|
}
|
||||||
} else if (g_state == NSE_S_WAIT_RESET) {
|
} else if (g_state == NSE_S_WAIT_RESET) {
|
||||||
alt {
|
alt {
|
||||||
[] NSCP.receive(t_NS_RecvFrom(tr_NS_RESET_ACK(config.nsvci, config.nsei))) -> value rf {
|
[] NSCP.receive(tr_NS_RESET_ACK(config.nsvci, config.nsei)) -> value rf {
|
||||||
f_change_state(NSE_S_ALIVE_BLOCKED);
|
f_change_state(NSE_S_ALIVE_BLOCKED);
|
||||||
f_sendAlive();
|
f_sendAlive();
|
||||||
f_sendUnblock();
|
f_sendUnblock();
|
||||||
|
@ -283,16 +288,16 @@ module NS_Emulation {
|
||||||
} else if (g_state == NSE_S_ALIVE_BLOCKED) {
|
} else if (g_state == NSE_S_ALIVE_BLOCKED) {
|
||||||
alt {
|
alt {
|
||||||
/* bogus block, just respond with ACK */
|
/* bogus block, just respond with ACK */
|
||||||
[] NSCP.receive(t_NS_RecvFrom(tr_NS_BLOCK(?, config.nsvci))) -> value rf {
|
[] NSCP.receive(tr_NS_BLOCK(?, config.nsvci)) -> value rf {
|
||||||
NSCP.send(t_NS_Send(g_conn_id, ts_NS_BLOCK_ACK(config.nsvci)));
|
NSCP.send(ts_NS_BLOCK_ACK(config.nsvci));
|
||||||
}
|
}
|
||||||
/* Respond to UNBLOCK with UNBLOCK-ACK + change state */
|
/* Respond to UNBLOCK with UNBLOCK-ACK + change state */
|
||||||
[] NSCP.receive(t_NS_RecvFrom(t_NS_UNBLOCK)) -> value rf {
|
[] NSCP.receive(t_NS_UNBLOCK) -> value rf {
|
||||||
NSCP.send(t_NS_Send(g_conn_id, t_NS_UNBLOCK_ACK));
|
NSCP.send(t_NS_UNBLOCK_ACK);
|
||||||
Tns_block.stop;
|
Tns_block.stop;
|
||||||
f_change_state(NSE_S_ALIVE_UNBLOCKED);
|
f_change_state(NSE_S_ALIVE_UNBLOCKED);
|
||||||
}
|
}
|
||||||
[] NSCP.receive(t_NS_RecvFrom(t_NS_UNBLOCK_ACK)) -> value rf {
|
[] NSCP.receive(t_NS_UNBLOCK_ACK) -> value rf {
|
||||||
Tns_block.stop;
|
Tns_block.stop;
|
||||||
f_change_state(NSE_S_ALIVE_UNBLOCKED);
|
f_change_state(NSE_S_ALIVE_UNBLOCKED);
|
||||||
}
|
}
|
||||||
|
@ -304,33 +309,33 @@ module NS_Emulation {
|
||||||
} else if (g_state == NSE_S_ALIVE_UNBLOCKED) {
|
} else if (g_state == NSE_S_ALIVE_UNBLOCKED) {
|
||||||
alt {
|
alt {
|
||||||
/* bogus unblock, just respond with ACK */
|
/* bogus unblock, just respond with ACK */
|
||||||
[] NSCP.receive(t_NS_RecvFrom(t_NS_UNBLOCK)) -> value rf {
|
[] NSCP.receive(t_NS_UNBLOCK) -> value rf {
|
||||||
NSCP.send(t_NS_Send(g_conn_id, t_NS_UNBLOCK_ACK));
|
NSCP.send(t_NS_UNBLOCK_ACK);
|
||||||
}
|
}
|
||||||
/* Respond to BLOCK with BLOCK-ACK + change state */
|
/* Respond to BLOCK with BLOCK-ACK + change state */
|
||||||
[] NSCP.receive(t_NS_RecvFrom(tr_NS_BLOCK(?, config.nsvci))) -> value rf {
|
[] NSCP.receive(tr_NS_BLOCK(?, config.nsvci)) -> value rf {
|
||||||
NSCP.send(t_NS_Send(g_conn_id, ts_NS_BLOCK_ACK(config.nsvci)));
|
NSCP.send(ts_NS_BLOCK_ACK(config.nsvci));
|
||||||
Tns_block.stop;
|
Tns_block.stop;
|
||||||
f_change_state(NSE_S_ALIVE_BLOCKED);
|
f_change_state(NSE_S_ALIVE_BLOCKED);
|
||||||
}
|
}
|
||||||
[] NSCP.receive(t_NS_RecvFrom(tr_NS_BLOCK_ACK(config.nsvci))) -> value rf {
|
[] NSCP.receive(tr_NS_BLOCK_ACK(config.nsvci)) -> value rf {
|
||||||
Tns_block.stop;
|
Tns_block.stop;
|
||||||
}
|
}
|
||||||
/* NS-UNITDATA PDU from network to NS-UNITDATA.ind to user */
|
/* NS-UNITDATA PDU from network to NS-UNITDATA.ind to user */
|
||||||
[] NSCP.receive(t_NS_RecvFrom(tr_NS_UNITDATA(?, ?, ?))) -> value rf {
|
[] NSCP.receive(tr_NS_UNITDATA(?, ?, ?)) -> value rf {
|
||||||
NS_SP.send(t_NsUdInd(config.nsei,
|
NS_SP.send(t_NsUdInd(config.nsei,
|
||||||
oct2int(rf.msg.pDU_NS_Unitdata.bVCI),
|
oct2int(rf.pDU_NS_Unitdata.bVCI),
|
||||||
rf.msg.pDU_NS_Unitdata.nS_SDU));
|
rf.pDU_NS_Unitdata.nS_SDU));
|
||||||
}
|
}
|
||||||
/* NS-UNITDATA.req from user to NS-UNITDATA PDU on network */
|
/* NS-UNITDATA.req from user to NS-UNITDATA PDU on network */
|
||||||
[] NS_SP.receive(t_NsUdReq(config.nsei, ?, ?, omit)) -> value ud_req {
|
[] NS_SP.receive(t_NsUdReq(config.nsei, ?, ?, omit)) -> value ud_req {
|
||||||
/* using raw octetstring PDU */
|
/* using raw octetstring PDU */
|
||||||
NSCP.send(t_NS_Send(g_conn_id, ts_NS_UNITDATA(t_SduCtrlB, ud_req.bvci, ud_req.sdu)));
|
NSCP.send(ts_NS_UNITDATA(t_SduCtrlB, ud_req.bvci, ud_req.sdu));
|
||||||
}
|
}
|
||||||
[] NS_SP.receive(t_NsUdReq(config.nsei, ?, omit, ?)) -> value ud_req {
|
[] NS_SP.receive(t_NsUdReq(config.nsei, ?, omit, ?)) -> value ud_req {
|
||||||
/* using decoded BSSGP PDU that we need to encode first */
|
/* using decoded BSSGP PDU that we need to encode first */
|
||||||
var octetstring enc := enc_PDU_BSSGP(ud_req.bssgp);
|
var octetstring enc := enc_PDU_BSSGP(ud_req.bssgp);
|
||||||
NSCP.send(t_NS_Send(g_conn_id, ts_NS_UNITDATA(t_SduCtrlB, ud_req.bvci, enc)));
|
NSCP.send(ts_NS_UNITDATA(t_SduCtrlB, ud_req.bvci, enc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
/* NS Provider for NS/UDP/IP
|
||||||
|
* (C) 2020 Harald Welte <laforge@gnumonks.org>
|
||||||
|
* contributions by sysmocom - s.f.m.c. GmbH
|
||||||
|
* 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 NS_Provider_IPL4 {
|
||||||
|
|
||||||
|
import from NS_Emulation all;
|
||||||
|
import from NS_Types all;
|
||||||
|
|
||||||
|
import from IPL4asp_Types all;
|
||||||
|
import from IPL4asp_PortType all;
|
||||||
|
|
||||||
|
type component NS_Provider_IPL4_CT extends NS_Provider_CT {
|
||||||
|
/* down-facing port towards IPL4asp to IUT */
|
||||||
|
port IPL4asp_PT IPL4;
|
||||||
|
var integer g_conn_id := -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
function main(NSConfiguration config) runs on NS_Provider_IPL4_CT {
|
||||||
|
|
||||||
|
/* connect socket */
|
||||||
|
var Result res := f_IPL4_connect(IPL4, config.remote_ip, config.remote_udp_port, config.local_ip,
|
||||||
|
config.local_udp_port, 0, { udp := {}});
|
||||||
|
if (not ispresent(res.connId)) {
|
||||||
|
setverdict(fail, "Could not connect NS UDP socket from " &
|
||||||
|
config.local_ip & ":" & int2str(config.local_udp_port) &
|
||||||
|
" to " & config.remote_ip & ":" & int2str(config.remote_udp_port));
|
||||||
|
mtc.stop;
|
||||||
|
}
|
||||||
|
g_conn_id := res.connId;
|
||||||
|
|
||||||
|
/* transceive beteween user-facing port and UDP socket */
|
||||||
|
while (true) {
|
||||||
|
var ASP_RecvFrom rx_rf;
|
||||||
|
var PDU_NS rx_pdu;
|
||||||
|
alt {
|
||||||
|
|
||||||
|
[] IPL4.receive(ASP_RecvFrom:?) -> value rx_rf {
|
||||||
|
NSE.send(dec_PDU_NS(rx_rf.msg));
|
||||||
|
}
|
||||||
|
|
||||||
|
[] IPL4.receive(ASP_ConnId_ReadyToRelease:?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
[] IPL4.receive(ASP_Event:?) {
|
||||||
|
}
|
||||||
|
|
||||||
|
[] NSE.receive(PDU_NS:?) -> value rx_pdu {
|
||||||
|
IPL4.send(ASP_Send:{connId := g_conn_id, proto := { udp := {} }, msg := enc_PDU_NS(rx_pdu)});
|
||||||
|
}
|
||||||
|
|
||||||
|
} /* alt */
|
||||||
|
} /* while */
|
||||||
|
|
||||||
|
} /* main */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} /* module */
|
|
@ -50,7 +50,7 @@ gen_links $DIR $FILES
|
||||||
|
|
||||||
DIR=../library
|
DIR=../library
|
||||||
FILES="Misc_Helpers.ttcn General_Types.ttcn Osmocom_VTY_Functions.ttcn Native_Functions.ttcn Native_FunctionDefs.cc GSM_Types.ttcn GSM_RR_Types.ttcn Osmocom_Types.ttcn RLCMAC_Templates.ttcn RLCMAC_Types.ttcn RLCMAC_CSN1_Templates.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc "
|
FILES="Misc_Helpers.ttcn General_Types.ttcn Osmocom_VTY_Functions.ttcn Native_Functions.ttcn Native_FunctionDefs.cc GSM_Types.ttcn GSM_RR_Types.ttcn Osmocom_Types.ttcn RLCMAC_Templates.ttcn RLCMAC_Types.ttcn RLCMAC_CSN1_Templates.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc "
|
||||||
FILES+="NS_Emulation.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn NS_CodecPort_CtrlFunctDef.cc "
|
FILES+="NS_Provider_IPL4.ttcn NS_Emulation.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn NS_CodecPort_CtrlFunctDef.cc "
|
||||||
FILES+="BSSGP_Emulation.ttcnpp Osmocom_Gb_Types.ttcn "
|
FILES+="BSSGP_Emulation.ttcnpp Osmocom_Gb_Types.ttcn "
|
||||||
FILES+="LLC_Templates.ttcn L3_Templates.ttcn L3_Common.ttcn "
|
FILES+="LLC_Templates.ttcn L3_Templates.ttcn L3_Common.ttcn "
|
||||||
FILES+="PCUIF_Types.ttcn PCUIF_CodecPort.ttcn "
|
FILES+="PCUIF_Types.ttcn PCUIF_CodecPort.ttcn "
|
||||||
|
|
|
@ -84,7 +84,7 @@ gen_links $DIR $FILES
|
||||||
|
|
||||||
DIR=../library
|
DIR=../library
|
||||||
FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn Osmocom_Types.ttcn RLCMAC_Templates.ttcn RLCMAC_Types.ttcn RLCMAC_CSN1_Templates.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc "
|
FILES="Misc_Helpers.ttcn General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn Osmocom_Types.ttcn RLCMAC_Templates.ttcn RLCMAC_Types.ttcn RLCMAC_CSN1_Templates.ttcn RLCMAC_CSN1_Types.ttcn RLCMAC_EncDec.cc "
|
||||||
FILES+="NS_Emulation.ttcn PCUIF_Types.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn NS_CodecPort_CtrlFunctDef.cc "
|
FILES+="NS_Provider_IPL4.ttcn NS_Emulation.ttcn PCUIF_Types.ttcn NS_CodecPort.ttcn NS_CodecPort_CtrlFunct.ttcn NS_CodecPort_CtrlFunctDef.cc "
|
||||||
FILES+="BSSGP_Emulation.ttcnpp Osmocom_Gb_Types.ttcn "
|
FILES+="BSSGP_Emulation.ttcnpp Osmocom_Gb_Types.ttcn "
|
||||||
FILES+="Osmocom_CTRL_Types.ttcn Osmocom_CTRL_Functions.ttcn Osmocom_CTRL_Adapter.ttcn "
|
FILES+="Osmocom_CTRL_Types.ttcn Osmocom_CTRL_Functions.ttcn Osmocom_CTRL_Adapter.ttcn "
|
||||||
FILES+="Osmocom_VTY_Functions.ttcn "
|
FILES+="Osmocom_VTY_Functions.ttcn "
|
||||||
|
|
Loading…
Reference in New Issue