Skip to content

Commit fb18ba8

Browse files
committed
T4576: Accel-ppp logging level configuration
add ability to change logging level config for: * VPN L2TP * VPN PPTP * VPN SSTP * IPoE Server * PPPoE Serve
1 parent 23a4201 commit fb18ba8

14 files changed

+125
-5
lines changed

data/templates/accel-ppp/ipoe.config.j2

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ max-starting={{ max_concurrent_sessions }}
2929
[log]
3030
syslog=accel-ipoe,daemon
3131
copy=1
32-
level=5
32+
{% if log.level is vyos_defined %}
33+
level={{ log.level }}
34+
{% endif %}
3335

3436
[ipoe]
3537
verbose=1

data/templates/accel-ppp/l2tp.config.j2

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ max-starting={{ max_concurrent_sessions }}
2828
[log]
2929
syslog=accel-l2tp,daemon
3030
copy=1
31-
level=5
31+
{% if log.level is vyos_defined %}
32+
level={{ log.level }}
33+
{% endif %}
3234

3335
[client-ip-range]
3436
0.0.0.0/0

data/templates/accel-ppp/pppoe.config.j2

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ thread-count={{ thread_count }}
2727
[log]
2828
syslog=accel-pppoe,daemon
2929
copy=1
30-
level=5
30+
{% if log.level is vyos_defined %}
31+
level={{ log.level }}
32+
{% endif %}
3133

3234
{% if authentication.mode is vyos_defined("noauth") %}
3335
[auth]

data/templates/accel-ppp/pptp.config.j2

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ max-starting={{ max_concurrent_sessions }}
2828
[log]
2929
syslog=accel-pptp,daemon
3030
copy=1
31-
level=5
31+
{% if log.level is vyos_defined %}
32+
level={{ log.level }}
33+
{% endif %}
3234

3335
[client-ip-range]
3436
0.0.0.0/0

data/templates/accel-ppp/sstp.config.j2

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ max-starting={{ max_concurrent_sessions }}
2929
[log]
3030
syslog=accel-sstp,daemon
3131
copy=1
32-
level=5
32+
{% if log.level is vyos_defined %}
33+
level={{ log.level }}
34+
{% endif %}
3335

3436
[client-ip-range]
3537
0.0.0.0/0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<!-- include start from accel-ppp/log-level.xml.i -->
2+
<leafNode name="level">
3+
<properties>
4+
<help>Specifies log level</help>
5+
<valueHelp>
6+
<format>0</format>
7+
<description>Turn off logging</description>
8+
</valueHelp>
9+
<valueHelp>
10+
<format>1</format>
11+
<description>Log only error messages</description>
12+
</valueHelp>
13+
<valueHelp>
14+
<format>2</format>
15+
<description>Log error and warning messages</description>
16+
</valueHelp>
17+
<valueHelp>
18+
<format>3</format>
19+
<description>Log error, warning and minimum information messages</description>
20+
</valueHelp>
21+
<valueHelp>
22+
<format>4</format>
23+
<description>Log error, warning and full information messages</description>
24+
</valueHelp>
25+
<valueHelp>
26+
<format>5</format>
27+
<description>Log all messages including debug messages</description>
28+
</valueHelp>
29+
<constraint>
30+
<validator name="numeric" argument="--range 0-5"/>
31+
</constraint>
32+
</properties>
33+
<defaultValue>3</defaultValue>
34+
</leafNode>
35+
<!-- include end -->

interface-definitions/service_ipoe-server.xml.in

+8
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,14 @@
189189
#include <include/accel-ppp/snmp.xml.i>
190190
#include <include/generic-description.xml.i>
191191
#include <include/name-server-ipv4-ipv6.xml.i>
192+
<node name="log">
193+
<properties>
194+
<help>IPoE server logging </help>
195+
</properties>
196+
<children>
197+
#include <include/accel-ppp/log-level.xml.i>
198+
</children>
199+
</node>
192200
</children>
193201
</node>
194202
</children>

interface-definitions/service_pppoe-server.xml.in

+8
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,14 @@
153153
#include <include/accel-ppp/wins-server.xml.i>
154154
#include <include/generic-description.xml.i>
155155
#include <include/name-server-ipv4-ipv6.xml.i>
156+
<node name="log">
157+
<properties>
158+
<help>PPPoE server logging</help>
159+
</properties>
160+
<children>
161+
#include <include/accel-ppp/log-level.xml.i>
162+
</children>
163+
</node>
156164
</children>
157165
</node>
158166
</children>

