summaryrefslogtreecommitdiff
path: root/src/conf_mode/system_sflow.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-01-22 08:12:21 +0100
committerChristian Breunig <christian@breunig.cc>2024-01-22 08:12:21 +0100
commit64473fa6f320375fb3d3de4de9e729f456ee5ae2 (patch)
tree515fce4e97b9103f320bc8d55a9a7b2fd0f13f89 /src/conf_mode/system_sflow.py
parentc9bceff2191986af504b114d2d8cfc3547f72ed1 (diff)
downloadvyos-1x-64473fa6f320375fb3d3de4de9e729f456ee5ae2.tar.gz
vyos-1x-64473fa6f320375fb3d3de4de9e729f456ee5ae2.zip
sflow: T5968: add VRF support
Add support to run hsflowd in a dedicated (e.g. management) VRF. Command will be "set system sflow vrf <name>" like with any other service
Diffstat (limited to 'src/conf_mode/system_sflow.py')
-rwxr-xr-xsrc/conf_mode/system_sflow.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/conf_mode/system_sflow.py b/src/conf_mode/system_sflow.py
index 2df1bbb7a..41119b494 100755
--- a/src/conf_mode/system_sflow.py
+++ b/src/conf_mode/system_sflow.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2023 VyOS maintainers and contributors
+# Copyright (C) 2023-2024 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,6 +19,7 @@ import os
from sys import exit
from vyos.config import Config
+from vyos.configverify import verify_vrf
from vyos.template import render
from vyos.utils.process import call
from vyos.utils.network import is_addr_assigned
@@ -46,7 +47,6 @@ def get_config(config=None):
return sflow
-
def verify(sflow):
if not sflow:
return None
@@ -68,9 +68,8 @@ def verify(sflow):
if 'server' not in sflow:
raise ConfigError('You need to configure at least one sFlow server!')
- # return True if all checks were passed
- return True
-
+ verify_vrf(sflow)
+ return None
def generate(sflow):
if not sflow:
@@ -81,7 +80,6 @@ def generate(sflow):
# Reload systemd manager configuration
call('systemctl daemon-reload')
-
def apply(sflow):
if not sflow:
# Stop flow-accounting daemon and remove configuration file
@@ -93,7 +91,6 @@ def apply(sflow):
# Start/reload flow-accounting daemon
call(f'systemctl restart {systemd_service}')
-
if __name__ == '__main__':
try:
config = get_config()