Change in osmo-ttcn3-hacks[master]: bts: Test forwarding PCUIF<->IPA/OSMO/PCU

pespin gerrit-no-reply at lists.osmocom.org
Mon Jun 14 11:48:31 UTC 2021


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/24657 )


Change subject: bts: Test forwarding PCUIF<->IPA/OSMO/PCU
......................................................................

bts: Test forwarding PCUIF<->IPA/OSMO/PCU

Related: SYS#5303
Change-Id: Ib3012ce612f78e661fd46b608a0bf67e038e136f
---
M bts/BTS_Tests.cfg
M bts/BTS_Tests.ttcn
M bts/BTS_Tests_OML.ttcn
M library/AbisOML_Types.ttcn
M library/PCUIF_Types.ttcn
5 files changed, 229 insertions(+), 8 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/57/24657/1

diff --git a/bts/BTS_Tests.cfg b/bts/BTS_Tests.cfg
index aaffbf6..36d81e2 100644
--- a/bts/BTS_Tests.cfg
+++ b/bts/BTS_Tests.cfg
@@ -31,6 +31,7 @@
 #BTS_Tests.mp_tolerance_rxlev := 10;
 #BTS_Tests.mp_tolerance_rxqual := 1;
 
+BTS_Tests_OML.mp_pcu_socket := "/tmp/pcu_sock"
 
 [MAIN_CONTROLLER]
 
diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 547ada2..9dd4027 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -70,6 +70,7 @@
 friend module BTS_Tests_virtphy;
 friend module BTS_Tests_LAPDm;
 friend module BTS_Tests_perf;
+friend module BTS_Tests_OML;
 
 /* The tests assume a BTS with the following timeslot configuration:
  * TS0 : Combined CCCH + SDCCH/4
@@ -429,7 +430,7 @@
 }
 
 /* PCU socket may at any time receive a new INFO.ind */
-private altstep as_pcu_info_ind(PCUIF_CODEC_PT pt, integer pcu_conn_id,
+friend altstep as_pcu_info_ind(PCUIF_CODEC_PT pt, integer pcu_conn_id,
 				out PCUIF_Message pcu_last_info) {
 	var PCUIF_send_data sd;
 	[] pt.receive(t_SD_PCUIF(pcu_conn_id, tr_PCUIF_INFO_IND(0, ?))) -> value sd {
diff --git a/bts/BTS_Tests_OML.ttcn b/bts/BTS_Tests_OML.ttcn
index ddeb139..e37805e 100644
--- a/bts/BTS_Tests_OML.ttcn
+++ b/bts/BTS_Tests_OML.ttcn
@@ -16,6 +16,13 @@
 import from AbisOML_Types all;
 import from IPA_Emulation all;
 import from IPA_Types all;
+import from Misc_Helpers all;
+
+import from PCUIF_Types all;
+import from PCUIF_CodecPort all;
+import from PCUIF_CodecPort all;
+
+import from BTS_Tests all;
 
 const integer NUM_TRX := 8;
 
@@ -43,6 +50,8 @@
 	uint8_t mp_air_timer := 100;
 	uint8_t mp_ny1 := 10;
 	uint8_t mp_bsic := 63;
+
+	charstring mp_pcu_socket := PCU_SOCK_DEFAULT;
 };
 
 /* BSC side OML component */
@@ -52,8 +61,17 @@
 	/* Port for OML */
 	port IPA_OML_PT OML;
 	var uint8_t g_bts_nr := 0;
+
 	/* Port for Abis/Osmo/PCU */
 	port IPA_OSMO_PCU_PT IPA_OSMO_PCU;
+	/* PCU Interface of BTS */
+	port PCUIF_CODEC_PT PCU;
+	var integer g_pcu_conn_id;
+	/* Last PCU INFO IND we received */
+	var PCUIF_Message g_pcu_last_info;
+
+	/* As rxed by Get Attributes Response NM_ATT_MANUF_ID IE, see f_oml_getattr() */
+	var bitstring g_bts_features;
 
 	/* global test case guard timer */
 	timer T_oml_guard := 60.0;
@@ -112,6 +130,27 @@
 	activate(as_IPA_evt());
 }
 
+private function f_init_pcu(PCUIF_CODEC_PT pt, charstring id,
+			    out integer pcu_conn_id, out PCUIF_Message pcu_last_info) {
+	timer T := 2.0;
+	var PCUIF_send_data sd;
+
+	if (mp_pcu_socket == "") {
+		pcu_conn_id := -1;
+		return;
+	}
+	map(self:PCU, system:PCU);
+	pcu_conn_id := f_pcuif_connect(pt, mp_pcu_socket);
+
+	T.start;
+	alt {
+	[] as_pcu_info_ind(pt, pcu_conn_id, pcu_last_info);
+	[] T.timeout {
+		Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "Timeout waiting for PCU INFO_IND");
+		}
+	}
+	pt.send(t_SD_PCUIF(pcu_conn_id, ts_PCUIF_TXT_IND(0, PCU_VERSION, testcasename())));
+}
 
 /* Perform an "OPSTART" procedure with the speciifed MO" */
 private function f_oml_opstart(template (value) OML_FOM_ObjectClass obj_class,
@@ -232,7 +271,7 @@
 }
 
 /* Perform a "SET BTS ATTRIBUTES" procedure with the BTS */
-private function f_oml_bts_attr()
+private function f_oml_bts_setattr()
 runs on BSC_OML_CT {
 	var OML_FOM_ObjectInstance obj_inst := valueof(ts_OML_ObjectInstance(g_bts_nr, 255, 255));
 	var template (value) OML_FOM_IE_List ies := {
@@ -290,12 +329,15 @@
 	}
 }
 
-private function f_oml_exp_rx(template OML_PDU exp_rx, charstring err_msg) runs on BSC_OML_CT
+private function f_oml_exp_rx(template OML_PDU exp_rx, charstring err_msg)
+	runs on BSC_OML_CT return OML_PDU
 {
+	var OML_PDU rx;
 	timer T := 5.0;
+
 	T.start;
 	alt {
-	[] OML.receive(exp_rx) {
+	[] OML.receive(exp_rx) -> value rx {
 		setverdict(pass);
 		}
 	[] OML.receive { repeat; }
@@ -303,6 +345,7 @@
 		setverdict(fail, "Timeout waiting for ", err_msg);
 		}
 	}
+	return rx;
 }
 
 /* Send an OML message and expect a failure event report in response */
@@ -351,7 +394,23 @@
 }
 
 
+private function f_oml_getattr(template OML_PDU exp_rx := tr_OML_GetAttributesResponse(NM_OC_BTS, ?, ?)) runs on BSC_OML_CT
+{
+	var OML_FOM_ObjectInstance obj_inst := valueof(ts_OML_ObjectInstance(g_bts_nr, 255, 255));
+	var OML_FOM_IE_Type attr_li[2] := { NM_ATT_MANUF_ID, NM_ATT_SW_CONFIG };
+	var octetstring req_attr := ''O;
+	for (var integer i := 0; i < lengthof(attr_li); i := i + 1) {
+		req_attr := req_attr & int2oct(enum2int(attr_li[i]), 1);
+	}
+	var OML_PDU cmd := valueof(ts_OML_GetAttributes(NM_OC_BTS, obj_inst, req_attr));
 
+	OML.send(cmd);
+	var OML_PDU rx := f_oml_exp_rx(exp_rx, "BTS GetAttributes Response");
+
+	var OML_FOM_IE_Body ie_ari := f_OML_FOM_get_ie(rx.u.fom, NM_ATT_GET_ARI);
+	var OML_FOM_IE_Body manuf_id := f_OML_FOM_IE_List_get_ie(ie_ari.ari.ies, NM_ATT_MANUF_ID);
+	g_bts_features := oct2bit(manuf_id.other.payload);
+}
 
 
 
@@ -539,7 +598,7 @@
 	[] OML.receive { repeat; }
 	}
 
-	f_oml_bts_attr();
+	f_oml_bts_setattr();
 	f_oml_opstart(obj_class, obj_inst, false, NM_OPSTATE_ENABLED);
 }
 
@@ -616,6 +675,71 @@
 	}
 }
 
