diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-07-21 19:18:14 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2022-07-21 19:18:47 +0200 |
commit | 5e510e45f6f9b9fecdbdf105bbd03171ce43679e (patch) | |
tree | 6942872c2d2325df4142e3ce64c35fec60d0fcd8 /src/conf_mode/service_ids_fastnetmon.py | |
parent | f40fe618f2a3efb7ea4dba35614f40db87903501 (diff) | |
download | vyos-1x-5e510e45f6f9b9fecdbdf105bbd03171ce43679e.tar.gz vyos-1x-5e510e45f6f9b9fecdbdf105bbd03171ce43679e.zip |
fastnetmon: T4553: add processing of XML defaultValue definitions
Diffstat (limited to 'src/conf_mode/service_ids_fastnetmon.py')
-rwxr-xr-x | src/conf_mode/service_ids_fastnetmon.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/conf_mode/service_ids_fastnetmon.py b/src/conf_mode/service_ids_fastnetmon.py index ae7e582ec..57e12ddf2 100755 --- a/src/conf_mode/service_ids_fastnetmon.py +++ b/src/conf_mode/service_ids_fastnetmon.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 # -# Copyright (C) 2018-2020 VyOS maintainers and contributors +# Copyright (C) 2018-2022 VyOS maintainers and contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or later as @@ -19,9 +19,11 @@ import os from sys import exit from vyos.config import Config -from vyos import ConfigError -from vyos.util import call +from vyos.configdict import dict_merge from vyos.template import render +from vyos.util import call +from vyos.xml import defaults +from vyos import ConfigError from vyos import airbag airbag.enable() @@ -35,6 +37,12 @@ def get_config(config=None): conf = Config() base = ['service', 'ids', 'ddos-protection'] fastnetmon = conf.get_config_dict(base, key_mangling=('-', '_'), get_first_key=True) + + # We have gathered the dict representation of the CLI, but there are default + # options which we need to update into the dictionary retrived. + default_values = defaults(base) + fastnetmon = dict_merge(default_values, fastnetmon) + return fastnetmon def verify(fastnetmon): |