diff options
author | Boslet, Cory <cory.boslet@att.com> | 2020-04-16 10:43:38 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2020-04-16 10:43:44 -0400 |
commit | fa9a707c87654330dfb5788a6029b8199c6cdf17 (patch) | |
tree | ebd981e12166281957b47353a45b6b3c9b3ee490 /adapters | |
parent | b0f5ac59c297f81b7f17c1f367e64257ef7be2d2 (diff) |
move network adapter to an external client task
Began impelenting new network external task.
Made the vnfAdapterTask subflow an openstack subflow, refactored infra
flows and BB to call it for network functions.
Fixed bugs discovered through a robot dry run, added unit test, added
support for rollback network request
Updated junit test files for comparison due to not polling for response
Removed the no longer used network adapter rest task from bpmn tasks
Removed the unused network adapter async and its beans
Removed network async client package from open pojo scan
Issue-ID: SO-2813
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I4c25892012cc86659ab122448ed1aca5cab91671
Diffstat (limited to 'adapters')
34 files changed, 296 insertions, 4957 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java index 62d9f068f9..c33160d255 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java @@ -184,6 +184,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin { if (CREATE_COMPLETE.equals(currentStack.getStackStatus())) { new StackInfoMapper(currentStack).map(); } else if (CREATE_IN_PROGRESS.equals(currentStack.getStackStatus())) { + // TODO should check poll for completion right here currentStack = processCreateStack(cloudSiteId, tenantId, timeoutMinutes, backout, currentStack, createStack, true); } else if (CREATE_FAILED.equals(currentStack.getStackStatus()) @@ -322,6 +323,27 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin { } } + public Stack postProcessStackUpdate(Stack updateStack) throws MsoOpenstackException { + if (!"UPDATE_COMPLETE".equals(updateStack.getStackStatus())) { + logger.error("{} Stack status: {} Stack status reason: {} {} Update Stack error", + MessageEnum.RA_UPDATE_STACK_ERR, updateStack.getStackStatus(), updateStack.getStackStatusReason(), + ErrorCode.DataError.getValue()); + + MsoOpenstackException me = null; + if ("UPDATE_IN_PROGRESS".equals(updateStack.getStackStatus())) { + me = new MsoOpenstackException(0, "", "Stack Update Timeout"); + } else { + String error = + "Stack error (" + updateStack.getStackStatus() + "): " + updateStack.getStackStatusReason(); + me = new MsoOpenstackException(0, "", error); + } + me.addContext("UpdateStack"); + throw me; + } else { + return updateStack; + } + } + public Stack pollStackForStatus(int timeoutMinutes, Stack stack, String stackStatus, String cloudSiteId, String tenantId, boolean notFoundIsSuccess) throws MsoException { int pollingFrequency = diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapter.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapter.java index 302a6d302b..010d91fec9 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapter.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapter.java @@ -191,13 +191,16 @@ public interface MsoNetworkAdapter { @WebParam(name = "modelCustomizationUuid") String modelCustomizationUuid, @WebParam(name = "networkId") @XmlElement(required = true) String networkId, @WebParam(name = "request") MsoRequest msoRequest, - @WebParam(name = "networkDeleted", mode = Mode.OUT) Holder<Boolean> networkDeleted) throws NetworkException; + @WebParam(name = "networkDeleted", mode = Mode.OUT) Holder<Boolean> networkDeleted, + @WebParam(name = "pollForCompletion") @XmlElement(required = false) Boolean pollForCompletion) + throws NetworkException; /** * This is the "Rollback Network" Web Service endpoint definition. */ @WebMethod - public void rollbackNetwork(@WebParam(name = "rollback") @XmlElement(required = true) NetworkRollback rollback) + public void rollbackNetwork(@WebParam(name = "rollback") @XmlElement(required = true) NetworkRollback rollback, + @WebParam(name = "pollForCompletion") @XmlElement(required = false) Boolean pollForCompletion) throws NetworkException; @WebMethod diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsync.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsync.java deleted file mode 100644 index 5b7340e24f..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsync.java +++ /dev/null @@ -1,104 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.network; - - -import java.util.List; -import java.util.Map; -import javax.jws.Oneway; -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebService; -import javax.xml.bind.annotation.XmlElement; -import org.onap.so.entity.MsoRequest; -import org.onap.so.openstack.beans.NetworkRollback; -import org.onap.so.openstack.beans.Subnet; - -/** - * This webservice defines the Asynchronous versions of NETWORK adapter calls. The notification messages for final - * responses are documented elsewhere (by the client service WSDL). - * - */ -@WebService(name = "NetworkAdapterAsync", targetNamespace = "http://org.onap.so/networkA") -public interface MsoNetworkAdapterAsync { - /** - * This is the "Create NETWORK" Web Service Endpoint definition. - */ - @WebMethod - @Oneway - public void createNetworkA(@WebParam(name = "cloudSiteId") @XmlElement(required = true) String cloudSiteId, - @WebParam(name = "tenantId") @XmlElement(required = true) String tenantId, - @WebParam(name = "networkType") @XmlElement(required = true) String networkType, - @WebParam(name = "modelCustomizationUuid") String modelCustomizationUuid, - @WebParam(name = "networkName") @XmlElement(required = true) String networkName, - @WebParam(name = "physicalNetworkName") String physicalNetworkName, - @WebParam(name = "vlans") List<Integer> vlans, @WebParam(name = "failIfExists") Boolean failIfExists, - @WebParam(name = "backout") Boolean backout, @WebParam(name = "subnets") List<Subnet> subnets, - @WebParam(name = "networkParams") Map<String, String> networkParams, - @WebParam(name = "messageId") @XmlElement(required = true) String messageId, - @WebParam(name = "request") MsoRequest msoRequest, - @WebParam(name = "notificationUrl") @XmlElement(required = true) String notificationUrl); - - @WebMethod - @Oneway - public void updateNetworkA(@WebParam(name = "cloudSiteId") @XmlElement(required = true) String cloudSiteId, - @WebParam(name = "tenantId") @XmlElement(required = true) String tenantId, - @WebParam(name = "networkType") @XmlElement(required = true) String networkType, - @WebParam(name = "modelCustomizationUuid") String modelCustomizationUuid, - @WebParam(name = "networkId") @XmlElement(required = true) String networkId, - @WebParam(name = "networkName") @XmlElement(required = true) String networkName, - @WebParam(name = "physicalNetworkName") @XmlElement(required = true) String physicalNetworkName, - @WebParam(name = "vlans") @XmlElement(required = true) List<Integer> vlans, - @WebParam(name = "subnets") List<Subnet> subnets, - @WebParam(name = "networkParams") Map<String, String> networkParams, - @WebParam(name = "messageId") @XmlElement(required = true) String messageId, - @WebParam(name = "request") MsoRequest msoRequest, - @WebParam(name = "notificationUrl") @XmlElement(required = true) String notificationUrl); - - @WebMethod - @Oneway - public void queryNetworkA(@WebParam(name = "cloudSiteId") @XmlElement(required = true) String cloudSiteId, - @WebParam(name = "tenantId") @XmlElement(required = true) String tenantId, - @WebParam(name = "networkNameOrId") @XmlElement(required = true) String networkNameOrId, - @WebParam(name = "messageId") @XmlElement(required = true) String messageId, - @WebParam(name = "request") MsoRequest msoRequest, - @WebParam(name = "notificationUrl") @XmlElement(required = true) String notificationUrl); - - @WebMethod - @Oneway - public void deleteNetworkA(@WebParam(name = "cloudSiteId") @XmlElement(required = true) String cloudSiteId, - @WebParam(name = "tenantId") @XmlElement(required = true) String tenantId, - @WebParam(name = "networkType") @XmlElement(required = true) String networkType, - @WebParam(name = "modelCustomizationUuid") String modelCustomizationUuid, - @WebParam(name = "networkId") @XmlElement(required = true) String networkId, - @WebParam(name = "messageId") @XmlElement(required = true) String messageId, - @WebParam(name = "request") MsoRequest msoRequest, - @WebParam(name = "notificationUrl") @XmlElement(required = true) String notificationUrl); - - @WebMethod - @Oneway - public void rollbackNetworkA(@WebParam(name = "rollback") @XmlElement(required = true) NetworkRollback rollback, - @WebParam(name = "messageId") @XmlElement(required = true) String messageId, - @WebParam(name = "notificationUrl") @XmlElement(required = true) String notificationUrl); - - @WebMethod - public void healthCheckA(); -} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java deleted file mode 100644 index 8d75212f4e..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java +++ /dev/null @@ -1,605 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Modifications Copyright (C) 2018 IBM. - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.network; - - -import java.net.MalformedURLException; -import java.net.URL; -import java.security.GeneralSecurityException; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.jws.WebService; -import javax.xml.bind.DatatypeConverter; -import javax.xml.namespace.QName; -import javax.xml.ws.BindingProvider; -import javax.xml.ws.Holder; -import javax.xml.ws.handler.MessageContext; -import org.onap.so.adapters.network.async.client.CreateNetworkNotification; -import org.onap.so.adapters.network.async.client.MsoExceptionCategory; -import org.onap.so.adapters.network.async.client.NetworkAdapterNotify; -import org.onap.so.adapters.network.async.client.NetworkAdapterNotify_Service; -import org.onap.so.adapters.network.async.client.QueryNetworkNotification; -import org.onap.so.adapters.network.async.client.UpdateNetworkNotification; -import org.onap.so.adapters.network.exceptions.NetworkException; -import org.onap.so.entity.MsoRequest; -import org.onap.logging.filter.base.ErrorCode; -import org.onap.so.logger.LoggingAnchor; -import org.onap.so.logger.MessageEnum; -import org.onap.so.openstack.beans.NetworkRollback; -import org.onap.so.openstack.beans.NetworkStatus; -import org.onap.so.openstack.beans.Subnet; -import org.onap.so.utils.CryptoUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.env.Environment; -import org.springframework.stereotype.Component; - -@Component -@WebService(serviceName = "NetworkAdapterAsync", - endpointInterface = "org.onap.so.adapters.network.MsoNetworkAdapterAsync", - targetNamespace = "http://org.onap.so/networkA") -public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { - - private static final Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterAsyncImpl.class); - - private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.network.bpelauth"; - private static final String ENCRYPTION_KEY_PROP = "mso.msoKey"; - private static final String NETWORK_EXCEPTION_MSG = "Got a NetworkException on createNetwork: "; - private static final String CREATE_NETWORK_ERROR_LOGMSG = "{} {} Error sending createNetwork notification {} "; - private static final String FAULT_INFO_ERROR_LOGMSG = "{} {} Exception - fault info "; - private static final String SHARED = "shared"; - private static final String EXTERNAL = "external"; - - @Autowired - private Environment environment; - - @Autowired - private MsoNetworkAdapter networkAdapter; - - /** - * Health Check web method. Does nothing but return to show the adapter is deployed. - */ - @Override - public void healthCheckA() { - logger.debug("Health check call in Network Adapter"); - } - - /** - * This is the "Create Network" web service implementation. It will create a new Network of the requested type in - * the specified cloud and tenant. The tenant must exist at the time this service is called. - * - * If a network with the same name already exists, this can be considered a success or failure, depending on the - * value of the 'failIfExists' parameter. - * - * There will be a pre-defined set of network types defined in the MSO Catalog. All such networks will have a - * similar configuration, based on the allowable Openstack networking definitions. This includes basic networks, - * provider networks (with a single VLAN), and multi-provider networks (one or more VLANs) - * - * Initially, all provider networks must be "vlan" type, and multiple segments in a multi-provider network must be - * multiple VLANs on the same physical network. - * - * This service supports two modes of Network creation/update: - via Heat Templates - via Neutron API The network - * orchestration mode for each network type is declared in its catalog definition. All Heat-based templates must - * support some subset of the same input parameters: network_name, physical_network, vlan(s). - * - * The method returns the network ID and a NetworkRollback object. This latter object can be passed as-is to the - * rollbackNetwork operation to undo everything that was created. This is useful if a network is successfully - * created but the orchestration fails on a subsequent operation. - */ - @Override - public void createNetworkA(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid, - String networkName, String physicalNetworkName, List<Integer> vlans, Boolean failIfExists, Boolean backout, - List<Subnet> subnets, Map<String, String> networkParams, String messageId, MsoRequest msoRequest, - String notificationUrl) { - - logger.debug("Async Create Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId); - - // Use the synchronous method to perform the actual Create - - - // Synchronous Web Service Outputs - Holder<String> networkId = new Holder<>(); - Holder<String> neutronNetworkId = new Holder<>(); - Holder<NetworkRollback> networkRollback = new Holder<>(); - Holder<Map<String, String>> subnetIdMap = new Holder<>(); - - HashMap<String, String> params = (HashMap<String, String>) networkParams; - if (params == null) - params = new HashMap<>(); - String shared = null; - String external = null; - if (params.containsKey(SHARED)) - shared = params.get(SHARED); - if (params.containsKey(EXTERNAL)) - external = params.get(EXTERNAL); - - try { - networkAdapter.createNetwork(cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkName, - physicalNetworkName, vlans, shared, external, failIfExists, backout, subnets, params, msoRequest, - networkId, neutronNetworkId, subnetIdMap, networkRollback); - } catch (NetworkException e) { - logger.debug(NETWORK_EXCEPTION_MSG, e); - MsoExceptionCategory exCat = null; - String eMsg = null; - try { - eMsg = e.getFaultInfo().getMessage(); - exCat = MsoExceptionCategory.fromValue(e.getFaultInfo().getCategory().name()); - } catch (Exception e1) { - logger.error(FAULT_INFO_ERROR_LOGMSG, MessageEnum.RA_FAULT_INFO_EXC, ErrorCode.DataError.getValue(), - e1); - } - // Build and send Asynchronous error response - try { - NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl); - notifyPort.createNetworkNotification(messageId, false, exCat, eMsg, null, null, null, null); - } catch (Exception e1) { - logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, - ErrorCode.DataError.getValue(), e1.getMessage(), e1); - - } - return; - } - logger.debug("Async Create Network:Name {} physicalNetworkName:{}", networkName, physicalNetworkName); - // Build and send Asynchronous response - try { - NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl); - notifyPort.createNetworkNotification(messageId, true, null, null, networkId.value, neutronNetworkId.value, - copyCreateSubnetIdMap(subnetIdMap), copyNrb(networkRollback)); - } catch (Exception e) { - logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, - ErrorCode.DataError.getValue(), e.getMessage(), e); - - } - return; - } - - /** - * This is the "Update Network" web service implementation. It will update an existing Network of the requested type - * in the specified cloud and tenant. The typical use will be to replace the VLANs with the supplied list (to add or - * remove a VLAN), but other properties may be updated as well. - * - * There will be a pre-defined set of network types defined in the MSO Catalog. All such networks will have a - * similar configuration, based on the allowable Openstack networking definitions. This includes basic networks, - * provider networks (with a single VLAN), and multi-provider networks (one or more VLANs). - * - * Initially, all provider networks must currently be "vlan" type, and multi-provider networks must be multiple - * VLANs on the same physical network. - * - * This service supports two modes of Network update: - via Heat Templates - via Neutron API The network - * orchestration mode for each network type is declared in its catalog definition. All Heat-based templates must - * support some subset of the same input parameters: network_name, physical_network, vlan, segments. - * - * The method returns a NetworkRollback object. This object can be passed as-is to the rollbackNetwork operation to - * undo everything that was updated. This is useful if a network is successfully updated but orchestration fails on - * a subsequent operation. - */ - @Override - public void updateNetworkA(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid, - String networkId, String networkName, String physicalNetworkName, List<Integer> vlans, List<Subnet> subnets, - Map<String, String> networkParams, String messageId, MsoRequest msoRequest, String notificationUrl) { - - logger.debug("Async Update Network: {} of type {} in {}/{}", networkId, networkType, cloudSiteId, tenantId); - - // Use the synchronous method to perform the actual Create - - - // Synchronous Web Service Outputs - Holder<NetworkRollback> networkRollback = new Holder<>(); - Holder<Map<String, String>> subnetIdMap = new Holder<>(); - - HashMap<String, String> params = (HashMap<String, String>) networkParams; - if (params == null) - params = new HashMap<>(); - String shared = null; - String external = null; - if (params.containsKey(SHARED)) - shared = params.get(SHARED); - if (params.containsKey(EXTERNAL)) - external = params.get(EXTERNAL); - - try { - networkAdapter.updateNetwork(cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkId, - networkName, physicalNetworkName, vlans, shared, external, subnets, params, msoRequest, subnetIdMap, - networkRollback); - } catch (NetworkException e) { - logger.debug("Got a NetworkException on updateNetwork: ", e); - MsoExceptionCategory exCat = null; - String eMsg = null; - try { - eMsg = e.getFaultInfo().getMessage(); - exCat = MsoExceptionCategory.fromValue(e.getFaultInfo().getCategory().name()); - } catch (Exception e1) { - logger.error(FAULT_INFO_ERROR_LOGMSG, MessageEnum.RA_FAULT_INFO_EXC, ErrorCode.DataError.getValue(), - e1); - } - // Build and send Asynchronous error response - try { - NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl); - notifyPort.updateNetworkNotification(messageId, false, exCat, eMsg, null, copyNrb(networkRollback)); - } catch (Exception e1) { - logger.error("{} {} Error sending updateNetwork notification {} ", - MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, ErrorCode.DataError.getValue(), e1.getMessage(), e1); - - } - return; - } - logger.debug("Async Update Network:Name {} NetworkId:{}", networkName, networkId); - // Build and send Asynchronous response - try { - NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl); - notifyPort.updateNetworkNotification(messageId, true, null, null, copyUpdateSubnetIdMap(subnetIdMap), - copyNrb(networkRollback)); - } catch (Exception e) { - logger.error("{} {} Error sending updateNotification request {} ", MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, - ErrorCode.DataError.getValue(), e.getMessage(), e); - } - return; - } - - /** - * This is the queryNetwork method. It returns the existence and status of the specified network, along with its - * Neutron UUID and list of VLANs. This method attempts to find the network using both Heat and Neutron. Heat stacks - * are first searched based on the provided network name/id. If none is found, the Neutron is directly queried. - */ - @Override - public void queryNetworkA(String cloudSiteId, String tenantId, String networkNameOrId, String messageId, - MsoRequest msoRequest, String notificationUrl) { - - logger.debug("Async Query Network {} in {}/{}", networkNameOrId, cloudSiteId, tenantId); - String errorCreateNetworkMessage = CREATE_NETWORK_ERROR_LOGMSG; - - // Use the synchronous method to perform the actual Create - - - // Synchronous Web Service Outputs - Holder<Boolean> networkExists = new Holder<>(); - Holder<String> networkId = new Holder<>(); - Holder<String> neutronNetworkId = new Holder<>(); - Holder<NetworkStatus> status = new Holder<>(); - Holder<List<Integer>> vlans = new Holder<>(); - Holder<Map<String, String>> subnetIdMap = new Holder<>(); - - try { - networkAdapter.queryNetwork(cloudSiteId, tenantId, networkNameOrId, msoRequest, networkExists, networkId, - neutronNetworkId, status, vlans, subnetIdMap); - } catch (NetworkException e) { - logger.debug(NETWORK_EXCEPTION_MSG, e); - MsoExceptionCategory exCat = null; - String eMsg = null; - try { - eMsg = e.getFaultInfo().getMessage(); - exCat = MsoExceptionCategory.fromValue(e.getFaultInfo().getCategory().name()); - } catch (Exception e1) { - logger.error(FAULT_INFO_ERROR_LOGMSG, MessageEnum.RA_FAULT_INFO_EXC, ErrorCode.DataError.getValue(), - e1); - } - // Build and send Asynchronous error response - try { - NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl); - notifyPort.queryNetworkNotification(messageId, false, exCat, eMsg, null, null, null, null, null, null); - } catch (Exception e1) { - logger.error(errorCreateNetworkMessage, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, - ErrorCode.DataError.getValue(), e1.getMessage(), e1); - } - return; - } - logger.debug("Async Query Network:NameOrId {} tenantId:{}", networkNameOrId, tenantId); - // Build and send Asynchronous response - try { - NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl); - org.onap.so.adapters.network.async.client.NetworkStatus networkS = - org.onap.so.adapters.network.async.client.NetworkStatus.fromValue(status.value.name()); - notifyPort.queryNetworkNotification(messageId, true, null, null, networkExists.value, networkId.value, - neutronNetworkId.value, networkS, vlans.value, copyQuerySubnetIdMap(subnetIdMap)); - } catch (Exception e) { - logger.error(errorCreateNetworkMessage, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, - ErrorCode.DataError.getValue(), e.getMessage(), e); - } - return; - } - - /** - * This is the "Delete Network" web service implementation. It will delete a Network in the specified cloud and - * tenant. - * - * If the network is not found, it is treated as a success. - * - * This service supports two modes of Network creation/update/delete: - via Heat Templates - via Neutron API The - * network orchestration mode for each network type is declared in its catalog definition. - * - * For Heat-based orchestration, the networkId should be the stack ID. For Neutron-based orchestration, the - * networkId should be the Neutron network UUID. - * - * The method returns nothing on success. Rollback is not possible for delete commands, so any failure on delete - * will require manual fallout in the client. - */ - @Override - public void deleteNetworkA(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid, - String networkId, String messageId, MsoRequest msoRequest, String notificationUrl) { - - String serviceName = "DeleteNetworkA"; - logger.debug("Async Delete Network {} in {}/{}", networkId, cloudSiteId, tenantId); - - // Use the synchronous method to perform the actual Create - - - // Synchronous Web Service Outputs - Holder<Boolean> networkDeleted = new Holder<>(); - - try { - networkAdapter.deleteNetwork(cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkId, - msoRequest, networkDeleted); - } catch (NetworkException e) { - logger.debug(NETWORK_EXCEPTION_MSG, e); - MsoExceptionCategory exCat = null; - String eMsg = null; - try { - eMsg = e.getFaultInfo().getMessage(); - exCat = MsoExceptionCategory.fromValue(e.getFaultInfo().getCategory().name()); - } catch (Exception e1) { - logger.error(FAULT_INFO_ERROR_LOGMSG, MessageEnum.RA_FAULT_INFO_EXC, ErrorCode.DataError.getValue(), - e1); - } - // Build and send Asynchronous error response - try { - NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl); - notifyPort.deleteNetworkNotification(messageId, false, exCat, eMsg, null); - } catch (Exception e1) { - logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, - ErrorCode.DataError.getValue(), e1.getMessage(), e1); - - } - return; - } - logger.debug("Async Delete NetworkId: {} tenantId:{}", networkId, tenantId); - // Build and send Asynchronous response - try { - NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl); - notifyPort.deleteNetworkNotification(messageId, true, null, null, networkDeleted.value); - } catch (Exception e) { - logger.error("{} {} Error sending deleteNetwork notification {} ", MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, - ErrorCode.DataError.getValue(), e.getMessage(), e); - - } - return; - } - - /** - * This web service endpoint will rollback a previous Create VNF operation. A rollback object is returned to the - * client in a successful creation response. The client can pass that object as-is back to the rollbackNetwork - * operation to undo the creation. - * - * The rollback includes removing the VNF and deleting the tenant if the tenant did not exist prior to the VNF - * creation. - */ - @Override - public void rollbackNetworkA(NetworkRollback rollback, String messageId, String notificationUrl) { - // rollback may be null (e.g. if network already existed when Create was called) - if (rollback == null) { - logger.warn("{} {} Rollback is null", MessageEnum.RA_ROLLBACK_NULL, ErrorCode.SchemaError.getValue()); - return; - } - - logger.info(LoggingAnchor.TWO, MessageEnum.RA_ASYNC_ROLLBACK, rollback.getNetworkStackId()); - // Use the synchronous method to perform the actual Create - - - try { - networkAdapter.rollbackNetwork(rollback); - } catch (NetworkException e) { - logger.debug("Got a NetworkException on rollbackNetwork: ", e); - // Build and send Asynchronous error response - MsoExceptionCategory exCat = null; - String eMsg = null; - try { - eMsg = e.getFaultInfo().getMessage(); - exCat = MsoExceptionCategory.fromValue(e.getFaultInfo().getCategory().name()); - } catch (Exception e1) { - logger.error("{} {} Exception in get fault info ", MessageEnum.RA_FAULT_INFO_EXC, - ErrorCode.DataError.getValue(), e1); - } - // Build and send Asynchronous error response - try { - NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl); - notifyPort.rollbackNetworkNotification(rollback.getMsoRequest().getRequestId(), false, exCat, eMsg); - } catch (Exception e1) { - logger.error(CREATE_NETWORK_ERROR_LOGMSG, MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, - ErrorCode.DataError.getValue(), e1.getMessage(), e1); - - } - return; - } - logger.debug("Async Rollback NetworkId: {} tenantId:{}", rollback.getNetworkStackId(), rollback.getTenantId()); - // Build and send Asynchronous response - try { - NetworkAdapterNotify notifyPort = getNotifyEP(notificationUrl); - notifyPort.rollbackNetworkNotification(rollback.getMsoRequest().getRequestId(), true, null, null); - } catch (Exception e) { - logger.error("{} {} Error sending rollbackNetwork notification {} ", - MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, ErrorCode.DataError.getValue(), e.getMessage(), e); - - } - return; - } - - private org.onap.so.adapters.network.async.client.NetworkRollback copyNrb(Holder<NetworkRollback> hNrb) { - org.onap.so.adapters.network.async.client.NetworkRollback cnrb = - new org.onap.so.adapters.network.async.client.NetworkRollback(); - - if (hNrb != null && hNrb.value != null) { - org.onap.so.adapters.network.async.client.MsoRequest cmr = - new org.onap.so.adapters.network.async.client.MsoRequest(); - - cnrb.setCloudId(hNrb.value.getCloudId()); - cmr.setRequestId(hNrb.value.getMsoRequest().getRequestId()); - cmr.setServiceInstanceId(hNrb.value.getMsoRequest().getServiceInstanceId()); - cnrb.setMsoRequest(cmr); - cnrb.setNetworkId(hNrb.value.getNetworkId()); - cnrb.setNetworkStackId(hNrb.value.getNetworkStackId()); - cnrb.setNeutronNetworkId(hNrb.value.getNeutronNetworkId()); - cnrb.setTenantId(hNrb.value.getTenantId()); - cnrb.setNetworkType(hNrb.value.getNetworkType()); - cnrb.setNetworkCreated(hNrb.value.getNetworkCreated()); - cnrb.setNetworkName(hNrb.value.getNetworkName()); - cnrb.setPhysicalNetwork(hNrb.value.getPhysicalNetwork()); - List<Integer> vlansc = cnrb.getVlans(); - List<Integer> vlansh = hNrb.value.getVlans(); - if (vlansh != null) { - vlansc.addAll(vlansh); - } - } - return cnrb; - } - - private NetworkAdapterNotify getNotifyEP(String notificationUrl) { - - URL warWsdlLoc = null; - try { - warWsdlLoc = Thread.currentThread().getContextClassLoader().getResource("NetworkAdapterNotify.wsdl"); - } catch (Exception e) { - logger.error("{} {} Exception - WSDL not found ", MessageEnum.RA_WSDL_NOT_FOUND, - ErrorCode.DataError.getValue(), e); - } - if (warWsdlLoc == null) { - logger.error("{} {} WSDL not found", MessageEnum.RA_WSDL_NOT_FOUND, ErrorCode.DataError.getValue()); - } else { - try { - logger.debug("NetworkAdpaterNotify.wsdl location: {}", warWsdlLoc.toURI().toString()); - } catch (Exception e) { - logger.error("{} {} Exception - WSDL URL convention ", MessageEnum.RA_WSDL_URL_CONVENTION_EXC, - ErrorCode.SchemaError.getValue(), e); - } - } - - NetworkAdapterNotify_Service notifySvc = new NetworkAdapterNotify_Service(warWsdlLoc, - new QName("http://org.onap.so/networkNotify", "networkAdapterNotify")); - - NetworkAdapterNotify notifyPort = notifySvc.getMsoNetworkAdapterAsyncImplPort(); - - BindingProvider bp = (BindingProvider) notifyPort; - - URL epUrl = null; - try { - epUrl = new URL(notificationUrl); - } catch (MalformedURLException e1) { - logger.error("{} {} Exception - init notification ", MessageEnum.RA_INIT_NOTIF_EXC, - ErrorCode.DataError.getValue(), e1); - } - - if (null != epUrl) { - logger.debug("Notification Endpoint URL: {}", epUrl.toExternalForm()); - bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, epUrl.toExternalForm()); - } else { - logger.debug("Notification Endpoint URL is NULL: "); - } - - // authentication - try { - Map<String, Object> reqCtx = bp.getRequestContext(); - Map<String, List<String>> headers = new HashMap<>(); - - String userCredentials = this.getEncryptedProperty(BPEL_AUTH_PROP, "", ENCRYPTION_KEY_PROP); - - String basicAuth = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes()); - reqCtx.put(MessageContext.HTTP_REQUEST_HEADERS, headers); - headers.put("Authorization", Collections.singletonList(basicAuth)); - } catch (Exception e) { - logger.error("{} {} Unable to set authorization in callback request {} ", - MessageEnum.RA_SET_CALLBACK_AUTH_EXC, ErrorCode.DataError.getValue(), e.getMessage(), e); - } - - return notifyPort; - } - - public String getEncryptedProperty(String key, String defaultValue, String encryptionKey) { - try { - return CryptoUtils.decrypt(this.environment.getProperty(key), this.environment.getProperty(encryptionKey)); - } catch (GeneralSecurityException e) { - logger.debug("Exception while decrypting property: {} ", this.environment.getProperty(key), e); - } - return defaultValue; - - } - - private CreateNetworkNotification.SubnetIdMap copyCreateSubnetIdMap(Holder<Map<String, String>> hMap) { - - CreateNetworkNotification.SubnetIdMap subnetIdMap = new CreateNetworkNotification.SubnetIdMap(); - - if (hMap != null && hMap.value != null) { - Map<String, String> sMap = hMap.value; - CreateNetworkNotification.SubnetIdMap.Entry entry = new CreateNetworkNotification.SubnetIdMap.Entry(); - - for (Map.Entry<String, String> mapEntry : sMap.entrySet()) { - String key = mapEntry.getKey(); - String value = mapEntry.getValue(); - entry.setKey(key); - entry.setValue(value); - subnetIdMap.getEntry().add(entry); - } - } - return subnetIdMap; - } - - private UpdateNetworkNotification.SubnetIdMap copyUpdateSubnetIdMap(Holder<Map<String, String>> hMap) { - - UpdateNetworkNotification.SubnetIdMap subnetIdMap = new UpdateNetworkNotification.SubnetIdMap(); - - if (hMap != null && hMap.value != null) { - Map<String, String> sMap = hMap.value; - UpdateNetworkNotification.SubnetIdMap.Entry entry = new UpdateNetworkNotification.SubnetIdMap.Entry(); - - for (Map.Entry<String, String> mapEntry : sMap.entrySet()) { - String key = mapEntry.getKey(); - String value = mapEntry.getValue(); - entry.setKey(key); - entry.setValue(value); - subnetIdMap.getEntry().add(entry); - } - } - return subnetIdMap; - } - - private QueryNetworkNotification.SubnetIdMap copyQuerySubnetIdMap(Holder<Map<String, String>> hMap) { - - QueryNetworkNotification.SubnetIdMap subnetIdMap = new QueryNetworkNotification.SubnetIdMap(); - - if (hMap != null && hMap.value != null) { - Map<String, String> sMap = hMap.value; - QueryNetworkNotification.SubnetIdMap.Entry entry = new QueryNetworkNotification.SubnetIdMap.Entry(); - - for (Map.Entry<String, String> mapEntry : sMap.entrySet()) { - String key = mapEntry.getKey(); - String value = mapEntry.getValue(); - entry.setKey(key); - entry.setValue(value); - subnetIdMap.getEntry().add(entry); - } - } - return subnetIdMap; - } -} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java index 860c747f15..489585c04b 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java @@ -140,6 +140,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { * @see MsoNetworkAdapterImpl#MsoNetworkAdapterImpl(MsoPropertiesFactory) */ + @Deprecated @Override public void createNetwork(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid, String networkName, String physicalNetworkName, List<Integer> vlans, String shared, String external, @@ -149,9 +150,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { Holder<String> networkFqdn = new Holder<>(); createNetwork(cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkName, physicalNetworkName, vlans, null, shared, external, failIfExists, backout, subnets, null, null, msoRequest, networkId, - neutronNetworkId, networkFqdn, subnetIdMap, rollback); + neutronNetworkId, networkFqdn, subnetIdMap, rollback, true); } + @Deprecated @Override public void createNetworkContrail(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid, String networkName, List<RouteTarget> routeTargets, String shared, @@ -162,7 +164,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { throws NetworkException { createNetwork(cloudSiteId, tenantId, networkType, modelCustomizationUuid, networkName, null, null, routeTargets, shared, external, failIfExists, backout, subnets, policyFqdns, routeTableFqdns, msoRequest, networkId, - neutronNetworkId, networkFqdn, subnetIdMap, rollback); + neutronNetworkId, networkFqdn, subnetIdMap, rollback, true); } /** @@ -188,12 +190,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { * created but the orchestration fails on a subsequent operation. */ - private void createNetwork(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid, + public void createNetwork(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid, String networkName, String physicalNetworkName, List<Integer> vlans, List<RouteTarget> routeTargets, String shared, String external, Boolean failIfExists, Boolean backout, List<Subnet> subnets, List<String> policyFqdns, List<String> routeTableFqdns, MsoRequest msoRequest, Holder<String> networkId, Holder<String> neutronNetworkId, Holder<String> networkFqdn, Holder<Map<String, String>> subnetIdMap, - Holder<NetworkRollback> rollback) throws NetworkException { + Holder<NetworkRollback> rollback, Boolean pollForCompletion) throws NetworkException { logger.debug("*** CREATE Network: {} of type {} in {}/{}", networkName, networkType, cloudSiteId, tenantId); // Will capture execution time for metrics @@ -365,7 +367,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (backout == null) backout = true; heatStack = heat.createStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName, null, template, stackParams, - true, heatTemplate.getTimeoutMinutes(), null, null, null, backout.booleanValue(), failIfExists); + pollForCompletion, heatTemplate.getTimeoutMinutes(), null, null, null, backout.booleanValue(), + failIfExists); } catch (MsoException me) { me.addContext(CREATE_NETWORK_CONTEXT); logger.error("{} {} Exception creating network type {} in {}/{} ", MessageEnum.RA_CREATE_NETWORK_EXC, @@ -423,6 +426,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { return; } + @Deprecated @Override public void updateNetwork(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid, String networkId, String networkName, String physicalNetworkName, List<Integer> vlans, String shared, @@ -434,6 +438,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } + @Deprecated @Override public void updateNetworkContrail(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid, String networkId, String networkName, List<RouteTarget> routeTargets, @@ -465,7 +470,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { * undo everything that was updated. This is useful if a network is successfully updated but orchestration fails on * a subsequent operation. */ - private void updateNetwork(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid, + public void updateNetwork(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid, String networkId, String networkName, String physicalNetworkName, List<Integer> vlans, List<RouteTarget> routeTargets, String shared, String external, List<Subnet> subnets, List<String> policyFqdns, List<String> routeTableFqdns, MsoRequest msoRequest, @@ -524,7 +529,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // Does not exist. Throw an exception (can't update a non-existent network) throw new NetworkException(error, MsoExceptionCategory.USERDATA); } - long updateNetworkStarttime = System.currentTimeMillis(); try { netInfo = neutron.updateNetwork(cloudSiteId, tenantId, networkId, neutronNetworkType, physicalNetworkName, vlans); @@ -671,7 +675,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // Ignore MsoStackNotFound exception because we already checked. try { heatStack = heatWithUpdate.updateStack(cloudSiteId, CLOUD_OWNER, tenantId, networkId, template, - stackParams, true, heatTemplate.getTimeoutMinutes()); + stackParams, false, heatTemplate.getTimeoutMinutes()); } catch (MsoException me) { me.addContext(UPDATE_NETWORK_CONTEXT); logger.error("{} {} Exception - update network {} in {}/{} ", MessageEnum.RA_UPDATE_NETWORK_ERR, @@ -944,7 +948,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { */ @Override public void deleteNetwork(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid, - String networkId, MsoRequest msoRequest, Holder<Boolean> networkDeleted) throws NetworkException { + String networkId, MsoRequest msoRequest, Holder<Boolean> networkDeleted, Boolean pollForCompletion) + throws NetworkException { logger.debug("*** DELETE Network adapter with Network: {} in {}/{}", networkId, cloudSiteId, tenantId); if (commonUtils.isNullOrEmpty(cloudSiteId) || commonUtils.isNullOrEmpty(tenantId) || commonUtils.isNullOrEmpty(networkId)) { @@ -953,6 +958,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { throw new NetworkException(error, MsoExceptionCategory.USERDATA); } + if (pollForCompletion == null) { + pollForCompletion = true; + } + // Retrieve the Network Resource definition NetworkResource networkResource = null; if (commonUtils.isNullOrEmpty(modelCustomizationUuid)) { @@ -980,7 +989,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } try { - StackInfo stack = heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true, timeoutMinutes); + StackInfo stack = + heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, pollForCompletion, timeoutMinutes); networkDeleted.value = stack.isOperationPerformed(); } catch (MsoException me) { me.addContext("DeleteNetwork"); @@ -1006,12 +1016,16 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { * creation. */ @Override - public void rollbackNetwork(NetworkRollback rollback) throws NetworkException { + public void rollbackNetwork(NetworkRollback rollback, Boolean pollForCompletion) throws NetworkException { if (rollback == null) { logger.error("{} {} rollback is null", MessageEnum.RA_ROLLBACK_NULL, ErrorCode.DataError.getValue()); return; } + if (pollForCompletion == null) { + pollForCompletion = true; + } + // Get the elements of the VnfRollback object for easier access String cloudSiteId = rollback.getCloudId(); String tenantId = rollback.getTenantId(); @@ -1021,7 +1035,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (rollback.getNetworkCreated()) { try { - heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true, 120); + heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, pollForCompletion, 120); } catch (MsoException me) { me.addContext("RollbackNetwork"); logger.error("{} {} Exception - Rollback Network (heat): {} in {}/{} ", diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java deleted file mode 100644 index 09356d02c8..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java +++ /dev/null @@ -1,660 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.network; - - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.inject.Provider; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.GenericEntity; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.xml.ws.Holder; -import org.apache.http.HttpStatus; -import org.onap.logging.ref.slf4j.ONAPLogConstants; -import org.onap.so.adapters.network.exceptions.NetworkException; -import org.onap.so.adapters.nwrest.ContrailNetwork; -import org.onap.so.adapters.nwrest.CreateNetworkError; -import org.onap.so.adapters.nwrest.CreateNetworkRequest; -import org.onap.so.adapters.nwrest.CreateNetworkResponse; -import org.onap.so.adapters.nwrest.DeleteNetworkError; -import org.onap.so.adapters.nwrest.DeleteNetworkRequest; -import org.onap.so.adapters.nwrest.DeleteNetworkResponse; -import org.onap.so.adapters.nwrest.ProviderVlanNetwork; -import org.onap.so.adapters.nwrest.QueryNetworkError; -import org.onap.so.adapters.nwrest.QueryNetworkResponse; -import org.onap.so.adapters.nwrest.RollbackNetworkError; -import org.onap.so.adapters.nwrest.RollbackNetworkRequest; -import org.onap.so.adapters.nwrest.RollbackNetworkResponse; -import org.onap.so.adapters.nwrest.UpdateNetworkError; -import org.onap.so.adapters.nwrest.UpdateNetworkRequest; -import org.onap.so.adapters.nwrest.UpdateNetworkResponse; -import org.onap.so.adapters.vnf.BpelRestClient; -import org.onap.so.entity.MsoRequest; -import org.onap.logging.filter.base.ErrorCode; -import org.onap.so.logger.MessageEnum; -import org.onap.so.openstack.beans.NetworkRollback; -import org.onap.so.openstack.beans.NetworkStatus; -import org.onap.so.openstack.beans.RouteTarget; -import org.onap.so.openstack.exceptions.MsoExceptionCategory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.slf4j.MDC; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; - -@Path("/v1/networks") -@Api(value = "/v1/networks", description = "root of network adapters restful web service") -@Component -@Transactional -public class NetworkAdapterRest { - - private static final Logger logger = LoggerFactory.getLogger(NetworkAdapterRest.class); - private static final String TESTING_KEYWORD = "___TESTING___"; - private String exceptionMsg = "Exception:"; - private static final String SHARED = "shared"; - private static final String EXTERNAL = "external"; - - @Autowired - private MsoNetworkAdapterImpl adapter; - - @Autowired - private Provider<BpelRestClient> bpelRestClientProvider; - - - @POST - @Path("") - @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - @ApiOperation(value = "CreateNetwork", response = Response.class, - notes = "Creates a new network, CreateNetworkRquest JSON is required") - @ApiResponses({@ApiResponse(code = 200, message = "network has been successfully created"), - @ApiResponse(code = 202, message = "create network request has been accepted (async only)"), - @ApiResponse(code = 500, message = "create network failed, examine entity object for details")}) - public Response createNetwork( - @ApiParam(value = "details of network being created", required = true) CreateNetworkRequest req) { - logger.debug("createNetwork enter: {}", req.toJsonString()); - CreateNetworkTask task = new CreateNetworkTask(req); - if (req.isSynchronous()) { - // This is a synchronous request - task.run(); - return Response.status(task.getStatusCode()).entity(task.getGenericEntityResponse()).build(); - } else { - // This is an asynchronous request - try { - Thread t1 = new Thread(task); - t1.start(); - } catch (Exception e) { - // problem handling create, send generic failure as sync resp to caller - logger.error("{} {} Exception while create network ", MessageEnum.RA_CREATE_NETWORK_EXC, - ErrorCode.BusinessProcessError.getValue(), e); - return Response.serverError().build(); - } - // send sync response (ACK) to caller - logger.debug("createNetwork exit"); - return Response.status(HttpStatus.SC_ACCEPTED).build(); - } - } - - public class CreateNetworkTask implements Runnable { - private final CreateNetworkRequest req; - private CreateNetworkResponse response = null; - private CreateNetworkError eresp = null; - private boolean sendxml; - - public CreateNetworkTask(CreateNetworkRequest req) { - this.req = req; - this.sendxml = true; // can be set with a field or header later - } - - public int getStatusCode() { - return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST; - } - - public Object getGenericEntityResponse() { - return (response != null) ? new GenericEntity<CreateNetworkResponse>(response) {} - : new GenericEntity<CreateNetworkError>(eresp) {}; - } - - private String getResponse() { - if (response != null) { - return sendxml ? response.toXmlString() : response.toJsonString(); - } else { - return sendxml ? eresp.toXmlString() : eresp.toJsonString(); - } - } - - @Override - public void run() { - try { - MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId()); - } catch (Exception e) { - logger.error("Error adding RequestId to MDC", e); - } - logger.debug("CreateNetworkTask start"); - try { - // Synchronous Web Service Outputs - Holder<String> networkId = new Holder<>(); - Holder<String> neutronNetworkId = new Holder<>(); - Holder<String> networkFqdn = new Holder<>(); - Holder<Map<String, String>> subnetIdMap = new Holder<>(); - Holder<NetworkRollback> rollback = new Holder<>(); - - HashMap<String, String> params = (HashMap<String, String>) req.getNetworkParams(); - if (params == null) { - params = new HashMap<>(); - } - String shared = null; - String external = null; - - String cloudsite = req.getCloudSiteId(); - if (cloudsite != null && cloudsite.equals(TESTING_KEYWORD)) { - String tenant = req.getTenantId(); - if (tenant != null && tenant.equals(TESTING_KEYWORD)) { - throw new NetworkException("testing."); - } - networkId.value = "479D3D8B-6360-47BC-AB75-21CC91981484"; - neutronNetworkId.value = "55e55884-28fa-11e6-8971-0017f20fe1b8"; - networkFqdn.value = "086f70b6-28fb-11e6-8260-0017f20fe1b8"; - subnetIdMap.value = testMap(); - rollback.value = new NetworkRollback(); - } else if (req.isContrailRequest()) { - ContrailNetwork ctn = req.getContrailNetwork(); - if (ctn == null) { - ctn = new ContrailNetwork(); - req.setContrailNetwork(ctn); - } - if (params.containsKey(SHARED)) { - shared = params.get(SHARED); - } else { - if (ctn.getShared() != null) { - shared = ctn.getShared(); - } - } - if (params.containsKey(EXTERNAL)) { - external = params.get(EXTERNAL); - } else { - if (ctn.getExternal() != null) { - external = ctn.getExternal(); - } - } - adapter.createNetworkContrail(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(), - req.getModelCustomizationUuid(), req.getNetworkName(), - req.getContrailNetwork().getRouteTargets(), shared, external, req.getFailIfExists(), - req.getBackout(), req.getSubnets(), params, req.getContrailNetwork().getPolicyFqdns(), - req.getContrailNetwork().getRouteTableFqdns(), req.getMsoRequest(), networkId, - neutronNetworkId, networkFqdn, subnetIdMap, rollback); - } else { - ProviderVlanNetwork pvn = req.getProviderVlanNetwork(); - if (pvn == null) { - pvn = new ProviderVlanNetwork(); - req.setProviderVlanNetwork(pvn); - } - if (params.containsKey(SHARED)) - shared = params.get(SHARED); - if (params.containsKey(EXTERNAL)) - external = params.get(EXTERNAL); - adapter.createNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(), - req.getModelCustomizationUuid(), req.getNetworkName(), - req.getProviderVlanNetwork().getPhysicalNetworkName(), - req.getProviderVlanNetwork().getVlans(), shared, external, req.getFailIfExists(), - req.getBackout(), req.getSubnets(), params, req.getMsoRequest(), networkId, - neutronNetworkId, subnetIdMap, rollback); - } - response = new CreateNetworkResponse(req.getNetworkId(), neutronNetworkId.value, - rollback.value.getNetworkStackId(), networkFqdn.value, rollback.value.getNetworkCreated(), - subnetIdMap.value, rollback.value, req.getMessageId()); - } catch (NetworkException e) { - logger.debug(exceptionMsg, e); - eresp = new CreateNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); - } - if (!req.isSynchronous()) { - // This is asynch, so POST response back to caller - BpelRestClient bpelClient = bpelRestClientProvider.get(); - bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); - } - logger.debug("CreateNetworkTask exit: code={}, resp={}", getStatusCode(), getResponse()); - } - } - - @DELETE - @Path("{aaiNetworkId}") - @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - @ApiOperation(value = "DeleteNetwork", response = Response.class, - notes = "Deletes an existing network, aaiNetworkId and DeleteNetworkRequest JSON are required") - @ApiResponses({@ApiResponse(code = 200, message = "network has been successfully deleted"), - @ApiResponse(code = 202, message = "request to delete network has been accepted (async only)"), - @ApiResponse(code = 500, message = "delete network failed, examine entity object for details")}) - public Response deleteNetwork( - @ApiParam(value = "aaiNetworkId to be deleted ", - required = true) @PathParam("aaiNetworkId") String aaiNetworkId, - @ApiParam(value = "details of network being deleted", required = true) DeleteNetworkRequest req) { - logger.debug("deleteNetwork enter: {}", req.toJsonString()); - if (aaiNetworkId == null || !aaiNetworkId.equals(req.getNetworkId())) { - return Response.status(HttpStatus.SC_BAD_REQUEST).type(MediaType.TEXT_PLAIN).entity( - "A&AI NetworkId in URL (" + aaiNetworkId + ") does not match content (" + req.getNetworkId() + ")") - .build(); - } - DeleteNetworkTask task = new DeleteNetworkTask(req); - if (req.isSynchronous()) { - // This is a synchronous request - task.run(); - return Response.status(task.getStatusCode()).entity(task.getGenericEntityResponse()).build(); - } else { - // This is an asynchronous request - try { - Thread t1 = new Thread(task); - t1.start(); - } catch (Exception e) { - // problem handling create, send generic failure as sync resp to caller - logger.error("{} {} Exception while delete network ", MessageEnum.RA_DELETE_NETWORK_EXC, - ErrorCode.BusinessProcessError.getValue(), e); - return Response.serverError().build(); - } - // send sync response (ACK) to caller - logger.debug("deleteNetwork exit"); - return Response.status(HttpStatus.SC_ACCEPTED).build(); - } - } - - public class DeleteNetworkTask implements Runnable { - private final DeleteNetworkRequest req; - private DeleteNetworkResponse response = null; - private DeleteNetworkError eresp = null; - private boolean sendxml; - - public DeleteNetworkTask(DeleteNetworkRequest req) { - this.req = req; - this.sendxml = true; // can be set with a field or header later - } - - public int getStatusCode() { - return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST; - } - - public Object getGenericEntityResponse() { - return (response != null) ? new GenericEntity<DeleteNetworkResponse>(response) {} - : new GenericEntity<DeleteNetworkError>(eresp) {}; - } - - private String getResponse() { - if (response != null) { - return sendxml ? response.toXmlString() : response.toJsonString(); - } else { - return sendxml ? eresp.toXmlString() : eresp.toJsonString(); - } - } - - @Override - public void run() { - try { - MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId()); - } catch (Exception e) { - logger.error("Error adding RequestId to MDC", e); - } - logger.debug("DeleteNetworkTask start"); - try { - Holder<Boolean> networkDeleted = new Holder<>(); - if (req.getCloudSiteId().equals(TESTING_KEYWORD)) { - networkDeleted.value = true; - } else { - adapter.deleteNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(), - req.getModelCustomizationUuid(), req.getNetworkStackId(), req.getMsoRequest(), - networkDeleted); - } - response = new DeleteNetworkResponse(req.getNetworkId(), networkDeleted.value, req.getMessageId()); - } catch (NetworkException e) { - logger.debug(exceptionMsg, e); - eresp = new DeleteNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); - } - if (!req.isSynchronous()) { - // This is asynch, so POST response back to caller - BpelRestClient bpelClient = bpelRestClientProvider.get(); - bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); - } - logger.debug("DeleteNetworkTask exit: code={}, resp={}", getStatusCode(), getResponse()); - } - } - - @GET - @Path("{aaiNetworkId}") - @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - @ApiOperation(value = "QueryNetwork", response = Response.class, notes = "Queries an existing network") - @ApiResponses({@ApiResponse(code = 200, message = "Query network successful"), - @ApiResponse(code = 500, message = "Query network failed, examine entity object for details")}) - public Response queryNetwork( - @ApiParam(value = "cloudSiteId", required = false) @QueryParam("cloudSiteId") String cloudSiteId, - @ApiParam(value = "tenantId", required = false) @QueryParam("tenantId") String tenantId, - @ApiParam(value = "networkStackId", required = false) @QueryParam("networkStackId") String networkStackId, - @ApiParam(value = "skipAAI", required = false) @QueryParam("skipAAI") String skipAAI, - @ApiParam(value = "msoRequest.requestId", - required = false) @QueryParam("msoRequest.requestId") String requestId, - @ApiParam(value = "msoRequest.serviceInstanceId", - required = false) @QueryParam("msoRequest.serviceInstanceId") String serviceInstanceId, - @ApiParam(value = "aaiNetworkId", required = false) @PathParam("aaiNetworkId") String aaiNetworkId) { - // This request responds synchronously only - logger.debug("Query network enter:{}" + aaiNetworkId); - MsoRequest msoRequest = new MsoRequest(requestId, serviceInstanceId); - - try { - int respStatus = HttpStatus.SC_OK; - QueryNetworkResponse resp = new QueryNetworkResponse(networkStackId, null, networkStackId, null, null); - Holder<Boolean> networkExists = new Holder<>(); - Holder<String> networkId = new Holder<>(); - Holder<String> neutronNetworkId = new Holder<>(); - Holder<NetworkStatus> status = new Holder<>(); - Holder<List<RouteTarget>> routeTargets = new Holder<>(); - Holder<Map<String, String>> subnetIdMap = new Holder<>(); - - adapter.queryNetworkContrail(cloudSiteId, tenantId, aaiNetworkId, msoRequest, networkExists, networkId, - neutronNetworkId, status, routeTargets, subnetIdMap); - - if (!networkExists.value) { - logger.debug("network not found"); - respStatus = HttpStatus.SC_NOT_FOUND; - } else { - logger.debug("network found {}, status={}", networkId.value, status.value); - resp.setNetworkExists(networkExists.value); - resp.setNetworkId(networkId.value); - resp.setNeutronNetworkId(neutronNetworkId.value); - resp.setNetworkStatus(status.value); - resp.setRouteTargets(routeTargets.value); - resp.setSubnetIdMap(subnetIdMap.value); - } - logger.debug("Query network exit"); - return Response.status(respStatus).entity(new GenericEntity<QueryNetworkResponse>(resp) {}).build(); - } catch (NetworkException e) { - logger.error("{} {} Exception when query VNF ", MessageEnum.RA_QUERY_VNF_ERR, - ErrorCode.BusinessProcessError.getValue(), e); - QueryNetworkError err = new QueryNetworkError(); - err.setMessage(e.getMessage()); - err.setCategory(MsoExceptionCategory.INTERNAL); - return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR) - .entity(new GenericEntity<QueryNetworkError>(err) {}).build(); - } - } - - @DELETE - @Path("{aaiNetworkId}/rollback") - @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - @ApiOperation(value = "RollbackNetwork", response = Response.class, notes = "Rollback an existing network") - @ApiResponses({@ApiResponse(code = 200, message = "Rollback network successful"), - @ApiResponse(code = 202, message = "Rollback network request has been accepted (async only)"), - @ApiResponse(code = 500, message = "Rollback network failed, examine entity object for details")}) - public Response rollbackNetwork( - @ApiParam(value = "RollbackNetworkRequest in JSON format", required = true) RollbackNetworkRequest req) { - logger.debug("rollbackNetwork enter: {}", req.toJsonString()); - RollbackNetworkTask task = new RollbackNetworkTask(req); - if (req.isSynchronous()) { - // This is a synchronous request - task.run(); - return Response.status(task.getStatusCode()).entity(task.getGenericEntityResponse()).build(); - } else { - // This is an asynchronous request - try { - Thread t1 = new Thread(task); - t1.start(); - } catch (Exception e) { - // problem handling create, send generic failure as sync resp to caller - logger.error("{} {} Exception in rollbackNetwork ", MessageEnum.RA_ROLLBACK_NULL, - ErrorCode.BusinessProcessError.getValue(), e); - return Response.serverError().build(); - } - // send sync response (ACK) to caller - logger.debug("rollbackNetwork exit"); - return Response.status(HttpStatus.SC_ACCEPTED).build(); - } - } - - public class RollbackNetworkTask implements Runnable { - private final RollbackNetworkRequest req; - private RollbackNetworkResponse response = null; - private RollbackNetworkError eresp = null; - private boolean sendxml; - - public RollbackNetworkTask(RollbackNetworkRequest req) { - this.req = req; - this.sendxml = true; // can be set with a field or header later - } - - public int getStatusCode() { - return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST; - } - - public Object getGenericEntityResponse() { - return (response != null) ? new GenericEntity<RollbackNetworkResponse>(response) {} - : new GenericEntity<RollbackNetworkError>(eresp) {}; - } - - private String getResponse() { - if (response != null) { - return sendxml ? response.toXmlString() : response.toJsonString(); - } else { - return sendxml ? eresp.toXmlString() : eresp.toJsonString(); - } - } - - @Override - public void run() { - try { - MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getNetworkRollback().getMsoRequest().getRequestId()); - } catch (Exception e) { - logger.error("Error adding RequestId to MDC", e); - } - logger.debug("RollbackNetworkTask start"); - try { - NetworkRollback nwr = req.getNetworkRollback(); - adapter.rollbackNetwork(nwr); - response = new RollbackNetworkResponse(true, req.getMessageId()); - } catch (NetworkException e) { - logger.debug(exceptionMsg, e); - eresp = new RollbackNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, - req.getMessageId()); - } - if (!req.isSynchronous()) { - // This is asynch, so POST response back to caller - BpelRestClient bpelClient = bpelRestClientProvider.get(); - bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); - } - logger.debug("RollbackNetworkTask exit: code={}, resp={}", getStatusCode(), getResponse()); - } - } - - @PUT - @Path("{aaiNetworkId}") - @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) - @ApiOperation(value = "UpdateNetwork", response = Response.class, notes = "Update an existing network") - @ApiResponses({@ApiResponse(code = 200, message = "Update network successful"), - @ApiResponse(code = 202, message = "Update network request has been accepted (async only)"), - @ApiResponse(code = 500, message = "Update network failed, examine entity object for details")}) - public Response updateNetwork( - @ApiParam(value = "aaiNetworkId", required = true) @PathParam("aaiNetworkId") String aaiNetworkId, - @ApiParam(value = "UpdateNetworkRequest in JSON format", required = true) UpdateNetworkRequest req) { - logger.debug("updateNetwork enter: {}", req.toJsonString()); - if (aaiNetworkId == null || !aaiNetworkId.equals(req.getNetworkId())) { - return Response.status(HttpStatus.SC_BAD_REQUEST).type(MediaType.TEXT_PLAIN).entity( - "A&AI NetworkId in URL (" + aaiNetworkId + ") does not match content (" + req.getNetworkId() + ")") - .build(); - } - UpdateNetworkTask task = new UpdateNetworkTask(req); - if (req.isSynchronous()) { - // This is a synchronous request - task.run(); - return Response.status(task.getStatusCode()).entity(task.getGenericEntityResponse()).build(); - } else { - // This is an asynchronous request - try { - Thread t1 = new Thread(task); - t1.start(); - } catch (Exception e) { - // problem handling create, send generic failure as sync resp to caller - logger.error("{} {} Exception in updateNetwork ", MessageEnum.RA_UPDATE_NETWORK_ERR, - ErrorCode.BusinessProcessError.getValue(), e); - return Response.serverError().build(); - } - // send sync response (ACK) to caller - logger.debug("updateNetwork exit"); - return Response.status(HttpStatus.SC_ACCEPTED).build(); - } - } - - public class UpdateNetworkTask implements Runnable { - private final UpdateNetworkRequest req; - private UpdateNetworkResponse response = null; - private UpdateNetworkError eresp = null; - private boolean sendxml; - - public UpdateNetworkTask(UpdateNetworkRequest req) { - this.req = req; - this.sendxml = true; // can be set with a field or header later - } - - public int getStatusCode() { - return (response != null) ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST; - } - - public Object getGenericEntityResponse() { - return (response != null) ? new GenericEntity<UpdateNetworkResponse>(response) {} - : new GenericEntity<UpdateNetworkError>(eresp) {}; - } - - private String getResponse() { - if (response != null) { - return sendxml ? response.toXmlString() : response.toJsonString(); - } else { - return sendxml ? eresp.toXmlString() : eresp.toJsonString(); - } - } - - @Override - public void run() { - try { - MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, req.getMsoRequest().getRequestId()); - } catch (Exception e) { - logger.error("Error adding RequestId to MDC", e); - } - logger.debug("UpdateNetworkTask start"); - try { - Holder<Map<String, String>> subnetIdMap = new Holder<>(); - Holder<NetworkRollback> rollback = new Holder<>(); - HashMap<String, String> params = (HashMap<String, String>) req.getNetworkParams(); - if (params == null) { - params = new HashMap<String, String>(); - } - String shared = null; - String external = null; - - if (req.getCloudSiteId().equals(TESTING_KEYWORD)) { - subnetIdMap.value = testMap(); - NetworkRollback rb = new NetworkRollback(); - rb.setCloudId(req.getCloudSiteId()); - rb.setTenantId(req.getTenantId()); - rb.setMsoRequest(req.getMsoRequest()); - rollback.value = rb; - } else if (req.isContrailRequest()) { - ContrailNetwork ctn = req.getContrailNetwork(); - if (ctn == null) { - ctn = new ContrailNetwork(); - req.setContrailNetwork(ctn); - } - if (params.containsKey(SHARED)) { - shared = params.get(SHARED); - } else { - if (ctn.getShared() != null) { - shared = ctn.getShared(); - } - } - if (params.containsKey(EXTERNAL)) { - external = params.get(EXTERNAL); - } else { - if (ctn.getExternal() != null) { - external = ctn.getExternal(); - } - } - adapter.updateNetworkContrail(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(), - req.getModelCustomizationUuid(), req.getNetworkStackId(), req.getNetworkName(), - req.getContrailNetwork().getRouteTargets(), shared, external, req.getSubnets(), params, - req.getContrailNetwork().getPolicyFqdns(), req.getContrailNetwork().getRouteTableFqdns(), - req.getMsoRequest(), subnetIdMap, rollback); - } else { - ProviderVlanNetwork pvn = req.getProviderVlanNetwork(); - if (pvn == null) { - pvn = new ProviderVlanNetwork(); - req.setProviderVlanNetwork(pvn); - } - if (params.containsKey(SHARED)) { - shared = params.get(SHARED); - } - if (params.containsKey(EXTERNAL)) { - external = params.get(EXTERNAL); - } - adapter.updateNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(), - req.getModelCustomizationUuid(), req.getNetworkStackId(), req.getNetworkName(), - req.getProviderVlanNetwork().getPhysicalNetworkName(), - req.getProviderVlanNetwork().getVlans(), shared, external, req.getSubnets(), params, - req.getMsoRequest(), subnetIdMap, rollback); - } - response = new UpdateNetworkResponse(req.getNetworkId(), null, // NeutronNetworkId is not available from - // an update - subnetIdMap.value, req.getMessageId()); - } catch (NetworkException e) { - logger.debug(exceptionMsg, e); - eresp = new UpdateNetworkError(e.getMessage(), MsoExceptionCategory.INTERNAL, true, req.getMessageId()); - } - if (!req.isSynchronous()) { - // This is asynch, so POST response back to caller - BpelRestClient bpelClient = bpelRestClientProvider.get(); - bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml); - } - logger.debug("UpdateNetworkTask exit: code={}, resp={}", getStatusCode(), getResponse()); - } - } - - public static Map<String, String> testMap() { - Map<String, String> m = new HashMap<>(); - m.put("mickey", "7"); - m.put("clyde", "10"); - m.put("wayne", "99"); - return m; - } -} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/CreateNetworkNotification.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/CreateNetworkNotification.java deleted file mode 100644 index f30ccf2214..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/CreateNetworkNotification.java +++ /dev/null @@ -1,394 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (C) 2018 IBM. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.network.async.client; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p> - * Java class for createNetworkNotification complex type. - * - * <p> - * The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="createNetworkNotification"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="exception" type="{http://org.onap.so/networkNotify}msoExceptionCategory" minOccurs="0"/> - * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="networkId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="neutronNetworkId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="subnetIdMap" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="entry" maxOccurs="unbounded" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * <element name="rollback" type="{http://org.onap.so/networkNotify}networkRollback" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "createNetworkNotification", propOrder = {"messageId", "completed", "exception", "errorMessage", - "networkId", "neutronNetworkId", "subnetIdMap", "rollback"}) -public class CreateNetworkNotification { - - @XmlElement(required = true) - protected String messageId; - protected boolean completed; - protected MsoExceptionCategory exception; - protected String errorMessage; - protected String networkId; - protected String neutronNetworkId; - protected CreateNetworkNotification.SubnetIdMap subnetIdMap; - protected NetworkRollback rollback; - - /** - * Gets the value of the messageId property. - * - * @return possible object is {@link String } - * - */ - public String getMessageId() { - return messageId; - } - - /** - * Sets the value of the messageId property. - * - * @param value allowed object is {@link String } - * - */ - public void setMessageId(String value) { - this.messageId = value; - } - - /** - * Gets the value of the completed property. - * - */ - public boolean isCompleted() { - return completed; - } - - /** - * Sets the value of the completed property. - * - */ - public void setCompleted(boolean value) { - this.completed = value; - } - - /** - * Gets the value of the exception property. - * - * @return possible object is {@link MsoExceptionCategory } - * - */ - public MsoExceptionCategory getException() { - return exception; - } - - /** - * Sets the value of the exception property. - * - * @param value allowed object is {@link MsoExceptionCategory } - * - */ - public void setException(MsoExceptionCategory value) { - this.exception = value; - } - - /** - * Gets the value of the errorMessage property. - * - * @return possible object is {@link String } - * - */ - public String getErrorMessage() { - return errorMessage; - } - - /** - * Sets the value of the errorMessage property. - * - * @param value allowed object is {@link String } - * - */ - public void setErrorMessage(String value) { - this.errorMessage = value; - } - - /** - * Gets the value of the networkId property. - * - * @return possible object is {@link String } - * - */ - public String getNetworkId() { - return networkId; - } - - /** - * Sets the value of the networkId property. - * - * @param value allowed object is {@link String } - * - */ - public void setNetworkId(String value) { - this.networkId = value; - } - - /** - * Gets the value of the neutronNetworkId property. - * - * @return possible object is {@link String } - * - */ - public String getNeutronNetworkId() { - return neutronNetworkId; - } - - /** - * Sets the value of the neutronNetworkId property. - * - * @param value allowed object is {@link String } - * - */ - public void setNeutronNetworkId(String value) { - this.neutronNetworkId = value; - } - - /** - * Gets the value of the subnetIdMap property. - * - * @return possible object is {@link CreateNetworkNotification.SubnetIdMap } - * - */ - public CreateNetworkNotification.SubnetIdMap getSubnetIdMap() { - return subnetIdMap; - } - - /** - * Sets the value of the subnetIdMap property. - * - * @param value allowed object is {@link CreateNetworkNotification.SubnetIdMap } - * - */ - public void setSubnetIdMap(CreateNetworkNotification.SubnetIdMap value) { - this.subnetIdMap = value; - } - - /** - * Gets the value of the rollback property. - * - * @return possible object is {@link NetworkRollback } - * - */ - public NetworkRollback getRollback() { - return rollback; - } - - /** - * Sets the value of the rollback property. - * - * @param value allowed object is {@link NetworkRollback } - * - */ - public void setRollback(NetworkRollback value) { - this.rollback = value; - } - - - /** - * <p> - * Java class for anonymous complex type. - * - * <p> - * The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="entry" maxOccurs="unbounded" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = {"entry"}) - public static class SubnetIdMap { - - protected List<CreateNetworkNotification.SubnetIdMap.Entry> entry; - - /** - * Gets the value of the entry property. - * - * <p> - * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you - * make to the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE> - * method for the entry property. - * - * <p> - * For example, to add a new item, do as follows: - * - * <pre> - * getEntry().add(newItem); - * </pre> - * - * - * <p> - * Objects of the following type(s) are allowed in the list {@link CreateNetworkNotification.SubnetIdMap.Entry } - * - * - */ - public List<CreateNetworkNotification.SubnetIdMap.Entry> getEntry() { - if (entry == null) { - entry = new ArrayList<>(); - } - return this.entry; - } - - - /** - * <p> - * Java class for anonymous complex type. - * - * <p> - * The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = {"key", "value"}) - public static class Entry { - - protected String key; - protected String value; - - /** - * Gets the value of the key property. - * - * @return possible object is {@link String } - * - */ - public String getKey() { - return key; - } - - /** - * Sets the value of the key property. - * - * @param value allowed object is {@link String } - * - */ - public void setKey(String value) { - this.key = value; - } - - /** - * Gets the value of the value property. - * - * @return possible object is {@link String } - * - */ - public String getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - * @param value allowed object is {@link String } - * - */ - public void setValue(String value) { - this.value = value; - } - - } - - } - -} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/CreateNetworkNotificationResponse.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/CreateNetworkNotificationResponse.java deleted file mode 100644 index 4ade875193..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/CreateNetworkNotificationResponse.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.network.async.client; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p> - * Java class for createNetworkNotificationResponse complex type. - * - * <p> - * The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="createNetworkNotificationResponse"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "createNetworkNotificationResponse") -public class CreateNetworkNotificationResponse { - - -} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/DeleteNetworkNotification.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/DeleteNetworkNotification.java deleted file mode 100644 index ff94be9156..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/DeleteNetworkNotification.java +++ /dev/null @@ -1,162 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.network.async.client; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p> - * Java class for deleteNetworkNotification complex type. - * - * <p> - * The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="deleteNetworkNotification"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="exception" type="{http://org.onap.so/networkNotify}msoExceptionCategory" minOccurs="0"/> - * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="networkDeleted" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "deleteNetworkNotification", - propOrder = {"messageId", "completed", "exception", "errorMessage", "networkDeleted"}) -public class DeleteNetworkNotification { - - @XmlElement(required = true) - protected String messageId; - protected boolean completed; - protected MsoExceptionCategory exception; - protected String errorMessage; - protected Boolean networkDeleted; - - /** - * Gets the value of the messageId property. - * - * @return possible object is {@link String } - * - */ - public String getMessageId() { - return messageId; - } - - /** - * Sets the value of the messageId property. - * - * @param value allowed object is {@link String } - * - */ - public void setMessageId(String value) { - this.messageId = value; - } - - /** - * Gets the value of the completed property. - * - */ - public boolean isCompleted() { - return completed; - } - - /** - * Sets the value of the completed property. - * - */ - public void setCompleted(boolean value) { - this.completed = value; - } - - /** - * Gets the value of the exception property. - * - * @return possible object is {@link MsoExceptionCategory } - * - */ - public MsoExceptionCategory getException() { - return exception; - } - - /** - * Sets the value of the exception property. - * - * @param value allowed object is {@link MsoExceptionCategory } - * - */ - public void setException(MsoExceptionCategory value) { - this.exception = value; - } - - /** - * Gets the value of the errorMessage property. - * - * @return possible object is {@link String } - * - */ - public String getErrorMessage() { - return errorMessage; - } - - /** - * Sets the value of the errorMessage property. - * - * @param value allowed object is {@link String } - * - */ - public void setErrorMessage(String value) { - this.errorMessage = value; - } - - /** - * Gets the value of the networkDeleted property. - * - * @return possible object is {@link Boolean } - * - */ - public Boolean isNetworkDeleted() { - return networkDeleted; - } - - /** - * Sets the value of the networkDeleted property. - * - * @param value allowed object is {@link Boolean } - * - */ - public void setNetworkDeleted(Boolean value) { - this.networkDeleted = value; - } - -} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/DeleteNetworkNotificationResponse.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/DeleteNetworkNotificationResponse.java deleted file mode 100644 index 7f7d0ae569..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/DeleteNetworkNotificationResponse.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.network.async.client; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p> - * Java class for deleteNetworkNotificationResponse complex type. - * - * <p> - * The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="deleteNetworkNotificationResponse"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "deleteNetworkNotificationResponse") -public class DeleteNetworkNotificationResponse { - - -} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/MsoExceptionCategory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/MsoExceptionCategory.java deleted file mode 100644 index ad3c541730..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/MsoExceptionCategory.java +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.network.async.client; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p> - * Java class for msoExceptionCategory. - * - * <p> - * The following schema fragment specifies the expected content contained within this class. - * <p> - * - * <pre> - * <simpleType name="msoExceptionCategory"> - * <restriction base="{http://www.w3.org/2001/XMLSchema}string"> - * <enumeration value="OPENSTACK"/> - * <enumeration value="IO"/> - * <enumeration value="INTERNAL"/> - * <enumeration value="USERDATA"/> - * </restriction> - * </simpleType> - * </pre> - * - */ -@XmlType(name = "msoExceptionCategory") -@XmlEnum -public enum MsoExceptionCategory { - - OPENSTACK, IO, INTERNAL, USERDATA; - - public String value() { - return name(); - } - - public static MsoExceptionCategory fromValue(String v) { - return valueOf(v); - } - -} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/MsoRequest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/MsoRequest.java deleted file mode 100644 index 90ae448660..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/MsoRequest.java +++ /dev/null @@ -1,97 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.network.async.client; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p> - * Java class for msoRequest complex type. - * - * <p> - * The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="msoRequest"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="requestId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="serviceInstanceId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "msoRequest", propOrder = {"requestId", "serviceInstanceId"}) -public class MsoRequest { - - protected String requestId; - protected String serviceInstanceId; - - /** - * Gets the value of the requestId property. - * - * @return possible object is {@link String } - * - */ - public String getRequestId() { - return requestId; - } - - /** - * Sets the value of the requestId property. - * - * @param value allowed object is {@link String } - * - */ - public void setRequestId(String value) { - this.requestId = value; - } - - /** - * Gets the value of the serviceInstanceId property. - * - * @return possible object is {@link String } - * - */ - public String getServiceInstanceId() { - return serviceInstanceId; - } - - /** - * Sets the value of the serviceInstanceId property. - * - * @param value allowed object is {@link String } - * - */ - public void setServiceInstanceId(String value) { - this.serviceInstanceId = value; - } - -} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify.java deleted file mode 100644 index 8fb62cc32e..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify.java +++ /dev/null @@ -1,170 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.network.async.client; - -import java.util.List; -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebService; -import javax.xml.bind.annotation.XmlSeeAlso; -import javax.xml.ws.Action; -import javax.xml.ws.RequestWrapper; -import javax.xml.ws.ResponseWrapper; - - -/** - * This class was generated by the JAX-WS RI. JAX-WS RI 2.2.9-b14002 Generated source version: 2.2 - * - */ -@WebService(name = "networkAdapterNotify", targetNamespace = "http://org.onap.so/networkNotify") -@XmlSeeAlso({ObjectFactory.class}) -public interface NetworkAdapterNotify { - - - /** - * - * @param exception - * @param errorMessage - * @param messageId - * @param completed - */ - @WebMethod - @RequestWrapper(localName = "rollbackNetworkNotification", targetNamespace = "http://org.onap.so/networkNotify", - className = "org.onap.so.adapters.network.async.client.RollbackNetworkNotification") - @ResponseWrapper(localName = "rollbackNetworkNotificationResponse", - targetNamespace = "http://org.onap.so/networkNotify", - className = "org.onap.so.adapters.network.async.client.RollbackNetworkNotificationResponse") - @Action(input = "http://org.onap.so/notify/adapterNotify/rollbackNetworkNotificationRequest", - output = "http://org.onap.so/notify/adapterNotify/rollbackNetworkNotificationResponse") - public void rollbackNetworkNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId, - @WebParam(name = "completed", targetNamespace = "") boolean completed, - @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage); - - /** - * - * @param exception - * @param vlans - * @param networkExists - * @param errorMessage - * @param messageId - * @param networkId - * @param completed - * @param neutronNetworkId - * @param status - * @param subnetIdMap - */ - @WebMethod - @RequestWrapper(localName = "queryNetworkNotification", targetNamespace = "http://org.onap.so/networkNotify", - className = "org.onap.so.adapters.network.async.client.QueryNetworkNotification") - @ResponseWrapper(localName = "queryNetworkNotificationResponse", - targetNamespace = "http://org.onap.so/networkNotify", - className = "org.onap.so.adapters.network.async.client.QueryNetworkNotificationResponse") - @Action(input = "http://org.onap.so/notify/adapterNotify/queryNetworkNotificationRequest", - output = "http://org.onap.so/notify/adapterNotify/queryNetworkNotificationResponse") - public void queryNetworkNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId, - @WebParam(name = "completed", targetNamespace = "") boolean completed, - @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage, - @WebParam(name = "networkExists", targetNamespace = "") Boolean networkExists, - @WebParam(name = "networkId", targetNamespace = "") String networkId, - @WebParam(name = "neutronNetworkId", targetNamespace = "") String neutronNetworkId, - @WebParam(name = "status", targetNamespace = "") NetworkStatus status, - @WebParam(name = "vlans", targetNamespace = "") List<Integer> vlans, @WebParam(name = "subnetIdMap", - targetNamespace = "") org.onap.so.adapters.network.async.client.QueryNetworkNotification.SubnetIdMap subnetIdMap); - - /** - * - * @param exception - * @param rollback - * @param errorMessage - * @param messageId - * @param networkId - * @param completed - * @param neutronNetworkId - * @param subnetIdMap - */ - @WebMethod - @RequestWrapper(localName = "createNetworkNotification", targetNamespace = "http://org.onap.so/networkNotify", - className = "org.onap.so.adapters.network.async.client.CreateNetworkNotification") - @ResponseWrapper(localName = "createNetworkNotificationResponse", - targetNamespace = "http://org.onap.so/networkNotify", - className = "org.onap.so.adapters.network.async.client.CreateNetworkNotificationResponse") - @Action(input = "http://org.onap.so/notify/adapterNotify/createNetworkNotificationRequest", - output = "http://org.onap.so/notify/adapterNotify/createNetworkNotificationResponse") - public void createNetworkNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId, - @WebParam(name = "completed", targetNamespace = "") boolean completed, - @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage, - @WebParam(name = "networkId", targetNamespace = "") String networkId, - @WebParam(name = "neutronNetworkId", targetNamespace = "") String neutronNetworkId, - @WebParam(name = "subnetIdMap", - targetNamespace = "") org.onap.so.adapters.network.async.client.CreateNetworkNotification.SubnetIdMap subnetIdMap, - @WebParam(name = "rollback", targetNamespace = "") NetworkRollback rollback); - - /** - * - * @param exception - * @param networkDeleted - * @param errorMessage - * @param messageId - * @param completed - */ - @WebMethod - @RequestWrapper(localName = "deleteNetworkNotification", targetNamespace = "http://org.onap.so/networkNotify", - className = "org.onap.so.adapters.network.async.client.DeleteNetworkNotification") - @ResponseWrapper(localName = "deleteNetworkNotificationResponse", - targetNamespace = "http://org.onap.so/networkNotify", - className = "org.onap.so.adapters.network.async.client.DeleteNetworkNotificationResponse") - @Action(input = "http://org.onap.so/notify/adapterNotify/deleteNetworkNotificationRequest", - output = "http://org.onap.so/notify/adapterNotify/deleteNetworkNotificationResponse") - public void deleteNetworkNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId, - @WebParam(name = "completed", targetNamespace = "") boolean completed, - @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage, - @WebParam(name = "networkDeleted", targetNamespace = "") Boolean networkDeleted); - - /** - * - * @param exception - * @param rollback - * @param errorMessage - * @param messageId - * @param completed - * @param subnetIdMap - */ - @WebMethod - @RequestWrapper(localName = "updateNetworkNotification", targetNamespace = "http://org.onap.so/networkNotify", - className = "org.onap.so.adapters.network.async.client.UpdateNetworkNotification") - @ResponseWrapper(localName = "updateNetworkNotificationResponse", - targetNamespace = "http://org.onap.so/networkNotify", - className = "org.onap.so.adapters.network.async.client.UpdateNetworkNotificationResponse") - @Action(input = "http://org.onap.so/notify/adapterNotify/updateNetworkNotificationRequest", - output = "http://org.onap.so/notify/adapterNotify/updateNetworkNotificationResponse") - public void updateNetworkNotification(@WebParam(name = "messageId", targetNamespace = "") String messageId, - @WebParam(name = "completed", targetNamespace = "") boolean completed, - @WebParam(name = "exception", targetNamespace = "") MsoExceptionCategory exception, - @WebParam(name = "errorMessage", targetNamespace = "") String errorMessage, - @WebParam(name = "subnetIdMap", - targetNamespace = "") org.onap.so.adapters.network.async.client.UpdateNetworkNotification.SubnetIdMap subnetIdMap, - @WebParam(name = "rollback", targetNamespace = "") NetworkRollback rollback); - -} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify_Service.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify_Service.java deleted file mode 100644 index 68142e6cc9..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkAdapterNotify_Service.java +++ /dev/null @@ -1,110 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (C) 2018 IBM. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.network.async.client; - -import java.net.URL; -import javax.xml.namespace.QName; -import javax.xml.ws.Service; -import javax.xml.ws.WebEndpoint; -import javax.xml.ws.WebServiceClient; -import javax.xml.ws.WebServiceException; -import javax.xml.ws.WebServiceFeature; - - -/** - * This class was generated by the JAX-WS RI. JAX-WS RI 2.2.9-b14002 Generated source version: 2.2 - * - */ -@WebServiceClient(name = "networkAdapterNotify", targetNamespace = "http://org.onap.so/networkNotify", - wsdlLocation = "/NetworkAdapterNotify.wsdl") -public class NetworkAdapterNotify_Service extends Service { - - private static final URL NETWORKADAPTERNOTIFY_WSDL_LOCATION; - private static final WebServiceException NETWORKADAPTERNOTIFY_EXCEPTION; - private static final String URL = "http://org.onap.so/networkNotify"; - private static final QName NETWORKADAPTERNOTIFY_QNAME = new QName(URL, "networkAdapterNotify"); - - static { - NETWORKADAPTERNOTIFY_WSDL_LOCATION = - org.onap.so.adapters.network.async.client.NetworkAdapterNotify_Service.class - .getResource("/NetworkAdapterNotify.wsdl"); - WebServiceException e = null; - if (NETWORKADAPTERNOTIFY_WSDL_LOCATION == null) { - e = new WebServiceException( - "Cannot find '/NetworkAdapterNotify.wsdl' wsdl. Place the resource correctly in the classpath."); - } - NETWORKADAPTERNOTIFY_EXCEPTION = e; - } - - public NetworkAdapterNotify_Service() { - super(getWsdlLocation(), NETWORKADAPTERNOTIFY_QNAME); - } - - public NetworkAdapterNotify_Service(WebServiceFeature... features) { - super(getWsdlLocation(), NETWORKADAPTERNOTIFY_QNAME, features); - } - - public NetworkAdapterNotify_Service(URL wsdlLocation) { - super(wsdlLocation, NETWORKADAPTERNOTIFY_QNAME); - } - - public NetworkAdapterNotify_Service(URL wsdlLocation, WebServiceFeature... features) { - super(wsdlLocation, NETWORKADAPTERNOTIFY_QNAME, features); - } - - public NetworkAdapterNotify_Service(URL wsdlLocation, QName serviceName) { - super(wsdlLocation, serviceName); - } - - public NetworkAdapterNotify_Service(URL wsdlLocation, QName serviceName, WebServiceFeature... features) { - super(wsdlLocation, serviceName, features); - } - - /** - * - * @return returns NetworkAdapterNotify - */ - @WebEndpoint(name = "MsoNetworkAdapterAsyncImplPort") - public NetworkAdapterNotify getMsoNetworkAdapterAsyncImplPort() { - return super.getPort(new QName(URL, "MsoNetworkAdapterAsyncImplPort"), NetworkAdapterNotify.class); - } - - /** - * - * @param features A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features - * not in the <code>features</code> parameter will have their default values. - * @return returns NetworkAdapterNotify - */ - @WebEndpoint(name = "MsoNetworkAdapterAsyncImplPort") - public NetworkAdapterNotify getMsoNetworkAdapterAsyncImplPort(WebServiceFeature... features) { - return super.getPort(new QName(URL, "MsoNetworkAdapterAsyncImplPort"), NetworkAdapterNotify.class, features); - } - - private static URL getWsdlLocation() { - if (NETWORKADAPTERNOTIFY_EXCEPTION != null) { - throw NETWORKADAPTERNOTIFY_EXCEPTION; - } - return NETWORKADAPTERNOTIFY_WSDL_LOCATION; - } - -} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkRollback.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkRollback.java deleted file mode 100644 index c51a21d5f0..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkRollback.java +++ /dev/null @@ -1,325 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (C) 2018 IBM. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.network.async.client; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p> - * Java class for networkRollback complex type. - * - * <p> - * The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="networkRollback"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="cloudId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="msoRequest" type="{http://org.onap.so/networkNotify}msoRequest" minOccurs="0"/> - * <element name="networkCreated" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="networkId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="networkStackId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="networkName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="networkType" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="networkUpdated" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="neutronNetworkId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="physicalNetwork" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="tenantId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="vlans" type="{http://www.w3.org/2001/XMLSchema}int" maxOccurs="unbounded" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "networkRollback", - propOrder = {"cloudId", "msoRequest", "networkCreated", "networkId", "networkStackId", "networkName", - "networkType", "networkUpdated", "neutronNetworkId", "physicalNetwork", "tenantId", "vlans"}) -public class NetworkRollback { - - protected String cloudId; - protected MsoRequest msoRequest; - protected boolean networkCreated; - protected String networkId; - protected String networkStackId; - protected String networkName; - protected String networkType; - protected boolean networkUpdated; - protected String neutronNetworkId; - protected String physicalNetwork; - protected String tenantId; - @XmlElement(nillable = true) - protected List<Integer> vlans; - - /** - * Gets the value of the cloudId property. - * - * @return possible object is {@link String } - * - */ - public String getCloudId() { - return cloudId; - } - - /** - * Sets the value of the cloudId property. - * - * @param value allowed object is {@link String } - * - */ - public void setCloudId(String value) { - this.cloudId = value; - } - - /** - * Gets the value of the msoRequest property. - * - * @return possible object is {@link MsoRequest } - * - */ - public MsoRequest getMsoRequest() { - return msoRequest; - } - - /** - * Sets the value of the msoRequest property. - * - * @param value allowed object is {@link MsoRequest } - * - */ - public void setMsoRequest(MsoRequest value) { - this.msoRequest = value; - } - - /** - * Gets the value of the networkCreated property. - * - */ - public boolean isNetworkCreated() { - return networkCreated; - } - - /** - * Sets the value of the networkCreated property. - * - */ - public void setNetworkCreated(boolean value) { - this.networkCreated = value; - } - - /** - * Gets the value of the networkId property. - * - * @return possible object is {@link String } - * - */ - public String getNetworkId() { - return networkId; - } - - /** - * Sets the value of the networkId property. - * - * @param value allowed object is {@link String } - * - */ - public void setNetworkId(String value) { - this.networkId = value; - } - - /** - * Gets the value of the networkStackId property. - * - * @return possible object is {@link String } - * - */ - public String getNetworkStackId() { - return networkStackId; - } - - /** - * Sets the value of the networkStackId property. - * - * @param value allowed object is {@link String } - * - */ - public void setNetworkStackId(String value) { - this.networkStackId = value; - } - - /** - * Gets the value of the networkName property. - * - * @return possible object is {@link String } - * - */ - public String getNetworkName() { - return networkName; - } - - /** - * Sets the value of the networkName property. - * - * @param value allowed object is {@link String } - * - */ - public void setNetworkName(String value) { - this.networkName = value; - } - - /** - * Gets the value of the networkType property. - * - * @return possible object is {@link String } - * - */ - public String getNetworkType() { - return networkType; - } - - /** - * Sets the value of the networkType property. - * - * @param value allowed object is {@link String } - * - */ - public void setNetworkType(String value) { - this.networkType = value; - } - - /** - * Gets the value of the networkUpdated property. - * - */ - public boolean isNetworkUpdated() { - return networkUpdated; - } - - /** - * Sets the value of the networkUpdated property. - * - */ - public void setNetworkUpdated(boolean value) { - this.networkUpdated = value; - } - - /** - * Gets the value of the neutronNetworkId property. - * - * @return possible object is {@link String } - * - */ - public String getNeutronNetworkId() { - return neutronNetworkId; - } - - /** - * Sets the value of the neutronNetworkId property. - * - * @param value allowed object is {@link String } - * - */ - public void setNeutronNetworkId(String value) { - this.neutronNetworkId = value; - } - - /** - * Gets the value of the physicalNetwork property. - * - * @return possible object is {@link String } - * - */ - public String getPhysicalNetwork() { - return physicalNetwork; - } - - /** - * Sets the value of the physicalNetwork property. - * - * @param value allowed object is {@link String } - * - */ - public void setPhysicalNetwork(String value) { - this.physicalNetwork = value; - } - - /** - * Gets the value of the tenantId property. - * - * @return possible object is {@link String } - * - */ - public String getTenantId() { - return tenantId; - } - - /** - * Sets the value of the tenantId property. - * - * @param value allowed object is {@link String } - * - */ - public void setTenantId(String value) { - this.tenantId = value; - } - - /** - * Gets the value of the vlans property. - * - * <p> - * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to - * the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE> method for - * the vlans property. - * - * <p> - * For example, to add a new item, do as follows: - * - * <pre> - * getVlans().add(newItem); - * </pre> - * - * - * <p> - * Objects of the following type(s) are allowed in the list {@link Integer } - * - * - */ - public List<Integer> getVlans() { - if (vlans == null) { - vlans = new ArrayList<>(); - } - return this.vlans; - } - -} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkStatus.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkStatus.java deleted file mode 100644 index 36641477c0..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/NetworkStatus.java +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.network.async.client; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p> - * Java class for networkStatus. - * - * <p> - * The following schema fragment specifies the expected content contained within this class. - * <p> - * - * <pre> - * <simpleType name="networkStatus"> - * <restriction base="{http://www.w3.org/2001/XMLSchema}string"> - * <enumeration value="NOTFOUND"/> - * <enumeration value="ACTIVE"/> - * <enumeration value="DOWN"/> - * <enumeration value="BUILD"/> - * <enumeration value="ERROR"/> - * <enumeration value="UNKNOWN"/> - * </restriction> - * </simpleType> - * </pre> - * - */ -@XmlType(name = "networkStatus") -@XmlEnum -public enum NetworkStatus { - - NOTFOUND, ACTIVE, DOWN, BUILD, ERROR, UNKNOWN; - - public String value() { - return name(); - } - - public static NetworkStatus fromValue(String v) { - return valueOf(v); - } - -} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java deleted file mode 100644 index a7a2974660..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/ObjectFactory.java +++ /dev/null @@ -1,311 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.network.async.client; - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.annotation.XmlElementDecl; -import javax.xml.bind.annotation.XmlRegistry; -import javax.xml.namespace.QName; - - -/** - * This object contains factory methods for each Java content interface and Java element interface generated in the - * org.onap.so.adapters.network.async.client package. - * <p> - * An ObjectFactory allows you to programatically construct new instances of the Java representation for XML content. - * The Java representation of XML content can consist of schema derived interfaces and classes representing the binding - * of schema type definitions, element declarations and model groups. Factory methods for each of these are provided in - * this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - private static final String URL = "http://org.onap.so/networkNotify"; - private static final QName _RollbackNetworkNotification_QNAME = new QName(URL, "rollbackNetworkNotification"); - private static final QName _UpdateNetworkNotification_QNAME = new QName(URL, "updateNetworkNotification"); - private static final QName _QueryNetworkNotificationResponse_QNAME = - new QName(URL, "queryNetworkNotificationResponse"); - private static final QName _UpdateNetworkNotificationResponse_QNAME = - new QName(URL, "updateNetworkNotificationResponse"); - private static final QName _CreateNetworkNotificationResponse_QNAME = - new QName(URL, "createNetworkNotificationResponse"); - private static final QName _DeleteNetworkNotification_QNAME = new QName(URL, "deleteNetworkNotification"); - private static final QName _DeleteNetworkNotificationResponse_QNAME = - new QName(URL, "deleteNetworkNotificationResponse"); - private static final QName _CreateNetworkNotification_QNAME = new QName(URL, "createNetworkNotification"); - private static final QName _QueryNetworkNotification_QNAME = new QName(URL, "queryNetworkNotification"); - private static final QName _RollbackNetworkNotificationResponse_QNAME = - new QName(URL, "rollbackNetworkNotificationResponse"); - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: - * org.onap.so.adapters.network.async.client - * - */ - public ObjectFactory() {} - - /** - * Create an instance of {@link QueryNetworkNotification } - * - */ - public QueryNetworkNotification createQueryNetworkNotification() { - return new QueryNetworkNotification(); - } - - /** - * Create an instance of {@link QueryNetworkNotification.SubnetIdMap } - * - */ - public QueryNetworkNotification.SubnetIdMap createQueryNetworkNotificationSubnetIdMap() { - return new QueryNetworkNotification.SubnetIdMap(); - } - - /** - * Create an instance of {@link CreateNetworkNotification } - * - */ - public CreateNetworkNotification createCreateNetworkNotification() { - return new CreateNetworkNotification(); - } - - /** - * Create an instance of {@link CreateNetworkNotification.SubnetIdMap } - * - */ - public CreateNetworkNotification.SubnetIdMap createCreateNetworkNotificationSubnetIdMap() { - return new CreateNetworkNotification.SubnetIdMap(); - } - - /** - * Create an instance of {@link UpdateNetworkNotification } - * - */ - public UpdateNetworkNotification createUpdateNetworkNotification() { - return new UpdateNetworkNotification(); - } - - /** - * Create an instance of {@link UpdateNetworkNotification.SubnetIdMap } - * - */ - public UpdateNetworkNotification.SubnetIdMap createUpdateNetworkNotificationSubnetIdMap() { - return new UpdateNetworkNotification.SubnetIdMap(); - } - - /** - * Create an instance of {@link UpdateNetworkNotificationResponse } - * - */ - public UpdateNetworkNotificationResponse createUpdateNetworkNotificationResponse() { - return new UpdateNetworkNotificationResponse(); - } - - /** - * Create an instance of {@link CreateNetworkNotificationResponse } - * - */ - public CreateNetworkNotificationResponse createCreateNetworkNotificationResponse() { - return new CreateNetworkNotificationResponse(); - } - - /** - * Create an instance of {@link RollbackNetworkNotification } - * - */ - public RollbackNetworkNotification createRollbackNetworkNotification() { - return new RollbackNetworkNotification(); - } - - /** - * Create an instance of {@link QueryNetworkNotificationResponse } - * - */ - public QueryNetworkNotificationResponse createQueryNetworkNotificationResponse() { - return new QueryNetworkNotificationResponse(); - } - - /** - * Create an instance of {@link RollbackNetworkNotificationResponse } - * - */ - public RollbackNetworkNotificationResponse createRollbackNetworkNotificationResponse() { - return new RollbackNetworkNotificationResponse(); - } - - /** - * Create an instance of {@link DeleteNetworkNotification } - * - */ - public DeleteNetworkNotification createDeleteNetworkNotification() { - return new DeleteNetworkNotification(); - } - - /** - * Create an instance of {@link DeleteNetworkNotificationResponse } - * - */ - public DeleteNetworkNotificationResponse createDeleteNetworkNotificationResponse() { - return new DeleteNetworkNotificationResponse(); - } - - /** - * Create an instance of {@link NetworkRollback } - * - */ - public NetworkRollback createNetworkRollback() { - return new NetworkRollback(); - } - - /** - * Create an instance of {@link MsoRequest } - * - */ - public MsoRequest createMsoRequest() { - return new MsoRequest(); - } - - /** - * Create an instance of {@link QueryNetworkNotification.SubnetIdMap.Entry } - * - */ - public QueryNetworkNotification.SubnetIdMap.Entry createQueryNetworkNotificationSubnetIdMapEntry() { - return new QueryNetworkNotification.SubnetIdMap.Entry(); - } - - /** - * Create an instance of {@link CreateNetworkNotification.SubnetIdMap.Entry } - * - */ - public CreateNetworkNotification.SubnetIdMap.Entry createCreateNetworkNotificationSubnetIdMapEntry() { - return new CreateNetworkNotification.SubnetIdMap.Entry(); - } - - /** - * Create an instance of {@link UpdateNetworkNotification.SubnetIdMap.Entry } - * - */ - public UpdateNetworkNotification.SubnetIdMap.Entry createUpdateNetworkNotificationSubnetIdMapEntry() { - return new UpdateNetworkNotification.SubnetIdMap.Entry(); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link RollbackNetworkNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = URL, name = "rollbackNetworkNotification") - public JAXBElement<RollbackNetworkNotification> createRollbackNetworkNotification( - RollbackNetworkNotification value) { - return new JAXBElement<>(_RollbackNetworkNotification_QNAME, RollbackNetworkNotification.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link UpdateNetworkNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = URL, name = "updateNetworkNotification") - public JAXBElement<UpdateNetworkNotification> createUpdateNetworkNotification(UpdateNetworkNotification value) { - return new JAXBElement<>(_UpdateNetworkNotification_QNAME, UpdateNetworkNotification.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link QueryNetworkNotificationResponse }{@code >}} - * - */ - @XmlElementDecl(namespace = URL, name = "queryNetworkNotificationResponse") - public JAXBElement<QueryNetworkNotificationResponse> createQueryNetworkNotificationResponse( - QueryNetworkNotificationResponse value) { - return new JAXBElement<>(_QueryNetworkNotificationResponse_QNAME, QueryNetworkNotificationResponse.class, null, - value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link UpdateNetworkNotificationResponse }{@code >}} - * - */ - @XmlElementDecl(namespace = URL, name = "updateNetworkNotificationResponse") - public JAXBElement<UpdateNetworkNotificationResponse> createUpdateNetworkNotificationResponse( - UpdateNetworkNotificationResponse value) { - return new JAXBElement<>(_UpdateNetworkNotificationResponse_QNAME, UpdateNetworkNotificationResponse.class, - null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link CreateNetworkNotificationResponse }{@code >}} - * - */ - @XmlElementDecl(namespace = URL, name = "createNetworkNotificationResponse") - public JAXBElement<CreateNetworkNotificationResponse> createCreateNetworkNotificationResponse( - CreateNetworkNotificationResponse value) { - return new JAXBElement<>(_CreateNetworkNotificationResponse_QNAME, CreateNetworkNotificationResponse.class, - null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link DeleteNetworkNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = URL, name = "deleteNetworkNotification") - public JAXBElement<DeleteNetworkNotification> createDeleteNetworkNotification(DeleteNetworkNotification value) { - return new JAXBElement<>(_DeleteNetworkNotification_QNAME, DeleteNetworkNotification.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link DeleteNetworkNotificationResponse }{@code >}} - * - */ - @XmlElementDecl(namespace = URL, name = "deleteNetworkNotificationResponse") - public JAXBElement<DeleteNetworkNotificationResponse> createDeleteNetworkNotificationResponse( - DeleteNetworkNotificationResponse value) { - return new JAXBElement<>(_DeleteNetworkNotificationResponse_QNAME, DeleteNetworkNotificationResponse.class, - null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link CreateNetworkNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = URL, name = "createNetworkNotification") - public JAXBElement<CreateNetworkNotification> createCreateNetworkNotification(CreateNetworkNotification value) { - return new JAXBElement<>(_CreateNetworkNotification_QNAME, CreateNetworkNotification.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link QueryNetworkNotification }{@code >}} - * - */ - @XmlElementDecl(namespace = URL, name = "queryNetworkNotification") - public JAXBElement<QueryNetworkNotification> createQueryNetworkNotification(QueryNetworkNotification value) { - return new JAXBElement<>(_QueryNetworkNotification_QNAME, QueryNetworkNotification.class, null, value); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link RollbackNetworkNotificationResponse }{@code >}} - * - */ - @XmlElementDecl(namespace = URL, name = "rollbackNetworkNotificationResponse") - public JAXBElement<RollbackNetworkNotificationResponse> createRollbackNetworkNotificationResponse( - RollbackNetworkNotificationResponse value) { - return new JAXBElement<>(_RollbackNetworkNotificationResponse_QNAME, RollbackNetworkNotificationResponse.class, - null, value); - } - -} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/QueryNetworkNotification.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/QueryNetworkNotification.java deleted file mode 100644 index d9adbf2ad2..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/QueryNetworkNotification.java +++ /dev/null @@ -1,447 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (C) 2018 IBM. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.network.async.client; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p> - * Java class for queryNetworkNotification complex type. - * - * <p> - * The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="queryNetworkNotification"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="exception" type="{http://org.onap.so/networkNotify}msoExceptionCategory" minOccurs="0"/> - * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="networkExists" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/> - * <element name="networkId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="neutronNetworkId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="status" type="{http://org.onap.so/networkNotify}networkStatus" minOccurs="0"/> - * <element name="vlans" type="{http://www.w3.org/2001/XMLSchema}int" maxOccurs="unbounded" minOccurs="0"/> - * <element name="subnetIdMap" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="entry" maxOccurs="unbounded" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "queryNetworkNotification", propOrder = {"messageId", "completed", "exception", "errorMessage", - "networkExists", "networkId", "neutronNetworkId", "status", "vlans", "subnetIdMap"}) -public class QueryNetworkNotification { - - @XmlElement(required = true) - protected String messageId; - protected boolean completed; - protected MsoExceptionCategory exception; - protected String errorMessage; - protected Boolean networkExists; - protected String networkId; - protected String neutronNetworkId; - protected NetworkStatus status; - @XmlElement(type = Integer.class) - protected List<Integer> vlans; - protected QueryNetworkNotification.SubnetIdMap subnetIdMap; - - /** - * Gets the value of the messageId property. - * - * @return possible object is {@link String } - * - */ - public String getMessageId() { - return messageId; - } - - /** - * Sets the value of the messageId property. - * - * @param value allowed object is {@link String } - * - */ - public void setMessageId(String value) { - this.messageId = value; - } - - /** - * Gets the value of the completed property. - * - */ - public boolean isCompleted() { - return completed; - } - - /** - * Sets the value of the completed property. - * - */ - public void setCompleted(boolean value) { - this.completed = value; - } - - /** - * Gets the value of the exception property. - * - * @return possible object is {@link MsoExceptionCategory } - * - */ - public MsoExceptionCategory getException() { - return exception; - } - - /** - * Sets the value of the exception property. - * - * @param value allowed object is {@link MsoExceptionCategory } - * - */ - public void setException(MsoExceptionCategory value) { - this.exception = value; - } - - /** - * Gets the value of the errorMessage property. - * - * @return possible object is {@link String } - * - */ - public String getErrorMessage() { - return errorMessage; - } - - /** - * Sets the value of the errorMessage property. - * - * @param value allowed object is {@link String } - * - */ - public void setErrorMessage(String value) { - this.errorMessage = value; - } - - /** - * Gets the value of the networkExists property. - * - * @return possible object is {@link Boolean } - * - */ - public Boolean isNetworkExists() { - return networkExists; - } - - /** - * Sets the value of the networkExists property. - * - * @param value allowed object is {@link Boolean } - * - */ - public void setNetworkExists(Boolean value) { - this.networkExists = value; - } - - /** - * Gets the value of the networkId property. - * - * @return possible object is {@link String } - * - */ - public String getNetworkId() { - return networkId; - } - - /** - * Sets the value of the networkId property. - * - * @param value allowed object is {@link String } - * - */ - public void setNetworkId(String value) { - this.networkId = value; - } - - /** - * Gets the value of the neutronNetworkId property. - * - * @return possible object is {@link String } - * - */ - public String getNeutronNetworkId() { - return neutronNetworkId; - } - - /** - * Sets the value of the neutronNetworkId property. - * - * @param value allowed object is {@link String } - * - */ - public void setNeutronNetworkId(String value) { - this.neutronNetworkId = value; - } - - /** - * Gets the value of the status property. - * - * @return possible object is {@link NetworkStatus } - * - */ - public NetworkStatus getStatus() { - return status; - } - - /** - * Sets the value of the status property. - * - * @param value allowed object is {@link NetworkStatus } - * - */ - public void setStatus(NetworkStatus value) { - this.status = value; - } - - /** - * Gets the value of the vlans property. - * - * <p> - * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to - * the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE> method for - * the vlans property. - * - * <p> - * For example, to add a new item, do as follows: - * - * <pre> - * getVlans().add(newItem); - * </pre> - * - * - * <p> - * Objects of the following type(s) are allowed in the list {@link Integer } - * - * - */ - public List<Integer> getVlans() { - if (vlans == null) { - vlans = new ArrayList<>(); - } - return this.vlans; - } - - /** - * Gets the value of the subnetIdMap property. - * - * @return possible object is {@link QueryNetworkNotification.SubnetIdMap } - * - */ - public QueryNetworkNotification.SubnetIdMap getSubnetIdMap() { - return subnetIdMap; - } - - /** - * Sets the value of the subnetIdMap property. - * - * @param value allowed object is {@link QueryNetworkNotification.SubnetIdMap } - * - */ - public void setSubnetIdMap(QueryNetworkNotification.SubnetIdMap value) { - this.subnetIdMap = value; - } - - - /** - * <p> - * Java class for anonymous complex type. - * - * <p> - * The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="entry" maxOccurs="unbounded" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = {"entry"}) - public static class SubnetIdMap { - - protected List<QueryNetworkNotification.SubnetIdMap.Entry> entry; - - /** - * Gets the value of the entry property. - * - * <p> - * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you - * make to the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE> - * method for the entry property. - * - * <p> - * For example, to add a new item, do as follows: - * - * <pre> - * getEntry().add(newItem); - * </pre> - * - * - * <p> - * Objects of the following type(s) are allowed in the list {@link QueryNetworkNotification.SubnetIdMap.Entry } - * - * - */ - public List<QueryNetworkNotification.SubnetIdMap.Entry> getEntry() { - if (entry == null) { - entry = new ArrayList<>(); - } - return this.entry; - } - - - /** - * <p> - * Java class for anonymous complex type. - * - * <p> - * The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = {"key", "value"}) - public static class Entry { - - protected String key; - protected String value; - - /** - * Gets the value of the key property. - * - * @return possible object is {@link String } - * - */ - public String getKey() { - return key; - } - - /** - * Sets the value of the key property. - * - * @param value allowed object is {@link String } - * - */ - public void setKey(String value) { - this.key = value; - } - - /** - * Gets the value of the value property. - * - * @return possible object is {@link String } - * - */ - public String getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - * @param value allowed object is {@link String } - * - */ - public void setValue(String value) { - this.value = value; - } - - } - - } - -} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/QueryNetworkNotificationResponse.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/QueryNetworkNotificationResponse.java deleted file mode 100644 index 2e18e05860..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/QueryNetworkNotificationResponse.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.network.async.client; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p> - * Java class for queryNetworkNotificationResponse complex type. - * - * <p> - * The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="queryNetworkNotificationResponse"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "queryNetworkNotificationResponse") -public class QueryNetworkNotificationResponse { - - -} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/RollbackNetworkNotification.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/RollbackNetworkNotification.java deleted file mode 100644 index 7b5d0f0f2a..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/RollbackNetworkNotification.java +++ /dev/null @@ -1,139 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.network.async.client; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p> - * Java class for rollbackNetworkNotification complex type. - * - * <p> - * The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="rollbackNetworkNotification"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="exception" type="{http://org.onap.so/networkNotify}msoExceptionCategory" minOccurs="0"/> - * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "rollbackNetworkNotification", propOrder = {"messageId", "completed", "exception", "errorMessage"}) -public class RollbackNetworkNotification { - - @XmlElement(required = true) - protected String messageId; - protected boolean completed; - protected MsoExceptionCategory exception; - protected String errorMessage; - - /** - * Gets the value of the messageId property. - * - * @return possible object is {@link String } - * - */ - public String getMessageId() { - return messageId; - } - - /** - * Sets the value of the messageId property. - * - * @param value allowed object is {@link String } - * - */ - public void setMessageId(String value) { - this.messageId = value; - } - - /** - * Gets the value of the completed property. - * - */ - public boolean isCompleted() { - return completed; - } - - /** - * Sets the value of the completed property. - * - */ - public void setCompleted(boolean value) { - this.completed = value; - } - - /** - * Gets the value of the exception property. - * - * @return possible object is {@link MsoExceptionCategory } - * - */ - public MsoExceptionCategory getException() { - return exception; - } - - /** - * Sets the value of the exception property. - * - * @param value allowed object is {@link MsoExceptionCategory } - * - */ - public void setException(MsoExceptionCategory value) { - this.exception = value; - } - - /** - * Gets the value of the errorMessage property. - * - * @return possible object is {@link String } - * - */ - public String getErrorMessage() { - return errorMessage; - } - - /** - * Sets the value of the errorMessage property. - * - * @param value allowed object is {@link String } - * - */ - public void setErrorMessage(String value) { - this.errorMessage = value; - } - -} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/RollbackNetworkNotificationResponse.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/RollbackNetworkNotificationResponse.java deleted file mode 100644 index 7ddc8d75de..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/RollbackNetworkNotificationResponse.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.network.async.client; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p> - * Java class for rollbackNetworkNotificationResponse complex type. - * - * <p> - * The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="rollbackNetworkNotificationResponse"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "rollbackNetworkNotificationResponse") -public class RollbackNetworkNotificationResponse { - - -} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/UpdateNetworkNotification.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/UpdateNetworkNotification.java deleted file mode 100644 index 1a464d3250..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/UpdateNetworkNotification.java +++ /dev/null @@ -1,350 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (C) 2018 IBM. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.network.async.client; - -import java.util.ArrayList; -import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p> - * Java class for updateNetworkNotification complex type. - * - * <p> - * The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="updateNetworkNotification"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/> - * <element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/> - * <element name="exception" type="{http://org.onap.so/networkNotify}msoExceptionCategory" minOccurs="0"/> - * <element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="subnetIdMap" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="entry" maxOccurs="unbounded" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * <element name="rollback" type="{http://org.onap.so/networkNotify}networkRollback" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "updateNetworkNotification", - propOrder = {"messageId", "completed", "exception", "errorMessage", "subnetIdMap", "rollback"}) -public class UpdateNetworkNotification { - - @XmlElement(required = true) - protected String messageId; - protected boolean completed; - protected MsoExceptionCategory exception; - protected String errorMessage; - protected UpdateNetworkNotification.SubnetIdMap subnetIdMap; - protected NetworkRollback rollback; - - /** - * Gets the value of the messageId property. - * - * @return possible object is {@link String } - * - */ - public String getMessageId() { - return messageId; - } - - /** - * Sets the value of the messageId property. - * - * @param value allowed object is {@link String } - * - */ - public void setMessageId(String value) { - this.messageId = value; - } - - /** - * Gets the value of the completed property. - * - */ - public boolean isCompleted() { - return completed; - } - - /** - * Sets the value of the completed property. - * - */ - public void setCompleted(boolean value) { - this.completed = value; - } - - /** - * Gets the value of the exception property. - * - * @return possible object is {@link MsoExceptionCategory } - * - */ - public MsoExceptionCategory getException() { - return exception; - } - - /** - * Sets the value of the exception property. - * - * @param value allowed object is {@link MsoExceptionCategory } - * - */ - public void setException(MsoExceptionCategory value) { - this.exception = value; - } - - /** - * Gets the value of the errorMessage property. - * - * @return possible object is {@link String } - * - */ - public String getErrorMessage() { - return errorMessage; - } - - /** - * Sets the value of the errorMessage property. - * - * @param value allowed object is {@link String } - * - */ - public void setErrorMessage(String value) { - this.errorMessage = value; - } - - /** - * Gets the value of the subnetIdMap property. - * - * @return possible object is {@link UpdateNetworkNotification.SubnetIdMap } - * - */ - public UpdateNetworkNotification.SubnetIdMap getSubnetIdMap() { - return subnetIdMap; - } - - /** - * Sets the value of the subnetIdMap property. - * - * @param value allowed object is {@link UpdateNetworkNotification.SubnetIdMap } - * - */ - public void setSubnetIdMap(UpdateNetworkNotification.SubnetIdMap value) { - this.subnetIdMap = value; - } - - /** - * Gets the value of the rollback property. - * - * @return possible object is {@link NetworkRollback } - * - */ - public NetworkRollback getRollback() { - return rollback; - } - - /** - * Sets the value of the rollback property. - * - * @param value allowed object is {@link NetworkRollback } - * - */ - public void setRollback(NetworkRollback value) { - this.rollback = value; - } - - - /** - * <p> - * Java class for anonymous complex type. - * - * <p> - * The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="entry" maxOccurs="unbounded" minOccurs="0"> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </element> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = {"entry"}) - public static class SubnetIdMap { - - protected List<UpdateNetworkNotification.SubnetIdMap.Entry> entry; - - /** - * Gets the value of the entry property. - * - * <p> - * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you - * make to the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE> - * method for the entry property. - * - * <p> - * For example, to add a new item, do as follows: - * - * <pre> - * getEntry().add(newItem); - * </pre> - * - * - * <p> - * Objects of the following type(s) are allowed in the list {@link UpdateNetworkNotification.SubnetIdMap.Entry } - * - * - */ - public List<UpdateNetworkNotification.SubnetIdMap.Entry> getEntry() { - if (entry == null) { - entry = new ArrayList<>(); - } - return this.entry; - } - - - /** - * <p> - * Java class for anonymous complex type. - * - * <p> - * The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * <element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * <element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = {"key", "value"}) - public static class Entry { - - protected String key; - protected String value; - - /** - * Gets the value of the key property. - * - * @return possible object is {@link String } - * - */ - public String getKey() { - return key; - } - - /** - * Sets the value of the key property. - * - * @param value allowed object is {@link String } - * - */ - public void setKey(String value) { - this.key = value; - } - - /** - * Gets the value of the value property. - * - * @return possible object is {@link String } - * - */ - public String getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - * @param value allowed object is {@link String } - * - */ - public void setValue(String value) { - this.value = value; - } - - } - - } - -} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/UpdateNetworkNotificationResponse.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/UpdateNetworkNotificationResponse.java deleted file mode 100644 index 0ffcb5e9e6..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/UpdateNetworkNotificationResponse.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.network.async.client; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - - -/** - * <p> - * Java class for updateNetworkNotificationResponse complex type. - * - * <p> - * The following schema fragment specifies the expected content contained within this class. - * - * <pre> - * <complexType name="updateNetworkNotificationResponse"> - * <complexContent> - * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> - * <sequence> - * </sequence> - * </restriction> - * </complexContent> - * </complexType> - * </pre> - * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "updateNetworkNotificationResponse") -public class UpdateNetworkNotificationResponse { - - -} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/package-info.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/package-info.java deleted file mode 100644 index fdd8711170..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/async/client/package-info.java +++ /dev/null @@ -1,21 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.onap.so/networkNotify") -package org.onap.so.adapters.network.async.client; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java index 8f815f1827..a7bca73fdd 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java @@ -33,9 +33,7 @@ import org.apache.cxf.jaxrs.swagger.Swagger2Feature; import org.apache.cxf.jaxws.EndpointImpl; import org.apache.cxf.transport.servlet.CXFServlet; import org.onap.so.adapters.cloudregion.CloudRegionRestV1; -import org.onap.so.adapters.network.MsoNetworkAdapterAsyncImpl; import org.onap.so.adapters.network.MsoNetworkAdapterImpl; -import org.onap.so.adapters.network.NetworkAdapterRest; import org.onap.so.adapters.tenant.MsoTenantAdapterImpl; import org.onap.so.adapters.tenant.TenantAdapterRest; import org.onap.so.adapters.vnf.MsoVnfAdapterAsyncImpl; @@ -55,14 +53,10 @@ import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; @Configuration public class CXFConfiguration { @Autowired - private NetworkAdapterRest networkAdapterRest; - @Autowired private TenantAdapterRest tenantAdapterRest; @Autowired private MsoNetworkAdapterImpl networkAdapterImpl; @Autowired - private MsoNetworkAdapterAsyncImpl networkAdapterAsyncImpl; - @Autowired private MsoTenantAdapterImpl tenantAdapterImpl; @Autowired private MsoVnfAdapterImpl vnfAdapterImpl; @@ -104,17 +98,6 @@ public class CXFConfiguration { return endpoint; } - @Bean - public Endpoint networkAdapterAsyncEndpoint() { - EndpointImpl endpoint = new EndpointImpl(springBus(), networkAdapterAsyncImpl); - endpoint.publish("/NetworkAdapterAsync"); - endpoint.setWsdlLocation("NetworkAdapterAsync.wsdl"); - endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor()); - endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor()); - endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor()); - return endpoint; - } - /* * tenant adapter endpoint */ @@ -159,7 +142,7 @@ public class CXFConfiguration { public Server rsServer() { JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean(); endpoint.setBus(springBus()); - endpoint.setServiceBeans(Arrays.<Object>asList(networkAdapterRest, tenantAdapterRest)); + endpoint.setServiceBeans(Arrays.<Object>asList(tenantAdapterRest)); endpoint.setAddress("/rest"); endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature())); endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(jettisonStyleObjectMapper.getMapper()), diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java index 6e181c4696..9ff50e8644 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java @@ -33,10 +33,13 @@ import javax.xml.parsers.DocumentBuilderFactory; import org.apache.commons.lang3.mutable.MutableBoolean; import org.camunda.bpm.client.task.ExternalTask; import org.camunda.bpm.client.task.ExternalTaskService; +import org.onap.so.adapters.nwrest.CreateNetworkRequest; import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest; import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest; +import org.onap.so.adapters.nwrest.DeleteNetworkRequest; +import org.onap.so.adapters.nwrest.UpdateNetworkRequest; import org.onap.so.logging.tasks.AuditMDCSetup; import org.onap.so.openstack.exceptions.MsoException; import org.onap.so.openstack.utils.MsoHeatUtils; @@ -70,7 +73,7 @@ public class PollService extends ExternalTaskUtils { MutableBoolean success = new MutableBoolean(); String errorMessage = null; try { - String xmlRequest = externalTask.getVariable("vnfAdapterTaskRequest"); + String xmlRequest = externalTask.getVariable("openstackAdapterTaskRequest"); if (xmlRequest != null) { Optional<String> requestType = findRequestType(xmlRequest); if ("createVolumeGroupRequest".equals(requestType.get())) { @@ -87,6 +90,15 @@ public class PollService extends ExternalTaskUtils { DeleteVolumeGroupRequest req = JAXB.unmarshal(new StringReader(xmlRequest), DeleteVolumeGroupRequest.class); pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success); + } else if ("createNetworkRequest".equals(requestType.get())) { + determineCreateNetworkStatus(xmlRequest, externalTask, success); + } else if ("deleteNetworkRequest".equals(requestType.get())) { + logger.debug("Executing External Task Poll Service for Delete Network"); + DeleteNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), DeleteNetworkRequest.class); + pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success); + } else if ("updateNetworkRequest".equals(requestType.get())) { + UpdateNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), UpdateNetworkRequest.class); + pollUpdateResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success); } } } catch (Exception e) { @@ -143,6 +155,19 @@ public class PollService extends ExternalTaskUtils { } } + private void determineCreateNetworkStatus(String xmlRequest, ExternalTask externalTask, MutableBoolean success) + throws MsoException { + CreateNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateNetworkRequest.class); + boolean pollRollbackStatus = externalTask.getVariable("PollRollbackStatus"); + if (pollRollbackStatus) { + logger.debug("Executing External Task Poll Service for Rollback Create Network"); + pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success); + } else { + logger.debug("Executing External Task Poll Service for Create Network"); + pollCreateResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success); + } + } + private void pollCreateResource(String cloudSiteId, String tenantId, ExternalTask externalTask, MutableBoolean success) throws MsoException { Stack currentStack = createCurrentStack(externalTask.getVariable("stackId")); @@ -163,6 +188,15 @@ public class PollService extends ExternalTaskUtils { success.setTrue(); } + private void pollUpdateResource(String cloudSiteId, String tenantId, ExternalTask externalTask, + MutableBoolean success) throws MsoException { + Stack currentStack = createCurrentStack(externalTask.getVariable("stackId")); + Stack stack = + msoHeatUtils.pollStackForStatus(1, currentStack, "UPDATE_IN_PROGRESS", cloudSiteId, tenantId, false); + msoHeatUtils.postProcessStackUpdate(stack); + success.setTrue(); + } + protected Optional<String> findRequestType(String xmlString) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java index c302293169..15e6ff581d 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java @@ -11,6 +11,8 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.ws.Holder; import org.camunda.bpm.client.task.ExternalTask; import org.camunda.bpm.client.task.ExternalTaskService; +import org.onap.so.adapters.network.MsoNetworkAdapterImpl; +import org.onap.so.adapters.nwrest.CreateNetworkRequest; import org.onap.so.adapters.vnf.MsoVnfAdapterImpl; import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest; @@ -30,6 +32,9 @@ public class RollbackService extends ExternalTaskUtils { private MsoVnfAdapterImpl vnfAdapterImpl; @Autowired + private MsoNetworkAdapterImpl networkAdapterImpl; + + @Autowired private AuditMDCSetup mdcSetup; public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) { @@ -39,7 +44,7 @@ public class RollbackService extends ExternalTaskUtils { boolean success = false; boolean pollRollbackStatus = false; try { - String xmlRequest = externalTask.getVariable("vnfAdapterTaskRequest"); + String xmlRequest = externalTask.getVariable("openstackAdapterTaskRequest"); if (xmlRequest != null) { Optional<String> requestType = findRequestType(xmlRequest); if ("createVolumeGroupRequest".equals(requestType.get())) { @@ -59,6 +64,15 @@ public class RollbackService extends ExternalTaskUtils { req.getMsoRequest(), new Holder<>()); pollRollbackStatus = true; success = true; + } else if ("createNetworkRequest".equals(requestType.get())) { + logger.debug("Executing External Task Rollback Service for Create Network"); + Holder<Boolean> networkDeleted = new Holder<>(); + CreateNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateNetworkRequest.class); + networkAdapterImpl.deleteNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(), + req.getModelCustomizationUuid(), req.getNetworkName(), req.getMsoRequest(), networkDeleted, + false); + pollRollbackStatus = true; + success = true; } } } catch (Exception e) { diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java index 34952a056b..6b7ceedbb8 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java @@ -25,6 +25,7 @@ package org.onap.so.adapters.tasks.orchestration; import java.io.ByteArrayInputStream; import java.io.StringReader; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Optional; import javax.xml.bind.JAXB; @@ -34,6 +35,18 @@ import javax.xml.ws.Holder; import org.apache.commons.lang3.mutable.MutableBoolean; import org.camunda.bpm.client.task.ExternalTask; import org.camunda.bpm.client.task.ExternalTaskService; +import org.onap.so.adapters.network.MsoNetworkAdapterImpl; +import org.onap.so.adapters.network.exceptions.NetworkException; +import org.onap.so.adapters.nwrest.ContrailNetwork; +import org.onap.so.adapters.nwrest.CreateNetworkRequest; +import org.onap.so.adapters.nwrest.CreateNetworkResponse; +import org.onap.so.adapters.nwrest.DeleteNetworkRequest; +import org.onap.so.adapters.nwrest.DeleteNetworkResponse; +import org.onap.so.adapters.nwrest.ProviderVlanNetwork; +import org.onap.so.adapters.nwrest.RollbackNetworkRequest; +import org.onap.so.adapters.nwrest.RollbackNetworkResponse; +import org.onap.so.adapters.nwrest.UpdateNetworkRequest; +import org.onap.so.adapters.nwrest.UpdateNetworkResponse; import org.onap.so.adapters.vnf.MsoVnfAdapterImpl; import org.onap.so.adapters.vnf.exceptions.VnfException; import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; @@ -47,6 +60,8 @@ import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse; import org.onap.so.adapters.vnfrest.VfModuleRollback; import org.onap.so.adapters.vnfrest.VolumeGroupRollback; import org.onap.so.logging.tasks.AuditMDCSetup; +import org.onap.so.openstack.beans.NetworkRollback; +import org.onap.so.openstack.beans.RouteTarget; import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.utils.ExternalTaskUtils; import org.slf4j.Logger; @@ -63,12 +78,19 @@ public class StackService extends ExternalTaskUtils { private MsoVnfAdapterImpl vnfAdapterImpl; @Autowired + private MsoNetworkAdapterImpl networkAdapterImpl; + + @Autowired private AuditMDCSetup mdcSetup; + private static final String SHARED = "shared"; + private static final String EXTERNAL = "external"; + + // TODO set backout earlier in case of exception?? public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) { Map<String, Object> variables = new HashMap<>(); mdcSetup.setupMDC(externalTask); - String xmlRequest = externalTask.getVariable("vnfAdapterTaskRequest"); + String xmlRequest = externalTask.getVariable("openstackAdapterTaskRequest"); logger.debug("Executing External Task Stack Service. {}", xmlRequest); MutableBoolean success = new MutableBoolean(); MutableBoolean backout = new MutableBoolean(); @@ -80,6 +102,11 @@ public class StackService extends ExternalTaskUtils { Holder<Map<String, String>> outputs = new Holder<>(); Holder<VnfRollback> vnfRollback = new Holder<>(); Optional<String> requestType = findRequestType(xmlRequest); + Holder<String> networkId = new Holder<>(); + Holder<String> neutronNetworkId = new Holder<>(); + Holder<String> networkFqdn = new Holder<>(); + Holder<Map<String, String>> subnetIdMap = new Holder<>(); + Holder<NetworkRollback> networkRollback = new Holder<>(); if ("createVolumeGroupRequest".equals(requestType.get())) { logger.debug("Executing External Task Stack Service For Create Volume Group"); response = createVolumeGroup(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success); @@ -92,6 +119,16 @@ public class StackService extends ExternalTaskUtils { } else if ("deleteVolumeGroupRequest".equals(requestType.get())) { logger.debug("Executing External Task Stack Service For Delete Volume Group"); response = deleteVolumeGroup(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success); + } else if ("createNetworkRequest".equals(requestType.get())) { + response = createNetwork(xmlRequest, networkId, neutronNetworkId, networkFqdn, subnetIdMap, + networkRollback, canonicalStackId, backout, success); + } else if ("deleteNetworkRequest".equals(requestType.get())) { + response = deleteNetwork(xmlRequest, canonicalStackId, backout, success); + } else if ("updateNetworkRequest".equals(requestType.get())) { + response = + updateNetwork(xmlRequest, subnetIdMap, networkRollback, canonicalStackId, backout, success); + } else if ("rollbackNetworkRequest".equals(requestType.get())) { + response = rollbackNetwork(xmlRequest, canonicalStackId, backout, success); } } } catch (Exception e) { @@ -192,6 +229,156 @@ public class StackService extends ExternalTaskUtils { return deleteResponse.toXmlString(); } + private String createNetwork(String xmlRequest, Holder<String> networkId, Holder<String> neutronNetworkId, + Holder<String> networkFqdn, Holder<Map<String, String>> subnetIdMap, + Holder<NetworkRollback> networkRollback, Holder<String> canonicalStackId, MutableBoolean backout, + MutableBoolean success) throws NetworkException { + CreateNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateNetworkRequest.class); + HashMap<String, String> params = (HashMap<String, String>) req.getNetworkParams(); + if (params == null) { + params = new HashMap<>(); + } + String shared = null; + String external = null; + String physicalNetworkName = null; + List<Integer> vlans = null; + List<RouteTarget> routeTargets = null; + List<String> fqdns = null; + List<String> routeTable = null; + if (params.containsKey(SHARED)) + shared = params.get(SHARED); + if (params.containsKey(EXTERNAL)) + external = params.get(EXTERNAL); + if (req.isContrailRequest()) { + ContrailNetwork ctn = req.getContrailNetwork(); + if (ctn == null) { + ctn = new ContrailNetwork(); + req.setContrailNetwork(ctn); + } + if (shared == null && ctn.getShared() != null) { + shared = ctn.getShared(); + } + if (shared == null && ctn.getExternal() != null) { + external = ctn.getExternal(); + } + routeTargets = req.getContrailNetwork().getRouteTargets(); + fqdns = req.getContrailNetwork().getPolicyFqdns(); + routeTable = req.getContrailNetwork().getRouteTableFqdns(); + } else { + ProviderVlanNetwork pvn = req.getProviderVlanNetwork(); + if (pvn == null) { + pvn = new ProviderVlanNetwork(); + req.setProviderVlanNetwork(pvn); + } + physicalNetworkName = req.getProviderVlanNetwork().getPhysicalNetworkName(); + vlans = req.getProviderVlanNetwork().getVlans(); + } + networkAdapterImpl.createNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(), + req.getModelCustomizationUuid(), req.getNetworkName(), physicalNetworkName, vlans, routeTargets, shared, + external, req.getFailIfExists(), false, req.getSubnets(), fqdns, routeTable, req.getMsoRequest(), + networkId, neutronNetworkId, networkFqdn, subnetIdMap, networkRollback, false); + success.setTrue(); + backout.setValue(req.getBackout()); + canonicalStackId.value = networkRollback.value.getNetworkStackId(); + + CreateNetworkResponse response = new CreateNetworkResponse(req.getNetworkId(), neutronNetworkId.value, + networkRollback.value.getNetworkStackId(), networkFqdn.value, networkRollback.value.getNetworkCreated(), + subnetIdMap.value, networkRollback.value, req.getMessageId()); + return response.toXmlString(); + } + + private String deleteNetwork(String xmlRequest, Holder<String> canonicalStackId, MutableBoolean backout, + MutableBoolean success) throws NetworkException { + backout.setFalse(); + DeleteNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), DeleteNetworkRequest.class); + Holder<Boolean> networkDeleted = new Holder<>(); + + networkAdapterImpl.deleteNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(), + req.getModelCustomizationUuid(), req.getNetworkStackId(), req.getMsoRequest(), networkDeleted, false); + + canonicalStackId.value = req.getNetworkStackId(); + success.setTrue(); + + DeleteNetworkResponse response = + new DeleteNetworkResponse(req.getNetworkId(), networkDeleted.value, req.getMessageId()); + return response.toXmlString(); + } + + private String rollbackNetwork(String xmlRequest, Holder<String> canonicalStackId, MutableBoolean backout, + MutableBoolean success) throws NetworkException { + backout.setFalse(); + RollbackNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), RollbackNetworkRequest.class); + + NetworkRollback rollback = req.getNetworkRollback(); + networkAdapterImpl.rollbackNetwork(rollback, false); + + canonicalStackId.value = rollback.getNetworkStackId(); + success.setTrue(); + + RollbackNetworkResponse response = new RollbackNetworkResponse(true, req.getMessageId()); + return response.toXmlString(); + } + + private String updateNetwork(String xmlRequest, Holder<Map<String, String>> subnetIdMap, + Holder<NetworkRollback> networkRollback, Holder<String> canonicalStackId, MutableBoolean backout, + MutableBoolean success) throws NetworkException { + backout.setFalse(); + UpdateNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), UpdateNetworkRequest.class); + HashMap<String, String> params = (HashMap<String, String>) req.getNetworkParams(); + if (params == null) { + params = new HashMap<>(); + } + String shared = null; + String external = null; + String physicalNetworkName = null; + List<Integer> vlans = null; + List<RouteTarget> routeTargets = null; + List<String> fqdns = null; + List<String> routeTable = null; + if (params.containsKey(SHARED)) + shared = params.get(SHARED); + if (params.containsKey(EXTERNAL)) + external = params.get(EXTERNAL); + if (req.isContrailRequest()) { + ContrailNetwork ctn = req.getContrailNetwork(); + if (ctn == null) { + ctn = new ContrailNetwork(); + req.setContrailNetwork(ctn); + } + if (shared == null && ctn.getShared() != null) { + shared = ctn.getShared(); + } + if (shared == null && ctn.getExternal() != null) { + external = ctn.getExternal(); + } + routeTargets = req.getContrailNetwork().getRouteTargets(); + fqdns = req.getContrailNetwork().getPolicyFqdns(); + routeTable = req.getContrailNetwork().getRouteTableFqdns(); + } else { + ProviderVlanNetwork pvn = req.getProviderVlanNetwork(); + if (pvn == null) { + pvn = new ProviderVlanNetwork(); + req.setProviderVlanNetwork(pvn); + } + physicalNetworkName = req.getProviderVlanNetwork().getPhysicalNetworkName(); + vlans = req.getProviderVlanNetwork().getVlans(); + } + + networkAdapterImpl.updateNetwork(req.getCloudSiteId(), req.getTenantId(), req.getNetworkType(), + req.getModelCustomizationUuid(), req.getNetworkStackId(), req.getNetworkName(), physicalNetworkName, + vlans, routeTargets, shared, external, req.getSubnets(), fqdns, routeTable, req.getMsoRequest(), + subnetIdMap, networkRollback); + + success.setTrue(); + canonicalStackId.value = req.getNetworkStackId(); + + UpdateNetworkResponse response = + new UpdateNetworkResponse(req.getNetworkId(), null, subnetIdMap.value, req.getMessageId()); + return response.toXmlString(); + } + + + protected Optional<String> findRequestType(String xmlString) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java index 5bafe2b1d6..d8e1e2a9a9 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java @@ -49,7 +49,6 @@ public class BeansTest { @Test public void pojoStructure() { - test("org.onap.so.adapters.network.async.client"); test("org.onap.so.adapters.vnf.async.client"); test("org.onap.so.adapters.network"); test("org.onap.so.adapters.vnf"); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java deleted file mode 100644 index 00961a16b9..0000000000 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java +++ /dev/null @@ -1,269 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.network; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.containing; -import static com.github.tomakehurst.wiremock.client.WireMock.patch; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; -import static org.onap.so.bpmn.mock.StubOpenStack.getBodyFromFile; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackCreatedVUSP_200; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackCreated_200; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackDeleteOrUpdateComplete_200; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPostStacks_200; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccessQueryNetwork; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import org.apache.http.HttpStatus; -import org.junit.Test; -import org.onap.so.adapters.vnf.BaseRestTestUtils; -import org.onap.so.entity.MsoRequest; -import org.onap.so.openstack.beans.NetworkRollback; -import org.onap.so.openstack.beans.Subnet; -import org.springframework.beans.factory.annotation.Autowired; -import com.github.tomakehurst.wiremock.WireMockServer; - -public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils { - @Autowired - MsoNetworkAdapterAsyncImpl impl; - - @Test - public void healthCheckATest() { - MsoNetworkAdapterAsyncImpl mNAAimpl = new MsoNetworkAdapterAsyncImpl(); - mNAAimpl.healthCheckA(); - } - - @Test - public void rollbackNetworkATest() throws IOException { - wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) - .withStatus(HttpStatus.SC_OK))); - wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl")) - .withRequestBody(containing("<completed>true</completed>")) - .willReturn(aResponse().withBody( - "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n" - + " <soapenv:Header/>\n" + " <soapenv:Body>\n" - + " <net:rollbackNetworkNotificationResponse>\n" - + " </net:rollbackNetworkNotificationResponse>\n" + " </soapenv:Body>\n" - + "</soapenv:Envelope>") - .withStatus(HttpStatus.SC_OK))); - NetworkRollback nrb = getNetworkRollback("mtn13"); - impl.rollbackNetworkA(nrb, "messageId", "http://localhost:" + wireMockPort + "/notificationUrl"); - } - - @Test - public void rollbackNetworkATest_NotifyException() throws IOException { - wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) - .withStatus(HttpStatus.SC_OK))); - wireMockServer.stubFor( - post(urlPathEqualTo("/notificationUrl")).withRequestBody(containing("<completed>true</completed>")) - .willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND))); - NetworkRollback nrb = getNetworkRollback("mtn13"); - impl.rollbackNetworkA(nrb, "messageId", "http://localhost:" + wireMockPort + "/notificationUrl"); - } - - private NetworkRollback getNetworkRollback(String cloudId) { - NetworkRollback nrb = new NetworkRollback(); - nrb.setCloudId(cloudId); - nrb.setMsoRequest(new MsoRequest()); - nrb.setModelCustomizationUuid("3bdbb104-476c-483e-9f8b-c095b3d3068c"); - nrb.setNetworkCreated(true); - nrb.setNetworkId("networkId"); - nrb.setNetworkName("networkName"); - nrb.setNetworkStackId("networkStackId"); - nrb.setNetworkType("networkType"); - nrb.setNeutronNetworkId("neutronNetworkId"); - nrb.setPhysicalNetwork("physicalNetwork"); - nrb.setTenantId("tenantId"); - nrb.setVlans(new ArrayList<>()); - return nrb; - } - - @Test - public void rollbackNetworkATestNetworkException() { - NetworkRollback nrb = getNetworkRollback("cloudId"); - - impl.rollbackNetworkA(nrb, "messageId", "http://localhost"); - } - - @Test - public void noRollbackNetworkATest() { - impl.rollbackNetworkA(null, "messageId", "http://localhost"); - } - - - @Test - public void deleteNetworkATest() throws IOException { - wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) - .withStatus(HttpStatus.SC_OK))); - wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl")) - .withRequestBody(containing("<completed>true</completed>")) - .willReturn(aResponse().withBody( - "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n" - + " <soapenv:Header/>\n" + " <soapenv:Body>\n" - + " <net:deleteNetworkNotificationResponse>\n" - + " </net:deleteNetworkNotificationResponse>\n" + " </soapenv:Body>\n" - + "</soapenv:Envelope>") - .withStatus(HttpStatus.SC_OK))); - impl.deleteNetworkA("mtn13", "tenantId", "networkType", "modelCustomizationUuid", "networkId", "messageId", - new MsoRequest(), "http://localhost:" + wireMockPort + "/notificationUrl"); - } - - @Test - public void deleteNetworkATest_NotifyException() throws IOException { - wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) - .withStatus(HttpStatus.SC_OK))); - wireMockServer.stubFor( - post(urlPathEqualTo("/notificationUrl")).withRequestBody(containing("<completed>true</completed>")) - .willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND))); - impl.deleteNetworkA("mtn13", "tenantId", "networkType", "modelCustomizationUuid", "networkId", "messageId", - new MsoRequest(), "http://localhost:" + wireMockPort + "/notificationUrl"); - } - - @Test - public void deleteNetworkATest_NetworkException() { - impl.deleteNetworkA("cloudSiteId", "tenantId", "networkType", "modelCustomizationUuid", "networkId", - "messageId", new MsoRequest(), "http://localhost:" + wireMockPort + "/notificationUrl"); - } - - @Test - public void updateNetworkATest() throws IOException { - wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) - .withStatus(HttpStatus.SC_OK))); - mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", - "dvspg-VCE_VPE-mtjnj40avbc"); - mockOpenStackGetStackDeleteOrUpdateComplete_200(wireMockServer, "OpenstackResponse_Stack_UpdateComplete.json"); - mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200(wireMockServer); - wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl")) - .withRequestBody(containing("updateNetworkNotification")) - .willReturn(aResponse().withBody( - "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n" - + " <soapenv:Header/>\n" + " <soapenv:Body>\n" - + " <net:updateNetworkNotificationResponse>\n" - + " </net:updateNetworkNotificationResponse>\n" + " </soapenv:Body>\n" - + "</soapenv:Envelope>") - .withStatus(HttpStatus.SC_OK))); - HashMap<String, String> networkParams = new HashMap<String, String>(); - networkParams.put("shared", "true"); - networkParams.put("external", "false"); - impl.updateNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", - "dvspg-VCE_VPE-mtjnj40avbc", "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(), - new ArrayList<Subnet>(), networkParams, "messageId", new MsoRequest(), - "http://localhost:" + wireMockPort + "/notificationUrl"); - } - - @Test - public void updateNetworkATest_NotifyExcpetion() throws IOException { - wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) - .withStatus(HttpStatus.SC_OK))); - mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", - "dvspg-VCE_VPE-mtjnj40avbc"); - mockOpenStackGetStackDeleteOrUpdateComplete_200(wireMockServer, "OpenstackResponse_Stack_UpdateComplete.json"); - mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200(wireMockServer); - HashMap<String, String> networkParams = new HashMap<String, String>(); - networkParams.put("shared", "true"); - networkParams.put("external", "false"); - impl.updateNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", - "dvspg-VCE_VPE-mtjnj40avbc", "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(), - new ArrayList<>(), networkParams, "messageId", new MsoRequest(), - "http://localhost:" + wireMockPort + "/notificationUrl"); - } - - @Test - public void updateNetworkATest_NetworkException() { - impl.updateNetworkA("cloudSiteId", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", - "networkId", "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(), new ArrayList<>(), - new HashMap<String, String>(), "messageId", new MsoRequest(), - "http://localhost:" + wireMockPort + "/notificationUrl"); - } - - @Test - public void queryNetworkATest() throws IOException { - mockOpenStackResponseAccessQueryNetwork(wireMockServer, wireMockPort); - impl.queryNetworkA("mtn13", "tenantId", "networkId", "messageId", new MsoRequest(), - "http://localhost:" + wireMockPort + "/notificationUrl"); - } - - @Test - public void createNetworkATest() throws IOException { - wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) - .withStatus(HttpStatus.SC_OK))); - wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl")) - .withRequestBody(containing("createNetworkNotification")) - .willReturn(aResponse().withBody( - "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n" - + " <soapenv:Header/>\n" + " <soapenv:Body>\n" - + " <net:createNetworkNotificationResponse>\n" - + " </net:createNetworkNotificationResponse>\n" + " </soapenv:Body>\n" - + "</soapenv:Envelope>") - .withStatus(HttpStatus.SC_OK))); - mockOpenStackGetStackCreatedVUSP_200(wireMockServer); - mockOpenStackPostStacks_200(wireMockServer); - mockOpenStackPostStacks_200(wireMockServer); - HashMap<String, String> networkParams = new HashMap<String, String>(); - impl.createNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", - "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0", "physicalNetworkName", new ArrayList<>(), false, - false, new ArrayList<>(), networkParams, "messageId", new MsoRequest(), - "http://localhost:" + wireMockPort + "/notificationUrl"); - } - - @Test - public void createNetworkATest_NotifyException() throws IOException { - wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) - .withStatus(HttpStatus.SC_OK))); - mockOpenStackGetStackCreatedVUSP_200(wireMockServer); - mockOpenStackPostStacks_200(wireMockServer); - HashMap<String, String> networkParams = new HashMap<String, String>(); - networkParams.put("shared", "true"); - networkParams.put("external", "false"); - impl.createNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", - "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0", "physicalNetworkName", new ArrayList<>(), false, - false, new ArrayList<>(), networkParams, "messageId", new MsoRequest(), - "http://localhost:" + wireMockPort + "/notificationUrl"); - } - - @Test - public void createNetworkATest_NetworkException() { - impl.createNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", - "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0", "physicalNetworkName", new ArrayList<>(), false, - false, new ArrayList<>(), new HashMap<String, String>(), "messageId", new MsoRequest(), - "http://localhost:" + wireMockPort + "/notificationUrl"); - } - -} diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java deleted file mode 100644 index 412abeab3b..0000000000 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java +++ /dev/null @@ -1,364 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.network; - -import static com.shazam.shazamcrest.MatcherAssert.assertThat; -import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; -import static org.junit.Assert.assertEquals; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackDeletePublicUrlStackByNameAndID_204; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetPublicUrlStackByNameAndID_200; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetPublicUrlStackByNameAndID_204; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackAppC_404; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackCreatedAppC_200; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackCreatedVUSP_200; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVUSP_404; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPostPublicUrlWithBodyFile_200; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPublicUrlStackByID_200; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPublicUrlStackByName_200; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutPublicUrlStackByNameAndID_200; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess; -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import org.json.JSONException; -import org.junit.Test; -import org.onap.so.adapters.nwrest.CreateNetworkRequest; -import org.onap.so.adapters.nwrest.CreateNetworkResponse; -import org.onap.so.adapters.nwrest.DeleteNetworkRequest; -import org.onap.so.adapters.nwrest.DeleteNetworkResponse; -import org.onap.so.adapters.nwrest.QueryNetworkError; -import org.onap.so.adapters.nwrest.QueryNetworkResponse; -import org.onap.so.adapters.nwrest.RollbackNetworkRequest; -import org.onap.so.adapters.nwrest.RollbackNetworkResponse; -import org.onap.so.adapters.nwrest.UpdateNetworkRequest; -import org.onap.so.adapters.nwrest.UpdateNetworkResponse; -import org.onap.so.adapters.vnf.BaseRestTestUtils; -import org.onap.so.client.policy.JettisonStyleMapperProvider; -import org.onap.so.entity.MsoRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpMethod; -import org.springframework.http.ResponseEntity; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; - -public class NetworkAdapterRestTest extends BaseRestTestUtils { - - @Autowired - private JettisonStyleMapperProvider jettisonTypeObjectMapper; - private static final String CLOUDSITE_ID = "mtn13"; - private static final String TENANT_ID = "ba38bc24a2ef4fb2ad2810c894f1938f"; - private static final String NETWORK_ID = "da886914-efb2-4917-b335-c8381528d90b"; - private static final String NETWORK_TYPE = "CONTRAIL30_BASIC"; - private static final String MODEL_CUSTOMIZATION_UUID = "3bdbb104-476c-483e-9f8b-c095b3d308ac"; - private static final String MSO_SERVICE_INSTANCE_ID = "05869d5f-47df-4b45-bbfc-4f03ce0a50bf"; - private static final String MSO_REQUEST_ID = "requestId"; - private static final String NETWORK_NAME = "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0"; - - @Test - public void testCreateNetwork() throws JSONException, JsonParseException, JsonMappingException, IOException { - - CreateNetworkRequest request = new CreateNetworkRequest(); - request.setBackout(true); - request.setSkipAAI(true); - request.setFailIfExists(false); - MsoRequest msoReq = new MsoRequest(); - String networkTechnology = "CONTRAIL"; - - msoReq.setRequestId(MSO_REQUEST_ID); - msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); - request.setMsoRequest(msoReq); - request.setCloudSiteId(CLOUDSITE_ID); - request.setTenantId(TENANT_ID); - request.setNetworkId(NETWORK_ID); - request.setNetworkName(NETWORK_NAME); - request.setNetworkType(NETWORK_TYPE); - request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID); - request.setNetworkTechnology(networkTechnology); - - mockOpenStackResponseAccess(wireMockServer, wireMockPort); - - mockOpenStackPostPublicUrlWithBodyFile_200(wireMockServer); - - mockOpenStackGetStackCreatedVUSP_200(wireMockServer); - - mockOpenStackGetStackVUSP_404(wireMockServer); - - headers.add("Accept", MediaType.APPLICATION_JSON); - HttpEntity<CreateNetworkRequest> entity = new HttpEntity<CreateNetworkRequest>(request, headers); - ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class); - - CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( - new File("src/test/resources/__files/CreateNetworkResponse.json"), CreateNetworkResponse.class); - - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - assertThat(response.getBody(), sameBeanAs(expectedResponse)); - } - - @Test - public void testCreateNetwork_JSON() throws JSONException, JsonParseException, JsonMappingException, IOException { - - - - mockOpenStackResponseAccess(wireMockServer, wireMockPort); - - mockOpenStackPostPublicUrlWithBodyFile_200(wireMockServer); - - mockOpenStackGetStackCreatedAppC_200(wireMockServer); - - mockOpenStackGetStackAppC_404(wireMockServer); - - headers.add("Content-Type", MediaType.APPLICATION_JSON); - headers.add("Accept", MediaType.APPLICATION_JSON); - - String request = readJsonFileAsString("src/test/resources/CreateNetwork.json"); - HttpEntity<String> entity = new HttpEntity<String>(request, headers); - - ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class); - - CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( - new File("src/test/resources/__files/CreateNetworkResponse2.json"), CreateNetworkResponse.class); - - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - assertThat(response.getBody(), sameBeanAs(expectedResponse)); - } - - - - @Test - public void testDeleteNetwork() throws IOException { - - DeleteNetworkRequest request = new DeleteNetworkRequest(); - - MsoRequest msoReq = new MsoRequest(); - - msoReq.setRequestId(MSO_REQUEST_ID); - msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); - request.setMsoRequest(msoReq); - request.setCloudSiteId(CLOUDSITE_ID); - request.setTenantId(TENANT_ID); - request.setNetworkId(NETWORK_ID); - request.setNetworkType(NETWORK_TYPE); - request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID); - request.setNetworkStackId(NETWORK_ID); - - mockOpenStackResponseAccess(wireMockServer, wireMockPort); - - mockOpenStackPublicUrlStackByID_200(wireMockServer, wireMockPort); - - mockOpenStackGetPublicUrlStackByNameAndID_204(wireMockServer, wireMockPort); - - mockOpenStackDeletePublicUrlStackByNameAndID_204(wireMockServer); - - headers.add("Accept", MediaType.APPLICATION_JSON); - - HttpEntity<DeleteNetworkRequest> entity = new HttpEntity<DeleteNetworkRequest>(request, headers); - - ResponseEntity<DeleteNetworkResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b"), HttpMethod.DELETE, - entity, DeleteNetworkResponse.class); - - DeleteNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( - new File("src/test/resources/__files/DeleteNetworkResponse.json"), DeleteNetworkResponse.class); - - assertThat(response.getBody(), sameBeanAs(expectedResponse)); - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - - } - - @Test - public void testRollbackNetwork() throws IOException { - - RollbackNetworkRequest request = new RollbackNetworkRequest(); - MsoRequest msoReq = new MsoRequest(); - msoReq.setRequestId(MSO_REQUEST_ID); - msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); - - mockOpenStackResponseAccess(wireMockServer, wireMockPort); - - mockOpenStackPublicUrlStackByID_200(wireMockServer, wireMockPort); - - mockOpenStackGetPublicUrlStackByNameAndID_204(wireMockServer, wireMockPort); - - mockOpenStackDeletePublicUrlStackByNameAndID_204(wireMockServer); - - headers.add("Accept", MediaType.APPLICATION_JSON); - - HttpEntity<RollbackNetworkRequest> entity = new HttpEntity<>(request, headers); - - ResponseEntity<RollbackNetworkResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b/rollback"), - HttpMethod.DELETE, entity, RollbackNetworkResponse.class); - - RollbackNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( - new File("src/test/resources/__files/RollbackNetworkResponse.json"), RollbackNetworkResponse.class); - - assertThat(response.getBody(), sameBeanAs(expectedResponse)); - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - - } - - @Test - public void testQueryNetwork_Exception() throws IOException { - MsoRequest msoReq = new MsoRequest(); - msoReq.setRequestId(MSO_REQUEST_ID); - msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); - headers.add("Accept", MediaType.APPLICATION_JSON); - - HttpEntity<DeleteNetworkRequest> entity = new HttpEntity<DeleteNetworkRequest>(headers); - - ResponseEntity<QueryNetworkError> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b"), HttpMethod.GET, - entity, QueryNetworkError.class); - - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - - } - - @Test - public void testQueryNetwork() throws IOException { - - mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStackVfModule_200(wireMockServer); - - headers.add("Accept", MediaType.APPLICATION_JSON); - HttpEntity<DeleteNetworkRequest> entity = new HttpEntity<DeleteNetworkRequest>(headers); - - ResponseEntity<QueryNetworkResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b" + "?cloudSiteId=" - + CLOUDSITE_ID + "&tenantId=" + TENANT_ID + "&aaiNetworkId=aaiNetworkId"), - HttpMethod.GET, entity, QueryNetworkResponse.class); - - assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value()); - - } - - @Test - public void testUpdateNetwork() throws IOException { - - UpdateNetworkRequest request = new UpdateNetworkRequest(); - - MsoRequest msoReq = new MsoRequest(); - - msoReq.setRequestId(MSO_REQUEST_ID); - msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); - request.setMsoRequest(msoReq); - request.setCloudSiteId(CLOUDSITE_ID); - request.setTenantId(TENANT_ID); - request.setNetworkId(NETWORK_ID); - request.setNetworkName(NETWORK_NAME); - request.setNetworkType(NETWORK_TYPE); - request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID); - request.setNetworkStackId(NETWORK_ID); - - mockOpenStackResponseAccess(wireMockServer, wireMockPort); - - mockOpenStackPublicUrlStackByName_200(wireMockServer, wireMockPort); - - mockOpenStackPublicUrlStackByID_200(wireMockServer, wireMockPort); - - mockOpenStackGetPublicUrlStackByNameAndID_200(wireMockServer, wireMockPort); - - mockOpenStackPutPublicUrlStackByNameAndID_200(wireMockServer); - - headers.add("Accept", MediaType.APPLICATION_JSON); - - HttpEntity<UpdateNetworkRequest> entity = new HttpEntity<UpdateNetworkRequest>(request, headers); - - ResponseEntity<UpdateNetworkResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b"), HttpMethod.PUT, - entity, UpdateNetworkResponse.class); - - UpdateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( - new File("src/test/resources/__files/UpdateNetworkResponse.json"), UpdateNetworkResponse.class); - - assertThat(response.getBody(), sameBeanAs(expectedResponse)); - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - } - - @Test - public void testCreateNetworkCNRC_JSON() - throws JSONException, JsonParseException, JsonMappingException, IOException { - - mockOpenStackResponseAccess(wireMockServer, wireMockPort); - - mockOpenStackPostPublicUrlWithBodyFile_200(wireMockServer); - - mockOpenStackGetStackCreatedAppC_200(wireMockServer); - - mockOpenStackGetStackAppC_404(wireMockServer); - - headers.add("Content-Type", MediaType.APPLICATION_JSON); - headers.add("Accept", MediaType.APPLICATION_JSON); - - String request = readJsonFileAsString("src/test/resources/CreateNetwork3.json"); - HttpEntity<String> entity = new HttpEntity<String>(request, headers); - - ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class); - - CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( - new File("src/test/resources/__files/CreateNetworkResponse3.json"), CreateNetworkResponse.class); - - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - assertThat(response.getBody(), sameBeanAs(expectedResponse)); - } - - @Test - public void testCreateNetworkNC_Shared_JSON() - throws JSONException, JsonParseException, JsonMappingException, IOException { - - mockOpenStackResponseAccess(wireMockServer, wireMockPort); - - mockOpenStackPostPublicUrlWithBodyFile_200(wireMockServer); - - mockOpenStackGetStackCreatedAppC_200(wireMockServer); - - mockOpenStackGetStackAppC_404(wireMockServer); - - headers.add("Content-Type", MediaType.APPLICATION_JSON); - headers.add("Accept", MediaType.APPLICATION_JSON); - - String request = readJsonFileAsString("src/test/resources/CreateNetwork4.json"); - HttpEntity<String> entity = new HttpEntity<String>(request, headers); - - ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class); - - CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( - new File("src/test/resources/__files/CreateNetworkResponse4.json"), CreateNetworkResponse.class); - - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - assertThat(response.getBody(), sameBeanAs(expectedResponse)); - } - - @Override - protected String readJsonFileAsString(String fileLocation) - throws JsonParseException, JsonMappingException, IOException { - return new String(Files.readAllBytes(Paths.get(fileLocation))); - } -} diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java index b5b0f5a8ef..8d5ab8234e 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java @@ -44,7 +44,7 @@ public class PollServiceTest { String xmlString = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml"))); - Mockito.when(mockExternalTask.getVariable("vnfAdapterTaskRequest")).thenReturn(xmlString); + Mockito.when(mockExternalTask.getVariable("openstackAdapterTaskRequest")).thenReturn(xmlString); Mockito.when(mockExternalTask.getVariable("PollRollbackStatus")).thenReturn(false); Mockito.when(mockExternalTask.getVariable("stackId")).thenReturn("stackId/stack123"); Mockito.when(msoHeatUtils.pollStackForStatus(eq(1), any(Stack.class), eq("CREATE_IN_PROGRESS"), eq("regionOne"), @@ -64,7 +64,7 @@ public class PollServiceTest { String xmlString = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml"))); - Mockito.when(mockExternalTask.getVariable("vnfAdapterTaskRequest")).thenReturn(xmlString); + Mockito.when(mockExternalTask.getVariable("openstackAdapterTaskRequest")).thenReturn(xmlString); Mockito.when(mockExternalTask.getVariable("PollRollbackStatus")).thenReturn(true); Mockito.when(mockExternalTask.getVariable("stackId")).thenReturn("stackId/stack123"); Mockito.when(msoHeatUtils.pollStackForStatus(eq(1), any(), eq("DELETE_IN_PROGRESS"), eq("regionOne"), diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java index f7613909ec..1f68106f78 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java @@ -65,7 +65,7 @@ public class RollbackServiceTest { Stack stack = new Stack(); stack.setId("heatId"); - Mockito.when(mockExternalTask.getVariable("vnfAdapterTaskRequest")).thenReturn(payload); + Mockito.when(mockExternalTask.getVariable("openstackAdapterTaskRequest")).thenReturn(payload); Mockito.doNothing().when(vnfAdapterImpl).deleteVfModule(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any()); Mockito.doNothing().when(mockExternalTaskService).complete(Mockito.any(), Mockito.any()); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java index 2f583b30a2..cc2dfa213e 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java @@ -64,7 +64,7 @@ public class StackServiceTest { Stack stack = new Stack(); stack.setId("heatId"); - Mockito.when(mockExternalTask.getVariable("vnfAdapterTaskRequest")).thenReturn(payload); + Mockito.when(mockExternalTask.getVariable("openstackAdapterTaskRequest")).thenReturn(payload); Mockito.doNothing().when(vnfAdapterImpl).createVfModule(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), |