summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.vscode/settings.json2
-rw-r--r--python/vyos/config.py4
-rw-r--r--python/vyos/xml_ref/definition.py9
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_bonding.py2
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_macsec.py3
-rwxr-xr-xsmoketest/scripts/cli/test_qos.py2
-rwxr-xr-xsmoketest/scripts/cli/test_service_dns_forwarding.py2
-rwxr-xr-xsmoketest/scripts/cli/test_system_frr.py2
-rwxr-xr-xsrc/conf_mode/protocols_bgp.py9
-rwxr-xr-xsrc/conf_mode/system-login.py2
10 files changed, 25 insertions, 12 deletions
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 9b18e9996..caa87ba4a 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -4,9 +4,11 @@
"editor.insertSpaces": true,
"files.insertFinalNewline": true,
"files.eol": "\n",
+ # https://code.visualstudio.com/docs/languages/identifiers#_known-language-identifiers
"files.associations": {
"*.xml.i": "xml",
"*.xml.in": "xml",
+ "*.j2": "jinja",
},
"editor.indentSize": "tabSize",
"[jinja]": {
diff --git a/python/vyos/config.py b/python/vyos/config.py
index b0dbc5c2a..179f60c43 100644
--- a/python/vyos/config.py
+++ b/python/vyos/config.py
@@ -245,9 +245,9 @@ class Config(object):
"""
lpath = self._make_path(path)
root_dict = self.get_cached_root_dict(effective)
- conf_dict = get_sub_dict(root_dict, lpath, get_first_key)
+ conf_dict = get_sub_dict(root_dict, lpath, get_first_key=get_first_key)
- if key_mangling is None and no_multi_convert and not with_defaults:
+ if key_mangling is None and no_multi_convert and not (with_defaults or with_recursive_defaults):
return deepcopy(conf_dict)
rpath = lpath if get_first_key else lpath[:-1]
diff --git a/python/vyos/xml_ref/definition.py b/python/vyos/xml_ref/definition.py
index 43101bb4e..d95d580e2 100644
--- a/python/vyos/xml_ref/definition.py
+++ b/python/vyos/xml_ref/definition.py
@@ -272,8 +272,13 @@ class Xml:
return self.get_defaults(path, get_first_key=get_first_key,
recursive=recursive)
if not self._well_defined(path, conf):
- print('path to config dict does not define full config paths')
- return {}
+ # adjust for possible overlap:
+ if path and path[-1] in list(conf):
+ conf = conf[path[-1]]
+ conf = {} if not isinstance(conf, dict) else conf
+ if not self._well_defined(path, conf):
+ print('path to config dict does not define full config paths')
+ return {}
res = self._relative_defaults(path, conf, recursive=recursive)
diff --git a/smoketest/scripts/cli/test_interfaces_bonding.py b/smoketest/scripts/cli/test_interfaces_bonding.py
index 8fc5cf8b1..d8e6bde5c 100755
--- a/smoketest/scripts/cli/test_interfaces_bonding.py
+++ b/smoketest/scripts/cli/test_interfaces_bonding.py
@@ -243,4 +243,4 @@ class BondingInterfaceTest(BasicInterfaceTest.TestCase):
self.assertIn(member, slaves)
if __name__ == '__main__':
- unittest.main(verbosity=2, failfast=True)
+ unittest.main(verbosity=2)
diff --git a/smoketest/scripts/cli/test_interfaces_macsec.py b/smoketest/scripts/cli/test_interfaces_macsec.py
index 20ffa04d4..b32a6f524 100755
--- a/smoketest/scripts/cli/test_interfaces_macsec.py
+++ b/smoketest/scripts/cli/test_interfaces_macsec.py
@@ -209,5 +209,4 @@ class MACsecInterfaceTest(BasicInterfaceTest.TestCase):
self.assertTrue(process_named_running(PROCESS_NAME))
if __name__ == '__main__':
- unittest.main(verbosity=2, failfast=True)
-
+ unittest.main(verbosity=2)
diff --git a/smoketest/scripts/cli/test_qos.py b/smoketest/scripts/cli/test_qos.py
index 4cda2089f..3743be788 100755
--- a/smoketest/scripts/cli/test_qos.py
+++ b/smoketest/scripts/cli/test_qos.py
@@ -544,4 +544,4 @@ class TestQoS(VyOSUnitTestSHIM.TestCase):
self.assertEqual(f'{dport:x}', filter['options']['match']['value'])
if __name__ == '__main__':
- unittest.main(verbosity=2, failfast=True)
+ unittest.main(verbosity=2)
diff --git a/smoketest/scripts/cli/test_service_dns_forwarding.py b/smoketest/scripts/cli/test_service_dns_forwarding.py
index 1bd9f8713..bc50a4ffe 100755
--- a/smoketest/scripts/cli/test_service_dns_forwarding.py
+++ b/smoketest/scripts/cli/test_service_dns_forwarding.py
@@ -256,4 +256,4 @@ class TestServicePowerDNS(VyOSUnitTestSHIM.TestCase):
self.assertEqual(tmp, port)
if __name__ == '__main__':
- unittest.main(verbosity=2, failfast=True)
+ unittest.main(verbosity=2)
diff --git a/smoketest/scripts/cli/test_system_frr.py b/smoketest/scripts/cli/test_system_frr.py
index 715ec401d..3eb0cd0ab 100755
--- a/smoketest/scripts/cli/test_system_frr.py
+++ b/smoketest/scripts/cli/test_system_frr.py
@@ -143,4 +143,4 @@ class TestSystemFRR(VyOSUnitTestSHIM.TestCase):
if __name__ == '__main__':
- unittest.main(verbosity=2, failfast=True)
+ unittest.main(verbosity=2)
diff --git a/src/conf_mode/protocols_bgp.py b/src/conf_mode/protocols_bgp.py
index fb4a0488c..cec025fea 100755
--- a/src/conf_mode/protocols_bgp.py
+++ b/src/conf_mode/protocols_bgp.py
@@ -203,14 +203,21 @@ def verify_remote_as(peer_config, bgp_config):
return None
def verify_afi(peer_config, bgp_config):
+ # If address_family configured under neighboor
if 'address_family' in peer_config:
return True
+ # If address_family configured under peer-group
+ # if neighbor interface configured
+ peer_group_name = ''
+ if dict_search('interface.peer_group', peer_config):
+ peer_group_name = peer_config['interface']['peer_group']
+ # if neighbor IP configured.
if 'peer_group' in peer_config:
peer_group_name = peer_config['peer_group']
+ if peer_group_name:
tmp = dict_search(f'peer_group.{peer_group_name}.address_family', bgp_config)
if tmp: return True
-
return False
def verify(bgp):
diff --git a/src/conf_mode/system-login.py b/src/conf_mode/system-login.py
index 273475c18..afd75913e 100755
--- a/src/conf_mode/system-login.py
+++ b/src/conf_mode/system-login.py
@@ -389,7 +389,7 @@ def apply(login):
# command until user is removed - userdel might return 8 as
# SSH sessions are not all yet properly cleaned away, thus we
# simply re-run the command until the account wen't away
- while run(f'userdel --remove {user}', stderr=DEVNULL):
+ while run(f'userdel {user}', stderr=DEVNULL):
sleep(0.250)
except Exception as e: