From e4e75aacac93f320a20ad367bdfc8aa2c21596ef Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 3 Oct 2020 11:48:36 +0200 Subject: pppoe-server: T2956: make use of defaultValue list feature --- data/templates/accel-ppp/pppoe.config.tmpl | 11 +++++++++-- interface-definitions/include/accel-auth-protocols.xml.i | 3 ++- smoketest/scripts/cli/test_service_pppoe-server.py | 6 +++--- src/conf_mode/service_pppoe-server.py | 8 -------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/data/templates/accel-ppp/pppoe.config.tmpl b/data/templates/accel-ppp/pppoe.config.tmpl index d0331f4e2..acc7df0a2 100644 --- a/data/templates/accel-ppp/pppoe.config.tmpl +++ b/data/templates/accel-ppp/pppoe.config.tmpl @@ -11,8 +11,15 @@ ipv6_nd ipv6_dhcp {% endif %} {% for protocol in authentication.protocols %} -{{ protocol }} -{% endfor%} +{# this should be fixed in the CLI by a migrator #} +{% if protocol == 'chap' %} +auth_chap_md5 +{% elif protocol == 'mschap' %} +auth_mschap_v1 +{% else %} +auth_{{ protocol.replace('-', '_') }} +{% endif %} +{% endfor %} shaper {% if snmp is defined %} net-snmp diff --git a/interface-definitions/include/accel-auth-protocols.xml.i b/interface-definitions/include/accel-auth-protocols.xml.i index 10d89d4de..a6899a4d8 100644 --- a/interface-definitions/include/accel-auth-protocols.xml.i +++ b/interface-definitions/include/accel-auth-protocols.xml.i @@ -24,7 +24,8 @@ (pap|chap|mschap|mschap-v2) - + + pap chap mschap mschap-v2 diff --git a/smoketest/scripts/cli/test_service_pppoe-server.py b/smoketest/scripts/cli/test_service_pppoe-server.py index 14f8316f5..2e435fa67 100755 --- a/smoketest/scripts/cli/test_service_pppoe-server.py +++ b/smoketest/scripts/cli/test_service_pppoe-server.py @@ -218,7 +218,9 @@ class TestServicePPPoEServer(unittest.TestCase): def test_auth_protocols(self): """ Test configuration of local authentication for PPPoE server """ self.basic_config() - self.session.set(base_path + ['authentication', 'protocols', 'auth_mschap_v2']) + + # explicitly test mschap-v2 - no special reason + self.session.set(base_path + ['authentication', 'protocols', 'mschap-v2']) # commit changes self.session.commit() @@ -286,8 +288,6 @@ class TestServicePPPoEServer(unittest.TestCase): # Validate configuration values conf = ConfigParser(allow_no_value=True, delimiters='=') conf.read(pppoe_conf) - from vyos.util import read_file - print(read_file(pppoe_conf)) for tmp in ['ipv6pool', 'ipv6_nd', 'ipv6_dhcp']: self.assertEqual(conf['modules'][tmp], None) diff --git a/src/conf_mode/service_pppoe-server.py b/src/conf_mode/service_pppoe-server.py index f92569c20..65a7f93b0 100755 --- a/src/conf_mode/service_pppoe-server.py +++ b/src/conf_mode/service_pppoe-server.py @@ -63,14 +63,6 @@ def get_config(config=None): # we need to store the path to the secrets file pppoe.update({'chap_secrets_file' : pppoe_chap_secrets}) - if not vyos_dict_search('authentication.protocols', pppoe): - if not 'authentication' in pppoe: - pppoe.update({'authentication' : ''}) - - pppoe['authentication'].update( - {'protocols' : ['auth_mschap_v2', 'auth_mschap_v1', - 'auth_chap_md5', 'auth_pap']}) - # We can only have two IPv4 and three IPv6 nameservers - also they are # configured in a different way in the configuration, this is why we split # the configuration -- cgit v1.2.3