The upgrade to Netbox 3.2 brings Custom Model Validation:
As it was only supported on custom fields until now.
We should leverage this new feature to prevent entry mistakes.
Next step is to list all the fields that require custom validation and their expected patterns.
Wishlist from T310590#8083821 plus extra:
- site.slug: lower case, maybe also 5 chars?
- device.name: valid hostname (not FQDN, so no dots) regex,
- device.name: if a 4 digit number is present the first digit must match the DC's digit prefix rule (eqiad => 1, etc.) - https://gerrit.wikimedia.org/r/c/operations/software/netbox-extras/+/917876
- device.asset_tag: custom WMF asset tag regex, to be removed from reports
virtual_chassis.domain: FQDN regex (unless already validated by netbox)- we're not going to add new VCs so that's not worth the effort.
- port/interfaces names:
- console_port.name: unclear from the data, most have console0, some console-re[0-1], Ripe atlas devices have different values
- console_server_port.name: port[1-9][0-9]?
- power_port.name: PSU[1-2] (the current report checks for PSU\d|PEM \d|Power Supply \d, we still need all of them?)
- power_outlet.name: a positive integer - https://gerrit.wikimedia.org/r/c/operations/software/netbox-extras/+/917876
- interface.name: see the INTERFACES_REGEXP in the current report
- cables not specific enough