Change of Mac addresses not possible via API #10660

Closed
opened 2025-12-29 21:34:24 +01:00 by adam · 3 comments
Owner

Originally created by @MedPlex98 on GitHub (Jan 16, 2025).

Deployment Type

Self-hosted

Triage priority

N/A

NetBox Version

v4.2.0

Python Version

3.10

Steps to Reproduce

  1. Check if Mac address exists:
    curl -k -s -H "Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -H "Content-Type: application/json" "https://10.4.4.58/api/dcim/mac-addresses/?mac_address=de:ad:0a:xx:xx:xx" | jq

Output:

{
  "count": 1,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": 1466,
      "url": "http://10.4.4.58/api/dcim/mac-addresses/1466/",
      "display_url": "http://10.4.4.58/dcim/mac-addresses/1466/",
      "display": "DE:AD:0A:xx:xx:xx",
      "mac_address": "DE:AD:0A:xx:xx:xx",
      "assigned_object_type": null,
      "assigned_object": null,
      "description": "",
      "comments": ""
    }
  ]
}
  1. Add the “assigned_object” info:
curl -k -X PATCH -s -H "Authorization: Token 

" -H "Content-Type: application/json" -d '{
  "assigned_object": {
    "id": 3247,
    "type": "virtualization.vminterface"
  }
}' "https://10.4.4.58/api/dcim/mac-addresses/1466/"

issue remains the same:

{
  "id": 1466,
  "url": "http://10.4.4.58/api/dcim/mac-addresses/1466/",
  "display_url": "http://10.4.4.58/dcim/mac-addresses/1466/",
  "display": "DE:AD:0A:xx:xx:xx",
  "mac_address": "DE:AD:0A:xx:xx:xx",
  "assigned_object_type": null,
  "assigned_object": null,
  "description": "",
  "comments": ""
}

Full Script: netbox_update.txt

Expected Behavior

The plan is for the patch command to enter the information to connect the Mac address to a VM and an interface.
This worked before the 4.2.0 update.

Observed Behavior

The patch command does not make any changes. The Mac address is not assigned to a VM or interface.

Originally created by @MedPlex98 on GitHub (Jan 16, 2025). ### Deployment Type Self-hosted ### Triage priority N/A ### NetBox Version v4.2.0 ### Python Version 3.10 ### Steps to Reproduce 1. Check if Mac address exists: `curl -k -s -H "Authorization: Token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -H "Content-Type: application/json" "https://10.4.4.58/api/dcim/mac-addresses/?mac_address=de:ad:0a:xx:xx:xx" | jq` Output: ``` { "count": 1, "next": null, "previous": null, "results": [ { "id": 1466, "url": "http://10.4.4.58/api/dcim/mac-addresses/1466/", "display_url": "http://10.4.4.58/dcim/mac-addresses/1466/", "display": "DE:AD:0A:xx:xx:xx", "mac_address": "DE:AD:0A:xx:xx:xx", "assigned_object_type": null, "assigned_object": null, "description": "", "comments": "" } ] } ``` 2. Add the “assigned_object” info: ``` curl -k -X PATCH -s -H "Authorization: Token " -H "Content-Type: application/json" -d '{ "assigned_object": { "id": 3247, "type": "virtualization.vminterface" } }' "https://10.4.4.58/api/dcim/mac-addresses/1466/" ``` issue remains the same: ``` { "id": 1466, "url": "http://10.4.4.58/api/dcim/mac-addresses/1466/", "display_url": "http://10.4.4.58/dcim/mac-addresses/1466/", "display": "DE:AD:0A:xx:xx:xx", "mac_address": "DE:AD:0A:xx:xx:xx", "assigned_object_type": null, "assigned_object": null, "description": "", "comments": "" } ``` Full Script: [netbox_update.txt](https://github.com/user-attachments/files/18441743/netbox_update.txt) ### Expected Behavior The plan is for the patch command to enter the information to connect the Mac address to a VM and an interface. This worked before the 4.2.0 update. ### Observed Behavior The patch command does not make any changes. The Mac address is not assigned to a VM or interface.
adam added the type: bugstatus: duplicate labels 2025-12-29 21:34:24 +01:00
adam closed this issue 2025-12-29 21:34:24 +01:00
Author
Owner

@atownson commented on GitHub (Jan 16, 2025):

I can work on this one. Most likely the intention is to PATCH the MAC Address like:

'{
  "assigned_object_type": "virtualization.vminterface",
  "assigned_object_id": 3247
}'

But the assigned_object_id field is missing.

@atownson commented on GitHub (Jan 16, 2025): I can work on this one. Most likely the intention is to PATCH the MAC Address like: ``` '{ "assigned_object_type": "virtualization.vminterface", "assigned_object_id": 3247 }' ``` But the `assigned_object_id` field is missing.
Author
Owner

@atownson commented on GitHub (Jan 16, 2025):

Actually, this is already fixed under #18363.

@atownson commented on GitHub (Jan 16, 2025): Actually, this is already fixed under #18363.
Author
Owner

@jeremystretch commented on GitHub (Jan 16, 2025):

Confirmed that this is a duplicate of #18363 and will be fixed in NetBox v4.2.2.

@jeremystretch commented on GitHub (Jan 16, 2025): Confirmed that this is a duplicate of #18363 and will be fixed in NetBox v4.2.2.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10660