diff options
Diffstat (limited to 'src/conf_mode/protocols_ospf.py')
-rwxr-xr-x | src/conf_mode/protocols_ospf.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/conf_mode/protocols_ospf.py b/src/conf_mode/protocols_ospf.py index 07e6a5860..9d35aa007 100755 --- a/src/conf_mode/protocols_ospf.py +++ b/src/conf_mode/protocols_ospf.py @@ -31,23 +31,22 @@ from vyos import ConfigError from vyos import airbag airbag.enable() -vrf = None -if len(argv) > 1: - vrf = argv[1] - def get_config(config=None): if config: conf = config else: conf = Config() - return get_frrender_dict(conf) + return get_frrender_dict(conf, argv) def verify(config_dict): - global vrf - if not has_frr_protocol_in_dict(config_dict, 'ospf', vrf): + if not has_frr_protocol_in_dict(config_dict, 'ospf'): return None + vrf = None + if 'vrf_context' in config_dict: + vrf = config_dict['vrf_context'] + # eqivalent of the C foo ? 'a' : 'b' statement ospf = vrf and config_dict['vrf']['name'][vrf]['protocols']['ospf'] or config_dict['ospf'] ospf['policy'] = config_dict['policy'] @@ -177,12 +176,12 @@ def verify(config_dict): return None def generate(config_dict): - if 'frrender_cls' not in config_dict: + if config_dict and 'frrender_cls' not in config_dict: FRRender().generate(config_dict) return None def apply(config_dict): - if 'frrender_cls' not in config_dict: + if config_dict and 'frrender_cls' not in config_dict: FRRender().apply() return None |