Change in osmo-hnodeb[master]: Configure HNB-Identity 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:44 UTC 2021


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

Change subject: Configure HNB-Identity over VTY and use it in HnbRegisterRequest
......................................................................

Configure HNB-Identity over VTY and use it in HnbRegisterRequest

Change-Id: Ida47bbb85b5438a2ec9805005bc2ab834c79b765
---
M include/osmocom/hnodeb/hnodeb.h
M src/osmo-hnodeb/hnb.c
M src/osmo-hnodeb/hnbap.c
M src/osmo-hnodeb/vty.c
4 files changed, 17 insertions(+), 3 deletions(-)

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



diff --git a/include/osmocom/hnodeb/hnodeb.h b/include/osmocom/hnodeb/hnodeb.h
index a82c662..5d6d088 100644
--- a/include/osmocom/hnodeb/hnodeb.h
+++ b/include/osmocom/hnodeb/hnodeb.h
@@ -55,6 +55,7 @@
 };
 
 struct hnb {
+	char *identity; /* HNB-Identity */
 	struct osmo_plmn_id plmn;
 	uint16_t cell_identity;
 	uint16_t lac;
diff --git a/src/osmo-hnodeb/hnb.c b/src/osmo-hnodeb/hnb.c
index b0628e5..34ff426 100644
--- a/src/osmo-hnodeb/hnb.c
+++ b/src/osmo-hnodeb/hnb.c
@@ -116,6 +116,7 @@
 	if (!hnb)
 		return NULL;
 
+	hnb->identity = talloc_strdup(hnb, "OsmoHNodeB");
 	hnb->plmn = (struct osmo_plmn_id){
 		.mcc = 1,
 		.mnc = 1,
diff --git a/src/osmo-hnodeb/hnbap.c b/src/osmo-hnodeb/hnbap.c
index 167ec50..bcddfb3 100644
--- a/src/osmo-hnodeb/hnbap.c
+++ b/src/osmo-hnodeb/hnbap.c
@@ -157,7 +157,6 @@
 	uint8_t rac;
 	uint32_t cid;
 	uint8_t plmn[3];
-	char identity[50] = "ATestHNB@";
 
 	HNBAP_HNBRegisterRequestIEs_t request;
 	memset(&request, 0, sizeof(request));
@@ -167,8 +166,8 @@
 	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);
+	request.hnB_Identity.hNB_Identity_Info.buf = (uint8_t*) hnb->identity;
+	request.hnB_Identity.hNB_Identity_Info.size = strlen(hnb->identity);
 
 	osmo_plmn_to_bcd(plmn, &hnb->plmn);
 	request.plmNidentity.buf = plmn;
diff --git a/src/osmo-hnodeb/vty.c b/src/osmo-hnodeb/vty.c
index 1adc7ba..714e00d 100644
--- a/src/osmo-hnodeb/vty.c
+++ b/src/osmo-hnodeb/vty.c
@@ -83,6 +83,17 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN_USRATTR(cfg_hnodeb_identity,
+	      cfg_hnodeb_identity_cmd,
+	      0,
+	      "identity TEXT",
+	      "Set the HNB-identity of this HnodeB\n" "HNB-Identity\n")
+{
+	struct hnb *hnb = (struct hnb *)vty->index;
+	osmo_talloc_replace_string(g_hnb, &hnb->identity, argv[0]);
+	return CMD_SUCCESS;
+}
+
 DEFUN_USRATTR(cfg_hnodeb_ncc,
 	      cfg_hnodeb_ncc_cmd,
 	      0,
@@ -239,6 +250,7 @@
 static int config_write_hnodeb(struct vty *vty)
 {
 	vty_out(vty, "hnodeb%s", VTY_NEWLINE);
+	vty_out(vty, " identity %s%s", g_hnb->identity, VTY_NEWLINE);
 	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);
@@ -361,6 +373,7 @@
 {
 	install_element(CONFIG_NODE, &cfg_hnodeb_cmd);
 	install_node(&hnodeb_node, config_write_hnodeb);
+	install_element(HNODEB_NODE, &cfg_hnodeb_identity_cmd);
 	install_element(HNODEB_NODE, &cfg_hnodeb_ncc_cmd);
 	install_element(HNODEB_NODE, &cfg_hnodeb_mnc_cmd);
 	install_element(HNODEB_NODE, &cfg_hnodeb_ci_cmd);

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

Gerrit-Project: osmo-hnodeb
Gerrit-Branch: master
Gerrit-Change-Id: Ida47bbb85b5438a2ec9805005bc2ab834c79b765
Gerrit-Change-Number: 26022
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/95be5604/attachment.htm>


More information about the gerrit-log mailing list