+ * Remove a Port from a Bridge
+ * <pre>
+ *
+ * Example :
+ *
+ * Request :
+ * DELETE
+ * http://localhost:8080/controller/nb/v2/networkconfig/bridgedomain/port/STUB/mgmt1/bridge1/port1
+ *
+ *</pre>
+ * @param nodeType Node Type of the node with the management session.
+ * @param nodeId Node Identifier of the node with the management session.
+ * @param bridgeName Name / Identifier of the bridge to which a Port is being added.
+ * @param portName Name / Identifier of a Port that is being deleted from a bridge.
+ */
+
+ @Path("/port/{nodeType}/{nodeId}/{bridgeName}/{portName}")
+ @DELETE
+ @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+ @StatusCodes( { @ResponseCode(code = 200, condition = "Port deleted successfully"),
+ @ResponseCode(code = 404, condition = "Could not delete Port to the Bridge"),
+ @ResponseCode(code = 412, condition = "Failed to delete Port due to an exception"),
+ @ResponseCode(code = 503, condition = "Bridge Domain Configuration Service not available")} )
+
+ public Response deletePort(
+ @PathParam(value = "nodeType") String nodeType,
+ @PathParam(value = "nodeId") String nodeId,
+ @PathParam(value = "bridgeName") String bridge,
+ @PathParam(value = "portName") String port) {
+
+ IBridgeDomainConfigService configurationService = getConfigurationService();
+ if (configurationService == null) {
+ throw new ServiceUnavailableException("IBridgeDomainConfigService not available.");
+ }
+
+ Node node = Node.fromString(nodeType, nodeId);
+ Status status = null;
+ try {
+ status = configurationService.deletePort(node, bridge, port);
+ if (status.getCode().equals(StatusCode.SUCCESS)) {
+ return Response.status(Response.Status.OK).build();
+ }
+ } catch (Exception t) {
+ return Response.status(Response.Status.PRECONDITION_FAILED).build();
+ }
+ throw new ResourceNotFoundException(status.getDescription());
+ }
+
+ private Map<ConfigConstants, Object> buildConfig(Map<String, Object> rawConfigs) {
+ if (rawConfigs == null) return null;
+ Map<ConfigConstants, Object> configs = new HashMap<ConfigConstants, Object>();
+ for (String key : rawConfigs.keySet()) {
+ ConfigConstants cc = ConfigConstants.valueOf(key.toUpperCase());
+ configs.put(cc, rawConfigs.get(key));
+ }
+ return configs;
+ }
+/**