VRF ignored when creating available_prefixes from a parent(container) prefix #6577

Closed
opened 2025-12-29 19:42:35 +01:00 by adam · 4 comments
Owner

Originally created by @AJNOURI on GitHub (Jun 20, 2022).

NetBox version

v3.2.2

Python version

3.9

Steps to Reproduce

This behavior applies to both versions:

  • 2.8.9
  • 3.2.2

1- Create child prefix from Netbox API

curl -X POST "https://netboxxxxxxxxxxxxxxx/api/ipam/prefixes/1160/available-prefixes/" -H "accept: application/json" -H "Content-Type: application/json" -H "X-CSRFToken: XXXXWPxN5UaJuzcV" -d "{ \"prefix_length\": 20, \"vrf\": 58, \"vlan\": 345}"
image

And the response:

{
  "id": 1239,
  "url": "https://netboxxxxxxxxxxxxxxx/api/ipam/prefixes/1239/",
  "display": "X.X.240.0/20",
  "family": {
    "value": 4,
    "label": "IPv4"
  },
  "prefix": "X.X.240.0/20",
  "site": null,
  "vrf": null,
  "tenant": null,
  "vlan": {
    "id": 345,
    "url": "https://netboxxxxxxxxxxxxxxx/api/ipam/vlans/345/",
    "display": "vlan123 (123)",
    "vid": 123,
    "name": "vlan123"
  },
  "status": {
    "value": "active",
    "label": "Active"
  },
  "role": null,
  "is_pool": false,
  "mark_utilized": false,
  "description": "",
  "tags": [],
  "custom_fields": {
    "community": null
  },
  "created": "2022-06-23T17:59:53.733198+02:00",
  "last_updated": "2022-06-23T17:59:53.733231+02:00",
  "children": 0,
  "_depth": 0
}

Response headers
2- The prefix is created with all the attributes except the VRF (it takes the same VRF as the container)
A work around is to push the VRF in a second step:

  • Get the created prefix
  • Modify its VRF attribut
  • run the object method save()

Expected Behavior

It is expected that the child prefix is created using the passed attributes, including VRF (58).

Observed Behavior

The created Childprefix ignores the passed VRF (null) and takes the VRF of the parent container.

Originally created by @AJNOURI on GitHub (Jun 20, 2022). ### NetBox version v3.2.2 ### Python version 3.9 ### Steps to Reproduce This behavior applies to both versions: - 2.8.9 - 3.2.2 ------- 1- Create child prefix from Netbox API `curl -X POST "https://netboxxxxxxxxxxxxxxx/api/ipam/prefixes/1160/available-prefixes/" -H "accept: application/json" -H "Content-Type: application/json" -H "X-CSRFToken: XXXXWPxN5UaJuzcV" -d "{ \"prefix_length\": 20, \"vrf\": 58, \"vlan\": 345}" ` ![image](https://user-images.githubusercontent.com/1716020/175346487-0234539a-c20e-4c20-84d6-0d2b9f951798.png) And the response: ``` { "id": 1239, "url": "https://netboxxxxxxxxxxxxxxx/api/ipam/prefixes/1239/", "display": "X.X.240.0/20", "family": { "value": 4, "label": "IPv4" }, "prefix": "X.X.240.0/20", "site": null, "vrf": null, "tenant": null, "vlan": { "id": 345, "url": "https://netboxxxxxxxxxxxxxxx/api/ipam/vlans/345/", "display": "vlan123 (123)", "vid": 123, "name": "vlan123" }, "status": { "value": "active", "label": "Active" }, "role": null, "is_pool": false, "mark_utilized": false, "description": "", "tags": [], "custom_fields": { "community": null }, "created": "2022-06-23T17:59:53.733198+02:00", "last_updated": "2022-06-23T17:59:53.733231+02:00", "children": 0, "_depth": 0 } ``` Response headers 2- The prefix is created with all the attributes except the VRF (it takes the same VRF as the container) A work around is to push the VRF in a second step: > - Get the created prefix > - Modify its VRF attribut > - run the object method save() ### Expected Behavior It is expected that the child prefix is created using the passed attributes, including VRF (58). ### Observed Behavior The created Childprefix ignores the passed VRF (null) and takes the VRF of the parent container.
adam added the type: bugstatus: revisions needed labels 2025-12-29 19:42:35 +01:00
adam closed this issue 2025-12-29 19:42:35 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jun 23, 2022):

Per the bug report instructions:

If reporting a bug in the REST API, be sure to reconstruct the raw HTTP request(s) being made: Don't rely on a client library such as pynetbox.

Please rewrite your post above to include reproduction instructions that do not rely on pynetbox. Please also upgrade to v3.2.5 and test again.

@jeremystretch commented on GitHub (Jun 23, 2022): Per the bug report instructions: > If reporting a bug in the REST API, be sure to reconstruct the raw HTTP request(s) being made: Don't rely on a client library such as pynetbox. Please rewrite your post above to include reproduction instructions that do not rely on pynetbox. Please also upgrade to v3.2.5 and test again.
Author
Owner

@AJNOURI commented on GitHub (Jun 23, 2022):

Hi @jeremystretch
Thanks for your reply.

I edited the post with request from the swagger of netbox itself.
Related to the version, unfortunately, these are the two version we are using for testing (3.2.2) and production (2.8.9).

@AJNOURI commented on GitHub (Jun 23, 2022): Hi @jeremystretch Thanks for your reply. I edited the post with request from the swagger of netbox itself. Related to the version, unfortunately, these are the two version we are using for **testing (3.2.2)** and **production (2.8.9)**.
Author
Owner

@AJNOURI commented on GitHub (Jun 24, 2022):

I'll find some time today to test it with the v3.2.5.

@AJNOURI commented on GitHub (Jun 24, 2022): I'll find some time today to test it with the v3.2.5.
Author
Owner

@jeremystretch commented on GitHub (Jul 19, 2022):

When creating child prefixes, the VRF of the parent is assigned automatically; it cannot be specified. This is intended behavior, as otherwise the new prefix would not exist within the specified parent.

@jeremystretch commented on GitHub (Jul 19, 2022): When creating child prefixes, the VRF of the parent is assigned automatically; it cannot be specified. This is intended behavior, as otherwise the new prefix would not exist within the specified parent.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6577