diff options
Diffstat (limited to 'tests')
25 files changed, 186 insertions, 51 deletions
diff --git a/tests/topotests/babel_topo1/r3/babeld.conf b/tests/topotests/babel_topo1/r3/babeld.conf index bfda3622dd..e10e5aaacc 100644 --- a/tests/topotests/babel_topo1/r3/babeld.conf +++ b/tests/topotests/babel_topo1/r3/babeld.conf @@ -14,4 +14,3 @@ router babel network r3-eth1 redistribute ipv4 connected redistribute ipv4 static - redistirbute ipv6 connected diff --git a/tests/topotests/bfd_ospf_topo1/rt1/ospfd.conf b/tests/topotests/bfd_ospf_topo1/rt1/ospfd.conf index ce36494604..72238ccd40 100644 --- a/tests/topotests/bfd_ospf_topo1/rt1/ospfd.conf +++ b/tests/topotests/bfd_ospf_topo1/rt1/ospfd.conf @@ -27,6 +27,5 @@ interface eth-rt3 ! router ospf ospf router-id 1.1.1.1 - passive interface lo router-info area 0.0.0.0 ! diff --git a/tests/topotests/bfd_ospf_topo1/rt2/ospfd.conf b/tests/topotests/bfd_ospf_topo1/rt2/ospfd.conf index a8ca564e4e..c5f4262a8f 100644 --- a/tests/topotests/bfd_ospf_topo1/rt2/ospfd.conf +++ b/tests/topotests/bfd_ospf_topo1/rt2/ospfd.conf @@ -25,6 +25,5 @@ interface eth-rt5 ! router ospf ospf router-id 2.2.2.2 - passive interface lo router-info area 0.0.0.0 ! diff --git a/tests/topotests/bfd_ospf_topo1/rt3/ospfd.conf b/tests/topotests/bfd_ospf_topo1/rt3/ospfd.conf index 0404994c09..e487bdd7c0 100644 --- a/tests/topotests/bfd_ospf_topo1/rt3/ospfd.conf +++ b/tests/topotests/bfd_ospf_topo1/rt3/ospfd.conf @@ -25,6 +25,5 @@ interface eth-rt4 ! router ospf ospf router-id 3.3.3.3 - passive interface lo router-info area 0.0.0.0 ! diff --git a/tests/topotests/bfd_ospf_topo1/rt4/ospfd.conf b/tests/topotests/bfd_ospf_topo1/rt4/ospfd.conf index 6b8ab3704f..560904e75d 100644 --- a/tests/topotests/bfd_ospf_topo1/rt4/ospfd.conf +++ b/tests/topotests/bfd_ospf_topo1/rt4/ospfd.conf @@ -24,6 +24,5 @@ interface eth-rt5 ! router ospf ospf router-id 4.4.4.4 - passive interface lo router-info area 0.0.0.0 ! diff --git a/tests/topotests/bfd_ospf_topo1/rt5/ospfd.conf b/tests/topotests/bfd_ospf_topo1/rt5/ospfd.conf index 043432ec3d..77f5445286 100644 --- a/tests/topotests/bfd_ospf_topo1/rt5/ospfd.conf +++ b/tests/topotests/bfd_ospf_topo1/rt5/ospfd.conf @@ -24,6 +24,5 @@ interface eth-rt4 ! router ospf ospf router-id 5.5.5.5 - passive interface lo router-info area 0.0.0.0 ! diff --git a/tests/topotests/bgp_addpath_best_selected/r5/bgpd.conf b/tests/topotests/bgp_addpath_best_selected/r5/bgpd.conf index 0396cc07b4..f36e2bddd7 100644 --- a/tests/topotests/bgp_addpath_best_selected/r5/bgpd.conf +++ b/tests/topotests/bgp_addpath_best_selected/r5/bgpd.conf @@ -1,5 +1,5 @@ router bgp 65005 - timers 3 10 + timers bgp 3 10 no bgp ebgp-requires-policy neighbor 192.168.2.2 remote-as external neighbor 192.168.2.2 timers connect 5 diff --git a/tests/topotests/bgp_addpath_best_selected/r6/bgpd.conf b/tests/topotests/bgp_addpath_best_selected/r6/bgpd.conf index d9e77b66d6..0d83ef868a 100644 --- a/tests/topotests/bgp_addpath_best_selected/r6/bgpd.conf +++ b/tests/topotests/bgp_addpath_best_selected/r6/bgpd.conf @@ -1,5 +1,5 @@ router bgp 65006 - timers 3 10 + timers bgp 3 10 no bgp ebgp-requires-policy neighbor 192.168.2.2 remote-as external neighbor 192.168.2.2 timers connect 5 diff --git a/tests/topotests/bgp_dynamic_capability/__init__.py b/tests/topotests/bgp_dynamic_capability/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/topotests/bgp_dynamic_capability/__init__.py diff --git a/tests/topotests/bgp_dynamic_capability/r1/bgpd.conf b/tests/topotests/bgp_dynamic_capability/r1/bgpd.conf new file mode 100644 index 0000000000..113936df4c --- /dev/null +++ b/tests/topotests/bgp_dynamic_capability/r1/bgpd.conf @@ -0,0 +1,10 @@ +! +!debug bgp neighbor +! +router bgp 65001 + no bgp ebgp-requires-policy + neighbor 192.168.1.2 remote-as external + neighbor 192.168.1.2 timers 1 3 + neighbor 192.168.1.2 timers connect 1 + neighbor 192.168.1.2 capability dynamic +! diff --git a/tests/topotests/bgp_dynamic_capability/r1/zebra.conf b/tests/topotests/bgp_dynamic_capability/r1/zebra.conf new file mode 100644 index 0000000000..b29940f46a --- /dev/null +++ b/tests/topotests/bgp_dynamic_capability/r1/zebra.conf @@ -0,0 +1,4 @@ +! +int r1-eth0 + ip address 192.168.1.1/24 +! diff --git a/tests/topotests/bgp_dynamic_capability/r2/bgpd.conf b/tests/topotests/bgp_dynamic_capability/r2/bgpd.conf new file mode 100644 index 0000000000..587b241a90 --- /dev/null +++ b/tests/topotests/bgp_dynamic_capability/r2/bgpd.conf @@ -0,0 +1,10 @@ +! +!debug bgp neighbor +! +router bgp 65002 + no bgp ebgp-requires-policy + neighbor 192.168.1.1 remote-as external + neighbor 192.168.1.1 timers 1 3 + neighbor 192.168.1.1 timers connect 1 + neighbor 192.168.1.1 capability dynamic +! diff --git a/tests/topotests/bgp_dynamic_capability/r2/zebra.conf b/tests/topotests/bgp_dynamic_capability/r2/zebra.conf new file mode 100644 index 0000000000..cffe827363 --- /dev/null +++ b/tests/topotests/bgp_dynamic_capability/r2/zebra.conf @@ -0,0 +1,4 @@ +! +int r2-eth0 + ip address 192.168.1.2/24 +! diff --git a/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_software_version.py b/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_software_version.py new file mode 100644 index 0000000000..a375993af4 --- /dev/null +++ b/tests/topotests/bgp_dynamic_capability/test_bgp_dynamic_capability_software_version.py @@ -0,0 +1,153 @@ +#!/usr/bin/env python +# SPDX-License-Identifier: ISC + +# Copyright (c) 2023 by +# Donatas Abraitis <donatas@opensourcerouting.org> +# + +""" +Test if software version capability is exchanged dynamically. +""" + +import os +import re +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 step + +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_dynamic_capability(): + tgen = get_topogen() + + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + r1 = tgen.gears["r1"] + r2 = tgen.gears["r2"] + + def _bgp_converge(): + output = json.loads(r1.vtysh_cmd("show bgp neighbor json")) + expected = { + "192.168.1.2": { + "bgpState": "Established", + "neighborCapabilities": { + "dynamic": "advertisedAndReceived", + "softwareVersion": { + "advertisedSoftwareVersion": None, + "receivedSoftwareVersion": None, + }, + }, + "connectionsEstablished": 1, + "connectionsDropped": 0, + } + } + return topotest.json_cmp(output, expected) + + test_func = functools.partial( + _bgp_converge, + ) + _, result = topotest.run_and_expect(test_func, None, count=30, wait=1) + assert result is None, "Can't converge" + + step("Enable software version capability and check if it's exchanged dynamically") + + r1.vtysh_cmd( + """ + configure terminal + router bgp + neighbor 192.168.1.2 capability software-version + """ + ) + + r2.vtysh_cmd( + """ + configure terminal + router bgp + neighbor 192.168.1.1 capability software-version + """ + ) + + def _bgp_check_if_session_not_reset(): + def _bgp_software_version(): + try: + versions = output["192.168.1.2"]["neighborCapabilities"][ + "softwareVersion" + ] + adv = versions["advertisedSoftwareVersion"] + rcv = versions["receivedSoftwareVersion"] + + if not adv and not rcv: + return "" + + pattern = "FRRouting/\\d.+" + if re.search(pattern, adv) and re.search(pattern, rcv): + return adv, rcv + except: + return "" + + output = json.loads(r1.vtysh_cmd("show bgp neighbor json")) + adv, rcv = _bgp_software_version() + expected = { + "192.168.1.2": { + "bgpState": "Established", + "neighborCapabilities": { + "dynamic": "advertisedAndReceived", + "softwareVersion": { + "advertisedSoftwareVersion": adv, + "receivedSoftwareVersion": rcv, + }, + }, + "connectionsEstablished": 1, + "connectionsDropped": 0, + } + } + return topotest.json_cmp(output, expected) + + test_func = functools.partial( + _bgp_check_if_session_not_reset, + ) + _, result = topotest.run_and_expect(test_func, None, count=30, wait=1) + assert ( + result is None + ), "Session was reset after enabling software version capability" + + +if __name__ == "__main__": + args = ["-s"] + sys.argv[1:] + sys.exit(pytest.main(args)) diff --git a/tests/topotests/bgp_evpn_vxlan_macvrf_soo_topo1/PE1/bgpd.conf b/tests/topotests/bgp_evpn_vxlan_macvrf_soo_topo1/PE1/bgpd.conf index f839443025..e4d20b9a50 100644 --- a/tests/topotests/bgp_evpn_vxlan_macvrf_soo_topo1/PE1/bgpd.conf +++ b/tests/topotests/bgp_evpn_vxlan_macvrf_soo_topo1/PE1/bgpd.conf @@ -1,5 +1,5 @@ router bgp 65000 - timers 3 9 + timers bgp 3 9 bgp router-id 10.10.10.10 no bgp default ipv4-unicast neighbor 10.30.30.30 remote-as 65000 diff --git a/tests/topotests/bgp_evpn_vxlan_svd_topo1/PE1/bgpd.conf b/tests/topotests/bgp_evpn_vxlan_svd_topo1/PE1/bgpd.conf index 39ac8ca69c..9fb2bd6835 100644 --- a/tests/topotests/bgp_evpn_vxlan_svd_topo1/PE1/bgpd.conf +++ b/tests/topotests/bgp_evpn_vxlan_svd_topo1/PE1/bgpd.conf @@ -1,5 +1,5 @@ router bgp 65000 - timers 3 9 + timers bgp 3 9 bgp router-id 10.10.10.10 no bgp default ipv4-unicast neighbor 10.30.30.30 remote-as 65000 diff --git a/tests/topotests/bgp_evpn_vxlan_topo1/PE1/bgpd.conf b/tests/topotests/bgp_evpn_vxlan_topo1/PE1/bgpd.conf index 991a1e7e56..dbbfc82db9 100644 --- a/tests/topotests/bgp_evpn_vxlan_topo1/PE1/bgpd.conf +++ b/tests/topotests/bgp_evpn_vxlan_topo1/PE1/bgpd.conf @@ -1,5 +1,5 @@ router bgp 65000 - timers 3 9 + timers bgp 3 9 bgp router-id 10.10.10.10 no bgp default ipv4-unicast neighbor 10.30.30.30 remote-as 65000 diff --git a/tests/topotests/bgp_update_delay/r2/zebra.conf b/tests/topotests/bgp_update_delay/r2/zebra.conf index 420f00d974..1fcedaaf72 100644 --- a/tests/topotests/bgp_update_delay/r2/zebra.conf +++ b/tests/topotests/bgp_update_delay/r2/zebra.conf @@ -12,9 +12,5 @@ interface r2-eth3 ip address 192.168.252.1/30 vrf vrf1 ! -auto vrf1 -iface vrf1 - vrf-table auto -! ip forwarding ! diff --git a/tests/topotests/bgp_vpnv4_noretain/r1/isisd.conf b/tests/topotests/bgp_vpnv4_noretain/r1/isisd.conf deleted file mode 100644 index 233a6473b3..0000000000 --- a/tests/topotests/bgp_vpnv4_noretain/r1/isisd.conf +++ /dev/null @@ -1,14 +0,0 @@ -interface r1-eth0 - ip router isis 1 - isis circuit-type level-1 -! -interface lo - ip router isis 1 - isis passive -! -router isis 1 - is-type level-1 - net 49.0002.0000.1994.00 - segment-routing on - segment-routing prefix 192.0.2.1/32 index 11 -! diff --git a/tests/topotests/bgp_vpnv4_noretain/r2/isisd.conf b/tests/topotests/bgp_vpnv4_noretain/r2/isisd.conf deleted file mode 100644 index 547d10f2bc..0000000000 --- a/tests/topotests/bgp_vpnv4_noretain/r2/isisd.conf +++ /dev/null @@ -1,14 +0,0 @@ -interface r2-eth0 - ip router isis 1 - isis circuit-type level-1 -! -interface lo - ip router isis 1 - isis passive -! -router isis 1 - is-type level-1 - net 49.0002.0000.1995.00 - segment-routing on - segment-routing prefix 192.0.2.2/32 index 22 -! diff --git a/tests/topotests/bgp_vpnv4_noretain/test_bgp_vpnv4_noretain.py b/tests/topotests/bgp_vpnv4_noretain/test_bgp_vpnv4_noretain.py index f665040f7f..f2865fec9e 100644 --- a/tests/topotests/bgp_vpnv4_noretain/test_bgp_vpnv4_noretain.py +++ b/tests/topotests/bgp_vpnv4_noretain/test_bgp_vpnv4_noretain.py @@ -120,9 +120,6 @@ def setup_module(mod): router.load_config( TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname)) ) - router.load_config( - TopoRouter.RD_ISIS, os.path.join(CWD, "{}/bgpd.conf".format(rname)) - ) # Initialize all routers. tgen.start_router() diff --git a/tests/topotests/config_timing/r1/zebra.conf b/tests/topotests/config_timing/r1/zebra.conf index 46fd965034..b4dc338b8d 100644 --- a/tests/topotests/config_timing/r1/zebra.conf +++ b/tests/topotests/config_timing/r1/zebra.conf @@ -4,10 +4,8 @@ ip prefix-list ANY permit 0.0.0.0/0 le 32 ipv6 prefix-list ANY seq 10 permit any route-map RM-NONE4 deny 10 -exit-route-map route-map RM-NONE6 deny 10 -exit-route-map interface r1-eth0 ip address 100.0.0.1/24 diff --git a/tests/topotests/cspf_topo1/r1/sharpd.conf b/tests/topotests/cspf_topo1/r1/sharpd.conf index 272eac944e..465034f150 100644 --- a/tests/topotests/cspf_topo1/r1/sharpd.conf +++ b/tests/topotests/cspf_topo1/r1/sharpd.conf @@ -1,3 +1,2 @@ ! -import-te ! diff --git a/tests/topotests/isis_snmp/r1/ldpd.conf b/tests/topotests/isis_snmp/r1/ldpd.conf index 5b1cbfebc9..64f51fce27 100644 --- a/tests/topotests/isis_snmp/r1/ldpd.conf +++ b/tests/topotests/isis_snmp/r1/ldpd.conf @@ -5,7 +5,6 @@ log file ldpd.log ! debug mpls ldp event ! debug mpls ldp errors ! debug mpls ldp sync -agentx ! mpls ldp router-id 1.1.1.1 diff --git a/tests/topotests/ospf6_gr_topo1/rt1/ospf6d.conf b/tests/topotests/ospf6_gr_topo1/rt1/ospf6d.conf index 8a9b4eb124..aa9438b78e 100644 --- a/tests/topotests/ospf6_gr_topo1/rt1/ospf6d.conf +++ b/tests/topotests/ospf6_gr_topo1/rt1/ospf6d.conf @@ -1,4 +1,3 @@ -:assword 1 hostname rt1 log file ospf6d.log log commands |
