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 | { |
Christian Franke | e720709 | 2016-04-03 12:46:28 -0300 | [diff] [blame] | 1622 | if(circuit->state != C_STATE_INIT && circuit->state != C_STATE_UP) |
| 1623 | continue; |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame] | 1624 | if(lsp_mtu > isis_circuit_pdu_size(circuit)) |
| 1625 | { |
| 1626 | vty_out(vty, "ISIS area contains circuit %s, which has a maximum PDU size of %zu.%s", |
| 1627 | circuit->interface->name, isis_circuit_pdu_size(circuit), |
| 1628 | VTY_NEWLINE); |
| 1629 | return CMD_ERR_AMBIGUOUS; |
| 1630 | } |
| 1631 | } |
| 1632 | |
| 1633 | area->lsp_mtu = lsp_mtu; |
| 1634 | lsp_regenerate_schedule(area, IS_LEVEL_1_AND_2, 1); |
| 1635 | |
| 1636 | return CMD_SUCCESS; |
| 1637 | } |
| 1638 | |
| 1639 | DEFUN (area_lsp_mtu, |
| 1640 | area_lsp_mtu_cmd, |
| 1641 | "lsp-mtu <128-4352>", |
| 1642 | "Configure the maximum size of generated LSPs\n" |
| 1643 | "Maximum size of generated LSPs\n") |
| 1644 | { |
| 1645 | struct isis_area *area; |
| 1646 | |
| 1647 | area = vty->index; |
| 1648 | if (!area) |
| 1649 | { |
| 1650 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
| 1651 | return CMD_ERR_NO_MATCH; |
| 1652 | } |
| 1653 | |
| 1654 | unsigned int lsp_mtu; |
| 1655 | |
| 1656 | VTY_GET_INTEGER_RANGE("lsp-mtu", lsp_mtu, argv[0], 128, 4352); |
| 1657 | |
| 1658 | return area_set_lsp_mtu(vty, area, lsp_mtu); |
| 1659 | } |
| 1660 | |
| 1661 | DEFUN(no_area_lsp_mtu, |
| 1662 | no_area_lsp_mtu_cmd, |
| 1663 | "no lsp-mtu", |
| 1664 | NO_STR |
| 1665 | "Configure the maximum size of generated LSPs\n") |
| 1666 | { |
| 1667 | struct isis_area *area; |
| 1668 | |
| 1669 | area = vty->index; |
| 1670 | if (!area) |
| 1671 | { |
| 1672 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
| 1673 | return CMD_ERR_NO_MATCH; |
| 1674 | } |
| 1675 | |
| 1676 | return area_set_lsp_mtu(vty, area, DEFAULT_LSP_MTU); |
| 1677 | } |
| 1678 | |
| 1679 | ALIAS(no_area_lsp_mtu, |
| 1680 | no_area_lsp_mtu_arg_cmd, |
| 1681 | "no lsp-mtu <128-4352>", |
| 1682 | NO_STR |
| 1683 | "Configure the maximum size of generated LSPs\n" |
| 1684 | "Maximum size of generated LSPs\n"); |
| 1685 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1686 | DEFUN (area_passwd_md5, |
| 1687 | area_passwd_md5_cmd, |
| 1688 | "area-password md5 WORD", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1689 | "Configure the authentication password for an area\n" |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1690 | "Authentication type\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1691 | "Area password\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1692 | { |
| 1693 | struct isis_area *area; |
| 1694 | int len; |
| 1695 | |
| 1696 | area = vty->index; |
| 1697 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1698 | if (!area) |
| 1699 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1700 | vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE); |
| 1701 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1702 | } |
| 1703 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1704 | len = strlen (argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1705 | if (len > 254) |
| 1706 | { |
| 1707 | vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1708 | return CMD_ERR_AMBIGUOUS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1709 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1710 | |
| 1711 | area->area_passwd.len = (u_char) len; |
| 1712 | area->area_passwd.type = ISIS_PASSWD_TYPE_HMAC_MD5; |
| 1713 | strncpy ((char *)area->area_passwd.passwd, argv[0], 255); |
| 1714 | |
| 1715 | if (argc > 1) |
| 1716 | { |
| 1717 | SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND); |
| 1718 | if (strncmp(argv[1], "v", 1) == 0) |
| 1719 | SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV); |
| 1720 | else |
| 1721 | UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV); |
| 1722 | } |
| 1723 | else |
| 1724 | { |
| 1725 | UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND); |
| 1726 | UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV); |
| 1727 | } |
| 1728 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1); |
| 1729 | |
| 1730 | return CMD_SUCCESS; |
| 1731 | } |
| 1732 | |
| 1733 | ALIAS (area_passwd_md5, |
| 1734 | area_passwd_md5_snpauth_cmd, |
| 1735 | "area-password md5 WORD authenticate snp (send-only|validate)", |
| 1736 | "Configure the authentication password for an area\n" |
| 1737 | "Authentication type\n" |
| 1738 | "Area password\n" |
| 1739 | "Authentication\n" |
| 1740 | "SNP PDUs\n" |
| 1741 | "Send but do not check PDUs on receiving\n" |
David Lamparter | b7d5021 | 2015-03-03 08:53:18 +0100 | [diff] [blame] | 1742 | "Send and check PDUs on receiving\n") |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1743 | |
| 1744 | DEFUN (area_passwd_clear, |
| 1745 | area_passwd_clear_cmd, |
| 1746 | "area-password clear WORD", |
| 1747 | "Configure the authentication password for an area\n" |
| 1748 | "Authentication type\n" |
| 1749 | "Area password\n") |
| 1750 | { |
| 1751 | struct isis_area *area; |
| 1752 | int len; |
| 1753 | |
| 1754 | area = vty->index; |
| 1755 | |
| 1756 | if (!area) |
| 1757 | { |
| 1758 | vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE); |
| 1759 | return CMD_ERR_NO_MATCH; |
| 1760 | } |
| 1761 | |
| 1762 | len = strlen (argv[0]); |
| 1763 | if (len > 254) |
| 1764 | { |
| 1765 | vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE); |
| 1766 | return CMD_ERR_AMBIGUOUS; |
| 1767 | } |
| 1768 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1769 | area->area_passwd.len = (u_char) len; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1770 | area->area_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT; |
hasso | f7c43dc | 2004-09-26 16:24:14 +0000 | [diff] [blame] | 1771 | strncpy ((char *)area->area_passwd.passwd, argv[0], 255); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1772 | |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1773 | if (argc > 1) |
| 1774 | { |
| 1775 | SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND); |
| 1776 | if (strncmp(argv[1], "v", 1) == 0) |
| 1777 | SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV); |
| 1778 | else |
| 1779 | UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV); |
| 1780 | } |
| 1781 | else |
| 1782 | { |
| 1783 | UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND); |
| 1784 | UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV); |
| 1785 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1786 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1); |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1787 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1788 | return CMD_SUCCESS; |
| 1789 | } |
| 1790 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1791 | ALIAS (area_passwd_clear, |
| 1792 | area_passwd_clear_snpauth_cmd, |
| 1793 | "area-password clear WORD authenticate snp (send-only|validate)", |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1794 | "Configure the authentication password for an area\n" |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1795 | "Authentication type\n" |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1796 | "Area password\n" |
| 1797 | "Authentication\n" |
| 1798 | "SNP PDUs\n" |
| 1799 | "Send but do not check PDUs on receiving\n" |
David Lamparter | b7d5021 | 2015-03-03 08:53:18 +0100 | [diff] [blame] | 1800 | "Send and check PDUs on receiving\n") |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1801 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1802 | DEFUN (no_area_passwd, |
| 1803 | no_area_passwd_cmd, |
| 1804 | "no area-password", |
| 1805 | NO_STR |
| 1806 | "Configure the authentication password for an area\n") |
| 1807 | { |
| 1808 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1809 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1810 | area = vty->index; |
| 1811 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1812 | if (!area) |
| 1813 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1814 | vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE); |
| 1815 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1816 | } |
| 1817 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1818 | memset (&area->area_passwd, 0, sizeof (struct isis_passwd)); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1819 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1820 | |
| 1821 | return CMD_SUCCESS; |
| 1822 | } |
| 1823 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1824 | DEFUN (domain_passwd_md5, |
| 1825 | domain_passwd_md5_cmd, |
| 1826 | "domain-password md5 WORD", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1827 | "Set the authentication password for a routing domain\n" |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1828 | "Authentication type\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1829 | "Routing domain password\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1830 | { |
| 1831 | struct isis_area *area; |
| 1832 | int len; |
| 1833 | |
| 1834 | area = vty->index; |
| 1835 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1836 | if (!area) |
| 1837 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1838 | vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE); |
| 1839 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1840 | } |
| 1841 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1842 | len = strlen (argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1843 | if (len > 254) |
| 1844 | { |
| 1845 | vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1846 | return CMD_ERR_AMBIGUOUS; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1847 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1848 | |
| 1849 | area->domain_passwd.len = (u_char) len; |
| 1850 | area->domain_passwd.type = ISIS_PASSWD_TYPE_HMAC_MD5; |
| 1851 | strncpy ((char *)area->domain_passwd.passwd, argv[0], 255); |
| 1852 | |
| 1853 | if (argc > 1) |
| 1854 | { |
| 1855 | SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND); |
| 1856 | if (strncmp(argv[1], "v", 1) == 0) |
| 1857 | SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV); |
| 1858 | else |
| 1859 | UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV); |
| 1860 | } |
| 1861 | else |
| 1862 | { |
| 1863 | UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND); |
| 1864 | UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV); |
| 1865 | } |
| 1866 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1); |
| 1867 | |
| 1868 | return CMD_SUCCESS; |
| 1869 | } |
| 1870 | |
| 1871 | ALIAS (domain_passwd_md5, |
| 1872 | domain_passwd_md5_snpauth_cmd, |
| 1873 | "domain-password md5 WORD authenticate snp (send-only|validate)", |
| 1874 | "Set the authentication password for a routing domain\n" |
| 1875 | "Authentication type\n" |
| 1876 | "Routing domain password\n" |
| 1877 | "Authentication\n" |
| 1878 | "SNP PDUs\n" |
| 1879 | "Send but do not check PDUs on receiving\n" |
David Lamparter | b7d5021 | 2015-03-03 08:53:18 +0100 | [diff] [blame] | 1880 | "Send and check PDUs on receiving\n") |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1881 | |
| 1882 | DEFUN (domain_passwd_clear, |
| 1883 | domain_passwd_clear_cmd, |
| 1884 | "domain-password clear WORD", |
| 1885 | "Set the authentication password for a routing domain\n" |
| 1886 | "Authentication type\n" |
| 1887 | "Routing domain password\n") |
| 1888 | { |
| 1889 | struct isis_area *area; |
| 1890 | int len; |
| 1891 | |
| 1892 | area = vty->index; |
| 1893 | |
| 1894 | if (!area) |
| 1895 | { |
| 1896 | vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE); |
| 1897 | return CMD_ERR_NO_MATCH; |
| 1898 | } |
| 1899 | |
| 1900 | len = strlen (argv[0]); |
| 1901 | if (len > 254) |
| 1902 | { |
| 1903 | vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE); |
| 1904 | return CMD_ERR_AMBIGUOUS; |
| 1905 | } |
| 1906 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1907 | area->domain_passwd.len = (u_char) len; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1908 | area->domain_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT; |
hasso | f7c43dc | 2004-09-26 16:24:14 +0000 | [diff] [blame] | 1909 | strncpy ((char *)area->domain_passwd.passwd, argv[0], 255); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1910 | |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1911 | if (argc > 1) |
| 1912 | { |
| 1913 | SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND); |
| 1914 | if (strncmp(argv[1], "v", 1) == 0) |
| 1915 | SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV); |
| 1916 | else |
| 1917 | UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV); |
| 1918 | } |
| 1919 | else |
| 1920 | { |
| 1921 | UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND); |
| 1922 | UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV); |
| 1923 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1924 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1); |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1925 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1926 | return CMD_SUCCESS; |
| 1927 | } |
| 1928 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1929 | ALIAS (domain_passwd_clear, |
| 1930 | domain_passwd_clear_snpauth_cmd, |
| 1931 | "domain-password clear WORD authenticate snp (send-only|validate)", |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1932 | "Set the authentication password for a routing domain\n" |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1933 | "Authentication type\n" |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1934 | "Routing domain password\n" |
| 1935 | "Authentication\n" |
| 1936 | "SNP PDUs\n" |
| 1937 | "Send but do not check PDUs on receiving\n" |
David Lamparter | b7d5021 | 2015-03-03 08:53:18 +0100 | [diff] [blame] | 1938 | "Send and check PDUs on receiving\n") |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 1939 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1940 | DEFUN (no_domain_passwd, |
| 1941 | no_domain_passwd_cmd, |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1942 | "no domain-password", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1943 | NO_STR |
| 1944 | "Set the authentication password for a routing domain\n") |
| 1945 | { |
| 1946 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1947 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1948 | area = vty->index; |
| 1949 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1950 | if (!area) |
| 1951 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1952 | vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE); |
| 1953 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1954 | } |
| 1955 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1956 | memset (&area->domain_passwd, 0, sizeof (struct isis_passwd)); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1957 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1958 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1959 | return CMD_SUCCESS; |
| 1960 | } |
| 1961 | |
| 1962 | DEFUN (is_type, |
| 1963 | is_type_cmd, |
| 1964 | "is-type (level-1|level-1-2|level-2-only)", |
| 1965 | "IS Level for this routing process (OSI only)\n" |
| 1966 | "Act as a station router only\n" |
| 1967 | "Act as both a station router and an area router\n" |
| 1968 | "Act as an area router only\n") |
| 1969 | { |
| 1970 | struct isis_area *area; |
| 1971 | int type; |
| 1972 | |
| 1973 | area = vty->index; |
| 1974 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1975 | if (!area) |
| 1976 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 1977 | vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE); |
| 1978 | return CMD_ERR_NO_MATCH; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1979 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1980 | |
Paul Jakma | 41b36e9 | 2006-12-08 01:09:50 +0000 | [diff] [blame] | 1981 | type = string2circuit_t (argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1982 | if (!type) |
| 1983 | { |
| 1984 | vty_out (vty, "Unknown IS level %s", VTY_NEWLINE); |
| 1985 | return CMD_SUCCESS; |
| 1986 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1987 | |
| 1988 | isis_event_system_type_change (area, type); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 1989 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1990 | return CMD_SUCCESS; |
| 1991 | } |
| 1992 | |
| 1993 | DEFUN (no_is_type, |
| 1994 | no_is_type_cmd, |
| 1995 | "no is-type (level-1|level-1-2|level-2-only)", |
| 1996 | NO_STR |
| 1997 | "IS Level for this routing process (OSI only)\n" |
| 1998 | "Act as a station router only\n" |
| 1999 | "Act as both a station router and an area router\n" |
| 2000 | "Act as an area router only\n") |
| 2001 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2002 | struct isis_area *area; |
| 2003 | int type; |
| 2004 | |
| 2005 | area = vty->index; |
| 2006 | assert (area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2007 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2008 | /* |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2009 | * Put the is-type back to defaults: |
| 2010 | * - level-1-2 on first area |
| 2011 | * - level-1 for the rest |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2012 | */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2013 | if (listgetdata (listhead (isis->area_list)) == area) |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2014 | type = IS_LEVEL_1_AND_2; |
| 2015 | else |
| 2016 | type = IS_LEVEL_1; |
| 2017 | |
| 2018 | isis_event_system_type_change (area, type); |
| 2019 | |
| 2020 | return CMD_SUCCESS; |
| 2021 | } |
| 2022 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2023 | static int |
| 2024 | set_lsp_gen_interval (struct vty *vty, struct isis_area *area, |
| 2025 | uint16_t interval, int level) |
| 2026 | { |
| 2027 | int lvl; |
| 2028 | |
| 2029 | for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl) |
| 2030 | { |
| 2031 | if (!(lvl & level)) |
| 2032 | continue; |
| 2033 | |
| 2034 | if (interval >= area->lsp_refresh[lvl-1]) |
| 2035 | { |
| 2036 | vty_out (vty, "LSP gen interval %us must be less than " |
| 2037 | "the LSP refresh interval %us%s", |
| 2038 | interval, area->lsp_refresh[lvl-1], VTY_NEWLINE); |
| 2039 | return CMD_ERR_AMBIGUOUS; |
| 2040 | } |
| 2041 | } |
| 2042 | |
| 2043 | for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl) |
| 2044 | { |
| 2045 | if (!(lvl & level)) |
| 2046 | continue; |
| 2047 | area->lsp_gen_interval[lvl-1] = interval; |
| 2048 | } |
| 2049 | |
| 2050 | return CMD_SUCCESS; |
| 2051 | } |
| 2052 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2053 | DEFUN (lsp_gen_interval, |
| 2054 | lsp_gen_interval_cmd, |
| 2055 | "lsp-gen-interval <1-120>", |
| 2056 | "Minimum interval between regenerating same LSP\n" |
| 2057 | "Minimum interval in seconds\n") |
| 2058 | { |
| 2059 | struct isis_area *area; |
| 2060 | uint16_t interval; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2061 | int level; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2062 | |
| 2063 | area = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2064 | interval = atoi (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2065 | level = IS_LEVEL_1 | IS_LEVEL_2; |
| 2066 | return set_lsp_gen_interval (vty, area, interval, level); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2067 | } |
| 2068 | |
| 2069 | DEFUN (no_lsp_gen_interval, |
| 2070 | no_lsp_gen_interval_cmd, |
| 2071 | "no lsp-gen-interval", |
| 2072 | NO_STR |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2073 | "Minimum interval between regenerating same LSP\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2074 | { |
| 2075 | struct isis_area *area; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2076 | uint16_t interval; |
| 2077 | int level; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2078 | |
| 2079 | area = vty->index; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2080 | interval = DEFAULT_MIN_LSP_GEN_INTERVAL; |
| 2081 | level = IS_LEVEL_1 | IS_LEVEL_2; |
| 2082 | return set_lsp_gen_interval (vty, area, interval, level); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2083 | } |
| 2084 | |
| 2085 | ALIAS (no_lsp_gen_interval, |
| 2086 | no_lsp_gen_interval_arg_cmd, |
| 2087 | "no lsp-gen-interval <1-120>", |
| 2088 | NO_STR |
| 2089 | "Minimum interval between regenerating same LSP\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2090 | "Minimum interval in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2091 | |
| 2092 | DEFUN (lsp_gen_interval_l1, |
| 2093 | lsp_gen_interval_l1_cmd, |
| 2094 | "lsp-gen-interval level-1 <1-120>", |
| 2095 | "Minimum interval between regenerating same LSP\n" |
| 2096 | "Set interval for level 1 only\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2097 | "Minimum interval in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2098 | { |
| 2099 | struct isis_area *area; |
| 2100 | uint16_t interval; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2101 | int level; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2102 | |
| 2103 | area = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2104 | interval = atoi (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2105 | level = IS_LEVEL_1; |
| 2106 | return set_lsp_gen_interval (vty, area, interval, level); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2107 | } |
| 2108 | |
| 2109 | DEFUN (no_lsp_gen_interval_l1, |
| 2110 | no_lsp_gen_interval_l1_cmd, |
| 2111 | "no lsp-gen-interval level-1", |
| 2112 | NO_STR |
| 2113 | "Minimum interval between regenerating same LSP\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2114 | "Set interval for level 1 only\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2115 | { |
| 2116 | struct isis_area *area; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2117 | uint16_t interval; |
| 2118 | int level; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2119 | |
| 2120 | area = vty->index; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2121 | interval = DEFAULT_MIN_LSP_GEN_INTERVAL; |
| 2122 | level = IS_LEVEL_1; |
| 2123 | return set_lsp_gen_interval (vty, area, interval, level); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2124 | } |
| 2125 | |
| 2126 | ALIAS (no_lsp_gen_interval_l1, |
| 2127 | no_lsp_gen_interval_l1_arg_cmd, |
| 2128 | "no lsp-gen-interval level-1 <1-120>", |
| 2129 | NO_STR |
| 2130 | "Minimum interval between regenerating same LSP\n" |
| 2131 | "Set interval for level 1 only\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2132 | "Minimum interval in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2133 | |
| 2134 | DEFUN (lsp_gen_interval_l2, |
| 2135 | lsp_gen_interval_l2_cmd, |
| 2136 | "lsp-gen-interval level-2 <1-120>", |
| 2137 | "Minimum interval between regenerating same LSP\n" |
| 2138 | "Set interval for level 2 only\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2139 | "Minimum interval in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2140 | { |
| 2141 | struct isis_area *area; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2142 | uint16_t interval; |
| 2143 | int level; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2144 | |
| 2145 | area = vty->index; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2146 | interval = atoi (argv[0]); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2147 | level = IS_LEVEL_2; |
| 2148 | return set_lsp_gen_interval (vty, area, interval, level); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2149 | } |
| 2150 | |
| 2151 | DEFUN (no_lsp_gen_interval_l2, |
| 2152 | no_lsp_gen_interval_l2_cmd, |
| 2153 | "no lsp-gen-interval level-2", |
| 2154 | NO_STR |
| 2155 | "Minimum interval between regenerating same LSP\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2156 | "Set interval for level 2 only\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2157 | { |
| 2158 | struct isis_area *area; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2159 | uint16_t interval; |
| 2160 | int level; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2161 | |
| 2162 | area = vty->index; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2163 | interval = DEFAULT_MIN_LSP_GEN_INTERVAL; |
| 2164 | level = IS_LEVEL_2; |
| 2165 | return set_lsp_gen_interval (vty, area, interval, level); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2166 | } |
| 2167 | |
| 2168 | ALIAS (no_lsp_gen_interval_l2, |
| 2169 | no_lsp_gen_interval_l2_arg_cmd, |
| 2170 | "no lsp-gen-interval level-2 <1-120>", |
| 2171 | NO_STR |
| 2172 | "Minimum interval between regenerating same LSP\n" |
| 2173 | "Set interval for level 2 only\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2174 | "Minimum interval in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2175 | |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 2176 | static int |
| 2177 | validate_metric_style_narrow (struct vty *vty, struct isis_area *area) |
| 2178 | { |
| 2179 | struct isis_circuit *circuit; |
| 2180 | struct listnode *node; |
| 2181 | |
| 2182 | if (! vty) |
| 2183 | return CMD_ERR_AMBIGUOUS; |
| 2184 | |
| 2185 | if (! area) |
| 2186 | { |
| 2187 | vty_out (vty, "ISIS area is invalid%s", VTY_NEWLINE); |
| 2188 | return CMD_ERR_AMBIGUOUS; |
| 2189 | } |
| 2190 | |
| 2191 | for (ALL_LIST_ELEMENTS_RO (area->circuit_list, node, circuit)) |
| 2192 | { |
| 2193 | if ((area->is_type & IS_LEVEL_1) && |
| 2194 | (circuit->is_type & IS_LEVEL_1) && |
Christian Franke | 4fb7c84 | 2012-11-27 19:51:59 +0000 | [diff] [blame] | 2195 | (circuit->te_metric[0] > MAX_NARROW_LINK_METRIC)) |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 2196 | { |
| 2197 | vty_out (vty, "ISIS circuit %s metric is invalid%s", |
| 2198 | circuit->interface->name, VTY_NEWLINE); |
| 2199 | return CMD_ERR_AMBIGUOUS; |
| 2200 | } |
| 2201 | if ((area->is_type & IS_LEVEL_2) && |
| 2202 | (circuit->is_type & IS_LEVEL_2) && |
Christian Franke | 4fb7c84 | 2012-11-27 19:51:59 +0000 | [diff] [blame] | 2203 | (circuit->te_metric[1] > MAX_NARROW_LINK_METRIC)) |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 2204 | { |
| 2205 | vty_out (vty, "ISIS circuit %s metric is invalid%s", |
| 2206 | circuit->interface->name, VTY_NEWLINE); |
| 2207 | return CMD_ERR_AMBIGUOUS; |
| 2208 | } |
| 2209 | } |
| 2210 | |
| 2211 | return CMD_SUCCESS; |
| 2212 | } |
| 2213 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2214 | DEFUN (metric_style, |
| 2215 | metric_style_cmd, |
hasso | 2984d26 | 2005-09-26 16:49:07 +0000 | [diff] [blame] | 2216 | "metric-style (narrow|transition|wide)", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2217 | "Use old-style (ISO 10589) or new-style packet formats\n" |
| 2218 | "Use old style of TLVs with narrow metric\n" |
hasso | 2984d26 | 2005-09-26 16:49:07 +0000 | [diff] [blame] | 2219 | "Send and accept both styles of TLVs during transition\n" |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2220 | "Use new style of TLVs to carry wider metric\n") |
| 2221 | { |
| 2222 | struct isis_area *area; |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 2223 | int ret; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2224 | |
| 2225 | area = vty->index; |
| 2226 | assert (area); |
hasso | 2984d26 | 2005-09-26 16:49:07 +0000 | [diff] [blame] | 2227 | |
| 2228 | if (strncmp (argv[0], "w", 1) == 0) |
| 2229 | { |
| 2230 | area->newmetric = 1; |
| 2231 | area->oldmetric = 0; |
| 2232 | } |
Christian Franke | 478c112 | 2012-11-27 19:52:00 +0000 | [diff] [blame] | 2233 | else |
hasso | 2984d26 | 2005-09-26 16:49:07 +0000 | [diff] [blame] | 2234 | { |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 2235 | ret = validate_metric_style_narrow (vty, area); |
| 2236 | if (ret != CMD_SUCCESS) |
| 2237 | return ret; |
| 2238 | |
Christian Franke | 478c112 | 2012-11-27 19:52:00 +0000 | [diff] [blame] | 2239 | if (strncmp (argv[0], "t", 1) == 0) |
| 2240 | { |
| 2241 | area->newmetric = 1; |
| 2242 | area->oldmetric = 1; |
| 2243 | } |
| 2244 | else if (strncmp (argv[0], "n", 1) == 0) |
| 2245 | { |
| 2246 | area->newmetric = 0; |
| 2247 | area->oldmetric = 1; |
| 2248 | } |
hasso | 2984d26 | 2005-09-26 16:49:07 +0000 | [diff] [blame] | 2249 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2250 | |
| 2251 | return CMD_SUCCESS; |
| 2252 | } |
| 2253 | |
| 2254 | DEFUN (no_metric_style, |
| 2255 | no_metric_style_cmd, |
hasso | 2984d26 | 2005-09-26 16:49:07 +0000 | [diff] [blame] | 2256 | "no metric-style", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2257 | NO_STR |
hasso | 2984d26 | 2005-09-26 16:49:07 +0000 | [diff] [blame] | 2258 | "Use old-style (ISO 10589) or new-style packet formats\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2259 | { |
| 2260 | struct isis_area *area; |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 2261 | int ret; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2262 | |
| 2263 | area = vty->index; |
| 2264 | assert (area); |
| 2265 | |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 2266 | ret = validate_metric_style_narrow (vty, area); |
| 2267 | if (ret != CMD_SUCCESS) |
| 2268 | return ret; |
| 2269 | |
hasso | 2984d26 | 2005-09-26 16:49:07 +0000 | [diff] [blame] | 2270 | /* Default is narrow metric. */ |
| 2271 | area->newmetric = 0; |
| 2272 | area->oldmetric = 1; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2273 | |
| 2274 | return CMD_SUCCESS; |
| 2275 | } |
| 2276 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2277 | DEFUN (set_overload_bit, |
| 2278 | set_overload_bit_cmd, |
| 2279 | "set-overload-bit", |
| 2280 | "Set overload bit to avoid any transit traffic\n" |
| 2281 | "Set overload bit\n") |
| 2282 | { |
| 2283 | struct isis_area *area; |
| 2284 | |
| 2285 | area = vty->index; |
| 2286 | assert (area); |
| 2287 | |
| 2288 | area->overload_bit = LSPBIT_OL; |
| 2289 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1); |
| 2290 | |
| 2291 | return CMD_SUCCESS; |
| 2292 | } |
| 2293 | |
| 2294 | DEFUN (no_set_overload_bit, |
| 2295 | no_set_overload_bit_cmd, |
| 2296 | "no set-overload-bit", |
| 2297 | "Reset overload bit to accept transit traffic\n" |
| 2298 | "Reset overload bit\n") |
| 2299 | { |
| 2300 | struct isis_area *area; |
| 2301 | |
| 2302 | area = vty->index; |
| 2303 | assert (area); |
| 2304 | |
| 2305 | area->overload_bit = 0; |
| 2306 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1); |
| 2307 | |
| 2308 | return CMD_SUCCESS; |
| 2309 | } |
| 2310 | |
Amritha Nambiar | c8ee940 | 2015-08-24 16:40:14 -0700 | [diff] [blame] | 2311 | DEFUN (set_attached_bit, |
| 2312 | set_attached_bit_cmd, |
| 2313 | "set-attached-bit", |
| 2314 | "Set attached bit to identify as L1/L2 router for inter-area traffic\n" |
| 2315 | "Set attached bit\n") |
| 2316 | { |
| 2317 | struct isis_area *area; |
| 2318 | |
| 2319 | area = vty->index; |
| 2320 | assert (area); |
| 2321 | |
| 2322 | area->attached_bit = LSPBIT_ATT; |
| 2323 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1); |
| 2324 | |
| 2325 | return CMD_SUCCESS; |
| 2326 | } |
| 2327 | |
| 2328 | DEFUN (no_set_attached_bit, |
| 2329 | no_set_attached_bit_cmd, |
| 2330 | "no set-attached-bit", |
| 2331 | "Reset attached bit\n") |
| 2332 | { |
| 2333 | struct isis_area *area; |
| 2334 | |
| 2335 | area = vty->index; |
| 2336 | assert (area); |
| 2337 | |
| 2338 | area->attached_bit = 0; |
| 2339 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1); |
| 2340 | |
| 2341 | return CMD_SUCCESS; |
| 2342 | } |
| 2343 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2344 | DEFUN (dynamic_hostname, |
| 2345 | dynamic_hostname_cmd, |
| 2346 | "hostname dynamic", |
| 2347 | "Dynamic hostname for IS-IS\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2348 | "Dynamic hostname\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2349 | { |
| 2350 | struct isis_area *area; |
| 2351 | |
| 2352 | area = vty->index; |
| 2353 | assert (area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2354 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2355 | if (!area->dynhostname) |
| 2356 | { |
| 2357 | area->dynhostname = 1; |
| 2358 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 0); |
| 2359 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2360 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2361 | return CMD_SUCCESS; |
| 2362 | } |
| 2363 | |
| 2364 | DEFUN (no_dynamic_hostname, |
| 2365 | no_dynamic_hostname_cmd, |
| 2366 | "no hostname dynamic", |
| 2367 | NO_STR |
| 2368 | "Dynamic hostname for IS-IS\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2369 | "Dynamic hostname\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2370 | { |
| 2371 | struct isis_area *area; |
| 2372 | |
| 2373 | area = vty->index; |
| 2374 | assert (area); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2375 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2376 | if (area->dynhostname) |
| 2377 | { |
| 2378 | area->dynhostname = 0; |
| 2379 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 0); |
| 2380 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2381 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2382 | return CMD_SUCCESS; |
| 2383 | } |
| 2384 | |
| 2385 | DEFUN (spf_interval, |
| 2386 | spf_interval_cmd, |
| 2387 | "spf-interval <1-120>", |
hasso | 2097cd8 | 2003-12-23 11:51:08 +0000 | [diff] [blame] | 2388 | "Minimum interval between SPF calculations\n" |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2389 | "Minimum interval between consecutive SPFs in seconds\n") |
| 2390 | { |
| 2391 | struct isis_area *area; |
| 2392 | u_int16_t interval; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2393 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2394 | area = vty->index; |
| 2395 | interval = atoi (argv[0]); |
| 2396 | area->min_spf_interval[0] = interval; |
| 2397 | area->min_spf_interval[1] = interval; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2398 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2399 | return CMD_SUCCESS; |
| 2400 | } |
| 2401 | |
| 2402 | DEFUN (no_spf_interval, |
| 2403 | no_spf_interval_cmd, |
| 2404 | "no spf-interval", |
| 2405 | NO_STR |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2406 | "Minimum interval between SPF calculations\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2407 | { |
| 2408 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2409 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2410 | area = vty->index; |
| 2411 | |
| 2412 | area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL; |
| 2413 | area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2414 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2415 | return CMD_SUCCESS; |
| 2416 | } |
| 2417 | |
| 2418 | ALIAS (no_spf_interval, |
| 2419 | no_spf_interval_arg_cmd, |
| 2420 | "no spf-interval <1-120>", |
| 2421 | NO_STR |
| 2422 | "Minimum interval between SPF calculations\n" |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2423 | "Minimum interval between consecutive SPFs in seconds\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2424 | |
| 2425 | DEFUN (spf_interval_l1, |
| 2426 | spf_interval_l1_cmd, |
| 2427 | "spf-interval level-1 <1-120>", |
| 2428 | "Minimum interval between SPF calculations\n" |
| 2429 | "Set interval for level 1 only\n" |
| 2430 | "Minimum interval between consecutive SPFs in seconds\n") |
| 2431 | { |
| 2432 | struct isis_area *area; |
| 2433 | u_int16_t interval; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2434 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2435 | area = vty->index; |
| 2436 | interval = atoi (argv[0]); |
| 2437 | area->min_spf_interval[0] = interval; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2438 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2439 | return CMD_SUCCESS; |
| 2440 | } |
| 2441 | |
| 2442 | DEFUN (no_spf_interval_l1, |
| 2443 | no_spf_interval_l1_cmd, |
| 2444 | "no spf-interval level-1", |
| 2445 | NO_STR |
| 2446 | "Minimum interval between SPF calculations\n" |
| 2447 | "Set interval for level 1 only\n") |
| 2448 | { |
| 2449 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2450 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2451 | area = vty->index; |
| 2452 | |
| 2453 | area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2454 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2455 | return CMD_SUCCESS; |
| 2456 | } |
| 2457 | |
| 2458 | ALIAS (no_spf_interval, |
| 2459 | no_spf_interval_l1_arg_cmd, |
| 2460 | "no spf-interval level-1 <1-120>", |
| 2461 | NO_STR |
| 2462 | "Minimum interval between SPF calculations\n" |
| 2463 | "Set interval for level 1 only\n" |
| 2464 | "Minimum interval between consecutive SPFs in seconds\n") |
| 2465 | |
| 2466 | DEFUN (spf_interval_l2, |
| 2467 | spf_interval_l2_cmd, |
| 2468 | "spf-interval level-2 <1-120>", |
| 2469 | "Minimum interval between SPF calculations\n" |
| 2470 | "Set interval for level 2 only\n" |
| 2471 | "Minimum interval between consecutive SPFs in seconds\n") |
| 2472 | { |
| 2473 | struct isis_area *area; |
| 2474 | u_int16_t interval; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2475 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2476 | area = vty->index; |
| 2477 | interval = atoi (argv[0]); |
| 2478 | area->min_spf_interval[1] = interval; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2479 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2480 | return CMD_SUCCESS; |
| 2481 | } |
| 2482 | |
| 2483 | DEFUN (no_spf_interval_l2, |
| 2484 | no_spf_interval_l2_cmd, |
| 2485 | "no spf-interval level-2", |
| 2486 | NO_STR |
| 2487 | "Minimum interval between SPF calculations\n" |
| 2488 | "Set interval for level 2 only\n") |
| 2489 | { |
| 2490 | struct isis_area *area; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2491 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2492 | area = vty->index; |
| 2493 | |
| 2494 | area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2495 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2496 | return CMD_SUCCESS; |
| 2497 | } |
| 2498 | |
| 2499 | ALIAS (no_spf_interval, |
| 2500 | no_spf_interval_l2_arg_cmd, |
| 2501 | "no spf-interval level-2 <1-120>", |
| 2502 | NO_STR |
| 2503 | "Minimum interval between SPF calculations\n" |
| 2504 | "Set interval for level 2 only\n" |
| 2505 | "Minimum interval between consecutive SPFs in seconds\n") |
| 2506 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2507 | static int |
| 2508 | set_lsp_max_lifetime (struct vty *vty, struct isis_area *area, |
| 2509 | uint16_t interval, int level) |
| 2510 | { |
| 2511 | int lvl; |
| 2512 | int set_refresh_interval[ISIS_LEVELS] = {0, 0}; |
| 2513 | uint16_t refresh_interval; |
| 2514 | |
| 2515 | refresh_interval = interval - 300; |
| 2516 | |
| 2517 | for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; lvl++) |
| 2518 | { |
| 2519 | if (!(lvl & level)) |
| 2520 | continue; |
| 2521 | if (refresh_interval < area->lsp_refresh[lvl-1]) |
| 2522 | { |
| 2523 | vty_out (vty, "Level %d Max LSP lifetime %us must be 300s greater than " |
| 2524 | "the configured LSP refresh interval %us%s", |
| 2525 | lvl, interval, area->lsp_refresh[lvl-1], VTY_NEWLINE); |
| 2526 | vty_out (vty, "Automatically reducing level %d LSP refresh interval " |
| 2527 | "to %us%s", lvl, refresh_interval, VTY_NEWLINE); |
| 2528 | set_refresh_interval[lvl-1] = 1; |
| 2529 | |
| 2530 | if (refresh_interval <= area->lsp_gen_interval[lvl-1]) |
| 2531 | { |
| 2532 | vty_out (vty, "LSP refresh interval %us must be greater than " |
| 2533 | "the configured LSP gen interval %us%s", |
| 2534 | refresh_interval, area->lsp_gen_interval[lvl-1], |
| 2535 | VTY_NEWLINE); |
| 2536 | return CMD_ERR_AMBIGUOUS; |
| 2537 | } |
| 2538 | } |
| 2539 | } |
| 2540 | |
| 2541 | for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; lvl++) |
| 2542 | { |
| 2543 | if (!(lvl & level)) |
| 2544 | continue; |
| 2545 | area->max_lsp_lifetime[lvl-1] = interval; |
| 2546 | /* Automatically reducing lsp_refresh_interval to interval - 300 */ |
| 2547 | if (set_refresh_interval[lvl-1]) |
| 2548 | area->lsp_refresh[lvl-1] = refresh_interval; |
| 2549 | } |
| 2550 | |
| 2551 | lsp_regenerate_schedule (area, level, 1); |
| 2552 | |
| 2553 | return CMD_SUCCESS; |
| 2554 | } |
| 2555 | |
| 2556 | DEFUN (max_lsp_lifetime, |
| 2557 | max_lsp_lifetime_cmd, |
| 2558 | "max-lsp-lifetime <350-65535>", |
| 2559 | "Maximum LSP lifetime\n" |
| 2560 | "LSP lifetime in seconds\n") |
| 2561 | { |
| 2562 | struct isis_area *area; |
| 2563 | uint16_t interval; |
| 2564 | int level; |
| 2565 | |
| 2566 | area = vty->index; |
| 2567 | interval = atoi (argv[0]); |
| 2568 | level = IS_LEVEL_1 | IS_LEVEL_2; |
| 2569 | return set_lsp_max_lifetime (vty, area, interval, level); |
| 2570 | } |
| 2571 | |
| 2572 | DEFUN (no_max_lsp_lifetime, |
| 2573 | no_max_lsp_lifetime_cmd, |
| 2574 | "no max-lsp-lifetime", |
| 2575 | NO_STR |
| 2576 | "LSP lifetime in seconds\n") |
| 2577 | { |
| 2578 | struct isis_area *area; |
| 2579 | uint16_t interval; |
| 2580 | int level; |
| 2581 | |
| 2582 | area = vty->index; |
| 2583 | interval = DEFAULT_LSP_LIFETIME; |
| 2584 | level = IS_LEVEL_1 | IS_LEVEL_2; |
| 2585 | return set_lsp_max_lifetime (vty, area, interval, level); |
| 2586 | } |
| 2587 | |
| 2588 | ALIAS (no_max_lsp_lifetime, |
| 2589 | no_max_lsp_lifetime_arg_cmd, |
| 2590 | "no max-lsp-lifetime <350-65535>", |
| 2591 | NO_STR |
| 2592 | "Maximum LSP lifetime\n" |
| 2593 | "LSP lifetime in seconds\n") |
| 2594 | |
| 2595 | DEFUN (max_lsp_lifetime_l1, |
| 2596 | max_lsp_lifetime_l1_cmd, |
| 2597 | "max-lsp-lifetime level-1 <350-65535>", |
| 2598 | "Maximum LSP lifetime for Level 1 only\n" |
| 2599 | "LSP lifetime for Level 1 only in seconds\n") |
| 2600 | { |
| 2601 | struct isis_area *area; |
| 2602 | uint16_t interval; |
| 2603 | int level; |
| 2604 | |
| 2605 | area = vty->index; |
| 2606 | interval = atoi (argv[0]); |
| 2607 | level = IS_LEVEL_1; |
| 2608 | return set_lsp_max_lifetime (vty, area, interval, level); |
| 2609 | } |
| 2610 | |
| 2611 | DEFUN (no_max_lsp_lifetime_l1, |
| 2612 | no_max_lsp_lifetime_l1_cmd, |
| 2613 | "no max-lsp-lifetime level-1", |
| 2614 | NO_STR |
| 2615 | "LSP lifetime for Level 1 only in seconds\n") |
| 2616 | { |
| 2617 | struct isis_area *area; |
| 2618 | uint16_t interval; |
| 2619 | int level; |
| 2620 | |
| 2621 | area = vty->index; |
| 2622 | interval = DEFAULT_LSP_LIFETIME; |
| 2623 | level = IS_LEVEL_1; |
| 2624 | return set_lsp_max_lifetime (vty, area, interval, level); |
| 2625 | } |
| 2626 | |
| 2627 | ALIAS (no_max_lsp_lifetime_l1, |
| 2628 | no_max_lsp_lifetime_l1_arg_cmd, |
| 2629 | "no max-lsp-lifetime level-1 <350-65535>", |
| 2630 | NO_STR |
| 2631 | "Maximum LSP lifetime for Level 1 only\n" |
| 2632 | "LSP lifetime for Level 1 only in seconds\n") |
| 2633 | |
| 2634 | DEFUN (max_lsp_lifetime_l2, |
| 2635 | max_lsp_lifetime_l2_cmd, |
| 2636 | "max-lsp-lifetime level-2 <350-65535>", |
| 2637 | "Maximum LSP lifetime for Level 2 only\n" |
| 2638 | "LSP lifetime for Level 2 only in seconds\n") |
| 2639 | { |
| 2640 | struct isis_area *area; |
| 2641 | uint16_t interval; |
| 2642 | int level; |
| 2643 | |
| 2644 | area = vty->index; |
| 2645 | interval = atoi (argv[0]); |
| 2646 | level = IS_LEVEL_2; |
| 2647 | return set_lsp_max_lifetime (vty, area, interval, level); |
| 2648 | } |
| 2649 | |
| 2650 | DEFUN (no_max_lsp_lifetime_l2, |
| 2651 | no_max_lsp_lifetime_l2_cmd, |
| 2652 | "no max-lsp-lifetime level-2", |
| 2653 | NO_STR |
| 2654 | "LSP lifetime for Level 2 only in seconds\n") |
| 2655 | { |
| 2656 | struct isis_area *area; |
| 2657 | uint16_t interval; |
| 2658 | int level; |
| 2659 | |
| 2660 | area = vty->index; |
| 2661 | interval = DEFAULT_LSP_LIFETIME; |
| 2662 | level = IS_LEVEL_2; |
| 2663 | return set_lsp_max_lifetime (vty, area, interval, level); |
| 2664 | } |
| 2665 | |
| 2666 | ALIAS (no_max_lsp_lifetime_l2, |
| 2667 | no_max_lsp_lifetime_l2_arg_cmd, |
| 2668 | "no max-lsp-lifetime level-2 <350-65535>", |
| 2669 | NO_STR |
| 2670 | "Maximum LSP lifetime for Level 2 only\n" |
| 2671 | "LSP lifetime for Level 2 only in seconds\n") |
| 2672 | |
| 2673 | static int |
| 2674 | set_lsp_refresh_interval (struct vty *vty, struct isis_area *area, |
| 2675 | uint16_t interval, int level) |
| 2676 | { |
| 2677 | int lvl; |
| 2678 | |
| 2679 | for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl) |
| 2680 | { |
| 2681 | if (!(lvl & level)) |
| 2682 | continue; |
| 2683 | if (interval <= area->lsp_gen_interval[lvl-1]) |
| 2684 | { |
| 2685 | vty_out (vty, "LSP refresh interval %us must be greater than " |
| 2686 | "the configured LSP gen interval %us%s", |
| 2687 | interval, area->lsp_gen_interval[lvl-1], |
| 2688 | VTY_NEWLINE); |
| 2689 | return CMD_ERR_AMBIGUOUS; |
| 2690 | } |
| 2691 | if (interval > (area->max_lsp_lifetime[lvl-1] - 300)) |
| 2692 | { |
| 2693 | vty_out (vty, "LSP refresh interval %us must be less than " |
| 2694 | "the configured LSP lifetime %us less 300%s", |
| 2695 | interval, area->max_lsp_lifetime[lvl-1], |
| 2696 | VTY_NEWLINE); |
| 2697 | return CMD_ERR_AMBIGUOUS; |
| 2698 | } |
| 2699 | } |
| 2700 | |
| 2701 | for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl) |
| 2702 | { |
| 2703 | if (!(lvl & level)) |
| 2704 | continue; |
| 2705 | area->lsp_refresh[lvl-1] = interval; |
| 2706 | } |
| 2707 | lsp_regenerate_schedule (area, level, 1); |
| 2708 | |
| 2709 | return CMD_SUCCESS; |
| 2710 | } |
| 2711 | |
| 2712 | DEFUN (lsp_refresh_interval, |
| 2713 | lsp_refresh_interval_cmd, |
| 2714 | "lsp-refresh-interval <1-65235>", |
| 2715 | "LSP refresh interval\n" |
| 2716 | "LSP refresh interval in seconds\n") |
| 2717 | { |
| 2718 | struct isis_area *area; |
| 2719 | uint16_t interval; |
| 2720 | int level; |
| 2721 | |
| 2722 | area = vty->index; |
| 2723 | interval = atoi (argv[0]); |
| 2724 | level = IS_LEVEL_1 | IS_LEVEL_2; |
| 2725 | return set_lsp_refresh_interval (vty, area, interval, level); |
| 2726 | } |
| 2727 | |
| 2728 | DEFUN (no_lsp_refresh_interval, |
| 2729 | no_lsp_refresh_interval_cmd, |
| 2730 | "no lsp-refresh-interval", |
| 2731 | NO_STR |
| 2732 | "LSP refresh interval in seconds\n") |
| 2733 | { |
| 2734 | struct isis_area *area; |
| 2735 | uint16_t interval; |
| 2736 | int level; |
| 2737 | |
| 2738 | area = vty->index; |
| 2739 | interval = DEFAULT_MAX_LSP_GEN_INTERVAL; |
| 2740 | level = IS_LEVEL_1 | IS_LEVEL_2; |
| 2741 | return set_lsp_refresh_interval (vty, area, interval, level); |
| 2742 | } |
| 2743 | |
| 2744 | ALIAS (no_lsp_refresh_interval, |
| 2745 | no_lsp_refresh_interval_arg_cmd, |
| 2746 | "no lsp-refresh-interval <1-65235>", |
| 2747 | NO_STR |
| 2748 | "LSP refresh interval\n" |
| 2749 | "LSP refresh interval in seconds\n") |
| 2750 | |
| 2751 | DEFUN (lsp_refresh_interval_l1, |
| 2752 | lsp_refresh_interval_l1_cmd, |
| 2753 | "lsp-refresh-interval level-1 <1-65235>", |
| 2754 | "LSP refresh interval for Level 1 only\n" |
| 2755 | "LSP refresh interval for Level 1 only in seconds\n") |
| 2756 | { |
| 2757 | struct isis_area *area; |
| 2758 | uint16_t interval; |
| 2759 | int level; |
| 2760 | |
| 2761 | area = vty->index; |
| 2762 | interval = atoi (argv[0]); |
| 2763 | level = IS_LEVEL_1; |
| 2764 | return set_lsp_refresh_interval (vty, area, interval, level); |
| 2765 | } |
| 2766 | |
| 2767 | DEFUN (no_lsp_refresh_interval_l1, |
| 2768 | no_lsp_refresh_interval_l1_cmd, |
| 2769 | "no lsp-refresh-interval level-1", |
| 2770 | NO_STR |
| 2771 | "LSP refresh interval for Level 1 only in seconds\n") |
| 2772 | { |
| 2773 | struct isis_area *area; |
| 2774 | uint16_t interval; |
| 2775 | int level; |
| 2776 | |
| 2777 | area = vty->index; |
| 2778 | interval = DEFAULT_MAX_LSP_GEN_INTERVAL; |
| 2779 | level = IS_LEVEL_1; |
| 2780 | return set_lsp_refresh_interval (vty, area, interval, level); |
| 2781 | } |
| 2782 | |
| 2783 | ALIAS (no_lsp_refresh_interval_l1, |
| 2784 | no_lsp_refresh_interval_l1_arg_cmd, |
| 2785 | "no lsp-refresh-interval level-1 <1-65235>", |
| 2786 | NO_STR |
| 2787 | "LSP refresh interval for Level 1 only\n" |
| 2788 | "LSP refresh interval for Level 1 only in seconds\n") |
| 2789 | |
| 2790 | DEFUN (lsp_refresh_interval_l2, |
| 2791 | lsp_refresh_interval_l2_cmd, |
| 2792 | "lsp-refresh-interval level-2 <1-65235>", |
| 2793 | "LSP refresh interval for Level 2 only\n" |
| 2794 | "LSP refresh interval for Level 2 only in seconds\n") |
| 2795 | { |
| 2796 | struct isis_area *area; |
| 2797 | uint16_t interval; |
| 2798 | int level; |
| 2799 | |
| 2800 | area = vty->index; |
| 2801 | interval = atoi (argv[0]); |
| 2802 | level = IS_LEVEL_2; |
| 2803 | return set_lsp_refresh_interval (vty, area, interval, level); |
| 2804 | } |
| 2805 | |
| 2806 | DEFUN (no_lsp_refresh_interval_l2, |
| 2807 | no_lsp_refresh_interval_l2_cmd, |
| 2808 | "no lsp-refresh-interval level-2", |
| 2809 | NO_STR |
| 2810 | "LSP refresh interval for Level 2 only in seconds\n") |
| 2811 | { |
| 2812 | struct isis_area *area; |
| 2813 | uint16_t interval; |
| 2814 | int level; |
| 2815 | |
| 2816 | area = vty->index; |
| 2817 | interval = DEFAULT_MAX_LSP_GEN_INTERVAL; |
| 2818 | level = IS_LEVEL_2; |
| 2819 | return set_lsp_refresh_interval (vty, area, interval, level); |
| 2820 | } |
| 2821 | |
| 2822 | ALIAS (no_lsp_refresh_interval_l2, |
| 2823 | no_lsp_refresh_interval_l2_arg_cmd, |
| 2824 | "no lsp-refresh-interval level-2 <1-65235>", |
| 2825 | NO_STR |
| 2826 | "LSP refresh interval for Level 2 only\n" |
| 2827 | "LSP refresh interval for Level 2 only in seconds\n") |
| 2828 | |
| 2829 | DEFUN (log_adj_changes, |
| 2830 | log_adj_changes_cmd, |
| 2831 | "log-adjacency-changes", |
| 2832 | "Log changes in adjacency state\n") |
| 2833 | { |
| 2834 | struct isis_area *area; |
| 2835 | |
| 2836 | area = vty->index; |
| 2837 | assert (area); |
| 2838 | |
| 2839 | area->log_adj_changes = 1; |
| 2840 | |
| 2841 | return CMD_SUCCESS; |
| 2842 | } |
| 2843 | |
| 2844 | DEFUN (no_log_adj_changes, |
| 2845 | no_log_adj_changes_cmd, |
| 2846 | "no log-adjacency-changes", |
| 2847 | "Stop logging changes in adjacency state\n") |
| 2848 | { |
| 2849 | struct isis_area *area; |
| 2850 | |
| 2851 | area = vty->index; |
| 2852 | assert (area); |
| 2853 | |
| 2854 | area->log_adj_changes = 0; |
| 2855 | |
| 2856 | return CMD_SUCCESS; |
| 2857 | } |
| 2858 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2859 | #ifdef TOPOLOGY_GENERATE |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2860 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2861 | DEFUN (topology_generate_grid, |
| 2862 | topology_generate_grid_cmd, |
| 2863 | "topology generate grid <1-100> <1-100> <1-65000> [param] [param] " |
| 2864 | "[param]", |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 2865 | "Topology generation for IS-IS\n" |
| 2866 | "Topology generation\n" |
| 2867 | "Grid topology\n" |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2868 | "X parameter of the grid\n" |
| 2869 | "Y parameter of the grid\n" |
| 2870 | "Random seed\n" |
| 2871 | "Optional param 1\n" |
| 2872 | "Optional param 2\n" |
| 2873 | "Optional param 3\n" |
| 2874 | "Topology\n") |
| 2875 | { |
| 2876 | struct isis_area *area; |
| 2877 | |
| 2878 | area = vty->index; |
| 2879 | assert (area); |
| 2880 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2881 | if (!spgrid_check_params (vty, argc, argv)) |
| 2882 | { |
| 2883 | if (area->topology) |
| 2884 | list_delete (area->topology); |
| 2885 | area->topology = list_new (); |
| 2886 | memcpy (area->top_params, vty->buf, 200); |
| 2887 | gen_spgrid_topology (vty, area->topology); |
| 2888 | remove_topology_lsps (area); |
| 2889 | generate_topology_lsps (area); |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 2890 | /* Regenerate L1 LSP to get two way connection to the generated |
| 2891 | * topology. */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2892 | lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2893 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2894 | |
| 2895 | return CMD_SUCCESS; |
| 2896 | } |
| 2897 | |
hasso | f695b01 | 2005-04-02 19:03:39 +0000 | [diff] [blame] | 2898 | DEFUN (show_isis_generated_topology, |
| 2899 | show_isis_generated_topology_cmd, |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 2900 | "show isis generated-topologies", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2901 | SHOW_STR |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2902 | "ISIS network information\n" |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 2903 | "Show generated topologies\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2904 | { |
| 2905 | struct isis_area *area; |
paul | 92c9f22 | 2005-05-25 12:21:13 +0000 | [diff] [blame] | 2906 | struct listnode *node; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2907 | struct listnode *node2; |
| 2908 | struct arc *arc; |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 2909 | |
paul | 92c9f22 | 2005-05-25 12:21:13 +0000 | [diff] [blame] | 2910 | for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area)) |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 2911 | { |
| 2912 | if (!area->topology) |
| 2913 | continue; |
| 2914 | |
| 2915 | vty_out (vty, "Topology for isis area: %s%s", area->area_tag, |
| 2916 | VTY_NEWLINE); |
| 2917 | vty_out (vty, "From node To node Distance%s", VTY_NEWLINE); |
| 2918 | |
| 2919 | for (ALL_LIST_ELEMENTS_RO (area->topology, node2, arc)) |
| 2920 | vty_out (vty, "%9ld %11ld %12ld%s", arc->from_node, arc->to_node, |
| 2921 | arc->distance, VTY_NEWLINE); |
| 2922 | } |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2923 | return CMD_SUCCESS; |
| 2924 | } |
| 2925 | |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 2926 | /* Base IS for topology generation. */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2927 | DEFUN (topology_baseis, |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2928 | topology_baseis_cmd, |
| 2929 | "topology base-is WORD", |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 2930 | "Topology generation for IS-IS\n" |
| 2931 | "A Network IS Base for this topology\n" |
| 2932 | "XXXX.XXXX.XXXX Network entity title (NET)\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2933 | { |
| 2934 | struct isis_area *area; |
| 2935 | u_char buff[ISIS_SYS_ID_LEN]; |
| 2936 | |
| 2937 | area = vty->index; |
| 2938 | assert (area); |
| 2939 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2940 | if (sysid2buff (buff, argv[0])) |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 2941 | sysid2buff (area->topology_baseis, argv[0]); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2942 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2943 | return CMD_SUCCESS; |
| 2944 | } |
| 2945 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2946 | DEFUN (no_topology_baseis, |
| 2947 | no_topology_baseis_cmd, |
| 2948 | "no topology base-is WORD", |
| 2949 | NO_STR |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 2950 | "Topology generation for IS-IS\n" |
| 2951 | "A Network IS Base for this topology\n" |
| 2952 | "XXXX.XXXX.XXXX Network entity title (NET)\n") |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2953 | { |
| 2954 | struct isis_area *area; |
| 2955 | |
| 2956 | area = vty->index; |
| 2957 | assert (area); |
| 2958 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2959 | memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2960 | return CMD_SUCCESS; |
| 2961 | } |
| 2962 | |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 2963 | ALIAS (no_topology_baseis, |
| 2964 | no_topology_baseis_noid_cmd, |
| 2965 | "no topology base-is", |
| 2966 | NO_STR |
| 2967 | "Topology generation for IS-IS\n" |
| 2968 | "A Network IS Base for this topology\n") |
| 2969 | |
| 2970 | DEFUN (topology_basedynh, |
| 2971 | topology_basedynh_cmd, |
| 2972 | "topology base-dynh WORD", |
| 2973 | "Topology generation for IS-IS\n" |
| 2974 | "Dynamic hostname base for this topology\n" |
| 2975 | "Dynamic hostname base\n") |
| 2976 | { |
| 2977 | struct isis_area *area; |
| 2978 | |
| 2979 | area = vty->index; |
| 2980 | assert (area); |
| 2981 | |
| 2982 | /* I hope that it's enough. */ |
| 2983 | area->topology_basedynh = strndup (argv[0], 16); |
| 2984 | return CMD_SUCCESS; |
| 2985 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 2986 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2987 | #endif /* TOPOLOGY_GENERATE */ |
| 2988 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2989 | /* IS-IS configuration write function */ |
| 2990 | int |
| 2991 | isis_config_write (struct vty *vty) |
| 2992 | { |
| 2993 | int write = 0; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2994 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 2995 | if (isis != NULL) |
| 2996 | { |
| 2997 | struct isis_area *area; |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 2998 | struct listnode *node, *node2; |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2999 | |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 3000 | for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area)) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3001 | { |
| 3002 | /* ISIS - Area name */ |
| 3003 | vty_out (vty, "router isis %s%s", area->area_tag, VTY_NEWLINE); |
| 3004 | write++; |
| 3005 | /* ISIS - Net */ |
| 3006 | if (listcount (area->area_addrs) > 0) |
| 3007 | { |
| 3008 | struct area_addr *area_addr; |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 3009 | for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node2, area_addr)) |
| 3010 | { |
| 3011 | vty_out (vty, " net %s%s", |
| 3012 | isonet_print (area_addr->area_addr, |
| 3013 | area_addr->addr_len + ISIS_SYS_ID_LEN + |
| 3014 | 1), VTY_NEWLINE); |
| 3015 | write++; |
| 3016 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3017 | } |
hasso | 3fdb2dd | 2005-09-28 18:45:54 +0000 | [diff] [blame] | 3018 | /* ISIS - Dynamic hostname - Defaults to true so only display if |
| 3019 | * false. */ |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3020 | if (!area->dynhostname) |
| 3021 | { |
| 3022 | vty_out (vty, " no hostname dynamic%s", VTY_NEWLINE); |
| 3023 | write++; |
| 3024 | } |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 3025 | /* ISIS - Metric-Style - when true displays wide */ |
| 3026 | if (area->newmetric) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3027 | { |
Subbaiah Venkata | e38e0df | 2012-03-27 23:48:05 -0700 | [diff] [blame] | 3028 | if (!area->oldmetric) |
| 3029 | vty_out (vty, " metric-style wide%s", VTY_NEWLINE); |
hasso | 2984d26 | 2005-09-26 16:49:07 +0000 | [diff] [blame] | 3030 | else |
| 3031 | vty_out (vty, " metric-style transition%s", VTY_NEWLINE); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3032 | write++; |
| 3033 | } |
Christian Franke | f818c8f | 2012-11-27 01:10:28 +0000 | [diff] [blame] | 3034 | else |
| 3035 | { |
| 3036 | vty_out (vty, " metric-style narrow%s", VTY_NEWLINE); |
| 3037 | write++; |
| 3038 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3039 | /* ISIS - overload-bit */ |
| 3040 | if (area->overload_bit) |
| 3041 | { |
| 3042 | vty_out (vty, " set-overload-bit%s", VTY_NEWLINE); |
| 3043 | write++; |
| 3044 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3045 | /* ISIS - Area is-type (level-1-2 is default) */ |
| 3046 | if (area->is_type == IS_LEVEL_1) |
| 3047 | { |
| 3048 | vty_out (vty, " is-type level-1%s", VTY_NEWLINE); |
| 3049 | write++; |
| 3050 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3051 | else if (area->is_type == IS_LEVEL_2) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3052 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3053 | vty_out (vty, " is-type level-2-only%s", VTY_NEWLINE); |
| 3054 | write++; |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3055 | } |
Christian Franke | acf9865 | 2015-11-12 14:24:22 +0100 | [diff] [blame] | 3056 | write += isis_redist_config_write(vty, area, AF_INET); |
| 3057 | write += isis_redist_config_write(vty, area, AF_INET6); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3058 | /* ISIS - Lsp generation interval */ |
| 3059 | if (area->lsp_gen_interval[0] == area->lsp_gen_interval[1]) |
| 3060 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3061 | if (area->lsp_gen_interval[0] != DEFAULT_MIN_LSP_GEN_INTERVAL) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3062 | { |
| 3063 | vty_out (vty, " lsp-gen-interval %d%s", |
| 3064 | area->lsp_gen_interval[0], VTY_NEWLINE); |
| 3065 | write++; |
| 3066 | } |
| 3067 | } |
| 3068 | else |
| 3069 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3070 | if (area->lsp_gen_interval[0] != DEFAULT_MIN_LSP_GEN_INTERVAL) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3071 | { |
| 3072 | vty_out (vty, " lsp-gen-interval level-1 %d%s", |
| 3073 | area->lsp_gen_interval[0], VTY_NEWLINE); |
| 3074 | write++; |
| 3075 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3076 | if (area->lsp_gen_interval[1] != DEFAULT_MIN_LSP_GEN_INTERVAL) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3077 | { |
| 3078 | vty_out (vty, " lsp-gen-interval level-2 %d%s", |
| 3079 | area->lsp_gen_interval[1], VTY_NEWLINE); |
| 3080 | write++; |
| 3081 | } |
| 3082 | } |
| 3083 | /* ISIS - LSP lifetime */ |
| 3084 | if (area->max_lsp_lifetime[0] == area->max_lsp_lifetime[1]) |
| 3085 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3086 | if (area->max_lsp_lifetime[0] != DEFAULT_LSP_LIFETIME) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3087 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3088 | vty_out (vty, " max-lsp-lifetime %u%s", area->max_lsp_lifetime[0], |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3089 | VTY_NEWLINE); |
| 3090 | write++; |
| 3091 | } |
| 3092 | } |
| 3093 | else |
| 3094 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3095 | if (area->max_lsp_lifetime[0] != DEFAULT_LSP_LIFETIME) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3096 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3097 | vty_out (vty, " max-lsp-lifetime level-1 %u%s", |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3098 | area->max_lsp_lifetime[0], VTY_NEWLINE); |
| 3099 | write++; |
| 3100 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3101 | if (area->max_lsp_lifetime[1] != DEFAULT_LSP_LIFETIME) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3102 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3103 | vty_out (vty, " max-lsp-lifetime level-2 %u%s", |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3104 | area->max_lsp_lifetime[1], VTY_NEWLINE); |
| 3105 | write++; |
| 3106 | } |
| 3107 | } |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3108 | /* ISIS - LSP refresh interval */ |
| 3109 | if (area->lsp_refresh[0] == area->lsp_refresh[1]) |
| 3110 | { |
| 3111 | if (area->lsp_refresh[0] != DEFAULT_MAX_LSP_GEN_INTERVAL) |
| 3112 | { |
| 3113 | vty_out (vty, " lsp-refresh-interval %u%s", area->lsp_refresh[0], |
| 3114 | VTY_NEWLINE); |
| 3115 | write++; |
| 3116 | } |
| 3117 | } |
| 3118 | else |
| 3119 | { |
| 3120 | if (area->lsp_refresh[0] != DEFAULT_MAX_LSP_GEN_INTERVAL) |
| 3121 | { |
| 3122 | vty_out (vty, " lsp-refresh-interval level-1 %u%s", |
| 3123 | area->lsp_refresh[0], VTY_NEWLINE); |
| 3124 | write++; |
| 3125 | } |
| 3126 | if (area->lsp_refresh[1] != DEFAULT_MAX_LSP_GEN_INTERVAL) |
| 3127 | { |
| 3128 | vty_out (vty, " lsp-refresh-interval level-2 %u%s", |
| 3129 | area->lsp_refresh[1], VTY_NEWLINE); |
| 3130 | write++; |
| 3131 | } |
| 3132 | } |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame] | 3133 | if (area->lsp_mtu != DEFAULT_LSP_MTU) |
| 3134 | { |
| 3135 | vty_out(vty, " lsp-mtu %u%s", area->lsp_mtu, VTY_NEWLINE); |
| 3136 | write++; |
| 3137 | } |
| 3138 | |
hasso | 13fb40a | 2005-10-01 06:03:04 +0000 | [diff] [blame] | 3139 | /* Minimum SPF interval. */ |
| 3140 | if (area->min_spf_interval[0] == area->min_spf_interval[1]) |
| 3141 | { |
| 3142 | if (area->min_spf_interval[0] != MINIMUM_SPF_INTERVAL) |
| 3143 | { |
| 3144 | vty_out (vty, " spf-interval %d%s", |
| 3145 | area->min_spf_interval[0], VTY_NEWLINE); |
| 3146 | write++; |
| 3147 | } |
| 3148 | } |
| 3149 | else |
| 3150 | { |
| 3151 | if (area->min_spf_interval[0] != MINIMUM_SPF_INTERVAL) |
| 3152 | { |
| 3153 | vty_out (vty, " spf-interval level-1 %d%s", |
| 3154 | area->min_spf_interval[0], VTY_NEWLINE); |
| 3155 | write++; |
| 3156 | } |
| 3157 | if (area->min_spf_interval[1] != MINIMUM_SPF_INTERVAL) |
| 3158 | { |
| 3159 | vty_out (vty, " spf-interval level-2 %d%s", |
| 3160 | area->min_spf_interval[1], VTY_NEWLINE); |
| 3161 | write++; |
| 3162 | } |
| 3163 | } |
hasso | 53c997c | 2004-09-15 16:21:59 +0000 | [diff] [blame] | 3164 | /* Authentication passwords. */ |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3165 | if (area->area_passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5) |
hasso | 53c997c | 2004-09-15 16:21:59 +0000 | [diff] [blame] | 3166 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3167 | vty_out(vty, " area-password md5 %s", area->area_passwd.passwd); |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 3168 | if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND)) |
| 3169 | { |
| 3170 | vty_out(vty, " authenticate snp "); |
| 3171 | if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV)) |
| 3172 | vty_out(vty, "validate"); |
| 3173 | else |
| 3174 | vty_out(vty, "send-only"); |
| 3175 | } |
| 3176 | vty_out(vty, "%s", VTY_NEWLINE); |
hasso | 53c997c | 2004-09-15 16:21:59 +0000 | [diff] [blame] | 3177 | write++; |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3178 | } |
| 3179 | else if (area->area_passwd.type == ISIS_PASSWD_TYPE_CLEARTXT) |
| 3180 | { |
| 3181 | vty_out(vty, " area-password clear %s", area->area_passwd.passwd); |
| 3182 | if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND)) |
| 3183 | { |
| 3184 | vty_out(vty, " authenticate snp "); |
| 3185 | if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV)) |
| 3186 | vty_out(vty, "validate"); |
| 3187 | else |
| 3188 | vty_out(vty, "send-only"); |
| 3189 | } |
| 3190 | vty_out(vty, "%s", VTY_NEWLINE); |
| 3191 | write++; |
| 3192 | } |
| 3193 | if (area->domain_passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5) |
hasso | 53c997c | 2004-09-15 16:21:59 +0000 | [diff] [blame] | 3194 | { |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3195 | vty_out(vty, " domain-password md5 %s", |
| 3196 | area->domain_passwd.passwd); |
| 3197 | if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND)) |
| 3198 | { |
| 3199 | vty_out(vty, " authenticate snp "); |
| 3200 | if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV)) |
| 3201 | vty_out(vty, "validate"); |
| 3202 | else |
| 3203 | vty_out(vty, "send-only"); |
| 3204 | } |
| 3205 | vty_out(vty, "%s", VTY_NEWLINE); |
| 3206 | write++; |
| 3207 | } |
| 3208 | else if (area->domain_passwd.type == ISIS_PASSWD_TYPE_CLEARTXT) |
| 3209 | { |
| 3210 | vty_out(vty, " domain-password clear %s", |
| 3211 | area->domain_passwd.passwd); |
hasso | 1cbc562 | 2005-01-01 10:29:51 +0000 | [diff] [blame] | 3212 | if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND)) |
| 3213 | { |
| 3214 | vty_out(vty, " authenticate snp "); |
| 3215 | if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV)) |
| 3216 | vty_out(vty, "validate"); |
| 3217 | else |
| 3218 | vty_out(vty, "send-only"); |
| 3219 | } |
| 3220 | vty_out(vty, "%s", VTY_NEWLINE); |
hasso | 53c997c | 2004-09-15 16:21:59 +0000 | [diff] [blame] | 3221 | write++; |
| 3222 | } |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 3223 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3224 | if (area->log_adj_changes) |
| 3225 | { |
| 3226 | vty_out (vty, " log-adjacency-changes%s", VTY_NEWLINE); |
| 3227 | write++; |
| 3228 | } |
| 3229 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3230 | #ifdef TOPOLOGY_GENERATE |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 3231 | if (memcmp (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, |
| 3232 | ISIS_SYS_ID_LEN)) |
| 3233 | { |
| 3234 | vty_out (vty, " topology base-is %s%s", |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3235 | sysid_print ((u_char *)area->topology_baseis), VTY_NEWLINE); |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 3236 | write++; |
| 3237 | } |
| 3238 | if (area->topology_basedynh) |
| 3239 | { |
| 3240 | vty_out (vty, " topology base-dynh %s%s", |
| 3241 | area->topology_basedynh, VTY_NEWLINE); |
| 3242 | write++; |
| 3243 | } |
| 3244 | /* We save the whole command line here. */ |
| 3245 | if (strlen(area->top_params)) |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3246 | { |
| 3247 | vty_out (vty, " %s%s", area->top_params, VTY_NEWLINE); |
| 3248 | write++; |
| 3249 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3250 | #endif /* TOPOLOGY_GENERATE */ |
hasso | f1082d1 | 2005-09-19 04:23:34 +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 | } |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3254 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3255 | return write; |
| 3256 | } |
| 3257 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3258 | struct cmd_node isis_node = { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3259 | ISIS_NODE, |
hasso | 2097cd8 | 2003-12-23 11:51:08 +0000 | [diff] [blame] | 3260 | "%s(config-router)# ", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3261 | 1 |
| 3262 | }; |
| 3263 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3264 | void |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3265 | isis_init () |
| 3266 | { |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3267 | /* Install IS-IS top node */ |
| 3268 | install_node (&isis_node, isis_config_write); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3269 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3270 | install_element (VIEW_NODE, &show_isis_summary_cmd); |
| 3271 | |
| 3272 | install_element (VIEW_NODE, &show_isis_interface_cmd); |
| 3273 | install_element (VIEW_NODE, &show_isis_interface_detail_cmd); |
| 3274 | install_element (VIEW_NODE, &show_isis_interface_arg_cmd); |
| 3275 | |
| 3276 | install_element (VIEW_NODE, &show_isis_neighbor_cmd); |
| 3277 | install_element (VIEW_NODE, &show_isis_neighbor_detail_cmd); |
| 3278 | install_element (VIEW_NODE, &show_isis_neighbor_arg_cmd); |
| 3279 | install_element (VIEW_NODE, &clear_isis_neighbor_cmd); |
| 3280 | install_element (VIEW_NODE, &clear_isis_neighbor_arg_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3281 | |
| 3282 | install_element (VIEW_NODE, &show_hostname_cmd); |
| 3283 | install_element (VIEW_NODE, &show_database_cmd); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3284 | install_element (VIEW_NODE, &show_database_arg_cmd); |
| 3285 | install_element (VIEW_NODE, &show_database_arg_detail_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3286 | install_element (VIEW_NODE, &show_database_detail_cmd); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3287 | install_element (VIEW_NODE, &show_database_detail_arg_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3288 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3289 | install_element (ENABLE_NODE, &show_isis_summary_cmd); |
| 3290 | |
| 3291 | install_element (ENABLE_NODE, &show_isis_interface_cmd); |
| 3292 | install_element (ENABLE_NODE, &show_isis_interface_detail_cmd); |
| 3293 | install_element (ENABLE_NODE, &show_isis_interface_arg_cmd); |
| 3294 | |
| 3295 | install_element (ENABLE_NODE, &show_isis_neighbor_cmd); |
| 3296 | install_element (ENABLE_NODE, &show_isis_neighbor_detail_cmd); |
| 3297 | install_element (ENABLE_NODE, &show_isis_neighbor_arg_cmd); |
| 3298 | install_element (ENABLE_NODE, &clear_isis_neighbor_cmd); |
| 3299 | install_element (ENABLE_NODE, &clear_isis_neighbor_arg_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3300 | |
| 3301 | install_element (ENABLE_NODE, &show_hostname_cmd); |
| 3302 | install_element (ENABLE_NODE, &show_database_cmd); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3303 | install_element (ENABLE_NODE, &show_database_arg_cmd); |
| 3304 | install_element (ENABLE_NODE, &show_database_arg_detail_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3305 | install_element (ENABLE_NODE, &show_database_detail_cmd); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3306 | install_element (ENABLE_NODE, &show_database_detail_arg_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3307 | install_element (ENABLE_NODE, &show_debugging_cmd); |
| 3308 | |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3309 | install_node (&debug_node, config_write_debug); |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 3310 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3311 | install_element (ENABLE_NODE, &debug_isis_adj_cmd); |
| 3312 | install_element (ENABLE_NODE, &no_debug_isis_adj_cmd); |
| 3313 | install_element (ENABLE_NODE, &debug_isis_csum_cmd); |
| 3314 | install_element (ENABLE_NODE, &no_debug_isis_csum_cmd); |
| 3315 | install_element (ENABLE_NODE, &debug_isis_lupd_cmd); |
| 3316 | install_element (ENABLE_NODE, &no_debug_isis_lupd_cmd); |
| 3317 | install_element (ENABLE_NODE, &debug_isis_err_cmd); |
| 3318 | install_element (ENABLE_NODE, &no_debug_isis_err_cmd); |
| 3319 | install_element (ENABLE_NODE, &debug_isis_snp_cmd); |
| 3320 | install_element (ENABLE_NODE, &no_debug_isis_snp_cmd); |
| 3321 | install_element (ENABLE_NODE, &debug_isis_upd_cmd); |
| 3322 | install_element (ENABLE_NODE, &no_debug_isis_upd_cmd); |
| 3323 | install_element (ENABLE_NODE, &debug_isis_spfevents_cmd); |
| 3324 | install_element (ENABLE_NODE, &no_debug_isis_spfevents_cmd); |
| 3325 | install_element (ENABLE_NODE, &debug_isis_spfstats_cmd); |
| 3326 | install_element (ENABLE_NODE, &no_debug_isis_spfstats_cmd); |
| 3327 | install_element (ENABLE_NODE, &debug_isis_spftrigg_cmd); |
| 3328 | install_element (ENABLE_NODE, &no_debug_isis_spftrigg_cmd); |
| 3329 | install_element (ENABLE_NODE, &debug_isis_rtevents_cmd); |
| 3330 | install_element (ENABLE_NODE, &no_debug_isis_rtevents_cmd); |
| 3331 | install_element (ENABLE_NODE, &debug_isis_events_cmd); |
| 3332 | install_element (ENABLE_NODE, &no_debug_isis_events_cmd); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3333 | install_element (ENABLE_NODE, &debug_isis_packet_dump_cmd); |
| 3334 | install_element (ENABLE_NODE, &no_debug_isis_packet_dump_cmd); |
Christian Franke | 80a8f72 | 2015-11-12 14:21:47 +0100 | [diff] [blame] | 3335 | install_element (ENABLE_NODE, &debug_isis_lsp_gen_cmd); |
| 3336 | install_element (ENABLE_NODE, &no_debug_isis_lsp_gen_cmd); |
Christian Franke | 61010c3 | 2015-11-10 18:43:34 +0100 | [diff] [blame] | 3337 | install_element (ENABLE_NODE, &debug_isis_lsp_sched_cmd); |
| 3338 | install_element (ENABLE_NODE, &no_debug_isis_lsp_sched_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3339 | |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 3340 | install_element (CONFIG_NODE, &debug_isis_adj_cmd); |
| 3341 | install_element (CONFIG_NODE, &no_debug_isis_adj_cmd); |
| 3342 | install_element (CONFIG_NODE, &debug_isis_csum_cmd); |
| 3343 | install_element (CONFIG_NODE, &no_debug_isis_csum_cmd); |
| 3344 | install_element (CONFIG_NODE, &debug_isis_lupd_cmd); |
| 3345 | install_element (CONFIG_NODE, &no_debug_isis_lupd_cmd); |
| 3346 | install_element (CONFIG_NODE, &debug_isis_err_cmd); |
| 3347 | install_element (CONFIG_NODE, &no_debug_isis_err_cmd); |
| 3348 | install_element (CONFIG_NODE, &debug_isis_snp_cmd); |
| 3349 | install_element (CONFIG_NODE, &no_debug_isis_snp_cmd); |
| 3350 | install_element (CONFIG_NODE, &debug_isis_upd_cmd); |
| 3351 | install_element (CONFIG_NODE, &no_debug_isis_upd_cmd); |
| 3352 | install_element (CONFIG_NODE, &debug_isis_spfevents_cmd); |
| 3353 | install_element (CONFIG_NODE, &no_debug_isis_spfevents_cmd); |
| 3354 | install_element (CONFIG_NODE, &debug_isis_spfstats_cmd); |
| 3355 | install_element (CONFIG_NODE, &no_debug_isis_spfstats_cmd); |
| 3356 | install_element (CONFIG_NODE, &debug_isis_spftrigg_cmd); |
| 3357 | install_element (CONFIG_NODE, &no_debug_isis_spftrigg_cmd); |
| 3358 | install_element (CONFIG_NODE, &debug_isis_rtevents_cmd); |
| 3359 | install_element (CONFIG_NODE, &no_debug_isis_rtevents_cmd); |
| 3360 | install_element (CONFIG_NODE, &debug_isis_events_cmd); |
| 3361 | install_element (CONFIG_NODE, &no_debug_isis_events_cmd); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3362 | install_element (CONFIG_NODE, &debug_isis_packet_dump_cmd); |
| 3363 | install_element (CONFIG_NODE, &no_debug_isis_packet_dump_cmd); |
Christian Franke | 80a8f72 | 2015-11-12 14:21:47 +0100 | [diff] [blame] | 3364 | install_element (CONFIG_NODE, &debug_isis_lsp_gen_cmd); |
| 3365 | install_element (CONFIG_NODE, &no_debug_isis_lsp_gen_cmd); |
Christian Franke | 61010c3 | 2015-11-10 18:43:34 +0100 | [diff] [blame] | 3366 | install_element (CONFIG_NODE, &debug_isis_lsp_sched_cmd); |
| 3367 | install_element (CONFIG_NODE, &no_debug_isis_lsp_sched_cmd); |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 3368 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3369 | install_element (CONFIG_NODE, &router_isis_cmd); |
| 3370 | install_element (CONFIG_NODE, &no_router_isis_cmd); |
| 3371 | |
| 3372 | install_default (ISIS_NODE); |
| 3373 | |
| 3374 | install_element (ISIS_NODE, &net_cmd); |
| 3375 | install_element (ISIS_NODE, &no_net_cmd); |
| 3376 | |
| 3377 | install_element (ISIS_NODE, &is_type_cmd); |
| 3378 | install_element (ISIS_NODE, &no_is_type_cmd); |
| 3379 | |
Christian Franke | f1fc1db | 2015-11-10 18:43:31 +0100 | [diff] [blame] | 3380 | install_element (ISIS_NODE, &area_lsp_mtu_cmd); |
| 3381 | install_element (ISIS_NODE, &no_area_lsp_mtu_cmd); |
| 3382 | install_element (ISIS_NODE, &no_area_lsp_mtu_arg_cmd); |
| 3383 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3384 | install_element (ISIS_NODE, &area_passwd_md5_cmd); |
| 3385 | install_element (ISIS_NODE, &area_passwd_md5_snpauth_cmd); |
| 3386 | install_element (ISIS_NODE, &area_passwd_clear_cmd); |
| 3387 | install_element (ISIS_NODE, &area_passwd_clear_snpauth_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3388 | install_element (ISIS_NODE, &no_area_passwd_cmd); |
| 3389 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3390 | install_element (ISIS_NODE, &domain_passwd_md5_cmd); |
| 3391 | install_element (ISIS_NODE, &domain_passwd_md5_snpauth_cmd); |
| 3392 | install_element (ISIS_NODE, &domain_passwd_clear_cmd); |
| 3393 | install_element (ISIS_NODE, &domain_passwd_clear_snpauth_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3394 | install_element (ISIS_NODE, &no_domain_passwd_cmd); |
| 3395 | |
| 3396 | install_element (ISIS_NODE, &lsp_gen_interval_cmd); |
| 3397 | install_element (ISIS_NODE, &no_lsp_gen_interval_cmd); |
| 3398 | install_element (ISIS_NODE, &no_lsp_gen_interval_arg_cmd); |
| 3399 | install_element (ISIS_NODE, &lsp_gen_interval_l1_cmd); |
| 3400 | install_element (ISIS_NODE, &no_lsp_gen_interval_l1_cmd); |
| 3401 | install_element (ISIS_NODE, &no_lsp_gen_interval_l1_arg_cmd); |
| 3402 | install_element (ISIS_NODE, &lsp_gen_interval_l2_cmd); |
| 3403 | install_element (ISIS_NODE, &no_lsp_gen_interval_l2_cmd); |
| 3404 | install_element (ISIS_NODE, &no_lsp_gen_interval_l2_arg_cmd); |
| 3405 | |
| 3406 | install_element (ISIS_NODE, &spf_interval_cmd); |
| 3407 | install_element (ISIS_NODE, &no_spf_interval_cmd); |
| 3408 | install_element (ISIS_NODE, &no_spf_interval_arg_cmd); |
| 3409 | install_element (ISIS_NODE, &spf_interval_l1_cmd); |
| 3410 | install_element (ISIS_NODE, &no_spf_interval_l1_cmd); |
| 3411 | install_element (ISIS_NODE, &no_spf_interval_l1_arg_cmd); |
| 3412 | install_element (ISIS_NODE, &spf_interval_l2_cmd); |
| 3413 | install_element (ISIS_NODE, &no_spf_interval_l2_cmd); |
| 3414 | install_element (ISIS_NODE, &no_spf_interval_l2_arg_cmd); |
hasso | f390d2c | 2004-09-10 20:48:21 +0000 | [diff] [blame] | 3415 | |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3416 | install_element (ISIS_NODE, &max_lsp_lifetime_cmd); |
| 3417 | install_element (ISIS_NODE, &no_max_lsp_lifetime_cmd); |
| 3418 | install_element (ISIS_NODE, &no_max_lsp_lifetime_arg_cmd); |
| 3419 | install_element (ISIS_NODE, &max_lsp_lifetime_l1_cmd); |
| 3420 | install_element (ISIS_NODE, &no_max_lsp_lifetime_l1_cmd); |
| 3421 | install_element (ISIS_NODE, &no_max_lsp_lifetime_l1_arg_cmd); |
| 3422 | install_element (ISIS_NODE, &max_lsp_lifetime_l2_cmd); |
| 3423 | install_element (ISIS_NODE, &no_max_lsp_lifetime_l2_cmd); |
| 3424 | install_element (ISIS_NODE, &no_max_lsp_lifetime_l2_arg_cmd); |
| 3425 | |
| 3426 | install_element (ISIS_NODE, &lsp_refresh_interval_cmd); |
| 3427 | install_element (ISIS_NODE, &no_lsp_refresh_interval_cmd); |
| 3428 | install_element (ISIS_NODE, &no_lsp_refresh_interval_arg_cmd); |
| 3429 | install_element (ISIS_NODE, &lsp_refresh_interval_l1_cmd); |
| 3430 | install_element (ISIS_NODE, &no_lsp_refresh_interval_l1_cmd); |
| 3431 | install_element (ISIS_NODE, &no_lsp_refresh_interval_l1_arg_cmd); |
| 3432 | install_element (ISIS_NODE, &lsp_refresh_interval_l2_cmd); |
| 3433 | install_element (ISIS_NODE, &no_lsp_refresh_interval_l2_cmd); |
| 3434 | install_element (ISIS_NODE, &no_lsp_refresh_interval_l2_arg_cmd); |
| 3435 | |
| 3436 | install_element (ISIS_NODE, &set_overload_bit_cmd); |
| 3437 | install_element (ISIS_NODE, &no_set_overload_bit_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3438 | |
Amritha Nambiar | c8ee940 | 2015-08-24 16:40:14 -0700 | [diff] [blame] | 3439 | install_element (ISIS_NODE, &set_attached_bit_cmd); |
| 3440 | install_element (ISIS_NODE, &no_set_attached_bit_cmd); |
| 3441 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3442 | install_element (ISIS_NODE, &dynamic_hostname_cmd); |
| 3443 | install_element (ISIS_NODE, &no_dynamic_hostname_cmd); |
| 3444 | |
| 3445 | install_element (ISIS_NODE, &metric_style_cmd); |
| 3446 | install_element (ISIS_NODE, &no_metric_style_cmd); |
Josh Bailey | 3f045a0 | 2012-03-24 08:35:20 -0700 | [diff] [blame] | 3447 | |
| 3448 | install_element (ISIS_NODE, &log_adj_changes_cmd); |
| 3449 | install_element (ISIS_NODE, &no_log_adj_changes_cmd); |
| 3450 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3451 | #ifdef TOPOLOGY_GENERATE |
| 3452 | install_element (ISIS_NODE, &topology_generate_grid_cmd); |
| 3453 | install_element (ISIS_NODE, &topology_baseis_cmd); |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 3454 | install_element (ISIS_NODE, &topology_basedynh_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3455 | install_element (ISIS_NODE, &no_topology_baseis_cmd); |
hasso | f1082d1 | 2005-09-19 04:23:34 +0000 | [diff] [blame] | 3456 | install_element (ISIS_NODE, &no_topology_baseis_noid_cmd); |
hasso | f695b01 | 2005-04-02 19:03:39 +0000 | [diff] [blame] | 3457 | install_element (VIEW_NODE, &show_isis_generated_topology_cmd); |
| 3458 | install_element (ENABLE_NODE, &show_isis_generated_topology_cmd); |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3459 | #endif /* TOPOLOGY_GENERATE */ |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 3460 | } |