summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-09-13 15:32:56 +0200
committerlaforge <laforge@osmocom.org>2020-09-27 09:15:32 +0000
commit5e8573e9b79d512e75a5e53a667d0e0477b39e27 (patch)
tree00d30e2d01379d8af1769184dd113d27ff32217d
parent6ed083c6c8c6b15b8aeecfe078f252e181e0904e (diff)
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
-rw-r--r--library/NS_Emulation.ttcn17
-rw-r--r--library/NS_Provider_IPL4.ttcn10
-rw-r--r--library/RAW_NS.ttcn9
-rw-r--r--pcu/PCU_Tests.cfg14
-rw-r--r--pcu/PCU_Tests.ttcn6
-rw-r--r--pcu/PCU_Tests_SNS.ttcn36
-rw-r--r--pcu/SGSN_Components.ttcn14
-rw-r--r--sgsn/SGSN_Tests.cfg30
-rw-r--r--sgsn/SGSN_Tests.ttcn42
9 files changed, 109 insertions, 69 deletions
diff --git a/library/NS_Emulation.ttcn b/library/NS_Emulation.ttcn
index 97a48e54..a0b24c9c 100644
--- a/library/NS_Emulation.ttcn
+++ b/library/NS_Emulation.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)) {
diff --git a/library/NS_Provider_IPL4.ttcn b/library/NS_Provider_IPL4.ttcn
index 8ab8caac..14149350 100644
--- a/library/NS_Provider_IPL4.ttcn
+++ b/library/NS_Provider_IPL4.ttcn
@@ -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;
diff --git a/library/RAW_NS.ttcn b/library/RAW_NS.ttcn
index d02f4ca9..dca352f2 100644
--- a/library/RAW_NS.ttcn
+++ b/library/RAW_NS.ttcn
@@ -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;
diff --git a/pcu/PCU_Tests.cfg b/pcu/PCU_Tests.cfg
index 76815449..e7bba181 100644
--- a/pcu/PCU_Tests.cfg
+++ b/pcu/PCU_Tests.cfg
@@ -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
}
diff --git a/pcu/PCU_Tests.ttcn b/pcu/PCU_Tests.ttcn
index 0bd70936..f68485a2 100644
--- a/pcu/PCU_Tests.ttcn
+++ b/pcu/PCU_Tests.ttcn
@@ -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 {
diff --git a/pcu/PCU_Tests_SNS.ttcn b/pcu/PCU_Tests_SNS.ttcn
index 192890d8..524d35cf 100644
--- a/pcu/PCU_Tests_SNS.ttcn
+++ b/pcu/PCU_Tests_SNS.ttcn
@@ -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));
diff --git a/pcu/SGSN_Components.ttcn b/pcu/SGSN_Components.ttcn
index afd4ee99..4a94c034 100644
--- a/pcu/SGSN_Components.ttcn
+++ b/pcu/SGSN_Components.ttcn
@@ -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,
diff --git a/sgsn/SGSN_Tests.cfg b/sgsn/SGSN_Tests.cfg
index d5c3a4cb..c4e1a33f 100644
--- a/sgsn/SGSN_Tests.cfg
+++ b/sgsn/SGSN_Tests.cfg
@@ -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 := {
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index b42020d0..8a87ee27 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -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,