aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-02-15 03:59:17 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2018-02-19 17:11:47 +0100
commit444f9e2bb0a99e9f97add9fd12e2361e2bd5de49 (patch)
treec9f0e221634c6c9466300a8e4490528bea88d0b6 /src
parent909e972787d178b141a202ec7f7dacd8ca06068f (diff)
HO: vty: rename ho decision 1 vty to 'handover1' with 'handover' alias
Handover decision 2 arguments are now configured by 'handover2 foo'. To match that scheme, rename the previously 'handover foo' args for handover decision 1 to 'handover1 foo'. For backwards compatibility, still provide aliases of the original VTY commands. Writing back the config will result in 'handover1' though. Change-Id: I7305ae7c04cc70082cd80d42b2ba32ffa399f51a
Diffstat (limited to 'src')
-rw-r--r--src/libbsc/handover_cfg.c4
-rw-r--r--src/libbsc/handover_vty.c34
2 files changed, 29 insertions, 9 deletions
diff --git a/src/libbsc/handover_cfg.c b/src/libbsc/handover_cfg.c
index 8c208f669..5b02e7698 100644
--- a/src/libbsc/handover_cfg.c
+++ b/src/libbsc/handover_cfg.c
@@ -30,7 +30,7 @@
struct handover_cfg {
struct handover_cfg *higher_level_cfg;
-#define HO_CFG_ONE_MEMBER(TYPE, NAME, DEFAULT_VAL, VTY1, VTY2, VTY3, VTY4, VTY5, VTY6) \
+#define HO_CFG_ONE_MEMBER(TYPE, NAME, DEFAULT_VAL, VTY0, VTY1, VTY2, VTY3, VTY4, VTY5, VTY6) \
TYPE NAME; \
bool has_##NAME;
@@ -46,7 +46,7 @@ struct handover_cfg *ho_cfg_init(void *ctx, struct handover_cfg *higher_level_cf
return ho;
}
-#define HO_CFG_ONE_MEMBER(TYPE, NAME, DEFAULT_VAL, VTY1, VTY2, VTY_ARG_EVAL, VTY4, VTY5, VTY6) \
+#define HO_CFG_ONE_MEMBER(TYPE, NAME, DEFAULT_VAL, VTY0, VTY1, VTY2, VTY_ARG_EVAL, VTY4, VTY5, VTY6) \
TYPE ho_get_##NAME(struct handover_cfg *ho) \
{ \
if (ho->has_##NAME) \
diff --git a/src/libbsc/handover_vty.c b/src/libbsc/handover_vty.c
index 9ec9bc79a..4bd8e5fe2 100644
--- a/src/libbsc/handover_vty.c
+++ b/src/libbsc/handover_vty.c
@@ -40,11 +40,11 @@ static struct handover_cfg *ho_cfg_from_vty(struct vty *vty)
#define HO_CFG_ONE_MEMBER(TYPE, NAME, DEFAULT_VAL, \
- VTY_CMD, VTY_CMD_ARG, VTY_ARG_EVAL, \
+ VTY_CMD_PREFIX, VTY_CMD, VTY_CMD_ARG, VTY_ARG_EVAL, \
VTY_WRITE_FMT, VTY_WRITE_CONV, \
VTY_DOC) \
DEFUN(cfg_ho_##NAME, cfg_ho_##NAME##_cmd, \
- VTY_CMD " (" VTY_CMD_ARG "|default)", \
+ VTY_CMD_PREFIX VTY_CMD " (" VTY_CMD_ARG "|default)", \
VTY_DOC \
"Use default (" #DEFAULT_VAL "), remove explicit setting on this node\n") \
{ \
@@ -57,7 +57,7 @@ DEFUN(cfg_ho_##NAME, cfg_ho_##NAME##_cmd, \
msg = "setting removed, now is"; \
} else \
msg = "already was unset, still is"; \
- vty_out(vty, "%% '" VTY_CMD "' %s " VTY_WRITE_FMT "%s%s", \
+ vty_out(vty, "%% '" VTY_CMD_PREFIX VTY_CMD "' %s " VTY_WRITE_FMT "%s%s", \
msg, VTY_WRITE_CONV( ho_get_##NAME(ho) ), \
ho_isset_on_parent_##NAME(ho)? " (set on higher level node)" : "", \
VTY_NEWLINE); \
@@ -71,6 +71,19 @@ HO_CFG_ALL_MEMBERS
#undef HO_CFG_ONE_MEMBER
+/* Aliases of 'handover' for 'handover1' for backwards compat */
+#define HO_CFG_ONE_MEMBER(TYPE, NAME, DEFAULT_VAL, \
+ VTY_CMD_PREFIX, VTY_CMD, VTY_CMD_ARG, VTY_ARG_EVAL, \
+ VTY_WRITE_FMT, VTY_WRITE_CONV, \
+ VTY_DOC) \
+ALIAS(cfg_ho_##NAME, cfg_ho_##NAME##_cmd_alias, \
+ "handover " VTY_CMD " (" VTY_CMD_ARG "|default)", \
+ VTY_DOC \
+ "Use default (" #DEFAULT_VAL "), remove explicit setting on this node\n");
+
+HODEC1_CFG_ALL_MEMBERS
+#undef HO_CFG_ONE_MEMBER
+
static inline const int a2congestion_check_interval(const char *arg)
{
if (!strcmp(arg, "disabled"))
@@ -109,11 +122,11 @@ DEFUN(cfg_net_ho_congestion_check_interval, cfg_net_ho_congestion_check_interval
static void ho_vty_write(struct vty *vty, const char *indent, struct handover_cfg *ho)
{
#define HO_CFG_ONE_MEMBER(TYPE, NAME, DEFAULT_VAL, \
- VTY_CMD, VTY_CMD_ARG, VTY_ARG_EVAL, \
+ VTY_CMD_PREFIX, VTY_CMD, VTY_CMD_ARG, VTY_ARG_EVAL, \
VTY_WRITE_FMT, VTY_WRITE_CONV, \
VTY_DOC) \
if (ho_isset_##NAME(ho)) \
- vty_out(vty, "%s" VTY_CMD " " VTY_WRITE_FMT "%s", indent, \
+ vty_out(vty, "%s" VTY_CMD_PREFIX VTY_CMD " " VTY_WRITE_FMT "%s", indent, \
VTY_WRITE_CONV( ho_get_##NAME(ho) ), VTY_NEWLINE);
HO_CFG_ALL_MEMBERS
@@ -130,18 +143,25 @@ void ho_vty_write_net(struct vty *vty, struct gsm_network *net)
ho_vty_write(vty, " ", net->ho);
if (net->hodec2.congestion_check_interval_s != HO_CFG_CONGESTION_CHECK_DEFAULT)
- vty_out(vty, " handover congestion-check %s%s",
+ vty_out(vty, " handover2 congestion-check %s%s",
congestion_check_interval2a(net->hodec2.congestion_check_interval_s),
VTY_NEWLINE);
}
static void ho_vty_init_cmds(int parent_node)
{
-#define HO_CFG_ONE_MEMBER(TYPE, NAME, DEFAULT_VAL, VTY1, VTY2, VTY3, VTY4, VTY5, VTY6) \
+#define HO_CFG_ONE_MEMBER(TYPE, NAME, DEFAULT_VAL, VTY0, VTY1, VTY2, VTY3, VTY4, VTY5, VTY6) \
install_element(parent_node, &cfg_ho_##NAME##_cmd);
HO_CFG_ALL_MEMBERS
#undef HO_CFG_ONE_MEMBER
+
+ /* Aliases of 'handover' for 'handover1' for backwards compat */
+#define HO_CFG_ONE_MEMBER(TYPE, NAME, DEFAULT_VAL, VTY0, VTY1, VTY2, VTY3, VTY4, VTY5, VTY6) \
+ install_element(parent_node, &cfg_ho_##NAME##_cmd_alias);
+
+HODEC1_CFG_ALL_MEMBERS
+#undef HO_CFG_ONE_MEMBER
}
void ho_vty_init()