Skip to content

Commit

Permalink
Merge pull request #3510 from HollyGurza/T4576
Browse files Browse the repository at this point in the history
T4576: Accel-ppp logging level configuration
  • Loading branch information
dmbaturin authored May 30, 2024
2 parents 9859440 + 4d84f78 commit 2250653
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 5 deletions.
4 changes: 3 additions & 1 deletion data/templates/accel-ppp/ipoe.config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ max-starting={{ max_concurrent_sessions }}
[log]
syslog=accel-ipoe,daemon
copy=1
level=5
{% if log.level is vyos_defined %}
level={{ log.level }}
{% endif %}

[ipoe]
verbose=1
Expand Down
4 changes: 3 additions & 1 deletion data/templates/accel-ppp/l2tp.config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ max-starting={{ max_concurrent_sessions }}
[log]
syslog=accel-l2tp,daemon
copy=1
level=5
{% if log.level is vyos_defined %}
level={{ log.level }}
{% endif %}

[client-ip-range]
0.0.0.0/0
Expand Down
4 changes: 3 additions & 1 deletion data/templates/accel-ppp/pppoe.config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ thread-count={{ thread_count }}
[log]
syslog=accel-pppoe,daemon
copy=1
level=5
{% if log.level is vyos_defined %}
level={{ log.level }}
{% endif %}

{% if authentication.mode is vyos_defined("noauth") %}
[auth]
Expand Down
4 changes: 3 additions & 1 deletion data/templates/accel-ppp/pptp.config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ max-starting={{ max_concurrent_sessions }}
[log]
syslog=accel-pptp,daemon
copy=1
level=5
{% if log.level is vyos_defined %}
level={{ log.level }}
{% endif %}

[client-ip-range]
0.0.0.0/0
Expand Down
4 changes: 3 additions & 1 deletion data/templates/accel-ppp/sstp.config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ max-starting={{ max_concurrent_sessions }}
[log]
syslog=accel-sstp,daemon
copy=1
level=5
{% if log.level is vyos_defined %}
level={{ log.level }}
{% endif %}

[client-ip-range]
0.0.0.0/0
Expand Down
42 changes: 42 additions & 0 deletions interface-definitions/include/accel-ppp/log.xml.i
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!-- include start from accel-ppp/log.xml.i -->
<node name="log">
<properties>
<help>Server logging </help>
</properties>
<children>
<leafNode name="level">
<properties>
<help>Specifies log level</help>
<valueHelp>
<format>0</format>
<description>Turn off logging</description>
</valueHelp>
<valueHelp>
<format>1</format>
<description>Log only error messages</description>
</valueHelp>
<valueHelp>
<format>2</format>
<description>Log error and warning messages</description>
</valueHelp>
<valueHelp>
<format>3</format>
<description>Log error, warning and minimum information messages</description>
</valueHelp>
<valueHelp>
<format>4</format>
<description>Log error, warning and full information messages</description>
</valueHelp>
<valueHelp>
<format>5</format>
<description>Log all messages including debug messages</description>
</valueHelp>
<constraint>
<validator name="numeric" argument="--range 0-5"/>
</constraint>
</properties>
<defaultValue>3</defaultValue>
</leafNode>
</children>
</node>
<!-- include end -->
1 change: 1 addition & 0 deletions interface-definitions/service_ipoe-server.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
#include <include/accel-ppp/snmp.xml.i>
#include <include/generic-description.xml.i>
#include <include/name-server-ipv4-ipv6.xml.i>
#include <include/accel-ppp/log.xml.i>
</children>
</node>
</children>
Expand Down
1 change: 1 addition & 0 deletions interface-definitions/service_pppoe-server.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
#include <include/accel-ppp/wins-server.xml.i>
#include <include/generic-description.xml.i>
#include <include/name-server-ipv4-ipv6.xml.i>
#include <include/accel-ppp/log.xml.i>
</children>
</node>
</children>
Expand Down
1 change: 1 addition & 0 deletions interface-definitions/vpn_l2tp.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
#include <include/accel-ppp/wins-server.xml.i>
#include <include/generic-description.xml.i>
#include <include/name-server-ipv4-ipv6.xml.i>
#include <include/accel-ppp/log.xml.i>
</children>
</node>
</children>
Expand Down
1 change: 1 addition & 0 deletions interface-definitions/vpn_pptp.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#include <include/accel-ppp/wins-server.xml.i>
#include <include/generic-description.xml.i>
#include <include/name-server-ipv4-ipv6.xml.i>
#include <include/accel-ppp/log.xml.i>
</children>
</node>
</children>
Expand Down
1 change: 1 addition & 0 deletions interface-definitions/vpn_sstp.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
<constraintErrorMessage>Host-name must be alphanumeric and can contain hyphens</constraintErrorMessage>
</properties>
</leafNode>
#include <include/accel-ppp/log.xml.i>
</children>
</node>
</children>
Expand Down
18 changes: 18 additions & 0 deletions smoketest/scripts/cli/base_accel_ppp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,3 +628,21 @@ def test_accel_limits(self):
self.assertEqual(conf['connlimit']['limit'], limits)
self.assertEqual(conf['connlimit']['burst'], burst)
self.assertEqual(conf['connlimit']['timeout'], timeout)

def test_accel_log_level(self):
self.basic_config()
self.cli_commit()

# check default value
conf = ConfigParser(allow_no_value=True)
conf.read(self._config_file)
self.assertEqual(conf['log']['level'], '3')

for log_level in range(0, 5):
self.set(['log', 'level', str(log_level)])
self.cli_commit()
# Validate configuration values
conf = ConfigParser(allow_no_value=True)
conf.read(self._config_file)

self.assertEqual(conf['log']['level'], str(log_level))

0 comments on commit 2250653

Please sign in to comment.