diff options
Diffstat (limited to 'tests')
569 files changed, 34698 insertions, 5293 deletions
diff --git a/tests/bgpd/test_aspath.py b/tests/bgpd/test_aspath.py index 5fa1f11629..88579ad3e4 100644 --- a/tests/bgpd/test_aspath.py +++ b/tests/bgpd/test_aspath.py @@ -1,14 +1,16 @@ import frrtest import re -re_okfail = re.compile(r'^(?:\x1b\[3[12]m)?(?P<ret>OK|failed)'.encode('utf8'), - re.MULTILINE) +re_okfail = re.compile( + r"^(?:\x1b\[3[12]m)?(?P<ret>OK|failed)".encode("utf8"), re.MULTILINE +) + class TestAspath(frrtest.TestMultiOut): - program = './test_aspath' + program = "./test_aspath" def _parsertest(self, line): - if not hasattr(self, 'parserno'): + if not hasattr(self, "parserno"): self.parserno = -1 self.parserno += 1 @@ -17,13 +19,14 @@ class TestAspath(frrtest.TestMultiOut): self._okfail("empty prepend %s:" % line, okfail=re_okfail) def _attrtest(self, line): - if not hasattr(self, 'attrno'): + if not hasattr(self, "attrno"): self.attrno = -1 self.attrno += 1 self._onesimple("aspath_attr test %d" % self.attrno) self._okfail(line, okfail=re_okfail) + TestAspath.parsertest("seq1") TestAspath.parsertest("seq2") TestAspath.parsertest("seq3") diff --git a/tests/bgpd/test_bgp_table.c b/tests/bgpd/test_bgp_table.c index 4eb132df55..e899e5b359 100644 --- a/tests/bgpd/test_bgp_table.c +++ b/tests/bgpd/test_bgp_table.c @@ -109,10 +109,7 @@ static void check_lookup_result(struct bgp_dest *match, va_list arglist) if (bgp_dest_has_bgp_path_info_data(dest) && !prefix_in_array(dest_p, prefixes, prefix_count)) { - char buf[PREFIX2STR_BUFFER]; - - prefix2str(dest_p, buf, PREFIX2STR_BUFFER); - printf("prefix %s was not expected!\n", buf); + printf("prefix %pFX was not expected!\n", dest_p); assert(0); } } diff --git a/tests/bgpd/test_bgp_table.py b/tests/bgpd/test_bgp_table.py index 53bd37233a..8f0544249c 100644 --- a/tests/bgpd/test_bgp_table.py +++ b/tests/bgpd/test_bgp_table.py @@ -1,7 +1,9 @@ import frrtest + class TestTable(frrtest.TestMultiOut): - program = './test_bgp_table' + program = "./test_bgp_table" + for i in range(7): - TestTable.onesimple('Checks successfull') + TestTable.onesimple("Checks successfull") diff --git a/tests/bgpd/test_capability.py b/tests/bgpd/test_capability.py index 872fcb6d12..e275195537 100644 --- a/tests/bgpd/test_capability.py +++ b/tests/bgpd/test_capability.py @@ -1,7 +1,9 @@ import frrtest + class TestCapability(frrtest.TestMultiOut): - program = './test_capability' + program = "./test_capability" + TestCapability.okfail("MP4: MP IP/Uni") TestCapability.okfail("MPv6: MP IPv6/Uni") @@ -43,5 +45,9 @@ TestCapability.okfail("AS4real2: AS4 capability, in series of capabilities") TestCapability.okfail("DynCap: Dynamic Capability Message, IP/Multicast") TestCapability.okfail("DynCapLong: Dynamic Capability Message, IP/Multicast, truncated") TestCapability.okfail("DynCapPadded: Dynamic Capability Message, IP/Multicast, padded") -TestCapability.okfail("DynCapMPCpadded: Dynamic Capability Message, IP/Multicast, cap data padded") -TestCapability.okfail("DynCapMPCoverflow: Dynamic Capability Message, IP/Multicast, cap data != length") +TestCapability.okfail( + "DynCapMPCpadded: Dynamic Capability Message, IP/Multicast, cap data padded" +) +TestCapability.okfail( + "DynCapMPCoverflow: Dynamic Capability Message, IP/Multicast, cap data != length" +) diff --git a/tests/bgpd/test_ecommunity.py b/tests/bgpd/test_ecommunity.py index 3a17ec9e31..1499294f7b 100644 --- a/tests/bgpd/test_ecommunity.py +++ b/tests/bgpd/test_ecommunity.py @@ -1,9 +1,11 @@ import frrtest + class TestEcommunity(frrtest.TestMultiOut): - program = './test_ecommunity' + program = "./test_ecommunity" + -TestEcommunity.okfail('ipaddr') -TestEcommunity.okfail('ipaddr-so') -TestEcommunity.okfail('asn') -TestEcommunity.okfail('asn4') +TestEcommunity.okfail("ipaddr") +TestEcommunity.okfail("ipaddr-so") +TestEcommunity.okfail("asn") +TestEcommunity.okfail("asn4") diff --git a/tests/bgpd/test_mp_attr.py b/tests/bgpd/test_mp_attr.py index 46d0c42402..d9612bb8d3 100644 --- a/tests/bgpd/test_mp_attr.py +++ b/tests/bgpd/test_mp_attr.py @@ -1,7 +1,9 @@ import frrtest + class TestMpAttr(frrtest.TestMultiOut): - program = './test_mp_attr' + program = "./test_mp_attr" + TestMpAttr.okfail("IPv6: IPV6 MP Reach, global nexthop, 1 NLRI") TestMpAttr.okfail("IPv6-2: IPV6 MP Reach, global nexthop, 2 NLRIs") @@ -16,13 +18,27 @@ TestMpAttr.okfail("IPv4: IPv4 MP Reach, 2 NLRIs + default") TestMpAttr.okfail("IPv4-nhlen: IPv4 MP Reach, nexthop lenth overflow") TestMpAttr.okfail("IPv4-nlrilen: IPv4 MP Reach, nlri lenth overflow") TestMpAttr.okfail("IPv4-VPNv4: IPv4/VPNv4 MP Reach, RD, Nexthop, 2 NLRIs") -TestMpAttr.okfail("IPv4-VPNv4-bogus-plen: IPv4/MPLS-labeled VPN MP Reach, RD, Nexthop, NLRI / bogus p'len") -TestMpAttr.okfail("IPv4-VPNv4-plen1-short: IPv4/VPNv4 MP Reach, RD, Nexthop, 2 NLRIs, 1st plen short") -TestMpAttr.okfail("IPv4-VPNv4-plen1-long: IPv4/VPNv4 MP Reach, RD, Nexthop, 2 NLRIs, 1st plen long") -TestMpAttr.okfail("IPv4-VPNv4-plenn-long: IPv4/VPNv4 MP Reach, RD, Nexthop, 3 NLRIs, last plen long") -TestMpAttr.okfail("IPv4-VPNv4-plenn-short: IPv4/VPNv4 MP Reach, RD, Nexthop, 2 NLRIs, last plen short") -TestMpAttr.okfail("IPv4-VPNv4-bogus-rd-type: IPv4/VPNv4 MP Reach, RD, NH, 2 NLRI, unknown RD in 1st (log, but parse)") -TestMpAttr.okfail("IPv4-VPNv4-0-nlri: IPv4/VPNv4 MP Reach, RD, Nexthop, 3 NLRI, 3rd 0 bogus") +TestMpAttr.okfail( + "IPv4-VPNv4-bogus-plen: IPv4/MPLS-labeled VPN MP Reach, RD, Nexthop, NLRI / bogus p'len" +) +TestMpAttr.okfail( + "IPv4-VPNv4-plen1-short: IPv4/VPNv4 MP Reach, RD, Nexthop, 2 NLRIs, 1st plen short" +) +TestMpAttr.okfail( + "IPv4-VPNv4-plen1-long: IPv4/VPNv4 MP Reach, RD, Nexthop, 2 NLRIs, 1st plen long" +) +TestMpAttr.okfail( + "IPv4-VPNv4-plenn-long: IPv4/VPNv4 MP Reach, RD, Nexthop, 3 NLRIs, last plen long" +) +TestMpAttr.okfail( + "IPv4-VPNv4-plenn-short: IPv4/VPNv4 MP Reach, RD, Nexthop, 2 NLRIs, last plen short" +) +TestMpAttr.okfail( + "IPv4-VPNv4-bogus-rd-type: IPv4/VPNv4 MP Reach, RD, NH, 2 NLRI, unknown RD in 1st (log, but parse)" +) +TestMpAttr.okfail( + "IPv4-VPNv4-0-nlri: IPv4/VPNv4 MP Reach, RD, Nexthop, 3 NLRI, 3rd 0 bogus" +) TestMpAttr.okfail("IPv6-bug: IPv6, global nexthop, 1 default NLRI") TestMpAttr.okfail("IPv6-unreach: IPV6 MP Unreach, 1 NLRI") TestMpAttr.okfail("IPv6-unreach2: IPV6 MP Unreach, 2 NLRIs") diff --git a/tests/bgpd/test_mpath.c b/tests/bgpd/test_mpath.c index 99fb7b620d..520c460f15 100644 --- a/tests/bgpd/test_mpath.c +++ b/tests/bgpd/test_mpath.c @@ -106,15 +106,13 @@ static struct bgp *bgp_create_fake(as_t *as, const char *name) // bgp->group->cmp = (int (*)(void *, void *)) peer_group_cmp; bgp_evpn_init(bgp); - for (afi = AFI_IP; afi < AFI_MAX; afi++) - for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { - bgp->route[afi][safi] = bgp_table_init(bgp, afi, safi); - bgp->aggregate[afi][safi] = bgp_table_init( - bgp, afi, safi); - bgp->rib[afi][safi] = bgp_table_init(bgp, afi, safi); - bgp->maxpaths[afi][safi].maxpaths_ebgp = MULTIPATH_NUM; - bgp->maxpaths[afi][safi].maxpaths_ibgp = MULTIPATH_NUM; - } + FOREACH_AFI_SAFI (afi, safi) { + bgp->route[afi][safi] = bgp_table_init(bgp, afi, safi); + bgp->aggregate[afi][safi] = bgp_table_init(bgp, afi, safi); + bgp->rib[afi][safi] = bgp_table_init(bgp, afi, safi); + bgp->maxpaths[afi][safi].maxpaths_ebgp = MULTIPATH_NUM; + bgp->maxpaths[afi][safi].maxpaths_ibgp = MULTIPATH_NUM; + } bgp_scan_init(bgp); bgp->default_local_pref = BGP_DEFAULT_LOCAL_PREF; @@ -152,36 +150,33 @@ static int run_bgp_cfg_maximum_paths(testcase_t *t) int test_result = TEST_PASSED; bgp = t->tmp_data; - for (afi = AFI_IP; afi < AFI_MAX; afi++) - for (safi = SAFI_UNICAST; safi < SAFI_MAX; safi++) { - /* test bgp_maximum_paths_set */ - api_result = bgp_maximum_paths_set( - bgp, afi, safi, BGP_PEER_EBGP, 10, 0); - EXPECT_TRUE(api_result == 0, test_result); - api_result = bgp_maximum_paths_set( - bgp, afi, safi, BGP_PEER_IBGP, 10, 0); - EXPECT_TRUE(api_result == 0, test_result); - EXPECT_TRUE(bgp->maxpaths[afi][safi].maxpaths_ebgp - == 10, - test_result); - EXPECT_TRUE(bgp->maxpaths[afi][safi].maxpaths_ibgp - == 10, - test_result); - - /* test bgp_maximum_paths_unset */ - api_result = bgp_maximum_paths_unset(bgp, afi, safi, - BGP_PEER_EBGP); - EXPECT_TRUE(api_result == 0, test_result); - api_result = bgp_maximum_paths_unset(bgp, afi, safi, - BGP_PEER_IBGP); - EXPECT_TRUE(api_result == 0, test_result); - EXPECT_TRUE((bgp->maxpaths[afi][safi].maxpaths_ebgp - == MULTIPATH_NUM), - test_result); - EXPECT_TRUE((bgp->maxpaths[afi][safi].maxpaths_ibgp - == MULTIPATH_NUM), - test_result); - } + FOREACH_AFI_SAFI (afi, safi) { + /* test bgp_maximum_paths_set */ + api_result = bgp_maximum_paths_set(bgp, afi, safi, + BGP_PEER_EBGP, 10, 0); + EXPECT_TRUE(api_result == 0, test_result); + api_result = bgp_maximum_paths_set(bgp, afi, safi, + BGP_PEER_IBGP, 10, 0); + EXPECT_TRUE(api_result == 0, test_result); + EXPECT_TRUE(bgp->maxpaths[afi][safi].maxpaths_ebgp == 10, + test_result); + EXPECT_TRUE(bgp->maxpaths[afi][safi].maxpaths_ibgp == 10, + test_result); + + /* test bgp_maximum_paths_unset */ + api_result = + bgp_maximum_paths_unset(bgp, afi, safi, BGP_PEER_EBGP); + EXPECT_TRUE(api_result == 0, test_result); + api_result = + bgp_maximum_paths_unset(bgp, afi, safi, BGP_PEER_IBGP); + EXPECT_TRUE(api_result == 0, test_result); + EXPECT_TRUE((bgp->maxpaths[afi][safi].maxpaths_ebgp + == MULTIPATH_NUM), + test_result); + EXPECT_TRUE((bgp->maxpaths[afi][safi].maxpaths_ibgp + == MULTIPATH_NUM), + test_result); + } return test_result; } diff --git a/tests/bgpd/test_mpath.py b/tests/bgpd/test_mpath.py index ce34ff8436..582fd25c20 100644 --- a/tests/bgpd/test_mpath.py +++ b/tests/bgpd/test_mpath.py @@ -1,9 +1,10 @@ import frrtest + class TestMpath(frrtest.TestMultiOut): - program = './test_mpath' + program = "./test_mpath" + TestMpath.okfail("bgp maximum-paths config") TestMpath.okfail("bgp_mp_list") TestMpath.okfail("bgp_path_info_mpath_update") - diff --git a/tests/bgpd/test_peer_attr.c b/tests/bgpd/test_peer_attr.c index 0979622eb3..0a15886c10 100644 --- a/tests/bgpd/test_peer_attr.c +++ b/tests/bgpd/test_peer_attr.c @@ -30,6 +30,8 @@ #include "bgpd/bgp_vty.h" #include "bgpd/bgp_zebra.h" #include "bgpd/bgp_network.h" +#include "lib/routing_nb.h" +#include "bgpd/bgp_nb.h" #ifdef ENABLE_BGP_VNC #include "bgpd/rfapi/rfapi_backend.h" @@ -932,7 +934,7 @@ static struct test *test_new(const char *desc, bool use_ibgp, test->vty = vty_new(); test->vty->type = VTY_TERM; - test->vty->node = CONFIG_NODE; + vty_config_enter(test->vty, true, false); test_initialize(test); @@ -1378,6 +1380,15 @@ static void test_peer_attr(struct test *test, struct test_peer_attr *pa) test_process(test, pa, p, g->conf, true, false); } +static const struct frr_yang_module_info *const bgpd_yang_modules[] = { + &frr_bgp_info, + &frr_filter_info, + &frr_interface_info, + &frr_route_map_info, + &frr_routing_info, + &frr_vrf_info, +}; + static void bgp_startup(void) { cmd_init(1); @@ -1387,7 +1398,7 @@ static void bgp_startup(void) master = thread_master_create(NULL); yang_init(true); - nb_init(master, NULL, 0, false); + nb_init(master, bgpd_yang_modules, array_size(bgpd_yang_modules), false); bgp_master_init(master, BGP_SOCKET_SNDBUF_SIZE); bgp_option_set(BGP_OPT_NO_LISTEN); vrf_init(NULL, NULL, NULL, NULL, NULL); diff --git a/tests/bgpd/test_peer_attr.py b/tests/bgpd/test_peer_attr.py index 44068605ee..16b441b25d 100644 --- a/tests/bgpd/test_peer_attr.py +++ b/tests/bgpd/test_peer_attr.py @@ -1,196 +1,198 @@ import frrtest + class TestFlag(frrtest.TestMultiOut): - program = './test_peer_attr' + program = "./test_peer_attr" + # List of tests can be generated by executing: # $> ./test_peer_attr 2>&1 | sed -n 's/\\/\\\\/g; s/\S\+ \[test\] \(.\+\)/TestFlag.okfail(\x27\1\x27)/pg' # -TestFlag.okfail('peer\\advertisement-interval') -TestFlag.okfail('peer\\capability dynamic') -TestFlag.okfail('peer\\capability extended-nexthop') -#TestFlag.okfail('peer\\capability extended-nexthop') -TestFlag.okfail('peer\\description') -TestFlag.okfail('peer\\disable-connected-check') -TestFlag.okfail('peer\\dont-capability-negotiate') -TestFlag.okfail('peer\\enforce-first-as') -TestFlag.okfail('peer\\local-as') -TestFlag.okfail('peer\\local-as 1 no-prepend') -TestFlag.okfail('peer\\local-as 1 no-prepend replace-as') -TestFlag.okfail('peer\\override-capability') -TestFlag.okfail('peer\\passive') -TestFlag.okfail('peer\\password') -TestFlag.okfail('peer\\shutdown') -TestFlag.okfail('peer\\strict-capability-match') -TestFlag.okfail('peer\\timers') -TestFlag.okfail('peer\\timers connect') -TestFlag.okfail('peer\\update-source') -TestFlag.okfail('peer\\update-source') -TestFlag.okfail('peer\\ipv4-unicast\\addpath') -TestFlag.okfail('peer\\ipv4-multicast\\addpath') -TestFlag.okfail('peer\\ipv6-unicast\\addpath') -TestFlag.okfail('peer\\ipv6-multicast\\addpath') -TestFlag.okfail('peer\\ipv4-unicast\\allowas-in') -TestFlag.okfail('peer\\ipv4-multicast\\allowas-in') -TestFlag.okfail('peer\\ipv6-unicast\\allowas-in') -TestFlag.okfail('peer\\ipv6-multicast\\allowas-in') -TestFlag.okfail('peer\\ipv4-unicast\\allowas-in origin') -TestFlag.okfail('peer\\ipv4-multicast\\allowas-in origin') -TestFlag.okfail('peer\\ipv6-unicast\\allowas-in origin') -TestFlag.okfail('peer\\ipv6-multicast\\allowas-in origin') -TestFlag.okfail('peer\\ipv4-unicast\\as-override') -TestFlag.okfail('peer\\ipv4-multicast\\as-override') -TestFlag.okfail('peer\\ipv6-unicast\\as-override') -TestFlag.okfail('peer\\ipv6-multicast\\as-override') -TestFlag.okfail('peer\\ipv4-unicast\\attribute-unchanged as-path') -TestFlag.okfail('peer\\ipv4-multicast\\attribute-unchanged as-path') -TestFlag.okfail('peer\\ipv6-unicast\\attribute-unchanged as-path') -TestFlag.okfail('peer\\ipv6-multicast\\attribute-unchanged as-path') -TestFlag.okfail('peer\\ipv4-unicast\\attribute-unchanged next-hop') -TestFlag.okfail('peer\\ipv4-multicast\\attribute-unchanged next-hop') -TestFlag.okfail('peer\\ipv6-unicast\\attribute-unchanged next-hop') -TestFlag.okfail('peer\\ipv6-multicast\\attribute-unchanged next-hop') -TestFlag.okfail('peer\\ipv4-unicast\\attribute-unchanged med') -TestFlag.okfail('peer\\ipv4-multicast\\attribute-unchanged med') -TestFlag.okfail('peer\\ipv6-unicast\\attribute-unchanged med') -TestFlag.okfail('peer\\ipv6-multicast\\attribute-unchanged med') -TestFlag.okfail('peer\\ipv4-unicast\\attribute-unchanged as-path next-hop') -TestFlag.okfail('peer\\ipv4-multicast\\attribute-unchanged as-path next-hop') -TestFlag.okfail('peer\\ipv6-unicast\\attribute-unchanged as-path next-hop') -TestFlag.okfail('peer\\ipv6-multicast\\attribute-unchanged as-path next-hop') -TestFlag.okfail('peer\\ipv4-unicast\\attribute-unchanged as-path med') -TestFlag.okfail('peer\\ipv4-multicast\\attribute-unchanged as-path med') -TestFlag.okfail('peer\\ipv6-unicast\\attribute-unchanged as-path med') -TestFlag.okfail('peer\\ipv6-multicast\\attribute-unchanged as-path med') -TestFlag.okfail('peer\\ipv4-unicast\\attribute-unchanged as-path next-hop med') -TestFlag.okfail('peer\\ipv4-multicast\\attribute-unchanged as-path next-hop med') -TestFlag.okfail('peer\\ipv6-unicast\\attribute-unchanged as-path next-hop med') -TestFlag.okfail('peer\\ipv6-multicast\\attribute-unchanged as-path next-hop med') -TestFlag.okfail('peer\\ipv4-unicast\\capability orf prefix-list send') -TestFlag.okfail('peer\\ipv4-multicast\\capability orf prefix-list send') -TestFlag.okfail('peer\\ipv6-unicast\\capability orf prefix-list send') -TestFlag.okfail('peer\\ipv6-multicast\\capability orf prefix-list send') -TestFlag.okfail('peer\\ipv4-unicast\\capability orf prefix-list receive') -TestFlag.okfail('peer\\ipv4-multicast\\capability orf prefix-list receive') -TestFlag.okfail('peer\\ipv6-unicast\\capability orf prefix-list receive') -TestFlag.okfail('peer\\ipv6-multicast\\capability orf prefix-list receive') -TestFlag.okfail('peer\\ipv4-unicast\\capability orf prefix-list both') -TestFlag.okfail('peer\\ipv4-multicast\\capability orf prefix-list both') -TestFlag.okfail('peer\\ipv6-unicast\\capability orf prefix-list both') -TestFlag.okfail('peer\\ipv6-multicast\\capability orf prefix-list both') -TestFlag.okfail('peer\\ipv4-unicast\\default-originate') -TestFlag.okfail('peer\\ipv4-multicast\\default-originate') -TestFlag.okfail('peer\\ipv6-unicast\\default-originate') -TestFlag.okfail('peer\\ipv6-multicast\\default-originate') -TestFlag.okfail('peer\\ipv4-unicast\\default-originate route-map') -TestFlag.okfail('peer\\ipv4-multicast\\default-originate route-map') -TestFlag.okfail('peer\\ipv6-unicast\\default-originate route-map') -TestFlag.okfail('peer\\ipv6-multicast\\default-originate route-map') -TestFlag.okfail('peer\\ipv4-unicast\\distribute-list') -TestFlag.okfail('peer\\ipv4-multicast\\distribute-list') -TestFlag.okfail('peer\\ipv6-unicast\\distribute-list') -TestFlag.okfail('peer\\ipv6-multicast\\distribute-list') -TestFlag.okfail('peer\\ipv4-unicast\\distribute-list') -TestFlag.okfail('peer\\ipv4-multicast\\distribute-list') -TestFlag.okfail('peer\\ipv6-unicast\\distribute-list') -TestFlag.okfail('peer\\ipv6-multicast\\distribute-list') -TestFlag.okfail('peer\\ipv4-unicast\\filter-list') -TestFlag.okfail('peer\\ipv4-multicast\\filter-list') -TestFlag.okfail('peer\\ipv6-unicast\\filter-list') -TestFlag.okfail('peer\\ipv6-multicast\\filter-list') -TestFlag.okfail('peer\\ipv4-unicast\\filter-list') -TestFlag.okfail('peer\\ipv4-multicast\\filter-list') -TestFlag.okfail('peer\\ipv6-unicast\\filter-list') -TestFlag.okfail('peer\\ipv6-multicast\\filter-list') -TestFlag.okfail('peer\\ipv4-unicast\\maximum-prefix') -TestFlag.okfail('peer\\ipv4-multicast\\maximum-prefix') -TestFlag.okfail('peer\\ipv6-unicast\\maximum-prefix') -TestFlag.okfail('peer\\ipv6-multicast\\maximum-prefix') -TestFlag.okfail('peer\\ipv4-unicast\\maximum-prefix') -TestFlag.okfail('peer\\ipv4-multicast\\maximum-prefix') -TestFlag.okfail('peer\\ipv6-unicast\\maximum-prefix') -TestFlag.okfail('peer\\ipv6-multicast\\maximum-prefix') -TestFlag.okfail('peer\\ipv4-unicast\\maximum-prefix') -TestFlag.okfail('peer\\ipv4-multicast\\maximum-prefix') -TestFlag.okfail('peer\\ipv6-unicast\\maximum-prefix') -TestFlag.okfail('peer\\ipv6-multicast\\maximum-prefix') -TestFlag.okfail('peer\\ipv4-unicast\\maximum-prefix') -TestFlag.okfail('peer\\ipv4-multicast\\maximum-prefix') -TestFlag.okfail('peer\\ipv6-unicast\\maximum-prefix') -TestFlag.okfail('peer\\ipv6-multicast\\maximum-prefix') -TestFlag.okfail('peer\\ipv4-unicast\\maximum-prefix') -TestFlag.okfail('peer\\ipv4-multicast\\maximum-prefix') -TestFlag.okfail('peer\\ipv6-unicast\\maximum-prefix') -TestFlag.okfail('peer\\ipv6-multicast\\maximum-prefix') -TestFlag.okfail('peer\\ipv4-unicast\\next-hop-self') -TestFlag.okfail('peer\\ipv4-multicast\\next-hop-self') -TestFlag.okfail('peer\\ipv6-unicast\\next-hop-self') -TestFlag.okfail('peer\\ipv6-multicast\\next-hop-self') -TestFlag.okfail('peer\\ipv4-unicast\\next-hop-self force') -TestFlag.okfail('peer\\ipv4-multicast\\next-hop-self force') -TestFlag.okfail('peer\\ipv6-unicast\\next-hop-self force') -TestFlag.okfail('peer\\ipv6-multicast\\next-hop-self force') -TestFlag.okfail('peer\\ipv4-unicast\\prefix-list') -TestFlag.okfail('peer\\ipv4-multicast\\prefix-list') -TestFlag.okfail('peer\\ipv6-unicast\\prefix-list') -TestFlag.okfail('peer\\ipv6-multicast\\prefix-list') -TestFlag.okfail('peer\\ipv4-unicast\\prefix-list') -TestFlag.okfail('peer\\ipv4-multicast\\prefix-list') -TestFlag.okfail('peer\\ipv6-unicast\\prefix-list') -TestFlag.okfail('peer\\ipv6-multicast\\prefix-list') -TestFlag.okfail('peer\\ipv4-unicast\\remove-private-AS') -TestFlag.okfail('peer\\ipv4-multicast\\remove-private-AS') -TestFlag.okfail('peer\\ipv6-unicast\\remove-private-AS') -TestFlag.okfail('peer\\ipv6-multicast\\remove-private-AS') -TestFlag.okfail('peer\\ipv4-unicast\\remove-private-AS all') -TestFlag.okfail('peer\\ipv4-multicast\\remove-private-AS all') -TestFlag.okfail('peer\\ipv6-unicast\\remove-private-AS all') -TestFlag.okfail('peer\\ipv6-multicast\\remove-private-AS all') -TestFlag.okfail('peer\\ipv4-unicast\\remove-private-AS replace-AS') -TestFlag.okfail('peer\\ipv4-multicast\\remove-private-AS replace-AS') -TestFlag.okfail('peer\\ipv6-unicast\\remove-private-AS replace-AS') -TestFlag.okfail('peer\\ipv6-multicast\\remove-private-AS replace-AS') -TestFlag.okfail('peer\\ipv4-unicast\\remove-private-AS all replace-AS') -TestFlag.okfail('peer\\ipv4-multicast\\remove-private-AS all replace-AS') -TestFlag.okfail('peer\\ipv6-unicast\\remove-private-AS all replace-AS') -TestFlag.okfail('peer\\ipv6-multicast\\remove-private-AS all replace-AS') -TestFlag.okfail('peer\\ipv4-unicast\\route-map') -TestFlag.okfail('peer\\ipv4-multicast\\route-map') -TestFlag.okfail('peer\\ipv6-unicast\\route-map') -TestFlag.okfail('peer\\ipv6-multicast\\route-map') -TestFlag.okfail('peer\\ipv4-unicast\\route-map') -TestFlag.okfail('peer\\ipv4-multicast\\route-map') -TestFlag.okfail('peer\\ipv6-unicast\\route-map') -TestFlag.okfail('peer\\ipv6-multicast\\route-map') -TestFlag.okfail('peer\\ipv4-unicast\\route-reflector-client') -TestFlag.okfail('peer\\ipv4-multicast\\route-reflector-client') -TestFlag.okfail('peer\\ipv6-unicast\\route-reflector-client') -TestFlag.okfail('peer\\ipv6-multicast\\route-reflector-client') -TestFlag.okfail('peer\\ipv4-unicast\\route-server-client') -TestFlag.okfail('peer\\ipv4-multicast\\route-server-client') -TestFlag.okfail('peer\\ipv6-unicast\\route-server-client') -TestFlag.okfail('peer\\ipv6-multicast\\route-server-client') -TestFlag.okfail('peer\\ipv4-unicast\\send-community') -TestFlag.okfail('peer\\ipv4-multicast\\send-community') -TestFlag.okfail('peer\\ipv6-unicast\\send-community') -TestFlag.okfail('peer\\ipv6-multicast\\send-community') -TestFlag.okfail('peer\\ipv4-unicast\\send-community extended') -TestFlag.okfail('peer\\ipv4-multicast\\send-community extended') -TestFlag.okfail('peer\\ipv6-unicast\\send-community extended') -TestFlag.okfail('peer\\ipv6-multicast\\send-community extended') -TestFlag.okfail('peer\\ipv4-unicast\\send-community large') -TestFlag.okfail('peer\\ipv4-multicast\\send-community large') -TestFlag.okfail('peer\\ipv6-unicast\\send-community large') -TestFlag.okfail('peer\\ipv6-multicast\\send-community large') -TestFlag.okfail('peer\\ipv4-unicast\\soft-reconfiguration inbound') -TestFlag.okfail('peer\\ipv4-multicast\\soft-reconfiguration inbound') -TestFlag.okfail('peer\\ipv6-unicast\\soft-reconfiguration inbound') -TestFlag.okfail('peer\\ipv6-multicast\\soft-reconfiguration inbound') -TestFlag.okfail('peer\\ipv4-unicast\\unsuppress-map') -TestFlag.okfail('peer\\ipv4-multicast\\unsuppress-map') -TestFlag.okfail('peer\\ipv6-unicast\\unsuppress-map') -TestFlag.okfail('peer\\ipv6-multicast\\unsuppress-map') -TestFlag.okfail('peer\\ipv4-unicast\\weight') -TestFlag.okfail('peer\\ipv4-multicast\\weight') -TestFlag.okfail('peer\\ipv6-unicast\\weight') -TestFlag.okfail('peer\\ipv6-multicast\\weight') +TestFlag.okfail("peer\\advertisement-interval") +TestFlag.okfail("peer\\capability dynamic") +TestFlag.okfail("peer\\capability extended-nexthop") +# TestFlag.okfail('peer\\capability extended-nexthop') +TestFlag.okfail("peer\\description") +TestFlag.okfail("peer\\disable-connected-check") +TestFlag.okfail("peer\\dont-capability-negotiate") +TestFlag.okfail("peer\\enforce-first-as") +TestFlag.okfail("peer\\local-as") +TestFlag.okfail("peer\\local-as 1 no-prepend") +TestFlag.okfail("peer\\local-as 1 no-prepend replace-as") +TestFlag.okfail("peer\\override-capability") +TestFlag.okfail("peer\\passive") +TestFlag.okfail("peer\\password") +TestFlag.okfail("peer\\shutdown") +TestFlag.okfail("peer\\strict-capability-match") +TestFlag.okfail("peer\\timers") +TestFlag.okfail("peer\\timers connect") +TestFlag.okfail("peer\\update-source") +TestFlag.okfail("peer\\update-source") +TestFlag.okfail("peer\\ipv4-unicast\\addpath") +TestFlag.okfail("peer\\ipv4-multicast\\addpath") +TestFlag.okfail("peer\\ipv6-unicast\\addpath") +TestFlag.okfail("peer\\ipv6-multicast\\addpath") +TestFlag.okfail("peer\\ipv4-unicast\\allowas-in") +TestFlag.okfail("peer\\ipv4-multicast\\allowas-in") +TestFlag.okfail("peer\\ipv6-unicast\\allowas-in") +TestFlag.okfail("peer\\ipv6-multicast\\allowas-in") +TestFlag.okfail("peer\\ipv4-unicast\\allowas-in origin") +TestFlag.okfail("peer\\ipv4-multicast\\allowas-in origin") +TestFlag.okfail("peer\\ipv6-unicast\\allowas-in origin") +TestFlag.okfail("peer\\ipv6-multicast\\allowas-in origin") +TestFlag.okfail("peer\\ipv4-unicast\\as-override") +TestFlag.okfail("peer\\ipv4-multicast\\as-override") +TestFlag.okfail("peer\\ipv6-unicast\\as-override") +TestFlag.okfail("peer\\ipv6-multicast\\as-override") +TestFlag.okfail("peer\\ipv4-unicast\\attribute-unchanged as-path") +TestFlag.okfail("peer\\ipv4-multicast\\attribute-unchanged as-path") +TestFlag.okfail("peer\\ipv6-unicast\\attribute-unchanged as-path") +TestFlag.okfail("peer\\ipv6-multicast\\attribute-unchanged as-path") +TestFlag.okfail("peer\\ipv4-unicast\\attribute-unchanged next-hop") +TestFlag.okfail("peer\\ipv4-multicast\\attribute-unchanged next-hop") +TestFlag.okfail("peer\\ipv6-unicast\\attribute-unchanged next-hop") +TestFlag.okfail("peer\\ipv6-multicast\\attribute-unchanged next-hop") +TestFlag.okfail("peer\\ipv4-unicast\\attribute-unchanged med") +TestFlag.okfail("peer\\ipv4-multicast\\attribute-unchanged med") +TestFlag.okfail("peer\\ipv6-unicast\\attribute-unchanged med") +TestFlag.okfail("peer\\ipv6-multicast\\attribute-unchanged med") +TestFlag.okfail("peer\\ipv4-unicast\\attribute-unchanged as-path next-hop") +TestFlag.okfail("peer\\ipv4-multicast\\attribute-unchanged as-path next-hop") +TestFlag.okfail("peer\\ipv6-unicast\\attribute-unchanged as-path next-hop") +TestFlag.okfail("peer\\ipv6-multicast\\attribute-unchanged as-path next-hop") +TestFlag.okfail("peer\\ipv4-unicast\\attribute-unchanged as-path med") +TestFlag.okfail("peer\\ipv4-multicast\\attribute-unchanged as-path med") +TestFlag.okfail("peer\\ipv6-unicast\\attribute-unchanged as-path med") +TestFlag.okfail("peer\\ipv6-multicast\\attribute-unchanged as-path med") +TestFlag.okfail("peer\\ipv4-unicast\\attribute-unchanged as-path next-hop med") +TestFlag.okfail("peer\\ipv4-multicast\\attribute-unchanged as-path next-hop med") +TestFlag.okfail("peer\\ipv6-unicast\\attribute-unchanged as-path next-hop med") +TestFlag.okfail("peer\\ipv6-multicast\\attribute-unchanged as-path next-hop med") +TestFlag.okfail("peer\\ipv4-unicast\\capability orf prefix-list send") +TestFlag.okfail("peer\\ipv4-multicast\\capability orf prefix-list send") +TestFlag.okfail("peer\\ipv6-unicast\\capability orf prefix-list send") +TestFlag.okfail("peer\\ipv6-multicast\\capability orf prefix-list send") +TestFlag.okfail("peer\\ipv4-unicast\\capability orf prefix-list receive") +TestFlag.okfail("peer\\ipv4-multicast\\capability orf prefix-list receive") +TestFlag.okfail("peer\\ipv6-unicast\\capability orf prefix-list receive") +TestFlag.okfail("peer\\ipv6-multicast\\capability orf prefix-list receive") +TestFlag.okfail("peer\\ipv4-unicast\\capability orf prefix-list both") +TestFlag.okfail("peer\\ipv4-multicast\\capability orf prefix-list both") +TestFlag.okfail("peer\\ipv6-unicast\\capability orf prefix-list both") +TestFlag.okfail("peer\\ipv6-multicast\\capability orf prefix-list both") +TestFlag.okfail("peer\\ipv4-unicast\\default-originate") +TestFlag.okfail("peer\\ipv4-multicast\\default-originate") +TestFlag.okfail("peer\\ipv6-unicast\\default-originate") +TestFlag.okfail("peer\\ipv6-multicast\\default-originate") +TestFlag.okfail("peer\\ipv4-unicast\\default-originate route-map") +TestFlag.okfail("peer\\ipv4-multicast\\default-originate route-map") +TestFlag.okfail("peer\\ipv6-unicast\\default-originate route-map") +TestFlag.okfail("peer\\ipv6-multicast\\default-originate route-map") +TestFlag.okfail("peer\\ipv4-unicast\\distribute-list") +TestFlag.okfail("peer\\ipv4-multicast\\distribute-list") +TestFlag.okfail("peer\\ipv6-unicast\\distribute-list") +TestFlag.okfail("peer\\ipv6-multicast\\distribute-list") +TestFlag.okfail("peer\\ipv4-unicast\\distribute-list") +TestFlag.okfail("peer\\ipv4-multicast\\distribute-list") +TestFlag.okfail("peer\\ipv6-unicast\\distribute-list") +TestFlag.okfail("peer\\ipv6-multicast\\distribute-list") +TestFlag.okfail("peer\\ipv4-unicast\\filter-list") +TestFlag.okfail("peer\\ipv4-multicast\\filter-list") +TestFlag.okfail("peer\\ipv6-unicast\\filter-list") +TestFlag.okfail("peer\\ipv6-multicast\\filter-list") +TestFlag.okfail("peer\\ipv4-unicast\\filter-list") +TestFlag.okfail("peer\\ipv4-multicast\\filter-list") +TestFlag.okfail("peer\\ipv6-unicast\\filter-list") +TestFlag.okfail("peer\\ipv6-multicast\\filter-list") +TestFlag.okfail("peer\\ipv4-unicast\\maximum-prefix") +TestFlag.okfail("peer\\ipv4-multicast\\maximum-prefix") +TestFlag.okfail("peer\\ipv6-unicast\\maximum-prefix") +TestFlag.okfail("peer\\ipv6-multicast\\maximum-prefix") +TestFlag.okfail("peer\\ipv4-unicast\\maximum-prefix") +TestFlag.okfail("peer\\ipv4-multicast\\maximum-prefix") +TestFlag.okfail("peer\\ipv6-unicast\\maximum-prefix") +TestFlag.okfail("peer\\ipv6-multicast\\maximum-prefix") +TestFlag.okfail("peer\\ipv4-unicast\\maximum-prefix") +TestFlag.okfail("peer\\ipv4-multicast\\maximum-prefix") +TestFlag.okfail("peer\\ipv6-unicast\\maximum-prefix") +TestFlag.okfail("peer\\ipv6-multicast\\maximum-prefix") +TestFlag.okfail("peer\\ipv4-unicast\\maximum-prefix") +TestFlag.okfail("peer\\ipv4-multicast\\maximum-prefix") +TestFlag.okfail("peer\\ipv6-unicast\\maximum-prefix") +TestFlag.okfail("peer\\ipv6-multicast\\maximum-prefix") +TestFlag.okfail("peer\\ipv4-unicast\\maximum-prefix") +TestFlag.okfail("peer\\ipv4-multicast\\maximum-prefix") +TestFlag.okfail("peer\\ipv6-unicast\\maximum-prefix") +TestFlag.okfail("peer\\ipv6-multicast\\maximum-prefix") +TestFlag.okfail("peer\\ipv4-unicast\\next-hop-self") +TestFlag.okfail("peer\\ipv4-multicast\\next-hop-self") +TestFlag.okfail("peer\\ipv6-unicast\\next-hop-self") +TestFlag.okfail("peer\\ipv6-multicast\\next-hop-self") +TestFlag.okfail("peer\\ipv4-unicast\\next-hop-self force") +TestFlag.okfail("peer\\ipv4-multicast\\next-hop-self force") +TestFlag.okfail("peer\\ipv6-unicast\\next-hop-self force") +TestFlag.okfail("peer\\ipv6-multicast\\next-hop-self force") +TestFlag.okfail("peer\\ipv4-unicast\\prefix-list") +TestFlag.okfail("peer\\ipv4-multicast\\prefix-list") +TestFlag.okfail("peer\\ipv6-unicast\\prefix-list") +TestFlag.okfail("peer\\ipv6-multicast\\prefix-list") +TestFlag.okfail("peer\\ipv4-unicast\\prefix-list") +TestFlag.okfail("peer\\ipv4-multicast\\prefix-list") +TestFlag.okfail("peer\\ipv6-unicast\\prefix-list") +TestFlag.okfail("peer\\ipv6-multicast\\prefix-list") +TestFlag.okfail("peer\\ipv4-unicast\\remove-private-AS") +TestFlag.okfail("peer\\ipv4-multicast\\remove-private-AS") +TestFlag.okfail("peer\\ipv6-unicast\\remove-private-AS") +TestFlag.okfail("peer\\ipv6-multicast\\remove-private-AS") +TestFlag.okfail("peer\\ipv4-unicast\\remove-private-AS all") +TestFlag.okfail("peer\\ipv4-multicast\\remove-private-AS all") +TestFlag.okfail("peer\\ipv6-unicast\\remove-private-AS all") +TestFlag.okfail("peer\\ipv6-multicast\\remove-private-AS all") +TestFlag.okfail("peer\\ipv4-unicast\\remove-private-AS replace-AS") +TestFlag.okfail("peer\\ipv4-multicast\\remove-private-AS replace-AS") +TestFlag.okfail("peer\\ipv6-unicast\\remove-private-AS replace-AS") +TestFlag.okfail("peer\\ipv6-multicast\\remove-private-AS replace-AS") +TestFlag.okfail("peer\\ipv4-unicast\\remove-private-AS all replace-AS") +TestFlag.okfail("peer\\ipv4-multicast\\remove-private-AS all replace-AS") +TestFlag.okfail("peer\\ipv6-unicast\\remove-private-AS all replace-AS") +TestFlag.okfail("peer\\ipv6-multicast\\remove-private-AS all replace-AS") +TestFlag.okfail("peer\\ipv4-unicast\\route-map") +TestFlag.okfail("peer\\ipv4-multicast\\route-map") +TestFlag.okfail("peer\\ipv6-unicast\\route-map") +TestFlag.okfail("peer\\ipv6-multicast\\route-map") +TestFlag.okfail("peer\\ipv4-unicast\\route-map") +TestFlag.okfail("peer\\ipv4-multicast\\route-map") +TestFlag.okfail("peer\\ipv6-unicast\\route-map") +TestFlag.okfail("peer\\ipv6-multicast\\route-map") +TestFlag.okfail("peer\\ipv4-unicast\\route-reflector-client") +TestFlag.okfail("peer\\ipv4-multicast\\route-reflector-client") +TestFlag.okfail("peer\\ipv6-unicast\\route-reflector-client") +TestFlag.okfail("peer\\ipv6-multicast\\route-reflector-client") +TestFlag.okfail("peer\\ipv4-unicast\\route-server-client") +TestFlag.okfail("peer\\ipv4-multicast\\route-server-client") +TestFlag.okfail("peer\\ipv6-unicast\\route-server-client") +TestFlag.okfail("peer\\ipv6-multicast\\route-server-client") +TestFlag.okfail("peer\\ipv4-unicast\\send-community") +TestFlag.okfail("peer\\ipv4-multicast\\send-community") +TestFlag.okfail("peer\\ipv6-unicast\\send-community") +TestFlag.okfail("peer\\ipv6-multicast\\send-community") +TestFlag.okfail("peer\\ipv4-unicast\\send-community extended") +TestFlag.okfail("peer\\ipv4-multicast\\send-community extended") +TestFlag.okfail("peer\\ipv6-unicast\\send-community extended") +TestFlag.okfail("peer\\ipv6-multicast\\send-community extended") +TestFlag.okfail("peer\\ipv4-unicast\\send-community large") +TestFlag.okfail("peer\\ipv4-multicast\\send-community large") +TestFlag.okfail("peer\\ipv6-unicast\\send-community large") +TestFlag.okfail("peer\\ipv6-multicast\\send-community large") +TestFlag.okfail("peer\\ipv4-unicast\\soft-reconfiguration inbound") +TestFlag.okfail("peer\\ipv4-multicast\\soft-reconfiguration inbound") +TestFlag.okfail("peer\\ipv6-unicast\\soft-reconfiguration inbound") +TestFlag.okfail("peer\\ipv6-multicast\\soft-reconfiguration inbound") +TestFlag.okfail("peer\\ipv4-unicast\\unsuppress-map") +TestFlag.okfail("peer\\ipv4-multicast\\unsuppress-map") +TestFlag.okfail("peer\\ipv6-unicast\\unsuppress-map") +TestFlag.okfail("peer\\ipv6-multicast\\unsuppress-map") +TestFlag.okfail("peer\\ipv4-unicast\\weight") +TestFlag.okfail("peer\\ipv4-multicast\\weight") +TestFlag.okfail("peer\\ipv6-unicast\\weight") +TestFlag.okfail("peer\\ipv6-multicast\\weight") diff --git a/tests/helpers/python/frrsix.py b/tests/helpers/python/frrsix.py index 91714f0c67..df737d92ef 100644 --- a/tests/helpers/python/frrsix.py +++ b/tests/helpers/python/frrsix.py @@ -29,24 +29,29 @@ import sys PY2 = sys.version_info[0] == 2 PY3 = sys.version_info[0] == 3 + def add_metaclass(metaclass): """Class decorator for creating a class with a metaclass.""" + def wrapper(cls): orig_vars = cls.__dict__.copy() - slots = orig_vars.get('__slots__') + slots = orig_vars.get("__slots__") if slots is not None: if isinstance(slots, str): slots = [slots] for slots_var in slots: orig_vars.pop(slots_var) - orig_vars.pop('__dict__', None) - orig_vars.pop('__weakref__', None) + orig_vars.pop("__dict__", None) + orig_vars.pop("__weakref__", None) return metaclass(cls.__name__, cls.__bases__, orig_vars) + return wrapper + if PY3: import builtins - exec_ = getattr(builtins,'exec') + + exec_ = getattr(builtins, "exec") def reraise(tp, value, tb=None): try: @@ -59,7 +64,9 @@ if PY3: value = None tb = None + else: + def exec_(_code_, _globs_=None, _locs_=None): """Execute code in a namespace.""" if _globs_ is None: @@ -72,9 +79,11 @@ else: _locs_ = _globs_ exec("""exec _code_ in _globs_, _locs_""") - exec_("""def reraise(tp, value, tb=None): + exec_( + """def reraise(tp, value, tb=None): try: raise tp, value, tb finally: tb = None -""") +""" + ) diff --git a/tests/helpers/python/frrtest.py b/tests/helpers/python/frrtest.py index 60bee5c88c..584fa90374 100644 --- a/tests/helpers/python/frrtest.py +++ b/tests/helpers/python/frrtest.py @@ -39,35 +39,41 @@ import frrsix srcbase = os.path.abspath(inspect.getsourcefile(frrsix)) for i in range(0, 3): srcbase = os.path.dirname(srcbase) + + def binpath(srcpath): return os.path.relpath(os.path.abspath(srcpath), srcbase) + class MultiTestFailure(Exception): pass + class MetaTestMultiOut(type): def __getattr__(cls, name): - if name.startswith('_'): + if name.startswith("_"): raise AttributeError - internal_name = '_{}'.format(name) + internal_name = "_{}".format(name) if internal_name not in dir(cls): raise AttributeError def registrar(*args, **kwargs): - cls._add_test(getattr(cls,internal_name), *args, **kwargs) + cls._add_test(getattr(cls, internal_name), *args, **kwargs) + return registrar + @frrsix.add_metaclass(MetaTestMultiOut) class _TestMultiOut(object): def _run_tests(self): - if 'tests_run' in dir(self.__class__) and self.tests_run: + if "tests_run" in dir(self.__class__) and self.tests_run: return self.__class__.tests_run = True basedir = os.path.dirname(inspect.getsourcefile(type(self))) program = os.path.join(basedir, self.program) proc = subprocess.Popen([binpath(program)], stdout=subprocess.PIPE) - self.output,_ = proc.communicate('') + self.output, _ = proc.communicate("") self.exitcode = proc.wait() self.__class__.testresults = {} @@ -85,13 +91,14 @@ class _TestMultiOut(object): @classmethod def _add_test(cls, method, *args, **kwargs): - if 'tests' not in dir(cls): - setattr(cls,'tests',[]) + if "tests" not in dir(cls): + setattr(cls, "tests", []) if method is not cls._exit_cleanly: cls._add_test(cls._exit_cleanly) def matchfunction(self): method(self, *args, **kwargs) + cls.tests.append(matchfunction) def testfunction(self): @@ -100,17 +107,18 @@ class _TestMultiOut(object): if result is not None: frrsix.reraise(*result) - testname = re.sub(r'[^A-Za-z0-9]', '_', '%r%r' % (args, kwargs)) - testname = re.sub(r'__*', '_', testname) - testname = testname.strip('_') + testname = re.sub(r"[^A-Za-z0-9]", "_", "%r%r" % (args, kwargs)) + testname = re.sub(r"__*", "_", testname) + testname = testname.strip("_") if not testname: - testname = method.__name__.strip('_') + testname = method.__name__.strip("_") if "test_%s" % testname in dir(cls): index = 2 - while "test_%s_%d" % (testname,index) in dir(cls): + while "test_%s_%d" % (testname, index) in dir(cls): index += 1 testname = "%s_%d" % (testname, index) - setattr(cls,"test_%s" % testname, testfunction) + setattr(cls, "test_%s" % testname, testfunction) + # # This class houses the actual TestMultiOut tests types. @@ -127,15 +135,16 @@ class _TestMultiOut(object): # modified according to consumed content. # -re_okfail = re.compile(r'(?:[3[12]m|^)?(?P<ret>OK|failed)'.encode('utf8'), - re.MULTILINE) +re_okfail = re.compile(r"(?:[3[12]m|^)?(?P<ret>OK|failed)".encode("utf8"), re.MULTILINE) + + class TestMultiOut(_TestMultiOut): def _onesimple(self, line): if type(line) is str: - line = line.encode('utf8') + line = line.encode("utf8") idx = self.output.find(line) if idx != -1: - self.output = self.output[idx+len(line):] + self.output = self.output[idx + len(line) :] else: raise MultiTestFailure("%r could not be found" % line) @@ -144,59 +153,73 @@ class TestMultiOut(_TestMultiOut): m = okfail.search(self.output) if m is None: - raise MultiTestFailure('OK/fail not found') - self.output = self.output[m.end():] + raise MultiTestFailure("OK/fail not found") + self.output = self.output[m.end() :] + + if m.group("ret") != "OK".encode("utf8"): + raise MultiTestFailure("Test output indicates failure") - if m.group('ret') != 'OK'.encode('utf8'): - raise MultiTestFailure('Test output indicates failure') # # This class implements a test comparing the output of a program against # an existing reference output # + class TestRefMismatch(Exception): def __init__(self, _test, outtext, reftext): - self.outtext = outtext.decode('utf8') if type(outtext) is bytes else outtext - self.reftext = reftext.decode('utf8') if type(reftext) is bytes else reftext + self.outtext = outtext + self.reftext = reftext def __str__(self): - rv = 'Expected output and actual output differ:\n' - rv += '\n'.join(difflib.unified_diff(self.reftext.splitlines(), - self.outtext.splitlines(), - 'outtext', 'reftext', - lineterm='')) + rv = "Expected output and actual output differ:\n" + rv += "\n".join( + difflib.unified_diff( + self.reftext.splitlines(), + self.outtext.splitlines(), + "outtext", + "reftext", + lineterm="", + ) + ) return rv + class TestExitNonzero(Exception): pass + class TestRefOut(object): def test_refout(self): basedir = os.path.dirname(inspect.getsourcefile(type(self))) program = os.path.join(basedir, self.program) - if getattr(self, 'built_refin', False): - refin = binpath(program) + '.in' + if getattr(self, "built_refin", False): + refin = binpath(program) + ".in" else: - refin = program + '.in' - if getattr(self, 'built_refout', False): - refout = binpath(program) + '.refout' + refin = program + ".in" + if getattr(self, "built_refout", False): + refout = binpath(program) + ".refout" else: - refout = program + '.refout' + refout = program + ".refout" - intext = '' + intext = "" if os.path.exists(refin): - with open(refin, 'rb') as f: + with open(refin, "rb") as f: intext = f.read() - with open(refout, 'rb') as f: + with open(refout, "rb") as f: reftext = f.read() - proc = subprocess.Popen([binpath(program)], - stdin=subprocess.PIPE, - stdout=subprocess.PIPE) - outtext,_ = proc.communicate(intext) - if outtext != reftext: - raise TestRefMismatch(self, outtext, reftext) + proc = subprocess.Popen( + [binpath(program)], stdin=subprocess.PIPE, stdout=subprocess.PIPE + ) + outtext, _ = proc.communicate(intext) + + # Get rid of newline problems (Windows vs Unix Style) + outtext_str = outtext.decode("utf8").replace("\r\n", "\n").replace("\r", "\n") + reftext_str = reftext.decode("utf8").replace("\r\n", "\n").replace("\r", "\n") + + if outtext_str != reftext_str: + raise TestRefMismatch(self, outtext_str, reftext_str) if proc.wait() != 0: raise TestExitNonzero(self) diff --git a/tests/isisd/test_common.c b/tests/isisd/test_common.c index 536847a1da..5fa604c749 100644 --- a/tests/isisd/test_common.c +++ b/tests/isisd/test_common.c @@ -106,6 +106,7 @@ static void lsp_add_ip_reach(struct isis_lsp *lsp, pcfg.sid = *next_sid_index; *next_sid_index = *next_sid_index + 1; pcfg.sid_type = SR_SID_VALUE_TYPE_INDEX; + pcfg.node_sid = true; pcfg.last_hop_behavior = SR_LAST_HOP_BEHAVIOR_PHP; } diff --git a/tests/isisd/test_fuzz_isis_tlv.py b/tests/isisd/test_fuzz_isis_tlv.py index d96e3c4fee..8fd20aabd1 100644 --- a/tests/isisd/test_fuzz_isis_tlv.py +++ b/tests/isisd/test_fuzz_isis_tlv.py @@ -9,18 +9,24 @@ import socket # on musl, ntop compresses a single :0: -> :: which is against RFC ## def inet_ntop_broken(): - addr = '1:2:3:4:0:6:7:8' - return socket.inet_ntop(socket.AF_INET6, - socket.inet_pton(socket.AF_INET6, addr)) != addr + addr = "1:2:3:4:0:6:7:8" + return ( + socket.inet_ntop(socket.AF_INET6, socket.inet_pton(socket.AF_INET6, addr)) + != addr + ) -if platform.uname()[0] == 'SunOS' or inet_ntop_broken(): +if platform.uname()[0] == "SunOS" or inet_ntop_broken(): + class TestFuzzIsisTLV: - @pytest.mark.skipif(True, reason='Test unsupported') + @pytest.mark.skipif(True, reason="Test unsupported") def test_exit_cleanly(self): pass + + else: + class TestFuzzIsisTLV(frrtest.TestMultiOut): - program = './test_fuzz_isis_tlv' + program = "./test_fuzz_isis_tlv" TestFuzzIsisTLV.exit_cleanly() diff --git a/tests/isisd/test_isis_lspdb.py b/tests/isisd/test_isis_lspdb.py index cd0b5345c7..280ed1c328 100644 --- a/tests/isisd/test_isis_lspdb.py +++ b/tests/isisd/test_isis_lspdb.py @@ -1,6 +1,8 @@ import frrtest + class TestIsisLSPDB(frrtest.TestMultiOut): - program = './test_isis_lspdb' + program = "./test_isis_lspdb" + TestIsisLSPDB.exit_cleanly() diff --git a/tests/isisd/test_isis_spf.c b/tests/isisd/test_isis_spf.c index 73bb531dc0..4c89a5be0a 100644 --- a/tests/isisd/test_isis_spf.c +++ b/tests/isisd/test_isis_spf.c @@ -39,6 +39,7 @@ enum test_type { TEST_SPF = 1, TEST_REVERSE_SPF, + TEST_TI_LFA, }; #define F_DISPLAY_LSPDB 0x01 @@ -65,17 +66,78 @@ 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); + isis_print_routes(vty, spftree, false, false); /* Cleanup SPF tree. */ isis_spftree_del(spftree); } +static void test_run_ti_lfa(struct vty *vty, + const struct isis_topology *topology, + const struct isis_test_node *root, + struct isis_area *area, struct lspdb_head *lspdb, + int level, int tree, + struct lfa_protected_resource *protected_resource) +{ + struct isis_spftree *spftree_self; + struct isis_spftree *spftree_reverse; + struct isis_spftree *spftree_pc; + struct isis_spf_node *spf_node, *node; + uint8_t flags; + + /* 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); + isis_run_spf(spftree_self); + + /* Run reverse SPF in the root node. */ + spftree_reverse = isis_spf_reverse_run(spftree_self); + + /* Run forward SPF on all adjacent routers. */ + isis_spf_run_neighbors(spftree_self); + + /* Compute the TI-LFA repair paths. */ + spftree_pc = isis_tilfa_compute(area, spftree_self, spftree_reverse, + protected_resource); + + /* Print the extended P-space and Q-space. */ + vty_out(vty, "P-space (self):\n"); + RB_FOREACH (node, isis_spf_nodes, &spftree_pc->lfa.p_space) + vty_out(vty, " %s\n", print_sys_hostname(node->sysid)); + vty_out(vty, "\n"); + RB_FOREACH (spf_node, isis_spf_nodes, &spftree_self->adj_nodes) { + if (RB_EMPTY(isis_spf_nodes, &spf_node->lfa.p_space)) + continue; + vty_out(vty, "P-space (%s):\n", + print_sys_hostname(spf_node->sysid)); + RB_FOREACH (node, isis_spf_nodes, &spf_node->lfa.p_space) + vty_out(vty, " %s\n", print_sys_hostname(node->sysid)); + vty_out(vty, "\n"); + } + vty_out(vty, "Q-space:\n"); + RB_FOREACH (node, isis_spf_nodes, &spftree_pc->lfa.q_space) + vty_out(vty, " %s\n", print_sys_hostname(node->sysid)); + vty_out(vty, "\n"); + + /* Print the post-convergence SPT and the correspoding routing table. */ + isis_print_spftree(vty, spftree_pc); + isis_print_routes(vty, spftree_self, false, true); + + /* Cleanup everything. */ + isis_spftree_del(spftree_self); + isis_spftree_del(spftree_reverse); + isis_spftree_del(spftree_pc); +} + static int test_run(struct vty *vty, const struct isis_topology *topology, const struct isis_test_node *root, enum test_type test_type, - uint8_t flags) + uint8_t flags, enum lfa_protection_type protection_type, + const char *fail_sysid_str, uint8_t fail_pseudonode_id) { struct isis_area *area; + struct lfa_protected_resource protected_resource = {}; + uint8_t fail_id[ISIS_SYS_ID_LEN] = {}; /* Init topology. */ memcpy(isis->sysid, root->sysid, sizeof(isis->sysid)); @@ -87,6 +149,26 @@ static int test_run(struct vty *vty, const struct isis_topology *topology, return CMD_WARNING; } + /* Parse failed link/node. */ + if (fail_sysid_str) { + if (sysid2buff(fail_id, fail_sysid_str) == 0) { + struct isis_dynhn *dynhn; + + dynhn = dynhn_find_by_name(fail_sysid_str); + if (dynhn == NULL) { + vty_out(vty, "Invalid system id %s\n", + fail_sysid_str); + return CMD_WARNING; + } + memcpy(fail_id, dynhn->id, ISIS_SYS_ID_LEN); + } + + protected_resource.type = protection_type; + memcpy(protected_resource.adjacency, fail_id, ISIS_SYS_ID_LEN); + LSP_PSEUDO_ID(protected_resource.adjacency) = + fail_pseudonode_id; + } + for (int level = IS_LEVEL_1; level <= IS_LEVEL_2; level++) { if (level == IS_LEVEL_1 && CHECK_FLAG(flags, F_LEVEL2_ONLY)) continue; @@ -120,6 +202,11 @@ static int test_run(struct vty *vty, const struct isis_topology *topology, &area->lspdb[level - 1], level, tree, true); break; + case TEST_TI_LFA: + test_run_ti_lfa(vty, topology, root, area, + &area->lspdb[level - 1], level, + tree, &protected_resource); + break; } } } @@ -138,6 +225,7 @@ DEFUN(test_isis, test_isis_cmd, <\ spf\ |reverse-spf\ + |ti-lfa system-id WORD [pseudonode-id <1-255>] [node-protection]\ >\ [display-lspdb] [<ipv4-only|ipv6-only>] [<level-1-only|level-2-only>]", "Test command\n" @@ -148,6 +236,12 @@ DEFUN(test_isis, test_isis_cmd, "SPF root hostname\n" "Normal Shortest Path First\n" "Reverse Shortest Path First\n" + "Topology Independent LFA\n" + "System ID\n" + "System ID\n" + "Pseudonode-ID\n" + "Pseudonode-ID\n" + "Node protection\n" "Display the LSPDB\n" "Do IPv4 processing only\n" "Do IPv6 processing only\n" @@ -158,6 +252,9 @@ DEFUN(test_isis, test_isis_cmd, const struct isis_topology *topology; const struct isis_test_node *root; enum test_type test_type; + enum lfa_protection_type protection_type = 0; + const char *fail_sysid_str = NULL; + uint8_t fail_pseudonode_id = 0; uint8_t flags = 0; int idx = 0; @@ -184,7 +281,18 @@ DEFUN(test_isis, test_isis_cmd, test_type = TEST_SPF; else if (argv_find(argv, argc, "reverse-spf", &idx)) test_type = TEST_REVERSE_SPF; - else + else if (argv_find(argv, argc, "ti-lfa", &idx)) { + test_type = TEST_TI_LFA; + + fail_sysid_str = argv[idx + 2]->arg; + if (argv_find(argv, argc, "pseudonode-id", &idx)) + fail_pseudonode_id = + strtoul(argv[idx + 1]->arg, NULL, 10); + if (argv_find(argv, argc, "node-protection", &idx)) + protection_type = LFA_NODE_PROTECTION; + else + protection_type = LFA_LINK_PROTECTION; + } else return CMD_WARNING; /* Parse control flags. */ @@ -199,7 +307,8 @@ DEFUN(test_isis, test_isis_cmd, else if (argv_find(argv, argc, "level-2-only", &idx)) SET_FLAG(flags, F_LEVEL2_ONLY); - return test_run(vty, topology, root, test_type, flags); + return test_run(vty, topology, root, test_type, flags, protection_type, + fail_sysid_str, fail_pseudonode_id); } static void vty_do_exit(int isexit) @@ -295,6 +404,7 @@ int main(int argc, char **argv) listnode_add(im->isis, isis); SET_FLAG(im->options, F_ISIS_UNIT_TEST); debug_spf_events |= DEBUG_SPF_EVENTS; + debug_tilfa |= DEBUG_TILFA; debug_events |= DEBUG_EVENTS; debug_rte_events |= DEBUG_RTE_EVENTS; diff --git a/tests/isisd/test_isis_spf.in b/tests/isisd/test_isis_spf.in index d9a61782e9..6bc5442f1e 100644 --- a/tests/isisd/test_isis_spf.in +++ b/tests/isisd/test_isis_spf.in @@ -14,3 +14,27 @@ test isis topology 13 root rt1 spf ipv4-only test isis topology 4 root rt1 reverse-spf ipv4-only test isis topology 11 root rt1 reverse-spf + +test isis topology 1 root rt1 ti-lfa system-id rt2 +test isis topology 2 root rt1 ti-lfa system-id rt3 +test isis topology 2 root rt1 ti-lfa system-id rt1 pseudonode-id 1 +test isis topology 2 root rt5 ti-lfa system-id rt1 pseudonode-id 1 +test isis topology 3 root rt5 ti-lfa system-id rt4 ipv4-only +test isis topology 3 root rt5 ti-lfa system-id rt3 ipv4-only +test isis topology 4 root rt1 ti-lfa system-id rt2 ipv4-only +test isis topology 4 root rt4 ti-lfa system-id rt6 ipv4-only +test isis topology 5 root rt1 ti-lfa system-id rt2 ipv4-only +test isis topology 6 root rt4 ti-lfa system-id rt3 ipv4-only +test isis topology 7 root rt11 ti-lfa system-id rt8 ipv4-only +test isis topology 7 root rt6 ti-lfa system-id rt5 ipv4-only +test isis topology 8 root rt2 ti-lfa system-id rt1 ipv4-only +test isis topology 8 root rt2 ti-lfa system-id rt5 ipv4-only +test isis topology 9 root rt1 ti-lfa system-id rt3 +test isis topology 9 root rt1 ti-lfa system-id rt2 +test isis topology 9 root rt9 ti-lfa system-id rt5 +test isis topology 9 root rt9 ti-lfa system-id rt8 +test isis topology 10 root rt1 ti-lfa system-id rt2 +test isis topology 10 root rt1 ti-lfa system-id rt4 +test isis topology 11 root rt2 ti-lfa system-id rt4 +test isis topology 12 root rt1 ti-lfa system-id rt3 ipv4-only +test isis topology 13 root rt1 ti-lfa system-id rt3 ipv4-only diff --git a/tests/isisd/test_isis_spf.py b/tests/isisd/test_isis_spf.py index 21e7ef6269..f44fa70d6b 100644 --- a/tests/isisd/test_isis_spf.py +++ b/tests/isisd/test_isis_spf.py @@ -1,4 +1,5 @@ import frrtest + class TestIsisSPF(frrtest.TestRefOut): - program = './test_isis_spf' + program = "./test_isis_spf" diff --git a/tests/isisd/test_isis_spf.refout b/tests/isisd/test_isis_spf.refout index ed0569947c..d24176a097 100644 --- a/tests/isisd/test_isis_spf.refout +++ b/tests/isisd/test_isis_spf.refout @@ -18,14 +18,15 @@ rt6 TE-IS 30 rt2 - rt4(4) IS-IS L1 IPv4 routing table:
- Prefix Metric Interface Nexthop Label(s)
- -----------------------------------------------------
- 10.0.255.2/32 20 - rt2 -
- 10.0.255.3/32 20 - rt3 -
- 10.0.255.4/32 30 - rt2 -
- 10.0.255.5/32 30 - rt3 -
- 10.0.255.6/32 40 - rt2 -
- - rt3 -
+ Prefix Metric Interface Nexthop Label(s)
+ ----------------------------------------------------------
+ 10.0.255.1/32 0 - - -
+ 10.0.255.2/32 20 - rt2 implicit-null
+ 10.0.255.3/32 20 - rt3 implicit-null
+ 10.0.255.4/32 30 - rt2 16040
+ 10.0.255.5/32 30 - rt3 16050
+ 10.0.255.6/32 40 - rt2 16060
+ - rt3 16060
IS-IS paths to level-1 routers that speak IPv6
Vertex Type Metric Next-Hop Interface Parent
@@ -46,14 +47,15 @@ rt6 TE-IS 30 rt2 - rt4(4) IS-IS L1 IPv6 routing table:
- Prefix Metric Interface Nexthop Label(s)
- -------------------------------------------------------
- 2001:db8::2/128 20 - rt2 -
- 2001:db8::3/128 20 - rt3 -
- 2001:db8::4/128 30 - rt2 -
- 2001:db8::5/128 30 - rt3 -
- 2001:db8::6/128 40 - rt2 -
- - rt3 -
+ Prefix Metric Interface Nexthop Label(s)
+ ------------------------------------------------------------
+ 2001:db8::1/128 0 - - -
+ 2001:db8::2/128 20 - rt2 implicit-null
+ 2001:db8::3/128 20 - rt3 implicit-null
+ 2001:db8::4/128 30 - rt2 16041
+ 2001:db8::5/128 30 - rt3 16051
+ 2001:db8::6/128 40 - rt2 16061
+ - rt3 16061
test# test isis topology 2 root rt1 spf
IS-IS paths to level-1 routers that speak IP
@@ -76,14 +78,15 @@ rt3 TE-IS 30 rt3 - rt1(4) IS-IS L1 IPv4 routing table:
- Prefix Metric Interface Nexthop Label(s)
- -----------------------------------------------------
- 10.0.255.2/32 25 - rt2 -
- 10.0.255.3/32 40 - rt3 -
- 10.0.255.4/32 20 - rt4 -
- 10.0.255.5/32 20 - rt5 -
- 10.0.255.6/32 30 - rt4 -
- - rt5 -
+ Prefix Metric Interface Nexthop Label(s)
+ ----------------------------------------------------------
+ 10.0.255.1/32 0 - - -
+ 10.0.255.2/32 25 - rt2 implicit-null
+ 10.0.255.3/32 40 - rt3 implicit-null
+ 10.0.255.4/32 20 - rt4 implicit-null
+ 10.0.255.5/32 20 - rt5 implicit-null
+ 10.0.255.6/32 30 - rt4 16060
+ - rt5 16060
IS-IS paths to level-1 routers that speak IPv6
Vertex Type Metric Next-Hop Interface Parent
@@ -105,14 +108,15 @@ rt3 TE-IS 30 rt3 - rt1(4) IS-IS L1 IPv6 routing table:
- Prefix Metric Interface Nexthop Label(s)
- -------------------------------------------------------
- 2001:db8::2/128 25 - rt2 -
- 2001:db8::3/128 40 - rt3 -
- 2001:db8::4/128 20 - rt4 -
- 2001:db8::5/128 20 - rt5 -
- 2001:db8::6/128 30 - rt4 -
- - rt5 -
+ Prefix Metric Interface Nexthop Label(s)
+ ------------------------------------------------------------
+ 2001:db8::1/128 0 - - -
+ 2001:db8::2/128 25 - rt2 implicit-null
+ 2001:db8::3/128 40 - rt3 implicit-null
+ 2001:db8::4/128 20 - rt4 implicit-null
+ 2001:db8::5/128 20 - rt5 implicit-null
+ 2001:db8::6/128 30 - rt4 16061
+ - rt5 16061
test# test isis topology 3 root rt1 spf ipv4-only
IS-IS paths to level-1 routers that speak IP
@@ -132,13 +136,14 @@ rt6 TE-IS 30 rt2 - rt4(4) IS-IS L1 IPv4 routing table:
- Prefix Metric Interface Nexthop Label(s)
- -----------------------------------------------------
- 10.0.255.2/32 20 - rt2 -
- 10.0.255.3/32 20 - rt3 -
- 10.0.255.4/32 30 - rt2 -
- 10.0.255.5/32 40 - rt2 -
- 10.0.255.6/32 40 - rt2 -
+ Prefix Metric Interface Nexthop Label(s)
+ ----------------------------------------------------------
+ 10.0.255.1/32 0 - - -
+ 10.0.255.2/32 20 - rt2 implicit-null
+ 10.0.255.3/32 20 - rt3 implicit-null
+ 10.0.255.4/32 30 - rt2 16040
+ 10.0.255.5/32 40 - rt2 16050
+ 10.0.255.6/32 40 - rt2 16060
test# test isis topology 4 root rt1 spf ipv4-only
IS-IS paths to level-1 routers that speak IP
@@ -162,15 +167,16 @@ rt8 TE-IS 40 rt2 - rt6(4) IS-IS L1 IPv4 routing table:
- Prefix Metric Interface Nexthop Label(s)
- -----------------------------------------------------
- 10.0.255.2/32 20 - rt2 -
- 10.0.255.3/32 20 - rt3 -
- 10.0.255.4/32 30 - rt2 -
- 10.0.255.5/32 30 - rt3 -
- 10.0.255.6/32 40 - rt2 -
- 10.0.255.7/32 40 - rt3 -
- 10.0.255.8/32 50 - rt2 -
+ Prefix Metric Interface Nexthop Label(s)
+ ----------------------------------------------------------
+ 10.0.255.1/32 0 - - -
+ 10.0.255.2/32 20 - rt2 implicit-null
+ 10.0.255.3/32 20 - rt3 implicit-null
+ 10.0.255.4/32 30 - rt2 16040
+ 10.0.255.5/32 30 - rt3 16050
+ 10.0.255.6/32 40 - rt2 16060
+ 10.0.255.7/32 40 - rt3 16070
+ 10.0.255.8/32 50 - rt2 16080
test# test isis topology 5 root rt1 spf ipv4-only
IS-IS paths to level-1 routers that speak IP
@@ -196,16 +202,17 @@ rt8 TE-IS 40 rt2 - rt6(4) IS-IS L1 IPv4 routing table:
- Prefix Metric Interface Nexthop Label(s)
- -----------------------------------------------------
- 10.0.255.2/32 20 - rt2 -
- 10.0.255.3/32 20 - rt3 -
- 10.0.255.4/32 30 - rt2 -
- 10.0.255.5/32 30 - rt3 -
- 10.0.255.6/32 40 - rt2 -
- 10.0.255.7/32 40 - rt3 -
- 10.0.255.8/32 50 - rt2 -
- - rt3 -
+ Prefix Metric Interface Nexthop Label(s)
+ ----------------------------------------------------------
+ 10.0.255.1/32 0 - - -
+ 10.0.255.2/32 20 - rt2 implicit-null
+ 10.0.255.3/32 20 - rt3 implicit-null
+ 10.0.255.4/32 30 - rt2 16040
+ 10.0.255.5/32 30 - rt3 16050
+ 10.0.255.6/32 40 - rt2 16060
+ 10.0.255.7/32 40 - rt3 16070
+ 10.0.255.8/32 50 - rt2 16080
+ - rt3 16080
test# test isis topology 6 root rt1 spf ipv4-only
IS-IS paths to level-1 routers that speak IP
@@ -239,20 +246,21 @@ rt7 TE-IS 50 rt2 - rt5(4) IS-IS L1 IPv4 routing table:
- Prefix Metric Interface Nexthop Label(s)
- -----------------------------------------------------
- 10.0.255.2/32 20 - rt2 -
- 10.0.255.3/32 20 - rt3 -
- 10.0.255.4/32 30 - rt2 -
- - rt3 -
- 10.0.255.5/32 50 - rt2 -
- - rt3 -
- 10.0.255.6/32 40 - rt2 -
- - rt3 -
- 10.0.255.7/32 60 - rt2 -
- - rt3 -
- 10.0.255.8/32 50 - rt2 -
- - rt3 -
+ Prefix Metric Interface Nexthop Label(s)
+ ----------------------------------------------------------
+ 10.0.255.1/32 0 - - -
+ 10.0.255.2/32 20 - rt2 implicit-null
+ 10.0.255.3/32 20 - rt3 implicit-null
+ 10.0.255.4/32 30 - rt2 16040
+ - rt3 16040
+ 10.0.255.5/32 50 - rt2 16050
+ - rt3 16050
+ 10.0.255.6/32 40 - rt2 16060
+ - rt3 16060
+ 10.0.255.7/32 60 - rt2 16070
+ - rt3 16070
+ 10.0.255.8/32 50 - rt2 16080
+ - rt3 16080
test# test isis topology 7 root rt1 spf ipv4-only
IS-IS paths to level-1 routers that speak IP
@@ -287,19 +295,20 @@ rt12 TE-IS 50 rt4 - rt9(4) IS-IS L1 IPv4 routing table:
- Prefix Metric Interface Nexthop Label(s)
- ------------------------------------------------------
- 10.0.255.2/32 40 - rt4 -
- 10.0.255.3/32 50 - rt4 -
- 10.0.255.4/32 20 - rt4 -
- 10.0.255.5/32 30 - rt4 -
- 10.0.255.6/32 40 - rt4 -
- 10.0.255.7/32 30 - rt4 -
- 10.0.255.8/32 40 - rt4 -
- 10.0.255.9/32 50 - rt4 -
- 10.0.255.10/32 50 - rt4 -
- 10.0.255.11/32 50 - rt4 -
- 10.0.255.12/32 60 - rt4 -
+ Prefix Metric Interface Nexthop Label(s)
+ -----------------------------------------------------------
+ 10.0.255.1/32 0 - - -
+ 10.0.255.2/32 40 - rt4 16020
+ 10.0.255.3/32 50 - rt4 16030
+ 10.0.255.4/32 20 - rt4 implicit-null
+ 10.0.255.5/32 30 - rt4 16050
+ 10.0.255.6/32 40 - rt4 16060
+ 10.0.255.7/32 30 - rt4 16070
+ 10.0.255.8/32 40 - rt4 16080
+ 10.0.255.9/32 50 - rt4 16090
+ 10.0.255.10/32 50 - rt4 16100
+ 10.0.255.11/32 50 - rt4 16110
+ 10.0.255.12/32 60 - rt4 16120
test# test isis topology 8 root rt1 spf ipv4-only
IS-IS paths to level-1 routers that speak IP
@@ -333,19 +342,20 @@ rt12 TE-IS 50 rt2 - rt9(4) IS-IS L1 IPv4 routing table:
- Prefix Metric Interface Nexthop Label(s)
- ------------------------------------------------------
- 10.0.255.2/32 20 - rt2 -
- 10.0.255.3/32 30 - rt2 -
- 10.0.255.4/32 20 - rt4 -
- 10.0.255.5/32 30 - rt2 -
- 10.0.255.6/32 40 - rt2 -
- 10.0.255.7/32 30 - rt4 -
- 10.0.255.8/32 40 - rt2 -
- 10.0.255.9/32 50 - rt2 -
- 10.0.255.10/32 40 - rt4 -
- 10.0.255.11/32 50 - rt2 -
- 10.0.255.12/32 60 - rt2 -
+ Prefix Metric Interface Nexthop Label(s)
+ -----------------------------------------------------------
+ 10.0.255.1/32 0 - - -
+ 10.0.255.2/32 20 - rt2 implicit-null
+ 10.0.255.3/32 30 - rt2 16030
+ 10.0.255.4/32 20 - rt4 implicit-null
+ 10.0.255.5/32 30 - rt2 16050
+ 10.0.255.6/32 40 - rt2 16060
+ 10.0.255.7/32 30 - rt4 16070
+ 10.0.255.8/32 40 - rt2 16080
+ 10.0.255.9/32 50 - rt2 16090
+ 10.0.255.10/32 40 - rt4 16100
+ 10.0.255.11/32 50 - rt2 16110
+ 10.0.255.12/32 60 - rt2 16120
test# test isis topology 9 root rt1 spf
IS-IS paths to level-1 routers that speak IP
@@ -374,16 +384,17 @@ rt8 TE-IS 50 rt2 - rt4(4) IS-IS L1 IPv4 routing table:
- Prefix Metric Interface Nexthop Label(s)
- -----------------------------------------------------
- 10.0.255.2/32 20 - rt2 -
- 10.0.255.3/32 20 - rt3 -
- 10.0.255.4/32 30 - rt2 -
- 10.0.255.5/32 40 - rt2 -
- 10.0.255.6/32 60 - rt2 -
- 10.0.255.7/32 60 - rt2 -
- 10.0.255.8/32 60 - rt2 -
- 10.0.255.9/32 50 - rt2 -
+ Prefix Metric Interface Nexthop Label(s)
+ ----------------------------------------------------------
+ 10.0.255.1/32 0 - - -
+ 10.0.255.2/32 20 - rt2 implicit-null
+ 10.0.255.3/32 20 - rt3 implicit-null
+ 10.0.255.4/32 30 - rt2 16040
+ 10.0.255.5/32 40 - rt2 16050
+ 10.0.255.6/32 60 - rt2 16060
+ 10.0.255.7/32 60 - rt2 16070
+ 10.0.255.8/32 60 - rt2 16080
+ 10.0.255.9/32 50 - rt2 16090
IS-IS paths to level-1 routers that speak IPv6
Vertex Type Metric Next-Hop Interface Parent
@@ -411,16 +422,17 @@ rt8 TE-IS 50 rt2 - rt4(4) IS-IS L1 IPv6 routing table:
- Prefix Metric Interface Nexthop Label(s)
- -------------------------------------------------------
- 2001:db8::2/128 20 - rt2 -
- 2001:db8::3/128 20 - rt3 -
- 2001:db8::4/128 30 - rt2 -
- 2001:db8::5/128 40 - rt2 -
- 2001:db8::6/128 60 - rt2 -
- 2001:db8::7/128 60 - rt2 -
- 2001:db8::8/128 60 - rt2 -
- 2001:db8::9/128 50 - rt2 -
+ Prefix Metric Interface Nexthop Label(s)
+ ------------------------------------------------------------
+ 2001:db8::1/128 0 - - -
+ 2001:db8::2/128 20 - rt2 implicit-null
+ 2001:db8::3/128 20 - rt3 implicit-null
+ 2001:db8::4/128 30 - rt2 16041
+ 2001:db8::5/128 40 - rt2 16051
+ 2001:db8::6/128 60 - rt2 16061
+ 2001:db8::7/128 60 - rt2 16071
+ 2001:db8::8/128 60 - rt2 16081
+ 2001:db8::9/128 50 - rt2 16091
test# test isis topology 10 root rt1 spf
IS-IS paths to level-1 routers that speak IP
@@ -444,15 +456,16 @@ rt8 TE-IS 30 rt2 - rt5(4) IS-IS L1 IPv4 routing table:
- Prefix Metric Interface Nexthop Label(s)
- -----------------------------------------------------
- 10.0.255.2/32 20 - rt2 -
- 10.0.255.3/32 30 - rt3 -
- 10.0.255.4/32 30 - rt4 -
- 10.0.255.5/32 30 - rt2 -
- 10.0.255.6/32 40 - rt3 -
- 10.0.255.7/32 40 - rt4 -
- 10.0.255.8/32 40 - rt2 -
+ Prefix Metric Interface Nexthop Label(s)
+ ----------------------------------------------------------
+ 10.0.255.1/32 0 - - -
+ 10.0.255.2/32 20 - rt2 implicit-null
+ 10.0.255.3/32 30 - rt3 implicit-null
+ 10.0.255.4/32 30 - rt4 implicit-null
+ 10.0.255.5/32 30 - rt2 16050
+ 10.0.255.6/32 40 - rt3 20060
+ 10.0.255.7/32 40 - rt4 16070
+ 10.0.255.8/32 40 - rt2 16080
IS-IS paths to level-1 routers that speak IPv6
Vertex Type Metric Next-Hop Interface Parent
@@ -475,15 +488,16 @@ rt8 TE-IS 30 rt2 - rt5(4) IS-IS L1 IPv6 routing table:
- Prefix Metric Interface Nexthop Label(s)
- -------------------------------------------------------
- 2001:db8::2/128 20 - rt2 -
- 2001:db8::3/128 30 - rt3 -
- 2001:db8::4/128 30 - rt4 -
- 2001:db8::5/128 30 - rt2 -
- 2001:db8::6/128 40 - rt3 -
- 2001:db8::7/128 40 - rt4 -
- 2001:db8::8/128 40 - rt2 -
+ Prefix Metric Interface Nexthop Label(s)
+ ------------------------------------------------------------
+ 2001:db8::1/128 0 - - -
+ 2001:db8::2/128 20 - rt2 implicit-null
+ 2001:db8::3/128 30 - rt3 implicit-null
+ 2001:db8::4/128 30 - rt4 implicit-null
+ 2001:db8::5/128 30 - rt2 16051
+ 2001:db8::6/128 40 - rt3 20061
+ 2001:db8::7/128 40 - rt4 16071
+ 2001:db8::8/128 40 - rt2 16081
test# test isis topology 11 root rt1 spf
IS-IS paths to level-1 routers that speak IP
@@ -506,14 +520,15 @@ rt6 TE-IS 30 rt2 - rt4(4) IS-IS L1 IPv4 routing table:
- Prefix Metric Interface Nexthop Label(s)
- -----------------------------------------------------
- 10.0.255.2/32 20 - rt2 -
- 10.0.255.3/32 20 - rt3 -
- 10.0.255.4/32 30 - rt2 -
- 10.0.255.5/32 30 - rt3 -
- 10.0.255.6/32 40 - rt2 -
- - rt3 -
+ Prefix Metric Interface Nexthop Label(s)
+ ----------------------------------------------------------
+ 10.0.255.1/32 0 - - -
+ 10.0.255.2/32 20 - rt2 implicit-null
+ 10.0.255.3/32 20 - rt3 implicit-null
+ 10.0.255.4/32 30 - rt2 16040
+ 10.0.255.5/32 30 - rt3 16050
+ 10.0.255.6/32 40 - rt2 16060
+ - rt3 16060
IS-IS paths to level-1 routers that speak IPv6
Vertex Type Metric Next-Hop Interface Parent
@@ -535,14 +550,15 @@ rt6 TE-IS 30 rt2 - rt4(4) IS-IS L1 IPv6 routing table:
- Prefix Metric Interface Nexthop Label(s)
- -------------------------------------------------------
- 2001:db8::2/128 20 - rt2 -
- 2001:db8::3/128 20 - rt3 -
- 2001:db8::4/128 30 - rt2 -
- 2001:db8::5/128 30 - rt3 -
- 2001:db8::6/128 40 - rt2 -
- - rt3 -
+ Prefix Metric Interface Nexthop Label(s)
+ ------------------------------------------------------------
+ 2001:db8::1/128 0 - - -
+ 2001:db8::2/128 20 - rt2 implicit-null
+ 2001:db8::3/128 20 - rt3 implicit-null
+ 2001:db8::4/128 30 - rt2 16041
+ 2001:db8::5/128 30 - rt3 16051
+ 2001:db8::6/128 40 - rt2 16061
+ - rt3 16061
test# test isis topology 12 root rt1 spf ipv4-only
IS-IS paths to level-1 routers that speak IP
@@ -570,17 +586,18 @@ rt10 TE-IS 50 rt2 - rt8(4) IS-IS L1 IPv4 routing table:
- Prefix Metric Interface Nexthop Label(s)
- ------------------------------------------------------
- 10.0.255.2/32 20 - rt2 -
- 10.0.255.3/32 20 - rt3 -
- 10.0.255.4/32 30 - rt2 -
- 10.0.255.5/32 30 - rt3 -
- 10.0.255.6/32 40 - rt2 -
- 10.0.255.7/32 40 - rt3 -
- 10.0.255.8/32 50 - rt2 -
- 10.0.255.9/32 50 - rt3 -
- 10.0.255.10/32 60 - rt2 -
+ Prefix Metric Interface Nexthop Label(s)
+ -----------------------------------------------------------
+ 10.0.255.1/32 0 - - -
+ 10.0.255.2/32 20 - rt2 implicit-null
+ 10.0.255.3/32 20 - rt3 implicit-null
+ 10.0.255.4/32 30 - rt2 16040
+ 10.0.255.5/32 30 - rt3 16050
+ 10.0.255.6/32 40 - rt2 16060
+ 10.0.255.7/32 40 - rt3 16070
+ 10.0.255.8/32 50 - rt2 16080
+ 10.0.255.9/32 50 - rt3 16090
+ 10.0.255.10/32 60 - rt2 16100
test# test isis topology 13 root rt1 spf ipv4-only
IS-IS paths to level-1 routers that speak IP
@@ -605,15 +622,16 @@ rt7 TE-IS 30 rt3 - rt5(4) IS-IS L1 IPv4 routing table:
- Prefix Metric Interface Nexthop Label(s)
- -----------------------------------------------------
- 10.0.255.2/32 20 - rt2 -
- 10.0.255.3/32 20 - rt3 -
- 10.0.255.4/32 30 - rt2 -
- - rt3 -
- 10.0.255.5/32 30 - rt3 -
- 10.0.255.6/32 30 - rt3 -
- 10.0.255.7/32 40 - rt3 -
+ Prefix Metric Interface Nexthop Label(s)
+ ----------------------------------------------------------
+ 10.0.255.1/32 0 - - -
+ 10.0.255.2/32 20 - rt2 implicit-null
+ 10.0.255.3/32 20 - rt3 implicit-null
+ 10.0.255.4/32 30 - rt2 16040
+ - rt3 16040
+ 10.0.255.5/32 30 - rt3 16050
+ 10.0.255.6/32 30 - rt3 16060
+ 10.0.255.7/32 40 - rt3 16070
test#
test# test isis topology 4 root rt1 reverse-spf ipv4-only
@@ -638,15 +656,16 @@ rt8 TE-IS 40 rt2 - rt6(4) IS-IS L1 IPv4 routing table:
- Prefix Metric Interface Nexthop Label(s)
- -----------------------------------------------------
- 10.0.255.2/32 20 - rt2 -
- 10.0.255.3/32 20 - rt3 -
- 10.0.255.4/32 30 - rt2 -
- 10.0.255.5/32 30 - rt3 -
- 10.0.255.6/32 40 - rt2 -
- 10.0.255.7/32 40 - rt3 -
- 10.0.255.8/32 50 - rt2 -
+ Prefix Metric Interface Nexthop Label(s)
+ ----------------------------------------------------------
+ 10.0.255.1/32 0 - - -
+ 10.0.255.2/32 20 - rt2 implicit-null
+ 10.0.255.3/32 20 - rt3 implicit-null
+ 10.0.255.4/32 30 - rt2 16040
+ 10.0.255.5/32 30 - rt3 16050
+ 10.0.255.6/32 40 - rt2 16060
+ 10.0.255.7/32 40 - rt3 16070
+ 10.0.255.8/32 50 - rt2 16080
test# test isis topology 11 root rt1 reverse-spf
IS-IS paths to level-1 routers that speak IP
@@ -668,11 +687,12 @@ rt6 TE-IS 30 rt3 - rt4(4) IS-IS L1 IPv4 routing table:
- Prefix Metric Interface Nexthop Label(s)
- -----------------------------------------------------
- 10.0.255.3/32 20 - rt3 -
- 10.0.255.5/32 30 - rt3 -
- 10.0.255.6/32 40 - rt3 -
+ Prefix Metric Interface Nexthop Label(s)
+ ----------------------------------------------------------
+ 10.0.255.1/32 0 - - -
+ 10.0.255.3/32 20 - rt3 implicit-null
+ 10.0.255.5/32 30 - rt3 16050
+ 10.0.255.6/32 40 - rt3 16060
IS-IS paths to level-1 routers that speak IPv6
Vertex Type Metric Next-Hop Interface Parent
@@ -693,11 +713,1781 @@ rt6 TE-IS 30 rt3 - rt4(4) IS-IS L1 IPv6 routing table:
- Prefix Metric Interface Nexthop Label(s)
- -------------------------------------------------------
- 2001:db8::3/128 20 - rt3 -
- 2001:db8::5/128 30 - rt3 -
- 2001:db8::6/128 40 - rt3 -
+ Prefix Metric Interface Nexthop Label(s)
+ ------------------------------------------------------------
+ 2001:db8::1/128 0 - - -
+ 2001:db8::3/128 20 - rt3 implicit-null
+ 2001:db8::5/128 30 - rt3 16051
+ 2001:db8::6/128 40 - rt3 16061
+
+test#
+test# test isis topology 1 root rt1 ti-lfa system-id rt2
+P-space (self):
+ rt3
+ rt5
+
+P-space (rt3):
+ rt3
+ rt5
+ rt6
+
+Q-space:
+ rt2
+ rt4
+ rt6
+
+IS-IS paths to level-1 routers that speak IP
+Vertex Type Metric Next-Hop Interface Parent
+rt1
+10.0.255.1/32 IP internal 0 rt1(4)
+rt3 TE-IS 10 rt3 - rt1(4)
+rt5 TE-IS 20 rt3 - rt3(4)
+10.0.255.3/32 IP TE 20 rt3 - rt3(4)
+rt6 TE-IS 30 rt3 - rt5(4)
+10.0.255.5/32 IP TE 30 rt3 - rt5(4)
+rt4 TE-IS 40 rt3 - rt6(4)
+10.0.255.6/32 IP TE 40 rt3 - rt6(4)
+rt2 TE-IS 50 rt3 - rt4(4)
+10.0.255.4/32 IP TE 50 rt3 - rt4(4)
+10.0.255.2/32 IP TE 60 rt3 - rt2(4)
+
+IS-IS L1 IPv4 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ --------------------------------------------------------
+ 10.0.255.2/32 60 - rt3 16060/16020
+ 10.0.255.4/32 50 - rt3 16060/16040
+
+P-space (self):
+ rt3
+ rt5
+
+P-space (rt3):
+ rt3
+ rt5
+ rt6
+
+Q-space:
+ rt2
+ rt4
+ rt6
+
+IS-IS paths to level-1 routers that speak IPv6
+Vertex Type Metric Next-Hop Interface Parent
+rt1
+2001:db8::1/128 IP6 internal 0 rt1(4)
+rt3 TE-IS 10 rt3 - rt1(4)
+rt5 TE-IS 20 rt3 - rt3(4)
+2001:db8::3/128 IP6 internal 20 rt3 - rt3(4)
+rt6 TE-IS 30 rt3 - rt5(4)
+2001:db8::5/128 IP6 internal 30 rt3 - rt5(4)
+rt4 TE-IS 40 rt3 - rt6(4)
+2001:db8::6/128 IP6 internal 40 rt3 - rt6(4)
+rt2 TE-IS 50 rt3 - rt4(4)
+2001:db8::4/128 IP6 internal 50 rt3 - rt4(4)
+2001:db8::2/128 IP6 internal 60 rt3 - rt2(4)
+
+IS-IS L1 IPv6 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ ----------------------------------------------------------
+ 2001:db8::2/128 60 - rt3 16061/16021
+ 2001:db8::4/128 50 - rt3 16061/16041
+
+test# test isis topology 2 root rt1 ti-lfa system-id rt3
+P-space (self):
+ rt2
+ rt4
+ rt5
+ rt6
+
+P-space (rt2):
+ rt2
+
+P-space (rt4):
+ rt2
+ rt4
+ rt5
+ rt6
+
+P-space (rt5):
+ rt2
+ rt4
+ rt5
+ rt6
+
+Q-space:
+ rt3
+
+IS-IS paths to level-1 routers that speak IP
+Vertex Type Metric Next-Hop Interface Parent
+rt1
+10.0.255.1/32 IP internal 0 rt1(4)
+rt4 TE-IS 10 rt4 - rt1(4)
+rt5 TE-IS 10 rt5 - rt1(4)
+rt2 TE-IS 15 rt2 - rt1(4)
+rt1
+rt6 TE-IS 20 rt4 - rt4(4)
+ rt5 - rt5(4)
+10.0.255.4/32 IP TE 20 rt4 - rt4(4)
+10.0.255.5/32 IP TE 20 rt5 - rt5(4)
+10.0.255.2/32 IP TE 25 rt2 - rt2(4)
+10.0.255.6/32 IP TE 30 rt4 - rt6(4)
+ rt5 -
+rt3 TE-IS 50 rt5 - rt5(4)
+10.0.255.3/32 IP TE 60 rt5 - rt3(4)
+
+IS-IS L1 IPv4 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ -----------------------------------------------------------
+ 10.0.255.3/32 60 - rt5 16050/18/16030
+
+P-space (self):
+ rt2
+ rt4
+ rt5
+ rt6
+
+P-space (rt2):
+ rt2
+
+P-space (rt4):
+ rt2
+ rt4
+ rt5
+ rt6
+
+P-space (rt5):
+ rt2
+ rt4
+ rt5
+ rt6
+
+Q-space:
+ rt3
+
+IS-IS paths to level-1 routers that speak IPv6
+Vertex Type Metric Next-Hop Interface Parent
+rt1
+2001:db8::1/128 IP6 internal 0 rt1(4)
+rt4 TE-IS 10 rt4 - rt1(4)
+rt5 TE-IS 10 rt5 - rt1(4)
+rt2 TE-IS 15 rt2 - rt1(4)
+rt1
+rt6 TE-IS 20 rt4 - rt4(4)
+ rt5 - rt5(4)
+2001:db8::4/128 IP6 internal 20 rt4 - rt4(4)
+2001:db8::5/128 IP6 internal 20 rt5 - rt5(4)
+2001:db8::2/128 IP6 internal 25 rt2 - rt2(4)
+2001:db8::6/128 IP6 internal 30 rt4 - rt6(4)
+ rt5 -
+rt3 TE-IS 50 rt5 - rt5(4)
+2001:db8::3/128 IP6 internal 60 rt5 - rt3(4)
+
+IS-IS L1 IPv6 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ -------------------------------------------------------------
+ 2001:db8::3/128 60 - rt5 16051/19/16031
+
+test# test isis topology 2 root rt1 ti-lfa system-id rt1 pseudonode-id 1
+P-space (self):
+ rt2
+ rt3
+
+P-space (rt2):
+ rt2
+ rt3
+
+P-space (rt3):
+ rt2
+ rt3
+
+Q-space:
+ rt4
+ rt5
+ rt6
+
+IS-IS paths to level-1 routers that speak IP
+Vertex Type Metric Next-Hop Interface Parent
+rt1
+10.0.255.1/32 IP internal 0 rt1(4)
+rt2 TE-IS 15 rt2 - rt1(4)
+10.0.255.2/32 IP TE 25 rt2 - rt2(4)
+rt3 TE-IS 30 rt3 - rt1(4)
+10.0.255.3/32 IP TE 40 rt3 - rt3(4)
+rt4 TE-IS 55 rt2 - rt2(4)
+rt1
+rt6 TE-IS 65 rt2 - rt4(4)
+rt5 TE-IS 65 rt2 - rt1(2)
+10.0.255.4/32 IP TE 65 rt2 - rt4(4)
+10.0.255.6/32 IP TE 75 rt2 - rt6(4)
+10.0.255.5/32 IP TE 75 rt2 - rt5(4)
+
+IS-IS L1 IPv4 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ -----------------------------------------------------------
+ 10.0.255.4/32 65 - rt2 16020/18/16040
+ 10.0.255.5/32 75 - rt2 16020/18/16050
+ 10.0.255.6/32 75 - rt2 16020/18/16060
+
+P-space (self):
+ rt2
+ rt3
+
+P-space (rt2):
+ rt2
+ rt3
+
+P-space (rt3):
+ rt2
+ rt3
+
+Q-space:
+ rt4
+ rt5
+ rt6
+
+IS-IS paths to level-1 routers that speak IPv6
+Vertex Type Metric Next-Hop Interface Parent
+rt1
+2001:db8::1/128 IP6 internal 0 rt1(4)
+rt2 TE-IS 15 rt2 - rt1(4)
+2001:db8::2/128 IP6 internal 25 rt2 - rt2(4)
+rt3 TE-IS 30 rt3 - rt1(4)
+2001:db8::3/128 IP6 internal 40 rt3 - rt3(4)
+rt4 TE-IS 55 rt2 - rt2(4)
+rt1
+rt6 TE-IS 65 rt2 - rt4(4)
+rt5 TE-IS 65 rt2 - rt1(2)
+2001:db8::4/128 IP6 internal 65 rt2 - rt4(4)
+2001:db8::6/128 IP6 internal 75 rt2 - rt6(4)
+2001:db8::5/128 IP6 internal 75 rt2 - rt5(4)
+
+IS-IS L1 IPv6 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ -------------------------------------------------------------
+ 2001:db8::4/128 65 - rt2 16021/19/16041
+ 2001:db8::5/128 75 - rt2 16021/19/16051
+ 2001:db8::6/128 75 - rt2 16021/19/16061
+
+test# test isis topology 2 root rt5 ti-lfa system-id rt1 pseudonode-id 1
+P-space (self):
+ rt6
+
+P-space (rt3):
+ rt1
+ rt2
+ rt3
+ rt4
+
+P-space (rt6):
+ rt4
+ rt6
+
+Q-space:
+ rt1
+ rt2
+ rt3
+ rt4
+ rt6
+
+IS-IS paths to level-1 routers that speak IP
+Vertex Type Metric Next-Hop Interface Parent
+rt5
+10.0.255.5/32 IP internal 0 rt5(4)
+rt6 TE-IS 10 rt6 - rt5(4)
+rt4 TE-IS 20 rt6 - rt6(4)
+10.0.255.6/32 IP TE 20 rt6 - rt6(4)
+rt1 pseudo_TE-IS 30 rt6 - rt4(4)
+rt1 TE-IS 30 rt6 - rt1(2)
+10.0.255.4/32 IP TE 30 rt6 - rt4(4)
+rt3 TE-IS 40 rt3 - rt5(4)
+10.0.255.1/32 IP TE 40 rt6 - rt1(4)
+rt2 TE-IS 45 rt6 - rt1(4)
+10.0.255.3/32 IP TE 50 rt3 - rt3(4)
+10.0.255.2/32 IP TE 55 rt6 - rt2(4)
+
+IS-IS L1 IPv4 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ --------------------------------------------------------
+ 10.0.255.1/32 40 - rt6 16040/16010
+ 10.0.255.2/32 55 - rt6 16040/16020
+ 10.0.255.4/32 30 - rt6 16040
+
+P-space (self):
+ rt6
+
+P-space (rt3):
+ rt1
+ rt2
+ rt3
+ rt4
+
+P-space (rt6):
+ rt4
+ rt6
+
+Q-space:
+ rt1
+ rt2
+ rt3
+ rt4
+ rt6
+
+IS-IS paths to level-1 routers that speak IPv6
+Vertex Type Metric Next-Hop Interface Parent
+rt5
+2001:db8::5/128 IP6 internal 0 rt5(4)
+rt6 TE-IS 10 rt6 - rt5(4)
+rt4 TE-IS 20 rt6 - rt6(4)
+2001:db8::6/128 IP6 internal 20 rt6 - rt6(4)
+rt1 pseudo_TE-IS 30 rt6 - rt4(4)
+rt1 TE-IS 30 rt6 - rt1(2)
+2001:db8::4/128 IP6 internal 30 rt6 - rt4(4)
+rt3 TE-IS 40 rt3 - rt5(4)
+2001:db8::1/128 IP6 internal 40 rt6 - rt1(4)
+rt2 TE-IS 45 rt6 - rt1(4)
+2001:db8::3/128 IP6 internal 50 rt3 - rt3(4)
+2001:db8::2/128 IP6 internal 55 rt6 - rt2(4)
+
+IS-IS L1 IPv6 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ ----------------------------------------------------------
+ 2001:db8::1/128 40 - rt6 16041/16011
+ 2001:db8::2/128 55 - rt6 16041/16021
+ 2001:db8::4/128 30 - rt6 16041
+
+test# test isis topology 3 root rt5 ti-lfa system-id rt4 ipv4-only
+P-space (self):
+ rt6
+
+P-space (rt3):
+ rt1
+ rt2
+ rt3
+ rt4
+ rt6
+
+P-space (rt6):
+ rt1
+ rt2
+ rt3
+ rt4
+ rt6
+
+Q-space:
+ rt1
+ rt2
+ rt3
+ rt4
+ rt6
+
+IS-IS paths to level-1 routers that speak IP
+Vertex Type Metric Next-Hop Interface Parent
+rt5
+10.0.255.5/32 IP internal 0 rt5(4)
+rt6 TE-IS 10 rt6 - rt5(4)
+rt4 TE-IS 20 rt6 - rt6(4)
+10.0.255.6/32 IP TE 20 rt6 - rt6(4)
+rt3 TE-IS 30 rt3 - rt5(4)
+rt2 TE-IS 30 rt6 - rt4(4)
+10.0.255.4/32 IP TE 30 rt6 - rt4(4)
+rt1 TE-IS 40 rt3 - rt3(4)
+ rt6 - rt2(4)
+10.0.255.3/32 IP TE 40 rt3 - rt3(4)
+10.0.255.2/32 IP TE 40 rt6 - rt2(4)
+10.0.255.1/32 IP TE 50 rt3 - rt1(4)
+ rt6 -
+
+IS-IS L1 IPv4 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ -----------------------------------------------------
+ 10.0.255.1/32 50 - rt3 16010
+ - rt6 16010
+ 10.0.255.2/32 40 - rt6 16020
+ 10.0.255.4/32 30 - rt6 16040
+
+test# test isis topology 3 root rt5 ti-lfa system-id rt3 ipv4-only
+P-space (self):
+ rt1
+ rt2
+ rt4
+ rt6
+
+P-space (rt4):
+ rt1
+ rt2
+ rt3
+ rt4
+ rt6
+
+P-space (rt6):
+ rt1
+ rt2
+ rt3
+ rt4
+ rt6
+
+Q-space:
+ rt1
+ rt2
+ rt3
+ rt4
+ rt6
+
+IS-IS paths to level-1 routers that speak IP
+Vertex Type Metric Next-Hop Interface Parent
+rt5
+10.0.255.5/32 IP internal 0 rt5(4)
+rt4 TE-IS 10 rt4 - rt5(4)
+rt6 TE-IS 10 rt6 - rt5(4)
+rt2 TE-IS 20 rt4 - rt4(4)
+10.0.255.4/32 IP TE 20 rt4 - rt4(4)
+10.0.255.6/32 IP TE 20 rt6 - rt6(4)
+rt1 TE-IS 30 rt4 - rt2(4)
+rt3 TE-IS 30 rt4 - rt2(4)
+10.0.255.2/32 IP TE 30 rt4 - rt2(4)
+10.0.255.1/32 IP TE 40 rt4 - rt1(4)
+10.0.255.3/32 IP TE 40 rt4 - rt3(4)
+
+IS-IS L1 IPv4 routing table:
+
+test# test isis topology 4 root rt1 ti-lfa system-id rt2 ipv4-only
+P-space (self):
+ rt3
+ rt5
+ rt7
+
+P-space (rt3):
+ rt3
+ rt5
+ rt7
+
+Q-space:
+ rt2
+ rt4
+ rt6
+ rt8
+
+IS-IS paths to level-1 routers that speak IP
+Vertex Type Metric Next-Hop Interface Parent
+rt1
+10.0.255.1/32 IP internal 0 rt1(4)
+rt3 TE-IS 10 rt3 - rt1(4)
+rt5 TE-IS 20 rt3 - rt3(4)
+10.0.255.3/32 IP TE 20 rt3 - rt3(4)
+rt7 TE-IS 30 rt3 - rt5(4)
+10.0.255.5/32 IP TE 30 rt3 - rt5(4)
+10.0.255.7/32 IP TE 40 rt3 - rt7(4)
+rt6 TE-IS 70 rt3 - rt5(4)
+rt4 TE-IS 80 rt3 - rt6(4)
+rt8 TE-IS 80 rt3 - rt6(4)
+10.0.255.6/32 IP TE 80 rt3 - rt6(4)
+rt2 TE-IS 90 rt3 - rt4(4)
+10.0.255.4/32 IP TE 90 rt3 - rt4(4)
+10.0.255.8/32 IP TE 90 rt3 - rt8(4)
+10.0.255.2/32 IP TE 100 rt3 - rt2(4)
+
+IS-IS L1 IPv4 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ -----------------------------------------------------------
+ 10.0.255.2/32 100 - rt3 16050/17/16020
+ 10.0.255.4/32 90 - rt3 16050/17/16040
+ 10.0.255.6/32 80 - rt3 16050/17/16060
+ 10.0.255.8/32 90 - rt3 16050/17/16080
+
+test# test isis topology 4 root rt4 ti-lfa system-id rt6 ipv4-only
+P-space (self):
+ rt1
+ rt2
+ rt3
+ rt5
+ rt7
+
+P-space (rt2):
+ rt1
+ rt2
+ rt3
+ rt5
+ rt7
+
+Q-space:
+ rt6
+ rt8
+
+IS-IS paths to level-1 routers that speak IP
+Vertex Type Metric Next-Hop Interface Parent
+rt4
+10.0.255.4/32 IP internal 0 rt4(4)
+rt2 TE-IS 10 rt2 - rt4(4)
+rt1 TE-IS 20 rt2 - rt2(4)
+10.0.255.2/32 IP TE 20 rt2 - rt2(4)
+rt3 TE-IS 30 rt2 - rt1(4)
+10.0.255.1/32 IP TE 30 rt2 - rt1(4)
+rt5 TE-IS 40 rt2 - rt3(4)
+10.0.255.3/32 IP TE 40 rt2 - rt3(4)
+rt7 TE-IS 50 rt2 - rt5(4)
+10.0.255.5/32 IP TE 50 rt2 - rt5(4)
+10.0.255.7/32 IP TE 60 rt2 - rt7(4)
+rt6 TE-IS 90 rt2 - rt5(4)
+rt8 TE-IS 100 rt2 - rt6(4)
+10.0.255.6/32 IP TE 100 rt2 - rt6(4)
+10.0.255.8/32 IP TE 110 rt2 - rt8(4)
+
+IS-IS L1 IPv4 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ -----------------------------------------------------------
+ 10.0.255.6/32 100 - rt2 16050/17/16060
+ 10.0.255.8/32 110 - rt2 16050/17/16080
+
+test# test isis topology 5 root rt1 ti-lfa system-id rt2 ipv4-only
+P-space (self):
+ rt3
+ rt5
+ rt7
+
+P-space (rt3):
+ rt3
+ rt5
+ rt7
+ rt8
+
+Q-space:
+ rt2
+ rt4
+ rt6
+ rt8
+
+IS-IS paths to level-1 routers that speak IP
+Vertex Type Metric Next-Hop Interface Parent
+rt1
+10.0.255.1/32 IP internal 0 rt1(4)
+rt3 TE-IS 10 rt3 - rt1(4)
+rt5 TE-IS 20 rt3 - rt3(4)
+10.0.255.3/32 IP TE 20 rt3 - rt3(4)
+rt7 TE-IS 30 rt3 - rt5(4)
+10.0.255.5/32 IP TE 30 rt3 - rt5(4)
+rt8 TE-IS 40 rt3 - rt7(4)
+10.0.255.7/32 IP TE 40 rt3 - rt7(4)
+rt6 TE-IS 50 rt3 - rt8(4)
+10.0.255.8/32 IP TE 50 rt3 - rt8(4)
+rt4 TE-IS 60 rt3 - rt6(4)
+10.0.255.6/32 IP TE 60 rt3 - rt6(4)
+rt2 TE-IS 70 rt3 - rt4(4)
+10.0.255.4/32 IP TE 70 rt3 - rt4(4)
+10.0.255.2/32 IP TE 80 rt3 - rt2(4)
+
+IS-IS L1 IPv4 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ --------------------------------------------------------
+ 10.0.255.2/32 80 - rt3 16080/16020
+ 10.0.255.4/32 70 - rt3 16080/16040
+ 10.0.255.6/32 60 - rt3 16080/16060
+
+test# test isis topology 6 root rt4 ti-lfa system-id rt3 ipv4-only
+P-space (self):
+ rt2
+ rt5
+ rt6
+ rt7
+ rt8
+
+P-space (rt2):
+ rt1
+ rt2
+
+P-space (rt6):
+ rt5
+ rt6
+ rt7
+ rt8
+
+Q-space:
+ rt1
+ rt3
+
+IS-IS paths to level-1 routers that speak IP
+Vertex Type Metric Next-Hop Interface Parent
+rt4
+10.0.255.4/32 IP internal 0 rt4(4)
+rt2 TE-IS 10 rt2 - rt4(4)
+rt6 TE-IS 10 rt6 - rt4(4)
+rt1 TE-IS 20 rt2 - rt2(4)
+rt5 TE-IS 20 rt6 - rt6(4)
+rt8 TE-IS 20 rt6 - rt6(4)
+10.0.255.2/32 IP TE 20 rt2 - rt2(4)
+10.0.255.6/32 IP TE 20 rt6 - rt6(4)
+rt3 TE-IS 30 rt2 - rt1(4)
+rt7 TE-IS 30 rt6 - rt5(4)
+ rt8(4)
+10.0.255.1/32 IP TE 30 rt2 - rt1(4)
+10.0.255.5/32 IP TE 30 rt6 - rt5(4)
+10.0.255.8/32 IP TE 30 rt6 - rt8(4)
+10.0.255.3/32 IP TE 40 rt2 - rt3(4)
+10.0.255.7/32 IP TE 40 rt6 - rt7(4)
+
+IS-IS L1 IPv4 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ --------------------------------------------------------
+ 10.0.255.3/32 40 - rt2 16010/16030
+
+test# test isis topology 7 root rt11 ti-lfa system-id rt8 ipv4-only
+P-space (self):
+ rt10
+ rt12
+
+P-space (rt10):
+ rt1
+ rt4
+ rt7
+ rt10
+
+P-space (rt12):
+ rt9
+ rt12
+
+Q-space:
+ rt1
+ rt2
+ rt3
+ rt4
+ rt5
+ rt6
+ rt7
+ rt8
+ rt9
+
+IS-IS paths to level-1 routers that speak IP
+Vertex Type Metric Next-Hop Interface Parent
+rt11
+10.0.255.11/32 IP internal 0 rt11(4)
+rt10 TE-IS 10 rt10 - rt11(4)
+rt12 TE-IS 10 rt12 - rt11(4)
+rt9 TE-IS 20 rt12 - rt12(4)
+10.0.255.10/32 IP TE 20 rt10 - rt10(4)
+10.0.255.12/32 IP TE 20 rt12 - rt12(4)
+rt7 TE-IS 30 rt10 - rt10(4)
+rt8 TE-IS 30 rt12 - rt9(4)
+10.0.255.9/32 IP TE 30 rt12 - rt9(4)
+rt4 TE-IS 40 rt10 - rt7(4)
+rt5 TE-IS 40 rt12 - rt8(4)
+10.0.255.7/32 IP TE 40 rt10 - rt7(4)
+10.0.255.8/32 IP TE 40 rt12 - rt8(4)
+rt6 TE-IS 50 rt12 - rt9(4)
+ rt5(4)
+rt1 TE-IS 50 rt10 - rt4(4)
+rt2 TE-IS 50 rt12 - rt5(4)
+10.0.255.4/32 IP TE 50 rt10 - rt4(4)
+10.0.255.5/32 IP TE 50 rt12 - rt5(4)
+rt3 TE-IS 60 rt12 - rt6(4)
+ rt2(4)
+10.0.255.6/32 IP TE 60 rt12 - rt6(4)
+10.0.255.1/32 IP TE 60 rt10 - rt1(4)
+10.0.255.2/32 IP TE 60 rt12 - rt2(4)
+10.0.255.3/32 IP TE 70 rt12 - rt3(4)
+
+IS-IS L1 IPv4 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ --------------------------------------------------------
+ 10.0.255.1/32 60 - rt10 16010
+ 10.0.255.2/32 60 - rt12 16090/16020
+ 10.0.255.3/32 70 - rt12 16090/16030
+ 10.0.255.4/32 50 - rt10 16040
+ 10.0.255.5/32 50 - rt12 16090/16050
+ 10.0.255.6/32 60 - rt12 16090/16060
+ 10.0.255.7/32 40 - rt10 16070
+ 10.0.255.8/32 40 - rt12 16090/16080
+
+test# test isis topology 7 root rt6 ti-lfa system-id rt5 ipv4-only
+P-space (self):
+ rt3
+
+P-space (rt3):
+ rt2
+ rt3
+
+P-space (rt9):
+ rt1
+ rt2
+ rt4
+ rt5
+ rt7
+ rt8
+ rt9
+ rt10
+ rt11
+ rt12
+
+Q-space:
+ rt1
+ rt2
+ rt4
+ rt5
+ rt7
+ rt8
+ rt9
+ rt10
+ rt11
+ rt12
+
+IS-IS paths to level-1 routers that speak IP
+Vertex Type Metric Next-Hop Interface Parent
+rt6
+10.0.255.6/32 IP internal 0 rt6(4)
+rt3 TE-IS 10 rt3 - rt6(4)
+rt2 TE-IS 20 rt3 - rt3(4)
+10.0.255.3/32 IP TE 20 rt3 - rt3(4)
+rt9 TE-IS 30 rt9 - rt6(4)
+rt5 TE-IS 30 rt3 - rt2(4)
+10.0.255.2/32 IP TE 30 rt3 - rt2(4)
+rt8 TE-IS 40 rt9 - rt9(4)
+ rt3 - rt5(4)
+rt12 TE-IS 40 rt9 - rt9(4)
+rt4 TE-IS 40 rt3 - rt5(4)
+10.0.255.9/32 IP TE 40 rt9 - rt9(4)
+10.0.255.5/32 IP TE 40 rt3 - rt5(4)
+rt7 TE-IS 50 rt9 - rt8(4)
+ rt3 - rt4(4)
+rt11 TE-IS 50 rt9 - rt8(4)
+ rt3 - rt12(4)
+rt1 TE-IS 50 rt3 - rt4(4)
+10.0.255.8/32 IP TE 50 rt9 - rt8(4)
+ rt3 -
+10.0.255.12/32 IP TE 50 rt9 - rt12(4)
+10.0.255.4/32 IP TE 50 rt3 - rt4(4)
+rt10 TE-IS 60 rt9 - rt11(4)
+ rt3 -
+10.0.255.7/32 IP TE 60 rt9 - rt7(4)
+ rt3 -
+10.0.255.11/32 IP TE 60 rt9 - rt11(4)
+ rt3 -
+10.0.255.1/32 IP TE 60 rt3 - rt1(4)
+10.0.255.10/32 IP TE 70 rt9 - rt10(4)
+ rt3 -
+
+IS-IS L1 IPv4 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ ---------------------------------------------------------
+ 10.0.255.1/32 60 - rt3 16020/16010
+ 10.0.255.4/32 50 - rt3 16020/16040
+ 10.0.255.5/32 40 - rt3 16020/16050
+ 10.0.255.7/32 60 - rt9 16070
+ - rt3 16070
+ 10.0.255.8/32 50 - rt9 16080
+ - rt3 16080
+ 10.0.255.10/32 70 - rt9 16100
+ - rt3 16100
+ 10.0.255.11/32 60 - rt9 16110
+ - rt3 16110
+
+test# test isis topology 8 root rt2 ti-lfa system-id rt1 ipv4-only
+P-space (self):
+ rt3
+ rt5
+ rt6
+ rt8
+ rt9
+ rt11
+ rt12
+
+P-space (rt3):
+ rt3
+ rt6
+
+P-space (rt5):
+ rt5
+ rt6
+ rt8
+ rt9
+ rt11
+ rt12
+
+Q-space:
+ rt1
+ rt4
+ rt7
+ rt10
+
+IS-IS paths to level-1 routers that speak IP
+Vertex Type Metric Next-Hop Interface Parent
+rt2
+10.0.255.2/32 IP internal 0 rt2(4)
+rt3 TE-IS 10 rt3 - rt2(4)
+rt5 TE-IS 10 rt5 - rt2(4)
+rt6 TE-IS 20 rt3 - rt3(4)
+ rt5 - rt5(4)
+rt8 TE-IS 20 rt5 - rt5(4)
+10.0.255.3/32 IP TE 20 rt3 - rt3(4)
+10.0.255.5/32 IP TE 20 rt5 - rt5(4)
+rt9 TE-IS 30 rt5 - rt8(4)
+rt11 TE-IS 30 rt5 - rt8(4)
+10.0.255.6/32 IP TE 30 rt3 - rt6(4)
+ rt5 -
+10.0.255.8/32 IP TE 30 rt5 - rt8(4)
+rt12 TE-IS 40 rt5 - rt9(4)
+ rt11(4)
+10.0.255.9/32 IP TE 40 rt5 - rt9(4)
+10.0.255.11/32 IP TE 40 rt5 - rt11(4)
+10.0.255.12/32 IP TE 50 rt5 - rt12(4)
+rt10 TE-IS 60 rt5 - rt11(4)
+rt7 TE-IS 70 rt5 - rt10(4)
+10.0.255.10/32 IP TE 70 rt5 - rt10(4)
+rt4 TE-IS 80 rt5 - rt7(4)
+10.0.255.7/32 IP TE 80 rt5 - rt7(4)
+rt1 TE-IS 90 rt5 - rt4(4)
+10.0.255.4/32 IP TE 90 rt5 - rt4(4)
+10.0.255.1/32 IP TE 100 rt5 - rt1(4)
+
+IS-IS L1 IPv4 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ ------------------------------------------------------------
+ 10.0.255.1/32 100 - rt5 16110/17/16010
+ 10.0.255.4/32 90 - rt5 16110/17/16040
+ 10.0.255.7/32 80 - rt5 16110/17/16070
+ 10.0.255.10/32 70 - rt5 16110/17/16100
+
+test# test isis topology 8 root rt2 ti-lfa system-id rt5 ipv4-only
+P-space (self):
+ rt1
+ rt3
+ rt4
+ rt7
+ rt10
+
+P-space (rt1):
+ rt1
+ rt4
+ rt7
+ rt10
+
+P-space (rt3):
+ rt3
+ rt6
+
+Q-space:
+ rt5
+ rt6
+ rt8
+ rt9
+ rt11
+ rt12
+
+IS-IS paths to level-1 routers that speak IP
+Vertex Type Metric Next-Hop Interface Parent
+rt2
+10.0.255.2/32 IP internal 0 rt2(4)
+rt1 TE-IS 10 rt1 - rt2(4)
+rt3 TE-IS 10 rt3 - rt2(4)
+rt4 TE-IS 20 rt1 - rt1(4)
+rt6 TE-IS 20 rt3 - rt3(4)
+10.0.255.1/32 IP TE 20 rt1 - rt1(4)
+10.0.255.3/32 IP TE 20 rt3 - rt3(4)
+rt7 TE-IS 30 rt1 - rt4(4)
+rt5 TE-IS 30 rt3 - rt6(4)
+10.0.255.4/32 IP TE 30 rt1 - rt4(4)
+10.0.255.6/32 IP TE 30 rt3 - rt6(4)
+rt10 TE-IS 40 rt1 - rt7(4)
+rt8 TE-IS 40 rt3 - rt5(4)
+10.0.255.7/32 IP TE 40 rt1 - rt7(4)
+10.0.255.5/32 IP TE 40 rt3 - rt5(4)
+rt9 TE-IS 50 rt3 - rt8(4)
+rt11 TE-IS 50 rt3 - rt8(4)
+10.0.255.10/32 IP TE 50 rt1 - rt10(4)
+10.0.255.8/32 IP TE 50 rt3 - rt8(4)
+rt12 TE-IS 60 rt3 - rt9(4)
+ rt11(4)
+10.0.255.9/32 IP TE 60 rt3 - rt9(4)
+10.0.255.11/32 IP TE 60 rt3 - rt11(4)
+10.0.255.12/32 IP TE 70 rt3 - rt12(4)
+
+IS-IS L1 IPv4 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ ---------------------------------------------------------
+ 10.0.255.5/32 40 - rt3 16060/16050
+ 10.0.255.8/32 50 - rt3 16060/16080
+ 10.0.255.9/32 60 - rt3 16060/16090
+ 10.0.255.11/32 60 - rt3 16060/16110
+ 10.0.255.12/32 70 - rt3 16060/16120
+
+test# test isis topology 9 root rt1 ti-lfa system-id rt3
+P-space (self):
+ rt2
+ rt4
+ rt5
+ rt6
+ rt7
+ rt8
+ rt9
+
+P-space (rt2):
+ rt2
+ rt4
+ rt5
+ rt6
+ rt7
+ rt8
+ rt9
+
+Q-space:
+ rt3
+
+IS-IS paths to level-1 routers that speak IP
+Vertex Type Metric Next-Hop Interface Parent
+rt1
+10.0.255.1/32 IP internal 0 rt1(4)
+rt2 TE-IS 10 rt2 - rt1(4)
+rt4 TE-IS 20 rt2 - rt2(4)
+10.0.255.2/32 IP TE 20 rt2 - rt2(4)
+rt5 TE-IS 30 rt2 - rt4(4)
+10.0.255.4/32 IP TE 30 rt2 - rt4(4)
+rt9 TE-IS 40 rt2 - rt5(4)
+10.0.255.5/32 IP TE 40 rt2 - rt5(4)
+rt6 TE-IS 50 rt2 - rt4(4)
+ rt9(4)
+rt7 TE-IS 50 rt2 - rt4(4)
+ rt9(4)
+rt8 TE-IS 50 rt2 - rt4(4)
+ rt9(4)
+10.0.255.9/32 IP TE 50 rt2 - rt9(4)
+10.0.255.6/32 IP TE 60 rt2 - rt6(4)
+10.0.255.7/32 IP TE 60 rt2 - rt7(4)
+10.0.255.8/32 IP TE 60 rt2 - rt8(4)
+rt3 TE-IS 120 rt2 - rt4(4)
+10.0.255.3/32 IP TE 130 rt2 - rt3(4)
+
+IS-IS L1 IPv4 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ -----------------------------------------------------------
+ 10.0.255.3/32 130 - rt2 16040/18/16030
+
+P-space (self):
+ rt2
+ rt4
+ rt5
+ rt6
+ rt7
+ rt8
+ rt9
+
+P-space (rt2):
+ rt2
+ rt4
+ rt5
+ rt6
+ rt7
+ rt8
+ rt9
+
+Q-space:
+ rt3
+
+IS-IS paths to level-1 routers that speak IPv6
+Vertex Type Metric Next-Hop Interface Parent
+rt1
+2001:db8::1/128 IP6 internal 0 rt1(4)
+rt2 TE-IS 10 rt2 - rt1(4)
+rt4 TE-IS 20 rt2 - rt2(4)
+2001:db8::2/128 IP6 internal 20 rt2 - rt2(4)
+rt5 TE-IS 30 rt2 - rt4(4)
+2001:db8::4/128 IP6 internal 30 rt2 - rt4(4)
+rt9 TE-IS 40 rt2 - rt5(4)
+2001:db8::5/128 IP6 internal 40 rt2 - rt5(4)
+rt6 TE-IS 50 rt2 - rt4(4)
+ rt9(4)
+rt7 TE-IS 50 rt2 - rt4(4)
+ rt9(4)
+rt8 TE-IS 50 rt2 - rt4(4)
+ rt9(4)
+2001:db8::9/128 IP6 internal 50 rt2 - rt9(4)
+2001:db8::6/128 IP6 internal 60 rt2 - rt6(4)
+2001:db8::7/128 IP6 internal 60 rt2 - rt7(4)
+2001:db8::8/128 IP6 internal 60 rt2 - rt8(4)
+rt3 TE-IS 120 rt2 - rt4(4)
+2001:db8::3/128 IP6 internal 130 rt2 - rt3(4)
+
+IS-IS L1 IPv6 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ -------------------------------------------------------------
+ 2001:db8::3/128 130 - rt2 16041/19/16031
+
+test# test isis topology 9 root rt1 ti-lfa system-id rt2
+P-space (self):
+ rt3
+
+P-space (rt3):
+ rt3
+
+Q-space:
+ rt2
+ rt4
+ rt5
+ rt6
+ rt7
+ rt8
+ rt9
+
+IS-IS paths to level-1 routers that speak IP
+Vertex Type Metric Next-Hop Interface Parent
+rt1
+10.0.255.1/32 IP internal 0 rt1(4)
+rt3 TE-IS 10 rt3 - rt1(4)
+10.0.255.3/32 IP TE 20 rt3 - rt3(4)
+rt4 TE-IS 110 rt3 - rt3(4)
+rt2 TE-IS 120 rt3 - rt4(4)
+rt5 TE-IS 120 rt3 - rt4(4)
+10.0.255.4/32 IP TE 120 rt3 - rt4(4)
+rt9 TE-IS 130 rt3 - rt5(4)
+10.0.255.2/32 IP TE 130 rt3 - rt2(4)
+10.0.255.5/32 IP TE 130 rt3 - rt5(4)
+rt6 TE-IS 140 rt3 - rt4(4)
+ rt9(4)
+rt7 TE-IS 140 rt3 - rt4(4)
+ rt9(4)
+rt8 TE-IS 140 rt3 - rt4(4)
+ rt9(4)
+10.0.255.9/32 IP TE 140 rt3 - rt9(4)
+10.0.255.6/32 IP TE 150 rt3 - rt6(4)
+10.0.255.7/32 IP TE 150 rt3 - rt7(4)
+10.0.255.8/32 IP TE 150 rt3 - rt8(4)
+
+IS-IS L1 IPv4 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ -----------------------------------------------------------
+ 10.0.255.2/32 130 - rt3 16030/18/16020
+ 10.0.255.4/32 120 - rt3 16030/18/16040
+ 10.0.255.5/32 130 - rt3 16030/18/16050
+ 10.0.255.6/32 150 - rt3 16030/18/16060
+ 10.0.255.7/32 150 - rt3 16030/18/16070
+ 10.0.255.8/32 150 - rt3 16030/18/16080
+ 10.0.255.9/32 140 - rt3 16030/18/16090
+
+P-space (self):
+ rt3
+
+P-space (rt3):
+ rt3
+
+Q-space:
+ rt2
+ rt4
+ rt5
+ rt6
+ rt7
+ rt8
+ rt9
+
+IS-IS paths to level-1 routers that speak IPv6
+Vertex Type Metric Next-Hop Interface Parent
+rt1
+2001:db8::1/128 IP6 internal 0 rt1(4)
+rt3 TE-IS 10 rt3 - rt1(4)
+2001:db8::3/128 IP6 internal 20 rt3 - rt3(4)
+rt4 TE-IS 110 rt3 - rt3(4)
+rt2 TE-IS 120 rt3 - rt4(4)
+rt5 TE-IS 120 rt3 - rt4(4)
+2001:db8::4/128 IP6 internal 120 rt3 - rt4(4)
+rt9 TE-IS 130 rt3 - rt5(4)
+2001:db8::2/128 IP6 internal 130 rt3 - rt2(4)
+2001:db8::5/128 IP6 internal 130 rt3 - rt5(4)
+rt6 TE-IS 140 rt3 - rt4(4)
+ rt9(4)
+rt7 TE-IS 140 rt3 - rt4(4)
+ rt9(4)
+rt8 TE-IS 140 rt3 - rt4(4)
+ rt9(4)
+2001:db8::9/128 IP6 internal 140 rt3 - rt9(4)
+2001:db8::6/128 IP6 internal 150 rt3 - rt6(4)
+2001:db8::7/128 IP6 internal 150 rt3 - rt7(4)
+2001:db8::8/128 IP6 internal 150 rt3 - rt8(4)
+
+IS-IS L1 IPv6 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ -------------------------------------------------------------
+ 2001:db8::2/128 130 - rt3 16031/19/16021
+ 2001:db8::4/128 120 - rt3 16031/19/16041
+ 2001:db8::5/128 130 - rt3 16031/19/16051
+ 2001:db8::6/128 150 - rt3 16031/19/16061
+ 2001:db8::7/128 150 - rt3 16031/19/16071
+ 2001:db8::8/128 150 - rt3 16031/19/16081
+ 2001:db8::9/128 140 - rt3 16031/19/16091
+
+test# test isis topology 9 root rt9 ti-lfa system-id rt5
+P-space (self):
+ rt6
+ rt7
+ rt8
+
+P-space (rt6):
+ rt6
+
+P-space (rt7):
+ rt7
+
+P-space (rt8):
+ rt8
+
+Q-space:
+ rt1
+ rt2
+ rt3
+ rt4
+ rt5
+
+IS-IS paths to level-1 routers that speak IP
+Vertex Type Metric Next-Hop Interface Parent
+rt9
+10.0.255.9/32 IP internal 0 rt9(4)
+rt6 TE-IS 10 rt6 - rt9(4)
+rt7 TE-IS 10 rt7 - rt9(4)
+rt8 TE-IS 10 rt8 - rt9(4)
+10.0.255.6/32 IP TE 20 rt6 - rt6(4)
+10.0.255.7/32 IP TE 20 rt7 - rt7(4)
+10.0.255.8/32 IP TE 20 rt8 - rt8(4)
+rt4 TE-IS 40 rt6 - rt6(4)
+ rt7 - rt7(4)
+ rt8 - rt8(4)
+rt2 TE-IS 50 rt6 - rt4(4)
+ rt7 -
+ rt8 -
+rt5 TE-IS 50 rt6 - rt4(4)
+ rt7 -
+ rt8 -
+10.0.255.4/32 IP TE 50 rt6 - rt4(4)
+ rt7 -
+ rt8 -
+rt1 TE-IS 60 rt6 - rt2(4)
+ rt7 -
+ rt8 -
+10.0.255.2/32 IP TE 60 rt6 - rt2(4)
+ rt7 -
+ rt8 -
+10.0.255.5/32 IP TE 60 rt6 - rt5(4)
+ rt7 -
+ rt8 -
+rt3 TE-IS 70 rt6 - rt1(4)
+ rt7 -
+ rt8 -
+10.0.255.1/32 IP TE 70 rt6 - rt1(4)
+ rt7 -
+ rt8 -
+10.0.255.3/32 IP TE 80 rt6 - rt3(4)
+ rt7 -
+ rt8 -
+
+IS-IS L1 IPv4 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ -----------------------------------------------------------
+ 10.0.255.1/32 70 - rt6 16060/16/16010
+ - rt7 16070/16/16010
+ - rt8 16080/16/16010
+ 10.0.255.2/32 60 - rt6 16060/16/16020
+ - rt7 16070/16/16020
+ - rt8 16080/16/16020
+ 10.0.255.3/32 80 - rt6 16060/16/16030
+ - rt7 16070/16/16030
+ - rt8 16080/16/16030
+ 10.0.255.4/32 50 - rt6 16060/16/16040
+ - rt7 16070/16/16040
+ - rt8 16080/16/16040
+ 10.0.255.5/32 60 - rt6 16060/16/16050
+ - rt7 16070/16/16050
+ - rt8 16080/16/16050
+
+P-space (self):
+ rt6
+ rt7
+ rt8
+
+P-space (rt6):
+ rt6
+
+P-space (rt7):
+ rt7
+
+P-space (rt8):
+ rt8
+
+Q-space:
+ rt1
+ rt2
+ rt3
+ rt4
+ rt5
+
+IS-IS paths to level-1 routers that speak IPv6
+Vertex Type Metric Next-Hop Interface Parent
+rt9
+2001:db8::9/128 IP6 internal 0 rt9(4)
+rt6 TE-IS 10 rt6 - rt9(4)
+rt7 TE-IS 10 rt7 - rt9(4)
+rt8 TE-IS 10 rt8 - rt9(4)
+2001:db8::6/128 IP6 internal 20 rt6 - rt6(4)
+2001:db8::7/128 IP6 internal 20 rt7 - rt7(4)
+2001:db8::8/128 IP6 internal 20 rt8 - rt8(4)
+rt4 TE-IS 40 rt6 - rt6(4)
+ rt7 - rt7(4)
+ rt8 - rt8(4)
+rt2 TE-IS 50 rt6 - rt4(4)
+ rt7 -
+ rt8 -
+rt5 TE-IS 50 rt6 - rt4(4)
+ rt7 -
+ rt8 -
+2001:db8::4/128 IP6 internal 50 rt6 - rt4(4)
+ rt7 -
+ rt8 -
+rt1 TE-IS 60 rt6 - rt2(4)
+ rt7 -
+ rt8 -
+2001:db8::2/128 IP6 internal 60 rt6 - rt2(4)
+ rt7 -
+ rt8 -
+2001:db8::5/128 IP6 internal 60 rt6 - rt5(4)
+ rt7 -
+ rt8 -
+rt3 TE-IS 70 rt6 - rt1(4)
+ rt7 -
+ rt8 -
+2001:db8::1/128 IP6 internal 70 rt6 - rt1(4)
+ rt7 -
+ rt8 -
+2001:db8::3/128 IP6 internal 80 rt6 - rt3(4)
+ rt7 -
+ rt8 -
+
+IS-IS L1 IPv6 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ -------------------------------------------------------------
+ 2001:db8::1/128 70 - rt6 16061/17/16011
+ - rt7 16071/17/16011
+ - rt8 16081/17/16011
+ 2001:db8::2/128 60 - rt6 16061/17/16021
+ - rt7 16071/17/16021
+ - rt8 16081/17/16021
+ 2001:db8::3/128 80 - rt6 16061/17/16031
+ - rt7 16071/17/16031
+ - rt8 16081/17/16031
+ 2001:db8::4/128 50 - rt6 16061/17/16041
+ - rt7 16071/17/16041
+ - rt8 16081/17/16041
+ 2001:db8::5/128 60 - rt6 16061/17/16051
+ - rt7 16071/17/16051
+ - rt8 16081/17/16051
+
+test# test isis topology 9 root rt9 ti-lfa system-id rt8
+P-space (self):
+ rt1
+ rt2
+ rt3
+ rt4
+ rt5
+ rt6
+ rt7
+
+P-space (rt5):
+ rt1
+ rt2
+ rt3
+ rt4
+ rt5
+
+P-space (rt6):
+ rt6
+
+P-space (rt7):
+ rt7
+
+Q-space:
+ rt8
+
+IS-IS paths to level-1 routers that speak IP
+Vertex Type Metric Next-Hop Interface Parent
+rt9
+10.0.255.9/32 IP internal 0 rt9(4)
+rt5 TE-IS 10 rt5 - rt9(4)
+rt6 TE-IS 10 rt6 - rt9(4)
+rt7 TE-IS 10 rt7 - rt9(4)
+rt4 TE-IS 20 rt5 - rt5(4)
+10.0.255.5/32 IP TE 20 rt5 - rt5(4)
+10.0.255.6/32 IP TE 20 rt6 - rt6(4)
+10.0.255.7/32 IP TE 20 rt7 - rt7(4)
+rt2 TE-IS 30 rt5 - rt4(4)
+10.0.255.4/32 IP TE 30 rt5 - rt4(4)
+rt1 TE-IS 40 rt5 - rt2(4)
+10.0.255.2/32 IP TE 40 rt5 - rt2(4)
+rt8 TE-IS 50 rt5 - rt4(4)
+rt3 TE-IS 50 rt5 - rt1(4)
+10.0.255.1/32 IP TE 50 rt5 - rt1(4)
+10.0.255.8/32 IP TE 60 rt5 - rt8(4)
+10.0.255.3/32 IP TE 60 rt5 - rt3(4)
+
+IS-IS L1 IPv4 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ -----------------------------------------------------------
+ 10.0.255.8/32 60 - rt5 16040/26/16080
+
+P-space (self):
+ rt1
+ rt2
+ rt3
+ rt4
+ rt5
+ rt6
+ rt7
+
+P-space (rt5):
+ rt1
+ rt2
+ rt3
+ rt4
+ rt5
+
+P-space (rt6):
+ rt6
+
+P-space (rt7):
+ rt7
+
+Q-space:
+ rt8
+
+IS-IS paths to level-1 routers that speak IPv6
+Vertex Type Metric Next-Hop Interface Parent
+rt9
+2001:db8::9/128 IP6 internal 0 rt9(4)
+rt5 TE-IS 10 rt5 - rt9(4)
+rt6 TE-IS 10 rt6 - rt9(4)
+rt7 TE-IS 10 rt7 - rt9(4)
+rt4 TE-IS 20 rt5 - rt5(4)
+2001:db8::5/128 IP6 internal 20 rt5 - rt5(4)
+2001:db8::6/128 IP6 internal 20 rt6 - rt6(4)
+2001:db8::7/128 IP6 internal 20 rt7 - rt7(4)
+rt2 TE-IS 30 rt5 - rt4(4)
+2001:db8::4/128 IP6 internal 30 rt5 - rt4(4)
+rt1 TE-IS 40 rt5 - rt2(4)
+2001:db8::2/128 IP6 internal 40 rt5 - rt2(4)
+rt8 TE-IS 50 rt5 - rt4(4)
+rt3 TE-IS 50 rt5 - rt1(4)
+2001:db8::1/128 IP6 internal 50 rt5 - rt1(4)
+2001:db8::8/128 IP6 internal 60 rt5 - rt8(4)
+2001:db8::3/128 IP6 internal 60 rt5 - rt3(4)
+
+IS-IS L1 IPv6 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ -------------------------------------------------------------
+ 2001:db8::8/128 60 - rt5 16041/27/16081
+
+test# test isis topology 10 root rt1 ti-lfa system-id rt2
+P-space (self):
+ rt3
+ rt4
+ rt6
+ rt7
+
+P-space (rt3):
+ rt3
+ rt6
+
+P-space (rt4):
+ rt4
+ rt7
+
+Q-space:
+ rt2
+ rt5
+ rt8
+
+IS-IS paths to level-1 routers that speak IP
+Vertex Type Metric Next-Hop Interface Parent
+rt1
+10.0.255.1/32 IP internal 0 rt1(4)
+rt3 TE-IS 20 rt3 - rt1(4)
+rt4 TE-IS 20 rt4 - rt1(4)
+rt6 TE-IS 30 rt3 - rt3(4)
+rt7 TE-IS 30 rt4 - rt4(4)
+10.0.255.3/32 IP TE 30 rt3 - rt3(4)
+10.0.255.4/32 IP TE 30 rt4 - rt4(4)
+10.0.255.6/32 IP TE 40 rt3 - rt6(4)
+10.0.255.7/32 IP TE 40 rt4 - rt7(4)
+rt8 TE-IS 80 rt3 - rt6(4)
+ rt4 - rt7(4)
+rt5 TE-IS 90 rt3 - rt8(4)
+ rt4 -
+10.0.255.8/32 IP TE 90 rt3 - rt8(4)
+ rt4 -
+rt2 TE-IS 100 rt3 - rt5(4)
+ rt4 -
+10.0.255.5/32 IP TE 100 rt3 - rt5(4)
+ rt4 -
+10.0.255.2/32 IP TE 110 rt3 - rt2(4)
+ rt4 -
+
+IS-IS L1 IPv4 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ -----------------------------------------------------------
+ 10.0.255.2/32 110 - rt3 20060/18/16020
+ - rt4 16070/18/16020
+ 10.0.255.5/32 100 - rt3 20060/18/16050
+ - rt4 16070/18/16050
+ 10.0.255.8/32 90 - rt3 20060/18/16080
+ - rt4 16070/18/16080
+
+P-space (self):
+ rt3
+ rt4
+ rt6
+ rt7
+
+P-space (rt3):
+ rt3
+ rt6
+
+P-space (rt4):
+ rt4
+ rt7
+
+Q-space:
+ rt2
+ rt5
+ rt8
+
+IS-IS paths to level-1 routers that speak IPv6
+Vertex Type Metric Next-Hop Interface Parent
+rt1
+2001:db8::1/128 IP6 internal 0 rt1(4)
+rt3 TE-IS 20 rt3 - rt1(4)
+rt4 TE-IS 20 rt4 - rt1(4)
+rt6 TE-IS 30 rt3 - rt3(4)
+rt7 TE-IS 30 rt4 - rt4(4)
+2001:db8::3/128 IP6 internal 30 rt3 - rt3(4)
+2001:db8::4/128 IP6 internal 30 rt4 - rt4(4)
+2001:db8::6/128 IP6 internal 40 rt3 - rt6(4)
+2001:db8::7/128 IP6 internal 40 rt4 - rt7(4)
+rt8 TE-IS 80 rt3 - rt6(4)
+ rt4 - rt7(4)
+rt5 TE-IS 90 rt3 - rt8(4)
+ rt4 -
+2001:db8::8/128 IP6 internal 90 rt3 - rt8(4)
+ rt4 -
+rt2 TE-IS 100 rt3 - rt5(4)
+ rt4 -
+2001:db8::5/128 IP6 internal 100 rt3 - rt5(4)
+ rt4 -
+2001:db8::2/128 IP6 internal 110 rt3 - rt2(4)
+ rt4 -
+
+IS-IS L1 IPv6 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ -------------------------------------------------------------
+ 2001:db8::2/128 110 - rt3 20061/19/16021
+ - rt4 16071/19/16021
+ 2001:db8::5/128 100 - rt3 20061/19/16051
+ - rt4 16071/19/16051
+ 2001:db8::8/128 90 - rt3 20061/19/16081
+ - rt4 16071/19/16081
+
+test# test isis topology 10 root rt1 ti-lfa system-id rt4
+P-space (self):
+ rt2
+ rt3
+ rt5
+ rt6
+ rt8
+
+P-space (rt2):
+ rt2
+ rt5
+ rt8
+
+P-space (rt3):
+ rt3
+ rt6
+
+Q-space:
+ rt4
+ rt7
+
+IS-IS paths to level-1 routers that speak IP
+Vertex Type Metric Next-Hop Interface Parent
+rt1
+10.0.255.1/32 IP internal 0 rt1(4)
+rt2 TE-IS 10 rt2 - rt1(4)
+rt3 TE-IS 20 rt3 - rt1(4)
+rt5 TE-IS 20 rt2 - rt2(4)
+10.0.255.2/32 IP TE 20 rt2 - rt2(4)
+rt6 TE-IS 30 rt3 - rt3(4)
+rt8 TE-IS 30 rt2 - rt5(4)
+10.0.255.3/32 IP TE 30 rt3 - rt3(4)
+10.0.255.5/32 IP TE 30 rt2 - rt5(4)
+10.0.255.6/32 IP TE 40 rt3 - rt6(4)
+10.0.255.8/32 IP TE 40 rt2 - rt8(4)
+rt7 TE-IS 80 rt2 - rt8(4)
+rt4 TE-IS 90 rt2 - rt7(4)
+10.0.255.7/32 IP TE 90 rt2 - rt7(4)
+10.0.255.4/32 IP TE 100 rt2 - rt4(4)
+
+IS-IS L1 IPv4 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ -----------------------------------------------------------
+ 10.0.255.4/32 100 - rt2 16080/20/16040
+ 10.0.255.7/32 90 - rt2 16080/20/16070
+
+P-space (self):
+ rt2
+ rt3
+ rt5
+ rt6
+ rt8
+
+P-space (rt2):
+ rt2
+ rt5
+ rt8
+
+P-space (rt3):
+ rt3
+ rt6
+
+Q-space:
+ rt4
+ rt7
+
+IS-IS paths to level-1 routers that speak IPv6
+Vertex Type Metric Next-Hop Interface Parent
+rt1
+2001:db8::1/128 IP6 internal 0 rt1(4)
+rt2 TE-IS 10 rt2 - rt1(4)
+rt3 TE-IS 20 rt3 - rt1(4)
+rt5 TE-IS 20 rt2 - rt2(4)
+2001:db8::2/128 IP6 internal 20 rt2 - rt2(4)
+rt6 TE-IS 30 rt3 - rt3(4)
+rt8 TE-IS 30 rt2 - rt5(4)
+2001:db8::3/128 IP6 internal 30 rt3 - rt3(4)
+2001:db8::5/128 IP6 internal 30 rt2 - rt5(4)
+2001:db8::6/128 IP6 internal 40 rt3 - rt6(4)
+2001:db8::8/128 IP6 internal 40 rt2 - rt8(4)
+rt7 TE-IS 80 rt2 - rt8(4)
+rt4 TE-IS 90 rt2 - rt7(4)
+2001:db8::7/128 IP6 internal 90 rt2 - rt7(4)
+2001:db8::4/128 IP6 internal 100 rt2 - rt4(4)
+
+IS-IS L1 IPv6 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ -------------------------------------------------------------
+ 2001:db8::4/128 100 - rt2 16081/21/16041
+ 2001:db8::7/128 90 - rt2 16081/21/16071
+
+test# test isis topology 11 root rt2 ti-lfa system-id rt4
+P-space (self):
+
+P-space (rt1):
+ rt1
+ rt3
+ rt5
+
+P-space (rt3):
+ rt1
+ rt3
+ rt5
+ rt6
+
+Q-space:
+ rt1
+ rt3
+ rt4
+ rt5
+ rt6
+
+IS-IS paths to level-1 routers that speak IP
+Vertex Type Metric Next-Hop Interface Parent
+rt2
+10.0.255.2/32 IP internal 0 rt2(4)
+rt1 TE-IS 50 rt1 - rt2(4)
+rt3 TE-IS 50 rt3 - rt2(4)
+rt2
+rt5 TE-IS 60 rt3 - rt3(4)
+10.0.255.1/32 IP TE 60 rt1 - rt1(4)
+10.0.255.3/32 IP TE 60 rt3 - rt3(4)
+rt4 TE-IS 70 rt3 - rt5(4)
+rt6 TE-IS 70 rt3 - rt5(4)
+10.0.255.5/32 IP TE 70 rt3 - rt5(4)
+10.0.255.4/32 IP TE 80 rt3 - rt4(4)
+10.0.255.6/32 IP TE 80 rt3 - rt6(4)
+
+IS-IS L1 IPv4 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ ----------------------------------------------------------
+ 10.0.255.1/32 60 - rt1 implicit-null
+ 10.0.255.3/32 60 - rt3 implicit-null
+ 10.0.255.4/32 80 - rt3 16050/16040
+ 10.0.255.5/32 70 - rt3 16050
+ 10.0.255.6/32 80 - rt3 16060
+
+P-space (self):
+
+P-space (rt1):
+ rt1
+ rt3
+ rt5
+
+P-space (rt3):
+ rt1
+ rt3
+ rt5
+ rt6
+
+Q-space:
+ rt1
+ rt3
+ rt4
+ rt5
+ rt6
+
+IS-IS paths to level-1 routers that speak IPv6
+Vertex Type Metric Next-Hop Interface Parent
+rt2
+2001:db8::2/128 IP6 internal 0 rt2(4)
+rt1 TE-IS 50 rt1 - rt2(4)
+rt3 TE-IS 50 rt3 - rt2(4)
+rt2
+rt5 TE-IS 60 rt3 - rt3(4)
+2001:db8::1/128 IP6 internal 60 rt1 - rt1(4)
+2001:db8::3/128 IP6 internal 60 rt3 - rt3(4)
+rt4 TE-IS 70 rt3 - rt5(4)
+rt6 TE-IS 70 rt3 - rt5(4)
+2001:db8::5/128 IP6 internal 70 rt3 - rt5(4)
+2001:db8::4/128 IP6 internal 80 rt3 - rt4(4)
+2001:db8::6/128 IP6 internal 80 rt3 - rt6(4)
+
+IS-IS L1 IPv6 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ ------------------------------------------------------------
+ 2001:db8::1/128 60 - rt1 implicit-null
+ 2001:db8::3/128 60 - rt3 implicit-null
+ 2001:db8::4/128 80 - rt3 16051/16041
+ 2001:db8::5/128 70 - rt3 16051
+ 2001:db8::6/128 80 - rt3 16061
+
+test# test isis topology 12 root rt1 ti-lfa system-id rt3 ipv4-only
+P-space (self):
+ rt2
+ rt4
+ rt6
+ rt8
+ rt10
+
+P-space (rt2):
+ rt2
+ rt4
+ rt6
+ rt8
+ rt10
+
+Q-space:
+ rt3
+
+IS-IS paths to level-1 routers that speak IP
+Vertex Type Metric Next-Hop Interface Parent
+rt1
+10.0.255.1/32 IP internal 0 rt1(4)
+rt2 TE-IS 10 rt2 - rt1(4)
+rt4 TE-IS 20 rt2 - rt2(4)
+10.0.255.2/32 IP TE 20 rt2 - rt2(4)
+rt6 TE-IS 30 rt2 - rt4(4)
+10.0.255.4/32 IP TE 30 rt2 - rt4(4)
+rt8 TE-IS 40 rt2 - rt6(4)
+10.0.255.6/32 IP TE 40 rt2 - rt6(4)
+rt10 TE-IS 50 rt2 - rt8(4)
+10.0.255.8/32 IP TE 50 rt2 - rt8(4)
+10.0.255.10/32 IP TE 60 rt2 - rt10(4)
+rt7 TE-IS 140 rt2 - rt8(4)
+rt9 TE-IS 150 rt2 - rt7(4)
+10.0.255.7/32 IP TE 150 rt2 - rt7(4)
+10.0.255.9/32 IP TE 160 rt2 - rt9(4)
+rt5 TE-IS 340 rt2 - rt7(4)
+10.0.255.5/32 IP TE 350 rt2 - rt5(4)
+rt3 TE-IS 740 rt2 - rt5(4)
+10.0.255.3/32 IP TE 750 rt2 - rt3(4)
+
+IS-IS L1 IPv4 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ -----------------------------------------------------------------
+ 10.0.255.3/32 750 - rt2 16080/17/16/16/16030
+ 10.0.255.5/32 350 - rt2 16080/17/16/16050
+ 10.0.255.7/32 150 - rt2 16080/17/16070
+ 10.0.255.9/32 160 - rt2 16080/17/18/16090
+
+test# test isis topology 13 root rt1 ti-lfa system-id rt3 ipv4-only
+P-space (self):
+ rt2
+
+P-space (rt2):
+ rt2
+ rt4
+
+Q-space:
+ rt3
+ rt4
+ rt5
+ rt6
+ rt7
+
+IS-IS paths to level-1 routers that speak IP
+Vertex Type Metric Next-Hop Interface Parent
+rt1
+10.0.255.1/32 IP internal 0 rt1(4)
+rt2 TE-IS 10 rt2 - rt1(4)
+rt4 TE-IS 20 rt2 - rt2(4)
+10.0.255.2/32 IP TE 20 rt2 - rt2(4)
+rt3 TE-IS 30 rt2 - rt4(4)
+10.0.255.4/32 IP TE 30 rt2 - rt4(4)
+rt5 TE-IS 40 rt2 - rt3(4)
+rt6 TE-IS 40 rt2 - rt3(4)
+10.0.255.3/32 IP TE 40 rt2 - rt3(4)
+rt7 TE-IS 50 rt2 - rt5(4)
+ rt6(4)
+10.0.255.5/32 IP TE 50 rt2 - rt5(4)
+10.0.255.6/32 IP TE 50 rt2 - rt6(4)
+10.0.255.7/32 IP TE 60 rt2 - rt7(4)
+
+IS-IS L1 IPv4 routing table:
+
+ Prefix Metric Interface Nexthop Label(s)
+ --------------------------------------------------------
+ 10.0.255.3/32 40 - rt2 16040/16030
+ 10.0.255.5/32 50 - rt2 16040/16050
+ 10.0.255.6/32 50 - rt2 16040/16060
+ 10.0.255.7/32 60 - rt2 16040/16070
test# end. diff --git a/tests/isisd/test_isis_vertex_queue.py b/tests/isisd/test_isis_vertex_queue.py index 5974edecc9..b9d2fc5fa2 100644 --- a/tests/isisd/test_isis_vertex_queue.py +++ b/tests/isisd/test_isis_vertex_queue.py @@ -1,6 +1,8 @@ import frrtest + class TestIsisVertexQueue(frrtest.TestMultiOut): - program = './test_isis_vertex_queue' + program = "./test_isis_vertex_queue" + TestIsisVertexQueue.exit_cleanly() diff --git a/tests/lib/cli/test_cli.c b/tests/lib/cli/test_cli.c index 8f062d8b5e..8dba1e29f0 100644 --- a/tests/lib/cli/test_cli.c +++ b/tests/lib/cli/test_cli.c @@ -47,12 +47,10 @@ DEFPY(magic_test, magic_test_cmd, "magic (0-100) {ipv4net A.B.C.D/M|X:X::X:X$ipv6}", "1\n2\n3\n4\n5\n") { - char buf[256]; vty_out(vty, "def: %s\n", self->string); vty_out(vty, "num: %ld\n", magic); - vty_out(vty, "ipv4: %s\n", prefix2str(ipv4net, buf, sizeof(buf))); - vty_out(vty, "ipv6: %s\n", - inet_ntop(AF_INET6, &ipv6, buf, sizeof(buf))); + vty_out(vty, "ipv4: %pFX\n", ipv4net); + vty_out(vty, "ipv6: %pI6\n", &ipv6); return CMD_SUCCESS; } diff --git a/tests/lib/cli/test_cli.py b/tests/lib/cli/test_cli.py index 7371db283a..6fdd6faa65 100644 --- a/tests/lib/cli/test_cli.py +++ b/tests/lib/cli/test_cli.py @@ -1,5 +1,6 @@ import frrtest + class TestCli(frrtest.TestRefOut): - program = './test_cli' + program = "./test_cli" built_refout = True diff --git a/tests/lib/cli/test_commands.py b/tests/lib/cli/test_commands.py index d55345186a..cf99077c35 100644 --- a/tests/lib/cli/test_commands.py +++ b/tests/lib/cli/test_commands.py @@ -2,10 +2,12 @@ import frrtest import pytest import os + class TestCommands(frrtest.TestRefOut): - program = './test_commands' + program = "./test_commands" - @pytest.mark.skipif('QUAGGA_TEST_COMMANDS' not in os.environ, - reason='QUAGGA_TEST_COMMANDS not set') + @pytest.mark.skipif( + "QUAGGA_TEST_COMMANDS" not in os.environ, reason="QUAGGA_TEST_COMMANDS not set" + ) def test_refout(self): return super(TestCommands, self).test_refout() diff --git a/tests/lib/northbound/test_oper_data.py b/tests/lib/northbound/test_oper_data.py index 8f5fdd6fd0..a02bf05c1a 100644 --- a/tests/lib/northbound/test_oper_data.py +++ b/tests/lib/northbound/test_oper_data.py @@ -1,4 +1,5 @@ import frrtest + class TestNbOperData(frrtest.TestRefOut): - program = './test_oper_data' + program = "./test_oper_data" diff --git a/tests/lib/test_atomlist.py b/tests/lib/test_atomlist.py index 293d47f316..719a2e791d 100644 --- a/tests/lib/test_atomlist.py +++ b/tests/lib/test_atomlist.py @@ -1,6 +1,8 @@ import frrtest + class TestAtomlist(frrtest.TestMultiOut): - program = './test_atomlist' + program = "./test_atomlist" + TestAtomlist.exit_cleanly() diff --git a/tests/lib/test_graph.py b/tests/lib/test_graph.py index 697e56c149..b26986c83c 100644 --- a/tests/lib/test_graph.py +++ b/tests/lib/test_graph.py @@ -1,4 +1,5 @@ import frrtest + class TestGraph(frrtest.TestRefOut): - program = './test_graph' + program = "./test_graph" diff --git a/tests/lib/test_idalloc.py b/tests/lib/test_idalloc.py index 22de082be4..e2186dc521 100644 --- a/tests/lib/test_idalloc.py +++ b/tests/lib/test_idalloc.py @@ -1,6 +1,8 @@ import frrtest + class TestIDAlloc(frrtest.TestMultiOut): - program = './test_idalloc' + program = "./test_idalloc" + -TestIDAlloc.onesimple('ID Allocator test successful.') +TestIDAlloc.onesimple("ID Allocator test successful.") diff --git a/tests/lib/test_nexthop_iter.py b/tests/lib/test_nexthop_iter.py index bb330a1c75..0c39dce08e 100644 --- a/tests/lib/test_nexthop_iter.py +++ b/tests/lib/test_nexthop_iter.py @@ -1,7 +1,9 @@ import frrtest + class TestNexthopIter(frrtest.TestMultiOut): - program = './test_nexthop_iter' + program = "./test_nexthop_iter" + -TestNexthopIter.onesimple('Simple test passed.') -TestNexthopIter.onesimple('PRNG test passed.') +TestNexthopIter.onesimple("Simple test passed.") +TestNexthopIter.onesimple("PRNG test passed.") diff --git a/tests/lib/test_ntop.py b/tests/lib/test_ntop.py index 2526f53db5..69c4353620 100644 --- a/tests/lib/test_ntop.py +++ b/tests/lib/test_ntop.py @@ -1,6 +1,8 @@ import frrtest + class TestNtop(frrtest.TestMultiOut): - program = './test_ntop' + program = "./test_ntop" + TestNtop.exit_cleanly() diff --git a/tests/lib/test_prefix2str.py b/tests/lib/test_prefix2str.py index 6e26d1b409..fd883ed530 100644 --- a/tests/lib/test_prefix2str.py +++ b/tests/lib/test_prefix2str.py @@ -1,6 +1,8 @@ import frrtest + class TestPrefix2str(frrtest.TestMultiOut): - program = './test_prefix2str' + program = "./test_prefix2str" + TestPrefix2str.exit_cleanly() diff --git a/tests/lib/test_printfrr.py b/tests/lib/test_printfrr.py index 4fe238618e..b8ab89e337 100644 --- a/tests/lib/test_printfrr.py +++ b/tests/lib/test_printfrr.py @@ -1,6 +1,8 @@ import frrtest + class TestPrintfrr(frrtest.TestMultiOut): - program = './test_printfrr' + program = "./test_printfrr" + TestPrintfrr.exit_cleanly() diff --git a/tests/lib/test_ringbuf.py b/tests/lib/test_ringbuf.py index 5d994ddd7b..0cd9dee2b7 100644 --- a/tests/lib/test_ringbuf.py +++ b/tests/lib/test_ringbuf.py @@ -1,6 +1,8 @@ import frrtest + class TestRingbuf(frrtest.TestMultiOut): - program = './test_ringbuf' + program = "./test_ringbuf" + TestRingbuf.exit_cleanly() diff --git a/tests/lib/test_srcdest_table.c b/tests/lib/test_srcdest_table.c index dbfe853365..097da113ab 100644 --- a/tests/lib/test_srcdest_table.c +++ b/tests/lib/test_srcdest_table.c @@ -271,7 +271,7 @@ static void test_state_verify(struct test_state *test) associated with rn */ expected_lock++; - if (rn->lock != expected_lock) + if (route_node_get_lock_count(rn) != expected_lock) test_failed( test, "Dest rnode lock count doesn't match expected count!", @@ -283,7 +283,7 @@ static void test_state_verify(struct test_state *test) != NULL) /* The route node is not internal */ expected_lock++; - if (rn->lock != expected_lock) { + if (route_node_get_lock_count(rn) != expected_lock) { srcdest_rnode_prefixes( rn, (const struct prefix **)&dst_p, (const struct prefix **)&src_p); diff --git a/tests/lib/test_srcdest_table.py b/tests/lib/test_srcdest_table.py index ee73121025..d0dde6a8e5 100644 --- a/tests/lib/test_srcdest_table.py +++ b/tests/lib/test_srcdest_table.py @@ -1,6 +1,8 @@ import frrtest + class TestSrcdestTable(frrtest.TestMultiOut): - program = './test_srcdest_table' + program = "./test_srcdest_table" + -TestSrcdestTable.onesimple('PRNG Test successful.') +TestSrcdestTable.onesimple("PRNG Test successful.") diff --git a/tests/lib/test_stream.py b/tests/lib/test_stream.py index 6f42db1839..11d902eb95 100644 --- a/tests/lib/test_stream.py +++ b/tests/lib/test_stream.py @@ -1,4 +1,5 @@ import frrtest + class TestStream(frrtest.TestRefOut): - program = './test_stream' + program = "./test_stream" diff --git a/tests/lib/test_table.c b/tests/lib/test_table.c index 90d6c76bf1..290657bd56 100644 --- a/tests/lib/test_table.c +++ b/tests/lib/test_table.c @@ -104,7 +104,6 @@ static void add_nodes(struct route_table *table, ...) static void print_subtree(struct route_node *rn, const char *legend, int indent_level) { - char buf[PREFIX2STR_BUFFER]; int i; /* @@ -114,8 +113,7 @@ static void print_subtree(struct route_node *rn, const char *legend, printf(" "); } - prefix2str(&rn->p, buf, sizeof(buf)); - printf("%s: %s", legend, buf); + printf("%s: %pFX", legend, &rn->p); if (!rn->info) { printf(" (internal)"); } diff --git a/tests/lib/test_table.py b/tests/lib/test_table.py index e724421273..ee1849fd86 100644 --- a/tests/lib/test_table.py +++ b/tests/lib/test_table.py @@ -1,10 +1,12 @@ import frrtest + class TestTable(frrtest.TestMultiOut): - program = './test_table' + program = "./test_table" + for i in range(6): - TestTable.onesimple('Verifying cmp') + TestTable.onesimple("Verifying cmp") for i in range(11): - TestTable.onesimple('Verifying successor') -TestTable.onesimple('Verified pausing') + TestTable.onesimple("Verifying successor") +TestTable.onesimple("Verified pausing") diff --git a/tests/lib/test_timer_correctness.c b/tests/lib/test_timer_correctness.c index cbf9b05546..416ea39772 100644 --- a/tests/lib/test_timer_correctness.c +++ b/tests/lib/test_timer_correctness.c @@ -153,7 +153,7 @@ int main(int argc, char **argv) continue; XFREE(MTYPE_TMP, timers[index]->arg); - thread_cancel(timers[index]); + thread_cancel(&timers[index]); timers[index] = NULL; timers_pending--; } diff --git a/tests/lib/test_timer_correctness.py b/tests/lib/test_timer_correctness.py index 8b4a765a81..71f45f980c 100644 --- a/tests/lib/test_timer_correctness.py +++ b/tests/lib/test_timer_correctness.py @@ -1,6 +1,8 @@ import frrtest + class TestTimerCorrectness(frrtest.TestMultiOut): - program = './test_timer_correctness' + program = "./test_timer_correctness" + -TestTimerCorrectness.onesimple('Expected output and actual output match.') +TestTimerCorrectness.onesimple("Expected output and actual output match.") diff --git a/tests/lib/test_timer_performance.c b/tests/lib/test_timer_performance.c index 2960e0d81e..45b29b92b1 100644 --- a/tests/lib/test_timer_performance.c +++ b/tests/lib/test_timer_performance.c @@ -59,7 +59,7 @@ int main(int argc, char **argv) thread_add_timer_msec(master, dummy_func, NULL, 0, &timers[i]); } for (i = 0; i < SCHEDULE_TIMERS; i++) - thread_cancel(timers[i]); + thread_cancel(&timers[i]); monotime(&tv_start); @@ -78,8 +78,7 @@ int main(int argc, char **argv) int index; index = prng_rand(prng) % SCHEDULE_TIMERS; - if (timers[index]) - thread_cancel(timers[index]); + thread_cancel(&timers[index]); timers[index] = NULL; } diff --git a/tests/lib/test_ttable.py b/tests/lib/test_ttable.py index 1d93932ad2..9151181a72 100644 --- a/tests/lib/test_ttable.py +++ b/tests/lib/test_ttable.py @@ -1,4 +1,5 @@ import frrtest + class TestTTable(frrtest.TestRefOut): - program = './test_ttable' + program = "./test_ttable" diff --git a/tests/lib/test_typelist.py b/tests/lib/test_typelist.py index 0b3c743971..fe3499cad8 100644 --- a/tests/lib/test_typelist.py +++ b/tests/lib/test_typelist.py @@ -1,19 +1,21 @@ import frrtest + class TestTypelist(frrtest.TestMultiOut): - program = './test_typelist' + program = "./test_typelist" + -TestTypelist.onesimple('LIST end') -TestTypelist.onesimple('DLIST end') -TestTypelist.onesimple('ATOMLIST end') -TestTypelist.onesimple('HEAP end') -TestTypelist.onesimple('SORTLIST_UNIQ end') -TestTypelist.onesimple('SORTLIST_NONUNIQ end') -TestTypelist.onesimple('HASH end') -TestTypelist.onesimple('HASH_collisions end') -TestTypelist.onesimple('SKIPLIST_UNIQ end') -TestTypelist.onesimple('SKIPLIST_NONUNIQ end') -TestTypelist.onesimple('RBTREE_UNIQ end') -TestTypelist.onesimple('RBTREE_NONUNIQ end') -TestTypelist.onesimple('ATOMSORT_UNIQ end') -TestTypelist.onesimple('ATOMSORT_NONUNIQ end') +TestTypelist.onesimple("LIST end") +TestTypelist.onesimple("DLIST end") +TestTypelist.onesimple("ATOMLIST end") +TestTypelist.onesimple("HEAP end") +TestTypelist.onesimple("SORTLIST_UNIQ end") +TestTypelist.onesimple("SORTLIST_NONUNIQ end") +TestTypelist.onesimple("HASH end") +TestTypelist.onesimple("HASH_collisions end") +TestTypelist.onesimple("SKIPLIST_UNIQ end") +TestTypelist.onesimple("SKIPLIST_NONUNIQ end") +TestTypelist.onesimple("RBTREE_UNIQ end") +TestTypelist.onesimple("RBTREE_NONUNIQ end") +TestTypelist.onesimple("ATOMSORT_UNIQ end") +TestTypelist.onesimple("ATOMSORT_NONUNIQ end") diff --git a/tests/lib/test_versioncmp.py b/tests/lib/test_versioncmp.py index 0990757000..8ded53bd58 100644 --- a/tests/lib/test_versioncmp.py +++ b/tests/lib/test_versioncmp.py @@ -1,6 +1,8 @@ import frrtest + class TestVersionCmp(frrtest.TestMultiOut): - program = './test_versioncmp' + program = "./test_versioncmp" + TestVersionCmp.exit_cleanly() diff --git a/tests/lib/test_zlog.py b/tests/lib/test_zlog.py index 2ca2585886..2a2d54e204 100644 --- a/tests/lib/test_zlog.py +++ b/tests/lib/test_zlog.py @@ -1,4 +1,5 @@ import frrtest + class TestZlog(frrtest.TestMultiOut): - program = './test_zlog' + program = "./test_zlog" diff --git a/tests/lib/test_zmq.py b/tests/lib/test_zmq.py index 1f8ee54169..5f6189d919 100644 --- a/tests/lib/test_zmq.py +++ b/tests/lib/test_zmq.py @@ -2,10 +2,13 @@ import frrtest import pytest import os + class TestZMQ(frrtest.TestRefOut): - program = './test_zmq' + program = "./test_zmq" - @pytest.mark.skipif('S["ZEROMQ_TRUE"]=""\n' not in open('../config.status').readlines(), - reason='ZEROMQ not enabled') + @pytest.mark.skipif( + 'S["ZEROMQ_TRUE"]=""\n' not in open("../config.status").readlines(), + reason="ZEROMQ not enabled", + ) def test_refout(self): return super(TestZMQ, self).test_refout() diff --git a/tests/ospf6d/test_lsdb.c b/tests/ospf6d/test_lsdb.c index 24821febe6..c5bdcd3d13 100644 --- a/tests/ospf6d/test_lsdb.c +++ b/tests/ospf6d/test_lsdb.c @@ -134,9 +134,10 @@ DEFPY(lsdb_walk, lsdb_walk_cmd, "LSDB\n" "walk entries\n") { - struct ospf6_lsa *lsa; + struct ospf6_lsa *lsa, *lsanext; + unsigned cnt = 0; - for (ALL_LSDB(lsdb, lsa)) { + for (ALL_LSDB(lsdb, lsa, lsanext)) { lsa_show_oneline(vty, lsa); cnt++; } diff --git a/tests/ospf6d/test_lsdb.py b/tests/ospf6d/test_lsdb.py index 6a94395113..6ada617657 100644 --- a/tests/ospf6d/test_lsdb.py +++ b/tests/ospf6d/test_lsdb.py @@ -1,4 +1,5 @@ import frrtest + class TestLSDB(frrtest.TestRefOut): - program = './test_lsdb' + program = "./test_lsdb" diff --git a/tests/runtests.py b/tests/runtests.py index 533dc6b167..4677796152 100644 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -2,5 +2,5 @@ import pytest import sys import os -sys.path.append(os.path.join(os.path.dirname(__file__), 'helpers','python')) +sys.path.append(os.path.join(os.path.dirname(__file__), "helpers", "python")) raise SystemExit(pytest.main(sys.argv[1:])) diff --git a/tests/subdir.am b/tests/subdir.am index d7318efc72..211814c1c3 100644 --- a/tests/subdir.am +++ b/tests/subdir.am @@ -168,6 +168,19 @@ tests_bgpd_test_peer_attr_CFLAGS = $(TESTS_CFLAGS) tests_bgpd_test_peer_attr_CPPFLAGS = $(TESTS_CPPFLAGS) tests_bgpd_test_peer_attr_LDADD = $(BGP_TEST_LDADD) tests_bgpd_test_peer_attr_SOURCES = tests/bgpd/test_peer_attr.c +nodist_tests_bgpd_test_peer_attr_SOURCES = \ + yang/frr-bgp-types.yang.c \ + yang/frr-bgp.yang.c \ + yang/frr-bgp-common-structure.yang.c \ + yang/frr-bgp-common.yang.c \ + yang/frr-bgp-common-multiprotocol.yang.c \ + yang/frr-bgp-neighbor.yang.c \ + yang/frr-bgp-peer-group.yang.c \ + yang/frr-bgp-bmp.yang.c \ + yang/frr-bgp-rpki.yang.c \ + yang/frr-deviations-bgp-datacenter.yang.c \ + # end + tests_isisd_test_fuzz_isis_tlv_CFLAGS = $(TESTS_CFLAGS) -I$(top_builddir)/tests/isisd tests_isisd_test_fuzz_isis_tlv_CPPFLAGS = $(TESTS_CPPFLAGS) -I$(top_builddir)/tests/isisd diff --git a/tests/topotests/all-protocol-startup/test_all_protocol_startup.py b/tests/topotests/all-protocol-startup/test_all_protocol_startup.py index 4b57928366..0254ff6af6 100644 --- a/tests/topotests/all-protocol-startup/test_all_protocol_startup.py +++ b/tests/topotests/all-protocol-startup/test_all_protocol_startup.py @@ -55,6 +55,7 @@ fatal_error = "" ## ##################################################### + class NetworkTopo(Topo): "All Protocol Startup Test" @@ -64,15 +65,15 @@ class NetworkTopo(Topo): router = {} # # Setup Main Router - router[1] = topotest.addRouter(self, 'r1') + router[1] = topotest.addRouter(self, "r1") # # Setup Switches switch = {} # for i in range(0, 10): - switch[i] = self.addSwitch('sw%s' % i, cls=topotest.LegacySwitch) - self.addLink(switch[i], router[1], intfName2='r1-eth%s' % i ) + switch[i] = self.addSwitch("sw%s" % i, cls=topotest.LegacySwitch) + self.addLink(switch[i], router[1], intfName2="r1-eth%s" % i) ##################################################### @@ -81,6 +82,7 @@ class NetworkTopo(Topo): ## ##################################################### + def setup_module(module): global topo, net global fatal_error @@ -89,8 +91,8 @@ def setup_module(module): print("******************************************\n") print("Cleanup old Mininet runs") - os.system('sudo mn -c > /dev/null 2>&1') - os.system('sudo rm /tmp/r* > /dev/null 2>&1') + os.system("sudo mn -c > /dev/null 2>&1") + os.system("sudo rm /tmp/r* > /dev/null 2>&1") thisDir = os.path.dirname(os.path.realpath(__file__)) topo = NetworkTopo() @@ -98,33 +100,35 @@ def setup_module(module): net = Mininet(controller=None, topo=topo) net.start() - if net['r1'].get_routertype() != 'frr': + if net["r1"].get_routertype() != "frr": fatal_error = "Test is only implemented for FRR" - sys.stderr.write('\n\nTest is only implemented for FRR - Skipping\n\n') + sys.stderr.write("\n\nTest is only implemented for FRR - Skipping\n\n") pytest.skip(fatal_error) - + # Starting Routers # # Main router for i in range(1, 2): - net['r%s' % i].loadConf('zebra', '%s/r%s/zebra.conf' % (thisDir, i)) - net['r%s' % i].loadConf('ripd', '%s/r%s/ripd.conf' % (thisDir, i)) - net['r%s' % i].loadConf('ripngd', '%s/r%s/ripngd.conf' % (thisDir, i)) - net['r%s' % i].loadConf('ospfd', '%s/r%s/ospfd.conf' % (thisDir, i)) - if net['r1'].checkRouterVersion('<', '4.0'): - net['r%s' % i].loadConf('ospf6d', '%s/r%s/ospf6d.conf-pre-v4' % (thisDir, i)) + net["r%s" % i].loadConf("zebra", "%s/r%s/zebra.conf" % (thisDir, i)) + net["r%s" % i].loadConf("ripd", "%s/r%s/ripd.conf" % (thisDir, i)) + net["r%s" % i].loadConf("ripngd", "%s/r%s/ripngd.conf" % (thisDir, i)) + net["r%s" % i].loadConf("ospfd", "%s/r%s/ospfd.conf" % (thisDir, i)) + if net["r1"].checkRouterVersion("<", "4.0"): + net["r%s" % i].loadConf( + "ospf6d", "%s/r%s/ospf6d.conf-pre-v4" % (thisDir, i) + ) else: - net['r%s' % i].loadConf('ospf6d', '%s/r%s/ospf6d.conf' % (thisDir, i)) - net['r%s' % i].loadConf('isisd', '%s/r%s/isisd.conf' % (thisDir, i)) - net['r%s' % i].loadConf('bgpd', '%s/r%s/bgpd.conf' % (thisDir, i)) - if net['r%s' % i].daemon_available('ldpd'): + net["r%s" % i].loadConf("ospf6d", "%s/r%s/ospf6d.conf" % (thisDir, i)) + net["r%s" % i].loadConf("isisd", "%s/r%s/isisd.conf" % (thisDir, i)) + net["r%s" % i].loadConf("bgpd", "%s/r%s/bgpd.conf" % (thisDir, i)) + if net["r%s" % i].daemon_available("ldpd"): # Only test LDPd if it's installed and Kernel >= 4.5 - net['r%s' % i].loadConf('ldpd', '%s/r%s/ldpd.conf' % (thisDir, i)) - net['r%s' % i].loadConf('sharpd') - net['r%s' % i].loadConf('nhrpd', '%s/r%s/nhrpd.conf' % (thisDir, i)) - net['r%s' % i].loadConf('babeld', '%s/r%s/babeld.conf' % (thisDir, i)) - net['r%s' % i].loadConf('pbrd', '%s/r%s/pbrd.conf' % (thisDir, i)) - net['r%s' % i].startRouter() + net["r%s" % i].loadConf("ldpd", "%s/r%s/ldpd.conf" % (thisDir, i)) + net["r%s" % i].loadConf("sharpd") + net["r%s" % i].loadConf("nhrpd", "%s/r%s/nhrpd.conf" % (thisDir, i)) + net["r%s" % i].loadConf("babeld", "%s/r%s/babeld.conf" % (thisDir, i)) + net["r%s" % i].loadConf("pbrd", "%s/r%s/pbrd.conf" % (thisDir, i)) + net["r%s" % i].startRouter() # For debugging after starting FRR daemons, uncomment the next line # CLI(net) @@ -145,7 +149,7 @@ def test_router_running(): global net # Skip if previous fatal error condition is raised - if (fatal_error != ""): + if fatal_error != "": pytest.skip(fatal_error) print("\n\n** Check if FRR is running on each Router node") @@ -154,7 +158,7 @@ def test_router_running(): # Starting Routers for i in range(1, 2): - fatal_error = net['r%s' % i].checkRouterRunning() + fatal_error = net["r%s" % i].checkRouterRunning() assert fatal_error == "", fatal_error # For debugging after starting FRR daemons, uncomment the next line @@ -166,7 +170,7 @@ def test_error_messages_vtysh(): global net # Skip if previous fatal error condition is raised - if (fatal_error != ""): + if fatal_error != "": pytest.skip(fatal_error) print("\n\n** Check for error messages on VTYSH") @@ -179,38 +183,38 @@ def test_error_messages_vtysh(): # # VTYSH output from router - vtystdout = net['r%s' % i].cmd('vtysh -c "show version" 2> /dev/null').rstrip() + vtystdout = net["r%s" % i].cmd('vtysh -c "show version" 2> /dev/null').rstrip() # Fix newlines (make them all the same) - vtystdout = ('\n'.join(vtystdout.splitlines()) + '\n').rstrip() + vtystdout = ("\n".join(vtystdout.splitlines()) + "\n").rstrip() # Drop everything starting with "FRRouting X.xx" message vtystdout = re.sub(r"FRRouting [0-9]+.*", "", vtystdout, flags=re.DOTALL) - if (vtystdout == ''): + if vtystdout == "": print("r%s StdOut ok" % i) - assert vtystdout == '', "Vtysh StdOut Output check failed for router r%s" % i + assert vtystdout == "", "Vtysh StdOut Output check failed for router r%s" % i # # Second checking Standard Error # # VTYSH StdErr output from router - vtystderr = net['r%s' % i].cmd('vtysh -c "show version" > /dev/null').rstrip() + vtystderr = net["r%s" % i].cmd('vtysh -c "show version" > /dev/null').rstrip() # Fix newlines (make them all the same) - vtystderr = ('\n'.join(vtystderr.splitlines()) + '\n').rstrip() + vtystderr = ("\n".join(vtystderr.splitlines()) + "\n").rstrip() # # Drop everything starting with "FRRouting X.xx" message - # vtystderr = re.sub(r"FRRouting [0-9]+.*", "", vtystderr, flags=re.DOTALL) + # vtystderr = re.sub(r"FRRouting [0-9]+.*", "", vtystderr, flags=re.DOTALL) - if (vtystderr == ''): + if vtystderr == "": print("r%s StdErr ok" % i) - assert vtystderr == '', "Vtysh StdErr Output check failed for router r%s" % i + assert vtystderr == "", "Vtysh StdErr Output check failed for router r%s" % i # Make sure that all daemons are running for i in range(1, 2): - fatal_error = net['r%s' % i].checkRouterRunning() + fatal_error = net["r%s" % i].checkRouterRunning() assert fatal_error == "", fatal_error # For debugging after starting FRR daemons, uncomment the next line @@ -222,7 +226,7 @@ def test_error_messages_daemons(): global net # Skip if previous fatal error condition is raised - if (fatal_error != ""): + if fatal_error != "": pytest.skip(fatal_error) print("\n\n** Check for error messages in daemons") @@ -231,67 +235,73 @@ def test_error_messages_daemons(): error_logs = "" for i in range(1, 2): - log = net['r%s' % i].getStdErr('ripd') + log = net["r%s" % i].getStdErr("ripd") if log: error_logs += "r%s RIPd StdErr Output:\n" % i error_logs += log - log = net['r%s' % i].getStdErr('ripngd') + log = net["r%s" % i].getStdErr("ripngd") if log: error_logs += "r%s RIPngd StdErr Output:\n" % i error_logs += log - log = net['r%s' % i].getStdErr('ospfd') + log = net["r%s" % i].getStdErr("ospfd") if log: error_logs += "r%s OSPFd StdErr Output:\n" % i error_logs += log - log = net['r%s' % i].getStdErr('ospf6d') + log = net["r%s" % i].getStdErr("ospf6d") if log: error_logs += "r%s OSPF6d StdErr Output:\n" % i error_logs += log - log = net['r%s' % i].getStdErr('isisd') + log = net["r%s" % i].getStdErr("isisd") # ISIS shows debugging enabled status on StdErr # Remove these messages log = re.sub(r"^IS-IS .* debugging is on.*", "", log).rstrip() if log: error_logs += "r%s ISISd StdErr Output:\n" % i error_logs += log - log = net['r%s' % i].getStdErr('bgpd') + log = net["r%s" % i].getStdErr("bgpd") if log: error_logs += "r%s BGPd StdErr Output:\n" % i error_logs += log - if (net['r%s' % i].daemon_available('ldpd')): - log = net['r%s' % i].getStdErr('ldpd') + if net["r%s" % i].daemon_available("ldpd"): + log = net["r%s" % i].getStdErr("ldpd") if log: error_logs += "r%s LDPd StdErr Output:\n" % i error_logs += log - log = net['r1'].getStdErr('nhrpd') + log = net["r1"].getStdErr("nhrpd") if log: error_logs += "r%s NHRPd StdErr Output:\n" % i error_logs += log - log = net['r1'].getStdErr('babeld') + log = net["r1"].getStdErr("babeld") if log: error_logs += "r%s BABELd StdErr Output:\n" % i error_logs += log - log = net['r1'].getStdErr('pbrd') + log = net["r1"].getStdErr("pbrd") if log: error_logs += "r%s PBRd StdErr Output:\n" % i error_logs += log - log = net['r%s' % i].getStdErr('zebra') + log = net["r%s" % i].getStdErr("zebra") if log: error_logs += "r%s Zebra StdErr Output:\n" error_logs += log if error_logs: - sys.stderr.write('Failed check for StdErr Output on daemons:\n%s\n' % error_logs) + sys.stderr.write( + "Failed check for StdErr Output on daemons:\n%s\n" % error_logs + ) # Ignoring the issue if told to ignore (ie not yet fixed) - if (error_logs != ""): - if (os.environ.get('bamboo_TOPOTESTS_ISSUE_349') == "IGNORE"): - sys.stderr.write('Known issue - IGNORING. See https://github.com/FRRouting/frr/issues/349\n') - pytest.skip('Known issue - IGNORING. See https://github.com/FRRouting/frr/issues/349') + if error_logs != "": + if os.environ.get("bamboo_TOPOTESTS_ISSUE_349") == "IGNORE": + sys.stderr.write( + "Known issue - IGNORING. See https://github.com/FRRouting/frr/issues/349\n" + ) + pytest.skip( + "Known issue - IGNORING. See https://github.com/FRRouting/frr/issues/349" + ) assert error_logs == "", "Daemons report errors to StdErr" @@ -304,7 +314,7 @@ def test_converge_protocols(): global net # Skip if previous fatal error condition is raised - if (fatal_error != ""): + if fatal_error != "": pytest.skip(fatal_error) thisDir = os.path.dirname(os.path.realpath(__file__)) @@ -318,62 +328,84 @@ def test_converge_protocols(): # Make sure that all daemons are running failures = 0 for i in range(1, 2): - fatal_error = net['r%s' % i].checkRouterRunning() + fatal_error = net["r%s" % i].checkRouterRunning() assert fatal_error == "", fatal_error - print("Show that v4 routes are right\n"); - v4_routesFile = '%s/r%s/ipv4_routes.ref' % (thisDir, i) + print("Show that v4 routes are right\n") + v4_routesFile = "%s/r%s/ipv4_routes.ref" % (thisDir, i) expected = open(v4_routesFile).read().rstrip() - expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1) - - actual = net['r%s' %i].cmd('vtysh -c "show ip route" | /usr/bin/tail -n +7 | env LC_ALL=en_US.UTF-8 sort 2> /dev/null').rstrip() + expected = ("\n".join(expected.splitlines()) + "\n").splitlines(1) + + actual = ( + net["r%s" % i] + .cmd( + 'vtysh -c "show ip route" | /usr/bin/tail -n +7 | env LC_ALL=en_US.UTF-8 sort 2> /dev/null' + ) + .rstrip() + ) # Drop time in last update actual = re.sub(r" [0-2][0-9]:[0-5][0-9]:[0-5][0-9]", " XX:XX:XX", actual) - actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1) - diff = topotest.get_textdiff(actual, expected, - title1="Actual IP Routing Table", - title2="Expected IP RoutingTable") + actual = ("\n".join(actual.splitlines()) + "\n").splitlines(1) + diff = topotest.get_textdiff( + actual, + expected, + title1="Actual IP Routing Table", + title2="Expected IP RoutingTable", + ) if diff: - sys.stderr.write('r%s failed IP Routing table check:\n%s\n' % (i, diff)) + sys.stderr.write("r%s failed IP Routing table check:\n%s\n" % (i, diff)) failures += 1 else: - print("r%s ok" %i) + print("r%s ok" % i) assert failures == 0, "IP Routing table failed for r%s\n%s" % (i, diff) failures = 0 print("Show that v6 routes are right\n") - v6_routesFile = '%s/r%s/ipv6_routes.ref' % (thisDir, i) + v6_routesFile = "%s/r%s/ipv6_routes.ref" % (thisDir, i) expected = open(v6_routesFile).read().rstrip() - expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1) - - actual = net['r%s' %i].cmd('vtysh -c "show ipv6 route" | /usr/bin/tail -n +7 | env LC_ALL=en_US.UTF-8 sort 2> /dev/null').rstrip() + expected = ("\n".join(expected.splitlines()) + "\n").splitlines(1) + + actual = ( + net["r%s" % i] + .cmd( + 'vtysh -c "show ipv6 route" | /usr/bin/tail -n +7 | env LC_ALL=en_US.UTF-8 sort 2> /dev/null' + ) + .rstrip() + ) # Drop time in last update actual = re.sub(r" [0-2][0-9]:[0-5][0-9]:[0-5][0-9]", " XX:XX:XX", actual) - actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1) - diff = topotest.get_textdiff(actual, expected, - title1="Actual IPv6 Routing Table", - title2="Expected IPv6 RoutingTable") + actual = ("\n".join(actual.splitlines()) + "\n").splitlines(1) + diff = topotest.get_textdiff( + actual, + expected, + title1="Actual IPv6 Routing Table", + title2="Expected IPv6 RoutingTable", + ) if diff: - sys.stderr.write('r%s failed IPv6 Routing table check:\n%s\n' % (i, diff)) + sys.stderr.write("r%s failed IPv6 Routing table check:\n%s\n" % (i, diff)) failures += 1 else: - print("r%s ok" %i) + print("r%s ok" % i) assert failures == 0, "IPv6 Routing table failed for r%s\n%s" % (i, diff) # For debugging after starting FRR daemons, uncomment the next line ## CLI(net) + def route_get_nhg_id(route_str): output = net["r1"].cmd('vtysh -c "show ip route %s nexthop-group"' % route_str) match = re.search(r"Nexthop Group ID: (\d+)", output) - assert match is not None, "Nexthop Group ID not found for sharpd route %s" % route_str + assert match is not None, ( + "Nexthop Group ID not found for sharpd route %s" % route_str + ) nhg_id = int(match.group(1)) return nhg_id + def verify_nexthop_group(nhg_id, recursive=False, ecmp=0): # Verify NHG is valid/installed output = net["r1"].cmd('vtysh -c "show nexthop-group rib %d"' % nhg_id) @@ -389,10 +421,14 @@ def verify_nexthop_group(nhg_id, recursive=False, ecmp=0): depends = re.findall(r"\((\d+)\)", match.group(0)) if ecmp: - assert (len(depends) == ecmp), "Nexthop Group ID=%d doesn't match ecmp size" % nhg_id + assert len(depends) == ecmp, ( + "Nexthop Group ID=%d doesn't match ecmp size" % nhg_id + ) else: # If recursive, we need to look at its resolved group - assert (len(depends) == 1), "Nexthop Group ID=%d should only have one recursive depend" % nhg_id + assert len(depends) == 1, ( + "Nexthop Group ID=%d should only have one recursive depend" % nhg_id + ) resolved_id = int(depends[0]) verify_nexthop_group(resolved_id, False) @@ -400,17 +436,19 @@ def verify_nexthop_group(nhg_id, recursive=False, ecmp=0): match = re.search(r"Installed", output) assert match is not None, "Nexthop Group ID=%d not marked Installed" % nhg_id + def verify_route_nexthop_group(route_str, recursive=False, ecmp=0): # Verify route and that zebra created NHGs for and they are valid/installed nhg_id = route_get_nhg_id(route_str) verify_nexthop_group(nhg_id, recursive, ecmp) + def test_nexthop_groups(): global fatal_error global net # Skip if previous fatal error condition is raised - if (fatal_error != ""): + if fatal_error != "": pytest.skip(fatal_error) print("\n\n** Verifying Nexthop Groups") @@ -421,7 +459,9 @@ def test_nexthop_groups(): ## Basic test # Create a lib nexthop-group - net["r1"].cmd('vtysh -c "c t" -c "nexthop-group basic" -c "nexthop 1.1.1.1" -c "nexthop 1.1.1.2"') + net["r1"].cmd( + 'vtysh -c "c t" -c "nexthop-group basic" -c "nexthop 1.1.1.1" -c "nexthop 1.1.1.2"' + ) # Create with sharpd using nexthop-group net["r1"].cmd('vtysh -c "sharp install routes 2.2.2.1 nexthop-group basic 1"') @@ -430,7 +470,9 @@ def test_nexthop_groups(): ## Connected - net["r1"].cmd('vtysh -c "c t" -c "nexthop-group connected" -c "nexthop r1-eth1" -c "nexthop r1-eth2"') + net["r1"].cmd( + 'vtysh -c "c t" -c "nexthop-group connected" -c "nexthop r1-eth1" -c "nexthop r1-eth2"' + ) net["r1"].cmd('vtysh -c "sharp install routes 2.2.2.2 nexthop-group connected 1"') @@ -438,15 +480,21 @@ def test_nexthop_groups(): ## Recursive - net["r1"].cmd('vtysh -c "c t" -c "nexthop-group basic-recursive" -c "nexthop 2.2.2.1"') + net["r1"].cmd( + 'vtysh -c "c t" -c "nexthop-group basic-recursive" -c "nexthop 2.2.2.1"' + ) - net["r1"].cmd('vtysh -c "sharp install routes 3.3.3.1 nexthop-group basic-recursive 1"') + net["r1"].cmd( + 'vtysh -c "sharp install routes 3.3.3.1 nexthop-group basic-recursive 1"' + ) verify_route_nexthop_group("3.3.3.1/32", True) ## Duplicate - net["r1"].cmd('vtysh -c "c t" -c "nexthop-group duplicate" -c "nexthop 2.2.2.1" -c "nexthop 1.1.1.1"') + net["r1"].cmd( + 'vtysh -c "c t" -c "nexthop-group duplicate" -c "nexthop 2.2.2.1" -c "nexthop 1.1.1.1"' + ) net["r1"].cmd('vtysh -c "sharp install routes 3.3.3.2 nexthop-group duplicate 1"') @@ -454,15 +502,19 @@ def test_nexthop_groups(): ## Two 4-Way ECMP - net["r1"].cmd('vtysh -c "c t" -c "nexthop-group fourA" -c "nexthop 1.1.1.1" -c "nexthop 1.1.1.2" \ - -c "nexthop 1.1.1.3" -c "nexthop 1.1.1.4"') + net["r1"].cmd( + 'vtysh -c "c t" -c "nexthop-group fourA" -c "nexthop 1.1.1.1" -c "nexthop 1.1.1.2" \ + -c "nexthop 1.1.1.3" -c "nexthop 1.1.1.4"' + ) net["r1"].cmd('vtysh -c "sharp install routes 4.4.4.1 nexthop-group fourA 1"') verify_route_nexthop_group("4.4.4.1/32") - net["r1"].cmd('vtysh -c "c t" -c "nexthop-group fourB" -c "nexthop 1.1.1.5" -c "nexthop 1.1.1.6" \ - -c "nexthop 1.1.1.7" -c "nexthop 1.1.1.8"') + net["r1"].cmd( + 'vtysh -c "c t" -c "nexthop-group fourB" -c "nexthop 1.1.1.5" -c "nexthop 1.1.1.6" \ + -c "nexthop 1.1.1.7" -c "nexthop 1.1.1.8"' + ) net["r1"].cmd('vtysh -c "sharp install routes 4.4.4.2 nexthop-group fourB 1"') @@ -470,9 +522,13 @@ def test_nexthop_groups(): ## Recursive to 8-Way ECMP - net["r1"].cmd('vtysh -c "c t" -c "nexthop-group eight-recursive" -c "nexthop 4.4.4.1" -c "nexthop 4.4.4.2"') + net["r1"].cmd( + 'vtysh -c "c t" -c "nexthop-group eight-recursive" -c "nexthop 4.4.4.1" -c "nexthop 4.4.4.2"' + ) - net["r1"].cmd('vtysh -c "sharp install routes 5.5.5.1 nexthop-group eight-recursive 1"') + net["r1"].cmd( + 'vtysh -c "sharp install routes 5.5.5.1 nexthop-group eight-recursive 1"' + ) verify_route_nexthop_group("5.5.5.1/32") @@ -488,12 +544,13 @@ def test_nexthop_groups(): net["r1"].cmd('vtysh -c "sharp remove routes 4.4.4.2 1"') net["r1"].cmd('vtysh -c "sharp remove routes 5.5.5.1 1"') + def test_rip_status(): global fatal_error global net # Skip if previous fatal error condition is raised - if (fatal_error != ""): + if fatal_error != "": pytest.skip(fatal_error) thisDir = os.path.dirname(os.path.realpath(__file__)) @@ -502,30 +559,37 @@ def test_rip_status(): print("******************************************\n") failures = 0 for i in range(1, 2): - refTableFile = '%s/r%s/rip_status.ref' % (thisDir, i) + refTableFile = "%s/r%s/rip_status.ref" % (thisDir, i) if os.path.isfile(refTableFile): # Read expected result from file expected = open(refTableFile).read().rstrip() # Fix newlines (make them all the same) - expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1) + expected = ("\n".join(expected.splitlines()) + "\n").splitlines(1) # Actual output from router - actual = net['r%s' % i].cmd('vtysh -c "show ip rip status" 2> /dev/null').rstrip() - # Drop time in next due + actual = ( + net["r%s" % i] + .cmd('vtysh -c "show ip rip status" 2> /dev/null') + .rstrip() + ) + # Drop time in next due actual = re.sub(r"in [0-9]+ seconds", "in XX seconds", actual) # Drop time in last update actual = re.sub(r" [0-2][0-9]:[0-5][0-9]:[0-5][0-9]", " XX:XX:XX", actual) # Fix newlines (make them all the same) - actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1) + actual = ("\n".join(actual.splitlines()) + "\n").splitlines(1) # Generate Diff - diff = topotest.get_textdiff(actual, expected, + diff = topotest.get_textdiff( + actual, + expected, title1="actual IP RIP status", - title2="expected IP RIP status") + title2="expected IP RIP status", + ) # Empty string if it matches, otherwise diff contains unified diff if diff: - sys.stderr.write('r%s failed IP RIP status check:\n%s\n' % (i, diff)) + sys.stderr.write("r%s failed IP RIP status check:\n%s\n" % (i, diff)) failures += 1 else: print("r%s ok" % i) @@ -534,7 +598,7 @@ def test_rip_status(): # Make sure that all daemons are running for i in range(1, 2): - fatal_error = net['r%s' % i].checkRouterRunning() + fatal_error = net["r%s" % i].checkRouterRunning() assert fatal_error == "", fatal_error # For debugging after starting FRR daemons, uncomment the next line @@ -546,7 +610,7 @@ def test_ripng_status(): global net # Skip if previous fatal error condition is raised - if (fatal_error != ""): + if fatal_error != "": pytest.skip(fatal_error) thisDir = os.path.dirname(os.path.realpath(__file__)) @@ -555,41 +619,53 @@ def test_ripng_status(): print("******************************************\n") failures = 0 for i in range(1, 2): - refTableFile = '%s/r%s/ripng_status.ref' % (thisDir, i) + refTableFile = "%s/r%s/ripng_status.ref" % (thisDir, i) if os.path.isfile(refTableFile): # Read expected result from file expected = open(refTableFile).read().rstrip() # Fix newlines (make them all the same) - expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1) + expected = ("\n".join(expected.splitlines()) + "\n").splitlines(1) # Actual output from router - actual = net['r%s' % i].cmd('vtysh -c "show ipv6 ripng status" 2> /dev/null').rstrip() + actual = ( + net["r%s" % i] + .cmd('vtysh -c "show ipv6 ripng status" 2> /dev/null') + .rstrip() + ) # Mask out Link-Local mac address portion. They are random... actual = re.sub(r" fe80::[0-9a-f:]+", " fe80::XXXX:XXXX:XXXX:XXXX", actual) - # Drop time in next due + # Drop time in next due actual = re.sub(r"in [0-9]+ seconds", "in XX seconds", actual) # Drop time in last update actual = re.sub(r" [0-2][0-9]:[0-5][0-9]:[0-5][0-9]", " XX:XX:XX", actual) # Fix newlines (make them all the same) - actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1) + actual = ("\n".join(actual.splitlines()) + "\n").splitlines(1) # Generate Diff - diff = topotest.get_textdiff(actual, expected, + diff = topotest.get_textdiff( + actual, + expected, title1="actual IPv6 RIPng status", - title2="expected IPv6 RIPng status") + title2="expected IPv6 RIPng status", + ) # Empty string if it matches, otherwise diff contains unified diff if diff: - sys.stderr.write('r%s failed IPv6 RIPng status check:\n%s\n' % (i, diff)) + sys.stderr.write( + "r%s failed IPv6 RIPng status check:\n%s\n" % (i, diff) + ) failures += 1 else: print("r%s ok" % i) - assert failures == 0, "IPv6 RIPng status failed for router r%s:\n%s" % (i, diff) + assert failures == 0, "IPv6 RIPng status failed for router r%s:\n%s" % ( + i, + diff, + ) # Make sure that all daemons are running for i in range(1, 2): - fatal_error = net['r%s' % i].checkRouterRunning() + fatal_error = net["r%s" % i].checkRouterRunning() assert fatal_error == "", fatal_error # For debugging after starting FRR daemons, uncomment the next line @@ -601,7 +677,7 @@ def test_ospfv2_interfaces(): global net # Skip if previous fatal error condition is raised - if (fatal_error != ""): + if fatal_error != "": pytest.skip(fatal_error) thisDir = os.path.dirname(os.path.realpath(__file__)) @@ -610,50 +686,71 @@ def test_ospfv2_interfaces(): print("******************************************\n") failures = 0 for i in range(1, 2): - refTableFile = '%s/r%s/show_ip_ospf_interface.ref' % (thisDir, i) + refTableFile = "%s/r%s/show_ip_ospf_interface.ref" % (thisDir, i) if os.path.isfile(refTableFile): # Read expected result from file expected = open(refTableFile).read().rstrip() # Fix newlines (make them all the same) - expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1) + expected = ("\n".join(expected.splitlines()) + "\n").splitlines(1) # Actual output from router - actual = net['r%s' % i].cmd('vtysh -c "show ip ospf interface" 2> /dev/null').rstrip() + actual = ( + net["r%s" % i] + .cmd('vtysh -c "show ip ospf interface" 2> /dev/null') + .rstrip() + ) # Mask out Bandwidth portion. They may change.. actual = re.sub(r"BW [0-9]+ Mbit", "BW XX Mbit", actual) actual = re.sub(r"ifindex [0-9]", "ifindex X", actual) - # Drop time in next due + # Drop time in next due actual = re.sub(r"Hello due in [0-9\.]+s", "Hello due in XX.XXXs", actual) - actual = re.sub(r"Hello due in [0-9\.]+ usecs", "Hello due in XX.XXXs", actual) + actual = re.sub( + r"Hello due in [0-9\.]+ usecs", "Hello due in XX.XXXs", actual + ) # Fix 'MTU mismatch detection: enabled' vs 'MTU mismatch detection:enabled' - accept both - actual = re.sub(r"MTU mismatch detection:([a-z]+.*)", r"MTU mismatch detection: \1", actual) + actual = re.sub( + r"MTU mismatch detection:([a-z]+.*)", + r"MTU mismatch detection: \1", + actual, + ) # Fix newlines (make them all the same) - actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1) + actual = ("\n".join(actual.splitlines()) + "\n").splitlines(1) # Generate Diff - diff = topotest.get_textdiff(actual, expected, + diff = topotest.get_textdiff( + actual, + expected, title1="actual SHOW IP OSPF INTERFACE", - title2="expected SHOW IP OSPF INTERFACE") + title2="expected SHOW IP OSPF INTERFACE", + ) # Empty string if it matches, otherwise diff contains unified diff if diff: - sys.stderr.write('r%s failed SHOW IP OSPF INTERFACE check:\n%s\n' % (i, diff)) + sys.stderr.write( + "r%s failed SHOW IP OSPF INTERFACE check:\n%s\n" % (i, diff) + ) failures += 1 else: print("r%s ok" % i) # Ignoring the issue if told to ignore (ie not yet fixed) - if (failures != 0): - if (os.environ.get('bamboo_TOPOTESTS_ISSUE_348') == "IGNORE"): - sys.stderr.write('Known issue - IGNORING. See https://github.com/FRRouting/frr/issues/348\n') - pytest.skip('Known issue - IGNORING. See https://github.com/FRRouting/frr/issues/348') - - assert failures == 0, "SHOW IP OSPF INTERFACE failed for router r%s:\n%s" % (i, diff) + if failures != 0: + if os.environ.get("bamboo_TOPOTESTS_ISSUE_348") == "IGNORE": + sys.stderr.write( + "Known issue - IGNORING. See https://github.com/FRRouting/frr/issues/348\n" + ) + pytest.skip( + "Known issue - IGNORING. See https://github.com/FRRouting/frr/issues/348" + ) + + assert ( + failures == 0 + ), "SHOW IP OSPF INTERFACE failed for router r%s:\n%s" % (i, diff) # Make sure that all daemons are running for i in range(1, 2): - fatal_error = net['r%s' % i].checkRouterRunning() + fatal_error = net["r%s" % i].checkRouterRunning() assert fatal_error == "", fatal_error # For debugging after starting FRR daemons, uncomment the next line @@ -665,7 +762,7 @@ def test_isis_interfaces(): global net # Skip if previous fatal error condition is raised - if (fatal_error != ""): + if fatal_error != "": pytest.skip(fatal_error) thisDir = os.path.dirname(os.path.realpath(__file__)) @@ -674,42 +771,52 @@ def test_isis_interfaces(): print("******************************************\n") failures = 0 for i in range(1, 2): - refTableFile = '%s/r%s/show_isis_interface_detail.ref' % (thisDir, i) + refTableFile = "%s/r%s/show_isis_interface_detail.ref" % (thisDir, i) if os.path.isfile(refTableFile): # Read expected result from file expected = open(refTableFile).read().rstrip() # Fix newlines (make them all the same) - expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1) + expected = ("\n".join(expected.splitlines()) + "\n").splitlines(1) # Actual output from router - actual = net['r%s' % i].cmd('vtysh -c "show isis interface detail" 2> /dev/null').rstrip() + actual = ( + net["r%s" % i] + .cmd('vtysh -c "show isis interface detail" 2> /dev/null') + .rstrip() + ) # Mask out Link-Local mac address portion. They are random... actual = re.sub(r"fe80::[0-9a-f:]+", "fe80::XXXX:XXXX:XXXX:XXXX", actual) # Mask out SNPA mac address portion. They are random... actual = re.sub(r"SNPA: [0-9a-f\.]+", "SNPA: XXXX.XXXX.XXXX", actual) # Mask out Circuit ID number - actual = re.sub(r"Circuit Id: 0x[0-9a-f]+", "Circuit Id: 0xXX", - actual) + actual = re.sub(r"Circuit Id: 0x[0-9a-f]+", "Circuit Id: 0xXX", actual) # Fix newlines (make them all the same) - actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1) + actual = ("\n".join(actual.splitlines()) + "\n").splitlines(1) # Generate Diff - diff = topotest.get_textdiff(actual, expected, + diff = topotest.get_textdiff( + actual, + expected, title1="actual SHOW ISIS INTERFACE DETAIL", - title2="expected SHOW ISIS OSPF6 INTERFACE DETAIL") + title2="expected SHOW ISIS OSPF6 INTERFACE DETAIL", + ) # Empty string if it matches, otherwise diff contains unified diff if diff: - sys.stderr.write('r%s failed SHOW ISIS INTERFACE DETAIL check:\n%s\n' % (i, diff)) + sys.stderr.write( + "r%s failed SHOW ISIS INTERFACE DETAIL check:\n%s\n" % (i, diff) + ) failures += 1 else: print("r%s ok" % i) - assert failures == 0, "SHOW ISIS INTERFACE DETAIL failed for router r%s:\n%s" % (i, diff) + assert ( + failures == 0 + ), "SHOW ISIS INTERFACE DETAIL failed for router r%s:\n%s" % (i, diff) # Make sure that all daemons are running for i in range(1, 2): - fatal_error = net['r%s' % i].checkRouterRunning() + fatal_error = net["r%s" % i].checkRouterRunning() assert fatal_error == "", fatal_error # For debugging after starting FRR daemons, uncomment the next line @@ -721,7 +828,7 @@ def test_bgp_summary(): global net # Skip if previous fatal error condition is raised - if (fatal_error != ""): + if fatal_error != "": pytest.skip(fatal_error) thisDir = os.path.dirname(os.path.realpath(__file__)) @@ -730,15 +837,19 @@ def test_bgp_summary(): print("******************************************\n") failures = 0 for i in range(1, 2): - refTableFile = '%s/r%s/show_ip_bgp_summary.ref' % (thisDir, i) + refTableFile = "%s/r%s/show_ip_bgp_summary.ref" % (thisDir, i) if os.path.isfile(refTableFile): # Read expected result from file expected = open(refTableFile).read().rstrip() # Fix newlines (make them all the same) - expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1) + expected = ("\n".join(expected.splitlines()) + "\n").splitlines(1) # Actual output from router - actual = net['r%s' % i].cmd('vtysh -c "show ip bgp summary" 2> /dev/null').rstrip() + actual = ( + net["r%s" % i] + .cmd('vtysh -c "show ip bgp summary" 2> /dev/null') + .rstrip() + ) # Mask out "using XXiXX bytes" portion. They are random... actual = re.sub(r"using [0-9]+ bytes", "using XXXX bytes", actual) # Mask out "using XiXXX KiB" portion. They are random... @@ -747,50 +858,60 @@ def test_bgp_summary(): # Remove extra summaries which exist with newer versions # # Remove summary lines (changed recently) - actual = re.sub(r'Total number.*', '', actual) - actual = re.sub(r'Displayed.*', '', actual) + actual = re.sub(r"Total number.*", "", actual) + actual = re.sub(r"Displayed.*", "", actual) # Remove IPv4 Unicast Summary (Title only) - actual = re.sub(r'IPv4 Unicast Summary:', '', actual) + actual = re.sub(r"IPv4 Unicast Summary:", "", actual) # Remove IPv4 Multicast Summary (all of it) - actual = re.sub(r'IPv4 Multicast Summary:', '', actual) - actual = re.sub(r'No IPv4 Multicast neighbor is configured', '', actual) + actual = re.sub(r"IPv4 Multicast Summary:", "", actual) + actual = re.sub(r"No IPv4 Multicast neighbor is configured", "", actual) # Remove IPv4 VPN Summary (all of it) - actual = re.sub(r'IPv4 VPN Summary:', '', actual) - actual = re.sub(r'No IPv4 VPN neighbor is configured', '', actual) + actual = re.sub(r"IPv4 VPN Summary:", "", actual) + actual = re.sub(r"No IPv4 VPN neighbor is configured", "", actual) # Remove IPv4 Encap Summary (all of it) - actual = re.sub(r'IPv4 Encap Summary:', '', actual) - actual = re.sub(r'No IPv4 Encap neighbor is configured', '', actual) + actual = re.sub(r"IPv4 Encap Summary:", "", actual) + actual = re.sub(r"No IPv4 Encap neighbor is configured", "", actual) # Remove Unknown Summary (all of it) - actual = re.sub(r'Unknown Summary:', '', actual) - actual = re.sub(r'No Unknown neighbor is configured', '', actual) + actual = re.sub(r"Unknown Summary:", "", actual) + actual = re.sub(r"No Unknown neighbor is configured", "", actual) - actual = re.sub(r'IPv4 labeled-unicast Summary:', '', actual) - actual = re.sub(r'No IPv4 labeled-unicast neighbor is configured', '', actual) + actual = re.sub(r"IPv4 labeled-unicast Summary:", "", actual) + actual = re.sub( + r"No IPv4 labeled-unicast neighbor is configured", "", actual + ) # Strip empty lines actual = actual.lstrip() actual = actual.rstrip() # # Fix newlines (make them all the same) - actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1) + actual = ("\n".join(actual.splitlines()) + "\n").splitlines(1) # Generate Diff - diff = topotest.get_textdiff(actual, expected, + diff = topotest.get_textdiff( + actual, + expected, title1="actual SHOW IP BGP SUMMARY", - title2="expected SHOW IP BGP SUMMARY") + title2="expected SHOW IP BGP SUMMARY", + ) # Empty string if it matches, otherwise diff contains unified diff if diff: - sys.stderr.write('r%s failed SHOW IP BGP SUMMARY check:\n%s\n' % (i, diff)) + sys.stderr.write( + "r%s failed SHOW IP BGP SUMMARY check:\n%s\n" % (i, diff) + ) failures += 1 else: print("r%s ok" % i) - assert failures == 0, "SHOW IP BGP SUMMARY failed for router r%s:\n%s" % (i, diff) + assert failures == 0, "SHOW IP BGP SUMMARY failed for router r%s:\n%s" % ( + i, + diff, + ) # Make sure that all daemons are running for i in range(1, 2): - fatal_error = net['r%s' % i].checkRouterRunning() + fatal_error = net["r%s" % i].checkRouterRunning() assert fatal_error == "", fatal_error # For debugging after starting FRR daemons, uncomment the next line @@ -802,7 +923,7 @@ def test_bgp_ipv6_summary(): global net # Skip if previous fatal error condition is raised - if (fatal_error != ""): + if fatal_error != "": pytest.skip(fatal_error) thisDir = os.path.dirname(os.path.realpath(__file__)) @@ -811,15 +932,19 @@ def test_bgp_ipv6_summary(): print("******************************************\n") failures = 0 for i in range(1, 2): - refTableFile = '%s/r%s/show_bgp_ipv6_summary.ref' % (thisDir, i) + refTableFile = "%s/r%s/show_bgp_ipv6_summary.ref" % (thisDir, i) if os.path.isfile(refTableFile): # Read expected result from file expected = open(refTableFile).read().rstrip() # Fix newlines (make them all the same) - expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1) + expected = ("\n".join(expected.splitlines()) + "\n").splitlines(1) # Actual output from router - actual = net['r%s' % i].cmd('vtysh -c "show bgp ipv6 summary" 2> /dev/null').rstrip() + actual = ( + net["r%s" % i] + .cmd('vtysh -c "show bgp ipv6 summary" 2> /dev/null') + .rstrip() + ) # Mask out "using XXiXX bytes" portion. They are random... actual = re.sub(r"using [0-9]+ bytes", "using XXXX bytes", actual) # Mask out "using XiXXX KiB" portion. They are random... @@ -828,51 +953,61 @@ def test_bgp_ipv6_summary(): # Remove extra summaries which exist with newer versions # # Remove summary lines (changed recently) - actual = re.sub(r'Total number.*', '', actual) - actual = re.sub(r'Displayed.*', '', actual) + actual = re.sub(r"Total number.*", "", actual) + actual = re.sub(r"Displayed.*", "", actual) # Remove IPv4 Unicast Summary (Title only) - actual = re.sub(r'IPv6 Unicast Summary:', '', actual) + actual = re.sub(r"IPv6 Unicast Summary:", "", actual) # Remove IPv4 Multicast Summary (all of it) - actual = re.sub(r'IPv6 Multicast Summary:', '', actual) - actual = re.sub(r'No IPv6 Multicast neighbor is configured', '', actual) + actual = re.sub(r"IPv6 Multicast Summary:", "", actual) + actual = re.sub(r"No IPv6 Multicast neighbor is configured", "", actual) # Remove IPv4 VPN Summary (all of it) - actual = re.sub(r'IPv6 VPN Summary:', '', actual) - actual = re.sub(r'No IPv6 VPN neighbor is configured', '', actual) + actual = re.sub(r"IPv6 VPN Summary:", "", actual) + actual = re.sub(r"No IPv6 VPN neighbor is configured", "", actual) # Remove IPv4 Encap Summary (all of it) - actual = re.sub(r'IPv6 Encap Summary:', '', actual) - actual = re.sub(r'No IPv6 Encap neighbor is configured', '', actual) + actual = re.sub(r"IPv6 Encap Summary:", "", actual) + actual = re.sub(r"No IPv6 Encap neighbor is configured", "", actual) # Remove Unknown Summary (all of it) - actual = re.sub(r'Unknown Summary:', '', actual) - actual = re.sub(r'No Unknown neighbor is configured', '', actual) + actual = re.sub(r"Unknown Summary:", "", actual) + actual = re.sub(r"No Unknown neighbor is configured", "", actual) # Remove Labeled Unicast Summary (all of it) - actual = re.sub(r'IPv6 labeled-unicast Summary:', '', actual) - actual = re.sub(r'No IPv6 labeled-unicast neighbor is configured', '', actual) + actual = re.sub(r"IPv6 labeled-unicast Summary:", "", actual) + actual = re.sub( + r"No IPv6 labeled-unicast neighbor is configured", "", actual + ) # Strip empty lines actual = actual.lstrip() actual = actual.rstrip() # # Fix newlines (make them all the same) - actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1) + actual = ("\n".join(actual.splitlines()) + "\n").splitlines(1) # Generate Diff - diff = topotest.get_textdiff(actual, expected, + diff = topotest.get_textdiff( + actual, + expected, title1="actual SHOW BGP IPv6 SUMMARY", - title2="expected SHOW BGP IPv6 SUMMARY") + title2="expected SHOW BGP IPv6 SUMMARY", + ) # Empty string if it matches, otherwise diff contains unified diff if diff: - sys.stderr.write('r%s failed SHOW BGP IPv6 SUMMARY check:\n%s\n' % (i, diff)) + sys.stderr.write( + "r%s failed SHOW BGP IPv6 SUMMARY check:\n%s\n" % (i, diff) + ) failures += 1 else: print("r%s ok" % i) - assert failures == 0, "SHOW BGP IPv6 SUMMARY failed for router r%s:\n%s" % (i, diff) + assert failures == 0, "SHOW BGP IPv6 SUMMARY failed for router r%s:\n%s" % ( + i, + diff, + ) # Make sure that all daemons are running for i in range(1, 2): - fatal_error = net['r%s' % i].checkRouterRunning() + fatal_error = net["r%s" % i].checkRouterRunning() assert fatal_error == "", fatal_error # For debugging after starting FRR daemons, uncomment the next line @@ -884,7 +1019,7 @@ def test_bgp_ipv4(): global net # Skip if previous fatal error condition is raised - if (fatal_error != ""): + if fatal_error != "": pytest.skip(fatal_error) thisDir = os.path.dirname(os.path.realpath(__file__)) @@ -894,27 +1029,31 @@ def test_bgp_ipv4(): diffresult = {} for i in range(1, 2): success = 0 - for refTableFile in (glob.glob( - '%s/r%s/show_bgp_ipv4*.ref' % (thisDir, i))): + for refTableFile in glob.glob("%s/r%s/show_bgp_ipv4*.ref" % (thisDir, i)): if os.path.isfile(refTableFile): # Read expected result from file expected = open(refTableFile).read().rstrip() # Fix newlines (make them all the same) - expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1) + expected = ("\n".join(expected.splitlines()) + "\n").splitlines(1) # Actual output from router - actual = net['r%s' % i].cmd('vtysh -c "show bgp ipv4" 2> /dev/null').rstrip() + actual = ( + net["r%s" % i].cmd('vtysh -c "show bgp ipv4" 2> /dev/null').rstrip() + ) # Remove summary line (changed recently) - actual = re.sub(r'Total number.*', '', actual) - actual = re.sub(r'Displayed.*', '', actual) + actual = re.sub(r"Total number.*", "", actual) + actual = re.sub(r"Displayed.*", "", actual) actual = actual.rstrip() # Fix newlines (make them all the same) - actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1) + actual = ("\n".join(actual.splitlines()) + "\n").splitlines(1) # Generate Diff - diff = topotest.get_textdiff(actual, expected, + diff = topotest.get_textdiff( + actual, + expected, title1="actual SHOW BGP IPv4", - title2="expected SHOW BGP IPv4") + title2="expected SHOW BGP IPv4", + ) # Empty string if it matches, otherwise diff contains unified diff if diff: @@ -925,17 +1064,20 @@ def test_bgp_ipv4(): break if not success: - resultstr = 'No template matched.\n' + resultstr = "No template matched.\n" for f in diffresult.iterkeys(): - resultstr += ( - 'template %s: r%s failed SHOW BGP IPv4 check:\n%s\n' - % (f, i, diffresult[f])) + resultstr += "template %s: r%s failed SHOW BGP IPv4 check:\n%s\n" % ( + f, + i, + diffresult[f], + ) raise AssertionError( - "SHOW BGP IPv4 failed for router r%s:\n%s" % (i, resultstr)) + "SHOW BGP IPv4 failed for router r%s:\n%s" % (i, resultstr) + ) # Make sure that all daemons are running for i in range(1, 2): - fatal_error = net['r%s' % i].checkRouterRunning() + fatal_error = net["r%s" % i].checkRouterRunning() assert fatal_error == "", fatal_error # For debugging after starting FRR daemons, uncomment the next line @@ -947,7 +1089,7 @@ def test_bgp_ipv6(): global net # Skip if previous fatal error condition is raised - if (fatal_error != ""): + if fatal_error != "": pytest.skip(fatal_error) thisDir = os.path.dirname(os.path.realpath(__file__)) @@ -957,27 +1099,31 @@ def test_bgp_ipv6(): diffresult = {} for i in range(1, 2): success = 0 - for refTableFile in (glob.glob( - '%s/r%s/show_bgp_ipv6*.ref' % (thisDir, i))): + for refTableFile in glob.glob("%s/r%s/show_bgp_ipv6*.ref" % (thisDir, i)): if os.path.isfile(refTableFile): # Read expected result from file expected = open(refTableFile).read().rstrip() # Fix newlines (make them all the same) - expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1) + expected = ("\n".join(expected.splitlines()) + "\n").splitlines(1) # Actual output from router - actual = net['r%s' % i].cmd('vtysh -c "show bgp ipv6" 2> /dev/null').rstrip() + actual = ( + net["r%s" % i].cmd('vtysh -c "show bgp ipv6" 2> /dev/null').rstrip() + ) # Remove summary line (changed recently) - actual = re.sub(r'Total number.*', '', actual) - actual = re.sub(r'Displayed.*', '', actual) + actual = re.sub(r"Total number.*", "", actual) + actual = re.sub(r"Displayed.*", "", actual) actual = actual.rstrip() # Fix newlines (make them all the same) - actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1) + actual = ("\n".join(actual.splitlines()) + "\n").splitlines(1) # Generate Diff - diff = topotest.get_textdiff(actual, expected, + diff = topotest.get_textdiff( + actual, + expected, title1="actual SHOW BGP IPv6", - title2="expected SHOW BGP IPv6") + title2="expected SHOW BGP IPv6", + ) # Empty string if it matches, otherwise diff contains unified diff if diff: @@ -987,27 +1133,31 @@ def test_bgp_ipv6(): print("template %s matched: r%s ok" % (refTableFile, i)) if not success: - resultstr = 'No template matched.\n' + resultstr = "No template matched.\n" for f in diffresult.iterkeys(): - resultstr += ( - 'template %s: r%s failed SHOW BGP IPv6 check:\n%s\n' - % (f, i, diffresult[f])) + resultstr += "template %s: r%s failed SHOW BGP IPv6 check:\n%s\n" % ( + f, + i, + diffresult[f], + ) raise AssertionError( - "SHOW BGP IPv6 failed for router r%s:\n%s" % (i, resultstr)) + "SHOW BGP IPv6 failed for router r%s:\n%s" % (i, resultstr) + ) # Make sure that all daemons are running for i in range(1, 2): - fatal_error = net['r%s' % i].checkRouterRunning() + fatal_error = net["r%s" % i].checkRouterRunning() assert fatal_error == "", fatal_error # For debugging after starting FRR daemons, uncomment the next line # CLI(net) + def test_route_map(): global fatal_error global net - if (fatal_error != ""): + if fatal_error != "": pytest.skip(fatal_error) thisDir = os.path.dirname(os.path.realpath(__file__)) @@ -1016,32 +1166,42 @@ def test_route_map(): print("*******************************************************\n") failures = 0 for i in range(1, 2): - refroutemap = '%s/r%s/show_route_map.ref' % (thisDir, i) + refroutemap = "%s/r%s/show_route_map.ref" % (thisDir, i) if os.path.isfile(refroutemap): expected = open(refroutemap).read().rstrip() - expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1) + expected = ("\n".join(expected.splitlines()) + "\n").splitlines(1) - actual = net['r%s' %i].cmd('vtysh -c "show route-map" 2> /dev/null').rstrip() - actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1) + actual = ( + net["r%s" % i].cmd('vtysh -c "show route-map" 2> /dev/null').rstrip() + ) + actual = ("\n".join(actual.splitlines()) + "\n").splitlines(1) - diff = topotest.get_textdiff(actual, expected, - title1="actual show route-map", - title2="expected show route-map") + diff = topotest.get_textdiff( + actual, + expected, + title1="actual show route-map", + title2="expected show route-map", + ) if diff: - sys.stderr.write('r%s failed show route-map command Check:\n%s\n' % (i, diff)) + sys.stderr.write( + "r%s failed show route-map command Check:\n%s\n" % (i, diff) + ) failures += 1 else: - print("r%s ok" %i) + print("r%s ok" % i) + + assert ( + failures == 0 + ), "Show route-map command failed for router r%s:\n%s" % (i, diff) - assert failures == 0, "Show route-map command failed for router r%s:\n%s" % (i, diff) def test_nexthop_groups_with_route_maps(): global fatal_error global net # Skip if previous fatal error condition is raised - if (fatal_error != ""): + if fatal_error != "": pytest.skip(fatal_error) print("\n\n** Verifying Nexthop Groups With Route-Maps") @@ -1050,14 +1210,18 @@ def test_nexthop_groups_with_route_maps(): ### Nexthop Group With Route-Map Tests # Create a lib nexthop-group - net["r1"].cmd('vtysh -c "c t" -c "nexthop-group test" -c "nexthop 1.1.1.1" -c "nexthop 1.1.1.2"') + net["r1"].cmd( + 'vtysh -c "c t" -c "nexthop-group test" -c "nexthop 1.1.1.1" -c "nexthop 1.1.1.2"' + ) ## Route-Map Proto Source route_str = "2.2.2.1" src_str = "192.168.0.1" - net["r1"].cmd('vtysh -c "c t" -c "route-map NH-SRC permit 111" -c "set src %s"' % src_str) + net["r1"].cmd( + 'vtysh -c "c t" -c "route-map NH-SRC permit 111" -c "set src %s"' % src_str + ) net["r1"].cmd('vtysh -c "c t" -c "ip protocol sharp route-map NH-SRC"') net["r1"].cmd('vtysh -c "sharp install routes %s nexthop-group test 1"' % route_str) @@ -1066,14 +1230,19 @@ def test_nexthop_groups_with_route_maps(): # Only a valid test on linux using nexthop objects if sys.platform.startswith("linux"): - output = net["r1"].cmd('ip route show %s/32' % route_str) + output = net["r1"].cmd("ip route show %s/32" % route_str) match = re.search(r"src %s" % src_str, output) - assert match is not None, "Route %s/32 not installed with src %s" % (route_str, src_str) + assert match is not None, "Route %s/32 not installed with src %s" % ( + route_str, + src_str, + ) # Remove NHG routes and route-map net["r1"].cmd('vtysh -c "sharp remove routes %s 1"' % route_str) net["r1"].cmd('vtysh -c "c t" -c "no ip protocol sharp route-map NH-SRC"') - net["r1"].cmd('vtysh -c "c t" -c "no route-map NH-SRC permit 111" -c "set src %s"' % src_str) + net["r1"].cmd( + 'vtysh -c "c t" -c "no route-map NH-SRC permit 111" -c "set src %s"' % src_str + ) net["r1"].cmd('vtysh -c "c t" -c "no route-map NH-SRC"') ## Route-Map Deny/Permit with same nexthop group @@ -1081,18 +1250,26 @@ def test_nexthop_groups_with_route_maps(): permit_route_str = "3.3.3.1" deny_route_str = "3.3.3.2" - net["r1"].cmd('vtysh -c "c t" -c "ip prefix-list NOPE seq 5 permit %s/32"' % permit_route_str) - net["r1"].cmd('vtysh -c "c t" -c "route-map NOPE permit 111" -c "match ip address prefix-list NOPE"') + net["r1"].cmd( + 'vtysh -c "c t" -c "ip prefix-list NOPE seq 5 permit %s/32"' % permit_route_str + ) + net["r1"].cmd( + 'vtysh -c "c t" -c "route-map NOPE permit 111" -c "match ip address prefix-list NOPE"' + ) net["r1"].cmd('vtysh -c "c t" -c "route-map NOPE deny 222"') net["r1"].cmd('vtysh -c "c t" -c "ip protocol sharp route-map NOPE"') # This route should be permitted - net["r1"].cmd('vtysh -c "sharp install routes %s nexthop-group test 1"' % permit_route_str) + net["r1"].cmd( + 'vtysh -c "sharp install routes %s nexthop-group test 1"' % permit_route_str + ) verify_route_nexthop_group("%s/32" % permit_route_str) # This route should be denied - net["r1"].cmd('vtysh -c "sharp install routes %s nexthop-group test 1"' % deny_route_str) + net["r1"].cmd( + 'vtysh -c "sharp install routes %s nexthop-group test 1"' % deny_route_str + ) nhg_id = route_get_nhg_id(deny_route_str) output = net["r1"].cmd('vtysh -c "show nexthop-group rib %d"' % nhg_id) @@ -1110,14 +1287,18 @@ def test_nexthop_groups_with_route_maps(): net["r1"].cmd('vtysh -c "c t" -c "no route-map NOPE permit 111"') net["r1"].cmd('vtysh -c "c t" -c "no route-map NOPE deny 222"') net["r1"].cmd('vtysh -c "c t" -c "no route-map NOPE"') - net["r1"].cmd('vtysh -c "c t" -c "no ip prefix-list NOPE seq 5 permit %s/32"' % permit_route_str) + net["r1"].cmd( + 'vtysh -c "c t" -c "no ip prefix-list NOPE seq 5 permit %s/32"' + % permit_route_str + ) + def test_nexthop_group_replace(): global fatal_error global net # Skip if previous fatal error condition is raised - if (fatal_error != ""): + if fatal_error != "": pytest.skip(fatal_error) print("\n\n** Verifying Nexthop Groups") @@ -1127,7 +1308,9 @@ def test_nexthop_group_replace(): ## 2-Way ECMP Directly Connected - net["r1"].cmd('vtysh -c "c t" -c "nexthop-group replace" -c "nexthop 1.1.1.1 r1-eth1 onlink" -c "nexthop 1.1.1.2 r1-eth2 onlink"') + net["r1"].cmd( + 'vtysh -c "c t" -c "nexthop-group replace" -c "nexthop 1.1.1.1 r1-eth1 onlink" -c "nexthop 1.1.1.2 r1-eth2 onlink"' + ) # Create with sharpd using nexthop-group net["r1"].cmd('vtysh -c "sharp install routes 3.3.3.1 nexthop-group replace 1"') @@ -1135,21 +1318,24 @@ def test_nexthop_group_replace(): verify_route_nexthop_group("3.3.3.1/32") # Change the nexthop group - net["r1"].cmd('vtysh -c "c t" -c "nexthop-group replace" -c "no nexthop 1.1.1.1 r1-eth1 onlink" -c "nexthop 1.1.1.3 r1-eth1 onlink" -c "nexthop 1.1.1.4 r1-eth4 onlink"') + net["r1"].cmd( + 'vtysh -c "c t" -c "nexthop-group replace" -c "no nexthop 1.1.1.1 r1-eth1 onlink" -c "nexthop 1.1.1.3 r1-eth1 onlink" -c "nexthop 1.1.1.4 r1-eth4 onlink"' + ) # Verify it updated. We can just check install and ecmp count here. verify_route_nexthop_group("3.3.3.1/32", False, 3) + def test_mpls_interfaces(): global fatal_error global net # Skip if previous fatal error condition is raised - if (fatal_error != ""): + if fatal_error != "": pytest.skip(fatal_error) # Skip if no LDP installed or old kernel - if (net['r1'].daemon_available('ldpd') == False): + if net["r1"].daemon_available("ldpd") == False: pytest.skip("No MPLS or kernel < 4.5") thisDir = os.path.dirname(os.path.realpath(__file__)) @@ -1158,40 +1344,51 @@ def test_mpls_interfaces(): print("******************************************\n") failures = 0 for i in range(1, 2): - refTableFile = '%s/r%s/show_mpls_ldp_interface.ref' % (thisDir, i) + refTableFile = "%s/r%s/show_mpls_ldp_interface.ref" % (thisDir, i) if os.path.isfile(refTableFile): # Read expected result from file expected = open(refTableFile).read().rstrip() # Fix newlines (make them all the same) - expected = ('\n'.join(expected.splitlines()) + '\n').splitlines(1) + expected = ("\n".join(expected.splitlines()) + "\n").splitlines(1) # Actual output from router - actual = net['r%s' % i].cmd('vtysh -c "show mpls ldp interface" 2> /dev/null').rstrip() + actual = ( + net["r%s" % i] + .cmd('vtysh -c "show mpls ldp interface" 2> /dev/null') + .rstrip() + ) # Mask out Timer in Uptime actual = re.sub(r" [0-9][0-9]:[0-9][0-9]:[0-9][0-9] ", " xx:xx:xx ", actual) # Fix newlines (make them all the same) - actual = ('\n'.join(actual.splitlines()) + '\n').splitlines(1) + actual = ("\n".join(actual.splitlines()) + "\n").splitlines(1) # Generate Diff - diff = topotest.get_textdiff(actual, expected, + diff = topotest.get_textdiff( + actual, + expected, title1="actual MPLS LDP interface status", - title2="expected MPLS LDP interface status") + title2="expected MPLS LDP interface status", + ) # Empty string if it matches, otherwise diff contains unified diff if diff: - sys.stderr.write('r%s failed MPLS LDP Interface status Check:\n%s\n' % (i, diff)) + sys.stderr.write( + "r%s failed MPLS LDP Interface status Check:\n%s\n" % (i, diff) + ) failures += 1 else: print("r%s ok" % i) - if failures>0: + if failures > 0: fatal_error = "MPLS LDP Interface status failed" - assert failures == 0, "MPLS LDP Interface status failed for router r%s:\n%s" % (i, diff) + assert ( + failures == 0 + ), "MPLS LDP Interface status failed for router r%s:\n%s" % (i, diff) # Make sure that all daemons are running for i in range(1, 2): - fatal_error = net['r%s' % i].checkRouterRunning() + fatal_error = net["r%s" % i].checkRouterRunning() assert fatal_error == "", fatal_error # For debugging after starting FRR daemons, uncomment the next line @@ -1203,58 +1400,60 @@ def test_shutdown_check_stderr(): global net # Skip if previous fatal error condition is raised - if (fatal_error != ""): + if fatal_error != "": pytest.skip(fatal_error) print("\n\n** Verifying unexpected STDERR output from daemons") print("******************************************\n") - if os.environ.get('TOPOTESTS_CHECK_STDERR') is None: - print("SKIPPED final check on StdErr output: Disabled (TOPOTESTS_CHECK_STDERR undefined)\n") - pytest.skip('Skipping test for Stderr output') + if os.environ.get("TOPOTESTS_CHECK_STDERR") is None: + print( + "SKIPPED final check on StdErr output: Disabled (TOPOTESTS_CHECK_STDERR undefined)\n" + ) + pytest.skip("Skipping test for Stderr output") thisDir = os.path.dirname(os.path.realpath(__file__)) print("thisDir=" + thisDir) - net['r1'].stopRouter() + net["r1"].stopRouter() - log = net['r1'].getStdErr('ripd') + log = net["r1"].getStdErr("ripd") if log: print("\nRIPd StdErr Log:\n" + log) - log = net['r1'].getStdErr('ripngd') + log = net["r1"].getStdErr("ripngd") if log: print("\nRIPngd StdErr Log:\n" + log) - log = net['r1'].getStdErr('ospfd') + log = net["r1"].getStdErr("ospfd") if log: print("\nOSPFd StdErr Log:\n" + log) - log = net['r1'].getStdErr('ospf6d') + log = net["r1"].getStdErr("ospf6d") if log: print("\nOSPF6d StdErr Log:\n" + log) - log = net['r1'].getStdErr('isisd') + log = net["r1"].getStdErr("isisd") if log: print("\nISISd StdErr Log:\n" + log) - log = net['r1'].getStdErr('bgpd') + log = net["r1"].getStdErr("bgpd") if log: print("\nBGPd StdErr Log:\n" + log) - log = net['r1'].getStdErr('nhrpd') + log = net["r1"].getStdErr("nhrpd") if log: print("\nNHRPd StdErr Log:\n" + log) - log = net['r1'].getStdErr('pbrd') + log = net["r1"].getStdErr("pbrd") if log: print("\nPBRd StdErr Log:\n" + log) - log = net['r1'].getStdErr('babeld') + log = net["r1"].getStdErr("babeld") if log: print("\nBABELd StdErr Log:\n" + log) - if (net['r1'].daemon_available('ldpd')): - log = net['r1'].getStdErr('ldpd') + if net["r1"].daemon_available("ldpd"): + log = net["r1"].getStdErr("ldpd") if log: print("\nLDPd StdErr Log:\n" + log) - log = net['r1'].getStdErr('zebra') + log = net["r1"].getStdErr("zebra") if log: print("\nZebra StdErr Log:\n" + log) @@ -1264,23 +1463,27 @@ def test_shutdown_check_memleak(): global net # Skip if previous fatal error condition is raised - if (fatal_error != ""): + if fatal_error != "": pytest.skip(fatal_error) - if os.environ.get('TOPOTESTS_CHECK_MEMLEAK') is None: - print("SKIPPED final check on Memory leaks: Disabled (TOPOTESTS_CHECK_MEMLEAK undefined)\n") - pytest.skip('Skipping test for memory leaks') - + if os.environ.get("TOPOTESTS_CHECK_MEMLEAK") is None: + print( + "SKIPPED final check on Memory leaks: Disabled (TOPOTESTS_CHECK_MEMLEAK undefined)\n" + ) + pytest.skip("Skipping test for memory leaks") + thisDir = os.path.dirname(os.path.realpath(__file__)) for i in range(1, 2): - net['r%s' % i].stopRouter() - net['r%s' % i].report_memory_leaks(os.environ.get('TOPOTESTS_CHECK_MEMLEAK'), os.path.basename(__file__)) + net["r%s" % i].stopRouter() + net["r%s" % i].report_memory_leaks( + os.environ.get("TOPOTESTS_CHECK_MEMLEAK"), os.path.basename(__file__) + ) -if __name__ == '__main__': +if __name__ == "__main__": - setLogLevel('info') + setLogLevel("info") # To suppress tracebacks, either use the following pytest call or add "--tb=no" to cli # retval = pytest.main(["-s", "--tb=no"]) retval = pytest.main(["-s"]) diff --git a/tests/topotests/bfd-isis-topo1/rt1/isisd.conf b/tests/topotests/bfd-isis-topo1/rt1/isisd.conf index 3219371d2e..8026aad49d 100644 --- a/tests/topotests/bfd-isis-topo1/rt1/isisd.conf +++ b/tests/topotests/bfd-isis-topo1/rt1/isisd.conf @@ -30,6 +30,7 @@ interface eth-rt3 isis bfd ! router isis 1 + lsp-gen-interval 2 net 49.0000.0000.0000.0001.00 is-type level-1 ! diff --git a/tests/topotests/bfd-isis-topo1/rt2/isisd.conf b/tests/topotests/bfd-isis-topo1/rt2/isisd.conf index 63ccb640a4..b0fde64a5e 100644 --- a/tests/topotests/bfd-isis-topo1/rt2/isisd.conf +++ b/tests/topotests/bfd-isis-topo1/rt2/isisd.conf @@ -25,6 +25,7 @@ interface eth-rt5 isis hello-multiplier 3 ! router isis 1 + lsp-gen-interval 2 net 49.0000.0000.0000.0002.00 is-type level-1 ! diff --git a/tests/topotests/bfd-isis-topo1/rt3/isisd.conf b/tests/topotests/bfd-isis-topo1/rt3/isisd.conf index 928f1e1a2b..5c36e96c0f 100644 --- a/tests/topotests/bfd-isis-topo1/rt3/isisd.conf +++ b/tests/topotests/bfd-isis-topo1/rt3/isisd.conf @@ -26,6 +26,7 @@ interface eth-rt4 isis hello-multiplier 3 ! router isis 1 + lsp-gen-interval 2 net 49.0000.0000.0000.0003.00 is-type level-1 ! diff --git a/tests/topotests/bfd-isis-topo1/rt4/isisd.conf b/tests/topotests/bfd-isis-topo1/rt4/isisd.conf index fde97478a9..3eac407776 100644 --- a/tests/topotests/bfd-isis-topo1/rt4/isisd.conf +++ b/tests/topotests/bfd-isis-topo1/rt4/isisd.conf @@ -24,6 +24,7 @@ interface eth-rt5 isis hello-multiplier 3 ! router isis 1 + lsp-gen-interval 2 net 49.0000.0000.0000.0004.00 is-type level-1 ! diff --git a/tests/topotests/bfd-isis-topo1/rt5/isisd.conf b/tests/topotests/bfd-isis-topo1/rt5/isisd.conf index fd00cb1ddb..5d449f6f93 100644 --- a/tests/topotests/bfd-isis-topo1/rt5/isisd.conf +++ b/tests/topotests/bfd-isis-topo1/rt5/isisd.conf @@ -24,6 +24,7 @@ interface eth-rt4 isis hello-multiplier 3 ! router isis 1 + lsp-gen-interval 2 net 49.0000.0000.0000.0005.00 is-type level-1 ! diff --git a/tests/topotests/bfd-profiles-topo1/r3/isisd.conf b/tests/topotests/bfd-profiles-topo1/r3/isisd.conf index d27a783adf..ca965e3956 100644 --- a/tests/topotests/bfd-profiles-topo1/r3/isisd.conf +++ b/tests/topotests/bfd-profiles-topo1/r3/isisd.conf @@ -11,6 +11,7 @@ interface r3-eth1 isis bfd profile fasttx ! router isis lan + lsp-gen-interval 2 net 10.0000.0000.0000.0000.0000.0000.0000.0000.0001.00 redistribute ipv6 connected level-1 ! diff --git a/tests/topotests/bfd-profiles-topo1/r4/isisd.conf b/tests/topotests/bfd-profiles-topo1/r4/isisd.conf index 01e197bed5..d8ffc9bc2c 100644 --- a/tests/topotests/bfd-profiles-topo1/r4/isisd.conf +++ b/tests/topotests/bfd-profiles-topo1/r4/isisd.conf @@ -11,6 +11,7 @@ interface r4-eth0 isis bfd profile DOES_NOT_EXIST ! router isis lan + lsp-gen-interval 2 net 10.0000.0000.0000.0000.0000.0000.0000.0000.0002.00 redistribute ipv6 connected level-1 ! diff --git a/tests/topotests/bfd-profiles-topo1/test_bfd_profiles_topo1.py b/tests/topotests/bfd-profiles-topo1/test_bfd_profiles_topo1.py index 514933b891..bd3b876eeb 100644 --- a/tests/topotests/bfd-profiles-topo1/test_bfd_profiles_topo1.py +++ b/tests/topotests/bfd-profiles-topo1/test_bfd_profiles_topo1.py @@ -118,6 +118,7 @@ def teardown_module(_mod): tgen = get_topogen() tgen.stop_topology() + def test_wait_protocols_convergence(): "Wait for all protocols to converge" tgen = get_topogen() @@ -128,41 +129,40 @@ def test_wait_protocols_convergence(): def expect_loopback_route(router, iptype, route, proto): "Wait until route is present on RIB for protocol." - logger.info('waiting route {} in {}'.format(route, router)) + logger.info("waiting route {} in {}".format(route, router)) test_func = partial( topotest.router_json_cmp, tgen.gears[router], - 'show {} route json'.format(iptype), - { route: [{ 'protocol': proto }] } + "show {} route json".format(iptype), + {route: [{"protocol": proto}]}, ) _, result = topotest.run_and_expect(test_func, None, count=130, wait=1) assertmsg = '"{}" OSPF convergence failure'.format(router) assert result is None, assertmsg - # Wait for R1 <-> R6 convergence. - expect_loopback_route('r1', 'ip', '10.254.254.6/32', 'ospf') + expect_loopback_route("r1", "ip", "10.254.254.6/32", "ospf") # Wait for R6 <-> R1 convergence. - expect_loopback_route('r6', 'ip', '10.254.254.1/32', 'ospf') + expect_loopback_route("r6", "ip", "10.254.254.1/32", "ospf") # Wait for R2 <-> R3 convergence. - expect_loopback_route('r2', 'ip', '10.254.254.3/32', 'bgp') + expect_loopback_route("r2", "ip", "10.254.254.3/32", "bgp") # Wait for R3 <-> R2 convergence. - expect_loopback_route('r3', 'ip', '10.254.254.2/32', 'bgp') + expect_loopback_route("r3", "ip", "10.254.254.2/32", "bgp") # Wait for R3 <-> R4 convergence. - expect_loopback_route('r3', 'ipv6', '2001:db8:3::/64', 'isis') + expect_loopback_route("r3", "ipv6", "2001:db8:3::/64", "isis") # Wait for R4 <-> R3 convergence. - expect_loopback_route('r4', 'ipv6', '2001:db8:1::/64', 'isis') + expect_loopback_route("r4", "ipv6", "2001:db8:1::/64", "isis") # Wait for R4 <-> R5 convergence. - expect_loopback_route('r4', 'ipv6', '2001:db8:3::/64', 'ospf6') + expect_loopback_route("r4", "ipv6", "2001:db8:3::/64", "ospf6") # Wait for R5 <-> R4 convergence. - expect_loopback_route('r5', 'ipv6', '2001:db8:2::/64', 'ospf6') + expect_loopback_route("r5", "ipv6", "2001:db8:2::/64", "ospf6") def test_bfd_profile_values(): diff --git a/tests/topotests/bfd-topo3/test_bfd_topo3.py b/tests/topotests/bfd-topo3/test_bfd_topo3.py index fa68ace59d..f473b67108 100644 --- a/tests/topotests/bfd-topo3/test_bfd_topo3.py +++ b/tests/topotests/bfd-topo3/test_bfd_topo3.py @@ -103,44 +103,44 @@ def test_wait_bgp_convergence(): def expect_loopback_route(router, iptype, route, proto): "Wait until route is present on RIB for protocol." - logger.info('waiting route {} in {}'.format(route, router)) + logger.info("waiting route {} in {}".format(route, router)) test_func = partial( topotest.router_json_cmp, tgen.gears[router], - 'show {} route json'.format(iptype), - { route: [{ 'protocol': proto }] } + "show {} route json".format(iptype), + {route: [{"protocol": proto}]}, ) _, result = topotest.run_and_expect(test_func, None, count=130, wait=1) assertmsg = '"{}" OSPF convergence failure'.format(router) assert result is None, assertmsg # Wait for R1 <-> R2 convergence. - expect_loopback_route('r1', 'ip', '10.254.254.2/32', 'bgp') + expect_loopback_route("r1", "ip", "10.254.254.2/32", "bgp") # Wait for R1 <-> R3 convergence. - expect_loopback_route('r1', 'ip', '10.254.254.3/32', 'bgp') + expect_loopback_route("r1", "ip", "10.254.254.3/32", "bgp") # Wait for R1 <-> R4 convergence. - expect_loopback_route('r1', 'ip', '10.254.254.4/32', 'bgp') + expect_loopback_route("r1", "ip", "10.254.254.4/32", "bgp") # Wait for R2 <-> R1 convergence. - expect_loopback_route('r2', 'ip', '10.254.254.1/32', 'bgp') + expect_loopback_route("r2", "ip", "10.254.254.1/32", "bgp") # Wait for R2 <-> R3 convergence. - expect_loopback_route('r2', 'ip', '10.254.254.3/32', 'bgp') + expect_loopback_route("r2", "ip", "10.254.254.3/32", "bgp") # Wait for R2 <-> R4 convergence. - expect_loopback_route('r2', 'ip', '10.254.254.4/32', 'bgp') + expect_loopback_route("r2", "ip", "10.254.254.4/32", "bgp") # Wait for R3 <-> R1 convergence. - expect_loopback_route('r3', 'ip', '10.254.254.1/32', 'bgp') + expect_loopback_route("r3", "ip", "10.254.254.1/32", "bgp") # Wait for R3 <-> R2 convergence. - expect_loopback_route('r3', 'ip', '10.254.254.2/32', 'bgp') + expect_loopback_route("r3", "ip", "10.254.254.2/32", "bgp") # Wait for R3 <-> R4 convergence. - expect_loopback_route('r3', 'ip', '10.254.254.4/32', 'bgp') + expect_loopback_route("r3", "ip", "10.254.254.4/32", "bgp") # Wait for R4 <-> R1 convergence. - expect_loopback_route('r4', 'ip', '10.254.254.1/32', 'bgp') + expect_loopback_route("r4", "ip", "10.254.254.1/32", "bgp") # Wait for R4 <-> R2 convergence. - expect_loopback_route('r4', 'ip', '10.254.254.2/32', 'bgp') + expect_loopback_route("r4", "ip", "10.254.254.2/32", "bgp") # Wait for R4 <-> R3 convergence. - expect_loopback_route('r4', 'ip', '10.254.254.3/32', 'bgp') + expect_loopback_route("r4", "ip", "10.254.254.3/32", "bgp") def test_wait_bfd_convergence(): @@ -153,22 +153,22 @@ def test_wait_bfd_convergence(): def expect_bfd_configuration(router): "Load JSON file and compare with 'show bfd peer json'" - logger.info('waiting BFD configuration on router {}'.format(router)) - bfd_config = json.loads(open('{}/{}/bfd-peers.json'.format(CWD, router)).read()) + logger.info("waiting BFD configuration on router {}".format(router)) + bfd_config = json.loads(open("{}/{}/bfd-peers.json".format(CWD, router)).read()) test_func = partial( topotest.router_json_cmp, tgen.gears[router], - 'show bfd peers json', - bfd_config + "show bfd peers json", + bfd_config, ) _, result = topotest.run_and_expect(test_func, None, count=130, wait=1) assertmsg = '"{}" BFD configuration failure'.format(router) assert result is None, assertmsg - expect_bfd_configuration('r1') - expect_bfd_configuration('r2') - expect_bfd_configuration('r3') - expect_bfd_configuration('r4') + expect_bfd_configuration("r1") + expect_bfd_configuration("r2") + expect_bfd_configuration("r3") + expect_bfd_configuration("r4") def teardown_module(_mod): diff --git a/tests/topotests/bgp-auth/test_bgp_auth.py b/tests/topotests/bgp-auth/test_bgp_auth.py index 286af3bf65..559cf4fb1b 100644 --- a/tests/topotests/bgp-auth/test_bgp_auth.py +++ b/tests/topotests/bgp-auth/test_bgp_auth.py @@ -270,7 +270,7 @@ def peer_name(rtr, prefix, vrf): def print_diag(vrf): "print failure disagnostics" - + tgen = get_topogen() router_list = tgen.routers() for rname, router in router_list.items(): @@ -330,7 +330,7 @@ def clear_ospf(vrf=""): def check_neigh_state(router, peer, state, vrf=""): "check BGP neighbor state on a router" - + count = 0 matched = False neigh_output = "" diff --git a/tests/topotests/bgp-basic-functionality-topo1/test_bgp_basic_functionality.py b/tests/topotests/bgp-basic-functionality-topo1/test_bgp_basic_functionality.py index 41fa7c0a09..b3b7256ac4 100644 --- a/tests/topotests/bgp-basic-functionality-topo1/test_bgp_basic_functionality.py +++ b/tests/topotests/bgp-basic-functionality-topo1/test_bgp_basic_functionality.py @@ -76,7 +76,7 @@ from lib.common_config import ( create_prefix_lists, create_route_maps, verify_bgp_community, - required_linux_kernel_version + required_linux_kernel_version, ) from lib.topolog import logger from lib.bgp import ( @@ -139,7 +139,7 @@ def setup_module(mod): """ # Required linux kernel version for this suite to run. - result = required_linux_kernel_version('4.15') + result = required_linux_kernel_version("4.15") if result is not True: pytest.skip("Kernel requirements are not met") @@ -567,7 +567,7 @@ def test_BGP_attributes_with_vrf_default_keyword_p0(request): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - #reset_config_on_routers(tgen) + # reset_config_on_routers(tgen) step("Configure static routes and redistribute in BGP on R3") for addr_type in ADDR_TYPES: diff --git a/tests/topotests/bgp-ecmp-topo2/test_ebgp_ecmp_topo2.py b/tests/topotests/bgp-ecmp-topo2/test_ebgp_ecmp_topo2.py index eed118ebdc..54a3c699f3 100644 --- a/tests/topotests/bgp-ecmp-topo2/test_ebgp_ecmp_topo2.py +++ b/tests/topotests/bgp-ecmp-topo2/test_ebgp_ecmp_topo2.py @@ -61,7 +61,7 @@ from lib.common_config import ( check_address_types, interface_status, reset_config_on_routers, - required_linux_kernel_version + required_linux_kernel_version, ) from lib.topolog import logger from lib.bgp import verify_bgp_convergence, create_router_bgp, clear_bgp @@ -110,7 +110,7 @@ def setup_module(mod): global ADDR_TYPES # Required linux kernel version for this suite to run. - result = required_linux_kernel_version('4.15') + result = required_linux_kernel_version("4.15") if result is not True: pytest.skip("Kernel requirements are not met") @@ -144,9 +144,7 @@ def setup_module(mod): ) link_data = [ - val - for links, val in topo["routers"]["r2"]["links"].items() - if "r3" in links + val for links, val in topo["routers"]["r2"]["links"].items() if "r3" in links ] for adt in ADDR_TYPES: NEXT_HOPS[adt] = [val[adt].split("/")[0] for val in link_data] @@ -161,9 +159,7 @@ def setup_module(mod): INTF_LIST_R2 = sorted(INTF_LIST_R2, key=lambda x: int(x.split("eth")[1])) link_data = [ - val - for links, val in topo["routers"]["r3"]["links"].items() - if "r2" in links + val for links, val in topo["routers"]["r3"]["links"].items() if "r2" in links ] INTF_LIST_R3 = [val["interface"].split("/")[0] for val in link_data] INTF_LIST_R3 = sorted(INTF_LIST_R3, key=lambda x: int(x.split("eth")[1])) @@ -296,6 +292,10 @@ def test_modify_ecmp_max_paths(request, ecmp_num, test_type): input_dict_1 = {"r3": {"static_routes": [{"network": NETWORK[addr_type]}]}} logger.info("Verifying %s routes on r3", addr_type) + + # Only test the count of nexthops; the actual nexthop addresses + # can vary and are not deterministic. + # result = verify_rib( tgen, addr_type, @@ -303,7 +303,9 @@ def test_modify_ecmp_max_paths(request, ecmp_num, test_type): input_dict_1, next_hop=NEXT_HOPS[addr_type][: int(ecmp_num)], protocol=protocol, + count_only=True ) + assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result ) diff --git a/tests/topotests/bgp-ecmp-topo2/test_ibgp_ecmp_topo2.py b/tests/topotests/bgp-ecmp-topo2/test_ibgp_ecmp_topo2.py index 7357c33824..73724ac069 100644 --- a/tests/topotests/bgp-ecmp-topo2/test_ibgp_ecmp_topo2.py +++ b/tests/topotests/bgp-ecmp-topo2/test_ibgp_ecmp_topo2.py @@ -61,7 +61,7 @@ from lib.common_config import ( check_address_types, interface_status, reset_config_on_routers, - required_linux_kernel_version + required_linux_kernel_version, ) from lib.topolog import logger from lib.bgp import verify_bgp_convergence, create_router_bgp, clear_bgp @@ -110,7 +110,7 @@ def setup_module(mod): global ADDR_TYPES # Required linux kernel version for this suite to run. - result = required_linux_kernel_version('4.15') + result = required_linux_kernel_version("4.15") if result is not True: pytest.skip("Kernel requirements are not met") @@ -145,9 +145,7 @@ def setup_module(mod): ) link_data = [ - val - for links, val in topo["routers"]["r2"]["links"].items() - if "r3" in links + val for links, val in topo["routers"]["r2"]["links"].items() if "r3" in links ] for adt in ADDR_TYPES: NEXT_HOPS[adt] = [val[adt].split("/")[0] for val in link_data] @@ -162,9 +160,7 @@ def setup_module(mod): INTF_LIST_R2 = sorted(INTF_LIST_R2, key=lambda x: int(x.split("eth")[1])) link_data = [ - val - for links, val in topo["routers"]["r3"]["links"].items() - if "r2" in links + val for links, val in topo["routers"]["r3"]["links"].items() if "r2" in links ] INTF_LIST_R3 = [val["interface"].split("/")[0] for val in link_data] INTF_LIST_R3 = sorted(INTF_LIST_R3, key=lambda x: int(x.split("eth")[1])) @@ -297,6 +293,10 @@ def test_modify_ecmp_max_paths(request, ecmp_num, test_type): input_dict_1 = {"r3": {"static_routes": [{"network": NETWORK[addr_type]}]}} logger.info("Verifying %s routes on r3", addr_type) + + # Test only the count of nexthops, not the specific nexthop addresses - + # they're not deterministic + # result = verify_rib( tgen, addr_type, @@ -304,7 +304,9 @@ def test_modify_ecmp_max_paths(request, ecmp_num, test_type): input_dict_1, next_hop=NEXT_HOPS[addr_type][: int(ecmp_num)], protocol=protocol, + count_only=True ) + assert result is True, "Testcase {} : Failed \n Error: {}".format( tc_name, result ) diff --git a/tests/topotests/bgp-evpn-mh/test_evpn_mh.py b/tests/topotests/bgp-evpn-mh/test_evpn_mh.py index 9af22c06bd..4c56d1a02d 100644 --- a/tests/topotests/bgp-evpn-mh/test_evpn_mh.py +++ b/tests/topotests/bgp-evpn-mh/test_evpn_mh.py @@ -57,13 +57,13 @@ from mininet.topo import Topo class NetworkTopo(Topo): - ''' + """ EVPN Multihoming Topology - 1. Two level CLOS 2. Two spine switches - spine1, spine2 3. Two racks with Top-of-Rack switches per rack - tormx1, tormx2 4. Two dual attached hosts per-rack - hostdx1, hostdx2 - ''' + """ def build(self, **_opts): "Build function" @@ -84,7 +84,6 @@ class NetworkTopo(Topo): # On main router # First switch is for a dummy interface (for local network) - ##################### spine1 ######################## # spine1-eth0 is connected to torm11-eth0 switch = tgen.add_switch("sw1") @@ -178,38 +177,44 @@ class NetworkTopo(Topo): ## ##################################################### -tor_ips = {"torm11" : "192.168.100.15", \ - "torm12" : "192.168.100.16", \ - "torm21" : "192.168.100.17", \ - "torm22" : "192.168.100.18"} +tor_ips = { + "torm11": "192.168.100.15", + "torm12": "192.168.100.16", + "torm21": "192.168.100.17", + "torm22": "192.168.100.18", +} + +svi_ips = { + "torm11": "45.0.0.2", + "torm12": "45.0.0.3", + "torm21": "45.0.0.4", + "torm22": "45.0.0.5", +} -svi_ips = {"torm11" : "45.0.0.2", \ - "torm12" : "45.0.0.3", \ - "torm21" : "45.0.0.4", \ - "torm22" : "45.0.0.5"} +tor_ips_rack_1 = {"torm11": "192.168.100.15", "torm12": "192.168.100.16"} -tor_ips_rack_1 = {"torm11" : "192.168.100.15", \ - "torm12" : "192.168.100.16"} +tor_ips_rack_2 = {"torm21": "192.168.100.17", "torm22": "192.168.100.18"} -tor_ips_rack_2 = {"torm21" : "192.168.100.17", \ - "torm22" : "192.168.100.18"} +host_es_map = { + "hostd11": "03:44:38:39:ff:ff:01:00:00:01", + "hostd12": "03:44:38:39:ff:ff:01:00:00:02", + "hostd21": "03:44:38:39:ff:ff:02:00:00:01", + "hostd22": "03:44:38:39:ff:ff:02:00:00:02", +} -host_es_map = {"hostd11" : "03:44:38:39:ff:ff:01:00:00:01", - "hostd12" : "03:44:38:39:ff:ff:01:00:00:02", - "hostd21" : "03:44:38:39:ff:ff:02:00:00:01", - "hostd22" : "03:44:38:39:ff:ff:02:00:00:02"} def config_bond(node, bond_name, bond_members, bond_ad_sys_mac, br): - ''' + """ Used to setup bonds on the TORs and hosts for MH - ''' + """ node.run("ip link add dev %s type bond mode 802.3ad" % bond_name) node.run("ip link set dev %s type bond lacp_rate 1" % bond_name) node.run("ip link set dev %s type bond miimon 100" % bond_name) node.run("ip link set dev %s type bond xmit_hash_policy layer3+4" % bond_name) node.run("ip link set dev %s type bond min_links 1" % bond_name) - node.run("ip link set dev %s type bond ad_actor_system %s" %\ - (bond_name, bond_ad_sys_mac)) + node.run( + "ip link set dev %s type bond ad_actor_system %s" % (bond_name, bond_ad_sys_mac) + ) for bond_member in bond_members: node.run("ip link set dev %s down" % bond_member) @@ -225,15 +230,14 @@ def config_bond(node, bond_name, bond_members, bond_ad_sys_mac, br): node.run("/sbin/bridge vlan del vid 1 dev %s" % bond_name) node.run("/sbin/bridge vlan del vid 1 untagged pvid dev %s" % bond_name) node.run("/sbin/bridge vlan add vid 1000 dev %s" % bond_name) - node.run("/sbin/bridge vlan add vid 1000 untagged pvid dev %s"\ - % bond_name) + node.run("/sbin/bridge vlan add vid 1000 untagged pvid dev %s" % bond_name) def config_mcast_tunnel_termination_device(node): - ''' + """ The kernel requires a device to terminate VxLAN multicast tunnels when EVPN-PIM is used for flooded traffic - ''' + """ node.run("ip link add dev ipmr-lo type dummy") node.run("ip link set dev ipmr-lo mtu 16000") node.run("ip link set dev ipmr-lo mode dormant") @@ -241,9 +245,9 @@ def config_mcast_tunnel_termination_device(node): def config_bridge(node): - ''' + """ Create a VLAN aware bridge - ''' + """ node.run("ip link add dev bridge type bridge stp_state 0") node.run("ip link set dev bridge type bridge vlan_filtering 1") node.run("ip link set dev bridge mtu 9216") @@ -255,10 +259,10 @@ def config_bridge(node): def config_vxlan(node, node_ip): - ''' + """ Create a VxLAN device for VNI 1000 and add it to the bridge. VLAN-1000 is mapped to VNI-1000. - ''' + """ node.run("ip link add dev vx-1000 type vxlan id 1000 dstport 4789") node.run("ip link set dev vx-1000 type vxlan nolearning") node.run("ip link set dev vx-1000 type vxlan local %s" % node_ip) @@ -279,9 +283,9 @@ def config_vxlan(node, node_ip): def config_svi(node, svi_pip): - ''' + """ Create an SVI for VLAN 1000 - ''' + """ node.run("ip link add link bridge name vlan1000 type vlan id 1000 protocol 802.1q") node.run("ip addr add %s/24 dev vlan1000" % svi_pip) node.run("ip link set dev vlan1000 up") @@ -297,9 +301,9 @@ def config_svi(node, svi_pip): def config_tor(tor_name, tor, tor_ip, svi_pip): - ''' + """ Create the bond/vxlan-bridge on the TOR which acts as VTEP and EPN-PE - ''' + """ # create a device for terminating VxLAN multicast tunnels config_mcast_tunnel_termination_device(tor) @@ -329,17 +333,19 @@ def config_tors(tgen, tors): tor = tgen.gears[tor_name] config_tor(tor_name, tor, tor_ips.get(tor_name), svi_ips.get(tor_name)) + def compute_host_ip_mac(host_name): host_id = host_name.split("hostd")[1] - host_ip = "45.0.0."+ host_id + "/24" + host_ip = "45.0.0." + host_id + "/24" host_mac = "00:00:00:00:00:" + host_id return host_ip, host_mac + def config_host(host_name, host): - ''' + """ Create the dual-attached bond on host nodes for MH - ''' + """ bond_members = [] bond_members.append(host_name + "-eth0") bond_members.append(host_name + "-eth1") @@ -407,9 +413,9 @@ def teardown_module(_mod): def check_local_es(esi, vtep_ips, dut_name, down_vteps): - ''' + """ Check if ES peers are setup correctly on local ESs - ''' + """ peer_ips = [] if "torm1" in dut_name: tor_ips_rack = tor_ips_rack_1 @@ -432,9 +438,9 @@ def check_local_es(esi, vtep_ips, dut_name, down_vteps): def check_remote_es(esi, vtep_ips, dut_name, down_vteps): - ''' + """ Verify list of PEs associated with a remote ES - ''' + """ remote_ips = [] if "torm1" in dut_name: @@ -455,10 +461,11 @@ def check_remote_es(esi, vtep_ips, dut_name, down_vteps): return (esi, diff) if diff else None + def check_es(dut): - ''' + """ Verify list of PEs associated all ESs, local and remote - ''' + """ bgp_es = dut.vtysh_cmd("show bgp l2vp evpn es json") bgp_es_json = json.loads(bgp_es) @@ -490,10 +497,11 @@ def check_es(dut): return result if result else None + def check_one_es(dut, esi, down_vteps): - ''' + """ Verify list of PEs associated all ESs, local and remote - ''' + """ bgp_es = dut.vtysh_cmd("show bgp l2vp evpn es %s json" % esi) es = json.loads(bgp_es) @@ -513,12 +521,13 @@ def check_one_es(dut, esi, down_vteps): return result + def test_evpn_es(): - ''' + """ Two ES are setup on each rack. This test checks if - 1. ES peer has been added to the local ES (via Type-1/EAD route) 2. The remote ESs are setup with the right list of PEs (via Type-1) - ''' + """ tgen = get_topogen() @@ -534,11 +543,12 @@ def test_evpn_es(): assert result is None, assertmsg # tgen.mininet_cli() + def test_evpn_ead_update(): - ''' + """ Flap a host link one the remote rack and check if the EAD updates are sent/processed for the corresponding ESI - ''' + """ tgen = get_topogen() if tgen.routers_have_failure(): @@ -580,30 +590,32 @@ def test_evpn_ead_update(): # tgen.mininet_cli() + def check_mac(dut, vni, mac, m_type, esi, intf): - ''' + """ checks if mac is present and if desination matches the one provided - ''' + """ out = dut.vtysh_cmd("show evpn mac vni %d mac %s json" % (vni, mac)) mac_js = json.loads(out) for mac, info in mac_js.items(): tmp_esi = info.get("esi", "") - tmp_m_type = info.get("type", "") + tmp_m_type = info.get("type", "") tmp_intf = info.get("intf", "") if tmp_m_type == "local" else "" if tmp_esi == esi and tmp_m_type == m_type and intf == intf: return None return "invalid vni %d mac %s out %s" % (vni, mac, mac_js) + def test_evpn_mac(): - ''' + """ 1. Add a MAC on hostd11 and check if the MAC is synced between torm11 and torm12. And installed as a local MAC. 2. Add a MAC on hostd21 and check if the MAC is installed as a remote MAC on torm11 and torm12 - ''' + """ tgen = get_topogen() @@ -646,6 +658,126 @@ def test_evpn_mac(): assertmsg = '"{}" remote MAC content incorrect'.format(tor.name) assert result is None, assertmsg +def check_df_role(dut, esi, role): + ''' + Return error string if the df role on the dut is different + ''' + es_json = dut.vtysh_cmd("show evpn es %s json" % esi) + es = json.loads(es_json) + + if not es: + return "esi %s not found" % esi + + flags = es.get("flags", []) + curr_role = "nonDF" if "nonDF" in flags else "DF" + + if curr_role != role: + return "%s is %s for %s" % (dut.name, curr_role, esi) + + return None + +def test_evpn_df(): + ''' + 1. Check the DF role on all the PEs on rack-1. + 2. Increase the DF preference on the non-DF and check if it becomes + the DF winner. + ''' + + tgen = get_topogen() + + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # We will run the tests on just one ES + esi = host_es_map.get("hostd11") + intf = "hostbond1" + + tors = [] + tors.append(tgen.gears["torm11"]) + tors.append(tgen.gears["torm12"]) + df_node = "torm11" + + # check roles on rack-1 + for tor in tors: + role = "DF" if tor.name == df_node else "nonDF" + test_fn = partial(check_df_role, tor, esi, role) + _, result = topotest.run_and_expect(test_fn, None, count=20, wait=3) + assertmsg = '"{}" DF role incorrect'.format(tor.name) + assert result is None, assertmsg + + # change df preference on the nonDF to make it the df + torm12 = tgen.gears["torm12"] + torm12.vtysh_cmd("conf\ninterface %s\nevpn mh es-df-pref %d" % (intf, 60000)) + df_node = "torm12" + + # re-check roles on rack-1; we should have a new winner + for tor in tors: + role = "DF" if tor.name == df_node else "nonDF" + test_fn = partial(check_df_role, tor, esi, role) + _, result = topotest.run_and_expect(test_fn, None, count=20, wait=3) + assertmsg = '"{}" DF role incorrect'.format(tor.name) + assert result is None, assertmsg + + # tgen.mininet_cli() + +def check_protodown_rc(dut, protodown_rc): + ''' + check if specified protodown reason code is set + ''' + + out = dut.vtysh_cmd("show evpn json") + + evpn_js = json.loads(out) + tmp_rc = evpn_js.get("protodownReasons", []) + + if protodown_rc: + if protodown_rc not in tmp_rc: + return "protodown %s missing in %s" % (protodown_rc, tmp_rc) + else: + if tmp_rc: + return "unexpected protodown rc %s" % (tmp_rc) + + return None + +def test_evpn_uplink_tracking(): + ''' + 1. Wait for access ports to come out of startup-delay + 2. disable uplinks and check if access ports have been protodowned + 3. enable uplinks and check if access ports have been moved out + of protodown + ''' + + tgen = get_topogen() + + dut_name = "torm11" + dut = tgen.gears[dut_name] + + # wait for protodown rc to clear after startup + test_fn = partial(check_protodown_rc, dut, None) + _, result = topotest.run_and_expect(test_fn, None, count=20, wait=3) + assertmsg = '"{}" protodown rc incorrect'.format(dut_name) + assert result is None, assertmsg + + # disable the uplinks + dut.run("ip link set %s-eth0 down" % dut_name) + dut.run("ip link set %s-eth1 down" % dut_name) + + # check if the access ports have been protodowned + test_fn = partial(check_protodown_rc, dut, "uplinkDown") + _, result = topotest.run_and_expect(test_fn, None, count=20, wait=3) + assertmsg = '"{}" protodown rc incorrect'.format(dut_name) + assert result is None, assertmsg + + # enable the uplinks + dut.run("ip link set %s-eth0 up" % dut_name) + dut.run("ip link set %s-eth1 up" % dut_name) + + # check if the access ports have been moved out of protodown + test_fn = partial(check_protodown_rc, dut, None) + _, result = topotest.run_and_expect(test_fn, None, count=20, wait=3) + assertmsg = '"{}" protodown rc incorrect'.format(dut_name) + assert result is None, assertmsg + if __name__ == "__main__": args = ["-s"] + sys.argv[1:] sys.exit(pytest.main(args)) diff --git a/tests/topotests/bgp-evpn-mh/torm11/zebra.conf b/tests/topotests/bgp-evpn-mh/torm11/zebra.conf index ee4e87e1c2..33e89c06ae 100644 --- a/tests/topotests/bgp-evpn-mh/torm11/zebra.conf +++ b/tests/topotests/bgp-evpn-mh/torm11/zebra.conf @@ -4,11 +4,15 @@ debug zebra evpn mh neigh debug zebra evpn mh nh debug zebra vxlan ! +evpn mh startup-delay 1 +! int torm11-eth0 ip addr 192.168.1.2/24 + evpn mh uplink ! int torm11-eth1 ip addr 192.168.5.2/24 + evpn mh uplink ! int lo ip addr 192.168.100.15/32 diff --git a/tests/topotests/bgp-evpn-mh/torm12/zebra.conf b/tests/topotests/bgp-evpn-mh/torm12/zebra.conf index 736af4159e..419f62b2ac 100644 --- a/tests/topotests/bgp-evpn-mh/torm12/zebra.conf +++ b/tests/topotests/bgp-evpn-mh/torm12/zebra.conf @@ -4,11 +4,16 @@ debug zebra evpn mh neigh debug zebra evpn mh nh debug zebra vxlan ! +evpn mh startup-delay 1 +! int torm12-eth0 ip addr 192.168.2.2/24 + evpn mh uplink ! int torm12-eth1 ip addr 192.168.6.2/24 + evpn mh uplink +! ! int lo ip addr 192.168.100.16/32 diff --git a/tests/topotests/bgp-evpn-mh/torm21/zebra.conf b/tests/topotests/bgp-evpn-mh/torm21/zebra.conf index 0ebe6f2d95..525f5eb099 100644 --- a/tests/topotests/bgp-evpn-mh/torm21/zebra.conf +++ b/tests/topotests/bgp-evpn-mh/torm21/zebra.conf @@ -4,11 +4,17 @@ debug zebra evpn mh neigh debug zebra evpn mh nh debug zebra vxlan ! +evpn mh startup-delay 1 +! int torm21-eth0 ip addr 192.168.3.2/24 + evpn mh uplink +! ! int torm21-eth1 ip addr 192.168.7.2/24 + evpn mh uplink +! ! int lo ip addr 192.168.100.17/32 diff --git a/tests/topotests/bgp-evpn-mh/torm22/evpn.conf b/tests/topotests/bgp-evpn-mh/torm22/evpn.conf index b4f4f1dc25..432135c94a 100644 --- a/tests/topotests/bgp-evpn-mh/torm22/evpn.conf +++ b/tests/topotests/bgp-evpn-mh/torm22/evpn.conf @@ -5,7 +5,6 @@ debug bgp evpn mh es debug bgp evpn mh route debug bgp zebra ! -! router bgp 65005 bgp router-id 192.168.100.18 no bgp ebgp-requires-policy diff --git a/tests/topotests/bgp-evpn-mh/torm22/zebra.conf b/tests/topotests/bgp-evpn-mh/torm22/zebra.conf index 356d8a43e7..398064df6c 100644 --- a/tests/topotests/bgp-evpn-mh/torm22/zebra.conf +++ b/tests/topotests/bgp-evpn-mh/torm22/zebra.conf @@ -4,11 +4,17 @@ debug zebra evpn mh neigh debug zebra evpn mh nh debug zebra vxlan ! +evpn mh startup-delay 1 +! int torm22-eth0 ip addr 192.168.4.2/24 + evpn mh uplink +! ! int torm22-eth1 ip addr 192.168.8.2/24 + evpn mh uplink +! ! int lo ip addr 192.168.100.18/32 diff --git a/tests/topotests/bgp-evpn-vxlan_topo1/test_bgp_evpn_vxlan.py b/tests/topotests/bgp-evpn-vxlan_topo1/test_bgp_evpn_vxlan.py index 2a14105383..5098808d55 100644..100755 --- a/tests/topotests/bgp-evpn-vxlan_topo1/test_bgp_evpn_vxlan.py +++ b/tests/topotests/bgp-evpn-vxlan_topo1/test_bgp_evpn_vxlan.py @@ -197,8 +197,12 @@ def mac_learn_test(host, local): host_output = host.vtysh_cmd("show interface {}-eth0".format(host.name)) int_lines = host_output.splitlines() - line_items = int_lines[7].split(": ") - mac = line_items[1] + for line in int_lines: + line_items = line.split(": ") + if "HWaddr" in line_items[0]: + mac = line_items[1] + break + mac_output = local.vtysh_cmd("show evpn mac vni 101 mac {} json".format(mac)) mac_output_json = json.loads(mac_output) assertmsg = "Local MAC output does not match interface mac {}".format(mac) @@ -287,8 +291,11 @@ def ip_learn_test(tgen, host, local, remote, ip_addr): "check the host IP gets learned by the VNI" host_output = host.vtysh_cmd("show interface {}-eth0".format(host.name)) int_lines = host_output.splitlines() - mac_line = int_lines[7].split(": ") - mac = mac_line[1] + for line in int_lines: + line_items = line.split(": ") + if "HWaddr" in line_items[0]: + mac = line_items[1] + break print(host_output) # check we have a local association between the MAC and IP diff --git a/tests/topotests/bgp-vrf-route-leak-basic/test_bgp-vrf-route-leak-basic.py b/tests/topotests/bgp-vrf-route-leak-basic/test_bgp-vrf-route-leak-basic.py index 5aa1bdf329..36f1d8cd56 100644 --- a/tests/topotests/bgp-vrf-route-leak-basic/test_bgp-vrf-route-leak-basic.py +++ b/tests/topotests/bgp-vrf-route-leak-basic/test_bgp-vrf-route-leak-basic.py @@ -90,84 +90,36 @@ def test_vrf_route_leak(): # Test DONNA VRF. expect = { - '10.0.0.0/24': [ - { - 'protocol': 'connected', - } + "10.0.0.0/24": [{"protocol": "connected",}], + "10.0.1.0/24": [ + {"protocol": "bgp", "selected": True, "nexthops": [{"fib": True}]} ], - '10.0.1.0/24': [ - { - 'protocol': 'bgp', - 'selected': True, - 'nexthops': [ - { - 'fib': True - } - ] - } + "10.0.2.0/24": [{"protocol": "connected"}], + "10.0.3.0/24": [ + {"protocol": "bgp", "selected": True, "nexthops": [{"fib": True}]} ], - '10.0.2.0/24': [ - { - 'protocol': 'connected' - } - ], - '10.0.3.0/24': [ - { - 'protocol': 'bgp', - 'selected': True, - 'nexthops': [ - { - 'fib': True - } - ] - } - ] } test_func = partial( - topotest.router_json_cmp, r1, 'show ip route vrf DONNA json', expect + topotest.router_json_cmp, r1, "show ip route vrf DONNA json", expect ) result, diff = topotest.run_and_expect(test_func, None, count=10, wait=0.5) assert result, "BGP VRF DONNA check failed:\n{}".format(diff) # Test EVA VRF. expect = { - '10.0.0.0/24': [ - { - 'protocol': 'bgp', - 'selected': True, - 'nexthops': [ - { - 'fib': True - } - ] - } - ], - '10.0.1.0/24': [ - { - 'protocol': 'connected', - } + "10.0.0.0/24": [ + {"protocol": "bgp", "selected": True, "nexthops": [{"fib": True}]} ], - '10.0.2.0/24': [ - { - 'protocol': 'bgp', - 'selected': True, - 'nexthops': [ - { - 'fib': True - } - ] - } + "10.0.1.0/24": [{"protocol": "connected",}], + "10.0.2.0/24": [ + {"protocol": "bgp", "selected": True, "nexthops": [{"fib": True}]} ], - '10.0.3.0/24': [ - { - 'protocol': 'connected', - } - ] + "10.0.3.0/24": [{"protocol": "connected",}], } test_func = partial( - topotest.router_json_cmp, r1, 'show ip route vrf EVA json', expect + topotest.router_json_cmp, r1, "show ip route vrf EVA json", expect ) result, diff = topotest.run_and_expect(test_func, None, count=10, wait=0.5) assert result, "BGP VRF EVA check failed:\n{}".format(diff) diff --git a/tests/topotests/bgp_default-route_route-map/__init__.py b/tests/topotests/bgp_aggregate_address_topo1/__init__.py index e69de29bb2..e69de29bb2 100644 --- a/tests/topotests/bgp_default-route_route-map/__init__.py +++ b/tests/topotests/bgp_aggregate_address_topo1/__init__.py diff --git a/tests/topotests/bgp_aggregate_address_topo1/exabgp.env b/tests/topotests/bgp_aggregate_address_topo1/exabgp.env new file mode 100644 index 0000000000..28e642360a --- /dev/null +++ b/tests/topotests/bgp_aggregate_address_topo1/exabgp.env @@ -0,0 +1,53 @@ +[exabgp.api] +encoder = text +highres = false +respawn = false +socket = '' + +[exabgp.bgp] +openwait = 60 + +[exabgp.cache] +attributes = true +nexthops = true + +[exabgp.daemon] +daemonize = true +pid = '/var/run/exabgp/exabgp.pid' +user = 'exabgp' +##daemonize = false + +[exabgp.log] +all = false +configuration = true +daemon = true +destination = '/var/log/exabgp.log' +enable = true +level = INFO +message = false +network = true +packets = false +parser = false +processes = true +reactor = true +rib = false +routes = false +short = false +timers = false + +[exabgp.pdb] +enable = false + +[exabgp.profile] +enable = false +file = '' + +[exabgp.reactor] +speed = 1.0 + +[exabgp.tcp] +acl = false +bind = '' +delay = 0 +once = false +port = 179 diff --git a/tests/topotests/bgp_aggregate_address_topo1/peer1/exabgp.cfg b/tests/topotests/bgp_aggregate_address_topo1/peer1/exabgp.cfg new file mode 100644 index 0000000000..e0f6ab601f --- /dev/null +++ b/tests/topotests/bgp_aggregate_address_topo1/peer1/exabgp.cfg @@ -0,0 +1,21 @@ +neighbor 10.0.0.1 { + router-id 10.254.254.3; + local-address 10.0.0.2; + local-as 65001; + peer-as 65000; + static { + route 10.254.254.3/32 next-hop 10.0.0.2; + + route 192.168.0.1/32 next-hop 10.0.0.2 med 10; + route 192.168.0.2/32 next-hop 10.0.0.2 med 10; + route 192.168.0.3/32 next-hop 10.0.0.2 med 10; + + route 192.168.1.1/32 next-hop 10.0.0.2 med 10; + route 192.168.1.2/32 next-hop 10.0.0.2 med 10; + route 192.168.1.3/32 next-hop 10.0.0.2 med 20; + + route 192.168.2.1/32 next-hop 10.0.0.2; + route 192.168.2.2/32 next-hop 10.0.0.2; + route 192.168.2.3/32 next-hop 10.0.0.2; + } +} diff --git a/tests/topotests/bgp_aggregate_address_topo1/r1/bgpd.conf b/tests/topotests/bgp_aggregate_address_topo1/r1/bgpd.conf new file mode 100644 index 0000000000..fa52150085 --- /dev/null +++ b/tests/topotests/bgp_aggregate_address_topo1/r1/bgpd.conf @@ -0,0 +1,30 @@ +debug bgp updates +! +access-list acl-sup-one seq 5 permit 192.168.2.1/32 +access-list acl-sup-one seq 10 deny any +! +access-list acl-sup-two seq 5 permit 192.168.2.2/32 +access-list acl-sup-two seq 10 deny any +! +access-list acl-sup-three seq 5 permit 192.168.2.3/32 +access-list acl-sup-three seq 10 deny any +! +route-map rm-sup-one permit 10 + match ip address acl-sup-one +! +route-map rm-sup-two permit 10 + match ip address acl-sup-two +! +router bgp 65000 + no bgp ebgp-requires-policy + neighbor 10.0.0.2 remote-as 65001 + neighbor 10.0.0.2 timers 3 10 + neighbor 10.0.1.2 remote-as internal + neighbor 10.0.1.2 timers 3 10 + address-family ipv4 unicast + redistribute connected + aggregate-address 192.168.0.0/24 matching-MED-only + aggregate-address 192.168.1.0/24 matching-MED-only + aggregate-address 192.168.2.0/24 suppress-map rm-sup-one + exit-address-family +! diff --git a/tests/topotests/bgp_aggregate_address_topo1/r1/zebra.conf b/tests/topotests/bgp_aggregate_address_topo1/r1/zebra.conf new file mode 100644 index 0000000000..931c73d8fa --- /dev/null +++ b/tests/topotests/bgp_aggregate_address_topo1/r1/zebra.conf @@ -0,0 +1,13 @@ +! +interface lo + ip address 10.254.254.1/32 +! +interface r1-eth0 + ip address 10.0.0.1/24 +! +interface r1-eth1 + ip address 10.0.1.1/24 +! +ip forwarding +ipv6 forwarding +! diff --git a/tests/topotests/bgp_aggregate_address_topo1/r2/bgpd.conf b/tests/topotests/bgp_aggregate_address_topo1/r2/bgpd.conf new file mode 100644 index 0000000000..acacd86526 --- /dev/null +++ b/tests/topotests/bgp_aggregate_address_topo1/r2/bgpd.conf @@ -0,0 +1,7 @@ +router bgp 65000 + neighbor 10.0.1.1 remote-as internal + neighbor 10.0.1.1 timers 3 10 + address-family ipv4 unicast + redistribute connected + exit-address-family +! diff --git a/tests/topotests/bgp_aggregate_address_topo1/r2/zebra.conf b/tests/topotests/bgp_aggregate_address_topo1/r2/zebra.conf new file mode 100644 index 0000000000..38e0c44299 --- /dev/null +++ b/tests/topotests/bgp_aggregate_address_topo1/r2/zebra.conf @@ -0,0 +1,10 @@ +! +interface lo + ip address 10.254.254.2/32 +! +interface r2-eth0 + ip address 10.0.1.2/24 +! +ip forwarding +ipv6 forwarding +! diff --git a/tests/topotests/bgp_aggregate_address_topo1/test_bgp_aggregate_address_topo1.py b/tests/topotests/bgp_aggregate_address_topo1/test_bgp_aggregate_address_topo1.py new file mode 100644 index 0000000000..089b1acb1c --- /dev/null +++ b/tests/topotests/bgp_aggregate_address_topo1/test_bgp_aggregate_address_topo1.py @@ -0,0 +1,298 @@ +#!/usr/bin/env python + +# +# test_bgp_aggregate_address_topo1.py +# Part of NetDEF Topology Tests +# +# Copyright (c) 2020 by +# Network Device Education Foundation, Inc. ("NetDEF") +# +# Permission to use, copy, modify, and/or distribute this software +# for any purpose with or without fee is hereby granted, provided +# that the above copyright notice and this permission notice appear +# in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY +# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. +# + +""" +Test BGP aggregate address features. +""" + +import os +import sys +import json +import time +import pytest +import functools + +CWD = os.path.dirname(os.path.realpath(__file__)) +sys.path.append(os.path.join(CWD, "../")) + +# pylint: disable=C0413 +from lib import topotest +from lib.topogen import Topogen, TopoRouter, get_topogen +from lib.topolog import logger +from mininet.topo import Topo + + +class BgpAggregateAddressTopo1(Topo): + def build(self, *_args, **_opts): + tgen = get_topogen(self) + + r1 = tgen.add_router("r1") + r2 = tgen.add_router("r2") + peer1 = tgen.add_exabgp_peer( + "peer1", ip="10.0.0.2", defaultRoute="via 10.0.0.1" + ) + + switch = tgen.add_switch("s1") + switch.add_link(r1) + switch.add_link(peer1) + + switch = tgen.add_switch("s2") + switch.add_link(r1) + switch.add_link(r2) + + +def setup_module(mod): + tgen = Topogen(BgpAggregateAddressTopo1, mod.__name__) + tgen.start_topology() + + router = tgen.gears["r1"] + router.load_config(TopoRouter.RD_ZEBRA, os.path.join(CWD, "r1/zebra.conf")) + router.load_config(TopoRouter.RD_BGP, os.path.join(CWD, "r1/bgpd.conf")) + router.start() + + router = tgen.gears["r2"] + router.load_config(TopoRouter.RD_ZEBRA, os.path.join(CWD, "r2/zebra.conf")) + router.load_config(TopoRouter.RD_BGP, os.path.join(CWD, "r2/bgpd.conf")) + router.start() + + peer = tgen.gears["peer1"] + peer.start(os.path.join(CWD, "peer1"), os.path.join(CWD, "exabgp.env")) + + +def teardown_module(mod): + tgen = get_topogen() + tgen.stop_topology() + + +def expect_route(router_name, routes_expected): + "Helper function to avoid repeated code." + tgen = get_topogen() + test_func = functools.partial( + topotest.router_json_cmp, + tgen.gears[router_name], + "show ip route json", + routes_expected, + ) + _, result = topotest.run_and_expect(test_func, None, count=120, wait=1) + assertmsg = '"{}" BGP convergence failure'.format(router_name) + assert result is None, assertmsg + + +def test_expect_convergence(): + "Test that BGP protocol converged." + + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + logger.info("waiting for protocols to converge") + + def expect_loopback_route(router, iptype, route, proto): + "Wait until route is present on RIB for protocol." + logger.info("waiting route {} in {}".format(route, router)) + test_func = functools.partial( + topotest.router_json_cmp, + tgen.gears[router], + "show {} route json".format(iptype), + {route: [{"protocol": proto}]}, + ) + _, result = topotest.run_and_expect(test_func, None, count=130, wait=1) + assertmsg = '"{}" BGP convergence failure'.format(router) + assert result is None, assertmsg + + expect_loopback_route("r2", "ip", "10.254.254.1/32", "bgp") + expect_loopback_route("r2", "ip", "10.254.254.3/32", "bgp") + + +def test_bgp_aggregate_address_matching_med_only(): + "Test that the command matching-MED-only works." + + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + routes_expected = { + # All MED matches, aggregation must exist. + "192.168.0.0/24": [{"protocol": "bgp", "metric": 0}], + "192.168.0.1/32": [{"protocol": "bgp", "metric": 10}], + "192.168.0.2/32": [{"protocol": "bgp", "metric": 10}], + "192.168.0.3/32": [{"protocol": "bgp", "metric": 10}], + # Non matching MED: aggregation must not exist. + "192.168.1.0/24": None, + "192.168.1.1/32": [{"protocol": "bgp", "metric": 10}], + "192.168.1.2/32": [{"protocol": "bgp", "metric": 10}], + "192.168.1.3/32": [{"protocol": "bgp", "metric": 20}], + } + + test_func = functools.partial( + topotest.router_json_cmp, + tgen.gears["r2"], + "show ip route json", + routes_expected, + ) + _, result = topotest.run_and_expect(test_func, None, count=20, wait=1) + assertmsg = '"r2" BGP convergence failure' + assert result is None, assertmsg + + +def test_bgp_aggregate_address_match_and_suppress(): + "Test that the command matching-MED-only with suppression works." + + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + tgen.gears["r1"].vtysh_multicmd( + """ +configure terminal +router bgp 65000 +address-family ipv4 unicast +no aggregate-address 192.168.0.0/24 matching-MED-only +no aggregate-address 192.168.1.0/24 matching-MED-only +aggregate-address 192.168.0.0/24 matching-MED-only summary-only +aggregate-address 192.168.1.0/24 matching-MED-only summary-only +""" + ) + + routes_expected = { + # All MED matches, aggregation must exist. + "192.168.0.0/24": [{"protocol": "bgp", "metric": 0}], + "192.168.0.1/32": None, + "192.168.0.2/32": None, + "192.168.0.3/32": None, + # Non matching MED: aggregation must not exist. + "192.168.1.0/24": None, + "192.168.1.1/32": [{"protocol": "bgp", "metric": 10}], + "192.168.1.2/32": [{"protocol": "bgp", "metric": 10}], + "192.168.1.3/32": [{"protocol": "bgp", "metric": 20}], + } + + test_func = functools.partial( + topotest.router_json_cmp, + tgen.gears["r2"], + "show ip route json", + routes_expected, + ) + _, result = topotest.run_and_expect(test_func, None, count=120, wait=1) + assertmsg = '"r2" BGP convergence failure' + assert result is None, assertmsg + + +def test_bgp_aggregate_address_suppress_map(): + "Test that the command suppress-map works." + + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + expect_route( + "r2", + { + "192.168.2.0/24": [{"protocol": "bgp"}], + "192.168.2.1/32": None, + "192.168.2.2/32": [{"protocol": "bgp"}], + "192.168.2.3/32": [{"protocol": "bgp"}], + }, + ) + + # Change route map and test again. + tgen.gears["r1"].vtysh_multicmd( + """ +configure terminal +router bgp 65000 +address-family ipv4 unicast +no aggregate-address 192.168.2.0/24 suppress-map rm-sup-one +aggregate-address 192.168.2.0/24 suppress-map rm-sup-two +""" + ) + + expect_route( + "r2", + { + "192.168.2.0/24": [{"protocol": "bgp"}], + "192.168.2.1/32": [{"protocol": "bgp"}], + "192.168.2.2/32": None, + "192.168.2.3/32": [{"protocol": "bgp"}], + }, + ) + + +def test_bgp_aggregate_address_suppress_map_update_route_map(): + "Test that the suppress-map late route map creation works." + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + tgen.gears["r1"].vtysh_multicmd( + """ +configure terminal +router bgp 65000 +address-family ipv4 unicast +no aggregate-address 192.168.2.0/24 suppress-map rm-sup-two +aggregate-address 192.168.2.0/24 suppress-map rm-sup-three +""" + ) + + expect_route( + "r2", + { + "192.168.2.0/24": [{"protocol": "bgp"}], + "192.168.2.1/32": [{"protocol": "bgp"}], + "192.168.2.2/32": [{"protocol": "bgp"}], + "192.168.2.3/32": [{"protocol": "bgp"}], + }, + ) + + # Create missing route map and test again. + tgen.gears["r1"].vtysh_multicmd( + """ +configure terminal +route-map rm-sup-three permit 10 +match ip address acl-sup-three +""" + ) + + expect_route( + "r2", + { + "192.168.2.0/24": [{"protocol": "bgp"}], + "192.168.2.1/32": [{"protocol": "bgp"}], + "192.168.2.2/32": [{"protocol": "bgp"}], + "192.168.2.3/32": None, + }, + ) + + +def test_memory_leak(): + "Run the memory leak test and report results." + tgen = get_topogen() + if not tgen.is_memleak_enabled(): + pytest.skip("Memory leak test/report is disabled") + + tgen.report_memory_leaks() + + +if __name__ == "__main__": + args = ["-s"] + sys.argv[1:] + sys.exit(pytest.main(args)) diff --git a/tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py b/tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py index f9d22a3a36..544bda145c 100644 --- a/tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py +++ b/tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py @@ -65,7 +65,7 @@ from lib.common_config import ( create_route_maps, check_address_types, step, - required_linux_kernel_version + required_linux_kernel_version, ) from lib.topolog import logger from lib.bgp import ( @@ -114,7 +114,7 @@ def setup_module(mod): """ # Required linux kernel version for this suite to run. - result = required_linux_kernel_version('4.15') + result = required_linux_kernel_version("4.15") if result is not True: pytest.skip("Kernel requirements are not met") diff --git a/tests/topotests/bgp_communities_topo1/bgp_communities_topo2.json b/tests/topotests/bgp_communities_topo1/bgp_communities_topo2.json new file mode 100644 index 0000000000..fa89f6b8f2 --- /dev/null +++ b/tests/topotests/bgp_communities_topo1/bgp_communities_topo2.json @@ -0,0 +1,191 @@ +{ + "address_types": [ + "ipv4", + "ipv6" + ], + "ipv4base": "10.0.0.0", + "ipv4mask": 24, + "ipv6base": "fd00::", + "ipv6mask": 64, + "link_ip_start": { + "ipv4": "10.0.0.0", + "v4mask": 24, + "ipv6": "fd00::", + "v6mask": 64 + }, + "lo_prefix": { + "ipv4": "1.0.", + "v4mask": 32, + "ipv6": "2001:db8:f::", + "v6mask": 128 + }, + "routers": { + "r1": { + "links": { + "lo": { + "ipv4": "auto", + "ipv6": "auto", + "type": "loopback" + }, + "r2": { + "ipv4": "auto", + "ipv6": "auto" + }, + "r3": { + "ipv4": "auto", + "ipv6": "auto" + } + }, + "bgp": { + "local_as": "100", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1": {} + } + }, + "r3": { + "dest_link": { + "r1": { + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1": { + } + } + }, + "r3": { + "dest_link": { + "r1": { + } + } + } + } + } + } + } + } + }, + "r2": { + "links": { + "lo": { + "ipv4": "auto", + "ipv6": "auto", + "type": "loopback" + }, + "r1": { + "ipv4": "auto", + "ipv6": "auto" + } + }, + "bgp": { + "local_as": "100", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r2": {} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r2": { + "route_maps": [{ + "name": "rmap_global", + "direction": "in" + }] + } + } + } + } + } + } + } + }, + "route_maps": { + "rmap_global": [{ + "action": "permit", + "set": { + "ipv6": { + "nexthop": "prefer-global" + } + } + }] + } + }, + "r3": { + "links": { + "lo": { + "ipv4": "auto", + "ipv6": "auto", + "type": "loopback" + }, + "r1": { + "ipv4": "auto", + "ipv6": "auto" + } + }, + "bgp": { + "local_as": "300", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r3": {} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r3": { + "route_maps": [{ + "name": "rmap_global", + "direction": "in" + }] + } + } + } + } + } + } + } + }, + "route_maps": { + "rmap_global": [{ + "action": "permit", + "set": { + "ipv6": { + "nexthop": "prefer-global" + } + } + }] + } + } + } +} diff --git a/tests/topotests/bgp_communities_topo1/test_bgp_communities.py b/tests/topotests/bgp_communities_topo1/test_bgp_communities.py index 57e8e0d34a..f2e54b24d6 100644 --- a/tests/topotests/bgp_communities_topo1/test_bgp_communities.py +++ b/tests/topotests/bgp_communities_topo1/test_bgp_communities.py @@ -54,7 +54,7 @@ from lib.common_config import ( create_route_maps, create_prefix_lists, create_route_maps, - required_linux_kernel_version + required_linux_kernel_version, ) from lib.topolog import logger from lib.bgp import ( @@ -104,7 +104,7 @@ def setup_module(mod): """ # Required linux kernel version for this suite to run. - result = required_linux_kernel_version('4.15') + result = required_linux_kernel_version("4.15") if result is not True: pytest.skip("Kernel requirements are not met") diff --git a/tests/topotests/bgp_communities_topo1/test_bgp_communities_topo2.py b/tests/topotests/bgp_communities_topo1/test_bgp_communities_topo2.py new file mode 100644 index 0000000000..c0842148f1 --- /dev/null +++ b/tests/topotests/bgp_communities_topo1/test_bgp_communities_topo2.py @@ -0,0 +1,422 @@ +#!/usr/bin/python + +# +# Copyright (c) 2020 by VMware, Inc. ("VMware") +# Used Copyright (c) 2018 by Network Device Education Foundation, +# Inc. ("NetDEF") in this file. +# +# Permission to use, copy, modify, and/or distribute this software +# for any purpose with or without fee is hereby granted, provided +# that the above copyright notice and this permission notice appear +# in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND VMWARE DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VMWARE BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY +# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. +# + +""" +Following tests are covered to test bgp community functionality: +1. Verify that BGP well known communities work fine for + eBGP and iBGP peers. + Well known communities tested: no-export, local-AS, internet + +""" + +import os +import sys +import time +import json +import pytest + +# 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 mininet.topo import Topo +from lib.topogen import Topogen, get_topogen + +# Import topoJson from lib, to create topology and initial configuration +from lib.common_config import ( + start_topology, + write_test_header, + write_test_footer, + reset_config_on_routers, + verify_rib, + create_static_routes, + check_address_types, + step, + create_route_maps, + create_prefix_lists, + create_route_maps, + required_linux_kernel_version, +) + +from lib.topolog import logger +from lib.bgp import ( + verify_bgp_convergence, + create_router_bgp, + clear_bgp_and_verify, + verify_bgp_rib, + verify_bgp_community, +) +from lib.topojson import build_topo_from_json, build_config_from_json +from copy import deepcopy + +# Reading the data from JSON File for topology creation +jsonFile = "{}/bgp_communities_topo2.json".format(CWD) +try: + with open(jsonFile, "r") as topoJson: + topo = json.load(topoJson) +except IOError: + assert False, "Could not read file {}".format(jsonFile) + +# Global variables +BGP_CONVERGENCE = False +ADDR_TYPES = check_address_types() +NETWORK = { + "ipv4": ["192.0.2.1/32", "192.0.2.2/32"], + "ipv6": ["2001:DB8::1:1/128", "2001:DB8::1:2/128"], +} + + +class BGPCOMMUNITIES(Topo): + """ + Test BGPCOMMUNITIES - topology 1 + + * `Topo`: Topology object + """ + + def build(self, *_args, **_opts): + """Build function""" + tgen = get_topogen(self) + + # Building topology from json file + build_topo_from_json(tgen, topo) + + +def setup_module(mod): + """ + Sets up the pytest environment + + * `mod`: module name + """ + + # Required linux kernel version for this suite to run. + result = required_linux_kernel_version("4.14") + if result is not True: + pytest.skip("Kernel requirements are not met") + + testsuite_run_time = time.asctime(time.localtime(time.time())) + logger.info("Testsuite start time: {}".format(testsuite_run_time)) + logger.info("=" * 40) + + logger.info("Running setup_module to create topology") + + # This function initiates the topology build with Topogen... + tgen = Topogen(BGPCOMMUNITIES, mod.__name__) + # ... and here it calls Mininet initialization functions. + + # Starting topology, create tmp files which are loaded to routers + # to start deamons and then start routers + start_topology(tgen) + + # Creating configuration from JSON + build_config_from_json(tgen, topo) + + # Checking BGP convergence + global BGP_CONVERGENCE + global ADDR_TYPES + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Api call verify whether BGP is converged + BGP_CONVERGENCE = verify_bgp_convergence(tgen, topo) + assert BGP_CONVERGENCE is True, "setup_module :Failed \n Error:" " {}".format( + BGP_CONVERGENCE + ) + + logger.info("Running setup_module() done") + + +def teardown_module(mod): + """ + Teardown the pytest environment + + * `mod`: module name + """ + + logger.info("Running teardown_module to delete topology") + + tgen = get_topogen() + + # Stop toplogy and Remove tmp files + tgen.stop_topology() + + logger.info( + "Testsuite end time: {}".format(time.asctime(time.localtime(time.time()))) + ) + logger.info("=" * 40) + + +##################################################### +# +# Tests starting +# +##################################################### + + +def test_bgp_no_export_local_as_and_internet_communities_p0(request): + """ + Verify that BGP well known communities work fine for + eBGP and iBGP peers. + Well known communities tested: no-export, local-AS, internet + """ + + tc_name = request.node.name + write_test_header(tc_name) + tgen = get_topogen() + + # Don"t run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + step("Initial config: Configure BGP neighborship between R1 and R3.") + reset_config_on_routers(tgen) + + step("Configure static routes on R1 with next-hop as null0") + for addr_type in ADDR_TYPES: + input_dict_4 = { + "r1": { + "static_routes": [{"network": NETWORK[addr_type], "next_hop": "null0"}] + } + } + result = create_static_routes(tgen, input_dict_4) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) + + for comm_type in ["no-export", "local-AS", "internet"]: + + step("Create a route-map on R1 to set community as {}".format(comm_type)) + + seq_id = 10 + input_rmap = { + "r1": { + "route_maps": { + "rmap_wkc": [ + { + "action": "permit", + "seq_id": seq_id, + "set": {"community": {"num": "{}".format(comm_type)}}, + } + ] + } + } + } + result = create_route_maps(tgen, input_rmap) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) + + step("Apply route-map while redistributing static routes into BGP") + input_dict_2 = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "redistribute": [ + { + "redist_type": "static", + "attribute": {"route-map": "rmap_wkc"}, + } + ] + } + }, + "ipv6": { + "unicast": { + "redistribute": [ + { + "redist_type": "static", + "attribute": {"route-map": "rmap_wkc"}, + } + ] + } + }, + } + } + } + } + result = create_router_bgp(tgen, topo, input_dict_2) + + step("Verify that BGP prefixes on R1 have community: {}".format(comm_type)) + input_dict_4 = {"community": "{}".format(comm_type)} + for addr_type in ADDR_TYPES: + result = verify_bgp_community( + tgen, addr_type, "r1", NETWORK[addr_type], input_dict_4 + ) + assert result is True, "Test case {} : Should fail \n Error: {}".format( + tc_name, result + ) + + for addr_type in ADDR_TYPES: + input_dict_4 = { + "r1": { + "static_routes": [ + { + "network": NETWORK[addr_type], + "next_hop": topo["routers"]["r2"]["links"]["r1"][ + addr_type + ].split("/")[0], + } + ] + } + } + result = verify_bgp_rib( + tgen, + addr_type, + "r2", + input_dict_4, + next_hop=topo["routers"]["r1"]["links"]["r2"][addr_type].split("/")[0], + ) + assert result is True, "Testcase : Failed \n Error: {}".format( + tc_name, result + ) + + if comm_type == "internet": + step( + "Verify that these prefixes, originated on R1, are" + "received on both R2 and R3" + ) + + result = verify_rib( + tgen, + addr_type, + "r3", + input_dict_4, + next_hop=topo["routers"]["r1"]["links"]["r3"][addr_type].split("/")[ + 0 + ], + ) + assert result is True, "Testcase : Failed \n Error: {}".format( + tc_name, result + ) + else: + step( + "Verify that these prefixes, originated on R1, are not" + "received on R3 but received on R2" + ) + + result = verify_rib( + tgen, + addr_type, + "r3", + input_dict_4, + next_hop=topo["routers"]["r1"]["links"]["r3"][addr_type].split("/")[ + 0 + ], + expected=False, + ) + assert result is not True, "Testcase : Failed \n Error: {}".format( + tc_name, result + ) + + step("Remove route-map from redistribute static on R1") + input_dict_2 = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "redistribute": [ + {"redist_type": "static", "delete": True} + ] + } + }, + "ipv6": { + "unicast": { + "redistribute": [ + {"redist_type": "static", "delete": True} + ] + } + }, + } + } + } + } + result = create_router_bgp(tgen, topo, input_dict_2) + assert result is True, "Testcase : Failed \n Error: {}".format(tc_name, result) + + step("Configure redistribute static") + input_dict_2 = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": {"redistribute": [{"redist_type": "static"}]} + }, + "ipv6": { + "unicast": {"redistribute": [{"redist_type": "static"}]} + }, + } + } + } + } + result = create_router_bgp(tgen, topo, input_dict_2) + assert result is True, "Testcase : Failed \n Error: {}".format(tc_name, result) + + step( + "Verify that these prefixes, originated on R1, are now" + "received on both routers R2 and R3" + ) + for addr_type in ADDR_TYPES: + input_dict_4 = { + "r1": { + "static_routes": [ + { + "network": NETWORK[addr_type], + "next_hop": topo["routers"]["r2"]["links"]["r1"][ + addr_type + ].split("/")[0], + } + ] + } + } + result = verify_bgp_rib( + tgen, + addr_type, + "r2", + input_dict_4, + next_hop=topo["routers"]["r1"]["links"]["r2"][addr_type].split("/")[0], + ) + assert result is True, "Testcase : Failed \n Error: {}".format( + tc_name, result + ) + + result = verify_bgp_rib( + tgen, + addr_type, + "r3", + input_dict_4, + next_hop=topo["routers"]["r1"]["links"]["r3"][addr_type].split("/")[0], + ) + assert result is True, "Testcase : Failed \n Error: {}".format( + tc_name, result + ) + + write_test_footer(tc_name) + + +if __name__ == "__main__": + args = ["-s"] + sys.argv[1:] + sys.exit(pytest.main(args)) diff --git a/tests/topotests/bgp_conditional_advertisement/__init__.py b/tests/topotests/bgp_conditional_advertisement/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/bgp_conditional_advertisement/__init__.py diff --git a/tests/topotests/bgp_conditional_advertisement/r1/bgpd.conf b/tests/topotests/bgp_conditional_advertisement/r1/bgpd.conf new file mode 100644 index 0000000000..633d1832fd --- /dev/null +++ b/tests/topotests/bgp_conditional_advertisement/r1/bgpd.conf @@ -0,0 +1,30 @@ +! +ip prefix-list CUST seq 5 permit 10.139.224.0/20 +ip prefix-list DEFAULT seq 5 permit 0.0.0.0/0 +ip prefix-list PL1 seq 5 permit 192.0.2.1/32 +! +route-map CUST permit 10 + match ip address prefix-list CUST + set community 64671:501 +! +route-map RM1 permit 10 + match ip address prefix-list PL1 + set community 64952:3008 +! +route-map DEF permit 10 + match ip address prefix-list DEFAULT + set community 64848:3011 65011:200 65013:200 +! +router bgp 1 + bgp log-neighbor-changes + no bgp ebgp-requires-policy + neighbor 10.10.10.2 remote-as 2 + ! + address-family ipv4 unicast + network 0.0.0.0/0 route-map DEF + network 192.0.2.1/32 route-map RM1 + network 192.0.2.5/32 + redistribute connected route-map CUST + neighbor 10.10.10.2 soft-reconfiguration inbound + exit-address-family +! diff --git a/tests/topotests/bgp_conditional_advertisement/r1/zebra.conf b/tests/topotests/bgp_conditional_advertisement/r1/zebra.conf new file mode 100644 index 0000000000..bb887e41ad --- /dev/null +++ b/tests/topotests/bgp_conditional_advertisement/r1/zebra.conf @@ -0,0 +1,19 @@ +! +hostname Router1 +! +ip route 0.0.0.0/0 blackhole +ip route 192.0.2.1/32 blackhole +ip route 192.0.2.2/32 blackhole +ip route 192.0.2.3/32 blackhole +ip route 192.0.2.4/32 blackhole +ip route 192.0.2.5/32 blackhole +! +interface r1-eth0 + ip address 10.10.10.1/24 +! +interface lo + ip address 10.139.224.1/20 +! +ip forwarding +ipv6 forwarding +! diff --git a/tests/topotests/bgp_conditional_advertisement/r2/bgpd.conf b/tests/topotests/bgp_conditional_advertisement/r2/bgpd.conf new file mode 100644 index 0000000000..c6147fe658 --- /dev/null +++ b/tests/topotests/bgp_conditional_advertisement/r2/bgpd.conf @@ -0,0 +1,44 @@ +! +ip prefix-list DEFAULT seq 5 permit 192.0.2.5/32 +ip prefix-list DEFAULT seq 10 permit 192.0.2.1/32 +ip prefix-list EXIST seq 5 permit 10.10.10.10/32 +ip prefix-list DEFAULT-ROUTE seq 5 permit 0.0.0.0/0 +ip prefix-list IP1 seq 5 permit 10.139.224.0/20 +ip prefix-list IP2 seq 5 permit 203.0.113.1/32 +! +bgp community-list standard DC-ROUTES seq 5 permit 64952:3008 +bgp community-list standard DC-ROUTES seq 10 permit 64671:501 +bgp community-list standard DC-ROUTES seq 15 permit 64950:3009 +bgp community-list standard DEFAULT-ROUTE seq 5 permit 65013:200 +! +route-map ADV-MAP-1 permit 10 + match ip address prefix-list IP1 +! +route-map ADV-MAP-1 permit 20 + match community DC-ROUTES +! +route-map ADV-MAP-2 permit 10 + match ip address prefix-list IP2 +! +route-map EXIST-MAP permit 10 + match community DEFAULT-ROUTE + match ip address prefix-list DEFAULT-ROUTE +! +route-map RMAP-1 deny 10 + match ip address prefix-list IP1 +! +route-map RMAP-2 deny 10 + match ip address prefix-list IP2 +! +router bgp 2 + bgp log-neighbor-changes + no bgp ebgp-requires-policy + neighbor 10.10.10.1 remote-as 1 + neighbor 10.10.20.3 remote-as 3 + ! + address-family ipv4 unicast + network 203.0.113.1/32 + neighbor 10.10.10.1 soft-reconfiguration inbound + neighbor 10.10.20.3 soft-reconfiguration inbound + exit-address-family +! diff --git a/tests/topotests/bgp_conditional_advertisement/r2/zebra.conf b/tests/topotests/bgp_conditional_advertisement/r2/zebra.conf new file mode 100644 index 0000000000..434ab68e3c --- /dev/null +++ b/tests/topotests/bgp_conditional_advertisement/r2/zebra.conf @@ -0,0 +1,15 @@ +! +hostname Router2 +! +interface r2-eth0 + ip address 10.10.10.2/24 +! +interface r2-eth1 + ip address 10.10.20.2/24 +! +interface lo + ip address 203.0.113.1/32 +! +ip forwarding +ipv6 forwarding +! diff --git a/tests/topotests/bgp_conditional_advertisement/r3/bgpd.conf b/tests/topotests/bgp_conditional_advertisement/r3/bgpd.conf new file mode 100644 index 0000000000..2f4f5068d8 --- /dev/null +++ b/tests/topotests/bgp_conditional_advertisement/r3/bgpd.conf @@ -0,0 +1,11 @@ +! +router bgp 3 + bgp log-neighbor-changes + no bgp ebgp-requires-policy + neighbor 10.10.20.2 remote-as 2 + ! + address-family ipv4 unicast + neighbor 10.10.20.2 soft-reconfiguration inbound + exit-address-family +! + diff --git a/tests/topotests/bgp_conditional_advertisement/r3/zebra.conf b/tests/topotests/bgp_conditional_advertisement/r3/zebra.conf new file mode 100644 index 0000000000..0dadfdb3a9 --- /dev/null +++ b/tests/topotests/bgp_conditional_advertisement/r3/zebra.conf @@ -0,0 +1,12 @@ +! +hostname Router3 +! +interface r3-eth0 + ip address 10.10.20.3/24 +! +interface lo + ip address 198.51.100.1/32 +! +ip forwarding +ipv6 forwarding +! diff --git a/tests/topotests/bgp_conditional_advertisement/test_bgp_conditional_advertisement.py b/tests/topotests/bgp_conditional_advertisement/test_bgp_conditional_advertisement.py new file mode 100644 index 0000000000..0e31ab1995 --- /dev/null +++ b/tests/topotests/bgp_conditional_advertisement/test_bgp_conditional_advertisement.py @@ -0,0 +1,961 @@ +#!/usr/bin/env python + +# +# test_bgp_conditional_advertisement.py +# +# Copyright (c) 2020 by +# Samsung R&D Institute India - Bangalore. +# Madhurilatha Kuruganti +# +# Permission to use, copy, modify, and/or distribute this software +# for any purpose with or without fee is hereby granted, provided +# that the above copyright notice and this permission notice appear +# in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY +# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. +# + +""" +Test BGP conditional advertisement functionality. + + +--------+ +--------+ +--------+ + | | | | | | + | R1 |------------| R2 |------------| R3 | + | | | | | | + +--------+ +--------+ +--------+ + +R2 is DUT and peers with R1 and R3 in default bgp instance. + +Following tests are covered under BGP conditional advertisement functionality. +Conditional advertisement +------------------------- +TC11: R3 BGP convergence, without advertise-map configuration. + All routes are advertised to R3. + +TC21: exist-map routes present in R2's BGP table. + advertise-map routes present in R2's BGP table are advertised to R3. +TC22: exist-map routes not present in R2's BGP table + advertise-map routes present in R2's BGP table are withdrawn from R3. +TC31: non-exist-map routes not present in R2's BGP table + advertise-map routes present in R2's BGP table are advertised to R3. +TC32: non-exist-map routes present in R2's BGP table + advertise-map routes present in R2's BGP table are withdrawn from R3. + +TC41: non-exist-map route-map configuration removed in R2. + advertise-map routes present in R2's BGP table are advertised to R3. +TC42: exist-map route-map configuration removed in R2 + advertise-map routes present in R2's BGP table are withdrawn from R3. + +Conditional advertisement(received routes) along with Route-map Filter +---------------------------------------------------------------------- +TC51: exist-map routes present in R2's BGP table, with route-map filter. + All routes are withdrawn from R3 except advertise-map routes. +TC52: exist-map routes present in R2's BGP table, without route-map filter. + All routes are advertised to R3 including advertise-map routes. +TC53: non-exist-map routes present in R2's BGP table, with route-map filter. + All routes are withdrawn from R3 including advertise-map routes. +TC54: non-exist-map routes present in R2's BGP table, without route-map filter. + All routes are advertised to R3 except advertise-map routes. + +TC61: exist-map routes not present in R2's BGP table, with route-map filter. + All routes are withdrawn from R3 including advertise-map routes. +TC62: exist-map routes not present in R2's BGP table, without route-map filter. + All routes are advertised to R3 except advertise-map routes. +TC63: non-exist-map routes not present in R2's BGP table, with route-map filter. + All routes are withdrawn from R3 except advertise-map routes. +TC64: non-exist-map routes not present in R2's BGP table, without route-map filter. + All routes are advertised to R3 including advertise-map routes. + +Conditional advertisement(attached routes) along with Route-map Filter +----------------------------------------------------------------- +TC71: exist-map routes present in R2's BGP table, with route-map filter. + All routes are withdrawn from R3 except advertise-map routes. +TC72: exist-map routes present in R2's BGP table, without route-map filter. + All routes are advertised to R3 including advertise-map routes. +TC73: non-exist-map routes present in R2's BGP table, with route-map filter. + All routes are withdrawn from R3 including advertise-map routes. +TC74: non-exist-map routes present in R2's BGP table, without route-map filter. + All routes are advertised to R3 except advertise-map routes. + +TC81: exist-map routes not present in R2's BGP table, with route-map filter. + All routes are withdrawn from R3 including advertise-map routes. +TC82: exist-map routes not present in R2's BGP table, without route-map filter. + All routes are advertised to R3 except advertise-map routes. +TC83: non-exist-map routes not present in R2's BGP table, with route-map filter. + All routes are withdrawn from R3 except advertise-map routes. +TC84: non-exist-map routes not present in R2's BGP table, without route-map filter. + All routes are advertised to R3 including advertise-map routes. + +TC91: exist-map routes present in R2's BGP table, with route-map filter and network. + All routes are advertised to R3 including advertise-map routes. +TC92: exist-map routes present in R2's BGP table, with route-map filter and no network. + All routes are advertised to R3 except advertise-map routes. +TC93: non-exist-map routes not present in R2's BGP table, with route-map filter and network. + All routes are advertised to R3 including advertise-map routes. +TC94: non-exist-map routes not present in R2's BGP table, with route-map filter and no network. + All routes are advertised to R3 except advertise-map routes. + +i.e. ++----------------+-------------------------+------------------------+ +| Routes in | exist-map status | advertise-map status | +| BGP table | | | ++----------------+-------------------------+------------------------+ +| Present | Condition matched | Advertise | ++----------------+-------------------------+------------------------+ +| Not Present | Condition not matched | Withdrawn | ++----------------+-------------------------+------------------------+ +| | non-exist-map status | advertise-map status | +| | | | ++----------------+-------------------------+------------------------+ +| Present | Condition matched | Withdrawn | ++----------------+-------------------------+------------------------+ +| Not Present | Condition not matched | Advertise | ++----------------+-------------------------+------------------------+ +Here in this topology, based on the default route presence in R2 and +the configured condition-map (exist-map/non-exist-map) 10.139.224.0/20 +will be either advertised/withdrawn to/from R3. +""" + +import os +import sys +import json +import time +import pytest +import functools + +CWD = os.path.dirname(os.path.realpath(__file__)) +sys.path.append(os.path.join(CWD, "../")) + +# pylint: disable=C0413 +from lib import topotest +from lib.topogen import Topogen, TopoRouter, get_topogen +from lib.topolog import logger +from mininet.topo import Topo + + +class BgpConditionalAdvertisementTopo(Topo): + def build(self, *_args, **_opts): + tgen = get_topogen(self) + + r1 = tgen.add_router("r1") + r2 = tgen.add_router("r2") + r3 = tgen.add_router("r3") + + switch = tgen.add_switch("s1") + switch.add_link(r1) + switch.add_link(r2) + + switch = tgen.add_switch("s2") + switch.add_link(r2) + switch.add_link(r3) + + +def setup_module(mod): + testsuite_run_time = time.asctime(time.localtime(time.time())) + logger.info("Testsuite start time: {}".format(testsuite_run_time)) + logger.info("=" * 40) + + logger.info("Running setup_module to create topology") + + tgen = Topogen(BgpConditionalAdvertisementTopo, mod.__name__) + tgen.start_topology() + + router_list = tgen.routers() + + for i, (rname, router) in enumerate(router_list.items(), 1): + router.load_config( + TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname)) + ) + router.load_config( + TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname)) + ) + + tgen.start_router() + + logger.info("Running setup_module() done") + + +def teardown_module(mod): + """ + Teardown the pytest environment + * `mod`: module name + """ + + logger.info("Running teardown_module to delete topology") + + tgen = get_topogen() + tgen.stop_topology() + + logger.info( + "Testsuite end time: {}".format(time.asctime(time.localtime(time.time()))) + ) + logger.info("=" * 40) + + +def test_bgp_conditional_advertisement(): + """ + Test BGP conditional advertisement functionality. + """ + + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router1 = tgen.gears["r1"] + router2 = tgen.gears["r2"] + router3 = tgen.gears["r3"] + + passed = "PASSED!!!" + failed = "FAILED!!!" + + def _all_routes_advertised(router): + output = json.loads(router.vtysh_cmd("show ip route json")) + expected = { + "0.0.0.0/0": [{"protocol": "bgp"}], + "192.0.2.1/32": [{"protocol": "bgp"}], + "192.0.2.5/32": [{"protocol": "bgp"}], + "10.139.224.0/20": [{"protocol": "bgp"}], + "203.0.113.1/32": [{"protocol": "bgp"}], + } + return topotest.json_cmp(output, expected) + + def _all_routes_withdrawn(router): + output = json.loads(router.vtysh_cmd("show ip route json")) + expected = { + "0.0.0.0/0": None, + "192.0.2.1/32": None, + "192.0.2.5/32": None, + "10.139.224.0/20": None, + "203.0.113.1/32": None, + } + return topotest.json_cmp(output, expected) + + # BGP conditional advertisement with route-maps + # EXIST-MAP, ADV-MAP-1 and RMAP-1 + def _exist_map_routes_present(router): + return _all_routes_advertised(router) + + def _exist_map_routes_not_present(router): + output = json.loads(router.vtysh_cmd("show ip route json")) + expected = { + "0.0.0.0/0": None, + "192.0.2.1/32": None, + "192.0.2.5/32": [{"protocol": "bgp"}], + "10.139.224.0/20": None, + "203.0.113.1/32": [{"protocol": "bgp"}], + } + return topotest.json_cmp(output, expected) + + def _non_exist_map_routes_present(router): + output = json.loads(router.vtysh_cmd("show ip route json")) + expected = { + "0.0.0.0/0": [{"protocol": "bgp"}], + "192.0.2.1/32": None, + "192.0.2.5/32": [{"protocol": "bgp"}], + "10.139.224.0/20": None, + "203.0.113.1/32": [{"protocol": "bgp"}], + } + return topotest.json_cmp(output, expected) + + def _non_exist_map_routes_not_present(router): + output = json.loads(router.vtysh_cmd("show ip route json")) + expected = { + "0.0.0.0/0": None, + "192.0.2.1/32": [{"protocol": "bgp"}], + "192.0.2.5/32": [{"protocol": "bgp"}], + "10.139.224.0/20": [{"protocol": "bgp"}], + "203.0.113.1/32": [{"protocol": "bgp"}], + } + return topotest.json_cmp(output, expected) + + def _exist_map_no_condition_route_map(router): + return _non_exist_map_routes_present(router) + + def _non_exist_map_no_condition_route_map(router): + return _all_routes_advertised(router) + + def _exist_map_routes_present_rmap_filter(router): + output = json.loads(router.vtysh_cmd("show ip route json")) + expected = { + "0.0.0.0/0": None, + "192.0.2.1/32": [{"protocol": "bgp"}], + "192.0.2.5/32": None, + "10.139.224.0/20": [{"protocol": "bgp"}], + "203.0.113.1/32": None, + } + return topotest.json_cmp(output, expected) + + def _exist_map_routes_present_no_rmap_filter(router): + return _all_routes_advertised(router) + + def _non_exist_map_routes_present_rmap_filter(router): + return _all_routes_withdrawn(router) + + def _non_exist_map_routes_present_no_rmap_filter(router): + return _non_exist_map_routes_present(router) + + def _exist_map_routes_not_present_rmap_filter(router): + return _all_routes_withdrawn(router) + + def _exist_map_routes_not_present_no_rmap_filter(router): + return _exist_map_routes_not_present(router) + + def _non_exist_map_routes_not_present_rmap_filter(router): + return _exist_map_routes_present_rmap_filter(router) + + def _non_exist_map_routes_not_present_no_rmap_filter(router): + return _non_exist_map_routes_not_present(router) + + # BGP conditional advertisement with route-maps + # EXIST-MAP, ADV-MAP-2 and RMAP-2 + def _exist_map_routes_not_present_rmap2_filter(router): + return _all_routes_withdrawn(router) + + def _exist_map_routes_not_present_no_rmap2_filter(router): + output = json.loads(router.vtysh_cmd("show ip route json")) + expected = { + "0.0.0.0/0": None, + "192.0.2.1/32": [{"protocol": "bgp"}], + "192.0.2.5/32": [{"protocol": "bgp"}], + "10.139.224.0/20": [{"protocol": "bgp"}], + "203.0.113.1/32": None, + } + return topotest.json_cmp(output, expected) + + def _non_exist_map_routes_not_present_rmap2_filter(router): + output = json.loads(router.vtysh_cmd("show ip route json")) + expected = { + "0.0.0.0/0": None, + "192.0.2.1/32": None, + "192.0.2.5/32": None, + "10.139.224.0/20": None, + "203.0.113.1/32": [{"protocol": "bgp"}], + } + return topotest.json_cmp(output, expected) + + def _non_exist_map_routes_not_present_no_rmap2_filter(router): + return _non_exist_map_routes_not_present(router) + + def _exist_map_routes_present_rmap2_filter(router): + return _non_exist_map_routes_not_present_rmap2_filter(router) + + def _exist_map_routes_present_no_rmap2_filter(router): + return _all_routes_advertised(router) + + def _non_exist_map_routes_present_rmap2_filter(router): + return _all_routes_withdrawn(router) + + def _non_exist_map_routes_present_no_rmap2_filter(router): + output = json.loads(router.vtysh_cmd("show ip route json")) + expected = { + "0.0.0.0/0": [{"protocol": "bgp"}], + "192.0.2.1/32": [{"protocol": "bgp"}], + "192.0.2.5/32": [{"protocol": "bgp"}], + "10.139.224.0/20": [{"protocol": "bgp"}], + "203.0.113.1/32": None, + } + return topotest.json_cmp(output, expected) + + def _exist_map_routes_present_rmap2_network(router): + return _non_exist_map_routes_not_present_rmap2_filter(router) + + def _exist_map_routes_present_rmap2_no_network(router): + return _all_routes_withdrawn(router) + + def _non_exist_map_routes_not_present_rmap2_network(router): + return _non_exist_map_routes_not_present_rmap2_filter(router) + + def _non_exist_map_routes_not_present_rmap2_no_network(router): + return _all_routes_withdrawn(router) + + # TC11: R3 BGP convergence, without advertise-map configuration. + # All routes are advertised to R3. + test_func = functools.partial(_all_routes_advertised, router3) + success, result = topotest.run_and_expect(test_func, None, count=130, wait=1) + + msg = 'TC11: "router3" BGP convergence - ' + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC21: exist-map routes present in R2's BGP table. + # advertise-map routes present in R2's BGP table are advertised to R3. + router2.vtysh_cmd( + """ + configure terminal + router bgp 2 + address-family ipv4 unicast + neighbor 10.10.20.3 advertise-map ADV-MAP-1 exist-map EXIST-MAP + """ + ) + + test_func = functools.partial(_exist_map_routes_present, router3) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = 'TC21: exist-map routes present in "router2" BGP table - ' + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC22: exist-map routes not present in R2's BGP table + # advertise-map routes present in R2's BGP table are withdrawn from R3. + router1.vtysh_cmd( + """ + configure terminal + router bgp 1 + address-family ipv4 unicast + no network 0.0.0.0/0 route-map DEF + """ + ) + + test_func = functools.partial(_exist_map_routes_not_present, router3) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = 'TC22: exist-map routes not present in "router2" BGP table - ' + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC31: non-exist-map routes not present in R2's BGP table + # advertise-map routes present in R2's BGP table are advertised to R3. + router2.vtysh_cmd( + """ + configure terminal + router bgp 2 + address-family ipv4 unicast + neighbor 10.10.20.3 advertise-map ADV-MAP-1 non-exist-map EXIST-MAP + """ + ) + + test_func = functools.partial(_non_exist_map_routes_not_present, router3) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = 'TC31: non-exist-map routes not present in "router2" BGP table - ' + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC32: non-exist-map routes present in R2's BGP table + # advertise-map routes present in R2's BGP table are withdrawn from R3. + router1.vtysh_cmd( + """ + configure terminal + router bgp 1 + address-family ipv4 unicast + network 0.0.0.0/0 route-map DEF + """ + ) + + test_func = functools.partial(_non_exist_map_routes_present, router3) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = 'TC32: non-exist-map routes present in "router2" BGP table - ' + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC41: non-exist-map route-map configuration removed in R2. + # advertise-map routes present in R2's BGP table are advertised to R3. + router2.vtysh_cmd( + """ + configure terminal + no route-map EXIST-MAP permit 10 + """ + ) + + test_func = functools.partial(_non_exist_map_no_condition_route_map, router3) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = 'TC41: non-exist-map route-map removed in "router2" - ' + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC42: exist-map route-map configuration removed in R2 + # advertise-map routes present in R2's BGP table are withdrawn from R3. + router2.vtysh_cmd( + """ + configure terminal + router bgp 2 + address-family ipv4 unicast + neighbor 10.10.20.3 advertise-map ADV-MAP-1 exist-map EXIST-MAP + """ + ) + + test_func = functools.partial(_exist_map_no_condition_route_map, router3) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = 'TC42: exist-map route-map removed in "router2" - ' + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC51: exist-map routes present in R2's BGP table, with route-map filter. + # All routes are withdrawn from R3 except advertise-map routes. + router2.vtysh_cmd( + """ + configure terminal + route-map EXIST-MAP permit 10 + match community DEFAULT-ROUTE + match ip address prefix-list DEFAULT-ROUTE + ! + router bgp 2 + address-family ipv4 unicast + neighbor 10.10.20.3 route-map RMAP-1 out + """ + ) + + test_func = functools.partial(_exist_map_routes_present_rmap_filter, router3) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = "TC51: exist-map routes present with route-map filter - " + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC52: exist-map routes present in R2's BGP table, no route-map filter. + # All routes are advertised to R3 including advertise-map routes. + router2.vtysh_cmd( + """ + configure terminal + router bgp 2 + address-family ipv4 unicast + no neighbor 10.10.20.3 route-map RMAP-1 out + """ + ) + + test_func = functools.partial(_exist_map_routes_present_no_rmap_filter, router3) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = "TC52: exist-map routes present, no route-map filter - " + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC53: non-exist-map routes present in R2's BGP table, with route-map filter. + # All routes are withdrawn from R3 including advertise-map routes. + router2.vtysh_cmd( + """ + configure terminal + router bgp 2 + address-family ipv4 unicast + neighbor 10.10.20.3 route-map RMAP-1 out + neighbor 10.10.20.3 advertise-map ADV-MAP-1 non-exist-map EXIST-MAP + """ + ) + + test_func = functools.partial(_non_exist_map_routes_present_rmap_filter, router3) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = "TC53: non-exist-map routes present, with route-map filter - " + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC54: non-exist-map routes present in R2's BGP table, no route-map filter. + # All routes are advertised to R3 except advertise-map routes. + router2.vtysh_cmd( + """ + configure terminal + router bgp 2 + address-family ipv4 unicast + no neighbor 10.10.20.3 route-map RMAP-1 out + """ + ) + + test_func = functools.partial(_non_exist_map_routes_present_no_rmap_filter, router3) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = "TC54: non-exist-map routes present, no route-map filter - " + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC61: exist-map routes not present in R2's BGP table, with route-map filter. + # All routes are withdrawn from R3 including advertise-map routes. + router1.vtysh_cmd( + """ + configure terminal + router bgp 1 + address-family ipv4 unicast + no network 0.0.0.0/0 route-map DEF + """ + ) + router2.vtysh_cmd( + """ + configure terminal + router bgp 2 + address-family ipv4 unicast + neighbor 10.10.20.3 route-map RMAP-1 out + neighbor 10.10.20.3 advertise-map ADV-MAP-1 exist-map EXIST-MAP + """ + ) + + test_func = functools.partial(_exist_map_routes_not_present_rmap_filter, router3) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = "TC61: exist-map routes not present, route-map filter - " + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC62: exist-map routes not present in R2's BGP table, without route-map filter. + # All routes are advertised to R3 except advertise-map routes. + router2.vtysh_cmd( + """ + configure terminal + router bgp 2 + address-family ipv4 unicast + no neighbor 10.10.20.3 route-map RMAP-1 out + """ + ) + + test_func = functools.partial(_exist_map_routes_not_present_no_rmap_filter, router3) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = "TC62: exist-map routes not present, no route-map filter - " + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC63: non-exist-map routes not present in R2's BGP table, with route-map filter. + # All routes are withdrawn from R3 except advertise-map routes. + router2.vtysh_cmd( + """ + configure terminal + router bgp 2 + address-family ipv4 unicast + neighbor 10.10.20.3 route-map RMAP-1 out + neighbor 10.10.20.3 advertise-map ADV-MAP-1 non-exist-map EXIST-MAP + """ + ) + + test_func = functools.partial( + _non_exist_map_routes_not_present_rmap_filter, router3 + ) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = "TC63: non-exist-map routes not present, route-map filter - " + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC64: non-exist-map routes not present in R2's BGP table, without route-map filter. + # All routes are advertised to R3 including advertise-map routes. + router2.vtysh_cmd( + """ + configure terminal + router bgp 2 + address-family ipv4 unicast + no neighbor 10.10.20.3 route-map RMAP-1 out + """ + ) + + test_func = functools.partial( + _non_exist_map_routes_not_present_no_rmap_filter, router3 + ) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = "TC64: non-exist-map routes not present, no route-map filter - " + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC71: exist-map routes present in R2's BGP table, with route-map filter. + # All routes are withdrawn from R3 except advertise-map routes. + router1.vtysh_cmd( + """ + configure terminal + router bgp 1 + address-family ipv4 unicast + network 0.0.0.0/0 route-map DEF + """ + ) + router2.vtysh_cmd( + """ + configure terminal + router bgp 2 + address-family ipv4 unicast + neighbor 10.10.20.3 route-map RMAP-2 out + neighbor 10.10.20.3 advertise-map ADV-MAP-2 exist-map EXIST-MAP + """ + ) + + test_func = functools.partial(_exist_map_routes_present_rmap2_filter, router3) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = "TC71: exist-map routes present, route-map filter - " + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC72: exist-map routes present in R2's BGP table, without route-map filter. + # All routes are advertised to R3 including advertise-map routes. + router2.vtysh_cmd( + """ + configure terminal + router bgp 2 + address-family ipv4 unicast + no neighbor 10.10.20.3 route-map RMAP-2 out + """ + ) + + test_func = functools.partial(_exist_map_routes_present_no_rmap2_filter, router3) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = "TC72: exist-map routes present, no route-map filter - " + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC73: non-exist-map routes present in R2's BGP table, with route-map filter. + # All routes are advertised to R3 including advertise-map routes. + router2.vtysh_cmd( + """ + configure terminal + router bgp 2 + address-family ipv4 unicast + neighbor 10.10.20.3 route-map RMAP-2 out + neighbor 10.10.20.3 advertise-map ADV-MAP-2 non-exist-map EXIST-MAP + """ + ) + + test_func = functools.partial(_non_exist_map_routes_present_rmap2_filter, router3) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = "TC73: non-exist-map routes present, route-map filter - " + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC74: non-exist-map routes present in R2's BGP table, without route-map filter. + # All routes are advertised to R3 including advertise-map routes. + router2.vtysh_cmd( + """ + configure terminal + router bgp 2 + address-family ipv4 unicast + no neighbor 10.10.20.3 route-map RMAP-2 out + """ + ) + + test_func = functools.partial( + _non_exist_map_routes_present_no_rmap2_filter, router3 + ) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = "TC74: non-exist-map routes present, no route-map filter - " + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC81: exist-map routes not present in R2's BGP table, with route-map filter. + # All routes are withdrawn from R3 including advertise-map routes. + router1.vtysh_cmd( + """ + configure terminal + router bgp 1 + address-family ipv4 unicast + no network 0.0.0.0/0 route-map DEF + """ + ) + router2.vtysh_cmd( + """ + configure terminal + router bgp 2 + address-family ipv4 unicast + neighbor 10.10.20.3 route-map RMAP-2 out + neighbor 10.10.20.3 advertise-map ADV-MAP-2 exist-map EXIST-MAP + """ + ) + + test_func = functools.partial(_exist_map_routes_not_present_rmap2_filter, router3) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = "TC81: exist-map routes not present, route-map filter - " + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC82: exist-map routes not present in R2's BGP table, without route-map filter. + # All routes are advertised to R3 except advertise-map routes. + router2.vtysh_cmd( + """ + configure terminal + router bgp 2 + address-family ipv4 unicast + no neighbor 10.10.20.3 route-map RMAP-2 out + """ + ) + + test_func = functools.partial( + _exist_map_routes_not_present_no_rmap2_filter, router3 + ) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = "TC82: exist-map routes not present, no route-map filter - " + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC83: non-exist-map routes not present in R2's BGP table, with route-map filter. + # All routes are advertised to R3 including advertise-map routes. + router2.vtysh_cmd( + """ + configure terminal + router bgp 2 + address-family ipv4 unicast + neighbor 10.10.20.3 route-map RMAP-2 out + neighbor 10.10.20.3 advertise-map ADV-MAP-2 non-exist-map EXIST-MAP + """ + ) + + test_func = functools.partial( + _non_exist_map_routes_not_present_rmap2_filter, router3 + ) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = "TC83: non-exist-map routes not present, route-map filter - " + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC84: non-exist-map routes not present in R2's BGP table, without route-map filter. + # All routes are advertised to R3 including advertise-map routes. + router2.vtysh_cmd( + """ + configure terminal + router bgp 2 + address-family ipv4 unicast + no neighbor 10.10.20.3 route-map RMAP-2 out + """ + ) + + test_func = functools.partial( + _non_exist_map_routes_not_present_no_rmap2_filter, router3 + ) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = "TC84: non-exist-map routes not present, no route-map filter - " + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC91: exist-map routes present in R2's BGP table, with route-map filter and network. + # All routes are advertised to R3 including advertise-map routes. + router1.vtysh_cmd( + """ + configure terminal + router bgp 1 + address-family ipv4 unicast + network 0.0.0.0/0 route-map DEF + """ + ) + router2.vtysh_cmd( + """ + configure terminal + router bgp 2 + address-family ipv4 unicast + neighbor 10.10.20.3 route-map RMAP-2 out + neighbor 10.10.20.3 advertise-map ADV-MAP-2 exist-map EXIST-MAP + """ + ) + + test_func = functools.partial(_exist_map_routes_present_rmap2_network, router3) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = "TC91: exist-map routes present, route-map filter and network - " + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC92: exist-map routes present in R2's BGP table, with route-map filter and no network. + # All routes are advertised to R3 except advertise-map routes. + router2.vtysh_cmd( + """ + configure terminal + router bgp 2 + address-family ipv4 unicast + no network 203.0.113.1/32 + """ + ) + + test_func = functools.partial(_exist_map_routes_present_rmap2_no_network, router3) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = "TC92: exist-map routes present, route-map filter and no network - " + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC93: non-exist-map routes not present in R2's BGP table, with route-map filter and network. + # All routes are advertised to R3 including advertise-map routes. + router1.vtysh_cmd( + """ + configure terminal + router bgp 1 + address-family ipv4 unicast + no network 0.0.0.0/0 route-map DEF + """ + ) + router2.vtysh_cmd( + """ + configure terminal + router bgp 2 + address-family ipv4 unicast + network 203.0.113.1/32 + neighbor 10.10.20.3 advertise-map ADV-MAP-2 non-exist-map EXIST-MAP + """ + ) + + test_func = functools.partial( + _non_exist_map_routes_not_present_rmap2_network, router3 + ) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = "TC93: non-exist-map routes not present, route-map filter and network - " + assert result is None, msg + failed + + logger.info(msg + passed) + + # TC94: non-exist-map routes not present in R2's BGP table, with route-map filter and no network. + # All routes are advertised to R3 except advertise-map routes. + router2.vtysh_cmd( + """ + configure terminal + router bgp 2 + address-family ipv4 unicast + no network 203.0.113.1/32 + """ + ) + + test_func = functools.partial( + _non_exist_map_routes_not_present_rmap2_no_network, router3 + ) + success, result = topotest.run_and_expect(test_func, None, count=90, wait=1) + + msg = "TC94: non-exist-map routes not present, route-map filter and no network - " + assert result is None, msg + failed + + logger.info(msg + passed) + + +def test_memory_leak(): + "Run the memory leak test and report results." + tgen = get_topogen() + if not tgen.is_memleak_enabled(): + pytest.skip("Memory leak test/report is disabled") + + tgen.report_memory_leaks() + + +if __name__ == "__main__": + args = ["-s"] + sys.argv[1:] + sys.exit(pytest.main(args)) diff --git a/tests/topotests/bgp_default-route/__init__.py b/tests/topotests/bgp_default-route/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/bgp_default-route/__init__.py diff --git a/tests/topotests/bgp_default-route/r1/bgpd.conf b/tests/topotests/bgp_default-route/r1/bgpd.conf new file mode 100644 index 0000000000..8699d62ff2 --- /dev/null +++ b/tests/topotests/bgp_default-route/r1/bgpd.conf @@ -0,0 +1,8 @@ +router bgp 65000 + no bgp ebgp-requires-policy + neighbor 192.168.255.2 remote-as 65001 + neighbor 192.168.255.2 timers 3 10 + address-family ipv4 unicast + neighbor 192.168.255.2 default-originate + exit-address-family +! diff --git a/tests/topotests/bgp_default-route_route-map/r1/zebra.conf b/tests/topotests/bgp_default-route/r1/zebra.conf index 0a283c06d5..0a283c06d5 100644 --- a/tests/topotests/bgp_default-route_route-map/r1/zebra.conf +++ b/tests/topotests/bgp_default-route/r1/zebra.conf diff --git a/tests/topotests/bgp_default-route_route-map/r2/bgpd.conf b/tests/topotests/bgp_default-route/r2/bgpd.conf index 00c96cc58b..00c96cc58b 100644 --- a/tests/topotests/bgp_default-route_route-map/r2/bgpd.conf +++ b/tests/topotests/bgp_default-route/r2/bgpd.conf diff --git a/tests/topotests/bgp_default-route_route-map/r2/zebra.conf b/tests/topotests/bgp_default-route/r2/zebra.conf index 606c17bec9..606c17bec9 100644 --- a/tests/topotests/bgp_default-route_route-map/r2/zebra.conf +++ b/tests/topotests/bgp_default-route/r2/zebra.conf diff --git a/tests/topotests/bgp_default-route/test_bgp_default-originate.py b/tests/topotests/bgp_default-route/test_bgp_default-originate.py new file mode 100644 index 0000000000..d8de0f0ac6 --- /dev/null +++ b/tests/topotests/bgp_default-route/test_bgp_default-originate.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python + +# Copyright (c) 2019-2020 by +# Donatas Abraitis <donatas.abraitis@gmail.com> +# +# Permission to use, copy, modify, and/or distribute this software +# for any purpose with or without fee is hereby granted, provided +# that the above copyright notice and this permission notice appear +# in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY +# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. +# + +""" +Test if default-originate works without route-map. +""" + +import os +import sys +import json +import time +import pytest +import functools + +CWD = os.path.dirname(os.path.realpath(__file__)) +sys.path.append(os.path.join(CWD, "../")) + +# pylint: disable=C0413 +from lib import topotest +from lib.topogen import Topogen, TopoRouter, get_topogen +from lib.topolog import logger +from mininet.topo import Topo + + +class TemplateTopo(Topo): + def build(self, *_args, **_opts): + tgen = get_topogen(self) + + for routern in range(1, 3): + tgen.add_router("r{}".format(routern)) + + switch = tgen.add_switch("s1") + switch.add_link(tgen.gears["r1"]) + switch.add_link(tgen.gears["r2"]) + + +def setup_module(mod): + tgen = Topogen(TemplateTopo, mod.__name__) + tgen.start_topology() + + router_list = tgen.routers() + + for i, (rname, router) in enumerate(router_list.items(), 1): + router.load_config( + TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname)) + ) + router.load_config( + TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname)) + ) + + tgen.start_router() + + +def teardown_module(mod): + tgen = get_topogen() + tgen.stop_topology() + + +def test_bgp_default_originate_route_map(): + tgen = get_topogen() + + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router = tgen.gears["r2"] + + def _bgp_converge(router): + output = json.loads(router.vtysh_cmd("show ip bgp neighbor 192.168.255.1 json")) + expected = { + "192.168.255.1": { + "bgpState": "Established", + "addressFamilyInfo": {"ipv4Unicast": {"acceptedPrefixCounter": 1}}, + } + } + return topotest.json_cmp(output, expected) + + def _bgp_default_route_is_valid(router): + output = json.loads(router.vtysh_cmd("show ip bgp 0.0.0.0/0 json")) + expected = {"paths": [{"valid": True}]} + return topotest.json_cmp(output, expected) + + test_func = functools.partial(_bgp_converge, router) + success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) + + assert result is None, 'Failed to see bgp convergence in "{}"'.format(router) + + test_func = functools.partial(_bgp_default_route_is_valid, router) + success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) + + assert ( + result is None + ), 'Failed to see applied metric for default route in "{}"'.format(router) + + +if __name__ == "__main__": + args = ["-s"] + sys.argv[1:] + sys.exit(pytest.main(args)) diff --git a/tests/topotests/bgp_default-route_route-map_match/__init__.py b/tests/topotests/bgp_default-route_route-map_match/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_match/__init__.py diff --git a/tests/topotests/bgp_default-route_route-map_match/r1/bgpd.conf b/tests/topotests/bgp_default-route_route-map_match/r1/bgpd.conf new file mode 100644 index 0000000000..97b440f5ce --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_match/r1/bgpd.conf @@ -0,0 +1,17 @@ +router bgp 65000 + no bgp ebgp-requires-policy + neighbor 192.168.255.2 remote-as 65001 + neighbor 192.168.255.2 timers 3 10 + address-family ipv4 unicast + network 192.168.13.0/24 route-map internal + neighbor 192.168.255.2 default-originate route-map default + exit-address-family +! +bgp community-list standard default seq 5 permit 65000:1 +! +route-map default permit 10 + match community default +! +route-map internal permit 10 + set community 65000:1 +! diff --git a/tests/topotests/bgp_default-route_route-map_match/r1/zebra.conf b/tests/topotests/bgp_default-route_route-map_match/r1/zebra.conf new file mode 100644 index 0000000000..9e581a7be7 --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_match/r1/zebra.conf @@ -0,0 +1,11 @@ +! +interface lo + ip address 172.16.255.254/32 +! +interface r1-eth0 + ip address 192.168.255.1/24 +! +ip route 192.168.13.0./24 Null0 +! +ip forwarding +! diff --git a/tests/topotests/bgp_default-route_route-map_match/r2/bgpd.conf b/tests/topotests/bgp_default-route_route-map_match/r2/bgpd.conf new file mode 100644 index 0000000000..00c96cc58b --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_match/r2/bgpd.conf @@ -0,0 +1,8 @@ +router bgp 65001 + no bgp ebgp-requires-policy + neighbor 192.168.255.1 remote-as 65000 + neighbor 192.168.255.1 timers 3 10 + address-family ipv4 unicast + redistribute connected + exit-address-family +! diff --git a/tests/topotests/bgp_default-route_route-map_match/r2/zebra.conf b/tests/topotests/bgp_default-route_route-map_match/r2/zebra.conf new file mode 100644 index 0000000000..606c17bec9 --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_match/r2/zebra.conf @@ -0,0 +1,6 @@ +! +interface r2-eth0 + ip address 192.168.255.2/24 +! +ip forwarding +! diff --git a/tests/topotests/bgp_default-route_route-map_match/test_bgp_default-originate_route-map_match.py b/tests/topotests/bgp_default-route_route-map_match/test_bgp_default-originate_route-map_match.py new file mode 100644 index 0000000000..089c9a964e --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_match/test_bgp_default-originate_route-map_match.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python + +# Copyright (c) 2019-2020 by +# Donatas Abraitis <donatas.abraitis@gmail.com> +# +# Permission to use, copy, modify, and/or distribute this software +# for any purpose with or without fee is hereby granted, provided +# that the above copyright notice and this permission notice appear +# in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY +# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. +# + +""" +Test if default-originate works with ONLY match operations. +""" + +import os +import sys +import json +import time +import pytest +import functools + +CWD = os.path.dirname(os.path.realpath(__file__)) +sys.path.append(os.path.join(CWD, "../")) + +# pylint: disable=C0413 +from lib import topotest +from lib.topogen import Topogen, TopoRouter, get_topogen +from lib.topolog import logger +from mininet.topo import Topo + + +class TemplateTopo(Topo): + def build(self, *_args, **_opts): + tgen = get_topogen(self) + + for routern in range(1, 3): + tgen.add_router("r{}".format(routern)) + + switch = tgen.add_switch("s1") + switch.add_link(tgen.gears["r1"]) + switch.add_link(tgen.gears["r2"]) + + +def setup_module(mod): + tgen = Topogen(TemplateTopo, mod.__name__) + tgen.start_topology() + + router_list = tgen.routers() + + for i, (rname, router) in enumerate(router_list.items(), 1): + router.load_config( + TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname)) + ) + router.load_config( + TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname)) + ) + + tgen.start_router() + + +def teardown_module(mod): + tgen = get_topogen() + tgen.stop_topology() + + +def test_bgp_default_originate_route_map(): + tgen = get_topogen() + + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router = tgen.gears["r2"] + + def _bgp_converge(router): + output = json.loads(router.vtysh_cmd("show ip bgp neighbor 192.168.255.1 json")) + expected = { + "192.168.255.1": { + "bgpState": "Established", + "addressFamilyInfo": {"ipv4Unicast": {"acceptedPrefixCounter": 1}}, + } + } + return topotest.json_cmp(output, expected) + + def _bgp_default_route_is_valid(router): + output = json.loads(router.vtysh_cmd("show ip bgp 0.0.0.0/0 json")) + expected = {"paths": [{"valid": True}]} + return topotest.json_cmp(output, expected) + + test_func = functools.partial(_bgp_converge, router) + success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) + + assert result is None, 'Failed to see bgp convergence in "{}"'.format(router) + + test_func = functools.partial(_bgp_default_route_is_valid, router) + success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) + + assert ( + result is None + ), 'Failed to see applied metric for default route in "{}"'.format(router) + + +if __name__ == "__main__": + args = ["-s"] + sys.argv[1:] + sys.exit(pytest.main(args)) diff --git a/tests/topotests/bgp_default-route_route-map_match_set/__init__.py b/tests/topotests/bgp_default-route_route-map_match_set/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_match_set/__init__.py diff --git a/tests/topotests/bgp_default-route_route-map_match_set/r1/bgpd.conf b/tests/topotests/bgp_default-route_route-map_match_set/r1/bgpd.conf new file mode 100644 index 0000000000..6ef8b1c0f4 --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_match_set/r1/bgpd.conf @@ -0,0 +1,18 @@ +router bgp 65000 + no bgp ebgp-requires-policy + neighbor 192.168.255.2 remote-as 65001 + neighbor 192.168.255.2 timers 3 10 + address-family ipv4 unicast + network 192.168.13.0/24 route-map internal + neighbor 192.168.255.2 default-originate route-map default + exit-address-family +! +bgp community-list standard default seq 5 permit 65000:1 +! +route-map default permit 10 + match community default + set metric 123 +! +route-map internal permit 10 + set community 65000:1 +! diff --git a/tests/topotests/bgp_default-route_route-map_match_set/r1/zebra.conf b/tests/topotests/bgp_default-route_route-map_match_set/r1/zebra.conf new file mode 100644 index 0000000000..9e581a7be7 --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_match_set/r1/zebra.conf @@ -0,0 +1,11 @@ +! +interface lo + ip address 172.16.255.254/32 +! +interface r1-eth0 + ip address 192.168.255.1/24 +! +ip route 192.168.13.0./24 Null0 +! +ip forwarding +! diff --git a/tests/topotests/bgp_default-route_route-map_match_set/r2/bgpd.conf b/tests/topotests/bgp_default-route_route-map_match_set/r2/bgpd.conf new file mode 100644 index 0000000000..00c96cc58b --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_match_set/r2/bgpd.conf @@ -0,0 +1,8 @@ +router bgp 65001 + no bgp ebgp-requires-policy + neighbor 192.168.255.1 remote-as 65000 + neighbor 192.168.255.1 timers 3 10 + address-family ipv4 unicast + redistribute connected + exit-address-family +! diff --git a/tests/topotests/bgp_default-route_route-map_match_set/r2/zebra.conf b/tests/topotests/bgp_default-route_route-map_match_set/r2/zebra.conf new file mode 100644 index 0000000000..606c17bec9 --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_match_set/r2/zebra.conf @@ -0,0 +1,6 @@ +! +interface r2-eth0 + ip address 192.168.255.2/24 +! +ip forwarding +! diff --git a/tests/topotests/bgp_default-route_route-map/test_bgp_default-originate_route-map.py b/tests/topotests/bgp_default-route_route-map_match_set/test_bgp_default-originate_route-map_match_set.py index a72c3a4cbf..d9ea5db278 100644 --- a/tests/topotests/bgp_default-route_route-map/test_bgp_default-originate_route-map.py +++ b/tests/topotests/bgp_default-route_route-map_match_set/test_bgp_default-originate_route-map_match_set.py @@ -1,10 +1,6 @@ #!/usr/bin/env python -# -# bgp_default-originate_route-map.py -# Part of NetDEF Topology Tests -# -# Copyright (c) 2019 by +# Copyright (c) 2020 by # Donatas Abraitis <donatas.abraitis@gmail.com> # # Permission to use, copy, modify, and/or distribute this software @@ -23,15 +19,8 @@ # """ -bgp_default-originate_route-map.py: - -Test if works the following commands: -router bgp 65031 - address-family ipv4 unicast - neighbor 192.168.255.2 default-originate route-map default - -route-map default permit 10 - set metric 123 +Test if default-originate works with match operations. +And verify if set operations work as well. """ import os @@ -109,12 +98,12 @@ def test_bgp_default_originate_route_map(): return topotest.json_cmp(output, expected) test_func = functools.partial(_bgp_converge, router) - success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) + success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) assert result is None, 'Failed to see bgp convergence in "{}"'.format(router) test_func = functools.partial(_bgp_default_route_has_metric, router) - success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) + success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) assert ( result is None diff --git a/tests/topotests/bgp_default-route_route-map_set/__init__.py b/tests/topotests/bgp_default-route_route-map_set/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_set/__init__.py diff --git a/tests/topotests/bgp_default-route_route-map/r1/bgpd.conf b/tests/topotests/bgp_default-route_route-map_set/r1/bgpd.conf index cb07ea9fdf..cb07ea9fdf 100644 --- a/tests/topotests/bgp_default-route_route-map/r1/bgpd.conf +++ b/tests/topotests/bgp_default-route_route-map_set/r1/bgpd.conf diff --git a/tests/topotests/bgp_default-route_route-map_set/r1/zebra.conf b/tests/topotests/bgp_default-route_route-map_set/r1/zebra.conf new file mode 100644 index 0000000000..0a283c06d5 --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_set/r1/zebra.conf @@ -0,0 +1,9 @@ +! +interface lo + ip address 172.16.255.254/32 +! +interface r1-eth0 + ip address 192.168.255.1/24 +! +ip forwarding +! diff --git a/tests/topotests/bgp_default-route_route-map_set/r2/bgpd.conf b/tests/topotests/bgp_default-route_route-map_set/r2/bgpd.conf new file mode 100644 index 0000000000..00c96cc58b --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_set/r2/bgpd.conf @@ -0,0 +1,8 @@ +router bgp 65001 + no bgp ebgp-requires-policy + neighbor 192.168.255.1 remote-as 65000 + neighbor 192.168.255.1 timers 3 10 + address-family ipv4 unicast + redistribute connected + exit-address-family +! diff --git a/tests/topotests/bgp_default-route_route-map_set/r2/zebra.conf b/tests/topotests/bgp_default-route_route-map_set/r2/zebra.conf new file mode 100644 index 0000000000..606c17bec9 --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_set/r2/zebra.conf @@ -0,0 +1,6 @@ +! +interface r2-eth0 + ip address 192.168.255.2/24 +! +ip forwarding +! diff --git a/tests/topotests/bgp_default-route_route-map_set/test_bgp_default-originate_route-map_set.py b/tests/topotests/bgp_default-route_route-map_set/test_bgp_default-originate_route-map_set.py new file mode 100644 index 0000000000..9a22c58b16 --- /dev/null +++ b/tests/topotests/bgp_default-route_route-map_set/test_bgp_default-originate_route-map_set.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python + +# Copyright (c) 2019-2020 by +# Donatas Abraitis <donatas.abraitis@gmail.com> +# +# Permission to use, copy, modify, and/or distribute this software +# for any purpose with or without fee is hereby granted, provided +# that the above copyright notice and this permission notice appear +# in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY +# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. +# + +""" +Test if default-originate works with ONLY set operations. +""" + +import os +import sys +import json +import time +import pytest +import functools + +CWD = os.path.dirname(os.path.realpath(__file__)) +sys.path.append(os.path.join(CWD, "../")) + +# pylint: disable=C0413 +from lib import topotest +from lib.topogen import Topogen, TopoRouter, get_topogen +from lib.topolog import logger +from mininet.topo import Topo + + +class TemplateTopo(Topo): + def build(self, *_args, **_opts): + tgen = get_topogen(self) + + for routern in range(1, 3): + tgen.add_router("r{}".format(routern)) + + switch = tgen.add_switch("s1") + switch.add_link(tgen.gears["r1"]) + switch.add_link(tgen.gears["r2"]) + + +def setup_module(mod): + tgen = Topogen(TemplateTopo, mod.__name__) + tgen.start_topology() + + router_list = tgen.routers() + + for i, (rname, router) in enumerate(router_list.items(), 1): + router.load_config( + TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname)) + ) + router.load_config( + TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname)) + ) + + tgen.start_router() + + +def teardown_module(mod): + tgen = get_topogen() + tgen.stop_topology() + + +def test_bgp_default_originate_route_map(): + tgen = get_topogen() + + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + router = tgen.gears["r2"] + + def _bgp_converge(router): + output = json.loads(router.vtysh_cmd("show ip bgp neighbor 192.168.255.1 json")) + expected = { + "192.168.255.1": { + "bgpState": "Established", + "addressFamilyInfo": {"ipv4Unicast": {"acceptedPrefixCounter": 1}}, + } + } + return topotest.json_cmp(output, expected) + + def _bgp_default_route_has_metric(router): + output = json.loads(router.vtysh_cmd("show ip bgp 0.0.0.0/0 json")) + expected = {"paths": [{"metric": 123}]} + return topotest.json_cmp(output, expected) + + test_func = functools.partial(_bgp_converge, router) + success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) + + assert result is None, 'Failed to see bgp convergence in "{}"'.format(router) + + test_func = functools.partial(_bgp_default_route_has_metric, router) + success, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) + + assert ( + result is None + ), 'Failed to see applied metric for default route in "{}"'.format(router) + + +if __name__ == "__main__": + args = ["-s"] + sys.argv[1:] + sys.exit(pytest.main(args)) diff --git a/tests/topotests/bgp_ebgp_requires_policy/test_bgp_ebgp_requires_policy.py b/tests/topotests/bgp_ebgp_requires_policy/test_bgp_ebgp_requires_policy.py index 2520763bda..003193f108 100644 --- a/tests/topotests/bgp_ebgp_requires_policy/test_bgp_ebgp_requires_policy.py +++ b/tests/topotests/bgp_ebgp_requires_policy/test_bgp_ebgp_requires_policy.py @@ -122,27 +122,39 @@ def test_ebgp_requires_policy(): test_func = functools.partial(_bgp_converge, "r2") success, result = topotest.run_and_expect(test_func, None, count=65, wait=2) - assert success is True, 'Failed bgp convergence (r2) in "{}"'.format(tgen.gears["r2"]) + assert success is True, 'Failed bgp convergence (r2) in "{}"'.format( + tgen.gears["r2"] + ) test_func = functools.partial(_bgp_has_routes, "r2") success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) - assert success is True, 'eBGP policy is not working (r2) in "{}"'.format(tgen.gears["r2"]) + assert success is True, 'eBGP policy is not working (r2) in "{}"'.format( + tgen.gears["r2"] + ) test_func = functools.partial(_bgp_converge, "r4") success, result = topotest.run_and_expect(test_func, None, count=65, wait=2) - assert success is True, 'Failed bgp convergence (r4) in "{}"'.format(tgen.gears["r4"]) + assert success is True, 'Failed bgp convergence (r4) in "{}"'.format( + tgen.gears["r4"] + ) test_func = functools.partial(_bgp_has_routes, "r4") success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) - assert success is False, 'eBGP policy is not working (r4) in "{}"'.format(tgen.gears["r4"]) + assert success is False, 'eBGP policy is not working (r4) in "{}"'.format( + tgen.gears["r4"] + ) test_func = functools.partial(_bgp_converge, "r6") success, result = topotest.run_and_expect(test_func, None, count=65, wait=2) - assert success is True, 'Failed bgp convergence (r6) in "{}"'.format(tgen.gears["r6"]) + assert success is True, 'Failed bgp convergence (r6) in "{}"'.format( + tgen.gears["r6"] + ) test_func = functools.partial(_bgp_has_routes, "r6") success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5) - assert success is True, 'eBGP policy is not working (r6) in "{}"'.format(tgen.gears["r6"]) + assert success is True, 'eBGP policy is not working (r6) in "{}"'.format( + tgen.gears["r6"] + ) if __name__ == "__main__": diff --git a/tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py b/tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py index 0d99f23ad9..222478f12d 100644 --- a/tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py +++ b/tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py @@ -35,7 +35,7 @@ import platform # Save the Current Working Directory to find configuration files. CWD = os.path.dirname(os.path.realpath(__file__)) -sys.path.append(os.path.join(CWD, '../')) +sys.path.append(os.path.join(CWD, "../")) # pylint: disable=C0413 # Import topogen and topotest helpers @@ -47,27 +47,30 @@ from lib.topolog import logger from mininet.topo import Topo l3mdev_accept = 0 -krel = '' +krel = "" + class BGPEVPNTopo(Topo): "Test topology builder" + def build(self, *_args, **_opts): "Build function" tgen = get_topogen(self) - tgen.add_router('r1') - tgen.add_router('r2') + tgen.add_router("r1") + tgen.add_router("r2") + + switch = tgen.add_switch("s1") + switch.add_link(tgen.gears["r1"]) + switch.add_link(tgen.gears["r2"]) - switch = tgen.add_switch('s1') - switch.add_link(tgen.gears['r1']) - switch.add_link(tgen.gears['r2']) + switch = tgen.add_switch("s2") + switch.add_link(tgen.gears["r1"]) + + switch = tgen.add_switch("s3") + switch.add_link(tgen.gears["r2"]) - switch = tgen.add_switch('s2') - switch.add_link(tgen.gears['r1']) - switch = tgen.add_switch('s3') - switch.add_link(tgen.gears['r2']) - def setup_module(mod): "Sets up the pytest environment" global l3mdev_accept @@ -79,99 +82,109 @@ def setup_module(mod): router_list = tgen.routers() krel = platform.release() - if topotest.version_cmp(krel, '4.18') < 0: - logger.info('BGP EVPN RT5 NETNS tests will not run (have kernel "{}", but it requires 4.18)'.format(krel)) - return pytest.skip('Skipping BGP EVPN RT5 NETNS Test. Kernel not supported') + if topotest.version_cmp(krel, "4.18") < 0: + logger.info( + 'BGP EVPN RT5 NETNS tests will not run (have kernel "{}", but it requires 4.18)'.format( + krel + ) + ) + return pytest.skip("Skipping BGP EVPN RT5 NETNS Test. Kernel not supported") l3mdev_accept = 1 - logger.info('setting net.ipv4.tcp_l3mdev_accept={}'.format(l3mdev_accept)) + logger.info("setting net.ipv4.tcp_l3mdev_accept={}".format(l3mdev_accept)) # create VRF vrf-101 on R1 and R2 # create loop101 - cmds_vrflite = ['sysctl -w net.ipv4.tcp_l3mdev_accept={}'.format(l3mdev_accept), - 'ip link add {}-vrf-101 type vrf table 101', - 'ip ru add oif {}-vrf-101 table 101', - 'ip ru add iif {}-vrf-101 table 101', - 'ip link set dev {}-vrf-101 up', - 'sysctl -w net.ipv4.tcp_l3mdev_accept={}'.format(l3mdev_accept), - 'ip link add loop101 type dummy', - 'ip link set dev loop101 master {}-vrf-101', - 'ip link set dev loop101 up'] - cmds_netns = ['ip netns add {}-vrf-101', - 'ip link add loop101 type dummy', - 'ip link set dev loop101 netns {}-vrf-101', - 'ip netns exec {}-vrf-101 ip link set dev loop101 up'] - - cmds_r2 = [ # config routing 101 - 'ip link add name bridge-101 up type bridge stp_state 0', - 'ip link set bridge-101 master {}-vrf-101', - 'ip link set dev bridge-101 up', - 'ip link add name vxlan-101 type vxlan id 101 dstport 4789 dev r2-eth0 local 192.168.100.41', - 'ip link set dev vxlan-101 master bridge-101', - 'ip link set vxlan-101 up type bridge_slave learning off flood off mcast_flood off'] - - cmds_r1_netns_method3 = ['ip link add name vxlan-{1} type vxlan id {1} dstport 4789 dev {0}-eth0 local 192.168.100.21', - 'ip link set dev vxlan-{1} netns {0}-vrf-{1}', - 'ip netns exec {0}-vrf-{1} ip li set dev lo up', - 'ip netns exec {0}-vrf-{1} ip link add name bridge-{1} up type bridge stp_state 0', - 'ip netns exec {0}-vrf-{1} ip link set dev vxlan-{1} master bridge-{1}', - 'ip netns exec {0}-vrf-{1} ip link set bridge-{1} up', - 'ip netns exec {0}-vrf-{1} ip link set vxlan-{1} up'] - - router = tgen.gears['r1'] + cmds_vrflite = [ + "sysctl -w net.ipv4.tcp_l3mdev_accept={}".format(l3mdev_accept), + "ip link add {}-vrf-101 type vrf table 101", + "ip ru add oif {}-vrf-101 table 101", + "ip ru add iif {}-vrf-101 table 101", + "ip link set dev {}-vrf-101 up", + "sysctl -w net.ipv4.tcp_l3mdev_accept={}".format(l3mdev_accept), + "ip link add loop101 type dummy", + "ip link set dev loop101 master {}-vrf-101", + "ip link set dev loop101 up", + ] + cmds_netns = [ + "ip netns add {}-vrf-101", + "ip link add loop101 type dummy", + "ip link set dev loop101 netns {}-vrf-101", + "ip netns exec {}-vrf-101 ip link set dev loop101 up", + ] + + cmds_r2 = [ # config routing 101 + "ip link add name bridge-101 up type bridge stp_state 0", + "ip link set bridge-101 master {}-vrf-101", + "ip link set dev bridge-101 up", + "ip link add name vxlan-101 type vxlan id 101 dstport 4789 dev r2-eth0 local 192.168.100.41", + "ip link set dev vxlan-101 master bridge-101", + "ip link set vxlan-101 up type bridge_slave learning off flood off mcast_flood off", + ] + + cmds_r1_netns_method3 = [ + "ip link add name vxlan-{1} type vxlan id {1} dstport 4789 dev {0}-eth0 local 192.168.100.21", + "ip link set dev vxlan-{1} netns {0}-vrf-{1}", + "ip netns exec {0}-vrf-{1} ip li set dev lo up", + "ip netns exec {0}-vrf-{1} ip link add name bridge-{1} up type bridge stp_state 0", + "ip netns exec {0}-vrf-{1} ip link set dev vxlan-{1} master bridge-{1}", + "ip netns exec {0}-vrf-{1} ip link set bridge-{1} up", + "ip netns exec {0}-vrf-{1} ip link set vxlan-{1} up", + ] + + router = tgen.gears["r1"] for cmd in cmds_netns: - logger.info('cmd to r1: '+cmd); - output = router.run(cmd.format('r1')) - logger.info('result: '+output); + logger.info("cmd to r1: " + cmd) + output = router.run(cmd.format("r1")) + logger.info("result: " + output) - router = tgen.gears['r2'] + router = tgen.gears["r2"] for cmd in cmds_vrflite: - logger.info('cmd to r2: '+cmd.format('r2')); - output = router.run(cmd.format('r2')) - logger.info('result: '+output); + logger.info("cmd to r2: " + cmd.format("r2")) + output = router.run(cmd.format("r2")) + logger.info("result: " + output) for cmd in cmds_r2: - logger.info('cmd to r2: '+cmd.format('r2')); - output = router.run(cmd.format('r2')) - logger.info('result: '+output); + logger.info("cmd to r2: " + cmd.format("r2")) + output = router.run(cmd.format("r2")) + logger.info("result: " + output) - router = tgen.gears['r1'] - bridge_id = '101' + router = tgen.gears["r1"] + bridge_id = "101" for cmd in cmds_r1_netns_method3: - logger.info('cmd to r1: '+cmd.format('r1', bridge_id)); - output = router.run(cmd.format('r1', bridge_id)) - logger.info('result: '+output); - router = tgen.gears['r1'] + logger.info("cmd to r1: " + cmd.format("r1", bridge_id)) + output = router.run(cmd.format("r1", bridge_id)) + logger.info("result: " + output) + router = tgen.gears["r1"] for rname, router in router_list.items(): - if rname == 'r1': + if rname == "r1": router.load_config( TopoRouter.RD_ZEBRA, - os.path.join(CWD, '{}/zebra.conf'.format(rname)), - '--vrfwnetns -o vrf0' + os.path.join(CWD, "{}/zebra.conf".format(rname)), + "--vrfwnetns -o vrf0", ) else: router.load_config( - TopoRouter.RD_ZEBRA, - os.path.join(CWD, '{}/zebra.conf'.format(rname)) + TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname)) ) router.load_config( - TopoRouter.RD_BGP, - os.path.join(CWD, '{}/bgpd.conf'.format(rname)) + TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname)) ) # Initialize all routers. tgen.start_router() + def teardown_module(_mod): "Teardown the pytest environment" tgen = get_topogen() - cmds_rx_netns = ['ip netns del {}-vrf-101'] - - router = tgen.gears['r1'] + cmds_rx_netns = ["ip netns del {}-vrf-101"] + + router = tgen.gears["r1"] for cmd in cmds_rx_netns: - logger.info('cmd to r1: '+cmd.format('r1')); - output = router.run(cmd.format('r1')) + logger.info("cmd to r1: " + cmd.format("r1")) + output = router.run(cmd.format("r1")) tgen.stop_topology() @@ -183,52 +196,59 @@ def test_protocols_convergence(): tgen = get_topogen() if tgen.routers_have_failure(): pytest.skip(tgen.errors) - topotest.sleep(4, 'waiting 4 seconds for bgp convergence') + topotest.sleep(4, "waiting 4 seconds for bgp convergence") # Check IPv4/IPv6 routing tables. - output = tgen.gears['r1'].vtysh_cmd('show bgp l2vpn evpn', isjson=False) - logger.info('==== result from show bgp l2vpn evpn') + output = tgen.gears["r1"].vtysh_cmd("show bgp l2vpn evpn", isjson=False) + logger.info("==== result from show bgp l2vpn evpn") logger.info(output) - output = tgen.gears['r1'].vtysh_cmd('show bgp l2vpn evpn route detail', isjson=False) - logger.info('==== result from show bgp l2vpn evpn route detail') + output = tgen.gears["r1"].vtysh_cmd( + "show bgp l2vpn evpn route detail", isjson=False + ) + logger.info("==== result from show bgp l2vpn evpn route detail") logger.info(output) - output = tgen.gears['r1'].vtysh_cmd('show bgp vrf r1-vrf-101 ipv4', isjson=False) - logger.info('==== result from show bgp vrf r1-vrf-101 ipv4') + output = tgen.gears["r1"].vtysh_cmd("show bgp vrf r1-vrf-101 ipv4", isjson=False) + logger.info("==== result from show bgp vrf r1-vrf-101 ipv4") logger.info(output) - output = tgen.gears['r1'].vtysh_cmd('show bgp vrf r1-vrf-101', isjson=False) - logger.info('==== result from show bgp vrf r1-vrf-101 ') + output = tgen.gears["r1"].vtysh_cmd("show bgp vrf r1-vrf-101", isjson=False) + logger.info("==== result from show bgp vrf r1-vrf-101 ") logger.info(output) - output = tgen.gears['r1'].vtysh_cmd('show ip route vrf r1-vrf-101', isjson=False) - logger.info('==== result from show ip route vrf r1-vrf-101') + output = tgen.gears["r1"].vtysh_cmd("show ip route vrf r1-vrf-101", isjson=False) + logger.info("==== result from show ip route vrf r1-vrf-101") logger.info(output) - output = tgen.gears['r1'].vtysh_cmd('show evpn vni detail', isjson=False) - logger.info('==== result from show evpn vni detail') + output = tgen.gears["r1"].vtysh_cmd("show evpn vni detail", isjson=False) + logger.info("==== result from show evpn vni detail") logger.info(output) - output = tgen.gears['r1'].vtysh_cmd('show evpn next-hops vni all', isjson=False) - logger.info('==== result from show evpn next-hops vni all') + output = tgen.gears["r1"].vtysh_cmd("show evpn next-hops vni all", isjson=False) + logger.info("==== result from show evpn next-hops vni all") logger.info(output) - output = tgen.gears['r1'].vtysh_cmd('show evpn rmac vni all', isjson=False) - logger.info('==== result from show evpn next-hops vni all') + output = tgen.gears["r1"].vtysh_cmd("show evpn rmac vni all", isjson=False) + logger.info("==== result from show evpn next-hops vni all") logger.info(output) # Check IPv4 and IPv6 connectivity between r1 and r2 ( routing vxlan evpn) - pingrouter = tgen.gears['r1'] - logger.info('Check Ping IPv4 from R1(r1-vrf-101) to R2(r2-vrf-101 = 192.168.101.41)') - output = pingrouter.run('ip netns exec r1-vrf-101 ping 192.168.101.41 -f -c 1000') + pingrouter = tgen.gears["r1"] + logger.info( + "Check Ping IPv4 from R1(r1-vrf-101) to R2(r2-vrf-101 = 192.168.101.41)" + ) + output = pingrouter.run("ip netns exec r1-vrf-101 ping 192.168.101.41 -f -c 1000") logger.info(output) - if '1000 packets transmitted, 1000 received' not in output: - assertmsg = 'expected ping IPv4 from R1(r1-vrf-101) to R2(192.168.101.41) should be ok' + if "1000 packets transmitted, 1000 received" not in output: + assertmsg = ( + "expected ping IPv4 from R1(r1-vrf-101) to R2(192.168.101.41) should be ok" + ) assert 0, assertmsg else: - logger.info('Check Ping IPv4 from R1(r1-vrf-101) to R2(192.168.101.41) OK') + logger.info("Check Ping IPv4 from R1(r1-vrf-101) to R2(192.168.101.41) OK") + def test_memory_leak(): "Run the memory leak test and report results." tgen = get_topogen() if not tgen.is_memleak_enabled(): - pytest.skip('Memory leak test/report is disabled') + pytest.skip("Memory leak test/report is disabled") tgen.report_memory_leaks() -if __name__ == '__main__': +if __name__ == "__main__": args = ["-s"] + sys.argv[1:] sys.exit(pytest.main(args)) diff --git a/tests/topotests/bgp_features/test_bgp_features.py b/tests/topotests/bgp_features/test_bgp_features.py index 4ec060b642..bd092c4340 100644 --- a/tests/topotests/bgp_features/test_bgp_features.py +++ b/tests/topotests/bgp_features/test_bgp_features.py @@ -188,11 +188,15 @@ def test_bgp_shutdown(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - tgen.net['r1'].cmd('vtysh -c \"conf t\" -c \"router bgp 65000\" -c \"bgp shutdown message ABCDabcd\"') + tgen.net["r1"].cmd( + 'vtysh -c "conf t" -c "router bgp 65000" -c "bgp shutdown message ABCDabcd"' + ) # Check BGP Summary on local and remote routers for rtrNum in [1, 2, 4]: - logger.info("Checking BGP Summary after shutdown of R1 BGP on router r{}".format(rtrNum)) + logger.info( + "Checking BGP Summary after shutdown of R1 BGP on router r{}".format(rtrNum) + ) router = tgen.gears["r{}".format(rtrNum)] reffile = os.path.join(CWD, "r{}/bgp_shutdown_summary.json".format(rtrNum)) @@ -202,7 +206,9 @@ def test_bgp_shutdown(): topotest.router_json_cmp, router, "show ip bgp summary json", expected ) _, res = topotest.run_and_expect(test_func, None, count=60, wait=2) - assertmsg = "BGP sessions on router R{} are in incorrect state (not down as expected?)".format(rtrNum) + assertmsg = "BGP sessions on router R{} are in incorrect state (not down as expected?)".format( + rtrNum + ) assert res is None, assertmsg @@ -218,18 +224,21 @@ def test_bgp_shutdown_message(): for rtrNum in [2, 4]: logger.info("Checking BGP shutdown received on router r{}".format(rtrNum)) - shut_message = tgen.net['r{}'.format(rtrNum)].cmd( - 'tail bgpd.log | grep "NOTIFICATION.*Cease/Administratively Shutdown"') + shut_message = tgen.net["r{}".format(rtrNum)].cmd( + 'tail bgpd.log | grep "NOTIFICATION.*Cease/Administratively Shutdown"' + ) assertmsg = "BGP shutdown message not received on router R{}".format(rtrNum) - assert shut_message != '', assertmsg + assert shut_message != "", assertmsg - m = re.search('.*([0-9]+ bytes[ 0-9a-fA-F]+)', shut_message) + m = re.search(".*([0-9]+ bytes[ 0-9a-fA-F]+)", shut_message) if m: found = m.group(1) else: - found = '' - assertmsg = "Incorrect BGP shutdown message received on router R{}".format(rtrNum) - assert found == '8 bytes 41 42 43 44 61 62 63 64', assertmsg + found = "" + assertmsg = "Incorrect BGP shutdown message received on router R{}".format( + rtrNum + ) + assert found == "8 bytes 41 42 43 44 61 62 63 64", assertmsg # tgen.mininet_cli() @@ -243,11 +252,15 @@ def test_bgp_no_shutdown(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - tgen.net['r1'].cmd('vtysh -c \"conf t\" -c \"router bgp 65000\" -c \"no bgp shutdown\"') + tgen.net["r1"].cmd('vtysh -c "conf t" -c "router bgp 65000" -c "no bgp shutdown"') # Check BGP Summary on local and remote routers for rtrNum in [1, 2, 4]: - logger.info("Checking BGP Summary after removing bgp shutdown on router r1 on router r{}".format(rtrNum)) + logger.info( + "Checking BGP Summary after removing bgp shutdown on router r1 on router r{}".format( + rtrNum + ) + ) router = tgen.gears["r{}".format(rtrNum)] reffile = os.path.join(CWD, "r{}/bgp_summary.json".format(rtrNum)) @@ -257,7 +270,9 @@ def test_bgp_no_shutdown(): topotest.router_json_cmp, router, "show ip bgp summary json", expected ) _, res = topotest.run_and_expect(test_func, None, count=60, wait=2) - assertmsg = "BGP sessions on router R{} are in incorrect state (not down as expected?)".format(rtrNum) + assertmsg = "BGP sessions on router R{} are in incorrect state (not down as expected?)".format( + rtrNum + ) assert res is None, assertmsg @@ -303,31 +318,43 @@ def test_bgp_metric_config(): # set metric +12 # ! - tgen.net['r1'].cmd('vtysh -c "conf t" -c "router bgp 65000" '+ - '-c "address-family ipv4 unicast" '+ - '-c "neighbor 192.168.0.2 route-map addmetric-in in" '+ - '-c "neighbor 192.168.0.2 route-map addmetric-out out" '+ - '-c "neighbor 192.168.101.2 route-map setmetric-in in" '+ - '-c "neighbor 192.168.101.2 route-map setmetric-out out" ') - tgen.net['r1'].cmd('vtysh -c "conf t" '+ - '-c "ip prefix-list net1 seq 10 permit 192.168.101.0/24" '+ - '-c "ip prefix-list net2 seq 20 permit 192.168.1.0/24"') - tgen.net['r1'].cmd('vtysh -c "conf t" '+ - '-c "route-map setmetric-in permit 10" '+ - '-c "match ip address prefix-list net1" '+ - '-c "set metric 111" '+ - '-c "route-map setmetric-in permit 20"') - tgen.net['r1'].cmd('vtysh -c "conf t" '+ - '-c "route-map setmetric-out permit 10" '+ - '-c "match ip address prefix-list net2" '+ - '-c "set metric 1011" '+ - '-c "route-map setmetric-out permit 20"') - tgen.net['r1'].cmd('vtysh -c "conf t" '+ - '-c "route-map addmetric-in permit 10" '+ - '-c "set metric +11"') - tgen.net['r1'].cmd('vtysh -c "conf t" '+ - '-c "route-map addmetric-out permit 10" '+ - '-c "set metric +12"') + tgen.net["r1"].cmd( + 'vtysh -c "conf t" -c "router bgp 65000" ' + + '-c "address-family ipv4 unicast" ' + + '-c "neighbor 192.168.0.2 route-map addmetric-in in" ' + + '-c "neighbor 192.168.0.2 route-map addmetric-out out" ' + + '-c "neighbor 192.168.101.2 route-map setmetric-in in" ' + + '-c "neighbor 192.168.101.2 route-map setmetric-out out" ' + ) + tgen.net["r1"].cmd( + 'vtysh -c "conf t" ' + + '-c "ip prefix-list net1 seq 10 permit 192.168.101.0/24" ' + + '-c "ip prefix-list net2 seq 20 permit 192.168.1.0/24"' + ) + tgen.net["r1"].cmd( + 'vtysh -c "conf t" ' + + '-c "route-map setmetric-in permit 10" ' + + '-c "match ip address prefix-list net1" ' + + '-c "set metric 111" ' + + '-c "route-map setmetric-in permit 20"' + ) + tgen.net["r1"].cmd( + 'vtysh -c "conf t" ' + + '-c "route-map setmetric-out permit 10" ' + + '-c "match ip address prefix-list net2" ' + + '-c "set metric 1011" ' + + '-c "route-map setmetric-out permit 20"' + ) + tgen.net["r1"].cmd( + 'vtysh -c "conf t" ' + + '-c "route-map addmetric-in permit 10" ' + + '-c "set metric +11"' + ) + tgen.net["r1"].cmd( + 'vtysh -c "conf t" ' + + '-c "route-map addmetric-out permit 10" ' + + '-c "set metric +12"' + ) # # Adding the following configuration to r2: # router bgp 65000 @@ -360,50 +387,72 @@ def test_bgp_metric_config(): # set metric -23 # ! - tgen.net['r2'].cmd('vtysh -c "conf t" -c "router bgp 65000" '+ - '-c "address-family ipv4 unicast" '+ - '-c "neighbor 192.168.0.1 route-map subtractmetric-in in" '+ - '-c "neighbor 192.168.0.1 route-map subtractmetric-out out" '+ - '-c "neighbor 192.168.201.2 route-map setmetric-in in" ' + - '-c "neighbor 192.168.201.2 route-map setmetric-out out" ') - tgen.net['r2'].cmd('vtysh -c "conf t" '+ - '-c "ip prefix-list net1 seq 10 permit 192.168.201.0/24" '+ - '-c "ip prefix-list net2 seq 20 permit 192.168.2.0/24" ') - tgen.net['r2'].cmd('vtysh -c "conf t" '+ - '-c "route-map setmetric-in permit 10" '+ - '-c "match ip address prefix-list net1" '+ - '-c "set metric 222" '+ - '-c "route-map setmetric-in permit 20"') - tgen.net['r2'].cmd('vtysh -c "conf t" '+ - '-c "route-map setmetric-out permit 10" '+ - '-c "match ip address prefix-list net2" '+ - '-c "set metric 2022" '+ - '-c "route-map setmetric-out permit 20"') - tgen.net['r2'].cmd('vtysh -c "conf t" '+ - '-c "route-map subtractmetric-in permit 10" '+ - '-c "set metric -22"') - tgen.net['r2'].cmd('vtysh -c "conf t" '+ - '-c "route-map subtractmetric-out permit 10" '+ - '-c "set metric -23"') + tgen.net["r2"].cmd( + 'vtysh -c "conf t" -c "router bgp 65000" ' + + '-c "address-family ipv4 unicast" ' + + '-c "neighbor 192.168.0.1 route-map subtractmetric-in in" ' + + '-c "neighbor 192.168.0.1 route-map subtractmetric-out out" ' + + '-c "neighbor 192.168.201.2 route-map setmetric-in in" ' + + '-c "neighbor 192.168.201.2 route-map setmetric-out out" ' + ) + tgen.net["r2"].cmd( + 'vtysh -c "conf t" ' + + '-c "ip prefix-list net1 seq 10 permit 192.168.201.0/24" ' + + '-c "ip prefix-list net2 seq 20 permit 192.168.2.0/24" ' + ) + tgen.net["r2"].cmd( + 'vtysh -c "conf t" ' + + '-c "route-map setmetric-in permit 10" ' + + '-c "match ip address prefix-list net1" ' + + '-c "set metric 222" ' + + '-c "route-map setmetric-in permit 20"' + ) + tgen.net["r2"].cmd( + 'vtysh -c "conf t" ' + + '-c "route-map setmetric-out permit 10" ' + + '-c "match ip address prefix-list net2" ' + + '-c "set metric 2022" ' + + '-c "route-map setmetric-out permit 20"' + ) + tgen.net["r2"].cmd( + 'vtysh -c "conf t" ' + + '-c "route-map subtractmetric-in permit 10" ' + + '-c "set metric -22"' + ) + tgen.net["r2"].cmd( + 'vtysh -c "conf t" ' + + '-c "route-map subtractmetric-out permit 10" ' + + '-c "set metric -23"' + ) # Clear IN the bgp neighbors to make sure the route-maps are applied - tgen.net['r1'].cmd('vtysh -c "clear ip bgp 192.168.0.2 in" '+ - '-c "clear ip bgp 192.168.101.2 in"') - tgen.net['r2'].cmd('vtysh -c "clear ip bgp 192.168.0.1 in" '+ - '-c "clear ip bgp 192.168.201.2 in"') + tgen.net["r1"].cmd( + 'vtysh -c "clear ip bgp 192.168.0.2 in" ' + '-c "clear ip bgp 192.168.101.2 in"' + ) + tgen.net["r2"].cmd( + 'vtysh -c "clear ip bgp 192.168.0.1 in" ' + '-c "clear ip bgp 192.168.201.2 in"' + ) # tgen.mininet_cli() # Checking BGP config - should show the bgp metric settings in the route-maps logger.info("Checking BGP configuration for correct 'set metric' values") - setmetric111 = tgen.net['r1'].cmd('vtysh -c "show running" | grep "^ set metric 111"').rstrip() - assertmsg = "'set metric 111' configuration applied to R1, but not visible in configuration" - assert setmetric111 == ' set metric 111', assertmsg + setmetric111 = ( + tgen.net["r1"].cmd('vtysh -c "show running" | grep "^ set metric 111"').rstrip() + ) + assertmsg = ( + "'set metric 111' configuration applied to R1, but not visible in configuration" + ) + assert setmetric111 == " set metric 111", assertmsg - setmetric222 = tgen.net['r2'].cmd('vtysh -c "show running" | grep "^ set metric 222"').rstrip() - assertmsg = "'set metric 222' configuration applied to R2, but not visible in configuration" - assert setmetric222 == ' set metric 222', assertmsg + setmetric222 = ( + tgen.net["r2"].cmd('vtysh -c "show running" | grep "^ set metric 222"').rstrip() + ) + assertmsg = ( + "'set metric 222' configuration applied to R2, but not visible in configuration" + ) + assert setmetric222 == " set metric 222", assertmsg def test_bgp_metric_add_config(): @@ -417,9 +466,13 @@ def test_bgp_metric_add_config(): logger.info("Checking BGP configuration for correct 'set metric' ADD value") - setmetricP11 = tgen.net['r1'].cmd('vtysh -c "show running" | grep "^ set metric +11"').rstrip() - assertmsg = "'set metric +11' configuration applied to R1, but not visible in configuration" - assert setmetricP11 == ' set metric +11', assertmsg + setmetricP11 = ( + tgen.net["r1"].cmd('vtysh -c "show running" | grep "^ set metric +11"').rstrip() + ) + assertmsg = ( + "'set metric +11' configuration applied to R1, but not visible in configuration" + ) + assert setmetricP11 == " set metric +11", assertmsg def test_bgp_metric_subtract_config(): @@ -433,9 +486,13 @@ def test_bgp_metric_subtract_config(): logger.info("Checking BGP configuration for correct 'set metric' SUBTRACT value") - setmetricM22 = tgen.net['r2'].cmd('vtysh -c "show running" | grep "^ set metric -22"').rstrip() - assertmsg = "'set metric -22' configuration applied to R2, but not visible in configuration" - assert setmetricM22 == ' set metric -22', assertmsg + setmetricM22 = ( + tgen.net["r2"].cmd('vtysh -c "show running" | grep "^ set metric -22"').rstrip() + ) + assertmsg = ( + "'set metric -22' configuration applied to R2, but not visible in configuration" + ) + assert setmetricM22 == " set metric -22", assertmsg def test_bgp_set_metric(): @@ -478,47 +535,49 @@ def test_bgp_remove_metric_rmaps(): # Remove metric route-maps and relevant comfiguration - tgen.net['r1'].cmd('vtysh -c "conf t" -c "router bgp 65000" '+ - '-c "address-family ipv4 unicast" '+ - '-c "no neighbor 192.168.0.2 route-map addmetric-in in" '+ - '-c "no neighbor 192.168.0.2 route-map addmetric-out out" '+ - '-c "no neighbor 192.168.101.2 route-map setmetric-in in" '+ - '-c "no neighbor 192.168.101.2 route-map setmetric-out out" ') - tgen.net['r1'].cmd('vtysh -c "conf t" '+ - '-c "no ip prefix-list net1" '+ - '-c "no ip prefix-list net2"') - tgen.net['r1'].cmd('vtysh -c "conf t" '+ - '-c "no route-map setmetric-in" ') - tgen.net['r1'].cmd('vtysh -c "conf t" '+ - '-c "no route-map setmetric-out" ') - tgen.net['r1'].cmd('vtysh -c "conf t" '+ - '-c "no route-map addmetric-in" ') - tgen.net['r1'].cmd('vtysh -c "conf t" '+ - '-c "no route-map addmetric-out" ') - - tgen.net['r2'].cmd('vtysh -c "conf t" -c "router bgp 65000" '+ - '-c "address-family ipv4 unicast" '+ - '-c "no neighbor 192.168.0.1 route-map subtractmetric-in in" '+ - '-c "no neighbor 192.168.0.1 route-map subtractmetric-out out" '+ - '-c "no neighbor 192.168.201.2 route-map setmetric-in in" ' + - '-c "no neighbor 192.168.201.2 route-map setmetric-out out" ') - tgen.net['r2'].cmd('vtysh -c "conf t" '+ - '-c "no ip prefix-list net1" '+ - '-c "no ip prefix-list net2" ') - tgen.net['r2'].cmd('vtysh -c "conf t" '+ - '-c "no route-map setmetric-in" ') - tgen.net['r2'].cmd('vtysh -c "conf t" '+ - '-c "no route-map setmetric-out" ') - tgen.net['r2'].cmd('vtysh -c "conf t" '+ - '-c "no route-map addmetric-in" ') - tgen.net['r2'].cmd('vtysh -c "conf t" '+ - '-c "no route-map addmetric-out" ') + tgen.net["r1"].cmd( + 'vtysh -c "conf t" -c "router bgp 65000" ' + + '-c "address-family ipv4 unicast" ' + + '-c "no neighbor 192.168.0.2 route-map addmetric-in in" ' + + '-c "no neighbor 192.168.0.2 route-map addmetric-out out" ' + + '-c "no neighbor 192.168.101.2 route-map setmetric-in in" ' + + '-c "no neighbor 192.168.101.2 route-map setmetric-out out" ' + ) + tgen.net["r1"].cmd( + 'vtysh -c "conf t" ' + + '-c "no ip prefix-list net1" ' + + '-c "no ip prefix-list net2"' + ) + tgen.net["r1"].cmd('vtysh -c "conf t" ' + '-c "no route-map setmetric-in" ') + tgen.net["r1"].cmd('vtysh -c "conf t" ' + '-c "no route-map setmetric-out" ') + tgen.net["r1"].cmd('vtysh -c "conf t" ' + '-c "no route-map addmetric-in" ') + tgen.net["r1"].cmd('vtysh -c "conf t" ' + '-c "no route-map addmetric-out" ') + + tgen.net["r2"].cmd( + 'vtysh -c "conf t" -c "router bgp 65000" ' + + '-c "address-family ipv4 unicast" ' + + '-c "no neighbor 192.168.0.1 route-map subtractmetric-in in" ' + + '-c "no neighbor 192.168.0.1 route-map subtractmetric-out out" ' + + '-c "no neighbor 192.168.201.2 route-map setmetric-in in" ' + + '-c "no neighbor 192.168.201.2 route-map setmetric-out out" ' + ) + tgen.net["r2"].cmd( + 'vtysh -c "conf t" ' + + '-c "no ip prefix-list net1" ' + + '-c "no ip prefix-list net2" ' + ) + tgen.net["r2"].cmd('vtysh -c "conf t" ' + '-c "no route-map setmetric-in" ') + tgen.net["r2"].cmd('vtysh -c "conf t" ' + '-c "no route-map setmetric-out" ') + tgen.net["r2"].cmd('vtysh -c "conf t" ' + '-c "no route-map addmetric-in" ') + tgen.net["r2"].cmd('vtysh -c "conf t" ' + '-c "no route-map addmetric-out" ') # Clear IN the bgp neighbors to make sure the route-maps are applied - tgen.net['r1'].cmd('vtysh -c "clear ip bgp 192.168.0.2 in" '+ - '-c "clear ip bgp 192.168.101.2 in"') - tgen.net['r2'].cmd('vtysh -c "clear ip bgp 192.168.0.1 in" '+ - '-c "clear ip bgp 192.168.201.2 in"') + tgen.net["r1"].cmd( + 'vtysh -c "clear ip bgp 192.168.0.2 in" ' + '-c "clear ip bgp 192.168.101.2 in"' + ) + tgen.net["r2"].cmd( + 'vtysh -c "clear ip bgp 192.168.0.1 in" ' + '-c "clear ip bgp 192.168.201.2 in"' + ) # tgen.mininet_cli() @@ -534,7 +593,9 @@ def test_bgp_remove_metric_rmaps(): topotest.router_json_cmp, router, "show ip bgp json", expected ) _, res = topotest.run_and_expect(test_func, None, count=60, wait=2) - assertmsg = "BGP routes on router r{} are wrong after removing metric route-maps".format(rtrNum) + assertmsg = "BGP routes on router r{} are wrong after removing metric route-maps".format( + rtrNum + ) assert res is None, assertmsg @@ -549,15 +610,17 @@ def test_bgp_norib(): logger.info("Configuring 'bgp no-rib' on router r1") - tgen.net['r1'].cmd('vtysh -c \"conf t\" -c \"bgp no-rib\"') + tgen.net["r1"].cmd('vtysh -c "conf t" -c "bgp no-rib"') # Checking BGP config - should show the "bgp no-rib" under the router bgp section logger.info("Checking BGP configuration for 'bgp no-rib'") - norib_cfg = tgen.net['r1'].cmd('vtysh -c "show running bgpd" | grep "^bgp no-rib"').rstrip() + norib_cfg = ( + tgen.net["r1"].cmd('vtysh -c "show running bgpd" | grep "^bgp no-rib"').rstrip() + ) assertmsg = "'bgp no-rib' configuration applied, but not visible in configuration" - assert norib_cfg == 'bgp no-rib', assertmsg + assert norib_cfg == "bgp no-rib", assertmsg def test_bgp_norib_routes(): @@ -585,7 +648,11 @@ def test_bgp_norib_routes(): # Check BGP Summary on local and remote routers for rtrNum in [1, 2, 4]: - logger.info("Checking BGP Summary after 'bgp no-rib' on router r1 on router r{}".format(rtrNum)) + logger.info( + "Checking BGP Summary after 'bgp no-rib' on router r1 on router r{}".format( + rtrNum + ) + ) router = tgen.gears["r{}".format(rtrNum)] reffile = os.path.join(CWD, "r{}/bgp_summary.json".format(rtrNum)) @@ -595,7 +662,9 @@ def test_bgp_norib_routes(): topotest.router_json_cmp, router, "show ip bgp summary json", expected ) _, res = topotest.run_and_expect(test_func, None, count=30, wait=2) - assertmsg = "BGP sessions on router R{} has incorrect routes after adding 'bgp no-rib on r1'".format(rtrNum) + assertmsg = "BGP sessions on router R{} has incorrect routes after adding 'bgp no-rib on r1'".format( + rtrNum + ) assert res is None, assertmsg # tgen.mininet_cli() @@ -612,15 +681,21 @@ def test_bgp_disable_norib(): logger.info("Configuring 'no bgp no-rib' on router r1") - tgen.net['r1'].cmd('vtysh -c \"conf t\" -c \"no bgp no-rib\"') + tgen.net["r1"].cmd('vtysh -c "conf t" -c "no bgp no-rib"') # Checking BGP config - should show the "bgp no-rib" under the router bgp section logger.info("Checking BGP configuration for 'bgp no-rib'") - norib_cfg = tgen.net['r1'].cmd('vtysh -c "show running bgpd" | grep "^ bgp no-rib"').rstrip() + norib_cfg = ( + tgen.net["r1"] + .cmd('vtysh -c "show running bgpd" | grep "^ bgp no-rib"') + .rstrip() + ) - assertmsg = "'no bgp no-rib'configuration applied, but still visible in configuration" - assert norib_cfg == '', assertmsg + assertmsg = ( + "'no bgp no-rib'configuration applied, but still visible in configuration" + ) + assert norib_cfg == "", assertmsg def test_bgp_disable_norib_routes(): @@ -648,7 +723,11 @@ def test_bgp_disable_norib_routes(): # Check BGP Summary on local and remote routers for rtrNum in [1, 2, 4]: - logger.info("Checking BGP Summary after removing the 'bgp no-rib' on router r1 on router r{}".format(rtrNum)) + logger.info( + "Checking BGP Summary after removing the 'bgp no-rib' on router r1 on router r{}".format( + rtrNum + ) + ) router = tgen.gears["r{}".format(rtrNum)] reffile = os.path.join(CWD, "r{}/bgp_summary.json".format(rtrNum)) @@ -658,13 +737,14 @@ def test_bgp_disable_norib_routes(): topotest.router_json_cmp, router, "show ip bgp summary json", expected ) _, res = topotest.run_and_expect(test_func, None, count=30, wait=2) - assertmsg = "BGP sessions on router R{} has incorrect routes after removing 'bgp no-rib on r1'".format(rtrNum) + assertmsg = "BGP sessions on router R{} has incorrect routes after removing 'bgp no-rib on r1'".format( + rtrNum + ) assert res is None, assertmsg # tgen.mininet_cli() - if __name__ == "__main__": args = ["-s"] + sys.argv[1:] sys.exit(pytest.main(args)) diff --git a/tests/topotests/bgp_flowspec/test_bgp_flowspec_topo.py b/tests/topotests/bgp_flowspec/test_bgp_flowspec_topo.py index 7e6bfc8b2b..a772a2aab1 100644 --- a/tests/topotests/bgp_flowspec/test_bgp_flowspec_topo.py +++ b/tests/topotests/bgp_flowspec/test_bgp_flowspec_topo.py @@ -200,6 +200,7 @@ def test_bgp_flowspec(): else: logger.info("Check BGP FS entry for 3::3 with redirect IP OK") + if __name__ == "__main__": args = ["-s"] + sys.argv[1:] diff --git a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1.py b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1.py index fdbd317093..097b654e77 100644 --- a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1.py +++ b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1.py @@ -28,61 +28,63 @@ Basic Common Test steps for all the test case below : - Verify for bgp to converge - Configure BGP Garceful Restart on both the routers. -1. Helper BGP router R1, mark and unmark IPV4 routes - as stale as the restarting router R2 come up within the restart time. -2. Helper BGP router R1, mark IPV4 routes as stale and - deletes them as the restarting router R2 did-not come up within restart - time. -3. Restart BGP router R1, detects it is connected to R2, - which is a helper router. Verify the restart capability i.e. R bit - are sent after R1 reloads and comes back. -4. Verify that the restarting node sets "R" bit while sending the +1. Transition from Peer-level helper to Global Restarting +2. Transition from Peer-level helper to Global inherit helper +3. Transition from Peer-level restarting to Global inherit helper +4. Default GR functional mode is Helper. +5. Verify that the restarting node sets "R" bit while sending the BGP open messages after the node restart, only if GR is enabled. -5. Verify if restarting node resets R bit in BGP open message - during normal BGP session flaps as well, even when GR restarting mode is enabled. - Here link flap happen due to interface UP/DOWN. 6. Verify if restarting node resets R bit in BGP open message - during normal BGP session flaps as well, even when GR restarting mode is enabled. - Here link flap happen due to neigh router restarts -7. Verify if restarting node resets R bit in BGP open message - during normal BGP session flaps when GR helper mode is enabled. - Here link flap happen due to interface UP/DOWN. -8. Verify if restarting node resets R bit in BGP open message - during normal BGP session flaps when GR helper mode is enabled. - Here link flap happen due to neigh router restarts. -9. Verify that restarting nodes set "F" bit while sending + during normal BGP session flaps as well, even when GR restarting + mode is enabled. Here link flap happen due to interface UP/DOWN. +7. Verify if restarting node resets R bit in BGP + open message during normal BGP session flaps when GR is disabled. +8. Verify that restarting nodes set "F" bit while sending the BGP open messages after it restarts, only when BGP GR is enabled. -10. Verify that restarting nodes reset "F" bit while sending - the BGP open messages after it's restarts, when BGP GR is **NOT** enabled. -11. Verify that only GR helper routers keep the stale +9. Verify that only GR helper routers keep the stale route entries, not any GR disabled router. -12. Verify that GR helper routers keeps all the routes received - from restarting node if both the routers are configured as GR restarting node. -13. Verify that GR helper routers delete all the routes - received from a node if both the routers are configured as GR helper node. -14. Test Objective : After BGP neighborship is established and GR capability - is exchanged, transition helper router to disabled state. -15.Test Objective : After BGP neighborship is established and GR capability - is exchanged, transition disabled router to helper state. -16. Verify transition from Global Restarting to Disable and then - Global Disable to Restarting. -17. Verify transition from Global Helper to Disable and then Global +10. Verify that GR helper routers keeps all the routes received + from restarting node if both the routers are configured as + GR restarting node. +11. Verify that GR helper routers delete all the routes + received from a node if both the routers are configured as GR + helper node. +12. After BGP neighborship is established and GR capability is exchanged, + transition restarting router to disabled state and vice versa. +13. After BGP neighborship is established and GR capability is exchanged, + transition restarting router to disabled state and vice versa. +14. Verify that restarting nodes reset "F" bit while sending + the BGP open messages after it's restarts, when BGP GR is **NOT** enabled. +15. Verify that only GR helper routers keep the stale + route entries, not any GR disabled router. +16. Transition from Global Restarting to Disable and then Global + Disable to Restarting. +17. Transition from Global Helper to Disable and then Global Disable to Helper. -18. Verify transition from Global Restart to Helper and then Global - Helper to Restart. -19. Verify transition from Peer-level helper to Global Restarting. -20. Verify transition from Peer-level restart to Global Restart. -21. Verify transition from Peer-level disabled to Global Restart. -22. Verify Peer-level inherit from Global Restarting mode. -23. Verify transition from Peer-level helper to Global inherit helper. -24. Verify transition from Peer-level restart to Global inherit helper. -25. Verify transition from Peer-level disbale to Global inherit helper. -26. Verify default GR functional mode is Helper. -27. Verify transition from Peer-level Helper to Global Disable. -28. Verify transition from Peer-level Restarting to Global Disable. -29. Verify transition from Peer-level Disable to Global Disable. -30. Verfiy Peer-level inherit from Global Disable mode. - +18. Transition from Global Restart to Helper and then Global + Helper to Restart, Global Mode : GR Restarting + PerPeer Mode : GR Helper + GR Mode effective : GR Helper +19. Transition from Peer-level helper to Global Restarting, + Global Mode : GR Restarting + PerPeer Mode : GR Restarting + GR Mode effective : GR Restarting +20. Transition from Peer-level restart to Global Restart + Global Mode : GR Restarting + PerPeer Mode : GR Restarting + GR Mode effective : GR Restarting +21. Transition from Peer-level disabled to Global Restart + Global Mode : GR Restarting + PerPeer Mode : GR Disabled + GR Mode effective : GR Disabled +22. Peer-level inherit from Global Restarting + Global Mode : GR Restart + PerPeer Mode : None + GR Mode effective : GR Restart +23. Transition from Peer-level disbale to Global inherit helper + Global Mode : None + PerPeer Mode : GR Disable + GR Mode effective : GR Disable """ import os @@ -91,7 +93,6 @@ import json import time import inspect import pytest -from time import sleep # Save the Current Working Directory to find configuration files. CWD = os.path.dirname(os.path.realpath(__file__)) @@ -116,8 +117,9 @@ from lib.bgp import ( create_router_bgp, verify_r_bit, verify_f_bit, - verify_bgp_convergence, verify_graceful_restart_timers, + verify_bgp_convergence, + verify_bgp_convergence_from_running_config, ) from lib.common_config import ( @@ -135,7 +137,7 @@ from lib.common_config import ( kill_mininet_routers_process, get_frr_ipv6_linklocal, create_route_maps, - required_linux_kernel_version + required_linux_kernel_version, ) # Reading the data from JSON File for topology and configuration creation @@ -188,7 +190,7 @@ def setup_module(mod): global ADDR_TYPES # Required linux kernel version for this suite to run. - result = required_linux_kernel_version('4.15') + result = required_linux_kernel_version("4.16") if result is not True: pytest.skip("Kernel requirements are not met") @@ -219,11 +221,10 @@ def setup_module(mod): # Api call verify whether BGP is converged ADDR_TYPES = check_address_types() - for addr_type in ADDR_TYPES: - BGP_CONVERGENCE = verify_bgp_convergence(tgen, topo) - assert BGP_CONVERGENCE is True, "setup_module : Failed \n Error:" " {}".format( - BGP_CONVERGENCE - ) + BGP_CONVERGENCE = verify_bgp_convergence(tgen, topo) + assert BGP_CONVERGENCE is True, "setup_module : Failed \n Error:" " {}".format( + BGP_CONVERGENCE + ) logger.info("Running setup_module() done") @@ -259,6 +260,12 @@ def configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut, peer): for addr_type in ADDR_TYPES: clear_bgp(tgen, addr_type, dut) + for addr_type in ADDR_TYPES: + clear_bgp(tgen, addr_type, peer) + + result = verify_bgp_convergence_from_running_config(tgen) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) + return True @@ -351,6 +358,32 @@ def test_BGP_GR_TC_46_p1(request): tc_name, result ) + for addr_type in ADDR_TYPES: + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, "r2", "r1", addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, "r2", input_topo, next_hop, protocol) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + for addr_type in ADDR_TYPES: + next_hop = next_hop_per_address_family( + tgen, "r1", "r2", addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, "r1", input_topo, next_hop) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + result = verify_rib(tgen, addr_type, "r1", input_topo, next_hop, protocol) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + step("Kill BGP on R2") kill_router_daemons(tgen, "r2", ["bgpd"]) @@ -423,7 +456,8 @@ def test_BGP_GR_TC_46_p1(request): } } - configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + result = create_router_bgp(tgen, topo, input_dict) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) step("Verify on R2 that R1 advertises GR capabilities as a restarting node") @@ -440,6 +474,36 @@ def test_BGP_GR_TC_46_p1(request): tc_name, result ) + for addr_type in ADDR_TYPES: + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, "r1", "r2", addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, "r1", input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} : Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + for addr_type in ADDR_TYPES: + next_hop = next_hop_per_address_family( + tgen, "r2", "r1", addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, "r2", input_topo, next_hop) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + result = verify_rib(tgen, addr_type, "r2", input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} : Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + step("Kill BGP on R1") kill_router_daemons(tgen, "r1", ["bgpd"]) @@ -547,6 +611,9 @@ def test_BGP_GR_TC_50_p1(request): configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + result = verify_bgp_convergence_from_running_config(tgen) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) + step("Verify on R2 that R1 advertises GR capabilities as a helper node") for addr_type in ADDR_TYPES: @@ -557,6 +624,32 @@ def test_BGP_GR_TC_50_p1(request): tc_name, result ) + for addr_type in ADDR_TYPES: + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, "r2", "r1", addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, "r2", input_topo, next_hop, protocol) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + for addr_type in ADDR_TYPES: + next_hop = next_hop_per_address_family( + tgen, "r1", "r2", addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, "r1", input_topo, next_hop) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + result = verify_rib(tgen, addr_type, "r1", input_topo, next_hop, protocol) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + step("Kill BGP on R2") kill_router_daemons(tgen, "r2", ["bgpd"]) @@ -628,6 +721,9 @@ def test_BGP_GR_TC_50_p1(request): configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + result = verify_bgp_convergence_from_running_config(tgen) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) + step("Verify on R2 that R1 still advertises GR capabilities as a helper node") input_dict = { @@ -643,6 +739,36 @@ def test_BGP_GR_TC_50_p1(request): tc_name, result ) + for addr_type in ADDR_TYPES: + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, "r2", "r1", addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, "r2", input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} : Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + for addr_type in ADDR_TYPES: + next_hop = next_hop_per_address_family( + tgen, "r1", "r2", addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, "r1", input_topo, next_hop) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + result = verify_rib(tgen, addr_type, "r1", input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} : Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + step("Kill BGP on R2") kill_router_daemons(tgen, "r2", ["bgpd"]) @@ -756,6 +882,32 @@ def test_BGP_GR_TC_51_p1(request): tc_name, result ) + for addr_type in ADDR_TYPES: + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, "r1", "r2", addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, "r1", input_topo, next_hop, protocol) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + for addr_type in ADDR_TYPES: + next_hop = next_hop_per_address_family( + tgen, "r2", "r1", addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, "r2", input_topo, next_hop) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + result = verify_rib(tgen, addr_type, "r2", input_topo, next_hop, protocol) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + step("Kill BGP on R1") kill_router_daemons(tgen, "r1", ["bgpd"]) @@ -842,6 +994,36 @@ def test_BGP_GR_TC_51_p1(request): tc_name, result ) + for addr_type in ADDR_TYPES: + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, "r2", "r1", addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, "r2", input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} : Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + for addr_type in ADDR_TYPES: + next_hop = next_hop_per_address_family( + tgen, "r1", "r2", addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, "r1", input_topo, next_hop) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + result = verify_rib(tgen, addr_type, "r1", input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} : Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + step("Kill BGPd on R2") kill_router_daemons(tgen, "r2", ["bgpd"]) @@ -933,14 +1115,6 @@ def test_BGP_GR_TC_53_p1(request): tc_name, result ) - step("Kill BGPd on R2") - - kill_router_daemons(tgen, "r2", ["bgpd"]) - - step( - "Verify that R2 keeps the stale entries in FIB & R1 keeps stale entries in RIB & FIB" - ) - for addr_type in ADDR_TYPES: protocol = "bgp" next_hop = next_hop_per_address_family( @@ -967,674 +1141,43 @@ def test_BGP_GR_TC_53_p1(request): tc_name, result ) - step("Start BGP on R2") - - start_router_daemons(tgen, "r2", ["bgpd"]) - - write_test_footer(tc_name) - - -def test_BGP_GR_UTP_1_3_p0(request): - """ - Test Objective : Helper BGP router R1, mark and unmark IPV4 routes - as stale as the restarting router R2 come up within the restart time - - Test Objective : Helper BGP router R1, mark IPV4 routes as stale and - deletes them as the restarting router R2 did-not come up within - restart time. - """ - - tgen = get_topogen() - tc_name = request.node.name - write_test_header(tc_name) - - # Don't run this test if we have any failure. - if tgen.routers_have_failure(): - pytest.skip(tgen.errors) - - # Create route-map to prefer global next-hop - input_dict = { - "r1": { - "route_maps": { - "rmap_global": [ - {"action": "permit", "set": {"ipv6": {"nexthop": "prefer-global"}}} - ] - } - }, - "r2": { - "route_maps": { - "rmap_global": [ - {"action": "permit", "set": {"ipv6": {"nexthop": "prefer-global"}}} - ] - } - }, - } - result = create_route_maps(tgen, input_dict) - assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) - - # Configure neighbor for route map - input_dict_1 = { - "r1": { - "bgp": { - "address_family": { - "ipv6": { - "unicast": { - "neighbor": { - "r2": { - "dest_link": { - "r1-link1": { - "route_maps": [ - { - "name": "rmap_global", - "direction": "in", - } - ] - } - } - } - } - } - } - } - } - }, - "r2": { - "bgp": { - "address_family": { - "ipv6": { - "unicast": { - "neighbor": { - "r1": { - "dest_link": { - "r2-link1": { - "route_maps": [ - { - "name": "rmap_global", - "direction": "in", - } - ] - } - } - } - } - } - } - } - } - }, - } - - result = create_router_bgp(tgen, topo, input_dict_1) - assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) - - # Configure graceful-restart - input_dict = { - "r1": { - "bgp": { - "address_family": { - "ipv4": { - "unicast": { - "neighbor": { - "r2": { - "dest_link": { - "r1-link1": {"graceful-restart-helper": True} - } - } - } - } - }, - "ipv6": { - "unicast": { - "neighbor": { - "r2": { - "dest_link": { - "r1-link1": {"graceful-restart-helper": True} - } - } - } - } - }, - } - } - }, - "r2": { - "bgp": { - "graceful-restart": {"timer": {"restart-time": GR_RESTART_TIMER}}, - "address_family": { - "ipv4": { - "unicast": { - "neighbor": { - "r1": { - "dest_link": { - "r2-link1": {"graceful-restart": True} - } - } - } - } - }, - "ipv6": { - "unicast": { - "neighbor": { - "r1": { - "dest_link": { - "r2-link1": {"graceful-restart": True} - } - } - } - } - }, - }, - } - }, - } - - configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r2", peer="r1") - - for addr_type in ADDR_TYPES: - result = verify_graceful_restart( - tgen, topo, addr_type, input_dict, dut="r2", peer="r1" - ) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - # Verifying BGP RIB routes - dut = "r1" - peer = "r2" - next_hop = next_hop_per_address_family( - tgen, dut, peer, addr_type, NEXT_HOP_IP_2, preferred_next_hop="global" - ) - input_topo = {key: topo["routers"][key] for key in ["r2"]} - result = verify_bgp_rib(tgen, addr_type, dut, input_topo) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - # Verifying RIB routes - result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, "bgp") - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - logger.info("[Phase 2] : R2 goes for reload ") + step("Kill BGPd on R2") kill_router_daemons(tgen, "r2", ["bgpd"]) - logger.info( - "[Phase 3] : R2 is still down, restart time 120 sec." - " So time verify the routes are present in BGP RIB" - " and ZEBRA" + step( + "Verify that R2 keeps the stale entries in FIB & R1 keeps stale entries in RIB & FIB" ) for addr_type in ADDR_TYPES: - # Verifying BGP RIB routes - next_hop = next_hop_per_address_family( - tgen, dut, peer, addr_type, NEXT_HOP_IP_2, preferred_next_hop="global" - ) - result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - # Verifying RIB routes protocol = "bgp" - result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - logger.info("[Phase 4] : sleep for {} sec".format(GR_RESTART_TIMER)) - sleep(GR_RESTART_TIMER) - - logger.info("[Phase 5] : Verify the routes from r2 ") - - for addr_type in ADDR_TYPES: - # Verifying BGP RIB routes - next_hop = NEXT_HOP_IP_2[addr_type] - input_topo = {key: topo["routers"][key] for key in ["r2"]} - result = verify_bgp_rib(tgen, addr_type, dut, input_topo, expected=False) - assert result is not True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - logger.info(" Expected behavior: {}".format(result)) - - # Verifying RIB routes - result = verify_rib( - tgen, addr_type, dut, input_topo, next_hop, "bgp", expected=False - ) - assert result is not True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - logger.info(" Expected behavior: {}".format(result)) - - logger.info("[Phase 5] : R2 is about to come up now ") - start_router_daemons(tgen, "r2", ["bgpd"]) - - logger.info("[Phase 5] : R2 is UP Now ! ") - - for addr_type in ADDR_TYPES: - # Verifying GR stats - result = verify_graceful_restart( - tgen, topo, addr_type, input_dict, dut="r2", peer="r1" - ) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - result = verify_r_bit(tgen, topo, addr_type, input_dict, dut="r1", peer="r2") - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - # Verifying BGP RIB routes next_hop = next_hop_per_address_family( - tgen, dut, peer, addr_type, NEXT_HOP_IP_2, preferred_next_hop="global" - ) - result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - # Verifying RIB routes - result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - write_test_footer(tc_name) - - -def test_BGP_GR_UTP_15_TC_9_p1(request): - """ - Test Objective : Restart BGP router R1, detects it is connected to R2, - which is a helper router. Verify the restart capability i.e. R bit - are sent after R1 reloads and comes back. - - Test Objective : Verify that restarting nodes reset "F" bit while sending - the BGP open messages after it's restarts, when BGP GR is **NOT** enabled. - """ - - tgen = get_topogen() - tc_name = request.node.name - write_test_header(tc_name) - - # Checking router status, starting if not running - check_router_status(tgen) - - # Don't run this test if we have any failure. - if tgen.routers_have_failure(): - pytest.skip(tgen.errors) - - # Creating configuration from JSON - # reset_config_on_routers(tgen) - - # Create route-map to prefer global next-hop - input_dict = { - "r1": { - "route_maps": { - "rmap_global": [ - {"action": "permit", "set": {"ipv6": {"nexthop": "prefer-global"}}} - ] - } - }, - "r2": { - "route_maps": { - "rmap_global": [ - {"action": "permit", "set": {"ipv6": {"nexthop": "prefer-global"}}} - ] - } - }, - } - result = create_route_maps(tgen, input_dict) - assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) - - # Configure neighbor for route map - input_dict_1 = { - "r1": { - "bgp": { - "address_family": { - "ipv6": { - "unicast": { - "neighbor": { - "r2": { - "dest_link": { - "r1-link1": { - "route_maps": [ - { - "name": "rmap_global", - "direction": "in", - } - ] - } - } - } - } - } - } - } - } - }, - "r2": { - "bgp": { - "address_family": { - "ipv6": { - "unicast": { - "neighbor": { - "r1": { - "dest_link": { - "r2-link1": { - "route_maps": [ - { - "name": "rmap_global", - "direction": "in", - } - ] - } - } - } - } - } - } - } - } - }, - } - - result = create_router_bgp(tgen, topo, input_dict_1) - assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) - - logger.info( - "[Phase 1] : Test Setup " "[Helper Mode]R1-----R2[Restart Mode] initialized " - ) - - # Configure graceful-restart - input_dict = { - "r1": { - "bgp": { - "address_family": { - "ipv4": { - "unicast": { - "neighbor": { - "r2": { - "dest_link": { - "r1-link1": {"graceful-restart": True} - } - } - } - } - }, - "ipv6": { - "unicast": { - "neighbor": { - "r2": { - "dest_link": { - "r1-link1": {"graceful-restart": True} - } - } - } - } - }, - } - } - }, - "r2": { - "bgp": { - "address_family": { - "ipv4": { - "unicast": { - "neighbor": { - "r1": { - "dest_link": { - "r2-link1": {"graceful-restart-helper": True} - } - } - } - } - }, - "ipv6": { - "unicast": { - "neighbor": { - "r1": { - "dest_link": { - "r2-link1": {"graceful-restart-helper": True} - } - } - } - } - }, - } - } - }, - } - - configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") - - for addr_type in ADDR_TYPES: - result = verify_graceful_restart( - tgen, topo, addr_type, input_dict, dut="r1", peer="r2" - ) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - # Verifying BGP RIB routes - dut = "r1" - peer = "r2" - next_hop = next_hop_per_address_family( - tgen, dut, peer, addr_type, NEXT_HOP_IP_2, preferred_next_hop="global" - ) - input_topo = {key: topo["routers"][key] for key in ["r2"]} - result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result + tgen, "r2", "r1", addr_type, NEXT_HOP_IP_1 ) - - # Verifying RIB routes - protocol = "bgp" - result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, "r2", input_topo, next_hop, protocol) assert result is True, "Testcase {} : Failed \n Error {}".format( tc_name, result ) - logger.info("[Phase 2] : R1 goes for reload ") - - kill_router_daemons(tgen, "r1", ["bgpd"]) - - logger.info("[Phase 6] : R1 is about to come up now ") - start_router_daemons(tgen, "r1", ["bgpd"]) - for addr_type in ADDR_TYPES: - # Verifying GR stats - result = verify_graceful_restart( - tgen, topo, addr_type, input_dict, dut="r1", peer="r2" - ) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - result = verify_r_bit(tgen, topo, addr_type, input_dict, dut="r2", peer="r1") - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - # Verifying BGP RIB routes next_hop = next_hop_per_address_family( - tgen, dut, peer, addr_type, NEXT_HOP_IP_2, preferred_next_hop="global" - ) - result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - # Verifying RIB routes - result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - result = verify_r_bit(tgen, topo, addr_type, input_dict, dut="r1", peer="r2") - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - result = verify_f_bit( - tgen, topo, addr_type, input_dict, dut="r1", peer="r2", expected=False - ) - assert result is not True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - write_test_footer(tc_name) - - -def test_BGP_GR_UTP_35_p1(request): - """ - Test Objective : Restart BGP router R1 connected to R2, - which is a restart router. - R1 should not send any GR capability in the open message, - however it would process open message from R2 with GR -restart - capability, but would not perform any BGP GR functionality. - """ - - tgen = get_topogen() - tc_name = request.node.name - write_test_header(tc_name) - - # Check router status - check_router_status(tgen) - - # Don't run this test if we have any failure. - if tgen.routers_have_failure(): - pytest.skip(tgen.errors) - - # Creating configuration from JSON - reset_config_on_routers(tgen) - - logger.info( - "[Phase 1] : Test Setup" " [Disable Mode]R1-----R2[Restart Mode] initialized " - ) - - # Configure graceful-restart - input_dict = { - "r1": { - "bgp": { - "address_family": { - "ipv4": { - "unicast": { - "neighbor": { - "r2": { - "dest_link": { - "r1-link1": {"graceful-restart-disable": True} - } - } - } - } - }, - "ipv6": { - "unicast": { - "neighbor": { - "r2": { - "dest_link": { - "r1-link1": {"graceful-restart-disable": True} - } - } - } - } - }, - } - } - }, - "r2": { - "bgp": { - "address_family": { - "ipv4": { - "unicast": { - "neighbor": { - "r1": { - "dest_link": { - "r2-link1": {"graceful-restart": True} - } - } - } - } - }, - "ipv6": { - "unicast": { - "neighbor": { - "r1": { - "dest_link": { - "r2-link1": {"graceful-restart": True} - } - } - } - } - }, - } - } - }, - } - - configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") - - for addr_type in ADDR_TYPES: - result = verify_graceful_restart( - tgen, topo, addr_type, input_dict, dut="r1", peer="r2" - ) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) - - # Verifying BGP RIB routes - dut = "r1" - peer = "r2" - next_hop = next_hop_per_address_family( - tgen, dut, peer, addr_type, NEXT_HOP_IP_2 - ) - input_topo = {key: topo["routers"][key] for key in ["r2"]} - result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result + tgen, "r1", "r2", addr_type, NEXT_HOP_IP_2 ) - - # Verifying RIB routes - protocol = "bgp" - result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, "r1", input_topo, next_hop) assert result is True, "Testcase {} : Failed \n Error {}".format( tc_name, result ) - logger.info("[Phase 2] : R1 goes for reload ") - - kill_router_daemons(tgen, "r1", ["bgpd"]) - - logger.info("[Phase 3] : R1 is about to come up now ") - start_router_daemons(tgen, "r1", ["bgpd"]) - - logger.info("[Phase 4] : R2 is UP now, so time to collect GR stats ") - - for addr_type in ADDR_TYPES: - result = verify_graceful_restart( - tgen, topo, addr_type, input_dict, dut="r1", peer="r2" - ) + result = verify_rib(tgen, addr_type, "r1", input_topo, next_hop, protocol) assert result is True, "Testcase {} : Failed \n Error {}".format( tc_name, result ) - # Verifying BGP RIB routes - next_hop = next_hop_per_address_family( - tgen, dut, peer, addr_type, NEXT_HOP_IP_2 - ) - input_topo = {key: topo["routers"][key] for key in ["r2"]} - result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) + step("Start BGP on R2") - # Verifying RIB routes - result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) - assert result is True, "Testcase {} : Failed \n Error {}".format( - tc_name, result - ) + start_router_daemons(tgen, "r2", ["bgpd"]) write_test_footer(tc_name) @@ -2151,6 +1694,9 @@ def test_BGP_GR_TC_6_1_2_p1(request): clear_bgp(tgen, addr_type, "r1") clear_bgp(tgen, addr_type, "r2") + result = verify_bgp_convergence_from_running_config(tgen, topo) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) + # Verify GR stats input_dict = { "r2": { @@ -3097,6 +2643,9 @@ def test_BGP_GR_TC_31_1_p1(request): clear_bgp(tgen, addr_type, "r1") clear_bgp(tgen, addr_type, "r2") + result = verify_bgp_convergence_from_running_config(tgen, topo) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) + # Verify GR stats input_dict = { "r1": { @@ -3374,6 +2923,9 @@ def test_BGP_GR_TC_31_2_p1(request): clear_bgp(tgen, addr_type, "r1") clear_bgp(tgen, addr_type, "r2") + result = verify_bgp_convergence_from_running_config(tgen, topo) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) + # Verify GR stats input_dict = { "r2": { @@ -3444,6 +2996,46 @@ def test_BGP_GR_TC_31_2_p1(request): tc_name, result ) + for addr_type in ADDR_TYPES: + # Verifying RIB routes + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {key: topo["routers"][key] for key in ["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + logger.info("[Phase 6] : R1 is about to come up now ") + start_router_daemons(tgen, "r1", ["bgpd"]) + + logger.info("[Phase 4] : R1 is UP now, so time to collect GR stats ") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + # Verifying BGP RIB routes + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + # Verifying RIB routes + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + logger.info("[Phase 3] : R1 goes for reload ") kill_router_daemons(tgen, "r1", ["bgpd"]) @@ -3496,6 +3088,2326 @@ def test_BGP_GR_TC_31_2_p1(request): write_test_footer(tc_name) +def test_BGP_GR_TC_9_p1(request): + """ + Test Objective : Verify that restarting nodes reset "F" bit while sending + the BGP open messages after it's restarts, when BGP GR is **NOT** enabled. + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + logger.info( + "[Phase 1] : Test Setup" " [Restart Mode]R1-----R2[Helper Mode] Initiliazed " + ) + + # Configure graceful-restart + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart": True} + } + } + } + } + }, + } + } + }, + "r2": { + "bgp": { + "graceful-restart": {"preserve-fw-state": True}, + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r2-link1": {"graceful-restart-helper": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r2-link1": {"graceful-restart-helper": True} + } + } + } + } + }, + }, + } + }, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes + protocol = "bgp" + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + logger.info("[Phase 2] : R2 goes for reload ") + kill_router_daemons(tgen, "r2", ["bgpd"]) + + logger.info( + "[Phase 3] : R2 is still down, restart time 120 sec." + "So time verify the routes are present in BGP RIB and ZEBRA " + ) + + for addr_type in ADDR_TYPES: + # Verifying BGP RIB routes + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib( + tgen, addr_type, dut, input_topo, next_hop, expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + logger.info(" Expected behavior: {}".format(result)) + + # Verifying RIB routes + protocol = "bgp" + result = verify_rib( + tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + logger.info(" Expected behavior: {}".format(result)) + + logger.info("[Phase 5] : R2 is about to come up now ") + start_router_daemons(tgen, "r2", ["bgpd"]) + + logger.info("[Phase 4] : R2 is UP now, so time to collect GR stats ") + + for addr_type in ADDR_TYPES: + result = verify_bgp_convergence(tgen, topo) + assert ( + result is True + ), "BGP Convergence after BGPd restart" " :Failed \n Error:{}".format(result) + + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_r_bit(tgen, topo, addr_type, input_dict, dut="r1", peer="r2") + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_f_bit( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2", expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + + write_test_footer(tc_name) + + +def test_BGP_GR_TC_17_p1(request): + """ + Test Objective : Verify that only GR helper routers keep the stale + route entries, not any GR disabled router. + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + logger.info("[Phase 1] : Test Setup [Disable]R1-----R2[Restart] " "Initiliazed ") + + # Configure graceful-restart + input_dict = { + "r1": { + "bgp": { + "graceful-restart": { + "graceful-restart": True, + "preserve-fw-state": True, + }, + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-disable": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-disable": True} + } + } + } + } + }, + }, + } + }, + "r2": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r2-link1": {"graceful-restart": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r2-link1": {"graceful-restart": True} + } + } + } + } + }, + } + } + }, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes + protocol = "bgp" + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + logger.info("[Phase 2] : R2 goes for reload ") + + kill_router_daemons(tgen, "r2", ["bgpd"]) + + logger.info( + "[Phase 3] : R2 is still down, restart time 120 sec." + " So time verify the routes are present in BGP RIB and ZEBRA " + ) + + for addr_type in ADDR_TYPES: + # Verifying BGP RIB routes + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib( + tgen, addr_type, dut, input_topo, next_hop, expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + logger.info(" Expected behavior: {}".format(result)) + + # Verifying RIB routes + protocol = "bgp" + result = verify_rib( + tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + logger.info(" Expected behavior: {}".format(result)) + + logger.info("[Phase 5] : R2 is about to come up now ") + start_router_daemons(tgen, "r2", ["bgpd"]) + + logger.info("[Phase 4] : R2 is UP now, so time to collect GR stats ") + + for addr_type in ADDR_TYPES: + result = verify_bgp_convergence(tgen, topo) + assert ( + result is True + ), "BGP Convergence after BGPd restart" " :Failed \n Error:{}".format(result) + + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_r_bit( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2", expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + + # Verifying BGP RIB routes + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes + protocol = "bgp" + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + write_test_footer(tc_name) + + +def test_BGP_GR_TC_43_p1(request): + """ + Test Objective : Transition from Global Restarting to Disable + and then Global Disable to Restarting. + + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + step("Configure R1 and R2 as GR restarting node in global level") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart": True,}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 advertises GR capabilities as a restarting node") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + protocol = "bgp" + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Kill BGP on R1") + + kill_router_daemons(tgen, "r1", ["bgpd"]) + + step( + "Verify that R1 keeps BGP routes in zebra and R2 retains" + " the stale entry for received routes from R1" + ) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + protocol = "bgp" + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Bring up BGPd on R1 and configure it as GR disabled node in global level") + + start_router_daemons(tgen, "r1", ["bgpd"]) + + input_dict = { + "r1": { + "bgp": { + "graceful-restart": { + "graceful-restart": False, + "graceful-restart-disable": True, + } + } + } + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 doesn't advertise any GR capabilities") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart-disable": True,}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + protocol = "bgp" + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Kill BGP on R1") + + kill_router_daemons(tgen, "r1", ["bgpd"]) + + step( + "Verify that R1 flush all BGP routes from RIB & FIB and FIB and R2" + " does not retain stale entry for received routes from R1" + ) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib( + tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False + ) + assert ( + result is not True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib( + tgen, addr_type, dut, input_topo, next_hop, expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + protocol = "bgp" + result = verify_rib( + tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False + ) + assert ( + result is not True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + step( + "Bring up BGPd on R1 and configure it as GR" " restarting node in global level" + ) + + start_router_daemons(tgen, "r1", ["bgpd"]) + + input_dict = {"r1": {"bgp": {"graceful-restart": {"graceful-restart": True}}}} + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 advertises GR capabilities as a restarting node") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart": True,}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + step("Kill BGP on R1") + + kill_router_daemons(tgen, "r1", ["bgpd"]) + + step( + "Verify that R1 keeps BGP routes in zebra and R2" + " retains the stale entry for received routes from R1" + ) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + write_test_footer(tc_name) + + +def test_BGP_GR_TC_44_p1(request): + """ + Test Objective : Transition from Global Helper to Disable + and then Global Disable to Helper. + + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + step( + "Configure R2 as GR restating node in global level and" + " leave R1 without any GR related config" + ) + + input_dict = {"r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}} + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 advertises GR capabilities as a helper node") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart-helper": True,}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Kill BGP on R2") + + kill_router_daemons(tgen, "r2", ["bgpd"]) + + step("Verify that R1 keeps stale entry for BGP routes when BGPd on R2 is down") + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Bring up BGPd on R2 and configure R1 as GR disabled node in global level") + + start_router_daemons(tgen, "r2", ["bgpd"]) + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart-disable": True,}}} + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 doesn't advertise any GR capabilities") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart-disable": True,}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + step("Kill BGP on R2") + + kill_router_daemons(tgen, "r2", ["bgpd"]) + + step("Verify that R1 does not retain stale entry for received routes from R2") + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + next_hop = NEXT_HOP_IP_2[addr_type] + result = verify_bgp_rib( + tgen, addr_type, dut, input_topo, next_hop, expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + result = verify_rib( + tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False + ) + assert ( + result is not True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + step("Bring up BGPd on R2 and remove GR related config from R1 in global level") + + start_router_daemons(tgen, "r2", ["bgpd"]) + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart-disable": False}}} + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 advertises GR capabilities as a helper node") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart-helper": True,}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Kill BGP on R2") + + kill_router_daemons(tgen, "r2", ["bgpd"]) + + step("Verify that R1 keeps stale entry for BGP routes when BGPd on R2 is down") + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + write_test_footer(tc_name) + + +def test_BGP_GR_TC_45_p1(request): + """ + Test Objective : Transition from Global Restart to Helper + and then Global Helper to Restart. + + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + step("Configure R1 and R2 as GR restarting node in global level") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 advertises GR capabilities as a restarting node") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Kill BGP on R1") + + kill_router_daemons(tgen, "r1", ["bgpd"]) + + step( + "Verify that R1 keeps BGP routes in zebra and R2" + " retains the stale entry for received routes from R1" + ) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Bring up BGPd on R1 and remove GR related config in global level") + + start_router_daemons(tgen, "r1", ["bgpd"]) + + input_dict = {"r1": {"bgp": {"graceful-restart": {"graceful-restart": False,}}}} + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 advertises GR capabilities as a helper node") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart-helper": True,}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + step("Kill BGP on R2") + + kill_router_daemons(tgen, "r2", ["bgpd"]) + + step("Verify that R1 keeps stale entry for BGP routes when BGPd on R2 is down") + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + step("Bring up BGPd on R2 and configure R1 as GR restarting node in global level") + + start_router_daemons(tgen, "r2", ["bgpd"]) + + input_dict = {"r1": {"bgp": {"graceful-restart": {"graceful-restart": True,}}}} + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 advertises GR capabilities as a restarting node") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart": True,}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Kill BGP on R1") + + kill_router_daemons(tgen, "r1", ["bgpd"]) + + step( + "Verify that R1 keeps BGP routes in zebra and R2" + " retains the stale entry for received routes from R1" + ) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + write_test_footer(tc_name) + + +def test_BGP_GR_TC_46_p1(request): + """ + Test Objective : transition from Peer-level helper to Global Restarting + Global Mode : GR Restarting + PerPeer Mode : GR Helper + GR Mode effective : GR Helper + + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + step( + "Configure R1 and R2 as GR restarting node in global" + " and helper in per-Peer-level" + ) + + input_dict = { + "r1": { + "bgp": { + "graceful-restart": {"graceful-restart": True,}, + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-helper": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-helper": True} + } + } + } + } + }, + }, + } + }, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 advertises GR capabilities as a restarting node") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Kill BGP on R2") + + kill_router_daemons(tgen, "r2", ["bgpd"]) + + step( + "Verify that R1 keeps the stale entries in RIB & FIB and R2 keeps stale entries in FIB using" + ) + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step( + "Bring up BGP on R1 and remove Peer-level GR config" + " from R1 following by a session reset" + ) + + start_router_daemons(tgen, "r2", ["bgpd"]) + + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-helper": False} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-helper": False} + } + } + } + } + }, + } + } + } + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 advertises GR capabilities as a restarting node") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + step("Kill BGP on R1") + + kill_router_daemons(tgen, "r1", ["bgpd"]) + + step( + "Verify that R1 keeps the stale entries in FIB command and R2 keeps stale entries in RIB & FIB" + ) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + write_test_footer(tc_name) + + +def test_BGP_GR_TC_47_p1(request): + """ + Test Objective : transition from Peer-level restart to Global Restart + Global Mode : GR Restarting + PerPeer Mode : GR Restarting + GR Mode effective : GR Restarting + + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + step("Configure R1 and R2 as GR restarting node in global and per-Peer-level") + + input_dict = { + "r1": { + "bgp": { + "graceful-restart": {"graceful-restart": True,}, + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart": True} + } + } + } + } + }, + }, + } + }, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 advertises GR capabilities as a restarting node") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Kill BGP on R1") + + kill_router_daemons(tgen, "r1", ["bgpd"]) + + step( + "Verify that R1 keeps the stale entries in FIB and R2 keeps stale entries in RIB & FIB" + ) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step( + "Bring up BGP on R1 and remove Peer-level GR" + " config from R1 following by a session reset" + ) + + start_router_daemons(tgen, "r1", ["bgpd"]) + + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart": False} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart": False} + } + } + } + } + }, + } + } + } + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 still advertises GR capabilities as a restarting node") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart": True,}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + step("Kill BGP on R1") + + kill_router_daemons(tgen, "r1", ["bgpd"]) + + step( + "Verify that R1 keeps the stale entries in FIB and R2 keeps stale entries in RIB & FIB" + ) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + write_test_footer(tc_name) + + +def test_BGP_GR_TC_48_p1(request): + """ + Test Objective : transition from Peer-level disabled to Global Restart + Global Mode : GR Restarting + PerPeer Mode : GR Disabled + GR Mode effective : GR Disabled + + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + step( + "Configure R1 as GR restarting node in global level and" + " GR Disabled in per-Peer-level" + ) + + input_dict = { + "r1": { + "bgp": { + "graceful-restart": {"graceful-restart": True,}, + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-disable": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-disable": True} + } + } + } + } + }, + }, + } + }, + "r2": {"bgp": {"graceful-restart": {"graceful-restart-helper": True}}}, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 does't advertise any GR capabilities") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Kill BGP on R1") + + kill_router_daemons(tgen, "r1", ["bgpd"]) + + step("Verify on R2 and R1 that none of the routers keep stale entries") + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib( + tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib( + tgen, addr_type, dut, input_topo, next_hop, expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + result = verify_rib( + tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + + step("Bring up BGP on R1 and remove Peer-level GR config from R1") + + start_router_daemons(tgen, "r1", ["bgpd"]) + + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-disable": False} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-disable": False} + } + } + } + } + }, + } + } + } + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 advertises GR capabilities as a restarting node") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart": True,}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart-helper": True}}}, + } + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + step("Kill BGP on R1") + + kill_router_daemons(tgen, "r1", ["bgpd"]) + + step( + "Verify that R1 keeps the stale entries in FIB and R2 keeps stale entries in RIB & FIB" + ) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + write_test_footer(tc_name) + + +def test_BGP_GR_TC_49_p1(request): + """ + Test Objective : Peer-level inherit from Global Restarting + Global Mode : GR Restart + PerPeer Mode : None + GR Mode effective : GR Restart + + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + step("Configure R1 as GR restarting node in global level") + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart-helper": True}}}, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step( + "Verify that R2 receives GR restarting capabilities" + " from R1 based on inheritence" + ) + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Kill BGPd on router R1") + + kill_router_daemons(tgen, "r1", ["bgpd"]) + + step( + "Verify that R1 keeps the stale entries in FIB and R2 keeps stale entries in RIB & FIB" + ) + + for addr_type in ADDR_TYPES: + dut = "r1" + peer = "r2" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r2" + peer = "r1" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + write_test_footer(tc_name) + + +def test_BGP_GR_TC_52_p1(request): + """ + Test Objective : Transition from Peer-level disbale to Global inherit helper + Global Mode : None + PerPeer Mode : GR Disable + GR Mode effective : GR Disable + + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + step( + "Configure R1 as GR disabled node at per Peer-level for R2" + " & R2 as GR restarting node" + ) + + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-disable": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-disable": True} + } + } + } + } + }, + } + } + }, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step("Verify on R2 that R1 does't advertise any GR capabilities") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Kill BGP on R2") + + kill_router_daemons(tgen, "r2", ["bgpd"]) + + step( + "Verify that R2 keeps the stale entries in FIB & R1 doesn't keep RIB & FIB entries." + ) + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib( + tgen, addr_type, dut, input_topo, next_hop, expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + result = verify_rib( + tgen, addr_type, dut, input_topo, next_hop, protocol, expected=False + ) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + + step("Bring up BGP on R2 and remove Peer-level GR config from R1") + + start_router_daemons(tgen, "r2", ["bgpd"]) + + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-disable": False} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": {"graceful-restart-disable": False} + } + } + } + } + }, + } + } + } + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + step( + "Verify on R2 that R1 advertises GR capabilities as a helper node from global inherit" + ) + + input_dict = { + "r1": {"bgp": {"graceful-restart": {"graceful-restart-helper": True}}}, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r2", peer="r1" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + step("Kill BGP on R2") + + kill_router_daemons(tgen, "r2", ["bgpd"]) + + step( + "Verify that R2 keeps the stale entries in FIB & R1 keeps stale entries in RIB & FIB" + ) + + for addr_type in ADDR_TYPES: + dut = "r2" + peer = "r1" + protocol = "bgp" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_1 + ) + input_topo = {"r1": topo["routers"]["r1"]} + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + dut = "r1" + peer = "r2" + next_hop = next_hop_per_address_family( + tgen, dut, peer, addr_type, NEXT_HOP_IP_2 + ) + input_topo = {"r2": topo["routers"]["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_topo, next_hop) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + result = verify_rib(tgen, addr_type, dut, input_topo, next_hop, protocol) + assert ( + result is True + ), "Testcase {} :Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) + + write_test_footer(tc_name) + + if __name__ == "__main__": args = ["-s"] + sys.argv[1:] sys.exit(pytest.main(args)) diff --git a/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py index e1ec0ea81b..6926121a6b 100644 --- a/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py +++ b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py @@ -118,6 +118,7 @@ from lib.bgp import ( verify_gr_address_family, modify_bgp_config_when_bgpd_down, verify_graceful_restart_timers, + verify_bgp_convergence_from_running_config, ) from lib.common_config import ( @@ -135,7 +136,7 @@ from lib.common_config import ( kill_mininet_routers_process, get_frr_ipv6_linklocal, create_route_maps, - required_linux_kernel_version + required_linux_kernel_version, ) # Reading the data from JSON File for topology and configuration creation @@ -150,6 +151,7 @@ except IOError: BGP_CONVERGENCE = False GR_RESTART_TIMER = 5 GR_SELECT_DEFER_TIMER = 5 +GR_STALEPATH_TIMER = 5 PREFERRED_NEXT_HOP = "link_local" NEXT_HOP_4 = ["192.168.1.1", "192.168.4.2"] NEXT_HOP_6 = ["fd00:0:0:1::1", "fd00:0:0:4::2"] @@ -185,7 +187,7 @@ def setup_module(mod): """ # Required linux kernel version for this suite to run. - result = required_linux_kernel_version('4.15') + result = required_linux_kernel_version("4.16") if result is not True: pytest.skip("Kernel requirements are not met") @@ -251,6 +253,12 @@ def configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut, peer): for addr_type in ADDR_TYPES: clear_bgp(tgen, addr_type, dut) + for addr_type in ADDR_TYPES: + clear_bgp(tgen, addr_type, peer) + + result = verify_bgp_convergence_from_running_config(tgen, topo) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) + return True @@ -653,6 +661,9 @@ def test_BGP_GR_TC_11_p0(request): clear_bgp(tgen, addr_type, "r1") clear_bgp(tgen, addr_type, "r3") + result = verify_bgp_convergence_from_running_config(tgen, topo) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) + for addr_type in ADDR_TYPES: result = verify_graceful_restart( tgen, topo, addr_type, input_dict, dut="r1", peer="r3" @@ -1169,7 +1180,7 @@ def test_BGP_GR_16_p2(request): tc_name, result ) - result = verify_bgp_convergence(tgen, topo) + result = verify_bgp_convergence_from_running_config(tgen, topo) assert result is True, "Testcase {} : Failed \n Error {}".format( tc_name, result ) @@ -1812,7 +1823,7 @@ def test_BGP_GR_chaos_29_p1(request): reset_config_on_routers(tgen) logger.info( - " Test Case : BGP_GR_UTP_29" + " Test Case : test_BGP_GR_chaos_29" " BGP GR [Helper Mode]R3-----R1[Restart Mode]" " and [restart-time 150]R1 initialized" ) @@ -1928,10 +1939,9 @@ def test_BGP_GR_chaos_29_p1(request): # Kill BGPd daemon on R1 kill_router_daemons(tgen, "r1", ["bgpd"]) - # Waiting for 120 sec logger.info("[Step 3] : Wait for {} seconds..".format(GR_RESTART_TIMER)) - # Waiting for 120 sec + # Waiting for GR_RESTART_TIMER sleep(GR_RESTART_TIMER) for addr_type in ADDR_TYPES: @@ -2197,7 +2207,13 @@ def test_BGP_GR_chaos_33_p1(request): else: next_hop_6 = NEXT_HOP_6[1] - result = verify_rib(tgen, addr_type, dut, input_dict_2, next_hop_6) + result = verify_rib(tgen, addr_type, dut, input_dict_2, next_hop_6, + expected=False) + assert result is not True,\ + "Testcase {} :Failed \n Error {}". \ + format(tc_name, result) + logger.info(" Expected behavior: {}".\ + format(result)) logger.info("[Step 4] : Start BGPd daemon on R1 and R4..") @@ -2523,6 +2539,9 @@ def test_BGP_GR_chaos_34_1_p1(request): for addr_type in ADDR_TYPES: clear_bgp(tgen, addr_type, "r1") + result = verify_bgp_convergence_from_running_config(tgen, topo) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) + for addr_type in ADDR_TYPES: # Verify f-bit after starting BGPd daemon result = verify_f_bit( @@ -2538,7 +2557,7 @@ def test_BGP_GR_chaos_34_1_p1(request): # Kill BGPd daemon on R1 kill_router_daemons(tgen, "r1", ["bgpd"]) - # Waiting for 120 sec + # Waiting for GR_RESTART_TIMER logger.info("Waiting for {} sec..".format(GR_RESTART_TIMER)) sleep(GR_RESTART_TIMER) @@ -2743,7 +2762,7 @@ def test_BGP_GR_chaos_32_p1(request): logger.info(" Expected behavior: {}".format(result)) # Verifying RIB routes - result = verify_rib(tgen, addr_type, dut, input_dict_1) + result = verify_rib(tgen, addr_type, dut, input_dict_1, expected=False) assert result is not True, "Testcase {} : Failed \n Error {}".format( tc_name, result ) @@ -3086,6 +3105,1165 @@ def test_BGP_GR_chaos_30_p1(request): write_test_footer(tc_name) +def test_BGP_GR_15_p2(request): + """ + Test Objective : Test GR scenarios by enabling Graceful Restart + for multiple address families.. + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + # Configure graceful-restart + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r6": {"dest_link": {"r1": {"graceful-restart": True}}} + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r6": {"dest_link": {"r1": {"graceful-restart": True}}} + } + } + }, + } + } + }, + "r6": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r6": {"graceful-restart-helper": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r6": {"graceful-restart-helper": True} + } + } + } + } + }, + } + } + }, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r6") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r6" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + logger.info( + "[Step 2] : Test Setup " + "[Helper Mode]R6-----R1[Restart Mode]" + "--------R2[Helper Mode] Initilized" + ) + + # Configure graceful-restart + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": {"dest_link": {"r1": {"graceful-restart": True}}} + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": {"dest_link": {"r1": {"graceful-restart": True}}} + } + } + }, + } + } + }, + "r2": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r2": {"graceful-restart-helper": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r2": {"graceful-restart-helper": True} + } + } + } + } + }, + } + } + }, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r6" + input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r6" + input_dict_2 = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Kill BGPd daemon on R1 + kill_router_daemons(tgen, "r1", ["bgpd"]) + + for addr_type in ADDR_TYPES: + # Verifying BGP RIB routes + dut = "r6" + input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r6" + input_dict_2 = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Start BGPd daemon on R1 + start_router_daemons(tgen, "r1", ["bgpd"]) + + for addr_type in ADDR_TYPES: + result = verify_bgp_convergence(tgen, topo) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r6" + input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r6" + input_dict_2 = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + write_test_footer(tc_name) + + +def BGP_GR_TC_7_p1(request): + """ + Verify that BGP restarting node deletes all the routes received from peer + if BGP Graceful capability is not present in BGP Open message from the + peer + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + logger.info( + " Verify route download to RIB: BGP_GR_TC_7 >> " + "BGP GR [Helper Mode]R3-----R1[Restart Mode] " + ) + + # Configure graceful-restart + input_dict = { + "r3": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r3": {"graceful-restart-helper": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r3": {"graceful-restart-helper": True} + } + } + } + } + }, + } + } + }, + "r1": { + "bgp": { + "graceful-restart": { + "graceful-restart": True, + "preserve-fw-state": True, + }, + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r3": {"dest_link": {"r1": {"graceful-restart": True}}} + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r3": {"dest_link": {"r1": {"graceful-restart": True}}} + } + } + }, + }, + } + }, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r3") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r3" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes received from router R1 + dut = "r1" + input_dict_1 = {key: topo["routers"][key] for key in ["r3"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + logger.info("R1 goes for reload") + kill_router_daemons(tgen, "r1", ["bgpd"]) + + # Change the configuration on router R1 + input_dict_2 = { + "r3": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r3": {"graceful-restart-disable": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r3": {"graceful-restart-disable": True} + } + } + } + } + }, + } + } + } + } + + result = create_router_bgp(tgen, topo, input_dict_2) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) + + # Change the configuration on R1 + network = {"ipv4": "103.0.20.1/32", "ipv6": "3::1/128"} + for addr_type in ADDR_TYPES: + input_dict_2 = { + "r3": { + "bgp": { + "address_family": { + addr_type: { + "unicast": { + "advertise_networks": [ + { + "network": network[addr_type], + "no_of_network": 5, + "delete": True, + } + ] + } + } + } + } + } + } + + result = create_router_bgp(tgen, topo, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + logger.info("R1 is about to come up now") + start_router_daemons(tgen, "r1", ["bgpd"]) + logger.info("R1 is UP Now") + + # Wait for RIB stale timeout + logger.info("Verify routes are not present" "in restart router") + + for addr_type in ADDR_TYPES: + # Verifying RIB routes + dut = "r1" + input_dict_1 = {key: topo["routers"][key] for key in ["r3"]} + result = verify_rib(tgen, addr_type, dut, input_dict_1, expected=False) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + + write_test_footer(tc_name) + + +def test_BGP_GR_TC_23_p1(request): + """ + Verify that helper routers are deleting stale routes after stale route + timer's expiry. If all the routes are not received from restating node + after restart. + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + logger.info( + "Verify Stale Routes are deleted on helper: BGP_GR_TC_23 >> " + "BGP GR [Helper Mode]R1-----R2[Restart Mode] " + ) + + # Configure graceful-restart + input_dict = { + "r1": { + "bgp": { + "graceful-restart": {"timer": {"stalepath-time": GR_STALEPATH_TIMER}}, + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1": {"graceful-restart-helper": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1": {"graceful-restart-helper": True} + } + } + } + } + }, + }, + } + }, + "r2": { + "bgp": { + "graceful-restart": { + "graceful-restart": True, + "preserve-fw-state": True, + }, + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r1": {"dest_link": {"r2": {"graceful-restart": True}}} + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r1": {"dest_link": {"r2": {"graceful-restart": True}}} + } + } + }, + }, + } + }, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes received from router R1 + dut = "r1" + input_dict_1 = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + logger.info("R2 goes for reload") + kill_router_daemons(tgen, "r2", ["bgpd"]) + + # Modify configuration to delete routes and include disable-eor + input_dict_3 = {"r2": {"bgp": {"graceful-restart": {"disable-eor": True}}}} + + result = modify_bgp_config_when_bgpd_down(tgen, topo, input_dict_3) + + # Modify configuration to delete routes and include disable-eor + network = {"ipv4": "102.0.20.1/32", "ipv6": "2::1/128"} + for addr_type in ADDR_TYPES: + input_dict_3 = { + "r2": { + "bgp": { + "address_family": { + addr_type: { + "unicast": { + "advertise_networks": [ + { + "network": network[addr_type], + "no_of_network": 3, + "delete": True, + } + ] + } + } + } + } + } + } + + result = modify_bgp_config_when_bgpd_down(tgen, topo, input_dict_3) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + logger.info("BGPd comes up for r2") + start_router_daemons(tgen, "r2", ["bgpd"]) + + # Wait for stalepath timer + logger.info("Waiting for stalepath timer({} sec..)".format(GR_STALEPATH_TIMER)) + sleep(GR_STALEPATH_TIMER) + + for addr_type in ADDR_TYPES: + clear_bgp(tgen, addr_type, "r2") + + # Verifying RIB routes + dut = "r1" + network = {"ipv4": "102.0.20.4/32", "ipv6": "2::4/128"} + for addr_type in ADDR_TYPES: + input_dict_1 = { + "r1": { + "bgp": { + "address_family": { + addr_type: { + "unicast": { + "advertise_networks": [ + {"network": network[addr_type], "no_of_network": 2} + ] + } + } + } + } + } + } + + # Verify EOR on helper router + result = verify_eor( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2", expected=False + ) + assert result is not True, ( + "Testcase " + tc_name + " :Failed \n Error: {}".format(result) + ) + + # Verifying BGP RIB routes received from router R1 + dut = "r1" + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + write_test_footer(tc_name) + + +def test_BGP_GR_20_p1(request): + """ + Test Objective : Verify that GR routers delete all the routes + received from a node if both the routers are configured as GR + helper node + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + logger.info( + "[Step 1] : Test Setup " "[Restart Mode]R3-----R1[Restart Mode] Initilized" + ) + + # Configure graceful-restart + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "r1": {"graceful-restart-helper": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "r1": {"graceful-restart-helper": True} + } + } + } + } + }, + } + } + }, + "r3": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r3": {"graceful-restart-helper": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r3": {"graceful-restart-helper": True} + } + } + } + } + }, + } + } + }, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r3") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r3" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r3" + input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Kill BGPd daemon on R1 + kill_router_daemons(tgen, "r1", ["bgpd"]) + + for addr_type in ADDR_TYPES: + # Verifying BGP RIB routes + dut = "r3" + input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1, expected=False) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + logger.info(" Expected behavior: {}".format(result)) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_1, expected=False) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + logger.info(" Expected behavior: {}".format(result)) + + # Start BGPd daemon on R1 + start_router_daemons(tgen, "r1", ["bgpd"]) + + for addr_type in ADDR_TYPES: + result = verify_bgp_convergence(tgen, topo) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r3" + input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + write_test_footer(tc_name) + + +def test_BGP_GR_21_p2(request): + """ + Test Objective : VVerify BGP-GR feature when helper node is + a transit router for it's eBGP peers. + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + logger.info( + "[Step 1] : Test Setup " "[Helper Mode]R6-----R1[Restart Mode] Initilized" + ) + + # Configure graceful-restart + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r6": { + "dest_link": { + "r1": {"graceful-restart-disable": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r6": { + "dest_link": { + "r1": {"graceful-restart-disable": True} + } + } + } + } + }, + } + } + }, + "r6": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r6": {"graceful-restart-helper": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r6": {"graceful-restart-helper": True} + } + } + } + } + }, + } + } + }, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r6") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r6" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + logger.info( + "[Step 2] : Test Setup " + "[Restart Mode]R2-----[Helper Mode]R1[Disable Mode]" + "--------R6[Helper Mode] Initilized" + ) + + # Configure graceful-restart + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1": {"graceful-restart-helper": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1": {"graceful-restart-helper": True} + } + } + } + } + }, + } + } + }, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True,}}}, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r6" + input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r6" + input_dict_2 = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Kill BGPd daemon on R1 + kill_router_daemons(tgen, "r2", ["bgpd"]) + + for addr_type in ADDR_TYPES: + # Verifying BGP RIB routes + dut = "r6" + input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r6" + input_dict_2 = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Start BGPd daemon on R1 + start_router_daemons(tgen, "r2", ["bgpd"]) + + for addr_type in ADDR_TYPES: + result = verify_bgp_convergence(tgen, topo) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r6" + input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes after bringing up BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r6" + input_dict_2 = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + write_test_footer(tc_name) + + +def test_BGP_GR_22_p2(request): + """ + Test Objective : Verify BGP-GR feature when helper node + is a transit router for it's iBGP peers. + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + # Check router status + check_router_status(tgen) + + # Don't run this test if we have any failure. + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + # Creating configuration from JSON + reset_config_on_routers(tgen) + + logger.info( + "[Step 1] : Test Setup " "[Helper Mode]R3-----R1[Restart Mode] Initilized" + ) + + # Configure graceful-restart + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "r1": { + "graceful-restart-disable": True, + "next_hop_self": True, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "r1": { + "graceful-restart-disable": True, + "next_hop_self": True, + } + } + } + } + } + }, + } + } + }, + "r3": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r3": {"graceful-restart-helper": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r1": { + "dest_link": { + "r3": {"graceful-restart-helper": True} + } + } + } + } + }, + } + } + }, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r3") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r3" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + logger.info( + "[Step 2] : Test Setup " + "[Restart Mode]R2-----[Helper Mode]R1[Disable Mode]" + "--------R3[Helper Mode] Initilized" + ) + + # Configure graceful-restart + input_dict = { + "r1": { + "bgp": { + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1": {"graceful-restart-helper": True} + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1": {"graceful-restart-helper": True} + } + } + } + } + }, + } + } + }, + "r2": {"bgp": {"graceful-restart": {"graceful-restart": True}}}, + } + + configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r2") + + for addr_type in ADDR_TYPES: + result = verify_graceful_restart( + tgen, topo, addr_type, input_dict, dut="r1", peer="r2" + ) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r3" + input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r3" + input_dict_2 = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Kill BGPd daemon on R1 + kill_router_daemons(tgen, "r2", ["bgpd"]) + + for addr_type in ADDR_TYPES: + # Verifying BGP RIB routes + dut = "r3" + input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r3" + input_dict_2 = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Start BGPd daemon on R1 + start_router_daemons(tgen, "r2", ["bgpd"]) + + for addr_type in ADDR_TYPES: + result = verify_bgp_convergence(tgen, topo) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r3" + input_dict_1 = {key: topo["routers"][key] for key in ["r1"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying BGP RIB routes + dut = "r3" + input_dict_2 = {key: topo["routers"][key] for key in ["r2"]} + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + # Verifying RIB routes before shutting down BGPd daemon + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + write_test_footer(tc_name) + + if __name__ == "__main__": args = ["-s"] + sys.argv[1:] sys.exit(pytest.main(args)) diff --git a/tests/topotests/bgp_gshut/test_bgp_gshut.py b/tests/topotests/bgp_gshut/test_bgp_gshut.py index 7f8cf17a5c..fe945a4565 100644 --- a/tests/topotests/bgp_gshut/test_bgp_gshut.py +++ b/tests/topotests/bgp_gshut/test_bgp_gshut.py @@ -99,12 +99,14 @@ class TemplateTopo(Topo): switch.add_link(tgen.gears["r2"]) switch.add_link(tgen.gears["r5"]) + def _run_cmd_and_check(router, cmd, results_file, retries=100, intvl=0.5): json_file = "{}/{}".format(CWD, results_file) expected = json.loads(open(json_file).read()) test_func = partial(topotest.router_json_cmp, router, cmd, expected) return topotest.run_and_expect(test_func, None, retries, intvl) + def setup_module(mod): tgen = Topogen(TemplateTopo, mod.__name__) tgen.start_topology() @@ -134,12 +136,14 @@ def setup_module(mod): tgen.start_router() # Basic peering test to see if things are ok - _, result = _run_cmd_and_check(r2, 'show ip bgp summary json', 'r2/bgp_sum_1.json') - assertmsg = 'R2: Basic sanity test after init failed -- global peerings not up' + _, result = _run_cmd_and_check(r2, "show ip bgp summary json", "r2/bgp_sum_1.json") + assertmsg = "R2: Basic sanity test after init failed -- global peerings not up" assert result is None, assertmsg - _, result = _run_cmd_and_check(r2, 'show ip bgp vrf vrf1 summary json', 'r2/bgp_sum_2.json') - assertmsg = 'R2: Basic sanity test after init failed -- VRF peerings not up' + _, result = _run_cmd_and_check( + r2, "show ip bgp vrf vrf1 summary json", "r2/bgp_sum_2.json" + ) + assertmsg = "R2: Basic sanity test after init failed -- VRF peerings not up" assert result is None, assertmsg @@ -160,80 +164,104 @@ def test_bgp_gshut(): r4 = tgen.gears["r4"] r5 = tgen.gears["r5"] - # Verify initial route states - logger.info('\nVerify initial route states') + logger.info("\nVerify initial route states") - _, result = _run_cmd_and_check(r1, 'show ip bgp 13.1.1.1/32 json', 'r1/bgp_route_1.json') - assertmsg = 'R1: Route 13.1.1.1/32 not present or has unexpected params' + _, result = _run_cmd_and_check( + r1, "show ip bgp 13.1.1.1/32 json", "r1/bgp_route_1.json" + ) + assertmsg = "R1: Route 13.1.1.1/32 not present or has unexpected params" assert result is None, assertmsg - _, result = _run_cmd_and_check(r3, 'show ip bgp 11.1.1.1/32 json', 'r3/bgp_route_1.json') - assertmsg = 'R3: Route 11.1.1.1/32 not present or has unexpected params' + _, result = _run_cmd_and_check( + r3, "show ip bgp 11.1.1.1/32 json", "r3/bgp_route_1.json" + ) + assertmsg = "R3: Route 11.1.1.1/32 not present or has unexpected params" assert result is None, assertmsg - _, result = _run_cmd_and_check(r5, 'show ip bgp 14.1.1.1/32 json', 'r5/bgp_route_1.json') - assertmsg = 'R5: Route 14.1.1.1/32 not present or has unexpected params' + _, result = _run_cmd_and_check( + r5, "show ip bgp 14.1.1.1/32 json", "r5/bgp_route_1.json" + ) + assertmsg = "R5: Route 14.1.1.1/32 not present or has unexpected params" assert result is None, assertmsg - logger.info('\nInitial route states are as expected') - + logger.info("\nInitial route states are as expected") - #"Test #1: Enable BGP-wide graceful-shutdown on R2 and check routes on peers" - logger.info('\nTest #1: Enable BGP-wide graceful-shutdown on R2 and check routes on peers') + # "Test #1: Enable BGP-wide graceful-shutdown on R2 and check routes on peers" + logger.info( + "\nTest #1: Enable BGP-wide graceful-shutdown on R2 and check routes on peers" + ) r2.vtysh_cmd( """ configure terminal bgp graceful-shutdown """ - ) + ) # R1, R3 and R5 should see routes from R2 with GSHUT. In addition, # R1 should see LOCAL_PREF of 0 - _, result = _run_cmd_and_check(r1, 'show ip bgp 13.1.1.1/32 json', 'r1/bgp_route_2.json') - assertmsg = 'R1: Route 13.1.1.1/32 not present or has unexpected params' + _, result = _run_cmd_and_check( + r1, "show ip bgp 13.1.1.1/32 json", "r1/bgp_route_2.json" + ) + assertmsg = "R1: Route 13.1.1.1/32 not present or has unexpected params" assert result is None, assertmsg - _, result = _run_cmd_and_check(r3, 'show ip bgp 11.1.1.1/32 json', 'r3/bgp_route_2.json') - assertmsg = 'R3: Route 11.1.1.1/32 not present or has unexpected params' + _, result = _run_cmd_and_check( + r3, "show ip bgp 11.1.1.1/32 json", "r3/bgp_route_2.json" + ) + assertmsg = "R3: Route 11.1.1.1/32 not present or has unexpected params" assert result is None, assertmsg - _, result = _run_cmd_and_check(r5, 'show ip bgp 14.1.1.1/32 json', 'r5/bgp_route_2.json') - assertmsg = 'R5: Route 14.1.1.1/32 not present or has unexpected params' + _, result = _run_cmd_and_check( + r5, "show ip bgp 14.1.1.1/32 json", "r5/bgp_route_2.json" + ) + assertmsg = "R5: Route 14.1.1.1/32 not present or has unexpected params" assert result is None, assertmsg - logger.info('\nTest #1: Successful, routes have GSHUT and/or LPREF of 0 as expected') - + logger.info( + "\nTest #1: Successful, routes have GSHUT and/or LPREF of 0 as expected" + ) - #"Test #2: Turn off BGP-wide graceful-shutdown on R2 and check routes on peers" - logger.info('\nTest #2: Turn off BGP-wide graceful-shutdown on R2 and check routes on peers') + # "Test #2: Turn off BGP-wide graceful-shutdown on R2 and check routes on peers" + logger.info( + "\nTest #2: Turn off BGP-wide graceful-shutdown on R2 and check routes on peers" + ) r2.vtysh_cmd( """ configure terminal no bgp graceful-shutdown """ - ) + ) # R1, R3 and R5 should see routes from R2 with their original attributes - _, result = _run_cmd_and_check(r1, 'show ip bgp 13.1.1.1/32 json', 'r1/bgp_route_1.json') - assertmsg = 'R1: Route 13.1.1.1/32 not present or has unexpected params' + _, result = _run_cmd_and_check( + r1, "show ip bgp 13.1.1.1/32 json", "r1/bgp_route_1.json" + ) + assertmsg = "R1: Route 13.1.1.1/32 not present or has unexpected params" assert result is None, assertmsg - _, result = _run_cmd_and_check(r3, 'show ip bgp 11.1.1.1/32 json', 'r3/bgp_route_1.json') - assertmsg = 'R3: Route 11.1.1.1/32 not present or has unexpected params' + _, result = _run_cmd_and_check( + r3, "show ip bgp 11.1.1.1/32 json", "r3/bgp_route_1.json" + ) + assertmsg = "R3: Route 11.1.1.1/32 not present or has unexpected params" assert result is None, assertmsg - _, result = _run_cmd_and_check(r5, 'show ip bgp 14.1.1.1/32 json', 'r5/bgp_route_1.json') - assertmsg = 'R5: Route 14.1.1.1/32 not present or has unexpected params' + _, result = _run_cmd_and_check( + r5, "show ip bgp 14.1.1.1/32 json", "r5/bgp_route_1.json" + ) + assertmsg = "R5: Route 14.1.1.1/32 not present or has unexpected params" assert result is None, assertmsg - logger.info('\nTest #2: Successful, routes have their original attributes with default LPREF and without GSHUT') + logger.info( + "\nTest #2: Successful, routes have their original attributes with default LPREF and without GSHUT" + ) - - #"Test #3: Enable graceful-shutdown on R2 only in VRF1 and check routes on peers" - logger.info('\nTest #3: Enable graceful-shutdown on R2 only in VRF1 and check routes on peers') + # "Test #3: Enable graceful-shutdown on R2 only in VRF1 and check routes on peers" + logger.info( + "\nTest #3: Enable graceful-shutdown on R2 only in VRF1 and check routes on peers" + ) r2.vtysh_cmd( """ @@ -241,44 +269,56 @@ def test_bgp_gshut(): router bgp 65001 vrf vrf1 bgp graceful-shutdown """ - ) + ) # R1 and R3 should see no change to their routes - _, result = _run_cmd_and_check(r1, 'show ip bgp 13.1.1.1/32 json', 'r1/bgp_route_1.json') - assertmsg = 'R1: Route 13.1.1.1/32 not present or has unexpected params' + _, result = _run_cmd_and_check( + r1, "show ip bgp 13.1.1.1/32 json", "r1/bgp_route_1.json" + ) + assertmsg = "R1: Route 13.1.1.1/32 not present or has unexpected params" assert result is None, assertmsg - _, result = _run_cmd_and_check(r3, 'show ip bgp 11.1.1.1/32 json', 'r3/bgp_route_1.json') - assertmsg = 'R3: Route 11.1.1.1/32 not present or has unexpected params' + _, result = _run_cmd_and_check( + r3, "show ip bgp 11.1.1.1/32 json", "r3/bgp_route_1.json" + ) + assertmsg = "R3: Route 11.1.1.1/32 not present or has unexpected params" assert result is None, assertmsg # R5 should see routes from R2 with GSHUT. - _, result = _run_cmd_and_check(r5, 'show ip bgp 14.1.1.1/32 json', 'r5/bgp_route_2.json') - assertmsg = 'R5: Route 14.1.1.1/32 not present or has unexpected params' + _, result = _run_cmd_and_check( + r5, "show ip bgp 14.1.1.1/32 json", "r5/bgp_route_2.json" + ) + assertmsg = "R5: Route 14.1.1.1/32 not present or has unexpected params" assert result is None, assertmsg - logger.info('\nTest #3: Successful, only VRF peers like R5 see routes with GSHUT') + logger.info("\nTest #3: Successful, only VRF peers like R5 see routes with GSHUT") - - #"Test #4: Try to enable BGP-wide graceful-shutdown on R2 while it is configured in VRF1" - logger.info('\nTest #4: Try to enable BGP-wide graceful-shutdown on R2 while it is configured in VRF1') + # "Test #4: Try to enable BGP-wide graceful-shutdown on R2 while it is configured in VRF1" + logger.info( + "\nTest #4: Try to enable BGP-wide graceful-shutdown on R2 while it is configured in VRF1" + ) ret = r2.vtysh_cmd( """ configure terminal bgp graceful-shutdown """ - ) + ) # This should fail - assertmsg = 'R2: BGP-wide graceful-shutdown config not rejected even though it is enabled in VRF1' - assert re.search("global graceful-shutdown not permitted", ret) is not None, assertmsg + assertmsg = "R2: BGP-wide graceful-shutdown config not rejected even though it is enabled in VRF1" + assert ( + re.search("global graceful-shutdown not permitted", ret) is not None + ), assertmsg - logger.info('\nTest #4: Successful, BGP-wide graceful-shutdown rejected as it is enabled in VRF') + logger.info( + "\nTest #4: Successful, BGP-wide graceful-shutdown rejected as it is enabled in VRF" + ) - - #"Test #5: Turn off graceful-shutdown on R2 in VRF1 and check routes on peers" - logger.info('\nTest #5: Turn off graceful-shutdown on R2 in VRF1 and check routes on peers') + # "Test #5: Turn off graceful-shutdown on R2 in VRF1 and check routes on peers" + logger.info( + "\nTest #5: Turn off graceful-shutdown on R2 in VRF1 and check routes on peers" + ) r2.vtysh_cmd( """ @@ -286,27 +326,34 @@ def test_bgp_gshut(): router bgp 65001 vrf vrf1 no bgp graceful-shutdown """ - ) + ) # R1 and R3 should see no change to their routes - _, result = _run_cmd_and_check(r1, 'show ip bgp 13.1.1.1/32 json', 'r1/bgp_route_1.json') - assertmsg = 'R1: Route 13.1.1.1/32 not present or has unexpected params' + _, result = _run_cmd_and_check( + r1, "show ip bgp 13.1.1.1/32 json", "r1/bgp_route_1.json" + ) + assertmsg = "R1: Route 13.1.1.1/32 not present or has unexpected params" assert result is None, assertmsg - _, result = _run_cmd_and_check(r3, 'show ip bgp 11.1.1.1/32 json', 'r3/bgp_route_1.json') - assertmsg = 'R3: Route 11.1.1.1/32 not present or has unexpected params' + _, result = _run_cmd_and_check( + r3, "show ip bgp 11.1.1.1/32 json", "r3/bgp_route_1.json" + ) + assertmsg = "R3: Route 11.1.1.1/32 not present or has unexpected params" assert result is None, assertmsg # R5 should see routes from R2 with original attributes. - _, result = _run_cmd_and_check(r5, 'show ip bgp 14.1.1.1/32 json', 'r5/bgp_route_1.json') - assertmsg = 'R5: Route 14.1.1.1/32 not present or has unexpected params' + _, result = _run_cmd_and_check( + r5, "show ip bgp 14.1.1.1/32 json", "r5/bgp_route_1.json" + ) + assertmsg = "R5: Route 14.1.1.1/32 not present or has unexpected params" assert result is None, assertmsg + logger.info( + "\nTest #5: Successful, routes have their original attributes with default LPREF and without GSHUT" + ) - logger.info('\nTest #5: Successful, routes have their original attributes with default LPREF and without GSHUT') - + # tgen.mininet_cli() - #tgen.mininet_cli() if __name__ == "__main__": args = ["-s"] + sys.argv[1:] diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce1/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce1/bgpd.conf index 6e6b9edde2..ae574319b3 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce1/bgpd.conf +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce1/bgpd.conf @@ -18,6 +18,8 @@ router bgp 5227 network 5.1.0.0/24 route-map rm-nh network 5.1.1.0/24 route-map rm-nh redistribute sharp route-map sharp-nh + network 6.0.1.0/24 route-map rm-nh + network 6.0.2.0/24 route-map rm-nh-same neighbor 192.168.1.1 activate exit-address-family ! @@ -41,5 +43,13 @@ route-map sharp-nh permit 10 set extcommunity rt 80:987 set community 0:65 ! - +route-map rm-nh-same permit 10 + match ip address al-any + set ip next-hop 99.0.0.1 + set local-preference 100 + set metric 100 + set large-community 12:34:11 + set extcommunity rt 89:123 + set community 0:67 +! end diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce2/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce2/bgpd.conf index 618acabd9f..599e2ddc1e 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce2/bgpd.conf +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce2/bgpd.conf @@ -18,6 +18,8 @@ router bgp 5227 network 5.1.0.0/24 route-map rm-nh network 5.1.1.0/24 route-map rm-nh redistribute sharp route-map sharp-nh + network 6.0.1.0/24 route-map rm-nh + network 6.0.2.0/24 route-map rm-nh-same neighbor 192.168.1.1 activate exit-address-family ! @@ -41,5 +43,13 @@ route-map sharp-nh permit 10 set extcommunity rt 70:456 set community 0:66 ! - +route-map rm-nh-same permit 10 + match ip address al-any + set ip next-hop 99.0.0.2 + set local-preference 100 + set metric 100 + set large-community 12:34:12 + set extcommunity rt 89:123 + set community 0:67 +! end diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/bgpd.conf index 85c5973e6f..e316de5690 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/bgpd.conf +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce3/bgpd.conf @@ -17,6 +17,8 @@ router bgp 5227 network 99.0.0.3/32 network 5.1.2.0/24 route-map rm-nh network 5.1.3.0/24 route-map rm-nh + network 6.0.1.0/24 route-map rm-nh + network 6.0.2.0/24 route-map rm-nh-same neighbor 192.168.1.1 activate exit-address-family ! @@ -31,5 +33,13 @@ route-map rm-nh permit 10 set extcommunity rt 89:123 set community 0:67 ! - +route-map rm-nh-same permit 10 + match ip address al-any + set ip next-hop 99.0.0.3 + set local-preference 100 + set metric 100 + set large-community 12:34:13 + set extcommunity rt 89:123 + set community 0:67 +! end diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce4/bgpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce4/bgpd.conf index 6a5075a000..60d9e93108 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce4/bgpd.conf +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/ce4/bgpd.conf @@ -17,6 +17,8 @@ router bgp 5228 vrf ce4-cust2 network 99.0.0.4/32 network 5.4.2.0/24 route-map rm-nh network 5.4.3.0/24 route-map rm-nh + network 6.0.1.0/24 route-map rm-nh + network 6.0.2.0/24 route-map rm-nh-same neighbor 192.168.2.1 activate exit-address-family ! @@ -31,5 +33,13 @@ route-map rm-nh permit 10 set extcommunity rt 89:123 set community 0:67 ! - +route-map rm-nh-same permit 10 + match ip address al-any + set ip next-hop 99.0.0.4 + set local-preference 100 + set metric 100 + set large-community 12:34:14 + set extcommunity rt 89:123 + set community 0:67 +! end diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py index f5a29b95c9..98d2a3bafc 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py @@ -14,6 +14,8 @@ from bgprib import bgpribRequireVpnRoutes, bgpribRequireUnicastRoutes want = [ {"p": "5.1.0.0/24", "n": "99.0.0.1"}, {"p": "5.1.1.0/24", "n": "99.0.0.1"}, + {"p": "6.0.1.0/24", "n": "99.0.0.1"}, + {"p": "6.0.2.0/24", "n": "99.0.0.1"}, {"p": "99.0.0.1/32", "n": "0.0.0.0"}, ] bgpribRequireUnicastRoutes("ce1", "ipv4", "", "Cust 1 routes in ce1", want) @@ -21,6 +23,8 @@ bgpribRequireUnicastRoutes("ce1", "ipv4", "", "Cust 1 routes in ce1", want) want = [ {"p": "5.1.0.0/24", "n": "99.0.0.2"}, {"p": "5.1.1.0/24", "n": "99.0.0.2"}, + {"p": "6.0.1.0/24", "n": "99.0.0.2"}, + {"p": "6.0.2.0/24", "n": "99.0.0.2"}, {"p": "99.0.0.2/32", "n": "0.0.0.0"}, ] bgpribRequireUnicastRoutes("ce2", "ipv4", "", "Cust 2 routes in ce1", want) @@ -28,6 +32,8 @@ bgpribRequireUnicastRoutes("ce2", "ipv4", "", "Cust 2 routes in ce1", want) want = [ {"p": "5.1.2.0/24", "n": "99.0.0.3"}, {"p": "5.1.3.0/24", "n": "99.0.0.3"}, + {"p": "6.0.1.0/24", "n": "99.0.0.3"}, + {"p": "6.0.2.0/24", "n": "99.0.0.3"}, {"p": "99.0.0.3/32", "n": "0.0.0.0"}, ] bgpribRequireUnicastRoutes("ce3", "ipv4", "", "Cust 3 routes in ce1", want) @@ -35,6 +41,8 @@ bgpribRequireUnicastRoutes("ce3", "ipv4", "", "Cust 3 routes in ce1", want) want = [ {"p": "5.4.2.0/24", "n": "99.0.0.4"}, {"p": "5.4.3.0/24", "n": "99.0.0.4"}, + {"p": "6.0.1.0/24", "n": "99.0.0.4"}, + {"p": "6.0.2.0/24", "n": "99.0.0.4"}, {"p": "99.0.0.4/32", "n": "0.0.0.0"}, ] bgpribRequireUnicastRoutes("ce4", "ipv4", "ce4-cust2", "Cust 4 routes in ce1", want) @@ -49,6 +57,8 @@ bgpribRequireUnicastRoutes("ce4", "ipv4", "ce4-cust2", "Cust 4 routes in ce1", w want_r1_cust1_routes = [ {"p": "5.1.0.0/24", "n": "99.0.0.1"}, {"p": "5.1.1.0/24", "n": "99.0.0.1"}, + {"p": "6.0.1.0/24", "n": "99.0.0.1"}, + {"p": "6.0.2.0/24", "n": "99.0.0.1"}, {"p": "99.0.0.1/32", "n": "192.168.1.2"}, ] bgpribRequireUnicastRoutes( @@ -58,6 +68,8 @@ bgpribRequireUnicastRoutes( want_r3_cust1_routes = [ {"p": "5.1.0.0/24", "n": "99.0.0.2"}, {"p": "5.1.1.0/24", "n": "99.0.0.2"}, + {"p": "6.0.1.0/24", "n": "99.0.0.2"}, + {"p": "6.0.2.0/24", "n": "99.0.0.2"}, {"p": "99.0.0.2/32", "n": "192.168.1.2"}, ] bgpribRequireUnicastRoutes( @@ -67,6 +79,8 @@ bgpribRequireUnicastRoutes( want_r4_cust1_routes = [ {"p": "5.1.2.0/24", "n": "99.0.0.3"}, {"p": "5.1.3.0/24", "n": "99.0.0.3"}, + {"p": "6.0.1.0/24", "n": "99.0.0.3"}, + {"p": "6.0.2.0/24", "n": "99.0.0.3"}, {"p": "99.0.0.3/32", "n": "192.168.1.2"}, ] bgpribRequireUnicastRoutes( @@ -76,6 +90,8 @@ bgpribRequireUnicastRoutes( want_r4_cust2_routes = [ {"p": "5.4.2.0/24", "n": "99.0.0.4"}, {"p": "5.4.3.0/24", "n": "99.0.0.4"}, + {"p": "6.0.1.0/24", "n": "99.0.0.4"}, + {"p": "6.0.2.0/24", "n": "99.0.0.4"}, {"p": "99.0.0.4/32", "n": "192.168.2.2"}, ] bgpribRequireUnicastRoutes( @@ -152,23 +168,27 @@ else: luCommand( "r1", 'vtysh -c "show bgp ipv4 vpn"', - r"Distinguisher: *10:1.*5.1.0.0/24 *99.0.0.1\b.*5.1.1.0/24 *99.0.0.1\b.*99.0.0.1/32 *192.168.1.2\b", + r"Distinguisher: *10:1.*5.1.0.0/24 *99.0.0.1\b.*5.1.1.0/24 *99.0.0.1\b.*6.0.1.0/24 *99.0.0.1\b.*6.0.2.0/24 *99.0.0.1\b.*99.0.0.1/32 *192.168.1.2\b", "pass", "vrf->vpn routes", ) luCommand( "r3", 'vtysh -c "show bgp ipv4 vpn"', - r"Distinguisher: *10:3.*5.1.0.0/24 *99.0.0.2\b.*5.1.1.0/24 *99.0.0.2\b.*99.0.0.2/32 *192.168.1.2\b", + r"Distinguisher: *10:3.*5.1.0.0/24 *99.0.0.2\b.*5.1.1.0/24 *99.0.0.2\b.*6.0.1.0/24 *99.0.0.2\b.*6.0.2.0/24 *99.0.0.2\b.*99.0.0.2/32 *192.168.1.2\b", "pass", "vrf->vpn routes", ) want = [ {"rd": "10:41", "p": "5.1.2.0/24", "n": "99.0.0.3"}, {"rd": "10:41", "p": "5.1.3.0/24", "n": "99.0.0.3"}, + {"rd": "10:41", "p": "6.0.1.0/24", "n": "99.0.0.3"}, + {"rd": "10:41", "p": "6.0.2.0/24", "n": "99.0.0.3"}, {"rd": "10:41", "p": "99.0.0.3/32", "n": "192.168.1.2"}, {"rd": "10:42", "p": "5.4.2.0/24", "n": "99.0.0.4"}, {"rd": "10:42", "p": "5.4.3.0/24", "n": "99.0.0.4"}, + {"rd": "10:42", "p": "6.0.1.0/24", "n": "99.0.0.4"}, + {"rd": "10:42", "p": "6.0.2.0/24", "n": "99.0.0.4"}, {"rd": "10:42", "p": "99.0.0.4/32", "n": "192.168.2.2"}, ] bgpribRequireVpnRoutes("r4", "vrf->vpn routes", want) @@ -266,57 +286,114 @@ bgpribRequireVpnRoutes( # PE routers: VRFs contain routes from remote customer nets ######################################################################## want_r1_remote_cust1_routes = [ - {"p": "5.1.0.0/24", "n": "3.3.3.3"}, - {"p": "5.1.1.0/24", "n": "3.3.3.3"}, - {"p": "99.0.0.2/32", "n": "3.3.3.3"}, + {"p": "5.1.0.0/24", "n": "3.3.3.3", "bp": False}, + {"p": "5.1.0.0/24", "n": "99.0.0.1", "bp": True}, + {"p": "5.1.1.0/24", "n": "3.3.3.3", "bp": False}, + {"p": "5.1.1.0/24", "n": "99.0.0.1", "bp": True}, {"p": "5.1.2.0/24", "n": "4.4.4.4"}, {"p": "5.1.3.0/24", "n": "4.4.4.4"}, - {"p": "99.0.0.3/32", "n": "4.4.4.4"}, {"p": "5.4.2.0/24", "n": "4.4.4.4"}, {"p": "5.4.3.0/24", "n": "4.4.4.4"}, + {"p": "6.0.1.0/24", "n": "3.3.3.3", "bp": False}, + {"p": "6.0.1.0/24", "n": "4.4.4.4", "bp": False}, + {"p": "6.0.1.0/24", "n": "99.0.0.1", "bp": True}, + {"p": "6.0.2.0/24", "n": "3.3.3.3", "bp": False}, + {"p": "6.0.2.0/24", "n": "4.4.4.4", "bp": False}, + {"p": "6.0.2.0/24", "n": "99.0.0.1", "bp": True}, + {"p": "99.0.0.1/32", "n": "192.168.1.2", "bp": True}, + {"p": "99.0.0.2/32", "n": "3.3.3.3"}, {"p": "99.0.0.3/32", "n": "4.4.4.4"}, + {"p": "99.0.0.4/32", "n": "4.4.4.4"}, ] bgpribRequireUnicastRoutes( - "r1", "ipv4", "r1-cust1", "Customer 1 routes in r1 vrf", want_r1_remote_cust1_routes + "r1", + "ipv4", + "r1-cust1", + "Customer 1 routes in r1 vrf (2)", + want_r1_remote_cust1_routes, + debug=False, ) want_r3_remote_cust1_routes = [ - {"p": "5.1.0.0/24", "n": "1.1.1.1"}, - {"p": "5.1.1.0/24", "n": "1.1.1.1"}, - {"p": "99.0.0.1/32", "n": "1.1.1.1"}, - {"p": "5.1.2.0/24", "n": "4.4.4.4"}, - {"p": "5.1.3.0/24", "n": "4.4.4.4"}, - {"p": "99.0.0.3/32", "n": "4.4.4.4"}, - {"p": "5.4.2.0/24", "n": "4.4.4.4"}, - {"p": "5.4.3.0/24", "n": "4.4.4.4"}, - {"p": "99.0.0.3/32", "n": "4.4.4.4"}, + {"p": "5.1.0.0/24", "n": "1.1.1.1", "bp": True}, + {"p": "5.1.0.0/24", "n": "99.0.0.2", "bp": False}, + {"p": "5.1.1.0/24", "n": "1.1.1.1", "bp": True}, + {"p": "5.1.1.0/24", "n": "99.0.0.2", "bp": False}, + {"p": "5.1.2.0/24", "n": "4.4.4.4", "bp": True}, + {"p": "5.1.3.0/24", "n": "4.4.4.4", "bp": True}, + {"p": "5.4.2.0/24", "n": "4.4.4.4", "bp": True}, + {"p": "5.4.3.0/24", "n": "4.4.4.4", "bp": True}, + {"p": "6.0.1.0/24", "n": "1.1.1.1", "bp": True}, + {"p": "6.0.1.0/24", "n": "4.4.4.4", "bp": False}, + {"p": "6.0.1.0/24", "n": "99.0.0.2", "bp": False}, + {"p": "6.0.2.0/24", "n": "1.1.1.1", "bp": False}, + {"p": "6.0.2.0/24", "n": "4.4.4.4", "bp": False}, + {"p": "6.0.2.0/24", "n": "99.0.0.2", "bp": True}, + {"p": "99.0.0.1/32", "n": "1.1.1.1", "bp": True}, + {"p": "99.0.0.3/32", "n": "4.4.4.4", "bp": True}, + {"p": "99.0.0.4/32", "n": "4.4.4.4", "bp": True}, ] bgpribRequireUnicastRoutes( - "r3", "ipv4", "r3-cust1", "Customer 1 routes in r3 vrf", want_r3_remote_cust1_routes + "r3", + "ipv4", + "r3-cust1", + "Customer 1 routes in r3 vrf (2)", + want_r3_remote_cust1_routes, + debug=False, ) want_r4_remote_cust1_routes = [ - {"p": "5.1.0.0/24", "n": "1.1.1.1"}, - {"p": "5.1.1.0/24", "n": "1.1.1.1"}, - {"p": "5.1.0.0/24", "n": "3.3.3.3"}, - {"p": "5.1.1.0/24", "n": "3.3.3.3"}, - {"p": "99.0.0.1/32", "n": "1.1.1.1"}, - {"p": "99.0.0.2/32", "n": "3.3.3.3"}, + {"p": "5.1.0.0/24", "n": "1.1.1.1", "bp": True}, + {"p": "5.1.0.0/24", "n": "3.3.3.3", "bp": False}, + {"p": "5.1.1.0/24", "n": "1.1.1.1", "bp": True}, + {"p": "5.1.1.0/24", "n": "3.3.3.3", "bp": False}, + {"p": "6.0.1.0/24", "n": "1.1.1.1", "bp": True}, + {"p": "6.0.1.0/24", "n": "3.3.3.3", "bp": False}, + {"p": "6.0.1.0/24", "n": "99.0.0.3", "bp": False}, + {"p": "6.0.1.0/24", "n": "99.0.0.4", "bp": False}, + {"p": "6.0.2.0/24", "n": "1.1.1.1", "bp": False}, + {"p": "6.0.2.0/24", "n": "3.3.3.3", "bp": False}, + {"p": "6.0.2.0/24", "n": "99.0.0.3", "bp": False}, + {"p": "6.0.2.0/24", "n": "99.0.0.4", "bp": True}, + {"p": "99.0.0.1/32", "n": "1.1.1.1", "bp": True}, + {"p": "99.0.0.2/32", "n": "3.3.3.3", "bp": True}, + {"p": "99.0.0.3/32", "n": "192.168.1.2", "bp": True}, + {"p": "99.0.0.4/32", "n": "192.168.2.2", "bp": True}, ] bgpribRequireUnicastRoutes( - "r4", "ipv4", "r4-cust1", "Customer 1 routes in r4 vrf", want_r4_remote_cust1_routes + "r4", + "ipv4", + "r4-cust1", + "Customer 1 routes in r4 vrf (2)", + want_r4_remote_cust1_routes, + debug=False, ) want_r4_remote_cust2_routes = [ - {"p": "5.1.0.0/24", "n": "1.1.1.1"}, - {"p": "5.1.1.0/24", "n": "1.1.1.1"}, - {"p": "5.1.0.0/24", "n": "3.3.3.3"}, - {"p": "5.1.1.0/24", "n": "3.3.3.3"}, - {"p": "99.0.0.1/32", "n": "1.1.1.1"}, - {"p": "99.0.0.2/32", "n": "3.3.3.3"}, + {"p": "5.1.0.0/24", "n": "1.1.1.1", "bp": True}, + {"p": "5.1.0.0/24", "n": "3.3.3.3", "bp": False}, + {"p": "5.1.1.0/24", "n": "1.1.1.1", "bp": True}, + {"p": "5.1.1.0/24", "n": "3.3.3.3", "bp": False}, + {"p": "6.0.1.0/24", "n": "1.1.1.1", "bp": True}, + {"p": "6.0.1.0/24", "n": "3.3.3.3", "bp": False}, + {"p": "6.0.1.0/24", "n": "99.0.0.3", "bp": False}, + {"p": "6.0.1.0/24", "n": "99.0.0.4", "bp": False}, + {"p": "6.0.2.0/24", "n": "1.1.1.1", "bp": False}, + {"p": "6.0.2.0/24", "n": "3.3.3.3", "bp": False}, + {"p": "6.0.2.0/24", "n": "99.0.0.3", "bp": True}, + {"p": "6.0.2.0/24", "n": "99.0.0.4", "bp": False}, + {"p": "99.0.0.1/32", "n": "1.1.1.1", "bp": True}, + {"p": "99.0.0.2/32", "n": "3.3.3.3", "bp": True}, + {"p": "99.0.0.3/32", "n": "192.168.1.2", "bp": True}, + {"p": "99.0.0.4/32", "n": "192.168.2.2", "bp": True}, ] bgpribRequireUnicastRoutes( - "r4", "ipv4", "r4-cust2", "Customer 2 routes in r4 vrf", want_r4_remote_cust2_routes + "r4", + "ipv4", + "r4-cust2", + "Customer 2 routes in r4 vrf (2)", + want_r4_remote_cust2_routes, + debug=False, ) @@ -330,36 +407,49 @@ bgpribRequireUnicastRoutes( luCommand( "ce1", 'vtysh -c "show bgp ipv4 uni"', - "10 routes and 10", + "12 routes and 12", "wait", "Local and remote routes", 10, ) want = [ - {"p": "5.1.2.0/24", "n": "192.168.1.1"}, - {"p": "5.1.3.0/24", "n": "192.168.1.1"}, - {"p": "5.4.2.0/24", "n": "192.168.1.1"}, - {"p": "5.4.3.0/24", "n": "192.168.1.1"}, + {"p": "5.1.0.0/24", "n": "99.0.0.1", "bp": True}, + {"p": "5.1.1.0/24", "n": "99.0.0.1", "bp": True}, + {"p": "5.1.2.0/24", "n": "192.168.1.1", "bp": True}, + {"p": "5.1.3.0/24", "n": "192.168.1.1", "bp": True}, + {"p": "5.4.2.0/24", "n": "192.168.1.1", "bp": True}, + {"p": "5.4.3.0/24", "n": "192.168.1.1", "bp": True}, + {"p": "6.0.1.0/24", "n": "99.0.0.1", "bp": True}, + {"p": "6.0.2.0/24", "n": "99.0.0.1", "bp": True}, ] -bgpribRequireUnicastRoutes("ce1", "ipv4", "", "Cust 1 routes from remote", want) +bgpribRequireUnicastRoutes( + "ce1", "ipv4", "", "Cust 1 routes from remote", want, debug=False +) luCommand( "ce2", 'vtysh -c "show bgp ipv4 uni"', - "10 routes and 12", + "12 routes and 15", "wait", "Local and remote routes", 10, ) want = [ - {"p": "5.1.0.0/24", "n": "192.168.1.1"}, - {"p": "5.1.1.0/24", "n": "192.168.1.1"}, - {"p": "5.1.2.0/24", "n": "192.168.1.1"}, - {"p": "5.1.3.0/24", "n": "192.168.1.1"}, - {"p": "5.4.2.0/24", "n": "192.168.1.1"}, - {"p": "5.4.3.0/24", "n": "192.168.1.1"}, + {"p": "5.1.0.0/24", "n": "192.168.1.1", "bp": False}, + {"p": "5.1.0.0/24", "n": "99.0.0.2", "bp": True}, + {"p": "5.1.1.0/24", "n": "192.168.1.1", "bp": False}, + {"p": "5.1.1.0/24", "n": "99.0.0.2", "bp": True}, + {"p": "5.1.2.0/24", "n": "192.168.1.1", "bp": True}, + {"p": "5.1.3.0/24", "n": "192.168.1.1", "bp": True}, + {"p": "5.4.2.0/24", "n": "192.168.1.1", "bp": True}, + {"p": "5.4.3.0/24", "n": "192.168.1.1", "bp": True}, + {"p": "6.0.1.0/24", "n": "192.168.1.1", "bp": False}, + {"p": "6.0.1.0/24", "n": "99.0.0.2", "bp": True}, + {"p": "6.0.2.0/24", "n": "99.0.0.2", "bp": True}, ] -bgpribRequireUnicastRoutes("ce2", "ipv4", "", "Cust 1 routes from remote", want) +bgpribRequireUnicastRoutes( + "ce2", "ipv4", "", "Cust 1 routes from remote", want, debug=False +) # human readable output for debugging luCommand("r4", 'vtysh -c "show bgp vrf r4-cust1 ipv4 uni"') @@ -371,34 +461,159 @@ luCommand("r4", 'vtysh -c "show ip route vrf r4-cust2"') luCommand( "ce3", 'vtysh -c "show bgp ipv4 uni"', - "10 routes and 10", + "12 routes and 14", "wait", "Local and remote routes", 10, ) # Requires bvl-bug-degenerate-no-label fix (FRR PR #2053) want = [ - {"p": "5.1.0.0/24", "n": "192.168.1.1"}, - {"p": "5.1.1.0/24", "n": "192.168.1.1"}, - {"p": "5.4.2.0/24", "n": "192.168.1.1"}, - {"p": "5.4.3.0/24", "n": "192.168.1.1"}, + {"p": "5.1.0.0/24", "n": "192.168.1.1", "bp": True}, + {"p": "5.1.1.0/24", "n": "192.168.1.1", "bp": True}, + {"p": "5.4.2.0/24", "n": "192.168.1.1", "bp": True}, + {"p": "5.4.3.0/24", "n": "192.168.1.1", "bp": True}, + {"p": "6.0.1.0/24", "n": "192.168.1.1", "bp": False}, + {"p": "6.0.2.0/24", "n": "192.168.1.1", "bp": False}, + {"p": "6.0.1.0/24", "n": "99.0.0.3", "bp": True}, + {"p": "6.0.2.0/24", "n": "99.0.0.3", "bp": True}, ] -bgpribRequireUnicastRoutes("ce3", "ipv4", "", "Cust 1 routes from remote", want) +bgpribRequireUnicastRoutes( + "ce3", "ipv4", "", "Cust 1 routes from remote", want, debug=False +) luCommand( "ce4", 'vtysh -c "show bgp vrf ce4-cust2 ipv4 uni"', - "10 routes and 10", + "12 routes and 14", "wait", "Local and remote routes", 10, ) want = [ - {"p": "5.1.0.0/24", "n": "192.168.2.1"}, - {"p": "5.1.1.0/24", "n": "192.168.2.1"}, - {"p": "5.1.2.0/24", "n": "192.168.2.1"}, - {"p": "5.1.3.0/24", "n": "192.168.2.1"}, + {"p": "5.1.0.0/24", "n": "192.168.2.1", "bp": True}, + {"p": "5.1.1.0/24", "n": "192.168.2.1", "bp": True}, + {"p": "5.1.2.0/24", "n": "192.168.2.1", "bp": True}, + {"p": "5.1.3.0/24", "n": "192.168.2.1", "bp": True}, + {"p": "6.0.1.0/24", "n": "192.168.2.1", "bp": False}, + {"p": "6.0.2.0/24", "n": "192.168.2.1", "bp": False}, + {"p": "6.0.1.0/24", "n": "99.0.0.4", "bp": True}, + {"p": "6.0.2.0/24", "n": "99.0.0.4", "bp": True}, ] bgpribRequireUnicastRoutes( - "ce4", "ipv4", "ce4-cust2", "Cust 2 routes from remote", want + "ce4", "ipv4", "ce4-cust2", "Cust 2 routes from remote", want, debug=False +) + +# verify details of exported/imported routes +luCommand( + "ce1", + 'vtysh -c "show bgp ipv4 uni 6.0.1.0"', + "1 available.*192.168.1.1.*99.0.0.1.*Community: 0:67.*Extended Community: RT:89:123.*Large Community: 12:34:56", + "pass", + "Redundant route 1 details", +) +luCommand( + "ce2", + 'vtysh -c "show bgp ipv4 uni 6.0.1.0"', + "2 available, best .*192.168.1.1.* Local.* 192.168.1.1 from 192.168.1.1 .192.168.1.1" + + ".* Origin IGP, metric 98, localpref 123, valid, internal" + + ".* Community: 0:67.* Extended Community: RT:52:100 RT:89:123.* Large Community: 12:34:56", + "pass", + "Redundant route 1 details", +) +luCommand( + "ce2", + 'vtysh -c "show bgp ipv4 uni 6.0.1.0"', + "2 available, best .*192.168.1.1.* Local.* 99.0.0.2 from 0.0.0.0 .99.0.0.2" + + ".* Origin IGP, metric 100, localpref 100, weight 32768, valid, sourced, local, best .Weight" + + ".* Community: 0:67.* Extended Community: RT:89:123.* Large Community: 12:34:56", + "pass", + "Redundant route 1 details", +) +luCommand( + "ce3", + 'vtysh -c "show bgp ipv4 uni 6.0.1.0"', + "2 available, best " + ".* Local.* 99.0.0.3 from 0.0.0.0 .99.0.0.3" + + ".* Origin IGP, metric 200, localpref 50, weight 32768, valid, sourced, local, best .Weight" + + ".* Community: 0:67.* Extended Community: RT:89:123.* Large Community: 12:34:56", + "pass", + "Redundant route 1 details", +) +luCommand( + "ce3", + 'vtysh -c "show bgp ipv4 uni 6.0.1.0"', + "2 available, best " + ".* Local.* 192.168.1.1 from 192.168.1.1 .192.168.1.1" + + ".* Origin IGP, metric 98, localpref 123, valid, internal" + + ".* Community: 0:67.* Extended Community: RT:52:100 RT:89:123.* Large Community: 12:34:56", + "pass", + "Redundant route 1 details", +) +luCommand( + "ce4", + 'vtysh -c "show bgp vrf ce4-cust2 ipv4 6.0.1.0"', + "2 available, best .*192.168.2.1.* Local.* 192.168.2.1 from 192.168.2.1 .192.168.2.1" + + ".* Origin IGP, metric 98, localpref 123, valid, internal" + + ".* Community: 0:67.* Extended Community: RT:52:100 RT:89:123.* Large Community: 12:34:56" + + ".* Local.* 99.0.0.4 from 0.0.0.0 .99.0.0.4" + + ".* Origin IGP, metric 200, localpref 50, weight 32768, valid, sourced, local, best .Weight" + + ".* Community: 0:67.* Extended Community: RT:89:123.* Large Community: 12:34:56", + "pass", + "Redundant route 1 details", +) + +luCommand( + "ce1", + 'vtysh -c "show bgp ipv4 uni 6.0.2.0"', + "1 available, best .*192.168.1.1.* Local.* 99.0.0.1 from 0.0.0.0 .99.0.0.1" + + ".* Origin IGP, metric 100, localpref 100, weight 32768, valid, sourced, local, best .First path received" + + ".* Community: 0:67.* Extended Community: RT:89:123.* Large Community: 12:34:11", + "pass", + "Redundant route 2 details", +) +luCommand( + "ce2", + 'vtysh -c "show bgp ipv4 uni 6.0.2.0"', + "1 available, best .*192.168.1.1.* Local.* 99.0.0.2 from 0.0.0.0 .99.0.0.2" + + ".* Origin IGP, metric 100, localpref 100, weight 32768, valid, sourced, local, best .First path received" + + ".* Community: 0:67.* Extended Community: RT:89:123.* Large Community: 12:34:12", + "pass", + "Redundant route 2 details", +) +luCommand( + "ce3", + 'vtysh -c "show bgp ipv4 uni 6.0.2.0"', + "2 available, best .*192.168.1.1.* Local.* 99.0.0.3 from 0.0.0.0 .99.0.0.3" + + ".* Origin IGP, metric 100, localpref 100, weight 32768, valid, sourced, local, best .Weight" + + ".* Community: 0:67.* Extended Community: RT:89:123.* Large Community: 12:34:13", + "pass", + "Redundant route 2 details", +) +luCommand( + "ce3", + 'vtysh -c "show bgp ipv4 uni 6.0.2.0"', + "2 available, best .*192.168.1.1.* Local.* 192.168.1.1 from 192.168.1.1 .192.168.1.1" + + ".* Origin IGP, metric 100, localpref 100, valid, internal" + + ".* Community: 0:67.* Extended Community: RT:52:100 RT:89:123.* Large Community: 12:34:14", + "pass", + "Redundant route 2 details", +) +luCommand( + "ce4", + 'vtysh -c "show bgp vrf ce4-cust2 ipv4 6.0.2.0"', + "2 available, best .*192.168.2.1.* Local.* 192.168.2.1 from 192.168.2.1 .192.168.2.1" + + ".* Origin IGP, metric 100, localpref 100, valid, internal" + + ".* Community: 0:67.* Extended Community: RT:52:100 RT:89:123.* Large Community: 12:34:13", + "pass", + "Redundant route 2 details", +) +luCommand( + "ce4", + 'vtysh -c "show bgp vrf ce4-cust2 ipv4 6.0.2.0"', + "2 available, best .*192.168.2.1.* Local.* 99.0.0.4 from 0.0.0.0 .99.0.0.4" + + ".* Origin IGP, metric 100, localpref 100, weight 32768, valid, sourced, local, best .Weight" + + ".* Community: 0:67.* Extended Community: RT:89:123.* Large Community: 12:34:14", + "pass", + "Redundant route 2 details", ) +# done diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_down.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_down.py index b4fa240495..7990533f3a 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_down.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_down.py @@ -49,7 +49,7 @@ if ret != False and found != None: luCommand( rtr, 'vtysh -c "show bgp ipv4 uni" | grep Display', - " 10 route", + " 12 route", "wait", "BGP routes removed", wait, diff --git a/tests/topotests/bgp_large_community/test_bgp_large_community_topo_1.py b/tests/topotests/bgp_large_community/test_bgp_large_community_topo_1.py index dc06b7131a..40489f438f 100644 --- a/tests/topotests/bgp_large_community/test_bgp_large_community_topo_1.py +++ b/tests/topotests/bgp_large_community/test_bgp_large_community_topo_1.py @@ -67,7 +67,7 @@ from lib.common_config import ( verify_bgp_community, step, check_address_types, - required_linux_kernel_version + required_linux_kernel_version, ) from lib.topolog import logger from lib.bgp import verify_bgp_convergence, create_router_bgp, clear_bgp_and_verify @@ -144,7 +144,7 @@ def setup_module(mod): * `mod`: module name """ # Required linux kernel version for this suite to run. - result = required_linux_kernel_version('4.15') + result = required_linux_kernel_version("4.15") if result is not True: pytest.skip("Kernel requirements are not met") diff --git a/tests/topotests/bgp_large_community/test_bgp_large_community_topo_2.py b/tests/topotests/bgp_large_community/test_bgp_large_community_topo_2.py index bb88e47415..9c0355a3e9 100644 --- a/tests/topotests/bgp_large_community/test_bgp_large_community_topo_2.py +++ b/tests/topotests/bgp_large_community/test_bgp_large_community_topo_2.py @@ -91,7 +91,7 @@ from lib.common_config import ( verify_route_maps, create_static_routes, check_address_types, - required_linux_kernel_version + required_linux_kernel_version, ) from lib.topolog import logger from lib.bgp import verify_bgp_convergence, create_router_bgp, clear_bgp_and_verify @@ -135,7 +135,7 @@ def setup_module(mod): """ # Required linux kernel version for this suite to run. - result = required_linux_kernel_version('4.15') + result = required_linux_kernel_version("4.15") if result is not True: pytest.skip("Kernel requirements are not met") diff --git a/tests/topotests/bgp_link_bw_ip/test_bgp_linkbw_ip.py b/tests/topotests/bgp_link_bw_ip/test_bgp_linkbw_ip.py index dff69e3a27..f09ff20651 100644 --- a/tests/topotests/bgp_link_bw_ip/test_bgp_linkbw_ip.py +++ b/tests/topotests/bgp_link_bw_ip/test_bgp_linkbw_ip.py @@ -35,7 +35,7 @@ import json # Save the Current Working Directory to find configuration files. CWD = os.path.dirname(os.path.realpath(__file__)) -sys.path.append(os.path.join(CWD, '../')) +sys.path.append(os.path.join(CWD, "../")) # pylint: disable=C0413 # Import topogen and topotest helpers @@ -63,8 +63,10 @@ this scenario, the servers are also routers as they have to announce anycast IP (VIP) addresses via BGP. """ + class BgpLinkBwTopo(Topo): "Test topology builder" + def build(self, *_args, **_opts): "Build function" tgen = get_topogen(self) @@ -73,45 +75,46 @@ class BgpLinkBwTopo(Topo): # and 4 servers routers = {} for i in range(1, 11): - routers[i] = tgen.add_router('r{}'.format(i)) + routers[i] = tgen.add_router("r{}".format(i)) # Create 13 "switches" - to interconnect the above routers switches = {} for i in range(1, 14): - switches[i] = tgen.add_switch('s{}'.format(i)) + switches[i] = tgen.add_switch("s{}".format(i)) # Interconnect R1 (super-spine) to R2 and R3 (the two spines) - switches[1].add_link(tgen.gears['r1']) - switches[1].add_link(tgen.gears['r2']) - switches[2].add_link(tgen.gears['r1']) - switches[2].add_link(tgen.gears['r3']) + switches[1].add_link(tgen.gears["r1"]) + switches[1].add_link(tgen.gears["r2"]) + switches[2].add_link(tgen.gears["r1"]) + switches[2].add_link(tgen.gears["r3"]) # Interconnect R2 (spine in pod-1) to R4 and R5 (the associated # leaf switches) - switches[3].add_link(tgen.gears['r2']) - switches[3].add_link(tgen.gears['r4']) - switches[4].add_link(tgen.gears['r2']) - switches[4].add_link(tgen.gears['r5']) + switches[3].add_link(tgen.gears["r2"]) + switches[3].add_link(tgen.gears["r4"]) + switches[4].add_link(tgen.gears["r2"]) + switches[4].add_link(tgen.gears["r5"]) # Interconnect R3 (spine in pod-2) to R6 (associated leaf) - switches[5].add_link(tgen.gears['r3']) - switches[5].add_link(tgen.gears['r6']) + switches[5].add_link(tgen.gears["r3"]) + switches[5].add_link(tgen.gears["r6"]) # Interconnect leaf switches to servers - switches[6].add_link(tgen.gears['r4']) - switches[6].add_link(tgen.gears['r7']) - switches[7].add_link(tgen.gears['r4']) - switches[7].add_link(tgen.gears['r8']) - switches[8].add_link(tgen.gears['r5']) - switches[8].add_link(tgen.gears['r9']) - switches[9].add_link(tgen.gears['r6']) - switches[9].add_link(tgen.gears['r10']) + switches[6].add_link(tgen.gears["r4"]) + switches[6].add_link(tgen.gears["r7"]) + switches[7].add_link(tgen.gears["r4"]) + switches[7].add_link(tgen.gears["r8"]) + switches[8].add_link(tgen.gears["r5"]) + switches[8].add_link(tgen.gears["r9"]) + switches[9].add_link(tgen.gears["r6"]) + switches[9].add_link(tgen.gears["r10"]) # Create empty networks for the servers - switches[10].add_link(tgen.gears['r7']) - switches[11].add_link(tgen.gears['r8']) - switches[12].add_link(tgen.gears['r9']) - switches[13].add_link(tgen.gears['r10']) + switches[10].add_link(tgen.gears["r7"]) + switches[11].add_link(tgen.gears["r8"]) + switches[12].add_link(tgen.gears["r9"]) + switches[13].add_link(tgen.gears["r10"]) + def setup_module(mod): "Sets up the pytest environment" @@ -121,395 +124,454 @@ def setup_module(mod): router_list = tgen.routers() for rname, router in router_list.items(): router.load_config( - TopoRouter.RD_ZEBRA, - os.path.join(CWD, '{}/zebra.conf'.format(rname)) + TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname)) ) router.load_config( - TopoRouter.RD_BGP, - os.path.join(CWD, '{}/bgpd.conf'.format(rname)) + TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname)) ) # Initialize all routers. tgen.start_router() - #tgen.mininet_cli() + # tgen.mininet_cli() + def teardown_module(mod): "Teardown the pytest environment" tgen = get_topogen() tgen.stop_topology() + def test_bgp_linkbw_adv(): "Test #1: Test BGP link-bandwidth advertisement based on number of multipaths" - logger.info('\nTest #1: Test BGP link-bandwidth advertisement based on number of multipaths') + logger.info( + "\nTest #1: Test BGP link-bandwidth advertisement based on number of multipaths" + ) tgen = get_topogen() if tgen.routers_have_failure(): - pytest.skip('skipped because of router(s) failure') + pytest.skip("skipped because of router(s) failure") - r1 = tgen.gears['r1'] - r2 = tgen.gears['r2'] + r1 = tgen.gears["r1"] + r2 = tgen.gears["r2"] # Configure anycast IP on server r7 - logger.info('Configure anycast IP on server r7') + logger.info("Configure anycast IP on server r7") - tgen.net['r7'].cmd('ip addr add 198.10.1.1/32 dev r7-eth1') + tgen.net["r7"].cmd("ip addr add 198.10.1.1/32 dev r7-eth1") # Check on spine router r2 for link-bw advertisement by leaf router r4 - logger.info('Check on spine router r2 for link-bw advertisement by leaf router r4') + logger.info("Check on spine router r2 for link-bw advertisement by leaf router r4") - json_file = '{}/r2/bgp-route-1.json'.format(CWD) + json_file = "{}/r2/bgp-route-1.json".format(CWD) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - r2, 'show bgp ipv4 uni 198.10.1.1/32 json', expected) + test_func = partial( + topotest.router_json_cmp, r2, "show bgp ipv4 uni 198.10.1.1/32 json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=200, wait=0.5) - assertmsg = 'JSON output mismatch on spine router r2' + assertmsg = "JSON output mismatch on spine router r2" assert result is None, assertmsg # Check on spine router r2 that default weight is used as there is no multipath - logger.info('Check on spine router r2 that default weight is used as there is no multipath') + logger.info( + "Check on spine router r2 that default weight is used as there is no multipath" + ) - json_file = '{}/r2/ip-route-1.json'.format(CWD) + json_file = "{}/r2/ip-route-1.json".format(CWD) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - r2, 'show ip route 198.10.1.1/32 json', expected) + test_func = partial( + topotest.router_json_cmp, r2, "show ip route 198.10.1.1/32 json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=50, wait=0.5) - assertmsg = 'JSON output mismatch on spine router r2' + assertmsg = "JSON output mismatch on spine router r2" assert result is None, assertmsg # Check on super-spine router r1 that link-bw has been propagated by spine router r2 - logger.info('Check on super-spine router r1 that link-bw has been propagated by spine router r2') + logger.info( + "Check on super-spine router r1 that link-bw has been propagated by spine router r2" + ) - json_file = '{}/r1/bgp-route-1.json'.format(CWD) + json_file = "{}/r1/bgp-route-1.json".format(CWD) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - r1, 'show bgp ipv4 uni 198.10.1.1/32 json', expected) + test_func = partial( + topotest.router_json_cmp, r1, "show bgp ipv4 uni 198.10.1.1/32 json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=200, wait=0.5) - assertmsg = 'JSON output mismatch on super-spine router r1' + assertmsg = "JSON output mismatch on super-spine router r1" assert result is None, assertmsg + def test_bgp_cumul_linkbw(): "Test #2: Test cumulative link-bandwidth propagation" - logger.info('\nTest #2: Test cumulative link-bandwidth propagation') + logger.info("\nTest #2: Test cumulative link-bandwidth propagation") tgen = get_topogen() if tgen.routers_have_failure(): - pytest.skip('skipped because of router(s) failure') + pytest.skip("skipped because of router(s) failure") - r1 = tgen.gears['r1'] - r2 = tgen.gears['r2'] - r4 = tgen.gears['r4'] + r1 = tgen.gears["r1"] + r2 = tgen.gears["r2"] + r4 = tgen.gears["r4"] # Configure anycast IP on additional server r8 - logger.info('Configure anycast IP on server r8') + logger.info("Configure anycast IP on server r8") - tgen.net['r8'].cmd('ip addr add 198.10.1.1/32 dev r8-eth1') + tgen.net["r8"].cmd("ip addr add 198.10.1.1/32 dev r8-eth1") # Check multipath on leaf router r4 - logger.info('Check multipath on leaf router r4') + logger.info("Check multipath on leaf router r4") - json_file = '{}/r4/bgp-route-1.json'.format(CWD) + json_file = "{}/r4/bgp-route-1.json".format(CWD) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - r4, 'show bgp ipv4 uni 198.10.1.1/32 json', expected) + test_func = partial( + topotest.router_json_cmp, r4, "show bgp ipv4 uni 198.10.1.1/32 json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=200, wait=0.5) - assertmsg = 'JSON output mismatch on leaf router r4' + assertmsg = "JSON output mismatch on leaf router r4" assert result is None, assertmsg # Check regular ECMP is in effect on leaf router r4 - logger.info('Check regular ECMP is in effect on leaf router r4') + logger.info("Check regular ECMP is in effect on leaf router r4") - json_file = '{}/r4/ip-route-1.json'.format(CWD) + json_file = "{}/r4/ip-route-1.json".format(CWD) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - r4, 'show ip route 198.10.1.1/32 json', expected) + test_func = partial( + topotest.router_json_cmp, r4, "show ip route 198.10.1.1/32 json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=50, wait=0.5) - assertmsg = 'JSON output mismatch on leaf router r4' + assertmsg = "JSON output mismatch on leaf router r4" assert result is None, assertmsg # Check on spine router r2 that leaf has propagated the cumulative link-bw based on num-multipaths - logger.info('Check on spine router r2 that leaf has propagated the cumulative link-bw based on num-multipaths') + logger.info( + "Check on spine router r2 that leaf has propagated the cumulative link-bw based on num-multipaths" + ) - json_file = '{}/r2/bgp-route-2.json'.format(CWD) + json_file = "{}/r2/bgp-route-2.json".format(CWD) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - r2, 'show bgp ipv4 uni 198.10.1.1/32 json', expected) + test_func = partial( + topotest.router_json_cmp, r2, "show bgp ipv4 uni 198.10.1.1/32 json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=200, wait=0.5) - assertmsg = 'JSON output mismatch on spine router r2' + assertmsg = "JSON output mismatch on spine router r2" assert result is None, assertmsg + def test_weighted_ecmp(): "Test #3: Test weighted ECMP - multipath with next hop weights" - logger.info('\nTest #3: Test weighted ECMP - multipath with next hop weights') + logger.info("\nTest #3: Test weighted ECMP - multipath with next hop weights") tgen = get_topogen() if tgen.routers_have_failure(): - pytest.skip('skipped because of router(s) failure') + pytest.skip("skipped because of router(s) failure") - r1 = tgen.gears['r1'] - r2 = tgen.gears['r2'] + r1 = tgen.gears["r1"] + r2 = tgen.gears["r2"] # Configure anycast IP on additional server r9 - logger.info('Configure anycast IP on server r9') + logger.info("Configure anycast IP on server r9") - tgen.net['r9'].cmd('ip addr add 198.10.1.1/32 dev r9-eth1') + tgen.net["r9"].cmd("ip addr add 198.10.1.1/32 dev r9-eth1") # Check multipath on spine router r2 - logger.info('Check multipath on spine router r2') - json_file = '{}/r2/bgp-route-3.json'.format(CWD) + logger.info("Check multipath on spine router r2") + json_file = "{}/r2/bgp-route-3.json".format(CWD) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - r2, 'show bgp ipv4 uni 198.10.1.1/32 json', expected) + test_func = partial( + topotest.router_json_cmp, r2, "show bgp ipv4 uni 198.10.1.1/32 json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=200, wait=0.5) - assertmsg = 'JSON output mismatch on spine router r2' + assertmsg = "JSON output mismatch on spine router r2" assert result is None, assertmsg # Check weighted ECMP is in effect on the spine router r2 - logger.info('Check weighted ECMP is in effect on the spine router r2') + logger.info("Check weighted ECMP is in effect on the spine router r2") - json_file = '{}/r2/ip-route-2.json'.format(CWD) + json_file = "{}/r2/ip-route-2.json".format(CWD) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - r2, 'show ip route 198.10.1.1/32 json', expected) + test_func = partial( + topotest.router_json_cmp, r2, "show ip route 198.10.1.1/32 json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=50, wait=0.5) - assertmsg = 'JSON output mismatch on spine router r2' + assertmsg = "JSON output mismatch on spine router r2" assert result is None, assertmsg # Configure anycast IP on additional server r10 - logger.info('Configure anycast IP on server r10') + logger.info("Configure anycast IP on server r10") - tgen.net['r10'].cmd('ip addr add 198.10.1.1/32 dev r10-eth1') + tgen.net["r10"].cmd("ip addr add 198.10.1.1/32 dev r10-eth1") # Check multipath on super-spine router r1 - logger.info('Check multipath on super-spine router r1') - json_file = '{}/r1/bgp-route-2.json'.format(CWD) + logger.info("Check multipath on super-spine router r1") + json_file = "{}/r1/bgp-route-2.json".format(CWD) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - r1, 'show bgp ipv4 uni 198.10.1.1/32 json', expected) + test_func = partial( + topotest.router_json_cmp, r1, "show bgp ipv4 uni 198.10.1.1/32 json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=200, wait=0.5) - assertmsg = 'JSON output mismatch on super-spine router r1' + assertmsg = "JSON output mismatch on super-spine router r1" assert result is None, assertmsg # Check weighted ECMP is in effect on the super-spine router r1 - logger.info('Check weighted ECMP is in effect on the super-spine router r1') - json_file = '{}/r1/ip-route-1.json'.format(CWD) + logger.info("Check weighted ECMP is in effect on the super-spine router r1") + json_file = "{}/r1/ip-route-1.json".format(CWD) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - r1, 'show ip route 198.10.1.1/32 json', expected) + test_func = partial( + topotest.router_json_cmp, r1, "show ip route 198.10.1.1/32 json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=50, wait=0.5) - assertmsg = 'JSON output mismatch on super-spine router r1' + assertmsg = "JSON output mismatch on super-spine router r1" assert result is None, assertmsg + def test_weighted_ecmp_link_flap(): "Test #4: Test weighted ECMP rebalancing upon change (link flap)" - logger.info('\nTest #4: Test weighted ECMP rebalancing upon change (link flap)') + logger.info("\nTest #4: Test weighted ECMP rebalancing upon change (link flap)") tgen = get_topogen() if tgen.routers_have_failure(): - pytest.skip('skipped because of router(s) failure') + pytest.skip("skipped because of router(s) failure") - r1 = tgen.gears['r1'] - r2 = tgen.gears['r2'] + r1 = tgen.gears["r1"] + r2 = tgen.gears["r2"] # Bring down link on server r9 - logger.info('Bring down link on server r9') + logger.info("Bring down link on server r9") - tgen.net['r9'].cmd('ip link set dev r9-eth1 down') + tgen.net["r9"].cmd("ip link set dev r9-eth1 down") # Check spine router r2 has only one path - logger.info('Check spine router r2 has only one path') + logger.info("Check spine router r2 has only one path") - json_file = '{}/r2/ip-route-3.json'.format(CWD) + json_file = "{}/r2/ip-route-3.json".format(CWD) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - r2, 'show ip route 198.10.1.1/32 json', expected) + test_func = partial( + topotest.router_json_cmp, r2, "show ip route 198.10.1.1/32 json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=200, wait=0.5) - assertmsg = 'JSON output mismatch on spine router r2' + assertmsg = "JSON output mismatch on spine router r2" assert result is None, assertmsg # Check link-bandwidth change and weighted ECMP rebalance on super-spine router r1 - logger.info('Check link-bandwidth change and weighted ECMP rebalance on super-spine router r1') + logger.info( + "Check link-bandwidth change and weighted ECMP rebalance on super-spine router r1" + ) - json_file = '{}/r1/bgp-route-3.json'.format(CWD) + json_file = "{}/r1/bgp-route-3.json".format(CWD) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - r1, 'show bgp ipv4 uni 198.10.1.1/32 json', expected) + test_func = partial( + topotest.router_json_cmp, r1, "show bgp ipv4 uni 198.10.1.1/32 json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=200, wait=0.5) - assertmsg = 'JSON output mismatch on super-spine router r1' + assertmsg = "JSON output mismatch on super-spine router r1" assert result is None, assertmsg - json_file = '{}/r1/ip-route-2.json'.format(CWD) + json_file = "{}/r1/ip-route-2.json".format(CWD) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - r1, 'show ip route 198.10.1.1/32 json', expected) + test_func = partial( + topotest.router_json_cmp, r1, "show ip route 198.10.1.1/32 json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=50, wait=0.5) - assertmsg = 'JSON output mismatch on super-spine router r1' + assertmsg = "JSON output mismatch on super-spine router r1" assert result is None, assertmsg # Bring up link on server r9 - logger.info('Bring up link on server r9') + logger.info("Bring up link on server r9") - tgen.net['r9'].cmd('ip link set dev r9-eth1 up') + tgen.net["r9"].cmd("ip link set dev r9-eth1 up") # Check link-bandwidth change and weighted ECMP rebalance on super-spine router r1 - logger.info('Check link-bandwidth change and weighted ECMP rebalance on super-spine router r1') + logger.info( + "Check link-bandwidth change and weighted ECMP rebalance on super-spine router r1" + ) - json_file = '{}/r1/bgp-route-2.json'.format(CWD) + json_file = "{}/r1/bgp-route-2.json".format(CWD) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - r1, 'show bgp ipv4 uni 198.10.1.1/32 json', expected) + test_func = partial( + topotest.router_json_cmp, r1, "show bgp ipv4 uni 198.10.1.1/32 json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=200, wait=0.5) - assertmsg = 'JSON output mismatch on super-spine router r1' + assertmsg = "JSON output mismatch on super-spine router r1" assert result is None, assertmsg - json_file = '{}/r1/ip-route-1.json'.format(CWD) + json_file = "{}/r1/ip-route-1.json".format(CWD) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - r1, 'show ip route 198.10.1.1/32 json', expected) + test_func = partial( + topotest.router_json_cmp, r1, "show ip route 198.10.1.1/32 json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=50, wait=0.5) - assertmsg = 'JSON output mismatch on super-spine router r1' + assertmsg = "JSON output mismatch on super-spine router r1" assert result is None, assertmsg + def test_weighted_ecmp_second_anycast_ip(): "Test #5: Test weighted ECMP for a second anycast IP" - logger.info('\nTest #5: Test weighted ECMP for a second anycast IP') + logger.info("\nTest #5: Test weighted ECMP for a second anycast IP") tgen = get_topogen() if tgen.routers_have_failure(): - pytest.skip('skipped because of router(s) failure') + pytest.skip("skipped because of router(s) failure") - r1 = tgen.gears['r1'] - r2 = tgen.gears['r2'] + r1 = tgen.gears["r1"] + r2 = tgen.gears["r2"] # Configure anycast IP on additional server r7, r9 and r10 - logger.info('Configure anycast IP on server r7, r9 and r10') + logger.info("Configure anycast IP on server r7, r9 and r10") - tgen.net['r7'].cmd('ip addr add 198.10.1.11/32 dev r7-eth1') - tgen.net['r9'].cmd('ip addr add 198.10.1.11/32 dev r9-eth1') - tgen.net['r10'].cmd('ip addr add 198.10.1.11/32 dev r10-eth1') + tgen.net["r7"].cmd("ip addr add 198.10.1.11/32 dev r7-eth1") + tgen.net["r9"].cmd("ip addr add 198.10.1.11/32 dev r9-eth1") + tgen.net["r10"].cmd("ip addr add 198.10.1.11/32 dev r10-eth1") # Check link-bandwidth and weighted ECMP on super-spine router r1 - logger.info('Check link-bandwidth and weighted ECMP on super-spine router r1') + logger.info("Check link-bandwidth and weighted ECMP on super-spine router r1") - json_file = '{}/r1/bgp-route-4.json'.format(CWD) + json_file = "{}/r1/bgp-route-4.json".format(CWD) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - r1, 'show bgp ipv4 uni 198.10.1.11/32 json', expected) + test_func = partial( + topotest.router_json_cmp, r1, "show bgp ipv4 uni 198.10.1.11/32 json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=200, wait=0.5) - assertmsg = 'JSON output mismatch on super-spine router r1' + assertmsg = "JSON output mismatch on super-spine router r1" assert result is None, assertmsg - json_file = '{}/r1/ip-route-3.json'.format(CWD) + json_file = "{}/r1/ip-route-3.json".format(CWD) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - r1, 'show ip route 198.10.1.11/32 json', expected) + test_func = partial( + topotest.router_json_cmp, r1, "show ip route 198.10.1.11/32 json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=50, wait=0.5) - assertmsg = 'JSON output mismatch on super-spine router r1' + assertmsg = "JSON output mismatch on super-spine router r1" assert result is None, assertmsg + def test_paths_with_and_without_linkbw(): "Test #6: Test paths with and without link-bandwidth - receiver should resort to regular ECMP" - logger.info('\nTest #6: Test paths with and without link-bandwidth - receiver should resort to regular ECMP') + logger.info( + "\nTest #6: Test paths with and without link-bandwidth - receiver should resort to regular ECMP" + ) tgen = get_topogen() if tgen.routers_have_failure(): - pytest.skip('skipped because of router(s) failure') + pytest.skip("skipped because of router(s) failure") - r1 = tgen.gears['r1'] + r1 = tgen.gears["r1"] # Configure leaf router r6 to not advertise any link-bandwidth - logger.info('Configure leaf router r6 to not advertise any link-bandwidth') + logger.info("Configure leaf router r6 to not advertise any link-bandwidth") - tgen.net['r6'].cmd('vtysh -c \"conf t\" -c \"router bgp 65303\" -c \"address-family ipv4 unicast\" -c \"no neighbor 11.1.3.1 route-map anycast_ip out\"') + tgen.net["r6"].cmd( + 'vtysh -c "conf t" -c "router bgp 65303" -c "address-family ipv4 unicast" -c "no neighbor 11.1.3.1 route-map anycast_ip out"' + ) # Check link-bandwidth change on super-spine router r1 - logger.info('Check link-bandwidth change on super-spine router r1') + logger.info("Check link-bandwidth change on super-spine router r1") - json_file = '{}/r1/bgp-route-5.json'.format(CWD) + json_file = "{}/r1/bgp-route-5.json".format(CWD) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - r1, 'show bgp ipv4 uni 198.10.1.1/32 json', expected) + test_func = partial( + topotest.router_json_cmp, r1, "show bgp ipv4 uni 198.10.1.1/32 json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=200, wait=0.5) - assertmsg = 'JSON output mismatch on super-spine router r1' + assertmsg = "JSON output mismatch on super-spine router r1" assert result is None, assertmsg # Check super-spine router r1 resorts to regular ECMP - logger.info('Check super-spine router r1 resorts to regular ECMP') + logger.info("Check super-spine router r1 resorts to regular ECMP") - json_file = '{}/r1/ip-route-4.json'.format(CWD) + json_file = "{}/r1/ip-route-4.json".format(CWD) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - r1, 'show ip route 198.10.1.1/32 json', expected) + test_func = partial( + topotest.router_json_cmp, r1, "show ip route 198.10.1.1/32 json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=50, wait=0.5) - assertmsg = 'JSON output mismatch on super-spine router r1' + assertmsg = "JSON output mismatch on super-spine router r1" assert result is None, assertmsg - json_file = '{}/r1/ip-route-5.json'.format(CWD) + json_file = "{}/r1/ip-route-5.json".format(CWD) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - r1, 'show ip route 198.10.1.11/32 json', expected) + test_func = partial( + topotest.router_json_cmp, r1, "show ip route 198.10.1.11/32 json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=50, wait=0.5) - assertmsg = 'JSON output mismatch on super-spine router r1' + assertmsg = "JSON output mismatch on super-spine router r1" assert result is None, assertmsg + def test_linkbw_handling_options(): "Test #7: Test different options for processing link-bandwidth on the receiver" - logger.info('\nTest #7: Test different options for processing link-bandwidth on the receiver') + logger.info( + "\nTest #7: Test different options for processing link-bandwidth on the receiver" + ) tgen = get_topogen() if tgen.routers_have_failure(): - pytest.skip('skipped because of router(s) failure') + pytest.skip("skipped because of router(s) failure") - r1 = tgen.gears['r1'] + r1 = tgen.gears["r1"] # Configure super-spine r1 to skip multipaths without link-bandwidth - logger.info('Configure super-spine r1 to skip multipaths without link-bandwidth') + logger.info("Configure super-spine r1 to skip multipaths without link-bandwidth") - tgen.net['r1'].cmd('vtysh -c \"conf t\" -c \"router bgp 65101\" -c \"bgp bestpath bandwidth skip-missing\"') + tgen.net["r1"].cmd( + 'vtysh -c "conf t" -c "router bgp 65101" -c "bgp bestpath bandwidth skip-missing"' + ) # Check super-spine router r1 resorts to only one path as other path is skipped - logger.info('Check super-spine router r1 resorts to only one path as other path is skipped') + logger.info( + "Check super-spine router r1 resorts to only one path as other path is skipped" + ) - json_file = '{}/r1/ip-route-6.json'.format(CWD) + json_file = "{}/r1/ip-route-6.json".format(CWD) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - r1, 'show ip route 198.10.1.1/32 json', expected) + test_func = partial( + topotest.router_json_cmp, r1, "show ip route 198.10.1.1/32 json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=200, wait=0.5) - assertmsg = 'JSON output mismatch on super-spine router r1' + assertmsg = "JSON output mismatch on super-spine router r1" assert result is None, assertmsg - json_file = '{}/r1/ip-route-7.json'.format(CWD) + json_file = "{}/r1/ip-route-7.json".format(CWD) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - r1, 'show ip route 198.10.1.11/32 json', expected) + test_func = partial( + topotest.router_json_cmp, r1, "show ip route 198.10.1.11/32 json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=200, wait=0.5) - assertmsg = 'JSON output mismatch on super-spine router r1' + assertmsg = "JSON output mismatch on super-spine router r1" assert result is None, assertmsg # Configure super-spine r1 to use default-weight for multipaths without link-bandwidth - logger.info('Configure super-spine r1 to use default-weight for multipaths without link-bandwidth') + logger.info( + "Configure super-spine r1 to use default-weight for multipaths without link-bandwidth" + ) - tgen.net['r1'].cmd('vtysh -c \"conf t\" -c \"router bgp 65101\" -c \"bgp bestpath bandwidth default-weight-for-missing\"') + tgen.net["r1"].cmd( + 'vtysh -c "conf t" -c "router bgp 65101" -c "bgp bestpath bandwidth default-weight-for-missing"' + ) # Check super-spine router r1 uses ECMP with weight 1 for path without link-bandwidth - logger.info('Check super-spine router r1 uses ECMP with weight 1 for path without link-bandwidth') + logger.info( + "Check super-spine router r1 uses ECMP with weight 1 for path without link-bandwidth" + ) - json_file = '{}/r1/ip-route-8.json'.format(CWD) + json_file = "{}/r1/ip-route-8.json".format(CWD) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - r1, 'show ip route 198.10.1.1/32 json', expected) + test_func = partial( + topotest.router_json_cmp, r1, "show ip route 198.10.1.1/32 json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=200, wait=0.5) - assertmsg = 'JSON output mismatch on super-spine router r1' + assertmsg = "JSON output mismatch on super-spine router r1" assert result is None, assertmsg - json_file = '{}/r1/ip-route-9.json'.format(CWD) + json_file = "{}/r1/ip-route-9.json".format(CWD) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - r1, 'show ip route 198.10.1.11/32 json', expected) + test_func = partial( + topotest.router_json_cmp, r1, "show ip route 198.10.1.11/32 json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=200, wait=0.5) - assertmsg = 'JSON output mismatch on super-spine router r1' + assertmsg = "JSON output mismatch on super-spine router r1" assert result is None, assertmsg -if __name__ == '__main__': + +if __name__ == "__main__": args = ["-s"] + sys.argv[1:] sys.exit(pytest.main(args)) diff --git a/tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py b/tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py index c15b88d371..cf6b7cc53f 100644 --- a/tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py +++ b/tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py @@ -132,7 +132,7 @@ from lib.common_config import ( create_bgp_community_lists, check_router_status, apply_raw_config, - required_linux_kernel_version + required_linux_kernel_version, ) from lib.topolog import logger @@ -211,7 +211,7 @@ def setup_module(mod): * `mod`: module name """ # Required linux kernel version for this suite to run. - result = required_linux_kernel_version('4.15') + result = required_linux_kernel_version("4.15") if result is not True: pytest.skip("Kernel requirements are not met") @@ -693,10 +693,12 @@ def test_static_routes_associated_to_specific_vrfs_p0(request): ) step( - "Verify that static routes 1.x.x.x/32 and 1::x/128 appear " "in VRF BLUE_A table" + "Verify that static routes 1.x.x.x/32 and 1::x/128 appear " + "in VRF BLUE_A table" ) step( - "Verify that static routes 2.x.x.x/32 and 2::x/128 appear " "in VRF BLUE_B table" + "Verify that static routes 2.x.x.x/32 and 2::x/128 appear " + "in VRF BLUE_B table" ) for addr_type in ADDR_TYPES: diff --git a/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py b/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py index bb13d54019..cafe758209 100644 --- a/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py +++ b/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py @@ -78,7 +78,7 @@ from lib.common_config import ( get_frr_ipv6_linklocal, check_router_status, apply_raw_config, - required_linux_kernel_version + required_linux_kernel_version, ) from lib.topolog import logger @@ -143,7 +143,7 @@ def setup_module(mod): * `mod`: module name """ # Required linux kernel version for this suite to run. - result = required_linux_kernel_version('4.15') + result = required_linux_kernel_version("4.15") if result is not True: pytest.skip("Kernel requirements are not met") diff --git a/tests/topotests/bgp_recursive_route_ebgp_multi_hop/test_bgp_recursive_route_ebgp_multi_hop.py b/tests/topotests/bgp_recursive_route_ebgp_multi_hop/test_bgp_recursive_route_ebgp_multi_hop.py index fef6eb71dc..3af944473d 100644 --- a/tests/topotests/bgp_recursive_route_ebgp_multi_hop/test_bgp_recursive_route_ebgp_multi_hop.py +++ b/tests/topotests/bgp_recursive_route_ebgp_multi_hop/test_bgp_recursive_route_ebgp_multi_hop.py @@ -91,7 +91,7 @@ jsonFile = "{}/bgp_recursive_route_ebgp_multi_hop.json".format(CWD) try: with open(jsonFile, "r") as topoJson: topo = json.load(topoJson) -except IOError : +except IOError: logger.info("Could not read file:", jsonFile) # Global variables @@ -284,7 +284,9 @@ def test_recursive_routes_iBGP_peer_p1(request): input_dict_4, next_hop=topo["routers"]["r3"]["links"]["r1"][addr_type].split("/")[0], ) - assert result is True, "Testcase : Failed \n Error : {}".format(tc_name, result) + assert result is True, "Testcase : Failed \n Error : {}".format( + tc_name, result + ) step( "Configure a static routes for next hop IP on R2 via multiple" @@ -317,7 +319,9 @@ def test_recursive_routes_iBGP_peer_p1(request): } } result = create_static_routes(tgen, input_dict_3) - assert result is True, "Testcase : Failed \n Error : {}".format(tc_name, result) + assert result is True, "Testcase : Failed \n Error : {}".format( + tc_name, result + ) step("verify if redistributed routes are now installed in FIB of R2") result = verify_rib( @@ -328,7 +332,9 @@ def test_recursive_routes_iBGP_peer_p1(request): next_hop=topo["routers"]["r3"]["links"]["r1"][addr_type].split("/")[0], protocol="bgp", ) - assert result is True, "Testcase : Failed \n Error : {}".format(tc_name, result) + assert result is True, "Testcase : Failed \n Error : {}".format( + tc_name, result + ) step("Delete 1 route from static recursive for the next-hop IP") dut = "r2" @@ -345,7 +351,9 @@ def test_recursive_routes_iBGP_peer_p1(request): } } result = create_static_routes(tgen, input_dict_3) - assert result is True, "Testcase : Failed \n Error : {}".format(tc_name, result) + assert result is True, "Testcase : Failed \n Error : {}".format( + tc_name, result + ) step("Verify that redistributed routes are withdrawn from FIB of R2") result = verify_rib( @@ -355,7 +363,7 @@ def test_recursive_routes_iBGP_peer_p1(request): input_dict_4, next_hop=topo["routers"]["r3"]["links"]["r1"][addr_type].split("/")[0], protocol="bgp", - expected=False + expected=False, ) assert result is not True, "Testcase : Failed \n Error : {}".format( tc_name, result @@ -375,7 +383,9 @@ def test_recursive_routes_iBGP_peer_p1(request): } } result = create_static_routes(tgen, input_dict_3) - assert result is True, "Testcase : Failed \n Error : {}".format(tc_name, result) + assert result is True, "Testcase : Failed \n Error : {}".format( + tc_name, result + ) step("Verify that redistributed routes are again installed" "in FIB of R2") result = verify_rib( @@ -386,7 +396,9 @@ def test_recursive_routes_iBGP_peer_p1(request): next_hop=topo["routers"]["r3"]["links"]["r1"][addr_type].split("/")[0], protocol="bgp", ) - assert result is True, "Testcase : Failed \n Error : {}".format(tc_name, result) + assert result is True, "Testcase : Failed \n Error : {}".format( + tc_name, result + ) step("Configure static route with changed next-hop from same subnet") for addr_type in ADDR_TYPES: @@ -410,7 +422,9 @@ def test_recursive_routes_iBGP_peer_p1(request): } } result = create_static_routes(tgen, input_dict_4) - assert result is True, "Testcase : Failed \n Error : {}".format(tc_name, result) + assert result is True, "Testcase : Failed \n Error : {}".format( + tc_name, result + ) result = verify_rib(tgen, addr_type, "r1", input_dict_4, protocol="static") assert result is True, "Testcase {} : Failed \n Error : {}".format( @@ -455,7 +469,9 @@ def test_recursive_routes_iBGP_peer_p1(request): } } result = create_static_routes(tgen, input_dict_4) - assert result is True, "Testcase : Failed \n Error : {}".format(tc_name, result) + assert result is True, "Testcase : Failed \n Error : {}".format( + tc_name, result + ) result = verify_rib(tgen, addr_type, "r1", input_dict_4, protocol="static") assert result is True, "Testcase {} : Failed \n Error : {}".format( @@ -578,7 +594,7 @@ def test_next_hop_as_self_ip_p1(request): "r2", input_dict_4, next_hop=topo["routers"]["r2"]["links"]["r4"][addr_type].split("/")[0], - expected=False + expected=False, ) assert result is not True, "Testcase : Failed \n Error : {}".format( tc_name, result @@ -614,7 +630,9 @@ def test_next_hop_as_self_ip_p1(request): input_dict_4, next_hop=topo["routers"]["r2"]["links"]["r4"][addr_type].split("/")[0], ) - assert result is True, "Testcase : Failed \n Error : {}".format(tc_name, result) + assert result is True, "Testcase : Failed \n Error : {}".format( + tc_name, result + ) step("No shutdown interface on R2 which was shut in previous step") intf_r2_r4 = topo["routers"]["r2"]["links"]["r4"]["interface"] @@ -644,14 +662,16 @@ def test_next_hop_as_self_ip_p1(request): input_dict_4, next_hop=topo["routers"]["r2"]["links"]["r4"][addr_type].split("/")[0], ) - assert result is True, "Testcase : Failed \n Error : {}".format(tc_name, result) + assert result is True, "Testcase : Failed \n Error : {}".format( + tc_name, result + ) result = verify_rib( tgen, addr_type, "r2", input_dict_4, next_hop=topo["routers"]["r2"]["links"]["r4"][addr_type].split("/")[0], - expected=False + expected=False, ) assert result is not True, "Testcase : Failed \n Error : {}".format( tc_name, result @@ -907,7 +927,9 @@ def test_next_hop_with_recursive_lookup_p1(request): result = verify_bgp_convergence_from_running_config(tgen, expected=False) assert ( result is not True - ), "Testcase {} : Failed \n" "BGP is converged \n Error : {}".format(tc_name, result) + ), "Testcase {} : Failed \n" "BGP is converged \n Error : {}".format( + tc_name, result + ) logger.info("Expected behaviour: {}".format(result)) for addr_type in ADDR_TYPES: @@ -1018,7 +1040,7 @@ def test_next_hop_with_recursive_lookup_p1(request): input_dict, protocol="bgp", next_hop=next_hop, - expected=False + expected=False, ) assert result is not True, ( "Testcase {} : Failed \n " @@ -1083,7 +1105,9 @@ def test_next_hop_with_recursive_lookup_p1(request): result = verify_bgp_convergence_from_running_config(tgen, expected=False) assert ( result is not True - ), "Testcase {} : Failed \n" "BGP is converged \n Error : {}".format(tc_name, result) + ), "Testcase {} : Failed \n" "BGP is converged \n Error : {}".format( + tc_name, result + ) logger.info("Expected behaviour: {}".format(result)) for addr_type in ADDR_TYPES: @@ -1099,7 +1123,7 @@ def test_next_hop_with_recursive_lookup_p1(request): input_dict, protocol="bgp", next_hop=next_hop, - expected=False + expected=False, ) assert result is not True, ( "Testcase {} : Failed \n " @@ -1138,7 +1162,9 @@ def test_next_hop_with_recursive_lookup_p1(request): result = verify_bgp_convergence_from_running_config(tgen, expected=False) assert ( result is not True - ), "Testcase {} : Failed \n" "BGP is converged \n Error : {}".format(tc_name, result) + ), "Testcase {} : Failed \n" "BGP is converged \n Error : {}".format( + tc_name, result + ) logger.info("Expected behaviour: {}".format(result)) for addr_type in ADDR_TYPES: @@ -1154,7 +1180,7 @@ def test_next_hop_with_recursive_lookup_p1(request): input_dict, protocol="bgp", next_hop=next_hop, - expected=False + expected=False, ) assert result is not True, ( "Testcase {} : Failed \n " @@ -1237,7 +1263,9 @@ def test_BGP_path_attributes_default_values_p1(request): topo["routers"]["r3"]["links"]["r4"][addr_type].split("/")[0], ], ) - assert result is True, "Testcase : Failed \n Error : {}".format(tc_name, result) + assert result is True, "Testcase : Failed \n Error : {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: input_dict_4 = { @@ -1256,7 +1284,9 @@ def test_BGP_path_attributes_default_values_p1(request): rmap_name="rmap_pf", input_dict=input_dict_4, ) - assert result is True, "Testcase : Failed \n Error : {}".format(tc_name, result) + assert result is True, "Testcase : Failed \n Error : {}".format( + tc_name, result + ) step( "Configure a route-map to set below attribute value as 500" @@ -1358,7 +1388,9 @@ def test_BGP_path_attributes_default_values_p1(request): rmap_name="rmap_pf", input_dict=input_dict_4, ) - assert result is True, "Testcase : Failed \n Error : {}".format(tc_name, result) + assert result is True, "Testcase : Failed \n Error : {}".format( + tc_name, result + ) step("Remove the route-map from R4") input_dict_5 = { @@ -1432,7 +1464,9 @@ def test_BGP_path_attributes_default_values_p1(request): input_dict=input_dict_4, nexthop=None, ) - assert result is True, "Testcase : Failed \n Error : {}".format(tc_name, result) + assert result is True, "Testcase : Failed \n Error : {}".format( + tc_name, result + ) write_test_footer(tc_name) @@ -1670,7 +1704,7 @@ def test_BGP_peering_bw_loopback_and_physical_p1(request): input_dict_1, protocol="static", next_hop=topo["routers"]["r1"]["links"]["r3"][addr_type].split("/")[0], - expected=False + expected=False, ) assert result is not True, "Testcase {} : Failed \n Error : {}".format( tc_name, result @@ -1801,7 +1835,9 @@ def test_BGP_active_standby_preemption_and_ecmp_p1(request): topo["routers"]["r3"]["links"]["r4"][addr_type].split("/")[0], ], ) - assert result is True, "Testcase : Failed \n Error : {}".format(tc_name, result) + assert result is True, "Testcase : Failed \n Error : {}".format( + tc_name, result + ) step( "Configure a route-map to set as-path attribute and" @@ -2037,7 +2073,7 @@ def test_BGP_active_standby_preemption_and_ecmp_p1(request): topo["routers"]["r2"]["links"]["r4"][addr_type].split("/")[0], topo["routers"]["r3"]["links"]["r4"][addr_type].split("/")[0], ], - expected=False + expected=False, ) assert result is not True, "Testcase {} : Failed \n Error : {}".format( tc_name, result @@ -2084,7 +2120,7 @@ def test_BGP_active_standby_preemption_and_ecmp_p1(request): topo["routers"]["r2"]["links"]["r4"][addr_type].split("/")[0], topo["routers"]["r3"]["links"]["r4"][addr_type].split("/")[0], ], - expected=False + expected=False, ) assert result is not True, "Testcase {} : Failed \n Error : {}".format( tc_name, result diff --git a/tests/topotests/bgp_suppress_fib/r1/bgpd.conf b/tests/topotests/bgp_suppress_fib/r1/bgpd.conf new file mode 100644 index 0000000000..69c563d37c --- /dev/null +++ b/tests/topotests/bgp_suppress_fib/r1/bgpd.conf @@ -0,0 +1,15 @@ +! exit1 +router bgp 1 + no bgp ebgp-requires-policy + neighbor 10.0.0.2 remote-as 2 + + address-family ipv4 unicast + redistribute static + neighbor 10.0.0.2 route-map rmap out + exit-address-family + +ip prefix-list plist seq 5 permit any + +route-map rmap permit 1 + match ip address prefix-list plist +! diff --git a/tests/topotests/bgp_suppress_fib/r1/zebra.conf b/tests/topotests/bgp_suppress_fib/r1/zebra.conf new file mode 100644 index 0000000000..7b442164ff --- /dev/null +++ b/tests/topotests/bgp_suppress_fib/r1/zebra.conf @@ -0,0 +1,9 @@ +! exit1 +interface r1-eth0 + ip address 10.0.0.1/30 +! +ip forwarding +! +ip route 40.0.0.0/8 blackhole +ip route 50.0.0.0/8 blackhole +! diff --git a/tests/topotests/bgp_suppress_fib/r2/bgpd.conf b/tests/topotests/bgp_suppress_fib/r2/bgpd.conf new file mode 100644 index 0000000000..8321c915e3 --- /dev/null +++ b/tests/topotests/bgp_suppress_fib/r2/bgpd.conf @@ -0,0 +1,6 @@ +! +router bgp 2 + no bgp ebgp-requires-policy + bgp suppress-fib-pending + neighbor 10.0.0.1 remote-as 1 + neighbor 10.0.0.10 remote-as 3 diff --git a/tests/topotests/bgp_suppress_fib/r2/zebra.conf b/tests/topotests/bgp_suppress_fib/r2/zebra.conf new file mode 100644 index 0000000000..443fffc703 --- /dev/null +++ b/tests/topotests/bgp_suppress_fib/r2/zebra.conf @@ -0,0 +1,13 @@ +! +interface r2-eth0 + ip address 10.0.0.2/30 +! +interface r2-eth1 + ip address 10.0.0.9/30 + +access-list access seq 5 permit 40.0.0.0/8 + +route-map LIMIT permit 10 + match ip address access + +ip protocol bgp route-map LIMIT diff --git a/tests/topotests/bgp_suppress_fib/r3/bgpd.conf b/tests/topotests/bgp_suppress_fib/r3/bgpd.conf new file mode 100644 index 0000000000..11715d45d7 --- /dev/null +++ b/tests/topotests/bgp_suppress_fib/r3/bgpd.conf @@ -0,0 +1,9 @@ +! +router bgp 3 + no bgp ebgp-requires-policy + neighbor 10.0.0.9 remote-as 2 + +route-map rmap permit 1 + match ip address prefix-list plist + ! +! diff --git a/tests/topotests/bgp_suppress_fib/r3/v4_route.json b/tests/topotests/bgp_suppress_fib/r3/v4_route.json new file mode 100644 index 0000000000..19294eb492 --- /dev/null +++ b/tests/topotests/bgp_suppress_fib/r3/v4_route.json @@ -0,0 +1,29 @@ +{ + "40.0.0.0\/8":[ + { + "prefix":"40.0.0.0\/8", + "protocol":"bgp", + "selected":true, + "destSelected":true, + "distance":20, + "metric":0, + "installed":true, + "table":254, + "internalStatus":16, + "internalFlags":8, + "internalNextHopNum":1, + "internalNextHopActiveNum":1, + "nexthops":[ + { + "flags":3, + "fib":true, + "ip":"10.0.0.9", + "afi":"ipv4", + "interfaceIndex":2, + "interfaceName":"r3-eth0", + "active":true + } + ] + } + ] +} diff --git a/tests/topotests/bgp_suppress_fib/r3/v4_route2.json b/tests/topotests/bgp_suppress_fib/r3/v4_route2.json new file mode 100644 index 0000000000..a35d49e9e8 --- /dev/null +++ b/tests/topotests/bgp_suppress_fib/r3/v4_route2.json @@ -0,0 +1,4 @@ +{ + "0.0.0.0\/0":[ + ] +} diff --git a/tests/topotests/bgp_suppress_fib/r3/zebra.conf b/tests/topotests/bgp_suppress_fib/r3/zebra.conf new file mode 100644 index 0000000000..793b043a7b --- /dev/null +++ b/tests/topotests/bgp_suppress_fib/r3/zebra.conf @@ -0,0 +1,6 @@ +! +interface r3-eth0 + ip address 10.0.0.10/30 +! +ip forwarding +! diff --git a/tests/topotests/bgp_suppress_fib/test_bgp_suppress_fib.py b/tests/topotests/bgp_suppress_fib/test_bgp_suppress_fib.py new file mode 100644 index 0000000000..cf8be5f44f --- /dev/null +++ b/tests/topotests/bgp_suppress_fib/test_bgp_suppress_fib.py @@ -0,0 +1,119 @@ +#!/usr/bin/env python + +# +# test_bgp_suppress_fib.py +# +# Copyright (c) 2019 by +# +# Permission to use, copy, modify, and/or distribute this software +# for any purpose with or without fee is hereby granted, provided +# that the above copyright notice and this permission notice appear +# in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY +# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. +# + +""" +""" + +import os +import sys +import json +import time +import pytest +from functools import partial +from time import sleep + +CWD = os.path.dirname(os.path.realpath(__file__)) +sys.path.append(os.path.join(CWD, "../")) + +# pylint: disable=C0413 +from lib import topotest +from lib.topogen import Topogen, TopoRouter, get_topogen +from lib.topolog import logger +from mininet.topo import Topo + + +class TemplateTopo(Topo): + def build(self, *_args, **_opts): + tgen = get_topogen(self) + + for routern in range(1, 4): + tgen.add_router("r{}".format(routern)) + + switch = tgen.add_switch("s1") + switch.add_link(tgen.gears["r1"]) + switch.add_link(tgen.gears["r2"]) + + switch = tgen.add_switch("s2") + switch.add_link(tgen.gears["r2"]) + switch.add_link(tgen.gears["r3"]) + +def setup_module(mod): + tgen = Topogen(TemplateTopo, mod.__name__) + tgen.start_topology() + + router_list = tgen.routers() + + for i, (rname, router) in enumerate(router_list.items(), 1): + router.load_config( + TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname)) + ) + router.load_config( + TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname)) + ) + + tgen.start_router() + + +def teardown_module(mod): + tgen = get_topogen() + tgen.stop_topology() + + +def test_bgp_route(): + tgen = get_topogen() + + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + r3 = tgen.gears["r3"] + + sleep(5) + + json_file = "{}/r3/v4_route.json".format(CWD) + expected = json.loads(open(json_file).read()) + + test_func = partial( + topotest.router_json_cmp, + r3, + "show ip route 40.0.0.0 json", + expected, + ) + _, result = topotest.run_and_expect(test_func, None, count=2, wait=0.5) + assertmsg = '"r3" JSON output mismatches' + assert result is None, assertmsg + + json_file = "{}/r3/v4_route2.json".format(CWD) + expected = json.loads(open(json_file).read()) + + test_func = partial( + topotest.router_json_cmp, + r3, + "show ip route 50.0.0.0 json", + expected, + ) + _, result = topotest.run_and_expect(test_func, None, count=3, wait=0.5) + assertmsg = '"r3" JSON output mismatches' + assert result is None, assertmsg + +if __name__ == "__main__": + args = ["-s"] + sys.argv[1:] + sys.exit(pytest.main(args)) diff --git a/tests/topotests/bgp_update_delay/test_bgp_update_delay.py b/tests/topotests/bgp_update_delay/test_bgp_update_delay.py index 4de7184c8e..71bd58bf73 100644 --- a/tests/topotests/bgp_update_delay/test_bgp_update_delay.py +++ b/tests/topotests/bgp_update_delay/test_bgp_update_delay.py @@ -149,22 +149,21 @@ def test_bgp_update_delay(): def _bgp_check_update_delay_in_progress(router): output = json.loads(router.vtysh_cmd("show ip bgp sum json")) - expected = {"ipv4Unicast": {"updateDelayInProgress":True}} + expected = {"ipv4Unicast": {"updateDelayInProgress": True}} return topotest.json_cmp(output, expected) def _bgp_check_route_install(router): output = json.loads(router.vtysh_cmd("show ip route 172.16.253.254/32 json")) - expected = {"172.16.253.254/32": [ {"protocol": "bgp"}]} + expected = {"172.16.253.254/32": [{"protocol": "bgp"}]} return topotest.json_cmp(output, expected) def _bgp_check_update_delay_and_wait(router): output = json.loads(router.vtysh_cmd("show ip bgp sum json")) expected = { - "ipv4Unicast": { - "updateDelayLimit": 20, - "updateDelayEstablishWait": 10}} + "ipv4Unicast": {"updateDelayLimit": 20, "updateDelayEstablishWait": 10} + } return topotest.json_cmp(output, expected) @@ -177,14 +176,11 @@ def test_bgp_update_delay(): def _bgp_check_vrf_update_delay_and_wait(router): output = json.loads(router.vtysh_cmd("show ip bgp vrf vrf1 sum json")) expected = { - "ipv4Unicast": { - "updateDelayLimit": 20, - "updateDelayEstablishWait": 10}} - + "ipv4Unicast": {"updateDelayLimit": 20, "updateDelayEstablishWait": 10} + } return topotest.json_cmp(output, expected) - # Check r2 initial convergence in default table test_func = functools.partial(_bgp_converge, router2) success, result = topotest.run_and_expect(test_func, None, count=30, wait=1) @@ -198,7 +194,7 @@ def test_bgp_update_delay(): router bgp 65002 update-delay 20 """ - ) + ) # Shutdown peering on r1 toward r2 so that delay timers can be exercised router1.vtysh_cmd( @@ -207,7 +203,7 @@ def test_bgp_update_delay(): router bgp 65001 neighbor 192.168.255.1 shut """ - ) + ) # Clear bgp neighbors on r2 and then check for the 'in progress' indicator router2.vtysh_cmd("""clear ip bgp *""") @@ -215,13 +211,17 @@ def test_bgp_update_delay(): test_func = functools.partial(_bgp_check_update_delay_in_progress, router2) success, result = topotest.run_and_expect(test_func, None, count=30, wait=1) - assert result is None, 'Failed to set update-delay max-delay timer "{}"'.format(router2) + assert result is None, 'Failed to set update-delay max-delay timer "{}"'.format( + router2 + ) # Check that r2 only installs route learned from r4 after the max-delay timer expires test_func = functools.partial(_bgp_check_route_install, router2) success, result = topotest.run_and_expect(test_func, None, count=30, wait=1) - assert result is None, 'Failed to install route after update-delay "{}"'.format(router2) + assert result is None, 'Failed to install route after update-delay "{}"'.format( + router2 + ) # Define update-delay with max-delay and estabish-wait and check json output showing set router2.vtysh_cmd( @@ -230,12 +230,14 @@ def test_bgp_update_delay(): router bgp 65002 update-delay 20 10 """ - ) + ) test_func = functools.partial(_bgp_check_update_delay_and_wait, router2) success, result = topotest.run_and_expect(test_func, None, count=30, wait=1) - assert result is None, 'Failed to set max-delay and establish-weight timers in "{}"'.format(router2) + assert ( + result is None + ), 'Failed to set max-delay and establish-weight timers in "{}"'.format(router2) # Define update-delay with max-delay and estabish-wait and check json output showing set router2.vtysh_cmd("""clear ip bgp *""") @@ -243,7 +245,11 @@ def test_bgp_update_delay(): test_func = functools.partial(_bgp_check_route_install, router3) success, result = topotest.run_and_expect(test_func, None, count=30, wait=1) - assert result is None, 'Failed to installed advertised route after establish-wait timer espired "{}"'.format(router2) + assert ( + result is None + ), 'Failed to installed advertised route after establish-wait timer espired "{}"'.format( + router2 + ) # Remove update-delay timer on r2 to verify that it goes back to normal behavior router2.vtysh_cmd( @@ -252,7 +258,7 @@ def test_bgp_update_delay(): router bgp 65002 no update-delay """ - ) + ) # Clear neighbors on r2 and check that route install time on r2 does not delay router2.vtysh_cmd("""clear ip bgp *""") @@ -260,7 +266,9 @@ def test_bgp_update_delay(): test_func = functools.partial(_bgp_check_route_install, router2) success, result = topotest.run_and_expect(test_func, None, count=30, wait=1) - assert result is None, 'Failed to remove update-delay delay timing "{}"'.format(router2) + assert result is None, 'Failed to remove update-delay delay timing "{}"'.format( + router2 + ) # Define global bgp update-delay with max-delay and establish-wait on r2 router2.vtysh_cmd( @@ -268,13 +276,15 @@ def test_bgp_update_delay(): configure terminal bgp update-delay 20 10 """ - ) + ) # Check that r2 default instance and vrf1 have the max-delay and establish set test_func = functools.partial(_bgp_check_update_delay_and_wait, router2) success, result = topotest.run_and_expect(test_func, None, count=30, wait=1) - assert result is None, 'Failed to set update-delay in default instance "{}"'.format(router2) + assert result is None, 'Failed to set update-delay in default instance "{}"'.format( + router2 + ) test_func = functools.partial(_bgp_check_vrf_update_delay_and_wait, router2) success, result = topotest.run_and_expect(test_func, None, count=30, wait=1) @@ -287,7 +297,11 @@ def test_bgp_update_delay(): test_func = functools.partial(_bgp_check_route_install, router3) success, result = topotest.run_and_expect(test_func, None, count=30, wait=1) - assert result is None, 'Failed to installed advertised route after establish-wait timer espired "{}"'.format(router2) + assert ( + result is None + ), 'Failed to installed advertised route after establish-wait timer espired "{}"'.format( + router2 + ) if __name__ == "__main__": diff --git a/tests/topotests/bgp_vrf_dynamic_route_leak/test_bgp_vrf_dynamic_route_leak_topo1.py b/tests/topotests/bgp_vrf_dynamic_route_leak/test_bgp_vrf_dynamic_route_leak_topo1.py index 1947548b3e..63db393178 100644 --- a/tests/topotests/bgp_vrf_dynamic_route_leak/test_bgp_vrf_dynamic_route_leak_topo1.py +++ b/tests/topotests/bgp_vrf_dynamic_route_leak/test_bgp_vrf_dynamic_route_leak_topo1.py @@ -40,8 +40,8 @@ import platform # Save the Current Working Directory to find configuration files. CWD = os.path.dirname(os.path.realpath(__file__)) -sys.path.append(os.path.join(CWD, '../')) -sys.path.append(os.path.join(CWD, '../lib/')) +sys.path.append(os.path.join(CWD, "../")) +sys.path.append(os.path.join(CWD, "../lib/")) # Required to instantiate the topology builder class. @@ -52,20 +52,32 @@ from lib.topotest import version_cmp from mininet.topo import Topo from lib.common_config import ( - start_topology, write_test_header, check_address_types, - write_test_footer, reset_config_on_routers, - verify_rib, step, create_route_maps, - shutdown_bringup_interface, create_static_routes, - create_prefix_lists, create_bgp_community_lists, + start_topology, + write_test_header, + check_address_types, + write_test_footer, + reset_config_on_routers, + verify_rib, + step, + create_route_maps, + shutdown_bringup_interface, + create_static_routes, + create_prefix_lists, + create_bgp_community_lists, create_interface_in_kernel, - check_router_status, verify_cli_json, - get_frr_ipv6_linklocal, verify_fib_routes + check_router_status, + verify_cli_json, + get_frr_ipv6_linklocal, + verify_fib_routes, ) from lib.topolog import logger from lib.bgp import ( - verify_bgp_convergence, create_router_bgp, - clear_bgp, verify_bgp_community, verify_bgp_rib + verify_bgp_convergence, + create_router_bgp, + clear_bgp, + verify_bgp_community, + verify_bgp_rib, ) from lib.topojson import build_topo_from_json, build_config_from_json @@ -99,10 +111,18 @@ NETWORK4_3 = {"ipv4": "50.50.50.5/32", "ipv6": "50:50::5/128"} NETWORK4_4 = {"ipv4": "50.50.50.50/32", "ipv6": "50:50::50/128"} NEXT_HOP_IP = {"ipv4": "Null0", "ipv6": "Null0"} -LOOPBACK_1 = {"ipv4": "10.0.0.7/24", "ipv6": "fd00:0:0:1::7/64", - "ipv4_mask": "255.255.255.0", "ipv6_mask": None} -LOOPBACK_2 = {"ipv4": "10.0.0.16/24", "ipv6": "fd00:0:0:3::5/64", - "ipv4_mask": "255.255.255.0", "ipv6_mask": None} +LOOPBACK_1 = { + "ipv4": "10.0.0.7/24", + "ipv6": "fd00:0:0:1::7/64", + "ipv4_mask": "255.255.255.0", + "ipv6_mask": None, +} +LOOPBACK_2 = { + "ipv4": "10.0.0.16/24", + "ipv6": "fd00:0:0:3::5/64", + "ipv4_mask": "255.255.255.0", + "ipv6_mask": None, +} PREFERRED_NEXT_HOP = "global" @@ -144,10 +164,11 @@ def setup_module(mod): start_topology(tgen) # Run these tests for kernel version 4.19 or above - if version_cmp(platform.release(), '4.19') < 0: - error_msg = ('BGP vrf dynamic route leak tests will not run ' - '(have kernel "{}", but it requires >= 4.19)'.\ - format(platform.release())) + if version_cmp(platform.release(), "4.19") < 0: + error_msg = ( + "BGP vrf dynamic route leak tests will not run " + '(have kernel "{}", but it requires >= 4.19)'.format(platform.release()) + ) pytest.skip(error_msg) # Creating configuration from JSON @@ -158,8 +179,9 @@ def setup_module(mod): ADDR_TYPES = check_address_types() BGP_CONVERGENCE = verify_bgp_convergence(tgen, topo) - assert BGP_CONVERGENCE is True, "setup_module : Failed \n Error: {}". \ - format(BGP_CONVERGENCE) + assert BGP_CONVERGENCE is True, "setup_module : Failed \n Error: {}".format( + BGP_CONVERGENCE + ) logger.info("Running setup_module() done") @@ -174,16 +196,19 @@ def teardown_module(): # Stop toplogy and Remove tmp files tgen.stop_topology() - logger.info("Testsuite end time: {}". - format(time.asctime(time.localtime(time.time())))) + logger.info( + "Testsuite end time: {}".format(time.asctime(time.localtime(time.time()))) + ) logger.info("=" * 40) + ##################################################### # # Local APIs # ##################################################### + def disable_route_map_to_prefer_global_next_hop(tgen, topo): """ This API is to remove prefer global route-map applied on neighbors @@ -202,8 +227,7 @@ def disable_route_map_to_prefer_global_next_hop(tgen, topo): logger.info("Remove prefer-global rmap applied on neighbors") input_dict = { "r1": { - "bgp": - [ + "bgp": [ { "local_as": "100", "vrf": "ISR", @@ -214,18 +238,20 @@ def disable_route_map_to_prefer_global_next_hop(tgen, topo): "r2": { "dest_link": { "r1-link1": { - "route_maps": [{ - "name": "rmap_global", - "direction": "in", - "delete": True - }] + "route_maps": [ + { + "name": "rmap_global", + "direction": "in", + "delete": True, + } + ] } } } } } } - } + }, }, { "local_as": "100", @@ -236,18 +262,20 @@ def disable_route_map_to_prefer_global_next_hop(tgen, topo): "r3": { "dest_link": { "r1-link1": { - "route_maps": [{ - "name": "rmap_global", - "direction": "in", - "delete": True - }] + "route_maps": [ + { + "name": "rmap_global", + "direction": "in", + "delete": True, + } + ] } } } } } } - } + }, }, { "local_as": "100", @@ -258,24 +286,25 @@ def disable_route_map_to_prefer_global_next_hop(tgen, topo): "r4": { "dest_link": { "r1-link1": { - "route_maps": [{ - "name": "rmap_global", - "direction": "in", - "delete": True - }] + "route_maps": [ + { + "name": "rmap_global", + "direction": "in", + "delete": True, + } + ] } } } } } } - } - } + }, + }, ] }, "r2": { - "bgp": - [ + "bgp": [ { "local_as": "100", "vrf": "ISR", @@ -286,18 +315,20 @@ def disable_route_map_to_prefer_global_next_hop(tgen, topo): "r1": { "dest_link": { "r2-link1": { - "route_maps": [{ - "name": "rmap_global", - "direction": "in", - "delete": True - }] + "route_maps": [ + { + "name": "rmap_global", + "direction": "in", + "delete": True, + } + ] } } } } } } - } + }, }, { "local_as": "100", @@ -308,18 +339,20 @@ def disable_route_map_to_prefer_global_next_hop(tgen, topo): "r3": { "dest_link": { "r2-link1": { - "route_maps": [{ - "name": "rmap_global", - "direction": "in", - "delete": True - }] + "route_maps": [ + { + "name": "rmap_global", + "direction": "in", + "delete": True, + } + ] } } } } } } - } + }, }, { "local_as": "100", @@ -330,24 +363,25 @@ def disable_route_map_to_prefer_global_next_hop(tgen, topo): "r4": { "dest_link": { "r2-link1": { - "route_maps": [{ - "name": "rmap_global", - "direction": "in", - "delete": True - }] + "route_maps": [ + { + "name": "rmap_global", + "direction": "in", + "delete": True, + } + ] } } } } } } - } - } + }, + }, ] }, "r3": { - "bgp": - [ + "bgp": [ { "local_as": "300", "address_family": { @@ -357,18 +391,20 @@ def disable_route_map_to_prefer_global_next_hop(tgen, topo): "r1": { "dest_link": { "r3-link1": { - "route_maps": [{ - "name": "rmap_global", - "direction": "in", - "delete": True - }] + "route_maps": [ + { + "name": "rmap_global", + "direction": "in", + "delete": True, + } + ] } } } } } } - } + }, }, { "local_as": "300", @@ -379,24 +415,25 @@ def disable_route_map_to_prefer_global_next_hop(tgen, topo): "r2": { "dest_link": { "r3-link1": { - "route_maps": [{ - "name": "rmap_global", - "direction": "in", - "delete": True - }] + "route_maps": [ + { + "name": "rmap_global", + "direction": "in", + "delete": True, + } + ] } } } } } } - } - } + }, + }, ] }, "r4": { - "bgp": - [ + "bgp": [ { "local_as": "400", "address_family": { @@ -406,18 +443,20 @@ def disable_route_map_to_prefer_global_next_hop(tgen, topo): "r1": { "dest_link": { "r4-link1": { - "route_maps": [{ - "name": "rmap_global", - "direction": "in", - "delete": True - }] + "route_maps": [ + { + "name": "rmap_global", + "direction": "in", + "delete": True, + } + ] } } } } } } - } + }, }, { "local_as": "400", @@ -428,26 +467,27 @@ def disable_route_map_to_prefer_global_next_hop(tgen, topo): "r2": { "dest_link": { "r4-link1": { - "route_maps": [{ - "name": "rmap_global", - "direction": "in", - "delete": True - }] + "route_maps": [ + { + "name": "rmap_global", + "direction": "in", + "delete": True, + } + ] } } } } } } - } - } + }, + }, ] - } + }, } result = create_router_bgp(tgen, topo, input_dict) - assert result is True, "Testcase {} :Failed \n Error: {}". \ - format(tc_name, result) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) return True @@ -458,6 +498,7 @@ def disable_route_map_to_prefer_global_next_hop(tgen, topo): # ##################################################### + def test_dynamic_imported_routes_advertised_to_iBGP_peer_p0(request): """ TC5_FUNC_5: @@ -475,10 +516,11 @@ def test_dynamic_imported_routes_advertised_to_iBGP_peer_p0(request): for addr_type in ADDR_TYPES: - step("Redistribute configured static routes into BGP process" - " on R1 and R3/R4") + step( + "Redistribute configured static routes into BGP process" " on R1 and R3/R4" + ) - input_dict_1={} + input_dict_1 = {} DUT = ["r1", "r3", "r4"] VRFS = ["default", "default", "default"] AS_NUM = [100, 300, 400] @@ -493,47 +535,48 @@ def test_dynamic_imported_routes_advertised_to_iBGP_peer_p0(request): "vrf": vrf, "address_family": { addr_type: { - "unicast": { - "redistribute": [{ - "redist_type": "static" - }] - } + "unicast": {"redistribute": [{"redist_type": "static"}]} } - } - }) + }, + } + ) result = create_router_bgp(tgen, topo, input_dict_1) - assert result is True, "Testcase {} :Failed \n Error: {}". \ - format(tc_name, result) + assert result is True, "Testcase {} :Failed \n Error: {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: - step("Verify that R1 receives BGP routes from R3 and R4 in " - "vrf default.") + step("Verify that R1 receives BGP routes from R3 and R4 in " "vrf default.") input_routes_r3 = { "r3": { - "static_routes": [{ - "network": [ - NETWORK3_1[addr_type], \ - NETWORK3_2[addr_type], \ - NETWORK3_3[addr_type], \ - NETWORK3_4[addr_type] - ] - }] + "static_routes": [ + { + "network": [ + NETWORK3_1[addr_type], + NETWORK3_2[addr_type], + NETWORK3_3[addr_type], + NETWORK3_4[addr_type], + ] + } + ] } } input_routes_r4 = { "r4": { - "static_routes": [{ - "network": [ - NETWORK4_1[addr_type], \ - NETWORK4_2[addr_type], \ - NETWORK4_3[addr_type], \ - NETWORK4_4[addr_type] - ] - }] + "static_routes": [ + { + "network": [ + NETWORK4_1[addr_type], + NETWORK4_2[addr_type], + NETWORK4_3[addr_type], + NETWORK4_4[addr_type], + ] + } + ] } } @@ -542,20 +585,20 @@ def test_dynamic_imported_routes_advertised_to_iBGP_peer_p0(request): for dut, routes in zip(DUT, INPUT_DICT): result = verify_bgp_rib(tgen, addr_type, dut, routes) - assert result is True, \ - "Testcase {} : Failed \n Error {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) result = verify_fib_routes(tgen, addr_type, dut, routes) - assert result is True, \ - "Testcase {} : Failed \n Error {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: step("Import from default vrf into vrf ISR on R1") - input_dict_isr={} + input_dict_isr = {} DUT = ["r1", "r2"] VRFS = ["ISR", "ISR"] AS_NUM = [100, 100] @@ -569,50 +612,52 @@ def test_dynamic_imported_routes_advertised_to_iBGP_peer_p0(request): "local_as": as_num, "vrf": vrf, "address_family": { - addr_type: { - "unicast": { - "import": { - "vrf": "default" - } - } - } - } - }) + addr_type: {"unicast": {"import": {"vrf": "default"}}} + }, + } + ) result = create_router_bgp(tgen, topo, input_dict_isr) - assert result is True, "Testcase {} : Failed \n Error: {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: - step("Verify that default vrf's imported routes are installed " - "in RIB/FIB of vrf ISR on R1:") + step( + "Verify that default vrf's imported routes are installed " + "in RIB/FIB of vrf ISR on R1:" + ) input_routes_r3 = { "r3": { - "static_routes": [{ - "network": [ - NETWORK3_1[addr_type], \ - NETWORK3_2[addr_type], \ - NETWORK3_3[addr_type], \ - NETWORK3_4[addr_type] - ], - "vrf": "ISR" - }] + "static_routes": [ + { + "network": [ + NETWORK3_1[addr_type], + NETWORK3_2[addr_type], + NETWORK3_3[addr_type], + NETWORK3_4[addr_type], + ], + "vrf": "ISR", + } + ] } } input_routes_r4 = { "r4": { - "static_routes": [{ - "network": [ - NETWORK4_1[addr_type], \ - NETWORK4_2[addr_type], \ - NETWORK4_3[addr_type], \ - NETWORK4_4[addr_type] - ], - "vrf": "ISR" - }] + "static_routes": [ + { + "network": [ + NETWORK4_1[addr_type], + NETWORK4_2[addr_type], + NETWORK4_3[addr_type], + NETWORK4_4[addr_type], + ], + "vrf": "ISR", + } + ] } } @@ -620,87 +665,101 @@ def test_dynamic_imported_routes_advertised_to_iBGP_peer_p0(request): for routes in INPUT_DICT_VRF: result = verify_bgp_rib(tgen, addr_type, "r1", routes) - assert result is True, \ - "Testcase {} : Failed \n Error {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) - result = verify_fib_routes(tgen, addr_type, "r1", routes) - assert result is True, \ - "Testcase {} : Failed \n Error {}". \ - format(tc_name, result) + result = verify_fib_routes(tgen, addr_type, "r1", routes) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) intf_r2_r1 = topo["routers"]["r2"]["links"]["r1-link1"] for addr_type in ADDR_TYPES: - step("Create a loopback10 interface on R1 with below IP address and " - "associate with vrf ISR:") + step( + "Create a loopback10 interface on R1 with below IP address and " + "associate with vrf ISR:" + ) - create_interface_in_kernel(tgen, "r1", "loopback2", - LOOPBACK_2[addr_type], - "ISR", - LOOPBACK_2["{}_mask".\ - format(addr_type)]) + create_interface_in_kernel( + tgen, + "r1", + "loopback2", + LOOPBACK_2[addr_type], + "ISR", + LOOPBACK_2["{}_mask".format(addr_type)], + ) for addr_type in ADDR_TYPES: - step("On router R1 Change the next-hop of static routes in vrf " - "ISR to LOOPBACK_1") + step( + "On router R1 Change the next-hop of static routes in vrf " + "ISR to LOOPBACK_1" + ) - input_routes_r1= { + input_routes_r1 = { "r1": { - "static_routes":[ + "static_routes": [ { "network": [NETWORK1_3[addr_type], NETWORK1_4[addr_type]], - "next_hop":"Null0", - "delete": True + "next_hop": "Null0", + "delete": True, } ] } } result = create_static_routes(tgen, input_routes_r1) - assert result is True, "Testcase {} :Failed \n Error: {}". \ - format(tc_name, result) + assert result is True, "Testcase {} :Failed \n Error: {}".format( + tc_name, result + ) - input_routes_r1= { + input_routes_r1 = { "r1": { - "static_routes":[ + "static_routes": [ { "network": [NETWORK1_3[addr_type], NETWORK1_4[addr_type]], - "next_hop": (intf_r2_r1[addr_type]).split("/")[0] + "next_hop": (intf_r2_r1[addr_type]).split("/")[0], } ] } } result = create_static_routes(tgen, input_routes_r1) - assert result is True, "Testcase {} :Failed \n Error: {}". \ - format(tc_name, result) + assert result is True, "Testcase {} :Failed \n Error: {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: - step("Verify that, though R1 originating BGP routes with next-hop" + step( + "Verify that, though R1 originating BGP routes with next-hop" " 24.1.1.2/24::1:2, which is local to R2(but in default vrf)" - ", R2 must receives and install all routes from R1 in vrf ISR.") - step("Verify on R2, that it now rejects 10.10.10.x routes originated " - "from R1. As next-hop IP is local to R2's vrf ISR.") + ", R2 must receives and install all routes from R1 in vrf ISR." + ) + step( + "Verify on R2, that it now rejects 10.10.10.x routes originated " + "from R1. As next-hop IP is local to R2's vrf ISR." + ) - input_routes_r1= { + input_routes_r1 = { "r1": { - "static_routes":[ + "static_routes": [ { "network": [NETWORK1_3[addr_type], NETWORK1_4[addr_type]], - "vrf": "ISR" + "vrf": "ISR", } ] } } - result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1, - expected=False) - assert result is not True, ( - "Testcase {} : Failed \n Routes are still present \n Error {}". \ - format(tc_name, result)) + result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1, expected=False) + assert ( + result is not True + ), "Testcase {} : Failed \n Routes are still present \n Error {}".format( + tc_name, result + ) write_test_footer(tc_name) @@ -722,71 +781,77 @@ def test_dynamic_imported_matching_prefix_based_on_community_list_p0(request): for addr_type in ADDR_TYPES: - step("Configure route-map to set community attribute for a specific" - "prefix on R1 in vrf ISR") + step( + "Configure route-map to set community attribute for a specific" + "prefix on R1 in vrf ISR" + ) input_dict_pf = { "r1": { "prefix_lists": { addr_type: { - "pflist_ABC_{}".format(addr_type): [{ - "seqid": 10, - "network": NETWORK1_1[addr_type], - "action": "permit" - }] + "pflist_ABC_{}".format(addr_type): [ + { + "seqid": 10, + "network": NETWORK1_1[addr_type], + "action": "permit", + } + ] } } } } result = create_prefix_lists(tgen, input_dict_pf) assert result is True, "Testcase {} : Failed \n Error: {}".format( - tc_name, result) + tc_name, result + ) input_dict_cl = { "r1": { "bgp_community_lists": [ - { - "community_type": "expanded", - "action": "permit", - "name": "COMM", - "value": "100:100" + { + "community_type": "expanded", + "action": "permit", + "name": "COMM", + "value": "100:100", } ] } } result = create_bgp_community_lists(tgen, input_dict_cl) - assert result is True, 'Testcase {} : Failed \n Error: {}'.format( - tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) for addr_type in ADDR_TYPES: input_dict_rm = { "r1": { "route_maps": { - "rmap_XYZ_{}".format(addr_type): [{ - "action": "permit", - "match": { - addr_type: { - "prefix_lists": - "pflist_ABC_{}".format(addr_type) - } - }, - "set": { - "community": {"num": "100:100"} + "rmap_XYZ_{}".format(addr_type): [ + { + "action": "permit", + "match": { + addr_type: { + "prefix_lists": "pflist_ABC_{}".format(addr_type) + } + }, + "set": {"community": {"num": "100:100"}}, } - }] + ] } } } result = create_route_maps(tgen, input_dict_rm) - assert result is True, 'Testcase {} : Failed \n Error: {}'.format( - tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: - step("Apply this route-map on R1 to vrf ISR while redistributing the" - " prefixes into BGP") + step( + "Apply this route-map on R1 to vrf ISR while redistributing the" + " prefixes into BGP" + ) - input_dict_1={} + input_dict_1 = {} DUT = ["r1"] VRFS = ["ISR"] AS_NUM = [100] @@ -802,53 +867,58 @@ def test_dynamic_imported_matching_prefix_based_on_community_list_p0(request): "address_family": { addr_type: { "unicast": { - "redistribute": [{ - "redist_type": "static", + "redistribute": [ + { + "redist_type": "static", "attribute": { - "route-map" : "rmap_XYZ_{}".\ - format(addr_type) - } + "route-map": "rmap_XYZ_{}".format(addr_type) + }, } ] } } - } - }) + }, + } + ) result = create_router_bgp(tgen, topo, input_dict_1) - assert result is True, "Testcase {} :Failed \n Error: {}". \ - format(tc_name, result) + assert result is True, "Testcase {} :Failed \n Error: {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: - step("Configure another route-map for filtering the prefixes based on" - " community attribute while importing into default vrf") + step( + "Configure another route-map for filtering the prefixes based on" + " community attribute while importing into default vrf" + ) input_dict_rm = { "r1": { "route_maps": { - "rmap_IMP_{}".format(addr_type): [{ - "action": "permit", - "match": { - "community_list": {"id": "COMM"} - }, - "set": { - "community": {"num": "none"} + "rmap_IMP_{}".format(addr_type): [ + { + "action": "permit", + "match": {"community_list": {"id": "COMM"}}, + "set": {"community": {"num": "none"}}, } - }] + ] } } } result = create_route_maps(tgen, input_dict_rm) - assert result is True, 'Testcase {} : Failed \n Error: {}'.format( - tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: - step("Apply the route-map while Importing vrf ISR's prefixes into " - "default vrf on router R1:") + step( + "Apply the route-map while Importing vrf ISR's prefixes into " + "default vrf on router R1:" + ) - input_dict_isr={} + input_dict_isr = {} DUT = ["r1"] VRFS = ["default"] AS_NUM = [100] @@ -862,15 +932,10 @@ def test_dynamic_imported_matching_prefix_based_on_community_list_p0(request): "local_as": as_num, "vrf": vrf, "address_family": { - addr_type: { - "unicast": { - "import": { - "vrf": "ISR" - } - } - } - } - }) + addr_type: {"unicast": {"import": {"vrf": "ISR"}}} + }, + } + ) temp[dut]["bgp"].append( { @@ -884,50 +949,57 @@ def test_dynamic_imported_matching_prefix_based_on_community_list_p0(request): } } } - } - }) + }, + } + ) result = create_router_bgp(tgen, topo, input_dict_isr) - assert result is True, "Testcase {} : Failed \n Error: {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: - step("Verify on R1 that only prefixes with community value 100:100" + step( + "Verify on R1 that only prefixes with community value 100:100" "in vrf ISR are imported to vrf default. While importing, the" - " community value has been stripped off:") + " community value has been stripped off:" + ) input_routes_r1 = { "r1": { - "static_routes": [{ - "network": [ - NETWORK1_1[addr_type] - ], - "vrf": "default" - }] + "static_routes": [ + {"network": [NETWORK1_1[addr_type]], "vrf": "default"} + ] } } result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1) - assert result is True, \ - "Testcase {} : Failed \n Error {}". \ - format(tc_name, result) - - input_dict_comm = { - "community": "100:100" - } - - result = verify_bgp_community(tgen, addr_type, dut, [NETWORK1_1[addr_type]], - input_dict_comm, expected=False) - assert result is not True, ( - "Testcase {} : Failed \n Error: Commnunity is not stipped off, {}".format( - tc_name, result)) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) + + input_dict_comm = {"community": "100:100"} + + result = verify_bgp_community( + tgen, + addr_type, + dut, + [NETWORK1_1[addr_type]], + input_dict_comm, + expected=False, + ) + assert ( + result is not True + ), "Testcase {} : Failed \n Error: Commnunity is not stipped off, {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: step("Remove/re-add route-map XYZ from redistribution.") - input_dict_1={} + input_dict_1 = {} DUT = ["r1"] VRFS = ["ISR"] AS_NUM = [100] @@ -943,49 +1015,52 @@ def test_dynamic_imported_matching_prefix_based_on_community_list_p0(request): "address_family": { addr_type: { "unicast": { - "redistribute": [{ - "redist_type": "static", - "attribute": { - "route-map" : "rmap_XYZ_{}".\ - format(addr_type) - }, - "delete": True - }] + "redistribute": [ + { + "redist_type": "static", + "attribute": { + "route-map": "rmap_XYZ_{}".format(addr_type) + }, + "delete": True, + } + ] } } - } - }) + }, + } + ) result = create_router_bgp(tgen, topo, input_dict_1) - assert result is True, "Testcase {} :Failed \n Error: {}". \ - format(tc_name, result) + assert result is True, "Testcase {} :Failed \n Error: {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: - step("Verify that all the routes disappear from vrf default when " + step( + "Verify that all the routes disappear from vrf default when " "route-map is removed from redistribution, and appear again " - "when route-map is re-added to redistribution in vrf ISR.") + "when route-map is re-added to redistribution in vrf ISR." + ) input_routes_r1 = { "r1": { - "static_routes": [{ - "network": [ - NETWORK1_1[addr_type] - ], - "vrf": "default" - }] + "static_routes": [ + {"network": [NETWORK1_1[addr_type]], "vrf": "default"} + ] } } - result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1, - expected=False) - assert result is not True, ( - "Testcase {} : Failed \n Error : Routes are still present \n {}".\ - format(tc_name, result)) + result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1, expected=False) + assert ( + result is not True + ), "Testcase {} : Failed \n Error : Routes are still present \n {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: - input_dict_1={} + input_dict_1 = {} DUT = ["r1"] VRFS = ["ISR"] AS_NUM = [100] @@ -1001,45 +1076,45 @@ def test_dynamic_imported_matching_prefix_based_on_community_list_p0(request): "address_family": { addr_type: { "unicast": { - "redistribute": [{ - "redist_type": "static", - "attribute": { - "route-map" : "rmap_XYZ_{}".\ - format(addr_type) + "redistribute": [ + { + "redist_type": "static", + "attribute": { + "route-map": "rmap_XYZ_{}".format(addr_type) + }, } - }] + ] } } - } - }) + }, + } + ) result = create_router_bgp(tgen, topo, input_dict_1) - assert result is True, "Testcase {} :Failed \n Error: {}". \ - format(tc_name, result) + assert result is True, "Testcase {} :Failed \n Error: {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: input_routes_r1 = { "r1": { - "static_routes": [{ - "network": [ - NETWORK1_1[addr_type] - ], - "vrf": "default" - }] + "static_routes": [ + {"network": [NETWORK1_1[addr_type]], "vrf": "default"} + ] } } result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1) - assert result is True, \ - "Testcase {} : Failed \n Error {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: step("Remove/re-add route-map IMP form import statement.") - input_dict_isr={} + input_dict_isr = {} DUT = ["r1"] VRFS = ["default"] AS_NUM = [100] @@ -1053,15 +1128,10 @@ def test_dynamic_imported_matching_prefix_based_on_community_list_p0(request): "local_as": as_num, "vrf": vrf, "address_family": { - addr_type: { - "unicast": { - "import": { - "vrf": "ISR" - } - } - } - } - }) + addr_type: {"unicast": {"import": {"vrf": "ISR"}}} + }, + } + ) temp[dut]["bgp"].append( { @@ -1072,43 +1142,44 @@ def test_dynamic_imported_matching_prefix_based_on_community_list_p0(request): "unicast": { "import": { "vrf": "route-map rmap_IMP_{}".format(addr_type), - "delete": True + "delete": True, } } } - } - }) + }, + } + ) result = create_router_bgp(tgen, topo, input_dict_isr) - assert result is True, "Testcase {} : Failed \n Error: {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: - step("Verify that when route-map IMP is removed all the prefixes of" + step( + "Verify that when route-map IMP is removed all the prefixes of" " vrf ISR are imported to vrf default. However when route-map " "IMP is re-added only 11.11.11.1 and 11:11::1 (with community " - "value) are imported.") + "value) are imported." + ) input_routes_r1 = { "r1": { - "static_routes": [{ - "network": [ - NETWORK1_1[addr_type] - ], - "vrf": "default" - }] + "static_routes": [ + {"network": [NETWORK1_1[addr_type]], "vrf": "default"} + ] } } result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1) - assert result is True, \ - "Testcase {} : Failed \n Error {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: - input_dict_isr={} + input_dict_isr = {} DUT = ["r1"] VRFS = ["default"] AS_NUM = [100] @@ -1122,15 +1193,10 @@ def test_dynamic_imported_matching_prefix_based_on_community_list_p0(request): "local_as": as_num, "vrf": vrf, "address_family": { - addr_type: { - "unicast": { - "import": { - "vrf": "ISR" - } - } - } - } - }) + addr_type: {"unicast": {"import": {"vrf": "ISR"}}} + }, + } + ) temp[dut]["bgp"].append( { @@ -1144,30 +1210,29 @@ def test_dynamic_imported_matching_prefix_based_on_community_list_p0(request): } } } - } - }) + }, + } + ) result = create_router_bgp(tgen, topo, input_dict_isr) - assert result is True, "Testcase {} : Failed \n Error: {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: input_routes_r1 = { "r1": { - "static_routes": [{ - "network": [ - NETWORK1_1[addr_type] - ], - "vrf": "default" - }] + "static_routes": [ + {"network": [NETWORK1_1[addr_type]], "vrf": "default"} + ] } } result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1) - assert result is True, \ - "Testcase {} : Failed \n Error {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: @@ -1177,165 +1242,178 @@ def test_dynamic_imported_matching_prefix_based_on_community_list_p0(request): "r1": { "prefix_lists": { addr_type: { - "pflist_ABC_{}".format(addr_type): [{ - "seqid": 10, - "network": NETWORK1_1[addr_type], - "action": "permit", - "delete": True - }] + "pflist_ABC_{}".format(addr_type): [ + { + "seqid": 10, + "network": NETWORK1_1[addr_type], + "action": "permit", + "delete": True, + } + ] } } } } result = create_prefix_lists(tgen, input_dict_pf) assert result is True, "Testcase {} : Failed \n Error: {}".format( - tc_name, result) + tc_name, result + ) input_routes_r1 = { "r1": { - "static_routes": [{ - "network": [ - NETWORK1_1[addr_type] - ], - "vrf": "default" - }] + "static_routes": [ + {"network": [NETWORK1_1[addr_type]], "vrf": "default"} + ] } } - result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1, - expected=False) - assert result is not True, ( - "Testcase {} : Failed \n Error : Routes are still present \n {}".\ - format(tc_name, result)) + result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1, expected=False) + assert ( + result is not True + ), "Testcase {} : Failed \n Error : Routes are still present \n {}".format( + tc_name, result + ) - input_dict_pf["r1"]["prefix_lists"][addr_type]["pflist_ABC_{}".\ - format(addr_type)][0]["delete"]=False + input_dict_pf["r1"]["prefix_lists"][addr_type][ + "pflist_ABC_{}".format(addr_type) + ][0]["delete"] = False result = create_prefix_lists(tgen, input_dict_pf) assert result is True, "Testcase {} : Failed \n Error: {}".format( - tc_name, result) + tc_name, result + ) result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1) - assert result is True, \ - "Testcase {} : Failed \n Error {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) step("Delete/Re-add community-list COMM.") input_dict_cl = { "r1": { "bgp_community_lists": [ - { - "community_type": "expanded", - "action": "permit", - "name": "COMM", - "value": "100:100", - "delete": True + { + "community_type": "expanded", + "action": "permit", + "name": "COMM", + "value": "100:100", + "delete": True, } ] } } result = create_bgp_community_lists(tgen, input_dict_cl) - assert result is True, 'Testcase {} : Failed \n Error: {}'.format( - tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) - result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1, - expected=False) - assert result is not True, ( - "Testcase {} : Failed \n Error : Routes are still present \n {}".\ - format(tc_name, result)) + result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1, expected=False) + assert ( + result is not True + ), "Testcase {} : Failed \n Error : Routes are still present \n {}".format( + tc_name, result + ) - input_dict_cl["r1"]["bgp_community_lists"][0]["delete"]=False + input_dict_cl["r1"]["bgp_community_lists"][0]["delete"] = False result = create_bgp_community_lists(tgen, input_dict_cl) - assert result is True, 'Testcase {} : Failed \n Error: {}'.format( - tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1) - assert result is True, \ - "Testcase {} : Failed \n Error {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) step("Delete/Re-add route-map XYZ.") input_dict_rm = { "r1": { "route_maps": { - "rmap_XYZ_{}".format(addr_type): [{ - "action": "permit", - "match": { - addr_type: { - "prefix_lists": - "pflist_ABC_{}".format(addr_type) - } - }, - "set": { - "community": {"num": "100:100"} - }, - "delete": True - }] + "rmap_XYZ_{}".format(addr_type): [ + { + "action": "permit", + "match": { + addr_type: { + "prefix_lists": "pflist_ABC_{}".format(addr_type) + } + }, + "set": {"community": {"num": "100:100"}}, + "delete": True, + } + ] } } } result = create_route_maps(tgen, input_dict_rm) - assert result is True, 'Testcase {} : Failed \n Error: {}'.format( - tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) - result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1, - expected=False) - assert result is not True, ( - "Testcase {} : Failed \n Error : Routes are still present \n {}".\ - format(tc_name, result)) + result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1, expected=False) + assert ( + result is not True + ), "Testcase {} : Failed \n Error : Routes are still present \n {}".format( + tc_name, result + ) - input_dict_rm["r1"]["route_maps"]["rmap_XYZ_{}".format(addr_type)][0]["delete"]=False + input_dict_rm["r1"]["route_maps"]["rmap_XYZ_{}".format(addr_type)][0][ + "delete" + ] = False result = create_route_maps(tgen, input_dict_rm) - assert result is True, 'Testcase {} : Failed \n Error: {}'.format( - tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1) - assert result is True, \ - "Testcase {} : Failed \n Error {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) step("Delete/Re-add route-map IMP.") input_dict_rm2 = { "r1": { "route_maps": { - "rmap_IMP_{}".format(addr_type): [{ - "action": "permit", - "match": { - "community_list": {"id": "COMM"} - }, - "set": { - "community": {"num": "none"} - }, - "delete": True - }] + "rmap_IMP_{}".format(addr_type): [ + { + "action": "permit", + "match": {"community_list": {"id": "COMM"}}, + "set": {"community": {"num": "none"}}, + "delete": True, + } + ] } } } result = create_route_maps(tgen, input_dict_rm2) - assert result is True, 'Testcase {} : Failed \n Error: {}'.format( - tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) - result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1, - expected=False) - assert result is not True, ( - "Testcase {} : Failed \n Error : Routes are still present \n {}".\ - format(tc_name, result)) + result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1, expected=False) + assert ( + result is not True + ), "Testcase {} : Failed \n Error : Routes are still present \n {}".format( + tc_name, result + ) - input_dict_rm2["r1"]["route_maps"]["rmap_IMP_{}".format(addr_type)][0]["delete"]=False + input_dict_rm2["r1"]["route_maps"]["rmap_IMP_{}".format(addr_type)][0][ + "delete" + ] = False result = create_route_maps(tgen, input_dict_rm2) - assert result is True, 'Testcase {} : Failed \n Error: {}'.format( - tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1) - assert result is True, \ - "Testcase {} : Failed \n Error {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) write_test_footer(tc_name) @@ -1356,71 +1434,77 @@ def test_routemap_operatons_with_dynamic_import_p0(request): for addr_type in ADDR_TYPES: - step("Configure route-map to set community attribute for a specific" - "prefix on R1 in vrf ISR") + step( + "Configure route-map to set community attribute for a specific" + "prefix on R1 in vrf ISR" + ) input_dict_pf = { "r1": { "prefix_lists": { addr_type: { - "pflist_ABC_{}".format(addr_type): [{ - "seqid": 10, - "network": NETWORK1_1[addr_type], - "action": "permit" - }] + "pflist_ABC_{}".format(addr_type): [ + { + "seqid": 10, + "network": NETWORK1_1[addr_type], + "action": "permit", + } + ] } } } } result = create_prefix_lists(tgen, input_dict_pf) assert result is True, "Testcase {} : Failed \n Error: {}".format( - tc_name, result) + tc_name, result + ) input_dict_cl = { "r1": { "bgp_community_lists": [ - { - "community_type": "expanded", - "action": "permit", - "name": "COMM", - "value": "100:100" + { + "community_type": "expanded", + "action": "permit", + "name": "COMM", + "value": "100:100", } ] } } result = create_bgp_community_lists(tgen, input_dict_cl) - assert result is True, 'Testcase {} : Failed \n Error: {}'.format( - tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) for addr_type in ADDR_TYPES: input_dict_rm = { "r1": { "route_maps": { - "rmap_XYZ_{}".format(addr_type): [{ - "action": "permit", - "match": { - addr_type: { - "prefix_lists": - "pflist_ABC_{}".format(addr_type) - } - }, - "set": { - "community": {"num": "100:100"} + "rmap_XYZ_{}".format(addr_type): [ + { + "action": "permit", + "match": { + addr_type: { + "prefix_lists": "pflist_ABC_{}".format(addr_type) + } + }, + "set": {"community": {"num": "100:100"}}, } - }] + ] } } } result = create_route_maps(tgen, input_dict_rm) - assert result is True, 'Testcase {} : Failed \n Error: {}'.format( - tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: - step("Apply this route-map on R1 to vrf ISR while redistributing the" - " prefixes into BGP") + step( + "Apply this route-map on R1 to vrf ISR while redistributing the" + " prefixes into BGP" + ) - input_dict_1={} + input_dict_1 = {} DUT = ["r1"] VRFS = ["ISR"] AS_NUM = [100] @@ -1436,53 +1520,58 @@ def test_routemap_operatons_with_dynamic_import_p0(request): "address_family": { addr_type: { "unicast": { - "redistribute": [{ - "redist_type": "static", + "redistribute": [ + { + "redist_type": "static", "attribute": { - "route-map" : "rmap_XYZ_{}".\ - format(addr_type) - } + "route-map": "rmap_XYZ_{}".format(addr_type) + }, } ] } } - } - }) + }, + } + ) result = create_router_bgp(tgen, topo, input_dict_1) - assert result is True, "Testcase {} :Failed \n Error: {}". \ - format(tc_name, result) + assert result is True, "Testcase {} :Failed \n Error: {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: - step("Configure another route-map for filtering the prefixes based on" - " community attribute while importing into default vrf") + step( + "Configure another route-map for filtering the prefixes based on" + " community attribute while importing into default vrf" + ) input_dict_rm = { "r1": { "route_maps": { - "rmap_IMP_{}".format(addr_type): [{ - "action": "permit", - "match": { - "community_list": {"id": "COMM"} - }, - "set": { - "community": {"num": "500:500"} + "rmap_IMP_{}".format(addr_type): [ + { + "action": "permit", + "match": {"community_list": {"id": "COMM"}}, + "set": {"community": {"num": "500:500"}}, } - }] + ] } } } result = create_route_maps(tgen, input_dict_rm) - assert result is True, 'Testcase {} : Failed \n Error: {}'.format( - tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: - step("Apply the route-map while Importing vrf ISR's prefixes into " - "default vrf on router R1:") + step( + "Apply the route-map while Importing vrf ISR's prefixes into " + "default vrf on router R1:" + ) - input_dict_isr={} + input_dict_isr = {} DUT = ["r1"] VRFS = ["default"] AS_NUM = [100] @@ -1496,15 +1585,10 @@ def test_routemap_operatons_with_dynamic_import_p0(request): "local_as": as_num, "vrf": vrf, "address_family": { - addr_type: { - "unicast": { - "import": { - "vrf": "ISR" - } - } - } - } - }) + addr_type: {"unicast": {"import": {"vrf": "ISR"}}} + }, + } + ) temp[dut]["bgp"].append( { @@ -1518,42 +1602,45 @@ def test_routemap_operatons_with_dynamic_import_p0(request): } } } - } - }) + }, + } + ) result = create_router_bgp(tgen, topo, input_dict_isr) - assert result is True, "Testcase {} : Failed \n Error: {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: - step("Verify on R1 that only prefixes with community value 100:100" + step( + "Verify on R1 that only prefixes with community value 100:100" "in vrf ISR are imported to vrf default. While importing, the" - " community value has been stripped off:") + " community value has been stripped off:" + ) input_routes_r1 = { "r1": { - "static_routes": [{ - "network": [ - NETWORK1_1[addr_type] - ], - "vrf": "default" - }] + "static_routes": [ + {"network": [NETWORK1_1[addr_type]], "vrf": "default"} + ] } } result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1) - assert result is True, \ - "Testcase {} : Failed \n Error {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: step("Applying route-map first followed by import VRF command.") - step("Apply the route-map while Importing vrf ISR's prefixes into " - "default vrf on router R1:") + step( + "Apply the route-map while Importing vrf ISR's prefixes into " + "default vrf on router R1:" + ) - input_dict_isr={} + input_dict_isr = {} DUT = ["r1"] VRFS = ["default"] AS_NUM = [100] @@ -1568,15 +1655,11 @@ def test_routemap_operatons_with_dynamic_import_p0(request): "vrf": vrf, "address_family": { addr_type: { - "unicast": { - "import": { - "vrf": "ISR", - "delete": True - } - } + "unicast": {"import": {"vrf": "ISR", "delete": True}} } - } - }) + }, + } + ) temp[dut]["bgp"].append( { @@ -1590,39 +1673,41 @@ def test_routemap_operatons_with_dynamic_import_p0(request): } } } - } - }) + }, + } + ) result = create_router_bgp(tgen, topo, input_dict_isr) - assert result is True, "Testcase {} : Failed \n Error: {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: - step("Verify that until 'import VRF command' is not configured, " + step( + "Verify that until 'import VRF command' is not configured, " "routes are not imported. After configuring 'import VRF command'" - " repeat step-4 for verification") + " repeat step-4 for verification" + ) input_routes_r1 = { "r1": { - "static_routes": [{ - "network": [ - NETWORK1_1[addr_type] - ], - "vrf": "default" - }] + "static_routes": [ + {"network": [NETWORK1_1[addr_type]], "vrf": "default"} + ] } } - result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1, - expected=False) - assert result is not True, ( - "Testcase {} : Failed \n Error : Routes are still present \n {}".\ - format(tc_name, result)) + result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1, expected=False) + assert ( + result is not True + ), "Testcase {} : Failed \n Error : Routes are still present \n {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: - input_dict_isr={} + input_dict_isr = {} DUT = ["r1"] VRFS = ["default"] AS_NUM = [100] @@ -1636,15 +1721,10 @@ def test_routemap_operatons_with_dynamic_import_p0(request): "local_as": as_num, "vrf": vrf, "address_family": { - addr_type: { - "unicast": { - "import": { - "vrf": "ISR" - } - } - } - } - }) + addr_type: {"unicast": {"import": {"vrf": "ISR"}}} + }, + } + ) temp[dut]["bgp"].append( { @@ -1658,37 +1738,35 @@ def test_routemap_operatons_with_dynamic_import_p0(request): } } } - } - }) + }, + } + ) result = create_router_bgp(tgen, topo, input_dict_isr) - assert result is True, "Testcase {} : Failed \n Error: {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: input_routes_r1 = { "r1": { - "static_routes": [{ - "network": [ - NETWORK1_1[addr_type] - ], - "vrf": "default" - }] + "static_routes": [ + {"network": [NETWORK1_1[addr_type]], "vrf": "default"} + ] } } result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1) - assert result is True, \ - "Testcase {} : Failed \n Error {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: - step("Delete/re-add import vrf ISR command multiple times in default" - "vrf.") + step("Delete/re-add import vrf ISR command multiple times in default" "vrf.") - input_dict_isr={} + input_dict_isr = {} DUT = ["r1"] VRFS = ["default"] AS_NUM = [100] @@ -1703,112 +1781,111 @@ def test_routemap_operatons_with_dynamic_import_p0(request): "vrf": vrf, "address_family": { addr_type: { - "unicast": { - "import": { - "vrf": "ISR", - "delete": True - } - } + "unicast": {"import": {"vrf": "ISR", "delete": True}} } - } - }) + }, + } + ) result = create_router_bgp(tgen, topo, input_dict_isr) - assert result is True, "Testcase {} : Failed \n Error: {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) - step("Verify that when import vrf ISR command is deleted, " - "all routes of vrf ISR disappear from default vrf and " - "when it's re-configured, repeat step-4 for verification.") + step( + "Verify that when import vrf ISR command is deleted, " + "all routes of vrf ISR disappear from default vrf and " + "when it's re-configured, repeat step-4 for verification." + ) input_routes_r1 = { "r1": { - "static_routes": [{ - "network": [ - NETWORK1_1[addr_type] - ], - "vrf": "default" - }] + "static_routes": [ + {"network": [NETWORK1_1[addr_type]], "vrf": "default"} + ] } } - result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1, - expected=False) - assert result is not True, ( - "Testcase {} : Failed \n Routes are still present, Error {}". \ - format(tc_name, result)) + result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1, expected=False) + assert ( + result is not True + ), "Testcase {} : Failed \n Routes are still present, Error {}".format( + tc_name, result + ) input_dict_isr["r1"]["bgp"][0]["address_family"][addr_type]["unicast"][ - "import"]["delete"]=False + "import" + ]["delete"] = False result = create_router_bgp(tgen, topo, input_dict_isr) - assert result is True, "Testcase {} : Failed \n Error: {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1) - assert result is True, ( - "Testcase {} : Failed \n Error {}". \ - format(tc_name, result)) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: - step("Delete and re-configure route-map IMP from global config when " - "import and route-maps are applied in a ISR vrf.") + step( + "Delete and re-configure route-map IMP from global config when " + "import and route-maps are applied in a ISR vrf." + ) input_dict_rm = { "r1": { "route_maps": { - "rmap_IMP_{}".format(addr_type): [{ - "action": "permit", - "match": { - "community_list": {"id": "COMM"} - }, - "set": { - "community": {"num": "500:500"} - }, - "delete": True - }] + "rmap_IMP_{}".format(addr_type): [ + { + "action": "permit", + "match": {"community_list": {"id": "COMM"}}, + "set": {"community": {"num": "500:500"}}, + "delete": True, + } + ] } } } result = create_route_maps(tgen, input_dict_rm) - assert result is True, 'Testcase {} : Failed \n Error: {}'.format( - tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) input_routes_r1 = { "r1": { - "static_routes": [{ - "network": [ - NETWORK1_1[addr_type] - ], - "vrf": "default" - }] + "static_routes": [ + {"network": [NETWORK1_1[addr_type]], "vrf": "default"} + ] } } - result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1, - expected=False) - assert result is not True, ( - "Testcase {} : Failed \n Routes are still present, Error {}". \ - format(tc_name, result)) + result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1, expected=False) + assert ( + result is not True + ), "Testcase {} : Failed \n Routes are still present, Error {}".format( + tc_name, result + ) - input_dict_rm["r1"]["route_maps"]["rmap_IMP_{}".\ - format(addr_type)][0]["delete"]=False + input_dict_rm["r1"]["route_maps"]["rmap_IMP_{}".format(addr_type)][0][ + "delete" + ] = False result = create_route_maps(tgen, input_dict_rm) - assert result is True, 'Testcase {} : Failed \n Error: {}'.format( - tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) - input_dict_comm = { - "community": "500:500" - } + input_dict_comm = {"community": "500:500"} - result = verify_bgp_community(tgen, addr_type, dut, [NETWORK1_1[addr_type]], - input_dict_comm) - assert result is True, ( - "Testcase {} : Failed \n Error: {}".format( - tc_name, result)) + result = verify_bgp_community( + tgen, addr_type, dut, [NETWORK1_1[addr_type]], input_dict_comm + ) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) write_test_footer(tc_name) @@ -1828,21 +1905,21 @@ def test_verify_cli_json_p1(request): check_router_status(tgen) input_dict = { - "r1":{ - "cli": ["show bgp vrf default ipv4 summary", - "show bgp vrf all ipv6 summary", - "show bgp neighbors" + "r1": { + "cli": [ + "show bgp vrf default ipv4 summary", + "show bgp vrf all ipv6 summary", + "show bgp neighbors", ] } } result = verify_cli_json(tgen, input_dict) - assert result is True, "Testcase {} : Failed \n Error: {}".format( - tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) write_test_footer(tc_name) -if __name__ == '__main__': +if __name__ == "__main__": args = ["-s"] + sys.argv[1:] sys.exit(pytest.main(args)) diff --git a/tests/topotests/bgp_vrf_dynamic_route_leak/test_bgp_vrf_dynamic_route_leak_topo2.py b/tests/topotests/bgp_vrf_dynamic_route_leak/test_bgp_vrf_dynamic_route_leak_topo2.py index 6c106060b8..9106c163cd 100644 --- a/tests/topotests/bgp_vrf_dynamic_route_leak/test_bgp_vrf_dynamic_route_leak_topo2.py +++ b/tests/topotests/bgp_vrf_dynamic_route_leak/test_bgp_vrf_dynamic_route_leak_topo2.py @@ -38,8 +38,8 @@ import platform # Save the Current Working Directory to find configuration files. CWD = os.path.dirname(os.path.realpath(__file__)) -sys.path.append(os.path.join(CWD, '../')) -sys.path.append(os.path.join(CWD, '../lib/')) +sys.path.append(os.path.join(CWD, "../")) +sys.path.append(os.path.join(CWD, "../lib/")) # Required to instantiate the topology builder class. @@ -50,22 +50,31 @@ from lib.topotest import version_cmp from mininet.topo import Topo from lib.common_config import ( - start_topology, write_test_header, check_address_types, + start_topology, + write_test_header, + check_address_types, write_test_footer, - verify_rib, step, create_route_maps, - create_static_routes, stop_router, start_router, + verify_rib, + step, + create_route_maps, + create_static_routes, + stop_router, + start_router, create_prefix_lists, create_bgp_community_lists, check_router_status, get_frr_ipv6_linklocal, - shutdown_bringup_interface + shutdown_bringup_interface, ) from lib.topolog import logger from lib.bgp import ( - verify_bgp_convergence, create_router_bgp, - verify_bgp_community, verify_bgp_attributes, - verify_best_path_as_per_bgp_attribute, verify_bgp_rib + verify_bgp_convergence, + create_router_bgp, + verify_bgp_community, + verify_bgp_attributes, + verify_best_path_as_per_bgp_attribute, + verify_bgp_rib, ) from lib.topojson import build_topo_from_json, build_config_from_json @@ -123,10 +132,11 @@ def setup_module(mod): start_topology(tgen) # Run these tests for kernel version 4.19 or above - if version_cmp(platform.release(), '4.19') < 0: - error_msg = ('BGP vrf dynamic route leak tests will not run ' - '(have kernel "{}", but it requires >= 4.19)'.\ - format(platform.release())) + if version_cmp(platform.release(), "4.19") < 0: + error_msg = ( + "BGP vrf dynamic route leak tests will not run " + '(have kernel "{}", but it requires >= 4.19)'.format(platform.release()) + ) pytest.skip(error_msg) # Creating configuration from JSON @@ -137,8 +147,9 @@ def setup_module(mod): ADDR_TYPES = check_address_types() BGP_CONVERGENCE = verify_bgp_convergence(tgen, topo) - assert BGP_CONVERGENCE is True, "setup_module : Failed \n Error: {}". \ - format(BGP_CONVERGENCE) + assert BGP_CONVERGENCE is True, "setup_module : Failed \n Error: {}".format( + BGP_CONVERGENCE + ) logger.info("Running setup_module() done") @@ -153,8 +164,9 @@ def teardown_module(): # Stop toplogy and Remove tmp files tgen.stop_topology() - logger.info("Testsuite end time: {}". - format(time.asctime(time.localtime(time.time())))) + logger.info( + "Testsuite end time: {}".format(time.asctime(time.localtime(time.time()))) + ) logger.info("=" * 40) @@ -164,6 +176,7 @@ def teardown_module(): # ##################################################### + def test_bgp_best_path_with_dynamic_import_p0(request): """ TC6_FUNC_6: @@ -181,10 +194,11 @@ def test_bgp_best_path_with_dynamic_import_p0(request): for addr_type in ADDR_TYPES: - step("Redistribute configured static routes into BGP process" - " on R1/R2 and R3") + step( + "Redistribute configured static routes into BGP process" " on R1/R2 and R3" + ) - input_dict_1={} + input_dict_1 = {} DUT = ["r1", "r2", "r3", "r4"] VRFS = ["ISR", "ISR", "default", "default"] AS_NUM = [100, 100, 300, 400] @@ -199,24 +213,22 @@ def test_bgp_best_path_with_dynamic_import_p0(request): "vrf": vrf, "address_family": { addr_type: { - "unicast": { - "redistribute": [{ - "redist_type": "static" - }] - } + "unicast": {"redistribute": [{"redist_type": "static"}]} } - } - }) + }, + } + ) result = create_router_bgp(tgen, topo, input_dict_1) - assert result is True, "Testcase {} :Failed \n Error: {}". \ - format(tc_name, result) + assert result is True, "Testcase {} :Failed \n Error: {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: step("Import from default vrf into vrf ISR on R1 and R2 as below") - input_dict_vrf={} + input_dict_vrf = {} DUT = ["r1", "r2"] VRFS = ["ISR", "ISR"] AS_NUM = [100, 100] @@ -230,21 +242,17 @@ def test_bgp_best_path_with_dynamic_import_p0(request): "local_as": as_num, "vrf": vrf, "address_family": { - addr_type: { - "unicast": { - "import": { - "vrf": "default" - } - } - } - } - }) + addr_type: {"unicast": {"import": {"vrf": "default"}}} + }, + } + ) result = create_router_bgp(tgen, topo, input_dict_vrf) - assert result is True, "Testcase {} : Failed \n Error: {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) - input_dict_default={} + input_dict_default = {} DUT = ["r1", "r2"] VRFS = ["default", "default"] AS_NUM = [100, 100] @@ -258,36 +266,28 @@ def test_bgp_best_path_with_dynamic_import_p0(request): "local_as": as_num, "vrf": vrf, "address_family": { - addr_type: { - "unicast": { - "import": { - "vrf": "ISR" - } - } - } - } - }) + addr_type: {"unicast": {"import": {"vrf": "ISR"}}} + }, + } + ) result = create_router_bgp(tgen, topo, input_dict_default) - assert result is True, "Testcase {} : Failed \n Error: {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) - step("Verify ECMP/Next-hop/Imported routes Vs Locally originated " - "routes/eBGP routes vs iBGP routes --already covered in almost" - " all tests") + step( + "Verify ECMP/Next-hop/Imported routes Vs Locally originated " + "routes/eBGP routes vs iBGP routes --already covered in almost" + " all tests" + ) for addr_type in ADDR_TYPES: step("Verify Pre-emption") input_routes_r3 = { - "r3": { - "static_routes": [{ - "network": [ - NETWORK3_3[addr_type] - ] - }] - } + "r3": {"static_routes": [{"network": [NETWORK3_3[addr_type]]}]} } intf_r3_r1 = topo["routers"]["r3"]["links"]["r1-link1"]["interface"] @@ -297,30 +297,27 @@ def test_bgp_best_path_with_dynamic_import_p0(request): nh_r3_r1 = get_frr_ipv6_linklocal(tgen, "r3", intf=intf_r3_r1) nh_r4_r1 = get_frr_ipv6_linklocal(tgen, "r4", intf=intf_r4_r1) else: - nh_r3_r1 = topo["routers"]["r3"]["links"]\ - ["r1-link1"][addr_type].split("/")[0] - nh_r4_r1 = topo["routers"]["r4"]["links"]\ - ["r1-link1"][addr_type].split("/")[0] + nh_r3_r1 = topo["routers"]["r3"]["links"]["r1-link1"][addr_type].split("/")[ + 0 + ] + nh_r4_r1 = topo["routers"]["r4"]["links"]["r1-link1"][addr_type].split("/")[ + 0 + ] - result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r3, - next_hop=[nh_r4_r1]) - assert result is True, ( - "Testcase {} : Failed \n Error {}". \ - format(tc_name, result)) + result = verify_bgp_rib( + tgen, addr_type, "r1", input_routes_r3, next_hop=[nh_r4_r1] + ) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) step("Shutdown interface connected to r1 from r4:") - shutdown_bringup_interface(tgen, 'r4', intf_r4_r1, False) + shutdown_bringup_interface(tgen, "r4", intf_r4_r1, False) for addr_type in ADDR_TYPES: input_routes_r3 = { - "r3": { - "static_routes": [{ - "network": [ - NETWORK3_3[addr_type] - ] - }] - } + "r3": {"static_routes": [{"network": [NETWORK3_3[addr_type]]}]} } intf_r3_r1 = topo["routers"]["r3"]["links"]["r1-link1"]["interface"] @@ -330,31 +327,28 @@ def test_bgp_best_path_with_dynamic_import_p0(request): nh_r3_r1 = get_frr_ipv6_linklocal(tgen, "r3", intf=intf_r3_r1) nh_r4_r1 = get_frr_ipv6_linklocal(tgen, "r4", intf=intf_r4_r1) else: - nh_r3_r1 = topo["routers"]["r3"]["links"]\ - ["r1-link1"][addr_type].split("/")[0] - nh_r4_r1 = topo["routers"]["r4"]["links"]\ - ["r1-link1"][addr_type].split("/")[0] + nh_r3_r1 = topo["routers"]["r3"]["links"]["r1-link1"][addr_type].split("/")[ + 0 + ] + nh_r4_r1 = topo["routers"]["r4"]["links"]["r1-link1"][addr_type].split("/")[ + 0 + ] step("Verify next-hop is changed") - result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r3, - next_hop=[nh_r3_r1]) - assert result is True, ( - "Testcase {} : Failed \n Error {}". \ - format(tc_name, result)) + result = verify_bgp_rib( + tgen, addr_type, "r1", input_routes_r3, next_hop=[nh_r3_r1] + ) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) step("Bringup interface connected to r1 from r4:") - shutdown_bringup_interface(tgen, 'r4', intf_r4_r1, True) + shutdown_bringup_interface(tgen, "r4", intf_r4_r1, True) for addr_type in ADDR_TYPES: input_routes_r3 = { - "r3": { - "static_routes": [{ - "network": [ - NETWORK3_3[addr_type] - ] - }] - } + "r3": {"static_routes": [{"network": [NETWORK3_3[addr_type]]}]} } intf_r3_r1 = topo["routers"]["r3"]["links"]["r1-link1"]["interface"] @@ -364,17 +358,20 @@ def test_bgp_best_path_with_dynamic_import_p0(request): nh_r3_r1 = get_frr_ipv6_linklocal(tgen, "r3", intf=intf_r3_r1) nh_r4_r1 = get_frr_ipv6_linklocal(tgen, "r4", intf=intf_r4_r1) else: - nh_r3_r1 = topo["routers"]["r3"]["links"]\ - ["r1-link1"][addr_type].split("/")[0] - nh_r4_r1 = topo["routers"]["r4"]["links"]\ - ["r1-link1"][addr_type].split("/")[0] + nh_r3_r1 = topo["routers"]["r3"]["links"]["r1-link1"][addr_type].split("/")[ + 0 + ] + nh_r4_r1 = topo["routers"]["r4"]["links"]["r1-link1"][addr_type].split("/")[ + 0 + ] step("Verify next-hop is not chnaged aftr shutdown:") - result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r3, - next_hop=[nh_r3_r1]) - assert result is True, ( - "Testcase {} : Failed \n Error {}". \ - format(tc_name, result)) + result = verify_bgp_rib( + tgen, addr_type, "r1", input_routes_r3, next_hop=[nh_r3_r1] + ) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) step("Active-Standby scenario(as-path prepend and Local pref)") @@ -386,18 +383,21 @@ def test_bgp_best_path_with_dynamic_import_p0(request): "r1": { "prefix_lists": { addr_type: { - "pf_ls_{}".format(addr_type): [{ - "seqid": 10, - "network": NETWORK3_4[addr_type], - "action": "permit" - }] + "pf_ls_{}".format(addr_type): [ + { + "seqid": 10, + "network": NETWORK3_4[addr_type], + "action": "permit", + } + ] } } } } result = create_prefix_lists(tgen, input_dict_pf) assert result is True, "Testcase {} : Failed \n Error: {}".format( - tc_name, result) + tc_name, result + ) for addr_type in ADDR_TYPES: @@ -406,57 +406,56 @@ def test_bgp_best_path_with_dynamic_import_p0(request): input_dict_rm = { "r1": { "route_maps": { - "rmap_PATH1_{}".format(addr_type): [{ - "action": "permit", - "seq_id": 10, - "match": { - addr_type: { - "prefix_lists": - "pf_ls_{}".format(addr_type) - } - }, - "set": { - "locPrf": 500 + "rmap_PATH1_{}".format(addr_type): [ + { + "action": "permit", + "seq_id": 10, + "match": { + addr_type: { + "prefix_lists": "pf_ls_{}".format(addr_type) + } + }, + "set": {"locPrf": 500}, } - }] + ] } } } result = create_route_maps(tgen, input_dict_rm) - assert result is True, 'Testcase {} : Failed \n Error: {}'.format( - tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) step("Create route-map to match prefix-list and set localpref 600") input_dict_rm = { "r1": { "route_maps": { - "rmap_PATH2_{}".format(addr_type): [{ - "action": "permit", - "seq_id": 20, - "match": { - addr_type: { - "prefix_lists": - "pf_ls_{}".format(addr_type) - } - }, - "set": { - "locPrf": 600 + "rmap_PATH2_{}".format(addr_type): [ + { + "action": "permit", + "seq_id": 20, + "match": { + addr_type: { + "prefix_lists": "pf_ls_{}".format(addr_type) + } + }, + "set": {"locPrf": 600}, } - }] + ] } } } result = create_route_maps(tgen, input_dict_rm) - assert result is True, 'Testcase {} : Failed \n Error: {}'.format( - tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) - input_dict_rma={ + input_dict_rma = { "r1": { - "bgp": - [ + "bgp": [ { "local_as": "100", "address_family": { @@ -466,36 +465,44 @@ def test_bgp_best_path_with_dynamic_import_p0(request): "r3": { "dest_link": { "r1-link1": { - "route_maps": [{ - "name": "rmap_PATH1_{}".\ - format(addr_type), - "direction": "in" - }] + "route_maps": [ + { + "name": "rmap_PATH1_{}".format( + addr_type + ), + "direction": "in", + } + ] } } }, "r4": { "dest_link": { "r1-link1": { - "route_maps": [{ - "name": "rmap_PATH2_{}".\ - format(addr_type), - "direction": "in" - }] + "route_maps": [ + { + "name": "rmap_PATH2_{}".format( + addr_type + ), + "direction": "in", + } + ] } } - } + }, } } } - } + }, } - ]} + ] } + } result = create_router_bgp(tgen, topo, input_dict_rma) assert result is True, "Testcase {} : Failed \n Error: {}".format( - tc_name, result) + tc_name, result + ) dut = "r1" attribute = "locPrf" @@ -506,20 +513,18 @@ def test_bgp_best_path_with_dynamic_import_p0(request): input_routes_r3 = { "r3": { - "static_routes": [{ - "network": [ - NETWORK3_3[addr_type], \ - NETWORK3_4[addr_type] - ] - }] + "static_routes": [ + {"network": [NETWORK3_3[addr_type], NETWORK3_4[addr_type]]} + ] } } - result = verify_best_path_as_per_bgp_attribute(tgen, addr_type, dut, - input_routes_r3, - attribute) + result = verify_best_path_as_per_bgp_attribute( + tgen, addr_type, dut, input_routes_r3, attribute + ) assert result is True, "Testcase {} : Failed \n Error: {}".format( - tc_name, result) + tc_name, result + ) for addr_type in ADDR_TYPES: @@ -528,26 +533,26 @@ def test_bgp_best_path_with_dynamic_import_p0(request): input_dict_rm = { "r1": { "route_maps": { - "rmap_PATH1_{}".format(addr_type): [{ - "action": "permit", - "seq_id": 10, - "match": { - addr_type: { - "prefix_lists": - "pf_ls_{}".format(addr_type) - } - }, - "set": { - "locPrf": 700 + "rmap_PATH1_{}".format(addr_type): [ + { + "action": "permit", + "seq_id": 10, + "match": { + addr_type: { + "prefix_lists": "pf_ls_{}".format(addr_type) + } + }, + "set": {"locPrf": 700}, } - }] + ] } } } result = create_route_maps(tgen, input_dict_rm) - assert result is True, 'Testcase {} : Failed \n Error: {}'.format( - tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: @@ -555,20 +560,18 @@ def test_bgp_best_path_with_dynamic_import_p0(request): input_routes_r3 = { "r3": { - "static_routes": [{ - "network": [ - NETWORK3_3[addr_type], \ - NETWORK3_4[addr_type] - ] - }] + "static_routes": [ + {"network": [NETWORK3_3[addr_type], NETWORK3_4[addr_type]]} + ] } } - result = verify_best_path_as_per_bgp_attribute(tgen, addr_type, dut, - input_routes_r3, - attribute) + result = verify_best_path_as_per_bgp_attribute( + tgen, addr_type, dut, input_routes_r3, attribute + ) assert result is True, "Testcase {} : Failed \n Error: {}".format( - tc_name, result) + tc_name, result + ) for addr_type in ADDR_TYPES: @@ -577,30 +580,29 @@ def test_bgp_best_path_with_dynamic_import_p0(request): input_dict_rm = { "r1": { "route_maps": { - "rmap_PATH2_{}".format(addr_type): [{ - "action": "permit", - "seq_id": 20, - "match": { - addr_type: { - "prefix_lists": - "pf_ls_{}".format(addr_type) - } - }, - "set": { - "localpref": 700, - "path": { - "as_num": "111", - "as_action": "prepend" - } + "rmap_PATH2_{}".format(addr_type): [ + { + "action": "permit", + "seq_id": 20, + "match": { + addr_type: { + "prefix_lists": "pf_ls_{}".format(addr_type) + } + }, + "set": { + "localpref": 700, + "path": {"as_num": "111", "as_action": "prepend"}, + }, } - }] + ] } } } result = create_route_maps(tgen, input_dict_rm) - assert result is True, 'Testcase {} : Failed \n Error: {}'.format( - tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) attribute = "path" @@ -610,20 +612,18 @@ def test_bgp_best_path_with_dynamic_import_p0(request): input_routes_r3 = { "r3": { - "static_routes": [{ - "network": [ - NETWORK3_3[addr_type], \ - NETWORK3_4[addr_type] - ] - }] + "static_routes": [ + {"network": [NETWORK3_3[addr_type], NETWORK3_4[addr_type]]} + ] } } - result = verify_best_path_as_per_bgp_attribute(tgen, addr_type, dut, - input_routes_r3, - attribute) + result = verify_best_path_as_per_bgp_attribute( + tgen, addr_type, dut, input_routes_r3, attribute + ) assert result is True, "Testcase {} : Failed \n Error: {}".format( - tc_name, result) + tc_name, result + ) write_test_footer(tc_name) @@ -645,71 +645,77 @@ def test_modify_route_map_match_set_clauses_p1(request): for addr_type in ADDR_TYPES: - step("Configure route-map to set community attribute for a specific" - "prefix on R1 in vrf ISR") + step( + "Configure route-map to set community attribute for a specific" + "prefix on R1 in vrf ISR" + ) input_dict_pf = { "r1": { "prefix_lists": { addr_type: { - "pflist_ABC_{}".format(addr_type): [{ - "seqid": 10, - "network": NETWORK1_1[addr_type], - "action": "permit" - }] + "pflist_ABC_{}".format(addr_type): [ + { + "seqid": 10, + "network": NETWORK1_1[addr_type], + "action": "permit", + } + ] } } } } result = create_prefix_lists(tgen, input_dict_pf) assert result is True, "Testcase {} : Failed \n Error: {}".format( - tc_name, result) + tc_name, result + ) input_dict_cl = { "r1": { "bgp_community_lists": [ - { - "community_type": "expanded", - "action": "permit", - "name": "COMM", - "value": "100:100" + { + "community_type": "expanded", + "action": "permit", + "name": "COMM", + "value": "100:100", } ] } } result = create_bgp_community_lists(tgen, input_dict_cl) - assert result is True, 'Testcase {} : Failed \n Error: {}'.format( - tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) for addr_type in ADDR_TYPES: input_dict_rm = { "r1": { "route_maps": { - "rmap_XYZ_{}".format(addr_type): [{ - "action": "permit", - "match": { - addr_type: { - "prefix_lists": - "pflist_ABC_{}".format(addr_type) - } - }, - "set": { - "community": {"num": "100:100"} + "rmap_XYZ_{}".format(addr_type): [ + { + "action": "permit", + "match": { + addr_type: { + "prefix_lists": "pflist_ABC_{}".format(addr_type) + } + }, + "set": {"community": {"num": "100:100"}}, } - }] + ] } } } result = create_route_maps(tgen, input_dict_rm) - assert result is True, 'Testcase {} : Failed \n Error: {}'.format( - tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: - step("Apply this route-map on R1 to vrf ISR while redistributing the" - " prefixes into BGP") + step( + "Apply this route-map on R1 to vrf ISR while redistributing the" + " prefixes into BGP" + ) - input_dict_1={} + input_dict_1 = {} DUT = ["r1"] VRFS = ["ISR"] AS_NUM = [100] @@ -725,54 +731,59 @@ def test_modify_route_map_match_set_clauses_p1(request): "address_family": { addr_type: { "unicast": { - "redistribute": [{ - "redist_type": "static", + "redistribute": [ + { + "redist_type": "static", "attribute": { - "route-map" : "rmap_XYZ_{}".\ - format(addr_type) - } + "route-map": "rmap_XYZ_{}".format(addr_type) + }, } ] } } - } - }) + }, + } + ) result = create_router_bgp(tgen, topo, input_dict_1) - assert result is True, "Testcase {} :Failed \n Error: {}". \ - format(tc_name, result) + assert result is True, "Testcase {} :Failed \n Error: {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: - step("Configure another route-map for filtering the prefixes based on" - " community attribute while importing into default vrf") + step( + "Configure another route-map for filtering the prefixes based on" + " community attribute while importing into default vrf" + ) input_dict_rm = { "r1": { "route_maps": { - "rmap_IMP_{}".format(addr_type): [{ - "action": "permit", - "seq_id": 10, - "match": { - "community_list": {"id": "COMM"} - }, - "set": { - "community": {"num": "none"} + "rmap_IMP_{}".format(addr_type): [ + { + "action": "permit", + "seq_id": 10, + "match": {"community_list": {"id": "COMM"}}, + "set": {"community": {"num": "none"}}, } - }] + ] } } } result = create_route_maps(tgen, input_dict_rm) - assert result is True, 'Testcase {} : Failed \n Error: {}'.format( - tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: - step("Apply the route-map while Importing vrf ISR's prefixes into " - "default vrf on router R1:") + step( + "Apply the route-map while Importing vrf ISR's prefixes into " + "default vrf on router R1:" + ) - input_dict_isr={} + input_dict_isr = {} DUT = ["r1"] VRFS = ["default"] AS_NUM = [100] @@ -786,15 +797,10 @@ def test_modify_route_map_match_set_clauses_p1(request): "local_as": as_num, "vrf": vrf, "address_family": { - addr_type: { - "unicast": { - "import": { - "vrf": "ISR" - } - } - } - } - }) + addr_type: {"unicast": {"import": {"vrf": "ISR"}}} + }, + } + ) temp[dut]["bgp"].append( { @@ -808,34 +814,35 @@ def test_modify_route_map_match_set_clauses_p1(request): } } } - } - }) + }, + } + ) result = create_router_bgp(tgen, topo, input_dict_isr) - assert result is True, "Testcase {} : Failed \n Error: {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: - step("Verify on R1 that only prefixes with community value 100:100" + step( + "Verify on R1 that only prefixes with community value 100:100" "in vrf ISR are imported to vrf default. While importing, the" - " community value has been stripped off:") + " community value has been stripped off:" + ) input_routes_r1 = { "r1": { - "static_routes": [{ - "network": [ - NETWORK1_1[addr_type] - ], - "vrf": "default" - }] + "static_routes": [ + {"network": [NETWORK1_1[addr_type]], "vrf": "default"} + ] } } result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1) - assert result is True, \ - "Testcase {} : Failed \n Error {}". \ - format(tc_name, result) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: @@ -844,119 +851,106 @@ def test_modify_route_map_match_set_clauses_p1(request): input_dict_rm = { "r1": { "route_maps": { - "rmap_IMP_{}".format(addr_type): [{ - "action": "permit", - "seq_id": 10, - "match": { - "community_list": {"id": "COMM"} - }, - "set": { - "large_community": {"num": "100:100:100"}, - "locPrf": 500, - "path": { - "as_num": "100 100", - "as_action": "prepend" - } + "rmap_IMP_{}".format(addr_type): [ + { + "action": "permit", + "seq_id": 10, + "match": {"community_list": {"id": "COMM"}}, + "set": { + "large_community": {"num": "100:100:100"}, + "locPrf": 500, + "path": {"as_num": "100 100", "as_action": "prepend"}, + }, } - }] + ] } } } result = create_route_maps(tgen, input_dict_rm) - assert result is True, 'Testcase {} : Failed \n Error: {}'.format( - tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) for addr_type in ADDR_TYPES: - step("Verify that as we continue adding different attributes " + step( + "Verify that as we continue adding different attributes " "step-by-step in route-map IMP those attributes gets " - "attached to prefixes:") + "attached to prefixes:" + ) input_routes_r1 = { "r1": { - "static_routes": [{ - "network": [ - NETWORK1_1[addr_type] - ], - "vrf": "default" - }] + "static_routes": [ + {"network": [NETWORK1_1[addr_type]], "vrf": "default"} + ] } } - input_dict_comm = { - "largeCommunity": "100:100:100" - } + input_dict_comm = {"largeCommunity": "100:100:100"} - result = verify_bgp_community(tgen, addr_type, dut, [NETWORK1_1[addr_type]], - input_dict_comm) - assert result is True, ( - "Testcase {} : Failed \n Error {}".format( - tc_name, result)) + result = verify_bgp_community( + tgen, addr_type, dut, [NETWORK1_1[addr_type]], input_dict_comm + ) + assert result is True, "Testcase {} : Failed \n Error {}".format( + tc_name, result + ) input_rmap = { "r1": { "route_maps": { - "rmap_IMP_{}".format(addr_type): [ - { - "set": { - "locPrf": 500 - } - } - ] + "rmap_IMP_{}".format(addr_type): [{"set": {"locPrf": 500}}] } } } - result = verify_bgp_attributes(tgen, addr_type, "r1",\ - [NETWORK1_1[addr_type]], - rmap_name="rmap_IMP_{}".format(addr_type),\ - input_dict=input_rmap) - assert result is True, "Testcase : Failed \n Error: {}".format( - tc_name, result) + result = verify_bgp_attributes( + tgen, + addr_type, + "r1", + [NETWORK1_1[addr_type]], + rmap_name="rmap_IMP_{}".format(addr_type), + input_dict=input_rmap, + ) + assert result is True, "Testcase : Failed \n Error: {}".format(tc_name, result) - step("Change community-list to match a different value then " - "100:100.") + step("Change community-list to match a different value then " "100:100.") input_dict_cl = { "r1": { "bgp_community_lists": [ - { - "community_type": "expanded", - "action": "permit", - "name": "COMM", - "value": "100:100", - "delete": True + { + "community_type": "expanded", + "action": "permit", + "name": "COMM", + "value": "100:100", + "delete": True, } ] } } result = create_bgp_community_lists(tgen, input_dict_cl) - assert result is True, 'Testcase {} : Failed \n Error: {}'.format( - tc_name, result) + assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) for addr_type in ADDR_TYPES: input_routes_r1 = { "r1": { - "static_routes": [{ - "network": [ - NETWORK1_1[addr_type] - ], - "vrf": "default" - }] + "static_routes": [ + {"network": [NETWORK1_1[addr_type]], "vrf": "default"} + ] } } - result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1, - expected=False) + result = verify_bgp_rib(tgen, addr_type, "r1", input_routes_r1, expected=False) assert result is not True, ( "Testcase {} : Failed \n Error : Routes are still " - "present {}".\ - format(tc_name, result)) + "present {}".format(tc_name, result) + ) write_test_footer(tc_name) -if __name__ == '__main__': +if __name__ == "__main__": args = ["-s"] + sys.argv[1:] sys.exit(pytest.main(args)) diff --git a/tests/topotests/evpn_type5_test_topo1/test_evpn_type5_chaos_topo1.py b/tests/topotests/evpn_type5_test_topo1/test_evpn_type5_chaos_topo1.py index e913105e43..46e21857c8 100644 --- a/tests/topotests/evpn_type5_test_topo1/test_evpn_type5_chaos_topo1.py +++ b/tests/topotests/evpn_type5_test_topo1/test_evpn_type5_chaos_topo1.py @@ -71,7 +71,7 @@ from lib.common_config import ( configure_brctl, apply_raw_config, verify_vrf_vni, - verify_cli_json + verify_cli_json, ) from lib.topolog import logger @@ -81,7 +81,7 @@ from lib.bgp import ( clear_bgp, verify_best_path_as_per_bgp_attribute, verify_attributes_for_evpn_routes, - verify_evpn_routes + verify_evpn_routes, ) from lib.topojson import build_topo_from_json, build_config_from_json @@ -177,9 +177,11 @@ def setup_module(mod): # Creating configuration from JSON build_config_from_json(tgen, topo) - if version_cmp(platform.release(), '4.19') < 0: - error_msg = ('EVPN tests will not run (have kernel "{}", ' - 'but it requires >= 4.19)'.format(platform.release())) + if version_cmp(platform.release(), "4.19") < 0: + error_msg = ( + 'EVPN tests will not run (have kernel "{}", ' + "but it requires >= 4.19)".format(platform.release()) + ) pytest.skip(error_msg) global BGP_CONVERGENCE @@ -389,9 +391,9 @@ def test_verify_overlay_index_p1(request): "network": NETWORK3_1[addr_type], "next_hop": NEXT_HOP_IP[addr_type], "vrf": "GREEN", - } + }, ] - } + }, } result = create_static_routes(tgen, input_dict_1) @@ -463,7 +465,7 @@ def test_evpn_cli_json_available_p1(request): "cli": [ "show evpn vni detail", "show bgp l2vpn evpn all overlay", - "show bgp l2vpn evpn vni" + "show bgp l2vpn evpn vni", ] } } @@ -516,9 +518,9 @@ def test_RT_verification_auto_p0(request): "network": NETWORK4_1[addr_type], "next_hop": NEXT_HOP_IP[addr_type], "vrf": "GREEN", - } + }, ] - } + }, } result = create_static_routes(tgen, input_dict_1) diff --git a/tests/topotests/evpn_type5_test_topo1/test_evpn_type5_topo1.py b/tests/topotests/evpn_type5_test_topo1/test_evpn_type5_topo1.py index c1eb7d68bb..87f391ae49 100644 --- a/tests/topotests/evpn_type5_test_topo1/test_evpn_type5_topo1.py +++ b/tests/topotests/evpn_type5_test_topo1/test_evpn_type5_topo1.py @@ -77,7 +77,7 @@ from lib.common_config import ( configure_vxlan, configure_brctl, verify_vrf_vni, - create_interface_in_kernel + create_interface_in_kernel, ) from lib.topolog import logger @@ -87,7 +87,7 @@ from lib.bgp import ( clear_bgp, verify_best_path_as_per_bgp_attribute, verify_attributes_for_evpn_routes, - verify_evpn_routes + verify_evpn_routes, ) from lib.topojson import build_topo_from_json, build_config_from_json @@ -179,9 +179,11 @@ def setup_module(mod): # Creating configuration from JSON build_config_from_json(tgen, topo) - if version_cmp(platform.release(), '4.19') < 0: - error_msg = ('EVPN tests will not run (have kernel "{}", ' - 'but it requires >= 4.19)'.format(platform.release())) + if version_cmp(platform.release(), "4.19") < 0: + error_msg = ( + 'EVPN tests will not run (have kernel "{}", ' + "but it requires >= 4.19)".format(platform.release()) + ) pytest.skip(error_msg) global BGP_CONVERGENCE @@ -387,9 +389,9 @@ def test_RD_verification_manual_and_auto_p0(request): "network": NETWORK3_1[addr_type], "next_hop": NEXT_HOP_IP[addr_type], "vrf": "GREEN", - } + }, ] - } + }, } result = create_static_routes(tgen, input_dict_1) @@ -453,7 +455,7 @@ def test_RD_verification_manual_and_auto_p0(request): "vrf": "RED", "address_family": { "l2vpn": {"evpn": {"rd": "100.100.100.100:100"}} - } + }, } ] } @@ -620,9 +622,9 @@ def test_RT_verification_manual_p0(request): "network": NETWORK3_1[addr_type], "next_hop": NEXT_HOP_IP[addr_type], "vrf": "GREEN", - } + }, ] - } + }, } result = create_static_routes(tgen, input_dict_1) @@ -652,7 +654,7 @@ def test_RT_verification_manual_p0(request): "l2vpn": { "evpn": {"route-target": {"export": [{"value": "100:100"}]}} }, - } + }, } ] } @@ -995,9 +997,9 @@ def test_active_standby_evpn_implementation_p1(request): "network": NETWORK1_4[addr_type], "next_hop": NEXT_HOP_IP[addr_type], "vrf": "GREEN", - } + }, ] - } + }, } result = create_static_routes(tgen, input_dict_1) @@ -1249,9 +1251,9 @@ def test_evpn_routes_from_VNFs_p1(request): "network": NETWORK3_1[addr_type], "next_hop": NEXT_HOP_IP[addr_type], "vrf": "GREEN", - } + }, ] - } + }, } result = create_static_routes(tgen, input_dict_1) @@ -1382,9 +1384,9 @@ def test_evpn_routes_from_VNFs_p1(request): "network": NETWORK3_1[addr_type], "next_hop": NEXT_HOP_IP[addr_type], "vrf": "GREEN", - } + }, ] - } + }, } result = create_static_routes(tgen, input_dict_1) @@ -1617,9 +1619,9 @@ def test_route_map_operations_for_evpn_address_family_p1(request, attribute): "network": NETWORK3_1[addr_type], "next_hop": NEXT_HOP_IP[addr_type], "vrf": "GREEN", - } + }, ] - } + }, } result = create_static_routes(tgen, input_dict_1) @@ -1811,9 +1813,9 @@ def test_bgp_attributes_for_evpn_address_family_p1(request, attribute): "network": NETWORK3_1[addr_type], "next_hop": NEXT_HOP_IP[addr_type], "vrf": "GREEN", - } + }, ] - } + }, } result = create_static_routes(tgen, input_dict_1) diff --git a/tests/topotests/isis-sr-topo1/rt1/isisd.conf b/tests/topotests/isis-sr-topo1/rt1/isisd.conf index 26ec4eb261..f441527597 100644 --- a/tests/topotests/isis-sr-topo1/rt1/isisd.conf +++ b/tests/topotests/isis-sr-topo1/rt1/isisd.conf @@ -19,9 +19,9 @@ interface eth-sw1 isis hello-multiplier 3 ! router isis 1 + lsp-gen-interval 2 net 49.0000.0000.0000.0001.00 is-type level-1 - lsp-gen-interval 2 topology ipv6-unicast segment-routing on segment-routing global-block 16000 23999 diff --git a/tests/topotests/isis-sr-topo1/rt1/step1/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt1/step1/show_ip_route.ref index 6b4a59011a..53bf8cb445 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step1/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step1/show_ip_route.ref @@ -290,5 +290,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 17100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt1/step1/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt1/step1/show_ipv6_route.ref index c507688f5b..0b39584717 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step1/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step1/show_ipv6_route.ref @@ -117,5 +117,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 17101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt1/step1/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt1/step1/show_mpls_table.ref index 773f5e3d43..5b1950d8cb 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step1/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step1/show_mpls_table.ref @@ -130,5 +130,41 @@ "interface":"eth-sw1" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.1.2" + }, + { + "type":"SR (IS-IS)", + "outLabel":17100, + "installed":true, + "nexthop":"10.0.1.3" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-sw1" + }, + { + "type":"SR (IS-IS)", + "outLabel":17101, + "installed":true, + "interface":"eth-sw1" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt1/step1/show_yang_interface_isis_adjacencies.ref b/tests/topotests/isis-sr-topo1/rt1/step1/show_yang_interface_isis_adjacencies.ref index 69dcc91b1d..26f0dffa7a 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step1/show_yang_interface_isis_adjacencies.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step1/show_yang_interface_isis_adjacencies.ref @@ -11,7 +11,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0003", - "neighbor-extended-circuit-id": 2, "hold-timer": 9, "neighbor-priority": 64, "state": "up" @@ -19,7 +18,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0002", - "neighbor-extended-circuit-id": 2, "hold-timer": 9, "neighbor-priority": 64, "state": "up" diff --git a/tests/topotests/isis-sr-topo1/rt1/step10/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt1/step10/show_ip_route.ref index 6b34d5e4ff..c712538c00 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step10/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step10/show_ip_route.ref @@ -283,5 +283,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 17100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt1/step10/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt1/step10/show_ipv6_route.ref index c507688f5b..0b39584717 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step10/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step10/show_ipv6_route.ref @@ -117,5 +117,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 17101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt1/step10/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt1/step10/show_mpls_table.ref index 25a48c2bfc..7e6c72627a 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step10/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step10/show_mpls_table.ref @@ -152,5 +152,41 @@ "interface":"eth-sw1" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.1.2" + }, + { + "type":"SR (IS-IS)", + "outLabel":17100, + "installed":true, + "nexthop":"10.0.1.3" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-sw1" + }, + { + "type":"SR (IS-IS)", + "outLabel":17101, + "installed":true, + "interface":"eth-sw1" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt1/step2/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt1/step2/show_ip_route.ref index 6b34d5e4ff..c712538c00 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step2/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step2/show_ip_route.ref @@ -283,5 +283,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 17100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt1/step2/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt1/step2/show_ipv6_route.ref index c507688f5b..0b39584717 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step2/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step2/show_ipv6_route.ref @@ -117,5 +117,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 17101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt1/step2/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt1/step2/show_mpls_table.ref index 773f5e3d43..5b1950d8cb 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step2/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step2/show_mpls_table.ref @@ -130,5 +130,41 @@ "interface":"eth-sw1" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.1.2" + }, + { + "type":"SR (IS-IS)", + "outLabel":17100, + "installed":true, + "nexthop":"10.0.1.3" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-sw1" + }, + { + "type":"SR (IS-IS)", + "outLabel":17101, + "installed":true, + "interface":"eth-sw1" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt1/step3/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt1/step3/show_ip_route.ref index 05a8498693..71f9ebddfb 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step3/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step3/show_ip_route.ref @@ -250,5 +250,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 17100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt1/step3/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt1/step3/show_ipv6_route.ref index d50952c6c4..304c0a475b 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step3/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step3/show_ipv6_route.ref @@ -86,5 +86,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 17101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt1/step3/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt1/step3/show_mpls_table.ref index 73f517a6e5..94b3cb6d1a 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step3/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step3/show_mpls_table.ref @@ -94,5 +94,41 @@ "interface":"eth-sw1" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.1.2" + }, + { + "type":"SR (IS-IS)", + "outLabel":17100, + "installed":true, + "nexthop":"10.0.1.3" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-sw1" + }, + { + "type":"SR (IS-IS)", + "outLabel":17101, + "installed":true, + "interface":"eth-sw1" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt1/step4/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt1/step4/show_ip_route.ref index 6b34d5e4ff..c712538c00 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step4/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step4/show_ip_route.ref @@ -283,5 +283,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 17100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt1/step4/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt1/step4/show_ipv6_route.ref index c507688f5b..0b39584717 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step4/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step4/show_ipv6_route.ref @@ -117,5 +117,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 17101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt1/step4/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt1/step4/show_mpls_table.ref index ac39920ee5..6500a47fbf 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step4/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step4/show_mpls_table.ref @@ -101,15 +101,15 @@ "nexthops":[ { "type":"SR (IS-IS)", - "outLabel":16060, + "outLabel":17060, "installed":true, - "nexthop":"10.0.1.2" + "nexthop":"10.0.1.3" }, { "type":"SR (IS-IS)", - "outLabel":17060, + "outLabel":16060, "installed":true, - "nexthop":"10.0.1.3" + "nexthop":"10.0.1.2" } ] }, @@ -130,5 +130,41 @@ "interface":"eth-sw1" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.1.2" + }, + { + "type":"SR (IS-IS)", + "outLabel":17100, + "installed":true, + "nexthop":"10.0.1.3" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-sw1" + }, + { + "type":"SR (IS-IS)", + "outLabel":17101, + "installed":true, + "interface":"eth-sw1" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt1/step5/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt1/step5/show_ip_route.ref index 59213686f2..16d9358468 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step5/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step5/show_ip_route.ref @@ -277,5 +277,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 17100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt1/step5/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt1/step5/show_ipv6_route.ref index cdfae284ba..f2093a3fc0 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step5/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step5/show_ipv6_route.ref @@ -111,5 +111,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 17101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt1/step5/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt1/step5/show_mpls_table.ref index 73f517a6e5..94b3cb6d1a 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step5/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step5/show_mpls_table.ref @@ -94,5 +94,41 @@ "interface":"eth-sw1" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.1.2" + }, + { + "type":"SR (IS-IS)", + "outLabel":17100, + "installed":true, + "nexthop":"10.0.1.3" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-sw1" + }, + { + "type":"SR (IS-IS)", + "outLabel":17101, + "installed":true, + "interface":"eth-sw1" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt1/step6/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt1/step6/show_ip_route.ref index 6b34d5e4ff..c712538c00 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step6/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step6/show_ip_route.ref @@ -283,5 +283,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 17100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt1/step6/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt1/step6/show_ipv6_route.ref index c507688f5b..0b39584717 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step6/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step6/show_ipv6_route.ref @@ -117,5 +117,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 17101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt1/step6/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt1/step6/show_mpls_table.ref index 773f5e3d43..5b1950d8cb 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step6/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step6/show_mpls_table.ref @@ -130,5 +130,41 @@ "interface":"eth-sw1" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.1.2" + }, + { + "type":"SR (IS-IS)", + "outLabel":17100, + "installed":true, + "nexthop":"10.0.1.3" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-sw1" + }, + { + "type":"SR (IS-IS)", + "outLabel":17101, + "installed":true, + "interface":"eth-sw1" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt1/step7/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt1/step7/show_ip_route.ref index 6b34d5e4ff..c712538c00 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step7/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step7/show_ip_route.ref @@ -283,5 +283,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 17100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt1/step7/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt1/step7/show_ipv6_route.ref index c507688f5b..0b39584717 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step7/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step7/show_ipv6_route.ref @@ -117,5 +117,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 17101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt1/step7/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt1/step7/show_mpls_table.ref index 773f5e3d43..5b1950d8cb 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step7/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step7/show_mpls_table.ref @@ -130,5 +130,41 @@ "interface":"eth-sw1" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.1.2" + }, + { + "type":"SR (IS-IS)", + "outLabel":17100, + "installed":true, + "nexthop":"10.0.1.3" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-sw1" + }, + { + "type":"SR (IS-IS)", + "outLabel":17101, + "installed":true, + "interface":"eth-sw1" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt1/step8/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt1/step8/show_ip_route.ref index 6b34d5e4ff..c712538c00 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step8/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step8/show_ip_route.ref @@ -283,5 +283,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 17100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt1/step8/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt1/step8/show_ipv6_route.ref index c507688f5b..0b39584717 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step8/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step8/show_ipv6_route.ref @@ -117,5 +117,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 17101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt1/step8/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt1/step8/show_mpls_table.ref index 773f5e3d43..5b1950d8cb 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step8/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step8/show_mpls_table.ref @@ -130,5 +130,41 @@ "interface":"eth-sw1" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.1.2" + }, + { + "type":"SR (IS-IS)", + "outLabel":17100, + "installed":true, + "nexthop":"10.0.1.3" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-sw1" + }, + { + "type":"SR (IS-IS)", + "outLabel":17101, + "installed":true, + "interface":"eth-sw1" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt1/step9/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt1/step9/show_ip_route.ref index 6b34d5e4ff..c712538c00 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step9/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step9/show_ip_route.ref @@ -283,5 +283,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 17100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt1/step9/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt1/step9/show_ipv6_route.ref index c507688f5b..0b39584717 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step9/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step9/show_ipv6_route.ref @@ -117,5 +117,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 17101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt1/step9/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt1/step9/show_mpls_table.ref index 25a48c2bfc..7e6c72627a 100644 --- a/tests/topotests/isis-sr-topo1/rt1/step9/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt1/step9/show_mpls_table.ref @@ -152,5 +152,41 @@ "interface":"eth-sw1" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.1.2" + }, + { + "type":"SR (IS-IS)", + "outLabel":17100, + "installed":true, + "nexthop":"10.0.1.3" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-sw1" + }, + { + "type":"SR (IS-IS)", + "outLabel":17101, + "installed":true, + "interface":"eth-sw1" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt2/isisd.conf b/tests/topotests/isis-sr-topo1/rt2/isisd.conf index 8704a28b6c..796b6ed32c 100644 --- a/tests/topotests/isis-sr-topo1/rt2/isisd.conf +++ b/tests/topotests/isis-sr-topo1/rt2/isisd.conf @@ -30,9 +30,9 @@ interface eth-rt4-2 isis hello-multiplier 3 ! router isis 1 + lsp-gen-interval 2 net 49.0000.0000.0000.0002.00 is-type level-1 - lsp-gen-interval 2 topology ipv6-unicast segment-routing on segment-routing global-block 16000 23999 diff --git a/tests/topotests/isis-sr-topo1/rt2/step1/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt2/step1/show_ip_route.ref index be037aba8b..109b94f7a1 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step1/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step1/show_ip_route.ref @@ -343,5 +343,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step1/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt2/step1/show_ipv6_route.ref index a888198ac8..eae700ee47 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step1/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step1/show_ipv6_route.ref @@ -144,5 +144,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step1/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt2/step1/show_mpls_table.ref index 42fde2d77f..a32cd1d1bf 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step1/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step1/show_mpls_table.ref @@ -77,13 +77,13 @@ "type":"SR (IS-IS)", "outLabel":16040, "installed":true, - "nexthop":"10.0.3.4" + "nexthop":"10.0.2.4" }, { "type":"SR (IS-IS)", "outLabel":16040, "installed":true, - "nexthop":"10.0.2.4" + "nexthop":"10.0.3.4" } ] }, @@ -95,13 +95,13 @@ "type":"SR (IS-IS)", "outLabel":16041, "installed":true, - "interface":"eth-rt4-2" + "interface":"eth-rt4-1" }, { "type":"SR (IS-IS)", "outLabel":16041, "installed":true, - "interface":"eth-rt4-1" + "interface":"eth-rt4-2" } ] }, @@ -111,9 +111,9 @@ "nexthops":[ { "type":"SR (IS-IS)", - "outLabel":17050, + "outLabel":16050, "installed":true, - "nexthop":"10.0.1.3" + "nexthop":"10.0.2.4" }, { "type":"SR (IS-IS)", @@ -123,9 +123,9 @@ }, { "type":"SR (IS-IS)", - "outLabel":16050, + "outLabel":17050, "installed":true, - "nexthop":"10.0.2.4" + "nexthop":"10.0.1.3" } ] }, @@ -135,9 +135,9 @@ "nexthops":[ { "type":"SR (IS-IS)", - "outLabel":17051, + "outLabel":16051, "installed":true, - "interface":"eth-sw1" + "interface":"eth-rt4-1" }, { "type":"SR (IS-IS)", @@ -147,9 +147,9 @@ }, { "type":"SR (IS-IS)", - "outLabel":16051, + "outLabel":17051, "installed":true, - "interface":"eth-rt4-1" + "interface":"eth-sw1" } ] }, @@ -161,13 +161,13 @@ "type":"SR (IS-IS)", "outLabel":16060, "installed":true, - "nexthop":"10.0.3.4" + "nexthop":"10.0.2.4" }, { "type":"SR (IS-IS)", "outLabel":16060, "installed":true, - "nexthop":"10.0.2.4" + "nexthop":"10.0.3.4" } ] }, @@ -179,13 +179,49 @@ "type":"SR (IS-IS)", "outLabel":16061, "installed":true, - "interface":"eth-rt4-2" + "interface":"eth-rt4-1" }, { "type":"SR (IS-IS)", "outLabel":16061, "installed":true, + "interface":"eth-rt4-2" + } + ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.2.4" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.3.4" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, "interface":"eth-rt4-1" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt4-2" } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step1/show_yang_interface_isis_adjacencies.ref b/tests/topotests/isis-sr-topo1/rt2/step1/show_yang_interface_isis_adjacencies.ref index be018fd59f..07f43e5999 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step1/show_yang_interface_isis_adjacencies.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step1/show_yang_interface_isis_adjacencies.ref @@ -11,7 +11,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0004", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" @@ -31,7 +30,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0004", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" @@ -51,7 +49,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0003", - "neighbor-extended-circuit-id": 2, "hold-timer": 9, "neighbor-priority": 64, "state": "up" @@ -59,7 +56,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0001", - "neighbor-extended-circuit-id": 2, "hold-timer": 9, "neighbor-priority": 64, "state": "up" diff --git a/tests/topotests/isis-sr-topo1/rt2/step10/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt2/step10/show_ip_route.ref index 33fbdba28f..387d3b43d7 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step10/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step10/show_ip_route.ref @@ -134,6 +134,27 @@ ] } ], + "10.0.2.0\/24":[ + { + "prefix":"10.0.2.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1" + }, + { + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true + } + ] + } + ], "10.0.3.0\/24":[ { "prefix":"10.0.3.0\/24", @@ -255,5 +276,28 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step10/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt2/step10/show_ipv6_route.ref index 19837bc700..355436cbfc 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step10/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step10/show_ipv6_route.ref @@ -126,5 +126,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step10/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt2/step10/show_mpls_table.ref index 29ec55a589..4cbdb9fda9 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step10/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step10/show_mpls_table.ref @@ -89,13 +89,13 @@ "type":"SR (IS-IS)", "outLabel":16041, "installed":true, - "interface":"eth-rt4-2" + "interface":"eth-rt4-1" }, { "type":"SR (IS-IS)", "outLabel":16041, "installed":true, - "interface":"eth-rt4-1" + "interface":"eth-rt4-2" } ] }, @@ -143,13 +143,43 @@ "type":"SR (IS-IS)", "outLabel":16061, "installed":true, - "interface":"eth-rt4-2" + "interface":"eth-rt4-1" }, { "type":"SR (IS-IS)", "outLabel":16061, "installed":true, + "interface":"eth-rt4-2" + } + ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.3.4" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, "interface":"eth-rt4-1" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt4-2" } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step2/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt2/step2/show_ip_route.ref index a110c51077..159392f7f7 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step2/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step2/show_ip_route.ref @@ -316,5 +316,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step2/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt2/step2/show_ipv6_route.ref index cb426897ce..e9f63849d8 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step2/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step2/show_ipv6_route.ref @@ -126,5 +126,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step2/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt2/step2/show_mpls_table.ref index 118ec89b5c..0692553808 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step2/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step2/show_mpls_table.ref @@ -77,13 +77,13 @@ "type":"SR (IS-IS)", "outLabel":16040, "installed":true, - "nexthop":"10.0.3.4" + "nexthop":"10.0.2.4" }, { "type":"SR (IS-IS)", "outLabel":16040, "installed":true, - "nexthop":"10.0.2.4" + "nexthop":"10.0.3.4" } ] }, @@ -95,13 +95,13 @@ "type":"SR (IS-IS)", "outLabel":16041, "installed":true, - "interface":"eth-rt4-2" + "interface":"eth-rt4-1" }, { "type":"SR (IS-IS)", "outLabel":16041, "installed":true, - "interface":"eth-rt4-1" + "interface":"eth-rt4-2" } ] }, @@ -137,13 +137,13 @@ "type":"SR (IS-IS)", "outLabel":16060, "installed":true, - "nexthop":"10.0.3.4" + "nexthop":"10.0.2.4" }, { "type":"SR (IS-IS)", "outLabel":16060, "installed":true, - "nexthop":"10.0.2.4" + "nexthop":"10.0.3.4" } ] }, @@ -155,13 +155,49 @@ "type":"SR (IS-IS)", "outLabel":16061, "installed":true, - "interface":"eth-rt4-2" + "interface":"eth-rt4-1" }, { "type":"SR (IS-IS)", "outLabel":16061, "installed":true, + "interface":"eth-rt4-2" + } + ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.2.4" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.3.4" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, "interface":"eth-rt4-1" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt4-2" } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step3/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt2/step3/show_ip_route.ref index d31affeb59..16f49ffe46 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step3/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step3/show_ip_route.ref @@ -269,5 +269,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step3/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt2/step3/show_ipv6_route.ref index d92df1918c..bde83c30d0 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step3/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step3/show_ipv6_route.ref @@ -95,5 +95,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step3/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt2/step3/show_mpls_table.ref index f1e18be26b..cbb0d5c695 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step3/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step3/show_mpls_table.ref @@ -77,13 +77,13 @@ "type":"SR (IS-IS)", "outLabel":16040, "installed":true, - "nexthop":"10.0.3.4" + "nexthop":"10.0.2.4" }, { "type":"SR (IS-IS)", "outLabel":16040, "installed":true, - "nexthop":"10.0.2.4" + "nexthop":"10.0.3.4" } ] }, @@ -95,13 +95,13 @@ "type":"SR (IS-IS)", "outLabel":16041, "installed":true, - "interface":"eth-rt4-2" + "interface":"eth-rt4-1" }, { "type":"SR (IS-IS)", "outLabel":16041, "installed":true, - "interface":"eth-rt4-1" + "interface":"eth-rt4-2" } ] }, @@ -128,5 +128,41 @@ "interface":"eth-sw1" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.2.4" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.3.4" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt4-1" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt4-2" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt2/step4/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt2/step4/show_ip_route.ref index a110c51077..159392f7f7 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step4/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step4/show_ip_route.ref @@ -316,5 +316,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step4/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt2/step4/show_ipv6_route.ref index cb426897ce..e9f63849d8 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step4/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step4/show_ipv6_route.ref @@ -126,5 +126,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step4/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt2/step4/show_mpls_table.ref index 118ec89b5c..0692553808 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step4/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step4/show_mpls_table.ref @@ -77,13 +77,13 @@ "type":"SR (IS-IS)", "outLabel":16040, "installed":true, - "nexthop":"10.0.3.4" + "nexthop":"10.0.2.4" }, { "type":"SR (IS-IS)", "outLabel":16040, "installed":true, - "nexthop":"10.0.2.4" + "nexthop":"10.0.3.4" } ] }, @@ -95,13 +95,13 @@ "type":"SR (IS-IS)", "outLabel":16041, "installed":true, - "interface":"eth-rt4-2" + "interface":"eth-rt4-1" }, { "type":"SR (IS-IS)", "outLabel":16041, "installed":true, - "interface":"eth-rt4-1" + "interface":"eth-rt4-2" } ] }, @@ -137,13 +137,13 @@ "type":"SR (IS-IS)", "outLabel":16060, "installed":true, - "nexthop":"10.0.3.4" + "nexthop":"10.0.2.4" }, { "type":"SR (IS-IS)", "outLabel":16060, "installed":true, - "nexthop":"10.0.2.4" + "nexthop":"10.0.3.4" } ] }, @@ -155,13 +155,49 @@ "type":"SR (IS-IS)", "outLabel":16061, "installed":true, - "interface":"eth-rt4-2" + "interface":"eth-rt4-1" }, { "type":"SR (IS-IS)", "outLabel":16061, "installed":true, + "interface":"eth-rt4-2" + } + ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.2.4" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.3.4" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, "interface":"eth-rt4-1" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt4-2" } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step5/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt2/step5/show_ip_route.ref index f378e41d8d..fbfcce10aa 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step5/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step5/show_ip_route.ref @@ -310,5 +310,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step5/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt2/step5/show_ipv6_route.ref index d63e7ceba5..f747a96518 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step5/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step5/show_ipv6_route.ref @@ -120,5 +120,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step5/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt2/step5/show_mpls_table.ref index f1e18be26b..cbb0d5c695 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step5/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step5/show_mpls_table.ref @@ -77,13 +77,13 @@ "type":"SR (IS-IS)", "outLabel":16040, "installed":true, - "nexthop":"10.0.3.4" + "nexthop":"10.0.2.4" }, { "type":"SR (IS-IS)", "outLabel":16040, "installed":true, - "nexthop":"10.0.2.4" + "nexthop":"10.0.3.4" } ] }, @@ -95,13 +95,13 @@ "type":"SR (IS-IS)", "outLabel":16041, "installed":true, - "interface":"eth-rt4-2" + "interface":"eth-rt4-1" }, { "type":"SR (IS-IS)", "outLabel":16041, "installed":true, - "interface":"eth-rt4-1" + "interface":"eth-rt4-2" } ] }, @@ -128,5 +128,41 @@ "interface":"eth-sw1" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.2.4" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.3.4" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt4-1" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt4-2" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt2/step6/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt2/step6/show_ip_route.ref index a110c51077..159392f7f7 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step6/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step6/show_ip_route.ref @@ -316,5 +316,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step6/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt2/step6/show_ipv6_route.ref index cb426897ce..e9f63849d8 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step6/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step6/show_ipv6_route.ref @@ -126,5 +126,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step6/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt2/step6/show_mpls_table.ref index 118ec89b5c..0692553808 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step6/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step6/show_mpls_table.ref @@ -77,13 +77,13 @@ "type":"SR (IS-IS)", "outLabel":16040, "installed":true, - "nexthop":"10.0.3.4" + "nexthop":"10.0.2.4" }, { "type":"SR (IS-IS)", "outLabel":16040, "installed":true, - "nexthop":"10.0.2.4" + "nexthop":"10.0.3.4" } ] }, @@ -95,13 +95,13 @@ "type":"SR (IS-IS)", "outLabel":16041, "installed":true, - "interface":"eth-rt4-2" + "interface":"eth-rt4-1" }, { "type":"SR (IS-IS)", "outLabel":16041, "installed":true, - "interface":"eth-rt4-1" + "interface":"eth-rt4-2" } ] }, @@ -137,13 +137,13 @@ "type":"SR (IS-IS)", "outLabel":16060, "installed":true, - "nexthop":"10.0.3.4" + "nexthop":"10.0.2.4" }, { "type":"SR (IS-IS)", "outLabel":16060, "installed":true, - "nexthop":"10.0.2.4" + "nexthop":"10.0.3.4" } ] }, @@ -155,13 +155,49 @@ "type":"SR (IS-IS)", "outLabel":16061, "installed":true, - "interface":"eth-rt4-2" + "interface":"eth-rt4-1" }, { "type":"SR (IS-IS)", "outLabel":16061, "installed":true, + "interface":"eth-rt4-2" + } + ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.2.4" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.3.4" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, "interface":"eth-rt4-1" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt4-2" } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step7/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt2/step7/show_ip_route.ref index a9b086a248..09ab6d4f8a 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step7/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step7/show_ip_route.ref @@ -313,5 +313,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step7/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt2/step7/show_ipv6_route.ref index 1c61f91451..851275fbf7 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step7/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step7/show_ipv6_route.ref @@ -123,5 +123,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step7/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt2/step7/show_mpls_table.ref index 0f0d24bbfb..87946aa7b9 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step7/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step7/show_mpls_table.ref @@ -53,13 +53,13 @@ "type":"SR (IS-IS)", "outLabel":16040, "installed":true, - "nexthop":"10.0.3.4" + "nexthop":"10.0.2.4" }, { "type":"SR (IS-IS)", "outLabel":16040, "installed":true, - "nexthop":"10.0.2.4" + "nexthop":"10.0.3.4" } ] }, @@ -71,13 +71,13 @@ "type":"SR (IS-IS)", "outLabel":16041, "installed":true, - "interface":"eth-rt4-2" + "interface":"eth-rt4-1" }, { "type":"SR (IS-IS)", "outLabel":16041, "installed":true, - "interface":"eth-rt4-1" + "interface":"eth-rt4-2" } ] }, @@ -113,13 +113,13 @@ "type":"SR (IS-IS)", "outLabel":16060, "installed":true, - "nexthop":"10.0.3.4" + "nexthop":"10.0.2.4" }, { "type":"SR (IS-IS)", "outLabel":16060, "installed":true, - "nexthop":"10.0.2.4" + "nexthop":"10.0.3.4" } ] }, @@ -131,13 +131,49 @@ "type":"SR (IS-IS)", "outLabel":16061, "installed":true, - "interface":"eth-rt4-2" + "interface":"eth-rt4-1" }, { "type":"SR (IS-IS)", "outLabel":16061, "installed":true, + "interface":"eth-rt4-2" + } + ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.2.4" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.3.4" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, "interface":"eth-rt4-1" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt4-2" } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step8/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt2/step8/show_ip_route.ref index a110c51077..159392f7f7 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step8/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step8/show_ip_route.ref @@ -316,5 +316,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step8/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt2/step8/show_ipv6_route.ref index cb426897ce..e9f63849d8 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step8/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step8/show_ipv6_route.ref @@ -126,5 +126,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step8/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt2/step8/show_mpls_table.ref index 118ec89b5c..0692553808 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step8/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step8/show_mpls_table.ref @@ -77,13 +77,13 @@ "type":"SR (IS-IS)", "outLabel":16040, "installed":true, - "nexthop":"10.0.3.4" + "nexthop":"10.0.2.4" }, { "type":"SR (IS-IS)", "outLabel":16040, "installed":true, - "nexthop":"10.0.2.4" + "nexthop":"10.0.3.4" } ] }, @@ -95,13 +95,13 @@ "type":"SR (IS-IS)", "outLabel":16041, "installed":true, - "interface":"eth-rt4-2" + "interface":"eth-rt4-1" }, { "type":"SR (IS-IS)", "outLabel":16041, "installed":true, - "interface":"eth-rt4-1" + "interface":"eth-rt4-2" } ] }, @@ -137,13 +137,13 @@ "type":"SR (IS-IS)", "outLabel":16060, "installed":true, - "nexthop":"10.0.3.4" + "nexthop":"10.0.2.4" }, { "type":"SR (IS-IS)", "outLabel":16060, "installed":true, - "nexthop":"10.0.2.4" + "nexthop":"10.0.3.4" } ] }, @@ -155,13 +155,49 @@ "type":"SR (IS-IS)", "outLabel":16061, "installed":true, - "interface":"eth-rt4-2" + "interface":"eth-rt4-1" }, { "type":"SR (IS-IS)", "outLabel":16061, "installed":true, + "interface":"eth-rt4-2" + } + ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.2.4" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.3.4" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, "interface":"eth-rt4-1" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt4-2" } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step9/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt2/step9/show_ip_route.ref index 2e4c20257f..fc82ada7e3 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step9/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step9/show_ip_route.ref @@ -316,5 +316,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step9/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt2/step9/show_ipv6_route.ref index 19837bc700..355436cbfc 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step9/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step9/show_ipv6_route.ref @@ -126,5 +126,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt2/step9/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt2/step9/show_mpls_table.ref index 7c910fc6f6..05201724f4 100644 --- a/tests/topotests/isis-sr-topo1/rt2/step9/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt2/step9/show_mpls_table.ref @@ -77,13 +77,13 @@ "type":"SR (IS-IS)", "outLabel":16040, "installed":true, - "nexthop":"10.0.3.4" + "nexthop":"10.0.2.4" }, { "type":"SR (IS-IS)", "outLabel":16040, "installed":true, - "nexthop":"10.0.2.4" + "nexthop":"10.0.3.4" } ] }, @@ -95,13 +95,13 @@ "type":"SR (IS-IS)", "outLabel":16041, "installed":true, - "interface":"eth-rt4-2" + "interface":"eth-rt4-1" }, { "type":"SR (IS-IS)", "outLabel":16041, "installed":true, - "interface":"eth-rt4-1" + "interface":"eth-rt4-2" } ] }, @@ -137,13 +137,13 @@ "type":"SR (IS-IS)", "outLabel":16060, "installed":true, - "nexthop":"10.0.3.4" + "nexthop":"10.0.2.4" }, { "type":"SR (IS-IS)", "outLabel":16060, "installed":true, - "nexthop":"10.0.2.4" + "nexthop":"10.0.3.4" } ] }, @@ -155,13 +155,49 @@ "type":"SR (IS-IS)", "outLabel":16061, "installed":true, - "interface":"eth-rt4-2" + "interface":"eth-rt4-1" }, { "type":"SR (IS-IS)", "outLabel":16061, "installed":true, + "interface":"eth-rt4-2" + } + ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.2.4" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.3.4" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, "interface":"eth-rt4-1" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt4-2" } ] } diff --git a/tests/topotests/isis-sr-topo1/rt3/isisd.conf b/tests/topotests/isis-sr-topo1/rt3/isisd.conf index 5a0add22a9..cc2aa1782b 100644 --- a/tests/topotests/isis-sr-topo1/rt3/isisd.conf +++ b/tests/topotests/isis-sr-topo1/rt3/isisd.conf @@ -30,9 +30,9 @@ interface eth-rt5-2 isis hello-multiplier 3 ! router isis 1 + lsp-gen-interval 2 net 49.0000.0000.0000.0003.00 is-type level-1 - lsp-gen-interval 2 topology ipv6-unicast segment-routing on segment-routing global-block 17000 24999 diff --git a/tests/topotests/isis-sr-topo1/rt3/step1/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt3/step1/show_ip_route.ref index 8d4fbec4b5..241f768859 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step1/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step1/show_ip_route.ref @@ -343,5 +343,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt3/step1/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt3/step1/show_ipv6_route.ref index 4e4961eaf0..dd78c7d318 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step1/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step1/show_ipv6_route.ref @@ -56,7 +56,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-sw1", "active":true, "labels":[ 16041 @@ -65,7 +65,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-sw1", + "interfaceName":"eth-rt5-1", "active":true, "labels":[ 16041 @@ -74,7 +74,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "labels":[ 16041 @@ -96,7 +96,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, "labels":[ 16051 @@ -105,7 +105,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "labels":[ 16051 @@ -127,7 +127,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, "labels":[ 16061 @@ -136,7 +136,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "labels":[ 16061 @@ -144,5 +144,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt3/step1/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt3/step1/show_mpls_table.ref index b7bdc3e4af..8c6fca7b57 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step1/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step1/show_mpls_table.ref @@ -77,19 +77,19 @@ "type":"SR (IS-IS)", "outLabel":16040, "installed":true, - "nexthop":"10.0.1.2" + "nexthop":"10.0.5.5" }, { "type":"SR (IS-IS)", "outLabel":16040, "installed":true, - "nexthop":"10.0.5.5" + "nexthop":"10.0.4.5" }, { "type":"SR (IS-IS)", "outLabel":16040, "installed":true, - "nexthop":"10.0.4.5" + "nexthop":"10.0.1.2" } ] }, @@ -101,19 +101,19 @@ "type":"SR (IS-IS)", "outLabel":16041, "installed":true, - "interface":"eth-sw1" + "interface":"eth-rt5-2" }, { "type":"SR (IS-IS)", "outLabel":16041, "installed":true, - "interface":"eth-rt5-2" + "interface":"eth-rt5-1" }, { "type":"SR (IS-IS)", "outLabel":16041, "installed":true, - "interface":"eth-rt5-1" + "interface":"eth-sw1" } ] }, @@ -188,5 +188,41 @@ "interface":"eth-rt5-1" } ] + }, + "17100":{ + "inLabel":17100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.5.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.4.5" + } + ] + }, + "17101":{ + "inLabel":17101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5-2" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5-1" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt3/step1/show_yang_interface_isis_adjacencies.ref b/tests/topotests/isis-sr-topo1/rt3/step1/show_yang_interface_isis_adjacencies.ref index 82069cec48..7fa6f5cf47 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step1/show_yang_interface_isis_adjacencies.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step1/show_yang_interface_isis_adjacencies.ref @@ -11,7 +11,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0005", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" @@ -31,7 +30,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0005", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" @@ -51,7 +49,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0001", - "neighbor-extended-circuit-id": 2, "hold-timer": 9, "neighbor-priority": 64, "state": "up" @@ -59,7 +56,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0002", - "neighbor-extended-circuit-id": 2, "hold-timer": 9, "neighbor-priority": 64, "state": "up" diff --git a/tests/topotests/isis-sr-topo1/rt3/step10/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt3/step10/show_ip_route.ref index 9522b141b0..40a98ab7c6 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step10/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step10/show_ip_route.ref @@ -323,5 +323,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt3/step10/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt3/step10/show_ipv6_route.ref index fb630bc68f..1fb50407bd 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step10/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step10/show_ipv6_route.ref @@ -78,7 +78,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, "labels":[ 16051 @@ -87,7 +87,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "labels":[ 16051 @@ -109,7 +109,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, "labels":[ 16061 @@ -118,7 +118,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "labels":[ 16061 @@ -126,5 +126,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt3/step10/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt3/step10/show_mpls_table.ref index 4aec3b6904..44ddc4bc14 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step10/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step10/show_mpls_table.ref @@ -164,5 +164,41 @@ "interface":"eth-rt5-1" } ] + }, + "17100":{ + "inLabel":17100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.5.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.4.5" + } + ] + }, + "17101":{ + "inLabel":17101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5-2" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5-1" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt3/step2/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt3/step2/show_ip_route.ref index 46ebeb8ab9..55d8213c4e 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step2/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step2/show_ip_route.ref @@ -323,5 +323,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt3/step2/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt3/step2/show_ipv6_route.ref index b2c774d493..4f6441e7b9 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step2/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step2/show_ipv6_route.ref @@ -78,7 +78,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, "labels":[ 16051 @@ -87,7 +87,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "labels":[ 16051 @@ -109,7 +109,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, "labels":[ 16061 @@ -118,7 +118,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "labels":[ 16061 @@ -126,5 +126,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt3/step2/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt3/step2/show_mpls_table.ref index a1e64afd67..db8253f83d 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step2/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step2/show_mpls_table.ref @@ -164,5 +164,41 @@ "interface":"eth-rt5-1" } ] + }, + "17100":{ + "inLabel":17100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.5.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.4.5" + } + ] + }, + "17101":{ + "inLabel":17101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5-2" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5-1" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt3/step3/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt3/step3/show_ip_route.ref index 738aa17406..ed5cef8a5b 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step3/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step3/show_ip_route.ref @@ -276,5 +276,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt3/step3/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt3/step3/show_ipv6_route.ref index b6423cd2b8..b33058c3bd 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step3/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step3/show_ipv6_route.ref @@ -78,7 +78,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, "labels":[ 16051 @@ -87,7 +87,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "labels":[ 16051 @@ -95,5 +95,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt3/step3/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt3/step3/show_mpls_table.ref index 1a2b8728e6..70cccc0f0b 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step3/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step3/show_mpls_table.ref @@ -128,5 +128,41 @@ "interface":"eth-rt5-1" } ] + }, + "17100":{ + "inLabel":17100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.5.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.4.5" + } + ] + }, + "17101":{ + "inLabel":17101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5-2" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5-1" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt3/step4/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt3/step4/show_ip_route.ref index 46ebeb8ab9..55d8213c4e 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step4/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step4/show_ip_route.ref @@ -323,5 +323,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt3/step4/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt3/step4/show_ipv6_route.ref index b2c774d493..4f6441e7b9 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step4/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step4/show_ipv6_route.ref @@ -78,7 +78,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, "labels":[ 16051 @@ -87,7 +87,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "labels":[ 16051 @@ -109,7 +109,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, "labels":[ 16061 @@ -118,7 +118,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "labels":[ 16061 @@ -126,5 +126,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt3/step4/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt3/step4/show_mpls_table.ref index a1e64afd67..db8253f83d 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step4/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step4/show_mpls_table.ref @@ -164,5 +164,41 @@ "interface":"eth-rt5-1" } ] + }, + "17100":{ + "inLabel":17100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.5.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.4.5" + } + ] + }, + "17101":{ + "inLabel":17101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5-2" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5-1" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt3/step5/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt3/step5/show_ip_route.ref index 489b495bb1..3adcdce58c 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step5/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step5/show_ip_route.ref @@ -317,5 +317,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt3/step5/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt3/step5/show_ipv6_route.ref index 46ee7ba28e..863e26c30e 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step5/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step5/show_ipv6_route.ref @@ -78,7 +78,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, "labels":[ 16051 @@ -87,7 +87,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "labels":[ 16051 @@ -109,16 +109,47 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true }, { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt3/step5/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt3/step5/show_mpls_table.ref index 1a2b8728e6..70cccc0f0b 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step5/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step5/show_mpls_table.ref @@ -128,5 +128,41 @@ "interface":"eth-rt5-1" } ] + }, + "17100":{ + "inLabel":17100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.5.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.4.5" + } + ] + }, + "17101":{ + "inLabel":17101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5-2" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5-1" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt3/step6/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt3/step6/show_ip_route.ref index 46ebeb8ab9..55d8213c4e 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step6/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step6/show_ip_route.ref @@ -323,5 +323,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt3/step6/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt3/step6/show_ipv6_route.ref index b2c774d493..4f6441e7b9 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step6/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step6/show_ipv6_route.ref @@ -78,7 +78,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, "labels":[ 16051 @@ -87,7 +87,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "labels":[ 16051 @@ -109,7 +109,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, "labels":[ 16061 @@ -118,7 +118,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "labels":[ 16061 @@ -126,5 +126,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt3/step6/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt3/step6/show_mpls_table.ref index a1e64afd67..db8253f83d 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step6/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step6/show_mpls_table.ref @@ -164,5 +164,41 @@ "interface":"eth-rt5-1" } ] + }, + "17100":{ + "inLabel":17100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.5.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.4.5" + } + ] + }, + "17101":{ + "inLabel":17101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5-2" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5-1" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt3/step7/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt3/step7/show_ip_route.ref index 1e8c27c01f..7f6e05f08b 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step7/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step7/show_ip_route.ref @@ -320,5 +320,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt3/step7/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt3/step7/show_ipv6_route.ref index d21700d407..f4770e2ac9 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step7/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step7/show_ipv6_route.ref @@ -75,7 +75,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, "labels":[ 16051 @@ -84,7 +84,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "labels":[ 16051 @@ -106,7 +106,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, "labels":[ 16061 @@ -115,7 +115,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "labels":[ 16061 @@ -123,5 +123,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt3/step7/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt3/step7/show_mpls_table.ref index e97e0d017b..cb49505f55 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step7/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step7/show_mpls_table.ref @@ -140,5 +140,41 @@ "interface":"eth-rt5-1" } ] + }, + "17100":{ + "inLabel":17100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.5.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.4.5" + } + ] + }, + "17101":{ + "inLabel":17101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5-2" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5-1" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt3/step8/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt3/step8/show_ip_route.ref index 46ebeb8ab9..55d8213c4e 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step8/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step8/show_ip_route.ref @@ -323,5 +323,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt3/step8/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt3/step8/show_ipv6_route.ref index b2c774d493..4f6441e7b9 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step8/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step8/show_ipv6_route.ref @@ -78,7 +78,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, "labels":[ 16051 @@ -87,7 +87,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "labels":[ 16051 @@ -109,7 +109,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, "labels":[ 16061 @@ -118,7 +118,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "labels":[ 16061 @@ -126,5 +126,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt3/step8/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt3/step8/show_mpls_table.ref index a1e64afd67..db8253f83d 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step8/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step8/show_mpls_table.ref @@ -164,5 +164,41 @@ "interface":"eth-rt5-1" } ] + }, + "17100":{ + "inLabel":17100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.5.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.4.5" + } + ] + }, + "17101":{ + "inLabel":17101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5-2" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5-1" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt3/step9/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt3/step9/show_ip_route.ref index 9522b141b0..40a98ab7c6 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step9/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step9/show_ip_route.ref @@ -323,5 +323,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt3/step9/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt3/step9/show_ipv6_route.ref index fb630bc68f..1fb50407bd 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step9/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step9/show_ipv6_route.ref @@ -78,7 +78,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, "labels":[ 16051 @@ -87,7 +87,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "labels":[ 16051 @@ -109,7 +109,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, "labels":[ 16061 @@ -118,7 +118,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "labels":[ 16061 @@ -126,5 +126,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt3/step9/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt3/step9/show_mpls_table.ref index 4aec3b6904..44ddc4bc14 100644 --- a/tests/topotests/isis-sr-topo1/rt3/step9/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt3/step9/show_mpls_table.ref @@ -164,5 +164,41 @@ "interface":"eth-rt5-1" } ] + }, + "17100":{ + "inLabel":17100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.5.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.4.5" + } + ] + }, + "17101":{ + "inLabel":17101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5-2" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5-1" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt4/isisd.conf b/tests/topotests/isis-sr-topo1/rt4/isisd.conf index 39003b9d7b..3852b1962b 100644 --- a/tests/topotests/isis-sr-topo1/rt4/isisd.conf +++ b/tests/topotests/isis-sr-topo1/rt4/isisd.conf @@ -37,13 +37,15 @@ interface eth-rt6 isis hello-multiplier 3 ! router isis 1 + lsp-gen-interval 2 net 49.0000.0000.0000.0004.00 is-type level-1 - lsp-gen-interval 2 topology ipv6-unicast segment-routing on segment-routing global-block 16000 23999 segment-routing node-msd 8 segment-routing prefix 4.4.4.4/32 index 40 no-php-flag + segment-routing prefix 10.10.10.10/32 index 100 no-php-flag n-flag-clear segment-routing prefix 2001:db8:1000::4/128 index 41 no-php-flag + segment-routing prefix 2001:db8:1000::10/128 index 101 no-php-flag n-flag-clear ! diff --git a/tests/topotests/isis-sr-topo1/rt4/step1/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt4/step1/show_ip_route.ref index f06182b088..493f3ab60d 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step1/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step1/show_ip_route.ref @@ -319,5 +319,24 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.6.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt4/step1/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt4/step1/show_ipv6_route.ref index f5772f2726..217a4a5379 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step1/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step1/show_ipv6_route.ref @@ -12,7 +12,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16011 @@ -21,7 +21,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16011 @@ -43,7 +43,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16021 @@ -52,7 +52,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16021 @@ -74,7 +74,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16031 @@ -83,7 +83,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16031 @@ -92,7 +92,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt5", "active":true, "labels":[ 16031 diff --git a/tests/topotests/isis-sr-topo1/rt4/step1/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt4/step1/show_mpls_table.ref index b7fb69dcde..307403964a 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step1/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step1/show_mpls_table.ref @@ -7,13 +7,13 @@ "type":"SR (IS-IS)", "outLabel":16010, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16010, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -25,13 +25,13 @@ "type":"SR (IS-IS)", "outLabel":16011, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16011, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -43,13 +43,13 @@ "type":"SR (IS-IS)", "outLabel":16020, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16020, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -61,13 +61,13 @@ "type":"SR (IS-IS)", "outLabel":16021, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16021, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -79,13 +79,13 @@ "type":"SR (IS-IS)", "outLabel":16030, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16030, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" }, { "type":"SR (IS-IS)", @@ -103,13 +103,13 @@ "type":"SR (IS-IS)", "outLabel":16031, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16031, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" }, { "type":"SR (IS-IS)", @@ -188,5 +188,28 @@ "interface":"eth-rt6" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.6.5" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt4/step1/show_yang_interface_isis_adjacencies.ref b/tests/topotests/isis-sr-topo1/rt4/step1/show_yang_interface_isis_adjacencies.ref index 9d7a19e868..2eb64b6fc9 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step1/show_yang_interface_isis_adjacencies.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step1/show_yang_interface_isis_adjacencies.ref @@ -11,7 +11,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0002", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" @@ -31,7 +30,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0002", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" @@ -51,7 +49,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0005", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" @@ -71,7 +68,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0006", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" diff --git a/tests/topotests/isis-sr-topo1/rt4/step10/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt4/step10/show_ip_route.ref index d7d42120a0..11bc948319 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step10/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step10/show_ip_route.ref @@ -231,6 +231,7 @@ "metric":30, "nexthops":[ { + "fib":true, "ip":"10.0.7.6", "afi":"ipv4", "interfaceName":"eth-rt6", @@ -273,5 +274,24 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "distance":115, + "metric":30, + "nexthops":[ + { + "ip":"10.0.7.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", + "active":true, + "labels":[ + 18100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt4/step10/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt4/step10/show_ipv6_route.ref index 235c1facc6..844f6becf9 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step10/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step10/show_ipv6_route.ref @@ -12,7 +12,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16011 @@ -21,7 +21,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16011 @@ -43,7 +43,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16021 @@ -52,7 +52,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16021 @@ -74,7 +74,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16031 @@ -83,7 +83,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16031 diff --git a/tests/topotests/isis-sr-topo1/rt4/step10/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt4/step10/show_mpls_table.ref index 86ceaf4883..f275056070 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step10/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step10/show_mpls_table.ref @@ -19,13 +19,13 @@ "type":"SR (IS-IS)", "outLabel":16011, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16011, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -49,13 +49,13 @@ "type":"SR (IS-IS)", "outLabel":16021, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16021, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -79,13 +79,13 @@ "type":"SR (IS-IS)", "outLabel":16031, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16031, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -158,5 +158,28 @@ "interface":"eth-rt6" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":18100, + "installed":true, + "nexthop":"10.0.7.6" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt4/step2/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt4/step2/show_ip_route.ref index 4789f7268f..c2fbdeb30e 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step2/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step2/show_ip_route.ref @@ -289,6 +289,7 @@ "metric":30, "nexthops":[ { + "fib":true, "ip":"10.0.7.6", "afi":"ipv4", "interfaceName":"eth-rt6", @@ -331,5 +332,24 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "distance":115, + "metric":30, + "nexthops":[ + { + "ip":"10.0.7.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt4/step2/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt4/step2/show_ipv6_route.ref index 871b303cab..7f823b6896 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step2/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step2/show_ipv6_route.ref @@ -12,7 +12,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16011 @@ -21,7 +21,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16011 @@ -43,7 +43,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16021 @@ -52,7 +52,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16021 @@ -74,7 +74,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16031 @@ -83,7 +83,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16031 diff --git a/tests/topotests/isis-sr-topo1/rt4/step2/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt4/step2/show_mpls_table.ref index ff83c374f0..8dd37880d0 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step2/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step2/show_mpls_table.ref @@ -7,13 +7,13 @@ "type":"SR (IS-IS)", "outLabel":16010, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16010, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -25,13 +25,13 @@ "type":"SR (IS-IS)", "outLabel":16011, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16011, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -43,13 +43,13 @@ "type":"SR (IS-IS)", "outLabel":16020, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16020, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -61,13 +61,13 @@ "type":"SR (IS-IS)", "outLabel":16021, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16021, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -79,13 +79,13 @@ "type":"SR (IS-IS)", "outLabel":16030, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16030, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -97,13 +97,13 @@ "type":"SR (IS-IS)", "outLabel":16031, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16031, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -176,5 +176,28 @@ "interface":"eth-rt6" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.7.6" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt4/step2/show_yang_interface_isis_adjacencies.ref b/tests/topotests/isis-sr-topo1/rt4/step2/show_yang_interface_isis_adjacencies.ref index 5fb8a361ac..be1e00b8a2 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step2/show_yang_interface_isis_adjacencies.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step2/show_yang_interface_isis_adjacencies.ref @@ -11,7 +11,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0002", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" @@ -31,7 +30,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0002", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" @@ -51,7 +49,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0006", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" diff --git a/tests/topotests/isis-sr-topo1/rt4/step3/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt4/step3/show_ip_route.ref index d86562deb9..4dc0dd7cac 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step3/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step3/show_ip_route.ref @@ -262,12 +262,14 @@ "metric":40, "nexthops":[ { + "fib":true, "ip":"10.0.2.2", "afi":"ipv4", "interfaceName":"eth-rt2-1", "active":true }, { + "fib":true, "ip":"10.0.3.2", "afi":"ipv4", "interfaceName":"eth-rt2-2", @@ -276,6 +278,21 @@ ] } ], + "10.0.7.0\/24":[ + { + "prefix":"10.0.7.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.7.6", + "afi":"ipv4", + "interfaceName":"eth-rt6" + } + ] + } + ], "10.0.8.0\/24":[ { "prefix":"10.0.8.0\/24", @@ -302,5 +319,33 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "distance":115, + "metric":40, + "nexthops":[ + { + "ip":"10.0.2.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-1", + "active":true, + "labels":[ + 16100 + ] + }, + { + "ip":"10.0.3.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-2", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt4/step3/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt4/step3/show_ipv6_route.ref index c09f584641..34afda1966 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step3/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step3/show_ipv6_route.ref @@ -12,7 +12,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16011 @@ -21,7 +21,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16011 @@ -43,7 +43,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16021 @@ -52,7 +52,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16021 @@ -74,7 +74,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16031 @@ -83,7 +83,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16031 @@ -105,7 +105,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16051 @@ -114,7 +114,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16051 diff --git a/tests/topotests/isis-sr-topo1/rt4/step3/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt4/step3/show_mpls_table.ref index 85c6c055c9..65336d88d1 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step3/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step3/show_mpls_table.ref @@ -7,13 +7,13 @@ "type":"SR (IS-IS)", "outLabel":16010, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16010, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -25,13 +25,13 @@ "type":"SR (IS-IS)", "outLabel":16011, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16011, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -43,13 +43,13 @@ "type":"SR (IS-IS)", "outLabel":16020, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16020, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -61,13 +61,13 @@ "type":"SR (IS-IS)", "outLabel":16021, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16021, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -79,13 +79,13 @@ "type":"SR (IS-IS)", "outLabel":16030, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16030, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -97,13 +97,13 @@ "type":"SR (IS-IS)", "outLabel":16031, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16031, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -137,13 +137,13 @@ "type":"SR (IS-IS)", "outLabel":16050, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16050, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -155,13 +155,42 @@ "type":"SR (IS-IS)", "outLabel":16051, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16051, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" + } + ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.2.2" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.3.2" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true } ] } diff --git a/tests/topotests/isis-sr-topo1/rt4/step3/show_yang_interface_isis_adjacencies.ref b/tests/topotests/isis-sr-topo1/rt4/step3/show_yang_interface_isis_adjacencies.ref index 2a56f54e16..bcade1ca90 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step3/show_yang_interface_isis_adjacencies.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step3/show_yang_interface_isis_adjacencies.ref @@ -11,7 +11,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0002", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" @@ -31,7 +30,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0002", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" diff --git a/tests/topotests/isis-sr-topo1/rt4/step4/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt4/step4/show_ip_route.ref index 3c7dfda0a3..e930657f8d 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step4/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step4/show_ip_route.ref @@ -289,6 +289,7 @@ "metric":30, "nexthops":[ { + "fib":true, "ip":"10.0.7.6", "afi":"ipv4", "interfaceName":"eth-rt6", @@ -331,5 +332,24 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "distance":115, + "metric":30, + "nexthops":[ + { + "ip":"10.0.7.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", + "active":true, + "labels":[ + 18100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt4/step4/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt4/step4/show_ipv6_route.ref index 38b51822dd..ca61c6e81f 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step4/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step4/show_ipv6_route.ref @@ -12,7 +12,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16011 @@ -21,7 +21,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16011 @@ -43,7 +43,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16021 @@ -52,7 +52,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16021 @@ -74,7 +74,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16031 @@ -83,7 +83,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16031 diff --git a/tests/topotests/isis-sr-topo1/rt4/step4/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt4/step4/show_mpls_table.ref index 4e5638f34f..eb95fa94c9 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step4/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step4/show_mpls_table.ref @@ -7,13 +7,13 @@ "type":"SR (IS-IS)", "outLabel":16010, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16010, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -25,13 +25,13 @@ "type":"SR (IS-IS)", "outLabel":16011, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16011, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -43,13 +43,13 @@ "type":"SR (IS-IS)", "outLabel":16020, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16020, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -61,13 +61,13 @@ "type":"SR (IS-IS)", "outLabel":16021, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16021, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -79,13 +79,13 @@ "type":"SR (IS-IS)", "outLabel":16030, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16030, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -97,13 +97,13 @@ "type":"SR (IS-IS)", "outLabel":16031, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16031, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -176,5 +176,28 @@ "interface":"eth-rt6" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":18100, + "installed":true, + "nexthop":"10.0.7.6" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt4/step5/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt4/step5/show_ip_route.ref index 90f69c06b8..8b0ddd4ee5 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step5/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step5/show_ip_route.ref @@ -283,6 +283,7 @@ "metric":30, "nexthops":[ { + "fib":true, "ip":"10.0.7.6", "afi":"ipv4", "interfaceName":"eth-rt6", @@ -325,5 +326,22 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "distance":115, + "metric":30, + "nexthops":[ + { + "fib":true, + "ip":"10.0.7.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", + "active":true + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt4/step5/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt4/step5/show_ipv6_route.ref index 04056ed873..94e1fac450 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step5/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step5/show_ipv6_route.ref @@ -12,7 +12,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16011 @@ -21,7 +21,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16011 @@ -43,7 +43,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16021 @@ -52,7 +52,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16021 @@ -74,7 +74,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16031 @@ -83,7 +83,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16031 diff --git a/tests/topotests/isis-sr-topo1/rt4/step5/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt4/step5/show_mpls_table.ref index 4df722be4f..cd47cfa3a7 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step5/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step5/show_mpls_table.ref @@ -7,13 +7,13 @@ "type":"SR (IS-IS)", "outLabel":16010, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16010, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -25,13 +25,13 @@ "type":"SR (IS-IS)", "outLabel":16011, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16011, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -43,13 +43,13 @@ "type":"SR (IS-IS)", "outLabel":16020, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16020, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -61,13 +61,13 @@ "type":"SR (IS-IS)", "outLabel":16021, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16021, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -79,13 +79,13 @@ "type":"SR (IS-IS)", "outLabel":16030, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16030, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -97,13 +97,13 @@ "type":"SR (IS-IS)", "outLabel":16031, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16031, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -128,5 +128,16 @@ "installed":true } ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt4/step6/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt4/step6/show_ip_route.ref index 3c7dfda0a3..e930657f8d 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step6/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step6/show_ip_route.ref @@ -289,6 +289,7 @@ "metric":30, "nexthops":[ { + "fib":true, "ip":"10.0.7.6", "afi":"ipv4", "interfaceName":"eth-rt6", @@ -331,5 +332,24 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "distance":115, + "metric":30, + "nexthops":[ + { + "ip":"10.0.7.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", + "active":true, + "labels":[ + 18100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt4/step6/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt4/step6/show_ipv6_route.ref index 38b51822dd..ca61c6e81f 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step6/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step6/show_ipv6_route.ref @@ -12,7 +12,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16011 @@ -21,7 +21,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16011 @@ -43,7 +43,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16021 @@ -52,7 +52,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16021 @@ -74,7 +74,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16031 @@ -83,7 +83,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16031 diff --git a/tests/topotests/isis-sr-topo1/rt4/step6/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt4/step6/show_mpls_table.ref index 4e5638f34f..eb95fa94c9 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step6/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step6/show_mpls_table.ref @@ -7,13 +7,13 @@ "type":"SR (IS-IS)", "outLabel":16010, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16010, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -25,13 +25,13 @@ "type":"SR (IS-IS)", "outLabel":16011, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16011, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -43,13 +43,13 @@ "type":"SR (IS-IS)", "outLabel":16020, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16020, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -61,13 +61,13 @@ "type":"SR (IS-IS)", "outLabel":16021, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16021, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -79,13 +79,13 @@ "type":"SR (IS-IS)", "outLabel":16030, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16030, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -97,13 +97,13 @@ "type":"SR (IS-IS)", "outLabel":16031, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16031, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -176,5 +176,28 @@ "interface":"eth-rt6" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":18100, + "installed":true, + "nexthop":"10.0.7.6" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt4/step7/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt4/step7/show_ip_route.ref index a3ac4ac109..f5ac45504e 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step7/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step7/show_ip_route.ref @@ -283,6 +283,7 @@ "metric":30, "nexthops":[ { + "fib":true, "ip":"10.0.7.6", "afi":"ipv4", "interfaceName":"eth-rt6", @@ -325,5 +326,24 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "distance":115, + "metric":30, + "nexthops":[ + { + "ip":"10.0.7.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", + "active":true, + "labels":[ + 18100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt4/step7/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt4/step7/show_ipv6_route.ref index c59abbd2f5..1599c88122 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step7/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step7/show_ipv6_route.ref @@ -12,13 +12,13 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true }, { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true } ] @@ -37,7 +37,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16021 @@ -46,7 +46,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16021 @@ -68,7 +68,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16031 @@ -77,7 +77,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16031 diff --git a/tests/topotests/isis-sr-topo1/rt4/step7/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt4/step7/show_mpls_table.ref index 512c057b31..19b0beb164 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step7/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step7/show_mpls_table.ref @@ -7,13 +7,13 @@ "type":"SR (IS-IS)", "outLabel":16020, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16020, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -25,13 +25,13 @@ "type":"SR (IS-IS)", "outLabel":16021, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16021, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -43,13 +43,13 @@ "type":"SR (IS-IS)", "outLabel":16030, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16030, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -61,13 +61,13 @@ "type":"SR (IS-IS)", "outLabel":16031, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16031, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -140,5 +140,28 @@ "interface":"eth-rt6" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":18100, + "installed":true, + "nexthop":"10.0.7.6" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt4/step8/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt4/step8/show_ip_route.ref index 3c7dfda0a3..e930657f8d 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step8/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step8/show_ip_route.ref @@ -289,6 +289,7 @@ "metric":30, "nexthops":[ { + "fib":true, "ip":"10.0.7.6", "afi":"ipv4", "interfaceName":"eth-rt6", @@ -331,5 +332,24 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "distance":115, + "metric":30, + "nexthops":[ + { + "ip":"10.0.7.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", + "active":true, + "labels":[ + 18100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt4/step8/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt4/step8/show_ipv6_route.ref index 38b51822dd..ca61c6e81f 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step8/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step8/show_ipv6_route.ref @@ -12,7 +12,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16011 @@ -21,7 +21,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16011 @@ -43,7 +43,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16021 @@ -52,7 +52,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16021 @@ -74,7 +74,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16031 @@ -83,7 +83,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16031 diff --git a/tests/topotests/isis-sr-topo1/rt4/step8/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt4/step8/show_mpls_table.ref index 4e5638f34f..eb95fa94c9 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step8/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step8/show_mpls_table.ref @@ -7,13 +7,13 @@ "type":"SR (IS-IS)", "outLabel":16010, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16010, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -25,13 +25,13 @@ "type":"SR (IS-IS)", "outLabel":16011, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16011, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -43,13 +43,13 @@ "type":"SR (IS-IS)", "outLabel":16020, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16020, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -61,13 +61,13 @@ "type":"SR (IS-IS)", "outLabel":16021, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16021, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -79,13 +79,13 @@ "type":"SR (IS-IS)", "outLabel":16030, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16030, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -97,13 +97,13 @@ "type":"SR (IS-IS)", "outLabel":16031, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16031, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -176,5 +176,28 @@ "interface":"eth-rt6" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":18100, + "installed":true, + "nexthop":"10.0.7.6" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt4/step9/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt4/step9/show_ip_route.ref index 73598e4605..a2b939a418 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step9/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step9/show_ip_route.ref @@ -289,6 +289,7 @@ "metric":30, "nexthops":[ { + "fib":true, "ip":"10.0.7.6", "afi":"ipv4", "interfaceName":"eth-rt6", @@ -331,5 +332,24 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "distance":115, + "metric":30, + "nexthops":[ + { + "ip":"10.0.7.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", + "active":true, + "labels":[ + 18100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt4/step9/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt4/step9/show_ipv6_route.ref index 235c1facc6..844f6becf9 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step9/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step9/show_ipv6_route.ref @@ -12,7 +12,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16011 @@ -21,7 +21,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16011 @@ -43,7 +43,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16021 @@ -52,7 +52,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16021 @@ -74,7 +74,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16031 @@ -83,7 +83,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16031 diff --git a/tests/topotests/isis-sr-topo1/rt4/step9/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt4/step9/show_mpls_table.ref index 5cdd99e425..5805bf3556 100644 --- a/tests/topotests/isis-sr-topo1/rt4/step9/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt4/step9/show_mpls_table.ref @@ -7,13 +7,13 @@ "type":"SR (IS-IS)", "outLabel":16010, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16010, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -25,13 +25,13 @@ "type":"SR (IS-IS)", "outLabel":16011, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16011, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -43,13 +43,13 @@ "type":"SR (IS-IS)", "outLabel":16020, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16020, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -61,13 +61,13 @@ "type":"SR (IS-IS)", "outLabel":16021, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16021, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -79,13 +79,13 @@ "type":"SR (IS-IS)", "outLabel":16030, "installed":true, - "nexthop":"10.0.3.2" + "nexthop":"10.0.2.2" }, { "type":"SR (IS-IS)", "outLabel":16030, "installed":true, - "nexthop":"10.0.2.2" + "nexthop":"10.0.3.2" } ] }, @@ -97,13 +97,13 @@ "type":"SR (IS-IS)", "outLabel":16031, "installed":true, - "interface":"eth-rt2-2" + "interface":"eth-rt2-1" }, { "type":"SR (IS-IS)", "outLabel":16031, "installed":true, - "interface":"eth-rt2-1" + "interface":"eth-rt2-2" } ] }, @@ -176,5 +176,28 @@ "interface":"eth-rt6" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":18100, + "installed":true, + "nexthop":"10.0.7.6" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt4/zebra.conf b/tests/topotests/isis-sr-topo1/rt4/zebra.conf index 4945897e9d..5889901c56 100644 --- a/tests/topotests/isis-sr-topo1/rt4/zebra.conf +++ b/tests/topotests/isis-sr-topo1/rt4/zebra.conf @@ -8,7 +8,9 @@ debug zebra mpls ! interface lo ip address 4.4.4.4/32 + ip address 10.10.10.10/32 ipv6 address 2001:db8:1000::4/128 + ipv6 address 2001:db8:1000::10/128 ! interface eth-rt2-1 ip address 10.0.2.4/24 diff --git a/tests/topotests/isis-sr-topo1/rt5/isisd.conf b/tests/topotests/isis-sr-topo1/rt5/isisd.conf index e693ca156c..f7beea796c 100644 --- a/tests/topotests/isis-sr-topo1/rt5/isisd.conf +++ b/tests/topotests/isis-sr-topo1/rt5/isisd.conf @@ -37,13 +37,15 @@ interface eth-rt6 isis hello-multiplier 3 ! router isis 1 + lsp-gen-interval 2 net 49.0000.0000.0000.0005.00 is-type level-1 - lsp-gen-interval 2 topology ipv6-unicast segment-routing on segment-routing global-block 16000 23999 segment-routing node-msd 8 segment-routing prefix 5.5.5.5/32 index 50 no-php-flag + segment-routing prefix 10.10.10.10/32 index 100 no-php-flag n-flag-clear segment-routing prefix 2001:db8:1000::5/128 index 51 no-php-flag + segment-routing prefix 2001:db8:1000::10/128 index 101 no-php-flag n-flag-clear ! diff --git a/tests/topotests/isis-sr-topo1/rt5/step1/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step1/show_ip_route.ref index 8eaf40f236..0497bd8399 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step1/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step1/show_ip_route.ref @@ -319,5 +319,24 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt5/step1/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt5/step1/show_mpls_table.ref index 9054c9c4af..99d1f773b7 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step1/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step1/show_mpls_table.ref @@ -188,5 +188,28 @@ "interface":"eth-rt6" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.6.4" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt5/step1/show_yang_interface_isis_adjacencies.ref b/tests/topotests/isis-sr-topo1/rt5/step1/show_yang_interface_isis_adjacencies.ref index 4a3e626123..1ff8c2cd4e 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step1/show_yang_interface_isis_adjacencies.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step1/show_yang_interface_isis_adjacencies.ref @@ -11,7 +11,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0003", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" @@ -31,7 +30,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0003", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" @@ -51,7 +49,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0004", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" @@ -71,7 +68,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0006", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" diff --git a/tests/topotests/isis-sr-topo1/rt5/step10/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step10/show_ip_route.ref index a5a0bacaad..620f5eac67 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step10/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step10/show_ip_route.ref @@ -274,6 +274,21 @@ ] } ], + "10.0.6.0\/24":[ + { + "prefix":"10.0.6.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", @@ -308,5 +323,24 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "distance":115, + "metric":30, + "nexthops":[ + { + "ip":"10.0.8.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", + "active":true, + "labels":[ + 18100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt5/step10/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt5/step10/show_mpls_table.ref index e43ef6671d..7cfea2a329 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step10/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step10/show_mpls_table.ref @@ -176,5 +176,28 @@ "interface":"eth-rt6" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":18100, + "installed":true, + "nexthop":"10.0.8.6" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt5/step2/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step2/show_ip_route.ref index 101b811d3b..19cdf9d896 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step2/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step2/show_ip_route.ref @@ -281,6 +281,21 @@ ] } ], + "10.0.6.0\/24":[ + { + "prefix":"10.0.6.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", @@ -315,5 +330,24 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "distance":115, + "metric":30, + "nexthops":[ + { + "ip":"10.0.8.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt5/step2/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt5/step2/show_mpls_table.ref index 660e319a50..08f1635a39 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step2/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step2/show_mpls_table.ref @@ -176,5 +176,28 @@ "interface":"eth-rt6" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.8.6" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt5/step2/show_yang_interface_isis_adjacencies.ref b/tests/topotests/isis-sr-topo1/rt5/step2/show_yang_interface_isis_adjacencies.ref index ae26b5be99..d9ac0a8d00 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step2/show_yang_interface_isis_adjacencies.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step2/show_yang_interface_isis_adjacencies.ref @@ -11,7 +11,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0003", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" @@ -31,7 +30,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0003", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" @@ -51,7 +49,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0006", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" diff --git a/tests/topotests/isis-sr-topo1/rt5/step3/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step3/show_ip_route.ref index dff6c5f7eb..48b5e6491e 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step3/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step3/show_ip_route.ref @@ -254,6 +254,21 @@ ] } ], + "10.0.6.0\/24":[ + { + "prefix":"10.0.6.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", @@ -280,5 +295,33 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "distance":115, + "metric":40, + "nexthops":[ + { + "ip":"10.0.4.3", + "afi":"ipv4", + "interfaceName":"eth-rt3-1", + "active":true, + "labels":[ + 17100 + ] + }, + { + "ip":"10.0.5.3", + "afi":"ipv4", + "interfaceName":"eth-rt3-2", + "active":true, + "labels":[ + 17100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt5/step3/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt5/step3/show_mpls_table.ref index 9df3fc9ef6..9980058b12 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step3/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step3/show_mpls_table.ref @@ -164,5 +164,34 @@ "installed":true } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":17100, + "installed":true, + "nexthop":"10.0.5.3" + }, + { + "type":"SR (IS-IS)", + "outLabel":17100, + "installed":true, + "nexthop":"10.0.4.3" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt5/step3/show_yang_interface_isis_adjacencies.ref b/tests/topotests/isis-sr-topo1/rt5/step3/show_yang_interface_isis_adjacencies.ref index 7e62a65ea1..0b8e6ba5b9 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step3/show_yang_interface_isis_adjacencies.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step3/show_yang_interface_isis_adjacencies.ref @@ -11,7 +11,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0003", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" @@ -31,7 +30,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0003", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" diff --git a/tests/topotests/isis-sr-topo1/rt5/step4/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step4/show_ip_route.ref index 6b29ff2d44..156beef0f1 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step4/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step4/show_ip_route.ref @@ -281,6 +281,21 @@ ] } ], + "10.0.6.0\/24":[ + { + "prefix":"10.0.6.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", @@ -301,17 +316,21 @@ ] } ], - "10.0.8.0\/24":[ + "10.10.10.10\/32":[ { - "prefix":"10.0.8.0\/24", + "prefix":"10.10.10.10\/32", "protocol":"isis", "distance":115, - "metric":20, + "metric":30, "nexthops":[ { "ip":"10.0.8.6", "afi":"ipv4", - "interfaceName":"eth-rt6" + "interfaceName":"eth-rt6", + "active":true, + "labels":[ + 18100 + ] } ] } diff --git a/tests/topotests/isis-sr-topo1/rt5/step4/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt5/step4/show_mpls_table.ref index 4d13108d7d..a84ed90b25 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step4/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step4/show_mpls_table.ref @@ -176,5 +176,28 @@ "interface":"eth-rt6" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":18100, + "installed":true, + "nexthop":"10.0.8.6" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt5/step4/show_yang_interface_isis_adjacencies.ref b/tests/topotests/isis-sr-topo1/rt5/step4/show_yang_interface_isis_adjacencies.ref index ae26b5be99..d9ac0a8d00 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step4/show_yang_interface_isis_adjacencies.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step4/show_yang_interface_isis_adjacencies.ref @@ -11,7 +11,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0003", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" @@ -31,7 +30,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0003", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" @@ -51,7 +49,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0006", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" diff --git a/tests/topotests/isis-sr-topo1/rt5/step5/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step5/show_ip_route.ref index cadb674ba3..dba5e8d8a2 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step5/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step5/show_ip_route.ref @@ -275,6 +275,21 @@ ] } ], + "10.0.6.0\/24":[ + { + "prefix":"10.0.6.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", @@ -295,17 +310,19 @@ ] } ], - "10.0.8.0\/24":[ + "10.10.10.10\/32":[ { - "prefix":"10.0.8.0\/24", + "prefix":"10.10.10.10\/32", "protocol":"isis", "distance":115, - "metric":20, + "metric":30, "nexthops":[ { + "fib":true, "ip":"10.0.8.6", "afi":"ipv4", - "interfaceName":"eth-rt6" + "interfaceName":"eth-rt6", + "active":true } ] } diff --git a/tests/topotests/isis-sr-topo1/rt5/step5/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt5/step5/show_mpls_table.ref index c60383093f..36c21b041f 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step5/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step5/show_mpls_table.ref @@ -128,5 +128,16 @@ "installed":true } ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt5/step6/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step6/show_ip_route.ref index 6b29ff2d44..156beef0f1 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step6/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step6/show_ip_route.ref @@ -281,6 +281,21 @@ ] } ], + "10.0.6.0\/24":[ + { + "prefix":"10.0.6.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", @@ -301,17 +316,21 @@ ] } ], - "10.0.8.0\/24":[ + "10.10.10.10\/32":[ { - "prefix":"10.0.8.0\/24", + "prefix":"10.10.10.10\/32", "protocol":"isis", "distance":115, - "metric":20, + "metric":30, "nexthops":[ { "ip":"10.0.8.6", "afi":"ipv4", - "interfaceName":"eth-rt6" + "interfaceName":"eth-rt6", + "active":true, + "labels":[ + 18100 + ] } ] } diff --git a/tests/topotests/isis-sr-topo1/rt5/step6/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt5/step6/show_mpls_table.ref index 4d13108d7d..a84ed90b25 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step6/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step6/show_mpls_table.ref @@ -176,5 +176,28 @@ "interface":"eth-rt6" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":18100, + "installed":true, + "nexthop":"10.0.8.6" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt5/step7/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step7/show_ip_route.ref index 72b89ccf69..ece747bdac 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step7/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step7/show_ip_route.ref @@ -275,6 +275,21 @@ ] } ], + "10.0.6.0\/24":[ + { + "prefix":"10.0.6.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", @@ -295,17 +310,21 @@ ] } ], - "10.0.8.0\/24":[ + "10.10.10.10\/32":[ { - "prefix":"10.0.8.0\/24", + "prefix":"10.10.10.10\/32", "protocol":"isis", "distance":115, - "metric":20, + "metric":30, "nexthops":[ { "ip":"10.0.8.6", "afi":"ipv4", - "interfaceName":"eth-rt6" + "interfaceName":"eth-rt6", + "active":true, + "labels":[ + 18100 + ] } ] } diff --git a/tests/topotests/isis-sr-topo1/rt5/step7/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt5/step7/show_mpls_table.ref index 2b1e67ea71..c98da7effd 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step7/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step7/show_mpls_table.ref @@ -140,5 +140,28 @@ "interface":"eth-rt6" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":18100, + "installed":true, + "nexthop":"10.0.8.6" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt5/step8/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step8/show_ip_route.ref index 6b29ff2d44..156beef0f1 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step8/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step8/show_ip_route.ref @@ -281,6 +281,21 @@ ] } ], + "10.0.6.0\/24":[ + { + "prefix":"10.0.6.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", @@ -301,17 +316,21 @@ ] } ], - "10.0.8.0\/24":[ + "10.10.10.10\/32":[ { - "prefix":"10.0.8.0\/24", + "prefix":"10.10.10.10\/32", "protocol":"isis", "distance":115, - "metric":20, + "metric":30, "nexthops":[ { "ip":"10.0.8.6", "afi":"ipv4", - "interfaceName":"eth-rt6" + "interfaceName":"eth-rt6", + "active":true, + "labels":[ + 18100 + ] } ] } diff --git a/tests/topotests/isis-sr-topo1/rt5/step8/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt5/step8/show_mpls_table.ref index 4d13108d7d..a84ed90b25 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step8/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step8/show_mpls_table.ref @@ -176,5 +176,28 @@ "interface":"eth-rt6" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":18100, + "installed":true, + "nexthop":"10.0.8.6" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt5/step9/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt5/step9/show_ip_route.ref index cc37894d67..90588c6708 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step9/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step9/show_ip_route.ref @@ -281,6 +281,21 @@ ] } ], + "10.0.6.0\/24":[ + { + "prefix":"10.0.6.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4" + } + ] + } + ], "10.0.7.0\/24":[ { "prefix":"10.0.7.0\/24", @@ -301,17 +316,21 @@ ] } ], - "10.0.8.0\/24":[ + "10.10.10.10\/32":[ { - "prefix":"10.0.8.0\/24", + "prefix":"10.10.10.10\/32", "protocol":"isis", "distance":115, - "metric":20, + "metric":30, "nexthops":[ { "ip":"10.0.8.6", "afi":"ipv4", - "interfaceName":"eth-rt6" + "interfaceName":"eth-rt6", + "active":true, + "labels":[ + 18100 + ] } ] } diff --git a/tests/topotests/isis-sr-topo1/rt5/step9/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt5/step9/show_mpls_table.ref index e43ef6671d..7cfea2a329 100644 --- a/tests/topotests/isis-sr-topo1/rt5/step9/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt5/step9/show_mpls_table.ref @@ -176,5 +176,28 @@ "interface":"eth-rt6" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":18100, + "installed":true, + "nexthop":"10.0.8.6" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt5/zebra.conf b/tests/topotests/isis-sr-topo1/rt5/zebra.conf index 4cfea1a59f..a0c8f2cd7e 100644 --- a/tests/topotests/isis-sr-topo1/rt5/zebra.conf +++ b/tests/topotests/isis-sr-topo1/rt5/zebra.conf @@ -8,7 +8,9 @@ debug zebra mpls ! interface lo ip address 5.5.5.5/32 + ip address 10.10.10.10/32 ipv6 address 2001:db8:1000::5/128 + ipv6 address 2001:db8:1000::10/128 ! interface eth-rt3-1 ip address 10.0.4.5/24 diff --git a/tests/topotests/isis-sr-topo1/rt6/isisd.conf b/tests/topotests/isis-sr-topo1/rt6/isisd.conf index 3b85dbae4e..a29b78f0a4 100644 --- a/tests/topotests/isis-sr-topo1/rt6/isisd.conf +++ b/tests/topotests/isis-sr-topo1/rt6/isisd.conf @@ -25,9 +25,9 @@ interface eth-rt5 isis hello-multiplier 3 ! router isis 1 + lsp-gen-interval 2 net 49.0000.0000.0000.0006.00 is-type level-1 - lsp-gen-interval 2 topology ipv6-unicast segment-routing on segment-routing global-block 16000 23999 diff --git a/tests/topotests/isis-sr-topo1/rt6/step1/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt6/step1/show_ip_route.ref index 324b71f7b8..7b62b0a9c6 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step1/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step1/show_ip_route.ref @@ -287,5 +287,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt6/step1/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt6/step1/show_ipv6_route.ref index eee9dea4d3..834cdfe6ca 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step1/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step1/show_ipv6_route.ref @@ -12,7 +12,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5", + "interfaceName":"eth-rt4", "active":true, "labels":[ 16011 @@ -21,7 +21,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4", + "interfaceName":"eth-rt5", "active":true, "labels":[ 16011 @@ -117,5 +117,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt6/step1/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt6/step1/show_mpls_table.ref index 970251fe8a..2c526e74f0 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step1/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step1/show_mpls_table.ref @@ -130,5 +130,41 @@ "interface":"eth-rt5" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.8.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.7.4" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt4" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt6/step1/show_yang_interface_isis_adjacencies.ref b/tests/topotests/isis-sr-topo1/rt6/step1/show_yang_interface_isis_adjacencies.ref index 49c40a471c..734832358f 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step1/show_yang_interface_isis_adjacencies.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step1/show_yang_interface_isis_adjacencies.ref @@ -11,7 +11,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0004", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" @@ -31,7 +30,6 @@ { "neighbor-sys-type": "level-1", "neighbor-sysid": "0000.0000.0005", - "neighbor-extended-circuit-id": 0, "hold-timer": 9, "neighbor-priority": 0, "state": "up" diff --git a/tests/topotests/isis-sr-topo1/rt6/step10/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt6/step10/show_ip_route.ref index 9d0c331ff2..d430ef5a33 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step10/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step10/show_ip_route.ref @@ -280,5 +280,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt6/step10/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt6/step10/show_ipv6_route.ref index eee9dea4d3..834cdfe6ca 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step10/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step10/show_ipv6_route.ref @@ -12,7 +12,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5", + "interfaceName":"eth-rt4", "active":true, "labels":[ 16011 @@ -21,7 +21,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4", + "interfaceName":"eth-rt5", "active":true, "labels":[ 16011 @@ -117,5 +117,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt6/step10/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt6/step10/show_mpls_table.ref index a79406b300..be87ed90a0 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step10/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step10/show_mpls_table.ref @@ -130,5 +130,41 @@ "interface":"eth-rt5" } ] + }, + "18100":{ + "inLabel":18100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.8.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.7.4" + } + ] + }, + "18101":{ + "inLabel":18101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt4" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt6/step2/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt6/step2/show_ip_route.ref index e4df0d846e..4b204dbc4c 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step2/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step2/show_ip_route.ref @@ -280,5 +280,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt6/step2/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt6/step2/show_ipv6_route.ref index eee9dea4d3..834cdfe6ca 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step2/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step2/show_ipv6_route.ref @@ -12,7 +12,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5", + "interfaceName":"eth-rt4", "active":true, "labels":[ 16011 @@ -21,7 +21,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4", + "interfaceName":"eth-rt5", "active":true, "labels":[ 16011 @@ -117,5 +117,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt6/step2/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt6/step2/show_mpls_table.ref index 970251fe8a..2c526e74f0 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step2/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step2/show_mpls_table.ref @@ -130,5 +130,41 @@ "interface":"eth-rt5" } ] + }, + "16100":{ + "inLabel":16100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.8.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.7.4" + } + ] + }, + "16101":{ + "inLabel":16101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt4" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt6/step4/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt6/step4/show_ip_route.ref index e4df0d846e..4b204dbc4c 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step4/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step4/show_ip_route.ref @@ -280,5 +280,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt6/step4/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt6/step4/show_ipv6_route.ref index eee9dea4d3..834cdfe6ca 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step4/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step4/show_ipv6_route.ref @@ -12,7 +12,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5", + "interfaceName":"eth-rt4", "active":true, "labels":[ 16011 @@ -21,7 +21,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4", + "interfaceName":"eth-rt5", "active":true, "labels":[ 16011 @@ -117,5 +117,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt6/step4/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt6/step4/show_mpls_table.ref index a79406b300..be87ed90a0 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step4/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step4/show_mpls_table.ref @@ -130,5 +130,41 @@ "interface":"eth-rt5" } ] + }, + "18100":{ + "inLabel":18100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.8.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.7.4" + } + ] + }, + "18101":{ + "inLabel":18101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt4" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt6/step5/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt6/step5/show_ip_route.ref index c200a9f476..4b204dbc4c 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step5/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step5/show_ip_route.ref @@ -14,14 +14,20 @@ "ip":"10.0.7.4", "afi":"ipv4", "interfaceName":"eth-rt4", - "active":true + "active":true, + "labels":[ + 16010 + ] }, { "fib":true, "ip":"10.0.8.5", "afi":"ipv4", "interfaceName":"eth-rt5", - "active":true + "active":true, + "labels":[ + 16010 + ] } ] } @@ -41,7 +47,10 @@ "ip":"10.0.7.4", "afi":"ipv4", "interfaceName":"eth-rt4", - "active":true + "active":true, + "labels":[ + 16020 + ] } ] } @@ -61,7 +70,10 @@ "ip":"10.0.8.5", "afi":"ipv4", "interfaceName":"eth-rt5", - "active":true + "active":true, + "labels":[ + 16030 + ] } ] } @@ -81,7 +93,10 @@ "ip":"10.0.7.4", "afi":"ipv4", "interfaceName":"eth-rt4", - "active":true + "active":true, + "labels":[ + 16040 + ] } ] } @@ -101,7 +116,10 @@ "ip":"10.0.8.5", "afi":"ipv4", "interfaceName":"eth-rt5", - "active":true + "active":true, + "labels":[ + 16050 + ] } ] } @@ -262,5 +280,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt6/step5/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt6/step5/show_ipv6_route.ref index 2bf4b70be8..834cdfe6ca 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step5/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step5/show_ipv6_route.ref @@ -12,14 +12,20 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5", - "active":true + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16011 + ] }, { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4", - "active":true + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16011 + ] } ] } @@ -38,7 +44,10 @@ "fib":true, "afi":"ipv6", "interfaceName":"eth-rt4", - "active":true + "active":true, + "labels":[ + 16021 + ] } ] } @@ -57,7 +66,10 @@ "fib":true, "afi":"ipv6", "interfaceName":"eth-rt5", - "active":true + "active":true, + "labels":[ + 16031 + ] } ] } @@ -76,7 +88,10 @@ "fib":true, "afi":"ipv6", "interfaceName":"eth-rt4", - "active":true + "active":true, + "labels":[ + 16041 + ] } ] } @@ -95,7 +110,41 @@ "fib":true, "afi":"ipv6", "interfaceName":"eth-rt5", - "active":true + "active":true, + "labels":[ + 16051 + ] + } + ] + } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16101 + ] } ] } diff --git a/tests/topotests/isis-sr-topo1/rt6/step5/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt6/step5/show_mpls_table.ref index 2c63c08510..be87ed90a0 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step5/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step5/show_mpls_table.ref @@ -1,2 +1,170 @@ { + "18010":{ + "inLabel":18010, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16010, + "installed":true, + "nexthop":"10.0.8.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16010, + "installed":true, + "nexthop":"10.0.7.4" + } + ] + }, + "18011":{ + "inLabel":18011, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16011, + "installed":true, + "interface":"eth-rt5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16011, + "installed":true, + "interface":"eth-rt4" + } + ] + }, + "18020":{ + "inLabel":18020, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16020, + "installed":true, + "nexthop":"10.0.7.4" + } + ] + }, + "18021":{ + "inLabel":18021, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16021, + "installed":true, + "interface":"eth-rt4" + } + ] + }, + "18030":{ + "inLabel":18030, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16030, + "installed":true, + "nexthop":"10.0.8.5" + } + ] + }, + "18031":{ + "inLabel":18031, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16031, + "installed":true, + "interface":"eth-rt5" + } + ] + }, + "18040":{ + "inLabel":18040, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16040, + "installed":true, + "nexthop":"10.0.7.4" + } + ] + }, + "18041":{ + "inLabel":18041, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16041, + "installed":true, + "interface":"eth-rt4" + } + ] + }, + "18050":{ + "inLabel":18050, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16050, + "installed":true, + "nexthop":"10.0.8.5" + } + ] + }, + "18051":{ + "inLabel":18051, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16051, + "installed":true, + "interface":"eth-rt5" + } + ] + }, + "18100":{ + "inLabel":18100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.8.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.7.4" + } + ] + }, + "18101":{ + "inLabel":18101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt4" + } + ] + } } diff --git a/tests/topotests/isis-sr-topo1/rt6/step6/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt6/step6/show_ip_route.ref index e4df0d846e..4b204dbc4c 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step6/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step6/show_ip_route.ref @@ -280,5 +280,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt6/step6/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt6/step6/show_ipv6_route.ref index eee9dea4d3..834cdfe6ca 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step6/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step6/show_ipv6_route.ref @@ -12,7 +12,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5", + "interfaceName":"eth-rt4", "active":true, "labels":[ 16011 @@ -21,7 +21,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4", + "interfaceName":"eth-rt5", "active":true, "labels":[ 16011 @@ -117,5 +117,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt6/step6/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt6/step6/show_mpls_table.ref index a79406b300..be87ed90a0 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step6/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step6/show_mpls_table.ref @@ -130,5 +130,41 @@ "interface":"eth-rt5" } ] + }, + "18100":{ + "inLabel":18100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.8.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.7.4" + } + ] + }, + "18101":{ + "inLabel":18101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt4" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt6/step7/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt6/step7/show_ip_route.ref index b21e5db928..1787988207 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step7/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step7/show_ip_route.ref @@ -274,5 +274,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt6/step7/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt6/step7/show_ipv6_route.ref index dfbb1954b8..367d0ed173 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step7/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step7/show_ipv6_route.ref @@ -12,13 +12,13 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5", + "interfaceName":"eth-rt4", "active":true }, { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4", + "interfaceName":"eth-rt5", "active":true } ] @@ -111,5 +111,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt6/step7/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt6/step7/show_mpls_table.ref index 43d771bcbd..b44dda298e 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step7/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step7/show_mpls_table.ref @@ -94,5 +94,41 @@ "interface":"eth-rt5" } ] + }, + "18100":{ + "inLabel":18100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.8.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.7.4" + } + ] + }, + "18101":{ + "inLabel":18101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt4" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt6/step8/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt6/step8/show_ip_route.ref index e4df0d846e..4b204dbc4c 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step8/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step8/show_ip_route.ref @@ -280,5 +280,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt6/step8/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt6/step8/show_ipv6_route.ref index eee9dea4d3..834cdfe6ca 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step8/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step8/show_ipv6_route.ref @@ -12,7 +12,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5", + "interfaceName":"eth-rt4", "active":true, "labels":[ 16011 @@ -21,7 +21,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4", + "interfaceName":"eth-rt5", "active":true, "labels":[ 16011 @@ -117,5 +117,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt6/step8/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt6/step8/show_mpls_table.ref index a79406b300..be87ed90a0 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step8/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step8/show_mpls_table.ref @@ -130,5 +130,41 @@ "interface":"eth-rt5" } ] + }, + "18100":{ + "inLabel":18100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.8.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.7.4" + } + ] + }, + "18101":{ + "inLabel":18101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt4" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/rt6/step9/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt6/step9/show_ip_route.ref index e4df0d846e..4b204dbc4c 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step9/show_ip_route.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step9/show_ip_route.ref @@ -280,5 +280,38 @@ } ] } + ], + "10.10.10.10\/32":[ + { + "prefix":"10.10.10.10\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16100 + ] + }, + { + "fib":true, + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16100 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt6/step9/show_ipv6_route.ref b/tests/topotests/isis-sr-topo1/rt6/step9/show_ipv6_route.ref index eee9dea4d3..834cdfe6ca 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step9/show_ipv6_route.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step9/show_ipv6_route.ref @@ -12,7 +12,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5", + "interfaceName":"eth-rt4", "active":true, "labels":[ 16011 @@ -21,7 +21,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4", + "interfaceName":"eth-rt5", "active":true, "labels":[ 16011 @@ -117,5 +117,36 @@ } ] } + ], + "2001:db8:1000::10\/128":[ + { + "prefix":"2001:db8:1000::10\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16101 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16101 + ] + } + ] + } ] } diff --git a/tests/topotests/isis-sr-topo1/rt6/step9/show_mpls_table.ref b/tests/topotests/isis-sr-topo1/rt6/step9/show_mpls_table.ref index a79406b300..be87ed90a0 100644 --- a/tests/topotests/isis-sr-topo1/rt6/step9/show_mpls_table.ref +++ b/tests/topotests/isis-sr-topo1/rt6/step9/show_mpls_table.ref @@ -130,5 +130,41 @@ "interface":"eth-rt5" } ] + }, + "18100":{ + "inLabel":18100, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.8.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16100, + "installed":true, + "nexthop":"10.0.7.4" + } + ] + }, + "18101":{ + "inLabel":18101, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16101, + "installed":true, + "interface":"eth-rt4" + } + ] } } diff --git a/tests/topotests/isis-sr-topo1/test_isis_sr_topo1.py b/tests/topotests/isis-sr-topo1/test_isis_sr_topo1.py index d4ebe52bf6..34eb6d90f6 100644 --- a/tests/topotests/isis-sr-topo1/test_isis_sr_topo1.py +++ b/tests/topotests/isis-sr-topo1/test_isis_sr_topo1.py @@ -73,7 +73,7 @@ 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, '../')) +sys.path.append(os.path.join(CWD, "../")) # pylint: disable=C0413 # Import topogen and topotest helpers @@ -84,8 +84,10 @@ from lib.topolog import logger # Required to instantiate the topology builder class. from mininet.topo import Topo + class TemplateTopo(Topo): "Test topology builder" + def build(self, *_args, **_opts): "Build function" tgen = get_topogen(self) @@ -93,44 +95,45 @@ class TemplateTopo(Topo): # # Define FRR Routers # - for router in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + for router in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: tgen.add_router(router) # # Define connections # - switch = tgen.add_switch('s1') - switch.add_link(tgen.gears['rt1'], nodeif="eth-sw1") - switch.add_link(tgen.gears['rt2'], nodeif="eth-sw1") - switch.add_link(tgen.gears['rt3'], nodeif="eth-sw1") + switch = tgen.add_switch("s1") + switch.add_link(tgen.gears["rt1"], nodeif="eth-sw1") + switch.add_link(tgen.gears["rt2"], nodeif="eth-sw1") + switch.add_link(tgen.gears["rt3"], nodeif="eth-sw1") + + switch = tgen.add_switch("s2") + switch.add_link(tgen.gears["rt2"], nodeif="eth-rt4-1") + switch.add_link(tgen.gears["rt4"], nodeif="eth-rt2-1") - switch = tgen.add_switch('s2') - switch.add_link(tgen.gears['rt2'], nodeif="eth-rt4-1") - switch.add_link(tgen.gears['rt4'], nodeif="eth-rt2-1") + switch = tgen.add_switch("s3") + switch.add_link(tgen.gears["rt2"], nodeif="eth-rt4-2") + switch.add_link(tgen.gears["rt4"], nodeif="eth-rt2-2") - switch = tgen.add_switch('s3') - switch.add_link(tgen.gears['rt2'], nodeif="eth-rt4-2") - switch.add_link(tgen.gears['rt4'], nodeif="eth-rt2-2") + switch = tgen.add_switch("s4") + switch.add_link(tgen.gears["rt3"], nodeif="eth-rt5-1") + switch.add_link(tgen.gears["rt5"], nodeif="eth-rt3-1") - switch = tgen.add_switch('s4') - switch.add_link(tgen.gears['rt3'], nodeif="eth-rt5-1") - switch.add_link(tgen.gears['rt5'], nodeif="eth-rt3-1") + switch = tgen.add_switch("s5") + switch.add_link(tgen.gears["rt3"], nodeif="eth-rt5-2") + switch.add_link(tgen.gears["rt5"], nodeif="eth-rt3-2") - switch = tgen.add_switch('s5') - switch.add_link(tgen.gears['rt3'], nodeif="eth-rt5-2") - switch.add_link(tgen.gears['rt5'], nodeif="eth-rt3-2") + switch = tgen.add_switch("s6") + switch.add_link(tgen.gears["rt4"], nodeif="eth-rt5") + switch.add_link(tgen.gears["rt5"], nodeif="eth-rt4") - switch = tgen.add_switch('s6') - switch.add_link(tgen.gears['rt4'], nodeif="eth-rt5") - switch.add_link(tgen.gears['rt5'], nodeif="eth-rt4") + switch = tgen.add_switch("s7") + switch.add_link(tgen.gears["rt4"], nodeif="eth-rt6") + switch.add_link(tgen.gears["rt6"], nodeif="eth-rt4") - switch = tgen.add_switch('s7') - switch.add_link(tgen.gears['rt4'], nodeif="eth-rt6") - switch.add_link(tgen.gears['rt6'], nodeif="eth-rt4") + switch = tgen.add_switch("s8") + switch.add_link(tgen.gears["rt5"], nodeif="eth-rt6") + switch.add_link(tgen.gears["rt6"], nodeif="eth-rt5") - switch = tgen.add_switch('s8') - switch.add_link(tgen.gears['rt5'], nodeif="eth-rt6") - switch.add_link(tgen.gears['rt6'], nodeif="eth-rt5") def setup_module(mod): "Sets up the pytest environment" @@ -142,16 +145,15 @@ def setup_module(mod): # 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)) + 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)) + 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() @@ -159,22 +161,23 @@ def teardown_module(mod): # This function tears down the whole topology. tgen.stop_topology() + def router_compare_json_output(rname, command, reference): "Compare router JSON output" logger.info('Comparing router "%s" "%s" output', rname, command) tgen = get_topogen() - filename = '{}/{}/{}'.format(CWD, rname, reference) + filename = "{}/{}/{}".format(CWD, rname, reference) expected = json.loads(open(filename).read()) # 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) + 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 + # # Step 1 # @@ -188,9 +191,13 @@ def test_isis_adjacencies_step1(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show yang operational-data /frr-interface:lib isisd", - "step1/show_yang_interface_isis_adjacencies.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, + "show yang operational-data /frr-interface:lib isisd", + "step1/show_yang_interface_isis_adjacencies.ref", + ) + def test_rib_ipv4_step1(): logger.info("Test (step 1): verify IPv4 RIB") @@ -200,9 +207,11 @@ def test_rib_ipv4_step1(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show ip route isis json", - "step1/show_ip_route.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show ip route isis json", "step1/show_ip_route.ref" + ) + def test_rib_ipv6_step1(): logger.info("Test (step 1): verify IPv6 RIB") @@ -212,9 +221,11 @@ def test_rib_ipv6_step1(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show ipv6 route isis json", - "step1/show_ipv6_route.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show ipv6 route isis json", "step1/show_ipv6_route.ref" + ) + def test_mpls_lib_step1(): logger.info("Test (step 1): verify MPLS LIB") @@ -224,9 +235,11 @@ def test_mpls_lib_step1(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show mpls table json", - "step1/show_mpls_table.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show mpls table json", "step1/show_mpls_table.ref" + ) + # # Step 2 @@ -252,13 +265,21 @@ def test_isis_adjacencies_step2(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - logger.info('Disabling IS-IS on the eth-rt5 interface on rt4') - tgen.net['rt4'].cmd('vtysh -c "conf t" -c "interface eth-rt5" -c "no ip router isis 1"') - tgen.net['rt4'].cmd('vtysh -c "conf t" -c "interface eth-rt5" -c "no ipv6 router isis 1"') + logger.info("Disabling IS-IS on the eth-rt5 interface on rt4") + tgen.net["rt4"].cmd( + 'vtysh -c "conf t" -c "interface eth-rt5" -c "no ip router isis 1"' + ) + tgen.net["rt4"].cmd( + 'vtysh -c "conf t" -c "interface eth-rt5" -c "no ipv6 router isis 1"' + ) + + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, + "show yang operational-data /frr-interface:lib isisd", + "step2/show_yang_interface_isis_adjacencies.ref", + ) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show yang operational-data /frr-interface:lib isisd", - "step2/show_yang_interface_isis_adjacencies.ref") def test_rib_ipv4_step2(): logger.info("Test (step 2): verify IPv4 RIB") @@ -268,9 +289,11 @@ def test_rib_ipv4_step2(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show ip route isis json", - "step2/show_ip_route.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show ip route isis json", "step2/show_ip_route.ref" + ) + def test_rib_ipv6_step2(): logger.info("Test (step 2): verify IPv6 RIB") @@ -280,9 +303,11 @@ def test_rib_ipv6_step2(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show ipv6 route isis json", - "step2/show_ipv6_route.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show ipv6 route isis json", "step2/show_ipv6_route.ref" + ) + def test_mpls_lib_step2(): logger.info("Test (step 2): verify MPLS LIB") @@ -292,9 +317,11 @@ def test_mpls_lib_step2(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show mpls table json", - "step2/show_mpls_table.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show mpls table json", "step2/show_mpls_table.ref" + ) + # # Step 3 @@ -318,14 +345,18 @@ def test_isis_adjacencies_step3(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - logger.info('Shutting down the eth-rt4 interface on rt6') - tgen.net['rt6'].cmd('vtysh -c "conf t" -c "interface eth-rt4" -c "shutdown"') - logger.info('Shutting down the eth-rt5 interface on rt6') - tgen.net['rt6'].cmd('vtysh -c "conf t" -c "interface eth-rt5" -c "shutdown"') + logger.info("Shutting down the eth-rt4 interface on rt6") + tgen.net["rt6"].cmd('vtysh -c "conf t" -c "interface eth-rt4" -c "shutdown"') + logger.info("Shutting down the eth-rt5 interface on rt6") + tgen.net["rt6"].cmd('vtysh -c "conf t" -c "interface eth-rt5" -c "shutdown"') + + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, + "show yang operational-data /frr-interface:lib isisd", + "step3/show_yang_interface_isis_adjacencies.ref", + ) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show yang operational-data /frr-interface:lib isisd", - "step3/show_yang_interface_isis_adjacencies.ref") def test_rib_ipv4_step3(): logger.info("Test (step 3): verify IPv4 RIB") @@ -335,9 +366,11 @@ def test_rib_ipv4_step3(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show ip route isis json", - "step3/show_ip_route.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show ip route isis json", "step3/show_ip_route.ref" + ) + def test_rib_ipv6_step3(): logger.info("Test (step 3): verify IPv6 RIB") @@ -347,9 +380,11 @@ def test_rib_ipv6_step3(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show ipv6 route isis json", - "step3/show_ipv6_route.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show ipv6 route isis json", "step3/show_ipv6_route.ref" + ) + def test_mpls_lib_step3(): logger.info("Test (step 3): verify MPLS LIB") @@ -359,9 +394,11 @@ def test_mpls_lib_step3(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show mpls table json", - "step3/show_mpls_table.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show mpls table json", "step3/show_mpls_table.ref" + ) + # # Step 4 @@ -386,16 +423,22 @@ def test_isis_adjacencies_step4(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - logger.info('Bringing up the eth-rt4 interface on rt6') - tgen.net['rt6'].cmd('vtysh -c "conf t" -c "interface eth-rt4" -c "no shutdown"') - logger.info('Bringing up the eth-rt5 interface on rt6') - tgen.net['rt6'].cmd('vtysh -c "conf t" -c "interface eth-rt5" -c "no shutdown"') - logger.info('Changing rt6\'s SRGB') - tgen.net['rt6'].cmd('vtysh -c "conf t" -c "router isis 1" -c "segment-routing global-block 18000 25999"') + logger.info("Bringing up the eth-rt4 interface on rt6") + tgen.net["rt6"].cmd('vtysh -c "conf t" -c "interface eth-rt4" -c "no shutdown"') + logger.info("Bringing up the eth-rt5 interface on rt6") + tgen.net["rt6"].cmd('vtysh -c "conf t" -c "interface eth-rt5" -c "no shutdown"') + logger.info("Changing rt6's SRGB") + tgen.net["rt6"].cmd( + 'vtysh -c "conf t" -c "router isis 1" -c "segment-routing global-block 18000 25999"' + ) + + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, + "show yang operational-data /frr-interface:lib isisd", + "step4/show_yang_interface_isis_adjacencies.ref", + ) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show yang operational-data /frr-interface:lib isisd", - "step4/show_yang_interface_isis_adjacencies.ref") def test_rib_ipv4_step4(): logger.info("Test (step 4): verify IPv4 RIB") @@ -405,9 +448,11 @@ def test_rib_ipv4_step4(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show ip route isis json", - "step4/show_ip_route.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show ip route isis json", "step4/show_ip_route.ref" + ) + def test_rib_ipv6_step4(): logger.info("Test (step 4): verify IPv6 RIB") @@ -417,9 +462,11 @@ def test_rib_ipv6_step4(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show ipv6 route isis json", - "step4/show_ipv6_route.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show ipv6 route isis json", "step4/show_ipv6_route.ref" + ) + def test_mpls_lib_step4(): logger.info("Test (step 4): verify MPLS LIB") @@ -429,9 +476,11 @@ def test_mpls_lib_step4(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show mpls table json", - "step4/show_mpls_table.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show mpls table json", "step4/show_mpls_table.ref" + ) + # # Step 5 @@ -453,12 +502,18 @@ def test_isis_adjacencies_step5(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - logger.info('Disabling SR on rt6') - tgen.net['rt6'].cmd('vtysh -c "conf t" -c "router isis 1" -c "no segment-routing on"') + logger.info("Disabling SR on rt6") + tgen.net["rt6"].cmd( + 'vtysh -c "conf t" -c "router isis 1" -c "no segment-routing on"' + ) + + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, + "show yang operational-data /frr-interface:lib isisd", + "step5/show_yang_interface_isis_adjacencies.ref", + ) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show yang operational-data /frr-interface:lib isisd", - "step5/show_yang_interface_isis_adjacencies.ref") def test_rib_ipv4_step5(): logger.info("Test (step 5): verify IPv4 RIB") @@ -468,9 +523,11 @@ def test_rib_ipv4_step5(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show ip route isis json", - "step5/show_ip_route.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show ip route isis json", "step5/show_ip_route.ref" + ) + def test_rib_ipv6_step5(): logger.info("Test (step 5): verify IPv6 RIB") @@ -480,9 +537,11 @@ def test_rib_ipv6_step5(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show ipv6 route isis json", - "step5/show_ipv6_route.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show ipv6 route isis json", "step5/show_ipv6_route.ref" + ) + def test_mpls_lib_step5(): logger.info("Test (step 5): verify MPLS LIB") @@ -492,9 +551,11 @@ def test_mpls_lib_step5(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show mpls table json", - "step5/show_mpls_table.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show mpls table json", "step5/show_mpls_table.ref" + ) + # # Step 6 @@ -516,12 +577,16 @@ def test_isis_adjacencies_step6(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - logger.info('Enabling SR on rt6') - tgen.net['rt6'].cmd('vtysh -c "conf t" -c "router isis 1" -c "segment-routing on"') + logger.info("Enabling SR on rt6") + tgen.net["rt6"].cmd('vtysh -c "conf t" -c "router isis 1" -c "segment-routing on"') + + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, + "show yang operational-data /frr-interface:lib isisd", + "step6/show_yang_interface_isis_adjacencies.ref", + ) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show yang operational-data /frr-interface:lib isisd", - "step6/show_yang_interface_isis_adjacencies.ref") def test_rib_ipv4_step6(): logger.info("Test (step 6): verify IPv4 RIB") @@ -531,9 +596,11 @@ def test_rib_ipv4_step6(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show ip route isis json", - "step6/show_ip_route.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show ip route isis json", "step6/show_ip_route.ref" + ) + def test_rib_ipv6_step6(): logger.info("Test (step 6): verify IPv6 RIB") @@ -543,9 +610,11 @@ def test_rib_ipv6_step6(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show ipv6 route isis json", - "step6/show_ipv6_route.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show ipv6 route isis json", "step6/show_ipv6_route.ref" + ) + def test_mpls_lib_step6(): logger.info("Test (step 6): verify MPLS LIB") @@ -555,9 +624,11 @@ def test_mpls_lib_step6(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show mpls table json", - "step6/show_mpls_table.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show mpls table json", "step6/show_mpls_table.ref" + ) + # # Step 7 @@ -576,13 +647,21 @@ def test_isis_adjacencies_step7(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - logger.info('Deleting rt1\'s Prefix-SIDs') - tgen.net['rt1'].cmd('vtysh -c "conf t" -c "router isis 1" -c "no segment-routing prefix 1.1.1.1/32 index 10"') - tgen.net['rt1'].cmd('vtysh -c "conf t" -c "router isis 1" -c "no segment-routing prefix 2001:db8:1000::1/128 index 11"') + logger.info("Deleting rt1's Prefix-SIDs") + tgen.net["rt1"].cmd( + 'vtysh -c "conf t" -c "router isis 1" -c "no segment-routing prefix 1.1.1.1/32 index 10"' + ) + tgen.net["rt1"].cmd( + 'vtysh -c "conf t" -c "router isis 1" -c "no segment-routing prefix 2001:db8:1000::1/128 index 11"' + ) + + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, + "show yang operational-data /frr-interface:lib isisd", + "step7/show_yang_interface_isis_adjacencies.ref", + ) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show yang operational-data /frr-interface:lib isisd", - "step7/show_yang_interface_isis_adjacencies.ref") def test_rib_ipv4_step7(): logger.info("Test (step 7): verify IPv4 RIB") @@ -592,9 +671,11 @@ def test_rib_ipv4_step7(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show ip route isis json", - "step7/show_ip_route.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show ip route isis json", "step7/show_ip_route.ref" + ) + def test_rib_ipv6_step7(): logger.info("Test (step 7): verify IPv6 RIB") @@ -604,9 +685,11 @@ def test_rib_ipv6_step7(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show ipv6 route isis json", - "step7/show_ipv6_route.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show ipv6 route isis json", "step7/show_ipv6_route.ref" + ) + def test_mpls_lib_step7(): logger.info("Test (step 7): verify MPLS LIB") @@ -616,9 +699,11 @@ def test_mpls_lib_step7(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show mpls table json", - "step7/show_mpls_table.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show mpls table json", "step7/show_mpls_table.ref" + ) + # # Step 8 @@ -637,13 +722,21 @@ def test_isis_adjacencies_step8(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - logger.info('Re-adding rt1\'s Prefix-SIDs') - tgen.net['rt1'].cmd('vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 1.1.1.1/32 index 10"') - tgen.net['rt1'].cmd('vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 2001:db8:1000::1/128 index 11"') + logger.info("Re-adding rt1's Prefix-SIDs") + tgen.net["rt1"].cmd( + 'vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 1.1.1.1/32 index 10"' + ) + tgen.net["rt1"].cmd( + 'vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 2001:db8:1000::1/128 index 11"' + ) + + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, + "show yang operational-data /frr-interface:lib isisd", + "step8/show_yang_interface_isis_adjacencies.ref", + ) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show yang operational-data /frr-interface:lib isisd", - "step8/show_yang_interface_isis_adjacencies.ref") def test_rib_ipv4_step8(): logger.info("Test (step 8): verify IPv4 RIB") @@ -653,9 +746,11 @@ def test_rib_ipv4_step8(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show ip route isis json", - "step8/show_ip_route.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show ip route isis json", "step8/show_ip_route.ref" + ) + def test_rib_ipv6_step8(): logger.info("Test (step 8): verify IPv6 RIB") @@ -665,9 +760,11 @@ def test_rib_ipv6_step8(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show ipv6 route isis json", - "step8/show_ipv6_route.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show ipv6 route isis json", "step8/show_ipv6_route.ref" + ) + def test_mpls_lib_step8(): logger.info("Test (step 8): verify MPLS LIB") @@ -677,9 +774,11 @@ def test_mpls_lib_step8(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show mpls table json", - "step8/show_mpls_table.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show mpls table json", "step8/show_mpls_table.ref" + ) + # # Step 9 @@ -700,16 +799,28 @@ def test_isis_adjacencies_step9(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - logger.info('Changing rt1\'s Prefix-SIDs to use the no-php option') - tgen.net['rt1'].cmd('vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 1.1.1.1/32 index 10 no-php-flag"') - tgen.net['rt1'].cmd('vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 2001:db8:1000::1/128 index 11 no-php-flag"') - logger.info('Change rt6\'s Prefix-SIDs to stop using the explicit-null option') - tgen.net['rt6'].cmd('vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 6.6.6.6/32 index 60"') - tgen.net['rt6'].cmd('vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 2001:db8:1000::6/128 index 61"') + logger.info("Changing rt1's Prefix-SIDs to use the no-php option") + tgen.net["rt1"].cmd( + 'vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 1.1.1.1/32 index 10 no-php-flag"' + ) + tgen.net["rt1"].cmd( + 'vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 2001:db8:1000::1/128 index 11 no-php-flag"' + ) + logger.info("Change rt6's Prefix-SIDs to stop using the explicit-null option") + tgen.net["rt6"].cmd( + 'vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 6.6.6.6/32 index 60"' + ) + tgen.net["rt6"].cmd( + 'vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 2001:db8:1000::6/128 index 61"' + ) + + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, + "show yang operational-data /frr-interface:lib isisd", + "step9/show_yang_interface_isis_adjacencies.ref", + ) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show yang operational-data /frr-interface:lib isisd", - "step9/show_yang_interface_isis_adjacencies.ref") def test_rib_ipv4_step9(): logger.info("Test (step 9): verify IPv4 RIB") @@ -719,9 +830,11 @@ def test_rib_ipv4_step9(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show ip route isis json", - "step9/show_ip_route.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show ip route isis json", "step9/show_ip_route.ref" + ) + def test_rib_ipv6_step9(): logger.info("Test (step 9): verify IPv6 RIB") @@ -731,9 +844,11 @@ def test_rib_ipv6_step9(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show ipv6 route isis json", - "step9/show_ipv6_route.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show ipv6 route isis json", "step9/show_ipv6_route.ref" + ) + def test_mpls_lib_step9(): logger.info("Test (step 9): verify MPLS LIB") @@ -743,9 +858,11 @@ def test_mpls_lib_step9(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show mpls table json", - "step9/show_mpls_table.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show mpls table json", "step9/show_mpls_table.ref" + ) + # # Step 10 @@ -766,12 +883,18 @@ def test_isis_adjacencies_step10(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - logger.info('Removing the IPv4 address from rt4\'s eth-rt2-1 interface') - tgen.net['rt4'].cmd('vtysh -c "conf t" -c "interface eth-rt2-1" -c "no ip address 10.0.2.4/24"') + logger.info("Removing the IPv4 address from rt4's eth-rt2-1 interface") + tgen.net["rt4"].cmd( + 'vtysh -c "conf t" -c "interface eth-rt2-1" -c "no ip address 10.0.2.4/24"' + ) + + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, + "show yang operational-data /frr-interface:lib isisd", + "step10/show_yang_interface_isis_adjacencies.ref", + ) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show yang operational-data /frr-interface:lib isisd", - "step10/show_yang_interface_isis_adjacencies.ref") def test_rib_ipv4_step10(): logger.info("Test (step 10): verify IPv4 RIB") @@ -781,9 +904,11 @@ def test_rib_ipv4_step10(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show ip route isis json", - "step10/show_ip_route.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show ip route isis json", "step10/show_ip_route.ref" + ) + def test_rib_ipv6_step10(): logger.info("Test (step 10): verify IPv6 RIB") @@ -793,9 +918,11 @@ def test_rib_ipv6_step10(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show ipv6 route isis json", - "step10/show_ipv6_route.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show ipv6 route isis json", "step10/show_ipv6_route.ref" + ) + def test_mpls_lib_step10(): logger.info("Test (step 10): verify MPLS LIB") @@ -805,9 +932,11 @@ def test_mpls_lib_step10(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show mpls table json", - "step10/show_mpls_table.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show mpls table json", "step10/show_mpls_table.ref" + ) + # # Step 11 @@ -826,13 +955,26 @@ def test_isis_invalid_config_step11(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - logger.info('Entering invalid Segment Routing configuration...') - ret = tgen.net['rt1'].cmd('vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 1.1.1.1/32 index 10000"') - assert re.search("Configuration failed", ret) is not None, "Invalid SR configuration wasn't rejected" - ret = tgen.net['rt1'].cmd('vtysh -c "conf t" -c "router isis 1" -c "segment-routing global-block 16000 14999"') - assert re.search("Configuration failed", ret) is not None, "Invalid SR configuration wasn't rejected" - ret = tgen.net['rt1'].cmd('vtysh -c "conf t" -c "router isis 1" -c "segment-routing global-block 16000 16001"') - assert re.search("Configuration failed", ret) is not None, "Invalid SR configuration wasn't rejected" + logger.info("Entering invalid Segment Routing configuration...") + ret = tgen.net["rt1"].cmd( + 'vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 1.1.1.1/32 index 10000"' + ) + assert ( + re.search("Configuration failed", ret) is not None + ), "Invalid SR configuration wasn't rejected" + ret = tgen.net["rt1"].cmd( + 'vtysh -c "conf t" -c "router isis 1" -c "segment-routing global-block 16000 14999"' + ) + assert ( + re.search("Configuration failed", ret) is not None + ), "Invalid SR configuration wasn't rejected" + ret = tgen.net["rt1"].cmd( + 'vtysh -c "conf t" -c "router isis 1" -c "segment-routing global-block 16000 16001"' + ) + assert ( + re.search("Configuration failed", ret) is not None + ), "Invalid SR configuration wasn't rejected" + # # Step 12 @@ -851,19 +993,39 @@ def test_isis_adjacencies_step12(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - logger.info('Restoring the original network setup') - tgen.net['rt4'].cmd('vtysh -c "conf t" -c "interface eth-rt5" -c "ip router isis 1"') - tgen.net['rt4'].cmd('vtysh -c "conf t" -c "interface eth-rt5" -c "ipv6 router isis 1"') - tgen.net['rt6'].cmd('vtysh -c "conf t" -c "router isis 1" -c "segment-routing global-block 16000 23999"') - tgen.net['rt1'].cmd('vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 1.1.1.1/32 index 10"') - tgen.net['rt1'].cmd('vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 2001:db8:1000::1/128 index 11"') - tgen.net['rt6'].cmd('vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 6.6.6.6/32 index 60 explicit-null"') - tgen.net['rt6'].cmd('vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 2001:db8:1000::6/128 index 61 explicit-null"') - tgen.net['rt4'].cmd('vtysh -c "conf t" -c "interface eth-rt2-1" -c "ip address 10.0.2.4/24"') + logger.info("Restoring the original network setup") + tgen.net["rt4"].cmd( + 'vtysh -c "conf t" -c "interface eth-rt5" -c "ip router isis 1"' + ) + tgen.net["rt4"].cmd( + 'vtysh -c "conf t" -c "interface eth-rt5" -c "ipv6 router isis 1"' + ) + tgen.net["rt6"].cmd( + 'vtysh -c "conf t" -c "router isis 1" -c "segment-routing global-block 16000 23999"' + ) + tgen.net["rt1"].cmd( + 'vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 1.1.1.1/32 index 10"' + ) + tgen.net["rt1"].cmd( + 'vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 2001:db8:1000::1/128 index 11"' + ) + tgen.net["rt6"].cmd( + 'vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 6.6.6.6/32 index 60 explicit-null"' + ) + tgen.net["rt6"].cmd( + 'vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 2001:db8:1000::6/128 index 61 explicit-null"' + ) + tgen.net["rt4"].cmd( + 'vtysh -c "conf t" -c "interface eth-rt2-1" -c "ip address 10.0.2.4/24"' + ) + + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, + "show yang operational-data /frr-interface:lib isisd", + "step1/show_yang_interface_isis_adjacencies.ref", + ) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show yang operational-data /frr-interface:lib isisd", - "step1/show_yang_interface_isis_adjacencies.ref") def test_rib_ipv4_step12(): logger.info("Test (step 12): verify IPv4 RIB") @@ -873,9 +1035,11 @@ def test_rib_ipv4_step12(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show ip route isis json", - "step1/show_ip_route.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show ip route isis json", "step1/show_ip_route.ref" + ) + def test_rib_ipv6_step12(): logger.info("Test (step 12): verify IPv6 RIB") @@ -885,9 +1049,11 @@ def test_rib_ipv6_step12(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show ipv6 route isis json", - "step1/show_ipv6_route.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show ipv6 route isis json", "step1/show_ipv6_route.ref" + ) + def test_mpls_lib_step12(): logger.info("Test (step 12): verify MPLS LIB") @@ -897,19 +1063,22 @@ def test_mpls_lib_step12(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) - for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: - router_compare_json_output(rname, "show mpls table json", - "step1/show_mpls_table.ref") + for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6"]: + router_compare_json_output( + rname, "show mpls table json", "step1/show_mpls_table.ref" + ) + # Memory leak test template def test_memory_leak(): "Run the memory leak test and report results." tgen = get_topogen() if not tgen.is_memleak_enabled(): - pytest.skip('Memory leak test/report is disabled') + pytest.skip("Memory leak test/report is disabled") tgen.report_memory_leaks() -if __name__ == '__main__': + +if __name__ == "__main__": args = ["-s"] + sys.argv[1:] sys.exit(pytest.main(args)) diff --git a/tests/topotests/isis-tilfa-topo1/__init__.py b/tests/topotests/isis-tilfa-topo1/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/__init__.py diff --git a/tests/topotests/isis-tilfa-topo1/rt1/isisd.conf b/tests/topotests/isis-tilfa-topo1/rt1/isisd.conf new file mode 100644 index 0000000000..a447a2aa5a --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/isisd.conf @@ -0,0 +1,33 @@ +password 1 +hostname rt1 +log file isisd.log +! +debug isis events +debug isis route-events +debug isis spf-events +debug isis sr-events +debug isis lsp-gen +! +interface lo + ip router isis 1 + ipv6 router isis 1 + isis passive +! +interface eth-sw1 + ip router isis 1 + ipv6 router isis 1 + isis hello-multiplier 3 + isis priority 100 + isis fast-reroute ti-lfa +! +router isis 1 + net 49.0000.0000.0000.0001.00 + is-type level-1 + lsp-gen-interval 2 + topology ipv6-unicast + segment-routing on + segment-routing global-block 16000 23999 + segment-routing node-msd 8 + segment-routing prefix 1.1.1.1/32 index 10 + segment-routing prefix 2001:db8:1000::1/128 index 11 +! diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step1/show_ip_route.ref b/tests/topotests/isis-tilfa-topo1/rt1/step1/show_ip_route.ref new file mode 100644 index 0000000000..92b7437324 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step1/show_ip_route.ref @@ -0,0 +1,294 @@ +{ + "2.2.2.2\/32":[ + { + "prefix":"2.2.2.2\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 3 + ] + } + ] + } + ], + "3.3.3.3\/32":[ + { + "prefix":"3.3.3.3\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 3 + ] + } + ] + } + ], + "4.4.4.4\/32":[ + { + "prefix":"4.4.4.4\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16040 + ] + } + ] + } + ], + "5.5.5.5\/32":[ + { + "prefix":"5.5.5.5\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16050 + ] + } + ] + } + ], + "6.6.6.6\/32":[ + { + "prefix":"6.6.6.6\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":40, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16060 + ] + }, + { + "fib":true, + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16060 + ] + } + ] + } + ], + "10.0.1.0\/24":[ + { + "prefix":"10.0.1.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1" + }, + { + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1" + } + ] + } + ], + "10.0.2.0\/24":[ + { + "prefix":"10.0.2.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true + } + ] + } + ], + "10.0.3.0\/24":[ + { + "prefix":"10.0.3.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true + } + ] + } + ], + "10.0.4.0\/24":[ + { + "prefix":"10.0.4.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true + } + ] + } + ], + "10.0.5.0\/24":[ + { + "prefix":"10.0.5.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true + } + ] + } + ], + "10.0.6.0\/24":[ + { + "prefix":"10.0.6.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true + }, + { + "fib":true, + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true + } + ] + } + ], + "10.0.7.0\/24":[ + { + "prefix":"10.0.7.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true + } + ] + } + ], + "10.0.8.0\/24":[ + { + "prefix":"10.0.8.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true + } + ] + } + ] +} diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step1/show_ipv6_route.ref b/tests/topotests/isis-tilfa-topo1/rt1/step1/show_ipv6_route.ref new file mode 100644 index 0000000000..3232121a0f --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step1/show_ipv6_route.ref @@ -0,0 +1,121 @@ +{ + "2001:db8:1000::2\/128":[ + { + "prefix":"2001:db8:1000::2\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 3 + ] + } + ] + } + ], + "2001:db8:1000::3\/128":[ + { + "prefix":"2001:db8:1000::3\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 3 + ] + } + ] + } + ], + "2001:db8:1000::4\/128":[ + { + "prefix":"2001:db8:1000::4\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16041 + ] + } + ] + } + ], + "2001:db8:1000::5\/128":[ + { + "prefix":"2001:db8:1000::5\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16051 + ] + } + ] + } + ], + "2001:db8:1000::6\/128":[ + { + "prefix":"2001:db8:1000::6\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":40, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16061 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16061 + ] + } + ] + } + ] +} diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step1/show_mpls_table.ref b/tests/topotests/isis-tilfa-topo1/rt1/step1/show_mpls_table.ref new file mode 100644 index 0000000000..e3ed7c20b2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step1/show_mpls_table.ref @@ -0,0 +1,134 @@ +{ + "16020":{ + "inLabel":16020, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "nexthop":"10.0.1.2" + } + ] + }, + "16021":{ + "inLabel":16021, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "interface":"eth-sw1" + } + ] + }, + "16030":{ + "inLabel":16030, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "nexthop":"10.0.1.3" + } + ] + }, + "16031":{ + "inLabel":16031, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "interface":"eth-sw1" + } + ] + }, + "16040":{ + "inLabel":16040, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16040, + "installed":true, + "nexthop":"10.0.1.2" + } + ] + }, + "16041":{ + "inLabel":16041, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16041, + "installed":true, + "interface":"eth-sw1" + } + ] + }, + "16050":{ + "inLabel":16050, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16050, + "installed":true, + "nexthop":"10.0.1.3" + } + ] + }, + "16051":{ + "inLabel":16051, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16051, + "installed":true, + "interface":"eth-sw1" + } + ] + }, + "16060":{ + "inLabel":16060, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16060, + "installed":true, + "nexthop":"10.0.1.2" + }, + { + "type":"SR (IS-IS)", + "outLabel":16060, + "installed":true, + "nexthop":"10.0.1.3" + } + ] + }, + "16061":{ + "inLabel":16061, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16061, + "installed":true, + "interface":"eth-sw1" + }, + { + "type":"SR (IS-IS)", + "outLabel":16061, + "installed":true, + "interface":"eth-sw1" + } + ] + } +} diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step1/show_yang_interface_isis_adjacencies.ref b/tests/topotests/isis-tilfa-topo1/rt1/step1/show_yang_interface_isis_adjacencies.ref new file mode 100644 index 0000000000..26f0dffa7a --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step1/show_yang_interface_isis_adjacencies.ref @@ -0,0 +1,32 @@ +{ + "frr-interface:lib": { + "interface": [ + { + "name": "eth-sw1", + "vrf": "default", + "state": { + "frr-isisd:isis": { + "adjacencies": { + "adjacency": [ + { + "neighbor-sys-type": "level-1", + "neighbor-sysid": "0000.0000.0003", + "hold-timer": 9, + "neighbor-priority": 64, + "state": "up" + }, + { + "neighbor-sys-type": "level-1", + "neighbor-sysid": "0000.0000.0002", + "hold-timer": 9, + "neighbor-priority": 64, + "state": "up" + } + ] + } + } + } + } + ] + } +} diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step2/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step2/show_ip_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step2/show_ip_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step2/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step2/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step2/show_ipv6_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step2/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step2/show_mpls_table.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step2/show_mpls_table.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step3/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step3/show_ip_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step3/show_ip_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step3/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step3/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step3/show_ipv6_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step3/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step3/show_mpls_table.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step3/show_mpls_table.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step4/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step4/show_ip_route.ref.diff new file mode 100644 index 0000000000..1a9307ddb9 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step4/show_ip_route.ref.diff @@ -0,0 +1,14 @@ +--- rt1/step3/show_ip_route.ref 2020-09-25 17:48:05.062911204 -0300 ++++ rt1/step4/show_ip_route.ref 2020-09-25 17:49:01.563647190 -0300 +@@ -60,10 +60,7 @@ + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", +- "active":true, +- "labels":[ +- 16040 +- ] ++ "active":true + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step4/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step4/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..f5036aeda8 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step4/show_ipv6_route.ref.diff @@ -0,0 +1,14 @@ +--- rt1/step3/show_ipv6_route.ref 2020-09-25 17:48:06.358928078 -0300 ++++ rt1/step4/show_ipv6_route.ref 2020-09-25 17:49:02.791663194 -0300 +@@ -57,10 +57,7 @@ + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", +- "active":true, +- "labels":[ +- 16041 +- ] ++ "active":true + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step4/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step4/show_mpls_table.ref.diff new file mode 100644 index 0000000000..30c612b544 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step4/show_mpls_table.ref.diff @@ -0,0 +1,33 @@ +--- rt1/step3/show_mpls_table.ref 2020-09-25 17:48:03.782894539 -0300 ++++ rt1/step4/show_mpls_table.ref 2020-09-25 17:49:00.343631290 -0300 +@@ -47,30 +47,6 @@ + } + ] + }, +- "16040":{ +- "inLabel":16040, +- "installed":true, +- "nexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16040, +- "installed":true, +- "nexthop":"10.0.1.2" +- } +- ] +- }, +- "16041":{ +- "inLabel":16041, +- "installed":true, +- "nexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16041, +- "installed":true, +- "interface":"eth-sw1" +- } +- ] +- }, + "16050":{ + "inLabel":16050, + "installed":true, diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step5/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step5/show_ip_route.ref.diff new file mode 100644 index 0000000000..79a452ef69 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step5/show_ip_route.ref.diff @@ -0,0 +1,14 @@ +--- rt1/step4/show_ip_route.ref 2020-09-25 17:49:01.563647190 -0300 ++++ rt1/step5/show_ip_route.ref 2020-09-25 17:50:12.144567593 -0300 +@@ -60,7 +60,10 @@ + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", +- "active":true ++ "active":true, ++ "labels":[ ++ 16040 ++ ] + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step5/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step5/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..805266aaaa --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step5/show_ipv6_route.ref.diff @@ -0,0 +1,14 @@ +--- rt1/step4/show_ipv6_route.ref 2020-09-25 17:49:02.791663194 -0300 ++++ rt1/step5/show_ipv6_route.ref 2020-09-25 17:50:13.428584346 -0300 +@@ -57,7 +57,10 @@ + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", +- "active":true ++ "active":true, ++ "labels":[ ++ 16041 ++ ] + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step5/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step5/show_mpls_table.ref.diff new file mode 100644 index 0000000000..d7ab66ee18 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step5/show_mpls_table.ref.diff @@ -0,0 +1,33 @@ +--- rt1/step4/show_mpls_table.ref 2020-09-25 17:49:00.343631290 -0300 ++++ rt1/step5/show_mpls_table.ref 2020-09-25 17:50:10.868550944 -0300 +@@ -47,6 +47,30 @@ + } + ] + }, ++ "16040":{ ++ "inLabel":16040, ++ "installed":true, ++ "nexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16040, ++ "installed":true, ++ "nexthop":"10.0.1.2" ++ } ++ ] ++ }, ++ "16041":{ ++ "inLabel":16041, ++ "installed":true, ++ "nexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16041, ++ "installed":true, ++ "interface":"eth-sw1" ++ } ++ ] ++ }, + "16050":{ + "inLabel":16050, + "installed":true, diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step6/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step6/show_ip_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step6/show_ip_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step6/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step6/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step6/show_ipv6_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step6/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step6/show_mpls_table.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step6/show_mpls_table.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step7/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step7/show_ip_route.ref.diff new file mode 100644 index 0000000000..9aa0cd2e39 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step7/show_ip_route.ref.diff @@ -0,0 +1,14 @@ +--- rt1/step6/show_ip_route.ref 2020-09-25 17:51:15.105389461 -0300 ++++ rt1/step7/show_ip_route.ref 2020-09-25 17:52:02.014002243 -0300 +@@ -83,10 +83,7 @@ + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", +- "active":true, +- "labels":[ +- 16050 +- ] ++ "active":true + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step7/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step7/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..52fd7caf91 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step7/show_ipv6_route.ref.diff @@ -0,0 +1,14 @@ +--- rt1/step6/show_ipv6_route.ref 2020-09-25 17:51:16.345405655 -0300 ++++ rt1/step7/show_ipv6_route.ref 2020-09-25 17:52:03.230018133 -0300 +@@ -79,10 +79,7 @@ + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", +- "active":true, +- "labels":[ +- 16051 +- ] ++ "active":true + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step7/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step7/show_mpls_table.ref.diff new file mode 100644 index 0000000000..53332be569 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step7/show_mpls_table.ref.diff @@ -0,0 +1,33 @@ +--- rt1/step6/show_mpls_table.ref 2020-09-25 17:51:13.861373215 -0300 ++++ rt1/step7/show_mpls_table.ref 2020-09-25 17:52:00.769985988 -0300 +@@ -71,30 +71,6 @@ + } + ] + }, +- "16050":{ +- "inLabel":16050, +- "installed":true, +- "nexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16050, +- "installed":true, +- "nexthop":"10.0.1.3" +- } +- ] +- }, +- "16051":{ +- "inLabel":16051, +- "installed":true, +- "nexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16051, +- "installed":true, +- "interface":"eth-sw1" +- } +- ] +- }, + "16060":{ + "inLabel":16060, + "installed":true, diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step8/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step8/show_ip_route.ref.diff new file mode 100644 index 0000000000..af9f72e718 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step8/show_ip_route.ref.diff @@ -0,0 +1,14 @@ +--- rt1/step7/show_ip_route.ref 2020-09-25 17:52:02.014002243 -0300 ++++ rt1/step8/show_ip_route.ref 2020-09-25 17:53:20.003021800 -0300 +@@ -83,7 +83,10 @@ + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", +- "active":true ++ "active":true, ++ "labels":[ ++ 16050 ++ ] + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step8/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step8/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..b733b33ed9 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step8/show_ipv6_route.ref.diff @@ -0,0 +1,14 @@ +--- rt1/step7/show_ipv6_route.ref 2020-09-25 17:52:03.230018133 -0300 ++++ rt1/step8/show_ipv6_route.ref 2020-09-25 17:53:21.239037966 -0300 +@@ -79,7 +79,10 @@ + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", +- "active":true ++ "active":true, ++ "labels":[ ++ 16051 ++ ] + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step8/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step8/show_mpls_table.ref.diff new file mode 100644 index 0000000000..b6f8c962f0 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step8/show_mpls_table.ref.diff @@ -0,0 +1,33 @@ +--- rt1/step7/show_mpls_table.ref 2020-09-25 17:52:00.769985988 -0300 ++++ rt1/step8/show_mpls_table.ref 2020-09-25 17:53:18.671004379 -0300 +@@ -71,6 +71,30 @@ + } + ] + }, ++ "16050":{ ++ "inLabel":16050, ++ "installed":true, ++ "nexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16050, ++ "installed":true, ++ "nexthop":"10.0.1.3" ++ } ++ ] ++ }, ++ "16051":{ ++ "inLabel":16051, ++ "installed":true, ++ "nexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16051, ++ "installed":true, ++ "interface":"eth-sw1" ++ } ++ ] ++ }, + "16060":{ + "inLabel":16060, + "installed":true, diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step9/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step9/show_ip_route.ref.diff new file mode 100644 index 0000000000..1d96341557 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step9/show_ip_route.ref.diff @@ -0,0 +1,11 @@ +--- rt1/step8/show_ip_route.ref 2020-09-25 17:53:20.003021800 -0300 ++++ rt1/step9/show_ip_route.ref 2020-09-25 17:54:37.700038367 -0300 +@@ -85,7 +85,7 @@ + "interfaceName":"eth-sw1", + "active":true, + "labels":[ +- 16050 ++ 16500 + ] + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step9/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step9/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..232b823ac2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step9/show_ipv6_route.ref.diff @@ -0,0 +1,11 @@ +--- rt1/step8/show_ipv6_route.ref 2020-09-25 17:53:21.239037966 -0300 ++++ rt1/step9/show_ipv6_route.ref 2020-09-25 17:54:38.912054230 -0300 +@@ -81,7 +81,7 @@ + "interfaceName":"eth-sw1", + "active":true, + "labels":[ +- 16051 ++ 16501 + ] + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt1/step9/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt1/step9/show_mpls_table.ref.diff new file mode 100644 index 0000000000..7f0d50f5f2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/step9/show_mpls_table.ref.diff @@ -0,0 +1,64 @@ +--- rt1/step8/show_mpls_table.ref 2020-09-25 17:53:18.671004379 -0300 ++++ rt1/step9/show_mpls_table.ref 2020-09-25 17:54:36.428021718 -0300 +@@ -71,30 +71,6 @@ + } + ] + }, +- "16050":{ +- "inLabel":16050, +- "installed":true, +- "nexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16050, +- "installed":true, +- "nexthop":"10.0.1.3" +- } +- ] +- }, +- "16051":{ +- "inLabel":16051, +- "installed":true, +- "nexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16051, +- "installed":true, +- "interface":"eth-sw1" +- } +- ] +- }, + "16060":{ + "inLabel":16060, + "installed":true, +@@ -129,6 +105,30 @@ + "installed":true, + "interface":"eth-sw1" + } ++ ] ++ }, ++ "16500":{ ++ "inLabel":16500, ++ "installed":true, ++ "nexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16500, ++ "installed":true, ++ "nexthop":"10.0.1.3" ++ } ++ ] ++ }, ++ "16501":{ ++ "inLabel":16501, ++ "installed":true, ++ "nexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16501, ++ "installed":true, ++ "interface":"eth-sw1" ++ } + ] + } + } diff --git a/tests/topotests/isis-tilfa-topo1/rt1/zebra.conf b/tests/topotests/isis-tilfa-topo1/rt1/zebra.conf new file mode 100644 index 0000000000..9d71d3005f --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt1/zebra.conf @@ -0,0 +1,19 @@ +log file zebra.log +! +hostname rt1 +! +debug zebra kernel +debug zebra packet +debug zebra mpls +! +interface lo + ip address 1.1.1.1/32 + ipv6 address 2001:db8:1000::1/128 +! +interface eth-sw1 + ip address 10.0.1.1/24 +! +ip forwarding +! +line vty +! diff --git a/tests/topotests/isis-tilfa-topo1/rt2/isisd.conf b/tests/topotests/isis-tilfa-topo1/rt2/isisd.conf new file mode 100644 index 0000000000..1a756e2c72 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/isisd.conf @@ -0,0 +1,45 @@ +hostname rt2 +log file isisd.log +! +debug isis events +debug isis route-events +debug isis spf-events +debug isis sr-events +debug isis lsp-gen +! +interface lo + ip router isis 1 + ipv6 router isis 1 + isis passive +! +interface eth-sw1 + ip router isis 1 + ipv6 router isis 1 + isis hello-multiplier 3 + isis fast-reroute ti-lfa +! +interface eth-rt4-1 + ip router isis 1 + ipv6 router isis 1 + isis network point-to-point + isis hello-multiplier 3 + isis fast-reroute ti-lfa +! +interface eth-rt4-2 + ip router isis 1 + ipv6 router isis 1 + isis network point-to-point + isis hello-multiplier 3 + isis fast-reroute ti-lfa +! +router isis 1 + net 49.0000.0000.0000.0002.00 + is-type level-1 + lsp-gen-interval 2 + topology ipv6-unicast + segment-routing on + segment-routing global-block 16000 23999 + segment-routing node-msd 8 + segment-routing prefix 2.2.2.2/32 index 20 + segment-routing prefix 2001:db8:1000::2/128 index 21 +! diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step1/show_ip_route.ref b/tests/topotests/isis-tilfa-topo1/rt2/step1/show_ip_route.ref new file mode 100644 index 0000000000..23e07b7cda --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step1/show_ip_route.ref @@ -0,0 +1,560 @@ +{ + "1.1.1.1\/32":[ + { + "prefix":"1.1.1.1\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.1", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "backupIndex":[ + 0, + 1 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16050, + 16010 + ] + }, + { + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16050, + 16010 + ] + } + ] + } + ], + "3.3.3.3\/32":[ + { + "prefix":"3.3.3.3\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "backupIndex":[ + 0, + 1 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16050, + 16030 + ] + }, + { + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16050, + 16030 + ] + } + ] + } + ], + "4.4.4.4\/32":[ + { + "prefix":"4.4.4.4\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + }, + { + "fib":true, + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16050, + 16040 + ] + } + ] + } + ], + "5.5.5.5\/32":[ + { + "prefix":"5.5.5.5\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16050 + ] + }, + { + "fib":true, + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16050 + ] + }, + { + "fib":true, + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16050 + ] + } + ] + } + ], + "6.6.6.6\/32":[ + { + "prefix":"6.6.6.6\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 16060 + ] + }, + { + "fib":true, + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 16060 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true + } + ] + } + ], + "10.0.1.0\/24":[ + { + "prefix":"10.0.1.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.1.1", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "backupIndex":[ + 0, + 1 + ] + }, + { + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "backupIndex":[ + 0, + 1 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16050 + ] + }, + { + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16050 + ] + } + ] + } + ], + "10.0.2.0\/24":[ + { + "prefix":"10.0.2.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", + "backupIndex":[ + 0 + ] + }, + { + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true, + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16050 + ] + } + ] + } + ], + "10.0.3.0\/24":[ + { + "prefix":"10.0.3.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", + "active":true, + "backupIndex":[ + 0 + ] + }, + { + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16050 + ] + } + ] + } + ], + "10.0.4.0\/24":[ + { + "prefix":"10.0.4.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "backupIndex":[ + 0, + 1 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", + "active":true + }, + { + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true + } + ] + } + ], + "10.0.5.0\/24":[ + { + "prefix":"10.0.5.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "backupIndex":[ + 0, + 1 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", + "active":true + }, + { + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true + } + ] + } + ], + "10.0.6.0\/24":[ + { + "prefix":"10.0.6.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", + "active":true, + "backupIndex":[ + 0 + ] + }, + { + "fib":true, + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true, + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true + } + ] + } + ], + "10.0.7.0\/24":[ + { + "prefix":"10.0.7.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", + "active":true, + "backupIndex":[ + 0 + ] + }, + { + "fib":true, + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true, + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16050 + ] + } + ] + } + ], + "10.0.8.0\/24":[ + { + "prefix":"10.0.8.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true + }, + { + "fib":true, + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", + "active":true + }, + { + "fib":true, + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true + } + ] + } + ] +} diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step1/show_ipv6_route.ref b/tests/topotests/isis-tilfa-topo1/rt2/step1/show_ipv6_route.ref new file mode 100644 index 0000000000..d9bd04ef30 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step1/show_ipv6_route.ref @@ -0,0 +1,226 @@ +{ + "2001:db8:1000::1\/128":[ + { + "prefix":"2001:db8:1000::1\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "backupIndex":[ + 0, + 1 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "afi":"ipv6", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16051, + 16011 + ] + }, + { + "afi":"ipv6", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16051, + 16011 + ] + } + ] + } + ], + "2001:db8:1000::3\/128":[ + { + "prefix":"2001:db8:1000::3\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "backupIndex":[ + 0, + 1 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "afi":"ipv6", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16051, + 16031 + ] + }, + { + "afi":"ipv6", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16051, + 16031 + ] + } + ] + } + ], + "2001:db8:1000::4\/128":[ + { + "prefix":"2001:db8:1000::4\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-2", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-1", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16051, + 16041 + ] + } + ] + } + ], + "2001:db8:1000::5\/128":[ + { + "prefix":"2001:db8:1000::5\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16051 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ + 16051 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ + 16051 + ] + } + ] + } + ], + "2001:db8:1000::6\/128":[ + { + "prefix":"2001:db8:1000::6\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-2", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 16061 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-1", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 16061 + ] + } + ], + "backupNexthops":[ + { + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true + } + ] + } + ] +} diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step1/show_mpls_table.ref b/tests/topotests/isis-tilfa-topo1/rt2/step1/show_mpls_table.ref new file mode 100644 index 0000000000..cd2f879593 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step1/show_mpls_table.ref @@ -0,0 +1,286 @@ +{ + "16010":{ + "inLabel":16010, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "nexthop":"10.0.1.1", + "backupIndex":[ + 0, + 1 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16050, + "nexthop":"10.0.2.4" + }, + { + "type":"SR (IS-IS)", + "outLabel":16050, + "nexthop":"10.0.3.4" + } + ] + }, + "16011":{ + "inLabel":16011, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "interface":"eth-sw1", + "backupIndex":[ + 0, + 1 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16051, + "interface":"eth-rt4-1" + }, + { + "type":"SR (IS-IS)", + "outLabel":16051, + "interface":"eth-rt4-2" + } + ] + }, + "16030":{ + "inLabel":16030, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "nexthop":"10.0.1.3", + "backupIndex":[ + 0, + 1 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16050, + "nexthop":"10.0.2.4" + }, + { + "type":"SR (IS-IS)", + "outLabel":16050, + "nexthop":"10.0.3.4" + } + ] + }, + "16031":{ + "inLabel":16031, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "interface":"eth-sw1", + "backupIndex":[ + 0, + 1 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16051, + "interface":"eth-rt4-1" + }, + { + "type":"SR (IS-IS)", + "outLabel":16051, + "interface":"eth-rt4-2" + } + ] + }, + "16040":{ + "inLabel":16040, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "nexthop":"10.0.3.4", + "backupIndex":[ + 0 + ] + }, + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "nexthop":"10.0.2.4", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16050, + "nexthop":"10.0.1.3" + } + ] + }, + "16041":{ + "inLabel":16041, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "interface":"eth-rt4-2", + "backupIndex":[ + 0 + ] + }, + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "interface":"eth-rt4-1", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16051, + "interface":"eth-sw1" + } + ] + }, + "16050":{ + "inLabel":16050, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16050, + "installed":true, + "nexthop":"10.0.3.4" + }, + { + "type":"SR (IS-IS)", + "outLabel":16050, + "installed":true, + "nexthop":"10.0.2.4" + }, + { + "type":"SR (IS-IS)", + "outLabel":16050, + "installed":true, + "nexthop":"10.0.1.3" + } + ] + }, + "16051":{ + "inLabel":16051, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16051, + "installed":true, + "interface":"eth-rt4-2" + }, + { + "type":"SR (IS-IS)", + "outLabel":16051, + "installed":true, + "interface":"eth-rt4-1" + }, + { + "type":"SR (IS-IS)", + "outLabel":16051, + "installed":true, + "interface":"eth-sw1" + } + ] + }, + "16060":{ + "inLabel":16060, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16060, + "installed":true, + "nexthop":"10.0.3.4", + "backupIndex":[ + 0 + ] + }, + { + "type":"SR (IS-IS)", + "outLabel":16060, + "installed":true, + "nexthop":"10.0.2.4", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "nexthop":"10.0.1.3" + } + ] + }, + "16061":{ + "inLabel":16061, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16061, + "installed":true, + "interface":"eth-rt4-2", + "backupIndex":[ + 0 + ] + }, + { + "type":"SR (IS-IS)", + "outLabel":16061, + "installed":true, + "interface":"eth-rt4-1", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "interface":"eth-sw1" + } + ] + } +} diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step1/show_yang_interface_isis_adjacencies.ref b/tests/topotests/isis-tilfa-topo1/rt2/step1/show_yang_interface_isis_adjacencies.ref new file mode 100644 index 0000000000..1ea72a528b --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step1/show_yang_interface_isis_adjacencies.ref @@ -0,0 +1,70 @@ +{ + "frr-interface:lib": { + "interface": [ + { + "name": "eth-rt4-1", + "vrf": "default", + "state": { + "frr-isisd:isis": { + "adjacencies": { + "adjacency": [ + { + "neighbor-sys-type": "level-1", + "neighbor-sysid": "0000.0000.0004", + "hold-timer": 9, + "neighbor-priority": 0, + "state": "up" + } + ] + } + } + } + }, + { + "name": "eth-rt4-2", + "vrf": "default", + "state": { + "frr-isisd:isis": { + "adjacencies": { + "adjacency": [ + { + "neighbor-sys-type": "level-1", + "neighbor-sysid": "0000.0000.0004", + "hold-timer": 9, + "neighbor-priority": 0, + "state": "up" + } + ] + } + } + } + }, + { + "name": "eth-sw1", + "vrf": "default", + "state": { + "frr-isisd:isis": { + "adjacencies": { + "adjacency": [ + { + "neighbor-sys-type": "level-1", + "neighbor-sysid": "0000.0000.0001", + "hold-timer": 9, + "neighbor-priority": 100, + "state": "up" + }, + { + "neighbor-sys-type": "level-1", + "neighbor-sysid": "0000.0000.0003", + "hold-timer": 9, + "neighbor-priority": 64, + "state": "up" + } + ] + } + } + } + } + ] + } +} diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step2/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step2/show_ip_route.ref.diff new file mode 100644 index 0000000000..22b896f684 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step2/show_ip_route.ref.diff @@ -0,0 +1,169 @@ +--- rt2/step1/show_ip_route.ref 2020-09-25 17:46:27.537642781 -0300 ++++ rt2/step2/show_ip_route.ref 2020-09-25 17:46:57.306029668 -0300 +@@ -15,36 +15,10 @@ + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, +- "backupIndex":[ +- 0, +- 1 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.2.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4-1", +- "active":true, +- "labels":[ +- 16050, +- 16010 +- ] +- }, +- { +- "ip":"10.0.3.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4-2", +- "active":true, +- "labels":[ +- 16050, +- 16010 +- ] +- } + ] + } + ], +@@ -64,36 +38,10 @@ + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, +- "backupIndex":[ +- 0, +- 1 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.2.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4-1", +- "active":true, +- "labels":[ +- 16050, +- 16030 +- ] +- }, +- { +- "ip":"10.0.3.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4-2", +- "active":true, +- "labels":[ +- 16050, +- 16030 +- ] +- } + ] + } + ], +@@ -248,40 +196,12 @@ + { + "ip":"10.0.1.1", + "afi":"ipv4", +- "interfaceName":"eth-sw1", +- "backupIndex":[ +- 0, +- 1 +- ] ++ "interfaceName":"eth-sw1" + }, + { + "ip":"10.0.1.3", + "afi":"ipv4", +- "interfaceName":"eth-sw1", +- "backupIndex":[ +- 0, +- 1 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.2.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4-1", +- "active":true, +- "labels":[ +- 16050 +- ] +- }, +- { +- "ip":"10.0.3.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4-2", +- "active":true, +- "labels":[ +- 16050 +- ] ++ "interfaceName":"eth-sw1" + } + ] + } +@@ -377,24 +297,6 @@ + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", +- "active":true, +- "backupIndex":[ +- 0, +- 1 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.2.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4-1", +- "active":true +- }, +- { +- "ip":"10.0.3.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4-2", + "active":true + } + ] +@@ -415,24 +317,6 @@ + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", +- "active":true, +- "backupIndex":[ +- 0, +- 1 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.2.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4-1", +- "active":true +- }, +- { +- "ip":"10.0.3.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4-2", + "active":true + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step2/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step2/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..08c7d2b1fc --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step2/show_ipv6_route.ref.diff @@ -0,0 +1,72 @@ +--- rt2/step1/show_ipv6_route.ref 2020-09-25 17:46:28.865660035 -0300 ++++ rt2/step2/show_ipv6_route.ref 2020-09-25 17:46:58.514045373 -0300 +@@ -14,34 +14,10 @@ + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, +- "backupIndex":[ +- 0, +- 1 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "afi":"ipv6", +- "interfaceName":"eth-rt4-1", +- "active":true, +- "labels":[ +- 16051, +- 16011 +- ] +- }, +- { +- "afi":"ipv6", +- "interfaceName":"eth-rt4-2", +- "active":true, +- "labels":[ +- 16051, +- 16011 +- ] +- } + ] + } + ], +@@ -60,34 +36,10 @@ + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, +- "backupIndex":[ +- 0, +- 1 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "afi":"ipv6", +- "interfaceName":"eth-rt4-1", +- "active":true, +- "labels":[ +- 16051, +- 16031 +- ] +- }, +- { +- "afi":"ipv6", +- "interfaceName":"eth-rt4-2", +- "active":true, +- "labels":[ +- 16051, +- 16031 +- ] +- } + ] + } + ], diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step2/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step2/show_mpls_table.ref.diff new file mode 100644 index 0000000000..4feb927156 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step2/show_mpls_table.ref.diff @@ -0,0 +1,102 @@ +--- rt2/step1/show_mpls_table.ref 2020-09-25 17:46:26.261626203 -0300 ++++ rt2/step2/show_mpls_table.ref 2020-09-25 17:46:56.086013807 -0300 +@@ -7,23 +7,7 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.1.1", +- "backupIndex":[ +- 0, +- 1 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16050, +- "nexthop":"10.0.2.4" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16050, +- "nexthop":"10.0.3.4" ++ "nexthop":"10.0.1.1" + } + ] + }, +@@ -35,23 +19,7 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-sw1", +- "backupIndex":[ +- 0, +- 1 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16051, +- "interface":"eth-rt4-1" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16051, +- "interface":"eth-rt4-2" ++ "interface":"eth-sw1" + } + ] + }, +@@ -63,23 +31,7 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.1.3", +- "backupIndex":[ +- 0, +- 1 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16050, +- "nexthop":"10.0.2.4" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16050, +- "nexthop":"10.0.3.4" ++ "nexthop":"10.0.1.3" + } + ] + }, +@@ -91,23 +43,7 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-sw1", +- "backupIndex":[ +- 0, +- 1 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16051, +- "interface":"eth-rt4-1" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16051, +- "interface":"eth-rt4-2" ++ "interface":"eth-sw1" + } + ] + }, diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step3/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step3/show_ip_route.ref.diff new file mode 100644 index 0000000000..af1cebc76d --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step3/show_ip_route.ref.diff @@ -0,0 +1,169 @@ +--- rt2/step2/show_ip_route.ref 2020-09-25 17:46:57.306029668 -0300 ++++ rt2/step3/show_ip_route.ref 2020-09-25 17:48:05.274913964 -0300 +@@ -15,10 +15,36 @@ + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, ++ "backupIndex":[ ++ 0, ++ 1 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.2.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4-1", ++ "active":true, ++ "labels":[ ++ 16050, ++ 16010 ++ ] ++ }, ++ { ++ "ip":"10.0.3.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4-2", ++ "active":true, ++ "labels":[ ++ 16050, ++ 16010 ++ ] ++ } + ] + } + ], +@@ -38,10 +64,36 @@ + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, ++ "backupIndex":[ ++ 0, ++ 1 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.2.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4-1", ++ "active":true, ++ "labels":[ ++ 16050, ++ 16030 ++ ] ++ }, ++ { ++ "ip":"10.0.3.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4-2", ++ "active":true, ++ "labels":[ ++ 16050, ++ 16030 ++ ] ++ } + ] + } + ], +@@ -196,12 +248,40 @@ + { + "ip":"10.0.1.1", + "afi":"ipv4", +- "interfaceName":"eth-sw1" ++ "interfaceName":"eth-sw1", ++ "backupIndex":[ ++ 0, ++ 1 ++ ] + }, + { + "ip":"10.0.1.3", + "afi":"ipv4", +- "interfaceName":"eth-sw1" ++ "interfaceName":"eth-sw1", ++ "backupIndex":[ ++ 0, ++ 1 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.2.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4-1", ++ "active":true, ++ "labels":[ ++ 16050 ++ ] ++ }, ++ { ++ "ip":"10.0.3.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4-2", ++ "active":true, ++ "labels":[ ++ 16050 ++ ] + } + ] + } +@@ -297,6 +377,24 @@ + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", ++ "active":true, ++ "backupIndex":[ ++ 0, ++ 1 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.2.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4-1", ++ "active":true ++ }, ++ { ++ "ip":"10.0.3.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4-2", + "active":true + } + ] +@@ -317,6 +415,24 @@ + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", ++ "active":true, ++ "backupIndex":[ ++ 0, ++ 1 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.2.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4-1", ++ "active":true ++ }, ++ { ++ "ip":"10.0.3.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4-2", + "active":true + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step3/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step3/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..9809c316e8 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step3/show_ipv6_route.ref.diff @@ -0,0 +1,72 @@ +--- rt2/step2/show_ipv6_route.ref 2020-09-25 17:46:58.514045373 -0300 ++++ rt2/step3/show_ipv6_route.ref 2020-09-25 17:48:06.570930838 -0300 +@@ -14,10 +14,34 @@ + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, ++ "backupIndex":[ ++ 0, ++ 1 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "afi":"ipv6", ++ "interfaceName":"eth-rt4-1", ++ "active":true, ++ "labels":[ ++ 16051, ++ 16011 ++ ] ++ }, ++ { ++ "afi":"ipv6", ++ "interfaceName":"eth-rt4-2", ++ "active":true, ++ "labels":[ ++ 16051, ++ 16011 ++ ] ++ } + ] + } + ], +@@ -36,10 +60,34 @@ + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, ++ "backupIndex":[ ++ 0, ++ 1 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "afi":"ipv6", ++ "interfaceName":"eth-rt4-1", ++ "active":true, ++ "labels":[ ++ 16051, ++ 16031 ++ ] ++ }, ++ { ++ "afi":"ipv6", ++ "interfaceName":"eth-rt4-2", ++ "active":true, ++ "labels":[ ++ 16051, ++ 16031 ++ ] ++ } + ] + } + ], diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step3/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step3/show_mpls_table.ref.diff new file mode 100644 index 0000000000..180323e4c8 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step3/show_mpls_table.ref.diff @@ -0,0 +1,102 @@ +--- rt2/step2/show_mpls_table.ref 2020-09-25 17:46:56.086013807 -0300 ++++ rt2/step3/show_mpls_table.ref 2020-09-25 17:48:03.994897300 -0300 +@@ -7,7 +7,23 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.1.1" ++ "nexthop":"10.0.1.1", ++ "backupIndex":[ ++ 0, ++ 1 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16050, ++ "nexthop":"10.0.2.4" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16050, ++ "nexthop":"10.0.3.4" + } + ] + }, +@@ -19,7 +35,23 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-sw1" ++ "interface":"eth-sw1", ++ "backupIndex":[ ++ 0, ++ 1 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16051, ++ "interface":"eth-rt4-1" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16051, ++ "interface":"eth-rt4-2" + } + ] + }, +@@ -31,7 +63,23 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.1.3" ++ "nexthop":"10.0.1.3", ++ "backupIndex":[ ++ 0, ++ 1 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16050, ++ "nexthop":"10.0.2.4" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16050, ++ "nexthop":"10.0.3.4" + } + ] + }, +@@ -43,7 +91,23 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-sw1" ++ "interface":"eth-sw1", ++ "backupIndex":[ ++ 0, ++ 1 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16051, ++ "interface":"eth-rt4-1" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16051, ++ "interface":"eth-rt4-2" + } + ] + }, diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step4/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step4/show_ip_route.ref.diff new file mode 100644 index 0000000000..12d45bbe07 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step4/show_ip_route.ref.diff @@ -0,0 +1,192 @@ +--- rt2/step3/show_ip_route.ref 2020-09-25 17:48:05.274913964 -0300 ++++ rt2/step4/show_ip_route.ref 2020-09-25 17:49:01.763649797 -0300 +@@ -15,36 +15,10 @@ + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, +- "backupIndex":[ +- 0, +- 1 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.2.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4-1", +- "active":true, +- "labels":[ +- 16050, +- 16010 +- ] +- }, +- { +- "ip":"10.0.3.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4-2", +- "active":true, +- "labels":[ +- 16050, +- 16010 +- ] +- } + ] + } + ], +@@ -64,36 +38,10 @@ + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, +- "backupIndex":[ +- 0, +- 1 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.2.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4-1", +- "active":true, +- "labels":[ +- 16050, +- 16030 +- ] +- }, +- { +- "ip":"10.0.3.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4-2", +- "active":true, +- "labels":[ +- 16050, +- 16030 +- ] +- } + ] + } + ], +@@ -115,9 +63,6 @@ + "active":true, + "backupIndex":[ + 0 +- ], +- "labels":[ +- 3 + ] + }, + { +@@ -128,9 +73,6 @@ + "active":true, + "backupIndex":[ + 0 +- ], +- "labels":[ +- 3 + ] + } + ], +@@ -141,8 +83,7 @@ + "interfaceName":"eth-sw1", + "active":true, + "labels":[ +- 16050, +- 16040 ++ 16050 + ] + } + ] +@@ -173,20 +114,14 @@ + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", +- "active":true, +- "labels":[ +- 16050 +- ] ++ "active":true + }, + { + "fib":true, + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", +- "active":true, +- "labels":[ +- 16050 +- ] ++ "active":true + } + ] + } +@@ -209,9 +144,6 @@ + "active":true, + "backupIndex":[ + 0 +- ], +- "labels":[ +- 16060 + ] + }, + { +@@ -222,9 +154,6 @@ + "active":true, + "backupIndex":[ + 0 +- ], +- "labels":[ +- 16060 + ] + } + ], +@@ -248,40 +177,12 @@ + { + "ip":"10.0.1.1", + "afi":"ipv4", +- "interfaceName":"eth-sw1", +- "backupIndex":[ +- 0, +- 1 +- ] ++ "interfaceName":"eth-sw1" + }, + { + "ip":"10.0.1.3", + "afi":"ipv4", +- "interfaceName":"eth-sw1", +- "backupIndex":[ +- 0, +- 1 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.2.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4-1", +- "active":true, +- "labels":[ +- 16050 +- ] +- }, +- { +- "ip":"10.0.3.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4-2", +- "active":true, +- "labels":[ +- 16050 +- ] ++ "interfaceName":"eth-sw1" + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step4/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step4/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..fdf658d59d --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step4/show_ipv6_route.ref.diff @@ -0,0 +1,144 @@ +--- rt2/step3/show_ipv6_route.ref 2020-09-25 17:48:06.570930838 -0300 ++++ rt2/step4/show_ipv6_route.ref 2020-09-25 17:49:02.995665853 -0300 +@@ -14,34 +14,10 @@ + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, +- "backupIndex":[ +- 0, +- 1 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "afi":"ipv6", +- "interfaceName":"eth-rt4-1", +- "active":true, +- "labels":[ +- 16051, +- 16011 +- ] +- }, +- { +- "afi":"ipv6", +- "interfaceName":"eth-rt4-2", +- "active":true, +- "labels":[ +- 16051, +- 16011 +- ] +- } + ] + } + ], +@@ -60,34 +36,10 @@ + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, +- "backupIndex":[ +- 0, +- 1 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "afi":"ipv6", +- "interfaceName":"eth-rt4-1", +- "active":true, +- "labels":[ +- 16051, +- 16031 +- ] +- }, +- { +- "afi":"ipv6", +- "interfaceName":"eth-rt4-2", +- "active":true, +- "labels":[ +- 16051, +- 16031 +- ] +- } + ] + } + ], +@@ -108,9 +60,6 @@ + "active":true, + "backupIndex":[ + 0 +- ], +- "labels":[ +- 3 + ] + }, + { +@@ -120,9 +69,6 @@ + "active":true, + "backupIndex":[ + 0 +- ], +- "labels":[ +- 3 + ] + } + ], +@@ -132,8 +78,7 @@ + "interfaceName":"eth-sw1", + "active":true, + "labels":[ +- 16051, +- 16041 ++ 16051 + ] + } + ] +@@ -162,19 +107,13 @@ + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-2", +- "active":true, +- "labels":[ +- 16051 +- ] ++ "active":true + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-1", +- "active":true, +- "labels":[ +- 16051 +- ] ++ "active":true + } + ] + } +@@ -196,9 +135,6 @@ + "active":true, + "backupIndex":[ + 0 +- ], +- "labels":[ +- 16061 + ] + }, + { +@@ -208,9 +144,6 @@ + "active":true, + "backupIndex":[ + 0 +- ], +- "labels":[ +- 16061 + ] + } + ], diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step4/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step4/show_mpls_table.ref.diff new file mode 100644 index 0000000000..a78f79c576 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step4/show_mpls_table.ref.diff @@ -0,0 +1,200 @@ +--- rt2/step3/show_mpls_table.ref 2020-09-25 17:48:03.994897300 -0300 ++++ rt2/step4/show_mpls_table.ref 2020-09-25 17:49:00.551634001 -0300 +@@ -7,23 +7,7 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.1.1", +- "backupIndex":[ +- 0, +- 1 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16050, +- "nexthop":"10.0.2.4" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16050, +- "nexthop":"10.0.3.4" ++ "nexthop":"10.0.1.1" + } + ] + }, +@@ -35,23 +19,7 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-sw1", +- "backupIndex":[ +- 0, +- 1 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16051, +- "interface":"eth-rt4-1" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16051, +- "interface":"eth-rt4-2" ++ "interface":"eth-sw1" + } + ] + }, +@@ -63,23 +31,7 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.1.3", +- "backupIndex":[ +- 0, +- 1 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16050, +- "nexthop":"10.0.2.4" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16050, +- "nexthop":"10.0.3.4" ++ "nexthop":"10.0.1.3" + } + ] + }, +@@ -91,84 +43,6 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-sw1", +- "backupIndex":[ +- 0, +- 1 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16051, +- "interface":"eth-rt4-1" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16051, +- "interface":"eth-rt4-2" +- } +- ] +- }, +- "16040":{ +- "inLabel":16040, +- "installed":true, +- "nexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "installed":true, +- "nexthop":"10.0.3.4", +- "backupIndex":[ +- 0 +- ] +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "installed":true, +- "nexthop":"10.0.2.4", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16050, +- "nexthop":"10.0.1.3" +- } +- ] +- }, +- "16041":{ +- "inLabel":16041, +- "installed":true, +- "nexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "installed":true, +- "interface":"eth-rt4-2", +- "backupIndex":[ +- 0 +- ] +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "installed":true, +- "interface":"eth-rt4-1", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16051, + "interface":"eth-sw1" + } + ] +@@ -181,18 +55,6 @@ + "type":"SR (IS-IS)", + "outLabel":16050, + "installed":true, +- "nexthop":"10.0.3.4" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16050, +- "installed":true, +- "nexthop":"10.0.2.4" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16050, +- "installed":true, + "nexthop":"10.0.1.3" + } + ] +@@ -204,18 +66,6 @@ + { + "type":"SR (IS-IS)", + "outLabel":16051, +- "installed":true, +- "interface":"eth-rt4-2" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16051, +- "installed":true, +- "interface":"eth-rt4-1" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16051, + "installed":true, + "interface":"eth-sw1" + } diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step5/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step5/show_ip_route.ref.diff new file mode 100644 index 0000000000..7d20fad3f4 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step5/show_ip_route.ref.diff @@ -0,0 +1,192 @@ +--- rt2/step4/show_ip_route.ref 2020-09-25 17:49:01.763649797 -0300 ++++ rt2/step5/show_ip_route.ref 2020-09-25 17:50:12.360570411 -0300 +@@ -15,10 +15,36 @@ + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, ++ "backupIndex":[ ++ 0, ++ 1 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.2.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4-1", ++ "active":true, ++ "labels":[ ++ 16050, ++ 16010 ++ ] ++ }, ++ { ++ "ip":"10.0.3.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4-2", ++ "active":true, ++ "labels":[ ++ 16050, ++ 16010 ++ ] ++ } + ] + } + ], +@@ -38,10 +64,36 @@ + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, ++ "backupIndex":[ ++ 0, ++ 1 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.2.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4-1", ++ "active":true, ++ "labels":[ ++ 16050, ++ 16030 ++ ] ++ }, ++ { ++ "ip":"10.0.3.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4-2", ++ "active":true, ++ "labels":[ ++ 16050, ++ 16030 ++ ] ++ } + ] + } + ], +@@ -63,6 +115,9 @@ + "active":true, + "backupIndex":[ + 0 ++ ], ++ "labels":[ ++ 3 + ] + }, + { +@@ -73,6 +128,9 @@ + "active":true, + "backupIndex":[ + 0 ++ ], ++ "labels":[ ++ 3 + ] + } + ], +@@ -83,7 +141,8 @@ + "interfaceName":"eth-sw1", + "active":true, + "labels":[ +- 16050 ++ 16050, ++ 16040 + ] + } + ] +@@ -114,14 +173,20 @@ + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", +- "active":true ++ "active":true, ++ "labels":[ ++ 16050 ++ ] + }, + { + "fib":true, + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", +- "active":true ++ "active":true, ++ "labels":[ ++ 16050 ++ ] + } + ] + } +@@ -144,6 +209,9 @@ + "active":true, + "backupIndex":[ + 0 ++ ], ++ "labels":[ ++ 16060 + ] + }, + { +@@ -154,6 +222,9 @@ + "active":true, + "backupIndex":[ + 0 ++ ], ++ "labels":[ ++ 16060 + ] + } + ], +@@ -177,12 +248,40 @@ + { + "ip":"10.0.1.1", + "afi":"ipv4", +- "interfaceName":"eth-sw1" ++ "interfaceName":"eth-sw1", ++ "backupIndex":[ ++ 0, ++ 1 ++ ] + }, + { + "ip":"10.0.1.3", + "afi":"ipv4", +- "interfaceName":"eth-sw1" ++ "interfaceName":"eth-sw1", ++ "backupIndex":[ ++ 0, ++ 1 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.2.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4-1", ++ "active":true, ++ "labels":[ ++ 16050 ++ ] ++ }, ++ { ++ "ip":"10.0.3.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4-2", ++ "active":true, ++ "labels":[ ++ 16050 ++ ] + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step5/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step5/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..9330964338 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step5/show_ipv6_route.ref.diff @@ -0,0 +1,144 @@ +--- rt2/step4/show_ipv6_route.ref 2020-09-25 17:49:02.995665853 -0300 ++++ rt2/step5/show_ipv6_route.ref 2020-09-25 17:50:13.636587060 -0300 +@@ -14,10 +14,34 @@ + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, ++ "backupIndex":[ ++ 0, ++ 1 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "afi":"ipv6", ++ "interfaceName":"eth-rt4-1", ++ "active":true, ++ "labels":[ ++ 16051, ++ 16011 ++ ] ++ }, ++ { ++ "afi":"ipv6", ++ "interfaceName":"eth-rt4-2", ++ "active":true, ++ "labels":[ ++ 16051, ++ 16011 ++ ] ++ } + ] + } + ], +@@ -36,10 +60,34 @@ + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, ++ "backupIndex":[ ++ 0, ++ 1 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "afi":"ipv6", ++ "interfaceName":"eth-rt4-1", ++ "active":true, ++ "labels":[ ++ 16051, ++ 16031 ++ ] ++ }, ++ { ++ "afi":"ipv6", ++ "interfaceName":"eth-rt4-2", ++ "active":true, ++ "labels":[ ++ 16051, ++ 16031 ++ ] ++ } + ] + } + ], +@@ -60,6 +108,9 @@ + "active":true, + "backupIndex":[ + 0 ++ ], ++ "labels":[ ++ 3 + ] + }, + { +@@ -69,6 +120,9 @@ + "active":true, + "backupIndex":[ + 0 ++ ], ++ "labels":[ ++ 3 + ] + } + ], +@@ -78,7 +132,8 @@ + "interfaceName":"eth-sw1", + "active":true, + "labels":[ +- 16051 ++ 16051, ++ 16041 + ] + } + ] +@@ -107,13 +162,19 @@ + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-2", +- "active":true ++ "active":true, ++ "labels":[ ++ 16051 ++ ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-1", +- "active":true ++ "active":true, ++ "labels":[ ++ 16051 ++ ] + } + ] + } +@@ -135,6 +196,9 @@ + "active":true, + "backupIndex":[ + 0 ++ ], ++ "labels":[ ++ 16061 + ] + }, + { +@@ -144,6 +208,9 @@ + "active":true, + "backupIndex":[ + 0 ++ ], ++ "labels":[ ++ 16061 + ] + } + ], diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step5/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step5/show_mpls_table.ref.diff new file mode 100644 index 0000000000..b1e44a727f --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step5/show_mpls_table.ref.diff @@ -0,0 +1,200 @@ +--- rt2/step4/show_mpls_table.ref 2020-09-25 17:49:00.551634001 -0300 ++++ rt2/step5/show_mpls_table.ref 2020-09-25 17:50:11.068553553 -0300 +@@ -7,7 +7,23 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.1.1" ++ "nexthop":"10.0.1.1", ++ "backupIndex":[ ++ 0, ++ 1 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16050, ++ "nexthop":"10.0.2.4" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16050, ++ "nexthop":"10.0.3.4" + } + ] + }, +@@ -19,7 +35,23 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-sw1" ++ "interface":"eth-sw1", ++ "backupIndex":[ ++ 0, ++ 1 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16051, ++ "interface":"eth-rt4-1" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16051, ++ "interface":"eth-rt4-2" + } + ] + }, +@@ -31,7 +63,23 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.1.3" ++ "nexthop":"10.0.1.3", ++ "backupIndex":[ ++ 0, ++ 1 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16050, ++ "nexthop":"10.0.2.4" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16050, ++ "nexthop":"10.0.3.4" + } + ] + }, +@@ -43,6 +91,84 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, ++ "interface":"eth-sw1", ++ "backupIndex":[ ++ 0, ++ 1 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16051, ++ "interface":"eth-rt4-1" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16051, ++ "interface":"eth-rt4-2" ++ } ++ ] ++ }, ++ "16040":{ ++ "inLabel":16040, ++ "installed":true, ++ "nexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "installed":true, ++ "nexthop":"10.0.3.4", ++ "backupIndex":[ ++ 0 ++ ] ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "installed":true, ++ "nexthop":"10.0.2.4", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16050, ++ "nexthop":"10.0.1.3" ++ } ++ ] ++ }, ++ "16041":{ ++ "inLabel":16041, ++ "installed":true, ++ "nexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "installed":true, ++ "interface":"eth-rt4-2", ++ "backupIndex":[ ++ 0 ++ ] ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "installed":true, ++ "interface":"eth-rt4-1", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16051, + "interface":"eth-sw1" + } + ] +@@ -55,6 +181,18 @@ + "type":"SR (IS-IS)", + "outLabel":16050, + "installed":true, ++ "nexthop":"10.0.3.4" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16050, ++ "installed":true, ++ "nexthop":"10.0.2.4" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16050, ++ "installed":true, + "nexthop":"10.0.1.3" + } + ] +@@ -66,6 +204,18 @@ + { + "type":"SR (IS-IS)", + "outLabel":16051, ++ "installed":true, ++ "interface":"eth-rt4-2" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16051, ++ "installed":true, ++ "interface":"eth-rt4-1" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16051, + "installed":true, + "interface":"eth-sw1" + } diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step6/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step6/show_ip_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step6/show_ip_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step6/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step6/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step6/show_ipv6_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step6/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step6/show_mpls_table.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step6/show_mpls_table.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step7/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step7/show_ip_route.ref.diff new file mode 100644 index 0000000000..c92195d704 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step7/show_ip_route.ref.diff @@ -0,0 +1,288 @@ +--- rt2/step6/show_ip_route.ref 2020-09-25 17:51:15.313392177 -0300 ++++ rt2/step7/show_ip_route.ref 2020-09-25 17:52:02.210004805 -0300 +@@ -15,36 +15,10 @@ + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, +- "backupIndex":[ +- 0, +- 1 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.2.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4-1", +- "active":true, +- "labels":[ +- 16050, +- 16010 +- ] +- }, +- { +- "ip":"10.0.3.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4-2", +- "active":true, +- "labels":[ +- 16050, +- 16010 +- ] +- } + ] + } + ], +@@ -64,36 +38,10 @@ + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, +- "backupIndex":[ +- 0, +- 1 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.2.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4-1", +- "active":true, +- "labels":[ +- 16050, +- 16030 +- ] +- }, +- { +- "ip":"10.0.3.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4-2", +- "active":true, +- "labels":[ +- 16050, +- 16030 +- ] +- } + ] + } + ], +@@ -113,9 +61,6 @@ + "afi":"ipv4", + "interfaceName":"eth-rt4-1", + "active":true, +- "backupIndex":[ +- 0 +- ], + "labels":[ + 3 + ] +@@ -126,25 +71,10 @@ + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true, +- "backupIndex":[ +- 0 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.1.3", +- "afi":"ipv4", +- "interfaceName":"eth-sw1", +- "active":true, +- "labels":[ +- 16050, +- 16040 +- ] +- } + ] + } + ], +@@ -163,30 +93,21 @@ + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", +- "active":true, +- "labels":[ +- 16050 +- ] ++ "active":true + }, + { + "fib":true, + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", +- "active":true, +- "labels":[ +- 16050 +- ] ++ "active":true + }, + { + "fib":true, + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", +- "active":true, +- "labels":[ +- 16050 +- ] ++ "active":true + } + ] + } +@@ -248,40 +169,12 @@ + { + "ip":"10.0.1.1", + "afi":"ipv4", +- "interfaceName":"eth-sw1", +- "backupIndex":[ +- 0, +- 1 +- ] ++ "interfaceName":"eth-sw1" + }, + { + "ip":"10.0.1.3", + "afi":"ipv4", +- "interfaceName":"eth-sw1", +- "backupIndex":[ +- 0, +- 1 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.2.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4-1", +- "active":true, +- "labels":[ +- 16050 +- ] +- }, +- { +- "ip":"10.0.3.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4-2", +- "active":true, +- "labels":[ +- 16050 +- ] ++ "interfaceName":"eth-sw1" + } + ] + } +@@ -296,30 +189,13 @@ + { + "ip":"10.0.2.4", + "afi":"ipv4", +- "interfaceName":"eth-rt4-1", +- "backupIndex":[ +- 0 +- ] ++ "interfaceName":"eth-rt4-1" + }, + { + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", +- "active":true, +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.1.3", +- "afi":"ipv4", +- "interfaceName":"eth-sw1", +- "active":true, +- "labels":[ +- 16050 +- ] ++ "active":true + } + ] + } +@@ -335,29 +211,12 @@ + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", +- "active":true, +- "backupIndex":[ +- 0 +- ] ++ "active":true + }, + { + "ip":"10.0.3.4", + "afi":"ipv4", +- "interfaceName":"eth-rt4-2", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.1.3", +- "afi":"ipv4", +- "interfaceName":"eth-sw1", +- "active":true, +- "labels":[ +- 16050 +- ] ++ "interfaceName":"eth-rt4-2" + } + ] + } +@@ -494,31 +353,14 @@ + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", +- "active":true, +- "backupIndex":[ +- 0 +- ] ++ "active":true + }, + { + "fib":true, + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", +- "active":true, +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.1.3", +- "afi":"ipv4", +- "interfaceName":"eth-sw1", +- "active":true, +- "labels":[ +- 16050 +- ] ++ "active":true + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step7/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step7/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..140c7b08bf --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step7/show_ipv6_route.ref.diff @@ -0,0 +1,139 @@ +--- rt2/step6/show_ipv6_route.ref 2020-09-25 17:51:16.549408319 -0300 ++++ rt2/step7/show_ipv6_route.ref 2020-09-25 17:52:03.438020851 -0300 +@@ -14,34 +14,10 @@ + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, +- "backupIndex":[ +- 0, +- 1 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "afi":"ipv6", +- "interfaceName":"eth-rt4-1", +- "active":true, +- "labels":[ +- 16051, +- 16011 +- ] +- }, +- { +- "afi":"ipv6", +- "interfaceName":"eth-rt4-2", +- "active":true, +- "labels":[ +- 16051, +- 16011 +- ] +- } + ] + } + ], +@@ -60,34 +36,10 @@ + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, +- "backupIndex":[ +- 0, +- 1 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "afi":"ipv6", +- "interfaceName":"eth-rt4-1", +- "active":true, +- "labels":[ +- 16051, +- 16031 +- ] +- }, +- { +- "afi":"ipv6", +- "interfaceName":"eth-rt4-2", +- "active":true, +- "labels":[ +- 16051, +- 16031 +- ] +- } + ] + } + ], +@@ -106,9 +58,6 @@ + "afi":"ipv6", + "interfaceName":"eth-rt4-2", + "active":true, +- "backupIndex":[ +- 0 +- ], + "labels":[ + 3 + ] +@@ -118,24 +67,10 @@ + "afi":"ipv6", + "interfaceName":"eth-rt4-1", + "active":true, +- "backupIndex":[ +- 0 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "afi":"ipv6", +- "interfaceName":"eth-sw1", +- "active":true, +- "labels":[ +- 16051, +- 16041 +- ] +- } + ] + } + ], +@@ -153,28 +88,19 @@ + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", +- "active":true, +- "labels":[ +- 16051 +- ] ++ "active":true + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-2", +- "active":true, +- "labels":[ +- 16051 +- ] ++ "active":true + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-1", +- "active":true, +- "labels":[ +- 16051 +- ] ++ "active":true + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step7/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step7/show_mpls_table.ref.diff new file mode 100644 index 0000000000..f8476cd0bb --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step7/show_mpls_table.ref.diff @@ -0,0 +1,207 @@ +--- rt2/step6/show_mpls_table.ref 2020-09-25 17:51:14.073375985 -0300 ++++ rt2/step7/show_mpls_table.ref 2020-09-25 17:52:00.973988653 -0300 +@@ -7,23 +7,7 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.1.1", +- "backupIndex":[ +- 0, +- 1 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16050, +- "nexthop":"10.0.2.4" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16050, +- "nexthop":"10.0.3.4" ++ "nexthop":"10.0.1.1" + } + ] + }, +@@ -35,23 +19,7 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-sw1", +- "backupIndex":[ +- 0, +- 1 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16051, +- "interface":"eth-rt4-1" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16051, +- "interface":"eth-rt4-2" ++ "interface":"eth-sw1" + } + ] + }, +@@ -63,23 +31,7 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.1.3", +- "backupIndex":[ +- 0, +- 1 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16050, +- "nexthop":"10.0.2.4" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16050, +- "nexthop":"10.0.3.4" ++ "nexthop":"10.0.1.3" + } + ] + }, +@@ -91,23 +43,7 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-sw1", +- "backupIndex":[ +- 0, +- 1 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16051, +- "interface":"eth-rt4-1" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16051, +- "interface":"eth-rt4-2" ++ "interface":"eth-sw1" + } + ] + }, +@@ -119,26 +55,13 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.3.4", +- "backupIndex":[ +- 0 +- ] ++ "nexthop":"10.0.3.4" + }, + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.2.4", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16050, +- "nexthop":"10.0.1.3" ++ "nexthop":"10.0.2.4" + } + ] + }, +@@ -150,74 +73,13 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-rt4-2", +- "backupIndex":[ +- 0 +- ] +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "installed":true, +- "interface":"eth-rt4-1", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16051, +- "interface":"eth-sw1" +- } +- ] +- }, +- "16050":{ +- "inLabel":16050, +- "installed":true, +- "nexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16050, +- "installed":true, +- "nexthop":"10.0.3.4" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16050, +- "installed":true, +- "nexthop":"10.0.2.4" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16050, +- "installed":true, +- "nexthop":"10.0.1.3" +- } +- ] +- }, +- "16051":{ +- "inLabel":16051, +- "installed":true, +- "nexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16051, +- "installed":true, + "interface":"eth-rt4-2" + }, + { + "type":"SR (IS-IS)", +- "outLabel":16051, ++ "outLabel":3, + "installed":true, + "interface":"eth-rt4-1" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16051, +- "installed":true, +- "interface":"eth-sw1" + } + ] + }, diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step8/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step8/show_ip_route.ref.diff new file mode 100644 index 0000000000..7d5237e740 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step8/show_ip_route.ref.diff @@ -0,0 +1,288 @@ +--- rt2/step7/show_ip_route.ref 2020-09-25 17:52:02.210004805 -0300 ++++ rt2/step8/show_ip_route.ref 2020-09-25 17:53:20.207024469 -0300 +@@ -15,10 +15,36 @@ + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, ++ "backupIndex":[ ++ 0, ++ 1 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.2.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4-1", ++ "active":true, ++ "labels":[ ++ 16050, ++ 16010 ++ ] ++ }, ++ { ++ "ip":"10.0.3.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4-2", ++ "active":true, ++ "labels":[ ++ 16050, ++ 16010 ++ ] ++ } + ] + } + ], +@@ -38,10 +64,36 @@ + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, ++ "backupIndex":[ ++ 0, ++ 1 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.2.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4-1", ++ "active":true, ++ "labels":[ ++ 16050, ++ 16030 ++ ] ++ }, ++ { ++ "ip":"10.0.3.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4-2", ++ "active":true, ++ "labels":[ ++ 16050, ++ 16030 ++ ] ++ } + ] + } + ], +@@ -61,6 +113,9 @@ + "afi":"ipv4", + "interfaceName":"eth-rt4-1", + "active":true, ++ "backupIndex":[ ++ 0 ++ ], + "labels":[ + 3 + ] +@@ -71,10 +126,25 @@ + "afi":"ipv4", + "interfaceName":"eth-rt4-2", + "active":true, ++ "backupIndex":[ ++ 0 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.1.3", ++ "afi":"ipv4", ++ "interfaceName":"eth-sw1", ++ "active":true, ++ "labels":[ ++ 16050, ++ 16040 ++ ] ++ } + ] + } + ], +@@ -93,21 +163,30 @@ + "ip":"10.0.1.3", + "afi":"ipv4", + "interfaceName":"eth-sw1", +- "active":true ++ "active":true, ++ "labels":[ ++ 16050 ++ ] + }, + { + "fib":true, + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", +- "active":true ++ "active":true, ++ "labels":[ ++ 16050 ++ ] + }, + { + "fib":true, + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", +- "active":true ++ "active":true, ++ "labels":[ ++ 16050 ++ ] + } + ] + } +@@ -169,12 +248,40 @@ + { + "ip":"10.0.1.1", + "afi":"ipv4", +- "interfaceName":"eth-sw1" ++ "interfaceName":"eth-sw1", ++ "backupIndex":[ ++ 0, ++ 1 ++ ] + }, + { + "ip":"10.0.1.3", + "afi":"ipv4", +- "interfaceName":"eth-sw1" ++ "interfaceName":"eth-sw1", ++ "backupIndex":[ ++ 0, ++ 1 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.2.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4-1", ++ "active":true, ++ "labels":[ ++ 16050 ++ ] ++ }, ++ { ++ "ip":"10.0.3.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4-2", ++ "active":true, ++ "labels":[ ++ 16050 ++ ] + } + ] + } +@@ -189,13 +296,30 @@ + { + "ip":"10.0.2.4", + "afi":"ipv4", +- "interfaceName":"eth-rt4-1" ++ "interfaceName":"eth-rt4-1", ++ "backupIndex":[ ++ 0 ++ ] + }, + { + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", +- "active":true ++ "active":true, ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.1.3", ++ "afi":"ipv4", ++ "interfaceName":"eth-sw1", ++ "active":true, ++ "labels":[ ++ 16050 ++ ] + } + ] + } +@@ -211,12 +335,29 @@ + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", +- "active":true ++ "active":true, ++ "backupIndex":[ ++ 0 ++ ] + }, + { + "ip":"10.0.3.4", + "afi":"ipv4", +- "interfaceName":"eth-rt4-2" ++ "interfaceName":"eth-rt4-2", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.1.3", ++ "afi":"ipv4", ++ "interfaceName":"eth-sw1", ++ "active":true, ++ "labels":[ ++ 16050 ++ ] + } + ] + } +@@ -353,14 +494,31 @@ + "ip":"10.0.2.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-1", +- "active":true ++ "active":true, ++ "backupIndex":[ ++ 0 ++ ] + }, + { + "fib":true, + "ip":"10.0.3.4", + "afi":"ipv4", + "interfaceName":"eth-rt4-2", +- "active":true ++ "active":true, ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.1.3", ++ "afi":"ipv4", ++ "interfaceName":"eth-sw1", ++ "active":true, ++ "labels":[ ++ 16050 ++ ] + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step8/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step8/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..45322214e6 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step8/show_ipv6_route.ref.diff @@ -0,0 +1,139 @@ +--- rt2/step7/show_ipv6_route.ref 2020-09-25 17:52:03.438020851 -0300 ++++ rt2/step8/show_ipv6_route.ref 2020-09-25 17:53:21.443040633 -0300 +@@ -14,10 +14,34 @@ + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, ++ "backupIndex":[ ++ 0, ++ 1 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "afi":"ipv6", ++ "interfaceName":"eth-rt4-1", ++ "active":true, ++ "labels":[ ++ 16051, ++ 16011 ++ ] ++ }, ++ { ++ "afi":"ipv6", ++ "interfaceName":"eth-rt4-2", ++ "active":true, ++ "labels":[ ++ 16051, ++ 16011 ++ ] ++ } + ] + } + ], +@@ -36,10 +60,34 @@ + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, ++ "backupIndex":[ ++ 0, ++ 1 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "afi":"ipv6", ++ "interfaceName":"eth-rt4-1", ++ "active":true, ++ "labels":[ ++ 16051, ++ 16031 ++ ] ++ }, ++ { ++ "afi":"ipv6", ++ "interfaceName":"eth-rt4-2", ++ "active":true, ++ "labels":[ ++ 16051, ++ 16031 ++ ] ++ } + ] + } + ], +@@ -58,6 +106,9 @@ + "afi":"ipv6", + "interfaceName":"eth-rt4-2", + "active":true, ++ "backupIndex":[ ++ 0 ++ ], + "labels":[ + 3 + ] +@@ -67,10 +118,24 @@ + "afi":"ipv6", + "interfaceName":"eth-rt4-1", + "active":true, ++ "backupIndex":[ ++ 0 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "afi":"ipv6", ++ "interfaceName":"eth-sw1", ++ "active":true, ++ "labels":[ ++ 16051, ++ 16041 ++ ] ++ } + ] + } + ], +@@ -88,19 +153,28 @@ + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", +- "active":true ++ "active":true, ++ "labels":[ ++ 16051 ++ ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-2", +- "active":true ++ "active":true, ++ "labels":[ ++ 16051 ++ ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4-1", +- "active":true ++ "active":true, ++ "labels":[ ++ 16051 ++ ] + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step8/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step8/show_mpls_table.ref.diff new file mode 100644 index 0000000000..083c647802 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step8/show_mpls_table.ref.diff @@ -0,0 +1,207 @@ +--- rt2/step7/show_mpls_table.ref 2020-09-25 17:52:00.973988653 -0300 ++++ rt2/step8/show_mpls_table.ref 2020-09-25 17:53:18.923007676 -0300 +@@ -7,7 +7,23 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.1.1" ++ "nexthop":"10.0.1.1", ++ "backupIndex":[ ++ 0, ++ 1 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16050, ++ "nexthop":"10.0.2.4" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16050, ++ "nexthop":"10.0.3.4" + } + ] + }, +@@ -19,7 +35,23 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-sw1" ++ "interface":"eth-sw1", ++ "backupIndex":[ ++ 0, ++ 1 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16051, ++ "interface":"eth-rt4-1" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16051, ++ "interface":"eth-rt4-2" + } + ] + }, +@@ -31,7 +63,23 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.1.3" ++ "nexthop":"10.0.1.3", ++ "backupIndex":[ ++ 0, ++ 1 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16050, ++ "nexthop":"10.0.2.4" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16050, ++ "nexthop":"10.0.3.4" + } + ] + }, +@@ -43,7 +91,23 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-sw1" ++ "interface":"eth-sw1", ++ "backupIndex":[ ++ 0, ++ 1 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16051, ++ "interface":"eth-rt4-1" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16051, ++ "interface":"eth-rt4-2" + } + ] + }, +@@ -55,13 +119,26 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.3.4" ++ "nexthop":"10.0.3.4", ++ "backupIndex":[ ++ 0 ++ ] + }, + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.2.4" ++ "nexthop":"10.0.2.4", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16050, ++ "nexthop":"10.0.1.3" + } + ] + }, +@@ -73,13 +150,74 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-rt4-2" ++ "interface":"eth-rt4-2", ++ "backupIndex":[ ++ 0 ++ ] + }, + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, ++ "interface":"eth-rt4-1", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16051, ++ "interface":"eth-sw1" ++ } ++ ] ++ }, ++ "16050":{ ++ "inLabel":16050, ++ "installed":true, ++ "nexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16050, ++ "installed":true, ++ "nexthop":"10.0.3.4" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16050, ++ "installed":true, ++ "nexthop":"10.0.2.4" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16050, ++ "installed":true, ++ "nexthop":"10.0.1.3" ++ } ++ ] ++ }, ++ "16051":{ ++ "inLabel":16051, ++ "installed":true, ++ "nexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16051, ++ "installed":true, ++ "interface":"eth-rt4-2" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16051, ++ "installed":true, + "interface":"eth-rt4-1" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16051, ++ "installed":true, ++ "interface":"eth-sw1" + } + ] + }, diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step9/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step9/show_ip_route.ref.diff new file mode 100644 index 0000000000..15370a0a62 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step9/show_ip_route.ref.diff @@ -0,0 +1,119 @@ +--- rt2/step8/show_ip_route.ref 2020-09-25 17:53:20.207024469 -0300 ++++ rt2/step9/show_ip_route.ref 2020-09-25 17:54:37.908041089 -0300 +@@ -31,7 +31,7 @@ + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ +- 16050, ++ 16500, + 16010 + ] + }, +@@ -41,7 +41,7 @@ + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ +- 16050, ++ 16500, + 16010 + ] + } +@@ -80,7 +80,7 @@ + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ +- 16050, ++ 16500, + 16030 + ] + }, +@@ -90,7 +90,7 @@ + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ +- 16050, ++ 16500, + 16030 + ] + } +@@ -141,7 +141,7 @@ + "interfaceName":"eth-sw1", + "active":true, + "labels":[ +- 16050, ++ 16500, + 16040 + ] + } +@@ -165,7 +165,7 @@ + "interfaceName":"eth-sw1", + "active":true, + "labels":[ +- 16050 ++ 16500 + ] + }, + { +@@ -175,7 +175,7 @@ + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ +- 16050 ++ 16500 + ] + }, + { +@@ -185,7 +185,7 @@ + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ +- 16050 ++ 16500 + ] + } + ] +@@ -271,7 +271,7 @@ + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ +- 16050 ++ 16500 + ] + }, + { +@@ -280,7 +280,7 @@ + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ +- 16050 ++ 16500 + ] + } + ] +@@ -318,7 +318,7 @@ + "interfaceName":"eth-sw1", + "active":true, + "labels":[ +- 16050 ++ 16500 + ] + } + ] +@@ -356,7 +356,7 @@ + "interfaceName":"eth-sw1", + "active":true, + "labels":[ +- 16050 ++ 16500 + ] + } + ] +@@ -517,7 +517,7 @@ + "interfaceName":"eth-sw1", + "active":true, + "labels":[ +- 16050 ++ 16500 + ] + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step9/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step9/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..2585f32595 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step9/show_ipv6_route.ref.diff @@ -0,0 +1,74 @@ +--- rt2/step8/show_ipv6_route.ref 2020-09-25 17:53:21.443040633 -0300 ++++ rt2/step9/show_ipv6_route.ref 2020-09-25 17:54:39.112056848 -0300 +@@ -29,7 +29,7 @@ + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ +- 16051, ++ 16501, + 16011 + ] + }, +@@ -38,7 +38,7 @@ + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ +- 16051, ++ 16501, + 16011 + ] + } +@@ -75,7 +75,7 @@ + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ +- 16051, ++ 16501, + 16031 + ] + }, +@@ -84,7 +84,7 @@ + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ +- 16051, ++ 16501, + 16031 + ] + } +@@ -132,7 +132,7 @@ + "interfaceName":"eth-sw1", + "active":true, + "labels":[ +- 16051, ++ 16501, + 16041 + ] + } +@@ -155,7 +155,7 @@ + "interfaceName":"eth-sw1", + "active":true, + "labels":[ +- 16051 ++ 16501 + ] + }, + { +@@ -164,7 +164,7 @@ + "interfaceName":"eth-rt4-2", + "active":true, + "labels":[ +- 16051 ++ 16501 + ] + }, + { +@@ -173,7 +173,7 @@ + "interfaceName":"eth-rt4-1", + "active":true, + "labels":[ +- 16051 ++ 16501 + ] + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt2/step9/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt2/step9/show_mpls_table.ref.diff new file mode 100644 index 0000000000..b90b889eba --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/step9/show_mpls_table.ref.diff @@ -0,0 +1,182 @@ +--- rt2/step8/show_mpls_table.ref 2020-09-25 17:53:18.923007676 -0300 ++++ rt2/step9/show_mpls_table.ref 2020-09-25 17:54:36.640024493 -0300 +@@ -17,12 +17,12 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16050, ++ "outLabel":16500, + "nexthop":"10.0.2.4" + }, + { + "type":"SR (IS-IS)", +- "outLabel":16050, ++ "outLabel":16500, + "nexthop":"10.0.3.4" + } + ] +@@ -45,12 +45,12 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16051, ++ "outLabel":16501, + "interface":"eth-rt4-1" + }, + { + "type":"SR (IS-IS)", +- "outLabel":16051, ++ "outLabel":16501, + "interface":"eth-rt4-2" + } + ] +@@ -73,12 +73,12 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16050, ++ "outLabel":16500, + "nexthop":"10.0.2.4" + }, + { + "type":"SR (IS-IS)", +- "outLabel":16050, ++ "outLabel":16500, + "nexthop":"10.0.3.4" + } + ] +@@ -101,12 +101,12 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16051, ++ "outLabel":16501, + "interface":"eth-rt4-1" + }, + { + "type":"SR (IS-IS)", +- "outLabel":16051, ++ "outLabel":16501, + "interface":"eth-rt4-2" + } + ] +@@ -137,7 +137,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16050, ++ "outLabel":16500, + "nexthop":"10.0.1.3" + } + ] +@@ -168,55 +168,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16051, +- "interface":"eth-sw1" +- } +- ] +- }, +- "16050":{ +- "inLabel":16050, +- "installed":true, +- "nexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16050, +- "installed":true, +- "nexthop":"10.0.3.4" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16050, +- "installed":true, +- "nexthop":"10.0.2.4" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16050, +- "installed":true, +- "nexthop":"10.0.1.3" +- } +- ] +- }, +- "16051":{ +- "inLabel":16051, +- "installed":true, +- "nexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16051, +- "installed":true, +- "interface":"eth-rt4-2" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16051, +- "installed":true, +- "interface":"eth-rt4-1" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16051, +- "installed":true, ++ "outLabel":16501, + "interface":"eth-sw1" + } + ] +@@ -282,5 +234,53 @@ + "interface":"eth-sw1" + } + ] ++ }, ++ "16500":{ ++ "inLabel":16500, ++ "installed":true, ++ "nexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16500, ++ "installed":true, ++ "nexthop":"10.0.3.4" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16500, ++ "installed":true, ++ "nexthop":"10.0.2.4" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16500, ++ "installed":true, ++ "nexthop":"10.0.1.3" ++ } ++ ] ++ }, ++ "16501":{ ++ "inLabel":16501, ++ "installed":true, ++ "nexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16501, ++ "installed":true, ++ "interface":"eth-rt4-2" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16501, ++ "installed":true, ++ "interface":"eth-rt4-1" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16501, ++ "installed":true, ++ "interface":"eth-sw1" ++ } ++ ] + } + } diff --git a/tests/topotests/isis-tilfa-topo1/rt2/zebra.conf b/tests/topotests/isis-tilfa-topo1/rt2/zebra.conf new file mode 100644 index 0000000000..dcb0686dc2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt2/zebra.conf @@ -0,0 +1,25 @@ +log file zebra.log +! +hostname rt2 +! +debug zebra kernel +debug zebra packet +debug zebra mpls +! +interface lo + ip address 2.2.2.2/32 + ipv6 address 2001:db8:1000::2/128 +! +interface eth-sw1 + ip address 10.0.1.2/24 +! +interface eth-rt4-1 + ip address 10.0.2.2/24 +! +interface eth-rt4-2 + ip address 10.0.3.2/24 +! +ip forwarding +! +line vty +! diff --git a/tests/topotests/isis-tilfa-topo1/rt3/isisd.conf b/tests/topotests/isis-tilfa-topo1/rt3/isisd.conf new file mode 100644 index 0000000000..986bf2804a --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/isisd.conf @@ -0,0 +1,45 @@ +hostname rt3 +log file isisd.log +! +debug isis events +debug isis route-events +debug isis spf-events +debug isis sr-events +debug isis lsp-gen +! +interface lo + ip router isis 1 + ipv6 router isis 1 + isis passive +! +interface eth-sw1 + ip router isis 1 + ipv6 router isis 1 + isis hello-multiplier 3 + isis fast-reroute ti-lfa +! +interface eth-rt5-1 + ip router isis 1 + ipv6 router isis 1 + isis network point-to-point + isis hello-multiplier 3 + isis fast-reroute ti-lfa +! +interface eth-rt5-2 + ip router isis 1 + ipv6 router isis 1 + isis network point-to-point + isis hello-multiplier 3 + isis fast-reroute ti-lfa +! +router isis 1 + net 49.0000.0000.0000.0003.00 + is-type level-1 + lsp-gen-interval 2 + topology ipv6-unicast + segment-routing on + segment-routing global-block 16000 23999 + segment-routing node-msd 8 + segment-routing prefix 3.3.3.3/32 index 30 + segment-routing prefix 2001:db8:1000::3/128 index 31 +! diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step1/show_ip_route.ref b/tests/topotests/isis-tilfa-topo1/rt3/step1/show_ip_route.ref new file mode 100644 index 0000000000..8c37180daf --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step1/show_ip_route.ref @@ -0,0 +1,560 @@ +{ + "1.1.1.1\/32":[ + { + "prefix":"1.1.1.1\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.1", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "backupIndex":[ + 0, + 1 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16040, + 16010 + ] + }, + { + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16040, + 16010 + ] + } + ] + } + ], + "2.2.2.2\/32":[ + { + "prefix":"2.2.2.2\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "backupIndex":[ + 0, + 1 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16040, + 16020 + ] + }, + { + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16040, + 16020 + ] + } + ] + } + ], + "4.4.4.4\/32":[ + { + "prefix":"4.4.4.4\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16040 + ] + }, + { + "fib":true, + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16040 + ] + }, + { + "fib":true, + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16040 + ] + } + ] + } + ], + "5.5.5.5\/32":[ + { + "prefix":"5.5.5.5\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + }, + { + "fib":true, + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16040, + 16050 + ] + } + ] + } + ], + "6.6.6.6\/32":[ + { + "prefix":"6.6.6.6\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 16060 + ] + }, + { + "fib":true, + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 16060 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true + } + ] + } + ], + "10.0.1.0\/24":[ + { + "prefix":"10.0.1.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.1.1", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "backupIndex":[ + 0, + 1 + ] + }, + { + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "backupIndex":[ + 0, + 1 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16040 + ] + }, + { + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16040 + ] + } + ] + } + ], + "10.0.2.0\/24":[ + { + "prefix":"10.0.2.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "backupIndex":[ + 0, + 1 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "active":true + }, + { + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "active":true + } + ] + } + ], + "10.0.3.0\/24":[ + { + "prefix":"10.0.3.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "backupIndex":[ + 0, + 1 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "active":true + }, + { + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "active":true + } + ] + } + ], + "10.0.4.0\/24":[ + { + "prefix":"10.0.4.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "backupIndex":[ + 0 + ] + }, + { + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "active":true, + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16040 + ] + } + ] + } + ], + "10.0.5.0\/24":[ + { + "prefix":"10.0.5.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "active":true, + "backupIndex":[ + 0 + ] + }, + { + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16040 + ] + } + ] + } + ], + "10.0.6.0\/24":[ + { + "prefix":"10.0.6.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "active":true, + "backupIndex":[ + 0 + ] + }, + { + "fib":true, + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "active":true, + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true + } + ] + } + ], + "10.0.7.0\/24":[ + { + "prefix":"10.0.7.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true + }, + { + "fib":true, + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "active":true + }, + { + "fib":true, + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "active":true + } + ] + } + ], + "10.0.8.0\/24":[ + { + "prefix":"10.0.8.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "active":true, + "backupIndex":[ + 0 + ] + }, + { + "fib":true, + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "active":true, + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16040 + ] + } + ] + } + ] +} diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step1/show_ipv6_route.ref b/tests/topotests/isis-tilfa-topo1/rt3/step1/show_ipv6_route.ref new file mode 100644 index 0000000000..5ddb24af5a --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step1/show_ipv6_route.ref @@ -0,0 +1,226 @@ +{ + "2001:db8:1000::1\/128":[ + { + "prefix":"2001:db8:1000::1\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "backupIndex":[ + 0, + 1 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "afi":"ipv6", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16041, + 16011 + ] + }, + { + "afi":"ipv6", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16041, + 16011 + ] + } + ] + } + ], + "2001:db8:1000::2\/128":[ + { + "prefix":"2001:db8:1000::2\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "backupIndex":[ + 0, + 1 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "afi":"ipv6", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16041, + 16021 + ] + }, + { + "afi":"ipv6", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16041, + 16021 + ] + } + ] + } + ], + "2001:db8:1000::4\/128":[ + { + "prefix":"2001:db8:1000::4\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16041 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ + 16041 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ + 16041 + ] + } + ] + } + ], + "2001:db8:1000::5\/128":[ + { + "prefix":"2001:db8:1000::5\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-2", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-1", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, + "labels":[ + 16041, + 16051 + ] + } + ] + } + ], + "2001:db8:1000::6\/128":[ + { + "prefix":"2001:db8:1000::6\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-2", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 16061 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-1", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 16061 + ] + } + ], + "backupNexthops":[ + { + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true + } + ] + } + ] +} diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step1/show_mpls_table.ref b/tests/topotests/isis-tilfa-topo1/rt3/step1/show_mpls_table.ref new file mode 100644 index 0000000000..f68d1f4244 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step1/show_mpls_table.ref @@ -0,0 +1,286 @@ +{ + "16010":{ + "inLabel":16010, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "nexthop":"10.0.1.1", + "backupIndex":[ + 0, + 1 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16040, + "nexthop":"10.0.4.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16040, + "nexthop":"10.0.5.5" + } + ] + }, + "16011":{ + "inLabel":16011, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "interface":"eth-sw1", + "backupIndex":[ + 0, + 1 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16041, + "interface":"eth-rt5-1" + }, + { + "type":"SR (IS-IS)", + "outLabel":16041, + "interface":"eth-rt5-2" + } + ] + }, + "16020":{ + "inLabel":16020, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "nexthop":"10.0.1.2", + "backupIndex":[ + 0, + 1 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16040, + "nexthop":"10.0.4.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16040, + "nexthop":"10.0.5.5" + } + ] + }, + "16021":{ + "inLabel":16021, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "interface":"eth-sw1", + "backupIndex":[ + 0, + 1 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16041, + "interface":"eth-rt5-1" + }, + { + "type":"SR (IS-IS)", + "outLabel":16041, + "interface":"eth-rt5-2" + } + ] + }, + "16040":{ + "inLabel":16040, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16040, + "installed":true, + "nexthop":"10.0.5.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16040, + "installed":true, + "nexthop":"10.0.4.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":16040, + "installed":true, + "nexthop":"10.0.1.2" + } + ] + }, + "16041":{ + "inLabel":16041, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16041, + "installed":true, + "interface":"eth-rt5-2" + }, + { + "type":"SR (IS-IS)", + "outLabel":16041, + "installed":true, + "interface":"eth-rt5-1" + }, + { + "type":"SR (IS-IS)", + "outLabel":16041, + "installed":true, + "interface":"eth-sw1" + } + ] + }, + "16050":{ + "inLabel":16050, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "nexthop":"10.0.5.5", + "backupIndex":[ + 0 + ] + }, + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "nexthop":"10.0.4.5", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16040, + "nexthop":"10.0.1.2" + } + ] + }, + "16051":{ + "inLabel":16051, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "interface":"eth-rt5-2", + "backupIndex":[ + 0 + ] + }, + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "interface":"eth-rt5-1", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16041, + "interface":"eth-sw1" + } + ] + }, + "16060":{ + "inLabel":16060, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16060, + "installed":true, + "nexthop":"10.0.5.5", + "backupIndex":[ + 0 + ] + }, + { + "type":"SR (IS-IS)", + "outLabel":16060, + "installed":true, + "nexthop":"10.0.4.5", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "nexthop":"10.0.1.2" + } + ] + }, + "16061":{ + "inLabel":16061, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16061, + "installed":true, + "interface":"eth-rt5-2", + "backupIndex":[ + 0 + ] + }, + { + "type":"SR (IS-IS)", + "outLabel":16061, + "installed":true, + "interface":"eth-rt5-1", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "interface":"eth-sw1" + } + ] + } +} diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step1/show_yang_interface_isis_adjacencies.ref b/tests/topotests/isis-tilfa-topo1/rt3/step1/show_yang_interface_isis_adjacencies.ref new file mode 100644 index 0000000000..d174b4a475 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step1/show_yang_interface_isis_adjacencies.ref @@ -0,0 +1,70 @@ +{ + "frr-interface:lib": { + "interface": [ + { + "name": "eth-rt5-1", + "vrf": "default", + "state": { + "frr-isisd:isis": { + "adjacencies": { + "adjacency": [ + { + "neighbor-sys-type": "level-1", + "neighbor-sysid": "0000.0000.0005", + "hold-timer": 9, + "neighbor-priority": 0, + "state": "up" + } + ] + } + } + } + }, + { + "name": "eth-rt5-2", + "vrf": "default", + "state": { + "frr-isisd:isis": { + "adjacencies": { + "adjacency": [ + { + "neighbor-sys-type": "level-1", + "neighbor-sysid": "0000.0000.0005", + "hold-timer": 9, + "neighbor-priority": 0, + "state": "up" + } + ] + } + } + } + }, + { + "name": "eth-sw1", + "vrf": "default", + "state": { + "frr-isisd:isis": { + "adjacencies": { + "adjacency": [ + { + "neighbor-sys-type": "level-1", + "neighbor-sysid": "0000.0000.0001", + "hold-timer": 9, + "neighbor-priority": 100, + "state": "up" + }, + { + "neighbor-sys-type": "level-1", + "neighbor-sysid": "0000.0000.0002", + "hold-timer": 9, + "neighbor-priority": 64, + "state": "up" + } + ] + } + } + } + } + ] + } +} diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step2/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step2/show_ip_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step2/show_ip_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step2/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step2/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step2/show_ipv6_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step2/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step2/show_mpls_table.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step2/show_mpls_table.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step3/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step3/show_ip_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step3/show_ip_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step3/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step3/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step3/show_ipv6_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step3/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step3/show_mpls_table.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step3/show_mpls_table.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step4/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step4/show_ip_route.ref.diff new file mode 100644 index 0000000000..707f95495d --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step4/show_ip_route.ref.diff @@ -0,0 +1,288 @@ +--- rt3/step3/show_ip_route.ref 2020-09-25 17:48:05.506916984 -0300 ++++ rt3/step4/show_ip_route.ref 2020-09-25 17:49:01.963652403 -0300 +@@ -15,36 +15,10 @@ + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, +- "backupIndex":[ +- 0, +- 1 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.4.5", +- "afi":"ipv4", +- "interfaceName":"eth-rt5-1", +- "active":true, +- "labels":[ +- 16040, +- 16010 +- ] +- }, +- { +- "ip":"10.0.5.5", +- "afi":"ipv4", +- "interfaceName":"eth-rt5-2", +- "active":true, +- "labels":[ +- 16040, +- 16010 +- ] +- } + ] + } + ], +@@ -64,36 +38,10 @@ + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, +- "backupIndex":[ +- 0, +- 1 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.4.5", +- "afi":"ipv4", +- "interfaceName":"eth-rt5-1", +- "active":true, +- "labels":[ +- 16040, +- 16020 +- ] +- }, +- { +- "ip":"10.0.5.5", +- "afi":"ipv4", +- "interfaceName":"eth-rt5-2", +- "active":true, +- "labels":[ +- 16040, +- 16020 +- ] +- } + ] + } + ], +@@ -112,30 +60,21 @@ + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", +- "active":true, +- "labels":[ +- 16040 +- ] ++ "active":true + }, + { + "fib":true, + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", +- "active":true, +- "labels":[ +- 16040 +- ] ++ "active":true + }, + { + "fib":true, + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", +- "active":true, +- "labels":[ +- 16040 +- ] ++ "active":true + } + ] + } +@@ -156,9 +95,6 @@ + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "active":true, +- "backupIndex":[ +- 0 +- ], + "labels":[ + 3 + ] +@@ -169,25 +105,10 @@ + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "active":true, +- "backupIndex":[ +- 0 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.1.2", +- "afi":"ipv4", +- "interfaceName":"eth-sw1", +- "active":true, +- "labels":[ +- 16040, +- 16050 +- ] +- } + ] + } + ], +@@ -248,40 +169,12 @@ + { + "ip":"10.0.1.1", + "afi":"ipv4", +- "interfaceName":"eth-sw1", +- "backupIndex":[ +- 0, +- 1 +- ] ++ "interfaceName":"eth-sw1" + }, + { + "ip":"10.0.1.2", + "afi":"ipv4", +- "interfaceName":"eth-sw1", +- "backupIndex":[ +- 0, +- 1 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.4.5", +- "afi":"ipv4", +- "interfaceName":"eth-rt5-1", +- "active":true, +- "labels":[ +- 16040 +- ] +- }, +- { +- "ip":"10.0.5.5", +- "afi":"ipv4", +- "interfaceName":"eth-rt5-2", +- "active":true, +- "labels":[ +- 16040 +- ] ++ "interfaceName":"eth-sw1" + } + ] + } +@@ -372,30 +265,13 @@ + { + "ip":"10.0.4.5", + "afi":"ipv4", +- "interfaceName":"eth-rt5-1", +- "backupIndex":[ +- 0 +- ] ++ "interfaceName":"eth-rt5-1" + }, + { + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", +- "active":true, +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.1.2", +- "afi":"ipv4", +- "interfaceName":"eth-sw1", +- "active":true, +- "labels":[ +- 16040 +- ] ++ "active":true + } + ] + } +@@ -411,29 +287,12 @@ + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", +- "active":true, +- "backupIndex":[ +- 0 +- ] ++ "active":true + }, + { + "ip":"10.0.5.5", + "afi":"ipv4", +- "interfaceName":"eth-rt5-2", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.1.2", +- "afi":"ipv4", +- "interfaceName":"eth-sw1", +- "active":true, +- "labels":[ +- 16040 +- ] ++ "interfaceName":"eth-rt5-2" + } + ] + } +@@ -528,31 +387,14 @@ + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", +- "active":true, +- "backupIndex":[ +- 0 +- ] ++ "active":true + }, + { + "fib":true, + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", +- "active":true, +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.1.2", +- "afi":"ipv4", +- "interfaceName":"eth-sw1", +- "active":true, +- "labels":[ +- 16040 +- ] ++ "active":true + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step4/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step4/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..76d0ebc913 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step4/show_ipv6_route.ref.diff @@ -0,0 +1,139 @@ +--- rt3/step3/show_ipv6_route.ref 2020-09-25 17:48:06.790933702 -0300 ++++ rt3/step4/show_ipv6_route.ref 2020-09-25 17:49:03.199668512 -0300 +@@ -14,34 +14,10 @@ + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, +- "backupIndex":[ +- 0, +- 1 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "afi":"ipv6", +- "interfaceName":"eth-rt5-1", +- "active":true, +- "labels":[ +- 16041, +- 16011 +- ] +- }, +- { +- "afi":"ipv6", +- "interfaceName":"eth-rt5-2", +- "active":true, +- "labels":[ +- 16041, +- 16011 +- ] +- } + ] + } + ], +@@ -60,34 +36,10 @@ + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, +- "backupIndex":[ +- 0, +- 1 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "afi":"ipv6", +- "interfaceName":"eth-rt5-1", +- "active":true, +- "labels":[ +- 16041, +- 16021 +- ] +- }, +- { +- "afi":"ipv6", +- "interfaceName":"eth-rt5-2", +- "active":true, +- "labels":[ +- 16041, +- 16021 +- ] +- } + ] + } + ], +@@ -105,28 +57,19 @@ + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", +- "active":true, +- "labels":[ +- 16041 +- ] ++ "active":true + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-2", +- "active":true, +- "labels":[ +- 16041 +- ] ++ "active":true + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-1", +- "active":true, +- "labels":[ +- 16041 +- ] ++ "active":true + } + ] + } +@@ -146,9 +89,6 @@ + "afi":"ipv6", + "interfaceName":"eth-rt5-2", + "active":true, +- "backupIndex":[ +- 0 +- ], + "labels":[ + 3 + ] +@@ -158,24 +98,10 @@ + "afi":"ipv6", + "interfaceName":"eth-rt5-1", + "active":true, +- "backupIndex":[ +- 0 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "afi":"ipv6", +- "interfaceName":"eth-sw1", +- "active":true, +- "labels":[ +- 16041, +- 16051 +- ] +- } + ] + } + ], diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step4/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step4/show_mpls_table.ref.diff new file mode 100644 index 0000000000..b888c9d273 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step4/show_mpls_table.ref.diff @@ -0,0 +1,206 @@ +--- rt3/step3/show_mpls_table.ref 2020-09-25 17:48:04.214900164 -0300 ++++ rt3/step4/show_mpls_table.ref 2020-09-25 17:49:00.759636711 -0300 +@@ -7,23 +7,7 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.1.1", +- "backupIndex":[ +- 0, +- 1 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16040, +- "nexthop":"10.0.4.5" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16040, +- "nexthop":"10.0.5.5" ++ "nexthop":"10.0.1.1" + } + ] + }, +@@ -35,23 +19,7 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-sw1", +- "backupIndex":[ +- 0, +- 1 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16041, +- "interface":"eth-rt5-1" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16041, +- "interface":"eth-rt5-2" ++ "interface":"eth-sw1" + } + ] + }, +@@ -63,23 +31,7 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.1.2", +- "backupIndex":[ +- 0, +- 1 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16040, +- "nexthop":"10.0.4.5" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16040, +- "nexthop":"10.0.5.5" ++ "nexthop":"10.0.1.2" + } + ] + }, +@@ -91,70 +43,6 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-sw1", +- "backupIndex":[ +- 0, +- 1 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16041, +- "interface":"eth-rt5-1" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16041, +- "interface":"eth-rt5-2" +- } +- ] +- }, +- "16040":{ +- "inLabel":16040, +- "installed":true, +- "nexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16040, +- "installed":true, +- "nexthop":"10.0.5.5" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16040, +- "installed":true, +- "nexthop":"10.0.4.5" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16040, +- "installed":true, +- "nexthop":"10.0.1.2" +- } +- ] +- }, +- "16041":{ +- "inLabel":16041, +- "installed":true, +- "nexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16041, +- "installed":true, +- "interface":"eth-rt5-2" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16041, +- "installed":true, +- "interface":"eth-rt5-1" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16041, +- "installed":true, + "interface":"eth-sw1" + } + ] +@@ -167,26 +55,13 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.5.5", +- "backupIndex":[ +- 0 +- ] ++ "nexthop":"10.0.5.5" + }, + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.4.5", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16040, +- "nexthop":"10.0.1.2" ++ "nexthop":"10.0.4.5" + } + ] + }, +@@ -198,26 +73,13 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-rt5-2", +- "backupIndex":[ +- 0 +- ] ++ "interface":"eth-rt5-2" + }, + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-rt5-1", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16041, +- "interface":"eth-sw1" ++ "interface":"eth-rt5-1" + } + ] + }, diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step5/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step5/show_ip_route.ref.diff new file mode 100644 index 0000000000..8eac75bec7 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step5/show_ip_route.ref.diff @@ -0,0 +1,288 @@ +--- rt3/step4/show_ip_route.ref 2020-09-25 17:49:01.963652403 -0300 ++++ rt3/step5/show_ip_route.ref 2020-09-25 17:50:12.592573438 -0300 +@@ -15,10 +15,36 @@ + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, ++ "backupIndex":[ ++ 0, ++ 1 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.4.5", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt5-1", ++ "active":true, ++ "labels":[ ++ 16040, ++ 16010 ++ ] ++ }, ++ { ++ "ip":"10.0.5.5", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt5-2", ++ "active":true, ++ "labels":[ ++ 16040, ++ 16010 ++ ] ++ } + ] + } + ], +@@ -38,10 +64,36 @@ + "afi":"ipv4", + "interfaceName":"eth-sw1", + "active":true, ++ "backupIndex":[ ++ 0, ++ 1 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.4.5", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt5-1", ++ "active":true, ++ "labels":[ ++ 16040, ++ 16020 ++ ] ++ }, ++ { ++ "ip":"10.0.5.5", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt5-2", ++ "active":true, ++ "labels":[ ++ 16040, ++ 16020 ++ ] ++ } + ] + } + ], +@@ -60,21 +112,30 @@ + "ip":"10.0.1.2", + "afi":"ipv4", + "interfaceName":"eth-sw1", +- "active":true ++ "active":true, ++ "labels":[ ++ 16040 ++ ] + }, + { + "fib":true, + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", +- "active":true ++ "active":true, ++ "labels":[ ++ 16040 ++ ] + }, + { + "fib":true, + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", +- "active":true ++ "active":true, ++ "labels":[ ++ 16040 ++ ] + } + ] + } +@@ -95,6 +156,9 @@ + "afi":"ipv4", + "interfaceName":"eth-rt5-1", + "active":true, ++ "backupIndex":[ ++ 0 ++ ], + "labels":[ + 3 + ] +@@ -105,10 +169,25 @@ + "afi":"ipv4", + "interfaceName":"eth-rt5-2", + "active":true, ++ "backupIndex":[ ++ 0 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.1.2", ++ "afi":"ipv4", ++ "interfaceName":"eth-sw1", ++ "active":true, ++ "labels":[ ++ 16040, ++ 16050 ++ ] ++ } + ] + } + ], +@@ -169,12 +248,40 @@ + { + "ip":"10.0.1.1", + "afi":"ipv4", +- "interfaceName":"eth-sw1" ++ "interfaceName":"eth-sw1", ++ "backupIndex":[ ++ 0, ++ 1 ++ ] + }, + { + "ip":"10.0.1.2", + "afi":"ipv4", +- "interfaceName":"eth-sw1" ++ "interfaceName":"eth-sw1", ++ "backupIndex":[ ++ 0, ++ 1 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.4.5", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt5-1", ++ "active":true, ++ "labels":[ ++ 16040 ++ ] ++ }, ++ { ++ "ip":"10.0.5.5", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt5-2", ++ "active":true, ++ "labels":[ ++ 16040 ++ ] + } + ] + } +@@ -265,13 +372,30 @@ + { + "ip":"10.0.4.5", + "afi":"ipv4", +- "interfaceName":"eth-rt5-1" ++ "interfaceName":"eth-rt5-1", ++ "backupIndex":[ ++ 0 ++ ] + }, + { + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", +- "active":true ++ "active":true, ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.1.2", ++ "afi":"ipv4", ++ "interfaceName":"eth-sw1", ++ "active":true, ++ "labels":[ ++ 16040 ++ ] + } + ] + } +@@ -287,12 +411,29 @@ + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", +- "active":true ++ "active":true, ++ "backupIndex":[ ++ 0 ++ ] + }, + { + "ip":"10.0.5.5", + "afi":"ipv4", +- "interfaceName":"eth-rt5-2" ++ "interfaceName":"eth-rt5-2", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.1.2", ++ "afi":"ipv4", ++ "interfaceName":"eth-sw1", ++ "active":true, ++ "labels":[ ++ 16040 ++ ] + } + ] + } +@@ -387,14 +528,31 @@ + "ip":"10.0.4.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-1", +- "active":true ++ "active":true, ++ "backupIndex":[ ++ 0 ++ ] + }, + { + "fib":true, + "ip":"10.0.5.5", + "afi":"ipv4", + "interfaceName":"eth-rt5-2", +- "active":true ++ "active":true, ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.1.2", ++ "afi":"ipv4", ++ "interfaceName":"eth-sw1", ++ "active":true, ++ "labels":[ ++ 16040 ++ ] + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step5/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step5/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..fc55267ad1 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step5/show_ipv6_route.ref.diff @@ -0,0 +1,139 @@ +--- rt3/step4/show_ipv6_route.ref 2020-09-25 17:49:03.199668512 -0300 ++++ rt3/step5/show_ipv6_route.ref 2020-09-25 17:50:13.840589722 -0300 +@@ -14,10 +14,34 @@ + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, ++ "backupIndex":[ ++ 0, ++ 1 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "afi":"ipv6", ++ "interfaceName":"eth-rt5-1", ++ "active":true, ++ "labels":[ ++ 16041, ++ 16011 ++ ] ++ }, ++ { ++ "afi":"ipv6", ++ "interfaceName":"eth-rt5-2", ++ "active":true, ++ "labels":[ ++ 16041, ++ 16011 ++ ] ++ } + ] + } + ], +@@ -36,10 +60,34 @@ + "afi":"ipv6", + "interfaceName":"eth-sw1", + "active":true, ++ "backupIndex":[ ++ 0, ++ 1 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "afi":"ipv6", ++ "interfaceName":"eth-rt5-1", ++ "active":true, ++ "labels":[ ++ 16041, ++ 16021 ++ ] ++ }, ++ { ++ "afi":"ipv6", ++ "interfaceName":"eth-rt5-2", ++ "active":true, ++ "labels":[ ++ 16041, ++ 16021 ++ ] ++ } + ] + } + ], +@@ -57,19 +105,28 @@ + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-sw1", +- "active":true ++ "active":true, ++ "labels":[ ++ 16041 ++ ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-2", +- "active":true ++ "active":true, ++ "labels":[ ++ 16041 ++ ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5-1", +- "active":true ++ "active":true, ++ "labels":[ ++ 16041 ++ ] + } + ] + } +@@ -89,6 +146,9 @@ + "afi":"ipv6", + "interfaceName":"eth-rt5-2", + "active":true, ++ "backupIndex":[ ++ 0 ++ ], + "labels":[ + 3 + ] +@@ -98,10 +158,24 @@ + "afi":"ipv6", + "interfaceName":"eth-rt5-1", + "active":true, ++ "backupIndex":[ ++ 0 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "afi":"ipv6", ++ "interfaceName":"eth-sw1", ++ "active":true, ++ "labels":[ ++ 16041, ++ 16051 ++ ] ++ } + ] + } + ], diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step5/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step5/show_mpls_table.ref.diff new file mode 100644 index 0000000000..4ed491e241 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step5/show_mpls_table.ref.diff @@ -0,0 +1,206 @@ +--- rt3/step4/show_mpls_table.ref 2020-09-25 17:49:00.759636711 -0300 ++++ rt3/step5/show_mpls_table.ref 2020-09-25 17:50:11.280556320 -0300 +@@ -7,7 +7,23 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.1.1" ++ "nexthop":"10.0.1.1", ++ "backupIndex":[ ++ 0, ++ 1 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16040, ++ "nexthop":"10.0.4.5" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16040, ++ "nexthop":"10.0.5.5" + } + ] + }, +@@ -19,7 +35,23 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-sw1" ++ "interface":"eth-sw1", ++ "backupIndex":[ ++ 0, ++ 1 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16041, ++ "interface":"eth-rt5-1" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16041, ++ "interface":"eth-rt5-2" + } + ] + }, +@@ -31,7 +63,23 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.1.2" ++ "nexthop":"10.0.1.2", ++ "backupIndex":[ ++ 0, ++ 1 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16040, ++ "nexthop":"10.0.4.5" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16040, ++ "nexthop":"10.0.5.5" + } + ] + }, +@@ -43,6 +91,70 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, ++ "interface":"eth-sw1", ++ "backupIndex":[ ++ 0, ++ 1 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16041, ++ "interface":"eth-rt5-1" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16041, ++ "interface":"eth-rt5-2" ++ } ++ ] ++ }, ++ "16040":{ ++ "inLabel":16040, ++ "installed":true, ++ "nexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16040, ++ "installed":true, ++ "nexthop":"10.0.5.5" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16040, ++ "installed":true, ++ "nexthop":"10.0.4.5" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16040, ++ "installed":true, ++ "nexthop":"10.0.1.2" ++ } ++ ] ++ }, ++ "16041":{ ++ "inLabel":16041, ++ "installed":true, ++ "nexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16041, ++ "installed":true, ++ "interface":"eth-rt5-2" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16041, ++ "installed":true, ++ "interface":"eth-rt5-1" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16041, ++ "installed":true, + "interface":"eth-sw1" + } + ] +@@ -55,13 +167,26 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.5.5" ++ "nexthop":"10.0.5.5", ++ "backupIndex":[ ++ 0 ++ ] + }, + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.4.5" ++ "nexthop":"10.0.4.5", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16040, ++ "nexthop":"10.0.1.2" + } + ] + }, +@@ -73,13 +198,26 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-rt5-2" ++ "interface":"eth-rt5-2", ++ "backupIndex":[ ++ 0 ++ ] + }, + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-rt5-1" ++ "interface":"eth-rt5-1", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16041, ++ "interface":"eth-sw1" + } + ] + }, diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step6/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step6/show_ip_route.ref.diff new file mode 100644 index 0000000000..9273c75352 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step6/show_ip_route.ref.diff @@ -0,0 +1,101 @@ +--- rt3/step5/show_ip_route.ref 2020-09-25 17:50:12.592573438 -0300 ++++ rt3/step6/show_ip_route.ref 2020-09-25 17:51:15.521394894 -0300 +@@ -31,7 +31,7 @@ + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ +- 16040, ++ 30040, + 16010 + ] + }, +@@ -41,7 +41,7 @@ + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ +- 16040, ++ 30040, + 16010 + ] + } +@@ -80,7 +80,7 @@ + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ +- 16040, ++ 30040, + 16020 + ] + }, +@@ -90,7 +90,7 @@ + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ +- 16040, ++ 30040, + 16020 + ] + } +@@ -124,7 +124,7 @@ + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ +- 16040 ++ 30040 + ] + }, + { +@@ -134,7 +134,7 @@ + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ +- 16040 ++ 30040 + ] + } + ] +@@ -185,7 +185,7 @@ + "active":true, + "labels":[ + 16040, +- 16050 ++ 30050 + ] + } + ] +@@ -211,7 +211,7 @@ + 0 + ], + "labels":[ +- 16060 ++ 30060 + ] + }, + { +@@ -224,7 +224,7 @@ + 0 + ], + "labels":[ +- 16060 ++ 30060 + ] + } + ], +@@ -271,7 +271,7 @@ + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ +- 16040 ++ 30040 + ] + }, + { +@@ -280,7 +280,7 @@ + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ +- 16040 ++ 30040 + ] + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step6/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step6/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..f50be893e4 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step6/show_ipv6_route.ref.diff @@ -0,0 +1,83 @@ +--- rt3/step5/show_ipv6_route.ref 2020-09-25 17:50:13.840589722 -0300 ++++ rt3/step6/show_ipv6_route.ref 2020-09-25 17:51:16.757411035 -0300 +@@ -29,7 +29,7 @@ + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ +- 16041, ++ 30041, + 16011 + ] + }, +@@ -38,7 +38,7 @@ + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ +- 16041, ++ 30041, + 16011 + ] + } +@@ -75,7 +75,7 @@ + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ +- 16041, ++ 30041, + 16021 + ] + }, +@@ -84,7 +84,7 @@ + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ +- 16041, ++ 30041, + 16021 + ] + } +@@ -116,7 +116,7 @@ + "interfaceName":"eth-rt5-2", + "active":true, + "labels":[ +- 16041 ++ 30041 + ] + }, + { +@@ -125,7 +125,7 @@ + "interfaceName":"eth-rt5-1", + "active":true, + "labels":[ +- 16041 ++ 30041 + ] + } + ] +@@ -173,7 +173,7 @@ + "active":true, + "labels":[ + 16041, +- 16051 ++ 30051 + ] + } + ] +@@ -198,7 +198,7 @@ + 0 + ], + "labels":[ +- 16061 ++ 30061 + ] + }, + { +@@ -210,7 +210,7 @@ + 0 + ], + "labels":[ +- 16061 ++ 30061 + ] + } + ], diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step6/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step6/show_mpls_table.ref.diff new file mode 100644 index 0000000000..b63a728ef1 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step6/show_mpls_table.ref.diff @@ -0,0 +1,130 @@ +--- rt3/step5/show_mpls_table.ref 2020-09-25 17:50:11.280556320 -0300 ++++ rt3/step6/show_mpls_table.ref 2020-09-25 17:51:14.281378700 -0300 +@@ -17,12 +17,12 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16040, ++ "outLabel":30040, + "nexthop":"10.0.4.5" + }, + { + "type":"SR (IS-IS)", +- "outLabel":16040, ++ "outLabel":30040, + "nexthop":"10.0.5.5" + } + ] +@@ -45,12 +45,12 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16041, ++ "outLabel":30041, + "interface":"eth-rt5-1" + }, + { + "type":"SR (IS-IS)", +- "outLabel":16041, ++ "outLabel":30041, + "interface":"eth-rt5-2" + } + ] +@@ -73,12 +73,12 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16040, ++ "outLabel":30040, + "nexthop":"10.0.4.5" + }, + { + "type":"SR (IS-IS)", +- "outLabel":16040, ++ "outLabel":30040, + "nexthop":"10.0.5.5" + } + ] +@@ -101,12 +101,12 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16041, ++ "outLabel":30041, + "interface":"eth-rt5-1" + }, + { + "type":"SR (IS-IS)", +- "outLabel":16041, ++ "outLabel":30041, + "interface":"eth-rt5-2" + } + ] +@@ -117,13 +117,13 @@ + "nexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16040, ++ "outLabel":30040, + "installed":true, + "nexthop":"10.0.5.5" + }, + { + "type":"SR (IS-IS)", +- "outLabel":16040, ++ "outLabel":30040, + "installed":true, + "nexthop":"10.0.4.5" + }, +@@ -141,13 +141,13 @@ + "nexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16041, ++ "outLabel":30041, + "installed":true, + "interface":"eth-rt5-2" + }, + { + "type":"SR (IS-IS)", +- "outLabel":16041, ++ "outLabel":30041, + "installed":true, + "interface":"eth-rt5-1" + }, +@@ -227,7 +227,7 @@ + "nexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16060, ++ "outLabel":30060, + "installed":true, + "nexthop":"10.0.5.5", + "backupIndex":[ +@@ -236,7 +236,7 @@ + }, + { + "type":"SR (IS-IS)", +- "outLabel":16060, ++ "outLabel":30060, + "installed":true, + "nexthop":"10.0.4.5", + "backupIndex":[ +@@ -258,7 +258,7 @@ + "nexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16061, ++ "outLabel":30061, + "installed":true, + "interface":"eth-rt5-2", + "backupIndex":[ +@@ -267,7 +267,7 @@ + }, + { + "type":"SR (IS-IS)", +- "outLabel":16061, ++ "outLabel":30061, + "installed":true, + "interface":"eth-rt5-1", + "backupIndex":[ diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step7/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step7/show_ip_route.ref.diff new file mode 100644 index 0000000000..0ae87afa3b --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step7/show_ip_route.ref.diff @@ -0,0 +1,32 @@ +--- rt3/step6/show_ip_route.ref 2020-09-25 17:51:15.521394894 -0300 ++++ rt3/step7/show_ip_route.ref 2020-09-25 17:52:02.414007470 -0300 +@@ -158,9 +158,6 @@ + "active":true, + "backupIndex":[ + 0 +- ], +- "labels":[ +- 3 + ] + }, + { +@@ -171,9 +168,6 @@ + "active":true, + "backupIndex":[ + 0 +- ], +- "labels":[ +- 3 + ] + } + ], +@@ -184,8 +178,7 @@ + "interfaceName":"eth-sw1", + "active":true, + "labels":[ +- 16040, +- 30050 ++ 16040 + ] + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step7/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step7/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..f392f644c0 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step7/show_ipv6_route.ref.diff @@ -0,0 +1,32 @@ +--- rt3/step6/show_ipv6_route.ref 2020-09-25 17:51:16.757411035 -0300 ++++ rt3/step7/show_ipv6_route.ref 2020-09-25 17:52:03.650023622 -0300 +@@ -148,9 +148,6 @@ + "active":true, + "backupIndex":[ + 0 +- ], +- "labels":[ +- 3 + ] + }, + { +@@ -160,9 +157,6 @@ + "active":true, + "backupIndex":[ + 0 +- ], +- "labels":[ +- 3 + ] + } + ], +@@ -172,8 +166,7 @@ + "interfaceName":"eth-sw1", + "active":true, + "labels":[ +- 16041, +- 30051 ++ 16041 + ] + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step7/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step7/show_mpls_table.ref.diff new file mode 100644 index 0000000000..b74eb9579c --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step7/show_mpls_table.ref.diff @@ -0,0 +1,71 @@ +--- rt3/step6/show_mpls_table.ref 2020-09-25 17:51:14.281378700 -0300 ++++ rt3/step7/show_mpls_table.ref 2020-09-25 17:52:01.181991371 -0300 +@@ -159,68 +159,6 @@ + } + ] + }, +- "16050":{ +- "inLabel":16050, +- "installed":true, +- "nexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "installed":true, +- "nexthop":"10.0.5.5", +- "backupIndex":[ +- 0 +- ] +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "installed":true, +- "nexthop":"10.0.4.5", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16040, +- "nexthop":"10.0.1.2" +- } +- ] +- }, +- "16051":{ +- "inLabel":16051, +- "installed":true, +- "nexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "installed":true, +- "interface":"eth-rt5-2", +- "backupIndex":[ +- 0 +- ] +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "installed":true, +- "interface":"eth-rt5-1", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16041, +- "interface":"eth-sw1" +- } +- ] +- }, + "16060":{ + "inLabel":16060, + "installed":true, diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step8/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step8/show_ip_route.ref.diff new file mode 100644 index 0000000000..25b42f2825 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step8/show_ip_route.ref.diff @@ -0,0 +1,32 @@ +--- rt3/step7/show_ip_route.ref 2020-09-25 17:52:02.414007470 -0300 ++++ rt3/step8/show_ip_route.ref 2020-09-25 17:53:20.419027241 -0300 +@@ -158,6 +158,9 @@ + "active":true, + "backupIndex":[ + 0 ++ ], ++ "labels":[ ++ 3 + ] + }, + { +@@ -168,6 +171,9 @@ + "active":true, + "backupIndex":[ + 0 ++ ], ++ "labels":[ ++ 3 + ] + } + ], +@@ -178,7 +184,8 @@ + "interfaceName":"eth-sw1", + "active":true, + "labels":[ +- 16040 ++ 16040, ++ 30050 + ] + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step8/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step8/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..42d9356c8a --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step8/show_ipv6_route.ref.diff @@ -0,0 +1,32 @@ +--- rt3/step7/show_ipv6_route.ref 2020-09-25 17:52:03.650023622 -0300 ++++ rt3/step8/show_ipv6_route.ref 2020-09-25 17:53:21.643043250 -0300 +@@ -148,6 +148,9 @@ + "active":true, + "backupIndex":[ + 0 ++ ], ++ "labels":[ ++ 3 + ] + }, + { +@@ -157,6 +160,9 @@ + "active":true, + "backupIndex":[ + 0 ++ ], ++ "labels":[ ++ 3 + ] + } + ], +@@ -166,7 +172,8 @@ + "interfaceName":"eth-sw1", + "active":true, + "labels":[ +- 16041 ++ 16041, ++ 30051 + ] + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step8/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step8/show_mpls_table.ref.diff new file mode 100644 index 0000000000..bd40f954eb --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step8/show_mpls_table.ref.diff @@ -0,0 +1,71 @@ +--- rt3/step7/show_mpls_table.ref 2020-09-25 17:52:01.181991371 -0300 ++++ rt3/step8/show_mpls_table.ref 2020-09-25 17:53:19.135010448 -0300 +@@ -159,6 +159,68 @@ + } + ] + }, ++ "16050":{ ++ "inLabel":16050, ++ "installed":true, ++ "nexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "installed":true, ++ "nexthop":"10.0.5.5", ++ "backupIndex":[ ++ 0 ++ ] ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "installed":true, ++ "nexthop":"10.0.4.5", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16040, ++ "nexthop":"10.0.1.2" ++ } ++ ] ++ }, ++ "16051":{ ++ "inLabel":16051, ++ "installed":true, ++ "nexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "installed":true, ++ "interface":"eth-rt5-2", ++ "backupIndex":[ ++ 0 ++ ] ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "installed":true, ++ "interface":"eth-rt5-1", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16041, ++ "interface":"eth-sw1" ++ } ++ ] ++ }, + "16060":{ + "inLabel":16060, + "installed":true, diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step9/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step9/show_ip_route.ref.diff new file mode 100644 index 0000000000..687e84ad40 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step9/show_ip_route.ref.diff @@ -0,0 +1,11 @@ +--- rt3/step8/show_ip_route.ref 2020-09-25 17:53:20.419027241 -0300 ++++ rt3/step9/show_ip_route.ref 2020-09-25 17:54:38.112043759 -0300 +@@ -185,7 +185,7 @@ + "active":true, + "labels":[ + 16040, +- 30050 ++ 30500 + ] + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step9/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step9/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..4b76be66ac --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step9/show_ipv6_route.ref.diff @@ -0,0 +1,11 @@ +--- rt3/step8/show_ipv6_route.ref 2020-09-25 17:53:21.643043250 -0300 ++++ rt3/step9/show_ipv6_route.ref 2020-09-25 17:54:39.320059571 -0300 +@@ -173,7 +173,7 @@ + "active":true, + "labels":[ + 16041, +- 30051 ++ 30501 + ] + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt3/step9/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt3/step9/show_mpls_table.ref.diff new file mode 100644 index 0000000000..6f6451e510 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/step9/show_mpls_table.ref.diff @@ -0,0 +1,133 @@ +--- rt3/step8/show_mpls_table.ref 2020-09-25 17:53:19.135010448 -0300 ++++ rt3/step9/show_mpls_table.ref 2020-09-25 17:54:36.852027268 -0300 +@@ -159,13 +159,13 @@ + } + ] + }, +- "16050":{ +- "inLabel":16050, ++ "16060":{ ++ "inLabel":16060, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":3, ++ "outLabel":30060, + "installed":true, + "nexthop":"10.0.5.5", + "backupIndex":[ +@@ -174,7 +174,7 @@ + }, + { + "type":"SR (IS-IS)", +- "outLabel":3, ++ "outLabel":30060, + "installed":true, + "nexthop":"10.0.4.5", + "backupIndex":[ +@@ -185,18 +185,18 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16040, ++ "outLabel":3, + "nexthop":"10.0.1.2" + } + ] + }, +- "16051":{ +- "inLabel":16051, ++ "16061":{ ++ "inLabel":16061, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":3, ++ "outLabel":30061, + "installed":true, + "interface":"eth-rt5-2", + "backupIndex":[ +@@ -205,7 +205,7 @@ + }, + { + "type":"SR (IS-IS)", +- "outLabel":3, ++ "outLabel":30061, + "installed":true, + "interface":"eth-rt5-1", + "backupIndex":[ +@@ -216,18 +216,18 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16041, ++ "outLabel":3, + "interface":"eth-sw1" + } + ] + }, +- "16060":{ +- "inLabel":16060, ++ "16500":{ ++ "inLabel":16500, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":30060, ++ "outLabel":3, + "installed":true, + "nexthop":"10.0.5.5", + "backupIndex":[ +@@ -236,7 +236,7 @@ + }, + { + "type":"SR (IS-IS)", +- "outLabel":30060, ++ "outLabel":3, + "installed":true, + "nexthop":"10.0.4.5", + "backupIndex":[ +@@ -247,18 +247,18 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":3, ++ "outLabel":16040, + "nexthop":"10.0.1.2" + } + ] + }, +- "16061":{ +- "inLabel":16061, ++ "16501":{ ++ "inLabel":16501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":30061, ++ "outLabel":3, + "installed":true, + "interface":"eth-rt5-2", + "backupIndex":[ +@@ -267,7 +267,7 @@ + }, + { + "type":"SR (IS-IS)", +- "outLabel":30061, ++ "outLabel":3, + "installed":true, + "interface":"eth-rt5-1", + "backupIndex":[ +@@ -278,7 +278,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":3, ++ "outLabel":16041, + "interface":"eth-sw1" + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt3/zebra.conf b/tests/topotests/isis-tilfa-topo1/rt3/zebra.conf new file mode 100644 index 0000000000..3254529386 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt3/zebra.conf @@ -0,0 +1,25 @@ +log file zebra.log +! +hostname rt3 +! +debug zebra kernel +debug zebra packet +debug zebra mpls +! +interface lo + ip address 3.3.3.3/32 + ipv6 address 2001:db8:1000::3/128 +! +interface eth-sw1 + ip address 10.0.1.3/24 +! +interface eth-rt5-1 + ip address 10.0.4.3/24 +! +interface eth-rt5-2 + ip address 10.0.5.3/24 +! +ip forwarding +! +line vty +! diff --git a/tests/topotests/isis-tilfa-topo1/rt4/isisd.conf b/tests/topotests/isis-tilfa-topo1/rt4/isisd.conf new file mode 100644 index 0000000000..7d411069d1 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/isisd.conf @@ -0,0 +1,53 @@ +hostname rt4 +log file isisd.log +! +debug isis events +debug isis route-events +debug isis spf-events +debug isis sr-events +debug isis lsp-gen +! +interface lo + ip router isis 1 + ipv6 router isis 1 + isis passive +! +interface eth-rt2-1 + ip router isis 1 + ipv6 router isis 1 + isis network point-to-point + isis hello-multiplier 3 + isis fast-reroute ti-lfa +! +interface eth-rt2-2 + ip router isis 1 + ipv6 router isis 1 + isis network point-to-point + isis hello-multiplier 3 + isis fast-reroute ti-lfa +! +interface eth-rt5 + ip router isis 1 + ipv6 router isis 1 + isis network point-to-point + isis hello-multiplier 3 + isis fast-reroute ti-lfa +! +interface eth-rt6 + ip router isis 1 + ipv6 router isis 1 + isis network point-to-point + isis hello-multiplier 3 + isis fast-reroute ti-lfa +! +router isis 1 + net 49.0000.0000.0000.0004.00 + is-type level-1 + lsp-gen-interval 2 + topology ipv6-unicast + segment-routing on + segment-routing global-block 16000 23999 + segment-routing node-msd 8 + segment-routing prefix 4.4.4.4/32 index 40 + segment-routing prefix 2001:db8:1000::4/128 index 41 +! diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step1/show_ip_route.ref b/tests/topotests/isis-tilfa-topo1/rt4/step1/show_ip_route.ref new file mode 100644 index 0000000000..168b90a3f6 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step1/show_ip_route.ref @@ -0,0 +1,497 @@ +{ + "1.1.1.1\/32":[ + { + "prefix":"1.1.1.1\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.2.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-1", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 16010 + ] + }, + { + "fib":true, + "ip":"10.0.3.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-2", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 16010 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.6.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true + } + ] + } + ], + "2.2.2.2\/32":[ + { + "prefix":"2.2.2.2\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.2.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-1", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + }, + { + "fib":true, + "ip":"10.0.3.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-2", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.6.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16030, + 16020 + ] + } + ] + } + ], + "3.3.3.3\/32":[ + { + "prefix":"3.3.3.3\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.2.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-1", + "active":true, + "labels":[ + 16030 + ] + }, + { + "fib":true, + "ip":"10.0.3.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-2", + "active":true, + "labels":[ + 16030 + ] + }, + { + "fib":true, + "ip":"10.0.6.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16030 + ] + } + ] + } + ], + "5.5.5.5\/32":[ + { + "prefix":"5.5.5.5\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.6.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.7.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", + "active":true + } + ] + } + ], + "6.6.6.6\/32":[ + { + "prefix":"6.6.6.6\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.7.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.6.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true + } + ] + } + ], + "10.0.1.0\/24":[ + { + "prefix":"10.0.1.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.2.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-1", + "active":true, + "backupIndex":[ + 0 + ] + }, + { + "fib":true, + "ip":"10.0.3.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-2", + "active":true, + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.6.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true + } + ] + } + ], + "10.0.2.0\/24":[ + { + "prefix":"10.0.2.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.2.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-1", + "backupIndex":[ + 0 + ] + }, + { + "ip":"10.0.3.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-2", + "active":true, + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.6.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16030 + ] + } + ] + } + ], + "10.0.3.0\/24":[ + { + "prefix":"10.0.3.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.2.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-1", + "active":true, + "backupIndex":[ + 0 + ] + }, + { + "ip":"10.0.3.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-2", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.6.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16030 + ] + } + ] + } + ], + "10.0.4.0\/24":[ + { + "prefix":"10.0.4.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.6.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true, + "backupIndex":[ + 0, + 1, + 2 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.7.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", + "active":true + }, + { + "ip":"10.0.2.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-1", + "active":true + }, + { + "ip":"10.0.3.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-2", + "active":true + } + ] + } + ], + "10.0.5.0\/24":[ + { + "prefix":"10.0.5.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.6.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true, + "backupIndex":[ + 0, + 1, + 2 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.7.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", + "active":true + }, + { + "ip":"10.0.2.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-1", + "active":true + }, + { + "ip":"10.0.3.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-2", + "active":true + } + ] + } + ], + "10.0.6.0\/24":[ + { + "prefix":"10.0.6.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.6.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.7.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", + "active":true + } + ] + } + ], + "10.0.7.0\/24":[ + { + "prefix":"10.0.7.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.7.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.6.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true + } + ] + } + ], + "10.0.8.0\/24":[ + { + "prefix":"10.0.8.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.6.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true + }, + { + "fib":true, + "ip":"10.0.7.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", + "active":true + } + ] + } + ] +} diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step1/show_ipv6_route.ref b/tests/topotests/isis-tilfa-topo1/rt4/step1/show_ipv6_route.ref new file mode 100644 index 0000000000..a4442ee089 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step1/show_ipv6_route.ref @@ -0,0 +1,198 @@ +{ + "2001:db8:1000::1\/128":[ + { + "prefix":"2001:db8:1000::1\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt2-1", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 16011 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt2-2", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 16011 + ] + } + ], + "backupNexthops":[ + { + "afi":"ipv6", + "interfaceName":"eth-rt5", + "active":true + } + ] + } + ], + "2001:db8:1000::2\/128":[ + { + "prefix":"2001:db8:1000::2\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt2-1", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt2-2", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "afi":"ipv6", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16031, + 16021 + ] + } + ] + } + ], + "2001:db8:1000::3\/128":[ + { + "prefix":"2001:db8:1000::3\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt2-1", + "active":true, + "labels":[ + 16031 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16031 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt2-2", + "active":true, + "labels":[ + 16031 + ] + } + ] + } + ], + "2001:db8:1000::5\/128":[ + { + "prefix":"2001:db8:1000::5\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "afi":"ipv6", + "interfaceName":"eth-rt6", + "active":true + } + ] + } + ], + "2001:db8:1000::6\/128":[ + { + "prefix":"2001:db8:1000::6\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt6", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "afi":"ipv6", + "interfaceName":"eth-rt5", + "active":true + } + ] + } + ] +} diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step1/show_mpls_table.ref b/tests/topotests/isis-tilfa-topo1/rt4/step1/show_mpls_table.ref new file mode 100644 index 0000000000..18354e947d --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step1/show_mpls_table.ref @@ -0,0 +1,262 @@ +{ + "16010":{ + "inLabel":16010, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16010, + "installed":true, + "nexthop":"10.0.3.2", + "backupIndex":[ + 0 + ] + }, + { + "type":"SR (IS-IS)", + "outLabel":16010, + "installed":true, + "nexthop":"10.0.2.2", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "nexthop":"10.0.6.5" + } + ] + }, + "16011":{ + "inLabel":16011, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16011, + "installed":true, + "interface":"eth-rt2-2", + "backupIndex":[ + 0 + ] + }, + { + "type":"SR (IS-IS)", + "outLabel":16011, + "installed":true, + "interface":"eth-rt2-1", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "interface":"eth-rt5" + } + ] + }, + "16020":{ + "inLabel":16020, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "nexthop":"10.0.3.2", + "backupIndex":[ + 0 + ] + }, + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "nexthop":"10.0.2.2", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16030, + "nexthop":"10.0.6.5" + } + ] + }, + "16021":{ + "inLabel":16021, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "interface":"eth-rt2-2", + "backupIndex":[ + 0 + ] + }, + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "interface":"eth-rt2-1", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16031, + "interface":"eth-rt5" + } + ] + }, + "16030":{ + "inLabel":16030, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16030, + "installed":true, + "nexthop":"10.0.3.2" + }, + { + "type":"SR (IS-IS)", + "outLabel":16030, + "installed":true, + "nexthop":"10.0.2.2" + }, + { + "type":"SR (IS-IS)", + "outLabel":16030, + "installed":true, + "nexthop":"10.0.6.5" + } + ] + }, + "16031":{ + "inLabel":16031, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16031, + "installed":true, + "interface":"eth-rt2-2" + }, + { + "type":"SR (IS-IS)", + "outLabel":16031, + "installed":true, + "interface":"eth-rt2-1" + }, + { + "type":"SR (IS-IS)", + "outLabel":16031, + "installed":true, + "interface":"eth-rt5" + } + ] + }, + "16050":{ + "inLabel":16050, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "nexthop":"10.0.6.5", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "nexthop":"10.0.7.6" + } + ] + }, + "16051":{ + "inLabel":16051, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "interface":"eth-rt5", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "interface":"eth-rt6" + } + ] + }, + "16060":{ + "inLabel":16060, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "nexthop":"10.0.7.6", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "nexthop":"10.0.6.5" + } + ] + }, + "16061":{ + "inLabel":16061, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "interface":"eth-rt6", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "interface":"eth-rt5" + } + ] + } +} diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step1/show_yang_interface_isis_adjacencies.ref b/tests/topotests/isis-tilfa-topo1/rt4/step1/show_yang_interface_isis_adjacencies.ref new file mode 100644 index 0000000000..2eb64b6fc9 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step1/show_yang_interface_isis_adjacencies.ref @@ -0,0 +1,82 @@ +{ + "frr-interface:lib": { + "interface": [ + { + "name": "eth-rt2-1", + "vrf": "default", + "state": { + "frr-isisd:isis": { + "adjacencies": { + "adjacency": [ + { + "neighbor-sys-type": "level-1", + "neighbor-sysid": "0000.0000.0002", + "hold-timer": 9, + "neighbor-priority": 0, + "state": "up" + } + ] + } + } + } + }, + { + "name": "eth-rt2-2", + "vrf": "default", + "state": { + "frr-isisd:isis": { + "adjacencies": { + "adjacency": [ + { + "neighbor-sys-type": "level-1", + "neighbor-sysid": "0000.0000.0002", + "hold-timer": 9, + "neighbor-priority": 0, + "state": "up" + } + ] + } + } + } + }, + { + "name": "eth-rt5", + "vrf": "default", + "state": { + "frr-isisd:isis": { + "adjacencies": { + "adjacency": [ + { + "neighbor-sys-type": "level-1", + "neighbor-sysid": "0000.0000.0005", + "hold-timer": 9, + "neighbor-priority": 0, + "state": "up" + } + ] + } + } + } + }, + { + "name": "eth-rt6", + "vrf": "default", + "state": { + "frr-isisd:isis": { + "adjacencies": { + "adjacency": [ + { + "neighbor-sys-type": "level-1", + "neighbor-sysid": "0000.0000.0006", + "hold-timer": 9, + "neighbor-priority": 0, + "state": "up" + } + ] + } + } + } + } + ] + } +} diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step2/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step2/show_ip_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step2/show_ip_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step2/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step2/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step2/show_ipv6_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step2/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step2/show_mpls_table.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step2/show_mpls_table.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step3/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step3/show_ip_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step3/show_ip_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step3/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step3/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step3/show_ipv6_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step3/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step3/show_mpls_table.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step3/show_mpls_table.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step4/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step4/show_ip_route.ref.diff new file mode 100644 index 0000000000..7dcdb744ac --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step4/show_ip_route.ref.diff @@ -0,0 +1,312 @@ +--- rt4/step3/show_ip_route.ref 2020-09-25 17:48:05.722919797 -0300 ++++ rt4/step4/show_ip_route.ref 2020-09-25 17:49:02.163655010 -0300 +@@ -15,9 +15,6 @@ + "afi":"ipv4", + "interfaceName":"eth-rt2-1", + "active":true, +- "backupIndex":[ +- 0 +- ], + "labels":[ + 16010 + ] +@@ -28,21 +25,10 @@ + "afi":"ipv4", + "interfaceName":"eth-rt2-2", + "active":true, +- "backupIndex":[ +- 0 +- ], + "labels":[ + 16010 + ] + } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.6.5", +- "afi":"ipv4", +- "interfaceName":"eth-rt5", +- "active":true +- } + ] + } + ], +@@ -62,9 +48,6 @@ + "afi":"ipv4", + "interfaceName":"eth-rt2-1", + "active":true, +- "backupIndex":[ +- 0 +- ], + "labels":[ + 3 + ] +@@ -75,25 +58,10 @@ + "afi":"ipv4", + "interfaceName":"eth-rt2-2", + "active":true, +- "backupIndex":[ +- 0 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.6.5", +- "afi":"ipv4", +- "interfaceName":"eth-rt5", +- "active":true, +- "labels":[ +- 16030, +- 16020 +- ] +- } + ] + } + ], +@@ -156,21 +124,10 @@ + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true, +- "backupIndex":[ +- 0 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.7.6", +- "afi":"ipv4", +- "interfaceName":"eth-rt6", +- "active":true +- } + ] + } + ], +@@ -190,21 +147,10 @@ + "afi":"ipv4", + "interfaceName":"eth-rt6", + "active":true, +- "backupIndex":[ +- 0 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.6.5", +- "afi":"ipv4", +- "interfaceName":"eth-rt5", +- "active":true +- } + ] + } + ], +@@ -223,27 +169,13 @@ + "ip":"10.0.2.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-1", +- "active":true, +- "backupIndex":[ +- 0 +- ] ++ "active":true + }, + { + "fib":true, + "ip":"10.0.3.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-2", +- "active":true, +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.6.5", +- "afi":"ipv4", +- "interfaceName":"eth-rt5", + "active":true + } + ] +@@ -259,30 +191,13 @@ + { + "ip":"10.0.2.2", + "afi":"ipv4", +- "interfaceName":"eth-rt2-1", +- "backupIndex":[ +- 0 +- ] ++ "interfaceName":"eth-rt2-1" + }, + { + "ip":"10.0.3.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-2", +- "active":true, +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.6.5", +- "afi":"ipv4", +- "interfaceName":"eth-rt5", +- "active":true, +- "labels":[ +- 16030 +- ] ++ "active":true + } + ] + } +@@ -298,29 +213,12 @@ + "ip":"10.0.2.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-1", +- "active":true, +- "backupIndex":[ +- 0 +- ] ++ "active":true + }, + { + "ip":"10.0.3.2", + "afi":"ipv4", +- "interfaceName":"eth-rt2-2", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.6.5", +- "afi":"ipv4", +- "interfaceName":"eth-rt5", +- "active":true, +- "labels":[ +- 16030 +- ] ++ "interfaceName":"eth-rt2-2" + } + ] + } +@@ -340,31 +238,6 @@ + "ip":"10.0.6.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", +- "active":true, +- "backupIndex":[ +- 0, +- 1, +- 2 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.7.6", +- "afi":"ipv4", +- "interfaceName":"eth-rt6", +- "active":true +- }, +- { +- "ip":"10.0.2.2", +- "afi":"ipv4", +- "interfaceName":"eth-rt2-1", +- "active":true +- }, +- { +- "ip":"10.0.3.2", +- "afi":"ipv4", +- "interfaceName":"eth-rt2-2", + "active":true + } + ] +@@ -385,31 +258,6 @@ + "ip":"10.0.6.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", +- "active":true, +- "backupIndex":[ +- 0, +- 1, +- 2 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.7.6", +- "afi":"ipv4", +- "interfaceName":"eth-rt6", +- "active":true +- }, +- { +- "ip":"10.0.2.2", +- "afi":"ipv4", +- "interfaceName":"eth-rt2-1", +- "active":true +- }, +- { +- "ip":"10.0.3.2", +- "afi":"ipv4", +- "interfaceName":"eth-rt2-2", + "active":true + } + ] +@@ -425,18 +273,7 @@ + { + "ip":"10.0.6.5", + "afi":"ipv4", +- "interfaceName":"eth-rt5", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.7.6", +- "afi":"ipv4", +- "interfaceName":"eth-rt6", +- "active":true ++ "interfaceName":"eth-rt5" + } + ] + } +@@ -451,18 +288,7 @@ + { + "ip":"10.0.7.6", + "afi":"ipv4", +- "interfaceName":"eth-rt6", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.6.5", +- "afi":"ipv4", +- "interfaceName":"eth-rt5", +- "active":true ++ "interfaceName":"eth-rt6" + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step4/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step4/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..b84ceaff1a --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step4/show_ipv6_route.ref.diff @@ -0,0 +1,110 @@ +--- rt4/step3/show_ipv6_route.ref 2020-09-25 17:48:06.998936410 -0300 ++++ rt4/step4/show_ipv6_route.ref 2020-09-25 17:49:03.399671119 -0300 +@@ -14,9 +14,6 @@ + "afi":"ipv6", + "interfaceName":"eth-rt2-1", + "active":true, +- "backupIndex":[ +- 0 +- ], + "labels":[ + 16011 + ] +@@ -26,20 +23,10 @@ + "afi":"ipv6", + "interfaceName":"eth-rt2-2", + "active":true, +- "backupIndex":[ +- 0 +- ], + "labels":[ + 16011 + ] + } +- ], +- "backupNexthops":[ +- { +- "afi":"ipv6", +- "interfaceName":"eth-rt5", +- "active":true +- } + ] + } + ], +@@ -58,9 +45,6 @@ + "afi":"ipv6", + "interfaceName":"eth-rt2-1", + "active":true, +- "backupIndex":[ +- 0 +- ], + "labels":[ + 3 + ] +@@ -70,24 +54,10 @@ + "afi":"ipv6", + "interfaceName":"eth-rt2-2", + "active":true, +- "backupIndex":[ +- 0 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "afi":"ipv6", +- "interfaceName":"eth-rt5", +- "active":true, +- "labels":[ +- 16031, +- 16021 +- ] +- } + ] + } + ], +@@ -146,20 +116,10 @@ + "afi":"ipv6", + "interfaceName":"eth-rt5", + "active":true, +- "backupIndex":[ +- 0 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "afi":"ipv6", +- "interfaceName":"eth-rt6", +- "active":true +- } + ] + } + ], +@@ -178,20 +138,10 @@ + "afi":"ipv6", + "interfaceName":"eth-rt6", + "active":true, +- "backupIndex":[ +- 0 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "afi":"ipv6", +- "interfaceName":"eth-rt5", +- "active":true +- } + ] + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step4/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step4/show_mpls_table.ref.diff new file mode 100644 index 0000000000..70e0108b0d --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step4/show_mpls_table.ref.diff @@ -0,0 +1,194 @@ +--- rt4/step3/show_mpls_table.ref 2020-09-25 17:48:04.418902820 -0300 ++++ rt4/step4/show_mpls_table.ref 2020-09-25 17:49:00.959639319 -0300 +@@ -7,26 +7,13 @@ + "type":"SR (IS-IS)", + "outLabel":16010, + "installed":true, +- "nexthop":"10.0.3.2", +- "backupIndex":[ +- 0 +- ] ++ "nexthop":"10.0.3.2" + }, + { + "type":"SR (IS-IS)", + "outLabel":16010, + "installed":true, +- "nexthop":"10.0.2.2", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "nexthop":"10.0.6.5" ++ "nexthop":"10.0.2.2" + } + ] + }, +@@ -38,26 +25,13 @@ + "type":"SR (IS-IS)", + "outLabel":16011, + "installed":true, +- "interface":"eth-rt2-2", +- "backupIndex":[ +- 0 +- ] ++ "interface":"eth-rt2-2" + }, + { + "type":"SR (IS-IS)", + "outLabel":16011, + "installed":true, +- "interface":"eth-rt2-1", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "interface":"eth-rt5" ++ "interface":"eth-rt2-1" + } + ] + }, +@@ -69,26 +43,13 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.3.2", +- "backupIndex":[ +- 0 +- ] ++ "nexthop":"10.0.3.2" + }, + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.2.2", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16030, +- "nexthop":"10.0.6.5" ++ "nexthop":"10.0.2.2" + } + ] + }, +@@ -100,26 +61,13 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-rt2-2", +- "backupIndex":[ +- 0 +- ] ++ "interface":"eth-rt2-2" + }, + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-rt2-1", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16031, +- "interface":"eth-rt5" ++ "interface":"eth-rt2-1" + } + ] + }, +@@ -179,17 +127,7 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.6.5", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "nexthop":"10.0.7.6" ++ "nexthop":"10.0.6.5" + } + ] + }, +@@ -201,17 +139,7 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-rt5", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "interface":"eth-rt6" ++ "interface":"eth-rt5" + } + ] + }, +@@ -223,17 +151,7 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.7.6", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "nexthop":"10.0.6.5" ++ "nexthop":"10.0.7.6" + } + ] + }, +@@ -245,17 +163,7 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-rt6", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "interface":"eth-rt5" ++ "interface":"eth-rt6" + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step5/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step5/show_ip_route.ref.diff new file mode 100644 index 0000000000..aa319a3232 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step5/show_ip_route.ref.diff @@ -0,0 +1,312 @@ +--- rt4/step4/show_ip_route.ref 2020-09-25 17:49:02.163655010 -0300 ++++ rt4/step5/show_ip_route.ref 2020-09-25 17:50:12.800576153 -0300 +@@ -15,6 +15,9 @@ + "afi":"ipv4", + "interfaceName":"eth-rt2-1", + "active":true, ++ "backupIndex":[ ++ 0 ++ ], + "labels":[ + 16010 + ] +@@ -25,10 +28,21 @@ + "afi":"ipv4", + "interfaceName":"eth-rt2-2", + "active":true, ++ "backupIndex":[ ++ 0 ++ ], + "labels":[ + 16010 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.6.5", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt5", ++ "active":true ++ } + ] + } + ], +@@ -48,6 +62,9 @@ + "afi":"ipv4", + "interfaceName":"eth-rt2-1", + "active":true, ++ "backupIndex":[ ++ 0 ++ ], + "labels":[ + 3 + ] +@@ -58,10 +75,25 @@ + "afi":"ipv4", + "interfaceName":"eth-rt2-2", + "active":true, ++ "backupIndex":[ ++ 0 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.6.5", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt5", ++ "active":true, ++ "labels":[ ++ 16030, ++ 16020 ++ ] ++ } + ] + } + ], +@@ -124,10 +156,21 @@ + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true, ++ "backupIndex":[ ++ 0 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.7.6", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt6", ++ "active":true ++ } + ] + } + ], +@@ -147,10 +190,21 @@ + "afi":"ipv4", + "interfaceName":"eth-rt6", + "active":true, ++ "backupIndex":[ ++ 0 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.6.5", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt5", ++ "active":true ++ } + ] + } + ], +@@ -169,13 +223,27 @@ + "ip":"10.0.2.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-1", +- "active":true ++ "active":true, ++ "backupIndex":[ ++ 0 ++ ] + }, + { + "fib":true, + "ip":"10.0.3.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-2", ++ "active":true, ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.6.5", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt5", + "active":true + } + ] +@@ -191,13 +259,30 @@ + { + "ip":"10.0.2.2", + "afi":"ipv4", +- "interfaceName":"eth-rt2-1" ++ "interfaceName":"eth-rt2-1", ++ "backupIndex":[ ++ 0 ++ ] + }, + { + "ip":"10.0.3.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-2", +- "active":true ++ "active":true, ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.6.5", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt5", ++ "active":true, ++ "labels":[ ++ 16030 ++ ] + } + ] + } +@@ -213,12 +298,29 @@ + "ip":"10.0.2.2", + "afi":"ipv4", + "interfaceName":"eth-rt2-1", +- "active":true ++ "active":true, ++ "backupIndex":[ ++ 0 ++ ] + }, + { + "ip":"10.0.3.2", + "afi":"ipv4", +- "interfaceName":"eth-rt2-2" ++ "interfaceName":"eth-rt2-2", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.6.5", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt5", ++ "active":true, ++ "labels":[ ++ 16030 ++ ] + } + ] + } +@@ -238,6 +340,31 @@ + "ip":"10.0.6.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", ++ "active":true, ++ "backupIndex":[ ++ 0, ++ 1, ++ 2 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.7.6", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt6", ++ "active":true ++ }, ++ { ++ "ip":"10.0.2.2", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt2-1", ++ "active":true ++ }, ++ { ++ "ip":"10.0.3.2", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt2-2", + "active":true + } + ] +@@ -258,6 +385,31 @@ + "ip":"10.0.6.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", ++ "active":true, ++ "backupIndex":[ ++ 0, ++ 1, ++ 2 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.7.6", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt6", ++ "active":true ++ }, ++ { ++ "ip":"10.0.2.2", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt2-1", ++ "active":true ++ }, ++ { ++ "ip":"10.0.3.2", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt2-2", + "active":true + } + ] +@@ -273,7 +425,18 @@ + { + "ip":"10.0.6.5", + "afi":"ipv4", +- "interfaceName":"eth-rt5" ++ "interfaceName":"eth-rt5", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.7.6", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt6", ++ "active":true + } + ] + } +@@ -288,7 +451,18 @@ + { + "ip":"10.0.7.6", + "afi":"ipv4", +- "interfaceName":"eth-rt6" ++ "interfaceName":"eth-rt6", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.6.5", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt5", ++ "active":true + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step5/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step5/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..1bd207854c --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step5/show_ipv6_route.ref.diff @@ -0,0 +1,110 @@ +--- rt4/step4/show_ipv6_route.ref 2020-09-25 17:49:03.399671119 -0300 ++++ rt4/step5/show_ipv6_route.ref 2020-09-25 17:50:14.040592332 -0300 +@@ -14,6 +14,9 @@ + "afi":"ipv6", + "interfaceName":"eth-rt2-1", + "active":true, ++ "backupIndex":[ ++ 0 ++ ], + "labels":[ + 16011 + ] +@@ -23,10 +26,20 @@ + "afi":"ipv6", + "interfaceName":"eth-rt2-2", + "active":true, ++ "backupIndex":[ ++ 0 ++ ], + "labels":[ + 16011 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "afi":"ipv6", ++ "interfaceName":"eth-rt5", ++ "active":true ++ } + ] + } + ], +@@ -45,6 +58,9 @@ + "afi":"ipv6", + "interfaceName":"eth-rt2-1", + "active":true, ++ "backupIndex":[ ++ 0 ++ ], + "labels":[ + 3 + ] +@@ -54,10 +70,24 @@ + "afi":"ipv6", + "interfaceName":"eth-rt2-2", + "active":true, ++ "backupIndex":[ ++ 0 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "afi":"ipv6", ++ "interfaceName":"eth-rt5", ++ "active":true, ++ "labels":[ ++ 16031, ++ 16021 ++ ] ++ } + ] + } + ], +@@ -116,10 +146,20 @@ + "afi":"ipv6", + "interfaceName":"eth-rt5", + "active":true, ++ "backupIndex":[ ++ 0 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "afi":"ipv6", ++ "interfaceName":"eth-rt6", ++ "active":true ++ } + ] + } + ], +@@ -138,10 +178,20 @@ + "afi":"ipv6", + "interfaceName":"eth-rt6", + "active":true, ++ "backupIndex":[ ++ 0 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "afi":"ipv6", ++ "interfaceName":"eth-rt5", ++ "active":true ++ } + ] + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step5/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step5/show_mpls_table.ref.diff new file mode 100644 index 0000000000..664b129a1b --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step5/show_mpls_table.ref.diff @@ -0,0 +1,194 @@ +--- rt4/step4/show_mpls_table.ref 2020-09-25 17:49:00.959639319 -0300 ++++ rt4/step5/show_mpls_table.ref 2020-09-25 17:50:11.488559034 -0300 +@@ -7,13 +7,26 @@ + "type":"SR (IS-IS)", + "outLabel":16010, + "installed":true, +- "nexthop":"10.0.3.2" ++ "nexthop":"10.0.3.2", ++ "backupIndex":[ ++ 0 ++ ] + }, + { + "type":"SR (IS-IS)", + "outLabel":16010, + "installed":true, +- "nexthop":"10.0.2.2" ++ "nexthop":"10.0.2.2", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "nexthop":"10.0.6.5" + } + ] + }, +@@ -25,13 +38,26 @@ + "type":"SR (IS-IS)", + "outLabel":16011, + "installed":true, +- "interface":"eth-rt2-2" ++ "interface":"eth-rt2-2", ++ "backupIndex":[ ++ 0 ++ ] + }, + { + "type":"SR (IS-IS)", + "outLabel":16011, + "installed":true, +- "interface":"eth-rt2-1" ++ "interface":"eth-rt2-1", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "interface":"eth-rt5" + } + ] + }, +@@ -43,13 +69,26 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.3.2" ++ "nexthop":"10.0.3.2", ++ "backupIndex":[ ++ 0 ++ ] + }, + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.2.2" ++ "nexthop":"10.0.2.2", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16030, ++ "nexthop":"10.0.6.5" + } + ] + }, +@@ -61,13 +100,26 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-rt2-2" ++ "interface":"eth-rt2-2", ++ "backupIndex":[ ++ 0 ++ ] + }, + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-rt2-1" ++ "interface":"eth-rt2-1", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16031, ++ "interface":"eth-rt5" + } + ] + }, +@@ -127,7 +179,17 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.6.5" ++ "nexthop":"10.0.6.5", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "nexthop":"10.0.7.6" + } + ] + }, +@@ -139,7 +201,17 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-rt5" ++ "interface":"eth-rt5", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "interface":"eth-rt6" + } + ] + }, +@@ -151,7 +223,17 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.7.6" ++ "nexthop":"10.0.7.6", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "nexthop":"10.0.6.5" + } + ] + }, +@@ -163,7 +245,17 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-rt6" ++ "interface":"eth-rt6", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "interface":"eth-rt5" + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step6/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step6/show_ip_route.ref.diff new file mode 100644 index 0000000000..c758b89839 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step6/show_ip_route.ref.diff @@ -0,0 +1,38 @@ +--- rt4/step5/show_ip_route.ref 2020-09-25 17:50:12.800576153 -0300 ++++ rt4/step6/show_ip_route.ref 2020-09-25 17:51:15.725397558 -0300 +@@ -90,7 +90,7 @@ + "interfaceName":"eth-rt5", + "active":true, + "labels":[ +- 16030, ++ 30030, + 16020 + ] + } +@@ -134,7 +134,7 @@ + "interfaceName":"eth-rt5", + "active":true, + "labels":[ +- 16030 ++ 30030 + ] + } + ] +@@ -281,7 +281,7 @@ + "interfaceName":"eth-rt5", + "active":true, + "labels":[ +- 16030 ++ 30030 + ] + } + ] +@@ -319,7 +319,7 @@ + "interfaceName":"eth-rt5", + "active":true, + "labels":[ +- 16030 ++ 30030 + ] + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step6/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step6/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..ca495216dd --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step6/show_ipv6_route.ref.diff @@ -0,0 +1,20 @@ +--- rt4/step5/show_ipv6_route.ref 2020-09-25 17:50:14.040592332 -0300 ++++ rt4/step6/show_ipv6_route.ref 2020-09-25 17:51:16.969413804 -0300 +@@ -84,7 +84,7 @@ + "interfaceName":"eth-rt5", + "active":true, + "labels":[ +- 16031, ++ 30031, + 16021 + ] + } +@@ -116,7 +116,7 @@ + "interfaceName":"eth-rt5", + "active":true, + "labels":[ +- 16031 ++ 30031 + ] + }, + { diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step6/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step6/show_mpls_table.ref.diff new file mode 100644 index 0000000000..630e0419cf --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step6/show_mpls_table.ref.diff @@ -0,0 +1,38 @@ +--- rt4/step5/show_mpls_table.ref 2020-09-25 17:50:11.488559034 -0300 ++++ rt4/step6/show_mpls_table.ref 2020-09-25 17:51:14.481381312 -0300 +@@ -87,7 +87,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16030, ++ "outLabel":30030, + "nexthop":"10.0.6.5" + } + ] +@@ -118,7 +118,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16031, ++ "outLabel":30031, + "interface":"eth-rt5" + } + ] +@@ -141,7 +141,7 @@ + }, + { + "type":"SR (IS-IS)", +- "outLabel":16030, ++ "outLabel":30030, + "installed":true, + "nexthop":"10.0.6.5" + } +@@ -165,7 +165,7 @@ + }, + { + "type":"SR (IS-IS)", +- "outLabel":16031, ++ "outLabel":30031, + "installed":true, + "interface":"eth-rt5" + } diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step7/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step7/show_ip_route.ref.diff new file mode 100644 index 0000000000..30e0dcf3c0 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step7/show_ip_route.ref.diff @@ -0,0 +1,12 @@ +--- rt4/step6/show_ip_route.ref 2020-09-25 17:51:15.725397558 -0300 ++++ rt4/step7/show_ip_route.ref 2020-09-25 17:52:02.614010084 -0300 +@@ -158,9 +158,6 @@ + "active":true, + "backupIndex":[ + 0 +- ], +- "labels":[ +- 3 + ] + } + ], diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step7/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step7/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..2606027d75 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step7/show_ipv6_route.ref.diff @@ -0,0 +1,12 @@ +--- rt4/step6/show_ipv6_route.ref 2020-09-25 17:51:16.969413804 -0300 ++++ rt4/step7/show_ipv6_route.ref 2020-09-25 17:52:03.854026287 -0300 +@@ -148,9 +148,6 @@ + "active":true, + "backupIndex":[ + 0 +- ], +- "labels":[ +- 3 + ] + } + ], diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step7/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step7/show_mpls_table.ref.diff new file mode 100644 index 0000000000..5334cfd048 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step7/show_mpls_table.ref.diff @@ -0,0 +1,53 @@ +--- rt4/step6/show_mpls_table.ref 2020-09-25 17:51:14.481381312 -0300 ++++ rt4/step7/show_mpls_table.ref 2020-09-25 17:52:01.385994037 -0300 +@@ -171,50 +171,6 @@ + } + ] + }, +- "16050":{ +- "inLabel":16050, +- "installed":true, +- "nexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "installed":true, +- "nexthop":"10.0.6.5", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "nexthop":"10.0.7.6" +- } +- ] +- }, +- "16051":{ +- "inLabel":16051, +- "installed":true, +- "nexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "installed":true, +- "interface":"eth-rt5", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "interface":"eth-rt6" +- } +- ] +- }, + "16060":{ + "inLabel":16060, + "installed":true, diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step8/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step8/show_ip_route.ref.diff new file mode 100644 index 0000000000..b393970e42 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step8/show_ip_route.ref.diff @@ -0,0 +1,12 @@ +--- rt4/step7/show_ip_route.ref 2020-09-25 17:52:02.614010084 -0300 ++++ rt4/step8/show_ip_route.ref 2020-09-25 17:53:20.623029909 -0300 +@@ -158,6 +158,9 @@ + "active":true, + "backupIndex":[ + 0 ++ ], ++ "labels":[ ++ 3 + ] + } + ], diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step8/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step8/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..8bad2edcf3 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step8/show_ipv6_route.ref.diff @@ -0,0 +1,12 @@ +--- rt4/step7/show_ipv6_route.ref 2020-09-25 17:52:03.854026287 -0300 ++++ rt4/step8/show_ipv6_route.ref 2020-09-25 17:53:21.843045865 -0300 +@@ -148,6 +148,9 @@ + "active":true, + "backupIndex":[ + 0 ++ ], ++ "labels":[ ++ 3 + ] + } + ], diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step8/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step8/show_mpls_table.ref.diff new file mode 100644 index 0000000000..d296dbdcaf --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step8/show_mpls_table.ref.diff @@ -0,0 +1,53 @@ +--- rt4/step7/show_mpls_table.ref 2020-09-25 17:52:01.385994037 -0300 ++++ rt4/step8/show_mpls_table.ref 2020-09-25 17:53:19.371013534 -0300 +@@ -171,6 +171,50 @@ + } + ] + }, ++ "16050":{ ++ "inLabel":16050, ++ "installed":true, ++ "nexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "installed":true, ++ "nexthop":"10.0.6.5", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "nexthop":"10.0.7.6" ++ } ++ ] ++ }, ++ "16051":{ ++ "inLabel":16051, ++ "installed":true, ++ "nexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "installed":true, ++ "interface":"eth-rt5", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "interface":"eth-rt6" ++ } ++ ] ++ }, + "16060":{ + "inLabel":16060, + "installed":true, diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step9/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step9/show_ip_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step9/show_ip_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step9/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step9/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step9/show_ipv6_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt4/step9/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt4/step9/show_mpls_table.ref.diff new file mode 100644 index 0000000000..408cbfb0ba --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/step9/show_mpls_table.ref.diff @@ -0,0 +1,102 @@ +--- rt4/step8/show_mpls_table.ref 2020-09-25 17:53:19.371013534 -0300 ++++ rt4/step9/show_mpls_table.ref 2020-09-25 17:54:37.064030042 -0300 +@@ -171,15 +171,15 @@ + } + ] + }, +- "16050":{ +- "inLabel":16050, ++ "16060":{ ++ "inLabel":16060, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.6.5", ++ "nexthop":"10.0.7.6", + "backupIndex":[ + 0 + ] +@@ -189,19 +189,19 @@ + { + "type":"SR (IS-IS)", + "outLabel":3, +- "nexthop":"10.0.7.6" ++ "nexthop":"10.0.6.5" + } + ] + }, +- "16051":{ +- "inLabel":16051, ++ "16061":{ ++ "inLabel":16061, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-rt5", ++ "interface":"eth-rt6", + "backupIndex":[ + 0 + ] +@@ -211,19 +211,19 @@ + { + "type":"SR (IS-IS)", + "outLabel":3, +- "interface":"eth-rt6" ++ "interface":"eth-rt5" + } + ] + }, +- "16060":{ +- "inLabel":16060, ++ "16500":{ ++ "inLabel":16500, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.7.6", ++ "nexthop":"10.0.6.5", + "backupIndex":[ + 0 + ] +@@ -233,19 +233,19 @@ + { + "type":"SR (IS-IS)", + "outLabel":3, +- "nexthop":"10.0.6.5" ++ "nexthop":"10.0.7.6" + } + ] + }, +- "16061":{ +- "inLabel":16061, ++ "16501":{ ++ "inLabel":16501, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-rt6", ++ "interface":"eth-rt5", + "backupIndex":[ + 0 + ] +@@ -255,7 +255,7 @@ + { + "type":"SR (IS-IS)", + "outLabel":3, +- "interface":"eth-rt5" ++ "interface":"eth-rt6" + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt4/zebra.conf b/tests/topotests/isis-tilfa-topo1/rt4/zebra.conf new file mode 100644 index 0000000000..4945897e9d --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt4/zebra.conf @@ -0,0 +1,28 @@ +log file zebra.log +! +hostname rt4 +! +debug zebra kernel +debug zebra packet +debug zebra mpls +! +interface lo + ip address 4.4.4.4/32 + ipv6 address 2001:db8:1000::4/128 +! +interface eth-rt2-1 + ip address 10.0.2.4/24 +! +interface eth-rt2-2 + ip address 10.0.3.4/24 +! +interface eth-rt5 + ip address 10.0.6.4/24 +! +interface eth-rt6 + ip address 10.0.7.4/24 +! +ip forwarding +! +line vty +! diff --git a/tests/topotests/isis-tilfa-topo1/rt5/isisd.conf b/tests/topotests/isis-tilfa-topo1/rt5/isisd.conf new file mode 100644 index 0000000000..be52eb0322 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/isisd.conf @@ -0,0 +1,53 @@ +hostname rt5 +log file isisd.log +! +debug isis events +debug isis route-events +debug isis spf-events +debug isis sr-events +debug isis lsp-gen +! +interface lo + ip router isis 1 + ipv6 router isis 1 + isis passive +! +interface eth-rt3-1 + ip router isis 1 + ipv6 router isis 1 + isis network point-to-point + isis hello-multiplier 3 + isis fast-reroute ti-lfa +! +interface eth-rt3-2 + ip router isis 1 + ipv6 router isis 1 + isis network point-to-point + isis hello-multiplier 3 + isis fast-reroute ti-lfa +! +interface eth-rt4 + ip router isis 1 + ipv6 router isis 1 + isis network point-to-point + isis hello-multiplier 3 + isis fast-reroute ti-lfa +! +interface eth-rt6 + ip router isis 1 + ipv6 router isis 1 + isis network point-to-point + isis hello-multiplier 3 + isis fast-reroute ti-lfa +! +router isis 1 + net 49.0000.0000.0000.0005.00 + is-type level-1 + lsp-gen-interval 2 + topology ipv6-unicast + segment-routing on + segment-routing global-block 16000 23999 + segment-routing node-msd 8 + segment-routing prefix 5.5.5.5/32 index 50 + segment-routing prefix 2001:db8:1000::5/128 index 51 +! diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step1/show_ip_route.ref b/tests/topotests/isis-tilfa-topo1/rt5/step1/show_ip_route.ref new file mode 100644 index 0000000000..f747065f9c --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step1/show_ip_route.ref @@ -0,0 +1,497 @@ +{ + "1.1.1.1\/32":[ + { + "prefix":"1.1.1.1\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.4.3", + "afi":"ipv4", + "interfaceName":"eth-rt3-1", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 16010 + ] + }, + { + "fib":true, + "ip":"10.0.5.3", + "afi":"ipv4", + "interfaceName":"eth-rt3-2", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 16010 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true + } + ] + } + ], + "2.2.2.2\/32":[ + { + "prefix":"2.2.2.2\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.4.3", + "afi":"ipv4", + "interfaceName":"eth-rt3-1", + "active":true, + "labels":[ + 16020 + ] + }, + { + "fib":true, + "ip":"10.0.5.3", + "afi":"ipv4", + "interfaceName":"eth-rt3-2", + "active":true, + "labels":[ + 16020 + ] + }, + { + "fib":true, + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16020 + ] + } + ] + } + ], + "3.3.3.3\/32":[ + { + "prefix":"3.3.3.3\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.4.3", + "afi":"ipv4", + "interfaceName":"eth-rt3-1", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + }, + { + "fib":true, + "ip":"10.0.5.3", + "afi":"ipv4", + "interfaceName":"eth-rt3-2", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16020, + 16030 + ] + } + ] + } + ], + "4.4.4.4\/32":[ + { + "prefix":"4.4.4.4\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.8.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", + "active":true + } + ] + } + ], + "6.6.6.6\/32":[ + { + "prefix":"6.6.6.6\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.8.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true + } + ] + } + ], + "10.0.1.0\/24":[ + { + "prefix":"10.0.1.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.4.3", + "afi":"ipv4", + "interfaceName":"eth-rt3-1", + "active":true, + "backupIndex":[ + 0 + ] + }, + { + "fib":true, + "ip":"10.0.5.3", + "afi":"ipv4", + "interfaceName":"eth-rt3-2", + "active":true, + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true + } + ] + } + ], + "10.0.2.0\/24":[ + { + "prefix":"10.0.2.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true, + "backupIndex":[ + 0, + 1, + 2 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.8.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", + "active":true + }, + { + "ip":"10.0.4.3", + "afi":"ipv4", + "interfaceName":"eth-rt3-1", + "active":true + }, + { + "ip":"10.0.5.3", + "afi":"ipv4", + "interfaceName":"eth-rt3-2", + "active":true + } + ] + } + ], + "10.0.3.0\/24":[ + { + "prefix":"10.0.3.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true, + "backupIndex":[ + 0, + 1, + 2 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.8.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", + "active":true + }, + { + "ip":"10.0.4.3", + "afi":"ipv4", + "interfaceName":"eth-rt3-1", + "active":true + }, + { + "ip":"10.0.5.3", + "afi":"ipv4", + "interfaceName":"eth-rt3-2", + "active":true + } + ] + } + ], + "10.0.4.0\/24":[ + { + "prefix":"10.0.4.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.4.3", + "afi":"ipv4", + "interfaceName":"eth-rt3-1", + "backupIndex":[ + 0 + ] + }, + { + "ip":"10.0.5.3", + "afi":"ipv4", + "interfaceName":"eth-rt3-2", + "active":true, + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16020 + ] + } + ] + } + ], + "10.0.5.0\/24":[ + { + "prefix":"10.0.5.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.4.3", + "afi":"ipv4", + "interfaceName":"eth-rt3-1", + "active":true, + "backupIndex":[ + 0 + ] + }, + { + "ip":"10.0.5.3", + "afi":"ipv4", + "interfaceName":"eth-rt3-2", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16020 + ] + } + ] + } + ], + "10.0.6.0\/24":[ + { + "prefix":"10.0.6.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.8.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", + "active":true + } + ] + } + ], + "10.0.7.0\/24":[ + { + "prefix":"10.0.7.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true + }, + { + "fib":true, + "ip":"10.0.8.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", + "active":true + } + ] + } + ], + "10.0.8.0\/24":[ + { + "prefix":"10.0.8.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.8.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true + } + ] + } + ] +} diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step1/show_ipv6_route.ref b/tests/topotests/isis-tilfa-topo1/rt5/step1/show_ipv6_route.ref new file mode 100644 index 0000000000..6c0a5e0b9b --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step1/show_ipv6_route.ref @@ -0,0 +1,198 @@ +{ + "2001:db8:1000::1\/128":[ + { + "prefix":"2001:db8:1000::1\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt3-1", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 16011 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt3-2", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 16011 + ] + } + ], + "backupNexthops":[ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", + "active":true + } + ] + } + ], + "2001:db8:1000::2\/128":[ + { + "prefix":"2001:db8:1000::2\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16021 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt3-1", + "active":true, + "labels":[ + 16021 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt3-2", + "active":true, + "labels":[ + 16021 + ] + } + ] + } + ], + "2001:db8:1000::3\/128":[ + { + "prefix":"2001:db8:1000::3\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt3-1", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt3-2", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16021, + 16031 + ] + } + ] + } + ], + "2001:db8:1000::4\/128":[ + { + "prefix":"2001:db8:1000::4\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "afi":"ipv6", + "interfaceName":"eth-rt6", + "active":true + } + ] + } + ], + "2001:db8:1000::6\/128":[ + { + "prefix":"2001:db8:1000::6\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt6", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", + "active":true + } + ] + } + ] +} diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step1/show_mpls_table.ref b/tests/topotests/isis-tilfa-topo1/rt5/step1/show_mpls_table.ref new file mode 100644 index 0000000000..2b70392adc --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step1/show_mpls_table.ref @@ -0,0 +1,262 @@ +{ + "16010":{ + "inLabel":16010, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16010, + "installed":true, + "nexthop":"10.0.5.3", + "backupIndex":[ + 0 + ] + }, + { + "type":"SR (IS-IS)", + "outLabel":16010, + "installed":true, + "nexthop":"10.0.4.3", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "nexthop":"10.0.6.4" + } + ] + }, + "16011":{ + "inLabel":16011, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16011, + "installed":true, + "interface":"eth-rt3-2", + "backupIndex":[ + 0 + ] + }, + { + "type":"SR (IS-IS)", + "outLabel":16011, + "installed":true, + "interface":"eth-rt3-1", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "interface":"eth-rt4" + } + ] + }, + "16020":{ + "inLabel":16020, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16020, + "installed":true, + "nexthop":"10.0.5.3" + }, + { + "type":"SR (IS-IS)", + "outLabel":16020, + "installed":true, + "nexthop":"10.0.4.3" + }, + { + "type":"SR (IS-IS)", + "outLabel":16020, + "installed":true, + "nexthop":"10.0.6.4" + } + ] + }, + "16021":{ + "inLabel":16021, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16021, + "installed":true, + "interface":"eth-rt3-2" + }, + { + "type":"SR (IS-IS)", + "outLabel":16021, + "installed":true, + "interface":"eth-rt3-1" + }, + { + "type":"SR (IS-IS)", + "outLabel":16021, + "installed":true, + "interface":"eth-rt4" + } + ] + }, + "16030":{ + "inLabel":16030, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "nexthop":"10.0.5.3", + "backupIndex":[ + 0 + ] + }, + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "nexthop":"10.0.4.3", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16020, + "nexthop":"10.0.6.4" + } + ] + }, + "16031":{ + "inLabel":16031, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "interface":"eth-rt3-2", + "backupIndex":[ + 0 + ] + }, + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "interface":"eth-rt3-1", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16021, + "interface":"eth-rt4" + } + ] + }, + "16040":{ + "inLabel":16040, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "nexthop":"10.0.6.4", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "nexthop":"10.0.8.6" + } + ] + }, + "16041":{ + "inLabel":16041, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "interface":"eth-rt4", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "interface":"eth-rt6" + } + ] + }, + "16060":{ + "inLabel":16060, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "nexthop":"10.0.8.6", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "nexthop":"10.0.6.4" + } + ] + }, + "16061":{ + "inLabel":16061, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "interface":"eth-rt6", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "interface":"eth-rt4" + } + ] + } +} diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step1/show_yang_interface_isis_adjacencies.ref b/tests/topotests/isis-tilfa-topo1/rt5/step1/show_yang_interface_isis_adjacencies.ref new file mode 100644 index 0000000000..1ff8c2cd4e --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step1/show_yang_interface_isis_adjacencies.ref @@ -0,0 +1,82 @@ +{ + "frr-interface:lib": { + "interface": [ + { + "name": "eth-rt3-1", + "vrf": "default", + "state": { + "frr-isisd:isis": { + "adjacencies": { + "adjacency": [ + { + "neighbor-sys-type": "level-1", + "neighbor-sysid": "0000.0000.0003", + "hold-timer": 9, + "neighbor-priority": 0, + "state": "up" + } + ] + } + } + } + }, + { + "name": "eth-rt3-2", + "vrf": "default", + "state": { + "frr-isisd:isis": { + "adjacencies": { + "adjacency": [ + { + "neighbor-sys-type": "level-1", + "neighbor-sysid": "0000.0000.0003", + "hold-timer": 9, + "neighbor-priority": 0, + "state": "up" + } + ] + } + } + } + }, + { + "name": "eth-rt4", + "vrf": "default", + "state": { + "frr-isisd:isis": { + "adjacencies": { + "adjacency": [ + { + "neighbor-sys-type": "level-1", + "neighbor-sysid": "0000.0000.0004", + "hold-timer": 9, + "neighbor-priority": 0, + "state": "up" + } + ] + } + } + } + }, + { + "name": "eth-rt6", + "vrf": "default", + "state": { + "frr-isisd:isis": { + "adjacencies": { + "adjacency": [ + { + "neighbor-sys-type": "level-1", + "neighbor-sysid": "0000.0000.0006", + "hold-timer": 9, + "neighbor-priority": 0, + "state": "up" + } + ] + } + } + } + } + ] + } +} diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step2/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step2/show_ip_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step2/show_ip_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step2/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step2/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step2/show_ipv6_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step2/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step2/show_mpls_table.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step2/show_mpls_table.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step3/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step3/show_ip_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step3/show_ip_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step3/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step3/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step3/show_ipv6_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step3/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step3/show_mpls_table.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step3/show_mpls_table.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step4/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step4/show_ip_route.ref.diff new file mode 100644 index 0000000000..6402b51893 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step4/show_ip_route.ref.diff @@ -0,0 +1,125 @@ +--- rt5/step3/show_ip_route.ref 2020-09-25 17:48:05.950922766 -0300 ++++ rt5/step4/show_ip_route.ref 2020-09-25 17:49:02.363657616 -0300 +@@ -81,10 +81,7 @@ + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16020 +- ] ++ "active":true + } + ] + } +@@ -105,9 +102,6 @@ + "afi":"ipv4", + "interfaceName":"eth-rt3-1", + "active":true, +- "backupIndex":[ +- 0 +- ], + "labels":[ + 3 + ] +@@ -118,25 +112,10 @@ + "afi":"ipv4", + "interfaceName":"eth-rt3-2", + "active":true, +- "backupIndex":[ +- 0 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.6.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16020, +- 16030 +- ] +- } + ] + } + ], +@@ -158,9 +137,6 @@ + "active":true, + "backupIndex":[ + 0 +- ], +- "labels":[ +- 3 + ] + } + ], +@@ -349,30 +325,13 @@ + { + "ip":"10.0.4.3", + "afi":"ipv4", +- "interfaceName":"eth-rt3-1", +- "backupIndex":[ +- 0 +- ] ++ "interfaceName":"eth-rt3-1" + }, + { + "ip":"10.0.5.3", + "afi":"ipv4", + "interfaceName":"eth-rt3-2", +- "active":true, +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.6.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16020 +- ] ++ "active":true + } + ] + } +@@ -388,29 +347,12 @@ + "ip":"10.0.4.3", + "afi":"ipv4", + "interfaceName":"eth-rt3-1", +- "active":true, +- "backupIndex":[ +- 0 +- ] ++ "active":true + }, + { + "ip":"10.0.5.3", + "afi":"ipv4", +- "interfaceName":"eth-rt3-2", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "ip":"10.0.6.4", +- "afi":"ipv4", +- "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16020 +- ] ++ "interfaceName":"eth-rt3-2" + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step4/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step4/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..7a0135bf04 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step4/show_ipv6_route.ref.diff @@ -0,0 +1,59 @@ +--- rt5/step3/show_ipv6_route.ref 2020-09-25 17:48:07.218939274 -0300 ++++ rt5/step4/show_ipv6_route.ref 2020-09-25 17:49:03.599673726 -0300 +@@ -57,10 +57,7 @@ + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16021 +- ] ++ "active":true + }, + { + "fib":true, +@@ -98,9 +95,6 @@ + "afi":"ipv6", + "interfaceName":"eth-rt3-1", + "active":true, +- "backupIndex":[ +- 0 +- ], + "labels":[ + 3 + ] +@@ -110,24 +104,10 @@ + "afi":"ipv6", + "interfaceName":"eth-rt3-2", + "active":true, +- "backupIndex":[ +- 0 +- ], + "labels":[ + 3 + ] + } +- ], +- "backupNexthops":[ +- { +- "afi":"ipv6", +- "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16021, +- 16031 +- ] +- } + ] + } + ], +@@ -148,9 +128,6 @@ + "active":true, + "backupIndex":[ + 0 +- ], +- "labels":[ +- 3 + ] + } + ], diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step4/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step4/show_mpls_table.ref.diff new file mode 100644 index 0000000000..299dac7640 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step4/show_mpls_table.ref.diff @@ -0,0 +1,130 @@ +--- rt5/step3/show_mpls_table.ref 2020-09-25 17:48:04.626905528 -0300 ++++ rt5/step4/show_mpls_table.ref 2020-09-25 17:49:01.159641924 -0300 +@@ -76,12 +76,6 @@ + "outLabel":16020, + "installed":true, + "nexthop":"10.0.4.3" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16020, +- "installed":true, +- "nexthop":"10.0.6.4" + } + ] + }, +@@ -100,12 +94,6 @@ + "outLabel":16021, + "installed":true, + "interface":"eth-rt3-1" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16021, +- "installed":true, +- "interface":"eth-rt4" + } + ] + }, +@@ -117,26 +105,13 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.5.3", +- "backupIndex":[ +- 0 +- ] ++ "nexthop":"10.0.5.3" + }, + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.4.3", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16020, +- "nexthop":"10.0.6.4" ++ "nexthop":"10.0.4.3" + } + ] + }, +@@ -148,70 +123,13 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-rt3-2", +- "backupIndex":[ +- 0 +- ] ++ "interface":"eth-rt3-2" + }, + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-rt3-1", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":16021, +- "interface":"eth-rt4" +- } +- ] +- }, +- "16040":{ +- "inLabel":16040, +- "installed":true, +- "nexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "installed":true, +- "nexthop":"10.0.6.4", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "nexthop":"10.0.8.6" +- } +- ] +- }, +- "16041":{ +- "inLabel":16041, +- "installed":true, +- "nexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "installed":true, +- "interface":"eth-rt4", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "interface":"eth-rt6" ++ "interface":"eth-rt3-1" + } + ] + }, diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step5/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step5/show_ip_route.ref.diff new file mode 100644 index 0000000000..31f70b17a3 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step5/show_ip_route.ref.diff @@ -0,0 +1,125 @@ +--- rt5/step4/show_ip_route.ref 2020-09-25 17:49:02.363657616 -0300 ++++ rt5/step5/show_ip_route.ref 2020-09-25 17:50:13.012578918 -0300 +@@ -81,7 +81,10 @@ + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", +- "active":true ++ "active":true, ++ "labels":[ ++ 16020 ++ ] + } + ] + } +@@ -102,6 +105,9 @@ + "afi":"ipv4", + "interfaceName":"eth-rt3-1", + "active":true, ++ "backupIndex":[ ++ 0 ++ ], + "labels":[ + 3 + ] +@@ -112,10 +118,25 @@ + "afi":"ipv4", + "interfaceName":"eth-rt3-2", + "active":true, ++ "backupIndex":[ ++ 0 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.6.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4", ++ "active":true, ++ "labels":[ ++ 16020, ++ 16030 ++ ] ++ } + ] + } + ], +@@ -137,6 +158,9 @@ + "active":true, + "backupIndex":[ + 0 ++ ], ++ "labels":[ ++ 3 + ] + } + ], +@@ -325,13 +349,30 @@ + { + "ip":"10.0.4.3", + "afi":"ipv4", +- "interfaceName":"eth-rt3-1" ++ "interfaceName":"eth-rt3-1", ++ "backupIndex":[ ++ 0 ++ ] + }, + { + "ip":"10.0.5.3", + "afi":"ipv4", + "interfaceName":"eth-rt3-2", +- "active":true ++ "active":true, ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.6.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4", ++ "active":true, ++ "labels":[ ++ 16020 ++ ] + } + ] + } +@@ -347,12 +388,29 @@ + "ip":"10.0.4.3", + "afi":"ipv4", + "interfaceName":"eth-rt3-1", +- "active":true ++ "active":true, ++ "backupIndex":[ ++ 0 ++ ] + }, + { + "ip":"10.0.5.3", + "afi":"ipv4", +- "interfaceName":"eth-rt3-2" ++ "interfaceName":"eth-rt3-2", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "ip":"10.0.6.4", ++ "afi":"ipv4", ++ "interfaceName":"eth-rt4", ++ "active":true, ++ "labels":[ ++ 16020 ++ ] + } + ] + } diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step5/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step5/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..59d9755e18 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step5/show_ipv6_route.ref.diff @@ -0,0 +1,59 @@ +--- rt5/step4/show_ipv6_route.ref 2020-09-25 17:49:03.599673726 -0300 ++++ rt5/step5/show_ipv6_route.ref 2020-09-25 17:50:14.248595046 -0300 +@@ -57,7 +57,10 @@ + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4", +- "active":true ++ "active":true, ++ "labels":[ ++ 16021 ++ ] + }, + { + "fib":true, +@@ -95,6 +98,9 @@ + "afi":"ipv6", + "interfaceName":"eth-rt3-1", + "active":true, ++ "backupIndex":[ ++ 0 ++ ], + "labels":[ + 3 + ] +@@ -104,10 +110,24 @@ + "afi":"ipv6", + "interfaceName":"eth-rt3-2", + "active":true, ++ "backupIndex":[ ++ 0 ++ ], + "labels":[ + 3 + ] + } ++ ], ++ "backupNexthops":[ ++ { ++ "afi":"ipv6", ++ "interfaceName":"eth-rt4", ++ "active":true, ++ "labels":[ ++ 16021, ++ 16031 ++ ] ++ } + ] + } + ], +@@ -128,6 +148,9 @@ + "active":true, + "backupIndex":[ + 0 ++ ], ++ "labels":[ ++ 3 + ] + } + ], diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step5/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step5/show_mpls_table.ref.diff new file mode 100644 index 0000000000..669c07e344 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step5/show_mpls_table.ref.diff @@ -0,0 +1,130 @@ +--- rt5/step4/show_mpls_table.ref 2020-09-25 17:49:01.159641924 -0300 ++++ rt5/step5/show_mpls_table.ref 2020-09-25 17:50:11.696561748 -0300 +@@ -69,6 +69,12 @@ + "type":"SR (IS-IS)", + "outLabel":16020, + "installed":true, ++ "nexthop":"10.0.6.4" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16020, ++ "installed":true, + "nexthop":"10.0.5.3" + }, + { +@@ -87,6 +93,12 @@ + "type":"SR (IS-IS)", + "outLabel":16021, + "installed":true, ++ "interface":"eth-rt4" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16021, ++ "installed":true, + "interface":"eth-rt3-2" + }, + { +@@ -105,13 +117,26 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.5.3" ++ "nexthop":"10.0.5.3", ++ "backupIndex":[ ++ 0 ++ ] + }, + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "nexthop":"10.0.4.3" ++ "nexthop":"10.0.4.3", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16020, ++ "nexthop":"10.0.6.4" + } + ] + }, +@@ -123,13 +148,70 @@ + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-rt3-2" ++ "interface":"eth-rt3-2", ++ "backupIndex":[ ++ 0 ++ ] + }, + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, +- "interface":"eth-rt3-1" ++ "interface":"eth-rt3-1", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16021, ++ "interface":"eth-rt4" ++ } ++ ] ++ }, ++ "16040":{ ++ "inLabel":16040, ++ "installed":true, ++ "nexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "installed":true, ++ "nexthop":"10.0.6.4", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "nexthop":"10.0.8.6" ++ } ++ ] ++ }, ++ "16041":{ ++ "inLabel":16041, ++ "installed":true, ++ "nexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "installed":true, ++ "interface":"eth-rt4", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "interface":"eth-rt6" + } + ] + }, diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step6/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step6/show_ip_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step6/show_ip_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step6/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step6/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step6/show_ipv6_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step6/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step6/show_mpls_table.ref.diff new file mode 100644 index 0000000000..a4f82cbf10 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step6/show_mpls_table.ref.diff @@ -0,0 +1,146 @@ +--- rt5/step5/show_mpls_table.ref 2020-09-25 17:50:11.696561748 -0300 ++++ rt5/step6/show_mpls_table.ref 2020-09-25 17:51:14.685383977 -0300 +@@ -1,6 +1,6 @@ + { +- "16010":{ +- "inLabel":16010, ++ "30010":{ ++ "inLabel":30010, + "installed":true, + "nexthops":[ + { +@@ -30,8 +30,8 @@ + } + ] + }, +- "16011":{ +- "inLabel":16011, ++ "30011":{ ++ "inLabel":30011, + "installed":true, + "nexthops":[ + { +@@ -61,56 +61,56 @@ + } + ] + }, +- "16020":{ +- "inLabel":16020, ++ "30020":{ ++ "inLabel":30020, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16020, + "installed":true, +- "nexthop":"10.0.6.4" ++ "nexthop":"10.0.5.3" + }, + { + "type":"SR (IS-IS)", + "outLabel":16020, + "installed":true, +- "nexthop":"10.0.5.3" ++ "nexthop":"10.0.4.3" + }, + { + "type":"SR (IS-IS)", + "outLabel":16020, + "installed":true, +- "nexthop":"10.0.4.3" ++ "nexthop":"10.0.6.4" + } + ] + }, +- "16021":{ +- "inLabel":16021, ++ "30021":{ ++ "inLabel":30021, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16021, + "installed":true, +- "interface":"eth-rt4" ++ "interface":"eth-rt3-2" + }, + { + "type":"SR (IS-IS)", + "outLabel":16021, + "installed":true, +- "interface":"eth-rt3-2" ++ "interface":"eth-rt3-1" + }, + { + "type":"SR (IS-IS)", + "outLabel":16021, + "installed":true, +- "interface":"eth-rt3-1" ++ "interface":"eth-rt4" + } + ] + }, +- "16030":{ +- "inLabel":16030, ++ "30030":{ ++ "inLabel":30030, + "installed":true, + "nexthops":[ + { +@@ -140,8 +140,8 @@ + } + ] + }, +- "16031":{ +- "inLabel":16031, ++ "30031":{ ++ "inLabel":30031, + "installed":true, + "nexthops":[ + { +@@ -171,8 +171,8 @@ + } + ] + }, +- "16040":{ +- "inLabel":16040, ++ "30040":{ ++ "inLabel":30040, + "installed":true, + "nexthops":[ + { +@@ -193,8 +193,8 @@ + } + ] + }, +- "16041":{ +- "inLabel":16041, ++ "30041":{ ++ "inLabel":30041, + "installed":true, + "nexthops":[ + { +@@ -215,8 +215,8 @@ + } + ] + }, +- "16060":{ +- "inLabel":16060, ++ "30060":{ ++ "inLabel":30060, + "installed":true, + "nexthops":[ + { +@@ -237,8 +237,8 @@ + } + ] + }, +- "16061":{ +- "inLabel":16061, ++ "30061":{ ++ "inLabel":30061, + "installed":true, + "nexthops":[ + { diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step7/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step7/show_ip_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step7/show_ip_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step7/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step7/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step7/show_ipv6_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step7/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step7/show_mpls_table.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step7/show_mpls_table.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step8/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step8/show_ip_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step8/show_ip_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step8/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step8/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step8/show_ipv6_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step8/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step8/show_mpls_table.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step8/show_mpls_table.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step9/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step9/show_ip_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step9/show_ip_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step9/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step9/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step9/show_ipv6_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt5/step9/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt5/step9/show_mpls_table.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/step9/show_mpls_table.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt5/zebra.conf b/tests/topotests/isis-tilfa-topo1/rt5/zebra.conf new file mode 100644 index 0000000000..4cfea1a59f --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt5/zebra.conf @@ -0,0 +1,28 @@ +log file zebra.log +! +hostname rt5 +! +debug zebra kernel +debug zebra packet +debug zebra mpls +! +interface lo + ip address 5.5.5.5/32 + ipv6 address 2001:db8:1000::5/128 +! +interface eth-rt3-1 + ip address 10.0.4.5/24 +! +interface eth-rt3-2 + ip address 10.0.5.5/24 +! +interface eth-rt4 + ip address 10.0.6.5/24 +! +interface eth-rt6 + ip address 10.0.8.5/24 +! +ip forwarding +! +line vty +! diff --git a/tests/topotests/isis-tilfa-topo1/rt6/isisd.conf b/tests/topotests/isis-tilfa-topo1/rt6/isisd.conf new file mode 100644 index 0000000000..db47622a10 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/isisd.conf @@ -0,0 +1,39 @@ +hostname rt6 +log file isisd.log +! +debug isis events +debug isis route-events +debug isis spf-events +debug isis sr-events +debug isis lsp-gen +! +interface lo + ip router isis 1 + ipv6 router isis 1 + isis passive +! +interface eth-rt4 + ip router isis 1 + ipv6 router isis 1 + isis network point-to-point + isis hello-multiplier 3 + isis fast-reroute ti-lfa +! +interface eth-rt5 + ip router isis 1 + ipv6 router isis 1 + isis network point-to-point + isis hello-multiplier 3 + isis fast-reroute ti-lfa +! +router isis 1 + net 49.0000.0000.0000.0006.00 + is-type level-1 + lsp-gen-interval 2 + topology ipv6-unicast + segment-routing on + segment-routing global-block 16000 23999 + segment-routing node-msd 8 + segment-routing prefix 6.6.6.6/32 index 60 + segment-routing prefix 2001:db8:1000::6/128 index 61 +! diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step1/show_ip_route.ref b/tests/topotests/isis-tilfa-topo1/rt6/step1/show_ip_route.ref new file mode 100644 index 0000000000..5bcef4c2f6 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step1/show_ip_route.ref @@ -0,0 +1,401 @@ +{ + "1.1.1.1\/32":[ + { + "prefix":"1.1.1.1\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":40, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16010 + ] + }, + { + "fib":true, + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16010 + ] + } + ] + } + ], + "2.2.2.2\/32":[ + { + "prefix":"2.2.2.2\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 16020 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true + } + ] + } + ], + "3.3.3.3\/32":[ + { + "prefix":"3.3.3.3\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 16030 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true + } + ] + } + ], + "4.4.4.4\/32":[ + { + "prefix":"4.4.4.4\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true + } + ] + } + ], + "5.5.5.5\/32":[ + { + "prefix":"5.5.5.5\/32", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true + } + ] + } + ], + "10.0.1.0\/24":[ + { + "prefix":"10.0.1.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true + }, + { + "fib":true, + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true + } + ] + } + ], + "10.0.2.0\/24":[ + { + "prefix":"10.0.2.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true, + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true + } + ] + } + ], + "10.0.3.0\/24":[ + { + "prefix":"10.0.3.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true, + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true + } + ] + } + ], + "10.0.4.0\/24":[ + { + "prefix":"10.0.4.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true, + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true + } + ] + } + ], + "10.0.5.0\/24":[ + { + "prefix":"10.0.5.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true, + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true + } + ] + } + ], + "10.0.6.0\/24":[ + { + "prefix":"10.0.6.0\/24", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true + }, + { + "fib":true, + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true + } + ] + } + ], + "10.0.7.0\/24":[ + { + "prefix":"10.0.7.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "active":true + } + ] + } + ], + "10.0.8.0\/24":[ + { + "prefix":"10.0.8.0\/24", + "protocol":"isis", + "distance":115, + "metric":20, + "nexthops":[ + { + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", + "active":true + } + ] + } + ] +} diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step1/show_ipv6_route.ref b/tests/topotests/isis-tilfa-topo1/rt6/step1/show_ipv6_route.ref new file mode 100644 index 0000000000..8294b07136 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step1/show_ipv6_route.ref @@ -0,0 +1,161 @@ +{ + "2001:db8:1000::1\/128":[ + { + "prefix":"2001:db8:1000::1\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":40, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5", + "active":true, + "labels":[ + 16011 + ] + }, + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4", + "active":true, + "labels":[ + 16011 + ] + } + ] + } + ], + "2001:db8:1000::2\/128":[ + { + "prefix":"2001:db8:1000::2\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 16021 + ] + } + ], + "backupNexthops":[ + { + "afi":"ipv6", + "interfaceName":"eth-rt5", + "active":true + } + ] + } + ], + "2001:db8:1000::3\/128":[ + { + "prefix":"2001:db8:1000::3\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":30, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 16031 + ] + } + ], + "backupNexthops":[ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", + "active":true + } + ] + } + ], + "2001:db8:1000::4\/128":[ + { + "prefix":"2001:db8:1000::4\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "afi":"ipv6", + "interfaceName":"eth-rt5", + "active":true + } + ] + } + ], + "2001:db8:1000::5\/128":[ + { + "prefix":"2001:db8:1000::5\/128", + "protocol":"isis", + "selected":true, + "destSelected":true, + "distance":115, + "metric":20, + "installed":true, + "nexthops":[ + { + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt5", + "active":true, + "backupIndex":[ + 0 + ], + "labels":[ + 3 + ] + } + ], + "backupNexthops":[ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", + "active":true + } + ] + } + ] +} diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step1/show_mpls_table.ref b/tests/topotests/isis-tilfa-topo1/rt6/step1/show_mpls_table.ref new file mode 100644 index 0000000000..33dbf59204 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step1/show_mpls_table.ref @@ -0,0 +1,214 @@ +{ + "16010":{ + "inLabel":16010, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16010, + "installed":true, + "nexthop":"10.0.7.4" + }, + { + "type":"SR (IS-IS)", + "outLabel":16010, + "installed":true, + "nexthop":"10.0.8.5" + } + ] + }, + "16011":{ + "inLabel":16011, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16011, + "installed":true, + "interface":"eth-rt4" + }, + { + "type":"SR (IS-IS)", + "outLabel":16011, + "installed":true, + "interface":"eth-rt5" + } + ] + }, + "16020":{ + "inLabel":16020, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16020, + "installed":true, + "nexthop":"10.0.7.4", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "nexthop":"10.0.8.5" + } + ] + }, + "16021":{ + "inLabel":16021, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16021, + "installed":true, + "interface":"eth-rt4", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "interface":"eth-rt5" + } + ] + }, + "16030":{ + "inLabel":16030, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16030, + "installed":true, + "nexthop":"10.0.8.5", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "nexthop":"10.0.7.4" + } + ] + }, + "16031":{ + "inLabel":16031, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":16031, + "installed":true, + "interface":"eth-rt5", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "interface":"eth-rt4" + } + ] + }, + "16040":{ + "inLabel":16040, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "nexthop":"10.0.7.4", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "nexthop":"10.0.8.5" + } + ] + }, + "16041":{ + "inLabel":16041, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "interface":"eth-rt4", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "interface":"eth-rt5" + } + ] + }, + "16050":{ + "inLabel":16050, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "nexthop":"10.0.8.5", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "nexthop":"10.0.7.4" + } + ] + }, + "16051":{ + "inLabel":16051, + "installed":true, + "nexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "installed":true, + "interface":"eth-rt5", + "backupIndex":[ + 0 + ] + } + ], + "backupNexthops":[ + { + "type":"SR (IS-IS)", + "outLabel":3, + "interface":"eth-rt4" + } + ] + } +} diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step1/show_yang_interface_isis_adjacencies.ref b/tests/topotests/isis-tilfa-topo1/rt6/step1/show_yang_interface_isis_adjacencies.ref new file mode 100644 index 0000000000..734832358f --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step1/show_yang_interface_isis_adjacencies.ref @@ -0,0 +1,44 @@ +{ + "frr-interface:lib": { + "interface": [ + { + "name": "eth-rt4", + "vrf": "default", + "state": { + "frr-isisd:isis": { + "adjacencies": { + "adjacency": [ + { + "neighbor-sys-type": "level-1", + "neighbor-sysid": "0000.0000.0004", + "hold-timer": 9, + "neighbor-priority": 0, + "state": "up" + } + ] + } + } + } + }, + { + "name": "eth-rt5", + "vrf": "default", + "state": { + "frr-isisd:isis": { + "adjacencies": { + "adjacency": [ + { + "neighbor-sys-type": "level-1", + "neighbor-sysid": "0000.0000.0005", + "hold-timer": 9, + "neighbor-priority": 0, + "state": "up" + } + ] + } + } + } + } + ] + } +} diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step2/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step2/show_ip_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step2/show_ip_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step2/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step2/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step2/show_ipv6_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step2/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step2/show_mpls_table.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step2/show_mpls_table.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step3/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step3/show_ip_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step3/show_ip_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step3/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step3/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step3/show_ipv6_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step3/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step3/show_mpls_table.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step3/show_mpls_table.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step4/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step4/show_ip_route.ref.diff new file mode 100644 index 0000000000..04adaefe78 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step4/show_ip_route.ref.diff @@ -0,0 +1,34 @@ +--- rt6/step3/show_ip_route.ref 2020-09-25 17:48:06.154925422 -0300 ++++ rt6/step4/show_ip_route.ref 2020-09-25 17:49:02.583660484 -0300 +@@ -14,10 +14,7 @@ + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16010 +- ] ++ "active":true + }, + { + "fib":true, +@@ -50,9 +47,6 @@ + "active":true, + "backupIndex":[ + 0 +- ], +- "labels":[ +- 16020 + ] + } + ], +@@ -118,9 +112,6 @@ + "active":true, + "backupIndex":[ + 0 +- ], +- "labels":[ +- 3 + ] + } + ], diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step4/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step4/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..20aa1ec83b --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step4/show_ipv6_route.ref.diff @@ -0,0 +1,34 @@ +--- rt6/step3/show_ipv6_route.ref 2020-09-25 17:48:07.434942087 -0300 ++++ rt6/step4/show_ipv6_route.ref 2020-09-25 17:49:03.847676958 -0300 +@@ -22,10 +22,7 @@ + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16011 +- ] ++ "active":true + } + ] + } +@@ -47,9 +44,6 @@ + "active":true, + "backupIndex":[ + 0 +- ], +- "labels":[ +- 16021 + ] + } + ], +@@ -111,9 +105,6 @@ + "active":true, + "backupIndex":[ + 0 +- ], +- "labels":[ +- 3 + ] + } + ], diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step4/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step4/show_mpls_table.ref.diff new file mode 100644 index 0000000000..3f24547f6d --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step4/show_mpls_table.ref.diff @@ -0,0 +1,79 @@ +--- rt6/step3/show_mpls_table.ref 2020-09-25 17:48:04.842908340 -0300 ++++ rt6/step4/show_mpls_table.ref 2020-09-25 17:49:01.363644584 -0300 +@@ -7,12 +7,6 @@ + "type":"SR (IS-IS)", + "outLabel":16010, + "installed":true, +- "nexthop":"10.0.7.4" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16010, +- "installed":true, + "nexthop":"10.0.8.5" + } + ] +@@ -25,12 +19,6 @@ + "type":"SR (IS-IS)", + "outLabel":16011, + "installed":true, +- "interface":"eth-rt4" +- }, +- { +- "type":"SR (IS-IS)", +- "outLabel":16011, +- "installed":true, + "interface":"eth-rt5" + } + ] +@@ -123,50 +111,6 @@ + } + ] + }, +- "16040":{ +- "inLabel":16040, +- "installed":true, +- "nexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "installed":true, +- "nexthop":"10.0.7.4", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "nexthop":"10.0.8.5" +- } +- ] +- }, +- "16041":{ +- "inLabel":16041, +- "installed":true, +- "nexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "installed":true, +- "interface":"eth-rt4", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "interface":"eth-rt5" +- } +- ] +- }, + "16050":{ + "inLabel":16050, + "installed":true, diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step5/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step5/show_ip_route.ref.diff new file mode 100644 index 0000000000..9f73a2904e --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step5/show_ip_route.ref.diff @@ -0,0 +1,34 @@ +--- rt6/step4/show_ip_route.ref 2020-09-25 17:49:02.583660484 -0300 ++++ rt6/step5/show_ip_route.ref 2020-09-25 17:50:13.220581632 -0300 +@@ -14,7 +14,10 @@ + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", +- "active":true ++ "active":true, ++ "labels":[ ++ 16010 ++ ] + }, + { + "fib":true, +@@ -47,6 +50,9 @@ + "active":true, + "backupIndex":[ + 0 ++ ], ++ "labels":[ ++ 16020 + ] + } + ], +@@ -112,6 +118,9 @@ + "active":true, + "backupIndex":[ + 0 ++ ], ++ "labels":[ ++ 3 + ] + } + ], diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step5/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step5/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..c9358d45b2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step5/show_ipv6_route.ref.diff @@ -0,0 +1,34 @@ +--- rt6/step4/show_ipv6_route.ref 2020-09-25 17:49:03.847676958 -0300 ++++ rt6/step5/show_ipv6_route.ref 2020-09-25 17:50:14.456597760 -0300 +@@ -22,7 +22,10 @@ + "fib":true, + "afi":"ipv6", + "interfaceName":"eth-rt4", +- "active":true ++ "active":true, ++ "labels":[ ++ 16011 ++ ] + } + ] + } +@@ -44,6 +47,9 @@ + "active":true, + "backupIndex":[ + 0 ++ ], ++ "labels":[ ++ 16021 + ] + } + ], +@@ -105,6 +111,9 @@ + "active":true, + "backupIndex":[ + 0 ++ ], ++ "labels":[ ++ 3 + ] + } + ], diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step5/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step5/show_mpls_table.ref.diff new file mode 100644 index 0000000000..c9d67955ef --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step5/show_mpls_table.ref.diff @@ -0,0 +1,79 @@ +--- rt6/step4/show_mpls_table.ref 2020-09-25 17:49:01.363644584 -0300 ++++ rt6/step5/show_mpls_table.ref 2020-09-25 17:50:11.904564461 -0300 +@@ -7,6 +7,12 @@ + "type":"SR (IS-IS)", + "outLabel":16010, + "installed":true, ++ "nexthop":"10.0.7.4" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16010, ++ "installed":true, + "nexthop":"10.0.8.5" + } + ] +@@ -19,6 +25,12 @@ + "type":"SR (IS-IS)", + "outLabel":16011, + "installed":true, ++ "interface":"eth-rt4" ++ }, ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":16011, ++ "installed":true, + "interface":"eth-rt5" + } + ] +@@ -111,6 +123,50 @@ + } + ] + }, ++ "16040":{ ++ "inLabel":16040, ++ "installed":true, ++ "nexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "installed":true, ++ "nexthop":"10.0.7.4", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "nexthop":"10.0.8.5" ++ } ++ ] ++ }, ++ "16041":{ ++ "inLabel":16041, ++ "installed":true, ++ "nexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "installed":true, ++ "interface":"eth-rt4", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "interface":"eth-rt5" ++ } ++ ] ++ }, + "16050":{ + "inLabel":16050, + "installed":true, diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step6/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step6/show_ip_route.ref.diff new file mode 100644 index 0000000000..527ec74958 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step6/show_ip_route.ref.diff @@ -0,0 +1,20 @@ +--- rt6/step5/show_ip_route.ref 2020-09-25 17:50:13.220581632 -0300 ++++ rt6/step6/show_ip_route.ref 2020-09-25 17:51:16.137402938 -0300 +@@ -26,7 +26,7 @@ + "interfaceName":"eth-rt5", + "active":true, + "labels":[ +- 16010 ++ 30010 + ] + } + ] +@@ -86,7 +86,7 @@ + 0 + ], + "labels":[ +- 16030 ++ 30030 + ] + } + ], diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step6/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step6/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..7b8f8022f2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step6/show_ipv6_route.ref.diff @@ -0,0 +1,20 @@ +--- rt6/step5/show_ipv6_route.ref 2020-09-25 17:50:14.456597760 -0300 ++++ rt6/step6/show_ipv6_route.ref 2020-09-25 17:51:17.401419446 -0300 +@@ -15,7 +15,7 @@ + "interfaceName":"eth-rt5", + "active":true, + "labels":[ +- 16011 ++ 30011 + ] + }, + { +@@ -81,7 +81,7 @@ + 0 + ], + "labels":[ +- 16031 ++ 30031 + ] + } + ], diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step6/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step6/show_mpls_table.ref.diff new file mode 100644 index 0000000000..edd5afeeb8 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step6/show_mpls_table.ref.diff @@ -0,0 +1,38 @@ +--- rt6/step5/show_mpls_table.ref 2020-09-25 17:50:11.904564461 -0300 ++++ rt6/step6/show_mpls_table.ref 2020-09-25 17:51:14.893386692 -0300 +@@ -11,7 +11,7 @@ + }, + { + "type":"SR (IS-IS)", +- "outLabel":16010, ++ "outLabel":30010, + "installed":true, + "nexthop":"10.0.8.5" + } +@@ -29,7 +29,7 @@ + }, + { + "type":"SR (IS-IS)", +- "outLabel":16011, ++ "outLabel":30011, + "installed":true, + "interface":"eth-rt5" + } +@@ -85,7 +85,7 @@ + "nexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16030, ++ "outLabel":30030, + "installed":true, + "nexthop":"10.0.8.5", + "backupIndex":[ +@@ -107,7 +107,7 @@ + "nexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16031, ++ "outLabel":30031, + "installed":true, + "interface":"eth-rt5", + "backupIndex":[ diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step7/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step7/show_ip_route.ref.diff new file mode 100644 index 0000000000..7553dd22e5 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step7/show_ip_route.ref.diff @@ -0,0 +1,12 @@ +--- rt6/step6/show_ip_route.ref 2020-09-25 17:51:16.137402938 -0300 ++++ rt6/step7/show_ip_route.ref 2020-09-25 17:52:03.018015363 -0300 +@@ -152,9 +152,6 @@ + "active":true, + "backupIndex":[ + 0 +- ], +- "labels":[ +- 3 + ] + } + ], diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step7/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step7/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..b56890de0f --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step7/show_ipv6_route.ref.diff @@ -0,0 +1,12 @@ +--- rt6/step6/show_ipv6_route.ref 2020-09-25 17:51:17.401419446 -0300 ++++ rt6/step7/show_ipv6_route.ref 2020-09-25 17:52:04.270031723 -0300 +@@ -143,9 +143,6 @@ + "active":true, + "backupIndex":[ + 0 +- ], +- "labels":[ +- 3 + ] + } + ], diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step7/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step7/show_mpls_table.ref.diff new file mode 100644 index 0000000000..ff043fb0bf --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step7/show_mpls_table.ref.diff @@ -0,0 +1,52 @@ +--- rt6/step6/show_mpls_table.ref 2020-09-25 17:51:14.893386692 -0300 ++++ rt6/step7/show_mpls_table.ref 2020-09-25 17:52:01.809999577 -0300 +@@ -166,49 +166,5 @@ + "interface":"eth-rt5" + } + ] +- }, +- "16050":{ +- "inLabel":16050, +- "installed":true, +- "nexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "installed":true, +- "nexthop":"10.0.8.5", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "nexthop":"10.0.7.4" +- } +- ] +- }, +- "16051":{ +- "inLabel":16051, +- "installed":true, +- "nexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "installed":true, +- "interface":"eth-rt5", +- "backupIndex":[ +- 0 +- ] +- } +- ], +- "backupNexthops":[ +- { +- "type":"SR (IS-IS)", +- "outLabel":3, +- "interface":"eth-rt4" +- } +- ] + } + } diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step8/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step8/show_ip_route.ref.diff new file mode 100644 index 0000000000..d0b25bffa3 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step8/show_ip_route.ref.diff @@ -0,0 +1,12 @@ +--- rt6/step7/show_ip_route.ref 2020-09-25 17:52:03.018015363 -0300 ++++ rt6/step8/show_ip_route.ref 2020-09-25 17:53:21.035035298 -0300 +@@ -152,6 +152,9 @@ + "active":true, + "backupIndex":[ + 0 ++ ], ++ "labels":[ ++ 3 + ] + } + ], diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step8/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step8/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..203175510c --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step8/show_ipv6_route.ref.diff @@ -0,0 +1,12 @@ +--- rt6/step7/show_ipv6_route.ref 2020-09-25 17:52:04.270031723 -0300 ++++ rt6/step8/show_ipv6_route.ref 2020-09-25 17:53:22.239051045 -0300 +@@ -143,6 +143,9 @@ + "active":true, + "backupIndex":[ + 0 ++ ], ++ "labels":[ ++ 3 + ] + } + ], diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step8/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step8/show_mpls_table.ref.diff new file mode 100644 index 0000000000..535f30bf35 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step8/show_mpls_table.ref.diff @@ -0,0 +1,52 @@ +--- rt6/step7/show_mpls_table.ref 2020-09-25 17:52:01.809999577 -0300 ++++ rt6/step8/show_mpls_table.ref 2020-09-25 17:53:19.799019132 -0300 +@@ -166,5 +166,49 @@ + "interface":"eth-rt5" + } + ] ++ }, ++ "16050":{ ++ "inLabel":16050, ++ "installed":true, ++ "nexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "installed":true, ++ "nexthop":"10.0.8.5", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "nexthop":"10.0.7.4" ++ } ++ ] ++ }, ++ "16051":{ ++ "inLabel":16051, ++ "installed":true, ++ "nexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "installed":true, ++ "interface":"eth-rt5", ++ "backupIndex":[ ++ 0 ++ ] ++ } ++ ], ++ "backupNexthops":[ ++ { ++ "type":"SR (IS-IS)", ++ "outLabel":3, ++ "interface":"eth-rt4" ++ } ++ ] + } + } diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step9/show_ip_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step9/show_ip_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step9/show_ip_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step9/show_ipv6_route.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step9/show_ipv6_route.ref.diff new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step9/show_ipv6_route.ref.diff diff --git a/tests/topotests/isis-tilfa-topo1/rt6/step9/show_mpls_table.ref.diff b/tests/topotests/isis-tilfa-topo1/rt6/step9/show_mpls_table.ref.diff new file mode 100644 index 0000000000..b6e5396554 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/step9/show_mpls_table.ref.diff @@ -0,0 +1,24 @@ +--- rt6/step8/show_mpls_table.ref 2020-09-25 17:53:19.799019132 -0300 ++++ rt6/step9/show_mpls_table.ref 2020-09-25 17:54:37.492035644 -0300 +@@ -167,8 +167,8 @@ + } + ] + }, +- "16050":{ +- "inLabel":16050, ++ "16500":{ ++ "inLabel":16500, + "installed":true, + "nexthops":[ + { +@@ -189,8 +189,8 @@ + } + ] + }, +- "16051":{ +- "inLabel":16051, ++ "16501":{ ++ "inLabel":16501, + "installed":true, + "nexthops":[ + { diff --git a/tests/topotests/isis-tilfa-topo1/rt6/zebra.conf b/tests/topotests/isis-tilfa-topo1/rt6/zebra.conf new file mode 100644 index 0000000000..6084010a93 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/rt6/zebra.conf @@ -0,0 +1,22 @@ +log file zebra.log +! +hostname rt6 +! +debug zebra kernel +debug zebra packet +debug zebra mpls +! +interface lo + ip address 6.6.6.6/32 + ipv6 address 2001:db8:1000::6/128 +! +interface eth-rt4 + ip address 10.0.7.6/24 +! +interface eth-rt5 + ip address 10.0.8.6/24 +! +ip forwarding +! +line vty +! diff --git a/tests/topotests/isis-tilfa-topo1/test_isis_tilfa_topo1.py b/tests/topotests/isis-tilfa-topo1/test_isis_tilfa_topo1.py new file mode 100755 index 0000000000..6bc097b0e7 --- /dev/null +++ b/tests/topotests/isis-tilfa-topo1/test_isis_tilfa_topo1.py @@ -0,0 +1,674 @@ +#!/usr/bin/env python + +# +# test_isis_tilfa_topo1.py +# Part of NetDEF Topology Tests +# +# Copyright (c) 2020 by +# Network Device Education Foundation, Inc. ("NetDEF") +# +# Permission to use, copy, modify, and/or distribute this software +# for any purpose with or without fee is hereby granted, provided +# that the above copyright notice and this permission notice appear +# in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY +# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS +# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. +# + +""" +test_isis_tilfa_topo1.py: + + +---------+ + | | + | RT1 | + | 1.1.1.1 | + | | + +---------+ + |eth-sw1 + | + | + | + +---------+ | +---------+ + | | | | | + | RT2 |eth-sw1 | eth-sw1| RT3 | + | 2.2.2.2 +----------+----------+ 3.3.3.3 | + | | 10.0.1.0/24 | | + +---------+ +---------+ + eth-rt4-1| |eth-rt4-2 eth-rt5-1| |eth-rt5-2 + | | | | + 10.0.2.0/24| |10.0.3.0/24 10.0.4.0/24| |10.0.5.0/24 + | | | | + eth-rt2-1| |eth-rt2-2 eth-rt3-1| |eth-rt3-2 + +---------+ +---------+ + | | | | + | RT4 | 10.0.6.0/24 | RT5 | + | 4.4.4.4 +---------------------+ 5.5.5.5 | + | |eth-rt5 eth-rt4| | + +---------+ +---------+ + eth-rt6| |eth-rt6 + | | + 10.0.7.0/24| |10.0.8.0/24 + | +---------+ | + | | | | + | | RT6 | | + +----------+ 6.6.6.6 +-----------+ + eth-rt4| |eth-rt5 + +---------+ +""" + +import os +import sys +import pytest +import json +import re +import tempfile +from time import sleep +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 + +# Required to instantiate the topology builder class. +from mininet.topo import Topo + +# Global multi-dimensional dictionary containing all expected outputs +outputs = {} + +class TemplateTopo(Topo): + "Test topology builder" + def build(self, *_args, **_opts): + "Build function" + tgen = get_topogen(self) + + # + # Define FRR Routers + # + for router in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + tgen.add_router(router) + + # + # Define connections + # + switch = tgen.add_switch('s1') + switch.add_link(tgen.gears['rt1'], nodeif="eth-sw1") + switch.add_link(tgen.gears['rt2'], nodeif="eth-sw1") + switch.add_link(tgen.gears['rt3'], nodeif="eth-sw1") + + switch = tgen.add_switch('s2') + switch.add_link(tgen.gears['rt2'], nodeif="eth-rt4-1") + switch.add_link(tgen.gears['rt4'], nodeif="eth-rt2-1") + + switch = tgen.add_switch('s3') + switch.add_link(tgen.gears['rt2'], nodeif="eth-rt4-2") + switch.add_link(tgen.gears['rt4'], nodeif="eth-rt2-2") + + switch = tgen.add_switch('s4') + switch.add_link(tgen.gears['rt3'], nodeif="eth-rt5-1") + switch.add_link(tgen.gears['rt5'], nodeif="eth-rt3-1") + + switch = tgen.add_switch('s5') + switch.add_link(tgen.gears['rt3'], nodeif="eth-rt5-2") + switch.add_link(tgen.gears['rt5'], nodeif="eth-rt3-2") + + switch = tgen.add_switch('s6') + switch.add_link(tgen.gears['rt4'], nodeif="eth-rt5") + switch.add_link(tgen.gears['rt5'], nodeif="eth-rt4") + + switch = tgen.add_switch('s7') + switch.add_link(tgen.gears['rt4'], nodeif="eth-rt6") + switch.add_link(tgen.gears['rt6'], nodeif="eth-rt4") + + switch = tgen.add_switch('s8') + switch.add_link(tgen.gears['rt5'], nodeif="eth-rt6") + switch.add_link(tgen.gears['rt6'], nodeif="eth-rt5") + + # + # Populate multi-dimensional dictionary containing all expected outputs + # + files = ["show_ip_route.ref", + "show_ipv6_route.ref", + "show_mpls_table.ref", + "show_yang_interface_isis_adjacencies.ref"] + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + outputs[rname] = {} + for step in range(1, 9 + 1): + outputs[rname][step] = {} + for file in files: + if step == 1: + # Get snapshots relative to the expected initial network convergence + filename = '{}/{}/step{}/{}'.format(CWD, rname, step, file) + outputs[rname][step][file] = open(filename).read() + else: + if file == "show_yang_interface_isis_adjacencies.ref": + continue + + # Get diff relative to the previous step + filename = '{}/{}/step{}/{}.diff'.format(CWD, rname, step, file) + + # Create temporary files in order to apply the diff + f_in = tempfile.NamedTemporaryFile() + f_in.write(outputs[rname][step - 1][file]) + f_in.flush() + f_out = tempfile.NamedTemporaryFile() + os.system("patch -s -o %s %s %s" %(f_out.name, f_in.name, filename)) + + # Store the updated snapshot and remove the temporary files + outputs[rname][step][file] = open(f_out.name).read() + f_in.close() + f_out.close() + +def setup_module(mod): + "Sets up the pytest environment" + tgen = Topogen(TemplateTopo, mod.__name__) + tgen.start_topology() + + router_list = tgen.routers() + + # For all registered routers, load the zebra configuration file + for rname, router in router_list.iteritems(): + 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() + + # This function tears down the whole topology. + tgen.stop_topology() + +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 + +# +# Step 1 +# +# Test initial network convergence +# +def test_isis_adjacencies_step1(): + logger.info("Test (step 1): check IS-IS adjacencies") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show yang operational-data /frr-interface:lib isisd", + outputs[rname][1]["show_yang_interface_isis_adjacencies.ref"]) + +def test_rib_ipv4_step1(): + logger.info("Test (step 1): verify IPv4 RIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show ip route isis json", + outputs[rname][1]["show_ip_route.ref"]) + +def test_rib_ipv6_step1(): + logger.info("Test (step 1): verify IPv6 RIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show ipv6 route isis json", + outputs[rname][1]["show_ipv6_route.ref"]) + +def test_mpls_lib_step1(): + logger.info("Test (step 1): verify MPLS LIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show mpls table json", + outputs[rname][1]["show_mpls_table.ref"]) + +# +# Step 2 +# +# Action(s): +# -Disable TI-LFA link protection on rt2's eth-sw1 interface +# +# Expected changes: +# -rt2 should uninstall the backup nexthops from destinations reachable over eth-sw1. +# +def test_rib_ipv4_step2(): + logger.info("Test (step 2): verify IPv4 RIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + logger.info('Disabling TI-LFA link protection on rt2\'s eth-sw1 interface') + tgen.net['rt2'].cmd('vtysh -c "conf t" -c "interface eth-sw1" -c "no isis fast-reroute ti-lfa"') + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show ip route isis json", + outputs[rname][2]["show_ip_route.ref"]) + +def test_rib_ipv6_step2(): + logger.info("Test (step 2): verify IPv6 RIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show ipv6 route isis json", + outputs[rname][2]["show_ipv6_route.ref"]) + +def test_mpls_lib_step2(): + logger.info("Test (step 2): verify MPLS LIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show mpls table json", + outputs[rname][2]["show_mpls_table.ref"]) + +# +# Step 3 +# +# Action(s): +# -Enable TI-LFA link protection on rt2's eth-sw1 interface +# +# Expected changes: +# -rt2 should install backup nexthops for destinations reachable over eth-sw1. +# +def test_rib_ipv4_step3(): + logger.info("Test (step 3): verify IPv4 RIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + logger.info('Enabling TI-LFA link protection on rt2\'s eth-sw1 interface') + tgen.net['rt2'].cmd('vtysh -c "conf t" -c "interface eth-sw1" -c "isis fast-reroute ti-lfa"') + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show ip route isis json", + outputs[rname][3]["show_ip_route.ref"]) + +def test_rib_ipv6_step3(): + logger.info("Test (step 3): verify IPv6 RIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show ipv6 route isis json", + outputs[rname][3]["show_ipv6_route.ref"]) + +def test_mpls_lib_step3(): + logger.info("Test (step 3): verify MPLS LIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show mpls table json", + outputs[rname][3]["show_mpls_table.ref"]) + +# +# Step 4 +# +# Action(s): +# -Disable SR on rt4 +# +# Expected changes: +# -rt4 should uninstall all Prefix-SIDs from the network +# -rt4 should uninstall all TI-LFA backup nexthops +# -All routers should uninstall rt4's Prefix-SIDs +# -All routers should uninstall all SR labels for destinations whose nexthop is rt4 +# -All routers should uninstall all TI-LFA backup nexthops that point to rt4 +# -All routers should uninstall all TI-LFA backup nexthops that use rt4's Prefix-SIDs +# +def test_rib_ipv4_step4(): + logger.info("Test (step 4): verify IPv4 RIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + logger.info('Disabling SR on rt4') + tgen.net['rt4'].cmd('vtysh -c "conf t" -c "router isis 1" -c "no segment-routing on"') + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show ip route isis json", + outputs[rname][4]["show_ip_route.ref"]) + +def test_rib_ipv6_step4(): + logger.info("Test (step 4): verify IPv6 RIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show ipv6 route isis json", + outputs[rname][4]["show_ipv6_route.ref"]) + +def test_mpls_lib_step4(): + logger.info("Test (step 4): verify MPLS LIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show mpls table json", + outputs[rname][4]["show_mpls_table.ref"]) + +# +# Step 5 +# +# Action(s): +# -Enable SR on rt4 +# +# Expected changes: +# -Reverse all changes done on the previous step +# +def test_rib_ipv4_step5(): + logger.info("Test (step 5): verify IPv4 RIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + logger.info('Enabling SR on rt4') + tgen.net['rt4'].cmd('vtysh -c "conf t" -c "router isis 1" -c "segment-routing on"') + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show ip route isis json", + outputs[rname][5]["show_ip_route.ref"]) + +def test_rib_ipv6_step5(): + logger.info("Test (step 5): verify IPv6 RIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show ipv6 route isis json", + outputs[rname][5]["show_ipv6_route.ref"]) + +def test_mpls_lib_step5(): + logger.info("Test (step 5): verify MPLS LIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show mpls table json", + outputs[rname][5]["show_mpls_table.ref"]) + +# +# Step 6 +# +# Action(s): +# -Change rt5's SRGB +# +# Expected changes: +# -All routers should update all SR labels for destinations whose primary or backup nexthop is rt5 +# +def test_rib_ipv4_step6(): + logger.info("Test (step 6): verify IPv4 RIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + logger.info('Changing rt5\'s SRGB') + tgen.net['rt5'].cmd('vtysh -c "conf t" -c "router isis 1" -c "segment-routing global-block 30000 37999"') + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show ip route isis json", + outputs[rname][6]["show_ip_route.ref"]) + +def test_rib_ipv6_step6(): + logger.info("Test (step 6): verify IPv6 RIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show ipv6 route isis json", + outputs[rname][6]["show_ipv6_route.ref"]) + +def test_mpls_lib_step6(): + logger.info("Test (step 6): verify MPLS LIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show mpls table json", + outputs[rname][6]["show_mpls_table.ref"]) + +# +# Step 7 +# +# Action(s): +# -Delete rt5's Prefix-SIDs +# +# Expected changes: +# -All routers should uninstall rt5's Prefix-SIDs +# -All routers should uninstall all TI-LFA backup nexthops that use rt5's Prefix-SIDs +# +def test_rib_ipv4_step7(): + logger.info("Test (step 7): verify IPv4 RIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + logger.info('Deleting rt5\'s Prefix-SIDs') + tgen.net['rt5'].cmd('vtysh -c "conf t" -c "router isis 1" -c "no segment-routing prefix 5.5.5.5/32 index 50"') + tgen.net['rt5'].cmd('vtysh -c "conf t" -c "router isis 1" -c "no segment-routing prefix 2001:db8:1000::5/128 index 51"') + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show ip route isis json", + outputs[rname][7]["show_ip_route.ref"]) + +def test_rib_ipv6_step7(): + logger.info("Test (step 7): verify IPv6 RIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show ipv6 route isis json", + outputs[rname][7]["show_ipv6_route.ref"]) + +def test_mpls_lib_step7(): + logger.info("Test (step 7): verify MPLS LIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show mpls table json", + outputs[rname][7]["show_mpls_table.ref"]) + +# +# Step 8 +# +# Action(s): +# -Re-add rt5's Prefix-SIDs +# +# Expected changes: +# -Reverse all changes done on the previous step +# +def test_rib_ipv4_step8(): + logger.info("Test (step 8): verify IPv4 RIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + logger.info('Re-adding rt5\'s Prefix-SIDs') + tgen.net['rt5'].cmd('vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 5.5.5.5/32 index 50"') + tgen.net['rt5'].cmd('vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 2001:db8:1000::5/128 index 51"') + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show ip route isis json", + outputs[rname][8]["show_ip_route.ref"]) + +def test_rib_ipv6_step8(): + logger.info("Test (step 8): verify IPv6 RIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show ipv6 route isis json", + outputs[rname][8]["show_ipv6_route.ref"]) + +def test_mpls_lib_step8(): + logger.info("Test (step 8): verify MPLS LIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show mpls table json", + outputs[rname][8]["show_mpls_table.ref"]) + +# +# Step 9 +# +# Action(s): +# -Change rt5's Prefix-SIDs +# +# Expected changes: +# -All routers should update rt5's Prefix-SIDs +# -All routers should update all TI-LFA backup nexthops that use rt5's Prefix-SIDs +# +def test_rib_ipv4_step9(): + logger.info("Test (step 9): verify IPv4 RIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + logger.info('Re-adding rt5\'s Prefix-SIDs') + tgen.net['rt5'].cmd('vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 5.5.5.5/32 index 500"') + tgen.net['rt5'].cmd('vtysh -c "conf t" -c "router isis 1" -c "segment-routing prefix 2001:db8:1000::5/128 index 501"') + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show ip route isis json", + outputs[rname][9]["show_ip_route.ref"]) + +def test_rib_ipv6_step9(): + logger.info("Test (step 9): verify IPv6 RIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show ipv6 route isis json", + outputs[rname][9]["show_ipv6_route.ref"]) + +def test_mpls_lib_step9(): + logger.info("Test (step 9): verify MPLS LIB") + tgen = get_topogen() + + # Skip if previous fatal error condition is raised + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + for rname in ['rt1', 'rt2', 'rt3', 'rt4', 'rt5', 'rt6']: + router_compare_json_output(rname, "show mpls table json", + outputs[rname][9]["show_mpls_table.ref"]) + +# Memory leak test template +def test_memory_leak(): + "Run the memory leak test and report results." + tgen = get_topogen() + if not tgen.is_memleak_enabled(): + pytest.skip('Memory leak test/report is disabled') + + tgen.report_memory_leaks() + +if __name__ == '__main__': + args = ["-s"] + sys.argv[1:] + sys.exit(pytest.main(args)) diff --git a/tests/topotests/isis-topo1-vrf/r1/isisd.conf b/tests/topotests/isis-topo1-vrf/r1/isisd.conf index 4ac4597015..5fb4c14d0b 100755 --- a/tests/topotests/isis-topo1-vrf/r1/isisd.conf +++ b/tests/topotests/isis-topo1-vrf/r1/isisd.conf @@ -8,6 +8,7 @@ interface r1-eth0 isis circuit-type level-2-only ! router isis 1 vrf r1-cust1 + lsp-gen-interval 2 net 10.0000.0000.0000.0000.0000.0000.0000.0000.0000.00 metric-style wide redistribute ipv4 connected level-2 diff --git a/tests/topotests/isis-topo1-vrf/r1/r1_route.json b/tests/topotests/isis-topo1-vrf/r1/r1_route.json index 77d2ad9c63..f0a3593a4c 100644 --- a/tests/topotests/isis-topo1-vrf/r1/r1_route.json +++ b/tests/topotests/isis-topo1-vrf/r1/r1_route.json @@ -20,20 +20,6 @@ ], "10.0.20.0/24": [ { - "distance": 115, - "metric": 20, - "nexthops": [ - { - "afi": "ipv4", - "interfaceName": "r1-eth0", - "ip": "10.0.20.1" - } - ], - "prefix": "10.0.20.0/24", - "protocol": "isis", - "vrfName": "r1-cust1" - }, - { "nexthops": [ { "active": true, diff --git a/tests/topotests/isis-topo1-vrf/r2/isisd.conf b/tests/topotests/isis-topo1-vrf/r2/isisd.conf index 4c68540265..0d2bc7ab72 100755 --- a/tests/topotests/isis-topo1-vrf/r2/isisd.conf +++ b/tests/topotests/isis-topo1-vrf/r2/isisd.conf @@ -8,6 +8,7 @@ interface r2-eth0 isis circuit-type level-2-only ! router isis 1 vrf r2-cust1 + lsp-gen-interval 2 net 10.0000.0000.0000.0000.0000.0000.0000.0000.0001.00 metric-style wide redistribute ipv4 connected level-2 diff --git a/tests/topotests/isis-topo1-vrf/r2/r2_route.json b/tests/topotests/isis-topo1-vrf/r2/r2_route.json index 98252c5939..a26cdfad8e 100644 --- a/tests/topotests/isis-topo1-vrf/r2/r2_route.json +++ b/tests/topotests/isis-topo1-vrf/r2/r2_route.json @@ -20,20 +20,6 @@ ], "10.0.21.0/24": [ { - "distance": 115, - "metric": 20, - "nexthops": [ - { - "afi": "ipv4", - "interfaceName": "r2-eth0", - "ip": "10.0.21.1" - } - ], - "prefix": "10.0.21.0/24", - "protocol": "isis", - "vrfName": "r2-cust1" - }, - { "nexthops": [ { "active": true, diff --git a/tests/topotests/isis-topo1-vrf/r3/isisd.conf b/tests/topotests/isis-topo1-vrf/r3/isisd.conf index ca01876690..66092407ab 100755 --- a/tests/topotests/isis-topo1-vrf/r3/isisd.conf +++ b/tests/topotests/isis-topo1-vrf/r3/isisd.conf @@ -13,6 +13,7 @@ interface r3-eth1 isis circuit-type level-1 ! router isis 1 vrf r3-cust1 + lsp-gen-interval 2 net 10.0000.0000.0000.0000.0000.0000.0000.0000.0002.00 metric-style wide redistribute ipv4 connected level-1 diff --git a/tests/topotests/isis-topo1-vrf/r3/r3_route.json b/tests/topotests/isis-topo1-vrf/r3/r3_route.json index de158876f1..9717df5c1a 100644 --- a/tests/topotests/isis-topo1-vrf/r3/r3_route.json +++ b/tests/topotests/isis-topo1-vrf/r3/r3_route.json @@ -50,20 +50,6 @@ ], "10.0.20.0/24": [ { - "distance": 115, - "metric": 20, - "nexthops": [ - { - "afi": "ipv4", - "interfaceName": "r3-eth0", - "ip": "10.0.20.2" - } - ], - "prefix": "10.0.20.0/24", - "protocol": "isis", - "vrfName": "r3-cust1" - }, - { "nexthops": [ { "active": true, diff --git a/tests/topotests/isis-topo1-vrf/r3/r3_route6.json b/tests/topotests/isis-topo1-vrf/r3/r3_route6.json index b100d3440a..31a1e4620f 100644 --- a/tests/topotests/isis-topo1-vrf/r3/r3_route6.json +++ b/tests/topotests/isis-topo1-vrf/r3/r3_route6.json @@ -12,7 +12,6 @@ "prefix": "2001:db8:1:1::/64", "protocol": "connected", "selected": true, - "vrfId": 4, "vrfName": "r3-cust1" } ], @@ -31,7 +30,6 @@ "prefix": "2001:db8:1:2::/64", "protocol": "isis", "selected": true, - "vrfId": 4, "vrfName": "r3-cust1" } ], @@ -48,7 +46,6 @@ "prefix": "2001:db8:2:1::/64", "protocol": "connected", "selected": true, - "vrfId": 4, "vrfName": "r3-cust1" } ], @@ -67,7 +64,6 @@ "prefix": "2001:db8:2:2::/64", "protocol": "isis", "selected": true, - "vrfId": 4, "vrfName": "r3-cust1" } ] diff --git a/tests/topotests/isis-topo1-vrf/r4/isisd.conf b/tests/topotests/isis-topo1-vrf/r4/isisd.conf index 74b1603d85..05815e8418 100755 --- a/tests/topotests/isis-topo1-vrf/r4/isisd.conf +++ b/tests/topotests/isis-topo1-vrf/r4/isisd.conf @@ -16,6 +16,7 @@ interface r4-eth1 isis circuit-type level-1 ! router isis 1 vrf r4-cust1 + lsp-gen-interval 2 net 10.0000.0000.0000.0000.0000.0000.0000.0000.0004.00 metric-style wide redistribute ipv4 connected level-1 diff --git a/tests/topotests/isis-topo1-vrf/r4/r4_route.json b/tests/topotests/isis-topo1-vrf/r4/r4_route.json index b3ed4f2cbe..6cb79b0301 100644 --- a/tests/topotests/isis-topo1-vrf/r4/r4_route.json +++ b/tests/topotests/isis-topo1-vrf/r4/r4_route.json @@ -66,18 +66,6 @@ { "nexthops": [ { - "afi": "ipv4", - "interfaceName": "r4-eth0", - "ip": "10.0.21.2" - } - ], - "prefix": "10.0.21.0/24", - "protocol": "isis", - "vrfName": "r4-cust1" - }, - { - "nexthops": [ - { "active": true, "directlyConnected": true, "fib": true, diff --git a/tests/topotests/isis-topo1-vrf/r5/isisd.conf b/tests/topotests/isis-topo1-vrf/r5/isisd.conf index 9e9b030455..f663c33fe9 100755 --- a/tests/topotests/isis-topo1-vrf/r5/isisd.conf +++ b/tests/topotests/isis-topo1-vrf/r5/isisd.conf @@ -13,6 +13,7 @@ interface r5-eth1 isis circuit-type level-1 ! router isis 1 vrf r5-cust1 + lsp-gen-interval 2 net 10.0000.0000.0000.0000.0000.0000.0000.0000.0005.00 metric-style wide is-type level-1 diff --git a/tests/topotests/isis-topo1-vrf/test_isis_topo1_vrf.py b/tests/topotests/isis-topo1-vrf/test_isis_topo1_vrf.py index 7943b94189..12121e4ddf 100644 --- a/tests/topotests/isis-topo1-vrf/test_isis_topo1_vrf.py +++ b/tests/topotests/isis-topo1-vrf/test_isis_topo1_vrf.py @@ -82,6 +82,7 @@ class ISISTopo1(Topo): sw.add_link(tgen.gears["r4"]) sw.add_link(tgen.gears["r5"]) + def setup_module(mod): "Sets up the pytest environment" tgen = Topogen(ISISTopo1, mod.__name__) @@ -129,16 +130,14 @@ def setup_module(mod): for rname, router in tgen.routers().items(): router.load_config( - TopoRouter.RD_ZEBRA, - os.path.join(CWD, "{}/zebra.conf".format(rname)) + 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)) + TopoRouter.RD_ISIS, os.path.join(CWD, "{}/isisd.conf".format(rname)) ) # After loading the configurations, this function loads configured daemons. tgen.start_router() - + has_version_20 = False for router in tgen.routers().values(): if router.has_version("<", "4"): @@ -148,6 +147,7 @@ def setup_module(mod): logger.info("Skipping ISIS vrf tests for FRR 2.0") tgen.set_error("ISIS has convergence problems with IPv6") + def teardown_module(mod): "Teardown the pytest environment" tgen = get_topogen() @@ -155,6 +155,7 @@ def teardown_module(mod): # delete rx-vrf tgen.stop_topology() + def test_isis_convergence(): "Wait for the protocol to converge before starting to test" tgen = get_topogen() @@ -163,10 +164,11 @@ def test_isis_convergence(): pytest.skip(tgen.errors) logger.info("waiting for ISIS protocol to converge") - + for rname, router in tgen.routers().items(): filename = "{0}/{1}/{1}_topology.json".format(CWD, rname) expected = json.loads(open(filename).read()) + def compare_isis_topology(router, expected): "Helper function to test ISIS vrf topology convergence." actual = show_isis_topology(router) @@ -177,6 +179,7 @@ def test_isis_convergence(): (result, diff) = topotest.run_and_expect(test_func, None, wait=0.5, count=120) assert result, "ISIS did not converge on {}:\n{}".format(rname, diff) + def test_isis_route_installation(): "Check whether all expected routes are present" tgen = get_topogen() @@ -189,7 +192,9 @@ def test_isis_route_installation(): for rname, router in tgen.routers().items(): filename = "{0}/{1}/{1}_route.json".format(CWD, rname) expected = json.loads(open(filename, "r").read()) - actual = router.vtysh_cmd("show ip route vrf {0}-cust1 json".format(rname) , isjson=True) + actual = router.vtysh_cmd( + "show ip route vrf {0}-cust1 json".format(rname), isjson=True + ) # Older FRR versions don't list interfaces in some ISIS routes if router.has_version("<", "3.1"): for network, routes in expected.items(): @@ -209,7 +214,7 @@ def test_isis_linux_route_installation(): dist = platform.dist() - if (dist[1] == "16.04"): + if dist[1] == "16.04": pytest.skip("Kernel not supported for vrf") "Check whether all expected routes are present and installed in the OS" @@ -234,6 +239,7 @@ def test_isis_linux_route_installation(): assertmsg = "Router '{}' OS routes mismatch".format(rname) assert topotest.json_cmp(actual, expected) is None, assertmsg + def test_isis_route6_installation(): "Check whether all expected routes are present" tgen = get_topogen() @@ -246,7 +252,9 @@ def test_isis_route6_installation(): for rname, router in tgen.routers().items(): filename = "{0}/{1}/{1}_route6.json".format(CWD, rname) expected = json.loads(open(filename, "r").read()) - actual = router.vtysh_cmd("show ipv6 route vrf {}-cust1 json".format(rname) , isjson=True) + actual = router.vtysh_cmd( + "show ipv6 route vrf {}-cust1 json".format(rname), isjson=True + ) # Older FRR versions don't list interfaces in some ISIS routes if router.has_version("<", "3.1"): @@ -262,11 +270,12 @@ def test_isis_route6_installation(): assertmsg = "Router '{}' routes mismatch".format(rname) assert topotest.json_cmp(actual, expected) is None, assertmsg + def test_isis_linux_route6_installation(): dist = platform.dist() - if (dist[1] == "16.04"): + if dist[1] == "16.04": pytest.skip("Kernel not supported for vrf") "Check whether all expected routes are present and installed in the OS" @@ -291,6 +300,7 @@ def test_isis_linux_route6_installation(): assertmsg = "Router '{}' OS routes mismatch".format(rname) assert topotest.json_cmp(actual, expected) is None, assertmsg + def test_memory_leak(): "Run the memory leak test and report results." tgen = get_topogen() @@ -452,4 +462,3 @@ def show_isis_topology(router): dict_merge(l1, l2) return l1 - diff --git a/tests/topotests/isis-topo1/r1/isisd.conf b/tests/topotests/isis-topo1/r1/isisd.conf index ee7dba3692..4e3761e5a1 100644 --- a/tests/topotests/isis-topo1/r1/isisd.conf +++ b/tests/topotests/isis-topo1/r1/isisd.conf @@ -4,10 +4,12 @@ debug isis events debug isis update-packets interface r1-eth0 ip router isis 1 + isis hello-interval 2 ipv6 router isis 1 isis circuit-type level-2-only ! router isis 1 + lsp-gen-interval 2 net 10.0000.0000.0000.0000.0000.0000.0000.0000.0000.00 metric-style wide redistribute ipv4 connected level-2 diff --git a/tests/topotests/isis-topo1/r1/r1_route.json b/tests/topotests/isis-topo1/r1/r1_route.json index 123b4dd163..f94233a80f 100644 --- a/tests/topotests/isis-topo1/r1/r1_route.json +++ b/tests/topotests/isis-topo1/r1/r1_route.json @@ -19,19 +19,6 @@ ], "10.0.20.0/24": [ { - "distance": 115, - "metric": 10, - "nexthops": [ - { - "afi": "ipv4", - "interfaceName": "r1-eth0", - "ip": "10.0.20.1" - } - ], - "prefix": "10.0.20.0/24", - "protocol": "isis" - }, - { "nexthops": [ { "active": true, diff --git a/tests/topotests/isis-topo1/r2/isisd.conf b/tests/topotests/isis-topo1/r2/isisd.conf index f6fee6c845..14db0940ec 100644 --- a/tests/topotests/isis-topo1/r2/isisd.conf +++ b/tests/topotests/isis-topo1/r2/isisd.conf @@ -4,10 +4,12 @@ debug isis events debug isis update-packets interface r2-eth0 ip router isis 1 + isis hello-interval 2 ipv6 router isis 1 isis circuit-type level-2-only ! router isis 1 + lsp-gen-interval 2 net 10.0000.0000.0000.0000.0000.0000.0000.0000.0001.00 metric-style wide redistribute ipv4 connected level-2 diff --git a/tests/topotests/isis-topo1/r2/r2_route.json b/tests/topotests/isis-topo1/r2/r2_route.json index fe2de05734..aab651eff0 100644 --- a/tests/topotests/isis-topo1/r2/r2_route.json +++ b/tests/topotests/isis-topo1/r2/r2_route.json @@ -19,19 +19,6 @@ ], "10.0.21.0/24": [ { - "distance": 115, - "metric": 10, - "nexthops": [ - { - "afi": "ipv4", - "interfaceName": "r2-eth0", - "ip": "10.0.21.1" - } - ], - "prefix": "10.0.21.0/24", - "protocol": "isis" - }, - { "nexthops": [ { "active": true, diff --git a/tests/topotests/isis-topo1/r3/isisd.conf b/tests/topotests/isis-topo1/r3/isisd.conf index 4ae56b4af4..6f36c0fa36 100644 --- a/tests/topotests/isis-topo1/r3/isisd.conf +++ b/tests/topotests/isis-topo1/r3/isisd.conf @@ -4,6 +4,7 @@ debug isis events debug isis update-packets interface r3-eth0 ip router isis 1 + isis hello-interval 2 ipv6 router isis 1 isis circuit-type level-2-only ! @@ -13,6 +14,7 @@ interface r3-eth1 isis circuit-type level-1 ! router isis 1 + lsp-gen-interval 2 net 10.0000.0000.0000.0000.0000.0000.0000.0000.0002.00 metric-style wide redistribute ipv4 connected level-1 diff --git a/tests/topotests/isis-topo1/r3/r3_route.json b/tests/topotests/isis-topo1/r3/r3_route.json index 1f0fcdfcd6..61d05e80bb 100644 --- a/tests/topotests/isis-topo1/r3/r3_route.json +++ b/tests/topotests/isis-topo1/r3/r3_route.json @@ -47,19 +47,6 @@ ], "10.0.20.0/24": [ { - "distance": 115, - "metric": 10, - "nexthops": [ - { - "afi": "ipv4", - "interfaceName": "r3-eth0", - "ip": "10.0.20.2" - } - ], - "prefix": "10.0.20.0/24", - "protocol": "isis" - }, - { "nexthops": [ { "active": true, diff --git a/tests/topotests/isis-topo1/r4/isisd.conf b/tests/topotests/isis-topo1/r4/isisd.conf index bf9653387e..502e035f50 100644 --- a/tests/topotests/isis-topo1/r4/isisd.conf +++ b/tests/topotests/isis-topo1/r4/isisd.conf @@ -4,6 +4,7 @@ debug isis events debug isis update-packets interface r4-eth0 ip router isis 1 + isis hello-interval 2 ipv6 router isis 1 isis circuit-type level-2-only ! @@ -13,6 +14,7 @@ interface r4-eth1 isis circuit-type level-1 ! router isis 1 + lsp-gen-interval 2 net 10.0000.0000.0000.0000.0000.0000.0000.0000.0004.00 metric-style wide redistribute ipv4 connected level-1 diff --git a/tests/topotests/isis-topo1/r4/r4_route.json b/tests/topotests/isis-topo1/r4/r4_route.json index 597e953c09..79361af4b5 100644 --- a/tests/topotests/isis-topo1/r4/r4_route.json +++ b/tests/topotests/isis-topo1/r4/r4_route.json @@ -16,19 +16,6 @@ ], "10.0.21.0/24": [ { - "distance": 115, - "metric": 10, - "nexthops": [ - { - "afi": "ipv4", - "interfaceName": "r4-eth0", - "ip": "10.0.21.2" - } - ], - "prefix": "10.0.21.0/24", - "protocol": "isis" - }, - { "nexthops": [ { "active": true, diff --git a/tests/topotests/isis-topo1/r5/isisd.conf b/tests/topotests/isis-topo1/r5/isisd.conf index 5a044988a9..42493a4991 100644 --- a/tests/topotests/isis-topo1/r5/isisd.conf +++ b/tests/topotests/isis-topo1/r5/isisd.conf @@ -4,6 +4,7 @@ debug isis events debug isis update-packets interface r5-eth0 ip router isis 1 + isis hello-interval 2 ipv6 router isis 1 isis circuit-type level-1 ! @@ -13,6 +14,7 @@ interface r5-eth1 isis circuit-type level-1 ! router isis 1 + lsp-gen-interval 2 net 10.0000.0000.0000.0000.0000.0000.0000.0000.0005.00 metric-style wide is-type level-1 diff --git a/tests/topotests/ldp-sync-isis-topo1/r1/isisd.conf b/tests/topotests/ldp-sync-isis-topo1/r1/isisd.conf index af8d117bc1..da2970d94e 100644 --- a/tests/topotests/ldp-sync-isis-topo1/r1/isisd.conf +++ b/tests/topotests/ldp-sync-isis-topo1/r1/isisd.conf @@ -6,6 +6,7 @@ debug isis update-packets debug isis ldp-sync ! router isis 1 + lsp-gen-interval 2 net 10.0000.0000.0000.0000.0000.0000.0000.0000.0001.00 metric-style wide redistribute ipv4 connected level-1 diff --git a/tests/topotests/ldp-sync-isis-topo1/r2/isisd.conf b/tests/topotests/ldp-sync-isis-topo1/r2/isisd.conf index e477bce827..b29a2b93ee 100644 --- a/tests/topotests/ldp-sync-isis-topo1/r2/isisd.conf +++ b/tests/topotests/ldp-sync-isis-topo1/r2/isisd.conf @@ -6,6 +6,7 @@ debug isis update-packets debug isis ldp-sync ! router isis 1 + lsp-gen-interval 2 net 10.0000.0000.0000.0000.0000.0000.0000.0000.0002.00 metric-style wide redistribute ipv4 connected level-1 diff --git a/tests/topotests/ldp-sync-isis-topo1/r3/isisd.conf b/tests/topotests/ldp-sync-isis-topo1/r3/isisd.conf index e50fb077ba..4c8499f23d 100644 --- a/tests/topotests/ldp-sync-isis-topo1/r3/isisd.conf +++ b/tests/topotests/ldp-sync-isis-topo1/r3/isisd.conf @@ -6,6 +6,7 @@ debug isis update-packets debug isis ldp-sync ! router isis 1 + lsp-gen-interval 2 net 10.0000.0000.0000.0000.0000.0000.0000.0000.0003.00 metric-style wide redistribute ipv4 connected level-1 diff --git a/tests/topotests/ldp-sync-isis-topo1/test_ldp_sync_isis_topo1.py b/tests/topotests/ldp-sync-isis-topo1/test_ldp_sync_isis_topo1.py index d339b7bd7b..331e6fafd4 100644 --- a/tests/topotests/ldp-sync-isis-topo1/test_ldp_sync_isis_topo1.py +++ b/tests/topotests/ldp-sync-isis-topo1/test_ldp_sync_isis_topo1.py @@ -182,7 +182,9 @@ def test_isis_convergence(): router_compare_json_output( rname, "show yang operational-data /frr-interface:lib isisd", - "show_yang_interface_isis_adjacencies.ref") + "show_yang_interface_isis_adjacencies.ref", + ) + def test_rib(): logger.info("Test: verify RIB") @@ -265,6 +267,7 @@ def test_ldp_pseudowires(): rname, "show l2vpn atom vc json", "show_l2vpn_vc.ref" ) + def test_ldp_igp_sync(): logger.info("Test: verify LDP igp-sync") tgen = get_topogen() @@ -278,6 +281,7 @@ def test_ldp_igp_sync(): rname, "show mpls ldp igp-sync json", "show_ldp_igp_sync.ref" ) + def test_isis_ldp_sync(): logger.info("Test: verify ISIS igp-sync") tgen = get_topogen() @@ -287,9 +291,7 @@ def test_isis_ldp_sync(): pytest.skip(tgen.errors) for rname in ["r1", "r2", "r3"]: - (result, diff) = validate_show_isis_ldp_sync( - rname, "show_isis_ldp_sync.ref" - ) + (result, diff) = validate_show_isis_ldp_sync(rname, "show_isis_ldp_sync.ref") assert result, "ISIS did not converge on {}:\n{}".format(rname, diff) for rname in ["r1", "r2", "r3"]: @@ -320,7 +322,9 @@ def test_r1_eth1_shutdown(): for rname in ["r1", "r2", "r3"]: router_compare_json_output( - rname, "show mpls ldp igp-sync json", "show_ldp_igp_sync_r1_eth1_shutdown.ref" + rname, + "show mpls ldp igp-sync json", + "show_ldp_igp_sync_r1_eth1_shutdown.ref", ) for rname in ["r1", "r2", "r3"]: @@ -355,9 +359,7 @@ def test_r1_eth1_no_shutdown(): ) for rname in ["r1", "r2", "r3"]: - (result, diff) = validate_show_isis_ldp_sync( - rname, "show_isis_ldp_sync.ref" - ) + (result, diff) = validate_show_isis_ldp_sync(rname, "show_isis_ldp_sync.ref") assert result, "ISIS did not converge on {}:\n{}".format(rname, diff) for rname in ["r1", "r2", "r3"]: @@ -382,7 +384,9 @@ def test_r2_eth1_shutdown(): for rname in ["r1", "r2", "r3"]: router_compare_json_output( - rname, "show mpls ldp igp-sync json", "show_ldp_igp_sync_r1_eth1_shutdown.ref" + rname, + "show mpls ldp igp-sync json", + "show_ldp_igp_sync_r1_eth1_shutdown.ref", ) for rname in ["r1", "r2", "r3"]: @@ -417,9 +421,7 @@ def test_r2_eth1_no_shutdown(): ) for rname in ["r1", "r2", "r3"]: - (result, diff) = validate_show_isis_ldp_sync( - rname, "show_isis_ldp_sync.ref" - ) + (result, diff) = validate_show_isis_ldp_sync(rname, "show_isis_ldp_sync.ref") assert result, "ISIS did not converge on {}:\n{}".format(rname, diff) for rname in ["r1", "r2", "r3"]: @@ -448,6 +450,7 @@ if __name__ == "__main__": # Auxiliary functions # + def parse_show_isis_ldp_sync(lines, rname): """ Parse the output of 'show isis mpls ldp sync' into a Python dict. @@ -461,23 +464,23 @@ def parse_show_isis_ldp_sync(lines, rname): interface = {} interface_name = None - line = it.next(); + line = it.next() if line.startswith(rname + "-eth"): interface_name = line - line = it.next(); + line = it.next() if line.startswith(" LDP-IGP Synchronization enabled: "): interface["ldpIgpSyncEnabled"] = line.endswith("yes") - line = it.next(); + line = it.next() if line.startswith(" holddown timer in seconds: "): - interface["holdDownTimeInSec"] = int(line.split(": ")[-1]) - line = it.next(); + interface["holdDownTimeInSec"] = int(line.split(": ")[-1]) + line = it.next() if line.startswith(" State: "): - interface["ldpIgpSyncState"] = line.split(": ")[-1] + interface["ldpIgpSyncState"] = line.split(": ")[-1] elif line.startswith(" Interface "): interface["Interface"] = line.endswith("down") @@ -534,7 +537,7 @@ def parse_show_isis_interface_detail(lines, rname): while True: try: - line = it.next(); + line = it.next() area_match = re.match(r"Area (.+):", line) if not area_match: @@ -543,34 +546,36 @@ def parse_show_isis_interface_detail(lines, rname): area_id = area_match.group(1) area = {} - line = it.next(); + line = it.next() while line.startswith(" Interface: "): - interface_name = re.split(':|,', line)[1].lstrip() + interface_name = re.split(":|,", line)[1].lstrip() - area[interface_name]= [] + area[interface_name] = [] # Look for keyword: Level-1 or Level-2 while not line.startswith(" Level-"): - line = it.next(); + line = it.next() while line.startswith(" Level-"): level = {} level_name = line.split()[0] - level['level'] = level_name + level["level"] = level_name - line = it.next(); + line = it.next() if line.startswith(" Metric:"): - level['metric'] = re.split(':|,', line)[1].lstrip() + level["metric"] = re.split(":|,", line)[1].lstrip() area[interface_name].append(level) # Look for keyword: Level-1 or Level-2 or Interface: - while not line.startswith(" Level-") and not line.startswith(" Interface: "): - line = it.next(); + while not line.startswith(" Level-") and not line.startswith( + " Interface: " + ): + line = it.next() if line.startswith(" Level-"): continue @@ -623,4 +628,3 @@ def validate_show_isis_interface_detail(rname, fname): (result, diff) = topotest.run_and_expect(test_func, None, wait=0.5, count=160) return (result, diff) - diff --git a/tests/topotests/ldp-sync-ospf-topo1/test_ldp_sync_ospf_topo1.py b/tests/topotests/ldp-sync-ospf-topo1/test_ldp_sync_ospf_topo1.py index 9694fa982f..20d7f46d4c 100644 --- a/tests/topotests/ldp-sync-ospf-topo1/test_ldp_sync_ospf_topo1.py +++ b/tests/topotests/ldp-sync-ospf-topo1/test_ldp_sync_ospf_topo1.py @@ -264,6 +264,7 @@ def test_ldp_pseudowires(): rname, "show l2vpn atom vc json", "show_l2vpn_vc.ref" ) + def test_ldp_igp_sync(): logger.info("Test: verify LDP igp-sync") tgen = get_topogen() @@ -277,6 +278,7 @@ def test_ldp_igp_sync(): rname, "show mpls ldp igp-sync json", "show_ldp_igp_sync.ref" ) + def test_ospf_ldp_sync(): logger.info("Test: verify OSPF igp-sync") tgen = get_topogen() @@ -317,19 +319,26 @@ def test_r1_eth1_shutdown(): for rname in ["r1", "r2", "r3"]: router_compare_json_output( - rname, "show mpls ldp igp-sync json", "show_ldp_igp_sync_r1_eth1_shutdown.ref" + rname, + "show mpls ldp igp-sync json", + "show_ldp_igp_sync_r1_eth1_shutdown.ref", ) for rname in ["r1", "r2", "r3"]: router_compare_json_output( - rname, "show ip ospf mpls ldp-sync json", "show_ospf_ldp_sync_r1_eth1_shutdown.ref" + rname, + "show ip ospf mpls ldp-sync json", + "show_ospf_ldp_sync_r1_eth1_shutdown.ref", ) for rname in ["r1", "r2", "r3"]: router_compare_json_output( - rname, "show ip ospf interface json", "show_ip_ospf_interface_r1_eth1_shutdown.ref" + rname, + "show ip ospf interface json", + "show_ip_ospf_interface_r1_eth1_shutdown.ref", ) + def test_r1_eth1_no_shutdown(): logger.info("Test: verify behaviour after r1-eth1 is no shutdown") tgen = get_topogen() @@ -358,6 +367,7 @@ def test_r1_eth1_no_shutdown(): rname, "show ip ospf interface json", "show_ip_ospf_interface.ref" ) + def test_r2_eth1_shutdown(): logger.info("Test: verify behaviour after r2-eth1 is shutdown") tgen = get_topogen() @@ -373,19 +383,26 @@ def test_r2_eth1_shutdown(): for rname in ["r1", "r2", "r3"]: router_compare_json_output( - rname, "show mpls ldp igp-sync json", "show_ldp_igp_sync_r1_eth1_shutdown.ref" + rname, + "show mpls ldp igp-sync json", + "show_ldp_igp_sync_r1_eth1_shutdown.ref", ) for rname in ["r1", "r2", "r3"]: router_compare_json_output( - rname, "show ip ospf mpls ldp-sync json", "show_ospf_ldp_sync_r2_eth1_shutdown.ref" + rname, + "show ip ospf mpls ldp-sync json", + "show_ospf_ldp_sync_r2_eth1_shutdown.ref", ) for rname in ["r1", "r2", "r3"]: router_compare_json_output( - rname, "show ip ospf interface json", "show_ip_ospf_interface_r2_eth1_shutdown.ref" + rname, + "show ip ospf interface json", + "show_ip_ospf_interface_r2_eth1_shutdown.ref", ) + def test_r2_eth1_no_shutdown(): logger.info("Test: verify behaviour after r2-eth1 is no shutdown") tgen = get_topogen() @@ -414,6 +431,7 @@ def test_r2_eth1_no_shutdown(): rname, "show ip ospf interface json", "show_ip_ospf_interface.ref" ) + # Memory leak test template def test_memory_leak(): "Run the memory leak test and report results." diff --git a/tests/topotests/ldp-vpls-topo1/test_ldp_vpls_topo1.py b/tests/topotests/ldp-vpls-topo1/test_ldp_vpls_topo1.py index 0b8bf4de0e..ba94cd47d4 100644 --- a/tests/topotests/ldp-vpls-topo1/test_ldp_vpls_topo1.py +++ b/tests/topotests/ldp-vpls-topo1/test_ldp_vpls_topo1.py @@ -283,8 +283,7 @@ def test_ldp_pseudowires_after_link_down(): # for nexthop resolution). Give some extra wait time. for rname in ["r1", "r2", "r3"]: router_compare_json_output( - rname, "show l2vpn atom vc json", "show_l2vpn_vc.ref", - count=160, wait=1 + rname, "show l2vpn atom vc json", "show_l2vpn_vc.ref", count=160, wait=1 ) diff --git a/tests/topotests/lib/bgp.py b/tests/topotests/lib/bgp.py index 72b99eeba8..8427b241b7 100644 --- a/tests/topotests/lib/bgp.py +++ b/tests/topotests/lib/bgp.py @@ -991,7 +991,7 @@ def modify_bgp_config_when_bgpd_down(tgen, topo, input_dict): ############################################# # Verification APIs ############################################# -@retry(attempts=3, wait=2, return_is_str=True) +@retry(attempts=4, wait=2, return_is_str=True) def verify_router_id(tgen, topo, input_dict): """ Running command "show ip bgp json" for DUT and reading router-id @@ -1246,7 +1246,7 @@ def verify_bgp_convergence(tgen, topo, dut=None): return True -@retry(attempts=3, wait=4, return_is_str=True) +@retry(attempts=4, wait=4, return_is_str=True) def verify_bgp_community( tgen, addr_type, router, network, input_dict=None, vrf=None, bestpath=False ): @@ -1411,7 +1411,7 @@ def modify_as_number(tgen, topo, input_dict): return True -@retry(attempts=3, wait=2, return_is_str=True) +@retry(attempts=4, wait=2, return_is_str=True) def verify_as_numbers(tgen, topo, input_dict): """ This API is to verify AS numbers for given DUT by running @@ -2062,7 +2062,7 @@ def verify_bgp_timers_and_functionality(tgen, topo, input_dict): return True -@retry(attempts=3, wait=4, return_is_str=True) +@retry(attempts=4, wait=4, return_is_str=True) def verify_bgp_attributes( tgen, addr_type, @@ -2198,7 +2198,7 @@ def verify_bgp_attributes( return True -@retry(attempts=5, wait=2, return_is_str=True) +@retry(attempts=4, wait=2, return_is_str=True) def verify_best_path_as_per_bgp_attribute( tgen, addr_type, router, input_dict, attribute ): @@ -2402,6 +2402,7 @@ def verify_best_path_as_per_bgp_attribute( return True +@retry(attempts=5, wait=2, return_is_str=True) def verify_best_path_as_per_admin_distance( tgen, addr_type, router, input_dict, attribute ): @@ -3303,7 +3304,7 @@ def verify_eor(tgen, topo, addr_type, input_dict, dut, peer): return True -@retry(attempts=5, wait=2, return_is_str=True) +@retry(attempts=4, wait=2, return_is_str=True) def verify_f_bit(tgen, topo, addr_type, input_dict, dut, peer): """ This API is to verify f_bit in the BGP gr capability advertised @@ -3569,7 +3570,7 @@ def verify_graceful_restart_timers(tgen, topo, addr_type, input_dict, dut, peer) return True -@retry(attempts=5, wait=2, return_is_str=True) +@retry(attempts=4, wait=2, return_is_str=True) def verify_gr_address_family(tgen, topo, addr_type, addr_family, dut): """ This API is to verify gr_address_family in the BGP gr capability advertised @@ -4060,7 +4061,7 @@ def verify_attributes_for_evpn_routes( return False -@retry(attempts=6, wait=2, return_is_str=True) +@retry(attempts=5, wait=2, return_is_str=True) def verify_evpn_routes( tgen, topo, dut, input_dict, routeType=5, EthTag=0, next_hop=None ): diff --git a/tests/topotests/lib/bgprib.py b/tests/topotests/lib/bgprib.py index 3d92718c78..a23092de83 100644 --- a/tests/topotests/lib/bgprib.py +++ b/tests/topotests/lib/bgprib.py @@ -18,8 +18,8 @@ # # want_rd_routes = [ -# {'rd':'10:1', 'p':'5.1.0.0/24', 'n':'1.1.1.1'}, -# {'rd':'10:1', 'p':'5.1.0.0/24', 'n':'1.1.1.1'}, +# {'rd':'10:1', 'p':'5.1.0.0/24', 'n':'1.1.1.1', 'bp': True}, +# {'rd':'10:1', 'p':'5.1.0.0/24', 'n':'1.1.1.1', 'bp': False}, # # {'rd':'10:3', 'p':'5.1.0.0/24', 'n':'3.3.3.3'}, # ] @@ -34,39 +34,46 @@ # ribRequireUnicastRoutes('r1','ipv4','','Customer routes in default',want_unicast_routes) # -from lutil import luCommand, luResult +from lutil import luCommand, luResult, LUtil import json import re # gpz: get rib in json form and compare against desired routes class BgpRib: + def log(self, str): + LUtil.log("BgpRib: " + str) + def routes_include_wanted(self, pfxtbl, want, debug): # helper function to RequireVpnRoutes for pfx in pfxtbl.iterkeys(): if debug: - print "trying pfx " + pfx + self.log("trying pfx %s" % pfx) if pfx != want["p"]: if debug: - print "want pfx=" + want["p"] + ", not " + pfx + self.log("want pfx=" + want["p"] + ", not " + pfx) continue if debug: - print "have pfx=" + pfx + self.log("have pfx=%s" % pfx) for r in pfxtbl[pfx]: + bp = r.get("bestpath", False) if debug: - print "trying route" + self.log("trying route %s bp=%s" % (r, bp)) nexthops = r["nexthops"] for nh in nexthops: if debug: - print "trying nh " + nh["ip"] + self.log("trying nh %s" % nh["ip"]) if nh["ip"] == want["n"]: if debug: - print "found " + want["n"] - return 1 + self.log("found %s" % want["n"]) + if bp == want.get("bp", bp): + return 1 + elif debug: + self.log("bestpath mismatch %s != %s" % (bp, want["bp"])) else: if debug: - print "want nh=" + want["n"] + ", not " + nh["ip"] + self.log("want nh=" + want["n"] + ", not " + nh["ip"]) if debug: - print "missing route: pfx=" + want["p"] + ", nh=" + want["n"] + self.log("missing route: pfx=" + want["p"] + ", nh=" + want["n"]) return 0 def RequireVpnRoutes(self, target, title, wantroutes, debug=0): @@ -99,12 +106,12 @@ class BgpRib: for want in wantroutes: found = 0 if debug: - print "want rd " + want["rd"] + self.log("want rd %s" % want["rd"]) for rd in rds.iterkeys(): if rd != want["rd"]: continue if debug: - print "found rd " + rd + self.log("found rd %s" % rd) table = rds[rd] if self.routes_include_wanted(table, want, debug): found = 1 @@ -115,13 +122,13 @@ class BgpRib: luResult(target, True, title, logstr) def RequireUnicastRoutes(self, target, afi, vrf, title, wantroutes, debug=0): - logstr = "RequireVpnRoutes " + str(wantroutes) + logstr = "RequireVpnRoutes %s" % str(wantroutes) vrfstr = "" if vrf != "": vrfstr = "vrf %s" % (vrf) if (afi != "ipv4") and (afi != "ipv6"): - print "ERROR invalid afi" + self.log("ERROR invalid afi") cmdstr = "show bgp %s %s unicast" % (vrfstr, afi) # non json form for humans @@ -148,7 +155,11 @@ class BgpRib: errstr = "-script ERROR: check if vrf missing" luResult(target, False, title + errstr, logstr) return + # if debug: + # self.log("table=%s" % table) for want in wantroutes: + if debug: + self.log("want=%s" % want) if not self.routes_include_wanted(table, want, debug): luResult(target, False, title, logstr) return diff --git a/tests/topotests/lib/common_config.py b/tests/topotests/lib/common_config.py index 1fa6d35101..9c104db3cd 100644 --- a/tests/topotests/lib/common_config.py +++ b/tests/topotests/lib/common_config.py @@ -400,6 +400,7 @@ def check_router_status(tgen): logger.debug("Exiting lib API: {}".format(sys._getframe().f_code.co_name)) return True + def getStrIO(): """ Return a StringIO object appropriate for the current python version. @@ -409,6 +410,7 @@ def getStrIO(): else: return StringIO.StringIO() + def reset_config_on_routers(tgen, routerName=None): """ Resets configuration on routers to the snapshot created using input JSON @@ -702,14 +704,14 @@ def start_topology(tgen, daemon=None): ) TMPDIR = os.path.join(LOGDIR, tgen.modname) - linux_ver = '' + linux_ver = "" router_list = tgen.routers() for rname in ROUTER_LIST: router = router_list[rname] # It will help in debugging the failures, will give more details on which # specific kernel version tests are failing - if linux_ver == '': + if linux_ver == "": linux_ver = router.run("uname -a") logger.info("Logging platform related details: \n %s \n", linux_ver) @@ -741,11 +743,10 @@ def start_topology(tgen, daemon=None): # Loading empty bgpd.conf file to router, to start the bgp deamon router.load_config(TopoRouter.RD_BGP, "{}/{}/bgpd.conf".format(TMPDIR, rname)) - if daemon and 'ospfd' in daemon: + if daemon and "ospfd" in daemon: # Loading empty ospf.conf file to router, to start the bgp deamon router.load_config( - TopoRouter.RD_OSPF, - '{}/{}/ospfd.conf'.format(TMPDIR, rname) + TopoRouter.RD_OSPF, "{}/{}/ospfd.conf".format(TMPDIR, rname) ) # Starting routers logger.info("Starting all routers once topology is created") @@ -831,8 +832,8 @@ def topo_daemons(tgen, topo): ) for rtr in ROUTER_LIST: - if 'ospf' in topo['routers'][rtr] and 'ospfd' not in daemon_list: - daemon_list.append('ospfd') + if "ospf" in topo["routers"][rtr] and "ospfd" not in daemon_list: + daemon_list.append("ospfd") return daemon_list @@ -1266,8 +1267,7 @@ def interface_status(tgen, topo, input_dict): return True -def retry(attempts=3, wait=2, return_is_str=True, initial_wait=0, - return_is_dict=False): +def retry(attempts=3, wait=2, return_is_str=True, initial_wait=0, return_is_dict=False): """ Retries function execution, if return is an errormsg or exception @@ -1279,11 +1279,10 @@ def retry(attempts=3, wait=2, return_is_str=True, initial_wait=0, """ def _retry(func): - @wraps(func) def func_retry(*args, **kwargs): - _wait = kwargs.pop('wait', wait) - _attempts = kwargs.pop('attempts', attempts) + _wait = kwargs.pop("wait", wait) + _attempts = kwargs.pop("attempts", attempts) _attempts = int(_attempts) expected = True if _attempts < 0: @@ -1293,19 +1292,21 @@ def retry(attempts=3, wait=2, return_is_str=True, initial_wait=0, logger.info("Waiting for [%s]s as initial delay", initial_wait) sleep(initial_wait) - _return_is_str = kwargs.pop('return_is_str', return_is_str) - _return_is_dict = kwargs.pop('return_is_str', return_is_dict) + _return_is_str = kwargs.pop("return_is_str", return_is_str) + _return_is_dict = kwargs.pop("return_is_str", return_is_dict) for i in range(1, _attempts + 1): try: - _expected = kwargs.setdefault('expected', True) + _expected = kwargs.setdefault("expected", True) if _expected is False: expected = _expected - kwargs.pop('expected') + kwargs.pop("expected") ret = func(*args, **kwargs) logger.debug("Function returned %s", ret) if _return_is_str and isinstance(ret, bool) and _expected: return ret - if (isinstance(ret, str) or isinstance(ret, unicode)) and _expected is False: + if ( + isinstance(ret, str) or isinstance(ret, unicode) + ) and _expected is False: return ret if _return_is_dict and isinstance(ret, dict): return ret @@ -1316,17 +1317,17 @@ def retry(attempts=3, wait=2, return_is_str=True, initial_wait=0, except Exception as err: if _attempts == i and expected: generate_support_bundle() - logger.info("Max number of attempts (%r) reached", - _attempts) + logger.info("Max number of attempts (%r) reached", _attempts) raise else: logger.info("Function returned %s", err) if i < _attempts: - logger.info("Retry [#%r] after sleeping for %ss" - % (i, _wait)) + logger.info("Retry [#%r] after sleeping for %ss" % (i, _wait)) sleep(_wait) + func_retry._original = func return func_retry + return _retry @@ -1420,58 +1421,63 @@ def create_interfaces_cfg(tgen, topo, build=False): else: interface_data.append("ipv6 address {}\n".format(intf_addr)) - if 'ospf' in data: - ospf_data = data['ospf'] - if 'area' in ospf_data: - intf_ospf_area = c_data["links"][destRouterLink][ - "ospf"]["area"] + if "ospf" in data: + ospf_data = data["ospf"] + if "area" in ospf_data: + intf_ospf_area = c_data["links"][destRouterLink]["ospf"]["area"] if "delete" in data and data["delete"]: interface_data.append("no ip ospf area") else: - interface_data.append("ip ospf area {}".format( - intf_ospf_area - )) + interface_data.append( + "ip ospf area {}".format(intf_ospf_area) + ) - if "hello_interval" in ospf_data: - intf_ospf_hello = c_data["links"][destRouterLink][ - "ospf"]["hello_interval"] + if "hello_interval" in ospf_data: + intf_ospf_hello = c_data["links"][destRouterLink]["ospf"][ + "hello_interval" + ] if "delete" in data and data["delete"]: - interface_data.append("no ip ospf "\ - " hello-interval") + interface_data.append("no ip ospf " " hello-interval") else: - interface_data.append("ip ospf "\ - " hello-interval {}".format(intf_ospf_hello)) + interface_data.append( + "ip ospf " " hello-interval {}".format(intf_ospf_hello) + ) if "dead_interval" in ospf_data: - intf_ospf_dead = c_data["links"][destRouterLink][ - "ospf"]["dead_interval"] + intf_ospf_dead = c_data["links"][destRouterLink]["ospf"][ + "dead_interval" + ] if "delete" in data and data["delete"]: - interface_data.append("no ip ospf"\ - " dead-interval") + interface_data.append("no ip ospf" " dead-interval") else: - interface_data.append("ip ospf "\ - " dead-interval {}".format(intf_ospf_dead)) + interface_data.append( + "ip ospf " " dead-interval {}".format(intf_ospf_dead) + ) if "network" in ospf_data: - intf_ospf_nw = c_data["links"][destRouterLink][ - "ospf"]["network"] + intf_ospf_nw = c_data["links"][destRouterLink]["ospf"][ + "network" + ] if "delete" in data and data["delete"]: - interface_data.append("no ip ospf"\ - " network {}".format(intf_ospf_nw)) + interface_data.append( + "no ip ospf" " network {}".format(intf_ospf_nw) + ) else: - interface_data.append("ip ospf"\ - " network {}".format(intf_ospf_nw)) + interface_data.append( + "ip ospf" " network {}".format(intf_ospf_nw) + ) if "priority" in ospf_data: - intf_ospf_nw = c_data["links"][destRouterLink][ - "ospf"]["priority"] + intf_ospf_nw = c_data["links"][destRouterLink]["ospf"][ + "priority" + ] if "delete" in data and data["delete"]: - interface_data.append("no ip ospf"\ - " priority") + interface_data.append("no ip ospf" " priority") else: - interface_data.append("ip ospf"\ - " priority {}".format(intf_ospf_nw)) + interface_data.append( + "ip ospf" " priority {}".format(intf_ospf_nw) + ) result = create_common_configuration( tgen, c_router, interface_data, "interface_config", build=build ) @@ -2553,6 +2559,7 @@ def verify_rib( tag=None, metric=None, fib=None, + count_only=False ): """ Data will be read from input_dict or input JSON file, API will generate @@ -2570,6 +2577,8 @@ def verify_rib( * `next_hop`[optional]: next_hop which needs to be verified, default: static * `protocol`[optional]: protocol, default = None + * `count_only`[optional]: count of nexthops only, not specific addresses, + default = False Usage ----- @@ -2733,7 +2742,23 @@ def verify_rib( for rib_r in rib_routes_json[st_rt][0]["nexthops"] ] - if found_hops: + # Check only the count of nexthops + if count_only: + if len(next_hop) == len(found_hops): + nh_found = True + else: + errormsg = ( + "Nexthops are missing for " + "route {} in RIB of router {}: " + "expected {}, found {}\n".format( + st_rt, dut, len(next_hop), + len(found_hops) + ) + ) + return errormsg + + # Check the actual nexthops + elif found_hops: missing_list_of_nexthops = set( found_hops ).difference(next_hop) @@ -2919,264 +2944,7 @@ def verify_rib( logger.debug("Exiting lib API: {}".format(sys._getframe().f_code.co_name)) return True - -@retry(attempts=5, wait=2, return_is_str=True, initial_wait=2) -def verify_fib_routes(tgen, addr_type, dut, input_dict, next_hop=None): - """ - Data will be read from input_dict or input JSON file, API will generate - same prefixes, which were redistributed by either create_static_routes() or - advertise_networks_using_network_command() and will verify next_hop and - each prefix/routes is present in "show ip/ipv6 fib json" - command o/p. - - Parameters - ---------- - * `tgen` : topogen object - * `addr_type` : ip type, ipv4/ipv6 - * `dut`: Device Under Test, for which user wants to test the data - * `input_dict` : input dict, has details of static routes - * `next_hop`[optional]: next_hop which needs to be verified, - default: static - - Usage - ----- - input_routes_r1 = { - "r1": { - "static_routes": [{ - "network": ["1.1.1.1/32], - "next_hop": "Null0", - "vrf": "RED" - }] - } - } - result = result = verify_fib_routes(tgen, "ipv4, "r1", input_routes_r1) - - Returns - ------- - errormsg(str) or True - """ - - logger.debug("Entering lib API: {}".format(sys._getframe().f_code.co_name)) - - router_list = tgen.routers() - for routerInput in input_dict.keys(): - for router, rnode in router_list.items(): - if router != dut: - continue - - logger.info("Checking router %s FIB routes:", router) - - # Verifying RIB routes - if addr_type == "ipv4": - command = "show ip fib" - else: - command = "show ipv6 fib" - - found_routes = [] - missing_routes = [] - - if "static_routes" in input_dict[routerInput]: - static_routes = input_dict[routerInput]["static_routes"] - - for static_route in static_routes: - if "vrf" in static_route and static_route["vrf"] is not None: - - logger.info( - "[DUT: {}]: Verifying routes for VRF:" - " {}".format(router, static_route["vrf"]) - ) - - cmd = "{} vrf {}".format(command, static_route["vrf"]) - - else: - cmd = "{}".format(command) - - cmd = "{} json".format(cmd) - - rib_routes_json = run_frr_cmd(rnode, cmd, isjson=True) - - # Verifying output dictionary rib_routes_json is not empty - if bool(rib_routes_json) is False: - errormsg = "[DUT: {}]: No route found in fib".format(router) - return errormsg - - network = static_route["network"] - if "no_of_ip" in static_route: - no_of_ip = static_route["no_of_ip"] - else: - no_of_ip = 1 - - # Generating IPs for verification - ip_list = generate_ips(network, no_of_ip) - st_found = False - nh_found = False - - for st_rt in ip_list: - st_rt = str(ipaddress.ip_network(frr_unicode(st_rt))) - #st_rt = str(ipaddr.IPNetwork(unicode(st_rt))) - - _addr_type = validate_ip_address(st_rt) - if _addr_type != addr_type: - continue - - if st_rt in rib_routes_json: - st_found = True - found_routes.append(st_rt) - - if next_hop: - if type(next_hop) is not list: - next_hop = [next_hop] - - count = 0 - for nh in next_hop: - for nh_dict in rib_routes_json[st_rt][0][ - "nexthops" - ]: - if nh_dict["ip"] != nh: - continue - else: - count += 1 - - if count == len(next_hop): - nh_found = True - else: - missing_routes.append(st_rt) - errormsg = ( - "Nexthop {} is Missing" - " for route {} in " - "RIB of router {}\n".format( - next_hop, st_rt, dut - ) - ) - return errormsg - - else: - missing_routes.append(st_rt) - - if len(missing_routes) > 0: - errormsg = "[DUT: {}]: Missing route in FIB:" " {}".format( - dut, missing_routes - ) - return errormsg - - if nh_found: - logger.info( - "Found next_hop {} for all routes in RIB" - " of router {}\n".format(next_hop, dut) - ) - - if found_routes: - logger.info( - "[DUT: %s]: Verified routes in FIB, found" " routes are: %s\n", - dut, - found_routes, - ) - - continue - - if "bgp" in input_dict[routerInput]: - if ( - "advertise_networks" - not in input_dict[routerInput]["bgp"]["address_family"][addr_type][ - "unicast" - ] - ): - continue - - found_routes = [] - missing_routes = [] - advertise_network = input_dict[routerInput]["bgp"]["address_family"][ - addr_type - ]["unicast"]["advertise_networks"] - - # Continue if there are no network advertise - if len(advertise_network) == 0: - continue - - for advertise_network_dict in advertise_network: - if "vrf" in advertise_network_dict: - cmd = "{} vrf {} json".format(command, static_route["vrf"]) - else: - cmd = "{} json".format(command) - - rib_routes_json = run_frr_cmd(rnode, cmd, isjson=True) - - # Verifying output dictionary rib_routes_json is not empty - if bool(rib_routes_json) is False: - errormsg = "No route found in rib of router {}..".format(router) - return errormsg - - start_ip = advertise_network_dict["network"] - if "no_of_network" in advertise_network_dict: - no_of_network = advertise_network_dict["no_of_network"] - else: - no_of_network = 1 - - # Generating IPs for verification - ip_list = generate_ips(start_ip, no_of_network) - st_found = False - nh_found = False - - for st_rt in ip_list: - #st_rt = str(ipaddr.IPNetwork(unicode(st_rt))) - st_rt = str(ipaddress.ip_network(frr_unicode(st_rt))) - - _addr_type = validate_ip_address(st_rt) - if _addr_type != addr_type: - continue - - if st_rt in rib_routes_json: - st_found = True - found_routes.append(st_rt) - - if next_hop: - if type(next_hop) is not list: - next_hop = [next_hop] - - count = 0 - for nh in next_hop: - for nh_dict in rib_routes_json[st_rt][0]["nexthops"]: - if nh_dict["ip"] != nh: - continue - else: - count += 1 - - if count == len(next_hop): - nh_found = True - else: - missing_routes.append(st_rt) - errormsg = ( - "Nexthop {} is Missing" - " for route {} in " - "RIB of router {}\n".format(next_hop, st_rt, dut) - ) - return errormsg - else: - missing_routes.append(st_rt) - - if len(missing_routes) > 0: - errormsg = "[DUT: {}]: Missing route in FIB: " "{} \n".format( - dut, missing_routes - ) - return errormsg - - if nh_found: - logger.info( - "Found next_hop {} for all routes in RIB" - " of router {}\n".format(next_hop, dut) - ) - - if found_routes: - logger.info( - "[DUT: {}]: Verified routes FIB" - ", found routes are: {}\n".format(dut, found_routes) - ) - - logger.debug("Exiting lib API: {}".format(sys._getframe().f_code.co_name)) - return True - - -@retry(attempts=5, wait=2, return_is_str=True, initial_wait=2) +@retry(attempts=6, wait=2, return_is_str=True) def verify_fib_routes(tgen, addr_type, dut, input_dict, next_hop=None): """ Data will be read from input_dict or input JSON file, API will generate @@ -3627,7 +3395,7 @@ def verify_route_maps(tgen, input_dict): return True -@retry(attempts=3, wait=4, return_is_str=True) +@retry(attempts=4, wait=4, return_is_str=True) def verify_bgp_community(tgen, addr_type, router, network, input_dict=None): """ API to veiryf BGP large community is attached in route for any given @@ -4075,8 +3843,9 @@ def required_linux_kernel_version(required_version): """ system_kernel = platform.release() if version_cmp(system_kernel, required_version) < 0: - error_msg = ('These tests will not run on kernel "{}", ' - 'they require kernel >= {})'.format(system_kernel, - required_version )) + error_msg = ( + 'These tests will not run on kernel "{}", ' + "they require kernel >= {})".format(system_kernel, required_version) + ) return error_msg return True diff --git a/tests/topotests/lib/ltemplate.py b/tests/topotests/lib/ltemplate.py index 3c93e1ac5c..d211be8836 100644 --- a/tests/topotests/lib/ltemplate.py +++ b/tests/topotests/lib/ltemplate.py @@ -43,7 +43,8 @@ from mininet.topo import Topo customize = None -class LTemplate(): + +class LTemplate: test = None testdir = None scriptdir = None @@ -54,12 +55,12 @@ class LTemplate(): def __init__(self, test, testdir): global customize - customize = imp.load_source('customize', os.path.join(testdir, 'customize.py')) + customize = imp.load_source("customize", os.path.join(testdir, "customize.py")) self.test = test self.testdir = testdir self.scriptdir = testdir - self.logdir = '/tmp/topotests/{0}.test_{0}'.format(test) - logger.info('LTemplate: '+test) + self.logdir = "/tmp/topotests/{0}.test_{0}".format(test) + logger.info("LTemplate: " + test) def setup_module(self, mod): "Sets up the pytest environment" @@ -68,14 +69,14 @@ class LTemplate(): # ... and here it calls Mininet initialization functions. tgen.start_topology() - logger.info('Topology started') + logger.info("Topology started") try: self.prestarthooksuccess = customize.ltemplatePreRouterStartHook() except AttributeError: - #not defined + # not defined logger.debug("ltemplatePreRouterStartHook() not defined") if self.prestarthooksuccess != True: - logger.info('ltemplatePreRouterStartHook() failed, skipping test') + logger.info("ltemplatePreRouterStartHook() failed, skipping test") return # This is a sample of configuration loading. @@ -85,48 +86,57 @@ class LTemplate(): for rname, router in router_list.items(): logger.info("Setting up %s" % rname) for rd_val in TopoRouter.RD: - config = os.path.join(self.testdir, '{}/{}.conf'.format(rname,TopoRouter.RD[rd_val])) + config = os.path.join( + self.testdir, "{}/{}.conf".format(rname, TopoRouter.RD[rd_val]) + ) prog = os.path.join(tgen.net[rname].daemondir, TopoRouter.RD[rd_val]) if os.path.exists(config): if os.path.exists(prog): router.load_config(rd_val, config) else: - logger.warning("{} not found, but have {}.conf file".format(prog, TopoRouter.RD[rd_val])) + logger.warning( + "{} not found, but have {}.conf file".format( + prog, TopoRouter.RD[rd_val] + ) + ) # After loading the configurations, this function loads configured daemons. - logger.info('Starting routers') + logger.info("Starting routers") tgen.start_router() try: self.poststarthooksuccess = customize.ltemplatePostRouterStartHook() except AttributeError: - #not defined + # not defined logger.debug("ltemplatePostRouterStartHook() not defined") luStart(baseScriptDir=self.scriptdir, baseLogDir=self.logdir, net=tgen.net) -#initialized by ltemplate_start + +# initialized by ltemplate_start _lt = None + def setup_module(mod): global _lt root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - test = mod.__name__[:mod.__name__.rfind(".")] + test = mod.__name__[: mod.__name__.rfind(".")] testdir = os.path.join(root, test) - #don't do this for now as reload didn't work as expected - #fixup sys.path, want test dir there only once - #try: + # don't do this for now as reload didn't work as expected + # fixup sys.path, want test dir there only once + # try: # sys.path.remove(testdir) - #except ValueError: + # except ValueError: # logger.debug(testdir+" not found in original sys.path") - #add testdir - #sys.path.append(testdir) + # add testdir + # sys.path.append(testdir) - #init class + # init class _lt = LTemplate(test, testdir) _lt.setup_module(mod) - #drop testdir - #sys.path.remove(testdir) + # drop testdir + # sys.path.remove(testdir) + def teardown_module(mod): global _lt @@ -141,7 +151,10 @@ def teardown_module(mod): tgen.stop_topology() _lt = None -def ltemplateTest(script, SkipIfFailed=True, CallOnFail=None, CheckFuncStr=None, KeepGoing=False): + +def ltemplateTest( + script, SkipIfFailed=True, CallOnFail=None, CheckFuncStr=None, KeepGoing=False +): global _lt if _lt == None or _lt.prestarthooksuccess != True: return @@ -149,8 +162,8 @@ def ltemplateTest(script, SkipIfFailed=True, CallOnFail=None, CheckFuncStr=None, tgen = get_topogen() if not os.path.isfile(script): if not os.path.isfile(os.path.join(_lt.scriptdir, script)): - logger.error('Could not find script file: ' + script) - assert 'Could not find script file: ' + script + logger.error("Could not find script file: " + script) + assert "Could not find script file: " + script logger.info("Starting template test: " + script) numEntry = luNumFail() @@ -163,7 +176,7 @@ def ltemplateTest(script, SkipIfFailed=True, CallOnFail=None, CheckFuncStr=None, if CheckFuncStr != None: check = eval(CheckFuncStr) if check != True: - pytest.skip("Check function '"+CheckFuncStr+"' returned: " + check) + pytest.skip("Check function '" + CheckFuncStr + "' returned: " + check) if CallOnFail != None: CallOnFail = eval(CallOnFail) @@ -173,22 +186,26 @@ def ltemplateTest(script, SkipIfFailed=True, CallOnFail=None, CheckFuncStr=None, luShowFail() fatal_error = "%d tests failed" % numFail if not KeepGoing: - assert "scripts/cleanup_all.py failed" == "See summary output above", fatal_error + assert ( + "scripts/cleanup_all.py failed" == "See summary output above" + ), fatal_error + # Memory leak test template def test_memory_leak(): "Run the memory leak test and report results." tgen = get_topogen() if not tgen.is_memleak_enabled(): - pytest.skip('Memory leak test/report is disabled') + pytest.skip("Memory leak test/report is disabled") tgen.report_memory_leaks() -class ltemplateRtrCmd(): + +class ltemplateRtrCmd: def __init__(self): self.resetCounts() - def doCmd(self, tgen, rtr, cmd, checkstr = None): + def doCmd(self, tgen, rtr, cmd, checkstr=None): output = tgen.net[rtr].cmd(cmd).strip() if len(output): self.output += 1 @@ -199,8 +216,8 @@ class ltemplateRtrCmd(): else: self.match += 1 return ret - logger.info('command: {} {}'.format(rtr, cmd)) - logger.info('output: ' + output) + logger.info("command: {} {}".format(rtr, cmd)) + logger.info("output: " + output) self.none += 1 return None @@ -222,63 +239,69 @@ class ltemplateRtrCmd(): def getNone(self): return self.none -def ltemplateVersionCheck(vstr, rname='r1', compstr='<',cli=False, kernel='4.9', iproute2=None, mpls=True): + +def ltemplateVersionCheck( + vstr, rname="r1", compstr="<", cli=False, kernel="4.9", iproute2=None, mpls=True +): tgen = get_topogen() router = tgen.gears[rname] if cli: - logger.info('calling mininet CLI') + logger.info("calling mininet CLI") tgen.mininet_cli() - logger.info('exited mininet CLI') + logger.info("exited mininet CLI") if _lt == None: - ret = 'Template not initialized' + ret = "Template not initialized" return ret if _lt.prestarthooksuccess != True: - ret = 'ltemplatePreRouterStartHook failed' + ret = "ltemplatePreRouterStartHook failed" return ret if _lt.poststarthooksuccess != True: - ret = 'ltemplatePostRouterStartHook failed' + ret = "ltemplatePostRouterStartHook failed" return ret if mpls == True and tgen.hasmpls != True: - ret = 'MPLS not initialized' + ret = "MPLS not initialized" return ret if kernel != None: krel = platform.release() if topotest.version_cmp(krel, kernel) < 0: - ret = 'Skipping tests, old kernel ({} < {})'.format(krel, kernel) + ret = "Skipping tests, old kernel ({} < {})".format(krel, kernel) return ret if iproute2 != None: if _lt.iproute2Ver == None: - #collect/log info on iproute2 + # collect/log info on iproute2 cc = ltemplateRtrCmd() - found = cc.doCmd(tgen, rname, 'apt-cache policy iproute2', 'Installed: ([\d\.]*)') + found = cc.doCmd( + tgen, rname, "apt-cache policy iproute2", "Installed: ([\d\.]*)" + ) if found != None: iproute2Ver = found.group(1) else: - iproute2Ver = '0-unknown' - logger.info('Have iproute2 version=' + iproute2Ver) + iproute2Ver = "0-unknown" + logger.info("Have iproute2 version=" + iproute2Ver) if topotest.version_cmp(iproute2Ver, iproute2) < 0: - ret = 'Skipping tests, old iproute2 ({} < {})'.format(iproute2Ver, iproute2) + ret = "Skipping tests, old iproute2 ({} < {})".format(iproute2Ver, iproute2) return ret ret = True try: if router.has_version(compstr, vstr): - ret = 'Skipping tests, old FRR version {} {}'.format(compstr, vstr) + ret = "Skipping tests, old FRR version {} {}".format(compstr, vstr) return ret except: ret = True return ret -#for testing -if __name__ == '__main__': + +# for testing +if __name__ == "__main__": args = ["-s"] + sys.argv[1:] sys.exit(pytest.main(args)) diff --git a/tests/topotests/lib/lutil.py b/tests/topotests/lib/lutil.py index 05ed9c007d..1fb4f48b0f 100644 --- a/tests/topotests/lib/lutil.py +++ b/tests/topotests/lib/lutil.py @@ -32,46 +32,53 @@ from mininet.net import Mininet # These functions are inteneted to provide support for CI testing within MiniNet # environments. + class lUtil: - #to be made configurable in the future - base_script_dir = '.' - base_log_dir = '.' - fout_name = 'output.log' - fsum_name = 'summary.txt' + # to be made configurable in the future + base_script_dir = "." + base_log_dir = "." + fout_name = "output.log" + fsum_name = "summary.txt" l_level = 6 CallOnFail = False l_total = 0 l_pass = 0 l_fail = 0 - l_filename = '' + l_filename = "" l_last = None l_line = 0 l_dotall_experiment = False l_last_nl = None - fout = '' - fsum = '' - net = '' + fout = "" + fsum = "" + net = "" def log(self, str, level=6): if self.l_level > 0: - if self.fout == '': - self.fout = open(self.fout_name, 'w', 0) - self.fout.write(str+'\n') + if self.fout == "": + self.fout = open(self.fout_name, "w", 0) + self.fout.write(str + "\n") if level <= self.l_level: print(str) def summary(self, str): - if self.fsum == '': - self.fsum = open(self.fsum_name, 'w', 0) - self.fsum.write('\ -******************************************************************************\n') - self.fsum.write('\ -Test Target Summary Pass Fail\n') - self.fsum.write('\ -******************************************************************************\n') - self.fsum.write(str+'\n') + if self.fsum == "": + self.fsum = open(self.fsum_name, "w", 0) + self.fsum.write( + "\ +******************************************************************************\n" + ) + self.fsum.write( + "\ +Test Target Summary Pass Fail\n" + ) + self.fsum.write( + "\ +******************************************************************************\n" + ) + self.fsum.write(str + "\n") def result(self, target, success, str, logstr=None): if success: @@ -88,32 +95,34 @@ Test Target Summary Pass Fail\n if logstr != None: self.log("R:%d %s: %s" % (self.l_total, sstr, logstr)) res = "%-4d %-6s %-56s %-4d %d" % (self.l_total, target, str, p, f) - self.log ('R:'+res) + self.log("R:" + res) self.summary(res) if f == 1 and self.CallOnFail != False: self.CallOnFail() def closeFiles(self): - ret = '\ + ret = ( + "\ ******************************************************************************\n\ Total %-4d %-4d %d\n\ -******************************************************************************'\ -% (self.l_total, self.l_pass, self.l_fail) - if self.fsum != '': - self.fsum.write(ret + '\n') +******************************************************************************" + % (self.l_total, self.l_pass, self.l_fail) + ) + if self.fsum != "": + self.fsum.write(ret + "\n") self.fsum.close() - self.fsum = '' - if self.fout != '': + self.fsum = "" + if self.fout != "": if os.path.isfile(self.fsum_name): - r = open(self.fsum_name, 'r') + r = open(self.fsum_name, "r") self.fout.write(r.read()) r.close() self.fout.close() - self.fout = '' + self.fout = "" return ret def setFilename(self, name): - str = 'FILE: ' + name + str = "FILE: " + name self.log(str) self.summary(str) self.l_filename = name @@ -128,19 +137,19 @@ Total %-4d %-4d %d\n\ def strToArray(self, string): a = [] c = 0 - end = '' + end = "" words = string.split() - if len(words) < 1 or words[0].startswith('#'): + if len(words) < 1 or words[0].startswith("#"): return a words = string.split() for word in words: if len(end) == 0: a.append(word) else: - a[c] += str(' '+word) - if end == '\\': - end = '' - if not word.endswith('\\'): + a[c] += str(" " + word) + if end == "\\": + end = "" + if not word.endswith("\\"): if end != '"': if word.startswith('"'): end = '"' @@ -148,14 +157,14 @@ Total %-4d %-4d %d\n\ c += 1 else: if word.endswith('"'): - end = '' + end = "" c += 1 else: c += 1 else: - end = '\\' - # if len(end) == 0: - # print('%d:%s:' % (c, a[c-1])) + end = "\\" + # if len(end) == 0: + # print('%d:%s:' % (c, a[c-1])) return a @@ -169,27 +178,37 @@ Total %-4d %-4d %d\n\ luCommand(a[1], a[2], a[3], a[4], a[5]) else: self.l_line += 1 - self.log('%s:%s %s' % (self.l_filename, self.l_line , line)) + self.log("%s:%s %s" % (self.l_filename, self.l_line, line)) if len(a) >= 2: - if a[0] == 'sleep': + if a[0] == "sleep": time.sleep(int(a[1])) - elif a[0] == 'include': + elif a[0] == "include": self.execTestFile(a[1]) f.close() else: - self.log('unable to read: ' + tstFile) + self.log("unable to read: " + tstFile) sys.exit(1) def command(self, target, command, regexp, op, result, returnJson): global net - if op != 'wait': - self.l_line += 1 - self.log('(#%d) %s:%s COMMAND:%s:%s:%s:%s:%s:' % \ - (self.l_total+1, - self.l_filename, self.l_line, target, command, regexp, op, result)) - if self.net == '': + if op != "wait": + self.l_line += 1 + self.log( + "(#%d) %s:%s COMMAND:%s:%s:%s:%s:%s:" + % ( + self.l_total + 1, + self.l_filename, + self.l_line, + target, + command, + regexp, + op, + result, + ) + ) + if self.net == "": return False - #self.log("Running %s %s" % (target, command)) + # self.log("Running %s %s" % (target, command)) js = None out = self.net[target].cmd(command).rstrip() if len(out) == 0: @@ -201,13 +220,15 @@ Total %-4d %-4d %d\n\ js = json.loads(out) except: js = None - self.log('WARNING: JSON load failed -- confirm command output is in JSON format.') - self.log('COMMAND OUTPUT:%s:' % report) + self.log( + "WARNING: JSON load failed -- confirm command output is in JSON format." + ) + self.log("COMMAND OUTPUT:%s:" % report) # Experiment: can we achieve the same match behavior via DOTALL # without converting newlines to spaces? out_nl = out - search_nl = re.search(regexp, out_nl, re.DOTALL); + search_nl = re.search(regexp, out_nl, re.DOTALL) self.l_last_nl = search_nl # Set up for comparison if search_nl != None: @@ -220,32 +241,50 @@ Total %-4d %-4d %d\n\ search = re.search(regexp, out) self.l_last = search if search == None: - if op == 'fail': + if op == "fail": success = True else: success = False ret = success else: ret = search.group() - if op != 'fail': + if op != "fail": success = True level = 7 else: success = False level = 5 - self.log('found:%s:' % ret, level) + self.log("found:%s:" % ret, level) # Experiment: compare matched strings obtained each way if self.l_dotall_experiment and (group_nl_converted != ret): - self.log('DOTALL experiment: strings differ dotall=[%s] orig=[%s]' % (group_nl_converted, ret), 9) - if op == 'pass' or op == 'fail': + self.log( + "DOTALL experiment: strings differ dotall=[%s] orig=[%s]" + % (group_nl_converted, ret), + 9, + ) + if op == "pass" or op == "fail": self.result(target, success, result) if js != None: return js return ret - def wait(self, target, command, regexp, op, result, wait, returnJson, wait_time=0.5): - self.log('%s:%s WAIT:%s:%s:%s:%s:%s:%s:%s:' % \ - (self.l_filename, self.l_line, target, command, regexp, op, result,wait,wait_time)) + def wait( + self, target, command, regexp, op, result, wait, returnJson, wait_time=0.5 + ): + self.log( + "%s:%s WAIT:%s:%s:%s:%s:%s:%s:%s:" + % ( + self.l_filename, + self.l_line, + target, + command, + regexp, + op, + result, + wait, + wait_time, + ) + ) found = False n = 0 startt = time.time() @@ -264,103 +303,137 @@ Total %-4d %-4d %d\n\ time.sleep(wait_time) delta = time.time() - startt - self.log('Done after %d loops, time=%s, Found=%s' % (n, delta, found)) - found = self.command(target, command, regexp, 'pass', '%s +%4.2f secs' % (result, delta), returnJson) + self.log("Done after %d loops, time=%s, Found=%s" % (n, delta, found)) + found = self.command( + target, + command, + regexp, + "pass", + "%s +%4.2f secs" % (result, delta), + returnJson, + ) return found -#initialized by luStart -LUtil=None -#entry calls -def luStart(baseScriptDir='.', baseLogDir='.', net='', - fout='output.log', fsum='summary.txt', level=None): +# initialized by luStart +LUtil = None + +# entry calls +def luStart( + baseScriptDir=".", + baseLogDir=".", + net="", + fout="output.log", + fsum="summary.txt", + level=None, +): global LUtil - #init class - LUtil=lUtil() + # init class + LUtil = lUtil() LUtil.base_script_dir = baseScriptDir LUtil.base_log_dir = baseLogDir LUtil.net = net - if fout != '': - LUtil.fout_name = baseLogDir + '/' + fout + if fout != "": + LUtil.fout_name = baseLogDir + "/" + fout if fsum != None: - LUtil.fsum_name = baseLogDir + '/' + fsum + LUtil.fsum_name = baseLogDir + "/" + fsum if level != None: LUtil.l_level = level LUtil.l_dotall_experiment = False LUtil.l_dotall_experiment = True -def luCommand(target, command, regexp='.', op='none', result='', time=10, returnJson=False, wait_time=0.5): - if op != 'wait': + +def luCommand( + target, + command, + regexp=".", + op="none", + result="", + time=10, + returnJson=False, + wait_time=0.5, +): + if op != "wait": return LUtil.command(target, command, regexp, op, result, returnJson) else: - return LUtil.wait(target, command, regexp, op, result, time, returnJson, wait_time) + return LUtil.wait( + target, command, regexp, op, result, time, returnJson, wait_time + ) + def luLast(usenl=False): if usenl: if LUtil.l_last_nl != None: - LUtil.log('luLast:%s:' % LUtil.l_last_nl.group(), 7) + LUtil.log("luLast:%s:" % LUtil.l_last_nl.group(), 7) return LUtil.l_last_nl else: if LUtil.l_last != None: - LUtil.log('luLast:%s:' % LUtil.l_last.group(), 7) + LUtil.log("luLast:%s:" % LUtil.l_last.group(), 7) return LUtil.l_last + def luInclude(filename, CallOnFail=None): - tstFile = LUtil.base_script_dir + '/' + filename + tstFile = LUtil.base_script_dir + "/" + filename LUtil.setFilename(filename) if CallOnFail != None: oldCallOnFail = LUtil.getCallOnFail() LUtil.setCallOnFail(CallOnFail) - if filename.endswith('.py'): - LUtil.log("luInclude: execfile "+tstFile) + if filename.endswith(".py"): + LUtil.log("luInclude: execfile " + tstFile) execfile(tstFile) else: - LUtil.log("luInclude: execTestFile "+tstFile) + LUtil.log("luInclude: execTestFile " + tstFile) LUtil.execTestFile(tstFile) if CallOnFail != None: LUtil.setCallOnFail(oldCallOnFail) + def luFinish(): global LUtil ret = LUtil.closeFiles() - #done + # done LUtil = None - return ret; + return ret + def luNumFail(): return LUtil.l_fail + def luNumPass(): return LUtil.l_pass + def luResult(target, success, str, logstr=None): return LUtil.result(target, success, str, logstr) + def luShowResults(prFunction): printed = 0 - sf = open(LUtil.fsum_name, 'r') + sf = open(LUtil.fsum_name, "r") for line in sf: - printed+=1 + printed += 1 prFunction(line.rstrip()) sf.close() + def luShowFail(): printed = 0 - sf = open(LUtil.fsum_name, 'r') + sf = open(LUtil.fsum_name, "r") for line in sf: if line[-2] != "0": - printed+=1 + printed += 1 logger.error(line.rstrip()) sf.close() if printed > 0: - logger.error("See %s for details of errors" % LUtil.fout_name) + logger.error("See %s for details of errors" % LUtil.fout_name) + -#for testing -if __name__ == '__main__': - print(os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + '/lib') +# for testing +if __name__ == "__main__": + print(os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + "/lib") luStart() for arg in sys.argv[1:]: luInclude(arg) luFinish() sys.exit(0) - diff --git a/tests/topotests/lib/ospf.py b/tests/topotests/lib/ospf.py index 9d6b8fa691..9f3d4841b0 100644 --- a/tests/topotests/lib/ospf.py +++ b/tests/topotests/lib/ospf.py @@ -26,12 +26,15 @@ import ipaddr from lib.topotest import frr_unicode # Import common_config to use commomnly used APIs -from lib.common_config import (create_common_configuration, - InvalidCLIError, retry, - generate_ips, - check_address_types, - validate_ip_address, - run_frr_cmd) +from lib.common_config import ( + create_common_configuration, + InvalidCLIError, + retry, + generate_ips, + check_address_types, + validate_ip_address, + run_frr_cmd, +) LOGDIR = "/tmp/topotests/" TMPDIR = None @@ -40,9 +43,8 @@ TMPDIR = None # Configure procs ################################ -def create_router_ospf( - tgen, topo, input_dict=None, build=False, - load_config=True): + +def create_router_ospf(tgen, topo, input_dict=None, build=False, load_config=True): """ API to configure ospf on router. @@ -84,19 +86,15 @@ def create_router_ospf( logger.debug("Router %s: 'ospf' not present in input_dict", router) continue - result = __create_ospf_global( - tgen, input_dict, router, build, load_config) + result = __create_ospf_global(tgen, input_dict, router, build, load_config) if result is True: ospf_data = input_dict[router]["ospf"] - logger.debug("Exiting lib API: create_router_ospf()") return result -def __create_ospf_global( - tgen, input_dict, router, build=False, - load_config=True): +def __create_ospf_global(tgen, input_dict, router, build=False, load_config=True): """ Helper API to create ospf global configuration. @@ -121,9 +119,9 @@ def __create_ospf_global( del_ospf_action = ospf_data.setdefault("delete", False) if del_ospf_action: config_data = ["no router ospf"] - result = create_common_configuration(tgen, router, config_data, - "ospf", build, - load_config) + result = create_common_configuration( + tgen, router, config_data, "ospf", build, load_config + ) return result config_data = [] @@ -137,34 +135,33 @@ def __create_ospf_global( if del_router_id: config_data.append("no ospf router-id") if router_id: - config_data.append("ospf router-id {}".format( - router_id)) + config_data.append("ospf router-id {}".format(router_id)) # redistribute command redistribute_data = ospf_data.setdefault("redistribute", {}) if redistribute_data: for redistribute in redistribute_data: if "redist_type" not in redistribute: - logger.debug("Router %s: 'redist_type' not present in " - "input_dict", router) + logger.debug( + "Router %s: 'redist_type' not present in " "input_dict", router + ) else: - cmd = "redistribute {}".format( - redistribute["redist_type"]) + cmd = "redistribute {}".format(redistribute["redist_type"]) for red_type in redistribute_data: if "route_map" in red_type: - cmd = cmd + " route-map {}".format(red_type[ - 'route_map']) + cmd = cmd + " route-map {}".format(red_type["route_map"]) del_action = redistribute.setdefault("delete", False) if del_action: cmd = "no {}".format(cmd) config_data.append(cmd) - #area information + # area information area_data = ospf_data.setdefault("area", {}) if area_data: for area in area_data: if "id" not in area: - logger.debug("Router %s: 'area id' not present in " - "input_dict", router) + logger.debug( + "Router %s: 'area id' not present in " "input_dict", router + ) else: cmd = "area {}".format(area["id"]) @@ -175,19 +172,21 @@ def __create_ospf_global( if del_action: cmd = "no {}".format(cmd) config_data.append(cmd) - result = create_common_configuration(tgen, router, config_data, - "ospf", build, load_config) + result = create_common_configuration( + tgen, router, config_data, "ospf", build, load_config + ) # summary information summary_data = ospf_data.setdefault("summary-address", {}) if summary_data: for summary in summary_data: if "prefix" not in summary: - logger.debug("Router %s: 'summary-address' not present in " - "input_dict", router) + logger.debug( + "Router %s: 'summary-address' not present in " "input_dict", + router, + ) else: - cmd = "summary {}/{}".format(summary["prefix"], summary[ - "mask"]) + cmd = "summary {}/{}".format(summary["prefix"], summary["mask"]) _tag = summary.setdefault("tag", None) if _tag: @@ -201,8 +200,9 @@ def __create_ospf_global( if del_action: cmd = "no {}".format(cmd) config_data.append(cmd) - result = create_common_configuration(tgen, router, config_data, - "ospf", build, load_config) + result = create_common_configuration( + tgen, router, config_data, "ospf", build, load_config + ) except InvalidCLIError: # Traceback @@ -214,9 +214,7 @@ def __create_ospf_global( return result -def create_router_ospf6( - tgen, topo, input_dict=None, build=False, - load_config=True): +def create_router_ospf6(tgen, topo, input_dict=None, build=False, load_config=True): """ API to configure ospf on router @@ -253,16 +251,13 @@ def create_router_ospf6( logger.debug("Router %s: 'ospf' not present in input_dict", router) continue - result = __create_ospf_global( - tgen, input_dict, router, build, load_config) + result = __create_ospf_global(tgen, input_dict, router, build, load_config) logger.debug("Exiting lib API: create_router_ospf()") return result -def __create_ospf6_global( - tgen, input_dict, router, build=False, - load_config=True): +def __create_ospf6_global(tgen, input_dict, router, build=False, load_config=True): """ Helper API to create ospf global configuration. @@ -286,9 +281,9 @@ def __create_ospf6_global( del_ospf_action = ospf_data.setdefault("delete", False) if del_ospf_action: config_data = ["no ipv6 router ospf"] - result = create_common_configuration(tgen, router, config_data, - "ospf", build, - load_config) + result = create_common_configuration( + tgen, router, config_data, "ospf", build, load_config + ) return result config_data = [] @@ -301,11 +296,11 @@ def __create_ospf6_global( if del_router_id: config_data.append("no ospf router-id") if router_id: - config_data.append("ospf router-id {}".format( - router_id)) + config_data.append("ospf router-id {}".format(router_id)) - result = create_common_configuration(tgen, router, config_data, - "ospf", build, load_config) + result = create_common_configuration( + tgen, router, config_data, "ospf", build, load_config + ) except InvalidCLIError: # Traceback errormsg = traceback.format_exc() @@ -315,8 +310,8 @@ def __create_ospf6_global( logger.debug("Exiting lib API: create_ospf_global()") return result -def config_ospf_interface (tgen, topo, input_dict=None, build=False, - load_config=True): + +def config_ospf_interface(tgen, topo, input_dict=None, build=False, load_config=True): """ API to configure ospf on router. @@ -356,22 +351,25 @@ def config_ospf_interface (tgen, topo, input_dict=None, build=False, input_dict = deepcopy(input_dict) for router in input_dict.keys(): config_data = [] - for lnk in input_dict[router]['links'].keys(): - if "ospf" not in input_dict[router]['links'][lnk]: - logger.debug("Router %s: ospf configs is not present in" - "input_dict, passed input_dict", router, - input_dict) + for lnk in input_dict[router]["links"].keys(): + if "ospf" not in input_dict[router]["links"][lnk]: + logger.debug( + "Router %s: ospf configs is not present in" + "input_dict, passed input_dict", + router, + input_dict, + ) continue - ospf_data = input_dict[router]['links'][lnk]['ospf'] + ospf_data = input_dict[router]["links"][lnk]["ospf"] data_ospf_area = ospf_data.setdefault("area", None) data_ospf_auth = ospf_data.setdefault("authentication", None) data_ospf_dr_priority = ospf_data.setdefault("priority", None) data_ospf_cost = ospf_data.setdefault("cost", None) try: - intf = topo['routers'][router]['links'][lnk]['interface'] + intf = topo["routers"][router]["links"][lnk]["interface"] except KeyError: - intf = topo['switches'][router]['links'][lnk]['interface'] + intf = topo["switches"][router]["links"][lnk]["interface"] # interface cmd = "interface {}".format(intf) @@ -383,58 +381,60 @@ def config_ospf_interface (tgen, topo, input_dict=None, build=False, config_data.append(cmd) # interface ospf auth if data_ospf_auth: - if data_ospf_auth == 'null': + if data_ospf_auth == "null": cmd = "ip ospf authentication null" - elif data_ospf_auth == 'message-digest': + elif data_ospf_auth == "message-digest": cmd = "ip ospf authentication message-digest" else: cmd = "ip ospf authentication" - if 'del_action' in ospf_data: + if "del_action" in ospf_data: cmd = "no {}".format(cmd) config_data.append(cmd) if "message-digest-key" in ospf_data: cmd = "ip ospf message-digest-key {} md5 {}".format( - ospf_data["message-digest-key"],ospf_data[ - "authentication-key"]) - if 'del_action' in ospf_data: + ospf_data["message-digest-key"], ospf_data["authentication-key"] + ) + if "del_action" in ospf_data: cmd = "no {}".format(cmd) config_data.append(cmd) - if "authentication-key" in ospf_data and \ - "message-digest-key" not in ospf_data: - cmd = "ip ospf authentication-key {}".format(ospf_data[ - "authentication-key"]) - if 'del_action' in ospf_data: + if ( + "authentication-key" in ospf_data + and "message-digest-key" not in ospf_data + ): + cmd = "ip ospf authentication-key {}".format( + ospf_data["authentication-key"] + ) + if "del_action" in ospf_data: cmd = "no {}".format(cmd) config_data.append(cmd) # interface ospf dr priority if data_ospf_dr_priority in ospf_data: - cmd = "ip ospf priority {}".format( - ospf_data["priority"]) - if 'del_action' in ospf_data: + cmd = "ip ospf priority {}".format(ospf_data["priority"]) + if "del_action" in ospf_data: cmd = "no {}".format(cmd) config_data.append(cmd) # interface ospf cost if data_ospf_cost in ospf_data: - cmd = "ip ospf cost {}".format( - ospf_data["cost"]) - if 'del_action' in ospf_data: + cmd = "ip ospf cost {}".format(ospf_data["cost"]) + if "del_action" in ospf_data: cmd = "no {}".format(cmd) config_data.append(cmd) if build: return config_data else: - result = create_common_configuration(tgen, router, config_data, - "interface_config", - build=build) + result = create_common_configuration( + tgen, router, config_data, "interface_config", build=build + ) logger.debug("Exiting lib API: create_igmp_config()") return result + def clear_ospf(tgen, router): """ This API is to clear ospf neighborship by running @@ -517,15 +517,16 @@ def verify_ospf_neighbor(tgen, topo, dut=None, input_dict=None, lan=False): result = False if input_dict: for router, rnode in tgen.routers().items(): - if 'ospf' not in topo['routers'][router]: + if "ospf" not in topo["routers"][router]: continue if dut is not None and dut != router: continue logger.info("Verifying OSPF neighborship on router %s:", router) - show_ospf_json = run_frr_cmd(rnode, - "show ip ospf neighbor all json", isjson=True) + show_ospf_json = run_frr_cmd( + rnode, "show ip ospf neighbor all json", isjson=True + ) # Verifying output dictionary show_ospf_json is empty or not if not bool(show_ospf_json): @@ -533,126 +534,134 @@ def verify_ospf_neighbor(tgen, topo, dut=None, input_dict=None, lan=False): return errormsg ospf_data_list = input_dict[router]["ospf"] - ospf_nbr_list = ospf_data_list['neighbors'] + ospf_nbr_list = ospf_data_list["neighbors"] for ospf_nbr, nbr_data in ospf_nbr_list.items(): - data_ip = topo['routers'][ospf_nbr]['links'] - data_rid = topo['routers'][ospf_nbr]['ospf']['router_id'] + data_ip = topo["routers"][ospf_nbr]["links"] + data_rid = topo["routers"][ospf_nbr]["ospf"]["router_id"] if ospf_nbr in data_ip: nbr_details = nbr_data[ospf_nbr] elif lan: - for switch in topo['switches']: - if 'ospf' in topo['switches'][switch]['links'][router]: - neighbor_ip = data_ip[switch]['ipv4'].split("/")[0] + for switch in topo["switches"]: + if "ospf" in topo["switches"][switch]["links"][router]: + neighbor_ip = data_ip[switch]["ipv4"].split("/")[0] else: continue else: - neighbor_ip = data_ip[router]['ipv4'].split("/")[0] + neighbor_ip = data_ip[router]["ipv4"].split("/")[0] nh_state = None neighbor_ip = neighbor_ip.lower() nbr_rid = data_rid try: - nh_state = show_ospf_json[nbr_rid][0][ - 'state'].split('/')[0] - intf_state = show_ospf_json[nbr_rid][0][ - 'state'].split('/')[1] + nh_state = show_ospf_json[nbr_rid][0]["state"].split("/")[0] + intf_state = show_ospf_json[nbr_rid][0]["state"].split("/")[1] except KeyError: - errormsg = "[DUT: {}] OSPF peer {} missing".format(router, - nbr_rid) + errormsg = "[DUT: {}] OSPF peer {} missing".format(router, nbr_rid) return errormsg - nbr_state = nbr_data.setdefault("state",None) - nbr_role = nbr_data.setdefault("role",None) + nbr_state = nbr_data.setdefault("state", None) + nbr_role = nbr_data.setdefault("role", None) if nbr_state: if nbr_state == nh_state: - logger.info("[DUT: {}] OSPF Nbr is {}:{} State {}".format - (router, ospf_nbr, nbr_rid, nh_state)) + logger.info( + "[DUT: {}] OSPF Nbr is {}:{} State {}".format( + router, ospf_nbr, nbr_rid, nh_state + ) + ) result = True else: - errormsg = ("[DUT: {}] OSPF is not Converged, neighbor" - " state is {}".format(router, nh_state)) + errormsg = ( + "[DUT: {}] OSPF is not Converged, neighbor" + " state is {}".format(router, nh_state) + ) return errormsg if nbr_role: if nbr_role == intf_state: - logger.info("[DUT: {}] OSPF Nbr is {}: {} Role {}".format( - router, ospf_nbr, nbr_rid, nbr_role)) + logger.info( + "[DUT: {}] OSPF Nbr is {}: {} Role {}".format( + router, ospf_nbr, nbr_rid, nbr_role + ) + ) else: - errormsg = ("[DUT: {}] OSPF is not Converged with rid" - "{}, role is {}".format(router, nbr_rid, intf_state)) + errormsg = ( + "[DUT: {}] OSPF is not Converged with rid" + "{}, role is {}".format(router, nbr_rid, intf_state) + ) return errormsg continue else: for router, rnode in tgen.routers().items(): - if 'ospf' not in topo['routers'][router]: + if "ospf" not in topo["routers"][router]: continue if dut is not None and dut != router: continue logger.info("Verifying OSPF neighborship on router %s:", router) - show_ospf_json = run_frr_cmd(rnode, - "show ip ospf neighbor all json", isjson=True) + show_ospf_json = run_frr_cmd( + rnode, "show ip ospf neighbor all json", isjson=True + ) # Verifying output dictionary show_ospf_json is empty or not if not bool(show_ospf_json): errormsg = "OSPF is not running" return errormsg ospf_data_list = topo["routers"][router]["ospf"] - ospf_neighbors = ospf_data_list['neighbors'] + ospf_neighbors = ospf_data_list["neighbors"] total_peer = 0 total_peer = len(ospf_neighbors.keys()) no_of_ospf_nbr = 0 - ospf_nbr_list = ospf_data_list['neighbors'] + ospf_nbr_list = ospf_data_list["neighbors"] no_of_peer = 0 for ospf_nbr, nbr_data in ospf_nbr_list.items(): if nbr_data: - data_ip = topo['routers'][nbr_data["nbr"]]['links'] - data_rid = topo['routers'][nbr_data["nbr"]][ - 'ospf']['router_id'] + data_ip = topo["routers"][nbr_data["nbr"]]["links"] + data_rid = topo["routers"][nbr_data["nbr"]]["ospf"]["router_id"] else: - data_ip = topo['routers'][ospf_nbr]['links'] - data_rid = topo['routers'][ospf_nbr]['ospf']['router_id'] + data_ip = topo["routers"][ospf_nbr]["links"] + data_rid = topo["routers"][ospf_nbr]["ospf"]["router_id"] if ospf_nbr in data_ip: nbr_details = nbr_data[ospf_nbr] elif lan: - for switch in topo['switches']: - if 'ospf' in topo['switches'][switch]['links'][router]: - neighbor_ip = data_ip[switch]['ipv4'].split("/")[0] + for switch in topo["switches"]: + if "ospf" in topo["switches"][switch]["links"][router]: + neighbor_ip = data_ip[switch]["ipv4"].split("/")[0] else: continue else: - neighbor_ip = data_ip[router]['ipv4'].split("/")[0] + neighbor_ip = data_ip[router]["ipv4"].split("/")[0] nh_state = None neighbor_ip = neighbor_ip.lower() nbr_rid = data_rid try: - nh_state = show_ospf_json[nbr_rid][0][ - 'state'].split('/')[0] + nh_state = show_ospf_json[nbr_rid][0]["state"].split("/")[0] except KeyError: - errormsg = "[DUT: {}] OSPF peer {} missing,from "\ - "{} ".format(router, - nbr_rid, ospf_nbr) + errormsg = "[DUT: {}] OSPF peer {} missing,from " "{} ".format( + router, nbr_rid, ospf_nbr + ) return errormsg - if nh_state == 'Full': + if nh_state == "Full": no_of_peer += 1 if no_of_peer == total_peer: logger.info("[DUT: {}] OSPF is Converged".format(router)) result = True else: - errormsg = ("[DUT: {}] OSPF is not Converged".format(router)) + errormsg = "[DUT: {}] OSPF is not Converged".format(router) return errormsg logger.debug("Exiting API: verify_ospf_neighbor()") return result + @retry(attempts=21, wait=2, return_is_str=True) -def verify_ospf_rib(tgen, dut, input_dict, next_hop=None, - tag=None, metric=None, fib=None): +def verify_ospf_rib( + tgen, dut, input_dict, next_hop=None, tag=None, metric=None, fib=None +): """ This API is to verify ospf routes by running show ip ospf route command. @@ -706,25 +715,28 @@ def verify_ospf_rib(tgen, dut, input_dict, next_hop=None, found_routes = [] missing_routes = [] - if "static_routes" in input_dict[routerInput] or \ - "prefix" in input_dict[routerInput]: + if ( + "static_routes" in input_dict[routerInput] + or "prefix" in input_dict[routerInput] + ): if "prefix" in input_dict[routerInput]: static_routes = input_dict[routerInput]["prefix"] else: static_routes = input_dict[routerInput]["static_routes"] - for static_route in static_routes: cmd = "{}".format(command) cmd = "{} json".format(cmd) - ospf_rib_json = run_frr_cmd(rnode, cmd, isjson=True) + ospf_rib_json = run_frr_cmd(rnode, cmd, isjson=True) # Verifying output dictionary ospf_rib_json is not empty if bool(ospf_rib_json) is False: - errormsg = "[DUT: {}] No routes found in OSPF route " \ + errormsg = ( + "[DUT: {}] No routes found in OSPF route " "table".format(router) + ) return errormsg network = static_route["network"] @@ -732,7 +744,6 @@ def verify_ospf_rib(tgen, dut, input_dict, next_hop=None, _tag = static_route.setdefault("tag", None) _rtype = static_route.setdefault("routeType", None) - # Generating IPs for verification ip_list = generate_ips(network, no_of_ip) st_found = False @@ -742,7 +753,7 @@ def verify_ospf_rib(tgen, dut, input_dict, next_hop=None, st_rt = str(ipaddr.IPNetwork(frr_unicode(st_rt))) _addr_type = validate_ip_address(st_rt) - if _addr_type != 'ipv4': + if _addr_type != "ipv4": continue if st_rt in ospf_rib_json: @@ -754,17 +765,26 @@ def verify_ospf_rib(tgen, dut, input_dict, next_hop=None, next_hop = [next_hop] for mnh in range(0, len(ospf_rib_json[st_rt])): - if 'fib' in ospf_rib_json[st_rt][ - mnh]["nexthops"][0]: - found_hops.append([rib_r[ - "ip"] for rib_r in ospf_rib_json[ - st_rt][mnh]["nexthops"]]) + if ( + "fib" + in ospf_rib_json[st_rt][mnh]["nexthops"][0] + ): + found_hops.append( + [ + rib_r["ip"] + for rib_r in ospf_rib_json[st_rt][mnh][ + "nexthops" + ] + ] + ) if found_hops[0]: - missing_list_of_nexthops = \ - set(found_hops[0]).difference(next_hop) - additional_nexthops_in_required_nhs = \ - set(next_hop).difference(found_hops[0]) + missing_list_of_nexthops = set( + found_hops[0] + ).difference(next_hop) + additional_nexthops_in_required_nhs = set( + next_hop + ).difference(found_hops[0]) if additional_nexthops_in_required_nhs: logger.info( @@ -772,13 +792,18 @@ def verify_ospf_rib(tgen, dut, input_dict, next_hop=None, "%s is not active for route %s in " "RIB of router %s\n", additional_nexthops_in_required_nhs, - st_rt, dut) + st_rt, + dut, + ) errormsg = ( "Nexthop {} is not active" " for route {} in RIB of router" " {}\n".format( - additional_nexthops_in_required_nhs, - st_rt, dut)) + additional_nexthops_in_required_nhs, + st_rt, + dut, + ) + ) return errormsg else: nh_found = True @@ -786,99 +811,111 @@ def verify_ospf_rib(tgen, dut, input_dict, next_hop=None, elif next_hop and fib is None: if type(next_hop) is not list: next_hop = [next_hop] - found_hops = [rib_r["ip"] for rib_r in - ospf_rib_json[st_rt][ - "nexthops"]] + found_hops = [ + rib_r["ip"] + for rib_r in ospf_rib_json[st_rt]["nexthops"] + ] if found_hops: - missing_list_of_nexthops = \ - set(found_hops).difference(next_hop) - additional_nexthops_in_required_nhs = \ - set(next_hop).difference(found_hops) + missing_list_of_nexthops = set( + found_hops + ).difference(next_hop) + additional_nexthops_in_required_nhs = set( + next_hop + ).difference(found_hops) if additional_nexthops_in_required_nhs: logger.info( - "Missing nexthop %s for route"\ - " %s in RIB of router %s\n", \ - additional_nexthops_in_required_nhs, \ - st_rt, dut) - errormsg=("Nexthop {} is Missing for "\ - "route {} in RIB of router {}\n".format( + "Missing nexthop %s for route" + " %s in RIB of router %s\n", additional_nexthops_in_required_nhs, - st_rt, dut)) + st_rt, + dut, + ) + errormsg = ( + "Nexthop {} is Missing for " + "route {} in RIB of router {}\n".format( + additional_nexthops_in_required_nhs, + st_rt, + dut, + ) + ) return errormsg else: nh_found = True if _rtype: - if "routeType" not in ospf_rib_json[ - st_rt]: - errormsg = ("[DUT: {}]: routeType missing" - "for route {} in OSPF RIB \n".\ - format(dut, st_rt)) + if "routeType" not in ospf_rib_json[st_rt]: + errormsg = ( + "[DUT: {}]: routeType missing" + "for route {} in OSPF RIB \n".format(dut, st_rt) + ) return errormsg - elif _rtype != ospf_rib_json[st_rt][ - "routeType"]: - errormsg = ("[DUT: {}]: routeType mismatch" - "for route {} in OSPF RIB \n".\ - format(dut, st_rt)) + elif _rtype != ospf_rib_json[st_rt]["routeType"]: + errormsg = ( + "[DUT: {}]: routeType mismatch" + "for route {} in OSPF RIB \n".format(dut, st_rt) + ) return errormsg else: - logger.info("DUT: {}]: Found routeType {}" - "for route {}".\ - format(dut, _rtype, st_rt)) + logger.info( + "DUT: {}]: Found routeType {}" + "for route {}".format(dut, _rtype, st_rt) + ) if tag: - if "tag" not in ospf_rib_json[ - st_rt]: - errormsg = ("[DUT: {}]: tag is not" - " present for" - " route {} in RIB \n".\ - format(dut, st_rt - )) + if "tag" not in ospf_rib_json[st_rt]: + errormsg = ( + "[DUT: {}]: tag is not" + " present for" + " route {} in RIB \n".format(dut, st_rt) + ) return errormsg - if _tag != ospf_rib_json[ - st_rt]["tag"]: - errormsg = ("[DUT: {}]: tag value {}" - " is not matched for" - " route {} in RIB \n".\ - format(dut, _tag, st_rt, - )) + if _tag != ospf_rib_json[st_rt]["tag"]: + errormsg = ( + "[DUT: {}]: tag value {}" + " is not matched for" + " route {} in RIB \n".format(dut, _tag, st_rt,) + ) return errormsg if metric is not None: - if "type2cost" not in ospf_rib_json[ - st_rt]: - errormsg = ("[DUT: {}]: metric is" - " not present for" - " route {} in RIB \n".\ - format(dut, st_rt)) + if "type2cost" not in ospf_rib_json[st_rt]: + errormsg = ( + "[DUT: {}]: metric is" + " not present for" + " route {} in RIB \n".format(dut, st_rt) + ) return errormsg - if metric != ospf_rib_json[ - st_rt]["type2cost"]: - errormsg = ("[DUT: {}]: metric value " - "{} is not matched for " - "route {} in RIB \n".\ - format(dut, metric, st_rt, - )) + if metric != ospf_rib_json[st_rt]["type2cost"]: + errormsg = ( + "[DUT: {}]: metric value " + "{} is not matched for " + "route {} in RIB \n".format(dut, metric, st_rt,) + ) return errormsg else: missing_routes.append(st_rt) if nh_found: - logger.info("[DUT: {}]: Found next_hop {} for all OSPF" - " routes in RIB".format(router, next_hop)) + logger.info( + "[DUT: {}]: Found next_hop {} for all OSPF" + " routes in RIB".format(router, next_hop) + ) if len(missing_routes) > 0: - errormsg = ("[DUT: {}]: Missing route in RIB, " - "routes: {}".\ - format(dut, missing_routes)) + errormsg = "[DUT: {}]: Missing route in RIB, " "routes: {}".format( + dut, missing_routes + ) return errormsg if found_routes: - logger.info("[DUT: %s]: Verified routes in RIB, found" - " routes are: %s\n", dut, found_routes) + logger.info( + "[DUT: %s]: Verified routes in RIB, found" " routes are: %s\n", + dut, + found_routes, + ) result = True logger.info("Exiting lib API: verify_ospf_rib()") @@ -886,7 +923,7 @@ def verify_ospf_rib(tgen, dut, input_dict, next_hop=None, @retry(attempts=10, wait=2, return_is_str=True) -def verify_ospf_interface(tgen, topo, dut=None,lan=False, input_dict=None): +def verify_ospf_interface(tgen, topo, dut=None, lan=False, input_dict=None): """ This API is to verify ospf routes by running show ip ospf interface command. @@ -928,15 +965,14 @@ def verify_ospf_interface(tgen, topo, dut=None,lan=False, input_dict=None): logger.debug("Entering lib API: verify_ospf_interface()") result = False for router, rnode in tgen.routers().items(): - if 'ospf' not in topo['routers'][router]: + if "ospf" not in topo["routers"][router]: continue if dut is not None and dut != router: continue logger.info("Verifying OSPF interface on router %s:", router) - show_ospf_json = run_frr_cmd(rnode, "show ip ospf interface json", - isjson=True) + show_ospf_json = run_frr_cmd(rnode, "show ip ospf interface json", isjson=True) # Verifying output dictionary show_ospf_json is empty or not if not bool(show_ospf_json): @@ -946,19 +982,29 @@ def verify_ospf_interface(tgen, topo, dut=None,lan=False, input_dict=None): # To find neighbor ip type ospf_intf_data = input_dict[router]["links"] for ospf_intf, intf_data in ospf_intf_data.items(): - intf = topo['routers'][router]['links'][ospf_intf]['interface'] - if intf in show_ospf_json['interfaces']: - for intf_attribute in intf_data['ospf']: - if intf_data['ospf'][intf_attribute] == show_ospf_json[ - 'interfaces'][intf][intf_attribute]: - logger.info("[DUT: %s] OSPF interface %s: %s is %s", - router, intf, intf_attribute, intf_data['ospf'][ - intf_attribute]) + intf = topo["routers"][router]["links"][ospf_intf]["interface"] + if intf in show_ospf_json["interfaces"]: + for intf_attribute in intf_data["ospf"]: + if ( + intf_data["ospf"][intf_attribute] + == show_ospf_json["interfaces"][intf][intf_attribute] + ): + logger.info( + "[DUT: %s] OSPF interface %s: %s is %s", + router, + intf, + intf_attribute, + intf_data["ospf"][intf_attribute], + ) else: - errormsg= "[DUT: {}] OSPF interface {}: {} is {}, \ - Expected is {}".format(router, intf, intf_attribute, - intf_data['ospf'][intf_attribute], show_ospf_json[ - 'interfaces'][intf][intf_attribute]) + errormsg = "[DUT: {}] OSPF interface {}: {} is {}, \ + Expected is {}".format( + router, + intf, + intf_attribute, + intf_data["ospf"][intf_attribute], + show_ospf_json["interfaces"][intf][intf_attribute], + ) return errormsg result = True logger.debug("Exiting API: verify_ospf_interface()") @@ -1016,16 +1062,14 @@ def verify_ospf_database(tgen, topo, dut, input_dict): router = dut logger.debug("Entering lib API: verify_ospf_database()") - if 'ospf' not in topo['routers'][dut]: - errormsg = "[DUT: {}] OSPF is not configured on the router.".format( - dut) + if "ospf" not in topo["routers"][dut]: + errormsg = "[DUT: {}] OSPF is not configured on the router.".format(dut) return errormsg rnode = tgen.routers()[dut] logger.info("Verifying OSPF interface on router %s:", dut) - show_ospf_json = run_frr_cmd(rnode, "show ip ospf database json", - isjson=True) + show_ospf_json = run_frr_cmd(rnode, "show ip ospf database json", isjson=True) # Verifying output dictionary show_ospf_json is empty or not if not bool(show_ospf_json): errormsg = "OSPF is not running" @@ -1033,82 +1077,103 @@ def verify_ospf_database(tgen, topo, dut, input_dict): # for inter and inter lsa's ospf_db_data = input_dict.setdefault("areas", None) - ospf_external_lsa = input_dict.setdefault( - 'AS External Link States', None) + ospf_external_lsa = input_dict.setdefault("AS External Link States", None) if ospf_db_data: - for ospf_area, area_lsa in ospf_db_data.items(): - if ospf_area in show_ospf_json['areas']: - if 'Router Link States' in area_lsa: - for lsa in area_lsa['Router Link States']: - if lsa in show_ospf_json['areas'][ospf_area][ - 'Router Link States']: - logger.info( - "[DUT: %s] OSPF LSDB area %s:Router " - "LSA %s", router, ospf_area, lsa) - result = True - else: - errormsg = \ - "[DUT: {}] OSPF LSDB area {}: expected" \ + for ospf_area, area_lsa in ospf_db_data.items(): + if ospf_area in show_ospf_json["areas"]: + if "Router Link States" in area_lsa: + for lsa in area_lsa["Router Link States"]: + if ( + lsa + in show_ospf_json["areas"][ospf_area]["Router Link States"] + ): + logger.info( + "[DUT: %s] OSPF LSDB area %s:Router " "LSA %s", + router, + ospf_area, + lsa, + ) + result = True + else: + errormsg = ( + "[DUT: {}] OSPF LSDB area {}: expected" " Router LSA is {}".format(router, ospf_area, lsa) - return errormsg - if 'Net Link States' in area_lsa: - for lsa in area_lsa['Net Link States']: - if lsa in show_ospf_json['areas'][ospf_area][ - 'Net Link States']: - logger.info( - "[DUT: %s] OSPF LSDB area %s:Network " - "LSA %s", router, ospf_area, lsa) - result = True - else: - errormsg = \ - "[DUT: {}] OSPF LSDB area {}: expected" \ + ) + return errormsg + if "Net Link States" in area_lsa: + for lsa in area_lsa["Net Link States"]: + if lsa in show_ospf_json["areas"][ospf_area]["Net Link States"]: + logger.info( + "[DUT: %s] OSPF LSDB area %s:Network " "LSA %s", + router, + ospf_area, + lsa, + ) + result = True + else: + errormsg = ( + "[DUT: {}] OSPF LSDB area {}: expected" " Network LSA is {}".format(router, ospf_area, lsa) - return errormsg - if 'Summary Link States' in area_lsa: - for lsa in area_lsa['Summary Link States']: - if lsa in show_ospf_json['areas'][ospf_area][ - 'Summary Link States']: - logger.info( - "[DUT: %s] OSPF LSDB area %s:Summary " - "LSA %s", router, ospf_area, lsa) - result = True - else: - errormsg = \ - "[DUT: {}] OSPF LSDB area {}: expected" \ + ) + return errormsg + if "Summary Link States" in area_lsa: + for lsa in area_lsa["Summary Link States"]: + if ( + lsa + in show_ospf_json["areas"][ospf_area]["Summary Link States"] + ): + logger.info( + "[DUT: %s] OSPF LSDB area %s:Summary " "LSA %s", + router, + ospf_area, + lsa, + ) + result = True + else: + errormsg = ( + "[DUT: {}] OSPF LSDB area {}: expected" " Summary LSA is {}".format(router, ospf_area, lsa) - return errormsg - if 'ASBR-Summary Link States' in area_lsa: - for lsa in area_lsa['ASBR-Summary Link States']: - if lsa in show_ospf_json['areas'][ospf_area][ - 'ASBR-Summary Link States']: - logger.info( - "[DUT: %s] OSPF LSDB area %s:ASBR Summary " - "LSA %s", router, ospf_area, lsa) - result = True - else: - errormsg = \ - "[DUT: {}] OSPF LSDB area {}: expected" \ - " ASBR Summary LSA is {}".format( - router, ospf_area, lsa) - return errormsg + ) + return errormsg + if "ASBR-Summary Link States" in area_lsa: + for lsa in area_lsa["ASBR-Summary Link States"]: + if ( + lsa + in show_ospf_json["areas"][ospf_area][ + "ASBR-Summary Link States" + ] + ): + logger.info( + "[DUT: %s] OSPF LSDB area %s:ASBR Summary " "LSA %s", + router, + ospf_area, + lsa, + ) + result = True + else: + errormsg = ( + "[DUT: {}] OSPF LSDB area {}: expected" + " ASBR Summary LSA is {}".format(router, ospf_area, lsa) + ) + return errormsg if ospf_external_lsa: - for ospf_ext_lsa, ext_lsa_data in ospf_external_lsa.items(): - if ospf_ext_lsa in show_ospf_json['AS External Link States']: - logger.info( - "[DUT: %s] OSPF LSDB:External LSA %s", - router, ospf_ext_lsa) - result = True - else: - errormsg = \ - "[DUT: {}] OSPF LSDB : expected" \ - " External LSA is {}".format(router, ospf_ext_lsa) - return errormsg + for ospf_ext_lsa, ext_lsa_data in ospf_external_lsa.items(): + if ospf_ext_lsa in show_ospf_json["AS External Link States"]: + logger.info( + "[DUT: %s] OSPF LSDB:External LSA %s", router, ospf_ext_lsa + ) + result = True + else: + errormsg = ( + "[DUT: {}] OSPF LSDB : expected" + " External LSA is {}".format(router, ospf_ext_lsa) + ) + return errormsg logger.debug("Exiting API: verify_ospf_database()") return result - @retry(attempts=10, wait=2, return_is_str=True) def verify_ospf_summary(tgen, topo, dut, input_dict): """ @@ -1146,14 +1211,12 @@ def verify_ospf_summary(tgen, topo, dut, input_dict): logger.info("Verifying OSPF summary on router %s:", router) - if 'ospf' not in topo['routers'][dut]: - errormsg = "[DUT: {}] OSPF is not configured on the router.".format( - router) + if "ospf" not in topo["routers"][dut]: + errormsg = "[DUT: {}] OSPF is not configured on the router.".format(router) return errormsg rnode = tgen.routers()[dut] - show_ospf_json = run_frr_cmd(rnode, "show ip ospf summary detail json", - isjson=True) + show_ospf_json = run_frr_cmd(rnode, "show ip ospf summary detail json", isjson=True) # Verifying output dictionary show_ospf_json is empty or not if not bool(show_ospf_json): @@ -1165,17 +1228,25 @@ def verify_ospf_summary(tgen, topo, dut, input_dict): for ospf_summ, summ_data in ospf_summary_data.items(): if ospf_summ not in show_ospf_json: continue - summary = ospf_summary_data[ospf_summ]['Summary address'] + summary = ospf_summary_data[ospf_summ]["Summary address"] if summary in show_ospf_json: for summ in summ_data: if summ_data[summ] == show_ospf_json[summary][summ]: - logger.info("[DUT: %s] OSPF summary %s:%s is %s", - router, summary, summ, summ_data[summ]) + logger.info( + "[DUT: %s] OSPF summary %s:%s is %s", + router, + summary, + summ, + summ_data[summ], + ) result = True else: - errormsg = ("[DUT: {}] OSPF summary {}:{} is %s, " - "Expected is {}".format(router,summary, summ, - show_ospf_json[summary][summ])) + errormsg = ( + "[DUT: {}] OSPF summary {}:{} is %s, " + "Expected is {}".format( + router, summary, summ, show_ospf_json[summary][summ] + ) + ) return errormsg logger.debug("Exiting API: verify_ospf_summary()") diff --git a/tests/topotests/lib/test/test_json.py b/tests/topotests/lib/test/test_json.py index 7a061a9bc6..b85e193d3b 100755 --- a/tests/topotests/lib/test/test_json.py +++ b/tests/topotests/lib/test/test_json.py @@ -296,7 +296,7 @@ def test_json_list_ordered(): ] dsub1 = [ - '__ordered__', + "__ordered__", "some string", {"id": 1, "value": "abc"}, 123, @@ -312,28 +312,28 @@ def test_json_list_exact_matching(): {"id": 1, "value": "abc"}, "some string", 123, - [1,2,3], + [1, 2, 3], ] dsub1 = [ "some string", {"id": 1, "value": "abc"}, 123, - [1,2,3], + [1, 2, 3], ] dsub2 = [ {"id": 1}, "some string", 123, - [1,2,3], + [1, 2, 3], ] dsub3 = [ {"id": 1, "value": "abc"}, "some string", 123, - [1,3,2], + [1, 3, 2], ] assert json_cmp(dcomplete, dsub1, exact=True) is not None @@ -344,30 +344,30 @@ def test_json_object_exact_matching(): "Test JSON object on exact matching using the 'exact' parameter." dcomplete = { - 'a': {"id": 1, "value": "abc"}, - 'b': "some string", - 'c': 123, - 'd': [1,2,3], + "a": {"id": 1, "value": "abc"}, + "b": "some string", + "c": 123, + "d": [1, 2, 3], } dsub1 = { - 'a': {"id": 1, "value": "abc"}, - 'c': 123, - 'd': [1,2,3], + "a": {"id": 1, "value": "abc"}, + "c": 123, + "d": [1, 2, 3], } dsub2 = { - 'a': {"id": 1}, - 'b': "some string", - 'c': 123, - 'd': [1,2,3], + "a": {"id": 1}, + "b": "some string", + "c": 123, + "d": [1, 2, 3], } dsub3 = { - 'a': {"id": 1, "value": "abc"}, - 'b': "some string", - 'c': 123, - 'd': [1,3], + "a": {"id": 1, "value": "abc"}, + "b": "some string", + "c": 123, + "d": [1, 3], } assert json_cmp(dcomplete, dsub1, exact=True) is not None @@ -382,35 +382,35 @@ def test_json_list_asterisk_matching(): {"id": 1, "value": "abc"}, "some string", 123, - [1,2,3], + [1, 2, 3], ] dsub1 = [ - '*', + "*", "some string", 123, - [1,2,3], + [1, 2, 3], ] dsub2 = [ - {"id": '*', "value": "abc"}, + {"id": "*", "value": "abc"}, "some string", 123, - [1,2,3], + [1, 2, 3], ] dsub3 = [ {"id": 1, "value": "abc"}, "some string", 123, - [1,'*',3], + [1, "*", 3], ] dsub4 = [ - '*', + "*", "some string", - '*', - [1,2,3], + "*", + [1, 2, 3], ] assert json_cmp(dcomplete, dsub1) is None @@ -423,38 +423,38 @@ def test_json_object_asterisk_matching(): "Test JSON object value elements on matching '*' as a placeholder for arbitrary data." dcomplete = { - 'a': {"id": 1, "value": "abc"}, - 'b': "some string", - 'c': 123, - 'd': [1,2,3], + "a": {"id": 1, "value": "abc"}, + "b": "some string", + "c": 123, + "d": [1, 2, 3], } dsub1 = { - 'a': '*', - 'b': "some string", - 'c': 123, - 'd': [1,2,3], + "a": "*", + "b": "some string", + "c": 123, + "d": [1, 2, 3], } dsub2 = { - 'a': {"id": 1, "value": "abc"}, - 'b': "some string", - 'c': 123, - 'd': [1,'*',3], + "a": {"id": 1, "value": "abc"}, + "b": "some string", + "c": 123, + "d": [1, "*", 3], } dsub3 = { - 'a': {"id": '*', "value": "abc"}, - 'b': "some string", - 'c': 123, - 'd': [1,2,3], + "a": {"id": "*", "value": "abc"}, + "b": "some string", + "c": 123, + "d": [1, 2, 3], } dsub4 = { - 'a': '*', - 'b': "some string", - 'c': '*', - 'd': [1,2,3], + "a": "*", + "b": "some string", + "c": "*", + "d": [1, 2, 3], } assert json_cmp(dcomplete, dsub1) is None @@ -465,37 +465,12 @@ def test_json_object_asterisk_matching(): def test_json_list_nested_with_objects(): - dcomplete = [ - { - "key": 1, - "list": [ - 123 - ] - }, - { - "key": 2, - "list": [ - 123 - ] - } - ] + dcomplete = [{"key": 1, "list": [123]}, {"key": 2, "list": [123]}] - dsub1 = [ - { - "key": 2, - "list": [ - 123 - ] - }, - { - "key": 1, - "list": [ - 123 - ] - } - ] + dsub1 = [{"key": 2, "list": [123]}, {"key": 1, "list": [123]}] assert json_cmp(dcomplete, dsub1) is None + if __name__ == "__main__": sys.exit(pytest.main()) diff --git a/tests/topotests/lib/topogen.py b/tests/topotests/lib/topogen.py index ffdcb683e7..3e92bd7565 100644 --- a/tests/topotests/lib/topogen.py +++ b/tests/topotests/lib/topogen.py @@ -703,11 +703,9 @@ class TopoRouter(TopoGear): Stop router, private internal version * Kill daemons """ - self.logger.debug("stopping: wait {}, assert {}".format( - wait, assertOnError)) + self.logger.debug("stopping: wait {}, assert {}".format(wait, assertOnError)) return self.tgen.net[self.name].stopRouter(wait, assertOnError) - def stop(self): """ Stop router cleanly: @@ -724,7 +722,7 @@ class TopoRouter(TopoGear): * Start daemons (e.g. FRR) * Configure daemon logging files """ - self.logger.debug('starting') + self.logger.debug("starting") nrouter = self.tgen.net[self.name] result = nrouter.startRouterDaemons(daemons) @@ -734,10 +732,12 @@ class TopoRouter(TopoGear): for d in daemons: if enabled == 0: continue - self.vtysh_cmd('configure terminal\nlog commands\nlog file {}.log'.\ - format(daemon), daemon=daemon) + self.vtysh_cmd( + "configure terminal\nlog commands\nlog file {}.log".format(daemon), + daemon=daemon, + ) - if result != '': + if result != "": self.tgen.set_error(result) return result @@ -747,7 +747,7 @@ class TopoRouter(TopoGear): Kill specific daemon(user defined daemon only) forcefully using SIGKILL """ - self.logger.debug('Killing daemons using SIGKILL..') + self.logger.debug("Killing daemons using SIGKILL..") return self.tgen.net[self.name].killRouterDaemons(daemons, wait, assertOnError) def vtysh_cmd(self, command, isjson=False, daemon=None): @@ -1070,7 +1070,7 @@ def diagnose_env_linux(): "isisd", "pimd", "ldpd", - "pbrd" + "pbrd", ]: path = os.path.join(frrdir, fname) if not os.path.isfile(path): diff --git a/tests/topotests/lib/topojson.py b/tests/topotests/lib/topojson.py index 6535918e36..f2fafa5e2a 100644 --- a/tests/topotests/lib/topojson.py +++ b/tests/topotests/lib/topojson.py @@ -45,6 +45,7 @@ from lib.common_config import ( from lib.bgp import create_router_bgp from lib.ospf import create_router_ospf + ROUTER_LIST = [] @@ -214,13 +215,14 @@ def build_topo_from_json(tgen, topo): while listSwitches != []: curSwitch = listSwitches.pop(0) # Physical Interfaces - if "links" in topo['switches'][curSwitch]: + if "links" in topo["switches"][curSwitch]: for destRouterLink, data in sorted( - topo['switches'][curSwitch]['links'].items()): + topo["switches"][curSwitch]["links"].items() + ): # Loopback interfaces if "dst_node" in data: - destRouter = data['dst_node'] + destRouter = data["dst_node"] elif "-" in destRouterLink: # Spliting and storing destRouterLink data in tempList @@ -232,39 +234,55 @@ def build_topo_from_json(tgen, topo): if destRouter in listAllRouters: - topo['routers'][destRouter]['links'][curSwitch] = \ - deepcopy(topo['switches'][curSwitch]['links'][destRouterLink]) + topo["routers"][destRouter]["links"][curSwitch] = deepcopy( + topo["switches"][curSwitch]["links"][destRouterLink] + ) # Assigning name to interfaces - topo['routers'][destRouter]['links'][curSwitch]['interface'] = \ - '{}-{}-eth{}'.format(destRouter, curSwitch, topo['routers'] \ - [destRouter]['nextIfname']) + topo["routers"][destRouter]["links"][curSwitch][ + "interface" + ] = "{}-{}-eth{}".format( + destRouter, curSwitch, topo["routers"][destRouter]["nextIfname"] + ) - topo['switches'][curSwitch]['links'][destRouter]['interface'] = \ - '{}-{}-eth{}'.format(curSwitch, destRouter, topo['routers'] \ - [destRouter]['nextIfname']) + topo["switches"][curSwitch]["links"][destRouter][ + "interface" + ] = "{}-{}-eth{}".format( + curSwitch, destRouter, topo["routers"][destRouter]["nextIfname"] + ) - topo['routers'][destRouter]['nextIfname'] += 1 + topo["routers"][destRouter]["nextIfname"] += 1 # Add links - dictSwitches[curSwitch].add_link(tgen.gears[destRouter], \ - topo['switches'][curSwitch]['links'][destRouter]['interface'], - topo['routers'][destRouter]['links'][curSwitch]['interface'], - ) + dictSwitches[curSwitch].add_link( + tgen.gears[destRouter], + topo["switches"][curSwitch]["links"][destRouter]["interface"], + topo["routers"][destRouter]["links"][curSwitch]["interface"], + ) # IPv4 - if 'ipv4' in topo['routers'][destRouter]['links'][curSwitch]: - if topo['routers'][destRouter]['links'][curSwitch]['ipv4'] == 'auto': - topo['routers'][destRouter]['links'][curSwitch]['ipv4'] = \ - '{}/{}'.format(ipv4Next, topo['link_ip_start'][ \ - 'v4mask']) + if "ipv4" in topo["routers"][destRouter]["links"][curSwitch]: + if ( + topo["routers"][destRouter]["links"][curSwitch]["ipv4"] + == "auto" + ): + topo["routers"][destRouter]["links"][curSwitch][ + "ipv4" + ] = "{}/{}".format( + ipv4Next, topo["link_ip_start"]["v4mask"] + ) ipv4Next += 1 # IPv6 - if 'ipv6' in topo['routers'][destRouter]['links'][curSwitch]: - if topo['routers'][destRouter]['links'][curSwitch]['ipv6'] == 'auto': - topo['routers'][destRouter]['links'][curSwitch]['ipv6'] = \ - '{}/{}'.format(ipv6Next, topo['link_ip_start'][ \ - 'v6mask']) + if "ipv6" in topo["routers"][destRouter]["links"][curSwitch]: + if ( + topo["routers"][destRouter]["links"][curSwitch]["ipv6"] + == "auto" + ): + topo["routers"][destRouter]["links"][curSwitch][ + "ipv6" + ] = "{}/{}".format( + ipv6Next, topo["link_ip_start"]["v6mask"] + ) ipv6Next = ipaddr.IPv6Address(int(ipv6Next) + ipv6Step) logger.debug( @@ -294,7 +312,7 @@ def build_config_from_json(tgen, topo, save_bkup=True): ("bgp_community_list", create_bgp_community_lists), ("route_maps", create_route_maps), ("bgp", create_router_bgp), - ("ospf", create_router_ospf) + ("ospf", create_router_ospf), ] ) diff --git a/tests/topotests/lib/topotest.py b/tests/topotests/lib/topotest.py index a187971e41..4b18862101 100644 --- a/tests/topotests/lib/topotest.py +++ b/tests/topotests/lib/topotest.py @@ -51,8 +51,9 @@ from mininet.log import setLogLevel, info from mininet.cli import CLI from mininet.link import Intf + def gdb_core(obj, daemon, corefiles): - gdbcmds = ''' + gdbcmds = """ info threads bt full disassemble @@ -66,21 +67,21 @@ def gdb_core(obj, daemon, corefiles): disassemble up disassemble - ''' - gdbcmds = [['-ex', i.strip()] for i in gdbcmds.strip().split('\n')] + """ + gdbcmds = [["-ex", i.strip()] for i in gdbcmds.strip().split("\n")] gdbcmds = [item for sl in gdbcmds for item in sl] daemon_path = os.path.join(obj.daemondir, daemon) backtrace = subprocess.check_output( - ['gdb', daemon_path, corefiles[0], '--batch'] + gdbcmds + ["gdb", daemon_path, corefiles[0], "--batch"] + gdbcmds ) sys.stderr.write( - "\n%s: %s crashed. Core file found - Backtrace follows:\n" - % (obj.name, daemon) + "\n%s: %s crashed. Core file found - Backtrace follows:\n" % (obj.name, daemon) ) sys.stderr.write("%s" % backtrace) return backtrace + class json_cmp_result(object): "json_cmp result class for better assertion messages" @@ -739,7 +740,8 @@ def ip4_vrf_route(node): } """ output = normalize_text( - node.run("ip route show vrf {0}-cust1".format(node.name))).splitlines() + node.run("ip route show vrf {0}-cust1".format(node.name)) + ).splitlines() result = {} for line in output: @@ -821,7 +823,8 @@ def ip6_vrf_route(node): } """ output = normalize_text( - node.run("ip -6 route show vrf {0}-cust1".format(node.name))).splitlines() + node.run("ip -6 route show vrf {0}-cust1".format(node.name)) + ).splitlines() result = {} for line in output: columns = line.split(" ") @@ -992,7 +995,7 @@ class Router(Node): # Backward compatibility: # Load configuration defaults like topogen. self.config_defaults = configparser.ConfigParser( - defaults = { + defaults={ "verbosity": "info", "frrdir": "/usr/lib/frr", "routertype": "frr", @@ -1095,7 +1098,7 @@ class Router(Node): if re.search(r"No such file or directory", rundaemons): return 0 if rundaemons is not None: - bet = rundaemons.split('\n') + bet = rundaemons.split("\n") for d in bet[:-1]: daemonpid = self.cmd("cat %s" % d.rstrip()).rstrip() if daemonpid.isdigit() and pid_exists(int(daemonpid)): @@ -1110,24 +1113,28 @@ class Router(Node): if re.search(r"No such file or directory", rundaemons): return errors if rundaemons is not None: - dmns = rundaemons.split('\n') + dmns = rundaemons.split("\n") # Exclude empty string at end of list for d in dmns[:-1]: daemonpid = self.cmd("cat %s" % d.rstrip()).rstrip() if daemonpid.isdigit() and pid_exists(int(daemonpid)): daemonname = os.path.basename(d.rstrip().rsplit(".", 1)[0]) - logger.info( - "{}: stopping {}".format( - self.name, daemonname - ) - ) + logger.info("{}: stopping {}".format(self.name, daemonname)) try: os.kill(int(daemonpid), signal.SIGTERM) except OSError as err: if err.errno == errno.ESRCH: - logger.error("{}: {} left a dead pidfile (pid={})".format(self.name, daemonname, daemonpid)) + logger.error( + "{}: {} left a dead pidfile (pid={})".format( + self.name, daemonname, daemonpid + ) + ) else: - logger.info("{}: {} could not kill pid {}: {}".format(self.name, daemonname, daemonpid, str(err))) + logger.info( + "{}: {} could not kill pid {}: {}".format( + self.name, daemonname, daemonpid, str(err) + ) + ) if not wait: return errors @@ -1135,18 +1142,28 @@ class Router(Node): running = self.listDaemons() if running: - sleep(0.1, "{}: waiting for daemons stopping: {}".format(self.name, ', '.join(running))) + sleep( + 0.1, + "{}: waiting for daemons stopping: {}".format( + self.name, ", ".join(running) + ), + ) running = self.listDaemons() counter = 20 while counter > 0 and running: - sleep(0.5, "{}: waiting for daemons stopping: {}".format(self.name, ', '.join(running))) + sleep( + 0.5, + "{}: waiting for daemons stopping: {}".format( + self.name, ", ".join(running) + ), + ) running = self.listDaemons() counter -= 1 if running: # 2nd round of kill if daemons didn't exit - dmns = rundaemons.split('\n') + dmns = rundaemons.split("\n") # Exclude empty string at end of list for d in dmns[:-1]: daemonpid = self.cmd("cat %s" % d.rstrip()).rstrip() @@ -1295,11 +1312,12 @@ class Router(Node): def startRouterDaemons(self, daemons=None): "Starts all FRR daemons for this router." - bundle_data = '' + bundle_data = "" - if os.path.exists('/etc/frr/support_bundle_commands.conf'): + if os.path.exists("/etc/frr/support_bundle_commands.conf"): bundle_data = subprocess.check_output( - ["cat /etc/frr/support_bundle_commands.conf"], shell=True) + ["cat /etc/frr/support_bundle_commands.conf"], shell=True + ) self.cmd( "echo '{}' > /etc/frr/support_bundle_commands.conf".format(bundle_data) ) @@ -1400,7 +1418,7 @@ class Router(Node): for daemon in daemons: if rundaemons is not None and daemon in rundaemons: numRunning = 0 - dmns = rundaemons.split('\n') + dmns = rundaemons.split("\n") # Exclude empty string at end of list for d in dmns[:-1]: if re.search(r"%s" % daemon, d): @@ -1738,8 +1756,9 @@ class LegacySwitch(OVSSwitch): OVSSwitch.__init__(self, name, failMode="standalone", **params) self.switchIP = None + def frr_unicode(s): - '''Convert string to unicode, depending on python version''' + """Convert string to unicode, depending on python version""" if sys.version_info[0] > 2: return s else: diff --git a/tests/topotests/ospf-sr-topo1/test_ospf_sr_topo1.py b/tests/topotests/ospf-sr-topo1/test_ospf_sr_topo1.py index 86fc90e665..53322f432f 100644 --- a/tests/topotests/ospf-sr-topo1/test_ospf_sr_topo1.py +++ b/tests/topotests/ospf-sr-topo1/test_ospf_sr_topo1.py @@ -65,22 +65,22 @@ class OspfSrTopo(Topo): tgen.add_router("r{}".format(routern)) # Interconect router 1 and 2 with 2 links - switch = tgen.add_switch('s1') - switch.add_link(tgen.gears['r1']) - switch.add_link(tgen.gears['r2']) - switch = tgen.add_switch('s2') - switch.add_link(tgen.gears['r1']) - switch.add_link(tgen.gears['r2']) + switch = tgen.add_switch("s1") + switch.add_link(tgen.gears["r1"]) + switch.add_link(tgen.gears["r2"]) + switch = tgen.add_switch("s2") + switch.add_link(tgen.gears["r1"]) + switch.add_link(tgen.gears["r2"]) # Interconect router 3 and 2 - switch = tgen.add_switch('s3') - switch.add_link(tgen.gears['r3']) - switch.add_link(tgen.gears['r2']) + switch = tgen.add_switch("s3") + switch.add_link(tgen.gears["r3"]) + switch.add_link(tgen.gears["r2"]) # Interconect router 4 and 2 - switch = tgen.add_switch('s4') - switch.add_link(tgen.gears['r4']) - switch.add_link(tgen.gears['r2']) + switch = tgen.add_switch("s4") + switch.add_link(tgen.gears["r4"]) + switch.add_link(tgen.gears["r2"]) def setup_module(mod): @@ -134,12 +134,13 @@ def test_ospf_sr(): # Run test function until we get an result. Wait at most 60 seconds. rt = tgen.gears[router] test_func = partial( - topotest.router_json_cmp, rt, 'show ip ospf database segment-routing json', expected + topotest.router_json_cmp, + rt, + "show ip ospf database segment-routing json", + expected, ) rv, diff = topotest.run_and_expect(test_func, None, count=25, wait=3) - assert rv, "OSPF did not start Segment Routing on {}:\n{}".format( - router, diff - ) + assert rv, "OSPF did not start Segment Routing on {}:\n{}".format(router, diff) def test_ospf_kernel_route(): @@ -169,7 +170,7 @@ def test_ospf_kernel_route(): } ] """ - out = rt.vtysh_cmd('show mpls table json', isjson=True) + out = rt.vtysh_cmd("show mpls table json", isjson=True) outlist = [] for key in out.keys(): diff --git a/tests/topotests/ospf-topo2/test_ospf_topo2.py b/tests/topotests/ospf-topo2/test_ospf_topo2.py index 79e8e6bf58..6451f5fb32 100644 --- a/tests/topotests/ospf-topo2/test_ospf_topo2.py +++ b/tests/topotests/ospf-topo2/test_ospf_topo2.py @@ -35,7 +35,7 @@ import json # Save the Current Working Directory to find configuration files. CWD = os.path.dirname(os.path.realpath(__file__)) -sys.path.append(os.path.join(CWD, '../')) +sys.path.append(os.path.join(CWD, "../")) # pylint: disable=C0413 # Import topogen and topotest helpers @@ -46,28 +46,30 @@ from lib.topolog import logger # Required to instantiate the topology builder class. from mininet.topo import Topo + class OSPFTopo(Topo): "Test topology builder" + def build(self, *_args, **_opts): "Build function" tgen = get_topogen(self) # Create 4 routers for routern in range(1, 3): - tgen.add_router('r{}'.format(routern)) + tgen.add_router("r{}".format(routern)) # Create a empty network for router 1 - switch = tgen.add_switch('s1') - switch.add_link(tgen.gears['r1']) + switch = tgen.add_switch("s1") + switch.add_link(tgen.gears["r1"]) # Create a empty network for router 2 - switch = tgen.add_switch('s2') - switch.add_link(tgen.gears['r2']) + switch = tgen.add_switch("s2") + switch.add_link(tgen.gears["r2"]) # Interconect router 1, 2 - switch = tgen.add_switch('s3') - switch.add_link(tgen.gears['r1']) - switch.add_link(tgen.gears['r2']) + switch = tgen.add_switch("s3") + switch.add_link(tgen.gears["r1"]) + switch.add_link(tgen.gears["r2"]) def setup_module(mod): @@ -78,12 +80,10 @@ def setup_module(mod): router_list = tgen.routers() for rname, router in router_list.items(): router.load_config( - TopoRouter.RD_ZEBRA, - os.path.join(CWD, '{}/zebra.conf'.format(rname)) + TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname)) ) router.load_config( - TopoRouter.RD_OSPF, - os.path.join(CWD, '{}/ospfd.conf'.format(rname)) + TopoRouter.RD_OSPF, os.path.join(CWD, "{}/ospfd.conf".format(rname)) ) # What is this? OSPF Unnumbered depends on the rp_filter @@ -93,18 +93,15 @@ def setup_module(mod): # the rp_filter. Setting it to '0' allows the OS to pass # up the mcast packet not destined for the local routers # network. - topotest.set_sysctl(tgen.net['r1'], - 'net.ipv4.conf.r1-eth1.rp_filter', 0) - topotest.set_sysctl(tgen.net['r1'], - 'net.ipv4.conf.all.rp_filter', 0) - topotest.set_sysctl(tgen.net['r2'], - 'net.ipv4.conf.r2-eth1.rp_filter', 0) - topotest.set_sysctl(tgen.net['r2'], - 'net.ipv4.conf.all.rp_filter', 0) + topotest.set_sysctl(tgen.net["r1"], "net.ipv4.conf.r1-eth1.rp_filter", 0) + topotest.set_sysctl(tgen.net["r1"], "net.ipv4.conf.all.rp_filter", 0) + topotest.set_sysctl(tgen.net["r2"], "net.ipv4.conf.r2-eth1.rp_filter", 0) + topotest.set_sysctl(tgen.net["r2"], "net.ipv4.conf.all.rp_filter", 0) # Initialize all routers. tgen.start_router() - #tgen.mininet_cli() + # tgen.mininet_cli() + def teardown_module(mod): "Teardown the pytest environment" @@ -116,50 +113,54 @@ def test_ospf_convergence(): "Test OSPF daemon convergence and that we have received the ospf routes" tgen = get_topogen() if tgen.routers_have_failure(): - pytest.skip('skipped because of router(s) failure') + pytest.skip("skipped because of router(s) failure") for router, rnode in tgen.routers().items(): logger.info('Waiting for router "%s" convergence', router) - json_file = '{}/{}/ospf-route.json'.format(CWD, router) + json_file = "{}/{}/ospf-route.json".format(CWD, router) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - rnode, 'show ip ospf route json', expected) + test_func = partial( + topotest.router_json_cmp, rnode, "show ip ospf route json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=160, wait=0.5) assertmsg = '"{}" JSON output mismatches'.format(router) assert result is None, assertmsg - #tgen.mininet_cli() + # tgen.mininet_cli() + def test_ospf_kernel_route(): "Test OSPF kernel route installation and we have the onlink success" tgen = get_topogen() if tgen.routers_have_failure(): - pytest.skip('skipped because of router(s) failure') + pytest.skip("skipped because of router(s) failure") rlist = tgen.routers().values() for router in rlist: logger.info('Checking OSPF IPv4 kernel routes in "%s"', router.name) - json_file = '{}/{}/v4_route.json'.format(CWD, router.name) + json_file = "{}/{}/v4_route.json".format(CWD, router.name) expected = json.loads(open(json_file).read()) - test_func = partial(topotest.router_json_cmp, - router, 'show ip route json', expected) - _, result = topotest.run_and_expect(test_func, None, count=10, wait=.5) + test_func = partial( + topotest.router_json_cmp, router, "show ip route json", expected + ) + _, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5) assertmsg = '"{}" JSON output mistmatches'.format(router) assert result is None, assertmsg - #tgen.mininet_cli() + # tgen.mininet_cli() def test_memory_leak(): "Run the memory leak test and report results." tgen = get_topogen() if not tgen.is_memleak_enabled(): - pytest.skip('Memory leak test/report is disabled') + pytest.skip("Memory leak test/report is disabled") tgen.report_memory_leaks() -if __name__ == '__main__': + +if __name__ == "__main__": args = ["-s"] + sys.argv[1:] sys.exit(pytest.main(args)) diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_authentication.py b/tests/topotests/ospf_basic_functionality/test_ospf_authentication.py index a2f9c03ab4..e92baefabf 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_authentication.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_authentication.py @@ -48,7 +48,7 @@ from lib.common_config import ( reset_config_on_routers, step, shutdown_bringup_interface, - topo_daemons + topo_daemons, ) from lib.topolog import logger from lib.topojson import build_topo_from_json, build_config_from_json diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_ecmp.py b/tests/topotests/ospf_basic_functionality/test_ospf_ecmp.py index 399fa02230..3b37b8a92f 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_ecmp.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_ecmp.py @@ -53,7 +53,7 @@ from lib.common_config import ( create_route_maps, shutdown_bringup_interface, create_interfaces_cfg, - topo_daemons + topo_daemons, ) from lib.topolog import logger diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_ecmp_lan.py b/tests/topotests/ospf_basic_functionality/test_ospf_ecmp_lan.py index 17a3676e2e..967bc44879 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_ecmp_lan.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_ecmp_lan.py @@ -53,7 +53,7 @@ from lib.common_config import ( shutdown_bringup_interface, stop_router, start_router, - topo_daemons + topo_daemons, ) from lib.bgp import verify_bgp_convergence, create_router_bgp from lib.topolog import logger diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_lan.py b/tests/topotests/ospf_basic_functionality/test_ospf_lan.py index f261104206..1357a86c81 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_lan.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_lan.py @@ -55,7 +55,7 @@ from lib.common_config import ( shutdown_bringup_interface, stop_router, start_router, - topo_daemons + topo_daemons, ) from lib.bgp import verify_bgp_convergence, create_router_bgp from lib.topolog import logger diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_nssa.py b/tests/topotests/ospf_basic_functionality/test_ospf_nssa.py index ff4399f19e..82a34d046c 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_nssa.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_nssa.py @@ -44,7 +44,7 @@ from lib.common_config import ( create_route_maps, shutdown_bringup_interface, create_interfaces_cfg, - topo_daemons + topo_daemons, ) from ipaddress import IPv4Address from lib.topogen import Topogen, get_topogen diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py b/tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py index 6ebc74a013..64edc1ebbf 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py @@ -52,7 +52,7 @@ from lib.common_config import ( step, create_route_maps, verify_prefix_lists, - topo_daemons + topo_daemons, ) from lib.topolog import logger from lib.topojson import build_topo_from_json, build_config_from_json diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py b/tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py index 2c6bcf0162..6ac0b515df 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py @@ -50,7 +50,7 @@ from lib.common_config import ( create_static_routes, step, shutdown_bringup_interface, - topo_daemons + topo_daemons, ) from lib.bgp import verify_bgp_convergence, create_router_bgp from lib.topolog import logger @@ -278,8 +278,7 @@ def test_ospf_redistribution_tc5_p0(request): dut = "r1" for num in range(0, nretry): - result = verify_ospf_rib( - tgen, dut, input_dict, next_hop=nh, expected=False) + result = verify_ospf_rib(tgen, dut, input_dict, next_hop=nh, expected=False) if result is not True: break @@ -399,8 +398,7 @@ def test_ospf_redistribution_tc6_p0(request): dut = "r1" for num in range(0, nretry): - result = verify_ospf_rib( - tgen, dut, input_dict, next_hop=nh, expected=False) + result = verify_ospf_rib(tgen, dut, input_dict, next_hop=nh, expected=False) if result is not True: break assert result is not True, "Testcase {} : Failed \n Error: {}".format( @@ -409,13 +407,7 @@ def test_ospf_redistribution_tc6_p0(request): protocol = "ospf" result = verify_rib( - tgen, - "ipv4", - dut, - input_dict, - protocol=protocol, - next_hop=nh, - expected=False, + tgen, "ipv4", dut, input_dict, protocol=protocol, next_hop=nh, expected=False, ) assert result is not True, "Testcase {} : Failed \n Error: {}".format( tc_name, result diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_single_area.py b/tests/topotests/ospf_basic_functionality/test_ospf_single_area.py index 5a141224f1..f563637b3c 100644 --- a/tests/topotests/ospf_basic_functionality/test_ospf_single_area.py +++ b/tests/topotests/ospf_basic_functionality/test_ospf_single_area.py @@ -53,7 +53,7 @@ from lib.common_config import ( create_route_maps, shutdown_bringup_interface, create_interfaces_cfg, - topo_daemons + topo_daemons, ) from lib.topolog import logger from lib.topojson import build_topo_from_json, build_config_from_json diff --git a/tests/topotests/pbr-topo1/test_pbr_topo1.py b/tests/topotests/pbr-topo1/test_pbr_topo1.py index 91979a8f04..fcbe3c0adf 100644 --- a/tests/topotests/pbr-topo1/test_pbr_topo1.py +++ b/tests/topotests/pbr-topo1/test_pbr_topo1.py @@ -147,7 +147,9 @@ def test_pbr_data(): expected = json.loads(open(intf_file).read()) # Actual output from router - test_func = partial(topotest.router_json_cmp, router, "show pbr interface json", expected) + test_func = partial( + topotest.router_json_cmp, router, "show pbr interface json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=30, wait=1) assertmsg = '"show pbr interface" mismatches on {}'.format(router.name) if result is not None: @@ -161,7 +163,9 @@ def test_pbr_data(): expected = json.loads(open(map_file).read()) # Actual output from router - test_func = partial(topotest.router_json_cmp, router, "show pbr map json", expected) + test_func = partial( + topotest.router_json_cmp, router, "show pbr map json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=30, wait=1) assertmsg = '"show pbr map" mismatches on {}'.format(router.name) if result is not None: @@ -175,13 +179,16 @@ def test_pbr_data(): expected = json.loads(open(nexthop_file).read()) # Actual output from router - test_func = partial(topotest.router_json_cmp, router, "show pbr nexthop-groups json", expected) + test_func = partial( + topotest.router_json_cmp, router, "show pbr nexthop-groups json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=30, wait=1) assertmsg = '"show pbr nexthop-groups" mismatches on {}'.format(router.name) if result is not None: gather_pbr_data_on_error(router) assert result is None, assertmsg + def test_pbr_flap(): "Test PBR interface flapping" @@ -212,7 +219,9 @@ def test_pbr_flap(): expected = json.loads(open(intf_file).read()) # Actual output from router - test_func = partial(topotest.router_json_cmp, router, "show pbr interface json", expected) + test_func = partial( + topotest.router_json_cmp, router, "show pbr interface json", expected + ) _, result = topotest.run_and_expect(test_func, None, count=30, wait=1) assertmsg = '"show pbr interface" mismatches on {}'.format(router.name) if result is not None: @@ -274,4 +283,3 @@ def gather_pbr_data_on_error(router): logger.info(router.run("ip route show table 10005")) logger.info(router.run("ip -6 route show table 10005")) logger.info(router.run("ip rule show")) - diff --git a/tests/topotests/pim-basic/mcast-rx.py b/tests/topotests/pim-basic/mcast-rx.py index 7aa4d4027e..862ad46af4 100755 --- a/tests/topotests/pim-basic/mcast-rx.py +++ b/tests/topotests/pim-basic/mcast-rx.py @@ -35,8 +35,9 @@ import time def ifname_to_ifindex(ifname): - output = subprocess.check_output("ip link show %s" % ifname, - shell=True, universal_newlines=True) + output = subprocess.check_output( + "ip link show %s" % ifname, shell=True, universal_newlines=True + ) first_line = output.split("\n")[0] re_index = re.search("^(\d+):", first_line) diff --git a/tests/topotests/pim-basic/mcast-tx.py b/tests/topotests/pim-basic/mcast-tx.py index 7fb980c647..87038ad5cf 100755 --- a/tests/topotests/pim-basic/mcast-tx.py +++ b/tests/topotests/pim-basic/mcast-tx.py @@ -39,9 +39,7 @@ logging.addLevelName( ) log = logging.getLogger(__name__) -parser = argparse.ArgumentParser( - description="Multicast packet generator" -) +parser = argparse.ArgumentParser(description="Multicast packet generator") parser.add_argument("group", help="Multicast IP") parser.add_argument("ifname", help="Interface name") parser.add_argument("--port", type=int, help="UDP port number", default=1000) @@ -62,8 +60,9 @@ sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # if sys.version_info[0] > 2: sock.setsockopt( - socket.SOL_SOCKET, 25, struct.pack("%ds" % len(args.ifname), - args.ifname.encode('utf-8')) + socket.SOL_SOCKET, + 25, + struct.pack("%ds" % len(args.ifname), args.ifname.encode("utf-8")), ) else: sock.setsockopt( diff --git a/tests/topotests/pytest.ini b/tests/topotests/pytest.ini index 2e9c4901bc..6e8e749092 100644 --- a/tests/topotests/pytest.ini +++ b/tests/topotests/pytest.ini @@ -1,6 +1,6 @@ # Skip pytests example directory [pytest] -norecursedirs = .git example-test example-topojson-test lib docker evpn_type5_test_topo1 +norecursedirs = .git example-test example-topojson-test lib docker [topogen] # Default configuration values diff --git a/tests/topotests/route-scale/r1/installed.routes.json b/tests/topotests/route-scale/r1/installed.routes.json index 25d209f9eb..24a45dca81 100644 --- a/tests/topotests/route-scale/r1/installed.routes.json +++ b/tests/topotests/route-scale/r1/installed.routes.json @@ -6,11 +6,11 @@ "type":"connected" }, { - "fib":1000000, - "rib":1000000, + "fib":200000, + "rib":200000, "type":"sharp" } ], - "routesTotal":1000032, - "routesTotalFib":1000032 + "routesTotal":200032, + "routesTotalFib":200032 } diff --git a/tests/topotests/route-scale/test_route_scale.py b/tests/topotests/route-scale/test_route_scale.py index 0bfae3b830..bbd6ef8d60 100644 --- a/tests/topotests/route-scale/test_route_scale.py +++ b/tests/topotests/route-scale/test_route_scale.py @@ -95,7 +95,8 @@ def setup_module(module): ) tgen.start_router() - #tgen.mininet_cli() + # tgen.mininet_cli() + def teardown_module(_mod): "Teardown the pytest environment" @@ -104,6 +105,7 @@ def teardown_module(_mod): # This function tears down the whole topology. tgen.stop_topology() + def test_converge_protocols(): "Wait for protocol convergence" @@ -112,37 +114,50 @@ def test_converge_protocols(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) + def run_one_setup(r1, s): "Run one ecmp config" # Extract params - expected_installed = s['expect_in'] - expected_removed = s['expect_rem'] - - count = s['count'] - wait = s['wait'] - - logger.info("Testing 1 million routes X {} ecmp".format(s['ecmp'])) - - r1.vtysh_cmd("sharp install route 1.0.0.0 \ - nexthop-group {} 1000000".format(s['nhg']), - isjson=False) - - test_func = partial(topotest.router_json_cmp, r1, "show ip route summary json", expected_installed) - success, result = topotest.run_and_expect(test_func, None, count, wait) + expected_installed = s["expect_in"] + expected_removed = s["expect_rem"] + + retries = s["retries"] + wait = s["wait"] + + for d in expected_installed["routes"]: + if d["type"] == "sharp": + count = d["rib"] + break + + logger.info("Testing {} routes X {} ecmp".format(count, s["ecmp"])) + + r1.vtysh_cmd( + "sharp install route 1.0.0.0 \ + nexthop-group {} {}".format( + s["nhg"], count + ), + isjson=False, + ) + + test_func = partial( + topotest.router_json_cmp, r1, "show ip route summary json", expected_installed + ) + success, result = topotest.run_and_expect(test_func, None, retries, wait) assert success, "Route scale test install failed:\n{}".format(result) output = r1.vtysh_cmd("sharp data route", isjson=False) - logger.info("1 million routes X {} ecmp installed".format(s['ecmp'])) + logger.info("{} routes X {} ecmp installed".format(count, s["ecmp"])) logger.info(output) - r1.vtysh_cmd("sharp remove route 1.0.0.0 1000000", isjson=False) - test_func = partial(topotest.router_json_cmp, r1, "show ip route summary json", expected_removed) - success, result = topotest.run_and_expect(test_func, None, count, wait) + r1.vtysh_cmd("sharp remove route 1.0.0.0 {}".format(count), isjson=False) + test_func = partial( + topotest.router_json_cmp, r1, "show ip route summary json", expected_removed + ) + success, result = topotest.run_and_expect(test_func, None, retries, wait) assert success, "Route scale test remove failed:\n{}".format(result) output = r1.vtysh_cmd("sharp data route", isjson=False) - logger.info("1 million routes x {} ecmp removed".format( - s['ecmp'])) + logger.info("{} routes x {} ecmp removed".format(count, s["ecmp"])) logger.info(output) @@ -164,19 +179,23 @@ def test_route_install(): # dict keys of params: ecmp number, corresponding nhg name, timeout, # number of times to wait - scale_keys = ['ecmp', 'nhg', 'wait', 'count', 'expect_in', 'expect_rem'] + scale_keys = ["ecmp", "nhg", "wait", "retries", "expect_in", "expect_rem"] # Table of defaults, used for timeout values and 'expected' objects - scale_defaults = dict(zip(scale_keys, [None, None, 7, 30, - expected_installed, - expected_removed])) + scale_defaults = dict( + zip(scale_keys, [None, None, 7, 30, expected_installed, expected_removed]) + ) # List of params for each step in the test; note extra time given # for the highest ecmp steps. Executing 'show' at scale can be costly # so we widen the interval there too. scale_steps = [ - [1, 'one'], [2, 'two'], [4, 'four'], - [8, 'eight'], [16, 'sixteen', 10, 40], [32, 'thirtytwo', 10, 40] + [1, "one"], + [2, "two"], + [4, "four"], + [8, "eight"], + [16, "sixteen", 10, 40], + [32, "thirtytwo", 10, 40], ] # Build up a list of dicts with params for each step of the test; @@ -191,17 +210,18 @@ def test_route_install(): scale_setups.append(d) # Avoid top ecmp case for runs with < 4G memory - p = os.popen('free') + p = os.popen("free") l = p.readlines()[1].split() mem = int(l[1]) if mem < 4000000: - logger.info('Limited memory available: {}, skipping x32 testcase'.format(mem)) + logger.info("Limited memory available: {}, skipping x32 testcase".format(mem)) scale_setups = scale_setups[0:-1] # Run each step using the dicts we've built for s in scale_setups: run_one_setup(r1, s) + # Mem leak testcase def test_memory_leak(): "Run the memory leak test and report results." @@ -210,6 +230,7 @@ def test_memory_leak(): pytest.skip("Memory leak test/report is disabled") tgen.report_memory_leaks() + if __name__ == "__main__": args = ["-s"] + sys.argv[1:] sys.exit(pytest.main(args)) |
