Details
- Reviewers
ngie zlei - Group Reviewers
network tests - Commits
- rGa8b8feced998: atf_python/vnet: Make it possible to set the FIB of vnet interfaces
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
| tests/atf_python/sys/net/vnet.py | ||
|---|---|---|
| 146 | The 0 is a perfect valid fib number. Why not supporting setting fib 0 ? | |
| tests/atf_python/sys/net/vnet.py | ||
|---|---|---|
| 60 | Setting a default here would be wise: that allows you to skip a lot of the baked-in defaults elsewhere in the diff. Other considerations:
| |
| 146 | No need for an explicit test, per PEP8. | |
| 380–386 | General comment: using dict.get with hardcoded defaults sprinkled around instead of using explicit property variables adds a lot of fragile complexity in this module (and other API consumers):
| |
| tests/atf_python/sys/net/vnet.py | ||
|---|---|---|
| 146 | Only because that's the default. But yes we could set it unconditionally. The only downside is an extra fork+exec per interface (which isn't free when running tests under QEMU). | |
| tests/atf_python/sys/net/vnet.py | ||
|---|---|---|
| 383 | What's the purpose of checking for negative values here? setfib(1) will fail if given an invalid FIB. | |
| tests/atf_python/sys/net/vnet.py | ||
|---|---|---|
| 383 |
I meant this, to avoid "an extra fork+exec per interface", def setfib(self, fib: int): if fib >= 0: cmd = "/sbin/ifconfig {} fib {}".format(self.name, fib) self.run_cmd(cmd) | |
| 383 |
Or probably a better choice, check the key "fib" exists, and then call iface.setfib(). if "fib" in topo[iface.alias]: fib = topo[iface.alias].get("fib") iface.setfib(fib[idx]) That avoids "an extra fork+exec per interface", and can also raise errors if bad config is passed in, say a negative FIB. | |
| tests/atf_python/sys/net/vnet.py | ||
|---|---|---|
| 383 | Thanks, I see. I think that's a good idea. | |
Looks good to me.
| tests/atf_python/sys/net/vnet.py | ||
|---|---|---|
| 384 | A nit. Given we have checked the existence of the key "fib", I think the default value is no longer needed, but is somewhat misleading. | |
| tests/atf_python/sys/net/vnet.py | ||
|---|---|---|
| 384 | This is the only item that could stand to be fixed in this diff. | |
| 431–432 | nitpick for another diff/time to avoid the extra indentation (all subsequent lines in the for-loop would need to be dedented one level OFC).. | |
| 441 | Sentinel values like this should be made into constants for readability and maintainability. | |
| 449 | Hanging systemwide subprocess calls off this object is an interesting choice... | |