diff --git a/include/osmocom/iuh/hnbgw.h b/include/osmocom/iuh/hnbgw.h index 92d76746..850c4d9c 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 2eecbeab..16a2e431 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 ff75aeae..a458c76b 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;