Change in osmo-iuh[master]: Add vty disconnect to disconnect a single HNB

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

lynxis lazus gerrit-no-reply at lists.osmocom.org
Sun Jan 12 05:25:49 UTC 2020


lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-iuh/+/16810 )


Change subject: Add vty disconnect to disconnect a single HNB
......................................................................

Add vty disconnect to disconnect a single HNB

Allow the operator to disconnect a specific HNB from the gateway.

Change-Id: Ia0b3d6e15202fdbc3a56bd4fce9c42209bb0cff1
---
M include/osmocom/iuh/hnbgw.h
M include/osmocom/iuh/hnbgw_hnbap.h
M src/hnbgw.c
M src/hnbgw_hnbap.c
M src/hnbgw_vty.c
5 files changed, 69 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/10/16810/1

diff --git a/include/osmocom/iuh/hnbgw.h b/include/osmocom/iuh/hnbgw.h
index 4848c2f..807f11a 100644
--- a/include/osmocom/iuh/hnbgw.h
+++ b/include/osmocom/iuh/hnbgw.h
@@ -164,5 +164,8 @@
 struct hnb_context *hnb_context_alloc(struct hnb_gw *gw, struct osmo_stream_srv_link *link, int new_fd);
 void hnb_context_release(struct hnb_context *ctx);
 
+/*! Send a HNB disconnect to the hnb and free all resources */
+void hnb_context_disconnect(struct hnb_context *ctx);
+
 void hnbgw_vty_init(struct hnb_gw *gw, void *tall_ctx);
 int hnbgw_vty_go_parent(struct vty *vty);
diff --git a/include/osmocom/iuh/hnbgw_hnbap.h b/include/osmocom/iuh/hnbgw_hnbap.h
index cca3550..d6bccc4 100644
--- a/include/osmocom/iuh/hnbgw_hnbap.h
+++ b/include/osmocom/iuh/hnbgw_hnbap.h
@@ -2,5 +2,6 @@
 
 #include <osmocom/iuh/hnbgw.h>
 
+int hnbgw_tx_hnb_deregister(struct hnb_context *ctx);
 int hnbgw_hnbap_rx(struct hnb_context *hnb, struct msgb *msg);
 int hnbgw_hnbap_init(void);
diff --git a/src/hnbgw.c b/src/hnbgw.c
index 70ee25b..05a8617 100644
--- a/src/hnbgw.c
+++ b/src/hnbgw.c
@@ -297,6 +297,15 @@
 	return ctx;
 }
 
+void hnb_context_disconnect(struct hnb_context *ctx)
+{
+	hnbgw_tx_hnb_deregister(ctx);
+	/* TODO: use a timeout/callback on the hnb_context_relase if the HNB
+	 * does not react. If we release the context right a way,
+	 * the disconnect message is never sent.
+	hnb_context_release(ctx); */
+}
+
 void hnb_context_release(struct hnb_context *ctx)
 {
 	struct hnbgw_context_map *map, *map2;
diff --git a/src/hnbgw_hnbap.c b/src/hnbgw_hnbap.c
index 2d67219..910a151 100644
--- a/src/hnbgw_hnbap.c
+++ b/src/hnbgw_hnbap.c
@@ -124,6 +124,35 @@
 	return hnbgw_hnbap_tx(ctx, msg);
 }
 
+int hnbgw_tx_hnb_deregister(struct hnb_context *ctx)
+{
+	HNBDe_Register_t *deregister_out;
+	struct msgb *msg;
+	int rc;
+	HNBDe_RegisterIEs_t deregister = {};
+
+	deregister.cause.present = Cause_PR_radioNetwork;
+	deregister.cause.choice.misc= CauseMisc_o_and_m_intervention;
+
+	memset(&deregister_out, 0, sizeof(deregister_out));
+	rc = hnbap_encode_hnbde_registeries(&deregister_out,  &deregister);
+	if (rc < 0) {
+		LOGP(DHNBAP, LOGL_ERROR, "Failure to encode HNB-DE-REGISTER to %s: rc=%d\n",
+		     ctx->identity_info, rc);
+		return rc;
+	}
+
+	/* encode pdu */
+	msg = hnbap_generate_initiating_message(ProcedureCode_id_HNBDe_Register,
+					  Criticality_ignore,
+					  &asn_DEF_HNBDe_Register,
+					  &deregister_out);
+
+	ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_HNBDe_Register, &deregister_out);
+
+	return hnbgw_hnbap_tx(ctx, msg);
+}
+
 
 static int hnbgw_tx_ue_register_acc(struct ue_context *ue)
 {
diff --git a/src/hnbgw_vty.c b/src/hnbgw_vty.c
index 84a5f01..60bcf90 100644
--- a/src/hnbgw_vty.c
+++ b/src/hnbgw_vty.c
@@ -31,6 +31,8 @@
 #include <osmocom/sigtran/sccp_helpers.h>
 #include <osmocom/netif/stream.h>
 
+#include <osmocom/iuh/hnbgw.h>
+
 static void *tall_hnb_ctx = NULL;
 static struct hnb_gw *g_hnb_gw = NULL;
 
@@ -260,6 +262,29 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(hnb_disconnect_by_name, hnb_disconnect_by_name_cmd, "hnb by-name NAME disconnect",
+      "HNB Specific Commands\n"
+      "Disconnect the HNB. The HNB can reconnect afterwards.")
+{
+	struct hnb_context *hnb;
+	const char *identity_info = argv[0];
+
+	if (llist_empty(&g_hnb_gw->hnb_list)) {
+		vty_out(vty, "No HNB connected%s", VTY_NEWLINE);
+		return CMD_ERR_NO_MATCH;
+	}
+
+	hnb = hnb_context_by_identity_info(g_hnb_gw, identity_info);
+	if (hnb == NULL) {
+		vty_out(vty, "No HNB found with identity '%s'%s", identity_info, VTY_NEWLINE);
+		return CMD_ERR_NO_MATCH;
+	}
+
+	hnb_context_disconnect(hnb);
+
+	return CMD_SUCCESS;
+}
+
 DEFUN(cfg_hnbgw_rnc_id, cfg_hnbgw_rnc_id_cmd,
       "rnc-id <0-65535>",
       "Configure the HNBGW's RNC Id, the common RNC Id used for all connected hNodeB. It is sent to"
@@ -401,4 +426,6 @@
 	install_element_ve(&show_one_hnb_cmd);
 	install_element_ve(&show_ue_cmd);
 	install_element_ve(&show_talloc_cmd);
+
+	install_element(ENABLE_NODE, &hnb_disconnect_by_name_cmd);
 }

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

Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Change-Id: Ia0b3d6e15202fdbc3a56bd4fce9c42209bb0cff1
Gerrit-Change-Number: 16810
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200112/38aa64e0/attachment.htm>


More information about the gerrit-log mailing list