Update device based on validity
Hey! Since we're going to use your plugin, we would already have all the information about the device. Would it be possible to reuse that as an update source for NetBox? Let me give you an example: we have a switch where we changed the config on the switch itself, but no one updated NetBox. The configuration in validity already has a nice, user-friendly view. Could we somehow reuse that to update the device in NetBox?
Hey @berlikm,
If I got you right, you're talking about some sort of auto-reconciliation: when Validity detects some failed tests, it triggers some workflow which looks at failed tests and then changes devices configuarion to fix that.
Well, in theory I do can imagine such a system, but it would be technically difficult to implement
Since we can see a readable format of the interface configuration, I thought of using that data to update the NetBox device itself. So, let's say I have an interface configuration with an IP address (from the configuration). I would then like to create such an interface in the NetBox device.
Yeah, this sounds easier. I suppose you can create netbox custom script and bind it to an event rule which is triggered on data source update.
Here is a snippet to access the config dict for a particular device:
from validity.models import VDevice
d1 = VDevice.objects.get(name='d1')
assert d1.config == {"interfaces": [{"name": "ge-0/0/0", "address": "1.2.3.4/29"}]}