Skip to content

Networks attachment - Update fails when all ports are removed from switch_ports #253

@mdmohan

Description

@mdmohan

It is seen that NDFC throws 500 Internal error if all ports are detached by sending "detachSwitchPorts"

{
    "path": "/rest/top-down/v2/fabrics/CML/networks/attachments",
    "Error": "Internal Server Error",
    "message": "Cannot read the array length because \"<local33>\" is null",
    "timestamp": "2025-12-16 11:59:41.889",
    "status": "500"

By design, the provider will not send any empty strings in json, and in this case as all ports were detached, switchPorts is not sent
However NDFC seems to require switchPorts to be empty, when all ports are detached.

Workaround this by sending switchPorts empty if all ports are detached

Working Payload

[{"networkName":"terraform-net01","lanAttachList":[{"fabric":"CML","fabricName":"CML","networkName":"terraform-net01","serialNumber":"9TQYTJSZ1VJ","displayName":"terraform-net01","vlan":"301","deployment":"true","switchPorts":"","detachSwitchPorts":"Ethernet1/17,Ethernet1/18","instanceValues":"{\"isVPC\":\"false\"}"}]}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions