pcu: Support Neighbor Address Resolution over PCUIF

New versions of osmo-pcu support Neighbor Address Resolution over this
interface, and deprecated the old CTRL interface.
Let's use it by default while still keeping support for the old one for
a while to avoid breakage of existing deployments.

Tests run to validate:
* Old osmo-pcu still passes tests using CTRL interface
* New osmo-pcu (with new iface support) still passes tests using CTRL
  interface
* New osmo-pcu (with new iface support) passes tests using new iface

Related: SYS#4971
Change-Id: I05f1aabc64fc5bc4740b0d8afd8990b485eacd50
diff --git a/library/PCUIF_Types.ttcn b/library/PCUIF_Types.ttcn
index 1e57fb2..dcae4e6 100644
--- a/library/PCUIF_Types.ttcn
+++ b/library/PCUIF_Types.ttcn
@@ -38,7 +38,10 @@
 	PCU_IF_MSG_INTERF_IND		('53'O),
 	PCU_IF_MSG_PAG_REQ		('60'O),
 	PCU_IF_MSG_TXT_IND		('70'O),
-	PCU_IF_MSG_CONTAINER		('80'O)
+	PCU_IF_MSG_CONTAINER		('80'O),
+	/* Container payload message types: */
+	PCU_IF_MSG_NEIGH_ADDR_REQ	('81'O),
+	PCU_IF_MSG_NEIGH_ADDR_CNF	('82'O)
 } with { variant "FIELDLENGTH(8)" };
 
 type enumerated PCUIF_Sapi {
@@ -254,15 +257,37 @@
 	variant (tlli) "BYTEORDER(last)"
 };
 
+type record PCUIF_neigh_addr_req {
+	uint16_t	local_lac,
+	uint16_t	local_ci,
+	uint16_t	tgt_arfcn,
+	uint8_t		tgt_bsic
+} with { variant (local_lac) "BYTEORDER(last)"
+	 variant (local_ci) "BYTEORDER(last)"
+	 variant (tgt_arfcn) "BYTEORDER(last)" };
+
+type record PCUIF_neigh_addr_cnf {
+	PCUIF_neigh_addr_req orig_req,
+	uint8_t 	error_code,
+	uint16_t	mcc,
+	uint16_t	mnc,
+	uint8_t		mnc_3_digits,
+	uint16_t	lac,
+	uint8_t		rac,
+	uint16_t	cell_identity
+} with { variant (mcc) "BYTEORDER(last)"
+	 variant (mnc) "BYTEORDER(last)"
+	 variant (lac) "BYTEORDER(last)"
+	 variant (cell_identity) "BYTEORDER(last)" };
+
 type union PCUIF_ContainerMsgUnion {
-	 /* This field can be removed once first container message is added, see
-	  * https://bugs.eclipse.org/bugs/show_bug.cgi?id=574469 */
-	octetstring tmp_fixme,
+	PCUIF_neigh_addr_req	neigh_addr_req,
+	PCUIF_neigh_addr_cnf	neigh_addr_cnf,
 	octetstring	other
 } with { variant "" };
 
 type record PCUIF_container {
-	uint8_t		msg_type,
+	PCUIF_MsgType	msg_type,
 	OCT1		spare,
 	uint16_t	len, /* network byte order */
 	PCUIF_ContainerMsgUnion	u
@@ -270,7 +295,8 @@
 	variant (len) "BYTEORDER(last)"
 	variant (len) "LENGTHTO(u)"
 	variant (u) "CROSSTAG(
-			tmp_fixme, 	msg_type = 255;
+			neigh_addr_req,	msg_type = PCU_IF_MSG_NEIGH_ADDR_REQ;
+			neigh_addr_cnf,	msg_type = PCU_IF_MSG_NEIGH_ADDR_CNF;
 			other,		OTHERWISE)"
 };
 
@@ -1026,7 +1052,7 @@
 	}
 }
 
