New prefix is not associated to the given VRF #8865

Closed
opened 2025-12-29 20:42:18 +01:00 by adam · 1 comment
Owner

Originally created by @AJNOURI on GitHub (Nov 21, 2023).

NetBox version

v3.4.7

Python version

3.10

Steps to Reproduce

The goal is to create a new prefix ans associate existing network ressources, vhf, clan, site, tenant, ...
Using API swagger:

image

Here is the input
inputs:

{
    "description": "prefix_nbr_1",
    "prefix_length": 28,
    "tags": [
        617,
        635,
        506
    ],
    "vlan": 4119,
    "vrf": 1483,
    "role": 170,
    "family": "ipv4",
    "is_pool": false,
    "site": 3,
    "tenant": 33
}

id prefix parent = 7570

The request :

curl -X 'POST' \
  'https://XXXX/netbox/api/ipam/prefixes/7570/available-prefixes/' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer XXXX' \
  -H 'Content-Type: application/json' \
  -H 'X-CSRFToken: XXXX' \
  -d '{
    "description": "prefix_nbr_1",
    "prefix_length": 28,
    "tags": [
        617,
        635,
        506
    ],
    "vlan": 4119,
    "vrf": 1483,
    "role": 170,
    "family": "ipv4",
    "is_pool": false,
    "site": 3,
    "tenant": 33
}'

The result:

{
  "id": 9148,
  "url": "https://XXX/netbox/api/ipam/prefixes/9148/",
  "display": "X.X.16.0/28",
  "family": {
    "value": 4,
    "label": "IPv4"
  },
  "prefix": "X.X.16.0/28",
  "site": {
    "id": 3,
    "url": "https://XXX/netbox/api/dcim/sites/3/",
    "display": "XXX",
    "name": "XXX",
    "slug": "XXX"
  },
  "vrf": null,
  "tenant": {
    "id": 33,
    "url": "https://XXX/netbox/api/tenancy/tenants/33/",
    "display": "xxx",
    "name": "xxx",
    "slug": "xxx"
  },
  "vlan": {
    "id": 4119,
    "url": "https://XXX/netbox/api/ipam/vlans/4119/",
    "display": "XXX(101)",
    "vid": 101,
    "name": "XXX"
  },
  "status": {
    "value": "active",
    "label": "Active"
  },
  "role": {
    "id": 170,
    "url": "https://XXX/netbox/api/ipam/roles/170/",
    "display": "intercos",
    "name": "intercos",
    "slug": "intercos"
  },
  "is_pool": false,
  "mark_utilized": false,
  "description": "prefix_nbr_1\"",
  "comments": "",
  "tags": [
    {
      "id": 506,
      "url": "https://XXX/netbox/api/extras/tags/506/",
      "display": "A256",
      "name": "A256",
      "slug": "a256",
      "color": "9e9e9e"
    },
    {
      "id": 635,
      "url": "https://XXX/netbox/api/extras/tags/635/",
      "display": "xxx",
      "name": "xxx",
      "slug": "xxx",
      "color": "9e9e9e"
    },
    {
      "id": 617,
      "url": "https://XXX/netbox/api/extras/tags/617/",
      "display": "xxx",
      "name": "xxx",
      "slug": "xxx",
      "color": "9e9e9e"
    }
  ],
  "custom_fields": {},
  "created": "2023-11-21T15:34:14.726429+01:00",
  "last_updated": "2023-11-21T15:34:14.726470+01:00",
  "children": 0,
  "_depth": 1
}

Expected Behavior

In the GUI, I am executing the VRF to be associated to the new prefix, not "global".

Observed Behavior

But, the result in GUI show "global"

