summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid <dferrandez@gmail.com>2022-07-26 16:36:46 +0100
committerGitHub <noreply@github.com>2022-07-26 17:36:46 +0200
commit8bbaafd554d003078607121e2de662c9c8edee40 (patch)
treee552615804a2f87573552012dd8c00a7096ecd95
parent1589eefe8b24b66bda1e479a7a2179329792dcbd (diff)
downloadvyos-1x-8bbaafd554d003078607121e2de662c9c8edee40.tar.gz
vyos-1x-8bbaafd554d003078607121e2de662c9c8edee40.zip
T4571: add sflow vrf to sflow agent address IP validation
-rwxr-xr-xsrc/conf_mode/flow_accounting_conf.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/conf_mode/flow_accounting_conf.py b/src/conf_mode/flow_accounting_conf.py
index 7750c1247..7e16235c1 100755
--- a/src/conf_mode/flow_accounting_conf.py
+++ b/src/conf_mode/flow_accounting_conf.py
@@ -192,6 +192,11 @@ def verify(flow_config):
raise ConfigError("All sFlow servers must use the same IP protocol")
else:
sflow_collector_ipver = ip_address(server).version
+
+ # check if vrf is defined for Sflow
+ sflow_vrf = None
+ if 'vrf' in flow_config:
+ sflow_vrf = flow_config['vrf']
# check agent-id for sFlow: we should avoid mixing IPv4 agent-id with IPv6 collectors and vice-versa
for server in flow_config['sflow']['server']:
@@ -203,12 +208,12 @@ def verify(flow_config):
if 'agent_address' in flow_config['sflow']:
tmp = flow_config['sflow']['agent_address']
- if not is_addr_assigned(tmp):
+ if not is_addr_assigned(tmp, sflow_vrf):
raise ConfigError(f'Configured "sflow agent-address {tmp}" does not exist in the system!')
# Check if configured netflow source-address exist in the system
if 'source_address' in flow_config['sflow']:
- if not is_addr_assigned(flow_config['sflow']['source_address']):
+ if not is_addr_assigned(flow_config['sflow']['source_address'], sflow_vrf):
tmp = flow_config['sflow']['source_address']
raise ConfigError(f'Configured "sflow source-address {tmp}" does not exist on the system!')