summaryrefslogtreecommitdiff
path: root/python/vyos
diff options
context:
space:
mode:
Diffstat (limited to 'python/vyos')
-rw-r--r--python/vyos/configdict.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py
index 53b5f9492..126d6195a 100644
--- a/python/vyos/configdict.py
+++ b/python/vyos/configdict.py
@@ -15,8 +15,8 @@
"""
A library for retrieving value dicts from VyOS configs in a declarative fashion.
-
"""
+import os
import jmespath
from enum import Enum
@@ -24,7 +24,6 @@ from copy import deepcopy
from vyos import ConfigError
from vyos.validate import is_member
-from vyos.util import ifname_from_config
def retrieve_config(path_hash, base_path, config):
"""
@@ -195,7 +194,7 @@ def get_removed_vlans(conf, dict):
return dict
-def get_interface_dict(config, base, ifname):
+def get_interface_dict(config, base, ifname=''):
"""
Common utility function to retrieve and mandgle the interfaces available
in CLI configuration. All interfaces have a common base ground where the
@@ -205,6 +204,12 @@ def get_interface_dict(config, base, ifname):
"""
from vyos.xml import defaults
+ if not ifname:
+ # determine tagNode instance
+ if 'VYOS_TAGNODE_VALUE' not in os.environ:
+ raise ConfigError('Interface (VYOS_TAGNODE_VALUE) not specified')
+ ifname = os.environ['VYOS_TAGNODE_VALUE']
+
# retrieve interface default values
default_values = defaults(base)