summaryrefslogtreecommitdiff
path: root/src/conf_mode/interfaces-wirelessmodem.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-04-02 20:22:40 +0200
committerChristian Poessinger <christian@poessinger.com>2020-04-02 20:22:40 +0200
commite467ef23b2429db80c8be1576f2eb3feea8d759e (patch)
treefb25139f26f1464ede5ccd25f47917cb5d713f7a /src/conf_mode/interfaces-wirelessmodem.py
parent7fa09dd0de1d657d6c854e09f41091008c99033e (diff)
downloadvyos-1x-e467ef23b2429db80c8be1576f2eb3feea8d759e.tar.gz
vyos-1x-e467ef23b2429db80c8be1576f2eb3feea8d759e.zip
wwan: vrf: T2200: add CLI options and parse configuration to dictionary
Diffstat (limited to 'src/conf_mode/interfaces-wirelessmodem.py')
-rwxr-xr-xsrc/conf_mode/interfaces-wirelessmodem.py11
1 files changed, 10 insertions, 1 deletions
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):