NS_Emulation: Prepare NSConfiguration for non-IP providers

NSConfiguration currently contains parameters relevant only for IP
based transport.  Move IP/UDP parameters into a sub-structure in
anticipation of Frame Relay support.

Change-Id: I6904520d8c2f546327029777d68b1907611a8cf5
changes/17/20117/9
Harald Welte 2 years ago committed by laforge
parent 6ed083c6c8
commit 5e8573e9b7
  1. 17
      library/NS_Emulation.ttcn
  2. 10
      library/NS_Provider_IPL4.ttcn
  3. 9
      library/RAW_NS.ttcn
  4. 14
      pcu/PCU_Tests.cfg
  5. 6
      pcu/PCU_Tests.ttcn
  6. 36
      pcu/PCU_Tests_SNS.ttcn
  7. 14
      pcu/SGSN_Components.ttcn
  8. 30
      sgsn/SGSN_Tests.cfg
  9. 42
      sgsn/SGSN_Tests.ttcn

@ -131,12 +131,18 @@ module NS_Emulation {
timer Tns_block := 10.0;
}
type record NSConfiguration {
type record NSConfigurationIP {
AddressFamily address_family,
PortNumber local_udp_port,
charstring local_ip,
PortNumber remote_udp_port,
charstring remote_ip,
charstring remote_ip
};
type union NSConfigurationP {
NSConfigurationIP ip
};
type record NSConfiguration {
NSConfigurationP provider,
Nsvci nsvci,
Nsvci nsei,
boolean role_sgsn,
@ -216,7 +222,7 @@ module NS_Emulation {
/* FIXME */
}
[config.role_sgsn and config.handle_sns] as_sns_sgsn();
[config.role_sgsn and config.handle_sns and ischosen(config.provider.ip)] as_sns_sgsn();
/* default case of handling unknown PDUs */
[] NSCP.receive(PDU_NS: ?) -> value rf {
@ -238,11 +244,12 @@ module NS_Emulation {
self.stop;
}
[] NSCP.receive(tr_SNS_CONFIG(config.nsei, true,
{tr_SNS_IPv4(config.remote_ip, config.remote_udp_port)})) -> value rf {
{tr_SNS_IPv4(config.provider.ip.remote_ip,
config.provider.ip.remote_udp_port)})) -> value rf {
/* blindly acknowledge whatever the PCU sends */
NSCP.send(ts_SNS_CONFIG_ACK(config.nsei, omit));
/* 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.provider.ip.local_ip, config.provider.ip.local_udp_port)) };
NSCP.send(ts_SNS_CONFIG(config.nsei, true, v4));
alt {
[] NSCP.receive(tr_SNS_CONFIG_ACK(config.nsei, omit)) {

@ -27,12 +27,12 @@ function main(NSConfiguration config) runs on NS_Provider_IPL4_CT {
/* connect socket */
map(self:IPL4, system:IPL4);
var Result res := f_IPL4_connect(IPL4, config.remote_ip, config.remote_udp_port, config.local_ip,
config.local_udp_port, 0, { udp := {}});
var Result res := f_IPL4_connect(IPL4, config.provider.ip.remote_ip,
config.provider.ip.remote_udp_port,
config.provider.ip.local_ip,
config.provider.ip.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));
setverdict(fail, "Could not connect NS UDP socket ", config.provider.ip);
mtc.stop;
}
g_conn_id := res.connId;

@ -50,14 +50,15 @@ function f_init_ns_codec(NSConfiguration ns_config, integer idx := 0, float guar
g_nsconfig[idx] := ns_config;
/* adjust those parts different for each NS-VC */
g_nsconfig[idx].nsvci := ns_config.nsvci + idx;
g_nsconfig[idx].local_udp_port := ns_config.local_udp_port + idx + tc_offset;
g_nsconfig[idx].provider.ip.local_udp_port := ns_config.provider.ip.local_udp_port + idx + tc_offset;
}
map(self:NSCP[idx], system:NSCP);
/* Connect the UDP socket */
log("connecting NSCP[", idx, "] to ", g_nsconfig[idx]);
res := f_IPL4_connect(NSCP[idx], g_nsconfig[idx].remote_ip, g_nsconfig[idx].remote_udp_port,
g_nsconfig[idx].local_ip, g_nsconfig[idx].local_udp_port, 0, { udp := {}});
var NSConfiguration nscfg := g_nsconfig[idx];
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 := {}});
if (not ispresent(res.connId)) {
setverdict(fail, "Could not connect NS UDP socket, check your configuration ", g_nsconfig[idx]);
mtc.stop;

@ -8,11 +8,15 @@
[MODULE_PARAMETERS]
SGSN_Components.mp_nsconfig := {
address_family := AF_INET,
local_ip := "127.0.0.1",
local_udp_port := 23000,
remote_ip := "127.0.0.1",
remote_udp_port := 22000,
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
}

@ -98,10 +98,10 @@ friend template (value) PCUIF_info_ind ts_PCUIF_INFO_default := {
initial_cs := 2,
initial_mcs := 6,
nsvci := { mp_nsconfig.nsvci, 0 },
local_port := { mp_nsconfig.remote_udp_port, 0 },
remote_port := { mp_nsconfig.local_udp_port, 0 },
local_port := { mp_nsconfig.provider.ip.remote_udp_port, 0 },
remote_port := { mp_nsconfig.provider.ip.local_udp_port, 0 },
remote_addr := f_PCUIF_ver_INFO_RemoteAddr(
f_PCUIF_AF2addr_type(mp_nsconfig.address_family), mp_nsconfig.local_ip)
f_PCUIF_AF2addr_type(mp_nsconfig.provider.ip.address_family), mp_nsconfig.provider.ip.local_ip)
}
type record lqual_range {

@ -50,8 +50,8 @@ 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 template IP4_Elements v4_elem := { tr_SNS_IPv4(mp_nsconfig.remote_ip,
mp_nsconfig.remote_udp_port) };
var template IP4_Elements v4_elem := { tr_SNS_IPv4(mp_nsconfig.provider.ip.remote_ip,
mp_nsconfig.provider.ip.remote_udp_port) };
rx := f_ns_exp(tr_SNS_CONFIG(g_nsconfig[idx].nsei, end_flag := true, v4 := v4_elem), idx);
NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause)));
}
@ -61,8 +61,8 @@ 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;
var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[idx].local_ip,
g_nsconfig[idx].local_udp_port) }
var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[idx].provider.ip.local_ip,
g_nsconfig[idx].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)));
rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause), idx);
}
@ -72,10 +72,10 @@ 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;
var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[0].local_ip,
g_nsconfig[0].local_udp_port, 1, 0),
ts_SNS_IPv4(g_nsconfig[1].local_ip,
g_nsconfig[1].local_udp_port, 0, 1) };
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) };
NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG(g_nsconfig[idx].nsei, true, v4)));
rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause), idx);
}
@ -85,10 +85,10 @@ 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;
var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[1].local_ip,
g_nsconfig[1].local_udp_port, 1, 0),
ts_SNS_IPv4(g_nsconfig[2].local_ip,
g_nsconfig[2].local_udp_port, 0, 1) };
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) };
NSCP[idx].send(t_NS_Send(g_ns_conn_id[idx], ts_SNS_CONFIG(g_nsconfig[idx].nsei, true, v4)));
rx := f_ns_exp(tr_SNS_CONFIG_ACK(g_nsconfig[idx].nsei, cause), idx);
}
@ -97,8 +97,8 @@ 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;
var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[idx_add].local_ip,
g_nsconfig[idx_add].local_udp_port,
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,
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));
@ -108,8 +108,8 @@ 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;
var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[idx_del].local_ip,
g_nsconfig[idx_del].local_udp_port,
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,
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));
@ -119,8 +119,8 @@ 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;
var template (omit) IP4_Elements v4 := { ts_SNS_IPv4(g_nsconfig[idx_chg].local_ip,
g_nsconfig[idx_chg].local_udp_port,
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,
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));

@ -35,11 +35,15 @@ modulepar {
};
NSConfiguration mp_nsconfig := {
address_family := AF_INET,
local_udp_port := 23000,
local_ip := "127.0.0.1",
remote_udp_port := 21000,
remote_ip := "127.0.0.1",
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,

@ -14,19 +14,31 @@
[MODULE_PARAMETERS]
SGSN_Tests.mp_nsconfig := {
{
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"
}
}
},
{
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"
}
}
},
{
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"
}
}
}
}
SGSN_Tests.mp_ranap_cfg := {

@ -69,33 +69,45 @@ modulepar {
NSConfigurations mp_nsconfig := {
{
address_family := AF_INET,
local_udp_port := 21010,
local_ip := "127.0.0.1",
remote_udp_port := 23000,
remote_ip := "127.0.0.1",
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
},
{
address_family := AF_INET,
local_udp_port := 21011,
local_ip := "127.0.0.1",
remote_udp_port := 23000,
remote_ip := "127.0.0.1",
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
},
{
address_family := AF_INET,
local_udp_port := 21012,
local_ip := "127.0.0.1",
remote_udp_port := 23000,
remote_ip := "127.0.0.1",
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,

Loading…
Cancel
Save