From 329f87b31006e02dffcfc518c24787aa67f5d49f Mon Sep 17 00:00:00 2001 From: Hiroki Shirokura Date: Sat, 11 Dec 2021 02:09:23 +0000 Subject: [PATCH 01/41] isisd: update struct isis_spftree with algorithm id The spftree has a new property called algorithm which is id used to identify the algorithm that separates it in the same IGP network. This is used in Flex-Algo. In other cases than Flex-Algo, the algorithm id is always zero. Signed-off-by: Hiroki Shirokura Signed-off-by: Louis Scalbert --- isisd/fabricd.c | 8 ++++---- isisd/isis_lfa.c | 12 ++++++++---- isisd/isis_spf.c | 26 +++++++++++++------------- isisd/isis_spf.h | 9 ++++----- isisd/isis_spf_private.h | 1 + tests/isisd/test_isis_spf.c | 18 +++++++++++------- 6 files changed, 41 insertions(+), 33 deletions(-) diff --git a/isisd/fabricd.c b/isisd/fabricd.c index 0be36e175..b229aa671 100644 --- a/isisd/fabricd.c +++ b/isisd/fabricd.c @@ -207,10 +207,10 @@ struct fabricd *fabricd_new(struct isis_area *area) rv->area = area; rv->initial_sync_state = FABRICD_SYNC_PENDING; - rv->spftree = - isis_spftree_new(area, &area->lspdb[IS_LEVEL_2 - 1], - area->isis->sysid, ISIS_LEVEL2, SPFTREE_IPV4, - SPF_TYPE_FORWARD, F_SPFTREE_HOPCOUNT_METRIC); + rv->spftree = isis_spftree_new( + area, &area->lspdb[IS_LEVEL_2 - 1], area->isis->sysid, + ISIS_LEVEL2, SPFTREE_IPV4, SPF_TYPE_FORWARD, + F_SPFTREE_HOPCOUNT_METRIC, SR_ALGORITHM_SPF); rv->neighbors = skiplist_new(0, neighbor_entry_list_cmp, neighbor_entry_del_void); rv->neighbors_neighbors = hash_create(neighbor_entry_hash_key, diff --git a/isisd/isis_lfa.c b/isisd/isis_lfa.c index abb616839..baec1ff87 100644 --- a/isisd/isis_lfa.c +++ b/isisd/isis_lfa.c @@ -1098,7 +1098,8 @@ struct isis_spftree *isis_spf_reverse_run(const struct isis_spftree *spftree) spftree_reverse = isis_spftree_new( spftree->area, spftree->lspdb, spftree->sysid, spftree->level, spftree->tree_id, SPF_TYPE_REVERSE, - F_SPFTREE_NO_ADJACENCIES | F_SPFTREE_NO_ROUTES); + F_SPFTREE_NO_ADJACENCIES | F_SPFTREE_NO_ROUTES, + SR_ALGORITHM_SPF); isis_run_spf(spftree_reverse); return spftree_reverse; @@ -1194,7 +1195,8 @@ struct isis_spftree *isis_tilfa_compute(struct isis_area *area, /* Create post-convergence SPF tree. */ spftree_pc = isis_spftree_new(area, spftree->lspdb, spftree->sysid, spftree->level, spftree->tree_id, - SPF_TYPE_TI_LFA, spftree->flags); + SPF_TYPE_TI_LFA, spftree->flags, + SR_ALGORITHM_SPF); spftree_pc->lfa.old.spftree = spftree; spftree_pc->lfa.old.spftree_reverse = spftree_reverse; spftree_pc->lfa.protected_resource = *resource; @@ -1242,7 +1244,8 @@ int isis_spf_run_neighbors(struct isis_spftree *spftree) adj_node->lfa.spftree = isis_spftree_new( spftree->area, spftree->lspdb, adj_node->sysid, spftree->level, spftree->tree_id, SPF_TYPE_FORWARD, - F_SPFTREE_NO_ADJACENCIES | F_SPFTREE_NO_ROUTES); + F_SPFTREE_NO_ADJACENCIES | F_SPFTREE_NO_ROUTES, + SR_ALGORITHM_SPF); isis_run_spf(adj_node->lfa.spftree); } @@ -1722,7 +1725,8 @@ struct isis_spftree *isis_rlfa_compute(struct isis_area *area, /* Create post-convergence SPF tree. */ spftree_pc = isis_spftree_new(area, spftree->lspdb, spftree->sysid, spftree->level, spftree->tree_id, - SPF_TYPE_RLFA, spftree->flags); + SPF_TYPE_RLFA, spftree->flags, + SR_ALGORITHM_SPF); spftree_pc->lfa.old.spftree = spftree; spftree_pc->lfa.old.spftree_reverse = spftree_reverse; spftree_pc->lfa.remote.max_metric = max_metric; diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index 8597049ac..407a58b76 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -322,11 +322,10 @@ static void isis_spf_adj_free(void *arg) XFREE(MTYPE_ISIS_SPF_ADJ, sadj); } -struct isis_spftree *isis_spftree_new(struct isis_area *area, - struct lspdb_head *lspdb, - const uint8_t *sysid, int level, - enum spf_tree_id tree_id, - enum spf_type type, uint8_t flags) +struct isis_spftree * +isis_spftree_new(struct isis_area *area, struct lspdb_head *lspdb, + const uint8_t *sysid, int level, enum spf_tree_id tree_id, + enum spf_type type, uint8_t flags, uint8_t algorithm) { struct isis_spftree *tree; @@ -361,6 +360,7 @@ struct isis_spftree *isis_spftree_new(struct isis_area *area, isis_spf_node_list_init(&tree->lfa.p_space); isis_spf_node_list_init(&tree->lfa.q_space); } + tree->algorithm = algorithm; return tree; } @@ -410,10 +410,10 @@ void spftree_area_init(struct isis_area *area) if (area->spftree[tree][level - 1]) continue; - area->spftree[tree][level - 1] = - isis_spftree_new(area, &area->lspdb[level - 1], - area->isis->sysid, level, tree, - SPF_TYPE_FORWARD, 0); + area->spftree[tree][level - 1] = isis_spftree_new( + area, &area->lspdb[level - 1], + area->isis->sysid, level, tree, + SPF_TYPE_FORWARD, 0, SR_ALGORITHM_SPF); } } } @@ -1701,10 +1701,10 @@ struct isis_spftree *isis_run_hopcount_spf(struct isis_area *area, struct isis_spftree *spftree) { if (!spftree) - spftree = isis_spftree_new(area, &area->lspdb[IS_LEVEL_2 - 1], - sysid, ISIS_LEVEL2, SPFTREE_IPV4, - SPF_TYPE_FORWARD, - F_SPFTREE_HOPCOUNT_METRIC); + spftree = isis_spftree_new( + area, &area->lspdb[IS_LEVEL_2 - 1], sysid, ISIS_LEVEL2, + SPFTREE_IPV4, SPF_TYPE_FORWARD, + F_SPFTREE_HOPCOUNT_METRIC, SR_ALGORITHM_SPF); init_spt(spftree, ISIS_MT_IPV4_UNICAST); if (!memcmp(sysid, area->isis->sysid, ISIS_SYS_ID_LEN)) { diff --git a/isisd/isis_spf.h b/isisd/isis_spf.h index 7f4ab707e..bf79a084b 100644 --- a/isisd/isis_spf.h +++ b/isisd/isis_spf.h @@ -37,11 +37,10 @@ struct isis_spf_adj { #define F_ISIS_SPF_ADJ_METRIC_INFINITY 0x04 }; -struct isis_spftree *isis_spftree_new(struct isis_area *area, - struct lspdb_head *lspdb, - const uint8_t *sysid, int level, - enum spf_tree_id tree_id, - enum spf_type type, uint8_t flags); +struct isis_spftree * +isis_spftree_new(struct isis_area *area, struct lspdb_head *lspdb, + const uint8_t *sysid, int level, enum spf_tree_id tree_id, + enum spf_type type, uint8_t flags, uint8_t algorithm); struct isis_vertex *isis_spf_prefix_sid_lookup(struct isis_spftree *spftree, struct isis_prefix_sid *psid); void isis_spf_invalidate_routes(struct isis_spftree *tree); diff --git a/isisd/isis_spf_private.h b/isisd/isis_spf_private.h index d82937270..5f926df70 100644 --- a/isisd/isis_spf_private.h +++ b/isisd/isis_spf_private.h @@ -349,6 +349,7 @@ struct isis_spftree { uint32_t total[SPF_PREFIX_PRIO_MAX]; } protection_counters; } lfa; + uint8_t algorithm; uint8_t flags; }; #define F_SPFTREE_HOPCOUNT_METRIC 0x01 diff --git a/tests/isisd/test_isis_spf.c b/tests/isisd/test_isis_spf.c index 85ddfea5b..8319d7e81 100644 --- a/tests/isisd/test_isis_spf.c +++ b/tests/isisd/test_isis_spf.c @@ -49,7 +49,8 @@ static void test_run_spf(struct vty *vty, const struct isis_topology *topology, /* Run SPF. */ spf_type = reverse ? SPF_TYPE_REVERSE : SPF_TYPE_FORWARD; spftree = isis_spftree_new(area, lspdb, root->sysid, level, tree, - spf_type, F_SPFTREE_NO_ADJACENCIES); + spf_type, F_SPFTREE_NO_ADJACENCIES, + SR_ALGORITHM_SPF); isis_run_spf(spftree); /* Print the SPT and the corresponding routing table. */ @@ -71,8 +72,9 @@ static void test_run_lfa(struct vty *vty, const struct isis_topology *topology, /* Run forward SPF in the root node. */ flags = F_SPFTREE_NO_ADJACENCIES; - spftree_self = isis_spftree_new(area, lspdb, root->sysid, level, tree, - SPF_TYPE_FORWARD, flags); + spftree_self = + isis_spftree_new(area, lspdb, root->sysid, level, tree, + SPF_TYPE_FORWARD, flags, SR_ALGORITHM_SPF); isis_run_spf(spftree_self); /* Run forward SPF on all adjacent routers. */ @@ -107,8 +109,9 @@ static void test_run_rlfa(struct vty *vty, const struct isis_topology *topology, /* Run forward SPF in the root node. */ flags = F_SPFTREE_NO_ADJACENCIES; - spftree_self = isis_spftree_new(area, lspdb, root->sysid, level, tree, - SPF_TYPE_FORWARD, flags); + spftree_self = + isis_spftree_new(area, lspdb, root->sysid, level, tree, + SPF_TYPE_FORWARD, flags, SR_ALGORITHM_SPF); isis_run_spf(spftree_self); /* Run reverse SPF in the root node. */ @@ -187,8 +190,9 @@ static void test_run_ti_lfa(struct vty *vty, /* Run forward SPF in the root node. */ flags = F_SPFTREE_NO_ADJACENCIES; - spftree_self = isis_spftree_new(area, lspdb, root->sysid, level, tree, - SPF_TYPE_FORWARD, flags); + spftree_self = + isis_spftree_new(area, lspdb, root->sysid, level, tree, + SPF_TYPE_FORWARD, flags, SR_ALGORITHM_SPF); isis_run_spf(spftree_self); /* Run reverse SPF in the root node. */ From 1f0d13e92225aaeddd72352d57f1dc26c54f6b53 Mon Sep 17 00:00:00 2001 From: Hiroki Shirokura Date: Sat, 11 Dec 2021 02:21:30 +0000 Subject: [PATCH 02/41] isisd: update struct sr_prefix_cfg with algorithm id The information in prefix-sid has a new property called algorithm id. This is used to identify the algorithm that separates it in the same IGP network. This is used in Flex-Algo.In all other cases, the algorithm id is basically 0. Signed-off-by: Hiroki Shirokura Signed-off-by: Louis Scalbert --- isisd/isis_lsp.c | 11 +++++++---- isisd/isis_nb_config.c | 2 +- isisd/isis_sr.c | 25 ++++++++++++++++++++----- isisd/isis_sr.h | 11 ++++++++--- 4 files changed, 36 insertions(+), 13 deletions(-) diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index fb69448d0..dc4382284 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -907,7 +907,8 @@ static void lsp_build_ext_reach_ipv4(struct isis_lsp *lsp, struct sr_prefix_cfg *pcfg = NULL; if (area->srdb.enabled) - pcfg = isis_sr_cfg_prefix_find(area, ipv4); + pcfg = isis_sr_cfg_prefix_find( + area, ipv4, SR_ALGORITHM_SPF); isis_tlvs_add_extended_ip_reach(lsp->tlvs, ipv4, metric, true, pcfg); @@ -941,7 +942,8 @@ static void lsp_build_ext_reach_ipv6(struct isis_lsp *lsp, struct sr_prefix_cfg *pcfg = NULL; if (area->srdb.enabled) - pcfg = isis_sr_cfg_prefix_find(area, p); + pcfg = isis_sr_cfg_prefix_find( + area, p, SR_ALGORITHM_SPF); isis_tlvs_add_ipv6_reach(lsp->tlvs, isis_area_ipv6_topology(area), @@ -1205,7 +1207,8 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area) if (area->srdb.enabled) pcfg = isis_sr_cfg_prefix_find( - area, ipv4); + area, ipv4, + SR_ALGORITHM_SPF); isis_tlvs_add_extended_ip_reach( lsp->tlvs, ipv4, metric, false, @@ -1228,7 +1231,7 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area) if (area->srdb.enabled) pcfg = isis_sr_cfg_prefix_find(area, - ipv6); + ipv6, 0); isis_tlvs_add_ipv6_reach( lsp->tlvs, diff --git a/isisd/isis_nb_config.c b/isisd/isis_nb_config.c index 022bfbed6..17706279b 100644 --- a/isisd/isis_nb_config.c +++ b/isisd/isis_nb_config.c @@ -2276,7 +2276,7 @@ int isis_instance_segment_routing_prefix_sid_map_prefix_sid_create( area = nb_running_get_entry(args->dnode, NULL, true); yang_dnode_get_prefix(&prefix, args->dnode, "./prefix"); - pcfg = isis_sr_cfg_prefix_add(area, &prefix); + pcfg = isis_sr_cfg_prefix_add(area, &prefix, SR_ALGORITHM_SPF); nb_running_set_entry(args->dnode, pcfg); return NB_OK; diff --git a/isisd/isis_sr.c b/isisd/isis_sr.c index e43b84ab2..b809c1c3a 100644 --- a/isisd/isis_sr.c +++ b/isisd/isis_sr.c @@ -57,7 +57,17 @@ static void sr_adj_sid_del(struct sr_adjacency *sra); static inline int sr_prefix_sid_cfg_compare(const struct sr_prefix_cfg *a, const struct sr_prefix_cfg *b) { - return prefix_cmp(&a->prefix, &b->prefix); + int ret; + + ret = prefix_cmp(&a->prefix, &b->prefix); + if (ret != 0) + return ret; + + ret = a->algorithm - b->algorithm; + if (ret != 0) + return ret; + + return 0; } DECLARE_RBTREE_UNIQ(srdb_prefix_cfg, struct sr_prefix_cfg, entry, sr_prefix_sid_cfg_compare); @@ -331,7 +341,8 @@ int isis_sr_cfg_srlb_update(struct isis_area *area, uint32_t lower_bound, * @return Newly added Prefix-SID configuration structure */ struct sr_prefix_cfg *isis_sr_cfg_prefix_add(struct isis_area *area, - const struct prefix *prefix) + const struct prefix *prefix, + uint8_t algorithm) { struct sr_prefix_cfg *pcfg; struct interface *ifp; @@ -341,6 +352,7 @@ struct sr_prefix_cfg *isis_sr_cfg_prefix_add(struct isis_area *area, pcfg = XCALLOC(MTYPE_ISIS_SR_INFO, sizeof(*pcfg)); pcfg->prefix = *prefix; pcfg->area = area; + pcfg->algorithm = algorithm; /* Pull defaults from the YANG module. */ pcfg->sid_type = yang_get_default_enum( @@ -386,11 +398,13 @@ void isis_sr_cfg_prefix_del(struct sr_prefix_cfg *pcfg) * @return Configured Prefix-SID structure if found, NULL otherwise */ struct sr_prefix_cfg *isis_sr_cfg_prefix_find(struct isis_area *area, - union prefixconstptr prefix) + union prefixconstptr prefix, + uint8_t algorithm) { struct sr_prefix_cfg pcfg = {}; prefix_copy(&pcfg.prefix, prefix.p); + pcfg.algorithm = algorithm; return srdb_prefix_cfg_find(&area->srdb.config.prefix_sids, &pcfg); } @@ -405,7 +419,7 @@ void isis_sr_prefix_cfg2subtlv(const struct sr_prefix_cfg *pcfg, bool external, struct isis_prefix_sid *psid) { /* Set SID algorithm. */ - psid->algorithm = SR_ALGORITHM_SPF; + psid->algorithm = pcfg->algorithm; /* Set SID flags. */ psid->flags = 0; @@ -939,7 +953,8 @@ static int sr_if_new_hook(struct interface *ifp) FOR_ALL_INTERFACES_ADDRESSES (ifp, connected, node) { struct sr_prefix_cfg *pcfg; - pcfg = isis_sr_cfg_prefix_find(area, connected->address); + pcfg = isis_sr_cfg_prefix_find(area, connected->address, + SR_ALGORITHM_SPF); if (!pcfg) continue; diff --git a/isisd/isis_sr.h b/isisd/isis_sr.h index 4ced5f4e8..ae15025c2 100644 --- a/isisd/isis_sr.h +++ b/isisd/isis_sr.h @@ -147,6 +147,9 @@ struct sr_prefix_cfg { /* Backpointer to IS-IS area. */ struct isis_area *area; + + /* SR Algorithm number */ + uint8_t algorithm; }; /* Per-area IS-IS Segment Routing Data Base (SRDB). */ @@ -198,11 +201,13 @@ extern int isis_sr_cfg_srgb_update(struct isis_area *area, uint32_t lower_bound, uint32_t upper_bound); extern int isis_sr_cfg_srlb_update(struct isis_area *area, uint32_t lower_bound, uint32_t upper_bound); -extern struct sr_prefix_cfg * -isis_sr_cfg_prefix_add(struct isis_area *area, const struct prefix *prefix); +extern struct sr_prefix_cfg *isis_sr_cfg_prefix_add(struct isis_area *area, + const struct prefix *prefix, + uint8_t algorithm); extern void isis_sr_cfg_prefix_del(struct sr_prefix_cfg *pcfg); extern struct sr_prefix_cfg * -isis_sr_cfg_prefix_find(struct isis_area *area, union prefixconstptr prefix); +isis_sr_cfg_prefix_find(struct isis_area *area, union prefixconstptr prefix, + uint8_t algorithm); extern void isis_sr_prefix_cfg2subtlv(const struct sr_prefix_cfg *pcfg, bool external, struct isis_prefix_sid *psid); From 7f8dddf4300911a8d125d53f87eb64598e2bbcf8 Mon Sep 17 00:00:00 2001 From: Hiroki Shirokura Date: Sat, 11 Dec 2021 03:01:07 +0000 Subject: [PATCH 03/41] isisd: update struct isis_sr_psid_info with algorithm id The information in prefix-sid has a new property called algorithm id. This is used to identify the algorithm that separates it in the same IGP network. This is used in Flex-Algo.In all other cases, the algorithm id is basically 0. Signed-off-by: Hiroki Shirokura Signed-off-by: Eric Kinzie Signed-off-by: Louis Scalbert --- isisd/isis_route.c | 3 +++ isisd/isis_spf.c | 10 +++++++--- isisd/isis_sr.h | 2 ++ isisd/isis_zebra.c | 8 ++++---- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/isisd/isis_route.c b/isisd/isis_route.c index 3b653194b..9a12df2fa 100644 --- a/isisd/isis_route.c +++ b/isisd/isis_route.c @@ -273,6 +273,9 @@ static bool isis_sr_psid_info_same(struct isis_sr_psid_info *new, || new->sid.value != old->sid.value) return false; + if (new->sid.algorithm != old->sid.algorithm) + return false; + return true; } diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index 407a58b76..4a9f0ed0c 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -585,6 +585,8 @@ isis_spf_add2tent(struct isis_spftree *spftree, enum vertextype vtype, void *id, vertex->N.ip.sr.sid = *psid; vertex->N.ip.sr.label = sr_prefix_in_label(area, psid, local); + vertex->N.ip.sr.algorithm = psid->algorithm; + if (vertex->N.ip.sr.label != MPLS_INVALID_LABEL) vertex->N.ip.sr.present = true; @@ -965,7 +967,8 @@ lspfragloop: struct isis_prefix_sid *psid = (struct isis_prefix_sid *)i; - if (psid->algorithm != SR_ALGORITHM_SPF) + if (psid->algorithm != + spftree->algorithm) continue; has_valid_psid = true; @@ -1033,7 +1036,8 @@ lspfragloop: struct isis_prefix_sid *psid = (struct isis_prefix_sid *)i; - if (psid->algorithm != SR_ALGORITHM_SPF) + if (psid->algorithm != + spftree->algorithm) continue; has_valid_psid = true; @@ -1157,7 +1161,7 @@ static int isis_spf_preload_tent_ip_reach_cb(const struct prefix *prefix, struct isis_prefix_sid *psid = (struct isis_prefix_sid *)i; - if (psid->algorithm != SR_ALGORITHM_SPF) + if (psid->algorithm != spftree->algorithm) continue; has_valid_psid = true; diff --git a/isisd/isis_sr.h b/isisd/isis_sr.h index ae15025c2..7c0222401 100644 --- a/isisd/isis_sr.h +++ b/isisd/isis_sr.h @@ -61,6 +61,8 @@ struct isis_sr_psid_info { /* Indicates whether the Prefix-SID is present or not. */ bool present; + + uint8_t algorithm; }; /* Segment Routing Local Block allocation */ diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c index 8cd8f57c4..c1f02361b 100644 --- a/isisd/isis_zebra.c +++ b/isisd/isis_zebra.c @@ -333,8 +333,8 @@ void isis_zebra_prefix_sid_install(struct isis_area *area, struct zapi_labels zl; int count = 0; - sr_debug("ISIS-Sr (%s): update label %u for prefix %pFX", - area->area_tag, psid->label, prefix); + sr_debug("ISIS-Sr (%s): update label %u for prefix %pFX algorithm %u", + area->area_tag, psid->label, prefix, psid->algorithm); /* Prepare message. */ memset(&zl, 0, sizeof(zl)); @@ -400,8 +400,8 @@ void isis_zebra_prefix_sid_uninstall(struct isis_area *area, { struct zapi_labels zl; - sr_debug("ISIS-Sr (%s): delete label %u for prefix %pFX", - area->area_tag, psid->label, prefix); + sr_debug("ISIS-Sr (%s): delete label %u for prefix %pFX algorithm %u", + area->area_tag, psid->label, prefix, psid->algorithm); /* Prepare message. */ memset(&zl, 0, sizeof(zl)); From 81a067cd9251b60a04bbc8133546e790044fa790 Mon Sep 17 00:00:00 2001 From: Hiroki Shirokura Date: Sat, 22 Jan 2022 11:07:40 +0000 Subject: [PATCH 04/41] lib,isisd: refactor igp-agnostic sr misc functions SR Algorithms are independent of specific IGPs such as IS-IS. This commit adds lib/sr to aggregate IGP agnostic functions and constants. Signed-off-by: Hiroki Shirokura Signed-off-by: Philippe Guibert Signed-off-by: Louis Scalbert --- isisd/isis_te.c | 2 +- isisd/isis_tlvs.c | 17 ++++++----------- isisd/isis_tlvs.h | 11 +---------- lib/link_state.h | 5 ++++- lib/segment_routing.c | 30 ++++++++++++++++++++++++++++++ lib/segment_routing.h | 42 ++++++++++++++++++++++++++++++++++++++++++ lib/subdir.am | 2 ++ 7 files changed, 86 insertions(+), 23 deletions(-) create mode 100644 lib/segment_routing.c create mode 100644 lib/segment_routing.h diff --git a/isisd/isis_te.c b/isisd/isis_te.c index 4e180ead6..70b0633fa 100644 --- a/isisd/isis_te.c +++ b/isisd/isis_te.c @@ -611,7 +611,7 @@ static struct ls_vertex *lsp_to_vertex(struct ls_ted *ted, struct isis_lsp *lsp) lnode.srgb.flag = cap->srgb.flags; lnode.srgb.lower_bound = cap->srgb.lower_bound; lnode.srgb.range_size = cap->srgb.range_size; - for (int i = 0; i < SR_ALGORITHM_COUNT; i++) + for (int i = 0; i < LIB_LS_SR_ALGO_COUNT; i++) lnode.algo[i] = cap->algo[i]; } diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c index 3b6db0ee1..15f927969 100644 --- a/isisd/isis_tlvs.c +++ b/isisd/isis_tlvs.c @@ -3552,9 +3552,8 @@ static void format_tlv_router_cap(const struct isis_router_cap *router_cap, for (int i = 0; i < SR_ALGORITHM_COUNT; i++) if (router_cap->algo[i] != SR_ALGORITHM_UNSET) sbuf_push(buf, indent, " %u: %s\n", i, - router_cap->algo[i] == 0 - ? "SPF" - : "Strict SPF"); + sr_algorithm_string( + router_cap->algo[i])); } /* Segment Routing Node MSD as per RFC8491 section #2 */ @@ -3573,7 +3572,7 @@ static int pack_tlv_router_cap(const struct isis_router_cap *router_cap, { size_t tlv_len = ISIS_ROUTER_CAP_SIZE; size_t len_pos; - uint8_t nb_algo; + uint16_t nb_algo; if (!router_cap) return 0; @@ -3757,13 +3756,9 @@ static int unpack_tlv_router_cap(enum isis_tlv_context context, if (length == 0) break; /* Only 2 algorithms are supported: SPF & Strict SPF */ - stream_get(&rcap->algo, s, - length > SR_ALGORITHM_COUNT - ? SR_ALGORITHM_COUNT - : length); - if (length > SR_ALGORITHM_COUNT) - stream_forward_getp( - s, length - SR_ALGORITHM_COUNT); + stream_get(&rcap->algo, s, length > 2 ? 2 : length); + if (length > 2) + stream_forward_getp(s, length - 2); break; case ISIS_SUBTLV_SRLB: /* Check that SRLB is correctly formated */ diff --git a/isisd/isis_tlvs.h b/isisd/isis_tlvs.h index 51058f1af..454288c45 100644 --- a/isisd/isis_tlvs.h +++ b/isisd/isis_tlvs.h @@ -9,6 +9,7 @@ #ifndef ISIS_TLVS_H #define ISIS_TLVS_H +#include "segment_routing.h" #include "openbsd-tree.h" #include "prefix.h" @@ -177,16 +178,6 @@ struct isis_lan_adj_sid { #define ISIS_ROUTER_CAP_FLAG_D 0x02 #define ISIS_ROUTER_CAP_SIZE 5 -/* Number of supported algorithm for Segment Routing. - * Right now only 2 have been standardized: - * - 0: SPF - * - 1: Strict SPF - */ -#define SR_ALGORITHM_COUNT 2 -#define SR_ALGORITHM_SPF 0 -#define SR_ALGORITHM_STRICT_SPF 1 -#define SR_ALGORITHM_UNSET 255 - #define MSD_TYPE_BASE_MPLS_IMPOSITION 0x01 #define MSD_TLV_SIZE 2 diff --git a/lib/link_state.h b/lib/link_state.h index b75f03543..3d2ed7a87 100644 --- a/lib/link_state.h +++ b/lib/link_state.h @@ -92,6 +92,9 @@ struct ls_node_id { */ extern int ls_node_id_same(struct ls_node_id i1, struct ls_node_id i2); +/* Supported number of algorithm by the link-state library */ +#define LIB_LS_SR_ALGO_COUNT 2 + /* Link State flags to indicate which Node parameters are valid */ #define LS_NODE_UNSET 0x0000 #define LS_NODE_NAME 0x0001 @@ -123,7 +126,7 @@ struct ls_node { uint32_t lower_bound; /* MPLS label lower bound */ uint32_t range_size; /* MPLS label range size */ } srlb; - uint8_t algo[2]; /* Segment Routing Algorithms */ + uint8_t algo[LIB_LS_SR_ALGO_COUNT]; /* Segment Routing Algorithms */ uint8_t msd; /* Maximum Stack Depth */ }; diff --git a/lib/segment_routing.c b/lib/segment_routing.c new file mode 100644 index 000000000..f45a64d29 --- /dev/null +++ b/lib/segment_routing.c @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/********************************************************************* + * Copyright 2022 Hiroki Shirokura, LINE Corporation + * Copyright 2022 Masakazu Asama + * Copyright 2022 6WIND S.A. + * + * segment_routing.c: Segment-Routing Library + * + * Authors + * ------- + * Hiroki Shirokura + * Masakazu Asama + * Louis Scalbert + */ + +#include "segment_routing.h" + +const char *sr_algorithm_string(uint8_t algo) +{ + switch (algo) { + case SR_ALGORITHM_SPF: + return "SPF"; + case SR_ALGORITHM_STRICT_SPF: + return "Strict SPF"; + case SR_ALGORITHM_UNSET: + return "Unset"; + default: + return algo >= SR_ALGORITHM_FLEX_MIN ? "Flex-Algo" : "Unknown"; + } +} diff --git a/lib/segment_routing.h b/lib/segment_routing.h new file mode 100644 index 000000000..5e71466bf --- /dev/null +++ b/lib/segment_routing.h @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/********************************************************************* + * Copyright 2022 Hiroki Shirokura, LINE Corporation + * Copyright 2022 Masakazu Asama + * Copyright 2022 6WIND S.A. + * + * segment_routing.h: Segment-Routing Library + * + * Authors + * ------- + * Hiroki Shirokura + * Masakazu Asama + * Louis Scalbert + */ + +#ifndef _FRR_SR_H +#define _FRR_SR_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * IGP Algorithm Types + * https://www.iana.org/assignments/igp-parameters/igp-parameters.xhtml + */ +#define SR_ALGORITHM_SPF 0 /* RFC8665 */ +#define SR_ALGORITHM_STRICT_SPF 1 /* RFC8665 */ +#define SR_ALGORITHM_UNSET 127 /* FRRouting defined */ +#define SR_ALGORITHM_FLEX_MIN 128 /* RFC9350 Flex-Algorithm */ +#define SR_ALGORITHM_FLEX_MAX 255 /* RFC9350 Flex-Algorithm */ +#define SR_ALGORITHM_COUNT 256 + +const char *sr_algorithm_string(uint8_t algo); + +#ifdef __cplusplus +} +#endif + +#endif /* _FRR_SR_H */ diff --git a/lib/subdir.am b/lib/subdir.am index dcc58b31a..318c09663 100644 --- a/lib/subdir.am +++ b/lib/subdir.am @@ -99,6 +99,7 @@ lib_libfrr_la_SOURCES = \ lib/sockopt.c \ lib/sockunion.c \ lib/spf_backoff.c \ + lib/segment_routing.c \ lib/srcdest_table.c \ lib/stream.c \ lib/strformat.c \ @@ -282,6 +283,7 @@ pkginclude_HEADERS += \ lib/sockopt.h \ lib/sockunion.h \ lib/spf_backoff.h \ + lib/segment_routing.h \ lib/srcdest_table.h \ lib/srte.h \ lib/stream.h \ From e7948f8ce607fca184a5c86591c29e31604454ae Mon Sep 17 00:00:00 2001 From: Hiroki Shirokura Date: Sat, 18 Dec 2021 09:03:01 +0000 Subject: [PATCH 05/41] isisd: update SR_ALGORITHM_COUNT to 256 Before this commit, SR_ALGORITHM_COUNT was set to 2, and each was hardcoded with router capability tlv. When Flex-Algo is supported, SR-Algorithm may be variably supported up to 256. Signed-off-by: Hiroki Shirokura Signed-off-by: Louis Scalbert --- isisd/isis_lsp.c | 8 ++++---- isisd/isis_sr.c | 23 +++++++++++++++-------- isisd/isis_tlvs.c | 35 +++++++++++++++++++++++++---------- isisd/isis_tlvs.h | 3 +++ 4 files changed, 47 insertions(+), 22 deletions(-) diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index dc4382284..9e5c200cc 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -1066,6 +1066,10 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area) if (area->isis->router_id != 0) { struct isis_router_cap cap = {}; + /* init SR algo list content to the default value */ + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) + cap.algo[i] = SR_ALGORITHM_UNSET; + cap.router_id.s_addr = area->isis->router_id; /* Add SR Sub-TLVs if SR is enabled. */ @@ -1091,10 +1095,6 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area) cap.srlb.lower_bound = srdb->config.srlb_lower_bound; /* And finally MSD */ cap.msd = srdb->config.msd; - } else { - /* Disable SR Algorithm */ - cap.algo[0] = SR_ALGORITHM_UNSET; - cap.algo[1] = SR_ALGORITHM_UNSET; } isis_tlvs_set_router_capability(lsp->tlvs, &cap); diff --git a/isisd/isis_sr.c b/isisd/isis_sr.c index b809c1c3a..87b6f0867 100644 --- a/isisd/isis_sr.c +++ b/isisd/isis_sr.c @@ -931,10 +931,12 @@ static int sr_adj_ip_disabled(struct isis_adjacency *adj, int family, */ static int sr_if_new_hook(struct interface *ifp) { + struct sr_prefix_cfg *pcfgs[SR_ALGORITHM_COUNT] = {NULL}; struct isis_circuit *circuit; struct isis_area *area; struct connected *connected; struct listnode *node; + bool need_lsp_regenerate = false; /* Get corresponding circuit */ circuit = circuit_scan_by_ifp(ifp); @@ -951,19 +953,24 @@ static int sr_if_new_hook(struct interface *ifp) * configuration before receiving interface information from zebra. */ FOR_ALL_INTERFACES_ADDRESSES (ifp, connected, node) { - struct sr_prefix_cfg *pcfg; - pcfg = isis_sr_cfg_prefix_find(area, connected->address, - SR_ALGORITHM_SPF); - if (!pcfg) - continue; + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) { + pcfgs[i] = isis_sr_cfg_prefix_find( + area, connected->address, i); - if (sr_prefix_is_node_sid(ifp, &pcfg->prefix)) { - pcfg->node_sid = true; - lsp_regenerate_schedule(area, area->is_type, 0); + if (!pcfgs[i]) + continue; + + if (sr_prefix_is_node_sid(ifp, &pcfgs[i]->prefix)) { + pcfgs[i]->node_sid = true; + need_lsp_regenerate = true; + } } } + if (need_lsp_regenerate) + lsp_regenerate_schedule(area, area->is_type, 0); + return 0; } diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c index 15f927969..fb4b9be7e 100644 --- a/isisd/isis_tlvs.c +++ b/isisd/isis_tlvs.c @@ -3572,7 +3572,7 @@ static int pack_tlv_router_cap(const struct isis_router_cap *router_cap, { size_t tlv_len = ISIS_ROUTER_CAP_SIZE; size_t len_pos; - uint16_t nb_algo; + uint8_t nb_algo; if (!router_cap) return 0; @@ -3606,14 +3606,13 @@ static int pack_tlv_router_cap(const struct isis_router_cap *router_cap, stream_put3(s, router_cap->srgb.lower_bound); /* Then SR Algorithm if set as per RFC8667 section #3.2 */ - for (nb_algo = 0; nb_algo < SR_ALGORITHM_COUNT; nb_algo++) - if (router_cap->algo[nb_algo] == SR_ALGORITHM_UNSET) - break; + nb_algo = isis_tlvs_sr_algo_count(router_cap); if (nb_algo > 0) { stream_putc(s, ISIS_SUBTLV_ALGORITHM); stream_putc(s, nb_algo); - for (int i = 0; i < nb_algo; i++) - stream_putc(s, router_cap->algo[i]); + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) + if (router_cap->algo[i] != SR_ALGORITHM_UNSET) + stream_putc(s, router_cap->algo[i]); } /* Local Block if defined as per RFC8667 section #3.3 */ @@ -3755,10 +3754,16 @@ static int unpack_tlv_router_cap(enum isis_tlv_context context, case ISIS_SUBTLV_ALGORITHM: if (length == 0) break; - /* Only 2 algorithms are supported: SPF & Strict SPF */ - stream_get(&rcap->algo, s, length > 2 ? 2 : length); - if (length > 2) - stream_forward_getp(s, length - 2); + + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) + rcap->algo[i] = SR_ALGORITHM_UNSET; + + for (int i = 0; i < length; i++) { + uint8_t algo; + + algo = stream_getc(s); + rcap->algo[algo] = algo; + } break; case ISIS_SUBTLV_SRLB: /* Check that SRLB is correctly formated */ @@ -5789,6 +5794,16 @@ void isis_tlvs_set_router_capability(struct isis_tlvs *tlvs, *tlvs->router_cap = *cap; } +int isis_tlvs_sr_algo_count(const struct isis_router_cap *cap) +{ + int count = 0; + + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) + if (cap->algo[i] != SR_ALGORITHM_UNSET) + count++; + return count; +} + void isis_tlvs_set_te_router_id(struct isis_tlvs *tlvs, const struct in_addr *id) { diff --git a/isisd/isis_tlvs.h b/isisd/isis_tlvs.h index 454288c45..2e26c13eb 100644 --- a/isisd/isis_tlvs.h +++ b/isisd/isis_tlvs.h @@ -560,6 +560,9 @@ void isis_tlvs_set_dynamic_hostname(struct isis_tlvs *tlvs, const char *hostname); void isis_tlvs_set_router_capability(struct isis_tlvs *tlvs, const struct isis_router_cap *cap); + +int isis_tlvs_sr_algo_count(const struct isis_router_cap *cap); + void isis_tlvs_set_te_router_id(struct isis_tlvs *tlvs, const struct in_addr *id); void isis_tlvs_set_te_router_id_ipv6(struct isis_tlvs *tlvs, From 0de7b43308e13b810202885d94ce2e8aa9734c31 Mon Sep 17 00:00:00 2001 From: Hiroki Shirokura Date: Sat, 11 Dec 2021 06:22:42 +0000 Subject: [PATCH 06/41] isisd: update isis_tlvs_add_*_reach() with multi algorithm isis_tlvs_add_extended_ip_reach adds IS-IS Extended IP reachability to the LSP. In this case, if the pcfg argument is not NULL, you can add IGP Prefix-SID as its sub tlv. Before this commit, only one Prefix-SID can be added. After this commit, the argument is not a single pointer but an array of pointers, and multiple Prefix-SIDs can be added. This feature is necessary because Flex-Algo requires multiple Prefix-SIDs for each Algorithm. Signed-off-by: Hiroki Shirokura Signed-off-by: Louis Scalbert --- isisd/isis_lsp.c | 49 +++++++++++++++++++++++++-------------- isisd/isis_tlvs.c | 43 +++++++++++++++++++++++----------- isisd/isis_tlvs.h | 5 ++-- tests/isisd/test_common.c | 4 ++-- 4 files changed, 67 insertions(+), 34 deletions(-) diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index 9e5c200cc..1dbca8ac7 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -904,14 +904,16 @@ static void lsp_build_ext_reach_ipv4(struct isis_lsp *lsp, isis_tlvs_add_oldstyle_ip_reach(lsp->tlvs, ipv4, metric); if (area->newmetric) { - struct sr_prefix_cfg *pcfg = NULL; + struct sr_prefix_cfg *pcfgs[SR_ALGORITHM_COUNT] = { + NULL}; if (area->srdb.enabled) - pcfg = isis_sr_cfg_prefix_find( - area, ipv4, SR_ALGORITHM_SPF); + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) + pcfgs[i] = isis_sr_cfg_prefix_find( + area, ipv4, i); isis_tlvs_add_extended_ip_reach(lsp->tlvs, ipv4, metric, - true, pcfg); + true, pcfgs); } } } @@ -939,15 +941,17 @@ static void lsp_build_ext_reach_ipv6(struct isis_lsp *lsp, metric = MAX_WIDE_PATH_METRIC; if (!src_p || !src_p->prefixlen) { - struct sr_prefix_cfg *pcfg = NULL; + struct sr_prefix_cfg *pcfgs[SR_ALGORITHM_COUNT] = { + NULL}; if (area->srdb.enabled) - pcfg = isis_sr_cfg_prefix_find( - area, p, SR_ALGORITHM_SPF); + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) + pcfgs[i] = isis_sr_cfg_prefix_find( + area, p, i); isis_tlvs_add_ipv6_reach(lsp->tlvs, isis_area_ipv6_topology(area), - p, metric, true, pcfg); + p, metric, true, pcfgs); } else if (isis_area_ipv6_dstsrc_enabled(area)) { isis_tlvs_add_ipv6_dstsrc_reach(lsp->tlvs, ISIS_MT_IPV6_DSTSRC, @@ -1199,20 +1203,27 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area) } if (area->newmetric) { - struct sr_prefix_cfg *pcfg = NULL; + struct sr_prefix_cfg + *pcfgs[SR_ALGORITHM_COUNT] = { + NULL}; lsp_debug( "ISIS (%s): Adding te-style IP reachability for %pFX", area->area_tag, ipv4); if (area->srdb.enabled) - pcfg = isis_sr_cfg_prefix_find( - area, ipv4, - SR_ALGORITHM_SPF); + for (int i = 0; + i < SR_ALGORITHM_COUNT; + i++) + pcfgs[i] = + isis_sr_cfg_prefix_find( + area, + ipv4, + i); isis_tlvs_add_extended_ip_reach( lsp->tlvs, ipv4, metric, false, - pcfg); + pcfgs); } } } @@ -1223,20 +1234,24 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area) for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_non_link, ipnode, ipv6)) { - struct sr_prefix_cfg *pcfg = NULL; + struct sr_prefix_cfg + *pcfgs[SR_ALGORITHM_COUNT] = {NULL}; lsp_debug( "ISIS (%s): Adding IPv6 reachability for %pFX", area->area_tag, ipv6); if (area->srdb.enabled) - pcfg = isis_sr_cfg_prefix_find(area, - ipv6, 0); + for (int i = 0; i < SR_ALGORITHM_COUNT; + i++) + pcfgs[i] = + isis_sr_cfg_prefix_find( + area, ipv6, i); isis_tlvs_add_ipv6_reach( lsp->tlvs, isis_area_ipv6_topology(area), ipv6, - metric, false, pcfg); + metric, false, pcfgs); } } diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c index fb4b9be7e..114c627c1 100644 --- a/isisd/isis_tlvs.c +++ b/isisd/isis_tlvs.c @@ -5873,40 +5873,57 @@ void isis_tlvs_del_lan_adj_sid(struct isis_ext_subtlvs *exts, void isis_tlvs_add_extended_ip_reach(struct isis_tlvs *tlvs, struct prefix_ipv4 *dest, uint32_t metric, - bool external, struct sr_prefix_cfg *pcfg) + bool external, + struct sr_prefix_cfg **pcfgs) { struct isis_extended_ip_reach *r = XCALLOC(MTYPE_ISIS_TLV, sizeof(*r)); r->metric = metric; memcpy(&r->prefix, dest, sizeof(*dest)); apply_mask_ipv4(&r->prefix); - if (pcfg) { - struct isis_prefix_sid *psid = - XCALLOC(MTYPE_ISIS_SUBTLV, sizeof(*psid)); - isis_sr_prefix_cfg2subtlv(pcfg, external, psid); + if (pcfgs) { r->subtlvs = isis_alloc_subtlvs(ISIS_CONTEXT_SUBTLV_IP_REACH); - append_item(&r->subtlvs->prefix_sids, (struct isis_item *)psid); + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) { + struct isis_prefix_sid *psid; + struct sr_prefix_cfg *pcfg = pcfgs[i]; + + if (!pcfg) + continue; + + psid = XCALLOC(MTYPE_ISIS_SUBTLV, sizeof(*psid)); + isis_sr_prefix_cfg2subtlv(pcfg, external, psid); + append_item(&r->subtlvs->prefix_sids, + (struct isis_item *)psid); + } } + append_item(&tlvs->extended_ip_reach, (struct isis_item *)r); } void isis_tlvs_add_ipv6_reach(struct isis_tlvs *tlvs, uint16_t mtid, struct prefix_ipv6 *dest, uint32_t metric, - bool external, struct sr_prefix_cfg *pcfg) + bool external, struct sr_prefix_cfg **pcfgs) { struct isis_ipv6_reach *r = XCALLOC(MTYPE_ISIS_TLV, sizeof(*r)); r->metric = metric; memcpy(&r->prefix, dest, sizeof(*dest)); apply_mask_ipv6(&r->prefix); - if (pcfg) { - struct isis_prefix_sid *psid = - XCALLOC(MTYPE_ISIS_SUBTLV, sizeof(*psid)); - - isis_sr_prefix_cfg2subtlv(pcfg, external, psid); + if (pcfgs) { r->subtlvs = isis_alloc_subtlvs(ISIS_CONTEXT_SUBTLV_IP_REACH); - append_item(&r->subtlvs->prefix_sids, (struct isis_item *)psid); + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) { + struct isis_prefix_sid *psid; + struct sr_prefix_cfg *pcfg = pcfgs[i]; + + if (!pcfg) + continue; + + psid = XCALLOC(MTYPE_ISIS_SUBTLV, sizeof(*psid)); + isis_sr_prefix_cfg2subtlv(pcfg, external, psid); + append_item(&r->subtlvs->prefix_sids, + (struct isis_item *)psid); + } } struct isis_item_list *l; diff --git a/isisd/isis_tlvs.h b/isisd/isis_tlvs.h index 2e26c13eb..cd6089c4a 100644 --- a/isisd/isis_tlvs.h +++ b/isisd/isis_tlvs.h @@ -571,10 +571,11 @@ void isis_tlvs_add_oldstyle_ip_reach(struct isis_tlvs *tlvs, struct prefix_ipv4 *dest, uint8_t metric); void isis_tlvs_add_extended_ip_reach(struct isis_tlvs *tlvs, struct prefix_ipv4 *dest, uint32_t metric, - bool external, struct sr_prefix_cfg *pcfg); + bool external, + struct sr_prefix_cfg **pcfgs); void isis_tlvs_add_ipv6_reach(struct isis_tlvs *tlvs, uint16_t mtid, struct prefix_ipv6 *dest, uint32_t metric, - bool external, struct sr_prefix_cfg *pcfg); + bool external, struct sr_prefix_cfg **pcfgs); void isis_tlvs_add_ipv6_dstsrc_reach(struct isis_tlvs *tlvs, uint16_t mtid, struct prefix_ipv6 *dest, struct prefix_ipv6 *src, diff --git a/tests/isisd/test_common.c b/tests/isisd/test_common.c index d0288f600..5c1debca8 100644 --- a/tests/isisd/test_common.c +++ b/tests/isisd/test_common.c @@ -98,7 +98,7 @@ static void lsp_add_ip_reach(struct isis_lsp *lsp, { struct prefix prefix; struct sr_prefix_cfg pcfg = {}; - struct sr_prefix_cfg *pcfg_p = NULL; + struct sr_prefix_cfg *pcfg_p[SR_ALGORITHM_COUNT] = {NULL}; if (str2prefix(prefix_str, &prefix) != 1) { zlog_debug("%s: invalid network: %s", __func__, prefix_str); @@ -106,7 +106,7 @@ static void lsp_add_ip_reach(struct isis_lsp *lsp, } if (CHECK_FLAG(tnode->flags, F_ISIS_TEST_NODE_SR)) { - pcfg_p = &pcfg; + pcfg_p[SR_ALGORITHM_SPF] = &pcfg; pcfg.sid = *next_sid_index; *next_sid_index = *next_sid_index + 1; From 484ab40511861136aa746d0936816f4380715431 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Thu, 15 Dec 2022 14:02:46 +0100 Subject: [PATCH 07/41] isisd: refactor IP reachability lsp build Refactor IP reachability lsp build to comply with checkpatch: > WARNING: Too many leading tabs - consider code refactoring No code logic change. Signed-off-by: Louis Scalbert --- isisd/isis_lsp.c | 106 +++++++++++++++++++++++------------------------ 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index 1dbca8ac7..08fa845e8 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -879,6 +879,53 @@ static uint16_t lsp_refresh_time(struct isis_lsp *lsp, uint16_t rem_lifetime) return refresh_time; } +static void lsp_build_internal_reach_ipv4(struct isis_lsp *lsp, + struct isis_area *area, + struct prefix_ipv4 *ipv4, + uint32_t metric) +{ + struct sr_prefix_cfg *pcfgs[SR_ALGORITHM_COUNT] = {NULL}; + + if (area->oldmetric) { + lsp_debug( + "ISIS (%s): Adding old-style IP reachability for %pFX", + area->area_tag, ipv4); + isis_tlvs_add_oldstyle_ip_reach(lsp->tlvs, ipv4, metric); + } + + if (area->newmetric) { + lsp_debug("ISIS (%s): Adding te-style IP reachability for %pFX", + area->area_tag, ipv4); + + if (area->srdb.enabled) + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) + pcfgs[i] = + isis_sr_cfg_prefix_find(area, ipv4, i); + + isis_tlvs_add_extended_ip_reach(lsp->tlvs, ipv4, metric, false, + pcfgs); + } +} + +static void lsp_build_internal_reach_ipv6(struct isis_lsp *lsp, + struct isis_area *area, + struct prefix_ipv6 *ipv6, + uint32_t metric) +{ + struct sr_prefix_cfg *pcfgs[SR_ALGORITHM_COUNT] = {NULL}; + + lsp_debug("ISIS (%s): Adding IPv6 reachability for %pFX", + area->area_tag, ipv6); + + if (area->srdb.enabled) + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) + pcfgs[i] = isis_sr_cfg_prefix_find(area, ipv6, i); + + isis_tlvs_add_ipv6_reach(lsp->tlvs, isis_area_ipv6_topology(area), ipv6, + metric, false, pcfgs); +} + + static void lsp_build_ext_reach_ipv4(struct isis_lsp *lsp, struct isis_area *area) { @@ -1193,39 +1240,9 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area) struct listnode *ipnode; struct prefix_ipv4 *ipv4; for (ALL_LIST_ELEMENTS_RO(circuit->ip_addrs, ipnode, - ipv4)) { - if (area->oldmetric) { - lsp_debug( - "ISIS (%s): Adding old-style IP reachability for %pFX", - area->area_tag, ipv4); - isis_tlvs_add_oldstyle_ip_reach( - lsp->tlvs, ipv4, metric); - } - - if (area->newmetric) { - struct sr_prefix_cfg - *pcfgs[SR_ALGORITHM_COUNT] = { - NULL}; - - lsp_debug( - "ISIS (%s): Adding te-style IP reachability for %pFX", - area->area_tag, ipv4); - - if (area->srdb.enabled) - for (int i = 0; - i < SR_ALGORITHM_COUNT; - i++) - pcfgs[i] = - isis_sr_cfg_prefix_find( - area, - ipv4, - i); - - isis_tlvs_add_extended_ip_reach( - lsp->tlvs, ipv4, metric, false, - pcfgs); - } - } + ipv4)) + lsp_build_internal_reach_ipv4(lsp, area, ipv4, + metric); } if (circuit->ipv6_router && circuit->ipv6_non_link->count > 0) { @@ -1233,26 +1250,9 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area) struct prefix_ipv6 *ipv6; for (ALL_LIST_ELEMENTS_RO(circuit->ipv6_non_link, - ipnode, ipv6)) { - struct sr_prefix_cfg - *pcfgs[SR_ALGORITHM_COUNT] = {NULL}; - - lsp_debug( - "ISIS (%s): Adding IPv6 reachability for %pFX", - area->area_tag, ipv6); - - if (area->srdb.enabled) - for (int i = 0; i < SR_ALGORITHM_COUNT; - i++) - pcfgs[i] = - isis_sr_cfg_prefix_find( - area, ipv6, i); - - isis_tlvs_add_ipv6_reach( - lsp->tlvs, - isis_area_ipv6_topology(area), ipv6, - metric, false, pcfgs); - } + ipnode, ipv6)) + lsp_build_internal_reach_ipv6(lsp, area, ipv6, + metric); } switch (circuit->circ_type) { From bdaafbf8344debcb24498c69d9024f9fc7cff56a Mon Sep 17 00:00:00 2001 From: Hiroki Shirokura Date: Tue, 4 Jan 2022 08:15:56 +0000 Subject: [PATCH 08/41] isisd: update struct isis_sr_psid_info with nh context Prefix-SID nexthops and backup nexthops are stored respectively in isis_route_info->nexthops and isis_route_info->backup->nexthops. With Flex-Algo, there are multiple Prefix-SIDs for a single prefix in different algorithms. Each of these Prefix-SIDs performs SPF calculation with a separate contract and sets a nexthops, so it is necessary to store a different set nexthops for each Prefix-SID. Add a nexthops and backup nethops list into the Prefix-SID isis_sr_psid_info struct and use these lists instead of the when needed After this commit, the nexthops for each Prefix-SID is not taken from route_info, but the nexthop set inside the Prefix-SID is taken. This works for backup nexthops as well. Signed-off-by: Hiroki Shirokura Signed-off-by: Louis Scalbert --- isisd/isis_route.c | 13 ++++++++++++- isisd/isis_sr.h | 3 +++ isisd/isis_zebra.c | 9 ++++----- isisd/isis_zebra.h | 1 - 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/isisd/isis_route.c b/isisd/isis_route.c index 9a12df2fa..20d30a148 100644 --- a/isisd/isis_route.c +++ b/isisd/isis_route.c @@ -239,6 +239,9 @@ isis_route_info_new(struct prefix *prefix, struct prefix_ipv6 *src_p, rinfo->cost = cost; rinfo->depth = depth; rinfo->sr = *sr; + rinfo->sr.nexthops = rinfo->nexthops; + rinfo->sr.nexthops_backup = + rinfo->backup ? rinfo->backup->nexthops : NULL; return rinfo; } @@ -489,8 +492,9 @@ static void isis_route_update(struct isis_area *area, struct prefix *prefix, route_info); /* Install/reinstall Prefix-SID label. */ if (route_info->sr.present) - isis_zebra_prefix_sid_install(area, prefix, route_info, + isis_zebra_prefix_sid_install(area, prefix, &route_info->sr); + hook_call(isis_route_update_hook, area, prefix, route_info); SET_FLAG(route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED); @@ -541,10 +545,13 @@ static void _isis_route_verify_table(struct isis_area *area, src_p); if (rnode_bck) { rinfo->backup = rnode_bck->info; + rinfo->sr.nexthops_backup = + rinfo->backup->nexthops; UNSET_FLAG(rinfo->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED); } else if (rinfo->backup) { rinfo->backup = NULL; + rinfo->sr.nexthops_backup = NULL; UNSET_FLAG(rinfo->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED); } @@ -658,10 +665,13 @@ void isis_route_verify_merge(struct isis_area *area, tables_backup[level - 1], prefix, src_p); if (rnode_bck) { rinfo->backup = rnode_bck->info; + rinfo->sr.nexthops_backup = + rinfo->backup->nexthops; UNSET_FLAG(rinfo->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED); } else if (rinfo->backup) { rinfo->backup = NULL; + rinfo->sr.nexthops_backup = NULL; UNSET_FLAG(rinfo->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED); } @@ -720,6 +730,7 @@ void isis_route_invalidate_table(struct isis_area *area, if (rinfo->backup) { rinfo->backup = NULL; + rinfo->sr.nexthops_backup = NULL; /* * For now, always force routes that have backup * nexthops to be reinstalled. diff --git a/isisd/isis_sr.h b/isisd/isis_sr.h index 7c0222401..f5f0adf24 100644 --- a/isisd/isis_sr.h +++ b/isisd/isis_sr.h @@ -63,6 +63,9 @@ struct isis_sr_psid_info { bool present; uint8_t algorithm; + + struct list *nexthops; + struct list *nexthops_backup; }; /* Segment Routing Local Block allocation */ diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c index c1f02361b..59b80c1e2 100644 --- a/isisd/isis_zebra.c +++ b/isisd/isis_zebra.c @@ -327,7 +327,6 @@ void isis_zebra_route_del_route(struct isis *isis, */ void isis_zebra_prefix_sid_install(struct isis_area *area, struct prefix *prefix, - struct isis_route_info *rinfo, struct isis_sr_psid_info *psid) { struct zapi_labels zl; @@ -342,7 +341,7 @@ void isis_zebra_prefix_sid_install(struct isis_area *area, zl.local_label = psid->label; /* Local routes don't have any nexthop and require special handling. */ - if (list_isempty(rinfo->nexthops)) { + if (list_isempty(psid->nexthops)) { struct zapi_nexthop *znh; struct interface *ifp; @@ -361,9 +360,9 @@ void isis_zebra_prefix_sid_install(struct isis_area *area, znh->labels[0] = MPLS_LABEL_IMPLICIT_NULL; } else { /* Add backup nexthops first. */ - if (rinfo->backup) { + if (psid->nexthops_backup) { count = isis_zebra_add_nexthops( - area->isis, rinfo->backup->nexthops, + area->isis, psid->nexthops_backup, zl.backup_nexthops, ISIS_NEXTHOP_BACKUP, true, 0); if (count > 0) { @@ -373,7 +372,7 @@ void isis_zebra_prefix_sid_install(struct isis_area *area, } /* Add primary nexthops. */ - count = isis_zebra_add_nexthops(area->isis, rinfo->nexthops, + count = isis_zebra_add_nexthops(area->isis, psid->nexthops, zl.nexthops, ISIS_NEXTHOP_MAIN, true, count); if (!count) diff --git a/isisd/isis_zebra.h b/isisd/isis_zebra.h index 359e39b59..045c75874 100644 --- a/isisd/isis_zebra.h +++ b/isisd/isis_zebra.h @@ -36,7 +36,6 @@ void isis_zebra_route_del_route(struct isis *isis, struct isis_route_info *route_info); void isis_zebra_prefix_sid_install(struct isis_area *area, struct prefix *prefix, - struct isis_route_info *rinfo, struct isis_sr_psid_info *psid); void isis_zebra_prefix_sid_uninstall(struct isis_area *area, struct prefix *prefix, From 7153c3cabf5c5051713487d68d4a749a96478f9d Mon Sep 17 00:00:00 2001 From: Hiroki Shirokura Date: Sun, 12 Dec 2021 09:20:21 +0000 Subject: [PATCH 09/41] isisd: update struct isis_route_info has multiple sr info by algorithm Before this commit, there was only one sr psid info included in route_info. In fact, in RFC8667, Algorithm ID, which is a property of Prefix-SID, has 8 bits of information. That is, each Prefix can hold up to 256 Prefix-SIDs. This commit implements it. The previously implemented single Prefix-SID will be continued as Algorithm 0. Signed-off-by: Hiroki Shirokura Signed-off-by: Louis Scalbert --- isisd/isis_route.c | 202 +++++++++++++++++++++++++++++++++++++++------ isisd/isis_route.h | 13 ++- isisd/isis_spf.c | 29 +++++-- 3 files changed, 208 insertions(+), 36 deletions(-) diff --git a/isisd/isis_route.c b/isisd/isis_route.c index 20d30a148..3191dfa4f 100644 --- a/isisd/isis_route.c +++ b/isisd/isis_route.c @@ -39,6 +39,8 @@ DEFINE_MTYPE_STATIC(ISISD, ISIS_NEXTHOP, "ISIS nexthop"); DEFINE_MTYPE_STATIC(ISISD, ISIS_ROUTE_INFO, "ISIS route info"); +DEFINE_MTYPE_STATIC(ISISD, ISIS_ROUTE_TABLE_INFO, "ISIS route table info"); + DEFINE_HOOK(isis_route_update_hook, (struct isis_area * area, struct prefix *prefix, @@ -51,8 +53,25 @@ static void isis_route_update(struct isis_area *area, struct prefix *prefix, struct prefix_ipv6 *src_p, struct isis_route_info *route_info); -static struct isis_nexthop *isis_nexthop_create(int family, union g_addr *ip, - ifindex_t ifindex) +static struct mpls_label_stack * +label_stack_dup(const struct mpls_label_stack *const orig) +{ + struct mpls_label_stack *copy; + int array_size; + + if (orig == NULL) + return NULL; + + array_size = orig->num_labels * sizeof(mpls_label_t); + copy = XCALLOC(MTYPE_ISIS_NEXTHOP_LABELS, + sizeof(struct mpls_label_stack) + array_size); + copy->num_labels = orig->num_labels; + memcpy(copy->label, orig->label, array_size); + return copy; +} + +static struct isis_nexthop * +isis_nexthop_create(int family, const union g_addr *const ip, ifindex_t ifindex) { struct isis_nexthop *nexthop; @@ -65,12 +84,40 @@ static struct isis_nexthop *isis_nexthop_create(int family, union g_addr *ip, return nexthop; } +static struct isis_nexthop * +isis_nexthop_dup(const struct isis_nexthop *const orig) +{ + struct isis_nexthop *nexthop; + + nexthop = isis_nexthop_create(orig->family, &orig->ip, orig->ifindex); + memcpy(nexthop->sysid, orig->sysid, ISIS_SYS_ID_LEN); + nexthop->sr = orig->sr; + nexthop->label_stack = label_stack_dup(orig->label_stack); + + return nexthop; +} + void isis_nexthop_delete(struct isis_nexthop *nexthop) { XFREE(MTYPE_ISIS_NEXTHOP_LABELS, nexthop->label_stack); XFREE(MTYPE_ISIS_NEXTHOP, nexthop); } +static struct list *isis_nexthop_list_dup(const struct list *orig) +{ + struct list *copy; + struct listnode *node; + struct isis_nexthop *nh; + struct isis_nexthop *nhcopy; + + copy = list_new(); + for (ALL_LIST_ELEMENTS_RO(orig, node, nh)) { + nhcopy = isis_nexthop_dup(nh); + listnode_add(copy, nhcopy); + } + return copy; +} + static struct isis_nexthop *nexthoplookup(struct list *nexthops, int family, union g_addr *ip, ifindex_t ifindex) { @@ -238,9 +285,9 @@ isis_route_info_new(struct prefix *prefix, struct prefix_ipv6 *src_p, rinfo->cost = cost; rinfo->depth = depth; - rinfo->sr = *sr; - rinfo->sr.nexthops = rinfo->nexthops; - rinfo->sr.nexthops_backup = + rinfo->sr_algo[sr->algorithm] = *sr; + rinfo->sr_algo[sr->algorithm].nexthops = rinfo->nexthops; + rinfo->sr_algo[sr->algorithm].nexthops_backup = rinfo->backup ? rinfo->backup->nexthops : NULL; return rinfo; @@ -248,6 +295,18 @@ isis_route_info_new(struct prefix *prefix, struct prefix_ipv6 *src_p, static void isis_route_info_delete(struct isis_route_info *route_info) { + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) { + if (!route_info->sr_algo[i].present) + continue; + + if (route_info->sr_algo[i].nexthops == route_info->nexthops) + continue; + + route_info->sr_algo[i].nexthops->del = + (void (*)(void *))isis_nexthop_delete; + list_delete(&route_info->sr_algo[i].nexthops); + } + if (route_info->nexthops) { route_info->nexthops->del = (void (*)(void *))isis_nexthop_delete; @@ -263,6 +322,27 @@ void isis_route_node_cleanup(struct route_table *table, struct route_node *node) isis_route_info_delete(node->info); } +struct isis_route_table_info *isis_route_table_info_alloc(uint8_t algorithm) +{ + struct isis_route_table_info *info; + + info = XCALLOC(MTYPE_ISIS_ROUTE_TABLE_INFO, sizeof(*info)); + info->algorithm = algorithm; + return info; +} + +void isis_route_table_info_free(void *info) +{ + XFREE(MTYPE_ISIS_ROUTE_TABLE_INFO, info); +} + +uint8_t isis_route_table_algorithm(const struct route_table *table) +{ + const struct isis_route_table_info *info = table->info; + + return info ? info->algorithm : 0; +} + static bool isis_sr_psid_info_same(struct isis_sr_psid_info *new, struct isis_sr_psid_info *old) { @@ -319,10 +399,22 @@ static int isis_route_info_same(struct isis_route_info *new, return 0; } - if (!isis_sr_psid_info_same(&new->sr, &old->sr)) { - if (buf) - snprintf(buf, buf_size, "SR input label"); - return 0; + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) { + struct isis_sr_psid_info new_sr_algo; + struct isis_sr_psid_info old_sr_algo; + + new_sr_algo = new->sr_algo[i]; + old_sr_algo = old->sr_algo[i]; + + if (!isis_sr_psid_info_same(&new_sr_algo, &old_sr_algo)) { + if (buf) + snprintf( + buf, buf_size, + "SR input label algo-%u (old: %s, new: %s)", + i, old_sr_algo.present ? "yes" : "no", + new_sr_algo.present ? "yes" : "no"); + return 0; + } } if (new->nexthops->count != old->nexthops->count) { @@ -411,7 +503,9 @@ isis_route_create(struct prefix *prefix, struct prefix_ipv6 *src_p, zlog_debug( "ISIS-Rte (%s): route changed: %pFX, change: %s", area->area_tag, prefix, change_buf); - rinfo_new->sr_previous = rinfo_old->sr; + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) + rinfo_new->sr_algo_previous[i] = + rinfo_old->sr_algo[i]; isis_route_info_delete(rinfo_old); route_info = rinfo_new; UNSET_FLAG(route_info->flag, @@ -467,11 +561,42 @@ static void isis_route_remove_previous_sid(struct isis_area *area, * Explicitly uninstall previous Prefix-SID label if it has * changed or was removed. */ - if (route_info->sr_previous.present && - (!route_info->sr.present || - route_info->sr_previous.label != route_info->sr.label)) - isis_zebra_prefix_sid_uninstall(area, prefix, route_info, - &route_info->sr_previous); + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) { + if (route_info->sr_algo_previous[i].present && + (!route_info->sr_algo[i].present || + route_info->sr_algo_previous[i].label != + route_info->sr_algo[i].label)) + isis_zebra_prefix_sid_uninstall( + area, prefix, route_info, + &route_info->sr_algo_previous[i]); + } +} + +static void set_merge_route_info_sr_algo(struct isis_route_info *mrinfo, + struct isis_route_info *rinfo) +{ + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) { + if (rinfo->sr_algo[i].present) { + assert(i == rinfo->sr_algo[i].algorithm); + assert(rinfo->nexthops); + assert(rinfo->backup ? rinfo->backup->nexthops != NULL + : true); + + if (mrinfo->sr_algo[i].nexthops != NULL && + mrinfo->sr_algo[i].nexthops != mrinfo->nexthops) { + mrinfo->sr_algo[i].nexthops->del = + (void (*)(void *))isis_nexthop_delete; + list_delete(&mrinfo->sr_algo[i].nexthops); + } + + mrinfo->sr_algo[i] = rinfo->sr_algo[i]; + mrinfo->sr_algo[i].nexthops = isis_nexthop_list_dup( + rinfo->sr_algo[i].nexthops); + } + } + + UNSET_FLAG(rinfo->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED); + UNSET_FLAG(mrinfo->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED); } static void isis_route_update(struct isis_area *area, struct prefix *prefix, @@ -490,10 +615,22 @@ static void isis_route_update(struct isis_area *area, struct prefix *prefix, /* Install route. */ isis_zebra_route_add_route(area->isis, prefix, src_p, route_info); - /* Install/reinstall Prefix-SID label. */ - if (route_info->sr.present) - isis_zebra_prefix_sid_install(area, prefix, - &route_info->sr); + + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) { + struct isis_sr_psid_info sr_algo; + + sr_algo = route_info->sr_algo[i]; + + /* + * Install/reinstall Prefix-SID label. + */ + if (sr_algo.present) + isis_zebra_prefix_sid_install(area, prefix, + &sr_algo); + + hook_call(isis_route_update_hook, area, prefix, + route_info); + } hook_call(isis_route_update_hook, area, prefix, route_info); @@ -501,9 +638,12 @@ static void isis_route_update(struct isis_area *area, struct prefix *prefix, UNSET_FLAG(route_info->flag, ISIS_ROUTE_FLAG_ZEBRA_RESYNC); } else { /* Uninstall Prefix-SID label. */ - if (route_info->sr.present) - isis_zebra_prefix_sid_uninstall( - area, prefix, route_info, &route_info->sr); + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) + if (route_info->sr_algo[i].present) + isis_zebra_prefix_sid_uninstall( + area, prefix, route_info, + &route_info->sr_algo[i]); + /* Uninstall route. */ isis_zebra_route_del_route(area->isis, prefix, src_p, route_info); @@ -523,6 +663,7 @@ static void _isis_route_verify_table(struct isis_area *area, #ifdef EXTREME_DEBUG char buff[SRCDEST2STR_BUFFER]; #endif /* EXTREME_DEBUG */ + uint8_t algorithm = isis_route_table_algorithm(table); for (rnode = route_top(table); rnode; rnode = srcdest_route_next(rnode)) { @@ -545,13 +686,14 @@ static void _isis_route_verify_table(struct isis_area *area, src_p); if (rnode_bck) { rinfo->backup = rnode_bck->info; - rinfo->sr.nexthops_backup = + rinfo->sr_algo[algorithm].nexthops_backup = rinfo->backup->nexthops; UNSET_FLAG(rinfo->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED); } else if (rinfo->backup) { rinfo->backup = NULL; - rinfo->sr.nexthops_backup = NULL; + rinfo->sr_algo[algorithm].nexthops_backup = + NULL; UNSET_FLAG(rinfo->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED); } @@ -645,6 +787,8 @@ void isis_route_verify_merge(struct isis_area *area, merge = srcdest_table_init(); for (int level = ISIS_LEVEL1; level <= ISIS_LEVEL2; level++) { + uint8_t algorithm = + isis_route_table_algorithm(tables[level - 1]); for (rnode = route_top(tables[level - 1]); rnode; rnode = srcdest_route_next(rnode)) { struct isis_route_info *rinfo = rnode->info; @@ -665,13 +809,14 @@ void isis_route_verify_merge(struct isis_area *area, tables_backup[level - 1], prefix, src_p); if (rnode_bck) { rinfo->backup = rnode_bck->info; - rinfo->sr.nexthops_backup = + rinfo->sr_algo[algorithm].nexthops_backup = rinfo->backup->nexthops; UNSET_FLAG(rinfo->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED); } else if (rinfo->backup) { rinfo->backup = NULL; - rinfo->sr.nexthops_backup = NULL; + rinfo->sr_algo[algorithm].nexthops_backup = + NULL; UNSET_FLAG(rinfo->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNCED); } @@ -680,6 +825,8 @@ void isis_route_verify_merge(struct isis_area *area, struct isis_route_info *mrinfo = mrnode->info; if (mrinfo) { route_unlock_node(mrnode); + set_merge_route_info_sr_algo(mrinfo, rinfo); + if (CHECK_FLAG(mrinfo->flag, ISIS_ROUTE_FLAG_ACTIVE)) { /* Clear the ZEBRA_SYNCED flag on the @@ -723,6 +870,7 @@ void isis_route_invalidate_table(struct isis_area *area, { struct route_node *rode; struct isis_route_info *rinfo; + uint8_t algorithm = isis_route_table_algorithm(table); for (rode = route_top(table); rode; rode = srcdest_route_next(rode)) { if (rode->info == NULL) continue; @@ -730,7 +878,7 @@ void isis_route_invalidate_table(struct isis_area *area, if (rinfo->backup) { rinfo->backup = NULL; - rinfo->sr.nexthops_backup = NULL; + rinfo->sr_algo[algorithm].nexthops_backup = NULL; /* * For now, always force routes that have backup * nexthops to be reinstalled. diff --git a/isisd/isis_route.h b/isisd/isis_route.h index 40e746289..79b604b77 100644 --- a/isisd/isis_route.h +++ b/isisd/isis_route.h @@ -30,12 +30,16 @@ struct isis_route_info { uint8_t flag; uint32_t cost; uint32_t depth; - struct isis_sr_psid_info sr; - struct isis_sr_psid_info sr_previous; + struct isis_sr_psid_info sr_algo[SR_ALGORITHM_COUNT]; + struct isis_sr_psid_info sr_algo_previous[SR_ALGORITHM_COUNT]; struct list *nexthops; struct isis_route_info *backup; }; +struct isis_route_table_info { + uint8_t algorithm; +}; + DECLARE_HOOK(isis_route_update_hook, (struct isis_area * area, struct prefix *prefix, struct isis_route_info *route_info), @@ -73,9 +77,14 @@ void isis_route_invalidate_table(struct isis_area *area, void isis_route_node_cleanup(struct route_table *table, struct route_node *node); + void isis_route_switchover_nexthop(struct isis_area *area, struct route_table *table, int family, union g_addr *nexthop_addr, ifindex_t ifindex); +struct isis_route_table_info *isis_route_table_info_alloc(uint8_t algorithm); +void isis_route_table_info_free(void *info); +uint8_t isis_route_table_algorithm(const struct route_table *table); + #endif /* _ZEBRA_ISIS_ROUTE_H */ diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index 4a9f0ed0c..6bfb83c21 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -335,7 +335,9 @@ isis_spftree_new(struct isis_area *area, struct lspdb_head *lspdb, isis_vertex_queue_init(&tree->paths, "IS-IS SPF paths", false); tree->route_table = srcdest_table_init(); tree->route_table->cleanup = isis_route_node_cleanup; + tree->route_table->info = isis_route_table_info_alloc(algorithm); tree->route_table_backup = srcdest_table_init(); + tree->route_table_backup->info = isis_route_table_info_alloc(algorithm); tree->route_table_backup->cleanup = isis_route_node_cleanup; tree->area = area; tree->lspdb = lspdb; @@ -380,6 +382,8 @@ void isis_spftree_del(struct isis_spftree *spftree) list_delete(&spftree->sadj_list); isis_vertex_queue_free(&spftree->tents); isis_vertex_queue_free(&spftree->paths); + isis_route_table_info_free(spftree->route_table->info); + isis_route_table_info_free(spftree->route_table_backup->info); route_table_finish(spftree->route_table); route_table_finish(spftree->route_table_backup); spftree->route_table = NULL; @@ -1838,11 +1842,18 @@ void isis_spf_verify_routes(struct isis_area *area, struct isis_spftree **trees) void isis_spf_invalidate_routes(struct isis_spftree *tree) { + struct isis_route_table_info *backup_info; + isis_route_invalidate_table(tree->area, tree->route_table); /* Delete backup routes. */ + + backup_info = tree->route_table_backup->info; route_table_finish(tree->route_table_backup); + isis_route_table_info_free(backup_info); tree->route_table_backup = srcdest_table_init(); + tree->route_table_backup->info = + isis_route_table_info_alloc(tree->algorithm); tree->route_table_backup->cleanup = isis_route_node_cleanup; } @@ -2242,8 +2253,10 @@ static void isis_print_route(struct ttable *tt, const struct prefix *prefix, if (nexthop->sr.present) { snprintf(buf_sid, sizeof(buf_sid), "%u", nexthop->sr.sid.value); - sr_op2str(buf_lblop, sizeof(buf_lblop), - rinfo->sr.label, nexthop->sr.label); + sr_op2str( + buf_lblop, sizeof(buf_lblop), + rinfo->sr_algo[SR_ALGORITHM_SPF].label, + nexthop->sr.label); } else { strlcpy(buf_sid, "-", sizeof(buf_sid)); strlcpy(buf_lblop, "-", sizeof(buf_lblop)); @@ -2298,12 +2311,14 @@ static void isis_print_route(struct ttable *tt, const struct prefix *prefix, char buf_sid[BUFSIZ] = {}; char buf_lblop[BUFSIZ] = {}; - if (rinfo->sr.present) { + if (rinfo->sr_algo[SR_ALGORITHM_SPF].present) { snprintf(buf_sid, sizeof(buf_sid), "%u", - rinfo->sr.sid.value); - sr_op2str(buf_lblop, sizeof(buf_lblop), - rinfo->sr.label, - MPLS_LABEL_IMPLICIT_NULL); + rinfo->sr_algo[SR_ALGORITHM_SPF] + .sid.value); + sr_op2str( + buf_lblop, sizeof(buf_lblop), + rinfo->sr_algo[SR_ALGORITHM_SPF].label, + MPLS_LABEL_IMPLICIT_NULL); } else { strlcpy(buf_sid, "-", sizeof(buf_sid)); strlcpy(buf_lblop, "-", sizeof(buf_lblop)); From 9b19f67e38527a8a3373a1b972eaea5795335b6e Mon Sep 17 00:00:00 2001 From: Hiroki Shirokura Date: Mon, 3 Jan 2022 22:53:52 +0000 Subject: [PATCH 10/41] isisd: refactor enum tail comma Many of the enum definitions defined in isis_tlvs.h are often extended at the end. The c/c++ allows commas at the end of a list. This commit simplifies the patching of later extensions. Signed-off-by: Hiroki Shirokura Signed-off-by: Louis Scalbert --- isisd/isis_tlvs.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/isisd/isis_tlvs.h b/isisd/isis_tlvs.h index cd6089c4a..516d4b879 100644 --- a/isisd/isis_tlvs.h +++ b/isisd/isis_tlvs.h @@ -103,7 +103,7 @@ struct isis_spine_leaf { enum isis_threeway_state { ISIS_THREEWAY_DOWN = 2, ISIS_THREEWAY_INITIALIZING = 1, - ISIS_THREEWAY_UP = 0 + ISIS_THREEWAY_UP = 0, }; struct isis_threeway_adj { @@ -300,7 +300,7 @@ enum isis_tlv_context { ISIS_CONTEXT_SUBTLV_NE_REACH, ISIS_CONTEXT_SUBTLV_IP_REACH, ISIS_CONTEXT_SUBTLV_IPV6_REACH, - ISIS_CONTEXT_MAX + ISIS_CONTEXT_MAX, }; struct isis_subtlvs { @@ -385,7 +385,7 @@ enum isis_tlv_type { ISIS_SUBTLV_AVA_BW = 38, ISIS_SUBTLV_USE_BW = 39, - ISIS_SUBTLV_MAX = 40 + ISIS_SUBTLV_MAX = 40, }; /* subTLVs size for TE and SR */ @@ -419,7 +419,7 @@ enum ext_subtlv_size { /* RFC 7308 */ ISIS_SUBTLV_EXT_ADMIN_GRP = 14, - ISIS_SUBTLV_MAX_SIZE = 180 + ISIS_SUBTLV_MAX_SIZE = 180, }; /* Macros to manage the optional presence of EXT subTLVs */ From d4f58e0b8497626d2f5ce5ec4a140d19a92bd283 Mon Sep 17 00:00:00 2001 From: Hiroki Shirokura Date: Tue, 4 Jan 2022 01:13:50 +0000 Subject: [PATCH 11/41] isisd: add TLV_SIZE_MISMATCH for tlvs length mismatch Basically in frrouting source code principle, the log string should not be a complicated abstraction or streamlined for grep. But for log format for the "TLV size does not match ..." can be unified, which makes development easier. > $ grep "TLV size does not match expected size for" isisd/isis_tlvs.c > "TLV size does not match expected size for Administrative Group!\n"); > "TLV size does not match expected size for Local IPv6 address!\n"); > ...(snip)... > "TLV size does not match expected size for Adjacency SID!\n"); > "TLV size does not match expected size for Adjacency SID!\n"); > "TLV size does not match expected size for Adjacency SID!\n"); > "TLV size does not match expected size for LAN-Adjacency SID!\n"); > "TLV size does not match expected size for LAN-Adjacency SID!\n"); > "TLV size does not match expected size for LAN-Adjacency SID!\n"); > > $ grep "TLV size does not match expected size for" isisd/isis_tlvs.c | wc -l > 25 Signed-off-by: Hiroki Shirokura Signed-off-by: Louis Scalbert --- isisd/isis_tlvs.c | 110 +++++++++++++++++++++++----------------------- 1 file changed, 56 insertions(+), 54 deletions(-) diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c index 114c627c1..8eaa095b3 100644 --- a/isisd/isis_tlvs.c +++ b/isisd/isis_tlvs.c @@ -30,6 +30,10 @@ #include "isisd/isis_te.h" #include "isisd/isis_sr.h" +#define TLV_SIZE_MISMATCH(log, indent, target) \ + sbuf_push(log, indent, \ + "TLV size does not match expected size for " target "!\n") + DEFINE_MTYPE_STATIC(ISISD, ISIS_TLV, "ISIS TLVs"); DEFINE_MTYPE(ISISD, ISIS_SUBTLV, "ISIS Sub-TLVs"); DEFINE_MTYPE_STATIC(ISISD, ISIS_MT_ITEM_LIST, "ISIS MT Item Lists"); @@ -896,8 +900,8 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, /* Standard Metric as defined in RFC5305 */ case ISIS_SUBTLV_ADMIN_GRP: if (subtlv_len != ISIS_SUBTLV_DEF_SIZE) { - sbuf_push(log, indent, - "TLV size does not match expected size for Administrative Group!\n"); + TLV_SIZE_MISMATCH(log, indent, + "Administrative Group"); stream_forward_getp(s, subtlv_len); } else { exts->adm_group = stream_getl(s); @@ -915,8 +919,7 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, break; case ISIS_SUBTLV_LLRI: if (subtlv_len != ISIS_SUBTLV_LLRI_SIZE) { - sbuf_push(log, indent, - "TLV size does not match expected size for Link ID!\n"); + TLV_SIZE_MISMATCH(log, indent, "Link ID"); stream_forward_getp(s, subtlv_len); } else { exts->local_llri = stream_getl(s); @@ -926,8 +929,8 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, break; case ISIS_SUBTLV_LOCAL_IPADDR: if (subtlv_len != ISIS_SUBTLV_DEF_SIZE) { - sbuf_push(log, indent, - "TLV size does not match expected size for Local IP address!\n"); + TLV_SIZE_MISMATCH(log, indent, + "Local IP address"); stream_forward_getp(s, subtlv_len); } else { stream_get(&exts->local_addr.s_addr, s, 4); @@ -936,8 +939,8 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, break; case ISIS_SUBTLV_RMT_IPADDR: if (subtlv_len != ISIS_SUBTLV_DEF_SIZE) { - sbuf_push(log, indent, - "TLV size does not match expected size for Remote IP address!\n"); + TLV_SIZE_MISMATCH(log, indent, + "Remote IP address"); stream_forward_getp(s, subtlv_len); } else { stream_get(&exts->neigh_addr.s_addr, s, 4); @@ -946,8 +949,8 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, break; case ISIS_SUBTLV_LOCAL_IPADDR6: if (subtlv_len != ISIS_SUBTLV_IPV6_ADDR_SIZE) { - sbuf_push(log, indent, - "TLV size does not match expected size for Local IPv6 address!\n"); + TLV_SIZE_MISMATCH(log, indent, + "Local IPv6 address"); stream_forward_getp(s, subtlv_len); } else { stream_get(&exts->local_addr6, s, 16); @@ -956,8 +959,8 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, break; case ISIS_SUBTLV_RMT_IPADDR6: if (subtlv_len != ISIS_SUBTLV_IPV6_ADDR_SIZE) { - sbuf_push(log, indent, - "TLV size does not match expected size for Remote IPv6 address!\n"); + TLV_SIZE_MISMATCH(log, indent, + "Remote IPv6 address"); stream_forward_getp(s, subtlv_len); } else { stream_get(&exts->neigh_addr6, s, 16); @@ -966,8 +969,8 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, break; case ISIS_SUBTLV_MAX_BW: if (subtlv_len != ISIS_SUBTLV_DEF_SIZE) { - sbuf_push(log, indent, - "TLV size does not match expected size for Maximum Bandwidth!\n"); + TLV_SIZE_MISMATCH(log, indent, + "Maximum Bandwidth"); stream_forward_getp(s, subtlv_len); } else { exts->max_bw = stream_getf(s); @@ -976,8 +979,9 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, break; case ISIS_SUBTLV_MAX_RSV_BW: if (subtlv_len != ISIS_SUBTLV_DEF_SIZE) { - sbuf_push(log, indent, - "TLV size does not match expected size for Maximum Reservable Bandwidth!\n"); + TLV_SIZE_MISMATCH( + log, indent, + "Maximum Reservable Bandwidth"); stream_forward_getp(s, subtlv_len); } else { exts->max_rsv_bw = stream_getf(s); @@ -986,8 +990,8 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, break; case ISIS_SUBTLV_UNRSV_BW: if (subtlv_len != ISIS_SUBTLV_UNRSV_BW_SIZE) { - sbuf_push(log, indent, - "TLV size does not match expected size for Unreserved Bandwidth!\n"); + TLV_SIZE_MISMATCH(log, indent, + "Unreserved Bandwidth"); stream_forward_getp(s, subtlv_len); } else { for (int i = 0; i < MAX_CLASS_TYPE; i++) @@ -997,8 +1001,8 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, break; case ISIS_SUBTLV_TE_METRIC: if (subtlv_len != ISIS_SUBTLV_TE_METRIC_SIZE) { - sbuf_push(log, indent, - "TLV size does not match expected size for Traffic Engineering Metric!\n"); + TLV_SIZE_MISMATCH(log, indent, + "Traffic Engineering Metric"); stream_forward_getp(s, subtlv_len); } else { exts->te_metric = stream_get3(s); @@ -1007,8 +1011,8 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, break; case ISIS_SUBTLV_RAS: if (subtlv_len != ISIS_SUBTLV_DEF_SIZE) { - sbuf_push(log, indent, - "TLV size does not match expected size for Remote AS number!\n"); + TLV_SIZE_MISMATCH(log, indent, + "Remote AS number"); stream_forward_getp(s, subtlv_len); } else { exts->remote_as = stream_getl(s); @@ -1017,8 +1021,8 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, break; case ISIS_SUBTLV_RIP: if (subtlv_len != ISIS_SUBTLV_DEF_SIZE) { - sbuf_push(log, indent, - "TLV size does not match expected size for Remote ASBR IP Address!\n"); + TLV_SIZE_MISMATCH(log, indent, + "Remote ASBR IP Address"); stream_forward_getp(s, subtlv_len); } else { stream_get(&exts->remote_ip.s_addr, s, 4); @@ -1028,8 +1032,8 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, /* Extended Metrics as defined in RFC 7810 */ case ISIS_SUBTLV_AV_DELAY: if (subtlv_len != ISIS_SUBTLV_DEF_SIZE) { - sbuf_push(log, indent, - "TLV size does not match expected size for Average Link Delay!\n"); + TLV_SIZE_MISMATCH(log, indent, + "Average Link Delay"); stream_forward_getp(s, subtlv_len); } else { exts->delay = stream_getl(s); @@ -1038,8 +1042,8 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, break; case ISIS_SUBTLV_MM_DELAY: if (subtlv_len != ISIS_SUBTLV_MM_DELAY_SIZE) { - sbuf_push(log, indent, - "TLV size does not match expected size for Min/Max Link Delay!\n"); + TLV_SIZE_MISMATCH(log, indent, + "Min/Max Link Delay"); stream_forward_getp(s, subtlv_len); } else { exts->min_delay = stream_getl(s); @@ -1049,8 +1053,8 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, break; case ISIS_SUBTLV_DELAY_VAR: if (subtlv_len != ISIS_SUBTLV_DEF_SIZE) { - sbuf_push(log, indent, - "TLV size does not match expected size for Delay Variation!\n"); + TLV_SIZE_MISMATCH(log, indent, + "Delay Variation"); stream_forward_getp(s, subtlv_len); } else { exts->delay_var = stream_getl(s); @@ -1059,8 +1063,8 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, break; case ISIS_SUBTLV_PKT_LOSS: if (subtlv_len != ISIS_SUBTLV_DEF_SIZE) { - sbuf_push(log, indent, - "TLV size does not match expected size for Link Packet Loss!\n"); + TLV_SIZE_MISMATCH(log, indent, + "Link Packet Loss"); stream_forward_getp(s, subtlv_len); } else { exts->pkt_loss = stream_getl(s); @@ -1069,8 +1073,9 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, break; case ISIS_SUBTLV_RES_BW: if (subtlv_len != ISIS_SUBTLV_DEF_SIZE) { - sbuf_push(log, indent, - "TLV size does not match expected size for Unidirectional Residual Bandwidth!\n"); + TLV_SIZE_MISMATCH( + log, indent, + "Unidirectional Residual Bandwidth"); stream_forward_getp(s, subtlv_len); } else { exts->res_bw = stream_getf(s); @@ -1079,8 +1084,9 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, break; case ISIS_SUBTLV_AVA_BW: if (subtlv_len != ISIS_SUBTLV_DEF_SIZE) { - sbuf_push(log, indent, - "TLV size does not match expected size for Unidirectional Available Bandwidth!\n"); + TLV_SIZE_MISMATCH( + log, indent, + "Unidirectional Available Bandwidth"); stream_forward_getp(s, subtlv_len); } else { exts->ava_bw = stream_getf(s); @@ -1089,8 +1095,9 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, break; case ISIS_SUBTLV_USE_BW: if (subtlv_len != ISIS_SUBTLV_DEF_SIZE) { - sbuf_push(log, indent, - "TLV size does not match expected size for Unidirectional Utilized Bandwidth!\n"); + TLV_SIZE_MISMATCH( + log, indent, + "Unidirectional Utilized Bandwidth"); stream_forward_getp(s, subtlv_len); } else { exts->use_bw = stream_getf(s); @@ -1101,8 +1108,7 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, case ISIS_SUBTLV_ADJ_SID: if (subtlv_len != ISIS_SUBTLV_ADJ_SID_SIZE && subtlv_len != ISIS_SUBTLV_ADJ_SID_SIZE + 1) { - sbuf_push(log, indent, - "TLV size does not match expected size for Adjacency SID!\n"); + TLV_SIZE_MISMATCH(log, indent, "Adjacency SID"); stream_forward_getp(s, subtlv_len); } else { struct isis_adj_sid *adj; @@ -1113,9 +1119,8 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, adj->weight = stream_getc(s); if (adj->flags & EXT_SUBTLV_LINK_ADJ_SID_VFLG && subtlv_len != ISIS_SUBTLV_ADJ_SID_SIZE) { - sbuf_push( - log, indent, - "TLV size does not match expected size for Adjacency SID!\n"); + TLV_SIZE_MISMATCH(log, indent, + "Adjacency SID"); stream_forward_getp(s, subtlv_len - 2); XFREE(MTYPE_ISIS_SUBTLV, adj); break; @@ -1125,9 +1130,8 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, && subtlv_len != ISIS_SUBTLV_ADJ_SID_SIZE + 1) { - sbuf_push( - log, indent, - "TLV size does not match expected size for Adjacency SID!\n"); + TLV_SIZE_MISMATCH(log, indent, + "Adjacency SID"); stream_forward_getp(s, subtlv_len - 2); XFREE(MTYPE_ISIS_SUBTLV, adj); break; @@ -1152,8 +1156,8 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, case ISIS_SUBTLV_LAN_ADJ_SID: if (subtlv_len != ISIS_SUBTLV_LAN_ADJ_SID_SIZE && subtlv_len != ISIS_SUBTLV_LAN_ADJ_SID_SIZE + 1) { - sbuf_push(log, indent, - "TLV size does not match expected size for LAN-Adjacency SID!\n"); + TLV_SIZE_MISMATCH(log, indent, + "LAN-Adjacency SID"); stream_forward_getp(s, subtlv_len); } else { struct isis_lan_adj_sid *lan; @@ -1168,9 +1172,8 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, if (lan->flags & EXT_SUBTLV_LINK_ADJ_SID_VFLG && subtlv_len != ISIS_SUBTLV_LAN_ADJ_SID_SIZE) { - sbuf_push( - log, indent, - "TLV size does not match expected size for LAN-Adjacency SID!\n"); + TLV_SIZE_MISMATCH(log, indent, + "LAN-Adjacency SID"); stream_forward_getp( s, subtlv_len - 2 - ISIS_SYS_ID_LEN); @@ -1182,9 +1185,8 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, && subtlv_len != ISIS_SUBTLV_LAN_ADJ_SID_SIZE + 1) { - sbuf_push( - log, indent, - "TLV size does not match expected size for LAN-Adjacency SID!\n"); + TLV_SIZE_MISMATCH(log, indent, + "LAN-Adjacency SID"); stream_forward_getp( s, subtlv_len - 2 - ISIS_SYS_ID_LEN); From cc4926c1284ea7950c12e9fab89c7276e8370fb8 Mon Sep 17 00:00:00 2001 From: Hiroki Shirokura Date: Sun, 12 Dec 2021 11:56:44 +0000 Subject: [PATCH 12/41] isisd,yang: add algorithm-prefix-sid configuration tree Add the ability to configure a Segment-Routing prefix SID for a given algorithm. For example: > segment-routing prefix 10.10.10.10/32 algorithm 128 index 100 Signed-off-by: Hiroki Shirokura Signed-off-by: Louis Scalbert --- isisd/isis_cli.c | 38 ++++++++ isisd/isis_nb.c | 34 +++++++ isisd/isis_nb.h | 19 ++++ isisd/isis_nb_config.c | 208 +++++++++++++++++++++++++++++++++++++++++ yang/frr-isisd.yang | 81 ++++++++++++++++ 5 files changed, 380 insertions(+) diff --git a/isisd/isis_cli.c b/isisd/isis_cli.c index ee51e4685..e75210341 100644 --- a/isisd/isis_cli.c +++ b/isisd/isis_cli.c @@ -1769,6 +1769,44 @@ void cli_show_isis_prefix_sid(struct vty *vty, const struct lyd_node *dnode, vty_out(vty, "\n"); } +/* + * XPath: + * /frr-isisd:isis/instance/segment-routing/algorithm-prefix-sids/algorithm-prefix-sid + */ +void cli_show_isis_prefix_sid_algorithm(struct vty *vty, + const struct lyd_node *dnode, + bool show_defaults) +{ + const char *prefix; + const char *lh_behavior; + const char *sid_value_type; + const char *sid_value; + bool n_flag_clear; + uint32_t algorithm; + + prefix = yang_dnode_get_string(dnode, "./prefix"); + sid_value_type = yang_dnode_get_string(dnode, "./sid-value-type"); + sid_value = yang_dnode_get_string(dnode, "./sid-value"); + algorithm = yang_dnode_get_uint32(dnode, "./algo"); + lh_behavior = yang_dnode_get_string(dnode, "./last-hop-behavior"); + n_flag_clear = yang_dnode_get_bool(dnode, "./n-flag-clear"); + + vty_out(vty, " segment-routing prefix %s", prefix); + vty_out(vty, " algorithm %u", algorithm); + if (strmatch(sid_value_type, "absolute")) + vty_out(vty, " absolute"); + else + vty_out(vty, " index"); + vty_out(vty, " %s", sid_value); + + if (strmatch(lh_behavior, "no-php")) + vty_out(vty, " no-php-flag"); + else if (strmatch(lh_behavior, "explicit-null")) + vty_out(vty, " explicit-null"); + if (n_flag_clear) + vty_out(vty, " n-flag-clear"); + vty_out(vty, "\n"); +} /* * XPath: /frr-isisd:isis/instance/fast-reroute/level-{1,2}/lfa/priority-limit diff --git a/isisd/isis_nb.c b/isisd/isis_nb.c index 9141bfc46..38817a01e 100644 --- a/isisd/isis_nb.c +++ b/isisd/isis_nb.c @@ -688,6 +688,40 @@ const struct frr_yang_module_info frr_isisd_info = { .modify = isis_instance_segment_routing_prefix_sid_map_prefix_sid_n_flag_clear_modify, } }, + { + .xpath = "/frr-isisd:isis/instance/segment-routing/algorithm-prefix-sids/algorithm-prefix-sid", + .cbs = { + .create = isis_instance_segment_routing_algorithm_prefix_sid_create, + .destroy = isis_instance_segment_routing_algorithm_prefix_sid_destroy, + .pre_validate = isis_instance_segment_routing_algorithm_prefix_sid_pre_validate, + .apply_finish = isis_instance_segment_routing_algorithm_prefix_sid_apply_finish, + .cli_show = cli_show_isis_prefix_sid_algorithm, + }, + }, + { + .xpath = "/frr-isisd:isis/instance/segment-routing/algorithm-prefix-sids/algorithm-prefix-sid/sid-value-type", + .cbs = { + .modify = isis_instance_segment_routing_algorithm_prefix_sid_sid_value_type_modify, + }, + }, + { + .xpath = "/frr-isisd:isis/instance/segment-routing/algorithm-prefix-sids/algorithm-prefix-sid/sid-value", + .cbs = { + .modify = isis_instance_segment_routing_algorithm_prefix_sid_sid_value_modify, + }, + }, + { + .xpath = "/frr-isisd:isis/instance/segment-routing/algorithm-prefix-sids/algorithm-prefix-sid/last-hop-behavior", + .cbs = { + .modify = isis_instance_segment_routing_algorithm_prefix_sid_last_hop_behavior_modify, + }, + }, + { + .xpath = "/frr-isisd:isis/instance/segment-routing/algorithm-prefix-sids/algorithm-prefix-sid/n-flag-clear", + .cbs = { + .modify = isis_instance_segment_routing_algorithm_prefix_sid_n_flag_clear_modify, + }, + }, { .xpath = "/frr-isisd:isis/instance/mpls/ldp-sync", .cbs = { diff --git a/isisd/isis_nb.h b/isisd/isis_nb.h index 9a1f1f786..72d6617c6 100644 --- a/isisd/isis_nb.h +++ b/isisd/isis_nb.h @@ -249,6 +249,22 @@ int isis_instance_segment_routing_prefix_sid_map_prefix_sid_last_hop_behavior_mo struct nb_cb_modify_args *args); int isis_instance_segment_routing_prefix_sid_map_prefix_sid_n_flag_clear_modify( struct nb_cb_modify_args *args); +int isis_instance_segment_routing_algorithm_prefix_sid_create( + struct nb_cb_create_args *args); +int isis_instance_segment_routing_algorithm_prefix_sid_destroy( + struct nb_cb_destroy_args *args); +int isis_instance_segment_routing_algorithm_prefix_sid_pre_validate( + struct nb_cb_pre_validate_args *args); +void isis_instance_segment_routing_algorithm_prefix_sid_apply_finish( + struct nb_cb_apply_finish_args *args); +int isis_instance_segment_routing_algorithm_prefix_sid_sid_value_type_modify( + struct nb_cb_modify_args *args); +int isis_instance_segment_routing_algorithm_prefix_sid_sid_value_modify( + struct nb_cb_modify_args *args); +int isis_instance_segment_routing_algorithm_prefix_sid_last_hop_behavior_modify( + struct nb_cb_modify_args *args); +int isis_instance_segment_routing_algorithm_prefix_sid_n_flag_clear_modify( + struct nb_cb_modify_args *args); int isis_instance_mpls_ldp_sync_destroy(struct nb_cb_destroy_args *args); int isis_instance_mpls_ldp_sync_create(struct nb_cb_create_args *args); int isis_instance_mpls_ldp_sync_holddown_modify(struct nb_cb_modify_args *args); @@ -538,6 +554,9 @@ void cli_show_isis_node_msd(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); void cli_show_isis_prefix_sid(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); +void cli_show_isis_prefix_sid_algorithm(struct vty *vty, + const struct lyd_node *dnode, + bool show_defaults); void cli_show_isis_frr_lfa_priority_limit(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); diff --git a/isisd/isis_nb_config.c b/isisd/isis_nb_config.c index 17706279b..697281a0d 100644 --- a/isisd/isis_nb_config.c +++ b/isisd/isis_nb_config.c @@ -2466,6 +2466,214 @@ int isis_instance_segment_routing_prefix_sid_map_prefix_sid_n_flag_clear_modify( return NB_OK; } +/* + * XPath: + * /frr-isisd:isis/instance/segment-routing/algorithm-prefix-sids/algorithm-prefix-sid + */ +int isis_instance_segment_routing_algorithm_prefix_sid_create( + struct nb_cb_create_args *args) +{ + struct isis_area *area; + struct prefix prefix; + struct sr_prefix_cfg *pcfg; + uint32_t algorithm; + + if (args->event != NB_EV_APPLY) + return NB_OK; + + area = nb_running_get_entry(args->dnode, NULL, true); + yang_dnode_get_prefix(&prefix, args->dnode, "./prefix"); + algorithm = yang_dnode_get_uint32(args->dnode, "./algo"); + + pcfg = isis_sr_cfg_prefix_add(area, &prefix, algorithm); + pcfg->algorithm = algorithm; + nb_running_set_entry(args->dnode, pcfg); + + return NB_OK; +} + +int isis_instance_segment_routing_algorithm_prefix_sid_destroy( + struct nb_cb_destroy_args *args) +{ + struct sr_prefix_cfg *pcfg; + struct isis_area *area; + + if (args->event != NB_EV_APPLY) + return NB_OK; + + pcfg = nb_running_unset_entry(args->dnode); + area = pcfg->area; + isis_sr_cfg_prefix_del(pcfg); + lsp_regenerate_schedule(area, area->is_type, 0); + + return NB_OK; +} + +int isis_instance_segment_routing_algorithm_prefix_sid_pre_validate( + struct nb_cb_pre_validate_args *args) +{ + const struct lyd_node *area_dnode; + struct isis_area *area; + struct prefix prefix; + uint32_t srgb_lbound; + uint32_t srgb_ubound; + uint32_t srgb_range; + uint32_t sid; + enum sr_sid_value_type sid_type; + struct isis_prefix_sid psid = {}; + + yang_dnode_get_prefix(&prefix, args->dnode, "./prefix"); + srgb_lbound = yang_dnode_get_uint32( + args->dnode, "../../label-blocks/srgb/lower-bound"); + srgb_ubound = yang_dnode_get_uint32( + args->dnode, "../../label-blocks/srgb/upper-bound"); + sid = yang_dnode_get_uint32(args->dnode, "./sid-value"); + sid_type = yang_dnode_get_enum(args->dnode, "./sid-value-type"); + + /* Check for invalid indexes/labels. */ + srgb_range = srgb_ubound - srgb_lbound + 1; + psid.value = sid; + switch (sid_type) { + case SR_SID_VALUE_TYPE_INDEX: + if (sid >= srgb_range) { + snprintf(args->errmsg, args->errmsg_len, + "SID index %u falls outside local SRGB range", + sid); + return NB_ERR_VALIDATION; + } + break; + case SR_SID_VALUE_TYPE_ABSOLUTE: + if (!IS_MPLS_UNRESERVED_LABEL(sid)) { + snprintf(args->errmsg, args->errmsg_len, + "Invalid absolute SID %u", sid); + return NB_ERR_VALIDATION; + } + SET_FLAG(psid.flags, ISIS_PREFIX_SID_VALUE); + SET_FLAG(psid.flags, ISIS_PREFIX_SID_LOCAL); + break; + } + + /* Check for Prefix-SID collisions. */ + area_dnode = yang_dnode_get_parent(args->dnode, "instance"); + area = nb_running_get_entry(area_dnode, NULL, false); + if (!area) + return NB_OK; + + for (int tree = SPFTREE_IPV4; tree < SPFTREE_COUNT; tree++) { + for (int level = ISIS_LEVEL1; level <= ISIS_LEVEL2; level++) { + struct isis_spftree *spftree; + struct isis_vertex *vertex_psid; + + if (!(area->is_type & level)) + continue; + spftree = area->spftree[tree][level - 1]; + if (!spftree) + continue; + + vertex_psid = + isis_spf_prefix_sid_lookup(spftree, &psid); + if (vertex_psid && + !prefix_same(&vertex_psid->N.ip.p.dest, &prefix)) { + snprintfrr( + args->errmsg, args->errmsg_len, + "Prefix-SID collision detected, SID %s %u is already in use by prefix %pFX (L%u)", + CHECK_FLAG(psid.flags, + ISIS_PREFIX_SID_VALUE) + ? "label" + : "index", + psid.value, &vertex_psid->N.ip.p.dest, + level); + return NB_ERR_VALIDATION; + } + } + } + + return NB_OK; +} + +void isis_instance_segment_routing_algorithm_prefix_sid_apply_finish( + struct nb_cb_apply_finish_args *args) +{ + struct sr_prefix_cfg *pcfg; + struct isis_area *area; + + pcfg = nb_running_get_entry(args->dnode, NULL, true); + area = pcfg->area; + lsp_regenerate_schedule(area, area->is_type, 0); +} + +/* + * XPath: + * /frr-isisd:isis/instance/segment-routing/algorithm-prefix-sids/algorithm-prefix-sid/sid-value-type + */ +int isis_instance_segment_routing_algorithm_prefix_sid_sid_value_type_modify( + struct nb_cb_modify_args *args) +{ + struct sr_prefix_cfg *pcfg; + + if (args->event != NB_EV_APPLY) + return NB_OK; + + pcfg = nb_running_get_entry(args->dnode, NULL, true); + pcfg->sid_type = yang_dnode_get_enum(args->dnode, NULL); + + return NB_OK; +} + +/* + * XPath: + * /frr-isisd:isis/instance/segment-routing/algorithm-prefix-sids/algorithm-prefix-sid/sid-value + */ +int isis_instance_segment_routing_algorithm_prefix_sid_sid_value_modify( + struct nb_cb_modify_args *args) +{ + struct sr_prefix_cfg *pcfg; + + if (args->event != NB_EV_APPLY) + return NB_OK; + + pcfg = nb_running_get_entry(args->dnode, NULL, true); + pcfg->sid = yang_dnode_get_uint32(args->dnode, NULL); + + return NB_OK; +} + +/* + * XPath: + * /frr-isisd:isis/instance/segment-routing/algorithm-prefix-sid-map/algorithm-prefix-sid/last-hop-behavior + */ +int isis_instance_segment_routing_algorithm_prefix_sid_last_hop_behavior_modify( + struct nb_cb_modify_args *args) +{ + struct sr_prefix_cfg *pcfg; + + if (args->event != NB_EV_APPLY) + return NB_OK; + + pcfg = nb_running_get_entry(args->dnode, NULL, true); + pcfg->last_hop_behavior = yang_dnode_get_enum(args->dnode, NULL); + + return NB_OK; +} + +/* + * XPath: + * /frr-isisd:isis/instance/segment-routing/algorithm-prefix-sids/algorithm-prefix-sid/n-flag-clear + */ +int isis_instance_segment_routing_algorithm_prefix_sid_n_flag_clear_modify( + struct nb_cb_modify_args *args) +{ + struct sr_prefix_cfg *pcfg; + + if (args->event != NB_EV_APPLY) + return NB_OK; + + pcfg = nb_running_get_entry(args->dnode, NULL, true); + pcfg->n_flag_clear = yang_dnode_get_bool(args->dnode, NULL); + + return NB_OK; +} + /* * XPath: /frr-isisd:isis/instance/mpls/ldp-sync */ diff --git a/yang/frr-isisd.yang b/yang/frr-isisd.yang index de925b482..264d5fd3c 100644 --- a/yang/frr-isisd.yang +++ b/yang/frr-isisd.yang @@ -1751,6 +1751,87 @@ module frr-isisd { } } } + container algorithm-prefix-sids { + description + "Algorithm SID Table"; + list algorithm-prefix-sid { + key "prefix algo"; + description + "Assign prefix SID for algorithm to an + interface, ISISPHPFlag will be rejected + if set to disable, ISISEXPLICITNULLFlag + will override the value of ISISPHPFlag"; + leaf algo { + type uint32 { + range "128..255"; + } + description + "Algorithm"; + } + leaf prefix { + type inet:ip-prefix; + mandatory true; + description + "Connected prefix sid."; + } + leaf sid-value-type { + type enumeration { + enum "index" { + value 0; + description + "The value will be interpreted as an index."; + } + enum "absolute" { + value 1; + description + "The value will become interpreted as an absolute + value."; + } + } + default "index"; + description + "This leaf defines how value must be interpreted."; + } + leaf sid-value { + type uint32 { + range "0..1048575"; + } + mandatory true; + description + "Value associated with prefix. The value must be + interpreted in the context of sid-value-type."; + } + leaf last-hop-behavior { + type enumeration { + enum "explicit-null" { + value 0; + description + "Use explicit-null for the SID."; + } + enum "no-php" { + value 1; + description + "Do not use Penultimate Hop Popping (PHP) + for the SID."; + } + enum "php" { + value 2; + description + "Use PHP for the SID."; + } + } + default "php"; + description + "Configure last hop behavior."; + } + leaf n-flag-clear { + type boolean; + default "false"; + description + "Not a node SID"; + } + } + } } container mpls { From 67409447ff0174cf83c2231a8b97414acc670903 Mon Sep 17 00:00:00 2001 From: Hiroki Shirokura Date: Sun, 12 Dec 2021 12:00:24 +0000 Subject: [PATCH 13/41] isisd: add cli to configure algorithm-prefix-sid Add the ability to configure a Segment-Routing prefix SID for a given algorithm. For example: > segment-routing prefix 10.10.10.10/32 algorithm 128 index 100 Signed-off-by: Hiroki Shirokura Signed-off-by: Louis Scalbert --- isisd/isis_cli.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/isisd/isis_cli.c b/isisd/isis_cli.c index e75210341..f4da01bb8 100644 --- a/isisd/isis_cli.c +++ b/isisd/isis_cli.c @@ -1769,10 +1769,88 @@ void cli_show_isis_prefix_sid(struct vty *vty, const struct lyd_node *dnode, vty_out(vty, "\n"); } +#ifndef FABRICD /* * XPath: * /frr-isisd:isis/instance/segment-routing/algorithm-prefix-sids/algorithm-prefix-sid */ +DEFPY_YANG( + isis_sr_prefix_sid_algorithm, isis_sr_prefix_sid_algorithm_cmd, + "segment-routing prefix $prefix\ + algorithm (128-255)$algorithm\ + \ + [$lh_behavior] [n-flag-clear$n_flag_clear]", + SR_STR + "Prefix SID\n" + "IPv4 Prefix\n" + "IPv6 Prefix\n" + "Algorithm Specific Prefix SID Configuration\n" + "Algorithm number\n" + "Specify the absolute value of Prefix Segment ID\n" + "The Prefix Segment ID value\n" + "Specify the index of Prefix Segment ID\n" + "The Prefix Segment ID index\n" + "Don't request Penultimate Hop Popping (PHP)\n" + "Upstream neighbor must replace prefix-sid with explicit null label\n" + "Not a node SID\n") +{ + nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); + nb_cli_enqueue_change(vty, "./sid-value-type", NB_OP_MODIFY, sid_type); + nb_cli_enqueue_change(vty, "./sid-value", NB_OP_MODIFY, sid_value_str); + if (lh_behavior) { + const char *value; + + if (strmatch(lh_behavior, "no-php-flag")) + value = "no-php"; + else if (strmatch(lh_behavior, "explicit-null")) + value = "explicit-null"; + else + value = "php"; + + nb_cli_enqueue_change(vty, "./last-hop-behavior", NB_OP_MODIFY, + value); + } else + nb_cli_enqueue_change(vty, "./last-hop-behavior", NB_OP_MODIFY, + NULL); + nb_cli_enqueue_change(vty, "./n-flag-clear", NB_OP_MODIFY, + n_flag_clear ? "true" : "false"); + + return nb_cli_apply_changes( + vty, + "./segment-routing/algorithm-prefix-sids/algorithm-prefix-sid[prefix='%s'][algo='%s']", + prefix_str, algorithm_str); +} + +DEFPY_YANG( + no_isis_sr_prefix_algorithm_sid, no_isis_sr_prefix_sid_algorithm_cmd, + "no segment-routing prefix $prefix\ + algorithm (128-255)$algorithm\ + [ []]\ + [n-flag-clear]", + NO_STR SR_STR + "Prefix SID\n" + "IPv4 Prefix\n" + "IPv6 Prefix\n" + "Algorithm Specific Prefix SID Configuration\n" + "Algorithm number\n" + "Specify the absolute value of Prefix Segment ID\n" + "The Prefix Segment ID value\n" + "Specify the index of Prefix Segment ID\n" + "The Prefix Segment ID index\n" + "Don't request Penultimate Hop Popping (PHP)\n" + "Upstream neighbor must replace prefix-sid with explicit null label\n" + "Not a node SID\n") +{ + nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); + + return nb_cli_apply_changes( + vty, + "./segment-routing/algorithm-prefix-sids/algorithm-prefix-sid[prefix='%s'][algo='%s']", + prefix_str, algorithm_str); + return CMD_SUCCESS; +} +#endif /* ifndef FABRICD */ + void cli_show_isis_prefix_sid_algorithm(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) @@ -3301,6 +3379,10 @@ void isis_cli_init(void) install_element(ISIS_NODE, &no_isis_sr_node_msd_cmd); install_element(ISIS_NODE, &isis_sr_prefix_sid_cmd); install_element(ISIS_NODE, &no_isis_sr_prefix_sid_cmd); +#ifndef FABRICD + install_element(ISIS_NODE, &isis_sr_prefix_sid_algorithm_cmd); + install_element(ISIS_NODE, &no_isis_sr_prefix_sid_algorithm_cmd); +#endif /* ifndef FABRICD */ install_element(ISIS_NODE, &isis_frr_lfa_priority_limit_cmd); install_element(ISIS_NODE, &isis_frr_lfa_tiebreaker_cmd); install_element(ISIS_NODE, &isis_frr_lfa_load_sharing_cmd); From 735fb37db1897f6393680c62d369e339146f004b Mon Sep 17 00:00:00 2001 From: Hiroki Shirokura Date: Sat, 22 Jan 2022 11:08:05 +0000 Subject: [PATCH 14/41] lib: add library for igp flexible-algorithm Add a library to deal with Flexible Algorithm that will be common to IS-IS and OSPF. The functions enables to deal with: - Affinity-maps - Extended Admin Group (RFC7308) - Flex-Algo structures that contains the flex-algo configurations Signed-off-by: Hiroki Shirokura Signed-off-by: Louis Scalbert --- lib/flex_algo.c | 142 ++++++++++++++++++++++++++++++++++++++++++++++++ lib/flex_algo.h | 121 +++++++++++++++++++++++++++++++++++++++++ lib/subdir.am | 2 + 3 files changed, 265 insertions(+) create mode 100644 lib/flex_algo.c create mode 100644 lib/flex_algo.h diff --git a/lib/flex_algo.c b/lib/flex_algo.c new file mode 100644 index 000000000..bafbf8b77 --- /dev/null +++ b/lib/flex_algo.c @@ -0,0 +1,142 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/********************************************************************* + * Copyright 2022 Hiroki Shirokura, LINE Corporation + * Copyright 2022 Masakazu Asama + * Copyright 2022 6WIND S.A. + * + * flex_algo.c: Flexible Algorithm library + * + * Authors + * ------- + * Hiroki Shirokura + * Masakazu Asama + * Louis Scalbert + */ + +#include "zebra.h" + +#include "flex_algo.h" + +DEFINE_MTYPE_STATIC(LIB, FLEX_ALGO, "Flex-Algo Definition"); + +struct flex_algos *flex_algos_alloc(flex_algo_allocator_t allocator, + flex_algo_releaser_t releaser) +{ + struct flex_algos *flex_algos; + + flex_algos = XCALLOC(MTYPE_FLEX_ALGO, sizeof(*flex_algos)); + flex_algos->flex_algos = list_new(); + flex_algos->allocator = allocator; + flex_algos->releaser = releaser; + return flex_algos; +} + +struct flex_algo *flex_algo_alloc(struct flex_algos *flex_algos, + uint8_t algorithm, void *arg) +{ + struct flex_algo *fa; + + fa = XCALLOC(MTYPE_FLEX_ALGO, sizeof(*fa)); + fa->algorithm = algorithm; + if (flex_algos->allocator) + fa->data = flex_algos->allocator(arg); + admin_group_init(&fa->admin_group_exclude_any); + admin_group_init(&fa->admin_group_include_any); + admin_group_init(&fa->admin_group_include_all); + listnode_add(flex_algos->flex_algos, fa); + return fa; +} + +/** + * @brief Look up the local flex-algo object by its algorithm number. + * @param algorithm flex-algo algorithm number + * @param area area pointer of flex-algo + * @return local flex-algo object if exist, else NULL + */ +struct flex_algo *flex_algo_lookup(struct flex_algos *flex_algos, + uint8_t algorithm) +{ + struct listnode *node; + struct flex_algo *fa; + + for (ALL_LIST_ELEMENTS_RO(flex_algos->flex_algos, node, fa)) + if (fa->algorithm == algorithm) + return fa; + return NULL; +} + +/** + * @brief Compare two Flex-Algo Definitions (FAD) + * @param Flex algo 1 + * @param Flex algo 2 + * @return true if the definition is equal, else false + */ +bool flex_algo_definition_cmp(struct flex_algo *fa1, struct flex_algo *fa2) +{ + if (fa1->algorithm != fa2->algorithm) + return false; + if (fa1->calc_type != fa2->calc_type) + return false; + if (fa1->metric_type != fa2->metric_type) + return false; + + if (!admin_group_cmp(&fa1->admin_group_exclude_any, + &fa2->admin_group_exclude_any)) + return false; + if (!admin_group_cmp(&fa1->admin_group_include_all, + &fa2->admin_group_include_all)) + return false; + if (!admin_group_cmp(&fa1->admin_group_include_any, + &fa2->admin_group_include_any)) + return false; + + return true; +} + +void flex_algo_delete(struct flex_algos *flex_algos, uint8_t algorithm) +{ + struct listnode *node, *nnode; + struct flex_algo *fa; + + for (ALL_LIST_ELEMENTS(flex_algos->flex_algos, node, nnode, fa)) { + if (fa->algorithm != algorithm) + continue; + if (flex_algos->releaser) + flex_algos->releaser(fa->data); + admin_group_term(&fa->admin_group_exclude_any); + admin_group_term(&fa->admin_group_include_any); + admin_group_term(&fa->admin_group_include_all); + listnode_delete(flex_algos->flex_algos, fa); + XFREE(MTYPE_FLEX_ALGO, fa); + return; + } +} + +/** + * Check SR Algorithm is Flex-Algo + * according to RFC9350 section 4 + * + * @param algorithm SR Algorithm + */ +bool flex_algo_id_valid(uint16_t algorithm) +{ + return algorithm >= SR_ALGORITHM_FLEX_MIN && + algorithm <= SR_ALGORITHM_FLEX_MAX; +} + +char *flex_algo_metric_type_print(char *type_str, size_t sz, + enum flex_algo_metric_type metric_type) +{ + switch (metric_type) { + case MT_IGP: + snprintf(type_str, sz, "igp"); + break; + case MT_MIN_UNI_LINK_DELAY: + snprintf(type_str, sz, "delay"); + break; + case MT_TE_DEFAULT: + snprintf(type_str, sz, "te"); + break; + } + return type_str; +} diff --git a/lib/flex_algo.h b/lib/flex_algo.h new file mode 100644 index 000000000..e012f4686 --- /dev/null +++ b/lib/flex_algo.h @@ -0,0 +1,121 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/********************************************************************* + * Copyright 2022 Hiroki Shirokura, LINE Corporation + * Copyright 2022 Masakazu Asama + * Copyright 2022 6WIND S.A. + * + * flex_algo.h: Flexible Algorithm library + * + * Authors + * ------- + * Hiroki Shirokura + * Masakazu Asama + * Louis Scalbert + */ + +#ifndef _FRR_FLEX_ALGO_H +#define _FRR_FLEX_ALGO_H + +#include "admin_group.h" +#include "linklist.h" +#include "prefix.h" +#include "segment_routing.h" + +#define FLEX_ALGO_PRIO_DEFAULT 128 + +#define CALC_TYPE_SPF 0 + +/* flex-algo definition flags */ + +/* M-flag (aka. prefix-metric) + * Flex-Algorithm specific prefix and ASBR metric MUST be used + */ +#define FAD_FLAG_M 0x80 + +/* + * Metric Type values from RFC9350 section 5.1 + */ +enum flex_algo_metric_type { + MT_IGP = 0, + MT_MIN_UNI_LINK_DELAY = 1, + MT_TE_DEFAULT = 2, +}; + + +/* Flex-Algo data about a given algorithm. + * It includes the definition and some local data. + */ +struct flex_algo { + /* Flex-Algo definition */ + uint8_t algorithm; + enum flex_algo_metric_type metric_type; + uint8_t calc_type; + uint8_t priority; + uint8_t flags; + + /* extended admin-groups */ + struct admin_group admin_group_exclude_any; + struct admin_group admin_group_include_any; + struct admin_group admin_group_include_all; + + /* Exclude SRLG Sub-TLV is not yet supported by IS-IS + * True if a Exclude SRLG Sub-TLV has been found + */ + bool exclude_srlg; + + /* True if an unsupported sub-TLV other Exclude SRLG + * has been received. + * A router that receives an unsupported definition + * that is elected must not participate in the algorithm. + * This boolean prevents future sub-TLV from being considered + * as supported. + */ + bool unsupported_subtlv; + + /* Flex-Algo local data */ + + /* True if the local definition must be advertised */ + bool advertise_definition; + + /* which dataplane must be used for the algorithm */ +#define FLEX_ALGO_SR_MPLS 0x01 +#define FLEX_ALGO_SRV6 0x02 +#define FLEX_ALGO_IP 0x04 + uint8_t dataplanes; + + /* + * This property can be freely extended among different routing + * protocols. Since Flex-Algo is an IGP protocol agnostic, both IS-IS + * and OSPF can implement Flex-Algo. The struct flex_algo thus provides + * the general data structure of Flex-Algo, and the value of extending + * it with the IGP protocol is provided by this property. + */ + void *data; +}; + +typedef void *(*flex_algo_allocator_t)(void *); +typedef void (*flex_algo_releaser_t)(void *); + +struct flex_algos { + flex_algo_allocator_t allocator; + flex_algo_releaser_t releaser; + struct list *flex_algos; +}; + +/* + * Flex-Algo Utilities + */ +struct flex_algos *flex_algos_alloc(flex_algo_allocator_t allocator, + flex_algo_releaser_t releaser); +struct flex_algo *flex_algo_alloc(struct flex_algos *flex_algos, + uint8_t algorithm, void *arg); +struct flex_algo *flex_algo_lookup(struct flex_algos *flex_algos, + uint8_t algorithm); +void flex_algos_free(struct flex_algos *flex_algos); +bool flex_algo_definition_cmp(struct flex_algo *fa1, struct flex_algo *fa2); +void flex_algo_delete(struct flex_algos *flex_algos, uint8_t algorithm); +bool flex_algo_id_valid(uint16_t algorithm); +char *flex_algo_metric_type_print(char *type_str, size_t sz, + enum flex_algo_metric_type metric_type); + +#endif /* _FRR_FLEX_ALGO_H */ diff --git a/lib/subdir.am b/lib/subdir.am index 318c09663..0cd68c0e7 100644 --- a/lib/subdir.am +++ b/lib/subdir.am @@ -33,6 +33,7 @@ lib_libfrr_la_SOURCES = \ lib/filter.c \ lib/filter_cli.c \ lib/filter_nb.c \ + lib/flex_algo.c \ lib/frrcu.c \ lib/frrlua.c \ lib/frrscript.c \ @@ -211,6 +212,7 @@ pkginclude_HEADERS += \ lib/distribute.h \ lib/ferr.h \ lib/filter.h \ + lib/flex_algo.h \ lib/freebsd-queue.h \ lib/frrlua.h \ lib/frrscript.h \ From 46fb37cf6774e910692f254e870451b2960197f2 Mon Sep 17 00:00:00 2001 From: Hiroki Shirokura Date: Sat, 18 Dec 2021 08:11:58 +0000 Subject: [PATCH 15/41] lib,vtysh,isisd,yang: algo cli/yang/callbacks Define the IS-IS flex-algo structure in yang, the CLI configuration commands and the skeletons of frontend and backend functions that are called by the CLI code. Signed-off-by: Hiroki Shirokura Signed-off-by: Eric Kinzie Signed-off-by: Louis Scalbert --- isisd/isis_cli.c | 145 ++++++++++++++++++++++++++++++++ isisd/isis_nb.c | 92 +++++++++++++++++++++ isisd/isis_nb.h | 56 +++++++++++++ isisd/isis_nb_config.c | 182 +++++++++++++++++++++++++++++++++++++++++ isisd/isisd.c | 11 +++ lib/command.h | 1 + vtysh/vtysh.c | 33 ++++++++ yang/frr-isisd.yang | 115 ++++++++++++++++++++++++++ 8 files changed, 635 insertions(+) diff --git a/isisd/isis_cli.c b/isisd/isis_cli.c index f4da01bb8..c93bcaf8f 100644 --- a/isisd/isis_cli.c +++ b/isisd/isis_cli.c @@ -1126,6 +1126,52 @@ void cli_show_isis_purge_origin(struct vty *vty, const struct lyd_node *dnode, vty_out(vty, " purge-originator\n"); } +/* + * XPath: /frr-isisd:isis/instance/admin-group-send-zero + */ +DEFPY_YANG(isis_admin_group_send_zero, isis_admin_group_send_zero_cmd, + "[no] admin-group-send-zero", + NO_STR + "Allow sending the default admin-group value of 0x00000000.\n") +{ + nb_cli_enqueue_change(vty, "./admin-group-send-zero", NB_OP_MODIFY, + no ? "false" : "true"); + + return nb_cli_apply_changes(vty, NULL); +} + +void cli_show_isis_admin_group_send_zero(struct vty *vty, + const struct lyd_node *dnode, + bool show_defaults) +{ + if (!yang_dnode_get_bool(dnode, NULL)) + vty_out(vty, " no"); + vty_out(vty, " admin-group-send-zero\n"); +} + + +/* + * XPath: /frr-isisd:isis/instance/asla-legacy-flag + */ +DEFPY_HIDDEN(isis_asla_legacy_flag, isis_asla_legacy_flag_cmd, + "[no] asla-legacy-flag", + NO_STR "Set the legacy flag (aka. L-FLAG) in the ASLA Sub-TLV.\n") +{ + nb_cli_enqueue_change(vty, "./asla-legacy-flag", NB_OP_MODIFY, + no ? "false" : "true"); + + return nb_cli_apply_changes(vty, NULL); +} + +void cli_show_isis_asla_legacy_flag(struct vty *vty, + const struct lyd_node *dnode, + bool show_defaults) +{ + if (!yang_dnode_get_bool(dnode, NULL)) + vty_out(vty, " no"); + vty_out(vty, " asla-legacy-flag\n"); +} + /* * XPath: /frr-isisd:isis/instance/mpls-te */ @@ -3298,6 +3344,92 @@ void cli_show_isis_mpls_if_ldp_sync_holddown(struct vty *vty, yang_dnode_get_string(dnode, NULL)); } +DEFPY_YANG_NOSH(flex_algo, flex_algo_cmd, "flex-algo (128-255)$algorithm", + "Flexible Algorithm\n" + "Flexible Algorithm Number\n") +{ + return CMD_SUCCESS; +} + +DEFPY_YANG(no_flex_algo, no_flex_algo_cmd, "no flex-algo (128-255)$algorithm", + NO_STR + "Flexible Algorithm\n" + "Flexible Algorithm Number\n") +{ + return CMD_SUCCESS; +} + +DEFPY_YANG(advertise_definition, advertise_definition_cmd, + "[no] advertise-definition", + NO_STR "Advertise Local Flexible Algorithm\n") +{ + return CMD_SUCCESS; +} + +DEFPY_YANG(affinity_include_any, affinity_include_any_cmd, + "[no] affinity include-any NAME...", + NO_STR + "Affinity configuration\n" + "Any Include with\n" + "Include NAME list\n") +{ + return CMD_SUCCESS; +} + +DEFPY_YANG(affinity_include_all, affinity_include_all_cmd, + "[no] affinity include-all NAME...", + NO_STR + "Affinity configuration\n" + "All Include with\n" + "Include NAME list\n") +{ + return CMD_SUCCESS; +} + +DEFPY_YANG(affinity_exclude_any, affinity_exclude_any_cmd, + "[no] affinity exclude-any NAME...", + NO_STR + "Affinity configuration\n" + "Any Exclude with\n" + "Exclude NAME list\n") +{ + return CMD_SUCCESS; +} + +DEFPY_YANG(prefix_metric, prefix_metric_cmd, "[no] prefix-metric", + NO_STR "Use Flex-Algo Prefix Metric\n") +{ + return CMD_SUCCESS; +} + +DEFPY_YANG(metric_type, metric_type_cmd, + "[no] metric-type [igp$igp|te$te|delay$delay]", + NO_STR + "Metric-type used by flex-algo calculation\n" + "Use IGP metric (default)\n" + "Use Delay as metric\n" + "Use Traffic Engineering metric\n") +{ + return CMD_SUCCESS; +} + +DEFPY_YANG(priority, priority_cmd, "[no] priority (0-255)$priority", + NO_STR + "Flex-Algo definition priority\n" + "Priority value\n") +{ + return CMD_SUCCESS; +} + +void cli_show_isis_flex_algo(struct vty *vty, const struct lyd_node *dnode, + bool show_defaults) +{ +} + +void cli_show_isis_flex_algo_end(struct vty *vty, const struct lyd_node *dnode) +{ +} + void isis_cli_init(void) { install_element(CONFIG_NODE, &router_isis_cmd); @@ -3356,6 +3488,9 @@ void isis_cli_init(void) install_element(ISIS_NODE, &area_purge_originator_cmd); + install_element(ISIS_NODE, &isis_admin_group_send_zero_cmd); + install_element(ISIS_NODE, &isis_asla_legacy_flag_cmd); + install_element(ISIS_NODE, &isis_mpls_te_on_cmd); install_element(ISIS_NODE, &no_isis_mpls_te_on_cmd); install_element(ISIS_NODE, &isis_mpls_te_router_addr_cmd); @@ -3439,6 +3574,16 @@ void isis_cli_init(void) install_element(INTERFACE_NODE, &isis_mpls_if_ldp_sync_cmd); install_element(INTERFACE_NODE, &isis_mpls_if_ldp_sync_holddown_cmd); install_element(INTERFACE_NODE, &no_isis_mpls_if_ldp_sync_holddown_cmd); + + install_element(ISIS_NODE, &flex_algo_cmd); + install_element(ISIS_NODE, &no_flex_algo_cmd); + install_element(ISIS_FLEX_ALGO_NODE, &advertise_definition_cmd); + install_element(ISIS_FLEX_ALGO_NODE, &affinity_include_any_cmd); + install_element(ISIS_FLEX_ALGO_NODE, &affinity_include_all_cmd); + install_element(ISIS_FLEX_ALGO_NODE, &affinity_exclude_any_cmd); + install_element(ISIS_FLEX_ALGO_NODE, &prefix_metric_cmd); + install_element(ISIS_FLEX_ALGO_NODE, &metric_type_cmd); + install_element(ISIS_FLEX_ALGO_NODE, &priority_cmd); } #endif /* ifndef FABRICD */ diff --git a/isisd/isis_nb.c b/isisd/isis_nb.c index 38817a01e..6da8fa2d2 100644 --- a/isisd/isis_nb.c +++ b/isisd/isis_nb.c @@ -102,6 +102,20 @@ const struct frr_yang_module_info frr_isisd_info = { .modify = isis_instance_purge_originator_modify, }, }, + { + .xpath = "/frr-isisd:isis/instance/admin-group-send-zero", + .cbs = { + .cli_show = cli_show_isis_admin_group_send_zero, + .modify = isis_instance_admin_group_send_zero_modify, + }, + }, + { + .xpath = "/frr-isisd:isis/instance/asla-legacy-flag", + .cbs = { + .cli_show = cli_show_isis_asla_legacy_flag, + .modify = isis_instance_asla_legacy_flag_modify, + }, + }, { .xpath = "/frr-isisd:isis/instance/lsp/mtu", .cbs = { @@ -722,6 +736,84 @@ const struct frr_yang_module_info frr_isisd_info = { .modify = isis_instance_segment_routing_algorithm_prefix_sid_n_flag_clear_modify, }, }, + { + .xpath = "/frr-isisd:isis/instance/flex-algos/flex-algo", + .cbs = { + .cli_show = cli_show_isis_flex_algo, + .cli_show_end = cli_show_isis_flex_algo_end, + .create = isis_instance_flex_algo_create, + .destroy = isis_instance_flex_algo_destroy, + }, + }, + { + .xpath = "/frr-isisd:isis/instance/flex-algos/flex-algo/advertise-definition", + .cbs = { + .modify = isis_instance_flex_algo_advertise_definition_modify, + .destroy = isis_instance_flex_algo_advertise_definition_destroy, + }, + }, + { + .xpath = "/frr-isisd:isis/instance/flex-algos/flex-algo/affinity-include-alls/affinity-include-all", + .cbs = { + .create = isis_instance_flex_algo_affinity_include_all_create, + .destroy = isis_instance_flex_algo_affinity_include_all_destroy, + }, + }, + { + .xpath = "/frr-isisd:isis/instance/flex-algos/flex-algo/affinity-include-anies/affinity-include-any", + .cbs = { + .create = isis_instance_flex_algo_affinity_include_any_create, + .destroy = isis_instance_flex_algo_affinity_include_any_destroy, + }, + }, + { + .xpath = "/frr-isisd:isis/instance/flex-algos/flex-algo/affinity-exclude-anies/affinity-exclude-any", + .cbs = { + .create = isis_instance_flex_algo_affinity_exclude_any_create, + .destroy = isis_instance_flex_algo_affinity_exclude_any_destroy, + }, + }, + { + .xpath = "/frr-isisd:isis/instance/flex-algos/flex-algo/prefix-metric", + .cbs = { + .create = isis_instance_flex_algo_prefix_metric_create, + .destroy = isis_instance_flex_algo_prefix_metric_destroy, + }, + }, + { + .xpath = "/frr-isisd:isis/instance/flex-algos/flex-algo/metric-type", + .cbs = { + .modify = isis_instance_flex_algo_metric_type_modify, + }, + }, + { + .xpath = "/frr-isisd:isis/instance/flex-algos/flex-algo/dplane-sr-mpls", + .cbs = { + .create = isis_instance_flex_algo_dplane_sr_mpls_create, + .destroy = isis_instance_flex_algo_dplane_sr_mpls_destroy, + }, + }, + { + .xpath = "/frr-isisd:isis/instance/flex-algos/flex-algo/dplane-srv6", + .cbs = { + .create = isis_instance_flex_algo_dplane_srv6_create, + .destroy = isis_instance_flex_algo_dplane_srv6_destroy, + }, + }, + { + .xpath = "/frr-isisd:isis/instance/flex-algos/flex-algo/dplane-ip", + .cbs = { + .create = isis_instance_flex_algo_dplane_ip_create, + .destroy = isis_instance_flex_algo_dplane_ip_destroy, + }, + }, + { + .xpath = "/frr-isisd:isis/instance/flex-algos/flex-algo/priority", + .cbs = { + .modify = isis_instance_flex_algo_priority_modify, + .destroy = isis_instance_flex_algo_priority_destroy, + }, + }, { .xpath = "/frr-isisd:isis/instance/mpls/ldp-sync", .cbs = { diff --git a/isisd/isis_nb.h b/isisd/isis_nb.h index 72d6617c6..13efa36d7 100644 --- a/isisd/isis_nb.h +++ b/isisd/isis_nb.h @@ -29,6 +29,8 @@ int isis_instance_overload_on_startup_modify(struct nb_cb_modify_args *args); int isis_instance_advertise_high_metrics_modify(struct nb_cb_modify_args *args); int isis_instance_metric_style_modify(struct nb_cb_modify_args *args); int isis_instance_purge_originator_modify(struct nb_cb_modify_args *args); +int isis_instance_admin_group_send_zero_modify(struct nb_cb_modify_args *args); +int isis_instance_asla_legacy_flag_modify(struct nb_cb_modify_args *args); int isis_instance_lsp_mtu_modify(struct nb_cb_modify_args *args); int isis_instance_advertise_passive_only_modify(struct nb_cb_modify_args *args); int isis_instance_lsp_refresh_interval_level_1_modify( @@ -265,6 +267,51 @@ int isis_instance_segment_routing_algorithm_prefix_sid_last_hop_behavior_modify( struct nb_cb_modify_args *args); int isis_instance_segment_routing_algorithm_prefix_sid_n_flag_clear_modify( struct nb_cb_modify_args *args); +int isis_instance_flex_algo_create(struct nb_cb_create_args *args); +int isis_instance_flex_algo_destroy(struct nb_cb_destroy_args *args); +int isis_instance_flex_algo_advertise_definition_modify( + struct nb_cb_modify_args *args); +int isis_instance_flex_algo_advertise_definition_destroy( + struct nb_cb_destroy_args *args); +int isis_instance_flex_algo_affinity_include_any_create( + struct nb_cb_create_args *args); +int isis_instance_flex_algo_affinity_include_any_destroy( + struct nb_cb_destroy_args *args); +int isis_instance_flex_algo_affinity_include_all_create( + struct nb_cb_create_args *args); +int isis_instance_flex_algo_affinity_include_all_destroy( + struct nb_cb_destroy_args *args); +int isis_instance_flex_algo_affinity_exclude_any_create( + struct nb_cb_create_args *args); +int isis_instance_flex_algo_affinity_exclude_any_destroy( + struct nb_cb_destroy_args *args); +int isis_instance_flex_algo_prefix_metric_create( + struct nb_cb_create_args *args); +int isis_instance_flex_algo_prefix_metric_destroy( + struct nb_cb_destroy_args *args); +int isis_instance_flex_algo_dplane_sr_mpls_create( + struct nb_cb_create_args *args); +int isis_instance_flex_algo_dplane_sr_mpls_destroy( + struct nb_cb_destroy_args *args); +int isis_instance_flex_algo_dplane_srv6_create(struct nb_cb_create_args *args); +int isis_instance_flex_algo_dplane_srv6_destroy( + struct nb_cb_destroy_args *args); +int isis_instance_flex_algo_dplane_ip_create(struct nb_cb_create_args *args); +int isis_instance_flex_algo_dplane_ip_destroy(struct nb_cb_destroy_args *args); +int isis_instance_flex_algo_metric_type_modify(struct nb_cb_modify_args *args); +int isis_instance_flex_algo_priority_modify(struct nb_cb_modify_args *args); +int isis_instance_flex_algo_priority_destroy(struct nb_cb_destroy_args *args); +int isis_instance_flex_algo_frr_disable_modify(struct nb_cb_modify_args *args); +int isis_instance_flex_algo_frr_disable_destroy( + struct nb_cb_destroy_args *args); +int isis_instance_flex_algo_affinity_mapping_create( + struct nb_cb_create_args *args); +int isis_instance_flex_algo_affinity_mapping_destroy( + struct nb_cb_destroy_args *args); +int isis_instance_flex_algo_affinity_mapping_value_modify( + struct nb_cb_modify_args *args); +int isis_instance_flex_algo_affinity_mapping_value_destroy( + struct nb_cb_destroy_args *args); int isis_instance_mpls_ldp_sync_destroy(struct nb_cb_destroy_args *args); int isis_instance_mpls_ldp_sync_create(struct nb_cb_create_args *args); int isis_instance_mpls_ldp_sync_holddown_modify(struct nb_cb_modify_args *args); @@ -511,6 +558,12 @@ void cli_show_isis_purge_origin(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); void cli_show_isis_mpls_te(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); +void cli_show_isis_admin_group_send_zero(struct vty *vty, + const struct lyd_node *dnode, + bool show_defaults); +void cli_show_isis_asla_legacy_flag(struct vty *vty, + const struct lyd_node *dnode, + bool show_defaults); void cli_show_isis_mpls_te_router_addr(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); @@ -642,6 +695,9 @@ void cli_show_isis_mpls_if_ldp_sync(struct vty *vty, void cli_show_isis_mpls_if_ldp_sync_holddown(struct vty *vty, const struct lyd_node *dnode, bool show_defaults); +void cli_show_isis_flex_algo(struct vty *vty, const struct lyd_node *dnode, + bool show_defaults); +void cli_show_isis_flex_algo_end(struct vty *vty, const struct lyd_node *dnode); /* Notifications. */ void isis_notif_db_overload(const struct isis_area *area, bool overload); diff --git a/isisd/isis_nb_config.c b/isisd/isis_nb_config.c index 697281a0d..858f0a287 100644 --- a/isisd/isis_nb_config.c +++ b/isisd/isis_nb_config.c @@ -416,6 +416,24 @@ int isis_instance_purge_originator_modify(struct nb_cb_modify_args *args) return NB_OK; } + +/* + * XPath: /frr-isisd:isis/instance/admin-group-send-zero + */ +int isis_instance_admin_group_send_zero_modify(struct nb_cb_modify_args *args) +{ + return NB_OK; +} + + +/* + * XPath: /frr-isisd:isis/instance/asla-legacy-flag + */ +int isis_instance_asla_legacy_flag_modify(struct nb_cb_modify_args *args) +{ + return NB_OK; +} + /* * XPath: /frr-isisd:isis/instance/lsp/mtu */ @@ -2674,6 +2692,170 @@ int isis_instance_segment_routing_algorithm_prefix_sid_n_flag_clear_modify( return NB_OK; } +/* + * XPath: /frr-isisd:isis/instance/flex-algos/flex-algo + */ +int isis_instance_flex_algo_create(struct nb_cb_create_args *args) +{ + return NB_OK; +} + +int isis_instance_flex_algo_destroy(struct nb_cb_destroy_args *args) +{ + return NB_OK; +} + +/* + * XPath: /frr-isisd:isis/instance/flex-algos/flex-algo/advertise-definition + */ +int isis_instance_flex_algo_advertise_definition_modify( + struct nb_cb_modify_args *args) +{ + return NB_OK; +} + +int isis_instance_flex_algo_advertise_definition_destroy( + struct nb_cb_destroy_args *args) +{ + return NB_OK; +} + +/* + * XPath: + * /frr-isisd:isis/instance/flex-algos/flex-algo/affinity-include-anies/affinity-include-any + */ +int isis_instance_flex_algo_affinity_include_any_create( + struct nb_cb_create_args *args) +{ + return NB_OK; +} + +int isis_instance_flex_algo_affinity_include_any_destroy( + struct nb_cb_destroy_args *args) +{ + return NB_OK; +} + +/* + * XPath: + * /frr-isisd:isis/instance/flex-algos/flex-algo/affinity-include-alls/affinity-include-all + */ +int isis_instance_flex_algo_affinity_include_all_create( + struct nb_cb_create_args *args) +{ + return NB_OK; +} + +int isis_instance_flex_algo_affinity_include_all_destroy( + struct nb_cb_destroy_args *args) +{ + return NB_OK; +} + +/* + * XPath: + * /frr-isisd:isis/instance/flex-algos/flex-algo/affinity-exclude-anies/affinity-exclude-any + */ +int isis_instance_flex_algo_affinity_exclude_any_create( + struct nb_cb_create_args *args) +{ + return NB_OK; +} + +int isis_instance_flex_algo_affinity_exclude_any_destroy( + struct nb_cb_destroy_args *args) +{ + /* TODO: implement me. */ + return NB_OK; +} + +/* + * XPath: /frr-isisd:isis/instance/flex-algos/flex-algo/prefix-metric + */ + +int isis_instance_flex_algo_prefix_metric_create(struct nb_cb_create_args *args) +{ + /* TODO: implement me. */ + return NB_OK; +} + +int isis_instance_flex_algo_prefix_metric_destroy( + struct nb_cb_destroy_args *args) +{ + /* TODO: implement me. */ + return NB_OK; +} + +/* + * XPath: /frr-isisd:isis/instance/flex-algos/flex-algo/dplane-sr-mpls + */ + +int isis_instance_flex_algo_dplane_sr_mpls_create( + struct nb_cb_create_args *args) +{ + return NB_OK; +} + +int isis_instance_flex_algo_dplane_sr_mpls_destroy( + struct nb_cb_destroy_args *args) +{ + return NB_OK; +} + +/* + * XPath: /frr-isisd:isis/instance/flex-algos/flex-algo/dplane-srv6 + */ + +int isis_instance_flex_algo_dplane_srv6_create(struct nb_cb_create_args *args) +{ + return NB_OK; +} + +int isis_instance_flex_algo_dplane_srv6_destroy(struct nb_cb_destroy_args *args) +{ + return NB_OK; +} + +/* + * XPath: /frr-isisd:isis/instance/flex-algos/flex-algo/dplane-ip + */ + +int isis_instance_flex_algo_dplane_ip_create(struct nb_cb_create_args *args) +{ + return NB_OK; +} + +int isis_instance_flex_algo_dplane_ip_destroy(struct nb_cb_destroy_args *args) +{ + return NB_OK; +} + +/* + * XPath: /frr-isisd:isis/instance/flex-algos/flex-algo/metric-type + */ + +int isis_instance_flex_algo_metric_type_modify(struct nb_cb_modify_args *args) +{ + + return NB_OK; +} + +/* + * XPath: /frr-isisd:isis/instance/flex-algos/flex-algo/priority + */ + +int isis_instance_flex_algo_priority_modify(struct nb_cb_modify_args *args) +{ + /* TODO: implement me. */ + return NB_OK; +} + +int isis_instance_flex_algo_priority_destroy(struct nb_cb_destroy_args *args) +{ + /* TODO: implement me. */ + return NB_OK; +} + /* * XPath: /frr-isisd:isis/instance/mpls/ldp-sync */ diff --git a/isisd/isisd.c b/isisd/isisd.c index fd6b91b42..088cc3191 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -3771,6 +3771,13 @@ struct cmd_node router_node = { .prompt = "%s(config-router)# ", .config_write = isis_config_write, }; + +struct cmd_node isis_flex_algo_node = { + .name = "isis-flex-algo", + .node = ISIS_FLEX_ALGO_NODE, + .parent_node = ISIS_NODE, + .prompt = "%s(config-router-flex-algo)# ", +}; #endif /* ifdef FABRICD */ void isis_init(void) @@ -3880,6 +3887,10 @@ void isis_init(void) install_element(ROUTER_NODE, &log_adj_changes_cmd); install_element(ROUTER_NODE, &no_log_adj_changes_cmd); #endif /* ifdef FABRICD */ +#ifndef FABRICD + install_node(&isis_flex_algo_node); + install_default(ISIS_FLEX_ALGO_NODE); +#endif /* ifdnef FABRICD */ spf_backoff_cmd_init(); } diff --git a/lib/command.h b/lib/command.h index 8856f9f09..39fbfa661 100644 --- a/lib/command.h +++ b/lib/command.h @@ -129,6 +129,7 @@ enum node_type { LDP_L2VPN_NODE, /* LDP L2VPN node */ LDP_PSEUDOWIRE_NODE, /* LDP Pseudowire node */ ISIS_NODE, /* ISIS protocol mode */ + ISIS_FLEX_ALGO_NODE, /* ISIS Flex Algo mode */ ACCESS_NODE, /* Access list node. */ PREFIX_NODE, /* Prefix list node. */ ACCESS_IPV6_NODE, /* Access list node. */ diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 4d52bd036..04f7ff65e 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1175,6 +1175,13 @@ static struct cmd_node isis_node = { .parent_node = CONFIG_NODE, .prompt = "%s(config-router)# ", }; + +static struct cmd_node isis_flex_algo_node = { + .name = "isis-flex-algo", + .node = ISIS_FLEX_ALGO_NODE, + .parent_node = ISIS_NODE, + .prompt = "%s(config-router-flex-algo)# ", +}; #endif /* HAVE_ISISD */ #ifdef HAVE_FABRICD @@ -2095,6 +2102,14 @@ DEFUNSH(VTYSH_ISISD, router_isis, router_isis_cmd, vty->node = ISIS_NODE; return CMD_SUCCESS; } + +DEFUNSH(VTYSH_ISISD, isis_flex_algo, isis_flex_algo_cmd, "flex-algo (128-255)", + "Flexible Algorithm\n" + "Flexible Algorithm Number\n") +{ + vty->node = ISIS_FLEX_ALGO_NODE; + return CMD_SUCCESS; +} #endif /* HAVE_ISISD */ #ifdef HAVE_FABRICD @@ -2578,6 +2593,18 @@ DEFUNSH(VTYSH_ISISD, vtysh_quit_isisd, vtysh_quit_isisd_cmd, "quit", { return vtysh_exit_isisd(self, vty, argc, argv); } + +DEFUNSH(VTYSH_ISISD, vtysh_exit_isis_flex_algo, vtysh_exit_isis_flex_algo_cmd, + "exit", "Exit current mode and down to previous mode\n") +{ + return vtysh_exit(vty); +} + +DEFUNSH(VTYSH_ISISD, vtysh_quit_isis_flex_algo, vtysh_quit_isis_flex_algo_cmd, + "quit", "Exit current mode and down to previous mode\n") +{ + return vtysh_exit_isisd(self, vty, argc, argv); +} #endif /* HAVE_ISISD */ #if HAVE_BFDD > 0 @@ -4702,6 +4729,12 @@ void vtysh_init_vty(void) install_element(ISIS_NODE, &vtysh_exit_isisd_cmd); install_element(ISIS_NODE, &vtysh_quit_isisd_cmd); install_element(ISIS_NODE, &vtysh_end_all_cmd); + + install_node(&isis_flex_algo_node); + install_element(ISIS_NODE, &isis_flex_algo_cmd); + install_element(ISIS_FLEX_ALGO_NODE, &vtysh_exit_isis_flex_algo_cmd); + install_element(ISIS_FLEX_ALGO_NODE, &vtysh_quit_isis_flex_algo_cmd); + install_element(ISIS_FLEX_ALGO_NODE, &vtysh_end_all_cmd); #endif /* HAVE_ISISD */ /* fabricd */ diff --git a/yang/frr-isisd.yang b/yang/frr-isisd.yang index 264d5fd3c..ae69d53cc 100644 --- a/yang/frr-isisd.yang +++ b/yang/frr-isisd.yang @@ -1212,6 +1212,20 @@ module frr-isisd { "Advertise prefixes of passive interfaces only"; } + leaf admin-group-send-zero { + type boolean; + default "false"; + description + "Allow sending the default admin-group value of 0x00000000"; + } + + leaf asla-legacy-flag { + type boolean; + default "false"; + description + "Set the legacy flag (aka. L-FLAG) in the ASLA Sub-TLV."; + } + container lsp { description "Configuration of Link-State Packets (LSP) parameters"; @@ -1623,6 +1637,107 @@ module frr-isisd { } } + container flex-algos { + description + "Flex-Algo Table"; + list flex-algo { + key "flex-algo"; + description + "Configuration for an IS-IS Flex-Algo"; + leaf advertise-definition { + type boolean; + description + "If TRUE, Flex-Algo definition is advertised"; + } + container affinity-include-alls { + description + "Set the include-all affinity"; + leaf-list affinity-include-all { + type string; + max-elements "256"; + description + "Array of Attribute Names"; + } + } + container affinity-include-anies { + description + "Set the include-any affinity"; + leaf-list affinity-include-any { + type string; + max-elements "256"; + description + "Array of Attribute Names"; + } + } + container affinity-exclude-anies { + description + "Set the exclude-any affinity"; + leaf-list affinity-exclude-any { + type string; + max-elements "256"; + description + "Array of Attribute Names"; + } + } + leaf prefix-metric { + type empty; + description + "Use Flex-algo Prefix Metric"; + } + leaf metric-type { + default "igp"; + description + "Set the Flex-Algo metric-type"; + type enumeration { + enum "igp" { + value 0; + description + "IGP Metric"; + } + enum "min-uni-link-delay" { + value 1; + description + "RFC 8570 Sec 4.2 Min Unidirectional Link Delay"; + } + enum "te-default" { + value 2; + description + "RFC 5305 Sec 3.7 Traffic Engineering Default Metric"; + } + } + } + leaf priority { + type uint32 { + range "0..255"; + } + description + "Set the Flex-Algo priority"; + } + leaf dplane-sr-mpls { + type empty; + description + "Advertise and participate in the Flex-Algo Segment-Routing MPLS data-plane"; + } + leaf dplane-srv6 { + type empty; + description + "Advertise and participate in the Flex-Algo Segment-Routing SRv6 data-plane"; + } + leaf dplane-ip { + type empty; + description + "Advertise and participate in the Flex-Algo IP data-plane"; + } + leaf flex-algo { + type uint32 { + range "128..255"; + } + description + "Flex-Algo"; + } + } + } + container segment-routing { description "Segment Routing global configuration."; From 72eae2c3cb771b7010f3f07b6c638e9ae078bbdf Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Tue, 13 Sep 2022 14:03:23 +0200 Subject: [PATCH 16/41] lib: add a frr_each_const macro Add a frr_each_const macro equivalent to loop on const lists. Signed-off-by: Louis Scalbert --- lib/typesafe.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/typesafe.h b/lib/typesafe.h index 1e3f93256..3292b6ec8 100644 --- a/lib/typesafe.h +++ b/lib/typesafe.h @@ -20,6 +20,9 @@ extern "C" { #define frr_each(prefix, head, item) \ for (item = prefix##_first(head); item; \ item = prefix##_next(head, item)) +#define frr_each_const(prefix, head, item) \ + for (item = prefix##_const_first(head); item; \ + item = prefix##_const_next(head, item)) #define frr_each_safe(prefix, head, item) \ for (typeof(prefix##_next_safe(head, NULL)) prefix##_safe = \ prefix##_next_safe(head, \ From 7f198e063c77f1be8273d0449ddf1d1caa21f368 Mon Sep 17 00:00:00 2001 From: Hiroki Shirokura Date: Sun, 12 Dec 2021 09:43:37 +0000 Subject: [PATCH 17/41] isisd: add isis flex-algo base interface Adds basic functionality to Flex-Algo for IS-IS wrapping lib/flex_algo. The configuration interface will be added in the next commit. Signed-off-by: Hiroki Shirokura Signed-off-by: Eric Kinzie Signed-off-by: Louis Scalbert --- isisd/isis_flex_algo.c | 240 +++++++++++++++++++++++++++++++++++++++++ isisd/isis_flex_algo.h | 51 +++++++++ isisd/isis_tlvs.h | 15 +++ isisd/isisd.c | 8 ++ isisd/isisd.h | 4 + isisd/subdir.am | 2 + 6 files changed, 320 insertions(+) create mode 100644 isisd/isis_flex_algo.c create mode 100644 isisd/isis_flex_algo.h diff --git a/isisd/isis_flex_algo.c b/isisd/isis_flex_algo.c new file mode 100644 index 000000000..94ad53b22 --- /dev/null +++ b/isisd/isis_flex_algo.c @@ -0,0 +1,240 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/********************************************************************* + * Copyright 2022 Hiroki Shirokura, LINE Corporation + * Copyright 2022 Masakazu Asama + * Copyright 2022 6WIND S.A. + * + * isis_flex_algo.c: IS-IS Flexible Algorithm + * + * Authors + * ------- + * Hiroki Shirokura + * Masakazu Asama + * Louis Scalbert + */ + +#include + +#include "memory.h" +#include "stream.h" +#include "sbuf.h" +#include "network.h" +#include "command.h" +#include "bitfield.h" + +#include "isisd/isisd.h" +#include "isisd/isis_tlvs.h" +#include "isisd/isis_common.h" +#include "isisd/isis_mt.h" +#include "isisd/isis_misc.h" +#include "isisd/isis_adjacency.h" +#include "isisd/isis_circuit.h" +#include "isisd/isis_pdu.h" +#include "isisd/isis_lsp.h" +#include "isisd/isis_spf.h" +#include "isisd/isis_te.h" +#include "isisd/isis_sr.h" +#include "isisd/isis_spf_private.h" +#include "isisd/isis_flex_algo.h" + +#ifndef FABRICD +DEFINE_MTYPE_STATIC(ISISD, FLEX_ALGO, "ISIS Flex Algo"); + +void *isis_flex_algo_data_alloc(void *voidarg) +{ + struct isis_flex_algo_alloc_arg *arg = voidarg; + struct isis_flex_algo_data *data; + + data = XCALLOC(MTYPE_FLEX_ALGO, sizeof(*data)); + + for (int tree = SPFTREE_IPV4; tree < SPFTREE_COUNT; tree++) { + for (int level = ISIS_LEVEL1; level <= ISIS_LEVEL2; level++) { + if (!(arg->area->is_type & level)) + continue; + data->spftree[tree][level - 1] = isis_spftree_new( + arg->area, &arg->area->lspdb[level - 1], + arg->area->isis->sysid, level, tree, + SPF_TYPE_FORWARD, 0, arg->algorithm); + } + } + + return data; +} + +void isis_flex_algo_data_free(void *voiddata) +{ + struct isis_flex_algo_data *data = voiddata; + + for (int tree = SPFTREE_IPV4; tree < SPFTREE_COUNT; tree++) + for (int level = ISIS_LEVEL1; level <= ISIS_LEVEL2; level++) + if (data->spftree[tree][level - 1]) + isis_spftree_del( + data->spftree[tree][level - 1]); +} + +static struct isis_router_cap_fad * +isis_flex_algo_definition_cmp(struct isis_router_cap_fad *elected, + struct isis_router_cap_fad *fa) +{ + if (!elected || fa->fad.priority > elected->fad.priority || + (fa->fad.priority == elected->fad.priority && + lsp_id_cmp(fa->sysid, elected->sysid) > 0)) + return fa; + + return elected; +} + +/** + * @brief Look up the flex-algo definition with the highest priority in the LSP + * Database (LSDB). If the value of priority is the same, the flex-algo + * definition with the highest sysid will be selected. + * @param algorithm flex-algo algorithm number + * @param area pointer + * @param local router capability Flex-Algo Definition (FAD) double pointer. + * - fad is NULL: use the local router capability FAD from LSDB for the + * election. + * - fad is not NULL and *fad is NULL: use no local router capability FAD for + * the election. + * - fad and *fad are not NULL: uses the *fad local definition instead of the + * local definition from LSDB for the election. + * @return elected flex-algo-definition object if exist, else NULL + */ +static struct isis_router_cap_fad * +_isis_flex_algo_elected(int algorithm, const struct isis_area *area, + struct isis_router_cap_fad **fad) +{ + struct flex_algo *flex_ago; + const struct isis_lsp *lsp; + struct isis_router_cap_fad *fa, *elected = NULL; + + if (!flex_algo_id_valid(algorithm)) + return NULL; + + /* No elected FAD if the algorithm is not locally configured */ + flex_ago = flex_algo_lookup(area->flex_algos, algorithm); + if (!flex_ago) + return NULL; + + /* No elected FAD if no data-plane is enabled + * Currently, only Segment-Routing MPLS is supported. + * Segment-Routing SRv6 and IP will be configured in the future. + */ + if (!CHECK_FLAG(flex_ago->dataplanes, FLEX_ALGO_SR_MPLS)) + return NULL; + + /* + * Perform FAD comparison. First, compare the priority, and if they are + * the same, compare the sys-id. + */ + /* clang-format off */ + frr_each_const(lspdb, &area->lspdb[ISIS_LEVEL1 - 1], lsp) { + /* clang-format on */ + + if (!lsp->tlvs || !lsp->tlvs->router_cap) + continue; + + if (lsp->own_lsp && fad) + continue; + + fa = lsp->tlvs->router_cap->fads[algorithm]; + + if (!fa) + continue; + + assert(algorithm == fa->fad.algorithm); + + memcpy(fa->sysid, lsp->hdr.lsp_id, ISIS_SYS_ID_LEN + 2); + + elected = isis_flex_algo_definition_cmp(elected, fa); + } + + if (fad && *fad) + elected = isis_flex_algo_definition_cmp(elected, *fad); + + return elected; +} + +struct isis_router_cap_fad *isis_flex_algo_elected(int algorithm, + const struct isis_area *area) +{ + return _isis_flex_algo_elected(algorithm, area, NULL); +} + +/** + * @brief Check the Flex-Algo Definition is supported by the current FRR version + * @param flex-algo + * @return true if supported else false + */ +bool isis_flex_algo_supported(struct flex_algo *fad) +{ + if (fad->calc_type != CALC_TYPE_SPF) + return false; + if (fad->metric_type != MT_IGP) + return false; + if (fad->flags != 0) + return false; + if (fad->exclude_srlg) + return false; + if (fad->unsupported_subtlv) + return false; + + return true; +} + +/** + * @brief Look for the elected Flex-Algo Definition and check that it is + * supported by the current FRR version + * @param algorithm flex-algo algorithm number + * @param area pointer + * @param local router capability Flex-Algo Definition (FAD) double pointer. + * @return elected flex-algo-definition object if exist and supported, else NULL + */ +static struct isis_router_cap_fad * +_isis_flex_algo_elected_supported(int algorithm, const struct isis_area *area, + struct isis_router_cap_fad **fad) +{ + struct isis_router_cap_fad *elected_fad; + + elected_fad = _isis_flex_algo_elected(algorithm, area, fad); + if (!elected_fad) + return NULL; + + if (isis_flex_algo_supported(&elected_fad->fad)) + return elected_fad; + + return NULL; +} + +struct isis_router_cap_fad * +isis_flex_algo_elected_supported(int algorithm, const struct isis_area *area) +{ + return _isis_flex_algo_elected_supported(algorithm, area, NULL); +} + +struct isis_router_cap_fad * +isis_flex_algo_elected_supported_local_fad(int algorithm, + const struct isis_area *area, + struct isis_router_cap_fad **fad) +{ + return _isis_flex_algo_elected_supported(algorithm, area, fad); +} + +/** + * Check LSP is participating specified SR Algorithm + * + * @param lsp IS-IS lsp + * @param algorithm SR Algorithm + * @return Return true if sr-algorithm tlv includes specified + * algorithm in router capability tlv + */ +bool sr_algorithm_participated(const struct isis_lsp *lsp, uint8_t algorithm) +{ + if (!lsp || !lsp->tlvs || !lsp->tlvs->router_cap) + return false; + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) + if (lsp->tlvs->router_cap->algo[i] == algorithm) + return true; + return false; +} + +#endif /* ifndef FABRICD */ diff --git a/isisd/isis_flex_algo.h b/isisd/isis_flex_algo.h new file mode 100644 index 000000000..0a0e337e0 --- /dev/null +++ b/isisd/isis_flex_algo.h @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/********************************************************************* + * Copyright 2022 Hiroki Shirokura, LINE Corporation + * Copyright 2022 Masakazu Asama + * Copyright 2022 6WIND S.A. + * + * isis_flex_algo.h: IS-IS Flexible Algorithm + * + * Authors + * ------- + * Hiroki Shirokura + * Masakazu Asama + * Louis Scalbert + */ + +#ifndef ISIS_FLEX_ALGO_H +#define ISIS_FLEX_ALGO_H + +#include "flex_algo.h" +#include "isisd/isis_constants.h" + +#ifndef FABRICD + +struct isis_flex_algo_data { + struct isis_spftree *spftree[SPFTREE_COUNT][ISIS_LEVELS]; + struct isis_area *area; +}; + +struct isis_flex_algo_alloc_arg { + uint8_t algorithm; + struct isis_area *area; +}; + +void *isis_flex_algo_data_alloc(void *arg); +void isis_flex_algo_data_free(void *data); + +struct isis_router_cap_fad * +isis_flex_algo_elected(int algorithm, const struct isis_area *area); +bool isis_flex_algo_supported(struct flex_algo *fad); +struct isis_router_cap_fad * +isis_flex_algo_elected_supported(int algorithm, const struct isis_area *area); +struct isis_router_cap_fad * +isis_flex_algo_elected_supported_local_fad(int algorithm, + const struct isis_area *area, + struct isis_router_cap_fad **fad); +struct isis_lsp; +bool sr_algorithm_participated(const struct isis_lsp *lsp, uint8_t algorithm); + +#endif /* ifndef FABRICD */ + +#endif /* ISIS_FLEX_ALGO_H */ diff --git a/isisd/isis_tlvs.h b/isisd/isis_tlvs.h index 516d4b879..d5c96d7ab 100644 --- a/isisd/isis_tlvs.h +++ b/isisd/isis_tlvs.h @@ -12,6 +12,7 @@ #include "segment_routing.h" #include "openbsd-tree.h" #include "prefix.h" +#include "flex_algo.h" DECLARE_MTYPE(ISIS_SUBTLV); @@ -181,6 +182,15 @@ struct isis_lan_adj_sid { #define MSD_TYPE_BASE_MPLS_IMPOSITION 0x01 #define MSD_TLV_SIZE 2 +#ifndef FABRICD +struct isis_router_cap_fad; +struct isis_router_cap_fad { + uint8_t sysid[ISIS_SYS_ID_LEN + 2]; + + struct flex_algo fad; +}; +#endif /* ifndef FABRICD */ + struct isis_router_cap { struct in_addr router_id; uint8_t flags; @@ -191,6 +201,11 @@ struct isis_router_cap { uint8_t algo[SR_ALGORITHM_COUNT]; /* RFC 8491 */ uint8_t msd; + +#ifndef FABRICD + /* RFC9350 Flex-Algorithm */ + struct isis_router_cap_fad *fads[SR_ALGORITHM_COUNT]; +#endif /* ifndef FABRICD */ }; struct isis_item { diff --git a/isisd/isisd.c b/isisd/isisd.c index 088cc3191..6c4cdfb95 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -27,6 +27,7 @@ #include "zclient.h" #include "vrf.h" #include "spf_backoff.h" +#include "flex_algo.h" #include "lib/northbound_cli.h" #include "bfd.h" @@ -49,6 +50,7 @@ #include "isisd/isis_te.h" #include "isisd/isis_mt.h" #include "isisd/isis_sr.h" +#include "isisd/isis_flex_algo.h" #include "isisd/fabricd.h" #include "isisd/isis_nb.h" @@ -317,6 +319,12 @@ struct isis_area *isis_area_create(const char *area_tag, const char *vrf_name) if (area->is_type & IS_LEVEL_2) lsp_db_init(&area->lspdb[1]); +#ifndef FABRICD + /* Flex-Algo */ + area->flex_algos = flex_algos_alloc(isis_flex_algo_data_alloc, + isis_flex_algo_data_free); +#endif /* ifndef FABRICD */ + spftree_area_init(area); area->circuit_list = list_new(); diff --git a/isisd/isisd.h b/isisd/isisd.h index 12d9cd36c..350d2c8d7 100644 --- a/isisd/isisd.h +++ b/isisd/isisd.h @@ -220,6 +220,10 @@ struct isis_area { size_t tilfa_protected_links[ISIS_LEVELS]; /* MPLS LDP-IGP Sync */ struct ldp_sync_info_cmd ldp_sync_cmd; +#ifndef FABRICD + /* Flex-Algo */ + struct flex_algos *flex_algos; +#endif /* ifndef FABRICD */ /* Counters */ uint32_t circuit_state_changes; struct isis_redist redist_settings[REDIST_PROTOCOL_COUNT] diff --git a/isisd/subdir.am b/isisd/subdir.am index dabf6a925..49e252c85 100644 --- a/isisd/subdir.am +++ b/isisd/subdir.am @@ -45,6 +45,7 @@ noinst_HEADERS += \ isisd/isis_spf.h \ isisd/isis_spf_private.h \ isisd/isis_sr.h \ + isisd/isis_flex_algo.h \ isisd/isis_te.h \ isisd/isis_tlvs.h \ isisd/isis_tx_queue.h \ @@ -76,6 +77,7 @@ LIBISIS_SOURCES = \ isisd/isis_routemap.c \ isisd/isis_spf.c \ isisd/isis_sr.c \ + isisd/isis_flex_algo.c \ isisd/isis_te.c \ isisd/isis_tlvs.c \ isisd/isis_tx_queue.c \ From 893882ee20473fc5356ec40bbc6438d652a11167 Mon Sep 17 00:00:00 2001 From: Hiroki Shirokura Date: Sat, 18 Dec 2021 08:23:16 +0000 Subject: [PATCH 18/41] isisd: add isis flex-algo configuration backend Add the backend functions for the flex-algo configuration. Signed-off-by: Hiroki Shirokura Signed-off-by: Eric Kinzie Signed-off-by: Louis Scalbert --- isisd/isis_nb_config.c | 546 +++++++++++++++++++++++++++++++++++++++-- isisd/isisd.h | 4 + 2 files changed, 532 insertions(+), 18 deletions(-) diff --git a/isisd/isis_nb_config.c b/isisd/isis_nb_config.c index 858f0a287..8a111b301 100644 --- a/isisd/isis_nb_config.c +++ b/isisd/isis_nb_config.c @@ -21,6 +21,7 @@ #include "vrf.h" #include "ldp_sync.h" #include "link_state.h" +#include "affinitymap.h" #include "isisd/isisd.h" #include "isisd/isis_nb.h" @@ -39,8 +40,14 @@ #include "isisd/isis_redist.h" #include "isisd/isis_ldp_sync.h" #include "isisd/isis_dr.h" +#include "isisd/isis_sr.h" +#include "isisd/isis_flex_algo.h" #include "isisd/isis_zebra.h" +#define AFFINITY_INCLUDE_ANY 0 +#define AFFINITY_INCLUDE_ALL 1 +#define AFFINITY_EXCLUDE_ANY 2 + /* * XPath: /frr-isisd:isis/instance */ @@ -422,6 +429,44 @@ int isis_instance_purge_originator_modify(struct nb_cb_modify_args *args) */ int isis_instance_admin_group_send_zero_modify(struct nb_cb_modify_args *args) { + struct isis_circuit *circuit; + struct isis_area *area; + struct listnode *node; + struct flex_algo *fa; + + if (args->event != NB_EV_APPLY) + return NB_OK; + + area = nb_running_get_entry(args->dnode, NULL, true); + area->admin_group_send_zero = yang_dnode_get_bool(args->dnode, NULL); + + if (area->admin_group_send_zero) { + for (ALL_LIST_ELEMENTS_RO(area->flex_algos->flex_algos, node, + fa)) { + admin_group_allow_explicit_zero( + &fa->admin_group_exclude_any); + admin_group_allow_explicit_zero( + &fa->admin_group_include_any); + admin_group_allow_explicit_zero( + &fa->admin_group_include_all); + } + } else { + for (ALL_LIST_ELEMENTS_RO(area->flex_algos->flex_algos, node, + fa)) { + admin_group_disallow_explicit_zero( + &fa->admin_group_exclude_any); + admin_group_disallow_explicit_zero( + &fa->admin_group_include_any); + admin_group_disallow_explicit_zero( + &fa->admin_group_include_all); + } + } + + for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit)) + isis_link_params_update(circuit, circuit->interface); + + lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 0); + return NB_OK; } @@ -431,6 +476,15 @@ int isis_instance_admin_group_send_zero_modify(struct nb_cb_modify_args *args) */ int isis_instance_asla_legacy_flag_modify(struct nb_cb_modify_args *args) { + struct isis_area *area; + + if (args->event != NB_EV_APPLY) + return NB_OK; + + area = nb_running_get_entry(args->dnode, NULL, true); + area->asla_legacy_flag = yang_dnode_get_bool(args->dnode, NULL); + lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 0); + return NB_OK; } @@ -2697,11 +2751,62 @@ int isis_instance_segment_routing_algorithm_prefix_sid_n_flag_clear_modify( */ int isis_instance_flex_algo_create(struct nb_cb_create_args *args) { + struct isis_area *area; + struct flex_algo *fa; + bool advertise; + uint32_t algorithm; + uint32_t priority = FLEX_ALGO_PRIO_DEFAULT; + struct isis_flex_algo_alloc_arg arg; + + algorithm = yang_dnode_get_uint32(args->dnode, "./flex-algo"); + advertise = yang_dnode_exists(args->dnode, "./advertise-definition"); + + switch (args->event) { + case NB_EV_APPLY: + area = nb_running_get_entry(args->dnode, NULL, true); + arg.algorithm = algorithm; + arg.area = area; + fa = flex_algo_alloc(area->flex_algos, algorithm, &arg); + fa->priority = priority; + fa->advertise_definition = advertise; + if (area->admin_group_send_zero) { + admin_group_allow_explicit_zero( + &fa->admin_group_exclude_any); + admin_group_allow_explicit_zero( + &fa->admin_group_include_any); + admin_group_allow_explicit_zero( + &fa->admin_group_include_all); + } + lsp_regenerate_schedule(area, area->is_type, 0); + break; + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + } + return NB_OK; } int isis_instance_flex_algo_destroy(struct nb_cb_destroy_args *args) { + struct isis_area *area; + uint32_t algorithm; + + algorithm = yang_dnode_get_uint32(args->dnode, "./flex-algo"); + area = nb_running_get_entry(args->dnode, NULL, true); + + switch (args->event) { + case NB_EV_APPLY: + flex_algo_delete(area->flex_algos, algorithm); + lsp_regenerate_schedule(area, area->is_type, 0); + break; + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + } + return NB_OK; } @@ -2711,12 +2816,191 @@ int isis_instance_flex_algo_destroy(struct nb_cb_destroy_args *args) int isis_instance_flex_algo_advertise_definition_modify( struct nb_cb_modify_args *args) { + struct isis_area *area; + struct flex_algo *fa; + bool advertise; + uint32_t algorithm; + + + algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo"); + advertise = yang_dnode_exists(args->dnode, "./../advertise-definition"); + + switch (args->event) { + case NB_EV_APPLY: + area = nb_running_get_entry(args->dnode, NULL, true); + fa = flex_algo_lookup(area->flex_algos, algorithm); + if (!fa) { + snprintf(args->errmsg, args->errmsg_len, + "flex-algo object not found"); + return NB_ERR_RESOURCE; + } + fa->advertise_definition = advertise; + lsp_regenerate_schedule(area, area->is_type, 0); + break; + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + } + return NB_OK; } int isis_instance_flex_algo_advertise_definition_destroy( struct nb_cb_destroy_args *args) { + struct isis_area *area; + struct flex_algo *fa; + uint32_t algorithm; + + area = nb_running_get_entry(args->dnode, NULL, true); + + algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo"); + + switch (args->event) { + case NB_EV_APPLY: + fa = flex_algo_lookup(area->flex_algos, algorithm); + if (!fa) { + snprintf(args->errmsg, args->errmsg_len, + "flex-algo object not found"); + return NB_ERR_RESOURCE; + } + fa->advertise_definition = false; + lsp_regenerate_schedule(area, area->is_type, 0); + break; + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + } + + return NB_OK; +} + +static int isis_instance_flex_algo_affinity_set(struct nb_cb_create_args *args, + int type) +{ + struct affinity_map *map; + struct isis_area *area; + struct admin_group *ag; + struct flex_algo *fa; + uint32_t algorithm; + const char *val; + + algorithm = yang_dnode_get_uint32(args->dnode, "../../flex-algo"); + area = nb_running_get_entry(args->dnode, NULL, true); + val = yang_dnode_get_string(args->dnode, "."); + + switch (args->event) { + case NB_EV_VALIDATE: + fa = flex_algo_lookup(area->flex_algos, algorithm); + if (!fa) { + snprintf(args->errmsg, args->errmsg_len, + "flex-algo object not found"); + return NB_ERR_RESOURCE; + } + map = affinity_map_get(val); + if (!map) { + snprintf(args->errmsg, args->errmsg_len, + "affinity map %s isn't found", val); + return NB_ERR_VALIDATION; + } + break; + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + fa = flex_algo_lookup(area->flex_algos, algorithm); + if (!fa) { + snprintf(args->errmsg, args->errmsg_len, + "flex-algo object not found"); + return NB_ERR_RESOURCE; + } + map = affinity_map_get(val); + if (!map) { + snprintf(args->errmsg, args->errmsg_len, + "affinity map %s isn't found", val); + return NB_ERR_RESOURCE; + } + if (type == AFFINITY_INCLUDE_ANY) + ag = &fa->admin_group_include_any; + else if (type == AFFINITY_INCLUDE_ALL) + ag = &fa->admin_group_include_all; + else if (type == AFFINITY_EXCLUDE_ANY) + ag = &fa->admin_group_exclude_any; + else + break; + + admin_group_set(ag, map->bit_position); + lsp_regenerate_schedule(area, area->is_type, 0); + break; + } + + return NB_OK; +} + +static int +isis_instance_flex_algo_affinity_unset(struct nb_cb_destroy_args *args, + int type) +{ + struct affinity_map *map; + struct isis_area *area; + struct admin_group *ag; + struct flex_algo *fa; + uint32_t algorithm; + const char *val; + + algorithm = yang_dnode_get_uint32(args->dnode, "../../flex-algo"); + area = nb_running_get_entry(args->dnode, NULL, true); + val = yang_dnode_get_string(args->dnode, "."); + + switch (args->event) { + case NB_EV_VALIDATE: + fa = flex_algo_lookup(area->flex_algos, algorithm); + if (!fa) { + snprintf(args->errmsg, args->errmsg_len, + "flex-algo object not found"); + return NB_ERR_RESOURCE; + } + map = affinity_map_get(val); + if (!map) { + snprintf(args->errmsg, args->errmsg_len, + "affinity map %s isn't found", val); + return NB_ERR_VALIDATION; + } + break; + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + fa = flex_algo_lookup(area->flex_algos, algorithm); + if (!fa) { + snprintf(args->errmsg, args->errmsg_len, + "flex-algo object not found"); + return NB_ERR_RESOURCE; + } + map = affinity_map_get(val); + if (!map) { + snprintf(args->errmsg, args->errmsg_len, + "affinity map %s isn't found", val); + return NB_ERR_RESOURCE; + } + if (type == AFFINITY_INCLUDE_ANY) + ag = &fa->admin_group_include_any; + else if (type == AFFINITY_INCLUDE_ALL) + ag = &fa->admin_group_include_all; + else if (type == AFFINITY_EXCLUDE_ANY) + ag = &fa->admin_group_exclude_any; + else + break; + + admin_group_unset(ag, map->bit_position); + if (area->admin_group_send_zero) + admin_group_allow_explicit_zero(ag); + lsp_regenerate_schedule(area, area->is_type, 0); + break; + } + return NB_OK; } @@ -2727,13 +3011,14 @@ int isis_instance_flex_algo_advertise_definition_destroy( int isis_instance_flex_algo_affinity_include_any_create( struct nb_cb_create_args *args) { - return NB_OK; + return isis_instance_flex_algo_affinity_set(args, AFFINITY_INCLUDE_ANY); } int isis_instance_flex_algo_affinity_include_any_destroy( struct nb_cb_destroy_args *args) { - return NB_OK; + return isis_instance_flex_algo_affinity_unset(args, + AFFINITY_INCLUDE_ANY); } /* @@ -2743,13 +3028,14 @@ int isis_instance_flex_algo_affinity_include_any_destroy( int isis_instance_flex_algo_affinity_include_all_create( struct nb_cb_create_args *args) { - return NB_OK; + return isis_instance_flex_algo_affinity_set(args, AFFINITY_INCLUDE_ALL); } int isis_instance_flex_algo_affinity_include_all_destroy( struct nb_cb_destroy_args *args) { - return NB_OK; + return isis_instance_flex_algo_affinity_unset(args, + AFFINITY_INCLUDE_ALL); } /* @@ -2759,14 +3045,14 @@ int isis_instance_flex_algo_affinity_include_all_destroy( int isis_instance_flex_algo_affinity_exclude_any_create( struct nb_cb_create_args *args) { - return NB_OK; + return isis_instance_flex_algo_affinity_set(args, AFFINITY_EXCLUDE_ANY); } int isis_instance_flex_algo_affinity_exclude_any_destroy( struct nb_cb_destroy_args *args) { - /* TODO: implement me. */ - return NB_OK; + return isis_instance_flex_algo_affinity_unset(args, + AFFINITY_EXCLUDE_ANY); } /* @@ -2775,14 +3061,147 @@ int isis_instance_flex_algo_affinity_exclude_any_destroy( int isis_instance_flex_algo_prefix_metric_create(struct nb_cb_create_args *args) { - /* TODO: implement me. */ + struct isis_area *area; + const char *area_tag; + struct flex_algo *fa; + uint32_t algorithm; + + area_tag = yang_dnode_get_string(args->dnode, "../../../area-tag"); + area = isis_area_lookup(area_tag, VRF_DEFAULT); + if (!area) + return NB_ERR_RESOURCE; + + algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo"); + + switch (args->event) { + case NB_EV_APPLY: + fa = flex_algo_lookup(area->flex_algos, algorithm); + if (!fa) { + snprintf(args->errmsg, args->errmsg_len, + "flex-algo object not found"); + return NB_ERR_RESOURCE; + } + SET_FLAG(fa->flags, FAD_FLAG_M); + lsp_regenerate_schedule(area, area->is_type, 0); + break; + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + } + return NB_OK; } int isis_instance_flex_algo_prefix_metric_destroy( struct nb_cb_destroy_args *args) { - /* TODO: implement me. */ + struct isis_area *area; + const char *area_tag; + struct flex_algo *fa; + uint32_t algorithm; + + area_tag = yang_dnode_get_string(args->dnode, "../../../area-tag"); + area = isis_area_lookup(area_tag, VRF_DEFAULT); + if (!area) + return NB_ERR_RESOURCE; + + algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo"); + + switch (args->event) { + case NB_EV_APPLY: + fa = flex_algo_lookup(area->flex_algos, algorithm); + if (!fa) { + snprintf(args->errmsg, args->errmsg_len, + "flex-algo object not found"); + return NB_ERR_RESOURCE; + } + UNSET_FLAG(fa->flags, FAD_FLAG_M); + lsp_regenerate_schedule(area, area->is_type, 0); + break; + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + } + + return NB_OK; +} + +static int isis_instance_flex_algo_dplane_set(struct nb_cb_create_args *args, + int type) +{ + struct isis_area *area; + const char *area_tag; + struct flex_algo *fa; + uint32_t algorithm; + + area_tag = yang_dnode_get_string(args->dnode, "../../../area-tag"); + area = isis_area_lookup(area_tag, VRF_DEFAULT); + if (!area) + return NB_ERR_RESOURCE; + + algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo"); + + switch (args->event) { + case NB_EV_APPLY: + fa = flex_algo_lookup(area->flex_algos, algorithm); + if (!fa) { + snprintf(args->errmsg, args->errmsg_len, + "flex-algo object not found"); + return NB_ERR_RESOURCE; + } + SET_FLAG(fa->dataplanes, type); + lsp_regenerate_schedule(area, area->is_type, 0); + break; + case NB_EV_VALIDATE: + if (type == FLEX_ALGO_SRV6 || type == FLEX_ALGO_IP) { + snprintf(args->errmsg, args->errmsg_len, + "%s Flex-algo dataplane is not yet supported.", + type == FLEX_ALGO_SRV6 ? "SRv6" : "IP"); + return NB_ERR_VALIDATION; + } + break; + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + } + + return NB_OK; +} + +static int isis_instance_flex_algo_dplane_unset(struct nb_cb_destroy_args *args, + int type) +{ + struct isis_area *area; + const char *area_tag; + struct flex_algo *fa; + uint32_t algorithm; + + area_tag = yang_dnode_get_string(args->dnode, "../../../area-tag"); + area = isis_area_lookup(area_tag, VRF_DEFAULT); + if (!area) + return NB_ERR_RESOURCE; + + algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo"); + + switch (args->event) { + case NB_EV_APPLY: + fa = flex_algo_lookup(area->flex_algos, algorithm); + if (!fa) { + snprintf(args->errmsg, args->errmsg_len, + "flex-algo object not found"); + return NB_ERR_RESOURCE; + } + UNSET_FLAG(fa->dataplanes, type); + lsp_regenerate_schedule(area, area->is_type, 0); + break; + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + } + return NB_OK; } @@ -2793,13 +3212,13 @@ int isis_instance_flex_algo_prefix_metric_destroy( int isis_instance_flex_algo_dplane_sr_mpls_create( struct nb_cb_create_args *args) { - return NB_OK; + return isis_instance_flex_algo_dplane_set(args, FLEX_ALGO_SR_MPLS); } int isis_instance_flex_algo_dplane_sr_mpls_destroy( struct nb_cb_destroy_args *args) { - return NB_OK; + return isis_instance_flex_algo_dplane_unset(args, FLEX_ALGO_SR_MPLS); } /* @@ -2808,12 +3227,12 @@ int isis_instance_flex_algo_dplane_sr_mpls_destroy( int isis_instance_flex_algo_dplane_srv6_create(struct nb_cb_create_args *args) { - return NB_OK; + return isis_instance_flex_algo_dplane_set(args, FLEX_ALGO_SRV6); } int isis_instance_flex_algo_dplane_srv6_destroy(struct nb_cb_destroy_args *args) { - return NB_OK; + return isis_instance_flex_algo_dplane_unset(args, FLEX_ALGO_SRV6); } /* @@ -2822,12 +3241,12 @@ int isis_instance_flex_algo_dplane_srv6_destroy(struct nb_cb_destroy_args *args) int isis_instance_flex_algo_dplane_ip_create(struct nb_cb_create_args *args) { - return NB_OK; + return isis_instance_flex_algo_dplane_set(args, FLEX_ALGO_IP); } int isis_instance_flex_algo_dplane_ip_destroy(struct nb_cb_destroy_args *args) { - return NB_OK; + return isis_instance_flex_algo_dplane_unset(args, FLEX_ALGO_IP); } /* @@ -2836,6 +3255,36 @@ int isis_instance_flex_algo_dplane_ip_destroy(struct nb_cb_destroy_args *args) int isis_instance_flex_algo_metric_type_modify(struct nb_cb_modify_args *args) { + struct isis_area *area; + const char *area_tag; + struct flex_algo *fa; + uint32_t algorithm; + enum flex_algo_metric_type metric_type; + + area_tag = yang_dnode_get_string(args->dnode, "../../../area-tag"); + area = isis_area_lookup(area_tag, VRF_DEFAULT); + if (!area) + return NB_ERR_RESOURCE; + + algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo"); + metric_type = yang_dnode_get_enum(args->dnode, NULL); + + switch (args->event) { + case NB_EV_APPLY: + fa = flex_algo_lookup(area->flex_algos, algorithm); + if (!fa) { + snprintf(args->errmsg, args->errmsg_len, + "flex-algo object not found"); + return NB_ERR_RESOURCE; + } + fa->metric_type = metric_type; + lsp_regenerate_schedule(area, area->is_type, 0); + break; + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + } return NB_OK; } @@ -2846,13 +3295,73 @@ int isis_instance_flex_algo_metric_type_modify(struct nb_cb_modify_args *args) int isis_instance_flex_algo_priority_modify(struct nb_cb_modify_args *args) { - /* TODO: implement me. */ + struct isis_area *area; + const char *area_tag; + struct flex_algo *fa; + uint32_t algorithm; + uint32_t priority; + + area_tag = yang_dnode_get_string(args->dnode, "../../../area-tag"); + area = isis_area_lookup(area_tag, VRF_DEFAULT); + if (!area) + return NB_ERR_RESOURCE; + + algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo"); + priority = yang_dnode_get_uint32(args->dnode, NULL); + + switch (args->event) { + case NB_EV_APPLY: + fa = flex_algo_lookup(area->flex_algos, algorithm); + if (!fa) { + snprintf(args->errmsg, args->errmsg_len, + "flex-algo object not found"); + return NB_ERR_RESOURCE; + } + fa->priority = priority; + lsp_regenerate_schedule(area, area->is_type, 0); + break; + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + } + return NB_OK; } int isis_instance_flex_algo_priority_destroy(struct nb_cb_destroy_args *args) { - /* TODO: implement me. */ + struct isis_area *area; + const char *area_tag; + struct flex_algo *fa; + uint32_t algorithm; + uint32_t priority = FLEX_ALGO_PRIO_DEFAULT; + + area_tag = yang_dnode_get_string(args->dnode, "../../../area-tag"); + area = isis_area_lookup(area_tag, VRF_DEFAULT); + if (!area) + return NB_ERR_RESOURCE; + + algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo"); + priority = yang_dnode_get_uint32(args->dnode, NULL); + + switch (args->event) { + case NB_EV_APPLY: + fa = flex_algo_lookup(area->flex_algos, algorithm); + if (!fa) { + snprintf(args->errmsg, args->errmsg_len, + "flex-algo object not found"); + return NB_ERR_RESOURCE; + } + fa->priority = priority; + lsp_regenerate_schedule(area, area->is_type, 0); + break; + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + } + return NB_OK; } @@ -2978,7 +3487,8 @@ int lib_interface_isis_area_tag_modify(struct nb_cb_modify_args *args) struct isis_circuit *circuit; if (args->event == NB_EV_VALIDATE) { - circuit = nb_running_get_entry_non_rec(lyd_parent(args->dnode), NULL, false); + circuit = nb_running_get_entry_non_rec(lyd_parent(args->dnode), + NULL, false); if (circuit) { snprintf(args->errmsg, args->errmsg_len, "Changing area tag is not allowed"); diff --git a/isisd/isisd.h b/isisd/isisd.h index 350d2c8d7..f0d236b64 100644 --- a/isisd/isisd.h +++ b/isisd/isisd.h @@ -163,6 +163,10 @@ struct isis_area { /* do we support new style metrics? */ char newmetric; char oldmetric; + /* Allow sending the default admin-group value of 0x00000000. */ + bool admin_group_send_zero; + /* Set the legacy flag (aka. L-FLAG) in the ASLA Sub-TLV */ + bool asla_legacy_flag; /* identifies the routing instance */ char *area_tag; /* area addresses for this area */ From f46e34f838e626c126277d5c02a8f9da0c1580ea Mon Sep 17 00:00:00 2001 From: Hiroki Shirokura Date: Sat, 18 Dec 2021 08:54:52 +0000 Subject: [PATCH 19/41] isisd: add isis flex-algo configuration frontend Add the frontend functions for the flex-algo configuration. Signed-off-by: Hiroki Shirokura Signed-off-by: Eric Kinzie Signed-off-by: Louis Scalbert --- isisd/isis_cli.c | 199 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 190 insertions(+), 9 deletions(-) diff --git a/isisd/isis_cli.c b/isisd/isis_cli.c index c93bcaf8f..7c7a8d238 100644 --- a/isisd/isis_cli.c +++ b/isisd/isis_cli.c @@ -23,6 +23,7 @@ #include "isisd/isis_misc.h" #include "isisd/isis_circuit.h" #include "isisd/isis_csm.h" +#include "isisd/isis_flex_algo.h" #include "isisd/isis_cli_clippy.c" @@ -1126,6 +1127,7 @@ void cli_show_isis_purge_origin(struct vty *vty, const struct lyd_node *dnode, vty_out(vty, " purge-originator\n"); } + /* * XPath: /frr-isisd:isis/instance/admin-group-send-zero */ @@ -2720,6 +2722,24 @@ void cli_show_ip_isis_circ_type(struct vty *vty, const struct lyd_node *dnode, } } +static int ag_change(struct vty *vty, int argc, struct cmd_token **argv, + const char *xpath, bool no, int start_idx) +{ + for (int i = start_idx; i < argc; i++) + nb_cli_enqueue_change(vty, xpath, + no ? NB_OP_DESTROY : NB_OP_CREATE, + argv[i]->arg); + return nb_cli_apply_changes(vty, NULL); +} + +static int ag_iter_cb(const struct lyd_node *dnode, void *arg) +{ + struct vty *vty = (struct vty *)arg; + + vty_out(vty, " %s", yang_dnode_get_string(dnode, ".")); + return YANG_ITER_CONTINUE; +} + /* * XPath: /frr-interface:lib/interface/frr-isisd:isis/network-type */ @@ -3348,7 +3368,21 @@ DEFPY_YANG_NOSH(flex_algo, flex_algo_cmd, "flex-algo (128-255)$algorithm", "Flexible Algorithm\n" "Flexible Algorithm Number\n") { - return CMD_SUCCESS; + int ret; + char xpath[XPATH_MAXLEN + 37]; + + snprintf(xpath, sizeof(xpath), + "%s/flex-algos/flex-algo[flex-algo='%ld']", VTY_CURR_XPATH, + algorithm); + + nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); + + ret = nb_cli_apply_changes( + vty, "./flex-algos/flex-algo[flex-algo='%ld']", algorithm); + if (ret == CMD_SUCCESS) + VTY_PUSH_XPATH(ISIS_FLEX_ALGO_NODE, xpath); + + return ret; } DEFPY_YANG(no_flex_algo, no_flex_algo_cmd, "no flex-algo (128-255)$algorithm", @@ -3356,14 +3390,30 @@ DEFPY_YANG(no_flex_algo, no_flex_algo_cmd, "no flex-algo (128-255)$algorithm", "Flexible Algorithm\n" "Flexible Algorithm Number\n") { - return CMD_SUCCESS; + char xpath[XPATH_MAXLEN + 37]; + + snprintf(xpath, sizeof(xpath), + "%s/flex-algos/flex-algo[flex-algo='%ld']", VTY_CURR_XPATH, + algorithm); + + if (!yang_dnode_exists(vty->candidate_config->dnode, xpath)) { + vty_out(vty, "ISIS flex-algo %ld isn't exist.\n", algorithm); + return CMD_ERR_NO_MATCH; + } + + nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL); + return nb_cli_apply_changes_clear_pending( + vty, "./flex-algos/flex-algo[flex-algo='%ld']", algorithm); } DEFPY_YANG(advertise_definition, advertise_definition_cmd, "[no] advertise-definition", NO_STR "Advertise Local Flexible Algorithm\n") { - return CMD_SUCCESS; + nb_cli_enqueue_change(vty, "./advertise-definition", + no ? NB_OP_DESTROY : NB_OP_CREATE, + no ? NULL : "true"); + return nb_cli_apply_changes(vty, NULL); } DEFPY_YANG(affinity_include_any, affinity_include_any_cmd, @@ -3373,7 +3423,9 @@ DEFPY_YANG(affinity_include_any, affinity_include_any_cmd, "Any Include with\n" "Include NAME list\n") { - return CMD_SUCCESS; + const char *xpath = "./affinity-include-anies/affinity-include-any"; + + return ag_change(vty, argc, argv, xpath, no, no ? 3 : 2); } DEFPY_YANG(affinity_include_all, affinity_include_all_cmd, @@ -3383,7 +3435,9 @@ DEFPY_YANG(affinity_include_all, affinity_include_all_cmd, "All Include with\n" "Include NAME list\n") { - return CMD_SUCCESS; + const char *xpath = "./affinity-include-alls/affinity-include-all"; + + return ag_change(vty, argc, argv, xpath, no, no ? 3 : 2); } DEFPY_YANG(affinity_exclude_any, affinity_exclude_any_cmd, @@ -3393,13 +3447,48 @@ DEFPY_YANG(affinity_exclude_any, affinity_exclude_any_cmd, "Any Exclude with\n" "Exclude NAME list\n") { - return CMD_SUCCESS; + const char *xpath = "./affinity-exclude-anies/affinity-exclude-any"; + + return ag_change(vty, argc, argv, xpath, no, no ? 3 : 2); } DEFPY_YANG(prefix_metric, prefix_metric_cmd, "[no] prefix-metric", NO_STR "Use Flex-Algo Prefix Metric\n") { - return CMD_SUCCESS; + nb_cli_enqueue_change(vty, "./prefix-metric", + no ? NB_OP_DESTROY : NB_OP_CREATE, NULL); + return nb_cli_apply_changes(vty, NULL); +} + +DEFPY_YANG(dplane_sr_mpls, dplane_sr_mpls_cmd, "[no] dataplane sr-mpls", + NO_STR + "Advertise and participate in the specified Data-Planes\n" + "Advertise and participate in SR-MPLS data-plane\n") +{ + nb_cli_enqueue_change(vty, "./dplane-sr-mpls", + no ? NB_OP_DESTROY : NB_OP_CREATE, NULL); + return nb_cli_apply_changes(vty, NULL); +} + +DEFPY_HIDDEN(dplane_srv6, dplane_srv6_cmd, "[no] dataplane srv6", + NO_STR + "Advertise and participate in the specified Data-Planes\n" + "Advertise and participate in SRv6 data-plane\n") +{ + + nb_cli_enqueue_change(vty, "./dplane-srv6", + no ? NB_OP_DESTROY : NB_OP_CREATE, NULL); + return nb_cli_apply_changes(vty, NULL); +} + +DEFPY_HIDDEN(dplane_ip, dplane_ip_cmd, "[no] dataplane ip", + NO_STR + "Advertise and participate in the specified Data-Planes\n" + "Advertise and participate in IP data-plane\n") +{ + nb_cli_enqueue_change(vty, "./dplane-ip", + no ? NB_OP_DESTROY : NB_OP_CREATE, NULL); + return nb_cli_apply_changes(vty, NULL); } DEFPY_YANG(metric_type, metric_type_cmd, @@ -3410,7 +3499,29 @@ DEFPY_YANG(metric_type, metric_type_cmd, "Use Delay as metric\n" "Use Traffic Engineering metric\n") { - return CMD_SUCCESS; + const char *type = NULL; + + if (igp) { + type = "igp"; + } else if (te) { + type = "te-default"; + } else if (delay) { + type = "min-uni-link-delay"; + } else { + vty_out(vty, "Error: unknown metric type\n"); + return CMD_SUCCESS; + } + + if (!igp) + vty_out(vty, + "Warning: this version can advertise a Flex-Algorithm Definition (FAD) with the %s metric.\n" + "However, participation in a Flex-Algorithm with such a metric is not yet supported.\n", + type); + + nb_cli_enqueue_change(vty, "./metric-type", + no ? NB_OP_DESTROY : NB_OP_MODIFY, + no ? NULL : type); + return nb_cli_apply_changes(vty, NULL); } DEFPY_YANG(priority, priority_cmd, "[no] priority (0-255)$priority", @@ -3418,18 +3529,85 @@ DEFPY_YANG(priority, priority_cmd, "[no] priority (0-255)$priority", "Flex-Algo definition priority\n" "Priority value\n") { - return CMD_SUCCESS; + nb_cli_enqueue_change(vty, "./priority", + no ? NB_OP_DESTROY : NB_OP_MODIFY, + no ? NULL : priority_str); + return nb_cli_apply_changes(vty, NULL); } void cli_show_isis_flex_algo(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { + uint32_t algorithm; + enum flex_algo_metric_type metric_type; + uint32_t priority; + char type_str[10]; + + algorithm = yang_dnode_get_uint32(dnode, "./flex-algo"); + vty_out(vty, " flex-algo %u\n", algorithm); + + if (yang_dnode_exists(dnode, "./advertise-definition")) + vty_out(vty, " advertise-definition\n"); + + if (yang_dnode_exists(dnode, "./dplane-sr-mpls")) + vty_out(vty, " dataplane sr-mpls\n"); + if (yang_dnode_exists(dnode, "./dplane-srv6")) + vty_out(vty, " dataplane srv6\n"); + if (yang_dnode_exists(dnode, "./dplane-ip")) + vty_out(vty, " dataplane ip\n"); + + if (yang_dnode_exists(dnode, "./prefix-metric")) + vty_out(vty, " prefix-metric\n"); + + if (yang_dnode_exists(dnode, "./metric-type")) { + metric_type = yang_dnode_get_enum(dnode, "./metric-type"); + if (metric_type != MT_IGP) { + flex_algo_metric_type_print(type_str, sizeof(type_str), + metric_type); + vty_out(vty, " metric-type %s\n", type_str); + } + } + + if (yang_dnode_exists(dnode, "./priority")) { + priority = yang_dnode_get_uint32(dnode, "./priority"); + if (priority != FLEX_ALGO_PRIO_DEFAULT) + vty_out(vty, " priority %u\n", priority); + } + + if (yang_dnode_exists(dnode, + "./affinity-include-alls/affinity-include-all")) { + vty_out(vty, " affinity include-all"); + yang_dnode_iterate( + ag_iter_cb, vty, dnode, + "./affinity-include-alls/affinity-include-all"); + vty_out(vty, "\n"); + } + + if (yang_dnode_exists( + dnode, "./affinity-include-anies/affinity-include-any")) { + vty_out(vty, " affinity include-any"); + yang_dnode_iterate( + ag_iter_cb, vty, dnode, + "./affinity-include-anies/affinity-include-any"); + vty_out(vty, "\n"); + } + + if (yang_dnode_exists( + dnode, "./affinity-exclude-anies/affinity-exclude-any")) { + vty_out(vty, " affinity exclude-any"); + yang_dnode_iterate( + ag_iter_cb, vty, dnode, + "./affinity-exclude-anies/affinity-exclude-any"); + vty_out(vty, "\n"); + } } void cli_show_isis_flex_algo_end(struct vty *vty, const struct lyd_node *dnode) { + vty_out(vty, " !\n"); } + void isis_cli_init(void) { install_element(CONFIG_NODE, &router_isis_cmd); @@ -3581,6 +3759,9 @@ void isis_cli_init(void) install_element(ISIS_FLEX_ALGO_NODE, &affinity_include_any_cmd); install_element(ISIS_FLEX_ALGO_NODE, &affinity_include_all_cmd); install_element(ISIS_FLEX_ALGO_NODE, &affinity_exclude_any_cmd); + install_element(ISIS_FLEX_ALGO_NODE, &dplane_sr_mpls_cmd); + install_element(ISIS_FLEX_ALGO_NODE, &dplane_srv6_cmd); + install_element(ISIS_FLEX_ALGO_NODE, &dplane_ip_cmd); install_element(ISIS_FLEX_ALGO_NODE, &prefix_metric_cmd); install_element(ISIS_FLEX_ALGO_NODE, &metric_type_cmd); install_element(ISIS_FLEX_ALGO_NODE, &priority_cmd); From 5749ac83a8adca45703e60ab56383e29ed732532 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Mon, 12 Dec 2022 16:00:58 +0100 Subject: [PATCH 20/41] isisd: add ASLA support Add the support of ASLA with the following TLV: - Extended IS Reachability (already defined TLV 22) - Application-Specific Link Attributes (Sub-TLV 16) (to enable the Flex-Algo flag on a link) - Admin-group (Sub-Sub-TLV 3) - Extended Admin-group (Sub-Sub-TLV 14) Signed-off-by: Louis Scalbert --- isisd/isis_te.c | 170 ++++++++++++++- isisd/isis_tlvs.c | 517 ++++++++++++++++++++++++++++++++++++++++++++++ isisd/isis_tlvs.h | 58 ++++++ 3 files changed, 744 insertions(+), 1 deletion(-) diff --git a/isisd/isis_te.c b/isisd/isis_te.c index 70b0633fa..c734ff95d 100644 --- a/isisd/isis_te.c +++ b/isisd/isis_te.c @@ -164,6 +164,154 @@ void isis_mpls_te_term(struct isis_area *area) XFREE(MTYPE_ISIS_MPLS_TE, area->mta); } +static void isis_link_params_update_asla(struct isis_circuit *circuit, + struct interface *ifp) +{ + struct isis_asla_subtlvs *asla; + struct listnode *node, *nnode; + struct isis_ext_subtlvs *ext = circuit->ext; + int i; + + if (!HAS_LINK_PARAMS(ifp)) { + list_delete_all_node(ext->aslas); + return; + } + +#ifndef FABRICD + /* RFC 8919 Application Specific Link-Attributes + * is required by flex-algo application ISIS_SABM_FLAG_X + */ + if (list_isempty(circuit->area->flex_algos->flex_algos)) + isis_tlvs_free_asla(ext, ISIS_SABM_FLAG_X); + else + isis_tlvs_find_alloc_asla(ext, ISIS_SABM_FLAG_X); +#endif /* ifndef FABRICD */ + + if (list_isempty(ext->aslas)) + return; + + for (ALL_LIST_ELEMENTS(ext->aslas, node, nnode, asla)) { + asla->legacy = circuit->area->asla_legacy_flag; + RESET_SUBTLV(asla); + + if (asla->legacy) + continue; + + /* Fulfill ASLA subTLVs from interface link parameters */ + if (IS_PARAM_SET(ifp->link_params, LP_ADM_GRP)) { + asla->admin_group = ifp->link_params->admin_grp; + SET_SUBTLV(asla, EXT_ADM_GRP); + } else + UNSET_SUBTLV(asla, EXT_ADM_GRP); + + if (IS_PARAM_SET(ifp->link_params, LP_EXTEND_ADM_GRP)) { + admin_group_copy(&asla->ext_admin_group, + &ifp->link_params->ext_admin_grp); + SET_SUBTLV(asla, EXT_EXTEND_ADM_GRP); + } else + UNSET_SUBTLV(asla, EXT_EXTEND_ADM_GRP); + + /* Send admin-group zero for better compatibility + * https://www.rfc-editor.org/rfc/rfc7308#section-2.3.2 + */ + if (circuit->area->admin_group_send_zero && + !IS_SUBTLV(asla, EXT_ADM_GRP) && + !IS_SUBTLV(asla, EXT_EXTEND_ADM_GRP)) { + asla->admin_group = 0; + SET_SUBTLV(asla, EXT_ADM_GRP); + admin_group_clear(&asla->ext_admin_group); + admin_group_allow_explicit_zero(&asla->ext_admin_group); + SET_SUBTLV(asla, EXT_EXTEND_ADM_GRP); + } + + if (IS_PARAM_SET(ifp->link_params, LP_TE_METRIC)) { + asla->te_metric = ifp->link_params->te_metric; + SET_SUBTLV(asla, EXT_TE_METRIC); + } else + UNSET_SUBTLV(asla, EXT_TE_METRIC); + + if (IS_PARAM_SET(ifp->link_params, LP_DELAY)) { + asla->delay = ifp->link_params->av_delay; + SET_SUBTLV(asla, EXT_DELAY); + } else + UNSET_SUBTLV(asla, EXT_DELAY); + + if (IS_PARAM_SET(ifp->link_params, LP_MM_DELAY)) { + asla->min_delay = ifp->link_params->min_delay; + asla->max_delay = ifp->link_params->max_delay; + SET_SUBTLV(asla, EXT_MM_DELAY); + } else { + UNSET_SUBTLV(asla, EXT_MM_DELAY); + } + + if (asla->standard_apps == ISIS_SABM_FLAG_X) + /* Flex-Algo ASLA does not need the following TE + * sub-TLVs + */ + continue; + + if (IS_PARAM_SET(ifp->link_params, LP_MAX_BW)) { + asla->max_bw = ifp->link_params->max_bw; + SET_SUBTLV(asla, EXT_MAX_BW); + } else + UNSET_SUBTLV(asla, EXT_MAX_BW); + + if (IS_PARAM_SET(ifp->link_params, LP_MAX_RSV_BW)) { + asla->max_rsv_bw = ifp->link_params->max_rsv_bw; + SET_SUBTLV(asla, EXT_MAX_RSV_BW); + } else + UNSET_SUBTLV(asla, EXT_MAX_RSV_BW); + + if (IS_PARAM_SET(ifp->link_params, LP_UNRSV_BW)) { + for (i = 0; i < MAX_CLASS_TYPE; i++) + asla->unrsv_bw[i] = + ifp->link_params->unrsv_bw[i]; + SET_SUBTLV(asla, EXT_UNRSV_BW); + } else + UNSET_SUBTLV(asla, EXT_UNRSV_BW); + + if (IS_PARAM_SET(ifp->link_params, LP_DELAY_VAR)) { + asla->delay_var = ifp->link_params->delay_var; + SET_SUBTLV(asla, EXT_DELAY_VAR); + } else + UNSET_SUBTLV(asla, EXT_DELAY_VAR); + + if (IS_PARAM_SET(ifp->link_params, LP_PKT_LOSS)) { + asla->pkt_loss = ifp->link_params->pkt_loss; + SET_SUBTLV(asla, EXT_PKT_LOSS); + } else + UNSET_SUBTLV(asla, EXT_PKT_LOSS); + + if (IS_PARAM_SET(ifp->link_params, LP_RES_BW)) { + asla->res_bw = ifp->link_params->res_bw; + SET_SUBTLV(asla, EXT_RES_BW); + } else + UNSET_SUBTLV(asla, EXT_RES_BW); + + if (IS_PARAM_SET(ifp->link_params, LP_AVA_BW)) { + asla->ava_bw = ifp->link_params->ava_bw; + SET_SUBTLV(asla, EXT_AVA_BW); + } else + UNSET_SUBTLV(asla, EXT_AVA_BW); + + if (IS_PARAM_SET(ifp->link_params, LP_USE_BW)) { + asla->use_bw = ifp->link_params->use_bw; + SET_SUBTLV(asla, EXT_USE_BW); + } else + UNSET_SUBTLV(asla, EXT_USE_BW); + } + + + for (ALL_LIST_ELEMENTS(ext->aslas, node, nnode, asla)) { + if (!asla->legacy && NO_SUBTLV(asla) && + admin_group_nb_words(&asla->ext_admin_group) == 0) + /* remove ASLA without info from the list of ASLAs to + * not send void ASLA + */ + isis_tlvs_del_asla_flex_algo(ext, asla); + } +} + /* Main initialization / update function of the MPLS TE Circuit context */ /* Call when interface TE Link parameters are modified */ void isis_link_params_update(struct isis_circuit *circuit, @@ -210,6 +358,19 @@ void isis_link_params_update(struct isis_circuit *circuit, } else UNSET_SUBTLV(ext, EXT_EXTEND_ADM_GRP); + /* Send admin-group zero for better compatibility + * https://www.rfc-editor.org/rfc/rfc7308#section-2.3.2 + */ + if (circuit->area->admin_group_send_zero && + !IS_SUBTLV(ext, EXT_ADM_GRP) && + !IS_SUBTLV(ext, EXT_EXTEND_ADM_GRP)) { + ext->adm_group = 0; + SET_SUBTLV(ext, EXT_ADM_GRP); + admin_group_clear(&ext->ext_admin_group); + admin_group_allow_explicit_zero(&ext->ext_admin_group); + SET_SUBTLV(ext, EXT_EXTEND_ADM_GRP); + } + /* If known, register local IPv4 addr from ip_addr list */ if (listcount(circuit->ip_addrs) != 0) { addr = (struct prefix_ipv4 *)listgetdata( @@ -331,6 +492,8 @@ void isis_link_params_update(struct isis_circuit *circuit, ext->status = 0; } + isis_link_params_update_asla(circuit, ifp); + return; } @@ -503,7 +666,12 @@ int isis_mpls_te_update(struct interface *ifp) isis_link_params_update(circuit, ifp); /* ... and LSP */ - if (circuit->area && IS_MPLS_TE(circuit->area->mta)) + if (circuit->area && + (IS_MPLS_TE(circuit->area->mta) +#ifndef FABRICD + || !list_isempty(circuit->area->flex_algos->flex_algos) +#endif /* ifndef FABRICD */ + )) lsp_regenerate_schedule(circuit->area, circuit->is_type, 0); rc = 0; diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c index 8eaa095b3..368973dfd 100644 --- a/isisd/isis_tlvs.c +++ b/isisd/isis_tlvs.c @@ -123,6 +123,7 @@ struct isis_ext_subtlvs *isis_alloc_ext_subtlvs(void) ext = XCALLOC(MTYPE_ISIS_SUBTLV, sizeof(struct isis_ext_subtlvs)); init_item_list(&ext->adj_sid); init_item_list(&ext->lan_sid); + ext->aslas = list_new(); admin_group_init(&ext->ext_admin_group); @@ -132,6 +133,8 @@ struct isis_ext_subtlvs *isis_alloc_ext_subtlvs(void) void isis_del_ext_subtlvs(struct isis_ext_subtlvs *ext) { struct isis_item *item, *next_item; + struct listnode *node, *nnode; + struct isis_asla_subtlvs *asla; if (!ext) return; @@ -146,6 +149,11 @@ void isis_del_ext_subtlvs(struct isis_ext_subtlvs *ext) XFREE(MTYPE_ISIS_SUBTLV, item); } + for (ALL_LIST_ELEMENTS(ext->aslas, node, nnode, asla)) + isis_tlvs_del_asla_flex_algo(ext, asla); + + list_delete(&ext->aslas); + admin_group_term(&ext->ext_admin_group); XFREE(MTYPE_ISIS_SUBTLV, ext); @@ -162,6 +170,8 @@ copy_item_ext_subtlvs(struct isis_ext_subtlvs *exts, uint16_t mtid) struct isis_ext_subtlvs *rv = XCALLOC(MTYPE_ISIS_SUBTLV, sizeof(*rv)); struct isis_adj_sid *adj; struct isis_lan_adj_sid *lan; + struct listnode *node, *nnode; + struct isis_asla_subtlvs *new_asla, *asla; /* Copy the Extended IS main part */ memcpy(rv, exts, sizeof(struct isis_ext_subtlvs)); @@ -226,12 +236,133 @@ copy_item_ext_subtlvs(struct isis_ext_subtlvs *exts, uint16_t mtid) SET_SUBTLV(rv, EXT_LAN_ADJ_SID); } + rv->aslas = list_new(); + + for (ALL_LIST_ELEMENTS(exts->aslas, node, nnode, asla)) { + new_asla = XCALLOC(MTYPE_ISIS_SUBTLV, + sizeof(struct isis_asla_subtlvs)); + memcpy(new_asla, asla, sizeof(struct isis_asla_subtlvs)); + + new_asla->ext_admin_group.bitmap.data = NULL; + admin_group_copy(&new_asla->ext_admin_group, + &asla->ext_admin_group); + + listnode_add(rv->aslas, new_asla); + } + rv->ext_admin_group.bitmap.data = NULL; admin_group_copy(&rv->ext_admin_group, &exts->ext_admin_group); return rv; } +static void format_item_asla_subtlvs(struct isis_asla_subtlvs *asla, + struct sbuf *buf, int indent) +{ + char admin_group_buf[ADMIN_GROUP_PRINT_MAX_SIZE]; + + sbuf_push(buf, indent, "Application Specific Link Attributes:\n"); + sbuf_push(buf, indent + 2, + "L flag: %u, SA-Length: %u, UDA-Length: %u\n", asla->legacy, + asla->standard_apps_length, asla->user_def_apps_length); + sbuf_push(buf, indent + 2, "Standard Applications: 0x%02x", + asla->standard_apps); + if (asla->standard_apps) { + uint8_t bit = asla->standard_apps; + if (bit & ISIS_SABM_FLAG_R) + sbuf_push(buf, 0, " RSVP-TE"); + if (bit & ISIS_SABM_FLAG_S) + sbuf_push(buf, 0, " SR-Policy"); + if (bit & ISIS_SABM_FLAG_L) + sbuf_push(buf, 0, " Loop-Free-Alternate"); + if (bit & ISIS_SABM_FLAG_X) + sbuf_push(buf, 0, " Flex-Algo"); + } + sbuf_push(buf, 0, "\n"); + sbuf_push(buf, indent + 2, "User Defined Applications: 0x%02x\n", + asla->user_def_apps); + + if (IS_SUBTLV(asla, EXT_ADM_GRP)) { + sbuf_push(buf, indent + 2, "Admin Group: 0x%08x\n", + asla->admin_group); + sbuf_push(buf, indent + 4, "Bit positions: %s\n", + admin_group_standard_print( + admin_group_buf, + indent + 2 + strlen("Admin Group: "), + asla->admin_group)); + } + if (IS_SUBTLV(asla, EXT_EXTEND_ADM_GRP) && + admin_group_nb_words(&asla->ext_admin_group) != 0) { + sbuf_push(buf, indent + 2, "Ext Admin Group: %s\n", + admin_group_string( + admin_group_buf, ADMIN_GROUP_PRINT_MAX_SIZE, + indent + 2 + strlen("Ext Admin Group: "), + &asla->ext_admin_group)); + admin_group_print(admin_group_buf, + indent + 2 + strlen("Ext Admin Group: "), + &asla->ext_admin_group); + if (admin_group_buf[0] != '\0' && + (buf->pos + strlen(admin_group_buf) + + SBUF_DEFAULT_SIZE / 2) < buf->size) + sbuf_push(buf, indent + 4, "Bit positions: %s\n", + admin_group_buf); + } + if (IS_SUBTLV(asla, EXT_MAX_BW)) + sbuf_push(buf, indent + 2, + "Maximum Bandwidth: %g (Bytes/sec)\n", asla->max_bw); + if (IS_SUBTLV(asla, EXT_MAX_RSV_BW)) + sbuf_push(buf, indent + 2, + "Maximum Reservable Bandwidth: %g (Bytes/sec)\n", + asla->max_rsv_bw); + if (IS_SUBTLV(asla, EXT_UNRSV_BW)) { + sbuf_push(buf, indent + 2, "Unreserved Bandwidth:\n"); + for (int j = 0; j < MAX_CLASS_TYPE; j += 2) { + sbuf_push( + buf, indent + 2, + "[%d]: %g (Bytes/sec),\t[%d]: %g (Bytes/sec)\n", + j, asla->unrsv_bw[j], j + 1, + asla->unrsv_bw[j + 1]); + } + } + if (IS_SUBTLV(asla, EXT_TE_METRIC)) + sbuf_push(buf, indent + 2, "Traffic Engineering Metric: %u\n", + asla->te_metric); + /* Extended metrics */ + if (IS_SUBTLV(asla, EXT_DELAY)) + sbuf_push(buf, indent + 2, + "%s Average Link Delay: %u (micro-sec)\n", + IS_ANORMAL(asla->delay) ? "Anomalous" : "Normal", + asla->delay); + if (IS_SUBTLV(asla, EXT_MM_DELAY)) { + sbuf_push(buf, indent + 2, + "%s Min/Max Link Delay: %u / %u (micro-sec)\n", + IS_ANORMAL(asla->min_delay) ? "Anomalous" : "Normal", + asla->min_delay & TE_EXT_MASK, + asla->max_delay & TE_EXT_MASK); + } + if (IS_SUBTLV(asla, EXT_DELAY_VAR)) { + sbuf_push(buf, indent + 2, "Delay Variation: %u (micro-sec)\n", + asla->delay_var & TE_EXT_MASK); + } + if (IS_SUBTLV(asla, EXT_PKT_LOSS)) + sbuf_push(buf, indent + 2, "%s Link Packet Loss: %g (%%)\n", + IS_ANORMAL(asla->pkt_loss) ? "Anomalous" : "Normal", + (float)((asla->pkt_loss & TE_EXT_MASK) * + LOSS_PRECISION)); + if (IS_SUBTLV(asla, EXT_RES_BW)) + sbuf_push(buf, indent + 2, + "Unidir. Residual Bandwidth: %g (Bytes/sec)\n", + asla->res_bw); + if (IS_SUBTLV(asla, EXT_AVA_BW)) + sbuf_push(buf, indent + 2, + "Unidir. Available Bandwidth: %g (Bytes/sec)\n", + asla->ava_bw); + if (IS_SUBTLV(asla, EXT_USE_BW)) + sbuf_push(buf, indent + 2, + "Unidir. Utilized Bandwidth: %g (Bytes/sec)\n", + asla->use_bw); +} + /* mtid parameter is used to manage multi-topology i.e. IPv4 / IPv6 */ static void format_item_ext_subtlvs(struct isis_ext_subtlvs *exts, struct sbuf *buf, struct json_object *json, @@ -240,6 +371,8 @@ static void format_item_ext_subtlvs(struct isis_ext_subtlvs *exts, char admin_group_buf[ADMIN_GROUP_PRINT_MAX_SIZE]; char aux_buf[255]; char cnt_buf[255]; + struct isis_asla_subtlvs *asla; + struct listnode *node; /* Standard metrics */ if (IS_SUBTLV(exts, EXT_ADM_GRP)) { @@ -688,6 +821,8 @@ static void format_item_ext_subtlvs(struct isis_ext_subtlvs *exts, lan->neighbor_id); } } + for (ALL_LIST_ELEMENTS_RO(exts->aslas, node, asla)) + format_item_asla_subtlvs(asla, buf, indent); } static void free_item_ext_subtlvs(struct isis_ext_subtlvs *exts) @@ -695,10 +830,124 @@ static void free_item_ext_subtlvs(struct isis_ext_subtlvs *exts) isis_del_ext_subtlvs(exts); } +static int pack_item_ext_subtlv_asla(struct isis_asla_subtlvs *asla, + struct stream *s, size_t *min_len) +{ + size_t subtlv_len; + size_t subtlv_len_pos; + + /* Sub TLV header */ + stream_putc(s, ISIS_SUBTLV_ASLA); + + subtlv_len_pos = stream_get_endp(s); + stream_putc(s, 0); /* length will be filled later */ + + /* SABM Flag/Length */ + if (asla->legacy) + stream_putc(s, ASLA_LEGACY_FLAG | asla->standard_apps_length); + else + stream_putc(s, asla->standard_apps_length); + stream_putc(s, asla->user_def_apps_length); /* UDABM Flag/Length */ + stream_putc(s, asla->standard_apps); + stream_putc(s, asla->user_def_apps); + + /* Administrative Group */ + if (IS_SUBTLV(asla, EXT_ADM_GRP)) { + stream_putc(s, ISIS_SUBTLV_ADMIN_GRP); + stream_putc(s, ISIS_SUBTLV_DEF_SIZE); + stream_putl(s, asla->admin_group); + } + + /* Extended Administrative Group */ + if (IS_SUBTLV(asla, EXT_EXTEND_ADM_GRP) && + admin_group_nb_words(&asla->ext_admin_group) != 0) { + size_t ag_length; + size_t ag_length_pos; + struct admin_group *ag; + + stream_putc(s, ISIS_SUBTLV_EXT_ADMIN_GRP); + ag_length_pos = stream_get_endp(s); + stream_putc(s, 0); /* length will be filled later*/ + + ag = &asla->ext_admin_group; + for (size_t i = 0; i < admin_group_nb_words(ag); i++) + stream_putl(s, ag->bitmap.data[i]); + + ag_length = stream_get_endp(s) - ag_length_pos - 1; + stream_putc_at(s, ag_length_pos, ag_length); + } + + if (IS_SUBTLV(asla, EXT_MAX_BW)) { + stream_putc(s, ISIS_SUBTLV_MAX_BW); + stream_putc(s, ISIS_SUBTLV_DEF_SIZE); + stream_putf(s, asla->max_bw); + } + if (IS_SUBTLV(asla, EXT_MAX_RSV_BW)) { + stream_putc(s, ISIS_SUBTLV_MAX_RSV_BW); + stream_putc(s, ISIS_SUBTLV_DEF_SIZE); + stream_putf(s, asla->max_rsv_bw); + } + if (IS_SUBTLV(asla, EXT_UNRSV_BW)) { + stream_putc(s, ISIS_SUBTLV_UNRSV_BW); + stream_putc(s, ISIS_SUBTLV_UNRSV_BW_SIZE); + for (int j = 0; j < MAX_CLASS_TYPE; j++) + stream_putf(s, asla->unrsv_bw[j]); + } + if (IS_SUBTLV(asla, EXT_TE_METRIC)) { + stream_putc(s, ISIS_SUBTLV_TE_METRIC); + stream_putc(s, ISIS_SUBTLV_TE_METRIC_SIZE); + stream_put3(s, asla->te_metric); + } + if (IS_SUBTLV(asla, EXT_DELAY)) { + stream_putc(s, ISIS_SUBTLV_AV_DELAY); + stream_putc(s, ISIS_SUBTLV_DEF_SIZE); + stream_putl(s, asla->delay); + } + if (IS_SUBTLV(asla, EXT_MM_DELAY)) { + stream_putc(s, ISIS_SUBTLV_MM_DELAY); + stream_putc(s, ISIS_SUBTLV_MM_DELAY_SIZE); + stream_putl(s, asla->min_delay); + stream_putl(s, asla->max_delay); + } + if (IS_SUBTLV(asla, EXT_DELAY_VAR)) { + stream_putc(s, ISIS_SUBTLV_DELAY_VAR); + stream_putc(s, ISIS_SUBTLV_DEF_SIZE); + stream_putl(s, asla->delay_var); + } + if (IS_SUBTLV(asla, EXT_PKT_LOSS)) { + stream_putc(s, ISIS_SUBTLV_PKT_LOSS); + stream_putc(s, ISIS_SUBTLV_DEF_SIZE); + stream_putl(s, asla->pkt_loss); + } + if (IS_SUBTLV(asla, EXT_RES_BW)) { + stream_putc(s, ISIS_SUBTLV_RES_BW); + stream_putc(s, ISIS_SUBTLV_DEF_SIZE); + stream_putf(s, asla->res_bw); + } + if (IS_SUBTLV(asla, EXT_AVA_BW)) { + stream_putc(s, ISIS_SUBTLV_AVA_BW); + stream_putc(s, ISIS_SUBTLV_DEF_SIZE); + stream_putf(s, asla->ava_bw); + } + if (IS_SUBTLV(asla, EXT_USE_BW)) { + stream_putc(s, ISIS_SUBTLV_USE_BW); + stream_putc(s, ISIS_SUBTLV_DEF_SIZE); + stream_putf(s, asla->use_bw); + } + + subtlv_len = stream_get_endp(s) - subtlv_len_pos - 1; + stream_putc_at(s, subtlv_len_pos, subtlv_len); + + return 0; +} + static int pack_item_ext_subtlvs(struct isis_ext_subtlvs *exts, struct stream *s, size_t *min_len) { + struct isis_asla_subtlvs *asla; + struct listnode *node; uint8_t size; + int ret; if (STREAM_WRITEABLE(s) < ISIS_SUBTLV_MAX_SIZE) { *min_len = ISIS_SUBTLV_MAX_SIZE; @@ -862,6 +1111,219 @@ static int pack_item_ext_subtlvs(struct isis_ext_subtlvs *exts, } } + for (ALL_LIST_ELEMENTS_RO(exts->aslas, node, asla)) { + ret = pack_item_ext_subtlv_asla(asla, s, min_len); + if (ret < 0) + return ret; + } + + return 0; +} + +static int unpack_item_ext_subtlv_asla(uint16_t mtid, uint8_t subtlv_len, + struct stream *s, struct sbuf *log, + int indent, + struct isis_ext_subtlvs *exts) +{ + /* Standard App Identifier Bit Flags/Length */ + uint8_t sabm_flag_len; + /* User-defined App Identifier Bit Flags/Length */ + uint8_t uabm_flag_len; + uint8_t sabm[ASLA_APP_IDENTIFIER_BIT_LENGTH] = {0}; + uint8_t uabm[ASLA_APP_IDENTIFIER_BIT_LENGTH] = {0}; + uint8_t readable; + uint8_t subsubtlv_type; + uint8_t subsubtlv_len; + size_t nb_groups; + struct isis_asla_subtlvs *asla; + + if (subtlv_len < ISIS_SUBSUBTLV_HDR_SIZE) { + TLV_SIZE_MISMATCH(log, indent, "ASLA"); + return -1; + } + + + asla = XCALLOC(MTYPE_ISIS_SUBTLV, sizeof(*asla)); + + admin_group_init(&asla->ext_admin_group); + + + sabm_flag_len = stream_getc(s); + uabm_flag_len = stream_getc(s); + asla->legacy = CHECK_FLAG(sabm_flag_len, ASLA_LEGACY_FLAG); + asla->standard_apps_length = ASLA_APPS_LENGTH_MASK & sabm_flag_len; + asla->user_def_apps_length = ASLA_APPS_LENGTH_MASK & uabm_flag_len; + + for (int i = 0; i < asla->standard_apps_length; i++) + sabm[i] = stream_getc(s); + for (int i = 0; i < asla->user_def_apps_length; i++) + uabm[i] = stream_getc(s); + + asla->standard_apps = sabm[0]; + asla->user_def_apps = uabm[0]; + + readable = subtlv_len - 4; + while (readable > 0) { + if (readable < ISIS_SUBSUBTLV_HDR_SIZE) { + TLV_SIZE_MISMATCH(log, indent, "ASLA Sub TLV"); + return -1; + } + + subsubtlv_type = stream_getc(s); + subsubtlv_len = stream_getc(s); + readable -= ISIS_SUBSUBTLV_HDR_SIZE; + + + switch (subsubtlv_type) { + case ISIS_SUBTLV_ADMIN_GRP: + if (subsubtlv_len != ISIS_SUBTLV_DEF_SIZE) { + TLV_SIZE_MISMATCH(log, indent, + "ASLA Adm Group"); + stream_forward_getp(s, subsubtlv_len); + } else { + asla->admin_group = stream_getl(s); + SET_SUBTLV(asla, EXT_ADM_GRP); + } + break; + + case ISIS_SUBTLV_EXT_ADMIN_GRP: + nb_groups = subsubtlv_len / sizeof(uint32_t); + for (size_t i = 0; i < nb_groups; i++) { + uint32_t val = stream_getl(s); + + admin_group_bulk_set(&asla->ext_admin_group, + val, i); + } + SET_SUBTLV(asla, EXT_EXTEND_ADM_GRP); + break; + case ISIS_SUBTLV_MAX_BW: + if (subsubtlv_len != ISIS_SUBTLV_DEF_SIZE) { + TLV_SIZE_MISMATCH(log, indent, + "Maximum Bandwidth"); + stream_forward_getp(s, subsubtlv_len); + } else { + asla->max_bw = stream_getf(s); + SET_SUBTLV(asla, EXT_MAX_BW); + } + break; + case ISIS_SUBTLV_MAX_RSV_BW: + if (subsubtlv_len != ISIS_SUBTLV_DEF_SIZE) { + TLV_SIZE_MISMATCH( + log, indent, + "Maximum Reservable Bandwidth"); + stream_forward_getp(s, subsubtlv_len); + } else { + asla->max_rsv_bw = stream_getf(s); + SET_SUBTLV(asla, EXT_MAX_RSV_BW); + } + break; + case ISIS_SUBTLV_UNRSV_BW: + if (subsubtlv_len != ISIS_SUBTLV_UNRSV_BW_SIZE) { + TLV_SIZE_MISMATCH(log, indent, + "Unreserved Bandwidth"); + stream_forward_getp(s, subsubtlv_len); + } else { + for (int i = 0; i < MAX_CLASS_TYPE; i++) + asla->unrsv_bw[i] = stream_getf(s); + SET_SUBTLV(asla, EXT_UNRSV_BW); + } + break; + case ISIS_SUBTLV_TE_METRIC: + if (subsubtlv_len != ISIS_SUBTLV_TE_METRIC_SIZE) { + TLV_SIZE_MISMATCH(log, indent, + "Traffic Engineering Metric"); + stream_forward_getp(s, subsubtlv_len); + } else { + asla->te_metric = stream_get3(s); + SET_SUBTLV(asla, EXT_TE_METRIC); + } + break; + /* Extended Metrics as defined in RFC 7810 */ + case ISIS_SUBTLV_AV_DELAY: + if (subsubtlv_len != ISIS_SUBTLV_DEF_SIZE) { + TLV_SIZE_MISMATCH(log, indent, + "Average Link Delay"); + stream_forward_getp(s, subsubtlv_len); + } else { + asla->delay = stream_getl(s); + SET_SUBTLV(asla, EXT_DELAY); + } + break; + case ISIS_SUBTLV_MM_DELAY: + if (subsubtlv_len != ISIS_SUBTLV_MM_DELAY_SIZE) { + TLV_SIZE_MISMATCH(log, indent, + "Min/Max Link Delay"); + stream_forward_getp(s, subsubtlv_len); + } else { + asla->min_delay = stream_getl(s); + asla->max_delay = stream_getl(s); + SET_SUBTLV(asla, EXT_MM_DELAY); + } + break; + case ISIS_SUBTLV_DELAY_VAR: + if (subsubtlv_len != ISIS_SUBTLV_DEF_SIZE) { + TLV_SIZE_MISMATCH(log, indent, + "Delay Variation"); + stream_forward_getp(s, subsubtlv_len); + } else { + asla->delay_var = stream_getl(s); + SET_SUBTLV(asla, EXT_DELAY_VAR); + } + break; + case ISIS_SUBTLV_PKT_LOSS: + if (subsubtlv_len != ISIS_SUBTLV_DEF_SIZE) { + TLV_SIZE_MISMATCH(log, indent, + "Link Packet Loss"); + stream_forward_getp(s, subsubtlv_len); + } else { + asla->pkt_loss = stream_getl(s); + SET_SUBTLV(asla, EXT_PKT_LOSS); + } + break; + case ISIS_SUBTLV_RES_BW: + if (subsubtlv_len != ISIS_SUBTLV_DEF_SIZE) { + TLV_SIZE_MISMATCH( + log, indent, + "Unidirectional Residual Bandwidth"); + stream_forward_getp(s, subsubtlv_len); + } else { + asla->res_bw = stream_getf(s); + SET_SUBTLV(asla, EXT_RES_BW); + } + break; + case ISIS_SUBTLV_AVA_BW: + if (subsubtlv_len != ISIS_SUBTLV_DEF_SIZE) { + TLV_SIZE_MISMATCH( + log, indent, + "Unidirectional Available Bandwidth"); + stream_forward_getp(s, subsubtlv_len); + } else { + asla->ava_bw = stream_getf(s); + SET_SUBTLV(asla, EXT_AVA_BW); + } + break; + case ISIS_SUBTLV_USE_BW: + if (subsubtlv_len != ISIS_SUBTLV_DEF_SIZE) { + TLV_SIZE_MISMATCH( + log, indent, + "Unidirectional Utilized Bandwidth"); + stream_forward_getp(s, subsubtlv_len); + } else { + asla->use_bw = stream_getf(s); + SET_SUBTLV(asla, EXT_USE_BW); + } + break; + default: + zlog_debug("unknown (t,l)=(%u,%u)", subsubtlv_type, + subsubtlv_len); + stream_forward_getp(s, subsubtlv_len); + break; + } + readable -= subsubtlv_len; + } + + listnode_add(exts->aslas, asla); + return 0; } @@ -1209,6 +1671,13 @@ static int unpack_item_ext_subtlvs(uint16_t mtid, uint8_t len, struct stream *s, SET_SUBTLV(exts, EXT_LAN_ADJ_SID); } break; + case ISIS_SUBTLV_ASLA: + if (unpack_item_ext_subtlv_asla(mtid, subtlv_len, s, + log, indent, + exts) < 0) { + sbuf_push(log, indent, "TLV parse error"); + } + break; default: /* Skip unknown TLV */ stream_forward_getp(s, subtlv_len); @@ -5873,6 +6342,54 @@ void isis_tlvs_del_lan_adj_sid(struct isis_ext_subtlvs *exts, UNSET_SUBTLV(exts, EXT_LAN_ADJ_SID); } +void isis_tlvs_del_asla_flex_algo(struct isis_ext_subtlvs *ext, + struct isis_asla_subtlvs *asla) +{ + admin_group_term(&asla->ext_admin_group); + listnode_delete(ext->aslas, asla); + XFREE(MTYPE_ISIS_SUBTLV, asla); +} + +struct isis_asla_subtlvs * +isis_tlvs_find_alloc_asla(struct isis_ext_subtlvs *ext, uint8_t standard_apps) +{ + struct isis_asla_subtlvs *asla; + struct listnode *node; + + if (!list_isempty(ext->aslas)) { + for (ALL_LIST_ELEMENTS_RO(ext->aslas, node, asla)) { + if (CHECK_FLAG(asla->standard_apps, standard_apps)) + return asla; + } + } + + asla = XCALLOC(MTYPE_ISIS_SUBTLV, sizeof(struct isis_asla_subtlvs)); + admin_group_init(&asla->ext_admin_group); + SET_FLAG(asla->standard_apps, standard_apps); + SET_FLAG(asla->user_def_apps, standard_apps); + asla->standard_apps_length = ASLA_APP_IDENTIFIER_BIT_LENGTH; + asla->user_def_apps_length = ASLA_APP_IDENTIFIER_BIT_LENGTH; + + listnode_add(ext->aslas, asla); + return asla; +} + +void isis_tlvs_free_asla(struct isis_ext_subtlvs *ext, uint8_t standard_apps) +{ + struct isis_asla_subtlvs *asla; + struct listnode *node; + + if (!ext) + return; + + for (ALL_LIST_ELEMENTS_RO(ext->aslas, node, asla)) { + if (!CHECK_FLAG(asla->standard_apps, standard_apps)) + continue; + isis_tlvs_del_asla_flex_algo(ext, asla); + break; + } +} + void isis_tlvs_add_extended_ip_reach(struct isis_tlvs *tlvs, struct prefix_ipv4 *dest, uint32_t metric, bool external, diff --git a/isisd/isis_tlvs.h b/isisd/isis_tlvs.h index d5c96d7ab..331cad93e 100644 --- a/isisd/isis_tlvs.h +++ b/isisd/isis_tlvs.h @@ -400,6 +400,9 @@ enum isis_tlv_type { ISIS_SUBTLV_AVA_BW = 38, ISIS_SUBTLV_USE_BW = 39, + /* RFC 8919 */ + ISIS_SUBTLV_ASLA = 16, + ISIS_SUBTLV_MAX = 40, }; @@ -434,6 +437,8 @@ enum ext_subtlv_size { /* RFC 7308 */ ISIS_SUBTLV_EXT_ADMIN_GRP = 14, + ISIS_SUBSUBTLV_HDR_SIZE = 2, + ISIS_SUBTLV_MAX_SIZE = 180, }; @@ -441,6 +446,8 @@ enum ext_subtlv_size { #define SET_SUBTLV(s, t) ((s->status) |= (t)) #define UNSET_SUBTLV(s, t) ((s->status) &= ~(t)) #define IS_SUBTLV(s, t) (s->status & t) +#define RESET_SUBTLV(s) (s->status = 0) +#define NO_SUBTLV(s) (s->status == 0) #define EXT_DISABLE 0x000000 #define EXT_ADM_GRP 0x000001 @@ -512,6 +519,45 @@ struct isis_ext_subtlvs { /* Segment Routing Adjacency & LAN Adjacency Segment ID */ struct isis_item_list adj_sid; struct isis_item_list lan_sid; + + struct list *aslas; +}; + +/* RFC 8919 */ +#define ISIS_SABM_FLAG_R 0x80 /* RSVP-TE */ +#define ISIS_SABM_FLAG_S 0x40 /* Segment Routing Policy */ +#define ISIS_SABM_FLAG_L 0x20 /* Loop-Free Alternate */ +#define ISIS_SABM_FLAG_X 0x10 /* Flex-Algorithm - RFC9350 */ + +#define ASLA_APP_IDENTIFIER_BIT_LENGTH 1 +#define ASLA_LEGACY_FLAG 0x80 +#define ASLA_APPS_LENGTH_MASK 0x7f + +struct isis_asla_subtlvs { + uint32_t status; + + /* Application Specific Link Attribute - RFC 8919 */ + bool legacy; /* L-Flag */ + uint8_t standard_apps_length; + uint8_t user_def_apps_length; + uint8_t standard_apps; + uint8_t user_def_apps; + + /* Sub-TLV list - rfc8919 section-3.1 */ + uint32_t admin_group; + struct admin_group ext_admin_group; /* Res. Class/Color - RFC 7308 */ + float max_bw; /* Maximum Bandwidth - RFC 5305 */ + float max_rsv_bw; /* Maximum Reservable Bandwidth - RFC 5305 */ + float unrsv_bw[8]; /* Unreserved Bandwidth - RFC 5305 */ + uint32_t te_metric; /* Traffic Engineering Metric - RFC 5305 */ + uint32_t delay; /* Average Link Delay - RFC 8570 */ + uint32_t min_delay; /* Low Link Delay - RFC 8570 */ + uint32_t max_delay; /* High Link Delay - RFC 8570 */ + uint32_t delay_var; /* Link Delay Variation i.e. Jitter - RFC 8570 */ + uint32_t pkt_loss; /* Unidirectional Link Packet Loss - RFC 8570 */ + float res_bw; /* Unidirectional Residual Bandwidth - RFC 8570 */ + float ava_bw; /* Unidirectional Available Bandwidth - RFC 8570 */ + float use_bw; /* Unidirectional Utilized Bandwidth - RFC 8570 */ }; #define IS_COMPAT_MT_TLV(tlv_type) \ @@ -542,6 +588,12 @@ struct list *isis_fragment_tlvs(struct isis_tlvs *tlvs, size_t size); #define ISIS_MT_AT_MASK 0x4000 #endif +/* RFC 8919 */ +#define ISIS_SABM_FLAG_R 0x80 /* RSVP-TE */ +#define ISIS_SABM_FLAG_S 0x40 /* Segment Routing Policy */ +#define ISIS_SABM_FLAG_L 0x20 /* Loop-Free Alternate */ +#define ISIS_SABM_FLAG_X 0x10 /* Flex-Algorithm - RFC9350 */ + void isis_tlvs_add_auth(struct isis_tlvs *tlvs, struct isis_passwd *passwd); void isis_tlvs_add_area_addresses(struct isis_tlvs *tlvs, struct list *addresses); @@ -606,6 +658,12 @@ void isis_tlvs_add_lan_adj_sid(struct isis_ext_subtlvs *exts, void isis_tlvs_del_lan_adj_sid(struct isis_ext_subtlvs *exts, struct isis_lan_adj_sid *lan); +void isis_tlvs_del_asla_flex_algo(struct isis_ext_subtlvs *ext, + struct isis_asla_subtlvs *asla); +struct isis_asla_subtlvs * +isis_tlvs_find_alloc_asla(struct isis_ext_subtlvs *ext, uint8_t standard_apps); +void isis_tlvs_free_asla(struct isis_ext_subtlvs *ext, uint8_t standard_apps); + void isis_tlvs_add_oldstyle_reach(struct isis_tlvs *tlvs, uint8_t *id, uint8_t metric); void isis_tlvs_add_extended_reach(struct isis_tlvs *tlvs, uint16_t mtid, From 78774bbcd51b1cb461b2d8622545d4b8136f2344 Mon Sep 17 00:00:00 2001 From: Hiroki Shirokura Date: Tue, 4 Jan 2022 01:31:45 +0000 Subject: [PATCH 21/41] isisd: add isis flex-algo lsp advertisement Deal with the packing and unpacking of following Flex-Algo Sub-Sub-TLVs: - Router Capability (already defined TLV 242) - List of the Flex-Algo Definitions (Sub-TLV 26) - Exclude admin group (Sub-Sub-TLV 1) - Include-any admin group (Sub-Sub-TLV 2) - Include-all admin group (Sub-Sub-TLV 3) - Flags (for prefix-metric) (Sub-Sub-TLV 4) This commit splits data into multiple router capability TLVs if needed because a TLV cannot contains more than 255 bytes. Note that the list of SR Algorithm (Sub-TLV 19) within Router Capability (TLV 242) is already set in a previous commit. Signed-off-by: Hiroki Shirokura Signed-off-by: Eric Kinzie Signed-off-by: Louis Scalbert --- isisd/isis_lsp.c | 102 ++++++--- isisd/isis_tlvs.c | 421 +++++++++++++++++++++++++++++++++++--- isisd/isis_tlvs.h | 48 ++++- tests/isisd/test_common.c | 25 +-- 4 files changed, 526 insertions(+), 70 deletions(-) diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c index 08fa845e8..c07083a06 100644 --- a/isisd/isis_lsp.c +++ b/isisd/isis_lsp.c @@ -46,6 +46,7 @@ #include "isisd/fabricd.h" #include "isisd/isis_tx_queue.h" #include "isisd/isis_nb.h" +#include "isisd/isis_flex_algo.h" DEFINE_MTYPE_STATIC(ISISD, ISIS_LSP, "ISIS LSP"); @@ -898,9 +899,15 @@ static void lsp_build_internal_reach_ipv4(struct isis_lsp *lsp, area->area_tag, ipv4); if (area->srdb.enabled) - for (int i = 0; i < SR_ALGORITHM_COUNT; i++) + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) { +#ifndef FABRICD + if (flex_algo_id_valid(i) && + !isis_flex_algo_elected_supported(i, area)) + continue; +#endif /* ifndef FABRICD */ pcfgs[i] = isis_sr_cfg_prefix_find(area, ipv4, i); + } isis_tlvs_add_extended_ip_reach(lsp->tlvs, ipv4, metric, false, pcfgs); @@ -918,8 +925,14 @@ static void lsp_build_internal_reach_ipv6(struct isis_lsp *lsp, area->area_tag, ipv6); if (area->srdb.enabled) - for (int i = 0; i < SR_ALGORITHM_COUNT; i++) + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) { +#ifndef FABRICD + if (flex_algo_id_valid(i) && + !isis_flex_algo_elected_supported(i, area)) + continue; +#endif /* ifndef FABRICD */ pcfgs[i] = isis_sr_cfg_prefix_find(area, ipv6, i); + } isis_tlvs_add_ipv6_reach(lsp->tlvs, isis_area_ipv6_topology(area), ipv6, metric, false, pcfgs); @@ -955,9 +968,16 @@ static void lsp_build_ext_reach_ipv4(struct isis_lsp *lsp, NULL}; if (area->srdb.enabled) - for (int i = 0; i < SR_ALGORITHM_COUNT; i++) + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) { +#ifndef FABRICD + if (flex_algo_id_valid(i) && + !isis_flex_algo_elected_supported( + i, area)) + continue; +#endif /* ifndef FABRICD */ pcfgs[i] = isis_sr_cfg_prefix_find( area, ipv4, i); + } isis_tlvs_add_extended_ip_reach(lsp->tlvs, ipv4, metric, true, pcfgs); @@ -992,9 +1012,16 @@ static void lsp_build_ext_reach_ipv6(struct isis_lsp *lsp, NULL}; if (area->srdb.enabled) - for (int i = 0; i < SR_ALGORITHM_COUNT; i++) + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) { +#ifndef FABRICD + if (flex_algo_id_valid(i) && + !isis_flex_algo_elected_supported( + i, area)) + continue; +#endif /* ifndef FABRICD */ pcfgs[i] = isis_sr_cfg_prefix_find( area, p, i); + } isis_tlvs_add_ipv6_reach(lsp->tlvs, isis_area_ipv6_topology(area), @@ -1115,13 +1142,30 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area) /* Add Router Capability TLV. */ if (area->isis->router_id != 0) { - struct isis_router_cap cap = {}; + struct isis_router_cap *rcap; +#ifndef FABRICD + struct isis_router_cap_fad *rcap_fad; + struct listnode *node; + struct flex_algo *fa; +#endif /* ifndef FABRICD */ - /* init SR algo list content to the default value */ - for (int i = 0; i < SR_ALGORITHM_COUNT; i++) - cap.algo[i] = SR_ALGORITHM_UNSET; + rcap = isis_tlvs_init_router_capability(lsp->tlvs); - cap.router_id.s_addr = area->isis->router_id; + rcap->router_id.s_addr = area->isis->router_id; + +#ifndef FABRICD + /* Set flex-algo definitions */ + for (ALL_LIST_ELEMENTS_RO(area->flex_algos->flex_algos, node, + fa)) { + if (!fa->advertise_definition) + continue; + lsp_debug("ISIS (%s): Flex-Algo Definition %u", + area->area_tag, fa->algorithm); + isis_tlvs_set_router_capability_fad(lsp->tlvs, fa, + fa->algorithm, + area->isis->sysid); + } +#endif /* ifndef FABRICD */ /* Add SR Sub-TLVs if SR is enabled. */ if (area->srdb.enabled) { @@ -1131,26 +1175,38 @@ static void lsp_build(struct isis_lsp *lsp, struct isis_area *area) /* SRGB first */ range_size = srdb->config.srgb_upper_bound - srdb->config.srgb_lower_bound + 1; - cap.srgb.flags = ISIS_SUBTLV_SRGB_FLAG_I - | ISIS_SUBTLV_SRGB_FLAG_V; - cap.srgb.range_size = range_size; - cap.srgb.lower_bound = srdb->config.srgb_lower_bound; + rcap->srgb.flags = ISIS_SUBTLV_SRGB_FLAG_I | + ISIS_SUBTLV_SRGB_FLAG_V; + rcap->srgb.range_size = range_size; + rcap->srgb.lower_bound = srdb->config.srgb_lower_bound; /* Then Algorithm */ - cap.algo[0] = SR_ALGORITHM_SPF; - cap.algo[1] = SR_ALGORITHM_UNSET; + rcap->algo[0] = SR_ALGORITHM_SPF; + rcap->algo[1] = SR_ALGORITHM_UNSET; +#ifndef FABRICD + for (ALL_LIST_ELEMENTS_RO(area->flex_algos->flex_algos, + node, fa)) { + if (fa->advertise_definition) + rcap_fad = rcap->fads[fa->algorithm]; + else + rcap_fad = NULL; + + if (!isis_flex_algo_elected_supported_local_fad( + fa->algorithm, area, &rcap_fad)) + continue; + lsp_debug("ISIS (%s): SR Algorithm %u", + area->area_tag, fa->algorithm); + rcap->algo[fa->algorithm] = fa->algorithm; + } +#endif /* ifndef FABRICD */ /* SRLB */ - cap.srlb.flags = 0; + rcap->srlb.flags = 0; range_size = srdb->config.srlb_upper_bound - srdb->config.srlb_lower_bound + 1; - cap.srlb.range_size = range_size; - cap.srlb.lower_bound = srdb->config.srlb_lower_bound; + rcap->srlb.range_size = range_size; + rcap->srlb.lower_bound = srdb->config.srlb_lower_bound; /* And finally MSD */ - cap.msd = srdb->config.msd; + rcap->msd = srdb->config.msd; } - - isis_tlvs_set_router_capability(lsp->tlvs, &cap); - lsp_debug("ISIS (%s): Adding Router Capabilities information", - area->area_tag); } /* IPv4 address and TE router ID TLVs. diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c index 368973dfd..4ad877ce0 100644 --- a/isisd/isis_tlvs.c +++ b/isisd/isis_tlvs.c @@ -29,6 +29,7 @@ #include "isisd/isis_lsp.h" #include "isisd/isis_te.h" #include "isisd/isis_sr.h" +#include "isisd/isis_flex_algo.h" #define TLV_SIZE_MISMATCH(log, indent, target) \ sbuf_push(log, indent, \ @@ -36,6 +37,7 @@ DEFINE_MTYPE_STATIC(ISISD, ISIS_TLV, "ISIS TLVs"); DEFINE_MTYPE(ISISD, ISIS_SUBTLV, "ISIS Sub-TLVs"); +DEFINE_MTYPE_STATIC(ISISD, ISIS_SUBSUBTLV, "ISIS Sub-Sub-TLVs"); DEFINE_MTYPE_STATIC(ISISD, ISIS_MT_ITEM_LIST, "ISIS MT Item Lists"); typedef int (*unpack_tlv_func)(enum isis_tlv_context context, uint8_t tlv_type, @@ -381,7 +383,7 @@ static void format_item_ext_subtlvs(struct isis_ext_subtlvs *exts, exts->adm_group); json_object_string_add(json, "adm-group", aux_buf); } else { - sbuf_push(buf, indent, "Administrative Group: 0x%x\n", + sbuf_push(buf, indent, "Admin Group: 0x%08x\n", exts->adm_group); sbuf_push(buf, indent + 2, "Bit positions: %s\n", admin_group_standard_print( @@ -3912,6 +3914,39 @@ static struct isis_router_cap *copy_tlv_router_cap( memcpy(rv, router_cap, sizeof(*rv)); +#ifndef FABRICD + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) { + struct isis_router_cap_fad *sc_fad; + struct isis_router_cap_fad *rv_fad; + + sc_fad = router_cap->fads[i]; + if (!sc_fad) + continue; + rv_fad = XMALLOC(MTYPE_ISIS_TLV, + sizeof(struct isis_router_cap_fad)); + *rv_fad = *sc_fad; + rv_fad->fad.admin_group_exclude_any.bitmap.data = NULL; + rv_fad->fad.admin_group_include_any.bitmap.data = NULL; + rv_fad->fad.admin_group_include_all.bitmap.data = NULL; + + assert(bf_is_inited( + sc_fad->fad.admin_group_exclude_any.bitmap)); + assert(bf_is_inited( + sc_fad->fad.admin_group_include_any.bitmap)); + assert(bf_is_inited( + sc_fad->fad.admin_group_include_all.bitmap)); + + admin_group_copy(&rv_fad->fad.admin_group_exclude_any, + &sc_fad->fad.admin_group_exclude_any); + admin_group_copy(&rv_fad->fad.admin_group_include_any, + &sc_fad->fad.admin_group_include_any); + admin_group_copy(&rv_fad->fad.admin_group_include_all, + &sc_fad->fad.admin_group_include_all); + + rv->fads[i] = rv_fad; + } +#endif /* ifndef FABRICD */ + return rv; } @@ -4031,37 +4066,178 @@ static void format_tlv_router_cap(const struct isis_router_cap *router_cap, if (router_cap->msd != 0) sbuf_push(buf, indent, " Node Maximum SID Depth: %u\n", router_cap->msd); + +#ifndef FABRICD + /* Flex-Algo */ + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) { + char admin_group_buf[ADMIN_GROUP_PRINT_MAX_SIZE]; + int indent2; + struct admin_group *admin_group; + struct isis_router_cap_fad *fad; + + fad = router_cap->fads[i]; + if (!fad) + continue; + + sbuf_push(buf, indent, " Flex-Algo Definition: %d\n", + fad->fad.algorithm); + sbuf_push(buf, indent, " Metric-Type: %d\n", + fad->fad.metric_type); + sbuf_push(buf, indent, " Calc-Type: %d\n", + fad->fad.calc_type); + sbuf_push(buf, indent, " Priority: %d\n", fad->fad.priority); + + indent2 = indent + strlen(" Exclude-Any: "); + admin_group = &fad->fad.admin_group_exclude_any; + sbuf_push(buf, indent, " Exclude-Any: "); + sbuf_push(buf, 0, "%s\n", + admin_group_string(admin_group_buf, + ADMIN_GROUP_PRINT_MAX_SIZE, + indent2, admin_group)); + + indent2 = indent + strlen(" Include-Any: "); + admin_group = &fad->fad.admin_group_include_any; + sbuf_push(buf, indent, " Include-Any: "); + sbuf_push(buf, 0, "%s\n", + admin_group_string(admin_group_buf, + ADMIN_GROUP_PRINT_MAX_SIZE, + indent2, admin_group)); + + indent2 = indent + strlen(" Include-All: "); + admin_group = &fad->fad.admin_group_include_all; + sbuf_push(buf, indent, " Include-All: "); + sbuf_push(buf, 0, "%s\n", + admin_group_string(admin_group_buf, + ADMIN_GROUP_PRINT_MAX_SIZE, + indent2, admin_group)); + + sbuf_push(buf, indent, " M-Flag: %c\n", + CHECK_FLAG(fad->fad.flags, FAD_FLAG_M) ? '1' : '0'); + + if (fad->fad.flags != 0 && fad->fad.flags != FAD_FLAG_M) + sbuf_push(buf, indent, " Flags: 0x%x\n", + fad->fad.flags); + if (fad->fad.exclude_srlg) + sbuf_push(buf, indent, " Exclude SRLG: Enabled\n"); + if (fad->fad.unsupported_subtlv) + sbuf_push(buf, indent, + " Got an unsupported sub-TLV: Yes\n"); + } +#endif /* ifndef FABRICD */ } static void free_tlv_router_cap(struct isis_router_cap *router_cap) { + if (!router_cap) + return; + +#ifndef FABRICD + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) { + struct isis_router_cap_fad *fad; + + fad = router_cap->fads[i]; + if (!fad) + continue; + admin_group_term(&fad->fad.admin_group_exclude_any); + admin_group_term(&fad->fad.admin_group_include_any); + admin_group_term(&fad->fad.admin_group_include_all); + XFREE(MTYPE_ISIS_TLV, fad); + } +#endif /* ifndef FABRICD */ + XFREE(MTYPE_ISIS_TLV, router_cap); } +#ifndef FABRICD +static size_t +isis_router_cap_fad_sub_tlv_len(const struct isis_router_cap_fad *fad) +{ + size_t sz = ISIS_SUBTLV_FAD_MIN_SIZE; + uint32_t admin_group_length; + + admin_group_length = + admin_group_nb_words(&fad->fad.admin_group_exclude_any); + if (admin_group_length) + sz += sizeof(uint32_t) * admin_group_length + 2; + + admin_group_length = + admin_group_nb_words(&fad->fad.admin_group_include_any); + if (admin_group_length) + sz += sizeof(uint32_t) * admin_group_length + 2; + + admin_group_length = + admin_group_nb_words(&fad->fad.admin_group_include_all); + if (admin_group_length) + sz += sizeof(uint32_t) * admin_group_length + 2; + + if (fad->fad.flags != 0) + sz += ISIS_SUBTLV_FAD_SUBSUBTLV_FLAGS_SIZE + 2; + + /* TODO: add exclude SRLG sub-sub-TLV length when supported */ + + return sz; +} +#endif /* ifndef FABRICD */ + +static size_t isis_router_cap_tlv_size(const struct isis_router_cap *router_cap) +{ + size_t sz = 2 + ISIS_ROUTER_CAP_SIZE; +#ifndef FABRICD + size_t fad_sz; +#endif /* ifndef FABRICD */ + int nb_algo; + + if ((router_cap->srgb.range_size != 0) && + (router_cap->srgb.lower_bound != 0)) { + sz += 2 + ISIS_SUBTLV_SID_LABEL_RANGE_SIZE; + sz += 2 + ISIS_SUBTLV_SID_LABEL_SIZE; + + nb_algo = isis_tlvs_sr_algo_count(router_cap); + if (nb_algo != 0) + sz += 2 + nb_algo; + + if ((router_cap->srlb.range_size != 0) && + (router_cap->srlb.lower_bound != 0)) { + sz += 2 + ISIS_SUBTLV_SID_LABEL_RANGE_SIZE; + sz += 2 + ISIS_SUBTLV_SID_LABEL_SIZE; + } + + if (router_cap->msd != 0) + sz += 2 + ISIS_SUBTLV_NODE_MSD_SIZE; + } + +#ifndef FABRICD + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) { + if (!router_cap->fads[i]) + continue; + fad_sz = 2 + + isis_router_cap_fad_sub_tlv_len(router_cap->fads[i]); + if (((sz + fad_sz) % 256) < (sz % 256)) + sz += 2 + ISIS_ROUTER_CAP_SIZE + fad_sz; + else + sz += fad_sz; + } +#endif /* ifndef FABRICD */ + + return sz; +} + static int pack_tlv_router_cap(const struct isis_router_cap *router_cap, struct stream *s) { - size_t tlv_len = ISIS_ROUTER_CAP_SIZE; - size_t len_pos; + size_t tlv_len, len_pos; uint8_t nb_algo; if (!router_cap) return 0; - /* Compute Maximum TLV size */ - tlv_len += ISIS_SUBTLV_SID_LABEL_RANGE_SIZE - + ISIS_SUBTLV_HDR_SIZE - + ISIS_SUBTLV_ALGORITHM_SIZE - + ISIS_SUBTLV_NODE_MSD_SIZE; - - if (STREAM_WRITEABLE(s) < (unsigned int)(2 + tlv_len)) + if (STREAM_WRITEABLE(s) < isis_router_cap_tlv_size(router_cap)) return 1; /* Add Router Capability TLV 242 with Router ID and Flags */ stream_putc(s, ISIS_TLV_ROUTER_CAPABILITY); - /* Real length will be adjusted later */ len_pos = stream_get_endp(s); - stream_putc(s, tlv_len); + stream_putc(s, 0); /* Real length will be adjusted later */ stream_put_ipv4(s, router_cap->router_id.s_addr); stream_putc(s, router_cap->flags); @@ -4108,6 +4284,80 @@ static int pack_tlv_router_cap(const struct isis_router_cap *router_cap, } } +#ifndef FABRICD + /* Flex Algo Definitions */ + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) { + struct isis_router_cap_fad *fad; + size_t subtlv_len; + struct admin_group *ag; + uint32_t admin_group_length; + + fad = router_cap->fads[i]; + if (!fad) + continue; + + subtlv_len = isis_router_cap_fad_sub_tlv_len(fad); + + if ((stream_get_endp(s) - len_pos - 1) > 250) { + /* Adjust TLV length which depends on subTLVs presence + */ + tlv_len = stream_get_endp(s) - len_pos - 1; + stream_putc_at(s, len_pos, tlv_len); + + /* Add Router Capability TLV 242 with Router ID and + * Flags + */ + stream_putc(s, ISIS_TLV_ROUTER_CAPABILITY); + /* Real length will be adjusted later */ + len_pos = stream_get_endp(s); + stream_putc(s, 0); + stream_put_ipv4(s, router_cap->router_id.s_addr); + stream_putc(s, router_cap->flags); + } + + stream_putc(s, ISIS_SUBTLV_FAD); + stream_putc(s, subtlv_len); /* length will be filled later */ + + stream_putc(s, fad->fad.algorithm); + stream_putc(s, fad->fad.metric_type); + stream_putc(s, fad->fad.calc_type); + stream_putc(s, fad->fad.priority); + + ag = &fad->fad.admin_group_exclude_any; + admin_group_length = admin_group_nb_words(ag); + if (admin_group_length) { + stream_putc(s, ISIS_SUBTLV_FAD_SUBSUBTLV_EXCAG); + stream_putc(s, sizeof(uint32_t) * admin_group_length); + for (size_t i = 0; i < admin_group_length; i++) + stream_putl(s, admin_group_get_offset(ag, i)); + } + + ag = &fad->fad.admin_group_include_any; + admin_group_length = admin_group_nb_words(ag); + if (admin_group_length) { + stream_putc(s, ISIS_SUBTLV_FAD_SUBSUBTLV_INCANYAG); + stream_putc(s, sizeof(uint32_t) * admin_group_length); + for (size_t i = 0; i < admin_group_length; i++) + stream_putl(s, admin_group_get_offset(ag, i)); + } + + ag = &fad->fad.admin_group_include_all; + admin_group_length = admin_group_nb_words(ag); + if (admin_group_length) { + stream_putc(s, ISIS_SUBTLV_FAD_SUBSUBTLV_INCALLAG); + stream_putc(s, sizeof(uint32_t) * admin_group_length); + for (size_t i = 0; i < admin_group_length; i++) + stream_putl(s, admin_group_get_offset(ag, i)); + } + + if (fad->fad.flags != 0) { + stream_putc(s, ISIS_SUBTLV_FAD_SUBSUBTLV_FLAGS); + stream_putc(s, ISIS_SUBTLV_FAD_SUBSUBTLV_FLAGS_SIZE); + stream_putc(s, fad->fad.flags); + } + } +#endif /* ifndef FABRICD */ + /* Adjust TLV length which depends on subTLVs presence */ tlv_len = stream_get_endp(s) - len_pos - 1; stream_putc_at(s, len_pos, tlv_len); @@ -4134,18 +4384,16 @@ static int unpack_tlv_router_cap(enum isis_tlv_context context, return 0; } - if (tlvs->router_cap) { - sbuf_push(log, indent, - "WARNING: Router Capability TLV present multiple times.\n"); - stream_forward_getp(s, tlv_len); - return 0; + if (tlvs->router_cap) + /* Multiple Router Capability found */ + rcap = tlvs->router_cap; + else { + /* Allocate router cap structure and initialize SR Algorithms */ + rcap = XCALLOC(MTYPE_ISIS_TLV, sizeof(struct isis_router_cap)); + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) + rcap->algo[i] = SR_ALGORITHM_UNSET; } - /* Allocate router cap structure and initialize SR Algorithms */ - rcap = XCALLOC(MTYPE_ISIS_TLV, sizeof(struct isis_router_cap)); - for (int i = 0; i < SR_ALGORITHM_COUNT; i++) - rcap->algo[i] = SR_ALGORITHM_UNSET; - /* Get Router ID and Flags */ rcap->router_id.s_addr = stream_get_ipv4(s); rcap->flags = stream_getc(s); @@ -4153,6 +4401,10 @@ static int unpack_tlv_router_cap(enum isis_tlv_context context, /* Parse remaining part of the TLV if present */ subtlv_len = tlv_len - ISIS_ROUTER_CAP_SIZE; while (subtlv_len > 2) { +#ifndef FABRICD + struct isis_router_cap_fad *fad; + uint8_t subsubtlvs_len; +#endif /* ifndef FABRICD */ uint8_t msd_type; type = stream_getc(s); @@ -4306,6 +4558,80 @@ static int unpack_tlv_router_cap(enum isis_tlv_context context, if (length > MSD_TLV_SIZE) stream_forward_getp(s, length - MSD_TLV_SIZE); break; +#ifndef FABRICD + case ISIS_SUBTLV_FAD: + fad = XCALLOC(MTYPE_ISIS_TLV, + sizeof(struct isis_router_cap_fad)); + fad->fad.algorithm = stream_getc(s); + fad->fad.metric_type = stream_getc(s); + fad->fad.calc_type = stream_getc(s); + fad->fad.priority = stream_getc(s); + rcap->fads[fad->fad.algorithm] = fad; + admin_group_init(&fad->fad.admin_group_exclude_any); + admin_group_init(&fad->fad.admin_group_include_any); + admin_group_init(&fad->fad.admin_group_include_all); + + subsubtlvs_len = length - 4; + while (subsubtlvs_len > 2) { + struct admin_group *ag; + uint8_t subsubtlv_type; + uint8_t subsubtlv_len; + uint32_t v; + int n_ag, i; + + subsubtlv_type = stream_getc(s); + subsubtlv_len = stream_getc(s); + + switch (subsubtlv_type) { + case ISIS_SUBTLV_FAD_SUBSUBTLV_EXCAG: + ag = &fad->fad.admin_group_exclude_any; + n_ag = subsubtlv_len / sizeof(uint32_t); + for (i = 0; i < n_ag; i++) { + v = stream_getl(s); + admin_group_bulk_set(ag, v, i); + } + break; + case ISIS_SUBTLV_FAD_SUBSUBTLV_INCANYAG: + ag = &fad->fad.admin_group_include_any; + n_ag = subsubtlv_len / sizeof(uint32_t); + for (i = 0; i < n_ag; i++) { + v = stream_getl(s); + admin_group_bulk_set(ag, v, i); + } + break; + case ISIS_SUBTLV_FAD_SUBSUBTLV_INCALLAG: + ag = &fad->fad.admin_group_include_all; + n_ag = subsubtlv_len / sizeof(uint32_t); + for (i = 0; i < n_ag; i++) { + v = stream_getl(s); + admin_group_bulk_set(ag, v, i); + } + break; + case ISIS_SUBTLV_FAD_SUBSUBTLV_FLAGS: + if (subsubtlv_len == 0) + break; + + fad->fad.flags = stream_getc(s); + for (i = subsubtlv_len - 1; i > 0; --i) + stream_getc(s); + break; + case ISIS_SUBTLV_FAD_SUBSUBTLV_ESRLG: + fad->fad.exclude_srlg = true; + stream_forward_getp(s, subsubtlv_len); + break; + default: + sbuf_push( + log, indent, + "Received an unsupported Flex-Algo sub-TLV type %u\n", + subsubtlv_type); + fad->fad.unsupported_subtlv = true; + stream_forward_getp(s, subsubtlv_len); + break; + } + subsubtlvs_len -= 2 + subsubtlv_len; + } + break; +#endif /* ifndef FABRICD */ default: stream_forward_getp(s, length); break; @@ -6253,18 +6579,53 @@ void isis_tlvs_set_dynamic_hostname(struct isis_tlvs *tlvs, tlvs->hostname = XSTRDUP(MTYPE_ISIS_TLV, hostname); } -/* Set Router Capability TLV parameters */ -void isis_tlvs_set_router_capability(struct isis_tlvs *tlvs, - const struct isis_router_cap *cap) +/* Init Router Capability TLV parameters */ +struct isis_router_cap *isis_tlvs_init_router_capability(struct isis_tlvs *tlvs) { - XFREE(MTYPE_ISIS_TLV, tlvs->router_cap); - if (!cap) - return; - tlvs->router_cap = XCALLOC(MTYPE_ISIS_TLV, sizeof(*tlvs->router_cap)); - *tlvs->router_cap = *cap; + + /* init SR algo list content to the default value */ + for (int i = 0; i < SR_ALGORITHM_COUNT; i++) + tlvs->router_cap->algo[i] = SR_ALGORITHM_UNSET; + + return tlvs->router_cap; } +#ifndef FABRICD +void isis_tlvs_set_router_capability_fad(struct isis_tlvs *tlvs, + struct flex_algo *fa, int algorithm, + uint8_t *sysid) +{ + struct isis_router_cap_fad *rcap_fad; + + assert(tlvs->router_cap); + + rcap_fad = tlvs->router_cap->fads[algorithm]; + + if (!rcap_fad) + rcap_fad = XCALLOC(MTYPE_ISIS_TLV, + sizeof(struct isis_router_cap_fad)); + + memset(rcap_fad->sysid, 0, ISIS_SYS_ID_LEN + 2); + memcpy(rcap_fad->sysid, sysid, ISIS_SYS_ID_LEN); + + memcpy(&rcap_fad->fad, fa, sizeof(struct flex_algo)); + + rcap_fad->fad.admin_group_exclude_any.bitmap.data = NULL; + rcap_fad->fad.admin_group_include_any.bitmap.data = NULL; + rcap_fad->fad.admin_group_include_all.bitmap.data = NULL; + + admin_group_copy(&rcap_fad->fad.admin_group_exclude_any, + &fa->admin_group_exclude_any); + admin_group_copy(&rcap_fad->fad.admin_group_include_any, + &fa->admin_group_include_any); + admin_group_copy(&rcap_fad->fad.admin_group_include_all, + &fa->admin_group_include_all); + + tlvs->router_cap->fads[algorithm] = rcap_fad; +} +#endif /* ifndef FABRICD */ + int isis_tlvs_sr_algo_count(const struct isis_router_cap *cap) { int count = 0; diff --git a/isisd/isis_tlvs.h b/isisd/isis_tlvs.h index 331cad93e..03e2b2edc 100644 --- a/isisd/isis_tlvs.h +++ b/isisd/isis_tlvs.h @@ -13,6 +13,8 @@ #include "openbsd-tree.h" #include "prefix.h" #include "flex_algo.h" +#include "affinitymap.h" + DECLARE_MTYPE(ISIS_SUBTLV); @@ -400,10 +402,22 @@ enum isis_tlv_type { ISIS_SUBTLV_AVA_BW = 38, ISIS_SUBTLV_USE_BW = 39, + /* RFC 7308 */ + ISIS_SUBTLV_EXT_ADMIN_GRP = 14, + /* RFC 8919 */ ISIS_SUBTLV_ASLA = 16, + /* draft-ietf-lsr-isis-srv6-extensions */ + ISIS_SUBTLV_SID_END = 5, + ISIS_SUBTLV_SID_END_X = 43, + ISIS_SUBTLV_MAX = 40, + + /* draft-ietf-lsr-isis-srv6-extensions */ + ISIS_SUBSUBTLV_SID_STRUCTURE = 1, + + ISIS_SUBSUBTLV_MAX = 256, }; /* subTLVs size for TE and SR */ @@ -431,15 +445,31 @@ enum ext_subtlv_size { /* RFC 7810 */ ISIS_SUBTLV_MM_DELAY_SIZE = 8, + /* RFC9350 - Flex-Algorithm */ + ISIS_SUBTLV_FAD = 26, + ISIS_SUBTLV_FAD_MIN_SIZE = 4, + ISIS_SUBTLV_HDR_SIZE = 2, ISIS_SUBTLV_DEF_SIZE = 4, - /* RFC 7308 */ - ISIS_SUBTLV_EXT_ADMIN_GRP = 14, + ISIS_SUBTLV_MAX_SIZE = 180, + + /* draft-ietf-lsr-isis-srv6-extensions */ + ISIS_SUBSUBTLV_SID_STRUCTURE_SIZE = 4, ISIS_SUBSUBTLV_HDR_SIZE = 2, + ISIS_SUBSUBTLV_MAX_SIZE = 180, - ISIS_SUBTLV_MAX_SIZE = 180, + /* RFC9350 - Flex-Algorithm */ + ISIS_SUBTLV_FAD_SUBSUBTLV_FLAGS_SIZE = 1, +}; + +enum ext_subsubtlv_types { + ISIS_SUBTLV_FAD_SUBSUBTLV_EXCAG = 1, + ISIS_SUBTLV_FAD_SUBSUBTLV_INCANYAG = 2, + ISIS_SUBTLV_FAD_SUBSUBTLV_INCALLAG = 3, + ISIS_SUBTLV_FAD_SUBSUBTLV_FLAGS = 4, + ISIS_SUBTLV_FAD_SUBSUBTLV_ESRLG = 5, }; /* Macros to manage the optional presence of EXT subTLVs */ @@ -625,8 +655,16 @@ void isis_tlvs_add_csnp_entries(struct isis_tlvs *tlvs, uint8_t *start_id, struct isis_lsp **last_lsp); void isis_tlvs_set_dynamic_hostname(struct isis_tlvs *tlvs, const char *hostname); -void isis_tlvs_set_router_capability(struct isis_tlvs *tlvs, - const struct isis_router_cap *cap); +struct isis_router_cap * +isis_tlvs_init_router_capability(struct isis_tlvs *tlvs); + +struct isis_area; +struct isis_flex_algo; +void isis_tlvs_set_router_capability_fad(struct isis_tlvs *tlvs, + struct flex_algo *fa, int algorithm, + uint8_t *sysid); + +struct isis_area; int isis_tlvs_sr_algo_count(const struct isis_router_cap *cap); diff --git a/tests/isisd/test_common.c b/tests/isisd/test_common.c index 5c1debca8..e47456965 100644 --- a/tests/isisd/test_common.c +++ b/tests/isisd/test_common.c @@ -163,31 +163,32 @@ static void lsp_add_reach(struct isis_lsp *lsp, static void lsp_add_router_capability(struct isis_lsp *lsp, const struct isis_test_node *tnode) { - struct isis_router_cap cap = {}; + struct isis_router_cap *cap; if (!tnode->router_id) return; - if (inet_pton(AF_INET, tnode->router_id, &cap.router_id) != 1) { + cap = isis_tlvs_init_router_capability(lsp->tlvs); + + if (inet_pton(AF_INET, tnode->router_id, &cap->router_id) != 1) { zlog_debug("%s: invalid router-id: %s", __func__, tnode->router_id); return; } if (CHECK_FLAG(tnode->flags, F_ISIS_TEST_NODE_SR)) { - cap.srgb.flags = + cap->srgb.flags = ISIS_SUBTLV_SRGB_FLAG_I | ISIS_SUBTLV_SRGB_FLAG_V; - cap.srgb.lower_bound = tnode->srgb.lower_bound - ? tnode->srgb.lower_bound - : SRGB_DFTL_LOWER_BOUND; - cap.srgb.range_size = tnode->srgb.range_size - ? tnode->srgb.range_size - : SRGB_DFTL_RANGE_SIZE; - cap.algo[0] = SR_ALGORITHM_SPF; - cap.algo[1] = SR_ALGORITHM_UNSET; + cap->srgb.lower_bound = tnode->srgb.lower_bound + ? tnode->srgb.lower_bound + : SRGB_DFTL_LOWER_BOUND; + cap->srgb.range_size = tnode->srgb.range_size + ? tnode->srgb.range_size + : SRGB_DFTL_RANGE_SIZE; + cap->algo[0] = SR_ALGORITHM_SPF; + cap->algo[1] = SR_ALGORITHM_UNSET; } - isis_tlvs_set_router_capability(lsp->tlvs, &cap); } static void lsp_add_mt_router_info(struct isis_lsp *lsp, From 860b75b40e73285ce165619dbebf650e3a3bc65f Mon Sep 17 00:00:00 2001 From: Hiroki Shirokura Date: Fri, 21 Jan 2022 14:54:15 +0000 Subject: [PATCH 22/41] isisd: calculate flex-algo constraint spf Take into account the flex-algo affinity constraints to compute the SPF tree. Signed-off-by: Hiroki Shirokura Signed-off-by: Louis Scalbert --- isisd/isis_flex_algo.c | 96 ++++++++++++++++++++++ isisd/isis_flex_algo.h | 4 + isisd/isis_spf.c | 173 ++++++++++++++++++++++++++++++++++----- isisd/isis_spf_private.h | 4 + isisd/isisd.c | 35 ++++++++ 5 files changed, 290 insertions(+), 22 deletions(-) diff --git a/isisd/isis_flex_algo.c b/isisd/isis_flex_algo.c index 94ad53b22..742a862fc 100644 --- a/isisd/isis_flex_algo.c +++ b/isisd/isis_flex_algo.c @@ -237,4 +237,100 @@ bool sr_algorithm_participated(const struct isis_lsp *lsp, uint8_t algorithm) return false; } +bool isis_flex_algo_constraint_drop(struct isis_spftree *spftree, + struct isis_lsp *lsp, + struct isis_extended_reach *reach) +{ + bool ret; + struct isis_ext_subtlvs *subtlvs = reach->subtlvs; + uint8_t lspid_orig[ISIS_SYS_ID_LEN + 2]; + uint8_t lspid_neigh[ISIS_SYS_ID_LEN + 2]; + struct isis_router_cap_fad *fad; + struct isis_asla_subtlvs *asla; + struct listnode *node; + uint32_t *link_admin_group = NULL; + uint32_t link_ext_admin_group_bitmap0; + struct admin_group *link_ext_admin_group = NULL; + + fad = isis_flex_algo_elected_supported(spftree->algorithm, + spftree->area); + if (!fad) + return true; + + for (ALL_LIST_ELEMENTS_RO(subtlvs->aslas, node, asla)) { + if (!CHECK_FLAG(asla->standard_apps, ISIS_SABM_FLAG_X)) + continue; + if (asla->legacy) { + if (IS_SUBTLV(subtlvs, EXT_ADM_GRP)) + link_admin_group = &subtlvs->adm_group; + + if (IS_SUBTLV(subtlvs, EXT_EXTEND_ADM_GRP) && + admin_group_nb_words(&subtlvs->ext_admin_group) != + 0) + link_ext_admin_group = + &subtlvs->ext_admin_group; + } else { + if (IS_SUBTLV(asla, EXT_ADM_GRP)) + link_admin_group = &asla->admin_group; + if (IS_SUBTLV(asla, EXT_EXTEND_ADM_GRP) && + admin_group_nb_words(&asla->ext_admin_group) != 0) + link_ext_admin_group = &asla->ext_admin_group; + } + break; + } + + /* RFC7308 section 2.3.1 + * A receiving node that notices that the AG differs from the first 32 + * bits of the EAG SHOULD report this mismatch to the operator. + */ + if (link_admin_group && link_ext_admin_group) { + link_ext_admin_group_bitmap0 = + admin_group_get_offset(link_ext_admin_group, 0); + if (*link_admin_group != link_ext_admin_group_bitmap0) { + memcpy(lspid_orig, lsp->hdr.lsp_id, + ISIS_SYS_ID_LEN + 2); + memcpy(lspid_neigh, reach->id, ISIS_SYS_ID_LEN + 2); + zlog_warn( + "ISIS-SPF: LSP from %pLS neighbor %pLS. Admin-group 0x%08x differs from ext admin-group 0x%08x.", + lspid_orig, lspid_neigh, *link_admin_group, + link_ext_admin_group_bitmap0); + } + } + + /* + * Exclude Any + */ + if (!admin_group_zero(&fad->fad.admin_group_exclude_any)) { + ret = admin_group_match_any(&fad->fad.admin_group_exclude_any, + link_admin_group, + link_ext_admin_group); + if (ret) + return true; + } + + /* + * Include Any + */ + if (!admin_group_zero(&fad->fad.admin_group_include_any)) { + ret = admin_group_match_any(&fad->fad.admin_group_include_any, + link_admin_group, + link_ext_admin_group); + if (!ret) + return true; + } + + /* + * Include All + */ + if (!admin_group_zero(&fad->fad.admin_group_include_all)) { + ret = admin_group_match_all(&fad->fad.admin_group_include_all, + link_admin_group, + link_ext_admin_group); + if (!ret) + return true; + } + + return false; +} + #endif /* ifndef FABRICD */ diff --git a/isisd/isis_flex_algo.h b/isisd/isis_flex_algo.h index 0a0e337e0..c47583824 100644 --- a/isisd/isis_flex_algo.h +++ b/isisd/isis_flex_algo.h @@ -46,6 +46,10 @@ isis_flex_algo_elected_supported_local_fad(int algorithm, struct isis_lsp; bool sr_algorithm_participated(const struct isis_lsp *lsp, uint8_t algorithm); +bool isis_flex_algo_constraint_drop(struct isis_spftree *spftree, + struct isis_lsp *lsp, + struct isis_extended_reach *reach); + #endif /* ifndef FABRICD */ #endif /* ISIS_FLEX_ALGO_H */ diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index 6bfb83c21..cc8c5168e 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -43,6 +43,7 @@ #include "isis_csm.h" #include "isis_mt.h" #include "isis_tlvs.h" +#include "isis_flex_algo.h" #include "isis_zebra.h" #include "fabricd.h" #include "isis_spf_private.h" @@ -322,6 +323,30 @@ static void isis_spf_adj_free(void *arg) XFREE(MTYPE_ISIS_SPF_ADJ, sadj); } +static void _isis_spftree_init(struct isis_spftree *tree) +{ + isis_vertex_queue_init(&tree->tents, "IS-IS SPF tents", true); + isis_vertex_queue_init(&tree->paths, "IS-IS SPF paths", false); + tree->route_table = srcdest_table_init(); + tree->route_table->cleanup = isis_route_node_cleanup; + tree->route_table->info = isis_route_table_info_alloc(tree->algorithm); + tree->route_table_backup = srcdest_table_init(); + tree->route_table_backup->info = + isis_route_table_info_alloc(tree->algorithm); + tree->route_table_backup->cleanup = isis_route_node_cleanup; + tree->prefix_sids = hash_create(prefix_sid_key_make, prefix_sid_cmp, + "SR Prefix-SID Entries"); + tree->sadj_list = list_new(); + tree->sadj_list->del = isis_spf_adj_free; + isis_rlfa_list_init(tree); + tree->lfa.remote.pc_spftrees = list_new(); + tree->lfa.remote.pc_spftrees->del = (void (*)(void *))isis_spftree_del; + if (tree->type == SPF_TYPE_RLFA || tree->type == SPF_TYPE_TI_LFA) { + isis_spf_node_list_init(&tree->lfa.p_space); + isis_spf_node_list_init(&tree->lfa.q_space); + } +} + struct isis_spftree * isis_spftree_new(struct isis_area *area, struct lspdb_head *lspdb, const uint8_t *sysid, int level, enum spf_tree_id tree_id, @@ -331,20 +356,8 @@ isis_spftree_new(struct isis_area *area, struct lspdb_head *lspdb, tree = XCALLOC(MTYPE_ISIS_SPFTREE, sizeof(struct isis_spftree)); - isis_vertex_queue_init(&tree->tents, "IS-IS SPF tents", true); - isis_vertex_queue_init(&tree->paths, "IS-IS SPF paths", false); - tree->route_table = srcdest_table_init(); - tree->route_table->cleanup = isis_route_node_cleanup; - tree->route_table->info = isis_route_table_info_alloc(algorithm); - tree->route_table_backup = srcdest_table_init(); - tree->route_table_backup->info = isis_route_table_info_alloc(algorithm); - tree->route_table_backup->cleanup = isis_route_node_cleanup; tree->area = area; tree->lspdb = lspdb; - tree->prefix_sids = hash_create(prefix_sid_key_make, prefix_sid_cmp, - "SR Prefix-SID Entries"); - tree->sadj_list = list_new(); - tree->sadj_list->del = isis_spf_adj_free; tree->last_run_timestamp = 0; tree->last_run_monotime = 0; tree->last_run_duration = 0; @@ -355,19 +368,14 @@ isis_spftree_new(struct isis_area *area, struct lspdb_head *lspdb, tree->tree_id = tree_id; tree->family = (tree->tree_id == SPFTREE_IPV4) ? AF_INET : AF_INET6; tree->flags = flags; - isis_rlfa_list_init(tree); - tree->lfa.remote.pc_spftrees = list_new(); - tree->lfa.remote.pc_spftrees->del = (void (*)(void *))isis_spftree_del; - if (tree->type == SPF_TYPE_RLFA || tree->type == SPF_TYPE_TI_LFA) { - isis_spf_node_list_init(&tree->lfa.p_space); - isis_spf_node_list_init(&tree->lfa.q_space); - } tree->algorithm = algorithm; + _isis_spftree_init(tree); + return tree; } -void isis_spftree_del(struct isis_spftree *spftree) +static void _isis_spftree_del(struct isis_spftree *spftree) { hash_clean_and_free(&spftree->prefix_sids, NULL); isis_zebra_rlfa_unregister_all(spftree); @@ -384,6 +392,12 @@ void isis_spftree_del(struct isis_spftree *spftree) isis_vertex_queue_free(&spftree->paths); isis_route_table_info_free(spftree->route_table->info); isis_route_table_info_free(spftree->route_table_backup->info); +} + +void isis_spftree_del(struct isis_spftree *spftree) +{ + _isis_spftree_del(spftree); + route_table_finish(spftree->route_table); route_table_finish(spftree->route_table_backup); spftree->route_table = NULL; @@ -392,6 +406,14 @@ void isis_spftree_del(struct isis_spftree *spftree) return; } +#ifndef FABRICD +static void isis_spftree_clear(struct isis_spftree *spftree) +{ + _isis_spftree_del(spftree); + _isis_spftree_init(spftree); +} +#endif /* ifndef FABRICD */ + static void isis_spftree_adj_del(struct isis_spftree *spftree, struct isis_adjacency *adj) { @@ -594,6 +616,15 @@ isis_spf_add2tent(struct isis_spftree *spftree, enum vertextype vtype, void *id, if (vertex->N.ip.sr.label != MPLS_INVALID_LABEL) vertex->N.ip.sr.present = true; +#ifndef FABRICD + if (flex_algo_id_valid(spftree->algorithm) && + !isis_flex_algo_elected_supported( + spftree->algorithm, spftree->area)) { + vertex->N.ip.sr.present = false; + vertex->N.ip.sr.label = MPLS_INVALID_LABEL; + } +#endif /* ifndef FABRICD */ + (void)hash_get(spftree->prefix_sids, vertex, hash_alloc_intern); } @@ -895,6 +926,16 @@ lspfragloop: && !memcmp(er->id, null_sysid, ISIS_SYS_ID_LEN)) continue; +#ifndef FABRICD + + if (flex_algo_id_valid(spftree->algorithm) && + (!sr_algorithm_participated( + lsp, spftree->algorithm) || + isis_flex_algo_constraint_drop(spftree, + lsp, er))) + continue; +#endif /* ifndef FABRICD */ + dist = cost + (CHECK_FLAG(spftree->flags, F_SPFTREE_HOPCOUNT_METRIC) @@ -975,6 +1016,17 @@ lspfragloop: spftree->algorithm) continue; +#ifndef FABRICD + if (flex_algo_id_valid( + spftree->algorithm) && + (!sr_algorithm_participated( + lsp, spftree->algorithm) || + !isis_flex_algo_elected_supported( + spftree->algorithm, + spftree->area))) + continue; +#endif /* ifndef FABRICD */ + has_valid_psid = true; process_N(spftree, VTYPE_IPREACH_TE, &ip_info, dist, depth + 1, @@ -1044,6 +1096,17 @@ lspfragloop: spftree->algorithm) continue; +#ifndef FABRICD + if (flex_algo_id_valid( + spftree->algorithm) && + (!sr_algorithm_participated( + lsp, spftree->algorithm) || + !isis_flex_algo_elected_supported( + spftree->algorithm, + spftree->area))) + continue; +#endif /* ifndef FABRICD */ + has_valid_psid = true; process_N(spftree, vtype, &ip_info, dist, depth + 1, psid, @@ -1428,6 +1491,19 @@ static void spf_adj_list_parse_lsp(struct isis_spftree *spftree, for (struct isis_extended_reach *reach = (struct isis_extended_reach *)head; reach; reach = reach->next) { +#ifndef FABRICD + /* + * cutting out adjacency by flex-algo link + * affinity attribute + */ + if (flex_algo_id_valid(spftree->algorithm) && + (!sr_algorithm_participated( + lsp, spftree->algorithm) || + isis_flex_algo_constraint_drop( + spftree, lsp, reach))) + continue; +#endif /* ifndef FABRICD */ + spf_adj_list_parse_tlv( spftree, adj_list, reach->id, pseudo_nodeid, pseudo_metric, @@ -1783,6 +1859,27 @@ void isis_run_spf(struct isis_spftree *spftree) exit(1); } +#ifndef FABRICD + /* If a node is configured to participate in a particular Flexible- + * Algorithm, but there is no valid Flex-Algorithm definition available + * for it, or the selected Flex-Algorithm definition includes + * calculation-type, metric-type, constraint, flag, or Sub-TLV that is + * not supported by the node, it MUST stop participating in such + * Flexible-Algorithm. + */ + if (flex_algo_id_valid(spftree->algorithm) && + !isis_flex_algo_elected_supported(spftree->algorithm, + spftree->area)) { + if (!CHECK_FLAG(spftree->flags, F_SPFTREE_DISABLED)) { + isis_spftree_clear(spftree); + SET_FLAG(spftree->flags, F_SPFTREE_DISABLED); + lsp_regenerate_schedule(spftree->area, + spftree->area->is_type, 0); + } + goto out; + } +#endif /* ifndef FABRICD */ + /* * C.2.5 Step 0 */ @@ -1803,6 +1900,18 @@ void isis_run_spf(struct isis_spftree *spftree) } isis_spf_loop(spftree, spftree->sysid); + + +#ifndef FABRICD + /* flex-algo */ + if (CHECK_FLAG(spftree->flags, F_SPFTREE_DISABLED)) { + UNSET_FLAG(spftree->flags, F_SPFTREE_DISABLED); + lsp_regenerate_schedule(spftree->area, spftree->area->is_type, + 0); + } + +out: +#endif /* ifndef FABRICD */ spftree->runcount++; spftree->last_run_timestamp = time(NULL); spftree->last_run_monotime = monotime(&time_end); @@ -1872,6 +1981,12 @@ static void isis_run_spf_cb(struct event *thread) struct isis_area *area = run->area; int level = run->level; int have_run = 0; + struct listnode *node; + struct isis_circuit *circuit; +#ifndef FABRICD + struct flex_algo *fa; + struct isis_flex_algo_data *data; +#endif /* ifndef FABRICD */ XFREE(MTYPE_ISIS_SPF_RUN, run); @@ -1892,11 +2007,27 @@ static void isis_run_spf_cb(struct event *thread) if (area->ip_circuits) { isis_run_spf_with_protection( area, area->spftree[SPFTREE_IPV4][level - 1]); +#ifndef FABRICD + for (ALL_LIST_ELEMENTS_RO(area->flex_algos->flex_algos, node, + fa)) { + data = fa->data; + isis_run_spf_with_protection( + area, data->spftree[SPFTREE_IPV4][level - 1]); + } +#endif /* ifndef FABRICD */ have_run = 1; } if (area->ipv6_circuits) { isis_run_spf_with_protection( area, area->spftree[SPFTREE_IPV6][level - 1]); +#ifndef FABRICD + for (ALL_LIST_ELEMENTS_RO(area->flex_algos->flex_algos, node, + fa)) { + data = fa->data; + isis_run_spf_with_protection( + area, data->spftree[SPFTREE_IPV6][level - 1]); + } +#endif /* ifndef FABRICD */ have_run = 1; } if (area->ipv6_circuits && isis_area_ipv6_dstsrc_enabled(area)) { @@ -1911,8 +2042,6 @@ static void isis_run_spf_cb(struct event *thread) isis_area_verify_routes(area); /* walk all circuits and reset any spf specific flags */ - struct listnode *node; - struct isis_circuit *circuit; for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit)) UNSET_FLAG(circuit->flags, ISIS_CIRCUIT_FLAPPED_AFTER_SPF); diff --git a/isisd/isis_spf_private.h b/isisd/isis_spf_private.h index 5f926df70..763673063 100644 --- a/isisd/isis_spf_private.h +++ b/isisd/isis_spf_private.h @@ -355,6 +355,10 @@ struct isis_spftree { #define F_SPFTREE_HOPCOUNT_METRIC 0x01 #define F_SPFTREE_NO_ROUTES 0x02 #define F_SPFTREE_NO_ADJACENCIES 0x04 +#ifndef FABRICD +/* flex-algo */ +#define F_SPFTREE_DISABLED 0x08 +#endif /* ifndef FABRICD */ __attribute__((__unused__)) static void isis_vertex_id_init(struct isis_vertex *vertex, const void *id, diff --git a/isisd/isisd.c b/isisd/isisd.c index 6c4cdfb95..195f9f16f 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -3069,12 +3069,27 @@ int isis_area_passwd_hmac_md5_set(struct isis_area *area, int level, void isis_area_invalidate_routes(struct isis_area *area, int levels) { +#ifndef FABRICD + struct flex_algo *fa; + struct listnode *node; + struct isis_flex_algo_data *data; +#endif /* ifndef FABRICD */ + for (int level = ISIS_LEVEL1; level <= ISIS_LEVEL2; level++) { if (!(level & levels)) continue; for (int tree = SPFTREE_IPV4; tree < SPFTREE_COUNT; tree++) { isis_spf_invalidate_routes( area->spftree[tree][level - 1]); + +#ifndef FABRICD + for (ALL_LIST_ELEMENTS_RO(area->flex_algos->flex_algos, + node, fa)) { + data = fa->data; + isis_spf_invalidate_routes( + data->spftree[tree][level - 1]); + } +#endif /* ifndef FABRICD */ } } } @@ -3106,6 +3121,12 @@ void isis_area_switchover_routes(struct isis_area *area, int family, static void area_resign_level(struct isis_area *area, int level) { +#ifndef FABRICD + struct flex_algo *fa; + struct listnode *node; + struct isis_flex_algo_data *data; +#endif /* ifndef FABRICD */ + isis_area_invalidate_routes(area, level); isis_area_verify_routes(area); @@ -3118,6 +3139,20 @@ static void area_resign_level(struct isis_area *area, int level) } } +#ifndef FABRICD + for (int tree = SPFTREE_IPV4; tree < SPFTREE_COUNT; tree++) { + for (ALL_LIST_ELEMENTS_RO(area->flex_algos->flex_algos, node, + fa)) { + data = fa->data; + if (data->spftree[level - 1]) { + isis_spftree_del( + data->spftree[tree][level - 1]); + data->spftree[tree][level - 1] = NULL; + } + } + } +#endif /* ifndef FABRICD */ + if (area->spf_timer[level - 1]) isis_spf_timer_free(EVENT_ARG(area->spf_timer[level - 1])); From 80ef2e89eeba4924cdd712535cf87e2a7ef4a49f Mon Sep 17 00:00:00 2001 From: Hiroki Shirokura Date: Fri, 21 Jan 2022 16:02:54 +0000 Subject: [PATCH 23/41] isisd: merge algorithm tables Create a temporary "merge" route table that contains the routing information from all algorithms and install the merge route table into the FIB. Signed-off-by: Hiroki Shirokura Signed-off-by: Louis Scalbert --- isisd/isis_route.c | 69 ++++++++++++++++++++++++++++++++++------------ isisd/isis_route.h | 4 +-- isisd/isis_spf.c | 9 +++--- isisd/isis_spf.h | 4 +-- isisd/isisd.c | 2 +- 5 files changed, 61 insertions(+), 27 deletions(-) diff --git a/isisd/isis_route.c b/isisd/isis_route.c index 3191dfa4f..3983c704c 100644 --- a/isisd/isis_route.c +++ b/isisd/isis_route.c @@ -36,6 +36,7 @@ #include "isis_spf_private.h" #include "isis_route.h" #include "isis_zebra.h" +#include "isis_flex_algo.h" DEFINE_MTYPE_STATIC(ISISD, ISIS_NEXTHOP, "ISIS nexthop"); DEFINE_MTYPE_STATIC(ISISD, ISIS_ROUTE_INFO, "ISIS route info"); @@ -725,7 +726,7 @@ static void _isis_route_verify_table(struct isis_area *area, if (CHECK_FLAG(rinfo->flag, ISIS_ROUTE_FLAG_ACTIVE)) continue; - /* Area is either L1 or L2 => we use level route tables + /* In case the verify is not for a merge, we use a single table * directly for * validating => no problems with deleting routes. */ if (!tables) { @@ -733,13 +734,12 @@ static void _isis_route_verify_table(struct isis_area *area, continue; } - /* If area is L1L2, we work with merge table and - * therefore must - * delete node from level tables as well before deleting + /* If we work on a merged table, + * therefore we must + * delete node from each table as well before deleting * route info. */ - for (int level = ISIS_LEVEL1; level <= ISIS_LEVEL2; level++) { - drnode = srcdest_rnode_lookup(tables[level - 1], - dst_p, src_p); + for (int i = 0; tables[i]; i++) { + drnode = srcdest_rnode_lookup(tables[i], dst_p, src_p); if (!drnode) continue; @@ -756,10 +756,36 @@ static void _isis_route_verify_table(struct isis_area *area, } } +static void _isis_route_verify_merge(struct isis_area *area, + struct route_table **tables, + struct route_table **tables_backup, + int tree); + void isis_route_verify_table(struct isis_area *area, struct route_table *table, - struct route_table *table_backup) + struct route_table *table_backup, int tree) { - _isis_route_verify_table(area, table, table_backup, NULL); + struct route_table *tables[SR_ALGORITHM_COUNT] = {table}; + struct route_table *tables_backup[SR_ALGORITHM_COUNT] = {table_backup}; +#ifndef FABRICD + int tables_next = 1; + int level = area->is_type == IS_LEVEL_1 ? ISIS_LEVEL1 : ISIS_LEVEL2; + struct listnode *node; + struct flex_algo *fa; + struct isis_flex_algo_data *data; + + for (ALL_LIST_ELEMENTS_RO(area->flex_algos->flex_algos, node, fa)) { + data = fa->data; + tables[tables_next] = + data->spftree[tree][level - 1]->route_table; + tables_backup[tables_next] = + data->spftree[tree][level - 1]->route_table_backup; + _isis_route_verify_table(area, tables[tables_next], + tables_backup[tables_next], NULL); + tables_next++; + } +#endif /* ifndef FABRICD */ + + _isis_route_verify_merge(area, tables, tables_backup, tree); } /* Function to validate route tables for L1L2 areas. In this case we can't use @@ -776,20 +802,27 @@ void isis_route_verify_merge(struct isis_area *area, struct route_table *level1_table, struct route_table *level1_table_backup, struct route_table *level2_table, - struct route_table *level2_table_backup) + struct route_table *level2_table_backup, int tree) { - struct route_table *tables[] = {level1_table, level2_table}; + struct route_table *tables[] = {level1_table, level2_table, NULL}; struct route_table *tables_backup[] = {level1_table_backup, - level2_table_backup}; + level2_table_backup, NULL}; + _isis_route_verify_merge(area, tables, tables_backup, tree); +} + +static void _isis_route_verify_merge(struct isis_area *area, + struct route_table **tables, + struct route_table **tables_backup, + int tree) +{ struct route_table *merge; struct route_node *rnode, *mrnode; merge = srcdest_table_init(); - for (int level = ISIS_LEVEL1; level <= ISIS_LEVEL2; level++) { - uint8_t algorithm = - isis_route_table_algorithm(tables[level - 1]); - for (rnode = route_top(tables[level - 1]); rnode; + for (int i = 0; tables[i]; i++) { + uint8_t algorithm = isis_route_table_algorithm(tables[i]); + for (rnode = route_top(tables[i]); rnode; rnode = srcdest_route_next(rnode)) { struct isis_route_info *rinfo = rnode->info; struct route_node *rnode_bck; @@ -805,8 +838,8 @@ void isis_route_verify_merge(struct isis_area *area, (const struct prefix **)&src_p); /* Link primary route to backup route. */ - rnode_bck = srcdest_rnode_lookup( - tables_backup[level - 1], prefix, src_p); + rnode_bck = srcdest_rnode_lookup(tables_backup[i], + prefix, src_p); if (rnode_bck) { rinfo->backup = rnode_bck->info; rinfo->sr_algo[algorithm].nexthops_backup = diff --git a/isisd/isis_route.h b/isisd/isis_route.h index 79b604b77..4d49a5ae9 100644 --- a/isisd/isis_route.h +++ b/isisd/isis_route.h @@ -60,14 +60,14 @@ void isis_route_delete(struct isis_area *area, struct route_node *rode, /* Walk the given table and install new routes to zebra and remove old ones. * route status is tracked using ISIS_ROUTE_FLAG_ACTIVE */ void isis_route_verify_table(struct isis_area *area, struct route_table *table, - struct route_table *table_backup); + struct route_table *table_backup, int tree); /* Same as isis_route_verify_table, but merge L1 and L2 routes before */ void isis_route_verify_merge(struct isis_area *area, struct route_table *level1_table, struct route_table *level1_table_backup, struct route_table *level2_table, - struct route_table *level2_table_backup); + struct route_table *level2_table_backup, int tree); /* Unset ISIS_ROUTE_FLAG_ACTIVE on all routes. Used before running spf. */ void isis_route_invalidate_table(struct isis_area *area, diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index cc8c5168e..faaf8d94d 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -1933,19 +1933,20 @@ static void isis_run_spf_with_protection(struct isis_area *area, isis_spf_run_lfa(area, spftree); } -void isis_spf_verify_routes(struct isis_area *area, struct isis_spftree **trees) +void isis_spf_verify_routes(struct isis_area *area, struct isis_spftree **trees, + int tree) { if (area->is_type == IS_LEVEL_1) { isis_route_verify_table(area, trees[0]->route_table, - trees[0]->route_table_backup); + trees[0]->route_table_backup, tree); } else if (area->is_type == IS_LEVEL_2) { isis_route_verify_table(area, trees[1]->route_table, - trees[1]->route_table_backup); + trees[1]->route_table_backup, tree); } else { isis_route_verify_merge(area, trees[0]->route_table, trees[0]->route_table_backup, trees[1]->route_table, - trees[1]->route_table_backup); + trees[1]->route_table_backup, tree); } } diff --git a/isisd/isis_spf.h b/isisd/isis_spf.h index bf79a084b..9af4d1bdc 100644 --- a/isisd/isis_spf.h +++ b/isisd/isis_spf.h @@ -44,8 +44,8 @@ isis_spftree_new(struct isis_area *area, struct lspdb_head *lspdb, struct isis_vertex *isis_spf_prefix_sid_lookup(struct isis_spftree *spftree, struct isis_prefix_sid *psid); void isis_spf_invalidate_routes(struct isis_spftree *tree); -void isis_spf_verify_routes(struct isis_area *area, - struct isis_spftree **trees); +void isis_spf_verify_routes(struct isis_area *area, struct isis_spftree **trees, + int tree); void isis_spf_switchover_routes(struct isis_area *area, struct isis_spftree **trees, int family, union g_addr *nexthop_ip, ifindex_t ifindex, diff --git a/isisd/isisd.c b/isisd/isisd.c index 195f9f16f..e4689b032 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -3097,7 +3097,7 @@ void isis_area_invalidate_routes(struct isis_area *area, int levels) void isis_area_verify_routes(struct isis_area *area) { for (int tree = SPFTREE_IPV4; tree < SPFTREE_COUNT; tree++) - isis_spf_verify_routes(area, area->spftree[tree]); + isis_spf_verify_routes(area, area->spftree[tree], tree); } void isis_area_switchover_routes(struct isis_area *area, int family, From 224eadd955b37d6eee501cecf85498eac3ad8d5b Mon Sep 17 00:00:00 2001 From: Eric Kinzie Date: Fri, 1 Apr 2022 00:47:30 +0000 Subject: [PATCH 24/41] isisd: fix merging flex-algo route nodes As isis_route_verify_merge() builds a new route table, each (src,dst) new node in the table is created by merging data from the same (src,dst) pair present in all route tables. However, as it iterates over those route nodes and copies SR data into the newly created node, it repeatedly overwrites the isis_route_info pointer. This, in turn, pollutes the isis_route_info structures in all of the other tables with partially updated SR data. After a route is deleted, this leaves pointers to freed memory in one of the route trees. Fixes: 26b0598f6b6f ("isisd: fix isis_route_merge_verify logic") Signed-off-by: Eric Kinzie --- isisd/isis_route.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/isisd/isis_route.c b/isisd/isis_route.c index 3983c704c..be92dcc22 100644 --- a/isisd/isis_route.c +++ b/isisd/isis_route.c @@ -889,8 +889,9 @@ static void _isis_route_verify_merge(struct isis_area *area, ISIS_ROUTE_FLAG_ZEBRA_SYNCED)) { continue; } + } else { + mrnode->info = rnode->info; } - mrnode->info = rnode->info; } } From 6f9598d1406246bd0b966e041f1caeccef138c6d Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Mon, 12 Dec 2022 17:22:56 +0100 Subject: [PATCH 25/41] isisd: add support of (ti-)lfa to flex-algo Add support of (ti-)lfa to flex-algo Signed-off-by: Louis Scalbert --- isisd/isis_lfa.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/isisd/isis_lfa.c b/isisd/isis_lfa.c index baec1ff87..6f21f4cea 100644 --- a/isisd/isis_lfa.c +++ b/isisd/isis_lfa.c @@ -355,6 +355,7 @@ bool isis_lfa_excise_node_check(const struct isis_spftree *spftree, struct tilfa_find_pnode_prefix_sid_args { uint32_t sid_index; + int algorithm; }; static int tilfa_find_pnode_prefix_sid_cb(const struct prefix *prefix, @@ -368,15 +369,17 @@ static int tilfa_find_pnode_prefix_sid_cb(const struct prefix *prefix, if (!subtlvs || subtlvs->prefix_sids.count == 0) return LSP_ITER_CONTINUE; - psid = (struct isis_prefix_sid *)subtlvs->prefix_sids.head; - - /* Require the node flag to be set. */ - if (!CHECK_FLAG(psid->flags, ISIS_PREFIX_SID_NODE)) - return LSP_ITER_CONTINUE; - - args->sid_index = psid->value; - - return LSP_ITER_STOP; + for (psid = (struct isis_prefix_sid *)subtlvs->prefix_sids.head; psid; + psid = psid->next) { + /* Require the node flag to be set. */ + if (!CHECK_FLAG(psid->flags, ISIS_PREFIX_SID_NODE)) + continue; + if (psid->algorithm != args->algorithm) + continue; + args->sid_index = psid->value; + return LSP_ITER_STOP; + } + return LSP_ITER_CONTINUE; } /* Find Prefix-SID associated to a System ID. */ @@ -390,6 +393,8 @@ static uint32_t tilfa_find_pnode_prefix_sid(struct isis_spftree *spftree, if (!lsp) return UINT32_MAX; + args.algorithm = spftree->algorithm; + args.sid_index = UINT32_MAX; isis_lsp_iterate_ip_reach(lsp, spftree->family, spftree->mtid, tilfa_find_pnode_prefix_sid_cb, &args); @@ -1099,7 +1104,7 @@ struct isis_spftree *isis_spf_reverse_run(const struct isis_spftree *spftree) spftree->area, spftree->lspdb, spftree->sysid, spftree->level, spftree->tree_id, SPF_TYPE_REVERSE, F_SPFTREE_NO_ADJACENCIES | F_SPFTREE_NO_ROUTES, - SR_ALGORITHM_SPF); + spftree->algorithm); isis_run_spf(spftree_reverse); return spftree_reverse; @@ -1196,7 +1201,7 @@ struct isis_spftree *isis_tilfa_compute(struct isis_area *area, spftree_pc = isis_spftree_new(area, spftree->lspdb, spftree->sysid, spftree->level, spftree->tree_id, SPF_TYPE_TI_LFA, spftree->flags, - SR_ALGORITHM_SPF); + spftree->algorithm); spftree_pc->lfa.old.spftree = spftree; spftree_pc->lfa.old.spftree_reverse = spftree_reverse; spftree_pc->lfa.protected_resource = *resource; @@ -1245,7 +1250,7 @@ int isis_spf_run_neighbors(struct isis_spftree *spftree) spftree->area, spftree->lspdb, adj_node->sysid, spftree->level, spftree->tree_id, SPF_TYPE_FORWARD, F_SPFTREE_NO_ADJACENCIES | F_SPFTREE_NO_ROUTES, - SR_ALGORITHM_SPF); + spftree->algorithm); isis_run_spf(adj_node->lfa.spftree); } @@ -1726,7 +1731,7 @@ struct isis_spftree *isis_rlfa_compute(struct isis_area *area, spftree_pc = isis_spftree_new(area, spftree->lspdb, spftree->sysid, spftree->level, spftree->tree_id, SPF_TYPE_RLFA, spftree->flags, - SR_ALGORITHM_SPF); + spftree->algorithm); spftree_pc->lfa.old.spftree = spftree; spftree_pc->lfa.old.spftree_reverse = spftree_reverse; spftree_pc->lfa.remote.max_metric = max_metric; From 9a65cf35da1d5653202a5355d60663a408ebdfa3 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Thu, 10 Nov 2022 16:36:08 +0100 Subject: [PATCH 26/41] isisd: add affinity-map configuration hooks Add affinity-map hooks to check the utilization of affinity-map in flex-algo contexts before its deletion and to update local TLVs when the affinity-map bit-position is updated. Signed-off-by: Louis Scalbert --- isisd/isis_affinitymap.c | 91 ++++++++++++++++++++++++++++++++++++++++ isisd/isis_affinitymap.h | 25 +++++++++++ isisd/isis_main.c | 5 ++- isisd/subdir.am | 2 + 4 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 isisd/isis_affinitymap.c create mode 100644 isisd/isis_affinitymap.h diff --git a/isisd/isis_affinitymap.c b/isisd/isis_affinitymap.c new file mode 100644 index 000000000..e681e820b --- /dev/null +++ b/isisd/isis_affinitymap.c @@ -0,0 +1,91 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* IS-IS affinity-map + * Copyright 2023 6WIND S.A. + */ + +#include +#include "lib/if.h" +#include "lib/vrf.h" +#include "isisd/isisd.h" +#include "isisd/isis_affinitymap.h" + +#ifndef FABRICD + +static bool isis_affinity_map_check_use(const char *affmap_name) +{ + struct isis *isis = isis_lookup_by_vrfid(VRF_DEFAULT); + struct isis_area *area; + struct listnode *area_node, *fa_node; + struct flex_algo *fa; + struct affinity_map *map; + uint16_t pos; + + map = affinity_map_get(affmap_name); + pos = map->bit_position; + + for (ALL_LIST_ELEMENTS_RO(isis->area_list, area_node, area)) { + for (ALL_LIST_ELEMENTS_RO(area->flex_algos->flex_algos, fa_node, + fa)) { + if (admin_group_get(&fa->admin_group_exclude_any, + pos) || + admin_group_get(&fa->admin_group_include_any, + pos) || + admin_group_get(&fa->admin_group_include_all, pos)) + return true; + } + } + return false; +} + +static void isis_affinity_map_update(const char *affmap_name, uint16_t old_pos, + uint16_t new_pos) +{ + struct isis *isis = isis_lookup_by_vrfid(VRF_DEFAULT); + struct listnode *area_node, *fa_node; + struct isis_area *area; + struct flex_algo *fa; + bool changed; + + for (ALL_LIST_ELEMENTS_RO(isis->area_list, area_node, area)) { + changed = false; + for (ALL_LIST_ELEMENTS_RO(area->flex_algos->flex_algos, fa_node, + fa)) { + if (admin_group_get(&fa->admin_group_exclude_any, + old_pos)) { + admin_group_unset(&fa->admin_group_exclude_any, + old_pos); + admin_group_set(&fa->admin_group_exclude_any, + new_pos); + changed = true; + } + if (admin_group_get(&fa->admin_group_include_any, + old_pos)) { + admin_group_unset(&fa->admin_group_include_any, + old_pos); + admin_group_set(&fa->admin_group_include_any, + new_pos); + changed = true; + } + if (admin_group_get(&fa->admin_group_include_all, + old_pos)) { + admin_group_unset(&fa->admin_group_include_all, + old_pos); + admin_group_set(&fa->admin_group_include_all, + new_pos); + changed = true; + } + } + if (changed) + lsp_regenerate_schedule(area, area->is_type, 0); + } +} + +void isis_affinity_map_init(void) +{ + affinity_map_init(); + + affinity_map_set_check_use_hook(isis_affinity_map_check_use); + affinity_map_set_update_hook(isis_affinity_map_update); +} + +#endif /* ifndef FABRICD */ diff --git a/isisd/isis_affinitymap.h b/isisd/isis_affinitymap.h new file mode 100644 index 000000000..c432e99f5 --- /dev/null +++ b/isisd/isis_affinitymap.h @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* IS-IS affinity-map header + * Copyright 2023 6WIND S.A. + */ + +#ifndef __ISIS_AFFINITYMAP_H__ +#define __ISIS_AFFINITYMAP_H__ + +#include "lib/affinitymap.h" + +#ifndef FABRICD + +#ifdef __cplusplus +extern "C" { +#endif + +extern void isis_affinity_map_init(void); + +#ifdef __cplusplus +} +#endif + +#endif /* ifndef FABRICD */ + +#endif /* __ISIS_AFFINITYMAP_H__ */ diff --git a/isisd/isis_main.c b/isisd/isis_main.c index 2f4e4e0bd..8e40882e5 100644 --- a/isisd/isis_main.c +++ b/isisd/isis_main.c @@ -29,6 +29,7 @@ #include "routemap.h" #include "affinitymap.h" +#include "isisd/isis_affinitymap.h" #include "isisd/isis_constants.h" #include "isisd/isis_common.h" #include "isisd/isis_flags.h" @@ -290,7 +291,9 @@ int main(int argc, char **argv, char **envp) lsp_init(); mt_init(); - affinity_map_init(); +#ifndef FABRICD + isis_affinity_map_init(); +#endif /* ifndef FABRICD */ isis_zebra_init(master, instance); isis_bfd_init(master); diff --git a/isisd/subdir.am b/isisd/subdir.am index 49e252c85..6bd2477b1 100644 --- a/isisd/subdir.am +++ b/isisd/subdir.am @@ -19,6 +19,7 @@ vtysh_daemons += fabricd endif noinst_HEADERS += \ + isisd/isis_affinitymap.h \ isisd/isis_adjacency.h \ isisd/isis_bfd.h \ isisd/isis_circuit.h \ @@ -56,6 +57,7 @@ noinst_HEADERS += \ # end LIBISIS_SOURCES = \ + isisd/isis_affinitymap.c \ isisd/isis_adjacency.c \ isisd/isis_bfd.c \ isisd/isis_circuit.c \ From 72b295f6400a7f1d310aeaa7902d9e1b783df459 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Mon, 27 Feb 2023 14:51:53 +0100 Subject: [PATCH 27/41] isisd: fix typo in indef fabricd comment fix typo in indef fabricd comment Fixes: 20bd27e2aa ("isisd, yang: add configuration model and callback stubs") Signed-off-by: Louis Scalbert --- isisd/isis_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/isisd/isis_main.c b/isisd/isis_main.c index 8e40882e5..385cdcc35 100644 --- a/isisd/isis_main.c +++ b/isisd/isis_main.c @@ -282,7 +282,7 @@ int main(int argc, char **argv, char **envp) #endif /* FABRICD */ #ifndef FABRICD isis_cli_init(); -#endif /* ifdef FABRICD */ +#endif /* ifndef FABRICD */ isis_spf_init(); isis_redist_init(); isis_route_map_init(); From 06ddebc822aea825b26eece86e440106e13f6b6d Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Mon, 27 Feb 2023 16:54:09 +0100 Subject: [PATCH 28/41] isisd: clarify ifdef fabricd clarify ifdef fabricd Signed-off-by: Louis Scalbert --- isisd/isisd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/isisd/isisd.c b/isisd/isisd.c index e4689b032..f65d21405 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -3791,7 +3791,8 @@ struct cmd_node router_node = { .prompt = "%s(config-router)# ", .config_write = isis_config_write, }; -#else +#endif /* ifdef FABRICD */ +#ifndef FABRICD /* IS-IS configuration write function */ static int isis_config_write(struct vty *vty) { @@ -3821,7 +3822,7 @@ struct cmd_node isis_flex_algo_node = { .parent_node = ISIS_NODE, .prompt = "%s(config-router-flex-algo)# ", }; -#endif /* ifdef FABRICD */ +#endif /* ifdnef FABRICD */ void isis_init(void) { From 42bf1afa5a06926839fb4ccf0bab27aa1a956bae Mon Sep 17 00:00:00 2001 From: Eric Kinzie Date: Fri, 2 Sep 2022 16:33:21 +0200 Subject: [PATCH 29/41] lib: convert termtable to json Add a function that returns a JSON-C structure containing a representation of a termtable. This is intended to be a quick way to implement JSON output to CLI commands. Signed-off-by: Eric Kinzie --- lib/termtable.c | 43 +++++++++++++++++++++++++++++++++++++++++++ lib/termtable.h | 12 ++++++++++++ 2 files changed, 55 insertions(+) diff --git a/lib/termtable.c b/lib/termtable.c index 30f1ab74c..9b36d5ebf 100644 --- a/lib/termtable.c +++ b/lib/termtable.c @@ -7,6 +7,7 @@ #include #include +#include "lib/json.h" #include "printfrr.h" #include "memory.h" #include "termtable.h" @@ -485,3 +486,45 @@ char *ttable_dump(struct ttable *tt, const char *newline) return buf; } + +/* Crude conversion from ttable to json array. + * Assume that the first row has column headings. + * + * Formats are: + * d int32 + * f double + * l int64 + * s string (default) + */ +json_object *ttable_json(struct ttable *tt, const char *const formats) +{ + struct ttable_cell *row; /* iteration pointers */ + json_object *json = NULL; + + json = json_object_new_array(); + + for (int i = 1; i < tt->nrows; i++) { + json_object *jobj; + json_object *val; + + row = tt->table[i]; + jobj = json_object_new_object(); + json_object_array_add(json, jobj); + for (int j = 0; j < tt->ncols; j++) { + switch (formats[j]) { + case 'd': + case 'l': + val = json_object_new_int64(atol(row[j].text)); + break; + case 'f': + val = json_object_new_double(atof(row[j].text)); + break; + default: + val = json_object_new_string(row[j].text); + } + json_object_object_add(jobj, tt->table[0][j].text, val); + } + } + + return json; +} diff --git a/lib/termtable.h b/lib/termtable.h index 3aa8caee8..7258682bd 100644 --- a/lib/termtable.h +++ b/lib/termtable.h @@ -8,6 +8,7 @@ #define _TERMTABLE_H_ #include +#include "lib/json.h" #ifdef __cplusplus extern "C" { @@ -277,6 +278,17 @@ void ttable_rowseps(struct ttable *tt, unsigned int row, */ char *ttable_dump(struct ttable *tt, const char *newline); +/** + * Convert a table to a JSON array of objects. + * + * Caller must free the returned json_object structure. + * + * @param tt the table to convert + * @param formats an array of characters indicating what JSON type should be + * used. + */ +json_object *ttable_json(struct ttable *tt, const char *const formats); + #ifdef __cplusplus } #endif From a0f45d1b5fc475b0b5756063b2d2963ec6793964 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Mon, 12 Sep 2022 14:57:51 +0200 Subject: [PATCH 30/41] isisd: show non-zero algos in "show isis route prefix-sid" (1/2) Change the indentation to facilitate the reading of next commit. No change on code. Signed-off-by: Louis Scalbert --- isisd/isis_spf.c | 146 +++++++++++++++++++++++------------------------ 1 file changed, 73 insertions(+), 73 deletions(-) diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index faaf8d94d..9560e0c67 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -2355,87 +2355,87 @@ static void isis_print_route(struct ttable *tt, const struct prefix *prefix, char buf_prefix[BUFSIZ]; (void)prefix2str(prefix, buf_prefix, sizeof(buf_prefix)); - for (ALL_LIST_ELEMENTS_RO(rinfo->nexthops, node, nexthop)) { - struct interface *ifp; - char buf_iface[BUFSIZ]; - char buf_nhop[BUFSIZ]; + for (ALL_LIST_ELEMENTS_RO(rinfo->nexthops, node, nexthop)) { + struct interface *ifp; + char buf_iface[BUFSIZ]; + char buf_nhop[BUFSIZ]; - if (!no_adjacencies) { - inet_ntop(nexthop->family, &nexthop->ip, buf_nhop, - sizeof(buf_nhop)); - ifp = if_lookup_by_index(nexthop->ifindex, VRF_DEFAULT); - if (ifp) - strlcpy(buf_iface, ifp->name, - sizeof(buf_iface)); - else - snprintf(buf_iface, sizeof(buf_iface), - "ifindex %u", nexthop->ifindex); - } else { - strlcpy(buf_nhop, print_sys_hostname(nexthop->sysid), - sizeof(buf_nhop)); - strlcpy(buf_iface, "-", sizeof(buf_iface)); - } - - if (prefix_sid) { - char buf_sid[BUFSIZ] = {}; - char buf_lblop[BUFSIZ] = {}; - - if (nexthop->sr.present) { - snprintf(buf_sid, sizeof(buf_sid), "%u", - nexthop->sr.sid.value); - sr_op2str( - buf_lblop, sizeof(buf_lblop), - rinfo->sr_algo[SR_ALGORITHM_SPF].label, - nexthop->sr.label); + if (!no_adjacencies) { + inet_ntop(nexthop->family, &nexthop->ip, buf_nhop, + sizeof(buf_nhop)); + ifp = if_lookup_by_index(nexthop->ifindex, VRF_DEFAULT); + if (ifp) + strlcpy(buf_iface, ifp->name, + sizeof(buf_iface)); + else + snprintf(buf_iface, sizeof(buf_iface), + "ifindex %u", nexthop->ifindex); } else { - strlcpy(buf_sid, "-", sizeof(buf_sid)); - strlcpy(buf_lblop, "-", sizeof(buf_lblop)); + strlcpy(buf_nhop, print_sys_hostname(nexthop->sysid), + sizeof(buf_nhop)); + strlcpy(buf_iface, "-", sizeof(buf_iface)); } - if (first) { - ttable_add_row(tt, "%s|%u|%s|%s|%s|%s", - buf_prefix, rinfo->cost, - buf_iface, buf_nhop, buf_sid, - buf_lblop); - first = false; - } else - ttable_add_row(tt, "||%s|%s|%s|%s", buf_iface, - buf_nhop, buf_sid, buf_lblop); - } else { - char buf_labels[BUFSIZ] = {}; + if (prefix_sid) { + char buf_sid[BUFSIZ] = {}; + char buf_lblop[BUFSIZ] = {}; - if (nexthop->label_stack) { - for (int i = 0; - i < nexthop->label_stack->num_labels; - i++) { - char buf_label[BUFSIZ]; - - label2str( - nexthop->label_stack->label[i], - 0, buf_label, - sizeof(buf_label)); - if (i != 0) - strlcat(buf_labels, "/", - sizeof(buf_labels)); - strlcat(buf_labels, buf_label, - sizeof(buf_labels)); + if (nexthop->sr.present) { + snprintf(buf_sid, sizeof(buf_sid), "%u", + nexthop->sr.sid.value); + sr_op2str( + buf_lblop, sizeof(buf_lblop), + rinfo->sr_algo[SR_ALGORITHM_SPF].label, + nexthop->sr.label); + } else { + strlcpy(buf_sid, "-", sizeof(buf_sid)); + strlcpy(buf_lblop, "-", sizeof(buf_lblop)); } - } else if (nexthop->sr.present) - label2str(nexthop->sr.label, 0, buf_labels, - sizeof(buf_labels)); - else - strlcpy(buf_labels, "-", sizeof(buf_labels)); - if (first) { - ttable_add_row(tt, "%s|%u|%s|%s|%s", buf_prefix, - rinfo->cost, buf_iface, buf_nhop, - buf_labels); - first = false; - } else - ttable_add_row(tt, "||%s|%s|%s", buf_iface, - buf_nhop, buf_labels); + if (first) { + ttable_add_row(tt, "%s|%u|%s|%s|%s|%s", + buf_prefix, rinfo->cost, + buf_iface, buf_nhop, buf_sid, + buf_lblop); + first = false; + } else + ttable_add_row(tt, "||%s|%s|%s|%s", buf_iface, + buf_nhop, buf_sid, buf_lblop); + } else { + char buf_labels[BUFSIZ] = {}; + + if (nexthop->label_stack) { + for (int i = 0; + i < nexthop->label_stack->num_labels; + i++) { + char buf_label[BUFSIZ]; + + label2str( + nexthop->label_stack->label[i], + 0, buf_label, + sizeof(buf_label)); + if (i != 0) + strlcat(buf_labels, "/", + sizeof(buf_labels)); + strlcat(buf_labels, buf_label, + sizeof(buf_labels)); + } + } else if (nexthop->sr.present) + label2str(nexthop->sr.label, 0, buf_labels, + sizeof(buf_labels)); + else + strlcpy(buf_labels, "-", sizeof(buf_labels)); + + if (first) { + ttable_add_row(tt, "%s|%u|%s|%s|%s", buf_prefix, + rinfo->cost, buf_iface, buf_nhop, + buf_labels); + first = false; + } else + ttable_add_row(tt, "||%s|%s|%s", buf_iface, + buf_nhop, buf_labels); + } } - } if (list_isempty(rinfo->nexthops)) { if (prefix_sid) { char buf_sid[BUFSIZ] = {}; From e39af3727e00d0a1262d9d73b3672788d823e8d3 Mon Sep 17 00:00:00 2001 From: Eric Kinzie Date: Fri, 2 Sep 2022 16:33:43 +0200 Subject: [PATCH 31/41] isisd: show non-zero algos in "show isis route prefix-sid" (2/2) Show Prefix-SIDs and labels for all available Flex-Algos. Signed-off-by: Eric Kinzie Signed-off-by: Louis Scalbert --- isisd/isis_spf.c | 86 +++++++++++++++++++++++++++++------------------- 1 file changed, 52 insertions(+), 34 deletions(-) diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index 9560e0c67..30a558a52 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -2355,23 +2355,28 @@ static void isis_print_route(struct ttable *tt, const struct prefix *prefix, char buf_prefix[BUFSIZ]; (void)prefix2str(prefix, buf_prefix, sizeof(buf_prefix)); - for (ALL_LIST_ELEMENTS_RO(rinfo->nexthops, node, nexthop)) { + for (int alg = 0; alg < SR_ALGORITHM_COUNT; alg++) { + for (ALL_LIST_ELEMENTS_RO(rinfo->sr_algo[alg].nexthops, node, + nexthop)) { struct interface *ifp; char buf_iface[BUFSIZ]; char buf_nhop[BUFSIZ]; if (!no_adjacencies) { - inet_ntop(nexthop->family, &nexthop->ip, buf_nhop, - sizeof(buf_nhop)); - ifp = if_lookup_by_index(nexthop->ifindex, VRF_DEFAULT); + inet_ntop(nexthop->family, &nexthop->ip, + buf_nhop, sizeof(buf_nhop)); + ifp = if_lookup_by_index(nexthop->ifindex, + VRF_DEFAULT); if (ifp) strlcpy(buf_iface, ifp->name, sizeof(buf_iface)); else snprintf(buf_iface, sizeof(buf_iface), - "ifindex %u", nexthop->ifindex); + "ifindex %u", + nexthop->ifindex); } else { - strlcpy(buf_nhop, print_sys_hostname(nexthop->sysid), + strlcpy(buf_nhop, + print_sys_hostname(nexthop->sysid), sizeof(buf_nhop)); strlcpy(buf_iface, "-", sizeof(buf_iface)); } @@ -2380,40 +2385,45 @@ static void isis_print_route(struct ttable *tt, const struct prefix *prefix, char buf_sid[BUFSIZ] = {}; char buf_lblop[BUFSIZ] = {}; - if (nexthop->sr.present) { + if (rinfo->sr_algo[alg].present) { snprintf(buf_sid, sizeof(buf_sid), "%u", - nexthop->sr.sid.value); - sr_op2str( - buf_lblop, sizeof(buf_lblop), - rinfo->sr_algo[SR_ALGORITHM_SPF].label, - nexthop->sr.label); - } else { + rinfo->sr_algo[alg].sid.value); + sr_op2str(buf_lblop, sizeof(buf_lblop), + rinfo->sr_algo[alg].label, + nexthop->sr.label); + } else if (alg == SR_ALGORITHM_SPF) { strlcpy(buf_sid, "-", sizeof(buf_sid)); - strlcpy(buf_lblop, "-", sizeof(buf_lblop)); + strlcpy(buf_lblop, "-", + sizeof(buf_lblop)); + } else { + continue; } if (first) { - ttable_add_row(tt, "%s|%u|%s|%s|%s|%s", - buf_prefix, rinfo->cost, - buf_iface, buf_nhop, buf_sid, - buf_lblop); + ttable_add_row(tt, + "%s|%u|%s|%s|%s|%s|%d", + buf_prefix, rinfo->cost, + buf_iface, buf_nhop, + buf_sid, buf_lblop, alg); first = false; } else - ttable_add_row(tt, "||%s|%s|%s|%s", buf_iface, - buf_nhop, buf_sid, buf_lblop); + ttable_add_row(tt, "||%s|%s|%s|%s|%d", + buf_iface, buf_nhop, + buf_sid, buf_lblop, alg); } else { char buf_labels[BUFSIZ] = {}; if (nexthop->label_stack) { for (int i = 0; - i < nexthop->label_stack->num_labels; - i++) { + i < + nexthop->label_stack->num_labels; + i++) { char buf_label[BUFSIZ]; - label2str( - nexthop->label_stack->label[i], - 0, buf_label, - sizeof(buf_label)); + label2str(nexthop->label_stack + ->label[i], + 0, buf_label, + sizeof(buf_label)); if (i != 0) strlcat(buf_labels, "/", sizeof(buf_labels)); @@ -2421,21 +2431,27 @@ static void isis_print_route(struct ttable *tt, const struct prefix *prefix, sizeof(buf_labels)); } } else if (nexthop->sr.present) - label2str(nexthop->sr.label, 0, buf_labels, + label2str(nexthop->sr.label, 0, + buf_labels, sizeof(buf_labels)); else - strlcpy(buf_labels, "-", sizeof(buf_labels)); + strlcpy(buf_labels, "-", + sizeof(buf_labels)); if (first) { - ttable_add_row(tt, "%s|%u|%s|%s|%s", buf_prefix, - rinfo->cost, buf_iface, buf_nhop, - buf_labels); + ttable_add_row(tt, "%s|%u|%s|%s|%s", + buf_prefix, rinfo->cost, + buf_iface, buf_nhop, + buf_labels); first = false; } else - ttable_add_row(tt, "||%s|%s|%s", buf_iface, - buf_nhop, buf_labels); + ttable_add_row(tt, "||%s|%s|%s", + buf_iface, buf_nhop, + buf_labels); } } + } + if (list_isempty(rinfo->nexthops)) { if (prefix_sid) { char buf_sid[BUFSIZ] = {}; @@ -2496,7 +2512,9 @@ void isis_print_routes(struct vty *vty, struct isis_spftree *spftree, /* Prepare table. */ tt = ttable_new(&ttable_styles[TTSTYLE_BLANK]); if (prefix_sid) - ttable_add_row(tt, "Prefix|Metric|Interface|Nexthop|SID|Label Op."); + ttable_add_row( + tt, + "Prefix|Metric|Interface|Nexthop|SID|Label Op.|Algo"); else ttable_add_row(tt, "Prefix|Metric|Interface|Nexthop|Label(s)"); tt->style.cell.rpad = 2; From 42ac4485386e47a2ae2baa24789c0a2ed2f0c393 Mon Sep 17 00:00:00 2001 From: Eric Kinzie Date: Fri, 2 Sep 2022 16:33:52 +0200 Subject: [PATCH 32/41] isisd: add option to display isis routes as json Append an optional parameter to "show isis route [prefix-sid]" that formats the output as a JSON array. Signed-off-by: Eric Kinzie Signed-off-by: Louis Scalbert --- isisd/isis_spf.c | 118 ++++++++++++++++++++++++++++++------ isisd/isis_spf.h | 3 +- tests/isisd/test_isis_spf.c | 12 ++-- 3 files changed, 106 insertions(+), 27 deletions(-) diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index 30a558a52..b94562f6a 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -26,6 +26,7 @@ #include "spf_backoff.h" #include "srcdest_table.h" #include "vrf.h" +#include "lib/json.h" #include "isis_errors.h" #include "isis_constants.h" @@ -2347,7 +2348,7 @@ DEFUN(show_isis_topology, show_isis_topology_cmd, static void isis_print_route(struct ttable *tt, const struct prefix *prefix, struct isis_route_info *rinfo, bool prefix_sid, - bool no_adjacencies) + bool no_adjacencies, bool json) { struct isis_nexthop *nexthop; struct listnode *node; @@ -2399,7 +2400,7 @@ static void isis_print_route(struct ttable *tt, const struct prefix *prefix, continue; } - if (first) { + if (first || json) { ttable_add_row(tt, "%s|%u|%s|%s|%s|%s|%d", buf_prefix, rinfo->cost, @@ -2438,7 +2439,7 @@ static void isis_print_route(struct ttable *tt, const struct prefix *prefix, strlcpy(buf_labels, "-", sizeof(buf_labels)); - if (first) { + if (first || json) { ttable_add_row(tt, "%s|%u|%s|%s|%s", buf_prefix, rinfo->cost, buf_iface, buf_nhop, @@ -2480,7 +2481,7 @@ static void isis_print_route(struct ttable *tt, const struct prefix *prefix, } void isis_print_routes(struct vty *vty, struct isis_spftree *spftree, - bool prefix_sid, bool backup) + struct json_object **json, bool prefix_sid, bool backup) { struct route_table *route_table; struct ttable *tt; @@ -2506,8 +2507,9 @@ void isis_print_routes(struct vty *vty, struct isis_spftree *spftree, return; } - vty_out(vty, "IS-IS %s %s routing table:\n\n", - circuit_t2string(spftree->level), tree_id_text); + if (json == NULL) + vty_out(vty, "IS-IS %s %s routing table:\n\n", + circuit_t2string(spftree->level), tree_id_text); /* Prepare table. */ tt = ttable_new(&ttable_styles[TTSTYLE_BLANK]); @@ -2534,55 +2536,101 @@ void isis_print_routes(struct vty *vty, struct isis_spftree *spftree, if (!rinfo) continue; - isis_print_route(tt, &rn->p, rinfo, prefix_sid, no_adjacencies); + isis_print_route(tt, &rn->p, rinfo, prefix_sid, no_adjacencies, + json != NULL); } /* Dump the generated table. */ - if (tt->nrows > 1) { + if (json == NULL && tt->nrows > 1) { char *table; table = ttable_dump(tt, "\n"); vty_out(vty, "%s\n", table); XFREE(MTYPE_TMP, table); + } else if (json) { + *json = ttable_json(tt, prefix_sid ? "sdssdsdd" : "sdsss"); } ttable_del(tt); } static void show_isis_route_common(struct vty *vty, int levels, struct isis *isis, bool prefix_sid, - bool backup) + bool backup, json_object **json) { + json_object *json_level = NULL, *jstr = NULL, *json_val; struct listnode *node; struct isis_area *area; + char key[8]; if (!isis->area_list || isis->area_list->count == 0) return; + if (json) + *json = json_object_new_object(); + for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) { - vty_out(vty, "Area %s:\n", - area->area_tag ? area->area_tag : "null"); + if (json) { + jstr = json_object_new_string( + area->area_tag ? area->area_tag : "null"); + json_object_object_add(*json, "area", jstr); + } else { + vty_out(vty, "Area %s:\n", + area->area_tag ? area->area_tag : "null"); + } for (int level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++) { if ((level & levels) == 0) continue; + if (json) { + json_level = json_object_new_object(); + jstr = json_object_new_string( + area->area_tag ? area->area_tag + : "null"); + json_object_object_add(json_level, "area", + jstr); + } + if (area->ip_circuits > 0) { + json_val = NULL; isis_print_routes( vty, area->spftree[SPFTREE_IPV4][level - 1], - prefix_sid, backup); + json ? &json_val : NULL, prefix_sid, + backup); + if (json && json_val) { + json_object_object_add( + json_level, "ipv4", json_val); + } } if (area->ipv6_circuits > 0) { + json_val = NULL; isis_print_routes( vty, area->spftree[SPFTREE_IPV6][level - 1], - prefix_sid, backup); + json ? &json_val : NULL, prefix_sid, + backup); + if (json && json_val) { + json_object_object_add( + json_level, "ipv6", json_val); + } } if (isis_area_ipv6_dstsrc_enabled(area)) { + json_val = NULL; isis_print_routes(vty, area->spftree[SPFTREE_DSTSRC] [level - 1], + json ? &json_val : NULL, prefix_sid, backup); + if (json && json_val) { + json_object_object_add(json_level, + "ipv6-dstsrc", + json_val); + } + } + if (json) { + snprintf(key, sizeof(key), "level-%d", level); + json_object_object_add(*json, key, json_level); } } } @@ -2594,7 +2642,8 @@ DEFUN(show_isis_route, show_isis_route_cmd, #ifndef FABRICD " []" #endif - " []", + " []" + " [json$uj]", SHOW_STR PROTO_HELP VRF_FULL_CMD_HELP_STR "IS-IS routing table\n" #ifndef FABRICD @@ -2602,7 +2651,7 @@ DEFUN(show_isis_route, show_isis_route_cmd, "level-2 routes\n" #endif "Show Prefix-SID information\n" - "Show backup routes\n") + "Show backup routes\n" JSON_STR) { int levels; struct isis *isis; @@ -2611,7 +2660,9 @@ DEFUN(show_isis_route, show_isis_route_cmd, bool all_vrf = false; bool prefix_sid = false; bool backup = false; + bool uj = use_json(argc, argv); int idx = 0; + json_object *json = NULL, *json_vrf = NULL; if (argv_find(argv, argc, "level-1", &idx)) levels = ISIS_LEVEL1; @@ -2631,17 +2682,44 @@ DEFUN(show_isis_route, show_isis_route_cmd, if (argv_find(argv, argc, "backup", &idx)) backup = true; + if (uj) + json = json_object_new_array(); + if (vrf_name) { if (all_vrf) { - for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis)) + for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis)) { show_isis_route_common(vty, levels, isis, - prefix_sid, backup); - return CMD_SUCCESS; + prefix_sid, backup, + uj ? &json_vrf : NULL); + if (uj) { + json_object_object_add( + json_vrf, "vrf_id", + json_object_new_int( + isis->vrf_id)); + json_object_array_add(json, json_vrf); + } + } + goto out; } isis = isis_lookup_by_vrfname(vrf_name); - if (isis != NULL) + if (isis != NULL) { show_isis_route_common(vty, levels, isis, prefix_sid, - backup); + backup, uj ? &json_vrf : NULL); + if (uj) { + json_object_object_add( + json_vrf, "vrf_id", + json_object_new_int(isis->vrf_id)); + json_object_array_add(json, json_vrf); + } + } + } + +out: + if (uj) { + vty_out(vty, "%s\n", + json_object_to_json_string_ext( + json, JSON_C_TO_STRING_PRETTY)); + json_object_free(json); } return CMD_SUCCESS; diff --git a/isisd/isis_spf.h b/isisd/isis_spf.h index 9af4d1bdc..7e9754d9b 100644 --- a/isisd/isis_spf.h +++ b/isisd/isis_spf.h @@ -12,6 +12,7 @@ #define _ZEBRA_ISIS_SPF_H #include "isisd/isis_lfa.h" +#include "lib/json.h" struct isis_spftree; @@ -62,7 +63,7 @@ int _isis_spf_schedule(struct isis_area *area, int level, const char *func, const char *file, int line); void isis_print_spftree(struct vty *vty, struct isis_spftree *spftree); void isis_print_routes(struct vty *vty, struct isis_spftree *spftree, - bool prefix_sid, bool backup); + json_object **json, bool prefix_sid, bool backup); void isis_spf_init(void); void isis_spf_print(struct isis_spftree *spftree, struct vty *vty); void isis_spf_print_json(struct isis_spftree *spftree, diff --git a/tests/isisd/test_isis_spf.c b/tests/isisd/test_isis_spf.c index 8319d7e81..6eb180b50 100644 --- a/tests/isisd/test_isis_spf.c +++ b/tests/isisd/test_isis_spf.c @@ -55,7 +55,7 @@ static void test_run_spf(struct vty *vty, const struct isis_topology *topology, /* Print the SPT and the corresponding routing table. */ isis_print_spftree(vty, spftree); - isis_print_routes(vty, spftree, false, false); + isis_print_routes(vty, spftree, NULL, false, false); /* Cleanup SPF tree. */ isis_spftree_del(spftree); @@ -86,9 +86,9 @@ static void test_run_lfa(struct vty *vty, const struct isis_topology *topology, /* Print the SPT and the corresponding main/backup routing tables. */ isis_print_spftree(vty, spftree_self); vty_out(vty, "Main:\n"); - isis_print_routes(vty, spftree_self, false, false); + isis_print_routes(vty, spftree_self, NULL, false, false); vty_out(vty, "Backup:\n"); - isis_print_routes(vty, spftree_self, false, true); + isis_print_routes(vty, spftree_self, NULL, false, true); /* Cleanup everything. */ isis_spftree_del(spftree_self); @@ -165,9 +165,9 @@ static void test_run_rlfa(struct vty *vty, const struct isis_topology *topology, /* Print the SPT and the corresponding main/backup routing tables. */ isis_print_spftree(vty, spftree_self); vty_out(vty, "Main:\n"); - isis_print_routes(vty, spftree_self, false, false); + isis_print_routes(vty, spftree_self, NULL, false, false); vty_out(vty, "Backup:\n"); - isis_print_routes(vty, spftree_self, false, true); + isis_print_routes(vty, spftree_self, NULL, false, true); /* Cleanup everything. */ isis_spftree_del(spftree_self); @@ -228,7 +228,7 @@ static void test_run_ti_lfa(struct vty *vty, * Print the post-convergence SPT and the corresponding routing table. */ isis_print_spftree(vty, spftree_pc); - isis_print_routes(vty, spftree_self, false, true); + isis_print_routes(vty, spftree_self, NULL, false, true); /* Cleanup everything. */ isis_spftree_del(spftree_self); From 042ea8f2fc82645272d85e03f9e256d0da846d33 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Tue, 30 Aug 2022 11:21:20 +0200 Subject: [PATCH 33/41] isisd: add flex-algo info to spf extreme debug Add flex-algo information ID to the SPF extreme debug mode. Signed-off-by: Eric Kinzie Signed-off-by: Louis Scalbert --- isisd/isis_spf.c | 65 ++++++++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 24 deletions(-) diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index b94562f6a..ddfa68012 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -522,8 +522,8 @@ static struct isis_vertex *isis_spf_add_root(struct isis_spftree *spftree) #ifdef EXTREME_DEBUG if (IS_DEBUG_SPF_EVENTS) zlog_debug( - "ISIS-SPF: added this IS %s %s depth %d dist %d to PATHS", - vtype2string(vertex->type), + "ISIS-SPF: A:%hhu added this IS %s %s depth %d dist %d to PATHS", + spftree->algorithm, vtype2string(vertex->type), vid2string(vertex, buff, sizeof(buff)), vertex->depth, vertex->d_N); #endif /* EXTREME_DEBUG */ @@ -653,8 +653,8 @@ isis_spf_add2tent(struct isis_spftree *spftree, enum vertextype vtype, void *id, #ifdef EXTREME_DEBUG if (IS_DEBUG_SPF_EVENTS) zlog_debug( - "ISIS-SPF: add to TENT %s %s %s depth %d dist %d adjcount %d", - print_sys_hostname(vertex->N.id), + "ISIS-SPF: A:%hhu add to TENT %s %s %s depth %d dist %d adjcount %d", + spftree->algorithm, print_sys_hostname(vertex->N.id), vtype2string(vertex->type), vid2string(vertex, buff, sizeof(buff)), vertex->depth, vertex->d_N, listcount(vertex->Adj_N)); @@ -747,7 +747,8 @@ static void process_N(struct isis_spftree *spftree, enum vertextype vtype, #ifdef EXTREME_DEBUG if (IS_DEBUG_SPF_EVENTS) zlog_debug( - "ISIS-SPF: process_N %s %s %s dist %d already found from PATH", + "ISIS-SPF: A:%hhu process_N %s %s %s dist %d already found from PATH", + spftree->algorithm, print_sys_hostname(vertex->N.id), vtype2string(vtype), vid2string(vertex, buff, sizeof(buff)), dist); @@ -763,7 +764,8 @@ static void process_N(struct isis_spftree *spftree, enum vertextype vtype, #ifdef EXTREME_DEBUG if (IS_DEBUG_SPF_EVENTS) zlog_debug( - "ISIS-SPF: process_N %s %s %s dist %d parent %s adjcount %d", + "ISIS-SPF: A:%hhu process_N %s %s %s dist %d parent %s adjcount %d", + spftree->algorithm, print_sys_hostname(vertex->N.id), vtype2string(vtype), vid2string(vertex, buff, sizeof(buff)), dist, @@ -809,8 +811,9 @@ static void process_N(struct isis_spftree *spftree, enum vertextype vtype, #ifdef EXTREME_DEBUG if (IS_DEBUG_SPF_EVENTS) zlog_debug( - "ISIS-SPF: process_N add2tent %s %s dist %d parent %s", - print_sys_hostname(id), vtype2string(vtype), dist, + "ISIS-SPF: A:%hhu process_N add2tent %s %s dist %d parent %s", + spftree->algorithm, print_sys_hostname(id), + vtype2string(vtype), dist, (parent ? print_sys_hostname(parent->N.id) : "null")); #endif /* EXTREME_DEBUG */ @@ -870,7 +873,8 @@ lspfragloop: #ifdef EXTREME_DEBUG if (IS_DEBUG_SPF_EVENTS) - zlog_debug("ISIS-SPF: process_lsp %s", + zlog_debug("ISIS-SPF: A:%hhu process_lsp %s", + spftree->algorithm, print_sys_hostname(lsp->hdr.lsp_id)); #endif /* EXTREME_DEBUG */ @@ -1560,11 +1564,13 @@ static void add_to_paths(struct isis_spftree *spftree, #ifdef EXTREME_DEBUG if (IS_DEBUG_SPF_EVENTS) - zlog_debug("ISIS-SPF: added %s %s %s depth %d dist %d to PATHS", - print_sys_hostname(vertex->N.id), - vtype2string(vertex->type), - vid2string(vertex, buff, sizeof(buff)), - vertex->depth, vertex->d_N); + zlog_debug( + "ISIS-SPF: A:%hhu S:%p added %s %s %s depth %d dist %d to PATHS", + spftree->algorithm, spftree, + print_sys_hostname(vertex->N.id), + vtype2string(vertex->type), + vid2string(vertex, buff, sizeof(buff)), vertex->depth, + vertex->d_N); #endif /* EXTREME_DEBUG */ } @@ -1710,10 +1716,23 @@ static void spf_path_process(struct isis_spftree *spftree, break; } - isis_route_create( - &vertex->N.ip.p.dest, &vertex->N.ip.p.src, - vertex->d_N, vertex->depth, &vertex->N.ip.sr, - vertex->Adj_N, allow_ecmp, area, route_table); +#ifdef EXTREME_DEBUG + struct isis_route_info *ri = +#endif /* EXTREME_DEBUG */ + isis_route_create(&vertex->N.ip.p.dest, + &vertex->N.ip.p.src, + vertex->d_N, vertex->depth, + &vertex->N.ip.sr, + vertex->Adj_N, allow_ecmp, + area, route_table); + +#ifdef EXTREME_DEBUG + zlog_debug( + "ISIS-SPF: A:%hhu create route pfx %pFX dist %d, sr.algo %d, table %p, rv %p", + spftree->algorithm, &vertex->N.ip.p.dest, + vertex->d_N, vertex->N.ip.sr.algorithm, + route_table, ri); +#endif /* EXTREME_DEBUG */ } else if (IS_DEBUG_SPF_EVENTS) zlog_debug( "ISIS-SPF: no adjacencies, do not install route for %s depth %d dist %d", @@ -1733,12 +1752,10 @@ static void isis_spf_loop(struct isis_spftree *spftree, vertex = isis_vertex_queue_pop(&spftree->tents); #ifdef EXTREME_DEBUG - if (IS_DEBUG_SPF_EVENTS) - zlog_debug( - "ISIS-SPF: get TENT node %s %s depth %d dist %d to PATHS", - print_sys_hostname(vertex->N.id), - vtype2string(vertex->type), vertex->depth, - vertex->d_N); + zlog_debug( + "ISIS-SPF: A:%hhu get TENT node %s %s depth %d dist %d to PATHS", + spftree->algorithm, print_sys_hostname(vertex->N.id), + vtype2string(vertex->type), vertex->depth, vertex->d_N); #endif /* EXTREME_DEBUG */ add_to_paths(spftree, vertex); From 1610e215d98f887afc508f01cac8280b0e96176a Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Tue, 6 Sep 2022 17:06:55 +0200 Subject: [PATCH 34/41] isisd: add an algorithm argument to show isis topology Add an optional algorithm argument to "show isis topology" command. Signed-off-by: Eric Kinzie Signed-off-by: Louis Scalbert --- isisd/isis_spf.c | 102 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 77 insertions(+), 25 deletions(-) diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index ddfa68012..01efaf8ef 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -2266,8 +2266,13 @@ void isis_print_spftree(struct vty *vty, struct isis_spftree *spftree) } static void show_isis_topology_common(struct vty *vty, int levels, - struct isis *isis) + struct isis *isis, uint8_t algo) { +#ifndef FABRICD + struct isis_flex_algo_data *fa_data; + struct flex_algo *fa; +#endif /* ifndef FABRICD */ + struct isis_spftree *spftree; struct listnode *node; struct isis_area *area; @@ -2275,27 +2280,68 @@ static void show_isis_topology_common(struct vty *vty, int levels, return; for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) { - vty_out(vty, "Area %s:\n", - area->area_tag ? area->area_tag : "null"); + vty_out(vty, + "Area %s:", area->area_tag ? area->area_tag : "null"); + +#ifndef FABRICD + /* + * The shapes of the flex algo spftree 2-dimensional array + * and the area spftree 2-dimensional array are not guaranteed + * to be identical. + */ + fa = NULL; + if (flex_algo_id_valid(algo)) { + fa = flex_algo_lookup(area->flex_algos, algo); + if (!fa) + continue; + fa_data = (struct isis_flex_algo_data *)fa->data; + } else + fa_data = NULL; + + if (algo != SR_ALGORITHM_SPF) + vty_out(vty, " Algorithm %hhu\n", algo); + else +#endif /* ifndef FABRICD */ + vty_out(vty, "\n"); for (int level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++) { if ((level & levels) == 0) continue; if (area->ip_circuits > 0) { - isis_print_spftree( - vty, - area->spftree[SPFTREE_IPV4][level - 1]); +#ifndef FABRICD + if (fa_data) + spftree = fa_data->spftree[SPFTREE_IPV4] + [level - 1]; + else +#endif /* ifndef FABRICD */ + spftree = area->spftree[SPFTREE_IPV4] + [level - 1]; + + isis_print_spftree(vty, spftree); } if (area->ipv6_circuits > 0) { - isis_print_spftree( - vty, - area->spftree[SPFTREE_IPV6][level - 1]); +#ifndef FABRICD + if (fa_data) + spftree = fa_data->spftree[SPFTREE_IPV6] + [level - 1]; + else +#endif /* ifndef FABRICD */ + spftree = area->spftree[SPFTREE_IPV6] + [level - 1]; + isis_print_spftree(vty, spftree); } if (isis_area_ipv6_dstsrc_enabled(area)) { - isis_print_spftree(vty, - area->spftree[SPFTREE_DSTSRC] - [level - 1]); +#ifndef FABRICD + if (fa_data) + spftree = + fa_data->spftree[SPFTREE_DSTSRC] + [level - 1]; + else +#endif /* ifndef FABRICD */ + spftree = area->spftree[SPFTREE_DSTSRC] + [level - 1]; + isis_print_spftree(vty, spftree); } } @@ -2315,7 +2361,8 @@ DEFUN(show_isis_topology, show_isis_topology_cmd, " [vrf ] topology" #ifndef FABRICD " []" -#endif + " [algorithm (128-255)]" +#endif /* ifndef FABRICD */ , SHOW_STR PROTO_HELP VRF_CMD_HELP_STR "All VRFs\n" @@ -2323,25 +2370,29 @@ DEFUN(show_isis_topology, show_isis_topology_cmd, #ifndef FABRICD "Paths to all level-1 routers in the area\n" "Paths to all level-2 routers in the domain\n" -#endif + "Show Flex-algo routes\n" + "Algorithm number\n" +#endif /* ifndef FABRICD */ ) { int levels = ISIS_LEVELS; struct listnode *node; struct isis *isis = NULL; - int idx = 0; const char *vrf_name = VRF_DEFAULT_NAME; bool all_vrf = false; int idx_vrf = 0; + uint8_t algorithm = SR_ALGORITHM_SPF; +#ifndef FABRICD + int idx = 0; - if (argv_find(argv, argc, "topology", &idx)) { - if (argc < idx + 2) - levels = ISIS_LEVEL1 | ISIS_LEVEL2; - else if (strmatch(argv[idx + 1]->arg, "level-1")) - levels = ISIS_LEVEL1; - else - levels = ISIS_LEVEL2; - } + levels = ISIS_LEVEL1 | ISIS_LEVEL2; + if (argv_find(argv, argc, "level-1", &idx)) + levels = ISIS_LEVEL1; + if (argv_find(argv, argc, "level-2", &idx)) + levels = ISIS_LEVEL2; + if (argv_find(argv, argc, "algorithm", &idx)) + algorithm = (uint8_t)strtoul(argv[idx + 1]->arg, NULL, 10); +#endif /* ifndef FABRICD */ if (!im) { vty_out(vty, "IS-IS Routing Process not enabled\n"); @@ -2352,12 +2403,13 @@ DEFUN(show_isis_topology, show_isis_topology_cmd, if (vrf_name) { if (all_vrf) { for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis)) - show_isis_topology_common(vty, levels, isis); + show_isis_topology_common(vty, levels, isis, + algorithm); return CMD_SUCCESS; } isis = isis_lookup_by_vrfname(vrf_name); if (isis != NULL) - show_isis_topology_common(vty, levels, isis); + show_isis_topology_common(vty, levels, isis, algorithm); } return CMD_SUCCESS; From 0833c251803bc01f25e027a7d18e90daf84f4361 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Tue, 6 Sep 2022 17:08:57 +0200 Subject: [PATCH 35/41] isisd: add an algorithm argument to show isis route Add an optional algorithm argument to "show isis route" command. Signed-off-by: Eric Kinzie Signed-off-by: Louis Scalbert --- isisd/isis_spf.c | 115 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 93 insertions(+), 22 deletions(-) diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index 01efaf8ef..9646f9259 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -2624,9 +2624,15 @@ void isis_print_routes(struct vty *vty, struct isis_spftree *spftree, static void show_isis_route_common(struct vty *vty, int levels, struct isis *isis, bool prefix_sid, - bool backup, json_object **json) + bool backup, uint8_t algo, + json_object **json) { json_object *json_level = NULL, *jstr = NULL, *json_val; +#ifndef FABRICD + struct isis_flex_algo_data *fa_data; + struct flex_algo *fa; +#endif /* ifndef FABRICD */ + struct isis_spftree *spftree; struct listnode *node; struct isis_area *area; char key[8]; @@ -2638,13 +2644,36 @@ static void show_isis_route_common(struct vty *vty, int levels, *json = json_object_new_object(); for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) { +#ifndef FABRICD + /* + * The shapes of the flex algo spftree 2-dimensional array + * and the area spftree 2-dimensional array are not guaranteed + * to be identical. + */ + fa = NULL; + if (flex_algo_id_valid(algo)) { + fa = flex_algo_lookup(area->flex_algos, algo); + if (!fa) + continue; + fa_data = (struct isis_flex_algo_data *)fa->data; + } else { + fa_data = NULL; + } +#endif /* ifndef FABRICD */ + if (json) { jstr = json_object_new_string( area->area_tag ? area->area_tag : "null"); json_object_object_add(*json, "area", jstr); } else { - vty_out(vty, "Area %s:\n", + vty_out(vty, "Area %s:", area->area_tag ? area->area_tag : "null"); +#ifndef FABRICD + if (algo != SR_ALGORITHM_SPF) + vty_out(vty, " Algorithm %hhu\n", algo); + else +#endif /* ifndef FABRICD */ + vty_out(vty, "\n"); } for (int level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++) { @@ -2662,11 +2691,20 @@ static void show_isis_route_common(struct vty *vty, int levels, if (area->ip_circuits > 0) { json_val = NULL; - isis_print_routes( - vty, - area->spftree[SPFTREE_IPV4][level - 1], - json ? &json_val : NULL, prefix_sid, - backup); +#ifndef FABRICD + if (fa_data) + spftree = fa_data->spftree[SPFTREE_IPV4] + [level - 1]; + else +#endif /* ifndef FABRICD */ + spftree = area->spftree[SPFTREE_IPV4] + [level - 1]; + + isis_print_spftree(vty, spftree); + + isis_print_routes(vty, spftree, + json ? &json_val : NULL, + prefix_sid, backup); if (json && json_val) { json_object_object_add( json_level, "ipv4", json_val); @@ -2674,11 +2712,20 @@ static void show_isis_route_common(struct vty *vty, int levels, } if (area->ipv6_circuits > 0) { json_val = NULL; - isis_print_routes( - vty, - area->spftree[SPFTREE_IPV6][level - 1], - json ? &json_val : NULL, prefix_sid, - backup); +#ifndef FABRICD + if (fa_data) + spftree = fa_data->spftree[SPFTREE_IPV6] + [level - 1]; + else +#endif /* ifndef FABRICD */ + spftree = area->spftree[SPFTREE_IPV6] + [level - 1]; + + isis_print_spftree(vty, spftree); + + isis_print_routes(vty, spftree, + json ? &json_val : NULL, + prefix_sid, backup); if (json && json_val) { json_object_object_add( json_level, "ipv6", json_val); @@ -2686,9 +2733,18 @@ static void show_isis_route_common(struct vty *vty, int levels, } if (isis_area_ipv6_dstsrc_enabled(area)) { json_val = NULL; - isis_print_routes(vty, - area->spftree[SPFTREE_DSTSRC] - [level - 1], +#ifndef FABRICD + if (fa_data) + spftree = + fa_data->spftree[SPFTREE_DSTSRC] + [level - 1]; + else +#endif /* ifndef FABRICD */ + spftree = area->spftree[SPFTREE_DSTSRC] + [level - 1]; + + isis_print_spftree(vty, spftree); + isis_print_routes(vty, spftree, json ? &json_val : NULL, prefix_sid, backup); if (json && json_val) { @@ -2710,17 +2766,25 @@ DEFUN(show_isis_route, show_isis_route_cmd, " [vrf ] route" #ifndef FABRICD " []" -#endif +#endif /* ifndef FABRICD */ " []" +#ifndef FABRICD + " [algorithm (128-255)]" +#endif /* ifndef FABRICD */ " [json$uj]", SHOW_STR PROTO_HELP VRF_FULL_CMD_HELP_STR "IS-IS routing table\n" #ifndef FABRICD "level-1 routes\n" "level-2 routes\n" -#endif +#endif /* ifndef FABRICD */ "Show Prefix-SID information\n" - "Show backup routes\n" JSON_STR) + "Show backup routes\n" +#ifndef FABRICD + "Show Flex-algo routes\n" + "Algorithm number\n" +#endif /* ifndef FABRICD */ + JSON_STR) { int levels; struct isis *isis; @@ -2732,6 +2796,7 @@ DEFUN(show_isis_route, show_isis_route_cmd, bool uj = use_json(argc, argv); int idx = 0; json_object *json = NULL, *json_vrf = NULL; + uint8_t algorithm = SR_ALGORITHM_SPF; if (argv_find(argv, argc, "level-1", &idx)) levels = ISIS_LEVEL1; @@ -2751,15 +2816,20 @@ DEFUN(show_isis_route, show_isis_route_cmd, if (argv_find(argv, argc, "backup", &idx)) backup = true; +#ifndef FABRICD + if (argv_find(argv, argc, "algorithm", &idx)) + algorithm = (uint8_t)strtoul(argv[idx + 1]->arg, NULL, 10); +#endif /* ifndef FABRICD */ + if (uj) json = json_object_new_array(); if (vrf_name) { if (all_vrf) { for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis)) { - show_isis_route_common(vty, levels, isis, - prefix_sid, backup, - uj ? &json_vrf : NULL); + show_isis_route_common( + vty, levels, isis, prefix_sid, backup, + algorithm, uj ? &json_vrf : NULL); if (uj) { json_object_object_add( json_vrf, "vrf_id", @@ -2773,7 +2843,8 @@ DEFUN(show_isis_route, show_isis_route_cmd, isis = isis_lookup_by_vrfname(vrf_name); if (isis != NULL) { show_isis_route_common(vty, levels, isis, prefix_sid, - backup, uj ? &json_vrf : NULL); + backup, algorithm, + uj ? &json_vrf : NULL); if (uj) { json_object_object_add( json_vrf, "vrf_id", From 18d03cd57aaa105fb9278f3aba5335152c1a14c6 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Mon, 12 Dec 2022 15:59:19 +0100 Subject: [PATCH 36/41] isisd: add algorithm argument to show isis segment-routing node Add algorithm argument to show isis segment-routing node Signed-off-by: Louis Scalbert --- isisd/isis_sr.c | 45 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/isisd/isis_sr.c b/isisd/isis_sr.c index 87b6f0867..f928185ff 100644 --- a/isisd/isis_sr.c +++ b/isisd/isis_sr.c @@ -1020,10 +1020,12 @@ char *sr_op2str(char *buf, size_t size, mpls_label_t label_in, * @param area IS-IS area * @param level IS-IS level */ -static void show_node(struct vty *vty, struct isis_area *area, int level) +static void show_node(struct vty *vty, struct isis_area *area, int level, + uint8_t algo) { struct isis_lsp *lsp; struct ttable *tt; + char buf[128]; vty_out(vty, " IS-IS %s SR-Nodes:\n\n", circuit_t2string(level)); @@ -1043,15 +1045,24 @@ static void show_node(struct vty *vty, struct isis_area *area, int level) cap = lsp->tlvs->router_cap; if (!cap) continue; + if (cap->algo[algo] == SR_ALGORITHM_UNSET) + continue; + + if (cap->algo[algo] == SR_ALGORITHM_SPF) + snprintf(buf, sizeof(buf), "SPF"); + else if (cap->algo[algo] == SR_ALGORITHM_STRICT_SPF) + snprintf(buf, sizeof(buf), "S-SPF"); +#ifndef FABRICD + else + snprintf(buf, sizeof(buf), "Flex-Algo %d", algo); +#endif /* ifndef FABRICD */ ttable_add_row(tt, "%pSY|%u - %u|%u - %u|%s|%u", lsp->hdr.lsp_id, cap->srgb.lower_bound, cap->srgb.lower_bound + cap->srgb.range_size - 1, cap->srlb.lower_bound, cap->srlb.lower_bound + cap->srlb.range_size - 1, - cap->algo[0] == SR_ALGORITHM_SPF ? "SPF" - : "S-SPF", - cap->msd); + buf, cap->msd); } /* Dump the generated table. */ @@ -1066,15 +1077,31 @@ static void show_node(struct vty *vty, struct isis_area *area, int level) } DEFUN(show_sr_node, show_sr_node_cmd, - "show " PROTO_NAME " segment-routing node", - SHOW_STR - PROTO_HELP + "show " PROTO_NAME + " segment-routing node" +#ifndef FABRICD + " [algorithm (128-255)]" +#endif /* ifndef FABRICD */ + , + SHOW_STR PROTO_HELP "Segment-Routing\n" - "Segment-Routing node\n") + "Segment-Routing node\n" +#ifndef FABRICD + "Show Flex-algo nodes\n" + "Algorithm number\n" +#endif /* ifndef FABRICD */ +) { struct listnode *node, *inode; struct isis_area *area; + uint8_t algorithm = SR_ALGORITHM_SPF; struct isis *isis; +#ifndef FABRICD + int idx = 0; + + if (argv_find(argv, argc, "algorithm", &idx)) + algorithm = (uint8_t)strtoul(argv[idx + 1]->arg, NULL, 10); +#endif /* ifndef FABRICD */ for (ALL_LIST_ELEMENTS_RO(im->isis, inode, isis)) { for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) { @@ -1086,7 +1113,7 @@ DEFUN(show_sr_node, show_sr_node_cmd, } for (int level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++) - show_node(vty, area, level); + show_node(vty, area, level, algorithm); } } From df2f80a721c50601b7806b3274a32a6e5b608e8e Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Mon, 12 Dec 2022 16:12:41 +0100 Subject: [PATCH 37/41] isisd: add "show isis flex-algo" command Add the show isis flex-algo command to display the elected Flex-Algo definitions and states (enabled/disabled). Signed-off-by: Louis Scalbert --- isisd/isis_spf.c | 187 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 187 insertions(+) diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index 9646f9259..732853796 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -2415,6 +2415,190 @@ DEFUN(show_isis_topology, show_isis_topology_cmd, return CMD_SUCCESS; } +#ifndef FABRICD +static void show_isis_flex_algo_display_eag(struct vty *vty, char *buf, + int indent, + struct admin_group *admin_group) +{ + if (admin_group_zero(admin_group)) + vty_out(vty, "not-set\n"); + else { + vty_out(vty, "%s\n", + admin_group_string(buf, ADMIN_GROUP_PRINT_MAX_SIZE, + indent, admin_group)); + admin_group_print(buf, indent, admin_group); + if (buf[0] != '\0') + vty_out(vty, " Bit positions: %s\n", buf); + } +} + +static void show_isis_flex_algo_common(struct vty *vty, struct isis *isis, + uint8_t algorithm) +{ + struct isis_router_cap_fad *router_fad; + char buf[ADMIN_GROUP_PRINT_MAX_SIZE]; + struct admin_group *admin_group; + struct isis_area *area; + struct listnode *node; + struct flex_algo *fa; + int indent, algo; + bool fad_identical, fad_supported; + + if (!isis->area_list || isis->area_list->count == 0) + return; + + for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) { + /* + * The shapes of the flex algo spftree 2-dimensional array + * and the area spftree 2-dimensional array are not guaranteed + * to be identical. + */ + + for (algo = 0; algo < SR_ALGORITHM_COUNT; algo++) { + if (algorithm != SR_ALGORITHM_UNSET && + algorithm != algo) + continue; + + fa = flex_algo_lookup(area->flex_algos, algo); + if (!fa) + continue; + + vty_out(vty, "Area %s:", + area->area_tag ? area->area_tag : "null"); + + vty_out(vty, " Algorithm %d\n", algo); + vty_out(vty, "\n"); + + vty_out(vty, " Enabled Data-Planes:"); + if (fa->dataplanes == 0) { + vty_out(vty, " None\n\n"); + continue; + } + if (CHECK_FLAG(fa->dataplanes, FLEX_ALGO_SR_MPLS)) + vty_out(vty, " SR-MPLS"); + if (CHECK_FLAG(fa->dataplanes, FLEX_ALGO_SRV6)) + vty_out(vty, " SRv6"); + if (CHECK_FLAG(fa->dataplanes, FLEX_ALGO_IP)) + vty_out(vty, " IP"); + vty_out(vty, "\n\n"); + + + router_fad = isis_flex_algo_elected(algo, area); + vty_out(vty, + " Elected and running Flexible-Algorithm Definition:\n"); + if (router_fad) + vty_out(vty, " Source: %pSY\n", + router_fad->sysid); + else + vty_out(vty, " Source: Not found\n"); + + if (!router_fad) { + vty_out(vty, "\n"); + continue; + } + + fad_identical = + flex_algo_definition_cmp(fa, &router_fad->fad); + fad_supported = + isis_flex_algo_supported(&router_fad->fad); + vty_out(vty, " Priority: %d\n", + router_fad->fad.priority); + vty_out(vty, " Equal to local: %s\n", + fad_identical ? "yes" : "no"); + vty_out(vty, " Local state: %s\n", + fad_supported + ? "enabled" + : "disabled (unsupported definition)"); + vty_out(vty, " Calculation type: "); + if (router_fad->fad.calc_type == 0) + vty_out(vty, "spf\n"); + else + vty_out(vty, "%d\n", router_fad->fad.calc_type); + vty_out(vty, " Metric type: %s\n", + flex_algo_metric_type_print( + buf, sizeof(buf), + router_fad->fad.metric_type)); + vty_out(vty, " Prefix-metric: %s\n", + CHECK_FLAG(router_fad->fad.flags, FAD_FLAG_M) + ? "enabled" + : "disabled"); + if (router_fad->fad.flags != 0 && + router_fad->fad.flags != FAD_FLAG_M) + vty_out(vty, " Flags: 0x%x\n", + router_fad->fad.flags); + vty_out(vty, " Exclude SRLG: %s\n", + router_fad->fad.exclude_srlg ? "enabled" + : "disabled"); + + admin_group = &router_fad->fad.admin_group_exclude_any; + indent = vty_out(vty, " Exclude-any admin-group: "); + show_isis_flex_algo_display_eag(vty, buf, indent, + admin_group); + + admin_group = &router_fad->fad.admin_group_include_all; + indent = vty_out(vty, " Include-all admin-group: "); + show_isis_flex_algo_display_eag(vty, buf, indent, + admin_group); + + admin_group = &router_fad->fad.admin_group_include_any; + indent = vty_out(vty, " Include-any admin-group: "); + show_isis_flex_algo_display_eag(vty, buf, indent, + admin_group); + + if (router_fad->fad.unsupported_subtlv) + vty_out(vty, + " Unsupported sub-TLV: Present (see logs)"); + + vty_out(vty, "\n"); + } + } +} + +DEFUN(show_isis_flex_algo, show_isis_flex_algo_cmd, + "show " PROTO_NAME + " [vrf ] flex-algo" + " [(128-255)]", + SHOW_STR PROTO_HELP VRF_CMD_HELP_STR + "All VRFs\n" + "IS-IS Flex-algo information\n" + "Algorithm number\n") +{ + struct isis *isis; + struct listnode *node; + const char *vrf_name = VRF_DEFAULT_NAME; + bool all_vrf = false; + int idx = 0; + int idx_vrf = 0; + uint8_t flex_algo; + + if (!im) { + vty_out(vty, "IS-IS Routing Process not enabled\n"); + return CMD_SUCCESS; + } + + if (argv_find(argv, argc, "flex-algo", &idx) && (idx + 1) < argc) + flex_algo = (uint8_t)strtoul(argv[idx + 1]->arg, NULL, 10); + else + flex_algo = SR_ALGORITHM_UNSET; + + ISIS_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); + + if (vrf_name) { + if (all_vrf) { + for (ALL_LIST_ELEMENTS_RO(im->isis, node, isis)) + show_isis_flex_algo_common(vty, isis, + flex_algo); + return CMD_SUCCESS; + } + isis = isis_lookup_by_vrfname(vrf_name); + if (isis != NULL) + show_isis_flex_algo_common(vty, isis, flex_algo); + } + + return CMD_SUCCESS; +} +#endif /* ifndef FABRICD */ + static void isis_print_route(struct ttable *tt, const struct prefix *prefix, struct isis_route_info *rinfo, bool prefix_sid, bool no_adjacencies, bool json) @@ -3079,6 +3263,9 @@ DEFUN(show_isis_frr_summary, show_isis_frr_summary_cmd, void isis_spf_init(void) { +#ifndef FABRICD + install_element(VIEW_NODE, &show_isis_flex_algo_cmd); +#endif /* ifndef FABRICD */ install_element(VIEW_NODE, &show_isis_topology_cmd); install_element(VIEW_NODE, &show_isis_route_cmd); install_element(VIEW_NODE, &show_isis_frr_summary_cmd); From 1a61ef95b2c14a95b7b61ac3c92d6d5070f2665a Mon Sep 17 00:00:00 2001 From: Hiroki Shirokura Date: Sun, 21 Nov 2021 10:07:27 +0000 Subject: [PATCH 38/41] tests: add isis_sr_flex_algo_topo1 for flex-algo Add a topotest to check some Flex-Algo configuration changes. Signed-off-by: Hiroki Shirokura Signed-off-by: Louis Scalbert --- .../isis_sr_flex_algo_topo1/rt1/isisd.conf | 96 +++ .../rt1/step1/show_isis_flex_algo.ref | 125 ++++ .../rt1/step1/show_mpls_table.ref | 514 +++++++++++++++ .../rt1/step10/show_isis_flex_algo.ref | 126 ++++ .../rt1/step10/show_mpls_table.ref | 514 +++++++++++++++ .../rt1/step11/show_isis_flex_algo.ref | 126 ++++ .../rt1/step11/show_mpls_table.ref | 514 +++++++++++++++ .../rt1/step2/show_isis_flex_algo.ref | 126 ++++ .../rt1/step2/show_mpls_table.ref | 514 +++++++++++++++ .../rt1/step3/show_isis_flex_algo.ref | 115 ++++ .../rt1/step3/show_mpls_table.ref | 450 ++++++++++++++ .../rt1/step4/show_isis_flex_algo.ref | 126 ++++ .../rt1/step4/show_mpls_table.ref | 514 +++++++++++++++ .../rt1/step5/show_isis_flex_algo.ref | 126 ++++ .../rt1/step5/show_mpls_table.ref | 514 +++++++++++++++ .../rt1/step6/show_isis_flex_algo.ref | 112 ++++ .../rt1/step6/show_mpls_table.ref | 450 ++++++++++++++ .../rt1/step7/show_isis_flex_algo.ref | 108 ++++ .../rt1/step7/show_mpls_table.ref | 450 ++++++++++++++ .../rt1/step8/show_isis_flex_algo.ref | 126 ++++ .../rt1/step8/show_mpls_table.ref | 514 +++++++++++++++ .../rt1/step9/show_isis_flex_algo.ref | 126 ++++ .../rt1/step9/show_mpls_table.ref | 514 +++++++++++++++ .../isis_sr_flex_algo_topo1/rt1/zebra.conf | 39 ++ .../isis_sr_flex_algo_topo1/rt2/isisd.conf | 96 +++ .../rt2/step1/show_isis_flex_algo.ref | 125 ++++ .../rt2/step1/show_mpls_table.ref | 514 +++++++++++++++ .../rt2/step10/show_isis_flex_algo.ref | 125 ++++ .../rt2/step10/show_mpls_table.ref | 514 +++++++++++++++ .../rt2/step11/show_isis_flex_algo.ref | 125 ++++ .../rt2/step11/show_mpls_table.ref | 514 +++++++++++++++ .../rt2/step2/show_isis_flex_algo.ref | 125 ++++ .../rt2/step2/show_mpls_table.ref | 514 +++++++++++++++ .../rt2/step3/show_isis_flex_algo.ref | 114 ++++ .../rt2/step3/show_mpls_table.ref | 450 ++++++++++++++ .../rt2/step4/show_isis_flex_algo.ref | 125 ++++ .../rt2/step4/show_mpls_table.ref | 514 +++++++++++++++ .../rt2/step5/show_isis_flex_algo.ref | 125 ++++ .../rt2/step5/show_mpls_table.ref | 514 +++++++++++++++ .../rt2/step6/show_isis_flex_algo.ref | 111 ++++ .../rt2/step6/show_mpls_table.ref | 450 ++++++++++++++ .../rt2/step7/show_isis_flex_algo.ref | 107 ++++ .../rt2/step7/show_mpls_table.ref | 450 ++++++++++++++ .../rt2/step8/show_isis_flex_algo.ref | 125 ++++ .../rt2/step8/show_mpls_table.ref | 514 +++++++++++++++ .../rt2/step9/show_isis_flex_algo.ref | 125 ++++ .../rt2/step9/show_mpls_table.ref | 482 +++++++++++++++ .../isis_sr_flex_algo_topo1/rt2/zebra.conf | 39 ++ .../isis_sr_flex_algo_topo1/rt3/isisd.conf | 76 +++ .../rt3/step1/show_isis_flex_algo.ref | 125 ++++ .../rt3/step1/show_mpls_table.ref | 514 +++++++++++++++ .../rt3/step10/show_isis_flex_algo.ref | 125 ++++ .../rt3/step10/show_mpls_table.ref | 514 +++++++++++++++ .../rt3/step11/show_isis_flex_algo.ref | 125 ++++ .../rt3/step11/show_mpls_table.ref | 514 +++++++++++++++ .../rt3/step2/show_isis_flex_algo.ref | 125 ++++ .../rt3/step2/show_mpls_table.ref | 514 +++++++++++++++ .../rt3/step3/show_isis_flex_algo.ref | 114 ++++ .../rt3/step3/show_mpls_table.ref | 450 ++++++++++++++ .../rt3/step4/show_isis_flex_algo.ref | 125 ++++ .../rt3/step4/show_mpls_table.ref | 514 +++++++++++++++ .../rt3/step5/show_isis_flex_algo.ref | 125 ++++ .../rt3/step5/show_mpls_table.ref | 514 +++++++++++++++ .../rt3/step6/show_isis_flex_algo.ref | 111 ++++ .../rt3/step6/show_mpls_table.ref | 450 ++++++++++++++ .../rt3/step7/show_isis_flex_algo.ref | 107 ++++ .../rt3/step7/show_mpls_table.ref | 450 ++++++++++++++ .../rt3/step8/show_isis_flex_algo.ref | 125 ++++ .../rt3/step8/show_mpls_table.ref | 514 +++++++++++++++ .../rt3/step9/show_isis_flex_algo.ref | 125 ++++ .../rt3/step9/show_mpls_table.ref | 482 +++++++++++++++ .../isis_sr_flex_algo_topo1/rt3/zebra.conf | 39 ++ .../test_isis_sr_flex_algo_topo1.py | 583 ++++++++++++++++++ 73 files changed, 21296 insertions(+) create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt1/isisd.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt1/step1/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt1/step1/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt1/step10/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt1/step10/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt1/step11/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt1/step11/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt1/step2/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt1/step2/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt1/step3/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt1/step3/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt1/step4/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt1/step4/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt1/step5/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt1/step5/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt1/step6/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt1/step6/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt1/step7/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt1/step7/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt1/step8/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt1/step8/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt1/step9/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt1/step9/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt1/zebra.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt2/isisd.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt2/step1/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt2/step1/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt2/step10/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt2/step10/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt2/step11/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt2/step11/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt2/step2/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt2/step2/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt2/step3/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt2/step3/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt2/step4/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt2/step4/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt2/step5/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt2/step5/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt2/step6/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt2/step6/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt2/step7/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt2/step7/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt2/step8/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt2/step8/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt2/step9/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt2/step9/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt2/zebra.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt3/isisd.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt3/step1/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt3/step1/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt3/step10/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt3/step10/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt3/step11/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt3/step11/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt3/step2/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt3/step2/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt3/step3/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt3/step3/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt3/step4/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt3/step4/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt3/step5/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt3/step5/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt3/step6/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt3/step6/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt3/step7/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt3/step7/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt3/step8/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt3/step8/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt3/step9/show_isis_flex_algo.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt3/step9/show_mpls_table.ref create mode 100644 tests/topotests/isis_sr_flex_algo_topo1/rt3/zebra.conf create mode 100755 tests/topotests/isis_sr_flex_algo_topo1/test_isis_sr_flex_algo_topo1.py diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt1/isisd.conf b/tests/topotests/isis_sr_flex_algo_topo1/rt1/isisd.conf new file mode 100644 index 000000000..5503baa58 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt1/isisd.conf @@ -0,0 +1,96 @@ +password 1 +hostname rt1 +log file isisd.log +! +!debug northbound +!debug isis events +!debug isis spf-events +!debug isis route-events +!debug isis sr-events +!debug isis lsp-gen +! +affinity-map red bit-position 0 +affinity-map blue bit-position 1 +affinity-map green bit-position 2 +affinity-map yellow bit-position 3 +affinity-map orange bit-position 4 +! +interface lo + ip router isis 1 + ipv6 router isis 1 + isis passive +! +interface eth-rt2 + ip router isis 1 + ipv6 router isis 1 + isis hello-multiplier 3 + isis network point-to-point +! +interface eth-rt3 + ip router isis 1 + ipv6 router isis 1 + isis hello-multiplier 3 + isis network point-to-point +! +router isis 1 + lsp-gen-interval 2 + net 49.0000.0000.0000.0001.00 + is-type level-1 + topology ipv6-unicast + mpls-te on + ! + flex-algo 201 + dataplane sr-mpls + advertise-definition + affinity exclude-any red + ! + flex-algo 202 + dataplane sr-mpls + advertise-definition + affinity exclude-any blue + ! + flex-algo 203 + dataplane sr-mpls + advertise-definition + affinity exclude-any green + ! + flex-algo 204 + dataplane sr-mpls + advertise-definition + affinity include-any blue green + ! + flex-algo 205 + dataplane sr-mpls + advertise-definition + affinity include-any red green + ! + flex-algo 206 + dataplane sr-mpls + advertise-definition + affinity include-any red blue + ! + flex-algo 207 + dataplane sr-mpls + advertise-definition + affinity include-all yellow orange + ! + segment-routing on + segment-routing global-block 20000 23999 + segment-routing node-msd 8 + segment-routing prefix 1.1.1.1/32 index 1 + segment-routing prefix 1.1.1.1/32 algorithm 201 index 101 + segment-routing prefix 1.1.1.1/32 algorithm 202 index 201 + segment-routing prefix 1.1.1.1/32 algorithm 203 index 301 + segment-routing prefix 1.1.1.1/32 algorithm 204 index 401 + segment-routing prefix 1.1.1.1/32 algorithm 205 index 501 + segment-routing prefix 1.1.1.1/32 algorithm 206 index 601 + segment-routing prefix 1.1.1.1/32 algorithm 207 index 701 + segment-routing prefix 2001:db8:1000::1/128 index 1001 + segment-routing prefix 2001:db8:1000::1/128 algorithm 201 index 1101 + segment-routing prefix 2001:db8:1000::1/128 algorithm 202 index 1201 + segment-routing prefix 2001:db8:1000::1/128 algorithm 203 index 1301 + segment-routing prefix 2001:db8:1000::1/128 algorithm 204 index 1401 + segment-routing prefix 2001:db8:1000::1/128 algorithm 205 index 1501 + segment-routing prefix 2001:db8:1000::1/128 algorithm 206 index 1601 + segment-routing prefix 2001:db8:1000::1/128 algorithm 207 index 1701 +! diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt1/step1/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step1/show_isis_flex_algo.ref new file mode 100644 index 000000000..750abc1fa --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step1/show_isis_flex_algo.ref @@ -0,0 +1,125 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000004 + Bit positions: 2 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set \ No newline at end of file diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt1/step1/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step1/show_mpls_table.ref new file mode 100644 index 000000000..2b16c5313 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step1/show_mpls_table.ref @@ -0,0 +1,514 @@ +{ + "20002":{ + "inLabel":20002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20003":{ + "inLabel":20003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20102":{ + "inLabel":20102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20102, + "outLabelStack":[ + 20102 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20103":{ + "inLabel":20103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20202":{ + "inLabel":20202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20203":{ + "inLabel":20203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20302":{ + "inLabel":20302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20303":{ + "inLabel":20303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20303, + "outLabelStack":[ + 20303 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20402":{ + "inLabel":20402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20402, + "outLabelStack":[ + 20402 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20403":{ + "inLabel":20403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20502":{ + "inLabel":20502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20503":{ + "inLabel":20503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20602":{ + "inLabel":20602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20603":{ + "inLabel":20603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20603, + "outLabelStack":[ + 20603 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20702":{ + "inLabel":20702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20702, + "outLabelStack":[ + 20702 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20703":{ + "inLabel":20703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "21002":{ + "inLabel":21002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21003":{ + "inLabel":21003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21102":{ + "inLabel":21102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21102, + "outLabelStack":[ + 21102 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21103":{ + "inLabel":21103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21202":{ + "inLabel":21202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21203":{ + "inLabel":21203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21302":{ + "inLabel":21302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21303":{ + "inLabel":21303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21303, + "outLabelStack":[ + 21303 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21402":{ + "inLabel":21402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21402, + "outLabelStack":[ + 21402 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21403":{ + "inLabel":21403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21502":{ + "inLabel":21502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21503":{ + "inLabel":21503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21602":{ + "inLabel":21602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21603":{ + "inLabel":21603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21603, + "outLabelStack":[ + 21603 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21702":{ + "inLabel":21702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21702, + "outLabelStack":[ + 21702 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21703":{ + "inLabel":21703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt1/step10/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step10/show_isis_flex_algo.ref new file mode 100644 index 000000000..942199031 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step10/show_isis_flex_algo.ref @@ -0,0 +1,126 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000004 + Bit positions: 2 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set + diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt1/step10/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step10/show_mpls_table.ref new file mode 100644 index 000000000..2b16c5313 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step10/show_mpls_table.ref @@ -0,0 +1,514 @@ +{ + "20002":{ + "inLabel":20002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20003":{ + "inLabel":20003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20102":{ + "inLabel":20102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20102, + "outLabelStack":[ + 20102 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20103":{ + "inLabel":20103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20202":{ + "inLabel":20202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20203":{ + "inLabel":20203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20302":{ + "inLabel":20302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20303":{ + "inLabel":20303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20303, + "outLabelStack":[ + 20303 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20402":{ + "inLabel":20402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20402, + "outLabelStack":[ + 20402 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20403":{ + "inLabel":20403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20502":{ + "inLabel":20502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20503":{ + "inLabel":20503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20602":{ + "inLabel":20602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20603":{ + "inLabel":20603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20603, + "outLabelStack":[ + 20603 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20702":{ + "inLabel":20702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20702, + "outLabelStack":[ + 20702 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20703":{ + "inLabel":20703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "21002":{ + "inLabel":21002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21003":{ + "inLabel":21003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21102":{ + "inLabel":21102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21102, + "outLabelStack":[ + 21102 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21103":{ + "inLabel":21103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21202":{ + "inLabel":21202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21203":{ + "inLabel":21203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21302":{ + "inLabel":21302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21303":{ + "inLabel":21303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21303, + "outLabelStack":[ + 21303 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21402":{ + "inLabel":21402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21402, + "outLabelStack":[ + 21402 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21403":{ + "inLabel":21403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21502":{ + "inLabel":21502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21503":{ + "inLabel":21503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21602":{ + "inLabel":21602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21603":{ + "inLabel":21603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21603, + "outLabelStack":[ + 21603 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21702":{ + "inLabel":21702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21702, + "outLabelStack":[ + 21702 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21703":{ + "inLabel":21703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt1/step11/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step11/show_isis_flex_algo.ref new file mode 100644 index 000000000..942199031 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step11/show_isis_flex_algo.ref @@ -0,0 +1,126 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000004 + Bit positions: 2 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set + diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt1/step11/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step11/show_mpls_table.ref new file mode 100644 index 000000000..2b16c5313 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step11/show_mpls_table.ref @@ -0,0 +1,514 @@ +{ + "20002":{ + "inLabel":20002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20003":{ + "inLabel":20003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20102":{ + "inLabel":20102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20102, + "outLabelStack":[ + 20102 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20103":{ + "inLabel":20103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20202":{ + "inLabel":20202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20203":{ + "inLabel":20203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20302":{ + "inLabel":20302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20303":{ + "inLabel":20303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20303, + "outLabelStack":[ + 20303 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20402":{ + "inLabel":20402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20402, + "outLabelStack":[ + 20402 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20403":{ + "inLabel":20403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20502":{ + "inLabel":20502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20503":{ + "inLabel":20503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20602":{ + "inLabel":20602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20603":{ + "inLabel":20603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20603, + "outLabelStack":[ + 20603 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20702":{ + "inLabel":20702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20702, + "outLabelStack":[ + 20702 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20703":{ + "inLabel":20703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "21002":{ + "inLabel":21002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21003":{ + "inLabel":21003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21102":{ + "inLabel":21102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21102, + "outLabelStack":[ + 21102 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21103":{ + "inLabel":21103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21202":{ + "inLabel":21202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21203":{ + "inLabel":21203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21302":{ + "inLabel":21302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21303":{ + "inLabel":21303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21303, + "outLabelStack":[ + 21303 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21402":{ + "inLabel":21402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21402, + "outLabelStack":[ + 21402 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21403":{ + "inLabel":21403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21502":{ + "inLabel":21502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21503":{ + "inLabel":21503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21602":{ + "inLabel":21602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21603":{ + "inLabel":21603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21603, + "outLabelStack":[ + 21603 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21702":{ + "inLabel":21702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21702, + "outLabelStack":[ + 21702 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21703":{ + "inLabel":21703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt1/step2/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step2/show_isis_flex_algo.ref new file mode 100644 index 000000000..942199031 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step2/show_isis_flex_algo.ref @@ -0,0 +1,126 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000004 + Bit positions: 2 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set + diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt1/step2/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step2/show_mpls_table.ref new file mode 100644 index 000000000..2b16c5313 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step2/show_mpls_table.ref @@ -0,0 +1,514 @@ +{ + "20002":{ + "inLabel":20002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20003":{ + "inLabel":20003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20102":{ + "inLabel":20102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20102, + "outLabelStack":[ + 20102 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20103":{ + "inLabel":20103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20202":{ + "inLabel":20202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20203":{ + "inLabel":20203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20302":{ + "inLabel":20302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20303":{ + "inLabel":20303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20303, + "outLabelStack":[ + 20303 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20402":{ + "inLabel":20402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20402, + "outLabelStack":[ + 20402 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20403":{ + "inLabel":20403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20502":{ + "inLabel":20502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20503":{ + "inLabel":20503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20602":{ + "inLabel":20602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20603":{ + "inLabel":20603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20603, + "outLabelStack":[ + 20603 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20702":{ + "inLabel":20702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20702, + "outLabelStack":[ + 20702 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20703":{ + "inLabel":20703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "21002":{ + "inLabel":21002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21003":{ + "inLabel":21003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21102":{ + "inLabel":21102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21102, + "outLabelStack":[ + 21102 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21103":{ + "inLabel":21103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21202":{ + "inLabel":21202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21203":{ + "inLabel":21203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21302":{ + "inLabel":21302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21303":{ + "inLabel":21303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21303, + "outLabelStack":[ + 21303 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21402":{ + "inLabel":21402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21402, + "outLabelStack":[ + 21402 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21403":{ + "inLabel":21403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21502":{ + "inLabel":21502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21503":{ + "inLabel":21503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21602":{ + "inLabel":21602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21603":{ + "inLabel":21603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21603, + "outLabelStack":[ + 21603 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21702":{ + "inLabel":21702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21702, + "outLabelStack":[ + 21702 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21703":{ + "inLabel":21703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt1/step3/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step3/show_isis_flex_algo.ref new file mode 100644 index 000000000..13a96161a --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step3/show_isis_flex_algo.ref @@ -0,0 +1,115 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: Not found + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set + diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt1/step3/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step3/show_mpls_table.ref new file mode 100644 index 000000000..d311e924d --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step3/show_mpls_table.ref @@ -0,0 +1,450 @@ +{ + "20002":{ + "inLabel":20002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20003":{ + "inLabel":20003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20102":{ + "inLabel":20102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20102, + "outLabelStack":[ + 20102 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20103":{ + "inLabel":20103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20202":{ + "inLabel":20202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20203":{ + "inLabel":20203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20402":{ + "inLabel":20402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20402, + "outLabelStack":[ + 20402 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20403":{ + "inLabel":20403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20502":{ + "inLabel":20502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20503":{ + "inLabel":20503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20602":{ + "inLabel":20602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20603":{ + "inLabel":20603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20603, + "outLabelStack":[ + 20603 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20702":{ + "inLabel":20702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20702, + "outLabelStack":[ + 20702 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20703":{ + "inLabel":20703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "21002":{ + "inLabel":21002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21003":{ + "inLabel":21003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21102":{ + "inLabel":21102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21102, + "outLabelStack":[ + 21102 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21103":{ + "inLabel":21103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21202":{ + "inLabel":21202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21203":{ + "inLabel":21203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21402":{ + "inLabel":21402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21402, + "outLabelStack":[ + 21402 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21403":{ + "inLabel":21403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21502":{ + "inLabel":21502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21503":{ + "inLabel":21503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21602":{ + "inLabel":21602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21603":{ + "inLabel":21603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21603, + "outLabelStack":[ + 21603 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21702":{ + "inLabel":21702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21702, + "outLabelStack":[ + 21702 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21703":{ + "inLabel":21703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt1/step4/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step4/show_isis_flex_algo.ref new file mode 100644 index 000000000..942199031 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step4/show_isis_flex_algo.ref @@ -0,0 +1,126 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000004 + Bit positions: 2 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set + diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt1/step4/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step4/show_mpls_table.ref new file mode 100644 index 000000000..2b16c5313 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step4/show_mpls_table.ref @@ -0,0 +1,514 @@ +{ + "20002":{ + "inLabel":20002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20003":{ + "inLabel":20003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20102":{ + "inLabel":20102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20102, + "outLabelStack":[ + 20102 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20103":{ + "inLabel":20103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20202":{ + "inLabel":20202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20203":{ + "inLabel":20203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20302":{ + "inLabel":20302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20303":{ + "inLabel":20303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20303, + "outLabelStack":[ + 20303 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20402":{ + "inLabel":20402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20402, + "outLabelStack":[ + 20402 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20403":{ + "inLabel":20403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20502":{ + "inLabel":20502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20503":{ + "inLabel":20503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20602":{ + "inLabel":20602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20603":{ + "inLabel":20603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20603, + "outLabelStack":[ + 20603 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20702":{ + "inLabel":20702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20702, + "outLabelStack":[ + 20702 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20703":{ + "inLabel":20703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "21002":{ + "inLabel":21002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21003":{ + "inLabel":21003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21102":{ + "inLabel":21102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21102, + "outLabelStack":[ + 21102 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21103":{ + "inLabel":21103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21202":{ + "inLabel":21202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21203":{ + "inLabel":21203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21302":{ + "inLabel":21302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21303":{ + "inLabel":21303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21303, + "outLabelStack":[ + 21303 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21402":{ + "inLabel":21402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21402, + "outLabelStack":[ + 21402 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21403":{ + "inLabel":21403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21502":{ + "inLabel":21502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21503":{ + "inLabel":21503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21602":{ + "inLabel":21602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21603":{ + "inLabel":21603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21603, + "outLabelStack":[ + 21603 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21702":{ + "inLabel":21702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21702, + "outLabelStack":[ + 21702 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21703":{ + "inLabel":21703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt1/step5/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step5/show_isis_flex_algo.ref new file mode 100644 index 000000000..942199031 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step5/show_isis_flex_algo.ref @@ -0,0 +1,126 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000004 + Bit positions: 2 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set + diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt1/step5/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step5/show_mpls_table.ref new file mode 100644 index 000000000..2b16c5313 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step5/show_mpls_table.ref @@ -0,0 +1,514 @@ +{ + "20002":{ + "inLabel":20002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20003":{ + "inLabel":20003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20102":{ + "inLabel":20102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20102, + "outLabelStack":[ + 20102 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20103":{ + "inLabel":20103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20202":{ + "inLabel":20202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20203":{ + "inLabel":20203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20302":{ + "inLabel":20302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20303":{ + "inLabel":20303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20303, + "outLabelStack":[ + 20303 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20402":{ + "inLabel":20402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20402, + "outLabelStack":[ + 20402 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20403":{ + "inLabel":20403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20502":{ + "inLabel":20502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20503":{ + "inLabel":20503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20602":{ + "inLabel":20602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20603":{ + "inLabel":20603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20603, + "outLabelStack":[ + 20603 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20702":{ + "inLabel":20702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20702, + "outLabelStack":[ + 20702 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20703":{ + "inLabel":20703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "21002":{ + "inLabel":21002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21003":{ + "inLabel":21003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21102":{ + "inLabel":21102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21102, + "outLabelStack":[ + 21102 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21103":{ + "inLabel":21103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21202":{ + "inLabel":21202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21203":{ + "inLabel":21203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21302":{ + "inLabel":21302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21303":{ + "inLabel":21303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21303, + "outLabelStack":[ + 21303 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21402":{ + "inLabel":21402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21402, + "outLabelStack":[ + 21402 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21403":{ + "inLabel":21403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21502":{ + "inLabel":21502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21503":{ + "inLabel":21503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21602":{ + "inLabel":21602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21603":{ + "inLabel":21603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21603, + "outLabelStack":[ + 21603 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21702":{ + "inLabel":21702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21702, + "outLabelStack":[ + 21702 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21703":{ + "inLabel":21703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt1/step6/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step6/show_isis_flex_algo.ref new file mode 100644 index 000000000..ce31766da --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step6/show_isis_flex_algo.ref @@ -0,0 +1,112 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: None + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set + diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt1/step6/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step6/show_mpls_table.ref new file mode 100644 index 000000000..d311e924d --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step6/show_mpls_table.ref @@ -0,0 +1,450 @@ +{ + "20002":{ + "inLabel":20002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20003":{ + "inLabel":20003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20102":{ + "inLabel":20102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20102, + "outLabelStack":[ + 20102 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20103":{ + "inLabel":20103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20202":{ + "inLabel":20202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20203":{ + "inLabel":20203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20402":{ + "inLabel":20402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20402, + "outLabelStack":[ + 20402 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20403":{ + "inLabel":20403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20502":{ + "inLabel":20502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20503":{ + "inLabel":20503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20602":{ + "inLabel":20602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20603":{ + "inLabel":20603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20603, + "outLabelStack":[ + 20603 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20702":{ + "inLabel":20702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20702, + "outLabelStack":[ + 20702 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20703":{ + "inLabel":20703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "21002":{ + "inLabel":21002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21003":{ + "inLabel":21003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21102":{ + "inLabel":21102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21102, + "outLabelStack":[ + 21102 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21103":{ + "inLabel":21103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21202":{ + "inLabel":21202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21203":{ + "inLabel":21203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21402":{ + "inLabel":21402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21402, + "outLabelStack":[ + 21402 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21403":{ + "inLabel":21403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21502":{ + "inLabel":21502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21503":{ + "inLabel":21503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21602":{ + "inLabel":21602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21603":{ + "inLabel":21603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21603, + "outLabelStack":[ + 21603 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21702":{ + "inLabel":21702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21702, + "outLabelStack":[ + 21702 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21703":{ + "inLabel":21703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt1/step7/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step7/show_isis_flex_algo.ref new file mode 100644 index 000000000..e56e5af2f --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step7/show_isis_flex_algo.ref @@ -0,0 +1,108 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set + diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt1/step7/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step7/show_mpls_table.ref new file mode 100644 index 000000000..d311e924d --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step7/show_mpls_table.ref @@ -0,0 +1,450 @@ +{ + "20002":{ + "inLabel":20002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20003":{ + "inLabel":20003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20102":{ + "inLabel":20102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20102, + "outLabelStack":[ + 20102 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20103":{ + "inLabel":20103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20202":{ + "inLabel":20202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20203":{ + "inLabel":20203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20402":{ + "inLabel":20402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20402, + "outLabelStack":[ + 20402 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20403":{ + "inLabel":20403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20502":{ + "inLabel":20502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20503":{ + "inLabel":20503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20602":{ + "inLabel":20602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20603":{ + "inLabel":20603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20603, + "outLabelStack":[ + 20603 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20702":{ + "inLabel":20702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20702, + "outLabelStack":[ + 20702 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20703":{ + "inLabel":20703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "21002":{ + "inLabel":21002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21003":{ + "inLabel":21003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21102":{ + "inLabel":21102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21102, + "outLabelStack":[ + 21102 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21103":{ + "inLabel":21103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21202":{ + "inLabel":21202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21203":{ + "inLabel":21203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21402":{ + "inLabel":21402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21402, + "outLabelStack":[ + 21402 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21403":{ + "inLabel":21403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21502":{ + "inLabel":21502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21503":{ + "inLabel":21503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21602":{ + "inLabel":21602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21603":{ + "inLabel":21603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21603, + "outLabelStack":[ + 21603 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21702":{ + "inLabel":21702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21702, + "outLabelStack":[ + 21702 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21703":{ + "inLabel":21703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt1/step8/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step8/show_isis_flex_algo.ref new file mode 100644 index 000000000..942199031 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step8/show_isis_flex_algo.ref @@ -0,0 +1,126 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000004 + Bit positions: 2 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set + diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt1/step8/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step8/show_mpls_table.ref new file mode 100644 index 000000000..2b16c5313 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step8/show_mpls_table.ref @@ -0,0 +1,514 @@ +{ + "20002":{ + "inLabel":20002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20003":{ + "inLabel":20003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20102":{ + "inLabel":20102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20102, + "outLabelStack":[ + 20102 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20103":{ + "inLabel":20103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20202":{ + "inLabel":20202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20203":{ + "inLabel":20203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20302":{ + "inLabel":20302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20303":{ + "inLabel":20303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20303, + "outLabelStack":[ + 20303 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20402":{ + "inLabel":20402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20402, + "outLabelStack":[ + 20402 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20403":{ + "inLabel":20403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20502":{ + "inLabel":20502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20503":{ + "inLabel":20503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20602":{ + "inLabel":20602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20603":{ + "inLabel":20603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20603, + "outLabelStack":[ + 20603 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20702":{ + "inLabel":20702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20702, + "outLabelStack":[ + 20702 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20703":{ + "inLabel":20703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "21002":{ + "inLabel":21002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21003":{ + "inLabel":21003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21102":{ + "inLabel":21102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21102, + "outLabelStack":[ + 21102 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21103":{ + "inLabel":21103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21202":{ + "inLabel":21202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21203":{ + "inLabel":21203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21302":{ + "inLabel":21302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21303":{ + "inLabel":21303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21303, + "outLabelStack":[ + 21303 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21402":{ + "inLabel":21402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21402, + "outLabelStack":[ + 21402 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21403":{ + "inLabel":21403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21502":{ + "inLabel":21502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21503":{ + "inLabel":21503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21602":{ + "inLabel":21602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21603":{ + "inLabel":21603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21603, + "outLabelStack":[ + 21603 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21702":{ + "inLabel":21702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21702, + "outLabelStack":[ + 21702 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21703":{ + "inLabel":21703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt1/step9/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step9/show_isis_flex_algo.ref new file mode 100644 index 000000000..942199031 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step9/show_isis_flex_algo.ref @@ -0,0 +1,126 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000004 + Bit positions: 2 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set + diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt1/step9/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step9/show_mpls_table.ref new file mode 100644 index 000000000..2b16c5313 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt1/step9/show_mpls_table.ref @@ -0,0 +1,514 @@ +{ + "20002":{ + "inLabel":20002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20003":{ + "inLabel":20003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20102":{ + "inLabel":20102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20102, + "outLabelStack":[ + 20102 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20103":{ + "inLabel":20103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20202":{ + "inLabel":20202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20203":{ + "inLabel":20203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20302":{ + "inLabel":20302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20303":{ + "inLabel":20303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20303, + "outLabelStack":[ + 20303 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20402":{ + "inLabel":20402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20402, + "outLabelStack":[ + 20402 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20403":{ + "inLabel":20403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20502":{ + "inLabel":20502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20503":{ + "inLabel":20503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20602":{ + "inLabel":20602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20603":{ + "inLabel":20603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20603, + "outLabelStack":[ + 20603 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.2" + } + ] + }, + "20702":{ + "inLabel":20702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20702, + "outLabelStack":[ + 20702 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "20703":{ + "inLabel":20703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.3" + } + ] + }, + "21002":{ + "inLabel":21002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21003":{ + "inLabel":21003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21102":{ + "inLabel":21102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21102, + "outLabelStack":[ + 21102 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21103":{ + "inLabel":21103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21202":{ + "inLabel":21202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21203":{ + "inLabel":21203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21302":{ + "inLabel":21302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21303":{ + "inLabel":21303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21303, + "outLabelStack":[ + 21303 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21402":{ + "inLabel":21402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21402, + "outLabelStack":[ + 21402 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21403":{ + "inLabel":21403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21502":{ + "inLabel":21502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21503":{ + "inLabel":21503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21602":{ + "inLabel":21602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21603":{ + "inLabel":21603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21603, + "outLabelStack":[ + 21603 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21702":{ + "inLabel":21702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21702, + "outLabelStack":[ + 21702 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21703":{ + "inLabel":21703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt1/zebra.conf b/tests/topotests/isis_sr_flex_algo_topo1/rt1/zebra.conf new file mode 100644 index 000000000..5140eda73 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt1/zebra.conf @@ -0,0 +1,39 @@ +log file zebra.log +! +hostname rt1 +! +log stdout notifications +log monitor notifications +log commands +! +!debug zebra packet +!debug zebra dplane +!debug zebra kernel +! +affinity-map red bit-position 0 +affinity-map blue bit-position 1 +affinity-map green bit-position 2 +affinity-map yellow bit-position 3 +affinity-map orange bit-position 4 +! +interface lo + ip address 1.1.1.1/32 + ipv6 address 2001:db8:1000::1/128 +! +interface eth-rt2 + ip address 10.12.0.1/24 + link-params + affinity red + exit-link-params +! +interface eth-rt3 + ip address 10.13.0.1/24 + link-params + affinity green yellow orange + exit-link-params +! +ip forwarding +ipv6 forwarding +! +line vty +! diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt2/isisd.conf b/tests/topotests/isis_sr_flex_algo_topo1/rt2/isisd.conf new file mode 100644 index 000000000..8655e7434 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt2/isisd.conf @@ -0,0 +1,96 @@ +password 1 +hostname rt2 +log file isisd.log +! +!debug northbound +!debug isis events +!debug isis route-events +!debug isis spf-events +!debug isis sr-events +!debug isis lsp-gen +! +affinity-map red bit-position 0 +affinity-map blue bit-position 1 +affinity-map green bit-position 2 +affinity-map yellow bit-position 3 +affinity-map orange bit-position 4 +! +interface lo + ip router isis 1 + ipv6 router isis 1 + isis passive +! +interface eth-rt1 + ip router isis 1 + ipv6 router isis 1 + isis hello-multiplier 3 + isis network point-to-point +! +interface eth-rt3 + ip router isis 1 + ipv6 router isis 1 + isis hello-multiplier 3 + isis network point-to-point +! +router isis 1 + lsp-gen-interval 2 + net 49.0000.0000.0000.0002.00 + is-type level-1 + topology ipv6-unicast + mpls-te on + ! + flex-algo 201 + dataplane sr-mpls + advertise-definition + affinity exclude-any red + ! + flex-algo 202 + dataplane sr-mpls + advertise-definition + affinity exclude-any blue + ! + flex-algo 203 + dataplane sr-mpls + advertise-definition + affinity exclude-any green + ! + flex-algo 204 + dataplane sr-mpls + advertise-definition + affinity include-any blue green + ! + flex-algo 205 + dataplane sr-mpls + advertise-definition + affinity include-any red green + ! + flex-algo 206 + dataplane sr-mpls + advertise-definition + affinity include-any red blue + ! + flex-algo 207 + dataplane sr-mpls + advertise-definition + affinity include-all yellow orange + ! + segment-routing on + segment-routing global-block 20000 23999 + segment-routing node-msd 8 + segment-routing prefix 2.2.2.2/32 index 2 + segment-routing prefix 2.2.2.2/32 algorithm 201 index 102 + segment-routing prefix 2.2.2.2/32 algorithm 202 index 202 + segment-routing prefix 2.2.2.2/32 algorithm 203 index 302 + segment-routing prefix 2.2.2.2/32 algorithm 204 index 402 + segment-routing prefix 2.2.2.2/32 algorithm 205 index 502 + segment-routing prefix 2.2.2.2/32 algorithm 206 index 602 + segment-routing prefix 2.2.2.2/32 algorithm 207 index 702 + segment-routing prefix 2001:db8:1000::2/128 index 1002 + segment-routing prefix 2001:db8:1000::2/128 algorithm 201 index 1102 + segment-routing prefix 2001:db8:1000::2/128 algorithm 202 index 1202 + segment-routing prefix 2001:db8:1000::2/128 algorithm 203 index 1302 + segment-routing prefix 2001:db8:1000::2/128 algorithm 204 index 1402 + segment-routing prefix 2001:db8:1000::2/128 algorithm 205 index 1502 + segment-routing prefix 2001:db8:1000::2/128 algorithm 206 index 1602 + segment-routing prefix 2001:db8:1000::2/128 algorithm 207 index 1702 +! diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt2/step1/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step1/show_isis_flex_algo.ref new file mode 100644 index 000000000..defa3efa6 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step1/show_isis_flex_algo.ref @@ -0,0 +1,125 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000004 + Bit positions: 2 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt2/step1/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step1/show_mpls_table.ref new file mode 100644 index 000000000..099045a14 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step1/show_mpls_table.ref @@ -0,0 +1,514 @@ +{ + "20001":{ + "inLabel":20001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20003":{ + "inLabel":20003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20101":{ + "inLabel":20101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20101, + "outLabelStack":[ + 20101 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20103":{ + "inLabel":20103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20201":{ + "inLabel":20201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20203":{ + "inLabel":20203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20203, + "outLabelStack":[ + 20203 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20301":{ + "inLabel":20301, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20303":{ + "inLabel":20303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20401":{ + "inLabel":20401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20401, + "outLabelStack":[ + 20401 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20403":{ + "inLabel":20403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20501":{ + "inLabel":20501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20503":{ + "inLabel":20503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20503, + "outLabelStack":[ + 20503 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20601":{ + "inLabel":20601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20603":{ + "inLabel":20603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20701":{ + "inLabel":20701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20701, + "outLabelStack":[ + 20701 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20703":{ + "inLabel":20703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "21001":{ + "inLabel":21001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21003":{ + "inLabel":21003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21101":{ + "inLabel":21101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21101, + "outLabelStack":[ + 21101 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21103":{ + "inLabel":21103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21201":{ + "inLabel":21201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21203":{ + "inLabel":21203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21203, + "outLabelStack":[ + 21203 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21301":{ + "inLabel":21301, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21303":{ + "inLabel":21303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21401":{ + "inLabel":21401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21401, + "outLabelStack":[ + 21401 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21403":{ + "inLabel":21403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21501":{ + "inLabel":21501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21503":{ + "inLabel":21503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21503, + "outLabelStack":[ + 21503 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21601":{ + "inLabel":21601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21603":{ + "inLabel":21603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21701":{ + "inLabel":21701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21701, + "outLabelStack":[ + 21701 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21703":{ + "inLabel":21703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt2/step10/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step10/show_isis_flex_algo.ref new file mode 100644 index 000000000..defa3efa6 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step10/show_isis_flex_algo.ref @@ -0,0 +1,125 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000004 + Bit positions: 2 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt2/step10/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step10/show_mpls_table.ref new file mode 100644 index 000000000..099045a14 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step10/show_mpls_table.ref @@ -0,0 +1,514 @@ +{ + "20001":{ + "inLabel":20001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20003":{ + "inLabel":20003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20101":{ + "inLabel":20101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20101, + "outLabelStack":[ + 20101 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20103":{ + "inLabel":20103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20201":{ + "inLabel":20201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20203":{ + "inLabel":20203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20203, + "outLabelStack":[ + 20203 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20301":{ + "inLabel":20301, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20303":{ + "inLabel":20303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20401":{ + "inLabel":20401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20401, + "outLabelStack":[ + 20401 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20403":{ + "inLabel":20403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20501":{ + "inLabel":20501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20503":{ + "inLabel":20503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20503, + "outLabelStack":[ + 20503 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20601":{ + "inLabel":20601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20603":{ + "inLabel":20603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20701":{ + "inLabel":20701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20701, + "outLabelStack":[ + 20701 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20703":{ + "inLabel":20703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "21001":{ + "inLabel":21001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21003":{ + "inLabel":21003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21101":{ + "inLabel":21101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21101, + "outLabelStack":[ + 21101 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21103":{ + "inLabel":21103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21201":{ + "inLabel":21201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21203":{ + "inLabel":21203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21203, + "outLabelStack":[ + 21203 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21301":{ + "inLabel":21301, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21303":{ + "inLabel":21303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21401":{ + "inLabel":21401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21401, + "outLabelStack":[ + 21401 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21403":{ + "inLabel":21403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21501":{ + "inLabel":21501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21503":{ + "inLabel":21503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21503, + "outLabelStack":[ + 21503 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21601":{ + "inLabel":21601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21603":{ + "inLabel":21603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21701":{ + "inLabel":21701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21701, + "outLabelStack":[ + 21701 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21703":{ + "inLabel":21703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt2/step11/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step11/show_isis_flex_algo.ref new file mode 100644 index 000000000..defa3efa6 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step11/show_isis_flex_algo.ref @@ -0,0 +1,125 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000004 + Bit positions: 2 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt2/step11/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step11/show_mpls_table.ref new file mode 100644 index 000000000..0ed0eb31e --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step11/show_mpls_table.ref @@ -0,0 +1,514 @@ +{ + "20001":{ + "inLabel":20001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20003":{ + "inLabel":20003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20101":{ + "inLabel":20101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20101, + "outLabelStack":[ + 20101 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20103":{ + "inLabel":20103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20201":{ + "inLabel":20201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20203":{ + "inLabel":20203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20203, + "outLabelStack":[ + 20203 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20303":{ + "inLabel":20303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20311":{ + "inLabel":20311, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20401":{ + "inLabel":20401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20401, + "outLabelStack":[ + 20401 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20403":{ + "inLabel":20403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20501":{ + "inLabel":20501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20503":{ + "inLabel":20503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20503, + "outLabelStack":[ + 20503 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20601":{ + "inLabel":20601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20603":{ + "inLabel":20603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20701":{ + "inLabel":20701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20701, + "outLabelStack":[ + 20701 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20703":{ + "inLabel":20703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "21001":{ + "inLabel":21001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21003":{ + "inLabel":21003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21101":{ + "inLabel":21101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21101, + "outLabelStack":[ + 21101 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21103":{ + "inLabel":21103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21201":{ + "inLabel":21201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21203":{ + "inLabel":21203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21203, + "outLabelStack":[ + 21203 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21303":{ + "inLabel":21303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21311":{ + "inLabel":21311, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21401":{ + "inLabel":21401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21401, + "outLabelStack":[ + 21401 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21403":{ + "inLabel":21403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21501":{ + "inLabel":21501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21503":{ + "inLabel":21503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21503, + "outLabelStack":[ + 21503 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21601":{ + "inLabel":21601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21603":{ + "inLabel":21603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21701":{ + "inLabel":21701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21701, + "outLabelStack":[ + 21701 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21703":{ + "inLabel":21703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt2/step2/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step2/show_isis_flex_algo.ref new file mode 100644 index 000000000..defa3efa6 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step2/show_isis_flex_algo.ref @@ -0,0 +1,125 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000004 + Bit positions: 2 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt2/step2/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step2/show_mpls_table.ref new file mode 100644 index 000000000..099045a14 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step2/show_mpls_table.ref @@ -0,0 +1,514 @@ +{ + "20001":{ + "inLabel":20001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20003":{ + "inLabel":20003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20101":{ + "inLabel":20101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20101, + "outLabelStack":[ + 20101 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20103":{ + "inLabel":20103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20201":{ + "inLabel":20201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20203":{ + "inLabel":20203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20203, + "outLabelStack":[ + 20203 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20301":{ + "inLabel":20301, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20303":{ + "inLabel":20303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20401":{ + "inLabel":20401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20401, + "outLabelStack":[ + 20401 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20403":{ + "inLabel":20403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20501":{ + "inLabel":20501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20503":{ + "inLabel":20503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20503, + "outLabelStack":[ + 20503 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20601":{ + "inLabel":20601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20603":{ + "inLabel":20603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20701":{ + "inLabel":20701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20701, + "outLabelStack":[ + 20701 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20703":{ + "inLabel":20703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "21001":{ + "inLabel":21001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21003":{ + "inLabel":21003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21101":{ + "inLabel":21101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21101, + "outLabelStack":[ + 21101 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21103":{ + "inLabel":21103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21201":{ + "inLabel":21201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21203":{ + "inLabel":21203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21203, + "outLabelStack":[ + 21203 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21301":{ + "inLabel":21301, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21303":{ + "inLabel":21303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21401":{ + "inLabel":21401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21401, + "outLabelStack":[ + 21401 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21403":{ + "inLabel":21403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21501":{ + "inLabel":21501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21503":{ + "inLabel":21503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21503, + "outLabelStack":[ + 21503 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21601":{ + "inLabel":21601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21603":{ + "inLabel":21603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21701":{ + "inLabel":21701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21701, + "outLabelStack":[ + 21701 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21703":{ + "inLabel":21703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt2/step3/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step3/show_isis_flex_algo.ref new file mode 100644 index 000000000..b10cb7086 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step3/show_isis_flex_algo.ref @@ -0,0 +1,114 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: Not found + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt2/step3/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step3/show_mpls_table.ref new file mode 100644 index 000000000..8b407387b --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step3/show_mpls_table.ref @@ -0,0 +1,450 @@ +{ + "20001":{ + "inLabel":20001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20003":{ + "inLabel":20003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20101":{ + "inLabel":20101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20101, + "outLabelStack":[ + 20101 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20103":{ + "inLabel":20103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20201":{ + "inLabel":20201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20203":{ + "inLabel":20203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20203, + "outLabelStack":[ + 20203 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20401":{ + "inLabel":20401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20401, + "outLabelStack":[ + 20401 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20403":{ + "inLabel":20403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20501":{ + "inLabel":20501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20503":{ + "inLabel":20503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20503, + "outLabelStack":[ + 20503 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20601":{ + "inLabel":20601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20603":{ + "inLabel":20603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20701":{ + "inLabel":20701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20701, + "outLabelStack":[ + 20701 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20703":{ + "inLabel":20703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "21001":{ + "inLabel":21001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21003":{ + "inLabel":21003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21101":{ + "inLabel":21101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21101, + "outLabelStack":[ + 21101 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21103":{ + "inLabel":21103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21201":{ + "inLabel":21201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21203":{ + "inLabel":21203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21203, + "outLabelStack":[ + 21203 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21401":{ + "inLabel":21401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21401, + "outLabelStack":[ + 21401 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21403":{ + "inLabel":21403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21501":{ + "inLabel":21501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21503":{ + "inLabel":21503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21503, + "outLabelStack":[ + 21503 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21601":{ + "inLabel":21601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21603":{ + "inLabel":21603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21701":{ + "inLabel":21701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21701, + "outLabelStack":[ + 21701 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21703":{ + "inLabel":21703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt2/step4/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step4/show_isis_flex_algo.ref new file mode 100644 index 000000000..defa3efa6 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step4/show_isis_flex_algo.ref @@ -0,0 +1,125 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000004 + Bit positions: 2 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt2/step4/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step4/show_mpls_table.ref new file mode 100644 index 000000000..099045a14 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step4/show_mpls_table.ref @@ -0,0 +1,514 @@ +{ + "20001":{ + "inLabel":20001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20003":{ + "inLabel":20003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20101":{ + "inLabel":20101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20101, + "outLabelStack":[ + 20101 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20103":{ + "inLabel":20103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20201":{ + "inLabel":20201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20203":{ + "inLabel":20203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20203, + "outLabelStack":[ + 20203 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20301":{ + "inLabel":20301, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20303":{ + "inLabel":20303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20401":{ + "inLabel":20401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20401, + "outLabelStack":[ + 20401 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20403":{ + "inLabel":20403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20501":{ + "inLabel":20501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20503":{ + "inLabel":20503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20503, + "outLabelStack":[ + 20503 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20601":{ + "inLabel":20601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20603":{ + "inLabel":20603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20701":{ + "inLabel":20701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20701, + "outLabelStack":[ + 20701 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20703":{ + "inLabel":20703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "21001":{ + "inLabel":21001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21003":{ + "inLabel":21003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21101":{ + "inLabel":21101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21101, + "outLabelStack":[ + 21101 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21103":{ + "inLabel":21103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21201":{ + "inLabel":21201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21203":{ + "inLabel":21203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21203, + "outLabelStack":[ + 21203 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21301":{ + "inLabel":21301, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21303":{ + "inLabel":21303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21401":{ + "inLabel":21401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21401, + "outLabelStack":[ + 21401 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21403":{ + "inLabel":21403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21501":{ + "inLabel":21501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21503":{ + "inLabel":21503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21503, + "outLabelStack":[ + 21503 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21601":{ + "inLabel":21601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21603":{ + "inLabel":21603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21701":{ + "inLabel":21701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21701, + "outLabelStack":[ + 21701 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21703":{ + "inLabel":21703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt2/step5/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step5/show_isis_flex_algo.ref new file mode 100644 index 000000000..defa3efa6 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step5/show_isis_flex_algo.ref @@ -0,0 +1,125 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000004 + Bit positions: 2 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt2/step5/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step5/show_mpls_table.ref new file mode 100644 index 000000000..099045a14 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step5/show_mpls_table.ref @@ -0,0 +1,514 @@ +{ + "20001":{ + "inLabel":20001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20003":{ + "inLabel":20003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20101":{ + "inLabel":20101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20101, + "outLabelStack":[ + 20101 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20103":{ + "inLabel":20103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20201":{ + "inLabel":20201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20203":{ + "inLabel":20203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20203, + "outLabelStack":[ + 20203 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20301":{ + "inLabel":20301, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20303":{ + "inLabel":20303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20401":{ + "inLabel":20401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20401, + "outLabelStack":[ + 20401 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20403":{ + "inLabel":20403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20501":{ + "inLabel":20501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20503":{ + "inLabel":20503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20503, + "outLabelStack":[ + 20503 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20601":{ + "inLabel":20601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20603":{ + "inLabel":20603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20701":{ + "inLabel":20701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20701, + "outLabelStack":[ + 20701 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20703":{ + "inLabel":20703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "21001":{ + "inLabel":21001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21003":{ + "inLabel":21003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21101":{ + "inLabel":21101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21101, + "outLabelStack":[ + 21101 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21103":{ + "inLabel":21103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21201":{ + "inLabel":21201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21203":{ + "inLabel":21203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21203, + "outLabelStack":[ + 21203 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21301":{ + "inLabel":21301, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21303":{ + "inLabel":21303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21401":{ + "inLabel":21401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21401, + "outLabelStack":[ + 21401 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21403":{ + "inLabel":21403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21501":{ + "inLabel":21501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21503":{ + "inLabel":21503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21503, + "outLabelStack":[ + 21503 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21601":{ + "inLabel":21601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21603":{ + "inLabel":21603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21701":{ + "inLabel":21701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21701, + "outLabelStack":[ + 21701 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21703":{ + "inLabel":21703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt2/step6/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step6/show_isis_flex_algo.ref new file mode 100644 index 000000000..358c4310e --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step6/show_isis_flex_algo.ref @@ -0,0 +1,111 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: None + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt2/step6/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step6/show_mpls_table.ref new file mode 100644 index 000000000..8b407387b --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step6/show_mpls_table.ref @@ -0,0 +1,450 @@ +{ + "20001":{ + "inLabel":20001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20003":{ + "inLabel":20003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20101":{ + "inLabel":20101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20101, + "outLabelStack":[ + 20101 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20103":{ + "inLabel":20103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20201":{ + "inLabel":20201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20203":{ + "inLabel":20203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20203, + "outLabelStack":[ + 20203 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20401":{ + "inLabel":20401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20401, + "outLabelStack":[ + 20401 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20403":{ + "inLabel":20403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20501":{ + "inLabel":20501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20503":{ + "inLabel":20503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20503, + "outLabelStack":[ + 20503 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20601":{ + "inLabel":20601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20603":{ + "inLabel":20603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20701":{ + "inLabel":20701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20701, + "outLabelStack":[ + 20701 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20703":{ + "inLabel":20703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "21001":{ + "inLabel":21001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21003":{ + "inLabel":21003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21101":{ + "inLabel":21101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21101, + "outLabelStack":[ + 21101 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21103":{ + "inLabel":21103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21201":{ + "inLabel":21201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21203":{ + "inLabel":21203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21203, + "outLabelStack":[ + 21203 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21401":{ + "inLabel":21401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21401, + "outLabelStack":[ + 21401 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21403":{ + "inLabel":21403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21501":{ + "inLabel":21501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21503":{ + "inLabel":21503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21503, + "outLabelStack":[ + 21503 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21601":{ + "inLabel":21601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21603":{ + "inLabel":21603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21701":{ + "inLabel":21701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21701, + "outLabelStack":[ + 21701 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21703":{ + "inLabel":21703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt2/step7/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step7/show_isis_flex_algo.ref new file mode 100644 index 000000000..04d07e641 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step7/show_isis_flex_algo.ref @@ -0,0 +1,107 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt2/step7/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step7/show_mpls_table.ref new file mode 100644 index 000000000..8b407387b --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step7/show_mpls_table.ref @@ -0,0 +1,450 @@ +{ + "20001":{ + "inLabel":20001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20003":{ + "inLabel":20003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20101":{ + "inLabel":20101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20101, + "outLabelStack":[ + 20101 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20103":{ + "inLabel":20103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20201":{ + "inLabel":20201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20203":{ + "inLabel":20203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20203, + "outLabelStack":[ + 20203 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20401":{ + "inLabel":20401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20401, + "outLabelStack":[ + 20401 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20403":{ + "inLabel":20403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20501":{ + "inLabel":20501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20503":{ + "inLabel":20503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20503, + "outLabelStack":[ + 20503 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20601":{ + "inLabel":20601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20603":{ + "inLabel":20603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20701":{ + "inLabel":20701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20701, + "outLabelStack":[ + 20701 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20703":{ + "inLabel":20703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "21001":{ + "inLabel":21001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21003":{ + "inLabel":21003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21101":{ + "inLabel":21101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21101, + "outLabelStack":[ + 21101 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21103":{ + "inLabel":21103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21201":{ + "inLabel":21201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21203":{ + "inLabel":21203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21203, + "outLabelStack":[ + 21203 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21401":{ + "inLabel":21401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21401, + "outLabelStack":[ + 21401 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21403":{ + "inLabel":21403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21501":{ + "inLabel":21501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21503":{ + "inLabel":21503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21503, + "outLabelStack":[ + 21503 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21601":{ + "inLabel":21601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21603":{ + "inLabel":21603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21701":{ + "inLabel":21701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21701, + "outLabelStack":[ + 21701 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21703":{ + "inLabel":21703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt2/step8/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step8/show_isis_flex_algo.ref new file mode 100644 index 000000000..defa3efa6 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step8/show_isis_flex_algo.ref @@ -0,0 +1,125 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000004 + Bit positions: 2 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt2/step8/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step8/show_mpls_table.ref new file mode 100644 index 000000000..099045a14 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step8/show_mpls_table.ref @@ -0,0 +1,514 @@ +{ + "20001":{ + "inLabel":20001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20003":{ + "inLabel":20003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20101":{ + "inLabel":20101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20101, + "outLabelStack":[ + 20101 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20103":{ + "inLabel":20103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20201":{ + "inLabel":20201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20203":{ + "inLabel":20203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20203, + "outLabelStack":[ + 20203 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20301":{ + "inLabel":20301, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20303":{ + "inLabel":20303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20401":{ + "inLabel":20401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20401, + "outLabelStack":[ + 20401 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20403":{ + "inLabel":20403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20501":{ + "inLabel":20501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20503":{ + "inLabel":20503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20503, + "outLabelStack":[ + 20503 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20601":{ + "inLabel":20601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20603":{ + "inLabel":20603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20701":{ + "inLabel":20701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20701, + "outLabelStack":[ + 20701 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20703":{ + "inLabel":20703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "21001":{ + "inLabel":21001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21003":{ + "inLabel":21003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21101":{ + "inLabel":21101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21101, + "outLabelStack":[ + 21101 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21103":{ + "inLabel":21103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21201":{ + "inLabel":21201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21203":{ + "inLabel":21203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21203, + "outLabelStack":[ + 21203 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21301":{ + "inLabel":21301, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21303":{ + "inLabel":21303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21401":{ + "inLabel":21401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21401, + "outLabelStack":[ + 21401 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21403":{ + "inLabel":21403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21501":{ + "inLabel":21501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21503":{ + "inLabel":21503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21503, + "outLabelStack":[ + 21503 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21601":{ + "inLabel":21601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21603":{ + "inLabel":21603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21701":{ + "inLabel":21701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21701, + "outLabelStack":[ + 21701 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21703":{ + "inLabel":21703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt2/step9/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step9/show_isis_flex_algo.ref new file mode 100644 index 000000000..defa3efa6 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step9/show_isis_flex_algo.ref @@ -0,0 +1,125 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000004 + Bit positions: 2 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: yes + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt2/step9/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step9/show_mpls_table.ref new file mode 100644 index 000000000..3db0ebfbf --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt2/step9/show_mpls_table.ref @@ -0,0 +1,482 @@ +{ + "20001":{ + "inLabel":20001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20003":{ + "inLabel":20003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20101":{ + "inLabel":20101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20101, + "outLabelStack":[ + 20101 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20103":{ + "inLabel":20103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20201":{ + "inLabel":20201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20203":{ + "inLabel":20203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20203, + "outLabelStack":[ + 20203 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20303":{ + "inLabel":20303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20401":{ + "inLabel":20401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20401, + "outLabelStack":[ + 20401 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20403":{ + "inLabel":20403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20501":{ + "inLabel":20501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20503":{ + "inLabel":20503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20503, + "outLabelStack":[ + 20503 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20601":{ + "inLabel":20601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.12.0.1" + } + ] + }, + "20603":{ + "inLabel":20603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20701":{ + "inLabel":20701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20701, + "outLabelStack":[ + 20701 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "20703":{ + "inLabel":20703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.3" + } + ] + }, + "21001":{ + "inLabel":21001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21003":{ + "inLabel":21003, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21101":{ + "inLabel":21101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21101, + "outLabelStack":[ + 21101 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21103":{ + "inLabel":21103, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21201":{ + "inLabel":21201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21203":{ + "inLabel":21203, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21203, + "outLabelStack":[ + 21203 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21303":{ + "inLabel":21303, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21401":{ + "inLabel":21401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21401, + "outLabelStack":[ + 21401 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21403":{ + "inLabel":21403, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21501":{ + "inLabel":21501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21503":{ + "inLabel":21503, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21503, + "outLabelStack":[ + 21503 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21601":{ + "inLabel":21601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21603":{ + "inLabel":21603, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21701":{ + "inLabel":21701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21701, + "outLabelStack":[ + 21701 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + }, + "21703":{ + "inLabel":21703, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt3" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt2/zebra.conf b/tests/topotests/isis_sr_flex_algo_topo1/rt2/zebra.conf new file mode 100644 index 000000000..388348fce --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt2/zebra.conf @@ -0,0 +1,39 @@ +log file zebra.log +! +hostname rt2 +! +log stdout notifications +log monitor notifications +log commands +! +!debug zebra packet +!debug zebra dplane +!debug zebra kernel +! +affinity-map red bit-position 0 +affinity-map blue bit-position 1 +affinity-map green bit-position 2 +affinity-map yellow bit-position 3 +affinity-map orange bit-position 4 +! +interface lo + ip address 2.2.2.2/32 + ipv6 address 2001:db8:1000::2/128 +! +interface eth-rt1 + ip address 10.12.0.2/24 + link-params + affinity red + exit-link-params +! +interface eth-rt3 + ip address 10.23.0.2/24 + link-params + affinity blue yellow orange + exit-link-params +! +ip forwarding +ipv6 forwarding +! +line vty +! diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt3/isisd.conf b/tests/topotests/isis_sr_flex_algo_topo1/rt3/isisd.conf new file mode 100644 index 000000000..d77af81d7 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt3/isisd.conf @@ -0,0 +1,76 @@ +password 1 +hostname rt3 +log file isisd.log +! +!debug northbound +!debug isis events +!debug isis route-events +!debug isis spf-events +!debug isis sr-events +!debug isis lsp-gen +! +affinity-map red bit-position 0 +affinity-map blue bit-position 1 +affinity-map green bit-position 2 +affinity-map yellow bit-position 3 +affinity-map orange bit-position 4 +! +interface lo + ip router isis 1 + ipv6 router isis 1 + isis passive +! +interface eth-rt1 + ip router isis 1 + ipv6 router isis 1 + isis hello-multiplier 3 + isis network point-to-point +! +interface eth-rt2 + ip router isis 1 + ipv6 router isis 1 + isis hello-multiplier 3 + isis network point-to-point +! +router isis 1 + lsp-gen-interval 2 + net 49.0000.0000.0000.0003.00 + is-type level-1 + topology ipv6-unicast + mpls-te on + ! + flex-algo 201 + dataplane sr-mpls + flex-algo 202 + dataplane sr-mpls + flex-algo 203 + dataplane sr-mpls + flex-algo 204 + dataplane sr-mpls + flex-algo 205 + dataplane sr-mpls + flex-algo 206 + dataplane sr-mpls + flex-algo 207 + dataplane sr-mpls + ! + segment-routing on + segment-routing global-block 20000 23999 + segment-routing node-msd 8 + segment-routing prefix 3.3.3.3/32 index 3 + segment-routing prefix 3.3.3.3/32 algorithm 201 index 103 + segment-routing prefix 3.3.3.3/32 algorithm 202 index 203 + segment-routing prefix 3.3.3.3/32 algorithm 203 index 303 + segment-routing prefix 3.3.3.3/32 algorithm 204 index 403 + segment-routing prefix 3.3.3.3/32 algorithm 205 index 503 + segment-routing prefix 3.3.3.3/32 algorithm 206 index 603 + segment-routing prefix 3.3.3.3/32 algorithm 207 index 703 + segment-routing prefix 2001:db8:1000::3/128 index 1003 + segment-routing prefix 2001:db8:1000::3/128 algorithm 201 index 1103 + segment-routing prefix 2001:db8:1000::3/128 algorithm 202 index 1203 + segment-routing prefix 2001:db8:1000::3/128 algorithm 203 index 1303 + segment-routing prefix 2001:db8:1000::3/128 algorithm 204 index 1403 + segment-routing prefix 2001:db8:1000::3/128 algorithm 205 index 1503 + segment-routing prefix 2001:db8:1000::3/128 algorithm 206 index 1603 + segment-routing prefix 2001:db8:1000::3/128 algorithm 207 index 1703 +! diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt3/step1/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step1/show_isis_flex_algo.ref new file mode 100644 index 000000000..795473493 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step1/show_isis_flex_algo.ref @@ -0,0 +1,125 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000004 + Bit positions: 2 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set \ No newline at end of file diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt3/step1/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step1/show_mpls_table.ref new file mode 100644 index 000000000..9ab0c74d0 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step1/show_mpls_table.ref @@ -0,0 +1,514 @@ +{ + "20001":{ + "inLabel":20001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20002":{ + "inLabel":20002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20101":{ + "inLabel":20101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20102":{ + "inLabel":20102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20201":{ + "inLabel":20201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20202":{ + "inLabel":20202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20202, + "outLabelStack":[ + 20202 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20301":{ + "inLabel":20301, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20301, + "outLabelStack":[ + 20301 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20302":{ + "inLabel":20302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20401":{ + "inLabel":20401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20402":{ + "inLabel":20402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20501":{ + "inLabel":20501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20502":{ + "inLabel":20502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20502, + "outLabelStack":[ + 20502 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20601":{ + "inLabel":20601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20601, + "outLabelStack":[ + 20601 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20602":{ + "inLabel":20602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20701":{ + "inLabel":20701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20702":{ + "inLabel":20702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "21001":{ + "inLabel":21001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21002":{ + "inLabel":21002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21101":{ + "inLabel":21101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21102":{ + "inLabel":21102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21201":{ + "inLabel":21201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21202":{ + "inLabel":21202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21202, + "outLabelStack":[ + 21202 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21301":{ + "inLabel":21301, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21301, + "outLabelStack":[ + 21301 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21302":{ + "inLabel":21302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21401":{ + "inLabel":21401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21402":{ + "inLabel":21402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21501":{ + "inLabel":21501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21502":{ + "inLabel":21502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21502, + "outLabelStack":[ + 21502 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21601":{ + "inLabel":21601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21601, + "outLabelStack":[ + 21601 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21602":{ + "inLabel":21602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21701":{ + "inLabel":21701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21702":{ + "inLabel":21702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt3/step10/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step10/show_isis_flex_algo.ref new file mode 100644 index 000000000..85182db33 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step10/show_isis_flex_algo.ref @@ -0,0 +1,125 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000004 + Bit positions: 2 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt3/step10/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step10/show_mpls_table.ref new file mode 100644 index 000000000..9ab0c74d0 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step10/show_mpls_table.ref @@ -0,0 +1,514 @@ +{ + "20001":{ + "inLabel":20001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20002":{ + "inLabel":20002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20101":{ + "inLabel":20101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20102":{ + "inLabel":20102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20201":{ + "inLabel":20201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20202":{ + "inLabel":20202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20202, + "outLabelStack":[ + 20202 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20301":{ + "inLabel":20301, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20301, + "outLabelStack":[ + 20301 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20302":{ + "inLabel":20302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20401":{ + "inLabel":20401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20402":{ + "inLabel":20402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20501":{ + "inLabel":20501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20502":{ + "inLabel":20502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20502, + "outLabelStack":[ + 20502 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20601":{ + "inLabel":20601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20601, + "outLabelStack":[ + 20601 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20602":{ + "inLabel":20602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20701":{ + "inLabel":20701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20702":{ + "inLabel":20702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "21001":{ + "inLabel":21001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21002":{ + "inLabel":21002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21101":{ + "inLabel":21101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21102":{ + "inLabel":21102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21201":{ + "inLabel":21201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21202":{ + "inLabel":21202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21202, + "outLabelStack":[ + 21202 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21301":{ + "inLabel":21301, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21301, + "outLabelStack":[ + 21301 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21302":{ + "inLabel":21302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21401":{ + "inLabel":21401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21402":{ + "inLabel":21402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21501":{ + "inLabel":21501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21502":{ + "inLabel":21502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21502, + "outLabelStack":[ + 21502 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21601":{ + "inLabel":21601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21601, + "outLabelStack":[ + 21601 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21602":{ + "inLabel":21602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21701":{ + "inLabel":21701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21702":{ + "inLabel":21702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt3/step11/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step11/show_isis_flex_algo.ref new file mode 100644 index 000000000..85182db33 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step11/show_isis_flex_algo.ref @@ -0,0 +1,125 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000004 + Bit positions: 2 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt3/step11/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step11/show_mpls_table.ref new file mode 100644 index 000000000..57755b00e --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step11/show_mpls_table.ref @@ -0,0 +1,514 @@ +{ + "20001":{ + "inLabel":20001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20002":{ + "inLabel":20002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20101":{ + "inLabel":20101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20102":{ + "inLabel":20102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20201":{ + "inLabel":20201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20202":{ + "inLabel":20202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20202, + "outLabelStack":[ + 20202 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20302":{ + "inLabel":20302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20311":{ + "inLabel":20311, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20311, + "outLabelStack":[ + 20311 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20401":{ + "inLabel":20401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20402":{ + "inLabel":20402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20501":{ + "inLabel":20501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20502":{ + "inLabel":20502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20502, + "outLabelStack":[ + 20502 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20601":{ + "inLabel":20601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20601, + "outLabelStack":[ + 20601 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20602":{ + "inLabel":20602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20701":{ + "inLabel":20701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20702":{ + "inLabel":20702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "21001":{ + "inLabel":21001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21002":{ + "inLabel":21002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21101":{ + "inLabel":21101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21102":{ + "inLabel":21102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21201":{ + "inLabel":21201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21202":{ + "inLabel":21202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21202, + "outLabelStack":[ + 21202 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21302":{ + "inLabel":21302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21311":{ + "inLabel":21311, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21311, + "outLabelStack":[ + 21311 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21401":{ + "inLabel":21401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21402":{ + "inLabel":21402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21501":{ + "inLabel":21501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21502":{ + "inLabel":21502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21502, + "outLabelStack":[ + 21502 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21601":{ + "inLabel":21601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21601, + "outLabelStack":[ + 21601 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21602":{ + "inLabel":21602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21701":{ + "inLabel":21701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21702":{ + "inLabel":21702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt3/step2/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step2/show_isis_flex_algo.ref new file mode 100644 index 000000000..85182db33 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step2/show_isis_flex_algo.ref @@ -0,0 +1,125 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000004 + Bit positions: 2 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt3/step2/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step2/show_mpls_table.ref new file mode 100644 index 000000000..9ab0c74d0 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step2/show_mpls_table.ref @@ -0,0 +1,514 @@ +{ + "20001":{ + "inLabel":20001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20002":{ + "inLabel":20002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20101":{ + "inLabel":20101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20102":{ + "inLabel":20102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20201":{ + "inLabel":20201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20202":{ + "inLabel":20202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20202, + "outLabelStack":[ + 20202 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20301":{ + "inLabel":20301, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20301, + "outLabelStack":[ + 20301 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20302":{ + "inLabel":20302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20401":{ + "inLabel":20401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20402":{ + "inLabel":20402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20501":{ + "inLabel":20501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20502":{ + "inLabel":20502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20502, + "outLabelStack":[ + 20502 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20601":{ + "inLabel":20601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20601, + "outLabelStack":[ + 20601 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20602":{ + "inLabel":20602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20701":{ + "inLabel":20701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20702":{ + "inLabel":20702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "21001":{ + "inLabel":21001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21002":{ + "inLabel":21002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21101":{ + "inLabel":21101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21102":{ + "inLabel":21102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21201":{ + "inLabel":21201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21202":{ + "inLabel":21202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21202, + "outLabelStack":[ + 21202 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21301":{ + "inLabel":21301, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21301, + "outLabelStack":[ + 21301 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21302":{ + "inLabel":21302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21401":{ + "inLabel":21401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21402":{ + "inLabel":21402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21501":{ + "inLabel":21501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21502":{ + "inLabel":21502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21502, + "outLabelStack":[ + 21502 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21601":{ + "inLabel":21601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21601, + "outLabelStack":[ + 21601 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21602":{ + "inLabel":21602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21701":{ + "inLabel":21701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21702":{ + "inLabel":21702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt3/step3/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step3/show_isis_flex_algo.ref new file mode 100644 index 000000000..2ccc4f165 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step3/show_isis_flex_algo.ref @@ -0,0 +1,114 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: Not found + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt3/step3/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step3/show_mpls_table.ref new file mode 100644 index 000000000..1b57f575b --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step3/show_mpls_table.ref @@ -0,0 +1,450 @@ +{ + "20001":{ + "inLabel":20001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20002":{ + "inLabel":20002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20101":{ + "inLabel":20101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20102":{ + "inLabel":20102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20201":{ + "inLabel":20201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20202":{ + "inLabel":20202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20202, + "outLabelStack":[ + 20202 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20401":{ + "inLabel":20401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20402":{ + "inLabel":20402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20501":{ + "inLabel":20501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20502":{ + "inLabel":20502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20502, + "outLabelStack":[ + 20502 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20601":{ + "inLabel":20601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20601, + "outLabelStack":[ + 20601 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20602":{ + "inLabel":20602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20701":{ + "inLabel":20701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20702":{ + "inLabel":20702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "21001":{ + "inLabel":21001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21002":{ + "inLabel":21002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21101":{ + "inLabel":21101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21102":{ + "inLabel":21102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21201":{ + "inLabel":21201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21202":{ + "inLabel":21202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21202, + "outLabelStack":[ + 21202 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21401":{ + "inLabel":21401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21402":{ + "inLabel":21402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21501":{ + "inLabel":21501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21502":{ + "inLabel":21502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21502, + "outLabelStack":[ + 21502 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21601":{ + "inLabel":21601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21601, + "outLabelStack":[ + 21601 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21602":{ + "inLabel":21602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21701":{ + "inLabel":21701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21702":{ + "inLabel":21702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt3/step4/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step4/show_isis_flex_algo.ref new file mode 100644 index 000000000..85182db33 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step4/show_isis_flex_algo.ref @@ -0,0 +1,125 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000004 + Bit positions: 2 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt3/step4/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step4/show_mpls_table.ref new file mode 100644 index 000000000..9ab0c74d0 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step4/show_mpls_table.ref @@ -0,0 +1,514 @@ +{ + "20001":{ + "inLabel":20001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20002":{ + "inLabel":20002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20101":{ + "inLabel":20101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20102":{ + "inLabel":20102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20201":{ + "inLabel":20201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20202":{ + "inLabel":20202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20202, + "outLabelStack":[ + 20202 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20301":{ + "inLabel":20301, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20301, + "outLabelStack":[ + 20301 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20302":{ + "inLabel":20302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20401":{ + "inLabel":20401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20402":{ + "inLabel":20402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20501":{ + "inLabel":20501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20502":{ + "inLabel":20502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20502, + "outLabelStack":[ + 20502 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20601":{ + "inLabel":20601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20601, + "outLabelStack":[ + 20601 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20602":{ + "inLabel":20602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20701":{ + "inLabel":20701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20702":{ + "inLabel":20702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "21001":{ + "inLabel":21001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21002":{ + "inLabel":21002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21101":{ + "inLabel":21101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21102":{ + "inLabel":21102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21201":{ + "inLabel":21201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21202":{ + "inLabel":21202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21202, + "outLabelStack":[ + 21202 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21301":{ + "inLabel":21301, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21301, + "outLabelStack":[ + 21301 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21302":{ + "inLabel":21302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21401":{ + "inLabel":21401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21402":{ + "inLabel":21402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21501":{ + "inLabel":21501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21502":{ + "inLabel":21502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21502, + "outLabelStack":[ + 21502 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21601":{ + "inLabel":21601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21601, + "outLabelStack":[ + 21601 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21602":{ + "inLabel":21602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21701":{ + "inLabel":21701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21702":{ + "inLabel":21702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt3/step5/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step5/show_isis_flex_algo.ref new file mode 100644 index 000000000..85182db33 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step5/show_isis_flex_algo.ref @@ -0,0 +1,125 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000004 + Bit positions: 2 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt3/step5/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step5/show_mpls_table.ref new file mode 100644 index 000000000..9ab0c74d0 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step5/show_mpls_table.ref @@ -0,0 +1,514 @@ +{ + "20001":{ + "inLabel":20001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20002":{ + "inLabel":20002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20101":{ + "inLabel":20101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20102":{ + "inLabel":20102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20201":{ + "inLabel":20201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20202":{ + "inLabel":20202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20202, + "outLabelStack":[ + 20202 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20301":{ + "inLabel":20301, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20301, + "outLabelStack":[ + 20301 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20302":{ + "inLabel":20302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20401":{ + "inLabel":20401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20402":{ + "inLabel":20402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20501":{ + "inLabel":20501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20502":{ + "inLabel":20502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20502, + "outLabelStack":[ + 20502 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20601":{ + "inLabel":20601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20601, + "outLabelStack":[ + 20601 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20602":{ + "inLabel":20602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20701":{ + "inLabel":20701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20702":{ + "inLabel":20702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "21001":{ + "inLabel":21001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21002":{ + "inLabel":21002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21101":{ + "inLabel":21101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21102":{ + "inLabel":21102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21201":{ + "inLabel":21201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21202":{ + "inLabel":21202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21202, + "outLabelStack":[ + 21202 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21301":{ + "inLabel":21301, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21301, + "outLabelStack":[ + 21301 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21302":{ + "inLabel":21302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21401":{ + "inLabel":21401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21402":{ + "inLabel":21402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21501":{ + "inLabel":21501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21502":{ + "inLabel":21502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21502, + "outLabelStack":[ + 21502 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21601":{ + "inLabel":21601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21601, + "outLabelStack":[ + 21601 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21602":{ + "inLabel":21602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21701":{ + "inLabel":21701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21702":{ + "inLabel":21702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt3/step6/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step6/show_isis_flex_algo.ref new file mode 100644 index 000000000..903c0f2be --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step6/show_isis_flex_algo.ref @@ -0,0 +1,111 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: None + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt3/step6/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step6/show_mpls_table.ref new file mode 100644 index 000000000..1b57f575b --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step6/show_mpls_table.ref @@ -0,0 +1,450 @@ +{ + "20001":{ + "inLabel":20001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20002":{ + "inLabel":20002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20101":{ + "inLabel":20101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20102":{ + "inLabel":20102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20201":{ + "inLabel":20201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20202":{ + "inLabel":20202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20202, + "outLabelStack":[ + 20202 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20401":{ + "inLabel":20401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20402":{ + "inLabel":20402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20501":{ + "inLabel":20501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20502":{ + "inLabel":20502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20502, + "outLabelStack":[ + 20502 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20601":{ + "inLabel":20601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20601, + "outLabelStack":[ + 20601 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20602":{ + "inLabel":20602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20701":{ + "inLabel":20701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20702":{ + "inLabel":20702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "21001":{ + "inLabel":21001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21002":{ + "inLabel":21002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21101":{ + "inLabel":21101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21102":{ + "inLabel":21102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21201":{ + "inLabel":21201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21202":{ + "inLabel":21202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21202, + "outLabelStack":[ + 21202 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21401":{ + "inLabel":21401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21402":{ + "inLabel":21402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21501":{ + "inLabel":21501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21502":{ + "inLabel":21502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21502, + "outLabelStack":[ + 21502 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21601":{ + "inLabel":21601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21601, + "outLabelStack":[ + 21601 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21602":{ + "inLabel":21602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21701":{ + "inLabel":21701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21702":{ + "inLabel":21702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt3/step7/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step7/show_isis_flex_algo.ref new file mode 100644 index 000000000..f36d96579 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step7/show_isis_flex_algo.ref @@ -0,0 +1,107 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt3/step7/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step7/show_mpls_table.ref new file mode 100644 index 000000000..1b57f575b --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step7/show_mpls_table.ref @@ -0,0 +1,450 @@ +{ + "20001":{ + "inLabel":20001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20002":{ + "inLabel":20002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20101":{ + "inLabel":20101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20102":{ + "inLabel":20102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20201":{ + "inLabel":20201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20202":{ + "inLabel":20202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20202, + "outLabelStack":[ + 20202 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20401":{ + "inLabel":20401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20402":{ + "inLabel":20402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20501":{ + "inLabel":20501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20502":{ + "inLabel":20502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20502, + "outLabelStack":[ + 20502 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20601":{ + "inLabel":20601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20601, + "outLabelStack":[ + 20601 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20602":{ + "inLabel":20602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20701":{ + "inLabel":20701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20702":{ + "inLabel":20702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "21001":{ + "inLabel":21001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21002":{ + "inLabel":21002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21101":{ + "inLabel":21101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21102":{ + "inLabel":21102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21201":{ + "inLabel":21201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21202":{ + "inLabel":21202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21202, + "outLabelStack":[ + 21202 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21401":{ + "inLabel":21401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21402":{ + "inLabel":21402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21501":{ + "inLabel":21501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21502":{ + "inLabel":21502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21502, + "outLabelStack":[ + 21502 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21601":{ + "inLabel":21601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21601, + "outLabelStack":[ + 21601 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21602":{ + "inLabel":21602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21701":{ + "inLabel":21701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21702":{ + "inLabel":21702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt3/step8/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step8/show_isis_flex_algo.ref new file mode 100644 index 000000000..85182db33 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step8/show_isis_flex_algo.ref @@ -0,0 +1,125 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000004 + Bit positions: 2 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt3/step8/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step8/show_mpls_table.ref new file mode 100644 index 000000000..9ab0c74d0 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step8/show_mpls_table.ref @@ -0,0 +1,514 @@ +{ + "20001":{ + "inLabel":20001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20002":{ + "inLabel":20002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20101":{ + "inLabel":20101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20102":{ + "inLabel":20102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20201":{ + "inLabel":20201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20202":{ + "inLabel":20202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20202, + "outLabelStack":[ + 20202 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20301":{ + "inLabel":20301, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20301, + "outLabelStack":[ + 20301 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20302":{ + "inLabel":20302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20401":{ + "inLabel":20401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20402":{ + "inLabel":20402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20501":{ + "inLabel":20501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20502":{ + "inLabel":20502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20502, + "outLabelStack":[ + 20502 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20601":{ + "inLabel":20601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20601, + "outLabelStack":[ + 20601 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20602":{ + "inLabel":20602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20701":{ + "inLabel":20701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20702":{ + "inLabel":20702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "21001":{ + "inLabel":21001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21002":{ + "inLabel":21002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21101":{ + "inLabel":21101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21102":{ + "inLabel":21102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21201":{ + "inLabel":21201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21202":{ + "inLabel":21202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21202, + "outLabelStack":[ + 21202 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21301":{ + "inLabel":21301, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21301, + "outLabelStack":[ + 21301 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21302":{ + "inLabel":21302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21401":{ + "inLabel":21401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21402":{ + "inLabel":21402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21501":{ + "inLabel":21501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21502":{ + "inLabel":21502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21502, + "outLabelStack":[ + 21502 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21601":{ + "inLabel":21601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21601, + "outLabelStack":[ + 21601 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21602":{ + "inLabel":21602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21701":{ + "inLabel":21701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21702":{ + "inLabel":21702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt3/step9/show_isis_flex_algo.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step9/show_isis_flex_algo.ref new file mode 100644 index 000000000..85182db33 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step9/show_isis_flex_algo.ref @@ -0,0 +1,125 @@ +Area 1: Algorithm 201 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000001 + Bit positions: 0 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 202 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000002 + Bit positions: 1 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 203 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: 0x00000004 + Bit positions: 2 + Include-all admin-group: not-set + Include-any admin-group: not-set + +Area 1: Algorithm 204 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000006 + Bit positions: 1, 2 + +Area 1: Algorithm 205 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000005 + Bit positions: 0, 2 + +Area 1: Algorithm 206 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: not-set + Include-any admin-group: 0x00000003 + Bit positions: 0, 1 + +Area 1: Algorithm 207 + + Enabled Data-Planes: SR-MPLS + + Elected and running Flexible-Algorithm Definition: + Source: 0000.0000.0002 + Priority: 128 + Equal to local: no + Local state: enabled + Calculation type: spf + Metric type: igp + Prefix-metric: disabled + Exclude SRLG: disabled + Exclude-any admin-group: not-set + Include-all admin-group: 0x00000018 + Bit positions: 3, 4 + Include-any admin-group: not-set diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt3/step9/show_mpls_table.ref b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step9/show_mpls_table.ref new file mode 100644 index 000000000..8ae983a79 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt3/step9/show_mpls_table.ref @@ -0,0 +1,482 @@ +{ + "20001":{ + "inLabel":20001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20002":{ + "inLabel":20002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20101":{ + "inLabel":20101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20102":{ + "inLabel":20102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20201":{ + "inLabel":20201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20202":{ + "inLabel":20202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20202, + "outLabelStack":[ + 20202 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20302":{ + "inLabel":20302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20401":{ + "inLabel":20401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20402":{ + "inLabel":20402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20501":{ + "inLabel":20501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20502":{ + "inLabel":20502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20502, + "outLabelStack":[ + 20502 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20601":{ + "inLabel":20601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":20601, + "outLabelStack":[ + 20601 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20602":{ + "inLabel":20602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "20701":{ + "inLabel":20701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.13.0.1" + } + ] + }, + "20702":{ + "inLabel":20702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "nexthop":"10.23.0.2" + } + ] + }, + "21001":{ + "inLabel":21001, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21002":{ + "inLabel":21002, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21101":{ + "inLabel":21101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21102":{ + "inLabel":21102, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21201":{ + "inLabel":21201, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21202":{ + "inLabel":21202, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21202, + "outLabelStack":[ + 21202 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21302":{ + "inLabel":21302, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21401":{ + "inLabel":21401, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21402":{ + "inLabel":21402, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21501":{ + "inLabel":21501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21502":{ + "inLabel":21502, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21502, + "outLabelStack":[ + 21502 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21601":{ + "inLabel":21601, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":21601, + "outLabelStack":[ + 21601 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21602":{ + "inLabel":21602, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + }, + "21701":{ + "inLabel":21701, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt1" + } + ] + }, + "21702":{ + "inLabel":21702, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "outLabelStack":[ + 3 + ], + "distance":150, + "installed":true, + "interface":"eth-rt2" + } + ] + } +} diff --git a/tests/topotests/isis_sr_flex_algo_topo1/rt3/zebra.conf b/tests/topotests/isis_sr_flex_algo_topo1/rt3/zebra.conf new file mode 100644 index 000000000..fb45ee128 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/rt3/zebra.conf @@ -0,0 +1,39 @@ +log file zebra.log +! +hostname rt3 +! +log stdout notifications +log monitor notifications +log commands +! +!debug zebra packet +!debug zebra dplane +!debug zebra kernel +! +affinity-map red bit-position 0 +affinity-map blue bit-position 1 +affinity-map green bit-position 2 +affinity-map yellow bit-position 3 +affinity-map orange bit-position 4 +! +interface lo + ip address 3.3.3.3/32 + ipv6 address 2001:db8:1000::3/128 +! +interface eth-rt1 + ip address 10.13.0.3/24 + link-params + affinity green yellow orange + exit-link-params +! +interface eth-rt2 + ip address 10.23.0.3/24 + link-params + affinity blue yellow orange + exit-link-params +! +ip forwarding +ipv6 forwarding +! +line vty +! diff --git a/tests/topotests/isis_sr_flex_algo_topo1/test_isis_sr_flex_algo_topo1.py b/tests/topotests/isis_sr_flex_algo_topo1/test_isis_sr_flex_algo_topo1.py new file mode 100755 index 000000000..85600beb0 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo1/test_isis_sr_flex_algo_topo1.py @@ -0,0 +1,583 @@ +#!/usr/bin/env python +# SPDX-License-Identifier: ISC + +# +# Part of NetDEF Topology Tests +# +# Copyright 2021 by LINE Corporation, Hiroki Shirokura +# Copyright 2023 6WIND S.A. + +""" +test_isis_sr_flex_algo_topo1.py: + +[+] Flex-Algos 201 exclude red +[+] Flex-Algos 202 exclude blue +[+] Flex-Algos 203 exclude green +[+] Flex-Algos 204 include-any blue green +[+] Flex-Algos 205 include-any red green +[+] Flex-Algos 206 include-any red blue +[+] Flex-Algos 207 include-all yellow orange + + +--------+ 10.12.0.0/24 +--------+ + | | red | | + | RT1 |----------------| RT2 | + | | | | + +--------+ +--------+ + 10.13.0.0/24 \\ / 10.23.0.0/24 + green \\ / blue + yellow \\ / yellow + orange +--------+ orange + | | + | RT3 | + | | + +--------+ +""" + +import os +import sys +import pytest +import json +import tempfile +from functools import partial + +# Save the Current Working Directory to find configuration files. +CWD = os.path.dirname(os.path.realpath(__file__)) +sys.path.append(os.path.join(CWD, "../")) + +# pylint: disable=C0413 +# Import topogen and topotest helpers +from lib import topotest +from lib.topogen import Topogen, TopoRouter, get_topogen +from lib.topolog import logger + + +pytestmark = [pytest.mark.isisd] + +# Global multi-dimensional dictionary containing all expected outputs +outputs = {} + + +def build_topo(tgen): + "Build function" + + def connect_routers(tgen, left_idx, right_idx): + left = "rt{}".format(left_idx) + right = "rt{}".format(right_idx) + switch = tgen.add_switch("s-{}-{}".format(left, right)) + switch.add_link(tgen.gears[left], nodeif="eth-{}".format(right)) + switch.add_link(tgen.gears[right], nodeif="eth-{}".format(left)) + l_addr = "52:54:00:{}:{}:{}".format(left_idx, right_idx, left_idx) + tgen.gears[left].run("ip link set eth-{} down".format(right)) + tgen.gears[left].run("ip link set eth-{} address {}".format(right, l_addr)) + tgen.gears[left].run("ip link set eth-{} up".format(right)) + r_addr = "52:54:00:{}:{}:{}".format(left_idx, right_idx, right_idx) + tgen.gears[right].run("ip link set eth-{} down".format(left)) + tgen.gears[right].run("ip link set eth-{} address {}".format(left, r_addr)) + tgen.gears[right].run("ip link set eth-{} up".format(left)) + + tgen.add_router("rt1") + tgen.add_router("rt2") + tgen.add_router("rt3") + connect_routers(tgen, 1, 2) + connect_routers(tgen, 2, 3) + connect_routers(tgen, 3, 1) + + # + # Populate multi-dimensional dictionary containing all expected outputs + # + number_of_steps = 11 + filenames = [ + "show_mpls_table.ref", + "show_isis_flex_algo.ref", + ] + for rname in ["rt1", "rt2", "rt3"]: + outputs[rname] = {} + for step in range(1, number_of_steps + 1): + outputs[rname][step] = {} + for filename in filenames: + # Get snapshots relative to the expected network convergence + filename_pullpath = "{}/{}/step{}/{}".format(CWD, rname, step, filename) + outputs[rname][step][filename] = open(filename_pullpath).read() + + +def setup_module(mod): + "Sets up the pytest environment" + tgen = Topogen(build_topo, mod.__name__) + frrdir = tgen.config.get(tgen.CONFIG_SECTION, "frrdir") + if not os.path.isfile(os.path.join(frrdir, "pathd")): + pytest.skip("pathd daemon wasn't built") + tgen.start_topology() + router_list = tgen.routers() + + # For all registered routers, load the zebra configuration file + for rname, router in router_list.items(): + router.load_config( TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))) + router.load_config( TopoRouter.RD_ISIS, os.path.join(CWD, "{}/isisd.conf".format(rname))) + tgen.start_router() + + +def teardown_module(mod): + "Teardown the pytest environment" + tgen = get_topogen() + tgen.stop_topology() + + +def setup_testcase(msg): + logger.info(msg) + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + return tgen + + +def router_compare_json_output(rname, command, reference): + "Compare router JSON output" + + logger.info('Comparing router "%s" "%s" output', rname, command) + + tgen = get_topogen() + expected = json.loads(reference) + + # Run test function until we get an result. Wait at most 60 seconds. + test_func = partial(topotest.router_json_cmp, tgen.gears[rname], command, expected) + _, diff = topotest.run_and_expect(test_func, None, count=120, wait=0.5) + assertmsg = '"{}" JSON output mismatches the expected result'.format(rname) + assert diff is None, assertmsg + + +def router_compare_output(rname, command, reference): + "Compare router output" + + logger.info('Comparing router "%s" "%s" output', rname, command) + + tgen = get_topogen() + + # Run test function until we get an result. Wait at most 60 seconds. + test_func = partial(topotest.router_output_cmp, tgen.gears[rname], command, reference) + result, diff = topotest.run_and_expect(test_func, "", count=120, wait=0.5) + assertmsg = '{} command "{}" output mismatches the expected result:\n{}'.format(rname, command, diff) + assert result, assertmsg + + +# +# Step 1 +# +# Test initial network convergenece +# +# All flex-algo are defined and its fib entries are installed +# +def test_step1_mpls_lfib(): + logger.info("Test (step 1)") + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # For Developers + # tgen.mininet_cli() + for rname in ["rt1", "rt2", "rt3"]: + router_compare_output( + rname, "show isis flex-algo", + outputs[rname][1]["show_isis_flex_algo.ref"]) + router_compare_json_output( + rname, "show mpls table json", + outputs[rname][1]["show_mpls_table.ref"]) + + +# +# Step 2 +# +# Action(s): +# - Disable flex-algo-203 definition advertisement on rt1 +# +# Expected change(s): +# - Nothing +# +# Description: +# No change occurs because it refers to the FAD set in rt2. +# +def test_step2_mpls_lfib(): + logger.info("Test (step 2)") + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + tgen.gears["rt1"].vtysh_cmd( + """ + configure terminal + router isis 1 + flex-algo 203 + no advertise-definition + """) + + # For Developers + # tgen.mininet_cli() + for rname in ["rt1", "rt2", "rt3"]: + router_compare_output( + rname, "show isis flex-algo", + outputs[rname][2]["show_isis_flex_algo.ref"]) + router_compare_json_output( + rname, "show mpls table json", + outputs[rname][2]["show_mpls_table.ref"]) + + +# +# Step 3 +# +# Action(s): +# - Disable flex-algo-203 definition advertisement on rt2 +# +# Expected change(s): +# - rt1,rt2,rt3 should uninstall all Prefix-SIDs of flex-algo-203 +# +# Description: +# When all FADs are disappeared, all their prefix sid routes are withdrawn. +# +def test_step3_mpls_lfib(): + logger.info("Test (step 3)") + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + tgen.gears["rt2"].vtysh_cmd( + """ + configure terminal + router isis 1 + flex-algo 203 + no advertise-definition + """) + + # For Developers + # tgen.mininet_cli() + for rname in ["rt1", "rt2", "rt3"]: + router_compare_output( + rname, "show isis flex-algo", + outputs[rname][3]["show_isis_flex_algo.ref"]) + router_compare_json_output( + rname, "show mpls table json", + outputs[rname][3]["show_mpls_table.ref"]) + + +# +# Step 4 +# +# Action(s): +# - Enable flex-algo-203 definition advertisement on rt2 +# +# Expected change(s): +# - rt1,rt2,rt3 should install all Prefix-SIDs of flex-algo-203 +# +# Description: +# Since the FAD is restored, the reachability to the Prefix-SID is restored. +# +def test_step4_mpls_lfib(): + logger.info("Test (step 4)") + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + tgen.gears["rt2"].vtysh_cmd( + """ + configure terminal + router isis 1 + flex-algo 203 + advertise-definition + """) + + # For Developers + # tgen.mininet_cli() + for rname in ["rt1", "rt2", "rt3"]: + router_compare_output( + rname, "show isis flex-algo", + outputs[rname][4]["show_isis_flex_algo.ref"]) + router_compare_json_output( + rname, "show mpls table json", + outputs[rname][4]["show_mpls_table.ref"]) + + +# +# Step 5 +# +# Action(s): +# - Enable flex-algo-203 definition advertisement on rt1 +# +# Expected change(s): +# - Nothing +# +# Description: +# This does not affect the FIB, since there is already a FAD for rt2. +# However, the FAD owner will be changed from rt2 to rt1. +# +def test_step5_mpls_lfib(): + logger.info("Test (step 5)") + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + tgen.gears["rt1"].vtysh_cmd( + """ + configure terminal + router isis 1 + flex-algo 203 + advertise-definition + """) + + # For Developers + # tgen.mininet_cli() + for rname in ["rt1", "rt2", "rt3"]: + router_compare_output( + rname, "show isis flex-algo", + outputs[rname][5]["show_isis_flex_algo.ref"]) + router_compare_json_output( + rname, "show mpls table json", + outputs[rname][5]["show_mpls_table.ref"]) + + +# +# Step 6 +# +# Action(s): +# - Disable flex-algo-203 SR-MPLS dataplane on rt1 +# - Disable flex-algo-203 SR-MPLS dataplane on rt2 +# - Disable flex-algo-203 SR-MPLS dataplane on rt3 +# +# Expected change(s): +# - rt1,rt2,rt3 should uninstall all Prefix-SIDs of flex-algo-203 +# +# Description: +# Clear the Flex-Algo 203 whole settings on each routers. All routes related +# to it will be withdrawn. +# +def test_step6_mpls_lfib(): + logger.info("Test (step 6)") + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + for rname in ["rt1", "rt2", "rt3"]: + tgen.gears[rname].vtysh_cmd( + """ + configure terminal + router isis 1 + flex-algo 203 + no dataplane sr-mpls + """) + + # For Developers + # tgen.mininet_cli() + for rname in ["rt1", "rt2", "rt3"]: + router_compare_output( + rname, "show isis flex-algo", + outputs[rname][6]["show_isis_flex_algo.ref"]) + router_compare_json_output( + rname, "show mpls table json", + outputs[rname][6]["show_mpls_table.ref"]) + + +# +# Step 7 +# +# Action(s): +# - Disable flex-algo-203 all configuration on rt1 +# - Disable flex-algo-203 all configuration on rt2 +# - Disable flex-algo-203 all configuration on rt3 +# +# Expected change(s): +# - rt1,rt2,rt3 should uninstall all Prefix-SIDs of flex-algo-203 +# +# Description: +# Clear the Flex-Algo 203 whole settings on each routers. All routes related +# to it will be withdrawn. +# +def test_step7_mpls_lfib(): + logger.info("Test (step 7)") + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + for rname in ["rt1", "rt2", "rt3"]: + tgen.gears[rname].vtysh_cmd( + """ + configure terminal + router isis 1 + no flex-algo 203 + """) + + # For Developers + # tgen.mininet_cli() + for rname in ["rt1", "rt2", "rt3"]: + router_compare_output( + rname, "show isis flex-algo", + outputs[rname][7]["show_isis_flex_algo.ref"]) + router_compare_json_output( + rname, "show mpls table json", + outputs[rname][7]["show_mpls_table.ref"]) + +# +# Step 8 +# +# Action(s): +# - Enable flex-algo-203 all configuration on rt1 +# - Enable flex-algo-203 all configuration on rt2 +# - Enable flex-algo-203 all configuration on rt3 +# +# Expected change(s): +# - rt1,rt2,rt3 should install all Prefix-SIDs of flex-algo-203 +# +# Description: +# All configurations were backed. +# +def test_step8_mpls_lfib(): + logger.info("Test (step 8)") + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + tgen.gears["rt1"].vtysh_cmd( + """ + configure terminal + router isis 1 + flex-algo 203 + advertise-definition + affinity exclude-any green + dataplane sr-mpls + """) + + tgen.gears["rt2"].vtysh_cmd( + """ + configure terminal + router isis 1 + flex-algo 203 + advertise-definition + affinity exclude-any green + dataplane sr-mpls + """) + + tgen.gears["rt3"].vtysh_cmd( + """ + configure terminal + router isis 1 + flex-algo 203 + dataplane sr-mpls + """) + + # For Developers + # tgen.mininet_cli() + for rname in ["rt1", "rt2", "rt3"]: + router_compare_output( + rname, "show isis flex-algo", + outputs[rname][8]["show_isis_flex_algo.ref"]) + router_compare_json_output( + rname, "show mpls table json", + outputs[rname][8]["show_mpls_table.ref"]) + + +# +# Step 9 +# +# Action(s): +# - Disable algorithm prefix-sid of algo-203 on rt1 +# +# Expected change(s): +# - rt1 should uninstall all Prefix-SIDs of flex-algo-203 +# - rt2 should uninstall Prefix-SIDs of rt1's flex-algo-203 +# - rt3 should uninstall Prefix-SIDs of rt1's flex-algo-203 +# +def test_step9_mpls_lfib(): + logger.info("Test (step 9)") + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + tgen.gears["rt1"].vtysh_cmd( + """ + configure terminal + router isis 1 + no segment-routing prefix 1.1.1.1/32 algorithm 203 index 301 + no segment-routing prefix 2001:db8:1000::1/128 algorithm 203 index 1301 + """) + + # For Developers + # tgen.mininet_cli() + for rname in ["rt1", "rt2", "rt3"]: + router_compare_output( + rname, "show isis flex-algo", + outputs[rname][9]["show_isis_flex_algo.ref"]) + router_compare_json_output( + rname, "show mpls table json", + outputs[rname][9]["show_mpls_table.ref"]) + + +# +# Step 10 +# +# Action(s): +# - Enable algorithm prefix-sid of algo-203 on rt1 +# +# Expected change(s): +# - rt1 should install all Prefix-SIDs of flex-algo-203 +# - rt2 should install Prefix-SIDs of rt1's flex-algo-203 +# - rt3 should install Prefix-SIDs of rt1's flex-algo-203 +# +def test_step10_mpls_lfib(): + logger.info("Test (step 10)") + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + tgen.gears["rt1"].vtysh_cmd( + """ + configure terminal + router isis 1 + segment-routing prefix 1.1.1.1/32 algorithm 203 index 301 + segment-routing prefix 2001:db8:1000::1/128 algorithm 203 index 1301 + """) + + # For Developers + # tgen.mininet_cli() + for rname in ["rt1", "rt2", "rt3"]: + router_compare_output( + rname, "show isis flex-algo", + outputs[rname][10]["show_isis_flex_algo.ref"]) + router_compare_json_output( + rname, "show mpls table json", + outputs[rname][10]["show_mpls_table.ref"]) + + +# +# Step 11 +# +# Action(s): +# - Update algorithm prefix-sid of algo-203 on rt1 from 301 to 311 +# +# Expected change(s): +# - rt2 should update Prefix-SIDs of rt1's flex-algo-203 from 301 to 311 +# - rt3 should update Prefix-SIDs of rt1's flex-algo-203 from 301 to 311 +# +def test_step11_mpls_lfib(): + logger.info("Test (step 11)") + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + tgen.gears["rt1"].vtysh_cmd( + """ + configure terminal + router isis 1 + segment-routing prefix 1.1.1.1/32 algorithm 203 index 311 + segment-routing prefix 2001:db8:1000::1/128 algorithm 203 index 1311 + """) + + # For Developers + # tgen.mininet_cli() + for rname in ["rt1", "rt2", "rt3"]: + router_compare_output( + rname, "show isis flex-algo", + outputs[rname][11]["show_isis_flex_algo.ref"]) + router_compare_json_output( + rname, "show mpls table json", + outputs[rname][11]["show_mpls_table.ref"]) + + +if __name__ == "__main__": + args = ["-s"] + sys.argv[1:] + sys.exit(pytest.main(args)) From b901ee6383dbd6519d07c093ba905246605bfd71 Mon Sep 17 00:00:00 2001 From: Hiroki Shirokura Date: Sun, 21 Nov 2021 10:07:32 +0000 Subject: [PATCH 39/41] tests: add isis_sr_flex_algo_topo2 for flex-algo Add a topotest with 9 flex-algo routers to check each router's MPLS table. Signed-off-by: Hiroki Shirokura Signed-off-by: Louis Scalbert --- .../isis_sr_flex_algo_topo2/README.md | 8 + .../isis_sr_flex_algo_topo2/configure-te.sh | 46 ++ .../isis_sr_flex_algo_topo2/rt0/bgpd.conf | 17 + .../isis_sr_flex_algo_topo2/rt0/isisd.conf | 56 +++ .../isis_sr_flex_algo_topo2/rt0/pathd.conf | 20 + .../rt0/step1/route.json | 438 ++++++++++++++++++ .../isis_sr_flex_algo_topo2/rt0/zebra.conf | 34 ++ .../isis_sr_flex_algo_topo2/rt1/isisd.conf | 60 +++ .../rt1/step1/route.json | 428 +++++++++++++++++ .../isis_sr_flex_algo_topo2/rt1/zebra.conf | 40 ++ .../isis_sr_flex_algo_topo2/rt2/isisd.conf | 54 +++ .../rt2/step1/route.json | 408 ++++++++++++++++ .../isis_sr_flex_algo_topo2/rt2/zebra.conf | 37 ++ .../isis_sr_flex_algo_topo2/rt3/isisd.conf | 60 +++ .../rt3/step1/route.json | 428 +++++++++++++++++ .../isis_sr_flex_algo_topo2/rt3/zebra.conf | 40 ++ .../isis_sr_flex_algo_topo2/rt4/isisd.conf | 52 +++ .../rt4/step1/route.json | 286 ++++++++++++ .../isis_sr_flex_algo_topo2/rt4/zebra.conf | 31 ++ .../isis_sr_flex_algo_topo2/rt5/isisd.conf | 60 +++ .../rt5/step1/route.json | 428 +++++++++++++++++ .../isis_sr_flex_algo_topo2/rt5/zebra.conf | 40 ++ .../isis_sr_flex_algo_topo2/rt6/isisd.conf | 54 +++ .../rt6/step1/route.json | 408 ++++++++++++++++ .../isis_sr_flex_algo_topo2/rt6/zebra.conf | 37 ++ .../isis_sr_flex_algo_topo2/rt7/isisd.conf | 60 +++ .../rt7/step1/route.json | 428 +++++++++++++++++ .../isis_sr_flex_algo_topo2/rt7/zebra.conf | 40 ++ .../isis_sr_flex_algo_topo2/rt8/isisd.conf | 50 ++ .../rt8/step1/route.json | 286 ++++++++++++ .../isis_sr_flex_algo_topo2/rt8/zebra.conf | 29 ++ .../isis_sr_flex_algo_topo2/rt9/bgpd.conf | 17 + .../isis_sr_flex_algo_topo2/rt9/isisd.conf | 56 +++ .../isis_sr_flex_algo_topo2/rt9/pathd.conf | 20 + .../rt9/step1/route.json | 438 ++++++++++++++++++ .../isis_sr_flex_algo_topo2/rt9/zebra.conf | 34 ++ .../test_isis_sr_flex_algo_topo2.py | 187 ++++++++ 37 files changed, 5215 insertions(+) create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/README.md create mode 100755 tests/topotests/isis_sr_flex_algo_topo2/configure-te.sh create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt0/bgpd.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt0/isisd.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt0/pathd.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt0/step1/route.json create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt0/zebra.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt1/isisd.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt1/step1/route.json create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt1/zebra.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt2/isisd.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt2/step1/route.json create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt2/zebra.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt3/isisd.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt3/step1/route.json create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt3/zebra.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt4/isisd.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt4/step1/route.json create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt4/zebra.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt5/isisd.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt5/step1/route.json create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt5/zebra.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt6/isisd.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt6/step1/route.json create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt6/zebra.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt7/isisd.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt7/step1/route.json create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt7/zebra.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt8/isisd.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt8/step1/route.json create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt8/zebra.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt9/bgpd.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt9/isisd.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt9/pathd.conf create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt9/step1/route.json create mode 100644 tests/topotests/isis_sr_flex_algo_topo2/rt9/zebra.conf create mode 100755 tests/topotests/isis_sr_flex_algo_topo2/test_isis_sr_flex_algo_topo2.py diff --git a/tests/topotests/isis_sr_flex_algo_topo2/README.md b/tests/topotests/isis_sr_flex_algo_topo2/README.md new file mode 100644 index 000000000..20282c49e --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo2/README.md @@ -0,0 +1,8 @@ + +## test + +``` +fdk-enter rt9.pid iperf3 -s +fdk-enter rt0.pid iperf3 -B 111.111.111.111 -c 222.222.222.222 -P20 -t 100000 +fdk-enter rt0.pid watch -n0.1 ip -s link show +``` diff --git a/tests/topotests/isis_sr_flex_algo_topo2/configure-te.sh b/tests/topotests/isis_sr_flex_algo_topo2/configure-te.sh new file mode 100755 index 000000000..527f05b60 --- /dev/null +++ b/tests/topotests/isis_sr_flex_algo_topo2/configure-te.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +if [ $# -ne 1 ]; then + echo "invalid command syntax" 1>&2 + echo "Usage: $0 <0|128|129|130>" 1>&2 + exit 1 +fi + +case "$1" in + 0 ) echo ;; + 128 ) echo ;; + 129 ) echo ;; + 130 ) echo ;; + * ) echo "error" ; exit ;; +esac + +R0=$(cat /tmp/topotests/isis_sr_flex_algo_topo2.test_isis_sr_flex_algo_topo2/rt0.pid) +R9=$(cat /tmp/topotests/isis_sr_flex_algo_topo2.test_isis_sr_flex_algo_topo2/rt9.pid) + +set -x + +cat < +# Copyright 2023 6WIND S.A. + +""" +test_isis_sr_flex_algo_topo2.py: + +[+] Flex-Algos 128 +[+] Flex-Algos 129 +[+] Flex-Algos 130 include-any blue + + +--------+ +--------+ + | | | | + | RT1 |------------------| RT2 | + | | | | + +--------+ +--------+ + / | \\ | \\ + / | \\ | \\ ++--------+ | \\ | \\ +| | | +--------+ | +--------+ +| RT0 | | | | | | | +| | | | RT4 |------------------| RT3 | ++--------+ | | | | | | + \\ | +--------+ | +--------+ + \\ | | | | \\ + +--------+ | +--------+ | \\ + | | | | | | +--------+ + | RT5 |-------|----------| RT6 | | | | + | | | | | | | RT9 | + +--------+ | +--------+ | | | + \\ | \\ | +--------+ + \\ | \\ | / + \\ | \\ | / + +--------+ +--------+ + | | | | + | RT8 |------------------| RT7 | + | | | | + +--------+ +--------+ +""" + +import os +import sys +import pytest +import json +import time +from functools import partial + +# Save the Current Working Directory to find configuration files. +CWD = os.path.dirname(os.path.realpath(__file__)) +sys.path.append(os.path.join(CWD, "../")) + +# pylint: disable=C0413 +# Import topogen and topotest helpers +from lib import topotest +from lib.topogen import Topogen, TopoRouter, get_topogen +from lib.topolog import logger + + +pytestmark = [pytest.mark.isisd] + + +def build_topo(tgen): + "Build function" + + routers = [] + for i in range(0, 10): + rt = tgen.add_router("rt{}".format(i)) + rt.run("sysctl -w net.ipv4.fib_multipath_hash_policy=1") + + def connect_routers(tgen, left_idx, right_idx): + left = "rt{}".format(left_idx) + right = "rt{}".format(right_idx) + switch = tgen.add_switch("s-{}-{}".format(left, right)) + switch.add_link(tgen.gears[left], nodeif="eth-{}".format(right)) + switch.add_link(tgen.gears[right], nodeif="eth-{}".format(left)) + l_addr = "52:54:00:{}:{}:{}".format(left_idx, right_idx, left_idx) + tgen.gears[left].run("ip link set eth-{} down".format(right)) + tgen.gears[left].run("ip link set eth-{} address {}".format(right, l_addr)) + tgen.gears[left].run("ip link set eth-{} up".format(right)) + tgen.gears[left].run("sysctl -w net.mpls.conf.eth-{}.input=1".format(right)) + r_addr = "52:54:00:{}:{}:{}".format(left_idx, right_idx, right_idx) + tgen.gears[right].run("ip link set eth-{} down".format(left)) + tgen.gears[right].run("ip link set eth-{} address {}".format(left, r_addr)) + tgen.gears[right].run("ip link set eth-{} up".format(left)) + tgen.gears[right].run("sysctl -w net.mpls.conf.eth-{}.input=1".format(left)) + + connect_routers(tgen, 0, 1) + connect_routers(tgen, 0, 5) + connect_routers(tgen, 1, 2) + connect_routers(tgen, 1, 4) + connect_routers(tgen, 1, 5) + connect_routers(tgen, 2, 3) + connect_routers(tgen, 2, 6) + connect_routers(tgen, 3, 4) + connect_routers(tgen, 3, 7) + connect_routers(tgen, 3, 9) + connect_routers(tgen, 4, 8) + connect_routers(tgen, 5, 6) + connect_routers(tgen, 5, 8) + connect_routers(tgen, 6, 7) + connect_routers(tgen, 7, 8) + connect_routers(tgen, 7, 9) + + +def setup_module(mod): + "Sets up the pytest environment" + tgen = Topogen(build_topo, mod.__name__) + frrdir = tgen.config.get(tgen.CONFIG_SECTION, "frrdir") + if not os.path.isfile(os.path.join(frrdir, "pathd")): + pytest.skip("pathd daemon wasn't built") + tgen.start_topology() + router_list = tgen.routers() + + # For all registered routers, load the zebra configuration file + for rname, router in router_list.items(): + router.load_config( TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))) + router.load_config( TopoRouter.RD_ISIS, os.path.join(CWD, "{}/isisd.conf".format(rname))) + if rname in ["rt0", "rt9"]: + router.load_config( TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname))) + router.load_config( TopoRouter.RD_PATH, os.path.join(CWD, "{}/pathd.conf".format(rname))) + router.run("ip link add dum0 type dummy") + router.run("ip link set dum0 up") + if rname == "rt0": + router.run("ip addr add 10.255.0.1/24 dev dum0") + elif rname == "rt9": + router.run("ip addr add 10.255.9.1/24 dev dum0") + tgen.start_router() + + +def teardown_module(mod): + "Teardown the pytest environment" + tgen = get_topogen() + tgen.stop_topology() + + +def setup_testcase(msg): + logger.info(msg) + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + return tgen + +def open_json_file(filename): + try: + with open(filename, "r") as f: + return json.load(f) + except IOError: + assert False, "Could not read file {}".format(filename) + + +def check_rib(name, cmd, expected_file): + def _check(name, cmd, expected_file): + logger.info("polling") + tgen = get_topogen() + router = tgen.gears[name] + output = json.loads(router.vtysh_cmd(cmd)) + expected = open_json_file("{}/{}".format(CWD, expected_file)) + return topotest.json_cmp(output, expected) + + logger.info("[+] check {} \"{}\" {}".format(name, cmd, expected_file)) + tgen = get_topogen() + func = partial(_check, name, cmd, expected_file) + success, result = topotest.run_and_expect(func, None, count=120, wait=0.5) + assert result is None, "Failed" + + +def test_rib(): + check_rib("rt0", "show mpls table json", "rt0/step1/route.json") + check_rib("rt1", "show mpls table json", "rt1/step1/route.json") + check_rib("rt2", "show mpls table json", "rt2/step1/route.json") + check_rib("rt3", "show mpls table json", "rt3/step1/route.json") + check_rib("rt4", "show mpls table json", "rt4/step1/route.json") + check_rib("rt5", "show mpls table json", "rt5/step1/route.json") + check_rib("rt6", "show mpls table json", "rt6/step1/route.json") + check_rib("rt7", "show mpls table json", "rt7/step1/route.json") + check_rib("rt8", "show mpls table json", "rt8/step1/route.json") + check_rib("rt9", "show mpls table json", "rt9/step1/route.json") + + +if __name__ == "__main__": + args = ["-s"] + sys.argv[1:] + sys.exit(pytest.main(args)) From b95f9f37eac6272774972d413ad4b535ea214da3 Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Tue, 6 Sep 2022 16:25:55 +0200 Subject: [PATCH 40/41] doc: fix debugging-isis reference Debugging-isis tag was moved. Move it to right place. Fixes: 9389175b75 ("doc: add documentation for IS-IS Segment Routing") Signed-off-by: Louis Scalbert --- doc/user/isisd.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/user/isisd.rst b/doc/user/isisd.rst index 88fa78ddf..941f86746 100644 --- a/doc/user/isisd.rst +++ b/doc/user/isisd.rst @@ -389,8 +389,7 @@ Traffic Engineering :ref:`ospf-traffic-engineering` - -.. _debugging-isis: +.. _isis-segment-routing: Segment Routing =============== @@ -436,6 +435,8 @@ Known limitations: Show detailed information about all learned Segment Routing Nodes. +.. _debugging-isis: + Debugging ISIS ============== From cba6998236f2fdbf0e8a1ca0819a18c6d756bfee Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Mon, 29 Aug 2022 13:32:20 +0200 Subject: [PATCH 41/41] doc: add isisd flex-algo documentation Add the isisd flex-algo documentation Signed-off-by: Louis Scalbert --- doc/user/isisd.rst | 162 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 157 insertions(+), 5 deletions(-) diff --git a/doc/user/isisd.rst b/doc/user/isisd.rst index 941f86746..570b8bd18 100644 --- a/doc/user/isisd.rst +++ b/doc/user/isisd.rst @@ -316,12 +316,12 @@ Showing ISIS information Show the ISIS database globally, for a specific LSP id without or with details. -.. clicmd:: show isis topology [level-1|level-2] +.. clicmd:: show isis topology [level-1|level-2] [algorithm (128-255)] Show topology IS-IS paths to Intermediate Systems, globally, in area (level-1) or domain (level-2). -.. clicmd:: show isis route [level-1|level-2] [prefix-sid|backup] +.. clicmd:: show isis route [level-1|level-2] [prefix-sid|backup] [algorithm (128-255)] Show the ISIS routing table, as determined by the most recent SPF calculation. @@ -422,7 +422,7 @@ Known limitations: MPLS dataplane. E.g. for Linux kernel, since version 4.13 the maximum value is 32. -.. clicmd:: segment-routing prefix [algorithm (128-255)] `_ on an MPLS Segment-Routing +dataplane. The compatibility has been tested against Cisco. + +IS-IS uses by default the `Shortest-Path-First` algorithm that basically +calculates paths based on the shortest total metric to the destinations. +Flex-Algo allows new algorithms to run in parallel to compute paths in different +manners, based on metrics (IGP metric or a new type of metrics such as Traffic +Engineering (TE) metric and minimum delay...) and constraints. New metric types +are not yet implemented but constraints are already operational. Constraints can +restrict paths to links with specific affinities or avoid links with specific +affinities. Combinations of these are also possible. + +The administrator can configure up to 128 Flex-Algos in an IS-IS area. +To do so, it defines a set of Flex-Algo Definitions (FAD) which +have the following characteristics: + +- a numeric identifier (ID) between 128 and 255 inclusive +- a set of constraints (basically, include or exclude a certain given set of + links, designated by a admin-group) +- the calculation type (only the `Shortest-Path-First` is currently supported) +- the metric type (only the IGP inherited metric type is currently supported) +- some additional flags (not supported for the moment). + +A subset of routers advertises the Flex-Algo Definitions (FAD) to the other +routers within an area. In order to use a common set of FADs, each router runs a +FAD election process for each locally configured algorithm, using the following +rules: + +- If a locally configured FAD is not advertised to the area, the router does not + participate in the particular flex algorithm. +- If a given flex algorithm is running, the participation in this particular + flex algorithm stops when its advertisements are over. +- A router includes its own FAD in the election process if and only if it is + advertised to the other routers. +- If only one router advertises the FAD, the FAD is elected. +- If several FADs are advertised with different priorities, the one with the + highest priority value is selected. +- If there are multiple advertisements of the FAD with the same highest + priority, the FAD of the router with the highest IS-IS system-ID is + selected. + +Routers only use the specifications of the elected FAD regardless of the locally +configured definitions. If a router does not support one of the FAD +characteristics, it stops participating in the Flex-Algo. + +For each running Flex-Algo, the Segment-Routing SIDs must be +configured with values unique to the algorithm. It allows routers to identify +which flex algorithm they must use for a given packet. + +The following commands configure Flex-Algo at the 'router isis' configuration +level. Segment-Routing prefixes must be configured for the Flex-Algo. + +.. clicmd:: flexible-algorithm (128-255) + + Add a Flex-Algo Definition (FAD) and enter the FAD configuration + level. The algorithm ID value is in the range of 128 to 255 inclusive. + +.. clicmd:: no flexible-algorithm (128-255) + + Unconfigure a Flex-Algo Definition. + +.. clicmd:: affinity-map NAME bit-position (0-255) + + Add the specified 'affinity-map'. Affinity-map definitions are used in + FADs and in interfaces admin-group definition. + + Affinity-maps format in advertisement TLVs use the extended admin-group + format defined in the RFC7308 section 2.2. The extended admin-group uses a + 256 bits field. If an affinity-map is set, the bit at the extended + admin-group 'bit-position' is set 1, else it is set to 0. + +The following commands configure Flex-Algo at the 'router isis' and +'flexible-algorithm (128-255)' configuration level. + +.. clicmd:: advertise-definition + + Advertise the current FAD to other IS-IS routers by using specific IS-IS + TLVs. By default, the definition is is not shared with other routers. + +   A router can advertise a FAD without participating in the Flex-Algo. + +.. clicmd:: priority (0-255) + + Set the specified 'priority' in the current FAD advertisements . + +.. clicmd:: metric-type [igp|te|delay] + + Set the 'metric-type' for the current FAD. 'igp' is + the default value and refers to the classic 'Shortest-Path-First' algorithm. + If the 'te' or the 'delay' metric is selected, the value is advertised but + the flex algorithm is disabled locally because these types are not currently + supported. + +.. clicmd:: no metric-type + + Reset the 'metric-type' to the default 'igp' metric. + +.. clicmd:: affinity exclude-any NAME + + Add the specified affinity to the list of exclude-any affinities. The + Flex-Algo will compute paths that exclude the segments with any of + the specified affinities. + +.. clicmd:: no affinity exclude-any NAME + + Remove the specified affinity to the list of exclude-any affinities. + +.. clicmd:: affinity include-all NAME + + Add the specified affinity to the list of include-all affinities. The + Flex-Algo will compute paths that include the segments with all + the specified affinities. + +.. clicmd:: no affinity include-all NAME + + Remove the specified affinity to the list of include-all affinities. + +.. clicmd:: affinity include-any NAME + + Add the specified affinity to the list of include-any affinities. The + Flex-Algo will compute paths that include the segments with any of + the specified affinities. + +.. clicmd:: no affinity include-any NAME + + Remove the specified affinity to the list of include-any affinities. + +The following commands configure Flex-Algo at the 'interface' configuration +level. + +.. clicmd:: isis affinity flex-algo NAME + + Add the specified affinity to the interface. + +.. clicmd:: no isis affinity flex-algo NAME + + Remove the specified affinity from the interface. + +The following command show Flex-Algo information: + +.. clicmd:: show isis flex-algo [(128-255)] + + Show information about the elected FADs + +'show isis route', 'show isis topology' and 'show isis segment-routing node' +includes an 'algorithm (128-255)' optional argument. See +:ref:`showing-isis-information` and :ref:`isis-segment-routing`. Debugging ISIS ==============