NS_Emulation: Support multiple NS-VC within one NSE (NS-VCG)

This is something we need to simulate more complex scenarios,
particularly in the context of frame relay.

Change-Id: If1220852785853f8a5d8de183d5053ddd6ccb958
changes/87/21087/4
Harald Welte 2 years ago committed by laforge
parent f8fe2d2ef3
commit 90f1974fb0
  1. 20
      fr-net/FRNET_Tests.ttcn
  2. 20
      fr/FR_Tests.ttcn
  3. 48
      gbproxy/GBProxy_Tests.cfg
  4. 104
      gbproxy/GBProxy_Tests.ttcn
  5. 2
      library/BSSGP_Emulation.ttcnpp
  6. 396
      library/NS_Emulation.ttcnpp
  7. 4
      library/NS_Provider_FR.ttcn
  8. 2
      library/NS_Provider_IPL4.ttcn
  9. 21
      library/RAW_NS.ttcn
  10. 26
      pcu/PCU_Tests.cfg
  11. 8
      pcu/PCU_Tests.ttcn
  12. 2
      pcu/PCU_Tests_NS.ttcn
  13. 24
      pcu/PCU_Tests_SNS.cfg
  14. 102
      pcu/PCU_Tests_SNS.ttcn
  15. 24
      pcu/PCU_Tests_SNSv6.cfg
  16. 26
      pcu/SGSN_Components.ttcn
  17. 42
      sgsn/SGSN_Tests.cfg
  18. 78
      sgsn/SGSN_Tests.ttcn

@ -10,16 +10,20 @@ import from BSSGP_Emulation all;
modulepar {
NSConfigurations mp_nsconfig := {
{
provider := {
fr := {
netdev := "hdlc2",
dlci := 123
}
},
nsvci := 123,
nsei := 123,
role_sgsn := true,
handle_sns := false
handle_sns := false,
nsvc := {
{
provider := {
fr := {
netdev := "hdlc2",
dlci := 123
}
},
nsvci := 123
}
}
}
};
}

@ -10,16 +10,20 @@ import from BSSGP_Emulation all;
modulepar {
NSConfigurations mp_nsconfig := {
{
provider := {
fr := {
netdev := "hdlc1",
dlci := 123
}
},
nsvci := 123,
nsei := 123,
role_sgsn := false,
handle_sns := false
handle_sns := false,
nsvc := {
{
provider := {
fr := {
netdev := "hdlc1",
dlci := 123
}
},
nsvci := 123
}
}
}
};
}

