aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-10-13 16:58:04 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2016-10-27 14:01:25 +0200
commitc510fc29fcf4999de8ba4992dd305968909ed69b (patch)
tree8771c8d20d5e3e28a7640cc673a23e9e944409b2
parent9153de649826d7e7e7382c21f5228a2779a76c82 (diff)
hnbgw: vty: set explicit go_parent_cb
A second level of depth will be added to the hnbgw node soon, which will need explicit go-parent logic. Change-Id: I8d1c18a396c215e8425ae49872b5c73316087d7d
-rw-r--r--include/osmocom/iuh/hnbgw.h1
-rw-r--r--src/hnbgw.c1
-rw-r--r--src/hnbgw_vty.c21
3 files changed, 23 insertions, 0 deletions
diff --git a/include/osmocom/iuh/hnbgw.h b/include/osmocom/iuh/hnbgw.h
index 92d7674..850c4d9 100644
--- a/include/osmocom/iuh/hnbgw.h
+++ b/include/osmocom/iuh/hnbgw.h
@@ -148,3 +148,4 @@ struct hnb_context *hnb_context_alloc(struct hnb_gw *gw, struct osmo_stream_srv_
void hnb_context_release(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/src/hnbgw.c b/src/hnbgw.c
index 2eecbea..16a2e43 100644
--- a/src/hnbgw.c
+++ b/src/hnbgw.c
@@ -346,6 +346,7 @@ static const struct log_info hnbgw_log_info = {
static struct vty_app_info vty_info = {
.name = "OsmoHNBGW",
.version = "0",
+ .go_parent_cb = hnbgw_vty_go_parent,
};
static struct {
diff --git a/src/hnbgw_vty.c b/src/hnbgw_vty.c
index ff75aea..a458c76 100644
--- a/src/hnbgw_vty.c
+++ b/src/hnbgw_vty.c
@@ -54,6 +54,27 @@ DEFUN(cfg_hnbgw_iuh, cfg_hnbgw_iuh_cmd,
return CMD_SUCCESS;
}
+int hnbgw_vty_go_parent(struct vty *vty)
+{
+ switch (vty->node) {
+ case IUH_NODE:
+ vty->node = HNBGW_NODE;
+ vty->index = NULL;
+ break;
+ default:
+ case HNBGW_NODE:
+ vty->node = CONFIG_NODE;
+ vty->index = NULL;
+ break;
+ case CONFIG_NODE:
+ vty->node = ENABLE_NODE;
+ vty->index = NULL;
+ break;
+ }
+
+ return vty->node;
+}
+
static void vty_dump_hnb_info(struct vty *vty, struct hnb_context *hnb)
{
struct hnbgw_context_map *map;