+/* Make sure that the IUT sends RSL Connect NACK when the remote is not reachable. */
+testcase TC_ipa_osmo_pcu_anr_fwd() runs on BSC_OML_CT {
+	var PCUIF_send_data pcu_sd_msg;
+	var PCUIF_Message msg_rx;
+	timer T := 2.0;
+
+	f_init_oml(testcasename());
+	f_init_pcu(PCU, testcasename(), g_pcu_conn_id, g_pcu_last_info);
+	f_oml_getattr();
+
+	log("BTS Features:", g_bts_features);
+	if (lengthof(g_bts_features) < 21 or g_bts_features[20] != '1'B) {
+		setverdict(fail, "Feature ABIS_OSMO_PCU not supported!");
+	}
+
+	IPA_OSMO_PCU.receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_UP));
+	IPA_OSMO_PCU.receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_ID_RESP));
+	IPA_OSMO_PCU.receive(tr_ASP_IPA_EV(ASP_IPA_EVENT_ID_ACK));
+
+	var PCUIF_CellDescriptionList cell_list := {
+		{3, 2, 880}, {3, 1, 880}, {3, 1, 887}
+	};
+	var PCUIF_CellDescriptionList zeroed_val := {{0, 0, 0}};
+	for (var integer i := 3; i < 80; i := i + 1) {
+		cell_list := cell_list & zeroed_val;
+	}
+
+	IPA_OSMO_PCU.send(ts_PCUIF_ANR_REQ(0, lengthof(cell_list), cell_list));
+	T.start;
+	alt {
+	[] PCU.receive(t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_ANR_REQ(0, lengthof(cell_list), cell_list))) {
+		setverdict(pass);
+		}
+	[] PCU.receive(PCUIF_send_data:?) -> value pcu_sd_msg {
+		setverdict(fail, "Unexpected message received: ", pcu_sd_msg.data, " vs exp: ",
+			   t_SD_PCUIF(g_pcu_conn_id, tr_PCUIF_ANR_REQ(0, lengthof(cell_list), cell_list)));
+	}
+	[] T.timeout { setverdict(fail, "Timeout waiting for ANR request on PCU inteface");}
+	}
+	T.stop;
+
+	var PCUIF_CellDescriptionList cell_list_resp := {
+		{3, 2, 880}, {3, 1, 880}, {3, 1, 887}
+	};
+	var PCUIF_RxLevList rxlev_list := { 40, 255, 34 };
+	for (var integer i := 3; i < 32; i := i + 1) {
+		cell_list_resp := cell_list_resp & zeroed_val;
+		rxlev_list := rxlev_list & {0};
+	}
+	/* Send back the response: */
+	PCU.send(t_SD_PCUIF(g_pcu_conn_id, ts_PCUIF_ANR_CNF(0, lengthof(cell_list_resp), cell_list_resp, rxlev_list)))
+	T.start;
+	alt {
+	[] IPA_OSMO_PCU.receive(tr_PCUIF_ANR_CNF(0, lengthof(cell_list_resp), cell_list_resp, rxlev_list)) {
+		setverdict(pass);
+		}
+	[] IPA_OSMO_PCU.receive(PCUIF_Message:?) -> value msg_rx {
+		setverdict(fail, "Unexpected message received: ", msg_rx, " vs exp: ",
+			   tr_PCUIF_ANR_CNF(0, lengthof(cell_list_resp), cell_list_resp, rxlev_list));
+	}
+	[] T.timeout { setverdict(fail, "Timeout waiting for ANR request on BSC inteface");}
+	}
+	setverdict(pass);
+}
+
 
 control {
 	execute( TC_wrong_mdisc() );
@@ -634,6 +758,8 @@
 	execute( TC_ts_opstart_noattr() );
 	execute( TC_initial_state_reports() );
 	execute( TC_ipa_rsl_connect_nack() );
+
+	execute( TC_ipa_osmo_pcu_anr_fwd() );
 }
 
 /* BTS:
diff --git a/library/AbisOML_Types.ttcn b/library/AbisOML_Types.ttcn
index 5997543..63dab7b 100644
--- a/library/AbisOML_Types.ttcn
+++ b/library/AbisOML_Types.ttcn
@@ -1226,6 +1226,21 @@
 	return resp;
 }
 
+function f_OML_FOM_IE_List_get_ie(OML_FOM_IE_List ie_list, OML_FOM_IE_Type iei) return OML_FOM_IE_Body
+{
+	for (var integer i := 0; i < lengthof(ie_list); i := i + 1) {
+		if (ie_list[i].iei == iei) {
+			return ie_list[i].body;
+		}
+	}
+	var OML_FOM_IE_Body dummy;
+	return dummy; /*TODO: setverdict(fail?) */
+}
+
+function f_OML_FOM_get_ie(OML_FOM fom, OML_FOM_IE_Type iei) return OML_FOM_IE_Body
+{
+	return f_OML_FOM_IE_List_get_ie(fom.ies, iei);
+}
 
 
 /***********************************************************************
diff --git a/library/PCUIF_Types.ttcn b/library/PCUIF_Types.ttcn
index 9d6b023..9c83a44 100644
--- a/library/PCUIF_Types.ttcn
+++ b/library/PCUIF_Types.ttcn
@@ -36,7 +36,9 @@
 	PCU_IF_MSG_ACT_REQ		('40'O),
 	PCU_IF_MSG_TIME_IND		('52'O),
 	PCU_IF_MSG_PAG_REQ		('60'O),
-	PCU_IF_MSG_TXT_IND		('70'O)
+	PCU_IF_MSG_TXT_IND		('70'O),
+	PCU_IF_MSG_ANR_REQ		('80'O),
+	PCU_IF_MSG_ANR_CNF		('81'O)
 } with { variant "FIELDLENGTH(8)" };
 
 type enumerated PCUIF_Sapi {
@@ -244,6 +246,25 @@
 	variant (tlli) "BYTEORDER(last)"
 };
 
+type record PCUIF_CellDescriptionV {
+	uint3_t				bcc, /* PLMN colour code */
+	uint3_t				ncc, /* BS colour code */
+	uint10_t			bcch_arfcn
+} with { variant "FIELDORDER(lsb)" };
+type set of PCUIF_CellDescriptionV PCUIF_CellDescriptionList;
+type set of uint8_t PCUIF_RxLevList;
+
+type record PCUIF_anr_req {
+	uint8_t		num_cells,
+	PCUIF_CellDescriptionList cell_list
+} with { variant (cell_list) "FIELDLENGTH(80)" };
+
+type record PCUIF_anr_cnf {
+	uint8_t		num_cells,
+	PCUIF_CellDescriptionList cell_list,
+	PCUIF_RxLevList	rxlev_list
+} with { variant (cell_list) "FIELDLENGTH(32)"
+	 variant (rxlev_list) "FIELDLENGTH(32)" };
 
 type union PCUIF_MsgUnion {
 	PCUIF_data		data_req,
@@ -258,7 +279,9 @@
 	PCUIF_act_req		act_req,
 	PCUIF_time_ind		time_ind,
 	PCUIF_pag_req		pag_req,
-	PCUIF_app_info_req	app_info_req
+	PCUIF_app_info_req	app_info_req,
+	PCUIF_anr_req		anr_req,
+	PCUIF_anr_cnf		anr_cnf
 } with { variant "" };
 
 type record PCUIF_Message {
@@ -279,7 +302,9 @@
 				act_req,	msg_type = PCU_IF_MSG_ACT_REQ;
 				time_ind,	msg_type = PCU_IF_MSG_TIME_IND;
 				pag_req,	msg_type = PCU_IF_MSG_PAG_REQ;
-				app_info_req,	msg_type = PCU_IF_MSG_APP_INFO_REQ)"
+				app_info_req,	msg_type = PCU_IF_MSG_APP_INFO_REQ;
+				anr_req,	msg_type = PCU_IF_MSG_ANR_REQ;
+				anr_cnf,	msg_type = PCU_IF_MSG_ANR_CNF)"
 	/* PCUIFv10: 1006 * 8 = 8048 bits */
 	variant "PADDING(8048)"
 };
