Problem description
Enabling sflow in VyOS is fairly simple process per documentation [1].
However, the sflow agent-address setting:
set system flow-accounting sflow agent-address <address>
Which is useful for identifying the system exporting the sflow data at the sflow collector does not allow for using an IP from a interface belonging to a vrf, if vrf is enabled on sflow via
set system flow-accounting vrf <vrf name>
We get a validation error on commit:
Configured "sflow agent-address <IP> " does not exist in the system!
It appears that src/conf_mode/flow_accounting_conf.py does not call is_addr_assigned() with the vrf if this has been configured, to which is_addr_assigned() makes use of the default vrf of None.
Obtaining and passing the vrf to is_addr_assigned() appears to solve the issue.
Directly configuring uacctd.conf with the IP from the vrf interface works just fine.
- Steps to reproduce:
- Create VRF, put interface in vrf, add IP address to interface
- Setup flow-accounting with sflow
set system flow-accounting buffer-size 64 set system flow-accounting disable-imt set system flow-accounting vrf <vrf name> set system flow-accounting interface <interface name> set system flow-accounting sflow agent-address <IP from vrf/interface> set system flow-accounting sflow sampling-rate 100 set system flow-accounting sflow server <sflow collector IP> port 6343
Commit and see error described above
Using an IP from non-vrf interface works but may not be the best describing IP for the sflow agent.
[1] https://docs.vyos.io/en/equuleus/configuration/system/flow-accounting.html