diff options
author | Christian Breunig <christian@breunig.cc> | 2023-03-17 20:09:31 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-17 20:09:31 +0100 |
commit | c820be57b6c77cdb0a5055d0c3a77dc8d550e2d7 (patch) | |
tree | b9d65f6aff120b793a8838c445825f348da2c6a1 | |
parent | 92c3ce9fbc266bbbd89a40fe0c98d6db1a4f4c2c (diff) | |
parent | 9d3f88170fabd2211d51a56a642b388529ec385a (diff) | |
download | vyos-1x-c820be57b6c77cdb0a5055d0c3a77dc8d550e2d7.tar.gz vyos-1x-c820be57b6c77cdb0a5055d0c3a77dc8d550e2d7.zip |
Merge pull request #1898 from sever-sever/T5086-def
T5086: Fix sflow fix default values for server
-rwxr-xr-x | smoketest/scripts/cli/test_system_sflow.py | 4 | ||||
-rwxr-xr-x | src/conf_mode/system_sflow.py | 6 |
2 files changed, 10 insertions, 0 deletions
diff --git a/smoketest/scripts/cli/test_system_sflow.py b/smoketest/scripts/cli/test_system_sflow.py index f50052d31..fef88b56a 100755 --- a/smoketest/scripts/cli/test_system_sflow.py +++ b/smoketest/scripts/cli/test_system_sflow.py @@ -56,7 +56,9 @@ class TestSystemFlowAccounting(VyOSUnitTestSHIM.TestCase): polling = '24' sampling_rate = '128' server = '192.0.2.254' + local_server = '127.0.0.1' port = '8192' + default_port = '6343' mon_limit = '50' self.cli_set( @@ -73,6 +75,7 @@ class TestSystemFlowAccounting(VyOSUnitTestSHIM.TestCase): self.cli_set(base_path + ['polling', polling]) self.cli_set(base_path + ['sampling-rate', sampling_rate]) self.cli_set(base_path + ['server', server, 'port', port]) + self.cli_set(base_path + ['server', local_server]) self.cli_set(base_path + ['drop-monitor-limit', mon_limit]) # commit changes @@ -86,6 +89,7 @@ class TestSystemFlowAccounting(VyOSUnitTestSHIM.TestCase): self.assertIn(f'agentIP={agent_address}', hsflowd) self.assertIn(f'agent={agent_interface}', hsflowd) self.assertIn(f'collector {{ ip = {server} udpport = {port} }}', hsflowd) + self.assertIn(f'collector {{ ip = {local_server} udpport = {default_port} }}', hsflowd) self.assertIn(f'dropmon {{ limit={mon_limit} start=on sw=on hw=off }}', hsflowd) for interface in Section.interfaces('ethernet'): diff --git a/src/conf_mode/system_sflow.py b/src/conf_mode/system_sflow.py index 2e19a5d76..a0c3fca7f 100755 --- a/src/conf_mode/system_sflow.py +++ b/src/conf_mode/system_sflow.py @@ -57,6 +57,12 @@ def get_config(config=None): if 'port' in sflow['server']: del sflow['server']['port'] + # Set default values per server + if 'server' in sflow: + for server in sflow['server']: + default_values = defaults(base + ['server']) + sflow['server'][server] = dict_merge(default_values, sflow['server'][server]) + return sflow |