PCUIF: Prepare for simulating BTS side of PCU Interface
Our TTCN-3 PCUIF code so far was only used to simulate the PCU side
of the interface: connecting to the socket as a client. However,
it's also useful to emulate the BTS side of the interface: Listening
for a connection as a server.
Also, the send/receive templates are prepared for the inverse role.
Change-Id: I779ff2903cab8c13ffb8fe10a4cacd996bafe69a
diff --git a/library/PCUIF_CodecPort.ttcn b/library/PCUIF_CodecPort.ttcn
index 389c5ca..676a91a 100644
--- a/library/PCUIF_CodecPort.ttcn
+++ b/library/PCUIF_CodecPort.ttcn
@@ -83,6 +83,35 @@
return -23;
}
+function f_pcuif_listen(PCUIF_CODEC_PT pt, charstring sock) return integer {
+ var UD_listen_result res;
+ var UD_connected udc;
+ timer T := 5.0;
+
+ pt.send(UD_listen:{sock});
+ T.start;
+ alt {
+ [] pt.receive(UD_listen_result:?) -> value res {
+ if (ispresent(res.result) and ispresent (res.result.result_code) and
+ res.result.result_code == ERROR) {
+ if (ispresent(res.result.err)) {
+ setverdict(fail, "Error listening on PCU socket: ", res.result.err);
+ } else {
+ setverdict(fail, "Error listening on PCU socket");
+ }
+ mtc.stop;
+ } else {
+ return res.id;
+ }
+ }
+ [] T.timeout {
+ setverdict(fail, "Timeout waiting for PCU socket connection");
+ mtc.stop;
+ }
+ }
+ return -23;
+}
+
function f_PCUIF_tx_imm_ass_pch(PCUIF_CODEC_PT pt, integer conn_id, octetstring imm_ass, hexstring imsi,
uint8_t bts_nr := 0) return uint32_t {
var PCUIF_send_data sd;
diff --git a/library/PCUIF_Types.ttcn b/library/PCUIF_Types.ttcn
index 7bfaf9b..89a4c33 100644
--- a/library/PCUIF_Types.ttcn
+++ b/library/PCUIF_Types.ttcn
@@ -125,11 +125,12 @@
OCT8 tsc,
uint32_t hLayer1
} with { variant (pdch_mask) "BITORDER(msb)" };
+type record length(8) of PCUIF_InfoTrx PCUIF_InfoTrxs;
type record PCUIF_info_ind {
uint32_t version,
PCUIF_Flags flags,
- record length(8) of PCUIF_InfoTrx trx,
+ PCUIF_InfoTrxs trx,
uint8_t bsic,
uint16_t mcc,
@@ -232,6 +233,29 @@
with { extension "prototype(convert) decode(RAW)" };
+template (value) PCUIF_Message ts_PCUIF_RTS_REQ(template (value) uint8_t bts_nr,
+ template (value) uint8_t trx_nr,
+ template (value) uint8_t ts_nr,
+ template (value) PCUIF_Sapi sapi,
+ template (value) uint32_t fn,
+ template (value) uint16_t arfcn,
+ template (value) uint8_t block_nr
+ ) := {
+ msg_type := PCU_IF_MSG_RTS_REQ,
+ bts_nr := bts_nr,
+ spare := '0000'O,
+ u := {
+ rts_req := {
+ sapi := sapi,
+ spare := '000000'O,
+ fn := fn,
+ arfcn := arfcn,
+ trx_nr := trx_nr,
+ ts_nr := ts_nr,
+ block_nr := block_nr
+ }
+ }
+}
template PCUIF_Message tr_PCUIF_RTS_REQ(template uint8_t bts_nr := ?,
template uint8_t trx_nr := ?,
template uint8_t ts_nr := ?,
@@ -266,6 +290,20 @@
}
}
}
+template PCUIF_Message tr_PCUIF_TXT_IND(template uint8_t bts_nr, template PCUIF_TextType tt,
+ template charstring text := ?) := {
+ msg_type := PCU_IF_MSG_TXT_IND,
+ bts_nr := bts_nr,
+ spare := '0000'O,
+ u := {
+ txt_ind := {
+ txt_type := tt,
+ text := text
+ }
+ }
+}
+
+
template (value) PCUIF_Message ts_PCUIF_ACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := {
msg_type := PCU_IF_MSG_ACT_REQ,
@@ -280,6 +318,20 @@
}
}
}
+template PCUIF_Message tr_PCUIF_ACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
+ template uint8_t ts_nr) := {
+ msg_type := PCU_IF_MSG_ACT_REQ,
+ bts_nr := bts_nr,
+ spare := '0000'O,
+ u := {
+ act_req := {
+ is_activate := 1,
+ trx_nr := trx_nr,
+ ts_nr := ts_nr,
+ spare := '00'O
+ }
+ }
+}
template (value) PCUIF_Message ts_PCUIF_DEACT_REQ(uint8_t bts_nr, uint8_t trx_nr, uint8_t ts_nr) := {
msg_type := PCU_IF_MSG_ACT_REQ,
@@ -294,7 +346,53 @@
}
}
}
+template PCUIF_Message tr_PCUIF_DEACT_REQ(template uint8_t bts_nr, template uint8_t trx_nr,
+ template uint8_t ts_nr) := {
+ msg_type := PCU_IF_MSG_ACT_REQ,
+ bts_nr := bts_nr,
+ spare := '0000'O,
+ u := {
+ act_req := {
+ is_activate := 0,
+ trx_nr := trx_nr,
+ ts_nr := ts_nr,
+ spare := '00'O
+ }
+ }
+}
+template (value) PCUIF_Message ts_PCUIF_DATA_IND(template (value) uint8_t bts_nr,
+ template (value) uint8_t trx_nr,
+ template (value) uint8_t ts_nr,
+ template (value) uint8_t block_nr,
+ template (value) PCUIF_Sapi sapi,
+ template (value) OCT162 data,
+ template (value) uint32_t fn,
+ template (value) uint16_t arfcn,
+ template (value) int8_t rssi := -80,
+ template (value) uint16_t ber10k := 0,
+ template (value) int16_t ta_offs_qbits := 0,
+ template (value) uint16_t lqual_cb := 10) := {
+ msg_type := PCU_IF_MSG_DATA_IND,
+ bts_nr := bts_nr,
+ spare := '0000'O,
+ u := {
+ data_ind := {
+ sapi := sapi,
+ len := lengthof(valueof(data)),
+ data := data,
+ fn := fn,
+ arfcn := arfcn,
+ trx_nr := trx_nr,
+ ts_nr := ts_nr,
+ block_nr := block_nr,
+ rssi := rssi,
+ ber10k := ber10k,
+ ta_offs_qbits := ta_offs_qbits,
+ lqual_cb := lqual_cb
+ }
+ }
+}
template PCUIF_Message tr_PCUIF_DATA_IND(template uint8_t bts_nr := ?,
template uint8_t trx_nr := ?,
template uint8_t ts_nr := ?,
@@ -347,7 +445,63 @@
}
}
}
+template PCUIF_Message tr_PCUIF_DATA_REQ(template uint8_t bts_nr,
+ template uint8_t trx_nr,
+ template uint8_t ts_nr,
+ template uint8_t block_nr := ?,
+ template uint32_t fn := ?,
+ template PCUIF_Sapi sapi := ?,
+ template octetstring data := ?) := {
+ msg_type := PCU_IF_MSG_DATA_REQ,
+ bts_nr := bts_nr,
+ spare := '0000'O,
+ u := {
+ data_req := {
+ sapi := sapi,
+ len := ?,
+ data := data,
+ fn := fn,
+ arfcn := 0, /* unused in BTS */
+ trx_nr := trx_nr,
+ ts_nr := ts_nr,
+ block_nr := block_nr,
+ /* measurement parameters below unused on Tx */
+ rssi := 0,
+ ber10k := 0,
+ ta_offs_qbits := 0,
+ lqual_cb := 0
+ }
+ }
+}
+template (value) PCUIF_Message ts_PCUIF_DATA_CNF(template (value) uint8_t bts_nr,
+ template (value) uint8_t trx_nr,
+ template (value) uint8_t ts_nr,
+ template (value) uint8_t block_nr,
+ template (value) uint32_t fn,
+ template (value) uint16_t arfcn,
+ template (value) PCUIF_Sapi sapi,
+ template (value) octetstring data) := {
+ msg_type := PCU_IF_MSG_DATA_CNF,
+ bts_nr := bts_nr,
+ spare := '0000'O,
+ u := {
+ data_cnf := {
+ sapi := sapi,
+ len := 0, /* overwritten */
+ data := data,
+ fn := fn,
+ arfcn := arfcn,
+ trx_nr := trx_nr,
+ ts_nr := ts_nr,
+ block_nr := block_nr,
+ rssi := 0,
+ ber10k := 0,
+ ta_offs_qbits := 0,
+ lqual_cb := 0
+ }
+ }
+}
template PCUIF_Message tr_PCUIF_DATA_CNF(template uint8_t bts_nr := ?,
template uint8_t trx_nr := ?,
template uint8_t ts_nr := ?,
@@ -374,6 +528,29 @@
}
}
+template (value) PCUIF_Message ts_PCUIF_RACH_IND(template (value) uint8_t bts_nr,
+ template (value) uint16_t ra,
+ template (value) uint8_t is_11bit,
+ template (value) uint8_t burst_type,
+ template (value) uint32_t fn,
+ template (value) uint16_t arfcn,
+ template (value) int16_t qta := 0
+) := {
+ msg_type := PCU_IF_MSG_RACH_IND,
+ bts_nr := bts_nr,
+ spare := '0000'O,
+ u := {
+ rach_ind := {
+ sapi := PCU_IF_SAPI_RACH,
+ ra := ra,
+ qta := qta,
+ fn := fn,
+ arfcn := arfcn,
+ is_11bit := is_11bit,
+ burst_type := burst_type
+ }
+ }
+}
template PCUIF_Message tr_PCUIF_RACH_IND(template uint8_t bts_nr := ?,
template uint16_t ra := ?,
template uint8_t is_11bit := ?,
@@ -395,6 +572,21 @@
}
}
+template (value) PCUIF_Message ts_PCUIF_PAG_REQ(template (value) uint8_t bts_nr,
+ template (value) OCT9 id_lv,
+ template (value) uint8_t chan_needed,
+ template (value) PCUIF_Sapi sapi) := {
+ msg_type := PCU_IF_MSG_PAG_REQ,
+ bts_nr := bts_nr,
+ spare := '0000'O,
+ u := {
+ pag_req := {
+ sapi := sapi,
+ chan_needed := chan_needed,
+ identity_lv := id_lv
+ }
+ }
+}
template PCUIF_Message tr_PCUIF_PAG_REQ(template uint8_t bts_nr := ?,
template OCT9 id_lv := ?,
template uint8_t chan_needed := ?,
@@ -411,6 +603,100 @@
}
}
+const PCUIF_Flags c_PCUIF_Flags_default := {
+ bts_active := true,
+ sysmo_direct_dsp := false,
+ spare := '00000000000000'B,
+ cs1 := true,
+ cs2 := true,
+ cs3 := true,
+ cs4 := true,
+ mcs1 := true,
+ mcs2 := true,
+ mcs3 := true,
+ mcs4 := true,
+ mcs5 := true,
+ mcs6 := true,
+ mcs7 := true,
+ mcs8 := true,
+ mcs9 := true,
+ spare2 := '000'B
+};
+
+template (value) PCUIF_InfoTrx ts_PCUIF_InfoTrx(template (value) uint16_t arfcn := 871,
+ template (value) BIT8 pdch_mask := '00000001'B,
+ OCT1 tsc := '07'O) := {
+ arfcn := arfcn,
+ pdch_mask := pdch_mask,
+ spare := '00'O,
+ tsc := tsc & tsc & tsc & tsc & tsc & tsc & tsc & tsc,
+ hLayer1 := 0
+}
+
+template (value) PCUIF_InfoTrx ts_PCUIF_InfoTrxNULL := ts_PCUIF_InfoTrx(0, '00000000'B, '00'O);
+
+template (value) PCUIF_InfoTrxs ts_PCUIF_InfoTrxs_def := {
+ ts_PCUIF_InfoTrx, ts_PCUIF_InfoTrxNULL, ts_PCUIF_InfoTrxNULL, ts_PCUIF_InfoTrxNULL,
+ ts_PCUIF_InfoTrxNULL, ts_PCUIF_InfoTrxNULL, ts_PCUIF_InfoTrxNULL, ts_PCUIF_InfoTrxNULL };
+
+
+template (value) PCUIF_Message ts_PCUIF_INFO_IND(template (value) uint8_t bts_nr,
+ template (value) uint16_t nsei,
+ template (value) uint16_t nsvci,
+ template (value) uint16_t bvci,
+ template (value) uint16_t local_port,
+ template (value) uint16_t remote_port,
+ template (value) uint32_t remote_ip,
+ template (value) PCUIF_Flags flags := c_PCUIF_Flags_default,
+ template (value) uint16_t mcc := 262,
+ template (value) uint16_t mnc := 42,
+ template (value) uint16_t lac := 2342,
+ template (value) uint8_t rac := 0,
+ template (value) uint16_t cell_id := 1,
+ template (value) uint8_t bsic := 7,
+ template (value) PCUIF_InfoTrxs trx := ts_PCUIF_InfoTrxs_def,
+ template (value) uint32_t version := PCU_IF_VERSION) := {
+ msg_type := PCU_IF_MSG_INFO_IND,
+ bts_nr := bts_nr,
+ spare := '0000'O,
+ u := {
+ info_ind := {
+ version := version,
+ flags := flags,
+ trx := trx,
+ bsic := bsic,
+ mcc := mcc,
+ mnc := mnc,
+ mnc_3_digits := 0,
+ lac := lac,
+ rac := rac,
+ nsei := nsei,
+ nse_timer := { 3, 3, 3, 3, 30, 3, 10 },
+ cell_timer := { 3, 3, 3, 3, 3, 10, 3, 10, 3, 10, 3 },
+ cell_id := cell_id,
+ repeat_time := 5 * 50,
+ repeat_count := 3,
+ bvci := bvci,
+ t3142 := 20,
+ t3169 := 5,
+ t3191 := 5,
+ t3193_10ms := 160,
+ t3195 := 5,
+ t3101 := 10,
+ t3103 := 4,
+ t3105 := 8,
+ cv_countdown := 15,
+ dl_tbf_ext := 250 * 10, /* ms */
+ ul_tbf_ext := 250 * 10, /* ms */
+ initial_cs := 2,
+ initial_mcs := 6,
+ nsvci := { nsvci, 0 },
+ local_pprt := { local_port, 0 },
+ remote_port := { remote_port, 0 },
+ remote_ip := { remote_ip , 0 }
+ }
+ }
+}
template PCUIF_Message tr_PCUIF_INFO_IND(template uint8_t bts_nr := ?,
template PCUIF_Flags flags := ?,
template uint32_t version := PCU_IF_VERSION) := {