summaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/GenericValetResponse.java79
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java348
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/HeatRequest.java137
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetConfirmRequest.java68
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetConfirmResponse.java30
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetCreateRequest.java158
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetCreateResponse.java74
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetDeleteRequest.java101
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetDeleteResponse.java68
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetRollbackRequest.java85
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetRollbackResponse.java29
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetStatus.java86
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetUpdateRequest.java159
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetUpdateResponse.java73
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java316
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java18
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java127
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java29
19 files changed, 13 insertions, 1992 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 92b8cec83b..f06d2a2452 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
@@ -969,26 +969,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
return newInputs;
}
- /*
- * This helpful method added for Valet
- */
- public String getCloudSiteKeystoneUrl(String cloudSiteId) throws MsoCloudSiteNotFound {
- String keystoneUrl = null;
- try {
- CloudSite cloudSite =
- cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
- CloudIdentity cloudIdentity = cloudSite.getIdentityService();
- keystoneUrl = cloudIdentity.getIdentityUrl();
- } catch (Exception e) {
- throw new MsoCloudSiteNotFound(cloudSiteId);
- }
- if (keystoneUrl == null || keystoneUrl.isEmpty()) {
- throw new MsoCloudSiteNotFound(cloudSiteId);
- }
- return keystoneUrl;
- }
-
-
/*******************************************************************************
*
* Methods (and associated utilities) to implement the VduPlugin interface
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/GenericValetResponse.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/GenericValetResponse.java
deleted file mode 100644
index 6946fb1f90..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/GenericValetResponse.java
+++ /dev/null
@@ -1,79 +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.valet;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-/*
- * The purpose of this class is to encapsulate the possible responses from Valet in to one generic class that the vnf
- * adapter can more easily utilize. This will ensure we get an object back. Any status code other than 200 will be
- * treated as a failure. We may still get a 200 back - but the ValetStatus.status is "failed" - which will also be
- * treated as a failure. The T class is expected to be one of the Valet*Response pojos.
- */
-public class GenericValetResponse<T> {
- private int statusCode;
- private String errorMessage;
- private T returnObject;
-
-
- public GenericValetResponse(int statusCode, String errorMessage, T obj) {
- super();
- this.statusCode = statusCode;
- this.errorMessage = errorMessage;
- this.returnObject = obj;
- }
-
- public GenericValetResponse() {
- this(-1, "not set", null);
- }
-
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("statusCode", statusCode).append("errorMessage", errorMessage)
- .append("returnObject", returnObject).toString();
- }
-
- public void setErrorMessage(String errorMessage) {
- this.errorMessage = errorMessage;
- }
-
- public String getErrorMessage() {
- return this.errorMessage;
- }
-
- public void setStatusCode(int statusCode) {
- this.statusCode = statusCode;
- }
-
- public int getStatusCode() {
- return this.statusCode;
- }
-
- public void setReturnObject(T obj) {
- this.returnObject = obj;
- }
-
- public T getReturnObject() {
- return this.returnObject;
- }
-
-}
-
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java
deleted file mode 100644
index d75824357f..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java
+++ /dev/null
@@ -1,348 +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.valet;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import java.net.URI;
-import javax.annotation.PostConstruct;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriBuilder;
-import org.onap.so.adapters.valet.beans.HeatRequest;
-import org.onap.so.adapters.valet.beans.ValetConfirmRequest;
-import org.onap.so.adapters.valet.beans.ValetConfirmResponse;
-import org.onap.so.adapters.valet.beans.ValetCreateRequest;
-import org.onap.so.adapters.valet.beans.ValetCreateResponse;
-import org.onap.so.adapters.valet.beans.ValetDeleteRequest;
-import org.onap.so.adapters.valet.beans.ValetDeleteResponse;
-import org.onap.so.adapters.valet.beans.ValetRollbackRequest;
-import org.onap.so.adapters.valet.beans.ValetRollbackResponse;
-import org.onap.so.adapters.valet.beans.ValetUpdateRequest;
-import org.onap.so.adapters.valet.beans.ValetUpdateResponse;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.Environment;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Component;
-import org.springframework.web.client.RestTemplate;
-import javax.inject.Provider;
-
-@Component
-public class ValetClient {
-
- private static Logger logger = LoggerFactory.getLogger(ValetClient.class);
-
- @Autowired
- private Environment environment;
-
- private static final String VALET_BASE_URL = "org.onap.so.adapters.valet.base_url";
- private static final String VALET_BASE_PATH = "org.onap.so.adapters.valet.base_path";
- private static final String VALET_AUTH = "org.onap.so.adapters.valet.basic_auth";
- private static final String REQ_ID_HEADER_NAME = "X-RequestID";
- protected static final String NO_STATUS_RETURNED = "no status returned from Valet";
-
- private static final String DEFAULT_BASE_URL = "http://localhost:8080/";
- private static final String DEFAULT_BASE_PATH = "api/valet/placement/v1";
- private static final String DEFAULT_AUTH_STRING = "";
- private static final String REQUEST_ID = "requestId";
- private static final String HEADERS = ", headers=";
- private static final String BODY = ", body=";
- @Autowired
- private ObjectMapper mapper;
- @Autowired
- private Provider<RestTemplate> templateProvider;
-
-
- protected String baseUrl;
- protected String basePath;
- protected String authString;
-
- /*
- * Setup the properties needed from properties file. Each will fall to a default
- */
- @PostConstruct
- private void setupParams() {
- try {
- this.baseUrl = this.environment.getProperty(ValetClient.VALET_BASE_URL, ValetClient.DEFAULT_BASE_URL);
- this.basePath = this.environment.getProperty(ValetClient.VALET_BASE_PATH, ValetClient.DEFAULT_BASE_PATH);
- this.authString = this.environment.getProperty(ValetClient.VALET_AUTH, ValetClient.DEFAULT_AUTH_STRING);
- } catch (Exception e) {
- logger.debug("Error retrieving valet properties. {}", e.getMessage());
- }
- }
-
- /*
- * This method will be invoked to send a Create request to Valet.
- */
- public GenericValetResponse<ValetCreateResponse> callValetCreateRequest(String requestId, String regionId,
- String ownerId, String tenantId, String serviceInstanceId, String vnfId, String vnfName, String vfModuleId,
- String vfModuleName, String keystoneUrl, HeatRequest heatRequest) throws Exception {
- ResponseEntity<ValetCreateResponse> response = null;
- GenericValetResponse<ValetCreateResponse> gvr = null;
-
- try {
- UriBuilder builder = UriBuilder.fromPath(baseUrl).path(basePath).queryParam(REQUEST_ID, requestId);
- URI uri = builder.build();
-
- ValetCreateRequest vcr = this.createValetCreateRequest(regionId, ownerId, tenantId, serviceInstanceId,
- vnfId, vnfName, vfModuleId, vfModuleName, keystoneUrl, heatRequest);
- String body = mapper.writeValueAsString(vcr);
- HttpHeaders headers = generateHeaders(requestId);
- HttpEntity<String> entity = new HttpEntity<>(body, headers);
-
- response = getRestTemplate().exchange(uri, HttpMethod.POST, entity, ValetCreateResponse.class);
- gvr = this.getGVRFromResponse(response);
- } catch (Exception e) {
- logger.error("An exception occurred in callValetCreateRequest", e);
- throw e;
- }
- return gvr;
- }
-
- private RestTemplate getRestTemplate() {
- return templateProvider.get();
- }
-
- /*
- * This method will be invoked to send an Update request to Valet.
- */
- public GenericValetResponse<ValetUpdateResponse> callValetUpdateRequest(String requestId, String regionId,
- String ownerId, String tenantId, String serviceInstanceId, String vnfId, String vnfName, String vfModuleId,
- String vfModuleName, String keystoneUrl, HeatRequest heatRequest) throws Exception {
- ResponseEntity<ValetUpdateResponse> response = null;
- GenericValetResponse<ValetUpdateResponse> gvr = null;
-
- try {
- UriBuilder builder = UriBuilder.fromPath(baseUrl).path(basePath).queryParam(REQUEST_ID, requestId);
- URI uri = builder.build();
-
- ValetUpdateRequest vur = this.createValetUpdateRequest(regionId, ownerId, tenantId, serviceInstanceId,
- vnfId, vnfName, vfModuleId, vfModuleName, keystoneUrl, heatRequest);
- String body = mapper.writeValueAsString(vur);
- HttpHeaders headers = generateHeaders(requestId);
- HttpEntity<String> entity = new HttpEntity<>(body, headers);
-
-
- response = getRestTemplate().exchange(uri, HttpMethod.PUT, entity, ValetUpdateResponse.class);
- gvr = this.getGVRFromResponse(response);
- } catch (Exception e) {
- logger.error("An exception occurred in callValetUpdateRequest", e);
- throw e;
- }
- return gvr;
- }
-
- /*
- * This method will be invoked to send a Delete request to Valet.
- */
- public GenericValetResponse<ValetDeleteResponse> callValetDeleteRequest(String requestId, String regionId,
- String ownerId, String tenantId, String vfModuleId, String vfModuleName) throws Exception {
- ResponseEntity<ValetDeleteResponse> response = null;
- GenericValetResponse<ValetDeleteResponse> gvr = null;
-
- try {
- UriBuilder builder = UriBuilder.fromPath(baseUrl).path(basePath).queryParam(REQUEST_ID, requestId);
- URI uri = builder.build();
-
- ValetDeleteRequest vdr =
- this.createValetDeleteRequest(regionId, ownerId, tenantId, vfModuleId, vfModuleName);
-
- String body = mapper.writeValueAsString(vdr);
- HttpHeaders headers = generateHeaders(requestId);
- HttpEntity<String> entity = new HttpEntity<>(body, headers);
-
-
- response = getRestTemplate().exchange(uri, HttpMethod.DELETE, entity, ValetDeleteResponse.class);
- gvr = this.getGVRFromResponse(response);
- } catch (Exception e) {
- logger.error("An exception occurred in callValetDeleteRequest", e);
- throw e;
- }
- return gvr;
- }
-
- /*
- * This method is called to invoke a Confirm request to Valet.
- */
- public GenericValetResponse<ValetConfirmResponse> callValetConfirmRequest(String requestId, String stackId)
- throws Exception {
- ResponseEntity<ValetConfirmResponse> response = null;
- GenericValetResponse<ValetConfirmResponse> gvr = null;
-
- try {
- UriBuilder builder = UriBuilder.fromPath(this.baseUrl).path(this.basePath).path("{requestId}/confirm/");
- URI uri = builder.build(requestId);
-
- ValetConfirmRequest vcr = this.createValetConfirmRequest(stackId);
-
- String body = mapper.writeValueAsString(vcr);
- HttpHeaders headers = generateHeaders(requestId);
- HttpEntity<String> entity = new HttpEntity<>(body, headers);
- logger.debug("valet confirm req: {} {} {} {} {}", uri, HEADERS, headers, BODY, body);
-
- response = getRestTemplate().exchange(uri, HttpMethod.PUT, entity, ValetConfirmResponse.class);
- gvr = this.getGVRFromResponse(response);
- } catch (Exception e) {
- logger.error("An exception occurred in callValetConfirmRequest", e);
- throw e;
- }
- return gvr;
- }
-
- /*
- * This method is called to invoke a Rollback request to Valet.
- */
- public GenericValetResponse<ValetRollbackResponse> callValetRollbackRequest(String requestId, String stackId,
- Boolean suppressRollback, String errorMessage) throws Exception {
- ResponseEntity<ValetRollbackResponse> response = null;
- GenericValetResponse<ValetRollbackResponse> gvr = null;
-
- try {
- UriBuilder builder = UriBuilder.fromPath(this.baseUrl).path(this.basePath).path("{requestId}/rollback/");
- URI uri = builder.build(requestId);
-
- ValetRollbackRequest vrr = this.createValetRollbackRequest(stackId, suppressRollback, errorMessage);
-
- String body = mapper.writeValueAsString(vrr);
- HttpHeaders headers = generateHeaders(requestId);
- HttpEntity<String> entity = new HttpEntity<>(body, headers);
-
-
- response = getRestTemplate().exchange(uri, HttpMethod.PUT, entity, ValetRollbackResponse.class);
- gvr = this.getGVRFromResponse(response);
- } catch (Exception e) {
- logger.error("An exception occurred in callValetRollbackRequest", e);
- throw e;
- }
- return gvr;
- }
-
- /*
- * This method is to construct the ValetCreateRequest pojo
- */
- private ValetCreateRequest createValetCreateRequest(String regionId, String ownerId, String tenantId,
- String serviceInstanceId, String vnfId, String vnfName, String vfModuleId, String vfModuleName,
- String keystoneUrl, HeatRequest heatRequest) {
- ValetCreateRequest vcr = new ValetCreateRequest();
- vcr.setHeatRequest(heatRequest);
- vcr.setKeystoneUrl(keystoneUrl);
- vcr.setRegionId(regionId);
- vcr.setOwnerId(ownerId);
- vcr.setServiceInstanceId(serviceInstanceId);
- vcr.setTenantId(tenantId);
- vcr.setVfModuleId(vfModuleId);
- vcr.setVfModuleName(vfModuleName);
- vcr.setVnfId(vnfId);
- vcr.setVnfName(vnfName);
-
- return vcr;
- }
-
- /*
- * This method is to construct the ValetUpdateRequest pojo
- */
- private ValetUpdateRequest createValetUpdateRequest(String regionId, String ownerId, String tenantId,
- String serviceInstanceId, String vnfId, String vnfName, String vfModuleId, String vfModuleName,
- String keystoneUrl, HeatRequest heatRequest) {
- ValetUpdateRequest vur = new ValetUpdateRequest();
- vur.setHeatRequest(heatRequest);
- vur.setKeystoneUrl(keystoneUrl);
- vur.setRegionId(regionId == null ? "" : regionId);
- vur.setOwnerId(ownerId == null ? "" : ownerId);
- vur.setServiceInstanceId(serviceInstanceId == null ? "" : serviceInstanceId);
- vur.setTenantId(tenantId == null ? "" : tenantId);
- vur.setVfModuleId(vfModuleId == null ? "" : vfModuleId);
- vur.setVfModuleName(vfModuleName == null ? "" : vfModuleName);
- vur.setVnfId(vnfId == null ? "" : vnfId);
- vur.setVnfName(vnfName == null ? "" : vnfName);
-
- return vur;
- }
-
- /*
- * This method is to construct the ValetDeleteRequest pojo
- */
- private ValetDeleteRequest createValetDeleteRequest(String regionId, String ownerId, String tenantId,
- String vfModuleId, String vfModuleName) {
- ValetDeleteRequest vdr = new ValetDeleteRequest();
- vdr.setRegionId(regionId == null ? "" : regionId);
- vdr.setOwnerId(ownerId == null ? "" : ownerId);
- vdr.setTenantId(tenantId == null ? "" : tenantId);
- vdr.setVfModuleId(vfModuleId == null ? "" : vfModuleId);
- vdr.setVfModuleName(vfModuleName == null ? "" : vfModuleName);
-
- return vdr;
- }
-
- /*
- * This method is to construct the ValetDeleteRequest pojo
- */
- private ValetConfirmRequest createValetConfirmRequest(String stackId) {
- ValetConfirmRequest vcr = new ValetConfirmRequest();
- vcr.setStackId(stackId);
-
- return vcr;
- }
-
- /*
- * This method is to construct the ValetRollbackRequest pojo
- */
- private ValetRollbackRequest createValetRollbackRequest(String stackId, Boolean suppressRollback,
- String errorMessage) {
- ValetRollbackRequest vrr = new ValetRollbackRequest();
- vrr.setStackId(stackId);
- vrr.setSuppressRollback(suppressRollback);
- vrr.setErrorMessage(errorMessage);
-
- return vrr;
- }
-
- private HttpHeaders generateHeaders(String requestId) {
- HttpHeaders headers = new HttpHeaders();
- headers.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
- if (!(this.authString == null || this.authString.isEmpty())) {
- headers.add("Authorization", "Basic " + this.authString);
- }
- headers.add(ValetClient.REQ_ID_HEADER_NAME, requestId);
-
- return headers;
- }
-
- private <T> GenericValetResponse<T> getGVRFromResponse(ResponseEntity<T> response) {
- GenericValetResponse<T> gvr = null;
- if (response != null) {
- T responseObj = response.getBody();
- gvr = new GenericValetResponse<>(response.getStatusCodeValue(), ValetClient.NO_STATUS_RETURNED,
- responseObj);
-
- } else {
- gvr = new GenericValetResponse<>(-1, ValetClient.NO_STATUS_RETURNED, null);
- }
- return gvr;
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/HeatRequest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/HeatRequest.java
deleted file mode 100644
index c12c89dbff..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/HeatRequest.java
+++ /dev/null
@@ -1,137 +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.valet.beans;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/*
- * This class represents the heat request as sent to OpenStack as defined in the Valet Placement Operations API
- */
-public class HeatRequest implements Serializable {
- private static final long serialVersionUID = 768026109321305392L;
- @JsonProperty("stack_name")
- private String stackName;
- @JsonProperty("disable_rollback")
- private Boolean disableRollback;
- @JsonProperty("timeout_mins")
- private Integer timeoutMins;
- @JsonProperty("template")
- private String template;
- @JsonProperty("environment")
- private String environment;
- @JsonProperty("files")
- private Map<String, Object> files = new HashMap<>();
- @JsonProperty("parameters")
- private Map<String, Object> parameters = new HashMap<>();
-
- public HeatRequest(String stackName, boolean disableRollback, int timeoutMins, String template, String environment,
- Map<String, Object> files, Map<String, Object> parameters) {
- super();
- this.stackName = stackName;
- this.disableRollback = disableRollback;
- this.timeoutMins = timeoutMins;
- this.template = template;
- this.environment = environment;
- this.files = files;
- this.parameters = parameters;
- }
-
- public String getStackName() {
- return this.stackName;
- }
-
- public void setStackName(String stackName) {
- this.stackName = stackName;
- }
-
- public Boolean getDisableRollback() {
- return this.disableRollback;
- }
-
- public void setDisableRollback(Boolean disableRollback) {
- this.disableRollback = disableRollback;
- }
-
- public Integer getTimeoutMins() {
- return this.timeoutMins;
- }
-
- public void setTimeoutMins(Integer timeoutMins) {
- this.timeoutMins = timeoutMins;
- }
-
- public String getTemplate() {
- return this.template;
- }
-
- public void setTemplate(String template) {
- this.template = template;
- }
-
- public String getEnvironment() {
- return this.environment;
- }
-
- public void setEnvironment(String environment) {
- this.environment = environment;
- }
-
- public Map<String, Object> getFiles() {
- return this.files;
- }
-
- public void setFiles(Map<String, Object> files) {
- this.files = files;
- }
-
- public Map<String, Object> getParameters() {
- return this.parameters;
- }
-
- public void setParameters(Map<String, Object> parameters) {
- this.parameters = parameters;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(stackName, disableRollback, timeoutMins, template, environment, files, parameters);
- }
-
- @Override
- public boolean equals(Object o) {
- if (o == this)
- return true;
- if (!(o instanceof HeatRequest)) {
- return false;
- }
- HeatRequest hr = (HeatRequest) o;
- return Objects.equals(stackName, hr.stackName) && Objects.equals(disableRollback, hr.disableRollback)
- && Objects.equals(timeoutMins, hr.timeoutMins) && Objects.equals(template, hr.template)
- && Objects.equals(environment, hr.environment) && Objects.equals(files, hr.files)
- && Objects.equals(parameters, hr.parameters);
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetConfirmRequest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetConfirmRequest.java
deleted file mode 100644
index 0d6c47b2db..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetConfirmRequest.java
+++ /dev/null
@@ -1,68 +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.valet.beans;
-
-import java.io.Serializable;
-import java.util.Objects;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/*
- * This class represents the body of a Confirm operation on a Valet Placement API call
- */
-public class ValetConfirmRequest implements Serializable {
- private static final long serialVersionUID = 768026109321305392L;
-
- @JsonProperty("stack_id")
- private String stackId;
-
- public ValetConfirmRequest() {
- super();
- }
-
- public ValetConfirmRequest(String stackId) {
- super();
- this.stackId = stackId;
- }
-
- public String getStackId() {
- return this.stackId;
- }
-
- public void setStackId(String stackId) {
- this.stackId = stackId;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(stackId);
- }
-
- @Override
- public boolean equals(Object o) {
- if (o == this)
- return true;
- if (!(o instanceof ValetConfirmRequest)) {
- return false;
- }
- ValetConfirmRequest vcr = (ValetConfirmRequest) o;
- return Objects.equals(stackId, vcr.stackId);
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetConfirmResponse.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetConfirmResponse.java
deleted file mode 100644
index f69b9b7eb8..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetConfirmResponse.java
+++ /dev/null
@@ -1,30 +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.valet.beans;
-
-import java.io.Serializable;
-
-/* This class has no body - placeholder if needed - for the response to a Confirm operation */
-
-public class ValetConfirmResponse implements Serializable {
- private static final long serialVersionUID = 768026109321305392L;
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetCreateRequest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetCreateRequest.java
deleted file mode 100644
index 5aac0a167a..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetCreateRequest.java
+++ /dev/null
@@ -1,158 +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.valet.beans;
-
-import java.io.Serializable;
-import java.util.Objects;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/*
- * This class represents the body of a Create request operation on a Valet Placement API call
- */
-public class ValetCreateRequest implements Serializable {
- private static final long serialVersionUID = 768026109321305392L;
-
- @JsonProperty("region_id")
- private String regionId;
- @JsonProperty("owner_id")
- private String ownerId;
- @JsonProperty("tenant_id")
- private String tenantId;
- @JsonProperty("service_instance_id")
- private String serviceInstanceId;
- @JsonProperty("vnf_id")
- private String vnfId;
- @JsonProperty("vnf_name")
- private String vnfName;
- @JsonProperty("vf_module_id")
- private String vfModuleId;
- @JsonProperty("vf_module_name")
- private String vfModuleName;
- @JsonProperty("keystone_url")
- private String keystoneUrl;
- @JsonProperty("heat_request")
- private HeatRequest heatRequest;
-
- public ValetCreateRequest() {
- super();
- }
-
- public String getRegionId() {
- return this.regionId;
- }
-
- public void setRegionId(String regionId) {
- this.regionId = regionId;
- }
-
- public String getOwnerId() {
- return this.ownerId;
- }
-
- public void setOwnerId(String ownerId) {
- this.ownerId = ownerId;
- }
-
- public String getTenantId() {
- return this.tenantId;
- }
-
- public void setTenantId(String tenantId) {
- this.tenantId = tenantId;
- }
-
- public String getServiceInstanceId() {
- return this.serviceInstanceId;
- }
-
- public void setServiceInstanceId(String serviceInstanceId) {
- this.serviceInstanceId = serviceInstanceId;
- }
-
- public String getVnfId() {
- return this.vnfId;
- }
-
- public void setVnfId(String vnfId) {
- this.vnfId = vnfId;
- }
-
- public String getVnfName() {
- return this.vnfName;
- }
-
- public void setVnfName(String vnfName) {
- this.vnfName = vnfName;
- }
-
- public String getVfModuleId() {
- return this.vfModuleId;
- }
-
- public void setVfModuleId(String vfModuleId) {
- this.vfModuleId = vfModuleId;
- }
-
- public String getVfModuleName() {
- return this.vfModuleName;
- }
-
- public void setVfModuleName(String vfModuleName) {
- this.vfModuleName = vfModuleName;
- }
-
- public String getKeystoneUrl() {
- return this.keystoneUrl;
- }
-
- public void setKeystoneUrl(String keystoneUrl) {
- this.keystoneUrl = keystoneUrl;
- }
-
- public HeatRequest getHeatRequest() {
- return this.heatRequest;
- }
-
- public void setHeatRequest(HeatRequest heatRequest) {
- this.heatRequest = heatRequest;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(regionId, ownerId, tenantId, serviceInstanceId, vnfId, vnfName, vfModuleId, vfModuleName,
- keystoneUrl, heatRequest);
- }
-
- @Override
- public boolean equals(Object o) {
- if (o == this)
- return true;
- if (!(o instanceof ValetCreateRequest)) {
- return false;
- }
- ValetCreateRequest vcr = (ValetCreateRequest) o;
- return Objects.equals(regionId, vcr.regionId) && Objects.equals(ownerId, vcr.ownerId)
- && Objects.equals(tenantId, vcr.tenantId) && Objects.equals(serviceInstanceId, vcr.serviceInstanceId)
- && Objects.equals(vnfId, vcr.vnfId) && Objects.equals(vnfName, vcr.vnfName)
- && Objects.equals(vfModuleId, vcr.vfModuleId) && Objects.equals(vfModuleName, vcr.vfModuleName)
- && Objects.equals(keystoneUrl, vcr.keystoneUrl) && Objects.equals(heatRequest, vcr.heatRequest);
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetCreateResponse.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetCreateResponse.java
deleted file mode 100644
index e09788714a..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetCreateResponse.java
+++ /dev/null
@@ -1,74 +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.valet.beans;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.Map;
-import java.util.Objects;
-import java.io.Serializable;
-
-/*
- * This class represents the body of a Create response on a Valet Placement API call
- */
-public class ValetCreateResponse implements Serializable {
- private static final long serialVersionUID = 768026109321305392L;
-
- @JsonProperty("status")
- private ValetStatus status;
- @JsonProperty("parameters")
- private Map<String, Object> parameters;
-
- public ValetCreateResponse() {
- super();
- }
-
- public ValetStatus getStatus() {
- return this.status;
- }
-
- public void setStatus(ValetStatus status) {
- this.status = status;
- }
-
- public Map<String, Object> getParameters() {
- return this.parameters;
- }
-
- public void setParameters(Map<String, Object> parameters) {
- this.parameters = parameters;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(status, parameters);
- }
-
- @Override
- public boolean equals(Object o) {
- if (o == this)
- return true;
- if (!(o instanceof ValetCreateResponse)) {
- return false;
- }
- ValetCreateResponse vcr = (ValetCreateResponse) o;
- return Objects.equals(status, vcr.status) && Objects.equals(parameters, vcr.parameters);
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetDeleteRequest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetDeleteRequest.java
deleted file mode 100644
index fb6ceb45d8..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetDeleteRequest.java
+++ /dev/null
@@ -1,101 +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.valet.beans;
-
-import java.io.Serializable;
-import java.util.Objects;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/*
- * This class represents the body of a Delete request on a Valet Placement API call
- */
-public class ValetDeleteRequest implements Serializable {
- private static final long serialVersionUID = 768026109321305392L;
-
- @JsonProperty("region_id")
- private String regionId;
- @JsonProperty("owner_id")
- private String ownerId;
- @JsonProperty("tenant_id")
- private String tenantId;
- @JsonProperty("vf_module_id")
- private String vfModuleId;
- @JsonProperty("vf_module_name")
- private String vfModuleName;
-
- public String getRegionId() {
- return this.regionId;
- }
-
- public void setRegionId(String regionId) {
- this.regionId = regionId;
- }
-
- public String getOwnerId() {
- return this.ownerId;
- }
-
- public void setOwnerId(String ownerId) {
- this.ownerId = ownerId;
- }
-
- public String getTenantId() {
- return this.tenantId;
- }
-
- public void setTenantId(String tenantId) {
- this.tenantId = tenantId;
- }
-
- public String getVfModuleId() {
- return this.vfModuleId;
- }
-
- public void setVfModuleId(String vfModuleId) {
- this.vfModuleId = vfModuleId;
- }
-
- public String getVfModuleName() {
- return this.vfModuleName;
- }
-
- public void setVfModuleName(String vfModuleName) {
- this.vfModuleName = vfModuleName;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(regionId, ownerId, tenantId, vfModuleId, vfModuleName);
- }
-
- @Override
- public boolean equals(Object o) {
- if (o == this)
- return true;
- if (!(o instanceof ValetDeleteRequest)) {
- return false;
- }
- ValetDeleteRequest vdr = (ValetDeleteRequest) o;
- return Objects.equals(regionId, vdr.regionId) && Objects.equals(ownerId, vdr.ownerId)
- && Objects.equals(tenantId, vdr.tenantId) && Objects.equals(vfModuleId, vdr.vfModuleId)
- && Objects.equals(vfModuleName, vdr.vfModuleName);
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetDeleteResponse.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetDeleteResponse.java
deleted file mode 100644
index 81cfbc7acb..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetDeleteResponse.java
+++ /dev/null
@@ -1,68 +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.valet.beans;
-
-import java.io.Serializable;
-import java.util.Objects;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/*
- * This class represents the body of a Delete response on a Valet Placement API call
- */
-public class ValetDeleteResponse implements Serializable {
- private static final long serialVersionUID = 768026109321305392L;
- @JsonProperty("status")
- private ValetStatus status;
-
- public ValetDeleteResponse() {
- super();
- }
-
- public ValetDeleteResponse(ValetStatus status) {
- super();
- this.status = status;
- }
-
- public ValetStatus getStatus() {
- return this.status;
- }
-
- public void setStatus(ValetStatus status) {
- this.status = status;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(status);
- }
-
- @Override
- public boolean equals(Object o) {
- if (o == this)
- return true;
- if (!(o instanceof ValetDeleteResponse)) {
- return false;
- }
- ValetDeleteResponse vdr = (ValetDeleteResponse) o;
- return Objects.equals(status, vdr.status);
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetRollbackRequest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetRollbackRequest.java
deleted file mode 100644
index 7ca11af443..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetRollbackRequest.java
+++ /dev/null
@@ -1,85 +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.valet.beans;
-
-import java.io.Serializable;
-import java.util.Objects;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/*
- * This class represents the body of a Rollback request on a Valet Placement API call
- */
-public class ValetRollbackRequest implements Serializable {
- private static final long serialVersionUID = 768026109321305392L;
-
- @JsonProperty("stack_id")
- private String stackId;
- @JsonProperty("suppress_rollback")
- private Boolean suppressRollback = false;
- @JsonProperty("error_message")
- private String errorMessage;
-
- public ValetRollbackRequest() {
- super();
- }
-
- public String getStackId() {
- return this.stackId;
- }
-
- public void setStackId(String stackId) {
- this.stackId = stackId;
- }
-
- public Boolean getSuppressRollback() {
- return this.suppressRollback;
- }
-
- public void setSuppressRollback(Boolean suppressRollback) {
- this.suppressRollback = suppressRollback;
- }
-
- public String getErrorMessage() {
- return this.errorMessage;
- }
-
- public void setErrorMessage(String errorMessage) {
- this.errorMessage = errorMessage;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(stackId, suppressRollback, errorMessage);
- }
-
- @Override
- public boolean equals(Object o) {
- if (o == this)
- return true;
- if (!(o instanceof ValetRollbackRequest)) {
- return false;
- }
- ValetRollbackRequest vrr = (ValetRollbackRequest) o;
- return Objects.equals(stackId, vrr.stackId) && Objects.equals(suppressRollback, vrr.suppressRollback)
- && Objects.equals(errorMessage, vrr.errorMessage);
- }
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetRollbackResponse.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetRollbackResponse.java
deleted file mode 100644
index d9d29c0935..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetRollbackResponse.java
+++ /dev/null
@@ -1,29 +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.valet.beans;
-
-import java.io.Serializable;
-/* This class has no body - placeholder - body of a Rollback response on a Valet Placement Operation */
-
-public class ValetRollbackResponse implements Serializable {
- private static final long serialVersionUID = 768026109321305392L;
-
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetStatus.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetStatus.java
deleted file mode 100644
index 3b8528cd72..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetStatus.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 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.valet.beans;
-
-import java.io.Serializable;
-import java.util.Objects;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-/*
- * This class represents the status object as defined in the Valet Placement Operations API - part of Response objects
- */
-public class ValetStatus implements Serializable {
- private static final long serialVersionUID = 1L;
- @JsonProperty("status")
- private String status;
- @JsonProperty("message")
- private String message;
-
-
- public ValetStatus() {
- super();
- }
-
- public ValetStatus(String statusCode, String statusMessage) {
- super();
- this.status = statusCode;
- this.message = statusMessage;
- }
-
-
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("status", status).append("message", message).toString();
- }
-
- public String getStatus() {
- return this.status;
- }
-
- public void setStatus(String statusCode) {
- this.status = statusCode;
- }
-
- public String getMessage() {
- return this.message;
- }
-
- public void setMessage(String statusMessage) {
- this.message = statusMessage;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(status, message);
- }
-
- @Override
- public boolean equals(Object o) {
- if (o == this)
- return true;
- if (!(o instanceof ValetStatus)) {
- return false;
- }
- ValetStatus vs = (ValetStatus) o;
- return Objects.equals(status, vs.status) && Objects.equals(message, vs.message);
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetUpdateRequest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetUpdateRequest.java
deleted file mode 100644
index ff27d88a1f..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetUpdateRequest.java
+++ /dev/null
@@ -1,159 +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.valet.beans;
-
-import java.io.Serializable;
-import java.util.Objects;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/*
- * This class represents the body of an Update request on a Valet Placement API call
- */
-public class ValetUpdateRequest implements Serializable {
- private static final long serialVersionUID = 768026109321305392L;
-
- @JsonProperty("region_id")
- private String regionId;
- @JsonProperty("owner)_id")
- private String ownerId;
- @JsonProperty("tenant_id")
- private String tenantId;
- @JsonProperty("service_instance_id")
- private String serviceInstanceId;
- @JsonProperty("vnf_id")
- private String vnfId;
- @JsonProperty("vnf_name")
- private String vnfName;
- @JsonProperty("vf_module_id")
- private String vfModuleId;
- @JsonProperty("vf_module_name")
- private String vfModuleName;
- @JsonProperty("keystone_url")
- private String keystoneUrl;
- @JsonProperty("heat_request")
- private HeatRequest heatRequest;
-
- public ValetUpdateRequest() {
- super();
- }
-
- public String getRegionId() {
- return this.regionId;
- }
-
- public void setRegionId(String regionId) {
- this.regionId = regionId;
- }
-
- public String getOwnerId() {
- return this.ownerId;
- }
-
- public void setOwnerId(String ownerId) {
- this.ownerId = ownerId;
- }
-
- public String getTenantId() {
- return this.tenantId;
- }
-
- public void setTenantId(String tenantId) {
- this.tenantId = tenantId;
- }
-
- public String getServiceInstanceId() {
- return this.serviceInstanceId;
- }
-
- public void setServiceInstanceId(String serviceInstanceId) {
- this.serviceInstanceId = serviceInstanceId;
- }
-
- public String getVnfId() {
- return this.vnfId;
- }
-
- public void setVnfId(String vnfId) {
- this.vnfId = vnfId;
- }
-
- public String getVnfName() {
- return this.vnfName;
- }
-
- public void setVnfName(String vnfName) {
- this.vnfName = vnfName;
- }
-
- public String getVfModuleId() {
- return this.vfModuleId;
- }
-
- public void setVfModuleId(String vfModuleId) {
- this.vfModuleId = vfModuleId;
- }
-
- public String getVfModuleName() {
- return this.vfModuleName;
- }
-
- public void setVfModuleName(String vfModuleName) {
- this.vfModuleName = vfModuleName;
- }
-
- public String getKeystoneUrl() {
- return this.keystoneUrl;
- }
-
- public void setKeystoneUrl(String keystoneUrl) {
- this.keystoneUrl = keystoneUrl;
- }
-
- public HeatRequest getHeatRequest() {
- return this.heatRequest;
- }
-
- public void setHeatRequest(HeatRequest heatRequest) {
- this.heatRequest = heatRequest;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(regionId, ownerId, tenantId, serviceInstanceId, vnfId, vnfName, vfModuleId, vfModuleName,
- keystoneUrl, heatRequest);
-
- }
-
- @Override
- public boolean equals(Object o) {
- if (o == this)
- return true;
- if (!(o instanceof ValetUpdateRequest)) {
- return false;
- }
- ValetUpdateRequest vur = (ValetUpdateRequest) o;
- return Objects.equals(regionId, vur.regionId) && Objects.equals(ownerId, vur.ownerId)
- && Objects.equals(tenantId, vur.tenantId) && Objects.equals(serviceInstanceId, vur.serviceInstanceId)
- && Objects.equals(vnfId, vur.vnfId) && Objects.equals(vnfName, vur.vnfName)
- && Objects.equals(vfModuleId, vur.vfModuleId) && Objects.equals(vfModuleName, vur.vfModuleName)
- && Objects.equals(keystoneUrl, vur.keystoneUrl) && Objects.equals(heatRequest, vur.heatRequest);
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetUpdateResponse.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetUpdateResponse.java
deleted file mode 100644
index 10b6d2a09e..0000000000
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetUpdateResponse.java
+++ /dev/null
@@ -1,73 +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.valet.beans;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Objects;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/*
- * This class represents the body of an Update response on a Valet Placement API call
- */
-public class ValetUpdateResponse implements Serializable {
- private static final long serialVersionUID = 768026109321305392L;
- @JsonProperty("status")
- private ValetStatus status;
- @JsonProperty("parameters")
- private HashMap<String, Object> parameters;
-
- public ValetUpdateResponse() {
- super();
- }
-
- public ValetStatus getStatus() {
- return this.status;
- }
-
- public void setStatus(ValetStatus status) {
- this.status = status;
- }
-
- public HashMap<String, Object> getParameters() {
- return this.parameters;
- }
-
- public void setParameters(HashMap<String, Object> parameters) {
- this.parameters = parameters;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(status, parameters);
- }
-
- @Override
- public boolean equals(Object o) {
- if (o == this)
- return true;
- if (!(o instanceof ValetUpdateResponse)) {
- return false;
- }
- ValetUpdateResponse vur = (ValetUpdateResponse) o;
- return Objects.equals(status, vur.status) && Objects.equals(parameters, vur.parameters);
- }
-}
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 4b908004df..65d5523709 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
@@ -33,15 +33,6 @@ import java.util.Optional;
import javax.jws.WebService;
import javax.xml.ws.Holder;
import org.apache.commons.collections.CollectionUtils;
-import org.onap.so.adapters.valet.GenericValetResponse;
-import org.onap.so.adapters.valet.ValetClient;
-import org.onap.so.adapters.valet.beans.HeatRequest;
-import org.onap.so.adapters.valet.beans.ValetConfirmResponse;
-import org.onap.so.adapters.valet.beans.ValetCreateResponse;
-import org.onap.so.adapters.valet.beans.ValetDeleteResponse;
-import org.onap.so.adapters.valet.beans.ValetRollbackResponse;
-import org.onap.so.adapters.valet.beans.ValetStatus;
-import org.onap.so.adapters.valet.beans.ValetUpdateResponse;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnf.exceptions.VnfNotFound;
import org.onap.so.client.aai.AAIResourcesClient;
@@ -59,8 +50,8 @@ import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository;
import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
import org.onap.so.db.catalog.utils.MavenLikeVersioning;
import org.onap.so.entity.MsoRequest;
-import org.onap.so.heatbridge.HeatBridgeException;
import org.onap.so.heatbridge.HeatBridgeApi;
+import org.onap.so.heatbridge.HeatBridgeException;
import org.onap.so.heatbridge.HeatBridgeImpl;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.LoggingAnchor;
@@ -109,9 +100,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters";
private static final String ADD_GET_FILES_ON_VOLUME_REQ = "org.onap.so.adapters.vnf.addGetFilesOnVolumeReq";
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
- private static final String VALET_ENABLED = "org.onap.so.adapters.vnf.valet_enabled";
- private static final String FAIL_REQUESTS_ON_VALET_FAILURE =
- "org.onap.so.adapters.vnf.fail_requests_on_valet_failure";
private static final String OPENSTACK = "OpenStack";
private static final String DELETE_VNF = "DeleteVNF";
private static final String QUERY_STACK = "QueryStack";
@@ -130,8 +118,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
private MsoHeatUtilsWithUpdate heatU;
@Autowired
private MsoHeatUtils msoHeatUtils;
- @Autowired
- private ValetClient vci;
/**
* DO NOT use that constructor to instantiate this class, the msoPropertiesfactory will be NULL.
@@ -1044,26 +1030,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
String template = heatTemplate.getHeatTemplate();
template = template.replaceAll("\r\n", "\n");
- // Valet - 1806
- boolean isValetEnabled = this.checkBooleanProperty(MsoVnfAdapterImpl.VALET_ENABLED, false);
- boolean failRequestOnValetFailure =
- this.checkBooleanProperty(MsoVnfAdapterImpl.FAIL_REQUESTS_ON_VALET_FAILURE, false);
- logger.debug("isValetEnabled={}, failRequestsOnValetFailure={}", isValetEnabled, failRequestOnValetFailure);
- if (oldWay || isVolumeRequest) {
- isValetEnabled = false;
- logger.debug("do not send to valet for volume requests or brocade");
- }
- boolean sendResponseToValet = false;
- if (isValetEnabled) {
- Holder<Map<String, Object>> valetModifiedParamsHolder = new Holder<>();
- sendResponseToValet = this.valetCreateRequest(cloudSiteId, cloudOwner, tenantId, heatFilesObjects,
- nestedTemplatesChecked, vfModuleName, backout, heatTemplate, newEnvironmentString, goldenInputs,
- msoRequest, inputs, failRequestOnValetFailure, valetModifiedParamsHolder);
- if (sendResponseToValet) {
- goldenInputs = valetModifiedParamsHolder.value;
- }
- }
-
// Have the tenant. Now deploy the stack itself
// Ignore MsoTenantNotFound and MsoStackAlreadyExists exceptions
// because we already checked for those.
@@ -1086,17 +1052,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
} catch (MsoException me) {
me.addContext(CREATE_VFM_MODULE);
logger.error("Error creating Stack", me);
- if (isValetEnabled && sendResponseToValet) {
- logger.debug("valet is enabled, the orchestration failed - now sending rollback to valet");
- try {
- GenericValetResponse<ValetRollbackResponse> gvr = this.vci
- .callValetRollbackRequest(msoRequest.getRequestId(), null, backout, me.getMessage());
- // Nothing to really do here whether it succeeded or not other than log it.
- logger.debug("Return code from Rollback response is {}", gvr.getStatusCode());
- } catch (Exception e) {
- logger.error("Exception encountered while sending Rollback to Valet ", e);
- }
- }
throw new VnfException(me);
} catch (NullPointerException npe) {
logger.error("Error creating Stack", npe);
@@ -1113,17 +1068,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
vnfId.value = heatStack.getCanonicalName();
outputs.value = copyStringOutputs(heatStack.getOutputs());
rollback.value = vfRollback;
- if (isValetEnabled && sendResponseToValet) {
- logger.debug("valet is enabled, the orchestration succeeded - now send confirm to valet with stack id");
- try {
- GenericValetResponse<ValetConfirmResponse> gvr =
- this.vci.callValetConfirmRequest(msoRequest.getRequestId(), heatStack.getCanonicalName());
- // Nothing to really do here whether it succeeded or not other than log it.
- logger.debug("Return code from Confirm response is {}", gvr.getStatusCode());
- } catch (Exception e) {
- logger.error("Exception encountered while sending Confirm to Valet ", e);
- }
- }
logger.debug("VF Module {} successfully created", vfModuleName);
if (enableBridge != null && enableBridge) {
// call heatbridge
@@ -1156,17 +1100,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// call method which handles the conversion from Map<String,Object> to Map<String,String> for our expected
// Object types
outputs.value = this.convertMapStringObjectToStringString(stackOutputs);
-
- boolean isValetEnabled = this.checkBooleanProperty(MsoVnfAdapterImpl.VALET_ENABLED, false);
- boolean failRequestOnValetFailure =
- this.checkBooleanProperty(MsoVnfAdapterImpl.FAIL_REQUESTS_ON_VALET_FAILURE, false);
- logger.debug("isValetEnabled={}, failRequestsOnValetFailure={}", isValetEnabled, failRequestOnValetFailure);
- boolean valetDeleteRequestSucceeded = false;
- if (isValetEnabled) {
- valetDeleteRequestSucceeded = this.valetDeleteRequest(cloudSiteId, cloudOwner, tenantId, vnfName,
- msoRequest, failRequestOnValetFailure);
- }
-
int timeoutMinutes = 118;
VfModule vf = null;
VfModuleCustomization vfmc = null;
@@ -1201,32 +1134,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
"Delete VF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
logger.error(LoggingAnchor.NINE, MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId,
tenantId, OPENSTACK, "DeleteStack", ErrorCode.DataError.getValue(), "Exception - deleteStack", me);
- logger.debug(error);
- if (isValetEnabled && valetDeleteRequestSucceeded) {
- logger.debug("valet is enabled, the orchestration failed - now sending rollback to valet");
- try {
- GenericValetResponse<ValetRollbackResponse> gvr = this.vci
- .callValetRollbackRequest(msoRequest.getRequestId(), vnfName, false, me.getMessage());
- // Nothing to really do here whether it succeeded or not other than log it.
- logger.debug("Return code from Rollback response is {}", gvr.getStatusCode());
- } catch (Exception e) {
- logger.error("Exception encountered while sending Rollback to Valet ", e);
- }
- }
+ logger.error(error);
throw new VnfException(me);
}
- if (isValetEnabled && valetDeleteRequestSucceeded) {
- // only if the original request succeeded do we send a confirm
- logger.debug("valet is enabled, the delete succeeded - now send confirm to valet");
- try {
- GenericValetResponse<ValetConfirmResponse> gvr =
- this.vci.callValetConfirmRequest(msoRequest.getRequestId(), vnfName);
- // Nothing to really do here whether it succeeded or not other than log it.
- logger.debug("Return code from Confirm response is {}", gvr.getStatusCode());
- } catch (Exception e) {
- logger.error("Exception encountered while sending Confirm to Valet ", e);
- }
- }
// call heatbridge delete
try {
new HeatBridgeImpl().deleteVfModuleData(vnfId, vfModuleId);
@@ -1812,30 +1722,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
String template = heatTemplate.getHeatTemplate();
template = template.replaceAll("\r\n", "\n");
- boolean isValetEnabled = this.checkBooleanProperty(MsoVnfAdapterImpl.VALET_ENABLED, false);
- boolean failRequestOnValetFailure =
- this.checkBooleanProperty(MsoVnfAdapterImpl.FAIL_REQUESTS_ON_VALET_FAILURE, false);
- logger.debug("isValetEnabled={}, failRequestsOnValetFailure={}", isValetEnabled, failRequestOnValetFailure);
- if (isVolumeRequest) {
- isValetEnabled = false;
- logger.debug("never send a volume request to valet");
- }
- boolean sendResponseToValet = false;
- if (isValetEnabled) {
- Holder<Map<String, Object>> valetModifiedParamsHolder = new Holder<>();
- String parsedVfModuleName = this.getVfModuleNameFromModuleStackId(vfModuleStackId);
- // Make sure it is set to something.
- if (parsedVfModuleName == null || parsedVfModuleName.isEmpty()) {
- parsedVfModuleName = "unknown";
- }
- sendResponseToValet = this.valetUpdateRequest(cloudSiteId, cloudOwner, tenantId, heatFilesObjects,
- nestedTemplatesChecked, parsedVfModuleName, false, heatTemplate, newEnvironmentString, goldenInputs,
- msoRequest, inputs, failRequestOnValetFailure, valetModifiedParamsHolder);
- if (sendResponseToValet) {
- goldenInputs = valetModifiedParamsHolder.value;
- }
- }
-
// Have the tenant. Now deploy the stack itself
// Ignore MsoTenantNotFound and MsoStackAlreadyExists exceptions
// because we already checked for those.
@@ -1850,38 +1736,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
+ ": " + me;
logger.error(LoggingAnchor.EIGHT, MessageEnum.RA_UPDATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
cloudSiteId, tenantId, OPENSTACK, ErrorCode.DataError.getValue(), "Exception - " + error, me);
- if (isValetEnabled && sendResponseToValet) {
- logger.debug("valet is enabled, the orchestration failed - now sending rollback to valet");
- try {
- GenericValetResponse<ValetRollbackResponse> gvr =
- this.vci.callValetRollbackRequest(msoRequest.getRequestId(), null, false, me.getMessage());
- // Nothing to really do here whether it succeeded or not other than log it.
- logger.debug("Return code from Rollback response is {}", gvr.getStatusCode());
- } catch (Exception e) {
- logger.error("Exception encountered while sending Rollback to Valet ", e);
- }
- }
throw new VnfException(me);
}
-
// Reach this point if updateStack is successful.
// Populate remaining rollback info and response parameters.
vfRollback.setVnfId(heatStack.getCanonicalName());
vfRollback.setVnfCreated(true);
-
- if (isValetEnabled && sendResponseToValet) {
- logger.debug("valet is enabled, the update succeeded - now send confirm to valet with stack id");
- try {
- GenericValetResponse<ValetConfirmResponse> gvr =
- this.vci.callValetConfirmRequest(msoRequest.getRequestId(), heatStack.getCanonicalName());
- // Nothing to really do here whether it succeeded or not other than log it.
- logger.debug("Return code from Confirm response is {}", gvr.getStatusCode());
- } catch (Exception e) {
- logger.error("Exception encountered while sending Confirm to Valet ", e);
- }
- }
-
outputs.value = copyStringOutputs(heatStack.getOutputs());
rollback.value = vfRollback;
}
@@ -1956,177 +1817,4 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
return files;
}
-
- /*
- * Valet Create request
- */
- private boolean valetCreateRequest(String cloudSiteId, String cloudOwner, String tenantId,
- Map<String, Object> heatFilesObjects, Map<String, Object> nestedTemplatesChecked, String vfModuleName,
- boolean backout, HeatTemplate heatTemplate, String newEnvironmentString, Map<String, Object> goldenInputs,
- MsoRequest msoRequest, Map<String, Object> inputs, boolean failRequestOnValetFailure,
- Holder<Map<String, Object>> valetModifiedParamsHolder) throws VnfException {
- boolean valetSucceeded = false;
- String valetErrorMessage = "more detail not available";
- try {
- String keystoneUrl = msoHeatUtils.getCloudSiteKeystoneUrl(cloudSiteId);
- Map<String, Object> files =
- this.combineGetFilesAndNestedTemplates(heatFilesObjects, nestedTemplatesChecked);
- HeatRequest heatRequest = new HeatRequest(vfModuleName, backout, heatTemplate.getTimeoutMinutes(),
- heatTemplate.getTemplateBody(), newEnvironmentString, files, goldenInputs);
- GenericValetResponse<ValetCreateResponse> createReq = this.vci.callValetCreateRequest(
- msoRequest.getRequestId(), cloudSiteId, cloudOwner, tenantId, msoRequest.getServiceInstanceId(),
- (String) inputs.get("vnf_id"), (String) inputs.get("vnf_name"), (String) inputs.get("vf_module_id"),
- (String) inputs.get("vf_module_name"), keystoneUrl, heatRequest);
- ValetCreateResponse vcr = createReq.getReturnObject();
- if (vcr != null && createReq.getStatusCode() == 200) {
- ValetStatus status = vcr.getStatus();
- if (status != null) {
- String statusCode = status.getStatus(); // "ok" or "failed"
- if ("ok".equalsIgnoreCase(statusCode)) {
- Map<String, Object> newInputs = vcr.getParameters();
- if (newInputs != null) {
- Map<String, Object> oldGold = goldenInputs;
- logger.debug("parameters before being modified by valet:{}", oldGold.toString());
- goldenInputs = new HashMap<>();
- for (String key : newInputs.keySet()) {
- goldenInputs.put(key, newInputs.get(key));
- }
- valetModifiedParamsHolder.value = goldenInputs;
- logger.debug("parameters after being modified by valet:{}", goldenInputs.toString());
- valetSucceeded = true;
- }
- } else {
- valetErrorMessage = status.getMessage();
- }
- }
- } else {
- logger.debug("Got a bad response back from valet");
- valetErrorMessage = "Bad response back from Valet";
- valetSucceeded = false;
- }
- } catch (Exception e) {
- logger.error("An exception occurred trying to call valet ...", e);
- valetSucceeded = false;
- valetErrorMessage = e.getMessage();
- }
- if (failRequestOnValetFailure && !valetSucceeded) {
- // The valet request failed - and property says to fail the request
- // TODO Create a new exception class for valet?
- throw new VnfException("A failure occurred with Valet: " + valetErrorMessage);
- }
- return valetSucceeded;
- }
-
- /*
- * Valet update request
- */
-
- private boolean valetUpdateRequest(String cloudSiteId, String cloudOwnerId, String tenantId,
- Map<String, Object> heatFilesObjects, Map<String, Object> nestedTemplatesChecked, String vfModuleName,
- boolean backout, HeatTemplate heatTemplate, String newEnvironmentString, Map<String, Object> goldenInputs,
- MsoRequest msoRequest, Map<String, Object> inputs, boolean failRequestOnValetFailure,
- Holder<Map<String, Object>> valetModifiedParamsHolder) throws VnfException {
-
- boolean valetSucceeded = false;
- String valetErrorMessage = "more detail not available";
- try {
- String keystoneUrl = msoHeatUtils.getCloudSiteKeystoneUrl(cloudSiteId);
- Map<String, Object> files =
- this.combineGetFilesAndNestedTemplates(heatFilesObjects, nestedTemplatesChecked);
- HeatRequest heatRequest = new HeatRequest(vfModuleName, false, heatTemplate.getTimeoutMinutes(),
- heatTemplate.getTemplateBody(), newEnvironmentString, files, goldenInputs);
- // vnf name is not sent to MSO on update requests - so we will set it to the vf module name for now
- GenericValetResponse<ValetUpdateResponse> updateReq =
- this.vci.callValetUpdateRequest(msoRequest.getRequestId(), cloudSiteId, cloudOwnerId, tenantId,
- msoRequest.getServiceInstanceId(), (String) inputs.get("vnf_id"), vfModuleName,
- (String) inputs.get("vf_module_id"), vfModuleName, keystoneUrl, heatRequest);
- ValetUpdateResponse vur = updateReq.getReturnObject();
- if (vur != null && updateReq.getStatusCode() == 200) {
- ValetStatus status = vur.getStatus();
- if (status != null) {
- String statusCode = status.getStatus(); // "ok" or "failed"
- if ("ok".equalsIgnoreCase(statusCode)) {
- Map<String, Object> newInputs = vur.getParameters();
- if (newInputs != null) {
- Map<String, Object> oldGold = goldenInputs;
- logger.debug("parameters before being modified by valet:{}", oldGold);
- goldenInputs = new HashMap<>();
- for (String key : newInputs.keySet()) {
- goldenInputs.put(key, newInputs.get(key));
- }
- valetModifiedParamsHolder.value = goldenInputs;
- logger.debug("parameters after being modified by valet:{}", goldenInputs);
- valetSucceeded = true;
- }
- } else {
- valetErrorMessage = status.getMessage();
- }
- }
- } else {
- logger.debug("Got a bad response back from valet");
- valetErrorMessage = "Got a bad response back from valet";
- valetSucceeded = false;
- }
- } catch (Exception e) {
- logger.error("An exception occurred trying to call valet - will continue processing for now...", e);
- valetErrorMessage = e.getMessage();
- valetSucceeded = false;
- }
- if (failRequestOnValetFailure && !valetSucceeded) {
- // The valet request failed - and property says to fail the request
- // TODO Create a new exception class for valet?
- throw new VnfException("A failure occurred with Valet: " + valetErrorMessage);
- }
- return valetSucceeded;
- }
-
- /*
- * Valet delete request
- */
- private boolean valetDeleteRequest(String cloudSiteId, String cloudOwnerId, String tenantId, String vnfName,
- MsoRequest msoRequest, boolean failRequestOnValetFailure) {
- boolean valetDeleteRequestSucceeded = false;
- String valetErrorMessage = "more detail not available";
- try {
- String vfModuleId = vnfName;
- String vfModuleName = vnfName;
- try {
- vfModuleName = vnfName.substring(0, vnfName.indexOf('/'));
- vfModuleId = vnfName.substring(vnfName.indexOf('/') + 1);
- } catch (Exception e) {
- // do nothing - send what we got for vnfName for both to valet
- logger.error("An exception occurred trying to call MsoVnfAdapterImpl.valetDeleteRequest() method", e);
- }
- GenericValetResponse<ValetDeleteResponse> deleteReq = this.vci.callValetDeleteRequest(
- msoRequest.getRequestId(), cloudSiteId, cloudOwnerId, tenantId, vfModuleId, vfModuleName);
- ValetDeleteResponse vdr = deleteReq.getReturnObject();
- if (vdr != null && deleteReq.getStatusCode() == 200) {
- ValetStatus status = vdr.getStatus();
- if (status != null) {
- String statusCode = status.getStatus(); // "ok" or "failed"
- if ("ok".equalsIgnoreCase(statusCode)) {
- logger.debug("delete request to valet returned success");
- valetDeleteRequestSucceeded = true;
- } else {
- logger.debug("delete request to valet returned failure");
- valetDeleteRequestSucceeded = false;
- valetErrorMessage = status.getMessage();
- }
- }
- } else {
- logger.debug("Got a bad response back from valet - delete request failed");
- valetDeleteRequestSucceeded = false;
- valetErrorMessage = "Got a bad response back from valet - delete request failed";
- }
- } catch (Exception e) {
- logger.error("An exception occurred trying to call valet - valetDeleteRequest failed", e);
- valetDeleteRequestSucceeded = false;
- valetErrorMessage = e.getMessage();
- }
- if (!valetDeleteRequestSucceeded && failRequestOnValetFailure) {
- logger.error("ValetDeleteRequestFailed - del req still will be sent to openstack",
- new VnfException("ValetDeleteRequestFailedError"));
- }
- return valetDeleteRequestSucceeded;
- }
}
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 ea9512bfa7..5bafe2b1d6 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
@@ -20,6 +20,9 @@
package org.onap.so;
+import org.junit.Test;
+import org.onap.so.openpojo.rules.ToStringTester;
+import org.springframework.stereotype.Component;
import com.openpojo.reflection.PojoClass;
import com.openpojo.reflection.PojoClassFilter;
import com.openpojo.reflection.filters.FilterEnum;
@@ -27,11 +30,11 @@ import com.openpojo.reflection.filters.FilterNonConcrete;
import com.openpojo.reflection.filters.FilterPackageInfo;
import com.openpojo.validation.Validator;
import com.openpojo.validation.ValidatorBuilder;
-import com.openpojo.validation.rule.impl.*;
-import com.openpojo.validation.test.impl.*;
-import org.junit.Test;
-import org.onap.so.openpojo.rules.ToStringTester;
-import org.springframework.stereotype.Component;
+import com.openpojo.validation.rule.impl.NoPublicFieldsExceptStaticFinalRule;
+import com.openpojo.validation.rule.impl.NoStaticExceptFinalRule;
+import com.openpojo.validation.rule.impl.SerializableMustHaveSerialVersionUIDRule;
+import com.openpojo.validation.test.impl.GetterTester;
+import com.openpojo.validation.test.impl.SetterTester;
public class BeansTest {
@@ -50,8 +53,6 @@ public class BeansTest {
test("org.onap.so.adapters.vnf.async.client");
test("org.onap.so.adapters.network");
test("org.onap.so.adapters.vnf");
- test("org.onap.so.adapters.valet");
- test("org.onap.so.adapters.valet.beans");
test("org.onap.so.vdu.utils");
}
@@ -68,18 +69,21 @@ public class BeansTest {
}
private static class FilterTestClasses implements PojoClassFilter {
+ @Override
public boolean include(PojoClass pojoClass) {
return !pojoClass.getSourcePath().contains("/test-classes/");
}
}
private static class FilterTestNestedClasses implements PojoClassFilter {
+ @Override
public boolean include(PojoClass pojoClass) {
return !pojoClass.isNestedClass();
}
}
private static class FilterBeans implements PojoClassFilter {
+ @Override
public boolean include(PojoClass pojoClass) {
return pojoClass.getAnnotations().stream().filter(o -> o instanceof Component).count() <= 0;
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java
deleted file mode 100644
index 61d2d08590..0000000000
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 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.valet;
-
-import static com.shazam.shazamcrest.MatcherAssert.assertThat;
-import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockValetConfirmPutRequest_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockValetCreatePostResponse_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockValetCreatePutResponse_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockValetDeleteDeleteResponse_200;
-import static org.onap.so.bpmn.mock.StubOpenStack.mockValetRollbackPutRequest_200;
-import java.io.File;
-import org.apache.http.HttpStatus;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.so.adapters.valet.beans.ValetConfirmResponse;
-import org.onap.so.adapters.valet.beans.ValetCreateResponse;
-import org.onap.so.adapters.valet.beans.ValetDeleteResponse;
-import org.onap.so.adapters.valet.beans.ValetRollbackResponse;
-import org.onap.so.adapters.valet.beans.ValetUpdateResponse;
-import org.onap.so.adapters.vnf.BaseRestTestUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class ValetClientTest extends BaseRestTestUtils {
- @Autowired
- protected ValetClient client;
-
- private ObjectMapper mapper = new ObjectMapper();
-
- @Before
- public void init() {
- client.baseUrl = "http://localhost:" + wireMockPort;
- }
-
- @Test
- public void testCallValetCreateRequest() throws Exception {
- ValetCreateResponse vcr = mapper.readValue(new File("src/test/resources/__files/ValetCreateRequest.json"),
- ValetCreateResponse.class);
- GenericValetResponse<ValetCreateResponse> expected =
- new GenericValetResponse<ValetCreateResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vcr);
-
- mockValetCreatePostResponse_200(wireMockServer, "requestId", mapper.writeValueAsString(vcr));
-
- GenericValetResponse<ValetCreateResponse> actual =
- client.callValetCreateRequest("requestId", "regionId", "ownerId", "tenantId", "serviceInstanceId",
- "vnfId", "vnfName", "vfModuleId", "vfModuleName", "keystoneUrl", null);
-
- assertThat(actual, sameBeanAs(expected));
- }
-
- @Test
- public void testCallValetUpdateRequest() throws Exception {
- ValetUpdateResponse vur = mapper.readValue(new File("src/test/resources/__files/ValetCreateRequest.json"),
- ValetUpdateResponse.class);
- GenericValetResponse<ValetUpdateResponse> expected =
- new GenericValetResponse<ValetUpdateResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vur);
-
- mockValetCreatePutResponse_200(wireMockServer, "requestId", mapper.writeValueAsString(vur));
-
- GenericValetResponse<ValetUpdateResponse> actual =
- client.callValetUpdateRequest("requestId", "regionId", "ownerId", "tenantId", "serviceInstanceId",
- "vnfId", "vnfName", "vfModuleId", "vfModuleName", "keystoneUrl", null);
-
- assertThat(actual, sameBeanAs(expected));
- }
-
- @Test
- public void testCallValetDeleteRequest() throws Exception {
- ValetDeleteResponse vdr = mapper.readValue(new File("src/test/resources/__files/ValetDeleteRequest.json"),
- ValetDeleteResponse.class);
- GenericValetResponse<ValetDeleteResponse> expected =
- new GenericValetResponse<ValetDeleteResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vdr);
-
- mockValetDeleteDeleteResponse_200(wireMockServer, "requestId", mapper.writeValueAsString(vdr));
-
- GenericValetResponse<ValetDeleteResponse> actual = client.callValetDeleteRequest("requestId", "regionId",
- "ownerId", "tenantId", "vfModuleId", "vfModuleName");
-
- assertThat(actual, sameBeanAs(expected));
- }
-
- @Test
- public void testCallValetConfirmRequest() throws Exception {
- ValetConfirmResponse vcr = new ValetConfirmResponse();
- GenericValetResponse<ValetConfirmResponse> expected =
- new GenericValetResponse<ValetConfirmResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vcr);
-
- mockValetConfirmPutRequest_200(wireMockServer, "requestId", "{}");
-
- GenericValetResponse<ValetConfirmResponse> actual = client.callValetConfirmRequest("requestId", "stackId");
-
- assertThat(actual, sameBeanAs(expected));
- }
-
- @Test
- public void testCallValetRollbackRequest() throws Exception {
- ValetRollbackResponse vrr = new ValetRollbackResponse();
- GenericValetResponse<ValetRollbackResponse> expected =
- new GenericValetResponse<ValetRollbackResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vrr);
-
- mockValetRollbackPutRequest_200(wireMockServer, "requestId", "{}");
-
- GenericValetResponse<ValetRollbackResponse> actual =
- client.callValetRollbackRequest("requestId", "stackId", true, "error");
-
- assertThat(actual, sameBeanAs(expected));
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java
index bb00700b60..73bac86b74 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java
@@ -454,35 +454,6 @@ public class StubOpenStack {
.withStatus(HttpStatus.SC_OK)));
}
- public static void mockValetCreatePostResponse_200(WireMockServer wireMockServer, String requestId, String body) {
- wireMockServer
- .stubFor(post(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId)).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody(body).withStatus(HttpStatus.SC_OK)));
- }
-
- public static void mockValetCreatePutResponse_200(WireMockServer wireMockServer, String requestId, String body) {
- wireMockServer.stubFor(put(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId)).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody(body).withStatus(HttpStatus.SC_OK)));
- }
-
- public static void mockValetDeleteDeleteResponse_200(WireMockServer wireMockServer, String requestId, String body) {
- wireMockServer
- .stubFor(delete(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId)).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody(body).withStatus(HttpStatus.SC_OK)));
- }
-
- public static void mockValetConfirmPutRequest_200(WireMockServer wireMockServer, String requestId, String body) {
- wireMockServer.stubFor(
- put(urlPathEqualTo("/api/valet/placement/v1/" + requestId + "/confirm/")).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody(body).withStatus(HttpStatus.SC_OK)));
- }
-
- public static void mockValetRollbackPutRequest_200(WireMockServer wireMockServer, String requestId, String body) {
- wireMockServer.stubFor(
- put(urlPathEqualTo("/api/valet/placement/v1/" + requestId + "/rollback/")).willReturn(aResponse()
- .withHeader("Content-Type", "application/json").withBody(body).withStatus(HttpStatus.SC_OK)));
- }
-
private static String getBodyFromFileVnfAdapter(String replaceWith) throws IOException {
String temp = readFile("src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json");
if (replaceWith == null) {