<p>Harald Welte <strong>merged</strong> this change.</p><p><a href="https://gerrit.osmocom.org/11506">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">add a VTY command which shows a specific HNB<br><br>Add the 'show hnb NAME' VTY command which displays just<br>one specific HNB, addressed by its identity string.<br>This augments the functionality provided by 'show hnb all'.<br><br>Change-Id: Iab12aa4ab090b72c472358b84daf6919b30747f6<br>Related: OS#2774<br>---<br>M include/osmocom/iuh/hnbgw.h<br>M src/hnbgw.c<br>M src/hnbgw_vty.c<br>3 files changed, 37 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmocom/iuh/hnbgw.h b/include/osmocom/iuh/hnbgw.h</span><br><span>index db49dc1..4848c2f 100644</span><br><span>--- a/include/osmocom/iuh/hnbgw.h</span><br><span>+++ b/include/osmocom/iuh/hnbgw.h</span><br><span>@@ -151,6 +151,7 @@</span><br><span> extern void *talloc_asn1_ctx;</span><br><span> </span><br><span> struct hnb_context *hnb_context_by_id(struct hnb_gw *gw, uint32_t cid);</span><br><span style="color: hsl(120, 100%, 40%);">+struct hnb_context *hnb_context_by_identity_info(struct hnb_gw *gw, const char *identity_info);</span><br><span> unsigned hnb_contexts(const struct hnb_gw *gw);</span><br><span> </span><br><span> struct ue_context *ue_context_by_id(struct hnb_gw *gw, uint32_t id);</span><br><span>diff --git a/src/hnbgw.c b/src/hnbgw.c</span><br><span>index cd6104b..e40996f 100644</span><br><span>--- a/src/hnbgw.c</span><br><span>+++ b/src/hnbgw.c</span><br><span>@@ -105,6 +105,19 @@</span><br><span>  return NULL;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+struct hnb_context *hnb_context_by_identity_info(struct hnb_gw *gw, const char *identity_info)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+      struct hnb_context *hnb;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    llist_for_each_entry(hnb, &gw->hnb_list, list) {</span><br><span style="color: hsl(120, 100%, 40%);">+               if (strcmp(identity_info, hnb->identity_info) == 0)</span><br><span style="color: hsl(120, 100%, 40%);">+                        return hnb;</span><br><span style="color: hsl(120, 100%, 40%);">+   }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> unsigned hnb_contexts(const struct hnb_gw *gw)</span><br><span> {</span><br><span>   unsigned num_ctx = 0;</span><br><span>diff --git a/src/hnbgw_vty.c b/src/hnbgw_vty.c</span><br><span>index 859cd31..15fdaf8 100644</span><br><span>--- a/src/hnbgw_vty.c</span><br><span>+++ b/src/hnbgw_vty.c</span><br><span>@@ -200,7 +200,7 @@</span><br><span>         vty_out(vty, "UE IMSI \"%s\" context ID %u%s", ue->imsi, ue->context_id, VTY_NEWLINE);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-DEFUN(show_hnb, show_hnb_cmd, "show hnb all", SHOW_STR "Display information about a HNB")</span><br><span style="color: hsl(120, 100%, 40%);">+DEFUN(show_hnb, show_hnb_cmd, "show hnb all", SHOW_STR "Display information about all HNB")</span><br><span> {</span><br><span>         struct hnb_context *hnb;</span><br><span>     unsigned int count = 0;</span><br><span>@@ -220,6 +220,27 @@</span><br><span>       return CMD_SUCCESS;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+DEFUN(show_one_hnb, show_one_hnb_cmd, "show hnb NAME ", SHOW_STR "Display information about a HNB")</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+      struct hnb_context *hnb;</span><br><span style="color: hsl(120, 100%, 40%);">+      int found = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+        const char *identity_info = argv[0];</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        if (llist_empty(&g_hnb_gw->hnb_list)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                vty_out(vty, "No HNB connected%s", VTY_NEWLINE);</span><br><span style="color: hsl(120, 100%, 40%);">+            return CMD_SUCCESS;</span><br><span style="color: hsl(120, 100%, 40%);">+   }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   hnb = hnb_context_by_identity_info(&g_hnb_gw, identity_info);</span><br><span style="color: hsl(120, 100%, 40%);">+     if (hnb == NULL) {</span><br><span style="color: hsl(120, 100%, 40%);">+            vty_out(vty, "No HNB found with identity '%s'%s", identity_info, VTY_NEWLINE);</span><br><span style="color: hsl(120, 100%, 40%);">+              return CMD_SUCCESS;</span><br><span style="color: hsl(120, 100%, 40%);">+   }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   vty_dump_hnb_info(vty, hnb);</span><br><span style="color: hsl(120, 100%, 40%);">+  return CMD_SUCCESS;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> DEFUN(show_ue, show_ue_cmd, "show ue all", SHOW_STR "Display information about a UE")</span><br><span> {</span><br><span>   struct ue_context *ue;</span><br><span>@@ -377,6 +398,7 @@</span><br><span> </span><br><span>     install_element_ve(&show_cnlink_cmd);</span><br><span>    install_element_ve(&show_hnb_cmd);</span><br><span style="color: hsl(120, 100%, 40%);">+        install_element_ve(&show_one_hnb_cmd);</span><br><span>   install_element_ve(&show_ue_cmd);</span><br><span>        install_element_ve(&show_talloc_cmd);</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/11506">change 11506</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/11506"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-iuh </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Iab12aa4ab090b72c472358b84daf6919b30747f6 </div>
<div style="display:none"> Gerrit-Change-Number: 11506 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Stefan Sperling <ssperling@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder (1000002) </div>
<div style="display:none"> Gerrit-Reviewer: Stefan Sperling <ssperling@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: lynxis lazus <lynxis@fe80.eu> </div>