get_config method of switch session type is gross
Concretely, It dumps a config file, which implies that the switch has a configuration that works just like the dell & nexus switches. This is a bit more implementation detail than I'm comfortable exposing. I'd like to find a way to make this separation a bit cleaner.
One relatively simple adjustment would be to hide it behind a switch capability, so that not all switches necessarily need to implement it.
Open to discussion on this.
This came up in the comments on #911.
which implies that the switch has a configuration that works just like the dell & nexus switches
I thought all switches have the concept of running-configs and startup-configs. Have you worked with a switch that doesn't have it?
The only purpose of this method is to see if the switch is actually saving the configuration to flash memory. Other things we could test instead of checking the whole config file is:
-
set a few vlans on an interface (or a couple). And then get the vlans from the running config (which we already do) and compare it against the interface config from the startup-config (slightly trickier to implement). But this isn't that much better than what we already do.
-
Get the timestamp of when the config file was last written to flash. Don't know if every switch supports this though.
On reflection, I guess I'm OK with the idea in the abstract, but the interface could use some work; the contract is very under-specified; I wouldn't know from reading the docstring what I needed to do when writing a new driver. I think the only real constraint on the return value is that it's comparable for equality, but we should verify that and document it.