sflow / vpp-sflow

sFlow plugin for VPP
Apache License 2.0
6 stars 0 forks source link

Python test script #10

Open sflow opened 1 month ago

sflow commented 1 month ago

It looks like it would be fairly straightforward to add a python test script that:

(1) enables sFlow with sampling-rate 1 and polling-interval 1 (2) sends a packet (3) waits a second or so (4) examines the output from "show sflow" to confirm that we have 1 packet sample and either 1 or 2 counter samples (5) turns off sflow again

Does that make sense?

(That would have been enough to catch the problem in issue #9, at least.)

We could expand on it later to include:

sflow commented 1 month ago

Added test/test_sflow.py. Adapted from an example in the VPP documentation. It does the first few steps above. It's not clear what sort of warning we should raise if mod_psample has not been loaded into the kernel. It seems like the test should not require that step. On a production VPP device the modprobe might only be done at boot time, so arguably it's out of scope for the VPP test suite? Otherwise we might have to check in something like the github.com/sflow/psampletest code just so a test can use it to verify the NetLink output...

...OK so maybe that doesn't sound completely crazy, but I'm hoping we don't have to go there for now.

The part that is most likely to need maintenance in the future is probably the VAPI query to linux-cp, so may need to learn how a test for one plugin can require that another be loaded.