Skip to content

Commit

Permalink
T5150: do not apply zebra route-map from routing-daemon config level
Browse files Browse the repository at this point in the history
  • Loading branch information
c-po committed Apr 13, 2023
1 parent 3f4de13 commit f9aa4c6
Show file tree
Hide file tree
Showing 14 changed files with 4 additions and 99 deletions.
10 changes: 0 additions & 10 deletions data/templates/frr/vrf.route-map.frr.j2

This file was deleted.

10 changes: 0 additions & 10 deletions data/templates/frr/vrf.route-map.v6.frr.j2

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -1565,7 +1565,6 @@
#include <include/port-number.xml.i>
</children>
</tagNode>
#include <include/route-map.xml.i>
<node name="timers">
<properties>
<help>BGP protocol timers</help>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@
<multi/>
</properties>
</leafNode>
#include <include/route-map.xml.i>
#include <include/router-id.xml.i>
<!-- FRR timers not implemented yet -->
<leafNode name="variance">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -687,5 +687,4 @@
</leafNode>
</children>
</tagNode>
#include <include/route-map.xml.i>
<!-- include end -->
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,6 @@
</leafNode>
</children>
</node>
#include <include/route-map.xml.i>
<node name="timers">
<properties>
<help>Adjust routing timers</help>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,5 +256,4 @@
</node>
</children>
</node>
#include <include/route-map.xml.i>
<!-- include end -->
21 changes: 0 additions & 21 deletions smoketest/scripts/cli/test_protocols_bgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,6 @@ def test_bgp_06_listen_range(self):
for prefix in listen_ranges:
self.assertIn(f' bgp listen range {prefix} peer-group {peer_group}', frrconfig)


def test_bgp_07_l2vpn_evpn(self):
vnis = ['10010', '10020', '10030']
neighbors = ['192.0.2.10', '192.0.2.20', '192.0.2.30']
Expand Down Expand Up @@ -743,26 +742,6 @@ def test_bgp_07_l2vpn_evpn(self):
self.assertIn(f' advertise-default-gw', vniconfig)
self.assertIn(f' advertise-svi-ip', vniconfig)

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'
Expand Down
11 changes: 0 additions & 11 deletions src/conf_mode/protocols_bgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,26 +484,15 @@ def generate(bgp):
if not bgp or 'deleted' in bgp:
return None

bgp['protocol'] = 'bgp' # required for frr/vrf.route-map.frr.j2
bgp['frr_zebra_config'] = render_to_string('frr/vrf.route-map.frr.j2', bgp)
bgp['frr_bgpd_config'] = render_to_string('frr/bgpd.frr.j2', bgp)

return None

def apply(bgp):
bgp_daemon = 'bgpd'
zebra_daemon = 'zebra'

# Save original configuration prior to starting any commit actions
frr_cfg = frr.FRRConfig()

# The route-map used for the FIB (zebra) is part of the zebra daemon
frr_cfg.load_configuration(zebra_daemon)
frr_cfg.modify_section(r'(\s+)?ip protocol bgp route-map [-a-zA-Z0-9.]+', stop_pattern='(\s|!)')
if 'frr_zebra_config' in bgp:
frr_cfg.add_before(frr.default_add_before, bgp['frr_zebra_config'])
frr_cfg.commit_configuration(zebra_daemon)

# Generate empty helper string which can be ammended to FRR commands, it
# will be either empty (default VRF) or contain the "vrf <name" statement
vrf = ''
Expand Down
10 changes: 0 additions & 10 deletions src/conf_mode/protocols_eigrp.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,24 +78,14 @@ def generate(eigrp):
if not eigrp or 'deleted' in eigrp:
return None

eigrp['protocol'] = 'eigrp' # required for frr/vrf.route-map.frr.j2
eigrp['frr_zebra_config'] = render_to_string('frr/vrf.route-map.frr.j2', eigrp)
eigrp['frr_eigrpd_config'] = render_to_string('frr/eigrpd.frr.j2', eigrp)

def apply(eigrp):
eigrp_daemon = 'eigrpd'
zebra_daemon = 'zebra'

# Save original configuration prior to starting any commit actions
frr_cfg = frr.FRRConfig()

# The route-map used for the FIB (zebra) is part of the zebra daemon
frr_cfg.load_configuration(zebra_daemon)
frr_cfg.modify_section(r'(\s+)?ip protocol eigrp route-map [-a-zA-Z0-9.]+', stop_pattern='(\s|!)')
if 'frr_zebra_config' in eigrp:
frr_cfg.add_before(frr.default_add_before, eigrp['frr_zebra_config'])
frr_cfg.commit_configuration(zebra_daemon)

# Generate empty helper string which can be ammended to FRR commands, it
# will be either empty (default VRF) or contain the "vrf <name" statement
vrf = ''
Expand Down
14 changes: 2 additions & 12 deletions src/conf_mode/protocols_isis.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def verify(isis):
if list(set(global_range) & set(local_range)):
raise ConfigError(f'Segment-Routing Global Block ({g_low_label_value}/{g_high_label_value}) '\
f'conflicts with Local Block ({l_low_label_value}/{l_high_label_value})!')

