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