Replies: 2 comments 1 reply
-
This also happens with the BGP plugin but it's nothing to do with the plugin. When adding a BGP sessions I am unable to validate the import/export policies. These object attributes, like the route target attributes in my VRF example above, are simply missing from the object passed to the custom validator function. I believe this is happening because just as a VRF has a 1:N relationship with RTs, BGP sessions have a 1:N relationship with import/export policies. In this case when an obj has a 1:N relationship, the list of those foreign objects aren't passed to the custom validator function. What I think is happening is that NetBox creates the VRF, or BGP session, or whatever, and then makes the relationships to the foreign objects (RTs in the case of VRFs of import/export policies in the case of the BGP session), as a second step. Is it possible that somehow we can get these objects passed to the obj bassed to the validator function? |
Beta Was this translation helpful? Give feedback.
-
Just hit the same wall, when trying to validate semantic tags. I've build
and applied it to |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am using custom validators. They are working fine for basic checks.
I am now trying to add some custom validation to VRFs. If I do a simple
print(vars(instance))
to see what is passed to thevalidate()
function in my custom validator class, I see the following:In the above output, I am editing an existing VRF, but the same applies when creating a new one; the
import_targets
andexport_targets
values aren't present in the instance. They are only present under_prechange_snapshot
, which is only present if you are editing an existing VRF, so in the case you are adding a new VRF,_prechange_snapshot
isn't there at all. Even so,_prechange_snapshot
is showing you what they were, not what they are now, so in either case (new or existing VRF), theinstance
object passed to the validator function is missing the two route target lists.How can one validate which RTs are being added/edited against a VRF?
Beta Was this translation helpful? Give feedback.
All reactions