diff options
Diffstat (limited to 'tests')
241 files changed, 8467 insertions, 2039 deletions
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/helpers/python/frrtest.py b/tests/helpers/python/frrtest.py index 0ac54fd900..584fa90374 100644 --- a/tests/helpers/python/frrtest.py +++ b/tests/helpers/python/frrtest.py @@ -168,8 +168,8 @@ class TestMultiOut(_TestMultiOut): 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" @@ -214,7 +214,12 @@ class TestRefOut(object): [binpath(program)], stdin=subprocess.PIPE, stdout=subprocess.PIPE ) outtext, _ = proc.communicate(intext) - if outtext != reftext: - raise TestRefMismatch(self, outtext, reftext) + + # 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/topotests/Dockerfile b/tests/topotests/Dockerfile index b7c6298228..b7042d84c6 100644 --- a/tests/topotests/Dockerfile +++ b/tests/topotests/Dockerfile @@ -48,7 +48,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \ && rm -rf /var/lib/apt/lists/* RUN export DEBIAN_FRONTEND=noninteractive \ - && apt-key adv --keyserver keyserver.ubuntu.com --recv-key 5418F291D0D4A1AA \ + && wget -qO- https://deb.frrouting.org/frr/keys.asc | apt-key add - \ && echo "deb https://deb.frrouting.org/frr bionic frr-stable" > /etc/apt/sources.list.d/frr.list \ && apt-get update \ && apt-get install -y libyang-dev \ 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 0254ff6af6..84bae74f6d 100644 --- a/tests/topotests/all-protocol-startup/test_all_protocol_startup.py +++ b/tests/topotests/all-protocol-startup/test_all_protocol_startup.py @@ -269,6 +269,9 @@ def test_error_messages_daemons(): error_logs += log log = net["r1"].getStdErr("nhrpd") + # NHRPD shows YANG model not embedded messages + # Ignore these + log = re.sub(r".*YANG model.*not embedded.*", "", log).rstrip() if log: error_logs += "r%s NHRPd StdErr Output:\n" % i error_logs += log @@ -285,7 +288,7 @@ def test_error_messages_daemons(): log = net["r%s" % i].getStdErr("zebra") if log: - error_logs += "r%s Zebra StdErr Output:\n" + error_logs += "r%s Zebra StdErr Output:\n" % i error_logs += log if error_logs: @@ -1065,7 +1068,7 @@ def test_bgp_ipv4(): if not success: resultstr = "No template matched.\n" - for f in diffresult.iterkeys(): + for f in diffresult.keys(): resultstr += "template %s: r%s failed SHOW BGP IPv4 check:\n%s\n" % ( f, i, @@ -1134,7 +1137,7 @@ def test_bgp_ipv6(): if not success: resultstr = "No template matched.\n" - for f in diffresult.iterkeys(): + for f in diffresult.keys(): resultstr += "template %s: r%s failed SHOW BGP IPv6 check:\n%s\n" % ( f, i, diff --git a/tests/topotests/bgp-auth/R1/bgpd_multi_vrf.conf b/tests/topotests/bgp-auth/R1/bgpd_multi_vrf.conf index aab35073cf..dde3c090b5 100644 --- a/tests/topotests/bgp-auth/R1/bgpd_multi_vrf.conf +++ b/tests/topotests/bgp-auth/R1/bgpd_multi_vrf.conf @@ -1,4 +1,3 @@ -log file /tmp/topotests/test_bgp_auth/R1/bgpd.log debugging debug bgp neighbor-events router bgp 65001 vrf blue diff --git a/tests/topotests/bgp-auth/R1/bgpd_vrf.conf b/tests/topotests/bgp-auth/R1/bgpd_vrf.conf index 73aa8c1a03..781f906d3a 100644 --- a/tests/topotests/bgp-auth/R1/bgpd_vrf.conf +++ b/tests/topotests/bgp-auth/R1/bgpd_vrf.conf @@ -1,4 +1,3 @@ -log file /tmp/topotests/test_bgp_auth/R1/bgpd.log debugging debug bgp neighbor-events router bgp 65001 vrf blue diff --git a/tests/topotests/bgp-auth/R1/zebra.conf b/tests/topotests/bgp-auth/R1/zebra.conf index d39915335a..a0b062c44c 100644 --- a/tests/topotests/bgp-auth/R1/zebra.conf +++ b/tests/topotests/bgp-auth/R1/zebra.conf @@ -1,4 +1,3 @@ -log file zebra.log ! interface lo ip address 1.1.1.1/32 @@ -18,4 +17,4 @@ interface R1-eth4 vrf red ip address 10.10.0.1/24 interface R1-eth5 vrf red ip address 10.20.0.1/24 -!
\ No newline at end of file +! diff --git a/tests/topotests/bgp-auth/R2/zebra.conf b/tests/topotests/bgp-auth/R2/zebra.conf index fece68472a..fed4c27c16 100644 --- a/tests/topotests/bgp-auth/R2/zebra.conf +++ b/tests/topotests/bgp-auth/R2/zebra.conf @@ -1,4 +1,3 @@ -log file zebra.log ! interface lo ip address 2.2.2.2/32 @@ -18,4 +17,4 @@ interface R2-eth4 vrf red ip address 10.10.0.2/24 interface R2-eth5 vrf red ip address 10.30.0.2/24 -!
\ No newline at end of file +! diff --git a/tests/topotests/bgp-auth/R3/zebra.conf b/tests/topotests/bgp-auth/R3/zebra.conf index 0fe3acdfd0..d49c98b168 100644 --- a/tests/topotests/bgp-auth/R3/zebra.conf +++ b/tests/topotests/bgp-auth/R3/zebra.conf @@ -1,4 +1,3 @@ -log file zebra.log ! interface lo ip address 3.3.3.3/32 @@ -18,4 +17,4 @@ interface R3-eth4 vrf red ip address 10.20.0.3/24 interface R3-eth5 vrf red ip address 10.30.0.3/24 -!
\ No newline at end of file +! 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 12069a12dc..54a3c699f3 100644 --- a/tests/topotests/bgp-ecmp-topo2/test_ebgp_ecmp_topo2.py +++ b/tests/topotests/bgp-ecmp-topo2/test_ebgp_ecmp_topo2.py @@ -292,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, @@ -299,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 50aa281d34..73724ac069 100644 --- a/tests/topotests/bgp-ecmp-topo2/test_ibgp_ecmp_topo2.py +++ b/tests/topotests/bgp-ecmp-topo2/test_ibgp_ecmp_topo2.py @@ -293,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, @@ -300,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 85cfd538ff..4c56d1a02d 100644 --- a/tests/topotests/bgp-evpn-mh/test_evpn_mh.py +++ b/tests/topotests/bgp-evpn-mh/test_evpn_mh.py @@ -720,6 +720,64 @@ def test_evpn_df(): # 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_aggregate_address_topo1/test_bgp_aggregate_address_topo1.py b/tests/topotests/bgp_aggregate_address_topo1/test_bgp_aggregate_address_topo1.py index 3f3b71dea3..089b1acb1c 100644 --- 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 @@ -156,7 +156,7 @@ def test_bgp_aggregate_address_matching_med_only(): assert result is None, assertmsg -def test_bgp_aggregate_address_match_and_supress(): +def test_bgp_aggregate_address_match_and_suppress(): "Test that the command matching-MED-only with suppression works." tgen = get_topogen() @@ -206,12 +206,15 @@ def test_bgp_aggregate_address_suppress_map(): 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"}], - }) + 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( @@ -224,12 +227,15 @@ 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"}], - }) + 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(): @@ -248,12 +254,15 @@ 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"}], - }) + 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( @@ -264,12 +273,15 @@ 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, - }) + 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(): diff --git a/tests/topotests/bgp_default-route_route-map/__init__.py b/tests/topotests/bgp_default-route/__init__.py index e69de29bb2..e69de29bb2 100644 --- a/tests/topotests/bgp_default-route_route-map/__init__.py +++ 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 003193f108..fa155dd5fe 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 @@ -31,9 +31,11 @@ to send advertisements. Scenario 1: r1 has a filter applied for outgoing direction, r2 receives 192.168.255.1/32. + Scenario 2: r3 hasn't a filter appied for outgoing direction, r4 does not receive 192.168.255.1/32. + Scenario 3: r5 and r6 establish iBGP session which in turn should ignore RFC8212. All routes for both directions MUST work. @@ -63,14 +65,17 @@ class TemplateTopo(Topo): for routern in range(1, 7): tgen.add_router("r{}".format(routern)) + # Scenario 1. switch = tgen.add_switch("s1") switch.add_link(tgen.gears["r1"]) switch.add_link(tgen.gears["r2"]) + # Scenario 2. switch = tgen.add_switch("s2") switch.add_link(tgen.gears["r3"]) switch.add_link(tgen.gears["r4"]) + # Scenario 3. switch = tgen.add_switch("s3") switch.add_link(tgen.gears["r5"]) switch.add_link(tgen.gears["r6"]) @@ -120,41 +125,48 @@ def test_ebgp_requires_policy(): expected = {"routes": {"172.16.255.254/32": [{"valid": True}]}} return topotest.json_cmp(output, expected) + def _bgp_advertised_routes(router): + output = json.loads( + tgen.gears[router].vtysh_cmd( + "show ip bgp neighbor 192.168.255.2 advertised-routes json" + ) + ) + expected = { + "advertisedRoutes": {}, + "totalPrefixCounter": 0, + "filteredPrefixCounter": 0, + } + return topotest.json_cmp(output, expected) + + # Scenario 1. + logger.info("Scenario 1: r2 receives 192.168.255.1/32 from r1") 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"] - ) + success, result = topotest.run_and_expect(test_func, None, count=120, wait=0.5) + assert success is True, "Failed bgp convergence (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"] - ) + success, result = topotest.run_and_expect(test_func, None, count=120, wait=0.5) + assert success is True, "r2 does not receive 192.168.255.1/32" + # Scenario 2. + logger.info("Scenario 2: r3 must not send 192.168.255.1/32 to r4") 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"] - ) + success, result = topotest.run_and_expect(test_func, None, count=120, wait=0.5) + assert success is True, "Failed bgp convergence (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"] - ) + test_func = functools.partial(_bgp_advertised_routes, "r3") + success, result = topotest.run_and_expect(test_func, None, count=120, wait=0.5) + assert success is True, "r3 announced 192.168.255.1/32 to r4" + # Scenario 3. + logger.info("Scenario 3: r6 receives 192.168.255.1/32 from r5 (iBGP)") 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"] - ) + success, result = topotest.run_and_expect(test_func, None, count=120, wait=0.5) + assert success is True, "Failed bgp convergence (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"] - ) + success, result = topotest.run_and_expect(test_func, None, count=120, wait=0.5) + assert success is True, "r6 does not receive 192.168.255.1/32" if __name__ == "__main__": diff --git a/tests/topotests/bgp_features/r1/ospf6d.conf b/tests/topotests/bgp_features/r1/ospf6d.conf index 532da39fb7..a38e4b862a 100644 --- a/tests/topotests/bgp_features/r1/ospf6d.conf +++ b/tests/topotests/bgp_features/r1/ospf6d.conf @@ -4,17 +4,16 @@ debug ospf6 neighbor ! interface r1-lo ! -interface r1-eth0 -! interface r1-eth1 + ipv6 ospf6 priority 10 ! interface r1-eth2 + ipv6 ospf6 priority 10 ! router ospf6 ospf6 router-id 192.168.0.1 log-adjacency-changes interface r1-lo area 0.0.0.0 - interface r1-eth0 area 0.0.0.0 interface r1-eth1 area 0.0.0.0 interface r1-eth2 area 0.0.0.0 ! diff --git a/tests/topotests/bgp_features/r1/ospf_neighbor.json b/tests/topotests/bgp_features/r1/ospf_neighbor.json index ecb97d8d74..e742c119da 100644 --- a/tests/topotests/bgp_features/r1/ospf_neighbor.json +++ b/tests/topotests/bgp_features/r1/ospf_neighbor.json @@ -2,14 +2,14 @@ "neighbors":{ "192.168.0.2":[ { - "priority":1, - "state":"Full\/DR" + "priority":5, + "state":"Full\/Backup" } ], "192.168.0.3":[ { - "priority":1, - "state":"Full\/DR" + "priority":5, + "state":"Full\/Backup" } ] } diff --git a/tests/topotests/bgp_features/r1/ospfd.conf b/tests/topotests/bgp_features/r1/ospfd.conf index 8f1711db7b..68a1bb5c75 100644 --- a/tests/topotests/bgp_features/r1/ospfd.conf +++ b/tests/topotests/bgp_features/r1/ospfd.conf @@ -3,6 +3,16 @@ log file ospfd.log debug ospf event debug ospf zebra ! +interface r1-eth1 + ip ospf hello-interval 2 + ip ospf dead-interval 10 + ip ospf priority 10 +! +interface r1-eth2 + ip ospf hello-interval 2 + ip ospf dead-interval 10 + ip ospf priority 10 +! router ospf ospf router-id 192.168.0.1 log-adjacency-changes @@ -13,11 +23,4 @@ router ospf refresh timer 10 ! line vty -interface r1-eth1 - ip ospf hello-interval 2 - ip ospf dead-interval 10 -! -interface r1-eth2 - ip ospf hello-interval 2 - ip ospf dead-interval 10 ! diff --git a/tests/topotests/bgp_features/r2/ospf6d.conf b/tests/topotests/bgp_features/r2/ospf6d.conf index 283d205489..47bd5a99cc 100644 --- a/tests/topotests/bgp_features/r2/ospf6d.conf +++ b/tests/topotests/bgp_features/r2/ospf6d.conf @@ -4,17 +4,16 @@ debug ospf6 neighbor ! interface r2-lo ! -interface r2-eth0 -! interface r2-eth1 + ipv6 ospf6 priority 5 ! interface r2-eth2 + ipv6 ospf6 priority 10 ! router ospf6 ospf6 router-id 192.168.0.2 log-adjacency-changes interface r2-lo area 0.0.0.0 - interface r2-eth0 area 0.0.0.0 interface r2-eth1 area 0.0.0.0 interface r2-eth2 area 0.0.0.0 ! diff --git a/tests/topotests/bgp_features/r2/ospf_neighbor.json b/tests/topotests/bgp_features/r2/ospf_neighbor.json index 5fcbd82ee1..2fd589ae25 100644 --- a/tests/topotests/bgp_features/r2/ospf_neighbor.json +++ b/tests/topotests/bgp_features/r2/ospf_neighbor.json @@ -2,14 +2,14 @@ "neighbors":{ "192.168.0.1":[ { - "priority":1, - "state":"Full\/Backup" + "priority":10, + "state":"Full\/DR" } ], "192.168.0.3":[ { - "priority":1, - "state":"Full\/DR" + "priority":5, + "state":"Full\/Backup" } ] } diff --git a/tests/topotests/bgp_features/r2/ospfd.conf b/tests/topotests/bgp_features/r2/ospfd.conf index 2174fddb11..6f608e454b 100644 --- a/tests/topotests/bgp_features/r2/ospfd.conf +++ b/tests/topotests/bgp_features/r2/ospfd.conf @@ -3,6 +3,16 @@ log file ospfd.log debug ospf event debug ospf zebra ! +int r2-eth1 + ip ospf hello-interval 2 + ip ospf dead-interval 10 + ip ospf priority 5 +! +int r2-eth2 + ip ospf hello-interval 2 + ip ospf dead-interval 10 + ip ospf priority 10 +! router ospf ospf router-id 192.168.0.2 log-adjacency-changes @@ -12,12 +22,5 @@ router ospf timers throttle lsa all 0 refresh timer 10 ! -int r2-eth1 - ip ospf hello-interval 2 - ip ospf dead-interval 10 -int r2-eth2 - ip ospf hello-interval 2 - ip ospf dead-interval 10 -! line vty ! diff --git a/tests/topotests/bgp_features/r3/ospf6d.conf b/tests/topotests/bgp_features/r3/ospf6d.conf index 7a6623f979..eb74901ba1 100644 --- a/tests/topotests/bgp_features/r3/ospf6d.conf +++ b/tests/topotests/bgp_features/r3/ospf6d.conf @@ -4,17 +4,16 @@ debug ospf6 neighbor ! interface r3-lo ! -interface r3-eth0 -! interface r3-eth1 + ipv6 ospf6 priority 5 ! interface r3-eth2 + ipv6 ospf6 priority 5 ! router ospf6 ospf6 router-id 192.168.0.3 log-adjacency-changes interface r3-lo area 0.0.0.0 - interface r3-eth0 area 0.0.0.0 interface r3-eth1 area 0.0.0.0 interface r3-eth2 area 0.0.0.0 ! diff --git a/tests/topotests/bgp_features/r3/ospf_neighbor.json b/tests/topotests/bgp_features/r3/ospf_neighbor.json index e90a70a8f6..80fc92c3bc 100644 --- a/tests/topotests/bgp_features/r3/ospf_neighbor.json +++ b/tests/topotests/bgp_features/r3/ospf_neighbor.json @@ -2,14 +2,14 @@ "neighbors":{ "192.168.0.1":[ { - "priority":1, - "state":"Full\/Backup" + "priority":10, + "state":"Full\/DR" } ], "192.168.0.2":[ { - "priority":1, - "state":"Full\/Backup" + "priority":10, + "state":"Full\/DR" } ] } diff --git a/tests/topotests/bgp_features/r3/ospfd.conf b/tests/topotests/bgp_features/r3/ospfd.conf index 795344fbe6..71e4f1e1df 100644 --- a/tests/topotests/bgp_features/r3/ospfd.conf +++ b/tests/topotests/bgp_features/r3/ospfd.conf @@ -3,6 +3,16 @@ log file ospfd.log debug ospf event debug ospf zebra ! +int r3-eth1 + ip ospf hello-interval 2 + ip ospf dead-interval 10 + ip ospf priority 5 +! +int r3-eth2 + ip ospf hello-interval 2 + ip ospf dead-interval 10 + ip ospf priority 5 +! router ospf ospf router-id 192.168.0.3 log-adjacency-changes @@ -12,12 +22,5 @@ router ospf timers throttle lsa all 0 refresh timer 10 ! -int r3-eth1 - ip ospf hello-interval 2 - ip ospf dead-interval 10 -int r3-eth2 - ip ospf hello-interval 2 - ip ospf dead-interval 10 -! line vty ! diff --git a/tests/topotests/bgp_features/test_bgp_features.py b/tests/topotests/bgp_features/test_bgp_features.py index bd092c4340..9dce9d668b 100644 --- a/tests/topotests/bgp_features/test_bgp_features.py +++ b/tests/topotests/bgp_features/test_bgp_features.py @@ -102,7 +102,7 @@ def setup_module(module): # Starting Routers router_list = tgen.routers() - for rname, router in router_list.iteritems(): + for rname, router in router_list.items(): router.load_config( TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname)) ) 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 18d2ac59d2..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 ( @@ -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 da1a47cd29..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 ( @@ -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_l3vpn_to_bgp_direct/scripts/add_routes.py b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/add_routes.py index 3f1157ad72..0deb181f3e 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/add_routes.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/add_routes.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand luCommand( "r1", 'vtysh -c "show bgp next"', "99.0.0.. valid", "wait", "See CE static NH" diff --git a/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/adjacencies.py b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/adjacencies.py index ea059c576e..789f93b837 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/adjacencies.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/adjacencies.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand luCommand("ce1", "ping 192.168.1.1 -c 1", " 0. packet loss", "pass", "CE->PE ping") luCommand("ce2", "ping 192.168.1.1 -c 1", " 0. packet loss", "pass", "CE->PE ping") diff --git a/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/check_routes.py b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/check_routes.py index 96b4978261..af39a951b7 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/check_routes.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/check_routes.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand luCommand( "ce1", diff --git a/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/cleanup_all.py b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/cleanup_all.py index 9f21d99913..38eac14c64 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/cleanup_all.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/cleanup_all.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand luCommand( "r1", diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/add_routes.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/add_routes.py index 5c7427763d..375bca8a63 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/add_routes.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/add_routes.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand luCommand( "r1", 'vtysh -c "add vrf r1-cust1 prefix 99.0.0.1/32"', ".", "none", "IP Address" diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/adjacencies.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/adjacencies.py index 53cf353fa0..f5145753a5 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/adjacencies.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/adjacencies.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand luCommand("ce1", 'vtysh -c "show bgp summary"', " 00:0", "wait", "Adjacencies up", 180) luCommand("ce2", 'vtysh -c "show bgp summary"', " 00:0", "wait", "Adjacencies up", 180) diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_mpls.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_mpls.py index 20113b1058..a5f95f94bf 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_mpls.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_mpls.py @@ -1,4 +1,4 @@ -from lutil import luCommand, luLast +from lib.lutil import luCommand, luLast from lib import topotest ret = luCommand( diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py index b552ea0406..7c154ecd15 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_vrf.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand from customize import l3mdev_accept l3mdev_rtrs = ["r1", "r3", "r4", "ce4"] 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 98d2a3bafc..d55169a19e 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 @@ -1,5 +1,5 @@ -from lutil import luCommand -from bgprib import bgpribRequireVpnRoutes, bgpribRequireUnicastRoutes +from lib.lutil import luCommand +from lib.bgprib import bgpribRequireVpnRoutes, bgpribRequireUnicastRoutes ######################################################################## # CE routers: contain routes they originate diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/cleanup_all.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/cleanup_all.py index af77ab01c1..a27b178548 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/cleanup_all.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/cleanup_all.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand luCommand( "r1", diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/del_bgp_instances.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/del_bgp_instances.py index 477578bdbd..fcbc3df6ef 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/del_bgp_instances.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/del_bgp_instances.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand luCommand( "r1", diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/notification_check.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/notification_check.py index 2b0a85a91a..dd2e24722f 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/notification_check.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/notification_check.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand rtrs = ["ce1", "ce2", "ce3", "r1", "r2", "r3", "r4"] for rtr in rtrs: 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 7990533f3a..6ce81baf11 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 @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand ret = luCommand( "ce1", diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_up.py b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_up.py index 3c768640a1..04ca03973d 100644 --- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_up.py +++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_up.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand num = 50000 b = int(num / (256 * 256)) diff --git a/tests/topotests/bgp_multi_vrf_topo2/bgp_multi_vrf_topo2.json b/tests/topotests/bgp_multi_vrf_topo2/bgp_multi_vrf_topo2.json index ab570fcc16..bcee7e1a12 100644 --- a/tests/topotests/bgp_multi_vrf_topo2/bgp_multi_vrf_topo2.json +++ b/tests/topotests/bgp_multi_vrf_topo2/bgp_multi_vrf_topo2.json @@ -43,7 +43,10 @@ "neighbor": { "r1": { "dest_link": { - "red1-link1": {} + "red1-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -54,7 +57,10 @@ "neighbor": { "r1": { "dest_link": { - "red1-link1": {} + "red1-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -71,7 +77,10 @@ "neighbor": { "r1": { "dest_link": { - "red1-link2": {} + "red1-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -82,7 +91,10 @@ "neighbor": { "r1": { "dest_link": { - "red1-link2": {} + "red1-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -118,7 +130,10 @@ "neighbor": { "r1": { "dest_link": { - "blue1-link1": {} + "blue1-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -129,7 +144,10 @@ "neighbor": { "r1": { "dest_link": { - "blue1-link1": {} + "blue1-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -146,7 +164,10 @@ "neighbor": { "r1": { "dest_link": { - "blue1-link2": {} + "blue1-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -157,7 +178,10 @@ "neighbor": { "r1": { "dest_link": { - "blue1-link2": {} + "blue1-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -211,18 +235,28 @@ "neighbor": { "red1": { "dest_link": { - "r1-link1": {} + "r1-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r2": { "dest_link": { "r1-link1": - { "next_hop_self": true } + { + "keepalivetimer": 1, + "holddowntimer": 3, + "next_hop_self": true + } } }, "r4": { "dest_link": { - "r1-link1": {} + "r1-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -233,18 +267,28 @@ "neighbor": { "red1": { "dest_link": { - "r1-link1": {} + "r1-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r2": { "dest_link": { "r1-link1": - { "next_hop_self": true } + { + "keepalivetimer": 1, + "holddowntimer": 3, + "next_hop_self": true + } } }, "r4": { "dest_link": { - "r1-link1": {} + "r1-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -261,18 +305,28 @@ "neighbor": { "red1": { "dest_link": { - "r1-link2": {} + "r1-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r2": { "dest_link": { "r1-link2": - { "next_hop_self": true } + { + "keepalivetimer": 1, + "holddowntimer": 3, + "next_hop_self": true + } } }, "r4": { "dest_link": { - "r1-link2": {} + "r1-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -283,18 +337,28 @@ "neighbor": { "red1": { "dest_link": { - "r1-link2": {} + "r1-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r2": { "dest_link": { "r1-link2": - { "next_hop_self": true } + { + "keepalivetimer": 1, + "holddowntimer": 3, + "next_hop_self": true + } } }, "r4": { "dest_link": { - "r1-link2": {} + "r1-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -311,18 +375,28 @@ "neighbor": { "blue1": { "dest_link": { - "r1-link1": {} + "r1-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r2": { "dest_link": { "r1-link3": - { "next_hop_self": true } + { + "keepalivetimer": 1, + "holddowntimer": 3, + "next_hop_self": true + } } }, "r4": { "dest_link": { - "r1-link3": {} + "r1-link3": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -333,18 +407,28 @@ "neighbor": { "blue1": { "dest_link": { - "r1-link1": {} + "r1-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r2": { "dest_link": { "r1-link3": - { "next_hop_self": true } + { + "keepalivetimer": 1, + "holddowntimer": 3, + "next_hop_self": true + } } }, "r4": { "dest_link": { - "r1-link3": {} + "r1-link3": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -361,18 +445,28 @@ "neighbor": { "blue1": { "dest_link": { - "r1-link2": {} + "r1-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r2": { "dest_link": { "r1-link4": - { "next_hop_self": true } + { + "keepalivetimer": 1, + "holddowntimer": 3, + "next_hop_self": true + } } }, "r4": { "dest_link": { - "r1-link4": {} + "r1-link4": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -383,18 +477,28 @@ "neighbor": { "blue1": { "dest_link": { - "r1-link2": {} + "r1-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r2": { "dest_link": { "r1-link4": - { "next_hop_self": true } + { + "keepalivetimer": 1, + "holddowntimer": 3, + "next_hop_self": true + } } }, "r4": { "dest_link": { - "r1-link4": {} + "r1-link4": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -444,12 +548,18 @@ "neighbor": { "r1": { "dest_link": { - "r2-link1": {} + "r2-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r3": { "dest_link": { - "r2-link1": {} + "r2-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -460,12 +570,18 @@ "neighbor": { "r1": { "dest_link": { - "r2-link1": {} + "r2-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r3": { "dest_link": { - "r2-link1": {} + "r2-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -482,12 +598,18 @@ "neighbor": { "r1": { "dest_link": { - "r2-link2": {} + "r2-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r3": { "dest_link": { - "r2-link2": {} + "r2-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -498,12 +620,18 @@ "neighbor": { "r1": { "dest_link": { - "r2-link2": {} + "r2-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r3": { "dest_link": { - "r2-link2": {} + "r2-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -520,12 +648,18 @@ "neighbor": { "r1": { "dest_link": { - "r2-link3": {} + "r2-link3": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r3": { "dest_link": { - "r2-link3": {} + "r2-link3": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -536,12 +670,18 @@ "neighbor": { "r1": { "dest_link": { - "r2-link3": {} + "r2-link3": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r3": { "dest_link": { - "r2-link3": {} + "r2-link3": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -558,12 +698,18 @@ "neighbor": { "r1": { "dest_link": { - "r2-link4": {} + "r2-link4": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r3": { "dest_link": { - "r2-link4": {} + "r2-link4": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -574,12 +720,18 @@ "neighbor": { "r1": { "dest_link": { - "r2-link4": {} + "r2-link4": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r3": { "dest_link": { - "r2-link4": {} + "r2-link4": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -633,17 +785,26 @@ "neighbor": { "r2": { "dest_link": { - "r3-link1": {} + "r3-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r4": { "dest_link": { - "r3-link1": {} + "r3-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "red2": { "dest_link": { - "r3-link1": {} + "r3-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -658,7 +819,9 @@ "route_maps": [{ "name": "rmap_global", "direction": "in" - }] + }], + "keepalivetimer": 1, + "holddowntimer": 3 } } }, @@ -668,7 +831,9 @@ "route_maps": [{ "name": "rmap_global", "direction": "in" - }] + }], + "keepalivetimer": 1, + "holddowntimer": 3 } } }, @@ -678,7 +843,9 @@ "route_maps": [{ "name": "rmap_global", "direction": "in" - }] + }], + "keepalivetimer": 1, + "holddowntimer": 3 } } } @@ -696,17 +863,26 @@ "neighbor": { "r2": { "dest_link": { - "r3-link2": {} + "r3-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r4": { "dest_link": { - "r3-link2": {} + "r3-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "red2": { "dest_link": { - "r3-link2": {} + "r3-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -721,7 +897,9 @@ "route_maps": [{ "name": "rmap_global", "direction": "in" - }] + }], + "keepalivetimer": 1, + "holddowntimer": 3 } } }, @@ -731,7 +909,9 @@ "route_maps": [{ "name": "rmap_global", "direction": "in" - }] + }], + "keepalivetimer": 1, + "holddowntimer": 3 } } }, @@ -741,7 +921,9 @@ "route_maps": [{ "name": "rmap_global", "direction": "in" - }] + }], + "keepalivetimer": 1, + "holddowntimer": 3 } } } @@ -759,17 +941,26 @@ "neighbor": { "r2": { "dest_link": { - "r3-link3": {} + "r3-link3": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r4": { "dest_link": { - "r3-link3": {} + "r3-link3": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "blue2": { "dest_link": { - "r3-link1": {} + "r3-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -784,7 +975,9 @@ "route_maps": [{ "name": "rmap_global", "direction": "in" - }] + }], + "keepalivetimer": 1, + "holddowntimer": 3 } } }, @@ -794,7 +987,9 @@ "route_maps": [{ "name": "rmap_global", "direction": "in" - }] + }], + "keepalivetimer": 1, + "holddowntimer": 3 } } }, @@ -804,7 +999,9 @@ "route_maps": [{ "name": "rmap_global", "direction": "in" - }] + }], + "keepalivetimer": 1, + "holddowntimer": 3 } } } @@ -822,17 +1019,26 @@ "neighbor": { "r2": { "dest_link": { - "r3-link4": {} + "r3-link4": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r4": { "dest_link": { - "r3-link4": {} + "r3-link4": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "blue2": { "dest_link": { - "r3-link2": {} + "r3-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -847,7 +1053,9 @@ "route_maps": [{ "name": "rmap_global", "direction": "in" - }] + }], + "keepalivetimer": 1, + "holddowntimer": 3 } } }, @@ -857,7 +1065,9 @@ "route_maps": [{ "name": "rmap_global", "direction": "in" - }] + }], + "keepalivetimer": 1, + "holddowntimer": 3 } } }, @@ -867,7 +1077,9 @@ "route_maps": [{ "name": "rmap_global", "direction": "in" - }] + }], + "keepalivetimer": 1, + "holddowntimer": 3 } } } @@ -928,12 +1140,18 @@ "neighbor": { "r1": { "dest_link": { - "r4-link1": {} + "r4-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r3": { "dest_link": { - "r4-link1": {} + "r4-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -945,6 +1163,8 @@ "r1": { "dest_link": { "r4-link1": { + "keepalivetimer": 1, + "holddowntimer": 3, "route_maps": [{ "name": "rmap_global", "direction": "in" @@ -955,6 +1175,8 @@ "r3": { "dest_link": { "r4-link1": { + "keepalivetimer": 1, + "holddowntimer": 3, "route_maps": [{ "name": "rmap_global", "direction": "in" @@ -976,12 +1198,18 @@ "neighbor": { "r1": { "dest_link": { - "r4-link2": {} + "r4-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r3": { "dest_link": { - "r4-link2": {} + "r4-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -993,6 +1221,8 @@ "r1": { "dest_link": { "r4-link2": { + "keepalivetimer": 1, + "holddowntimer": 3, "route_maps": [{ "name": "rmap_global", "direction": "in" @@ -1003,6 +1233,8 @@ "r3": { "dest_link": { "r4-link2": { + "keepalivetimer": 1, + "holddowntimer": 3, "route_maps": [{ "name": "rmap_global", "direction": "in" @@ -1024,12 +1256,18 @@ "neighbor": { "r1": { "dest_link": { - "r4-link3": {} + "r4-link3": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r3": { "dest_link": { - "r4-link3": {} + "r4-link3": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -1041,6 +1279,8 @@ "r1": { "dest_link": { "r4-link3": { + "keepalivetimer": 1, + "holddowntimer": 3, "route_maps": [{ "name": "rmap_global", "direction": "in" @@ -1051,6 +1291,8 @@ "r3": { "dest_link": { "r4-link3": { + "keepalivetimer": 1, + "holddowntimer": 3, "route_maps": [{ "name": "rmap_global", "direction": "in" @@ -1072,12 +1314,18 @@ "neighbor": { "r1": { "dest_link": { - "r4-link4": {} + "r4-link4": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } }, "r3": { "dest_link": { - "r4-link4": {} + "r4-link4": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -1089,6 +1337,8 @@ "r1": { "dest_link": { "r4-link4": { + "keepalivetimer": 1, + "holddowntimer": 3, "route_maps": [{ "name": "rmap_global", "direction": "in" @@ -1099,6 +1349,8 @@ "r3": { "dest_link": { "r4-link4": { + "keepalivetimer": 1, + "holddowntimer": 3, "route_maps": [{ "name": "rmap_global", "direction": "in" @@ -1149,7 +1401,10 @@ "neighbor": { "r3": { "dest_link": { - "red2-link1": {} + "red2-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -1160,7 +1415,10 @@ "neighbor": { "r3": { "dest_link": { - "red2-link1": {} + "red2-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -1177,7 +1435,10 @@ "neighbor": { "r3": { "dest_link": { - "red2-link2": {} + "red2-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -1188,7 +1449,10 @@ "neighbor": { "r3": { "dest_link": { - "red2-link2": {} + "red2-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -1224,7 +1488,10 @@ "neighbor": { "r3": { "dest_link": { - "blue2-link1": {} + "blue2-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -1235,7 +1502,10 @@ "neighbor": { "r3": { "dest_link": { - "blue2-link1": {} + "blue2-link1": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -1252,7 +1522,10 @@ "neighbor": { "r3": { "dest_link": { - "blue2-link2": {} + "blue2-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } @@ -1263,7 +1536,10 @@ "neighbor": { "r3": { "dest_link": { - "blue2-link2": {} + "blue2-link2": { + "keepalivetimer": 1, + "holddowntimer": 3 + } } } } 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 cafe758209..3190070223 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 @@ -35,7 +35,20 @@ CHAOS_5: CHAOS_9: Verify that all vrf instances fall back to backup path, if primary link goes down. - +CHAOS_6: + Restart BGPd daemon on DUT to check if all the + routes in respective vrfs are reinstalled.. +CHAOS_2: + Delete a VRF instance from DUT and check if the routes get + deleted from subsequent neighbour routers and appears again once VRF + is re-added. +CHAOS_4: + Verify that VRF names are locally significant + to a router, and end to end connectivity depends on unique + virtual circuits (using VLANs or separate physical interfaces). +CHAOS_8: + Restart all FRR services (reboot DUT) to check if all + the routes in respective vrfs are reinstalled. """ import os @@ -79,6 +92,10 @@ from lib.common_config import ( check_router_status, apply_raw_config, required_linux_kernel_version, + kill_router_daemons, + start_router_daemons, + stop_router, + start_router ) from lib.topolog import logger @@ -112,7 +129,7 @@ LOOPBACK_2 = { "ipv4": "20.20.20.20/32", "ipv6": "20::20:20/128", "ipv4_mask": "255.255.255.255", - "ipv6_mask": None, + "ipv6_mask": None } MAX_PATHS = 2 @@ -143,7 +160,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.14") if result is not True: pytest.skip("Kernel requirements are not met") @@ -1194,7 +1211,7 @@ def test_shut_noshut_p1(request): result = create_router_bgp(tgen, topo, input_dict_3) assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) - step("Api call to modfiy BGP timerse") + step("Api call to modfiy BGP timers") input_dict_4 = { "r1": { @@ -1508,7 +1525,7 @@ def test_shut_noshut_p1(request): " when the interface is shut" ) - step("Sleeping for holddowntimer+1 sec..") + step("Sleeping for {}+1 sec..".format(HOLDDOWNTIMER)) sleep(HOLDDOWNTIMER + 1) result = verify_bgp_convergence(tgen, topo, expected=False) @@ -1718,7 +1735,7 @@ def test_vrf_vlan_routing_table_p1(request): tc_name, result ) - step("Api call to modfiy BGP timerse") + step("Api call to modfiy BGP timers") input_dict_4 = { "r3": { @@ -1780,7 +1797,7 @@ def test_vrf_vlan_routing_table_p1(request): tc_name, result ) - step("Sleeping for holdowntimer+1 sec..") + step("Sleeping for {}+1 sec..".format(HOLDDOWNTIMER)) sleep(HOLDDOWNTIMER + 1) for addr_type in ADDR_TYPES: @@ -1811,7 +1828,7 @@ def test_vrf_vlan_routing_table_p1(request): ) step( - "After deleting VRFs ipv6 addresses wil be deleted from kernel " + "After deleting VRFs ipv6 addresses will be deleted from kernel " " Adding back ipv6 addresses" ) @@ -1829,7 +1846,7 @@ def test_vrf_vlan_routing_table_p1(request): tgen, dut, intf_name, intf_ipv6, vrf, create=False ) - step("Sleeping for holdowntimer+1 sec..") + step("Sleeping for {}+1 sec..".format(HOLDDOWNTIMER)) sleep(HOLDDOWNTIMER + 1) for addr_type in ADDR_TYPES: @@ -2011,6 +2028,1782 @@ def test_vrf_route_leaking_next_hop_interface_flapping_p1(request): write_test_footer(tc_name) +def test_restart_bgpd_daemon_p1(request): + """ + CHAOS_6: + Restart BGPd daemon on DUT to check if all the + routes in respective vrfs are reinstalled.. + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + + if tgen.routers_have_failure(): + check_router_status(tgen) + + reset_config_on_routers(tgen) + + step( + "Advertise unique BGP prefixes(IPv4+IPv6) from RED_1" + " in vrf instances(RED_A and RED_B)." + ) + + for addr_type in ADDR_TYPES: + input_dict_1 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_B", + }, + ] + } + } + result = create_static_routes(tgen, input_dict_1) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) + + step( + "Advertise unique BGP prefixes(IPv4+IPv6) from BLUE_1 in" + " vrf instances(BLUE_A and BLUE_B)." + ) + + for addr_type in ADDR_TYPES: + input_dict_2 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_B", + }, + ] + } + } + result = create_static_routes(tgen, input_dict_2) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) + + step("Redistribute static..") + + input_dict_3 = {} + for dut in ["red1", "blue1"]: + temp = {dut: {"bgp": []}} + input_dict_3.update(temp) + + if "red" in dut: + VRFS = ["RED_A", "RED_B"] + AS_NUM = [500, 500] + elif "blue" in dut: + VRFS = ["BLUE_A", "BLUE_B"] + AS_NUM = [800, 800] + + for vrf, as_num in zip(VRFS, AS_NUM): + temp[dut]["bgp"].append( + { + "local_as": as_num, + "vrf": vrf, + "address_family": { + "ipv4": { + "unicast": {"redistribute": [{"redist_type": "static"}]} + }, + "ipv6": { + "unicast": {"redistribute": [{"redist_type": "static"}]} + }, + }, + } + ) + + result = create_router_bgp(tgen, topo, input_dict_3) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + + step("Kill BGPd daemon on R1.") + kill_router_daemons(tgen, "r1", ["bgpd"]) + + for addr_type in ADDR_TYPES: + dut = "r2" + input_dict_1 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_B", + }, + ] + } + } + + input_dict_2 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_B", + }, + ] + } + } + + 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 + ) + + result = verify_rib(tgen, addr_type, dut, input_dict_2, expected=False) + assert result is not True, "Testcase {} :Failed \n Error {}".format( + tc_name, result + ) + + step("Bring up BGPd daemon on R1.") + start_router_daemons(tgen, "r1", ["bgpd"]) + + result = verify_bgp_convergence(tgen, topo) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r2" + input_dict_1 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_B", + }, + ] + } + } + + input_dict_2 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_B", + }, + ] + } + } + + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + 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_delete_and_re_add_vrf_p1(request): + """ + CHAOS_2: + Delete a VRF instance from DUT and check if the routes get + deleted from subsequent neighbour routers and appears again once VRF + is re-added. + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + reset_config_on_routers(tgen) + + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + step( + "Advertise unique prefixes in BGP using static redistribution" + "for both vrfs (RED_A and RED_B) on router RED_1" + ) + + for addr_type in ADDR_TYPES: + input_dict_1 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_B", + }, + ] + } + } + result = create_static_routes(tgen, input_dict_1) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) + + step( + "Advertise unique prefixes in BGP using static redistribution" + " for both vrfs (BLUE_A and BLUE_B) on router BLUE_1." + ) + + for addr_type in ADDR_TYPES: + input_dict_2 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK3_1[addr_type]] + [NETWORK3_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + }, + { + "network": [NETWORK4_1[addr_type]] + [NETWORK4_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_B", + }, + ] + } + } + result = create_static_routes(tgen, input_dict_2) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) + + step("Redistribute static for vrfs RED_A and RED_B and BLUE_A and BLUE_B") + + input_dict_3 = {} + for dut in ["red1", "blue1"]: + temp = {dut: {"bgp": []}} + input_dict_3.update(temp) + + if "red" in dut: + VRFS = ["RED_A", "RED_B"] + AS_NUM = [500, 500] + elif "blue" in dut: + VRFS = ["BLUE_A", "BLUE_B"] + AS_NUM = [800, 800] + + for vrf, as_num in zip(VRFS, AS_NUM): + temp[dut]["bgp"].append( + { + "local_as": as_num, + "vrf": vrf, + "address_family": { + "ipv4": { + "unicast": {"redistribute": [{"redist_type": "static"}]} + }, + "ipv6": { + "unicast": {"redistribute": [{"redist_type": "static"}]} + }, + }, + } + ) + + result = create_router_bgp(tgen, topo, input_dict_3) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + + step("Verifying RIB and FIB before deleting VRFs") + + for addr_type in ADDR_TYPES: + dut = "r2" + input_dict_1 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_B", + }, + ] + } + } + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r2" + input_dict_2 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK3_1[addr_type]] + [NETWORK3_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + }, + { + "network": [NETWORK4_1[addr_type]] + [NETWORK4_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_B", + }, + ] + } + } + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Api call to modfiy BGP timers") + + input_dict_4 = { + "r1": { + "bgp": [ + { + "local_as": "100", + "vrf": "RED_A", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + { + "local_as": "100", + "vrf": "RED_B", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + { + "local_as": "100", + "vrf": "BLUE_A", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link3": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link3": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + { + "local_as": "100", + "vrf": "BLUE_B", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link4": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r2": { + "dest_link": { + "r1-link4": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + ] + } + } + + result = create_router_bgp(tgen, topo, input_dict_4) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + clear_bgp(tgen, addr_type, "r1", vrf=["RED_A", "RED_B", "BLUE_A", "BLUE_B"]) + + step("Delete vrfs RED_A and BLUE_A from R1.") + + input_dict = { + "r1": { + "vrfs": [ + {"name": "RED_A", "id": "1", "delete": True}, + {"name": "BLUE_A", "id": "3", "delete": True}, + ] + } + } + + result = create_vrf_cfg(tgen, input_dict) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step( + "R2 must not receive the prefixes(in respective vrfs)" + "originated from RED_1 and BLUE_1." + ) + + step("Wait for {}+1 sec..".format(HOLDDOWNTIMER)) + sleep(HOLDDOWNTIMER + 1) + + for addr_type in ADDR_TYPES: + dut = "r2" + input_dict_2 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + } + ] + }, + "blue1": { + "static_routes": [ + { + "network": [NETWORK3_1[addr_type]] + [NETWORK3_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + } + ] + }, + } + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2, expected=False) + assert result is not True, ( + "Testcase {} :Failed \n Expected Behaviour:" + " Routes are not present \n Error {}".format(tc_name, result) + ) + + result = verify_rib(tgen, addr_type, dut, input_dict_2, expected=False) + assert result is not True, ( + "Testcase {} :Failed \n Expected Behaviour:" + " Routes are not present \n Error {}".format(tc_name, result) + ) + + step("Add vrfs again RED_A and BLUE_A on R1.") + + result = create_vrf_cfg(tgen, {"r1": topo["routers"]["r1"]}) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + create_interfaces_cfg(tgen, {"r1": topo["routers"]["r1"]}) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step( + "After deleting VRFs ipv6 addresses will be deleted from kernel " + " Adding back ipv6 addresses" + ) + + dut = "r1" + vrfs = ["RED_A", "BLUE_A"] + + for vrf in vrfs: + for c_link, c_data in topo["routers"][dut]["links"].items(): + if c_data["vrf"] != vrf: + continue + + intf_name = c_data["interface"] + intf_ipv6 = c_data["ipv6"] + + create_interface_in_kernel( + tgen, dut, intf_name, intf_ipv6, vrf, create=False + ) + + step( + "R2 should now receive the prefixes(in respective vrfs)" + "again. Check the debugging logs as well. For verification" + " use same commands as mention in step-3." + ) + + for addr_type in ADDR_TYPES: + dut = "r2" + input_dict_2 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + } + ] + } + } + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "r2" + input_dict_2 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK3_1[addr_type]] + [NETWORK3_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + } + ] + } + } + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + 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_vrf_name_significance_p1(request): + """ + CHAOS_4: + Verify that VRF names are locally significant + to a router, and end to end connectivity depends on unique + virtual circuits (using VLANs or separate physical interfaces). + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + reset_config_on_routers(tgen) + + if tgen.routers_have_failure(): + check_router_status(tgen) + + step( + "Advertise unique prefixes in BGP using static redistribution" + "for both vrfs (RED_A and RED_B) on router RED_1" + ) + + for addr_type in ADDR_TYPES: + input_dict_1 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_B", + }, + ] + } + } + result = create_static_routes(tgen, input_dict_1) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) + + step( + "Advertise unique prefixes in BGP using static redistribution" + " for both vrfs (BLUE_A and BLUE_B) on router BLUE_1." + ) + + for addr_type in ADDR_TYPES: + input_dict_2 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK3_1[addr_type]] + [NETWORK3_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + }, + { + "network": [NETWORK4_1[addr_type]] + [NETWORK4_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_B", + }, + ] + } + } + result = create_static_routes(tgen, input_dict_2) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) + + step("Redistribute static for vrfs RED_A and RED_B and BLUE_A and BLUE_B") + + input_dict_3 = {} + for dut in ["red1", "blue1"]: + temp = {dut: {"bgp": []}} + input_dict_3.update(temp) + + if "red" in dut: + VRFS = ["RED_A", "RED_B"] + AS_NUM = [500, 500] + elif "blue" in dut: + VRFS = ["BLUE_A", "BLUE_B"] + AS_NUM = [800, 800] + + for vrf, as_num in zip(VRFS, AS_NUM): + temp[dut]["bgp"].append( + { + "local_as": as_num, + "vrf": vrf, + "address_family": { + "ipv4": { + "unicast": {"redistribute": [{"redist_type": "static"}]} + }, + "ipv6": { + "unicast": {"redistribute": [{"redist_type": "static"}]} + }, + }, + } + ) + + result = create_router_bgp(tgen, topo, input_dict_3) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + + step("Configure allowas-in on red2 and blue2") + + input_dict_4 = { + "red2": { + "bgp": [ + { + "local_as": "500", + "vrf": "RED_A", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "red2-link1": { + "allowas-in": {"number_occurences": 2} + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "red2-link1": { + "allowas-in": {"number_occurences": 2} + } + } + } + } + } + }, + }, + }, + { + "local_as": "500", + "vrf": "RED_B", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "red2-link2": { + "allowas-in": {"number_occurences": 2} + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "red2-link2": { + "allowas-in": {"number_occurences": 2} + } + } + } + } + } + }, + }, + }, + ] + }, + "blue2": { + "bgp": [ + { + "local_as": "800", + "vrf": "BLUE_A", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "blue2-link1": { + "allowas-in": {"number_occurences": 2} + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "blue2-link1": { + "allowas-in": {"number_occurences": 2} + } + } + } + } + } + }, + }, + }, + { + "local_as": "800", + "vrf": "BLUE_B", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "blue2-link2": { + "allowas-in": {"number_occurences": 2} + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "blue2-link2": { + "allowas-in": {"number_occurences": 2} + } + } + } + } + } + }, + }, + }, + ] + }, + } + + result = create_router_bgp(tgen, topo, input_dict_4) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + + step("Verifying RIB and FIB before deleting VRFs") + + for addr_type in ADDR_TYPES: + dut = "red2" + input_dict_1 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + } + ] + } + } + input_dict_2 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_B", + } + ] + } + } + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "blue2" + input_dict_3 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK3_1[addr_type]] + [NETWORK3_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + } + ] + } + } + + input_dict_4 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK4_1[addr_type]] + [NETWORK4_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_B", + } + ] + } + } + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_3) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_3) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_4) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Api call to modfiy BGP timers") + + input_dict_4 = { + "r3": { + "bgp": [ + { + "local_as": "200", + "vrf": "RED_A", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "red2": { + "dest_link": { + "r3-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "red2": { + "dest_link": { + "r3-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + { + "local_as": "200", + "vrf": "RED_B", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "red2": { + "dest_link": { + "r3-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "red2": { + "dest_link": { + "r3-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + { + "local_as": "200", + "vrf": "BLUE_A", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "blue2": { + "dest_link": { + "r3-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "blue2": { + "dest_link": { + "r3-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + { + "local_as": "200", + "vrf": "BLUE_B", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "blue2": { + "dest_link": { + "r3-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "blue2": { + "dest_link": { + "r3-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + ] + }, + "red2": { + "bgp": [ + { + "local_as": "500", + "vrf": "RED_A", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "red2-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "red2-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + { + "local_as": "500", + "vrf": "RED_B", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "red2-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "red2-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + ] + }, + "blue2": { + "bgp": [ + { + "local_as": "800", + "vrf": "BLUE_A", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "blue2-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "blue2-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + { + "local_as": "800", + "vrf": "BLUE_B", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "blue2-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "r3": { + "dest_link": { + "blue2-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + ] + }, + } + + result = create_router_bgp(tgen, topo, input_dict_4) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + clear_bgp(tgen, addr_type, "r3", vrf=["RED_A", "RED_B", "BLUE_A", "BLUE_B"]) + + clear_bgp(tgen, addr_type, "red2", vrf=["RED_A", "RED_B"]) + + clear_bgp(tgen, addr_type, "blue2", vrf=["BLUE_A", "BLUE_B"]) + + step("Delete vrfs RED_A and BLUE_A from R3") + + input_dict = { + "r3": { + "vrfs": [ + {"name": "RED_A", "id": "1", "delete": True}, + {"name": "BLUE_A", "id": "3", "delete": True}, + ] + } + } + + result = create_vrf_cfg(tgen, input_dict) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + step("Waiting for {}+1..".format(HOLDDOWNTIMER)) + sleep(HOLDDOWNTIMER + 1) + + step("Verify RIB and FIB after deleting VRFs") + + for addr_type in ADDR_TYPES: + dut = "red2" + input_dict_1 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + } + ] + } + } + + result = verify_rib(tgen, addr_type, dut, input_dict_1, expected=False) + assert ( + result is not True + ), "Testcase {} :Failed \n Expected Behaviour: Routes are not" + " present \n Error {}".format(tc_name, result) + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1, expected=False) + assert ( + result is not True + ), "Testcase {} :Failed \n Expected Behaviour: Routes are not" + " present \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "blue2" + input_dict_2 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK3_1[addr_type]] + [NETWORK3_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + } + ] + } + } + + result = verify_rib(tgen, addr_type, dut, input_dict_2, expected=False) + assert result is not True, ( + "Testcase {} :Failed \n Expected Behaviour: Routes are not" + " present \n Error {}".format(tc_name, result) + ) + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2, expected=False) + assert result is not True, ( + "Testcase {} :Failed \n Expected Behaviour: Routes are not" + " present \n Error {}".format(tc_name, result) + ) + + step("Create 2 new VRFs PINK_A and GREY_A IN R3") + + topo_modify = deepcopy(topo) + topo_modify["routers"]["r3"]["vrfs"][0]["name"] = "PINK_A" + topo_modify["routers"]["r3"]["vrfs"][0]["id"] = "1" + topo_modify["routers"]["r3"]["vrfs"][2]["name"] = "GREY_A" + topo_modify["routers"]["r3"]["vrfs"][2]["id"] = "3" + + topo_modify["routers"]["r3"]["links"]["red2-link1"]["vrf"] = "PINK_A" + topo_modify["routers"]["r3"]["links"]["blue2-link1"]["vrf"] = "GREY_A" + + topo_modify["routers"]["r3"]["links"]["r2-link1"]["vrf"] = "PINK_A" + topo_modify["routers"]["r3"]["links"]["r2-link3"]["vrf"] = "GREY_A" + + topo_modify["routers"]["r3"]["links"]["r4-link1"]["vrf"] = "PINK_A" + topo_modify["routers"]["r3"]["links"]["r4-link3"]["vrf"] = "GREY_A" + + topo_modify["routers"]["r3"]["bgp"][0]["vrf"] = "PINK_A" + topo_modify["routers"]["r3"]["bgp"][2]["vrf"] = "GREY_A" + + result = create_vrf_cfg(tgen, {"r3": topo_modify["routers"]["r3"]}) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + create_interfaces_cfg(tgen, {"r3": topo_modify["routers"]["r3"]}) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = create_router_bgp(tgen, topo_modify["routers"]) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + + step("Api call to modfiy BGP timers") + + input_dict_4 = { + "r3": { + "bgp": [ + { + "local_as": "200", + "vrf": "PINK_A", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "red2": { + "dest_link": { + "r3-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "red2": { + "dest_link": { + "r3-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + { + "local_as": "200", + "vrf": "RED_B", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "red2": { + "dest_link": { + "r3-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "red2": { + "dest_link": { + "r3-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + { + "local_as": "200", + "vrf": "GREY_A", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "blue2": { + "dest_link": { + "r3-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "blue2": { + "dest_link": { + "r3-link1": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + { + "local_as": "200", + "vrf": "BLUE_B", + "address_family": { + "ipv4": { + "unicast": { + "neighbor": { + "blue2": { + "dest_link": { + "r3-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + "ipv6": { + "unicast": { + "neighbor": { + "blue2": { + "dest_link": { + "r3-link2": { + "keepalivetimer": KEEPALIVETIMER, + "holddowntimer": HOLDDOWNTIMER, + } + } + } + } + } + }, + }, + }, + ] + } + } + + result = create_router_bgp(tgen, topo_modify, input_dict_4) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + clear_bgp(tgen, addr_type, "r3", vrf=["PINK_A", "RED_B", "GREY_A", "BLUE_B"]) + + step( + "After deleting VRFs ipv6 addresses will be deleted from kernel " + " Adding back ipv6 addresses" + ) + + dut = "r3" + vrfs = ["GREY_A", "PINK_A"] + + for vrf in vrfs: + for c_link, c_data in topo_modify["routers"][dut]["links"].items(): + if c_data["vrf"] != vrf: + continue + + intf_name = c_data["interface"] + intf_ipv6 = c_data["ipv6"] + + create_interface_in_kernel( + tgen, dut, intf_name, intf_ipv6, vrf, create=False + ) + + step("Waiting for {}+1 sec..".format(HOLDDOWNTIMER)) + sleep(HOLDDOWNTIMER + 1) + + step( + "Advertised prefixes should appear again in respective VRF" + " table on routers RED_2 and BLUE_2. Verify fib and rib entries" + ) + + for addr_type in ADDR_TYPES: + dut = "red2" + input_dict_1 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + } + ] + } + } + + input_dict_2 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_B", + } + ] + } + } + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_2) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + for addr_type in ADDR_TYPES: + dut = "blue2" + input_dict_3 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK3_1[addr_type]] + [NETWORK3_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + } + ] + } + } + + input_dict_4 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK4_1[addr_type]] + [NETWORK4_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_B", + } + ] + } + } + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_3) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_3) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + result = verify_rib(tgen, addr_type, dut, input_dict_4) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + write_test_footer(tc_name) + + +def test_restart_frr_services_p1(request): + """ + CHAOS_8: + Restart all FRR services (reboot DUT) to check if all + the routes in respective vrfs are reinstalled. + """ + + tgen = get_topogen() + tc_name = request.node.name + write_test_header(tc_name) + reset_config_on_routers(tgen) + + if tgen.routers_have_failure(): + check_router_status(tgen) + + step( + "Advertise unique BGP prefixes(IPv4+IPv6) from RED_1" + " in vrf instances(RED_A and RED_B)." + ) + + for addr_type in ADDR_TYPES: + input_dict_1 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_B", + }, + ] + } + } + result = create_static_routes(tgen, input_dict_1) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) + + step( + "Advertise unique BGP prefixes(IPv4+IPv6) from BLUE_1 in" + " vrf instances(BLUE_A and BLUE_B)." + ) + + for addr_type in ADDR_TYPES: + input_dict_2 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_B", + }, + ] + } + } + result = create_static_routes(tgen, input_dict_2) + assert result is True, "Testcase {} : Failed \n Error: {}".format( + tc_name, result + ) + + step("Redistribute static..") + + input_dict_3 = {} + for dut in ["red1", "blue1"]: + temp = {dut: {"bgp": []}} + input_dict_3.update(temp) + + if "red" in dut: + VRFS = ["RED_A", "RED_B"] + AS_NUM = [500, 500] + elif "blue" in dut: + VRFS = ["BLUE_A", "BLUE_B"] + AS_NUM = [800, 800] + + for vrf, as_num in zip(VRFS, AS_NUM): + temp[dut]["bgp"].append( + { + "local_as": as_num, + "vrf": vrf, + "address_family": { + "ipv4": { + "unicast": {"redistribute": [{"redist_type": "static"}]} + }, + "ipv6": { + "unicast": {"redistribute": [{"redist_type": "static"}]} + }, + }, + } + ) + + result = create_router_bgp(tgen, topo, input_dict_3) + assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result) + + step("Restart frr on R1") + stop_router(tgen, "r1") + start_router(tgen, "r1") + + for addr_type in ADDR_TYPES: + dut = "r2" + + input_dict_1 = { + "red1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "RED_B", + }, + ] + } + } + + input_dict_2 = { + "blue1": { + "static_routes": [ + { + "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_A", + }, + { + "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]], + "next_hop": NEXT_HOP_IP[addr_type], + "vrf": "BLUE_B", + }, + ] + } + } + + result = verify_rib(tgen, addr_type, dut, input_dict_1) + assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result) + + 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_multiview_topo1/test_bgp_multiview_topo1.py b/tests/topotests/bgp_multiview_topo1/test_bgp_multiview_topo1.py index 6344f7bb40..7635f74125 100644 --- a/tests/topotests/bgp_multiview_topo1/test_bgp_multiview_topo1.py +++ b/tests/topotests/bgp_multiview_topo1/test_bgp_multiview_topo1.py @@ -332,7 +332,7 @@ def test_bgp_routingTable(): if not success: resultstr = "No template matched.\n" - for f in diffresult.iterkeys(): + for f in diffresult.keys(): resultstr += ( "template %s: r%s failed Routing Table Check for view %s:\n%s\n" % (f, i, view, diffresult[f]) diff --git a/tests/topotests/bgp_rfapi_basic_sanity/scripts/add_routes.py b/tests/topotests/bgp_rfapi_basic_sanity/scripts/add_routes.py index f4b4da55d2..bc47dfc85c 100644 --- a/tests/topotests/bgp_rfapi_basic_sanity/scripts/add_routes.py +++ b/tests/topotests/bgp_rfapi_basic_sanity/scripts/add_routes.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand holddownFactorSet = luCommand( "r1", diff --git a/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_close.py b/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_close.py index 9fdef84cdf..e68fac86fa 100644 --- a/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_close.py +++ b/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_close.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand holddownFactorSet = luCommand( "r1", diff --git a/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_routes.py b/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_routes.py index 1caa827ce2..24b3cba96e 100644 --- a/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_routes.py +++ b/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_routes.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand luCommand("r1", 'vtysh -c "show bgp ipv4 vpn"', "", "none", "VPN SAFI") luCommand("r2", 'vtysh -c "show bgp ipv4 vpn"', "", "none", "VPN SAFI") diff --git a/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_timeout.py b/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_timeout.py index e68e9e93ab..f5c2db25ff 100644 --- a/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_timeout.py +++ b/tests/topotests/bgp_rfapi_basic_sanity/scripts/check_timeout.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand holddownFactorSet = luCommand( "r1", diff --git a/tests/topotests/bgp_rfapi_basic_sanity/scripts/cleanup_all.py b/tests/topotests/bgp_rfapi_basic_sanity/scripts/cleanup_all.py index eea977bfaf..7201ac8111 100644 --- a/tests/topotests/bgp_rfapi_basic_sanity/scripts/cleanup_all.py +++ b/tests/topotests/bgp_rfapi_basic_sanity/scripts/cleanup_all.py @@ -1,4 +1,4 @@ -from lutil import luCommand +from lib.lutil import luCommand luCommand( "r1", 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/isis-sr-topo1/rt2/step10/show_ip_route.ref b/tests/topotests/isis-sr-topo1/rt2/step10/show_ip_route.ref index 387d3b43d7..b7d52cecca 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,27 +134,6 @@ ] } ], - "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", 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 4dc0dd7cac..f2a54bf958 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 @@ -278,21 +278,6 @@ ] } ], - "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", 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 620f5eac67..29f4782482 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,21 +274,6 @@ ] } ], - "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", 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 19cdf9d896..dc61b86410 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,21 +281,6 @@ ] } ], - "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", 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 48b5e6491e..2d983c43b6 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,21 +254,6 @@ ] } ], - "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", 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 156beef0f1..0a64db60f6 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,21 +281,6 @@ ] } ], - "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", 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 dba5e8d8a2..88485477e3 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,21 +275,6 @@ ] } ], - "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", 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 156beef0f1..0a64db60f6 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,21 +281,6 @@ ] } ], - "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", 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 ece747bdac..769bc4d31e 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,21 +275,6 @@ ] } ], - "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", 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 156beef0f1..0a64db60f6 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,21 +281,6 @@ ] } ], - "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", 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 90588c6708..34cbf68b21 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,21 +281,6 @@ ] } ], - "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", 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 index e3ed7c20b2..aa0357d750 100644 --- a/tests/topotests/isis-tilfa-topo1/rt1/step1/show_mpls_table.ref +++ b/tests/topotests/isis-tilfa-topo1/rt1/step1/show_mpls_table.ref @@ -103,13 +103,13 @@ "type":"SR (IS-IS)", "outLabel":16060, "installed":true, - "nexthop":"10.0.1.2" + "nexthop":"10.0.1.3" }, { "type":"SR (IS-IS)", "outLabel":16060, "installed":true, - "nexthop":"10.0.1.3" + "nexthop":"10.0.1.2" } ] }, 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 index 1a9307ddb9..10b336f5b8 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt1/step3/show_ip_route.ref ++++ b/rt1/step4/show_ip_route.ref @@ -60,10 +60,7 @@ "ip":"10.0.1.2", "afi":"ipv4", 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 index f5036aeda8..904aaa1ce2 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt1/step3/show_ipv6_route.ref ++++ b/rt1/step4/show_ipv6_route.ref @@ -57,10 +57,7 @@ "fib":true, "afi":"ipv6", 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 index 30c612b544..d7d8753131 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt1/step3/show_mpls_table.ref ++++ b/rt1/step4/show_mpls_table.ref @@ -47,30 +47,6 @@ } ] 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 index 79a452ef69..b583fa97bd 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt1/step4/show_ip_route.ref ++++ b/rt1/step5/show_ip_route.ref @@ -60,7 +60,10 @@ "ip":"10.0.1.2", "afi":"ipv4", 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 index 805266aaaa..d608abec98 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt1/step4/show_ipv6_route.ref ++++ b/rt1/step5/show_ipv6_route.ref @@ -57,7 +57,10 @@ "fib":true, "afi":"ipv6", 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 index d7ab66ee18..b5161fcd55 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt1/step4/show_mpls_table.ref ++++ b/rt1/step5/show_mpls_table.ref @@ -47,6 +47,30 @@ } ] 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 index 9aa0cd2e39..726aed514f 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt1/step6/show_ip_route.ref ++++ b/rt1/step7/show_ip_route.ref @@ -83,10 +83,7 @@ "ip":"10.0.1.3", "afi":"ipv4", 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 index 52fd7caf91..2049f6fa19 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt1/step6/show_ipv6_route.ref ++++ b/rt1/step7/show_ipv6_route.ref @@ -79,10 +79,7 @@ "fib":true, "afi":"ipv6", 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 index 53332be569..22301ba1ff 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt1/step6/show_mpls_table.ref ++++ b/rt1/step7/show_mpls_table.ref @@ -71,30 +71,6 @@ } ] 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 index af9f72e718..4a1d4805a4 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt1/step7/show_ip_route.ref ++++ b/rt1/step8/show_ip_route.ref @@ -83,7 +83,10 @@ "ip":"10.0.1.3", "afi":"ipv4", 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 index b733b33ed9..eaece74e48 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt1/step7/show_ipv6_route.ref ++++ b/rt1/step8/show_ipv6_route.ref @@ -79,7 +79,10 @@ "fib":true, "afi":"ipv6", 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 index b6f8c962f0..46c17de019 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt1/step7/show_mpls_table.ref ++++ b/rt1/step8/show_mpls_table.ref @@ -71,6 +71,30 @@ } ] 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 index 1d96341557..06efdc96ce 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt1/step8/show_ip_route.ref ++++ b/rt1/step9/show_ip_route.ref @@ -85,7 +85,7 @@ "interfaceName":"eth-sw1", "active":true, 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 index 232b823ac2..a58f2d447c 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt1/step8/show_ipv6_route.ref ++++ b/rt1/step9/show_ipv6_route.ref @@ -81,7 +81,7 @@ "interfaceName":"eth-sw1", "active":true, 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 index 7f0d50f5f2..c0a1ac592b 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt1/step8/show_mpls_table.ref ++++ b/rt1/step9/show_mpls_table.ref @@ -71,30 +71,6 @@ } ] 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 index 23e07b7cda..7e1ccd10a2 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step1/show_ip_route.ref +++ b/tests/topotests/isis-tilfa-topo1/rt2/step1/show_ip_route.ref @@ -233,7 +233,10 @@ "ip":"10.0.1.3", "afi":"ipv4", "interfaceName":"eth-sw1", - "active":true + "active":true, + "labels":[ + 16060 + ] } ] } 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 index d9bd04ef30..6d31f6f26b 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step1/show_ipv6_route.ref +++ b/tests/topotests/isis-tilfa-topo1/rt2/step1/show_ipv6_route.ref @@ -104,7 +104,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-2", + "interfaceName":"eth-rt4-1", "active":true, "backupIndex":[ 0 @@ -116,7 +116,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-1", + "interfaceName":"eth-rt4-2", "active":true, "backupIndex":[ 0 @@ -152,7 +152,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-sw1", + "interfaceName":"eth-rt4-1", "active":true, "labels":[ 16051 @@ -161,7 +161,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-2", + "interfaceName":"eth-sw1", "active":true, "labels":[ 16051 @@ -170,7 +170,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-1", + "interfaceName":"eth-rt4-2", "active":true, "labels":[ 16051 @@ -192,7 +192,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-2", + "interfaceName":"eth-rt4-1", "active":true, "backupIndex":[ 0 @@ -204,7 +204,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-1", + "interfaceName":"eth-rt4-2", "active":true, "backupIndex":[ 0 @@ -218,7 +218,10 @@ { "afi":"ipv6", "interfaceName":"eth-sw1", - "active":true + "active":true, + "labels":[ + 16061 + ] } ] } 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 index cd2f879593..b9b906a31d 100644 --- a/tests/topotests/isis-tilfa-topo1/rt2/step1/show_mpls_table.ref +++ b/tests/topotests/isis-tilfa-topo1/rt2/step1/show_mpls_table.ref @@ -247,7 +247,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16060, "nexthop":"10.0.1.3" } ] @@ -278,7 +278,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16061, "interface":"eth-sw1" } ] 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 index 22b896f684..90e0895639 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt2/step1/show_ip_route.ref ++++ b/rt2/step2/show_ip_route.ref @@ -15,36 +15,10 @@ "afi":"ipv4", "interfaceName":"eth-sw1", @@ -74,7 +74,7 @@ ] } ], -@@ -248,40 +196,12 @@ +@@ -251,40 +199,12 @@ { "ip":"10.0.1.1", "afi":"ipv4", @@ -117,7 +117,7 @@ } ] } -@@ -377,24 +297,6 @@ +@@ -380,24 +300,6 @@ "ip":"10.0.1.3", "afi":"ipv4", "interfaceName":"eth-sw1", @@ -142,7 +142,7 @@ "active":true } ] -@@ -415,24 +317,6 @@ +@@ -418,24 +320,6 @@ "ip":"10.0.1.3", "afi":"ipv4", "interfaceName":"eth-sw1", 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 index 08c7d2b1fc..2d19f20f63 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt2/step1/show_ipv6_route.ref ++++ b/rt2/step2/show_ipv6_route.ref @@ -14,34 +14,10 @@ "afi":"ipv6", "interfaceName":"eth-sw1", 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 index 4feb927156..01fc74a60b 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt2/step1/show_mpls_table.ref ++++ b/rt2/step2/show_mpls_table.ref @@ -7,23 +7,7 @@ "type":"SR (IS-IS)", "outLabel":3, 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 index af1cebc76d..d93f036229 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt2/step2/show_ip_route.ref ++++ b/rt2/step3/show_ip_route.ref @@ -15,10 +15,36 @@ "afi":"ipv4", "interfaceName":"eth-sw1", @@ -74,7 +74,7 @@ ] } ], -@@ -196,12 +248,40 @@ +@@ -199,12 +251,40 @@ { "ip":"10.0.1.1", "afi":"ipv4", @@ -117,7 +117,7 @@ } ] } -@@ -297,6 +377,24 @@ +@@ -300,6 +380,24 @@ "ip":"10.0.1.3", "afi":"ipv4", "interfaceName":"eth-sw1", @@ -142,7 +142,7 @@ "active":true } ] -@@ -317,6 +415,24 @@ +@@ -320,6 +418,24 @@ "ip":"10.0.1.3", "afi":"ipv4", "interfaceName":"eth-sw1", 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 index 9809c316e8..68b618e91d 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt2/step2/show_ipv6_route.ref ++++ b/rt2/step3/show_ipv6_route.ref @@ -14,10 +14,34 @@ "afi":"ipv6", "interfaceName":"eth-sw1", 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 index 180323e4c8..966e153a6b 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt2/step2/show_mpls_table.ref ++++ b/rt2/step3/show_mpls_table.ref @@ -7,7 +7,23 @@ "type":"SR (IS-IS)", "outLabel":3, 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 index 12d45bbe07..dd75d76b9b 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt2/step3/show_ip_route.ref ++++ b/rt2/step4/show_ip_route.ref @@ -15,36 +15,10 @@ "afi":"ipv4", "interfaceName":"eth-sw1", @@ -147,7 +147,7 @@ ] } ], -@@ -248,40 +177,12 @@ +@@ -251,40 +180,12 @@ { "ip":"10.0.1.1", "afi":"ipv4", 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 index fdf658d59d..63731237ec 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt2/step3/show_ipv6_route.ref ++++ b/rt2/step4/show_ipv6_route.ref @@ -14,34 +14,10 @@ "afi":"ipv6", "interfaceName":"eth-sw1", @@ -100,10 +100,10 @@ ] } ] -@@ -162,19 +107,13 @@ +@@ -153,10 +98,7 @@ "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-2", + "interfaceName":"eth-rt4-1", - "active":true, - "labels":[ - 16051 @@ -112,8 +112,10 @@ }, { "fib":true, +@@ -171,10 +113,7 @@ + "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-1", + "interfaceName":"eth-rt4-2", - "active":true, - "labels":[ - 16051 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 index a78f79c576..3872ce4980 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt2/step3/show_mpls_table.ref ++++ b/rt2/step4/show_mpls_table.ref @@ -7,23 +7,7 @@ "type":"SR (IS-IS)", "outLabel":3, 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 index 7d20fad3f4..4d5636436c 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt2/step4/show_ip_route.ref ++++ b/rt2/step5/show_ip_route.ref @@ -15,10 +15,36 @@ "afi":"ipv4", "interfaceName":"eth-sw1", @@ -147,7 +147,7 @@ ] } ], -@@ -177,12 +248,40 @@ +@@ -180,12 +251,40 @@ { "ip":"10.0.1.1", "afi":"ipv4", 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 index 9330964338..f9e0276f85 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt2/step4/show_ipv6_route.ref ++++ b/rt2/step5/show_ipv6_route.ref @@ -14,10 +14,34 @@ "afi":"ipv6", "interfaceName":"eth-sw1", @@ -100,10 +100,10 @@ ] } ] -@@ -107,13 +162,19 @@ +@@ -98,7 +153,10 @@ "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-2", + "interfaceName":"eth-rt4-1", - "active":true + "active":true, + "labels":[ @@ -112,8 +112,10 @@ }, { "fib":true, +@@ -113,7 +171,10 @@ + "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-1", + "interfaceName":"eth-rt4-2", - "active":true + "active":true, + "labels":[ 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 index b1e44a727f..6aebbd6c82 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt2/step4/show_mpls_table.ref ++++ b/rt2/step5/show_mpls_table.ref @@ -7,7 +7,23 @@ "type":"SR (IS-IS)", "outLabel":3, 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 index c92195d704..5e73b97844 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt2/step6/show_ip_route.ref ++++ b/rt2/step7/show_ip_route.ref @@ -15,36 +15,10 @@ "afi":"ipv4", "interfaceName":"eth-sw1", @@ -144,7 +144,7 @@ } ] } -@@ -248,40 +169,12 @@ +@@ -251,40 +172,12 @@ { "ip":"10.0.1.1", "afi":"ipv4", @@ -187,7 +187,7 @@ } ] } -@@ -296,30 +189,13 @@ +@@ -299,30 +192,13 @@ { "ip":"10.0.2.4", "afi":"ipv4", @@ -220,7 +220,7 @@ } ] } -@@ -335,29 +211,12 @@ +@@ -338,29 +214,12 @@ "ip":"10.0.2.4", "afi":"ipv4", "interfaceName":"eth-rt4-1", @@ -252,7 +252,7 @@ } ] } -@@ -494,31 +353,14 @@ +@@ -497,31 +356,14 @@ "ip":"10.0.2.4", "afi":"ipv4", "interfaceName":"eth-rt4-1", 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 index 140c7b08bf..5dc4e59151 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt2/step6/show_ipv6_route.ref ++++ b/rt2/step7/show_ipv6_route.ref @@ -14,34 +14,10 @@ "afi":"ipv6", "interfaceName":"eth-sw1", @@ -72,7 +72,7 @@ ], @@ -106,9 +58,6 @@ "afi":"ipv6", - "interfaceName":"eth-rt4-2", + "interfaceName":"eth-rt4-1", "active":true, - "backupIndex":[ - 0 @@ -82,7 +82,7 @@ ] @@ -118,24 +67,10 @@ "afi":"ipv6", - "interfaceName":"eth-rt4-1", + "interfaceName":"eth-rt4-2", "active":true, - "backupIndex":[ - 0 @@ -108,7 +108,7 @@ @@ -153,28 +88,19 @@ "fib":true, "afi":"ipv6", - "interfaceName":"eth-sw1", + "interfaceName":"eth-rt4-1", - "active":true, - "labels":[ - 16051 @@ -118,7 +118,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-2", + "interfaceName":"eth-sw1", - "active":true, - "labels":[ - 16051 @@ -128,7 +128,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-1", + "interfaceName":"eth-rt4-2", - "active":true, - "labels":[ - 16051 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 index f8476cd0bb..6c0d7392f0 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt2/step6/show_mpls_table.ref ++++ b/rt2/step7/show_mpls_table.ref @@ -7,23 +7,7 @@ "type":"SR (IS-IS)", "outLabel":3, 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 index 7d5237e740..f5df607613 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt2/step7/show_ip_route.ref ++++ b/rt2/step8/show_ip_route.ref @@ -15,10 +15,36 @@ "afi":"ipv4", "interfaceName":"eth-sw1", @@ -144,7 +144,7 @@ } ] } -@@ -169,12 +248,40 @@ +@@ -172,12 +251,40 @@ { "ip":"10.0.1.1", "afi":"ipv4", @@ -187,7 +187,7 @@ } ] } -@@ -189,13 +296,30 @@ +@@ -192,13 +299,30 @@ { "ip":"10.0.2.4", "afi":"ipv4", @@ -220,7 +220,7 @@ } ] } -@@ -211,12 +335,29 @@ +@@ -214,12 +338,29 @@ "ip":"10.0.2.4", "afi":"ipv4", "interfaceName":"eth-rt4-1", @@ -252,7 +252,7 @@ } ] } -@@ -353,14 +494,31 @@ +@@ -356,14 +497,31 @@ "ip":"10.0.2.4", "afi":"ipv4", "interfaceName":"eth-rt4-1", 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 index 45322214e6..125f36b1b4 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt2/step7/show_ipv6_route.ref ++++ b/rt2/step8/show_ipv6_route.ref @@ -14,10 +14,34 @@ "afi":"ipv6", "interfaceName":"eth-sw1", @@ -72,7 +72,7 @@ ], @@ -58,6 +106,9 @@ "afi":"ipv6", - "interfaceName":"eth-rt4-2", + "interfaceName":"eth-rt4-1", "active":true, + "backupIndex":[ + 0 @@ -82,7 +82,7 @@ ] @@ -67,10 +118,24 @@ "afi":"ipv6", - "interfaceName":"eth-rt4-1", + "interfaceName":"eth-rt4-2", "active":true, + "backupIndex":[ + 0 @@ -108,7 +108,7 @@ @@ -88,19 +153,28 @@ "fib":true, "afi":"ipv6", - "interfaceName":"eth-sw1", + "interfaceName":"eth-rt4-1", - "active":true + "active":true, + "labels":[ @@ -118,7 +118,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-2", + "interfaceName":"eth-sw1", - "active":true + "active":true, + "labels":[ @@ -128,7 +128,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt4-1", + "interfaceName":"eth-rt4-2", - "active":true + "active":true, + "labels":[ 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 index 083c647802..a1d5d795c5 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt2/step7/show_mpls_table.ref ++++ b/rt2/step8/show_mpls_table.ref @@ -7,7 +7,23 @@ "type":"SR (IS-IS)", "outLabel":3, 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 index 15370a0a62..2475c639c1 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt2/step8/show_ip_route.ref ++++ b/rt2/step9/show_ip_route.ref @@ -31,7 +31,7 @@ "interfaceName":"eth-rt4-1", "active":true, @@ -72,7 +72,7 @@ ] } ] -@@ -271,7 +271,7 @@ +@@ -274,7 +274,7 @@ "interfaceName":"eth-rt4-1", "active":true, "labels":[ @@ -81,7 +81,7 @@ ] }, { -@@ -280,7 +280,7 @@ +@@ -283,7 +283,7 @@ "interfaceName":"eth-rt4-2", "active":true, "labels":[ @@ -90,7 +90,7 @@ ] } ] -@@ -318,7 +318,7 @@ +@@ -321,7 +321,7 @@ "interfaceName":"eth-sw1", "active":true, "labels":[ @@ -99,7 +99,7 @@ ] } ] -@@ -356,7 +356,7 @@ +@@ -359,7 +359,7 @@ "interfaceName":"eth-sw1", "active":true, "labels":[ @@ -108,7 +108,7 @@ ] } ] -@@ -517,7 +517,7 @@ +@@ -520,7 +520,7 @@ "interfaceName":"eth-sw1", "active":true, "labels":[ 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 index 2585f32595..2d21fbcde2 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt2/step8/show_ipv6_route.ref ++++ b/rt2/step9/show_ipv6_route.ref @@ -29,7 +29,7 @@ "interfaceName":"eth-rt4-1", "active":true, @@ -46,7 +46,7 @@ ] } @@ -155,7 +155,7 @@ - "interfaceName":"eth-sw1", + "interfaceName":"eth-rt4-1", "active":true, "labels":[ - 16051 @@ -55,7 +55,7 @@ }, { @@ -164,7 +164,7 @@ - "interfaceName":"eth-rt4-2", + "interfaceName":"eth-sw1", "active":true, "labels":[ - 16051 @@ -64,7 +64,7 @@ }, { @@ -173,7 +173,7 @@ - "interfaceName":"eth-rt4-1", + "interfaceName":"eth-rt4-2", "active":true, "labels":[ - 16051 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 index b90b889eba..bc0ec3157e 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt2/step8/show_mpls_table.ref ++++ b/rt2/step9/show_mpls_table.ref @@ -17,12 +17,12 @@ "backupNexthops":[ { 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 index 8c37180daf..d70e9fe882 100644 --- a/tests/topotests/isis-tilfa-topo1/rt3/step1/show_ip_route.ref +++ b/tests/topotests/isis-tilfa-topo1/rt3/step1/show_ip_route.ref @@ -233,7 +233,10 @@ "ip":"10.0.1.2", "afi":"ipv4", "interfaceName":"eth-sw1", - "active":true + "active":true, + "labels":[ + 16060 + ] } ] } 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 index 5ddb24af5a..058d33609b 100644 --- a/tests/topotests/isis-tilfa-topo1/rt3/step1/show_ipv6_route.ref +++ b/tests/topotests/isis-tilfa-topo1/rt3/step1/show_ipv6_route.ref @@ -104,7 +104,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-sw1", + "interfaceName":"eth-rt5-1", "active":true, "labels":[ 16041 @@ -113,7 +113,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-sw1", "active":true, "labels":[ 16041 @@ -122,7 +122,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "labels":[ 16041 @@ -144,7 +144,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, "backupIndex":[ 0 @@ -156,7 +156,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "backupIndex":[ 0 @@ -192,7 +192,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, "backupIndex":[ 0 @@ -204,7 +204,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "backupIndex":[ 0 @@ -218,7 +218,10 @@ { "afi":"ipv6", "interfaceName":"eth-sw1", - "active":true + "active":true, + "labels":[ + 16061 + ] } ] } 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 index f68d1f4244..1912df3f05 100644 --- a/tests/topotests/isis-tilfa-topo1/rt3/step1/show_mpls_table.ref +++ b/tests/topotests/isis-tilfa-topo1/rt3/step1/show_mpls_table.ref @@ -247,7 +247,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16060, "nexthop":"10.0.1.2" } ] @@ -278,7 +278,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16061, "interface":"eth-sw1" } ] 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 index 707f95495d..9ba73b057a 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt3/step3/show_ip_route.ref ++++ b/rt3/step4/show_ip_route.ref @@ -15,36 +15,10 @@ "afi":"ipv4", "interfaceName":"eth-sw1", @@ -144,7 +144,7 @@ ] } ], -@@ -248,40 +169,12 @@ +@@ -251,40 +172,12 @@ { "ip":"10.0.1.1", "afi":"ipv4", @@ -187,7 +187,7 @@ } ] } -@@ -372,30 +265,13 @@ +@@ -375,30 +268,13 @@ { "ip":"10.0.4.5", "afi":"ipv4", @@ -220,7 +220,7 @@ } ] } -@@ -411,29 +287,12 @@ +@@ -414,29 +290,12 @@ "ip":"10.0.4.5", "afi":"ipv4", "interfaceName":"eth-rt5-1", @@ -252,7 +252,7 @@ } ] } -@@ -528,31 +387,14 @@ +@@ -531,31 +390,14 @@ "ip":"10.0.4.5", "afi":"ipv4", "interfaceName":"eth-rt5-1", 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 index 76d0ebc913..04f61c4eb4 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt3/step3/show_ipv6_route.ref ++++ b/rt3/step4/show_ipv6_route.ref @@ -14,34 +14,10 @@ "afi":"ipv6", "interfaceName":"eth-sw1", @@ -73,7 +73,7 @@ @@ -105,28 +57,19 @@ "fib":true, "afi":"ipv6", - "interfaceName":"eth-sw1", + "interfaceName":"eth-rt5-1", - "active":true, - "labels":[ - 16041 @@ -83,7 +83,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-sw1", - "active":true, - "labels":[ - 16041 @@ -93,7 +93,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", - "active":true, - "labels":[ - 16041 @@ -104,7 +104,7 @@ } @@ -146,9 +89,6 @@ "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, - "backupIndex":[ - 0 @@ -114,7 +114,7 @@ ] @@ -158,24 +98,10 @@ "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, - "backupIndex":[ - 0 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 index b888c9d273..b3588ca791 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt3/step3/show_mpls_table.ref ++++ b/rt3/step4/show_mpls_table.ref @@ -7,23 +7,7 @@ "type":"SR (IS-IS)", "outLabel":3, 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 index 8eac75bec7..1af024fc2e 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt3/step4/show_ip_route.ref ++++ b/rt3/step5/show_ip_route.ref @@ -15,10 +15,36 @@ "afi":"ipv4", "interfaceName":"eth-sw1", @@ -144,7 +144,7 @@ ] } ], -@@ -169,12 +248,40 @@ +@@ -172,12 +251,40 @@ { "ip":"10.0.1.1", "afi":"ipv4", @@ -187,7 +187,7 @@ } ] } -@@ -265,13 +372,30 @@ +@@ -268,13 +375,30 @@ { "ip":"10.0.4.5", "afi":"ipv4", @@ -220,7 +220,7 @@ } ] } -@@ -287,12 +411,29 @@ +@@ -290,12 +414,29 @@ "ip":"10.0.4.5", "afi":"ipv4", "interfaceName":"eth-rt5-1", @@ -252,7 +252,7 @@ } ] } -@@ -387,14 +528,31 @@ +@@ -390,14 +531,31 @@ "ip":"10.0.4.5", "afi":"ipv4", "interfaceName":"eth-rt5-1", 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 index fc55267ad1..7cc79d0e58 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt3/step4/show_ipv6_route.ref ++++ b/rt3/step5/show_ipv6_route.ref @@ -14,10 +14,34 @@ "afi":"ipv6", "interfaceName":"eth-sw1", @@ -73,7 +73,7 @@ @@ -57,19 +105,28 @@ "fib":true, "afi":"ipv6", - "interfaceName":"eth-sw1", + "interfaceName":"eth-rt5-1", - "active":true + "active":true, + "labels":[ @@ -83,7 +83,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-sw1", - "active":true + "active":true, + "labels":[ @@ -93,7 +93,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", - "active":true + "active":true, + "labels":[ @@ -104,7 +104,7 @@ } @@ -89,6 +146,9 @@ "afi":"ipv6", - "interfaceName":"eth-rt5-2", + "interfaceName":"eth-rt5-1", "active":true, + "backupIndex":[ + 0 @@ -114,7 +114,7 @@ ] @@ -98,10 +158,24 @@ "afi":"ipv6", - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, + "backupIndex":[ + 0 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 index 4ed491e241..75a0f01f55 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt3/step4/show_mpls_table.ref ++++ b/rt3/step5/show_mpls_table.ref @@ -7,7 +7,23 @@ "type":"SR (IS-IS)", "outLabel":3, 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 index 9273c75352..c814a2876b 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt3/step5/show_ip_route.ref ++++ b/rt3/step6/show_ip_route.ref @@ -31,7 +31,7 @@ "interfaceName":"eth-rt5-1", "active":true, @@ -81,7 +81,7 @@ ] } ], -@@ -271,7 +271,7 @@ +@@ -274,7 +274,7 @@ "interfaceName":"eth-rt5-1", "active":true, "labels":[ @@ -90,7 +90,7 @@ ] }, { -@@ -280,7 +280,7 @@ +@@ -283,7 +283,7 @@ "interfaceName":"eth-rt5-2", "active":true, "labels":[ 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 index f50be893e4..6f9405f20c 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt3/step5/show_ipv6_route.ref ++++ b/rt3/step6/show_ipv6_route.ref @@ -29,7 +29,7 @@ "interfaceName":"eth-rt5-1", "active":true, @@ -36,8 +36,8 @@ 16021 ] } -@@ -116,7 +116,7 @@ - "interfaceName":"eth-rt5-2", +@@ -107,7 +107,7 @@ + "interfaceName":"eth-rt5-1", "active":true, "labels":[ - 16041 @@ -46,7 +46,7 @@ }, { @@ -125,7 +125,7 @@ - "interfaceName":"eth-rt5-1", + "interfaceName":"eth-rt5-2", "active":true, "labels":[ - 16041 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 index b63a728ef1..d8c39685de 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt3/step5/show_mpls_table.ref ++++ b/rt3/step6/show_mpls_table.ref @@ -17,12 +17,12 @@ "backupNexthops":[ { 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 index 0ae87afa3b..c928fcdb4b 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt3/step6/show_ip_route.ref ++++ b/rt3/step7/show_ip_route.ref @@ -158,9 +158,6 @@ "active":true, "backupIndex":[ 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 index f392f644c0..0170971781 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt3/step6/show_ipv6_route.ref ++++ b/rt3/step7/show_ipv6_route.ref @@ -148,9 +148,6 @@ "active":true, "backupIndex":[ 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 index b74eb9579c..d7a3ed978f 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt3/step6/show_mpls_table.ref ++++ b/rt3/step7/show_mpls_table.ref @@ -159,68 +159,6 @@ } ] 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 index 25b42f2825..41a7ff3255 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt3/step7/show_ip_route.ref ++++ b/rt3/step8/show_ip_route.ref @@ -158,6 +158,9 @@ "active":true, "backupIndex":[ 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 index 42d9356c8a..bd49f8606b 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt3/step7/show_ipv6_route.ref ++++ b/rt3/step8/show_ipv6_route.ref @@ -148,6 +148,9 @@ "active":true, "backupIndex":[ 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 index bd40f954eb..4cc69b66f2 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt3/step7/show_mpls_table.ref ++++ b/rt3/step8/show_mpls_table.ref @@ -159,6 +159,68 @@ } ] 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 index 687e84ad40..cc0a482eee 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt3/step8/show_ip_route.ref ++++ b/rt3/step9/show_ip_route.ref @@ -185,7 +185,7 @@ "active":true, "labels":[ 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 index 4b76be66ac..650b982f0b 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt3/step8/show_ipv6_route.ref ++++ b/rt3/step9/show_ipv6_route.ref @@ -173,7 +173,7 @@ "active":true, "labels":[ 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 index 6f6451e510..8ce4f1d266 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt3/step8/show_mpls_table.ref ++++ b/rt3/step9/show_mpls_table.ref @@ -159,13 +159,13 @@ } ] @@ -31,7 +31,7 @@ { "type":"SR (IS-IS)", - "outLabel":16040, -+ "outLabel":3, ++ "outLabel":16060, "nexthop":"10.0.1.2" } ] @@ -63,7 +63,7 @@ { "type":"SR (IS-IS)", - "outLabel":16041, -+ "outLabel":3, ++ "outLabel":16061, "interface":"eth-sw1" } ] @@ -94,7 +94,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16060, + "outLabel":16040, "nexthop":"10.0.1.2" } @@ -126,7 +126,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16061, + "outLabel":16041, "interface":"eth-sw1" } 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 index 168b90a3f6..0ef5d1bc3f 100644 --- a/tests/topotests/isis-tilfa-topo1/rt4/step1/show_ip_route.ref +++ b/tests/topotests/isis-tilfa-topo1/rt4/step1/show_ip_route.ref @@ -41,7 +41,10 @@ "ip":"10.0.6.5", "afi":"ipv4", "interfaceName":"eth-rt5", - "active":true + "active":true, + "labels":[ + 16010 + ] } ] } @@ -169,7 +172,10 @@ "ip":"10.0.7.6", "afi":"ipv4", "interfaceName":"eth-rt6", - "active":true + "active":true, + "labels":[ + 16050 + ] } ] } @@ -203,7 +209,10 @@ "ip":"10.0.6.5", "afi":"ipv4", "interfaceName":"eth-rt5", - "active":true + "active":true, + "labels":[ + 16060 + ] } ] } 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 index a4442ee089..b640df30c1 100644 --- a/tests/topotests/isis-tilfa-topo1/rt4/step1/show_ipv6_route.ref +++ b/tests/topotests/isis-tilfa-topo1/rt4/step1/show_ipv6_route.ref @@ -12,7 +12,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "backupIndex":[ 0 @@ -24,7 +24,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "backupIndex":[ 0 @@ -38,7 +38,10 @@ { "afi":"ipv6", "interfaceName":"eth-rt5", - "active":true + "active":true, + "labels":[ + 16011 + ] } ] } @@ -56,7 +59,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "backupIndex":[ 0 @@ -68,7 +71,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, "backupIndex":[ 0 @@ -104,7 +107,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, "labels":[ 16031 @@ -113,7 +116,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt5", + "interfaceName":"eth-rt2-1", "active":true, "labels":[ 16031 @@ -122,7 +125,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt5", "active":true, "labels":[ 16031 @@ -158,7 +161,10 @@ { "afi":"ipv6", "interfaceName":"eth-rt6", - "active":true + "active":true, + "labels":[ + 16051 + ] } ] } @@ -190,7 +196,10 @@ { "afi":"ipv6", "interfaceName":"eth-rt5", - "active":true + "active":true, + "labels":[ + 16061 + ] } ] } 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 index 18354e947d..f60937ccbc 100644 --- a/tests/topotests/isis-tilfa-topo1/rt4/step1/show_mpls_table.ref +++ b/tests/topotests/isis-tilfa-topo1/rt4/step1/show_mpls_table.ref @@ -25,7 +25,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16010, "nexthop":"10.0.6.5" } ] @@ -56,7 +56,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16011, "interface":"eth-rt5" } ] @@ -188,7 +188,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16050, "nexthop":"10.0.7.6" } ] @@ -210,7 +210,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16051, "interface":"eth-rt6" } ] @@ -232,7 +232,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16060, "nexthop":"10.0.6.5" } ] @@ -254,7 +254,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16061, "interface":"eth-rt5" } ] 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 index 7dcdb744ac..8b115c2058 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt4/step3/show_ip_route.ref ++++ b/rt4/step4/show_ip_route.ref @@ -15,9 +15,6 @@ "afi":"ipv4", "interfaceName":"eth-rt2-1", @@ -10,29 +10,28 @@ "labels":[ 16010 ] -@@ -28,21 +25,10 @@ +@@ -28,20 +25,6 @@ "afi":"ipv4", "interfaceName":"eth-rt2-2", "active":true, - "backupIndex":[ - 0 - ], - "labels":[ - 16010 - ] - } +- "labels":[ +- 16010 +- ] +- } - ], - "backupNexthops":[ - { - "ip":"10.0.6.5", - "afi":"ipv4", - "interfaceName":"eth-rt5", -- "active":true -- } - ] - } - ], -@@ -62,9 +48,6 @@ +- "active":true, + "labels":[ + 16010 + ] +@@ -65,9 +48,6 @@ "afi":"ipv4", "interfaceName":"eth-rt2-1", "active":true, @@ -42,7 +41,7 @@ "labels":[ 3 ] -@@ -75,25 +58,10 @@ +@@ -78,25 +58,10 @@ "afi":"ipv4", "interfaceName":"eth-rt2-2", "active":true, @@ -68,7 +67,7 @@ ] } ], -@@ -156,21 +124,10 @@ +@@ -159,24 +124,10 @@ "afi":"ipv4", "interfaceName":"eth-rt5", "active":true, @@ -85,12 +84,15 @@ - "ip":"10.0.7.6", - "afi":"ipv4", - "interfaceName":"eth-rt6", -- "active":true +- "active":true, +- "labels":[ +- 16050 +- ] - } ] } ], -@@ -190,21 +147,10 @@ +@@ -196,24 +147,10 @@ "afi":"ipv4", "interfaceName":"eth-rt6", "active":true, @@ -107,12 +109,15 @@ - "ip":"10.0.6.5", - "afi":"ipv4", - "interfaceName":"eth-rt5", -- "active":true +- "active":true, +- "labels":[ +- 16060 +- ] - } ] } ], -@@ -223,27 +169,13 @@ +@@ -232,27 +169,13 @@ "ip":"10.0.2.2", "afi":"ipv4", "interfaceName":"eth-rt2-1", @@ -141,7 +146,7 @@ "active":true } ] -@@ -259,30 +191,13 @@ +@@ -268,30 +191,13 @@ { "ip":"10.0.2.2", "afi":"ipv4", @@ -174,7 +179,7 @@ } ] } -@@ -298,29 +213,12 @@ +@@ -307,29 +213,12 @@ "ip":"10.0.2.2", "afi":"ipv4", "interfaceName":"eth-rt2-1", @@ -206,7 +211,7 @@ } ] } -@@ -340,31 +238,6 @@ +@@ -349,31 +238,6 @@ "ip":"10.0.6.5", "afi":"ipv4", "interfaceName":"eth-rt5", @@ -238,7 +243,7 @@ "active":true } ] -@@ -385,31 +258,6 @@ +@@ -394,31 +258,6 @@ "ip":"10.0.6.5", "afi":"ipv4", "interfaceName":"eth-rt5", @@ -270,7 +275,7 @@ "active":true } ] -@@ -425,18 +273,7 @@ +@@ -434,18 +273,7 @@ { "ip":"10.0.6.5", "afi":"ipv4", @@ -290,7 +295,7 @@ } ] } -@@ -451,18 +288,7 @@ +@@ -460,18 +288,7 @@ { "ip":"10.0.7.6", "afi":"ipv4", 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 index b84ceaff1a..7f39285089 100644 --- 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 @@ -1,8 +1,8 @@ ---- 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 +--- a/rt4/step3/show_ipv6_route.ref ++++ b/rt4/step4/show_ipv6_route.ref @@ -14,9 +14,6 @@ "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, - "backupIndex":[ - 0 @@ -10,30 +10,29 @@ "labels":[ 16011 ] -@@ -26,20 +23,10 @@ +@@ -26,19 +23,6 @@ "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, - "backupIndex":[ - 0 - ], - "labels":[ - 16011 - ] - } +- "labels":[ +- 16011 +- ] +- } - ], - "backupNexthops":[ - { - "afi":"ipv6", - "interfaceName":"eth-rt5", -- "active":true -- } - ] - } - ], -@@ -58,9 +45,6 @@ +- "active":true, + "labels":[ + 16011 + ] +@@ -61,9 +45,6 @@ "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, - "backupIndex":[ - 0 @@ -41,9 +40,9 @@ "labels":[ 3 ] -@@ -70,24 +54,10 @@ +@@ -73,24 +54,10 @@ "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, - "backupIndex":[ - 0 @@ -66,7 +65,7 @@ ] } ], -@@ -146,20 +116,10 @@ +@@ -149,23 +116,10 @@ "afi":"ipv6", "interfaceName":"eth-rt5", "active":true, @@ -82,12 +81,15 @@ - { - "afi":"ipv6", - "interfaceName":"eth-rt6", -- "active":true +- "active":true, +- "labels":[ +- 16051 +- ] - } ] } ], -@@ -178,20 +138,10 @@ +@@ -184,23 +138,10 @@ "afi":"ipv6", "interfaceName":"eth-rt6", "active":true, @@ -103,7 +105,10 @@ - { - "afi":"ipv6", - "interfaceName":"eth-rt5", -- "active":true +- "active":true, +- "labels":[ +- 16061 +- ] - } ] } 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 index 70e0108b0d..3dcd36c176 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt4/step3/show_mpls_table.ref ++++ b/rt4/step4/show_mpls_table.ref @@ -7,26 +7,13 @@ "type":"SR (IS-IS)", "outLabel":16010, @@ -23,7 +23,7 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16010, - "nexthop":"10.0.6.5" + "nexthop":"10.0.2.2" } @@ -52,7 +52,7 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16011, - "interface":"eth-rt5" + "interface":"eth-rt2-1" } @@ -129,7 +129,7 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16050, - "nexthop":"10.0.7.6" + "nexthop":"10.0.6.5" } @@ -148,7 +148,7 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16051, - "interface":"eth-rt6" + "interface":"eth-rt5" } @@ -167,7 +167,7 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16060, - "nexthop":"10.0.6.5" + "nexthop":"10.0.7.6" } @@ -186,7 +186,7 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16061, - "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 index aa319a3232..484a3147dc 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt4/step4/show_ip_route.ref ++++ b/rt4/step5/show_ip_route.ref @@ -15,6 +15,9 @@ "afi":"ipv4", "interfaceName":"eth-rt2-1", @@ -10,29 +10,28 @@ "labels":[ 16010 ] -@@ -25,10 +28,21 @@ +@@ -25,6 +28,20 @@ "afi":"ipv4", "interfaceName":"eth-rt2-2", "active":true, + "backupIndex":[ + 0 + ], - "labels":[ - 16010 - ] - } ++ "labels":[ ++ 16010 ++ ] ++ } + ], + "backupNexthops":[ + { + "ip":"10.0.6.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", -+ "active":true -+ } - ] - } - ], -@@ -48,6 +62,9 @@ ++ "active":true, + "labels":[ + 16010 + ] +@@ -48,6 +65,9 @@ "afi":"ipv4", "interfaceName":"eth-rt2-1", "active":true, @@ -42,7 +41,7 @@ "labels":[ 3 ] -@@ -58,10 +75,25 @@ +@@ -58,10 +78,25 @@ "afi":"ipv4", "interfaceName":"eth-rt2-2", "active":true, @@ -68,7 +67,7 @@ ] } ], -@@ -124,10 +156,21 @@ +@@ -124,10 +159,24 @@ "afi":"ipv4", "interfaceName":"eth-rt5", "active":true, @@ -85,12 +84,15 @@ + "ip":"10.0.7.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", -+ "active":true ++ "active":true, ++ "labels":[ ++ 16050 ++ ] + } ] } ], -@@ -147,10 +190,21 @@ +@@ -147,10 +196,24 @@ "afi":"ipv4", "interfaceName":"eth-rt6", "active":true, @@ -107,12 +109,15 @@ + "ip":"10.0.6.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", -+ "active":true ++ "active":true, ++ "labels":[ ++ 16060 ++ ] + } ] } ], -@@ -169,13 +223,27 @@ +@@ -169,13 +232,27 @@ "ip":"10.0.2.2", "afi":"ipv4", "interfaceName":"eth-rt2-1", @@ -141,7 +146,7 @@ "active":true } ] -@@ -191,13 +259,30 @@ +@@ -191,13 +268,30 @@ { "ip":"10.0.2.2", "afi":"ipv4", @@ -174,7 +179,7 @@ } ] } -@@ -213,12 +298,29 @@ +@@ -213,12 +307,29 @@ "ip":"10.0.2.2", "afi":"ipv4", "interfaceName":"eth-rt2-1", @@ -206,7 +211,7 @@ } ] } -@@ -238,6 +340,31 @@ +@@ -238,6 +349,31 @@ "ip":"10.0.6.5", "afi":"ipv4", "interfaceName":"eth-rt5", @@ -238,7 +243,7 @@ "active":true } ] -@@ -258,6 +385,31 @@ +@@ -258,6 +394,31 @@ "ip":"10.0.6.5", "afi":"ipv4", "interfaceName":"eth-rt5", @@ -270,7 +275,7 @@ "active":true } ] -@@ -273,7 +425,18 @@ +@@ -273,7 +434,18 @@ { "ip":"10.0.6.5", "afi":"ipv4", @@ -290,7 +295,7 @@ } ] } -@@ -288,7 +451,18 @@ +@@ -288,7 +460,18 @@ { "ip":"10.0.7.6", "afi":"ipv4", 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 index 1bd207854c..3ad0085120 100644 --- 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 @@ -1,8 +1,8 @@ ---- 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 +--- a/rt4/step4/show_ipv6_route.ref ++++ b/rt4/step5/show_ipv6_route.ref @@ -14,6 +14,9 @@ "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, + "backupIndex":[ + 0 @@ -10,30 +10,29 @@ "labels":[ 16011 ] -@@ -23,10 +26,20 @@ +@@ -23,6 +26,19 @@ "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, + "backupIndex":[ + 0 + ], - "labels":[ - 16011 - ] - } ++ "labels":[ ++ 16011 ++ ] ++ } + ], + "backupNexthops":[ + { + "afi":"ipv6", + "interfaceName":"eth-rt5", -+ "active":true -+ } - ] - } - ], -@@ -45,6 +58,9 @@ ++ "active":true, + "labels":[ + 16011 + ] +@@ -45,6 +61,9 @@ "afi":"ipv6", - "interfaceName":"eth-rt2-1", + "interfaceName":"eth-rt2-2", "active":true, + "backupIndex":[ + 0 @@ -41,9 +40,9 @@ "labels":[ 3 ] -@@ -54,10 +70,24 @@ +@@ -54,10 +73,24 @@ "afi":"ipv6", - "interfaceName":"eth-rt2-2", + "interfaceName":"eth-rt2-1", "active":true, + "backupIndex":[ + 0 @@ -66,7 +65,7 @@ ] } ], -@@ -116,10 +146,20 @@ +@@ -116,10 +149,23 @@ "afi":"ipv6", "interfaceName":"eth-rt5", "active":true, @@ -82,12 +81,15 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt6", -+ "active":true ++ "active":true, ++ "labels":[ ++ 16051 ++ ] + } ] } ], -@@ -138,10 +178,20 @@ +@@ -138,10 +184,23 @@ "afi":"ipv6", "interfaceName":"eth-rt6", "active":true, @@ -103,7 +105,10 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt5", -+ "active":true ++ "active":true, ++ "labels":[ ++ 16061 ++ ] + } ] } 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 index 664b129a1b..20e363375b 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt4/step4/show_mpls_table.ref ++++ b/rt4/step5/show_mpls_table.ref @@ -7,13 +7,26 @@ "type":"SR (IS-IS)", "outLabel":16010, @@ -24,7 +24,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16010, + "nexthop":"10.0.6.5" } ] @@ -53,7 +53,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16011, + "interface":"eth-rt5" } ] @@ -130,7 +130,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16050, + "nexthop":"10.0.7.6" } ] @@ -149,7 +149,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16051, + "interface":"eth-rt6" } ] @@ -168,7 +168,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16060, + "nexthop":"10.0.6.5" } ] @@ -187,7 +187,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16061, + "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 index c758b89839..9070414730 100644 --- 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 @@ -1,6 +1,15 @@ ---- 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 @@ +--- a/rt4/step5/show_ip_route.ref ++++ b/rt4/step6/show_ip_route.ref +@@ -43,7 +43,7 @@ + "interfaceName":"eth-rt5", + "active":true, + "labels":[ +- 16010 ++ 30010 + ] + } + ] +@@ -93,7 +93,7 @@ "interfaceName":"eth-rt5", "active":true, "labels":[ @@ -9,7 +18,7 @@ 16020 ] } -@@ -134,7 +134,7 @@ +@@ -137,7 +137,7 @@ "interfaceName":"eth-rt5", "active":true, "labels":[ @@ -18,7 +27,16 @@ ] } ] -@@ -281,7 +281,7 @@ +@@ -211,7 +211,7 @@ + "interfaceName":"eth-rt5", + "active":true, + "labels":[ +- 16060 ++ 30060 + ] + } + ] +@@ -290,7 +290,7 @@ "interfaceName":"eth-rt5", "active":true, "labels":[ @@ -27,7 +45,7 @@ ] } ] -@@ -319,7 +319,7 @@ +@@ -328,7 +328,7 @@ "interfaceName":"eth-rt5", "active":true, "labels":[ 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 index ca495216dd..57a57647a1 100644 --- 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 @@ -1,6 +1,15 @@ ---- 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 @@ +--- a/rt4/step5/show_ipv6_route.ref ++++ b/rt4/step6/show_ipv6_route.ref +@@ -40,7 +40,7 @@ + "interfaceName":"eth-rt5", + "active":true, + "labels":[ +- 16011 ++ 30011 + ] + } + ] +@@ -87,7 +87,7 @@ "interfaceName":"eth-rt5", "active":true, "labels":[ @@ -9,12 +18,21 @@ 16021 ] } -@@ -116,7 +116,7 @@ +@@ -128,7 +128,7 @@ "interfaceName":"eth-rt5", "active":true, "labels":[ - 16031 + 30031 ] - }, - { + } + ] +@@ -198,7 +198,7 @@ + "interfaceName":"eth-rt5", + "active":true, + "labels":[ +- 16061 ++ 30061 + ] + } + ] 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 index 630e0419cf..94f87854d1 100644 --- 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 @@ -1,5 +1,23 @@ ---- 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 +--- a/rt4/step5/show_mpls_table.ref ++++ b/rt4/step6/show_mpls_table.ref +@@ -25,7 +25,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16010, ++ "outLabel":30010, + "nexthop":"10.0.6.5" + } + ] +@@ -56,7 +56,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16011, ++ "outLabel":30011, + "interface":"eth-rt5" + } + ] @@ -87,7 +87,7 @@ "backupNexthops":[ { @@ -36,3 +54,21 @@ "installed":true, "interface":"eth-rt5" } +@@ -232,7 +232,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16060, ++ "outLabel":30060, + "nexthop":"10.0.6.5" + } + ] +@@ -254,7 +254,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16061, ++ "outLabel":30061, + "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 index 30e0dcf3c0..e54873d5ab 100644 --- 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 @@ -1,6 +1,6 @@ ---- 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 @@ +--- a/rt4/step6/show_ip_route.ref ++++ b/rt4/step7/show_ip_route.ref +@@ -161,9 +161,6 @@ "active":true, "backupIndex":[ 0 @@ -10,3 +10,15 @@ ] } ], +@@ -172,10 +169,7 @@ + "ip":"10.0.7.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", +- "active":true, +- "labels":[ +- 16050 +- ] ++ "active":true + } + ] + } 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 index 2606027d75..92e08f99a0 100644 --- 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 @@ -1,6 +1,6 @@ ---- 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 @@ +--- a/rt4/step6/show_ipv6_route.ref ++++ b/rt4/step7/show_ipv6_route.ref +@@ -151,9 +151,6 @@ "active":true, "backupIndex":[ 0 @@ -10,3 +10,15 @@ ] } ], +@@ -161,10 +158,7 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt6", +- "active":true, +- "labels":[ +- 16051 +- ] ++ "active":true + } + ] + } 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 index 5334cfd048..fb614ebf6a 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt4/step6/show_mpls_table.ref ++++ b/rt4/step7/show_mpls_table.ref @@ -171,50 +171,6 @@ } ] @@ -21,7 +21,7 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16050, - "nexthop":"10.0.7.6" - } - ] @@ -43,7 +43,7 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16051, - "interface":"eth-rt6" - } - ] 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 index b393970e42..252da6e764 100644 --- 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 @@ -1,6 +1,6 @@ ---- 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 @@ +--- a/rt4/step7/show_ip_route.ref ++++ b/rt4/step8/show_ip_route.ref +@@ -161,6 +161,9 @@ "active":true, "backupIndex":[ 0 @@ -10,3 +10,15 @@ ] } ], +@@ -169,7 +172,10 @@ + "ip":"10.0.7.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", +- "active":true ++ "active":true, ++ "labels":[ ++ 16050 ++ ] + } + ] + } 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 index 8bad2edcf3..7057d2166a 100644 --- 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 @@ -1,6 +1,6 @@ ---- 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 @@ +--- a/rt4/step7/show_ipv6_route.ref ++++ b/rt4/step8/show_ipv6_route.ref +@@ -151,6 +151,9 @@ "active":true, "backupIndex":[ 0 @@ -10,3 +10,15 @@ ] } ], +@@ -158,7 +161,10 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt6", +- "active":true ++ "active":true, ++ "labels":[ ++ 16051 ++ ] + } + ] + } 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 index d296dbdcaf..3dc4303b9b 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt4/step7/show_mpls_table.ref ++++ b/rt4/step8/show_mpls_table.ref @@ -171,6 +171,50 @@ } ] @@ -21,7 +21,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16050, + "nexthop":"10.0.7.6" + } + ] @@ -43,7 +43,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16051, + "interface":"eth-rt6" + } + ] 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 index e69de29bb2..56f9cc534f 100644 --- 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 @@ -0,0 +1,11 @@ +--- a/rt4/step8/show_ip_route.ref ++++ b/rt4/step9/show_ip_route.ref +@@ -174,7 +174,7 @@ + "interfaceName":"eth-rt6", + "active":true, + "labels":[ +- 16050 ++ 16500 + ] + } + ] 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 index e69de29bb2..41e552177a 100644 --- 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 @@ -0,0 +1,11 @@ +--- a/rt4/step8/show_ipv6_route.ref ++++ b/rt4/step9/show_ipv6_route.ref +@@ -163,7 +163,7 @@ + "interfaceName":"eth-rt6", + "active":true, + "labels":[ +- 16051 ++ 16501 + ] + } + ] 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 index 408cbfb0ba..627e292518 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt4/step8/show_mpls_table.ref ++++ b/rt4/step9/show_mpls_table.ref @@ -171,15 +171,15 @@ } ] @@ -19,11 +19,13 @@ "backupIndex":[ 0 ] -@@ -189,19 +189,19 @@ +@@ -188,20 +188,20 @@ + "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, +- "outLabel":16050, - "nexthop":"10.0.7.6" ++ "outLabel":30060, + "nexthop":"10.0.6.5" } ] @@ -43,11 +45,13 @@ "backupIndex":[ 0 ] -@@ -211,19 +211,19 @@ +@@ -210,20 +210,20 @@ + "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, +- "outLabel":16051, - "interface":"eth-rt6" ++ "outLabel":30061, + "interface":"eth-rt5" } ] @@ -67,11 +71,13 @@ "backupIndex":[ 0 ] -@@ -233,19 +233,19 @@ +@@ -232,20 +232,20 @@ + "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, +- "outLabel":30060, - "nexthop":"10.0.6.5" ++ "outLabel":16500, + "nexthop":"10.0.7.6" } ] @@ -91,11 +97,13 @@ "backupIndex":[ 0 ] -@@ -255,7 +255,7 @@ +@@ -254,8 +254,8 @@ + "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, +- "outLabel":30061, - "interface":"eth-rt5" ++ "outLabel":16501, + "interface":"eth-rt6" } ] 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 index f747065f9c..93740e22e0 100644 --- a/tests/topotests/isis-tilfa-topo1/rt5/step1/show_ip_route.ref +++ b/tests/topotests/isis-tilfa-topo1/rt5/step1/show_ip_route.ref @@ -41,7 +41,10 @@ "ip":"10.0.6.4", "afi":"ipv4", "interfaceName":"eth-rt4", - "active":true + "active":true, + "labels":[ + 16010 + ] } ] } @@ -169,7 +172,10 @@ "ip":"10.0.8.6", "afi":"ipv4", "interfaceName":"eth-rt6", - "active":true + "active":true, + "labels":[ + 16040 + ] } ] } @@ -203,7 +209,10 @@ "ip":"10.0.6.4", "afi":"ipv4", "interfaceName":"eth-rt4", - "active":true + "active":true, + "labels":[ + 16060 + ] } ] } 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 index 6c0a5e0b9b..6dafa69adb 100644 --- a/tests/topotests/isis-tilfa-topo1/rt5/step1/show_ipv6_route.ref +++ b/tests/topotests/isis-tilfa-topo1/rt5/step1/show_ipv6_route.ref @@ -12,7 +12,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt3-1", + "interfaceName":"eth-rt3-2", "active":true, "backupIndex":[ 0 @@ -24,7 +24,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt3-2", + "interfaceName":"eth-rt3-1", "active":true, "backupIndex":[ 0 @@ -38,7 +38,10 @@ { "afi":"ipv6", "interfaceName":"eth-rt4", - "active":true + "active":true, + "labels":[ + 16011 + ] } ] } @@ -65,7 +68,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt3-1", + "interfaceName":"eth-rt3-2", "active":true, "labels":[ 16021 @@ -74,7 +77,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt3-2", + "interfaceName":"eth-rt3-1", "active":true, "labels":[ 16021 @@ -96,7 +99,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt3-1", + "interfaceName":"eth-rt3-2", "active":true, "backupIndex":[ 0 @@ -108,7 +111,7 @@ { "fib":true, "afi":"ipv6", - "interfaceName":"eth-rt3-2", + "interfaceName":"eth-rt3-1", "active":true, "backupIndex":[ 0 @@ -158,7 +161,10 @@ { "afi":"ipv6", "interfaceName":"eth-rt6", - "active":true + "active":true, + "labels":[ + 16041 + ] } ] } @@ -190,7 +196,10 @@ { "afi":"ipv6", "interfaceName":"eth-rt4", - "active":true + "active":true, + "labels":[ + 16061 + ] } ] } 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 index 2b70392adc..0c5861b5e8 100644 --- a/tests/topotests/isis-tilfa-topo1/rt5/step1/show_mpls_table.ref +++ b/tests/topotests/isis-tilfa-topo1/rt5/step1/show_mpls_table.ref @@ -25,7 +25,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16010, "nexthop":"10.0.6.4" } ] @@ -56,7 +56,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16011, "interface":"eth-rt4" } ] @@ -188,7 +188,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16040, "nexthop":"10.0.8.6" } ] @@ -210,7 +210,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16041, "interface":"eth-rt6" } ] @@ -232,7 +232,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16060, "nexthop":"10.0.6.4" } ] @@ -254,7 +254,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16061, "interface":"eth-rt4" } ] 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 index 6402b51893..7545a31b9b 100644 --- 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 @@ -1,6 +1,18 @@ ---- 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 @@ +--- a/rt5/step3/show_ip_route.ref ++++ b/rt5/step4/show_ip_route.ref +@@ -41,10 +41,7 @@ + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16010 +- ] ++ "active":true + } + ] + } +@@ -84,10 +81,7 @@ "ip":"10.0.6.4", "afi":"ipv4", "interfaceName":"eth-rt4", @@ -12,7 +24,7 @@ } ] } -@@ -105,9 +102,6 @@ +@@ -108,9 +102,6 @@ "afi":"ipv4", "interfaceName":"eth-rt3-1", "active":true, @@ -22,7 +34,7 @@ "labels":[ 3 ] -@@ -118,25 +112,10 @@ +@@ -121,25 +112,10 @@ "afi":"ipv4", "interfaceName":"eth-rt3-2", "active":true, @@ -48,7 +60,7 @@ ] } ], -@@ -158,9 +137,6 @@ +@@ -161,9 +137,6 @@ "active":true, "backupIndex":[ 0 @@ -58,7 +70,31 @@ ] } ], -@@ -349,30 +325,13 @@ +@@ -172,10 +145,7 @@ + "ip":"10.0.8.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", +- "active":true, +- "labels":[ +- 16040 +- ] ++ "active":true + } + ] + } +@@ -209,10 +179,7 @@ + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16060 +- ] ++ "active":true + } + ] + } +@@ -358,30 +325,13 @@ { "ip":"10.0.4.3", "afi":"ipv4", @@ -91,7 +127,7 @@ } ] } -@@ -388,29 +347,12 @@ +@@ -397,29 +347,12 @@ "ip":"10.0.4.3", "afi":"ipv4", "interfaceName":"eth-rt3-1", 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 index 7a0135bf04..1de62bb58e 100644 --- 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 @@ -1,6 +1,18 @@ ---- 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 @@ +--- a/rt5/step3/show_ipv6_route.ref ++++ b/rt5/step4/show_ipv6_route.ref +@@ -38,10 +38,7 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16011 +- ] ++ "active":true + } + ] + } +@@ -60,10 +57,7 @@ "fib":true, "afi":"ipv6", "interfaceName":"eth-rt4", @@ -12,9 +24,9 @@ }, { "fib":true, -@@ -98,9 +95,6 @@ +@@ -101,9 +95,6 @@ "afi":"ipv6", - "interfaceName":"eth-rt3-1", + "interfaceName":"eth-rt3-2", "active":true, - "backupIndex":[ - 0 @@ -22,9 +34,9 @@ "labels":[ 3 ] -@@ -110,24 +104,10 @@ +@@ -113,24 +104,10 @@ "afi":"ipv6", - "interfaceName":"eth-rt3-2", + "interfaceName":"eth-rt3-1", "active":true, - "backupIndex":[ - 0 @@ -47,7 +59,7 @@ ] } ], -@@ -148,9 +128,6 @@ +@@ -151,9 +128,6 @@ "active":true, "backupIndex":[ 0 @@ -57,3 +69,27 @@ ] } ], +@@ -161,10 +135,7 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt6", +- "active":true, +- "labels":[ +- 16041 +- ] ++ "active":true + } + ] + } +@@ -196,10 +167,7 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16061 +- ] ++ "active":true + } + ] + } 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 index 299dac7640..b3d5252430 100644 --- 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 @@ -1,5 +1,23 @@ ---- 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 +--- a/rt5/step3/show_mpls_table.ref ++++ b/rt5/step4/show_mpls_table.ref +@@ -25,7 +25,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16010, ++ "outLabel":3, + "nexthop":"10.0.6.4" + } + ] +@@ -56,7 +56,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16011, ++ "outLabel":3, + "interface":"eth-rt4" + } + ] @@ -76,12 +76,6 @@ "outLabel":16020, "installed":true, @@ -100,7 +118,7 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16040, - "nexthop":"10.0.8.6" - } - ] @@ -122,9 +140,27 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16041, - "interface":"eth-rt6" + "interface":"eth-rt3-1" } ] }, +@@ -232,7 +150,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16060, ++ "outLabel":3, + "nexthop":"10.0.6.4" + } + ] +@@ -254,7 +172,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16061, ++ "outLabel":3, + "interface":"eth-rt4" + } + ] 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 index 31f70b17a3..be5d83f463 100644 --- 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 @@ -1,6 +1,18 @@ ---- 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 @@ +--- a/rt5/step4/show_ip_route.ref ++++ b/rt5/step5/show_ip_route.ref +@@ -41,7 +41,10 @@ + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", +- "active":true ++ "active":true, ++ "labels":[ ++ 16010 ++ ] + } + ] + } +@@ -81,7 +84,10 @@ "ip":"10.0.6.4", "afi":"ipv4", "interfaceName":"eth-rt4", @@ -12,7 +24,7 @@ } ] } -@@ -102,6 +105,9 @@ +@@ -102,6 +108,9 @@ "afi":"ipv4", "interfaceName":"eth-rt3-1", "active":true, @@ -22,7 +34,7 @@ "labels":[ 3 ] -@@ -112,10 +118,25 @@ +@@ -112,10 +121,25 @@ "afi":"ipv4", "interfaceName":"eth-rt3-2", "active":true, @@ -48,7 +60,7 @@ ] } ], -@@ -137,6 +158,9 @@ +@@ -137,6 +161,9 @@ "active":true, "backupIndex":[ 0 @@ -58,7 +70,31 @@ ] } ], -@@ -325,13 +349,30 @@ +@@ -145,7 +172,10 @@ + "ip":"10.0.8.6", + "afi":"ipv4", + "interfaceName":"eth-rt6", +- "active":true ++ "active":true, ++ "labels":[ ++ 16040 ++ ] + } + ] + } +@@ -179,7 +209,10 @@ + "ip":"10.0.6.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", +- "active":true ++ "active":true, ++ "labels":[ ++ 16060 ++ ] + } + ] + } +@@ -325,13 +358,30 @@ { "ip":"10.0.4.3", "afi":"ipv4", @@ -91,7 +127,7 @@ } ] } -@@ -347,12 +388,29 @@ +@@ -347,12 +397,29 @@ "ip":"10.0.4.3", "afi":"ipv4", "interfaceName":"eth-rt3-1", 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 index 59d9755e18..a856019622 100644 --- 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 @@ -1,6 +1,18 @@ ---- 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 @@ +--- a/rt5/step4/show_ipv6_route.ref ++++ b/rt5/step5/show_ipv6_route.ref +@@ -38,7 +38,10 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", +- "active":true ++ "active":true, ++ "labels":[ ++ 16011 ++ ] + } + ] + } +@@ -57,7 +60,10 @@ "fib":true, "afi":"ipv6", "interfaceName":"eth-rt4", @@ -12,9 +24,9 @@ }, { "fib":true, -@@ -95,6 +98,9 @@ +@@ -95,6 +101,9 @@ "afi":"ipv6", - "interfaceName":"eth-rt3-1", + "interfaceName":"eth-rt3-2", "active":true, + "backupIndex":[ + 0 @@ -22,9 +34,9 @@ "labels":[ 3 ] -@@ -104,10 +110,24 @@ +@@ -104,10 +113,24 @@ "afi":"ipv6", - "interfaceName":"eth-rt3-2", + "interfaceName":"eth-rt3-1", "active":true, + "backupIndex":[ + 0 @@ -47,7 +59,7 @@ ] } ], -@@ -128,6 +148,9 @@ +@@ -128,6 +151,9 @@ "active":true, "backupIndex":[ 0 @@ -57,3 +69,27 @@ ] } ], +@@ -135,7 +161,10 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt6", +- "active":true ++ "active":true, ++ "labels":[ ++ 16041 ++ ] + } + ] + } +@@ -167,7 +196,10 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", +- "active":true ++ "active":true, ++ "labels":[ ++ 16061 ++ ] + } + ] + } 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 index 669c07e344..74caa8620e 100644 --- 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 @@ -1,5 +1,23 @@ ---- 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 +--- a/rt5/step4/show_mpls_table.ref ++++ b/rt5/step5/show_mpls_table.ref +@@ -25,7 +25,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":3, ++ "outLabel":16010, + "nexthop":"10.0.6.4" + } + ] +@@ -56,7 +56,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":3, ++ "outLabel":16011, + "interface":"eth-rt4" + } + ] @@ -69,6 +69,12 @@ "type":"SR (IS-IS)", "outLabel":16020, @@ -101,7 +119,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16040, + "nexthop":"10.0.8.6" + } + ] @@ -123,8 +141,26 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16041, + "interface":"eth-rt6" } ] }, +@@ -150,7 +232,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":3, ++ "outLabel":16060, + "nexthop":"10.0.6.4" + } + ] +@@ -172,7 +254,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":3, ++ "outLabel":16061, + "interface":"eth-rt4" + } + ] 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 index a4f82cbf10..2883c046fd 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt5/step5/show_mpls_table.ref ++++ b/rt5/step6/show_mpls_table.ref @@ -1,6 +1,6 @@ { - "16010":{ 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 index 5bcef4c2f6..b9b43c4139 100644 --- a/tests/topotests/isis-tilfa-topo1/rt6/step1/show_ip_route.ref +++ b/tests/topotests/isis-tilfa-topo1/rt6/step1/show_ip_route.ref @@ -61,7 +61,10 @@ "ip":"10.0.8.5", "afi":"ipv4", "interfaceName":"eth-rt5", - "active":true + "active":true, + "labels":[ + 16020 + ] } ] } @@ -95,7 +98,10 @@ "ip":"10.0.7.4", "afi":"ipv4", "interfaceName":"eth-rt4", - "active":true + "active":true, + "labels":[ + 16030 + ] } ] } @@ -129,7 +135,10 @@ "ip":"10.0.8.5", "afi":"ipv4", "interfaceName":"eth-rt5", - "active":true + "active":true, + "labels":[ + 16040 + ] } ] } @@ -163,7 +172,10 @@ "ip":"10.0.7.4", "afi":"ipv4", "interfaceName":"eth-rt4", - "active":true + "active":true, + "labels":[ + 16050 + ] } ] } 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 index 8294b07136..1b1942939d 100644 --- a/tests/topotests/isis-tilfa-topo1/rt6/step1/show_ipv6_route.ref +++ b/tests/topotests/isis-tilfa-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 @@ -57,7 +57,10 @@ { "afi":"ipv6", "interfaceName":"eth-rt5", - "active":true + "active":true, + "labels":[ + 16021 + ] } ] } @@ -89,7 +92,10 @@ { "afi":"ipv6", "interfaceName":"eth-rt4", - "active":true + "active":true, + "labels":[ + 16031 + ] } ] } @@ -121,7 +127,10 @@ { "afi":"ipv6", "interfaceName":"eth-rt5", - "active":true + "active":true, + "labels":[ + 16041 + ] } ] } @@ -153,7 +162,10 @@ { "afi":"ipv6", "interfaceName":"eth-rt4", - "active":true + "active":true, + "labels":[ + 16051 + ] } ] } 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 index 33dbf59204..5b52a16f48 100644 --- a/tests/topotests/isis-tilfa-topo1/rt6/step1/show_mpls_table.ref +++ b/tests/topotests/isis-tilfa-topo1/rt6/step1/show_mpls_table.ref @@ -7,13 +7,13 @@ "type":"SR (IS-IS)", "outLabel":16010, "installed":true, - "nexthop":"10.0.7.4" + "nexthop":"10.0.8.5" }, { "type":"SR (IS-IS)", "outLabel":16010, "installed":true, - "nexthop":"10.0.8.5" + "nexthop":"10.0.7.4" } ] }, @@ -25,13 +25,13 @@ "type":"SR (IS-IS)", "outLabel":16011, "installed":true, - "interface":"eth-rt4" + "interface":"eth-rt5" }, { "type":"SR (IS-IS)", "outLabel":16011, "installed":true, - "interface":"eth-rt5" + "interface":"eth-rt4" } ] }, @@ -52,7 +52,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16020, "nexthop":"10.0.8.5" } ] @@ -74,7 +74,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16021, "interface":"eth-rt5" } ] @@ -96,7 +96,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16030, "nexthop":"10.0.7.4" } ] @@ -118,7 +118,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16031, "interface":"eth-rt4" } ] @@ -140,7 +140,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16040, "nexthop":"10.0.8.5" } ] @@ -162,7 +162,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16041, "interface":"eth-rt5" } ] @@ -184,7 +184,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16050, "nexthop":"10.0.7.4" } ] @@ -206,7 +206,7 @@ "backupNexthops":[ { "type":"SR (IS-IS)", - "outLabel":3, + "outLabel":16051, "interface":"eth-rt4" } ] 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 index 04adaefe78..7c2f00419a 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt6/step3/show_ip_route.ref ++++ b/rt6/step4/show_ip_route.ref @@ -14,10 +14,7 @@ "ip":"10.0.7.4", "afi":"ipv4", @@ -22,7 +22,19 @@ ] } ], -@@ -118,9 +112,6 @@ +@@ -98,10 +92,7 @@ + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16030 +- ] ++ "active":true + } + ] + } +@@ -124,9 +115,6 @@ "active":true, "backupIndex":[ 0 @@ -32,3 +44,27 @@ ] } ], +@@ -135,10 +123,7 @@ + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", +- "active":true, +- "labels":[ +- 16040 +- ] ++ "active":true + } + ] + } +@@ -172,10 +157,7 @@ + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16050 +- ] ++ "active":true + } + ] + } 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 index 20aa1ec83b..70f872e9de 100644 --- 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 @@ -1,6 +1,6 @@ ---- 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 @@ +--- a/rt6/step3/show_ipv6_route.ref ++++ b/rt6/step4/show_ipv6_route.ref +@@ -13,10 +13,7 @@ "fib":true, "afi":"ipv6", "interfaceName":"eth-rt4", @@ -9,9 +9,9 @@ - 16011 - ] + "active":true - } - ] - } + }, + { + "fib":true, @@ -47,9 +44,6 @@ "active":true, "backupIndex":[ @@ -22,7 +22,19 @@ ] } ], -@@ -111,9 +105,6 @@ +@@ -92,10 +86,7 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16031 +- ] ++ "active":true + } + ] + } +@@ -117,9 +108,6 @@ "active":true, "backupIndex":[ 0 @@ -32,3 +44,27 @@ ] } ], +@@ -127,10 +115,7 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt5", +- "active":true, +- "labels":[ +- 16041 +- ] ++ "active":true + } + ] + } +@@ -162,10 +147,7 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16051 +- ] ++ "active":true + } + ] + } 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 index 3f24547f6d..c191763a73 100644 --- 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 @@ -1,35 +1,49 @@ ---- 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)", +--- a/rt6/step3/show_mpls_table.ref ++++ b/rt6/step4/show_mpls_table.ref +@@ -8,12 +8,6 @@ "outLabel":16010, "installed":true, -- "nexthop":"10.0.7.4" + "nexthop":"10.0.8.5" - }, - { - "type":"SR (IS-IS)", - "outLabel":16010, - "installed":true, - "nexthop":"10.0.8.5" +- "nexthop":"10.0.7.4" } ] -@@ -25,12 +19,6 @@ - "type":"SR (IS-IS)", + }, +@@ -26,12 +20,6 @@ "outLabel":16011, "installed":true, -- "interface":"eth-rt4" + "interface":"eth-rt5" - }, - { - "type":"SR (IS-IS)", - "outLabel":16011, - "installed":true, - "interface":"eth-rt5" +- "interface":"eth-rt4" } ] -@@ -123,50 +111,6 @@ + }, +@@ -96,7 +84,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16030, ++ "outLabel":3, + "nexthop":"10.0.7.4" } ] - }, +@@ -118,52 +106,8 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16031, +- "interface":"eth-rt4" +- } +- ] +- }, - "16040":{ - "inLabel":16040, - "installed":true, @@ -47,7 +61,7 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16040, - "nexthop":"10.0.8.5" - } - ] @@ -58,7 +72,7 @@ - "nexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, + "outLabel":3, - "installed":true, - "interface":"eth-rt4", - "backupIndex":[ @@ -69,11 +83,27 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16041, - "interface":"eth-rt5" -- } -- ] -- }, - "16050":{ - "inLabel":16050, - "installed":true, ++ "interface":"eth-rt4" + } + ] + }, +@@ -184,7 +128,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16050, ++ "outLabel":3, + "nexthop":"10.0.7.4" + } + ] +@@ -206,7 +150,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16051, ++ "outLabel":3, + "interface":"eth-rt4" + } + ] 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 index 9f73a2904e..9f017d2492 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt6/step4/show_ip_route.ref ++++ b/rt6/step5/show_ip_route.ref @@ -14,7 +14,10 @@ "ip":"10.0.7.4", "afi":"ipv4", @@ -22,7 +22,19 @@ ] } ], -@@ -112,6 +118,9 @@ +@@ -92,7 +98,10 @@ + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", +- "active":true ++ "active":true, ++ "labels":[ ++ 16030 ++ ] + } + ] + } +@@ -115,6 +124,9 @@ "active":true, "backupIndex":[ 0 @@ -32,3 +44,27 @@ ] } ], +@@ -123,7 +135,10 @@ + "ip":"10.0.8.5", + "afi":"ipv4", + "interfaceName":"eth-rt5", +- "active":true ++ "active":true, ++ "labels":[ ++ 16040 ++ ] + } + ] + } +@@ -157,7 +172,10 @@ + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", +- "active":true ++ "active":true, ++ "labels":[ ++ 16050 ++ ] + } + ] + } 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 index c9358d45b2..1209504e94 100644 --- 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 @@ -1,6 +1,6 @@ ---- 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 @@ +--- a/rt6/step4/show_ipv6_route.ref ++++ b/rt6/step5/show_ipv6_route.ref +@@ -13,7 +13,10 @@ "fib":true, "afi":"ipv6", "interfaceName":"eth-rt4", @@ -9,9 +9,9 @@ + "labels":[ + 16011 + ] - } - ] - } + }, + { + "fib":true, @@ -44,6 +47,9 @@ "active":true, "backupIndex":[ @@ -22,7 +22,19 @@ ] } ], -@@ -105,6 +111,9 @@ +@@ -86,7 +92,10 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", +- "active":true ++ "active":true, ++ "labels":[ ++ 16031 ++ ] + } + ] + } +@@ -108,6 +117,9 @@ "active":true, "backupIndex":[ 0 @@ -32,3 +44,27 @@ ] } ], +@@ -115,7 +127,10 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt5", +- "active":true ++ "active":true, ++ "labels":[ ++ 16041 ++ ] + } + ] + } +@@ -147,7 +162,10 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", +- "active":true ++ "active":true, ++ "labels":[ ++ 16051 ++ ] + } + ] + } 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 index c9d67955ef..abf7c2a32d 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt6/step4/show_mpls_table.ref ++++ b/rt6/step5/show_mpls_table.ref @@ -7,6 +7,12 @@ "type":"SR (IS-IS)", "outLabel":16010, @@ -26,7 +26,22 @@ "interface":"eth-rt5" } ] -@@ -111,6 +123,50 @@ +@@ -84,7 +96,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":3, ++ "outLabel":16030, + "nexthop":"10.0.7.4" + } + ] +@@ -106,11 +118,55 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":3, ++ "outLabel":16031, + "interface":"eth-rt4" } ] }, @@ -47,7 +62,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16040, + "nexthop":"10.0.8.5" + } + ] @@ -69,7 +84,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16041, + "interface":"eth-rt5" + } + ] @@ -77,3 +92,21 @@ "16050":{ "inLabel":16050, "installed":true, +@@ -128,7 +184,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":3, ++ "outLabel":16050, + "nexthop":"10.0.7.4" + } + ] +@@ -150,7 +206,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":3, ++ "outLabel":16051, + "interface":"eth-rt4" + } + ] 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 index 527ec74958..f318f95e21 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt6/step5/show_ip_route.ref ++++ b/rt6/step6/show_ip_route.ref @@ -26,7 +26,7 @@ "interfaceName":"eth-rt5", "active":true, @@ -9,7 +9,16 @@ ] } ] -@@ -86,7 +86,7 @@ +@@ -63,7 +63,7 @@ + "interfaceName":"eth-rt5", + "active":true, + "labels":[ +- 16020 ++ 30020 + ] + } + ] +@@ -89,7 +89,7 @@ 0 ], "labels":[ @@ -18,3 +27,12 @@ ] } ], +@@ -137,7 +137,7 @@ + "interfaceName":"eth-rt5", + "active":true, + "labels":[ +- 16040 ++ 30040 + ] + } + ] 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 index 7b8f8022f2..9208491fc8 100644 --- 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 @@ -1,15 +1,24 @@ ---- 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 @@ +--- a/rt6/step5/show_ipv6_route.ref ++++ b/rt6/step6/show_ipv6_route.ref +@@ -24,7 +24,7 @@ "interfaceName":"eth-rt5", "active":true, "labels":[ - 16011 + 30011 ] - }, - { -@@ -81,7 +81,7 @@ + } + ] +@@ -59,7 +59,7 @@ + "interfaceName":"eth-rt5", + "active":true, + "labels":[ +- 16021 ++ 30021 + ] + } + ] +@@ -84,7 +84,7 @@ 0 ], "labels":[ @@ -18,3 +27,12 @@ ] } ], +@@ -129,7 +129,7 @@ + "interfaceName":"eth-rt5", + "active":true, + "labels":[ +- 16041 ++ 30041 + ] + } + ] 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 index edd5afeeb8..aee8969ded 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt6/step5/show_mpls_table.ref ++++ b/rt6/step6/show_mpls_table.ref @@ -11,7 +11,7 @@ }, { @@ -18,6 +18,24 @@ "installed":true, "interface":"eth-rt5" } +@@ -52,7 +52,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16020, ++ "outLabel":30020, + "nexthop":"10.0.8.5" + } + ] +@@ -74,7 +74,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16021, ++ "outLabel":30021, + "interface":"eth-rt5" + } + ] @@ -85,7 +85,7 @@ "nexthops":[ { @@ -36,3 +54,21 @@ "installed":true, "interface":"eth-rt5", "backupIndex":[ +@@ -140,7 +140,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16040, ++ "outLabel":30040, + "nexthop":"10.0.8.5" + } + ] +@@ -162,7 +162,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16041, ++ "outLabel":30041, + "interface":"eth-rt5" + } + ] 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 index 7553dd22e5..0e6c3ff5cd 100644 --- 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 @@ -1,6 +1,6 @@ ---- 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 @@ +--- a/rt6/step6/show_ip_route.ref ++++ b/rt6/step7/show_ip_route.ref +@@ -161,9 +161,6 @@ "active":true, "backupIndex":[ 0 @@ -10,3 +10,15 @@ ] } ], +@@ -172,10 +169,7 @@ + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16050 +- ] ++ "active":true + } + ] + } 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 index b56890de0f..2fe46c8265 100644 --- 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 @@ -1,6 +1,6 @@ ---- 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 @@ +--- a/rt6/step6/show_ipv6_route.ref ++++ b/rt6/step7/show_ipv6_route.ref +@@ -152,9 +152,6 @@ "active":true, "backupIndex":[ 0 @@ -10,3 +10,15 @@ ] } ], +@@ -162,10 +159,7 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", +- "active":true, +- "labels":[ +- 16051 +- ] ++ "active":true + } + ] + } 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 index ff043fb0bf..179a4f460b 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt6/step6/show_mpls_table.ref ++++ b/rt6/step7/show_mpls_table.ref @@ -166,49 +166,5 @@ "interface":"eth-rt5" } @@ -22,7 +22,7 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16050, - "nexthop":"10.0.7.4" - } - ] @@ -44,7 +44,7 @@ - "backupNexthops":[ - { - "type":"SR (IS-IS)", -- "outLabel":3, +- "outLabel":16051, - "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 index d0b25bffa3..9d5c440a22 100644 --- 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 @@ -1,6 +1,6 @@ ---- 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 @@ +--- a/rt6/step7/show_ip_route.ref ++++ b/rt6/step8/show_ip_route.ref +@@ -161,6 +161,9 @@ "active":true, "backupIndex":[ 0 @@ -10,3 +10,15 @@ ] } ], +@@ -169,7 +172,10 @@ + "ip":"10.0.7.4", + "afi":"ipv4", + "interfaceName":"eth-rt4", +- "active":true ++ "active":true, ++ "labels":[ ++ 16050 ++ ] + } + ] + } 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 index 203175510c..21cab20a47 100644 --- 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 @@ -1,6 +1,6 @@ ---- 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 @@ +--- a/rt6/step7/show_ipv6_route.ref ++++ b/rt6/step8/show_ipv6_route.ref +@@ -152,6 +152,9 @@ "active":true, "backupIndex":[ 0 @@ -10,3 +10,15 @@ ] } ], +@@ -159,7 +162,10 @@ + { + "afi":"ipv6", + "interfaceName":"eth-rt4", +- "active":true ++ "active":true, ++ "labels":[ ++ 16051 ++ ] + } + ] + } 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 index 535f30bf35..760c5542cb 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt6/step7/show_mpls_table.ref ++++ b/rt6/step8/show_mpls_table.ref @@ -166,5 +166,49 @@ "interface":"eth-rt5" } @@ -22,7 +22,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16050, + "nexthop":"10.0.7.4" + } + ] @@ -44,7 +44,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", -+ "outLabel":3, ++ "outLabel":16051, + "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 index e69de29bb2..ee296470c0 100644 --- 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 @@ -0,0 +1,11 @@ +--- a/rt6/step8/show_ip_route.ref ++++ b/rt6/step9/show_ip_route.ref +@@ -174,7 +174,7 @@ + "interfaceName":"eth-rt4", + "active":true, + "labels":[ +- 16050 ++ 16500 + ] + } + ] 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 index e69de29bb2..bebca4dcf1 100644 --- 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 @@ -0,0 +1,11 @@ +--- a/rt6/step8/show_ipv6_route.ref ++++ b/rt6/step9/show_ipv6_route.ref +@@ -164,7 +164,7 @@ + "interfaceName":"eth-rt4", + "active":true, + "labels":[ +- 16051 ++ 16501 + ] + } + ] 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 index b6e5396554..57347d15be 100644 --- 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 @@ -1,5 +1,5 @@ ---- 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 +--- a/rt6/step8/show_mpls_table.ref ++++ b/rt6/step9/show_mpls_table.ref @@ -167,8 +167,8 @@ } ] @@ -11,7 +11,13 @@ "installed":true, "nexthops":[ { -@@ -189,8 +189,8 @@ +@@ -184,13 +184,13 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16050, ++ "outLabel":16500, + "nexthop":"10.0.7.4" } ] }, @@ -22,3 +28,12 @@ "installed":true, "nexthops":[ { +@@ -206,7 +206,7 @@ + "backupNexthops":[ + { + "type":"SR (IS-IS)", +- "outLabel":16051, ++ "outLabel":16501, + "interface":"eth-rt4" + } + ] diff --git a/tests/topotests/isis-tilfa-topo1/test_isis_tilfa_topo1.py b/tests/topotests/isis-tilfa-topo1/test_isis_tilfa_topo1.py index 6bc097b0e7..514ea53552 100755 --- a/tests/topotests/isis-tilfa-topo1/test_isis_tilfa_topo1.py +++ b/tests/topotests/isis-tilfa-topo1/test_isis_tilfa_topo1.py @@ -179,7 +179,7 @@ def setup_module(mod): router_list = tgen.routers() # For all registered routers, load the zebra configuration file - for rname, router in router_list.iteritems(): + for rname, router in router_list.items(): router.load_config( TopoRouter.RD_ZEBRA, os.path.join(CWD, '{}/zebra.conf'.format(rname)) diff --git a/tests/topotests/ldp-oc-acl-topo1/r1/ospfd.conf b/tests/topotests/ldp-oc-acl-topo1/r1/ospfd.conf index 87d5703d9e..877e14ff36 100644 --- a/tests/topotests/ldp-oc-acl-topo1/r1/ospfd.conf +++ b/tests/topotests/ldp-oc-acl-topo1/r1/ospfd.conf @@ -8,4 +8,5 @@ router ospf int r1-eth0 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 1 ! diff --git a/tests/topotests/ldp-oc-acl-topo1/r1/show_ip_ospf_neighbor.json b/tests/topotests/ldp-oc-acl-topo1/r1/show_ip_ospf_neighbor.json index 2c493173f5..aa3f74fc5f 100644 --- a/tests/topotests/ldp-oc-acl-topo1/r1/show_ip_ospf_neighbor.json +++ b/tests/topotests/ldp-oc-acl-topo1/r1/show_ip_ospf_neighbor.json @@ -2,7 +2,7 @@ "neighbors":{ "2.2.2.2":[ { - "priority":1, + "priority":2, "state":"Full\/DR", "address":"10.0.1.2", "ifaceName":"r1-eth0:10.0.1.1" diff --git a/tests/topotests/ldp-oc-acl-topo1/r2/ospfd.conf b/tests/topotests/ldp-oc-acl-topo1/r2/ospfd.conf index 51317202bb..8cba1529e8 100644 --- a/tests/topotests/ldp-oc-acl-topo1/r2/ospfd.conf +++ b/tests/topotests/ldp-oc-acl-topo1/r2/ospfd.conf @@ -8,8 +8,10 @@ router ospf int r2-eth0 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 2 ! int r2-eth1 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 1 ! diff --git a/tests/topotests/ldp-oc-acl-topo1/r2/show_ip_ospf_neighbor.json b/tests/topotests/ldp-oc-acl-topo1/r2/show_ip_ospf_neighbor.json index 55f12359e5..aa68198957 100644 --- a/tests/topotests/ldp-oc-acl-topo1/r2/show_ip_ospf_neighbor.json +++ b/tests/topotests/ldp-oc-acl-topo1/r2/show_ip_ospf_neighbor.json @@ -5,15 +5,12 @@ "priority":1, "state":"Full\/Backup", "address":"10.0.1.1", - "ifaceName":"r2-eth0:10.0.1.2", - "retransmitCounter":0, - "requestCounter":0, - "dbSummaryCounter":0 + "ifaceName":"r2-eth0:10.0.1.2" } ], "3.3.3.3":[ { - "priority":1, + "priority":2, "state":"Full\/Backup", "address":"10.0.2.3", "ifaceName":"r2-eth1:10.0.2.2" @@ -21,7 +18,7 @@ ], "4.4.4.4":[ { - "priority":1, + "priority":3, "state":"Full\/DR", "address":"10.0.2.4", "ifaceName":"r2-eth1:10.0.2.2" diff --git a/tests/topotests/ldp-oc-acl-topo1/r3/ospfd.conf b/tests/topotests/ldp-oc-acl-topo1/r3/ospfd.conf index 4566976b7b..0d3a74c4ac 100644 --- a/tests/topotests/ldp-oc-acl-topo1/r3/ospfd.conf +++ b/tests/topotests/ldp-oc-acl-topo1/r3/ospfd.conf @@ -9,4 +9,5 @@ router ospf int r3-eth0 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 2 ! diff --git a/tests/topotests/ldp-oc-acl-topo1/r3/show_ip_ospf_neighbor.json b/tests/topotests/ldp-oc-acl-topo1/r3/show_ip_ospf_neighbor.json index 24502ed813..905774fc46 100644 --- a/tests/topotests/ldp-oc-acl-topo1/r3/show_ip_ospf_neighbor.json +++ b/tests/topotests/ldp-oc-acl-topo1/r3/show_ip_ospf_neighbor.json @@ -10,7 +10,7 @@ ], "4.4.4.4":[ { - "priority":1, + "priority":3, "state":"Full\/DR", "address":"10.0.2.4", "ifaceName":"r3-eth0:10.0.2.3" diff --git a/tests/topotests/ldp-oc-acl-topo1/r4/ospfd.conf b/tests/topotests/ldp-oc-acl-topo1/r4/ospfd.conf index 5aae885a12..7bbd228d02 100644 --- a/tests/topotests/ldp-oc-acl-topo1/r4/ospfd.conf +++ b/tests/topotests/ldp-oc-acl-topo1/r4/ospfd.conf @@ -8,4 +8,5 @@ router ospf int r4-eth0 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 3 ! diff --git a/tests/topotests/ldp-oc-acl-topo1/r4/show_ip_ospf_neighbor.json b/tests/topotests/ldp-oc-acl-topo1/r4/show_ip_ospf_neighbor.json index 794410522d..67593952ca 100644 --- a/tests/topotests/ldp-oc-acl-topo1/r4/show_ip_ospf_neighbor.json +++ b/tests/topotests/ldp-oc-acl-topo1/r4/show_ip_ospf_neighbor.json @@ -11,7 +11,7 @@ ], "3.3.3.3":[ { - "priority":1, + "priority":2, "state":"Full\/Backup", "address":"10.0.2.3", "ifaceName":"r4-eth0:10.0.2.4" diff --git a/tests/topotests/ldp-oc-topo1/r1/ospfd.conf b/tests/topotests/ldp-oc-topo1/r1/ospfd.conf index 87d5703d9e..877e14ff36 100644 --- a/tests/topotests/ldp-oc-topo1/r1/ospfd.conf +++ b/tests/topotests/ldp-oc-topo1/r1/ospfd.conf @@ -8,4 +8,5 @@ router ospf int r1-eth0 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 1 ! diff --git a/tests/topotests/ldp-oc-topo1/r1/show_ip_ospf_neighbor.json b/tests/topotests/ldp-oc-topo1/r1/show_ip_ospf_neighbor.json index 2c493173f5..aa3f74fc5f 100644 --- a/tests/topotests/ldp-oc-topo1/r1/show_ip_ospf_neighbor.json +++ b/tests/topotests/ldp-oc-topo1/r1/show_ip_ospf_neighbor.json @@ -2,7 +2,7 @@ "neighbors":{ "2.2.2.2":[ { - "priority":1, + "priority":2, "state":"Full\/DR", "address":"10.0.1.2", "ifaceName":"r1-eth0:10.0.1.1" diff --git a/tests/topotests/ldp-oc-topo1/r2/ospfd.conf b/tests/topotests/ldp-oc-topo1/r2/ospfd.conf index 51317202bb..8cba1529e8 100644 --- a/tests/topotests/ldp-oc-topo1/r2/ospfd.conf +++ b/tests/topotests/ldp-oc-topo1/r2/ospfd.conf @@ -8,8 +8,10 @@ router ospf int r2-eth0 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 2 ! int r2-eth1 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 1 ! diff --git a/tests/topotests/ldp-oc-topo1/r2/show_ip_ospf_neighbor.json b/tests/topotests/ldp-oc-topo1/r2/show_ip_ospf_neighbor.json index 55f12359e5..aa68198957 100644 --- a/tests/topotests/ldp-oc-topo1/r2/show_ip_ospf_neighbor.json +++ b/tests/topotests/ldp-oc-topo1/r2/show_ip_ospf_neighbor.json @@ -5,15 +5,12 @@ "priority":1, "state":"Full\/Backup", "address":"10.0.1.1", - "ifaceName":"r2-eth0:10.0.1.2", - "retransmitCounter":0, - "requestCounter":0, - "dbSummaryCounter":0 + "ifaceName":"r2-eth0:10.0.1.2" } ], "3.3.3.3":[ { - "priority":1, + "priority":2, "state":"Full\/Backup", "address":"10.0.2.3", "ifaceName":"r2-eth1:10.0.2.2" @@ -21,7 +18,7 @@ ], "4.4.4.4":[ { - "priority":1, + "priority":3, "state":"Full\/DR", "address":"10.0.2.4", "ifaceName":"r2-eth1:10.0.2.2" diff --git a/tests/topotests/ldp-oc-topo1/r3/ospfd.conf b/tests/topotests/ldp-oc-topo1/r3/ospfd.conf index 4566976b7b..0d3a74c4ac 100644 --- a/tests/topotests/ldp-oc-topo1/r3/ospfd.conf +++ b/tests/topotests/ldp-oc-topo1/r3/ospfd.conf @@ -9,4 +9,5 @@ router ospf int r3-eth0 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 2 ! diff --git a/tests/topotests/ldp-oc-topo1/r3/show_ip_ospf_neighbor.json b/tests/topotests/ldp-oc-topo1/r3/show_ip_ospf_neighbor.json index 24502ed813..905774fc46 100644 --- a/tests/topotests/ldp-oc-topo1/r3/show_ip_ospf_neighbor.json +++ b/tests/topotests/ldp-oc-topo1/r3/show_ip_ospf_neighbor.json @@ -10,7 +10,7 @@ ], "4.4.4.4":[ { - "priority":1, + "priority":3, "state":"Full\/DR", "address":"10.0.2.4", "ifaceName":"r3-eth0:10.0.2.3" diff --git a/tests/topotests/ldp-oc-topo1/r4/ospfd.conf b/tests/topotests/ldp-oc-topo1/r4/ospfd.conf index 5aae885a12..7bbd228d02 100644 --- a/tests/topotests/ldp-oc-topo1/r4/ospfd.conf +++ b/tests/topotests/ldp-oc-topo1/r4/ospfd.conf @@ -8,4 +8,5 @@ router ospf int r4-eth0 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 3 ! diff --git a/tests/topotests/ldp-oc-topo1/r4/show_ip_ospf_neighbor.json b/tests/topotests/ldp-oc-topo1/r4/show_ip_ospf_neighbor.json index 794410522d..67593952ca 100644 --- a/tests/topotests/ldp-oc-topo1/r4/show_ip_ospf_neighbor.json +++ b/tests/topotests/ldp-oc-topo1/r4/show_ip_ospf_neighbor.json @@ -11,7 +11,7 @@ ], "3.3.3.3":[ { - "priority":1, + "priority":2, "state":"Full\/Backup", "address":"10.0.2.3", "ifaceName":"r4-eth0:10.0.2.4" diff --git a/tests/topotests/ldp-vpls-topo1/r1/ospfd.conf b/tests/topotests/ldp-vpls-topo1/r1/ospfd.conf index 76ea32fb61..a66fb92ba3 100644 --- a/tests/topotests/ldp-vpls-topo1/r1/ospfd.conf +++ b/tests/topotests/ldp-vpls-topo1/r1/ospfd.conf @@ -8,8 +8,10 @@ router ospf int r1-eth1 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 1 ! int r1-eth2 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 1 ! diff --git a/tests/topotests/ldp-vpls-topo1/r1/show_ip_ospf_neighbor.json b/tests/topotests/ldp-vpls-topo1/r1/show_ip_ospf_neighbor.json index 6e6c3c8cb8..7e281abb5f 100644 --- a/tests/topotests/ldp-vpls-topo1/r1/show_ip_ospf_neighbor.json +++ b/tests/topotests/ldp-vpls-topo1/r1/show_ip_ospf_neighbor.json @@ -4,8 +4,8 @@ { "dbSummaryCounter": 0, "retransmitCounter": 0, - "priority": 1, - "state": "Full/DR", + "priority": 2, + "state": "Full\/DR", "address": "10.0.1.2", "ifaceName": "r1-eth1:10.0.1.1", "requestCounter": 0 @@ -15,8 +15,8 @@ { "dbSummaryCounter": 0, "retransmitCounter": 0, - "priority": 1, - "state": "Full/DR", + "priority": 2, + "state": "Full\/DR", "address": "10.0.2.3", "ifaceName": "r1-eth2:10.0.2.1", "requestCounter": 0 diff --git a/tests/topotests/ldp-vpls-topo1/r2/ospfd.conf b/tests/topotests/ldp-vpls-topo1/r2/ospfd.conf index 7b3ddfe371..b4692feec8 100644 --- a/tests/topotests/ldp-vpls-topo1/r2/ospfd.conf +++ b/tests/topotests/ldp-vpls-topo1/r2/ospfd.conf @@ -8,8 +8,10 @@ router ospf int r2-eth1 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 2 ! int r2-eth2 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 1 ! diff --git a/tests/topotests/ldp-vpls-topo1/r2/show_ip_ospf_neighbor.json b/tests/topotests/ldp-vpls-topo1/r2/show_ip_ospf_neighbor.json index b5b10cc535..22fd98f519 100644 --- a/tests/topotests/ldp-vpls-topo1/r2/show_ip_ospf_neighbor.json +++ b/tests/topotests/ldp-vpls-topo1/r2/show_ip_ospf_neighbor.json @@ -3,7 +3,7 @@ "1.1.1.1": [ { "priority":1, - "state":"Full/Backup", + "state":"Full\/Backup", "address":"10.0.1.1", "ifaceName":"r2-eth1:10.0.1.2", "retransmitCounter":0, @@ -13,8 +13,8 @@ ], "3.3.3.3": [ { - "priority":1, - "state":"Full/DR", + "priority":2, + "state":"Full\/DR", "address":"10.0.3.3", "ifaceName":"r2-eth2:10.0.3.2", "retransmitCounter":0, diff --git a/tests/topotests/ldp-vpls-topo1/r3/ospfd.conf b/tests/topotests/ldp-vpls-topo1/r3/ospfd.conf index b424f2e108..2413bfa9d5 100644 --- a/tests/topotests/ldp-vpls-topo1/r3/ospfd.conf +++ b/tests/topotests/ldp-vpls-topo1/r3/ospfd.conf @@ -8,8 +8,10 @@ router ospf int r3-eth1 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 2 ! int r3-eth2 ip ospf hello-interval 2 ip ospf dead-interval 10 + ip ospf priority 2 ! diff --git a/tests/topotests/ldp-vpls-topo1/r3/show_ip_ospf_neighbor.json b/tests/topotests/ldp-vpls-topo1/r3/show_ip_ospf_neighbor.json index bc7bb1e894..970eb2fc1d 100644 --- a/tests/topotests/ldp-vpls-topo1/r3/show_ip_ospf_neighbor.json +++ b/tests/topotests/ldp-vpls-topo1/r3/show_ip_ospf_neighbor.json @@ -3,7 +3,7 @@ "1.1.1.1": [ { "priority":1, - "state":"Full/Backup", + "state":"Full\/Backup", "address":"10.0.2.1", "ifaceName":"r3-eth1:10.0.2.3", "retransmitCounter":0, @@ -14,7 +14,7 @@ "2.2.2.2": [ { "priority":1, - "state":"Full/Backup", + "state":"Full\/Backup", "address":"10.0.3.2", "ifaceName":"r3-eth2:10.0.3.3", "retransmitCounter":0, diff --git a/tests/topotests/ldp-vpls-topo1/test_ldp_vpls_topo1.pdf b/tests/topotests/ldp-vpls-topo1/test_ldp_vpls_topo1.pdf Binary files differindex dd7c6f74d0..4d26732ea7 100644 --- a/tests/topotests/ldp-vpls-topo1/test_ldp_vpls_topo1.pdf +++ b/tests/topotests/ldp-vpls-topo1/test_ldp_vpls_topo1.pdf 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 a23092de83..abab9600a1 100644 --- a/tests/topotests/lib/bgprib.py +++ b/tests/topotests/lib/bgprib.py @@ -45,7 +45,7 @@ class BgpRib: def routes_include_wanted(self, pfxtbl, want, debug): # helper function to RequireVpnRoutes - for pfx in pfxtbl.iterkeys(): + for pfx in pfxtbl.keys(): if debug: self.log("trying pfx %s" % pfx) if pfx != want["p"]: @@ -107,7 +107,7 @@ class BgpRib: found = 0 if debug: self.log("want rd %s" % want["rd"]) - for rd in rds.iterkeys(): + for rd in rds.keys(): if rd != want["rd"]: continue if debug: diff --git a/tests/topotests/lib/common_config.py b/tests/topotests/lib/common_config.py index d83f946c42..6c24b6ddbb 100644 --- a/tests/topotests/lib/common_config.py +++ b/tests/topotests/lib/common_config.py @@ -1150,6 +1150,9 @@ def generate_ips(network, no_of_ips): if "/" in start_ipaddr: start_ip = start_ipaddr.split("/")[0] mask = int(start_ipaddr.split("/")[1]) + else: + logger.debug("start_ipaddr {} must have a / in it".format(start_ipaddr)) + assert(0) addr_type = validate_ip_address(start_ip) if addr_type == "ipv4": @@ -2559,6 +2562,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 @@ -2576,6 +2580,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 ----- @@ -2739,7 +2745,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) @@ -2846,7 +2868,7 @@ def verify_rib( for advertise_network_dict in advertise_network: if "vrf" in advertise_network_dict: - cmd = "{} vrf {} json".format(command, static_route["vrf"]) + cmd = "{} vrf {} json".format(command, advertise_network_dict["vrf"]) else: cmd = "{} json".format(command) @@ -2925,264 +2947,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 @@ -3633,7 +3398,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 diff --git a/tests/topotests/lib/lutil.py b/tests/topotests/lib/lutil.py index 1fb4f48b0f..9cbea67af1 100644 --- a/tests/topotests/lib/lutil.py +++ b/tests/topotests/lib/lutil.py @@ -23,7 +23,7 @@ import time import datetime import json import math -from topolog import logger +from lib.topolog import logger from mininet.net import Mininet @@ -58,14 +58,14 @@ class lUtil: def log(self, str, level=6): if self.l_level > 0: if self.fout == "": - self.fout = open(self.fout_name, "w", 0) + self.fout = open(self.fout_name, "w") 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 = open(self.fsum_name, "w") self.fsum.write( "\ ******************************************************************************\n" @@ -380,7 +380,8 @@ def luInclude(filename, CallOnFail=None): LUtil.setCallOnFail(CallOnFail) if filename.endswith(".py"): LUtil.log("luInclude: execfile " + tstFile) - execfile(tstFile) + with open(tstFile) as infile: + exec(infile.read()) else: LUtil.log("luInclude: execTestFile " + tstFile) LUtil.execTestFile(tstFile) diff --git a/tests/topotests/lib/topogen.py b/tests/topotests/lib/topogen.py index 3e92bd7565..7ae4223f72 100644 --- a/tests/topotests/lib/topogen.py +++ b/tests/topotests/lib/topogen.py @@ -336,7 +336,7 @@ class Topogen(object): for gear in self.gears.values(): errors += gear.stop() if len(errors) > 0: - assert "Errors found post shutdown - details follow:" == 0, errors + logger.error("Errors found post shutdown - details follow: {}".format(errors)) self.net.stop() @@ -714,7 +714,7 @@ class TopoRouter(TopoGear): """ self.logger.debug("stopping") self.__stop_internal(False, False) - return self.__stop_internal() + return self.__stop_internal(True, False) def startDaemons(self, daemons): """ diff --git a/tests/topotests/lib/topotest.py b/tests/topotests/lib/topotest.py index 4b18862101..7047c52b18 100644 --- a/tests/topotests/lib/topotest.py +++ b/tests/topotests/lib/topotest.py @@ -910,31 +910,63 @@ def sleep(amount, reason=None): time.sleep(amount) -def checkAddressSanitizerError(output, router, component): +def checkAddressSanitizerError(output, router, component, logdir=""): "Checks for AddressSanitizer in output. If found, then logs it and returns true, false otherwise" - addressSantizerError = re.search( - "(==[0-9]+==)ERROR: AddressSanitizer: ([^\s]*) ", output - ) - if addressSantizerError: + def processAddressSanitizerError(asanErrorRe, output, router, component): sys.stderr.write( "%s: %s triggered an exception by AddressSanitizer\n" % (router, component) ) # Sanitizer Error found in log - pidMark = addressSantizerError.group(1) + pidMark = asanErrorRe.group(1) addressSantizerLog = re.search( "%s(.*)%s" % (pidMark, pidMark), output, re.DOTALL ) if addressSantizerLog: - callingTest = os.path.basename( - sys._current_frames().values()[0].f_back.f_back.f_globals["__file__"] - ) - callingProc = sys._getframe(2).f_code.co_name + # Find Calling Test. Could be multiple steps back + testframe=sys._current_frames().values()[0] + level=0 + while level < 10: + test=os.path.splitext(os.path.basename(testframe.f_globals["__file__"]))[0] + if (test != "topotest") and (test != "topogen"): + # Found the calling test + callingTest=os.path.basename(testframe.f_globals["__file__"]) + break + level=level+1 + testframe=testframe.f_back + if (level >= 10): + # somehow couldn't find the test script. + callingTest="unknownTest" + # + # Now finding Calling Procedure + level=0 + while level < 20: + callingProc=sys._getframe(level).f_code.co_name + if ((callingProc != "processAddressSanitizerError") and + (callingProc != "checkAddressSanitizerError") and + (callingProc != "checkRouterCores") and + (callingProc != "stopRouter") and + (callingProc != "__stop_internal") and + (callingProc != "stop") and + (callingProc != "stop_topology") and + (callingProc != "checkRouterRunning") and + (callingProc != "check_router_running") and + (callingProc != "routers_have_failure")): + # Found the calling test + break + level=level+1 + if (level >= 20): + # something wrong - couldn't found the calling test function + callingProc="unknownProc" with open("/tmp/AddressSanitzer.txt", "a") as addrSanFile: sys.stderr.write( + "AddressSanitizer error in topotest `%s`, test `%s`, router `%s`\n\n" + % (callingTest, callingProc, router) + ) + sys.stderr.write( "\n".join(addressSantizerLog.group(1).splitlines()) + "\n" ) - addrSanFile.write("## Error: %s\n\n" % addressSantizerError.group(2)) + addrSanFile.write("## Error: %s\n\n" % asanErrorRe.group(2)) addrSanFile.write( "### AddressSanitizer error in topotest `%s`, test `%s`, router `%s`\n\n" % (callingTest, callingProc, router) @@ -945,7 +977,29 @@ def checkAddressSanitizerError(output, router, component): + "\n" ) addrSanFile.write("\n---------------\n") + return + + + addressSantizerError = re.search( + "(==[0-9]+==)ERROR: AddressSanitizer: ([^\s]*) ", output + ) + if addressSantizerError: + processAddressSanitizerError(addressSantizerError, output, router, component) return True + + # No Address Sanitizer Error in Output. Now check for AddressSanitizer daemon file + if logdir: + filepattern=logdir+"/"+router+"/"+component+".asan.*" + sys.stderr.write("Log check for %s on %s, pattern %s\n" % (component, router, filepattern)) + for file in glob.glob(filepattern): + with open(file, "r") as asanErrorFile: + asanError=asanErrorFile.read() + addressSantizerError = re.search( + "(==[0-9]+==)ERROR: AddressSanitizer: ([^\s]*) ", asanError + ) + if addressSantizerError: + processAddressSanitizerError(addressSantizerError, asanError, router, component) + return True return False @@ -1011,7 +1065,7 @@ class Router(Node): if self.logdir is None: cur_test = os.environ["PYTEST_CURRENT_TEST"] self.logdir = "/tmp/topotests/" + cur_test[ - 0 : cur_test.find(".py") + cur_test.find("/")+1 : cur_test.find(".py") ].replace("/", ".") # If the logdir is not created, then create it and set the @@ -1019,6 +1073,8 @@ class Router(Node): if not os.path.isdir(self.logdir): os.system("mkdir -p " + self.logdir + "/" + name) os.system("chmod -R go+rw /tmp/topotests") + # Erase logs of previous run + os.system("rm -rf " + self.logdir + "/" + name) self.daemondir = None self.hasmpls = False @@ -1185,7 +1241,7 @@ class Router(Node): if self.checkRouterVersion("<", minErrorVersion): # ignore errors in old versions errors = "" - if assertOnError and len(errors) > 0: + if assertOnError and errors is not None and len(errors) > 0: assert "Errors found - details follow:" == 0, errors return errors @@ -1324,6 +1380,7 @@ class Router(Node): # Starts actual daemons without init (ie restart) # cd to per node directory + self.cmd("install -d {}/{}".format(self.logdir, self.name)) self.cmd("cd {}/{}".format(self.logdir, self.name)) self.cmd("umask 000") @@ -1353,7 +1410,7 @@ class Router(Node): zebra_path = os.path.join(self.daemondir, "zebra") zebra_option = self.daemons_options["zebra"] self.cmd( - "{0} {1} --log stdout --log-level debug -s 90000000 -d > zebra.out 2> zebra.err".format( + "ASAN_OPTIONS=log_path=zebra.asan {0} {1} --log file:zebra.log --log-level debug -s 90000000 -d > zebra.out 2> zebra.err".format( zebra_path, zebra_option, self.logdir, self.name ) ) @@ -1368,7 +1425,7 @@ class Router(Node): staticd_path = os.path.join(self.daemondir, "staticd") staticd_option = self.daemons_options["staticd"] self.cmd( - "{0} {1} --log stdout --log-level debug -d > staticd.out 2> staticd.err".format( + "ASAN_OPTIONS=log_path=staticd.asan {0} {1} --log file:staticd.log --log-level debug -d > staticd.out 2> staticd.err".format( staticd_path, staticd_option, self.logdir, self.name ) ) @@ -1392,7 +1449,7 @@ class Router(Node): daemon_path = os.path.join(self.daemondir, daemon) self.cmd( - "{0} {1} --log stdout --log-level debug -d > {2}.out 2> {2}.err".format( + "ASAN_OPTIONS=log_path={2}.asan {0} {1} --log file:{2}.log --log-level debug -d > {2}.out 2> {2}.err".format( daemon_path, self.daemons_options.get(daemon, ""), daemon ) ) @@ -1514,7 +1571,7 @@ class Router(Node): reportMade = True # Look for AddressSanitizer Errors and append to /tmp/AddressSanitzer.txt if found if checkAddressSanitizerError( - self.getStdErr(daemon), self.name, daemon + self.getStdErr(daemon), self.name, daemon, self.logdir ): sys.stderr.write( "%s: Daemon %s killed by AddressSanitizer" % (self.name, daemon) @@ -1578,7 +1635,7 @@ class Router(Node): # Look for AddressSanitizer Errors and append to /tmp/AddressSanitzer.txt if found if checkAddressSanitizerError( - self.getStdErr(daemon), self.name, daemon + self.getStdErr(daemon), self.name, daemon, self.logdir ): return "%s: Daemon %s not running - killed by AddressSanitizer" % ( self.name, diff --git a/tests/topotests/route-scale/test_route_scale.py b/tests/topotests/route-scale/test_route_scale.py index 8aedfc198c..bbd6ef8d60 100644 --- a/tests/topotests/route-scale/test_route_scale.py +++ b/tests/topotests/route-scale/test_route_scale.py @@ -122,15 +122,20 @@ def run_one_setup(r1, s): expected_installed = s["expect_in"] expected_removed = s["expect_rem"] - count = s["count"] + retries = s["retries"] wait = s["wait"] - logger.info("Testing 1 million routes X {} ecmp".format(s["ecmp"])) + 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 {} 1000000".format( - s["nhg"] + nexthop-group {} {}".format( + s["nhg"], count ), isjson=False, ) @@ -138,21 +143,21 @@ def run_one_setup(r1, s): 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) + 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) + 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, count, wait) + 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) @@ -174,7 +179,7 @@ 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( |
