jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1 | /* |
| 2 | * IS-IS Rout(e)ing protocol - isisd.c |
| 3 | * |
| 4 | * Copyright (C) 2001,2002 Sampo Saaristo |
| 5 | * Tampere University of Technology |
| 6 | * Institute of Communications Engineering |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public Licenseas published by the Free |
| 10 | * Software Foundation; either version 2 of the License, or (at your option) |
| 11 | * any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful,but WITHOUT |
| 14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 16 | * more details. |
| 17 | |
| 18 | * You should have received a copy of the GNU General Public License along |
| 19 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 21 | */ |
| 22 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 23 | #include <zebra.h> |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 24 | |
| 25 | #include "thread.h" |
| 26 | #include "vty.h" |
| 27 | #include "command.h" |
| 28 | #include "log.h" |
| 29 | #include "memory.h" |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 30 | #include "time.h" |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 31 | #include "linklist.h" |
| 32 | #include "if.h" |
| 33 | #include "hash.h" |
| 34 | #include "stream.h" |
| 35 | #include "prefix.h" |
| 36 | #include "table.h" |
| 37 | |
| 38 | #include "isisd/dict.h" |
| 39 | #include "isisd/include-netbsd/iso.h" |
| 40 | #include "isisd/isis_constants.h" |
| 41 | #include "isisd/isis_common.h" |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 42 | #include "isisd/isis_flags.h" |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 43 | #include "isisd/isis_circuit.h" |
| 44 | #include "isisd/isis_csm.h" |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 45 | #include "isisd/isisd.h" |
| 46 | #include "isisd/isis_dynhn.h" |
| 47 | #include "isisd/isis_adjacency.h" |
| 48 | #include "isisd/isis_pdu.h" |
| 49 | #include "isisd/isis_misc.h" |
| 50 | #include "isisd/isis_constants.h" |
| 51 | #include "isisd/isis_tlv.h" |
| 52 | #include "isisd/isis_lsp.h" |
| 53 | #include "isisd/isis_spf.h" |
| 54 | #include "isisd/isis_route.h" |
| 55 | #include "isisd/isis_zebra.h" |
| 56 | #include "isisd/isis_events.h" |
| 57 | |
| 58 | #ifdef TOPOLOGY_GENERATE |
| 59 | #include "spgrid.h" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 60 | u_char DEFAULT_TOPOLOGY_BASEIS[6] = { 0xFE, 0xED, 0xFE, 0xED, 0x00, 0x00 }; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 61 | #endif /* TOPOLOGY_GENERATE */ |
| 62 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 63 | struct isis *isis = NULL; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 64 | |
Paul Jakma | 41b36e9 | 2006-12-08 01:09:50 +0000 | [diff] [blame] | 65 | /* |
| 66 | * Prototypes. |
| 67 | */ |
Paul Jakma | 41b36e9 | 2006-12-08 01:09:50 +0000 | [diff] [blame] | 68 | int isis_area_get(struct vty *, const char *); |
| 69 | int isis_area_destroy(struct vty *, const char *); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 70 | int area_net_title(struct vty *, const char *); |
| 71 | int area_clear_net_title(struct vty *, const char *); |
| 72 | int show_isis_interface_common(struct vty *, const char *ifname, char); |
| 73 | int show_isis_neighbor_common(struct vty *, const char *id, char); |
| 74 | int clear_isis_neighbor_common(struct vty *, const char *id); |
Paul Jakma | 41b36e9 | 2006-12-08 01:09:50 +0000 | [diff] [blame] | 75 | int isis_config_write(struct vty *); |
| 76 | |
| 77 | |
| 78 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 79 | void |
| 80 | isis_new (unsigned long process_id) |
| 81 | { |
hasso | aac372f | 2005-09-01 17:52:33 +0000 | [diff] [blame] | 82 | isis = XCALLOC (MTYPE_ISIS, sizeof (struct isis)); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 83 | /* |
| 84 | * Default values |
| 85 | */ |
| 86 | isis->max_area_addrs = 3; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 87 | isis->process_id = process_id; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 88 | isis->router_id = 0; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 89 | isis->area_list = list_new (); |
| 90 | isis->init_circ_list = list_new (); |
| 91 | isis->uptime = time (NULL); |
| 92 | isis->nexthops = list_new (); |
| 93 | #ifdef HAVE_IPV6 |
| 94 | isis->nexthops6 = list_new (); |
| 95 | #endif /* HAVE_IPV6 */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 96 | dyn_cache_init (); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 97 | /* |
| 98 | * uncomment the next line for full debugs |
| 99 | */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 100 | /* isis->debugs = 0xFFFF; */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 101 | } |
| 102 | |
| 103 | struct isis_area * |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 104 | isis_area_create (const char *area_tag) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 105 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 106 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 107 | |
hasso | aac372f | 2005-09-01 17:52:33 +0000 | [diff] [blame] | 108 | area = XCALLOC (MTYPE_ISIS_AREA, sizeof (struct isis_area)); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 109 | |
| 110 | /* |
| 111 | * The first instance is level-1-2 rest are level-1, unless otherwise |
| 112 | * configured |
| 113 | */ |
| 114 | if (listcount (isis->area_list) > 0) |
| 115 | area->is_type = IS_LEVEL_1; |
| 116 | else |
| 117 | area->is_type = IS_LEVEL_1_AND_2; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 118 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 119 | /* |
| 120 | * intialize the databases |
| 121 | */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 122 | if (area->is_type & IS_LEVEL_1) |
| 123 | { |
| 124 | area->lspdb[0] = lsp_db_init (); |
| 125 | area->route_table[0] = route_table_init (); |
| 126 | #ifdef HAVE_IPV6 |
| 127 | area->route_table6[0] = route_table_init (); |
| 128 | #endif /* HAVE_IPV6 */ |
| 129 | } |
| 130 | if (area->is_type & IS_LEVEL_2) |
| 131 | { |
| 132 | area->lspdb[1] = lsp_db_init (); |
| 133 | area->route_table[1] = route_table_init (); |
| 134 | #ifdef HAVE_IPV6 |
| 135 | area->route_table6[1] = route_table_init (); |
| 136 | #endif /* HAVE_IPV6 */ |
| 137 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 138 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 139 | spftree_area_init (area); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 140 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 141 | area->circuit_list = list_new (); |
| 142 | area->area_addrs = list_new (); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 143 | THREAD_TIMER_ON (master, area->t_tick, lsp_tick, area, 1); |
Paul Jakma | c7350c4 | 2008-01-29 19:29:44 +0000 | [diff] [blame] | 144 | flags_initialize (&area->flags); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 145 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 146 | /* |
| 147 | * Default values |
| 148 | */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 149 | area->max_lsp_lifetime[0] = DEFAULT_LSP_LIFETIME; /* 1200 */ |
| 150 | area->max_lsp_lifetime[1] = DEFAULT_LSP_LIFETIME; /* 1200 */ |
| 151 | area->lsp_refresh[0] = DEFAULT_MAX_LSP_GEN_INTERVAL; /* 900 */ |
| 152 | area->lsp_refresh[1] = DEFAULT_MAX_LSP_GEN_INTERVAL; /* 900 */ |
| 153 | area->lsp_gen_interval[0] = DEFAULT_MIN_LSP_GEN_INTERVAL; |
| 154 | area->lsp_gen_interval[1] = DEFAULT_MIN_LSP_GEN_INTERVAL; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 155 | area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL; |
| 156 | area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL; |
| 157 | area->dynhostname = 1; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 158 | area->oldmetric = 0; |
| 159 | area->newmetric = 1; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 160 | area->lsp_frag_threshold = 90; |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame] | 161 | area->lsp_mtu = DEFAULT_LSP_MTU; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 162 | #ifdef TOPOLOGY_GENERATE |
| 163 | memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN); |
| 164 | #endif /* TOPOLOGY_GENERATE */ |
| 165 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 166 | area->area_tag = strdup (area_tag); |
| 167 | listnode_add (isis->area_list, area); |
| 168 | area->isis = isis; |
| 169 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 170 | return area; |
| 171 | } |
| 172 | |
| 173 | struct isis_area * |
hasso | f90a5f6 | 2004-10-11 13:11:56 +0000 | [diff] [blame] | 174 | isis_area_lookup (const char *area_tag) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 175 | { |
| 176 | struct isis_area *area; |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 177 | struct listnode *node; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 178 | |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 179 | for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area)) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 180 | if ((area->area_tag == NULL && area_tag == NULL) || |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 181 | (area->area_tag && area_tag |
| 182 | && strcmp (area->area_tag, area_tag) == 0)) |
| 183 | return area; |
| 184 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 185 | return NULL; |
| 186 | } |
| 187 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 188 | int |
hasso | f90a5f6 | 2004-10-11 13:11:56 +0000 | [diff] [blame] | 189 | isis_area_get (struct vty *vty, const char *area_tag) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 190 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 191 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 192 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 193 | area = isis_area_lookup (area_tag); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 194 | |
| 195 | if (area) |
| 196 | { |
| 197 | vty->node = ISIS_NODE; |
| 198 | vty->index = area; |
| 199 | return CMD_SUCCESS; |
| 200 | } |
| 201 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 202 | area = isis_area_create (area_tag); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 203 | |
hasso | c89c05d | 2005-09-04 21:36:36 +0000 | [diff] [blame] | 204 | if (isis->debugs & DEBUG_EVENTS) |
| 205 | zlog_debug ("New IS-IS area instance %s", area->area_tag); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 206 | |
| 207 | vty->node = ISIS_NODE; |
| 208 | vty->index = area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 209 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 210 | return CMD_SUCCESS; |
| 211 | } |
| 212 | |
| 213 | int |
hasso | f90a5f6 | 2004-10-11 13:11:56 +0000 | [diff] [blame] | 214 | isis_area_destroy (struct vty *vty, const char *area_tag) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 215 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 216 | struct isis_area *area; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 217 | struct listnode *node, *nnode; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 218 | struct isis_circuit *circuit; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 219 | struct area_addr *addr; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 220 | |
| 221 | area = isis_area_lookup (area_tag); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 222 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 223 | if (area == NULL) |
| 224 | { |
| 225 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 226 | return CMD_ERR_NO_MATCH; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 227 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 228 | |
| 229 | if (area->circuit_list) |
| 230 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 231 | for (ALL_LIST_ELEMENTS (area->circuit_list, node, nnode, circuit)) |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 232 | { |
| 233 | circuit->ip_router = 0; |
| 234 | #ifdef HAVE_IPV6 |
| 235 | circuit->ipv6_router = 0; |
| 236 | #endif |
| 237 | isis_csm_state_change (ISIS_DISABLE, circuit, area); |
| 238 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 239 | list_delete (area->circuit_list); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 240 | area->circuit_list = NULL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 241 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 242 | |
| 243 | if (area->lspdb[0] != NULL) |
| 244 | { |
| 245 | lsp_db_destroy (area->lspdb[0]); |
| 246 | area->lspdb[0] = NULL; |
| 247 | } |
| 248 | if (area->lspdb[1] != NULL) |
| 249 | { |
| 250 | lsp_db_destroy (area->lspdb[1]); |
| 251 | area->lspdb[1] = NULL; |
| 252 | } |
| 253 | |
| 254 | spftree_area_del (area); |
| 255 | |
| 256 | /* invalidate and validate would delete all routes from zebra */ |
| 257 | isis_route_invalidate (area); |
| 258 | isis_route_validate (area); |
| 259 | |
| 260 | if (area->route_table[0]) |
| 261 | { |
| 262 | route_table_finish (area->route_table[0]); |
| 263 | area->route_table[0] = NULL; |
| 264 | } |
| 265 | if (area->route_table[1]) |
| 266 | { |
| 267 | route_table_finish (area->route_table[1]); |
| 268 | area->route_table[1] = NULL; |
| 269 | } |
| 270 | #ifdef HAVE_IPV6 |
| 271 | if (area->route_table6[0]) |
| 272 | { |
| 273 | route_table_finish (area->route_table6[0]); |
| 274 | area->route_table6[0] = NULL; |
| 275 | } |
| 276 | if (area->route_table6[1]) |
| 277 | { |
| 278 | route_table_finish (area->route_table6[1]); |
| 279 | area->route_table6[1] = NULL; |
| 280 | } |
| 281 | #endif /* HAVE_IPV6 */ |
| 282 | |
| 283 | for (ALL_LIST_ELEMENTS (area->area_addrs, node, nnode, addr)) |
| 284 | { |
| 285 | list_delete_node (area->area_addrs, node); |
| 286 | XFREE (MTYPE_ISIS_AREA_ADDR, addr); |
| 287 | } |
| 288 | area->area_addrs = NULL; |
| 289 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 290 | THREAD_TIMER_OFF (area->t_tick); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 291 | THREAD_TIMER_OFF (area->t_lsp_refresh[0]); |
| 292 | THREAD_TIMER_OFF (area->t_lsp_refresh[1]); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 293 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 294 | thread_cancel_event (master, area); |
| 295 | |
| 296 | listnode_delete (isis->area_list, area); |
| 297 | |
| 298 | free (area->area_tag); |
| 299 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 300 | XFREE (MTYPE_ISIS_AREA, area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 301 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 302 | if (listcount (isis->area_list) == 0) |
| 303 | { |
| 304 | memset (isis->sysid, 0, ISIS_SYS_ID_LEN); |
| 305 | isis->sysid_set = 0; |
| 306 | } |
| 307 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 308 | return CMD_SUCCESS; |
| 309 | } |
| 310 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 311 | int |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 312 | area_net_title (struct vty *vty, const char *net_title) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 313 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 314 | struct isis_area *area; |
| 315 | struct area_addr *addr; |
| 316 | struct area_addr *addrp; |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 317 | struct listnode *node; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 318 | |
| 319 | u_char buff[255]; |
| 320 | area = vty->index; |
| 321 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 322 | if (!area) |
| 323 | { |
| 324 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 325 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 326 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 327 | |
| 328 | /* We check that we are not over the maximal number of addresses */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 329 | if (listcount (area->area_addrs) >= isis->max_area_addrs) |
| 330 | { |
| 331 | vty_out (vty, "Maximum of area addresses (%d) already reached %s", |
| 332 | isis->max_area_addrs, VTY_NEWLINE); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 333 | return CMD_ERR_NOTHING_TODO; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 334 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 335 | |
| 336 | addr = XMALLOC (MTYPE_ISIS_AREA_ADDR, sizeof (struct area_addr)); |
| 337 | addr->addr_len = dotformat2buff (buff, net_title); |
| 338 | memcpy (addr->area_addr, buff, addr->addr_len); |
| 339 | #ifdef EXTREME_DEBUG |
hasso | 529d65b | 2004-12-24 00:14:50 +0000 | [diff] [blame] | 340 | zlog_debug ("added area address %s for area %s (address length %d)", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 341 | net_title, area->area_tag, addr->addr_len); |
| 342 | #endif /* EXTREME_DEBUG */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 343 | if (addr->addr_len < 8 || addr->addr_len > 20) |
| 344 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 345 | vty_out (vty, "area address must be at least 8..20 octets long (%d)%s", |
| 346 | addr->addr_len, VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 347 | XFREE (MTYPE_ISIS_AREA_ADDR, addr); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 348 | return CMD_ERR_AMBIGUOUS; |
| 349 | } |
| 350 | |
| 351 | if (addr->area_addr[addr->addr_len-1] != 0) |
| 352 | { |
| 353 | vty_out (vty, "nsel byte (last byte) in area address must be 0%s", |
| 354 | VTY_NEWLINE); |
| 355 | XFREE (MTYPE_ISIS_AREA_ADDR, addr); |
| 356 | return CMD_ERR_AMBIGUOUS; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 357 | } |
| 358 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 359 | if (isis->sysid_set == 0) |
| 360 | { |
| 361 | /* |
| 362 | * First area address - get the SystemID for this router |
| 363 | */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 364 | memcpy (isis->sysid, GETSYSID (addr), ISIS_SYS_ID_LEN); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 365 | isis->sysid_set = 1; |
hasso | c89c05d | 2005-09-04 21:36:36 +0000 | [diff] [blame] | 366 | if (isis->debugs & DEBUG_EVENTS) |
| 367 | zlog_debug ("Router has SystemID %s", sysid_print (isis->sysid)); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 368 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 369 | else |
| 370 | { |
| 371 | /* |
| 372 | * Check that the SystemID portions match |
| 373 | */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 374 | if (memcmp (isis->sysid, GETSYSID (addr), ISIS_SYS_ID_LEN)) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 375 | { |
| 376 | vty_out (vty, |
| 377 | "System ID must not change when defining additional area" |
| 378 | " addresses%s", VTY_NEWLINE); |
| 379 | XFREE (MTYPE_ISIS_AREA_ADDR, addr); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 380 | return CMD_ERR_AMBIGUOUS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 381 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 382 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 383 | /* now we see that we don't already have this address */ |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 384 | for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp)) |
| 385 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 386 | if ((addrp->addr_len + ISIS_SYS_ID_LEN + ISIS_NSEL_LEN) != (addr->addr_len)) |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 387 | continue; |
| 388 | if (!memcmp (addrp->area_addr, addr->area_addr, addr->addr_len)) |
| 389 | { |
| 390 | XFREE (MTYPE_ISIS_AREA_ADDR, addr); |
| 391 | return CMD_SUCCESS; /* silent fail */ |
| 392 | } |
| 393 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 394 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 395 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 396 | /* |
| 397 | * Forget the systemID part of the address |
| 398 | */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 399 | addr->addr_len -= (ISIS_SYS_ID_LEN + ISIS_NSEL_LEN); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 400 | listnode_add (area->area_addrs, addr); |
| 401 | |
| 402 | /* only now we can safely generate our LSPs for this area */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 403 | if (listcount (area->area_addrs) > 0) |
| 404 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 405 | if (area->is_type & IS_LEVEL_1) |
| 406 | lsp_generate (area, IS_LEVEL_1); |
| 407 | if (area->is_type & IS_LEVEL_2) |
| 408 | lsp_generate (area, IS_LEVEL_2); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 409 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 410 | |
| 411 | return CMD_SUCCESS; |
| 412 | } |
| 413 | |
| 414 | int |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 415 | area_clear_net_title (struct vty *vty, const char *net_title) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 416 | { |
| 417 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 418 | struct area_addr addr, *addrp = NULL; |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 419 | struct listnode *node; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 420 | u_char buff[255]; |
| 421 | |
| 422 | area = vty->index; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 423 | if (!area) |
| 424 | { |
| 425 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 426 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 427 | } |
| 428 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 429 | addr.addr_len = dotformat2buff (buff, net_title); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 430 | if (addr.addr_len < 8 || addr.addr_len > 20) |
| 431 | { |
| 432 | vty_out (vty, "Unsupported area address length %d, should be 8...20 %s", |
| 433 | addr.addr_len, VTY_NEWLINE); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 434 | return CMD_ERR_AMBIGUOUS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 435 | } |
| 436 | |
| 437 | memcpy (addr.area_addr, buff, (int) addr.addr_len); |
| 438 | |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 439 | for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp)) |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 440 | if ((addrp->addr_len + ISIS_SYS_ID_LEN + 1) == addr.addr_len && |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 441 | !memcmp (addrp->area_addr, addr.area_addr, addr.addr_len)) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 442 | break; |
| 443 | |
| 444 | if (!addrp) |
| 445 | { |
| 446 | vty_out (vty, "No area address %s for area %s %s", net_title, |
| 447 | area->area_tag, VTY_NEWLINE); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 448 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 449 | } |
| 450 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 451 | listnode_delete (area->area_addrs, addrp); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 452 | XFREE (MTYPE_ISIS_AREA_ADDR, addrp); |
| 453 | |
| 454 | /* |
| 455 | * Last area address - reset the SystemID for this router |
| 456 | */ |
| 457 | if (listcount (area->area_addrs) == 0) |
| 458 | { |
| 459 | memset (isis->sysid, 0, ISIS_SYS_ID_LEN); |
| 460 | isis->sysid_set = 0; |
| 461 | if (isis->debugs & DEBUG_EVENTS) |
| 462 | zlog_debug ("Router has no SystemID"); |
| 463 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 464 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 465 | return CMD_SUCCESS; |
| 466 | } |
| 467 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 468 | /* |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 469 | * 'show isis interface' command |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 470 | */ |
| 471 | |
| 472 | int |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 473 | show_isis_interface_common (struct vty *vty, const char *ifname, char detail) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 474 | { |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 475 | struct listnode *anode, *cnode; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 476 | struct isis_area *area; |
| 477 | struct isis_circuit *circuit; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 478 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 479 | if (!isis) |
| 480 | { |
| 481 | vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE); |
| 482 | return CMD_SUCCESS; |
| 483 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 484 | |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 485 | for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area)) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 486 | { |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 487 | vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 488 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 489 | if (detail == ISIS_UI_LEVEL_BRIEF) |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 490 | vty_out (vty, " Interface CircId State Type Level%s", |
| 491 | VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 492 | |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 493 | for (ALL_LIST_ELEMENTS_RO (area->circuit_list, cnode, circuit)) |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 494 | if (!ifname) |
| 495 | isis_circuit_print_vty (circuit, vty, detail); |
| 496 | else if (strcmp(circuit->interface->name, ifname) == 0) |
| 497 | isis_circuit_print_vty (circuit, vty, detail); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 498 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 499 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 500 | return CMD_SUCCESS; |
| 501 | } |
| 502 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 503 | DEFUN (show_isis_interface, |
| 504 | show_isis_interface_cmd, |
| 505 | "show isis interface", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 506 | SHOW_STR |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 507 | "ISIS network information\n" |
| 508 | "ISIS interface\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 509 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 510 | return show_isis_interface_common (vty, NULL, ISIS_UI_LEVEL_BRIEF); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 511 | } |
| 512 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 513 | DEFUN (show_isis_interface_detail, |
| 514 | show_isis_interface_detail_cmd, |
| 515 | "show isis interface detail", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 516 | SHOW_STR |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 517 | "ISIS network information\n" |
| 518 | "ISIS interface\n" |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 519 | "show detailed information\n") |
| 520 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 521 | return show_isis_interface_common (vty, NULL, ISIS_UI_LEVEL_DETAIL); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 522 | } |
| 523 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 524 | DEFUN (show_isis_interface_arg, |
| 525 | show_isis_interface_arg_cmd, |
| 526 | "show isis interface WORD", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 527 | SHOW_STR |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 528 | "ISIS network information\n" |
| 529 | "ISIS interface\n" |
| 530 | "ISIS interface name\n") |
| 531 | { |
| 532 | return show_isis_interface_common (vty, argv[0], ISIS_UI_LEVEL_DETAIL); |
| 533 | } |
| 534 | |
| 535 | /* |
| 536 | * 'show isis neighbor' command |
| 537 | */ |
| 538 | |
| 539 | int |
| 540 | show_isis_neighbor_common (struct vty *vty, const char *id, char detail) |
| 541 | { |
| 542 | struct listnode *anode, *cnode, *node; |
| 543 | struct isis_area *area; |
| 544 | struct isis_circuit *circuit; |
| 545 | struct list *adjdb; |
| 546 | struct isis_adjacency *adj; |
| 547 | struct isis_dynhn *dynhn; |
| 548 | u_char sysid[ISIS_SYS_ID_LEN]; |
| 549 | int i; |
| 550 | |
| 551 | if (!isis) |
| 552 | { |
| 553 | vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE); |
| 554 | return CMD_SUCCESS; |
| 555 | } |
| 556 | |
| 557 | memset (sysid, 0, ISIS_SYS_ID_LEN); |
| 558 | if (id) |
| 559 | { |
| 560 | if (sysid2buff (sysid, id) == 0) |
| 561 | { |
| 562 | dynhn = dynhn_find_by_name (id); |
| 563 | if (dynhn == NULL) |
| 564 | { |
| 565 | vty_out (vty, "Invalid system id %s%s", id, VTY_NEWLINE); |
| 566 | return CMD_SUCCESS; |
| 567 | } |
| 568 | memcpy (sysid, dynhn->id, ISIS_SYS_ID_LEN); |
| 569 | } |
| 570 | } |
| 571 | |
| 572 | for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area)) |
| 573 | { |
| 574 | vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE); |
| 575 | |
| 576 | if (detail == ISIS_UI_LEVEL_BRIEF) |
| 577 | vty_out (vty, " System Id Interface L State" |
| 578 | " Holdtime SNPA%s", VTY_NEWLINE); |
| 579 | |
| 580 | for (ALL_LIST_ELEMENTS_RO (area->circuit_list, cnode, circuit)) |
| 581 | { |
| 582 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) |
| 583 | { |
| 584 | for (i = 0; i < 2; i++) |
| 585 | { |
| 586 | adjdb = circuit->u.bc.adjdb[i]; |
| 587 | if (adjdb && adjdb->count) |
| 588 | { |
| 589 | for (ALL_LIST_ELEMENTS_RO (adjdb, node, adj)) |
| 590 | if (!id || !memcmp (adj->sysid, sysid, |
| 591 | ISIS_SYS_ID_LEN)) |
| 592 | isis_adj_print_vty (adj, vty, detail); |
| 593 | } |
| 594 | } |
| 595 | } |
| 596 | else if (circuit->circ_type == CIRCUIT_T_P2P && |
| 597 | circuit->u.p2p.neighbor) |
| 598 | { |
| 599 | adj = circuit->u.p2p.neighbor; |
| 600 | if (!id || !memcmp (adj->sysid, sysid, ISIS_SYS_ID_LEN)) |
| 601 | isis_adj_print_vty (adj, vty, detail); |
| 602 | } |
| 603 | } |
| 604 | } |
| 605 | |
| 606 | return CMD_SUCCESS; |
| 607 | } |
| 608 | |
| 609 | /* |
| 610 | * 'clear isis neighbor' command |
| 611 | */ |
| 612 | int |
| 613 | clear_isis_neighbor_common (struct vty *vty, const char *id) |
| 614 | { |
| 615 | struct listnode *anode, *cnode, *cnextnode, *node, *nnode; |
| 616 | struct isis_area *area; |
| 617 | struct isis_circuit *circuit; |
| 618 | struct list *adjdb; |
| 619 | struct isis_adjacency *adj; |
| 620 | struct isis_dynhn *dynhn; |
| 621 | u_char sysid[ISIS_SYS_ID_LEN]; |
| 622 | int i; |
| 623 | |
| 624 | if (!isis) |
| 625 | { |
| 626 | vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE); |
| 627 | return CMD_SUCCESS; |
| 628 | } |
| 629 | |
| 630 | memset (sysid, 0, ISIS_SYS_ID_LEN); |
| 631 | if (id) |
| 632 | { |
| 633 | if (sysid2buff (sysid, id) == 0) |
| 634 | { |
| 635 | dynhn = dynhn_find_by_name (id); |
| 636 | if (dynhn == NULL) |
| 637 | { |
| 638 | vty_out (vty, "Invalid system id %s%s", id, VTY_NEWLINE); |
| 639 | return CMD_SUCCESS; |
| 640 | } |
| 641 | memcpy (sysid, dynhn->id, ISIS_SYS_ID_LEN); |
| 642 | } |
| 643 | } |
| 644 | |
| 645 | for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area)) |
| 646 | { |
| 647 | for (ALL_LIST_ELEMENTS (area->circuit_list, cnode, cnextnode, circuit)) |
| 648 | { |
| 649 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) |
| 650 | { |
| 651 | for (i = 0; i < 2; i++) |
| 652 | { |
| 653 | adjdb = circuit->u.bc.adjdb[i]; |
| 654 | if (adjdb && adjdb->count) |
| 655 | { |
| 656 | for (ALL_LIST_ELEMENTS (adjdb, node, nnode, adj)) |
| 657 | if (!id || !memcmp (adj->sysid, sysid, ISIS_SYS_ID_LEN)) |
| 658 | isis_adj_state_change (adj, ISIS_ADJ_DOWN, |
| 659 | "clear user request"); |
| 660 | } |
| 661 | } |
| 662 | } |
| 663 | else if (circuit->circ_type == CIRCUIT_T_P2P && |
| 664 | circuit->u.p2p.neighbor) |
| 665 | { |
| 666 | adj = circuit->u.p2p.neighbor; |
| 667 | if (!id || !memcmp (adj->sysid, sysid, ISIS_SYS_ID_LEN)) |
| 668 | isis_adj_state_change (adj, ISIS_ADJ_DOWN, |
| 669 | "clear user request"); |
| 670 | } |
| 671 | } |
| 672 | } |
| 673 | |
| 674 | return CMD_SUCCESS; |
| 675 | } |
| 676 | |
| 677 | DEFUN (show_isis_neighbor, |
| 678 | show_isis_neighbor_cmd, |
| 679 | "show isis neighbor", |
| 680 | SHOW_STR |
| 681 | "ISIS network information\n" |
| 682 | "ISIS neighbor adjacencies\n") |
| 683 | { |
| 684 | return show_isis_neighbor_common (vty, NULL, ISIS_UI_LEVEL_BRIEF); |
| 685 | } |
| 686 | |
| 687 | DEFUN (show_isis_neighbor_detail, |
| 688 | show_isis_neighbor_detail_cmd, |
| 689 | "show isis neighbor detail", |
| 690 | SHOW_STR |
| 691 | "ISIS network information\n" |
| 692 | "ISIS neighbor adjacencies\n" |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 693 | "show detailed information\n") |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 694 | { |
| 695 | return show_isis_neighbor_common (vty, NULL, ISIS_UI_LEVEL_DETAIL); |
| 696 | } |
| 697 | |
| 698 | DEFUN (show_isis_neighbor_arg, |
| 699 | show_isis_neighbor_arg_cmd, |
| 700 | "show isis neighbor WORD", |
| 701 | SHOW_STR |
| 702 | "ISIS network information\n" |
| 703 | "ISIS neighbor adjacencies\n" |
| 704 | "System id\n") |
| 705 | { |
| 706 | return show_isis_neighbor_common (vty, argv[0], ISIS_UI_LEVEL_DETAIL); |
| 707 | } |
| 708 | |
| 709 | DEFUN (clear_isis_neighbor, |
| 710 | clear_isis_neighbor_cmd, |
| 711 | "clear isis neighbor", |
| 712 | CLEAR_STR |
| 713 | "Reset ISIS network information\n" |
| 714 | "Reset ISIS neighbor adjacencies\n") |
| 715 | { |
| 716 | return clear_isis_neighbor_common (vty, NULL); |
| 717 | } |
| 718 | |
| 719 | DEFUN (clear_isis_neighbor_arg, |
| 720 | clear_isis_neighbor_arg_cmd, |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 721 | "clear isis neighbor WORD", |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 722 | CLEAR_STR |
| 723 | "ISIS network information\n" |
| 724 | "ISIS neighbor adjacencies\n" |
| 725 | "System id\n") |
| 726 | { |
| 727 | return clear_isis_neighbor_common (vty, argv[0]); |
| 728 | } |
| 729 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 730 | /* |
| 731 | * 'isis debug', 'show debugging' |
| 732 | */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 733 | void |
| 734 | print_debug (struct vty *vty, int flags, int onoff) |
| 735 | { |
| 736 | char onoffs[4]; |
| 737 | if (onoff) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 738 | strcpy (onoffs, "on"); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 739 | else |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 740 | strcpy (onoffs, "off"); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 741 | |
| 742 | if (flags & DEBUG_ADJ_PACKETS) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 743 | vty_out (vty, "IS-IS Adjacency related packets debugging is %s%s", onoffs, |
| 744 | VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 745 | if (flags & DEBUG_CHECKSUM_ERRORS) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 746 | vty_out (vty, "IS-IS checksum errors debugging is %s%s", onoffs, |
| 747 | VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 748 | if (flags & DEBUG_LOCAL_UPDATES) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 749 | vty_out (vty, "IS-IS local updates debugging is %s%s", onoffs, |
| 750 | VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 751 | if (flags & DEBUG_PROTOCOL_ERRORS) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 752 | vty_out (vty, "IS-IS protocol errors debugging is %s%s", onoffs, |
| 753 | VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 754 | if (flags & DEBUG_SNP_PACKETS) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 755 | vty_out (vty, "IS-IS CSNP/PSNP packets debugging is %s%s", onoffs, |
| 756 | VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 757 | if (flags & DEBUG_SPF_EVENTS) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 758 | vty_out (vty, "IS-IS SPF events debugging is %s%s", onoffs, VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 759 | if (flags & DEBUG_SPF_STATS) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 760 | vty_out (vty, "IS-IS SPF Timing and Statistics Data debugging is %s%s", |
| 761 | onoffs, VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 762 | if (flags & DEBUG_SPF_TRIGGERS) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 763 | vty_out (vty, "IS-IS SPF triggering events debugging is %s%s", onoffs, |
| 764 | VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 765 | if (flags & DEBUG_UPDATE_PACKETS) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 766 | vty_out (vty, "IS-IS Update related packet debugging is %s%s", onoffs, |
| 767 | VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 768 | if (flags & DEBUG_RTE_EVENTS) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 769 | vty_out (vty, "IS-IS Route related debuggin is %s%s", onoffs, |
| 770 | VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 771 | if (flags & DEBUG_EVENTS) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 772 | vty_out (vty, "IS-IS Event debugging is %s%s", onoffs, VTY_NEWLINE); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 773 | if (flags & DEBUG_PACKET_DUMP) |
| 774 | vty_out (vty, "IS-IS Packet dump debugging is %s%s", onoffs, VTY_NEWLINE); |
Christian Franke | 80a8f72 | 2015-11-12 14:21:47 +0100 | [diff] [blame^] | 775 | if (flags & DEBUG_LSP_GEN) |
| 776 | vty_out (vty, "IS-IS LSP generation debugging is %s%s", onoffs, VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 777 | } |
| 778 | |
| 779 | DEFUN (show_debugging, |
| 780 | show_debugging_cmd, |
| 781 | "show debugging", |
| 782 | SHOW_STR |
| 783 | "State of each debugging option\n") |
| 784 | { |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 785 | vty_out (vty, "IS-IS:%s", VTY_NEWLINE); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 786 | print_debug (vty, isis->debugs, 1); |
| 787 | return CMD_SUCCESS; |
| 788 | } |
| 789 | |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 790 | /* Debug node. */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 791 | static struct cmd_node debug_node = { |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 792 | DEBUG_NODE, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 793 | "", |
| 794 | 1 |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 795 | }; |
| 796 | |
| 797 | static int |
| 798 | config_write_debug (struct vty *vty) |
| 799 | { |
| 800 | int write = 0; |
| 801 | int flags = isis->debugs; |
| 802 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 803 | if (flags & DEBUG_ADJ_PACKETS) |
| 804 | { |
| 805 | vty_out (vty, "debug isis adj-packets%s", VTY_NEWLINE); |
| 806 | write++; |
| 807 | } |
| 808 | if (flags & DEBUG_CHECKSUM_ERRORS) |
| 809 | { |
| 810 | vty_out (vty, "debug isis checksum-errors%s", VTY_NEWLINE); |
| 811 | write++; |
| 812 | } |
| 813 | if (flags & DEBUG_LOCAL_UPDATES) |
| 814 | { |
| 815 | vty_out (vty, "debug isis local-updates%s", VTY_NEWLINE); |
| 816 | write++; |
| 817 | } |
| 818 | if (flags & DEBUG_PROTOCOL_ERRORS) |
| 819 | { |
| 820 | vty_out (vty, "debug isis protocol-errors%s", VTY_NEWLINE); |
| 821 | write++; |
| 822 | } |
| 823 | if (flags & DEBUG_SNP_PACKETS) |
| 824 | { |
| 825 | vty_out (vty, "debug isis snp-packets%s", VTY_NEWLINE); |
| 826 | write++; |
| 827 | } |
| 828 | if (flags & DEBUG_SPF_EVENTS) |
| 829 | { |
| 830 | vty_out (vty, "debug isis spf-events%s", VTY_NEWLINE); |
| 831 | write++; |
| 832 | } |
| 833 | if (flags & DEBUG_SPF_STATS) |
| 834 | { |
| 835 | vty_out (vty, "debug isis spf-statistics%s", VTY_NEWLINE); |
| 836 | write++; |
| 837 | } |
| 838 | if (flags & DEBUG_SPF_TRIGGERS) |
| 839 | { |
| 840 | vty_out (vty, "debug isis spf-triggers%s", VTY_NEWLINE); |
| 841 | write++; |
| 842 | } |
| 843 | if (flags & DEBUG_UPDATE_PACKETS) |
| 844 | { |
| 845 | vty_out (vty, "debug isis update-packets%s", VTY_NEWLINE); |
| 846 | write++; |
| 847 | } |
| 848 | if (flags & DEBUG_RTE_EVENTS) |
| 849 | { |
| 850 | vty_out (vty, "debug isis route-events%s", VTY_NEWLINE); |
| 851 | write++; |
| 852 | } |
| 853 | if (flags & DEBUG_EVENTS) |
| 854 | { |
| 855 | vty_out (vty, "debug isis events%s", VTY_NEWLINE); |
| 856 | write++; |
| 857 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 858 | if (flags & DEBUG_PACKET_DUMP) |
| 859 | { |
| 860 | vty_out (vty, "debug isis packet-dump%s", VTY_NEWLINE); |
| 861 | write++; |
| 862 | } |
Christian Franke | 80a8f72 | 2015-11-12 14:21:47 +0100 | [diff] [blame^] | 863 | if (flags & DEBUG_LSP_GEN) |
| 864 | { |
| 865 | vty_out (vty, "debug isis lsp-gen%s", VTY_NEWLINE); |
| 866 | write++; |
| 867 | } |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 868 | |
| 869 | return write; |
| 870 | } |
| 871 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 872 | DEFUN (debug_isis_adj, |
| 873 | debug_isis_adj_cmd, |
| 874 | "debug isis adj-packets", |
| 875 | DEBUG_STR |
| 876 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 877 | "IS-IS Adjacency related packets\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 878 | { |
| 879 | isis->debugs |= DEBUG_ADJ_PACKETS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 880 | print_debug (vty, DEBUG_ADJ_PACKETS, 1); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 881 | |
| 882 | return CMD_SUCCESS; |
| 883 | } |
| 884 | |
| 885 | DEFUN (no_debug_isis_adj, |
| 886 | no_debug_isis_adj_cmd, |
| 887 | "no debug isis adj-packets", |
| 888 | UNDEBUG_STR |
| 889 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 890 | "IS-IS Adjacency related packets\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 891 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 892 | isis->debugs &= ~DEBUG_ADJ_PACKETS; |
| 893 | print_debug (vty, DEBUG_ADJ_PACKETS, 0); |
| 894 | |
| 895 | return CMD_SUCCESS; |
| 896 | } |
| 897 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 898 | DEFUN (debug_isis_csum, |
| 899 | debug_isis_csum_cmd, |
| 900 | "debug isis checksum-errors", |
| 901 | DEBUG_STR |
| 902 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 903 | "IS-IS LSP checksum errors\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 904 | { |
| 905 | isis->debugs |= DEBUG_CHECKSUM_ERRORS; |
| 906 | print_debug (vty, DEBUG_CHECKSUM_ERRORS, 1); |
| 907 | |
| 908 | return CMD_SUCCESS; |
| 909 | } |
| 910 | |
| 911 | DEFUN (no_debug_isis_csum, |
| 912 | no_debug_isis_csum_cmd, |
| 913 | "no debug isis checksum-errors", |
| 914 | UNDEBUG_STR |
| 915 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 916 | "IS-IS LSP checksum errors\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 917 | { |
| 918 | isis->debugs &= ~DEBUG_CHECKSUM_ERRORS; |
| 919 | print_debug (vty, DEBUG_CHECKSUM_ERRORS, 0); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 920 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 921 | return CMD_SUCCESS; |
| 922 | } |
| 923 | |
| 924 | DEFUN (debug_isis_lupd, |
| 925 | debug_isis_lupd_cmd, |
| 926 | "debug isis local-updates", |
| 927 | DEBUG_STR |
| 928 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 929 | "IS-IS local update packets\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 930 | { |
| 931 | isis->debugs |= DEBUG_LOCAL_UPDATES; |
| 932 | print_debug (vty, DEBUG_LOCAL_UPDATES, 1); |
| 933 | |
| 934 | return CMD_SUCCESS; |
| 935 | } |
| 936 | |
| 937 | DEFUN (no_debug_isis_lupd, |
| 938 | no_debug_isis_lupd_cmd, |
| 939 | "no debug isis local-updates", |
| 940 | UNDEBUG_STR |
| 941 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 942 | "IS-IS local update packets\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 943 | { |
| 944 | isis->debugs &= ~DEBUG_LOCAL_UPDATES; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 945 | print_debug (vty, DEBUG_LOCAL_UPDATES, 0); |
| 946 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 947 | return CMD_SUCCESS; |
| 948 | } |
| 949 | |
| 950 | DEFUN (debug_isis_err, |
| 951 | debug_isis_err_cmd, |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 952 | "debug isis protocol-errors", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 953 | DEBUG_STR |
| 954 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 955 | "IS-IS LSP protocol errors\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 956 | { |
| 957 | isis->debugs |= DEBUG_PROTOCOL_ERRORS; |
| 958 | print_debug (vty, DEBUG_PROTOCOL_ERRORS, 1); |
| 959 | |
| 960 | return CMD_SUCCESS; |
| 961 | } |
| 962 | |
| 963 | DEFUN (no_debug_isis_err, |
| 964 | no_debug_isis_err_cmd, |
| 965 | "no debug isis protocol-errors", |
| 966 | UNDEBUG_STR |
| 967 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 968 | "IS-IS LSP protocol errors\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 969 | { |
| 970 | isis->debugs &= ~DEBUG_PROTOCOL_ERRORS; |
| 971 | print_debug (vty, DEBUG_PROTOCOL_ERRORS, 0); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 972 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 973 | return CMD_SUCCESS; |
| 974 | } |
| 975 | |
| 976 | DEFUN (debug_isis_snp, |
| 977 | debug_isis_snp_cmd, |
| 978 | "debug isis snp-packets", |
| 979 | DEBUG_STR |
| 980 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 981 | "IS-IS CSNP/PSNP packets\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 982 | { |
| 983 | isis->debugs |= DEBUG_SNP_PACKETS; |
| 984 | print_debug (vty, DEBUG_SNP_PACKETS, 1); |
| 985 | |
| 986 | return CMD_SUCCESS; |
| 987 | } |
| 988 | |
| 989 | DEFUN (no_debug_isis_snp, |
| 990 | no_debug_isis_snp_cmd, |
| 991 | "no debug isis snp-packets", |
| 992 | UNDEBUG_STR |
| 993 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 994 | "IS-IS CSNP/PSNP packets\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 995 | { |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 996 | isis->debugs &= ~DEBUG_SNP_PACKETS; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 997 | print_debug (vty, DEBUG_SNP_PACKETS, 0); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 998 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 999 | return CMD_SUCCESS; |
| 1000 | } |
| 1001 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1002 | DEFUN (debug_isis_upd, |
| 1003 | debug_isis_upd_cmd, |
| 1004 | "debug isis update-packets", |
| 1005 | DEBUG_STR |
| 1006 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1007 | "IS-IS Update related packets\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1008 | { |
| 1009 | isis->debugs |= DEBUG_UPDATE_PACKETS; |
| 1010 | print_debug (vty, DEBUG_UPDATE_PACKETS, 1); |
| 1011 | |
| 1012 | return CMD_SUCCESS; |
| 1013 | } |
| 1014 | |
| 1015 | DEFUN (no_debug_isis_upd, |
| 1016 | no_debug_isis_upd_cmd, |
| 1017 | "no debug isis update-packets", |
| 1018 | UNDEBUG_STR |
| 1019 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1020 | "IS-IS Update related packets\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1021 | { |
| 1022 | isis->debugs &= ~DEBUG_UPDATE_PACKETS; |
| 1023 | print_debug (vty, DEBUG_UPDATE_PACKETS, 0); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1024 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1025 | return CMD_SUCCESS; |
| 1026 | } |
| 1027 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1028 | DEFUN (debug_isis_spfevents, |
| 1029 | debug_isis_spfevents_cmd, |
| 1030 | "debug isis spf-events", |
| 1031 | DEBUG_STR |
| 1032 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1033 | "IS-IS Shortest Path First Events\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1034 | { |
| 1035 | isis->debugs |= DEBUG_SPF_EVENTS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1036 | print_debug (vty, DEBUG_SPF_EVENTS, 1); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1037 | |
| 1038 | return CMD_SUCCESS; |
| 1039 | } |
| 1040 | |
| 1041 | DEFUN (no_debug_isis_spfevents, |
| 1042 | no_debug_isis_spfevents_cmd, |
| 1043 | "no debug isis spf-events", |
| 1044 | UNDEBUG_STR |
| 1045 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1046 | "IS-IS Shortest Path First Events\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1047 | { |
| 1048 | isis->debugs &= ~DEBUG_SPF_EVENTS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1049 | print_debug (vty, DEBUG_SPF_EVENTS, 0); |
| 1050 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1051 | return CMD_SUCCESS; |
| 1052 | } |
| 1053 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1054 | DEFUN (debug_isis_spfstats, |
| 1055 | debug_isis_spfstats_cmd, |
| 1056 | "debug isis spf-statistics ", |
| 1057 | DEBUG_STR |
| 1058 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1059 | "IS-IS SPF Timing and Statistic Data\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1060 | { |
| 1061 | isis->debugs |= DEBUG_SPF_STATS; |
| 1062 | print_debug (vty, DEBUG_SPF_STATS, 1); |
| 1063 | |
| 1064 | return CMD_SUCCESS; |
| 1065 | } |
| 1066 | |
| 1067 | DEFUN (no_debug_isis_spfstats, |
| 1068 | no_debug_isis_spfstats_cmd, |
| 1069 | "no debug isis spf-statistics", |
| 1070 | UNDEBUG_STR |
| 1071 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1072 | "IS-IS SPF Timing and Statistic Data\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1073 | { |
| 1074 | isis->debugs &= ~DEBUG_SPF_STATS; |
| 1075 | print_debug (vty, DEBUG_SPF_STATS, 0); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1076 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1077 | return CMD_SUCCESS; |
| 1078 | } |
| 1079 | |
| 1080 | DEFUN (debug_isis_spftrigg, |
| 1081 | debug_isis_spftrigg_cmd, |
| 1082 | "debug isis spf-triggers", |
| 1083 | DEBUG_STR |
| 1084 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1085 | "IS-IS SPF triggering events\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1086 | { |
| 1087 | isis->debugs |= DEBUG_SPF_TRIGGERS; |
| 1088 | print_debug (vty, DEBUG_SPF_TRIGGERS, 1); |
| 1089 | |
| 1090 | return CMD_SUCCESS; |
| 1091 | } |
| 1092 | |
| 1093 | DEFUN (no_debug_isis_spftrigg, |
| 1094 | no_debug_isis_spftrigg_cmd, |
| 1095 | "no debug isis spf-triggers", |
| 1096 | UNDEBUG_STR |
| 1097 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1098 | "IS-IS SPF triggering events\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1099 | { |
| 1100 | isis->debugs &= ~DEBUG_SPF_TRIGGERS; |
| 1101 | print_debug (vty, DEBUG_SPF_TRIGGERS, 0); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1102 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1103 | return CMD_SUCCESS; |
| 1104 | } |
| 1105 | |
| 1106 | DEFUN (debug_isis_rtevents, |
| 1107 | debug_isis_rtevents_cmd, |
| 1108 | "debug isis route-events", |
| 1109 | DEBUG_STR |
| 1110 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1111 | "IS-IS Route related events\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1112 | { |
| 1113 | isis->debugs |= DEBUG_RTE_EVENTS; |
| 1114 | print_debug (vty, DEBUG_RTE_EVENTS, 1); |
| 1115 | |
| 1116 | return CMD_SUCCESS; |
| 1117 | } |
| 1118 | |
| 1119 | DEFUN (no_debug_isis_rtevents, |
| 1120 | no_debug_isis_rtevents_cmd, |
| 1121 | "no debug isis route-events", |
| 1122 | UNDEBUG_STR |
| 1123 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1124 | "IS-IS Route related events\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1125 | { |
| 1126 | isis->debugs &= ~DEBUG_RTE_EVENTS; |
| 1127 | print_debug (vty, DEBUG_RTE_EVENTS, 0); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1128 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1129 | return CMD_SUCCESS; |
| 1130 | } |
| 1131 | |
| 1132 | DEFUN (debug_isis_events, |
| 1133 | debug_isis_events_cmd, |
| 1134 | "debug isis events", |
| 1135 | DEBUG_STR |
| 1136 | "IS-IS information\n" |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 1137 | "IS-IS Events\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1138 | { |
| 1139 | isis->debugs |= DEBUG_EVENTS; |
| 1140 | print_debug (vty, DEBUG_EVENTS, 1); |
| 1141 | |
| 1142 | return CMD_SUCCESS; |
| 1143 | } |
| 1144 | |
| 1145 | DEFUN (no_debug_isis_events, |
| 1146 | no_debug_isis_events_cmd, |
| 1147 | "no debug isis events", |
| 1148 | UNDEBUG_STR |
| 1149 | "IS-IS information\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1150 | "IS-IS Events\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1151 | { |
| 1152 | isis->debugs &= ~DEBUG_EVENTS; |
| 1153 | print_debug (vty, DEBUG_EVENTS, 0); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1154 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1155 | return CMD_SUCCESS; |
| 1156 | } |
| 1157 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1158 | DEFUN (debug_isis_packet_dump, |
| 1159 | debug_isis_packet_dump_cmd, |
| 1160 | "debug isis packet-dump", |
| 1161 | DEBUG_STR |
| 1162 | "IS-IS information\n" |
| 1163 | "IS-IS packet dump\n") |
| 1164 | { |
| 1165 | isis->debugs |= DEBUG_PACKET_DUMP; |
| 1166 | print_debug (vty, DEBUG_PACKET_DUMP, 1); |
| 1167 | |
| 1168 | return CMD_SUCCESS; |
| 1169 | } |
| 1170 | |
| 1171 | DEFUN (no_debug_isis_packet_dump, |
| 1172 | no_debug_isis_packet_dump_cmd, |
| 1173 | "no debug isis packet-dump", |
| 1174 | UNDEBUG_STR |
| 1175 | "IS-IS information\n" |
| 1176 | "IS-IS packet dump\n") |
| 1177 | { |
| 1178 | isis->debugs &= ~DEBUG_PACKET_DUMP; |
| 1179 | print_debug (vty, DEBUG_PACKET_DUMP, 0); |
| 1180 | |
| 1181 | return CMD_SUCCESS; |
| 1182 | } |
| 1183 | |
Christian Franke | 80a8f72 | 2015-11-12 14:21:47 +0100 | [diff] [blame^] | 1184 | DEFUN (debug_isis_lsp_gen, |
| 1185 | debug_isis_lsp_gen_cmd, |
| 1186 | "debug isis lsp-gen", |
| 1187 | DEBUG_STR |
| 1188 | "IS-IS information\n" |
| 1189 | "IS-IS generation of own LSPs\n") |
| 1190 | { |
| 1191 | isis->debugs |= DEBUG_LSP_GEN; |
| 1192 | print_debug (vty, DEBUG_LSP_GEN, 1); |
| 1193 | |
| 1194 | return CMD_SUCCESS; |
| 1195 | } |
| 1196 | |
| 1197 | DEFUN (no_debug_isis_lsp_gen, |
| 1198 | no_debug_isis_lsp_gen_cmd, |
| 1199 | "no debug isis lsp-gen", |
| 1200 | UNDEBUG_STR |
| 1201 | "IS-IS information\n" |
| 1202 | "IS-IS generation of own LSPs\n") |
| 1203 | { |
| 1204 | isis->debugs &= ~DEBUG_LSP_GEN; |
| 1205 | print_debug (vty, DEBUG_LSP_GEN, 0); |
| 1206 | |
| 1207 | return CMD_SUCCESS; |
| 1208 | } |
| 1209 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1210 | DEFUN (show_hostname, |
| 1211 | show_hostname_cmd, |
| 1212 | "show isis hostname", |
| 1213 | SHOW_STR |
| 1214 | "IS-IS information\n" |
| 1215 | "IS-IS Dynamic hostname mapping\n") |
| 1216 | { |
| 1217 | dynhn_print_all (vty); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1218 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1219 | return CMD_SUCCESS; |
| 1220 | } |
| 1221 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1222 | static void |
| 1223 | vty_out_timestr(struct vty *vty, time_t uptime) |
| 1224 | { |
| 1225 | struct tm *tm; |
| 1226 | time_t difftime = time (NULL); |
| 1227 | difftime -= uptime; |
| 1228 | tm = gmtime (&difftime); |
| 1229 | |
| 1230 | #define ONE_DAY_SECOND 60*60*24 |
| 1231 | #define ONE_WEEK_SECOND 60*60*24*7 |
| 1232 | if (difftime < ONE_DAY_SECOND) |
| 1233 | vty_out (vty, "%02d:%02d:%02d", |
| 1234 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
| 1235 | else if (difftime < ONE_WEEK_SECOND) |
| 1236 | vty_out (vty, "%dd%02dh%02dm", |
| 1237 | tm->tm_yday, tm->tm_hour, tm->tm_min); |
| 1238 | else |
| 1239 | vty_out (vty, "%02dw%dd%02dh", |
| 1240 | tm->tm_yday/7, |
| 1241 | tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour); |
| 1242 | vty_out (vty, " ago"); |
| 1243 | } |
| 1244 | |
| 1245 | DEFUN (show_isis_summary, |
| 1246 | show_isis_summary_cmd, |
| 1247 | "show isis summary", |
| 1248 | SHOW_STR "IS-IS information\n" "IS-IS summary\n") |
| 1249 | { |
| 1250 | struct listnode *node, *node2; |
| 1251 | struct isis_area *area; |
| 1252 | struct isis_spftree *spftree; |
| 1253 | int level; |
| 1254 | |
| 1255 | if (isis == NULL) |
| 1256 | { |
| 1257 | vty_out (vty, "ISIS is not running%s", VTY_NEWLINE); |
| 1258 | return CMD_SUCCESS; |
| 1259 | } |
| 1260 | |
| 1261 | vty_out (vty, "Process Id : %ld%s", isis->process_id, |
| 1262 | VTY_NEWLINE); |
| 1263 | if (isis->sysid_set) |
| 1264 | vty_out (vty, "System Id : %s%s", sysid_print (isis->sysid), |
| 1265 | VTY_NEWLINE); |
| 1266 | |
| 1267 | vty_out (vty, "Up time : "); |
| 1268 | vty_out_timestr(vty, isis->uptime); |
| 1269 | vty_out (vty, "%s", VTY_NEWLINE); |
| 1270 | |
| 1271 | if (isis->area_list) |
| 1272 | vty_out (vty, "Number of areas : %d%s", isis->area_list->count, |
| 1273 | VTY_NEWLINE); |
| 1274 | |
| 1275 | for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area)) |
| 1276 | { |
| 1277 | vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null", |
| 1278 | VTY_NEWLINE); |
| 1279 | |
| 1280 | if (listcount (area->area_addrs) > 0) |
| 1281 | { |
| 1282 | struct area_addr *area_addr; |
| 1283 | for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node2, area_addr)) |
| 1284 | { |
| 1285 | vty_out (vty, " Net: %s%s", |
| 1286 | isonet_print (area_addr->area_addr, |
| 1287 | area_addr->addr_len + ISIS_SYS_ID_LEN + |
| 1288 | 1), VTY_NEWLINE); |
| 1289 | } |
| 1290 | } |
| 1291 | |
| 1292 | for (level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++) |
| 1293 | { |
| 1294 | if ((area->is_type & level) == 0) |
| 1295 | continue; |
| 1296 | |
| 1297 | vty_out (vty, " Level-%d:%s", level, VTY_NEWLINE); |
| 1298 | spftree = area->spftree[level - 1]; |
| 1299 | if (spftree->pending) |
| 1300 | vty_out (vty, " IPv4 SPF: (pending)%s", VTY_NEWLINE); |
| 1301 | else |
| 1302 | vty_out (vty, " IPv4 SPF:%s", VTY_NEWLINE); |
| 1303 | |
| 1304 | vty_out (vty, " minimum interval : %d%s", |
| 1305 | area->min_spf_interval[level - 1], VTY_NEWLINE); |
| 1306 | |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 1307 | vty_out (vty, " last run elapsed : "); |
| 1308 | vty_out_timestr(vty, spftree->last_run_timestamp); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1309 | vty_out (vty, "%s", VTY_NEWLINE); |
| 1310 | |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 1311 | vty_out (vty, " last run duration : %u usec%s", |
| 1312 | (u_int32_t)spftree->last_run_duration, VTY_NEWLINE); |
| 1313 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1314 | vty_out (vty, " run count : %d%s", |
| 1315 | spftree->runcount, VTY_NEWLINE); |
| 1316 | |
| 1317 | #ifdef HAVE_IPV6 |
| 1318 | spftree = area->spftree6[level - 1]; |
| 1319 | if (spftree->pending) |
| 1320 | vty_out (vty, " IPv6 SPF: (pending)%s", VTY_NEWLINE); |
| 1321 | else |
| 1322 | vty_out (vty, " IPv6 SPF:%s", VTY_NEWLINE); |
| 1323 | |
| 1324 | vty_out (vty, " minimum interval : %d%s", |
| 1325 | area->min_spf_interval[level - 1], VTY_NEWLINE); |
| 1326 | |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 1327 | vty_out (vty, " last run elapsed : "); |
| 1328 | vty_out_timestr(vty, spftree->last_run_timestamp); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1329 | vty_out (vty, "%s", VTY_NEWLINE); |
| 1330 | |
David Lamparter | ef008d2 | 2015-03-03 08:48:11 +0100 | [diff] [blame] | 1331 | vty_out (vty, " last run duration : %llu msec%s", |
| 1332 | (unsigned long long)spftree->last_run_duration, VTY_NEWLINE); |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 1333 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1334 | vty_out (vty, " run count : %d%s", |
| 1335 | spftree->runcount, VTY_NEWLINE); |
| 1336 | #endif |
| 1337 | } |
| 1338 | } |
| 1339 | vty_out (vty, "%s", VTY_NEWLINE); |
| 1340 | |
| 1341 | return CMD_SUCCESS; |
| 1342 | } |
| 1343 | |
| 1344 | /* |
| 1345 | * This function supports following display options: |
| 1346 | * [ show isis database [detail] ] |
| 1347 | * [ show isis database <sysid> [detail] ] |
| 1348 | * [ show isis database <hostname> [detail] ] |
| 1349 | * [ show isis database <sysid>.<pseudo-id> [detail] ] |
| 1350 | * [ show isis database <hostname>.<pseudo-id> [detail] ] |
| 1351 | * [ show isis database <sysid>.<pseudo-id>-<fragment-number> [detail] ] |
| 1352 | * [ show isis database <hostname>.<pseudo-id>-<fragment-number> [detail] ] |
| 1353 | * [ show isis database detail <sysid> ] |
| 1354 | * [ show isis database detail <hostname> ] |
| 1355 | * [ show isis database detail <sysid>.<pseudo-id> ] |
| 1356 | * [ show isis database detail <hostname>.<pseudo-id> ] |
| 1357 | * [ show isis database detail <sysid>.<pseudo-id>-<fragment-number> ] |
| 1358 | * [ show isis database detail <hostname>.<pseudo-id>-<fragment-number> ] |
| 1359 | */ |
| 1360 | static int |
| 1361 | show_isis_database (struct vty *vty, const char *argv, int ui_level) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1362 | { |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 1363 | struct listnode *node; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1364 | struct isis_area *area; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1365 | struct isis_lsp *lsp; |
| 1366 | struct isis_dynhn *dynhn; |
| 1367 | const char *pos = argv; |
| 1368 | u_char lspid[ISIS_SYS_ID_LEN+2]; |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 1369 | char sysid[255]; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1370 | u_char number[3]; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1371 | int level, lsp_count; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1372 | |
| 1373 | if (isis->area_list->count == 0) |
| 1374 | return CMD_SUCCESS; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1375 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1376 | memset (&lspid, 0, ISIS_SYS_ID_LEN); |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 1377 | memset (&sysid, 0, 255); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1378 | |
| 1379 | /* |
| 1380 | * extract fragment and pseudo id from the string argv |
| 1381 | * in the forms: |
| 1382 | * (a) <systemid/hostname>.<pseudo-id>-<framenent> or |
| 1383 | * (b) <systemid/hostname>.<pseudo-id> or |
| 1384 | * (c) <systemid/hostname> or |
| 1385 | * Where systemid is in the form: |
| 1386 | * xxxx.xxxx.xxxx |
| 1387 | */ |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 1388 | if (argv) |
| 1389 | strncpy (sysid, argv, 254); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1390 | if (argv && strlen (argv) > 3) |
| 1391 | { |
| 1392 | pos = argv + strlen (argv) - 3; |
| 1393 | if (strncmp (pos, "-", 1) == 0) |
| 1394 | { |
| 1395 | memcpy (number, ++pos, 2); |
| 1396 | lspid[ISIS_SYS_ID_LEN+1] = (u_char) strtol ((char *)number, NULL, 16); |
| 1397 | pos -= 4; |
| 1398 | if (strncmp (pos, ".", 1) != 0) |
| 1399 | return CMD_ERR_AMBIGUOUS; |
| 1400 | } |
| 1401 | if (strncmp (pos, ".", 1) == 0) |
| 1402 | { |
| 1403 | memcpy (number, ++pos, 2); |
| 1404 | lspid[ISIS_SYS_ID_LEN] = (u_char) strtol ((char *)number, NULL, 16); |
| 1405 | sysid[pos - argv - 1] = '\0'; |
| 1406 | } |
| 1407 | } |
| 1408 | |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 1409 | for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area)) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1410 | { |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1411 | vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null", |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1412 | VTY_NEWLINE); |
| 1413 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1414 | for (level = 0; level < ISIS_LEVELS; level++) |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1415 | { |
| 1416 | if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0) |
| 1417 | { |
| 1418 | lsp = NULL; |
| 1419 | if (argv != NULL) |
| 1420 | { |
| 1421 | /* |
| 1422 | * Try to find the lsp-id if the argv string is in |
| 1423 | * the form hostname.<pseudo-id>-<fragment> |
| 1424 | */ |
| 1425 | if (sysid2buff (lspid, sysid)) |
| 1426 | { |
| 1427 | lsp = lsp_search (lspid, area->lspdb[level]); |
| 1428 | } |
| 1429 | else if ((dynhn = dynhn_find_by_name (sysid))) |
| 1430 | { |
| 1431 | memcpy (lspid, dynhn->id, ISIS_SYS_ID_LEN); |
| 1432 | lsp = lsp_search (lspid, area->lspdb[level]); |
| 1433 | } |
| 1434 | else if (strncmp(unix_hostname (), sysid, 15) == 0) |
| 1435 | { |
| 1436 | memcpy (lspid, isis->sysid, ISIS_SYS_ID_LEN); |
| 1437 | lsp = lsp_search (lspid, area->lspdb[level]); |
| 1438 | } |
| 1439 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1440 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1441 | if (lsp != NULL || argv == NULL) |
| 1442 | { |
| 1443 | vty_out (vty, "IS-IS Level-%d link-state database:%s", |
| 1444 | level + 1, VTY_NEWLINE); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1445 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1446 | /* print the title in all cases */ |
| 1447 | vty_out (vty, "LSP ID PduLen " |
| 1448 | "SeqNumber Chksum Holdtime ATT/P/OL%s", |
| 1449 | VTY_NEWLINE); |
| 1450 | } |
| 1451 | |
| 1452 | if (lsp) |
| 1453 | { |
| 1454 | if (ui_level == ISIS_UI_LEVEL_DETAIL) |
| 1455 | lsp_print_detail (lsp, vty, area->dynhostname); |
| 1456 | else |
| 1457 | lsp_print (lsp, vty, area->dynhostname); |
| 1458 | } |
| 1459 | else if (argv == NULL) |
| 1460 | { |
| 1461 | lsp_count = lsp_print_all (vty, area->lspdb[level], |
| 1462 | ui_level, |
| 1463 | area->dynhostname); |
| 1464 | |
| 1465 | vty_out (vty, " %u LSPs%s%s", |
| 1466 | lsp_count, VTY_NEWLINE, VTY_NEWLINE); |
| 1467 | } |
| 1468 | } |
| 1469 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1470 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1471 | |
| 1472 | return CMD_SUCCESS; |
| 1473 | } |
| 1474 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1475 | DEFUN (show_database_brief, |
| 1476 | show_database_cmd, |
| 1477 | "show isis database", |
| 1478 | SHOW_STR |
| 1479 | "IS-IS information\n" |
| 1480 | "IS-IS link state database\n") |
| 1481 | { |
| 1482 | return show_isis_database (vty, NULL, ISIS_UI_LEVEL_BRIEF); |
| 1483 | } |
| 1484 | |
| 1485 | DEFUN (show_database_lsp_brief, |
| 1486 | show_database_arg_cmd, |
| 1487 | "show isis database WORD", |
| 1488 | SHOW_STR |
| 1489 | "IS-IS information\n" |
| 1490 | "IS-IS link state database\n" |
| 1491 | "LSP ID\n") |
| 1492 | { |
| 1493 | return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_BRIEF); |
| 1494 | } |
| 1495 | |
| 1496 | DEFUN (show_database_lsp_detail, |
| 1497 | show_database_arg_detail_cmd, |
| 1498 | "show isis database WORD detail", |
| 1499 | SHOW_STR |
| 1500 | "IS-IS information\n" |
| 1501 | "IS-IS link state database\n" |
| 1502 | "LSP ID\n" |
| 1503 | "Detailed information\n") |
| 1504 | { |
| 1505 | return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_DETAIL); |
| 1506 | } |
| 1507 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1508 | DEFUN (show_database_detail, |
| 1509 | show_database_detail_cmd, |
| 1510 | "show isis database detail", |
| 1511 | SHOW_STR |
| 1512 | "IS-IS information\n" |
| 1513 | "IS-IS link state database\n") |
| 1514 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1515 | return show_isis_database (vty, NULL, ISIS_UI_LEVEL_DETAIL); |
| 1516 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1517 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1518 | DEFUN (show_database_detail_lsp, |
| 1519 | show_database_detail_arg_cmd, |
| 1520 | "show isis database detail WORD", |
| 1521 | SHOW_STR |
| 1522 | "IS-IS information\n" |
| 1523 | "IS-IS link state database\n" |
| 1524 | "Detailed information\n" |
| 1525 | "LSP ID\n") |
| 1526 | { |
| 1527 | return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_DETAIL); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1528 | } |
| 1529 | |
| 1530 | /* |
| 1531 | * 'router isis' command |
| 1532 | */ |
| 1533 | DEFUN (router_isis, |
| 1534 | router_isis_cmd, |
| 1535 | "router isis WORD", |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1536 | ROUTER_STR |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1537 | "ISO IS-IS\n" |
| 1538 | "ISO Routing area tag") |
| 1539 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1540 | return isis_area_get (vty, argv[0]); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1541 | } |
| 1542 | |
| 1543 | /* |
| 1544 | *'no router isis' command |
| 1545 | */ |
| 1546 | DEFUN (no_router_isis, |
| 1547 | no_router_isis_cmd, |
| 1548 | "no router isis WORD", |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1549 | "no\n" ROUTER_STR "ISO IS-IS\n" "ISO Routing area tag") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1550 | { |
| 1551 | return isis_area_destroy (vty, argv[0]); |
| 1552 | } |
| 1553 | |
| 1554 | /* |
| 1555 | * 'net' command |
| 1556 | */ |
| 1557 | DEFUN (net, |
| 1558 | net_cmd, |
| 1559 | "net WORD", |
| 1560 | "A Network Entity Title for this process (OSI only)\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1561 | "XX.XXXX. ... .XXX.XX Network entity title (NET)\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1562 | { |
Paul Jakma | 41b36e9 | 2006-12-08 01:09:50 +0000 | [diff] [blame] | 1563 | return area_net_title (vty, argv[0]); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1564 | } |
| 1565 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1566 | /* |
| 1567 | * 'no net' command |
| 1568 | */ |
| 1569 | DEFUN (no_net, |
| 1570 | no_net_cmd, |
| 1571 | "no net WORD", |
| 1572 | NO_STR |
| 1573 | "A Network Entity Title for this process (OSI only)\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1574 | "XX.XXXX. ... .XXX.XX Network entity title (NET)\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1575 | { |
Paul Jakma | 41b36e9 | 2006-12-08 01:09:50 +0000 | [diff] [blame] | 1576 | return area_clear_net_title (vty, argv[0]); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1577 | } |
| 1578 | |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame] | 1579 | static |
| 1580 | int area_set_lsp_mtu(struct vty *vty, struct isis_area *area, unsigned int lsp_mtu) |
| 1581 | { |
| 1582 | struct isis_circuit *circuit; |
| 1583 | struct listnode *node; |
| 1584 | |
| 1585 | for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit)) |
| 1586 | { |
| 1587 | if(lsp_mtu > isis_circuit_pdu_size(circuit)) |
| 1588 | { |
| 1589 | vty_out(vty, "ISIS area contains circuit %s, which has a maximum PDU size of %zu.%s", |
| 1590 | circuit->interface->name, isis_circuit_pdu_size(circuit), |
| 1591 | VTY_NEWLINE); |
| 1592 | return CMD_ERR_AMBIGUOUS; |
| 1593 | } |
| 1594 | } |
| 1595 | |
| 1596 | area->lsp_mtu = lsp_mtu; |
| 1597 | lsp_regenerate_schedule(area, IS_LEVEL_1_AND_2, 1); |
| 1598 | |
| 1599 | return CMD_SUCCESS; |
| 1600 | } |
| 1601 | |
| 1602 | DEFUN (area_lsp_mtu, |
| 1603 | area_lsp_mtu_cmd, |
| 1604 | "lsp-mtu <128-4352>", |
| 1605 | "Configure the maximum size of generated LSPs\n" |
| 1606 | "Maximum size of generated LSPs\n") |
| 1607 | { |
| 1608 | struct isis_area *area; |
| 1609 | |
| 1610 | area = vty->index; |
| 1611 | if (!area) |
| 1612 | { |
| 1613 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
| 1614 | return CMD_ERR_NO_MATCH; |
| 1615 | } |
| 1616 | |
| 1617 | unsigned int lsp_mtu; |
| 1618 | |
| 1619 | VTY_GET_INTEGER_RANGE("lsp-mtu", lsp_mtu, argv[0], 128, 4352); |
| 1620 | |
| 1621 | return area_set_lsp_mtu(vty, area, lsp_mtu); |
| 1622 | } |
| 1623 | |
| 1624 | DEFUN(no_area_lsp_mtu, |
| 1625 | no_area_lsp_mtu_cmd, |
| 1626 | "no lsp-mtu", |
| 1627 | NO_STR |
| 1628 | "Configure the maximum size of generated LSPs\n") |
| 1629 | { |
| 1630 | struct isis_area *area; |
| 1631 | |
| 1632 | area = vty->index; |
| 1633 | if (!area) |
| 1634 | { |
| 1635 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
| 1636 | return CMD_ERR_NO_MATCH; |
| 1637 | } |
| 1638 | |
| 1639 | return area_set_lsp_mtu(vty, area, DEFAULT_LSP_MTU); |
| 1640 | } |
| 1641 | |
| 1642 | ALIAS(no_area_lsp_mtu, |
| 1643 | no_area_lsp_mtu_arg_cmd, |
| 1644 | "no lsp-mtu <128-4352>", |
| 1645 | NO_STR |
| 1646 | "Configure the maximum size of generated LSPs\n" |
| 1647 | "Maximum size of generated LSPs\n"); |
| 1648 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1649 | DEFUN (area_passwd_md5, |
| 1650 | area_passwd_md5_cmd, |
| 1651 | "area-password md5 WORD", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1652 | "Configure the authentication password for an area\n" |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1653 | "Authentication type\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1654 | "Area password\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1655 | { |
| 1656 | struct isis_area *area; |
| 1657 | int len; |
| 1658 | |
| 1659 | area = vty->index; |
| 1660 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1661 | if (!area) |
| 1662 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1663 | vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE); |
| 1664 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1665 | } |
| 1666 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1667 | len = strlen (argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1668 | if (len > 254) |
| 1669 | { |
| 1670 | vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1671 | return CMD_ERR_AMBIGUOUS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1672 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1673 | |
| 1674 | area->area_passwd.len = (u_char) len; |
| 1675 | area->area_passwd.type = ISIS_PASSWD_TYPE_HMAC_MD5; |
| 1676 | strncpy ((char *)area->area_passwd.passwd, argv[0], 255); |
| 1677 | |
| 1678 | if (argc > 1) |
| 1679 | { |
| 1680 | SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND); |
| 1681 | if (strncmp(argv[1], "v", 1) == 0) |
| 1682 | SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV); |
| 1683 | else |
| 1684 | UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV); |
| 1685 | } |
| 1686 | else |
| 1687 | { |
| 1688 | UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND); |
| 1689 | UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV); |
| 1690 | } |
| 1691 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1); |
| 1692 | |
| 1693 | return CMD_SUCCESS; |
| 1694 | } |
| 1695 | |
| 1696 | ALIAS (area_passwd_md5, |
| 1697 | area_passwd_md5_snpauth_cmd, |
| 1698 | "area-password md5 WORD authenticate snp (send-only|validate)", |
| 1699 | "Configure the authentication password for an area\n" |
| 1700 | "Authentication type\n" |
| 1701 | "Area password\n" |
| 1702 | "Authentication\n" |
| 1703 | "SNP PDUs\n" |
| 1704 | "Send but do not check PDUs on receiving\n" |
David Lamparter | b7d5021 | 2015-03-03 08:53:18 +0100 | [diff] [blame] | 1705 | "Send and check PDUs on receiving\n") |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1706 | |
| 1707 | DEFUN (area_passwd_clear, |
| 1708 | area_passwd_clear_cmd, |
| 1709 | "area-password clear WORD", |
| 1710 | "Configure the authentication password for an area\n" |
| 1711 | "Authentication type\n" |
| 1712 | "Area password\n") |
| 1713 | { |
| 1714 | struct isis_area *area; |
| 1715 | int len; |
| 1716 | |
| 1717 | area = vty->index; |
| 1718 | |
| 1719 | if (!area) |
| 1720 | { |
| 1721 | vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE); |
| 1722 | return CMD_ERR_NO_MATCH; |
| 1723 | } |
| 1724 | |
| 1725 | len = strlen (argv[0]); |
| 1726 | if (len > 254) |
| 1727 | { |
| 1728 | vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE); |
| 1729 | return CMD_ERR_AMBIGUOUS; |
| 1730 | } |
| 1731 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1732 | area->area_passwd.len = (u_char) len; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1733 | area->area_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT; |
hasso | f7c43dc | 2004-09-26 16:24:14 +0000 | [diff] [blame] | 1734 | strncpy ((char *)area->area_passwd.passwd, argv[0], 255); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1735 | |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1736 | if (argc > 1) |
| 1737 | { |
| 1738 | SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND); |
| 1739 | if (strncmp(argv[1], "v", 1) == 0) |
| 1740 | SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV); |
| 1741 | else |
| 1742 | UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV); |
| 1743 | } |
| 1744 | else |
| 1745 | { |
| 1746 | UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND); |
| 1747 | UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV); |
| 1748 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1749 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1); |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1750 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1751 | return CMD_SUCCESS; |
| 1752 | } |
| 1753 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1754 | ALIAS (area_passwd_clear, |
| 1755 | area_passwd_clear_snpauth_cmd, |
| 1756 | "area-password clear WORD authenticate snp (send-only|validate)", |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1757 | "Configure the authentication password for an area\n" |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1758 | "Authentication type\n" |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1759 | "Area password\n" |
| 1760 | "Authentication\n" |
| 1761 | "SNP PDUs\n" |
| 1762 | "Send but do not check PDUs on receiving\n" |
David Lamparter | b7d5021 | 2015-03-03 08:53:18 +0100 | [diff] [blame] | 1763 | "Send and check PDUs on receiving\n") |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1764 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1765 | DEFUN (no_area_passwd, |
| 1766 | no_area_passwd_cmd, |
| 1767 | "no area-password", |
| 1768 | NO_STR |
| 1769 | "Configure the authentication password for an area\n") |
| 1770 | { |
| 1771 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1772 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1773 | area = vty->index; |
| 1774 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1775 | if (!area) |
| 1776 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1777 | vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE); |
| 1778 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1779 | } |
| 1780 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1781 | memset (&area->area_passwd, 0, sizeof (struct isis_passwd)); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1782 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1783 | |
| 1784 | return CMD_SUCCESS; |
| 1785 | } |
| 1786 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1787 | DEFUN (domain_passwd_md5, |
| 1788 | domain_passwd_md5_cmd, |
| 1789 | "domain-password md5 WORD", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1790 | "Set the authentication password for a routing domain\n" |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1791 | "Authentication type\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1792 | "Routing domain password\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1793 | { |
| 1794 | struct isis_area *area; |
| 1795 | int len; |
| 1796 | |
| 1797 | area = vty->index; |
| 1798 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1799 | if (!area) |
| 1800 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1801 | vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE); |
| 1802 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1803 | } |
| 1804 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1805 | len = strlen (argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1806 | if (len > 254) |
| 1807 | { |
| 1808 | vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1809 | return CMD_ERR_AMBIGUOUS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1810 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1811 | |
| 1812 | area->domain_passwd.len = (u_char) len; |
| 1813 | area->domain_passwd.type = ISIS_PASSWD_TYPE_HMAC_MD5; |
| 1814 | strncpy ((char *)area->domain_passwd.passwd, argv[0], 255); |
| 1815 | |
| 1816 | if (argc > 1) |
| 1817 | { |
| 1818 | SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND); |
| 1819 | if (strncmp(argv[1], "v", 1) == 0) |
| 1820 | SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV); |
| 1821 | else |
| 1822 | UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV); |
| 1823 | } |
| 1824 | else |
| 1825 | { |
| 1826 | UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND); |
| 1827 | UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV); |
| 1828 | } |
| 1829 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1); |
| 1830 | |
| 1831 | return CMD_SUCCESS; |
| 1832 | } |
| 1833 | |
| 1834 | ALIAS (domain_passwd_md5, |
| 1835 | domain_passwd_md5_snpauth_cmd, |
| 1836 | "domain-password md5 WORD authenticate snp (send-only|validate)", |
| 1837 | "Set the authentication password for a routing domain\n" |
| 1838 | "Authentication type\n" |
| 1839 | "Routing domain password\n" |
| 1840 | "Authentication\n" |
| 1841 | "SNP PDUs\n" |
| 1842 | "Send but do not check PDUs on receiving\n" |
David Lamparter | b7d5021 | 2015-03-03 08:53:18 +0100 | [diff] [blame] | 1843 | "Send and check PDUs on receiving\n") |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1844 | |
| 1845 | DEFUN (domain_passwd_clear, |
| 1846 | domain_passwd_clear_cmd, |
| 1847 | "domain-password clear WORD", |
| 1848 | "Set the authentication password for a routing domain\n" |
| 1849 | "Authentication type\n" |
| 1850 | "Routing domain password\n") |
| 1851 | { |
| 1852 | struct isis_area *area; |
| 1853 | int len; |
| 1854 | |
| 1855 | area = vty->index; |
| 1856 | |
| 1857 | if (!area) |
| 1858 | { |
| 1859 | vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE); |
| 1860 | return CMD_ERR_NO_MATCH; |
| 1861 | } |
| 1862 | |
| 1863 | len = strlen (argv[0]); |
| 1864 | if (len > 254) |
| 1865 | { |
| 1866 | vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE); |
| 1867 | return CMD_ERR_AMBIGUOUS; |
| 1868 | } |
| 1869 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1870 | area->domain_passwd.len = (u_char) len; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1871 | area->domain_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT; |
hasso | f7c43dc | 2004-09-26 16:24:14 +0000 | [diff] [blame] | 1872 | strncpy ((char *)area->domain_passwd.passwd, argv[0], 255); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1873 | |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1874 | if (argc > 1) |
| 1875 | { |
| 1876 | SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND); |
| 1877 | if (strncmp(argv[1], "v", 1) == 0) |
| 1878 | SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV); |
| 1879 | else |
| 1880 | UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV); |
| 1881 | } |
| 1882 | else |
| 1883 | { |
| 1884 | UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND); |
| 1885 | UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV); |
| 1886 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1887 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1); |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1888 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1889 | return CMD_SUCCESS; |
| 1890 | } |
| 1891 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1892 | ALIAS (domain_passwd_clear, |
| 1893 | domain_passwd_clear_snpauth_cmd, |
| 1894 | "domain-password clear WORD authenticate snp (send-only|validate)", |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1895 | "Set the authentication password for a routing domain\n" |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1896 | "Authentication type\n" |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1897 | "Routing domain password\n" |
| 1898 | "Authentication\n" |
| 1899 | "SNP PDUs\n" |
| 1900 | "Send but do not check PDUs on receiving\n" |
David Lamparter | b7d5021 | 2015-03-03 08:53:18 +0100 | [diff] [blame] | 1901 | "Send and check PDUs on receiving\n") |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1902 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1903 | DEFUN (no_domain_passwd, |
| 1904 | no_domain_passwd_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1905 | "no domain-password", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1906 | NO_STR |
| 1907 | "Set the authentication password for a routing domain\n") |
| 1908 | { |
| 1909 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1910 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1911 | area = vty->index; |
| 1912 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1913 | if (!area) |
| 1914 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1915 | vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE); |
| 1916 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1917 | } |
| 1918 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1919 | memset (&area->domain_passwd, 0, sizeof (struct isis_passwd)); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1920 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1921 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1922 | return CMD_SUCCESS; |
| 1923 | } |
| 1924 | |
| 1925 | DEFUN (is_type, |
| 1926 | is_type_cmd, |
| 1927 | "is-type (level-1|level-1-2|level-2-only)", |
| 1928 | "IS Level for this routing process (OSI only)\n" |
| 1929 | "Act as a station router only\n" |
| 1930 | "Act as both a station router and an area router\n" |
| 1931 | "Act as an area router only\n") |
| 1932 | { |
| 1933 | struct isis_area *area; |
| 1934 | int type; |
| 1935 | |
| 1936 | area = vty->index; |
| 1937 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1938 | if (!area) |
| 1939 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1940 | vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE); |
| 1941 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1942 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1943 | |
Paul Jakma | 41b36e9 | 2006-12-08 01:09:50 +0000 | [diff] [blame] | 1944 | type = string2circuit_t (argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1945 | if (!type) |
| 1946 | { |
| 1947 | vty_out (vty, "Unknown IS level %s", VTY_NEWLINE); |
| 1948 | return CMD_SUCCESS; |
| 1949 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1950 | |
| 1951 | isis_event_system_type_change (area, type); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1952 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1953 | return CMD_SUCCESS; |
| 1954 | } |
| 1955 | |
| 1956 | DEFUN (no_is_type, |
| 1957 | no_is_type_cmd, |
| 1958 | "no is-type (level-1|level-1-2|level-2-only)", |
| 1959 | NO_STR |
| 1960 | "IS Level for this routing process (OSI only)\n" |
| 1961 | "Act as a station router only\n" |
| 1962 | "Act as both a station router and an area router\n" |
| 1963 | "Act as an area router only\n") |
| 1964 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1965 | struct isis_area *area; |
| 1966 | int type; |
| 1967 | |
| 1968 | area = vty->index; |
| 1969 | assert (area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1970 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1971 | /* |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1972 | * Put the is-type back to defaults: |
| 1973 | * - level-1-2 on first area |
| 1974 | * - level-1 for the rest |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1975 | */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 1976 | if (listgetdata (listhead (isis->area_list)) == area) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1977 | type = IS_LEVEL_1_AND_2; |
| 1978 | else |
| 1979 | type = IS_LEVEL_1; |
| 1980 | |
| 1981 | isis_event_system_type_change (area, type); |
| 1982 | |
| 1983 | return CMD_SUCCESS; |
| 1984 | } |
| 1985 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1986 | static int |
| 1987 | set_lsp_gen_interval (struct vty *vty, struct isis_area *area, |
| 1988 | uint16_t interval, int level) |
| 1989 | { |
| 1990 | int lvl; |
| 1991 | |
| 1992 | for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl) |
| 1993 | { |
| 1994 | if (!(lvl & level)) |
| 1995 | continue; |
| 1996 | |
| 1997 | if (interval >= area->lsp_refresh[lvl-1]) |
| 1998 | { |
| 1999 | vty_out (vty, "LSP gen interval %us must be less than " |
| 2000 | "the LSP refresh interval %us%s", |
| 2001 | interval, area->lsp_refresh[lvl-1], VTY_NEWLINE); |
| 2002 | return CMD_ERR_AMBIGUOUS; |
| 2003 | } |
| 2004 | } |
| 2005 | |
| 2006 | for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl) |
| 2007 | { |
| 2008 | if (!(lvl & level)) |
| 2009 | continue; |
| 2010 | area->lsp_gen_interval[lvl-1] = interval; |
| 2011 | } |
| 2012 | |
| 2013 | return CMD_SUCCESS; |
| 2014 | } |
| 2015 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2016 | DEFUN (lsp_gen_interval, |
| 2017 | lsp_gen_interval_cmd, |
| 2018 | "lsp-gen-interval <1-120>", |
| 2019 | "Minimum interval between regenerating same LSP\n" |
| 2020 | "Minimum interval in seconds\n") |
| 2021 | { |
| 2022 | struct isis_area *area; |
| 2023 | uint16_t interval; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2024 | int level; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2025 | |
| 2026 | area = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2027 | interval = atoi (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2028 | level = IS_LEVEL_1 | IS_LEVEL_2; |
| 2029 | return set_lsp_gen_interval (vty, area, interval, level); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2030 | } |
| 2031 | |
| 2032 | DEFUN (no_lsp_gen_interval, |
| 2033 | no_lsp_gen_interval_cmd, |
| 2034 | "no lsp-gen-interval", |
| 2035 | NO_STR |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2036 | "Minimum interval between regenerating same LSP\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2037 | { |
| 2038 | struct isis_area *area; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2039 | uint16_t interval; |
| 2040 | int level; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2041 | |
| 2042 | area = vty->index; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2043 | interval = DEFAULT_MIN_LSP_GEN_INTERVAL; |
| 2044 | level = IS_LEVEL_1 | IS_LEVEL_2; |
| 2045 | return set_lsp_gen_interval (vty, area, interval, level); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2046 | } |
| 2047 | |
| 2048 | ALIAS (no_lsp_gen_interval, |
| 2049 | no_lsp_gen_interval_arg_cmd, |
| 2050 | "no lsp-gen-interval <1-120>", |
| 2051 | NO_STR |
| 2052 | "Minimum interval between regenerating same LSP\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2053 | "Minimum interval in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2054 | |
| 2055 | DEFUN (lsp_gen_interval_l1, |
| 2056 | lsp_gen_interval_l1_cmd, |
| 2057 | "lsp-gen-interval level-1 <1-120>", |
| 2058 | "Minimum interval between regenerating same LSP\n" |
| 2059 | "Set interval for level 1 only\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2060 | "Minimum interval in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2061 | { |
| 2062 | struct isis_area *area; |
| 2063 | uint16_t interval; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2064 | int level; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2065 | |
| 2066 | area = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2067 | interval = atoi (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2068 | level = IS_LEVEL_1; |
| 2069 | return set_lsp_gen_interval (vty, area, interval, level); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2070 | } |
| 2071 | |
| 2072 | DEFUN (no_lsp_gen_interval_l1, |
| 2073 | no_lsp_gen_interval_l1_cmd, |
| 2074 | "no lsp-gen-interval level-1", |
| 2075 | NO_STR |
| 2076 | "Minimum interval between regenerating same LSP\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2077 | "Set interval for level 1 only\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2078 | { |
| 2079 | struct isis_area *area; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2080 | uint16_t interval; |
| 2081 | int level; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2082 | |
| 2083 | area = vty->index; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2084 | interval = DEFAULT_MIN_LSP_GEN_INTERVAL; |
| 2085 | level = IS_LEVEL_1; |
| 2086 | return set_lsp_gen_interval (vty, area, interval, level); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2087 | } |
| 2088 | |
| 2089 | ALIAS (no_lsp_gen_interval_l1, |
| 2090 | no_lsp_gen_interval_l1_arg_cmd, |
| 2091 | "no lsp-gen-interval level-1 <1-120>", |
| 2092 | NO_STR |
| 2093 | "Minimum interval between regenerating same LSP\n" |
| 2094 | "Set interval for level 1 only\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2095 | "Minimum interval in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2096 | |
| 2097 | DEFUN (lsp_gen_interval_l2, |
| 2098 | lsp_gen_interval_l2_cmd, |
| 2099 | "lsp-gen-interval level-2 <1-120>", |
| 2100 | "Minimum interval between regenerating same LSP\n" |
| 2101 | "Set interval for level 2 only\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2102 | "Minimum interval in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2103 | { |
| 2104 | struct isis_area *area; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2105 | uint16_t interval; |
| 2106 | int level; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2107 | |
| 2108 | area = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2109 | interval = atoi (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2110 | level = IS_LEVEL_2; |
| 2111 | return set_lsp_gen_interval (vty, area, interval, level); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2112 | } |
| 2113 | |
| 2114 | DEFUN (no_lsp_gen_interval_l2, |
| 2115 | no_lsp_gen_interval_l2_cmd, |
| 2116 | "no lsp-gen-interval level-2", |
| 2117 | NO_STR |
| 2118 | "Minimum interval between regenerating same LSP\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2119 | "Set interval for level 2 only\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2120 | { |
| 2121 | struct isis_area *area; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2122 | uint16_t interval; |
| 2123 | int level; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2124 | |
| 2125 | area = vty->index; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2126 | interval = DEFAULT_MIN_LSP_GEN_INTERVAL; |
| 2127 | level = IS_LEVEL_2; |
| 2128 | return set_lsp_gen_interval (vty, area, interval, level); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2129 | } |
| 2130 | |
| 2131 | ALIAS (no_lsp_gen_interval_l2, |
| 2132 | no_lsp_gen_interval_l2_arg_cmd, |
| 2133 | "no lsp-gen-interval level-2 <1-120>", |
| 2134 | NO_STR |
| 2135 | "Minimum interval between regenerating same LSP\n" |
| 2136 | "Set interval for level 2 only\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2137 | "Minimum interval in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2138 | |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 2139 | static int |
| 2140 | validate_metric_style_narrow (struct vty *vty, struct isis_area *area) |
| 2141 | { |
| 2142 | struct isis_circuit *circuit; |
| 2143 | struct listnode *node; |
| 2144 | |
| 2145 | if (! vty) |
| 2146 | return CMD_ERR_AMBIGUOUS; |
| 2147 | |
| 2148 | if (! area) |
| 2149 | { |
| 2150 | vty_out (vty, "ISIS area is invalid%s", VTY_NEWLINE); |
| 2151 | return CMD_ERR_AMBIGUOUS; |
| 2152 | } |
| 2153 | |
| 2154 | for (ALL_LIST_ELEMENTS_RO (area->circuit_list, node, circuit)) |
| 2155 | { |
| 2156 | if ((area->is_type & IS_LEVEL_1) && |
| 2157 | (circuit->is_type & IS_LEVEL_1) && |
Christian Franke | 4fb7c84 | 2012-11-27 19:51:59 +0000 | [diff] [blame] | 2158 | (circuit->te_metric[0] > MAX_NARROW_LINK_METRIC)) |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 2159 | { |
| 2160 | vty_out (vty, "ISIS circuit %s metric is invalid%s", |
| 2161 | circuit->interface->name, VTY_NEWLINE); |
| 2162 | return CMD_ERR_AMBIGUOUS; |
| 2163 | } |
| 2164 | if ((area->is_type & IS_LEVEL_2) && |
| 2165 | (circuit->is_type & IS_LEVEL_2) && |
Christian Franke | 4fb7c84 | 2012-11-27 19:51:59 +0000 | [diff] [blame] | 2166 | (circuit->te_metric[1] > MAX_NARROW_LINK_METRIC)) |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 2167 | { |
| 2168 | vty_out (vty, "ISIS circuit %s metric is invalid%s", |
| 2169 | circuit->interface->name, VTY_NEWLINE); |
| 2170 | return CMD_ERR_AMBIGUOUS; |
| 2171 | } |
| 2172 | } |
| 2173 | |
| 2174 | return CMD_SUCCESS; |
| 2175 | } |
| 2176 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2177 | DEFUN (metric_style, |
| 2178 | metric_style_cmd, |
hasso | 2984d26 | 2005-09-26 16:49:07 +0000 | [diff] [blame] | 2179 | "metric-style (narrow|transition|wide)", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2180 | "Use old-style (ISO 10589) or new-style packet formats\n" |
| 2181 | "Use old style of TLVs with narrow metric\n" |
hasso | 2984d26 | 2005-09-26 16:49:07 +0000 | [diff] [blame] | 2182 | "Send and accept both styles of TLVs during transition\n" |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2183 | "Use new style of TLVs to carry wider metric\n") |
| 2184 | { |
| 2185 | struct isis_area *area; |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 2186 | int ret; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2187 | |
| 2188 | area = vty->index; |
| 2189 | assert (area); |
hasso | 2984d26 | 2005-09-26 16:49:07 +0000 | [diff] [blame] | 2190 | |
| 2191 | if (strncmp (argv[0], "w", 1) == 0) |
| 2192 | { |
| 2193 | area->newmetric = 1; |
| 2194 | area->oldmetric = 0; |
| 2195 | } |
Christian Franke | 478c112 | 2012-11-27 19:52:00 +0000 | [diff] [blame] | 2196 | else |
hasso | 2984d26 | 2005-09-26 16:49:07 +0000 | [diff] [blame] | 2197 | { |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 2198 | ret = validate_metric_style_narrow (vty, area); |
| 2199 | if (ret != CMD_SUCCESS) |
| 2200 | return ret; |
| 2201 | |
Christian Franke | 478c112 | 2012-11-27 19:52:00 +0000 | [diff] [blame] | 2202 | if (strncmp (argv[0], "t", 1) == 0) |
| 2203 | { |
| 2204 | area->newmetric = 1; |
| 2205 | area->oldmetric = 1; |
| 2206 | } |
| 2207 | else if (strncmp (argv[0], "n", 1) == 0) |
| 2208 | { |
| 2209 | area->newmetric = 0; |
| 2210 | area->oldmetric = 1; |
| 2211 | } |
hasso | 2984d26 | 2005-09-26 16:49:07 +0000 | [diff] [blame] | 2212 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2213 | |
| 2214 | return CMD_SUCCESS; |
| 2215 | } |
| 2216 | |
| 2217 | DEFUN (no_metric_style, |
| 2218 | no_metric_style_cmd, |
hasso | 2984d26 | 2005-09-26 16:49:07 +0000 | [diff] [blame] | 2219 | "no metric-style", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2220 | NO_STR |
hasso | 2984d26 | 2005-09-26 16:49:07 +0000 | [diff] [blame] | 2221 | "Use old-style (ISO 10589) or new-style packet formats\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2222 | { |
| 2223 | struct isis_area *area; |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 2224 | int ret; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2225 | |
| 2226 | area = vty->index; |
| 2227 | assert (area); |
| 2228 | |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 2229 | ret = validate_metric_style_narrow (vty, area); |
| 2230 | if (ret != CMD_SUCCESS) |
| 2231 | return ret; |
| 2232 | |
hasso | 2984d26 | 2005-09-26 16:49:07 +0000 | [diff] [blame] | 2233 | /* Default is narrow metric. */ |
| 2234 | area->newmetric = 0; |
| 2235 | area->oldmetric = 1; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2236 | |
| 2237 | return CMD_SUCCESS; |
| 2238 | } |
| 2239 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2240 | DEFUN (set_overload_bit, |
| 2241 | set_overload_bit_cmd, |
| 2242 | "set-overload-bit", |
| 2243 | "Set overload bit to avoid any transit traffic\n" |
| 2244 | "Set overload bit\n") |
| 2245 | { |
| 2246 | struct isis_area *area; |
| 2247 | |
| 2248 | area = vty->index; |
| 2249 | assert (area); |
| 2250 | |
| 2251 | area->overload_bit = LSPBIT_OL; |
| 2252 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1); |
| 2253 | |
| 2254 | return CMD_SUCCESS; |
| 2255 | } |
| 2256 | |
| 2257 | DEFUN (no_set_overload_bit, |
| 2258 | no_set_overload_bit_cmd, |
| 2259 | "no set-overload-bit", |
| 2260 | "Reset overload bit to accept transit traffic\n" |
| 2261 | "Reset overload bit\n") |
| 2262 | { |
| 2263 | struct isis_area *area; |
| 2264 | |
| 2265 | area = vty->index; |
| 2266 | assert (area); |
| 2267 | |
| 2268 | area->overload_bit = 0; |
| 2269 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1); |
| 2270 | |
| 2271 | return CMD_SUCCESS; |
| 2272 | } |
| 2273 | |
Amritha Nambiar | c8ee940 | 2015-08-24 16:40:14 -0700 | [diff] [blame] | 2274 | DEFUN (set_attached_bit, |
| 2275 | set_attached_bit_cmd, |
| 2276 | "set-attached-bit", |
| 2277 | "Set attached bit to identify as L1/L2 router for inter-area traffic\n" |
| 2278 | "Set attached bit\n") |
| 2279 | { |
| 2280 | struct isis_area *area; |
| 2281 | |
| 2282 | area = vty->index; |
| 2283 | assert (area); |
| 2284 | |
| 2285 | area->attached_bit = LSPBIT_ATT; |
| 2286 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1); |
| 2287 | |
| 2288 | return CMD_SUCCESS; |
| 2289 | } |
| 2290 | |
| 2291 | DEFUN (no_set_attached_bit, |
| 2292 | no_set_attached_bit_cmd, |
| 2293 | "no set-attached-bit", |
| 2294 | "Reset attached bit\n") |
| 2295 | { |
| 2296 | struct isis_area *area; |
| 2297 | |
| 2298 | area = vty->index; |
| 2299 | assert (area); |
| 2300 | |
| 2301 | area->attached_bit = 0; |
| 2302 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1); |
| 2303 | |
| 2304 | return CMD_SUCCESS; |
| 2305 | } |
| 2306 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2307 | DEFUN (dynamic_hostname, |
| 2308 | dynamic_hostname_cmd, |
| 2309 | "hostname dynamic", |
| 2310 | "Dynamic hostname for IS-IS\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2311 | "Dynamic hostname\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2312 | { |
| 2313 | struct isis_area *area; |
| 2314 | |
| 2315 | area = vty->index; |
| 2316 | assert (area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2317 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2318 | if (!area->dynhostname) |
| 2319 | { |
| 2320 | area->dynhostname = 1; |
| 2321 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 0); |
| 2322 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2323 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2324 | return CMD_SUCCESS; |
| 2325 | } |
| 2326 | |
| 2327 | DEFUN (no_dynamic_hostname, |
| 2328 | no_dynamic_hostname_cmd, |
| 2329 | "no hostname dynamic", |
| 2330 | NO_STR |
| 2331 | "Dynamic hostname for IS-IS\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2332 | "Dynamic hostname\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2333 | { |
| 2334 | struct isis_area *area; |
| 2335 | |
| 2336 | area = vty->index; |
| 2337 | assert (area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2338 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2339 | if (area->dynhostname) |
| 2340 | { |
| 2341 | area->dynhostname = 0; |
| 2342 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 0); |
| 2343 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2344 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2345 | return CMD_SUCCESS; |
| 2346 | } |
| 2347 | |
| 2348 | DEFUN (spf_interval, |
| 2349 | spf_interval_cmd, |
| 2350 | "spf-interval <1-120>", |
hasso | 2097cd8 | 2003-12-23 11:51:08 +0000 | [diff] [blame] | 2351 | "Minimum interval between SPF calculations\n" |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2352 | "Minimum interval between consecutive SPFs in seconds\n") |
| 2353 | { |
| 2354 | struct isis_area *area; |
| 2355 | u_int16_t interval; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2356 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2357 | area = vty->index; |
| 2358 | interval = atoi (argv[0]); |
| 2359 | area->min_spf_interval[0] = interval; |
| 2360 | area->min_spf_interval[1] = interval; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2361 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2362 | return CMD_SUCCESS; |
| 2363 | } |
| 2364 | |
| 2365 | DEFUN (no_spf_interval, |
| 2366 | no_spf_interval_cmd, |
| 2367 | "no spf-interval", |
| 2368 | NO_STR |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2369 | "Minimum interval between SPF calculations\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2370 | { |
| 2371 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2372 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2373 | area = vty->index; |
| 2374 | |
| 2375 | area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL; |
| 2376 | area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2377 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2378 | return CMD_SUCCESS; |
| 2379 | } |
| 2380 | |
| 2381 | ALIAS (no_spf_interval, |
| 2382 | no_spf_interval_arg_cmd, |
| 2383 | "no spf-interval <1-120>", |
| 2384 | NO_STR |
| 2385 | "Minimum interval between SPF calculations\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2386 | "Minimum interval between consecutive SPFs in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2387 | |
| 2388 | DEFUN (spf_interval_l1, |
| 2389 | spf_interval_l1_cmd, |
| 2390 | "spf-interval level-1 <1-120>", |
| 2391 | "Minimum interval between SPF calculations\n" |
| 2392 | "Set interval for level 1 only\n" |
| 2393 | "Minimum interval between consecutive SPFs in seconds\n") |
| 2394 | { |
| 2395 | struct isis_area *area; |
| 2396 | u_int16_t interval; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2397 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2398 | area = vty->index; |
| 2399 | interval = atoi (argv[0]); |
| 2400 | area->min_spf_interval[0] = interval; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2401 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2402 | return CMD_SUCCESS; |
| 2403 | } |
| 2404 | |
| 2405 | DEFUN (no_spf_interval_l1, |
| 2406 | no_spf_interval_l1_cmd, |
| 2407 | "no spf-interval level-1", |
| 2408 | NO_STR |
| 2409 | "Minimum interval between SPF calculations\n" |
| 2410 | "Set interval for level 1 only\n") |
| 2411 | { |
| 2412 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2413 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2414 | area = vty->index; |
| 2415 | |
| 2416 | area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2417 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2418 | return CMD_SUCCESS; |
| 2419 | } |
| 2420 | |
| 2421 | ALIAS (no_spf_interval, |
| 2422 | no_spf_interval_l1_arg_cmd, |
| 2423 | "no spf-interval level-1 <1-120>", |
| 2424 | NO_STR |
| 2425 | "Minimum interval between SPF calculations\n" |
| 2426 | "Set interval for level 1 only\n" |
| 2427 | "Minimum interval between consecutive SPFs in seconds\n") |
| 2428 | |
| 2429 | DEFUN (spf_interval_l2, |
| 2430 | spf_interval_l2_cmd, |
| 2431 | "spf-interval level-2 <1-120>", |
| 2432 | "Minimum interval between SPF calculations\n" |
| 2433 | "Set interval for level 2 only\n" |
| 2434 | "Minimum interval between consecutive SPFs in seconds\n") |
| 2435 | { |
| 2436 | struct isis_area *area; |
| 2437 | u_int16_t interval; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2438 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2439 | area = vty->index; |
| 2440 | interval = atoi (argv[0]); |
| 2441 | area->min_spf_interval[1] = interval; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2442 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2443 | return CMD_SUCCESS; |
| 2444 | } |
| 2445 | |
| 2446 | DEFUN (no_spf_interval_l2, |
| 2447 | no_spf_interval_l2_cmd, |
| 2448 | "no spf-interval level-2", |
| 2449 | NO_STR |
| 2450 | "Minimum interval between SPF calculations\n" |
| 2451 | "Set interval for level 2 only\n") |
| 2452 | { |
| 2453 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2454 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2455 | area = vty->index; |
| 2456 | |
| 2457 | area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2458 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2459 | return CMD_SUCCESS; |
| 2460 | } |
| 2461 | |
| 2462 | ALIAS (no_spf_interval, |
| 2463 | no_spf_interval_l2_arg_cmd, |
| 2464 | "no spf-interval level-2 <1-120>", |
| 2465 | NO_STR |
| 2466 | "Minimum interval between SPF calculations\n" |
| 2467 | "Set interval for level 2 only\n" |
| 2468 | "Minimum interval between consecutive SPFs in seconds\n") |
| 2469 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2470 | static int |
| 2471 | set_lsp_max_lifetime (struct vty *vty, struct isis_area *area, |
| 2472 | uint16_t interval, int level) |
| 2473 | { |
| 2474 | int lvl; |
| 2475 | int set_refresh_interval[ISIS_LEVELS] = {0, 0}; |
| 2476 | uint16_t refresh_interval; |
| 2477 | |
| 2478 | refresh_interval = interval - 300; |
| 2479 | |
| 2480 | for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; lvl++) |
| 2481 | { |
| 2482 | if (!(lvl & level)) |
| 2483 | continue; |
| 2484 | if (refresh_interval < area->lsp_refresh[lvl-1]) |
| 2485 | { |
| 2486 | vty_out (vty, "Level %d Max LSP lifetime %us must be 300s greater than " |
| 2487 | "the configured LSP refresh interval %us%s", |
| 2488 | lvl, interval, area->lsp_refresh[lvl-1], VTY_NEWLINE); |
| 2489 | vty_out (vty, "Automatically reducing level %d LSP refresh interval " |
| 2490 | "to %us%s", lvl, refresh_interval, VTY_NEWLINE); |
| 2491 | set_refresh_interval[lvl-1] = 1; |
| 2492 | |
| 2493 | if (refresh_interval <= area->lsp_gen_interval[lvl-1]) |
| 2494 | { |
| 2495 | vty_out (vty, "LSP refresh interval %us must be greater than " |
| 2496 | "the configured LSP gen interval %us%s", |
| 2497 | refresh_interval, area->lsp_gen_interval[lvl-1], |
| 2498 | VTY_NEWLINE); |
| 2499 | return CMD_ERR_AMBIGUOUS; |
| 2500 | } |
| 2501 | } |
| 2502 | } |
| 2503 | |
| 2504 | for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; lvl++) |
| 2505 | { |
| 2506 | if (!(lvl & level)) |
| 2507 | continue; |
| 2508 | area->max_lsp_lifetime[lvl-1] = interval; |
| 2509 | /* Automatically reducing lsp_refresh_interval to interval - 300 */ |
| 2510 | if (set_refresh_interval[lvl-1]) |
| 2511 | area->lsp_refresh[lvl-1] = refresh_interval; |
| 2512 | } |
| 2513 | |
| 2514 | lsp_regenerate_schedule (area, level, 1); |
| 2515 | |
| 2516 | return CMD_SUCCESS; |
| 2517 | } |
| 2518 | |
| 2519 | DEFUN (max_lsp_lifetime, |
| 2520 | max_lsp_lifetime_cmd, |
| 2521 | "max-lsp-lifetime <350-65535>", |
| 2522 | "Maximum LSP lifetime\n" |
| 2523 | "LSP lifetime in seconds\n") |
| 2524 | { |
| 2525 | struct isis_area *area; |
| 2526 | uint16_t interval; |
| 2527 | int level; |
| 2528 | |
| 2529 | area = vty->index; |
| 2530 | interval = atoi (argv[0]); |
| 2531 | level = IS_LEVEL_1 | IS_LEVEL_2; |
| 2532 | return set_lsp_max_lifetime (vty, area, interval, level); |
| 2533 | } |
| 2534 | |
| 2535 | DEFUN (no_max_lsp_lifetime, |
| 2536 | no_max_lsp_lifetime_cmd, |
| 2537 | "no max-lsp-lifetime", |
| 2538 | NO_STR |
| 2539 | "LSP lifetime in seconds\n") |
| 2540 | { |
| 2541 | struct isis_area *area; |
| 2542 | uint16_t interval; |
| 2543 | int level; |
| 2544 | |
| 2545 | area = vty->index; |
| 2546 | interval = DEFAULT_LSP_LIFETIME; |
| 2547 | level = IS_LEVEL_1 | IS_LEVEL_2; |
| 2548 | return set_lsp_max_lifetime (vty, area, interval, level); |
| 2549 | } |
| 2550 | |
| 2551 | ALIAS (no_max_lsp_lifetime, |
| 2552 | no_max_lsp_lifetime_arg_cmd, |
| 2553 | "no max-lsp-lifetime <350-65535>", |
| 2554 | NO_STR |
| 2555 | "Maximum LSP lifetime\n" |
| 2556 | "LSP lifetime in seconds\n") |
| 2557 | |
| 2558 | DEFUN (max_lsp_lifetime_l1, |
| 2559 | max_lsp_lifetime_l1_cmd, |
| 2560 | "max-lsp-lifetime level-1 <350-65535>", |
| 2561 | "Maximum LSP lifetime for Level 1 only\n" |
| 2562 | "LSP lifetime for Level 1 only in seconds\n") |
| 2563 | { |
| 2564 | struct isis_area *area; |
| 2565 | uint16_t interval; |
| 2566 | int level; |
| 2567 | |
| 2568 | area = vty->index; |
| 2569 | interval = atoi (argv[0]); |
| 2570 | level = IS_LEVEL_1; |
| 2571 | return set_lsp_max_lifetime (vty, area, interval, level); |
| 2572 | } |
| 2573 | |
| 2574 | DEFUN (no_max_lsp_lifetime_l1, |
| 2575 | no_max_lsp_lifetime_l1_cmd, |
| 2576 | "no max-lsp-lifetime level-1", |
| 2577 | NO_STR |
| 2578 | "LSP lifetime for Level 1 only in seconds\n") |
| 2579 | { |
| 2580 | struct isis_area *area; |
| 2581 | uint16_t interval; |
| 2582 | int level; |
| 2583 | |
| 2584 | area = vty->index; |
| 2585 | interval = DEFAULT_LSP_LIFETIME; |
| 2586 | level = IS_LEVEL_1; |
| 2587 | return set_lsp_max_lifetime (vty, area, interval, level); |
| 2588 | } |
| 2589 | |
| 2590 | ALIAS (no_max_lsp_lifetime_l1, |
| 2591 | no_max_lsp_lifetime_l1_arg_cmd, |
| 2592 | "no max-lsp-lifetime level-1 <350-65535>", |
| 2593 | NO_STR |
| 2594 | "Maximum LSP lifetime for Level 1 only\n" |
| 2595 | "LSP lifetime for Level 1 only in seconds\n") |
| 2596 | |
| 2597 | DEFUN (max_lsp_lifetime_l2, |
| 2598 | max_lsp_lifetime_l2_cmd, |
| 2599 | "max-lsp-lifetime level-2 <350-65535>", |
| 2600 | "Maximum LSP lifetime for Level 2 only\n" |
| 2601 | "LSP lifetime for Level 2 only in seconds\n") |
| 2602 | { |
| 2603 | struct isis_area *area; |
| 2604 | uint16_t interval; |
| 2605 | int level; |
| 2606 | |
| 2607 | area = vty->index; |
| 2608 | interval = atoi (argv[0]); |
| 2609 | level = IS_LEVEL_2; |
| 2610 | return set_lsp_max_lifetime (vty, area, interval, level); |
| 2611 | } |
| 2612 | |
| 2613 | DEFUN (no_max_lsp_lifetime_l2, |
| 2614 | no_max_lsp_lifetime_l2_cmd, |
| 2615 | "no max-lsp-lifetime level-2", |
| 2616 | NO_STR |
| 2617 | "LSP lifetime for Level 2 only in seconds\n") |
| 2618 | { |
| 2619 | struct isis_area *area; |
| 2620 | uint16_t interval; |
| 2621 | int level; |
| 2622 | |
| 2623 | area = vty->index; |
| 2624 | interval = DEFAULT_LSP_LIFETIME; |
| 2625 | level = IS_LEVEL_2; |
| 2626 | return set_lsp_max_lifetime (vty, area, interval, level); |
| 2627 | } |
| 2628 | |
| 2629 | ALIAS (no_max_lsp_lifetime_l2, |
| 2630 | no_max_lsp_lifetime_l2_arg_cmd, |
| 2631 | "no max-lsp-lifetime level-2 <350-65535>", |
| 2632 | NO_STR |
| 2633 | "Maximum LSP lifetime for Level 2 only\n" |
| 2634 | "LSP lifetime for Level 2 only in seconds\n") |
| 2635 | |
| 2636 | static int |
| 2637 | set_lsp_refresh_interval (struct vty *vty, struct isis_area *area, |
| 2638 | uint16_t interval, int level) |
| 2639 | { |
| 2640 | int lvl; |
| 2641 | |
| 2642 | for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl) |
| 2643 | { |
| 2644 | if (!(lvl & level)) |
| 2645 | continue; |
| 2646 | if (interval <= area->lsp_gen_interval[lvl-1]) |
| 2647 | { |
| 2648 | vty_out (vty, "LSP refresh interval %us must be greater than " |
| 2649 | "the configured LSP gen interval %us%s", |
| 2650 | interval, area->lsp_gen_interval[lvl-1], |
| 2651 | VTY_NEWLINE); |
| 2652 | return CMD_ERR_AMBIGUOUS; |
| 2653 | } |
| 2654 | if (interval > (area->max_lsp_lifetime[lvl-1] - 300)) |
| 2655 | { |
| 2656 | vty_out (vty, "LSP refresh interval %us must be less than " |
| 2657 | "the configured LSP lifetime %us less 300%s", |
| 2658 | interval, area->max_lsp_lifetime[lvl-1], |
| 2659 | VTY_NEWLINE); |
| 2660 | return CMD_ERR_AMBIGUOUS; |
| 2661 | } |
| 2662 | } |
| 2663 | |
| 2664 | for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl) |
| 2665 | { |
| 2666 | if (!(lvl & level)) |
| 2667 | continue; |
| 2668 | area->lsp_refresh[lvl-1] = interval; |
| 2669 | } |
| 2670 | lsp_regenerate_schedule (area, level, 1); |
| 2671 | |
| 2672 | return CMD_SUCCESS; |
| 2673 | } |
| 2674 | |
| 2675 | DEFUN (lsp_refresh_interval, |
| 2676 | lsp_refresh_interval_cmd, |
| 2677 | "lsp-refresh-interval <1-65235>", |
| 2678 | "LSP refresh interval\n" |
| 2679 | "LSP refresh interval in seconds\n") |
| 2680 | { |
| 2681 | struct isis_area *area; |
| 2682 | uint16_t interval; |
| 2683 | int level; |
| 2684 | |
| 2685 | area = vty->index; |
| 2686 | interval = atoi (argv[0]); |
| 2687 | level = IS_LEVEL_1 | IS_LEVEL_2; |
| 2688 | return set_lsp_refresh_interval (vty, area, interval, level); |
| 2689 | } |
| 2690 | |
| 2691 | DEFUN (no_lsp_refresh_interval, |
| 2692 | no_lsp_refresh_interval_cmd, |
| 2693 | "no lsp-refresh-interval", |
| 2694 | NO_STR |
| 2695 | "LSP refresh interval in seconds\n") |
| 2696 | { |
| 2697 | struct isis_area *area; |
| 2698 | uint16_t interval; |
| 2699 | int level; |
| 2700 | |
| 2701 | area = vty->index; |
| 2702 | interval = DEFAULT_MAX_LSP_GEN_INTERVAL; |
| 2703 | level = IS_LEVEL_1 | IS_LEVEL_2; |
| 2704 | return set_lsp_refresh_interval (vty, area, interval, level); |
| 2705 | } |
| 2706 | |
| 2707 | ALIAS (no_lsp_refresh_interval, |
| 2708 | no_lsp_refresh_interval_arg_cmd, |
| 2709 | "no lsp-refresh-interval <1-65235>", |
| 2710 | NO_STR |
| 2711 | "LSP refresh interval\n" |
| 2712 | "LSP refresh interval in seconds\n") |
| 2713 | |
| 2714 | DEFUN (lsp_refresh_interval_l1, |
| 2715 | lsp_refresh_interval_l1_cmd, |
| 2716 | "lsp-refresh-interval level-1 <1-65235>", |
| 2717 | "LSP refresh interval for Level 1 only\n" |
| 2718 | "LSP refresh interval for Level 1 only in seconds\n") |
| 2719 | { |
| 2720 | struct isis_area *area; |
| 2721 | uint16_t interval; |
| 2722 | int level; |
| 2723 | |
| 2724 | area = vty->index; |
| 2725 | interval = atoi (argv[0]); |
| 2726 | level = IS_LEVEL_1; |
| 2727 | return set_lsp_refresh_interval (vty, area, interval, level); |
| 2728 | } |
| 2729 | |
| 2730 | DEFUN (no_lsp_refresh_interval_l1, |
| 2731 | no_lsp_refresh_interval_l1_cmd, |
| 2732 | "no lsp-refresh-interval level-1", |
| 2733 | NO_STR |
| 2734 | "LSP refresh interval for Level 1 only in seconds\n") |
| 2735 | { |
| 2736 | struct isis_area *area; |
| 2737 | uint16_t interval; |
| 2738 | int level; |
| 2739 | |
| 2740 | area = vty->index; |
| 2741 | interval = DEFAULT_MAX_LSP_GEN_INTERVAL; |
| 2742 | level = IS_LEVEL_1; |
| 2743 | return set_lsp_refresh_interval (vty, area, interval, level); |
| 2744 | } |
| 2745 | |
| 2746 | ALIAS (no_lsp_refresh_interval_l1, |
| 2747 | no_lsp_refresh_interval_l1_arg_cmd, |
| 2748 | "no lsp-refresh-interval level-1 <1-65235>", |
| 2749 | NO_STR |
| 2750 | "LSP refresh interval for Level 1 only\n" |
| 2751 | "LSP refresh interval for Level 1 only in seconds\n") |
| 2752 | |
| 2753 | DEFUN (lsp_refresh_interval_l2, |
| 2754 | lsp_refresh_interval_l2_cmd, |
| 2755 | "lsp-refresh-interval level-2 <1-65235>", |
| 2756 | "LSP refresh interval for Level 2 only\n" |
| 2757 | "LSP refresh interval for Level 2 only in seconds\n") |
| 2758 | { |
| 2759 | struct isis_area *area; |
| 2760 | uint16_t interval; |
| 2761 | int level; |
| 2762 | |
| 2763 | area = vty->index; |
| 2764 | interval = atoi (argv[0]); |
| 2765 | level = IS_LEVEL_2; |
| 2766 | return set_lsp_refresh_interval (vty, area, interval, level); |
| 2767 | } |
| 2768 | |
| 2769 | DEFUN (no_lsp_refresh_interval_l2, |
| 2770 | no_lsp_refresh_interval_l2_cmd, |
| 2771 | "no lsp-refresh-interval level-2", |
| 2772 | NO_STR |
| 2773 | "LSP refresh interval for Level 2 only in seconds\n") |
| 2774 | { |
| 2775 | struct isis_area *area; |
| 2776 | uint16_t interval; |
| 2777 | int level; |
| 2778 | |
| 2779 | area = vty->index; |
| 2780 | interval = DEFAULT_MAX_LSP_GEN_INTERVAL; |
| 2781 | level = IS_LEVEL_2; |
| 2782 | return set_lsp_refresh_interval (vty, area, interval, level); |
| 2783 | } |
| 2784 | |
| 2785 | ALIAS (no_lsp_refresh_interval_l2, |
| 2786 | no_lsp_refresh_interval_l2_arg_cmd, |
| 2787 | "no lsp-refresh-interval level-2 <1-65235>", |
| 2788 | NO_STR |
| 2789 | "LSP refresh interval for Level 2 only\n" |
| 2790 | "LSP refresh interval for Level 2 only in seconds\n") |
| 2791 | |
| 2792 | DEFUN (log_adj_changes, |
| 2793 | log_adj_changes_cmd, |
| 2794 | "log-adjacency-changes", |
| 2795 | "Log changes in adjacency state\n") |
| 2796 | { |
| 2797 | struct isis_area *area; |
| 2798 | |
| 2799 | area = vty->index; |
| 2800 | assert (area); |
| 2801 | |
| 2802 | area->log_adj_changes = 1; |
| 2803 | |
| 2804 | return CMD_SUCCESS; |
| 2805 | } |
| 2806 | |
| 2807 | DEFUN (no_log_adj_changes, |
| 2808 | no_log_adj_changes_cmd, |
| 2809 | "no log-adjacency-changes", |
| 2810 | "Stop logging changes in adjacency state\n") |
| 2811 | { |
| 2812 | struct isis_area *area; |
| 2813 | |
| 2814 | area = vty->index; |
| 2815 | assert (area); |
| 2816 | |
| 2817 | area->log_adj_changes = 0; |
| 2818 | |
| 2819 | return CMD_SUCCESS; |
| 2820 | } |
| 2821 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2822 | #ifdef TOPOLOGY_GENERATE |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2823 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2824 | DEFUN (topology_generate_grid, |
| 2825 | topology_generate_grid_cmd, |
| 2826 | "topology generate grid <1-100> <1-100> <1-65000> [param] [param] " |
| 2827 | "[param]", |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 2828 | "Topology generation for IS-IS\n" |
| 2829 | "Topology generation\n" |
| 2830 | "Grid topology\n" |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2831 | "X parameter of the grid\n" |
| 2832 | "Y parameter of the grid\n" |
| 2833 | "Random seed\n" |
| 2834 | "Optional param 1\n" |
| 2835 | "Optional param 2\n" |
| 2836 | "Optional param 3\n" |
| 2837 | "Topology\n") |
| 2838 | { |
| 2839 | struct isis_area *area; |
| 2840 | |
| 2841 | area = vty->index; |
| 2842 | assert (area); |
| 2843 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2844 | if (!spgrid_check_params (vty, argc, argv)) |
| 2845 | { |
| 2846 | if (area->topology) |
| 2847 | list_delete (area->topology); |
| 2848 | area->topology = list_new (); |
| 2849 | memcpy (area->top_params, vty->buf, 200); |
| 2850 | gen_spgrid_topology (vty, area->topology); |
| 2851 | remove_topology_lsps (area); |
| 2852 | generate_topology_lsps (area); |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 2853 | /* Regenerate L1 LSP to get two way connection to the generated |
| 2854 | * topology. */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2855 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2856 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2857 | |
| 2858 | return CMD_SUCCESS; |
| 2859 | } |
| 2860 | |
hasso | f695b01 | 2005-04-02 19:03:39 +0000 | [diff] [blame] | 2861 | DEFUN (show_isis_generated_topology, |
| 2862 | show_isis_generated_topology_cmd, |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 2863 | "show isis generated-topologies", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2864 | SHOW_STR |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2865 | "ISIS network information\n" |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 2866 | "Show generated topologies\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2867 | { |
| 2868 | struct isis_area *area; |
paul | 92c9f22 | 2005-05-25 12:21:13 +0000 | [diff] [blame] | 2869 | struct listnode *node; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2870 | struct listnode *node2; |
| 2871 | struct arc *arc; |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 2872 | |
paul | 92c9f22 | 2005-05-25 12:21:13 +0000 | [diff] [blame] | 2873 | for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area)) |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 2874 | { |
| 2875 | if (!area->topology) |
| 2876 | continue; |
| 2877 | |
| 2878 | vty_out (vty, "Topology for isis area: %s%s", area->area_tag, |
| 2879 | VTY_NEWLINE); |
| 2880 | vty_out (vty, "From node To node Distance%s", VTY_NEWLINE); |
| 2881 | |
| 2882 | for (ALL_LIST_ELEMENTS_RO (area->topology, node2, arc)) |
| 2883 | vty_out (vty, "%9ld %11ld %12ld%s", arc->from_node, arc->to_node, |
| 2884 | arc->distance, VTY_NEWLINE); |
| 2885 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2886 | return CMD_SUCCESS; |
| 2887 | } |
| 2888 | |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 2889 | /* Base IS for topology generation. */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2890 | DEFUN (topology_baseis, |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2891 | topology_baseis_cmd, |
| 2892 | "topology base-is WORD", |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 2893 | "Topology generation for IS-IS\n" |
| 2894 | "A Network IS Base for this topology\n" |
| 2895 | "XXXX.XXXX.XXXX Network entity title (NET)\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2896 | { |
| 2897 | struct isis_area *area; |
| 2898 | u_char buff[ISIS_SYS_ID_LEN]; |
| 2899 | |
| 2900 | area = vty->index; |
| 2901 | assert (area); |
| 2902 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2903 | if (sysid2buff (buff, argv[0])) |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 2904 | sysid2buff (area->topology_baseis, argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2905 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2906 | return CMD_SUCCESS; |
| 2907 | } |
| 2908 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2909 | DEFUN (no_topology_baseis, |
| 2910 | no_topology_baseis_cmd, |
| 2911 | "no topology base-is WORD", |
| 2912 | NO_STR |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 2913 | "Topology generation for IS-IS\n" |
| 2914 | "A Network IS Base for this topology\n" |
| 2915 | "XXXX.XXXX.XXXX Network entity title (NET)\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2916 | { |
| 2917 | struct isis_area *area; |
| 2918 | |
| 2919 | area = vty->index; |
| 2920 | assert (area); |
| 2921 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2922 | memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2923 | return CMD_SUCCESS; |
| 2924 | } |
| 2925 | |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 2926 | ALIAS (no_topology_baseis, |
| 2927 | no_topology_baseis_noid_cmd, |
| 2928 | "no topology base-is", |
| 2929 | NO_STR |
| 2930 | "Topology generation for IS-IS\n" |
| 2931 | "A Network IS Base for this topology\n") |
| 2932 | |
| 2933 | DEFUN (topology_basedynh, |
| 2934 | topology_basedynh_cmd, |
| 2935 | "topology base-dynh WORD", |
| 2936 | "Topology generation for IS-IS\n" |
| 2937 | "Dynamic hostname base for this topology\n" |
| 2938 | "Dynamic hostname base\n") |
| 2939 | { |
| 2940 | struct isis_area *area; |
| 2941 | |
| 2942 | area = vty->index; |
| 2943 | assert (area); |
| 2944 | |
| 2945 | /* I hope that it's enough. */ |
| 2946 | area->topology_basedynh = strndup (argv[0], 16); |
| 2947 | return CMD_SUCCESS; |
| 2948 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2949 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2950 | #endif /* TOPOLOGY_GENERATE */ |
| 2951 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2952 | /* IS-IS configuration write function */ |
| 2953 | int |
| 2954 | isis_config_write (struct vty *vty) |
| 2955 | { |
| 2956 | int write = 0; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2957 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2958 | if (isis != NULL) |
| 2959 | { |
| 2960 | struct isis_area *area; |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 2961 | struct listnode *node, *node2; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2962 | |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 2963 | for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area)) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2964 | { |
| 2965 | /* ISIS - Area name */ |
| 2966 | vty_out (vty, "router isis %s%s", area->area_tag, VTY_NEWLINE); |
| 2967 | write++; |
| 2968 | /* ISIS - Net */ |
| 2969 | if (listcount (area->area_addrs) > 0) |
| 2970 | { |
| 2971 | struct area_addr *area_addr; |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 2972 | for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node2, area_addr)) |
| 2973 | { |
| 2974 | vty_out (vty, " net %s%s", |
| 2975 | isonet_print (area_addr->area_addr, |
| 2976 | area_addr->addr_len + ISIS_SYS_ID_LEN + |
| 2977 | 1), VTY_NEWLINE); |
| 2978 | write++; |
| 2979 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2980 | } |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 2981 | /* ISIS - Dynamic hostname - Defaults to true so only display if |
| 2982 | * false. */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2983 | if (!area->dynhostname) |
| 2984 | { |
| 2985 | vty_out (vty, " no hostname dynamic%s", VTY_NEWLINE); |
| 2986 | write++; |
| 2987 | } |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 2988 | /* ISIS - Metric-Style - when true displays wide */ |
| 2989 | if (area->newmetric) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2990 | { |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 2991 | if (!area->oldmetric) |
| 2992 | vty_out (vty, " metric-style wide%s", VTY_NEWLINE); |
hasso | 2984d26 | 2005-09-26 16:49:07 +0000 | [diff] [blame] | 2993 | else |
| 2994 | vty_out (vty, " metric-style transition%s", VTY_NEWLINE); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2995 | write++; |
| 2996 | } |
Christian Franke | f818c8f | 2012-11-27 01:10:28 +0000 | [diff] [blame] | 2997 | else |
| 2998 | { |
| 2999 | vty_out (vty, " metric-style narrow%s", VTY_NEWLINE); |
| 3000 | write++; |
| 3001 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3002 | /* ISIS - overload-bit */ |
| 3003 | if (area->overload_bit) |
| 3004 | { |
| 3005 | vty_out (vty, " set-overload-bit%s", VTY_NEWLINE); |
| 3006 | write++; |
| 3007 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3008 | /* ISIS - Area is-type (level-1-2 is default) */ |
| 3009 | if (area->is_type == IS_LEVEL_1) |
| 3010 | { |
| 3011 | vty_out (vty, " is-type level-1%s", VTY_NEWLINE); |
| 3012 | write++; |
| 3013 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3014 | else if (area->is_type == IS_LEVEL_2) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3015 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3016 | vty_out (vty, " is-type level-2-only%s", VTY_NEWLINE); |
| 3017 | write++; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3018 | } |
| 3019 | /* ISIS - Lsp generation interval */ |
| 3020 | if (area->lsp_gen_interval[0] == area->lsp_gen_interval[1]) |
| 3021 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3022 | if (area->lsp_gen_interval[0] != DEFAULT_MIN_LSP_GEN_INTERVAL) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3023 | { |
| 3024 | vty_out (vty, " lsp-gen-interval %d%s", |
| 3025 | area->lsp_gen_interval[0], VTY_NEWLINE); |
| 3026 | write++; |
| 3027 | } |
| 3028 | } |
| 3029 | else |
| 3030 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3031 | if (area->lsp_gen_interval[0] != DEFAULT_MIN_LSP_GEN_INTERVAL) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3032 | { |
| 3033 | vty_out (vty, " lsp-gen-interval level-1 %d%s", |
| 3034 | area->lsp_gen_interval[0], VTY_NEWLINE); |
| 3035 | write++; |
| 3036 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3037 | if (area->lsp_gen_interval[1] != DEFAULT_MIN_LSP_GEN_INTERVAL) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3038 | { |
| 3039 | vty_out (vty, " lsp-gen-interval level-2 %d%s", |
| 3040 | area->lsp_gen_interval[1], VTY_NEWLINE); |
| 3041 | write++; |
| 3042 | } |
| 3043 | } |
| 3044 | /* ISIS - LSP lifetime */ |
| 3045 | if (area->max_lsp_lifetime[0] == area->max_lsp_lifetime[1]) |
| 3046 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3047 | if (area->max_lsp_lifetime[0] != DEFAULT_LSP_LIFETIME) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3048 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3049 | vty_out (vty, " max-lsp-lifetime %u%s", area->max_lsp_lifetime[0], |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3050 | VTY_NEWLINE); |
| 3051 | write++; |
| 3052 | } |
| 3053 | } |
| 3054 | else |
| 3055 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3056 | if (area->max_lsp_lifetime[0] != DEFAULT_LSP_LIFETIME) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3057 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3058 | vty_out (vty, " max-lsp-lifetime level-1 %u%s", |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3059 | area->max_lsp_lifetime[0], VTY_NEWLINE); |
| 3060 | write++; |
| 3061 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3062 | if (area->max_lsp_lifetime[1] != DEFAULT_LSP_LIFETIME) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3063 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3064 | vty_out (vty, " max-lsp-lifetime level-2 %u%s", |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3065 | area->max_lsp_lifetime[1], VTY_NEWLINE); |
| 3066 | write++; |
| 3067 | } |
| 3068 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3069 | /* ISIS - LSP refresh interval */ |
| 3070 | if (area->lsp_refresh[0] == area->lsp_refresh[1]) |
| 3071 | { |
| 3072 | if (area->lsp_refresh[0] != DEFAULT_MAX_LSP_GEN_INTERVAL) |
| 3073 | { |
| 3074 | vty_out (vty, " lsp-refresh-interval %u%s", area->lsp_refresh[0], |
| 3075 | VTY_NEWLINE); |
| 3076 | write++; |
| 3077 | } |
| 3078 | } |
| 3079 | else |
| 3080 | { |
| 3081 | if (area->lsp_refresh[0] != DEFAULT_MAX_LSP_GEN_INTERVAL) |
| 3082 | { |
| 3083 | vty_out (vty, " lsp-refresh-interval level-1 %u%s", |
| 3084 | area->lsp_refresh[0], VTY_NEWLINE); |
| 3085 | write++; |
| 3086 | } |
| 3087 | if (area->lsp_refresh[1] != DEFAULT_MAX_LSP_GEN_INTERVAL) |
| 3088 | { |
| 3089 | vty_out (vty, " lsp-refresh-interval level-2 %u%s", |
| 3090 | area->lsp_refresh[1], VTY_NEWLINE); |
| 3091 | write++; |
| 3092 | } |
| 3093 | } |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame] | 3094 | if (area->lsp_mtu != DEFAULT_LSP_MTU) |
| 3095 | { |
| 3096 | vty_out(vty, " lsp-mtu %u%s", area->lsp_mtu, VTY_NEWLINE); |
| 3097 | write++; |
| 3098 | } |
| 3099 | |
hasso | 13fb40a | 2005-10-01 06:03:04 +0000 | [diff] [blame] | 3100 | /* Minimum SPF interval. */ |
| 3101 | if (area->min_spf_interval[0] == area->min_spf_interval[1]) |
| 3102 | { |
| 3103 | if (area->min_spf_interval[0] != MINIMUM_SPF_INTERVAL) |
| 3104 | { |
| 3105 | vty_out (vty, " spf-interval %d%s", |
| 3106 | area->min_spf_interval[0], VTY_NEWLINE); |
| 3107 | write++; |
| 3108 | } |
| 3109 | } |
| 3110 | else |
| 3111 | { |
| 3112 | if (area->min_spf_interval[0] != MINIMUM_SPF_INTERVAL) |
| 3113 | { |
| 3114 | vty_out (vty, " spf-interval level-1 %d%s", |
| 3115 | area->min_spf_interval[0], VTY_NEWLINE); |
| 3116 | write++; |
| 3117 | } |
| 3118 | if (area->min_spf_interval[1] != MINIMUM_SPF_INTERVAL) |
| 3119 | { |
| 3120 | vty_out (vty, " spf-interval level-2 %d%s", |
| 3121 | area->min_spf_interval[1], VTY_NEWLINE); |
| 3122 | write++; |
| 3123 | } |
| 3124 | } |
hasso | 53c997c | 2004-09-15 16:21:59 +0000 | [diff] [blame] | 3125 | /* Authentication passwords. */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3126 | if (area->area_passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5) |
hasso | 53c997c | 2004-09-15 16:21:59 +0000 | [diff] [blame] | 3127 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3128 | vty_out(vty, " area-password md5 %s", area->area_passwd.passwd); |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 3129 | if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND)) |
| 3130 | { |
| 3131 | vty_out(vty, " authenticate snp "); |
| 3132 | if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV)) |
| 3133 | vty_out(vty, "validate"); |
| 3134 | else |
| 3135 | vty_out(vty, "send-only"); |
| 3136 | } |
| 3137 | vty_out(vty, "%s", VTY_NEWLINE); |
hasso | 53c997c | 2004-09-15 16:21:59 +0000 | [diff] [blame] | 3138 | write++; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3139 | } |
| 3140 | else if (area->area_passwd.type == ISIS_PASSWD_TYPE_CLEARTXT) |
| 3141 | { |
| 3142 | vty_out(vty, " area-password clear %s", area->area_passwd.passwd); |
| 3143 | if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND)) |
| 3144 | { |
| 3145 | vty_out(vty, " authenticate snp "); |
| 3146 | if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV)) |
| 3147 | vty_out(vty, "validate"); |
| 3148 | else |
| 3149 | vty_out(vty, "send-only"); |
| 3150 | } |
| 3151 | vty_out(vty, "%s", VTY_NEWLINE); |
| 3152 | write++; |
| 3153 | } |
| 3154 | if (area->domain_passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5) |
hasso | 53c997c | 2004-09-15 16:21:59 +0000 | [diff] [blame] | 3155 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3156 | vty_out(vty, " domain-password md5 %s", |
| 3157 | area->domain_passwd.passwd); |
| 3158 | if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND)) |
| 3159 | { |
| 3160 | vty_out(vty, " authenticate snp "); |
| 3161 | if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV)) |
| 3162 | vty_out(vty, "validate"); |
| 3163 | else |
| 3164 | vty_out(vty, "send-only"); |
| 3165 | } |
| 3166 | vty_out(vty, "%s", VTY_NEWLINE); |
| 3167 | write++; |
| 3168 | } |
| 3169 | else if (area->domain_passwd.type == ISIS_PASSWD_TYPE_CLEARTXT) |
| 3170 | { |
| 3171 | vty_out(vty, " domain-password clear %s", |
| 3172 | area->domain_passwd.passwd); |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 3173 | if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND)) |
| 3174 | { |
| 3175 | vty_out(vty, " authenticate snp "); |
| 3176 | if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV)) |
| 3177 | vty_out(vty, "validate"); |
| 3178 | else |
| 3179 | vty_out(vty, "send-only"); |
| 3180 | } |
| 3181 | vty_out(vty, "%s", VTY_NEWLINE); |
hasso | 53c997c | 2004-09-15 16:21:59 +0000 | [diff] [blame] | 3182 | write++; |
| 3183 | } |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 3184 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3185 | if (area->log_adj_changes) |
| 3186 | { |
| 3187 | vty_out (vty, " log-adjacency-changes%s", VTY_NEWLINE); |
| 3188 | write++; |
| 3189 | } |
| 3190 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3191 | #ifdef TOPOLOGY_GENERATE |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 3192 | if (memcmp (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, |
| 3193 | ISIS_SYS_ID_LEN)) |
| 3194 | { |
| 3195 | vty_out (vty, " topology base-is %s%s", |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3196 | sysid_print ((u_char *)area->topology_baseis), VTY_NEWLINE); |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 3197 | write++; |
| 3198 | } |
| 3199 | if (area->topology_basedynh) |
| 3200 | { |
| 3201 | vty_out (vty, " topology base-dynh %s%s", |
| 3202 | area->topology_basedynh, VTY_NEWLINE); |
| 3203 | write++; |
| 3204 | } |
| 3205 | /* We save the whole command line here. */ |
| 3206 | if (strlen(area->top_params)) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3207 | { |
| 3208 | vty_out (vty, " %s%s", area->top_params, VTY_NEWLINE); |
| 3209 | write++; |
| 3210 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3211 | #endif /* TOPOLOGY_GENERATE */ |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 3212 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3213 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3214 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3215 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3216 | return write; |
| 3217 | } |
| 3218 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3219 | struct cmd_node isis_node = { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3220 | ISIS_NODE, |
hasso | 2097cd8 | 2003-12-23 11:51:08 +0000 | [diff] [blame] | 3221 | "%s(config-router)# ", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3222 | 1 |
| 3223 | }; |
| 3224 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3225 | void |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3226 | isis_init () |
| 3227 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3228 | /* Install IS-IS top node */ |
| 3229 | install_node (&isis_node, isis_config_write); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3230 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3231 | install_element (VIEW_NODE, &show_isis_summary_cmd); |
| 3232 | |
| 3233 | install_element (VIEW_NODE, &show_isis_interface_cmd); |
| 3234 | install_element (VIEW_NODE, &show_isis_interface_detail_cmd); |
| 3235 | install_element (VIEW_NODE, &show_isis_interface_arg_cmd); |
| 3236 | |
| 3237 | install_element (VIEW_NODE, &show_isis_neighbor_cmd); |
| 3238 | install_element (VIEW_NODE, &show_isis_neighbor_detail_cmd); |
| 3239 | install_element (VIEW_NODE, &show_isis_neighbor_arg_cmd); |
| 3240 | install_element (VIEW_NODE, &clear_isis_neighbor_cmd); |
| 3241 | install_element (VIEW_NODE, &clear_isis_neighbor_arg_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3242 | |
| 3243 | install_element (VIEW_NODE, &show_hostname_cmd); |
| 3244 | install_element (VIEW_NODE, &show_database_cmd); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3245 | install_element (VIEW_NODE, &show_database_arg_cmd); |
| 3246 | install_element (VIEW_NODE, &show_database_arg_detail_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3247 | install_element (VIEW_NODE, &show_database_detail_cmd); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3248 | install_element (VIEW_NODE, &show_database_detail_arg_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3249 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3250 | install_element (ENABLE_NODE, &show_isis_summary_cmd); |
| 3251 | |
| 3252 | install_element (ENABLE_NODE, &show_isis_interface_cmd); |
| 3253 | install_element (ENABLE_NODE, &show_isis_interface_detail_cmd); |
| 3254 | install_element (ENABLE_NODE, &show_isis_interface_arg_cmd); |
| 3255 | |
| 3256 | install_element (ENABLE_NODE, &show_isis_neighbor_cmd); |
| 3257 | install_element (ENABLE_NODE, &show_isis_neighbor_detail_cmd); |
| 3258 | install_element (ENABLE_NODE, &show_isis_neighbor_arg_cmd); |
| 3259 | install_element (ENABLE_NODE, &clear_isis_neighbor_cmd); |
| 3260 | install_element (ENABLE_NODE, &clear_isis_neighbor_arg_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3261 | |
| 3262 | install_element (ENABLE_NODE, &show_hostname_cmd); |
| 3263 | install_element (ENABLE_NODE, &show_database_cmd); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3264 | install_element (ENABLE_NODE, &show_database_arg_cmd); |
| 3265 | install_element (ENABLE_NODE, &show_database_arg_detail_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3266 | install_element (ENABLE_NODE, &show_database_detail_cmd); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3267 | install_element (ENABLE_NODE, &show_database_detail_arg_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3268 | install_element (ENABLE_NODE, &show_debugging_cmd); |
| 3269 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3270 | install_node (&debug_node, config_write_debug); |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 3271 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3272 | install_element (ENABLE_NODE, &debug_isis_adj_cmd); |
| 3273 | install_element (ENABLE_NODE, &no_debug_isis_adj_cmd); |
| 3274 | install_element (ENABLE_NODE, &debug_isis_csum_cmd); |
| 3275 | install_element (ENABLE_NODE, &no_debug_isis_csum_cmd); |
| 3276 | install_element (ENABLE_NODE, &debug_isis_lupd_cmd); |
| 3277 | install_element (ENABLE_NODE, &no_debug_isis_lupd_cmd); |
| 3278 | install_element (ENABLE_NODE, &debug_isis_err_cmd); |
| 3279 | install_element (ENABLE_NODE, &no_debug_isis_err_cmd); |
| 3280 | install_element (ENABLE_NODE, &debug_isis_snp_cmd); |
| 3281 | install_element (ENABLE_NODE, &no_debug_isis_snp_cmd); |
| 3282 | install_element (ENABLE_NODE, &debug_isis_upd_cmd); |
| 3283 | install_element (ENABLE_NODE, &no_debug_isis_upd_cmd); |
| 3284 | install_element (ENABLE_NODE, &debug_isis_spfevents_cmd); |
| 3285 | install_element (ENABLE_NODE, &no_debug_isis_spfevents_cmd); |
| 3286 | install_element (ENABLE_NODE, &debug_isis_spfstats_cmd); |
| 3287 | install_element (ENABLE_NODE, &no_debug_isis_spfstats_cmd); |
| 3288 | install_element (ENABLE_NODE, &debug_isis_spftrigg_cmd); |
| 3289 | install_element (ENABLE_NODE, &no_debug_isis_spftrigg_cmd); |
| 3290 | install_element (ENABLE_NODE, &debug_isis_rtevents_cmd); |
| 3291 | install_element (ENABLE_NODE, &no_debug_isis_rtevents_cmd); |
| 3292 | install_element (ENABLE_NODE, &debug_isis_events_cmd); |
| 3293 | install_element (ENABLE_NODE, &no_debug_isis_events_cmd); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3294 | install_element (ENABLE_NODE, &debug_isis_packet_dump_cmd); |
| 3295 | install_element (ENABLE_NODE, &no_debug_isis_packet_dump_cmd); |
Christian Franke | 80a8f72 | 2015-11-12 14:21:47 +0100 | [diff] [blame^] | 3296 | install_element (ENABLE_NODE, &debug_isis_lsp_gen_cmd); |
| 3297 | install_element (ENABLE_NODE, &no_debug_isis_lsp_gen_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3298 | |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 3299 | install_element (CONFIG_NODE, &debug_isis_adj_cmd); |
| 3300 | install_element (CONFIG_NODE, &no_debug_isis_adj_cmd); |
| 3301 | install_element (CONFIG_NODE, &debug_isis_csum_cmd); |
| 3302 | install_element (CONFIG_NODE, &no_debug_isis_csum_cmd); |
| 3303 | install_element (CONFIG_NODE, &debug_isis_lupd_cmd); |
| 3304 | install_element (CONFIG_NODE, &no_debug_isis_lupd_cmd); |
| 3305 | install_element (CONFIG_NODE, &debug_isis_err_cmd); |
| 3306 | install_element (CONFIG_NODE, &no_debug_isis_err_cmd); |
| 3307 | install_element (CONFIG_NODE, &debug_isis_snp_cmd); |
| 3308 | install_element (CONFIG_NODE, &no_debug_isis_snp_cmd); |
| 3309 | install_element (CONFIG_NODE, &debug_isis_upd_cmd); |
| 3310 | install_element (CONFIG_NODE, &no_debug_isis_upd_cmd); |
| 3311 | install_element (CONFIG_NODE, &debug_isis_spfevents_cmd); |
| 3312 | install_element (CONFIG_NODE, &no_debug_isis_spfevents_cmd); |
| 3313 | install_element (CONFIG_NODE, &debug_isis_spfstats_cmd); |
| 3314 | install_element (CONFIG_NODE, &no_debug_isis_spfstats_cmd); |
| 3315 | install_element (CONFIG_NODE, &debug_isis_spftrigg_cmd); |
| 3316 | install_element (CONFIG_NODE, &no_debug_isis_spftrigg_cmd); |
| 3317 | install_element (CONFIG_NODE, &debug_isis_rtevents_cmd); |
| 3318 | install_element (CONFIG_NODE, &no_debug_isis_rtevents_cmd); |
| 3319 | install_element (CONFIG_NODE, &debug_isis_events_cmd); |
| 3320 | install_element (CONFIG_NODE, &no_debug_isis_events_cmd); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3321 | install_element (CONFIG_NODE, &debug_isis_packet_dump_cmd); |
| 3322 | install_element (CONFIG_NODE, &no_debug_isis_packet_dump_cmd); |
Christian Franke | 80a8f72 | 2015-11-12 14:21:47 +0100 | [diff] [blame^] | 3323 | install_element (CONFIG_NODE, &debug_isis_lsp_gen_cmd); |
| 3324 | install_element (CONFIG_NODE, &no_debug_isis_lsp_gen_cmd); |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 3325 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3326 | install_element (CONFIG_NODE, &router_isis_cmd); |
| 3327 | install_element (CONFIG_NODE, &no_router_isis_cmd); |
| 3328 | |
| 3329 | install_default (ISIS_NODE); |
| 3330 | |
| 3331 | install_element (ISIS_NODE, &net_cmd); |
| 3332 | install_element (ISIS_NODE, &no_net_cmd); |
| 3333 | |
| 3334 | install_element (ISIS_NODE, &is_type_cmd); |
| 3335 | install_element (ISIS_NODE, &no_is_type_cmd); |
| 3336 | |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame] | 3337 | install_element (ISIS_NODE, &area_lsp_mtu_cmd); |
| 3338 | install_element (ISIS_NODE, &no_area_lsp_mtu_cmd); |
| 3339 | install_element (ISIS_NODE, &no_area_lsp_mtu_arg_cmd); |
| 3340 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3341 | install_element (ISIS_NODE, &area_passwd_md5_cmd); |
| 3342 | install_element (ISIS_NODE, &area_passwd_md5_snpauth_cmd); |
| 3343 | install_element (ISIS_NODE, &area_passwd_clear_cmd); |
| 3344 | install_element (ISIS_NODE, &area_passwd_clear_snpauth_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3345 | install_element (ISIS_NODE, &no_area_passwd_cmd); |
| 3346 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3347 | install_element (ISIS_NODE, &domain_passwd_md5_cmd); |
| 3348 | install_element (ISIS_NODE, &domain_passwd_md5_snpauth_cmd); |
| 3349 | install_element (ISIS_NODE, &domain_passwd_clear_cmd); |
| 3350 | install_element (ISIS_NODE, &domain_passwd_clear_snpauth_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3351 | install_element (ISIS_NODE, &no_domain_passwd_cmd); |
| 3352 | |
| 3353 | install_element (ISIS_NODE, &lsp_gen_interval_cmd); |
| 3354 | install_element (ISIS_NODE, &no_lsp_gen_interval_cmd); |
| 3355 | install_element (ISIS_NODE, &no_lsp_gen_interval_arg_cmd); |
| 3356 | install_element (ISIS_NODE, &lsp_gen_interval_l1_cmd); |
| 3357 | install_element (ISIS_NODE, &no_lsp_gen_interval_l1_cmd); |
| 3358 | install_element (ISIS_NODE, &no_lsp_gen_interval_l1_arg_cmd); |
| 3359 | install_element (ISIS_NODE, &lsp_gen_interval_l2_cmd); |
| 3360 | install_element (ISIS_NODE, &no_lsp_gen_interval_l2_cmd); |
| 3361 | install_element (ISIS_NODE, &no_lsp_gen_interval_l2_arg_cmd); |
| 3362 | |
| 3363 | install_element (ISIS_NODE, &spf_interval_cmd); |
| 3364 | install_element (ISIS_NODE, &no_spf_interval_cmd); |
| 3365 | install_element (ISIS_NODE, &no_spf_interval_arg_cmd); |
| 3366 | install_element (ISIS_NODE, &spf_interval_l1_cmd); |
| 3367 | install_element (ISIS_NODE, &no_spf_interval_l1_cmd); |
| 3368 | install_element (ISIS_NODE, &no_spf_interval_l1_arg_cmd); |
| 3369 | install_element (ISIS_NODE, &spf_interval_l2_cmd); |
| 3370 | install_element (ISIS_NODE, &no_spf_interval_l2_cmd); |
| 3371 | install_element (ISIS_NODE, &no_spf_interval_l2_arg_cmd); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3372 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3373 | install_element (ISIS_NODE, &max_lsp_lifetime_cmd); |
| 3374 | install_element (ISIS_NODE, &no_max_lsp_lifetime_cmd); |
| 3375 | install_element (ISIS_NODE, &no_max_lsp_lifetime_arg_cmd); |
| 3376 | install_element (ISIS_NODE, &max_lsp_lifetime_l1_cmd); |
| 3377 | install_element (ISIS_NODE, &no_max_lsp_lifetime_l1_cmd); |
| 3378 | install_element (ISIS_NODE, &no_max_lsp_lifetime_l1_arg_cmd); |
| 3379 | install_element (ISIS_NODE, &max_lsp_lifetime_l2_cmd); |
| 3380 | install_element (ISIS_NODE, &no_max_lsp_lifetime_l2_cmd); |
| 3381 | install_element (ISIS_NODE, &no_max_lsp_lifetime_l2_arg_cmd); |
| 3382 | |
| 3383 | install_element (ISIS_NODE, &lsp_refresh_interval_cmd); |
| 3384 | install_element (ISIS_NODE, &no_lsp_refresh_interval_cmd); |
| 3385 | install_element (ISIS_NODE, &no_lsp_refresh_interval_arg_cmd); |
| 3386 | install_element (ISIS_NODE, &lsp_refresh_interval_l1_cmd); |
| 3387 | install_element (ISIS_NODE, &no_lsp_refresh_interval_l1_cmd); |
| 3388 | install_element (ISIS_NODE, &no_lsp_refresh_interval_l1_arg_cmd); |
| 3389 | install_element (ISIS_NODE, &lsp_refresh_interval_l2_cmd); |
| 3390 | install_element (ISIS_NODE, &no_lsp_refresh_interval_l2_cmd); |
| 3391 | install_element (ISIS_NODE, &no_lsp_refresh_interval_l2_arg_cmd); |
| 3392 | |
| 3393 | install_element (ISIS_NODE, &set_overload_bit_cmd); |
| 3394 | install_element (ISIS_NODE, &no_set_overload_bit_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3395 | |
Amritha Nambiar | c8ee940 | 2015-08-24 16:40:14 -0700 | [diff] [blame] | 3396 | install_element (ISIS_NODE, &set_attached_bit_cmd); |
| 3397 | install_element (ISIS_NODE, &no_set_attached_bit_cmd); |
| 3398 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3399 | install_element (ISIS_NODE, &dynamic_hostname_cmd); |
| 3400 | install_element (ISIS_NODE, &no_dynamic_hostname_cmd); |
| 3401 | |
| 3402 | install_element (ISIS_NODE, &metric_style_cmd); |
| 3403 | install_element (ISIS_NODE, &no_metric_style_cmd); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3404 | |
| 3405 | install_element (ISIS_NODE, &log_adj_changes_cmd); |
| 3406 | install_element (ISIS_NODE, &no_log_adj_changes_cmd); |
| 3407 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3408 | #ifdef TOPOLOGY_GENERATE |
| 3409 | install_element (ISIS_NODE, &topology_generate_grid_cmd); |
| 3410 | install_element (ISIS_NODE, &topology_baseis_cmd); |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 3411 | install_element (ISIS_NODE, &topology_basedynh_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3412 | install_element (ISIS_NODE, &no_topology_baseis_cmd); |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 3413 | install_element (ISIS_NODE, &no_topology_baseis_noid_cmd); |
hasso | f695b01 | 2005-04-02 19:03:39 +0000 | [diff] [blame] | 3414 | install_element (VIEW_NODE, &show_isis_generated_topology_cmd); |
| 3415 | install_element (ENABLE_NODE, &show_isis_generated_topology_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3416 | #endif /* TOPOLOGY_GENERATE */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3417 | } |