summaryrefslogtreecommitdiff
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
parent7fa09dd0de1d657d6c854e09f41091008c99033e (diff)
downloadvyos-1x-e467ef23b2429db80c8be1576f2eb3feea8d759e.tar.gz
vyos-1x-e467ef23b2429db80c8be1576f2eb3feea8d759e.zip
wwan: vrf: T2200: add CLI options and parse configuration to dictionary
-rw-r--r--interface-definitions/interfaces-wirelessmodem.xml.in1
-rwxr-xr-xsrc/conf_mode/interfaces-wirelessmodem.py11
2 files changed, 11 insertions, 1 deletions
diff --git a/interface-definitions/interfaces-wirelessmodem.xml.in b/interface-definitions/interfaces-wirelessmodem.xml.in
index cea8f4029..1e1f23717 100644
--- a/interface-definitions/interfaces-wirelessmodem.xml.in
+++ b/interface-definitions/interfaces-wirelessmodem.xml.in
@@ -43,6 +43,7 @@
</node>
#include <include/interface-description.xml.i>
#include <include/interface-disable.xml.i>
+ #include <include/interface-vrf.xml.i>
<leafNode name="device">
<properties>
<help>System device name (default: ttyUSB0)</help>
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):