-template (value) PCUIF_container ts_PCUIF_CONT_OTHER(uint8_t msg_type, template (value) octetstring payload) := {
+template (value) PCUIF_container ts_PCUIF_CONT_OTHER(PCUIF_MsgType msg_type, template (value) octetstring payload) := {
 	msg_type := msg_type,
 	spare := '00'O,
 	len := lengthof(payload),
@@ -1034,7 +1060,7 @@
 		other := payload
 	}
 }
-template (present) PCUIF_container tr_PCUIF_CONT_OTHER(template (present) uint8_t msg_type,
+template (present) PCUIF_container tr_PCUIF_CONT_OTHER(template (present) PCUIF_MsgType msg_type,
 						       template (present) octetstring payload) := {
 	msg_type := msg_type,
 	spare := '00'O,
@@ -1044,6 +1070,77 @@
 	}
 }
 
+template (present) PCUIF_container tr_PCUIF_CONT_NEIGH_ADDR_REQ(template (present) uint16_t local_lac := ?,
+								template (present) uint16_t local_ci := ?,
+								template (present) uint16_t tgt_arfcn := ?,
+								template (present) uint8_t tgt_bsic := ?) := {
+	msg_type := PCU_IF_MSG_NEIGH_ADDR_REQ,
+	spare := '00'O,
+	len := ?,
+	u := {
+		neigh_addr_req := {
+			local_lac := local_lac,
+			local_ci := local_ci,
+			tgt_arfcn := tgt_arfcn,
+			tgt_bsic := tgt_bsic
+		}
+	}
+}
+template (present) PCUIF_Message tr_PCUIF_NEIGH_ADDR_REQ(template (present) uint8_t bts_nr,
+								template (present) uint16_t local_lac := ?,
+								template (present) uint16_t local_ci := ?,
+								template (present) uint16_t tgt_arfcn := ?,
+								template (present) uint8_t tgt_bsic := ?) := {
+	msg_type := PCU_IF_MSG_CONTAINER,
+	bts_nr := bts_nr,
+	spare := '0000'O,
+	u := {
+		container := tr_PCUIF_CONT_NEIGH_ADDR_REQ(local_lac, local_ci, tgt_arfcn, tgt_bsic)
+	}
+}
+
+template (value) PCUIF_container ts_PCUIF_CONT_NEIGH_ADDR_CNF(template (value) PCUIF_neigh_addr_req orig_req,
+							template (value) uint8_t error_code := 0,
+							template (value) uint16_t mcc := 0,
+							template (value) uint16_t mnc := 0,
+							template (value) uint8_t mnc_3_digits := 0,
+							template (value) uint16_t lac := 0,
+							template (value) uint8_t rac := 0,
+							template (value) uint16_t cell_identity := 0) := {
+	msg_type := PCU_IF_MSG_NEIGH_ADDR_CNF,
+	spare := '00'O,
+	len := 0, /* overwritten */
+	u := {
+		neigh_addr_cnf := {
+			orig_req := orig_req,
+			error_code := error_code,
+			mcc := mcc,
+			mnc := mnc,
+			mnc_3_digits := mnc_3_digits,
+			lac := lac,
+			rac := rac,
+			cell_identity := cell_identity
+		}
+	}
+}
+template (value) PCUIF_Message ts_PCUIF_NEIGH_ADDR_CNF(template (value) uint8_t bts_nr,
+							template (value) PCUIF_neigh_addr_req orig_req,
+							template (value) uint8_t error_code := 0,
+							template (value) uint16_t mcc := 0,
+							template (value) uint16_t mnc := 0,
+							template (value) uint8_t mnc_3_digits := 0,
+							template (value) uint16_t lac := 0,
+							template (value) uint8_t rac := 0,
+							template (value) uint16_t cell_identity := 0) := {
+	msg_type := PCU_IF_MSG_CONTAINER,
+	bts_nr := bts_nr,
+	spare := '0000'O,
+	u := {
+		container := ts_PCUIF_CONT_NEIGH_ADDR_CNF(orig_req, error_code, mcc, mnc, mnc_3_digits,
+							  lac, rac, cell_identity)
+	}
+}
+
 function f_PCUIF_PDCHMask_set(inout PCUIF_info_ind info, BIT8 pdch_mask,
 			      template (present) uint8_t trx_nr := ?)
 {