aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src/main
diff options
context:
space:
mode:
authorMax Benjamin <max.benjamin@att.com>2021-03-10 03:28:57 +0000
committerGerrit Code Review <gerrit@onap.org>2021-03-10 03:28:57 +0000
commit1d316a3c50f978313eca360c1a1636de68afee9d (patch)
treed0b7d6f5d242a6afeb7b7c2174994955d6a4298e /adapters/mso-openstack-adapters/src/main
parent85d6591d7fa102bf755bd9b025264586ebe15190 (diff)
parent7a9d4fb8c03b23d0d60d41c91111015c509bfa4f (diff)
Merge "remove vnfadaptercreate vnfadaptercreatevfmodule"
Diffstat (limited to 'adapters/mso-openstack-adapters/src/main')
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapter.java1
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java28
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java1
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java13
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java56
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java296
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java75
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java342
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java136
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java32
10 files changed, 54 insertions, 926 deletions
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 010d91fec9..52340d684a 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
@@ -36,6 +36,7 @@ import org.onap.so.openstack.beans.NetworkStatus;
import org.onap.so.openstack.beans.RouteTarget;
import org.onap.so.openstack.beans.Subnet;
+@Deprecated
@WebService(name = "NetworkAdapter", targetNamespace = "http://org.onap.so/network")
public interface MsoNetworkAdapter {
// TODO: Rename all of these to include Vlan in the service name? At least for the
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 abfacebf05..1446047ebd 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
@@ -34,7 +34,6 @@ 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.MsoNetworkAdapterImpl;
-import org.onap.so.adapters.vnf.MsoVnfAdapterAsyncImpl;
import org.onap.so.adapters.vnf.MsoVnfAdapterImpl;
import org.onap.so.client.policy.JettisonStyleMapperProvider;
import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor;
@@ -55,8 +54,6 @@ public class CXFConfiguration {
@Autowired
private MsoVnfAdapterImpl vnfAdapterImpl;
@Autowired
- private MsoVnfAdapterAsyncImpl vnfAdapterAsyncImpl;
- @Autowired
private CloudRegionRestV1 cloudRegionRestV1;
@Autowired
private JettisonStyleMapperProvider jettisonStyleObjectMapper;
@@ -92,31 +89,6 @@ public class CXFConfiguration {
return endpoint;
}
- /*
- * vnfAdapterEndpoint VnfAsyncAdapterEndpoint VnfCloudAdapterEndpoint
- */
- @Bean
- public Endpoint vnfAdapterEndpoint() {
- EndpointImpl endpoint = new EndpointImpl(springBus(), vnfAdapterImpl);
- endpoint.publish("/VnfAdapter");
- endpoint.setWsdlLocation("VnfAdapter.wsdl");
- endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor());
- endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor());
- endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor());
- return endpoint;
- }
-
- @Bean
- public Endpoint vnfAsyncAdapterEndpoint() {
- EndpointImpl endpoint = new EndpointImpl(springBus(), vnfAdapterAsyncImpl);
- endpoint.publish("/VnfAsyncAdapter");
- endpoint.setWsdlLocation("VnfAsyncAdapter.wsdl");
- endpoint.getInInterceptors().add(new SOAPLoggingInInterceptor());
- endpoint.getOutInterceptors().add(new SOAPLoggingOutInterceptor());
- endpoint.getOutFaultInterceptors().add(new SOAPLoggingOutInterceptor());
- return endpoint;
- }
-
// Uses normal Jackson marshalling semantics
@Bean
public Server rsServerApi() {
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 14df4e6941..f13b5bda7c 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
@@ -239,6 +239,7 @@ public class PollService extends ExternalTaskUtils {
StackInfo stack =
pollCreateResource(timeoutMinutes, req.getCloudSiteId(), req.getTenantId(), stackId, success);
outputs = vnfAdapterImpl.copyStringOutputs(stack.getOutputs());
+
}
VfModuleRollback modRollback = new VfModuleRollback(buildVnfRollback(req, stackId, isMulticloud),
req.getVfModuleId(), stackId, req.getMessageId());
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 d6d2264217..52dfa6a534 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
@@ -61,8 +61,8 @@ public class RollbackService extends ExternalTaskUtils {
JAXB.unmarshal(new StringReader(xmlRequest), CreateVolumeGroupRequest.class);
boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
if (!isMulticloud) {
- vnfAdapterImpl.deleteVnf(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
- req.getVolumeGroupName(), req.getMsoRequest(), false);
+ vnfAdapterImpl.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ req.getVolumeGroupName(), null, req.getMsoRequest(), new Holder<>());
pollRollbackStatus = true;
success = true;
} else {
@@ -78,16 +78,11 @@ public class RollbackService extends ExternalTaskUtils {
boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
if (!isMulticloud) {
vnfAdapterImpl.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
- req.getVfModuleName(), req.getVnfId(), req.getVfModuleId(),
- req.getModelCustomizationUuid(), req.getMsoRequest(), new Holder<>());
+ req.getVfModuleName(), req.getModelCustomizationUuid(), req.getMsoRequest(),
+ new Holder<>());
pollRollbackStatus = true;
success = true;
} else {
- /*
- * vnfPluginImpl.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
- * req.getVfModuleName(),req.getMsoRequest(), new Holder<>()); TODO: Figure out how to properly
- * rollback
- */
pollRollbackStatus = false;
success = true;
}
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 6b76c3af9a..9d217380d6 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
@@ -55,7 +55,6 @@ import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
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;
import org.slf4j.LoggerFactory;
@@ -97,33 +96,26 @@ public class StackService extends ExternalTaskUtils {
String errorMessage = "";
try {
if (xmlRequest != null) {
- 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");
- createVolumeGroup(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
+ createVolumeGroup(xmlRequest, canonicalStackId, backout, success);
} else if ("createVfModuleRequest".equals(requestType.get())) {
logger.debug("Executing External Task Stack Service For Create Vf Module");
- createVfModule(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
+ createVfModule(xmlRequest, canonicalStackId, backout, success);
} else if ("deleteVfModuleRequest".equals(requestType.get())) {
logger.debug("Executing External Task Stack Service For Delete Vf Module");
- deleteVfModule(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
+ deleteVfModule(xmlRequest, canonicalStackId, backout, success);
} else if ("deleteVolumeGroupRequest".equals(requestType.get())) {
logger.debug("Executing External Task Stack Service For Delete Volume Group");
- deleteVolumeGroup(xmlRequest, outputs, vnfRollback, canonicalStackId, backout, success);
+ deleteVolumeGroup(xmlRequest, canonicalStackId, backout, success);
} else if ("createNetworkRequest".equals(requestType.get())) {
- createNetwork(xmlRequest, networkId, neutronNetworkId, networkFqdn, subnetIdMap, networkRollback,
- canonicalStackId, backout, success, os3Nw);
+ createNetwork(xmlRequest, subnetIdMap, networkRollback, canonicalStackId, backout, success, os3Nw);
} else if ("deleteNetworkRequest".equals(requestType.get())) {
deleteNetwork(xmlRequest, canonicalStackId, backout, success);
} else if ("updateNetworkRequest".equals(requestType.get())) {
-
updateNetwork(xmlRequest, subnetIdMap, networkRollback, canonicalStackId, backout, success);
} else if ("rollbackNetworkRequest".equals(requestType.get())) {
rollbackNetwork(xmlRequest, canonicalStackId, backout, success);
@@ -152,8 +144,7 @@ public class StackService extends ExternalTaskUtils {
}
}
- private void createVolumeGroup(String xmlRequest, Holder<Map<String, String>> outputs,
- Holder<VnfRollback> vnfRollback, Holder<String> canonicalStackId, MutableBoolean backout,
+ private void createVolumeGroup(String xmlRequest, Holder<String> canonicalStackId, MutableBoolean backout,
MutableBoolean success) throws VnfException {
CreateVolumeGroupRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateVolumeGroupRequest.class);
String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
@@ -162,19 +153,19 @@ public class StackService extends ExternalTaskUtils {
vnfPluginImpl.createVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
completeVnfVfModuleType, req.getVnfVersion(), "", req.getVolumeGroupName(), "", "VOLUME", null,
null, req.getModelCustomizationUuid(), req.getVolumeGroupParams(), false, true,
- req.getEnableBridge(), req.getMsoRequest(), canonicalStackId, outputs, vnfRollback);
+ req.getEnableBridge(), req.getMsoRequest(), canonicalStackId);
} else {
vnfAdapterImpl.createVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
completeVnfVfModuleType, req.getVnfVersion(), "", req.getVolumeGroupName(), "", "VOLUME", null,
null, req.getModelCustomizationUuid(), req.getVolumeGroupParams(), false, true,
- req.getEnableBridge(), req.getMsoRequest(), canonicalStackId, outputs, vnfRollback);
+ req.getEnableBridge(), req.getMsoRequest(), canonicalStackId);
}
success.setTrue();
backout.setValue(!req.getSuppressBackout());
}
- private void createVfModule(String xmlRequest, Holder<Map<String, String>> outputs, Holder<VnfRollback> vnfRollback,
- Holder<String> canonicalStackId, MutableBoolean backout, MutableBoolean success) throws VnfException {
+ private void createVfModule(String xmlRequest, Holder<String> canonicalStackId, MutableBoolean backout,
+ MutableBoolean success) throws VnfException {
CreateVfModuleRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateVfModuleRequest.class);
String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
@@ -183,21 +174,22 @@ public class StackService extends ExternalTaskUtils {
completeVnfVfModuleType, req.getVnfVersion(), req.getVnfId(), req.getVfModuleName(),
req.getVfModuleId(), req.getRequestType(), req.getVolumeGroupStackId(),
req.getBaseVfModuleStackId(), req.getModelCustomizationUuid(), req.getVfModuleParams(), false,
- false, req.getEnableBridge(), req.getMsoRequest(), canonicalStackId, outputs, vnfRollback);
+ false, req.getEnableBridge(), req.getMsoRequest(), canonicalStackId);
} else {
vnfAdapterImpl.createVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
completeVnfVfModuleType, req.getVnfVersion(), req.getVnfId(), req.getVfModuleName(),
req.getVfModuleId(), req.getRequestType(), req.getVolumeGroupStackId(),
req.getBaseVfModuleStackId(), req.getModelCustomizationUuid(), req.getVfModuleParams(), false,
- false, req.getEnableBridge(), req.getMsoRequest(), canonicalStackId, outputs, vnfRollback);
+ false, req.getEnableBridge(), req.getMsoRequest(), canonicalStackId);
}
success.setTrue();
backout.setValue(req.getBackout());
}
- private void deleteVfModule(String xmlRequest, Holder<Map<String, String>> outputs, Holder<VnfRollback> vnfRollback,
- Holder<String> canonicalStackId, MutableBoolean backout, MutableBoolean success) throws VnfException {
+ private void deleteVfModule(String xmlRequest, Holder<String> canonicalStackId, MutableBoolean backout,
+ MutableBoolean success) throws VnfException {
backout.setFalse();
+ Holder<Map<String, String>> outputs = new Holder<>();
DeleteVfModuleRequest req = JAXB.unmarshal(new StringReader(xmlRequest), DeleteVfModuleRequest.class);
boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
if (isMulticloud) {
@@ -205,8 +197,7 @@ public class StackService extends ExternalTaskUtils {
req.getVfModuleStackId(), req.getMsoRequest(), outputs);
} else {
vnfAdapterImpl.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
- req.getVfModuleStackId(), req.getVnfId(), req.getVfModuleId(), req.getModelCustomizationUuid(),
- req.getMsoRequest(), outputs);
+ req.getVfModuleStackId(), req.getModelCustomizationUuid(), req.getMsoRequest(), outputs);
}
success.setTrue();
if (outputs != null && outputs.value != null) {
@@ -216,21 +207,24 @@ public class StackService extends ExternalTaskUtils {
}
}
- private void deleteVolumeGroup(String xmlRequest, Holder<Map<String, String>> outputs,
- Holder<VnfRollback> vnfRollback, Holder<String> canonicalStackId, MutableBoolean backout,
+ private void deleteVolumeGroup(String xmlRequest, Holder<String> canonicalStackId, MutableBoolean backout,
MutableBoolean success) throws VnfException {
backout.setFalse();
DeleteVolumeGroupRequest req = JAXB.unmarshal(new StringReader(xmlRequest), DeleteVolumeGroupRequest.class);
- vnfAdapterImpl.deleteVnf(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
- req.getVolumeGroupStackId(), req.getMsoRequest(), false);
+ vnfAdapterImpl.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ req.getVolumeGroupStackId(), null, req.getMsoRequest(), new Holder<>());
success.setTrue();
canonicalStackId.value = req.getVolumeGroupStackId();
}
- private void createNetwork(String xmlRequest, Holder<String> networkId, Holder<String> neutronNetworkId,
- Holder<String> networkFqdn, Holder<Map<String, String>> subnetIdMap,
+ private void createNetwork(String xmlRequest, Holder<Map<String, String>> subnetIdMap,
Holder<NetworkRollback> networkRollback, Holder<String> canonicalStackId, MutableBoolean backout,
MutableBoolean success, MutableBoolean os3) throws NetworkException {
+
+ Holder<String> networkId = new Holder<>();
+ Holder<String> neutronNetworkId = new Holder<>();
+ Holder<String> networkFqdn = new Holder<>();
+
CreateNetworkRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateNetworkRequest.class);
HashMap<String, String> params = (HashMap<String, String>) req.getNetworkParams();
if (params == null) {
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java
deleted file mode 100644
index 5b0370b25e..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. 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.vnf;
-
-
-import java.security.GeneralSecurityException;
-import java.util.Set;
-import java.util.TreeSet;
-import javax.annotation.PostConstruct;
-import javax.xml.bind.DatatypeConverter;
-import org.apache.http.HttpEntity;
-import org.apache.http.client.config.RequestConfig;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.ContentType;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.apache.http.util.EntityUtils;
-import org.onap.logging.filter.base.ErrorCode;
-import org.onap.so.logger.MessageEnum;
-import org.onap.so.utils.CryptoUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.core.env.Environment;
-import org.springframework.stereotype.Component;
-
-/**
- * This is the class that is used to POST replies from the MSO adapters to the BPEL engine. It can be configured via
- * property file, or modified using the member methods. The properties to use are: org.onap.so.adapters.vnf.bpelauth
- * encrypted authorization string to send to BEPL engine org.onap.so.adapters.vnf.sockettimeout socket timeout value
- * org.onap.so.adapters.vnf.connecttimeout connect timeout value org.onap.so.adapters.vnf.retrycount number of times to
- * retry failed connections org.onap.so.adapters.vnf.retryinterval interval (in seconds) between retries
- * org.onap.so.adapters.vnf.retrylist list of response codes that will trigger a retry (the special code 900 means
- * "connection was not established")
- */
-@Component
-@Scope("prototype")
-public class BpelRestClient {
- public static final String MSO_PROP_VNF_ADAPTER = "MSO_PROP_VNF_ADAPTER";
- private static final String PROPERTY_DOMAIN = "org.onap.so.adapters.vnf";
- private static final String BPEL_AUTH_PROPERTY = PROPERTY_DOMAIN + ".bpelauth";
- private static final String SOCKET_TIMEOUT_PROPERTY = PROPERTY_DOMAIN + ".sockettimeout";
- private static final String CONN_TIMEOUT_PROPERTY = PROPERTY_DOMAIN + ".connecttimeout";
- private static final String RETRY_COUNT_PROPERTY = PROPERTY_DOMAIN + ".retrycount";
- private static final String RETRY_INTERVAL_PROPERTY = PROPERTY_DOMAIN + ".retryinterval";
- private static final String RETRY_LIST_PROPERTY = PROPERTY_DOMAIN + ".retrylist";
- private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey";
- private static final Logger logger = LoggerFactory.getLogger(BpelRestClient.class);
-
- /** Default socket timeout (in seconds) */
- public static final int DEFAULT_SOCKET_TIMEOUT = 5;
- /** Default connect timeout (in seconds) */
- public static final int DEFAULT_CONNECT_TIMEOUT = 5;
- /** By default, retry up to five times */
- public static final int DEFAULT_RETRY_COUNT = 5;
- /** Default interval to wait between retries (in seconds), negative means use backoff algorithm */
- public static final int DEFAULT_RETRY_INTERVAL = -15;
- /** Default list of response codes to trigger a retry */
- public static final String DEFAULT_RETRY_LIST = "408,429,500,502,503,504,900"; // 900 is "connection failed"
- /** Default credentials */
- public static final String DEFAULT_CREDENTIALS = "";
-
- @Autowired
- private Environment env;
- // Properties of the BPEL client -- all are configurable
- private int socketTimeout;
- private int connectTimeout;
- private int retryCount;
- private int retryInterval;
- private Set<Integer> retryList;
- private String credentials;
-
- // last response from BPEL engine
- private int lastResponseCode;
- private String lastResponse;
-
- /**
- * Create a client to send results to the BPEL engine, using configuration from the MSO_PROP_VNF_ADAPTER properties.
- */
- public BpelRestClient() {
- socketTimeout = DEFAULT_SOCKET_TIMEOUT;
- connectTimeout = DEFAULT_CONNECT_TIMEOUT;
- retryCount = DEFAULT_RETRY_COUNT;
- retryInterval = DEFAULT_RETRY_INTERVAL;
- setRetryList(DEFAULT_RETRY_LIST);
- credentials = DEFAULT_CREDENTIALS;
- lastResponseCode = 0;
- lastResponse = "";
-
- }
-
- @PostConstruct
- protected void init() {
-
- socketTimeout = env.getProperty(SOCKET_TIMEOUT_PROPERTY, Integer.class, DEFAULT_SOCKET_TIMEOUT);
- connectTimeout = env.getProperty(CONN_TIMEOUT_PROPERTY, Integer.class, DEFAULT_CONNECT_TIMEOUT);
- retryCount = env.getProperty(RETRY_COUNT_PROPERTY, Integer.class, DEFAULT_RETRY_COUNT);
- retryInterval = env.getProperty(RETRY_INTERVAL_PROPERTY, Integer.class, DEFAULT_RETRY_INTERVAL);
- setRetryList(env.getProperty(RETRY_LIST_PROPERTY, DEFAULT_RETRY_LIST));
- credentials = getEncryptedProperty(BPEL_AUTH_PROPERTY, DEFAULT_CREDENTIALS, ENCRYPTION_KEY_PROP);
- }
-
- public int getSocketTimeout() {
- return socketTimeout;
- }
-
- public void setSocketTimeout(int socketTimeout) {
- this.socketTimeout = socketTimeout;
- }
-
- public int getConnectTimeout() {
- return connectTimeout;
- }
-
- public void setConnectTimeout(int connectTimeout) {
- this.connectTimeout = connectTimeout;
- }
-
- public int getRetryCount() {
- return retryCount;
- }
-
- public void setRetryCount(int retryCount) {
- int newRetryCount = retryCount;
- if (newRetryCount < 0)
- newRetryCount = DEFAULT_RETRY_COUNT;
- this.retryCount = newRetryCount;
- }
-
- public int getRetryInterval() {
- return retryInterval;
- }
-
- public void setRetryInterval(int retryInterval) {
- this.retryInterval = retryInterval;
- }
-
- public String getCredentials() {
- return credentials;
- }
-
- public void setCredentials(String credentials) {
- this.credentials = credentials;
- }
-
- public String getRetryList() {
- if (retryList.isEmpty())
- return "";
- String t = retryList.toString();
- return t.substring(1, t.length() - 1);
- }
-
- public void setRetryList(String retryList) {
- Set<Integer> s = new TreeSet<>();
- for (String t : retryList.split("[, ]")) {
- try {
- s.add(Integer.parseInt(t));
- } catch (NumberFormatException x) {
- // ignore
- }
- }
- this.retryList = s;
- }
-
- public int getLastResponseCode() {
- return lastResponseCode;
- }
-
- public String getLastResponse() {
- return lastResponse;
- }
-
- /**
- * Post a response to the URL of the BPEL engine. As long as the response code is one of those in the retryList, the
- * post will be retried up to "retrycount" times with an interval (in seconds) of "retryInterval". If retryInterval
- * is negative, then each successive retry interval will be double the previous one.
- *
- * @param toBpelStr the content (XML or JSON) to post
- * @param bpelUrl the URL to post to
- * @param isxml true if the content is XML, otherwise assumed to be JSON
- * @return true if the post succeeded, false if all retries failed
- */
- public boolean bpelPost(final String toBpelStr, final String bpelUrl, final boolean isxml) {
- int totalretries = 0;
- int retryint = retryInterval;
- while (true) {
- sendOne(toBpelStr, bpelUrl, isxml);
- // Note: really should handle response code 415 by switching between content types if needed
- if (!retryList.contains(lastResponseCode)) {
- debug("Got response code: " + lastResponseCode + ": returning.");
- return true;
- }
- if (totalretries >= retryCount) {
- debug("Retried " + totalretries + " times, giving up.");
- logger.error("{} {} Could not deliver response to BPEL after {} tries: {}",
- MessageEnum.RA_SEND_VNF_NOTIF_ERR, ErrorCode.BusinessProcessError.getValue(), totalretries,
- toBpelStr);
- return false;
- }
- totalretries++;
- int sleepinterval = retryint;
- if (retryint < 0) {
- // if retry interval is negative double the retry on each pass
- sleepinterval = -retryint;
- retryint *= 2;
- }
- debug("Sleeping for " + sleepinterval + " seconds.");
- try {
- Thread.sleep(sleepinterval * 1000L);
- } catch (InterruptedException e) {
- logger.debug("Exception while Thread sleep", e);
- Thread.currentThread().interrupt();
- }
- }
- }
-
- private void debug(String m) {
- logger.debug(m);
- }
-
- private void sendOne(final String toBpelStr, final String bpelUrl, final boolean isxml) {
- logger.debug("Sending to BPEL server: {}", bpelUrl);
- logger.debug("Content is: {}", toBpelStr);
-
- // POST
- HttpPost post = new HttpPost(bpelUrl);
- if (credentials != null && !credentials.isEmpty())
- post.addHeader("Authorization", "Basic " + DatatypeConverter.printBase64Binary(credentials.getBytes()));
-
- logger.debug("HTTPPost Headers: {}", post.getAllHeaders());
-
- // ContentType
- ContentType ctype = isxml ? ContentType.APPLICATION_XML : ContentType.APPLICATION_JSON;
- post.setEntity(new StringEntity(toBpelStr, ctype));
-
- // Timeouts
- RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(socketTimeout * 1000)
- .setConnectTimeout(connectTimeout * 1000).build();
- post.setConfig(requestConfig);
-
- try (CloseableHttpClient client = HttpClients.createDefault()) {
- CloseableHttpResponse response = client.execute(post);
- if (response != null) {
- lastResponseCode = response.getStatusLine().getStatusCode();
- HttpEntity entity = response.getEntity();
- lastResponse = (entity != null) ? EntityUtils.toString(entity) : "";
- } else {
- lastResponseCode = 900;
- lastResponse = "";
- }
- } catch (Exception e) {
- logger.error("{} {} Exception - Error sending Bpel notification: {} ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
- ErrorCode.BusinessProcessError.getValue(), toBpelStr, e);
- lastResponseCode = 900;
- lastResponse = "";
- }
-
- logger.debug("Response code from BPEL server: {}", lastResponseCode);
- logger.debug("Response body is: {}", lastResponse);
- }
-
- private String getEncryptedProperty(String key, String defaultValue, String encryptionKey) {
- if (env.getProperty(key) != null) {
- try {
- return CryptoUtils.decrypt(env.getProperty(key), env.getProperty(encryptionKey));
- } catch (GeneralSecurityException e) {
- logger.debug("Exception while decrypting property: {} ", env.getProperty(key), e);
- }
- }
- return defaultValue;
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java
deleted file mode 100644
index 4b9c36b7b7..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java
+++ /dev/null
@@ -1,75 +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.vnf;
-
-
-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 javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.onap.so.entity.MsoRequest;
-import org.onap.so.openstack.mappers.MapAdapter;
-
-/**
- * This webservice defines the Asynchronous versions of VNF adapter calls. The notification messages for final responses
- * are documented elsewhere (by the client service WSDL).
- *
- */
-@Deprecated
-@WebService(name = "VnfAdapterAsync", targetNamespace = "http://org.onap.so/vnfA")
-public interface MsoVnfAdapterAsync {
- /**
- * This is the "Create VNF" Web Service Endpoint definition.
- */
- @WebMethod
- @Oneway
- public void createVnfA(@WebParam(name = "cloudSiteId") @XmlElement(required = true) String cloudSiteId,
- @WebParam(name = "cloudOwner") @XmlElement(required = false) String cloudOwner,
- @WebParam(name = "tenantId") @XmlElement(required = true) String tenantId,
- @WebParam(name = "vnfType") @XmlElement(required = true) String vnfType,
- @WebParam(name = "vnfVersion") @XmlElement(required = false) String vnfVersion,
- @WebParam(name = "vnfName") @XmlElement(required = true) String vnfName,
- @WebParam(name = "requestType") @XmlElement(required = false) String requestType,
- @WebParam(name = "volumeGroupHeatStackId") @XmlElement(required = false) String volumeGroupHeatStackId,
- @WebParam(name = "inputs") @XmlJavaTypeAdapter(MapAdapter.class) Map<String, Object> inputs,
- @WebParam(name = "failIfExists") Boolean failIfExists, @WebParam(name = "backout") Boolean backout,
- @WebParam(name = "enableBridge") Boolean enableBridge,
- @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 deleteVnfA(@WebParam(name = "cloudSiteId") @XmlElement(required = true) String cloudSiteId,
- @WebParam(name = "cloudOwner") @XmlElement(required = false) String cloudOwner,
- @WebParam(name = "tenantId") @XmlElement(required = true) String tenantId,
- @WebParam(name = "vnfName") @XmlElement(required = true) String vnfName,
- @WebParam(name = "messageId") @XmlElement(required = true) String messageId,
- @WebParam(name = "request") MsoRequest msoRequest,
- @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/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java
deleted file mode 100644
index 3bea44b884..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java
+++ /dev/null
@@ -1,342 +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.vnf;
-
-
-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.vnf.async.client.CreateVnfNotification;
-import org.onap.so.adapters.vnf.async.client.VnfAdapterNotify;
-import org.onap.so.adapters.vnf.async.client.VnfAdapterNotify_Service;
-import org.onap.so.adapters.vnf.exceptions.VnfException;
-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.VnfRollback;
-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;
-
-@WebService(serviceName = "VnfAdapterAsync", endpointInterface = "org.onap.so.adapters.vnf.MsoVnfAdapterAsync",
- targetNamespace = "http://org.onap.so/vnfA")
-@Component
-public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync {
-
- private static final Logger logger = LoggerFactory.getLogger(MsoVnfAdapterAsyncImpl.class);
-
- private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.vnf.bpelauth";
- private static final String ENCRYPTION_KEY_PROP = "mso.msoKey";
-
- @Autowired
- private Environment environment;
-
- @Autowired
- private MsoVnfAdapterImpl vnfImpl;
-
- /**
- * Health Check web method. Does nothing but return to show the adapter is deployed.
- */
- @Override
- public void healthCheckA() {
- logger.debug("Health check call in VNF Adapter");
- }
-
- /**
- * This is the asynchronous "Create VNF" web service implementation. It will create a new VNF of the requested type
- * in the specified cloud and tenant. The tenant must exist before this service is called.
- *
- * If a VNF with the same name already exists, this can be considered a success or failure, depending on the value
- * of the 'failIfExists' parameter.
- *
- * All VNF types will be defined in the MSO catalog. The caller must request one of these pre-defined types or an
- * error will be returned. Within the catalog, each VNF type references (among other things) a Heat template which
- * is used to deploy the required VNF artifacts (VMs, networks, etc.) to the cloud.
- *
- * Depending on the Heat template, a variable set of input parameters will be defined, some of which are required.
- * The caller is responsible to pass the necessary input data for the VNF or an error will be thrown.
- *
- * The method sends an asynchronous response to the notification URL when processing completes. The
- * createAsyncResponse contains the vnfId (the canonical name of the stack), a Map of VNF output attributes, and a
- * VnfRollback object. This last object can be passed as-is to the rollbackVnf operation to undo everything that was
- * created for the VNF. This is useful if a VNF is successfully created but the orchestrator fails on a subsequent
- * operation.
- *
- * Note: this method is implemented by calling the synchronous web method and translating the response to an
- * asynchronous notification.
- *
- * @param cloudSiteId CLLI code of the cloud site in which to create the VNF
- * @param cloudOwner cloud owner of the cloud site in which to create the VNF
- * @param tenantId Openstack tenant identifier
- * @param vnfType VNF type key, should match a VNF definition in catalog DB
- * @param vnfName Name to be assigned to the new VNF
- * @param inputs Map of key=value inputs for VNF stack creation
- * @param failIfExists Flag whether already existing VNF should be considered a success or failure
- * @param msoRequest Request tracking information for logs
- * @param notificationURL the target URL for asynchronous response
- */
- @Override
- public void createVnfA(String cloudSiteId, String cloudOwner, String tenantId, String vnfType, String vnfVersion,
- String vnfName, String requestType, String volumeGroupHeatStackId, Map<String, Object> inputs,
- Boolean failIfExists, Boolean backout, Boolean enableBridge, String messageId, MsoRequest msoRequest,
- String notificationUrl) {
-
- logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF);
- // Synchronous Web Service Outputs
- Holder<String> vnfId = new Holder<>();
- Holder<Map<String, String>> outputs = new Holder<>();
- Holder<VnfRollback> vnfRollback = new Holder<>();
-
- try {
- vnfImpl.createVnf(cloudSiteId, cloudOwner, tenantId, vnfType, vnfVersion, vnfName, requestType,
- volumeGroupHeatStackId, inputs, failIfExists, backout, enableBridge, msoRequest, vnfId, outputs,
- vnfRollback);
- } catch (VnfException e) {
- logger.error("{} {} VnfException in createVnfA ", MessageEnum.RA_CREATE_VNF_ERR,
- ErrorCode.BusinessProcessError.getValue(), e);
- org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
- String eMsg = null;
- try {
- eMsg = e.getFaultInfo().getMessage();
- exCat = org.onap.so.adapters.vnf.async.client.MsoExceptionCategory
- .fromValue(e.getFaultInfo().getCategory().name());
- } catch (Exception e1) {
- logger.error("{} {} Exception - Fault info ", MessageEnum.RA_FAULT_INFO_EXC,
- ErrorCode.BusinessProcessError.getValue(), e1);
- }
- // Build and send Asynchronous error response
- try {
- VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl);
- notifyPort.createVnfNotification(messageId, false, exCat, eMsg, null, null, null);
- } catch (Exception e1) {
- logger.error("{} {} Exception sending createVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
- ErrorCode.BusinessProcessError.getValue(), e1);
- }
- logger.info(LoggingAnchor.ONE, MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE);
- return;
- }
- logger.debug("Async Create VNF: {} VnfId:{}", vnfName, vnfId.value);
- // Build and send Asynchronous response
- try {
- VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl);
- notifyPort.createVnfNotification(messageId, true, null, null, vnfId.value, copyCreateOutputs(outputs),
- copyVrb(vnfRollback));
- } catch (Exception e) {
- logger.error("{} {} Exception sending createVnf notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
- ErrorCode.BusinessProcessError.getValue(), e);
- }
- logger.info("{} createVnfA", MessageEnum.RA_ASYNC_CREATE_VNF_COMPLETE);
- return;
- }
-
- /**
- * This is the Asynchronous "Delete VNF" web service implementation. It will delete a VNF by name or ID in the
- * specified cloud and tenant.
- *
- * The method has no outputs.
- *
- * @param cloudSiteId CLLI code of the cloud site in which to delete
- * @param cloudOwner cloud owner of cloud site in which to delete
- * @param tenantId Openstack tenant identifier
- * @param vnfName VNF Name or Openstack ID
- * @param msoRequest Request tracking information for logs
- * @param notificationURL the target URL for asynchronous response
- */
- @Override
- public void deleteVnfA(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, String messageId,
- MsoRequest msoRequest, String notificationUrl) {
-
- logger.info(LoggingAnchor.ONE, MessageEnum.RA_ASYNC_DELETE_VNF);
-
- try {
- vnfImpl.deleteVnf(cloudSiteId, cloudOwner, tenantId, vnfName, msoRequest);
- } catch (VnfException e) {
- logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_DELETE_VNF_ERR,
- ErrorCode.BusinessProcessError.getValue(), e);
- org.onap.so.adapters.vnf.async.client.MsoExceptionCategory exCat = null;
- String eMsg = null;
- try {
- eMsg = e.getFaultInfo().getMessage();
- exCat = org.onap.so.adapters.vnf.async.client.MsoExceptionCategory
- .fromValue(e.getFaultInfo().getCategory().name());
- } catch (Exception e1) {
- logger.error("{} {} Exception - fault info ", MessageEnum.RA_FAULT_INFO_EXC,
- ErrorCode.BusinessProcessError.getValue(), e1);
- }
- // Build and send Asynchronous error response
- try {
- VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl);
- notifyPort.deleteVnfNotification(messageId, false, exCat, eMsg);
- } catch (Exception e1) {
- logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
- ErrorCode.BusinessProcessError.getValue(), e1);
- }
- logger.info("{} deleteVnfA", MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE);
- return;
- }
-
- logger.debug("Async Delete VNF: {}", vnfName);
- // Build and send Asynchronous response
- try {
- VnfAdapterNotify notifyPort = getNotifyEP(notificationUrl);
- notifyPort.deleteVnfNotification(messageId, true, null, null);
-
- } catch (Exception e) {
- logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_SEND_VNF_NOTIF_ERR,
- ErrorCode.BusinessProcessError.getValue(), e);
- }
-
- logger.info("{} deleteVnfA", MessageEnum.RA_ASYNC_DELETE_VNF_COMPLETE);
- return;
- }
-
- private org.onap.so.adapters.vnf.async.client.VnfRollback copyVrb(Holder<VnfRollback> hVrb) {
- org.onap.so.adapters.vnf.async.client.VnfRollback cvrb =
- new org.onap.so.adapters.vnf.async.client.VnfRollback();
-
- if (hVrb != null && hVrb.value != null) {
- org.onap.so.adapters.vnf.async.client.MsoRequest cmr =
- new org.onap.so.adapters.vnf.async.client.MsoRequest();
-
- cvrb.setCloudSiteId(hVrb.value.getCloudSiteId());
- if (hVrb.value.getMsoRequest() != null) {
- cmr.setRequestId(hVrb.value.getMsoRequest().getRequestId());
- cmr.setServiceInstanceId(hVrb.value.getMsoRequest().getServiceInstanceId());
- } else {
- cmr.setRequestId(null);
- cmr.setServiceInstanceId(null);
- }
- cvrb.setMsoRequest(cmr);
- cvrb.setVnfId(hVrb.value.getVnfId());
- cvrb.setTenantId(hVrb.value.getTenantId());
- cvrb.setTenantCreated(hVrb.value.getTenantCreated());
- cvrb.setVnfCreated(hVrb.value.getVnfCreated());
- }
- return cvrb;
- }
-
- private CreateVnfNotification.Outputs copyCreateOutputs(Holder<Map<String, String>> hMap) {
-
- CreateVnfNotification.Outputs outputs = new CreateVnfNotification.Outputs();
-
- if (hMap != null && hMap.value != null) {
- Map<String, String> sMap;
- sMap = hMap.value;
- CreateVnfNotification.Outputs.Entry entry = new CreateVnfNotification.Outputs.Entry();
-
- for (String key : sMap.keySet()) {
- entry.setKey(key);
- entry.setValue(sMap.get(key));
- outputs.getEntry().add(entry);
- }
- }
- return outputs;
- }
-
- private VnfAdapterNotify getNotifyEP(String notificationUrl) {
-
- URL warWsdlLoc = null;
- try {
- warWsdlLoc = Thread.currentThread().getContextClassLoader().getResource("VnfAdapterNotify.wsdl");
- } catch (Exception e) {
- logger.error("{} {} Exception - WSDL not found ", MessageEnum.RA_WSDL_NOT_FOUND,
- ErrorCode.BusinessProcessError.getValue(), e);
- }
- if (warWsdlLoc == null) {
- logger.error("{} {} WSDL not found", MessageEnum.RA_WSDL_NOT_FOUND,
- ErrorCode.BusinessProcessError.getValue());
- } else {
- try {
- logger.debug("VnfAdpaterNotify.wsdl location:{}", warWsdlLoc.toURI().toString());
- } catch (Exception e) {
- logger.error("{} {} Exception - WSDL URL convention ", MessageEnum.RA_WSDL_URL_CONVENTION_EXC,
- ErrorCode.BusinessProcessError.getValue(), e);
- }
- }
-
- VnfAdapterNotify_Service notifySvc =
- new VnfAdapterNotify_Service(warWsdlLoc, new QName("http://org.onap.so/vnfNotify", "vnfAdapterNotify"));
-
- VnfAdapterNotify notifyPort = notifySvc.getMsoVnfAdapterAsyncImplPort();
-
- BindingProvider bp = (BindingProvider) notifyPort;
-
- URL epUrl = null;
- try {
- epUrl = new URL(notificationUrl);
- } catch (MalformedURLException e1) {
- logger.error("{} {} MalformedURLException ", MessageEnum.RA_INIT_NOTIF_EXC,
- ErrorCode.BusinessProcessError.getValue(), e1);
- }
-
- if (null != epUrl) {
- logger.debug("Notification Endpoint URL: {}", epUrl.toExternalForm());
- bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, epUrl.toExternalForm());
- } else {
- logger.debug("epUrl 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("{} {} Exception - Unable to set authorization in callback request ",
- MessageEnum.RA_SET_CALLBACK_AUTH_EXC, ErrorCode.BusinessProcessError.getValue(), 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;
-
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
index 4ee6cf259e..92d1c5f684 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
@@ -184,7 +184,7 @@ public class MsoVnfAdapterImpl {
}
this.createVfModule(cloudSiteId, cloudOwner, tenantId, vnfType, vnfVersion, genericVnfId, vnfName,
vfModuleId, newRequestType, vfVolGroupHeatStackId, vfBaseHeatStackId, null, inputs, failIfExists,
- backout, enableBridge, msoRequest, vnfId, outputs, rollback);
+ backout, enableBridge, msoRequest, vnfId);
return;
}
// createVf will know if the requestType starts with "X" that it's the "old" way
@@ -196,89 +196,12 @@ public class MsoVnfAdapterImpl {
}
this.createVfModule(cloudSiteId, cloudOwner, tenantId, vnfType, vnfVersion, genericVnfId, vnfName, vfModuleId,
newRequestTypeSb.toString(), vfVolGroupHeatStackId, vfBaseHeatStackId, null, inputs, failIfExists,
- backout, enableBridge, msoRequest, vnfId, outputs, rollback);
+ backout, enableBridge, msoRequest, vnfId);
return;
// End createVf shortcut
}
/**
- * This is the "Delete VNF" web service implementation. It will delete a VNF by name or ID in the specified cloud
- * and tenant.
- *
- * The method has no outputs.
- *
- * @param cloudSiteId CLLI code of the cloud site in which to delete
- * @param cloudOwner cloud owner of the cloud region in which to delete
- * @param tenantId Openstack tenant identifier
- * @param vnfName VNF Name or Openstack ID
- * @param msoRequest Request tracking information for logs
- */
- @Deprecated
- public void deleteVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, MsoRequest msoRequest)
- throws VnfException {
-
- logger.debug("Deleting VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
-
- try {
- StackInfo stackInfo = msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true, 118);
-
- msoHeatUtils.updateResourceStatus(msoRequest.getRequestId(),
- stackInfo.isOperationPerformed() ? String.format(RESOURCE_DELETED_STATUS_MESSAGE, VOLUME_GROUP)
- : String.format(RESOURCE_NOT_EXIST_STATUS_MESSAGE, VOLUME_GROUP, VOLUME_GROUP));
- } catch (MsoException me) {
- me.addContext(DELETE_VNF);
- // Failed to query the Stack due to an openstack exception.
- // Convert to a generic VnfException
- String error =
- "Delete VNF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId,
- tenantId, OPENSTACK, DELETE_VNF, ErrorCode.DataError.getValue(), "Exception - " + DELETE_VNF, me);
- logger.debug(error);
- throw new VnfException(me);
- }
-
- // On success, nothing is returned.
- return;
- }
-
- /**
- * This is the "Delete VNF" web service implementation. It will delete a VNF by name or ID in the specified cloud
- * and tenant.
- *
- * The method has no outputs.
- *
- * @param cloudSiteId CLLI code of the cloud site in which to delete
- * @param cloudOwner cloud owner of the cloud region in which to delete
- * @param tenantId Openstack tenant identifier
- * @param vnfName VNF Name or Openstack ID
- * @param msoRequest Request tracking information for logs
- */
- @Deprecated
- public void deleteVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, MsoRequest msoRequest,
- boolean pollStackStatus) throws VnfException {
-
- logger.debug("Deleting VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
-
- try {
- msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, pollStackStatus, 118);
- } catch (MsoException me) {
- me.addContext(DELETE_VNF);
- // Failed to query the Stack due to an openstack exception.
- // Convert to a generic VnfException
- String error =
- "Delete VNF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId,
- tenantId, OPENSTACK, DELETE_VNF, ErrorCode.DataError.getValue(), "Exception - " + DELETE_VNF, me);
- logger.debug(error);
- throw new VnfException(me);
- }
-
- // On success, nothing is returned.
- 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 rollbackVnf operation
* to undo the creation.
@@ -408,14 +331,12 @@ public class MsoVnfAdapterImpl {
return stringMap;
}
- // TODO remove rollback and outputs and polling
+ // TODO remove polling
public void createVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vnfType,
String vnfVersion, String genericVnfName, String vnfName, String vfModuleId, String requestType,
String volumeGroupHeatStackId, String baseVfHeatStackId, String modelCustomizationUuid,
Map<String, Object> inputs, Boolean failIfExists, Boolean backout, Boolean enableBridge,
- MsoRequest msoRequest, Holder<String> vnfId, Holder<Map<String, String>> outputs,
- Holder<VnfRollback> rollback) throws VnfException {
- boolean pollForCompletion = false;
+ MsoRequest msoRequest, Holder<String> stackId) throws VnfException {
String vfModuleName = vnfName;
String vfModuleType = vnfType;
String vfVersion = vnfVersion;
@@ -465,19 +386,6 @@ public class MsoVnfAdapterImpl {
logger.debug("requestTypeString = " + requestTypeString + ", nestedStackId = " + nestedStackId
+ ", nestedBaseStackId = " + nestedBaseStackId);
- // TODO remove
- // Build a default rollback object (no actions performed)
- VnfRollback vfRollback = new VnfRollback();
- vfRollback.setCloudSiteId(cloudSiteId);
- vfRollback.setCloudOwner(cloudOwner);
- vfRollback.setTenantId(tenantId);
- vfRollback.setMsoRequest(msoRequest);
- vfRollback.setRequestType(requestTypeString);
- vfRollback.setVolumeGroupHeatStackId(volumeGroupHeatStackId);
- vfRollback.setBaseGroupHeatStackId(baseVfHeatStackId);
- vfRollback.setIsBase(isBaseRequest);
- vfRollback.setModelCustomizationUuid(mcu);
-
// handle a nestedStackId if sent- this one would be for the volume - so applies to both Vf and Vnf
StackInfo nestedHeatStack = null;
Map<String, Object> nestedVolumeOutputs = null;
@@ -931,9 +839,8 @@ public class MsoVnfAdapterImpl {
}
if (msoHeatUtils != null) {
heatStack = msoHeatUtils.createStack(cloudSiteId, cloudOwner, tenantId, vfModuleName, null,
- template, goldenInputs, pollForCompletion, heatTemplate.getTimeoutMinutes(),
- newEnvironmentString, nestedTemplatesChecked, heatFilesObjects, backout.booleanValue(),
- failIfExists);
+ template, goldenInputs, false, heatTemplate.getTimeoutMinutes(), newEnvironmentString,
+ nestedTemplatesChecked, heatFilesObjects, backout.booleanValue(), failIfExists);
String resource = VF_MODULE;
if (isVolumeRequest) {
resource = VOLUME_GROUP;
@@ -958,14 +865,8 @@ public class MsoVnfAdapterImpl {
logger.error("Error creating Stack", e);
throw new VnfException("Exception during heat.createStack! " + e.getMessage());
}
- // Reach this point if createStack is successful.
- // Populate remaining rollback info and response parameters.
- vfRollback.setVnfId(heatStack.getCanonicalName());
- vfRollback.setVnfCreated(true);
- vnfId.value = heatStack.getCanonicalName();
- outputs.value = copyStringOutputs(heatStack.getOutputs());
- rollback.value = vfRollback; // TODO remove
+ stackId.value = heatStack.getCanonicalName();
logger.debug("VF Module {} successfully created", vfModuleName);
} catch (Exception e) {
logger.debug("unhandled exception in create VF", e);
@@ -973,19 +874,19 @@ public class MsoVnfAdapterImpl {
}
}
- public void deleteVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, String vnfId,
- String vfModuleId, String modelCustomizationUuid, MsoRequest msoRequest,
- Holder<Map<String, String>> outputs) throws VnfException {
+ public void deleteVfModule(String cloudSiteId, String cloudOwner, String tenantId, String stackId,
+ String modelCustomizationUuid, MsoRequest msoRequest, Holder<Map<String, String>> outputs)
+ throws VnfException {
Map<String, Object> stackOutputs;
try {
- stackOutputs = msoHeatUtils.queryStackForOutputs(cloudSiteId, cloudOwner, tenantId, vnfName);
+ stackOutputs = msoHeatUtils.queryStackForOutputs(cloudSiteId, cloudOwner, tenantId, stackId);
} catch (MsoException me) {
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
me.addContext("DeleteVFModule");
- String error = "Delete VFModule: Query to get outputs: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId
+ String error = "Delete VFModule: Query to get outputs: " + stackId + " in " + cloudOwner + "/" + cloudSiteId
+ "/" + tenantId + ": " + me;
- logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId,
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), stackId, cloudOwner, cloudSiteId,
tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(), "Exception - " + QUERY_STACK, me);
logger.debug(error);
throw new VnfException(me);
@@ -993,11 +894,14 @@ public class MsoVnfAdapterImpl {
// call method which handles the conversion from Map<String,Object> to Map<String,String> for our expected
// Object types
outputs.value = this.convertMapStringObjectToStringString(stackOutputs);
- int timeoutMinutes = msoHeatUtils.getVfHeatTimeoutValue(modelCustomizationUuid, false);
+ int timeoutMinutes = 118;
+ if (modelCustomizationUuid != null) {
+ timeoutMinutes = msoHeatUtils.getVfHeatTimeoutValue(modelCustomizationUuid, false);
+ }
try {
StackInfo currentStack =
- msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, false, timeoutMinutes);
+ msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, stackId, false, timeoutMinutes);
if (currentStack != null && outputs != null && outputs.value != null) {
logger.debug("Adding canonical stack id to outputs " + currentStack.getCanonicalName());
outputs.value.put("canonicalStackId", currentStack.getCanonicalName());
@@ -1010,8 +914,8 @@ public class MsoVnfAdapterImpl {
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
String error =
- "Delete VF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
- logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId,
+ "Delete VF: " + stackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
+ logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), stackId, cloudOwner, cloudSiteId,
tenantId, OPENSTACK, "DeleteStack", ErrorCode.DataError.getValue(), "Exception - deleteStack", me);
logger.error(error);
throw new VnfException(me);
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
index 58c43be36a..bde6d6b9c4 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
@@ -42,6 +42,7 @@ import java.util.Optional;
import java.util.Set;
import javax.jws.WebService;
import javax.xml.ws.Holder;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.adapters.vdu.CloudInfo;
import org.onap.so.adapters.vdu.VduException;
import org.onap.so.adapters.vdu.VduInstance;
@@ -63,11 +64,9 @@ import org.onap.so.db.catalog.beans.VnfResource;
import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository;
import org.onap.so.db.catalog.utils.MavenLikeVersioning;
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.VnfRollback;
import org.onap.so.openstack.beans.VnfStatus;
-import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.exceptions.MsoExceptionCategory;
import org.onap.so.openstack.utils.MsoHeatEnvironmentEntry;
@@ -532,8 +531,8 @@ public class MsoVnfPluginAdapterImpl {
public void createVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vfModuleType,
String vnfVersion, String genericVnfId, String vfModuleName, String vfModuleId, String requestType,
String volumeGroupId, String baseVfModuleId, String modelCustomizationUuid, Map<String, Object> inputs,
- Boolean failIfExists, Boolean backout, Boolean enableBridge, MsoRequest msoRequest, Holder<String> vnfId,
- Holder<Map<String, String>> outputs, Holder<VnfRollback> rollback) throws VnfException {
+ Boolean failIfExists, Boolean backout, Boolean enableBridge, MsoRequest msoRequest, Holder<String> vnfId)
+ throws VnfException {
// Will capture execution time for metrics
long startTime = System.currentTimeMillis();
@@ -575,21 +574,6 @@ public class MsoVnfPluginAdapterImpl {
logger.debug("requestType = " + requestType + ", volumeGroupStackId = " + volumeGroupId + ", baseStackId = "
+ baseVfModuleId);
- // Build a default rollback object (no actions performed)
- VnfRollback vfRollback = new VnfRollback();
- vfRollback.setCloudSiteId(cloudSiteId);
- vfRollback.setCloudOwner(cloudOwner);
- vfRollback.setTenantId(tenantId);
- vfRollback.setMsoRequest(msoRequest);
- vfRollback.setRequestType(requestType);
- vfRollback.setIsBase(false); // Until we know better
- vfRollback.setVolumeGroupHeatStackId(volumeGroupId);
- vfRollback.setBaseGroupHeatStackId(baseVfModuleId);
- vfRollback.setModelCustomizationUuid(modelCustomizationUuid);
- vfRollback.setMode("CFY");
-
- rollback.value = vfRollback; // Default rollback - no updates performed
-
// Get the VNF/VF Module definition from the Catalog DB first.
// There are three relevant records: VfModule, VfModuleCustomization, VnfResource
@@ -696,7 +680,6 @@ public class MsoVnfPluginAdapterImpl {
// Populate the outputs from the existing deployment.
vnfId.value = vduInstance.getVduInstanceId();
- outputs.value = copyStringOutputs(vduInstance.getOutputs());
return;
}
}
@@ -794,7 +777,6 @@ public class MsoVnfPluginAdapterImpl {
if (vfModule.getIsBase()) {
logger.debug("This is a BASE Module request");
- vfRollback.setIsBase(true);
} else {
logger.debug("This is an Add-On Module request");
@@ -1063,15 +1045,7 @@ public class MsoVnfPluginAdapterImpl {
throw new VnfException("Exception during instantiateVdu: " + e.getMessage());
}
-
- // Reach this point if create is successful.
- // Populate remaining rollback info and response parameters.
- vfRollback.setVnfCreated(true);
- vfRollback.setVnfId(vduInstance.getVduInstanceId());
vnfId.value = vduInstance.getVduInstanceId();
- outputs.value = copyStringOutputs(vduInstance.getOutputs());
-
- rollback.value = vfRollback;
logger.debug("VF Module " + vfModuleName + " successfully created");
return;