image
Originally created by @AJNOURI on GitHub (Nov 21, 2023). ### NetBox version v3.4.7 ### Python version 3.10 ### Steps to Reproduce The goal is to create a new prefix ans associate existing network ressources, vhf, clan, site, tenant, ... Using API swagger: <img width="1508" alt="image" src="https://github.com/netbox-community/netbox/assets/1716020/57650eff-e6f1-4d19-a3c9-799211451390"> Here is the input inputs: ``` { "description": "prefix_nbr_1", "prefix_length": 28, "tags": [ 617, 635, 506 ], "vlan": 4119, "vrf": 1483, "role": 170, "family": "ipv4", "is_pool": false, "site": 3, "tenant": 33 } ``` id prefix parent = 7570 The request : ``` curl -X 'POST' \ 'https://XXXX/netbox/api/ipam/prefixes/7570/available-prefixes/' \ -H 'accept: application/json' \ -H 'Authorization: Bearer XXXX' \ -H 'Content-Type: application/json' \ -H 'X-CSRFToken: XXXX' \ -d '{ "description": "prefix_nbr_1", "prefix_length": 28, "tags": [ 617, 635, 506 ], "vlan": 4119, "vrf": 1483, "role": 170, "family": "ipv4", "is_pool": false, "site": 3, "tenant": 33 }' ``` The result: ``` { "id": 9148, "url": "https://XXX/netbox/api/ipam/prefixes/9148/", "display": "X.X.16.0/28", "family": { "value": 4, "label": "IPv4" }, "prefix": "X.X.16.0/28", "site": { "id": 3, "url": "https://XXX/netbox/api/dcim/sites/3/", "display": "XXX", "name": "XXX", "slug": "XXX" }, "vrf": null, "tenant": { "id": 33, "url": "https://XXX/netbox/api/tenancy/tenants/33/", "display": "xxx", "name": "xxx", "slug": "xxx" }, "vlan": { "id": 4119, "url": "https://XXX/netbox/api/ipam/vlans/4119/", "display": "XXX(101)", "vid": 101, "name": "XXX" }, "status": { "value": "active", "label": "Active" }, "role": { "id": 170, "url": "https://XXX/netbox/api/ipam/roles/170/", "display": "intercos", "name": "intercos", "slug": "intercos" }, "is_pool": false, "mark_utilized": false, "description": "prefix_nbr_1\"", "comments": "", "tags": [ { "id": 506, "url": "https://XXX/netbox/api/extras/tags/506/", "display": "A256", "name": "A256", "slug": "a256", "color": "9e9e9e" }, { "id": 635, "url": "https://XXX/netbox/api/extras/tags/635/", "display": "xxx", "name": "xxx", "slug": "xxx", "color": "9e9e9e" }, { "id": 617, "url": "https://XXX/netbox/api/extras/tags/617/", "display": "xxx", "name": "xxx", "slug": "xxx", "color": "9e9e9e" } ], "custom_fields": {}, "created": "2023-11-21T15:34:14.726429+01:00", "last_updated": "2023-11-21T15:34:14.726470+01:00", "children": 0, "_depth": 1 } ``` ### Expected Behavior In the GUI, I am executing the VRF to be associated to the new prefix, not "global". ### Observed Behavior But, the result in GUI show "global" <img width="1269" alt="image" src="https://github.com/netbox-community/netbox/assets/1716020/705308d0-36b1-4710-87fe-327fa40cf265">
adam closed this issue 2025-12-29 20:42:18 +01:00
Author
Owner

@jeremystretch commented on GitHub (Nov 22, 2023):

NetBox does not support assigning a VRF different from the parent prefix when assigning a new prefix automatically from available space. The child prefix will inherit whatever VRF the parent is assigned to, if any.

If you'd like to propose this functionality, please submit a feature request citing your use case and detailed operational requirements. Thanks!

@jeremystretch commented on GitHub (Nov 22, 2023): NetBox does not support assigning a VRF different from the parent prefix when assigning a new prefix automatically from available space. The child prefix will inherit whatever VRF the parent is assigned to, if any. If you'd like to propose this functionality, please submit a [feature request](https://github.com/netbox-community/netbox/issues/new?assignees=&labels=type%3A+feature&projects=&template=feature_request.yaml) citing your use case and detailed operational requirements. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8865