This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
lynxis lazus gerrit-no-reply at lists.osmocom.orglynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/10376 Change subject: NS_Emulation: support multiple instances at the same time ...................................................................... NS_Emulation: support multiple instances at the same time The NS_Emulation has multiple configuration values hardcoded. Add an offset parameter to NSStart which adds to: - the source udp port - nsei - nsvci. Change-Id: I9128f9ad5c372779c38799269393137ba52576cd --- M library/NS_Emulation.ttcn 1 file changed, 22 insertions(+), 16 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/76/10376/1 diff --git a/library/NS_Emulation.ttcn b/library/NS_Emulation.ttcn index 01d45b4..1095ae5 100644 --- a/library/NS_Emulation.ttcn +++ b/library/NS_Emulation.ttcn @@ -72,7 +72,10 @@ out NsUnitdataRequest; } with { extension "internal" }; - function NSStart() runs on NS_CT { + function NSStart(integer init_offset := 0) runs on NS_CT { + offset := init_offset; + nsei := mp_nsei + offset; + nsvci := mp_nsvci + offset; f_init(); f_ScanEvents(); } @@ -80,7 +83,7 @@ private function f_init() runs on NS_CT { var Result res; /* Connect the UDP socket */ - res := f_IPL4_connect(NSCP, mp_remote_ip, mp_remote_udp_port, mp_local_ip, mp_local_udp_port, 0, { udp := {}}); + res := f_IPL4_connect(NSCP, mp_remote_ip, mp_remote_udp_port, mp_local_ip, mp_local_udp_port + offset, 0, { udp := {}}); if (not ispresent(res.connId)) { setverdict(fail, "Could not connect NS UDP socket, check your configuration"); mtc.stop; @@ -97,6 +100,9 @@ /* NS-User SAP towards the user */ port NS_SP_PT NS_SP; + var integer offset := 0; + var Nsvci nsvci := 0 + var Nsvci nsei := 0 var NseState g_state := NSE_S_DEAD_BLOCKED; var ConnectionId g_conn_id := -1; @@ -118,11 +124,11 @@ var NseState old_state := g_state; g_state := new_state; log("NS State Transition: ", old_state, " -> ", new_state); - NS_SP.send(t_NsStsInd(mp_nsei, mp_nsvci, old_state, new_state)); + NS_SP.send(t_NsStsInd(nsei, nsvci, old_state, new_state)); } private function f_sendReset() runs on NS_CT { - NSCP.send(t_NS_Send(g_conn_id, t_NS_RESET(NS_CAUSE_OM_INTERVENTION, mp_nsvci, mp_nsei))); + NSCP.send(t_NS_Send(g_conn_id, t_NS_RESET(NS_CAUSE_OM_INTERVENTION, nsvci, nsei))); g_state := NSE_S_WAIT_RESET; } @@ -137,7 +143,7 @@ } private function f_sendBlock(NsCause cause) runs on NS_CT { - NSCP.send(t_NS_Send(g_conn_id, t_NS_BLOCK(cause, mp_nsvci))); + NSCP.send(t_NS_Send(g_conn_id, t_NS_BLOCK(cause, nsvci))); Tns_block.start; } @@ -176,9 +182,9 @@ } /* Respond to RESET with correct NSEI/NSVCI */ - [] NSCP.receive(t_NS_RecvFrom(t_NS_RESET(?, mp_nsvci, mp_nsei))) -> value rf { + [] NSCP.receive(t_NS_RecvFrom(t_NS_RESET(?, nsvci, nsei))) -> value rf { f_change_state(NSE_S_ALIVE_BLOCKED); - NSCP.send(t_NS_Send(g_conn_id, t_NS_RESET_ACK(mp_nsvci, mp_nsei))); + NSCP.send(t_NS_Send(g_conn_id, t_NS_RESET_ACK(nsvci, nsei))); } /* Respond to RESET with wrong NSEI/NSVCI */ @@ -210,7 +216,7 @@ } } else if (g_state == NSE_S_WAIT_RESET) { alt { - [] NSCP.receive(t_NS_RecvFrom(t_NS_RESET_ACK(mp_nsvci, mp_nsei))) -> value rf { + [] NSCP.receive(t_NS_RecvFrom(t_NS_RESET_ACK(nsvci, nsei))) -> value rf { f_change_state(NSE_S_ALIVE_BLOCKED); f_sendAlive(); f_sendUnblock(); @@ -219,8 +225,8 @@ } else if (g_state == NSE_S_ALIVE_BLOCKED) { alt { /* bogus block, just respond with ACK */ - [] NSCP.receive(t_NS_RecvFrom(t_NS_BLOCK(?, mp_nsvci))) -> value rf { - NSCP.send(t_NS_Send(g_conn_id, t_NS_BLOCK_ACK(mp_nsvci))); + [] NSCP.receive(t_NS_RecvFrom(t_NS_BLOCK(?, nsvci))) -> value rf { + NSCP.send(t_NS_Send(g_conn_id, t_NS_BLOCK_ACK(nsvci))); } /* Respond to UNBLOCK with UNBLOCK-ACK + change state */ [] NSCP.receive(t_NS_RecvFrom(t_NS_UNBLOCK)) -> value rf { @@ -244,26 +250,26 @@ NSCP.send(t_NS_Send(g_conn_id, t_NS_UNBLOCK_ACK)); } /* Respond to BLOCK with BLOCK-ACK + change state */ - [] NSCP.receive(t_NS_RecvFrom(t_NS_BLOCK(?, mp_nsvci))) -> value rf { - NSCP.send(t_NS_Send(g_conn_id, t_NS_BLOCK_ACK(mp_nsvci))); + [] NSCP.receive(t_NS_RecvFrom(t_NS_BLOCK(?, nsvci))) -> value rf { + NSCP.send(t_NS_Send(g_conn_id, t_NS_BLOCK_ACK(nsvci))); Tns_block.stop; f_change_state(NSE_S_ALIVE_BLOCKED); } - [] NSCP.receive(t_NS_RecvFrom(t_NS_BLOCK_ACK(mp_nsvci))) -> value rf { + [] NSCP.receive(t_NS_RecvFrom(t_NS_BLOCK_ACK(nsvci))) -> value rf { Tns_block.stop; } /* NS-UNITDATA PDU from network to NS-UNITDATA.ind to user */ [] NSCP.receive(t_NS_RecvFrom(t_NS_UNITDATA(?, ?, ?))) -> value rf { - NS_SP.send(t_NsUdInd(mp_nsei, + NS_SP.send(t_NsUdInd(nsei, oct2int(rf.msg.pDU_NS_Unitdata.bVCI), rf.msg.pDU_NS_Unitdata.nS_SDU)); } /* NS-UNITDATA.req from user to NS-UNITDATA PDU on network */ - [] NS_SP.receive(t_NsUdReq(mp_nsei, ?, ?, omit)) -> value ud_req { + [] NS_SP.receive(t_NsUdReq(nsei, ?, ?, omit)) -> value ud_req { /* using raw octetstring PDU */ NSCP.send(t_NS_Send(g_conn_id, t_NS_UNITDATA(t_SduCtrlB, ud_req.bvci, ud_req.sdu))); } - [] NS_SP.receive(t_NsUdReq(mp_nsei, ?, omit, ?)) -> value ud_req { + [] NS_SP.receive(t_NsUdReq(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(t_NS_Send(g_conn_id, t_NS_UNITDATA(t_SduCtrlB, ud_req.bvci, enc))); -- To view, visit https://gerrit.osmocom.org/10376 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I9128f9ad5c372779c38799269393137ba52576cd Gerrit-Change-Number: 10376 Gerrit-PatchSet: 1 Gerrit-Owner: lynxis lazus <lynxis at fe80.eu> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180807/dc299643/attachment.htm>