API POST request tries to change 'form_factor' of interface without the change being in JSON #1981

Closed
opened 2025-12-29 17:21:08 +01:00 by adam · 5 comments
Owner

Originally created by @pm17788 on GitHub (Aug 31, 2018).

Environment

  • Python version: 3.5.2
  • NetBox version: 2.4.4

Steps to Reproduce

PATCH with {"description":"Some string there"}

Expected Behavior

PATCH request to succeed.

Observed Behavior

Error is output about trying to change the form_factor of the NIC in question.

curl -X GET "https://netbox.DOMAIN/api/dcim/interfaces/6936984/" -H  "accept: application/json" -H  "X-CSRFToken: <SANITIZED>"
{
  "id": 6936984,
  "device": {
    "id": 392724,
    "url": "https://netbox.DOMAIN/api/dcim/devices/392724/",
    "name": "server892",
    "display_name": "server892"
  },
  "name": "bond0",
  "form_factor": {
    "value": 1200,
    "label": "SFP+ (10GE)"
  },
  "enabled": true,
  "lag": null,
  "mtu": 1,
  "mac_address": null,
  "mgmt_only": false,
  "description": "Interface 'bond0' on host 'server892'",
  "is_connected": false,
  "interface_connection": null,
  "circuit_termination": null,
  "mode": null,
  "untagged_vlan": null,
  "tagged_vlans": [],
  "tags": []
}

curl -X PATCH "https://netbox.DOMAIN/api/dcim/interfaces/6936984/" -H  "accept: application/json" -H  "Content-Type: application/json" -H  "X-CSRFToken: <SANITIZED>" -d "{\"description\": \"Interface 'bond0' on host 'server892'\"}"
{
  "non_field_errors": [
    "Cannot change interface form factor; it has LAG members (eth0, eth1)."
  ]
}
Originally created by @pm17788 on GitHub (Aug 31, 2018). ### Environment * Python version: 3.5.2 * NetBox version: 2.4.4 ### Steps to Reproduce PATCH with `{"description":"Some string there"}` ### Expected Behavior PATCH request to succeed. ### Observed Behavior Error is output about trying to change the `form_factor` of the NIC in question. ``` curl -X GET "https://netbox.DOMAIN/api/dcim/interfaces/6936984/" -H "accept: application/json" -H "X-CSRFToken: <SANITIZED>" { "id": 6936984, "device": { "id": 392724, "url": "https://netbox.DOMAIN/api/dcim/devices/392724/", "name": "server892", "display_name": "server892" }, "name": "bond0", "form_factor": { "value": 1200, "label": "SFP+ (10GE)" }, "enabled": true, "lag": null, "mtu": 1, "mac_address": null, "mgmt_only": false, "description": "Interface 'bond0' on host 'server892'", "is_connected": false, "interface_connection": null, "circuit_termination": null, "mode": null, "untagged_vlan": null, "tagged_vlans": [], "tags": [] } curl -X PATCH "https://netbox.DOMAIN/api/dcim/interfaces/6936984/" -H "accept: application/json" -H "Content-Type: application/json" -H "X-CSRFToken: <SANITIZED>" -d "{\"description\": \"Interface 'bond0' on host 'server892'\"}" { "non_field_errors": [ "Cannot change interface form factor; it has LAG members (eth0, eth1)." ] } ```
adam closed this issue 2025-12-29 17:21:08 +01:00
Author
Owner

@lampwins commented on GitHub (Sep 2, 2018):

This error is being thrown here and as you can see it seems to have reason to believe this interface has LAG members, while it's form factor is not IFACE_FF_LAG. Can you verify this in the nbshell?

>>> interface = Interface.objects.get(id=6936984)
>>> interface.member_interfaces.all()

Seeing members interfaces would indicate some sort of data manipulation outside of the application. Perhaps at the database level directly.

@lampwins commented on GitHub (Sep 2, 2018): This error is being thrown [here](https://github.com/digitalocean/netbox/blob/dbbf7ab66453c96dad2b66434afe91e2ddba0291/netbox/dcim/models.py#L1907) and as you can see it seems to have reason to believe this interface has LAG members, while it's form factor is not `IFACE_FF_LAG`. Can you verify this in the nbshell? ```$ python manage.py nbshell >>> interface = Interface.objects.get(id=6936984) >>> interface.member_interfaces.all() ``` Seeing members interfaces would indicate some sort of data manipulation outside of the application. Perhaps at the database level directly.
Author
Owner

@pm17788 commented on GitHub (Sep 4, 2018):

@lampwins: Good call. When I change the NIC's form_factor to LAG, the LAG memebers show up.

The only data manipulation we do is via the API or the WebUI. However, part of the upgrade procedure (this installation started life from NetBox 2.2.7 and has been incrementally upgraded as updates came out) does do things with SQL, so I cannot help but wonder if I somehow caused the upgrade process make this change?

@pm17788 commented on GitHub (Sep 4, 2018): @lampwins: Good call. When I change the NIC's `form_factor` to LAG, the LAG memebers show up. The only data manipulation we do is via the API or the WebUI. However, part of the upgrade procedure (this installation started life from NetBox 2.2.7 and has been incrementally upgraded as updates came out) does do things with SQL, so I cannot help but wonder if I somehow caused the upgrade process make this change?
Author
Owner

@pm17788 commented on GitHub (Sep 4, 2018):

I suspect that this is related to #2391

@pm17788 commented on GitHub (Sep 4, 2018): I *suspect* that this is related to #2391
Author
Owner

@pm17788 commented on GitHub (Sep 5, 2018):

@lampwins: To me, it seems wrong that I'm getting what appears to be an uncommanded change request - the JSON doesn't contain a form_factor change.

@pm17788 commented on GitHub (Sep 5, 2018): @lampwins: To me, it seems wrong that I'm getting what appears to be an uncommanded change request - the JSON doesn't contain a `form_factor` change.
Author
Owner

@jeremystretch commented on GitHub (Sep 5, 2018):

You're getting the error because the object is failing validation when saving. Remove the LAG member assignments and it will work. The root cause is that LAG members have somehow been assigned to a non-LAG interface. This would require a new bug to address, but please open one only if you can provide the exact steps someone else can take to recreate the issue.

@jeremystretch commented on GitHub (Sep 5, 2018): You're getting the error because the object is failing validation when saving. Remove the LAG member assignments and it will work. The root cause is that LAG members have somehow been assigned to a non-LAG interface. This would require a new bug to address, but please open one _only_ if you can provide the exact steps someone else can take to recreate the issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1981