Skip to content

Updating Interface.tagged_vlans via API improperly allowed on interface with mode: tagged-all #15924

@radek-senfeld

Description

@radek-senfeld

Deployment Type

Self-hosted

NetBox Version

v3.7.5, 4.0.3

Python Version

3.9

Steps to Reproduce

  • Choose any interface.
  • Set the interface's 801.1Q Mode to Tagged (all) (in API terms, "mode": "tagged-all")
  • Use a PATCH request to set a non-empty value for the interface's tagged_vlans property
  • Use a second PATCH request to change only the interface's description property, leaving tagged_vlans and untagged_vlans out of the patch
  • Retrieve the interface via the API.
$ curl -X PATCH -H "Content-type: application/json"  -H "Accept: application/json" -H "Authorization: Token $TOKEN"  http://localhost/api/dcim/interfaces/1/  --data '{"description": "Patching the description and tagged_vlans", "tagged_vlans": [ 1 ] }'

$ curl -X PATCH -H "Content-type: application/json"  -H "Accept: application/json" -H "Authorization: Token $TOKEN"  http://localhost/api/dcim/interfaces/1/  --data '{"description": "Patching the description only" }'

Expected Behavior

The first PATCH should be rejected with an API error message indicating that setting tagged_vlan is not allowed on an interface with "mode": "tagged_all".

Observed Behavior

The first (invalid) PATCH is accepted, and reflected as specified. The second (valid) PATCH is accepted, and results in the unexpected obliteration of the tagged_vlan result.

Metadata

Metadata

Assignees

Labels

netboxseverity: lowDoes not significantly disrupt application functionality, or a workaround is availablestatus: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions