Change in osmo-iuh[master]: add a VTY command which shows a specific HNB

2018-10-31 Thread Harald Welte
Harald Welte has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/11506 )

Change subject: add a VTY command which shows a specific HNB
..

add a VTY command which shows a specific HNB

Add the 'show hnb NAME' VTY command which displays just
one specific HNB, addressed by its identity string.
This augments the functionality provided by 'show hnb all'.

Change-Id: Iab12aa4ab090b72c472358b84daf6919b30747f6
Related: OS#2774
---
M include/osmocom/iuh/hnbgw.h
M src/hnbgw.c
M src/hnbgw_vty.c
3 files changed, 37 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/include/osmocom/iuh/hnbgw.h b/include/osmocom/iuh/hnbgw.h
index db49dc1..4848c2f 100644
--- a/include/osmocom/iuh/hnbgw.h
+++ b/include/osmocom/iuh/hnbgw.h
@@ -151,6 +151,7 @@
 extern void *talloc_asn1_ctx;

 struct hnb_context *hnb_context_by_id(struct hnb_gw *gw, uint32_t cid);
+struct hnb_context *hnb_context_by_identity_info(struct hnb_gw *gw, const char 
*identity_info);
 unsigned hnb_contexts(const struct hnb_gw *gw);

 struct ue_context *ue_context_by_id(struct hnb_gw *gw, uint32_t id);
diff --git a/src/hnbgw.c b/src/hnbgw.c
index cd6104b..e40996f 100644
--- a/src/hnbgw.c
+++ b/src/hnbgw.c
@@ -105,6 +105,19 @@
return NULL;
 }

+struct hnb_context *hnb_context_by_identity_info(struct hnb_gw *gw, const char 
*identity_info)
+{
+   struct hnb_context *hnb;
+
+   llist_for_each_entry(hnb, >hnb_list, list) {
+   if (strcmp(identity_info, hnb->identity_info) == 0)
+   return hnb;
+   }
+
+   return NULL;
+}
+
+
 unsigned hnb_contexts(const struct hnb_gw *gw)
 {
unsigned num_ctx = 0;
diff --git a/src/hnbgw_vty.c b/src/hnbgw_vty.c
index 859cd31..15fdaf8 100644
--- a/src/hnbgw_vty.c
+++ b/src/hnbgw_vty.c
@@ -200,7 +200,7 @@
vty_out(vty, "UE IMSI \"%s\" context ID %u%s", ue->imsi, 
ue->context_id, VTY_NEWLINE);
 }

-DEFUN(show_hnb, show_hnb_cmd, "show hnb all", SHOW_STR "Display information 
about a HNB")
+DEFUN(show_hnb, show_hnb_cmd, "show hnb all", SHOW_STR "Display information 
about all HNB")
 {
struct hnb_context *hnb;
unsigned int count = 0;
@@ -220,6 +220,27 @@
return CMD_SUCCESS;
 }

+DEFUN(show_one_hnb, show_one_hnb_cmd, "show hnb NAME ", SHOW_STR "Display 
information about a HNB")
+{
+   struct hnb_context *hnb;
+   int found = 0;
+   const char *identity_info = argv[0];
+
+   if (llist_empty(_hnb_gw->hnb_list)) {
+   vty_out(vty, "No HNB connected%s", VTY_NEWLINE);
+   return CMD_SUCCESS;
+   }
+
+   hnb = hnb_context_by_identity_info(_hnb_gw, identity_info);
+   if (hnb == NULL) {
+   vty_out(vty, "No HNB found with identity '%s'%s", 
identity_info, VTY_NEWLINE);
+   return CMD_SUCCESS;
+   }
+
+   vty_dump_hnb_info(vty, hnb);
+   return CMD_SUCCESS;
+}
+
 DEFUN(show_ue, show_ue_cmd, "show ue all", SHOW_STR "Display information about 
a UE")
 {
struct ue_context *ue;
@@ -377,6 +398,7 @@

install_element_ve(_cnlink_cmd);
install_element_ve(_hnb_cmd);
+   install_element_ve(_one_hnb_cmd);
install_element_ve(_ue_cmd);
install_element_ve(_talloc_cmd);
 }

--
To view, visit https://gerrit.osmocom.org/11506
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Iab12aa4ab090b72c472358b84daf6919b30747f6
Gerrit-Change-Number: 11506
Gerrit-PatchSet: 2
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Reviewer: lynxis lazus 


Change in osmo-iuh[master]: add a VTY command which shows a specific HNB

2018-10-31 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/11506 )

Change subject: add a VTY command which shows a specific HNB
..


Patch Set 2: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/11506
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iab12aa4ab090b72c472358b84daf6919b30747f6
Gerrit-Change-Number: 11506
Gerrit-PatchSet: 2
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Reviewer: lynxis lazus 
Gerrit-Comment-Date: Wed, 31 Oct 2018 22:13:06 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-iuh[master]: add a VTY command which shows a specific HNB

2018-10-31 Thread Stefan Sperling
Stefan Sperling has posted comments on this change. ( 
https://gerrit.osmocom.org/11506 )

Change subject: add a VTY command which shows a specific HNB
..


Patch Set 2:

(1 comment)

https://gerrit.osmocom.org/#/c/11506/1/src/hnbgw_vty.c
File src/hnbgw_vty.c:

https://gerrit.osmocom.org/#/c/11506/1/src/hnbgw_vty.c@234
PS1, Line 234:  hnb = hnb_context_by_identity_info(_hnb_gw, identity_info);
> I suggest to add a hnb_context_by_identity_info() function, similar to 
> hnb_context_by_id() which we  […]
Agreed. See patch set 2.



--
To view, visit https://gerrit.osmocom.org/11506
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iab12aa4ab090b72c472358b84daf6919b30747f6
Gerrit-Change-Number: 11506
Gerrit-PatchSet: 2
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Reviewer: lynxis lazus 
Gerrit-CC: Harald Welte 
Gerrit-Comment-Date: Wed, 31 Oct 2018 11:20:15 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-iuh[master]: add a VTY command which shows a specific HNB

2018-10-31 Thread Stefan Sperling
Hello lynxis lazus, Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/11506

to look at the new patch set (#2).

Change subject: add a VTY command which shows a specific HNB
..

add a VTY command which shows a specific HNB

Add the 'show hnb NAME' VTY command which displays just
one specific HNB, addressed by its identity string.
This augments the functionality provided by 'show hnb all'.

Change-Id: Iab12aa4ab090b72c472358b84daf6919b30747f6
Related: OS#2774
---
M include/osmocom/iuh/hnbgw.h
M src/hnbgw.c
M src/hnbgw_vty.c
3 files changed, 37 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/06/11506/2
--
To view, visit https://gerrit.osmocom.org/11506
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Iab12aa4ab090b72c472358b84daf6919b30747f6
Gerrit-Change-Number: 11506
Gerrit-PatchSet: 2
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Reviewer: lynxis lazus 
Gerrit-CC: Harald Welte 


Change in osmo-iuh[master]: add a VTY command which shows a specific HNB

2018-10-29 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/11506 )

Change subject: add a VTY command which shows a specific HNB
..


Patch Set 1:

(1 comment)

https://gerrit.osmocom.org/#/c/11506/1/src/hnbgw_vty.c
File src/hnbgw_vty.c:

https://gerrit.osmocom.org/#/c/11506/1/src/hnbgw_vty.c@234
PS1, Line 234:  llist_for_each_entry(hnb, _hnb_gw->hnb_list, list) {
I suggest to add a hnb_context_by_identity_info() function, similar to 
hnb_context_by_id() which we alraeady have, and then simply use that and dump 
it.  Or is it a common/expected case that there would be multiple hnb with the 
same identity? My gut feeling says that's somehow wrong...



--
To view, visit https://gerrit.osmocom.org/11506
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Iab12aa4ab090b72c472358b84daf6919b30747f6
Gerrit-Change-Number: 11506
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Reviewer: Stefan Sperling 
Gerrit-Reviewer: lynxis lazus 
Gerrit-CC: Harald Welte 
Gerrit-Comment-Date: Mon, 29 Oct 2018 23:16:47 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: No


Change in osmo-iuh[master]: add a VTY command which shows a specific HNB

2018-10-29 Thread Stefan Sperling
Stefan Sperling has uploaded this change for review. ( 
https://gerrit.osmocom.org/11506


Change subject: add a VTY command which shows a specific HNB
..

add a VTY command which shows a specific HNB

Add the 'show hnb NAME' VTY command which displays just
one specific HNB, addressed by its identity string.
This augments the functionality provided by 'show hnb all'.

Change-Id: Iab12aa4ab090b72c472358b84daf6919b30747f6
Related: OS#2774
---
M src/hnbgw_vty.c
1 file changed, 26 insertions(+), 1 deletion(-)



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

diff --git a/src/hnbgw_vty.c b/src/hnbgw_vty.c
index 859cd31..1561aed 100644
--- a/src/hnbgw_vty.c
+++ b/src/hnbgw_vty.c
@@ -200,7 +200,7 @@
vty_out(vty, "UE IMSI \"%s\" context ID %u%s", ue->imsi, 
ue->context_id, VTY_NEWLINE);
 }

-DEFUN(show_hnb, show_hnb_cmd, "show hnb all", SHOW_STR "Display information 
about a HNB")
+DEFUN(show_hnb, show_hnb_cmd, "show hnb all", SHOW_STR "Display information 
about all HNB")
 {
struct hnb_context *hnb;
unsigned int count = 0;
@@ -220,6 +220,30 @@
return CMD_SUCCESS;
 }

+DEFUN(show_one_hnb, show_one_hnb_cmd, "show hnb NAME ", SHOW_STR "Display 
information about a HNB")
+{
+   struct hnb_context *hnb;
+   int found = 0;
+   const char *name = argv[0];
+
+   if (llist_empty(_hnb_gw->hnb_list)) {
+   vty_out(vty, "No HNB connected%s", VTY_NEWLINE);
+   return CMD_SUCCESS;
+   }
+
+   llist_for_each_entry(hnb, _hnb_gw->hnb_list, list) {
+   if (strcmp(name, hnb->identity_info) != 0)
+   continue;
+   vty_dump_hnb_info(vty, hnb);
+   found = 1;
+   break;
+   }
+
+   if (!found)
+   vty_out(vty, "No HNB found with identity '%s'%s", name, 
VTY_NEWLINE);
+   return CMD_SUCCESS;
+}
+
 DEFUN(show_ue, show_ue_cmd, "show ue all", SHOW_STR "Display information about 
a UE")
 {
struct ue_context *ue;
@@ -377,6 +401,7 @@

install_element_ve(_cnlink_cmd);
install_element_ve(_hnb_cmd);
+   install_element_ve(_one_hnb_cmd);
install_element_ve(_ue_cmd);
install_element_ve(_talloc_cmd);
 }

--
To view, visit https://gerrit.osmocom.org/11506
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab12aa4ab090b72c472358b84daf6919b30747f6
Gerrit-Change-Number: 11506
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling