summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-10-13 18:49:33 +0200
committerChristian Poessinger <christian@poessinger.com>2020-10-13 18:56:04 +0200
commit6c2a2cb8ce98b3b43ac07403bc61f186c28ccdf9 (patch)
tree8e06f7a6d8e4f295b3cfd845196e8e9172488ea5
parentf0f7d0658a7b48f7885916cd27ef499c780c3f4f (diff)
downloadvyos-1x-6c2a2cb8ce98b3b43ac07403bc61f186c28ccdf9.tar.gz
vyos-1x-6c2a2cb8ce98b3b43ac07403bc61f186c28ccdf9.zip
pppoe-server: T2976: fix local-users default value retrieval from XML
We must use XML node style (hyphen over underscore).
-rw-r--r--python/vyos/configdict.py2
-rw-r--r--smoketest/scripts/cli/base_accel_ppp_test.py17
2 files changed, 18 insertions, 1 deletions
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py
index 99072a1b9..02006465c 100644
--- a/python/vyos/configdict.py
+++ b/python/vyos/configdict.py
@@ -465,7 +465,7 @@ def get_accel_dict(config, base, chap_secrets):
# Add individual local-user default values
if vyos_dict_search('authentication.local_users.username', dict):
- default_values = defaults(base + ['authentication', 'local_users', 'username'])
+ default_values = defaults(base + ['authentication', 'local-users', 'username'])
for username in vyos_dict_search('authentication.local_users.username', dict):
dict['authentication']['local_users']['username'][username] = dict_merge(
diff --git a/smoketest/scripts/cli/base_accel_ppp_test.py b/smoketest/scripts/cli/base_accel_ppp_test.py
index cf401b0d8..56cbf1dd4 100644
--- a/smoketest/scripts/cli/base_accel_ppp_test.py
+++ b/smoketest/scripts/cli/base_accel_ppp_test.py
@@ -44,6 +44,9 @@ class BasicAccelPPPTest:
def set(self, path):
self.session.set(self._base_path + path)
+ def delete(self, path):
+ self.session.delete(self._base_path + path)
+
def basic_config(self):
# PPPoE local auth mode requires local users to be configured!
self.set(['authentication', 'local-users', 'username', 'vyos', 'password', 'vyos'])
@@ -117,6 +120,20 @@ class BasicAccelPPPTest:
# Check for running process
self.assertTrue(process_named_running(self._process_name))
+ # Check local-users default value(s)
+ self.delete(['authentication', 'local-users', 'username', user, 'static-ip'])
+ # commit changes
+ self.session.commit()
+
+ # check local users
+ tmp = cmd(f'sudo cat {self._chap_secrets}')
+ regex = f'{user}\s+\*\s+{password}\s+\*\s+{download}/{upload}'
+ tmp = re.findall(regex, tmp)
+ self.assertTrue(tmp)
+
+ # Check for running process
+ self.assertTrue(process_named_running(self._process_name))
+
def test_authentication_radius(self):
""" Test configuration of RADIUS authentication for PPPoE server """
self.basic_config()