Two Prefixes created in Custom Script, one with given VLAN and VRF, one in VRF Global #22121
Replies: 1 comment
-
|
Since this is a direct follow-up to the original custom script/prefix creation discussion, I’m going to close this one so we can keep the full context in one place. Please continue in #22069, which I’ve reopened. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In Netbox v4.6.9 I create in Custom Script a Prefix with code:
corporate_prefix = Prefix(
prefix=data["corporate_ipsubnet"],
scope=site,
vlan=corporate_vlan,
)
corporate_prefix.full_clean()
corporate_prefix.save()
i.e. within a specific site, with a specific VLAN and a specific (non-default) VLAN.
This results in two "versions" of this prefix being created, see screenshot below (let us look at the corporate prefix 10.11.23.0/24 in VRF corporate, VLAN 2099, in this case):
When I attempt to tlelete the above corporate prefix 10.11.23.0/24 in VRF Global with the below code, I get the following error for the Prefix.objects.get statement:
An exception occurred: FieldError: Field 'scope' does not generate an automatic reverse relation and therefore cannot be used for reverse querying. If it is a GenericForeignKey, consider adding a GenericRelation.
corporate_prefix_no_vrf_vlan = Prefix.objects.get(
prefix=data["corporate_ipsubnet"],
scope=site,
vlan=None,
vrf=None,
)
Requests for assistance:
Beta Was this translation helpful? Give feedback.
All reactions