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