summaryrefslogtreecommitdiff
path: root/src/conf_mode/protocols_ospf.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-03-21 20:30:28 +0100
committerGitHub <noreply@github.com>2021-03-21 20:30:28 +0100
commitd2bf3bc3bd12f854cfa2ad8bdf5980e2cd6a90b9 (patch)
tree2cafb5b7553eb2fdb980201e36fc3a055bc3614f /src/conf_mode/protocols_ospf.py
parent300f1d2962f9f3f59cc13eac7c03c21f1c9a8eb1 (diff)
parent0a34f23012f5f0621d5d15a1a5c30c04dfc68bf9 (diff)
downloadvyos-1x-d2bf3bc3bd12f854cfa2ad8bdf5980e2cd6a90b9.tar.gz
vyos-1x-d2bf3bc3bd12f854cfa2ad8bdf5980e2cd6a90b9.zip
Merge pull request #779 from c-po/isis-vrf
ISIS: add VRF support
Diffstat (limited to 'src/conf_mode/protocols_ospf.py')
-rwxr-xr-xsrc/conf_mode/protocols_ospf.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/conf_mode/protocols_ospf.py b/src/conf_mode/protocols_ospf.py
index 08347aa52..a655eaeca 100755
--- a/src/conf_mode/protocols_ospf.py
+++ b/src/conf_mode/protocols_ospf.py
@@ -154,11 +154,10 @@ def verify(ospf):
f'concurrently for {interface}!')
if 'vrf' in ospf:
- # If interface specific options are set, we must ensure that
- # the interface is bound to our requesting VRF. Due to the VyOS
- # priorities the interface is bound to the VRF after creation
- # of the VRF itself, and before any routing protocol is
- # configured.
+ # If interface specific options are set, we must ensure that the
+ # interface is bound to our requesting VRF. Due to the VyOS
+ # priorities the interface is bound to the VRF after creation of
+ # the VRF itself, and before any routing protocol is configured.
vrf = ospf['vrf']
tmp = get_interface_config(interface)
if 'master' not in tmp or tmp['master'] != vrf:
@@ -179,17 +178,18 @@ def apply(ospf):
frr_cfg = frr.FRRConfig()
frr_cfg.load_configuration(frr_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 = ''
if 'vrf' in ospf:
- vrf = ospf['vrf']
- frr_cfg.modify_section(f'^router ospf vrf {vrf}$', '')
- else:
- frr_cfg.modify_section('^router ospf$', '')
+ vrf = ' vrf ' + ospf['vrf']
+ frr_cfg.modify_section(f'^router ospf{vrf}$', '')
for key in ['interface', 'interface_removed']:
if key not in ospf:
continue
for interface in ospf[key]:
- frr_cfg.modify_section(f'^interface {interface}$', '')
+ frr_cfg.modify_section(f'^interface {interface}{vrf}$', '')
frr_cfg.add_before(r'(ip prefix-list .*|route-map .*|line vty)', ospf['new_frr_config'])
frr_cfg.commit_configuration(frr_daemon)