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