Our current flow accounting CLI is a mess. There are reasons for it and it's no one's fault, but we need to fix that nonetheless.
How it became messy: in the old days when the OS was just recently forked from Vyatta and @dmbaturin wasn't bald yet and didn't need glasses [1], there was system flow-accounting subtree handled by a single flow-accounting.pl script that generated NetFlow and sFlow configs for pmacct.
The system flow-accounting tree had subtrees netflow and sflow and a bunch of shared options like enable-eggress that would apply to pmacct as a whole.
Pmacct development had slowed down and it was no longer fast enough for modern networks, so people kept asking for better solutions.
The first thing we did was to add a different sFlow implementation based on hsflowd (T5086). We weren't yet sure if it was a good enough long-term solution for sFlow and it was pretty difficult to rework the script of system flow-accounting to handle sFlow separately, so we bit the bullet and placed it in a different subtree alongside the old implementation. People could use set system flow-accounting sflow if they wanted to use pmacct or use set system sflow if they wanted to give the new implementation a try.
Then we started reworking NetFlow to move it from pmacct to ipt-netflow. That allowed us to remove pmacct from the system completely.
Now system flow-accounting contains:
- netflow for NetFlow options;
- enable-eggress that was formerly shared between sFlow and NetFlow but now only applies to NetFlow;
- vrf <name> option that is only used for verifying that the source address is assigned.
Unrelated to that, the reasons why it's system flow-accounting are purely historical. sFlow and NetFlow have nothing to do with typical system-wide settings placed in that subtree like system name-server, system host-name, or system option reboot-on-panic, and should have never been there.
What we should do:
In the CLI:
- Move "system flow-accounting" to "flow-accounting" (top-level node)
- Move "system flow-accounting enable-eggress" to "flow-accounting netflow enable-egress"
- Move "system flow-accounting vrf" to "flow-accounting netflow vrf" (if we need it at all)
- Move "system sflow" to "flow-accounting sflow"
In the code:
- Rename conf_mode/system_flow-accounting.py to flow-accounting_netflow.
- Rename system_sflow to flow-accounting_sflow.
And, obviously, update CLI versions and add migration script to move everything to the new places.
[1] Those were the days!