# Check for a blank or invalid value per prefix
if dict_search('segment_routing.prefix', isis):
for prefix, prefix_config in isis['segment_routing']['prefix'].items():
Expand All @@ -218,7 +218,7 @@ def verify(isis):
if dict_search('segment_routing.prefix', isis):
for prefix, prefix_config in isis['segment_routing']['prefix'].items():
if 'absolute' in prefix_config:
if ("explicit_null" in prefix_config['absolute']) and ("no_php_flag" in prefix_config['absolute']):
if ("explicit_null" in prefix_config['absolute']) and ("no_php_flag" in prefix_config['absolute']):
raise ConfigError(f'Segment routing prefix {prefix} cannot have both explicit-null '\
f'and no-php-flag configured at the same time.')
elif 'index' in prefix_config:
Expand All @@ -232,25 +232,15 @@ def generate(isis):
if not isis or 'deleted' in isis:
return None

isis['protocol'] = 'isis' # required for frr/vrf.route-map.frr.j2
isis['frr_zebra_config'] = render_to_string('frr/vrf.route-map.frr.j2', isis)
isis['frr_isisd_config'] = render_to_string('frr/isisd.frr.j2', isis)
return None

def apply(isis):
isis_daemon = 'isisd'
zebra_daemon = 'zebra'

# Save original configuration prior to starting any commit actions
frr_cfg = frr.FRRConfig()

# The route-map used for the FIB (zebra) is part of the zebra daemon
frr_cfg.load_configuration(zebra_daemon)
frr_cfg.modify_section('(\s+)?ip protocol isis route-map [-a-zA-Z0-9.]+', stop_pattern='(\s|!)')
if 'frr_zebra_config' in isis:
frr_cfg.add_before(frr.default_add_before, isis['frr_zebra_config'])
frr_cfg.commit_configuration(zebra_daemon)

# Generate empty helper string which can be ammended to FRR commands, it
# will be either empty (default VRF) or contain the "vrf <name" statement
vrf = ''
Expand Down
11 changes: 1 addition & 10 deletions src/conf_mode/protocols_ospf.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,25 +256,15 @@ def generate(ospf):
if not ospf or 'deleted' in ospf:
return None

ospf['protocol'] = 'ospf' # required for frr/vrf.route-map.frr.j2
ospf['frr_zebra_config'] = render_to_string('frr/vrf.route-map.frr.j2', ospf)
ospf['frr_ospfd_config'] = render_to_string('frr/ospfd.frr.j2', ospf)
return None

def apply(ospf):
ospf_daemon = 'ospfd'
zebra_daemon = 'zebra'

# Save original configuration prior to starting any commit actions
frr_cfg = frr.FRRConfig()

# The route-map used for the FIB (zebra) is part of the zebra daemon
frr_cfg.load_configuration(zebra_daemon)
frr_cfg.modify_section('(\s+)?ip protocol ospf route-map [-a-zA-Z0-9.]+', stop_pattern='(\s|!)')
if 'frr_zebra_config' in ospf:
frr_cfg.add_before(frr.default_add_before, ospf['frr_zebra_config'])
frr_cfg.commit_configuration(zebra_daemon)

# Generate empty helper string which can be ammended to FRR commands, it
# will be either empty (default VRF) or contain the "vrf <name" statement
vrf = ''
Expand All @@ -292,6 +282,7 @@ def apply(ospf):

if 'frr_ospfd_config' in ospf:
frr_cfg.add_before(frr.default_add_before, ospf['frr_ospfd_config'])

frr_cfg.commit_configuration(ospf_daemon)

return None
Expand Down
10 changes: 0 additions & 10 deletions src/conf_mode/protocols_ospfv3.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,25 +146,15 @@ def generate(ospfv3):
if not ospfv3 or 'deleted' in ospfv3:
return None

ospfv3['protocol'] = 'ospf6' # required for frr/vrf.route-map.v6.frr.j2
ospfv3['frr_zebra_config'] = render_to_string('frr/vrf.route-map.v6.frr.j2', ospfv3)
ospfv3['new_frr_config'] = render_to_string('frr/ospf6d.frr.j2', ospfv3)
return None

def apply(ospfv3):
ospf6_daemon = 'ospf6d'
zebra_daemon = 'zebra'

# Save original configuration prior to starting any commit actions
frr_cfg = frr.FRRConfig()

# The route-map used for the FIB (zebra) is part of the zebra daemon
frr_cfg.load_configuration(zebra_daemon)
frr_cfg.modify_section('(\s+)?ipv6 protocol ospf6 route-map [-a-zA-Z0-9.]+', stop_pattern='(\s|!)')
if 'frr_zebra_config' in ospfv3:
frr_cfg.add_before(frr.default_add_before, ospfv3['frr_zebra_config'])
frr_cfg.commit_configuration(zebra_daemon)

# Generate empty helper string which can be ammended to FRR commands, it
# will be either empty (default VRF) or contain the "vrf <name" statement
vrf = ''
Expand Down
1 change: 1 addition & 0 deletions src/conf_mode/protocols_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def apply(static):

# Save original configuration prior to starting any commit actions
frr_cfg = frr.FRRConfig()
frr_cfg.load_configuration(static_daemon)

if 'vrf' in static:
vrf = static['vrf']
Expand Down

0 comments on commit f9aa4c6

Please sign in to comment.