@ -20,31 +20,43 @@ GBProxy_Tests.mp_nsconfig_sgsn := {
GBProxy_Tests.mp_nsconfig_pcu := {
{
provider := {
ip := {
local_ip := "127.0.0.1",
remote_ip := "127.0.0.1"
handle_sns := false,
nsvc := {
{
provider := {
ip := {
local_ip := "127.0.0.1",
remote_ip := "127.0.0.1"
}
}
}
},
handle_sns := false
}
},
{
provider := {
ip := {
local_ip := "127.0.0.1",
remote_ip := "127.0.0.1"
handle_sns := false,
nsvc := {
{
provider := {
ip := {
local_ip := "127.0.0.1",
remote_ip := "127.0.0.1"
}
},
}
},
handle_sns := false
}
},
{
provider := {
ip := {
local_ip := "127.0.0.1",
remote_ip := "127.0.0.1"
handle_sns := false,
nsvc := {
{
provider := {
ip := {
local_ip := "127.0.0.1",
remote_ip := "127.0.0.1"
}
}
}
},
handle_sns := false
}
}
}

@ -41,66 +41,82 @@ modulepar {
/* IP/port on which we run our internal GSUP/HLR emulation */
NSConfigurations_SGSN mp_nsconfig_sgsn := {
{
provider := {
ip := {
address_family := AF_INET,
local_udp_port := 7777,
local_ip := "127.0.0.1",
remote_udp_port := 23000,
remote_ip := "127.0.0.1"
}
},
nsvci := 101,
nsei := 101,
role_sgsn := true,
handle_sns := false
handle_sns := false,
nsvc := {
{
provider := {
ip := {
address_family := AF_INET,
local_udp_port := 7777,
local_ip := "127.0.0.1",
remote_udp_port := 23000,
remote_ip := "127.0.0.1"
}
},
nsvci := 101
}
}
}
};
NSConfigurations_PCU mp_nsconfig_pcu := {
{
provider := {
ip := {
address_family := AF_INET,
local_udp_port := 21010,
local_ip := "127.0.0.1",
remote_udp_port := 23000,
remote_ip := "127.0.0.1"
}
},
nsvci := 97,
nsei := 96,
role_sgsn := false,
handle_sns := false
handle_sns := false,
nsvc := {
{
provider := {
ip := {
address_family := AF_INET,
local_udp_port := 21010,
local_ip := "127.0.0.1",
remote_udp_port := 23000,
remote_ip := "127.0.0.1"
}
},
nsvci := 97
}
}
},
{
provider := {
ip := {
address_family := AF_INET,
local_udp_port := 21011,
local_ip := "127.0.0.1",
remote_udp_port := 23000,
remote_ip := "127.0.0.1"
}
},
nsvci := 98,
nsei := 97,
role_sgsn := false,
handle_sns := false
handle_sns := false,
nsvc := {
{
provider := {
ip := {
address_family := AF_INET,
local_udp_port := 21011,
local_ip := "127.0.0.1",
remote_udp_port := 23000,
remote_ip := "127.0.0.1"
}
},
nsvci := 98
}
}
},
{
provider := {
ip := {
address_family := AF_INET,
local_udp_port := 21012,
local_ip := "127.0.0.1",
remote_udp_port := 23000,
remote_ip := "127.0.0.1"
}
},
nsvci := 99,
nsei := 98,
role_sgsn := false,
handle_sns := false
handle_sns := false,
nsvc := {
{
provider := {
ip := {
address_family := AF_INET,
local_udp_port := 21012,
local_ip := "127.0.0.1",
remote_udp_port := 23000,
remote_ip := "127.0.0.1"
}
},
nsvci := 99
}
}
}
};
};

@ -359,7 +359,7 @@ altstep as_sig_unblocked() runs on BSSGP_CT {
/* We are in BVC_S_WAIT_NS_ALIVE_UNBLOCKED (only happens in BSS role) */
altstep as_sig_wait_ns_alive_unblocked() runs on BSSGP_CT {
var NsStatusIndication nsi;
[] BSCP.receive(NsStatusIndication:{?,?, complement (NSE_S_ALIVE_UNBLOCKED), NSE_S_ALIVE_UNBLOCKED}) -> value nsi {
[] BSCP.receive(NsStatusIndication:{?,?, complement (NSVC_S_ALIVE_UNBLOCKED), NSVC_S_ALIVE_UNBLOCKED}) -> value nsi {
/* if we just became NS-unblocked, send a BCC-RESET */
if (g_cfg.sgsn_role == false) {
BSCP.send(f_BnsUdReq(ts_BVC_RESET(BSSGP_CAUSE_OM_INTERVENTION, 0, omit), 0));

@ -10,6 +10,7 @@
*/
module NS_Emulation {
import from Misc_Helpers all;
import from NS_Types all;
import from BSSGP_Types all;
import from Osmocom_Types all;
@ -27,8 +28,18 @@ module NS_Emulation {
PDU_BSSGP bssgp optional
}
template NsUnitdataRequest t_NsUdReq(template Nsei nsei, template BssgpBvci bvci, template octetstring sdu,
template PDU_BSSGP bssgp) := {
template NsUnitdataRequest tr_NsUdReq(template Nsei nsei, template BssgpBvci bvci, template octetstring sdu,
template PDU_BSSGP bssgp) := {
bvci := bvci,
nsei := nsei,
sdu := sdu,
bssgp := bssgp
}
template (value) NsUnitdataRequest ts_NsUdReq(template (value) Nsei nsei,
template (value) BssgpBvci bvci,
template (omit) octetstring sdu,
template (omit) PDU_BSSGP bssgp) := {
bvci := bvci,
nsei := nsei,
sdu := sdu,
@ -42,7 +53,16 @@ module NS_Emulation {
PDU_BSSGP bssgp optional
}
template NsUnitdataIndication t_NsUdInd(Nsei nsei, BssgpBvci bvci, octetstring sdu) := {
template (present) NsUnitdataIndication tr_NsUdInd(template (present) Nsei nsei,
template (present) BssgpBvci bvci,
template octetstring sdu) := {
bvci := bvci,
nsei := nsei,
sdu := sdu,
bssgp := ?
}
template (value) NsUnitdataIndication ts_NsUdInd(Nsei nsei, BssgpBvci bvci, octetstring sdu) := {
bvci := bvci,
nsei := nsei,
sdu := sdu,
@ -52,22 +72,33 @@ module NS_Emulation {
type record NsStatusIndication {
Nsei nsei,
Nsvci nsvci,
NseState old_state,
NseState new_state
NsvcState old_state,
NsvcState new_state
}
template (present) NsStatusIndication tr_NsStsInd(template (present) Nsei nsei := ?,
template (present) Nsvci nsvci := ?,
template (present) NsvcState old_state := ?,
template (present) NsvcState state := ?) := {
nsei := nsei,
nsvci := nsvci,
old_state := old_state,
new_state := state
}
template NsStatusIndication t_NsStsInd(Nsei nsei, Nsvci nsvci, NseState old_state, NseState state) := {
template (value) NsStatusIndication ts_NsStsInd(Nsei nsei, Nsvci nsvci, NsvcState old_state, NsvcState state) := {
nsei := nsei,
nsvci := nsvci,
old_state := old_state,
new_state := state
}
type enumerated NseState {
NSE_S_DEAD_BLOCKED,
NSE_S_WAIT_RESET,
NSE_S_ALIVE_BLOCKED,
NSE_S_ALIVE_UNBLOCKED
type enumerated NsvcState {
NSVC_S_DEAD_BLOCKED,
NSVC_S_WAIT_RESET,
NSVC_S_ALIVE_BLOCKED,
NSVC_S_ALIVE_UNBLOCKED
}
/* port from our (internal) point of view */
@ -85,31 +116,6 @@ module NS_Emulation {
out NsUnitdataRequest;
} with { extension "internal" };
function NSStart(NSConfiguration init_config, charstring id := testcasename()) runs on NS_CT {
config := init_config;
f_init(id & "-NSemu");
f_ScanEvents();
}
private function f_init(charstring id) runs on NS_CT {
var Result res;
if (ischosen(config.provider.ip)) {
/* Connect the UDP socket */
vc_NSP_IP := NS_Provider_IPL4_CT.create(id & "-provIP");
connect(self:NSCP, vc_NSP_IP:NSE);
vc_NSP_IP.start(NS_Provider_IPL4.main(config, id));
#ifdef NS_EMULATION_FR
} else if (ischosen(config.provider.fr)) {
vc_NSP_FR := NS_Provider_FR_CT.create(id & "-provFR");
connect(self:NSCP, vc_NSP_FR:NSE);
vc_NSP_FR.start(NS_Provider_FR.main(config, id));
#endif
}
f_change_state(NSE_S_DEAD_BLOCKED);
}
type component NS_Provider_CT {
/* upper port, facing to NS_Emulation:NSCP */
port NS_PROVIDER_PT NSE;
@ -129,7 +135,154 @@ module NS_Emulation {
inout PDU_NS, NS_Provider_Evt;
} with { extension "internal" };
type record NSVCConfigurationIP {
AddressFamily address_family,
PortNumber local_udp_port,
charstring local_ip,
PortNumber remote_udp_port,
charstring remote_ip
};
type record NSVCConfigurationFR {
charstring netdev, /* HDLC net-device for AF_PACKET socket */
integer dlci
};
type union NSVCConfigurationP {
NSVCConfigurationIP ip,
NSVCConfigurationFR fr
};
type record NSVCConfiguration {
NSVCConfigurationP provider,
Nsvci nsvci
};
type record of NSVCConfiguration NSVCConfigurations;
type record NSConfiguration {
Nsvci nsei,
boolean role_sgsn,
boolean handle_sns,
NSVCConfigurations nsvc
}
/***********************************************************************
* per NS-VCG component. Exists once per [peer of] NSE
***********************************************************************/
type component NS_CT {
/* NS-User SAP towards the user */
port NS_SP_PT NS_SP;
/* port towards the per-NSVC components */
port NS_PT NSVC;
/* all of the NS configuration a user passes to us */
var NSConfiguration g_config;
var charstring g_id;
/* references to the per-NSVC components */
var NsvcTable g_nsvcs := {};
};
type record NsvcTableEntry {
Nsvci nsvci,
NSVC_CT vc_conn,
NsvcState state
};
type record of NsvcTableEntry NsvcTable;
/* add one NSVC (component and table entry */
function f_nsvc_add(NSVCConfiguration nsvc_cfg) runs on NS_CT {
var charstring nsvc_id := g_id & "-NSVCI" & int2str(nsvc_cfg.nsvci);
var NsvcTableEntry te;
te.nsvci := nsvc_cfg.nsvci;
te.vc_conn := NSVC_CT.create(nsvc_id);
te.state := NSVC_S_DEAD_BLOCKED;
connect(self:NSVC, te.vc_conn:NS_SP);
te.vc_conn.start(NSVCStart(nsvc_cfg, g_config, nsvc_id));
g_nsvcs := g_nsvcs & { te };
}
function f_nsvc_find_idx(Nsvci nsvci) runs on NS_CT return integer {
var integer i;
for (i := 0; i < lengthof(g_nsvcs); i := i+1) {
if (g_nsvcs[i].nsvci == nsvci) {
return i;
}
}
return -1;
}
function f_nsvc_find(Nsvci nsvci) runs on NS_CT return NSVC_CT {
var integer i := f_nsvc_find_idx(nsvci);
if (i < 0) {
return null;
} else {
return g_nsvcs[i].vc_conn;
}
}
function f_nsvc_update_state(Nsvci nsvci, NsvcState state) runs on NS_CT {
var integer i := f_nsvc_find_idx(nsvci);
if (i < 0) {
return;
}
g_nsvcs[i].state := state;
}
function NSStart(NSConfiguration init_config, charstring id := testcasename()) runs on NS_CT {
g_config := init_config;
g_id := id;
/* iterate over list of NS-VCs and start per-NSVC components */
for (var integer i := 0; i < lengthof(g_config.nsvc); i := i+1) {
var NSVCConfiguration nsvc_cfg := g_config.nsvc[i];
f_nsvc_add(nsvc_cfg);
}
while (true) {
alt {
[] as_ns_common() {}
}
}
}
private altstep as_ns_common() runs on NS_CT {
var NsStatusIndication rx_nssi;
var NsUnitdataIndication rx_nsudi;
var NsUnitdataRequest rx_nsudr;
/* pass from NS-VCs up to user */
[] NSVC.receive(tr_NsStsInd(g_config.nsei)) -> value rx_nssi {
f_nsvc_update_state(rx_nssi.nsvci, rx_nssi.new_state);
NS_SP.send(rx_nssi);
}
[] NSVC.receive(tr_NsStsInd) -> value rx_nssi {
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
log2str("Received NsStatusInd for invalid NSEI: ", rx_nssi));
}
[] NSVC.receive(tr_NsUdInd(g_config.nsei, ?, ?)) -> value rx_nsudi {
NS_SP.send(rx_nsudi);
}
[] NSVC.receive(tr_NsUdInd(?, ?, ?)) -> value rx_nsudi {
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
log2str("Received UnitDataInd for invalid NSEI: ", rx_nsudi));
}
/* from user down to NS-VC */
[] NS_SP.receive(tr_NsUdReq(g_config.nsei, ?, ?, *)) -> value rx_nsudr {
/* FIXME: load distribution function */
NSVC.send(rx_nsudr) to g_nsvcs[0].vc_conn;
}
[] NS_SP.receive(tr_NsUdReq(?, ?, ?, *)) -> value rx_nsudr {
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail,
log2str("Received NsUnitdataReq for invalid NSEI: ", rx_nsudr));
}
}
/***********************************************************************
per-NSVC component. Exists once for each NS-VC in the NS-VCG
***********************************************************************/
type component NSVC_CT {
/* UDP port towards the bottom (IUT) */
port NS_PROVIDER_PT NSCP;
var NS_Provider_IPL4_CT vc_NSP_IP;
@ -137,12 +290,15 @@ module NS_Emulation {
var NS_Provider_FR_CT vc_NSP_FR;
#endif
/* NS-User SAP towards the user */
/* port towards the NS_CT */
port NS_SP_PT NS_SP;
var NSConfiguration config;
/* configuration passed by the user */
var NSVCConfiguration g_nsvc_config;
/* we cannot access the NS_CT.config and hence need to copy those */
var NSConfiguration g_config;
var NseState g_state := NSE_S_DEAD_BLOCKED;
var NsvcState vc_state := NSVC_S_DEAD_BLOCKED;
timer Tns_alive := 3.0;
timer Tns_test := 10.0;
@ -150,65 +306,68 @@ module NS_Emulation {
timer Tns_reset := 10.0;
}
type record NSConfigurationIP {
AddressFamily address_family,
PortNumber local_udp_port,
charstring local_ip,
PortNumber remote_udp_port,
charstring remote_ip
};
type record NSConfigurationFR {
charstring netdev, /* HDLC net-device for AF_PACKET socket */
integer dlci
};
type union NSConfigurationP {
NSConfigurationIP ip,
NSConfigurationFR fr
};
type record NSConfiguration {
NSConfigurationP provider,
Nsvci nsvci,
Nsvci nsei,
boolean role_sgsn,
boolean handle_sns
function NSVCStart(NSVCConfiguration init_config, NSConfiguration init_g_config, charstring id := testcasename()) runs on NSVC_CT {
g_nsvc_config := init_config;
g_config := init_g_config;
f_init(id & "-NSVCemu" & int2str(g_nsvc_config.nsvci));
f_ScanEvents();
}
private function f_init(charstring id) runs on NSVC_CT {
var Result res;
if (ischosen(g_nsvc_config.provider.ip)) {
/* Connect the UDP socket */
vc_NSP_IP := NS_Provider_IPL4_CT.create(id & "-provIP");
connect(self:NSCP, vc_NSP_IP:NSE);
vc_NSP_IP.start(NS_Provider_IPL4.main(g_nsvc_config, g_config, id));
#ifdef NS_EMULATION_FR
} else if (ischosen(g_nsvc_config.provider.fr)) {
vc_NSP_FR := NS_Provider_FR_CT.create(id & "-provFR");
connect(self:NSCP, vc_NSP_FR:NSE);
vc_NSP_FR.start(NS_Provider_FR.main(g_nsvc_config, g_config, id));
#endif
}
f_change_state(NSVC_S_DEAD_BLOCKED);
}
private function f_change_state(NseState new_state) runs on NS_CT {
var NseState old_state := g_state;
g_state := new_state;
log("NS State Transition: ", old_state, " -> ", new_state);
NS_SP.send(t_NsStsInd(config.nsei, config.nsvci, old_state, new_state));
private function f_change_state(NsvcState new_state) runs on NSVC_CT {
var NsvcState old_state := vc_state;
vc_state := new_state;
log("NSVC ", g_nsvc_config.nsvci, " State Transition: ", old_state, " -> ", new_state);
NS_SP.send(ts_NsStsInd(g_config.nsei, g_nsvc_config.nsvci, old_state, new_state));
}
private function f_sendReset() runs on NS_CT {
NSCP.send(ts_NS_RESET(NS_CAUSE_OM_INTERVENTION, config.nsvci, config.nsei));
private function f_sendReset() runs on NSVC_CT {
NSCP.send(ts_NS_RESET(NS_CAUSE_OM_INTERVENTION, g_nsvc_config.nsvci, g_config.nsei));
Tns_reset.start;
g_state := NSE_S_WAIT_RESET;
vc_state := NSVC_S_WAIT_RESET;
}
private function f_sendAlive() runs on NS_CT {
private function f_sendAlive() runs on NSVC_CT {
NSCP.send(t_NS_ALIVE);
Tns_alive.start;
}
private function f_sendUnblock() runs on NS_CT {
private function f_sendUnblock() runs on NSVC_CT {
NSCP.send(t_NS_UNBLOCK);
Tns_block.start;
}
private function f_sendBlock(NsCause cause) runs on NS_CT {
NSCP.send(ts_NS_BLOCK(cause, config.nsvci));
private function f_sendBlock(NsCause cause) runs on NSVC_CT {
NSCP.send(ts_NS_BLOCK(cause, g_nsvc_config.nsvci));
Tns_block.start;
}
private altstep as_allstate() runs on NS_CT {
private altstep as_allstate() runs on NSVC_CT {
var PDU_NS rf;
var ASP_Event evt;
/* transition to DEAD if t_alive times out */
[] Tns_alive.timeout {
log("Tns-alive expired: changing to DEAD_BLOCKED + starting Tns-test");
f_change_state(NSE_S_DEAD_BLOCKED);
f_change_state(NSVC_S_DEAD_BLOCKED);
Tns_test.start;
}
@ -235,33 +394,33 @@ module NS_Emulation {
/* FIXME */
}
[not config.handle_sns] as_handle_reset();
[not g_config.handle_sns] as_handle_reset();
[config.role_sgsn and config.handle_sns and ischosen(config.provider.ip)] as_sns_sgsn();
[g_config.role_sgsn and g_config.handle_sns and ischosen(g_nsvc_config.provider.ip)] as_sns_sgsn();
/* default case of handling unknown PDUs */
[] NSCP.receive(PDU_NS: ?) -> value rf {
log("Rx Unexpected NS PDU ", rf," in state ", g_state);
log("Rx Unexpected NS PDU ", rf," in state ", vc_state);
NSCP.send(ts_NS_STATUS(NS_CAUSE_PDU_NOT_COMPATIBLE_WITH_PROTOCOL_STATE, rf));
}
}
private altstep as_handle_reset() runs on NS_CT {
private altstep as_handle_reset() runs on NSVC_CT {
var PDU_NS rf;
[config.role_sgsn] NSCP.receive(NS_Provider_Evt:{link_status:=NS_PROV_LINK_STATUS_UP}) {
[g_config.role_sgsn] NSCP.receive(NS_Provider_Evt:{link_status:=NS_PROV_LINK_STATUS_UP}) {
log("Provider Link came up: waiting for NS-RESET");
}
[not config.role_sgsn] NSCP.receive(NS_Provider_Evt:{link_status:=NS_PROV_LINK_STATUS_UP}) {
[not g_config.role_sgsn] NSCP.receive(NS_Provider_Evt:{link_status:=NS_PROV_LINK_STATUS_UP}) {
log("Provider Link came up: sending NS-RESET");
f_sendReset();
}
/* Respond to RESET with correct NSEI/NSVCI */
[] NSCP.receive(tr_NS_RESET(?, config.nsvci, config.nsei)) -> value rf {
f_change_state(NSE_S_ALIVE_BLOCKED);
NSCP.send(ts_NS_RESET_ACK(config.nsvci, config.nsei));
[] NSCP.receive(tr_NS_RESET(?, g_nsvc_config.nsvci, g_config.nsei)) -> value rf {
f_change_state(NSVC_S_ALIVE_BLOCKED);
NSCP.send(ts_NS_RESET_ACK(g_nsvc_config.nsvci, g_config.nsei));
log("Rx NS-RESET: Sending NS-ALIVE");
f_sendAlive();
Tns_test.start;
@ -276,46 +435,47 @@ module NS_Emulation {
/* 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 */
private altstep as_sns_sgsn() runs on NS_CT {
private altstep as_sns_sgsn() runs on NSVC_CT {
var PDU_NS rf;
[config.role_sgsn] NSCP.receive(NS_Provider_Evt:{link_status:=NS_PROV_LINK_STATUS_UP}) {
[g_config.role_sgsn] NSCP.receive(NS_Provider_Evt:{link_status:=NS_PROV_LINK_STATUS_UP}) {
log("Provider Link came up: sending NS-ALIVE");
f_sendAlive();
}
[not config.role_sgsn] NSCP.receive(NS_Provider_Evt:{link_status:=NS_PROV_LINK_STATUS_UP}) {
[not g_config.role_sgsn] NSCP.receive(NS_Provider_Evt:{link_status:=NS_PROV_LINK_STATUS_UP}) {
log("Provider Link came up: sending NS-ALIVE");
f_sendAlive();
}
[] NSCP.receive(tr_SNS_SIZE(config.nsei)) -> value rf {
[] NSCP.receive(tr_SNS_SIZE(g_config.nsei)) -> value rf {
/* blindly acknowledge whatever the PCU sends */
NSCP.send(ts_SNS_SIZE_ACK(config.nsei, omit));
NSCP.send(ts_SNS_SIZE_ACK(g_config.nsei, omit));
}
[] NSCP.receive(tr_SNS_SIZE(?)) {
setverdict(fail, "SNS-SIZE from unexpected NSEI");
self.stop;
}
[] NSCP.receive(tr_SNS_CONFIG(config.nsei, true,
{tr_SNS_IPv4(config.provider.ip.remote_ip,
config.provider.ip.remote_udp_port)})) -> value rf {
[] NSCP.receive(tr_SNS_CONFIG(g_config.nsei, true,
{tr_SNS_IPv4(g_nsvc_config.provider.ip.remote_ip,
g_nsvc_config.provider.ip.remote_udp_port)})) -> value rf {
/* blindly acknowledge whatever the PCU sends */
NSCP.send(ts_SNS_CONFIG_ACK(config.nsei, omit));
NSCP.send(ts_SNS_CONFIG_ACK(g_config.nsei, omit));
/* send a SNS-CONFIG in response and expect a SNS-CONFIG-ACK */
var IP4_Elements v4 := { valueof(ts_SNS_IPv4(config.provider.ip.local_ip, config.provider.ip.local_udp_port)) };
NSCP.send(ts_SNS_CONFIG(config.nsei, true, v4));
var IP4_Elements v4 := { valueof(ts_SNS_IPv4(g_nsvc_config.provider.ip.local_ip,
g_nsvc_config.provider.ip.local_udp_port)) };
NSCP.send(ts_SNS_CONFIG(g_config.nsei, true, v4));
alt {
[] NSCP.receive(tr_SNS_CONFIG_ACK(config.nsei, omit)) {
[] NSCP.receive(tr_SNS_CONFIG_ACK(g_config.nsei, omit)) {
/* success */
}
[] NSCP.receive(tr_SNS_CONFIG_ACK(config.nsei, ?)) {
[] NSCP.receive(tr_SNS_CONFIG_ACK(g_config.nsei, ?)) {
setverdict(fail, "Unexpected SNS-CONFIG-NACK");
self.stop;
}
}
}
[] NSCP.receive(tr_SNS_CONFIG(config.nsei, false, ?)) { /* ignore */}
[] NSCP.receive(tr_SNS_CONFIG(config.nsei, true, ?)) {
[] NSCP.receive(tr_SNS_CONFIG(g_config.nsei, false, ?)) { /* ignore */}
[] NSCP.receive(tr_SNS_CONFIG(g_config.nsei, true, ?)) {
setverdict(fail, "Unexpected SNS-CONFIG content");
self.stop;
}
@ -325,21 +485,21 @@ module NS_Emulation {
}
}
private altstep as_alive_blocked() runs on NS_CT {
private altstep as_alive_blocked() runs on NSVC_CT {
var PDU_NS rf;
/* bogus block, just respond with ACK */
[] NSCP.receive(tr_NS_BLOCK(?, config.nsvci)) -> value rf {
NSCP.send(ts_NS_BLOCK_ACK(config.nsvci));
[] NSCP.receive(tr_NS_BLOCK(?, g_nsvc_config.nsvci)) -> value rf {
NSCP.send(ts_NS_BLOCK_ACK(g_nsvc_config.nsvci));
}
/* Respond to UNBLOCK with UNBLOCK-ACK + change state */
[] NSCP.receive(t_NS_UNBLOCK) -> value rf {
NSCP.send(t_NS_UNBLOCK_ACK);
Tns_block.stop;
f_change_state(NSE_S_ALIVE_UNBLOCKED);
f_change_state(NSVC_S_ALIVE_UNBLOCKED);
}
[] NSCP.receive(t_NS_UNBLOCK_ACK) -> value rf {
Tns_block.stop;
f_change_state(NSE_S_ALIVE_UNBLOCKED);
f_change_state(NSVC_S_ALIVE_UNBLOCKED);
}
[] Tns_block.timeout {
/* repeat unblock transmission */
@ -347,7 +507,7 @@ module NS_Emulation {
}
}
private altstep as_alive_unblocked() runs on NS_CT {
private altstep as_alive_unblocked() runs on NSVC_CT {
var NsUnitdataRequest ud_req;
var PDU_NS rf;
/* bogus unblock, just respond with ACK */
@ -355,33 +515,33 @@ module NS_Emulation {
NSCP.send(t_NS_UNBLOCK_ACK);
}
/* Respond to BLOCK with BLOCK-ACK + change state */
[] NSCP.receive(tr_NS_BLOCK(?, config.nsvci)) -> value rf {
NSCP.send(ts_NS_BLOCK_ACK(config.nsvci));
[] NSCP.receive(tr_NS_BLOCK(?, g_nsvc_config.nsvci)) -> value rf {
NSCP.send(ts_NS_BLOCK_ACK(g_nsvc_config.nsvci));
Tns_block.stop;
f_change_state(NSE_S_ALIVE_BLOCKED);
f_change_state(NSVC_S_ALIVE_BLOCKED);
}
[] NSCP.receive(tr_NS_BLOCK_ACK(config.nsvci)) -> value rf {
[] NSCP.receive(tr_NS_BLOCK_ACK(g_nsvc_config.nsvci)) -> value rf {
Tns_block.stop;
}
/* NS-UNITDATA PDU from network to NS-UNITDATA.ind to user */
[] NSCP.receive(tr_NS_UNITDATA(?, ?, ?)) -> value rf {
NS_SP.send(t_NsUdInd(config.nsei,
NS_SP.send(ts_NsUdInd(g_config.nsei,
oct2int(rf.pDU_NS_Unitdata.bVCI),
rf.pDU_NS_Unitdata.nS_SDU));
}
/* 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(tr_NsUdReq(g_config.nsei, ?, ?, omit)) -> value ud_req {
/* using raw octetstring PDU */
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(tr_NsUdReq(g_config.nsei, ?, omit, ?)) -> value ud_req {
/* using decoded BSSGP PDU that we need to encode first */
var octetstring enc := enc_PDU_BSSGP(ud_req.bssgp);
NSCP.send(ts_NS_UNITDATA(t_SduCtrlB, ud_req.bvci, enc));
}
}
private altstep as_wait_reset() runs on NS_CT {
private altstep as_wait_reset() runs on NSVC_CT {
var PDU_NS rf;
[] Tns_reset.timeout {
/* If the sending entity of an NS-RESET PDU receives no NS-RESET-ACK PDU before timer
@ -389,21 +549,21 @@ module NS_Emulation {
* entire reset procedure shall be repeated */
f_sendReset();
}
[] NSCP.receive(tr_NS_RESET_ACK(config.nsvci, config.nsei)) -> value rf {
[] NSCP.receive(tr_NS_RESET_ACK(g_nsvc_config.nsvci, g_config.nsei)) -> value rf {
Tns_reset.stop;
f_change_state(NSE_S_ALIVE_BLOCKED);
f_change_state(NSVC_S_ALIVE_BLOCKED);
f_sendAlive();
f_sendUnblock();
}
}
private function f_ScanEvents() runs on NS_CT {
private function f_ScanEvents() runs on NSVC_CT {
var PDU_NS rf;
while (true) {
alt {
[g_state == NSE_S_WAIT_RESET] as_wait_reset();
[g_state == NSE_S_ALIVE_BLOCKED] as_alive_blocked();
[g_state == NSE_S_ALIVE_UNBLOCKED] as_alive_unblocked();
[vc_state == NSVC_S_WAIT_RESET] as_wait_reset();
[vc_state == NSVC_S_ALIVE_BLOCKED] as_alive_blocked();
[vc_state == NSVC_S_ALIVE_UNBLOCKED] as_alive_unblocked();
[] as_allstate();
}
}

@ -27,11 +27,11 @@ type component NS_Provider_FR_CT extends NS_Provider_CT, FR_Client_CT {
var boolean pvc_active := false;
};
function main(NSConfiguration config, charstring id) runs on NS_Provider_FR_CT system af_packet {
function main(NSVCConfiguration config, NSConfiguration nsconfig, charstring id) runs on NS_Provider_FR_CT system af_packet {
/* start Frame Relay Emulation */
vc_FREMU := FR_Emulation_CT.create(id & "-FRemu");
var Q933em_Config q933_cfg := valueof(ts_Q933em_Config(ats_is_user := not config.role_sgsn, bidirectional := false));
var Q933em_Config q933_cfg := valueof(ts_Q933em_Config(ats_is_user := not nsconfig.role_sgsn, bidirectional := false));
q933_cfg.T391 := 1.0;
map(vc_FREMU:FR, system:AF_PACKET) param (config.provider.fr.netdev);
vc_FREMU.start(FrameRelay_Emulation.main(q933_cfg));

@ -23,7 +23,7 @@ type component NS_Provider_IPL4_CT extends NS_Provider_CT {
var integer g_conn_id := -1;
};
function main(NSConfiguration config, charstring id) runs on NS_Provider_IPL4_CT {
function main(NSVCConfiguration config, NSConfiguration nsconfig, charstring id) runs on NS_Provider_IPL4_CT {
/* connect socket */
map(self:IPL4, system:IPL4);

@ -49,16 +49,17 @@ function f_init_ns_codec(NSConfiguration ns_config, integer idx := 0, float guar
/* copy most parts from mp_nsconfig */
g_nsconfig[idx] := ns_config;
/* adjust those parts different for each NS-VC */
g_nsconfig[idx].nsvci := ns_config.nsvci + idx;
g_nsconfig[idx].provider.ip.local_udp_port := ns_config.provider.ip.local_udp_port + idx + tc_offset;
g_nsconfig[idx].nsvc[0].nsvci := ns_config.nsvc[0].nsvci + idx;
g_nsconfig[idx].nsvc[0].provider.ip.local_udp_port := ns_config.nsvc[0].provider.ip.local_udp_port + idx + tc_offset;
}
map(self:NSCP[idx], system:NSCP);
/* Connect the UDP socket */
var NSConfiguration nscfg := g_nsconfig[idx];
var NSVCConfiguration nsvc_cfg := nscfg.nsvc[0];
log("connecting NSCP[", idx, "] to ", nscfg);
res := f_IPL4_connect(NSCP[idx], nscfg.provider.ip.remote_ip, nscfg.provider.ip.remote_udp_port,
nscfg.provider.ip.local_ip, nscfg.provider.ip.local_udp_port, 0, { udp := {}});
res := f_IPL4_connect(NSCP[idx], nsvc_cfg.provider.ip.remote_ip, nsvc_cfg.provider.ip.remote_udp_port,
nsvc_cfg.provider.ip.local_ip, nsvc_cfg.provider.ip.local_udp_port, 0, { udp := {}});
if (not ispresent(res.connId)) {
setverdict(fail, "Could not connect NS UDP socket, check your configuration ", g_nsconfig[idx]);
mtc.stop;
@ -107,11 +108,11 @@ function f_outgoing_ns_alive_no_ack(integer idx := 0, float tout := 10.0) runs o
function f_outgoing_ns_reset(integer idx := 0, float tout := 10.0) runs on RAW_NS_CT {
timer T := tout;
var template PDU_NS reset := ts_NS_RESET(NS_CAUSE_EQUIPMENT_FAILURE, g_nsconfig[idx].nsvci, g_nsconfig[idx].nsei)
var template PDU_NS reset := ts_NS_RESET(NS_CAUSE_EQUIPMENT_FAILURE, g_nsconfig[idx].nsvc[0].nsvci, g_nsconfig[idx].nsei)
NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], reset));
T.start;
alt {
[] NSCP[idx].receive(t_NS_RecvFrom(ts_NS_RESET_ACK(g_nsconfig[idx].nsvci, g_nsconfig[idx].nsei))) {
[] NSCP[idx].receive(t_NS_RecvFrom(ts_NS_RESET_ACK(g_nsconfig[idx].nsvc[0].nsvci, g_nsconfig[idx].nsei))) {
setverdict(pass);
}
[] NSCP[idx].receive { repeat; }
@ -123,9 +124,9 @@ function f_outgoing_ns_reset(integer idx := 0, float tout := 10.0) runs on RAW_N
/* perform outbound NS-BLOCK procedure */
function f_outgoing_ns_block(NsCause cause, integer idx := 0) runs on RAW_NS_CT {
NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_NS_BLOCK(cause, g_nsconfig[idx].nsvci)));
NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_NS_BLOCK(cause, g_nsconfig[idx].nsvc[0].nsvci)));
alt {
[] NSCP[idx].receive(t_NS_RecvFrom(tr_NS_BLOCK_ACK(g_nsconfig[idx].nsvci)));
[] NSCP[idx].receive(t_NS_RecvFrom(tr_NS_BLOCK_ACK(g_nsconfig[idx].nsvc[0].nsvci)));
[] NSCP[idx].receive { repeat; }
}
}
@ -211,9 +212,9 @@ altstep as_rx_bvc_fc_tx_ack(BssgpBvci bvci, boolean oneshot := false, integer id
/* Receive a NS-RESET and ACK it */
public altstep as_rx_ns_reset_ack(boolean oneshot := false, integer idx := 0) runs on RAW_NS_CT {
var NS_RecvFrom ns_rf;
[] NSCP[idx].receive(t_NS_RecvFrom(tr_NS_RESET(NS_CAUSE_OM_INTERVENTION, g_nsconfig[idx].nsvci,
[] NSCP[idx].receive(t_NS_RecvFrom(tr_NS_RESET(NS_CAUSE_OM_INTERVENTION, g_nsconfig[idx].nsvc[0].nsvci,
g_nsconfig[idx].nsei))) -> value ns_rf {
NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_NS_RESET_ACK(g_nsconfig[idx].nsvci,
NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_NS_RESET_ACK(g_nsconfig[idx].nsvc[0].nsvci,
g_nsconfig[idx].nsei)));
if (not oneshot) { repeat; }
}

@ -8,18 +8,22 @@
[MODULE_PARAMETERS]
SGSN_Components.mp_nsconfig := {
provider := {
ip := {
address_family := AF_INET,
local_ip := "127.0.0.1",
local_udp_port := 23000,
remote_ip := "127.0.0.1",
remote_udp_port := 22000
}
},
nsvci := 1234,
nsei := 1234,
handle_sns := false
handle_sns := false,
nsvc := {
{
provider := {
ip := {
address_family := AF_INET,
local_ip := "127.0.0.1",
local_udp_port := 23000,
remote_ip := "127.0.0.1",
remote_udp_port := 22000
}
},
nsvci := 1234
}
}
}
[TESTPORT_PARAMETERS]

@ -98,11 +98,11 @@ friend template (value) PCUIF_info_ind ts_PCUIF_INFO_default(template (value) PC
ul_tbf_ext := 250 * 10, /* ms */
initial_cs := 2,
initial_mcs := 6,
nsvci := { mp_nsconfig.nsvci, 0 },
local_port := { mp_nsconfig.provider.ip.remote_udp_port, 0 },
remote_port := { mp_nsconfig.provider.ip.local_udp_port, 0 },
nsvci := { mp_nsconfig.nsvc[0].nsvci, 0 },
local_port := { mp_nsconfig.nsvc[0].provider.ip.remote_udp_port, 0 },
remote_port := { mp_nsconfig.nsvc[0].provider.ip.local_udp_port, 0 },
remote_addr := f_PCUIF_ver_INFO_RemoteAddr(
f_PCUIF_AF2addr_type(mp_nsconfig.provider.ip.address_family), mp_nsconfig.provider.ip.local_ip)
f_PCUIF_AF2addr_type(mp_nsconfig.nsvc[0].provider.ip.address_family), mp_nsconfig.nsvc[0].provider.ip.local_ip)
}
type record lqual_range {

@ -98,7 +98,7 @@ testcase TC_ns_reset_retrans() runs on RAW_Test_CT {
var integer i;
for (i := 0; i < 3; i := i+1) {
NSCP[0].receive(t_NS_RecvFrom(tr_NS_RESET(NS_CAUSE_OM_INTERVENTION,
g_nsconfig[0].nsvci, g_nsconfig[0].nsei)));
g_nsconfig[0].nsvc[0].nsvci, g_nsconfig[0].nsei)));
}
/* Expect inbound NS-RESET procedure */

@ -8,17 +8,21 @@
[MODULE_PARAMETERS]
SGSN_Components.mp_nsconfig := {
provider := {
ip := {
address_family := AF_INET,
local_ip := "127.0.0.1",
local_udp_port := 23000,
remote_ip := "127.0.0.1",
remote_udp_port := 22000
nsei := 1234,
nsvc := {
{
provider := {
ip := {
address_family := AF_INET,
local_ip := "127.0.0.1",
local_udp_port := 23000,
remote_ip := "127.0.0.1",
remote_udp_port := 22000
}
},
nsvci := 1234
}
},
nsvci := 1234,
nsei := 1234
}
}
PCUIF_Types.mp_pcuif_version := 10

@ -14,6 +14,7 @@ import from Osmocom_Types all;
import from PCU_Tests_NS all;
import from SGSN_Components all;
import from Osmocom_Gb_Types all;
import from NS_Emulation all;
import from NS_CodecPort all;
import from NS_Types all;
import from RAW_NS all;
@ -27,8 +28,9 @@ function f_incoming_sns_size(template (omit) NsCause cause := omit, integer idx
runs on RAW_NS_CT {
log("f_incoming_sns_size(idx=", idx, ")");
var PDU_NS rx;
var NSVCConfiguration nsvc_cfg := g_nsconfig[idx].nsvc[0];
if (mp_nsconfig.provider.ip.address_family == AF_INET) {
if (nsvc_cfg.provider.ip.address_family == AF_INET) {
/* expect one single SNS-SIZE with RESET flag; 4x v4 EP; no v6 EP */
rx := f_ns_exp(tr_SNS_SIZE(g_nsconfig[idx].nsei, rst_flag := true, max_nsvcs := 8,
num_v4 := 4, num_v6 := omit), idx);
@ -45,7 +47,9 @@ function f_outgoing_sns_size(template (omit) NsCause cause := omit, integer idx:
runs on RAW_NS_CT {
log("f_outgoing_sns_size(idx=", idx, ")");
var PDU_NS rx;
if (mp_nsconfig.provider.ip.address_family == AF_INET) {
var NSVCConfiguration nsvc_cfg := g_nsconfig[idx].nsvc[0];
if (nsvc_cfg.provider.ip.address_family == AF_INET) {
NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_SIZE(g_nsconfig[idx].nsei, rst_flag := true, max_nsvcs := 1,
num_v4 := 1, num_v6 := omit)
));
@ -63,17 +67,17 @@ function f_incoming_sns_config(template (omit) NsCause cause := omit, integer id
runs on RAW_NS_CT {
log("f_incoming_sns_config(idx=", idx, ")");
var PDU_NS rx;
var NSVCConfiguration nsvc_cfg := g_nsconfig[idx].nsvc[0];
if (mp_nsconfig.provider.ip.address_family == AF_INET) {
var template IP4_Elements v4_elem := { tr_SNS_IPv4(mp_nsconfig.provider.ip.remote_ip,
mp_nsconfig.provider.ip.remote_udp_port) };
if (nsvc_cfg.provider.ip.address_family == AF_INET) {
var template IP4_Elements v4_elem := { tr_SNS_IPv4(nsvc_cfg.provider.ip.remote_ip,
nsvc_cfg.provider.ip.remote_udp_port) };
rx := f_ns_exp(tr_SNS_CONFIG(g_nsconfig[idx].nsei, end_flag := true, v4 := v4_elem), idx);
} else {
var template IP6_Elements v6_elem := { tr_SNS_IPv6(mp_nsconfig.provider.ip.remote_ip,
mp_nsconfig.provider.ip.remote_udp_port) };
var template IP6_Elements v6_elem := { tr_SNS_IPv6(nsvc_cfg.provider.ip.remote_ip,
nsvc_cfg.provider.ip.remote_udp_port) };
rx := f_ns_exp(tr_SNS_CONFIG(g_nsconfig[idx].nsei, end_flag := true, v6 := v6_elem), idx);
}
NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause)));
}
@ -82,13 +86,15 @@ function f_outgoing_sns_config(template (omit) NsCause cause := omit, integer id
runs on RAW_NS_CT {
log("f_outgoing_sns_config(idx=", idx, ")");
var PDU_NS rx;
if (mp_nsconfig.provider.ip.address_family == AF_INET) {
var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[idx].provider.ip.local_ip,
g_nsconfig[idx].provider.ip.local_udp_port) }
var NSVCConfiguration nsvc_cfg := g_nsconfig[idx].nsvc[0];
if (nsvc_cfg.provider.ip.address_family == AF_INET) {
var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(nsvc_cfg.provider.ip.local_ip,
nsvc_cfg.provider.ip.local_udp_port) }
NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG(g_nsconfig[idx].nsei, true, v4)));
} else {
var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(g_nsconfig[idx].provider.ip.local_ip,
g_nsconfig[idx].provider.ip.local_udp_port) }
var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(nsvc_cfg.provider.ip.local_ip,
nsvc_cfg.provider.ip.local_udp_port) }
NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG(g_nsconfig[idx].nsei, true, omit, v6)));
}
rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause), idx);
@ -99,17 +105,18 @@ function f_outgoing_sns_config_1c1u(template (omit) NsCause cause := omit, integ
runs on RAW_NS_CT {
log("f_outgoing_sns_config_1c1u(idx=", idx, ")");
var PDU_NS rx;
if (mp_nsconfig.provider.ip.address_family == AF_INET) {
var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[0].provider.ip.local_ip,
g_nsconfig[0].provider.ip.local_udp_port, 1, 0),
ts_SNS_IPv4(g_nsconfig[1].provider.ip.local_ip,
g_nsconfig[1].provider.ip.local_udp_port, 0, 1) };
if (mp_nsconfig.nsvc[0].provider.ip.address_family == AF_INET) {
var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[0].nsvc[0].provider.ip.local_ip,
g_nsconfig[0].nsvc[0].provider.ip.local_udp_port, 1, 0),
ts_SNS_IPv4(g_nsconfig[1].nsvc[0].provider.ip.local_ip,
g_nsconfig[1].nsvc[0].provider.ip.local_udp_port, 0, 1) };
NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG(g_nsconfig[idx].nsei, true, v4)));
} else {
var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(g_nsconfig[0].provider.ip.local_ip,
g_nsconfig[0].provider.ip.local_udp_port, 1, 0),
ts_SNS_IPv6(g_nsconfig[1].provider.ip.local_ip,
g_nsconfig[1].provider.ip.local_udp_port, 0, 1) };
var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(g_nsconfig[0].nsvc[0].provider.ip.local_ip,
g_nsconfig[0].nsvc[0].provider.ip.local_udp_port, 1, 0),
ts_SNS_IPv6(g_nsconfig[1].nsvc[0].provider.ip.local_ip,
g_nsconfig[1].nsvc[0].provider.ip.local_udp_port, 0, 1) };
NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG(g_nsconfig[idx].nsei, true, omit, v6)));
}
rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause), idx);
@ -120,17 +127,17 @@ function f_outgoing_sns_config_1c1u_separate(template (omit) NsCause cause := om
runs on RAW_NS_CT {
log("f_outgoing_sns_config_1c1u_separate(idx=", idx, ")");
var PDU_NS rx;
if (mp_nsconfig.provider.ip.address_family == AF_INET) {
var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[1].provider.ip.local_ip,
g_nsconfig[1].provider.ip.local_udp_port, 1, 0),
ts_SNS_IPv4(g_nsconfig[2].provider.ip.local_ip,
g_nsconfig[2].provider.ip.local_udp_port, 0, 1) };
if (mp_nsconfig.nsvc[0].provider.ip.address_family == AF_INET) {
var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[1].nsvc[0].provider.ip.local_ip,
g_nsconfig[1].nsvc[0].provider.ip.local_udp_port, 1, 0),
ts_SNS_IPv4(g_nsconfig[2].nsvc[0].provider.ip.local_ip,
g_nsconfig[2].nsvc[0].provider.ip.local_udp_port, 0, 1) };
NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG(g_nsconfig[idx].nsei, true, v4)));
} else {
var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(g_nsconfig[1].provider.ip.local_ip,
g_nsconfig[1].provider.ip.local_udp_port, 1, 0),
ts_SNS_IPv6(g_nsconfig[2].provider.ip.local_ip,
g_nsconfig[2].provider.ip.local_udp_port, 0, 1) };
var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(g_nsconfig[1].nsvc[0].provider.ip.local_ip,
g_nsconfig[1].nsvc[0].provider.ip.local_udp_port, 1, 0),
ts_SNS_IPv6(g_nsconfig[2].nsvc[0].provider.ip.local_ip,
g_nsconfig[2].nsvc[0].provider.ip.local_udp_port, 0, 1) };
NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG(g_nsconfig[idx].nsei, true, omit, v6)));
}
rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause), idx);
@ -140,15 +147,16 @@ function f_outgoing_sns_add(integer idx_add, uint8_t w_sig := 1, uint8_t w_user
runs on RAW_NS_CT {
log("f_outgoing_sns_add(idx_add=", idx_add, ")");
var PDU_NS rx;
if (mp_nsconfig.provider.ip.address_family == AF_INET) {
var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[idx_add].provider.ip.local_ip,
g_nsconfig[idx_add].provider.ip.local_udp_port,
var NSVCConfiguration nsvc_cfg := g_nsconfig[idx].nsvc[0];
if (nsvc_cfg.provider.ip.address_family == AF_INET) {
var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(nsvc_cfg.provider.ip.local_ip,
nsvc_cfg.provider.ip.local_udp_port,
w_sig, w_user) };
NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_ADD(g_nsconfig[idx].nsei, 23, v4)));
rx := f_ns_exp(tr_SNS_ACK(g_nsconfig[idx].nsei, 23, omit, v4));
} else {
var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(g_nsconfig[idx_add].provider.ip.local_ip,
g_nsconfig[idx_add].provider.ip.local_udp_port,
var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(nsvc_cfg.provider.ip.local_ip,
nsvc_cfg.provider.ip.local_udp_port,
w_sig, w_user) };
NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_ADD(g_nsconfig[idx].nsei, 23, omit, v6)));
rx := f_ns_exp(tr_SNS_ACK(g_nsconfig[idx].nsei, 23, omit, omit, v6));
@ -159,15 +167,16 @@ function f_outgoing_sns_del(integer idx_del, uint8_t w_sig := 1, uint8_t w_user
runs on RAW_NS_CT {
log("f_outgoing_sns_del(idx_del=", idx_del, ")");
var PDU_NS rx;
if (mp_nsconfig.provider.ip.address_family == AF_INET) {
var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[idx_del].provider.ip.local_ip,
g_nsconfig[idx_del].provider.ip.local_udp_port,
var NSVCConfiguration nsvc_cfg := g_nsconfig[idx_del].nsvc[0];
if (nsvc_cfg.provider.ip.address_family == AF_INET) {
var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(nsvc_cfg.provider.ip.local_ip,
nsvc_cfg.provider.ip.local_udp_port,
w_sig, w_user) };
NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_DEL(g_nsconfig[idx].nsei, 24, omit, v4)));
rx := f_ns_exp(tr_SNS_ACK(g_nsconfig[idx].nsei, 24, omit, v4));
} else {
var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(g_nsconfig[idx_del].provider.ip.local_ip,
g_nsconfig[idx_del].provider.ip.local_udp_port,
var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(nsvc_cfg.provider.ip.local_ip,
nsvc_cfg.provider.ip.local_udp_port,
w_sig, w_user) };
NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_DEL(g_nsconfig[idx].nsei, 24, omit, omit, v6)));
rx := f_ns_exp(tr_SNS_ACK(g_nsconfig[idx].nsei, 24, omit, omit, v6));
@ -178,15 +187,16 @@ function f_outgoing_sns_chg_weight(integer idx_chg, uint8_t w_sig, uint8_t w_use
runs on RAW_NS_CT {
log("f_outgoing_sns_chg_weight(idx_chg=", idx_chg, ")");
var PDU_NS rx;
if (mp_nsconfig.provider.ip.address_family == AF_INET) {
var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[idx_chg].provider.ip.local_ip,
g_nsconfig[idx_chg].provider.ip.local_udp_port,
var NSVCConfiguration nsvc_cfg := g_nsconfig[idx_chg].nsvc[0];
if (nsvc_cfg.provider.ip.address_family == AF_INET) {
var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(nsvc_cfg.provider.ip.local_ip,
nsvc_cfg.provider.ip.local_udp_port,
w_sig, w_user) };
NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CHG_WEIGHT(g_nsconfig[idx].nsei, 25, v4)));
rx := f_ns_exp(tr_SNS_ACK(g_nsconfig[idx].nsei, 25, omit, v4));
} else {
var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(g_nsconfig[idx_chg].provider.ip.local_ip,
g_nsconfig[idx_chg].provider.ip.local_udp_port,
var template (omit) IP6_Elements v6 := { ts_SNS_IPv6(nsvc_cfg.provider.ip.local_ip,
nsvc_cfg.provider.ip.local_udp_port,
w_sig, w_user) };
NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CHG_WEIGHT(g_nsconfig[idx].nsei, 25, omit, v6)));
rx := f_ns_exp(tr_SNS_ACK(g_nsconfig[idx].nsei, 25, omit, omit, v6));

@ -8,17 +8,21 @@
[MODULE_PARAMETERS]
SGSN_Components.mp_nsconfig := {
provider := {
ip := {
address_family := AF_INET6,
local_ip := "::1",
local_udp_port := 23000,
remote_ip := "::1",
remote_udp_port := 22000,
nsei := 1234,
nsvc : {
{
provider := {
ip := {
address_family := AF_INET6,
local_ip := "::1",
local_udp_port := 23000,
remote_ip := "::1",
remote_udp_port := 22000,
}
},
nsvci := 1234
}
},
nsvci := 1234,
nsei := 1234
}
}
PCUIF_Types.mp_pcuif_version := 10

@ -39,19 +39,23 @@ modulepar {
};
NSConfiguration mp_nsconfig := {
provider := {
ip := {
address_family := AF_INET,
local_udp_port := 23000,
local_ip := "127.0.0.1",
remote_udp_port := 21000,
remote_ip := "127.0.0.1"
}
},
nsvci := 0,
nsei := 2342,
role_sgsn := true,
handle_sns := true
handle_sns := true,
nsvc := {
{
provider := {
ip := {
address_family := AF_INET,
local_udp_port := 23000,
local_ip := "127.0.0.1",
remote_udp_port := 21000,
remote_ip := "127.0.0.1"
}
},
nsvci := 0
}
}
};
}

@ -14,29 +14,41 @@
[MODULE_PARAMETERS]
SGSN_Tests.mp_nsconfig := {
{
provider := {
ip := {
address_family := AF_INET,
local_ip := "127.0.0.103",
remote_ip := "127.0.0.10"
nsvc := {
{
provider := {
ip := {
address_family := AF_INET,
local_ip := "127.0.0.103",
remote_ip := "127.0.0.10"
}
}
}
}
},
{
provider := {
ip := {
address_family := AF_INET,
local_ip := "127.0.0.103",
remote_ip := "127.0.0.10"
nsvc := {
{
provider := {
ip := {
address_family := AF_INET,
local_ip := "127.0.0.103",
remote_ip := "127.0.0.10"
}
}
}
}
},
{
provider := {
ip := {
address_family := AF_INET,
local_ip := "127.0.0.103",
remote_ip := "127.0.0.10"
nsvc := {
{
provider := {
ip := {
address_family := AF_INET,
local_ip := "127.0.0.103",
remote_ip := "127.0.0.10"
}
}
}
}
}

@ -69,49 +69,61 @@ modulepar {
NSConfigurations mp_nsconfig := {
{
provider := {
ip := {
address_family := AF_INET,
local_udp_port := 21010,
local_ip := "127.0.0.1",
remote_udp_port := 23000,
remote_ip := "127.0.0.1"
}
},
nsvci := 97,
nsei := 96,
role_sgsn := false,
handle_sns := false
handle_sns := false,
nsvc := {
{
provider := {
ip := {
address_family := AF_INET,
local_udp_port := 21010,
local_ip := "127.0.0.1",
remote_udp_port := 23000,
remote_ip := "127.0.0.1"
}
},
nsvci := 97
}
}
},
{
provider := {
ip := {
address_family := AF_INET,
local_udp_port := 21011,
local_ip := "127.0.0.1",
remote_udp_port := 23000,
remote_ip := "127.0.0.1"
}
},
nsvci := 98,
nsei := 97,
role_sgsn := false,
handle_sns := false
handle_sns := false,
nsvc := {
{
provider := {
ip := {
address_family := AF_INET,
local_udp_port := 21011,
local_ip := "127.0.0.1",
remote_udp_port := 23000,
remote_ip := "127.0.0.1"
}
},
nsvci := 98
}
}
},
{
provider := {
ip := {
address_family := AF_INET,
local_udp_port := 21012,
local_ip := "127.0.0.1",
remote_udp_port := 23000,
remote_ip := "127.0.0.1"
}
},
nsvci := 99,
nsei := 98,
role_sgsn := false,
handle_sns := false
handle_sns := false,
nsvc := {
{
provider := {
ip := {
address_family := AF_INET,
local_udp_port := 21012,
local_ip := "127.0.0.1",
remote_udp_port := 23000,
remote_ip := "127.0.0.1"
}
},
nsvci := 99
}
}
}
};

Loading…
Cancel
Save