summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli/test_protocols_bgp.py
diff options
context:
space:
mode:
Diffstat (limited to 'smoketest/scripts/cli/test_protocols_bgp.py')
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_bgp.py95
1 files changed, 72 insertions, 23 deletions
diff --git a/smoketest/scripts/cli/test_protocols_bgp.py b/smoketest/scripts/cli/test_protocols_bgp.py
index bce74a7b2..8ed0f7228 100755
--- a/smoketest/scripts/cli/test_protocols_bgp.py
+++ b/smoketest/scripts/cli/test_protocols_bgp.py
@@ -547,7 +547,76 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase):
self.assertIn(f' advertise-default-gw', vniconfig)
self.assertIn(f' advertise-svi-ip', vniconfig)
- def test_bgp_08_vrf_simple(self):
+ def test_bgp_08_zebra_route_map(self):
+ # Implemented because of T3328
+ self.cli_set(base_path + ['route-map', route_map_in])
+ # commit changes
+ self.cli_commit()
+
+ # Verify FRR configuration
+ zebra_route_map = f'ip protocol bgp route-map {route_map_in}'
+ frrconfig = self.getFRRconfig(zebra_route_map)
+ self.assertIn(zebra_route_map, frrconfig)
+
+ # Remove the route-map again
+ self.cli_delete(base_path + ['route-map'])
+ # commit changes
+ self.cli_commit()
+
+ # Verify FRR configuration
+ frrconfig = self.getFRRconfig(zebra_route_map)
+ self.assertNotIn(zebra_route_map, frrconfig)
+
+ def test_bgp_09_distance_and_flowspec(self):
+ distance_external = '25'
+ distance_internal = '30'
+ distance_local = '35'
+ distance_v4_prefix = '169.254.0.0/32'
+ distance_v6_prefix = '2001::/128'
+ distance_prefix_value = '110'
+ distance_families = ['ipv4-unicast', 'ipv6-unicast','ipv4-multicast', 'ipv6-multicast']
+ verify_families = ['ipv4 unicast', 'ipv6 unicast','ipv4 multicast', 'ipv6 multicast']
+ flowspec_families = ['address-family ipv4 flowspec', 'address-family ipv6 flowspec']
+ flowspec_int = 'lo'
+
+ # Per family distance support
+ for family in distance_families:
+ self.cli_set(base_path + ['address-family', family, 'distance', 'external', distance_external])
+ self.cli_set(base_path + ['address-family', family, 'distance', 'internal', distance_internal])
+ self.cli_set(base_path + ['address-family', family, 'distance', 'local', distance_local])
+ if 'ipv4' in family:
+ self.cli_set(base_path + ['address-family', family, 'distance',
+ 'prefix', distance_v4_prefix, 'distance', distance_prefix_value])
+ if 'ipv6' in family:
+ self.cli_set(base_path + ['address-family', family, 'distance',
+ 'prefix', distance_v6_prefix, 'distance', distance_prefix_value])
+
+ # IPv4 flowspec interface check
+ self.cli_set(base_path + ['address-family', 'ipv4-flowspec', 'local-install', 'interface', flowspec_int])
+
+ # IPv6 flowspec interface check
+ self.cli_set(base_path + ['address-family', 'ipv6-flowspec', 'local-install', 'interface', flowspec_int])
+
+ # Commit changes
+ self.cli_commit()
+
+ # Verify FRR distances configuration
+ frrconfig = self.getFRRconfig(f'router bgp {ASN}')
+ self.assertIn(f'router bgp {ASN}', frrconfig)
+ for family in verify_families:
+ self.assertIn(f'address-family {family}', frrconfig)
+ self.assertIn(f'distance bgp {distance_external} {distance_internal} {distance_local}', frrconfig)
+ if 'ipv4' in family:
+ self.assertIn(f'distance {distance_prefix_value} {distance_v4_prefix}', frrconfig)
+ if 'ipv6' in family:
+ self.assertIn(f'distance {distance_prefix_value} {distance_v6_prefix}', frrconfig)
+
+ # Verify FRR flowspec configuration
+ for family in flowspec_families:
+ self.assertIn(f'{family}', frrconfig)
+ self.assertIn(f'local-install {flowspec_int}', frrconfig)
+
+ def test_bgp_10_vrf_simple(self):
router_id = '127.0.0.3'
vrfs = ['red', 'green', 'blue']
@@ -571,26 +640,6 @@ class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase):
self.assertIn(f'router bgp {ASN} vrf {vrf}', frrconfig)
self.assertIn(f' bgp router-id {router_id}', frrconfig)
-
- def test_bgp_09_zebra_route_map(self):
- # Implemented because of T3328
- self.cli_set(base_path + ['route-map', route_map_in])
- # commit changes
- self.cli_commit()
-
- # Verify FRR configuration
- zebra_route_map = f'ip protocol bgp route-map {route_map_in}'
- frrconfig = self.getFRRconfig(zebra_route_map)
- self.assertIn(zebra_route_map, frrconfig)
-
- # Remove the route-map again
- self.cli_delete(base_path + ['route-map'])
- # commit changes
- self.cli_commit()
-
- # Verify FRR configuration
- frrconfig = self.getFRRconfig(zebra_route_map)
- self.assertNotIn(zebra_route_map, frrconfig)
-
+
if __name__ == '__main__':
- unittest.main(verbosity=2)
+ unittest.main(verbosity=2) \ No newline at end of file