@@ -937,6 +962,59 @@
 	}
 }
 
+template (value) PCUIF_Message ts_PCUIF_ANR_REQ(uint8_t bts_nr, uint8_t num_cells, PCUIF_CellDescriptionList cell_list) := {
+	msg_type := PCU_IF_MSG_ANR_REQ,
+	bts_nr := bts_nr,
+	spare := '0000'O,
+	u := {
+		anr_req := {
+			num_cells := num_cells,
+			cell_list := cell_list
+		}
+	}
+}
+template (present) PCUIF_Message tr_PCUIF_ANR_REQ(template (present) uint8_t bts_nr,
+						       template (present) uint8_t num_cells,
+						       template (present) PCUIF_CellDescriptionList cell_list) := {
+	msg_type := PCU_IF_MSG_ANR_REQ,
+	bts_nr := bts_nr,
+	spare := '0000'O,
+	u := {
+		anr_req := {
+			num_cells := num_cells,
+			cell_list := cell_list
+		}
+	}
+}
+
+template (value) PCUIF_Message ts_PCUIF_ANR_CNF(uint8_t bts_nr, uint8_t num_cells, PCUIF_CellDescriptionList cell_list,
+						PCUIF_RxLevList rxlev_list) := {
+	msg_type := PCU_IF_MSG_ANR_CNF,
+	bts_nr := bts_nr,
+	spare := '0000'O,
+	u := {
+		anr_cnf := {
+			num_cells := num_cells,
+			cell_list := cell_list,
+			rxlev_list := rxlev_list
+		}
+	}
+}
+template (present) PCUIF_Message tr_PCUIF_ANR_CNF(template (present) uint8_t bts_nr,
+						       template (present) uint8_t num_cells,
+						       template (present) PCUIF_CellDescriptionList cell_list,
+						       template (present) PCUIF_RxLevList rxlev_list) := {
+	msg_type := PCU_IF_MSG_ANR_CNF,
+	bts_nr := bts_nr,
+	spare := '0000'O,
+	u := {
+		anr_cnf := {
+			num_cells := num_cells,
+			cell_list := cell_list,
+			rxlev_list := rxlev_list
+		}
+	}
+}
 
 function f_PCUIF_PDCHMask_set(inout PCUIF_info_ind info, BIT8 pdch_mask,
 			      template (present) uint8_t trx_nr := ?)

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/24657
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ib3012ce612f78e661fd46b608a0bf67e038e136f
Gerrit-Change-Number: 24657
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210614/53cc26c2/attachment.htm>


More information about the gerrit-log mailing list