summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-07-21 19:18:14 +0200
committerChristian Poessinger <christian@poessinger.com>2022-07-21 19:18:47 +0200
commit5e510e45f6f9b9fecdbdf105bbd03171ce43679e (patch)
tree6942872c2d2325df4142e3ce64c35fec60d0fcd8
parentf40fe618f2a3efb7ea4dba35614f40db87903501 (diff)
downloadvyos-1x-5e510e45f6f9b9fecdbdf105bbd03171ce43679e.tar.gz
vyos-1x-5e510e45f6f9b9fecdbdf105bbd03171ce43679e.zip
fastnetmon: T4553: add processing of XML defaultValue definitions
-rwxr-xr-xsrc/conf_mode/service_ids_fastnetmon.py14
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):