Skip to content

Change of Mac addresses not possible via API #18415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MedPlex98 opened this issue Jan 16, 2025 · 3 comments
Closed

Change of Mac addresses not possible via API #18415

MedPlex98 opened this issue Jan 16, 2025 · 3 comments
Labels
status: duplicate This issue has already been raised type: bug A confirmed report of unexpected behavior in the application

Comments

@MedPlex98
Copy link

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.

@MedPlex98 MedPlex98 added status: needs triage This issue is awaiting triage by a maintainer type: bug A confirmed report of unexpected behavior in the application labels Jan 16, 2025
@bctiemann bctiemann added status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation severity: medium Results in substantial degraded or broken functionality for specfic workflows and removed status: needs triage This issue is awaiting triage by a maintainer labels Jan 16, 2025
@atownson
Copy link
Contributor

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
Copy link
Contributor

Actually, this is already fixed under #18363.

@jeremystretch
Copy link
Member

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

@jeremystretch jeremystretch added status: duplicate This issue has already been raised and removed status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation severity: medium Results in substantial degraded or broken functionality for specfic workflows labels Jan 16, 2025
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: duplicate This issue has already been raised type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

4 participants