dropbox / nsot

Network Source of Truth is an open source IPAM and network inventory database
https://nsot.readthedocs.io
Other
398 stars 66 forks source link

Allow Interface.speed to be null #346

Closed nickpegg closed 5 years ago

nickpegg commented 5 years ago

To support the intention of an interface speed to be auto-negotiated, we need to be able to set the speed field to some value that indicates no explicit speed. This commit does so by changing the field to allow nulls.

This is a minor behavior change, notably because before this, setting speed to be None would cause a validation failure. The other behavior has been preserved, where omitting speed when creating an Interface still sets the default speed.

The unit tests have been updated the verify all of this behavior.

nickpegg commented 5 years ago

@therouterninja That's a good point! When updating the CLI for this, I found that it's hard to make it play well with this tri-state "int, NULL, or not specified" thing.

Just getting rid of the INTERFACE_DEFAULT_SPEED setting and defaulting to None would definitely reduce some complexity, but I'm afraid of breaking folks' workflows in that case though. A good middle-ground would be too leave this diff as-is and then change our setting in the Dropbox instance to default to None, so I'm going to proceed with that unless there are any objections.