validity icon indicating copy to clipboard operation
validity copied to clipboard

Update device based on validity

Open berlikm opened this issue 2 months ago • 3 comments

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?

berlikm avatar Nov 02 '25 19:11 berlikm

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

amyasnikov avatar Nov 07 '25 22:11 amyasnikov

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.

berlikm avatar Nov 17 '25 10:11 berlikm

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"}]}

amyasnikov avatar Nov 17 '25 21:11 amyasnikov