Unable to Delete a Logical switch attached to Transport zone from NSX manager 2.3.1.0 or 3.2.X GUI OR through API request.
book
Article ID: 325715
calendar_today
Updated On:
Products
VMware NSX
Issue/Introduction
Symptoms:
Attempt to delete an NSX-T 2.3 logical switch fails with an error similar to the following:
Logical switch delete failed: One or more relationships exist for object with id Logical Switch/d6ec54f9-71ee-4164-a134-95c7d16d833d. (Error code: 3022)
The Logical Switch has no logical ports, ESXi Bridge Clusters, ESXi Bridge Profiles nor DCHP servers attached.
Attempt to delete an NSX-T 3.2.3 logical switch via GUI is greyed out
Environment
VMware NSX-T Data Center 2.x VMware NSX-T Data Center VMware NSX-T Data Center 3.2.x
Cause
Possible cause of this error is that Logical switch that you are trying to delete is either applied to IPFIX Switch Profile or IPFIX DFW Profile under Tools>IPFIX section. When there is a vRNI IPFIX profile in the NSX-T configuration, the logical switches are added to the profile automatically after 10 or 15 minutes: "All the logical switches present in NSX-T are appended in the IPFIX profile within 10-15 minutes."
Also, if the logical switch is selected and used in DFW, Edge Firewall rule or FW Exclusion list you will see the error mentioned above.
This same use case and error is applicable for Logical Port and NS groups.
Stale entry of logical port which was part of the logical switch previously
Resolution
Workaround 1:
Remove the affected logical switch from the IPFIX profile:
Go to Networking / Switching / Click on the affected logical switch / Click on Overview
Copy the ID of the switch, the ID looks similar to this: aea74e40-b8ab-4767-96e4-cdc5aff1ff2e
On the main panel (left side), click on search and paste the ID of the logical switch. This will return all of the objects associated to it.
Detach the logical switch from the profile.
The attempt to delete the logical switch should be successful at this point.
Workaround 2:
If the delete icon is greyed out in NSX GUI we need to run the below API call in any one of the NSX manager node:
To obtain the details of the logical switch: curl -k -X -H "Content-Type: application/json" -H "X-Allow-Overwrite: true" GET https://localhost/api/v1/logical-switches/<UUID of logical switch> -u admin
To delete the logical switch: curl -k -X -H "Content-Type: application/json" -H "X-Allow-Overwrite: true" DELETE https://localhost/api/v1/logical-switches/<UUID of logical switch> -u admin