From e467ef23b2429db80c8be1576f2eb3feea8d759e Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Thu, 2 Apr 2020 20:22:40 +0200 Subject: wwan: vrf: T2200: add CLI options and parse configuration to dictionary --- src/conf_mode/interfaces-wirelessmodem.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/conf_mode') diff --git a/src/conf_mode/interfaces-wirelessmodem.py b/src/conf_mode/interfaces-wirelessmodem.py index 9efad3b8d..76ed90daa 100755 --- a/src/conf_mode/interfaces-wirelessmodem.py +++ b/src/conf_mode/interfaces-wirelessmodem.py @@ -84,7 +84,8 @@ default_config_data = { 'metric': '10', 'mtu': '1500', 'name_server': True, - 'intf': '' + 'intf': '', + 'vrf': '' } def subprocess_cmd(command): @@ -154,6 +155,10 @@ def get_config(): if conf.exists(['ondemand']): wwan['on_demand'] = True + # retrieve VRF instance + if conf.exists('vrf'): + wwan['vrf'] = conf.return_value(['vrf']) + return wwan def verify(wwan): @@ -168,6 +173,10 @@ def verify(wwan): if not os.path.exists(f"/dev/{wwan['device']}"): raise ConfigError(f"Device {wwan['device']} does not exist") + vrf_name = wwan['vrf'] + if vrf_name and vrf_name not in interfaces(): + raise ConfigError(f'VRF {vrf_name} does not exist') + return None def generate(wwan): -- cgit v1.2.3