interface-definitions/vpn_l2tp.xml.in

+8
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@
142142
#include <include/name-server-ipv4-ipv6.xml.i>
143143
</children>
144144
</node>
145+
<node name="log">
146+
<properties>
147+
<help>L2TP server logging</help>
148+
</properties>
149+
<children>
150+
#include <include/accel-ppp/log-level.xml.i>
151+
</children>
152+
</node>
145153
</children>
146154
</node>
147155
</children>

interface-definitions/vpn_pptp.xml.in

+8
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@
5858
#include <include/name-server-ipv4-ipv6.xml.i>
5959
</children>
6060
</node>
61+
<node name="log">
62+
<properties>
63+
<help>PPTP server logging</help>
64+
</properties>
65+
<children>
66+
#include <include/accel-ppp/log-level.xml.i>
67+
</children>
68+
</node>
6169
</children>
6270
</node>
6371
</children>

interface-definitions/vpn_sstp.xml.in

+8
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@
6262
<constraintErrorMessage>Host-name must be alphanumeric and can contain hyphens</constraintErrorMessage>
6363
</properties>
6464
</leafNode>
65+
<node name="log">
66+
<properties>
67+
<help>SSTP server logging</help>
68+
</properties>
69+
<children>
70+
#include <include/accel-ppp/log-level.xml.i>
71+
</children>
72+
</node>
6573
</children>
6674
</node>
6775
</children>

smoketest/scripts/cli/base_accel_ppp_test.py

+24
Original file line numberDiff line numberDiff line change
@@ -628,3 +628,27 @@ def test_accel_limits(self):
628628
self.assertEqual(conf['connlimit']['limit'], limits)
629629
self.assertEqual(conf['connlimit']['burst'], burst)
630630
self.assertEqual(conf['connlimit']['timeout'], timeout)
631+
632+
def test_accel_log_level(self):
633+
self.basic_config()
634+
self.cli_commit()
635+
636+
# check default value
637+
conf = ConfigParser(allow_no_value=True)
638+
conf.read(self._config_file)
639+
self.assertEqual(conf['log']['level'], '3')
640+
641+
for log_level in range(0, 5):
642+
log_level_path = ['log', 'level', str(log_level)]
643+
if self._base_path == ['vpn', 'pptp', 'remote-access']:
644+
self.cli_set(['vpn', 'pptp'] + log_level_path)
645+
elif self._base_path == ['vpn', 'l2tp', 'remote-access']:
646+
self.cli_set(['vpn', 'l2tp'] + log_level_path)
647+
else:
648+
self.set(log_level_path)
649+
self.cli_commit()
650+
# Validate configuration values
651+
conf = ConfigParser(allow_no_value=True)
652+
conf.read(self._config_file)
653+
654+
self.assertEqual(conf['log']['level'], str(log_level))

src/conf_mode/vpn_l2tp.py

+6
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ def get_config(config=None):
5252

5353
# retrieve common dictionary keys
5454
l2tp = get_accel_dict(conf, base, l2tp_chap_secrets)
55+
l2tp['log'] = conf.get_config_dict(['vpn', 'l2tp', 'log'],
56+
key_mangling=('-', '_'),
57+
get_first_key=True,
58+
with_recursive_defaults=True,
59+
with_pki=True)
60+
5561
if dict_search('client_ip_pool', l2tp):
5662
# Multiple named pools require ordered values T5099
5763
l2tp['ordered_named_pools'] = get_pools_in_order(

src/conf_mode/vpn_pptp.py

+5
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ def get_config(config=None):
4848

4949
# retrieve common dictionary keys
5050
pptp = get_accel_dict(conf, base, pptp_chap_secrets)
51+
pptp['log'] = conf.get_config_dict(['vpn', 'pptp', 'log'],
52+
key_mangling=('-', '_'),
53+
get_first_key=True,
54+
with_recursive_defaults=True,
55+
with_pki=True)
5156

5257
if dict_search('client_ip_pool', pptp):
5358
# Multiple named pools require ordered values T5099

0 commit comments

Comments
 (0)