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
diff --git a/library/RAW_NS.ttcn b/library/RAW_NS.ttcn
index 314bf31..8540f38 100644
--- a/library/RAW_NS.ttcn
+++ b/library/RAW_NS.ttcn
@@ -49,16 +49,17 @@
/* 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_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 @@
/* 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 @@
/* 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; }
}