summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkhramshinr <khramshinr@gmail.com>2024-05-23 17:39:56 +0600
committerkhramshinr <khramshinr@gmail.com>2024-05-27 18:23:32 +0600
commit4d84f786f64d2b80046100ead5d0e8c1eef7418c (patch)
tree1b51a268300b87d5e85a5dd98996067237b83feb
parent22dae74ef6037ad6a97da7118df42e41acbb117b (diff)
downloadvyos-1x-4d84f786f64d2b80046100ead5d0e8c1eef7418c.tar.gz
vyos-1x-4d84f786f64d2b80046100ead5d0e8c1eef7418c.zip
T4576: Accel-ppp logging level configuration
add ability to change logging level config for: * VPN L2TP * VPN PPTP * VPN SSTP * IPoE Server * PPPoE Serve
-rw-r--r--data/templates/accel-ppp/ipoe.config.j24
-rw-r--r--data/templates/accel-ppp/l2tp.config.j24
-rw-r--r--data/templates/accel-ppp/pppoe.config.j24
-rw-r--r--data/templates/accel-ppp/pptp.config.j24
-rw-r--r--data/templates/accel-ppp/sstp.config.j24
-rw-r--r--interface-definitions/include/accel-ppp/log.xml.i42
-rw-r--r--interface-definitions/service_ipoe-server.xml.in1
-rw-r--r--interface-definitions/service_pppoe-server.xml.in1
-rw-r--r--interface-definitions/vpn_l2tp.xml.in1
-rw-r--r--interface-definitions/vpn_pptp.xml.in1
-rw-r--r--interface-definitions/vpn_sstp.xml.in1
-rw-r--r--smoketest/scripts/cli/base_accel_ppp_test.py18
12 files changed, 80 insertions, 5 deletions
diff --git a/data/templates/accel-ppp/ipoe.config.j2 b/data/templates/accel-ppp/ipoe.config.j2
index c89812985..d87b90473 100644
--- a/data/templates/accel-ppp/ipoe.config.j2
+++ b/data/templates/accel-ppp/ipoe.config.j2
@@ -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
diff --git a/data/templates/accel-ppp/l2tp.config.j2 b/data/templates/accel-ppp/l2tp.config.j2
index 4ce9042c2..db4db66a7 100644
--- a/data/templates/accel-ppp/l2tp.config.j2
+++ b/data/templates/accel-ppp/l2tp.config.j2
@@ -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
diff --git a/data/templates/accel-ppp/pppoe.config.j2 b/data/templates/accel-ppp/pppoe.config.j2
index 42bc8440c..6711f2ec9 100644
--- a/data/templates/accel-ppp/pppoe.config.j2
+++ b/data/templates/accel-ppp/pppoe.config.j2
@@ -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]
diff --git a/data/templates/accel-ppp/pptp.config.j2 b/data/templates/accel-ppp/pptp.config.j2
index a04bd40c0..44f35998b 100644
--- a/data/templates/accel-ppp/pptp.config.j2
+++ b/data/templates/accel-ppp/pptp.config.j2
@@ -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
diff --git a/data/templates/accel-ppp/sstp.config.j2 b/data/templates/accel-ppp/sstp.config.j2
index 22fb55506..38da829f3 100644
--- a/data/templates/accel-ppp/sstp.config.j2
+++ b/data/templates/accel-ppp/sstp.config.j2
@@ -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
diff --git a/interface-definitions/include/accel-ppp/log.xml.i b/interface-definitions/include/accel-ppp/log.xml.i
new file mode 100644
index 000000000..96ce93ff9
--- /dev/null
+++ b/interface-definitions/include/accel-ppp/log.xml.i
@@ -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 -->
diff --git a/interface-definitions/service_ipoe-server.xml.in b/interface-definitions/service_ipoe-server.xml.in
index 414c9a731..c7542f0d0 100644
--- a/interface-definitions/service_ipoe-server.xml.in
+++ b/interface-definitions/service_ipoe-server.xml.in
@@ -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>
diff --git a/interface-definitions/service_pppoe-server.xml.in b/interface-definitions/service_pppoe-server.xml.in
index 5d357c2f9..81228938f 100644
--- a/interface-definitions/service_pppoe-server.xml.in
+++ b/interface-definitions/service_pppoe-server.xml.in
@@ -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>
diff --git a/interface-definitions/vpn_l2tp.xml.in b/interface-definitions/vpn_l2tp.xml.in
index 85a375db4..c00e82534 100644
--- a/interface-definitions/vpn_l2tp.xml.in
+++ b/interface-definitions/vpn_l2tp.xml.in
@@ -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>
diff --git a/interface-definitions/vpn_pptp.xml.in b/interface-definitions/vpn_pptp.xml.in
index a63633f57..8aec0cb1c 100644
--- a/interface-definitions/vpn_pptp.xml.in
+++ b/interface-definitions/vpn_pptp.xml.in
@@ -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>
diff --git a/interface-definitions/vpn_sstp.xml.in b/interface-definitions/vpn_sstp.xml.in
index d9ed1c040..5fd5c95ca 100644
--- a/interface-definitions/vpn_sstp.xml.in
+++ b/interface-definitions/vpn_sstp.xml.in
@@ -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>
diff --git a/smoketest/scripts/cli/base_accel_ppp_test.py b/smoketest/scripts/cli/base_accel_ppp_test.py
index ab723e707..212dc58ab 100644
--- a/smoketest/scripts/cli/base_accel_ppp_test.py
+++ b/smoketest/scripts/cli/base_accel_ppp_test.py
@@ -628,3 +628,21 @@ delegate={delegate_2_prefix},{delegate_mask},name={pool_name}"""
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))