summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/.gitignore3
-rw-r--r--tests/bgpd/subdir.am82
-rw-r--r--tests/bgpd/test_mpath.c6
-rw-r--r--tests/isisd/subdir.am66
-rw-r--r--tests/isisd/test_fuzz_isis_tlv_tests.h.gzbin182891 -> 176859 bytes
-rw-r--r--tests/lib/cli/common_cli.c3
-rw-r--r--tests/lib/cli/common_cli.h2
-rw-r--r--tests/lib/cli/test_commands.refout24
-rw-r--r--tests/lib/subdir.am364
-rw-r--r--tests/lib/test_printfrr.c4
-rw-r--r--tests/lib/test_resolver.c81
-rw-r--r--tests/lib/test_segv.c2
-rw-r--r--tests/lib/test_sig.c24
-rw-r--r--tests/lib/test_timer_correctness.c1
-rw-r--r--tests/lib/test_timer_performance.c1
-rw-r--r--tests/lib/test_typelist.h82
-rw-r--r--tests/lib/test_zmq.c2
-rw-r--r--tests/ospf6d/subdir.am19
-rw-r--r--tests/ospfd/subdir.am21
-rw-r--r--tests/subdir.am492
-rw-r--r--tests/topotests/all_protocol_startup/r1/isisd.conf2
-rw-r--r--tests/topotests/all_protocol_startup/r1/ldpd.conf4
-rw-r--r--tests/topotests/all_protocol_startup/r1/ospf6d.conf8
-rw-r--r--tests/topotests/all_protocol_startup/r1/ospfd.conf4
-rw-r--r--tests/topotests/all_protocol_startup/r1/ripd.conf4
-rw-r--r--tests/topotests/all_protocol_startup/r1/ripngd.conf4
-rw-r--r--tests/topotests/all_protocol_startup/test_all_protocol_startup.py152
-rw-r--r--tests/topotests/bfd_bgp_cbit_topo3/r1/bfdd.conf6
-rw-r--r--tests/topotests/bfd_bgp_cbit_topo3/r1/bgpd.conf2
-rw-r--r--tests/topotests/bfd_bgp_cbit_topo3/r3/bfdd.conf6
-rw-r--r--tests/topotests/bfd_bgp_cbit_topo3/r3/bgpd.conf2
-rw-r--r--tests/topotests/bfd_isis_topo1/rt1/bfdd.conf6
-rw-r--r--tests/topotests/bfd_isis_topo1/rt1/isisd.conf10
-rw-r--r--tests/topotests/bfd_isis_topo1/rt1/zebra.conf8
-rw-r--r--tests/topotests/bfd_isis_topo1/rt2/bfdd.conf6
-rw-r--r--tests/topotests/bfd_isis_topo1/rt2/isisd.conf6
-rw-r--r--tests/topotests/bfd_isis_topo1/rt2/zebra.conf4
-rw-r--r--tests/topotests/bfd_isis_topo1/rt3/bfdd.conf6
-rw-r--r--tests/topotests/bfd_isis_topo1/rt3/isisd.conf6
-rw-r--r--tests/topotests/bfd_isis_topo1/rt3/zebra.conf4
-rw-r--r--tests/topotests/bfd_isis_topo1/rt4/bfdd.conf6
-rw-r--r--tests/topotests/bfd_isis_topo1/rt4/isisd.conf6
-rw-r--r--tests/topotests/bfd_isis_topo1/rt4/zebra.conf4
-rw-r--r--tests/topotests/bfd_isis_topo1/rt5/bfdd.conf6
-rw-r--r--tests/topotests/bfd_isis_topo1/rt5/isisd.conf6
-rw-r--r--tests/topotests/bfd_isis_topo1/rt5/zebra.conf4
-rw-r--r--tests/topotests/bfd_isis_topo1/test_bfd_isis_topo1.py15
-rw-r--r--tests/topotests/bfd_ospf_topo1/rt1/bfdd.conf6
-rw-r--r--tests/topotests/bfd_ospf_topo1/rt1/ospfd.conf4
-rw-r--r--tests/topotests/bfd_ospf_topo1/rt1/zebra.conf8
-rw-r--r--tests/topotests/bfd_ospf_topo1/rt2/bfdd.conf6
-rw-r--r--tests/topotests/bfd_ospf_topo1/rt2/ospfd.conf4
-rw-r--r--tests/topotests/bfd_ospf_topo1/rt2/zebra.conf4
-rw-r--r--tests/topotests/bfd_ospf_topo1/rt3/bfdd.conf6
-rw-r--r--tests/topotests/bfd_ospf_topo1/rt3/ospfd.conf4
-rw-r--r--tests/topotests/bfd_ospf_topo1/rt3/zebra.conf4
-rw-r--r--tests/topotests/bfd_ospf_topo1/rt4/bfdd.conf6
-rw-r--r--tests/topotests/bfd_ospf_topo1/rt4/ospfd.conf4
-rw-r--r--tests/topotests/bfd_ospf_topo1/rt4/zebra.conf4
-rw-r--r--tests/topotests/bfd_ospf_topo1/rt5/bfdd.conf6
-rw-r--r--tests/topotests/bfd_ospf_topo1/rt5/ospfd.conf4
-rw-r--r--tests/topotests/bfd_ospf_topo1/rt5/zebra.conf4
-rwxr-xr-xtests/topotests/bfd_ospf_topo1/test_bfd_ospf_topo1.py16
-rw-r--r--tests/topotests/bfd_profiles_topo1/r1/bfdd.conf6
-rw-r--r--tests/topotests/bfd_profiles_topo1/r2/bfdd.conf6
-rw-r--r--tests/topotests/bfd_profiles_topo1/r2/bgpd.conf2
-rw-r--r--tests/topotests/bfd_profiles_topo1/r3/bfdd.conf6
-rw-r--r--tests/topotests/bfd_profiles_topo1/r3/isisd.conf6
-rw-r--r--tests/topotests/bfd_profiles_topo1/r4/bfdd.conf6
-rw-r--r--tests/topotests/bfd_profiles_topo1/r4/bgpd.conf2
-rw-r--r--tests/topotests/bfd_profiles_topo1/r4/isisd.conf6
-rw-r--r--tests/topotests/bfd_profiles_topo1/r5/bfdd.conf6
-rw-r--r--tests/topotests/bfd_profiles_topo1/r6/bfdd.conf6
-rw-r--r--tests/topotests/bfd_topo1/r1/bfdd.conf6
-rw-r--r--tests/topotests/bfd_topo1/r2/bfdd.conf6
-rw-r--r--tests/topotests/bfd_topo1/r3/bfdd.conf6
-rw-r--r--tests/topotests/bfd_topo1/r4/bfdd.conf6
-rw-r--r--tests/topotests/bfd_topo2/r1/bfdd.conf6
-rw-r--r--tests/topotests/bfd_topo2/r2/bfdd.conf6
-rw-r--r--tests/topotests/bfd_topo2/r3/bfdd.conf6
-rw-r--r--tests/topotests/bfd_topo2/r4/bfdd.conf6
-rw-r--r--tests/topotests/bfd_topo3/r1/bfd-peers.json9
-rw-r--r--tests/topotests/bfd_topo3/r1/bfdd.conf6
-rw-r--r--tests/topotests/bfd_topo3/r2/bfd-peers.json6
-rw-r--r--tests/topotests/bfd_topo3/r2/bfdd.conf6
-rw-r--r--tests/topotests/bfd_topo3/r3/bfd-peers.json9
-rw-r--r--tests/topotests/bfd_topo3/r3/bfdd.conf6
-rw-r--r--tests/topotests/bfd_topo3/r4/bfd-peers.json6
-rw-r--r--tests/topotests/bfd_topo3/r4/bfdd.conf6
-rw-r--r--tests/topotests/bfd_vrf_topo1/r1/bfdd.conf6
-rw-r--r--tests/topotests/bfd_vrf_topo1/r2/bfdd.conf6
-rw-r--r--tests/topotests/bfd_vrf_topo1/r3/bfdd.conf6
-rw-r--r--tests/topotests/bfd_vrf_topo1/r4/bfdd.conf6
-rw-r--r--tests/topotests/bgp_aggregate_address_topo1/r1/bgpd.conf2
-rw-r--r--tests/topotests/bgp_auth/R1/bgpd_multi_vrf.conf2
-rw-r--r--tests/topotests/bgp_auth/R1/bgpd_vrf.conf2
-rwxr-xr-xtests/topotests/bgp_ecmp_topo1/peer1/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_ecmp_topo1/peer10/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_ecmp_topo1/peer11/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_ecmp_topo1/peer12/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_ecmp_topo1/peer13/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_ecmp_topo1/peer14/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_ecmp_topo1/peer15/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_ecmp_topo1/peer16/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_ecmp_topo1/peer17/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_ecmp_topo1/peer18/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_ecmp_topo1/peer19/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_ecmp_topo1/peer2/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_ecmp_topo1/peer20/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_ecmp_topo1/peer3/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_ecmp_topo1/peer4/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_ecmp_topo1/peer5/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_ecmp_topo1/peer6/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_ecmp_topo1/peer7/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_ecmp_topo1/peer8/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_ecmp_topo1/peer9/exa-send.py2
-rw-r--r--tests/topotests/bgp_ecmp_topo1/r1/summary.txt2
-rw-r--r--tests/topotests/bgp_ecmp_topo1/r1/summary20.txt2
-rw-r--r--tests/topotests/bgp_ecmp_topo1/test_bgp_ecmp_topo1.py8
-rw-r--r--tests/topotests/bgp_ecmp_topo3/test_ibgp_ecmp_topo3.py11
-rw-r--r--tests/topotests/bgp_evpn_mh/torm11/evpn.conf6
-rw-r--r--tests/topotests/bgp_evpn_mh/torm11/zebra.conf10
-rw-r--r--tests/topotests/bgp_evpn_mh/torm12/evpn.conf6
-rw-r--r--tests/topotests/bgp_evpn_mh/torm12/zebra.conf10
-rw-r--r--tests/topotests/bgp_evpn_mh/torm21/evpn.conf6
-rw-r--r--tests/topotests/bgp_evpn_mh/torm21/zebra.conf10
-rw-r--r--tests/topotests/bgp_evpn_mh/torm22/evpn.conf6
-rw-r--r--tests/topotests/bgp_evpn_mh/torm22/zebra.conf10
-rw-r--r--tests/topotests/bgp_evpn_rt5/r1/bgpd.conf6
-rw-r--r--tests/topotests/bgp_evpn_rt5/r1/zebra.conf8
-rw-r--r--tests/topotests/bgp_evpn_rt5/r2/bgpd.conf6
-rw-r--r--tests/topotests/bgp_evpn_rt5/r2/zebra.conf2
-rw-r--r--tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py2
-rw-r--r--tests/topotests/bgp_extended_optional_parameters_length/__init__.py0
-rw-r--r--tests/topotests/bgp_extended_optional_parameters_length/r1/bgpd.conf6
-rw-r--r--tests/topotests/bgp_extended_optional_parameters_length/r1/zebra.conf4
-rw-r--r--tests/topotests/bgp_extended_optional_parameters_length/r2/bgpd.conf8
-rw-r--r--tests/topotests/bgp_extended_optional_parameters_length/r2/zebra.conf7
-rw-r--r--tests/topotests/bgp_extended_optional_parameters_length/test_bgp_extended_optional_parameters_length.py106
-rw-r--r--tests/topotests/bgp_features/r1/ospf6d.conf2
-rw-r--r--tests/topotests/bgp_features/r1/ospf_neighbor.json4
-rw-r--r--tests/topotests/bgp_features/r1/ospfd.conf4
-rw-r--r--tests/topotests/bgp_features/r2/ospf6d.conf2
-rw-r--r--tests/topotests/bgp_features/r2/ospf_neighbor.json4
-rw-r--r--tests/topotests/bgp_features/r2/ospfd.conf4
-rw-r--r--tests/topotests/bgp_features/r3/ospf6d.conf2
-rw-r--r--tests/topotests/bgp_features/r3/ospf_neighbor.json4
-rw-r--r--tests/topotests/bgp_features/r3/ospfd.conf4
-rw-r--r--tests/topotests/bgp_features/test_bgp_features.py9
-rw-r--r--tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-1.py1542
-rw-r--r--tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-2.py404
-rw-r--r--tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-3.py (renamed from tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1.py)2321
-rw-r--r--tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-4.py1686
-rw-r--r--tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-1.py1515
-rw-r--r--tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-2.py1216
-rw-r--r--tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-3.py1367
-rw-r--r--tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-4.py1024
-rw-r--r--tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py4358
-rw-r--r--tests/topotests/bgp_gr_functionality_topo3/bgp_gr_functionality_topo3.json222
-rw-r--r--tests/topotests/bgp_gr_functionality_topo3/bgp_gr_functionality_topo3.py554
-rw-r--r--tests/topotests/bgp_ipv6_rtadv/r1/zebra.conf4
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_direct/r1/ldpd.conf14
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_direct/r2/ldpd.conf14
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_direct/r3/ldpd.conf14
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_direct/r4/ldpd.conf14
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/adjacencies.py7
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/ldpd.conf14
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/r2/ldpd.conf14
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/r3/ldpd.conf14
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/r4/ldpd.conf14
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_linux_mpls.py4
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/check_routes.py290
-rw-r--r--tests/topotests/bgp_l3vpn_to_bgp_vrf/scripts/scale_up.py4
-rw-r--r--tests/topotests/bgp_link_bw_ip/r4/bgpd.conf6
-rw-r--r--tests/topotests/bgp_llgr/__init__.py0
-rw-r--r--tests/topotests/bgp_llgr/r0/bgpd.conf10
-rw-r--r--tests/topotests/bgp_llgr/r0/zebra.conf7
-rw-r--r--tests/topotests/bgp_llgr/r1/bgpd.conf10
-rw-r--r--tests/topotests/bgp_llgr/r1/zebra.conf7
-rw-r--r--tests/topotests/bgp_llgr/r2/bgpd.conf9
-rw-r--r--tests/topotests/bgp_llgr/r2/zebra.conf10
-rw-r--r--tests/topotests/bgp_llgr/r3/bgpd.conf6
-rw-r--r--tests/topotests/bgp_llgr/r3/zebra.conf4
-rw-r--r--tests/topotests/bgp_llgr/test_bgp_llgr.py184
-rw-r--r--tests/topotests/bgp_lu_topo1/R1/bgpd.conf4
-rw-r--r--tests/topotests/bgp_lu_topo1/R1/zebra.conf6
-rw-r--r--tests/topotests/bgp_lu_topo1/R2/bgpd.conf4
-rw-r--r--tests/topotests/bgp_lu_topo1/R2/labelpool.summ.json6
-rw-r--r--tests/topotests/bgp_lu_topo1/R2/zebra.conf6
-rw-r--r--tests/topotests/bgp_lu_topo1/R3/bgpd.conf2
-rw-r--r--tests/topotests/bgp_lu_topo1/R3/zebra.conf6
-rw-r--r--tests/topotests/bgp_lu_topo2/R1/bgpd.conf29
-rw-r--r--tests/topotests/bgp_lu_topo2/R1/labelpool.summ.json8
-rw-r--r--tests/topotests/bgp_lu_topo2/R1/zebra.conf13
-rw-r--r--tests/topotests/bgp_lu_topo2/R2/bgpd.conf27
-rw-r--r--tests/topotests/bgp_lu_topo2/R2/labelpool.summ.json8
-rw-r--r--tests/topotests/bgp_lu_topo2/R2/zebra.conf14
-rw-r--r--tests/topotests/bgp_lu_topo2/R3/bgpd.conf70
-rw-r--r--tests/topotests/bgp_lu_topo2/R3/staticd.conf5
-rw-r--r--tests/topotests/bgp_lu_topo2/R3/zebra.conf11
-rw-r--r--tests/topotests/bgp_lu_topo2/R4/bgpd.conf23
-rw-r--r--tests/topotests/bgp_lu_topo2/R4/zebra.conf9
-rw-r--r--tests/topotests/bgp_lu_topo2/test_bgp_lu2.py221
-rwxr-xr-xtests/topotests/bgp_multiview_topo1/peer1/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_multiview_topo1/peer2/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_multiview_topo1/peer3/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_multiview_topo1/peer4/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_multiview_topo1/peer5/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_multiview_topo1/peer6/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_multiview_topo1/peer7/exa-send.py2
-rwxr-xr-xtests/topotests/bgp_multiview_topo1/peer8/exa-send.py2
-rw-r--r--tests/topotests/bgp_peer_type_multipath_relax/peer1/exa_readpipe.py2
-rw-r--r--tests/topotests/bgp_peer_type_multipath_relax/peer2/exa_readpipe.py2
-rw-r--r--tests/topotests/bgp_peer_type_multipath_relax/peer3/exa_readpipe.py2
-rw-r--r--tests/topotests/bgp_peer_type_multipath_relax/peer4/exa_readpipe.py2
-rw-r--r--tests/topotests/bgp_route_map_match_ipv6_nexthop/__init__.py0
-rw-r--r--tests/topotests/bgp_route_map_match_ipv6_nexthop/r1/bgpd.conf32
-rw-r--r--tests/topotests/bgp_route_map_match_ipv6_nexthop/r1/zebra.conf4
-rw-r--r--tests/topotests/bgp_route_map_match_ipv6_nexthop/r2/bgpd.conf33
-rw-r--r--tests/topotests/bgp_route_map_match_ipv6_nexthop/r2/zebra.conf11
-rw-r--r--tests/topotests/bgp_route_map_match_ipv6_nexthop/test_bgp_route_map_match_ipv6_nexthop.py121
-rw-r--r--tests/topotests/bgp_route_server_client/__init__.py0
-rw-r--r--tests/topotests/bgp_route_server_client/r1/bgpd.conf12
-rw-r--r--tests/topotests/bgp_route_server_client/r1/zebra.conf7
-rw-r--r--tests/topotests/bgp_route_server_client/r2/bgpd.conf17
-rw-r--r--tests/topotests/bgp_route_server_client/r2/zebra.conf7
-rw-r--r--tests/topotests/bgp_route_server_client/r3/bgpd.conf12
-rw-r--r--tests/topotests/bgp_route_server_client/r3/zebra.conf7
-rw-r--r--tests/topotests/bgp_route_server_client/test_bgp_route_server_client.py143
-rw-r--r--tests/topotests/bgp_snmp_mplsl3vpn/ce1/zebra.conf4
-rw-r--r--tests/topotests/bgp_snmp_mplsl3vpn/ce2/zebra.conf4
-rw-r--r--tests/topotests/bgp_snmp_mplsl3vpn/ce3/zebra.conf4
-rw-r--r--tests/topotests/bgp_snmp_mplsl3vpn/ce4/zebra.conf4
-rw-r--r--tests/topotests/bgp_snmp_mplsl3vpn/r1/isisd.conf4
-rw-r--r--tests/topotests/bgp_snmp_mplsl3vpn/r2/isisd.conf4
-rw-r--r--tests/topotests/bgp_snmp_mplsl3vpn/r2/zebra.conf4
-rw-r--r--tests/topotests/bgp_snmp_mplsl3vpn/r3/isisd.conf4
-rw-r--r--tests/topotests/bgp_snmp_mplsl3vpn/r3/zebra.conf4
-rw-r--r--tests/topotests/bgp_snmp_mplsl3vpn/r4/isisd.conf4
-rw-r--r--tests/topotests/bgp_snmp_mplsl3vpn/r4/zebra.conf4
-rw-r--r--tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/zebra.conf6
-rw-r--r--tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/zebra.conf6
-rwxr-xr-xtests/topotests/bgp_srv6l3vpn_to_bgp_vrf/test_bgp_srv6l3vpn_to_bgp_vrf.py7
-rw-r--r--tests/topotests/bgp_suppress_fib/r1/bgp_ipv4_allowas.json40
-rw-r--r--tests/topotests/bgp_suppress_fib/r2/bgp_ipv4_allowas.json68
-rw-r--r--tests/topotests/bgp_suppress_fib/r2/bgpd.allowas_in.conf18
-rw-r--r--tests/topotests/bgp_suppress_fib/r2/bgpd.conf3
-rw-r--r--tests/topotests/bgp_suppress_fib/r2/no_bgp_ipv4_allowas.json1
-rw-r--r--tests/topotests/bgp_suppress_fib/r2/v4_override.json20
-rw-r--r--tests/topotests/bgp_suppress_fib/r3/v4_override.json4
-rw-r--r--tests/topotests/bgp_suppress_fib/test_bgp_suppress_fib.py110
-rw-r--r--tests/topotests/bgp_tcp_mss/bgp_vrf_tcp_mss.json222
-rw-r--r--tests/topotests/bgp_tcp_mss/test_bgp_vrf_tcp_mss.py766
-rw-r--r--tests/topotests/bgp_vrf_lite_best_path_test/bgp_vrf_lite_best_path_topo1.json563
-rw-r--r--tests/topotests/bgp_vrf_lite_best_path_test/bgp_vrf_lite_best_path_topo2.json1088
-rw-r--r--tests/topotests/bgp_vrf_lite_best_path_test/test_bgp_vrf_lite_best_path_topo1.py916
-rw-r--r--tests/topotests/bgp_vrf_lite_best_path_test/test_bgp_vrf_lite_best_path_topo2.py539
-rw-r--r--tests/topotests/bgp_vrf_lite_ipv6_rtadv/r1/zebra.conf4
-rwxr-xr-xtests/topotests/bgp_vrf_netns/peer1/exa-send.py2
-rw-r--r--tests/topotests/bgp_vrf_netns/r1/zebra.conf2
-rw-r--r--tests/topotests/config_timing/test_config_timing.py22
-rwxr-xr-xtests/topotests/conftest.py63
-rw-r--r--tests/topotests/eigrp_topo1/r1/zebra.conf2
-rw-r--r--tests/topotests/evpn_pim_1/leaf1/pimd.conf6
-rw-r--r--tests/topotests/isis_lfa_topo1/rt1/isisd.conf8
-rw-r--r--tests/topotests/isis_lfa_topo1/rt1/zebra.conf6
-rw-r--r--tests/topotests/isis_lfa_topo1/rt2/isisd.conf8
-rw-r--r--tests/topotests/isis_lfa_topo1/rt2/zebra.conf6
-rw-r--r--tests/topotests/isis_lfa_topo1/rt3/isisd.conf8
-rw-r--r--tests/topotests/isis_lfa_topo1/rt3/zebra.conf6
-rw-r--r--tests/topotests/isis_lfa_topo1/rt4/isisd.conf8
-rw-r--r--tests/topotests/isis_lfa_topo1/rt4/zebra.conf6
-rw-r--r--tests/topotests/isis_lfa_topo1/rt5/isisd.conf8
-rw-r--r--tests/topotests/isis_lfa_topo1/rt5/zebra.conf6
-rw-r--r--tests/topotests/isis_lfa_topo1/rt6/isisd.conf8
-rw-r--r--tests/topotests/isis_lfa_topo1/rt6/zebra.conf6
-rw-r--r--tests/topotests/isis_lfa_topo1/rt7/isisd.conf8
-rw-r--r--tests/topotests/isis_lfa_topo1/rt7/zebra.conf6
-rw-r--r--tests/topotests/isis_lsp_bits_topo1/rt1/isisd.conf10
-rw-r--r--tests/topotests/isis_lsp_bits_topo1/rt1/zebra.conf6
-rw-r--r--tests/topotests/isis_lsp_bits_topo1/rt2/isisd.conf10
-rw-r--r--tests/topotests/isis_lsp_bits_topo1/rt2/zebra.conf6
-rw-r--r--tests/topotests/isis_lsp_bits_topo1/rt3/isisd.conf10
-rw-r--r--tests/topotests/isis_lsp_bits_topo1/rt3/zebra.conf6
-rw-r--r--tests/topotests/isis_lsp_bits_topo1/rt4/isisd.conf10
-rw-r--r--tests/topotests/isis_lsp_bits_topo1/rt4/zebra.conf6
-rw-r--r--tests/topotests/isis_lsp_bits_topo1/rt5/isisd.conf10
-rw-r--r--tests/topotests/isis_lsp_bits_topo1/rt5/zebra.conf6
-rw-r--r--tests/topotests/isis_lsp_bits_topo1/rt6/isisd.conf10
-rw-r--r--tests/topotests/isis_lsp_bits_topo1/rt6/zebra.conf6
-rw-r--r--tests/topotests/isis_rlfa_topo1/rt1/isisd.conf8
-rw-r--r--tests/topotests/isis_rlfa_topo1/rt1/ldpd.conf6
-rw-r--r--tests/topotests/isis_rlfa_topo1/rt1/zebra.conf6
-rw-r--r--tests/topotests/isis_rlfa_topo1/rt2/isisd.conf8
-rw-r--r--tests/topotests/isis_rlfa_topo1/rt2/ldpd.conf6
-rw-r--r--tests/topotests/isis_rlfa_topo1/rt2/zebra.conf6
-rw-r--r--tests/topotests/isis_rlfa_topo1/rt3/isisd.conf8
-rw-r--r--tests/topotests/isis_rlfa_topo1/rt3/ldpd.conf6
-rw-r--r--tests/topotests/isis_rlfa_topo1/rt3/zebra.conf6
-rw-r--r--tests/topotests/isis_rlfa_topo1/rt4/isisd.conf8
-rw-r--r--tests/topotests/isis_rlfa_topo1/rt4/ldpd.conf6
-rw-r--r--tests/topotests/isis_rlfa_topo1/rt4/zebra.conf6
-rw-r--r--tests/topotests/isis_rlfa_topo1/rt5/isisd.conf8
-rw-r--r--tests/topotests/isis_rlfa_topo1/rt5/ldpd.conf6
-rw-r--r--tests/topotests/isis_rlfa_topo1/rt5/zebra.conf6
-rw-r--r--tests/topotests/isis_rlfa_topo1/rt6/isisd.conf8
-rw-r--r--tests/topotests/isis_rlfa_topo1/rt6/ldpd.conf6
-rw-r--r--tests/topotests/isis_rlfa_topo1/rt6/zebra.conf6
-rw-r--r--tests/topotests/isis_rlfa_topo1/rt7/isisd.conf8
-rw-r--r--tests/topotests/isis_rlfa_topo1/rt7/ldpd.conf6
-rw-r--r--tests/topotests/isis_rlfa_topo1/rt7/zebra.conf6
-rw-r--r--tests/topotests/isis_rlfa_topo1/rt8/isisd.conf8
-rw-r--r--tests/topotests/isis_rlfa_topo1/rt8/ldpd.conf6
-rw-r--r--tests/topotests/isis_rlfa_topo1/rt8/zebra.conf6
-rw-r--r--tests/topotests/isis_snmp/r1/isisd.conf6
-rw-r--r--tests/topotests/isis_snmp/r1/ldpd.conf8
-rw-r--r--tests/topotests/isis_snmp/r1/zebra.conf8
-rw-r--r--tests/topotests/isis_snmp/r2/isisd.conf6
-rw-r--r--tests/topotests/isis_snmp/r2/ldpd.conf8
-rw-r--r--tests/topotests/isis_snmp/r2/zebra.conf8
-rw-r--r--tests/topotests/isis_snmp/r3/isisd.conf6
-rw-r--r--tests/topotests/isis_snmp/r3/ldpd.conf8
-rw-r--r--tests/topotests/isis_snmp/r3/zebra.conf8
-rw-r--r--tests/topotests/isis_snmp/r4/isisd.conf6
-rw-r--r--tests/topotests/isis_snmp/r4/ldpd.conf8
-rw-r--r--tests/topotests/isis_snmp/r4/zebra.conf8
-rw-r--r--tests/topotests/isis_snmp/r5/isisd.conf6
-rw-r--r--tests/topotests/isis_snmp/r5/ldpd.conf8
-rw-r--r--tests/topotests/isis_snmp/r5/zebra.conf8
-rw-r--r--tests/topotests/isis_sr_te_topo1/dst/zebra.conf6
-rw-r--r--tests/topotests/isis_sr_te_topo1/rt1/isisd.conf10
-rw-r--r--tests/topotests/isis_sr_te_topo1/rt1/zebra.conf6
-rw-r--r--tests/topotests/isis_sr_te_topo1/rt2/isisd.conf10
-rw-r--r--tests/topotests/isis_sr_te_topo1/rt2/zebra.conf6
-rw-r--r--tests/topotests/isis_sr_te_topo1/rt3/isisd.conf10
-rw-r--r--tests/topotests/isis_sr_te_topo1/rt3/zebra.conf6
-rw-r--r--tests/topotests/isis_sr_te_topo1/rt4/isisd.conf10
-rw-r--r--tests/topotests/isis_sr_te_topo1/rt4/zebra.conf6
-rw-r--r--tests/topotests/isis_sr_te_topo1/rt5/isisd.conf10
-rw-r--r--tests/topotests/isis_sr_te_topo1/rt5/zebra.conf6
-rw-r--r--tests/topotests/isis_sr_te_topo1/rt6/isisd.conf10
-rw-r--r--tests/topotests/isis_sr_te_topo1/rt6/zebra.conf6
-rw-r--r--tests/topotests/isis_sr_topo1/rt1/isisd.conf10
-rw-r--r--tests/topotests/isis_sr_topo1/rt1/zebra.conf6
-rw-r--r--tests/topotests/isis_sr_topo1/rt2/isisd.conf10
-rw-r--r--tests/topotests/isis_sr_topo1/rt2/zebra.conf6
-rw-r--r--tests/topotests/isis_sr_topo1/rt3/isisd.conf10
-rw-r--r--tests/topotests/isis_sr_topo1/rt3/zebra.conf6
-rw-r--r--tests/topotests/isis_sr_topo1/rt4/isisd.conf10
-rw-r--r--tests/topotests/isis_sr_topo1/rt4/zebra.conf6
-rw-r--r--tests/topotests/isis_sr_topo1/rt5/isisd.conf10
-rw-r--r--tests/topotests/isis_sr_topo1/rt5/zebra.conf6
-rw-r--r--tests/topotests/isis_sr_topo1/rt6/isisd.conf10
-rw-r--r--tests/topotests/isis_sr_topo1/rt6/zebra.conf6
-rw-r--r--tests/topotests/isis_tilfa_topo1/rt1/isisd.conf10
-rw-r--r--tests/topotests/isis_tilfa_topo1/rt1/zebra.conf6
-rw-r--r--tests/topotests/isis_tilfa_topo1/rt2/isisd.conf10
-rw-r--r--tests/topotests/isis_tilfa_topo1/rt2/zebra.conf6
-rw-r--r--tests/topotests/isis_tilfa_topo1/rt3/isisd.conf10
-rw-r--r--tests/topotests/isis_tilfa_topo1/rt3/zebra.conf6
-rw-r--r--tests/topotests/isis_tilfa_topo1/rt4/isisd.conf10
-rw-r--r--tests/topotests/isis_tilfa_topo1/rt4/zebra.conf6
-rw-r--r--tests/topotests/isis_tilfa_topo1/rt5/isisd.conf10
-rw-r--r--tests/topotests/isis_tilfa_topo1/rt5/zebra.conf6
-rw-r--r--tests/topotests/isis_tilfa_topo1/rt6/isisd.conf10
-rw-r--r--tests/topotests/isis_tilfa_topo1/rt6/zebra.conf6
-rw-r--r--tests/topotests/isis_topo1/r1/isisd.conf6
-rw-r--r--tests/topotests/isis_topo1/r2/isisd.conf6
-rw-r--r--tests/topotests/isis_topo1/r3/isisd.conf6
-rw-r--r--tests/topotests/isis_topo1/r4/isisd.conf6
-rw-r--r--tests/topotests/isis_topo1/r5/isisd.conf6
-rw-r--r--tests/topotests/isis_topo1/test_isis_topo1.py24
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r1/isisd.conf6
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r2/isisd.conf6
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r3/isisd.conf6
-rw-r--r--tests/topotests/isis_topo1_vrf/r3/r3_topology.json12
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r4/isisd.conf10
-rwxr-xr-xtests/topotests/isis_topo1_vrf/r5/isisd.conf6
-rw-r--r--tests/topotests/isis_topo1_vrf/test_isis_topo1_vrf.py42
-rw-r--r--tests/topotests/ldp_oc_acl_topo1/r1/ldpd.conf14
-rw-r--r--tests/topotests/ldp_oc_acl_topo1/r1/show_ip_ospf_neighbor.json2
-rw-r--r--tests/topotests/ldp_oc_acl_topo1/r2/ldpd.conf14
-rw-r--r--tests/topotests/ldp_oc_acl_topo1/r2/show_ip_ospf_neighbor.json6
-rw-r--r--tests/topotests/ldp_oc_acl_topo1/r3/ldpd.conf14
-rw-r--r--tests/topotests/ldp_oc_acl_topo1/r3/show_ip_ospf_neighbor.json4
-rw-r--r--tests/topotests/ldp_oc_acl_topo1/r4/ldpd.conf14
-rw-r--r--tests/topotests/ldp_oc_acl_topo1/r4/show_ip_ospf_neighbor.json4
-rw-r--r--tests/topotests/ldp_oc_topo1/r1/ldpd.conf14
-rw-r--r--tests/topotests/ldp_oc_topo1/r1/show_ip_ospf_neighbor.json2
-rw-r--r--tests/topotests/ldp_oc_topo1/r2/ldpd.conf14
-rw-r--r--tests/topotests/ldp_oc_topo1/r2/show_ip_ospf_neighbor.json6
-rw-r--r--tests/topotests/ldp_oc_topo1/r3/ldpd.conf14
-rw-r--r--tests/topotests/ldp_oc_topo1/r3/show_ip_ospf_neighbor.json4
-rw-r--r--tests/topotests/ldp_oc_topo1/r4/ldpd.conf14
-rw-r--r--tests/topotests/ldp_oc_topo1/r4/show_ip_ospf_neighbor.json4
-rw-r--r--tests/topotests/ldp_snmp/r1/isisd.conf8
-rw-r--r--tests/topotests/ldp_snmp/r1/ldpd.conf8
-rw-r--r--tests/topotests/ldp_snmp/r1/zebra.conf12
-rw-r--r--tests/topotests/ldp_snmp/r2/isisd.conf8
-rw-r--r--tests/topotests/ldp_snmp/r2/ldpd.conf8
-rw-r--r--tests/topotests/ldp_snmp/r2/ospfd.conf4
-rw-r--r--tests/topotests/ldp_snmp/r2/zebra.conf10
-rw-r--r--tests/topotests/ldp_snmp/r3/isisd.conf8
-rw-r--r--tests/topotests/ldp_snmp/r3/ldpd.conf8
-rw-r--r--tests/topotests/ldp_snmp/r3/zebra.conf10
-rw-r--r--tests/topotests/ldp_sync_isis_topo1/r1/isisd.conf8
-rw-r--r--tests/topotests/ldp_sync_isis_topo1/r1/ldpd.conf8
-rw-r--r--tests/topotests/ldp_sync_isis_topo1/r1/zebra.conf12
-rw-r--r--tests/topotests/ldp_sync_isis_topo1/r2/isisd.conf8
-rw-r--r--tests/topotests/ldp_sync_isis_topo1/r2/ldpd.conf8
-rw-r--r--tests/topotests/ldp_sync_isis_topo1/r2/zebra.conf10
-rw-r--r--tests/topotests/ldp_sync_isis_topo1/r3/isisd.conf8
-rw-r--r--tests/topotests/ldp_sync_isis_topo1/r3/ldpd.conf8
-rw-r--r--tests/topotests/ldp_sync_isis_topo1/r3/zebra.conf10
-rw-r--r--tests/topotests/ldp_sync_ospf_topo1/r1/ldpd.conf8
-rw-r--r--tests/topotests/ldp_sync_ospf_topo1/r1/ospfd.conf4
-rw-r--r--tests/topotests/ldp_sync_ospf_topo1/r1/show_ip_ospf_neighbor.json4
-rw-r--r--tests/topotests/ldp_sync_ospf_topo1/r1/zebra.conf12
-rw-r--r--tests/topotests/ldp_sync_ospf_topo1/r2/ldpd.conf8
-rw-r--r--tests/topotests/ldp_sync_ospf_topo1/r2/ospfd.conf4
-rw-r--r--tests/topotests/ldp_sync_ospf_topo1/r2/show_ip_ospf_neighbor.json4
-rw-r--r--tests/topotests/ldp_sync_ospf_topo1/r2/zebra.conf10
-rw-r--r--tests/topotests/ldp_sync_ospf_topo1/r3/ldpd.conf8
-rw-r--r--tests/topotests/ldp_sync_ospf_topo1/r3/ospfd.conf4
-rw-r--r--tests/topotests/ldp_sync_ospf_topo1/r3/show_ip_ospf_neighbor.json4
-rw-r--r--tests/topotests/ldp_sync_ospf_topo1/r3/zebra.conf10
-rw-r--r--tests/topotests/ldp_topo1/r1/ldpd.conf14
-rw-r--r--tests/topotests/ldp_topo1/r2/ldpd.conf14
-rw-r--r--tests/topotests/ldp_topo1/r3/ldpd.conf14
-rw-r--r--tests/topotests/ldp_topo1/r4/ldpd.conf14
-rw-r--r--tests/topotests/ldp_topo1/test_ldp_topo1.py39
-rw-r--r--tests/topotests/ldp_vpls_topo1/r1/ldpd.conf14
-rw-r--r--tests/topotests/ldp_vpls_topo1/r1/show_ip_ospf_neighbor.json4
-rw-r--r--tests/topotests/ldp_vpls_topo1/r1/show_ip_route_after_link_down.ref20
-rw-r--r--tests/topotests/ldp_vpls_topo1/r1/zebra.conf12
-rw-r--r--tests/topotests/ldp_vpls_topo1/r2/ldpd.conf14
-rw-r--r--tests/topotests/ldp_vpls_topo1/r2/show_ip_ospf_neighbor.json4
-rw-r--r--tests/topotests/ldp_vpls_topo1/r2/zebra.conf10
-rw-r--r--tests/topotests/ldp_vpls_topo1/r3/ldpd.conf14
-rw-r--r--tests/topotests/ldp_vpls_topo1/r3/show_ip_ospf_neighbor.json4
-rw-r--r--tests/topotests/ldp_vpls_topo1/r3/zebra.conf10
-rw-r--r--tests/topotests/ldp_vpls_topo1/test_ldp_vpls_topo1.py12
-rw-r--r--tests/topotests/lib/bgp.py152
-rw-r--r--tests/topotests/lib/bgprib.py2
-rw-r--r--tests/topotests/lib/common_config.py44
-rw-r--r--tests/topotests/lib/ltemplate.py2
-rw-r--r--tests/topotests/lib/lutil.py21
-rw-r--r--tests/topotests/lib/ospf.py115
-rw-r--r--tests/topotests/lib/pim.py52
-rw-r--r--tests/topotests/lib/topojson.py15
-rw-r--r--tests/topotests/lib/topotest.py13
-rw-r--r--tests/topotests/msdp_topo1/r1/pimd.conf4
-rw-r--r--tests/topotests/msdp_topo1/r2/pimd.conf4
-rw-r--r--tests/topotests/msdp_topo1/r3/pimd.conf4
-rw-r--r--tests/topotests/msdp_topo1/r4/pimd.conf4
-rw-r--r--tests/topotests/multicast_pim_bsm_topo1/test_mcast_pim_bsmp_01.py10
-rwxr-xr-xtests/topotests/multicast_pim_sm_topo1/test_multicast_pim_sm_topo1.py10
-rwxr-xr-xtests/topotests/multicast_pim_sm_topo2/test_multicast_pim_sm_topo2.py6
-rwxr-xr-xtests/topotests/multicast_pim_sm_topo3/test_multicast_pim_sm_topo4.py99
-rwxr-xr-xtests/topotests/multicast_pim_static_rp_topo1/test_multicast_pim_static_rp.py26
-rw-r--r--tests/topotests/nhrp_topo/r1/nhrpd.conf2
-rw-r--r--tests/topotests/nhrp_topo/r2/nhrpd.conf2
-rw-r--r--tests/topotests/nhrp_topo/r3/zebra.conf8
-rw-r--r--tests/topotests/nhrp_topo/test_nhrp_topo.py14
-rw-r--r--tests/topotests/ospf6_gr_topo1/rt1/ospf6d.conf16
-rw-r--r--tests/topotests/ospf6_gr_topo1/rt1/zebra.conf8
-rw-r--r--tests/topotests/ospf6_gr_topo1/rt2/ospf6d.conf16
-rw-r--r--tests/topotests/ospf6_gr_topo1/rt2/zebra.conf8
-rw-r--r--tests/topotests/ospf6_gr_topo1/rt3/ospf6d.conf16
-rw-r--r--tests/topotests/ospf6_gr_topo1/rt3/zebra.conf8
-rw-r--r--tests/topotests/ospf6_gr_topo1/rt4/ospf6d.conf16
-rw-r--r--tests/topotests/ospf6_gr_topo1/rt4/zebra.conf8
-rw-r--r--tests/topotests/ospf6_gr_topo1/rt5/ospf6d.conf16
-rw-r--r--tests/topotests/ospf6_gr_topo1/rt5/zebra.conf8
-rw-r--r--tests/topotests/ospf6_gr_topo1/rt6/ospf6d.conf16
-rw-r--r--tests/topotests/ospf6_gr_topo1/rt6/zebra.conf8
-rw-r--r--tests/topotests/ospf6_gr_topo1/rt7/ospf6d.conf16
-rw-r--r--tests/topotests/ospf6_gr_topo1/rt7/zebra.conf8
-rwxr-xr-xtests/topotests/ospf6_gr_topo1/test_ospf6_gr_topo1.py95
-rw-r--r--tests/topotests/ospf6_topo1/r1/ospf6d.conf14
-rw-r--r--tests/topotests/ospf6_topo1/r1/zebra.conf4
-rw-r--r--tests/topotests/ospf6_topo1/r2/ospf6d.conf14
-rw-r--r--tests/topotests/ospf6_topo1/r2/zebra.conf4
-rw-r--r--tests/topotests/ospf6_topo1/r3/ospf6d.conf14
-rw-r--r--tests/topotests/ospf6_topo1/r3/zebra.conf4
-rw-r--r--tests/topotests/ospf6_topo1/r4/ospf6d.conf14
-rw-r--r--tests/topotests/ospf6_topo1/r4/zebra.conf4
-rw-r--r--tests/topotests/ospf6_topo1_vrf/r1/ospf6d.conf14
-rw-r--r--tests/topotests/ospf6_topo1_vrf/r1/zebra.conf4
-rw-r--r--tests/topotests/ospf6_topo1_vrf/r2/ospf6d.conf14
-rw-r--r--tests/topotests/ospf6_topo1_vrf/r2/zebra.conf4
-rw-r--r--tests/topotests/ospf6_topo1_vrf/r3/ospf6d.conf14
-rw-r--r--tests/topotests/ospf6_topo1_vrf/r3/zebra.conf4
-rw-r--r--tests/topotests/ospf6_topo1_vrf/r4/ospf6d.conf14
-rw-r--r--tests/topotests/ospf6_topo1_vrf/r4/zebra.conf4
-rw-r--r--tests/topotests/ospf6_topo2/r1/ospf6d.conf53
-rw-r--r--tests/topotests/ospf6_topo2/r2/ospf6d.conf57
-rw-r--r--tests/topotests/ospf6_topo2/r3/ospf6d.conf53
-rw-r--r--tests/topotests/ospf6_topo2/r4/ospf6d.conf53
-rw-r--r--tests/topotests/ospf6_topo2/test_ospf6_topo2.py100
-rw-r--r--tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_topo1.py83
-rw-r--r--tests/topotests/ospf_basic_functionality/test_ospf_lan.py3
-rw-r--r--tests/topotests/ospf_dual_stack/test_ospf_dual_stack.json52
-rw-r--r--tests/topotests/ospf_gr_topo1/rt1/ospfd.conf20
-rw-r--r--tests/topotests/ospf_gr_topo1/rt1/show_ip_ospf_neighbor.json2
-rw-r--r--tests/topotests/ospf_gr_topo1/rt1/zebra.conf8
-rw-r--r--tests/topotests/ospf_gr_topo1/rt2/ospfd.conf20
-rw-r--r--tests/topotests/ospf_gr_topo1/rt2/show_ip_ospf_neighbor.json4
-rw-r--r--tests/topotests/ospf_gr_topo1/rt2/zebra.conf8
-rw-r--r--tests/topotests/ospf_gr_topo1/rt3/ospfd.conf20
-rw-r--r--tests/topotests/ospf_gr_topo1/rt3/show_ip_ospf_neighbor.json6
-rw-r--r--tests/topotests/ospf_gr_topo1/rt3/zebra.conf8
-rw-r--r--tests/topotests/ospf_gr_topo1/rt4/ospfd.conf20
-rw-r--r--tests/topotests/ospf_gr_topo1/rt4/show_ip_ospf_neighbor.json4
-rw-r--r--tests/topotests/ospf_gr_topo1/rt4/zebra.conf8
-rw-r--r--tests/topotests/ospf_gr_topo1/rt5/ospfd.conf20
-rw-r--r--tests/topotests/ospf_gr_topo1/rt5/show_ip_ospf_neighbor.json2
-rw-r--r--tests/topotests/ospf_gr_topo1/rt5/zebra.conf8
-rw-r--r--tests/topotests/ospf_gr_topo1/rt6/ospfd.conf20
-rw-r--r--tests/topotests/ospf_gr_topo1/rt6/show_ip_ospf_neighbor.json4
-rw-r--r--tests/topotests/ospf_gr_topo1/rt6/zebra.conf8
-rw-r--r--tests/topotests/ospf_gr_topo1/rt7/ospfd.conf20
-rw-r--r--tests/topotests/ospf_gr_topo1/rt7/show_ip_ospf_neighbor.json2
-rw-r--r--tests/topotests/ospf_gr_topo1/rt7/zebra.conf8
-rwxr-xr-xtests/topotests/ospf_gr_topo1/test_ospf_gr_topo1.py94
-rw-r--r--tests/topotests/ospf_sr_te_topo1/dst/zebra.conf6
-rw-r--r--tests/topotests/ospf_sr_te_topo1/rt1/ospfd.conf10
-rw-r--r--tests/topotests/ospf_sr_te_topo1/rt1/zebra.conf6
-rw-r--r--tests/topotests/ospf_sr_te_topo1/rt2/ospfd.conf10
-rw-r--r--tests/topotests/ospf_sr_te_topo1/rt2/zebra.conf6
-rw-r--r--tests/topotests/ospf_sr_te_topo1/rt3/ospfd.conf10
-rw-r--r--tests/topotests/ospf_sr_te_topo1/rt3/zebra.conf6
-rw-r--r--tests/topotests/ospf_sr_te_topo1/rt4/ospfd.conf10
-rw-r--r--tests/topotests/ospf_sr_te_topo1/rt4/zebra.conf6
-rw-r--r--tests/topotests/ospf_sr_te_topo1/rt5/ospfd.conf10
-rw-r--r--tests/topotests/ospf_sr_te_topo1/rt5/zebra.conf6
-rw-r--r--tests/topotests/ospf_sr_te_topo1/rt6/ospfd.conf10
-rw-r--r--tests/topotests/ospf_sr_te_topo1/rt6/zebra.conf6
-rw-r--r--tests/topotests/ospf_sr_topo1/rt1/ospfd.conf10
-rw-r--r--tests/topotests/ospf_sr_topo1/rt1/zebra.conf6
-rw-r--r--tests/topotests/ospf_sr_topo1/rt2/ospfd.conf10
-rw-r--r--tests/topotests/ospf_sr_topo1/rt2/zebra.conf6
-rw-r--r--tests/topotests/ospf_sr_topo1/rt3/ospfd.conf10
-rw-r--r--tests/topotests/ospf_sr_topo1/rt3/zebra.conf6
-rw-r--r--tests/topotests/ospf_sr_topo1/rt4/ospfd.conf10
-rw-r--r--tests/topotests/ospf_sr_topo1/rt4/zebra.conf6
-rw-r--r--tests/topotests/ospf_sr_topo1/rt5/ospfd.conf10
-rw-r--r--tests/topotests/ospf_sr_topo1/rt5/zebra.conf6
-rw-r--r--tests/topotests/ospf_sr_topo1/rt6/ospfd.conf10
-rw-r--r--tests/topotests/ospf_sr_topo1/rt6/zebra.conf6
-rw-r--r--tests/topotests/ospf_tilfa_topo1/rt1/ospfd.conf4
-rw-r--r--tests/topotests/ospf_tilfa_topo1/rt2/ospfd.conf4
-rw-r--r--tests/topotests/ospf_tilfa_topo1/rt3/ospfd.conf4
-rw-r--r--tests/topotests/ospf_tilfa_topo1/rt4/ospfd.conf4
-rw-r--r--tests/topotests/ospf_tilfa_topo1/rt5/ospfd.conf4
-rw-r--r--tests/topotests/ospf_topo1/test_ospf_topo1.py34
-rw-r--r--tests/topotests/ospf_topo1_vrf/r1/zebra.conf8
-rw-r--r--tests/topotests/ospfv3_basic_functionality/ospfv3_nssa.json86
-rw-r--r--tests/topotests/ospfv3_basic_functionality/test_ospfv3_nssa.py162
-rw-r--r--tests/topotests/pbr_topo1/r1/pbrd.conf8
-rw-r--r--tests/topotests/pim_acl/r1/ospf_neighbor.json10
-rw-r--r--tests/topotests/pim_acl/r1/ospfd.conf2
-rw-r--r--tests/topotests/pim_acl/r1/pimd.conf14
-rw-r--r--tests/topotests/pim_acl/r11/ospfd.conf2
-rw-r--r--tests/topotests/pim_acl/r11/pimd.conf10
-rw-r--r--tests/topotests/pim_acl/r12/ospfd.conf2
-rw-r--r--tests/topotests/pim_acl/r12/pimd.conf10
-rw-r--r--tests/topotests/pim_acl/r13/ospfd.conf2
-rw-r--r--tests/topotests/pim_acl/r13/pimd.conf10
-rw-r--r--tests/topotests/pim_acl/r14/ospfd.conf2
-rw-r--r--tests/topotests/pim_acl/r14/pimd.conf10
-rw-r--r--tests/topotests/pim_acl/r15/ospfd.conf2
-rw-r--r--tests/topotests/pim_acl/r15/pimd.conf10
-rwxr-xr-xtests/topotests/pim_basic/mcast-rx.py2
-rwxr-xr-xtests/topotests/pim_basic/mcast-tx.py2
-rw-r--r--tests/topotests/pim_basic/test_pim.py6
-rw-r--r--tests/topotests/pim_igmp_vrf/r1/ospf_blue_neighbor.json2
-rw-r--r--tests/topotests/pim_igmp_vrf/r1/ospf_red_neighbor.json2
-rw-r--r--tests/topotests/pim_igmp_vrf/r1/ospfd.conf2
-rw-r--r--tests/topotests/pim_igmp_vrf/r1/pimd.conf14
-rw-r--r--tests/topotests/pim_igmp_vrf/r11/ospfd.conf2
-rw-r--r--tests/topotests/pim_igmp_vrf/r11/pimd.conf10
-rw-r--r--tests/topotests/pim_igmp_vrf/r12/ospfd.conf2
-rw-r--r--tests/topotests/pim_igmp_vrf/r12/pimd.conf10
-rw-r--r--tests/topotests/pytest.ini1
-rw-r--r--tests/topotests/rip_topo1/test_rip_topo1.py17
-rw-r--r--tests/topotests/ripng_topo1/r1/ripng_status.ref2
-rw-r--r--tests/topotests/ripng_topo1/r1/ripngd.conf8
-rw-r--r--tests/topotests/ripng_topo1/r2/ripng_status.ref2
-rw-r--r--tests/topotests/ripng_topo1/r2/ripngd.conf8
-rw-r--r--tests/topotests/ripng_topo1/r3/ripng_status.ref2
-rw-r--r--tests/topotests/ripng_topo1/r3/ripngd.conf8
-rw-r--r--tests/topotests/ripng_topo1/test_ripng_topo1.py17
-rw-r--r--tests/topotests/simple_snmp_test/r1/isisd.conf4
-rw-r--r--tests/topotests/srv6_locator/r1/zebra.conf4
-rw-r--r--tests/topotests/zebra_seg6_route/r1/routes.json2
-rw-r--r--tests/topotests/zebra_seg6_route/r1/zebra.conf6
-rwxr-xr-xtests/topotests/zebra_seg6_route/test_zebra_seg6_route.py26
-rw-r--r--tests/topotests/zebra_seg6local_route/r1/zebra.conf6
-rwxr-xr-xtests/topotests/zebra_seg6local_route/test_zebra_seg6local_route.py20
-rw-r--r--tests/zebra/subdir.am17
601 files changed, 19111 insertions, 9458 deletions
diff --git a/tests/.gitignore b/tests/.gitignore
index 498d7dd0b7..53dbd68c9a 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -28,6 +28,7 @@
/lib/test_frrscript
/lib/test_frrlua
/lib/test_graph
+/lib/test_grpc
/lib/test_heavy
/lib/test_heavy_thread
/lib/test_heavy_wq
@@ -40,10 +41,12 @@
/lib/test_prefix2str
/lib/test_printfrr
/lib/test_privs
+/lib/test_resolver
/lib/test_ringbuf
/lib/test_segv
/lib/test_seqlock
/lib/test_sig
+/lib/test_skiplist
/lib/test_srcdest_table
/lib/test_stream
/lib/test_table
diff --git a/tests/bgpd/subdir.am b/tests/bgpd/subdir.am
new file mode 100644
index 0000000000..5148e7e440
--- /dev/null
+++ b/tests/bgpd/subdir.am
@@ -0,0 +1,82 @@
+if !BGPD
+PYTEST_IGNORE += --ignore=bgpd/
+endif
+BGP_TEST_LDADD = bgpd/libbgp.a $(RFPLDADD) $(ALL_TESTS_LDADD) $(LIBYANG_LIBS) $(UST_LIBS) -lm
+
+
+if BGPD
+check_PROGRAMS += tests/bgpd/test_aspath
+endif
+tests_bgpd_test_aspath_CFLAGS = $(TESTS_CFLAGS)
+tests_bgpd_test_aspath_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_bgpd_test_aspath_LDADD = $(BGP_TEST_LDADD)
+tests_bgpd_test_aspath_SOURCES = tests/bgpd/test_aspath.c
+EXTRA_DIST += tests/bgpd/test_aspath.py
+
+
+if BGPD
+check_PROGRAMS += tests/bgpd/test_bgp_table
+endif
+tests_bgpd_test_bgp_table_CFLAGS = $(TESTS_CFLAGS)
+tests_bgpd_test_bgp_table_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_bgpd_test_bgp_table_LDADD = $(BGP_TEST_LDADD)
+tests_bgpd_test_bgp_table_SOURCES = tests/bgpd/test_bgp_table.c
+
+
+if BGPD
+check_PROGRAMS += tests/bgpd/test_capability
+endif
+tests_bgpd_test_capability_CFLAGS = $(TESTS_CFLAGS)
+tests_bgpd_test_capability_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_bgpd_test_capability_LDADD = $(BGP_TEST_LDADD)
+tests_bgpd_test_capability_SOURCES = tests/bgpd/test_capability.c
+EXTRA_DIST += tests/bgpd/test_capability.py
+
+
+if BGPD
+check_PROGRAMS += tests/bgpd/test_ecommunity
+endif
+tests_bgpd_test_ecommunity_CFLAGS = $(TESTS_CFLAGS)
+tests_bgpd_test_ecommunity_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_bgpd_test_ecommunity_LDADD = $(BGP_TEST_LDADD)
+tests_bgpd_test_ecommunity_SOURCES = tests/bgpd/test_ecommunity.c
+EXTRA_DIST += tests/bgpd/test_ecommunity.py
+
+
+if BGPD
+check_PROGRAMS += tests/bgpd/test_mp_attr
+endif
+tests_bgpd_test_mp_attr_CFLAGS = $(TESTS_CFLAGS)
+tests_bgpd_test_mp_attr_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_bgpd_test_mp_attr_LDADD = $(BGP_TEST_LDADD)
+tests_bgpd_test_mp_attr_SOURCES = tests/bgpd/test_mp_attr.c
+EXTRA_DIST += tests/bgpd/test_mp_attr.py
+
+
+if BGPD
+check_PROGRAMS += tests/bgpd/test_mpath
+endif
+tests_bgpd_test_mpath_CFLAGS = $(TESTS_CFLAGS)
+tests_bgpd_test_mpath_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_bgpd_test_mpath_LDADD = $(BGP_TEST_LDADD)
+tests_bgpd_test_mpath_SOURCES = tests/bgpd/test_mpath.c
+EXTRA_DIST += tests/bgpd/test_mpath.py
+
+
+if BGPD
+check_PROGRAMS += tests/bgpd/test_packet
+endif
+tests_bgpd_test_packet_CFLAGS = $(TESTS_CFLAGS)
+tests_bgpd_test_packet_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_bgpd_test_packet_LDADD = $(BGP_TEST_LDADD)
+tests_bgpd_test_packet_SOURCES = tests/bgpd/test_packet.c
+
+
+if BGPD
+check_PROGRAMS += tests/bgpd/test_peer_attr
+endif
+tests_bgpd_test_peer_attr_CFLAGS = $(TESTS_CFLAGS)
+tests_bgpd_test_peer_attr_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_bgpd_test_peer_attr_LDADD = $(BGP_TEST_LDADD)
+tests_bgpd_test_peer_attr_SOURCES = tests/bgpd/test_peer_attr.c
+EXTRA_DIST += tests/bgpd/test_peer_attr.py
diff --git a/tests/bgpd/test_mpath.c b/tests/bgpd/test_mpath.c
index 77fd876594..b93cbd8e5a 100644
--- a/tests/bgpd/test_mpath.c
+++ b/tests/bgpd/test_mpath.c
@@ -330,7 +330,7 @@ static int run_bgp_path_info_mpath_update(testcase_t *t)
bgp_mp_list_add(&mp_list, &test_mp_list_info[1]);
new_best = &test_mp_list_info[3];
old_best = NULL;
- bgp_path_info_mpath_update(&test_rn, new_best, old_best, &mp_list,
+ bgp_path_info_mpath_update(NULL, &test_rn, new_best, old_best, &mp_list,
&mp_cfg);
bgp_mp_list_clear(&mp_list);
EXPECT_TRUE(bgp_path_info_mpath_count(new_best) == 2, test_result);
@@ -345,7 +345,7 @@ static int run_bgp_path_info_mpath_update(testcase_t *t)
bgp_mp_list_add(&mp_list, &test_mp_list_info[1]);
new_best = &test_mp_list_info[0];
old_best = &test_mp_list_info[3];
- bgp_path_info_mpath_update(&test_rn, new_best, old_best, &mp_list,
+ bgp_path_info_mpath_update(NULL, &test_rn, new_best, old_best, &mp_list,
&mp_cfg);
bgp_mp_list_clear(&mp_list);
EXPECT_TRUE(bgp_path_info_mpath_count(new_best) == 1, test_result);
@@ -392,7 +392,7 @@ static int global_test_init(void)
{
qobj_init();
master = thread_master_create(NULL);
- zclient = zclient_new(master, &zclient_options_default);
+ zclient = zclient_new(master, &zclient_options_default, NULL, 0);
bgp_master_init(master, BGP_SOCKET_SNDBUF_SIZE, list_new());
vrf_init(NULL, NULL, NULL, NULL, NULL);
bgp_option_set(BGP_OPT_NO_LISTEN);
diff --git a/tests/isisd/subdir.am b/tests/isisd/subdir.am
new file mode 100644
index 0000000000..2f9ce81f16
--- /dev/null
+++ b/tests/isisd/subdir.am
@@ -0,0 +1,66 @@
+if !ISISD
+PYTEST_IGNORE += --ignore=isisd/
+endif
+ISISD_TEST_LDADD = isisd/libisis.a $(ALL_TESTS_LDADD)
+noinst_HEADERS += \
+ tests/isisd/test_common.h \
+ # end
+
+
+if ISISD
+check_PROGRAMS += tests/isisd/test_fuzz_isis_tlv
+endif
+tests_isisd_test_fuzz_isis_tlv_CFLAGS = $(TESTS_CFLAGS) -I$(top_builddir)/tests/isisd
+tests_isisd_test_fuzz_isis_tlv_CPPFLAGS = $(TESTS_CPPFLAGS) -I$(top_builddir)/tests/isisd
+tests_isisd_test_fuzz_isis_tlv_LDADD = $(ISISD_TEST_LDADD)
+tests_isisd_test_fuzz_isis_tlv_SOURCES = tests/isisd/test_fuzz_isis_tlv.c tests/isisd/test_common.c
+nodist_tests_isisd_test_fuzz_isis_tlv_SOURCES = tests/isisd/test_fuzz_isis_tlv_tests.h
+EXTRA_DIST += \
+ tests/isisd/test_fuzz_isis_tlv.py \
+ tests/isisd/test_fuzz_isis_tlv_tests.h.gz \
+ # end
+
+tests/isisd/test_fuzz_isis_tlv_tests.h: $(top_srcdir)/tests/isisd/test_fuzz_isis_tlv_tests.h.gz
+ @mkdir -p tests/isisd
+ $(AM_V_GEN)gzip -d < $(top_srcdir)/tests/isisd/test_fuzz_isis_tlv_tests.h.gz > "$@"
+CLEANFILES += tests/isisd/test_fuzz_isis_tlv_tests.h
+
+tests/isisd/tests_isisd_test_fuzz_isis_tlv-test_fuzz_isis_tlv.$(OBJEXT): \
+ tests/isisd/test_fuzz_isis_tlv_tests.h
+tests/isisd/test_fuzz_isis_tlv-test_fuzz_isis_tlv.$(OBJEXT): \
+ tests/isisd/test_fuzz_isis_tlv_tests.h
+
+
+if ISISD
+check_PROGRAMS += tests/isisd/test_isis_lspdb
+endif
+tests_isisd_test_isis_lspdb_CFLAGS = $(TESTS_CFLAGS)
+tests_isisd_test_isis_lspdb_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_isisd_test_isis_lspdb_LDADD = $(ISISD_TEST_LDADD)
+tests_isisd_test_isis_lspdb_SOURCES = tests/isisd/test_isis_lspdb.c tests/isisd/test_common.c
+EXTRA_DIST += tests/isisd/test_isis_lspdb.py
+
+
+if ISISD
+check_PROGRAMS += tests/isisd/test_isis_spf
+endif
+tests_isisd_test_isis_spf_CFLAGS = $(TESTS_CFLAGS)
+tests_isisd_test_isis_spf_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_isisd_test_isis_spf_LDADD = $(ISISD_TEST_LDADD)
+tests_isisd_test_isis_spf_SOURCES = tests/isisd/test_isis_spf.c tests/isisd/test_common.c tests/isisd/test_topologies.c
+nodist_tests_isisd_test_isis_spf_SOURCES = yang/frr-isisd.yang.c
+EXTRA_DIST += \
+ tests/isisd/test_isis_spf.py \
+ tests/isisd/test_isis_spf.in \
+ tests/isisd/test_isis_spf.refout \
+ # end
+
+
+if ISISD
+check_PROGRAMS += tests/isisd/test_isis_vertex_queue
+endif
+tests_isisd_test_isis_vertex_queue_CFLAGS = $(TESTS_CFLAGS)
+tests_isisd_test_isis_vertex_queue_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_isisd_test_isis_vertex_queue_LDADD = $(ISISD_TEST_LDADD)
+tests_isisd_test_isis_vertex_queue_SOURCES = tests/isisd/test_isis_vertex_queue.c tests/isisd/test_common.c
+EXTRA_DIST += tests/isisd/test_isis_vertex_queue.py
diff --git a/tests/isisd/test_fuzz_isis_tlv_tests.h.gz b/tests/isisd/test_fuzz_isis_tlv_tests.h.gz
index 4f59d1d7c0..b50c5683bf 100644
--- a/tests/isisd/test_fuzz_isis_tlv_tests.h.gz
+++ b/tests/isisd/test_fuzz_isis_tlv_tests.h.gz
Binary files differ
diff --git a/tests/lib/cli/common_cli.c b/tests/lib/cli/common_cli.c
index 8be81cc4cb..7c9febe2ca 100644
--- a/tests/lib/cli/common_cli.c
+++ b/tests/lib/cli/common_cli.c
@@ -60,6 +60,7 @@ static void vty_do_exit(int isexit)
}
const struct frr_yang_module_info *const *test_yang_modules = NULL;
+int test_log_prio = ZLOG_DISABLED;
/* main routine. */
int main(int argc, char **argv)
@@ -73,7 +74,7 @@ int main(int argc, char **argv)
/* master init. */
master = thread_master_create(NULL);
- zlog_aux_init("NONE: ", ZLOG_DISABLED);
+ zlog_aux_init("NONE: ", test_log_prio);
/* Library inits. */
cmd_init(1);
diff --git a/tests/lib/cli/common_cli.h b/tests/lib/cli/common_cli.h
index 3042ff5b12..6660b27ef7 100644
--- a/tests/lib/cli/common_cli.h
+++ b/tests/lib/cli/common_cli.h
@@ -37,6 +37,8 @@ extern void test_init(int argc, char **argv);
*/
extern struct thread_master *master;
+extern int test_log_prio;
+
extern int dump_args(struct vty *vty, const char *descr, int argc,
struct cmd_token *argv[]);
diff --git a/tests/lib/cli/test_commands.refout b/tests/lib/cli/test_commands.refout
index 9d4a6ef03e..2ec3e5504b 100644
--- a/tests/lib/cli/test_commands.refout
+++ b/tests/lib/cli/test_commands.refout
@@ -191,38 +191,38 @@ execute strict 'no ipv6 nd mtu 1'@11: rv==0, 'no ipv6 nd mtu <1-65535>': '1'
complete 'no ipv6 nd mtu 1'@11: rv==2
describe 'no ipv6 nd mtu 1'@11: rv==0
'<1-65535>' 'MTU in bytes'
-execute relaxed 'no neighbor 1.2.3.4 distribute-list 1 in'@17: rv==0, 'no neighbor (A.B.C.D|X:X::X:X|WORD) distribute-list (<1-199>|<1300-2699>|WORD) (in|out)': '1.2.3.4', '1', 'in'
-execute strict 'no neighbor 1.2.3.4 distribute-list 1 in'@17: rv==0, 'no neighbor (A.B.C.D|X:X::X:X|WORD) distribute-list (<1-199>|<1300-2699>|WORD) (in|out)': '1.2.3.4', '1', 'in'
+execute relaxed 'no neighbor 1.2.3.4 distribute-list 1 in'@17: rv==0, 'no neighbor (A.B.C.D|X:X::X:X|WORD) distribute-list WORD (in|out)': '1.2.3.4', '1', 'in'
+execute strict 'no neighbor 1.2.3.4 distribute-list 1 in'@17: rv==0, 'no neighbor (A.B.C.D|X:X::X:X|WORD) distribute-list WORD (in|out)': '1.2.3.4', '1', 'in'
complete 'no neighbor 1.2.3.4 distribute-list 1 in'@17: rv==7
'in'
describe 'no neighbor 1.2.3.4 distribute-list 1 in'@17: rv==0
'in' 'Filter incoming updates'
-execute relaxed 'no neighbor 1.2.3.4 distribute-list 1 in'@18: rv==0, 'no neighbor (A.B.C.D|X:X::X:X|WORD) distribute-list (<1-199>|<1300-2699>|WORD) (in|out)': '1.2.3.4', '1', 'in'
-execute strict 'no neighbor 1.2.3.4 distribute-list 1 in'@18: rv==0, 'no neighbor (A.B.C.D|X:X::X:X|WORD) distribute-list (<1-199>|<1300-2699>|WORD) (in|out)': '1.2.3.4', '1', 'in'
+execute relaxed 'no neighbor 1.2.3.4 distribute-list 1 in'@18: rv==0, 'no neighbor (A.B.C.D|X:X::X:X|WORD) distribute-list WORD (in|out)': '1.2.3.4', '1', 'in'
+execute strict 'no neighbor 1.2.3.4 distribute-list 1 in'@18: rv==0, 'no neighbor (A.B.C.D|X:X::X:X|WORD) distribute-list WORD (in|out)': '1.2.3.4', '1', 'in'
complete 'no neighbor 1.2.3.4 distribute-list 1 in'@18: rv==7
'in'
describe 'no neighbor 1.2.3.4 distribute-list 1 in'@18: rv==0
'in' 'Filter incoming updates'
-execute relaxed 'no neighbor 1.2.3.4 distribute-list 1 in'@19: rv==0, 'no neighbor (A.B.C.D|X:X::X:X|WORD) distribute-list (<1-199>|<1300-2699>|WORD) (in|out)': '1.2.3.4', '1', 'in'
-execute strict 'no neighbor 1.2.3.4 distribute-list 1 in'@19: rv==0, 'no neighbor (A.B.C.D|X:X::X:X|WORD) distribute-list (<1-199>|<1300-2699>|WORD) (in|out)': '1.2.3.4', '1', 'in'
+execute relaxed 'no neighbor 1.2.3.4 distribute-list 1 in'@19: rv==0, 'no neighbor (A.B.C.D|X:X::X:X|WORD) distribute-list WORD (in|out)': '1.2.3.4', '1', 'in'
+execute strict 'no neighbor 1.2.3.4 distribute-list 1 in'@19: rv==0, 'no neighbor (A.B.C.D|X:X::X:X|WORD) distribute-list WORD (in|out)': '1.2.3.4', '1', 'in'
complete 'no neighbor 1.2.3.4 distribute-list 1 in'@19: rv==7
'in'
describe 'no neighbor 1.2.3.4 distribute-list 1 in'@19: rv==0
'in' 'Filter incoming updates'
-execute relaxed 'no neighbor 1.2.3.4 distribute-list 1 in'@20: rv==0, 'no neighbor (A.B.C.D|X:X::X:X|WORD) distribute-list (<1-199>|<1300-2699>|WORD) (in|out)': '1.2.3.4', '1', 'in'
-execute strict 'no neighbor 1.2.3.4 distribute-list 1 in'@20: rv==0, 'no neighbor (A.B.C.D|X:X::X:X|WORD) distribute-list (<1-199>|<1300-2699>|WORD) (in|out)': '1.2.3.4', '1', 'in'
+execute relaxed 'no neighbor 1.2.3.4 distribute-list 1 in'@20: rv==0, 'no neighbor (A.B.C.D|X:X::X:X|WORD) distribute-list WORD (in|out)': '1.2.3.4', '1', 'in'
+execute strict 'no neighbor 1.2.3.4 distribute-list 1 in'@20: rv==0, 'no neighbor (A.B.C.D|X:X::X:X|WORD) distribute-list WORD (in|out)': '1.2.3.4', '1', 'in'
complete 'no neighbor 1.2.3.4 distribute-list 1 in'@20: rv==7
'in'
describe 'no neighbor 1.2.3.4 distribute-list 1 in'@20: rv==0
'in' 'Filter incoming updates'
-execute relaxed 'no neighbor 1.2.3.4 distribute-list 1 in'@21: rv==0, 'no neighbor (A.B.C.D|X:X::X:X|WORD) distribute-list (<1-199>|<1300-2699>|WORD) (in|out)': '1.2.3.4', '1', 'in'
-execute strict 'no neighbor 1.2.3.4 distribute-list 1 in'@21: rv==0, 'no neighbor (A.B.C.D|X:X::X:X|WORD) distribute-list (<1-199>|<1300-2699>|WORD) (in|out)': '1.2.3.4', '1', 'in'
+execute relaxed 'no neighbor 1.2.3.4 distribute-list 1 in'@21: rv==0, 'no neighbor (A.B.C.D|X:X::X:X|WORD) distribute-list WORD (in|out)': '1.2.3.4', '1', 'in'
+execute strict 'no neighbor 1.2.3.4 distribute-list 1 in'@21: rv==0, 'no neighbor (A.B.C.D|X:X::X:X|WORD) distribute-list WORD (in|out)': '1.2.3.4', '1', 'in'
complete 'no neighbor 1.2.3.4 distribute-list 1 in'@21: rv==7
'in'
describe 'no neighbor 1.2.3.4 distribute-list 1 in'@21: rv==0
'in' 'Filter incoming updates'
-execute relaxed 'no neighbor 1.2.3.4 distribute-list 1 in'@22: rv==0, 'no neighbor (A.B.C.D|X:X::X:X|WORD) distribute-list (<1-199>|<1300-2699>|WORD) (in|out)': '1.2.3.4', '1', 'in'
-execute strict 'no neighbor 1.2.3.4 distribute-list 1 in'@22: rv==0, 'no neighbor (A.B.C.D|X:X::X:X|WORD) distribute-list (<1-199>|<1300-2699>|WORD) (in|out)': '1.2.3.4', '1', 'in'
+execute relaxed 'no neighbor 1.2.3.4 distribute-list 1 in'@22: rv==0, 'no neighbor (A.B.C.D|X:X::X:X|WORD) distribute-list WORD (in|out)': '1.2.3.4', '1', 'in'
+execute strict 'no neighbor 1.2.3.4 distribute-list 1 in'@22: rv==0, 'no neighbor (A.B.C.D|X:X::X:X|WORD) distribute-list WORD (in|out)': '1.2.3.4', '1', 'in'
complete 'no neighbor 1.2.3.4 distribute-list 1 in'@22: rv==7
'in'
describe 'no neighbor 1.2.3.4 distribute-list 1 in'@22: rv==0
diff --git a/tests/lib/subdir.am b/tests/lib/subdir.am
new file mode 100644
index 0000000000..00fe93278b
--- /dev/null
+++ b/tests/lib/subdir.am
@@ -0,0 +1,364 @@
+##############################################################################
+if SCRIPTING
+check_PROGRAMS += tests/lib/test_frrlua
+endif
+tests_lib_test_frrlua_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_frrlua_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_frrlua_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_frrlua_SOURCES = tests/lib/test_frrlua.c
+EXTRA_DIST += tests/lib/test_frrlua.py
+
+if SCRIPTING
+check_PROGRAMS += tests/lib/test_frrscript
+endif
+tests_lib_test_frrscript_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_frrscript_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_frrscript_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_frrscript_SOURCES = tests/lib/test_frrscript.c
+EXTRA_DIST += tests/lib/test_frrscript.py
+
+
+##############################################################################
+GRPC_TESTS_LDADD = staticd/libstatic.a grpc/libfrrgrpc_pb.la -lgrpc++ -lprotobuf $(ALL_TESTS_LDADD) $(LIBYANG_LIBS) -lm
+
+if GRPC
+check_PROGRAMS += tests/lib/test_grpc
+endif
+tests_lib_test_grpc_CXXFLAGS = $(WERROR) $(TESTS_CXXFLAGS)
+tests_lib_test_grpc_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_grpc_LDADD = $(GRPC_TESTS_LDADD)
+tests_lib_test_grpc_SOURCES = tests/lib/test_grpc.cpp
+
+
+##############################################################################
+if ZEROMQ
+check_PROGRAMS += tests/lib/test_zmq
+endif
+tests_lib_test_zmq_CFLAGS = $(TESTS_CFLAGS) $(ZEROMQ_CFLAGS)
+tests_lib_test_zmq_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_zmq_LDADD = lib/libfrrzmq.la $(ALL_TESTS_LDADD) $(ZEROMQ_LIBS)
+tests_lib_test_zmq_SOURCES = tests/lib/test_zmq.c
+
+
+##############################################################################
+if CARES
+check_PROGRAMS += tests/lib/test_resolver
+endif
+tests_lib_test_resolver_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_resolver_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_resolver_LDADD = $(ALL_TESTS_LDADD) lib/libfrrcares.la
+tests_lib_test_resolver_SOURCES = tests/lib/test_resolver.c tests/lib/cli/common_cli.c
+
+
+##############################################################################
+noinst_HEADERS += \
+ tests/helpers/c/prng.h \
+ tests/helpers/c/tests.h \
+ tests/lib/cli/common_cli.h \
+ # end
+
+
+check_PROGRAMS += tests/lib/cxxcompat
+tests_lib_cxxcompat_CFLAGS = $(TESTS_CFLAGS) $(CXX_COMPAT_CFLAGS) $(WERROR)
+tests_lib_cxxcompat_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_cxxcompat_SOURCES = tests/lib/cxxcompat.c
+tests_lib_cxxcompat_LDADD = $(ALL_TESTS_LDADD)
+
+
+check_PROGRAMS += tests/lib/cli/test_cli
+tests_lib_cli_test_cli_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_cli_test_cli_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_cli_test_cli_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_cli_test_cli_SOURCES = tests/lib/cli/test_cli.c tests/lib/cli/common_cli.c
+clippy_scan += tests/lib/cli/test_cli.c
+EXTRA_DIST += \
+ tests/lib/cli/test_cli.in \
+ tests/lib/cli/test_cli.py \
+ tests/lib/cli/test_cli.refout \
+ # end
+
+
+check_PROGRAMS += tests/lib/cli/test_commands
+tests_lib_cli_test_commands_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_cli_test_commands_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_cli_test_commands_LDADD = $(ALL_TESTS_LDADD)
+nodist_tests_lib_cli_test_commands_SOURCES = tests/lib/cli/test_commands_defun.c
+tests_lib_cli_test_commands_SOURCES = tests/lib/cli/test_commands.c tests/helpers/c/prng.c
+tests/lib/cli/test_commands_defun.c: vtysh/vtysh_cmd.c
+ @mkdir -p tests/lib/cli
+ $(AM_V_GEN)sed \
+ -e 's%"vtysh/vtysh\.h"%"tests/helpers/c/tests.h"%' \
+ -e 's/vtysh_init_cmd/test_init_cmd/' \
+ -e 's/VTYSH_[A-Z][A-Z_0-9]*/0/g' \
+ < vtysh/vtysh_cmd.c \
+ > "$@"
+CLEANFILES += tests/lib/cli/test_commands_defun.c
+EXTRA_DIST += \
+ tests/lib/cli/test_commands.in \
+ tests/lib/cli/test_commands.py \
+ tests/lib/cli/test_commands.refout \
+ # end
+
+
+check_PROGRAMS += tests/lib/northbound/test_oper_data
+tests_lib_northbound_test_oper_data_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_northbound_test_oper_data_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_northbound_test_oper_data_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_northbound_test_oper_data_SOURCES = tests/lib/northbound/test_oper_data.c
+nodist_tests_lib_northbound_test_oper_data_SOURCES = yang/frr-test-module.yang.c
+EXTRA_DIST += \
+ tests/lib/northbound/test_oper_data.in \
+ tests/lib/northbound/test_oper_data.py \
+ tests/lib/northbound/test_oper_data.refout \
+ # end
+
+
+check_PROGRAMS += tests/lib/test_assert
+tests_lib_test_assert_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_assert_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_assert_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_assert_SOURCES = tests/lib/test_assert.c
+EXTRA_DIST += tests/lib/test_assert.py
+
+
+check_PROGRAMS += tests/lib/test_atomlist
+tests_lib_test_atomlist_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_atomlist_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_atomlist_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_atomlist_SOURCES = tests/lib/test_atomlist.c
+EXTRA_DIST += tests/lib/test_atomlist.py
+
+
+check_PROGRAMS += tests/lib/test_buffer
+tests_lib_test_buffer_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_buffer_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_buffer_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_buffer_SOURCES = tests/lib/test_buffer.c
+
+
+check_PROGRAMS += tests/lib/test_checksum
+tests_lib_test_checksum_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_checksum_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_checksum_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_checksum_SOURCES = tests/lib/test_checksum.c
+
+
+check_PROGRAMS += tests/lib/test_graph
+tests_lib_test_graph_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_graph_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_graph_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_graph_SOURCES = tests/lib/test_graph.c
+EXTRA_DIST += \
+ tests/lib/test_graph.py \
+ tests/lib/test_graph.refout \
+ # end
+
+
+check_PROGRAMS += tests/lib/test_heavy
+tests_lib_test_heavy_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_heavy_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_heavy_LDADD = $(ALL_TESTS_LDADD) -lm
+tests_lib_test_heavy_SOURCES = tests/lib/test_heavy.c tests/helpers/c/main.c
+
+
+check_PROGRAMS += tests/lib/test_heavy_thread
+tests_lib_test_heavy_thread_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_heavy_thread_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_heavy_thread_LDADD = $(ALL_TESTS_LDADD) -lm
+tests_lib_test_heavy_thread_SOURCES = tests/lib/test_heavy_thread.c tests/helpers/c/main.c
+
+
+check_PROGRAMS += tests/lib/test_heavy_wq
+tests_lib_test_heavy_wq_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_heavy_wq_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_heavy_wq_LDADD = $(ALL_TESTS_LDADD) -lm
+tests_lib_test_heavy_wq_SOURCES = tests/lib/test_heavy_wq.c tests/helpers/c/main.c
+
+
+check_PROGRAMS += tests/lib/test_idalloc
+tests_lib_test_idalloc_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_idalloc_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_idalloc_SOURCES = tests/lib/test_idalloc.c
+
+
+check_PROGRAMS += tests/lib/test_memory
+tests_lib_test_memory_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_memory_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_memory_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_memory_SOURCES = tests/lib/test_memory.c
+
+
+check_PROGRAMS += tests/lib/test_nexthop_iter
+tests_lib_test_nexthop_iter_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_nexthop_iter_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_nexthop_iter_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_nexthop_iter_SOURCES = tests/lib/test_nexthop_iter.c tests/helpers/c/prng.c
+EXTRA_DIST += tests/lib/test_nexthop_iter.py
+
+
+check_PROGRAMS += tests/lib/test_nexthop
+tests_lib_test_nexthop_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_nexthop_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_nexthop_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_nexthop_SOURCES = tests/lib/test_nexthop.c
+EXTRA_DIST += tests/lib/test_nexthop.py
+
+
+check_PROGRAMS += tests/lib/test_ntop
+tests_lib_test_ntop_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_ntop_CPPFLAGS = $(CPPFLAGS_BASE) # no assert override
+tests_lib_test_ntop_LDADD = # none
+tests_lib_test_ntop_SOURCES = tests/lib/test_ntop.c tests/helpers/c/prng.c
+EXTRA_DIST += tests/lib/test_ntop.py
+
+
+check_PROGRAMS += tests/lib/test_plist
+tests_lib_test_plist_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_plist_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_plist_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_plist_SOURCES = tests/lib/test_plist.c tests/lib/cli/common_cli.c
+
+
+check_PROGRAMS += tests/lib/test_prefix2str
+tests_lib_test_prefix2str_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_prefix2str_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_prefix2str_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_prefix2str_SOURCES = tests/lib/test_prefix2str.c tests/helpers/c/prng.c
+EXTRA_DIST += tests/lib/test_prefix2str.py
+
+
+check_PROGRAMS += tests/lib/test_printfrr
+tests_lib_test_printfrr_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_printfrr_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_printfrr_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_printfrr_SOURCES = tests/lib/test_printfrr.c
+EXTRA_DIST += tests/lib/test_printfrr.py
+
+
+check_PROGRAMS += tests/lib/test_privs
+tests_lib_test_privs_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_privs_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_privs_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_privs_SOURCES = tests/lib/test_privs.c
+
+
+check_PROGRAMS += tests/lib/test_ringbuf
+tests_lib_test_ringbuf_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_ringbuf_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_ringbuf_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_ringbuf_SOURCES = tests/lib/test_ringbuf.c
+EXTRA_DIST += tests/lib/test_ringbuf.py
+
+
+check_PROGRAMS += tests/lib/test_segv
+tests_lib_test_segv_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_segv_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_segv_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_segv_SOURCES = tests/lib/test_segv.c
+
+
+check_PROGRAMS += tests/lib/test_seqlock
+tests_lib_test_seqlock_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_seqlock_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_seqlock_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_seqlock_SOURCES = tests/lib/test_seqlock.c
+
+
+check_PROGRAMS += tests/lib/test_sig
+tests_lib_test_sig_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_sig_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_sig_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_sig_SOURCES = tests/lib/test_sig.c
+
+
+check_PROGRAMS += tests/lib/test_skiplist
+tests_lib_test_skiplist_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_skiplist_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_skiplist_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_skiplist_SOURCES = tests/lib/test_skiplist.c
+
+
+check_PROGRAMS += tests/lib/test_srcdest_table
+tests_lib_test_srcdest_table_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_srcdest_table_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_srcdest_table_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_srcdest_table_SOURCES = tests/lib/test_srcdest_table.c tests/helpers/c/prng.c
+EXTRA_DIST += tests/lib/test_srcdest_table.py
+
+
+check_PROGRAMS += tests/lib/test_stream
+tests_lib_test_stream_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_stream_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_stream_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_stream_SOURCES = tests/lib/test_stream.c
+EXTRA_DIST += \
+ tests/lib/test_stream.py \
+ tests/lib/test_stream.refout \
+ # end
+
+
+check_PROGRAMS += tests/lib/test_table
+tests_lib_test_table_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_table_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_table_LDADD = $(ALL_TESTS_LDADD) -lm
+tests_lib_test_table_SOURCES = tests/lib/test_table.c
+EXTRA_DIST += tests/lib/test_table.py
+
+
+check_PROGRAMS += tests/lib/test_timer_correctness
+tests_lib_test_timer_correctness_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_timer_correctness_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_timer_correctness_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_timer_correctness_SOURCES = tests/lib/test_timer_correctness.c tests/helpers/c/prng.c
+EXTRA_DIST += tests/lib/test_timer_correctness.py
+
+
+check_PROGRAMS += tests/lib/test_timer_performance
+tests_lib_test_timer_performance_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_timer_performance_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_timer_performance_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_timer_performance_SOURCES = tests/lib/test_timer_performance.c tests/helpers/c/prng.c
+
+
+check_PROGRAMS += tests/lib/test_ttable
+tests_lib_test_ttable_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_ttable_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_ttable_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_ttable_SOURCES = tests/lib/test_ttable.c
+EXTRA_DIST += \
+ tests/lib/test_ttable.py \
+ tests/lib/test_ttable.refout \
+ # end
+
+
+check_PROGRAMS += tests/lib/test_typelist
+tests_lib_test_typelist_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_typelist_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_typelist_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_typelist_SOURCES = tests/lib/test_typelist.c tests/helpers/c/prng.c
+noinst_HEADERS += tests/lib/test_typelist.h
+EXTRA_DIST += tests/lib/test_typelist.py
+
+
+check_PROGRAMS += tests/lib/test_versioncmp
+tests_lib_test_versioncmp_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_versioncmp_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_versioncmp_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_versioncmp_SOURCES = tests/lib/test_versioncmp.c
+EXTRA_DIST += tests/lib/test_versioncmp.py
+
+
+check_PROGRAMS += tests/lib/test_xref
+tests_lib_test_xref_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_xref_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_xref_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_xref_SOURCES = tests/lib/test_xref.c
+EXTRA_DIST += tests/lib/test_xref.py
+
+
+check_PROGRAMS += tests/lib/test_zlog
+tests_lib_test_zlog_CFLAGS = $(TESTS_CFLAGS)
+tests_lib_test_zlog_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_lib_test_zlog_LDADD = $(ALL_TESTS_LDADD)
+tests_lib_test_zlog_SOURCES = tests/lib/test_zlog.c
+EXTRA_DIST += tests/lib/test_zlog.py
diff --git a/tests/lib/test_printfrr.c b/tests/lib/test_printfrr.c
index 06996a2f13..8413b7b372 100644
--- a/tests/lib/test_printfrr.c
+++ b/tests/lib/test_printfrr.c
@@ -259,8 +259,8 @@ int main(int argc, char **argv)
*
* gateway addresses only for now: interfaces require more setup
*/
- printchk("(null)", "%pNHcg", NULL);
- printchk("(null)", "%pNHci", NULL);
+ printchk("(null)", "%pNHcg", (struct nexthop *)NULL);
+ printchk("(null)", "%pNHci", (struct nexthop *)NULL);
struct nexthop nh;
diff --git a/tests/lib/test_resolver.c b/tests/lib/test_resolver.c
new file mode 100644
index 0000000000..6a582cceaf
--- /dev/null
+++ b/tests/lib/test_resolver.c
@@ -0,0 +1,81 @@
+/*
+ * FRR c-ares integration test
+ * Copyright (C) 2021 David Lamparter for NetDEF, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* this test is not run automatically since tests MUST NOT rely on any outside
+ * state. DNS is most definitely "outside state". A testbed may not have any
+ * internet connectivity at all. It may not have working DNS. Or worst of
+ * all, whatever name we use to test may have a temporary failure entirely
+ * beyond our control.
+ *
+ * The only way this test could be run in a testbed is with an all-local DNS
+ * setup, which considering the resolver code is rarely touched is not worth
+ * the time at all. Instead, after touching the resolver code, manually run
+ * this test and throw some names at it.
+ */
+
+#include <zebra.h>
+
+#include "vty.h"
+#include "command.h"
+#include "resolver.h"
+#include "log.h"
+#include "sockunion.h"
+
+#include "tests/lib/cli/common_cli.h"
+
+extern struct thread_master *master;
+
+static void resolver_result(struct resolver_query *resq, const char *errstr,
+ int numaddrs, union sockunion *addr)
+{
+ int i;
+
+ if (numaddrs <= 0) {
+ zlog_warn("hostname resolution failed: %s", errstr);
+ return;
+ }
+
+ for (i = 0; i < numaddrs; i++)
+ zlog_info("resolver result: %pSU", &addr[i]);
+}
+
+struct resolver_query query;
+
+DEFUN (test_resolve,
+ test_resolve_cmd,
+ "resolve WORD",
+ "DNS resolver\n"
+ "Name to resolve\n")
+{
+ resolver_resolve(&query, AF_UNSPEC, 0, argv[1]->arg, resolver_result);
+ return CMD_SUCCESS;
+}
+
+__attribute__((_CONSTRUCTOR(2000)))
+static void test_setup(void)
+{
+ test_log_prio = LOG_DEBUG;
+}
+
+void test_init(int argc, char **argv)
+{
+ resolver_init(master);
+
+ install_element(VIEW_NODE, &test_resolve_cmd);
+}
diff --git a/tests/lib/test_segv.c b/tests/lib/test_segv.c
index 8133637adc..494a162a45 100644
--- a/tests/lib/test_segv.c
+++ b/tests/lib/test_segv.c
@@ -28,7 +28,7 @@
#include "lib/log.h"
#include "lib/memory.h"
-struct quagga_signal_t sigs[] = {};
+struct frr_signal_t sigs[] = {};
struct thread_master *master;
diff --git a/tests/lib/test_sig.c b/tests/lib/test_sig.c
index 2aceafb8f0..9165f1850f 100644
--- a/tests/lib/test_sig.c
+++ b/tests/lib/test_sig.c
@@ -36,18 +36,18 @@ static void sigusr2(void)
printf("processed usr2\n");
}
-struct quagga_signal_t sigs[] = {{
- .signal = SIGHUP,
- .handler = &sighup,
- },
- {
- .signal = SIGUSR1,
- .handler = &sigusr1,
- },
- {
- .signal = SIGUSR2,
- .handler = &sigusr2,
- }};
+struct frr_signal_t sigs[] = {{
+ .signal = SIGHUP,
+ .handler = &sighup,
+ },
+ {
+ .signal = SIGUSR1,
+ .handler = &sigusr1,
+ },
+ {
+ .signal = SIGUSR2,
+ .handler = &sigusr2,
+ }};
struct thread_master *master;
struct thread t;
diff --git a/tests/lib/test_timer_correctness.c b/tests/lib/test_timer_correctness.c
index 0ae9761b11..1756d87a6f 100644
--- a/tests/lib/test_timer_correctness.c
+++ b/tests/lib/test_timer_correctness.c
@@ -153,7 +153,6 @@ int main(int argc, char **argv)
XFREE(MTYPE_TMP, timers[index]->arg);
thread_cancel(&timers[index]);
- timers[index] = NULL;
timers_pending--;
}
diff --git a/tests/lib/test_timer_performance.c b/tests/lib/test_timer_performance.c
index 23c044c7c1..f9d634b6a6 100644
--- a/tests/lib/test_timer_performance.c
+++ b/tests/lib/test_timer_performance.c
@@ -77,7 +77,6 @@ int main(int argc, char **argv)
index = prng_rand(prng) % SCHEDULE_TIMERS;
thread_cancel(&timers[index]);
- timers[index] = NULL;
}
monotime(&tv_stop);
diff --git a/tests/lib/test_typelist.h b/tests/lib/test_typelist.h
index 379a2396b4..8261616ed2 100644
--- a/tests/lib/test_typelist.h
+++ b/tests/lib/test_typelist.h
@@ -39,6 +39,8 @@
#define list_find concat(TYPE, _find)
#define list_find_lt concat(TYPE, _find_lt)
#define list_find_gteq concat(TYPE, _find_gteq)
+#define list_member concat(TYPE, _member)
+#define list_anywhere concat(TYPE, _anywhere)
#define list_del concat(TYPE, _del)
#define list_pop concat(TYPE, _pop)
#define list_swap_all concat(TYPE, _swap_all)
@@ -239,6 +241,13 @@ static void concat(test_, TYPE)(void)
ts_hash_headx(
&head, "swap2b",
"a538546a6e6ab0484e925940aa8dd02fd934408bbaed8cb66a0721841584d838");
+
+ while (list_pop(&other))
+ ;
+ list_fini(&other);
+ prng_free(prng_swap);
+
+ ts_ref("swap-cleanup");
#endif /* !IS_ATOMIC */
k = 0;
@@ -294,7 +303,7 @@ static void concat(test_, TYPE)(void)
#elif IS_HEAP(REALTYPE)
/* heap - partially sorted. */
prev = NULL;
- l = k / 2;
+ l = k / 4;
for (i = 0; i < l; i++) {
item = list_pop(&head);
if (prev)
@@ -303,7 +312,24 @@ static void concat(test_, TYPE)(void)
k--;
prev = item;
}
- ts_hash("pop", NULL);
+ ts_hash("pop#1", NULL);
+
+ for (i = 0; i < NITEM; i++)
+ assertf(list_member(&head, &itm[i]) == itm[i].scratchpad,
+ "%zu should:%d is:%d", i, itm[i].scratchpad,
+ list_member(&head, &itm[i]));
+ ts_hash("member", NULL);
+
+ l = k / 2;
+ for (; i < l; i++) {
+ item = list_pop(&head);
+ if (prev)
+ assert(prev->val < item->val);
+ item->scratchpad = 0;
+ k--;
+ prev = item;
+ }
+ ts_hash("pop#2", NULL);
#else /* !IS_UNIQ(REALTYPE) && !IS_HEAP(REALTYPE) */
for (i = 0; i < NITEM; i++) {
@@ -380,6 +406,14 @@ static void concat(test_, TYPE)(void)
assert(l + list_count(&head) == k);
ts_hashx("del", "cb2e5d80f08a803ef7b56c15e981b681adcea214bebc2f55e12e0bfb242b07ca");
+#if !IS_ATOMIC(REALTYPE)
+ for (i = 0; i < NITEM; i++)
+ assertf(list_member(&head, &itm[i]) == itm[i].scratchpad,
+ "%zu should:%d is:%d", i, itm[i].scratchpad,
+ list_member(&head, &itm[i]));
+ ts_hashx("member", "cb2e5d80f08a803ef7b56c15e981b681adcea214bebc2f55e12e0bfb242b07ca");
+#endif
+
frr_each_safe(list, &head, item) {
assert(item->scratchpad != 0);
@@ -449,6 +483,13 @@ static void concat(test_, TYPE)(void)
ts_hash_head(
&head, "swap2b",
"eabfcf1413936daaf20965abced95762f45110a6619b84aac7d38481bce4ea19");
+
+ while (list_pop(&other))
+ ;
+ list_fini(&other);
+ prng_free(prng_swap);
+
+ ts_ref("swap-cleanup");
#endif
for (i = 0; i < NITEM / 2; i++) {
@@ -461,7 +502,39 @@ static void concat(test_, TYPE)(void)
}
ts_hash("del-prng", "86d568a95eb429dab3162976c5a5f3f75aabc835932cd682aa280b6923549564");
+#if !IS_ATOMIC(REALTYPE)
+ for (i = 0; i < NITEM; i++) {
+ assertf(list_member(&head, &itm[i]) == itm[i].scratchpad,
+ "%zu should:%d is:%d", i, itm[i].scratchpad,
+ list_member(&head, &itm[i]));
+ assertf(list_anywhere(&itm[i]) == itm[i].scratchpad,
+ "%zu should:%d is:%d", i, itm[i].scratchpad,
+ list_anywhere(&itm[i]));
+ }
+ ts_hash("member", "86d568a95eb429dab3162976c5a5f3f75aabc835932cd682aa280b6923549564");
+#endif
+
l = 0;
+ while (l < (k / 4) && (prev = list_pop(&head))) {
+ assert(prev->scratchpad != 0);
+
+ prev->scratchpad = 0;
+ l++;
+ }
+ ts_hash("pop#1", "42b8950c880535b2d2e0c980f9845f7841ecf675c0fb9801aec4170d2036349d");
+
+#if !IS_ATOMIC(REALTYPE)
+ for (i = 0; i < NITEM; i++) {
+ assertf(list_member(&head, &itm[i]) == itm[i].scratchpad,
+ "%zu should:%d is:%d", i, itm[i].scratchpad,
+ list_member(&head, &itm[i]));
+ assertf(list_anywhere(&itm[i]) == itm[i].scratchpad,
+ "%zu should:%d is:%d", i, itm[i].scratchpad,
+ list_anywhere(&itm[i]));
+ }
+ ts_hash("member", "42b8950c880535b2d2e0c980f9845f7841ecf675c0fb9801aec4170d2036349d");
+#endif
+
while ((item = list_pop(&head))) {
assert(item->scratchpad != 0);
@@ -471,7 +544,7 @@ static void concat(test_, TYPE)(void)
assert(l == k);
assert(list_count(&head) == 0);
assert(list_first(&head) == NULL);
- ts_hash("pop", "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119");
+ ts_hash("pop#2", "df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b81119");
prng_free(prng);
prng = prng_new(0x1e5a2d69);
@@ -650,6 +723,7 @@ static void concat(test_, TYPE)(void)
list_fini(&head);
ts_ref("fini");
ts_end();
+ prng_free(prng);
printfrr("%s end\n", str(TYPE));
}
@@ -680,6 +754,8 @@ static void concat(test_, TYPE)(void)
#undef list_find
#undef list_find_lt
#undef list_find_gteq
+#undef list_member
+#undef list_anywhere
#undef list_del
#undef list_pop
#undef list_swap_all
diff --git a/tests/lib/test_zmq.c b/tests/lib/test_zmq.c
index 65195aa3e1..c411de7252 100644
--- a/tests/lib/test_zmq.c
+++ b/tests/lib/test_zmq.c
@@ -266,7 +266,7 @@ static void sigchld(void)
frrzmq_thread_cancel(&cb, &cb->write);
}
-static struct quagga_signal_t sigs[] = {
+static struct frr_signal_t sigs[] = {
{
.signal = SIGCHLD,
.handler = sigchld,
diff --git a/tests/ospf6d/subdir.am b/tests/ospf6d/subdir.am
new file mode 100644
index 0000000000..ef1f40cf08
--- /dev/null
+++ b/tests/ospf6d/subdir.am
@@ -0,0 +1,19 @@
+if !OSPF6D
+PYTEST_IGNORE += --ignore=ospf6d/
+endif
+OSPF6_TEST_LDADD = ospf6d/libospf6.a $(ALL_TESTS_LDADD)
+
+
+if OSPF6D
+check_PROGRAMS += tests/ospf6d/test_lsdb
+endif
+tests_ospf6d_test_lsdb_CFLAGS = $(TESTS_CFLAGS)
+tests_ospf6d_test_lsdb_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_ospf6d_test_lsdb_LDADD = $(OSPF6_TEST_LDADD)
+tests_ospf6d_test_lsdb_SOURCES = tests/ospf6d/test_lsdb.c tests/lib/cli/common_cli.c
+clippy_scan += tests/ospf6d/test_lsdb.c
+EXTRA_DIST += \
+ tests/ospf6d/test_lsdb.py \
+ tests/ospf6d/test_lsdb.in \
+ tests/ospf6d/test_lsdb.refout \
+ # end
diff --git a/tests/ospfd/subdir.am b/tests/ospfd/subdir.am
new file mode 100644
index 0000000000..5ed5b9deaa
--- /dev/null
+++ b/tests/ospfd/subdir.am
@@ -0,0 +1,21 @@
+if !OSPFD
+PYTEST_IGNORE += --ignore=ospfd/
+endif
+OSPFD_TEST_LDADD = ospfd/libfrrospf.a $(ALL_TESTS_LDADD)
+noinst_HEADERS += \
+ tests/ospfd/common.h \
+ # end
+
+
+if OSPFD
+check_PROGRAMS += tests/ospfd/test_ospf_spf
+endif
+tests_ospfd_test_ospf_spf_CFLAGS = $(TESTS_CFLAGS)
+tests_ospfd_test_ospf_spf_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_ospfd_test_ospf_spf_LDADD = $(OSPFD_TEST_LDADD)
+tests_ospfd_test_ospf_spf_SOURCES = tests/ospfd/test_ospf_spf.c tests/ospfd/common.c tests/ospfd/topologies.c
+EXTRA_DIST += \
+ tests/ospfd/test_ospf_spf.py \
+ tests/ospfd/test_ospf_spf.in \
+ tests/ospfd/test_ospf_spf.refout \
+ # end
diff --git a/tests/subdir.am b/tests/subdir.am
index f21e12ecbb..ab322f70d2 100644
--- a/tests/subdir.am
+++ b/tests/subdir.am
@@ -2,165 +2,6 @@
# tests
#
-if BGPD
-TESTS_BGPD = \
- tests/bgpd/test_aspath \
- tests/bgpd/test_capability \
- tests/bgpd/test_packet \
- tests/bgpd/test_peer_attr \
- tests/bgpd/test_ecommunity \
- tests/bgpd/test_mp_attr \
- tests/bgpd/test_mpath \
- tests/bgpd/test_bgp_table
-IGNORE_BGPD =
-else
-TESTS_BGPD =
-IGNORE_BGPD = --ignore=bgpd/
-endif
-
-if ISISD
-TESTS_ISISD = \
- tests/isisd/test_fuzz_isis_tlv \
- tests/isisd/test_isis_lspdb \
- tests/isisd/test_isis_spf \
- tests/isisd/test_isis_vertex_queue \
- # end
-IGNORE_ISISD =
-else
-TESTS_ISISD =
-IGNORE_ISISD = --ignore=isisd/
-endif
-
-if OSPFD
-TESTS_OSPFD = \
- tests/ospfd/test_ospf_spf \
- # end
-IGNORE_OSPFD =
-else
-TESTS_OSPFD =
-IGNORE_OSPFD = --ignore=ospfd/
-endif
-
-if OSPF6D
-TESTS_OSPF6D = \
- tests/ospf6d/test_lsdb \
- # end
-IGNORE_OSPF6D =
-else
-TESTS_OSPF6D =
-IGNORE_OSPF6D = --ignore=ospf6d/
-endif
-
-if ZEBRA
-TESTS_ZEBRA = \
- tests/zebra/test_lm_plugin \
- #end
-IGNORE_ZEBRA =
-else
-TESTS_ZEBRA =
-IGNORE_ZEBRA = --ignore=zebra/
-endif
-
-if SCRIPTING
-TESTS_SCRIPTING = \
- tests/lib/test_frrlua \
- tests/lib/test_frrscript \
- #end
-else
-TESTS_SCRIPTING =
-endif
-
-clippy_scan += \
- tests/lib/cli/test_cli.c \
- tests/ospf6d/test_lsdb.c \
- # end
-
-check_PROGRAMS = \
- tests/lib/cxxcompat \
- tests/lib/test_assert \
- tests/lib/test_atomlist \
- tests/lib/test_buffer \
- tests/lib/test_checksum \
- tests/lib/test_heavy_thread \
- tests/lib/test_heavy_wq \
- tests/lib/test_heavy \
- tests/lib/test_idalloc \
- tests/lib/test_memory \
- tests/lib/test_nexthop_iter \
- tests/lib/test_nexthop \
- tests/lib/test_ntop \
- tests/lib/test_plist \
- tests/lib/test_prefix2str \
- tests/lib/test_printfrr \
- tests/lib/test_privs \
- tests/lib/test_ringbuf \
- tests/lib/test_srcdest_table \
- tests/lib/test_segv \
- tests/lib/test_seqlock \
- tests/lib/test_sig \
- tests/lib/test_skiplist \
- tests/lib/test_stream \
- tests/lib/test_table \
- tests/lib/test_timer_correctness \
- tests/lib/test_timer_performance \
- tests/lib/test_ttable \
- tests/lib/test_typelist \
- tests/lib/test_versioncmp \
- tests/lib/test_xref \
- tests/lib/test_zlog \
- tests/lib/test_graph \
- tests/lib/cli/test_cli \
- tests/lib/cli/test_commands \
- tests/lib/northbound/test_oper_data \
- $(TESTS_BGPD) \
- $(TESTS_ISISD) \
- $(TESTS_OSPFD) \
- $(TESTS_OSPF6D) \
- $(TESTS_ZEBRA) \
- $(TESTS_SCRIPTING) \
- # end
-
-if GRPC
-check_PROGRAMS += \
- tests/lib/test_grpc \
- #end
-endif
-
-if ZEROMQ
-check_PROGRAMS += \
- tests/lib/test_zmq \
- # end
-endif
-
-tests/lib/cli/test_commands_defun.c: vtysh/vtysh_cmd.c
- mkdir -p tests/lib/cli
- sed \
- -e 's%"vtysh/vtysh\.h"%"tests/helpers/c/tests.h"%' \
- -e 's/vtysh_init_cmd/test_init_cmd/' \
- -e 's/VTYSH_[A-Z][A-Z_0-9]*/0/g' \
- < vtysh/vtysh_cmd.c \
- > "$@"
-CLEANFILES += tests/lib/cli/test_commands_defun.c
-
-tests/isisd/test_fuzz_isis_tlv_tests.h: $(top_srcdir)/tests/isisd/test_fuzz_isis_tlv_tests.h.gz
- mkdir -p tests/isisd
- gzip -d < $(top_srcdir)/tests/isisd/test_fuzz_isis_tlv_tests.h.gz > "$@"
-CLEANFILES += tests/isisd/test_fuzz_isis_tlv_tests.h
-
-tests/isisd/tests_isisd_test_fuzz_isis_tlv-test_fuzz_isis_tlv.$(OBJEXT): \
- tests/isisd/test_fuzz_isis_tlv_tests.h
-tests/isisd/test_fuzz_isis_tlv-test_fuzz_isis_tlv.$(OBJEXT): \
- tests/isisd/test_fuzz_isis_tlv_tests.h
-
-noinst_HEADERS += \
- tests/helpers/c/prng.h \
- tests/helpers/c/tests.h \
- tests/lib/cli/common_cli.h \
- tests/lib/test_typelist.h \
- tests/isisd/test_common.h \
- tests/ospfd/common.h \
- # end
-
#
# *sigh* - there is no way to get CPPFLAGS or CFLAGS for a group of files :(
#
@@ -184,319 +25,52 @@ TESTS_CXXFLAGS = \
# note no -Werror
ALL_TESTS_LDADD = lib/libfrr.la $(LIBCAP)
-BGP_TEST_LDADD = bgpd/libbgp.a $(RFPLDADD) $(ALL_TESTS_LDADD) $(LIBYANG_LIBS) $(UST_LIBS) -lm
-ISISD_TEST_LDADD = isisd/libisis.a $(ALL_TESTS_LDADD)
-if GRPC
-GRPC_TESTS_LDADD = staticd/libstatic.a grpc/libfrrgrpc_pb.la -lgrpc++ -lprotobuf $(ALL_TESTS_LDADD) $(LIBYANG_LIBS) -lm
-endif
-OSPFD_TEST_LDADD = ospfd/libfrrospf.a $(ALL_TESTS_LDADD)
-OSPF6_TEST_LDADD = ospf6d/libospf6.a $(ALL_TESTS_LDADD)
-ZEBRA_TEST_LDADD = zebra/label_manager.o $(ALL_TESTS_LDADD)
-
-tests_bgpd_test_aspath_CFLAGS = $(TESTS_CFLAGS)
-tests_bgpd_test_aspath_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_bgpd_test_aspath_LDADD = $(BGP_TEST_LDADD)
-tests_bgpd_test_aspath_SOURCES = tests/bgpd/test_aspath.c
-tests_bgpd_test_bgp_table_CFLAGS = $(TESTS_CFLAGS)
-tests_bgpd_test_bgp_table_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_bgpd_test_bgp_table_LDADD = $(BGP_TEST_LDADD)
-tests_bgpd_test_bgp_table_SOURCES = tests/bgpd/test_bgp_table.c
-tests_bgpd_test_capability_CFLAGS = $(TESTS_CFLAGS)
-tests_bgpd_test_capability_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_bgpd_test_capability_LDADD = $(BGP_TEST_LDADD)
-tests_bgpd_test_capability_SOURCES = tests/bgpd/test_capability.c
-tests_bgpd_test_ecommunity_CFLAGS = $(TESTS_CFLAGS)
-tests_bgpd_test_ecommunity_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_bgpd_test_ecommunity_LDADD = $(BGP_TEST_LDADD)
-tests_bgpd_test_ecommunity_SOURCES = tests/bgpd/test_ecommunity.c
-tests_bgpd_test_mp_attr_CFLAGS = $(TESTS_CFLAGS)
-tests_bgpd_test_mp_attr_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_bgpd_test_mp_attr_LDADD = $(BGP_TEST_LDADD)
-tests_bgpd_test_mp_attr_SOURCES = tests/bgpd/test_mp_attr.c
-tests_bgpd_test_mpath_CFLAGS = $(TESTS_CFLAGS)
-tests_bgpd_test_mpath_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_bgpd_test_mpath_LDADD = $(BGP_TEST_LDADD)
-tests_bgpd_test_mpath_SOURCES = tests/bgpd/test_mpath.c
-tests_bgpd_test_packet_CFLAGS = $(TESTS_CFLAGS)
-tests_bgpd_test_packet_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_bgpd_test_packet_LDADD = $(BGP_TEST_LDADD)
-tests_bgpd_test_packet_SOURCES = tests/bgpd/test_packet.c
-tests_bgpd_test_peer_attr_CFLAGS = $(TESTS_CFLAGS)
-tests_bgpd_test_peer_attr_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_bgpd_test_peer_attr_LDADD = $(BGP_TEST_LDADD)
-tests_bgpd_test_peer_attr_SOURCES = tests/bgpd/test_peer_attr.c
-
-tests_isisd_test_fuzz_isis_tlv_CFLAGS = $(TESTS_CFLAGS) -I$(top_builddir)/tests/isisd
-tests_isisd_test_fuzz_isis_tlv_CPPFLAGS = $(TESTS_CPPFLAGS) -I$(top_builddir)/tests/isisd
-tests_isisd_test_fuzz_isis_tlv_LDADD = $(ISISD_TEST_LDADD)
-tests_isisd_test_fuzz_isis_tlv_SOURCES = tests/isisd/test_fuzz_isis_tlv.c tests/isisd/test_common.c
-nodist_tests_isisd_test_fuzz_isis_tlv_SOURCES = tests/isisd/test_fuzz_isis_tlv_tests.h
-tests_isisd_test_isis_lspdb_CFLAGS = $(TESTS_CFLAGS)
-tests_isisd_test_isis_lspdb_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_isisd_test_isis_lspdb_LDADD = $(ISISD_TEST_LDADD)
-tests_isisd_test_isis_lspdb_SOURCES = tests/isisd/test_isis_lspdb.c tests/isisd/test_common.c
-tests_isisd_test_isis_spf_CFLAGS = $(TESTS_CFLAGS)
-tests_isisd_test_isis_spf_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_isisd_test_isis_spf_LDADD = $(ISISD_TEST_LDADD)
-tests_isisd_test_isis_spf_SOURCES = tests/isisd/test_isis_spf.c tests/isisd/test_common.c tests/isisd/test_topologies.c
-nodist_tests_isisd_test_isis_spf_SOURCES = yang/frr-isisd.yang.c
-tests_isisd_test_isis_vertex_queue_CFLAGS = $(TESTS_CFLAGS)
-tests_isisd_test_isis_vertex_queue_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_isisd_test_isis_vertex_queue_LDADD = $(ISISD_TEST_LDADD)
-tests_isisd_test_isis_vertex_queue_SOURCES = tests/isisd/test_isis_vertex_queue.c tests/isisd/test_common.c
-
-tests_ospfd_test_ospf_spf_CFLAGS = $(TESTS_CFLAGS)
-tests_ospfd_test_ospf_spf_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_ospfd_test_ospf_spf_LDADD = $(OSPFD_TEST_LDADD)
-tests_ospfd_test_ospf_spf_SOURCES = tests/ospfd/test_ospf_spf.c tests/ospfd/common.c tests/ospfd/topologies.c
-
-tests_lib_cxxcompat_CFLAGS = $(TESTS_CFLAGS) $(CXX_COMPAT_CFLAGS) $(WERROR)
-tests_lib_cxxcompat_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_cxxcompat_SOURCES = tests/lib/cxxcompat.c
-tests_lib_cxxcompat_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_cli_test_cli_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_cli_test_cli_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_cli_test_cli_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_cli_test_cli_SOURCES = tests/lib/cli/test_cli.c tests/lib/cli/common_cli.c
-tests_lib_cli_test_commands_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_cli_test_commands_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_cli_test_commands_LDADD = $(ALL_TESTS_LDADD)
-nodist_tests_lib_cli_test_commands_SOURCES = tests/lib/cli/test_commands_defun.c
-tests_lib_cli_test_commands_SOURCES = tests/lib/cli/test_commands.c tests/helpers/c/prng.c
-tests_lib_northbound_test_oper_data_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_northbound_test_oper_data_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_northbound_test_oper_data_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_northbound_test_oper_data_SOURCES = tests/lib/northbound/test_oper_data.c
-nodist_tests_lib_northbound_test_oper_data_SOURCES = yang/frr-test-module.yang.c
-if GRPC
-tests_lib_test_grpc_CXXFLAGS = $(WERROR) $(TESTS_CXXFLAGS)
-tests_lib_test_grpc_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_grpc_LDADD = $(GRPC_TESTS_LDADD)
-tests_lib_test_grpc_SOURCES = tests/lib/test_grpc.cpp
-endif
-tests_lib_test_assert_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_assert_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_assert_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_assert_SOURCES = tests/lib/test_assert.c
-tests_lib_test_atomlist_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_atomlist_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_atomlist_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_atomlist_SOURCES = tests/lib/test_atomlist.c
-tests_lib_test_buffer_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_buffer_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_buffer_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_buffer_SOURCES = tests/lib/test_buffer.c
-tests_lib_test_checksum_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_checksum_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_checksum_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_checksum_SOURCES = tests/lib/test_checksum.c
-if SCRIPTING
-tests_lib_test_frrlua_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_frrlua_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_frrlua_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_frrlua_SOURCES = tests/lib/test_frrlua.c
-tests_lib_test_frrscript_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_frrscript_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_frrscript_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_frrscript_SOURCES = tests/lib/test_frrscript.c
-endif
-tests_lib_test_graph_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_graph_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_graph_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_graph_SOURCES = tests/lib/test_graph.c
-tests_lib_test_heavy_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_heavy_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_heavy_LDADD = $(ALL_TESTS_LDADD) -lm
-tests_lib_test_heavy_SOURCES = tests/lib/test_heavy.c tests/helpers/c/main.c
-tests_lib_test_heavy_thread_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_heavy_thread_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_heavy_thread_LDADD = $(ALL_TESTS_LDADD) -lm
-tests_lib_test_heavy_thread_SOURCES = tests/lib/test_heavy_thread.c tests/helpers/c/main.c
-tests_lib_test_heavy_wq_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_heavy_wq_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_heavy_wq_LDADD = $(ALL_TESTS_LDADD) -lm
-tests_lib_test_heavy_wq_SOURCES = tests/lib/test_heavy_wq.c tests/helpers/c/main.c
-tests_lib_test_idalloc_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_idalloc_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_idalloc_SOURCES = tests/lib/test_idalloc.c
-tests_lib_test_memory_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_memory_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_memory_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_memory_SOURCES = tests/lib/test_memory.c
-tests_lib_test_nexthop_iter_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_nexthop_iter_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_nexthop_iter_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_nexthop_iter_SOURCES = tests/lib/test_nexthop_iter.c tests/helpers/c/prng.c
-tests_lib_test_nexthop_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_nexthop_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_nexthop_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_nexthop_SOURCES = tests/lib/test_nexthop.c
-tests_lib_test_ntop_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_ntop_CPPFLAGS = $(CPPFLAGS_BASE) # no assert override
-tests_lib_test_ntop_LDADD = # none
-tests_lib_test_ntop_SOURCES = tests/lib/test_ntop.c tests/helpers/c/prng.c
-tests_lib_test_plist_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_plist_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_plist_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_plist_SOURCES = tests/lib/test_plist.c tests/lib/cli/common_cli.c
-tests_lib_test_prefix2str_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_prefix2str_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_prefix2str_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_prefix2str_SOURCES = tests/lib/test_prefix2str.c tests/helpers/c/prng.c
-tests_lib_test_printfrr_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_printfrr_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_printfrr_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_printfrr_SOURCES = tests/lib/test_printfrr.c
-tests_lib_test_privs_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_privs_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_privs_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_privs_SOURCES = tests/lib/test_privs.c
-tests_lib_test_ringbuf_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_ringbuf_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_ringbuf_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_ringbuf_SOURCES = tests/lib/test_ringbuf.c
-tests_lib_test_segv_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_segv_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_segv_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_segv_SOURCES = tests/lib/test_segv.c
-tests_lib_test_seqlock_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_seqlock_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_seqlock_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_seqlock_SOURCES = tests/lib/test_seqlock.c
-tests_lib_test_sig_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_sig_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_sig_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_sig_SOURCES = tests/lib/test_sig.c
-tests_lib_test_skiplist_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_skiplist_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_skiplist_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_skiplist_SOURCES = tests/lib/test_skiplist.c
-tests_lib_test_srcdest_table_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_srcdest_table_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_srcdest_table_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_srcdest_table_SOURCES = tests/lib/test_srcdest_table.c tests/helpers/c/prng.c
-tests_lib_test_stream_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_stream_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_stream_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_stream_SOURCES = tests/lib/test_stream.c
-tests_lib_test_table_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_table_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_table_LDADD = $(ALL_TESTS_LDADD) -lm
-tests_lib_test_table_SOURCES = tests/lib/test_table.c
-tests_lib_test_timer_correctness_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_timer_correctness_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_timer_correctness_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_timer_correctness_SOURCES = tests/lib/test_timer_correctness.c tests/helpers/c/prng.c
-tests_lib_test_timer_performance_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_timer_performance_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_timer_performance_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_timer_performance_SOURCES = tests/lib/test_timer_performance.c tests/helpers/c/prng.c
-tests_lib_test_ttable_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_ttable_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_ttable_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_ttable_SOURCES = tests/lib/test_ttable.c
-tests_lib_test_typelist_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_typelist_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_typelist_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_typelist_SOURCES = tests/lib/test_typelist.c tests/helpers/c/prng.c
-tests_lib_test_versioncmp_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_versioncmp_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_versioncmp_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_versioncmp_SOURCES = tests/lib/test_versioncmp.c
-tests_lib_test_xref_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_xref_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_xref_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_xref_SOURCES = tests/lib/test_xref.c
-tests_lib_test_zlog_CFLAGS = $(TESTS_CFLAGS)
-tests_lib_test_zlog_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_zlog_LDADD = $(ALL_TESTS_LDADD)
-tests_lib_test_zlog_SOURCES = tests/lib/test_zlog.c
-tests_lib_test_zmq_CFLAGS = $(TESTS_CFLAGS) $(ZEROMQ_CFLAGS)
-tests_lib_test_zmq_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_lib_test_zmq_LDADD = lib/libfrrzmq.la $(ALL_TESTS_LDADD) $(ZEROMQ_LIBS)
-tests_lib_test_zmq_SOURCES = tests/lib/test_zmq.c
-
-tests_ospf6d_test_lsdb_CFLAGS = $(TESTS_CFLAGS)
-tests_ospf6d_test_lsdb_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_ospf6d_test_lsdb_LDADD = $(OSPF6_TEST_LDADD)
-tests_ospf6d_test_lsdb_SOURCES = tests/ospf6d/test_lsdb.c tests/lib/cli/common_cli.c
-
-tests_zebra_test_lm_plugin_CFLAGS = $(TESTS_CFLAGS)
-tests_zebra_test_lm_plugin_CPPFLAGS = $(TESTS_CPPFLAGS)
-tests_zebra_test_lm_plugin_LDADD = $(ZEBRA_TEST_LDADD)
-tests_zebra_test_lm_plugin_SOURCES = tests/zebra/test_lm_plugin.c
EXTRA_DIST += \
tests/runtests.py \
- tests/bgpd/test_aspath.py \
- tests/bgpd/test_capability.py \
- tests/bgpd/test_ecommunity.py \
- tests/bgpd/test_mp_attr.py \
- tests/bgpd/test_mpath.py \
- tests/bgpd/test_peer_attr.py \
tests/helpers/python/frrsix.py \
tests/helpers/python/frrtest.py \
- tests/isisd/test_fuzz_isis_tlv.py \
- tests/isisd/test_fuzz_isis_tlv_tests.h.gz \
- tests/isisd/test_isis_lspdb.py \
- tests/isisd/test_isis_spf.py \
- tests/isisd/test_isis_spf.in \
- tests/isisd/test_isis_spf.refout \
- tests/isisd/test_isis_vertex_queue.py \
- tests/ospfd/test_ospf_spf.py \
- tests/ospfd/test_ospf_spf.in \
- tests/ospfd/test_ospf_spf.refout \
- tests/lib/cli/test_commands.in \
- tests/lib/cli/test_commands.py \
- tests/lib/cli/test_commands.refout \
- tests/lib/cli/test_cli.in \
- tests/lib/cli/test_cli.py \
- tests/lib/cli/test_cli.refout \
- tests/lib/northbound/test_oper_data.in \
- tests/lib/northbound/test_oper_data.py \
- tests/lib/northbound/test_oper_data.refout \
- tests/lib/test_assert.py \
- tests/lib/test_atomlist.py \
- tests/lib/test_nexthop_iter.py \
- tests/lib/test_nexthop.py \
- tests/lib/test_ntop.py \
- tests/lib/test_prefix2str.py \
- tests/lib/test_printfrr.py \
- tests/lib/test_ringbuf.py \
- tests/lib/test_srcdest_table.py \
- tests/lib/test_stream.py \
- tests/lib/test_stream.refout \
- tests/lib/test_table.py \
- tests/lib/test_timer_correctness.py \
- tests/lib/test_ttable.py \
- tests/lib/test_ttable.refout \
- tests/lib/test_typelist.py \
- tests/lib/test_versioncmp.py \
- tests/lib/test_xref.py \
- tests/lib/test_zlog.py \
- tests/lib/test_graph.py \
- tests/lib/test_graph.refout \
- tests/ospf6d/test_lsdb.py \
- tests/ospf6d/test_lsdb.in \
- tests/ospf6d/test_lsdb.refout \
- tests/zebra/test_lm_plugin.py \
- tests/zebra/test_lm_plugin.refout \
# end
-
-if SCRIPTING
-EXTRA_DIST += \
- tests/lib/test_frrscript.py \
- tests/lib/test_frrlua.py \
- #end
-endif
+check_PROGRAMS =
+PYTEST_IGNORE =
.PHONY: tests/tests.xml
tests/tests.xml: $(check_PROGRAMS)
- ( cd tests; $(PYTHON) ../$(srcdir)/tests/runtests.py --junitxml=tests.xml -v ../$(srcdir)/tests $(IGNORE_BGPD) $(IGNORE_ISISD) $(IGNORE_OSPFD) $(IGNORE_OSPF6D); )
+ ( cd tests; $(PYTHON) ../$(srcdir)/tests/runtests.py --junitxml=tests.xml -v ../$(srcdir)/tests $(PYTEST_IGNORE); )
check: tests/tests.xml
clean-local: clean-tests
.PHONY: clean-tests
clean-tests:
-rm -f tests/tests.xml
+
+
+# CHEAT SHEET:
+#
+### conditional (if needed) - ONLY for "check_PROGRAMS +=" line!
+# if DAEMON
+# check_PROGRAMS += tests/daemon/test_foo
+# endif
+### CFLAGS/CPPFLAGS/LDADD as usual, extend on top of TESTS_XYZFLAGS
+# tests_daemon_test_foo_CFLAGS = $(TESTS_CFLAGS)
+# tests_daemon_test_foo_CPPFLAGS = $(TESTS_CPPFLAGS)
+# tests_daemon_test_foo_LDADD = $(ALL_TESTS_LDADD)
+# tests_daemon_test_foo_SOURCES = tests/daemon/test_foo.c
+### don't forget "nodist_" for autogenerated source files, & add to CLEANFILES
+# nodist_tests_daemon_test_foo_SOURCES = tests/daemon/test_foo_autogen.c
+# CLEANFILES += tests/daemon/test_foo_autogen.c
+### clippy_scan works normally
+# clippy_scan += tests/daemon/test_foo.c
+### header files for tests go into "noinst_HEADERS"
+# noinst_HEADERS += tests/daemon/foo.h
+### all python scripts & auxiliary files are added into EXTRA_DIST
+# EXTRA_DIST += tests/daemon/test_foo.py
+#
+
+include tests/bgpd/subdir.am
+include tests/isisd/subdir.am
+include tests/ospfd/subdir.am
+include tests/ospf6d/subdir.am
+include tests/zebra/subdir.am
+include tests/lib/subdir.am
diff --git a/tests/topotests/all_protocol_startup/r1/isisd.conf b/tests/topotests/all_protocol_startup/r1/isisd.conf
index 413f8d15a9..8ceded894f 100644
--- a/tests/topotests/all_protocol_startup/r1/isisd.conf
+++ b/tests/topotests/all_protocol_startup/r1/isisd.conf
@@ -1,6 +1,6 @@
log file isisd.log
!
-debug isis events
+! debug isis events
!
!
interface r1-eth5
diff --git a/tests/topotests/all_protocol_startup/r1/ldpd.conf b/tests/topotests/all_protocol_startup/r1/ldpd.conf
index 02332a4e75..2358fb898e 100644
--- a/tests/topotests/all_protocol_startup/r1/ldpd.conf
+++ b/tests/topotests/all_protocol_startup/r1/ldpd.conf
@@ -1,7 +1,7 @@
log file ldpd.log
!
-debug mpls ldp event
-debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp zebra
!
!
mpls ldp
diff --git a/tests/topotests/all_protocol_startup/r1/ospf6d.conf b/tests/topotests/all_protocol_startup/r1/ospf6d.conf
index 5c6f071644..2e45186653 100644
--- a/tests/topotests/all_protocol_startup/r1/ospf6d.conf
+++ b/tests/topotests/all_protocol_startup/r1/ospf6d.conf
@@ -1,9 +1,9 @@
log file ospf6d.log
!
-debug ospf6 lsa unknown
-debug ospf6 zebra
-debug ospf6 interface
-debug ospf6 neighbor
+! debug ospf6 lsa unknown
+! debug ospf6 zebra
+! debug ospf6 interface
+! debug ospf6 neighbor
!
interface r1-eth4
!
diff --git a/tests/topotests/all_protocol_startup/r1/ospfd.conf b/tests/topotests/all_protocol_startup/r1/ospfd.conf
index bac9f61620..188f810f81 100644
--- a/tests/topotests/all_protocol_startup/r1/ospfd.conf
+++ b/tests/topotests/all_protocol_startup/r1/ospfd.conf
@@ -1,7 +1,7 @@
log file ospfd.log
!
-debug ospf event
-debug ospf zebra
+! debug ospf event
+! debug ospf zebra
!
router ospf
ospf router-id 192.168.0.1
diff --git a/tests/topotests/all_protocol_startup/r1/ripd.conf b/tests/topotests/all_protocol_startup/r1/ripd.conf
index ace7608873..0a06794886 100644
--- a/tests/topotests/all_protocol_startup/r1/ripd.conf
+++ b/tests/topotests/all_protocol_startup/r1/ripd.conf
@@ -1,7 +1,7 @@
log file ripd.log
!
-debug rip events
-debug rip zebra
+! debug rip events
+! debug rip zebra
!
router rip
version 2
diff --git a/tests/topotests/all_protocol_startup/r1/ripngd.conf b/tests/topotests/all_protocol_startup/r1/ripngd.conf
index 2e0aef3a14..d9d900f926 100644
--- a/tests/topotests/all_protocol_startup/r1/ripngd.conf
+++ b/tests/topotests/all_protocol_startup/r1/ripngd.conf
@@ -1,7 +1,7 @@
log file ripngd.log
!
-debug ripng events
-debug ripng zebra
+! debug ripng events
+! debug ripng zebra
!
router ripng
network fc00:0:0:2::/64
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 ddb7f4e16e..ca8c005f9e 100644
--- a/tests/topotests/all_protocol_startup/test_all_protocol_startup.py
+++ b/tests/topotests/all_protocol_startup/test_all_protocol_startup.py
@@ -34,7 +34,6 @@ import pytest
import glob
from time import sleep
-
pytestmark = [
pytest.mark.babeld,
pytest.mark.bgpd,
@@ -115,7 +114,7 @@ def setup_module(module):
tgen.gears["r%s" % i].start()
# For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
+ # tgen.mininet_cli()
def teardown_module(module):
@@ -127,7 +126,8 @@ def teardown_module(module):
def test_router_running():
global fatal_error
- net = get_topogen().net
+ tgen = get_topogen()
+ net = tgen.net
# Skip if previous fatal error condition is raised
if fatal_error != "":
@@ -143,7 +143,7 @@ def test_router_running():
assert fatal_error == "", fatal_error
# For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
+ # tgen.mininet_cli()
def test_error_messages_vtysh():
@@ -198,9 +198,6 @@ def test_error_messages_vtysh():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_error_messages_daemons():
global fatal_error
@@ -289,9 +286,6 @@ def test_error_messages_daemons():
assert error_logs == "", "Daemons report errors to StdErr"
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_converge_protocols():
global fatal_error
@@ -325,7 +319,7 @@ def test_converge_protocols():
actual = (
net["r%s" % i]
.cmd(
- "vtysh -c \"show ip route\" | sed -e '/^Codes: /,/^\s*$/d' | sort 2> /dev/null"
+ "vtysh -c \"show ip route\" | sed -e '/^Codes: /,/^\\s*$/d' | sort 2> /dev/null"
)
.rstrip()
)
@@ -358,7 +352,7 @@ def test_converge_protocols():
actual = (
net["r%s" % i]
.cmd(
- "vtysh -c \"show ipv6 route\" | sed -e '/^Codes: /,/^\s*$/d' | sort 2> /dev/null"
+ "vtysh -c \"show ipv6 route\" | sed -e '/^Codes: /,/^\\s*$/d' | sort 2> /dev/null"
)
.rstrip()
)
@@ -379,9 +373,6 @@ def test_converge_protocols():
assert failures == 0, "IPv6 Routing table failed for r%s\n%s" % (i, diff)
- # For debugging after starting FRR daemons, uncomment the next line
- ## CLI(net)
-
def route_get_nhg_id(route_str):
net = get_topogen().net
@@ -397,34 +388,71 @@ def route_get_nhg_id(route_str):
def verify_nexthop_group(nhg_id, recursive=False, ecmp=0):
net = get_topogen().net
- # Verify NHG is valid/installed
- output = net["r1"].cmd('vtysh -c "show nexthop-group rib %d"' % nhg_id)
-
- match = re.search(r"Valid", output)
- assert match is not None, "Nexthop Group ID=%d not marked Valid" % nhg_id
-
+ count = 0
+ valid = None
+ ecmpcount = None
+ depends = None
+ resolved_id = None
+ installed = None
+ found = False
+
+ while not found and count < 10:
+ count += 1
+ # Verify NHG is valid/installed
+ output = net["r1"].cmd('vtysh -c "show nexthop-group rib %d"' % nhg_id)
+ valid = re.search(r"Valid", output)
+ if valid is None:
+ found = False
+ sleep(1)
+ continue
+
+ if ecmp or recursive:
+ ecmpcount = re.search(r"Depends:.*\n", output)
+ if ecmpcount is None:
+ found = False
+ sleep(1)
+ continue
+
+ # list of IDs in group
+ depends = re.findall(r"\((\d+)\)", ecmpcount.group(0))
+
+ if ecmp:
+ if len(depends) != ecmp:
+ found = False
+ sleep(1)
+ continue
+ else:
+ # If recursive, we need to look at its resolved group
+ if len(depends) != 1:
+ found = False
+ sleep(1)
+ continue
+
+ resolved_id = int(depends[0])
+ verify_nexthop_group(resolved_id, False)
+ else:
+ installed = re.search(r"Installed", output)
+ if installed is None:
+ found = False
+ sleep(1)
+ continue
+ found = True
+
+ assert valid is not None, "Nexthop Group ID=%d not marked Valid" % nhg_id
if ecmp or recursive:
- match = re.search(r"Depends:.*\n", output)
- assert match is not None, "Nexthop Group ID=%d has no depends" % nhg_id
-
- # list of IDs in group
- depends = re.findall(r"\((\d+)\)", match.group(0))
-
+ assert ecmpcount is not None, "Nexthop Group ID=%d has no depends" % nhg_id
if ecmp:
assert len(depends) == ecmp, (
"Nexthop Group ID=%d doesn't match ecmp size" % nhg_id
)
else:
- # If recursive, we need to look at its resolved group
assert len(depends) == 1, (
"Nexthop Group ID=%d should only have one recursive depend" % nhg_id
)
- resolved_id = int(depends[0])
- verify_nexthop_group(resolved_id, False)
-
else:
- match = re.search(r"Installed", output)
- assert match is not None, "Nexthop Group ID=%d not marked Installed" % nhg_id
+ assert installed is not None, (
+ "Nexthop Group ID=%d not marked Installed" % nhg_id
+ )
def verify_route_nexthop_group(route_str, recursive=False, ecmp=0):
@@ -455,7 +483,6 @@ def test_nexthop_groups():
# Create with sharpd using nexthop-group
net["r1"].cmd('vtysh -c "sharp install routes 2.2.2.1 nexthop-group basic 1"')
-
verify_route_nexthop_group("2.2.2.1/32")
## Connected
@@ -465,7 +492,6 @@ def test_nexthop_groups():
)
net["r1"].cmd('vtysh -c "sharp install routes 2.2.2.2 nexthop-group connected 1"')
-
verify_route_nexthop_group("2.2.2.2/32")
## Recursive
@@ -542,24 +568,33 @@ def test_nexthop_groups():
net["r1"].cmd(
'vtysh -c "sharp install routes 6.6.6.4 nexthop-group infinite-recursive 1"'
)
+ sleep(5)
net["r1"].cmd(
'vtysh -c "sharp install routes 6.6.6.3 nexthop-group infinite-recursive 1"'
)
+ sleep(5)
net["r1"].cmd(
'vtysh -c "sharp install routes 6.6.6.2 nexthop-group infinite-recursive 1"'
)
+ sleep(5)
net["r1"].cmd(
'vtysh -c "sharp install routes 6.6.6.1 nexthop-group infinite-recursive 1"'
)
# Get routes and test if has too many (duplicate) nexthops
+ count = 0
+ dups = []
nhg_id = route_get_nhg_id("6.6.6.1/32")
- output = net["r1"].cmd('vtysh -c "show nexthop-group rib %d"' % nhg_id)
+ while (len(dups) != 3) and count < 10:
+ output = net["r1"].cmd('vtysh -c "show nexthop-group rib %d"' % nhg_id)
- dups = re.findall(r"(via 1\.1\.1\.1)", output)
+ dups = re.findall(r"(via 1\.1\.1\.1)", output)
+ if len(dups) != 3:
+ count += 1
+ sleep(1)
# Should find 3, itself is inactive
assert len(dups) == 3, (
@@ -567,8 +602,6 @@ def test_nexthop_groups():
% nhg_id
)
- ##CLI(net)
-
## Remove all NHG routes
net["r1"].cmd('vtysh -c "sharp remove routes 2.2.2.1 1"')
@@ -638,9 +671,6 @@ def test_rip_status():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_ripng_status():
global fatal_error
@@ -705,9 +735,6 @@ def test_ripng_status():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_ospfv2_interfaces():
global fatal_error
@@ -790,9 +817,6 @@ def test_ospfv2_interfaces():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_isis_interfaces():
global fatal_error
@@ -856,9 +880,6 @@ def test_isis_interfaces():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_bgp_summary():
global fatal_error
@@ -1037,9 +1058,6 @@ def test_bgp_summary():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_bgp_ipv6_summary():
global fatal_error
@@ -1138,12 +1156,15 @@ def test_bgp_ipv6_summary():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_nht():
+ global fatal_error
net = get_topogen().net
+
+ # Skip if previous fatal error condition is raised
+ if fatal_error != "":
+ pytest.skip(fatal_error)
+
print("\n\n**** Test that nexthop tracking is at least nominally working ****\n")
thisDir = os.path.dirname(os.path.realpath(__file__))
@@ -1256,9 +1277,6 @@ def test_bgp_ipv4():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_bgp_ipv6():
global fatal_error
@@ -1325,9 +1343,6 @@ def test_bgp_ipv6():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_route_map():
global fatal_error
@@ -1488,6 +1503,14 @@ def test_nexthop_group_replace():
'vtysh -c "c t" -c "nexthop-group replace" -c "nexthop 1.1.1.1 r1-eth1 onlink" -c "nexthop 1.1.1.2 r1-eth2 onlink"'
)
+ # At the moment there is absolutely no real easy way to query sharpd
+ # for the nexthop group actually installed. If it is not installed
+ # sharpd will just transmit the nexthops down instead of the nexthop
+ # group id. Leading to a situation where the replace is not actually
+ # being tested. So let's just wait some time here because this
+ # is hard and this test fails all the time
+ sleep(5)
+
# Create with sharpd using nexthop-group
net["r1"].cmd('vtysh -c "sharp install routes 3.3.3.1 nexthop-group replace 1"')
@@ -1567,9 +1590,6 @@ def test_mpls_interfaces():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_shutdown_check_stderr():
global fatal_error
diff --git a/tests/topotests/bfd_bgp_cbit_topo3/r1/bfdd.conf b/tests/topotests/bfd_bgp_cbit_topo3/r1/bfdd.conf
index f35e772790..ee7144d003 100644
--- a/tests/topotests/bfd_bgp_cbit_topo3/r1/bfdd.conf
+++ b/tests/topotests/bfd_bgp_cbit_topo3/r1/bfdd.conf
@@ -1,5 +1,5 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
diff --git a/tests/topotests/bfd_bgp_cbit_topo3/r1/bgpd.conf b/tests/topotests/bfd_bgp_cbit_topo3/r1/bgpd.conf
index 689797a5e6..d30c32043e 100644
--- a/tests/topotests/bfd_bgp_cbit_topo3/r1/bgpd.conf
+++ b/tests/topotests/bfd_bgp_cbit_topo3/r1/bgpd.conf
@@ -1,4 +1,4 @@
-debug bgp neighbor-events
+! debug bgp neighbor-events
router bgp 101
bgp router-id 10.254.254.1
no bgp ebgp-requires-policy
diff --git a/tests/topotests/bfd_bgp_cbit_topo3/r3/bfdd.conf b/tests/topotests/bfd_bgp_cbit_topo3/r3/bfdd.conf
index f35e772790..ee7144d003 100644
--- a/tests/topotests/bfd_bgp_cbit_topo3/r3/bfdd.conf
+++ b/tests/topotests/bfd_bgp_cbit_topo3/r3/bfdd.conf
@@ -1,5 +1,5 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
diff --git a/tests/topotests/bfd_bgp_cbit_topo3/r3/bgpd.conf b/tests/topotests/bfd_bgp_cbit_topo3/r3/bgpd.conf
index 1f5aac42ed..dba2ffd372 100644
--- a/tests/topotests/bfd_bgp_cbit_topo3/r3/bgpd.conf
+++ b/tests/topotests/bfd_bgp_cbit_topo3/r3/bgpd.conf
@@ -1,4 +1,4 @@
-debug bgp neighbor-events
+! debug bgp neighbor-events
router bgp 102
bgp router-id 10.254.254.3
no bgp ebgp-requires-policy
diff --git a/tests/topotests/bfd_isis_topo1/rt1/bfdd.conf b/tests/topotests/bfd_isis_topo1/rt1/bfdd.conf
index 57f9cd9e3d..dbcf23f306 100644
--- a/tests/topotests/bfd_isis_topo1/rt1/bfdd.conf
+++ b/tests/topotests/bfd_isis_topo1/rt1/bfdd.conf
@@ -1,7 +1,7 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
bfd
peer 10.0.1.2 interface eth-rt2
diff --git a/tests/topotests/bfd_isis_topo1/rt1/isisd.conf b/tests/topotests/bfd_isis_topo1/rt1/isisd.conf
index 8026aad49d..a5cbdd932e 100644
--- a/tests/topotests/bfd_isis_topo1/rt1/isisd.conf
+++ b/tests/topotests/bfd_isis_topo1/rt1/isisd.conf
@@ -5,11 +5,11 @@ hostname rt1
!
password 1
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis adj-packets
-debug isis lsp-sched
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis adj-packets
+! debug isis lsp-sched
!
interface lo
ip router isis 1
diff --git a/tests/topotests/bfd_isis_topo1/rt1/zebra.conf b/tests/topotests/bfd_isis_topo1/rt1/zebra.conf
index 6003125b6b..7e6f7881b4 100644
--- a/tests/topotests/bfd_isis_topo1/rt1/zebra.conf
+++ b/tests/topotests/bfd_isis_topo1/rt1/zebra.conf
@@ -3,10 +3,10 @@ log timestamp precision 3
!
hostname rt1
!
-debug zebra kernel
-debug zebra packet
-debug zebra events
-debug zebra rib
+! debug zebra kernel
+! debug zebra packet
+! debug zebra events
+! debug zebra rib
!
interface lo
ip address 1.1.1.1/32
diff --git a/tests/topotests/bfd_isis_topo1/rt2/bfdd.conf b/tests/topotests/bfd_isis_topo1/rt2/bfdd.conf
index 6b34e337d3..d5054aac09 100644
--- a/tests/topotests/bfd_isis_topo1/rt2/bfdd.conf
+++ b/tests/topotests/bfd_isis_topo1/rt2/bfdd.conf
@@ -1,7 +1,7 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
bfd
peer 10.0.1.1 interface eth-rt1
diff --git a/tests/topotests/bfd_isis_topo1/rt2/isisd.conf b/tests/topotests/bfd_isis_topo1/rt2/isisd.conf
index b0fde64a5e..b32170d208 100644
--- a/tests/topotests/bfd_isis_topo1/rt2/isisd.conf
+++ b/tests/topotests/bfd_isis_topo1/rt2/isisd.conf
@@ -4,9 +4,9 @@ hostname rt2
!
password 1
!
-debug isis events
-debug isis route-events
-debug isis spf-events
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
!
interface lo
ip router isis 1
diff --git a/tests/topotests/bfd_isis_topo1/rt2/zebra.conf b/tests/topotests/bfd_isis_topo1/rt2/zebra.conf
index 5fc7fc5b28..5788e31f12 100644
--- a/tests/topotests/bfd_isis_topo1/rt2/zebra.conf
+++ b/tests/topotests/bfd_isis_topo1/rt2/zebra.conf
@@ -2,8 +2,8 @@ log file zebra.log
!
hostname rt2
!
-debug zebra kernel
-debug zebra packet
+! debug zebra kernel
+! debug zebra packet
!
interface lo
ip address 2.2.2.2/32
diff --git a/tests/topotests/bfd_isis_topo1/rt3/bfdd.conf b/tests/topotests/bfd_isis_topo1/rt3/bfdd.conf
index 22937fe46f..fd9a5e1b9d 100644
--- a/tests/topotests/bfd_isis_topo1/rt3/bfdd.conf
+++ b/tests/topotests/bfd_isis_topo1/rt3/bfdd.conf
@@ -1,7 +1,7 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
bfd
peer 10.0.2.1 interface eth-rt1
diff --git a/tests/topotests/bfd_isis_topo1/rt3/isisd.conf b/tests/topotests/bfd_isis_topo1/rt3/isisd.conf
index 5c36e96c0f..b98f249395 100644
--- a/tests/topotests/bfd_isis_topo1/rt3/isisd.conf
+++ b/tests/topotests/bfd_isis_topo1/rt3/isisd.conf
@@ -4,9 +4,9 @@ hostname rt3
!
password 1
!
-debug isis events
-debug isis route-events
-debug isis spf-events
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
!
interface lo
ip router isis 1
diff --git a/tests/topotests/bfd_isis_topo1/rt3/zebra.conf b/tests/topotests/bfd_isis_topo1/rt3/zebra.conf
index d368de9bbe..78eac2e15a 100644
--- a/tests/topotests/bfd_isis_topo1/rt3/zebra.conf
+++ b/tests/topotests/bfd_isis_topo1/rt3/zebra.conf
@@ -2,8 +2,8 @@ log file zebra.log
!
hostname rt3
!
-debug zebra kernel
-debug zebra packet
+! debug zebra kernel
+! debug zebra packet
!
interface lo
ip address 3.3.3.3/32
diff --git a/tests/topotests/bfd_isis_topo1/rt4/bfdd.conf b/tests/topotests/bfd_isis_topo1/rt4/bfdd.conf
index f35e772790..ee7144d003 100644
--- a/tests/topotests/bfd_isis_topo1/rt4/bfdd.conf
+++ b/tests/topotests/bfd_isis_topo1/rt4/bfdd.conf
@@ -1,5 +1,5 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
diff --git a/tests/topotests/bfd_isis_topo1/rt4/isisd.conf b/tests/topotests/bfd_isis_topo1/rt4/isisd.conf
index 3eac407776..6a4b05f204 100644
--- a/tests/topotests/bfd_isis_topo1/rt4/isisd.conf
+++ b/tests/topotests/bfd_isis_topo1/rt4/isisd.conf
@@ -4,9 +4,9 @@ hostname rt4
!
password 1
!
-debug isis events
-debug isis route-events
-debug isis spf-events
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
!
interface lo
ip router isis 1
diff --git a/tests/topotests/bfd_isis_topo1/rt4/zebra.conf b/tests/topotests/bfd_isis_topo1/rt4/zebra.conf
index 7b053bac35..a6cb573ed8 100644
--- a/tests/topotests/bfd_isis_topo1/rt4/zebra.conf
+++ b/tests/topotests/bfd_isis_topo1/rt4/zebra.conf
@@ -2,8 +2,8 @@ log file zebra.log
!
hostname rt4
!
-debug zebra kernel
-debug zebra packet
+! debug zebra kernel
+! debug zebra packet
!
interface lo
ip address 4.4.4.4/32
diff --git a/tests/topotests/bfd_isis_topo1/rt5/bfdd.conf b/tests/topotests/bfd_isis_topo1/rt5/bfdd.conf
index f35e772790..ee7144d003 100644
--- a/tests/topotests/bfd_isis_topo1/rt5/bfdd.conf
+++ b/tests/topotests/bfd_isis_topo1/rt5/bfdd.conf
@@ -1,5 +1,5 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
diff --git a/tests/topotests/bfd_isis_topo1/rt5/isisd.conf b/tests/topotests/bfd_isis_topo1/rt5/isisd.conf
index 5d449f6f93..ed32b15ea1 100644
--- a/tests/topotests/bfd_isis_topo1/rt5/isisd.conf
+++ b/tests/topotests/bfd_isis_topo1/rt5/isisd.conf
@@ -4,9 +4,9 @@ hostname rt5
!
password 1
!
-debug isis events
-debug isis route-events
-debug isis spf-events
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
!
interface lo
ip router isis 1
diff --git a/tests/topotests/bfd_isis_topo1/rt5/zebra.conf b/tests/topotests/bfd_isis_topo1/rt5/zebra.conf
index 0b7c9e02f3..33473c91a3 100644
--- a/tests/topotests/bfd_isis_topo1/rt5/zebra.conf
+++ b/tests/topotests/bfd_isis_topo1/rt5/zebra.conf
@@ -2,8 +2,8 @@ log file zebra.log
!
hostname rt5
!
-debug zebra kernel
-debug zebra packet
+! debug zebra kernel
+! debug zebra packet
!
interface lo
ip address 5.5.5.5/32
diff --git a/tests/topotests/bfd_isis_topo1/test_bfd_isis_topo1.py b/tests/topotests/bfd_isis_topo1/test_bfd_isis_topo1.py
index 3c176f25a3..27a4419329 100644
--- a/tests/topotests/bfd_isis_topo1/test_bfd_isis_topo1.py
+++ b/tests/topotests/bfd_isis_topo1/test_bfd_isis_topo1.py
@@ -72,7 +72,6 @@ import os
import sys
import pytest
import json
-from time import sleep
from functools import partial
# Save the Current Working Directory to find configuration files.
@@ -193,15 +192,14 @@ def test_bfd_isis_interface_failure_rt2_step3():
# By default BFD provides a recovery time of 900ms plus jitter, so let's wait
# initial 2 seconds to let the CI not suffer.
# TODO: add check for array size
- sleep(2)
router_compare_json_output(
- "rt1", "show ip route isis json", "step3/show_ip_route_rt2_down.ref", 1, 0
+ "rt1", "show ip route isis json", "step3/show_ip_route_rt2_down.ref", 20, 1
)
router_compare_json_output(
- "rt1", "show ipv6 route isis json", "step3/show_ipv6_route_rt2_down.ref", 1, 0
+ "rt1", "show ipv6 route isis json", "step3/show_ipv6_route_rt2_down.ref", 20, 1
)
router_compare_json_output(
- "rt1", "show bfd peers json", "step3/show_bfd_peers_rt2_down.ref", 1, 0
+ "rt1", "show bfd peers json", "step3/show_bfd_peers_rt2_down.ref", 20, 1
)
# Check recovery, this can take some time
@@ -232,15 +230,14 @@ def test_bfd_isis_interface_failure_rt3_step3():
# By default BFD provides a recovery time of 900ms plus jitter, so let's wait
# initial 2 seconds to let the CI not suffer.
# TODO: add check for array size
- sleep(2)
router_compare_json_output(
- "rt1", "show ip route isis json", "step3/show_ip_route_rt3_down.ref", 1, 0
+ "rt1", "show ip route isis json", "step3/show_ip_route_rt3_down.ref", 20, 1
)
router_compare_json_output(
- "rt1", "show ipv6 route isis json", "step3/show_ipv6_route_rt3_down.ref", 1, 0
+ "rt1", "show ipv6 route isis json", "step3/show_ipv6_route_rt3_down.ref", 20, 1
)
router_compare_json_output(
- "rt1", "show bfd peers json", "step3/show_bfd_peers_rt3_down.ref", 1, 0
+ "rt1", "show bfd peers json", "step3/show_bfd_peers_rt3_down.ref", 20, 1
)
# Check recovery, this can take some time
diff --git a/tests/topotests/bfd_ospf_topo1/rt1/bfdd.conf b/tests/topotests/bfd_ospf_topo1/rt1/bfdd.conf
index 610a20f88a..f34f4ca61d 100644
--- a/tests/topotests/bfd_ospf_topo1/rt1/bfdd.conf
+++ b/tests/topotests/bfd_ospf_topo1/rt1/bfdd.conf
@@ -1,9 +1,9 @@
log file bfdd.log
log timestamp precision 3
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
bfd
!
diff --git a/tests/topotests/bfd_ospf_topo1/rt1/ospfd.conf b/tests/topotests/bfd_ospf_topo1/rt1/ospfd.conf
index 9da8765005..ce36494604 100644
--- a/tests/topotests/bfd_ospf_topo1/rt1/ospfd.conf
+++ b/tests/topotests/bfd_ospf_topo1/rt1/ospfd.conf
@@ -5,8 +5,8 @@ hostname rt1
!
password 1
!
-debug ospf event
-debug ospf zebra
+! debug ospf event
+! debug ospf zebra
!
interface lo
ip ospf area 0.0.0.0
diff --git a/tests/topotests/bfd_ospf_topo1/rt1/zebra.conf b/tests/topotests/bfd_ospf_topo1/rt1/zebra.conf
index 6003125b6b..7e6f7881b4 100644
--- a/tests/topotests/bfd_ospf_topo1/rt1/zebra.conf
+++ b/tests/topotests/bfd_ospf_topo1/rt1/zebra.conf
@@ -3,10 +3,10 @@ log timestamp precision 3
!
hostname rt1
!
-debug zebra kernel
-debug zebra packet
-debug zebra events
-debug zebra rib
+! debug zebra kernel
+! debug zebra packet
+! debug zebra events
+! debug zebra rib
!
interface lo
ip address 1.1.1.1/32
diff --git a/tests/topotests/bfd_ospf_topo1/rt2/bfdd.conf b/tests/topotests/bfd_ospf_topo1/rt2/bfdd.conf
index 437f063d8f..5baea3c842 100644
--- a/tests/topotests/bfd_ospf_topo1/rt2/bfdd.conf
+++ b/tests/topotests/bfd_ospf_topo1/rt2/bfdd.conf
@@ -1,7 +1,7 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
bfd
!
diff --git a/tests/topotests/bfd_ospf_topo1/rt2/ospfd.conf b/tests/topotests/bfd_ospf_topo1/rt2/ospfd.conf
index 11be6a14b2..a8ca564e4e 100644
--- a/tests/topotests/bfd_ospf_topo1/rt2/ospfd.conf
+++ b/tests/topotests/bfd_ospf_topo1/rt2/ospfd.conf
@@ -4,8 +4,8 @@ hostname rt2
!
password 1
!
-debug ospf event
-debug ospf zebra
+! debug ospf event
+! debug ospf zebra
!
interface lo
ip ospf area 0.0.0.0
diff --git a/tests/topotests/bfd_ospf_topo1/rt2/zebra.conf b/tests/topotests/bfd_ospf_topo1/rt2/zebra.conf
index 5fc7fc5b28..5788e31f12 100644
--- a/tests/topotests/bfd_ospf_topo1/rt2/zebra.conf
+++ b/tests/topotests/bfd_ospf_topo1/rt2/zebra.conf
@@ -2,8 +2,8 @@ log file zebra.log
!
hostname rt2
!
-debug zebra kernel
-debug zebra packet
+! debug zebra kernel
+! debug zebra packet
!
interface lo
ip address 2.2.2.2/32
diff --git a/tests/topotests/bfd_ospf_topo1/rt3/bfdd.conf b/tests/topotests/bfd_ospf_topo1/rt3/bfdd.conf
index 437f063d8f..5baea3c842 100644
--- a/tests/topotests/bfd_ospf_topo1/rt3/bfdd.conf
+++ b/tests/topotests/bfd_ospf_topo1/rt3/bfdd.conf
@@ -1,7 +1,7 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
bfd
!
diff --git a/tests/topotests/bfd_ospf_topo1/rt3/ospfd.conf b/tests/topotests/bfd_ospf_topo1/rt3/ospfd.conf
index acc54b3866..0404994c09 100644
--- a/tests/topotests/bfd_ospf_topo1/rt3/ospfd.conf
+++ b/tests/topotests/bfd_ospf_topo1/rt3/ospfd.conf
@@ -4,8 +4,8 @@ hostname rt3
!
password 1
!
-debug ospf event
-debug ospf zebra
+! debug ospf event
+! debug ospf zebra
!
interface lo
ip ospf area 0.0.0.0
diff --git a/tests/topotests/bfd_ospf_topo1/rt3/zebra.conf b/tests/topotests/bfd_ospf_topo1/rt3/zebra.conf
index d368de9bbe..78eac2e15a 100644
--- a/tests/topotests/bfd_ospf_topo1/rt3/zebra.conf
+++ b/tests/topotests/bfd_ospf_topo1/rt3/zebra.conf
@@ -2,8 +2,8 @@ log file zebra.log
!
hostname rt3
!
-debug zebra kernel
-debug zebra packet
+! debug zebra kernel
+! debug zebra packet
!
interface lo
ip address 3.3.3.3/32
diff --git a/tests/topotests/bfd_ospf_topo1/rt4/bfdd.conf b/tests/topotests/bfd_ospf_topo1/rt4/bfdd.conf
index f35e772790..ee7144d003 100644
--- a/tests/topotests/bfd_ospf_topo1/rt4/bfdd.conf
+++ b/tests/topotests/bfd_ospf_topo1/rt4/bfdd.conf
@@ -1,5 +1,5 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
diff --git a/tests/topotests/bfd_ospf_topo1/rt4/ospfd.conf b/tests/topotests/bfd_ospf_topo1/rt4/ospfd.conf
index 670e56ccc8..6b8ab3704f 100644
--- a/tests/topotests/bfd_ospf_topo1/rt4/ospfd.conf
+++ b/tests/topotests/bfd_ospf_topo1/rt4/ospfd.conf
@@ -4,8 +4,8 @@ hostname rt4
!
password 1
!
-debug ospf event
-debug ospf zebra
+! debug ospf event
+! debug ospf zebra
!
interface lo
ip ospf area 0.0.0.0
diff --git a/tests/topotests/bfd_ospf_topo1/rt4/zebra.conf b/tests/topotests/bfd_ospf_topo1/rt4/zebra.conf
index 7b053bac35..a6cb573ed8 100644
--- a/tests/topotests/bfd_ospf_topo1/rt4/zebra.conf
+++ b/tests/topotests/bfd_ospf_topo1/rt4/zebra.conf
@@ -2,8 +2,8 @@ log file zebra.log
!
hostname rt4
!
-debug zebra kernel
-debug zebra packet
+! debug zebra kernel
+! debug zebra packet
!
interface lo
ip address 4.4.4.4/32
diff --git a/tests/topotests/bfd_ospf_topo1/rt5/bfdd.conf b/tests/topotests/bfd_ospf_topo1/rt5/bfdd.conf
index f35e772790..ee7144d003 100644
--- a/tests/topotests/bfd_ospf_topo1/rt5/bfdd.conf
+++ b/tests/topotests/bfd_ospf_topo1/rt5/bfdd.conf
@@ -1,5 +1,5 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
diff --git a/tests/topotests/bfd_ospf_topo1/rt5/ospfd.conf b/tests/topotests/bfd_ospf_topo1/rt5/ospfd.conf
index 286de51288..043432ec3d 100644
--- a/tests/topotests/bfd_ospf_topo1/rt5/ospfd.conf
+++ b/tests/topotests/bfd_ospf_topo1/rt5/ospfd.conf
@@ -4,8 +4,8 @@ hostname rt5
!
password 1
!
-debug ospf event
-debug ospf zebra
+! debug ospf event
+! debug ospf zebra
!
interface lo
ip ospf area 0.0.0.0
diff --git a/tests/topotests/bfd_ospf_topo1/rt5/zebra.conf b/tests/topotests/bfd_ospf_topo1/rt5/zebra.conf
index 0b7c9e02f3..33473c91a3 100644
--- a/tests/topotests/bfd_ospf_topo1/rt5/zebra.conf
+++ b/tests/topotests/bfd_ospf_topo1/rt5/zebra.conf
@@ -2,8 +2,8 @@ log file zebra.log
!
hostname rt5
!
-debug zebra kernel
-debug zebra packet
+! debug zebra kernel
+! debug zebra packet
!
interface lo
ip address 5.5.5.5/32
diff --git a/tests/topotests/bfd_ospf_topo1/test_bfd_ospf_topo1.py b/tests/topotests/bfd_ospf_topo1/test_bfd_ospf_topo1.py
index bef2c3f162..93a2339299 100755
--- a/tests/topotests/bfd_ospf_topo1/test_bfd_ospf_topo1.py
+++ b/tests/topotests/bfd_ospf_topo1/test_bfd_ospf_topo1.py
@@ -195,16 +195,16 @@ def test_bfd_ospf_interface_failure_rt2_step3():
# By default BFD provides a recovery time of 900ms plus jitter, so let's wait
# initial 2 seconds to let the CI not suffer.
- topotest.sleep(2, 'Wait for BFD down notification')
+ topotest.sleep(2, "Wait for BFD down notification")
router_compare_json_output(
- "rt1", "show ip route ospf json", "step3/show_ip_route_rt2_down.ref", 1, 0
+ "rt1", "show ip route ospf json", "step3/show_ip_route_rt2_down.ref", 10, 2
)
router_compare_json_output(
- "rt1", "show ipv6 route ospf json", "step3/show_ipv6_route_rt2_down.ref", 1, 0
+ "rt1", "show ipv6 route ospf json", "step3/show_ipv6_route_rt2_down.ref", 10, 2
)
router_compare_json_output(
- "rt1", "show bfd peers json", "step3/show_bfd_peers_rt2_down.ref", 1, 0
+ "rt1", "show bfd peers json", "step3/show_bfd_peers_rt2_down.ref", 10, 2
)
# Check recovery, this can take some time
@@ -234,15 +234,15 @@ def test_bfd_ospf_interface_failure_rt3_step3():
# By default BFD provides a recovery time of 900ms plus jitter, so let's wait
# initial 2 seconds to let the CI not suffer.
- topotest.sleep(2, 'Wait for BFD down notification')
+ topotest.sleep(2, "Wait for BFD down notification")
router_compare_json_output(
- "rt1", "show ip route ospf json", "step3/show_ip_route_rt3_down.ref", 1, 0
+ "rt1", "show ip route ospf json", "step3/show_ip_route_rt3_down.ref", 10, 2
)
router_compare_json_output(
- "rt1", "show ipv6 route ospf json", "step3/show_ipv6_route_rt3_down.ref", 1, 0
+ "rt1", "show ipv6 route ospf json", "step3/show_ipv6_route_rt3_down.ref", 10, 2
)
router_compare_json_output(
- "rt1", "show bfd peers json", "step3/show_bfd_peers_rt3_down.ref", 1, 0
+ "rt1", "show bfd peers json", "step3/show_bfd_peers_rt3_down.ref", 10, 2
)
# Check recovery, this can take some time
diff --git a/tests/topotests/bfd_profiles_topo1/r1/bfdd.conf b/tests/topotests/bfd_profiles_topo1/r1/bfdd.conf
index 688f2e839c..c2ac9c1b7c 100644
--- a/tests/topotests/bfd_profiles_topo1/r1/bfdd.conf
+++ b/tests/topotests/bfd_profiles_topo1/r1/bfdd.conf
@@ -1,6 +1,6 @@
-debug bfd peer
-debug bfd network
-debug bfd zebra
+! debug bfd peer
+! debug bfd network
+! debug bfd zebra
!
bfd
profile slowtx
diff --git a/tests/topotests/bfd_profiles_topo1/r2/bfdd.conf b/tests/topotests/bfd_profiles_topo1/r2/bfdd.conf
index 700c46ba1e..b68eecb34c 100644
--- a/tests/topotests/bfd_profiles_topo1/r2/bfdd.conf
+++ b/tests/topotests/bfd_profiles_topo1/r2/bfdd.conf
@@ -1,6 +1,6 @@
-debug bfd peer
-debug bfd network
-debug bfd zebra
+! debug bfd peer
+! debug bfd network
+! debug bfd zebra
!
bfd
profile slowtx
diff --git a/tests/topotests/bfd_profiles_topo1/r2/bgpd.conf b/tests/topotests/bfd_profiles_topo1/r2/bgpd.conf
index 0c3db97bc1..1aab1d1372 100644
--- a/tests/topotests/bfd_profiles_topo1/r2/bgpd.conf
+++ b/tests/topotests/bfd_profiles_topo1/r2/bgpd.conf
@@ -1,4 +1,4 @@
-debug bgp neighbor-events
+! debug bgp neighbor-events
!
router bgp 100
bgp router-id 10.254.254.2
diff --git a/tests/topotests/bfd_profiles_topo1/r3/bfdd.conf b/tests/topotests/bfd_profiles_topo1/r3/bfdd.conf
index 08eb0468d6..f3a86edce8 100644
--- a/tests/topotests/bfd_profiles_topo1/r3/bfdd.conf
+++ b/tests/topotests/bfd_profiles_topo1/r3/bfdd.conf
@@ -1,6 +1,6 @@
-debug bfd peer
-debug bfd network
-debug bfd zebra
+! debug bfd peer
+! debug bfd network
+! debug bfd zebra
!
bfd
profile fasttx
diff --git a/tests/topotests/bfd_profiles_topo1/r3/isisd.conf b/tests/topotests/bfd_profiles_topo1/r3/isisd.conf
index ca965e3956..3bba2b03cf 100644
--- a/tests/topotests/bfd_profiles_topo1/r3/isisd.conf
+++ b/tests/topotests/bfd_profiles_topo1/r3/isisd.conf
@@ -1,8 +1,8 @@
hostname r3
!
-debug isis adj-packets
-debug isis events
-debug isis update-packets
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
!
interface r3-eth1
ipv6 router isis lan
diff --git a/tests/topotests/bfd_profiles_topo1/r4/bfdd.conf b/tests/topotests/bfd_profiles_topo1/r4/bfdd.conf
index 4f5e022077..a5d1e25949 100644
--- a/tests/topotests/bfd_profiles_topo1/r4/bfdd.conf
+++ b/tests/topotests/bfd_profiles_topo1/r4/bfdd.conf
@@ -1,6 +1,6 @@
-debug bfd peer
-debug bfd network
-debug bfd zebra
+! debug bfd peer
+! debug bfd network
+! debug bfd zebra
!
bfd
profile fast-tx
diff --git a/tests/topotests/bfd_profiles_topo1/r4/bgpd.conf b/tests/topotests/bfd_profiles_topo1/r4/bgpd.conf
index 200937a9a5..12d68270f8 100644
--- a/tests/topotests/bfd_profiles_topo1/r4/bgpd.conf
+++ b/tests/topotests/bfd_profiles_topo1/r4/bgpd.conf
@@ -1,4 +1,4 @@
-debug bgp neighbor-events
+! debug bgp neighbor-events
!
router bgp 200
bgp router-id 10.254.254.4
diff --git a/tests/topotests/bfd_profiles_topo1/r4/isisd.conf b/tests/topotests/bfd_profiles_topo1/r4/isisd.conf
index d8ffc9bc2c..18009ce6dc 100644
--- a/tests/topotests/bfd_profiles_topo1/r4/isisd.conf
+++ b/tests/topotests/bfd_profiles_topo1/r4/isisd.conf
@@ -1,8 +1,8 @@
hostname r4
!
-debug isis adj-packets
-debug isis events
-debug isis update-packets
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
!
interface r4-eth0
ipv6 router isis lan
diff --git a/tests/topotests/bfd_profiles_topo1/r5/bfdd.conf b/tests/topotests/bfd_profiles_topo1/r5/bfdd.conf
index 74dae5a60d..670fd44165 100644
--- a/tests/topotests/bfd_profiles_topo1/r5/bfdd.conf
+++ b/tests/topotests/bfd_profiles_topo1/r5/bfdd.conf
@@ -1,6 +1,6 @@
-debug bfd peer
-debug bfd network
-debug bfd zebra
+! debug bfd peer
+! debug bfd network
+! debug bfd zebra
!
bfd
! profile is commented out on purpose.
diff --git a/tests/topotests/bfd_profiles_topo1/r6/bfdd.conf b/tests/topotests/bfd_profiles_topo1/r6/bfdd.conf
index 74dae5a60d..670fd44165 100644
--- a/tests/topotests/bfd_profiles_topo1/r6/bfdd.conf
+++ b/tests/topotests/bfd_profiles_topo1/r6/bfdd.conf
@@ -1,6 +1,6 @@
-debug bfd peer
-debug bfd network
-debug bfd zebra
+! debug bfd peer
+! debug bfd network
+! debug bfd zebra
!
bfd
! profile is commented out on purpose.
diff --git a/tests/topotests/bfd_topo1/r1/bfdd.conf b/tests/topotests/bfd_topo1/r1/bfdd.conf
index 4102000337..b9efbafbc5 100644
--- a/tests/topotests/bfd_topo1/r1/bfdd.conf
+++ b/tests/topotests/bfd_topo1/r1/bfdd.conf
@@ -1,7 +1,7 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
bfd
peer 192.168.0.2
diff --git a/tests/topotests/bfd_topo1/r2/bfdd.conf b/tests/topotests/bfd_topo1/r2/bfdd.conf
index 412450ca1e..0d1e17e3ff 100644
--- a/tests/topotests/bfd_topo1/r2/bfdd.conf
+++ b/tests/topotests/bfd_topo1/r2/bfdd.conf
@@ -1,7 +1,7 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
bfd
peer 192.168.0.1
diff --git a/tests/topotests/bfd_topo1/r3/bfdd.conf b/tests/topotests/bfd_topo1/r3/bfdd.conf
index 4cf20bb904..e091a1c41d 100644
--- a/tests/topotests/bfd_topo1/r3/bfdd.conf
+++ b/tests/topotests/bfd_topo1/r3/bfdd.conf
@@ -1,7 +1,7 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
bfd
peer 192.168.1.2
diff --git a/tests/topotests/bfd_topo1/r4/bfdd.conf b/tests/topotests/bfd_topo1/r4/bfdd.conf
index 34b88c9a35..63dd738451 100644
--- a/tests/topotests/bfd_topo1/r4/bfdd.conf
+++ b/tests/topotests/bfd_topo1/r4/bfdd.conf
@@ -1,7 +1,7 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
bfd
peer 192.168.2.2
diff --git a/tests/topotests/bfd_topo2/r1/bfdd.conf b/tests/topotests/bfd_topo2/r1/bfdd.conf
index f03135021e..df8baeb5af 100644
--- a/tests/topotests/bfd_topo2/r1/bfdd.conf
+++ b/tests/topotests/bfd_topo2/r1/bfdd.conf
@@ -1,7 +1,7 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
bfd
peer 2001:db8:4::1 multihop local-address 2001:db8:1::1
diff --git a/tests/topotests/bfd_topo2/r2/bfdd.conf b/tests/topotests/bfd_topo2/r2/bfdd.conf
index f35e772790..ee7144d003 100644
--- a/tests/topotests/bfd_topo2/r2/bfdd.conf
+++ b/tests/topotests/bfd_topo2/r2/bfdd.conf
@@ -1,5 +1,5 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
diff --git a/tests/topotests/bfd_topo2/r3/bfdd.conf b/tests/topotests/bfd_topo2/r3/bfdd.conf
index f35e772790..ee7144d003 100644
--- a/tests/topotests/bfd_topo2/r3/bfdd.conf
+++ b/tests/topotests/bfd_topo2/r3/bfdd.conf
@@ -1,5 +1,5 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
diff --git a/tests/topotests/bfd_topo2/r4/bfdd.conf b/tests/topotests/bfd_topo2/r4/bfdd.conf
index 0173dc9be2..c1e8d28e96 100644
--- a/tests/topotests/bfd_topo2/r4/bfdd.conf
+++ b/tests/topotests/bfd_topo2/r4/bfdd.conf
@@ -1,7 +1,7 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
bfd
peer 2001:db8:1::1 multihop local-address 2001:db8:4::1
diff --git a/tests/topotests/bfd_topo3/r1/bfd-peers.json b/tests/topotests/bfd_topo3/r1/bfd-peers.json
index f8a354fc20..3ce8d97f15 100644
--- a/tests/topotests/bfd_topo3/r1/bfd-peers.json
+++ b/tests/topotests/bfd_topo3/r1/bfd-peers.json
@@ -18,9 +18,8 @@
"remote-receive-interval": 2000,
"remote-transmit-interval": 2000,
"status": "up",
- "transmit-interval": 2000,
"uptime": "*",
- "vrf": "default"
+ "transmit-interval": 2000
},
{
"detect-multiplier": 3,
@@ -41,9 +40,8 @@
"remote-receive-interval": 600,
"remote-transmit-interval": 600,
"status": "up",
- "transmit-interval": 600,
"uptime": "*",
- "vrf": "default"
+ "transmit-interval": 600
},
{
"detect-multiplier": 3,
@@ -64,8 +62,7 @@
"remote-receive-interval": 2000,
"remote-transmit-interval": 2000,
"status": "up",
- "transmit-interval": 2000,
"uptime": "*",
- "vrf": "default"
+ "transmit-interval": 2000
}
]
diff --git a/tests/topotests/bfd_topo3/r1/bfdd.conf b/tests/topotests/bfd_topo3/r1/bfdd.conf
index 8e40b76d41..60f129b48d 100644
--- a/tests/topotests/bfd_topo3/r1/bfdd.conf
+++ b/tests/topotests/bfd_topo3/r1/bfdd.conf
@@ -1,7 +1,7 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
bfd
profile fast-tx
diff --git a/tests/topotests/bfd_topo3/r2/bfd-peers.json b/tests/topotests/bfd_topo3/r2/bfd-peers.json
index 786d66dbe3..a40f7e46cf 100644
--- a/tests/topotests/bfd_topo3/r2/bfd-peers.json
+++ b/tests/topotests/bfd_topo3/r2/bfd-peers.json
@@ -18,9 +18,8 @@
"remote-receive-interval": 600,
"remote-transmit-interval": 600,
"status": "up",
- "transmit-interval": 600,
"uptime": "*",
- "vrf": "default"
+ "transmit-interval": 600
},
{
"detect-multiplier": 3,
@@ -41,8 +40,7 @@
"remote-receive-interval": 2000,
"remote-transmit-interval": 2000,
"status": "up",
- "transmit-interval": 2000,
"uptime": "*",
- "vrf": "default"
+ "transmit-interval": 2000
}
]
diff --git a/tests/topotests/bfd_topo3/r2/bfdd.conf b/tests/topotests/bfd_topo3/r2/bfdd.conf
index 2a92e463e0..8297043e6d 100644
--- a/tests/topotests/bfd_topo3/r2/bfdd.conf
+++ b/tests/topotests/bfd_topo3/r2/bfdd.conf
@@ -1,7 +1,7 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
bfd
profile fast-tx
diff --git a/tests/topotests/bfd_topo3/r3/bfd-peers.json b/tests/topotests/bfd_topo3/r3/bfd-peers.json
index 1f58663a4e..2182b26ed3 100644
--- a/tests/topotests/bfd_topo3/r3/bfd-peers.json
+++ b/tests/topotests/bfd_topo3/r3/bfd-peers.json
@@ -18,9 +18,8 @@
"remote-receive-interval": 2000,
"remote-transmit-interval": 2000,
"status": "up",
- "transmit-interval": 2000,
"uptime": "*",
- "vrf": "default"
+ "transmit-interval": 2000
},
{
"detect-multiplier": 3,
@@ -41,9 +40,8 @@
"remote-receive-interval": 2000,
"remote-transmit-interval": 2000,
"status": "up",
- "transmit-interval": 2000,
"uptime": "*",
- "vrf": "default"
+ "transmit-interval": 2000
},
{
"detect-multiplier": 3,
@@ -64,8 +62,7 @@
"remote-receive-interval": 2000,
"remote-transmit-interval": 2000,
"status": "up",
- "transmit-interval": 2000,
"uptime": "*",
- "vrf": "default"
+ "transmit-interval": 2000
}
]
diff --git a/tests/topotests/bfd_topo3/r3/bfdd.conf b/tests/topotests/bfd_topo3/r3/bfdd.conf
index f7972c6ce5..51ce2ac0c8 100644
--- a/tests/topotests/bfd_topo3/r3/bfdd.conf
+++ b/tests/topotests/bfd_topo3/r3/bfdd.conf
@@ -1,7 +1,7 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
bfd
profile slow-tx
diff --git a/tests/topotests/bfd_topo3/r4/bfd-peers.json b/tests/topotests/bfd_topo3/r4/bfd-peers.json
index 5477f39120..2f41f25c58 100644
--- a/tests/topotests/bfd_topo3/r4/bfd-peers.json
+++ b/tests/topotests/bfd_topo3/r4/bfd-peers.json
@@ -18,9 +18,8 @@
"remote-receive-interval": 2000,
"remote-transmit-interval": 2000,
"status": "up",
- "transmit-interval": 2000,
"uptime": "*",
- "vrf": "default"
+ "transmit-interval": 2000
},
{
"detect-multiplier": 3,
@@ -41,8 +40,7 @@
"remote-receive-interval": 2000,
"remote-transmit-interval": 2000,
"status": "up",
- "transmit-interval": 2000,
"uptime": "*",
- "vrf": "default"
+ "transmit-interval": 2000
}
]
diff --git a/tests/topotests/bfd_topo3/r4/bfdd.conf b/tests/topotests/bfd_topo3/r4/bfdd.conf
index f44abc0b8a..e5fc1647cf 100644
--- a/tests/topotests/bfd_topo3/r4/bfdd.conf
+++ b/tests/topotests/bfd_topo3/r4/bfdd.conf
@@ -1,7 +1,7 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
bfd
profile slow-tx
diff --git a/tests/topotests/bfd_vrf_topo1/r1/bfdd.conf b/tests/topotests/bfd_vrf_topo1/r1/bfdd.conf
index fd57b2c4d5..8fca099686 100644
--- a/tests/topotests/bfd_vrf_topo1/r1/bfdd.conf
+++ b/tests/topotests/bfd_vrf_topo1/r1/bfdd.conf
@@ -1,7 +1,7 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
bfd
peer 192.168.0.2 vrf r1-bfd-cust1
diff --git a/tests/topotests/bfd_vrf_topo1/r2/bfdd.conf b/tests/topotests/bfd_vrf_topo1/r2/bfdd.conf
index e5539f14e5..4490090ec6 100644
--- a/tests/topotests/bfd_vrf_topo1/r2/bfdd.conf
+++ b/tests/topotests/bfd_vrf_topo1/r2/bfdd.conf
@@ -1,7 +1,7 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
bfd
peer 192.168.0.1 vrf r2-bfd-cust1
diff --git a/tests/topotests/bfd_vrf_topo1/r3/bfdd.conf b/tests/topotests/bfd_vrf_topo1/r3/bfdd.conf
index e1f53e1abc..0333320898 100644
--- a/tests/topotests/bfd_vrf_topo1/r3/bfdd.conf
+++ b/tests/topotests/bfd_vrf_topo1/r3/bfdd.conf
@@ -1,7 +1,7 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
bfd
peer 192.168.1.2 vrf r3-bfd-cust1
diff --git a/tests/topotests/bfd_vrf_topo1/r4/bfdd.conf b/tests/topotests/bfd_vrf_topo1/r4/bfdd.conf
index 9ef2023b21..119e5e5e40 100644
--- a/tests/topotests/bfd_vrf_topo1/r4/bfdd.conf
+++ b/tests/topotests/bfd_vrf_topo1/r4/bfdd.conf
@@ -1,7 +1,7 @@
!
-debug bfd network
-debug bfd peer
-debug bfd zebra
+! debug bfd network
+! debug bfd peer
+! debug bfd zebra
!
bfd
peer 192.168.2.2 vrf r4-bfd-cust1
diff --git a/tests/topotests/bgp_aggregate_address_topo1/r1/bgpd.conf b/tests/topotests/bgp_aggregate_address_topo1/r1/bgpd.conf
index fa52150085..c7cf4a527f 100644
--- a/tests/topotests/bgp_aggregate_address_topo1/r1/bgpd.conf
+++ b/tests/topotests/bgp_aggregate_address_topo1/r1/bgpd.conf
@@ -1,4 +1,4 @@
-debug bgp updates
+! debug bgp updates
!
access-list acl-sup-one seq 5 permit 192.168.2.1/32
access-list acl-sup-one seq 10 deny any
diff --git a/tests/topotests/bgp_auth/R1/bgpd_multi_vrf.conf b/tests/topotests/bgp_auth/R1/bgpd_multi_vrf.conf
index 071b559462..644e01c0b4 100644
--- a/tests/topotests/bgp_auth/R1/bgpd_multi_vrf.conf
+++ b/tests/topotests/bgp_auth/R1/bgpd_multi_vrf.conf
@@ -1,4 +1,4 @@
-debug bgp neighbor-events
+! debug bgp neighbor-events
router bgp 65001 vrf blue
timers bgp 3 9
diff --git a/tests/topotests/bgp_auth/R1/bgpd_vrf.conf b/tests/topotests/bgp_auth/R1/bgpd_vrf.conf
index fc0ae53b11..5799da165a 100644
--- a/tests/topotests/bgp_auth/R1/bgpd_vrf.conf
+++ b/tests/topotests/bgp_auth/R1/bgpd_vrf.conf
@@ -1,4 +1,4 @@
-debug bgp neighbor-events
+! debug bgp neighbor-events
router bgp 65001 vrf blue
timers bgp 3 9
diff --git a/tests/topotests/bgp_ecmp_topo1/peer1/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer1/exa-send.py
index d9ae3d1906..6bef35508f 100755
--- a/tests/topotests/bgp_ecmp_topo1/peer1/exa-send.py
+++ b/tests/topotests/bgp_ecmp_topo1/peer1/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_ecmp_topo1/peer10/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer10/exa-send.py
index d9ae3d1906..6bef35508f 100755
--- a/tests/topotests/bgp_ecmp_topo1/peer10/exa-send.py
+++ b/tests/topotests/bgp_ecmp_topo1/peer10/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_ecmp_topo1/peer11/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer11/exa-send.py
index d9ae3d1906..6bef35508f 100755
--- a/tests/topotests/bgp_ecmp_topo1/peer11/exa-send.py
+++ b/tests/topotests/bgp_ecmp_topo1/peer11/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_ecmp_topo1/peer12/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer12/exa-send.py
index d9ae3d1906..6bef35508f 100755
--- a/tests/topotests/bgp_ecmp_topo1/peer12/exa-send.py
+++ b/tests/topotests/bgp_ecmp_topo1/peer12/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_ecmp_topo1/peer13/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer13/exa-send.py
index d9ae3d1906..6bef35508f 100755
--- a/tests/topotests/bgp_ecmp_topo1/peer13/exa-send.py
+++ b/tests/topotests/bgp_ecmp_topo1/peer13/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_ecmp_topo1/peer14/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer14/exa-send.py
index d9ae3d1906..6bef35508f 100755
--- a/tests/topotests/bgp_ecmp_topo1/peer14/exa-send.py
+++ b/tests/topotests/bgp_ecmp_topo1/peer14/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_ecmp_topo1/peer15/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer15/exa-send.py
index d9ae3d1906..6bef35508f 100755
--- a/tests/topotests/bgp_ecmp_topo1/peer15/exa-send.py
+++ b/tests/topotests/bgp_ecmp_topo1/peer15/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_ecmp_topo1/peer16/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer16/exa-send.py
index d9ae3d1906..6bef35508f 100755
--- a/tests/topotests/bgp_ecmp_topo1/peer16/exa-send.py
+++ b/tests/topotests/bgp_ecmp_topo1/peer16/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_ecmp_topo1/peer17/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer17/exa-send.py
index d9ae3d1906..6bef35508f 100755
--- a/tests/topotests/bgp_ecmp_topo1/peer17/exa-send.py
+++ b/tests/topotests/bgp_ecmp_topo1/peer17/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_ecmp_topo1/peer18/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer18/exa-send.py
index d9ae3d1906..6bef35508f 100755
--- a/tests/topotests/bgp_ecmp_topo1/peer18/exa-send.py
+++ b/tests/topotests/bgp_ecmp_topo1/peer18/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_ecmp_topo1/peer19/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer19/exa-send.py
index d9ae3d1906..6bef35508f 100755
--- a/tests/topotests/bgp_ecmp_topo1/peer19/exa-send.py
+++ b/tests/topotests/bgp_ecmp_topo1/peer19/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_ecmp_topo1/peer2/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer2/exa-send.py
index d9ae3d1906..6bef35508f 100755
--- a/tests/topotests/bgp_ecmp_topo1/peer2/exa-send.py
+++ b/tests/topotests/bgp_ecmp_topo1/peer2/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_ecmp_topo1/peer20/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer20/exa-send.py
index d9ae3d1906..6bef35508f 100755
--- a/tests/topotests/bgp_ecmp_topo1/peer20/exa-send.py
+++ b/tests/topotests/bgp_ecmp_topo1/peer20/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_ecmp_topo1/peer3/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer3/exa-send.py
index d9ae3d1906..6bef35508f 100755
--- a/tests/topotests/bgp_ecmp_topo1/peer3/exa-send.py
+++ b/tests/topotests/bgp_ecmp_topo1/peer3/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_ecmp_topo1/peer4/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer4/exa-send.py
index d9ae3d1906..6bef35508f 100755
--- a/tests/topotests/bgp_ecmp_topo1/peer4/exa-send.py
+++ b/tests/topotests/bgp_ecmp_topo1/peer4/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_ecmp_topo1/peer5/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer5/exa-send.py
index d9ae3d1906..6bef35508f 100755
--- a/tests/topotests/bgp_ecmp_topo1/peer5/exa-send.py
+++ b/tests/topotests/bgp_ecmp_topo1/peer5/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_ecmp_topo1/peer6/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer6/exa-send.py
index d9ae3d1906..6bef35508f 100755
--- a/tests/topotests/bgp_ecmp_topo1/peer6/exa-send.py
+++ b/tests/topotests/bgp_ecmp_topo1/peer6/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_ecmp_topo1/peer7/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer7/exa-send.py
index d9ae3d1906..6bef35508f 100755
--- a/tests/topotests/bgp_ecmp_topo1/peer7/exa-send.py
+++ b/tests/topotests/bgp_ecmp_topo1/peer7/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_ecmp_topo1/peer8/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer8/exa-send.py
index d9ae3d1906..6bef35508f 100755
--- a/tests/topotests/bgp_ecmp_topo1/peer8/exa-send.py
+++ b/tests/topotests/bgp_ecmp_topo1/peer8/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_ecmp_topo1/peer9/exa-send.py b/tests/topotests/bgp_ecmp_topo1/peer9/exa-send.py
index d9ae3d1906..6bef35508f 100755
--- a/tests/topotests/bgp_ecmp_topo1/peer9/exa-send.py
+++ b/tests/topotests/bgp_ecmp_topo1/peer9/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_ecmp_topo1/r1/summary.txt b/tests/topotests/bgp_ecmp_topo1/r1/summary.txt
index f0929536d3..68de28a35b 100644
--- a/tests/topotests/bgp_ecmp_topo1/r1/summary.txt
+++ b/tests/topotests/bgp_ecmp_topo1/r1/summary.txt
@@ -2,7 +2,7 @@
"ipv4Unicast":{
"routerId":"10.0.255.1",
"as":100,
- "vrfName":"Default",
+ "vrfName":"default",
"peerCount":20,
"peers":{
"10.0.1.101":{
diff --git a/tests/topotests/bgp_ecmp_topo1/r1/summary20.txt b/tests/topotests/bgp_ecmp_topo1/r1/summary20.txt
index 9015f485f8..4895cdbecf 100644
--- a/tests/topotests/bgp_ecmp_topo1/r1/summary20.txt
+++ b/tests/topotests/bgp_ecmp_topo1/r1/summary20.txt
@@ -1,7 +1,7 @@
{
"routerId":"10.0.255.1",
"as":100,
- "vrfName":"Default",
+ "vrfName":"default",
"peerCount":20,
"peers":{
"10.0.1.101":{
diff --git a/tests/topotests/bgp_ecmp_topo1/test_bgp_ecmp_topo1.py b/tests/topotests/bgp_ecmp_topo1/test_bgp_ecmp_topo1.py
index 7b9ef0a505..96e4bf6ed3 100644
--- a/tests/topotests/bgp_ecmp_topo1/test_bgp_ecmp_topo1.py
+++ b/tests/topotests/bgp_ecmp_topo1/test_bgp_ecmp_topo1.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
#
# test_bgp_ecmp_topo1.py
@@ -140,12 +140,6 @@ def test_bgp_convergence():
with 'json') and compare with `data` contents.
"""
output = router.vtysh_cmd(cmd, isjson=True)
- if "ipv4Unicast" in output:
- output["ipv4Unicast"]["vrfName"] = output["ipv4Unicast"]["vrfName"].replace(
- "default", "Default"
- )
- elif "vrfName" in output:
- output["vrfName"] = output["vrfName"].replace("default", "Default")
return topotest.json_cmp(output, data)
test_func = functools.partial(
diff --git a/tests/topotests/bgp_ecmp_topo3/test_ibgp_ecmp_topo3.py b/tests/topotests/bgp_ecmp_topo3/test_ibgp_ecmp_topo3.py
index 54b3e80da5..2a51dc83ef 100644
--- a/tests/topotests/bgp_ecmp_topo3/test_ibgp_ecmp_topo3.py
+++ b/tests/topotests/bgp_ecmp_topo3/test_ibgp_ecmp_topo3.py
@@ -29,6 +29,7 @@ import os
import sys
import time
import pytest
+import re
from time import sleep
# Save the Current Working Directory to find configuration files.
@@ -221,6 +222,9 @@ def test_ecmp_fast_convergence(request, test_type, tgen, topo):
shutdown_bringup_interface(tgen, "r2", intf1, True)
shutdown_bringup_interface(tgen, "r2", intf2, True)
+ logger.info("Ensure that the links are still up")
+ result = verify_bgp_convergence(tgen, topo)
+
logger.info("Enable bgp fast-convergence cli")
raw_config = {
"r2": {
@@ -233,6 +237,13 @@ def test_ecmp_fast_convergence(request, test_type, tgen, topo):
result = apply_raw_config(tgen, raw_config)
assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
+ logger.info("Ensure BGP has processed the cli")
+ r2 = tgen.gears["r2"]
+ output = r2.vtysh_cmd("show run")
+ verify = re.search(r"fast-convergence", output )
+ assert verify is not None, (
+ "r2 does not have the fast convergence command yet")
+
logger.info("Shutdown one link b/w r2 and r3")
shutdown_bringup_interface(tgen, "r2", intf1, False)
diff --git a/tests/topotests/bgp_evpn_mh/torm11/evpn.conf b/tests/topotests/bgp_evpn_mh/torm11/evpn.conf
index 01f4b65704..2c1c695a18 100644
--- a/tests/topotests/bgp_evpn_mh/torm11/evpn.conf
+++ b/tests/topotests/bgp_evpn_mh/torm11/evpn.conf
@@ -1,9 +1,9 @@
!
frr defaults datacenter
!
-debug bgp evpn mh es
-debug bgp evpn mh route
-debug bgp zebra
+! debug bgp evpn mh es
+! debug bgp evpn mh route
+! debug bgp zebra
!
!
router bgp 65002
diff --git a/tests/topotests/bgp_evpn_mh/torm11/zebra.conf b/tests/topotests/bgp_evpn_mh/torm11/zebra.conf
index 33e89c06ae..a88370d06b 100644
--- a/tests/topotests/bgp_evpn_mh/torm11/zebra.conf
+++ b/tests/topotests/bgp_evpn_mh/torm11/zebra.conf
@@ -1,8 +1,8 @@
-debug zebra evpn mh es
-debug zebra evpn mh mac
-debug zebra evpn mh neigh
-debug zebra evpn mh nh
-debug zebra vxlan
+! debug zebra evpn mh es
+! debug zebra evpn mh mac
+! debug zebra evpn mh neigh
+! debug zebra evpn mh nh
+! debug zebra vxlan
!
evpn mh startup-delay 1
!
diff --git a/tests/topotests/bgp_evpn_mh/torm12/evpn.conf b/tests/topotests/bgp_evpn_mh/torm12/evpn.conf
index 2c13024bbc..8b0ce1d98f 100644
--- a/tests/topotests/bgp_evpn_mh/torm12/evpn.conf
+++ b/tests/topotests/bgp_evpn_mh/torm12/evpn.conf
@@ -1,9 +1,9 @@
!
frr defaults datacenter
!
-debug bgp evpn mh es
-debug bgp evpn mh route
-debug bgp zebra
+! debug bgp evpn mh es
+! debug bgp evpn mh route
+! debug bgp zebra
!
!
router bgp 65003
diff --git a/tests/topotests/bgp_evpn_mh/torm12/zebra.conf b/tests/topotests/bgp_evpn_mh/torm12/zebra.conf
index 419f62b2ac..95327628f4 100644
--- a/tests/topotests/bgp_evpn_mh/torm12/zebra.conf
+++ b/tests/topotests/bgp_evpn_mh/torm12/zebra.conf
@@ -1,8 +1,8 @@
-debug zebra evpn mh es
-debug zebra evpn mh mac
-debug zebra evpn mh neigh
-debug zebra evpn mh nh
-debug zebra vxlan
+! debug zebra evpn mh es
+! debug zebra evpn mh mac
+! debug zebra evpn mh neigh
+! debug zebra evpn mh nh
+! debug zebra vxlan
!
evpn mh startup-delay 1
!
diff --git a/tests/topotests/bgp_evpn_mh/torm21/evpn.conf b/tests/topotests/bgp_evpn_mh/torm21/evpn.conf
index 2a2ba061c6..5247dc1ebd 100644
--- a/tests/topotests/bgp_evpn_mh/torm21/evpn.conf
+++ b/tests/topotests/bgp_evpn_mh/torm21/evpn.conf
@@ -1,9 +1,9 @@
!
frr defaults datacenter
!
-debug bgp evpn mh es
-debug bgp evpn mh route
-debug bgp zebra
+! debug bgp evpn mh es
+! debug bgp evpn mh route
+! debug bgp zebra
!
!
router bgp 65004
diff --git a/tests/topotests/bgp_evpn_mh/torm21/zebra.conf b/tests/topotests/bgp_evpn_mh/torm21/zebra.conf
index 525f5eb099..6c75df73c3 100644
--- a/tests/topotests/bgp_evpn_mh/torm21/zebra.conf
+++ b/tests/topotests/bgp_evpn_mh/torm21/zebra.conf
@@ -1,8 +1,8 @@
-debug zebra evpn mh es
-debug zebra evpn mh mac
-debug zebra evpn mh neigh
-debug zebra evpn mh nh
-debug zebra vxlan
+! debug zebra evpn mh es
+! debug zebra evpn mh mac
+! debug zebra evpn mh neigh
+! debug zebra evpn mh nh
+! debug zebra vxlan
!
evpn mh startup-delay 1
!
diff --git a/tests/topotests/bgp_evpn_mh/torm22/evpn.conf b/tests/topotests/bgp_evpn_mh/torm22/evpn.conf
index 432135c94a..ec56360176 100644
--- a/tests/topotests/bgp_evpn_mh/torm22/evpn.conf
+++ b/tests/topotests/bgp_evpn_mh/torm22/evpn.conf
@@ -1,9 +1,9 @@
!
frr defaults datacenter
!
-debug bgp evpn mh es
-debug bgp evpn mh route
-debug bgp zebra
+! debug bgp evpn mh es
+! debug bgp evpn mh route
+! debug bgp zebra
!
router bgp 65005
bgp router-id 192.168.100.18
diff --git a/tests/topotests/bgp_evpn_mh/torm22/zebra.conf b/tests/topotests/bgp_evpn_mh/torm22/zebra.conf
index 398064df6c..4c949668a2 100644
--- a/tests/topotests/bgp_evpn_mh/torm22/zebra.conf
+++ b/tests/topotests/bgp_evpn_mh/torm22/zebra.conf
@@ -1,8 +1,8 @@
-debug zebra evpn mh es
-debug zebra evpn mh mac
-debug zebra evpn mh neigh
-debug zebra evpn mh nh
-debug zebra vxlan
+! debug zebra evpn mh es
+! debug zebra evpn mh mac
+! debug zebra evpn mh neigh
+! debug zebra evpn mh nh
+! debug zebra vxlan
!
evpn mh startup-delay 1
!
diff --git a/tests/topotests/bgp_evpn_rt5/r1/bgpd.conf b/tests/topotests/bgp_evpn_rt5/r1/bgpd.conf
index 9237682067..ccbeae6ed7 100644
--- a/tests/topotests/bgp_evpn_rt5/r1/bgpd.conf
+++ b/tests/topotests/bgp_evpn_rt5/r1/bgpd.conf
@@ -1,6 +1,6 @@
-debug bgp neighbor-events
-debug bgp updates
-debug bgp zebra
+! debug bgp neighbor-events
+! debug bgp updates
+! debug bgp zebra
router bgp 65000
bgp router-id 192.168.100.21
bgp log-neighbor-changes
diff --git a/tests/topotests/bgp_evpn_rt5/r1/zebra.conf b/tests/topotests/bgp_evpn_rt5/r1/zebra.conf
index f5eaab1953..4f1804c676 100644
--- a/tests/topotests/bgp_evpn_rt5/r1/zebra.conf
+++ b/tests/topotests/bgp_evpn_rt5/r1/zebra.conf
@@ -3,10 +3,10 @@ log stdout
hostname r1
password zebra
-debug zebra vxlan
-debug zebra kernel
-debug zebra dplane
-debug zebra rib
+! debug zebra vxlan
+! debug zebra kernel
+! debug zebra dplane
+! debug zebra rib
log stdout
vrf r1-vrf-101
vni 101
diff --git a/tests/topotests/bgp_evpn_rt5/r2/bgpd.conf b/tests/topotests/bgp_evpn_rt5/r2/bgpd.conf
index 6dcacd288d..744c259d9a 100644
--- a/tests/topotests/bgp_evpn_rt5/r2/bgpd.conf
+++ b/tests/topotests/bgp_evpn_rt5/r2/bgpd.conf
@@ -1,6 +1,6 @@
-debug bgp neighbor-events
-debug bgp updates
-debug bgp zebra
+! debug bgp neighbor-events
+! debug bgp updates
+! debug bgp zebra
router bgp 65000
bgp router-id 192.168.100.41
bgp log-neighbor-changes
diff --git a/tests/topotests/bgp_evpn_rt5/r2/zebra.conf b/tests/topotests/bgp_evpn_rt5/r2/zebra.conf
index e5f962d254..7d19a5b381 100644
--- a/tests/topotests/bgp_evpn_rt5/r2/zebra.conf
+++ b/tests/topotests/bgp_evpn_rt5/r2/zebra.conf
@@ -3,7 +3,7 @@ log stdout
hostname r2
password zebra
-debug zebra vxlan
+! debug zebra vxlan
vrf r2-vrf-101
vni 101
diff --git a/tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py b/tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py
index 6ea281e6f0..3e2fb2b6e0 100644
--- a/tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py
+++ b/tests/topotests/bgp_evpn_rt5/test_bgp_evpn.py
@@ -148,7 +148,7 @@ def setup_module(mod):
router.load_config(
TopoRouter.RD_ZEBRA,
os.path.join(CWD, "{}/zebra.conf".format(rname)),
- "--vrfwnetns -o vrf0",
+ "--vrfwnetns",
)
else:
router.load_config(
diff --git a/tests/topotests/bgp_extended_optional_parameters_length/__init__.py b/tests/topotests/bgp_extended_optional_parameters_length/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/topotests/bgp_extended_optional_parameters_length/__init__.py
diff --git a/tests/topotests/bgp_extended_optional_parameters_length/r1/bgpd.conf b/tests/topotests/bgp_extended_optional_parameters_length/r1/bgpd.conf
new file mode 100644
index 0000000000..d83013ca99
--- /dev/null
+++ b/tests/topotests/bgp_extended_optional_parameters_length/r1/bgpd.conf
@@ -0,0 +1,6 @@
+!
+router bgp 65001
+ no bgp ebgp-requires-policy
+ neighbor 192.168.1.2 remote-as external
+ neighbor 192.168.1.2 extended-optional-parameters
+!
diff --git a/tests/topotests/bgp_extended_optional_parameters_length/r1/zebra.conf b/tests/topotests/bgp_extended_optional_parameters_length/r1/zebra.conf
new file mode 100644
index 0000000000..b29940f46a
--- /dev/null
+++ b/tests/topotests/bgp_extended_optional_parameters_length/r1/zebra.conf
@@ -0,0 +1,4 @@
+!
+int r1-eth0
+ ip address 192.168.1.1/24
+!
diff --git a/tests/topotests/bgp_extended_optional_parameters_length/r2/bgpd.conf b/tests/topotests/bgp_extended_optional_parameters_length/r2/bgpd.conf
new file mode 100644
index 0000000000..e390d6ed8d
--- /dev/null
+++ b/tests/topotests/bgp_extended_optional_parameters_length/r2/bgpd.conf
@@ -0,0 +1,8 @@
+router bgp 65002
+ no bgp ebgp-requires-policy
+ neighbor 192.168.1.1 remote-as external
+ neighbor 192.168.1.1 extended-optional-parameters
+ address-family ipv4 unicast
+ redistribute connected
+ exit-address-family
+!
diff --git a/tests/topotests/bgp_extended_optional_parameters_length/r2/zebra.conf b/tests/topotests/bgp_extended_optional_parameters_length/r2/zebra.conf
new file mode 100644
index 0000000000..dc15cf756a
--- /dev/null
+++ b/tests/topotests/bgp_extended_optional_parameters_length/r2/zebra.conf
@@ -0,0 +1,7 @@
+!
+int lo
+ ip address 172.16.16.1/32
+!
+int r2-eth0
+ ip address 192.168.1.2/24
+!
diff --git a/tests/topotests/bgp_extended_optional_parameters_length/test_bgp_extended_optional_parameters_length.py b/tests/topotests/bgp_extended_optional_parameters_length/test_bgp_extended_optional_parameters_length.py
new file mode 100644
index 0000000000..e677dc6ff6
--- /dev/null
+++ b/tests/topotests/bgp_extended_optional_parameters_length/test_bgp_extended_optional_parameters_length.py
@@ -0,0 +1,106 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2021 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 Extended Optional Parameters Length encoding format works
+if forced with a knob.
+https://datatracker.ietf.org/doc/html/rfc9072
+"""
+
+import os
+import sys
+import json
+import pytest
+import functools
+
+pytestmark = pytest.mark.bgpd
+
+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
+
+pytestmark = [pytest.mark.bgpd]
+
+
+def setup_module(mod):
+ topodef = {"s1": ("r1", "r2")}
+ tgen = Topogen(topodef, 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_extended_optional_parameters_length():
+ tgen = get_topogen()
+
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ router = tgen.gears["r1"]
+
+ def _bgp_converge(router):
+ output = json.loads(router.vtysh_cmd("show bgp ipv4 unicast summary json"))
+ expected = {
+ "peers": {
+ "192.168.1.2": {
+ "pfxRcd": 2,
+ "pfxSnt": 2,
+ "state": "Established",
+ "peerState": "OK",
+ }
+ }
+ }
+ return topotest.json_cmp(output, expected)
+
+ test_func = functools.partial(_bgp_converge, router)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ assert result is None, "Can't converge with extended-optional-parameters"
+
+ def _bgp_extended_optional_parameters_length(router):
+ output = json.loads(router.vtysh_cmd("show bgp neighbor 192.168.1.2 json"))
+ expected = {"192.168.1.2": {"extendedOptionalParametersLength": True}}
+ return topotest.json_cmp(output, expected)
+
+ test_func = functools.partial(_bgp_extended_optional_parameters_length, router)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ assert result is None, "Can't see Extended Optional Parameters Length to be used"
+
+
+if __name__ == "__main__":
+ args = ["-s"] + sys.argv[1:]
+ sys.exit(pytest.main(args))
diff --git a/tests/topotests/bgp_features/r1/ospf6d.conf b/tests/topotests/bgp_features/r1/ospf6d.conf
index a38e4b862a..9afc6f4919 100644
--- a/tests/topotests/bgp_features/r1/ospf6d.conf
+++ b/tests/topotests/bgp_features/r1/ospf6d.conf
@@ -1,6 +1,6 @@
log file ospf6d.log
!
-debug ospf6 neighbor
+! debug ospf6 neighbor
!
interface r1-lo
!
diff --git a/tests/topotests/bgp_features/r1/ospf_neighbor.json b/tests/topotests/bgp_features/r1/ospf_neighbor.json
index e742c119da..3b5f46d934 100644
--- a/tests/topotests/bgp_features/r1/ospf_neighbor.json
+++ b/tests/topotests/bgp_features/r1/ospf_neighbor.json
@@ -3,13 +3,13 @@
"192.168.0.2":[
{
"priority":5,
- "state":"Full\/Backup"
+ "converged":"Full"
}
],
"192.168.0.3":[
{
"priority":5,
- "state":"Full\/Backup"
+ "converged":"Full"
}
]
}
diff --git a/tests/topotests/bgp_features/r1/ospfd.conf b/tests/topotests/bgp_features/r1/ospfd.conf
index 68a1bb5c75..aef017fe52 100644
--- a/tests/topotests/bgp_features/r1/ospfd.conf
+++ b/tests/topotests/bgp_features/r1/ospfd.conf
@@ -1,7 +1,7 @@
log file ospfd.log
!
-debug ospf event
-debug ospf zebra
+! debug ospf event
+! debug ospf zebra
!
interface r1-eth1
ip ospf hello-interval 2
diff --git a/tests/topotests/bgp_features/r2/ospf6d.conf b/tests/topotests/bgp_features/r2/ospf6d.conf
index 47bd5a99cc..7fe535651e 100644
--- a/tests/topotests/bgp_features/r2/ospf6d.conf
+++ b/tests/topotests/bgp_features/r2/ospf6d.conf
@@ -1,6 +1,6 @@
log file ospf6d.log
!
-debug ospf6 neighbor
+! debug ospf6 neighbor
!
interface r2-lo
!
diff --git a/tests/topotests/bgp_features/r2/ospf_neighbor.json b/tests/topotests/bgp_features/r2/ospf_neighbor.json
index 2fd589ae25..47bb57cd00 100644
--- a/tests/topotests/bgp_features/r2/ospf_neighbor.json
+++ b/tests/topotests/bgp_features/r2/ospf_neighbor.json
@@ -3,13 +3,13 @@
"192.168.0.1":[
{
"priority":10,
- "state":"Full\/DR"
+ "converged":"Full"
}
],
"192.168.0.3":[
{
"priority":5,
- "state":"Full\/Backup"
+ "converged":"Full"
}
]
}
diff --git a/tests/topotests/bgp_features/r2/ospfd.conf b/tests/topotests/bgp_features/r2/ospfd.conf
index 6f608e454b..7f043c9d74 100644
--- a/tests/topotests/bgp_features/r2/ospfd.conf
+++ b/tests/topotests/bgp_features/r2/ospfd.conf
@@ -1,7 +1,7 @@
log file ospfd.log
!
-debug ospf event
-debug ospf zebra
+! debug ospf event
+! debug ospf zebra
!
int r2-eth1
ip ospf hello-interval 2
diff --git a/tests/topotests/bgp_features/r3/ospf6d.conf b/tests/topotests/bgp_features/r3/ospf6d.conf
index eb74901ba1..07325b69b0 100644
--- a/tests/topotests/bgp_features/r3/ospf6d.conf
+++ b/tests/topotests/bgp_features/r3/ospf6d.conf
@@ -1,6 +1,6 @@
log file ospf6d.log
!
-debug ospf6 neighbor
+! debug ospf6 neighbor
!
interface r3-lo
!
diff --git a/tests/topotests/bgp_features/r3/ospf_neighbor.json b/tests/topotests/bgp_features/r3/ospf_neighbor.json
index 80fc92c3bc..b84974ccca 100644
--- a/tests/topotests/bgp_features/r3/ospf_neighbor.json
+++ b/tests/topotests/bgp_features/r3/ospf_neighbor.json
@@ -3,13 +3,13 @@
"192.168.0.1":[
{
"priority":10,
- "state":"Full\/DR"
+ "converged":"Full"
}
],
"192.168.0.2":[
{
"priority":10,
- "state":"Full\/DR"
+ "converged":"Full"
}
]
}
diff --git a/tests/topotests/bgp_features/r3/ospfd.conf b/tests/topotests/bgp_features/r3/ospfd.conf
index 71e4f1e1df..c3399fd60d 100644
--- a/tests/topotests/bgp_features/r3/ospfd.conf
+++ b/tests/topotests/bgp_features/r3/ospfd.conf
@@ -1,7 +1,7 @@
log file ospfd.log
!
-debug ospf event
-debug ospf zebra
+! debug ospf event
+! debug ospf zebra
!
int r3-eth1
ip ospf hello-interval 2
diff --git a/tests/topotests/bgp_features/test_bgp_features.py b/tests/topotests/bgp_features/test_bgp_features.py
index 00f5d1fcb1..ab44ba3c83 100644
--- a/tests/topotests/bgp_features/test_bgp_features.py
+++ b/tests/topotests/bgp_features/test_bgp_features.py
@@ -235,20 +235,15 @@ def test_bgp_shutdown_message():
logger.info("Checking BGP shutdown received on router r{}".format(rtrNum))
shut_message = tgen.net["r{}".format(rtrNum)].cmd(
- 'tail bgpd.log | grep "NOTIFICATION.*Cease/Administratively Shutdown"'
+ 'tail bgpd.log | grep "NOTIFICATION.*Cease/Administrative Shutdown"'
)
assertmsg = "BGP shutdown message not received on router R{}".format(rtrNum)
assert shut_message != "", assertmsg
- m = re.search(".*([0-9]+ bytes[ 0-9a-fA-F]+)", shut_message)
- if m:
- found = m.group(1)
- else:
- found = ""
assertmsg = "Incorrect BGP shutdown message received on router R{}".format(
rtrNum
)
- assert found == "8 bytes 41 42 43 44 61 62 63 64", assertmsg
+ assert "ABCDabcd" in shut_message, assertmsg
# tgen.mininet_cli()
diff --git a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-1.py b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-1.py
new file mode 100644
index 0000000000..290bf16fea
--- /dev/null
+++ b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-1.py
@@ -0,0 +1,1542 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2019 by VMware, Inc. ("VMware")
+# Used Copyright (c) 2018 by Network Device Education Foundation, Inc. ("NetDEF")
+# in this file.
+#
+# Permission to use, copy, modify, and/or distribute this software
+# for any purpose with or without fee is hereby granted, provided
+# that the above copyright notice and this permission notice appear
+# in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND VMWARE DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VMWARE BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+#
+
+"""
+Following tests are covered to test BGP Gracefull Restart functionality.
+Basic Common Test steps for all the test case below :
+- Create topology (setup module)
+ Creating 2 routers topology, r1, r2 in IBGP
+- Bring up topology
+- Verify for bgp to converge
+- Configure BGP Garceful Restart on both the routers.
+
+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.
+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 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.
+9. Verify that only GR helper routers keep the stale
+ route entries, not any GR disabled router.
+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. 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
+
+These tests have been broken up into 4 sub python scripts because
+the totality of this run was fairly significant.
+"""
+
+import os
+import sys
+import time
+import pytest
+
+# Save the Current Working Directory to find configuration files.
+CWD = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join("../"))
+sys.path.append(os.path.join("../lib/"))
+
+# pylint: disable=C0413
+# Import topogen and topotest helpers
+from lib.topogen import Topogen, get_topogen
+from lib.topolog import logger
+
+# Required to instantiate the topology builder class.
+
+# Import topoJson from lib, to create topology and initial configuration
+from lib.topojson import build_config_from_json
+from lib.bgp import (
+ clear_bgp,
+ verify_bgp_rib,
+ verify_graceful_restart,
+ create_router_bgp,
+ verify_r_bit,
+ verify_f_bit,
+ verify_bgp_convergence,
+ verify_bgp_convergence_from_running_config,
+)
+
+from lib.common_config import (
+ write_test_header,
+ reset_config_on_routers,
+ start_topology,
+ kill_router_daemons,
+ start_router_daemons,
+ verify_rib,
+ check_address_types,
+ write_test_footer,
+ check_router_status,
+ shutdown_bringup_interface,
+ step,
+ get_frr_ipv6_linklocal,
+ required_linux_kernel_version,
+)
+
+pytestmark = [pytest.mark.bgpd]
+
+
+# Global variables
+NEXT_HOP_IP = {"ipv4": "192.168.1.10", "ipv6": "fd00:0:0:1::10"}
+NEXT_HOP_IP_1 = {"ipv4": "192.168.0.1", "ipv6": "fd00::1"}
+NEXT_HOP_IP_2 = {"ipv4": "192.168.0.2", "ipv6": "fd00::2"}
+BGP_CONVERGENCE = False
+GR_RESTART_TIMER = 20
+PREFERRED_NEXT_HOP = "link_local"
+
+
+def setup_module(mod):
+ """
+ Sets up the pytest environment
+
+ * `mod`: module name
+ """
+
+ global ADDR_TYPES
+
+ # Required linux kernel version for this suite to run.
+ result = required_linux_kernel_version("4.16")
+ if result is not True:
+ pytest.skip("Kernel requirements are not met")
+
+ testsuite_run_time = time.asctime(time.localtime(time.time()))
+ logger.info("Testsuite start time: {}".format(testsuite_run_time))
+ logger.info("=" * 40)
+
+ logger.info("Running setup_module to create topology")
+
+ # This function initiates the topology build with Topogen...
+ json_file = "{}/bgp_gr_topojson_topo1.json".format(CWD)
+ tgen = Topogen(json_file, mod.__name__)
+ global topo
+ topo = tgen.json_topo
+ # ... and here it calls Mininet initialization functions.
+
+ # Starting topology, create tmp files which are loaded to routers
+ # to start deamons and then start routers
+ start_topology(tgen)
+
+ # Creating configuration from JSON
+ build_config_from_json(tgen, topo)
+
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ # Api call verify whether BGP is converged
+ ADDR_TYPES = check_address_types()
+
+ BGP_CONVERGENCE = verify_bgp_convergence(tgen, topo)
+ assert BGP_CONVERGENCE is True, "setup_module : Failed \n Error:" " {}".format(
+ BGP_CONVERGENCE
+ )
+
+ logger.info("Running setup_module() done")
+
+
+def teardown_module(mod):
+ """
+ Teardown the pytest environment
+
+ * `mod`: module name
+ """
+
+ logger.info("Running teardown_module to delete topology")
+
+ tgen = get_topogen()
+
+ # Stop toplogy and Remove tmp files
+ tgen.stop_topology()
+
+ logger.info(
+ "Testsuite end time: {}".format(time.asctime(time.localtime(time.time())))
+ )
+ logger.info("=" * 40)
+
+
+def configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut, peer):
+ """
+ This function groups the repetitive function calls into one function.
+ """
+
+ result = create_router_bgp(tgen, topo, input_dict)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ for addr_type in ADDR_TYPES:
+ neighbor = topo["routers"][peer]["links"]["r1-link1"][addr_type].split("/")[0]
+ clear_bgp(tgen, addr_type, dut, neighbor=neighbor)
+
+ for addr_type in ADDR_TYPES:
+ neighbor = topo["routers"][dut]["links"]["r2-link1"][addr_type].split("/")[0]
+ clear_bgp(tgen, addr_type, peer, neighbor=neighbor)
+
+ result = verify_bgp_convergence_from_running_config(tgen)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ return True
+
+
+def next_hop_per_address_family(
+ tgen, dut, peer, addr_type, next_hop_dict, preferred_next_hop=PREFERRED_NEXT_HOP
+):
+ """
+ This function returns link_local or global next_hop per address-family
+ """
+
+ intferface = topo["routers"][peer]["links"]["{}-link1".format(dut)]["interface"]
+ if addr_type == "ipv6" and "link_local" in preferred_next_hop:
+ next_hop = get_frr_ipv6_linklocal(tgen, peer, intf=intferface)
+ else:
+ next_hop = next_hop_dict[addr_type]
+
+ return next_hop
+
+
+def BGP_GR_TC_50_p1(request):
+ """
+ Test Objective : Transition from Peer-level helper to Global inherit helper
+ Global Mode : None
+ PerPeer Mode : 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 as GR helper node at per Peer-level for R2"
+ " and configure R2 as global restarting node."
+ )
+
+ 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": {"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")
+
+ 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
+ )
+
+ 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"])
+
+ 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(
+ 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("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-helper": False}
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r2": {
+ "dest_link": {
+ "r1-link1": {"graceful-restart-helper": False}
+ }
+ }
+ }
+ }
+ },
+ }
+ }
+ }
+ }
+
+ result = create_router_bgp(tgen, topo, input_dict)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ for addr_type in ADDR_TYPES:
+ neighbor = topo["routers"]["r2"]["links"]["r1-link1"][addr_type].split("/")[0]
+ clear_bgp(tgen, addr_type, "r1", neighbor=neighbor)
+
+ 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 = {
+ "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
+ )
+
+ 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"])
+
+ 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(
+ 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("Start BGP on R2")
+
+ start_router_daemons(tgen, "r2", ["bgpd"])
+
+ write_test_footer(tc_name)
+
+
+def test_BGP_GR_TC_51_p1(request):
+ """
+ Test Objective : Transition from Peer-level restarting to Global inherit helper
+ Global Mode : None
+ PerPeer Mode : GR Restart
+ 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 at per Peer-level for R2")
+
+ 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": {"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
+ )
+
+ 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"])
+
+ step(
+ "Verify that R1 keeps the stale entries in FIB & R2 keeps stale entries in RIB & FIB"
+ )
+
+ 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("Bring up BGP on R1 and remove Peer-level GR config")
+
+ 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}
+ }
+ }
+ }
+ }
+ },
+ }
+ }
+ }
+ }
+
+ result = create_router_bgp(tgen, topo, input_dict)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ for addr_type in ADDR_TYPES:
+ neighbor = topo["routers"]["r2"]["links"]["r1-link1"][addr_type].split("/")[0]
+ clear_bgp(tgen, addr_type, "r1", neighbor=neighbor)
+
+ 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")
+
+ 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
+ )
+
+ 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"])
+
+ 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(
+ 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("Start BGP on R2")
+
+ start_router_daemons(tgen, "r2", ["bgpd"])
+
+ write_test_footer(tc_name)
+
+
+def test_BGP_GR_TC_53_p1(request):
+ """
+ Test Objective : Default GR functional mode is Helper.
+ Global Mode : None
+ PerPeer Mode : None
+ 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 R2 as global restarting node")
+
+ 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 based on 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
+ )
+
+ 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 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(
+ 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("Start BGP on R2")
+
+ start_router_daemons(tgen, "r2", ["bgpd"])
+
+ write_test_footer(tc_name)
+
+
+def test_BGP_GR_TC_4_p0(request):
+ """
+ Test Objective : Verify that the restarting node sets "R" bit while sending the
+ BGP open messages after the node restart, only if GR is 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] 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
+ )
+ 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 {} sec."
+ "So time verify the routes are present in BGP RIB and ZEBRA ".format(
+ GR_RESTART_TIMER
+ )
+ )
+
+ 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 "
+ "r1: routes are still present in BGP RIB\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, protocol, expected=False
+ )
+ assert result is not True, (
+ "Testcase {} : Failed \n "
+ "r1: routes are still present in ZEBRA\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_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")
+ 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
+ )
+
+ write_test_footer(tc_name)
+
+
+def test_BGP_GR_TC_5_1_2_p1(request):
+ """
+ Test Objective : 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.
+
+ """
+ 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[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": 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] : Now flap the link running the BGP session ")
+ # Shutdown interface
+ intf = "r2-r1-eth0"
+ shutdown_bringup_interface(tgen, "r2", intf)
+
+ # Bring up Interface
+ shutdown_bringup_interface(tgen, "r2", intf, ifaceaction=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_r_bit(tgen, topo, addr_type, input_dict, dut="r1", peer="r2")
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ logger.info("[Phase 2] : Restart BGPd on router R2. ")
+ kill_router_daemons(tgen, "r2", ["bgpd"])
+
+ 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_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")
+ 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
+ )
+
+ write_test_footer(tc_name)
+
+
+def test_BGP_GR_TC_6_1_2_p1(request):
+ """
+ Test Objective : Verify if restarting node resets R bit in BGP
+ open message during normal BGP session flaps when GR is 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)
+
+ logger.info(
+ "[Phase 1] : Test Setup" "[Restart Mode]R1-----R2[Helper 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
+ )
+ 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 1] : Changing mode" "[Disable Mode]R1-----R2[Helper Mode]")
+
+ # 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}
+ }
+ }
+ }
+ }
+ },
+ }
+ }
+ }
+ }
+
+ result = create_router_bgp(tgen, topo, input_dict)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ for addr_type in ADDR_TYPES:
+ neighbor = topo["routers"]["r2"]["links"]["r1-link1"][addr_type].split("/")[0]
+ clear_bgp(tgen, addr_type, "r1", neighbor=neighbor)
+
+ result = verify_bgp_convergence_from_running_config(tgen)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ # Verify GR stats
+ input_dict = {
+ "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}
+ }
+ }
+ }
+ }
+ },
+ }
+ }
+ },
+ "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}
+ }
+ }
+ }
+ }
+ },
+ }
+ }
+ },
+ }
+
+ # here the verify_graceful_restart fro the neighbor would be
+ # "NotReceived" as the latest GR config is not yet applied.
+ 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
+ )
+
+ logger.info("[Phase 2] : Now flap the link running the BGP session ")
+ # Shutdown interface
+ intf = "r2-r1-eth0"
+ shutdown_bringup_interface(tgen, "r2", intf)
+
+ # Bring up Interface
+ shutdown_bringup_interface(tgen, "r2", intf, ifaceaction=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_r_bit(
+ tgen, topo, addr_type, input_dict, dut="r2", peer="r1", expected=False
+ )
+ assert (
+ result is not True
+ ), "Testcase {} : Failed \n " "r2: R-bit is set to True\n Error: {}".format(
+ tc_name, result
+ )
+
+ logger.info("Restart BGPd on R2 ")
+ kill_router_daemons(tgen, "r2", ["bgpd"])
+
+ start_router_daemons(tgen, "r2", ["bgpd"])
+
+ 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_r_bit(
+ tgen, topo, addr_type, input_dict, dut="r2", peer="r1", expected=False
+ )
+ assert (
+ result is not True
+ ), "Testcase {} : Failed \n " "r2: R-bit is set to True\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_topo1/test_bgp_gr_functionality_topo1-2.py b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-2.py
new file mode 100644
index 0000000000..0647ad5d06
--- /dev/null
+++ b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-2.py
@@ -0,0 +1,404 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2019 by VMware, Inc. ("VMware")
+# Used Copyright (c) 2018 by Network Device Education Foundation, Inc. ("NetDEF")
+# in this file.
+#
+# Permission to use, copy, modify, and/or distribute this software
+# for any purpose with or without fee is hereby granted, provided
+# that the above copyright notice and this permission notice appear
+# in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND VMWARE DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VMWARE BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+#
+
+"""
+Following tests are covered to test BGP Gracefull Restart functionality.
+Basic Common Test steps for all the test case below :
+- Create topology (setup module)
+ Creating 2 routers topology, r1, r2 in IBGP
+- Bring up topology
+- Verify for bgp to converge
+- Configure BGP Garceful Restart on both the routers.
+
+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.
+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 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.
+9. Verify that only GR helper routers keep the stale
+ route entries, not any GR disabled router.
+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. 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
+
+These tests have been broken up into 4 sub python scripts because
+the totality of this run was fairly significant.
+"""
+
+import os
+import sys
+import time
+import pytest
+
+# Save the Current Working Directory to find configuration files.
+CWD = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join("../"))
+sys.path.append(os.path.join("../lib/"))
+
+# pylint: disable=C0413
+# Import topogen and topotest helpers
+from lib.topogen import Topogen, get_topogen
+from lib.topolog import logger
+
+# Required to instantiate the topology builder class.
+
+# Import topoJson from lib, to create topology and initial configuration
+from lib.topojson import build_config_from_json
+from lib.bgp import (
+ clear_bgp,
+ verify_bgp_rib,
+ verify_graceful_restart,
+ create_router_bgp,
+ verify_r_bit,
+ verify_f_bit,
+ verify_bgp_convergence,
+ verify_bgp_convergence_from_running_config,
+)
+
+from lib.common_config import (
+ write_test_header,
+ reset_config_on_routers,
+ start_topology,
+ kill_router_daemons,
+ start_router_daemons,
+ verify_rib,
+ check_address_types,
+ write_test_footer,
+ check_router_status,
+ shutdown_bringup_interface,
+ step,
+ get_frr_ipv6_linklocal,
+ required_linux_kernel_version,
+)
+
+pytestmark = [pytest.mark.bgpd]
+
+
+# Global variables
+NEXT_HOP_IP = {"ipv4": "192.168.1.10", "ipv6": "fd00:0:0:1::10"}
+NEXT_HOP_IP_1 = {"ipv4": "192.168.0.1", "ipv6": "fd00::1"}
+NEXT_HOP_IP_2 = {"ipv4": "192.168.0.2", "ipv6": "fd00::2"}
+BGP_CONVERGENCE = False
+GR_RESTART_TIMER = 20
+PREFERRED_NEXT_HOP = "link_local"
+
+
+def setup_module(mod):
+ """
+ Sets up the pytest environment
+
+ * `mod`: module name
+ """
+
+ global ADDR_TYPES
+
+ # Required linux kernel version for this suite to run.
+ result = required_linux_kernel_version("4.16")
+ if result is not True:
+ pytest.skip("Kernel requirements are not met")
+
+ testsuite_run_time = time.asctime(time.localtime(time.time()))
+ logger.info("Testsuite start time: {}".format(testsuite_run_time))
+ logger.info("=" * 40)
+
+ logger.info("Running setup_module to create topology")
+
+ # This function initiates the topology build with Topogen...
+ json_file = "{}/bgp_gr_topojson_topo1.json".format(CWD)
+ tgen = Topogen(json_file, mod.__name__)
+ global topo
+ topo = tgen.json_topo
+ # ... and here it calls Mininet initialization functions.
+
+ # Starting topology, create tmp files which are loaded to routers
+ # to start deamons and then start routers
+ start_topology(tgen)
+
+ # Creating configuration from JSON
+ build_config_from_json(tgen, topo)
+
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ # Api call verify whether BGP is converged
+ ADDR_TYPES = check_address_types()
+
+ BGP_CONVERGENCE = verify_bgp_convergence(tgen, topo)
+ assert BGP_CONVERGENCE is True, "setup_module : Failed \n Error:" " {}".format(
+ BGP_CONVERGENCE
+ )
+
+ logger.info("Running setup_module() done")
+
+
+def teardown_module(mod):
+ """
+ Teardown the pytest environment
+
+ * `mod`: module name
+ """
+
+ logger.info("Running teardown_module to delete topology")
+
+ tgen = get_topogen()
+
+ # Stop toplogy and Remove tmp files
+ tgen.stop_topology()
+
+ logger.info(
+ "Testsuite end time: {}".format(time.asctime(time.localtime(time.time())))
+ )
+ logger.info("=" * 40)
+
+
+def configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut, peer):
+ """
+ This function groups the repetitive function calls into one function.
+ """
+
+ result = create_router_bgp(tgen, topo, input_dict)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ for addr_type in ADDR_TYPES:
+ neighbor = topo["routers"][peer]["links"]["r1-link1"][addr_type].split("/")[0]
+ clear_bgp(tgen, addr_type, dut, neighbor=neighbor)
+
+ for addr_type in ADDR_TYPES:
+ neighbor = topo["routers"][dut]["links"]["r2-link1"][addr_type].split("/")[0]
+ clear_bgp(tgen, addr_type, peer, neighbor=neighbor)
+
+ result = verify_bgp_convergence_from_running_config(tgen)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ return True
+
+
+def next_hop_per_address_family(
+ tgen, dut, peer, addr_type, next_hop_dict, preferred_next_hop=PREFERRED_NEXT_HOP
+):
+ """
+ This function returns link_local or global next_hop per address-family
+ """
+
+ intferface = topo["routers"][peer]["links"]["{}-link1".format(dut)]["interface"]
+ if addr_type == "ipv6" and "link_local" in preferred_next_hop:
+ next_hop = get_frr_ipv6_linklocal(tgen, peer, intf=intferface)
+ else:
+ next_hop = next_hop_dict[addr_type]
+
+ return next_hop
+
+
+def test_BGP_GR_TC_8_p1(request):
+ """
+ Test Objective : Verify that restarting nodes set "F" bit while sending
+ the BGP open messages after it restarts, only when BGP GR is 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[Restart Mode] initialized "
+ )
+
+ # Configure graceful-restart
+ input_dict = {
+ "r1": {
+ "bgp": {
+ "graceful-restart": {"preserve-fw-state": 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": {
+ "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] : 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"
+ )
+ 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
+ )
+
+ result = verify_f_bit(tgen, topo, addr_type, input_dict, dut="r2", peer="r1")
+ 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_gr_functionality_topo1/test_bgp_gr_functionality_topo1.py b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-3.py
index 56f6e1a3be..0c3ff6451e 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-3.py
@@ -85,6 +85,9 @@ Basic Common Test steps for all the test case below :
Global Mode : None
PerPeer Mode : GR Disable
GR Mode effective : GR Disable
+
+These tests have been broken up into 4 sub python scripts because
+the totality of this run was fairly significant.
"""
import os
@@ -519,1165 +522,6 @@ def BGP_GR_TC_50_p1(request):
write_test_footer(tc_name)
-def test_BGP_GR_TC_51_p1(request):
- """
- Test Objective : Transition from Peer-level restarting to Global inherit helper
- Global Mode : None
- PerPeer Mode : GR Restart
- 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 at per Peer-level for R2")
-
- 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": {"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
- )
-
- 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"])
-
- step(
- "Verify that R1 keeps the stale entries in FIB & R2 keeps stale entries in RIB & FIB"
- )
-
- 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("Bring up BGP on R1 and remove Peer-level GR config")
-
- 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}
- }
- }
- }
- }
- },
- }
- }
- }
- }
-
- result = create_router_bgp(tgen, topo, input_dict)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
-
- for addr_type in ADDR_TYPES:
- neighbor = topo["routers"]["r2"]["links"]["r1-link1"][addr_type].split("/")[0]
- clear_bgp(tgen, addr_type, "r1", neighbor=neighbor)
-
- 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")
-
- 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
- )
-
- 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"])
-
- 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(
- 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("Start BGP on R2")
-
- start_router_daemons(tgen, "r2", ["bgpd"])
-
- write_test_footer(tc_name)
-
-
-def test_BGP_GR_TC_53_p1(request):
- """
- Test Objective : Default GR functional mode is Helper.
- Global Mode : None
- PerPeer Mode : None
- 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 R2 as global restarting node")
-
- 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 based on 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
- )
-
- 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 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(
- 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("Start BGP on R2")
-
- start_router_daemons(tgen, "r2", ["bgpd"])
-
- write_test_footer(tc_name)
-
-
-def test_BGP_GR_TC_4_p0(request):
- """
- Test Objective : Verify that the restarting node sets "R" bit while sending the
- BGP open messages after the node restart, only if GR is 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] 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
- )
- 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 {} sec."
- "So time verify the routes are present in BGP RIB and ZEBRA ".format(
- GR_RESTART_TIMER
- )
- )
-
- 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 "
- "r1: routes are still present in BGP RIB\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, protocol, expected=False
- )
- assert result is not True, (
- "Testcase {} : Failed \n "
- "r1: routes are still present in ZEBRA\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_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")
- 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
- )
-
- write_test_footer(tc_name)
-
-
-def test_BGP_GR_TC_5_1_2_p1(request):
- """
- Test Objective : 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.
-
- """
- 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[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": 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] : Now flap the link running the BGP session ")
- # Shutdown interface
- intf = "r2-r1-eth0"
- shutdown_bringup_interface(tgen, "r2", intf)
-
- # Bring up Interface
- shutdown_bringup_interface(tgen, "r2", intf, ifaceaction=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_r_bit(tgen, topo, addr_type, input_dict, dut="r1", peer="r2")
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- logger.info("[Phase 2] : Restart BGPd on router R2. ")
- kill_router_daemons(tgen, "r2", ["bgpd"])
-
- 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_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")
- 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
- )
-
- write_test_footer(tc_name)
-
-
-def test_BGP_GR_TC_6_1_2_p1(request):
- """
- Test Objective : Verify if restarting node resets R bit in BGP
- open message during normal BGP session flaps when GR is 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)
-
- logger.info(
- "[Phase 1] : Test Setup" "[Restart Mode]R1-----R2[Helper 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
- )
- 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 1] : Changing mode" "[Disable Mode]R1-----R2[Helper Mode]")
-
- # 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}
- }
- }
- }
- }
- },
- }
- }
- }
- }
-
- result = create_router_bgp(tgen, topo, input_dict)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
-
- for addr_type in ADDR_TYPES:
- neighbor = topo["routers"]["r2"]["links"]["r1-link1"][addr_type].split("/")[0]
- clear_bgp(tgen, addr_type, "r1", neighbor=neighbor)
-
- result = verify_bgp_convergence_from_running_config(tgen)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
-
- # Verify GR stats
- input_dict = {
- "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}
- }
- }
- }
- }
- },
- }
- }
- },
- "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}
- }
- }
- }
- }
- },
- }
- }
- },
- }
-
- # here the verify_graceful_restart fro the neighbor would be
- # "NotReceived" as the latest GR config is not yet applied.
- 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
- )
-
- logger.info("[Phase 2] : Now flap the link running the BGP session ")
- # Shutdown interface
- intf = "r2-r1-eth0"
- shutdown_bringup_interface(tgen, "r2", intf)
-
- # Bring up Interface
- shutdown_bringup_interface(tgen, "r2", intf, ifaceaction=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_r_bit(
- tgen, topo, addr_type, input_dict, dut="r2", peer="r1", expected=False
- )
- assert (
- result is not True
- ), "Testcase {} : Failed \n " "r2: R-bit is set to True\n Error: {}".format(
- tc_name, result
- )
-
- logger.info("Restart BGPd on R2 ")
- kill_router_daemons(tgen, "r2", ["bgpd"])
-
- start_router_daemons(tgen, "r2", ["bgpd"])
-
- 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_r_bit(
- tgen, topo, addr_type, input_dict, dut="r2", peer="r1", expected=False
- )
- assert (
- result is not True
- ), "Testcase {} : Failed \n " "r2: R-bit is set to True\n Error: {}".format(
- tc_name, result
- )
-
- write_test_footer(tc_name)
-
-
-def test_BGP_GR_TC_8_p1(request):
- """
- Test Objective : Verify that restarting nodes set "F" bit while sending
- the BGP open messages after it restarts, only when BGP GR is 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[Restart Mode] initialized "
- )
-
- # Configure graceful-restart
- input_dict = {
- "r1": {
- "bgp": {
- "graceful-restart": {"preserve-fw-state": 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": {
- "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] : 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"
- )
- 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
- )
-
- result = verify_f_bit(tgen, topo, addr_type, input_dict, dut="r2", peer="r1")
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- write_test_footer(tc_name)
-
-
def test_BGP_GR_TC_19_p1(request):
"""
Test Objective : Verify that GR helper routers keeps all the routes received
@@ -3904,1165 +2748,6 @@ def test_BGP_GR_TC_45_p1(request):
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 "
- "r1: routes are still present in ZEBRA\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 "
- "r2: routes are still present in BGP RIB\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 "
- "r2: routes are still present in ZEBRA\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 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 "
- "r1: routes are still present in BGP RIB\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 "
- "r1: routes are still present in ZEBRA\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_topo1/test_bgp_gr_functionality_topo1-4.py b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-4.py
new file mode 100644
index 0000000000..791ca37eae
--- /dev/null
+++ b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-4.py
@@ -0,0 +1,1686 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2019 by VMware, Inc. ("VMware")
+# Used Copyright (c) 2018 by Network Device Education Foundation, Inc. ("NetDEF")
+# in this file.
+#
+# Permission to use, copy, modify, and/or distribute this software
+# for any purpose with or without fee is hereby granted, provided
+# that the above copyright notice and this permission notice appear
+# in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND VMWARE DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VMWARE BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+#
+
+"""
+Following tests are covered to test BGP Gracefull Restart functionality.
+Basic Common Test steps for all the test case below :
+- Create topology (setup module)
+ Creating 2 routers topology, r1, r2 in IBGP
+- Bring up topology
+- Verify for bgp to converge
+- Configure BGP Garceful Restart on both the routers.
+
+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.
+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 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.
+9. Verify that only GR helper routers keep the stale
+ route entries, not any GR disabled router.
+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. 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
+
+These tests have been broken up into 4 sub python scripts because
+the totality of this run was fairly significant.
+"""
+
+import os
+import sys
+import time
+import pytest
+
+# Save the Current Working Directory to find configuration files.
+CWD = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join("../"))
+sys.path.append(os.path.join("../lib/"))
+
+# pylint: disable=C0413
+# Import topogen and topotest helpers
+from lib.topogen import Topogen, get_topogen
+from lib.topolog import logger
+
+# Required to instantiate the topology builder class.
+
+# Import topoJson from lib, to create topology and initial configuration
+from lib.topojson import build_config_from_json
+from lib.bgp import (
+ clear_bgp,
+ verify_bgp_rib,
+ verify_graceful_restart,
+ create_router_bgp,
+ verify_r_bit,
+ verify_f_bit,
+ verify_bgp_convergence,
+ verify_bgp_convergence_from_running_config,
+)
+
+from lib.common_config import (
+ write_test_header,
+ reset_config_on_routers,
+ start_topology,
+ kill_router_daemons,
+ start_router_daemons,
+ verify_rib,
+ check_address_types,
+ write_test_footer,
+ check_router_status,
+ shutdown_bringup_interface,
+ step,
+ get_frr_ipv6_linklocal,
+ required_linux_kernel_version,
+)
+
+pytestmark = [pytest.mark.bgpd]
+
+
+# Global variables
+NEXT_HOP_IP = {"ipv4": "192.168.1.10", "ipv6": "fd00:0:0:1::10"}
+NEXT_HOP_IP_1 = {"ipv4": "192.168.0.1", "ipv6": "fd00::1"}
+NEXT_HOP_IP_2 = {"ipv4": "192.168.0.2", "ipv6": "fd00::2"}
+BGP_CONVERGENCE = False
+GR_RESTART_TIMER = 20
+PREFERRED_NEXT_HOP = "link_local"
+
+
+def setup_module(mod):
+ """
+ Sets up the pytest environment
+
+ * `mod`: module name
+ """
+
+ global ADDR_TYPES
+
+ # Required linux kernel version for this suite to run.
+ result = required_linux_kernel_version("4.16")
+ if result is not True:
+ pytest.skip("Kernel requirements are not met")
+
+ testsuite_run_time = time.asctime(time.localtime(time.time()))
+ logger.info("Testsuite start time: {}".format(testsuite_run_time))
+ logger.info("=" * 40)
+
+ logger.info("Running setup_module to create topology")
+
+ # This function initiates the topology build with Topogen...
+ json_file = "{}/bgp_gr_topojson_topo1.json".format(CWD)
+ tgen = Topogen(json_file, mod.__name__)
+ global topo
+ topo = tgen.json_topo
+ # ... and here it calls Mininet initialization functions.
+
+ # Starting topology, create tmp files which are loaded to routers
+ # to start deamons and then start routers
+ start_topology(tgen)
+
+ # Creating configuration from JSON
+ build_config_from_json(tgen, topo)
+
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ # Api call verify whether BGP is converged
+ ADDR_TYPES = check_address_types()
+
+ BGP_CONVERGENCE = verify_bgp_convergence(tgen, topo)
+ assert BGP_CONVERGENCE is True, "setup_module : Failed \n Error:" " {}".format(
+ BGP_CONVERGENCE
+ )
+
+ logger.info("Running setup_module() done")
+
+
+def teardown_module(mod):
+ """
+ Teardown the pytest environment
+
+ * `mod`: module name
+ """
+
+ logger.info("Running teardown_module to delete topology")
+
+ tgen = get_topogen()
+
+ # Stop toplogy and Remove tmp files
+ tgen.stop_topology()
+
+ logger.info(
+ "Testsuite end time: {}".format(time.asctime(time.localtime(time.time())))
+ )
+ logger.info("=" * 40)
+
+
+def configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut, peer):
+ """
+ This function groups the repetitive function calls into one function.
+ """
+
+ result = create_router_bgp(tgen, topo, input_dict)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ for addr_type in ADDR_TYPES:
+ neighbor = topo["routers"][peer]["links"]["r1-link1"][addr_type].split("/")[0]
+ clear_bgp(tgen, addr_type, dut, neighbor=neighbor)
+
+ for addr_type in ADDR_TYPES:
+ neighbor = topo["routers"][dut]["links"]["r2-link1"][addr_type].split("/")[0]
+ clear_bgp(tgen, addr_type, peer, neighbor=neighbor)
+
+ result = verify_bgp_convergence_from_running_config(tgen)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ return True
+
+
+def next_hop_per_address_family(
+ tgen, dut, peer, addr_type, next_hop_dict, preferred_next_hop=PREFERRED_NEXT_HOP
+):
+ """
+ This function returns link_local or global next_hop per address-family
+ """
+
+ intferface = topo["routers"][peer]["links"]["{}-link1".format(dut)]["interface"]
+ if addr_type == "ipv6" and "link_local" in preferred_next_hop:
+ next_hop = get_frr_ipv6_linklocal(tgen, peer, intf=intferface)
+ else:
+ next_hop = next_hop_dict[addr_type]
+
+ return next_hop
+
+
+def BGP_GR_TC_50_p1(request):
+ """
+ Test Objective : Transition from Peer-level helper to Global inherit helper
+ Global Mode : None
+ PerPeer Mode : 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 as GR helper node at per Peer-level for R2"
+ " and configure R2 as global restarting node."
+ )
+
+ 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": {"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")
+
+ 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
+ )
+
+ 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"])
+
+ 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(
+ 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("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-helper": False}
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r2": {
+ "dest_link": {
+ "r1-link1": {"graceful-restart-helper": False}
+ }
+ }
+ }
+ }
+ },
+ }
+ }
+ }
+ }
+
+ result = create_router_bgp(tgen, topo, input_dict)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ for addr_type in ADDR_TYPES:
+ neighbor = topo["routers"]["r2"]["links"]["r1-link1"][addr_type].split("/")[0]
+ clear_bgp(tgen, addr_type, "r1", neighbor=neighbor)
+
+ 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 = {
+ "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
+ )
+
+ 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"])
+
+ 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(
+ 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("Start BGP on R2")
+
+ start_router_daemons(tgen, "r2", ["bgpd"])
+
+ 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 "
+ "r1: routes are still present in ZEBRA\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 "
+ "r2: routes are still present in BGP RIB\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 "
+ "r2: routes are still present in ZEBRA\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 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 "
+ "r1: routes are still present in BGP RIB\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 "
+ "r1: routes are still present in ZEBRA\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-1.py b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-1.py
new file mode 100644
index 0000000000..064fde1633
--- /dev/null
+++ b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-1.py
@@ -0,0 +1,1515 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2019 by VMware, Inc. ("VMware")
+# Used Copyright (c) 2018 by Network Device Education Foundation, Inc. ("NetDEF")
+# in this file.
+#
+# Permission to use, copy, modify, and/or distribute this software
+# for any purpose with or without fee is hereby granted, provided
+# that the above copyright notice and this permission notice appear
+# in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND VMWARE DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VMWARE BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+#
+
+"""
+Following tests are covered to test BGP Graceful Restart functionality.
+Basic Common Test steps for all the test case below :
+- Create topology (setup module)
+ Creating 7 routers topology
+- Bring up topology
+- Verify for bgp to converge
+- Configure BGP Graceful Restart on both the routers.
+
+TC_1_2:
+ Verify that EOR message is sent out only after initial convergence
+ Verify whether EOR message is received from all the peers after restart
+TC_3:
+ Verify the selection deferral timer functionality when EOR is not sent
+ by the helper router
+TC_11:
+ Verify that selection-deferral timer sets the maximum time to
+ avoid deadlock during which the best-path
+TC_10:
+ Test Objective : Test GR scenarios on helper router by enabling
+ Graceful Restart for multiple address families.
+TC_15:
+ Test Objective : Test GR scenarios by enabling Graceful Restart
+ for multiple address families..
+TC_16:
+ Test Objective : Verify BGP-GR feature when restarting node
+ is a transit router for it's iBGP peers.
+TC_18:
+ Test Objective : Verify that GR helper router deletes stale routes
+ received from restarting node, if GR capability is not present in
+TC_19:
+ Test Objective : Verify that GR routers keeps all the routes
+ received from restarting node if both the routers are
+TC_26:
+ Test Objective : Test GR scenarios on helper router by enabling
+ Graceful Restart for multiple address families.
+TC_28:
+ Test Objective : Verify if helper node goes down before restarting
+ node comes up online, helper node sets the R-bit to avoid dead-lock
+TC_29:
+ Test Objective : Change timers on the fly, and
+ verify if it takes immediate effect.
+TC_33:
+ Test Objective : Helper router receives same prefixes from two
+ different routers (GR-restarting and GR-disabled). Keeps the
+TC_34_1:
+ Test Objective : Restarting node doesn't preserve forwarding
+ state, helper router should not keep the stale entries.
+TC_34_2:
+ Test Objective : Restarting node doesn't preserve the forwarding
+ state verify the behaviour on helper node, if it still keeps the
+TC_32:
+ Test Objective : Restarting node is connected to multiple helper
+ nodes, one of them doesn't send EOR to restarting router. Verify
+TC_37:
+ Test Objective : Verify if helper node restarts before sending the
+ EOR message, restarting node doesn't wait until stale path timer
+TC_30:
+ Test Objective : Restarting node removes stale routes from Zebra
+ after receiving an EOR from helper router.
+
+"""
+
+import os
+import sys
+import time
+import pytest
+from time import sleep
+
+# Save the Current Working Directory to find configuration files.
+CWD = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join("../"))
+sys.path.append(os.path.join("../lib/"))
+
+# pylint: disable=C0413
+# Import topogen and topotest helpers
+from lib.topogen import Topogen, get_topogen
+from lib.topolog import logger
+
+# Required to instantiate the topology builder class.
+
+# Import topoJson from lib, to create topology and initial configuration
+from lib.topojson import build_config_from_json
+from lib.bgp import (
+ clear_bgp,
+ verify_bgp_rib,
+ verify_graceful_restart,
+ create_router_bgp,
+ verify_r_bit,
+ verify_eor,
+ verify_f_bit,
+ verify_bgp_convergence,
+ 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 (
+ write_test_header,
+ reset_config_on_routers,
+ start_topology,
+ kill_router_daemons,
+ start_router_daemons,
+ verify_rib,
+ check_address_types,
+ write_test_footer,
+ check_router_status,
+ step,
+ get_frr_ipv6_linklocal,
+ required_linux_kernel_version,
+)
+
+pytestmark = [pytest.mark.bgpd]
+
+
+# Global variables
+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"]
+
+
+def setup_module(mod):
+ """
+ Sets up the pytest environment
+
+ * `mod`: module name
+ """
+
+ # Required linux kernel version for this suite to run.
+ result = required_linux_kernel_version("4.16")
+ if result is not True:
+ pytest.skip("Kernel requirements are not met")
+
+ global ADDR_TYPES
+
+ testsuite_run_time = time.asctime(time.localtime(time.time()))
+ logger.info("Testsuite start time: {}".format(testsuite_run_time))
+ logger.info("=" * 40)
+
+ logger.info("Running setup_module to create topology")
+
+ # This function initiates the topology build with Topogen...
+ json_file = "{}/bgp_gr_topojson_topo2.json".format(CWD)
+ tgen = Topogen(json_file, mod.__name__)
+ global topo
+ topo = tgen.json_topo
+ # ... and here it calls Mininet initialization functions.
+
+ # Starting topology, create tmp files which are loaded to routers
+ # to start deamons and then start routers
+ start_topology(tgen)
+
+ # Creating configuration from JSON
+ build_config_from_json(tgen, topo)
+
+ # 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
+ )
+
+ logger.info("Running setup_module() done")
+
+
+def teardown_module(mod):
+ """
+ Teardown the pytest environment
+
+ * `mod`: module name
+ """
+
+ logger.info("Running teardown_module to delete topology")
+
+ tgen = get_topogen()
+
+ # Stop toplogy and Remove tmp files
+ tgen.stop_topology()
+
+ logger.info(
+ "Testsuite end time: {}".format(time.asctime(time.localtime(time.time())))
+ )
+ logger.info("=" * 40)
+
+
+def configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut, peer):
+ """
+ This function groups the repetitive function calls into one function.
+ """
+
+ logger.info("configure_gr_followed_by_clear: dut %s peer %s", dut, peer)
+
+ result = create_router_bgp(tgen, topo, input_dict)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ for addr_type in ADDR_TYPES:
+ neighbor = topo["routers"][peer]["links"][dut][addr_type].split("/")[0]
+ clear_bgp(tgen, addr_type, dut, neighbor=neighbor)
+
+ for addr_type in ADDR_TYPES:
+ neighbor = topo["routers"][dut]["links"][peer][addr_type].split("/")[0]
+ clear_bgp(tgen, addr_type, peer, neighbor=neighbor)
+
+ result = verify_bgp_convergence_from_running_config(tgen)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ return True
+
+
+def next_hop_per_address_family(tgen, dut, peer, addr_type, next_hop_dict):
+ """
+ This function returns link_local or global next_hop per address-family
+ """
+
+ intferface = topo["routers"][peer]["links"]["{}-link1".format(dut)]["interface"]
+ if addr_type == "ipv6" and "link_local" in PREFERRED_NEXT_HOP:
+ next_hop = get_frr_ipv6_linklocal(tgen, peer, intf=intferface)
+ else:
+ next_hop = next_hop_dict[addr_type]
+
+ return next_hop
+
+
+def test_BGP_GR_TC_1_2_p0(request):
+ """
+ Verify that EOR message is sent out only after initial convergence
+ Verify whether EOR message is received from all the peers 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 EOR Sent and Received : BGP_GR_TC_1_2 >> "
+ "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 R3
+ 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"])
+
+ for addr_type in ADDR_TYPES:
+ # Verifying RIB routes
+ input_dict_1 = {key: topo["routers"][key] for key in ["r3"]}
+ # 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("Starting bgpd process")
+ start_router_daemons(tgen, "r1", ["bgpd"])
+ logger.info("R1 is UP Now")
+
+ 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 R3
+ 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
+ )
+
+ # Verifying EOR on restarting router
+ result = verify_eor(tgen, topo, addr_type, input_dict, dut="r3", peer="r1")
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ write_test_footer(tc_name)
+
+
+def test_BGP_GR_TC_3_p0(request):
+ """
+ Verify the selection deferral timer functionality when EOR is not sent
+ by the helper 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(
+ " Verify route download to RIB: BGP_GR_TC_3 >> "
+ "BGP GR [Helper Mode]R1-----R2[Restart Mode] "
+ )
+
+ # Configure graceful-restart
+ input_dict = {
+ "r1": {
+ "bgp": {
+ "graceful-restart": {
+ "disable-eor": True,
+ },
+ "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,
+ "timer": {"select-defer-time": GR_SELECT_DEFER_TIMER},
+ },
+ "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 = "r2"
+ 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
+ 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"])
+
+ logger.info("R2 is about to come up now")
+ start_router_daemons(tgen, "r2", ["bgpd"])
+ logger.info("R2 is UP Now")
+
+ for addr_type in ADDR_TYPES:
+ # Verifying BGP RIB routes received from router R1
+ 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
+ )
+
+ # Verify EOR on restarting router
+ result = verify_eor(
+ tgen, topo, addr_type, input_dict, dut="r2", peer="r1", expected=False
+ )
+ assert (
+ result is not True
+ ), "Testcase {} : Failed \n " "r2: EOR is set to True\n Error: {}".format(
+ tc_name, result
+ )
+
+ logger.info(
+ "Waiting for selection deferral timer({} sec)..".format(GR_SELECT_DEFER_TIMER)
+ )
+ sleep(GR_SELECT_DEFER_TIMER)
+
+ for addr_type in ADDR_TYPES:
+ # Verifying RIB routes
+ result = verify_rib(tgen, addr_type, "r2", input_dict_1)
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ write_test_footer(tc_name)
+
+
+def test_BGP_GR_TC_11_p0(request):
+ """
+ Verify that selection-deferral timer sets the maximum time to
+ avoid deadlock during which the best-path
+ selection process is deferred, after a peer session was restarted
+ """
+
+ 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 EOR Sent after deferral timeout : BGP_GR_TC_11")
+
+ # Configure graceful-restart
+ input_dict = {
+ "r1": {
+ "bgp": {
+ "graceful-restart": {
+ "graceful-restart": True,
+ "select-defer-time": GR_SELECT_DEFER_TIMER,
+ },
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r2": {"dest_link": {"r1": {"graceful-restart": True}}},
+ "r3": {"dest_link": {"r1": {"graceful-restart": True}}},
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r2": {"dest_link": {"r1": {"graceful-restart": True}}},
+ "r3": {"dest_link": {"r1": {"graceful-restart": True}}},
+ }
+ }
+ },
+ },
+ }
+ },
+ "r3": {
+ "bgp": {
+ "graceful-restart": {"disable-eor": True},
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r3": {"graceful-restart-helper": True}
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r3": {"graceful-restart-helper": True}
+ }
+ }
+ }
+ }
+ },
+ },
+ }
+ },
+ }
+
+ result = create_router_bgp(tgen, topo, input_dict)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ for addr_type in ADDR_TYPES:
+ 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"
+ )
+ 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"])
+
+ logger.info("Starting bgpd process")
+ start_router_daemons(tgen, "r1", ["bgpd"])
+ logger.info("R1 is UP Now")
+
+ for addr_type in ADDR_TYPES:
+ # Verify EOR on restarting router
+ result = verify_eor(
+ tgen, topo, addr_type, input_dict, dut="r1", peer="r3", expected=False
+ )
+ assert (
+ result is not True
+ ), "Testcase {} : Failed \n " "r1: EOR is set to True\n Error: {}".format(
+ tc_name, result
+ )
+
+ logger.info(
+ "Waiting for selection deferral timer({} sec).. ".format(
+ GR_SELECT_DEFER_TIMER + 2
+ )
+ )
+ sleep(GR_SELECT_DEFER_TIMER + 2)
+
+ for addr_type in ADDR_TYPES:
+ # Verifying BGP RIB routes received from router 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
+ )
+
+ # Verifying EOR on restarting router
+ result = verify_eor(
+ tgen, topo, addr_type, input_dict, dut="r3", peer="r1", expected=False
+ )
+ assert (
+ result is not True
+ ), "Testcase {} : Failed \n " "r3: EOR is set to True\n Error: {}".format(
+ tc_name, result
+ )
+
+ write_test_footer(tc_name)
+
+
+def test_BGP_GR_10_p2(request):
+ """
+ Test Objective : Test GR scenarios on helper router 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)
+
+ step("Test Setup: [Helper Mode]R3-----R1[Restart Mode] initialized")
+
+ # Configure graceful-restart
+ input_dict = {
+ "r1": {
+ "bgp": {
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r1": {
+ "next_hop_self": True,
+ "graceful-restart": True,
+ "activate": "ipv6",
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r1": {
+ "next_hop_self": True,
+ "graceful-restart": True,
+ "activate": "ipv4",
+ }
+ }
+ }
+ }
+ }
+ },
+ }
+ }
+ },
+ "r3": {
+ "bgp": {
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r3": {
+ "graceful-restart-helper": True,
+ "activate": "ipv6",
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r3": {
+ "graceful-restart-helper": True,
+ "activate": "ipv4",
+ }
+ }
+ }
+ }
+ }
+ },
+ }
+ }
+ },
+ }
+
+ configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r3")
+
+ for addr_type in ADDR_TYPES:
+ step(
+ "Verifying GR config and operational state for addr_type {}".format(
+ addr_type
+ )
+ )
+
+ 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_topo = {key: topo["routers"][key] for key in ["r1"]}
+ 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 before shutting down BGPd daemon
+ result = verify_rib(tgen, addr_type, dut, input_topo)
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ # verify multi address family
+ result = verify_gr_address_family(
+ tgen,
+ topo,
+ addr_type,
+ "ipv4Unicast",
+ dut="r1",
+ peer="r3",
+ )
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ # verify multi address family
+ result = verify_gr_address_family(
+ tgen,
+ topo,
+ addr_type,
+ "ipv6Unicast",
+ dut="r1",
+ peer="r3",
+ )
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ # verify multi address family
+ result = verify_gr_address_family(
+ tgen,
+ topo,
+ addr_type,
+ "ipv4Unicast",
+ dut="r3",
+ peer="r1",
+ )
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ # verify multi address family
+ result = verify_gr_address_family(
+ tgen,
+ topo,
+ addr_type,
+ "ipv6Unicast",
+ dut="r3",
+ peer="r1",
+ )
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ step("Killing bgpd on r1")
+
+ # Kill BGPd daemon on R1
+ kill_router_daemons(tgen, "r1", ["bgpd"])
+
+ for addr_type in ADDR_TYPES:
+ # Verifying BGP RIB routes
+ input_topo = {key: topo["routers"][key] for key in ["r1"]}
+ 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 before shutting down BGPd daemon
+ result = verify_rib(tgen, addr_type, dut, input_topo)
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ step("Starting bgpd on r1")
+
+ # Start BGPd daemon on R1
+ start_router_daemons(tgen, "r1", ["bgpd"])
+
+ for addr_type in ADDR_TYPES:
+ # Verifying BGP RIB routes
+ input_topo = {key: topo["routers"][key] for key in ["r1"]}
+ 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 before shutting down BGPd daemon
+ result = verify_rib(tgen, addr_type, dut, input_topo)
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ write_test_footer(tc_name)
+
+
+def BGP_GR_16_p2(request):
+ """
+ Test Objective : Verify BGP-GR feature when restarting 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] initialized"
+ )
+
+ # Configure graceful-restart and timers
+ input_dict = {
+ "r1": {
+ "bgp": {
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r1": {
+ "graceful-restart": True,
+ "next_hop_self": True,
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r1": {
+ "graceful-restart": 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 "
+ "[Helper Mode]R3-----R1[Restart Mode]"
+ "--------R6[Helper Mode] initialized"
+ )
+
+ # Configure graceful-restart and timers
+ 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 = "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
+ 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
+ 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
+ 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:
+ # Verifying BGP RIB routes
+ 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
+ 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
+ )
+
+ result = verify_bgp_convergence_from_running_config(tgen, topo)
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ write_test_footer(tc_name)
+
+
+def test_BGP_GR_18_p1(request):
+ """
+ Test Objective : Verify that GR helper router deletes stale routes
+ received from restarting node, if GR capability is not present in
+ restarting node's OPEN message.
+ """
+
+ 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] initialized"
+ )
+
+ # Configure graceful-restart and timers
+ 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] initialized"
+ )
+
+ # Configure graceful-restart and timers
+ 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 = "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 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"])
+
+ logger.info("[Step 3] : Configure R1 to prevent sending EOR")
+
+ # Modify graceful-restart config to prevent sending EOR
+ input_dict_3 = {"r1": {"bgp": {"graceful-restart": {"disable-eor": True}}}}
+
+ result = modify_bgp_config_when_bgpd_down(tgen, topo, input_dict_3)
+
+ # Modify configuration to delete routes
+ network = {"ipv4": "101.0.20.1/32", "ipv6": "1::1/128"}
+ for addr_type in ADDR_TYPES:
+ input_dict_3 = {
+ "r1": {
+ "bgp": {
+ "address_family": {
+ addr_type: {
+ "unicast": {
+ "advertise_networks": [
+ {
+ "network": network[addr_type],
+ "no_of_network": 5,
+ "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
+ )
+
+ # Modify graceful-restart config
+ input_dict_3 = {
+ "r1": {
+ "bgp": {
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r2": {
+ "dest_link": {
+ "r1": {"graceful-restart-disable": True}
+ }
+ },
+ "r6": {
+ "dest_link": {
+ "r1": {"graceful-restart-disable": True}
+ }
+ },
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r2": {
+ "dest_link": {
+ "r1": {"graceful-restart-disable": True}
+ }
+ },
+ "r6": {
+ "dest_link": {
+ "r1": {"graceful-restart-disable": 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("[Step 4] : Bring up the BGPd daemon on R1 for 30" " seconds..")
+
+ # Start BGPd daemon on R1
+ start_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, expected=False)
+ assert result is not True, (
+ "Testcase {} : Failed \n "
+ "r6: routes are still present in BGP RIB\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 "
+ "r6: routes are still present in ZEBRA\n Error: {}".format(tc_name, result)
+ )
+ logger.info(" Expected behavior: {}".format(result))
+
+ # Verifying BGP RIB routes
+ dut = "r2"
+ result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1, expected=False)
+ assert result is not True, (
+ "Testcase {} : Failed \n "
+ "r2: routes are still present in BGP RIB\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 "
+ "r6: routes are still present in ZEBRA\n Error: {}".format(tc_name, result)
+ )
+ logger.info(" Expected behavior: {}".format(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-2.py b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-2.py
new file mode 100644
index 0000000000..4356c4d591
--- /dev/null
+++ b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-2.py
@@ -0,0 +1,1216 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2019 by VMware, Inc. ("VMware")
+# Used Copyright (c) 2018 by Network Device Education Foundation, Inc. ("NetDEF")
+# in this file.
+#
+# Permission to use, copy, modify, and/or distribute this software
+# for any purpose with or without fee is hereby granted, provided
+# that the above copyright notice and this permission notice appear
+# in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND VMWARE DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VMWARE BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+#
+
+"""
+Following tests are covered to test BGP Graceful Restart functionality.
+Basic Common Test steps for all the test case below :
+- Create topology (setup module)
+ Creating 7 routers topology
+- Bring up topology
+- Verify for bgp to converge
+- Configure BGP Graceful Restart on both the routers.
+
+TC_1_2:
+ Verify that EOR message is sent out only after initial convergence
+ Verify whether EOR message is received from all the peers after restart
+TC_3:
+ Verify the selection deferral timer functionality when EOR is not sent
+ by the helper router
+TC_11:
+ Verify that selection-deferral timer sets the maximum time to
+ avoid deadlock during which the best-path
+TC_10:
+ Test Objective : Test GR scenarios on helper router by enabling
+ Graceful Restart for multiple address families.
+TC_15:
+ Test Objective : Test GR scenarios by enabling Graceful Restart
+ for multiple address families..
+TC_16:
+ Test Objective : Verify BGP-GR feature when restarting node
+ is a transit router for it's iBGP peers.
+TC_18:
+ Test Objective : Verify that GR helper router deletes stale routes
+ received from restarting node, if GR capability is not present in
+TC_19:
+ Test Objective : Verify that GR routers keeps all the routes
+ received from restarting node if both the routers are
+TC_26:
+ Test Objective : Test GR scenarios on helper router by enabling
+ Graceful Restart for multiple address families.
+TC_28:
+ Test Objective : Verify if helper node goes down before restarting
+ node comes up online, helper node sets the R-bit to avoid dead-lock
+TC_29:
+ Test Objective : Change timers on the fly, and
+ verify if it takes immediate effect.
+TC_33:
+ Test Objective : Helper router receives same prefixes from two
+ different routers (GR-restarting and GR-disabled). Keeps the
+TC_34_1:
+ Test Objective : Restarting node doesn't preserve forwarding
+ state, helper router should not keep the stale entries.
+TC_34_2:
+ Test Objective : Restarting node doesn't preserve the forwarding
+ state verify the behaviour on helper node, if it still keeps the
+TC_32:
+ Test Objective : Restarting node is connected to multiple helper
+ nodes, one of them doesn't send EOR to restarting router. Verify
+TC_37:
+ Test Objective : Verify if helper node restarts before sending the
+ EOR message, restarting node doesn't wait until stale path timer
+TC_30:
+ Test Objective : Restarting node removes stale routes from Zebra
+ after receiving an EOR from helper router.
+
+"""
+
+import os
+import sys
+import time
+import pytest
+from time import sleep
+
+# Save the Current Working Directory to find configuration files.
+CWD = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join("../"))
+sys.path.append(os.path.join("../lib/"))
+
+# pylint: disable=C0413
+# Import topogen and topotest helpers
+from lib.topogen import Topogen, get_topogen
+from lib.topolog import logger
+
+# Required to instantiate the topology builder class.
+
+# Import topoJson from lib, to create topology and initial configuration
+from lib.topojson import build_config_from_json
+from lib.bgp import (
+ clear_bgp,
+ verify_bgp_rib,
+ verify_graceful_restart,
+ create_router_bgp,
+ verify_r_bit,
+ verify_eor,
+ verify_f_bit,
+ verify_bgp_convergence,
+ 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 (
+ write_test_header,
+ reset_config_on_routers,
+ start_topology,
+ kill_router_daemons,
+ start_router_daemons,
+ verify_rib,
+ check_address_types,
+ write_test_footer,
+ check_router_status,
+ step,
+ get_frr_ipv6_linklocal,
+ required_linux_kernel_version,
+)
+
+pytestmark = [pytest.mark.bgpd]
+
+
+# Global variables
+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"]
+
+
+def setup_module(mod):
+ """
+ Sets up the pytest environment
+
+ * `mod`: module name
+ """
+
+ # Required linux kernel version for this suite to run.
+ result = required_linux_kernel_version("4.16")
+ if result is not True:
+ pytest.skip("Kernel requirements are not met")
+
+ global ADDR_TYPES
+
+ testsuite_run_time = time.asctime(time.localtime(time.time()))
+ logger.info("Testsuite start time: {}".format(testsuite_run_time))
+ logger.info("=" * 40)
+
+ logger.info("Running setup_module to create topology")
+
+ # This function initiates the topology build with Topogen...
+ json_file = "{}/bgp_gr_topojson_topo2.json".format(CWD)
+ tgen = Topogen(json_file, mod.__name__)
+ global topo
+ topo = tgen.json_topo
+ # ... and here it calls Mininet initialization functions.
+
+ # Starting topology, create tmp files which are loaded to routers
+ # to start deamons and then start routers
+ start_topology(tgen)
+
+ # Creating configuration from JSON
+ build_config_from_json(tgen, topo)
+
+ # 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
+ )
+
+ logger.info("Running setup_module() done")
+
+
+def teardown_module(mod):
+ """
+ Teardown the pytest environment
+
+ * `mod`: module name
+ """
+
+ logger.info("Running teardown_module to delete topology")
+
+ tgen = get_topogen()
+
+ # Stop toplogy and Remove tmp files
+ tgen.stop_topology()
+
+ logger.info(
+ "Testsuite end time: {}".format(time.asctime(time.localtime(time.time())))
+ )
+ logger.info("=" * 40)
+
+
+def configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut, peer):
+ """
+ This function groups the repetitive function calls into one function.
+ """
+
+ logger.info("configure_gr_followed_by_clear: dut %s peer %s", dut, peer)
+
+ result = create_router_bgp(tgen, topo, input_dict)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ for addr_type in ADDR_TYPES:
+ neighbor = topo["routers"][peer]["links"][dut][addr_type].split("/")[0]
+ clear_bgp(tgen, addr_type, dut, neighbor=neighbor)
+
+ for addr_type in ADDR_TYPES:
+ neighbor = topo["routers"][dut]["links"][peer][addr_type].split("/")[0]
+ clear_bgp(tgen, addr_type, peer, neighbor=neighbor)
+
+ result = verify_bgp_convergence_from_running_config(tgen)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ return True
+
+
+def next_hop_per_address_family(tgen, dut, peer, addr_type, next_hop_dict):
+ """
+ This function returns link_local or global next_hop per address-family
+ """
+
+ intferface = topo["routers"][peer]["links"]["{}-link1".format(dut)]["interface"]
+ if addr_type == "ipv6" and "link_local" in PREFERRED_NEXT_HOP:
+ next_hop = get_frr_ipv6_linklocal(tgen, peer, intf=intferface)
+ else:
+ next_hop = next_hop_dict[addr_type]
+
+ return next_hop
+
+
+def test_BGP_GR_26_p2(request):
+ """
+ Test Objective : Test GR scenarios on helper router 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)
+
+ logger.info(
+ "[Step 1] : Test Setup " "[Helper Mode]R3-----R1[Restart Mode] initialized"
+ )
+
+ # Configure graceful-restart
+ input_dict = {
+ "r1": {
+ "bgp": {
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r1": {
+ "graceful-restart": True,
+ "next_hop_self": True,
+ "activate": "ipv6",
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r1": {
+ "graceful-restart": True,
+ "next_hop_self": True,
+ "activate": "ipv4",
+ }
+ }
+ }
+ }
+ }
+ },
+ }
+ }
+ },
+ "r3": {
+ "bgp": {
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r3": {
+ "graceful-restart-helper": True,
+ "activate": "ipv6",
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r3": {
+ "graceful-restart-helper": True,
+ "activate": "ipv4",
+ }
+ }
+ }
+ }
+ }
+ },
+ }
+ }
+ },
+ }
+
+ 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="r3", peer="r1"
+ )
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ # Verifying BGP RIB routes
+ dut = "r3"
+ input_topo = {key: topo["routers"][key] for key in ["r1"]}
+ 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 before shutting down BGPd daemon
+ result = verify_rib(tgen, addr_type, dut, input_topo)
+ 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
+ input_topo = {key: topo["routers"][key] for key in ["r1"]}
+ 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 before shutting down BGPd daemon
+ result = verify_rib(tgen, addr_type, dut, input_topo)
+ 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:
+ # Verifying BGP RIB routes
+ input_topo = {key: topo["routers"][key] for key in ["r1"]}
+ 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 before shutting down BGPd daemon
+ result = verify_rib(tgen, addr_type, dut, input_topo)
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ # verify multi address family
+ result = verify_gr_address_family(
+ tgen,
+ topo,
+ addr_type,
+ "ipv4Unicast",
+ dut="r1",
+ peer="r3",
+ )
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ # verify multi address family
+ result = verify_gr_address_family(
+ tgen,
+ topo,
+ addr_type,
+ "ipv6Unicast",
+ dut="r1",
+ peer="r3",
+ )
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ # verify multi address family
+ result = verify_gr_address_family(
+ tgen,
+ topo,
+ addr_type,
+ "ipv4Unicast",
+ dut="r3",
+ peer="r1",
+ )
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ # verify multi address family
+ result = verify_gr_address_family(
+ tgen,
+ topo,
+ addr_type,
+ "ipv6Unicast",
+ dut="r3",
+ peer="r1",
+ )
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ write_test_footer(tc_name)
+
+
+def test_BGP_GR_chaos_28_p1(request):
+ """
+ Test Objective : Verify if helper node goes down before restarting
+ node comes up online, helper node sets the R-bit to avoid dead-lock
+ till SDT expiry.
+ """
+
+ 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(
+ "Test Case: test_BGP_GR_chaos_28 :"
+ "[Helper Mode]R3-----R1[Restart Mode] initialized"
+ )
+
+ # Configure graceful-restart
+ input_dict = {
+ "r1": {
+ "bgp": {
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {"dest_link": {"r1": {"graceful-restart": True}}}
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {"dest_link": {"r1": {"graceful-restart": 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 1] : Kill BGPd daemon on R1..")
+
+ # Kill BGPd daemon on R1
+ kill_router_daemons(tgen, "r1", ["bgpd"])
+
+ logger.info("[Step 2] : Kill BGPd daemon on R3..")
+
+ # Kill BGPd daemon on R3
+ kill_router_daemons(tgen, "r3", ["bgpd"])
+
+ logger.info("[Step 3] : Start BGPd daemon on R1..")
+
+ # Start BGPd daemon on R1
+ start_router_daemons(tgen, "r1", ["bgpd"])
+
+ logger.info("[Step 4] : Start BGPd daemon on R3..")
+
+ # Start BGPd daemon on R3
+ start_router_daemons(tgen, "r3", ["bgpd"])
+
+ # Verify r_bit
+ for addr_type in ADDR_TYPES:
+ result = verify_r_bit(tgen, topo, addr_type, input_dict, dut="r3", peer="r1")
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ write_test_footer(tc_name)
+
+
+def test_BGP_GR_chaos_29_p1(request):
+ """
+ Test Objective : Change timers on the fly, and
+ verify if it takes immediate effect.
+ """
+
+ 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(
+ " Test Case : test_BGP_GR_chaos_29"
+ " BGP GR [Helper Mode]R3-----R1[Restart Mode]"
+ " and [restart-time 150]R1 initialized"
+ )
+
+ # Configure graceful-restart and timers
+ input_dict = {
+ "r1": {
+ "bgp": {
+ "graceful-restart": {"timer": {"restart-time": GR_RESTART_TIMER}},
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {"dest_link": {"r1": {"graceful-restart": True}}}
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {"dest_link": {"r1": {"graceful-restart": 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
+ )
+
+ # Verify graceful-restart timers
+ input_dict_2 = {
+ "r1": {
+ "bgp": {
+ "graceful-restart": {"timer": {"restart-time": GR_RESTART_TIMER + 5}}
+ }
+ }
+ }
+
+ result = create_router_bgp(tgen, topo, input_dict_2)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ for addr_type in ADDR_TYPES:
+ input_dict_2 = {
+ "r1": {
+ "bgp": {
+ "graceful-restart": {"timer": {"restart-time": GR_RESTART_TIMER}}
+ }
+ }
+ }
+
+ result = verify_graceful_restart_timers(
+ tgen, topo, addr_type, input_dict_2, dut="r3", peer="r1"
+ )
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ for addr_type in ADDR_TYPES:
+ # Verifying BGP RIB routes before shutting down BGPd daemon
+ dut = "r3"
+ input_dict = {key: topo["routers"][key] for key in ["r1"]}
+ result = verify_bgp_rib(tgen, addr_type, dut, input_dict)
+ 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)
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ logger.info("[Step 2] : Kill BGPd daemon on R1..")
+
+ # Kill BGPd daemon on R1
+ kill_router_daemons(tgen, "r1", ["bgpd"])
+
+ logger.info("[Step 3] : Wait for {} seconds..".format(GR_RESTART_TIMER))
+
+ # Waiting for GR_RESTART_TIMER
+ sleep(GR_RESTART_TIMER)
+
+ for addr_type in ADDR_TYPES:
+ # Verifying BGP RIB routes before shutting down BGPd daemon
+ input_dict = {key: topo["routers"][key] for key in ["r1"]}
+ result = verify_bgp_rib(tgen, addr_type, dut, input_dict, expected=False)
+ assert result is not True, (
+ "Testcase {} : Failed \n "
+ "r3: routes are still present in BGP RIB\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, expected=False)
+ assert result is not True, (
+ "Testcase {} : Failed \n "
+ "r3: routes are still present in ZEBRA\n Error: {}".format(tc_name, result)
+ )
+ logger.info(" Expected behavior: {}".format(result))
+
+ logger.info("[Step 4] : Start BGPd daemon on R1..")
+
+ # Start BGPd daemon on R1
+ start_router_daemons(tgen, "r1", ["bgpd"])
+
+ write_test_footer(tc_name)
+
+
+def test_BGP_GR_chaos_33_p1(request):
+ """
+ Test Objective : Helper router receives same prefixes from two
+ different routers (GR-restarting and GR-disabled). Keeps the
+ stale entry only for GR-restarting node(next-hop is correct).
+ """
+
+ 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(
+ " Test Case : test_BGP_GR_chaos_33 "
+ "BGP GR "
+ "[Restart Mode]R1--R3[Helper Mode]--R4[Disabled Mode]"
+ )
+
+ # Configure graceful-restart
+ input_dict = {
+ "r1": {
+ "bgp": {
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {"dest_link": {"r1": {"graceful-restart": True}}}
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {"dest_link": {"r1": {"graceful-restart": 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}
+ }
+ }
+ }
+ }
+ },
+ }
+ }
+ },
+ "r4": {
+ "bgp": {
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r4": {"graceful-restart-disable": True}
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r4": {"graceful-restart-disable": 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] : Advertise same networks from R1 and R4..")
+
+ # Api call to delete advertised networks
+ input_dict_2 = {
+ "r1": {
+ "bgp": {
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "advertise_networks": [
+ {
+ "network": "200.0.20.1/32",
+ "no_of_network": 2,
+ }
+ ]
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "advertise_networks": [
+ {"network": "2001::1/128", "no_of_network": 2}
+ ]
+ }
+ },
+ }
+ }
+ },
+ "r4": {
+ "bgp": {
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "advertise_networks": [
+ {"network": "200.0.20.1/32", "no_of_network": 2}
+ ]
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "advertise_networks": [
+ {"network": "2001::1/128", "no_of_network": 2}
+ ]
+ }
+ },
+ }
+ }
+ },
+ }
+
+ result = create_router_bgp(tgen, topo, input_dict_2)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ for addr_type in ADDR_TYPES:
+ # Verifying RIB routes
+ dut = "r3"
+ peer1 = "r1"
+ peer2 = "r4"
+ intf1 = topo["routers"][peer1]["links"][dut]["interface"]
+ intf2 = topo["routers"][peer2]["links"][dut]["interface"]
+
+ if addr_type == "ipv4":
+ next_hop_4 = NEXT_HOP_4
+ result = verify_rib(tgen, addr_type, dut, input_dict_2, next_hop_4)
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ if addr_type == "ipv6":
+ if "link_local" in PREFERRED_NEXT_HOP:
+ next_hop1 = get_frr_ipv6_linklocal(tgen, peer1, intf=intf1)
+ next_hop2 = get_frr_ipv6_linklocal(tgen, peer2, intf=intf2)
+
+ next_hop_6 = [next_hop1, next_hop2]
+ else:
+ next_hop_6 = NEXT_HOP_6
+
+ result = verify_rib(tgen, addr_type, dut, input_dict_2, next_hop_6)
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ logger.info("[Step 3] : Kill BGPd daemon on R1 and R4..")
+
+ # Kill BGPd daemon on R1
+ kill_router_daemons(tgen, "r1", ["bgpd"])
+
+ # Kill BGPd daemon on R4
+ kill_router_daemons(tgen, "r4", ["bgpd"])
+
+ for addr_type in ADDR_TYPES:
+ # Verifying RIB routes
+ next_hop_6 = ["fd00:0:0:1::1"]
+ if addr_type == "ipv4":
+ next_hop_4 = NEXT_HOP_4[0]
+
+ result = verify_rib(tgen, addr_type, dut, input_dict_2, next_hop_4)
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ if addr_type == "ipv6":
+ if "link_local" in PREFERRED_NEXT_HOP:
+ next_hop_6 = get_frr_ipv6_linklocal(tgen, peer1, intf=intf1)
+ else:
+ next_hop_6 = NEXT_HOP_6[0]
+
+ result = verify_rib(tgen, addr_type, dut, input_dict_2, next_hop_6)
+
+ # Verifying RIB routes
+ if addr_type == "ipv4":
+ next_hop_4 = NEXT_HOP_4[1]
+ result = verify_rib(
+ tgen, addr_type, dut, input_dict_2, next_hop_4, expected=False
+ )
+ assert result is not True, (
+ "Testcase {} : Failed \n "
+ "r3: routes are still present in BGP RIB\n Error: {}".format(
+ tc_name, result
+ )
+ )
+ logger.info(" Expected behavior: {}".format(result))
+
+ if addr_type == "ipv6":
+ if "link_local" in PREFERRED_NEXT_HOP:
+ next_hop_6 = get_frr_ipv6_linklocal(tgen, peer2, intf=intf2)
+ else:
+ next_hop_6 = NEXT_HOP_6[1]
+
+ result = verify_rib(
+ tgen, addr_type, dut, input_dict_2, next_hop_6, expected=False
+ )
+ assert result is not True, (
+ "Testcase {} : Failed \n "
+ "r3: routes are still present in ZEBRA\n Error: {}".format(
+ tc_name, result
+ )
+ )
+ logger.info(" Expected behavior: {}".format(result))
+
+ logger.info("[Step 4] : Start BGPd daemon on R1 and R4..")
+
+ # Start BGPd daemon on R1
+ start_router_daemons(tgen, "r1", ["bgpd"])
+
+ # Start BGPd daemon on R4
+ start_router_daemons(tgen, "r4", ["bgpd"])
+
+ write_test_footer(tc_name)
+
+
+def test_BGP_GR_chaos_34_2_p1(request):
+ """
+ Test Objective : Restarting node doesn't preserve the forwarding
+ state verify the behaviour on helper node, if it still keeps the
+ stale routes.
+ """
+
+ 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(
+ " Test Case : test_BGP_GR_chaos_34 "
+ "BGP GR "
+ "[Restart Mode]R1---R3[Helper Mode]"
+ )
+
+ logger.info("[Step 1] : Configure restarting" " router R1 to prevent ")
+ logger.info("[Step 2] : Reset the session" " between R1 and R3..")
+
+ # Configure graceful-restart
+ input_dict = {
+ "r1": {
+ "bgp": {
+ "graceful-restart": {"preserve-fw-state": True, "disable-eor": True},
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {"dest_link": {"r1": {"graceful-restart": True}}}
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {"dest_link": {"r1": {"graceful-restart": 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
+ )
+
+ # Verify f-bit before killing BGPd daemon
+ result = verify_f_bit(tgen, topo, addr_type, input_dict, "r3", "r1")
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ # Verifying BGP RIB routes after starting BGPd daemon
+ 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
+ result = verify_rib(tgen, addr_type, dut, input_dict_1)
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ logger.info("[Step 3] : Kill BGPd daemon on R1..")
+
+ # Kill BGPd daemon on R1
+ kill_router_daemons(tgen, "r1", ["bgpd"])
+
+ logger.info("[Step 4] : Withdraw/delete the prefixes " "originated from R1..")
+
+ # Api call to delete advertised networks
+ network = {"ipv4": "101.0.20.1/32", "ipv6": "1::1/128"}
+ for addr_type in ADDR_TYPES:
+ input_dict_2 = {
+ "r1": {
+ "bgp": {
+ "address_family": {
+ addr_type: {
+ "unicast": {
+ "advertise_networks": [
+ {
+ "network": network[addr_type],
+ "no_of_network": 5,
+ "delete": True,
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+
+ result = modify_bgp_config_when_bgpd_down(tgen, topo, input_dict_2)
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ logger.info("[Step 5] : Remove the CLI from R1's config to " "set the F-bit..")
+
+ # Modify graceful-restart config not to set f-bit
+ # and write to /etc/frr
+ input_dict_2 = {"r1": {"bgp": {"graceful-restart": {"preserve-fw-state": False}}}}
+
+ result = modify_bgp_config_when_bgpd_down(tgen, topo, input_dict_2)
+ assert result is True, "Testcase {} : Failed \n Error {}".format(tc_name, result)
+
+ logger.info("[Step 6] : Bring up the BGPd daemon on R1 again..")
+
+ # Start BGPd daemon on R1
+ start_router_daemons(tgen, "r1", ["bgpd"])
+
+ for addr_type in ADDR_TYPES:
+ # Verify f-bit after starting BGPd daemon
+ result = verify_f_bit(
+ tgen, topo, addr_type, input_dict, "r3", "r1", expected=False
+ )
+ assert (
+ result is not True
+ ), "Testcase {} : Failed \n " "r3: F-bit is set to True\n Error: {}".format(
+ tc_name, result
+ )
+ logger.info(" Expected behavior: {}".format(result))
+
+ # Verifying BGP RIB routes after starting BGPd daemon
+ 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 "
+ "r3: routes are still present in BGP RIB\n Error: {}".format(
+ tc_name, result
+ )
+ )
+ logger.info(" Expected behavior: {}".format(result))
+
+ # Verifying RIB routes
+ result = verify_rib(tgen, addr_type, dut, input_dict_1, expected=False)
+ assert result is not True, (
+ "Testcase {} : Failed \n "
+ "r3: routes are still present in ZEBRA\n Error: {}".format(tc_name, result)
+ )
+ logger.info(" Expected behavior: {}".format(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-3.py b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-3.py
new file mode 100644
index 0000000000..86d676dd8b
--- /dev/null
+++ b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-3.py
@@ -0,0 +1,1367 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2019 by VMware, Inc. ("VMware")
+# Used Copyright (c) 2018 by Network Device Education Foundation, Inc. ("NetDEF")
+# in this file.
+#
+# Permission to use, copy, modify, and/or distribute this software
+# for any purpose with or without fee is hereby granted, provided
+# that the above copyright notice and this permission notice appear
+# in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND VMWARE DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VMWARE BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+#
+
+"""
+Following tests are covered to test BGP Graceful Restart functionality.
+Basic Common Test steps for all the test case below :
+- Create topology (setup module)
+ Creating 7 routers topology
+- Bring up topology
+- Verify for bgp to converge
+- Configure BGP Graceful Restart on both the routers.
+
+TC_1_2:
+ Verify that EOR message is sent out only after initial convergence
+ Verify whether EOR message is received from all the peers after restart
+TC_3:
+ Verify the selection deferral timer functionality when EOR is not sent
+ by the helper router
+TC_11:
+ Verify that selection-deferral timer sets the maximum time to
+ avoid deadlock during which the best-path
+TC_10:
+ Test Objective : Test GR scenarios on helper router by enabling
+ Graceful Restart for multiple address families.
+TC_15:
+ Test Objective : Test GR scenarios by enabling Graceful Restart
+ for multiple address families..
+TC_16:
+ Test Objective : Verify BGP-GR feature when restarting node
+ is a transit router for it's iBGP peers.
+TC_18:
+ Test Objective : Verify that GR helper router deletes stale routes
+ received from restarting node, if GR capability is not present in
+TC_19:
+ Test Objective : Verify that GR routers keeps all the routes
+ received from restarting node if both the routers are
+TC_26:
+ Test Objective : Test GR scenarios on helper router by enabling
+ Graceful Restart for multiple address families.
+TC_28:
+ Test Objective : Verify if helper node goes down before restarting
+ node comes up online, helper node sets the R-bit to avoid dead-lock
+TC_29:
+ Test Objective : Change timers on the fly, and
+ verify if it takes immediate effect.
+TC_33:
+ Test Objective : Helper router receives same prefixes from two
+ different routers (GR-restarting and GR-disabled). Keeps the
+TC_34_1:
+ Test Objective : Restarting node doesn't preserve forwarding
+ state, helper router should not keep the stale entries.
+TC_34_2:
+ Test Objective : Restarting node doesn't preserve the forwarding
+ state verify the behaviour on helper node, if it still keeps the
+TC_32:
+ Test Objective : Restarting node is connected to multiple helper
+ nodes, one of them doesn't send EOR to restarting router. Verify
+TC_37:
+ Test Objective : Verify if helper node restarts before sending the
+ EOR message, restarting node doesn't wait until stale path timer
+TC_30:
+ Test Objective : Restarting node removes stale routes from Zebra
+ after receiving an EOR from helper router.
+
+"""
+
+import os
+import sys
+import time
+import pytest
+from time import sleep
+
+# Save the Current Working Directory to find configuration files.
+CWD = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join("../"))
+sys.path.append(os.path.join("../lib/"))
+
+# pylint: disable=C0413
+# Import topogen and topotest helpers
+from lib.topogen import Topogen, get_topogen
+from lib.topolog import logger
+
+# Required to instantiate the topology builder class.
+
+# Import topoJson from lib, to create topology and initial configuration
+from lib.topojson import build_config_from_json
+from lib.bgp import (
+ clear_bgp,
+ verify_bgp_rib,
+ verify_graceful_restart,
+ create_router_bgp,
+ verify_r_bit,
+ verify_eor,
+ verify_f_bit,
+ verify_bgp_convergence,
+ 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 (
+ write_test_header,
+ reset_config_on_routers,
+ start_topology,
+ kill_router_daemons,
+ start_router_daemons,
+ verify_rib,
+ check_address_types,
+ write_test_footer,
+ check_router_status,
+ step,
+ get_frr_ipv6_linklocal,
+ required_linux_kernel_version,
+)
+
+pytestmark = [pytest.mark.bgpd]
+
+
+# Global variables
+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"]
+
+
+def setup_module(mod):
+ """
+ Sets up the pytest environment
+
+ * `mod`: module name
+ """
+
+ # Required linux kernel version for this suite to run.
+ result = required_linux_kernel_version("4.16")
+ if result is not True:
+ pytest.skip("Kernel requirements are not met")
+
+ global ADDR_TYPES
+
+ testsuite_run_time = time.asctime(time.localtime(time.time()))
+ logger.info("Testsuite start time: {}".format(testsuite_run_time))
+ logger.info("=" * 40)
+
+ logger.info("Running setup_module to create topology")
+
+ # This function initiates the topology build with Topogen...
+ json_file = "{}/bgp_gr_topojson_topo2.json".format(CWD)
+ tgen = Topogen(json_file, mod.__name__)
+ global topo
+ topo = tgen.json_topo
+ # ... and here it calls Mininet initialization functions.
+
+ # Starting topology, create tmp files which are loaded to routers
+ # to start deamons and then start routers
+ start_topology(tgen)
+
+ # Creating configuration from JSON
+ build_config_from_json(tgen, topo)
+
+ # 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
+ )
+
+ logger.info("Running setup_module() done")
+
+
+def teardown_module(mod):
+ """
+ Teardown the pytest environment
+
+ * `mod`: module name
+ """
+
+ logger.info("Running teardown_module to delete topology")
+
+ tgen = get_topogen()
+
+ # Stop toplogy and Remove tmp files
+ tgen.stop_topology()
+
+ logger.info(
+ "Testsuite end time: {}".format(time.asctime(time.localtime(time.time())))
+ )
+ logger.info("=" * 40)
+
+
+def configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut, peer):
+ """
+ This function groups the repetitive function calls into one function.
+ """
+
+ logger.info("configure_gr_followed_by_clear: dut %s peer %s", dut, peer)
+
+ result = create_router_bgp(tgen, topo, input_dict)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ for addr_type in ADDR_TYPES:
+ neighbor = topo["routers"][peer]["links"][dut][addr_type].split("/")[0]
+ clear_bgp(tgen, addr_type, dut, neighbor=neighbor)
+
+ for addr_type in ADDR_TYPES:
+ neighbor = topo["routers"][dut]["links"][peer][addr_type].split("/")[0]
+ clear_bgp(tgen, addr_type, peer, neighbor=neighbor)
+
+ result = verify_bgp_convergence_from_running_config(tgen)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ return True
+
+
+def next_hop_per_address_family(tgen, dut, peer, addr_type, next_hop_dict):
+ """
+ This function returns link_local or global next_hop per address-family
+ """
+
+ intferface = topo["routers"][peer]["links"]["{}-link1".format(dut)]["interface"]
+ if addr_type == "ipv6" and "link_local" in PREFERRED_NEXT_HOP:
+ next_hop = get_frr_ipv6_linklocal(tgen, peer, intf=intferface)
+ else:
+ next_hop = next_hop_dict[addr_type]
+
+ return next_hop
+
+
+def test_BGP_GR_chaos_34_1_p1(request):
+ """
+ Test Objective : Restarting node doesn't preserve forwarding
+ state, helper router should not keep the stale entries.
+ """
+
+ 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(
+ " Test Case : test_BGP_GR_chaos_31 "
+ "BGP GR "
+ "[Restart Mode]R1---R3[Helper Mode]"
+ )
+
+ # Configure graceful-restart
+ input_dict = {
+ "r1": {
+ "bgp": {
+ "graceful-restart": {
+ "preserve-fw-state": True,
+ "timer": {"restart-time": GR_RESTART_TIMER},
+ },
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {"dest_link": {"r1": {"graceful-restart": True}}}
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {"dest_link": {"r1": {"graceful-restart": 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 after starting BGPd daemon
+ 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
+ result = verify_rib(tgen, addr_type, dut, input_dict_1)
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ logger.info(
+ "[Step 1] : Remove the preserve-fw-state command"
+ " from restarting node R1's config"
+ )
+
+ # Configure graceful-restart to set f-bit as False
+ input_dict_2 = {"r1": {"bgp": {"graceful-restart": {"preserve-fw-state": False}}}}
+
+ result = create_router_bgp(tgen, topo, input_dict_2)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ logger.info("[Step 2] : Reset the session between R1 and R3..")
+
+ # Reset sessions
+ 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(
+ tgen, topo, addr_type, input_dict_2, "r3", "r1", expected=False
+ )
+ assert (
+ result is not True
+ ), "Testcase {} : Failed \n " "r3: F-bit is set to True\n Error: {}".format(
+ tc_name, result
+ )
+ logger.info(" Expected behavior: {}".format(result))
+
+ logger.info("[Step 3] : Kill BGPd daemon on R1..")
+
+ # Kill BGPd daemon on R1
+ kill_router_daemons(tgen, "r1", ["bgpd"])
+
+ # Waiting for GR_RESTART_TIMER
+ logger.info("Waiting for {} sec..".format(GR_RESTART_TIMER))
+ sleep(GR_RESTART_TIMER)
+
+ for addr_type in ADDR_TYPES:
+ # Verifying BGP RIB routes
+ input_dict = {key: topo["routers"][key] for key in ["r1"]}
+ result = verify_bgp_rib(tgen, addr_type, dut, input_dict, expected=False)
+ assert result is not True, (
+ "Testcase {} : Failed \n "
+ "r3: routes are still present in BGP RIB\n Error: {}".format(
+ tc_name, result
+ )
+ )
+ logger.info(" Expected behavior: {}".format(result))
+
+ # Verifying RIB routes
+ result = verify_rib(tgen, addr_type, dut, input_dict, expected=False)
+ assert result is not True, (
+ "Testcase {} : Failed \n "
+ "r3: routes are still present in ZEBRA\n Error: {}".format(tc_name, result)
+ )
+ logger.info(" Expected behavior: {}".format(result))
+
+ # Start BGPd daemon on R1
+ start_router_daemons(tgen, "r1", ["bgpd"])
+
+ write_test_footer(tc_name)
+
+
+def test_BGP_GR_chaos_32_p1(request):
+ """
+ Test Objective : Restarting node is connected to multiple helper
+ nodes, one of them doesn't send EOR to restarting router. Verify
+ that only after SDT restarting node send EOR to all helper peers
+ excluding the prefixes originated by faulty 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(
+ " Test Case : test_BGP_GR_chaos_32 "
+ "BGP GR "
+ "[Restart Mode]R1---R3&R5[Helper Mode]"
+ )
+
+ logger.info(
+ "[Step 1] : Change the mode on R1 be a restarting" " node on global level"
+ )
+
+ # Configure graceful-restart
+ input_dict = {
+ "r1": {
+ "bgp": {
+ "graceful-restart": {"graceful-restart": True},
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {"dest_link": {"r1": {"next_hop_self": True}}},
+ "r5": {"dest_link": {"r1": {"graceful-restart": True}}},
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {"dest_link": {"r1": {"next_hop_self": True}}},
+ "r5": {"dest_link": {"r1": {"graceful-restart": True}}},
+ }
+ }
+ },
+ },
+ }
+ },
+ "r5": {
+ "bgp": {
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r5": {"graceful-restart-helper": True}
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r5": {"graceful-restart-helper": True}
+ }
+ }
+ }
+ }
+ },
+ }
+ }
+ },
+ }
+
+ configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r5")
+
+ for addr_type in ADDR_TYPES:
+ result = verify_graceful_restart(
+ tgen, topo, addr_type, input_dict, dut="r1", peer="r5"
+ )
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ # Verifying BGP RIB routes after starting BGPd daemon
+ dut = "r3"
+ input_dict_1 = {key: topo["routers"][key] for key in ["r5"]}
+ 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("[Step 2] : Kill BGPd daemon on R1..")
+ # Kill BGPd daemon on R1
+ kill_router_daemons(tgen, "r1", ["bgpd"])
+
+ logger.info("[Step 3] : Withdraw all the advertised prefixes from R5")
+
+ # Api call to delete advertised networks
+ network = {"ipv4": "105.0.20.1/32", "ipv6": "5::1/128"}
+ for addr_type in ADDR_TYPES:
+ input_dict_2 = {
+ "r5": {
+ "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(
+ "[Step 4] : Stop the helper router R5 from sending EOR" " message using CLI"
+ )
+
+ # Modify graceful-restart config to prevent sending EOR
+ input_dict_3 = {"r5": {"bgp": {"graceful-restart": {"disable-eor": True}}}}
+
+ result = create_router_bgp(tgen, topo, input_dict_3)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ logger.info("[Step 5] : Bring up the BGPd daemon on R1..")
+
+ # Start BGPd daemon on R1
+ start_router_daemons(tgen, "r1", ["bgpd"])
+
+ for addr_type in ADDR_TYPES:
+ # Verify EOR is disabled
+ result = verify_eor(
+ tgen, topo, addr_type, input_dict_3, dut="r5", peer="r1", expected=False
+ )
+ assert (
+ result is not True
+ ), "Testcase {} : Failed \n " "r5: EOR is set to TRUE\n Error: {}".format(
+ tc_name, result
+ )
+ logger.info(" Expected behavior: {}".format(result))
+
+ # Verifying BGP RIB routes after starting BGPd daemon
+ input_dict_1 = {key: topo["routers"][key] for key in ["r5"]}
+ result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1, expected=False)
+ assert result is not True, (
+ "Testcase {} : Failed \n "
+ "r3: routes are still present in BGP RIB\n Error: {}".format(
+ tc_name, result
+ )
+ )
+ logger.info(" Expected behavior: {}".format(result))
+
+ # Verifying RIB routes
+ result = verify_rib(tgen, addr_type, dut, input_dict_1, expected=False)
+ assert result is not True, (
+ "Testcase {} : Failed \n "
+ "r3: routes are still present in ZEBRA\n Error: {}".format(tc_name, result)
+ )
+ logger.info(" Expected behavior: {}".format(result))
+
+ write_test_footer(tc_name)
+
+
+def test_BGP_GR_chaos_37_p1(request):
+ """
+ Test Objective : Verify if helper node restarts before sending the
+ EOR message, restarting node doesn't wait until stale path timer
+ expiry to do the best path selection and sends an EOR
+ """
+
+ 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(
+ " Test Case : test_BGP_GR_chaos_37 "
+ "BGP GR "
+ "[Restart Mode]R1---R3[Helper Mode]"
+ )
+
+ logger.info(
+ "[Step 1] : Configure restarting router R3 to prevent " "sending an EOR.."
+ )
+
+ logger.info("[Step 2] : Reset the session between R3 and R1..")
+
+ # Configure graceful-restart
+ input_dict = {
+ "r1": {
+ "bgp": {
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {"dest_link": {"r1": {"graceful-restart": True}}}
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {"dest_link": {"r1": {"graceful-restart": True}}}
+ }
+ }
+ },
+ }
+ }
+ },
+ "r3": {
+ "bgp": {
+ "graceful-restart": {"disable-eor": True},
+ "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
+ )
+
+ # Verify EOR is disabled
+ result = verify_eor(
+ tgen, topo, addr_type, input_dict, dut="r3", peer="r1", expected=False
+ )
+ assert (
+ result is not True
+ ), "Testcase {} : Failed \n " "r3: EOR is set to True\n Error: {}".format(
+ tc_name, result
+ )
+ logger.info(" Expected behavior: {}".format(result))
+
+ # Verifying BGP RIB routes after starting BGPd daemon
+ 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("[Step 3] : Kill BGPd daemon on R1..")
+
+ # Kill BGPd daemon on R1
+ kill_router_daemons(tgen, "r1", ["bgpd"])
+
+ logger.info("[Step 4] : Start BGPd daemon on R1..")
+
+ # Start BGPd daemon on R1
+ start_router_daemons(tgen, "r1", ["bgpd"])
+
+ logger.info("[Step 5] : Kill BGPd daemon on R3..")
+
+ # Kill BGPd daemon on R3
+ kill_router_daemons(tgen, "r3", ["bgpd"])
+
+ # Modify graceful-restart config to prevent sending EOR
+ input_dict_2 = {"r3": {"bgp": {"graceful-restart": {"disable-eor": True}}}}
+
+ result = modify_bgp_config_when_bgpd_down(tgen, topo, input_dict_2)
+ assert result is True, "Testcase {} : Failed \n Error {}".format(tc_name, result)
+
+ logger.info("[Step 6] : Start BGPd daemon on R3..")
+
+ # Start BGPd daemon on R3
+ start_router_daemons(tgen, "r3", ["bgpd"])
+
+ for addr_type in ADDR_TYPES:
+ # Verify r_bit
+ result = verify_r_bit(tgen, topo, addr_type, input_dict, dut="r1", peer="r3")
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ # Verifying RIB routes
+ input_dict_1 = {key: topo["routers"][key] for key in ["r3"]}
+ result = verify_rib(tgen, addr_type, dut, input_dict_1)
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ # Verify EOR is send from R1 to R3
+ input_dict_3 = {"r1": {"bgp": {"graceful-restart": {"disable-eor": True}}}}
+
+ result = verify_eor(
+ tgen, topo, addr_type, input_dict_3, dut="r1", peer="r3", expected=False
+ )
+ assert (
+ result is not True
+ ), "Testcase {} : Failed \n " "r1: EOR is set to True\n Error: {}".format(
+ tc_name, result
+ )
+
+ write_test_footer(tc_name)
+
+
+def test_BGP_GR_chaos_30_p1(request):
+ """
+ Test Objective : Restarting node removes stale routes from Zebra
+ after receiving an EOR from helper 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(
+ " Test Case : test_BGP_GR_chaos_30 "
+ "BGP GR [Helper Mode]R3-----R1[Restart Mode] "
+ )
+
+ # Configure graceful-restart and timers
+ input_dict = {
+ "r1": {
+ "bgp": {
+ "graceful-restart": {"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}}}
+ }
+ }
+ },
+ },
+ }
+ },
+ "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
+ )
+
+ for addr_type in ADDR_TYPES:
+ # Verifying BGP RIB routes before shutting down BGPd daemon
+ dut = "r1"
+ input_dict = {key: topo["routers"][key] for key in ["r3"]}
+ result = verify_bgp_rib(tgen, addr_type, dut, input_dict)
+ 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)
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ logger.info("[Step 2] : Kill BGPd daemon on R1..")
+
+ # Kill BGPd daemon on R1
+ kill_router_daemons(tgen, "r1", ["bgpd"])
+
+ logger.info("[Step 3] : Withdraw advertised prefixes from R3...")
+
+ # Api call to delete advertised networks
+ network = {"ipv4": "103.0.20.1/32", "ipv6": "3::1/128"}
+ for addr_type in ADDR_TYPES:
+ input_dict = {
+ "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)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(
+ tc_name, result
+ )
+
+ logger.info("[Step 4] : Start BGPd daemon on R1..")
+
+ # Start BGPd daemon on R1
+ start_router_daemons(tgen, "r1", ["bgpd"])
+
+ for addr_type in ADDR_TYPES:
+ # Verifying BGP RIB routes before shutting down BGPd daemon
+ input_dict = {key: topo["routers"][key] for key in ["r3"]}
+ result = verify_bgp_rib(tgen, addr_type, dut, input_dict, expected=False)
+ assert result is not True, (
+ "Testcase {} : Failed \n "
+ "r1: routes are still present in BGP RIB\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, expected=False)
+ assert result is not True, (
+ "Testcase {} : Failed \n "
+ "r1: routes are still present in ZEBRA\n Error: {}".format(tc_name, result)
+ )
+ logger.info(" Expected behavior: {}".format(result))
+
+ 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 "
+ "r1: routes are still present in ZEBRA\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-4.py b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-4.py
new file mode 100644
index 0000000000..889f47f377
--- /dev/null
+++ b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-4.py
@@ -0,0 +1,1024 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2019 by VMware, Inc. ("VMware")
+# Used Copyright (c) 2018 by Network Device Education Foundation, Inc. ("NetDEF")
+# in this file.
+#
+# Permission to use, copy, modify, and/or distribute this software
+# for any purpose with or without fee is hereby granted, provided
+# that the above copyright notice and this permission notice appear
+# in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND VMWARE DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VMWARE BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+#
+
+"""
+Following tests are covered to test BGP Graceful Restart functionality.
+Basic Common Test steps for all the test case below :
+- Create topology (setup module)
+ Creating 7 routers topology
+- Bring up topology
+- Verify for bgp to converge
+- Configure BGP Graceful Restart on both the routers.
+
+TC_1_2:
+ Verify that EOR message is sent out only after initial convergence
+ Verify whether EOR message is received from all the peers after restart
+TC_3:
+ Verify the selection deferral timer functionality when EOR is not sent
+ by the helper router
+TC_11:
+ Verify that selection-deferral timer sets the maximum time to
+ avoid deadlock during which the best-path
+TC_10:
+ Test Objective : Test GR scenarios on helper router by enabling
+ Graceful Restart for multiple address families.
+TC_15:
+ Test Objective : Test GR scenarios by enabling Graceful Restart
+ for multiple address families..
+TC_16:
+ Test Objective : Verify BGP-GR feature when restarting node
+ is a transit router for it's iBGP peers.
+TC_18:
+ Test Objective : Verify that GR helper router deletes stale routes
+ received from restarting node, if GR capability is not present in
+TC_19:
+ Test Objective : Verify that GR routers keeps all the routes
+ received from restarting node if both the routers are
+TC_26:
+ Test Objective : Test GR scenarios on helper router by enabling
+ Graceful Restart for multiple address families.
+TC_28:
+ Test Objective : Verify if helper node goes down before restarting
+ node comes up online, helper node sets the R-bit to avoid dead-lock
+TC_29:
+ Test Objective : Change timers on the fly, and
+ verify if it takes immediate effect.
+TC_33:
+ Test Objective : Helper router receives same prefixes from two
+ different routers (GR-restarting and GR-disabled). Keeps the
+TC_34_1:
+ Test Objective : Restarting node doesn't preserve forwarding
+ state, helper router should not keep the stale entries.
+TC_34_2:
+ Test Objective : Restarting node doesn't preserve the forwarding
+ state verify the behaviour on helper node, if it still keeps the
+TC_32:
+ Test Objective : Restarting node is connected to multiple helper
+ nodes, one of them doesn't send EOR to restarting router. Verify
+TC_37:
+ Test Objective : Verify if helper node restarts before sending the
+ EOR message, restarting node doesn't wait until stale path timer
+TC_30:
+ Test Objective : Restarting node removes stale routes from Zebra
+ after receiving an EOR from helper router.
+
+These tests have been broken up into 4 sub python scripts because
+the totality of run time for this script was greater than 10 minutes
+"""
+
+import os
+import sys
+import time
+import pytest
+from time import sleep
+
+# Save the Current Working Directory to find configuration files.
+CWD = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join("../"))
+sys.path.append(os.path.join("../lib/"))
+
+# pylint: disable=C0413
+# Import topogen and topotest helpers
+from lib.topogen import Topogen, get_topogen
+from lib.topolog import logger
+
+# Required to instantiate the topology builder class.
+
+# Import topoJson from lib, to create topology and initial configuration
+from lib.topojson import build_config_from_json
+from lib.bgp import (
+ clear_bgp,
+ verify_bgp_rib,
+ verify_graceful_restart,
+ create_router_bgp,
+ verify_r_bit,
+ verify_eor,
+ verify_f_bit,
+ verify_bgp_convergence,
+ 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 (
+ write_test_header,
+ reset_config_on_routers,
+ start_topology,
+ kill_router_daemons,
+ start_router_daemons,
+ verify_rib,
+ check_address_types,
+ write_test_footer,
+ check_router_status,
+ step,
+ get_frr_ipv6_linklocal,
+ required_linux_kernel_version,
+)
+
+pytestmark = [pytest.mark.bgpd]
+
+
+# Global variables
+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"]
+
+
+def setup_module(mod):
+ """
+ Sets up the pytest environment
+
+ * `mod`: module name
+ """
+
+ # Required linux kernel version for this suite to run.
+ result = required_linux_kernel_version("4.16")
+ if result is not True:
+ pytest.skip("Kernel requirements are not met")
+
+ global ADDR_TYPES
+
+ testsuite_run_time = time.asctime(time.localtime(time.time()))
+ logger.info("Testsuite start time: {}".format(testsuite_run_time))
+ logger.info("=" * 40)
+
+ logger.info("Running setup_module to create topology")
+
+ # This function initiates the topology build with Topogen...
+ json_file = "{}/bgp_gr_topojson_topo2.json".format(CWD)
+ tgen = Topogen(json_file, mod.__name__)
+ global topo
+ topo = tgen.json_topo
+ # ... and here it calls Mininet initialization functions.
+
+ # Starting topology, create tmp files which are loaded to routers
+ # to start deamons and then start routers
+ start_topology(tgen)
+
+ # Creating configuration from JSON
+ build_config_from_json(tgen, topo)
+
+ # 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
+ )
+
+ logger.info("Running setup_module() done")
+
+
+def teardown_module(mod):
+ """
+ Teardown the pytest environment
+
+ * `mod`: module name
+ """
+
+ logger.info("Running teardown_module to delete topology")
+
+ tgen = get_topogen()
+
+ # Stop toplogy and Remove tmp files
+ tgen.stop_topology()
+
+ logger.info(
+ "Testsuite end time: {}".format(time.asctime(time.localtime(time.time())))
+ )
+ logger.info("=" * 40)
+
+
+def configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut, peer):
+ """
+ This function groups the repetitive function calls into one function.
+ """
+
+ logger.info("configure_gr_followed_by_clear: dut %s peer %s", dut, peer)
+
+ result = create_router_bgp(tgen, topo, input_dict)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ for addr_type in ADDR_TYPES:
+ neighbor = topo["routers"][peer]["links"][dut][addr_type].split("/")[0]
+ clear_bgp(tgen, addr_type, dut, neighbor=neighbor)
+
+ for addr_type in ADDR_TYPES:
+ neighbor = topo["routers"][dut]["links"][peer][addr_type].split("/")[0]
+ clear_bgp(tgen, addr_type, peer, neighbor=neighbor)
+
+ result = verify_bgp_convergence_from_running_config(tgen)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+
+ return True
+
+
+def next_hop_per_address_family(tgen, dut, peer, addr_type, next_hop_dict):
+ """
+ This function returns link_local or global next_hop per address-family
+ """
+
+ intferface = topo["routers"][peer]["links"]["{}-link1".format(dut)]["interface"]
+ if addr_type == "ipv6" and "link_local" in PREFERRED_NEXT_HOP:
+ next_hop = get_frr_ipv6_linklocal(tgen, peer, intf=intferface)
+ else:
+ next_hop = next_hop_dict[addr_type]
+
+ return next_hop
+
+
+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 {} : Failed \n " "r1: EOR is set to True\n Error: {}".format(
+ tc_name, 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 "
+ "r3: routes are still present in BGP RIB\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 "
+ "r3: routes are still present in ZEBRA\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_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py
deleted file mode 100644
index 52ad7813c5..0000000000
--- a/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2.py
+++ /dev/null
@@ -1,4358 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (c) 2019 by VMware, Inc. ("VMware")
-# Used Copyright (c) 2018 by Network Device Education Foundation, Inc. ("NetDEF")
-# in this file.
-#
-# Permission to use, copy, modify, and/or distribute this software
-# for any purpose with or without fee is hereby granted, provided
-# that the above copyright notice and this permission notice appear
-# in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND VMWARE DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VMWARE BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
-# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
-# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
-# OF THIS SOFTWARE.
-#
-
-"""
-Following tests are covered to test BGP Graceful Restart functionality.
-Basic Common Test steps for all the test case below :
-- Create topology (setup module)
- Creating 7 routers topology
-- Bring up topology
-- Verify for bgp to converge
-- Configure BGP Graceful Restart on both the routers.
-
-TC_1_2:
- Verify that EOR message is sent out only after initial convergence
- Verify whether EOR message is received from all the peers after restart
-TC_3:
- Verify the selection deferral timer functionality when EOR is not sent
- by the helper router
-TC_11:
- Verify that selection-deferral timer sets the maximum time to
- avoid deadlock during which the best-path
-TC_10:
- Test Objective : Test GR scenarios on helper router by enabling
- Graceful Restart for multiple address families.
-TC_15:
- Test Objective : Test GR scenarios by enabling Graceful Restart
- for multiple address families..
-TC_16:
- Test Objective : Verify BGP-GR feature when restarting node
- is a transit router for it's iBGP peers.
-TC_18:
- Test Objective : Verify that GR helper router deletes stale routes
- received from restarting node, if GR capability is not present in
-TC_19:
- Test Objective : Verify that GR routers keeps all the routes
- received from restarting node if both the routers are
-TC_26:
- Test Objective : Test GR scenarios on helper router by enabling
- Graceful Restart for multiple address families.
-TC_28:
- Test Objective : Verify if helper node goes down before restarting
- node comes up online, helper node sets the R-bit to avoid dead-lock
-TC_29:
- Test Objective : Change timers on the fly, and
- verify if it takes immediate effect.
-TC_33:
- Test Objective : Helper router receives same prefixes from two
- different routers (GR-restarting and GR-disabled). Keeps the
-TC_34_1:
- Test Objective : Restarting node doesn't preserve forwarding
- state, helper router should not keep the stale entries.
-TC_34_2:
- Test Objective : Restarting node doesn't preserve the forwarding
- state verify the behaviour on helper node, if it still keeps the
-TC_32:
- Test Objective : Restarting node is connected to multiple helper
- nodes, one of them doesn't send EOR to restarting router. Verify
-TC_37:
- Test Objective : Verify if helper node restarts before sending the
- EOR message, restarting node doesn't wait until stale path timer
-TC_30:
- Test Objective : Restarting node removes stale routes from Zebra
- after receiving an EOR from helper router.
-
-"""
-
-import os
-import sys
-import time
-import pytest
-from time import sleep
-
-# Save the Current Working Directory to find configuration files.
-CWD = os.path.dirname(os.path.realpath(__file__))
-sys.path.append(os.path.join("../"))
-sys.path.append(os.path.join("../lib/"))
-
-# pylint: disable=C0413
-# Import topogen and topotest helpers
-from lib.topogen import Topogen, get_topogen
-from lib.topolog import logger
-
-# Required to instantiate the topology builder class.
-
-# Import topoJson from lib, to create topology and initial configuration
-from lib.topojson import build_config_from_json
-from lib.bgp import (
- clear_bgp,
- verify_bgp_rib,
- verify_graceful_restart,
- create_router_bgp,
- verify_r_bit,
- verify_eor,
- verify_f_bit,
- verify_bgp_convergence,
- 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 (
- write_test_header,
- reset_config_on_routers,
- start_topology,
- kill_router_daemons,
- start_router_daemons,
- verify_rib,
- check_address_types,
- write_test_footer,
- check_router_status,
- step,
- get_frr_ipv6_linklocal,
- required_linux_kernel_version,
-)
-
-pytestmark = [pytest.mark.bgpd]
-
-
-# Global variables
-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"]
-
-
-def setup_module(mod):
- """
- Sets up the pytest environment
-
- * `mod`: module name
- """
-
- # Required linux kernel version for this suite to run.
- result = required_linux_kernel_version("4.16")
- if result is not True:
- pytest.skip("Kernel requirements are not met")
-
- global ADDR_TYPES
-
- testsuite_run_time = time.asctime(time.localtime(time.time()))
- logger.info("Testsuite start time: {}".format(testsuite_run_time))
- logger.info("=" * 40)
-
- logger.info("Running setup_module to create topology")
-
- # This function initiates the topology build with Topogen...
- json_file = "{}/bgp_gr_topojson_topo2.json".format(CWD)
- tgen = Topogen(json_file, mod.__name__)
- global topo
- topo = tgen.json_topo
- # ... and here it calls Mininet initialization functions.
-
- # Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
- start_topology(tgen)
-
- # Creating configuration from JSON
- build_config_from_json(tgen, topo)
-
- # 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
- )
-
- logger.info("Running setup_module() done")
-
-
-def teardown_module(mod):
- """
- Teardown the pytest environment
-
- * `mod`: module name
- """
-
- logger.info("Running teardown_module to delete topology")
-
- tgen = get_topogen()
-
- # Stop toplogy and Remove tmp files
- tgen.stop_topology()
-
- logger.info(
- "Testsuite end time: {}".format(time.asctime(time.localtime(time.time())))
- )
- logger.info("=" * 40)
-
-
-def configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut, peer):
- """
- This function groups the repetitive function calls into one function.
- """
-
- logger.info("configure_gr_followed_by_clear: dut %s peer %s", dut, peer)
-
- result = create_router_bgp(tgen, topo, input_dict)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
-
- for addr_type in ADDR_TYPES:
- neighbor = topo["routers"][peer]["links"][dut][addr_type].split("/")[0]
- clear_bgp(tgen, addr_type, dut, neighbor=neighbor)
-
- for addr_type in ADDR_TYPES:
- neighbor = topo["routers"][dut]["links"][peer][addr_type].split("/")[0]
- clear_bgp(tgen, addr_type, peer, neighbor=neighbor)
-
- result = verify_bgp_convergence_from_running_config(tgen)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
-
- return True
-
-
-def next_hop_per_address_family(tgen, dut, peer, addr_type, next_hop_dict):
- """
- This function returns link_local or global next_hop per address-family
- """
-
- intferface = topo["routers"][peer]["links"]["{}-link1".format(dut)]["interface"]
- if addr_type == "ipv6" and "link_local" in PREFERRED_NEXT_HOP:
- next_hop = get_frr_ipv6_linklocal(tgen, peer, intf=intferface)
- else:
- next_hop = next_hop_dict[addr_type]
-
- return next_hop
-
-
-def test_BGP_GR_TC_1_2_p0(request):
- """
- Verify that EOR message is sent out only after initial convergence
- Verify whether EOR message is received from all the peers 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 EOR Sent and Received : BGP_GR_TC_1_2 >> "
- "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 R3
- 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"])
-
- for addr_type in ADDR_TYPES:
- # Verifying RIB routes
- input_dict_1 = {key: topo["routers"][key] for key in ["r3"]}
- # 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("Starting bgpd process")
- start_router_daemons(tgen, "r1", ["bgpd"])
- logger.info("R1 is UP Now")
-
- 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 R3
- 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
- )
-
- # Verifying EOR on restarting router
- result = verify_eor(tgen, topo, addr_type, input_dict, dut="r3", peer="r1")
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- write_test_footer(tc_name)
-
-
-def test_BGP_GR_TC_3_p0(request):
- """
- Verify the selection deferral timer functionality when EOR is not sent
- by the helper 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(
- " Verify route download to RIB: BGP_GR_TC_3 >> "
- "BGP GR [Helper Mode]R1-----R2[Restart Mode] "
- )
-
- # Configure graceful-restart
- input_dict = {
- "r1": {
- "bgp": {
- "graceful-restart": {
- "disable-eor": True,
- },
- "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,
- "timer": {"select-defer-time": GR_SELECT_DEFER_TIMER},
- },
- "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 = "r2"
- 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
- 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"])
-
- logger.info("R2 is about to come up now")
- start_router_daemons(tgen, "r2", ["bgpd"])
- logger.info("R2 is UP Now")
-
- for addr_type in ADDR_TYPES:
- # Verifying BGP RIB routes received from router R1
- 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
- )
-
- # Verify EOR on restarting router
- result = verify_eor(
- tgen, topo, addr_type, input_dict, dut="r2", peer="r1", expected=False
- )
- assert (
- result is not True
- ), "Testcase {} : Failed \n " "r2: EOR is set to True\n Error: {}".format(
- tc_name, result
- )
-
- logger.info(
- "Waiting for selection deferral timer({} sec)..".format(GR_SELECT_DEFER_TIMER)
- )
- sleep(GR_SELECT_DEFER_TIMER)
-
- for addr_type in ADDR_TYPES:
- # Verifying RIB routes
- result = verify_rib(tgen, addr_type, "r2", input_dict_1)
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- write_test_footer(tc_name)
-
-
-def test_BGP_GR_TC_11_p0(request):
- """
- Verify that selection-deferral timer sets the maximum time to
- avoid deadlock during which the best-path
- selection process is deferred, after a peer session was restarted
- """
-
- 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 EOR Sent after deferral timeout : BGP_GR_TC_11")
-
- # Configure graceful-restart
- input_dict = {
- "r1": {
- "bgp": {
- "graceful-restart": {
- "graceful-restart": True,
- "select-defer-time": GR_SELECT_DEFER_TIMER,
- },
- "address_family": {
- "ipv4": {
- "unicast": {
- "neighbor": {
- "r2": {"dest_link": {"r1": {"graceful-restart": True}}},
- "r3": {"dest_link": {"r1": {"graceful-restart": True}}},
- }
- }
- },
- "ipv6": {
- "unicast": {
- "neighbor": {
- "r2": {"dest_link": {"r1": {"graceful-restart": True}}},
- "r3": {"dest_link": {"r1": {"graceful-restart": True}}},
- }
- }
- },
- },
- }
- },
- "r3": {
- "bgp": {
- "graceful-restart": {"disable-eor": True},
- "address_family": {
- "ipv4": {
- "unicast": {
- "neighbor": {
- "r1": {
- "dest_link": {
- "r3": {"graceful-restart-helper": True}
- }
- }
- }
- }
- },
- "ipv6": {
- "unicast": {
- "neighbor": {
- "r1": {
- "dest_link": {
- "r3": {"graceful-restart-helper": True}
- }
- }
- }
- }
- },
- },
- }
- },
- }
-
- result = create_router_bgp(tgen, topo, input_dict)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
-
- for addr_type in ADDR_TYPES:
- 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"
- )
- 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"])
-
- logger.info("Starting bgpd process")
- start_router_daemons(tgen, "r1", ["bgpd"])
- logger.info("R1 is UP Now")
-
- for addr_type in ADDR_TYPES:
- # Verify EOR on restarting router
- result = verify_eor(
- tgen, topo, addr_type, input_dict, dut="r1", peer="r3", expected=False
- )
- assert (
- result is not True
- ), "Testcase {} : Failed \n " "r1: EOR is set to True\n Error: {}".format(
- tc_name, result
- )
-
- logger.info(
- "Waiting for selection deferral timer({} sec).. ".format(
- GR_SELECT_DEFER_TIMER + 2
- )
- )
- sleep(GR_SELECT_DEFER_TIMER + 2)
-
- for addr_type in ADDR_TYPES:
- # Verifying BGP RIB routes received from router 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
- )
-
- # Verifying EOR on restarting router
- result = verify_eor(
- tgen, topo, addr_type, input_dict, dut="r3", peer="r1", expected=False
- )
- assert (
- result is not True
- ), "Testcase {} : Failed \n " "r3: EOR is set to True\n Error: {}".format(
- tc_name, result
- )
-
- write_test_footer(tc_name)
-
-
-def test_BGP_GR_10_p2(request):
- """
- Test Objective : Test GR scenarios on helper router 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)
-
- step("Test Setup: [Helper Mode]R3-----R1[Restart Mode] initialized")
-
- # Configure graceful-restart
- input_dict = {
- "r1": {
- "bgp": {
- "address_family": {
- "ipv4": {
- "unicast": {
- "neighbor": {
- "r3": {
- "dest_link": {
- "r1": {
- "next_hop_self": True,
- "graceful-restart": True,
- "activate": "ipv6",
- }
- }
- }
- }
- }
- },
- "ipv6": {
- "unicast": {
- "neighbor": {
- "r3": {
- "dest_link": {
- "r1": {
- "next_hop_self": True,
- "graceful-restart": True,
- "activate": "ipv4",
- }
- }
- }
- }
- }
- },
- }
- }
- },
- "r3": {
- "bgp": {
- "address_family": {
- "ipv4": {
- "unicast": {
- "neighbor": {
- "r1": {
- "dest_link": {
- "r3": {
- "graceful-restart-helper": True,
- "activate": "ipv6",
- }
- }
- }
- }
- }
- },
- "ipv6": {
- "unicast": {
- "neighbor": {
- "r1": {
- "dest_link": {
- "r3": {
- "graceful-restart-helper": True,
- "activate": "ipv4",
- }
- }
- }
- }
- }
- },
- }
- }
- },
- }
-
- configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r3")
-
- for addr_type in ADDR_TYPES:
- step(
- "Verifying GR config and operational state for addr_type {}".format(
- addr_type
- )
- )
-
- 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_topo = {key: topo["routers"][key] for key in ["r1"]}
- 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 before shutting down BGPd daemon
- result = verify_rib(tgen, addr_type, dut, input_topo)
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- # verify multi address family
- result = verify_gr_address_family(
- tgen,
- topo,
- addr_type,
- "ipv4Unicast",
- dut="r1",
- peer="r3",
- )
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- # verify multi address family
- result = verify_gr_address_family(
- tgen,
- topo,
- addr_type,
- "ipv6Unicast",
- dut="r1",
- peer="r3",
- )
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- # verify multi address family
- result = verify_gr_address_family(
- tgen,
- topo,
- addr_type,
- "ipv4Unicast",
- dut="r3",
- peer="r1",
- )
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- # verify multi address family
- result = verify_gr_address_family(
- tgen,
- topo,
- addr_type,
- "ipv6Unicast",
- dut="r3",
- peer="r1",
- )
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- step("Killing bgpd on r1")
-
- # Kill BGPd daemon on R1
- kill_router_daemons(tgen, "r1", ["bgpd"])
-
- for addr_type in ADDR_TYPES:
- # Verifying BGP RIB routes
- input_topo = {key: topo["routers"][key] for key in ["r1"]}
- 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 before shutting down BGPd daemon
- result = verify_rib(tgen, addr_type, dut, input_topo)
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- step("Starting bgpd on r1")
-
- # Start BGPd daemon on R1
- start_router_daemons(tgen, "r1", ["bgpd"])
-
- for addr_type in ADDR_TYPES:
- # Verifying BGP RIB routes
- input_topo = {key: topo["routers"][key] for key in ["r1"]}
- 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 before shutting down BGPd daemon
- result = verify_rib(tgen, addr_type, dut, input_topo)
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- write_test_footer(tc_name)
-
-
-def BGP_GR_16_p2(request):
- """
- Test Objective : Verify BGP-GR feature when restarting 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] initialized"
- )
-
- # Configure graceful-restart and timers
- input_dict = {
- "r1": {
- "bgp": {
- "address_family": {
- "ipv4": {
- "unicast": {
- "neighbor": {
- "r3": {
- "dest_link": {
- "r1": {
- "graceful-restart": True,
- "next_hop_self": True,
- }
- }
- }
- }
- }
- },
- "ipv6": {
- "unicast": {
- "neighbor": {
- "r3": {
- "dest_link": {
- "r1": {
- "graceful-restart": 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 "
- "[Helper Mode]R3-----R1[Restart Mode]"
- "--------R6[Helper Mode] initialized"
- )
-
- # Configure graceful-restart and timers
- 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 = "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
- 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
- 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
- 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:
- # Verifying BGP RIB routes
- 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
- 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
- )
-
- result = verify_bgp_convergence_from_running_config(tgen, topo)
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- write_test_footer(tc_name)
-
-
-def test_BGP_GR_18_p1(request):
- """
- Test Objective : Verify that GR helper router deletes stale routes
- received from restarting node, if GR capability is not present in
- restarting node's OPEN message.
- """
-
- 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] initialized"
- )
-
- # Configure graceful-restart and timers
- 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] initialized"
- )
-
- # Configure graceful-restart and timers
- 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 = "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 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"])
-
- logger.info("[Step 3] : Configure R1 to prevent sending EOR")
-
- # Modify graceful-restart config to prevent sending EOR
- input_dict_3 = {"r1": {"bgp": {"graceful-restart": {"disable-eor": True}}}}
-
- result = modify_bgp_config_when_bgpd_down(tgen, topo, input_dict_3)
-
- # Modify configuration to delete routes
- network = {"ipv4": "101.0.20.1/32", "ipv6": "1::1/128"}
- for addr_type in ADDR_TYPES:
- input_dict_3 = {
- "r1": {
- "bgp": {
- "address_family": {
- addr_type: {
- "unicast": {
- "advertise_networks": [
- {
- "network": network[addr_type],
- "no_of_network": 5,
- "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
- )
-
- # Modify graceful-restart config
- input_dict_3 = {
- "r1": {
- "bgp": {
- "address_family": {
- "ipv4": {
- "unicast": {
- "neighbor": {
- "r2": {
- "dest_link": {
- "r1": {"graceful-restart-disable": True}
- }
- },
- "r6": {
- "dest_link": {
- "r1": {"graceful-restart-disable": True}
- }
- },
- }
- }
- },
- "ipv6": {
- "unicast": {
- "neighbor": {
- "r2": {
- "dest_link": {
- "r1": {"graceful-restart-disable": True}
- }
- },
- "r6": {
- "dest_link": {
- "r1": {"graceful-restart-disable": 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("[Step 4] : Bring up the BGPd daemon on R1 for 30" " seconds..")
-
- # Start BGPd daemon on R1
- start_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, expected=False)
- assert result is not True, (
- "Testcase {} : Failed \n "
- "r6: routes are still present in BGP RIB\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 "
- "r6: routes are still present in ZEBRA\n Error: {}".format(tc_name, result)
- )
- logger.info(" Expected behavior: {}".format(result))
-
- # Verifying BGP RIB routes
- dut = "r2"
- result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1, expected=False)
- assert result is not True, (
- "Testcase {} : Failed \n "
- "r2: routes are still present in BGP RIB\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 "
- "r6: routes are still present in ZEBRA\n Error: {}".format(tc_name, result)
- )
- logger.info(" Expected behavior: {}".format(result))
-
- write_test_footer(tc_name)
-
-
-def test_BGP_GR_26_p2(request):
- """
- Test Objective : Test GR scenarios on helper router 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)
-
- logger.info(
- "[Step 1] : Test Setup " "[Helper Mode]R3-----R1[Restart Mode] initialized"
- )
-
- # Configure graceful-restart
- input_dict = {
- "r1": {
- "bgp": {
- "address_family": {
- "ipv4": {
- "unicast": {
- "neighbor": {
- "r3": {
- "dest_link": {
- "r1": {
- "graceful-restart": True,
- "next_hop_self": True,
- "activate": "ipv6",
- }
- }
- }
- }
- }
- },
- "ipv6": {
- "unicast": {
- "neighbor": {
- "r3": {
- "dest_link": {
- "r1": {
- "graceful-restart": True,
- "next_hop_self": True,
- "activate": "ipv4",
- }
- }
- }
- }
- }
- },
- }
- }
- },
- "r3": {
- "bgp": {
- "address_family": {
- "ipv4": {
- "unicast": {
- "neighbor": {
- "r1": {
- "dest_link": {
- "r3": {
- "graceful-restart-helper": True,
- "activate": "ipv6",
- }
- }
- }
- }
- }
- },
- "ipv6": {
- "unicast": {
- "neighbor": {
- "r1": {
- "dest_link": {
- "r3": {
- "graceful-restart-helper": True,
- "activate": "ipv4",
- }
- }
- }
- }
- }
- },
- }
- }
- },
- }
-
- 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="r3", peer="r1"
- )
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- # Verifying BGP RIB routes
- dut = "r3"
- input_topo = {key: topo["routers"][key] for key in ["r1"]}
- 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 before shutting down BGPd daemon
- result = verify_rib(tgen, addr_type, dut, input_topo)
- 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
- input_topo = {key: topo["routers"][key] for key in ["r1"]}
- 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 before shutting down BGPd daemon
- result = verify_rib(tgen, addr_type, dut, input_topo)
- 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:
- # Verifying BGP RIB routes
- input_topo = {key: topo["routers"][key] for key in ["r1"]}
- 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 before shutting down BGPd daemon
- result = verify_rib(tgen, addr_type, dut, input_topo)
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- # verify multi address family
- result = verify_gr_address_family(
- tgen,
- topo,
- addr_type,
- "ipv4Unicast",
- dut="r1",
- peer="r3",
- )
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- # verify multi address family
- result = verify_gr_address_family(
- tgen,
- topo,
- addr_type,
- "ipv6Unicast",
- dut="r1",
- peer="r3",
- )
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- # verify multi address family
- result = verify_gr_address_family(
- tgen,
- topo,
- addr_type,
- "ipv4Unicast",
- dut="r3",
- peer="r1",
- )
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- # verify multi address family
- result = verify_gr_address_family(
- tgen,
- topo,
- addr_type,
- "ipv6Unicast",
- dut="r3",
- peer="r1",
- )
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- write_test_footer(tc_name)
-
-
-def test_BGP_GR_chaos_28_p1(request):
- """
- Test Objective : Verify if helper node goes down before restarting
- node comes up online, helper node sets the R-bit to avoid dead-lock
- till SDT expiry.
- """
-
- 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(
- "Test Case: test_BGP_GR_chaos_28 :"
- "[Helper Mode]R3-----R1[Restart Mode] initialized"
- )
-
- # Configure graceful-restart
- input_dict = {
- "r1": {
- "bgp": {
- "address_family": {
- "ipv4": {
- "unicast": {
- "neighbor": {
- "r3": {"dest_link": {"r1": {"graceful-restart": True}}}
- }
- }
- },
- "ipv6": {
- "unicast": {
- "neighbor": {
- "r3": {"dest_link": {"r1": {"graceful-restart": 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 1] : Kill BGPd daemon on R1..")
-
- # Kill BGPd daemon on R1
- kill_router_daemons(tgen, "r1", ["bgpd"])
-
- logger.info("[Step 2] : Kill BGPd daemon on R3..")
-
- # Kill BGPd daemon on R3
- kill_router_daemons(tgen, "r3", ["bgpd"])
-
- logger.info("[Step 3] : Start BGPd daemon on R1..")
-
- # Start BGPd daemon on R1
- start_router_daemons(tgen, "r1", ["bgpd"])
-
- logger.info("[Step 4] : Start BGPd daemon on R3..")
-
- # Start BGPd daemon on R3
- start_router_daemons(tgen, "r3", ["bgpd"])
-
- # Verify r_bit
- for addr_type in ADDR_TYPES:
- result = verify_r_bit(tgen, topo, addr_type, input_dict, dut="r3", peer="r1")
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- write_test_footer(tc_name)
-
-
-def test_BGP_GR_chaos_29_p1(request):
- """
- Test Objective : Change timers on the fly, and
- verify if it takes immediate effect.
- """
-
- 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(
- " Test Case : test_BGP_GR_chaos_29"
- " BGP GR [Helper Mode]R3-----R1[Restart Mode]"
- " and [restart-time 150]R1 initialized"
- )
-
- # Configure graceful-restart and timers
- input_dict = {
- "r1": {
- "bgp": {
- "graceful-restart": {"timer": {"restart-time": GR_RESTART_TIMER}},
- "address_family": {
- "ipv4": {
- "unicast": {
- "neighbor": {
- "r3": {"dest_link": {"r1": {"graceful-restart": True}}}
- }
- }
- },
- "ipv6": {
- "unicast": {
- "neighbor": {
- "r3": {"dest_link": {"r1": {"graceful-restart": 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
- )
-
- # Verify graceful-restart timers
- input_dict_2 = {
- "r1": {
- "bgp": {
- "graceful-restart": {"timer": {"restart-time": GR_RESTART_TIMER + 5}}
- }
- }
- }
-
- result = create_router_bgp(tgen, topo, input_dict_2)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
-
- for addr_type in ADDR_TYPES:
- input_dict_2 = {
- "r1": {
- "bgp": {
- "graceful-restart": {"timer": {"restart-time": GR_RESTART_TIMER}}
- }
- }
- }
-
- result = verify_graceful_restart_timers(
- tgen, topo, addr_type, input_dict_2, dut="r3", peer="r1"
- )
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- for addr_type in ADDR_TYPES:
- # Verifying BGP RIB routes before shutting down BGPd daemon
- dut = "r3"
- input_dict = {key: topo["routers"][key] for key in ["r1"]}
- result = verify_bgp_rib(tgen, addr_type, dut, input_dict)
- 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)
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- logger.info("[Step 2] : Kill BGPd daemon on R1..")
-
- # Kill BGPd daemon on R1
- kill_router_daemons(tgen, "r1", ["bgpd"])
-
- logger.info("[Step 3] : Wait for {} seconds..".format(GR_RESTART_TIMER))
-
- # Waiting for GR_RESTART_TIMER
- sleep(GR_RESTART_TIMER)
-
- for addr_type in ADDR_TYPES:
- # Verifying BGP RIB routes before shutting down BGPd daemon
- input_dict = {key: topo["routers"][key] for key in ["r1"]}
- result = verify_bgp_rib(tgen, addr_type, dut, input_dict, expected=False)
- assert result is not True, (
- "Testcase {} : Failed \n "
- "r3: routes are still present in BGP RIB\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, expected=False)
- assert result is not True, (
- "Testcase {} : Failed \n "
- "r3: routes are still present in ZEBRA\n Error: {}".format(tc_name, result)
- )
- logger.info(" Expected behavior: {}".format(result))
-
- logger.info("[Step 4] : Start BGPd daemon on R1..")
-
- # Start BGPd daemon on R1
- start_router_daemons(tgen, "r1", ["bgpd"])
-
- write_test_footer(tc_name)
-
-
-def test_BGP_GR_chaos_33_p1(request):
- """
- Test Objective : Helper router receives same prefixes from two
- different routers (GR-restarting and GR-disabled). Keeps the
- stale entry only for GR-restarting node(next-hop is correct).
- """
-
- 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(
- " Test Case : test_BGP_GR_chaos_33 "
- "BGP GR "
- "[Restart Mode]R1--R3[Helper Mode]--R4[Disabled Mode]"
- )
-
- # Configure graceful-restart
- input_dict = {
- "r1": {
- "bgp": {
- "address_family": {
- "ipv4": {
- "unicast": {
- "neighbor": {
- "r3": {"dest_link": {"r1": {"graceful-restart": True}}}
- }
- }
- },
- "ipv6": {
- "unicast": {
- "neighbor": {
- "r3": {"dest_link": {"r1": {"graceful-restart": 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}
- }
- }
- }
- }
- },
- }
- }
- },
- "r4": {
- "bgp": {
- "address_family": {
- "ipv4": {
- "unicast": {
- "neighbor": {
- "r3": {
- "dest_link": {
- "r4": {"graceful-restart-disable": True}
- }
- }
- }
- }
- },
- "ipv6": {
- "unicast": {
- "neighbor": {
- "r3": {
- "dest_link": {
- "r4": {"graceful-restart-disable": 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] : Advertise same networks from R1 and R4..")
-
- # Api call to delete advertised networks
- input_dict_2 = {
- "r1": {
- "bgp": {
- "address_family": {
- "ipv4": {
- "unicast": {
- "advertise_networks": [
- {
- "network": "200.0.20.1/32",
- "no_of_network": 2,
- }
- ]
- }
- },
- "ipv6": {
- "unicast": {
- "advertise_networks": [
- {"network": "2001::1/128", "no_of_network": 2}
- ]
- }
- },
- }
- }
- },
- "r4": {
- "bgp": {
- "address_family": {
- "ipv4": {
- "unicast": {
- "advertise_networks": [
- {"network": "200.0.20.1/32", "no_of_network": 2}
- ]
- }
- },
- "ipv6": {
- "unicast": {
- "advertise_networks": [
- {"network": "2001::1/128", "no_of_network": 2}
- ]
- }
- },
- }
- }
- },
- }
-
- result = create_router_bgp(tgen, topo, input_dict_2)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
-
- for addr_type in ADDR_TYPES:
- # Verifying RIB routes
- dut = "r3"
- peer1 = "r1"
- peer2 = "r4"
- intf1 = topo["routers"][peer1]["links"][dut]["interface"]
- intf2 = topo["routers"][peer2]["links"][dut]["interface"]
-
- if addr_type == "ipv4":
- next_hop_4 = NEXT_HOP_4
- result = verify_rib(tgen, addr_type, dut, input_dict_2, next_hop_4)
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- if addr_type == "ipv6":
- if "link_local" in PREFERRED_NEXT_HOP:
- next_hop1 = get_frr_ipv6_linklocal(tgen, peer1, intf=intf1)
- next_hop2 = get_frr_ipv6_linklocal(tgen, peer2, intf=intf2)
-
- next_hop_6 = [next_hop1, next_hop2]
- else:
- next_hop_6 = NEXT_HOP_6
-
- result = verify_rib(tgen, addr_type, dut, input_dict_2, next_hop_6)
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- logger.info("[Step 3] : Kill BGPd daemon on R1 and R4..")
-
- # Kill BGPd daemon on R1
- kill_router_daemons(tgen, "r1", ["bgpd"])
-
- # Kill BGPd daemon on R4
- kill_router_daemons(tgen, "r4", ["bgpd"])
-
- for addr_type in ADDR_TYPES:
- # Verifying RIB routes
- next_hop_6 = ["fd00:0:0:1::1"]
- if addr_type == "ipv4":
- next_hop_4 = NEXT_HOP_4[0]
-
- result = verify_rib(tgen, addr_type, dut, input_dict_2, next_hop_4)
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- if addr_type == "ipv6":
- if "link_local" in PREFERRED_NEXT_HOP:
- next_hop_6 = get_frr_ipv6_linklocal(tgen, peer1, intf=intf1)
- else:
- next_hop_6 = NEXT_HOP_6[0]
-
- result = verify_rib(tgen, addr_type, dut, input_dict_2, next_hop_6)
-
- # Verifying RIB routes
- if addr_type == "ipv4":
- next_hop_4 = NEXT_HOP_4[1]
- result = verify_rib(
- tgen, addr_type, dut, input_dict_2, next_hop_4, expected=False
- )
- assert result is not True, (
- "Testcase {} : Failed \n "
- "r3: routes are still present in BGP RIB\n Error: {}".format(
- tc_name, result
- )
- )
- logger.info(" Expected behavior: {}".format(result))
-
- if addr_type == "ipv6":
- if "link_local" in PREFERRED_NEXT_HOP:
- next_hop_6 = get_frr_ipv6_linklocal(tgen, peer2, intf=intf2)
- else:
- next_hop_6 = NEXT_HOP_6[1]
-
- result = verify_rib(
- tgen, addr_type, dut, input_dict_2, next_hop_6, expected=False
- )
- assert result is not True, (
- "Testcase {} : Failed \n "
- "r3: routes are still present in ZEBRA\n Error: {}".format(
- tc_name, result
- )
- )
- logger.info(" Expected behavior: {}".format(result))
-
- logger.info("[Step 4] : Start BGPd daemon on R1 and R4..")
-
- # Start BGPd daemon on R1
- start_router_daemons(tgen, "r1", ["bgpd"])
-
- # Start BGPd daemon on R4
- start_router_daemons(tgen, "r4", ["bgpd"])
-
- write_test_footer(tc_name)
-
-
-def test_BGP_GR_chaos_34_2_p1(request):
- """
- Test Objective : Restarting node doesn't preserve the forwarding
- state verify the behaviour on helper node, if it still keeps the
- stale routes.
- """
-
- 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(
- " Test Case : test_BGP_GR_chaos_34 "
- "BGP GR "
- "[Restart Mode]R1---R3[Helper Mode]"
- )
-
- logger.info("[Step 1] : Configure restarting" " router R1 to prevent ")
- logger.info("[Step 2] : Reset the session" " between R1 and R3..")
-
- # Configure graceful-restart
- input_dict = {
- "r1": {
- "bgp": {
- "graceful-restart": {"preserve-fw-state": True, "disable-eor": True},
- "address_family": {
- "ipv4": {
- "unicast": {
- "neighbor": {
- "r3": {"dest_link": {"r1": {"graceful-restart": True}}}
- }
- }
- },
- "ipv6": {
- "unicast": {
- "neighbor": {
- "r3": {"dest_link": {"r1": {"graceful-restart": 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
- )
-
- # Verify f-bit before killing BGPd daemon
- result = verify_f_bit(tgen, topo, addr_type, input_dict, "r3", "r1")
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- # Verifying BGP RIB routes after starting BGPd daemon
- 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
- result = verify_rib(tgen, addr_type, dut, input_dict_1)
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- logger.info("[Step 3] : Kill BGPd daemon on R1..")
-
- # Kill BGPd daemon on R1
- kill_router_daemons(tgen, "r1", ["bgpd"])
-
- logger.info("[Step 4] : Withdraw/delete the prefixes " "originated from R1..")
-
- # Api call to delete advertised networks
- network = {"ipv4": "101.0.20.1/32", "ipv6": "1::1/128"}
- for addr_type in ADDR_TYPES:
- input_dict_2 = {
- "r1": {
- "bgp": {
- "address_family": {
- addr_type: {
- "unicast": {
- "advertise_networks": [
- {
- "network": network[addr_type],
- "no_of_network": 5,
- "delete": True,
- }
- ]
- }
- }
- }
- }
- }
- }
-
- result = modify_bgp_config_when_bgpd_down(tgen, topo, input_dict_2)
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- logger.info("[Step 5] : Remove the CLI from R1's config to " "set the F-bit..")
-
- # Modify graceful-restart config not to set f-bit
- # and write to /etc/frr
- input_dict_2 = {"r1": {"bgp": {"graceful-restart": {"preserve-fw-state": False}}}}
-
- result = modify_bgp_config_when_bgpd_down(tgen, topo, input_dict_2)
- assert result is True, "Testcase {} : Failed \n Error {}".format(tc_name, result)
-
- logger.info("[Step 6] : Bring up the BGPd daemon on R1 again..")
-
- # Start BGPd daemon on R1
- start_router_daemons(tgen, "r1", ["bgpd"])
-
- for addr_type in ADDR_TYPES:
- # Verify f-bit after starting BGPd daemon
- result = verify_f_bit(
- tgen, topo, addr_type, input_dict, "r3", "r1", expected=False
- )
- assert (
- result is not True
- ), "Testcase {} : Failed \n " "r3: F-bit is set to True\n Error: {}".format(
- tc_name, result
- )
- logger.info(" Expected behavior: {}".format(result))
-
- # Verifying BGP RIB routes after starting BGPd daemon
- 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 "
- "r3: routes are still present in BGP RIB\n Error: {}".format(
- tc_name, result
- )
- )
- logger.info(" Expected behavior: {}".format(result))
-
- # Verifying RIB routes
- result = verify_rib(tgen, addr_type, dut, input_dict_1, expected=False)
- assert result is not True, (
- "Testcase {} : Failed \n "
- "r3: routes are still present in ZEBRA\n Error: {}".format(tc_name, result)
- )
- logger.info(" Expected behavior: {}".format(result))
-
- write_test_footer(tc_name)
-
-
-def test_BGP_GR_chaos_34_1_p1(request):
- """
- Test Objective : Restarting node doesn't preserve forwarding
- state, helper router should not keep the stale entries.
- """
-
- 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(
- " Test Case : test_BGP_GR_chaos_31 "
- "BGP GR "
- "[Restart Mode]R1---R3[Helper Mode]"
- )
-
- # Configure graceful-restart
- input_dict = {
- "r1": {
- "bgp": {
- "graceful-restart": {
- "preserve-fw-state": True,
- "timer": {"restart-time": GR_RESTART_TIMER},
- },
- "address_family": {
- "ipv4": {
- "unicast": {
- "neighbor": {
- "r3": {"dest_link": {"r1": {"graceful-restart": True}}}
- }
- }
- },
- "ipv6": {
- "unicast": {
- "neighbor": {
- "r3": {"dest_link": {"r1": {"graceful-restart": 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 after starting BGPd daemon
- 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
- result = verify_rib(tgen, addr_type, dut, input_dict_1)
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- logger.info(
- "[Step 1] : Remove the preserve-fw-state command"
- " from restarting node R1's config"
- )
-
- # Configure graceful-restart to set f-bit as False
- input_dict_2 = {"r1": {"bgp": {"graceful-restart": {"preserve-fw-state": False}}}}
-
- result = create_router_bgp(tgen, topo, input_dict_2)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
-
- logger.info("[Step 2] : Reset the session between R1 and R3..")
-
- # Reset sessions
- 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(
- tgen, topo, addr_type, input_dict_2, "r3", "r1", expected=False
- )
- assert (
- result is not True
- ), "Testcase {} : Failed \n " "r3: F-bit is set to True\n Error: {}".format(
- tc_name, result
- )
- logger.info(" Expected behavior: {}".format(result))
-
- logger.info("[Step 3] : Kill BGPd daemon on R1..")
-
- # Kill BGPd daemon on R1
- kill_router_daemons(tgen, "r1", ["bgpd"])
-
- # Waiting for GR_RESTART_TIMER
- logger.info("Waiting for {} sec..".format(GR_RESTART_TIMER))
- sleep(GR_RESTART_TIMER)
-
- for addr_type in ADDR_TYPES:
- # Verifying BGP RIB routes
- input_dict = {key: topo["routers"][key] for key in ["r1"]}
- result = verify_bgp_rib(tgen, addr_type, dut, input_dict, expected=False)
- assert result is not True, (
- "Testcase {} : Failed \n "
- "r3: routes are still present in BGP RIB\n Error: {}".format(
- tc_name, result
- )
- )
- logger.info(" Expected behavior: {}".format(result))
-
- # Verifying RIB routes
- result = verify_rib(tgen, addr_type, dut, input_dict, expected=False)
- assert result is not True, (
- "Testcase {} : Failed \n "
- "r3: routes are still present in ZEBRA\n Error: {}".format(tc_name, result)
- )
- logger.info(" Expected behavior: {}".format(result))
-
- # Start BGPd daemon on R1
- start_router_daemons(tgen, "r1", ["bgpd"])
-
- write_test_footer(tc_name)
-
-
-def test_BGP_GR_chaos_32_p1(request):
- """
- Test Objective : Restarting node is connected to multiple helper
- nodes, one of them doesn't send EOR to restarting router. Verify
- that only after SDT restarting node send EOR to all helper peers
- excluding the prefixes originated by faulty 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(
- " Test Case : test_BGP_GR_chaos_32 "
- "BGP GR "
- "[Restart Mode]R1---R3&R5[Helper Mode]"
- )
-
- logger.info(
- "[Step 1] : Change the mode on R1 be a restarting" " node on global level"
- )
-
- # Configure graceful-restart
- input_dict = {
- "r1": {
- "bgp": {
- "graceful-restart": {"graceful-restart": True},
- "address_family": {
- "ipv4": {
- "unicast": {
- "neighbor": {
- "r3": {"dest_link": {"r1": {"next_hop_self": True}}},
- "r5": {"dest_link": {"r1": {"graceful-restart": True}}},
- }
- }
- },
- "ipv6": {
- "unicast": {
- "neighbor": {
- "r3": {"dest_link": {"r1": {"next_hop_self": True}}},
- "r5": {"dest_link": {"r1": {"graceful-restart": True}}},
- }
- }
- },
- },
- }
- },
- "r5": {
- "bgp": {
- "address_family": {
- "ipv4": {
- "unicast": {
- "neighbor": {
- "r1": {
- "dest_link": {
- "r5": {"graceful-restart-helper": True}
- }
- }
- }
- }
- },
- "ipv6": {
- "unicast": {
- "neighbor": {
- "r1": {
- "dest_link": {
- "r5": {"graceful-restart-helper": True}
- }
- }
- }
- }
- },
- }
- }
- },
- }
-
- configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name, dut="r1", peer="r5")
-
- for addr_type in ADDR_TYPES:
- result = verify_graceful_restart(
- tgen, topo, addr_type, input_dict, dut="r1", peer="r5"
- )
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- # Verifying BGP RIB routes after starting BGPd daemon
- dut = "r3"
- input_dict_1 = {key: topo["routers"][key] for key in ["r5"]}
- 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("[Step 2] : Kill BGPd daemon on R1..")
- # Kill BGPd daemon on R1
- kill_router_daemons(tgen, "r1", ["bgpd"])
-
- logger.info("[Step 3] : Withdraw all the advertised prefixes from R5")
-
- # Api call to delete advertised networks
- network = {"ipv4": "105.0.20.1/32", "ipv6": "5::1/128"}
- for addr_type in ADDR_TYPES:
- input_dict_2 = {
- "r5": {
- "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(
- "[Step 4] : Stop the helper router R5 from sending EOR" " message using CLI"
- )
-
- # Modify graceful-restart config to prevent sending EOR
- input_dict_3 = {"r5": {"bgp": {"graceful-restart": {"disable-eor": True}}}}
-
- result = create_router_bgp(tgen, topo, input_dict_3)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
-
- logger.info("[Step 5] : Bring up the BGPd daemon on R1..")
-
- # Start BGPd daemon on R1
- start_router_daemons(tgen, "r1", ["bgpd"])
-
- for addr_type in ADDR_TYPES:
- # Verify EOR is disabled
- result = verify_eor(
- tgen, topo, addr_type, input_dict_3, dut="r5", peer="r1", expected=False
- )
- assert (
- result is not True
- ), "Testcase {} : Failed \n " "r5: EOR is set to TRUE\n Error: {}".format(
- tc_name, result
- )
- logger.info(" Expected behavior: {}".format(result))
-
- # Verifying BGP RIB routes after starting BGPd daemon
- input_dict_1 = {key: topo["routers"][key] for key in ["r5"]}
- result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1, expected=False)
- assert result is not True, (
- "Testcase {} : Failed \n "
- "r3: routes are still present in BGP RIB\n Error: {}".format(
- tc_name, result
- )
- )
- logger.info(" Expected behavior: {}".format(result))
-
- # Verifying RIB routes
- result = verify_rib(tgen, addr_type, dut, input_dict_1, expected=False)
- assert result is not True, (
- "Testcase {} : Failed \n "
- "r3: routes are still present in ZEBRA\n Error: {}".format(tc_name, result)
- )
- logger.info(" Expected behavior: {}".format(result))
-
- write_test_footer(tc_name)
-
-
-def test_BGP_GR_chaos_37_p1(request):
- """
- Test Objective : Verify if helper node restarts before sending the
- EOR message, restarting node doesn't wait until stale path timer
- expiry to do the best path selection and sends an EOR
- """
-
- 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(
- " Test Case : test_BGP_GR_chaos_37 "
- "BGP GR "
- "[Restart Mode]R1---R3[Helper Mode]"
- )
-
- logger.info(
- "[Step 1] : Configure restarting router R3 to prevent " "sending an EOR.."
- )
-
- logger.info("[Step 2] : Reset the session between R3 and R1..")
-
- # Configure graceful-restart
- input_dict = {
- "r1": {
- "bgp": {
- "address_family": {
- "ipv4": {
- "unicast": {
- "neighbor": {
- "r3": {"dest_link": {"r1": {"graceful-restart": True}}}
- }
- }
- },
- "ipv6": {
- "unicast": {
- "neighbor": {
- "r3": {"dest_link": {"r1": {"graceful-restart": True}}}
- }
- }
- },
- }
- }
- },
- "r3": {
- "bgp": {
- "graceful-restart": {"disable-eor": True},
- "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
- )
-
- # Verify EOR is disabled
- result = verify_eor(
- tgen, topo, addr_type, input_dict, dut="r3", peer="r1", expected=False
- )
- assert (
- result is not True
- ), "Testcase {} : Failed \n " "r3: EOR is set to True\n Error: {}".format(
- tc_name, result
- )
- logger.info(" Expected behavior: {}".format(result))
-
- # Verifying BGP RIB routes after starting BGPd daemon
- 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("[Step 3] : Kill BGPd daemon on R1..")
-
- # Kill BGPd daemon on R1
- kill_router_daemons(tgen, "r1", ["bgpd"])
-
- logger.info("[Step 4] : Start BGPd daemon on R1..")
-
- # Start BGPd daemon on R1
- start_router_daemons(tgen, "r1", ["bgpd"])
-
- logger.info("[Step 5] : Kill BGPd daemon on R3..")
-
- # Kill BGPd daemon on R3
- kill_router_daemons(tgen, "r3", ["bgpd"])
-
- # Modify graceful-restart config to prevent sending EOR
- input_dict_2 = {"r3": {"bgp": {"graceful-restart": {"disable-eor": True}}}}
-
- result = modify_bgp_config_when_bgpd_down(tgen, topo, input_dict_2)
- assert result is True, "Testcase {} : Failed \n Error {}".format(tc_name, result)
-
- logger.info("[Step 6] : Start BGPd daemon on R3..")
-
- # Start BGPd daemon on R3
- start_router_daemons(tgen, "r3", ["bgpd"])
-
- for addr_type in ADDR_TYPES:
- # Verify r_bit
- result = verify_r_bit(tgen, topo, addr_type, input_dict, dut="r1", peer="r3")
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- # Verifying RIB routes
- input_dict_1 = {key: topo["routers"][key] for key in ["r3"]}
- result = verify_rib(tgen, addr_type, dut, input_dict_1)
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- # Verify EOR is send from R1 to R3
- input_dict_3 = {"r1": {"bgp": {"graceful-restart": {"disable-eor": True}}}}
-
- result = verify_eor(
- tgen, topo, addr_type, input_dict_3, dut="r1", peer="r3", expected=False
- )
- assert (
- result is not True
- ), "Testcase {} : Failed \n " "r1: EOR is set to True\n Error: {}".format(
- tc_name, result
- )
-
- write_test_footer(tc_name)
-
-
-def test_BGP_GR_chaos_30_p1(request):
- """
- Test Objective : Restarting node removes stale routes from Zebra
- after receiving an EOR from helper 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(
- " Test Case : test_BGP_GR_chaos_30 "
- "BGP GR [Helper Mode]R3-----R1[Restart Mode] "
- )
-
- # Configure graceful-restart and timers
- input_dict = {
- "r1": {
- "bgp": {
- "graceful-restart": {"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}}}
- }
- }
- },
- },
- }
- },
- "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
- )
-
- for addr_type in ADDR_TYPES:
- # Verifying BGP RIB routes before shutting down BGPd daemon
- dut = "r1"
- input_dict = {key: topo["routers"][key] for key in ["r3"]}
- result = verify_bgp_rib(tgen, addr_type, dut, input_dict)
- 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)
- assert result is True, "Testcase {} : Failed \n Error {}".format(
- tc_name, result
- )
-
- logger.info("[Step 2] : Kill BGPd daemon on R1..")
-
- # Kill BGPd daemon on R1
- kill_router_daemons(tgen, "r1", ["bgpd"])
-
- logger.info("[Step 3] : Withdraw advertised prefixes from R3...")
-
- # Api call to delete advertised networks
- network = {"ipv4": "103.0.20.1/32", "ipv6": "3::1/128"}
- for addr_type in ADDR_TYPES:
- input_dict = {
- "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)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(
- tc_name, result
- )
-
- logger.info("[Step 4] : Start BGPd daemon on R1..")
-
- # Start BGPd daemon on R1
- start_router_daemons(tgen, "r1", ["bgpd"])
-
- for addr_type in ADDR_TYPES:
- # Verifying BGP RIB routes before shutting down BGPd daemon
- input_dict = {key: topo["routers"][key] for key in ["r3"]}
- result = verify_bgp_rib(tgen, addr_type, dut, input_dict, expected=False)
- assert result is not True, (
- "Testcase {} : Failed \n "
- "r1: routes are still present in BGP RIB\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, expected=False)
- assert result is not True, (
- "Testcase {} : Failed \n "
- "r1: routes are still present in ZEBRA\n Error: {}".format(tc_name, result)
- )
- logger.info(" Expected behavior: {}".format(result))
-
- 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 "
- "r1: routes are still present in ZEBRA\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 {} : Failed \n " "r1: EOR is set to True\n Error: {}".format(
- tc_name, 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 "
- "r3: routes are still present in BGP RIB\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 "
- "r3: routes are still present in ZEBRA\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_gr_functionality_topo3/bgp_gr_functionality_topo3.json b/tests/topotests/bgp_gr_functionality_topo3/bgp_gr_functionality_topo3.json
new file mode 100644
index 0000000000..84ddc6119a
--- /dev/null
+++ b/tests/topotests/bgp_gr_functionality_topo3/bgp_gr_functionality_topo3.json
@@ -0,0 +1,222 @@
+{
+ "address_types": [
+ "ipv4",
+ "ipv6"
+ ],
+ "ipv4base": "192.168.0.0",
+ "ipv4mask": 24,
+ "ipv6base": "fd00::",
+ "ipv6mask": 64,
+ "link_ip_start": {
+ "ipv4": "192.168.0.0",
+ "v4mask": 24,
+ "ipv6": "fd00::",
+ "v6mask": 64
+ },
+ "lo_prefix": {
+ "ipv4": "1.0.",
+ "v4mask": 32,
+ "ipv6": "2001:DB8:F::",
+ "v6mask": 128
+ },
+ "routers": {
+ "r1": {
+ "links": {
+ "r2-link1": {
+ "ipv4": "auto",
+ "ipv6": "auto",
+ "vrf": "RED"
+ }
+ },
+ "vrfs": [
+ {
+ "name": "RED",
+ "id": "1"
+ }
+ ],
+ "bgp": [
+ {
+ "local_as": "100",
+ "vrf": "RED",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r2": {
+ "dest_link": {
+ "r1-link1": {}
+ }
+ }
+ },
+ "redistribute": [
+ {
+ "redist_type": "static"
+ }
+ ]
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r2": {
+ "dest_link": {
+ "r1-link1": {}
+ }
+ }
+ },
+ "redistribute": [
+ {
+ "redist_type": "static"
+ }
+ ]
+ }
+ }
+ }
+ }
+ ]
+ },
+ "r2": {
+ "links": {
+ "r1-link1": {
+ "ipv4": "auto",
+ "ipv6": "auto",
+ "vrf": "RED"
+ },
+ "r3-link1": {
+ "ipv4": "auto",
+ "ipv6": "auto"
+ }
+ },
+ "vrfs": [
+ {
+ "name": "RED",
+ "id": "1"
+ }
+ ],
+ "bgp": [
+ {
+ "local_as": "200",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r2-link1": {}
+ }
+ }
+ },
+ "redistribute": [
+ {
+ "redist_type": "static"
+ }
+ ]
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r2-link1": {}
+ }
+ }
+ },
+ "redistribute": [
+ {
+ "redist_type": "static"
+ }
+ ]
+ }
+ }
+ }
+ },
+ {
+ "local_as": "200",
+ "vrf": "RED",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r2-link1": {}
+ }
+ }
+ },
+ "redistribute": [
+ {
+ "redist_type": "static"
+ }
+ ]
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r2-link1": {}
+ }
+ }
+ },
+ "redistribute": [
+ {
+ "redist_type": "static"
+ }
+ ]
+ }
+ }
+ }
+ }
+ ]
+ },
+ "r3": {
+ "links": {
+ "r2-link1": {
+ "ipv4": "auto",
+ "ipv6": "auto"
+ }
+ },
+ "bgp": [
+ {
+ "local_as": "300",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r2": {
+ "dest_link": {
+ "r3-link1": {}
+ }
+ }
+ },
+ "redistribute": [
+ {
+ "redist_type": "static"
+ }
+ ]
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r2": {
+ "dest_link": {
+ "r3-link1": {}
+ }
+ }
+ },
+ "redistribute": [
+ {
+ "redist_type": "static"
+ }
+ ]
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/topotests/bgp_gr_functionality_topo3/bgp_gr_functionality_topo3.py b/tests/topotests/bgp_gr_functionality_topo3/bgp_gr_functionality_topo3.py
new file mode 100644
index 0000000000..c19ee06bab
--- /dev/null
+++ b/tests/topotests/bgp_gr_functionality_topo3/bgp_gr_functionality_topo3.py
@@ -0,0 +1,554 @@
+#!/usr/bin/env python
+#
+# Copyright (c) 2019 by VMware, Inc. ("VMware")
+# Used Copyright (c) 2018 by Network Device Education Foundation, Inc. ("NetDEF")
+# in this file.
+#
+# Permission to use, copy, modify, and/or distribute this software
+# for any purpose with or without fee is hereby granted, provided
+# that the above copyright notice and this permission notice appear
+# in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND VMWARE DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VMWARE BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+#
+
+import os
+import sys
+import time
+import pytest
+from time import sleep
+
+import traceback
+import ipaddress
+
+# Save the Current Working Directory to find configuration files.
+CWD = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join("../"))
+sys.path.append(os.path.join("../lib/"))
+
+# pylint: disable=C0413
+# Import topogen and topotest helpers
+from lib.topogen import Topogen, get_topogen
+from lib.topolog import logger
+
+# Required to instantiate the topology builder class.
+
+# Import topoJson from lib, to create topology and initial configuration
+from lib.topojson import build_config_from_json
+from lib.bgp import (
+ clear_bgp,
+ verify_bgp_rib,
+ verify_graceful_restart,
+ create_router_bgp,
+ verify_r_bit,
+ verify_eor,
+ verify_f_bit,
+ verify_bgp_convergence,
+ verify_gr_address_family,
+ modify_bgp_config_when_bgpd_down,
+ verify_graceful_restart_timers,
+ verify_bgp_convergence_from_running_config,
+)
+# Import common_config to use commomnly used APIs
+from lib.common_config import (create_common_configuration,
+ InvalidCLIError, retry,
+ generate_ips, FRRCFG_FILE,
+ find_interface_with_greater_ip,
+ check_address_types,
+ validate_ip_address,
+ run_frr_cmd,
+ get_frr_ipv6_linklocal)
+
+from lib.common_config import (
+ write_test_header,
+ reset_config_on_routers,
+ start_topology,
+ kill_router_daemons,
+ start_router_daemons,
+ verify_rib,
+ check_address_types,
+ write_test_footer,
+ check_router_status,
+ step,
+ get_frr_ipv6_linklocal,
+ create_static_routes,
+ required_linux_kernel_version,
+)
+
+pytestmark = [pytest.mark.bgpd]
+
+
+# Global variables
+BGP_CONVERGENCE = False
+GR_RESTART_TIMER = 5
+GR_SELECT_DEFER_TIMER = 5
+GR_STALEPATH_TIMER = 5
+# Global variables
+# STATIC_ROUTES=[]
+NETWORK1_1 = {"ipv4": "192.0.2.1/32", "ipv6": "2001:DB8::1:1/128"}
+NETWORK1_2 = {"ipv4": "192.0.2.2/32", "ipv6": "2001:DB8::2:1/128"}
+NETWORK2_1 = {"ipv4": "192.0.2.3/32", "ipv6": "2001:DB8::3:1/128"}
+NETWORK2_2 = {"ipv4": "192.0.2.4/32", "ipv6": "2001:DB8::4:1/128"}
+NETWORK3_1 = {"ipv4": "192.0.2.5/32", "ipv6": "2001:DB8::5:1/128"}
+NETWORK3_2 = {"ipv4": "192.0.2.6/32", "ipv6": "2001:DB8::6:1/128"}
+NETWORK4_1 = {"ipv4": "192.0.2.7/32", "ipv6": "2001:DB8::7:1/128"}
+NETWORK4_2 = {"ipv4": "192.0.2.8/32", "ipv6": "2001:DB8::8:1/128"}
+NETWORK5_1 = {"ipv4": "192.0.2.9/32", "ipv6": "2001:DB8::9:1/128"}
+NETWORK5_2 = {"ipv4": "192.0.2.10/32", "ipv6": "2001:DB8::10:1/128"}
+
+NEXT_HOP_IP = {"ipv4": "Null0", "ipv6": "Null0"}
+
+PREFERRED_NEXT_HOP = "link_local"
+
+
+def configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name,
+ dut, peer):
+ """
+ result = configure_gr_followed_by_clear(tgen, topo, dut)
+ assert result is True, \
+ "Testcase {} :Failed \n Error {}". \
+ format(tc_name, result)
+ """
+
+ result = create_router_bgp(tgen, topo, input_dict)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(
+ tc_name, result)
+ 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
+
+def verify_stale_routes_list(tgen, addr_type, dut, input_dict):
+ """
+ This API is use verify Stale routes on refering the network with next hop value
+ Parameters
+ ----------
+ * `tgen`: topogen object
+ * `dut`: input dut router name
+ * `addr_type` : ip type ipv4/ipv6
+ * `input_dict` : input dict, has details of static routes
+ Usage
+ -----
+ dut = 'r1'
+ input_dict = {
+ "r3": {
+ "static_routes": [
+
+ {
+ "network": [NETWORK1_1[addr_type]],
+ "no_of_ip": 2,
+ "vrf": "RED"
+ }
+ ]
+ }
+ }
+
+ result = verify_stale_routes_list(tgen, addr_type, dut, input_dict)
+ Returns
+ -------
+ errormsg(str) or True
+ """
+ logger.debug("Entering lib API: verify_stale_routes_list()")
+ router_list = tgen.routers()
+ additional_nexthops_in_required_nhs = []
+ list1 = []
+ list2 = []
+ found_hops = []
+ for routerInput in input_dict.keys():
+ for router, rnode in router_list.items():
+ if router != dut:
+ continue
+ # Verifying RIB routes
+ command = "show bgp"
+ # Static routes
+ sleep(2)
+ logger.info('Checking router {} BGP RIB:'.format(dut))
+ if 'static_routes' in input_dict[routerInput]:
+ static_routes = input_dict[routerInput]["static_routes"]
+ for static_route in static_routes:
+ found_routes = []
+ missing_routes = []
+ st_found = False
+ nh_found = False
+ vrf = static_route.setdefault("vrf", None)
+ community = static_route.setdefault("community", None)
+ largeCommunity = \
+ static_route.setdefault("largeCommunity", None)
+ if vrf:
+ cmd = "{} vrf {} {}".\
+ format(command, vrf, addr_type)
+ if community:
+ cmd = "{} community {}".\
+ format(cmd, community)
+ if largeCommunity:
+ cmd = "{} large-community {}".\
+ format(cmd, largeCommunity)
+ else:
+ cmd = "{} {}".\
+ format(command, addr_type)
+ 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) == False:
+ errormsg = "[DUT: {}]: No route found in rib of router". \
+ format(router)
+ return errormsg
+ elif "warning" in rib_routes_json:
+ errormsg = "[DUT: {}]: {}". \
+ format(router, rib_routes_json["warning"])
+ 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)
+
+ for st_rt in ip_list:
+ st_rt = str(ipaddress.ip_network(st_rt))
+ _addr_type = validate_ip_address(st_rt)
+ if _addr_type != addr_type:
+ continue
+ if st_rt in rib_routes_json["routes"]:
+ st_found = True
+
+ found_routes.append(st_rt)
+ for mnh in range(0, len(rib_routes_json[
+ 'routes'][st_rt])):
+ found_hops.append([rib_r[
+ "ip"] for rib_r in rib_routes_json[
+ 'routes'][st_rt][
+ mnh]["nexthops"]])
+ return found_hops
+ else:
+ return 'error msg - no hops found'
+
+
+def setup_module(mod):
+ """
+ Sets up the pytest environment
+
+ * `mod`: module name
+ """
+
+ # Required linux kernel version for this suite to run.
+ result = required_linux_kernel_version("4.16")
+ if result is not True:
+ pytest.skip("Kernel requirements are not met")
+
+ global ADDR_TYPES
+
+ testsuite_run_time = time.asctime(time.localtime(time.time()))
+ logger.info("Testsuite start time: {}".format(testsuite_run_time))
+ logger.info("=" * 40)
+
+ logger.info("Running setup_module to create topology")
+
+ # This function initiates the topology build with Topogen...
+ json_file = "{}/bgp_gr_functionality_topo3.json".format(CWD)
+ tgen = Topogen(json_file, mod.__name__)
+ global topo
+ topo = tgen.json_topo
+ # ... and here it calls Mininet initialization functions.
+
+ # Starting topology, create tmp files which are loaded to routers
+ # to start deamons and then start routers
+ start_topology(tgen)
+
+ # Creating configuration from JSON
+ build_config_from_json(tgen, topo)
+
+ # 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
+ )
+
+ logger.info("Running setup_module() done")
+
+
+def teardown_module(mod):
+ """
+ Teardown the pytest environment
+
+ * `mod`: module name
+ """
+
+ logger.info("Running teardown_module to delete topology")
+
+ tgen = get_topogen()
+
+ # Stop toplogy and Remove tmp files
+ tgen.stop_topology()
+
+ logger.info(
+ "Testsuite end time: {}".format(time.asctime(time.localtime(time.time())))
+ )
+ logger.info("=" * 40)
+################################################################################
+#
+# TEST CASES
+#
+################################################################################
+def test_bgp_gr_stale_routes(request):
+ tgen = get_topogen()
+ tc_name = request.node.name
+ write_test_header(tc_name)
+
+ step("Verify the router failures")
+ if tgen.routers_have_failure():
+ check_router_status(tgen)
+
+ step("Creating 5 static Routes in Router R3 with NULL0 as Next hop")
+ for addr_type in ADDR_TYPES:
+ input_dict_1 = {
+ "r3": {
+ "static_routes": [{
+ "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type]
+ },
+ {
+ "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type]
+ },
+ {
+ "network": [NETWORK3_1[addr_type]] + [NETWORK3_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type]
+ },
+ {
+ "network": [NETWORK4_1[addr_type]] + [NETWORK4_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type]
+ },
+ {
+ "network": [NETWORK5_1[addr_type]] + [NETWORK5_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type]
+ }]
+ }
+ }
+ result = create_static_routes(tgen, input_dict_1)
+ assert result is True, 'Testcase {} : Failed \n Error: {}'.format(
+ tc_name, result)
+ step("verifying Created Route at R3 in VRF default")
+ for addr_type in ADDR_TYPES:
+ dut = 'r3'
+ input_dict_1= {'r3': topo['routers']['r3']}
+ result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1)
+ assert result is True, \
+ "Testcase {} :Failed \n Error {}". \
+ format(tc_name, result)
+ #done
+ step("verifying Created Route at R2 in VRF default")
+ for addr_type in ADDR_TYPES:
+ dut = 'r2'
+ input_dict_1= {'r2': topo['routers']['r2']}
+ result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1)
+ assert result is True, \
+ "Testcase {} :Failed \n Error {}". \
+ format(tc_name, result)
+ step("importing vrf RED on R2 under Address Family")
+ for addr_type in ADDR_TYPES:
+ input_import_vrf={
+ "r2": {
+ "bgp": [
+ {
+ "local_as": 200,
+ "vrf": "RED",
+ "address_family": {addr_type: {"unicast": {"import": {"vrf": "default"}}}},
+ }
+ ]
+ }
+ }
+ result = create_router_bgp(tgen, topo,input_import_vrf)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
+ #done
+ step("verifying static Routes at R2 in VRF RED")
+ for addr_type in ADDR_TYPES:
+ dut = 'r2'
+ input_dict_1= {'r2': topo['routers']['r2']}
+ result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1)
+ assert result is True, \
+ "Testcase {} :Failed \n Error {}". \
+ format(tc_name, result)
+
+ step("verifying static Routes at R1 in VRF RED")
+ for addr_type in ADDR_TYPES:
+ dut = 'r1'
+ input_dict_1= {'r1': topo['routers']['r1']}
+ result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1)
+ assert result is True, \
+ "Testcase {} :Failed \n Error {}". \
+ format(tc_name, result)
+
+ step("Configuring Graceful restart at R2 and R3 ")
+ input_dict = {
+ "r2": {
+
+ "bgp": {
+ "local_as": "200",
+ "graceful-restart": {
+ "graceful-restart": True,
+ }
+ }
+ },
+ "r3": {
+ "bgp": {
+ "local_as": "300",
+ "graceful-restart": {
+ "graceful-restart": True
+ }
+ }
+ }
+ }
+
+ configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name,dut='r2', peer='r3')
+
+
+
+ step("verify Graceful restart at R2")
+ for addr_type in ADDR_TYPES:
+ result = verify_graceful_restart(tgen, topo, addr_type, input_dict,
+ dut='r2', peer='r3')
+ assert result is True, \
+ "Testcase {} :Failed \n Error {}". \
+ format(tc_name, result)
+
+ step("verify Graceful restart at R3")
+ for addr_type in ADDR_TYPES:
+ result = verify_graceful_restart(tgen, topo, addr_type, input_dict,
+ dut='r3', peer='r2')
+ assert result is True, \
+ "Testcase {} :Failed \n Error {}". \
+ format(tc_name, result)
+
+ step("Configuring Graceful-restart-disable at R3")
+ input_dict = {
+ "r2": {
+
+ "bgp": {
+ "local_as": "200",
+ "graceful-restart": {
+ "graceful-restart": False,
+ }
+ }
+ },
+ "r3": {
+ "bgp": {
+ "local_as": "300",
+ "graceful-restart": {
+ "graceful-restart": False
+ }
+ }
+ }
+ }
+ configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name,dut='r3', peer='r2')
+
+ step("Verify Graceful-restart-disable at R3")
+ for addr_type in ADDR_TYPES:
+ result = verify_graceful_restart(tgen, topo, addr_type, input_dict,
+ dut='r3', peer='r2')
+ assert result is True, \
+ "Testcase {} :Failed \n Error {}". \
+ format(tc_name, result)
+
+ for iteration in range(5):
+ step("graceful-restart-disable:True at R3")
+ input_dict = {
+ "r3": {
+ "bgp": {
+ "graceful-restart": {
+ "graceful-restart-disable": True,
+ }
+ }
+ }
+ }
+ configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name,
+ dut='r3', peer='r2')
+
+ step("Verifying Routes at R2 on enabling GRD")
+ dut = 'r2'
+ for addr_type in ADDR_TYPES:
+ input_dict_1= {'r2': topo['routers']['r2']}
+ result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1)
+ assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result)
+
+ step("Verify stale Routes in Router R2 enabling GRD")
+ for addr_type in ADDR_TYPES:
+ dut = "r2"
+ protocol = "bgp"
+ verify_nh_for_static_rtes = {
+ "r3": {
+ "static_routes": [
+
+ {
+ "network": [NETWORK1_1[addr_type]],
+ "no_of_ip": 2,
+ "vrf": "RED"
+ }
+ ]
+ }
+ }
+ bgp_rib_next_hops = verify_stale_routes_list(
+ tgen, addr_type, dut, verify_nh_for_static_rtes)
+ assert (len(bgp_rib_next_hops)== 1) is True, "Testcase {} : Failed \n Error: {}".format(
+ tc_name, bgp_rib_next_hops,expected=True)
+
+ step("graceful-restart-disable:False at R3")
+ input_dict = {
+ "r3": {
+ "bgp": {
+ "graceful-restart": {
+ "graceful-restart-disable": False,
+ }
+ }
+ }
+ }
+ configure_gr_followed_by_clear(tgen, topo, input_dict, tc_name,
+ dut='r3', peer='r2')
+
+ step("Verifying Routes at R2 on disabling GRD")
+ dut = 'r2'
+ for addr_type in ADDR_TYPES:
+ input_dict_1= {'r2': topo['routers']['r2']}
+ result = verify_bgp_rib(tgen, addr_type, dut, input_dict_1)
+ assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result)
+
+ step("Verify stale Routes in Router R2 on disabling GRD")
+ for addr_type in ADDR_TYPES:
+ dut = "r2"
+ protocol = "bgp"
+ verify_nh_for_static_rtes = {
+ "r3": {
+ "static_routes": [
+
+ {
+ "network": [NETWORK1_1[addr_type]],
+ "no_of_ip": 2,
+ "vrf": "RED"
+ }
+ ]
+ }
+ }
+ bgp_rib_next_hops = verify_stale_routes_list(tgen, addr_type, dut, verify_nh_for_static_rtes)
+
+ stale_route_status=len(bgp_rib_next_hops)== 1
+ assert stale_route_status is True, "Testcase {} : Failed \n Error: {}".format(
+ tc_name, stale_route_status,expected=True)
+ write_test_footer(tc_name)
+
diff --git a/tests/topotests/bgp_ipv6_rtadv/r1/zebra.conf b/tests/topotests/bgp_ipv6_rtadv/r1/zebra.conf
index f95c3b07a7..1397c7f5fd 100644
--- a/tests/topotests/bgp_ipv6_rtadv/r1/zebra.conf
+++ b/tests/topotests/bgp_ipv6_rtadv/r1/zebra.conf
@@ -1,5 +1,5 @@
-debug zebra packet recv
-debug zebra packet send
+! debug zebra packet recv
+! debug zebra packet send
log stdout
interface lo
ip address 10.254.254.1/32
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_direct/r1/ldpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_direct/r1/ldpd.conf
index 3c6cbddc2a..f7f2714dae 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_direct/r1/ldpd.conf
+++ b/tests/topotests/bgp_l3vpn_to_bgp_direct/r1/ldpd.conf
@@ -1,13 +1,13 @@
hostname r1
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp discovery hello recv
-debug mpls ldp discovery hello sent
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp discovery hello recv
+! debug mpls ldp discovery hello sent
!
mpls ldp
router-id 1.1.1.1
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_direct/r2/ldpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_direct/r2/ldpd.conf
index bfdef21b75..c4056e01a8 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_direct/r2/ldpd.conf
+++ b/tests/topotests/bgp_l3vpn_to_bgp_direct/r2/ldpd.conf
@@ -1,13 +1,13 @@
hostname r2
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp discovery hello recv
-debug mpls ldp discovery hello sent
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp discovery hello recv
+! debug mpls ldp discovery hello sent
!
mpls ldp
router-id 2.2.2.2
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_direct/r3/ldpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_direct/r3/ldpd.conf
index dbf1d72b5f..48956cb996 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_direct/r3/ldpd.conf
+++ b/tests/topotests/bgp_l3vpn_to_bgp_direct/r3/ldpd.conf
@@ -1,13 +1,13 @@
hostname r3
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp discovery hello recv
-debug mpls ldp discovery hello sent
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp discovery hello recv
+! debug mpls ldp discovery hello sent
!
mpls ldp
router-id 3.3.3.3
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_direct/r4/ldpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_direct/r4/ldpd.conf
index 8f3533527d..1d04aa07e7 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_direct/r4/ldpd.conf
+++ b/tests/topotests/bgp_l3vpn_to_bgp_direct/r4/ldpd.conf
@@ -1,13 +1,13 @@
hostname r4
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp discovery hello recv
-debug mpls ldp discovery hello sent
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp discovery hello recv
+! debug mpls ldp discovery hello sent
!
mpls ldp
router-id 4.4.4.4
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 789f93b837..6cd92e293d 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/adjacencies.py
+++ b/tests/topotests/bgp_l3vpn_to_bgp_direct/scripts/adjacencies.py
@@ -7,11 +7,18 @@ luCommand("ce1", 'vtysh -c "show bgp summary"', " 00:0", "wait", "Adjacencies up
luCommand("ce2", 'vtysh -c "show bgp summary"', " 00:0", "wait", "Adjacencies up", 180)
luCommand("ce3", 'vtysh -c "show bgp summary"', " 00:0", "wait", "Adjacencies up", 180)
luCommand(
+ "r1", 'vtysh -c "show ip route ospf"', "2.2.2.2", "wait", "OSPF Route has Arrived", 60)
+luCommand(
"r1", "ping 2.2.2.2 -c 1", " 0. packet loss", "wait", "PE->P2 (loopback) ping", 60
)
luCommand(
+ "r3", 'vtysh -c "show ip route ospf"', "2.2.2.2", "wait", "OSPF Route has Arrived", 60)
+luCommand(
"r3", "ping 2.2.2.2 -c 1", " 0. packet loss", "wait", "PE->P2 (loopback) ping", 60
)
+
+luCommand(
+ "r4", 'vtysh -c "show ip route ospf"', "2.2.2.2", "wait", "OSPF Route has Arrived", 60)
luCommand(
"r4", "ping 2.2.2.2 -c 1", " 0. packet loss", "wait", "PE->P2 (loopback) ping", 60
)
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/ldpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/ldpd.conf
index de84f2bc3f..168b2d4802 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/ldpd.conf
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r1/ldpd.conf
@@ -2,13 +2,13 @@ hostname r1
log file ldpd.log
password zebra
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp discovery hello recv
-debug mpls ldp discovery hello sent
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp discovery hello recv
+! debug mpls ldp discovery hello sent
!
mpls ldp
router-id 1.1.1.1
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r2/ldpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r2/ldpd.conf
index 411ba85ef6..847be20934 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r2/ldpd.conf
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r2/ldpd.conf
@@ -2,13 +2,13 @@ hostname r2
log file ldpd.log
password zebra
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp discovery hello recv
-debug mpls ldp discovery hello sent
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp discovery hello recv
+! debug mpls ldp discovery hello sent
!
mpls ldp
router-id 2.2.2.2
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r3/ldpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r3/ldpd.conf
index 6002895f48..a620739ffb 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r3/ldpd.conf
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r3/ldpd.conf
@@ -2,13 +2,13 @@ hostname r3
password zebra
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp discovery hello recv
-debug mpls ldp discovery hello sent
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp discovery hello recv
+! debug mpls ldp discovery hello sent
!
mpls ldp
router-id 3.3.3.3
diff --git a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r4/ldpd.conf b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r4/ldpd.conf
index 292e9a7187..617d3a76d5 100644
--- a/tests/topotests/bgp_l3vpn_to_bgp_vrf/r4/ldpd.conf
+++ b/tests/topotests/bgp_l3vpn_to_bgp_vrf/r4/ldpd.conf
@@ -2,13 +2,13 @@ hostname r4
password zebra
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp discovery hello recv
-debug mpls ldp discovery hello sent
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp discovery hello recv
+! debug mpls ldp discovery hello sent
!
mpls ldp
router-id 4.4.4.4
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 a5f95f94bf..91a7adf997 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
@@ -4,7 +4,7 @@ from lib import topotest
ret = luCommand(
"r2",
"ip -M route show",
- "\d*(?= via inet 10.0.2.4 dev r2-eth1)",
+ r"\d*(?= via inet 10.0.2.4 dev r2-eth1)",
"wait",
"See mpls route to r4",
)
@@ -16,7 +16,7 @@ if ret != False and found != None:
ret = luCommand(
"r2",
"ip -M route show",
- "\d*(?= via inet 10.0.1.1 dev r2-eth0)",
+ r"\d*(?= via inet 10.0.1.1 dev r2-eth0)",
"wait",
"See mpls route to r1",
)
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 c8c03025c2..550ff93ea3 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
@@ -281,10 +281,109 @@ bgpribRequireVpnRoutes(
# r1 vtysh -c "show bgp vrf r1-cust1 ipv4"
-
########################################################################
# PE routers: VRFs contain routes from remote customer nets
########################################################################
+# First let's spot check and ensure that some of the routes
+# have showed up and been best path'd
+# After the first two are good. It's probably ok
+# to look at the rest of the routes in the vrf
+luCommand(
+ "r1",
+ 'vtysh -c "show bgp vrf r1-cust1 ipv4 uni 5.1.0.0/24"',
+ "2 available, best",
+ "wait",
+ "Ensure 5.1.0.0 shows up on r1",
+ 10,
+)
+luCommand(
+ "r1",
+ 'vtysh -c "show bgp vrf r1-cust1 ipv4 uni 5.1.1.0/24"',
+ "2 available, best",
+ "wait",
+ "Ensure 5.1.1.0 shows up on r1",
+ 10,
+)
+luCommand(
+ "r1",
+ 'vtysh -c "show bgp vrf r1-cust1 ipv4 uni 5.1.2.0/24"',
+ "1 available, best",
+ "wait",
+ "Ensure 5.1.2.0 shows up on r1",
+ 10,
+)
+luCommand(
+ "r1",
+ 'vtysh -c "show bgp vrf r1-cust1 ipv4 uni 5.1.3.0/24"',
+ "1 available, best",
+ "wait",
+ "Ensure 5.1.3.0 shows up on r1",
+ 10,
+)
+luCommand(
+ "r1",
+ 'vtysh -c "show bgp vrf r1-cust1 ipv4 uni 5.4.2.0/24"',
+ "1 available, best",
+ "wait",
+ "Ensure 5.4.2.0 shows up on r1",
+ 10,
+)
+luCommand(
+ "r1",
+ 'vtysh -c "show bgp vrf r1-cust1 ipv4 uni 5.4.2.0/24"',
+ "1 available, best",
+ "wait",
+ "Ensure 5.4.3.0 shows up on r1",
+ 10,
+)
+luCommand(
+ "r1",
+ 'vtysh -c "show bgp vrf r1-cust1 ipv4 uni 6.0.1.0/24"',
+ "3 available, best",
+ "wait",
+ "Ensure 6.0.1.0 shows up on r1",
+ 10,
+)
+luCommand(
+ "r1",
+ 'vtysh -c "show bgp vrf r1-cust1 ipv4 uni 6.0.2.0/24"',
+ "3 available, best",
+ "wait",
+ "Ensure 6.0.2.0 shows up on r1",
+ 10,
+)
+luCommand(
+ "r1",
+ 'vtysh -c "show bgp vrf r1-cust1 ipv4 uni 99.0.0.1/32"',
+ "1 available, best",
+ "wait",
+ "Ensure 99.0.0.1 shows up on r1",
+ 10,
+)
+luCommand(
+ "r1",
+ 'vtysh -c "show bgp vrf r1-cust1 ipv4 uni 99.0.0.2/32"',
+ "1 available, best",
+ "wait",
+ "Ensure 99.0.0.2 shows up on r1",
+ 10,
+)
+luCommand(
+ "r1",
+ 'vtysh -c "show bgp vrf r1-cust1 ipv4 uni 99.0.0.3/32"',
+ "1 available, best",
+ "wait",
+ "Ensure 99.0.0.3 shows up on r1",
+ 10,
+)
+luCommand(
+ "r1",
+ 'vtysh -c "show bgp vrf r1-cust1 ipv4 uni 99.0.0.4/32"',
+ "1 available, best",
+ "wait",
+ "Ensure 99.0.0.4 shows up on r1",
+ 10,
+)
want_r1_remote_cust1_routes = [
{"p": "5.1.0.0/24", "n": "3.3.3.3", "bp": False},
{"p": "5.1.0.0/24", "n": "99.0.0.1", "bp": True},
@@ -297,9 +396,9 @@ want_r1_remote_cust1_routes = [
{"p": "6.0.1.0/24", "n": "3.3.3.3", "bp": False},
{"p": "6.0.1.0/24", "n": "4.4.4.4", "bp": False},
{"p": "6.0.1.0/24", "n": "99.0.0.1", "bp": True},
- {"p": "6.0.2.0/24", "n": "3.3.3.3", "bp": False},
+ {"p": "6.0.2.0/24", "n": "3.3.3.3", "bp": True},
{"p": "6.0.2.0/24", "n": "4.4.4.4", "bp": False},
- {"p": "6.0.2.0/24", "n": "99.0.0.1", "bp": True},
+ {"p": "6.0.2.0/24", "n": "99.0.0.1", "bp": False},
{"p": "99.0.0.1/32", "n": "192.168.1.2", "bp": True},
{"p": "99.0.0.2/32", "n": "3.3.3.3"},
{"p": "99.0.0.3/32", "n": "4.4.4.4"},
@@ -314,6 +413,103 @@ bgpribRequireUnicastRoutes(
debug=False,
)
+
+luCommand(
+ "r3",
+ 'vtysh -c "show bgp vrf r3-cust1 ipv4 uni 5.1.0.0/24"',
+ "2 available, best",
+ "wait",
+ "Ensure 5.1.0.0 shows up r3",
+ 10,
+)
+luCommand(
+ "r3",
+ 'vtysh -c "show bgp vrf r3-cust1 ipv4 uni 5.1.1.0/24"',
+ "2 available, best",
+ "wait",
+ "Ensure 5.1.1.0 shows up on r3",
+ 10,
+)
+luCommand(
+ "r3",
+ 'vtysh -c "show bgp vrf r3-cust1 ipv4 uni 5.1.2.0/24"',
+ "1 available, best",
+ "wait",
+ "Ensure 5.1.2.0 shows up on r3",
+ 10,
+)
+luCommand(
+ "r3",
+ 'vtysh -c "show bgp vrf r3-cust1 ipv4 uni 5.1.3.0/24"',
+ "1 available, best",
+ "wait",
+ "Ensure 5.1.3.0 shows up on r3",
+ 10,
+)
+luCommand(
+ "r3",
+ 'vtysh -c "show bgp vrf r3-cust1 ipv4 uni 5.4.3.0/24"',
+ "1 available, best",
+ "wait",
+ "Ensure 5.4.3.0 shows up on r3",
+ 10,
+)
+luCommand(
+ "r3",
+ 'vtysh -c "show bgp vrf r3-cust1 ipv4 uni 5.4.3.0/24"',
+ "1 available, best",
+ "wait",
+ "Ensure 5.4.3.0 shows up on r3",
+ 10,
+)
+luCommand(
+ "r3",
+ 'vtysh -c "show bgp vrf r3-cust1 ipv4 uni 5.4.3.0/24"',
+ "1 available, best",
+ "wait",
+ "Ensure 5.4.3.0 shows up on r3",
+ 10,
+)
+luCommand(
+ "r3",
+ 'vtysh -c "show bgp vrf r3-cust1 ipv4 uni 6.0.1.0/24"',
+ "3 available, best",
+ "wait",
+ "Ensure 6.0.1.0 shows up on r3",
+ 10,
+)
+luCommand(
+ "r3",
+ 'vtysh -c "show bgp vrf r3-cust1 ipv4 uni 6.0.2.0/24"',
+ "3 available, best",
+ "wait",
+ "Ensure 6.0.2.0 shows up on r3",
+ 10,
+)
+luCommand(
+ "r3",
+ 'vtysh -c "show bgp vrf r3-cust1 ipv4 uni 99.0.0.1/32"',
+ "1 available, best",
+ "wait",
+ "Ensure 99.0.0.1 shows up on r3",
+ 10,
+)
+luCommand(
+ "r3",
+ 'vtysh -c "show bgp vrf r3-cust1 ipv4 uni 99.0.0.3/32"',
+ "1 available, best",
+ "wait",
+ "Ensure 99.0.0.3 shows up on r3",
+ 10,
+)
+luCommand(
+ "r3",
+ 'vtysh -c "show bgp vrf r3-cust1 ipv4 uni 99.0.0.4/32"',
+ "1 available, best",
+ "wait",
+ "Ensure 99.0.0.4 shows up on r3",
+ 10,
+)
want_r3_remote_cust1_routes = [
{"p": "5.1.0.0/24", "n": "1.1.1.1", "bp": True},
{"p": "5.1.0.0/24", "n": "99.0.0.2", "bp": False},
@@ -326,9 +522,9 @@ want_r3_remote_cust1_routes = [
{"p": "6.0.1.0/24", "n": "1.1.1.1", "bp": True},
{"p": "6.0.1.0/24", "n": "4.4.4.4", "bp": False},
{"p": "6.0.1.0/24", "n": "99.0.0.2", "bp": False},
- {"p": "6.0.2.0/24", "n": "1.1.1.1", "bp": False},
+ {"p": "6.0.2.0/24", "n": "1.1.1.1", "bp": True},
{"p": "6.0.2.0/24", "n": "4.4.4.4", "bp": False},
- {"p": "6.0.2.0/24", "n": "99.0.0.2", "bp": True},
+ {"p": "6.0.2.0/24", "n": "99.0.0.2", "bp": False},
{"p": "99.0.0.1/32", "n": "1.1.1.1", "bp": True},
{"p": "99.0.0.3/32", "n": "4.4.4.4", "bp": True},
{"p": "99.0.0.4/32", "n": "4.4.4.4", "bp": True},
@@ -342,6 +538,70 @@ bgpribRequireUnicastRoutes(
debug=False,
)
+luCommand(
+ "r4",
+ 'vtysh -c "show bgp vrf r4-cust1 ipv4 uni 5.1.0.0/24"',
+ "2 available, best",
+ "wait",
+ "Ensure 5.1.0.0 shows up on r4",
+ 10,
+)
+luCommand(
+ "r4",
+ 'vtysh -c "show bgp vrf r4-cust1 ipv4 uni 5.1.1.0/24"',
+ "2 available, best",
+ "wait",
+ "Ensure 5.1.1.0 shows up on r4",
+ 10,
+)
+luCommand(
+ "r4",
+ 'vtysh -c "show bgp vrf r4-cust1 ipv4 uni 6.0.1.0/24"',
+ "4 available, best",
+ "wait",
+ "Ensure 6.0.1.0 shows up on r4",
+ 10,
+)
+luCommand(
+ "r4",
+ 'vtysh -c "show bgp vrf r4-cust1 ipv4 uni 6.0.2.0/24"',
+ "4 available, best",
+ "wait",
+ "Ensure 6.0.2.0 shows up on r4",
+ 10,
+)
+luCommand(
+ "r4",
+ 'vtysh -c "show bgp vrf r4-cust1 ipv4 uni 99.0.0.1/32"',
+ "1 available, best",
+ "wait",
+ "Ensure 99.0.0.1 shows up on r4",
+ 10,
+)
+luCommand(
+ "r4",
+ 'vtysh -c "show bgp vrf r4-cust1 ipv4 uni 99.0.0.2/32"',
+ "1 available, best",
+ "wait",
+ "Ensure 99.0.0.2 shows up on r4",
+ 10,
+)
+luCommand(
+ "r4",
+ 'vtysh -c "show bgp vrf r4-cust1 ipv4 uni 99.0.0.3/32"',
+ "1 available, best",
+ "wait",
+ "Ensure 99.0.0.3 shows up on r4",
+ 10,
+)
+luCommand(
+ "r4",
+ 'vtysh -c "show bgp vrf r4-cust1 ipv4 uni 99.0.0.4/32"',
+ "1 available, best",
+ "wait",
+ "Ensure 99.0.0.4 shows up on r4",
+ 10,
+)
want_r4_remote_cust1_routes = [
{"p": "5.1.0.0/24", "n": "1.1.1.1", "bp": True},
{"p": "5.1.0.0/24", "n": "3.3.3.3", "bp": False},
@@ -351,10 +611,10 @@ want_r4_remote_cust1_routes = [
{"p": "6.0.1.0/24", "n": "3.3.3.3", "bp": False},
{"p": "6.0.1.0/24", "n": "99.0.0.3", "bp": False},
{"p": "6.0.1.0/24", "n": "99.0.0.4", "bp": False},
- {"p": "6.0.2.0/24", "n": "1.1.1.1", "bp": False},
+ {"p": "6.0.2.0/24", "n": "1.1.1.1", "bp": True},
{"p": "6.0.2.0/24", "n": "3.3.3.3", "bp": False},
{"p": "6.0.2.0/24", "n": "99.0.0.3", "bp": False},
- {"p": "6.0.2.0/24", "n": "99.0.0.4", "bp": True},
+ {"p": "6.0.2.0/24", "n": "99.0.0.4", "bp": False},
{"p": "99.0.0.1/32", "n": "1.1.1.1", "bp": True},
{"p": "99.0.0.2/32", "n": "3.3.3.3", "bp": True},
{"p": "99.0.0.3/32", "n": "192.168.1.2", "bp": True},
@@ -378,9 +638,9 @@ want_r4_remote_cust2_routes = [
{"p": "6.0.1.0/24", "n": "3.3.3.3", "bp": False},
{"p": "6.0.1.0/24", "n": "99.0.0.3", "bp": False},
{"p": "6.0.1.0/24", "n": "99.0.0.4", "bp": False},
- {"p": "6.0.2.0/24", "n": "1.1.1.1", "bp": False},
+ {"p": "6.0.2.0/24", "n": "1.1.1.1", "bp": True},
{"p": "6.0.2.0/24", "n": "3.3.3.3", "bp": False},
- {"p": "6.0.2.0/24", "n": "99.0.0.3", "bp": True},
+ {"p": "6.0.2.0/24", "n": "99.0.0.3", "bp": False},
{"p": "6.0.2.0/24", "n": "99.0.0.4", "bp": False},
{"p": "99.0.0.1/32", "n": "1.1.1.1", "bp": True},
{"p": "99.0.0.2/32", "n": "3.3.3.3", "bp": True},
@@ -574,8 +834,8 @@ luCommand(
luCommand(
"ce1",
'vtysh -c "show bgp ipv4 uni 6.0.2.0"',
- "1 available, best .*192.168.1.1.* Local.* 99.0.0.1 from 0.0.0.0 .99.0.0.1"
- + ".* Origin IGP, metric 100, localpref 100, weight 32768, valid, sourced, local, best .First path received"
+ "2 available, best .*192.168.1.1.* Local.* 99.0.0.1 from 0.0.0.0 .99.0.0.1"
+ + ".* Origin IGP, metric 100, localpref 100, weight 32768, valid, sourced, local, best .Weight"
+ ".* Community: 0:67.* Extended Community: RT:89:123.* Large Community: 12:34:11",
"pass",
"Redundant route 2 details",
@@ -583,8 +843,8 @@ luCommand(
luCommand(
"ce2",
'vtysh -c "show bgp ipv4 uni 6.0.2.0"',
- "1 available, best .*192.168.1.1.* Local.* 99.0.0.2 from 0.0.0.0 .99.0.0.2"
- + ".* Origin IGP, metric 100, localpref 100, weight 32768, valid, sourced, local, best .First path received"
+ "2 available, best .*192.168.1.1.* Local.* 99.0.0.2 from 0.0.0.0 .99.0.0.2"
+ + ".* Origin IGP, metric 100, localpref 100, weight 32768, valid, sourced, local, best .Weight"
+ ".* Community: 0:67.* Extended Community: RT:89:123.* Large Community: 12:34:12",
"pass",
"Redundant route 2 details",
@@ -603,7 +863,7 @@ luCommand(
'vtysh -c "show bgp ipv4 uni 6.0.2.0"',
"2 available, best .*192.168.1.1.* Local.* 192.168.1.1 from 192.168.1.1 .192.168.1.1"
+ ".* Origin IGP, metric 100, localpref 100, valid, internal"
- + ".* Community: 0:67.* Extended Community: RT:52:100 RT:89:123.* Large Community: 12:34:14",
+ + ".* Community: 0:67.* Extended Community: RT:52:100 RT:89:123.* Large Community: 12:34:11",
"pass",
"Redundant route 2 details",
)
@@ -612,7 +872,7 @@ luCommand(
'vtysh -c "show bgp vrf ce4-cust2 ipv4 6.0.2.0"',
"2 available, best .*192.168.2.1.* Local.* 192.168.2.1 from 192.168.2.1 .192.168.2.1"
+ ".* Origin IGP, metric 100, localpref 100, valid, internal"
- + ".* Community: 0:67.* Extended Community: RT:52:100 RT:89:123.* Large Community: 12:34:13",
+ + ".* Community: 0:67.* Extended Community: RT:52:100 RT:89:123.* Large Community: 12:34:11",
"pass",
"Redundant route 2 details",
)
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 9f100b7c30..eaa6aa4c30 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
@@ -21,7 +21,7 @@ for rtr in rtrs:
ret = luCommand(
rtr,
'vtysh -c "show memory"',
- "zebra: System allocator statistics: Total heap allocated: *(\d*) ([A-Za-z]*) .*bgpd: System allocator statistics: Total heap allocated: *(\d*) ([A-Za-z]*)",
+ r"zebra: System allocator statistics: Total heap allocated: *(\d*) ([A-Za-z]*) .*bgpd: System allocator statistics: Total heap allocated: *(\d*) ([A-Za-z]*)",
"none",
"collect bgpd memory stats",
)
@@ -188,7 +188,7 @@ else:
ret = luCommand(
rtr,
'vtysh -c "show memory"',
- "zebra: System allocator statistics: Total heap allocated: *(\d*) ([A-Za-z]*) .*bgpd: System allocator statistics: Total heap allocated: *(\d*) ([A-Za-z]*)",
+ r"zebra: System allocator statistics: Total heap allocated: *(\d*) ([A-Za-z]*) .*bgpd: System allocator statistics: Total heap allocated: *(\d*) ([A-Za-z]*)",
"none",
"collect bgpd memory stats",
)
diff --git a/tests/topotests/bgp_link_bw_ip/r4/bgpd.conf b/tests/topotests/bgp_link_bw_ip/r4/bgpd.conf
index d34db982c9..88b260f7e2 100644
--- a/tests/topotests/bgp_link_bw_ip/r4/bgpd.conf
+++ b/tests/topotests/bgp_link_bw_ip/r4/bgpd.conf
@@ -1,9 +1,9 @@
!
log file bgpd.log
!
-debug bgp updates
-debug bgp zebra
-debug bgp bestpath 198.10.1.1/32
+! debug bgp updates
+! debug bgp zebra
+! debug bgp bestpath 198.10.1.1/32
!
hostname r4
!
diff --git a/tests/topotests/bgp_llgr/__init__.py b/tests/topotests/bgp_llgr/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/topotests/bgp_llgr/__init__.py
diff --git a/tests/topotests/bgp_llgr/r0/bgpd.conf b/tests/topotests/bgp_llgr/r0/bgpd.conf
new file mode 100644
index 0000000000..d93ee193bc
--- /dev/null
+++ b/tests/topotests/bgp_llgr/r0/bgpd.conf
@@ -0,0 +1,10 @@
+router bgp 65000
+ no bgp ebgp-requires-policy
+ bgp graceful-restart
+ bgp graceful-restart restart-time 0
+ bgp long-lived-graceful-restart stale-time 20
+ neighbor 192.168.0.2 remote-as external
+ address-family ipv4 unicast
+ redistribute connected
+ exit-address-family
+!
diff --git a/tests/topotests/bgp_llgr/r0/zebra.conf b/tests/topotests/bgp_llgr/r0/zebra.conf
new file mode 100644
index 0000000000..4d11b67b26
--- /dev/null
+++ b/tests/topotests/bgp_llgr/r0/zebra.conf
@@ -0,0 +1,7 @@
+!
+int lo
+ ip address 172.16.1.1/32
+!
+int r0-eth0
+ ip address 192.168.0.1/24
+!
diff --git a/tests/topotests/bgp_llgr/r1/bgpd.conf b/tests/topotests/bgp_llgr/r1/bgpd.conf
new file mode 100644
index 0000000000..f8c9877730
--- /dev/null
+++ b/tests/topotests/bgp_llgr/r1/bgpd.conf
@@ -0,0 +1,10 @@
+router bgp 65001
+ no bgp ebgp-requires-policy
+ bgp graceful-restart
+ bgp graceful-restart restart-time 0
+ bgp long-lived-graceful-restart stale-time 20
+ neighbor 192.168.1.2 remote-as external
+ address-family ipv4 unicast
+ redistribute connected
+ exit-address-family
+!
diff --git a/tests/topotests/bgp_llgr/r1/zebra.conf b/tests/topotests/bgp_llgr/r1/zebra.conf
new file mode 100644
index 0000000000..1782edc2a5
--- /dev/null
+++ b/tests/topotests/bgp_llgr/r1/zebra.conf
@@ -0,0 +1,7 @@
+!
+int lo
+ ip address 172.16.1.1/32
+!
+int r1-eth0
+ ip address 192.168.1.1/24
+!
diff --git a/tests/topotests/bgp_llgr/r2/bgpd.conf b/tests/topotests/bgp_llgr/r2/bgpd.conf
new file mode 100644
index 0000000000..ea8e6beef1
--- /dev/null
+++ b/tests/topotests/bgp_llgr/r2/bgpd.conf
@@ -0,0 +1,9 @@
+router bgp 65002
+ no bgp ebgp-requires-policy
+ bgp graceful-restart
+ bgp long-lived-graceful-restart stale-time 20
+ neighbor 192.168.0.1 remote-as external
+ neighbor 192.168.1.1 remote-as external
+ neighbor 192.168.2.1 remote-as external
+ address-family ipv4 unicast
+ neighbor 192.168.1.1 weight 100
diff --git a/tests/topotests/bgp_llgr/r2/zebra.conf b/tests/topotests/bgp_llgr/r2/zebra.conf
new file mode 100644
index 0000000000..0fa589f3a9
--- /dev/null
+++ b/tests/topotests/bgp_llgr/r2/zebra.conf
@@ -0,0 +1,10 @@
+!
+int r2-eth0
+ ip address 192.168.0.2/24
+!
+int r2-eth1
+ ip address 192.168.1.2/24
+!
+int r2-eth2
+ ip address 192.168.2.2/24
+!
diff --git a/tests/topotests/bgp_llgr/r3/bgpd.conf b/tests/topotests/bgp_llgr/r3/bgpd.conf
new file mode 100644
index 0000000000..d73fdccb1d
--- /dev/null
+++ b/tests/topotests/bgp_llgr/r3/bgpd.conf
@@ -0,0 +1,6 @@
+router bgp 65003
+ bgp router-id 192.168.2.1
+ no bgp ebgp-requires-policy
+ bgp graceful-restart
+ bgp long-lived-graceful-restart stale-time 20
+ neighbor 192.168.2.2 remote-as external
diff --git a/tests/topotests/bgp_llgr/r3/zebra.conf b/tests/topotests/bgp_llgr/r3/zebra.conf
new file mode 100644
index 0000000000..8a7941b5a8
--- /dev/null
+++ b/tests/topotests/bgp_llgr/r3/zebra.conf
@@ -0,0 +1,4 @@
+!
+int r3-eth0
+ ip address 192.168.2.1/24
+!
diff --git a/tests/topotests/bgp_llgr/test_bgp_llgr.py b/tests/topotests/bgp_llgr/test_bgp_llgr.py
new file mode 100644
index 0000000000..df4f401d02
--- /dev/null
+++ b/tests/topotests/bgp_llgr/test_bgp_llgr.py
@@ -0,0 +1,184 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2021 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 BGP Long-lived Graceful Restart capability works:
+ Check if we can see 172.16.1.1/32 after initial converge in R3.
+ Check if we can see 172.16.1.1/32 as best selected due to higher weigth in R2.
+ Kill bgpd in R1.
+ Check if we can see 172.16.1.1/32 as stale in R2.
+ Check if we can see 172.16.1.1/32 depreferenced due to LLGR_STALE in R2.
+ Check if we can see 172.16.1.1/32 after R1 was killed in R3.
+"""
+
+import os
+import sys
+import json
+import pytest
+import functools
+
+pytestmark = [pytest.mark.bgpd]
+
+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.common_config import (
+ kill_router_daemons,
+ start_router_daemons,
+ step,
+)
+
+pytestmark = [pytest.mark.bgpd]
+
+
+def build_topo(tgen):
+ for routern in range(0, 5):
+ tgen.add_router("r{}".format(routern))
+
+ switch = tgen.add_switch("s0")
+ switch.add_link(tgen.gears["r0"])
+ switch.add_link(tgen.gears["r2"])
+
+ switch = tgen.add_switch("s1")
+ switch.add_link(tgen.gears["r1"])
+ switch.add_link(tgen.gears["r2"])
+
+ switch = tgen.add_switch("s2")
+ switch.add_link(tgen.gears["r2"])
+ switch.add_link(tgen.gears["r3"])
+
+
+def setup_module(mod):
+ tgen = Topogen(build_topo, 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_llgr():
+ tgen = get_topogen()
+
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ r2 = tgen.gears["r2"]
+ r3 = tgen.gears["r3"]
+
+ def _bgp_converge(router):
+ output = json.loads(router.vtysh_cmd("show ip bgp json"))
+ expected = {
+ "routes": {
+ "172.16.1.1/32": [{"nexthops": [{"ip": "192.168.2.2", "used": True}]}]
+ }
+ }
+ return topotest.json_cmp(output, expected)
+
+ step("Check if we can see 172.16.1.1/32 after initial converge in R3")
+ test_func = functools.partial(_bgp_converge, r3)
+ success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ assert result is None, "Cannot see 172.16.1.1/32 in r3"
+
+ def _bgp_weight_prefered_route(router):
+ output = json.loads(router.vtysh_cmd("show ip bgp 172.16.1.1/32 json"))
+ expected = {
+ "paths": [
+ {
+ "bestpath": {"selectionReason": "Weight"},
+ "nexthops": [
+ {
+ "ip": "192.168.1.1",
+ }
+ ],
+ }
+ ]
+ }
+ return topotest.json_cmp(output, expected)
+
+ step(
+ "Check if we can see 172.16.1.1/32 as best selected due to higher weigth in R2"
+ )
+ test_func = functools.partial(_bgp_weight_prefered_route, r2)
+ success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ assert (
+ result is None
+ ), "Prefix 172.16.1.1/32 is not selected as bests path due to weight"
+
+ step("Kill bgpd in R1")
+ kill_router_daemons(tgen, "r1", ["bgpd"])
+
+ def _bgp_stale_route(router):
+ output = json.loads(router.vtysh_cmd("show ip bgp 172.16.1.1/32 json"))
+ expected = {"paths": [{"community": {"string": "llgr-stale"}, "stale": True}]}
+ return topotest.json_cmp(output, expected)
+
+ step("Check if we can see 172.16.1.1/32 as stale in R2")
+ test_func = functools.partial(_bgp_stale_route, r2)
+ success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ assert result is None, "Prefix 172.16.1.1/32 is not stale"
+
+ def _bgp_llgr_depreference_route(router):
+ output = json.loads(router.vtysh_cmd("show ip bgp 172.16.1.1/32 json"))
+ expected = {
+ "paths": [
+ {
+ "bestpath": {"selectionReason": "First path received"},
+ "nexthops": [
+ {
+ "ip": "192.168.0.1",
+ }
+ ],
+ }
+ ]
+ }
+ return topotest.json_cmp(output, expected)
+
+ step("Check if we can see 172.16.1.1/32 depreferenced due to LLGR_STALE in R2")
+ test_func = functools.partial(_bgp_llgr_depreference_route, r2)
+ success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ assert result is None, "Prefix 172.16.1.1/32 is not depreferenced due to LLGR_STALE"
+
+ step("Check if we can see 172.16.1.1/32 after R1 was killed in R3")
+ test_func = functools.partial(_bgp_converge, r3)
+ success, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ assert result is None, "Cannot see 172.16.1.1/32 in r3"
+
+
+if __name__ == "__main__":
+ args = ["-s"] + sys.argv[1:]
+ sys.exit(pytest.main(args))
diff --git a/tests/topotests/bgp_lu_topo1/R1/bgpd.conf b/tests/topotests/bgp_lu_topo1/R1/bgpd.conf
index 1bdb4c7a3e..a164152e0e 100644
--- a/tests/topotests/bgp_lu_topo1/R1/bgpd.conf
+++ b/tests/topotests/bgp_lu_topo1/R1/bgpd.conf
@@ -1,6 +1,6 @@
!
-debug bgp labelpool
-debug bgp zebra
+! debug bgp labelpool
+! debug bgp zebra
!
router bgp 1
bgp router-id 10.0.0.1
diff --git a/tests/topotests/bgp_lu_topo1/R1/zebra.conf b/tests/topotests/bgp_lu_topo1/R1/zebra.conf
index 4f6fee579f..f8a9ce4e03 100644
--- a/tests/topotests/bgp_lu_topo1/R1/zebra.conf
+++ b/tests/topotests/bgp_lu_topo1/R1/zebra.conf
@@ -1,6 +1,6 @@
-debug zebra events
-debug zebra dplane
-debug zebra mpls
+! debug zebra events
+! debug zebra dplane
+! debug zebra mpls
!
interface R1-eth0
ip address 10.0.0.1/24
diff --git a/tests/topotests/bgp_lu_topo1/R2/bgpd.conf b/tests/topotests/bgp_lu_topo1/R2/bgpd.conf
index bac608e1c3..d35bbb886b 100644
--- a/tests/topotests/bgp_lu_topo1/R2/bgpd.conf
+++ b/tests/topotests/bgp_lu_topo1/R2/bgpd.conf
@@ -1,5 +1,5 @@
-debug bgp labelpool
-debug bgp zebra
+! debug bgp labelpool
+! debug bgp zebra
!
router bgp 2
bgp router-id 10.0.0.2
diff --git a/tests/topotests/bgp_lu_topo1/R2/labelpool.summ.json b/tests/topotests/bgp_lu_topo1/R2/labelpool.summ.json
index 29e6c2cbf7..9c817e8075 100644
--- a/tests/topotests/bgp_lu_topo1/R2/labelpool.summ.json
+++ b/tests/topotests/bgp_lu_topo1/R2/labelpool.summ.json
@@ -1,8 +1,8 @@
{
- "Ledger":506,
- "InUse":506,
+ "Ledger":0,
+ "InUse":0,
"Requests":0,
- "LabelChunks":11,
+ "LabelChunks":0,
"Pending":0,
"Reconnects":0
}
diff --git a/tests/topotests/bgp_lu_topo1/R2/zebra.conf b/tests/topotests/bgp_lu_topo1/R2/zebra.conf
index 33ee53efe7..083da3ef9c 100644
--- a/tests/topotests/bgp_lu_topo1/R2/zebra.conf
+++ b/tests/topotests/bgp_lu_topo1/R2/zebra.conf
@@ -1,7 +1,7 @@
!
-debug zebra events
-debug zebra dplane
-debug zebra mpls
+! debug zebra events
+! debug zebra dplane
+! debug zebra mpls
!
interface R2-eth0
ip address 10.0.0.2/24
diff --git a/tests/topotests/bgp_lu_topo1/R3/bgpd.conf b/tests/topotests/bgp_lu_topo1/R3/bgpd.conf
index b42df022e0..31d26ea1ed 100644
--- a/tests/topotests/bgp_lu_topo1/R3/bgpd.conf
+++ b/tests/topotests/bgp_lu_topo1/R3/bgpd.conf
@@ -1,6 +1,6 @@
log file /tmp/bgpd.log
!
-debug bgp updates
+! debug bgp updates
!
router bgp 2
bgp router-id 10.0.1.3
diff --git a/tests/topotests/bgp_lu_topo1/R3/zebra.conf b/tests/topotests/bgp_lu_topo1/R3/zebra.conf
index 524978bff6..ea4a1482dd 100644
--- a/tests/topotests/bgp_lu_topo1/R3/zebra.conf
+++ b/tests/topotests/bgp_lu_topo1/R3/zebra.conf
@@ -1,8 +1,8 @@
log file /tmp/zebra.log
!
-debug zebra events
-debug zebra packet detail
-debug zebra mpls
+! debug zebra events
+! debug zebra packet detail
+! debug zebra mpls
!
interface R3-eth0
ip address 10.0.1.3/24
diff --git a/tests/topotests/bgp_lu_topo2/R1/bgpd.conf b/tests/topotests/bgp_lu_topo2/R1/bgpd.conf
new file mode 100644
index 0000000000..9fe4026977
--- /dev/null
+++ b/tests/topotests/bgp_lu_topo2/R1/bgpd.conf
@@ -0,0 +1,29 @@
+!
+no log unique-id
+!
+! debug bgp labelpool
+! debug bgp zebra
+!
+router bgp 1
+ bgp router-id 10.0.0.1
+ timers bgp 3 9
+ no bgp ebgp-requires-policy
+ no bgp network import-check
+ neighbor 10.0.0.2 remote-as 2
+! neighbor 10.0.0.2 solo
+ neighbor 10.0.0.2 timers connect 10
+ neighbor 10.0.4.4 remote-as 4
+! neighbor 10.0.4.4 solo
+ neighbor 10.0.4.4 timers connect 10
+!
+ address-family ipv4 unicast
+ no neighbor 10.0.0.2 activate
+ no neighbor 10.0.4.4 activate
+ redistribute connected
+ exit-address-family
+ !
+ address-family ipv4 labeled-unicast
+ neighbor 10.0.0.2 activate
+ neighbor 10.0.4.4 activate
+ exit-address-family
+!
diff --git a/tests/topotests/bgp_lu_topo2/R1/labelpool.summ.json b/tests/topotests/bgp_lu_topo2/R1/labelpool.summ.json
new file mode 100644
index 0000000000..77705e8d35
--- /dev/null
+++ b/tests/topotests/bgp_lu_topo2/R1/labelpool.summ.json
@@ -0,0 +1,8 @@
+{
+ "Ledger":51,
+ "InUse":51,
+ "Requests":0,
+ "LabelChunks":2,
+ "Pending":0,
+ "Reconnects":0
+}
diff --git a/tests/topotests/bgp_lu_topo2/R1/zebra.conf b/tests/topotests/bgp_lu_topo2/R1/zebra.conf
new file mode 100644
index 0000000000..64c34a3bc3
--- /dev/null
+++ b/tests/topotests/bgp_lu_topo2/R1/zebra.conf
@@ -0,0 +1,13 @@
+!
+no log unique-id
+!
+! debug zebra events
+! debug zebra rib det
+! debug zebra dplane
+! debug zebra mpls
+!
+interface R1-eth0
+ ip address 10.0.0.1/24
+!
+interface R1-eth1
+ ip address 10.0.4.1/24
diff --git a/tests/topotests/bgp_lu_topo2/R2/bgpd.conf b/tests/topotests/bgp_lu_topo2/R2/bgpd.conf
new file mode 100644
index 0000000000..917060c4df
--- /dev/null
+++ b/tests/topotests/bgp_lu_topo2/R2/bgpd.conf
@@ -0,0 +1,27 @@
+!
+no log unique-id
+!
+! debug bgp labelpool
+! debug bgp zebra
+!
+router bgp 2
+ bgp router-id 10.0.0.2
+ no bgp ebgp-requires-policy
+ no bgp network import-check
+ timers bgp 3 9
+ neighbor 10.0.0.1 remote-as 1
+ neighbor 10.0.0.1 timers connect 10
+ neighbor 10.0.1.3 remote-as 2
+ neighbor 10.0.1.3 update-source 10.0.1.2
+ neighbor 10.0.1.3 timers connect 10
+!
+ address-family ipv4 unicast
+ network 10.0.0.0/24
+ neighbor 10.0.1.3 activate
+ no neighbor 10.0.0.1 activate
+ exit-address-family
+ !
+ address-family ipv4 labeled-unicast
+ neighbor 10.0.0.1 activate
+ exit-address-family
+!
diff --git a/tests/topotests/bgp_lu_topo2/R2/labelpool.summ.json b/tests/topotests/bgp_lu_topo2/R2/labelpool.summ.json
new file mode 100644
index 0000000000..eb1ae93b6c
--- /dev/null
+++ b/tests/topotests/bgp_lu_topo2/R2/labelpool.summ.json
@@ -0,0 +1,8 @@
+{
+ "Ledger":1,
+ "InUse":1,
+ "Requests":0,
+ "LabelChunks":1,
+ "Pending":0,
+ "Reconnects":0
+}
diff --git a/tests/topotests/bgp_lu_topo2/R2/zebra.conf b/tests/topotests/bgp_lu_topo2/R2/zebra.conf
new file mode 100644
index 0000000000..f465914f63
--- /dev/null
+++ b/tests/topotests/bgp_lu_topo2/R2/zebra.conf
@@ -0,0 +1,14 @@
+!
+no log unique-id
+!
+! debug zebra events
+! debug zebra dplane
+! debug zebra mpls
+! debug zebra rib det
+!
+interface R2-eth0
+ ip address 10.0.0.2/24
+!
+interface R2-eth1
+ ip address 10.0.1.2/24
+! \ No newline at end of file
diff --git a/tests/topotests/bgp_lu_topo2/R3/bgpd.conf b/tests/topotests/bgp_lu_topo2/R3/bgpd.conf
new file mode 100644
index 0000000000..6443445b80
--- /dev/null
+++ b/tests/topotests/bgp_lu_topo2/R3/bgpd.conf
@@ -0,0 +1,70 @@
+log file /tmp/bgpd.log
+no log unique-id
+!
+!
+! debug bgp updates
+!
+router bgp 2
+ bgp router-id 10.0.1.3
+ no bgp ebgp-requires-policy
+ no bgp network import-check
+ timers bgp 3 9
+ neighbor 10.0.1.2 remote-as 2
+ neighbor 10.0.1.2 timers connect 10
+ !
+ address-family ipv4 unicast
+ neighbor 10.0.1.2 activate
+ network 10.0.1.0/24
+ network 11.0.0.1/32
+ network 11.0.0.2/32
+ network 11.0.0.3/32
+ network 11.0.0.4/32
+ network 11.0.0.5/32
+ network 11.0.0.6/32
+ network 11.0.0.7/32
+ network 11.0.0.8/32
+ network 11.0.0.9/32
+ network 11.0.0.10/32
+ network 11.0.0.11/32
+ network 11.0.0.12/32
+ network 11.0.0.13/32
+ network 11.0.0.14/32
+ network 11.0.0.15/32
+ network 11.0.0.16/32
+ network 11.0.0.17/32
+ network 11.0.0.18/32
+ network 11.0.0.19/32
+ network 11.0.0.20/32
+ network 11.0.0.21/32
+ network 11.0.0.22/32
+ network 11.0.0.23/32
+ network 11.0.0.24/32
+ network 11.0.0.25/32
+ network 11.0.0.26/32
+ network 11.0.0.27/32
+ network 11.0.0.28/32
+ network 11.0.0.29/32
+ network 11.0.0.30/32
+ network 11.0.0.31/32
+ network 11.0.0.32/32
+ network 11.0.0.33/32
+ network 11.0.0.34/32
+ network 11.0.0.35/32
+ network 11.0.0.36/32
+ network 11.0.0.37/32
+ network 11.0.0.38/32
+ network 11.0.0.39/32
+ network 11.0.0.40/32
+ network 11.0.0.41/32
+ network 11.0.0.42/32
+ network 11.0.0.43/32
+ network 11.0.0.44/32
+ network 11.0.0.45/32
+ network 11.0.0.46/32
+ network 11.0.0.47/32
+ network 11.0.0.48/32
+ network 11.0.0.49/32
+ network 11.0.0.50/32
+ exit-address-family
+ !
+!
diff --git a/tests/topotests/bgp_lu_topo2/R3/staticd.conf b/tests/topotests/bgp_lu_topo2/R3/staticd.conf
new file mode 100644
index 0000000000..867fc5a837
--- /dev/null
+++ b/tests/topotests/bgp_lu_topo2/R3/staticd.conf
@@ -0,0 +1,5 @@
+log file /tmp/staticd.log
+no log unique-id
+!
+!
+ip route 10.0.4.0/24 10.0.1.2
diff --git a/tests/topotests/bgp_lu_topo2/R3/zebra.conf b/tests/topotests/bgp_lu_topo2/R3/zebra.conf
new file mode 100644
index 0000000000..dd24deb214
--- /dev/null
+++ b/tests/topotests/bgp_lu_topo2/R3/zebra.conf
@@ -0,0 +1,11 @@
+log file /tmp/zebra.log
+no log unique-id
+!
+!
+! debug zebra events
+! debug zebra packet detail
+! debug zebra mpls
+!
+interface R3-eth0
+ ip address 10.0.1.3/24
+!
diff --git a/tests/topotests/bgp_lu_topo2/R4/bgpd.conf b/tests/topotests/bgp_lu_topo2/R4/bgpd.conf
new file mode 100644
index 0000000000..45c81fb93e
--- /dev/null
+++ b/tests/topotests/bgp_lu_topo2/R4/bgpd.conf
@@ -0,0 +1,23 @@
+!
+no log unique-id
+!
+! debug bgp labelpool
+! debug bgp zebra
+!
+router bgp 4
+ bgp router-id 10.0.4.4
+ timers bgp 3 9
+ no bgp ebgp-requires-policy
+ no bgp network import-check
+ neighbor 10.0.4.1 remote-as 1
+ neighbor 10.0.4.1 solo
+ neighbor 10.0.4.1 timers connect 10
+!
+ address-family ipv4 unicast
+ no neighbor 10.0.4.1 activate
+ exit-address-family
+ !
+ address-family ipv4 labeled-unicast
+ neighbor 10.0.4.1 activate
+ exit-address-family
+!
diff --git a/tests/topotests/bgp_lu_topo2/R4/zebra.conf b/tests/topotests/bgp_lu_topo2/R4/zebra.conf
new file mode 100644
index 0000000000..53ffe51e06
--- /dev/null
+++ b/tests/topotests/bgp_lu_topo2/R4/zebra.conf
@@ -0,0 +1,9 @@
+no log unique-id
+!
+! debug zebra events
+! debug zebra dplane
+! debug zebra mpls
+! debug zebra rib det
+!
+interface R4-eth0
+ ip address 10.0.4.4/24
diff --git a/tests/topotests/bgp_lu_topo2/test_bgp_lu2.py b/tests/topotests/bgp_lu_topo2/test_bgp_lu2.py
new file mode 100644
index 0000000000..fc9d2c433a
--- /dev/null
+++ b/tests/topotests/bgp_lu_topo2/test_bgp_lu2.py
@@ -0,0 +1,221 @@
+#!/usr/bin/env python
+#
+# test_bgp_lu2.py
+#
+# Part of FRR/NetDEF Topology Tests
+#
+# Copyright (c) 2020 by Volta Networks
+# Copyright (c) 2021 by Nvidia, Inc.
+#
+# Permission to use, copy, modify, and/or distribute this software
+# for any purpose with or without fee is hereby granted, provided
+# that the above copyright notice and this permission notice appear
+# in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND NETDEF DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NETDEF BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+#
+
+"""
+test_bgp_lu2.py: Test BGP LU label allocation
+"""
+
+import os
+import sys
+import json
+from functools import partial
+import pytest
+
+# Save the Current Working Directory to find configuration files.
+CWD = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join(CWD, "../"))
+
+# pylint: disable=C0413
+# Import topogen and topotest helpers
+from lib import topotest
+from lib.topogen import Topogen, TopoRouter, get_topogen
+from lib.topolog import logger
+
+# Required to instantiate the topology builder class.
+
+pytestmark = [pytest.mark.bgpd]
+
+#
+# Basic scenario for BGP-LU. Nodes are directly connected.
+# Node 3 is advertising routes to 2, which advertises them
+# as BGP-LU to 1; this way we get routes with actual labels, as
+# opposed to implicit-null routes in the 2-node case.
+#
+# R2 is an LER, with MPLS towards R1, and IP towards R3. R1 is an LSR, with
+# MPLS on both sides.
+#
+#
+# AS4 BGP-LU AS1 BGP-LU AS2 iBGP AS2
+# +-----+ +-----+ +-----+ +-----+
+# | |.4 .1| |.1 .2| |.2 .3| |
+# | 4 +-------------+ 1 +----------------+ 2 +-----------------+ 3 |
+# | | 10.0.4.0/24 | | 10.0.0.0/24 | | 10.0.1.0/24 | |
+# +-----+ +-----+ +-----+ +-----+
+#
+#
+
+
+def build_topo(tgen):
+ "Build function"
+
+ # This function's only purpose is to define allocation and relationship
+ # between routers, switches and hosts.
+ #
+ #
+ # Create routers
+ tgen.add_router("R1")
+ tgen.add_router("R2")
+ tgen.add_router("R3")
+ tgen.add_router("R4")
+
+ # R1-R2
+ switch = tgen.add_switch("s1")
+ switch.add_link(tgen.gears["R1"])
+ switch.add_link(tgen.gears["R2"])
+
+ # R2-R3
+ switch = tgen.add_switch("s2")
+ switch.add_link(tgen.gears["R2"])
+ switch.add_link(tgen.gears["R3"])
+
+ # R1-R4
+ switch = tgen.add_switch("s3")
+ switch.add_link(tgen.gears["R1"])
+ switch.add_link(tgen.gears["R4"])
+
+
+def setup_module(mod):
+ "Sets up the pytest environment"
+ # This function initiates the topology build with Topogen...
+ tgen = Topogen(build_topo, mod.__name__)
+
+ # Skip if no mpls support
+ if not tgen.hasmpls:
+ logger.info("MPLS is not available, skipping test")
+ pytest.skip("MPLS is not available, skipping")
+ return
+
+ # ... and here it calls Mininet initialization functions.
+ tgen.start_topology()
+
+ # This is a sample of configuration loading.
+ router_list = tgen.routers()
+
+ # Enable mpls input for routers, so we can ping
+ sval = "net.mpls.conf.{}.input"
+ topotest.sysctl_assure(router_list["R2"], sval.format("R2-eth0"), 1)
+ topotest.sysctl_assure(router_list["R1"], sval.format("R1-eth0"), 1)
+ topotest.sysctl_assure(router_list["R1"], sval.format("R1-eth1"), 1)
+ topotest.sysctl_assure(router_list["R4"], sval.format("R4-eth0"), 1)
+
+ # For all registered routers, load the zebra configuration file
+ for rname, router in router_list.items():
+ router.load_config(
+ TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
+ )
+ router.load_config(
+ TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname))
+ )
+
+ # Have static config for R3 too
+ if router == router_list["R3"]:
+ router.load_config(
+ TopoRouter.RD_STATIC, os.path.join(CWD, "{}/staticd.conf".format(rname))
+ )
+
+ # After loading the configurations, this function loads configured daemons.
+ tgen.start_router()
+
+
+def teardown_module(mod):
+ "Teardown the pytest environment"
+ tgen = get_topogen()
+
+ # This function tears down the whole topology.
+ tgen.stop_topology()
+
+
+def check_labelpool(router):
+ json_file = "{}/{}/labelpool.summ.json".format(CWD, router.name)
+ expected = json.loads(open(json_file).read())
+
+ test_func = partial(
+ topotest.router_json_cmp, router, "show bgp labelpool summary json", expected
+ )
+ _, result = topotest.run_and_expect(test_func, None, count=20, wait=1)
+ assertmsg = '"{}" JSON output mismatches - Did not converge'.format(router.name)
+ assert result is None, assertmsg
+
+
+def test_converge_bgplu():
+ "Wait for protocol convergence"
+
+ tgen = get_topogen()
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ # TODO -- enable for debugging
+ # tgen.mininet_cli()
+
+ r1 = tgen.gears["R1"]
+ r2 = tgen.gears["R2"]
+
+ check_labelpool(r1)
+ check_labelpool(r2)
+
+
+def test_ping():
+ "Simple ping tests"
+
+ tgen = get_topogen()
+
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ #
+ logger.info("Ping from R2 to R3")
+ router = tgen.gears["R2"]
+ output = router.run("ping -c 4 -w 4 {}".format("10.0.1.3"))
+ assert " 0% packet loss" in output, "Ping R2->R3 FAILED"
+ logger.info("Ping from R2 to R3 ... success")
+
+ #
+ logger.info("Ping from R4 to R2")
+ router = tgen.gears["R4"]
+ output = router.run("ping -c 4 -w 4 {}".format("10.0.0.2"))
+ assert " 0% packet loss" in output, "Ping R4->R2 FAILED"
+ logger.info("Ping from R4 to R2 ... success")
+
+ #
+ logger.info("Ping from R4 to R3")
+ router = tgen.gears["R4"]
+ output = router.run("ping -c 4 -w 4 {}".format("10.0.1.3"))
+ assert " 0% packet loss" in output, "Ping R4->R3 FAILED"
+ logger.info("Ping from R4 to R3 ... success")
+
+
+def test_memory_leak():
+ "Run the memory leak test and report results."
+ tgen = get_topogen()
+ if not tgen.is_memleak_enabled():
+ pytest.skip("Memory leak test/report is disabled")
+
+ tgen.report_memory_leaks()
+
+
+if __name__ == "__main__":
+ args = ["-s"] + sys.argv[1:]
+ sys.exit(pytest.main(args))
diff --git a/tests/topotests/bgp_multiview_topo1/peer1/exa-send.py b/tests/topotests/bgp_multiview_topo1/peer1/exa-send.py
index fbb73f5b6a..09f6ea59e5 100755
--- a/tests/topotests/bgp_multiview_topo1/peer1/exa-send.py
+++ b/tests/topotests/bgp_multiview_topo1/peer1/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_multiview_topo1/peer2/exa-send.py b/tests/topotests/bgp_multiview_topo1/peer2/exa-send.py
index fbb73f5b6a..09f6ea59e5 100755
--- a/tests/topotests/bgp_multiview_topo1/peer2/exa-send.py
+++ b/tests/topotests/bgp_multiview_topo1/peer2/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_multiview_topo1/peer3/exa-send.py b/tests/topotests/bgp_multiview_topo1/peer3/exa-send.py
index fbb73f5b6a..09f6ea59e5 100755
--- a/tests/topotests/bgp_multiview_topo1/peer3/exa-send.py
+++ b/tests/topotests/bgp_multiview_topo1/peer3/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_multiview_topo1/peer4/exa-send.py b/tests/topotests/bgp_multiview_topo1/peer4/exa-send.py
index fbb73f5b6a..09f6ea59e5 100755
--- a/tests/topotests/bgp_multiview_topo1/peer4/exa-send.py
+++ b/tests/topotests/bgp_multiview_topo1/peer4/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_multiview_topo1/peer5/exa-send.py b/tests/topotests/bgp_multiview_topo1/peer5/exa-send.py
index fbb73f5b6a..09f6ea59e5 100755
--- a/tests/topotests/bgp_multiview_topo1/peer5/exa-send.py
+++ b/tests/topotests/bgp_multiview_topo1/peer5/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_multiview_topo1/peer6/exa-send.py b/tests/topotests/bgp_multiview_topo1/peer6/exa-send.py
index fbb73f5b6a..09f6ea59e5 100755
--- a/tests/topotests/bgp_multiview_topo1/peer6/exa-send.py
+++ b/tests/topotests/bgp_multiview_topo1/peer6/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_multiview_topo1/peer7/exa-send.py b/tests/topotests/bgp_multiview_topo1/peer7/exa-send.py
index fbb73f5b6a..09f6ea59e5 100755
--- a/tests/topotests/bgp_multiview_topo1/peer7/exa-send.py
+++ b/tests/topotests/bgp_multiview_topo1/peer7/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_multiview_topo1/peer8/exa-send.py b/tests/topotests/bgp_multiview_topo1/peer8/exa-send.py
index fbb73f5b6a..09f6ea59e5 100755
--- a/tests/topotests/bgp_multiview_topo1/peer8/exa-send.py
+++ b/tests/topotests/bgp_multiview_topo1/peer8/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_peer_type_multipath_relax/peer1/exa_readpipe.py b/tests/topotests/bgp_peer_type_multipath_relax/peer1/exa_readpipe.py
index 9e689a27e3..0f998c1613 100644
--- a/tests/topotests/bgp_peer_type_multipath_relax/peer1/exa_readpipe.py
+++ b/tests/topotests/bgp_peer_type_multipath_relax/peer1/exa_readpipe.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"Helper script to read api commands from a pipe and feed them to ExaBGP"
import sys
diff --git a/tests/topotests/bgp_peer_type_multipath_relax/peer2/exa_readpipe.py b/tests/topotests/bgp_peer_type_multipath_relax/peer2/exa_readpipe.py
index 9e689a27e3..0f998c1613 100644
--- a/tests/topotests/bgp_peer_type_multipath_relax/peer2/exa_readpipe.py
+++ b/tests/topotests/bgp_peer_type_multipath_relax/peer2/exa_readpipe.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"Helper script to read api commands from a pipe and feed them to ExaBGP"
import sys
diff --git a/tests/topotests/bgp_peer_type_multipath_relax/peer3/exa_readpipe.py b/tests/topotests/bgp_peer_type_multipath_relax/peer3/exa_readpipe.py
index 9e689a27e3..0f998c1613 100644
--- a/tests/topotests/bgp_peer_type_multipath_relax/peer3/exa_readpipe.py
+++ b/tests/topotests/bgp_peer_type_multipath_relax/peer3/exa_readpipe.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"Helper script to read api commands from a pipe and feed them to ExaBGP"
import sys
diff --git a/tests/topotests/bgp_peer_type_multipath_relax/peer4/exa_readpipe.py b/tests/topotests/bgp_peer_type_multipath_relax/peer4/exa_readpipe.py
index 9e689a27e3..0f998c1613 100644
--- a/tests/topotests/bgp_peer_type_multipath_relax/peer4/exa_readpipe.py
+++ b/tests/topotests/bgp_peer_type_multipath_relax/peer4/exa_readpipe.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"Helper script to read api commands from a pipe and feed them to ExaBGP"
import sys
diff --git a/tests/topotests/bgp_route_map_match_ipv6_nexthop/__init__.py b/tests/topotests/bgp_route_map_match_ipv6_nexthop/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/topotests/bgp_route_map_match_ipv6_nexthop/__init__.py
diff --git a/tests/topotests/bgp_route_map_match_ipv6_nexthop/r1/bgpd.conf b/tests/topotests/bgp_route_map_match_ipv6_nexthop/r1/bgpd.conf
new file mode 100644
index 0000000000..c2a49252d6
--- /dev/null
+++ b/tests/topotests/bgp_route_map_match_ipv6_nexthop/r1/bgpd.conf
@@ -0,0 +1,32 @@
+!
+ipv6 access-list nh1 permit 2001:db8:1::/64
+ipv6 access-list nh2 permit 2001:db8:2::/64
+ipv6 access-list nh3 permit 2001:db8:3::/64
+!
+ipv6 prefix-list nh4 permit 2001:db8:5::/64 le 128
+!
+router bgp 65001
+ bgp router-id 10.10.10.1
+ no bgp ebgp-requires-policy
+ neighbor 2001:db8::2 remote-as external
+ address-family ipv6 unicast
+ neighbor 2001:db8::2 activate
+ neighbor 2001:db8::2 route-map r2 in
+ exit-address-family
+!
+route-map r2 permit 10
+ match ipv6 next-hop nh1
+ set community 65002:1
+route-map r2 permit 20
+ match ipv6 next-hop nh2
+ set community 65002:2
+route-map r2 permit 30
+ match ipv6 next-hop nh3
+ set community 65002:3
+route-map r2 permit 40
+ match ipv6 next-hop address 2001:db8:4::1
+ set community 65002:4
+route-map r2 permit 50
+ match ipv6 next-hop prefix-list nh4
+ set community 65002:5
+!
diff --git a/tests/topotests/bgp_route_map_match_ipv6_nexthop/r1/zebra.conf b/tests/topotests/bgp_route_map_match_ipv6_nexthop/r1/zebra.conf
new file mode 100644
index 0000000000..1d4374bd8f
--- /dev/null
+++ b/tests/topotests/bgp_route_map_match_ipv6_nexthop/r1/zebra.conf
@@ -0,0 +1,4 @@
+!
+int r1-eth0
+ ipv6 address 2001:db8::1/64
+!
diff --git a/tests/topotests/bgp_route_map_match_ipv6_nexthop/r2/bgpd.conf b/tests/topotests/bgp_route_map_match_ipv6_nexthop/r2/bgpd.conf
new file mode 100644
index 0000000000..19dcf3664b
--- /dev/null
+++ b/tests/topotests/bgp_route_map_match_ipv6_nexthop/r2/bgpd.conf
@@ -0,0 +1,33 @@
+!
+router bgp 65002
+ bgp router-id 10.10.10.2
+ no bgp ebgp-requires-policy
+ neighbor 2001:db8::1 remote-as external
+ address-family ipv6 unicast
+ redistribute connected
+ neighbor 2001:db8::1 activate
+ neighbor 2001:db8::1 route-map r1 out
+ exit-address-family
+!
+ipv6 prefix-list p1 permit 2001:db8:1::1/128
+ipv6 prefix-list p2 permit 2001:db8:2::1/128
+ipv6 prefix-list p3 permit 2001:db8:3::1/128
+ipv6 prefix-list p4 permit 2001:db8:4::1/128
+ipv6 prefix-list p5 permit 2001:db8:5::1/128
+!
+route-map r1 permit 10
+ match ipv6 address prefix-list p1
+ set ipv6 next-hop global 2001:db8:1::1
+route-map r1 permit 20
+ match ipv6 address prefix-list p2
+ set ipv6 next-hop global 2001:db8:2::1
+route-map r1 permit 30
+ match ipv6 address prefix-list p3
+ set ipv6 next-hop global 2001:db8:3::1
+route-map r1 permit 40
+ match ipv6 address prefix-list p4
+ set ipv6 next-hop global 2001:db8:4::1
+route-map r1 permit 50
+ match ipv6 address prefix-list p5
+ set ipv6 next-hop global 2001:db8:5::1
+!
diff --git a/tests/topotests/bgp_route_map_match_ipv6_nexthop/r2/zebra.conf b/tests/topotests/bgp_route_map_match_ipv6_nexthop/r2/zebra.conf
new file mode 100644
index 0000000000..e69345f4f6
--- /dev/null
+++ b/tests/topotests/bgp_route_map_match_ipv6_nexthop/r2/zebra.conf
@@ -0,0 +1,11 @@
+!
+int lo
+ ipv6 address 2001:db8:1::1/128
+ ipv6 address 2001:db8:2::1/128
+ ipv6 address 2001:db8:3::1/128
+ ipv6 address 2001:db8:4::1/128
+ ipv6 address 2001:db8:5::1/128
+!
+int r2-eth0
+ ip address 2001:db8::2/64
+!
diff --git a/tests/topotests/bgp_route_map_match_ipv6_nexthop/test_bgp_route_map_match_ipv6_nexthop.py b/tests/topotests/bgp_route_map_match_ipv6_nexthop/test_bgp_route_map_match_ipv6_nexthop.py
new file mode 100644
index 0000000000..8c86526bf1
--- /dev/null
+++ b/tests/topotests/bgp_route_map_match_ipv6_nexthop/test_bgp_route_map_match_ipv6_nexthop.py
@@ -0,0 +1,121 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2021 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 we can match BGP prefixes by next-hop which is
+specified by an IPv6 Access-list, prefix-list or just an address.
+"""
+
+import os
+import sys
+import json
+import pytest
+import functools
+
+pytestmark = pytest.mark.bgpd
+
+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
+
+pytestmark = [pytest.mark.bgpd]
+
+
+def build_topo(tgen):
+ 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(build_topo, 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_map_match_ipv6_next_hop_access_list():
+ tgen = get_topogen()
+
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ router = tgen.gears["r1"]
+
+ def _bgp_converge(router):
+ output = json.loads(router.vtysh_cmd("show ipv6 route json"))
+ expected = {
+ "2001:db8:1::1/128": [
+ {
+ "communities": "65002:1",
+ }
+ ],
+ "2001:db8:2::1/128": [
+ {
+ "communities": "65002:2",
+ }
+ ],
+ "2001:db8:3::1/128": [
+ {
+ "communities": "65002:3",
+ }
+ ],
+ "2001:db8:4::1/128": [
+ {
+ "communities": "65002:4",
+ }
+ ],
+ "2001:db8:5::1/128": [
+ {
+ "communities": "65002:5",
+ }
+ ],
+ }
+ 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)
+ assert result is None, "Can't match routes using ipv6 next-hop access-list"
+
+
+if __name__ == "__main__":
+ args = ["-s"] + sys.argv[1:]
+ sys.exit(pytest.main(args))
diff --git a/tests/topotests/bgp_route_server_client/__init__.py b/tests/topotests/bgp_route_server_client/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/topotests/bgp_route_server_client/__init__.py
diff --git a/tests/topotests/bgp_route_server_client/r1/bgpd.conf b/tests/topotests/bgp_route_server_client/r1/bgpd.conf
new file mode 100644
index 0000000000..9826b671f9
--- /dev/null
+++ b/tests/topotests/bgp_route_server_client/r1/bgpd.conf
@@ -0,0 +1,12 @@
+!
+router bgp 65001
+ bgp router-id 10.10.10.1
+ no bgp ebgp-requires-policy
+ neighbor 2001:db8:1::1 remote-as external
+ neighbor 2001:db8:1::1 timers 3 10
+ neighbor 2001:db8:1::1 timers connect 5
+ address-family ipv6 unicast
+ redistribute connected
+ neighbor 2001:db8:1::1 activate
+ exit-address-family
+!
diff --git a/tests/topotests/bgp_route_server_client/r1/zebra.conf b/tests/topotests/bgp_route_server_client/r1/zebra.conf
new file mode 100644
index 0000000000..08d0be6220
--- /dev/null
+++ b/tests/topotests/bgp_route_server_client/r1/zebra.conf
@@ -0,0 +1,7 @@
+!
+int lo
+ ipv6 address 2001:db8:f::1/128
+!
+int r1-eth0
+ ipv6 address 2001:db8:1::2/64
+!
diff --git a/tests/topotests/bgp_route_server_client/r2/bgpd.conf b/tests/topotests/bgp_route_server_client/r2/bgpd.conf
new file mode 100644
index 0000000000..3b0a24b8ba
--- /dev/null
+++ b/tests/topotests/bgp_route_server_client/r2/bgpd.conf
@@ -0,0 +1,17 @@
+router bgp 65000 view RS
+ bgp router-id 10.10.10.2
+ no bgp ebgp-requires-policy
+ neighbor 2001:db8:1::2 remote-as external
+ neighbor 2001:db8:1::2 timers 3 10
+ neighbor 2001:db8:1::2 timers connect 5
+ neighbor 2001:db8:3::2 remote-as external
+ neighbor 2001:db8:3::2 timers 3 10
+ neighbor 2001:db8:3::2 timers connect 5
+ address-family ipv6 unicast
+ redistribute connected
+ neighbor 2001:db8:1::2 activate
+ neighbor 2001:db8:3::2 activate
+ neighbor 2001:db8:1::2 route-server-client
+ neighbor 2001:db8:3::2 route-server-client
+ exit-address-family
+!
diff --git a/tests/topotests/bgp_route_server_client/r2/zebra.conf b/tests/topotests/bgp_route_server_client/r2/zebra.conf
new file mode 100644
index 0000000000..806bc4fe32
--- /dev/null
+++ b/tests/topotests/bgp_route_server_client/r2/zebra.conf
@@ -0,0 +1,7 @@
+!
+int r2-eth0
+ ipv6 address 2001:db8:1::1/64
+!
+int r2-eth1
+ ipv6 address 2001:db8:3::1/64
+!
diff --git a/tests/topotests/bgp_route_server_client/r3/bgpd.conf b/tests/topotests/bgp_route_server_client/r3/bgpd.conf
new file mode 100644
index 0000000000..60a5ffc559
--- /dev/null
+++ b/tests/topotests/bgp_route_server_client/r3/bgpd.conf
@@ -0,0 +1,12 @@
+!
+router bgp 65003
+ bgp router-id 10.10.10.3
+ no bgp ebgp-requires-policy
+ neighbor 2001:db8:3::1 remote-as external
+ neighbor 2001:db8:3::1 timers 3 10
+ neighbor 2001:db8:3::1 timers connect 5
+ address-family ipv6 unicast
+ redistribute connected
+ neighbor 2001:db8:3::1 activate
+ exit-address-family
+!
diff --git a/tests/topotests/bgp_route_server_client/r3/zebra.conf b/tests/topotests/bgp_route_server_client/r3/zebra.conf
new file mode 100644
index 0000000000..b5511a437c
--- /dev/null
+++ b/tests/topotests/bgp_route_server_client/r3/zebra.conf
@@ -0,0 +1,7 @@
+!
+int lo
+ ipv6 address 2001:db8:f::3/128
+!
+int r3-eth0
+ ipv6 address 2001:db8:3::2/64
+!
diff --git a/tests/topotests/bgp_route_server_client/test_bgp_route_server_client.py b/tests/topotests/bgp_route_server_client/test_bgp_route_server_client.py
new file mode 100644
index 0000000000..21088f7008
--- /dev/null
+++ b/tests/topotests/bgp_route_server_client/test_bgp_route_server_client.py
@@ -0,0 +1,143 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2021 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 we send ONLY GUA address for route-server-client peers.
+"""
+
+import os
+import sys
+import json
+import pytest
+import functools
+
+pytestmark = pytest.mark.bgpd
+
+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
+
+pytestmark = [pytest.mark.bgpd]
+
+
+def build_topo(tgen):
+ 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(build_topo, 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_server_client():
+ tgen = get_topogen()
+
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ r1 = tgen.gears["r1"]
+ r2 = tgen.gears["r2"]
+
+ def _bgp_converge(router):
+ output = json.loads(router.vtysh_cmd("show bgp ipv6 unicast summary json"))
+ expected = {"peers": {"2001:db8:1::1": {"state": "Established", "pfxRcd": 2}}}
+ return topotest.json_cmp(output, expected)
+
+ test_func = functools.partial(_bgp_converge, r1)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ assert result is None, "Cannot see BGP sessions to be up"
+
+ def _bgp_prefix_received(router):
+ output = json.loads(router.vtysh_cmd("show bgp 2001:db8:f::3/128 json"))
+ expected = {
+ "prefix": "2001:db8:f::3/128",
+ "paths": [{"nexthops": [{"ip": "2001:db8:3::2"}]}],
+ }
+ return topotest.json_cmp(output, expected)
+
+ test_func = functools.partial(_bgp_prefix_received, r1)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ assert result is None, "Cannot see BGP GUA next hop from r3 in r1"
+
+ def _bgp_single_next_hop(router):
+ output = json.loads(router.vtysh_cmd("show bgp 2001:db8:f::3/128 json"))
+ return len(output["paths"][0]["nexthops"])
+
+ assert (
+ _bgp_single_next_hop(r1) == 1
+ ), "Not ONLY one Next Hop received for 2001:db8:f::3/128"
+
+ def _bgp_gua_lla_next_hop(router):
+ output = json.loads(router.vtysh_cmd("show bgp view RS 2001:db8:f::3/128 json"))
+ expected = {
+ "prefix": "2001:db8:f::3/128",
+ "paths": [
+ {
+ "nexthops": [
+ {
+ "ip": "2001:db8:3::2",
+ "hostname": "r3",
+ "afi": "ipv6",
+ "scope": "global",
+ },
+ {"hostname": "r3", "afi": "ipv6", "scope": "link-local"},
+ ]
+ }
+ ],
+ }
+ return topotest.json_cmp(output, expected)
+
+ test_func = functools.partial(_bgp_gua_lla_next_hop, r2)
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=0.5)
+ assert result is None, "Cannot see BGP LLA next hop from r3 in r2"
+
+
+if __name__ == "__main__":
+ args = ["-s"] + sys.argv[1:]
+ sys.exit(pytest.main(args))
diff --git a/tests/topotests/bgp_snmp_mplsl3vpn/ce1/zebra.conf b/tests/topotests/bgp_snmp_mplsl3vpn/ce1/zebra.conf
index 8ad2ddc48c..4a8579845c 100644
--- a/tests/topotests/bgp_snmp_mplsl3vpn/ce1/zebra.conf
+++ b/tests/topotests/bgp_snmp_mplsl3vpn/ce1/zebra.conf
@@ -1,8 +1,8 @@
log file /tmp/zebra.log
log stdout
!
-debug zebra events
-debug zebra dplane
+! debug zebra events
+! debug zebra dplane
!
!
interface ce1-eth0
diff --git a/tests/topotests/bgp_snmp_mplsl3vpn/ce2/zebra.conf b/tests/topotests/bgp_snmp_mplsl3vpn/ce2/zebra.conf
index fa2e968e55..5e0aa5d3f0 100644
--- a/tests/topotests/bgp_snmp_mplsl3vpn/ce2/zebra.conf
+++ b/tests/topotests/bgp_snmp_mplsl3vpn/ce2/zebra.conf
@@ -1,8 +1,8 @@
log file /tmp/zebra.log
log stdout
!
-debug zebra events
-debug zebra dplane
+! debug zebra events
+! debug zebra dplane
!
!
interface ce2-eth0
diff --git a/tests/topotests/bgp_snmp_mplsl3vpn/ce3/zebra.conf b/tests/topotests/bgp_snmp_mplsl3vpn/ce3/zebra.conf
index ea91e21bad..fabc11e84d 100644
--- a/tests/topotests/bgp_snmp_mplsl3vpn/ce3/zebra.conf
+++ b/tests/topotests/bgp_snmp_mplsl3vpn/ce3/zebra.conf
@@ -1,8 +1,8 @@
log file /tmp/zebra.log
log stdout
!
-debug zebra events
-debug zebra dplane
+! debug zebra events
+! debug zebra dplane
!
!
interface ce3-eth0
diff --git a/tests/topotests/bgp_snmp_mplsl3vpn/ce4/zebra.conf b/tests/topotests/bgp_snmp_mplsl3vpn/ce4/zebra.conf
index 0866fa9759..e369f41b39 100644
--- a/tests/topotests/bgp_snmp_mplsl3vpn/ce4/zebra.conf
+++ b/tests/topotests/bgp_snmp_mplsl3vpn/ce4/zebra.conf
@@ -1,8 +1,8 @@
log file /tmp/zebra.log
log stdout
!
-debug zebra events
-debug zebra dplane
+! debug zebra events
+! debug zebra dplane
!
!
interface ce4-eth0
diff --git a/tests/topotests/bgp_snmp_mplsl3vpn/r1/isisd.conf b/tests/topotests/bgp_snmp_mplsl3vpn/r1/isisd.conf
index b5ca993da3..1a148f0628 100644
--- a/tests/topotests/bgp_snmp_mplsl3vpn/r1/isisd.conf
+++ b/tests/topotests/bgp_snmp_mplsl3vpn/r1/isisd.conf
@@ -1,7 +1,7 @@
log stdout debugging
!
-debug isis route-events
-debug isis events
+! debug isis route-events
+! debug isis events
!
interface r1-eth0
ip router isis ISIS1
diff --git a/tests/topotests/bgp_snmp_mplsl3vpn/r2/isisd.conf b/tests/topotests/bgp_snmp_mplsl3vpn/r2/isisd.conf
index 3dfa43831a..396797dfb9 100644
--- a/tests/topotests/bgp_snmp_mplsl3vpn/r2/isisd.conf
+++ b/tests/topotests/bgp_snmp_mplsl3vpn/r2/isisd.conf
@@ -1,7 +1,7 @@
log stdout debugging
!
-debug isis route-events
-debug isis events
+! debug isis route-events
+! debug isis events
!
interface r2-eth0
ip router isis ISIS1
diff --git a/tests/topotests/bgp_snmp_mplsl3vpn/r2/zebra.conf b/tests/topotests/bgp_snmp_mplsl3vpn/r2/zebra.conf
index 9bc4331bae..4fec8af3db 100644
--- a/tests/topotests/bgp_snmp_mplsl3vpn/r2/zebra.conf
+++ b/tests/topotests/bgp_snmp_mplsl3vpn/r2/zebra.conf
@@ -1,8 +1,8 @@
log file /tmp/zebra.log
log stdout
!
-debug zebra events
-debug zebra dplane
+! debug zebra events
+! debug zebra dplane
!
!
interface r2-eth0
diff --git a/tests/topotests/bgp_snmp_mplsl3vpn/r3/isisd.conf b/tests/topotests/bgp_snmp_mplsl3vpn/r3/isisd.conf
index 578ebafad6..9e52fb6820 100644
--- a/tests/topotests/bgp_snmp_mplsl3vpn/r3/isisd.conf
+++ b/tests/topotests/bgp_snmp_mplsl3vpn/r3/isisd.conf
@@ -1,7 +1,7 @@
log stdout debugging
!
-debug isis route-events
-debug isis events
+! debug isis route-events
+! debug isis events
!
interface r3-eth0
ip router isis ISIS1
diff --git a/tests/topotests/bgp_snmp_mplsl3vpn/r3/zebra.conf b/tests/topotests/bgp_snmp_mplsl3vpn/r3/zebra.conf
index 4d2007e787..e433995593 100644
--- a/tests/topotests/bgp_snmp_mplsl3vpn/r3/zebra.conf
+++ b/tests/topotests/bgp_snmp_mplsl3vpn/r3/zebra.conf
@@ -1,8 +1,8 @@
log file /tmp/zebra.log
log stdout
!
-debug zebra events
-debug zebra dplane
+! debug zebra events
+! debug zebra dplane
!
!
interface r3-eth0
diff --git a/tests/topotests/bgp_snmp_mplsl3vpn/r4/isisd.conf b/tests/topotests/bgp_snmp_mplsl3vpn/r4/isisd.conf
index 3e9e9af45f..8de2cf05c5 100644
--- a/tests/topotests/bgp_snmp_mplsl3vpn/r4/isisd.conf
+++ b/tests/topotests/bgp_snmp_mplsl3vpn/r4/isisd.conf
@@ -1,7 +1,7 @@
log stdout debugging
!
-debug isis route-events
-debug isis events
+! debug isis route-events
+! debug isis events
!
interface r4-eth0
ip router isis ISIS1
diff --git a/tests/topotests/bgp_snmp_mplsl3vpn/r4/zebra.conf b/tests/topotests/bgp_snmp_mplsl3vpn/r4/zebra.conf
index c48407c108..14580e5b3a 100644
--- a/tests/topotests/bgp_snmp_mplsl3vpn/r4/zebra.conf
+++ b/tests/topotests/bgp_snmp_mplsl3vpn/r4/zebra.conf
@@ -1,8 +1,8 @@
log file /tmp/zebra.log
log stdout
!
-debug zebra events
-debug zebra dplane
+! debug zebra events
+! debug zebra dplane
!
!
interface r4-eth0
diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/zebra.conf
index 68b5730a63..8defa0125a 100644
--- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/zebra.conf
+++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/zebra.conf
@@ -7,9 +7,9 @@ log stdout notifications
log monitor notifications
log commands
!
-debug zebra packet
-debug zebra dplane
-debug zebra kernel
+! debug zebra packet
+! debug zebra dplane
+! debug zebra kernel
!
interface eth0
ipv6 address 2001::1/64
diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/zebra.conf
index 91fd92d422..51d9c92235 100644
--- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/zebra.conf
+++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/zebra.conf
@@ -7,9 +7,9 @@ log stdout notifications
log monitor notifications
log commands
!
-debug zebra packet
-debug zebra dplane
-debug zebra kernel
+! debug zebra packet
+! debug zebra dplane
+! debug zebra kernel
!
interface eth0
ipv6 address 2001::2/64
diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/test_bgp_srv6l3vpn_to_bgp_vrf.py b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/test_bgp_srv6l3vpn_to_bgp_vrf.py
index e0cf8c88e6..ffdcd08f80 100755
--- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/test_bgp_srv6l3vpn_to_bgp_vrf.py
+++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/test_bgp_srv6l3vpn_to_bgp_vrf.py
@@ -152,13 +152,14 @@ def check_ping(name, dest_addr, expect_connected):
tgen = get_topogen()
output = tgen.gears[name].run("ping6 {} -c 1 -w 1".format(dest_addr))
logger.info(output)
- assert match in output, "ping fail"
+ if match not in output:
+ return "ping fail"
match = "{} packet loss".format("0%" if expect_connected else "100%")
logger.info("[+] check {} {} {}".format(name, dest_addr, match))
tgen = get_topogen()
func = functools.partial(_check, name, dest_addr, match)
- success, result = topotest.run_and_expect(func, None, count=10, wait=0.5)
+ success, result = topotest.run_and_expect(func, None, count=10, wait=1)
assert result is None, "Failed"
@@ -171,7 +172,7 @@ def check_rib(name, cmd, expected_file):
expected = open_json_file("{}/{}".format(CWD, expected_file))
return topotest.json_cmp(output, expected)
- logger.info("[+] check {} \"{}\" {}".format(name, cmd, expected_file))
+ logger.info('[+] check {} "{}" {}'.format(name, cmd, expected_file))
tgen = get_topogen()
func = functools.partial(_check, name, cmd, expected_file)
success, result = topotest.run_and_expect(func, None, count=10, wait=0.5)
diff --git a/tests/topotests/bgp_suppress_fib/r1/bgp_ipv4_allowas.json b/tests/topotests/bgp_suppress_fib/r1/bgp_ipv4_allowas.json
new file mode 100644
index 0000000000..bc4d0f4796
--- /dev/null
+++ b/tests/topotests/bgp_suppress_fib/r1/bgp_ipv4_allowas.json
@@ -0,0 +1,40 @@
+{
+ "prefix":"192.168.1.1/32",
+ "paths":[
+ {
+ "aspath":{
+ "string":"2",
+ "segments":[
+ {
+ "type":"as-sequence",
+ "list":[
+ 2
+ ]
+ }
+ ],
+ "length":1
+ },
+ "origin":"incomplete",
+ "metric":0,
+ "valid":true,
+ "bestpath":{
+ "overall":true,
+ "selectionReason":"First path received"
+ },
+ "nexthops":[
+ {
+ "ip":"10.0.0.2",
+ "afi":"ipv4",
+ "metric":0,
+ "accessible":true,
+ "used":true
+ }
+ ],
+ "peer":{
+ "peerId":"10.0.0.2",
+ "routerId":"10.0.0.9",
+ "type":"external"
+ }
+ }
+ ]
+}
diff --git a/tests/topotests/bgp_suppress_fib/r2/bgp_ipv4_allowas.json b/tests/topotests/bgp_suppress_fib/r2/bgp_ipv4_allowas.json
new file mode 100644
index 0000000000..16561ce837
--- /dev/null
+++ b/tests/topotests/bgp_suppress_fib/r2/bgp_ipv4_allowas.json
@@ -0,0 +1,68 @@
+{
+ "prefix":"192.168.1.1/32",
+ "paths":[
+ {
+ "aspath":{
+ "string":"1 2",
+ "segments":[
+ {
+ "type":"as-sequence",
+ "list":[
+ 1,
+ 2
+ ]
+ }
+ ],
+ "length":2
+ },
+ "origin":"incomplete",
+ "valid":true,
+ "fibInstalled":true,
+ "nexthops":[
+ {
+ "ip":"10.0.0.1",
+ "afi":"ipv4",
+ "metric":0,
+ "accessible":true,
+ "used":true
+ }
+ ],
+ "peer":{
+ "peerId":"10.0.0.1",
+ "routerId":"10.0.0.1",
+ "type":"external"
+ }
+ },
+ {
+ "aspath":{
+ "string":"Local",
+ "segments":[
+ ],
+ "length":0
+ },
+ "origin":"incomplete",
+ "metric":0,
+ "weight":32768,
+ "valid":true,
+ "sourced":true,
+ "bestpath":{
+ "overall":true,
+ "selectionReason":"Weight"
+ },
+ "fibInstalled":true,
+ "nexthops":[
+ {
+ "ip":"10.0.0.10",
+ "afi":"ipv4",
+ "metric":0,
+ "accessible":true,
+ "used":true
+ }
+ ],
+ "peer":{
+ "peerId":"0.0.0.0",
+ "routerId":"10.0.0.9"
+ }
+ }
+ ]
+}
diff --git a/tests/topotests/bgp_suppress_fib/r2/bgpd.allowas_in.conf b/tests/topotests/bgp_suppress_fib/r2/bgpd.allowas_in.conf
new file mode 100644
index 0000000000..caebb0e922
--- /dev/null
+++ b/tests/topotests/bgp_suppress_fib/r2/bgpd.allowas_in.conf
@@ -0,0 +1,18 @@
+access-list access seq 10 permit 192.168.1.1/32
+!
+ip route 192.168.1.1/32 10.0.0.10
+!
+debug bgp bestpath
+debug bgp nht
+debug bgp updates
+debug bgp update-groups
+debug bgp zebra
+debug zebra rib detail
+!
+router bgp 2
+ address-family ipv4 uni
+ redistribute static
+ neighbor 10.0.0.10 allowas-in 1
+ neighbor 10.0.0.1 allowas-in 1
+ !
+!
diff --git a/tests/topotests/bgp_suppress_fib/r2/bgpd.conf b/tests/topotests/bgp_suppress_fib/r2/bgpd.conf
index 8321c915e3..ebef2012a8 100644
--- a/tests/topotests/bgp_suppress_fib/r2/bgpd.conf
+++ b/tests/topotests/bgp_suppress_fib/r2/bgpd.conf
@@ -1,3 +1,6 @@
+debug bgp updates
+debug bgp bestpath 40.0.0.0/8
+debug bgp zebra
!
router bgp 2
no bgp ebgp-requires-policy
diff --git a/tests/topotests/bgp_suppress_fib/r2/no_bgp_ipv4_allowas.json b/tests/topotests/bgp_suppress_fib/r2/no_bgp_ipv4_allowas.json
new file mode 100644
index 0000000000..0967ef424b
--- /dev/null
+++ b/tests/topotests/bgp_suppress_fib/r2/no_bgp_ipv4_allowas.json
@@ -0,0 +1 @@
+{}
diff --git a/tests/topotests/bgp_suppress_fib/r2/v4_override.json b/tests/topotests/bgp_suppress_fib/r2/v4_override.json
new file mode 100644
index 0000000000..f17907f011
--- /dev/null
+++ b/tests/topotests/bgp_suppress_fib/r2/v4_override.json
@@ -0,0 +1,20 @@
+{
+ "40.0.0.0\/8":[
+ {
+ "prefix":"40.0.0.0\/8",
+ "protocol":"static",
+ "vrfName":"default",
+ "selected":true,
+ "destSelected":true,
+ "installed":true,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.0.10",
+ "afi":"ipv4",
+ "active":true
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/topotests/bgp_suppress_fib/r3/v4_override.json b/tests/topotests/bgp_suppress_fib/r3/v4_override.json
new file mode 100644
index 0000000000..a35d49e9e8
--- /dev/null
+++ b/tests/topotests/bgp_suppress_fib/r3/v4_override.json
@@ -0,0 +1,4 @@
+{
+ "0.0.0.0\/0":[
+ ]
+}
diff --git a/tests/topotests/bgp_suppress_fib/test_bgp_suppress_fib.py b/tests/topotests/bgp_suppress_fib/test_bgp_suppress_fib.py
index 5a22fbbc54..2c87d9d7b0 100644
--- a/tests/topotests/bgp_suppress_fib/test_bgp_suppress_fib.py
+++ b/tests/topotests/bgp_suppress_fib/test_bgp_suppress_fib.py
@@ -29,6 +29,7 @@ import json
import pytest
from functools import partial
from time import sleep
+from lib.topolog import logger
CWD = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(CWD, "../"))
@@ -112,6 +113,115 @@ def test_bgp_route():
assert result is None, assertmsg
+def test_bgp_better_admin_won():
+ "A better Admin distance protocol may come along and knock us out"
+
+ tgen = get_topogen()
+
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ r2 = tgen.gears["r2"]
+ r2.vtysh_cmd("conf\nip route 40.0.0.0/8 10.0.0.10")
+
+ json_file = "{}/r2/v4_override.json".format(CWD)
+ expected = json.loads(open(json_file).read())
+
+ logger.info(expected)
+ test_func = partial(
+ topotest.router_json_cmp, r2, "show ip route 40.0.0.0 json", expected
+ )
+
+ _, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ assertmsg = '"r2" static route did not take over'
+ assert result is None, assertmsg
+
+ r3 = tgen.gears["r3"]
+
+ json_file = "{}/r3/v4_override.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=10, wait=0.5)
+ assertmsg = '"r3" route to 40.0.0.0 should have been lost'
+ assert result is None, assertmsg
+
+ r2.vtysh_cmd("conf\nno ip route 40.0.0.0/8 10.0.0.10")
+
+ 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=10, wait=0.5)
+ assertmsg = '"r3" route to 40.0.0.0 did not come back'
+ assert result is None, assertmsg
+
+
+def test_bgp_allow_as_in():
+ tgen = get_topogen()
+
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ r2 = tgen.gears["r2"]
+
+ config_file = "{}/r2/bgpd.allowas_in.conf".format(CWD)
+ r2.run("vtysh -f {}".format(config_file))
+
+ json_file = "{}/r2/bgp_ipv4_allowas.json".format(CWD)
+ expected = json.loads(open(json_file).read())
+
+ test_func = partial(
+ topotest.router_json_cmp,
+ r2,
+ "show bgp ipv4 uni 192.168.1.1/32 json",
+ expected,
+ )
+ _, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ assertmsg = '"r2" static redistribution failed into bgp'
+ assert result is None, assertmsg
+
+ r1 = tgen.gears["r1"]
+
+ json_file = "{}/r1/bgp_ipv4_allowas.json".format(CWD)
+ expected = json.loads(open(json_file).read())
+
+ test_func = partial(
+ topotest.router_json_cmp,
+ r1,
+ "show bgp ipv4 uni 192.168.1.1/32 json",
+ expected,
+ )
+
+ _, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ assertmsg = '"r1" 192.168.1.1/32 route should have arrived'
+ assert result is None, assertmsg
+
+ r2.vtysh_cmd("conf\nno ip route 192.168.1.1/32 10.0.0.10")
+
+ json_file = "{}/r2/no_bgp_ipv4_allowas.json".format(CWD)
+ expected = json.loads(open(json_file).read())
+
+ test_func = partial(
+ topotest.router_json_cmp,
+ r2,
+ "show bgp ipv4 uni 192.168.1.1/32 json",
+ expected,
+ )
+
+ _, result = topotest.run_and_expect(test_func, None, count=10, wait=0.5)
+ assertmsg = '"r2" 192.168.1.1/32 route should be gone'
+ assert result is None, assertmsg
+
+
if __name__ == "__main__":
args = ["-s"] + sys.argv[1:]
sys.exit(pytest.main(args))
diff --git a/tests/topotests/bgp_tcp_mss/bgp_vrf_tcp_mss.json b/tests/topotests/bgp_tcp_mss/bgp_vrf_tcp_mss.json
new file mode 100644
index 0000000000..17cee03fa3
--- /dev/null
+++ b/tests/topotests/bgp_tcp_mss/bgp_vrf_tcp_mss.json
@@ -0,0 +1,222 @@
+{
+ "address_types": [
+ "ipv4",
+ "ipv6"
+ ],
+ "ipv4base": "20.20.20.0",
+ "ipv4mask": 24,
+ "ipv6base": "fd00::",
+ "ipv6mask": 64,
+ "link_ip_start": {
+ "ipv4": "10.10.10.0",
+ "v4mask": 24,
+ "ipv6": "fd00::",
+ "v6mask": 64
+ },
+ "lo_prefix": {
+ "ipv4": "1.0.",
+ "v4mask": 24,
+ "ipv6": "2001:db8:f::",
+ "v6mask": 128
+ },
+ "routers": {
+ "r1": {
+ "links": {
+ "r2-link1": {
+ "ipv4": "auto",
+ "ipv6": "auto",
+ "vrf": "RED"
+ }
+ },
+ "vrfs": [
+ {
+ "name": "RED",
+ "id": "1"
+ }
+ ],
+ "bgp": [
+ {
+ "local_as": "100",
+ "vrf": "RED",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r2": {
+ "dest_link": {
+ "r1-link1": {}
+ }
+ }
+ },
+ "redistribute": [
+ {
+ "redist_type": "static"
+ }
+ ]
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r2": {
+ "dest_link": {
+ "r1-link1": {}
+ }
+ }
+ },
+ "redistribute": [
+ {
+ "redist_type": "static"
+ }
+ ]
+ }
+ }
+ }
+ }
+ ]
+ },
+ "r2": {
+ "links": {
+ "r1-link1": {
+ "ipv4": "auto",
+ "ipv6": "auto",
+ "vrf": "RED"
+ },
+ "r3-link1": {
+ "ipv4": "auto",
+ "ipv6": "auto"
+ }
+ },
+ "vrfs": [
+ {
+ "name": "RED",
+ "id": "1"
+ }
+ ],
+ "bgp": [
+ {
+ "local_as": "200",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r2-link1": {}
+ }
+ }
+ },
+ "redistribute": [
+ {
+ "redist_type": "static"
+ }
+ ]
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r2-link1": {}
+ }
+ }
+ },
+ "redistribute": [
+ {
+ "redist_type": "static"
+ }
+ ]
+ }
+ }
+ }
+ },
+ {
+ "local_as": "200",
+ "vrf": "RED",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r2-link1": {}
+ }
+ }
+ },
+ "redistribute": [
+ {
+ "redist_type": "static"
+ }
+ ]
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r2-link1": {}
+ }
+ }
+ },
+ "redistribute": [
+ {
+ "redist_type": "static"
+ }
+ ]
+ }
+ }
+ }
+ }
+ ]
+ },
+ "r3": {
+ "links": {
+ "r2-link1": {
+ "ipv4": "auto",
+ "ipv6": "auto"
+ }
+ },
+ "bgp": [
+ {
+ "local_as": "300",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r2": {
+ "dest_link": {
+ "r3-link1": {}
+ }
+ }
+ },
+ "redistribute": [
+ {
+ "redist_type": "static"
+ }
+ ]
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r2": {
+ "dest_link": {
+ "r3-link1": {}
+ }
+ }
+ },
+ "redistribute": [
+ {
+ "redist_type": "static"
+ }
+ ]
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/topotests/bgp_tcp_mss/test_bgp_vrf_tcp_mss.py b/tests/topotests/bgp_tcp_mss/test_bgp_vrf_tcp_mss.py
new file mode 100644
index 0000000000..c48bd8a439
--- /dev/null
+++ b/tests/topotests/bgp_tcp_mss/test_bgp_vrf_tcp_mss.py
@@ -0,0 +1,766 @@
+#!/usr/bin/env python
+
+#
+# bgp_tcp_mss.py
+# Part of NetDEF Topology Tests
+#
+# Copyright (c) 2021 by
+# Shreenidhi A R <rshreenidhi@vmware.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.
+#
+
+"""
+bgp_tcp_mss_vrf.py:
+
+Need to verify if the tcp-mss value is reflected in the TCP session and in VRF.
+"""
+
+import os
+import sys
+import json
+import pytest
+import functools
+import platform
+import socket
+import subprocess
+
+# add after imports, before defining classes or functions:
+pytestmark = [pytest.mark.bgpd]
+
+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.topojson import build_config_from_json
+from lib.topolog import logger
+import time
+from lib.bgp import (
+ clear_bgp,
+ clear_bgp_and_verify,
+ create_router_bgp,
+ modify_as_number,
+ verify_as_numbers,
+ verify_bgp_convergence,
+ verify_bgp_rib,
+ verify_bgp_timers_and_functionality,
+ verify_router_id,
+ verify_tcp_mss
+)
+from lib.common_config import (
+ kill_router_daemons,
+ start_router_daemons,
+ addKernelRoute,
+ apply_raw_config,
+ check_address_types,
+ create_prefix_lists,
+ create_route_maps,
+ create_static_routes,
+ required_linux_kernel_version,
+ reset_config_on_routers,
+ start_topology,
+ step,
+ verify_admin_distance_for_static_routes,
+ verify_bgp_community,
+ verify_fib_routes,
+ verify_rib,
+ write_test_footer,
+ write_test_header
+)
+
+pytestmark = [pytest.mark.bgpd]
+# Global variables
+NETWORK1_1 = {"ipv4": "1.1.1.1/32", "ipv6": "1::1/128"}
+NETWORK1_2 = {"ipv4": "1.1.1.2/32", "ipv6": "1::2/128"}
+NETWORK2_1 = {"ipv4": "2.1.1.1/32", "ipv6": "2::1/128"}
+NETWORK2_2 = {"ipv4": "2.1.1.2/32", "ipv6": "2::2/128"}
+NETWORK3_1 = {"ipv4": "3.1.1.1/32", "ipv6": "3::1/128"}
+NETWORK3_2 = {"ipv4": "3.1.1.2/32", "ipv6": "3::2/128"}
+NETWORK4_1 = {"ipv4": "4.1.1.1/32", "ipv6": "4::1/128"}
+NETWORK4_2 = {"ipv4": "4.1.1.2/32", "ipv6": "4::2/128"}
+NETWORK5_1 = {"ipv4": "5.1.1.1/32", "ipv6": "5::1/128"}
+NETWORK5_2 = {"ipv4": "5.1.1.2/32", "ipv6": "5::2/128"}
+
+NEXT_HOP_IP = {"ipv4": "Null0", "ipv6": "Null0"}
+
+## File name
+TCPDUMP_FILE="test_tcp_packet_test.txt"
+
+def setup_module(mod):
+ """
+ Sets up the pytest environment
+
+ * `mod`: module name
+ """
+ global topo,TCPDUMP_FILE
+
+ # Required linux kernel version for this suite to run.
+ result = required_linux_kernel_version("4.15")
+ if result is not True:
+ pytest.skip("Kernel requirements are not met")
+
+ testsuite_run_time = time.asctime(time.localtime(time.time()))
+ step("Testsuite start time: {}".format(testsuite_run_time))
+ step("=" * 40)
+
+ step("Running setup_module to create topology")
+
+ # This function initiates the topology build with Topogen...
+ json_file = "{}/bgp_vrf_tcp_mss.json".format(CWD)
+ tgen = Topogen(json_file, mod.__name__)
+ global topo
+ topo = tgen.json_topo
+ # ... and here it calls Mininet initialization functions.
+ # Starting topology, create tmp files which are loaded to routers
+ # to start deamons and then start routers
+ start_topology(tgen)
+ # Creating configuration from JSON
+ build_config_from_json(tgen, topo)
+
+ global ADDR_TYPES
+ global BGP_CONVERGENCE
+ ADDR_TYPES = check_address_types()
+ BGP_CONVERGENCE = verify_bgp_convergence(tgen, topo)
+ assert BGP_CONVERGENCE is True, "setup_module :Failed \n Error: {}".format(
+ BGP_CONVERGENCE
+ )
+
+ step("Running setup_module() done")
+
+def teardown_module():
+ """Teardown the pytest environment"""
+
+ step("Running teardown_module to delete topology")
+
+ tgen = get_topogen()
+
+ # Stop toplogy and Remove tmp files
+ tgen.stop_topology()
+
+ step(
+ "Testsuite end time: {}".format(time.asctime(time.localtime(time.time())))
+ )
+ step("=" * 40)
+
+
+#####################################################
+#
+# Testcases
+#
+#####################################################
+
+def test_bgp_vrf_tcp_mss(request):
+ tgen = get_topogen()
+ tc_name = request.node.name
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ step("Verify the router failures")
+ if tgen.routers_have_failure():
+ check_router_status(tgen)
+
+ step("Configuring 5 static Routes in Router R3 with NULL0 as Next hop")
+ for addr_type in ADDR_TYPES:
+ static_routes_input = {
+ "r3": {
+ "static_routes": [
+ {
+ "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ },
+ {
+ "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ },
+ {
+ "network": [NETWORK3_1[addr_type]] + [NETWORK3_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ },
+ {
+ "network": [NETWORK4_1[addr_type]] + [NETWORK4_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ },
+ {
+ "network": [NETWORK5_1[addr_type]] + [NETWORK5_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ },
+ ]
+ }
+ }
+ result = create_static_routes(tgen, static_routes_input)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(
+ tc_name, result
+ )
+
+ step("Verify the static Routes in R3 on default VRF")
+ for addr_type in ADDR_TYPES:
+ static_routes_input = {
+ "r3": {
+ "static_routes": [
+ {
+ "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ },
+ {
+ "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ },
+ {
+ "network": [NETWORK3_1[addr_type]] + [NETWORK3_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ },
+ {
+ "network": [NETWORK4_1[addr_type]] + [NETWORK4_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ },
+ {
+ "network": [NETWORK5_1[addr_type]] + [NETWORK5_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ },
+ ]
+ }
+ }
+ dut = "r3"
+ result = verify_bgp_rib(tgen, addr_type, dut, static_routes_input)
+ assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result)
+
+ step("Verify the static Routes in R2 on default VRF")
+ for addr_type in ADDR_TYPES:
+ static_routes_input = {
+ "r3": {
+ "static_routes": [
+ {
+ "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ },
+ {
+ "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ },
+ {
+ "network": [NETWORK3_1[addr_type]] + [NETWORK3_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ },
+ {
+ "network": [NETWORK4_1[addr_type]] + [NETWORK4_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ },
+ {
+ "network": [NETWORK5_1[addr_type]] + [NETWORK5_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ },
+ ]
+ }
+ }
+ dut = "r2"
+ result = verify_bgp_rib(tgen, addr_type, dut, static_routes_input)
+ assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result)
+
+ step("importing default vrf on R2 under VRF RED Address Family")
+ for addr_type in ADDR_TYPES:
+ input_import_vrf = {
+ "r2": {
+ "bgp": [
+ {
+ "local_as": 200,
+ "vrf": "RED",
+ "address_family": {
+ addr_type: {"unicast": {"import": {"vrf": "default"}}}
+ },
+ }
+ ]
+ }
+ }
+ result = create_router_bgp(tgen, topo, input_import_vrf)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(
+ tc_name, result
+ )
+
+ step("Verify the static Routes in R2 on RED VRF")
+ for addr_type in ADDR_TYPES:
+ static_routes_input = {
+ "r3": {
+ "static_routes": [
+ {
+ "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ "vrf": "RED",
+ },
+ {
+ "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ "vrf": "RED",
+ },
+ {
+ "network": [NETWORK3_1[addr_type]] + [NETWORK3_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ "vrf": "RED",
+ },
+ {
+ "network": [NETWORK4_1[addr_type]] + [NETWORK4_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ "vrf": "RED",
+ },
+ {
+ "network": [NETWORK5_1[addr_type]] + [NETWORK5_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ "vrf": "RED",
+ },
+ ]
+ }
+ }
+ dut = "r2"
+ result = verify_bgp_rib(tgen, addr_type, dut, static_routes_input)
+ assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result)
+
+ step("Verify the static Routes in R1 on RED VRF")
+ for addr_type in ADDR_TYPES:
+ static_routes_input = {
+ "r3": {
+ "static_routes": [
+ {
+ "network": [NETWORK1_1[addr_type]] + [NETWORK1_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ "vrf": "RED",
+ },
+ {
+ "network": [NETWORK2_1[addr_type]] + [NETWORK2_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ "vrf": "RED",
+ },
+ {
+ "network": [NETWORK3_1[addr_type]] + [NETWORK3_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ "vrf": "RED",
+ },
+ {
+ "network": [NETWORK4_1[addr_type]] + [NETWORK4_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ "vrf": "RED",
+ },
+ {
+ "network": [NETWORK5_1[addr_type]] + [NETWORK5_2[addr_type]],
+ "next_hop": NEXT_HOP_IP[addr_type],
+ "vrf": "RED",
+ },
+ ]
+ }
+ }
+ dut = "r1"
+ result = verify_bgp_rib(tgen, addr_type, dut, static_routes_input)
+ assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result)
+
+ step("Enabling tcp-mss 150 on Router R1 in VRF RED")
+ TCP_MSS = 150
+ raw_config = {
+ "r1": {
+ "raw_config": [
+ "router bgp {} vrf {}".format(
+ topo["routers"]["r1"]["bgp"][0]["local_as"],
+ topo["routers"]["r1"]["bgp"][0]["vrf"],
+ ),
+ "neighbor {} tcp-mss {}".format(
+ topo["routers"]["r2"]["links"]["r1-link1"]["ipv4"].split("/")[0],
+ TCP_MSS,
+ ),
+ "neighbor {} tcp-mss {}".format(
+ topo["routers"]["r2"]["links"]["r1-link1"]["ipv6"].split("/")[0],
+ TCP_MSS,
+ ),
+ ]
+ },
+ }
+
+ result = apply_raw_config(tgen, raw_config)
+ assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
+
+ step("Clearing BGP on R1 and R2 ")
+ for addr_type in ADDR_TYPES:
+ clear_bgp(tgen, addr_type, "r1", vrf=topo["routers"]["r1"]["bgp"][0]["vrf"])
+ clear_bgp(tgen, addr_type, "r2", vrf=topo["routers"]["r2"]["bgp"][1]["vrf"])
+
+ step("Verify the BGP Convergence at R1 & R2 after Clear BGP")
+ r1_convergence = verify_bgp_convergence(tgen, topo, dut="r1")
+ assert (
+ r1_convergence is True
+ ), "BGP convergence after Clear BGP :Failed \n Error: {}".format(r1_convergence)
+ r2_convergence = verify_bgp_convergence(tgen, topo, dut="r2")
+ assert (
+ r2_convergence is True
+ ), "BGP convergence after Clear BGP :Failed \n Error: {}".format(r2_convergence)
+
+ step("Verify the TCP-MSS value on both Router R1 and R2")
+ for addr_type in ADDR_TYPES:
+ dut = "r1"
+ tcp_mss_result = verify_tcp_mss(
+ tgen,
+ dut,
+ topo["routers"]["r2"]["links"]["r1-link1"][addr_type].split("/")[0],
+ TCP_MSS,
+ "RED",
+ )
+ assert tcp_mss_result is True, " TCP-MSS mismatch :Failed \n Error: {}".format(
+ tcp_mss_result
+ )
+
+
+
+
+ step("Enabling tcp-mss 500 between R2 and R3 of VRF Default")
+ TCP_MSS = 500
+ raw_config = {
+ "r2": {
+ "raw_config": [
+ "router bgp {} ".format(topo["routers"]["r2"]["bgp"][0]["local_as"]),
+ "neighbor {} tcp-mss {}".format(
+ topo["routers"]["r3"]["links"]["r2-link1"]["ipv4"].split("/")[0],
+ TCP_MSS,
+ ),
+ "neighbor {} tcp-mss {}".format(
+ topo["routers"]["r3"]["links"]["r2-link1"]["ipv6"].split("/")[0],
+ TCP_MSS,
+ ),
+ ]
+ },
+ "r3": {
+ "raw_config": [
+ "router bgp {} ".format(topo["routers"]["r3"]["bgp"][0]["local_as"]),
+ "neighbor {} tcp-mss {}".format(
+ topo["routers"]["r2"]["links"]["r3-link1"]["ipv4"].split("/")[0],
+ TCP_MSS,
+ ),
+ "neighbor {} tcp-mss {}".format(
+ topo["routers"]["r2"]["links"]["r3-link1"]["ipv6"].split("/")[0],
+ TCP_MSS,
+ ),
+ ]
+ },
+ }
+ result = apply_raw_config(tgen, raw_config)
+ assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
+
+
+
+ step("Clear BGP at router R2 and R3")
+ for addr_type in ADDR_TYPES:
+ clear_bgp(tgen, topo, "r2", addr_type)
+ clear_bgp(tgen, topo, "r3", addr_type)
+
+ step("Verify the BGP Convergence at R2 & R3 after Clear BGP")
+ r1_convergence = verify_bgp_convergence(tgen, topo, dut="r2")
+ assert (
+ r1_convergence is True
+ ), "BGP convergence after Clear BGP :Failed \n Error: {}".format(r2_convergence)
+ r2_convergence = verify_bgp_convergence(tgen, topo, dut="r3")
+ assert (
+ r2_convergence is True
+ ), "BGP convergence after Clear BGP :Failed \n Error: {}".format(r2_convergence)
+
+ step("Verify the TCP-MSS value on both Router R2 and R3")
+ for addr_type in ADDR_TYPES:
+ dut = "r2"
+ tcp_mss_result = verify_tcp_mss(
+ tgen,
+ dut,
+ topo["routers"]["r3"]["links"]["r2-link1"]["ipv4"].split("/")[0],
+ TCP_MSS,
+ )
+ assert tcp_mss_result is True, " TCP-MSS mismatch :Failed \n Error: {}".format(
+ tcp_mss_result
+ )
+
+ dut = "r3"
+ tcp_mss_result = verify_tcp_mss(
+ tgen,
+ dut,
+ topo["routers"]["r2"]["links"]["r3-link1"]["ipv4"].split("/")[0],
+ TCP_MSS,
+ )
+ assert tcp_mss_result is True, " TCP-MSS mismatch :Failed \n Error: {}".format(
+ tcp_mss_result
+ )
+
+ step("Removing tcp-mss 150 between R1 and R2 of VRF RED ")
+ TCP_MSS = 150
+ raw_config = {
+ "r1": {
+ "raw_config": [
+ "router bgp {} vrf {}".format(
+ topo["routers"]["r1"]["bgp"][0]["local_as"],
+ topo["routers"]["r1"]["bgp"][0]["vrf"],
+ ),
+ "no neighbor {} tcp-mss {}".format(
+ topo["routers"]["r2"]["links"]["r1-link1"]["ipv4"].split("/")[0],
+ TCP_MSS,
+ ),
+ "no neighbor {} tcp-mss {}".format(
+ topo["routers"]["r2"]["links"]["r1-link1"]["ipv6"].split("/")[0],
+ TCP_MSS,
+ ),
+ ]
+ }
+ }
+ result = apply_raw_config(tgen, raw_config)
+ assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
+ raw_config = {
+ "r2": {
+ "raw_config": [
+ "router bgp {} vrf {}".format(
+ topo["routers"]["r2"]["bgp"][0]["local_as"],
+ topo["routers"]["r2"]["bgp"][1]["vrf"],
+ ),
+ "no neighbor {} tcp-mss {}".format(
+ topo["routers"]["r1"]["links"]["r2-link1"]["ipv4"].split("/")[0],
+ TCP_MSS,
+ ),
+ "no neighbor {} tcp-mss {}".format(
+ topo["routers"]["r1"]["links"]["r2-link1"]["ipv6"].split("/")[0],
+ TCP_MSS,
+ ),
+ ]
+ }
+ }
+ result = apply_raw_config(tgen, raw_config)
+ assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
+
+ step("Verify the TCP-MSS value cleared on both Router R1 and R2")
+ for addr_type in ADDR_TYPES:
+ dut = "r1"
+ tcp_mss_result = verify_tcp_mss(
+ tgen,
+ dut,
+ topo["routers"]["r2"]["links"]["r1-link1"][addr_type].split("/")[0],
+ TCP_MSS,
+ "RED",
+ )
+ assert (
+ tcp_mss_result is not True
+ ), " TCP-MSS mismatch :Failed \n Error: {}".format(tcp_mss_result)
+
+ dut = "r2"
+ tcp_mss_result = verify_tcp_mss(
+ tgen,
+ dut,
+ topo["routers"]["r1"]["links"]["r2-link1"]["ipv4"].split("/")[0],
+ TCP_MSS,
+ "RED",
+ )
+ assert (
+ tcp_mss_result is not True
+ ), " TCP-MSS mismatch :Failed \n Error: {}".format(tcp_mss_result)
+
+
+ step("Removing tcp-mss 500 between R2 and R3 of VRF Default ")
+ TCP_MSS = 500
+ raw_config = {
+ "r2": {
+ "raw_config": [
+ "router bgp {} ".format(topo["routers"]["r2"]["bgp"][0]["local_as"]),
+ "no neighbor {} tcp-mss {}".format(
+ topo["routers"]["r3"]["links"]["r2-link1"]["ipv4"].split("/")[0],
+ TCP_MSS,
+ ),
+ "no neighbor {} tcp-mss {}".format(
+ topo["routers"]["r3"]["links"]["r2-link1"]["ipv6"].split("/")[0],
+ TCP_MSS,
+ ),
+ ]
+ }
+ }
+ result = apply_raw_config(tgen, raw_config)
+ assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
+
+ raw_config = {
+ "r3": {
+ "raw_config": [
+ "router bgp {} ".format(topo["routers"]["r3"]["bgp"][0]["local_as"]),
+ "no neighbor {} tcp-mss {}".format(
+ topo["routers"]["r2"]["links"]["r3-link1"]["ipv4"].split("/")[0],
+ TCP_MSS,
+ ),
+ "no neighbor {} tcp-mss {}".format(
+ topo["routers"]["r2"]["links"]["r3-link1"]["ipv6"].split("/")[0],
+ TCP_MSS,
+ ),
+ ]
+ }
+ }
+ result = apply_raw_config(tgen, raw_config)
+ assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
+
+ step("Verify the TCP-MSS value got cleared on both Router R2 and R3")
+ for addr_type in ADDR_TYPES:
+ dut = "r2"
+ tcp_mss_result = verify_tcp_mss(
+ tgen,
+ dut,
+ topo["routers"]["r3"]["links"]["r2-link1"]["ipv4"].split("/")[0],
+ TCP_MSS,
+ )
+ assert (
+ tcp_mss_result is not True
+ ), " TCP-MSS mismatch :Failed \n Error: {}".format(tcp_mss_result)
+
+ dut = "r3"
+ tcp_mss_result = verify_tcp_mss(
+ tgen,
+ dut,
+ topo["routers"]["r2"]["links"]["r3-link1"]["ipv4"].split("/")[0],
+ TCP_MSS,
+ )
+ assert (
+ tcp_mss_result is not True
+ ), " TCP-MSS mismatch :Failed \n Error: {}".format(tcp_mss_result)
+
+ step("Configuring different TCP-MSS R2 and R3 ")
+ TCP_MSS = 500
+ raw_config = {
+ "r2": {
+ "raw_config": [
+ "router bgp {}".format(topo["routers"]["r2"]["bgp"][0]["local_as"]),
+ "neighbor {} tcp-mss {}".format(
+ topo["routers"]["r3"]["links"]["r2-link1"]["ipv4"].split("/")[0],
+ TCP_MSS,
+ ),
+ "neighbor {} tcp-mss {}".format(
+ topo["routers"]["r3"]["links"]["r2-link1"]["ipv6"].split("/")[0],
+ TCP_MSS,
+ ),
+ ]
+ }
+ }
+ result = apply_raw_config(tgen, raw_config)
+ assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
+ TCP_MSS = 300
+ raw_config = {
+ "r3": {
+ "raw_config": [
+ "router bgp {} ".format(topo["routers"]["r3"]["bgp"][0]["local_as"]),
+ "neighbor {} tcp-mss {}".format(
+ topo["routers"]["r2"]["links"]["r3-link1"]["ipv4"].split("/")[0],
+ TCP_MSS,
+ ),
+ "neighbor {} tcp-mss {}".format(
+ topo["routers"]["r2"]["links"]["r3-link1"]["ipv6"].split("/")[0],
+ TCP_MSS,
+ ),
+ ]
+ }
+ }
+ result = apply_raw_config(tgen, raw_config)
+ assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
+
+ step("Verify the TCP-MSS value on both Router R2 and R3")
+ for addr_type in ADDR_TYPES:
+ TCP_MSS = 500
+ dut = "r2"
+ tcp_mss_result = verify_tcp_mss(
+ tgen,
+ dut,
+ topo["routers"]["r3"]["links"]["r2-link1"]["ipv4"].split("/")[0],
+ TCP_MSS,
+ )
+ assert tcp_mss_result is True, " TCP-MSS mismatch :Failed \n Error: {}".format(
+ tcp_mss_result
+ )
+
+ TCP_MSS = 300
+ dut = "r3"
+ tcp_mss_result = verify_tcp_mss(
+ tgen,
+ dut,
+ topo["routers"]["r2"]["links"]["r3-link1"]["ipv4"].split("/")[0],
+ TCP_MSS,
+ )
+ assert tcp_mss_result is True, " TCP-MSS mismatch :Failed \n Error: {}".format(
+ tcp_mss_result
+ )
+
+ step("Configure TCP_MSS > MTU on R2 and R3 and it should be 1460 ")
+ TCP_MSS = 4096
+ REF_TCP_MSS = 1460
+ raw_config = {
+ "r2": {
+ "raw_config": [
+ "router bgp {} ".format(topo["routers"]["r2"]["bgp"][0]["local_as"]),
+ "neighbor {} tcp-mss {}".format(
+ topo["routers"]["r3"]["links"]["r2-link1"]["ipv4"].split("/")[0],
+ TCP_MSS,
+ ),
+ "neighbor {} tcp-mss {}".format(
+ topo["routers"]["r3"]["links"]["r2-link1"]["ipv6"].split("/")[0],
+ TCP_MSS,
+ ),
+ ]
+ }
+ }
+ result = apply_raw_config(tgen, raw_config)
+ assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
+ raw_config = {
+ "r3": {
+ "raw_config": [
+ "router bgp {} ".format(topo["routers"]["r3"]["bgp"][0]["local_as"]),
+ "neighbor {} tcp-mss {}".format(
+ topo["routers"]["r2"]["links"]["r3-link1"]["ipv4"].split("/")[0],
+ TCP_MSS,
+ ),
+ "neighbor {} tcp-mss {}".format(
+ topo["routers"]["r2"]["links"]["r3-link1"]["ipv6"].split("/")[0],
+ TCP_MSS,
+ ),
+ ]
+ }
+ }
+ result = apply_raw_config(tgen, raw_config)
+ assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
+
+ step("Restarting BGP Daemon on R3")
+
+ kill_router_daemons(tgen, "r3", ["bgpd"])
+ start_router_daemons(tgen, "r3", ["bgpd"])
+
+ step(
+ "Verify the configured TCP-MSS 4096 value on restarting both Daemon both Router R2 and R3 "
+ )
+ for addr_type in ADDR_TYPES:
+ TCP_MSS = 4096
+ dut = "r2"
+ tcp_mss_result = verify_tcp_mss(
+ tgen,
+ dut,
+ topo["routers"]["r3"]["links"]["r2-link1"]["ipv4"].split("/")[0],
+ TCP_MSS,
+ )
+ assert tcp_mss_result is True, " TCP-MSS mismatch :Failed \n Error: {}".format(
+ tcp_mss_result
+ )
+ dut = "r3"
+ tcp_mss_result = verify_tcp_mss(
+ tgen,
+ dut,
+ topo["routers"]["r2"]["links"]["r3-link1"]["ipv4"].split("/")[0],
+ TCP_MSS,
+ )
+ assert tcp_mss_result is True, " TCP-MSS mismatch :Failed \n Error: {}".format(
+ tcp_mss_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_vrf_lite_best_path_test/bgp_vrf_lite_best_path_topo1.json b/tests/topotests/bgp_vrf_lite_best_path_test/bgp_vrf_lite_best_path_topo1.json
new file mode 100644
index 0000000000..b1d7d09db8
--- /dev/null
+++ b/tests/topotests/bgp_vrf_lite_best_path_test/bgp_vrf_lite_best_path_topo1.json
@@ -0,0 +1,563 @@
+{
+ "address_types": ["ipv4","ipv6"],
+ "ipv4base": "10.0.0.0",
+ "ipv4mask": 30,
+ "ipv6base": "fd00::",
+ "ipv6mask": 64,
+ "link_ip_start": {
+ "ipv4": "10.0.0.0",
+ "v4mask": 30,
+ "ipv6": "fd00::",
+ "v6mask": 64
+ },
+ "lo_prefix": {
+ "ipv4": "1.0.",
+ "v4mask": 32,
+ "ipv6": "2001:db8:f::",
+ "v6mask": 128
+ },
+ "routers": {
+ "r1": {
+ "links": {
+ "r2-link1": {"ipv4": "auto", "ipv6": "auto", "vrf": "ISR"},
+ "r3-link1": {"ipv4": "auto", "ipv6": "auto"},
+ "r4-link1": {"ipv4": "auto", "ipv6": "auto"}
+ },
+ "vrfs":[
+ {
+ "name": "ISR",
+ "id": "1"
+ }
+ ],
+ "bgp":
+ [
+ {
+ "local_as": "100",
+ "vrf": "ISR",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r2": {
+ "dest_link": {
+ "r1-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "next_hop_self": true
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r2": {
+ "dest_link": {
+ "r1-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "next_hop_self": true,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "local_as": "100",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r1-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r1-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "local_as": "100",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r4": {
+ "dest_link": {
+ "r1-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r4": {
+ "dest_link": {
+ "r1-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ],
+ "static_routes":[
+ {
+ "network": ["11.11.11.1/32", "11.11.11.11/32"],
+ "next_hop":"Null0",
+ "vrf": "ISR"
+ },
+ {
+ "network": ["11:11::1/128", "11:11::11/128"],
+ "next_hop":"Null0",
+ "vrf": "ISR"
+ },
+ {
+ "network": ["10.10.10.10/32", "10.10.10.100/32"],
+ "next_hop":"Null0"
+ },
+ {
+ "network": ["10:10::10/128", "10:10::100/128"],
+ "next_hop":"Null0"
+ }
+ ],
+ "route_maps": {
+ "rmap_global": [{
+ "action": "permit",
+ "set": {
+ "ipv6": {
+ "nexthop": "prefer-global"
+ }
+ }
+ }]
+ }
+ },
+ "r2": {
+ "links": {
+ "r1-link1": {"ipv4": "auto", "ipv6": "auto", "vrf": "ISR"},
+ "r3-link1": {"ipv4": "auto", "ipv6": "auto"},
+ "r4-link1": {"ipv4": "auto", "ipv6": "auto"}
+ },
+ "vrfs":[
+ {
+ "name": "ISR",
+ "id": "1"
+ }
+ ],
+ "bgp":
+ [
+ {
+ "local_as": "100",
+ "vrf": "ISR",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r2-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "next_hop_self": true
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r2-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "next_hop_self": true,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "local_as": "100",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r2-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r2-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "local_as": "100",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r4": {
+ "dest_link": {
+ "r2-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r4": {
+ "dest_link": {
+ "r2-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ],
+ "static_routes":[
+ {
+ "network": ["22.22.22.2/32", "22.22.22.22/32"],
+ "next_hop":"Null0",
+ "vrf": "ISR"
+ },
+ {
+ "network": ["22:22::2/128", "22:22::22/128"],
+ "next_hop":"Null0",
+ "vrf": "ISR"
+ },
+ {
+ "network": ["20.20.20.20/32", "20.20.20.200/32"],
+ "next_hop":"Null0"
+ },
+ {
+ "network": ["20:20::20/128", "20:20::200/128"],
+ "next_hop":"Null0"
+ }
+ ],
+ "route_maps": {
+ "rmap_global": [{
+ "action": "permit",
+ "set": {
+ "ipv6": {
+ "nexthop": "prefer-global"
+ }
+ }
+ }]
+ }
+ },
+ "r3": {
+ "links": {
+ "r1-link1": {"ipv4": "auto", "ipv6": "auto"},
+ "r2-link1": {"ipv4": "auto", "ipv6": "auto"}
+ },
+ "bgp":
+ [
+ {
+ "local_as": "300",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r3-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r3-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "local_as": "300",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r2": {
+ "dest_link": {
+ "r3-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r2": {
+ "dest_link": {
+ "r3-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ],
+ "static_routes":[
+ {
+ "network": ["30.30.30.3/32", "30.30.30.30/32"],
+ "next_hop":"Null0"
+ },
+ {
+ "network": ["30:30::3/128", "30:30::30/128"],
+ "next_hop":"Null0"
+ },
+ {
+ "network": ["50.50.50.5/32", "50.50.50.50/32"],
+ "next_hop":"Null0"
+ },
+ {
+ "network": ["50:50::5/128", "50:50::50/128"],
+ "next_hop":"Null0"
+ }
+ ],
+ "route_maps": {
+ "rmap_global": [{
+ "action": "permit",
+ "set": {
+ "ipv6": {
+ "nexthop": "prefer-global"
+ }
+ }
+ }]
+ }
+ },
+ "r4": {
+ "links": {
+ "r1-link1": {"ipv4": "auto", "ipv6": "auto"},
+ "r2-link1": {"ipv4": "auto", "ipv6": "auto"}
+ },
+ "bgp":
+ [
+ {
+ "local_as": "400",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r4-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r4-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "local_as": "400",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r2": {
+ "dest_link": {
+ "r4-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r2": {
+ "dest_link": {
+ "r4-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ],
+ "static_routes":[
+ {
+ "network": ["40.40.40.4/32", "40.40.40.40/32"],
+ "next_hop":"Null0"
+ },
+ {
+ "network": ["40:40::4/128", "40:40::40/128"],
+ "next_hop":"Null0"
+ },
+ {
+ "network": ["50.50.50.5/32", "50.50.50.50/32"],
+ "next_hop":"Null0"
+ },
+ {
+ "network": ["50:50::5/128", "50:50::50/128"],
+ "next_hop":"Null0"
+ }
+ ],
+ "route_maps": {
+ "rmap_global": [{
+ "action": "permit",
+ "set": {
+ "ipv6": {
+ "nexthop": "prefer-global"
+ }
+ }
+ }]
+ }
+ }
+ }
+}
diff --git a/tests/topotests/bgp_vrf_lite_best_path_test/bgp_vrf_lite_best_path_topo2.json b/tests/topotests/bgp_vrf_lite_best_path_test/bgp_vrf_lite_best_path_topo2.json
new file mode 100644
index 0000000000..0b13882176
--- /dev/null
+++ b/tests/topotests/bgp_vrf_lite_best_path_test/bgp_vrf_lite_best_path_topo2.json
@@ -0,0 +1,1088 @@
+{
+ "address_types": ["ipv4","ipv6"],
+ "ipv4base": "10.0.0.0",
+ "ipv4mask": 24,
+ "ipv6base": "fd00::",
+ "ipv6mask": 64,
+ "link_ip_start": {
+ "ipv4": "10.0.0.0",
+ "v4mask": 24,
+ "ipv6": "fd00::",
+ "v6mask": 64
+ },
+ "lo_prefix": {
+ "ipv4": "1.0.",
+ "v4mask": 32,
+ "ipv6": "2001:db8:f::",
+ "v6mask": 128
+ },
+ "routers": {
+ "r1": {
+ "links": {
+ "r3-link1": {"ipv4": "192.168.1.1/24", "ipv6": "fd00:0:0:1::1/120", "vrf": "RED"},
+ "r3-link2": {"ipv4": "auto", "ipv6": "auto", "vrf": "BLUE"},
+ "r3-link3": {"ipv4": "192.168.1.1/24", "ipv6": "fd00:0:0:1::1/120", "vrf": "GREEN"},
+ "r3-link4": {"ipv4": "auto", "ipv6": "auto"}
+ },
+ "vrfs":[
+ {"name": "RED", "id": "1"},
+ {"name": "BLUE", "id": "2"},
+ {"name": "GREEN", "id": "3"}
+ ],
+ "bgp":
+ [
+ {
+ "local_as": "1",
+ "vrf": "RED",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r1-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r1-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "local_as": "1",
+ "vrf": "BLUE",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r1-link2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r1-link2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "local_as": "1",
+ "vrf": "GREEN",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r1-link3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r1-link3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "local_as": "1",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r1-link4": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r1-link4": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ],
+ "route_maps": {
+ "rmap_global": [{
+ "action": "permit",
+ "set": {
+ "ipv6": {
+ "nexthop": "prefer-global"
+ }
+ }
+ }]
+ }
+ },
+ "r2": {
+ "links": {
+ "r3-link1": {"ipv4": "auto", "ipv6": "auto", "vrf": "RED"},
+ "r3-link2": {"ipv4": "auto", "ipv6": "auto", "vrf": "BLUE"},
+ "r3-link3": {"ipv4": "auto", "ipv6": "auto", "vrf": "GREEN"},
+ "r3-link4": {"ipv4": "auto", "ipv6": "auto"}
+ },
+ "vrfs":[
+ {"name": "RED", "id": "1"},
+ {"name": "BLUE", "id": "2"},
+ {"name": "GREEN", "id": "3"}
+ ],
+ "bgp":
+ [
+ {
+ "local_as": "2",
+ "vrf": "RED",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r2-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r2-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "local_as": "2",
+ "vrf": "BLUE",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r2-link2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r2-link2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "local_as": "2",
+ "vrf": "GREEN",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r2-link3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r2-link3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "local_as": "2",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r2-link4": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r2-link4": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ],
+ "route_maps": {
+ "rmap_global": [{
+ "action": "permit",
+ "set": {
+ "ipv6": {
+ "nexthop": "prefer-global"
+ }
+ }
+ }]
+ }
+ },
+ "r3": {
+ "links": {
+ "r1-link1": {"ipv4": "192.168.1.2/24", "ipv6": "fd00:0:0:1::2/120", "vrf": "RED"},
+ "r1-link2": {"ipv4": "auto", "ipv6": "auto", "vrf": "BLUE"},
+ "r1-link3": {"ipv4": "192.168.1.2/24", "ipv6": "fd00:0:0:1::2/120", "vrf": "GREEN"},
+ "r1-link4": {"ipv4": "auto", "ipv6": "auto"},
+ "r2-link1": {"ipv4": "auto", "ipv6": "auto", "vrf": "RED"},
+ "r2-link2": {"ipv4": "auto", "ipv6": "auto", "vrf": "BLUE"},
+ "r2-link3": {"ipv4": "auto", "ipv6": "auto", "vrf": "GREEN"},
+ "r2-link4": {"ipv4": "auto", "ipv6": "auto"},
+ "r4-link1": {"ipv4": "auto", "ipv6": "auto", "vrf": "RED"},
+ "r4-link2": {"ipv4": "auto", "ipv6": "auto", "vrf": "BLUE"},
+ "r4-link3": {"ipv4": "auto", "ipv6": "auto", "vrf": "GREEN"},
+ "r4-link4": {"ipv4": "auto", "ipv6": "auto"},
+ "r5-link1": {"ipv4": "auto", "ipv6": "auto", "vrf": "RED"},
+ "r5-link2": {"ipv4": "auto", "ipv6": "auto", "vrf": "BLUE"},
+ "r5-link3": {"ipv4": "auto", "ipv6": "auto", "vrf": "GREEN"},
+ "r5-link4": {"ipv4": "auto", "ipv6": "auto"}
+ },
+ "vrfs":[
+ {"name": "RED", "id": "1"},
+ {"name": "BLUE", "id": "2"},
+ {"name": "GREEN", "id": "3"}
+ ],
+ "bgp":
+ [
+ {
+ "local_as": "3",
+ "vrf": "RED",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r3-link1": {}
+ }
+ },
+ "r2": {
+ "dest_link": {
+ "r3-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ },
+ "r4": {
+ "dest_link": {
+ "r3-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ },
+ "r5": {
+ "dest_link": {
+ "r3-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r3-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ },
+ "r2": {
+ "dest_link": {
+ "r3-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ },
+ "r4": {
+ "dest_link": {
+ "r3-link1": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ },
+ "r5": {
+ "dest_link": {
+ "r3-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "local_as": "3",
+ "vrf": "BLUE",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r3-link2": {}
+ }
+ },
+ "r2": {
+ "dest_link": {
+ "r3-link2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ },
+ "r4": {
+ "dest_link": {
+ "r3-link2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ },
+ "r5": {
+ "dest_link": {
+ "r3-link2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r3-link2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ },
+ "r2": {
+ "dest_link": {
+ "r3-link2": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ },
+ "r4": {
+ "dest_link": {
+ "r3-link2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ },
+ "r5": {
+ "dest_link": {
+ "r3-link2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "local_as": "3",
+ "vrf": "GREEN",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r3-link3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ },
+ "r2": {
+ "dest_link": {
+ "r3-link3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ },
+ "r4": {
+ "dest_link": {
+ "r3-link3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ },
+ "r5": {
+ "dest_link": {
+ "r3-link3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r3-link3": {
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ },
+ "r2": {
+ "dest_link": {
+ "r3-link3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ },
+ "r4": {
+ "dest_link": {
+ "r3-link3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ },
+ "r5": {
+ "dest_link": {
+ "r3-link3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "local_as": "3",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r3-link4": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ },
+ "r2": {
+ "dest_link": {
+ "r3-link4": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ },
+ "r4": {
+ "dest_link": {
+ "r3-link4": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ },
+ "r5": {
+ "dest_link": {
+ "r3-link4": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r3-link4": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ },
+ "r2": {
+ "dest_link": {
+ "r3-link4": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ },
+ "r4": {
+ "dest_link": {
+ "r3-link4": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ },
+ "r5": {
+ "dest_link": {
+ "r3-link4": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3,
+ "route_maps": [{
+ "name": "rmap_global",
+ "direction": "in"
+ }]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ],
+ "route_maps": {
+ "rmap_global": [{
+ "action": "permit",
+ "set": {
+ "ipv6": {
+ "nexthop": "prefer-global"
+ }
+ }
+ }]
+ }
+ },
+ "r4": {
+ "links": {
+ "r3-link1": {"ipv4": "auto", "ipv6": "auto", "vrf": "RED"},
+ "r3-link2": {"ipv4": "auto", "ipv6": "auto", "vrf": "BLUE"},
+ "r3-link3": {"ipv4": "auto", "ipv6": "auto", "vrf": "GREEN"},
+ "r3-link4": {"ipv4": "auto", "ipv6": "auto"}
+ },
+ "vrfs":[
+ {"name": "RED", "id": "1"},
+ {"name": "BLUE", "id": "2"},
+ {"name": "GREEN", "id": "3"}
+ ],
+ "bgp":
+ [
+ {
+ "local_as": "4",
+ "vrf": "RED",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r4-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r4-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "local_as": "4",
+ "vrf": "BLUE",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r4-link2": {}
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r4-link2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "local_as": "4",
+ "vrf": "GREEN",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r4-link3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r4-link3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "local_as": "4",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r4-link4": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r4-link4": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ]
+ },
+ "r5": {
+ "links": {
+ "r3-link1": {"ipv4": "auto", "ipv6": "auto", "vrf": "RED"},
+ "r3-link2": {"ipv4": "auto", "ipv6": "auto", "vrf": "BLUE"},
+ "r3-link3": {"ipv4": "auto", "ipv6": "auto", "vrf": "GREEN"},
+ "r3-link4": {"ipv4": "auto", "ipv6": "auto"}
+ },
+ "vrfs":[
+ {"name": "RED", "id": "1"},
+ {"name": "BLUE", "id": "2"},
+ {"name": "GREEN", "id": "3"}
+ ],
+ "bgp":
+ [
+ {
+ "local_as": "3",
+ "vrf": "RED",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r5-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r5-link1": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "local_as": "3",
+ "vrf": "BLUE",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r5-link2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r5-link2": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "local_as": "3",
+ "vrf": "GREEN",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r5-link3": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r5-link3": {}
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ {
+ "local_as": "3",
+ "address_family": {
+ "ipv4": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r5-link4": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ },
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r5-link4": {
+ "keepalivetimer": 1,
+ "holddowntimer": 3
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+}
diff --git a/tests/topotests/bgp_vrf_lite_best_path_test/test_bgp_vrf_lite_best_path_topo1.py b/tests/topotests/bgp_vrf_lite_best_path_test/test_bgp_vrf_lite_best_path_topo1.py
new file mode 100644
index 0000000000..d9d4f4f8b2
--- /dev/null
+++ b/tests/topotests/bgp_vrf_lite_best_path_test/test_bgp_vrf_lite_best_path_topo1.py
@@ -0,0 +1,916 @@
+#!/usr/bin/env python
+
+#
+# Copyright (c) 2020 by VMware, Inc. ("VMware")
+# Used Copyright (c) 2018 by Network Device Education Foundation,
+# Inc. ("NetDEF") in this file.
+#
+# Permission to use, copy, modify, and/or distribute this software
+# for any purpose with or without fee is hereby granted, provided
+# that the above copyright notice and this permission notice appear
+# in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND VMWARE DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VMWARE BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+#
+
+"""
+Following tests are covered to test BGP VRF Lite:
+
+1. Verify BGP best path selection algorithm works fine when
+routes are imported from ISR to default vrf and vice versa.
+"""
+
+import os
+import sys
+import time
+import pytest
+import platform
+
+# Save the Current Working Directory to find configuration files.
+CWD = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join(CWD, "../"))
+sys.path.append(os.path.join(CWD, "../lib/"))
+
+# Required to instantiate the topology builder class.
+
+# pylint: disable=C0413
+# Import topogen and topotest helpers
+from lib.topogen import Topogen, get_topogen
+from lib.topotest import version_cmp
+
+from lib.common_config import (
+ start_topology,
+ write_test_header,
+ check_address_types,
+ write_test_footer,
+ step,
+ create_route_maps,
+ create_prefix_lists,
+ check_router_status,
+ get_frr_ipv6_linklocal,
+ shutdown_bringup_interface,
+)
+
+from lib.topolog import logger
+from lib.bgp import (
+ verify_bgp_convergence,
+ create_router_bgp,
+ verify_bgp_community,
+ verify_bgp_rib,
+ clear_bgp,
+ verify_best_path_as_per_bgp_attribute
+)
+from lib.topojson import build_config_from_json
+
+
+pytestmark = [pytest.mark.bgpd, pytest.mark.staticd]
+
+# Global variables
+NETWORK1_1 = {"ipv4": "11.11.11.1/32", "ipv6": "11:11::1/128"}
+NETWORK1_2 = {"ipv4": "11.11.11.11/32", "ipv6": "11:11::11/128"}
+NETWORK1_3 = {"ipv4": "10.10.10.10/32", "ipv6": "10:10::10/128"}
+NETWORK1_4 = {"ipv4": "10.10.10.100/32", "ipv6": "10:10::100/128"}
+
+NETWORK2_1 = {"ipv4": "22.22.22.2/32", "ipv6": "22:22::2/128"}
+NETWORK2_2 = {"ipv4": "22.22.22.22/32", "ipv6": "22:22::22/128"}
+NETWORK2_3 = {"ipv4": "20.20.20.20/32", "ipv6": "20:20::20/128"}
+NETWORK2_4 = {"ipv4": "20.20.20.200/32", "ipv6": "20:20::200/128"}
+
+NETWORK3_1 = {"ipv4": "30.30.30.3/32", "ipv6": "30:30::3/128"}
+NETWORK3_2 = {"ipv4": "30.30.30.30/32", "ipv6": "30:30::30/128"}
+NETWORK3_3 = {"ipv4": "50.50.50.5/32", "ipv6": "50:50::5/128"}
+NETWORK3_4 = {"ipv4": "50.50.50.50/32", "ipv6": "50:50::50/128"}
+
+NETWORK4_1 = {"ipv4": "40.40.40.4/32", "ipv6": "40:40::4/128"}
+NETWORK4_2 = {"ipv4": "40.40.40.40/32", "ipv6": "40:40::40/128"}
+NETWORK4_3 = {"ipv4": "50.50.50.5/32", "ipv6": "50:50::5/128"}
+NETWORK4_4 = {"ipv4": "50.50.50.50/32", "ipv6": "50:50::50/128"}
+NEXT_HOP_IP = {"ipv4": "Null0", "ipv6": "Null0"}
+LOOPBACK_1 = {
+ "ipv4": "10.0.0.7/24",
+ "ipv6": "fd00:0:0:1::7/64",
+ "ipv4_mask": "255.255.255.0",
+ "ipv6_mask": None,
+}
+LOOPBACK_2 = {
+ "ipv4": "10.0.0.16/24",
+ "ipv6": "fd00:0:0:3::5/64",
+ "ipv4_mask": "255.255.255.0",
+ "ipv6_mask": None,
+}
+PREFERRED_NEXT_HOP = "global"
+
+
+def setup_module(mod):
+ """
+ Sets up the pytest environment
+
+ * `mod`: module name
+ """
+
+ testsuite_run_time = time.asctime(time.localtime(time.time()))
+ logger.info("Testsuite start time: {}".format(testsuite_run_time))
+ logger.info("=" * 40)
+
+ logger.info("Running setup_module to create topology")
+
+ # This function initiates the topology build with Topogen...
+ json_file = "{}/bgp_vrf_lite_best_path_topo1.json".format(CWD)
+ tgen = Topogen(json_file, mod.__name__)
+ global topo
+ topo = tgen.json_topo
+ # ... and here it calls Mininet initialization functions.
+
+ # Starting topology, create tmp files which are loaded to routers
+ # to start deamons and then start routers
+ start_topology(tgen)
+
+ # Run these tests for kernel version 4.19 or above
+ if version_cmp(platform.release(), "4.19") < 0:
+ error_msg = (
+ "BGP vrf dynamic route leak tests will not run "
+ '(have kernel "{}", but it requires >= 4.19)'.format(platform.release())
+ )
+ pytest.skip(error_msg)
+
+ # Creating configuration from JSON
+ build_config_from_json(tgen, topo)
+
+ global BGP_CONVERGENCE
+ global ADDR_TYPES
+ ADDR_TYPES = check_address_types()
+
+ BGP_CONVERGENCE = verify_bgp_convergence(tgen, topo)
+ assert BGP_CONVERGENCE is True, "setup_module : Failed \n Error: {}".format(
+ BGP_CONVERGENCE
+ )
+
+ logger.info("Running setup_module() done")
+
+
+def teardown_module():
+ """Teardown the pytest environment"""
+
+ logger.info("Running teardown_module to delete topology")
+
+ tgen = get_topogen()
+
+ # Stop toplogy and Remove tmp files
+ tgen.stop_topology()
+
+ logger.info(
+ "Testsuite end time: {}".format(time.asctime(time.localtime(time.time())))
+ )
+ logger.info("=" * 40)
+
+
+#####################################################
+#
+# Testcases
+#
+#####################################################
+
+
+def disable_route_map_to_prefer_global_next_hop(tgen, topo):
+ """
+ This API is to remove prefer global route-map applied on neighbors
+
+ Parameter:
+ ----------
+ * `tgen` : Topogen object
+ * `topo` : Input JSON data
+
+ Returns:
+ --------
+ True/errormsg
+
+ """
+
+ logger.info("Remove prefer-global rmap applied on neighbors")
+ input_dict = {
+ "r1": {
+ "bgp": [
+ {
+ "local_as": "100",
+ "vrf": "ISR",
+ "address_family": {
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r2": {
+ "dest_link": {
+ "r1-link1": {
+ "route_maps": [
+ {
+ "name": "rmap_global",
+ "direction": "in",
+ "delete": True,
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ },
+ {
+ "local_as": "100",
+ "address_family": {
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r1-link1": {
+ "route_maps": [
+ {
+ "name": "rmap_global",
+ "direction": "in",
+ "delete": True,
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ },
+ {
+ "local_as": "100",
+ "address_family": {
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r4": {
+ "dest_link": {
+ "r1-link1": {
+ "route_maps": [
+ {
+ "name": "rmap_global",
+ "direction": "in",
+ "delete": True,
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ },
+ ]
+ },
+ "r2": {
+ "bgp": [
+ {
+ "local_as": "100",
+ "vrf": "ISR",
+ "address_family": {
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r2-link1": {
+ "route_maps": [
+ {
+ "name": "rmap_global",
+ "direction": "in",
+ "delete": True,
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ },
+ {
+ "local_as": "100",
+ "address_family": {
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r2-link1": {
+ "route_maps": [
+ {
+ "name": "rmap_global",
+ "direction": "in",
+ "delete": True,
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ },
+ {
+ "local_as": "100",
+ "address_family": {
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r4": {
+ "dest_link": {
+ "r2-link1": {
+ "route_maps": [
+ {
+ "name": "rmap_global",
+ "direction": "in",
+ "delete": True,
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ },
+ ]
+ },
+ "r3": {
+ "bgp": [
+ {
+ "local_as": "300",
+ "address_family": {
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r3-link1": {
+ "route_maps": [
+ {
+ "name": "rmap_global",
+ "direction": "in",
+ "delete": True,
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ },
+ {
+ "local_as": "300",
+ "address_family": {
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r2": {
+ "dest_link": {
+ "r3-link1": {
+ "route_maps": [
+ {
+ "name": "rmap_global",
+ "direction": "in",
+ "delete": True,
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ },
+ ]
+ },
+ "r4": {
+ "bgp": [
+ {
+ "local_as": "400",
+ "address_family": {
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r1": {
+ "dest_link": {
+ "r4-link1": {
+ "route_maps": [
+ {
+ "name": "rmap_global",
+ "direction": "in",
+ "delete": True,
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ },
+ {
+ "local_as": "400",
+ "address_family": {
+ "ipv6": {
+ "unicast": {
+ "neighbor": {
+ "r2": {
+ "dest_link": {
+ "r4-link1": {
+ "route_maps": [
+ {
+ "name": "rmap_global",
+ "direction": "in",
+ "delete": True,
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ },
+ ]
+ },
+ }
+
+ result = create_router_bgp(tgen, topo, input_dict)
+ assert result is True, "Testcase :Failed \n Error: {}".format(result)
+
+ return True
+
+
+def test_bgp_best_path_with_dynamic_import_p0(request):
+ """
+ 1.5.6. Verify BGP best path selection algorithm works fine when
+ routes are imported from ISR to default vrf and vice versa.
+ """
+
+ tgen = get_topogen()
+ tc_name = request.node.name
+ write_test_header(tc_name)
+ build_config_from_json(tgen, topo)
+
+ if tgen.routers_have_failure():
+ check_router_status(tgen)
+
+ for addr_type in ADDR_TYPES:
+
+ step(
+ "Redistribute configured static routes into BGP process" " on R1/R2 and R3"
+ )
+
+ input_dict_1 = {}
+ DUT = ["r1", "r2", "r3", "r4"]
+ VRFS = ["ISR", "ISR", "default", "default"]
+ AS_NUM = [100, 100, 300, 400]
+
+ for dut, vrf, as_num in zip(DUT, VRFS, AS_NUM):
+ temp = {dut: {"bgp": []}}
+ input_dict_1.update(temp)
+
+ temp[dut]["bgp"].append(
+ {
+ "local_as": as_num,
+ "vrf": vrf,
+ "address_family": {
+ addr_type: {
+ "unicast": {"redistribute": [{"redist_type": "static"}]}
+ }
+ },
+ }
+ )
+
+ result = create_router_bgp(tgen, topo, input_dict_1)
+ assert result is True, "Testcase {} :Failed \n Error: {}".format(
+ tc_name, result
+ )
+
+ for addr_type in ADDR_TYPES:
+
+ step("Import from default vrf into vrf ISR on R1 and R2 as below")
+
+ input_dict_vrf = {}
+ DUT = ["r1", "r2"]
+ VRFS = ["ISR", "ISR"]
+ AS_NUM = [100, 100]
+
+ for dut, vrf, as_num in zip(DUT, VRFS, AS_NUM):
+ temp = {dut: {"bgp": []}}
+ input_dict_vrf.update(temp)
+
+ temp[dut]["bgp"].append(
+ {
+ "local_as": as_num,
+ "vrf": vrf,
+ "address_family": {
+ addr_type: {"unicast": {"import": {"vrf": "default"}}}
+ },
+ }
+ )
+
+ result = create_router_bgp(tgen, topo, input_dict_vrf)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(
+ tc_name, result
+ )
+
+ input_dict_default = {}
+ DUT = ["r1", "r2"]
+ VRFS = ["default", "default"]
+ AS_NUM = [100, 100]
+
+ for dut, vrf, as_num in zip(DUT, VRFS, AS_NUM):
+ temp = {dut: {"bgp": []}}
+ input_dict_default.update(temp)
+
+ temp[dut]["bgp"].append(
+ {
+ "local_as": as_num,
+ "vrf": vrf,
+ "address_family": {
+ addr_type: {"unicast": {"import": {"vrf": "ISR"}}}
+ },
+ }
+ )
+
+ result = create_router_bgp(tgen, topo, input_dict_default)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(
+ tc_name, result
+ )
+
+ step(
+ "Verify ECMP/Next-hop/Imported routes Vs Locally originated "
+ "routes/eBGP routes vs iBGP routes --already covered in almost"
+ " all tests"
+ )
+
+ for addr_type in ADDR_TYPES:
+
+ step("Verify Pre-emption")
+
+ input_routes_r3 = {
+ "r3": {"static_routes": [{"network": [NETWORK3_3[addr_type]]}]}
+ }
+
+ intf_r3_r1 = topo["routers"]["r3"]["links"]["r1-link1"]["interface"]
+ intf_r4_r1 = topo["routers"]["r4"]["links"]["r1-link1"]["interface"]
+
+ if addr_type == "ipv6" and "link_local" in PREFERRED_NEXT_HOP:
+ nh_r3_r1 = get_frr_ipv6_linklocal(tgen, "r3", intf=intf_r3_r1)
+ nh_r4_r1 = get_frr_ipv6_linklocal(tgen, "r4", intf=intf_r4_r1)
+ else:
+ nh_r3_r1 = topo["routers"]["r3"]["links"]["r1-link1"][addr_type].split("/")[
+ 0
+ ]
+ nh_r4_r1 = topo["routers"]["r4"]["links"]["r1-link1"][addr_type].split("/")[
+ 0
+ ]
+
+ result = verify_bgp_rib(
+ tgen, addr_type, "r1", input_routes_r3, next_hop=[nh_r4_r1]
+ )
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ step("Shutdown interface connected to r1 from r4:")
+ shutdown_bringup_interface(tgen, "r4", intf_r4_r1, False)
+
+ for addr_type in ADDR_TYPES:
+
+ input_routes_r3 = {
+ "r3": {"static_routes": [{"network": [NETWORK3_3[addr_type]]}]}
+ }
+
+ intf_r3_r1 = topo["routers"]["r3"]["links"]["r1-link1"]["interface"]
+ intf_r4_r1 = topo["routers"]["r4"]["links"]["r1-link1"]["interface"]
+
+ if addr_type == "ipv6" and "link_local" in PREFERRED_NEXT_HOP:
+ nh_r3_r1 = get_frr_ipv6_linklocal(tgen, "r3", intf=intf_r3_r1)
+ nh_r4_r1 = get_frr_ipv6_linklocal(tgen, "r4", intf=intf_r4_r1)
+ else:
+ nh_r3_r1 = topo["routers"]["r3"]["links"]["r1-link1"][addr_type].split("/")[
+ 0
+ ]
+ nh_r4_r1 = topo["routers"]["r4"]["links"]["r1-link1"][addr_type].split("/")[
+ 0
+ ]
+
+ step("Verify next-hop is changed")
+ result = verify_bgp_rib(
+ tgen, addr_type, "r1", input_routes_r3, next_hop=[nh_r3_r1]
+ )
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ step("Bringup interface connected to r1 from r4:")
+ shutdown_bringup_interface(tgen, "r4", intf_r4_r1, True)
+
+ for addr_type in ADDR_TYPES:
+
+ input_routes_r3 = {
+ "r3": {"static_routes": [{"network": [NETWORK3_3[addr_type]]}]}
+ }
+
+ intf_r3_r1 = topo["routers"]["r3"]["links"]["r1-link1"]["interface"]
+ intf_r4_r1 = topo["routers"]["r4"]["links"]["r1-link1"]["interface"]
+
+ if addr_type == "ipv6" and "link_local" in PREFERRED_NEXT_HOP:
+ nh_r3_r1 = get_frr_ipv6_linklocal(tgen, "r3", intf=intf_r3_r1)
+ nh_r4_r1 = get_frr_ipv6_linklocal(tgen, "r4", intf=intf_r4_r1)
+ else:
+ nh_r3_r1 = topo["routers"]["r3"]["links"]["r1-link1"][addr_type].split("/")[
+ 0
+ ]
+ nh_r4_r1 = topo["routers"]["r4"]["links"]["r1-link1"][addr_type].split("/")[
+ 0
+ ]
+
+ step("Verify next-hop is not chnaged aftr shutdown:")
+ result = verify_bgp_rib(
+ tgen, addr_type, "r1", input_routes_r3, next_hop=[nh_r3_r1]
+ )
+ assert result is True, "Testcase {} : Failed \n Error {}".format(
+ tc_name, result
+ )
+
+ step("Active-Standby scenario(as-path prepend and Local pref)")
+
+ for addr_type in ADDR_TYPES:
+
+ step("Create prefix-list")
+
+ input_dict_pf = {
+ "r1": {
+ "prefix_lists": {
+ addr_type: {
+ "pf_ls_{}".format(addr_type): [
+ {
+ "seqid": 10,
+ "network": NETWORK3_4[addr_type],
+ "action": "permit",
+ }
+ ]
+ }
+ }
+ }
+ }
+ result = create_prefix_lists(tgen, input_dict_pf)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(
+ tc_name, result
+ )
+
+ for addr_type in ADDR_TYPES:
+
+ step("Create route-map to match prefix-list and set localpref 500")
+
+ input_dict_rm = {
+ "r1": {
+ "route_maps": {
+ "rmap_PATH1_{}".format(addr_type): [
+ {
+ "action": "permit",
+ "seq_id": 10,
+ "match": {
+ addr_type: {
+ "prefix_lists": "pf_ls_{}".format(addr_type)
+ }
+ },
+ "set": {"locPrf": 500},
+ }
+ ]
+ }
+ }
+ }
+
+ result = create_route_maps(tgen, input_dict_rm)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(
+ tc_name, result
+ )
+
+ step("Create route-map to match prefix-list and set localpref 600")
+
+ input_dict_rm = {
+ "r1": {
+ "route_maps": {
+ "rmap_PATH2_{}".format(addr_type): [
+ {
+ "action": "permit",
+ "seq_id": 20,
+ "match": {
+ addr_type: {
+ "prefix_lists": "pf_ls_{}".format(addr_type)
+ }
+ },
+ "set": {"locPrf": 600},
+ }
+ ]
+ }
+ }
+ }
+
+ result = create_route_maps(tgen, input_dict_rm)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(
+ tc_name, result
+ )
+
+ input_dict_rma = {
+ "r1": {
+ "bgp": [
+ {
+ "local_as": "100",
+ "address_family": {
+ addr_type: {
+ "unicast": {
+ "neighbor": {
+ "r3": {
+ "dest_link": {
+ "r1-link1": {
+ "route_maps": [
+ {
+ "name": "rmap_PATH1_{}".format(
+ addr_type
+ ),
+ "direction": "in",
+ }
+ ]
+ }
+ }
+ },
+ "r4": {
+ "dest_link": {
+ "r1-link1": {
+ "route_maps": [
+ {
+ "name": "rmap_PATH2_{}".format(
+ addr_type
+ ),
+ "direction": "in",
+ }
+ ]
+ }
+ }
+ },
+ }
+ }
+ }
+ },
+ }
+ ]
+ }
+ }
+
+ result = create_router_bgp(tgen, topo, input_dict_rma)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(
+ tc_name, result
+ )
+
+ dut = "r1"
+ attribute = "locPrf"
+
+ for addr_type in ADDR_TYPES:
+
+ step("Verify bestpath is installed as per highest localpref")
+
+ input_routes_r3 = {
+ "r3": {
+ "static_routes": [
+ {"network": [NETWORK3_3[addr_type], NETWORK3_4[addr_type]]}
+ ]
+ }
+ }
+
+ result = verify_best_path_as_per_bgp_attribute(
+ tgen, addr_type, dut, input_routes_r3, attribute
+ )
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(
+ tc_name, result
+ )
+
+ for addr_type in ADDR_TYPES:
+
+ step("Create route-map to match prefix-list and set localpref 700")
+
+ input_dict_rm = {
+ "r1": {
+ "route_maps": {
+ "rmap_PATH1_{}".format(addr_type): [
+ {
+ "action": "permit",
+ "seq_id": 10,
+ "match": {
+ addr_type: {
+ "prefix_lists": "pf_ls_{}".format(addr_type)
+ }
+ },
+ "set": {"locPrf": 700},
+ }
+ ]
+ }
+ }
+ }
+
+ result = create_route_maps(tgen, input_dict_rm)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(
+ tc_name, result
+ )
+
+ for addr_type in ADDR_TYPES:
+
+ step("Verify bestpath is changed as per highest localpref")
+
+ input_routes_r3 = {
+ "r3": {
+ "static_routes": [
+ {"network": [NETWORK3_3[addr_type], NETWORK3_4[addr_type]]}
+ ]
+ }
+ }
+
+ result = verify_best_path_as_per_bgp_attribute(
+ tgen, addr_type, dut, input_routes_r3, attribute
+ )
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(
+ tc_name, result
+ )
+
+ for addr_type in ADDR_TYPES:
+
+ step("Create route-map to match prefix-list and set as-path prepend")
+
+ input_dict_rm = {
+ "r1": {
+ "route_maps": {
+ "rmap_PATH2_{}".format(addr_type): [
+ {
+ "action": "permit",
+ "seq_id": 20,
+ "match": {
+ addr_type: {
+ "prefix_lists": "pf_ls_{}".format(addr_type)
+ }
+ },
+ "set": {
+ "localpref": 700,
+ "path": {"as_num": "111", "as_action": "prepend"},
+ },
+ }
+ ]
+ }
+ }
+ }
+
+ result = create_route_maps(tgen, input_dict_rm)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(
+ tc_name, result
+ )
+
+ attribute = "path"
+
+ for addr_type in ADDR_TYPES:
+
+ step("Verify bestpath is changed as per shortest as-path")
+
+ input_routes_r3 = {
+ "r3": {
+ "static_routes": [
+ {"network": [NETWORK3_3[addr_type], NETWORK3_4[addr_type]]}
+ ]
+ }
+ }
+
+ result = verify_best_path_as_per_bgp_attribute(
+ tgen, addr_type, dut, input_routes_r3, attribute
+ )
+ 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_vrf_lite_best_path_test/test_bgp_vrf_lite_best_path_topo2.py b/tests/topotests/bgp_vrf_lite_best_path_test/test_bgp_vrf_lite_best_path_topo2.py
new file mode 100644
index 0000000000..e930b62706
--- /dev/null
+++ b/tests/topotests/bgp_vrf_lite_best_path_test/test_bgp_vrf_lite_best_path_topo2.py
@@ -0,0 +1,539 @@
+#!/usr/bin/env python
+
+#
+# Copyright (c) 2021 by VMware, Inc. ("VMware")
+# Used Copyright (c) 2018 by Network Device Education Foundation,
+# Inc. ("NetDEF") in this file.
+#
+# Permission to use, copy, modify, and/or distribute this software
+# for any purpose with or without fee is hereby granted, provided
+# that the above copyright notice and this permission notice appear
+# in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND VMWARE DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VMWARE BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
+# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+# OF THIS SOFTWARE.
+#
+
+"""
+Following tests are covered to test BGP VRF Lite:
+1. Verify that locally imported routes are selected as best path over eBGP imported routes
+ peers.
+2. Verify ECMP for imported routes from different VRFs.
+"""
+
+import os
+import sys
+import time
+import pytest
+import platform
+from time import sleep
+
+# Save the Current Working Directory to find configuration files.
+CWD = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join(CWD, "../"))
+sys.path.append(os.path.join(CWD, "../lib/"))
+
+# Required to instantiate the topology builder class.
+
+# pylint: disable=C0413
+# Import topogen and topotest helpers
+from lib.topogen import Topogen, get_topogen
+from lib.topotest import version_cmp
+
+from lib.common_config import (
+ start_topology,
+ write_test_header,
+ check_address_types,
+ write_test_footer,
+ reset_config_on_routers,
+ verify_rib,
+ step,
+ create_static_routes,
+ check_router_status,
+ apply_raw_config
+)
+
+from lib.topolog import logger
+from lib.bgp import (
+ verify_bgp_convergence,
+ create_router_bgp,
+ verify_bgp_rib,
+ verify_bgp_bestpath
+)
+from lib.topojson import build_config_from_json
+
+pytestmark = [pytest.mark.bgpd, pytest.mark.staticd]
+
+# Global variables
+NETWORK1_1 = {"ipv4": "11.11.11.1/32", "ipv6": "11:11::1/128"}
+NETWORK1_2 = {"ipv4": "11.11.11.11/32", "ipv6": "11:11::11/128"}
+NETWORK1_3 = {"ipv4": "10.10.10.1/32", "ipv6": "10:10::1/128"}
+NETWORK1_4 = {"ipv4": "10.10.10.100/32", "ipv6": "10:10::100/128"}
+NETWORK1_5 = {"ipv4": "110.110.110.1/32", "ipv6": "110:110::1/128"}
+NETWORK1_6 = {"ipv4": "110.110.110.100/32", "ipv6": "110:110::100/128"}
+
+NETWORK2_1 = {"ipv4": "22.22.22.2/32", "ipv6": "22:22::2/128"}
+NETWORK2_2 = {"ipv4": "22.22.22.22/32", "ipv6": "22:22::22/128"}
+NETWORK2_3 = {"ipv4": "20.20.20.20/32", "ipv6": "20:20::20/128"}
+NETWORK2_4 = {"ipv4": "20.20.20.200/32", "ipv6": "20:20::200/128"}
+NETWORK2_5 = {"ipv4": "220.220.220.20/32", "ipv6": "220:220::20/128"}
+NETWORK2_6 = {"ipv4": "220.220.220.200/32", "ipv6": "220:220::200/128"}
+
+NETWORK3_1 = {"ipv4": "30.30.30.3/32", "ipv6": "30:30::3/128"}
+NETWORK3_2 = {"ipv4": "30.30.30.30/32", "ipv6": "30:30::30/128"}
+
+PREFIX_LIST = {
+ "ipv4": ["11.11.11.1", "22.22.22.2", "22.22.22.22"],
+ "ipv6": ["11:11::1", "22:22::2", "22:22::22"],
+}
+PREFERRED_NEXT_HOP = "global"
+VRF_LIST = ["RED", "BLUE", "GREEN"]
+COMM_VAL_1 = "100:100"
+COMM_VAL_2 = "500:500"
+COMM_VAL_3 = "600:600"
+BESTPATH = {
+ "ipv4": "0.0.0.0",
+ "ipv6": "::"
+}
+
+def setup_module(mod):
+ """
+ Sets up the pytest environment
+
+ * `mod`: module name
+ """
+
+ testsuite_run_time = time.asctime(time.localtime(time.time()))
+ logger.info("Testsuite start time: {}".format(testsuite_run_time))
+ logger.info("=" * 40)
+
+ logger.info("Running setup_module to create topology")
+
+ # This function initiates the topology build with Topogen...
+ json_file = "{}/bgp_vrf_lite_best_path_topo2.json".format(CWD)
+ tgen = Topogen(json_file, mod.__name__)
+ global topo
+ topo = tgen.json_topo
+ # ... and here it calls Mininet initialization functions.
+
+ # Starting topology, create tmp files which are loaded to routers
+ # to start deamons and then start routers
+ start_topology(tgen)
+
+ # Run these tests for kernel version 4.19 or above
+ if version_cmp(platform.release(), "4.19") < 0:
+ error_msg = (
+ "BGP vrf dynamic route leak tests will not run "
+ '(have kernel "{}", but it requires >= 4.19)'.format(platform.release())
+ )
+ pytest.skip(error_msg)
+
+ # Creating configuration from JSON
+ build_config_from_json(tgen, topo)
+
+ global BGP_CONVERGENCE
+ global ADDR_TYPES
+ ADDR_TYPES = check_address_types()
+
+ BGP_CONVERGENCE = verify_bgp_convergence(tgen, topo)
+ assert BGP_CONVERGENCE is True, "setup_module : Failed \n Error: {}".format(
+ BGP_CONVERGENCE
+ )
+
+ logger.info("Running setup_module() done")
+
+
+def teardown_module():
+ """Teardown the pytest environment"""
+
+ logger.info("Running teardown_module to delete topology")
+
+ tgen = get_topogen()
+
+ # Stop toplogy and Remove tmp files
+ tgen.stop_topology()
+
+ logger.info(
+ "Testsuite end time: {}".format(time.asctime(time.localtime(time.time())))
+ )
+ logger.info("=" * 40)
+
+
+#####################################################
+#
+# Testcases
+#
+#####################################################
+
+def test_dynamic_import_ecmp_imported_routed_diffrent_vrfs_p0(request):
+ """
+ Verify ECMP for imported routes from different VRFs.
+ """
+
+ 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("Configure same static routes in tenant vrfs RED and GREEN on router "
+ "R3 and redistribute in respective BGP process")
+
+ for vrf_name in ["RED", "GREEN"]:
+ for addr_type in ADDR_TYPES:
+ if vrf_name == "GREEN":
+ next_hop_vrf = topo["routers"]["r1"]["links"][
+ "r3-link3"][addr_type].split("/")[0]
+ else:
+ next_hop_vrf = topo["routers"]["r2"]["links"][
+ "r3-link1"][addr_type].split("/")[0]
+ static_routes = {
+ "r3": {
+ "static_routes": [
+ {
+ "network": [NETWORK1_1[addr_type]],
+ "next_hop": next_hop_vrf,
+ "vrf": vrf_name
+ }
+ ]
+ }
+ }
+
+ result = create_static_routes(tgen, static_routes)
+ assert result is True, "Testcase {} :Failed \n Error: {}". \
+ format(tc_name, result)
+
+ step("Redistribute static route on BGP VRF : {}".format(vrf_name))
+ temp = {}
+ for addr_type in ADDR_TYPES:
+ temp.update({
+ addr_type: {
+ "unicast": {
+ "redistribute": [{
+ "redist_type": "static"
+ }]
+ }
+ }
+ })
+
+ redist_dict = {"r3": {"bgp": [{
+ "vrf": vrf_name, "local_as": 3, "address_family": temp
+ }]}}
+
+ result = create_router_bgp(tgen, topo, redist_dict)
+ assert result is True, "Testcase {} :Failed \n Error: {}". \
+ format(tc_name, result)
+
+ step("Verify that configured static routes are installed in respective "
+ "BGP table for vrf RED & GREEN")
+ for vrf_name in ["RED", "GREEN"]:
+ for addr_type in ADDR_TYPES:
+ if vrf_name == "GREEN":
+ next_hop_vrf = topo["routers"]["r1"]["links"][
+ "r3-link3"][addr_type].split("/")[0]
+ else:
+ next_hop_vrf = topo["routers"]["r2"]["links"][
+ "r3-link1"][addr_type].split("/")[0]
+ static_routes = {
+ "r3": {
+ "static_routes": [
+ {
+ "network": [NETWORK1_1[addr_type]],
+ "vrf": vrf_name
+ }
+ ]
+ }
+ }
+
+ result = verify_bgp_rib(tgen, addr_type, "r3", static_routes,
+ next_hop=next_hop_vrf)
+ assert result is True, "Testcase {} : Failed \n Error {}". \
+ format(tc_name, result)
+
+ result = verify_rib(tgen, addr_type, "r3", static_routes,
+ next_hop=next_hop_vrf)
+ assert result is True, "Testcase {} : Failed \n Error {}". \
+ format(tc_name, result)
+
+ step("Import vrf RED and GREEN into default vrf and Configure ECMP")
+ bgp_val = []
+ for vrf_name in ["RED", "GREEN"]:
+ temp = {}
+ for addr_type in ADDR_TYPES:
+ temp.update({
+ addr_type: {
+ "unicast": {
+ "import": {
+ "vrf": vrf_name
+ },
+ "maximum_paths": {
+ "ebgp": 2
+ }
+ }
+ }
+ })
+
+ bgp_val.append({
+ "local_as": 3, "address_family": temp
+ })
+
+ import_dict = {"r3": {"bgp": bgp_val}}
+
+ result = create_router_bgp(tgen, topo, import_dict)
+ assert result is True, "Testcase {} :Failed \n Error: {}". \
+ format(tc_name, result)
+
+ step("Configure bgp bestpath on router r3")
+ r3_raw_config = {
+ "r3": {
+ "raw_config": [
+ "router bgp 3",
+ "bgp bestpath as-path multipath-relax"
+ ]
+ }
+ }
+ result = apply_raw_config(tgen, r3_raw_config)
+ assert result is True, "Testcase {} :Failed \n Error: {}". \
+ format(tc_name, result)
+
+ step("Verify that routes are imported with two different next-hop vrfs "
+ "and IPs. Additionally R3 must do ECMP for both the routes.")
+
+ for addr_type in ADDR_TYPES:
+ next_hop_vrf = [
+ topo["routers"]["r2"]["links"]["r3-link1"][addr_type]. \
+ split("/")[0],
+ topo["routers"]["r1"]["links"]["r3-link3"][addr_type]. \
+ split("/")[0]
+ ]
+ static_routes = {
+ "r3": {
+ "static_routes": [
+ {
+ "network": [NETWORK1_1[addr_type]],
+ }
+ ]
+ }
+ }
+
+ result = verify_bgp_rib(tgen, addr_type, "r3", static_routes,
+ next_hop=next_hop_vrf)
+ assert result is True, "Testcase {} : Failed \n Error {}". \
+ format(tc_name, result)
+
+ result = verify_rib(tgen, addr_type, "r3", static_routes,
+ next_hop=next_hop_vrf)
+ assert result is True, "Testcase {} : Failed \n Error {}". \
+ format(tc_name, result)
+
+ step("Now change the next-hop of static routes in vrf RED and GREEN to "
+ "same IP address")
+ for addr_type in ADDR_TYPES:
+ next_hop_vrf = topo["routers"]["r1"]["links"][
+ "r3-link3"][addr_type].split("/")[0]
+ static_routes = {
+ "r3": {
+ "static_routes": [
+ {
+ "network": [NETWORK1_1[addr_type]],
+ "next_hop": next_hop_vrf,
+ "vrf": "RED"
+ },
+ {
+ "network": [NETWORK1_1[addr_type]],
+ "next_hop": topo["routers"]["r2"]["links"][
+ "r3-link1"][addr_type].split("/")[0],
+ "vrf": "RED",
+ "delete": True
+ }
+ ]
+ }
+ }
+
+ result = create_static_routes(tgen, static_routes)
+ assert result is True, "Testcase {} :Failed \n Error: {}". \
+ format(tc_name, result)
+
+ step("Verify that now routes are imported with two different next-hop "
+ "vrfs but same IPs. Additionally R3 must do ECMP for both the routes")
+
+ for addr_type in ADDR_TYPES:
+ next_hop_vrf = [
+ topo["routers"]["r1"]["links"]["r3-link3"][addr_type].\
+ split("/")[0],
+ topo["routers"]["r1"]["links"]["r3-link3"][addr_type]. \
+ split("/")[0]
+ ]
+ static_routes = {
+ "r3": {
+ "static_routes": [
+ {
+ "network": [NETWORK1_1[addr_type]],
+ }
+ ]
+ }
+ }
+
+ result = verify_bgp_rib(tgen, addr_type, "r3", static_routes,
+ next_hop=next_hop_vrf)
+ assert result is True, "Testcase {} : Failed \n Error {}". \
+ format(tc_name, result)
+
+ result = verify_rib(tgen, addr_type, "r3", static_routes,
+ next_hop=next_hop_vrf)
+ assert result is True, "Testcase {} : Failed \n Error {}". \
+ format(tc_name, result)
+
+ write_test_footer(tc_name)
+
+
+def test_locally_imported_routes_selected_as_bestpath_over_ebgp_imported_routes_p0(request):
+ """
+ Verify ECMP for imported routes from different VRFs.
+ """
+
+ 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("Configure same static routes on R2 and R3 vrfs and redistribute in BGP "
+ "for GREEN and RED vrf instances")
+ for dut, network in zip(["r2", "r3"], [
+ [NETWORK1_1, NETWORK1_2], [NETWORK1_1, NETWORK1_2]]):
+ for vrf_name, network_vrf in zip(["RED", "GREEN"], network):
+ step("Configure static route for VRF : {} on {}".format(vrf_name,
+ dut))
+ for addr_type in ADDR_TYPES:
+ static_routes = {
+ dut: {
+ "static_routes": [
+ {
+ "network": [network_vrf[addr_type]],
+ "next_hop": "blackhole",
+ "vrf": vrf_name
+ }
+ ]
+ }
+ }
+
+ result = create_static_routes(tgen, static_routes)
+ assert result is True, "Testcase {} :Failed \n Error: {}". \
+ format(tc_name, result)
+
+ for dut, as_num in zip(["r2", "r3"], ["2", "3"]):
+ for vrf_name in ["RED", "GREEN"]:
+ step("Redistribute static route on BGP VRF : {}".format(vrf_name))
+ temp = {}
+ for addr_type in ADDR_TYPES:
+ temp.update({
+ addr_type: {
+ "unicast": {
+ "redistribute": [{
+ "redist_type": "static"
+ }]
+ }
+ }
+ })
+
+ redist_dict = {dut: {"bgp": [{
+ "vrf": vrf_name, "local_as": as_num, "address_family": temp
+ }]}}
+
+ result = create_router_bgp(tgen, topo, redist_dict)
+ assert result is True, "Testcase {} :Failed \n Error: {}". \
+ format(tc_name, result)
+
+ step("Verify that R2 and R3 has installed redistributed routes in default "
+ "and RED vrfs and GREEN respectively:")
+ for dut, network in zip(["r2", "r3"],
+ [[NETWORK1_1, NETWORK1_2],
+ [NETWORK1_1, NETWORK1_2]]):
+ for vrf_name, network_vrf in zip(["RED", "GREEN"], network):
+ for addr_type in ADDR_TYPES:
+ static_routes = {
+ dut: {
+ "static_routes": [
+ {
+ "network": [network_vrf[addr_type]],
+ "next_hop": "blackhole",
+ "vrf": vrf_name
+ }
+ ]
+ }
+ }
+ result = verify_bgp_rib(tgen, addr_type, dut, static_routes)
+ assert result is True, "Testcase {} : Failed \n Error {}". \
+ format(tc_name, result)
+
+ step("Import vrf RED's route in vrf GREEN on R3")
+ temp = {}
+ for addr_type in ADDR_TYPES:
+ temp.update({
+ addr_type: {
+ "unicast": {
+ "import": {
+ "vrf": "RED"
+ }
+ }
+ }
+ })
+
+ import_dict = {"r3": {"bgp": [{
+ "vrf": "GREEN", "local_as": 3, "address_family": temp
+ }]}}
+
+ result = create_router_bgp(tgen, topo, import_dict)
+ assert result is True, "Testcase {} :Failed \n Error: {}". \
+ format(tc_name, result)
+
+ step("Verify that locally imported routes are installed over eBGP imported"
+ " routes from VRF RED into VRF GREEN")
+ for addr_type in ADDR_TYPES:
+ static_routes = {
+ "r3": {
+ "static_routes": [
+ {
+ "network": [NETWORK1_2[addr_type]],
+ "next_hop": "blackhole",
+ "vrf": "GREEN"
+ }
+ ]
+ }
+ }
+
+ input_routes = {
+ "r3": {
+ addr_type: [
+ {
+ "network": NETWORK1_2[addr_type],
+ "bestpath": BESTPATH[addr_type],
+ "vrf": "GREEN"
+ }
+ ]
+ }
+ }
+
+ result = verify_bgp_bestpath(tgen, addr_type, input_routes)
+ assert result is True, "Testcase {} : Failed \n Error {}". \
+ format(tc_name, result)
+
+ result = verify_rib(tgen, addr_type, "r3", static_routes)
+ 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_vrf_lite_ipv6_rtadv/r1/zebra.conf b/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r1/zebra.conf
index f19c497208..74359a55da 100644
--- a/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r1/zebra.conf
+++ b/tests/topotests/bgp_vrf_lite_ipv6_rtadv/r1/zebra.conf
@@ -1,5 +1,5 @@
-debug zebra packet recv
-debug zebra packet send
+! debug zebra packet recv
+! debug zebra packet send
log stdout
interface loop1 vrf r1-cust1
ip address 10.254.254.1/32
diff --git a/tests/topotests/bgp_vrf_netns/peer1/exa-send.py b/tests/topotests/bgp_vrf_netns/peer1/exa-send.py
index 9279cc45ff..ab0eb8ce8f 100755
--- a/tests/topotests/bgp_vrf_netns/peer1/exa-send.py
+++ b/tests/topotests/bgp_vrf_netns/peer1/exa-send.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2
"""
exa-send.py: Send a few testroutes with ExaBGP
diff --git a/tests/topotests/bgp_vrf_netns/r1/zebra.conf b/tests/topotests/bgp_vrf_netns/r1/zebra.conf
index fd0e18f5fd..ed4edfa0bd 100644
--- a/tests/topotests/bgp_vrf_netns/r1/zebra.conf
+++ b/tests/topotests/bgp_vrf_netns/r1/zebra.conf
@@ -4,4 +4,4 @@ interface r1-eth0 vrf r1-bgp-cust1
!
line vty
!
-debug vrf
+! debug vrf
diff --git a/tests/topotests/config_timing/test_config_timing.py b/tests/topotests/config_timing/test_config_timing.py
index c3eb8ed840..7ab8619b01 100644
--- a/tests/topotests/config_timing/test_config_timing.py
+++ b/tests/topotests/config_timing/test_config_timing.py
@@ -77,8 +77,8 @@ def teardown_module(mod):
tgen.stop_topology()
-def get_ip_networks(super_prefix, count):
- count_log2 = math.log(count, 2)
+def get_ip_networks(super_prefix, base_count, count):
+ count_log2 = math.log(base_count, 2)
if count_log2 != int(count_log2):
count_log2 = int(count_log2) + 1
else:
@@ -94,6 +94,7 @@ def test_static_timing():
pytest.skip(tgen.errors)
def do_config(
+ base_count,
count,
bad_indices,
base_delta,
@@ -121,7 +122,7 @@ def test_static_timing():
router.logdir, rname, "{}-routes-{}.conf".format(iptype.lower(), optype)
)
with open(config_file, "w") as f:
- for i, net in enumerate(get_ip_networks(super_prefix, count)):
+ for i, net in enumerate(get_ip_networks(super_prefix, base_count, count)):
if i in bad_indices:
if add:
f.write("ip route {} {} bad_input\n".format(net, via))
@@ -170,25 +171,26 @@ def test_static_timing():
bad_indices = []
for ipv6 in [False, True]:
base_delta = do_config(
- prefix_count, bad_indices, 0, 0, True, ipv6, prefix_base[ipv6][0]
+ prefix_count, prefix_count, bad_indices, 0, 0, True, ipv6, prefix_base[ipv6][0]
)
# Another set of same number of prefixes
do_config(
- prefix_count, bad_indices, base_delta, 2, True, ipv6, prefix_base[ipv6][1]
+ prefix_count, prefix_count, bad_indices, base_delta, 3, True, ipv6, prefix_base[ipv6][1]
)
# Duplicate config
do_config(
- prefix_count, bad_indices, base_delta, 2, True, ipv6, prefix_base[ipv6][0]
+ prefix_count, prefix_count, bad_indices, base_delta, 3, True, ipv6, prefix_base[ipv6][0]
)
# Remove 1/2 of duplicate
do_config(
+ prefix_count,
prefix_count // 2,
bad_indices,
base_delta,
- 2,
+ 3,
False,
ipv6,
prefix_base[ipv6][0],
@@ -196,15 +198,15 @@ def test_static_timing():
# Add all back in so 1/2 replicate 1/2 new
do_config(
- prefix_count, bad_indices, base_delta, 2, True, ipv6, prefix_base[ipv6][0]
+ prefix_count, prefix_count, bad_indices, base_delta, 3, True, ipv6, prefix_base[ipv6][0]
)
# remove all
delta = do_config(
- prefix_count, bad_indices, base_delta, 2, False, ipv6, prefix_base[ipv6][0]
+ prefix_count, prefix_count, bad_indices, base_delta, 3, False, ipv6, prefix_base[ipv6][0]
)
delta += do_config(
- prefix_count, bad_indices, base_delta, 2, False, ipv6, prefix_base[ipv6][1]
+ prefix_count, prefix_count, bad_indices, base_delta, 3, False, ipv6, prefix_base[ipv6][1]
)
diff --git a/tests/topotests/conftest.py b/tests/topotests/conftest.py
index 7fe6a5aea1..3e1e6eb79b 100755
--- a/tests/topotests/conftest.py
+++ b/tests/topotests/conftest.py
@@ -9,6 +9,7 @@ import re
import subprocess
import sys
import time
+import resource
import pytest
import lib.fixtures
@@ -21,13 +22,6 @@ from lib.topolog import logger
from lib.topotest import g_extra_config as topotest_extra_config
from lib.topotest import json_cmp_result
-try:
- from _pytest._code.code import ExceptionInfo
-
- leak_check_ok = True
-except ImportError:
- leak_check_ok = False
-
def pytest_addoption(parser):
"""
@@ -138,8 +132,7 @@ def pytest_addoption(parser):
def check_for_memleaks():
- if not topotest_extra_config["valgrind_memleaks"]:
- return
+ assert topotest_extra_config["valgrind_memleaks"]
leaks = []
tgen = get_topogen()
@@ -151,21 +144,25 @@ def check_for_memleaks():
existing = tgen.valgrind_existing_files
latest = glob.glob(os.path.join(logdir, "*.valgrind.*"))
+ daemons = set()
for vfile in latest:
if vfile in existing:
continue
- with open(vfile) as vf:
+ existing.append(vfile)
+ with open(vfile, encoding="ascii") as vf:
vfcontent = vf.read()
match = re.search(r"ERROR SUMMARY: (\d+) errors", vfcontent)
if match and match.group(1) != "0":
emsg = "{} in {}".format(match.group(1), vfile)
leaks.append(emsg)
+ daemons.add(re.match(r".*\.valgrind\.(.*)\.\d+", vfile).group(1))
+
+ if tgen is not None:
+ tgen.valgrind_existing_files = existing
if leaks:
- if leak_check_ok:
- pytest.fail("Memleaks found:\n\t" + "\n\t".join(leaks))
- else:
- logger.error("Memleaks found:\n\t" + "\n\t".join(leaks))
+ logger.error("valgrind memleaks found:\n\t%s", "\n\t".join(leaks))
+ pytest.fail("valgrind memleaks found for daemons: " + " ".join(daemons))
def pytest_runtest_logstart(nodeid, location):
@@ -178,18 +175,21 @@ def pytest_runtest_logfinish(nodeid, location):
topolog.logfinish(nodeid, location)
-def pytest_runtest_call():
- """
- This function must be run after setup_module(), it does standarized post
- setup routines. It is only being used for the 'topology-only' option.
- """
+@pytest.hookimpl(hookwrapper=True)
+def pytest_runtest_call(item: pytest.Item) -> None:
+ "Hook the function that is called to execute the test."
+
+ # For topology only run the CLI then exit
if topotest_extra_config["topology_only"]:
- tgen = get_topogen()
- if tgen is not None:
- # Allow user to play with the setup.
- tgen.cli()
+ get_topogen().cli()
+ pytest.exit("exiting after --topology-only")
+
+ # Let the default pytest_runtest_call execute the test function
+ yield
- pytest.exit("the topology executed successfully")
+ # Check for leaks if requested
+ if topotest_extra_config["valgrind_memleaks"]:
+ check_for_memleaks()
def pytest_assertrepr_compare(op, left, right):
@@ -222,6 +222,9 @@ def pytest_configure(config):
is_xdist = True
is_worker = True
+ resource.setrlimit(
+ resource.RLIMIT_CORE, (resource.RLIM_INFINITY, resource.RLIM_INFINITY)
+ )
# -----------------------------------------------------
# Set some defaults for the pytest.ini [pytest] section
# ---------------------------------------------------
@@ -333,7 +336,10 @@ def pytest_configure(config):
topotest_extra_config["pause"] = pause
assert_feature_windows(pause, "--pause")
- topotest_extra_config["topology_only"] = config.getoption("--topology-only")
+ topology_only = config.getoption("--topology-only")
+ if topology_only and is_xdist:
+ pytest.exit("Cannot use --topology-only with distributed test mode")
+ topotest_extra_config["topology_only"] = topology_only
# Check environment now that we have config
if not diagnose_env(rundir):
@@ -373,12 +379,6 @@ def pytest_runtest_makereport(item, call):
else:
pause = False
- if call.excinfo is None and call.when == "call":
- try:
- check_for_memleaks()
- except:
- call.excinfo = ExceptionInfo()
-
title = "unset"
if call.excinfo is None:
@@ -509,5 +509,6 @@ def pytest_runtest_makereport(item, call):
#
# Add common fixtures available to all tests as parameters
#
+
tgen = pytest.fixture(lib.fixtures.tgen)
topo = pytest.fixture(lib.fixtures.topo)
diff --git a/tests/topotests/eigrp_topo1/r1/zebra.conf b/tests/topotests/eigrp_topo1/r1/zebra.conf
index 56ae4a66f4..51579a7d11 100644
--- a/tests/topotests/eigrp_topo1/r1/zebra.conf
+++ b/tests/topotests/eigrp_topo1/r1/zebra.conf
@@ -1,5 +1,5 @@
log file zebra.log
-debug zebra rib detail
+! debug zebra rib detail
!
hostname r1
!
diff --git a/tests/topotests/evpn_pim_1/leaf1/pimd.conf b/tests/topotests/evpn_pim_1/leaf1/pimd.conf
index d85f33d1fc..b54aada022 100644
--- a/tests/topotests/evpn_pim_1/leaf1/pimd.conf
+++ b/tests/topotests/evpn_pim_1/leaf1/pimd.conf
@@ -1,6 +1,6 @@
-debug pim events
-debug pim nht
-debug pim zebra
+! debug pim events
+! debug pim nht
+! debug pim zebra
ip pim rp 192.168.100.1
ip pim join-prune-interval 5
!
diff --git a/tests/topotests/isis_lfa_topo1/rt1/isisd.conf b/tests/topotests/isis_lfa_topo1/rt1/isisd.conf
index 2ad8c12538..833cd66ced 100644
--- a/tests/topotests/isis_lfa_topo1/rt1/isisd.conf
+++ b/tests/topotests/isis_lfa_topo1/rt1/isisd.conf
@@ -2,10 +2,10 @@ password 1
hostname rt1
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis lsp-gen
!
interface lo
ipv6 router isis 1
diff --git a/tests/topotests/isis_lfa_topo1/rt1/zebra.conf b/tests/topotests/isis_lfa_topo1/rt1/zebra.conf
index 317f1031df..4ce144495c 100644
--- a/tests/topotests/isis_lfa_topo1/rt1/zebra.conf
+++ b/tests/topotests/isis_lfa_topo1/rt1/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt1
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 1.1.1.1/32
diff --git a/tests/topotests/isis_lfa_topo1/rt2/isisd.conf b/tests/topotests/isis_lfa_topo1/rt2/isisd.conf
index 39ff2570d4..42dee00e60 100644
--- a/tests/topotests/isis_lfa_topo1/rt2/isisd.conf
+++ b/tests/topotests/isis_lfa_topo1/rt2/isisd.conf
@@ -2,10 +2,10 @@ password 1
hostname rt2
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis lsp-gen
!
interface lo
ipv6 router isis 1
diff --git a/tests/topotests/isis_lfa_topo1/rt2/zebra.conf b/tests/topotests/isis_lfa_topo1/rt2/zebra.conf
index 9feaada791..3372ec5033 100644
--- a/tests/topotests/isis_lfa_topo1/rt2/zebra.conf
+++ b/tests/topotests/isis_lfa_topo1/rt2/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt2
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 2.2.2.2/32
diff --git a/tests/topotests/isis_lfa_topo1/rt3/isisd.conf b/tests/topotests/isis_lfa_topo1/rt3/isisd.conf
index 8b0c7bd0dc..9dd813cff6 100644
--- a/tests/topotests/isis_lfa_topo1/rt3/isisd.conf
+++ b/tests/topotests/isis_lfa_topo1/rt3/isisd.conf
@@ -2,10 +2,10 @@ password 1
hostname rt3
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis lsp-gen
!
interface lo
ipv6 router isis 1
diff --git a/tests/topotests/isis_lfa_topo1/rt3/zebra.conf b/tests/topotests/isis_lfa_topo1/rt3/zebra.conf
index 48d732e72a..231b02b9bd 100644
--- a/tests/topotests/isis_lfa_topo1/rt3/zebra.conf
+++ b/tests/topotests/isis_lfa_topo1/rt3/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt3
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 3.3.3.3/32
diff --git a/tests/topotests/isis_lfa_topo1/rt4/isisd.conf b/tests/topotests/isis_lfa_topo1/rt4/isisd.conf
index 86edee6ab1..7500ff8d7b 100644
--- a/tests/topotests/isis_lfa_topo1/rt4/isisd.conf
+++ b/tests/topotests/isis_lfa_topo1/rt4/isisd.conf
@@ -2,10 +2,10 @@ password 1
hostname rt4
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis lsp-gen
!
interface lo
ipv6 router isis 1
diff --git a/tests/topotests/isis_lfa_topo1/rt4/zebra.conf b/tests/topotests/isis_lfa_topo1/rt4/zebra.conf
index bff10860cc..2d62924334 100644
--- a/tests/topotests/isis_lfa_topo1/rt4/zebra.conf
+++ b/tests/topotests/isis_lfa_topo1/rt4/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt4
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 4.4.4.4/32
diff --git a/tests/topotests/isis_lfa_topo1/rt5/isisd.conf b/tests/topotests/isis_lfa_topo1/rt5/isisd.conf
index 7a7cfe557d..5e022e9ad8 100644
--- a/tests/topotests/isis_lfa_topo1/rt5/isisd.conf
+++ b/tests/topotests/isis_lfa_topo1/rt5/isisd.conf
@@ -2,10 +2,10 @@ password 1
hostname rt5
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis lsp-gen
!
interface lo
ipv6 router isis 1
diff --git a/tests/topotests/isis_lfa_topo1/rt5/zebra.conf b/tests/topotests/isis_lfa_topo1/rt5/zebra.conf
index ee1e46c966..efb7bf6d12 100644
--- a/tests/topotests/isis_lfa_topo1/rt5/zebra.conf
+++ b/tests/topotests/isis_lfa_topo1/rt5/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt5
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 5.5.5.5/32
diff --git a/tests/topotests/isis_lfa_topo1/rt6/isisd.conf b/tests/topotests/isis_lfa_topo1/rt6/isisd.conf
index 20cb7769a4..d262e8a564 100644
--- a/tests/topotests/isis_lfa_topo1/rt6/isisd.conf
+++ b/tests/topotests/isis_lfa_topo1/rt6/isisd.conf
@@ -2,10 +2,10 @@ password 1
hostname rt6
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis lsp-gen
!
interface lo
ipv6 router isis 1
diff --git a/tests/topotests/isis_lfa_topo1/rt6/zebra.conf b/tests/topotests/isis_lfa_topo1/rt6/zebra.conf
index 4108078896..31650bd260 100644
--- a/tests/topotests/isis_lfa_topo1/rt6/zebra.conf
+++ b/tests/topotests/isis_lfa_topo1/rt6/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt6
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 6.6.6.6/32
diff --git a/tests/topotests/isis_lfa_topo1/rt7/isisd.conf b/tests/topotests/isis_lfa_topo1/rt7/isisd.conf
index 713e6d39f4..c2061236c3 100644
--- a/tests/topotests/isis_lfa_topo1/rt7/isisd.conf
+++ b/tests/topotests/isis_lfa_topo1/rt7/isisd.conf
@@ -2,10 +2,10 @@ password 1
hostname rt6
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis lsp-gen
!
interface lo
ipv6 router isis 1
diff --git a/tests/topotests/isis_lfa_topo1/rt7/zebra.conf b/tests/topotests/isis_lfa_topo1/rt7/zebra.conf
index 353c9efa93..4271ccea11 100644
--- a/tests/topotests/isis_lfa_topo1/rt7/zebra.conf
+++ b/tests/topotests/isis_lfa_topo1/rt7/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt7
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 7.7.7.7/32
diff --git a/tests/topotests/isis_lsp_bits_topo1/rt1/isisd.conf b/tests/topotests/isis_lsp_bits_topo1/rt1/isisd.conf
index 90764a0d0f..fc004e429b 100644
--- a/tests/topotests/isis_lsp_bits_topo1/rt1/isisd.conf
+++ b/tests/topotests/isis_lsp_bits_topo1/rt1/isisd.conf
@@ -2,11 +2,11 @@ password 1
hostname rt1
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis sr-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis sr-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_lsp_bits_topo1/rt1/zebra.conf b/tests/topotests/isis_lsp_bits_topo1/rt1/zebra.conf
index 9d71d3005f..37b3f27cae 100644
--- a/tests/topotests/isis_lsp_bits_topo1/rt1/zebra.conf
+++ b/tests/topotests/isis_lsp_bits_topo1/rt1/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt1
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 1.1.1.1/32
diff --git a/tests/topotests/isis_lsp_bits_topo1/rt2/isisd.conf b/tests/topotests/isis_lsp_bits_topo1/rt2/isisd.conf
index 2bc4c4ad97..d01720f4f0 100644
--- a/tests/topotests/isis_lsp_bits_topo1/rt2/isisd.conf
+++ b/tests/topotests/isis_lsp_bits_topo1/rt2/isisd.conf
@@ -1,11 +1,11 @@
hostname rt2
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis sr-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis sr-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_lsp_bits_topo1/rt2/zebra.conf b/tests/topotests/isis_lsp_bits_topo1/rt2/zebra.conf
index 234e10efa9..03acb6f272 100644
--- a/tests/topotests/isis_lsp_bits_topo1/rt2/zebra.conf
+++ b/tests/topotests/isis_lsp_bits_topo1/rt2/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt2
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 2.2.2.2/32
diff --git a/tests/topotests/isis_lsp_bits_topo1/rt3/isisd.conf b/tests/topotests/isis_lsp_bits_topo1/rt3/isisd.conf
index 9ad97109b5..a8d589678a 100644
--- a/tests/topotests/isis_lsp_bits_topo1/rt3/isisd.conf
+++ b/tests/topotests/isis_lsp_bits_topo1/rt3/isisd.conf
@@ -1,11 +1,11 @@
hostname rt3
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis sr-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis sr-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_lsp_bits_topo1/rt3/zebra.conf b/tests/topotests/isis_lsp_bits_topo1/rt3/zebra.conf
index 9a0defd62b..5f59be19b3 100644
--- a/tests/topotests/isis_lsp_bits_topo1/rt3/zebra.conf
+++ b/tests/topotests/isis_lsp_bits_topo1/rt3/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt3
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 3.3.3.3/32
diff --git a/tests/topotests/isis_lsp_bits_topo1/rt4/isisd.conf b/tests/topotests/isis_lsp_bits_topo1/rt4/isisd.conf
index e85412a71d..2d30790f29 100644
--- a/tests/topotests/isis_lsp_bits_topo1/rt4/isisd.conf
+++ b/tests/topotests/isis_lsp_bits_topo1/rt4/isisd.conf
@@ -1,11 +1,11 @@
hostname rt4
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis sr-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis sr-events
+! debug isis lsp-gen
!
interface lo
ip router isis 4
diff --git a/tests/topotests/isis_lsp_bits_topo1/rt4/zebra.conf b/tests/topotests/isis_lsp_bits_topo1/rt4/zebra.conf
index adcf433249..a567f3b864 100644
--- a/tests/topotests/isis_lsp_bits_topo1/rt4/zebra.conf
+++ b/tests/topotests/isis_lsp_bits_topo1/rt4/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt4
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 4.4.4.4/32
diff --git a/tests/topotests/isis_lsp_bits_topo1/rt5/isisd.conf b/tests/topotests/isis_lsp_bits_topo1/rt5/isisd.conf
index 2cab0c88fc..263c3f9478 100644
--- a/tests/topotests/isis_lsp_bits_topo1/rt5/isisd.conf
+++ b/tests/topotests/isis_lsp_bits_topo1/rt5/isisd.conf
@@ -1,11 +1,11 @@
hostname rt5
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis sr-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis sr-events
+! debug isis lsp-gen
!
interface lo
ip router isis 2
diff --git a/tests/topotests/isis_lsp_bits_topo1/rt5/zebra.conf b/tests/topotests/isis_lsp_bits_topo1/rt5/zebra.conf
index 0f10ce921f..50aedb3940 100644
--- a/tests/topotests/isis_lsp_bits_topo1/rt5/zebra.conf
+++ b/tests/topotests/isis_lsp_bits_topo1/rt5/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt5
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 5.5.5.5/32
diff --git a/tests/topotests/isis_lsp_bits_topo1/rt6/isisd.conf b/tests/topotests/isis_lsp_bits_topo1/rt6/isisd.conf
index 249f945e0c..505604ef33 100644
--- a/tests/topotests/isis_lsp_bits_topo1/rt6/isisd.conf
+++ b/tests/topotests/isis_lsp_bits_topo1/rt6/isisd.conf
@@ -1,11 +1,11 @@
hostname rt6
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis sr-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis sr-events
+! debug isis lsp-gen
!
interface lo
ip router isis 4
diff --git a/tests/topotests/isis_lsp_bits_topo1/rt6/zebra.conf b/tests/topotests/isis_lsp_bits_topo1/rt6/zebra.conf
index 6084010a93..4d51d3df84 100644
--- a/tests/topotests/isis_lsp_bits_topo1/rt6/zebra.conf
+++ b/tests/topotests/isis_lsp_bits_topo1/rt6/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt6
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 6.6.6.6/32
diff --git a/tests/topotests/isis_rlfa_topo1/rt1/isisd.conf b/tests/topotests/isis_rlfa_topo1/rt1/isisd.conf
index a80f30dc7b..f7f0a95e1c 100644
--- a/tests/topotests/isis_rlfa_topo1/rt1/isisd.conf
+++ b/tests/topotests/isis_rlfa_topo1/rt1/isisd.conf
@@ -2,10 +2,10 @@ password 1
hostname rt1
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_rlfa_topo1/rt1/ldpd.conf b/tests/topotests/isis_rlfa_topo1/rt1/ldpd.conf
index f60fdb9742..eb8589219e 100644
--- a/tests/topotests/isis_rlfa_topo1/rt1/ldpd.conf
+++ b/tests/topotests/isis_rlfa_topo1/rt1/ldpd.conf
@@ -2,9 +2,9 @@ log file ldpd.log
!
hostname rt1
!
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp zebra
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp zebra
!
mpls ldp
router-id 10.0.255.1
diff --git a/tests/topotests/isis_rlfa_topo1/rt1/zebra.conf b/tests/topotests/isis_rlfa_topo1/rt1/zebra.conf
index 741fc2d02b..6210b29950 100644
--- a/tests/topotests/isis_rlfa_topo1/rt1/zebra.conf
+++ b/tests/topotests/isis_rlfa_topo1/rt1/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt1
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 10.0.255.1/32
diff --git a/tests/topotests/isis_rlfa_topo1/rt2/isisd.conf b/tests/topotests/isis_rlfa_topo1/rt2/isisd.conf
index 7b4c6c50b9..6595052fab 100644
--- a/tests/topotests/isis_rlfa_topo1/rt2/isisd.conf
+++ b/tests/topotests/isis_rlfa_topo1/rt2/isisd.conf
@@ -2,10 +2,10 @@ password 1
hostname rt2
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_rlfa_topo1/rt2/ldpd.conf b/tests/topotests/isis_rlfa_topo1/rt2/ldpd.conf
index 0a815ef004..25882be67a 100644
--- a/tests/topotests/isis_rlfa_topo1/rt2/ldpd.conf
+++ b/tests/topotests/isis_rlfa_topo1/rt2/ldpd.conf
@@ -2,9 +2,9 @@ log file ldpd.log
!
hostname rt2
!
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp zebra
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp zebra
!
mpls ldp
router-id 10.0.255.2
diff --git a/tests/topotests/isis_rlfa_topo1/rt2/zebra.conf b/tests/topotests/isis_rlfa_topo1/rt2/zebra.conf
index 657c69bf28..38c561d475 100644
--- a/tests/topotests/isis_rlfa_topo1/rt2/zebra.conf
+++ b/tests/topotests/isis_rlfa_topo1/rt2/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt2
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 10.0.255.2/32
diff --git a/tests/topotests/isis_rlfa_topo1/rt3/isisd.conf b/tests/topotests/isis_rlfa_topo1/rt3/isisd.conf
index 17d58a9d15..a029b7140f 100644
--- a/tests/topotests/isis_rlfa_topo1/rt3/isisd.conf
+++ b/tests/topotests/isis_rlfa_topo1/rt3/isisd.conf
@@ -2,10 +2,10 @@ password 1
hostname rt3
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_rlfa_topo1/rt3/ldpd.conf b/tests/topotests/isis_rlfa_topo1/rt3/ldpd.conf
index 40f1f5587a..8f2234a207 100644
--- a/tests/topotests/isis_rlfa_topo1/rt3/ldpd.conf
+++ b/tests/topotests/isis_rlfa_topo1/rt3/ldpd.conf
@@ -2,9 +2,9 @@ log file ldpd.log
!
hostname rt3
!
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp zebra
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp zebra
!
mpls ldp
router-id 10.0.255.3
diff --git a/tests/topotests/isis_rlfa_topo1/rt3/zebra.conf b/tests/topotests/isis_rlfa_topo1/rt3/zebra.conf
index 86f5d2871a..21557645d8 100644
--- a/tests/topotests/isis_rlfa_topo1/rt3/zebra.conf
+++ b/tests/topotests/isis_rlfa_topo1/rt3/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt3
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 10.0.255.3/32
diff --git a/tests/topotests/isis_rlfa_topo1/rt4/isisd.conf b/tests/topotests/isis_rlfa_topo1/rt4/isisd.conf
index 1519fd4c16..86aa6b1f46 100644
--- a/tests/topotests/isis_rlfa_topo1/rt4/isisd.conf
+++ b/tests/topotests/isis_rlfa_topo1/rt4/isisd.conf
@@ -2,10 +2,10 @@ password 1
hostname rt4
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_rlfa_topo1/rt4/ldpd.conf b/tests/topotests/isis_rlfa_topo1/rt4/ldpd.conf
index 569ecf733e..c8d467c518 100644
--- a/tests/topotests/isis_rlfa_topo1/rt4/ldpd.conf
+++ b/tests/topotests/isis_rlfa_topo1/rt4/ldpd.conf
@@ -2,9 +2,9 @@ log file ldpd.log
!
hostname rt4
!
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp zebra
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp zebra
!
mpls ldp
router-id 10.0.255.4
diff --git a/tests/topotests/isis_rlfa_topo1/rt4/zebra.conf b/tests/topotests/isis_rlfa_topo1/rt4/zebra.conf
index 1dd09bf83b..4e22813b94 100644
--- a/tests/topotests/isis_rlfa_topo1/rt4/zebra.conf
+++ b/tests/topotests/isis_rlfa_topo1/rt4/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt4
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 10.0.255.4/32
diff --git a/tests/topotests/isis_rlfa_topo1/rt5/isisd.conf b/tests/topotests/isis_rlfa_topo1/rt5/isisd.conf
index caf7477073..e4fc9cdd4c 100644
--- a/tests/topotests/isis_rlfa_topo1/rt5/isisd.conf
+++ b/tests/topotests/isis_rlfa_topo1/rt5/isisd.conf
@@ -2,10 +2,10 @@ password 1
hostname rt5
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_rlfa_topo1/rt5/ldpd.conf b/tests/topotests/isis_rlfa_topo1/rt5/ldpd.conf
index 519c3d3628..c5fc36a61c 100644
--- a/tests/topotests/isis_rlfa_topo1/rt5/ldpd.conf
+++ b/tests/topotests/isis_rlfa_topo1/rt5/ldpd.conf
@@ -2,9 +2,9 @@ log file ldpd.log
!
hostname rt5
!
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp zebra
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp zebra
!
mpls ldp
router-id 10.0.255.5
diff --git a/tests/topotests/isis_rlfa_topo1/rt5/zebra.conf b/tests/topotests/isis_rlfa_topo1/rt5/zebra.conf
index 7117a2a2e3..83bbb1ba4d 100644
--- a/tests/topotests/isis_rlfa_topo1/rt5/zebra.conf
+++ b/tests/topotests/isis_rlfa_topo1/rt5/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt5
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 10.0.255.5/32
diff --git a/tests/topotests/isis_rlfa_topo1/rt6/isisd.conf b/tests/topotests/isis_rlfa_topo1/rt6/isisd.conf
index cdf6267236..81319e4264 100644
--- a/tests/topotests/isis_rlfa_topo1/rt6/isisd.conf
+++ b/tests/topotests/isis_rlfa_topo1/rt6/isisd.conf
@@ -2,10 +2,10 @@ password 1
hostname rt6
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_rlfa_topo1/rt6/ldpd.conf b/tests/topotests/isis_rlfa_topo1/rt6/ldpd.conf
index a5b7062bec..11bed3ce30 100644
--- a/tests/topotests/isis_rlfa_topo1/rt6/ldpd.conf
+++ b/tests/topotests/isis_rlfa_topo1/rt6/ldpd.conf
@@ -2,9 +2,9 @@ log file ldpd.log
!
hostname rt6
!
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp zebra
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp zebra
!
mpls ldp
router-id 10.0.255.6
diff --git a/tests/topotests/isis_rlfa_topo1/rt6/zebra.conf b/tests/topotests/isis_rlfa_topo1/rt6/zebra.conf
index c6344870b7..1fdd0d4b61 100644
--- a/tests/topotests/isis_rlfa_topo1/rt6/zebra.conf
+++ b/tests/topotests/isis_rlfa_topo1/rt6/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt6
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 10.0.255.6/32
diff --git a/tests/topotests/isis_rlfa_topo1/rt7/isisd.conf b/tests/topotests/isis_rlfa_topo1/rt7/isisd.conf
index 8ab8fcb232..1f48671e74 100644
--- a/tests/topotests/isis_rlfa_topo1/rt7/isisd.conf
+++ b/tests/topotests/isis_rlfa_topo1/rt7/isisd.conf
@@ -2,10 +2,10 @@ password 1
hostname rt7
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_rlfa_topo1/rt7/ldpd.conf b/tests/topotests/isis_rlfa_topo1/rt7/ldpd.conf
index 26d428c4c6..6c40ccb33c 100644
--- a/tests/topotests/isis_rlfa_topo1/rt7/ldpd.conf
+++ b/tests/topotests/isis_rlfa_topo1/rt7/ldpd.conf
@@ -2,9 +2,9 @@ log file ldpd.log
!
hostname rt7
!
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp zebra
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp zebra
!
mpls ldp
router-id 10.0.255.7
diff --git a/tests/topotests/isis_rlfa_topo1/rt7/zebra.conf b/tests/topotests/isis_rlfa_topo1/rt7/zebra.conf
index 4c5e0f1126..114ebd93a6 100644
--- a/tests/topotests/isis_rlfa_topo1/rt7/zebra.conf
+++ b/tests/topotests/isis_rlfa_topo1/rt7/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt7
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 10.0.255.7/32
diff --git a/tests/topotests/isis_rlfa_topo1/rt8/isisd.conf b/tests/topotests/isis_rlfa_topo1/rt8/isisd.conf
index abdc6a53a5..7675f777a7 100644
--- a/tests/topotests/isis_rlfa_topo1/rt8/isisd.conf
+++ b/tests/topotests/isis_rlfa_topo1/rt8/isisd.conf
@@ -2,10 +2,10 @@ password 1
hostname rt8
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_rlfa_topo1/rt8/ldpd.conf b/tests/topotests/isis_rlfa_topo1/rt8/ldpd.conf
index 1629f82de1..36e7ce12a9 100644
--- a/tests/topotests/isis_rlfa_topo1/rt8/ldpd.conf
+++ b/tests/topotests/isis_rlfa_topo1/rt8/ldpd.conf
@@ -2,9 +2,9 @@ log file ldpd.log
!
hostname rt8
!
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp zebra
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp zebra
!
mpls ldp
router-id 10.0.255.8
diff --git a/tests/topotests/isis_rlfa_topo1/rt8/zebra.conf b/tests/topotests/isis_rlfa_topo1/rt8/zebra.conf
index f3f10f649a..001e62ed25 100644
--- a/tests/topotests/isis_rlfa_topo1/rt8/zebra.conf
+++ b/tests/topotests/isis_rlfa_topo1/rt8/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt8
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 10.0.255.8/32
diff --git a/tests/topotests/isis_snmp/r1/isisd.conf b/tests/topotests/isis_snmp/r1/isisd.conf
index dd32d3b8a5..4928341225 100644
--- a/tests/topotests/isis_snmp/r1/isisd.conf
+++ b/tests/topotests/isis_snmp/r1/isisd.conf
@@ -1,8 +1,8 @@
hostname r1
log file isisd.log
-debug isis adj-packets
-debug isis events
-debug isis update-packets
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
agentx
!
router isis 1
diff --git a/tests/topotests/isis_snmp/r1/ldpd.conf b/tests/topotests/isis_snmp/r1/ldpd.conf
index 4ec296ca5a..5b1cbfebc9 100644
--- a/tests/topotests/isis_snmp/r1/ldpd.conf
+++ b/tests/topotests/isis_snmp/r1/ldpd.conf
@@ -1,10 +1,10 @@
hostname r1
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp sync
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp sync
agentx
!
mpls ldp
diff --git a/tests/topotests/isis_snmp/r1/zebra.conf b/tests/topotests/isis_snmp/r1/zebra.conf
index 6ac341e431..4ca46da805 100644
--- a/tests/topotests/isis_snmp/r1/zebra.conf
+++ b/tests/topotests/isis_snmp/r1/zebra.conf
@@ -2,10 +2,10 @@ log file zebra.log
!
hostname r1
!
-debug zebra kernel
-debug zebra rib detailed
-debug zebra dplane detailed
-debug zebra nht
+! debug zebra kernel
+! debug zebra rib detailed
+! debug zebra dplane detailed
+! debug zebra nht
!
interface lo
ip address 1.1.1.1/32
diff --git a/tests/topotests/isis_snmp/r2/isisd.conf b/tests/topotests/isis_snmp/r2/isisd.conf
index 4403d8913b..9bb8a8d5f9 100644
--- a/tests/topotests/isis_snmp/r2/isisd.conf
+++ b/tests/topotests/isis_snmp/r2/isisd.conf
@@ -1,8 +1,8 @@
hostname r2
log file isisd.log
-debug isis adj-packets
-debug isis events
-debug isis update-packets
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
agentx
!
router isis 1
diff --git a/tests/topotests/isis_snmp/r2/ldpd.conf b/tests/topotests/isis_snmp/r2/ldpd.conf
index eb963fe41c..533d2d9d49 100644
--- a/tests/topotests/isis_snmp/r2/ldpd.conf
+++ b/tests/topotests/isis_snmp/r2/ldpd.conf
@@ -1,10 +1,10 @@
hostname r2
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp sync
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp sync
!
mpls ldp
router-id 2.2.2.2
diff --git a/tests/topotests/isis_snmp/r2/zebra.conf b/tests/topotests/isis_snmp/r2/zebra.conf
index 4aa7440c33..9f6e3d5359 100644
--- a/tests/topotests/isis_snmp/r2/zebra.conf
+++ b/tests/topotests/isis_snmp/r2/zebra.conf
@@ -2,10 +2,10 @@ log file zebra.log
!
hostname r2
!
-debug zebra rib detailed
-debug zebra dplane detailed
-debug zebra kernel
-debug zebra nht
+! debug zebra rib detailed
+! debug zebra dplane detailed
+! debug zebra kernel
+! debug zebra nht
!
interface lo
ip address 2.2.2.2/32
diff --git a/tests/topotests/isis_snmp/r3/isisd.conf b/tests/topotests/isis_snmp/r3/isisd.conf
index e06fe8c1f9..4daec791b3 100644
--- a/tests/topotests/isis_snmp/r3/isisd.conf
+++ b/tests/topotests/isis_snmp/r3/isisd.conf
@@ -1,8 +1,8 @@
hostname r3
log file isisd.log
-debug isis adj-packets
-debug isis events
-debug isis update-packets
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
agentx
!
router isis 1
diff --git a/tests/topotests/isis_snmp/r3/ldpd.conf b/tests/topotests/isis_snmp/r3/ldpd.conf
index 2935caf13b..fae25e0710 100644
--- a/tests/topotests/isis_snmp/r3/ldpd.conf
+++ b/tests/topotests/isis_snmp/r3/ldpd.conf
@@ -1,10 +1,10 @@
hostname r3
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp sync
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp sync
!
mpls ldp
router-id 3.3.3.3
diff --git a/tests/topotests/isis_snmp/r3/zebra.conf b/tests/topotests/isis_snmp/r3/zebra.conf
index 6b76114d4d..4e6bddd296 100644
--- a/tests/topotests/isis_snmp/r3/zebra.conf
+++ b/tests/topotests/isis_snmp/r3/zebra.conf
@@ -2,10 +2,10 @@ log file zebra.log
!
hostname r3
!
-debug zebra rib detailed
-debug zebra dplane detailed
-debug zebra kernel
-debug zebra nht
+! debug zebra rib detailed
+! debug zebra dplane detailed
+! debug zebra kernel
+! debug zebra nht
!
interface lo
ip address 3.3.3.3/32
diff --git a/tests/topotests/isis_snmp/r4/isisd.conf b/tests/topotests/isis_snmp/r4/isisd.conf
index 1256141da9..32b07b3cb4 100644
--- a/tests/topotests/isis_snmp/r4/isisd.conf
+++ b/tests/topotests/isis_snmp/r4/isisd.conf
@@ -1,8 +1,8 @@
hostname r4
log file isisd.log
-debug isis adj-packets
-debug isis events
-debug isis update-packets
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
agentx
!
router isis 1
diff --git a/tests/topotests/isis_snmp/r4/ldpd.conf b/tests/topotests/isis_snmp/r4/ldpd.conf
index b27952514b..dbffdff42c 100644
--- a/tests/topotests/isis_snmp/r4/ldpd.conf
+++ b/tests/topotests/isis_snmp/r4/ldpd.conf
@@ -1,10 +1,10 @@
hostname r4
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp sync
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp sync
!
mpls ldp
router-id 4.4.4.4
diff --git a/tests/topotests/isis_snmp/r4/zebra.conf b/tests/topotests/isis_snmp/r4/zebra.conf
index fa13601164..66b8ea3de8 100644
--- a/tests/topotests/isis_snmp/r4/zebra.conf
+++ b/tests/topotests/isis_snmp/r4/zebra.conf
@@ -2,10 +2,10 @@ log file zebra.log
!
hostname r4
!
-debug zebra rib detailed
-debug zebra dplane detailed
-debug zebra kernel
-debug zebra nht
+! debug zebra rib detailed
+! debug zebra dplane detailed
+! debug zebra kernel
+! debug zebra nht
!
interface lo
ip address 4.4.4.4/32
diff --git a/tests/topotests/isis_snmp/r5/isisd.conf b/tests/topotests/isis_snmp/r5/isisd.conf
index 58859041a9..fe3ca0f3aa 100644
--- a/tests/topotests/isis_snmp/r5/isisd.conf
+++ b/tests/topotests/isis_snmp/r5/isisd.conf
@@ -1,8 +1,8 @@
hostname r5
log file isisd.log
-debug isis adj-packets
-debug isis events
-debug isis update-packets
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
agentx
!
router isis 1
diff --git a/tests/topotests/isis_snmp/r5/ldpd.conf b/tests/topotests/isis_snmp/r5/ldpd.conf
index f3ba867a9f..fd273d5dae 100644
--- a/tests/topotests/isis_snmp/r5/ldpd.conf
+++ b/tests/topotests/isis_snmp/r5/ldpd.conf
@@ -1,10 +1,10 @@
hostname r5
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp sync
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp sync
!
mpls ldp
router-id 5.5.5.5
diff --git a/tests/topotests/isis_snmp/r5/zebra.conf b/tests/topotests/isis_snmp/r5/zebra.conf
index 7230129f22..5607fab9cd 100644
--- a/tests/topotests/isis_snmp/r5/zebra.conf
+++ b/tests/topotests/isis_snmp/r5/zebra.conf
@@ -2,10 +2,10 @@ log file zebra.log
!
hostname r5
!
-debug zebra rib detailed
-debug zebra dplane detailed
-debug zebra kernel
-debug zebra nht
+! debug zebra rib detailed
+! debug zebra dplane detailed
+! debug zebra kernel
+! debug zebra nht
!
interface lo
ip address 5.5.5.5/32
diff --git a/tests/topotests/isis_sr_te_topo1/dst/zebra.conf b/tests/topotests/isis_sr_te_topo1/dst/zebra.conf
index e873ac8a5c..0c7937b9bb 100644
--- a/tests/topotests/isis_sr_te_topo1/dst/zebra.conf
+++ b/tests/topotests/isis_sr_te_topo1/dst/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname dst
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 9.9.9.2/32
diff --git a/tests/topotests/isis_sr_te_topo1/rt1/isisd.conf b/tests/topotests/isis_sr_te_topo1/rt1/isisd.conf
index 70ae1b07f5..3d5ac20451 100644
--- a/tests/topotests/isis_sr_te_topo1/rt1/isisd.conf
+++ b/tests/topotests/isis_sr_te_topo1/rt1/isisd.conf
@@ -2,11 +2,11 @@ password 1
hostname rt1
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis sr-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis sr-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_sr_te_topo1/rt1/zebra.conf b/tests/topotests/isis_sr_te_topo1/rt1/zebra.conf
index 9d71d3005f..37b3f27cae 100644
--- a/tests/topotests/isis_sr_te_topo1/rt1/zebra.conf
+++ b/tests/topotests/isis_sr_te_topo1/rt1/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt1
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 1.1.1.1/32
diff --git a/tests/topotests/isis_sr_te_topo1/rt2/isisd.conf b/tests/topotests/isis_sr_te_topo1/rt2/isisd.conf
index 733f26bc62..ba214c92c1 100644
--- a/tests/topotests/isis_sr_te_topo1/rt2/isisd.conf
+++ b/tests/topotests/isis_sr_te_topo1/rt2/isisd.conf
@@ -1,11 +1,11 @@
hostname rt2
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis sr-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis sr-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_sr_te_topo1/rt2/zebra.conf b/tests/topotests/isis_sr_te_topo1/rt2/zebra.conf
index dcb0686dc2..f9ac098f4f 100644
--- a/tests/topotests/isis_sr_te_topo1/rt2/zebra.conf
+++ b/tests/topotests/isis_sr_te_topo1/rt2/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt2
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 2.2.2.2/32
diff --git a/tests/topotests/isis_sr_te_topo1/rt3/isisd.conf b/tests/topotests/isis_sr_te_topo1/rt3/isisd.conf
index 2395906cbf..482d8152c2 100644
--- a/tests/topotests/isis_sr_te_topo1/rt3/isisd.conf
+++ b/tests/topotests/isis_sr_te_topo1/rt3/isisd.conf
@@ -1,11 +1,11 @@
hostname rt3
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis sr-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis sr-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_sr_te_topo1/rt3/zebra.conf b/tests/topotests/isis_sr_te_topo1/rt3/zebra.conf
index 3254529386..441c9a3aca 100644
--- a/tests/topotests/isis_sr_te_topo1/rt3/zebra.conf
+++ b/tests/topotests/isis_sr_te_topo1/rt3/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt3
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 3.3.3.3/32
diff --git a/tests/topotests/isis_sr_te_topo1/rt4/isisd.conf b/tests/topotests/isis_sr_te_topo1/rt4/isisd.conf
index 07a7867cbb..851c6da019 100644
--- a/tests/topotests/isis_sr_te_topo1/rt4/isisd.conf
+++ b/tests/topotests/isis_sr_te_topo1/rt4/isisd.conf
@@ -1,11 +1,11 @@
hostname rt4
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis sr-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis sr-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_sr_te_topo1/rt4/zebra.conf b/tests/topotests/isis_sr_te_topo1/rt4/zebra.conf
index 4945897e9d..a2569aa51f 100644
--- a/tests/topotests/isis_sr_te_topo1/rt4/zebra.conf
+++ b/tests/topotests/isis_sr_te_topo1/rt4/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt4
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 4.4.4.4/32
diff --git a/tests/topotests/isis_sr_te_topo1/rt5/isisd.conf b/tests/topotests/isis_sr_te_topo1/rt5/isisd.conf
index b0fcdede07..4cc54f318c 100644
--- a/tests/topotests/isis_sr_te_topo1/rt5/isisd.conf
+++ b/tests/topotests/isis_sr_te_topo1/rt5/isisd.conf
@@ -1,11 +1,11 @@
hostname rt5
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis sr-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis sr-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_sr_te_topo1/rt5/zebra.conf b/tests/topotests/isis_sr_te_topo1/rt5/zebra.conf
index 4cfea1a59f..f62cc8ffd3 100644
--- a/tests/topotests/isis_sr_te_topo1/rt5/zebra.conf
+++ b/tests/topotests/isis_sr_te_topo1/rt5/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt5
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 5.5.5.5/32
diff --git a/tests/topotests/isis_sr_te_topo1/rt6/isisd.conf b/tests/topotests/isis_sr_te_topo1/rt6/isisd.conf
index 3be24ad24c..8fec87b929 100644
--- a/tests/topotests/isis_sr_te_topo1/rt6/isisd.conf
+++ b/tests/topotests/isis_sr_te_topo1/rt6/isisd.conf
@@ -1,11 +1,11 @@
hostname rt6
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis sr-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis sr-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_sr_te_topo1/rt6/zebra.conf b/tests/topotests/isis_sr_te_topo1/rt6/zebra.conf
index 32c6e6c4e0..f2f1a3eefe 100644
--- a/tests/topotests/isis_sr_te_topo1/rt6/zebra.conf
+++ b/tests/topotests/isis_sr_te_topo1/rt6/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt6
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 6.6.6.6/32
diff --git a/tests/topotests/isis_sr_topo1/rt1/isisd.conf b/tests/topotests/isis_sr_topo1/rt1/isisd.conf
index f441527597..ed09753d20 100644
--- a/tests/topotests/isis_sr_topo1/rt1/isisd.conf
+++ b/tests/topotests/isis_sr_topo1/rt1/isisd.conf
@@ -2,11 +2,11 @@ password 1
hostname rt1
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis sr-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis sr-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_sr_topo1/rt1/zebra.conf b/tests/topotests/isis_sr_topo1/rt1/zebra.conf
index 9d71d3005f..37b3f27cae 100644
--- a/tests/topotests/isis_sr_topo1/rt1/zebra.conf
+++ b/tests/topotests/isis_sr_topo1/rt1/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt1
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 1.1.1.1/32
diff --git a/tests/topotests/isis_sr_topo1/rt2/isisd.conf b/tests/topotests/isis_sr_topo1/rt2/isisd.conf
index 796b6ed32c..9b8efe40e9 100644
--- a/tests/topotests/isis_sr_topo1/rt2/isisd.conf
+++ b/tests/topotests/isis_sr_topo1/rt2/isisd.conf
@@ -1,11 +1,11 @@
hostname rt2
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis sr-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis sr-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_sr_topo1/rt2/zebra.conf b/tests/topotests/isis_sr_topo1/rt2/zebra.conf
index dcb0686dc2..f9ac098f4f 100644
--- a/tests/topotests/isis_sr_topo1/rt2/zebra.conf
+++ b/tests/topotests/isis_sr_topo1/rt2/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt2
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 2.2.2.2/32
diff --git a/tests/topotests/isis_sr_topo1/rt3/isisd.conf b/tests/topotests/isis_sr_topo1/rt3/isisd.conf
index cc2aa1782b..ded8bd1576 100644
--- a/tests/topotests/isis_sr_topo1/rt3/isisd.conf
+++ b/tests/topotests/isis_sr_topo1/rt3/isisd.conf
@@ -1,11 +1,11 @@
hostname rt3
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis sr-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis sr-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_sr_topo1/rt3/zebra.conf b/tests/topotests/isis_sr_topo1/rt3/zebra.conf
index 3254529386..441c9a3aca 100644
--- a/tests/topotests/isis_sr_topo1/rt3/zebra.conf
+++ b/tests/topotests/isis_sr_topo1/rt3/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt3
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 3.3.3.3/32
diff --git a/tests/topotests/isis_sr_topo1/rt4/isisd.conf b/tests/topotests/isis_sr_topo1/rt4/isisd.conf
index 3852b1962b..ba9704531c 100644
--- a/tests/topotests/isis_sr_topo1/rt4/isisd.conf
+++ b/tests/topotests/isis_sr_topo1/rt4/isisd.conf
@@ -1,11 +1,11 @@
hostname rt4
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis sr-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis sr-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_sr_topo1/rt4/zebra.conf b/tests/topotests/isis_sr_topo1/rt4/zebra.conf
index 5889901c56..b66a9afcb5 100644
--- a/tests/topotests/isis_sr_topo1/rt4/zebra.conf
+++ b/tests/topotests/isis_sr_topo1/rt4/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt4
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 4.4.4.4/32
diff --git a/tests/topotests/isis_sr_topo1/rt5/isisd.conf b/tests/topotests/isis_sr_topo1/rt5/isisd.conf
index f7beea796c..3fe7bdf1b2 100644
--- a/tests/topotests/isis_sr_topo1/rt5/isisd.conf
+++ b/tests/topotests/isis_sr_topo1/rt5/isisd.conf
@@ -1,11 +1,11 @@
hostname rt5
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis sr-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis sr-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_sr_topo1/rt5/zebra.conf b/tests/topotests/isis_sr_topo1/rt5/zebra.conf
index a0c8f2cd7e..90ceb817fa 100644
--- a/tests/topotests/isis_sr_topo1/rt5/zebra.conf
+++ b/tests/topotests/isis_sr_topo1/rt5/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt5
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 5.5.5.5/32
diff --git a/tests/topotests/isis_sr_topo1/rt6/isisd.conf b/tests/topotests/isis_sr_topo1/rt6/isisd.conf
index a29b78f0a4..e7a7e2dfd4 100644
--- a/tests/topotests/isis_sr_topo1/rt6/isisd.conf
+++ b/tests/topotests/isis_sr_topo1/rt6/isisd.conf
@@ -1,11 +1,11 @@
hostname rt6
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis sr-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis sr-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_sr_topo1/rt6/zebra.conf b/tests/topotests/isis_sr_topo1/rt6/zebra.conf
index 6084010a93..4d51d3df84 100644
--- a/tests/topotests/isis_sr_topo1/rt6/zebra.conf
+++ b/tests/topotests/isis_sr_topo1/rt6/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt6
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 6.6.6.6/32
diff --git a/tests/topotests/isis_tilfa_topo1/rt1/isisd.conf b/tests/topotests/isis_tilfa_topo1/rt1/isisd.conf
index a447a2aa5a..955bd5caa0 100644
--- a/tests/topotests/isis_tilfa_topo1/rt1/isisd.conf
+++ b/tests/topotests/isis_tilfa_topo1/rt1/isisd.conf
@@ -2,11 +2,11 @@ password 1
hostname rt1
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis sr-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis sr-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_tilfa_topo1/rt1/zebra.conf b/tests/topotests/isis_tilfa_topo1/rt1/zebra.conf
index 9d71d3005f..37b3f27cae 100644
--- a/tests/topotests/isis_tilfa_topo1/rt1/zebra.conf
+++ b/tests/topotests/isis_tilfa_topo1/rt1/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt1
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 1.1.1.1/32
diff --git a/tests/topotests/isis_tilfa_topo1/rt2/isisd.conf b/tests/topotests/isis_tilfa_topo1/rt2/isisd.conf
index 1a756e2c72..f971c658d4 100644
--- a/tests/topotests/isis_tilfa_topo1/rt2/isisd.conf
+++ b/tests/topotests/isis_tilfa_topo1/rt2/isisd.conf
@@ -1,11 +1,11 @@
hostname rt2
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis sr-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis sr-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_tilfa_topo1/rt2/zebra.conf b/tests/topotests/isis_tilfa_topo1/rt2/zebra.conf
index dcb0686dc2..f9ac098f4f 100644
--- a/tests/topotests/isis_tilfa_topo1/rt2/zebra.conf
+++ b/tests/topotests/isis_tilfa_topo1/rt2/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt2
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 2.2.2.2/32
diff --git a/tests/topotests/isis_tilfa_topo1/rt3/isisd.conf b/tests/topotests/isis_tilfa_topo1/rt3/isisd.conf
index 986bf2804a..64f091cfed 100644
--- a/tests/topotests/isis_tilfa_topo1/rt3/isisd.conf
+++ b/tests/topotests/isis_tilfa_topo1/rt3/isisd.conf
@@ -1,11 +1,11 @@
hostname rt3
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis sr-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis sr-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_tilfa_topo1/rt3/zebra.conf b/tests/topotests/isis_tilfa_topo1/rt3/zebra.conf
index 3254529386..441c9a3aca 100644
--- a/tests/topotests/isis_tilfa_topo1/rt3/zebra.conf
+++ b/tests/topotests/isis_tilfa_topo1/rt3/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt3
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 3.3.3.3/32
diff --git a/tests/topotests/isis_tilfa_topo1/rt4/isisd.conf b/tests/topotests/isis_tilfa_topo1/rt4/isisd.conf
index 7d411069d1..9223852f79 100644
--- a/tests/topotests/isis_tilfa_topo1/rt4/isisd.conf
+++ b/tests/topotests/isis_tilfa_topo1/rt4/isisd.conf
@@ -1,11 +1,11 @@
hostname rt4
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis sr-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis sr-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_tilfa_topo1/rt4/zebra.conf b/tests/topotests/isis_tilfa_topo1/rt4/zebra.conf
index 4945897e9d..a2569aa51f 100644
--- a/tests/topotests/isis_tilfa_topo1/rt4/zebra.conf
+++ b/tests/topotests/isis_tilfa_topo1/rt4/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt4
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 4.4.4.4/32
diff --git a/tests/topotests/isis_tilfa_topo1/rt5/isisd.conf b/tests/topotests/isis_tilfa_topo1/rt5/isisd.conf
index be52eb0322..a08534cf30 100644
--- a/tests/topotests/isis_tilfa_topo1/rt5/isisd.conf
+++ b/tests/topotests/isis_tilfa_topo1/rt5/isisd.conf
@@ -1,11 +1,11 @@
hostname rt5
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis sr-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis sr-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_tilfa_topo1/rt5/zebra.conf b/tests/topotests/isis_tilfa_topo1/rt5/zebra.conf
index 4cfea1a59f..f62cc8ffd3 100644
--- a/tests/topotests/isis_tilfa_topo1/rt5/zebra.conf
+++ b/tests/topotests/isis_tilfa_topo1/rt5/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt5
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 5.5.5.5/32
diff --git a/tests/topotests/isis_tilfa_topo1/rt6/isisd.conf b/tests/topotests/isis_tilfa_topo1/rt6/isisd.conf
index db47622a10..d92f822b8d 100644
--- a/tests/topotests/isis_tilfa_topo1/rt6/isisd.conf
+++ b/tests/topotests/isis_tilfa_topo1/rt6/isisd.conf
@@ -1,11 +1,11 @@
hostname rt6
log file isisd.log
!
-debug isis events
-debug isis route-events
-debug isis spf-events
-debug isis sr-events
-debug isis lsp-gen
+! debug isis events
+! debug isis route-events
+! debug isis spf-events
+! debug isis sr-events
+! debug isis lsp-gen
!
interface lo
ip router isis 1
diff --git a/tests/topotests/isis_tilfa_topo1/rt6/zebra.conf b/tests/topotests/isis_tilfa_topo1/rt6/zebra.conf
index 6084010a93..4d51d3df84 100644
--- a/tests/topotests/isis_tilfa_topo1/rt6/zebra.conf
+++ b/tests/topotests/isis_tilfa_topo1/rt6/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt6
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 6.6.6.6/32
diff --git a/tests/topotests/isis_topo1/r1/isisd.conf b/tests/topotests/isis_topo1/r1/isisd.conf
index 4e3761e5a1..9c1bfffdfb 100644
--- a/tests/topotests/isis_topo1/r1/isisd.conf
+++ b/tests/topotests/isis_topo1/r1/isisd.conf
@@ -1,7 +1,7 @@
hostname r1
-debug isis adj-packets
-debug isis events
-debug isis update-packets
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
interface r1-eth0
ip router isis 1
isis hello-interval 2
diff --git a/tests/topotests/isis_topo1/r2/isisd.conf b/tests/topotests/isis_topo1/r2/isisd.conf
index 14db0940ec..e8b578939b 100644
--- a/tests/topotests/isis_topo1/r2/isisd.conf
+++ b/tests/topotests/isis_topo1/r2/isisd.conf
@@ -1,7 +1,7 @@
hostname r2
-debug isis adj-packets
-debug isis events
-debug isis update-packets
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
interface r2-eth0
ip router isis 1
isis hello-interval 2
diff --git a/tests/topotests/isis_topo1/r3/isisd.conf b/tests/topotests/isis_topo1/r3/isisd.conf
index 6f36c0fa36..47bfc5359c 100644
--- a/tests/topotests/isis_topo1/r3/isisd.conf
+++ b/tests/topotests/isis_topo1/r3/isisd.conf
@@ -1,7 +1,7 @@
hostname r3
-debug isis adj-packets
-debug isis events
-debug isis update-packets
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
interface r3-eth0
ip router isis 1
isis hello-interval 2
diff --git a/tests/topotests/isis_topo1/r4/isisd.conf b/tests/topotests/isis_topo1/r4/isisd.conf
index 502e035f50..50c876db92 100644
--- a/tests/topotests/isis_topo1/r4/isisd.conf
+++ b/tests/topotests/isis_topo1/r4/isisd.conf
@@ -1,7 +1,7 @@
hostname r4
-debug isis adj-packets
-debug isis events
-debug isis update-packets
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
interface r4-eth0
ip router isis 1
isis hello-interval 2
diff --git a/tests/topotests/isis_topo1/r5/isisd.conf b/tests/topotests/isis_topo1/r5/isisd.conf
index 42493a4991..e0e9200d62 100644
--- a/tests/topotests/isis_topo1/r5/isisd.conf
+++ b/tests/topotests/isis_topo1/r5/isisd.conf
@@ -1,7 +1,7 @@
hostname r5
-debug isis adj-packets
-debug isis events
-debug isis update-packets
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
interface r5-eth0
ip router isis 1
isis hello-interval 2
diff --git a/tests/topotests/isis_topo1/test_isis_topo1.py b/tests/topotests/isis_topo1/test_isis_topo1.py
index df63de76de..94c5faf2e0 100644
--- a/tests/topotests/isis_topo1/test_isis_topo1.py
+++ b/tests/topotests/isis_topo1/test_isis_topo1.py
@@ -161,9 +161,16 @@ def test_isis_route_installation():
for rname, router in tgen.routers().items():
filename = "{0}/{1}/{1}_route.json".format(CWD, rname)
expected = json.loads(open(filename, "r").read())
- actual = router.vtysh_cmd("show ip route json", isjson=True)
+
+ def compare_isis_installed_routes(router, expected):
+ "Helper function to test ISIS routes installed in rib."
+ actual = router.vtysh_cmd("show ip route json", isjson=True)
+ return topotest.json_cmp(actual, expected)
+
+ test_func = functools.partial(compare_isis_installed_routes, router, expected)
+ (result, diff) = topotest.run_and_expect(test_func, None, wait=1, count=10)
assertmsg = "Router '{}' routes mismatch".format(rname)
- assert topotest.json_cmp(actual, expected) is None, assertmsg
+ assert result, assertmsg
def test_isis_linux_route_installation():
@@ -197,9 +204,18 @@ def test_isis_route6_installation():
for rname, router in tgen.routers().items():
filename = "{0}/{1}/{1}_route6.json".format(CWD, rname)
expected = json.loads(open(filename, "r").read())
- actual = router.vtysh_cmd("show ipv6 route json", isjson=True)
+
+ def compare_isis_v6_installed_routes(router, expected):
+ "Helper function to test ISIS v6 routes installed in rib."
+ actual = router.vtysh_cmd("show ipv6 route json", isjson=True)
+ return topotest.json_cmp(actual, expected)
+
+ test_func = functools.partial(
+ compare_isis_v6_installed_routes, router, expected
+ )
+ (result, diff) = topotest.run_and_expect(test_func, None, wait=1, count=10)
assertmsg = "Router '{}' routes mismatch".format(rname)
- assert topotest.json_cmp(actual, expected) is None, assertmsg
+ assert result, assertmsg
def test_isis_linux_route6_installation():
diff --git a/tests/topotests/isis_topo1_vrf/r1/isisd.conf b/tests/topotests/isis_topo1_vrf/r1/isisd.conf
index 5fb4c14d0b..0e8e490c94 100755
--- a/tests/topotests/isis_topo1_vrf/r1/isisd.conf
+++ b/tests/topotests/isis_topo1_vrf/r1/isisd.conf
@@ -1,7 +1,7 @@
hostname r1
-debug isis adj-packets
-debug isis events
-debug isis update-packets
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
interface r1-eth0
ip router isis 1 vrf r1-cust1
ipv6 router isis 1 vrf r1-cust1
diff --git a/tests/topotests/isis_topo1_vrf/r2/isisd.conf b/tests/topotests/isis_topo1_vrf/r2/isisd.conf
index 0d2bc7ab72..1e9bb9fb7f 100755
--- a/tests/topotests/isis_topo1_vrf/r2/isisd.conf
+++ b/tests/topotests/isis_topo1_vrf/r2/isisd.conf
@@ -1,7 +1,7 @@
hostname r2
-debug isis adj-packets
-debug isis events
-debug isis update-packets
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
interface r2-eth0
ip router isis 1 vrf r2-cust1
ipv6 router isis 1 vrf r2-cust1
diff --git a/tests/topotests/isis_topo1_vrf/r3/isisd.conf b/tests/topotests/isis_topo1_vrf/r3/isisd.conf
index 66092407ab..93a33f6db2 100755
--- a/tests/topotests/isis_topo1_vrf/r3/isisd.conf
+++ b/tests/topotests/isis_topo1_vrf/r3/isisd.conf
@@ -1,7 +1,7 @@
hostname r3
-debug isis adj-packets
-debug isis events
-debug isis update-packets
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
interface r3-eth0
ip router isis 1 vrf r3-cust1
ipv6 router isis 1 vrf r3-cust1
diff --git a/tests/topotests/isis_topo1_vrf/r3/r3_topology.json b/tests/topotests/isis_topo1_vrf/r3/r3_topology.json
index 34892d4a3a..044a6c0438 100644
--- a/tests/topotests/isis_topo1_vrf/r3/r3_topology.json
+++ b/tests/topotests/isis_topo1_vrf/r3/r3_topology.json
@@ -94,16 +94,16 @@
{
"interface": "r3-eth0",
"metric": "10",
- "next-hop": "r3",
+ "next-hop": "r1",
"parent": "r3(4)",
"type": "TE-IS",
- "vertex": "r3"
+ "vertex": "r1"
},
{
"interface": "r3-eth0",
"metric": "10",
- "next-hop": "r3",
- "parent": "r3(4)",
+ "next-hop": "r1",
+ "parent": "r1(4)",
"type": "IP TE",
"vertex": "10.0.20.0/24"
}
@@ -121,10 +121,10 @@
{
"interface": "r3-eth0",
"metric": "10",
- "next-hop": "r3",
+ "next-hop": "r1",
"parent": "r3(4)",
"type": "TE-IS",
- "vertex": "r3"
+ "vertex": "r1"
}
]
}
diff --git a/tests/topotests/isis_topo1_vrf/r4/isisd.conf b/tests/topotests/isis_topo1_vrf/r4/isisd.conf
index 05815e8418..b8c0b77f44 100755
--- a/tests/topotests/isis_topo1_vrf/r4/isisd.conf
+++ b/tests/topotests/isis_topo1_vrf/r4/isisd.conf
@@ -1,9 +1,9 @@
hostname r4
-debug isis adj-packets
-debug isis events
-debug isis update-packets
-debug isis lsp-gen
-debug isis lsp-sched
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
+! debug isis lsp-gen
+! debug isis lsp-sched
interface r4-eth0
ip router isis 1 vrf r4-cust1
diff --git a/tests/topotests/isis_topo1_vrf/r5/isisd.conf b/tests/topotests/isis_topo1_vrf/r5/isisd.conf
index f663c33fe9..e6febd5dea 100755
--- a/tests/topotests/isis_topo1_vrf/r5/isisd.conf
+++ b/tests/topotests/isis_topo1_vrf/r5/isisd.conf
@@ -1,7 +1,7 @@
hostname r5
-debug isis adj-packets
-debug isis events
-debug isis update-packets
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
interface r5-eth0
ip router isis 1 vrf r5-cust1
ipv6 router isis 1 vrf r5-cust1
diff --git a/tests/topotests/isis_topo1_vrf/test_isis_topo1_vrf.py b/tests/topotests/isis_topo1_vrf/test_isis_topo1_vrf.py
index 74d5edecab..ff9ad6150a 100644
--- a/tests/topotests/isis_topo1_vrf/test_isis_topo1_vrf.py
+++ b/tests/topotests/isis_topo1_vrf/test_isis_topo1_vrf.py
@@ -105,15 +105,21 @@ def setup_module(mod):
"ip link add {0}-cust1 type vrf table 1001",
"ip link add loop1 type dummy",
"ip link set {0}-eth0 master {0}-cust1",
- "ip link set {0}-eth1 master {0}-cust1",
]
+ eth1_cmds = ["ip link set {0}-eth1 master {0}-cust1"]
+
# For all registered routers, load the zebra configuration file
for rname, router in tgen.routers().items():
# create VRF rx-cust1 and link rx-eth0 to rx-cust1
for cmd in cmds:
output = tgen.net[rname].cmd(cmd.format(rname))
+ # If router has an rX-eth1, link that to vrf also
+ if "{}-eth1".format(rname) in router.links.keys():
+ for cmd in eth1_cmds:
+ output = output + tgen.net[rname].cmd(cmd.format(rname))
+
for rname, router in tgen.routers().items():
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
@@ -169,11 +175,19 @@ def test_isis_route_installation():
for rname, router in tgen.routers().items():
filename = "{0}/{1}/{1}_route.json".format(CWD, rname)
expected = json.loads(open(filename, "r").read())
- actual = router.vtysh_cmd(
- "show ip route vrf {0}-cust1 json".format(rname), isjson=True
- )
- assertmsg = "Router '{}' routes mismatch".format(rname)
- assert topotest.json_cmp(actual, expected) is None, assertmsg
+
+ def compare_routing_table(router, expected):
+ "Helper function to ensure zebra rib convergence"
+
+ actual = router.vtysh_cmd(
+ "show ip route vrf {0}-cust1 json".format(rname), isjson=True
+ )
+ return topotest.json_cmp(actual, expected)
+
+ test_func = functools.partial(compare_routing_table, router, expected)
+ (result, diff) = topotest.run_and_expect(test_func, None, count=20, wait=1)
+ assertmsg = "Router '{}' routes mismatch diff: {}".format(rname, diff)
+ assert result, assertmsg
def test_isis_linux_route_installation():
@@ -214,12 +228,18 @@ def test_isis_route6_installation():
for rname, router in tgen.routers().items():
filename = "{0}/{1}/{1}_route6.json".format(CWD, rname)
expected = json.loads(open(filename, "r").read())
- actual = router.vtysh_cmd(
- "show ipv6 route vrf {}-cust1 json".format(rname), isjson=True
- )
- assertmsg = "Router '{}' routes mismatch".format(rname)
- assert topotest.json_cmp(actual, expected) is None, assertmsg
+ def compare_routing_table(router, expected):
+ "Helper function to ensure zebra rib convergence"
+ actual = router.vtysh_cmd(
+ "show ipv6 route vrf {}-cust1 json".format(rname), isjson=True
+ )
+ return topotest.json_cmp(actual, expected)
+
+ test_func = functools.partial(compare_routing_table, router, expected)
+ (result, diff) = topotest.run_and_expect(test_func, None, count=20, wait=1)
+ assertmsg = "Router '{}' routes mismatch diff: ".format(rname, diff)
+ assert result, assertmsg
def test_isis_linux_route6_installation():
diff --git a/tests/topotests/ldp_oc_acl_topo1/r1/ldpd.conf b/tests/topotests/ldp_oc_acl_topo1/r1/ldpd.conf
index 85bb970fdf..4d5fe38cf1 100644
--- a/tests/topotests/ldp_oc_acl_topo1/r1/ldpd.conf
+++ b/tests/topotests/ldp_oc_acl_topo1/r1/ldpd.conf
@@ -1,13 +1,13 @@
hostname r1
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp discovery hello recv
-debug mpls ldp discovery hello sent
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp discovery hello recv
+! debug mpls ldp discovery hello sent
!
mpls ldp
router-id 1.1.1.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 aa3f74fc5f..63281e9be3 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
@@ -3,7 +3,7 @@
"2.2.2.2":[
{
"priority":2,
- "state":"Full\/DR",
+ "converged":"Full",
"address":"10.0.1.2",
"ifaceName":"r1-eth0:10.0.1.1"
}
diff --git a/tests/topotests/ldp_oc_acl_topo1/r2/ldpd.conf b/tests/topotests/ldp_oc_acl_topo1/r2/ldpd.conf
index e1a552c701..175d3d0cee 100644
--- a/tests/topotests/ldp_oc_acl_topo1/r2/ldpd.conf
+++ b/tests/topotests/ldp_oc_acl_topo1/r2/ldpd.conf
@@ -1,13 +1,13 @@
hostname r2
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp discovery hello recv
-debug mpls ldp discovery hello sent
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp discovery hello recv
+! debug mpls ldp discovery hello sent
!
mpls ldp
router-id 2.2.2.2
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 aa68198957..f361d605ce 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
@@ -3,7 +3,7 @@
"1.1.1.1":[
{
"priority":1,
- "state":"Full\/Backup",
+ "converged":"Full",
"address":"10.0.1.1",
"ifaceName":"r2-eth0:10.0.1.2"
}
@@ -11,7 +11,7 @@
"3.3.3.3":[
{
"priority":2,
- "state":"Full\/Backup",
+ "converged":"Full",
"address":"10.0.2.3",
"ifaceName":"r2-eth1:10.0.2.2"
}
@@ -19,7 +19,7 @@
"4.4.4.4":[
{
"priority":3,
- "state":"Full\/DR",
+ "converged":"Full",
"address":"10.0.2.4",
"ifaceName":"r2-eth1:10.0.2.2"
}
diff --git a/tests/topotests/ldp_oc_acl_topo1/r3/ldpd.conf b/tests/topotests/ldp_oc_acl_topo1/r3/ldpd.conf
index 4e66b140ac..81bd25ac6b 100644
--- a/tests/topotests/ldp_oc_acl_topo1/r3/ldpd.conf
+++ b/tests/topotests/ldp_oc_acl_topo1/r3/ldpd.conf
@@ -1,13 +1,13 @@
hostname r3
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp discovery hello recv
-debug mpls ldp discovery hello sent
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp discovery hello recv
+! debug mpls ldp discovery hello sent
!
mpls ldp
router-id 3.3.3.3
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 905774fc46..38794357ff 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
@@ -3,7 +3,7 @@
"2.2.2.2":[
{
"priority":1,
- "state":"Full\/DROther",
+ "converged":"Full",
"address":"10.0.2.2",
"ifaceName":"r3-eth0:10.0.2.3"
}
@@ -11,7 +11,7 @@
"4.4.4.4":[
{
"priority":3,
- "state":"Full\/DR",
+ "converged":"Full",
"address":"10.0.2.4",
"ifaceName":"r3-eth0:10.0.2.3"
}
diff --git a/tests/topotests/ldp_oc_acl_topo1/r4/ldpd.conf b/tests/topotests/ldp_oc_acl_topo1/r4/ldpd.conf
index 6b7d28f983..9f66d7ba45 100644
--- a/tests/topotests/ldp_oc_acl_topo1/r4/ldpd.conf
+++ b/tests/topotests/ldp_oc_acl_topo1/r4/ldpd.conf
@@ -1,13 +1,13 @@
hostname r4
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp discovery hello recv
-debug mpls ldp discovery hello sent
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp discovery hello recv
+! debug mpls ldp discovery hello sent
!
mpls ldp
router-id 4.4.4.4
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 67593952ca..fccca693b9 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
@@ -4,7 +4,7 @@
"2.2.2.2":[
{
"priority":1,
- "state":"Full\/DROther",
+ "converged":"Full",
"address":"10.0.2.2",
"ifaceName":"r4-eth0:10.0.2.4"
}
@@ -12,7 +12,7 @@
"3.3.3.3":[
{
"priority":2,
- "state":"Full\/Backup",
+ "converged":"Full",
"address":"10.0.2.3",
"ifaceName":"r4-eth0:10.0.2.4"
}
diff --git a/tests/topotests/ldp_oc_topo1/r1/ldpd.conf b/tests/topotests/ldp_oc_topo1/r1/ldpd.conf
index 2a8e023832..fdb9e628b3 100644
--- a/tests/topotests/ldp_oc_topo1/r1/ldpd.conf
+++ b/tests/topotests/ldp_oc_topo1/r1/ldpd.conf
@@ -1,13 +1,13 @@
hostname r1
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp discovery hello recv
-debug mpls ldp discovery hello sent
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp discovery hello recv
+! debug mpls ldp discovery hello sent
!
mpls ldp
router-id 1.1.1.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 aa3f74fc5f..63281e9be3 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
@@ -3,7 +3,7 @@
"2.2.2.2":[
{
"priority":2,
- "state":"Full\/DR",
+ "converged":"Full",
"address":"10.0.1.2",
"ifaceName":"r1-eth0:10.0.1.1"
}
diff --git a/tests/topotests/ldp_oc_topo1/r2/ldpd.conf b/tests/topotests/ldp_oc_topo1/r2/ldpd.conf
index e1a552c701..175d3d0cee 100644
--- a/tests/topotests/ldp_oc_topo1/r2/ldpd.conf
+++ b/tests/topotests/ldp_oc_topo1/r2/ldpd.conf
@@ -1,13 +1,13 @@
hostname r2
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp discovery hello recv
-debug mpls ldp discovery hello sent
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp discovery hello recv
+! debug mpls ldp discovery hello sent
!
mpls ldp
router-id 2.2.2.2
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 aa68198957..f361d605ce 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
@@ -3,7 +3,7 @@
"1.1.1.1":[
{
"priority":1,
- "state":"Full\/Backup",
+ "converged":"Full",
"address":"10.0.1.1",
"ifaceName":"r2-eth0:10.0.1.2"
}
@@ -11,7 +11,7 @@
"3.3.3.3":[
{
"priority":2,
- "state":"Full\/Backup",
+ "converged":"Full",
"address":"10.0.2.3",
"ifaceName":"r2-eth1:10.0.2.2"
}
@@ -19,7 +19,7 @@
"4.4.4.4":[
{
"priority":3,
- "state":"Full\/DR",
+ "converged":"Full",
"address":"10.0.2.4",
"ifaceName":"r2-eth1:10.0.2.2"
}
diff --git a/tests/topotests/ldp_oc_topo1/r3/ldpd.conf b/tests/topotests/ldp_oc_topo1/r3/ldpd.conf
index 4e66b140ac..81bd25ac6b 100644
--- a/tests/topotests/ldp_oc_topo1/r3/ldpd.conf
+++ b/tests/topotests/ldp_oc_topo1/r3/ldpd.conf
@@ -1,13 +1,13 @@
hostname r3
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp discovery hello recv
-debug mpls ldp discovery hello sent
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp discovery hello recv
+! debug mpls ldp discovery hello sent
!
mpls ldp
router-id 3.3.3.3
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 905774fc46..38794357ff 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
@@ -3,7 +3,7 @@
"2.2.2.2":[
{
"priority":1,
- "state":"Full\/DROther",
+ "converged":"Full",
"address":"10.0.2.2",
"ifaceName":"r3-eth0:10.0.2.3"
}
@@ -11,7 +11,7 @@
"4.4.4.4":[
{
"priority":3,
- "state":"Full\/DR",
+ "converged":"Full",
"address":"10.0.2.4",
"ifaceName":"r3-eth0:10.0.2.3"
}
diff --git a/tests/topotests/ldp_oc_topo1/r4/ldpd.conf b/tests/topotests/ldp_oc_topo1/r4/ldpd.conf
index 6b7d28f983..9f66d7ba45 100644
--- a/tests/topotests/ldp_oc_topo1/r4/ldpd.conf
+++ b/tests/topotests/ldp_oc_topo1/r4/ldpd.conf
@@ -1,13 +1,13 @@
hostname r4
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp discovery hello recv
-debug mpls ldp discovery hello sent
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp discovery hello recv
+! debug mpls ldp discovery hello sent
!
mpls ldp
router-id 4.4.4.4
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 67593952ca..fccca693b9 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
@@ -4,7 +4,7 @@
"2.2.2.2":[
{
"priority":1,
- "state":"Full\/DROther",
+ "converged":"Full",
"address":"10.0.2.2",
"ifaceName":"r4-eth0:10.0.2.4"
}
@@ -12,7 +12,7 @@
"3.3.3.3":[
{
"priority":2,
- "state":"Full\/Backup",
+ "converged":"Full",
"address":"10.0.2.3",
"ifaceName":"r4-eth0:10.0.2.4"
}
diff --git a/tests/topotests/ldp_snmp/r1/isisd.conf b/tests/topotests/ldp_snmp/r1/isisd.conf
index da2970d94e..d1abb497a6 100644
--- a/tests/topotests/ldp_snmp/r1/isisd.conf
+++ b/tests/topotests/ldp_snmp/r1/isisd.conf
@@ -1,9 +1,9 @@
hostname r1
log file isisd.log
-debug isis adj-packets
-debug isis events
-debug isis update-packets
-debug isis ldp-sync
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
+! debug isis ldp-sync
!
router isis 1
lsp-gen-interval 2
diff --git a/tests/topotests/ldp_snmp/r1/ldpd.conf b/tests/topotests/ldp_snmp/r1/ldpd.conf
index 01fc039b09..c13135ff90 100644
--- a/tests/topotests/ldp_snmp/r1/ldpd.conf
+++ b/tests/topotests/ldp_snmp/r1/ldpd.conf
@@ -1,10 +1,10 @@
hostname r1
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp sync
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp sync
!
mpls ldp
router-id 1.1.1.1
diff --git a/tests/topotests/ldp_snmp/r1/zebra.conf b/tests/topotests/ldp_snmp/r1/zebra.conf
index ea047355ad..bbb98d22fa 100644
--- a/tests/topotests/ldp_snmp/r1/zebra.conf
+++ b/tests/topotests/ldp_snmp/r1/zebra.conf
@@ -2,12 +2,12 @@ log file zebra.log
!
hostname r1
!
-debug zebra kernel
-debug zebra rib detailed
-debug zebra dplane detailed
-debug zebra nht
-debug zebra pseudowires
-debug zebra mpls
+! debug zebra kernel
+! debug zebra rib detailed
+! debug zebra dplane detailed
+! debug zebra nht
+! debug zebra pseudowires
+! debug zebra mpls
!
interface lo
ip address 1.1.1.1/32
diff --git a/tests/topotests/ldp_snmp/r2/isisd.conf b/tests/topotests/ldp_snmp/r2/isisd.conf
index b29a2b93ee..213b65ee4c 100644
--- a/tests/topotests/ldp_snmp/r2/isisd.conf
+++ b/tests/topotests/ldp_snmp/r2/isisd.conf
@@ -1,9 +1,9 @@
hostname r2
log file isisd.log
-debug isis adj-packets
-debug isis events
-debug isis update-packets
-debug isis ldp-sync
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
+! debug isis ldp-sync
!
router isis 1
lsp-gen-interval 2
diff --git a/tests/topotests/ldp_snmp/r2/ldpd.conf b/tests/topotests/ldp_snmp/r2/ldpd.conf
index c93e1a6ac5..fdb76ed3c0 100644
--- a/tests/topotests/ldp_snmp/r2/ldpd.conf
+++ b/tests/topotests/ldp_snmp/r2/ldpd.conf
@@ -1,10 +1,10 @@
hostname r2
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp sync
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp sync
!
mpls ldp
router-id 2.2.2.2
diff --git a/tests/topotests/ldp_snmp/r2/ospfd.conf b/tests/topotests/ldp_snmp/r2/ospfd.conf
index f93f6aed56..50c593cb58 100644
--- a/tests/topotests/ldp_snmp/r2/ospfd.conf
+++ b/tests/topotests/ldp_snmp/r2/ospfd.conf
@@ -1,7 +1,7 @@
hostname r2
log file ospfd.log
-debug ospf zebra interface
-debug ospf ldp-sync
+! debug ospf zebra interface
+! debug ospf ldp-sync
!
router ospf
router-id 2.2.2.2
diff --git a/tests/topotests/ldp_snmp/r2/zebra.conf b/tests/topotests/ldp_snmp/r2/zebra.conf
index c244442876..c79b210f11 100644
--- a/tests/topotests/ldp_snmp/r2/zebra.conf
+++ b/tests/topotests/ldp_snmp/r2/zebra.conf
@@ -2,11 +2,11 @@ log file zebra.log
!
hostname r2
!
-debug zebra rib detailed
-debug zebra dplane detailed
-debug zebra kernel
-debug zebra nht
-debug zebra pseudowires
+! debug zebra rib detailed
+! debug zebra dplane detailed
+! debug zebra kernel
+! debug zebra nht
+! debug zebra pseudowires
!
interface lo
ip address 2.2.2.2/32
diff --git a/tests/topotests/ldp_snmp/r3/isisd.conf b/tests/topotests/ldp_snmp/r3/isisd.conf
index 4c8499f23d..956d58239b 100644
--- a/tests/topotests/ldp_snmp/r3/isisd.conf
+++ b/tests/topotests/ldp_snmp/r3/isisd.conf
@@ -1,9 +1,9 @@
hostname r3
log file isisd.log
-debug isis adj-packets
-debug isis events
-debug isis update-packets
-debug isis ldp-sync
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
+! debug isis ldp-sync
!
router isis 1
lsp-gen-interval 2
diff --git a/tests/topotests/ldp_snmp/r3/ldpd.conf b/tests/topotests/ldp_snmp/r3/ldpd.conf
index b7eeb258f1..d1a928bf45 100644
--- a/tests/topotests/ldp_snmp/r3/ldpd.conf
+++ b/tests/topotests/ldp_snmp/r3/ldpd.conf
@@ -1,10 +1,10 @@
hostname r3
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp sync
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp sync
!
mpls ldp
router-id 3.3.3.3
diff --git a/tests/topotests/ldp_snmp/r3/zebra.conf b/tests/topotests/ldp_snmp/r3/zebra.conf
index b1919bd296..45929acb21 100644
--- a/tests/topotests/ldp_snmp/r3/zebra.conf
+++ b/tests/topotests/ldp_snmp/r3/zebra.conf
@@ -2,11 +2,11 @@ log file zebra.log
!
hostname r3
!
-debug zebra rib detailed
-debug zebra dplane detailed
-debug zebra kernel
-debug zebra nht
-debug zebra pseudowires
+! debug zebra rib detailed
+! debug zebra dplane detailed
+! debug zebra kernel
+! debug zebra nht
+! debug zebra pseudowires
!
interface lo
ip address 3.3.3.3/32
diff --git a/tests/topotests/ldp_sync_isis_topo1/r1/isisd.conf b/tests/topotests/ldp_sync_isis_topo1/r1/isisd.conf
index da2970d94e..d1abb497a6 100644
--- a/tests/topotests/ldp_sync_isis_topo1/r1/isisd.conf
+++ b/tests/topotests/ldp_sync_isis_topo1/r1/isisd.conf
@@ -1,9 +1,9 @@
hostname r1
log file isisd.log
-debug isis adj-packets
-debug isis events
-debug isis update-packets
-debug isis ldp-sync
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
+! debug isis ldp-sync
!
router isis 1
lsp-gen-interval 2
diff --git a/tests/topotests/ldp_sync_isis_topo1/r1/ldpd.conf b/tests/topotests/ldp_sync_isis_topo1/r1/ldpd.conf
index b9c32d3000..973acf4356 100644
--- a/tests/topotests/ldp_sync_isis_topo1/r1/ldpd.conf
+++ b/tests/topotests/ldp_sync_isis_topo1/r1/ldpd.conf
@@ -1,10 +1,10 @@
hostname r1
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp sync
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp sync
!
mpls ldp
router-id 1.1.1.1
diff --git a/tests/topotests/ldp_sync_isis_topo1/r1/zebra.conf b/tests/topotests/ldp_sync_isis_topo1/r1/zebra.conf
index ea047355ad..bbb98d22fa 100644
--- a/tests/topotests/ldp_sync_isis_topo1/r1/zebra.conf
+++ b/tests/topotests/ldp_sync_isis_topo1/r1/zebra.conf
@@ -2,12 +2,12 @@ log file zebra.log
!
hostname r1
!
-debug zebra kernel
-debug zebra rib detailed
-debug zebra dplane detailed
-debug zebra nht
-debug zebra pseudowires
-debug zebra mpls
+! debug zebra kernel
+! debug zebra rib detailed
+! debug zebra dplane detailed
+! debug zebra nht
+! debug zebra pseudowires
+! debug zebra mpls
!
interface lo
ip address 1.1.1.1/32
diff --git a/tests/topotests/ldp_sync_isis_topo1/r2/isisd.conf b/tests/topotests/ldp_sync_isis_topo1/r2/isisd.conf
index b29a2b93ee..213b65ee4c 100644
--- a/tests/topotests/ldp_sync_isis_topo1/r2/isisd.conf
+++ b/tests/topotests/ldp_sync_isis_topo1/r2/isisd.conf
@@ -1,9 +1,9 @@
hostname r2
log file isisd.log
-debug isis adj-packets
-debug isis events
-debug isis update-packets
-debug isis ldp-sync
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
+! debug isis ldp-sync
!
router isis 1
lsp-gen-interval 2
diff --git a/tests/topotests/ldp_sync_isis_topo1/r2/ldpd.conf b/tests/topotests/ldp_sync_isis_topo1/r2/ldpd.conf
index 52398b1b72..e738ff9917 100644
--- a/tests/topotests/ldp_sync_isis_topo1/r2/ldpd.conf
+++ b/tests/topotests/ldp_sync_isis_topo1/r2/ldpd.conf
@@ -1,10 +1,10 @@
hostname r2
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp sync
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp sync
!
mpls ldp
router-id 2.2.2.2
diff --git a/tests/topotests/ldp_sync_isis_topo1/r2/zebra.conf b/tests/topotests/ldp_sync_isis_topo1/r2/zebra.conf
index c244442876..c79b210f11 100644
--- a/tests/topotests/ldp_sync_isis_topo1/r2/zebra.conf
+++ b/tests/topotests/ldp_sync_isis_topo1/r2/zebra.conf
@@ -2,11 +2,11 @@ log file zebra.log
!
hostname r2
!
-debug zebra rib detailed
-debug zebra dplane detailed
-debug zebra kernel
-debug zebra nht
-debug zebra pseudowires
+! debug zebra rib detailed
+! debug zebra dplane detailed
+! debug zebra kernel
+! debug zebra nht
+! debug zebra pseudowires
!
interface lo
ip address 2.2.2.2/32
diff --git a/tests/topotests/ldp_sync_isis_topo1/r3/isisd.conf b/tests/topotests/ldp_sync_isis_topo1/r3/isisd.conf
index 4c8499f23d..956d58239b 100644
--- a/tests/topotests/ldp_sync_isis_topo1/r3/isisd.conf
+++ b/tests/topotests/ldp_sync_isis_topo1/r3/isisd.conf
@@ -1,9 +1,9 @@
hostname r3
log file isisd.log
-debug isis adj-packets
-debug isis events
-debug isis update-packets
-debug isis ldp-sync
+! debug isis adj-packets
+! debug isis events
+! debug isis update-packets
+! debug isis ldp-sync
!
router isis 1
lsp-gen-interval 2
diff --git a/tests/topotests/ldp_sync_isis_topo1/r3/ldpd.conf b/tests/topotests/ldp_sync_isis_topo1/r3/ldpd.conf
index 2935caf13b..fae25e0710 100644
--- a/tests/topotests/ldp_sync_isis_topo1/r3/ldpd.conf
+++ b/tests/topotests/ldp_sync_isis_topo1/r3/ldpd.conf
@@ -1,10 +1,10 @@
hostname r3
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp sync
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp sync
!
mpls ldp
router-id 3.3.3.3
diff --git a/tests/topotests/ldp_sync_isis_topo1/r3/zebra.conf b/tests/topotests/ldp_sync_isis_topo1/r3/zebra.conf
index b1919bd296..45929acb21 100644
--- a/tests/topotests/ldp_sync_isis_topo1/r3/zebra.conf
+++ b/tests/topotests/ldp_sync_isis_topo1/r3/zebra.conf
@@ -2,11 +2,11 @@ log file zebra.log
!
hostname r3
!
-debug zebra rib detailed
-debug zebra dplane detailed
-debug zebra kernel
-debug zebra nht
-debug zebra pseudowires
+! debug zebra rib detailed
+! debug zebra dplane detailed
+! debug zebra kernel
+! debug zebra nht
+! debug zebra pseudowires
!
interface lo
ip address 3.3.3.3/32
diff --git a/tests/topotests/ldp_sync_ospf_topo1/r1/ldpd.conf b/tests/topotests/ldp_sync_ospf_topo1/r1/ldpd.conf
index b9c32d3000..973acf4356 100644
--- a/tests/topotests/ldp_sync_ospf_topo1/r1/ldpd.conf
+++ b/tests/topotests/ldp_sync_ospf_topo1/r1/ldpd.conf
@@ -1,10 +1,10 @@
hostname r1
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp sync
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp sync
!
mpls ldp
router-id 1.1.1.1
diff --git a/tests/topotests/ldp_sync_ospf_topo1/r1/ospfd.conf b/tests/topotests/ldp_sync_ospf_topo1/r1/ospfd.conf
index eefcd1e71c..dc201695f4 100644
--- a/tests/topotests/ldp_sync_ospf_topo1/r1/ospfd.conf
+++ b/tests/topotests/ldp_sync_ospf_topo1/r1/ospfd.conf
@@ -1,7 +1,7 @@
hostname r1
log file ospfd.log
-debug ospf zebra interface
-debug ospf ldp-sync
+! debug ospf zebra interface
+! debug ospf ldp-sync
!
router ospf
router-id 1.1.1.1
diff --git a/tests/topotests/ldp_sync_ospf_topo1/r1/show_ip_ospf_neighbor.json b/tests/topotests/ldp_sync_ospf_topo1/r1/show_ip_ospf_neighbor.json
index 3bfda39071..7efde22f3f 100644
--- a/tests/topotests/ldp_sync_ospf_topo1/r1/show_ip_ospf_neighbor.json
+++ b/tests/topotests/ldp_sync_ospf_topo1/r1/show_ip_ospf_neighbor.json
@@ -5,7 +5,7 @@
"dbSummaryCounter": 0,
"retransmitCounter": 0,
"priority": 1,
- "state": "Full/DROther",
+ "converged": "Full",
"address": "10.0.1.2",
"ifaceName": "r1-eth1:10.0.1.1",
"requestCounter": 0
@@ -16,7 +16,7 @@
"dbSummaryCounter": 0,
"retransmitCounter": 0,
"priority": 1,
- "state": "Full/DROther",
+ "converged": "Full",
"address": "10.0.2.3",
"ifaceName": "r1-eth2:10.0.2.1",
"requestCounter": 0
diff --git a/tests/topotests/ldp_sync_ospf_topo1/r1/zebra.conf b/tests/topotests/ldp_sync_ospf_topo1/r1/zebra.conf
index ea047355ad..bbb98d22fa 100644
--- a/tests/topotests/ldp_sync_ospf_topo1/r1/zebra.conf
+++ b/tests/topotests/ldp_sync_ospf_topo1/r1/zebra.conf
@@ -2,12 +2,12 @@ log file zebra.log
!
hostname r1
!
-debug zebra kernel
-debug zebra rib detailed
-debug zebra dplane detailed
-debug zebra nht
-debug zebra pseudowires
-debug zebra mpls
+! debug zebra kernel
+! debug zebra rib detailed
+! debug zebra dplane detailed
+! debug zebra nht
+! debug zebra pseudowires
+! debug zebra mpls
!
interface lo
ip address 1.1.1.1/32
diff --git a/tests/topotests/ldp_sync_ospf_topo1/r2/ldpd.conf b/tests/topotests/ldp_sync_ospf_topo1/r2/ldpd.conf
index 52398b1b72..e738ff9917 100644
--- a/tests/topotests/ldp_sync_ospf_topo1/r2/ldpd.conf
+++ b/tests/topotests/ldp_sync_ospf_topo1/r2/ldpd.conf
@@ -1,10 +1,10 @@
hostname r2
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp sync
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp sync
!
mpls ldp
router-id 2.2.2.2
diff --git a/tests/topotests/ldp_sync_ospf_topo1/r2/ospfd.conf b/tests/topotests/ldp_sync_ospf_topo1/r2/ospfd.conf
index f93f6aed56..50c593cb58 100644
--- a/tests/topotests/ldp_sync_ospf_topo1/r2/ospfd.conf
+++ b/tests/topotests/ldp_sync_ospf_topo1/r2/ospfd.conf
@@ -1,7 +1,7 @@
hostname r2
log file ospfd.log
-debug ospf zebra interface
-debug ospf ldp-sync
+! debug ospf zebra interface
+! debug ospf ldp-sync
!
router ospf
router-id 2.2.2.2
diff --git a/tests/topotests/ldp_sync_ospf_topo1/r2/show_ip_ospf_neighbor.json b/tests/topotests/ldp_sync_ospf_topo1/r2/show_ip_ospf_neighbor.json
index 5b7a5ebbb9..5bea193e01 100644
--- a/tests/topotests/ldp_sync_ospf_topo1/r2/show_ip_ospf_neighbor.json
+++ b/tests/topotests/ldp_sync_ospf_topo1/r2/show_ip_ospf_neighbor.json
@@ -3,7 +3,7 @@
"1.1.1.1": [
{
"priority":1,
- "state":"Full/DROther",
+ "converged":"Full",
"address":"10.0.1.1",
"ifaceName":"r2-eth1:10.0.1.2",
"retransmitCounter":0,
@@ -14,7 +14,7 @@
"3.3.3.3": [
{
"priority":1,
- "state":"Full/DROther",
+ "converged":"Full",
"address":"10.0.3.3",
"ifaceName":"r2-eth2:10.0.3.2",
"retransmitCounter":0,
diff --git a/tests/topotests/ldp_sync_ospf_topo1/r2/zebra.conf b/tests/topotests/ldp_sync_ospf_topo1/r2/zebra.conf
index c244442876..c79b210f11 100644
--- a/tests/topotests/ldp_sync_ospf_topo1/r2/zebra.conf
+++ b/tests/topotests/ldp_sync_ospf_topo1/r2/zebra.conf
@@ -2,11 +2,11 @@ log file zebra.log
!
hostname r2
!
-debug zebra rib detailed
-debug zebra dplane detailed
-debug zebra kernel
-debug zebra nht
-debug zebra pseudowires
+! debug zebra rib detailed
+! debug zebra dplane detailed
+! debug zebra kernel
+! debug zebra nht
+! debug zebra pseudowires
!
interface lo
ip address 2.2.2.2/32
diff --git a/tests/topotests/ldp_sync_ospf_topo1/r3/ldpd.conf b/tests/topotests/ldp_sync_ospf_topo1/r3/ldpd.conf
index 2935caf13b..fae25e0710 100644
--- a/tests/topotests/ldp_sync_ospf_topo1/r3/ldpd.conf
+++ b/tests/topotests/ldp_sync_ospf_topo1/r3/ldpd.conf
@@ -1,10 +1,10 @@
hostname r3
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp sync
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp sync
!
mpls ldp
router-id 3.3.3.3
diff --git a/tests/topotests/ldp_sync_ospf_topo1/r3/ospfd.conf b/tests/topotests/ldp_sync_ospf_topo1/r3/ospfd.conf
index 09eea759ad..b641fd8713 100644
--- a/tests/topotests/ldp_sync_ospf_topo1/r3/ospfd.conf
+++ b/tests/topotests/ldp_sync_ospf_topo1/r3/ospfd.conf
@@ -1,7 +1,7 @@
hostname r3
log file ospfd.log
-debug ospf zebra interface
-debug ospf ldp-sync
+! debug ospf zebra interface
+! debug ospf ldp-sync
!
router ospf
router-id 3.3.3.3
diff --git a/tests/topotests/ldp_sync_ospf_topo1/r3/show_ip_ospf_neighbor.json b/tests/topotests/ldp_sync_ospf_topo1/r3/show_ip_ospf_neighbor.json
index 1b29b9f947..9966297d8a 100644
--- a/tests/topotests/ldp_sync_ospf_topo1/r3/show_ip_ospf_neighbor.json
+++ b/tests/topotests/ldp_sync_ospf_topo1/r3/show_ip_ospf_neighbor.json
@@ -3,7 +3,7 @@
"1.1.1.1": [
{
"priority":1,
- "state":"Full/DROther",
+ "converged":"Full",
"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/DROther",
+ "converged":"Full",
"address":"10.0.3.2",
"ifaceName":"r3-eth2:10.0.3.3",
"retransmitCounter":0,
diff --git a/tests/topotests/ldp_sync_ospf_topo1/r3/zebra.conf b/tests/topotests/ldp_sync_ospf_topo1/r3/zebra.conf
index b1919bd296..45929acb21 100644
--- a/tests/topotests/ldp_sync_ospf_topo1/r3/zebra.conf
+++ b/tests/topotests/ldp_sync_ospf_topo1/r3/zebra.conf
@@ -2,11 +2,11 @@ log file zebra.log
!
hostname r3
!
-debug zebra rib detailed
-debug zebra dplane detailed
-debug zebra kernel
-debug zebra nht
-debug zebra pseudowires
+! debug zebra rib detailed
+! debug zebra dplane detailed
+! debug zebra kernel
+! debug zebra nht
+! debug zebra pseudowires
!
interface lo
ip address 3.3.3.3/32
diff --git a/tests/topotests/ldp_topo1/r1/ldpd.conf b/tests/topotests/ldp_topo1/r1/ldpd.conf
index 3c6cbddc2a..f7f2714dae 100644
--- a/tests/topotests/ldp_topo1/r1/ldpd.conf
+++ b/tests/topotests/ldp_topo1/r1/ldpd.conf
@@ -1,13 +1,13 @@
hostname r1
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp discovery hello recv
-debug mpls ldp discovery hello sent
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp discovery hello recv
+! debug mpls ldp discovery hello sent
!
mpls ldp
router-id 1.1.1.1
diff --git a/tests/topotests/ldp_topo1/r2/ldpd.conf b/tests/topotests/ldp_topo1/r2/ldpd.conf
index bfdef21b75..c4056e01a8 100644
--- a/tests/topotests/ldp_topo1/r2/ldpd.conf
+++ b/tests/topotests/ldp_topo1/r2/ldpd.conf
@@ -1,13 +1,13 @@
hostname r2
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp discovery hello recv
-debug mpls ldp discovery hello sent
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp discovery hello recv
+! debug mpls ldp discovery hello sent
!
mpls ldp
router-id 2.2.2.2
diff --git a/tests/topotests/ldp_topo1/r3/ldpd.conf b/tests/topotests/ldp_topo1/r3/ldpd.conf
index dbf1d72b5f..48956cb996 100644
--- a/tests/topotests/ldp_topo1/r3/ldpd.conf
+++ b/tests/topotests/ldp_topo1/r3/ldpd.conf
@@ -1,13 +1,13 @@
hostname r3
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp discovery hello recv
-debug mpls ldp discovery hello sent
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp discovery hello recv
+! debug mpls ldp discovery hello sent
!
mpls ldp
router-id 3.3.3.3
diff --git a/tests/topotests/ldp_topo1/r4/ldpd.conf b/tests/topotests/ldp_topo1/r4/ldpd.conf
index 8f3533527d..1d04aa07e7 100644
--- a/tests/topotests/ldp_topo1/r4/ldpd.conf
+++ b/tests/topotests/ldp_topo1/r4/ldpd.conf
@@ -1,13 +1,13 @@
hostname r4
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp discovery hello recv
-debug mpls ldp discovery hello sent
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp discovery hello recv
+! debug mpls ldp discovery hello sent
!
mpls ldp
router-id 4.4.4.4
diff --git a/tests/topotests/ldp_topo1/test_ldp_topo1.py b/tests/topotests/ldp_topo1/test_ldp_topo1.py
index c21d6bf28e..4a33edb9d1 100644
--- a/tests/topotests/ldp_topo1/test_ldp_topo1.py
+++ b/tests/topotests/ldp_topo1/test_ldp_topo1.py
@@ -64,6 +64,7 @@ import re
import sys
import pytest
from time import sleep
+from lib.topolog import logger
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from lib import topotest
@@ -126,7 +127,7 @@ def setup_module(module):
tgen.gears["r%s" % i].start()
# For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
+ # tgen.mininet_cli()
def teardown_module(module):
@@ -153,9 +154,6 @@ def test_router_running():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_mpls_interfaces():
global fatal_error
@@ -219,9 +217,6 @@ def test_mpls_interfaces():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_mpls_ldp_neighbor_establish():
global fatal_error
@@ -231,6 +226,13 @@ def test_mpls_ldp_neighbor_establish():
if fatal_error != "":
pytest.skip(fatal_error)
+ neighbors_operational = {
+ 1: 1,
+ 2: 3,
+ 3: 2,
+ 4: 2,
+ }
+
# Wait for MPLS LDP neighbors to establish.
print("\n\n** Verify MPLS LDP neighbors to establish")
print("******************************************\n")
@@ -260,9 +262,14 @@ def test_mpls_ldp_neighbor_establish():
established = "" # Empty string shows NOT established
if re.search(operational, lines[j]):
found_operational += 1
+
+ logger.info("Found operational %d" % found_operational)
if found_operational < 1:
# Need at least one operational neighbor
established = "" # Empty string shows NOT established
+ else:
+ if found_operational != neighbors_operational[i]:
+ established = ""
if not established:
print("Waiting for r%s" % i)
sys.stdout.flush()
@@ -356,9 +363,6 @@ def test_mpls_ldp_discovery():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_mpls_ldp_neighbor():
global fatal_error
@@ -426,9 +430,6 @@ def test_mpls_ldp_neighbor():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_mpls_ldp_binding():
global fatal_error
@@ -518,9 +519,6 @@ def test_mpls_ldp_binding():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_zebra_ipv4_routingTable():
global fatal_error
@@ -595,9 +593,6 @@ def test_zebra_ipv4_routingTable():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_mpls_table():
global fatal_error
@@ -674,9 +669,6 @@ def test_mpls_table():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_linux_mpls_routes():
global fatal_error
@@ -758,9 +750,6 @@ def test_linux_mpls_routes():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_shutdown_check_stderr():
global fatal_error
diff --git a/tests/topotests/ldp_vpls_topo1/r1/ldpd.conf b/tests/topotests/ldp_vpls_topo1/r1/ldpd.conf
index a1c0c822d6..594ec5a58f 100644
--- a/tests/topotests/ldp_vpls_topo1/r1/ldpd.conf
+++ b/tests/topotests/ldp_vpls_topo1/r1/ldpd.conf
@@ -1,13 +1,13 @@
hostname r1
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp discovery hello recv
-debug mpls ldp discovery hello sent
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp discovery hello recv
+! debug mpls ldp discovery hello sent
!
mpls ldp
router-id 1.1.1.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 7e281abb5f..90c8195416 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
@@ -5,7 +5,7 @@
"dbSummaryCounter": 0,
"retransmitCounter": 0,
"priority": 2,
- "state": "Full\/DR",
+ "converged": "Full",
"address": "10.0.1.2",
"ifaceName": "r1-eth1:10.0.1.1",
"requestCounter": 0
@@ -16,7 +16,7 @@
"dbSummaryCounter": 0,
"retransmitCounter": 0,
"priority": 2,
- "state": "Full\/DR",
+ "converged": "Full",
"address": "10.0.2.3",
"ifaceName": "r1-eth2:10.0.2.1",
"requestCounter": 0
diff --git a/tests/topotests/ldp_vpls_topo1/r1/show_ip_route_after_link_down.ref b/tests/topotests/ldp_vpls_topo1/r1/show_ip_route_after_link_down.ref
new file mode 100644
index 0000000000..84113a0383
--- /dev/null
+++ b/tests/topotests/ldp_vpls_topo1/r1/show_ip_route_after_link_down.ref
@@ -0,0 +1,20 @@
+{
+ "2.2.2.2/32":[
+ {
+ "prefix":"2.2.2.2/32",
+ "protocol":"ospf",
+ "selected":true,
+ "distance":110,
+ "metric":20,
+ "nexthops":[
+ {
+ "fib":true,
+ "ip":"10.0.2.3",
+ "afi":"ipv4",
+ "interfaceName":"r1-eth2",
+ "active":true
+ }
+ ]
+ }
+ ]
+}
diff --git a/tests/topotests/ldp_vpls_topo1/r1/zebra.conf b/tests/topotests/ldp_vpls_topo1/r1/zebra.conf
index ea047355ad..bbb98d22fa 100644
--- a/tests/topotests/ldp_vpls_topo1/r1/zebra.conf
+++ b/tests/topotests/ldp_vpls_topo1/r1/zebra.conf
@@ -2,12 +2,12 @@ log file zebra.log
!
hostname r1
!
-debug zebra kernel
-debug zebra rib detailed
-debug zebra dplane detailed
-debug zebra nht
-debug zebra pseudowires
-debug zebra mpls
+! debug zebra kernel
+! debug zebra rib detailed
+! debug zebra dplane detailed
+! debug zebra nht
+! debug zebra pseudowires
+! debug zebra mpls
!
interface lo
ip address 1.1.1.1/32
diff --git a/tests/topotests/ldp_vpls_topo1/r2/ldpd.conf b/tests/topotests/ldp_vpls_topo1/r2/ldpd.conf
index 06e5973040..ffb4f0974a 100644
--- a/tests/topotests/ldp_vpls_topo1/r2/ldpd.conf
+++ b/tests/topotests/ldp_vpls_topo1/r2/ldpd.conf
@@ -1,13 +1,13 @@
hostname r2
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp discovery hello recv
-debug mpls ldp discovery hello sent
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp discovery hello recv
+! debug mpls ldp discovery hello sent
!
mpls ldp
router-id 2.2.2.2
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 22fd98f519..29dde53c6d 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",
+ "converged":"Full",
"address":"10.0.1.1",
"ifaceName":"r2-eth1:10.0.1.2",
"retransmitCounter":0,
@@ -14,7 +14,7 @@
"3.3.3.3": [
{
"priority":2,
- "state":"Full\/DR",
+ "converged":"Full",
"address":"10.0.3.3",
"ifaceName":"r2-eth2:10.0.3.2",
"retransmitCounter":0,
diff --git a/tests/topotests/ldp_vpls_topo1/r2/zebra.conf b/tests/topotests/ldp_vpls_topo1/r2/zebra.conf
index c244442876..c79b210f11 100644
--- a/tests/topotests/ldp_vpls_topo1/r2/zebra.conf
+++ b/tests/topotests/ldp_vpls_topo1/r2/zebra.conf
@@ -2,11 +2,11 @@ log file zebra.log
!
hostname r2
!
-debug zebra rib detailed
-debug zebra dplane detailed
-debug zebra kernel
-debug zebra nht
-debug zebra pseudowires
+! debug zebra rib detailed
+! debug zebra dplane detailed
+! debug zebra kernel
+! debug zebra nht
+! debug zebra pseudowires
!
interface lo
ip address 2.2.2.2/32
diff --git a/tests/topotests/ldp_vpls_topo1/r3/ldpd.conf b/tests/topotests/ldp_vpls_topo1/r3/ldpd.conf
index 57a203bce3..c95471ffd8 100644
--- a/tests/topotests/ldp_vpls_topo1/r3/ldpd.conf
+++ b/tests/topotests/ldp_vpls_topo1/r3/ldpd.conf
@@ -1,13 +1,13 @@
hostname r3
log file ldpd.log
!
-debug mpls ldp zebra
-debug mpls ldp event
-debug mpls ldp errors
-debug mpls ldp messages recv
-debug mpls ldp messages sent
-debug mpls ldp discovery hello recv
-debug mpls ldp discovery hello sent
+! debug mpls ldp zebra
+! debug mpls ldp event
+! debug mpls ldp errors
+! debug mpls ldp messages recv
+! debug mpls ldp messages sent
+! debug mpls ldp discovery hello recv
+! debug mpls ldp discovery hello sent
!
mpls ldp
router-id 3.3.3.3
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 970eb2fc1d..9966297d8a 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",
+ "converged":"Full",
"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",
+ "converged":"Full",
"address":"10.0.3.2",
"ifaceName":"r3-eth2:10.0.3.3",
"retransmitCounter":0,
diff --git a/tests/topotests/ldp_vpls_topo1/r3/zebra.conf b/tests/topotests/ldp_vpls_topo1/r3/zebra.conf
index 6b1eaa2ca0..bcc0d8d2be 100644
--- a/tests/topotests/ldp_vpls_topo1/r3/zebra.conf
+++ b/tests/topotests/ldp_vpls_topo1/r3/zebra.conf
@@ -2,11 +2,11 @@ log file zebra.log
!
hostname r3
!
-debug zebra rib detailed
-debug zebra dplane detailed
-debug zebra kernel
-debug zebra nht
-debug zebra pseudowires
+! debug zebra rib detailed
+! debug zebra dplane detailed
+! debug zebra kernel
+! debug zebra nht
+! debug zebra pseudowires
!
interface lo
ip address 3.3.3.3/32
diff --git a/tests/topotests/ldp_vpls_topo1/test_ldp_vpls_topo1.py b/tests/topotests/ldp_vpls_topo1/test_ldp_vpls_topo1.py
index 86128a629d..8a41ea510e 100644
--- a/tests/topotests/ldp_vpls_topo1/test_ldp_vpls_topo1.py
+++ b/tests/topotests/ldp_vpls_topo1/test_ldp_vpls_topo1.py
@@ -272,9 +272,15 @@ def test_ldp_pseudowires_after_link_down():
# Shut down r1-r2 link */
tgen = get_topogen()
- tgen.gears["r1"].peer_link_enable("r1-eth1", False)
- topotest.sleep(5, "Waiting for the network to reconverge")
-
+ rname = "r1"
+ tgen.gears[rname].peer_link_enable("r1-eth1", False)
+ router_compare_json_output(
+ rname,
+ "show ip route json",
+ "show_ip_route_after_link_down.ref",
+ count=160,
+ wait=1,
+ )
# check if the pseudowire is still up (using an alternate path
# for nexthop resolution). Give some extra wait time.
for rname in ["r1", "r2", "r3"]:
diff --git a/tests/topotests/lib/bgp.py b/tests/topotests/lib/bgp.py
index 556240bfb5..551483d718 100644
--- a/tests/topotests/lib/bgp.py
+++ b/tests/topotests/lib/bgp.py
@@ -989,6 +989,14 @@ def __create_bgp_unicast_address_family(
if "no_allowas_in" in peer:
allow_as_in = peer["no_allowas_in"]
config_data.append("no {} allowas-in {}".format(neigh_cxt, allow_as_in))
+
+ if "shutdown" in peer:
+ shut_val = peer["shutdown"]
+ if shut_val is True:
+ config_data.append("{} shutdown".format(neigh_cxt))
+ elif shut_val is False:
+ config_data.append("no {} shutdown".format(neigh_cxt))
+
if prefix_lists:
for prefix_list in prefix_lists:
name = prefix_list.setdefault("name", {})
@@ -2221,6 +2229,7 @@ def verify_bgp_attributes(
rmap_name=None,
input_dict=None,
seq_id=None,
+ vrf=None,
nexthop=None,
expected=True,
):
@@ -2275,7 +2284,10 @@ def verify_bgp_attributes(
logger.info("Verifying BGP set attributes for dut {}:".format(router))
for static_route in static_routes:
- cmd = "show bgp {} {} json".format(addr_type, static_route)
+ if vrf:
+ cmd = "show bgp vrf {} {} {} json".format(vrf, addr_type, static_route)
+ else:
+ cmd = "show bgp {} {} json".format(addr_type, static_route)
show_bgp_json = run_frr_cmd(rnode, cmd, isjson=True)
dict_to_test = []
@@ -2821,7 +2833,6 @@ def verify_bgp_rib(
st_rt,
dut,
)
- return errormsg
else:
nh_found = True
@@ -3050,7 +3061,12 @@ def verify_graceful_restart(
if router != dut:
continue
- bgp_addr_type = topo["routers"][dut]["bgp"]["address_family"]
+ try:
+ bgp_addr_type = topo["routers"][dut]["bgp"]["address_family"]
+ except TypeError:
+ bgp_addr_type = topo["routers"][dut]["bgp"][0]["address_family"]
+
+ # bgp_addr_type = topo["routers"][dut]["bgp"]["address_family"]
if addr_type in bgp_addr_type:
if not check_address_types(addr_type):
@@ -4428,3 +4444,133 @@ def verify_evpn_routes(
logger.debug("Exiting lib API: {}".format(sys._getframe().f_code.co_name))
return False
+
+
+@retry(retry_timeout=10)
+def verify_bgp_bestpath(tgen, addr_type, input_dict):
+ """
+ Verifies bgp next hop values in best-path output
+
+ * `dut` : device under test
+ * `addr_type` : Address type ipv4/ipv6
+ * `input_dict`: having details like multipath and bestpath
+
+ Usage
+ -----
+ input_dict_1 = {
+ "r1": {
+ "ipv4" : {
+ "bestpath": "50.0.0.1",
+ "multipath": ["50.0.0.1", "50.0.0.2"],
+ "network": "100.0.0.0/24"
+ }
+ "ipv6" : {
+ "bestpath": "1000::1",
+ "multipath": ["1000::1", "1000::2"]
+ "network": "2000::1/128"
+ }
+ }
+ }
+
+ result = verify_bgp_bestpath(tgen, input_dict)
+
+ """
+
+ result = False
+ logger.debug("Entering lib API: {}".format(sys._getframe().f_code.co_name))
+ for dut in input_dict.keys():
+ rnode = tgen.routers()[dut]
+
+ logger.info("[DUT: %s]: Verifying bgp bestpath and multipath " "routes:", dut)
+ result = False
+ for network_dict in input_dict[dut][addr_type]:
+ nw_addr = network_dict.setdefault("network", None)
+ vrf = network_dict.setdefault("vrf", None)
+ bestpath = network_dict.setdefault("bestpath", None)
+
+ if vrf:
+ cmd = "show bgp vrf {} {} {} bestpath json".format(
+ vrf, addr_type, nw_addr
+ )
+ else:
+ cmd = "show bgp {} {} bestpath json".format(addr_type, nw_addr)
+
+ data = run_frr_cmd(rnode, cmd, isjson=True)
+ route = data["paths"][0]
+
+ if "bestpath" in route:
+ if route["bestpath"]["overall"] is True:
+ _bestpath = route["nexthops"][0]["ip"]
+
+ if _bestpath != bestpath:
+ return (
+ "DUT:[{}] Bestpath do not match for"
+ " network: {}, Expected "
+ " {} as bgp bestpath found {}".format(
+ dut, nw_addr, bestpath, _bestpath
+ )
+ )
+
+ logger.info(
+ "DUT:[{}] Found expected bestpath: "
+ " {} for network: {}".format(dut, _bestpath, nw_addr)
+ )
+ result = True
+
+ logger.debug("Exiting lib API: {}".format(sys._getframe().f_code.co_name))
+ return result
+
+
+def verify_tcp_mss(tgen, dut, neighbour, configured_tcp_mss, vrf=None):
+ """
+ This api is used to verify the tcp-mss value assigned to a neigbour of DUT
+
+ Parameters
+ ----------
+ * `tgen` : topogen object
+ * `dut`: device under test
+ * `neighbour`:neigbout IP address
+ * `configured_tcp_mss`:The TCP-MSS value to be verified
+ * `vrf`:vrf
+
+ Usage
+ -----
+ result = verify_tcp_mss(tgen, dut,neighbour,configured_tcp_mss)
+ Returns
+ -------
+ errormsg(str) or True
+ """
+
+ logger.debug("Entering lib API: {}".format(sys._getframe().f_code.co_name))
+ rnode = tgen.routers()[dut]
+ if vrf:
+ cmd = "show bgp vrf {} neighbors {} json".format(vrf, neighbour)
+ else:
+ cmd = "show bgp neighbors {} json".format(neighbour)
+
+ # Execute the command
+ show_vrf_stats = run_frr_cmd(rnode, cmd, isjson=True)
+
+ # Verify TCP-MSS on router
+ logger.info("Verify that no core is observed")
+ if tgen.routers_have_failure():
+ errormsg = "Core observed while running CLI: %s" % (cmd)
+ return errormsg
+ else:
+ if configured_tcp_mss == show_vrf_stats.get(neighbour).get(
+ "bgpTcpMssConfigured"
+ ):
+ logger.debug(
+ "Configured TCP - MSS Found: {}".format(sys._getframe().f_code.co_name)
+ )
+ return True
+ else:
+ logger.debug(
+ "TCP-MSS Mismatch ,configured {} expecting {}".format(
+ show_vrf_stats.get(neighbour).get("bgpTcpMssConfigured"),
+ configured_tcp_mss,
+ )
+ )
+ return "TCP-MSS Mismatch"
+ logger.debug("Exiting lib API: {}".format(sys._getframe().f_code.co_name))
+ return False
diff --git a/tests/topotests/lib/bgprib.py b/tests/topotests/lib/bgprib.py
index a216e3588e..35a57d0a99 100644
--- a/tests/topotests/lib/bgprib.py
+++ b/tests/topotests/lib/bgprib.py
@@ -122,7 +122,7 @@ class BgpRib:
luResult(target, True, title, logstr)
def RequireUnicastRoutes(self, target, afi, vrf, title, wantroutes, debug=0):
- logstr = "RequireVpnRoutes %s" % str(wantroutes)
+ logstr = "RequireUnicastRoutes %s" % str(wantroutes)
vrfstr = ""
if vrf != "":
vrfstr = "vrf %s" % (vrf)
diff --git a/tests/topotests/lib/common_config.py b/tests/topotests/lib/common_config.py
index 1bce3c6bb2..c744e5bbbf 100644
--- a/tests/topotests/lib/common_config.py
+++ b/tests/topotests/lib/common_config.py
@@ -26,6 +26,7 @@ import socket
import subprocess
import sys
import traceback
+import functools
from collections import OrderedDict
from copy import deepcopy
from datetime import datetime, timedelta
@@ -2552,6 +2553,7 @@ def create_route_maps(tgen, input_dict, build=False):
nexthop = set_data.setdefault("nexthop", None)
origin = set_data.setdefault("origin", None)
ext_comm_list = set_data.setdefault("extcommunity", {})
+ metrictype = set_data.setdefault("metric-type", {})
# Local Preference
if local_preference:
@@ -2559,6 +2561,10 @@ def create_route_maps(tgen, input_dict, build=False):
"set local-preference {}".format(local_preference)
)
+ # Metric-Type
+ if metrictype:
+ rmap_data.append("set metric-type {}\n".format(metrictype))
+
# Metric
if metric:
rmap_data.append("set metric {} \n".format(metric))
@@ -2965,24 +2971,34 @@ def addKernelRoute(
logger.info("[DUT: {}]: Running command: [{}]".format(router, cmd))
output = rnode.run(cmd)
- # Verifying if ip route added to kernal
- result = rnode.run(verify_cmd)
- logger.debug("{}\n{}".format(verify_cmd, result))
- if "/" in grp_addr:
- ip, mask = grp_addr.split("/")
- if mask == "32" or mask == "128":
- grp_addr = ip
- else:
- mask = "32" if addr_type == "ipv4" else "128"
+ def check_in_kernel(rnode, verify_cmd, grp_addr, router):
+ # Verifying if ip route added to kernal
+ errormsg = None
+ result = rnode.run(verify_cmd)
+ logger.debug("{}\n{}".format(verify_cmd, result))
+ if "/" in grp_addr:
+ ip, mask = grp_addr.split("/")
+ if mask == "32" or mask == "128":
+ grp_addr = ip
+ else:
+ mask = "32" if addr_type == "ipv4" else "128"
- if not re_search(r"{}".format(grp_addr), result) and mask != "0":
- errormsg = (
- "[DUT: {}]: Kernal route is not added for group"
- " address {} Config output: {}".format(router, grp_addr, output)
- )
+ if not re_search(r"{}".format(grp_addr), result) and mask != "0":
+ errormsg = (
+ "[DUT: {}]: Kernal route is not added for group"
+ " address {} Config output: {}".format(
+ router, grp_addr, output
+ )
+ )
return errormsg
+ test_func = functools.partial(
+ check_in_kernel, rnode, verify_cmd, grp_addr, router
+ )
+ (result, out) = topotest.run_and_expect(test_func, None, count=20, wait=1)
+ assert result, out
+
logger.debug("Exiting lib API: addKernelRoute()")
return True
diff --git a/tests/topotests/lib/ltemplate.py b/tests/topotests/lib/ltemplate.py
index c98bfac9ee..18882285ed 100644
--- a/tests/topotests/lib/ltemplate.py
+++ b/tests/topotests/lib/ltemplate.py
@@ -291,7 +291,7 @@ def ltemplateVersionCheck(
# collect/log info on iproute2
cc = ltemplateRtrCmd()
found = cc.doCmd(
- tgen, rname, "apt-cache policy iproute2", "Installed: ([\d\.]*)"
+ tgen, rname, "apt-cache policy iproute2", r"Installed: ([\d\.]*)"
)
if found != None:
iproute2Ver = found.group(1)
diff --git a/tests/topotests/lib/lutil.py b/tests/topotests/lib/lutil.py
index c17c7f14e7..5c1fa24a7b 100644
--- a/tests/topotests/lib/lutil.py
+++ b/tests/topotests/lib/lutil.py
@@ -189,11 +189,8 @@ Total %-4d %-4d %d\n\
self.log("unable to read: " + tstFile)
sys.exit(1)
- def command(self, target, command, regexp, op, result, returnJson):
+ def command(self, target, command, regexp, op, result, returnJson, startt=None):
global net
- if op != "wait":
- self.l_line += 1
-
if op == "jsoncmp_pass" or op == "jsoncmp_fail":
returnJson = True
@@ -294,7 +291,11 @@ Total %-4d %-4d %d\n\
% (group_nl_converted, ret),
9,
)
- if op == "pass" or op == "fail":
+ if startt != None:
+ if js != None or ret is not False:
+ delta = time.time() - startt
+ self.result(target, success, "%s +%4.2f secs" % (result, delta))
+ elif op == "pass" or op == "fail":
self.result(target, success, result)
if js != None:
return js
@@ -326,7 +327,7 @@ Total %-4d %-4d %d\n\
while wait_count > 0:
n += 1
- found = self.command(target, command, regexp, op, result, returnJson)
+ found = self.command(target, command, regexp, op, result, returnJson, startt)
if found is not False:
break
@@ -336,14 +337,6 @@ Total %-4d %-4d %d\n\
delta = time.time() - startt
self.log("Done after %d loops, time=%s, Found=%s" % (n, delta, found))
- found = self.command(
- target,
- command,
- regexp,
- "pass",
- "%s +%4.2f secs" % (result, delta),
- returnJson,
- )
return found
diff --git a/tests/topotests/lib/ospf.py b/tests/topotests/lib/ospf.py
index c425e121af..92d29ad1ab 100644
--- a/tests/topotests/lib/ospf.py
+++ b/tests/topotests/lib/ospf.py
@@ -265,35 +265,6 @@ def __create_ospf_global(tgen, input_dict, router, build, load_config, ospf):
cmd = "no {}".format(cmd)
config_data.append(cmd)
- # area interface information for ospf6d only
- if ospf == "ospf6":
- area_iface = ospf_data.setdefault("neighbors", {})
- if area_iface:
- for neighbor in area_iface:
- if "area" in area_iface[neighbor]:
- iface = input_dict[router]["links"][neighbor]["interface"]
- cmd = "interface {} area {}".format(
- iface, area_iface[neighbor]["area"]
- )
- if area_iface[neighbor].setdefault("delete", False):
- cmd = "no {}".format(cmd)
- config_data.append(cmd)
-
- try:
- if "area" in input_dict[router]["links"][neighbor]["ospf6"]:
- iface = input_dict[router]["links"][neighbor]["interface"]
- cmd = "interface {} area {}".format(
- iface,
- input_dict[router]["links"][neighbor]["ospf6"]["area"],
- )
- if input_dict[router]["links"][neighbor].setdefault(
- "delete", False
- ):
- cmd = "no {}".format(cmd)
- config_data.append(cmd)
- except KeyError:
- pass
-
# summary information
summary_data = ospf_data.setdefault("summary-address", {})
if summary_data:
@@ -363,69 +334,6 @@ def __create_ospf_global(tgen, input_dict, router, build, load_config, ospf):
return config_data
-def create_router_ospf6(
- tgen, topo=None, input_dict=None, build=False, load_config=True
-):
- """
- API to configure ospf on router
-
- Parameters
- ----------
- * `tgen` : Topogen object
- * `topo` : json file data
- * `input_dict` : Input dict data, required when configuring from testcase
- * `build` : Only for initial setup phase this is set as True.
-
- Usage
- -----
- input_dict = {
- "r1": {
- "ospf6": {
- "router_id": "22.22.22.22",
- }
- }
-
- Returns
- -------
- True or False
- """
- logger.debug("Entering lib API: create_router_ospf6()")
- result = False
-
- if topo is None:
- topo = tgen.json_topo
-
- if not input_dict:
- input_dict = deepcopy(topo)
- else:
- topo = topo["routers"]
- input_dict = deepcopy(input_dict)
-
- config_data_dict = {}
-
- for router in input_dict.keys():
- if "ospf6" not in input_dict[router]:
- logger.debug("Router %s: 'ospf6' not present in input_dict", router)
- continue
-
- config_data = __create_ospf_global(
- tgen, input_dict, router, build, load_config, "ospf6"
- )
- if config_data:
- config_data_dict[router] = config_data
-
- try:
- result = create_common_configurations(
- tgen, config_data_dict, "ospf6", build, load_config
- )
- except InvalidCLIError:
- logger.error("create_router_ospf6", exc_info=True)
- result = False
-
- logger.debug("Exiting lib API: create_router_ospf6()")
- return result
-
-
def config_ospf_interface(
tgen, topo=None, input_dict=None, build=False, load_config=True
):
@@ -874,6 +782,16 @@ def verify_ospf6_neighbor(tgen, topo=None, dut=None, input_dict=None, lan=False)
}
result = verify_ospf6_neighbor(tgen, topo, dut, input_dict, lan=True)
+ 3. To check there are no neighbors.
+ input_dict = {
+ "r0": {
+ "ospf6": {
+ "neighbors": []
+ }
+ }
+ }
+ result = verify_ospf6_neighbor(tgen, topo, dut, input_dict)
+
Returns
-------
True or False (Error Message)
@@ -904,6 +822,19 @@ def verify_ospf6_neighbor(tgen, topo=None, dut=None, input_dict=None, lan=False)
ospf_data_list = input_dict[router]["ospf6"]
ospf_nbr_list = ospf_data_list["neighbors"]
+ # Check if looking for no neighbors
+ if ospf_nbr_list == []:
+ if show_ospf_json["neighbors"] == []:
+ logger.info("[DUT: {}] OSPF6 no neighbors found".format(router))
+ return True
+ else:
+ errormsg = (
+ "[DUT: {}] OSPF6 active neighbors found, expected None".format(
+ router
+ )
+ )
+ return errormsg
+
for ospf_nbr, nbr_data in ospf_nbr_list.items():
try:
diff --git a/tests/topotests/lib/pim.py b/tests/topotests/lib/pim.py
index 944981add4..1f723eab93 100644
--- a/tests/topotests/lib/pim.py
+++ b/tests/topotests/lib/pim.py
@@ -21,8 +21,10 @@ import os
import re
import sys
import traceback
+import functools
from copy import deepcopy
from time import sleep
+from lib import topotest
# Import common_config to use commomnly used APIs
@@ -1441,16 +1443,16 @@ def verify_pim_state(
return True
-def verify_pim_interface_traffic(tgen, input_dict):
+def get_pim_interface_traffic(tgen, input_dict):
"""
- Verify ip pim interface traffice by running
+ get ip pim interface traffice by running
"show ip pim interface traffic" cli
Parameters
----------
* `tgen`: topogen object
* `input_dict(dict)`: defines DUT, what and from which interfaces
- traffic needs to be verified
+ traffic needs to be retrieved
Usage
-----
input_dict = {
@@ -1464,7 +1466,7 @@ def verify_pim_interface_traffic(tgen, input_dict):
}
}
- result = verify_pim_interface_traffic(tgen, input_dict)
+ result = get_pim_interface_traffic(tgen, input_dict)
Returns
-------
@@ -1481,24 +1483,34 @@ def verify_pim_interface_traffic(tgen, input_dict):
rnode = tgen.routers()[dut]
logger.info("[DUT: %s]: Verifying pim interface traffic", dut)
- show_pim_intf_traffic_json = run_frr_cmd(
- rnode, "show ip pim interface traffic json", isjson=True
- )
- output_dict[dut] = {}
- for intf, data in input_dict[dut].items():
- interface_json = show_pim_intf_traffic_json[intf]
- for state in data:
+ def show_pim_intf_traffic(rnode, dut, input_dict, output_dict):
+ show_pim_intf_traffic_json = run_frr_cmd(
+ rnode, "show ip pim interface traffic json", isjson=True
+ )
- # Verify Tx/Rx
- if state in interface_json:
- output_dict[dut][state] = interface_json[state]
- else:
- errormsg = (
- "[DUT %s]: %s is not present"
- "for interface %s [FAILED]!! " % (dut, state, intf)
- )
- return errormsg
+ output_dict[dut] = {}
+ for intf, data in input_dict[dut].items():
+ interface_json = show_pim_intf_traffic_json[intf]
+ for state in data:
+
+ # Verify Tx/Rx
+ if state in interface_json:
+ output_dict[dut][state] = interface_json[state]
+ else:
+ errormsg = (
+ "[DUT %s]: %s is not present"
+ "for interface %s [FAILED]!! " % (dut, state, intf)
+ )
+ return errormsg
+ return None
+
+ test_func = functools.partial(
+ show_pim_intf_traffic, rnode, dut, input_dict, output_dict
+ )
+ (result, out) = topotest.run_and_expect(test_func, None, count=20, wait=1)
+ if not result:
+ return out
logger.debug("Exiting lib API: {}".format(sys._getframe().f_code.co_name))
return output_dict
diff --git a/tests/topotests/lib/topojson.py b/tests/topotests/lib/topojson.py
index 4f23e1ace0..3ca3353ed3 100644
--- a/tests/topotests/lib/topojson.py
+++ b/tests/topotests/lib/topojson.py
@@ -40,7 +40,7 @@ from lib.common_config import (
topo_daemons,
number_to_column,
)
-from lib.ospf import create_router_ospf, create_router_ospf6
+from lib.ospf import create_router_ospf
from lib.pim import create_igmp_config, create_pim_config
from lib.topolog import logger
@@ -334,7 +334,6 @@ def build_config_from_json(tgen, topo=None, save_bkup=True):
("igmp", create_igmp_config),
("bgp", create_router_bgp),
("ospf", create_router_ospf),
- ("ospf6", create_router_ospf6),
]
)
@@ -353,6 +352,18 @@ def build_config_from_json(tgen, topo=None, save_bkup=True):
logger.info("build_config_from_json: failed to configure topology")
pytest.exit(1)
+ logger.info("Built config now clearing ospf neighbors as that router-id might not be what is used")
+ for ospf in ["ospf", "ospf6"]:
+ for router in data:
+ if ospf not in data[router]:
+ continue
+
+ r = tgen.gears[router]
+ if ospf == "ospf":
+ r.vtysh_cmd("clear ip ospf process")
+ else:
+ r.vtysh_cmd("clear ipv6 ospf6 process")
+
def create_tgen_from_json(testfile, json_file=None):
"""Create a topogen object given a testfile.
diff --git a/tests/topotests/lib/topotest.py b/tests/topotests/lib/topotest.py
index b98698185c..6be644ac00 100644
--- a/tests/topotests/lib/topotest.py
+++ b/tests/topotests/lib/topotest.py
@@ -1386,7 +1386,6 @@ class Router(Node):
if params.get("routertype") is not None:
self.routertype = params.get("routertype")
- self.cmd("ulimit -c unlimited")
# Set ownership of config files
self.cmd("chown {0}:{0}vty /etc/{0}".format(self.routertype))
@@ -1445,7 +1444,7 @@ class Router(Node):
running = self.listDaemons()
if running:
- for _ in range(0, 5):
+ for _ in range(0, 30):
sleep(
0.5,
"{}: waiting for daemons stopping: {}".format(
@@ -1725,7 +1724,7 @@ class Router(Node):
)
if valgrind_extra:
cmdenv += (
- "--gen-suppressions=all --expensive-definedness-checks=yes"
+ " --gen-suppressions=all --expensive-definedness-checks=yes"
)
elif daemon in strace_daemons or "all" in strace_daemons:
cmdenv = "strace -f -D -o {1}/{2}.strace.{0} ".format(
@@ -1860,7 +1859,7 @@ class Router(Node):
self.cmd("kill -9 %s" % daemonpid)
if pid_exists(int(daemonpid)):
numRunning += 1
- if wait and numRunning > 0:
+ while wait and numRunning > 0:
sleep(
2,
"{}: waiting for {} daemon to be stopped".format(
@@ -1884,7 +1883,11 @@ class Router(Node):
)
)
self.cmd("kill -9 %s" % daemonpid)
- self.cmd("rm -- {}".format(d.rstrip()))
+ if daemonpid.isdigit() and not pid_exists(
+ int(daemonpid)
+ ):
+ numRunning -= 1
+ self.cmd("rm -- {}".format(d.rstrip()))
if wait:
errors = self.checkRouterCores(reportOnce=True)
if self.checkRouterVersion("<", minErrorVersion):
diff --git a/tests/topotests/msdp_topo1/r1/pimd.conf b/tests/topotests/msdp_topo1/r1/pimd.conf
index 4274315271..5bb268ebef 100644
--- a/tests/topotests/msdp_topo1/r1/pimd.conf
+++ b/tests/topotests/msdp_topo1/r1/pimd.conf
@@ -1,5 +1,5 @@
-debug pim
-debug pim zebra
+! debug pim
+! debug pim zebra
!
interface lo
ip pim
diff --git a/tests/topotests/msdp_topo1/r2/pimd.conf b/tests/topotests/msdp_topo1/r2/pimd.conf
index a4a69bf05c..733bd6f2f1 100644
--- a/tests/topotests/msdp_topo1/r2/pimd.conf
+++ b/tests/topotests/msdp_topo1/r2/pimd.conf
@@ -1,5 +1,5 @@
-debug pim
-debug pim zebra
+! debug pim
+! debug pim zebra
!
interface lo
ip pim
diff --git a/tests/topotests/msdp_topo1/r3/pimd.conf b/tests/topotests/msdp_topo1/r3/pimd.conf
index db94447c76..47987c0aa8 100644
--- a/tests/topotests/msdp_topo1/r3/pimd.conf
+++ b/tests/topotests/msdp_topo1/r3/pimd.conf
@@ -1,5 +1,5 @@
-debug pim
-debug pim zebra
+! debug pim
+! debug pim zebra
!
interface lo
ip pim
diff --git a/tests/topotests/msdp_topo1/r4/pimd.conf b/tests/topotests/msdp_topo1/r4/pimd.conf
index e9bb59054c..28085913fb 100644
--- a/tests/topotests/msdp_topo1/r4/pimd.conf
+++ b/tests/topotests/msdp_topo1/r4/pimd.conf
@@ -1,5 +1,5 @@
-debug pim
-debug pim zebra
+! debug pim
+! debug pim zebra
!
interface lo
ip pim
diff --git a/tests/topotests/multicast_pim_bsm_topo1/test_mcast_pim_bsmp_01.py b/tests/topotests/multicast_pim_bsm_topo1/test_mcast_pim_bsmp_01.py
index a94dcb505a..a8418d400d 100644
--- a/tests/topotests/multicast_pim_bsm_topo1/test_mcast_pim_bsmp_01.py
+++ b/tests/topotests/multicast_pim_bsm_topo1/test_mcast_pim_bsmp_01.py
@@ -104,7 +104,7 @@ from lib.pim import (
enable_disable_pim_bsm,
clear_ip_mroute,
clear_ip_pim_interface_traffic,
- verify_pim_interface_traffic,
+ get_pim_interface_traffic,
McastTesterHelper,
)
from lib.topolog import logger
@@ -648,7 +648,7 @@ def test_BSR_CRP_with_blackhole_address_p1(request):
step("Verify bsm transit count is not increamented" "show ip pim interface traffic")
state_dict = {"f1": {intf_f1_i1: ["bsmTx"]}}
- state_before = verify_pim_interface_traffic(tgen, state_dict)
+ state_before = get_pim_interface_traffic(tgen, state_dict)
assert isinstance(
state_before, dict
), "Testcase{} : Failed \n state_before is not dictionary \n Error: {}".format(
@@ -673,7 +673,7 @@ def test_BSR_CRP_with_blackhole_address_p1(request):
tc_name, result
)
- state_after = verify_pim_interface_traffic(tgen, state_dict)
+ state_after = get_pim_interface_traffic(tgen, state_dict)
assert isinstance(
state_after, dict
), "Testcase{} : Failed \n state_before is not dictionary \n Error: {}".format(
@@ -848,6 +848,10 @@ def test_new_router_fwd_p0(request):
assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result)
do_countdown(5)
+ step("Verify again if BSR is installed from bsm forwarded by i1")
+ result = verify_pim_bsr(tgen, topo, "l1", bsr_ip)
+ assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result)
+
# Verify ip mroute populated again
step("Verify mroute again on l1 (lhr)")
result = verify_ip_mroutes(tgen, "l1", src_addr, GROUP_ADDRESS, iif, oil)
diff --git a/tests/topotests/multicast_pim_sm_topo1/test_multicast_pim_sm_topo1.py b/tests/topotests/multicast_pim_sm_topo1/test_multicast_pim_sm_topo1.py
index dc14bc6468..9929f4b3c7 100755
--- a/tests/topotests/multicast_pim_sm_topo1/test_multicast_pim_sm_topo1.py
+++ b/tests/topotests/multicast_pim_sm_topo1/test_multicast_pim_sm_topo1.py
@@ -84,7 +84,7 @@ from lib.pim import (
create_igmp_config,
verify_igmp_groups,
verify_ip_mroutes,
- verify_pim_interface_traffic,
+ get_pim_interface_traffic,
verify_upstream_iif,
verify_ip_pim_join,
clear_ip_mroute,
@@ -280,7 +280,7 @@ def test_multicast_data_traffic_static_RP_send_join_then_traffic_p0(request):
step("get joinRx value before join")
intf_r2_l1 = topo["routers"]["r2"]["links"]["l1"]["interface"]
state_dict = {"r2": {intf_r2_l1: ["joinRx"]}}
- state_before = verify_pim_interface_traffic(tgen, state_dict)
+ state_before = get_pim_interface_traffic(tgen, state_dict)
assert isinstance(
state_before, dict
), "Testcase {} : Failed \n state_before is not dictionary \n Error: {}".format(
@@ -352,7 +352,7 @@ def test_multicast_data_traffic_static_RP_send_join_then_traffic_p0(request):
assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
step("joinRx value after join sent")
- state_after = verify_pim_interface_traffic(tgen, state_dict)
+ state_after = get_pim_interface_traffic(tgen, state_dict)
assert isinstance(
state_after, dict
), "Testcase {} : Failed \n state_before is not dictionary \n Error: {}".format(
@@ -425,7 +425,7 @@ def test_multicast_data_traffic_static_RP_send_traffic_then_join_p0(request):
step("Enable IGMP on FRR1 interface and send IGMP join (225.1.1.1)")
step("joinRx value before join sent")
state_dict = {"r2": {"r2-l1-eth2": ["joinRx"]}}
- state_before = verify_pim_interface_traffic(tgen, state_dict)
+ state_before = get_pim_interface_traffic(tgen, state_dict)
assert isinstance(
state_before, dict
), "Testcase {} : Failed \n state_before is not dictionary \n Error: {}".format(
@@ -474,7 +474,7 @@ def test_multicast_data_traffic_static_RP_send_traffic_then_join_p0(request):
assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
step("joinRx value after join sent")
- state_after = verify_pim_interface_traffic(tgen, state_dict)
+ state_after = get_pim_interface_traffic(tgen, state_dict)
assert isinstance(
state_after, dict
), "Testcase {} : Failed \n state_before is not dictionary \n Error: {}".format(
diff --git a/tests/topotests/multicast_pim_sm_topo2/test_multicast_pim_sm_topo2.py b/tests/topotests/multicast_pim_sm_topo2/test_multicast_pim_sm_topo2.py
index c7d453ad81..57561c78eb 100755
--- a/tests/topotests/multicast_pim_sm_topo2/test_multicast_pim_sm_topo2.py
+++ b/tests/topotests/multicast_pim_sm_topo2/test_multicast_pim_sm_topo2.py
@@ -82,7 +82,7 @@ from lib.pim import (
create_igmp_config,
verify_igmp_groups,
verify_ip_mroutes,
- verify_pim_interface_traffic,
+ get_pim_interface_traffic,
verify_upstream_iif,
verify_pim_neighbors,
verify_pim_state,
@@ -731,7 +731,7 @@ def test_verify_SPT_switchover_when_RPT_and_SPT_path_is_different_p0(request):
step("registerRx and registerStopTx value before traffic sent")
state_dict = {"c2": {"c2-f1-eth1": ["registerRx", "registerStopTx"]}}
- state_before = verify_pim_interface_traffic(tgen, state_dict)
+ state_before = get_pim_interface_traffic(tgen, state_dict)
assert isinstance(
state_before, dict
), "Testcase {} : Failed \n state_before is not dictionary \nError: {}".format(
@@ -815,7 +815,7 @@ def test_verify_SPT_switchover_when_RPT_and_SPT_path_is_different_p0(request):
assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
step("registerRx and registerStopTx value after traffic sent")
- state_after = verify_pim_interface_traffic(tgen, state_dict)
+ state_after = get_pim_interface_traffic(tgen, state_dict)
assert isinstance(
state_after, dict
), "Testcase {} : Failed \n state_before is not dictionary \nError: {}".format(
diff --git a/tests/topotests/multicast_pim_sm_topo3/test_multicast_pim_sm_topo4.py b/tests/topotests/multicast_pim_sm_topo3/test_multicast_pim_sm_topo4.py
index 5e29a1f1fd..1fc6fddefe 100755
--- a/tests/topotests/multicast_pim_sm_topo3/test_multicast_pim_sm_topo4.py
+++ b/tests/topotests/multicast_pim_sm_topo3/test_multicast_pim_sm_topo4.py
@@ -78,11 +78,13 @@ from lib.pim import (
verify_upstream_iif,
clear_ip_mroute,
verify_pim_rp_info,
- verify_pim_interface_traffic,
+ get_pim_interface_traffic,
McastTesterHelper,
)
from lib.topolog import logger
from lib.topojson import build_config_from_json
+from time import sleep
+
TOPOLOGY = """
@@ -930,7 +932,7 @@ def test_PIM_hello_tx_rx_p1(request):
}
}
- c1_state_before = verify_pim_interface_traffic(tgen, state_dict)
+ c1_state_before = get_pim_interface_traffic(tgen, state_dict)
assert isinstance(
c1_state_before, dict
), "Testcase{} : Failed \n state_before is not dictionary \n Error: {}".format(
@@ -946,19 +948,30 @@ def test_PIM_hello_tx_rx_p1(request):
)
shutdown_bringup_interface(tgen, "c1", intf_c1_l1, True)
- step("verify stats after on c1")
- c1_state_after = verify_pim_interface_traffic(tgen, state_dict)
- assert isinstance(
- c1_state_after, dict
- ), "Testcase{} : Failed \n state_before is not dictionary \n Error: {}".format(
- tc_name, result
- )
+ step("verify stats after on c1 and that they are incremented")
+
+ count = 0
+ done = False
+ while not done and count <= 7:
+ c1_state_after = get_pim_interface_traffic(tgen, state_dict)
+ assert isinstance(
+ c1_state_after, dict
+ ), "Testcase{} : Failed \n state_before is not dictionary \n Error: {}".format(
+ tc_name, result
+ )
+
+ result = verify_state_incremented(c1_state_before, c1_state_after)
+ if result is not True:
+ sleep(5)
+ count += 1
+ else:
+ done = True
- step("verify stats not increamented on c1")
- result = verify_state_incremented(c1_state_before, c1_state_after)
assert (
- result is not True
- ), "Testcase{} : Failed Error: {}" "stats incremented".format(tc_name, result)
+ result is True
+ ), "Testcase{} : Failed Error: {}" "stats is not incremented".format(
+ tc_name, result
+ )
step("verify before stats on l1")
l1_state_dict = {
@@ -967,7 +980,7 @@ def test_PIM_hello_tx_rx_p1(request):
}
}
- l1_state_before = verify_pim_interface_traffic(tgen, l1_state_dict)
+ l1_state_before = get_pim_interface_traffic(tgen, l1_state_dict)
assert isinstance(
l1_state_before, dict
), "Testcase{} : Failed \n state_before is not dictionary \n Error: {}".format(
@@ -983,16 +996,24 @@ def test_PIM_hello_tx_rx_p1(request):
)
shutdown_bringup_interface(tgen, "l1", intf_l1_c1, True)
- step("verify stats after on l1")
- l1_state_after = verify_pim_interface_traffic(tgen, l1_state_dict)
- assert isinstance(
- l1_state_after, dict
- ), "Testcase{} : Failed \n state_before is not dictionary \n Error: {}".format(
- tc_name, result
- )
+ step("verify stats after on l1 are incremented")
+ count = 0
+ done = False
+ while not done and count <= 7:
+ l1_state_after = get_pim_interface_traffic(tgen, l1_state_dict)
+ assert isinstance(
+ l1_state_after, dict
+ ), "Testcase{} : Failed \n state_before is not dictionary \n Error: {}".format(
+ tc_name, result
+ )
+
+ result = verify_state_incremented(l1_state_before, l1_state_after)
+ if result is True:
+ sleep(5)
+ count += 1
+ else:
+ done = True
- step("verify stats not increamented on l1")
- result = verify_state_incremented(l1_state_before, l1_state_after)
assert (
result is not True
), "Testcase{} : Failed Error: {}" "stats incremented".format(tc_name, result)
@@ -1010,7 +1031,7 @@ def test_PIM_hello_tx_rx_p1(request):
}
}
- c1_state_before = verify_pim_interface_traffic(tgen, state_dict)
+ c1_state_before = get_pim_interface_traffic(tgen, state_dict)
assert isinstance(
c1_state_before, dict
), "Testcase{} : Failed \n state_before is not dictionary \n Error: {}".format(
@@ -1033,20 +1054,28 @@ def test_PIM_hello_tx_rx_p1(request):
result = apply_raw_config(tgen, raw_config)
assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
- step("verify stats after on c1")
- c1_state_after = verify_pim_interface_traffic(tgen, state_dict)
- assert isinstance(
- c1_state_after, dict
- ), "Testcase{} : Failed \n state_before is not dictionary \n Error: {}".format(
+ step("verify stats after on c1 are incremented")
+ count = 0
+ done = False
+ while not done and count <= 7:
+ c1_state_after = get_pim_interface_traffic(tgen, state_dict)
+ assert isinstance(
+ c1_state_after, dict
+ ), "Testcase{} : Failed \n state_before is not dictionary \n Error: {}".format(
+ tc_name, result
+ )
+
+ result = verify_state_incremented(c1_state_before, c1_state_after)
+ if result is not True:
+ sleep(5)
+ count += 1
+ else:
+ done = True
+
+ assert result is True, "Testcase{} : Failed Error: {}" "stats incremented".format(
tc_name, result
)
- step("verify stats not increamented on c1")
- result = verify_state_incremented(c1_state_before, c1_state_after)
- assert (
- result is not True
- ), "Testcase{} : Failed Error: {}" "stats incremented".format(tc_name, result)
-
write_test_footer(tc_name)
diff --git a/tests/topotests/multicast_pim_static_rp_topo1/test_multicast_pim_static_rp.py b/tests/topotests/multicast_pim_static_rp_topo1/test_multicast_pim_static_rp.py
index 9bbe3ca028..a5cec93813 100755
--- a/tests/topotests/multicast_pim_static_rp_topo1/test_multicast_pim_static_rp.py
+++ b/tests/topotests/multicast_pim_static_rp_topo1/test_multicast_pim_static_rp.py
@@ -137,7 +137,7 @@ from lib.pim import (
verify_join_state_and_timer,
verify_ip_mroutes,
verify_pim_neighbors,
- verify_pim_interface_traffic,
+ get_pim_interface_traffic,
verify_pim_rp_info,
verify_pim_state,
clear_ip_pim_interface_traffic,
@@ -386,7 +386,7 @@ def test_add_delete_static_RP_p0(request):
step("r1: Verify show ip pim interface traffic without any IGMP join")
state_dict = {"r1": {"r1-r2-eth1": ["pruneTx"]}}
- state_before = verify_pim_interface_traffic(tgen, state_dict)
+ state_before = get_pim_interface_traffic(tgen, state_dict)
assert isinstance(
state_before, dict
), "Testcase {} : Failed \n state_before is not dictionary\n Error: {}".format(
@@ -488,7 +488,7 @@ def test_add_delete_static_RP_p0(request):
)
step("r1: Verify show ip pim interface traffic without any IGMP join")
- state_after = verify_pim_interface_traffic(tgen, state_dict)
+ state_after = get_pim_interface_traffic(tgen, state_dict)
assert isinstance(
state_after, dict
), "Testcase {} : Failed \n state_before is not dictionary \n Error: {}".format(
@@ -699,7 +699,7 @@ def test_not_reachable_static_RP_p0(request):
"show ip pim interface traffic"
)
state_dict = {"r1": {"r1-r2-eth1": ["pruneTx"]}}
- state_before = verify_pim_interface_traffic(tgen, state_dict)
+ state_before = get_pim_interface_traffic(tgen, state_dict)
assert isinstance(
state_before, dict
), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
@@ -800,7 +800,7 @@ def test_not_reachable_static_RP_p0(request):
"r1: (*,G) prune is sent towards the RP interface, verify using"
"show ip pim interface traffic"
)
- state_after = verify_pim_interface_traffic(tgen, state_dict)
+ state_after = get_pim_interface_traffic(tgen, state_dict)
assert isinstance(
state_after, dict
), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
@@ -888,7 +888,7 @@ def test_add_RP_after_join_received_p1(request):
step("joinTx value before join sent")
state_dict = {"r1": {"r1-r2-eth1": ["joinTx"]}}
- state_before = verify_pim_interface_traffic(tgen, state_dict)
+ state_before = get_pim_interface_traffic(tgen, state_dict)
assert isinstance(
state_before, dict
), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
@@ -979,7 +979,7 @@ def test_add_RP_after_join_received_p1(request):
assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
logger.info("Expected behavior: %s", result)
- state_after = verify_pim_interface_traffic(tgen, state_dict)
+ state_after = get_pim_interface_traffic(tgen, state_dict)
assert isinstance(
state_after, dict
), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
@@ -1024,7 +1024,7 @@ def test_reachable_static_RP_after_join_p0(request):
step("r1 : Verify pim interface traffic")
state_dict = {"r1": {"r1-r2-eth1": ["joinTx"]}}
- state_before = verify_pim_interface_traffic(tgen, state_dict)
+ state_before = get_pim_interface_traffic(tgen, state_dict)
assert isinstance(
state_before, dict
), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
@@ -1123,7 +1123,7 @@ def test_reachable_static_RP_after_join_p0(request):
logger.info("Expected behavior: %s", result)
step("r1 : Verify pim interface traffic")
- state_after = verify_pim_interface_traffic(tgen, state_dict)
+ state_after = get_pim_interface_traffic(tgen, state_dict)
assert isinstance(
state_after, dict
), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
@@ -1211,7 +1211,7 @@ def test_send_join_on_higher_preffered_rp_p1(request):
step("r1 : Verify joinTx count before sending join")
state_dict = {"r1": {"r1-r4-eth3": ["joinTx"], "r1-r2-eth1": ["pruneTx"]}}
- state_before = verify_pim_interface_traffic(tgen, state_dict)
+ state_before = get_pim_interface_traffic(tgen, state_dict)
assert isinstance(
state_before, dict
), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
@@ -1261,7 +1261,7 @@ def test_send_join_on_higher_preffered_rp_p1(request):
step("r1 : Verify join is sent to higher preferred RP")
step("r1 : Verify prune is sent to lower preferred RP")
- state_after = verify_pim_interface_traffic(tgen, state_dict)
+ state_after = get_pim_interface_traffic(tgen, state_dict)
assert isinstance(
state_after, dict
), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
@@ -1293,7 +1293,7 @@ def test_send_join_on_higher_preffered_rp_p1(request):
step("r1 : Verify joinTx, pruneTx count before RP gets deleted")
state_dict = {"r1": {"r1-r2-eth1": ["joinTx"], "r1-r4-eth3": ["pruneTx"]}}
- state_before = verify_pim_interface_traffic(tgen, state_dict)
+ state_before = get_pim_interface_traffic(tgen, state_dict)
assert isinstance(
state_before, dict
), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
@@ -1375,7 +1375,7 @@ def test_send_join_on_higher_preffered_rp_p1(request):
"r1 : Verify prune is sent to higher preferred RP when higher"
" preferred RP gets deleted"
)
- state_after = verify_pim_interface_traffic(tgen, state_dict)
+ state_after = get_pim_interface_traffic(tgen, state_dict)
assert isinstance(
state_after, dict
), "Testcase{} : Failed \n state_before is not dictionary \n " "Error: {}".format(
diff --git a/tests/topotests/nhrp_topo/r1/nhrpd.conf b/tests/topotests/nhrp_topo/r1/nhrpd.conf
index 04114bdbe6..e5224e4aab 100644
--- a/tests/topotests/nhrp_topo/r1/nhrpd.conf
+++ b/tests/topotests/nhrp_topo/r1/nhrpd.conf
@@ -1,5 +1,5 @@
log stdout debugging
-debug nhrp all
+! debug nhrp all
interface r1-gre0
ip nhrp holdtime 500
ip nhrp shortcut
diff --git a/tests/topotests/nhrp_topo/r2/nhrpd.conf b/tests/topotests/nhrp_topo/r2/nhrpd.conf
index e4f6fb7445..f9185f9a63 100644
--- a/tests/topotests/nhrp_topo/r2/nhrpd.conf
+++ b/tests/topotests/nhrp_topo/r2/nhrpd.conf
@@ -1,4 +1,4 @@
-debug nhrp all
+! debug nhrp all
log stdout debugging
nhrp nflog-group 1
interface r2-gre0
diff --git a/tests/topotests/nhrp_topo/r3/zebra.conf b/tests/topotests/nhrp_topo/r3/zebra.conf
index 6d3d267978..e77f955225 100644
--- a/tests/topotests/nhrp_topo/r3/zebra.conf
+++ b/tests/topotests/nhrp_topo/r3/zebra.conf
@@ -1,7 +1,7 @@
-debug zebra kernel
-debug zebra rib
-debug zebra events
-debug zebra packet
+! debug zebra kernel
+! debug zebra rib
+! debug zebra events
+! debug zebra packet
ip forwarding
interface r3-eth0
ip address 10.1.1.3/24
diff --git a/tests/topotests/nhrp_topo/test_nhrp_topo.py b/tests/topotests/nhrp_topo/test_nhrp_topo.py
index 2dd00c0184..e6e551906a 100644
--- a/tests/topotests/nhrp_topo/test_nhrp_topo.py
+++ b/tests/topotests/nhrp_topo/test_nhrp_topo.py
@@ -41,6 +41,7 @@ sys.path.append(os.path.join(CWD, "../"))
from lib import topotest
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger
+from lib.common_config import required_linux_kernel_version
# Required to instantiate the topology builder class.
@@ -86,19 +87,24 @@ def _populate_iface():
for cmd in cmds_tot_hub:
input = cmd.format("r2", "2")
- logger.info("input: " + cmd)
- output = tgen.net["r2"].cmd(cmd.format("r2", "2"))
+ logger.info("input: " + input)
+ output = tgen.net["r2"].cmd(input)
logger.info("output: " + output)
for cmd in cmds_tot:
input = cmd.format("r1", "1")
- logger.info("input: " + cmd)
- output = tgen.net["r1"].cmd(cmd.format("r1", "1"))
+ logger.info("input: " + input)
+ output = tgen.net["r1"].cmd(input)
logger.info("output: " + output)
def setup_module(mod):
"Sets up the pytest environment"
+
+ result = required_linux_kernel_version("5.0")
+ if result is not True:
+ pytest.skip("Kernel requirements are not met")
+
tgen = Topogen(build_topo, mod.__name__)
tgen.start_topology()
diff --git a/tests/topotests/ospf6_gr_topo1/rt1/ospf6d.conf b/tests/topotests/ospf6_gr_topo1/rt1/ospf6d.conf
index 9e2ad298a3..8a9b4eb124 100644
--- a/tests/topotests/ospf6_gr_topo1/rt1/ospf6d.conf
+++ b/tests/topotests/ospf6_gr_topo1/rt1/ospf6d.conf
@@ -3,14 +3,14 @@ hostname rt1
log file ospf6d.log
log commands
!
-debug ospf6 lsa router originate
-debug ospf6 lsa router flooding
-debug ospf6 zebra
-debug ospf6 interface
-debug ospf6 neighbor
-debug ospf6 flooding
-debug ospf6 graceful-restart
-debug ospf6 spf process
+! debug ospf6 lsa router originate
+! debug ospf6 lsa router flooding
+! debug ospf6 zebra
+! debug ospf6 interface
+! debug ospf6 neighbor
+! debug ospf6 flooding
+! debug ospf6 graceful-restart
+! debug ospf6 spf process
!
interface lo
ipv6 ospf area 1
diff --git a/tests/topotests/ospf6_gr_topo1/rt1/zebra.conf b/tests/topotests/ospf6_gr_topo1/rt1/zebra.conf
index f29f5b73fb..01ecd647b5 100644
--- a/tests/topotests/ospf6_gr_topo1/rt1/zebra.conf
+++ b/tests/topotests/ospf6_gr_topo1/rt1/zebra.conf
@@ -3,10 +3,10 @@ hostname rt1
log file zebra.log
log commands
!
-debug zebra event
-debug zebra packet
-debug zebra rib
-debug zebra kernel
+! debug zebra event
+! debug zebra packet
+! debug zebra rib
+! debug zebra kernel
!
interface lo
ip address 1.1.1.1/32
diff --git a/tests/topotests/ospf6_gr_topo1/rt2/ospf6d.conf b/tests/topotests/ospf6_gr_topo1/rt2/ospf6d.conf
index cfa8758344..bcce341f51 100644
--- a/tests/topotests/ospf6_gr_topo1/rt2/ospf6d.conf
+++ b/tests/topotests/ospf6_gr_topo1/rt2/ospf6d.conf
@@ -3,14 +3,14 @@ hostname rt2
log file ospf6d.log
log commands
!
-debug ospf6 lsa router originate
-debug ospf6 lsa router flooding
-debug ospf6 zebra
-debug ospf6 interface
-debug ospf6 neighbor
-debug ospf6 flooding
-debug ospf6 graceful-restart
-debug ospf6 spf process
+! debug ospf6 lsa router originate
+! debug ospf6 lsa router flooding
+! debug ospf6 zebra
+! debug ospf6 interface
+! debug ospf6 neighbor
+! debug ospf6 flooding
+! debug ospf6 graceful-restart
+! debug ospf6 spf process
!
interface lo
ipv6 ospf area 0
diff --git a/tests/topotests/ospf6_gr_topo1/rt2/zebra.conf b/tests/topotests/ospf6_gr_topo1/rt2/zebra.conf
index e4fe7620da..5e5731b7ab 100644
--- a/tests/topotests/ospf6_gr_topo1/rt2/zebra.conf
+++ b/tests/topotests/ospf6_gr_topo1/rt2/zebra.conf
@@ -3,10 +3,10 @@ hostname rt2
log file zebra.log
log commands
!
-debug zebra event
-debug zebra packet
-debug zebra rib
-debug zebra kernel
+! debug zebra event
+! debug zebra packet
+! debug zebra rib
+! debug zebra kernel
!
interface lo
ip address 2.2.2.2/32
diff --git a/tests/topotests/ospf6_gr_topo1/rt3/ospf6d.conf b/tests/topotests/ospf6_gr_topo1/rt3/ospf6d.conf
index f33f14f34f..8dba58e07c 100644
--- a/tests/topotests/ospf6_gr_topo1/rt3/ospf6d.conf
+++ b/tests/topotests/ospf6_gr_topo1/rt3/ospf6d.conf
@@ -3,14 +3,14 @@ hostname rt3
log file ospf6d.log
log commands
!
-debug ospf6 lsa router originate
-debug ospf6 lsa router flooding
-debug ospf6 zebra
-debug ospf6 interface
-debug ospf6 neighbor
-debug ospf6 flooding
-debug ospf6 graceful-restart
-debug ospf6 spf process
+! debug ospf6 lsa router originate
+! debug ospf6 lsa router flooding
+! debug ospf6 zebra
+! debug ospf6 interface
+! debug ospf6 neighbor
+! debug ospf6 flooding
+! debug ospf6 graceful-restart
+! debug ospf6 spf process
!
interface lo
ipv6 ospf area 0
diff --git a/tests/topotests/ospf6_gr_topo1/rt3/zebra.conf b/tests/topotests/ospf6_gr_topo1/rt3/zebra.conf
index 3a9de21d30..ca3eea410d 100644
--- a/tests/topotests/ospf6_gr_topo1/rt3/zebra.conf
+++ b/tests/topotests/ospf6_gr_topo1/rt3/zebra.conf
@@ -3,10 +3,10 @@ hostname rt3
log file zebra.log
log commands
!
-debug zebra event
-debug zebra packet
-debug zebra rib
-debug zebra kernel
+! debug zebra event
+! debug zebra packet
+! debug zebra rib
+! debug zebra kernel
!
interface lo
ip address 3.3.3.3/32
diff --git a/tests/topotests/ospf6_gr_topo1/rt4/ospf6d.conf b/tests/topotests/ospf6_gr_topo1/rt4/ospf6d.conf
index 301eb57e7d..9be5321e68 100644
--- a/tests/topotests/ospf6_gr_topo1/rt4/ospf6d.conf
+++ b/tests/topotests/ospf6_gr_topo1/rt4/ospf6d.conf
@@ -3,14 +3,14 @@ hostname rt4
log file ospf6d.log
log commands
!
-debug ospf6 lsa router originate
-debug ospf6 lsa router flooding
-debug ospf6 zebra
-debug ospf6 interface
-debug ospf6 neighbor
-debug ospf6 flooding
-debug ospf6 graceful-restart
-debug ospf6 spf process
+! debug ospf6 lsa router originate
+! debug ospf6 lsa router flooding
+! debug ospf6 zebra
+! debug ospf6 interface
+! debug ospf6 neighbor
+! debug ospf6 flooding
+! debug ospf6 graceful-restart
+! debug ospf6 spf process
!
interface lo
ipv6 ospf area 0
diff --git a/tests/topotests/ospf6_gr_topo1/rt4/zebra.conf b/tests/topotests/ospf6_gr_topo1/rt4/zebra.conf
index eeea417b70..c488b2a387 100644
--- a/tests/topotests/ospf6_gr_topo1/rt4/zebra.conf
+++ b/tests/topotests/ospf6_gr_topo1/rt4/zebra.conf
@@ -3,10 +3,10 @@ hostname rt4
log file zebra.log
log commands
!
-debug zebra event
-debug zebra packet
-debug zebra rib
-debug zebra kernel
+! debug zebra event
+! debug zebra packet
+! debug zebra rib
+! debug zebra kernel
!
interface lo
ip address 4.4.4.4/32
diff --git a/tests/topotests/ospf6_gr_topo1/rt5/ospf6d.conf b/tests/topotests/ospf6_gr_topo1/rt5/ospf6d.conf
index 254fea75fc..98ba8bc447 100644
--- a/tests/topotests/ospf6_gr_topo1/rt5/ospf6d.conf
+++ b/tests/topotests/ospf6_gr_topo1/rt5/ospf6d.conf
@@ -3,14 +3,14 @@ hostname rt5
log file ospf6d.log
log commands
!
-debug ospf6 lsa router originate
-debug ospf6 lsa router flooding
-debug ospf6 zebra
-debug ospf6 interface
-debug ospf6 neighbor
-debug ospf6 flooding
-debug ospf6 graceful-restart
-debug ospf6 spf process
+! debug ospf6 lsa router originate
+! debug ospf6 lsa router flooding
+! debug ospf6 zebra
+! debug ospf6 interface
+! debug ospf6 neighbor
+! debug ospf6 flooding
+! debug ospf6 graceful-restart
+! debug ospf6 spf process
!
interface lo
ipv6 ospf area 2
diff --git a/tests/topotests/ospf6_gr_topo1/rt5/zebra.conf b/tests/topotests/ospf6_gr_topo1/rt5/zebra.conf
index 0cdb90b129..43ed901266 100644
--- a/tests/topotests/ospf6_gr_topo1/rt5/zebra.conf
+++ b/tests/topotests/ospf6_gr_topo1/rt5/zebra.conf
@@ -3,10 +3,10 @@ hostname rt5
log file zebra.log
log commands
!
-debug zebra event
-debug zebra packet
-debug zebra rib
-debug zebra kernel
+! debug zebra event
+! debug zebra packet
+! debug zebra rib
+! debug zebra kernel
!
interface lo
ip address 5.5.5.5/32
diff --git a/tests/topotests/ospf6_gr_topo1/rt6/ospf6d.conf b/tests/topotests/ospf6_gr_topo1/rt6/ospf6d.conf
index b1feb1ac57..d6d6f0cf92 100644
--- a/tests/topotests/ospf6_gr_topo1/rt6/ospf6d.conf
+++ b/tests/topotests/ospf6_gr_topo1/rt6/ospf6d.conf
@@ -3,14 +3,14 @@ hostname rt6
log file ospf6d.log
log commands
!
-debug ospf6 lsa router originate
-debug ospf6 lsa router flooding
-debug ospf6 zebra
-debug ospf6 interface
-debug ospf6 neighbor
-debug ospf6 flooding
-debug ospf6 graceful-restart
-debug ospf6 spf process
+! debug ospf6 lsa router originate
+! debug ospf6 lsa router flooding
+! debug ospf6 zebra
+! debug ospf6 interface
+! debug ospf6 neighbor
+! debug ospf6 flooding
+! debug ospf6 graceful-restart
+! debug ospf6 spf process
!
interface lo
ipv6 ospf area 0
diff --git a/tests/topotests/ospf6_gr_topo1/rt6/zebra.conf b/tests/topotests/ospf6_gr_topo1/rt6/zebra.conf
index 3c2312da8a..5ec27de17a 100644
--- a/tests/topotests/ospf6_gr_topo1/rt6/zebra.conf
+++ b/tests/topotests/ospf6_gr_topo1/rt6/zebra.conf
@@ -3,10 +3,10 @@ hostname rt6
log file zebra.log
log commands
!
-debug zebra event
-debug zebra packet
-debug zebra rib
-debug zebra kernel
+! debug zebra event
+! debug zebra packet
+! debug zebra rib
+! debug zebra kernel
!
interface lo
ip address 6.6.6.6/32
diff --git a/tests/topotests/ospf6_gr_topo1/rt7/ospf6d.conf b/tests/topotests/ospf6_gr_topo1/rt7/ospf6d.conf
index d032741d1a..cee6ee577e 100644
--- a/tests/topotests/ospf6_gr_topo1/rt7/ospf6d.conf
+++ b/tests/topotests/ospf6_gr_topo1/rt7/ospf6d.conf
@@ -3,14 +3,14 @@ hostname rt7
log file ospf6d.log
log commands
!
-debug ospf6 lsa router originate
-debug ospf6 lsa router flooding
-debug ospf6 zebra
-debug ospf6 interface
-debug ospf6 neighbor
-debug ospf6 flooding
-debug ospf6 graceful-restart
-debug ospf6 spf process
+! debug ospf6 lsa router originate
+! debug ospf6 lsa router flooding
+! debug ospf6 zebra
+! debug ospf6 interface
+! debug ospf6 neighbor
+! debug ospf6 flooding
+! debug ospf6 graceful-restart
+! debug ospf6 spf process
!
interface lo
ipv6 ospf area 3
diff --git a/tests/topotests/ospf6_gr_topo1/rt7/zebra.conf b/tests/topotests/ospf6_gr_topo1/rt7/zebra.conf
index 9cc8c29c1e..3939472b5e 100644
--- a/tests/topotests/ospf6_gr_topo1/rt7/zebra.conf
+++ b/tests/topotests/ospf6_gr_topo1/rt7/zebra.conf
@@ -3,10 +3,10 @@ hostname rt7
log file zebra.log
log commands
!
-debug zebra event
-debug zebra packet
-debug zebra rib
-debug zebra kernel
+! debug zebra event
+! debug zebra packet
+! debug zebra rib
+! debug zebra kernel
!
interface lo
ip address 7.7.7.7/32
diff --git a/tests/topotests/ospf6_gr_topo1/test_ospf6_gr_topo1.py b/tests/topotests/ospf6_gr_topo1/test_ospf6_gr_topo1.py
index ccbcadb8b1..e59333ebd2 100755
--- a/tests/topotests/ospf6_gr_topo1/test_ospf6_gr_topo1.py
+++ b/tests/topotests/ospf6_gr_topo1/test_ospf6_gr_topo1.py
@@ -171,14 +171,60 @@ def router_compare_json_output(rname, command, reference, tries):
assert diff is None, assertmsg
+def expect_grace_lsa(restarting, helper):
+ """
+ Check if the given helper neighbor has already received a Grace-LSA from
+ the router performing a graceful restart.
+ """
+ tgen = get_topogen()
+
+ logger.info(
+ "'{}': checking if a Grace-LSA was received from '{}'".format(
+ helper, restarting
+ )
+ )
+ test_func = partial(
+ topotest.router_json_cmp,
+ tgen.gears[helper],
+ "show ipv6 ospf6 database json",
+ {
+ "interfaceScopedLinkStateDb": [
+ {
+ "lsa": [
+ {
+ "type": "GR",
+ "advRouter": restarting,
+ }
+ ]
+ }
+ ]
+ },
+ )
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=1)
+ assertmsg = '"{}" didn\'t receive a Grace-LSA from "{}"'.format(helper, restarting)
+
+ assert result is None, assertmsg
+
+
def check_routers(initial_convergence=False, exiting=None, restarting=None):
for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6", "rt7"]:
# Check the RIB first, which should be preserved across restarts in
# all routers of the routing domain.
+ # If we are not on initial convergence *but* we are checking
+ # after a restart. Looking in the zebra rib for installed
+ # is a recipe for test failure. Why? because if we are restarting
+ # then ospf is in the process of establishing neighbors and passing
+ # new routes to zebra. Zebra will not mark the route as installed
+ # when it receives a replacement from ospf until it has finished
+ # processing it. Let's give it a few seconds to allow this to happen
+ # under load.
if initial_convergence == True:
tries = 240
else:
- tries = 1
+ if restarting != None:
+ tries = 40
+ else:
+ tries = 1
router_compare_json_output(
rname, "show ipv6 route ospf json", "show_ipv6_route.json", tries
)
@@ -212,6 +258,26 @@ def check_routers(initial_convergence=False, exiting=None, restarting=None):
)
+def ensure_gr_is_in_zebra(rname):
+ retry = True
+ retry_times = 10
+ tgen = get_topogen()
+
+ while retry and retry_times > 0:
+ out = tgen.net[rname].cmd(
+ 'vtysh -c "show zebra client" | grep "Client: ospf6$" -A 40 | grep "Capabilities "'
+ )
+
+ if "Graceful Restart" not in out:
+ sleep(2)
+ retry_times -= 1
+ else:
+ retry = False
+
+ assertmsg = "%s does not appear to have Graceful Restart setup" % rname
+ assert not retry and retry_times > 0, assertmsg
+
+
#
# Test initial network convergence
#
@@ -238,10 +304,10 @@ def test_gr_rt1():
pytest.skip(tgen.errors)
tgen.net["rt1"].cmd('vtysh -c "graceful-restart prepare ipv6 ospf"')
- sleep(5)
+ expect_grace_lsa(restarting="1.1.1.1", helper="rt2")
+ ensure_gr_is_in_zebra("rt1")
kill_router_daemons(tgen, "rt1", ["ospf6d"], save_config=False)
check_routers(exiting="rt1")
-
start_router_daemons(tgen, "rt1", ["ospf6d"])
check_routers(restarting="rt1")
@@ -258,7 +324,9 @@ def test_gr_rt2():
pytest.skip(tgen.errors)
tgen.net["rt2"].cmd('vtysh -c "graceful-restart prepare ipv6 ospf"')
- sleep(5)
+ expect_grace_lsa(restarting="2.2.2.2", helper="rt1")
+ expect_grace_lsa(restarting="2.2.2.2", helper="rt3")
+ ensure_gr_is_in_zebra("rt2")
kill_router_daemons(tgen, "rt2", ["ospf6d"], save_config=False)
check_routers(exiting="rt2")
@@ -278,7 +346,10 @@ def test_gr_rt3():
pytest.skip(tgen.errors)
tgen.net["rt3"].cmd('vtysh -c "graceful-restart prepare ipv6 ospf"')
- sleep(5)
+ expect_grace_lsa(restarting="3.3.3.3", helper="rt2")
+ expect_grace_lsa(restarting="3.3.3.3", helper="rt4")
+ expect_grace_lsa(restarting="3.3.3.3", helper="rt6")
+ ensure_gr_is_in_zebra("rt3")
kill_router_daemons(tgen, "rt3", ["ospf6d"], save_config=False)
check_routers(exiting="rt3")
@@ -298,7 +369,9 @@ def test_gr_rt4():
pytest.skip(tgen.errors)
tgen.net["rt4"].cmd('vtysh -c "graceful-restart prepare ipv6 ospf"')
- sleep(5)
+ expect_grace_lsa(restarting="4.4.4.4", helper="rt3")
+ expect_grace_lsa(restarting="4.4.4.4", helper="rt5")
+ ensure_gr_is_in_zebra("rt4")
kill_router_daemons(tgen, "rt4", ["ospf6d"], save_config=False)
check_routers(exiting="rt4")
@@ -318,7 +391,8 @@ def test_gr_rt5():
pytest.skip(tgen.errors)
tgen.net["rt5"].cmd('vtysh -c "graceful-restart prepare ipv6 ospf"')
- sleep(5)
+ expect_grace_lsa(restarting="5.5.5.5", helper="rt4")
+ ensure_gr_is_in_zebra("rt5")
kill_router_daemons(tgen, "rt5", ["ospf6d"], save_config=False)
check_routers(exiting="rt5")
@@ -338,7 +412,9 @@ def test_gr_rt6():
pytest.skip(tgen.errors)
tgen.net["rt6"].cmd('vtysh -c "graceful-restart prepare ipv6 ospf"')
- sleep(5)
+ expect_grace_lsa(restarting="6.6.6.6", helper="rt3")
+ expect_grace_lsa(restarting="6.6.6.6", helper="rt7")
+ ensure_gr_is_in_zebra("rt6")
kill_router_daemons(tgen, "rt6", ["ospf6d"], save_config=False)
check_routers(exiting="rt6")
@@ -358,7 +434,8 @@ def test_gr_rt7():
pytest.skip(tgen.errors)
tgen.net["rt7"].cmd('vtysh -c "graceful-restart prepare ipv6 ospf"')
- sleep(5)
+ expect_grace_lsa(restarting="6.6.6.6", helper="rt6")
+ ensure_gr_is_in_zebra("rt7")
kill_router_daemons(tgen, "rt7", ["ospf6d"], save_config=False)
check_routers(exiting="rt7")
diff --git a/tests/topotests/ospf6_topo1/r1/ospf6d.conf b/tests/topotests/ospf6_topo1/r1/ospf6d.conf
index 9f7e058931..5f1ceee964 100644
--- a/tests/topotests/ospf6_topo1/r1/ospf6d.conf
+++ b/tests/topotests/ospf6_topo1/r1/ospf6d.conf
@@ -1,13 +1,13 @@
hostname r1
log file ospf6d.log
!
-debug ospf6 message all
-debug ospf6 lsa unknown
-debug ospf6 zebra
-debug ospf6 interface
-debug ospf6 neighbor
-debug ospf6 route table
-debug ospf6 flooding
+! debug ospf6 message all
+! debug ospf6 lsa unknown
+! debug ospf6 zebra
+! debug ospf6 interface
+! debug ospf6 neighbor
+! debug ospf6 route table
+! debug ospf6 flooding
!
interface r1-stubnet
ipv6 ospf6 network broadcast
diff --git a/tests/topotests/ospf6_topo1/r1/zebra.conf b/tests/topotests/ospf6_topo1/r1/zebra.conf
index dfbcea8d21..3a7db9f25e 100644
--- a/tests/topotests/ospf6_topo1/r1/zebra.conf
+++ b/tests/topotests/ospf6_topo1/r1/zebra.conf
@@ -2,8 +2,8 @@
hostname r1
log file zebra.log
!
-debug zebra events
-debug zebra rib
+! debug zebra events
+! debug zebra rib
!
interface r1-stubnet
ipv6 address fc00:1:1:1::1/64
diff --git a/tests/topotests/ospf6_topo1/r2/ospf6d.conf b/tests/topotests/ospf6_topo1/r2/ospf6d.conf
index 26ebc2c0ea..d51b41e1e5 100644
--- a/tests/topotests/ospf6_topo1/r2/ospf6d.conf
+++ b/tests/topotests/ospf6_topo1/r2/ospf6d.conf
@@ -1,13 +1,13 @@
hostname r2
log file ospf6d.log
!
-debug ospf6 message all
-debug ospf6 lsa unknown
-debug ospf6 zebra
-debug ospf6 interface
-debug ospf6 neighbor
-debug ospf6 route table
-debug ospf6 flooding
+! debug ospf6 message all
+! debug ospf6 lsa unknown
+! debug ospf6 zebra
+! debug ospf6 interface
+! debug ospf6 neighbor
+! debug ospf6 route table
+! debug ospf6 flooding
!
interface r2-stubnet
ipv6 ospf6 network broadcast
diff --git a/tests/topotests/ospf6_topo1/r2/zebra.conf b/tests/topotests/ospf6_topo1/r2/zebra.conf
index f05d1a60ff..5571dc979c 100644
--- a/tests/topotests/ospf6_topo1/r2/zebra.conf
+++ b/tests/topotests/ospf6_topo1/r2/zebra.conf
@@ -2,8 +2,8 @@
hostname r2
log file zebra.log
!
-debug zebra events
-debug zebra rib
+! debug zebra events
+! debug zebra rib
!
interface r2-stubnet
ipv6 address fc00:2:2:2::2/64
diff --git a/tests/topotests/ospf6_topo1/r3/ospf6d.conf b/tests/topotests/ospf6_topo1/r3/ospf6d.conf
index e902496530..cad71ac067 100644
--- a/tests/topotests/ospf6_topo1/r3/ospf6d.conf
+++ b/tests/topotests/ospf6_topo1/r3/ospf6d.conf
@@ -1,13 +1,13 @@
hostname r3
log file ospf6d.log
!
-debug ospf6 message all
-debug ospf6 lsa unknown
-debug ospf6 zebra
-debug ospf6 interface
-debug ospf6 neighbor
-debug ospf6 route table
-debug ospf6 flooding
+! debug ospf6 message all
+! debug ospf6 lsa unknown
+! debug ospf6 zebra
+! debug ospf6 interface
+! debug ospf6 neighbor
+! debug ospf6 route table
+! debug ospf6 flooding
!
interface r3-stubnet
ipv6 ospf6 network broadcast
diff --git a/tests/topotests/ospf6_topo1/r3/zebra.conf b/tests/topotests/ospf6_topo1/r3/zebra.conf
index d8051c350d..3cc5626bd7 100644
--- a/tests/topotests/ospf6_topo1/r3/zebra.conf
+++ b/tests/topotests/ospf6_topo1/r3/zebra.conf
@@ -2,8 +2,8 @@
hostname r3
log file zebra.log
!
-debug zebra events
-debug zebra rib
+! debug zebra events
+! debug zebra rib
!
interface r3-stubnet
ipv6 address fc00:3:3:3::3/64
diff --git a/tests/topotests/ospf6_topo1/r4/ospf6d.conf b/tests/topotests/ospf6_topo1/r4/ospf6d.conf
index 5607a789de..f0b166bc4b 100644
--- a/tests/topotests/ospf6_topo1/r4/ospf6d.conf
+++ b/tests/topotests/ospf6_topo1/r4/ospf6d.conf
@@ -1,13 +1,13 @@
hostname r4
log file ospf6d.log
!
-debug ospf6 message all
-debug ospf6 lsa unknown
-debug ospf6 zebra
-debug ospf6 interface
-debug ospf6 neighbor
-debug ospf6 route table
-debug ospf6 flooding
+! debug ospf6 message all
+! debug ospf6 lsa unknown
+! debug ospf6 zebra
+! debug ospf6 interface
+! debug ospf6 neighbor
+! debug ospf6 route table
+! debug ospf6 flooding
!
interface r4-stubnet
ipv6 ospf6 network broadcast
diff --git a/tests/topotests/ospf6_topo1/r4/zebra.conf b/tests/topotests/ospf6_topo1/r4/zebra.conf
index cada58bd01..20e27cea46 100644
--- a/tests/topotests/ospf6_topo1/r4/zebra.conf
+++ b/tests/topotests/ospf6_topo1/r4/zebra.conf
@@ -2,8 +2,8 @@
hostname r4
log file zebra.log
!
-debug zebra events
-debug zebra rib
+! debug zebra events
+! debug zebra rib
!
interface r4-stubnet
ipv6 address fc00:4:4:4::4/64
diff --git a/tests/topotests/ospf6_topo1_vrf/r1/ospf6d.conf b/tests/topotests/ospf6_topo1_vrf/r1/ospf6d.conf
index 83bdfb7c81..e60c5991a4 100644
--- a/tests/topotests/ospf6_topo1_vrf/r1/ospf6d.conf
+++ b/tests/topotests/ospf6_topo1_vrf/r1/ospf6d.conf
@@ -1,13 +1,13 @@
hostname r1
log file ospf6d.log
!
-debug ospf6 message all
-debug ospf6 lsa unknown
-debug ospf6 zebra
-debug ospf6 interface
-debug ospf6 neighbor
-debug ospf6 route table
-debug ospf6 flooding
+! debug ospf6 message all
+! debug ospf6 lsa unknown
+! debug ospf6 zebra
+! debug ospf6 interface
+! debug ospf6 neighbor
+! debug ospf6 route table
+! debug ospf6 flooding
!
interface r1-stubnet
ipv6 ospf6 area 0.0.0.0
diff --git a/tests/topotests/ospf6_topo1_vrf/r1/zebra.conf b/tests/topotests/ospf6_topo1_vrf/r1/zebra.conf
index abe8a9bc45..704912b52d 100644
--- a/tests/topotests/ospf6_topo1_vrf/r1/zebra.conf
+++ b/tests/topotests/ospf6_topo1_vrf/r1/zebra.conf
@@ -2,8 +2,8 @@
hostname r1
log file zebra.log
!
-debug zebra events
-debug zebra rib
+! debug zebra events
+! debug zebra rib
!
interface r1-stubnet vrf r1-cust1
ipv6 address fc00:1:1:1::1/64
diff --git a/tests/topotests/ospf6_topo1_vrf/r2/ospf6d.conf b/tests/topotests/ospf6_topo1_vrf/r2/ospf6d.conf
index 7fd01aa0cc..778c7781d8 100644
--- a/tests/topotests/ospf6_topo1_vrf/r2/ospf6d.conf
+++ b/tests/topotests/ospf6_topo1_vrf/r2/ospf6d.conf
@@ -1,13 +1,13 @@
hostname r2
log file ospf6d.log
!
-debug ospf6 message all
-debug ospf6 lsa unknown
-debug ospf6 zebra
-debug ospf6 interface
-debug ospf6 neighbor
-debug ospf6 route table
-debug ospf6 flooding
+! debug ospf6 message all
+! debug ospf6 lsa unknown
+! debug ospf6 zebra
+! debug ospf6 interface
+! debug ospf6 neighbor
+! debug ospf6 route table
+! debug ospf6 flooding
!
interface r2-stubnet
ipv6 ospf6 area 0.0.0.0
diff --git a/tests/topotests/ospf6_topo1_vrf/r2/zebra.conf b/tests/topotests/ospf6_topo1_vrf/r2/zebra.conf
index e1011bd3b6..123d8c4a35 100644
--- a/tests/topotests/ospf6_topo1_vrf/r2/zebra.conf
+++ b/tests/topotests/ospf6_topo1_vrf/r2/zebra.conf
@@ -2,8 +2,8 @@
hostname r2
log file zebra.log
!
-debug zebra events
-debug zebra rib
+! debug zebra events
+! debug zebra rib
!
interface r2-stubnet vrf r2-cust1
ipv6 address fc00:2:2:2::2/64
diff --git a/tests/topotests/ospf6_topo1_vrf/r3/ospf6d.conf b/tests/topotests/ospf6_topo1_vrf/r3/ospf6d.conf
index df5aed3a6a..61d183f1d8 100644
--- a/tests/topotests/ospf6_topo1_vrf/r3/ospf6d.conf
+++ b/tests/topotests/ospf6_topo1_vrf/r3/ospf6d.conf
@@ -1,13 +1,13 @@
hostname r3
log file ospf6d.log
!
-debug ospf6 message all
-debug ospf6 lsa unknown
-debug ospf6 zebra
-debug ospf6 interface
-debug ospf6 neighbor
-debug ospf6 route table
-debug ospf6 flooding
+! debug ospf6 message all
+! debug ospf6 lsa unknown
+! debug ospf6 zebra
+! debug ospf6 interface
+! debug ospf6 neighbor
+! debug ospf6 route table
+! debug ospf6 flooding
!
interface r3-stubnet
ipv6 ospf6 area 0.0.0.0
diff --git a/tests/topotests/ospf6_topo1_vrf/r3/zebra.conf b/tests/topotests/ospf6_topo1_vrf/r3/zebra.conf
index f489f3ac73..bd6873d2a8 100644
--- a/tests/topotests/ospf6_topo1_vrf/r3/zebra.conf
+++ b/tests/topotests/ospf6_topo1_vrf/r3/zebra.conf
@@ -2,8 +2,8 @@
hostname r3
log file zebra.log
!
-debug zebra events
-debug zebra rib
+! debug zebra events
+! debug zebra rib
!
interface r3-stubnet vrf r3-cust1
ipv6 address fc00:3:3:3::3/64
diff --git a/tests/topotests/ospf6_topo1_vrf/r4/ospf6d.conf b/tests/topotests/ospf6_topo1_vrf/r4/ospf6d.conf
index 465defb40f..12f6f52166 100644
--- a/tests/topotests/ospf6_topo1_vrf/r4/ospf6d.conf
+++ b/tests/topotests/ospf6_topo1_vrf/r4/ospf6d.conf
@@ -1,13 +1,13 @@
hostname r4
log file ospf6d.log
!
-debug ospf6 message all
-debug ospf6 lsa unknown
-debug ospf6 zebra
-debug ospf6 interface
-debug ospf6 neighbor
-debug ospf6 route table
-debug ospf6 flooding
+! debug ospf6 message all
+! debug ospf6 lsa unknown
+! debug ospf6 zebra
+! debug ospf6 interface
+! debug ospf6 neighbor
+! debug ospf6 route table
+! debug ospf6 flooding
!
interface r4-stubnet
ipv6 ospf6 area 0.0.0.1
diff --git a/tests/topotests/ospf6_topo1_vrf/r4/zebra.conf b/tests/topotests/ospf6_topo1_vrf/r4/zebra.conf
index c59116df8c..0d9d011f6d 100644
--- a/tests/topotests/ospf6_topo1_vrf/r4/zebra.conf
+++ b/tests/topotests/ospf6_topo1_vrf/r4/zebra.conf
@@ -2,8 +2,8 @@
hostname r4
log file zebra.log
!
-debug zebra events
-debug zebra rib
+! debug zebra events
+! debug zebra rib
!
interface r4-stubnet vrf r4-cust1
ipv6 address fc00:4:4:4::4/64
diff --git a/tests/topotests/ospf6_topo2/r1/ospf6d.conf b/tests/topotests/ospf6_topo2/r1/ospf6d.conf
index 2e465e6d1f..a9d46be41a 100644
--- a/tests/topotests/ospf6_topo2/r1/ospf6d.conf
+++ b/tests/topotests/ospf6_topo2/r1/ospf6d.conf
@@ -1,34 +1,37 @@
-debug ospf6 lsa router
-debug ospf6 lsa router originate
-debug ospf6 lsa router examine
-debug ospf6 lsa router flooding
-debug ospf6 lsa as-external
-debug ospf6 lsa as-external originate
-debug ospf6 lsa as-external examine
-debug ospf6 lsa as-external flooding
-debug ospf6 lsa intra-prefix
-debug ospf6 lsa intra-prefix originate
-debug ospf6 lsa intra-prefix examine
-debug ospf6 lsa intra-prefix flooding
-debug ospf6 border-routers
-debug ospf6 zebra
-debug ospf6 interface
-debug ospf6 neighbor
-debug ospf6 flooding
-debug ospf6 gr helper
-debug ospf6 spf process
-debug ospf6 route intra-area
-debug ospf6 route inter-area
-debug ospf6 abr
-debug ospf6 asbr
-debug ospf6 nssa
+! debug ospf6 lsa router
+! debug ospf6 lsa router originate
+! debug ospf6 lsa router examine
+! debug ospf6 lsa router flooding
+! debug ospf6 lsa nssa
+! debug ospf6 lsa nssa originate
+! debug ospf6 lsa nssa examine
+! debug ospf6 lsa nssa flooding
+! debug ospf6 lsa as-external
+! debug ospf6 lsa as-external originate
+! debug ospf6 lsa as-external examine
+! debug ospf6 lsa as-external flooding
+! debug ospf6 lsa intra-prefix
+! debug ospf6 lsa intra-prefix originate
+! debug ospf6 lsa intra-prefix examine
+! debug ospf6 lsa intra-prefix flooding
+! debug ospf6 border-routers
+! debug ospf6 zebra
+! debug ospf6 interface
+! debug ospf6 neighbor
+! debug ospf6 flooding
+! debug ospf6 spf process
+! debug ospf6 route intra-area
+! debug ospf6 route inter-area
+! debug ospf6 abr
+! debug ospf6 asbr
+! debug ospf6 nssa
!
interface r1-eth0
+ ipv6 ospf6 area 0.0.0.1
ipv6 ospf6 hello-interval 2
ipv6 ospf6 dead-interval 10
!
router ospf6
ospf6 router-id 10.254.254.1
area 0.0.0.1 stub
- interface r1-eth0 area 0.0.0.1
!
diff --git a/tests/topotests/ospf6_topo2/r2/ospf6d.conf b/tests/topotests/ospf6_topo2/r2/ospf6d.conf
index 4a1d10693d..8819a588f1 100644
--- a/tests/topotests/ospf6_topo2/r2/ospf6d.conf
+++ b/tests/topotests/ospf6_topo2/r2/ospf6d.conf
@@ -1,37 +1,43 @@
-debug ospf6 lsa router
-debug ospf6 lsa router originate
-debug ospf6 lsa router examine
-debug ospf6 lsa router flooding
-debug ospf6 lsa as-external
-debug ospf6 lsa as-external originate
-debug ospf6 lsa as-external examine
-debug ospf6 lsa as-external flooding
-debug ospf6 lsa intra-prefix
-debug ospf6 lsa intra-prefix originate
-debug ospf6 lsa intra-prefix examine
-debug ospf6 lsa intra-prefix flooding
-debug ospf6 border-routers
-debug ospf6 zebra
-debug ospf6 interface
-debug ospf6 neighbor
-debug ospf6 flooding
-debug ospf6 gr helper
-debug ospf6 spf process
-debug ospf6 route intra-area
-debug ospf6 route inter-area
-debug ospf6 abr
-debug ospf6 asbr
-debug ospf6 nssa
+! debug ospf6 lsa router
+! debug ospf6 lsa router originate
+! debug ospf6 lsa router examine
+! debug ospf6 lsa router flooding
+! debug ospf6 lsa nssa
+! debug ospf6 lsa nssa originate
+! debug ospf6 lsa nssa examine
+! debug ospf6 lsa nssa flooding
+! debug ospf6 lsa as-external
+! debug ospf6 lsa as-external originate
+! debug ospf6 lsa as-external examine
+! debug ospf6 lsa as-external flooding
+! debug ospf6 lsa intra-prefix
+! debug ospf6 lsa intra-prefix originate
+! debug ospf6 lsa intra-prefix examine
+! debug ospf6 lsa intra-prefix flooding
+! debug ospf6 border-routers
+! debug ospf6 zebra
+! debug ospf6 interface
+! debug ospf6 neighbor
+! debug ospf6 flooding
+! debug ospf6 spf process
+! debug ospf6 route intra-area
+! debug ospf6 route inter-area
+! debug ospf6 abr
+! debug ospf6 asbr
+! debug ospf6 nssa
!
interface r2-eth0
+ ipv6 ospf6 area 0.0.0.1
ipv6 ospf6 hello-interval 2
ipv6 ospf6 dead-interval 10
!
interface r2-eth1
+ ipv6 ospf6 area 0.0.0.0
ipv6 ospf6 hello-interval 2
ipv6 ospf6 dead-interval 10
!
interface r2-eth2
+ ipv6 ospf6 area 0.0.0.2
ipv6 ospf6 hello-interval 2
ipv6 ospf6 dead-interval 10
!
@@ -42,7 +48,4 @@ router ospf6
default-information originate always metric 123
area 0.0.0.1 stub
area 0.0.0.2 nssa
- interface r2-eth0 area 0.0.0.1
- interface r2-eth1 area 0.0.0.0
- interface r2-eth2 area 0.0.0.2
!
diff --git a/tests/topotests/ospf6_topo2/r3/ospf6d.conf b/tests/topotests/ospf6_topo2/r3/ospf6d.conf
index 5faeb70e56..6e4f56ba7a 100644
--- a/tests/topotests/ospf6_topo2/r3/ospf6d.conf
+++ b/tests/topotests/ospf6_topo2/r3/ospf6d.conf
@@ -1,29 +1,33 @@
-debug ospf6 lsa router
-debug ospf6 lsa router originate
-debug ospf6 lsa router examine
-debug ospf6 lsa router flooding
-debug ospf6 lsa as-external
-debug ospf6 lsa as-external originate
-debug ospf6 lsa as-external examine
-debug ospf6 lsa as-external flooding
-debug ospf6 lsa intra-prefix
-debug ospf6 lsa intra-prefix originate
-debug ospf6 lsa intra-prefix examine
-debug ospf6 lsa intra-prefix flooding
-debug ospf6 border-routers
-debug ospf6 zebra
-debug ospf6 interface
-debug ospf6 neighbor
-debug ospf6 flooding
-debug ospf6 gr helper
-debug ospf6 spf process
-debug ospf6 route intra-area
-debug ospf6 route inter-area
-debug ospf6 abr
-debug ospf6 asbr
-debug ospf6 nssa
+! debug ospf6 lsa router
+! debug ospf6 lsa router originate
+! debug ospf6 lsa router examine
+! debug ospf6 lsa router flooding
+! debug ospf6 lsa nssa
+! debug ospf6 lsa nssa originate
+! debug ospf6 lsa nssa examine
+! debug ospf6 lsa nssa flooding
+! debug ospf6 lsa as-external
+! debug ospf6 lsa as-external originate
+! debug ospf6 lsa as-external examine
+! debug ospf6 lsa as-external flooding
+! debug ospf6 lsa intra-prefix
+! debug ospf6 lsa intra-prefix originate
+! debug ospf6 lsa intra-prefix examine
+! debug ospf6 lsa intra-prefix flooding
+! debug ospf6 border-routers
+! debug ospf6 zebra
+! debug ospf6 interface
+! debug ospf6 neighbor
+! debug ospf6 flooding
+! debug ospf6 spf process
+! debug ospf6 route intra-area
+! debug ospf6 route inter-area
+! debug ospf6 abr
+! debug ospf6 asbr
+! debug ospf6 nssa
!
interface r3-eth0
+ ipv6 ospf6 area 0.0.0.0
ipv6 ospf6 hello-interval 2
ipv6 ospf6 dead-interval 10
!
@@ -31,5 +35,4 @@ router ospf6
ospf6 router-id 10.254.254.3
redistribute connected
redistribute static
- interface r3-eth0 area 0.0.0.0
!
diff --git a/tests/topotests/ospf6_topo2/r4/ospf6d.conf b/tests/topotests/ospf6_topo2/r4/ospf6d.conf
index 04d763f6a8..59a2fd5cc9 100644
--- a/tests/topotests/ospf6_topo2/r4/ospf6d.conf
+++ b/tests/topotests/ospf6_topo2/r4/ospf6d.conf
@@ -1,34 +1,37 @@
-debug ospf6 lsa router
-debug ospf6 lsa router originate
-debug ospf6 lsa router examine
-debug ospf6 lsa router flooding
-debug ospf6 lsa as-external
-debug ospf6 lsa as-external originate
-debug ospf6 lsa as-external examine
-debug ospf6 lsa as-external flooding
-debug ospf6 lsa intra-prefix
-debug ospf6 lsa intra-prefix originate
-debug ospf6 lsa intra-prefix examine
-debug ospf6 lsa intra-prefix flooding
-debug ospf6 border-routers
-debug ospf6 zebra
-debug ospf6 interface
-debug ospf6 neighbor
-debug ospf6 flooding
-debug ospf6 gr helper
-debug ospf6 spf process
-debug ospf6 route intra-area
-debug ospf6 route inter-area
-debug ospf6 abr
-debug ospf6 asbr
-debug ospf6 nssa
+! debug ospf6 lsa router
+! debug ospf6 lsa router originate
+! debug ospf6 lsa router examine
+! debug ospf6 lsa router flooding
+! debug ospf6 lsa nssa
+! debug ospf6 lsa nssa originate
+! debug ospf6 lsa nssa examine
+! debug ospf6 lsa nssa flooding
+! debug ospf6 lsa as-external
+! debug ospf6 lsa as-external originate
+! debug ospf6 lsa as-external examine
+! debug ospf6 lsa as-external flooding
+! debug ospf6 lsa intra-prefix
+! debug ospf6 lsa intra-prefix originate
+! debug ospf6 lsa intra-prefix examine
+! debug ospf6 lsa intra-prefix flooding
+! debug ospf6 border-routers
+! debug ospf6 zebra
+! debug ospf6 interface
+! debug ospf6 neighbor
+! debug ospf6 flooding
+! debug ospf6 spf process
+! debug ospf6 route intra-area
+! debug ospf6 route inter-area
+! debug ospf6 abr
+! debug ospf6 asbr
+! debug ospf6 nssa
!
interface r4-eth0
+ ipv6 ospf6 area 0.0.0.2
ipv6 ospf6 hello-interval 2
ipv6 ospf6 dead-interval 10
!
router ospf6
ospf6 router-id 10.254.254.4
area 0.0.0.2 nssa
- interface r4-eth0 area 0.0.0.2
!
diff --git a/tests/topotests/ospf6_topo2/test_ospf6_topo2.py b/tests/topotests/ospf6_topo2/test_ospf6_topo2.py
index 303bcd014d..eb8561c404 100644
--- a/tests/topotests/ospf6_topo2/test_ospf6_topo2.py
+++ b/tests/topotests/ospf6_topo2/test_ospf6_topo2.py
@@ -131,6 +131,8 @@ def build_topo(tgen):
switch.add_link(tgen.gears["r2"])
switch.add_link(tgen.gears["r4"])
+ switch = tgen.add_switch("s4")
+ switch.add_link(tgen.gears["r4"], nodeif="r4-stubnet")
def setup_module(mod):
"Sets up the pytest environment"
@@ -484,7 +486,7 @@ def test_area_filters():
pytest.skip(tgen.errors)
#
- # Configure import/export filters on r2 (ABR for area 1).
+ # Configure import/export filters on r2 (ABR for area 2).
#
config = """
configure terminal
@@ -544,6 +546,102 @@ def test_area_filters():
expect_ospfv3_routes("r1", routes, wait=30, type="inter-area")
+def test_nssa_range():
+ """
+ Test NSSA ABR ranges.
+ """
+ tgen = get_topogen()
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ # Configure new addresses on r4 and enable redistribution of connected
+ # routes.
+ config = """
+ configure terminal
+ interface r4-stubnet
+ ipv6 address 2001:db8:1000::1/128
+ ipv6 address 2001:db8:1000::2/128
+ router ospf6
+ redistribute connected
+ """
+ tgen.gears["r4"].vtysh_cmd(config)
+ logger.info("Expecting NSSA-translated external routes to be added on r3")
+ routes = {"2001:db8:1000::1/128": {}, "2001:db8:1000::2/128": {}}
+ expect_ospfv3_routes("r3", routes, wait=30, type="external-2")
+
+ # Configure an NSSA range on r2 (ABR for area 2).
+ config = """
+ configure terminal
+ router ospf6
+ area 2 nssa range 2001:db8:1000::/64
+ """
+ tgen.gears["r2"].vtysh_cmd(config)
+ logger.info("Expecting summarized routes to be removed from r3")
+ for route in ["2001:db8:1000::1/128", "2001:db8:1000::2/128"]:
+ test_func = partial(dont_expect_route, "r3", route, type="external-2")
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
+ assertmsg = "{}'s {} summarized route still exists".format("r3", route)
+ assert result is None, assertmsg
+ logger.info("Expecting NSSA range to be added on r3")
+ routes = {
+ "2001:db8:1000::/64": {
+ "metricType":2,
+ "metricCost":20,
+ "metricCostE2":10,
+ }}
+ expect_ospfv3_routes("r3", routes, wait=30, type="external-2", detail=True)
+
+ # Change the NSSA range cost.
+ config = """
+ configure terminal
+ router ospf6
+ area 2 nssa range 2001:db8:1000::/64 cost 1000
+ """
+ tgen.gears["r2"].vtysh_cmd(config)
+ logger.info("Expecting NSSA range to be updated with new cost")
+ routes = {
+ "2001:db8:1000::/64": {
+ "metricType":2,
+ "metricCost":20,
+ "metricCostE2":1000,
+ }}
+ expect_ospfv3_routes("r3", routes, wait=30, type="external-2", detail=True)
+
+ # Configure the NSSA range to not be advertised.
+ config = """
+ configure terminal
+ router ospf6
+ area 2 nssa range 2001:db8:1000::/64 not-advertise
+ """
+ tgen.gears["r2"].vtysh_cmd(config)
+ logger.info("Expecting NSSA summary route to be removed")
+ route = "2001:db8:1000::/64"
+ test_func = partial(dont_expect_route, "r3", route, type="external-2")
+ _, result = topotest.run_and_expect(test_func, None, count=30, wait=1)
+ assertmsg = "{}'s {} NSSA summary route still exists".format("r3", route)
+ assert result is None, assertmsg
+
+ # Remove the NSSA range.
+ config = """
+ configure terminal
+ router ospf6
+ no area 2 nssa range 2001:db8:1000::/64
+ """
+ tgen.gears["r2"].vtysh_cmd(config)
+ logger.info("Expecting previously summarized routes to be re-added")
+ routes = {
+ "2001:db8:1000::1/128": {
+ "metricType":2,
+ "metricCost":20,
+ },
+ "2001:db8:1000::2/128": {
+ "metricType":2,
+ "metricCost":20,
+ },
+ }
+ expect_ospfv3_routes("r3", routes, wait=30, type="external-2", detail=True)
+
+
def teardown_module(_mod):
"Teardown the pytest environment"
tgen = get_topogen()
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_topo1.py b/tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_topo1.py
index 64dfa0c69d..f9fa55e275 100644
--- a/tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_topo1.py
+++ b/tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_topo1.py
@@ -669,89 +669,6 @@ def test_ospf_type5_summary_tc48_p0(request):
result is True
), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
- step("Configure metric type as 1 in route map.")
-
- routemaps = {
- "r0": {
- "route_maps": {
- "rmap_ipv4": [{"action": "permit", "set": {"metric-type": "type-1"}}]
- }
- }
- }
- result = create_route_maps(tgen, routemaps)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
-
- step(
- "Verify that external routes(static / connected) are summarised"
- " to configured summary address with metric type 2."
- )
- input_dict = {
- SUMMARY["ipv4"][0]: {
- "Summary address": SUMMARY["ipv4"][0],
- "Metric-type": "E2",
- "Metric": 20,
- "Tag": 0,
- "External route count": 5,
- }
- }
- dut = "r0"
- result = verify_ospf_summary(tgen, topo, dut, input_dict)
- assert (
- result is True
- ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
-
- step("Un configure metric type from route map.")
-
- routemaps = {
- "r0": {
- "route_maps": {
- "rmap_ipv4": [
- {
- "action": "permit",
- "set": {"metric-type": "type-1"},
- "delete": True,
- }
- ]
- }
- }
- }
- result = create_route_maps(tgen, routemaps)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
-
- step(
- "Verify that external routes(static / connected) are summarised"
- " to configured summary address with metric type 2."
- )
- input_dict = {
- SUMMARY["ipv4"][0]: {
- "Summary address": SUMMARY["ipv4"][0],
- "Metric-type": "E2",
- "Metric": 20,
- "Tag": 0,
- "External route count": 5,
- }
- }
- dut = "r0"
- result = verify_ospf_summary(tgen, topo, dut, input_dict)
- assert (
- result is True
- ), "Testcase {} : Failed" "Error: Summary missing in OSPF DB".format(tc_name)
-
- step("Change rule from permit to deny in prefix list.")
- pfx_list = {
- "r0": {
- "prefix_lists": {
- "ipv4": {
- "pf_list_1_ipv4": [
- {"seqid": 10, "network": "any", "action": "deny"}
- ]
- }
- }
- }
- }
- result = create_prefix_lists(tgen, pfx_list)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
-
write_test_footer(tc_name)
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_lan.py b/tests/topotests/ospf_basic_functionality/test_ospf_lan.py
index b80da41bec..b32483f7ad 100644
--- a/tests/topotests/ospf_basic_functionality/test_ospf_lan.py
+++ b/tests/topotests/ospf_basic_functionality/test_ospf_lan.py
@@ -408,11 +408,12 @@ def test_ospf_lan_tc1_p0(request):
topo_modify_change_ip = deepcopy(topo)
intf_ip = topo_modify_change_ip["routers"]["r0"]["links"]["s1"]["ipv4"]
topo_modify_change_ip["routers"]["r0"]["links"]["s1"]["ipv4"] = str(
- IPv4Address(frr_unicode(intf_ip.split("/")[0])) + 3
+ IPv4Address(frr_unicode(intf_ip.split("/")[0])) + 4
) + "/{}".format(intf_ip.split("/")[1])
build_config_from_json(tgen, topo_modify_change_ip, save_bkup=False)
+ clear_ospf(tgen, "r0")
step(
"Verify that OSPF is in FULL state with other routers with "
"newly configured IP."
diff --git a/tests/topotests/ospf_dual_stack/test_ospf_dual_stack.json b/tests/topotests/ospf_dual_stack/test_ospf_dual_stack.json
index c8a3ce783b..cdb8813b3d 100644
--- a/tests/topotests/ospf_dual_stack/test_ospf_dual_stack.json
+++ b/tests/topotests/ospf_dual_stack/test_ospf_dual_stack.json
@@ -23,7 +23,8 @@
},
"ospf6": {
"hello_interval": 1,
- "dead_interval": 4
+ "dead_interval": 4,
+ "area": "1.1.1.1"
}
}
},
@@ -36,9 +37,7 @@
"ospf6": {
"router_id": "1.1.1.1",
"neighbors": {
- "r3": {
- "area": "1.1.1.1"
- }
+ "r3": {}
}
}
},
@@ -56,7 +55,8 @@
"ospf6": {
"hello_interval": 1,
"dead_interval": 4,
- "network": "point-to-point"
+ "network": "point-to-point",
+ "area": "1.1.1.1"
}
},
"r4": {
@@ -71,7 +71,8 @@
"ospf6": {
"hello_interval": 1,
"dead_interval": 4,
- "network": "point-to-point"
+ "network": "point-to-point",
+ "area": "0.0.0.0"
}
}
},
@@ -85,8 +86,8 @@
"ospf6": {
"router_id": "2.2.2.2",
"neighbors": {
- "r3": { "area": "1.1.1.1" },
- "r4": { "area": "0.0.0.0" }
+ "r3": {},
+ "r4": {}
}
}
},
@@ -104,7 +105,8 @@
"ospf6": {
"hello_interval": 1,
"dead_interval": 4,
- "network": "point-to-point"
+ "network": "point-to-point",
+ "area": "1.1.1.1"
}
},
"r2": {
@@ -119,7 +121,8 @@
"ospf6": {
"hello_interval": 1,
"dead_interval": 4,
- "network": "point-to-point"
+ "network": "point-to-point",
+ "area": "1.1.1.1"
}
},
"r4": {
@@ -134,7 +137,8 @@
"ospf6": {
"hello_interval": 1,
"dead_interval": 4,
- "network": "point-to-point"
+ "network": "point-to-point",
+ "area": "0.0.0.0"
}
}
},
@@ -149,9 +153,9 @@
"ospf6": {
"router_id": "3.3.3.3",
"neighbors": {
- "r1": { "area": "1.1.1.1" },
- "r2": { "area": "1.1.1.1" },
- "r4": { "area": "0.0.0.0" }
+ "r1": {},
+ "r2": {},
+ "r4": {}
}
}
},
@@ -169,7 +173,8 @@
"ospf6": {
"hello_interval": 1,
"dead_interval": 4,
- "network": "point-to-point"
+ "network": "point-to-point",
+ "area": "0.0.0.0"
}
},
"r3": {
@@ -184,7 +189,8 @@
"ospf6": {
"hello_interval": 1,
"dead_interval": 4,
- "network": "point-to-point"
+ "network": "point-to-point",
+ "area": "0.0.0.0"
}
},
"r5": {
@@ -199,7 +205,8 @@
"ospf6": {
"hello_interval": 1,
"dead_interval": 4,
- "network": "point-to-point"
+ "network": "point-to-point",
+ "area": "2.2.2.2"
}
}
},
@@ -214,9 +221,9 @@
"ospf6": {
"router_id": "4.4.4.4",
"neighbors": {
- "r2": { "area": "0.0.0.0" },
- "r3": { "area": "0.0.0.0" },
- "r5": { "area": "2.2.2.2" }
+ "r2": {},
+ "r3": {},
+ "r5": {}
}
}
},
@@ -234,7 +241,8 @@
"ospf6": {
"hello_interval": 1,
"dead_interval": 4,
- "network": "point-to-point"
+ "network": "point-to-point",
+ "area": "2.2.2.2"
}
}
},
@@ -247,7 +255,7 @@
"ospf6": {
"router_id": "5.5.5.5",
"neighbors": {
- "r4": { "area": "2.2.2.2" }
+ "r4": {}
}
}
}
diff --git a/tests/topotests/ospf_gr_topo1/rt1/ospfd.conf b/tests/topotests/ospf_gr_topo1/rt1/ospfd.conf
index 9590a7cadf..27042e1a85 100644
--- a/tests/topotests/ospf_gr_topo1/rt1/ospfd.conf
+++ b/tests/topotests/ospf_gr_topo1/rt1/ospfd.conf
@@ -3,16 +3,16 @@ hostname rt1
log file ospfd.log
log commands
!
-debug ospf zebra
-debug ospf event
-debug ospf lsa
-debug ospf te
-debug ospf packet all
-debug ospf packet ls-update detail
-debug ospf ism
-debug ospf nsm
-debug ospf nssa
-debug ospf graceful-restart
+! debug ospf zebra
+! debug ospf event
+! debug ospf lsa
+! debug ospf te
+! debug ospf packet all
+! debug ospf packet ls-update detail
+! debug ospf ism
+! debug ospf nsm
+! debug ospf nssa
+! debug ospf graceful-restart
!
interface lo
ip ospf area 1
diff --git a/tests/topotests/ospf_gr_topo1/rt1/show_ip_ospf_neighbor.json b/tests/topotests/ospf_gr_topo1/rt1/show_ip_ospf_neighbor.json
index ed290323a4..f82758101c 100644
--- a/tests/topotests/ospf_gr_topo1/rt1/show_ip_ospf_neighbor.json
+++ b/tests/topotests/ospf_gr_topo1/rt1/show_ip_ospf_neighbor.json
@@ -2,7 +2,7 @@
"neighbors":{
"2.2.2.2":[
{
- "state":"Full\/DROther",
+ "converged":"Full",
"address":"10.0.1.2",
"ifaceName":"eth-rt2:10.0.1.1"
}
diff --git a/tests/topotests/ospf_gr_topo1/rt1/zebra.conf b/tests/topotests/ospf_gr_topo1/rt1/zebra.conf
index 183cd3df48..7b99b58548 100644
--- a/tests/topotests/ospf_gr_topo1/rt1/zebra.conf
+++ b/tests/topotests/ospf_gr_topo1/rt1/zebra.conf
@@ -3,10 +3,10 @@ hostname rt1
log file zebra.log
log commands
!
-debug zebra event
-debug zebra packet
-debug zebra rib
-debug zebra kernel
+! debug zebra event
+! debug zebra packet
+! debug zebra rib
+! debug zebra kernel
!
interface lo
ip address 1.1.1.1/32
diff --git a/tests/topotests/ospf_gr_topo1/rt2/ospfd.conf b/tests/topotests/ospf_gr_topo1/rt2/ospfd.conf
index 4f60d37b18..591b242da7 100644
--- a/tests/topotests/ospf_gr_topo1/rt2/ospfd.conf
+++ b/tests/topotests/ospf_gr_topo1/rt2/ospfd.conf
@@ -3,16 +3,16 @@ hostname rt2
log file ospfd.log
log commands
!
-debug ospf zebra
-debug ospf event
-debug ospf lsa
-debug ospf te
-debug ospf packet all
-debug ospf packet ls-update detail
-debug ospf ism
-debug ospf nsm
-debug ospf nssa
-debug ospf graceful-restart
+! debug ospf zebra
+! debug ospf event
+! debug ospf lsa
+! debug ospf te
+! debug ospf packet all
+! debug ospf packet ls-update detail
+! debug ospf ism
+! debug ospf nsm
+! debug ospf nssa
+! debug ospf graceful-restart
!
interface lo
ip ospf area 0
diff --git a/tests/topotests/ospf_gr_topo1/rt2/show_ip_ospf_neighbor.json b/tests/topotests/ospf_gr_topo1/rt2/show_ip_ospf_neighbor.json
index 4fe92b0b98..5a0b092702 100644
--- a/tests/topotests/ospf_gr_topo1/rt2/show_ip_ospf_neighbor.json
+++ b/tests/topotests/ospf_gr_topo1/rt2/show_ip_ospf_neighbor.json
@@ -2,14 +2,14 @@
"neighbors":{
"1.1.1.1":[
{
- "state":"Full\/DROther",
+ "converged":"Full",
"address":"10.0.1.1",
"ifaceName":"eth-rt1:10.0.1.2"
}
],
"3.3.3.3":[
{
- "state":"Full\/DROther",
+ "converged":"Full",
"address":"10.0.2.3",
"ifaceName":"eth-rt3:10.0.2.2"
}
diff --git a/tests/topotests/ospf_gr_topo1/rt2/zebra.conf b/tests/topotests/ospf_gr_topo1/rt2/zebra.conf
index 8bde98ad44..73571aadbf 100644
--- a/tests/topotests/ospf_gr_topo1/rt2/zebra.conf
+++ b/tests/topotests/ospf_gr_topo1/rt2/zebra.conf
@@ -3,10 +3,10 @@ hostname rt2
log file zebra.log
log commands
!
-debug zebra event
-debug zebra packet
-debug zebra rib
-debug zebra kernel
+! debug zebra event
+! debug zebra packet
+! debug zebra rib
+! debug zebra kernel
!
interface lo
ip address 2.2.2.2/32
diff --git a/tests/topotests/ospf_gr_topo1/rt3/ospfd.conf b/tests/topotests/ospf_gr_topo1/rt3/ospfd.conf
index 870878287d..5e7477120a 100644
--- a/tests/topotests/ospf_gr_topo1/rt3/ospfd.conf
+++ b/tests/topotests/ospf_gr_topo1/rt3/ospfd.conf
@@ -3,16 +3,16 @@ hostname rt3
log file ospfd.log
log commands
!
-debug ospf zebra
-debug ospf event
-debug ospf lsa
-debug ospf te
-debug ospf packet all
-debug ospf packet ls-update detail
-debug ospf ism
-debug ospf nsm
-debug ospf nssa
-debug ospf graceful-restart
+! debug ospf zebra
+! debug ospf event
+! debug ospf lsa
+! debug ospf te
+! debug ospf packet all
+! debug ospf packet ls-update detail
+! debug ospf ism
+! debug ospf nsm
+! debug ospf nssa
+! debug ospf graceful-restart
!
interface lo
ip ospf area 0
diff --git a/tests/topotests/ospf_gr_topo1/rt3/show_ip_ospf_neighbor.json b/tests/topotests/ospf_gr_topo1/rt3/show_ip_ospf_neighbor.json
index e3c36ab9a3..ab5e78414d 100644
--- a/tests/topotests/ospf_gr_topo1/rt3/show_ip_ospf_neighbor.json
+++ b/tests/topotests/ospf_gr_topo1/rt3/show_ip_ospf_neighbor.json
@@ -2,21 +2,21 @@
"neighbors":{
"2.2.2.2":[
{
- "state":"Full\/DROther",
+ "converged":"Full",
"address":"10.0.2.2",
"ifaceName":"eth-rt2:10.0.2.3"
}
],
"4.4.4.4":[
{
- "state":"Full\/DROther",
+ "converged":"Full",
"address":"10.0.3.4",
"ifaceName":"eth-rt4:10.0.3.3"
}
],
"6.6.6.6":[
{
- "state":"Full\/DROther",
+ "converged":"Full",
"address":"10.0.4.6",
"ifaceName":"eth-rt6:10.0.4.3"
}
diff --git a/tests/topotests/ospf_gr_topo1/rt3/zebra.conf b/tests/topotests/ospf_gr_topo1/rt3/zebra.conf
index dfd89cbe5b..c09bafef2e 100644
--- a/tests/topotests/ospf_gr_topo1/rt3/zebra.conf
+++ b/tests/topotests/ospf_gr_topo1/rt3/zebra.conf
@@ -3,10 +3,10 @@ hostname rt3
log file zebra.log
log commands
!
-debug zebra event
-debug zebra packet
-debug zebra rib
-debug zebra kernel
+! debug zebra event
+! debug zebra packet
+! debug zebra rib
+! debug zebra kernel
!
interface lo
ip address 3.3.3.3/32
diff --git a/tests/topotests/ospf_gr_topo1/rt4/ospfd.conf b/tests/topotests/ospf_gr_topo1/rt4/ospfd.conf
index 0aff1faf2c..7aa722cb8a 100644
--- a/tests/topotests/ospf_gr_topo1/rt4/ospfd.conf
+++ b/tests/topotests/ospf_gr_topo1/rt4/ospfd.conf
@@ -3,16 +3,16 @@ hostname rt4
log file ospfd.log
log commands
!
-debug ospf zebra
-debug ospf event
-debug ospf lsa
-debug ospf te
-debug ospf packet all
-debug ospf packet ls-update detail
-debug ospf ism
-debug ospf nsm
-debug ospf nssa
-debug ospf graceful-restart
+! debug ospf zebra
+! debug ospf event
+! debug ospf lsa
+! debug ospf te
+! debug ospf packet all
+! debug ospf packet ls-update detail
+! debug ospf ism
+! debug ospf nsm
+! debug ospf nssa
+! debug ospf graceful-restart
!
interface lo
ip ospf area 0
diff --git a/tests/topotests/ospf_gr_topo1/rt4/show_ip_ospf_neighbor.json b/tests/topotests/ospf_gr_topo1/rt4/show_ip_ospf_neighbor.json
index 2123ecb8da..405679c10e 100644
--- a/tests/topotests/ospf_gr_topo1/rt4/show_ip_ospf_neighbor.json
+++ b/tests/topotests/ospf_gr_topo1/rt4/show_ip_ospf_neighbor.json
@@ -2,14 +2,14 @@
"neighbors":{
"3.3.3.3":[
{
- "state":"Full\/DROther",
+ "converged":"Full",
"address":"10.0.3.3",
"ifaceName":"eth-rt3:10.0.3.4"
}
],
"5.5.5.5":[
{
- "state":"Full\/DROther",
+ "converged":"Full",
"address":"10.0.5.5",
"ifaceName":"eth-rt5:10.0.5.4"
}
diff --git a/tests/topotests/ospf_gr_topo1/rt4/zebra.conf b/tests/topotests/ospf_gr_topo1/rt4/zebra.conf
index f399b29f3f..e21b23e4d3 100644
--- a/tests/topotests/ospf_gr_topo1/rt4/zebra.conf
+++ b/tests/topotests/ospf_gr_topo1/rt4/zebra.conf
@@ -3,10 +3,10 @@ hostname rt4
log file zebra.log
log commands
!
-debug zebra event
-debug zebra packet
-debug zebra rib
-debug zebra kernel
+! debug zebra event
+! debug zebra packet
+! debug zebra rib
+! debug zebra kernel
!
interface lo
ip address 4.4.4.4/32
diff --git a/tests/topotests/ospf_gr_topo1/rt5/ospfd.conf b/tests/topotests/ospf_gr_topo1/rt5/ospfd.conf
index 4af89389a5..0e25f1a138 100644
--- a/tests/topotests/ospf_gr_topo1/rt5/ospfd.conf
+++ b/tests/topotests/ospf_gr_topo1/rt5/ospfd.conf
@@ -3,16 +3,16 @@ hostname rt5
log file ospfd.log
log commands
!
-debug ospf zebra
-debug ospf event
-debug ospf lsa
-debug ospf te
-debug ospf packet all
-debug ospf packet ls-update detail
-debug ospf ism
-debug ospf nsm
-debug ospf nssa
-debug ospf graceful-restart
+! debug ospf zebra
+! debug ospf event
+! debug ospf lsa
+! debug ospf te
+! debug ospf packet all
+! debug ospf packet ls-update detail
+! debug ospf ism
+! debug ospf nsm
+! debug ospf nssa
+! debug ospf graceful-restart
!
interface lo
ip ospf area 2
diff --git a/tests/topotests/ospf_gr_topo1/rt5/show_ip_ospf_neighbor.json b/tests/topotests/ospf_gr_topo1/rt5/show_ip_ospf_neighbor.json
index 6440b67698..893d454368 100644
--- a/tests/topotests/ospf_gr_topo1/rt5/show_ip_ospf_neighbor.json
+++ b/tests/topotests/ospf_gr_topo1/rt5/show_ip_ospf_neighbor.json
@@ -2,7 +2,7 @@
"neighbors":{
"4.4.4.4":[
{
- "state":"Full\/DROther",
+ "converged":"Full",
"address":"10.0.5.4",
"ifaceName":"eth-rt4:10.0.5.5"
}
diff --git a/tests/topotests/ospf_gr_topo1/rt5/zebra.conf b/tests/topotests/ospf_gr_topo1/rt5/zebra.conf
index 49a1c05a6d..83f12c6635 100644
--- a/tests/topotests/ospf_gr_topo1/rt5/zebra.conf
+++ b/tests/topotests/ospf_gr_topo1/rt5/zebra.conf
@@ -3,10 +3,10 @@ hostname rt5
log file zebra.log
log commands
!
-debug zebra event
-debug zebra packet
-debug zebra rib
-debug zebra kernel
+! debug zebra event
+! debug zebra packet
+! debug zebra rib
+! debug zebra kernel
!
interface lo
ip address 5.5.5.5/32
diff --git a/tests/topotests/ospf_gr_topo1/rt6/ospfd.conf b/tests/topotests/ospf_gr_topo1/rt6/ospfd.conf
index 2295a75fe7..3960e6b40c 100644
--- a/tests/topotests/ospf_gr_topo1/rt6/ospfd.conf
+++ b/tests/topotests/ospf_gr_topo1/rt6/ospfd.conf
@@ -3,16 +3,16 @@ hostname rt6
log file ospfd.log
log commands
!
-debug ospf zebra
-debug ospf event
-debug ospf lsa
-debug ospf te
-debug ospf packet all
-debug ospf packet ls-update detail
-debug ospf ism
-debug ospf nsm
-debug ospf nssa
-debug ospf graceful-restart
+! debug ospf zebra
+! debug ospf event
+! debug ospf lsa
+! debug ospf te
+! debug ospf packet all
+! debug ospf packet ls-update detail
+! debug ospf ism
+! debug ospf nsm
+! debug ospf nssa
+! debug ospf graceful-restart
!
interface lo
ip ospf area 0
diff --git a/tests/topotests/ospf_gr_topo1/rt6/show_ip_ospf_neighbor.json b/tests/topotests/ospf_gr_topo1/rt6/show_ip_ospf_neighbor.json
index d815c23927..564a513ac6 100644
--- a/tests/topotests/ospf_gr_topo1/rt6/show_ip_ospf_neighbor.json
+++ b/tests/topotests/ospf_gr_topo1/rt6/show_ip_ospf_neighbor.json
@@ -2,14 +2,14 @@
"neighbors":{
"3.3.3.3":[
{
- "state":"Full\/DROther",
+ "converged":"Full",
"address":"10.0.4.3",
"ifaceName":"eth-rt3:10.0.4.6"
}
],
"7.7.7.7":[
{
- "state":"Full\/DROther",
+ "converged":"Full",
"address":"10.0.6.7",
"ifaceName":"eth-rt7:10.0.6.6"
}
diff --git a/tests/topotests/ospf_gr_topo1/rt6/zebra.conf b/tests/topotests/ospf_gr_topo1/rt6/zebra.conf
index d6a8f52b3a..67ebf14575 100644
--- a/tests/topotests/ospf_gr_topo1/rt6/zebra.conf
+++ b/tests/topotests/ospf_gr_topo1/rt6/zebra.conf
@@ -3,10 +3,10 @@ hostname rt6
log file zebra.log
log commands
!
-debug zebra event
-debug zebra packet
-debug zebra rib
-debug zebra kernel
+! debug zebra event
+! debug zebra packet
+! debug zebra rib
+! debug zebra kernel
!
interface lo
ip address 6.6.6.6/32
diff --git a/tests/topotests/ospf_gr_topo1/rt7/ospfd.conf b/tests/topotests/ospf_gr_topo1/rt7/ospfd.conf
index 8534eda5a7..e52424e1db 100644
--- a/tests/topotests/ospf_gr_topo1/rt7/ospfd.conf
+++ b/tests/topotests/ospf_gr_topo1/rt7/ospfd.conf
@@ -3,16 +3,16 @@ hostname rt7
log file ospfd.log
log commands
!
-debug ospf zebra
-debug ospf event
-debug ospf lsa
-debug ospf te
-debug ospf packet all
-debug ospf packet ls-update detail
-debug ospf ism
-debug ospf nsm
-debug ospf nssa
-debug ospf graceful-restart
+! debug ospf zebra
+! debug ospf event
+! debug ospf lsa
+! debug ospf te
+! debug ospf packet all
+! debug ospf packet ls-update detail
+! debug ospf ism
+! debug ospf nsm
+! debug ospf nssa
+! debug ospf graceful-restart
!
interface lo
ip ospf area 3
diff --git a/tests/topotests/ospf_gr_topo1/rt7/show_ip_ospf_neighbor.json b/tests/topotests/ospf_gr_topo1/rt7/show_ip_ospf_neighbor.json
index 2254aea9a6..bc6b60697c 100644
--- a/tests/topotests/ospf_gr_topo1/rt7/show_ip_ospf_neighbor.json
+++ b/tests/topotests/ospf_gr_topo1/rt7/show_ip_ospf_neighbor.json
@@ -2,7 +2,7 @@
"neighbors":{
"6.6.6.6":[
{
- "state":"Full\/DROther",
+ "converged":"Full",
"address":"10.0.6.6",
"ifaceName":"eth-rt6:10.0.6.7"
}
diff --git a/tests/topotests/ospf_gr_topo1/rt7/zebra.conf b/tests/topotests/ospf_gr_topo1/rt7/zebra.conf
index c481e4532b..7037e6fc5f 100644
--- a/tests/topotests/ospf_gr_topo1/rt7/zebra.conf
+++ b/tests/topotests/ospf_gr_topo1/rt7/zebra.conf
@@ -3,10 +3,10 @@ hostname rt7
log file zebra.log
log commands
!
-debug zebra event
-debug zebra packet
-debug zebra rib
-debug zebra kernel
+! debug zebra event
+! debug zebra packet
+! debug zebra rib
+! debug zebra kernel
!
interface lo
ip address 7.7.7.7/32
diff --git a/tests/topotests/ospf_gr_topo1/test_ospf_gr_topo1.py b/tests/topotests/ospf_gr_topo1/test_ospf_gr_topo1.py
index 7d9cc68412..debf7ad766 100755
--- a/tests/topotests/ospf_gr_topo1/test_ospf_gr_topo1.py
+++ b/tests/topotests/ospf_gr_topo1/test_ospf_gr_topo1.py
@@ -180,14 +180,60 @@ def router_compare_json_output(rname, command, reference, tries):
assert diff is None, assertmsg
+def expect_grace_lsa(restarting, area, helper):
+ """
+ Check if the given helper neighbor has already received a Grace-LSA from
+ the router performing a graceful restart.
+ """
+ tgen = get_topogen()
+
+ logger.info(
+ "'{}': checking if a Grace-LSA was received from '{}'".format(
+ helper, restarting
+ )
+ )
+ test_func = partial(
+ topotest.router_json_cmp,
+ tgen.gears[helper],
+ "show ip ospf database opaque-link json",
+ {
+ "linkLocalOpaqueLsa": {
+ "areas": {
+ area: [
+ {
+ "advertisingRouter": restarting,
+ "opaqueType": "Grace-LSA",
+ }
+ ]
+ }
+ }
+ },
+ )
+ _, result = topotest.run_and_expect(test_func, None, count=60, wait=1)
+ assertmsg = '"{}" didn\'t receive a Grace-LSA from "{}"'.format(helper, restarting)
+
+ assert result is None, assertmsg
+
+
def check_routers(initial_convergence=False, exiting=None, restarting=None):
for rname in ["rt1", "rt2", "rt3", "rt4", "rt5", "rt6", "rt7"]:
# Check the RIB first, which should be preserved across restarts in
# all routers of the routing domain.
+ # If we are not on initial convergence *but* we are checking
+ # after a restart. Looking in the zebra rib for installed
+ # is a recipe for test failure. Why? because if we are restarting
+ # then ospf is in the process of establishing neighbors and passing
+ # new routes to zebra. Zebra will not mark the route as installed
+ # when it receives a replacement from ospf until it has finished
+ # processing it. Let's give it a few seconds to allow this to happen
+ # under load.
if initial_convergence == True:
tries = 240
else:
- tries = 1
+ if restarting != None:
+ tries = 60
+ else:
+ tries = 1
router_compare_json_output(
rname, "show ip route ospf json", "show_ip_route.json", tries
)
@@ -215,6 +261,26 @@ def check_routers(initial_convergence=False, exiting=None, restarting=None):
)
+def ensure_gr_is_in_zebra(rname):
+ retry = True
+ retry_times = 10
+ tgen = get_topogen()
+
+ while retry and retry_times > 0:
+ out = tgen.net[rname].cmd(
+ 'vtysh -c "show zebra client" | grep "Client: ospf$" -A 40 | grep "Capabilities "'
+ )
+
+ if "Graceful Restart" not in out:
+ sleep(2)
+ retry_times -= 1
+ else:
+ retry = False
+
+ assertmsg = "%s does not appear to have Graceful Restart setup" % rname
+ assert not retry and retry_times > 0, assertmsg
+
+
#
# Test initial network convergence
#
@@ -241,7 +307,8 @@ def test_gr_rt1():
pytest.skip(tgen.errors)
tgen.net["rt1"].cmd('vtysh -c "graceful-restart prepare ip ospf"')
- sleep(3)
+ expect_grace_lsa(restarting="1.1.1.1", area="0.0.0.1", helper="rt2")
+ ensure_gr_is_in_zebra("rt1")
kill_router_daemons(tgen, "rt1", ["ospfd"], save_config=False)
check_routers(exiting="rt1")
@@ -261,7 +328,9 @@ def test_gr_rt2():
pytest.skip(tgen.errors)
tgen.net["rt2"].cmd('vtysh -c "graceful-restart prepare ip ospf"')
- sleep(3)
+ expect_grace_lsa(restarting="2.2.2.2", area="0.0.0.1", helper="rt1")
+ expect_grace_lsa(restarting="2.2.2.2", area="0.0.0.0", helper="rt3")
+ ensure_gr_is_in_zebra("rt2")
kill_router_daemons(tgen, "rt2", ["ospfd"], save_config=False)
check_routers(exiting="rt2")
@@ -281,7 +350,10 @@ def test_gr_rt3():
pytest.skip(tgen.errors)
tgen.net["rt3"].cmd('vtysh -c "graceful-restart prepare ip ospf"')
- sleep(3)
+ expect_grace_lsa(restarting="3.3.3.3", area="0.0.0.0", helper="rt2")
+ expect_grace_lsa(restarting="3.3.3.3", area="0.0.0.0", helper="rt4")
+ expect_grace_lsa(restarting="3.3.3.3", area="0.0.0.0", helper="rt6")
+ ensure_gr_is_in_zebra("rt3")
kill_router_daemons(tgen, "rt3", ["ospfd"], save_config=False)
check_routers(exiting="rt3")
@@ -301,7 +373,9 @@ def test_gr_rt4():
pytest.skip(tgen.errors)
tgen.net["rt4"].cmd('vtysh -c "graceful-restart prepare ip ospf"')
- sleep(3)
+ expect_grace_lsa(restarting="4.4.4.4", area="0.0.0.0", helper="rt3")
+ expect_grace_lsa(restarting="4.4.4.4", area="0.0.0.2", helper="rt5")
+ ensure_gr_is_in_zebra("rt4")
kill_router_daemons(tgen, "rt4", ["ospfd"], save_config=False)
check_routers(exiting="rt4")
@@ -321,7 +395,8 @@ def test_gr_rt5():
pytest.skip(tgen.errors)
tgen.net["rt5"].cmd('vtysh -c "graceful-restart prepare ip ospf"')
- sleep(3)
+ expect_grace_lsa(restarting="5.5.5.5", area="0.0.0.2", helper="rt4")
+ ensure_gr_is_in_zebra("rt5")
kill_router_daemons(tgen, "rt5", ["ospfd"], save_config=False)
check_routers(exiting="rt5")
@@ -341,7 +416,9 @@ def test_gr_rt6():
pytest.skip(tgen.errors)
tgen.net["rt6"].cmd('vtysh -c "graceful-restart prepare ip ospf"')
- sleep(3)
+ expect_grace_lsa(restarting="6.6.6.6", area="0.0.0.0", helper="rt3")
+ expect_grace_lsa(restarting="6.6.6.6", area="0.0.0.3", helper="rt7")
+ ensure_gr_is_in_zebra("rt6")
kill_router_daemons(tgen, "rt6", ["ospfd"], save_config=False)
check_routers(exiting="rt6")
@@ -361,7 +438,8 @@ def test_gr_rt7():
pytest.skip(tgen.errors)
tgen.net["rt7"].cmd('vtysh -c "graceful-restart prepare ip ospf"')
- sleep(3)
+ expect_grace_lsa(restarting="7.7.7.7", area="0.0.0.3", helper="rt6")
+ ensure_gr_is_in_zebra("rt7")
kill_router_daemons(tgen, "rt7", ["ospfd"], save_config=False)
check_routers(exiting="rt7")
diff --git a/tests/topotests/ospf_sr_te_topo1/dst/zebra.conf b/tests/topotests/ospf_sr_te_topo1/dst/zebra.conf
index 4cb50fdb27..fbe55e53a4 100644
--- a/tests/topotests/ospf_sr_te_topo1/dst/zebra.conf
+++ b/tests/topotests/ospf_sr_te_topo1/dst/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname dst
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 9.9.9.2/32
diff --git a/tests/topotests/ospf_sr_te_topo1/rt1/ospfd.conf b/tests/topotests/ospf_sr_te_topo1/rt1/ospfd.conf
index 225ac93528..a440fa6fdf 100644
--- a/tests/topotests/ospf_sr_te_topo1/rt1/ospfd.conf
+++ b/tests/topotests/ospf_sr_te_topo1/rt1/ospfd.conf
@@ -2,11 +2,11 @@ password 1
hostname rt1
log file ospfd.log
!
-debug ospf sr
-debug ospf te
-debug ospf event
-debug ospf lsa
-debug ospf zebra
+! debug ospf sr
+! debug ospf te
+! debug ospf event
+! debug ospf lsa
+! debug ospf zebra
!
interface lo
ip ospf area 0.0.0.0
diff --git a/tests/topotests/ospf_sr_te_topo1/rt1/zebra.conf b/tests/topotests/ospf_sr_te_topo1/rt1/zebra.conf
index dd686ea3da..6b282b110b 100644
--- a/tests/topotests/ospf_sr_te_topo1/rt1/zebra.conf
+++ b/tests/topotests/ospf_sr_te_topo1/rt1/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt1
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 1.1.1.1/32
diff --git a/tests/topotests/ospf_sr_te_topo1/rt2/ospfd.conf b/tests/topotests/ospf_sr_te_topo1/rt2/ospfd.conf
index f6a7bbb621..7bec98cd76 100644
--- a/tests/topotests/ospf_sr_te_topo1/rt2/ospfd.conf
+++ b/tests/topotests/ospf_sr_te_topo1/rt2/ospfd.conf
@@ -1,11 +1,11 @@
hostname rt2
log file ospfd.log
!
-debug ospf sr
-debug ospf te
-debug ospf event
-debug ospf lsa
-debug ospf zebra
+! debug ospf sr
+! debug ospf te
+! debug ospf event
+! debug ospf lsa
+! debug ospf zebra
!
interface lo
ip ospf area 0.0.0.0
diff --git a/tests/topotests/ospf_sr_te_topo1/rt2/zebra.conf b/tests/topotests/ospf_sr_te_topo1/rt2/zebra.conf
index ddd50ba520..24795c2618 100644
--- a/tests/topotests/ospf_sr_te_topo1/rt2/zebra.conf
+++ b/tests/topotests/ospf_sr_te_topo1/rt2/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt2
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 2.2.2.2/32
diff --git a/tests/topotests/ospf_sr_te_topo1/rt3/ospfd.conf b/tests/topotests/ospf_sr_te_topo1/rt3/ospfd.conf
index 5f71cd8484..40b85c4601 100644
--- a/tests/topotests/ospf_sr_te_topo1/rt3/ospfd.conf
+++ b/tests/topotests/ospf_sr_te_topo1/rt3/ospfd.conf
@@ -1,11 +1,11 @@
hostname rt3
log file ospfd.log
!
-debug ospf sr
-debug ospf te
-debug ospf event
-debug ospf lsa
-debug ospf zebra
+! debug ospf sr
+! debug ospf te
+! debug ospf event
+! debug ospf lsa
+! debug ospf zebra
!
interface lo
ip ospf area 0.0.0.0
diff --git a/tests/topotests/ospf_sr_te_topo1/rt3/zebra.conf b/tests/topotests/ospf_sr_te_topo1/rt3/zebra.conf
index 0825b5c8bf..353c710bdb 100644
--- a/tests/topotests/ospf_sr_te_topo1/rt3/zebra.conf
+++ b/tests/topotests/ospf_sr_te_topo1/rt3/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt3
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 3.3.3.3/32
diff --git a/tests/topotests/ospf_sr_te_topo1/rt4/ospfd.conf b/tests/topotests/ospf_sr_te_topo1/rt4/ospfd.conf
index d4862cd233..4d3380d107 100644
--- a/tests/topotests/ospf_sr_te_topo1/rt4/ospfd.conf
+++ b/tests/topotests/ospf_sr_te_topo1/rt4/ospfd.conf
@@ -1,11 +1,11 @@
hostname rt4
log file ospfd.log
!
-debug ospf sr
-debug ospf te
-debug ospf event
-debug ospf lsa
-debug ospf zebra
+! debug ospf sr
+! debug ospf te
+! debug ospf event
+! debug ospf lsa
+! debug ospf zebra
!
interface lo
ip ospf area 0.0.0.0
diff --git a/tests/topotests/ospf_sr_te_topo1/rt4/zebra.conf b/tests/topotests/ospf_sr_te_topo1/rt4/zebra.conf
index c6d1f4f40e..966eb725a1 100644
--- a/tests/topotests/ospf_sr_te_topo1/rt4/zebra.conf
+++ b/tests/topotests/ospf_sr_te_topo1/rt4/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt4
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 4.4.4.4/32
diff --git a/tests/topotests/ospf_sr_te_topo1/rt5/ospfd.conf b/tests/topotests/ospf_sr_te_topo1/rt5/ospfd.conf
index fdc0dcfdb7..b111ce588a 100644
--- a/tests/topotests/ospf_sr_te_topo1/rt5/ospfd.conf
+++ b/tests/topotests/ospf_sr_te_topo1/rt5/ospfd.conf
@@ -1,11 +1,11 @@
hostname rt5
log file ospfd.log
!
-debug ospf sr
-debug ospf te
-debug ospf event
-debug ospf lsa
-debug ospf zebra
+! debug ospf sr
+! debug ospf te
+! debug ospf event
+! debug ospf lsa
+! debug ospf zebra
!
interface lo
ip ospf area 0.0.0.0
diff --git a/tests/topotests/ospf_sr_te_topo1/rt5/zebra.conf b/tests/topotests/ospf_sr_te_topo1/rt5/zebra.conf
index 96b732d398..3184f1d778 100644
--- a/tests/topotests/ospf_sr_te_topo1/rt5/zebra.conf
+++ b/tests/topotests/ospf_sr_te_topo1/rt5/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt5
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 5.5.5.5/32
diff --git a/tests/topotests/ospf_sr_te_topo1/rt6/ospfd.conf b/tests/topotests/ospf_sr_te_topo1/rt6/ospfd.conf
index c06565be0b..f0c5a9c0ba 100644
--- a/tests/topotests/ospf_sr_te_topo1/rt6/ospfd.conf
+++ b/tests/topotests/ospf_sr_te_topo1/rt6/ospfd.conf
@@ -1,11 +1,11 @@
hostname rt6
log file ospfd.log
!
-debug ospf sr
-debug ospf te
-debug ospf event
-debug ospf lsa
-debug ospf zebra
+! debug ospf sr
+! debug ospf te
+! debug ospf event
+! debug ospf lsa
+! debug ospf zebra
!
interface lo
ip ospf area 0.0.0.0
diff --git a/tests/topotests/ospf_sr_te_topo1/rt6/zebra.conf b/tests/topotests/ospf_sr_te_topo1/rt6/zebra.conf
index 360837c4ca..c556aa3681 100644
--- a/tests/topotests/ospf_sr_te_topo1/rt6/zebra.conf
+++ b/tests/topotests/ospf_sr_te_topo1/rt6/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt6
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 6.6.6.6/32
diff --git a/tests/topotests/ospf_sr_topo1/rt1/ospfd.conf b/tests/topotests/ospf_sr_topo1/rt1/ospfd.conf
index 6a12ae5011..be9abf6238 100644
--- a/tests/topotests/ospf_sr_topo1/rt1/ospfd.conf
+++ b/tests/topotests/ospf_sr_topo1/rt1/ospfd.conf
@@ -2,11 +2,11 @@ password 1
hostname rt1
log file ospfd.log
!
-debug ospf sr
-debug ospf te
-debug ospf event
-debug ospf lsa
-debug ospf zebra
+! debug ospf sr
+! debug ospf te
+! debug ospf event
+! debug ospf lsa
+! debug ospf zebra
!
interface lo
!
diff --git a/tests/topotests/ospf_sr_topo1/rt1/zebra.conf b/tests/topotests/ospf_sr_topo1/rt1/zebra.conf
index 7d3139a80e..520f2e4994 100644
--- a/tests/topotests/ospf_sr_topo1/rt1/zebra.conf
+++ b/tests/topotests/ospf_sr_topo1/rt1/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt1
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 1.1.1.1/32
diff --git a/tests/topotests/ospf_sr_topo1/rt2/ospfd.conf b/tests/topotests/ospf_sr_topo1/rt2/ospfd.conf
index adf4d09235..30ef12a79e 100644
--- a/tests/topotests/ospf_sr_topo1/rt2/ospfd.conf
+++ b/tests/topotests/ospf_sr_topo1/rt2/ospfd.conf
@@ -2,11 +2,11 @@ password 1
hostname rt2
log file ospfd.log
!
-debug ospf sr
-debug ospf te
-debug ospf event
-debug ospf lsa
-debug ospf zebra
+! debug ospf sr
+! debug ospf te
+! debug ospf event
+! debug ospf lsa
+! debug ospf zebra
!
interface lo
!
diff --git a/tests/topotests/ospf_sr_topo1/rt2/zebra.conf b/tests/topotests/ospf_sr_topo1/rt2/zebra.conf
index c4ed4276d9..fbf805cdac 100644
--- a/tests/topotests/ospf_sr_topo1/rt2/zebra.conf
+++ b/tests/topotests/ospf_sr_topo1/rt2/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt2
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 2.2.2.2/32
diff --git a/tests/topotests/ospf_sr_topo1/rt3/ospfd.conf b/tests/topotests/ospf_sr_topo1/rt3/ospfd.conf
index c45c1069fb..e315679765 100644
--- a/tests/topotests/ospf_sr_topo1/rt3/ospfd.conf
+++ b/tests/topotests/ospf_sr_topo1/rt3/ospfd.conf
@@ -2,11 +2,11 @@ password 1
hostname rt3
log file ospfd.log
!
-debug ospf sr
-debug ospf te
-debug ospf event
-debug ospf lsa
-debug ospf zebra
+! debug ospf sr
+! debug ospf te
+! debug ospf event
+! debug ospf lsa
+! debug ospf zebra
!
interface lo
!
diff --git a/tests/topotests/ospf_sr_topo1/rt3/zebra.conf b/tests/topotests/ospf_sr_topo1/rt3/zebra.conf
index 89a781fe3c..fc9db060e9 100644
--- a/tests/topotests/ospf_sr_topo1/rt3/zebra.conf
+++ b/tests/topotests/ospf_sr_topo1/rt3/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt3
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 3.3.3.3/32
diff --git a/tests/topotests/ospf_sr_topo1/rt4/ospfd.conf b/tests/topotests/ospf_sr_topo1/rt4/ospfd.conf
index 9853ce64cf..681aaa3a8c 100644
--- a/tests/topotests/ospf_sr_topo1/rt4/ospfd.conf
+++ b/tests/topotests/ospf_sr_topo1/rt4/ospfd.conf
@@ -2,11 +2,11 @@ password 1
hostname rt4
log file ospfd.log
!
-debug ospf sr
-debug ospf te
-debug ospf event
-debug ospf lsa
-debug ospf zebra
+! debug ospf sr
+! debug ospf te
+! debug ospf event
+! debug ospf lsa
+! debug ospf zebra
!
interface lo
!
diff --git a/tests/topotests/ospf_sr_topo1/rt4/zebra.conf b/tests/topotests/ospf_sr_topo1/rt4/zebra.conf
index 13c621eb31..d794837eb7 100644
--- a/tests/topotests/ospf_sr_topo1/rt4/zebra.conf
+++ b/tests/topotests/ospf_sr_topo1/rt4/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt4
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 4.4.4.4/32
diff --git a/tests/topotests/ospf_sr_topo1/rt5/ospfd.conf b/tests/topotests/ospf_sr_topo1/rt5/ospfd.conf
index e6a755c430..0b441c70de 100644
--- a/tests/topotests/ospf_sr_topo1/rt5/ospfd.conf
+++ b/tests/topotests/ospf_sr_topo1/rt5/ospfd.conf
@@ -2,11 +2,11 @@ password 1
hostname rt5
log file ospfd.log
!
-debug ospf sr
-debug ospf te
-debug ospf event
-debug ospf lsa
-debug ospf zebra
+! debug ospf sr
+! debug ospf te
+! debug ospf event
+! debug ospf lsa
+! debug ospf zebra
!
interface lo
!
diff --git a/tests/topotests/ospf_sr_topo1/rt5/zebra.conf b/tests/topotests/ospf_sr_topo1/rt5/zebra.conf
index ca2d6df665..09923f28e9 100644
--- a/tests/topotests/ospf_sr_topo1/rt5/zebra.conf
+++ b/tests/topotests/ospf_sr_topo1/rt5/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt5
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 5.5.5.5/32
diff --git a/tests/topotests/ospf_sr_topo1/rt6/ospfd.conf b/tests/topotests/ospf_sr_topo1/rt6/ospfd.conf
index 1ec71e4454..7bb5de9440 100644
--- a/tests/topotests/ospf_sr_topo1/rt6/ospfd.conf
+++ b/tests/topotests/ospf_sr_topo1/rt6/ospfd.conf
@@ -2,11 +2,11 @@ password 1
hostname rt6
log file ospfd.log
!
-debug ospf sr
-debug ospf te
-debug ospf event
-debug ospf lsa
-debug ospf zebra
+! debug ospf sr
+! debug ospf te
+! debug ospf event
+! debug ospf lsa
+! debug ospf zebra
!
interface lo
!
diff --git a/tests/topotests/ospf_sr_topo1/rt6/zebra.conf b/tests/topotests/ospf_sr_topo1/rt6/zebra.conf
index 4b739d0bca..1452560065 100644
--- a/tests/topotests/ospf_sr_topo1/rt6/zebra.conf
+++ b/tests/topotests/ospf_sr_topo1/rt6/zebra.conf
@@ -2,9 +2,9 @@ log file zebra.log
!
hostname rt6
!
-debug zebra kernel
-debug zebra packet
-debug zebra mpls
+! debug zebra kernel
+! debug zebra packet
+! debug zebra mpls
!
interface lo
ip address 6.6.6.6/32
diff --git a/tests/topotests/ospf_tilfa_topo1/rt1/ospfd.conf b/tests/topotests/ospf_tilfa_topo1/rt1/ospfd.conf
index eaef49225f..04b2c381e2 100644
--- a/tests/topotests/ospf_tilfa_topo1/rt1/ospfd.conf
+++ b/tests/topotests/ospf_tilfa_topo1/rt1/ospfd.conf
@@ -1,5 +1,5 @@
-debug ospf sr
-debug ospf ti-lfa
+! debug ospf sr
+! debug ospf ti-lfa
!
interface lo
!
diff --git a/tests/topotests/ospf_tilfa_topo1/rt2/ospfd.conf b/tests/topotests/ospf_tilfa_topo1/rt2/ospfd.conf
index 7548aad7f8..e6e4847ba7 100644
--- a/tests/topotests/ospf_tilfa_topo1/rt2/ospfd.conf
+++ b/tests/topotests/ospf_tilfa_topo1/rt2/ospfd.conf
@@ -1,5 +1,5 @@
-debug ospf sr
-debug ospf ti-lfa
+! debug ospf sr
+! debug ospf ti-lfa
!
interface lo
!
diff --git a/tests/topotests/ospf_tilfa_topo1/rt3/ospfd.conf b/tests/topotests/ospf_tilfa_topo1/rt3/ospfd.conf
index 6258295b6f..472cdc6bcb 100644
--- a/tests/topotests/ospf_tilfa_topo1/rt3/ospfd.conf
+++ b/tests/topotests/ospf_tilfa_topo1/rt3/ospfd.conf
@@ -1,5 +1,5 @@
-debug ospf sr
-debug ospf ti-lfa
+! debug ospf sr
+! debug ospf ti-lfa
!
interface lo
!
diff --git a/tests/topotests/ospf_tilfa_topo1/rt4/ospfd.conf b/tests/topotests/ospf_tilfa_topo1/rt4/ospfd.conf
index ad02214017..75770dc5dd 100644
--- a/tests/topotests/ospf_tilfa_topo1/rt4/ospfd.conf
+++ b/tests/topotests/ospf_tilfa_topo1/rt4/ospfd.conf
@@ -1,5 +1,5 @@
-debug ospf sr
-debug ospf ti-lfa
+! debug ospf sr
+! debug ospf ti-lfa
!
interface lo
!
diff --git a/tests/topotests/ospf_tilfa_topo1/rt5/ospfd.conf b/tests/topotests/ospf_tilfa_topo1/rt5/ospfd.conf
index 1b95858f53..ef9d583ae9 100644
--- a/tests/topotests/ospf_tilfa_topo1/rt5/ospfd.conf
+++ b/tests/topotests/ospf_tilfa_topo1/rt5/ospfd.conf
@@ -1,5 +1,5 @@
-debug ospf sr
-debug ospf ti-lfa
+! debug ospf sr
+! debug ospf ti-lfa
!
interface lo
!
diff --git a/tests/topotests/ospf_topo1/test_ospf_topo1.py b/tests/topotests/ospf_topo1/test_ospf_topo1.py
index d84c41bea3..e2a6ff64a4 100644
--- a/tests/topotests/ospf_topo1/test_ospf_topo1.py
+++ b/tests/topotests/ospf_topo1/test_ospf_topo1.py
@@ -30,6 +30,7 @@ import os
import re
import sys
from functools import partial
+from time import sleep
import pytest
# Save the Current Working Directory to find configuration files.
@@ -135,7 +136,7 @@ def test_wait_protocol_convergence():
)
if (
topotest.json_cmp(
- result, {"neighbors": {neighbor: [{"state": "Full/DR"}]}}
+ result, {"neighbors": {neighbor: [{"converged": "Full"}]}}
)
is None
):
@@ -143,14 +144,14 @@ def test_wait_protocol_convergence():
if (
topotest.json_cmp(
- result, {"neighbors": {neighbor: [{"state": "Full/DROther"}]}}
+ result, {"neighbors": {neighbor: [{"converged": "Full"}]}}
)
is None
):
return None
return topotest.json_cmp(
- result, {"neighbors": {neighbor: [{"state": "Full/Backup"}]}}
+ result, {"neighbors": {neighbor: [{"converged": "Full"}]}}
)
_, result = topotest.run_and_expect(
@@ -475,7 +476,18 @@ def test_ospf_link_down_kernel_route():
assertmsg = 'OSPF IPv4 route mismatch in router "{}" after link down'.format(
router.name
)
- assert topotest.json_cmp(routes, expected) is None, assertmsg
+ count = 0
+ not_found = True
+ while not_found and count < 10:
+ not_found = topotest.json_cmp(routes, expected)
+ if not_found:
+ sleep(1)
+ routes = topotest.ip4_route(router)
+ count += 1
+ else:
+ not_found = False
+ break
+ assert not_found is False, assertmsg
def test_ospf6_link_down():
@@ -547,7 +559,19 @@ def test_ospf6_link_down_kernel_route():
assertmsg = 'OSPF IPv6 route mismatch in router "{}" after link down'.format(
router.name
)
- assert topotest.json_cmp(routes, expected) is None, assertmsg
+ count = 0
+ not_found = True
+ while not_found and count < 10:
+ not_found = topotest.json_cmp(routes, expected)
+ if not_found:
+ sleep(1)
+ routes = topotest.ip6_route(router)
+ count += 1
+ else:
+ not_found = False
+ break
+
+ assert not_found is False, assertmsg
def test_memory_leak():
diff --git a/tests/topotests/ospf_topo1_vrf/r1/zebra.conf b/tests/topotests/ospf_topo1_vrf/r1/zebra.conf
index e100d3b121..56d7a9764e 100644
--- a/tests/topotests/ospf_topo1_vrf/r1/zebra.conf
+++ b/tests/topotests/ospf_topo1_vrf/r1/zebra.conf
@@ -1,7 +1,7 @@
-debug zebra kernel
-debug zebra dplane detail
-debug zebra rib
-debug zebra event
+! debug zebra kernel
+! debug zebra dplane detail
+! debug zebra rib
+! debug zebra event
!
hostname r1
password zebra
diff --git a/tests/topotests/ospfv3_basic_functionality/ospfv3_nssa.json b/tests/topotests/ospfv3_basic_functionality/ospfv3_nssa.json
new file mode 100644
index 0000000000..2b91abc9e3
--- /dev/null
+++ b/tests/topotests/ospfv3_basic_functionality/ospfv3_nssa.json
@@ -0,0 +1,86 @@
+{
+ "address_types": [
+ "ipv6"
+ ],
+ "lo_prefix": {
+ "ipv6": "2001::",
+ "v6mask": 128
+ },
+ "routers": {
+ "r1": {
+ "links": {
+ "lo": {
+ "ipv6": "auto",
+ "type": "loopback"
+ },
+ "r2": {
+ "ipv6": "12::1/64",
+ "ospf6": {
+ "area": "0.0.0.0",
+ "hello_interval": 1,
+ "dead_interval": 4
+ }
+ }
+ },
+ "ospf6": {
+ "router_id": "1.1.1.1",
+ "neighbors": {
+ "r2": {}
+ }
+ }
+ },
+ "r2": {
+ "links": {
+ "lo": {
+ "ipv6": "auto",
+ "type": "loopback"
+ },
+ "r1": {
+ "ipv6": "12::2/64",
+ "ospf6": {
+ "area": "0.0.0.0",
+ "hello_interval": 1,
+ "dead_interval": 4
+ }
+ },
+ "r3": {
+ "ipv6": "23::2/64",
+ "ospf6": {
+ "area": "1.1.1.1",
+ "hello_interval": 1,
+ "dead_interval": 4
+ }
+ }
+ },
+ "ospf6": {
+ "router_id": "2.2.2.2",
+ "neighbors": {
+ "r1": {},
+ "r3": {}
+ }
+ }
+ },
+ "r3": {
+ "links": {
+ "lo": {
+ "ipv6": "auto",
+ "type": "loopback"
+ },
+ "r2": {
+ "ipv6": "23::3/64",
+ "ospf6": {
+ "area": "1.1.1.1",
+ "hello_interval": 1,
+ "dead_interval": 4
+ }
+ }
+ },
+ "ospf6": {
+ "router_id": "3.3.3.3",
+ "neighbors": {
+ "r2": {}
+ }
+ }
+ }
+ }
+}
diff --git a/tests/topotests/ospfv3_basic_functionality/test_ospfv3_nssa.py b/tests/topotests/ospfv3_basic_functionality/test_ospfv3_nssa.py
new file mode 100644
index 0000000000..64a067cd1a
--- /dev/null
+++ b/tests/topotests/ospfv3_basic_functionality/test_ospfv3_nssa.py
@@ -0,0 +1,162 @@
+#!/usr/bin/python
+
+from lib.topogen import Topogen, get_topogen
+from lib.common_config import (
+ start_topology,
+ write_test_header,
+ write_test_footer,
+ reset_config_on_routers,
+ step,
+ topo_daemons,
+)
+from lib.topolog import logger
+from lib.topojson import build_config_from_json
+from lib.ospf import create_router_ospf, verify_ospf6_neighbor
+import os
+import sys
+import time
+import pytest
+
+# Save the Current Working Directory to find configuration files.
+CWD = os.path.dirname(os.path.realpath(__file__))
+sys.path.append(os.path.join(CWD, "../"))
+sys.path.append(os.path.join(CWD, "../lib/"))
+
+# pylint: disable=C0413
+
+pytestmark = [pytest.mark.ospfd]
+
+
+# Global variables
+topo = None
+
+"""
+TOPOOLOGY
+
+ +---+ 0.0.0.0 +---+ 1.1.1.1 +---+
+ +R1 +------------+R2 |------------+R3 |
+ +-+-+ +--++ +--++
+
+TESTCASES =
+1. OSPF Verify E-bit mismatch between R2 and R3
+2. OSPF Verify N-bit mismatch between R2 and R3
+"""
+
+
+def setup_module(mod):
+ """
+ Sets up the pytest environment
+
+ * `mod`: module name
+ """
+ testsuite_run_time = time.asctime(time.localtime(time.time()))
+ logger.info("Testsuite start time: {}".format(testsuite_run_time))
+ logger.info("=" * 40)
+
+ logger.info("Running setup_module to create topology")
+
+ # This function initiates the topology build with Topogen...
+ json_file = "{}/ospfv3_nssa.json".format(CWD)
+ tgen = Topogen(json_file, mod.__name__)
+ global topo
+ topo = tgen.json_topo
+ # ... and here it calls Mininet initialization functions.
+
+ # get list of daemons needs to be started for this suite.
+ daemons = topo_daemons(tgen, topo)
+
+ # Starting topology, create tmp files which are loaded to routers
+ # to start deamons and then start routers
+ start_topology(tgen, daemons)
+
+ # Creating configuration from JSON
+ build_config_from_json(tgen, topo)
+
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ result = verify_ospf6_neighbor(tgen, topo)
+ assert result is True, "setup_module: Failed \n Error:" " {}".format(result)
+
+ logger.info("Running setup_module() done")
+
+
+def teardown_module(mod):
+ """
+ Teardown the pytest environment.
+
+ * `mod`: module name
+ """
+
+ logger.info("Running teardown_module to delete topology")
+
+ tgen = get_topogen()
+
+ # Stop toplogy and Remove tmp files
+ tgen.stop_topology()
+
+ logger.info(
+ "Testsuite end time: {}".format(time.asctime(time.localtime(time.time())))
+ )
+ logger.info("=" * 40)
+
+
+# ##################################
+# Test cases start here.
+# ##################################
+
+
+def test_ospfv3_bit_mismatch(request):
+ """OSPF verify E-bit and N-bit mismatch."""
+
+ tc_name = request.node.name
+ write_test_header(tc_name)
+ tgen = get_topogen()
+
+ # Don't run this test if we have any failure.
+ if tgen.routers_have_failure():
+ pytest.skip(tgen.errors)
+
+ global topo
+ step("Bring up the base config as per the topology")
+ reset_config_on_routers(tgen)
+
+ input_dict = {"r3": {"ospf6": {"neighbors": []}}}
+
+ step("Configure r3 as stub router")
+ stub = {"r3": {"ospf6": {"area": [{"id": "1.1.1.1", "type": "stub"}]}}}
+ result = create_router_ospf(tgen, topo, stub)
+ assert result is True, "Testcase {}: Failed \n Error: {}".format(tc_name, result)
+ # Verify r3 lost its adjacency with r2 due to E-bit mismatch
+ result = verify_ospf6_neighbor(tgen, topo, dut="r3", input_dict=input_dict)
+ assert result is True, "Testcase {}: Failed \n Error: {}".format(tc_name, result)
+
+ step("Configure r2 as stub router")
+ stub = {"r2": {"ospf6": {"area": [{"id": "1.1.1.1", "type": "stub"}]}}}
+ result = create_router_ospf(tgen, topo, stub)
+ assert result is True, "Testcase {}: Failed \n Error: {}".format(tc_name, result)
+ # Verify r3 has an adjacency up with r2 again
+ result = verify_ospf6_neighbor(tgen, topo, dut="r3")
+ assert result is True, "Testcase {}: Failed \n Error: {}".format(tc_name, result)
+
+ step("Configure r3 as NSSA router")
+ nssa = {"r3": {"ospf6": {"area": [{"id": "1.1.1.1", "type": "nssa"}]}}}
+ result = create_router_ospf(tgen, topo, nssa)
+ # Verify r3 lost its adjacency with r2 due to N-bit mismatch
+ result = verify_ospf6_neighbor(tgen, topo, dut="r3", input_dict=input_dict)
+ assert result is True, "Testcase {}: Failed \n Error: {}".format(tc_name, result)
+
+ step("Configure r2 as NSSA router")
+ nssa = {"r2": {"ospf6": {"area": [{"id": "1.1.1.1", "type": "nssa"}]}}}
+ result = create_router_ospf(tgen, topo, nssa)
+ # Verify r3 has an adjacency up with r2 again
+ result = verify_ospf6_neighbor(tgen, topo, dut="r3")
+ 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/pbr_topo1/r1/pbrd.conf b/tests/topotests/pbr_topo1/r1/pbrd.conf
index 45cb7656ab..2a5f464780 100644
--- a/tests/topotests/pbr_topo1/r1/pbrd.conf
+++ b/tests/topotests/pbr_topo1/r1/pbrd.conf
@@ -1,7 +1,7 @@
-debug pbr
-debug pbr events
-debug pbr nht
-debug pbr zebra
+! debug pbr
+! debug pbr events
+! debug pbr nht
+! debug pbr zebra
# Valid table range
pbr table range 10000 50000
# Try to set invalid bounds
diff --git a/tests/topotests/pim_acl/r1/ospf_neighbor.json b/tests/topotests/pim_acl/r1/ospf_neighbor.json
index a8fc093e90..af83d6bea3 100644
--- a/tests/topotests/pim_acl/r1/ospf_neighbor.json
+++ b/tests/topotests/pim_acl/r1/ospf_neighbor.json
@@ -3,7 +3,7 @@
"192.168.0.11":[
{
"priority":10,
- "state":"Full\/Backup",
+ "converged":"Full",
"address":"192.168.101.11",
"ifaceName":"r1-eth1:192.168.101.1",
"retransmitCounter":0,
@@ -14,7 +14,7 @@
"192.168.0.12":[
{
"priority":0,
- "state":"Full\/DROther",
+ "converged":"Full",
"address":"192.168.101.12",
"ifaceName":"r1-eth1:192.168.101.1",
"retransmitCounter":0,
@@ -25,7 +25,7 @@
"192.168.0.13":[
{
"priority":0,
- "state":"Full\/DROther",
+ "converged":"Full",
"address":"192.168.101.13",
"ifaceName":"r1-eth1:192.168.101.1",
"retransmitCounter":0,
@@ -36,7 +36,7 @@
"192.168.0.14":[
{
"priority":0,
- "state":"Full\/DROther",
+ "converged":"Full",
"address":"192.168.101.14",
"ifaceName":"r1-eth1:192.168.101.1",
"retransmitCounter":0,
@@ -47,7 +47,7 @@
"192.168.0.15":[
{
"priority":0,
- "state":"Full\/DROther",
+ "converged":"Full",
"address":"192.168.101.15",
"ifaceName":"r1-eth1:192.168.101.1",
"retransmitCounter":0,
diff --git a/tests/topotests/pim_acl/r1/ospfd.conf b/tests/topotests/pim_acl/r1/ospfd.conf
index e1f47fb3b1..c453dec96c 100644
--- a/tests/topotests/pim_acl/r1/ospfd.conf
+++ b/tests/topotests/pim_acl/r1/ospfd.conf
@@ -1,6 +1,6 @@
hostname r1
!
-debug ospf event
+! debug ospf event
!
interface r1-eth1
ip ospf hello-interval 2
diff --git a/tests/topotests/pim_acl/r1/pimd.conf b/tests/topotests/pim_acl/r1/pimd.conf
index a148c73146..5bdfbea72a 100644
--- a/tests/topotests/pim_acl/r1/pimd.conf
+++ b/tests/topotests/pim_acl/r1/pimd.conf
@@ -1,12 +1,12 @@
hostname r1
!
-debug igmp events
-debug igmp packets
-debug pim events
-debug pim packets
-debug pim trace
-debug pim zebra
-debug pim bsm
+! debug igmp events
+! debug igmp packets
+! debug pim events
+! debug pim packets
+! debug pim trace
+! debug pim zebra
+! debug pim bsm
!
ip pim rp 192.168.0.11 prefix-list rp-pl-1
ip pim rp 192.168.0.12 prefix-list rp-pl-2
diff --git a/tests/topotests/pim_acl/r11/ospfd.conf b/tests/topotests/pim_acl/r11/ospfd.conf
index e107220a4e..86fb66db61 100644
--- a/tests/topotests/pim_acl/r11/ospfd.conf
+++ b/tests/topotests/pim_acl/r11/ospfd.conf
@@ -1,6 +1,6 @@
hostname r11
!
-debug ospf event
+! debug ospf event
!
interface r11-eth0
ip ospf hello-interval 2
diff --git a/tests/topotests/pim_acl/r11/pimd.conf b/tests/topotests/pim_acl/r11/pimd.conf
index b1d45205da..3e409ddd31 100644
--- a/tests/topotests/pim_acl/r11/pimd.conf
+++ b/tests/topotests/pim_acl/r11/pimd.conf
@@ -1,10 +1,10 @@
hostname r11
!
-debug pim events
-debug pim packets
-debug pim trace
-debug pim zebra
-debug pim bsm
+! debug pim events
+! debug pim packets
+! debug pim trace
+! debug pim zebra
+! debug pim bsm
!
ip pim rp 192.168.0.11 239.100.0.0/28
ip pim join-prune-interval 5
diff --git a/tests/topotests/pim_acl/r12/ospfd.conf b/tests/topotests/pim_acl/r12/ospfd.conf
index f9203c78e4..1110df18b4 100644
--- a/tests/topotests/pim_acl/r12/ospfd.conf
+++ b/tests/topotests/pim_acl/r12/ospfd.conf
@@ -1,6 +1,6 @@
hostname r12
!
-debug ospf event
+! debug ospf event
!
interface r12-eth0
ip ospf hello-interval 2
diff --git a/tests/topotests/pim_acl/r12/pimd.conf b/tests/topotests/pim_acl/r12/pimd.conf
index ba9e7d902f..2fc853bc04 100644
--- a/tests/topotests/pim_acl/r12/pimd.conf
+++ b/tests/topotests/pim_acl/r12/pimd.conf
@@ -1,10 +1,10 @@
hostname r12
!
-debug pim events
-debug pim packets
-debug pim trace
-debug pim zebra
-debug pim bsm
+! debug pim events
+! debug pim packets
+! debug pim trace
+! debug pim zebra
+! debug pim bsm
!
ip pim rp 192.168.0.12 239.100.0.17/32
ip pim join-prune-interval 5
diff --git a/tests/topotests/pim_acl/r13/ospfd.conf b/tests/topotests/pim_acl/r13/ospfd.conf
index 830c5a14b6..aff24c7038 100644
--- a/tests/topotests/pim_acl/r13/ospfd.conf
+++ b/tests/topotests/pim_acl/r13/ospfd.conf
@@ -1,6 +1,6 @@
hostname r13
!
-debug ospf event
+! debug ospf event
!
interface r13-eth0
ip ospf hello-interval 2
diff --git a/tests/topotests/pim_acl/r13/pimd.conf b/tests/topotests/pim_acl/r13/pimd.conf
index 2ff1743574..5e44879306 100644
--- a/tests/topotests/pim_acl/r13/pimd.conf
+++ b/tests/topotests/pim_acl/r13/pimd.conf
@@ -1,10 +1,10 @@
hostname r13
!
-debug pim events
-debug pim packets
-debug pim trace
-debug pim zebra
-debug pim bsm
+! debug pim events
+! debug pim packets
+! debug pim trace
+! debug pim zebra
+! debug pim bsm
!
ip pim rp 192.168.0.13 239.100.0.32/27
ip pim join-prune-interval 5
diff --git a/tests/topotests/pim_acl/r14/ospfd.conf b/tests/topotests/pim_acl/r14/ospfd.conf
index 422e4c08b0..e5cf8e2567 100644
--- a/tests/topotests/pim_acl/r14/ospfd.conf
+++ b/tests/topotests/pim_acl/r14/ospfd.conf
@@ -1,6 +1,6 @@
hostname r14
!
-debug ospf event
+! debug ospf event
!
interface r14-eth0
ip ospf hello-interval 2
diff --git a/tests/topotests/pim_acl/r14/pimd.conf b/tests/topotests/pim_acl/r14/pimd.conf
index 1324a9e40b..42beb2ab08 100644
--- a/tests/topotests/pim_acl/r14/pimd.conf
+++ b/tests/topotests/pim_acl/r14/pimd.conf
@@ -1,10 +1,10 @@
hostname r14
!
-debug pim events
-debug pim packets
-debug pim trace
-debug pim zebra
-debug pim bsm
+! debug pim events
+! debug pim packets
+! debug pim trace
+! debug pim zebra
+! debug pim bsm
!
ip pim rp 192.168.0.14 239.100.0.96/28
ip pim rp 192.168.0.14 239.100.0.128/25
diff --git a/tests/topotests/pim_acl/r15/ospfd.conf b/tests/topotests/pim_acl/r15/ospfd.conf
index cd4d7b3875..cc58325e2b 100644
--- a/tests/topotests/pim_acl/r15/ospfd.conf
+++ b/tests/topotests/pim_acl/r15/ospfd.conf
@@ -1,6 +1,6 @@
hostname r15
!
-debug ospf event
+! debug ospf event
!
interface r15-eth0
ip ospf hello-interval 2
diff --git a/tests/topotests/pim_acl/r15/pimd.conf b/tests/topotests/pim_acl/r15/pimd.conf
index f47e78c221..d5a0450067 100644
--- a/tests/topotests/pim_acl/r15/pimd.conf
+++ b/tests/topotests/pim_acl/r15/pimd.conf
@@ -1,10 +1,10 @@
hostname r15
!
-debug pim events
-debug pim packets
-debug pim trace
-debug pim zebra
-debug pim bsm
+! debug pim events
+! debug pim packets
+! debug pim trace
+! debug pim zebra
+! debug pim bsm
!
ip pim rp 192.168.0.15 239.100.0.64/28
ip pim join-prune-interval 5
diff --git a/tests/topotests/pim_basic/mcast-rx.py b/tests/topotests/pim_basic/mcast-rx.py
index 862ad46af4..885337666a 100755
--- a/tests/topotests/pim_basic/mcast-rx.py
+++ b/tests/topotests/pim_basic/mcast-rx.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
#
# mcast-rx.py
#
diff --git a/tests/topotests/pim_basic/mcast-tx.py b/tests/topotests/pim_basic/mcast-tx.py
index 87038ad5cf..88c234573f 100755
--- a/tests/topotests/pim_basic/mcast-tx.py
+++ b/tests/topotests/pim_basic/mcast-tx.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
#
# mcast-tx.py
#
diff --git a/tests/topotests/pim_basic/test_pim.py b/tests/topotests/pim_basic/test_pim.py
index 03b4368e42..6cea521aa9 100644
--- a/tests/topotests/pim_basic/test_pim.py
+++ b/tests/topotests/pim_basic/test_pim.py
@@ -172,7 +172,11 @@ def test_pim_send_mcast_stream():
}
}
- assert topotest.json_cmp(out, expected) is None, "failed to converge pim"
+ test_func = partial(
+ topotest.router_json_cmp, r1, "show ip pim upstream json", expected
+ )
+ _, result = topotest.run_and_expect(test_func, None, count=20, wait=1)
+ assert result is None, "failed to converge pim"
# tgen.mininet_cli()
diff --git a/tests/topotests/pim_igmp_vrf/r1/ospf_blue_neighbor.json b/tests/topotests/pim_igmp_vrf/r1/ospf_blue_neighbor.json
index 604d25fac1..1e70fcc36e 100644
--- a/tests/topotests/pim_igmp_vrf/r1/ospf_blue_neighbor.json
+++ b/tests/topotests/pim_igmp_vrf/r1/ospf_blue_neighbor.json
@@ -5,7 +5,7 @@
"192.168.0.11":[
{
"priority":10,
- "state":"Full\/Backup",
+ "converged":"Full",
"address":"192.168.101.11",
"ifaceName":"r1-eth1:192.168.101.1"
}
diff --git a/tests/topotests/pim_igmp_vrf/r1/ospf_red_neighbor.json b/tests/topotests/pim_igmp_vrf/r1/ospf_red_neighbor.json
index 456bb87520..7f2ab248cc 100644
--- a/tests/topotests/pim_igmp_vrf/r1/ospf_red_neighbor.json
+++ b/tests/topotests/pim_igmp_vrf/r1/ospf_red_neighbor.json
@@ -5,7 +5,7 @@
"192.168.0.12":[
{
"priority":10,
- "state":"Full\/Backup",
+ "converged":"Full",
"address":"192.168.101.12",
"ifaceName":"r1-eth3:192.168.101.1"
}
diff --git a/tests/topotests/pim_igmp_vrf/r1/ospfd.conf b/tests/topotests/pim_igmp_vrf/r1/ospfd.conf
index 263b5867cc..88eb5a8a05 100644
--- a/tests/topotests/pim_igmp_vrf/r1/ospfd.conf
+++ b/tests/topotests/pim_igmp_vrf/r1/ospfd.conf
@@ -1,6 +1,6 @@
hostname r1
!
-debug ospf event
+! debug ospf event
!
!
interface r1-eth1
diff --git a/tests/topotests/pim_igmp_vrf/r1/pimd.conf b/tests/topotests/pim_igmp_vrf/r1/pimd.conf
index f04c255de9..040c3d01b1 100644
--- a/tests/topotests/pim_igmp_vrf/r1/pimd.conf
+++ b/tests/topotests/pim_igmp_vrf/r1/pimd.conf
@@ -1,12 +1,12 @@
hostname r1
!
-debug igmp events
-debug igmp packets
-debug pim events
-debug pim packets
-debug pim trace
-debug pim zebra
-debug pim bsm
+! debug igmp events
+! debug igmp packets
+! debug pim events
+! debug pim packets
+! debug pim trace
+! debug pim zebra
+! debug pim bsm
!
interface r1-eth0
ip igmp
diff --git a/tests/topotests/pim_igmp_vrf/r11/ospfd.conf b/tests/topotests/pim_igmp_vrf/r11/ospfd.conf
index e107220a4e..86fb66db61 100644
--- a/tests/topotests/pim_igmp_vrf/r11/ospfd.conf
+++ b/tests/topotests/pim_igmp_vrf/r11/ospfd.conf
@@ -1,6 +1,6 @@
hostname r11
!
-debug ospf event
+! debug ospf event
!
interface r11-eth0
ip ospf hello-interval 2
diff --git a/tests/topotests/pim_igmp_vrf/r11/pimd.conf b/tests/topotests/pim_igmp_vrf/r11/pimd.conf
index b1d45205da..3e409ddd31 100644
--- a/tests/topotests/pim_igmp_vrf/r11/pimd.conf
+++ b/tests/topotests/pim_igmp_vrf/r11/pimd.conf
@@ -1,10 +1,10 @@
hostname r11
!
-debug pim events
-debug pim packets
-debug pim trace
-debug pim zebra
-debug pim bsm
+! debug pim events
+! debug pim packets
+! debug pim trace
+! debug pim zebra
+! debug pim bsm
!
ip pim rp 192.168.0.11 239.100.0.0/28
ip pim join-prune-interval 5
diff --git a/tests/topotests/pim_igmp_vrf/r12/ospfd.conf b/tests/topotests/pim_igmp_vrf/r12/ospfd.conf
index 03acc82c1d..f0dcabece2 100644
--- a/tests/topotests/pim_igmp_vrf/r12/ospfd.conf
+++ b/tests/topotests/pim_igmp_vrf/r12/ospfd.conf
@@ -1,6 +1,6 @@
hostname r12
!
-debug ospf event
+! debug ospf event
!
interface r12-eth0
ip ospf hello-interval 2
diff --git a/tests/topotests/pim_igmp_vrf/r12/pimd.conf b/tests/topotests/pim_igmp_vrf/r12/pimd.conf
index 5cb76efa22..2c308f7818 100644
--- a/tests/topotests/pim_igmp_vrf/r12/pimd.conf
+++ b/tests/topotests/pim_igmp_vrf/r12/pimd.conf
@@ -1,10 +1,10 @@
hostname r12
!
-debug pim events
-debug pim packets
-debug pim trace
-debug pim zebra
-debug pim bsm
+! debug pim events
+! debug pim packets
+! debug pim trace
+! debug pim zebra
+! debug pim bsm
!
ip pim rp 192.168.0.12 239.100.0.0/28
ip pim join-prune-interval 5
diff --git a/tests/topotests/pytest.ini b/tests/topotests/pytest.ini
index 33c5635eb2..7dd13935b1 100644
--- a/tests/topotests/pytest.ini
+++ b/tests/topotests/pytest.ini
@@ -81,4 +81,3 @@ markers =
# memleak_path = /tmp/memleak_
# Output files will be named after the testname:
# /tmp/memleak_test_ospf_topo1.txt
-memleak_path = /tmp/memleak_
diff --git a/tests/topotests/rip_topo1/test_rip_topo1.py b/tests/topotests/rip_topo1/test_rip_topo1.py
index c5812f28cf..7d59e8422f 100644
--- a/tests/topotests/rip_topo1/test_rip_topo1.py
+++ b/tests/topotests/rip_topo1/test_rip_topo1.py
@@ -108,7 +108,7 @@ def setup_module(module):
tgen.gears["r%s" % i].start()
# For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
+ # tgen.mininet_cli()
def teardown_module(module):
@@ -134,9 +134,6 @@ def test_router_running():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_converge_protocols():
global fatal_error
@@ -159,9 +156,6 @@ def test_converge_protocols():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_rip_status():
global fatal_error
@@ -220,9 +214,6 @@ def test_rip_status():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_rip_routes():
global fatal_error
@@ -275,9 +266,6 @@ def test_rip_routes():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_zebra_ipv4_routingTable():
global fatal_error
@@ -341,9 +329,6 @@ def test_zebra_ipv4_routingTable():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_shutdown_check_stderr():
global fatal_error
diff --git a/tests/topotests/ripng_topo1/r1/ripng_status.ref b/tests/topotests/ripng_topo1/r1/ripng_status.ref
index b02cc69d0e..d92ae054cf 100644
--- a/tests/topotests/ripng_topo1/r1/ripng_status.ref
+++ b/tests/topotests/ripng_topo1/r1/ripng_status.ref
@@ -1,5 +1,5 @@
Routing Protocol is "RIPng"
- Sending updates every 5 seconds with +/-50%, next due in XX seconds
+ Sending updates every 1 seconds with +/-50%, next due in XX seconds
Timeout after 180 seconds, garbage collect after 5 seconds
Outgoing update filter list for all interface is not set
Incoming update filter list for all interface is not set
diff --git a/tests/topotests/ripng_topo1/r1/ripngd.conf b/tests/topotests/ripng_topo1/r1/ripngd.conf
index 07ed7296d9..f96297b927 100644
--- a/tests/topotests/ripng_topo1/r1/ripngd.conf
+++ b/tests/topotests/ripng_topo1/r1/ripngd.conf
@@ -1,11 +1,11 @@
log file ripngd.log
!
-debug ripng events
-debug ripng packet
-debug ripng zebra
+! debug ripng events
+! debug ripng packet
+! debug ripng zebra
!
router ripng
- timers basic 5 180 5
+ timers basic 1 180 5
network fc00:5::/64
network r1-eth2
network r1-eth3
diff --git a/tests/topotests/ripng_topo1/r2/ripng_status.ref b/tests/topotests/ripng_topo1/r2/ripng_status.ref
index 640df9a4a0..de14b12ca4 100644
--- a/tests/topotests/ripng_topo1/r2/ripng_status.ref
+++ b/tests/topotests/ripng_topo1/r2/ripng_status.ref
@@ -1,5 +1,5 @@
Routing Protocol is "RIPng"
- Sending updates every 5 seconds with +/-50%, next due in XX seconds
+ Sending updates every 1 seconds with +/-50%, next due in XX seconds
Timeout after 180 seconds, garbage collect after 5 seconds
Outgoing update filter list for all interface is not set
Incoming update filter list for all interface is not set
diff --git a/tests/topotests/ripng_topo1/r2/ripngd.conf b/tests/topotests/ripng_topo1/r2/ripngd.conf
index ef2c42195d..7a6450eab5 100644
--- a/tests/topotests/ripng_topo1/r2/ripngd.conf
+++ b/tests/topotests/ripng_topo1/r2/ripngd.conf
@@ -1,11 +1,11 @@
log file ripngd.log
!
-debug ripng events
-debug ripng packet
-debug ripng zebra
+! debug ripng events
+! debug ripng packet
+! debug ripng zebra
!
router ripng
- timers basic 5 180 5
+ timers basic 1 180 5
network fc00:5::/64
network fc00:6::/62
!
diff --git a/tests/topotests/ripng_topo1/r3/ripng_status.ref b/tests/topotests/ripng_topo1/r3/ripng_status.ref
index f4bfff0c59..bef2361fcd 100644
--- a/tests/topotests/ripng_topo1/r3/ripng_status.ref
+++ b/tests/topotests/ripng_topo1/r3/ripng_status.ref
@@ -1,5 +1,5 @@
Routing Protocol is "RIPng"
- Sending updates every 5 seconds with +/-50%, next due in XX seconds
+ Sending updates every 1 seconds with +/-50%, next due in XX seconds
Timeout after 180 seconds, garbage collect after 5 seconds
Outgoing update filter list for all interface is not set
Incoming update filter list for all interface is not set
diff --git a/tests/topotests/ripng_topo1/r3/ripngd.conf b/tests/topotests/ripng_topo1/r3/ripngd.conf
index 506eaac442..7a07080f7a 100644
--- a/tests/topotests/ripng_topo1/r3/ripngd.conf
+++ b/tests/topotests/ripng_topo1/r3/ripngd.conf
@@ -1,11 +1,11 @@
log file ripngd.log
!
-debug ripng events
-debug ripng packet
-debug ripng zebra
+! debug ripng events
+! debug ripng packet
+! debug ripng zebra
!
router ripng
- timers basic 5 180 5
+ timers basic 1 180 5
network fc00:6::/62
redistribute connected
redistribute static
diff --git a/tests/topotests/ripng_topo1/test_ripng_topo1.py b/tests/topotests/ripng_topo1/test_ripng_topo1.py
index df81ac08c4..563c4f7497 100644
--- a/tests/topotests/ripng_topo1/test_ripng_topo1.py
+++ b/tests/topotests/ripng_topo1/test_ripng_topo1.py
@@ -104,7 +104,7 @@ def setup_module(module):
tgen.gears["r%s" % i].start()
# For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
+ # tgen.mininet_cli()
def teardown_module(module):
@@ -130,9 +130,6 @@ def test_router_running():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_converge_protocols():
global fatal_error
@@ -155,9 +152,6 @@ def test_converge_protocols():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_ripng_status():
global fatal_error
@@ -223,9 +217,6 @@ def test_ripng_status():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_ripng_routes():
global fatal_error
@@ -290,9 +281,6 @@ def test_ripng_routes():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_zebra_ipv6_routingTable():
global fatal_error
@@ -358,9 +346,6 @@ def test_zebra_ipv6_routingTable():
fatal_error = net["r%s" % i].checkRouterRunning()
assert fatal_error == "", fatal_error
- # For debugging after starting FRR daemons, uncomment the next line
- # CLI(net)
-
def test_shutdown_check_stderr():
global fatal_error
diff --git a/tests/topotests/simple_snmp_test/r1/isisd.conf b/tests/topotests/simple_snmp_test/r1/isisd.conf
index b5ca993da3..1a148f0628 100644
--- a/tests/topotests/simple_snmp_test/r1/isisd.conf
+++ b/tests/topotests/simple_snmp_test/r1/isisd.conf
@@ -1,7 +1,7 @@
log stdout debugging
!
-debug isis route-events
-debug isis events
+! debug isis route-events
+! debug isis events
!
interface r1-eth0
ip router isis ISIS1
diff --git a/tests/topotests/srv6_locator/r1/zebra.conf b/tests/topotests/srv6_locator/r1/zebra.conf
index d0c0232073..85001d710e 100644
--- a/tests/topotests/srv6_locator/r1/zebra.conf
+++ b/tests/topotests/srv6_locator/r1/zebra.conf
@@ -1,7 +1,7 @@
hostname r1
!
-debug zebra events
-debug zebra rib detailed
+! debug zebra events
+! debug zebra rib detailed
!
log stdout notifications
log monitor notifications
diff --git a/tests/topotests/zebra_seg6_route/r1/routes.json b/tests/topotests/zebra_seg6_route/r1/routes.json
index a0c15b8fe4..50ac4f7174 100644
--- a/tests/topotests/zebra_seg6_route/r1/routes.json
+++ b/tests/topotests/zebra_seg6_route/r1/routes.json
@@ -2,7 +2,7 @@
{
"in": {
"dest": "1::1",
- "nh": "2001::1",
+ "nh": "2001::2",
"sid": "a::"
},
"out":[{
diff --git a/tests/topotests/zebra_seg6_route/r1/zebra.conf b/tests/topotests/zebra_seg6_route/r1/zebra.conf
index ad661e116b..e5e360ffa5 100644
--- a/tests/topotests/zebra_seg6_route/r1/zebra.conf
+++ b/tests/topotests/zebra_seg6_route/r1/zebra.conf
@@ -4,9 +4,9 @@ log stdout notifications
log monitor notifications
log commands
!
-debug zebra packet
-debug zebra dplane
-debug zebra kernel msgdump
+! debug zebra packet
+! debug zebra dplane
+! debug zebra kernel msgdump
!
interface dum0
ipv6 address 2001::1/64
diff --git a/tests/topotests/zebra_seg6_route/test_zebra_seg6_route.py b/tests/topotests/zebra_seg6_route/test_zebra_seg6_route.py
index cdad988b81..399af748a1 100755
--- a/tests/topotests/zebra_seg6_route/test_zebra_seg6_route.py
+++ b/tests/topotests/zebra_seg6_route/test_zebra_seg6_route.py
@@ -79,11 +79,7 @@ def test_zebra_seg6local_routes():
logger.info("Test for seg6local route install via ZAPI was start.")
r1 = tgen.gears["r1"]
- def check(router, dest, nh, sid, expected):
- router.vtysh_cmd(
- "sharp install seg6-routes {} "
- "nexthop-seg6 {} encap {} 1".format(dest, nh, sid)
- )
+ def check(router, dest, expected):
output = json.loads(router.vtysh_cmd("show ipv6 route {} json".format(dest)))
output = output.get("{}/128".format(dest))
if output is None:
@@ -92,19 +88,17 @@ def test_zebra_seg6local_routes():
manifests = open_json_file(os.path.join(CWD, "{}/routes.json".format("r1")))
for manifest in manifests:
- logger.info(
- "CHECK {} {} {}".format(
- manifest["in"]["dest"], manifest["in"]["nh"], manifest["in"]["sid"]
+ dest = manifest["in"]["dest"]
+ nh = manifest["in"]["nh"]
+ sid = manifest["in"]["sid"]
+
+ r1.vtysh_cmd(
+ "sharp install seg6-routes {} nexthop-seg6 {} encap {} 1".format(
+ dest, nh, sid
)
)
- test_func = partial(
- check,
- r1,
- manifest["in"]["dest"],
- manifest["in"]["nh"],
- manifest["in"]["sid"],
- manifest["out"],
- )
+ logger.info("CHECK {} {} {}".format(dest, nh, sid))
+ test_func = partial(check, r1, dest, manifest["out"])
success, result = topotest.run_and_expect(test_func, None, count=5, wait=1)
assert result is None, "Failed"
diff --git a/tests/topotests/zebra_seg6local_route/r1/zebra.conf b/tests/topotests/zebra_seg6local_route/r1/zebra.conf
index 22eb88098b..dee7a9171a 100644
--- a/tests/topotests/zebra_seg6local_route/r1/zebra.conf
+++ b/tests/topotests/zebra_seg6local_route/r1/zebra.conf
@@ -4,6 +4,6 @@ log stdout notifications
log monitor notifications
log commands
!
-debug zebra packet
-debug zebra dplane
-debug zebra kernel msgdump
+! debug zebra packet
+! debug zebra dplane
+! debug zebra kernel msgdump
diff --git a/tests/topotests/zebra_seg6local_route/test_zebra_seg6local_route.py b/tests/topotests/zebra_seg6local_route/test_zebra_seg6local_route.py
index 1062c306a0..0da51cc8b2 100755
--- a/tests/topotests/zebra_seg6local_route/test_zebra_seg6local_route.py
+++ b/tests/topotests/zebra_seg6local_route/test_zebra_seg6local_route.py
@@ -79,11 +79,7 @@ def test_zebra_seg6local_routes():
logger.info("Test for seg6local route install via ZAPI was start.")
r1 = tgen.gears["r1"]
- def check(router, dest, context, expected):
- router.vtysh_cmd(
- "sharp install seg6local-routes {} "
- "nexthop-seg6local dum0 {} 1".format(dest, context)
- )
+ def check(router, dest, expected):
output = json.loads(router.vtysh_cmd("show ipv6 route {} json".format(dest)))
output = output.get("{}/128".format(dest))
if output is None:
@@ -92,14 +88,20 @@ def test_zebra_seg6local_routes():
manifests = open_json_file(os.path.join(CWD, "{}/routes.json".format("r1")))
for manifest in manifests:
- logger.info(
- "CHECK {} {}".format(manifest["in"]["dest"], manifest["in"]["context"])
+ dest = manifest["in"]["dest"]
+ context = manifest["in"]["context"]
+
+ logger.info("CHECK {} {}".format(dest, context))
+
+ r1.vtysh_cmd(
+ "sharp install seg6local-routes {} nexthop-seg6local dum0 {} 1".format(
+ dest, context
+ )
)
test_func = partial(
check,
r1,
- manifest["in"]["dest"],
- manifest["in"]["context"],
+ dest,
manifest["out"],
)
success, result = topotest.run_and_expect(test_func, None, count=5, wait=1)
diff --git a/tests/zebra/subdir.am b/tests/zebra/subdir.am
new file mode 100644
index 0000000000..d9fcde80a9
--- /dev/null
+++ b/tests/zebra/subdir.am
@@ -0,0 +1,17 @@
+if !ZEBRA
+PYTEST_IGNORE += --ignore=zebra/
+endif
+ZEBRA_TEST_LDADD = zebra/label_manager.o $(ALL_TESTS_LDADD)
+
+
+if ZEBRA
+check_PROGRAMS += tests/zebra/test_lm_plugin
+endif
+tests_zebra_test_lm_plugin_CFLAGS = $(TESTS_CFLAGS)
+tests_zebra_test_lm_plugin_CPPFLAGS = $(TESTS_CPPFLAGS)
+tests_zebra_test_lm_plugin_LDADD = $(ZEBRA_TEST_LDADD)
+tests_zebra_test_lm_plugin_SOURCES = tests/zebra/test_lm_plugin.c
+EXTRA_DIST += \
+ tests/zebra/test_lm_plugin.py \
+ tests/zebra/test_lm_plugin.refout \
+ # end