diff options
Diffstat (limited to 'ospfd/ospf_vty.c')
| -rw-r--r-- | ospfd/ospf_vty.c | 150 |
1 files changed, 70 insertions, 80 deletions
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index bb908ead2f..99c8368a5f 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -988,15 +988,15 @@ ospf_vl_set (struct ospf *ospf, struct ospf_vl_config_data *vl_config) "Use null authentication\n" \ "Use message-digest authentication\n" -#define VLINK_HELPSTR_TIME_PARAM_NOSECS \ +#define VLINK_HELPSTR_TIME_PARAM \ "Time between HELLO packets\n" \ + "Seconds\n" \ "Time between retransmitting lost link state advertisements\n" \ + "Seconds\n" \ "Link state transmit delay\n" \ - "Interval time after which a neighbor is declared down\n" - -#define VLINK_HELPSTR_TIME_PARAM \ - VLINK_HELPSTR_TIME_PARAM_NOSECS \ - "Seconds\n" + "Seconds\n" \ + "Interval time after which a neighbor is declared down\n" \ + "Seconds\n" \ #define VLINK_HELPSTR_AUTH_SIMPLE \ "Authentication password (key)\n" \ @@ -1129,59 +1129,6 @@ DEFUN (ospf_area_vlink, } -DEFUN (ospf_area_vlink_intervals, - ospf_area_vlink_intervals_cmd, - "area <A.B.C.D|(0-4294967295)> virtual-link A.B.C.D" - "<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)" - "[<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)" - "[<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)" - "[<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)" - "]]]", - VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_TIME_PARAM - VLINK_HELPSTR_TIME_PARAM - VLINK_HELPSTR_TIME_PARAM - VLINK_HELPSTR_TIME_PARAM) -{ - VTY_DECLVAR_CONTEXT(ospf, ospf); - struct ospf_vl_config_data vl_config; - int ret = 0; - - ospf_vl_config_data_init(&vl_config, vty); - - char *area_id = argv[1]->arg; - char *router_id = argv[3]->arg; - - ret = str2area_id (area_id, &vl_config.area_id, &vl_config.area_id_fmt); - if (ret < 0) - { - vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); - return CMD_WARNING; - } - - ret = inet_aton (router_id, &vl_config.vl_peer); - if (! ret) - { - vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", VTY_NEWLINE); - return CMD_WARNING; - } - for (unsigned int i = 0; i < 4; i++) - { - int idx = 0; - if (argv_find (argv, argc, "hello-interval", &idx)) - vl_config.hello_interval = strtol(argv[idx+1]->arg, NULL, 10); - else if (argv_find (argv, argc, "retransmit-interval", &idx)) - vl_config.retransmit_interval = strtol(argv[idx+1]->arg, NULL, 10); - else if (argv_find (argv, argc, "transmit-delay", &idx)) - vl_config.transmit_delay = strtol(argv[idx+1]->arg, NULL, 10); - else if (argv_find (argv, argc, "dead-interval", &idx)) - vl_config.dead_interval = strtol(argv[idx+1]->arg, NULL, 10); - } - - /* Action configuration */ - return ospf_vl_set (ospf, &vl_config); -} - DEFUN (no_ospf_area_vlink, no_ospf_area_vlink_cmd, "no area <A.B.C.D|(0-4294967295)> virtual-link A.B.C.D [authentication] [<message-digest|null>] [<message-digest-key (1-255) md5 KEY|authentication-key AUTH_KEY>]", @@ -1292,19 +1239,56 @@ DEFUN (no_ospf_area_vlink, return ospf_vl_set (ospf, &vl_config); } +DEFUN (ospf_area_vlink_intervals, + ospf_area_vlink_intervals_cmd, + "area <A.B.C.D|(0-4294967295)> virtual-link A.B.C.D {hello-interval (1-65535)|retransmit-interval (1-65535)|transmit-delay (1-65535)|dead-interval (1-65535)}", + VLINK_HELPSTR_IPADDR + VLINK_HELPSTR_TIME_PARAM) +{ + VTY_DECLVAR_CONTEXT(ospf, ospf); + struct ospf_vl_config_data vl_config; + int ret = 0; + + ospf_vl_config_data_init(&vl_config, vty); + + char *area_id = argv[1]->arg; + char *router_id = argv[3]->arg; + + ret = str2area_id (area_id, &vl_config.area_id, &vl_config.area_id_fmt); + if (ret < 0) + { + vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); + return CMD_WARNING; + } + + ret = inet_aton (router_id, &vl_config.vl_peer); + if (! ret) + { + vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", VTY_NEWLINE); + return CMD_WARNING; + } + + for (int idx = 4; idx < argc; idx++) + { + if (strmatch (argv[idx]->text, "hello-interval")) + vl_config.hello_interval = strtol(argv[++idx]->arg, NULL, 10); + else if (strmatch (argv[idx]->text, "retransmit-interval")) + vl_config.retransmit_interval = strtol(argv[++idx]->arg, NULL, 10); + else if (strmatch (argv[idx]->text, "transmit-delay")) + vl_config.transmit_delay = strtol(argv[++idx]->arg, NULL, 10); + else if (strmatch (argv[idx]->text, "dead-interval")) + vl_config.dead_interval = strtol(argv[++idx]->arg, NULL, 10); + } + + /* Action configuration */ + return ospf_vl_set (ospf, &vl_config); +} + DEFUN (no_ospf_area_vlink_intervals, no_ospf_area_vlink_intervals_cmd, - "no area <A.B.C.D|(0-4294967295)> virtual-link A.B.C.D" - "<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)" - "[<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)" - "[<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)" - "[<hello-interval|retransmit-interval|transmit-delay|dead-interval> (1-65535)" - "]]]", + "no area <A.B.C.D|(0-4294967295)> virtual-link A.B.C.D {hello-interval (1-65535)|retransmit-interval (1-65535)|transmit-delay (1-65535)|dead-interval (1-65535)}", NO_STR VLINK_HELPSTR_IPADDR - VLINK_HELPSTR_TIME_PARAM - VLINK_HELPSTR_TIME_PARAM - VLINK_HELPSTR_TIME_PARAM VLINK_HELPSTR_TIME_PARAM) { VTY_DECLVAR_CONTEXT(ospf, ospf); @@ -1330,16 +1314,15 @@ DEFUN (no_ospf_area_vlink_intervals, return CMD_WARNING; } - for (unsigned int i = 0; i < 4; i++) + for (int idx = 5; idx < argc; idx++) { - int idx = 0; - if (argv_find (argv, argc, "hello-interval", &idx)) + if (strmatch (argv[idx]->text, "hello-interval")) vl_config.hello_interval = OSPF_HELLO_INTERVAL_DEFAULT; - else if (argv_find (argv, argc, "retransmit-interval", &idx)) + else if (strmatch (argv[idx]->text, "retransmit-interval")) vl_config.retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT; - else if (argv_find (argv, argc, "transmit-delay", &idx)) + else if (strmatch (argv[idx]->text, "transmit-delay")) vl_config.transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT; - else if (argv_find (argv, argc, "dead-interval", &idx)) + else if (strmatch (argv[idx]->text, "dead-interval")) vl_config.dead_interval = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT; } @@ -2222,7 +2205,7 @@ DEFUN (ospf_timers_min_ls_interval, int idx_number = 4; unsigned int interval; - if (argc != 1) + if (argc < 5) { vty_out (vty, "Insufficient arguments%s", VTY_NEWLINE); return CMD_WARNING; @@ -2264,7 +2247,7 @@ DEFUN (ospf_timers_min_ls_arrival, int idx_number = 3; unsigned int arrival; - if (argc != 1) + if (argc < 4) { vty_out (vty, "Insufficient arguments%s", VTY_NEWLINE); return CMD_WARNING; @@ -2309,7 +2292,7 @@ DEFUN (ospf_timers_throttle_spf, int idx_number_3 = 5; unsigned int delay, hold, max; - if (argc != 3) + if (argc < 6) { vty_out (vty, "Insufficient arguments%s", VTY_NEWLINE); return CMD_WARNING; @@ -2352,7 +2335,7 @@ DEFUN (ospf_timers_lsa, int idx_number = 3; unsigned int minarrival; - if (argc != 1) + if (argc < 4) { vty_out (vty, "Insufficient number of arguments%s", VTY_NEWLINE); return CMD_WARNING; @@ -3552,7 +3535,6 @@ show_ip_ospf_interface_common (struct vty *vty, struct ospf *ospf, int argc, if (use_json) { json = json_object_new_object(); - json_interface_sub = json_object_new_object(); } if (ospf->instance) @@ -3571,7 +3553,11 @@ show_ip_ospf_interface_common (struct vty *vty, struct ospf *ospf, int argc, { if (ospf_oi_count(ifp)) { + if (use_json) + json_interface_sub = json_object_new_object(); + show_ip_ospf_interface_sub (vty, ospf, ifp, json_interface_sub, use_json); + if (use_json) json_object_object_add (json, ifp->name, json_interface_sub); } @@ -3589,7 +3575,11 @@ show_ip_ospf_interface_common (struct vty *vty, struct ospf *ospf, int argc, } else { + if (use_json) + json_interface_sub = json_object_new_object(); + show_ip_ospf_interface_sub (vty, ospf, ifp, json_interface_sub, use_json); + if (use_json) json_object_object_add(json, ifp->name, json_interface_sub); } @@ -9099,7 +9089,7 @@ DEFUN (clear_ip_ospf_interface, } else /* Interface name is specified. */ { - if ((ifp = if_lookup_by_name (argv[idx_ifname]->text, VRF_DEFAULT)) == NULL) + if ((ifp = if_lookup_by_name (argv[idx_ifname]->arg, VRF_DEFAULT)) == NULL) vty_out (vty, "No such interface name%s", VTY_NEWLINE); else ospf_interface_clear(ifp); |
