diff options
author | Steve Smokowski <ss835w@att.com> | 2019-03-20 20:26:41 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-03-20 20:26:41 +0000 |
commit | cfab2fdde91df35e9f134e128495371939b305a0 (patch) | |
tree | ac2c9e4f0765ac0862ac79da18656b75d9f9bb2a /adapters/mso-openstack-adapters/src | |
parent | 26c6548520475894fa23231987f5e3fa69fed6d9 (diff) | |
parent | 9a409f9ea4c3cc5f73d5756dba833889040e7dda (diff) |
Merge "Add cloudOwner to VNF adapter call"
Diffstat (limited to 'adapters/mso-openstack-adapters/src')
25 files changed, 501 insertions, 388 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java index 108a7148f6..8053cd6f9e 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java @@ -11,9 +11,9 @@ * 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. @@ -89,7 +89,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { private static final String CREATE_NETWORK_CONTEXT = "CreateNetwork"; private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError"; private static final String NEUTRON_MODE = "NEUTRON"; - + private static final Logger logger = LoggerFactory.getLogger(MsoNetworkAdapterImpl.class); @Autowired @@ -104,13 +104,13 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { private MsoHeatUtilsWithUpdate heatWithUpdate; @Autowired private MsoCommonUtils commonUtils; - - @Autowired + + @Autowired private NetworkResourceCustomizationRepository networkCustomRepo; - + @Autowired private CollectionNetworkResourceCustomizationRepository collectionNetworkCustomRepo; - + @Autowired private NetworkResourceRepository networkResourceRepo; /** @@ -406,7 +406,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { StackInfo heatStack = null; long queryNetworkStarttime = System.currentTimeMillis (); try { - heatStack = heat.queryStack (cloudSiteId, tenantId, networkName); + heatStack = heat.queryStack (cloudSiteId, "CloudOwner", tenantId, networkName); } catch (MsoException me) { me.addContext (CREATE_NETWORK_CONTEXT); logger.error("{} {} Create Network (heat): query network {} in {}/{}: ", @@ -534,6 +534,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { if (backout == null) backout = true; heatStack = heat.createStack (cloudSiteId, + "CloudOwner", tenantId, networkName, template, @@ -592,7 +593,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { logger.debug("Network {} successfully created via HEAT", networkName); } - + return; } @@ -736,7 +737,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { - + NetworkResource networkResource = networkCheck( startTime, networkType, @@ -807,7 +808,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { StackInfo heatStack = null; long queryStackStarttime = System.currentTimeMillis(); try { - heatStack = heat.queryStack(cloudSiteId, tenantId, networkName); + heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkName); } catch (MsoException me) { me.addContext(UPDATE_NETWORK_CONTEXT); logger.error("{} {} Exception - QueryStack query {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC, @@ -863,9 +864,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { boolean aic3template = false; String aic3nw = AIC3_NW; - + aic3nw = environment.getProperty(AIC3_NW_PROPERTY, AIC3_NW); - + if (template.contains(aic3nw)) aic3template = true; @@ -934,6 +935,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { long updateStackStarttime = System.currentTimeMillis(); try { heatStack = heatWithUpdate.updateStack(cloudSiteId, + "CloudOwner", tenantId, networkId, template, @@ -1076,7 +1078,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { throw new NetworkException(error, MsoExceptionCategory.USERDATA); } - + return networkResource; } @@ -1180,7 +1182,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { StackInfo heatStack = null; long queryStackStarttime = System.currentTimeMillis (); try { - heatStack = heat.queryStack (cloudSiteId, tenantId, networkNameOrId); + heatStack = heat.queryStack (cloudSiteId, "CloudOwner", tenantId, networkNameOrId); } catch (MsoException me) { me.addContext ("QueryNetwork"); logger.error("{} {} Exception - Query Network (heat): {} in {}/{} ", MessageEnum.RA_QUERY_NETWORK_EXC, @@ -1290,7 +1292,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // Will capture execution time for metrics long startTime = System.currentTimeMillis (); - + if (commonUtils.isNullOrEmpty (cloudSiteId) || commonUtils.isNullOrEmpty(tenantId) || commonUtils.isNullOrEmpty(networkId)) { @@ -1301,7 +1303,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // Retrieve the Network Resource definition NetworkResource networkResource = null; - + if (commonUtils.isNullOrEmpty(modelCustomizationUuid)) { if (!commonUtils.isNullOrEmpty(networkType)) { networkResource = networkResourceRepo.findFirstByModelNameOrderByModelVersionDesc(networkType); @@ -1312,7 +1314,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { networkResource = nrc.getNetworkResource(); } } - + String mode = ""; if (networkResource != null) { logger.debug("Got Network definition from Catalog: {}", networkResource.toString()); @@ -1342,10 +1344,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // The deleteStack function in MsoHeatUtils returns NOTFOUND if the stack was not found or if the stack was deleted. // So query first to report back if stack WAS deleted or just NOTOFUND StackInfo heatStack = null; - heatStack = heat.queryStack(cloudSiteId, tenantId, networkId); + heatStack = heat.queryStack(cloudSiteId, "CloudOwner", tenantId, networkId); if (heatStack != null && heatStack.getStatus() != HeatStatus.NOTFOUND) { - heat.deleteStack (tenantId, cloudSiteId, networkId, true); + heat.deleteStack (tenantId, "CloudOwner", cloudSiteId, networkId, true); networkDeleted.value = true; } else @@ -1359,7 +1361,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { throw new NetworkException (me); } } - + // On success, nothing is returned. return; @@ -1398,7 +1400,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // Retrieve the Network Resource definition NetworkResource networkResource = null; if (commonUtils.isNullOrEmpty(modelCustomizationUuid)) { - networkResource = networkCustomRepo.findOneByNetworkType(networkType).getNetworkResource(); + networkResource = networkCustomRepo.findOneByNetworkType(networkType).getNetworkResource(); } else { networkResource = networkCustomRepo.findOneByModelCustomizationUUID(modelCustomizationUuid).getNetworkResource(); } @@ -1431,7 +1433,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { try { // The deleteStack function in MsoHeatUtils returns success if the stack // was not found. So don't bother to query first. - heat.deleteStack (tenantId, cloudSiteId, networkId, true); + heat.deleteStack (tenantId, "CloudOwner", cloudSiteId, networkId, true); } catch (MsoException me) { me.addContext ("RollbackNetwork"); logger.error("{} {} Exception - Rollback Network (heat): {} in {}/{} ", @@ -1505,7 +1507,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { stackParams.put (VLANS, csl); } if (routeTargets != null) { - + String rtGlobal = ""; String rtImport = ""; String rtExport = ""; @@ -1528,7 +1530,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { logger.debug("Input RT:{}", rt); String role = rt.getRouteTargetRole(); String rtValue = rt.getRouteTarget(); - + if ("IMPORT".equalsIgnoreCase(role)) { sep = rtImport.isEmpty() ? "" : ","; @@ -1547,7 +1549,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { } } - + if (!rtImport.isEmpty()) { stackParams.put ("route_targets_import", rtImport); 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 index 5645759b02..b8e504084b 100644 --- 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 @@ -11,9 +11,9 @@ * 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. @@ -60,13 +60,13 @@ public class ValetClient { @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 = ""; @@ -75,13 +75,13 @@ public class ValetClient { private static final String BODY=", body="; @Autowired private ObjectMapper mapper; - + protected String baseUrl; protected String basePath; protected String authString; - - /* - * Setup the properties needed from properties file. Each will fall to a default + + /* + * Setup the properties needed from properties file. Each will fall to a default */ @PostConstruct private void setupParams() { @@ -93,11 +93,11 @@ public class ValetClient { logger.debug("Error retrieving valet properties. {}", e.getMessage()); } } - + /* - * This method will be invoked to send a Create request to Valet. + * This method will be invoked to send a Create request to Valet. */ - public GenericValetResponse<ValetCreateResponse> callValetCreateRequest(String requestId, String regionId, String tenantId, String serviceInstanceId, + 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; @@ -105,12 +105,12 @@ public class ValetClient { try { UriBuilder builder = UriBuilder.fromPath(baseUrl).path(basePath).queryParam(REQUEST_ID, requestId); URI uri = builder.build(); - - ValetCreateRequest vcr = this.createValetCreateRequest(regionId, tenantId, serviceInstanceId, vnfId, vnfName, vfModuleId, vfModuleName, keystoneUrl, heatRequest); + + 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); - + HttpEntity<String> entity = new HttpEntity<>(body, headers); + response = getRestTemplate().exchange(uri, HttpMethod.POST, entity, ValetCreateResponse.class); gvr = this.getGVRFromResponse(response); } catch (Exception e) { @@ -119,17 +119,17 @@ public class ValetClient { } return gvr; } - + private RestTemplate getRestTemplate(){ RestTemplate restTemplate = new RestTemplate(); restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory())); return restTemplate; } - + /* - * This method will be invoked to send an Update request to Valet. + * This method will be invoked to send an Update request to Valet. */ - public GenericValetResponse<ValetUpdateResponse> callValetUpdateRequest(String requestId, String regionId, String tenantId, String serviceInstanceId, + 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; @@ -137,13 +137,13 @@ public class ValetClient { try { UriBuilder builder = UriBuilder.fromPath(baseUrl).path(basePath).queryParam(REQUEST_ID, requestId); URI uri = builder.build(); - - ValetUpdateRequest vur = this.createValetUpdateRequest(regionId, tenantId, serviceInstanceId, vnfId, vnfName, vfModuleId, vfModuleName, keystoneUrl, heatRequest); + + ValetUpdateRequest vur = this.createValetUpdateRequest(regionId, ownerId, tenantId, serviceInstanceId, vnfId, vnfName, vfModuleId, vfModuleName, keystoneUrl, heatRequest); String body = mapper.writeValueAsString(vur); - HttpHeaders headers = generateHeaders(requestId); + 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) { @@ -152,25 +152,25 @@ public class ValetClient { } return gvr; } - + /* * This method will be invoked to send a Delete request to Valet. */ - public GenericValetResponse<ValetDeleteResponse> callValetDeleteRequest(String requestId, String regionId, String tenantId, String vfModuleId, String vfModuleName) throws Exception { + 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, tenantId, vfModuleId, vfModuleName); - + + 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) { @@ -179,9 +179,9 @@ public class ValetClient { } return gvr; } - + /* - * This method is called to invoke a Confirm request to Valet. + * 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; @@ -190,9 +190,9 @@ public class ValetClient { 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); @@ -206,8 +206,8 @@ public class ValetClient { } 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 { @@ -217,14 +217,14 @@ public class ValetClient { 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) { @@ -233,68 +233,71 @@ public class ValetClient { } return gvr; } - + /* * This method is to construct the ValetCreateRequest pojo */ - private ValetCreateRequest createValetCreateRequest(String regionId, String tenantId, String serviceInstanceId, + 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 tenantId, String serviceInstanceId, + 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 tenantId, String vfModuleId, String vfModuleName) { + 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 */ @@ -303,10 +306,10 @@ public class ValetClient { 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); @@ -314,16 +317,16 @@ public class ValetClient { 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); } 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 index d692416ea1..cb92ecddad 100644 --- 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 @@ -7,9 +7,9 @@ * 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. @@ -30,9 +30,11 @@ import com.fasterxml.jackson.annotation.JsonProperty; */ 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") @@ -49,17 +51,23 @@ public class ValetCreateRequest implements Serializable { 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; } @@ -108,10 +116,10 @@ public class ValetCreateRequest implements Serializable { public void setHeatRequest(HeatRequest heatRequest) { this.heatRequest = heatRequest; } - + @Override public int hashCode() { - return Objects.hash(regionId, tenantId, serviceInstanceId, vnfId, vnfName, vfModuleId, vfModuleName, keystoneUrl, heatRequest); + return Objects.hash(regionId, ownerId, tenantId, serviceInstanceId, vnfId, vnfName, vfModuleId, vfModuleName, keystoneUrl, heatRequest); } @Override public boolean equals(Object o) { @@ -121,7 +129,8 @@ public class ValetCreateRequest implements Serializable { return false; } ValetCreateRequest vcr = (ValetCreateRequest) o; - return Objects.equals(regionId, vcr.regionId) + 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) 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 index 7bd5855d0e..75d7df1a83 100644 --- 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 @@ -7,9 +7,9 @@ * 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. @@ -30,22 +30,30 @@ import com.fasterxml.jackson.annotation.JsonProperty; */ 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; } @@ -66,7 +74,7 @@ public class ValetDeleteRequest implements Serializable { } @Override public int hashCode() { - return Objects.hash(regionId, tenantId, vfModuleId, vfModuleName); + return Objects.hash(regionId, ownerId, tenantId, vfModuleId, vfModuleName); } @Override public boolean equals(Object o) { @@ -76,7 +84,8 @@ public class ValetDeleteRequest implements Serializable { return false; } ValetDeleteRequest vdr = (ValetDeleteRequest) o; - return Objects.equals(regionId, vdr.regionId) + 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/ValetUpdateRequest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetUpdateRequest.java index 360c07b225..2d39dd1a71 100644 --- 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 @@ -7,9 +7,9 @@ * 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. @@ -33,6 +33,8 @@ public class ValetUpdateRequest implements Serializable { @JsonProperty("region_id") private String regionId; + @JsonProperty("owner)_id") + private String ownerId; @JsonProperty("tenant_id") private String tenantId; @JsonProperty("service_instance_id") @@ -49,17 +51,23 @@ public class ValetUpdateRequest implements Serializable { 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; } @@ -110,7 +118,7 @@ public class ValetUpdateRequest implements Serializable { } @Override public int hashCode() { - return Objects.hash(regionId, tenantId, serviceInstanceId, vnfId, vnfName, vfModuleId, vfModuleName, keystoneUrl, heatRequest); + return Objects.hash(regionId, ownerId, tenantId, serviceInstanceId, vnfId, vnfName, vfModuleId, vfModuleName, keystoneUrl, heatRequest); } @Override @@ -121,9 +129,10 @@ public class ValetUpdateRequest implements Serializable { return false; } ValetUpdateRequest vur = (ValetUpdateRequest) o; - return Objects.equals(regionId, vur.regionId) + return Objects.equals(regionId, vur.regionId) + && Objects.equals(ownerId, vur.ownerId) && Objects.equals(tenantId, vur.tenantId) - && Objects.equals(serviceInstanceId, vur.serviceInstanceId) + && Objects.equals(serviceInstanceId, vur.serviceInstanceId) && Objects.equals(vnfId, vur.vnfId) && Objects.equals(vnfName, vur.vnfName) && Objects.equals(vfModuleId, vur.vfModuleId) diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java index c54b067a78..aafcb1c600 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java @@ -44,6 +44,7 @@ public interface MsoVnfAdapter */ @WebMethod public void createVnf (@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, @@ -62,6 +63,7 @@ public interface MsoVnfAdapter @WebMethod public void updateVnf (@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, @@ -76,6 +78,7 @@ public interface MsoVnfAdapter @WebMethod public void queryVnf (@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="request") MsoRequest msoRequest, @@ -87,6 +90,7 @@ public interface MsoVnfAdapter @WebMethod public void deleteVnf (@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="request") MsoRequest msoRequest) @@ -99,6 +103,7 @@ public interface MsoVnfAdapter @WebMethod public void createVfModule (@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, @@ -121,6 +126,7 @@ public interface MsoVnfAdapter @WebMethod public void deleteVfModule (@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="vfName") @XmlElement(required=true) String vfName, @WebParam(name="request") MsoRequest msoRequest, @@ -129,6 +135,7 @@ public interface MsoVnfAdapter @WebMethod public void updateVfModule (@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, 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 index 6f61f0292c..70afb1c69c 100644 --- 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 @@ -7,9 +7,9 @@ * 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. @@ -47,7 +47,8 @@ public interface MsoVnfAdapterAsync @WebMethod @Oneway public void createVnfA (@WebParam(name="cloudSiteId") @XmlElement(required=true) String cloudSiteId, - @WebParam(name="tenantId") @XmlElement(required=true) String tenantId, + @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, @@ -60,10 +61,11 @@ public interface MsoVnfAdapterAsync @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 updateVnfA (@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, @@ -74,10 +76,11 @@ public interface MsoVnfAdapterAsync @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 queryVnfA (@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, @@ -87,6 +90,7 @@ public interface MsoVnfAdapterAsync @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, @@ -99,7 +103,7 @@ public interface MsoVnfAdapterAsync @WebParam(name="messageId") @XmlElement(required=true) String messageId, @WebParam(name="notificationUrl") @XmlElement(required=true) String notificationUrl ); - + @WebMethod public void healthCheckA (); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java index fce14c718b..5e42fa5603 100644 --- 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 @@ -10,9 +10,9 @@ * 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. @@ -63,10 +63,10 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.vnf.bpelauth"; private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey"; - + @Autowired private Environment environment; - + @Autowired private MsoVnfAdapterImpl vnfImpl; @@ -108,6 +108,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { * 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 @@ -119,6 +120,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { */ @Override public void createVnfA (String cloudSiteId, + String cloudOwner, String tenantId, String vnfType, String vnfVersion, @@ -143,6 +145,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { try { vnfAdapter.createVnf (cloudSiteId, + cloudOwner, tenantId, vnfType, vnfVersion, @@ -203,6 +206,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { @Override public void updateVnfA (String cloudSiteId, + String cloudOwner, String tenantId, String vnfType, String vnfVersion, @@ -225,7 +229,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { Holder <VnfRollback> vnfRollback = new Holder <> (); try { - vnfAdapter.updateVnf (cloudSiteId, tenantId, vnfType,vnfVersion, vnfName, requestType, volumeGroupHeatStackId, inputs, msoRequest, outputs, vnfRollback); + vnfAdapter.updateVnf (cloudSiteId, cloudOwner, tenantId, vnfType,vnfVersion, vnfName, requestType, volumeGroupHeatStackId, inputs, msoRequest, outputs, vnfRollback); } catch (VnfException e) { logger.error("{} {} Exception sending updateVnf notification ", MessageEnum.RA_UPDATE_VNF_ERR, ErrorCode.BusinessProcesssError.getValue(), e); @@ -277,6 +281,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { * ID, its status, and the set of outputs (from when the stack was created). * * @param cloudSiteId CLLI code of the cloud site in which to query + * @param cloudOwner cloud owner of cloud site in which to query * @param tenantId Openstack tenant identifier * @param vnfName VNF Name or Openstack ID * @param msoRequest Request tracking information for logs @@ -284,6 +289,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { */ @Override public void queryVnfA (String cloudSiteId, + String cloudOwner, String tenantId, String vnfName, String messageId, @@ -303,7 +309,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { Holder <Map <String, String>> outputs = new Holder <> (); try { - vnfAdapter.queryVnf (cloudSiteId, tenantId, vnfName, msoRequest, vnfExists, vnfId, status, outputs); + vnfAdapter.queryVnf (cloudSiteId, cloudOwner, tenantId, vnfName, msoRequest, vnfExists, vnfId, status, outputs); } catch (VnfException e) { logger.error("{} {} Exception sending queryVnfA notification ", MessageEnum.RA_QUERY_VNF_ERR, ErrorCode.BusinessProcesssError.getValue(), e); @@ -363,6 +369,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { * 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 @@ -370,6 +377,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { */ @Override public void deleteVnfA (String cloudSiteId, + String cloudOwner, String tenantId, String vnfName, String messageId, @@ -383,7 +391,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { MsoVnfAdapter vnfAdapter = vnfImpl; try { - vnfAdapter.deleteVnf (cloudSiteId, tenantId, vnfName, msoRequest); + vnfAdapter.deleteVnf (cloudSiteId, cloudOwner, tenantId, vnfName, msoRequest); } catch (VnfException e) { logger.error("{} {} Exception sending deleteVnfA notification ", MessageEnum.RA_DELETE_VNF_ERR, ErrorCode.BusinessProcesssError.getValue(), e); @@ -630,7 +638,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { return notifyPort; } - + public String getEncryptedProperty(String key, String defaultValue, String encryptionKey) { try { return CryptoUtils.decrypt(this.environment.getProperty(key), this.environment.getProperty(encryptionKey)); 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 af09e5ac0c..0563d6c242 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 @@ -164,6 +164,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { * orchestrator fails on a subsequent operation. * * @param cloudSiteId CLLI code of the cloud site in which to create the VNF + * @param cloudOwner cloud owner of the cloud region 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 vnfVersion VNF version key, should match a VNF definition in catalog DB @@ -178,6 +179,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { */ @Override public void createVnf (String cloudSiteId, + String cloudOwner, String tenantId, String vnfType, String vnfVersion, @@ -211,6 +213,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { logger.debug("ERROR trying to parse the volumeGroupHeatStackId " + volumeGroupHeatStackId,e); } this.createVfModule(cloudSiteId, + cloudOwner, tenantId, vnfType, vnfVersion, @@ -239,11 +242,12 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { newRequestTypeSb.append(requestType); } this.createVfModule(cloudSiteId, - tenantId, + cloudOwner, + tenantId, vnfType, vnfVersion, genericVnfId, - vnfName, + vnfName, vfModuleId, newRequestTypeSb.toString(), vfVolGroupHeatStackId, @@ -263,6 +267,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { @Override public void updateVnf(String cloudSiteId, + String cloudOwner, String tenantId, String vnfType, String vnfVersion, @@ -294,6 +299,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { */ @Override public void queryVnf (String cloudSiteId, + String cloudOwner, String tenantId, String vnfName, MsoRequest msoRequest, @@ -310,12 +316,12 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { StackInfo heatStack = null; long subStartTime = System.currentTimeMillis (); try { - heatStack = heat.queryStack (cloudSiteId, tenantId, vnfName); + heatStack = heat.queryStack (cloudSiteId, cloudOwner, tenantId, vnfName); } catch (MsoException me) { me.addContext ("QueryVNF"); // Failed to query the Stack due to an openstack exception. // Convert to a generic VnfException - String error = "Query VNF: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me; + String error = "Query VNF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, tenantId, "OpenStack", "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryStack", me); @@ -351,12 +357,14 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { * 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 */ @Override public void deleteVnf (String cloudSiteId, + String cloudOwner, String tenantId, String vnfName, MsoRequest msoRequest) throws VnfException { @@ -371,13 +379,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // could be thrown. long subStartTime = System.currentTimeMillis (); try { - heat.deleteStack (tenantId, cloudSiteId, vnfName, true); + heat.deleteStack (tenantId, cloudOwner, cloudSiteId, vnfName, true); } catch (MsoException me) { me.addContext ("DeleteVNF"); // Failed to query the Stack due to an openstack exception. // Convert to a generic VnfException - String error = "Delete VNF: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudSiteId, + String error = "Delete VNF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId, "OpenStack", "DeleteVNF", ErrorCode.DataError.getValue(), "Exception - DeleteVNF", me); logger.debug(error); @@ -405,23 +413,24 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // Get the elements of the VnfRollback object for easier access String cloudSiteId = rollback.getCloudSiteId (); + String cloudOwner = rollback.getCloudOwner (); String tenantId = rollback.getTenantId (); String vnfId = rollback.getVnfId (); - logger.debug("Rolling Back VNF {} in {}", vnfId, cloudSiteId + "/" + tenantId); + logger.debug("Rolling Back VNF {} in {}", vnfId, cloudOwner + "/" + cloudSiteId + "/" + tenantId); // Use the MsoHeatUtils to delete the stack. Set the polling flag to true. // The possible outcomes of deleteStack are a StackInfo object with status // of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException // could be thrown. try { - heat.deleteStack (tenantId, cloudSiteId, vnfId, true); + heat.deleteStack (tenantId, cloudOwner, cloudSiteId, vnfId, true); } catch (MsoException me) { // Failed to rollback the Stack due to an openstack exception. // Convert to a generic VnfException me.addContext ("RollbackVNF"); - String error = "Rollback VNF: " + vnfId + " in " + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfId, cloudSiteId, + String error = "Rollback VNF: " + vnfId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfId, cloudOwner, cloudSiteId, tenantId, "OpenStack", "DeleteStack", ErrorCode.DataError.getValue(), "Exception - DeleteStack", me); logger.debug(error); @@ -563,6 +572,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { @Override public void createVfModule(String cloudSiteId, + String cloudOwner, String tenantId, String vnfType, String vnfVersion, @@ -632,6 +642,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // 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); @@ -648,10 +659,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { StackInfo heatStack = null; long subStartTime1 = System.currentTimeMillis (); try { - heatStack = heat.queryStack (cloudSiteId, tenantId, vfModuleName); + heatStack = heat.queryStack (cloudSiteId, cloudOwner, tenantId, vfModuleName); } catch (MsoException me) { - String error = "Create VF Module: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me ; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId, + String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me ; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(), "Exception - queryStack", me); logger.debug(error); @@ -666,43 +677,43 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { HeatStatus status = heatStack.getStatus(); if (status == HeatStatus.INIT || status == HeatStatus.BUILDING || status == HeatStatus.DELETING || status == HeatStatus.UPDATING) { // fail - it's in progress - return meaningful error - String error = "Create VF: Stack " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually."; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(), + String error = "Create VF: Stack " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually."; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + cloudOwner, cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(), "Stack " + vfModuleName + " already exists"); logger.debug(error); - throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName ()); + throw new VnfAlreadyExists (vfModuleName, cloudOwner, cloudSiteId, tenantId, heatStack.getCanonicalName ()); } if (status == HeatStatus.FAILED) { // fail - it exists and is in a FAILED state - String error = "Create VF: Stack " + vfModuleName + " already exists and is in FAILED state in " + cloudSiteId + "/" + tenantId + "; requires manual intervention."; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(), + String error = "Create VF: Stack " + vfModuleName + " already exists and is in FAILED state in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention."; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + cloudOwner, cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(), "Stack " + vfModuleName + " already exists and is " + "in FAILED state"); logger.debug(error); - throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName ()); + throw new VnfAlreadyExists (vfModuleName, cloudOwner, cloudSiteId, tenantId, heatStack.getCanonicalName ()); } if (status == HeatStatus.UNKNOWN || status == HeatStatus.UPDATED) { // fail - it exists and is in a FAILED state String error = "Create VF: Stack " + vfModuleName + " already exists and has status " + status.toString() + " in " - + cloudSiteId + "/" + tenantId + "; requires manual intervention."; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(), + + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention."; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + cloudOwner, cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(), "Stack " + vfModuleName + " already exists and is " + "in UPDATED or UNKNOWN state"); logger.debug(error); - throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName()); + throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId, heatStack.getCanonicalName()); } if (status == HeatStatus.CREATED) { // fail - it exists if (failIfExists != null && failIfExists) { String error = - "Create VF: Stack " + vfModuleName + " already exists in " + cloudSiteId + "/" + tenantId; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(), + "Create VF: Stack " + vfModuleName + " already exists in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + cloudOwner, cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.DataError.getValue(), "Stack " + vfModuleName + " already exists"); logger.debug(error); - throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName()); + throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId, heatStack.getCanonicalName()); } else { logger.debug ("Found Existing stack, status={}", heatStack.getStatus ()); // Populate the outputs from the existing stack. @@ -722,22 +733,22 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (nestedStackId != null) { try { logger.debug("Querying for nestedStackId = {}", nestedStackId); - nestedHeatStack = heat.queryStack(cloudSiteId, tenantId, nestedStackId); + nestedHeatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, nestedStackId); } catch (MsoException me) { // Failed to query the Stack due to an openstack exception. // Convert to a generic VnfException me.addContext ("CreateVFModule"); - String error = "Create VFModule: Attached heatStack ID Query " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + ": " + me ; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId, + String error = "Create VFModule: Attached heatStack ID Query " + nestedStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me ; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, "OpenStack", "queryStack", ErrorCode.BusinessProcesssError.getValue(), "MsoException trying to query nested stack", me); logger.debug("ERROR trying to query nested stack= {}", error); throw new VnfException (me); } if (nestedHeatStack == null || nestedHeatStack.getStatus() == HeatStatus.NOTFOUND) { - String error = "Create VFModule: Attached heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, - cloudSiteId, tenantId, error, "OpenStack", "queryStack", + String error = "Create VFModule: Attached heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR" ; + logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, + cloudOwner, cloudSiteId, tenantId, error, "OpenStack", "queryStack", ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Attached heatStack ID " + "DOES NOT EXIST"); logger.debug(error); @@ -755,23 +766,23 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (nestedBaseStackId != null) { try { logger.debug("Querying for nestedBaseStackId = {}", nestedBaseStackId); - nestedBaseHeatStack = heat.queryStack(cloudSiteId, tenantId, nestedBaseStackId); + nestedBaseHeatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, nestedBaseStackId); } catch (MsoException me) { // Failed to query the Stack due to an openstack exception. // Convert to a generic VnfException me.addContext ("CreateVFModule"); - String error = "Create VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + ": " + me ; + String error = "Create VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me ; logger - .error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId, + .error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, "OpenStack", "QueryStack", ErrorCode.BusinessProcesssError.getValue(), "MsoException trying to query nested base stack", me); logger.debug("ERROR trying to query nested base stack= {}", error); throw new VnfException (me); } if (nestedBaseHeatStack == null || nestedBaseHeatStack.getStatus() == HeatStatus.NOTFOUND) { - String error = "Create VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, - cloudSiteId, tenantId, error, "OpenStack", "QueryStack", + String error = "Create VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR" ; + logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, + cloudOwner, cloudSiteId, tenantId, error, "OpenStack", "QueryStack", ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Attached base heatStack ID DOES NOT EXIST"); logger.debug("Exception occurred", error); @@ -1170,7 +1181,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { boolean sendResponseToValet = false; if (isValetEnabled) { Holder<Map<String, Object>> valetModifiedParamsHolder = new Holder<>(); - sendResponseToValet = this.valetCreateRequest(cloudSiteId, tenantId, heatFilesObjects, + sendResponseToValet = this.valetCreateRequest(cloudSiteId, cloudOwner, tenantId, heatFilesObjects, nestedTemplatesChecked, vfModuleName, backout, heatTemplate, newEnvironmentString, goldenInputs, msoRequest, inputs, failRequestOnValetFailure, valetModifiedParamsHolder); if (sendResponseToValet) { @@ -1192,6 +1203,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { logger.debug("heat is not null!!"); heatStack = heat.createStack (cloudSiteId, + cloudOwner, tenantId, vfModuleName, template, @@ -1209,9 +1221,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } } catch (MsoException me) { me.addContext ("CreateVFModule"); - String error = "Create VF Module " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + me; + String error = "Create VF Module " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; logger - .error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId, + .error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner, cloudSiteId, tenantId, "OpenStack", ErrorCode.DataError.getValue(), "MsoException - createStack", me); logger.debug(error); @@ -1227,9 +1239,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { } throw new VnfException (me); } catch (NullPointerException npe) { - String error = "Create VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + npe; + String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + npe; logger - .error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId, + .error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner, cloudSiteId, tenantId, "OpenStack", ErrorCode.DataError.getValue(), "NullPointerException - createStack", npe); logger.debug(error); @@ -1268,12 +1280,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { @Override public void deleteVfModule (String cloudSiteId, + String cloudOwner, String tenantId, String vnfName, MsoRequest msoRequest, Holder <Map <String, String>> outputs) throws VnfException { - logger.debug("Deleting VF {} in ", vnfName, cloudSiteId + "/" + tenantId); + logger.debug("Deleting VF {} in ", vnfName, cloudOwner + "/" + cloudSiteId + "/" + tenantId); // Will capture execution time for metrics long startTime = System.currentTimeMillis (); @@ -1281,13 +1294,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // so we'll need to query first Map<String, Object> stackOutputs = null; try { - stackOutputs = heat.queryStackForOutputs(cloudSiteId, tenantId, vnfName); + stackOutputs = heat.queryStackForOutputs(cloudSiteId, cloudOwner, tenantId, vnfName); } 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 " + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, + String error = "Delete VFModule: Query to get outputs: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(), "Exception - QueryStack", me); logger.debug(error); @@ -1301,7 +1314,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { logger.debug("isValetEnabled={}, failRequestsOnValetFailure={}", isValetEnabled, failRequestOnValetFailure); boolean valetDeleteRequestSucceeded = false; if (isValetEnabled) { - valetDeleteRequestSucceeded = this.valetDeleteRequest(cloudSiteId, tenantId, vnfName, msoRequest, failRequestOnValetFailure); + valetDeleteRequestSucceeded = this.valetDeleteRequest(cloudSiteId, cloudOwner, tenantId, vnfName, msoRequest, failRequestOnValetFailure); } // Use the MsoHeatUtils to delete the stack. Set the polling flag to true. @@ -1310,13 +1323,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // could be thrown. long subStartTime = System.currentTimeMillis (); try { - heat.deleteStack (tenantId, cloudSiteId, vnfName, true); + heat.deleteStack (tenantId, cloudOwner, cloudSiteId, vnfName, true); } catch (MsoException me) { me.addContext ("DeleteVNF"); // Failed to query the Stack due to an openstack exception. // Convert to a generic VnfException - String error = "Delete VF: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudSiteId, + String error = "Delete VF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId, "OpenStack", "DeleteStack", ErrorCode.DataError.getValue(), "Exception - deleteStack", me); logger.debug(error); @@ -1350,6 +1363,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { @Override public void updateVfModule (String cloudSiteId, + String cloudOwner, String tenantId, String vnfType, String vnfVersion, @@ -1370,7 +1384,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { StringBuilder sbInit = new StringBuilder(); sbInit.append("updateVfModule: \n"); - sbInit.append("cloudSiteId=" + cloudSiteId + "\n"); + sbInit.append("cloudOwner=" + cloudOwner + "\n"); + sbInit.append("cloudSiteId=" + cloudSiteId + "\n"); sbInit.append("tenantId=" + tenantId + "\n"); sbInit.append("vnfType=" + vnfType + "\n"); sbInit.append("vnfVersion=" + vnfVersion + "\n"); @@ -1425,7 +1440,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { vfModuleName = this.getVfModuleNameFromModuleStackId(vfModuleStackId); } - logger.debug ("Updating VFModule: " + vfModuleName + " of type " + vfModuleType + "in " + cloudSiteId + "/" + tenantId); + logger.debug ("Updating VFModule: " + vfModuleName + " of type " + vfModuleType + "in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId); logger.debug("requestTypeString = " + requestTypeString + ", nestedVolumeStackId = " + nestedStackId + ", nestedBaseStackId = " + nestedBaseStackId); // Will capture execution time for metrics @@ -1434,6 +1449,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { // 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); @@ -1447,13 +1463,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { long queryStackStarttime = System.currentTimeMillis (); logger.debug("UpdateVfModule - querying for {}", vfModuleName); try { - heatStack = heat.queryStack (cloudSiteId, tenantId, vfModuleName); + heatStack = heat.queryStack (cloudSiteId, cloudOwner, tenantId, vfModuleName); } catch (MsoException me) { // Failed to query the Stack due to an openstack exception. // Convert to a generic VnfException me.addContext ("UpdateVFModule"); - String error = "Update VFModule: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId, + String error = "Update VFModule: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(), "Exception - QueryStack", me); logger.debug(error); @@ -1463,10 +1479,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { //TODO - do we need to check for the other status possibilities? if (heatStack == null || heatStack.getStatus () == HeatStatus.NOTFOUND) { // Not Found - String error = "Update VF: Stack " + vfModuleName + " does not exist in " + cloudSiteId + "/" + tenantId; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_NOT_EXIST.toString(), vfModuleName, cloudSiteId, + String error = "Update VF: Stack " + vfModuleName + " does not exist in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_NOT_EXIST.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(), error); - throw new VnfNotFound (cloudSiteId, tenantId, vfModuleName); + throw new VnfNotFound (cloudSiteId, cloudOwner, tenantId, vfModuleName); } else { logger.debug("Found Existing stack, status={}", heatStack.getStatus()); // Populate the outputs from the existing stack. @@ -1481,21 +1497,21 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (nestedStackId != null) { try { logger.debug("Querying for nestedStackId = {}", nestedStackId); - nestedHeatStack = heat.queryStack(cloudSiteId, tenantId, nestedStackId); + nestedHeatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, nestedStackId); } catch (MsoException me) { // Failed to query the Stack due to an openstack exception. // Convert to a generic VnfException me.addContext ("UpdateVFModule"); - String error = "Update VF: Attached heatStack ID Query " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + ": " + me ; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, + String error = "Update VF: Attached heatStack ID Query " + nestedStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me ; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(), "Exception - " + error, me); logger.debug("ERROR trying to query nested stack= {}", error); throw new VnfException (me); } if (nestedHeatStack == null || nestedHeatStack.getStatus() == HeatStatus.NOTFOUND) { - String error = "Update VFModule: Attached volume heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, + String error = "Update VFModule: Attached volume heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR" ; + logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId, error, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(), error); logger.debug(error); throw new VnfException (error, MsoExceptionCategory.USERDATA); @@ -1512,23 +1528,23 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { long queryStackStarttime3 = System.currentTimeMillis (); try { logger.debug("Querying for nestedBaseStackId = {}", nestedBaseStackId); - nestedBaseHeatStack = heat.queryStack(cloudSiteId, tenantId, nestedBaseStackId); + nestedBaseHeatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, nestedBaseStackId); } catch (MsoException me) { // Failed to query the Stack due to an openstack exception. // Convert to a generic VnfException me.addContext ("UpdateVfModule"); - String error = "Update VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + ": " + me ; + String error = "Update VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me ; logger - .error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId, + .error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner, cloudSiteId, tenantId, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(), "Exception - " + error, me); logger.debug("ERROR trying to query nested base stack= {}", error); throw new VnfException (me); } if (nestedBaseHeatStack == null || nestedBaseHeatStack.getStatus() == HeatStatus.NOTFOUND) { - String error = "Update VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ; - logger.error ("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, - cloudSiteId, tenantId, error, "OpenStack", + String error = "Update VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR" ; + logger.error ("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, + cloudOwner, cloudSiteId, tenantId, error, "OpenStack", "QueryStack", ErrorCode.DataError.getValue(), error); logger.debug(error); throw new VnfException (error, MsoExceptionCategory.USERDATA); @@ -1958,7 +1974,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { if (parsedVfModuleName == null || parsedVfModuleName.isEmpty()) { parsedVfModuleName = "unknown"; } - sendResponseToValet = this.valetUpdateRequest(cloudSiteId, tenantId, heatFilesObjects, + sendResponseToValet = this.valetUpdateRequest(cloudSiteId, cloudOwner, tenantId, heatFilesObjects, nestedTemplatesChecked, parsedVfModuleName, false, heatTemplate, newEnvironmentString, (HashMap<String, Object>) goldenInputs, msoRequest, inputs, failRequestOnValetFailure, valetModifiedParamsHolder); if (sendResponseToValet) { @@ -1973,6 +1989,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { try { heatStack = heatU.updateStack( cloudSiteId, + cloudOwner, tenantId, vfModuleName, template, @@ -1986,9 +2003,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { ); } catch (MsoException me) { me.addContext ("UpdateVFModule"); - String error = "Update VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + me; + String error = "Update VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; logger - .error("{} {} {} {} {} {} {}", MessageEnum.RA_UPDATE_VNF_ERR.toString(), vfModuleType, cloudSiteId, + .error("{} {} {} {} {} {} {} {}", 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"); @@ -2097,7 +2114,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { /* * Valet Create request */ - private boolean valetCreateRequest(String cloudSiteId, String tenantId, Map<String, Object> heatFilesObjects, Map<String, Object> nestedTemplatesChecked, + 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; @@ -2109,7 +2126,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { HeatRequest heatRequest = new HeatRequest(vfModuleName, backout, heatTemplate.getTimeoutMinutes(), heatTemplate.getTemplateBody(), newEnvironmentString, files, goldenInputs); GenericValetResponse<ValetCreateResponse> createReq = this.vci.callValetCreateRequest(msoRequest.getRequestId(), - cloudSiteId, tenantId, msoRequest.getServiceInstanceId(), (String)inputs.get("vnf_id"), + 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(); @@ -2156,7 +2173,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { * Valet update request */ - private boolean valetUpdateRequest(String cloudSiteId, String tenantId, + 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, @@ -2172,7 +2189,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { 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, tenantId, msoRequest.getServiceInstanceId(), (String)inputs.get("vnf_id"), + cloudSiteId, cloudOwnerId, tenantId, msoRequest.getServiceInstanceId(), (String)inputs.get("vnf_id"), vfModuleName, (String)inputs.get("vf_module_id"), vfModuleName, keystoneUrl, heatRequest); ValetUpdateResponse vur = updateReq.getReturnObject(); @@ -2218,7 +2235,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { /* * Valet delete request */ - private boolean valetDeleteRequest(String cloudSiteId, String tenantId, String vnfName, + private boolean valetDeleteRequest(String cloudSiteId, String cloudOwnerId, String tenantId, String vnfName, MsoRequest msoRequest, boolean failRequestOnValetFailure) { boolean valetDeleteRequestSucceeded = false; String valetErrorMessage = "more detail not available"; @@ -2233,7 +2250,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { logger.error("An exception occurred trying to call MsoVnfAdapterImpl.valetDeleteRequest() method", e); } GenericValetResponse<ValetDeleteResponse> deleteReq = this.vci.callValetDeleteRequest(msoRequest.getRequestId(), - cloudSiteId, tenantId, vfModuleId, vfModuleName); + cloudSiteId, cloudOwnerId, tenantId, vfModuleId, vfModuleName); ValetDeleteResponse vdr = deleteReq.getReturnObject(); if (vdr != null && deleteReq.getStatusCode() == 200) { ValetStatus status = vdr.getStatus(); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java index b8be910c43..a07fff024b 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java @@ -129,6 +129,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { */ @Override public void createVnf (String cloudSiteId, + String cloudOwner, String tenantId, String vnfType, String vnfVersion, @@ -157,6 +158,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { */ @Override public void updateVnf (String cloudSiteId, + String cloudOwner, String tenantId, String vnfType, String vnfVersion, @@ -188,6 +190,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { * The input "vnfName" will also be reflected back as its ID. * * @param cloudSiteId CLLI code of the cloud site in which to query + * @param cloudOwner cloud owner of the cloud site in which to query * @param tenantId Openstack tenant identifier - ignored for Cloudify * @param vnfName VNF Name (should match a deployment ID) * @param msoRequest Request tracking information for logs @@ -197,6 +200,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { */ @Override public void queryVnf (String cloudSiteId, + String cloudOwner, String tenantId, String vnfName, MsoRequest msoRequest, @@ -226,9 +230,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // Failed to query the Deployment due to a cloudify exception. // Convert to a generic VnfException me.addContext("QueryVNF"); - String error = "Query VNF (Cloudify): " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me; + String error = "Query VNF (Cloudify): " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; logger - .error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, tenantId, + .error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryDeployment", me); logger.debug(error); throw new VnfException(me); @@ -260,6 +264,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { */ @Override public void deleteVnf (String cloudSiteId, + String cloudOwner, String tenantId, String vnfName, MsoRequest msoRequest) throws VnfException { @@ -294,10 +299,11 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // Get the elements of the VnfRollback object for easier access String cloudSiteId = rollback.getCloudSiteId (); + String cloudOwner = rollback.getCloudOwner(); String tenantId = rollback.getTenantId (); String vfModuleId = rollback.getVfModuleStackId (); - logger.debug("Rolling Back VF Module {} in {}", vfModuleId, cloudSiteId + "/" + tenantId); + logger.debug("Rolling Back VF Module {} in {}", vfModuleId, cloudOwner + "/" + cloudSiteId + "/" + tenantId); DeploymentInfo deployment = null; @@ -319,8 +325,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // Failed to rollback the VNF due to a cloudify exception. // Convert to a generic VnfException me.addContext ("RollbackVNF"); - String error = "Rollback VF Module: " + vfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudSiteId, + String error = "Rollback VF Module: " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "DeleteDeployment", ErrorCode.DataError.getValue(), "Exception - DeleteDeployment", me); logger.debug(error); @@ -523,6 +529,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { * is successfully created but the orchestration fails on a subsequent step. * * @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 vfModuleType VF Module type key, should match a VNF definition in catalog DB. * Deprecated - should use modelCustomizationUuid @@ -548,6 +555,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { */ @Override public void createVfModule(String cloudSiteId, + String cloudOwner, String tenantId, String vfModuleType, String vnfVersion, @@ -612,6 +620,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // 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); @@ -693,7 +702,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { } catch (MsoException me) { // Failed to query the Deployment due to a cloudify exception. - String error = "Create VF Module: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me ; + String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me ; logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), "Exception - queryDeployment", me); @@ -713,12 +722,12 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { if (status == DeploymentStatus.INSTALLED) { // fail - it exists if (failIfExists != null && failIfExists) { - String error = "Create VF: Deployment " + vfModuleName + " already exists in " + cloudSiteId + "/" + tenantId; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), + String error = "Create VF: Deployment " + vfModuleName + " already exists in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), "Deployment " + vfModuleName + " already exists"); logger.debug(error); - throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId()); + throw new VnfAlreadyExists (vfModuleName, cloudSiteId, cloudOwner, tenantId, cloudifyDeployment.getId()); } else { // Found existing deployment and client has not requested "failIfExists". // Populate the outputs from the existing deployment. @@ -731,41 +740,41 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // Check through various detailed error cases if (status == DeploymentStatus.INSTALLING || status == DeploymentStatus.UNINSTALLING) { // fail - it's in progress - return meaningful error - String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually."; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), + String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually."; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), "Deployment " + vfModuleName + " already exists"); logger.debug(error); - throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId()); + throw new VnfAlreadyExists (vfModuleName, cloudSiteId, cloudOwner, tenantId, cloudifyDeployment.getId()); } else if (status == DeploymentStatus.FAILED) { // fail - it exists and is in a FAILED state - String error = "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in " + cloudSiteId + "/" + tenantId + "; requires manual intervention."; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), + String error = "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention."; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), "Deployment " + vfModuleName + " already " + "exists and is in FAILED state"); logger.debug(error); - throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId()); + throw new VnfAlreadyExists (vfModuleName, cloudSiteId, cloudOwner, tenantId, cloudifyDeployment.getId()); } else if (status == DeploymentStatus.UNKNOWN || status == DeploymentStatus.CREATED) { // fail - it exists and is in a UNKNOWN state - String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention."; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), + String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention."; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), "Deployment " + vfModuleName + " already " + "exists and is in " + status.toString() + " state"); logger.debug(error); - throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId()); + throw new VnfAlreadyExists (vfModuleName, cloudSiteId, cloudOwner, tenantId, cloudifyDeployment.getId()); } else { // Unexpected, since all known status values have been tested for String error = "Create VF: Deployment " + vfModuleName + " already exists with unexpected status " + status - .toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention."; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), + .toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention."; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", ErrorCode.DataError.getValue(), "Deployment " + vfModuleName + " already " + "exists and is in an unknown state"); logger.debug(error); - throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId()); + throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, cloudifyDeployment.getId()); } } @@ -783,9 +792,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { } catch (MsoException me) { // Failed to query the Volume GroupDeployment due to a cloudify exception. - String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudSiteId + "/" + tenantId + ": " + me ; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, - cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(volume)", + String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me ; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, + cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(volume)", ErrorCode.DataError.getValue(), "Exception - queryDeployment(volume)", me); logger.debug(error); // Convert to a generic VnfException @@ -835,10 +844,10 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { catch (MsoException me) { // Failed to query the Volume GroupDeployment due to a cloudify exception. String error = - "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, - cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(Base)", + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, + cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(Base)", ErrorCode.DataError.getValue(), "Exception - queryDeployment(Base)", me); logger.debug(error); // Convert to a generic VnfException @@ -1127,17 +1136,17 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { } catch (MsoException me) { me.addContext ("CreateVFModule"); - String error = "Create VF Module " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + me; + String error = "Create VF Module " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; logger - .error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId, + .error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner, cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(), "MsoException - createDeployment", me); logger.debug(error); throw new VnfException (me); } catch (NullPointerException npe) { - String error = "Create VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + npe; + String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + npe; logger - .error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId, + .error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner, cloudSiteId, tenantId, CLOUDIFY, ErrorCode.DataError.getValue(), "NullPointerException - createDeployment", npe); logger.debug(error); @@ -1168,12 +1177,12 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { } public void deleteVfModule (String cloudSiteId, + String cloudOwner, String tenantId, String vnfName, MsoRequest msoRequest, Holder <Map <String, String>> outputs) throws VnfException { - - logger.debug ("Deleting VF " + vnfName + " in " + cloudSiteId + "/" + tenantId); + logger.debug ("Deleting VF " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId); // Will capture execution time for metrics long startTime = System.currentTimeMillis (); @@ -1185,8 +1194,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { } catch (MsoException me) { // Failed to query the deployment. Convert to a generic VnfException me.addContext ("DeleteVFModule"); - String error = "Delete VFModule: Query to get outputs: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, + String error = "Delete VFModule: Query to get outputs: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId, CLOUDIFY, "QueryDeployment", ErrorCode.DataError.getValue(), "Exception - QueryDeployment", me); logger.debug(error); @@ -1205,8 +1214,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { } catch (MsoException me) { me.addContext("DeleteVfModule"); // Convert to a generic VnfException - String error = "Delete VF: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudSiteId, + String error = "Delete VF: " + vnfName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudOwner, cloudSiteId, tenantId, "DeleteDeployment", "DeleteDeployment", ErrorCode.DataError.getValue(), "Exception - DeleteDeployment: " + me.getMessage()); logger.debug(error); @@ -1220,6 +1229,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter { // TODO: Should Update be supported for Cloudify? What would this look like? @Override public void updateVfModule (String cloudSiteId, + String cloudOwner, String tenantId, String vnfType, String vnfVersion, 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 197777c1ae..2b49290727 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 @@ -153,6 +153,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { */ @Override public void createVnf (String cloudSiteId, + String cloudOwner, String tenantId, String vnfType, String vnfVersion, @@ -181,6 +182,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { */ @Override public void updateVnf (String cloudSiteId, + String cloudOwner, String tenantId, String vnfType, String vnfVersion, @@ -216,6 +218,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { */ @Override public void queryVnf (String cloudSiteId, + String cloudOwner, String tenantId, String vnfNameOrId, MsoRequest msoRequest, @@ -225,16 +228,16 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { Holder <Map <String, String>> outputs) throws VnfException { - logger.debug("Querying VNF " + vnfNameOrId + " in " + cloudSiteId + "/" + tenantId); + logger.debug("Querying VNF " + vnfNameOrId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId); // Will capture execution time for metrics long startTime = System.currentTimeMillis (); long subStartTime = System.currentTimeMillis (); VduInstance vduInstance = null; - CloudInfo cloudInfo = new CloudInfo(cloudSiteId, tenantId, null); + CloudInfo cloudInfo = new CloudInfo(cloudSiteId, cloudOwner, tenantId, null); - VduPlugin vduPlugin = getVduPlugin(cloudSiteId); + VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner); try { vduInstance = vduPlugin.queryVdu (cloudInfo, vnfNameOrId); @@ -243,8 +246,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Failed to query the VDU due to a plugin exception. // Convert to a generic VnfException e.addContext("QueryVNF"); - String error = "Query VNF (VDU): " + vnfNameOrId + " in " + cloudSiteId + "/" + tenantId + ": " + e; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfNameOrId, cloudSiteId, + String error = "Query VNF (VDU): " + vnfNameOrId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + e; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfNameOrId, cloudOwner, cloudSiteId, tenantId, "VDU", "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryVDU", e); logger.debug(error); throw new VnfException(e); @@ -277,6 +280,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { */ @Override public void deleteVnf (String cloudSiteId, + String cloudOwner, String tenantId, String vnfName, MsoRequest msoRequest) throws VnfException { @@ -311,17 +315,18 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Get the elements of the VnfRollback object for easier access String cloudSiteId = rollback.getCloudSiteId (); + String cloudOwner = rollback.getCloudOwner(); String tenantId = rollback.getTenantId (); - CloudInfo cloudInfo = new CloudInfo (cloudSiteId, tenantId, null); + CloudInfo cloudInfo = new CloudInfo (cloudSiteId, cloudOwner, tenantId, null); String vfModuleId = rollback.getVfModuleStackId (); - logger.debug("Rolling Back VF Module " + vfModuleId + " in " + cloudSiteId + "/" + tenantId); + logger.debug("Rolling Back VF Module " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId); VduInstance vduInstance = null; // Use the VduPlugin to delete the VF Module. - VduPlugin vduPlugin = getVduPlugin(cloudSiteId); + VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner); long subStartTime = System.currentTimeMillis (); try { @@ -334,8 +339,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Failed to rollback the VF Module due to a plugin exception. // Convert to a generic VnfException ve.addContext ("RollbackVFModule"); - String error = "Rollback VF Module: " + vfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + ve; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudSiteId, + String error = "Rollback VF Module: " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + ve; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner, cloudSiteId, tenantId, "VDU", "DeleteVdu", ErrorCode.DataError.getValue(), "Exception - DeleteVdu", ve); logger.debug(error); throw new VnfException (ve); @@ -565,6 +570,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { * is successfully created but the orchestration fails on a subsequent step. * * @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 vfModuleType VF Module type key, should match a VNF definition in catalog DB. * Deprecated - should use modelCustomizationUuid @@ -590,6 +596,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { */ @Override public void createVfModule(String cloudSiteId, + String cloudOwner, String tenantId, String vfModuleType, String vnfVersion, @@ -654,6 +661,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // 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); @@ -727,10 +735,10 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { VduInstance vduInstance = null; - CloudInfo cloudInfo = new CloudInfo (cloudSiteId, tenantId, null); + CloudInfo cloudInfo = new CloudInfo (cloudSiteId, cloudOwner, tenantId, null); // Use the VduPlugin. - VduPlugin vduPlugin = getVduPlugin(cloudSiteId); + VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner); // First, look up to see if the VF already exists, unless using multicloud adapter @@ -741,9 +749,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } catch (VduException me) { // Failed to query the VDU due to a plugin exception. - String error = "Create VF Module: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me ; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, - cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), + String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me ; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, + cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "Exception - queryVdu", me); logger.debug(error); // Convert to a generic VnfException @@ -761,12 +769,12 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { if (failIfExists != null && failIfExists) { // fail - it exists String error = - "Create VF: Deployment " + vfModuleName + " already exists in " + cloudSiteId + "/" + tenantId; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), + "Create VF: Deployment " + vfModuleName + " already exists in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "VF Module " + vfModuleName + " already exists"); logger.debug(error); - throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId()); + throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, vduInstance.getVduInstanceId()); } else { // Found existing deployment and client has not requested "failIfExists". // Populate the outputs from the existing deployment. @@ -782,42 +790,42 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // fail - it's in progress - return meaningful error String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() - + " in " + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually."; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), + + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually."; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "VF Module " + vfModuleName + " already exists"); logger.debug(error); - throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId()); + throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, vduInstance.getVduInstanceId()); } else if (status == VduStateType.FAILED) { // fail - it exists and is in a FAILED state String error = - "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in " + cloudSiteId + "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention."; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "VF Module " + vfModuleName + " already exists and is in FAILED state"); logger.debug(error); - throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId()); + throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, vduInstance.getVduInstanceId()); } else if (status == VduStateType.UNKNOWN) { // fail - it exists and is in a UNKNOWN state String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() - + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention."; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), + + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention."; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "VF Module " + vfModuleName + " already exists and is in " + status.toString() + " state"); logger.debug(error); - throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId()); + throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, vduInstance.getVduInstanceId()); } else { // Unexpected, since all known status values have been tested for String error = "Create VF: Deployment " + vfModuleName + " already exists with unexpected status " + status - .toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention."; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, - cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), + .toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention."; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, + cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(), "VF Module " + vfModuleName + " already exists and is in an unknown state"); logger.debug(error); - throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId()); + throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId, vduInstance.getVduInstanceId()); } } @@ -835,9 +843,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } catch (VduException me) { // Failed to query the Volume Group VDU due to a plugin exception. - String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudSiteId + "/" + tenantId + ": " + me ; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, - cloudSiteId, tenantId, "VDU", "queryVdu(volume)", ErrorCode.DataError.getValue(), + String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me ; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, + cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu(volume)", ErrorCode.DataError.getValue(), "Exception - queryVdu(volume)", me); logger.debug(error); // Convert to a generic VnfException @@ -846,9 +854,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } if (volumeVdu == null || volumeVdu.getStatus().getState() == VduStateType.NOTFOUND) { - String error = "Create VFModule: Attached Volume Group DOES NOT EXIST " + volumeGroupId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR" ; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, - cloudSiteId, tenantId, error, "VDU", "queryVdu(volume)", + String error = "Create VFModule: Attached Volume Group DOES NOT EXIST " + volumeGroupId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR" ; + logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId, + cloudOwner, cloudSiteId, tenantId, error, "VDU", "queryVdu(volume)", ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Attached Volume Group " + "DOES NOT EXIST"); logger.debug(error); @@ -885,9 +893,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } catch (MsoException me) { // Failed to query the Base VF Module due to a Vdu Plugin exception. - String error = "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + me ; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, - cloudSiteId, tenantId, "VDU", "queryVdu(Base)", ErrorCode.DataError.getValue(), + String error = "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me ; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, + cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu(Base)", ErrorCode.DataError.getValue(), "Exception - queryVdu(Base)", me); logger.debug(error); // Convert to a generic VnfException @@ -897,10 +905,10 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { if (baseVdu == null || baseVdu.getStatus().getState() == VduStateType.NOTFOUND) { String error = - "Create VFModule: Base Module DOES NOT EXIST " + baseVfModuleId + " in " + cloudSiteId + "/" + "Create VFModule: Base Module DOES NOT EXIST " + baseVfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR"; - logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, - cloudSiteId, tenantId, error, "VDU", "queryVdu(Base)", + logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId, + cloudOwner, cloudSiteId, tenantId, error, "VDU", "queryVdu(Base)", ErrorCode.BusinessProcesssError.getValue(), "Create VFModule: Base Module DOES NOT EXIST"); logger.debug(error); @@ -1116,22 +1124,22 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } catch (VduException me) { // Failed to instantiate the VDU. me.addContext("CreateVFModule"); - String error = "Create VF Module " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId, + String error = "Create VF Module " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; + logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner, cloudSiteId, tenantId, "VDU", ErrorCode.DataError.getValue(), "MsoException - instantiateVdu", me); logger.debug(error); // Convert to a generic VnfException throw new VnfException(me); } catch (NullPointerException npe) { - String error = "Create VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + npe; - logger.error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId, + String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + npe; + logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner, cloudSiteId, tenantId, "VDU", ErrorCode.DataError.getValue(), "NullPointerException - instantiateVdu", npe); logger.debug(error); logger.debug("NULL POINTER EXCEPTION at vduPlugin.instantiateVdu", npe); throw new VnfException("NullPointerException during instantiateVdu"); } catch (Exception e) { - String error = "Create VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + e; + String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + e; logger.debug("Unhandled exception at vduPlugin.instantiateVdu", e); logger.debug(error); throw new VnfException("Exception during instantiateVdu: " + e.getMessage()); @@ -1153,22 +1161,23 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { public void deleteVfModule (String cloudSiteId, + String cloudOwner, String tenantId, String vfModuleId, MsoRequest msoRequest, Holder <Map <String, String>> outputs) throws VnfException { - logger.debug("Deleting VF Module " + vfModuleId + " in " + cloudSiteId + "/" + tenantId); + logger.debug("Deleting VF Module " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId); // Will capture execution time for metrics long startTime = System.currentTimeMillis (); // Capture the output parameters on a delete, so need to query first VduInstance vduInstance = null; - CloudInfo cloudInfo = new CloudInfo(cloudSiteId, tenantId, null); + CloudInfo cloudInfo = new CloudInfo(cloudSiteId, cloudOwner, tenantId, null); // Use the VduPlugin. - VduPlugin vduPlugin = getVduPlugin(cloudSiteId); + VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner); try { vduInstance = vduPlugin.queryVdu (cloudInfo, vfModuleId); @@ -1177,8 +1186,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Failed to query the VDU due to a plugin exception. // Convert to a generic VnfException e.addContext("QueryVFModule"); - String error = "Query VfModule (VDU): " + vfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + e; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleId, cloudSiteId, + String error = "Query VfModule (VDU): " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + e; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleId, cloudOwner, cloudSiteId, tenantId, "VDU", "QueryVFModule", ErrorCode.DataError.getValue(), "Exception - queryVDU", e); logger.debug(error); throw new VnfException(e); @@ -1200,8 +1209,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { } catch (VduException me) { me.addContext ("DeleteVfModule"); // Convert to a generic VnfException - String error = "Delete VF: " + vfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + me; - logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudSiteId, + String error = "Delete VF: " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me; + logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner, cloudSiteId, tenantId, "VDU", "DeleteVdu", ErrorCode.DataError.getValue(), "Exception - DeleteVdu: " + me.getMessage()); logger.debug(error); @@ -1215,6 +1224,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Update VF Module not yet implemented for generic VDU plug-in model. @Override public void updateVfModule (String cloudSiteId, + String cloudOwner, String tenantId, String vnfType, String vnfVersion, @@ -1239,7 +1249,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { * defined for the target cloud. Should really be looking at the VNF Model (ochestration_mode) * but we don't currently have access to that in Query and Delete cases. */ - private VduPlugin getVduPlugin (String cloudSiteId) { + private VduPlugin getVduPlugin (String cloudSiteId, String cloudOwner) { Optional<CloudSite> cloudSiteOp = cloudConfig.getCloudSite(cloudSiteId); if (cloudSiteOp.isPresent()) { CloudSite cloudSite = cloudSiteOp.get(); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java index 33055c225e..d1a48a7c9b 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java @@ -208,7 +208,7 @@ public class VnfAdapterRest { Holder<Map<String, String>> outputs = new Holder <> (); if (cloudsite != null && !cloudsite.equals(TESTING_KEYWORD)) { //vnfAdapter.deleteVnf (req.getCloudSiteId(), req.getTenantId(), req.getVfModuleStackId(), req.getMsoRequest()); - vnfAdapter.deleteVfModule (req.getCloudSiteId(), req.getTenantId(), req.getVfModuleStackId(), req.getMsoRequest(), outputs); + vnfAdapter.deleteVfModule (req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(), req.getVfModuleStackId(), req.getMsoRequest(), outputs); } response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE, req.getMessageId(), outputs.value); } catch (VnfException e) { @@ -254,7 +254,9 @@ public class VnfAdapterRest { @PathParam("aaiVfModuleId") String aaiVfModuleId, @ApiParam(value = "cloudSiteId", required = true) @QueryParam("cloudSiteId") String cloudSiteId, - @ApiParam(value = "tenantId", required = true) + @ApiParam(value = "cloudOwner", required = true) + @QueryParam("cloudOwner") String cloudOwner, + @ApiParam(value = "tenantId", required = true) @QueryParam("tenantId") String tenantId, @ApiParam(value = "vfModuleName", required = true) @QueryParam("vfModuleName") String vfModuleName, //RAA? Id in doc @@ -276,7 +278,7 @@ public class VnfAdapterRest { Holder<String> vfModuleId = new Holder<>(); Holder<VnfStatus> status = new Holder<>(); Holder<Map<String, String>> outputs = new Holder <> (); - vnfAdapter.queryVnf (cloudSiteId, tenantId, vfModuleName, msoRequest, vnfExists, vfModuleId, status, outputs); + vnfAdapter.queryVnf (cloudSiteId, cloudOwner, tenantId, vfModuleName, msoRequest, vnfExists, vfModuleId, status, outputs); if (!vnfExists.value) { logger.debug("vfModule not found"); respStatus = HttpStatus.SC_NOT_FOUND; @@ -417,12 +419,13 @@ public class VnfAdapterRest { String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType(); logger.debug("completeVnfVfModuleType=" + completeVnfVfModuleType); String cloudsite = req.getCloudSiteId(); + String cloudOwner = req.getCloudOwner(); if (cloudsite != null && cloudsite.equals(TESTING_KEYWORD)) { String tenant = req.getTenantId(); if (tenant != null && tenant.equals(TESTING_KEYWORD)) { throw new VnfException("testing."); } - vnfRollback.value = new VnfRollback(req.getVnfId(), tenant, cloudsite, + vnfRollback.value = new VnfRollback(req.getVnfId(), tenant, cloudOwner, cloudsite, true, false, new MsoRequest("reqid", "svcid"), req.getVolumeGroupId(), req.getVolumeGroupId(), req.getRequestType(), req.getModelCustomizationUuid()); vfModuleStackId.value = "479D3D8B-6360-47BC-AB75-21CC91981484"; @@ -443,6 +446,7 @@ public class VnfAdapterRest { // outputs, // vnfRollback); vnfAdapter.createVfModule(req.getCloudSiteId(), + req.getCloudOwner(), req.getTenantId(), //req.getVnfType(), completeVnfVfModuleType, @@ -561,6 +565,7 @@ public class VnfAdapterRest { logger.debug("in updateVf - completeVnfVfModuleType=" + completeVnfVfModuleType); vnfAdapter.updateVfModule (req.getCloudSiteId(), + req.getCloudOwner(), req.getTenantId(), //req.getVnfType(), completeVnfVfModuleType, @@ -684,7 +689,7 @@ public class VnfAdapterRest { try { VfModuleRollback vmr = req.getVfModuleRollback(); VnfRollback vrb = new VnfRollback( - vmr.getVfModuleStackId(), vmr.getTenantId(), vmr.getCloudSiteId(), true, true, + vmr.getVfModuleStackId(), vmr.getTenantId(), vmr.getCloudOwner(), vmr.getCloudSiteId(), true, true, vmr.getMsoRequest(), null, null, null, null); vnfAdapter.rollbackVnf (vrb); response = new RollbackVfModuleResponse(Boolean.TRUE, req.getMessageId()); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java index 4696e43d75..41d350d765 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java @@ -213,7 +213,7 @@ public class VnfAdapterRestV2 { //vnfAdapter.deleteVnf (req.getCloudSiteId(), req.getTenantId(), req.getVfModuleStackId(), req.getMsoRequest()); // Support different Adapter Implementations MsoVnfAdapter adapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudsite); - adapter.deleteVfModule (req.getCloudSiteId(), req.getTenantId(), req.getVfModuleStackId(), req.getMsoRequest(), outputs); + adapter.deleteVfModule (req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(), req.getVfModuleStackId(), req.getMsoRequest(), outputs); } response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE, req.getMessageId(), outputs.value); } catch (VnfException e) { @@ -259,6 +259,8 @@ public class VnfAdapterRestV2 { @PathParam("aaiVfModuleId") String aaiVfModuleId, @ApiParam(value = "cloudSiteId", required = true) @QueryParam("cloudSiteId") String cloudSiteId, + @ApiParam(value = "cloudOwner", required = true) + @QueryParam("cloudOwner") String cloudOwner, @ApiParam(value = "tenantId", required = true) @QueryParam("tenantId") String tenantId, @ApiParam(value = "vfModuleName", required = true) @@ -286,7 +288,7 @@ public class VnfAdapterRestV2 { // Support different Adapter Implementations MsoVnfAdapter adapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudSiteId); - adapter.queryVnf (cloudSiteId, tenantId, vfModuleName, msoRequest, vnfExists, vfModuleId, status, outputs); + adapter.queryVnf (cloudSiteId, cloudOwner, tenantId, vfModuleName, msoRequest, vnfExists, vfModuleId, status, outputs); if (!vnfExists.value) { logger.debug("vfModule not found"); @@ -434,12 +436,13 @@ public class VnfAdapterRestV2 { logger.debug("completeVnfVfModuleType=" + completeVnfVfModuleType); String cloudsiteId = req.getCloudSiteId(); + String cloudOwner = req.getCloudOwner(); if (cloudsiteId != null && cloudsiteId.equals(TESTING_KEYWORD)) { String tenant = req.getTenantId(); if (tenant != null && tenant.equals(TESTING_KEYWORD)) { throw new VnfException("testing."); } - vnfRollback.value = new VnfRollback(req.getVnfId(), tenant, cloudsiteId, + vnfRollback.value = new VnfRollback(req.getVnfId(), tenant, cloudOwner, cloudsiteId, true, false, new MsoRequest("reqid", "svcid"), req.getVolumeGroupId(), req.getVolumeGroupId(), req.getRequestType(), req.getModelCustomizationUuid()); vfModuleStackId.value = "479D3D8B-6360-47BC-AB75-21CC91981484"; @@ -448,6 +451,7 @@ public class VnfAdapterRestV2 { // Support different Adapter Implementations MsoVnfAdapter adapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudsiteId); adapter.createVfModule(req.getCloudSiteId(), + req.getCloudOwner(), req.getTenantId(), completeVnfVfModuleType, req.getVnfVersion(), @@ -572,6 +576,7 @@ public class VnfAdapterRestV2 { // Support different Adapter Implementations MsoVnfAdapter adapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudsiteId); adapter.updateVfModule (req.getCloudSiteId(), + req.getCloudOwner(), req.getTenantId(), completeVnfVfModuleType, req.getVnfVersion(), @@ -693,7 +698,7 @@ public class VnfAdapterRestV2 { try { VfModuleRollback vmr = req.getVfModuleRollback(); VnfRollback vrb = new VnfRollback( - vmr.getVfModuleStackId(), vmr.getTenantId(), vmr.getCloudSiteId(), true, vmr.isVfModuleCreated(), + vmr.getVfModuleStackId(), vmr.getTenantId(), vmr.getCloudOwner(), vmr.getCloudSiteId(), true, vmr.isVfModuleCreated(), vmr.getMsoRequest(), null, null, null, null); // Support multiple adapter implementations diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java index bdc93f675b..e7d7b56624 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java @@ -195,6 +195,7 @@ public class VolumeAdapterRest { // vnfRollback); vnfAdapter.createVfModule( req.getCloudSiteId(), //cloudSiteId, + req.getCloudOwner(), //cloudOwner, req.getTenantId(), //tenantId, //req.getVnfType(), //vnfType, completeVnfVfModuleType, @@ -220,6 +221,7 @@ public class VolumeAdapterRest { stackId.value, true, // TODO boolean volumeGroupCreated, when would it be false? req.getTenantId(), + req.getCloudOwner(), req.getCloudSiteId(), req.getMsoRequest(), req.getMessageId()); @@ -325,7 +327,7 @@ public class VolumeAdapterRest { logger.debug("DeleteVNFVolumesTask start"); try { if (!req.getCloudSiteId().equals(TESTING_KEYWORD)) { - vnfAdapter.deleteVnf(req.getCloudSiteId(), req.getTenantId(), req.getVolumeGroupStackId(), req.getMsoRequest()); + vnfAdapter.deleteVnf(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(), req.getVolumeGroupStackId(), req.getMsoRequest()); } response = new DeleteVolumeGroupResponse(true, req.getMessageId()); } catch (VnfException e) { @@ -423,7 +425,7 @@ public class VolumeAdapterRest { try { VolumeGroupRollback vgr = req.getVolumeGroupRollback(); VnfRollback vrb = new VnfRollback( - vgr.getVolumeGroupStackId(), vgr.getTenantId(), vgr.getCloudSiteId(), true, true, + vgr.getVolumeGroupStackId(), vgr.getTenantId(), vgr.getCloudOwnerId(), vgr.getCloudSiteId(), true, true, vgr.getMsoRequest(), null, null, null, null); vnfAdapter.rollbackVnf(vrb); response = new RollbackVolumeGroupResponse(true, req.getMessageId()); @@ -542,6 +544,7 @@ public class VolumeAdapterRest { // outputs, // vnfRollback); vnfAdapter.updateVfModule (req.getCloudSiteId(), + req.getCloudOwner(), req.getTenantId(), //req.getVnfType(), completeVnfVfModuleType, @@ -587,6 +590,8 @@ public class VolumeAdapterRest { @PathParam("aaiVolumeGroupId") String aaiVolumeGroupId, @ApiParam(value = "cloudSiteId", required = true) @QueryParam("cloudSiteId") String cloudSiteId, + @ApiParam(value = "cloudOwner", required = true) + @QueryParam("cloudOwner") String cloudOwner, @ApiParam(value = "tenantId", required = true) @QueryParam("tenantId") String tenantId, @ApiParam(value = "volumeGroupStackId", required = true) @@ -619,7 +624,7 @@ public class VolumeAdapterRest { status.value = VnfStatus.ACTIVE; outputs.value = testMap(); } else { - vnfAdapter.queryVnf(cloudSiteId, tenantId, volumeGroupStackId, msoRequest, vnfExists, vfModuleId, status, outputs); + vnfAdapter.queryVnf(cloudSiteId, cloudOwner, tenantId, volumeGroupStackId, msoRequest, vnfExists, vfModuleId, status, outputs); } if (!vnfExists.value) { logger.debug("VNFVolumes not found"); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java index f38f858d7b..cbbfdf359a 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java @@ -189,6 +189,7 @@ public class VolumeAdapterRestV2 { MsoVnfAdapter vnfAdapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudsiteId); vnfAdapter.createVfModule( req.getCloudSiteId(), //cloudSiteId, + req.getCloudOwner(), //cloudOwner, req.getTenantId(), //tenantId, completeVnfVfModuleType, //vnfType, req.getVnfVersion(), //vnfVersion, @@ -214,6 +215,7 @@ public class VolumeAdapterRestV2 { stackId.value, vnfRollback.value.getVnfCreated(), req.getTenantId(), + req.getCloudOwner(), req.getCloudSiteId(), req.getMsoRequest(), req.getMessageId()); @@ -327,7 +329,7 @@ public class VolumeAdapterRestV2 { if (! cloudSiteId.equals(TESTING_KEYWORD)) { // Support different Adapter Implementations MsoVnfAdapter vnfAdapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudSiteId); - vnfAdapter.deleteVnf(req.getCloudSiteId(), req.getTenantId(), req.getVolumeGroupStackId(), req.getMsoRequest()); + vnfAdapter.deleteVnf(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(), req.getVolumeGroupStackId(), req.getMsoRequest()); } response = new DeleteVolumeGroupResponse(true, req.getMessageId()); } catch (VnfException e) { @@ -425,7 +427,7 @@ public class VolumeAdapterRestV2 { try { VolumeGroupRollback vgr = req.getVolumeGroupRollback(); VnfRollback vrb = new VnfRollback( - vgr.getVolumeGroupStackId(), vgr.getTenantId(), vgr.getCloudSiteId(), true, true, + vgr.getVolumeGroupStackId(), vgr.getTenantId(), vgr.getCloudOwnerId(), vgr.getCloudSiteId(), true, true, vgr.getMsoRequest(), null, null, null, null); // Support different Adapter Implementations @@ -541,6 +543,7 @@ public class VolumeAdapterRestV2 { // Support different Adapter Implementations MsoVnfAdapter vnfAdapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, req.getCloudSiteId()); vnfAdapter.updateVfModule (req.getCloudSiteId(), + req.getCloudOwner(), req.getTenantId(), //req.getVnfType(), completeVnfVfModuleType, @@ -586,6 +589,8 @@ public class VolumeAdapterRestV2 { @PathParam("aaiVolumeGroupId") String aaiVolumeGroupId, @ApiParam(value = "cloudSiteId", required = true) @QueryParam("cloudSiteId") String cloudSiteId, + @ApiParam(value = "cloudOwner", required = true) + @QueryParam("cloudOwner") String cloudOwner, @ApiParam(value = "tenantId", required = true) @QueryParam("tenantId") String tenantId, @ApiParam(value = "volumeGroupStackId", required = true) @@ -622,7 +627,7 @@ public class VolumeAdapterRestV2 { } else { // Support different Adapter Implementations MsoVnfAdapter vnfAdapter = vnfAdapterRestUtils.getVnfAdapterImpl(mode, cloudSiteId); - vnfAdapter.queryVnf(cloudSiteId, tenantId, volumeGroupStackId, msoRequest, vnfExists, vfModuleId, status, outputs); + vnfAdapter.queryVnf(cloudSiteId, cloudOwner, tenantId, volumeGroupStackId, msoRequest, vnfExists, vfModuleId, status, outputs); } if (!vnfExists.value) { logger.debug("VNFVolumes not found"); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/exceptions/VnfAlreadyExists.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/exceptions/VnfAlreadyExists.java index 2a7f33a682..38283aa17b 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/exceptions/VnfAlreadyExists.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/exceptions/VnfAlreadyExists.java @@ -36,7 +36,7 @@ public class VnfAlreadyExists extends VnfException { private static final long serialVersionUID = 1L; - public VnfAlreadyExists (String name, String cloudId, String tenantId, String vnfId) { - super("Resource " + name + " already exists in cloud/tenant " + cloudId + "/" + tenantId + " with ID " + vnfId); + public VnfAlreadyExists (String name, String cloudId, String cloudOwner, String tenantId, String vnfId) { + super("Resource " + name + " already exists in owner/cloud/tenant " + cloudOwner + "/" + cloudId + "/" + tenantId + " with ID " + vnfId); } } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/exceptions/VnfNotFound.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/exceptions/VnfNotFound.java index f3fa39cc2d..18d622453b 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/exceptions/VnfNotFound.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/exceptions/VnfNotFound.java @@ -35,7 +35,7 @@ public class VnfNotFound extends VnfException { private static final long serialVersionUID = 1L; - public VnfNotFound (String cloudId, String tenantId, String vnfName) { - super("Resource " + vnfName + " not found in cloud/tenant " + cloudId + "/" + tenantId); + public VnfNotFound (String cloudId, String cloudOwner, String tenantId, String vnfName) { + super("Resource " + vnfName + " not found in owner/cloud/tenant " + cloudOwner + "/" + cloudId + "/" + tenantId); } } 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 index 141be6bd7c..8f6a18225d 100644 --- 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 @@ -61,7 +61,7 @@ public class ValetClientTest extends BaseRestTestUtils { mockValetCreatePostResponse_200("requestId", mapper.writeValueAsString(vcr)); - GenericValetResponse<ValetCreateResponse> actual = client.callValetCreateRequest("requestId", "regionId", "tenantId", "serviceInstanceId", "vnfId", "vnfName", "vfModuleId", "vfModuleName", "keystoneUrl", null); + GenericValetResponse<ValetCreateResponse> actual = client.callValetCreateRequest("requestId", "regionId", "ownerId", "tenantId", "serviceInstanceId", "vnfId", "vnfName", "vfModuleId", "vfModuleName", "keystoneUrl", null); assertThat(actual, sameBeanAs(expected)); } @@ -73,7 +73,7 @@ public class ValetClientTest extends BaseRestTestUtils { mockValetCreatePutResponse_200("requestId", mapper.writeValueAsString(vur)); - GenericValetResponse<ValetUpdateResponse> actual = client.callValetUpdateRequest("requestId", "regionId", "tenantId", "serviceInstanceId", "vnfId", "vnfName", "vfModuleId", "vfModuleName", "keystoneUrl", null); + GenericValetResponse<ValetUpdateResponse> actual = client.callValetUpdateRequest("requestId", "regionId", "ownerId", "tenantId", "serviceInstanceId", "vnfId", "vnfName", "vfModuleId", "vfModuleName", "keystoneUrl", null); assertThat(actual, sameBeanAs(expected)); } @@ -85,7 +85,7 @@ public class ValetClientTest extends BaseRestTestUtils { mockValetDeleteDeleteResponse_200("requestId", mapper.writeValueAsString(vdr)); - GenericValetResponse<ValetDeleteResponse> actual = client.callValetDeleteRequest("requestId", "regionId", "tenantId", "vfModuleId", "vfModuleName"); + GenericValetResponse<ValetDeleteResponse> actual = client.callValetDeleteRequest("requestId", "regionId", "ownerId", "tenantId", "vfModuleId", "vfModuleName"); assertThat(actual, sameBeanAs(expected)); } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java index 3ebaea9c2c..cbf252ec3a 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java @@ -75,7 +75,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils { String vnfName = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"; String notificationUrl = "http://localhost:"+wireMockPort+"/notify/adapterNotify/updateVnfNotificationRequest"; - instance.createVnfA("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.createVnfA("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", "volumeGroupHeatStackId|1", new HashMap<String, Object>(), Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, "messageId", msoRequest, notificationUrl); @@ -85,7 +85,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils { @Test public void createVNFTest_Exception() throws Exception { String notificationUrl = "http://localhost:"+wireMockPort+"/notify/adapterNotify/updateVnfNotificationRequest"; - instance.createVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", + instance.createVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", "volumeGroupHeatStackId|1", new HashMap<String, Object>(), Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, "messageId", null, notificationUrl); @@ -105,7 +105,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils { (containing("messageId")) .willReturn(aResponse().withStatus(HttpStatus.SC_OK))); String notificationUrl = "http://localhost:"+wireMockPort+"/notify/adapterNotify/updateVnfNotificationRequest"; - instance.updateVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", + instance.updateVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", "volumeGroupHeatStackId|1", map, "messageId", msoRequest, notificationUrl); } @@ -122,7 +122,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils { (containing("messageId")) .willReturn(aResponse().withStatus(HttpStatus.SC_OK))); String notificationUrl = "http://localhost:"+wireMockPort+"/notify/adapterNotify/updateVnfNotificationRequest"; - instance.updateVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", + instance.updateVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", "volumeGroupHeatStackId|1", map, "messageId", msoRequest, notificationUrl); verify(1,postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest"))); @@ -133,7 +133,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils { MsoRequest msoRequest = new MsoRequest(); msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - instance.queryVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId", msoRequest, + instance.queryVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId", msoRequest, "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest"); } @@ -142,7 +142,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils { MsoRequest msoRequest = new MsoRequest(); msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - instance.deleteVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId", msoRequest, + instance.deleteVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId", msoRequest, "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest"); } @@ -150,6 +150,7 @@ public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils { public void rollbackVnfTest() { VnfRollback vnfRollBack = new VnfRollback(); vnfRollBack.setCloudSiteId("mdt1"); + vnfRollBack.setCloudOwner("CloudOwner"); vnfRollBack.setTenantId("88a6ca3ee0394ade9403f075db23167e"); vnfRollBack.setVnfId("ff5256d1-5a33-55df-13ab-12abad84e7ff"); instance.rollbackVnfA(vnfRollBack, "messageId", diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java index be3b54e23f..0816bc55a6 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java @@ -106,7 +106,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("MTN13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", + instance.createVfModule("MTN13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -126,7 +126,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -146,7 +146,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -166,7 +166,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -183,7 +183,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.TRUE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -197,7 +197,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -213,7 +213,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -232,7 +232,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -252,7 +252,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -270,7 +270,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -302,7 +302,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -339,7 +339,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "XVFMOD", + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "XVFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", null, map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -357,7 +357,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -377,7 +377,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - instance.updateVfModule("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", + instance.updateVfModule("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "vfModuleStackId", "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -390,7 +390,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { mockOpenStackResponseAccess(wireMockPort); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -407,7 +407,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -424,7 +424,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { .withStatus(HttpStatus.SC_NOT_FOUND))); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -440,7 +440,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_INTERNAL_SERVER_ERROR,"OpenstackResponse_Stack_Created_VfModule.json"); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -456,7 +456,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_NOT_FOUND,"OpenstackResponse_Stack_Created_VfModule.json"); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -472,7 +472,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -491,7 +491,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { vfModuleCustomization.getVfModule().getModuleHeatTemplate().setParameters(new HashSet<>()); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -511,7 +511,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { vfModuleCustomization.getVfModule().getModuleHeatTemplate().setParameters(new HashSet<>()); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - instance.updateVfModule("MTN13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + instance.updateVfModule("MTN13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", "b4ea86b4-253f-11e7-93ae-92361f002671", map, msoRequest, new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -523,12 +523,12 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils { Map<String, Object> outputs = new HashMap<>(); outputs.put("Key1", "value1"); - when(heatUtils.queryStackForOutputs("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12")).thenReturn(outputs); + when(heatUtils.queryStackForOutputs("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12")).thenReturn(outputs); MsoVnfAdapterImpl instance = new MsoVnfAdapterImpl(); MsoRequest msoRequest = getMsoRequest(); try { - instance.deleteVfModule("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest, + instance.deleteVfModule("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest, new Holder<Map<String, String>>()); } catch (Exception e) { diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java index 44843900fc..fbb9a224b3 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java @@ -68,7 +68,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - instance.queryVnf("siteid", "1234", "vfname", + instance.queryVnf("siteid", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new Holder<>(), new Holder<>(), new Holder<>()); } @@ -94,7 +94,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { .withBodyFile("OpenstackResponse_Access.json") .withStatus(HttpStatus.SC_OK))); - instance.queryVnf("mtn13", "1234", "vfname", + instance.queryVnf("mtn13", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new Holder<>(), new Holder<>(), new Holder<>()); } @@ -106,7 +106,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - instance.deleteVfModule("mtn13", "1234", "vfname", msoRequest, new Holder<>()); + instance.deleteVfModule("mtn13", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>()); } @Test @@ -131,7 +131,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { .withBodyFile("OpenstackResponse_Access.json") .withStatus(HttpStatus.SC_OK))); - instance.deleteVfModule("mtn13", "1234", "vfname", msoRequest, new Holder<>()); + instance.deleteVfModule("mtn13", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>()); } @Test @@ -141,7 +141,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - instance.deleteVnf("12344", "234", "vnfname", msoRequest); + instance.deleteVnf("12344", "CloudOwner", "234", "vnfname", msoRequest); } @@ -184,7 +184,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - instance.createVfModule("123", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", "123", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); + instance.createVfModule("123", "CloudOwner", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", "123", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); } @Test @@ -194,7 +194,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - instance.createVfModule("123", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", null, new + instance.createVfModule("123", "CloudOwner", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", null, new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); } @@ -205,7 +205,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - instance.createVfModule("123", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); + instance.createVfModule("123", "CloudOwner", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); } @Test @@ -215,7 +215,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - instance.createVfModule("mtn13", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); + instance.createVfModule("mtn13", "CloudOwner", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); } @Test @@ -241,7 +241,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { .withBodyFile("OpenstackResponse_Access.json") .withStatus(HttpStatus.SC_OK))); - instance.createVfModule("mtn13", "123", "vf", "v1", "", "vfname", "", "create", "3245", "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); + instance.createVfModule("mtn13", "CloudOwner", "123", "vf", "v1", "", "vfname", "", "create", "3245", "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); } @Test @@ -251,7 +251,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - instance.updateVfModule("123", "1234", "fw", "v2", "vnf1", "create", "123", "12", "233", "234", new HashMap<>(), msoRequest, new Holder<>(), new Holder<>()); + instance.updateVfModule("123", "CloudOwner", "1234", "fw", "v2", "vnf1", "create", "123", "12", "233", "234", new HashMap<>(), msoRequest, new Holder<>(), new Holder<>()); } @Test @@ -268,7 +268,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); try { - instance.createVnf("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", + instance.createVnf("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", "volumeGroupHeatStackId|1", map, Boolean.FALSE, Boolean.TRUE, Boolean.TRUE, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); @@ -286,7 +286,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { map.put("key1", "value1"); try { - instance.updateVnf("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", + instance.updateVnf("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", "volumeGroupHeatStackId|1", map, msoRequest, new Holder<>(), new Holder<>()); } catch (Exception e) { @@ -300,7 +300,7 @@ public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); try { - instance.deleteVnf("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest); + instance.deleteVnf("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest); } catch (Exception e) { } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java index 376076a0a0..342a21a49c 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java @@ -92,7 +92,7 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils{ .withBodyFile("MulticloudResponse_Stack_Create.json") .withStatus(HttpStatus.SC_CREATED))); - instance.createVfModule("MTN13", "123", "vf", "v1", "genericVnfId", "vfname", "vfModuleId", "create", null, "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", stackInputs, true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); + instance.createVfModule("MTN13", "CloudOwner", "123", "vf", "v1", "genericVnfId", "vfname", "vfModuleId", "create", null, "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", stackInputs, true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); } @Test @@ -108,7 +108,7 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils{ stubFor(delete(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/workload-id")).willReturn(aResponse() .withStatus(HttpStatus.SC_NO_CONTENT))); - instance.deleteVfModule("MTN13", "123", "workload-id", msoRequest, new Holder<>()); + instance.deleteVfModule("MTN13", "CloudOwner", "123", "workload-id", msoRequest, new Holder<>()); } @Test @@ -121,7 +121,7 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils{ .withBodyFile("MulticloudResponse_Stack.json") .withStatus(HttpStatus.SC_OK))); - instance.queryVnf("MTN13", "123", "workload-id", msoRequest, new Holder<>(), new Holder<>(), new Holder<>(), new Holder<>()); + instance.queryVnf("MTN13", "CloudOwner", "123", "workload-id", msoRequest, new Holder<>(), new Holder<>(), new Holder<>(), new Holder<>()); } // TODO Error Tests diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java index 0cd3d1a61d..3dcb52b8b7 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java @@ -58,7 +58,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", + msoVnfPluginAdapter.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", null, map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -70,7 +70,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", + msoVnfPluginAdapter.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -82,7 +82,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", + msoVnfPluginAdapter.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -96,7 +96,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - msoVnfPluginAdapter.createVfModule("MTN13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", + msoVnfPluginAdapter.createVfModule("MTN13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", null, "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -109,7 +109,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", + msoVnfPluginAdapter.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -127,7 +127,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", + msoVnfPluginAdapter.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); @@ -137,7 +137,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { public void deleteVfModule_QueryVduException() throws Exception { expectedException.expect(VnfException.class); MsoRequest msoRequest = getMsoRequest(); - msoVnfPluginAdapter.deleteVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest, + msoVnfPluginAdapter.deleteVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest, new Holder<Map<String, String>>()); } @@ -154,7 +154,7 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { .willReturn(aResponse().withHeader("Content-Type", "application/json") .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); MsoRequest msoRequest = getMsoRequest(); - msoVnfPluginAdapter.deleteVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest, + msoVnfPluginAdapter.deleteVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest, new Holder<Map<String, String>>()); } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java index 2740e254e1..232f5b3afe 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java @@ -59,8 +59,9 @@ public class QueryTest { @Test public void testQueryCreatedVnf() throws VnfException, MsoException { StackInfo info = new StackInfo("stackName", HeatStatus.CREATED); - when(heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(info); + when(heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(info); String cloudId = "MT"; + String cloudOwner = "CloudOwner"; String tenantId = "MSO_Test"; String vnfName = "VNF_TEST1"; Holder<Boolean> vnfExists = new Holder<>(); @@ -68,7 +69,7 @@ public class QueryTest { Holder<VnfStatus> status = new Holder<>(); Holder<Map<String, String>> outputs = new Holder<>(); - vnfAdapter.queryVnf(cloudId, tenantId, vnfName, null, vnfExists, vnfId, status, outputs); + vnfAdapter.queryVnf(cloudId, cloudOwner, tenantId, vnfName, null, vnfExists, vnfId, status, outputs); assertTrue(vnfExists.value); } @@ -76,8 +77,9 @@ public class QueryTest { @Test public void testQueryNotFoundVnf() throws VnfException, MsoException { StackInfo info = new StackInfo("stackName", HeatStatus.NOTFOUND); - when(heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(info); + when(heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(info); String cloudId = "MT"; + String cloudOwner = "CloudOwner"; String tenantId = "MSO_Test"; String vnfName = "VNF_TEST1"; Holder<Boolean> vnfExists = new Holder<>(); @@ -85,7 +87,7 @@ public class QueryTest { Holder<VnfStatus> status = new Holder<>(); Holder<Map<String, String>> outputs = new Holder<>(); - vnfAdapter.queryVnf(cloudId, tenantId, vnfName, null, vnfExists, vnfId, status, outputs); + vnfAdapter.queryVnf(cloudId, cloudOwner, tenantId, vnfName, null, vnfExists, vnfId, status, outputs); assertFalse(vnfExists.value); } @@ -94,6 +96,7 @@ public class QueryTest { // @Ignore // 1802 merge public void testQueryVnfWithException() throws VnfException, MsoException { String cloudId = "MT"; + String cloudOwner = "CloudOwner"; String tenantId = "MSO_Test"; String vnfName = "VNF_TEST1"; Holder<Boolean> vnfExists = new Holder<>(); @@ -102,7 +105,7 @@ public class QueryTest { Holder<Map<String, String>> outputs = new Holder<>(); thrown.expect(VnfException.class); thrown.expectCause(hasProperty("context", is("QueryVNF"))); - when(heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any())).thenThrow(new MsoOpenstackException(1, "test messsage", "test detail")); - vnfAdapter.queryVnf(cloudId, tenantId, vnfName, null, vnfExists, vnfId, status, outputs); + when(heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any())).thenThrow(new MsoOpenstackException(1, "test messsage", "test detail")); + vnfAdapter.queryVnf(cloudId, cloudOwner, tenantId, vnfName, null, vnfExists, vnfId, status, outputs); } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java index 343b6245e6..50bae8a074 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java @@ -82,6 +82,7 @@ public class VnfAdapterRestTest extends BaseRestTestUtils { private static final String MSO_REQUEST_ID = "62265093-277d-4388-9ba6-449838ade586"; private static final String MSO_SERVICE_INSTANCE_ID = "4147e06f-1b89-49c5-b21f-4faf8dc9805a"; private static final String CLOUDSITE_ID = "mtn13"; + private static final String CLOUD_OWNER = "CloudOwner"; private static final String TENANT_ID = "0422ffb57ba042c0800a29dc85ca70f8"; private static final String VNF_TYPE = "MSOTADevInfra_vSAMP10a_Service/vSAMP10a 1"; private static final String VNF_NAME = "MSO-DEV-VNF-1802-it3-pwt3-vSAMP10a-1XXX-Replace"; @@ -449,7 +450,7 @@ public class VnfAdapterRestTest extends BaseRestTestUtils { msoRequest.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); VfModuleRollback vfModuleRollback = new VfModuleRollback(AAI_VNF_ID, VF_MODULE_ID, - "StackId", false, TENANT_ID, CLOUDSITE_ID, msoRequest, "messageId"); + "StackId", false, TENANT_ID, CLOUD_OWNER, CLOUDSITE_ID, msoRequest, "messageId"); RollbackVfModuleRequest request = new RollbackVfModuleRequest(); request.setVfModuleRollback(vfModuleRollback); |