Migrate Gb (NS/BSSGP) code over to Ericsson NS/BSSGP modules
When we started out, Ericsson hadn't released yet their NS and BSSGP
modules. Let's port our logic over to their encoder/decoders, as they
are more complete (but less regular / more difficult to use).
Change-Id: Icbc4f5d24f3419f99c9a4805f836bddd2849f492
diff --git a/library/BSSGP_Emulation.ttcn b/library/BSSGP_Emulation.ttcn
index ac7beb8..70c9c80 100644
--- a/library/BSSGP_Emulation.ttcn
+++ b/library/BSSGP_Emulation.ttcn
@@ -2,7 +2,7 @@
import from NS_Types all;
import from NS_Emulation all;
import from BSSGP_Types all;
- import from BSSGP_Helper_Functions all;
+ import from Osmocom_Gb_Types all;
import from IPL4asp_Types all;
type record BssgpStatusIndication {
@@ -24,8 +24,8 @@
/* port from our (internal) point of view */
type port BSSGP_SP_PT message {
- in BssgpPdu;
- out BssgpPdu,
+ in PDU_BSSGP;
+ out PDU_BSSGP,
NsStatusIndication,
BssgpStatusIndication,
ASP_Event;
@@ -36,8 +36,8 @@
in ASP_Event,
NsStatusIndication,
BssgpStatusIndication,
- BssgpPdu;
- out BssgpPdu;
+ PDU_BSSGP;
+ out PDU_BSSGP;
} with { extension "internal" };
function BssgpStart() runs on BSSGP_CT {
@@ -65,10 +65,10 @@
modulepar {
Nsvci mp_nsei := 96;
Nsvci mp_bvci := 196;
- BssgpCellId mp_cellid := { ra_id := { lai := { mcc_mnc := '262F42'H, lac := 13135}, rac := 0 }, cell_id := 20960 };
+ BssgpCellId mp_cellid := { ra_id := { lai := { mcc_mnc := '26242F'H, lac := 13135}, rac := 0 }, cell_id := 20960 };
};
- function f_BnsUdReq(template BssgpPdu pdu, BssgpBvci bvci := mp_bvci) return NsUnitdataRequest {
+ function f_BnsUdReq(template PDU_BSSGP pdu, BssgpBvci bvci := mp_bvci) return NsUnitdataRequest {
var NsUnitdataRequest udr := {
bvci := bvci,
nsei := mp_nsei,
@@ -76,13 +76,13 @@
* unbound integer value." when trying to send the reocrd rather than the octetstring */
//sdu := omit,
//bssgp := valueof(pdu)
- sdu := f_BSSGP_compact_len(enc_BssgpPdu(valueof(pdu))),
+ sdu := enc_PDU_BSSGP(valueof(pdu)),
bssgp := omit
}
return udr;
}
- function f_BnsUdInd(template BssgpPdu pdu, template BssgpBvci bvci := mp_bvci) return template NsUnitdataIndication {
+ function f_BnsUdInd(template PDU_BSSGP pdu, template BssgpBvci bvci := mp_bvci) return template NsUnitdataIndication {
var template NsUnitdataIndication udi := {
bvci := bvci,
nsei := mp_nsei,
@@ -99,9 +99,9 @@
}
private function f_sendReset() runs on BSSGP_CT {
- var BssgpPdu pdu := valueof(t_BVC_RESET(BSSGP_CAUSE_OM_INTERVENTION, mp_bvci, mp_cellid));
+ var PDU_BSSGP pdu := valueof(ts_BVC_RESET(BSSGP_CAUSE_OM_INTERVENTION, mp_bvci, mp_cellid));
log("PDU: ", pdu);
- log("ENC: ", enc_BssgpPdu(pdu));
+ log("ENC: ", enc_PDU_BSSGP(pdu));
/* BVC-RESET is always sent via the SIGNALLING BVCI, see Table 5.4.1 */
BSCP.send(f_BnsUdReq(pdu, 0));
@@ -119,9 +119,9 @@
g_T1.start;
}
- private function f_sendStatus(BssgpCause cause, BssgpPdu pdu) runs on BSSGP_CT {
+ private function f_sendStatus(BssgpCause cause, PDU_BSSGP pdu) runs on BSSGP_CT {
/* FIXME: Make sure correct Signaling or PTP BVCI is used! */
- BSCP.send(f_BnsUdReq(t_BSSGP_STATUS({ t_BSSGP_IE_Cause(cause), t_BSSGP_IE_Bvci(mp_bvci), t_BSSGP_IE_PDU(pdu)})));
+ BSCP.send(f_BnsUdReq(ts_BSSGP_STATUS(mp_bvci, cause, pdu)));
}
altstep as_allstate() runs on BSSGP_CT {
@@ -136,20 +136,20 @@
}
/* Respond to RESET with correct BVCI/CellID */
- [] BSCP.receive(f_BnsUdInd(t_BVC_RESET(?, mp_bvci, mp_cellid), 0)) -> value udi {
+ [] BSCP.receive(f_BnsUdInd(tr_BVC_RESET(?, mp_bvci, mp_cellid), 0)) -> value udi {
log("Rx BVC-RESET for Our BVCI=", mp_bvci);
- BSCP.send(f_BnsUdReq(t_BVC_RESET_ACK(mp_bvci, mp_cellid), 0));
+ BSCP.send(f_BnsUdReq(ts_BVC_RESET_ACK(mp_bvci, mp_cellid), 0));
f_change_state(BVC_S_UNBLOCKED);
}
/* Respond to RESET for signalling BVCI 0 */
- [] BSCP.receive(f_BnsUdInd(t_BVC_RESET(?, 0, mp_cellid), 0)) -> value udi {
+ [] BSCP.receive(f_BnsUdInd(tr_BVC_RESET(?, 0, mp_cellid), 0)) -> value udi {
log("Rx BVC-RESET for Signaling BVCI=0");
- BSCP.send(f_BnsUdReq(t_BVC_RESET_ACK(0, mp_cellid), 0));
+ BSCP.send(f_BnsUdReq(ts_BVC_RESET_ACK(0, mp_cellid), 0));
}
/* Respond to RESET with wrong NSEI/NSVCI */
- [] BSCP.receive(f_BnsUdInd(t_BVC_RESET(?, ?, ?), 0)) -> value udi {
+ [] BSCP.receive(f_BnsUdInd(tr_BVC_RESET(?, ?, ?), 0)) -> value udi {
log("Rx BVC-RESET for unknown BVCI");
f_sendStatus(BSSGP_CAUSE_BVCI_UNKNOWN, udi.bssgp);
}
@@ -175,11 +175,11 @@
private function f_ScanEvents() runs on BSSGP_CT {
var NsUnitdataIndication udi;
- var BssgpPdu bs_pdu;
+ var PDU_BSSGP bs_pdu;
var default d;
- log("matching against ", t_BVC_RESET(?, mp_bvci, mp_cellid));
+ log("matching against ", tr_BVC_RESET(?, mp_bvci, mp_cellid));
d := activate(as_allstate());
@@ -213,28 +213,30 @@
g_T1.stop;
f_change_state(BVC_S_BLOCKED);
}
- [] BSCP.receive(f_BnsUdInd(t_BVC_RESET_ACK(mp_bvci, mp_cellid), 0)) -> value udi {
+ [] BSCP.receive(f_BnsUdInd(tr_BVC_RESET_ACK(mp_bvci, mp_cellid), 0)) -> value udi {
g_T2.stop;
f_change_state(BVC_S_UNBLOCKED);
}
/* simply acknowledge all Flow Control Messages */
+/*
[g_sgsn_role] BSCP.receive(f_BnsUdInd(t_BVC_FC_BVC)) {
BSCP.send(f_BnsUdReq(t_BVC_FC_BVC_ACK));
}
[g_sgsn_role] BSCP.receive(f_BnsUdInd(t_BVC_FC_MS)) {
BSCP.send(f_BnsUdReq(t_BVC_FC_MS_ACK));
}
+*/
/* BSSGP-UNITDATA PDUs from network to NS-UNITDATA.ind to user */
- [] BSCP.receive(f_BnsUdInd(tr_BSSGP_type(DL_UNITDATA))) -> value udi {
+ [not g_sgsn_role] BSCP.receive(f_BnsUdInd(tr_BSSGP_DL_UD)) -> value udi {
BSSGP_SP.send(udi.bssgp);
}
- [] BSCP.receive(f_BnsUdInd(tr_BSSGP_type(UL_UNITDATA))) -> value udi {
+ [g_sgsn_role] BSCP.receive(f_BnsUdInd(tr_BSSGP_UL_UD)) -> value udi {
BSSGP_SP.send(udi.bssgp);
}
/* pass virtually any PDU from user to NS-UNITDATA PDU on network */
- [] BSSGP_SP.receive(BssgpPdu:?) -> value bs_pdu {
+ [] BSSGP_SP.receive(PDU_BSSGP:?) -> value bs_pdu {
BSCP.send(f_BnsUdReq(bs_pdu));
}