@Test public void shouldDestroyNetwork() throws OpenStackException, IOException { when(openOperationUtil.executeNovaRequest(any(HttpUriRequest.class))).thenReturn("ok"); String response = openStackUtil.deleteNetwork("networkId", "region", "token", "vdc"); assertNotNull(response); }
public String deleteNetwork(String networkId, String region, String token, String vdc) throws OpenStackException { HttpUriRequest request = openOperationUtil.createQuantumDeleteRequest(RESOURCE_NETWORKS + "/" + networkId, region, vdc, token); String response = null; try { response = openOperationUtil.executeNovaRequest(request); } catch (OpenStackException e) { String errorMessage = "Error deleting network " + networkId + ": " + e; log.error(errorMessage); throw new OpenStackException(errorMessage); } catch (Exception e) { String errorMessage = "Error deleting network " + networkId + " from OpenStack: " + e; log.error(errorMessage); throw new OpenStackException(errorMessage); } return response; }
OpenStackUtilImpl implements OpenStackUtil { public String deleteNetwork(String networkId, String region, String token, String vdc) throws OpenStackException { HttpUriRequest request = openOperationUtil.createQuantumDeleteRequest(RESOURCE_NETWORKS + "/" + networkId, region, vdc, token); String response = null; try { response = openOperationUtil.executeNovaRequest(request); } catch (OpenStackException e) { String errorMessage = "Error deleting network " + networkId + ": " + e; log.error(errorMessage); throw new OpenStackException(errorMessage); } catch (Exception e) { String errorMessage = "Error deleting network " + networkId + " from OpenStack: " + e; log.error(errorMessage); throw new OpenStackException(errorMessage); } return response; } }
OpenStackUtilImpl implements OpenStackUtil { public String deleteNetwork(String networkId, String region, String token, String vdc) throws OpenStackException { HttpUriRequest request = openOperationUtil.createQuantumDeleteRequest(RESOURCE_NETWORKS + "/" + networkId, region, vdc, token); String response = null; try { response = openOperationUtil.executeNovaRequest(request); } catch (OpenStackException e) { String errorMessage = "Error deleting network " + networkId + ": " + e; log.error(errorMessage); throw new OpenStackException(errorMessage); } catch (Exception e) { String errorMessage = "Error deleting network " + networkId + " from OpenStack: " + e; log.error(errorMessage); throw new OpenStackException(errorMessage); } return response; } OpenStackUtilImpl(); }
OpenStackUtilImpl implements OpenStackUtil { public String deleteNetwork(String networkId, String region, String token, String vdc) throws OpenStackException { HttpUriRequest request = openOperationUtil.createQuantumDeleteRequest(RESOURCE_NETWORKS + "/" + networkId, region, vdc, token); String response = null; try { response = openOperationUtil.executeNovaRequest(request); } catch (OpenStackException e) { String errorMessage = "Error deleting network " + networkId + ": " + e; log.error(errorMessage); throw new OpenStackException(errorMessage); } catch (Exception e) { String errorMessage = "Error deleting network " + networkId + " from OpenStack: " + e; log.error(errorMessage); throw new OpenStackException(errorMessage); } return response; } OpenStackUtilImpl(); HttpClientConnectionManager getHttpConnectionManager(); void setHttpConnectionManager(HttpClientConnectionManager httpConnectionManager); String addInterface(String idRouter, NetworkInstance net, String region, String token, String vdc); String addInterfaceToPublicRouter(PaasManagerUser user, NetworkInstance net, String region); String addRouterInterface(String routerId, String subNetId, String region, String token, String vdc); String allocateFloatingIP(String payload, String region, String token, String vdc); String getFloatingIPs(String region, String token, String vdc, String dd); void disAllocateFloatingIP(String region, String token, String vdc, String floatingIp); String assignFloatingIP(String serverId, String floatingIP, String region, String token, String vdc); String createNetwork(String payload, String region, String token, String vdc); String createRouter(RouterInstance router, String region, String token, String vdc); String createServer(String payload, String region, String token, String vdc); String createSubNet(SubNetworkInstance subNet, String region, String token, String vdc); String deleteNetwork(String networkId, String region, String token, String vdc); String deleteRouter(String routerId, String region, String token, String vdc); String deleteServer(String serverId, String region, String token, String vdc); void deleteSubNetwork(String idSubNet, String region, String vdc, String token); String getFloatingIP(PaasManagerUser user, String region); String getNetworkDetails(String networkId, String region, String token, String vdc); String getSubNetworkDetails(String subNetworkId, String region, String token, String vdc); String getNetworks(String region, String token, String vdc); String getServer(String serverId, String region, String token, String vdc); boolean existsServerForDelete(String serverId, String region, String token, String vdc); String listServers(String region, String token, String vdc); String removeInterface(RouterInstance router, String net, String region, String token, String vdc); String getAbsoluteLimits(PaasManagerUser user, String region); String listNetworks(PaasManagerUser user, String region); String listSubNetworks(PaasManagerUser user, String region); String listPorts(PaasManagerUser user, String region); String deleteInterfaceToPublicRouter(PaasManagerUser user, NetworkInstance net, String region); OpenStackRegion getOpenStackRegion(); void setOpenStackRegion(OpenStackRegion openStackRegion); void setOpenOperationUtil(OpenOperationUtil openOperationUtil); void setOpenStackConfigUtil(OpenStackConfigUtil openStackConfigUtil); String joinNetworks(NetworkInstance networkInstance, NetworkInstance networkInstance2, String token); }
OpenStackUtilImpl implements OpenStackUtil { public String deleteNetwork(String networkId, String region, String token, String vdc) throws OpenStackException { HttpUriRequest request = openOperationUtil.createQuantumDeleteRequest(RESOURCE_NETWORKS + "/" + networkId, region, vdc, token); String response = null; try { response = openOperationUtil.executeNovaRequest(request); } catch (OpenStackException e) { String errorMessage = "Error deleting network " + networkId + ": " + e; log.error(errorMessage); throw new OpenStackException(errorMessage); } catch (Exception e) { String errorMessage = "Error deleting network " + networkId + " from OpenStack: " + e; log.error(errorMessage); throw new OpenStackException(errorMessage); } return response; } OpenStackUtilImpl(); HttpClientConnectionManager getHttpConnectionManager(); void setHttpConnectionManager(HttpClientConnectionManager httpConnectionManager); String addInterface(String idRouter, NetworkInstance net, String region, String token, String vdc); String addInterfaceToPublicRouter(PaasManagerUser user, NetworkInstance net, String region); String addRouterInterface(String routerId, String subNetId, String region, String token, String vdc); String allocateFloatingIP(String payload, String region, String token, String vdc); String getFloatingIPs(String region, String token, String vdc, String dd); void disAllocateFloatingIP(String region, String token, String vdc, String floatingIp); String assignFloatingIP(String serverId, String floatingIP, String region, String token, String vdc); String createNetwork(String payload, String region, String token, String vdc); String createRouter(RouterInstance router, String region, String token, String vdc); String createServer(String payload, String region, String token, String vdc); String createSubNet(SubNetworkInstance subNet, String region, String token, String vdc); String deleteNetwork(String networkId, String region, String token, String vdc); String deleteRouter(String routerId, String region, String token, String vdc); String deleteServer(String serverId, String region, String token, String vdc); void deleteSubNetwork(String idSubNet, String region, String vdc, String token); String getFloatingIP(PaasManagerUser user, String region); String getNetworkDetails(String networkId, String region, String token, String vdc); String getSubNetworkDetails(String subNetworkId, String region, String token, String vdc); String getNetworks(String region, String token, String vdc); String getServer(String serverId, String region, String token, String vdc); boolean existsServerForDelete(String serverId, String region, String token, String vdc); String listServers(String region, String token, String vdc); String removeInterface(RouterInstance router, String net, String region, String token, String vdc); String getAbsoluteLimits(PaasManagerUser user, String region); String listNetworks(PaasManagerUser user, String region); String listSubNetworks(PaasManagerUser user, String region); String listPorts(PaasManagerUser user, String region); String deleteInterfaceToPublicRouter(PaasManagerUser user, NetworkInstance net, String region); OpenStackRegion getOpenStackRegion(); void setOpenStackRegion(OpenStackRegion openStackRegion); void setOpenOperationUtil(OpenOperationUtil openOperationUtil); void setOpenStackConfigUtil(OpenStackConfigUtil openStackConfigUtil); String joinNetworks(NetworkInstance networkInstance, NetworkInstance networkInstance2, String token);  }