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