Change in osmo-hnodeb[master]: Configure CI, LAC, RAC, SAC over VTY and use it in HnbRegisterRequest

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/.

pespin gerrit-no-reply at lists.osmocom.org
Tue Nov 2 12:00:42 UTC 2021


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-hnodeb/+/26021 )

Change subject: Configure CI,LAC,RAC,SAC over VTY and use it in HnbRegisterRequest
......................................................................

Configure CI,LAC,RAC,SAC over VTY and use it in HnbRegisterRequest

Change-Id: I06f21758e361b7d4d7141086d758893bee434e5c
---
M include/osmocom/hnodeb/hnodeb.h
M src/osmo-hnodeb/hnbap.c
M src/osmo-hnodeb/vty.c
3 files changed, 69 insertions(+), 9 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, approved
  laforge: Looks good to me, but someone else must approve



diff --git a/include/osmocom/hnodeb/hnodeb.h b/include/osmocom/hnodeb/hnodeb.h
index 77430d6..a82c662 100644
--- a/include/osmocom/hnodeb/hnodeb.h
+++ b/include/osmocom/hnodeb/hnodeb.h
@@ -56,6 +56,10 @@
 
 struct hnb {
 	struct osmo_plmn_id plmn;
+	uint16_t cell_identity;
+	uint16_t lac;
+	uint8_t rac;
+	uint16_t sac;
 	struct {
 		char *local_addr;
 		uint16_t local_port;
diff --git a/src/osmo-hnodeb/hnbap.c b/src/osmo-hnodeb/hnbap.c
index 58fec85..167ec50 100644
--- a/src/osmo-hnodeb/hnbap.c
+++ b/src/osmo-hnodeb/hnbap.c
@@ -162,15 +162,10 @@
 	HNBAP_HNBRegisterRequestIEs_t request;
 	memset(&request, 0, sizeof(request));
 
-	lac = 0xc0fe;
-	sac = 0xabab;
-	rac = 0x42;
-	cid = 0xadceaab;
-
-	asn1_u16_to_str(&request.lac, &lac, lac);
-	asn1_u16_to_str(&request.sac, &sac, sac);
-	asn1_u8_to_str(&request.rac, &rac, rac);
-	asn1_u28_to_bitstring(&request.cellIdentity, &cid, cid);
+	asn1_u16_to_str(&request.lac, &lac, hnb->lac);
+	asn1_u16_to_str(&request.sac, &sac, hnb->sac);
+	asn1_u8_to_str(&request.rac, &rac, hnb->rac);
+	asn1_u28_to_bitstring(&request.cellIdentity, &cid, hnb->cell_identity);
 
 	request.hnB_Identity.hNB_Identity_Info.buf = (uint8_t*) identity;
 	request.hnB_Identity.hNB_Identity_Info.size = strlen(identity);
diff --git a/src/osmo-hnodeb/vty.c b/src/osmo-hnodeb/vty.c
index f4623ad..1adc7ba 100644
--- a/src/osmo-hnodeb/vty.c
+++ b/src/osmo-hnodeb/vty.c
@@ -27,6 +27,8 @@
 #include <osmocom/vty/command.h>
 #include <osmocom/core/msgb.h>
 
+#include <osmocom/gsm/protocol/gsm_04_08.h>
+
 #include <osmocom/rua/rua_msg_factory.h>
 
 #include <osmocom/ranap/ranap_common.h>
@@ -127,6 +129,57 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN_USRATTR(cfg_hnodeb_ci,
+	      cfg_hnodeb_ci_cmd,
+	      0,
+	      "cell_identity <0-65535>",
+	      "Set the Cell identity of this HnodeB\n" "Cell Identity\n")
+{
+	struct hnb *hnb = (struct hnb *)vty->index;
+	hnb->cell_identity = atoi(argv[0]);
+	return CMD_SUCCESS;
+}
+
+DEFUN_USRATTR(cfg_hnodeb_lac,
+	      cfg_hnodeb_lac_cmd,
+	      0,
+	      "location_area_code <0-65535>",
+	      "Set the Location Area Code (LAC) of this HnodeB\n" "LAC\n")
+{
+	struct hnb *hnb = (struct hnb *)vty->index;
+	int lac = atoi(argv[0]);
+
+	if (lac == GSM_LAC_RESERVED_DETACHED || lac == GSM_LAC_RESERVED_ALL_BTS) {
+		vty_out(vty, "%% LAC %d is reserved by GSM 04.08%s",
+			lac, VTY_NEWLINE);
+		return CMD_WARNING;
+	}
+	hnb->lac = lac;
+	return CMD_SUCCESS;
+}
+
+DEFUN_USRATTR(cfg_hnodeb_rac,
+	      cfg_hnodeb_rac_cmd,
+	      0,
+	      "routing_area_code <0-255>",
+	      "Set the Routing Area Code (RAC) of this HnodeB\n" "RAC\n")
+{
+	struct hnb *hnb = (struct hnb *)vty->index;
+	hnb->rac = atoi(argv[0]);
+	return CMD_SUCCESS;
+}
+
+DEFUN_USRATTR(cfg_hnodeb_sac,
+	      cfg_hnodeb_sac_cmd,
+	      0,
+	      "service_area_code <0-255>",
+	      "Set the Service Area Code (RAC) of this HnodeB\n" "SAC\n")
+{
+	struct hnb *hnb = (struct hnb *)vty->index;
+	hnb->sac = atoi(argv[0]);
+	return CMD_SUCCESS;
+}
+
 static struct cmd_node iuh_node = {
 	IUH_NODE,
 	"%s(config-iuh)# ",
@@ -189,6 +242,10 @@
 	vty_out(vty, " network country code %s%s", osmo_mcc_name(g_hnb->plmn.mcc), VTY_NEWLINE);
 	vty_out(vty, " mobile network code %s%s",
 		osmo_mnc_name(g_hnb->plmn.mnc, g_hnb->plmn.mnc_3_digits), VTY_NEWLINE);
+	vty_out(vty, " cell_identity %u%s", g_hnb->cell_identity, VTY_NEWLINE);
+	vty_out(vty, " location_area_code %u%s", g_hnb->lac, VTY_NEWLINE);
+	vty_out(vty, " routing_area_code %u%s", g_hnb->rac, VTY_NEWLINE);
+	vty_out(vty, " service_area_code %u%s", g_hnb->sac, VTY_NEWLINE);
 	vty_out(vty, " iuh%s", VTY_NEWLINE);
 	if (g_hnb->iuh.local_addr)
 		vty_out(vty, "  local-ip %s%s", g_hnb->iuh.local_addr, VTY_NEWLINE);
@@ -306,6 +363,10 @@
 	install_node(&hnodeb_node, config_write_hnodeb);
 	install_element(HNODEB_NODE, &cfg_hnodeb_ncc_cmd);
 	install_element(HNODEB_NODE, &cfg_hnodeb_mnc_cmd);
+	install_element(HNODEB_NODE, &cfg_hnodeb_ci_cmd);
+	install_element(HNODEB_NODE, &cfg_hnodeb_lac_cmd);
+	install_element(HNODEB_NODE, &cfg_hnodeb_rac_cmd);
+	install_element(HNODEB_NODE, &cfg_hnodeb_sac_cmd);
 	install_element(HNODEB_NODE, &cfg_hnodeb_iuh_cmd);
 	install_node(&iuh_node, NULL);
 	install_element(IUH_NODE, &cfg_hnodeb_iuh_local_ip_cmd);

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

Gerrit-Project: osmo-hnodeb
Gerrit-Branch: master
Gerrit-Change-Id: I06f21758e361b7d4d7141086d758893bee434e5c
Gerrit-Change-Number: 26021
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211102/6d96364c/attachment.htm>


More information about the gerrit-log mailing list