summaryrefslogtreecommitdiffstats
path: root/library
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 /library
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
Diffstat (limited to 'library')
-rw-r--r--library/NS_Emulation.ttcn17
-rw-r--r--library/NS_Provider_IPL4.ttcn10
-rw-r--r--library/RAW_NS.ttcn9
3 files changed, 22 insertions, 14 deletions
diff --git a/library/NS_Emulation.ttcn b/library/NS_Emulation.ttcn
index 97a48e5..a0b24c9 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 8ab8caa..1414935 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 d02f4ca..dca352f 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;