aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/VnfRollback.java25
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java53
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java11
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java57
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java69
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/VnfRollbackTest.java11
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java2
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java8
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java8
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/CloudInfo.java34
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java9
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java9
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVfModuleRequest.java9
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVolumeGroupRequest.java15
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java15
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java13
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java14
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VolumeGroupRollback.java16
-rw-r--r--adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfRollback.java25
-rw-r--r--adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml3
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java44
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java54
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/ValetClient.java119
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetCreateRequest.java25
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetDeleteRequest.java21
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetUpdateRequest.java23
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapter.java7
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsync.java16
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java24
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java183
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java94
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java130
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java15
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java13
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRest.java11
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java11
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/exceptions/VnfAlreadyExists.java4
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/exceptions/VnfNotFound.java4
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java40
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java6
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java13
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java48
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java28
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java6
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java16
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java15
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java3
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/GetResources.json407
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/NeutronPort1.json41
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/NeutronPort2.json41
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/NeutronPort3.json41
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/NeutronPort4.json41
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/NeutronPort5.json41
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/NeutronPort6.json41
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml5
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java60
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java78
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy18
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy146
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy1
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy1
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy1
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResource.java207
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResourceApplication.java55
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java156
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java148
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java141
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java36
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java23
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java167
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java153
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java149
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java158
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java151
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java152
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BPMNLogger.java37
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java61
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java28
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java37
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java18
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java5
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java8
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy9
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java4
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java6
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java2
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.spec.ts356
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.html16
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.spec.ts256
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/searchData.model.spec.ts78
109 files changed, 2193 insertions, 2836 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/VnfRollback.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/VnfRollback.java
index bb8aa92281..8da4df28b1 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/VnfRollback.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/beans/VnfRollback.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.
@@ -34,6 +34,7 @@ public class VnfRollback {
private String vnfId;
private String tenantId;
private String cloudSiteId;
+ private String cloudOwner;
private boolean tenantCreated = false;
private boolean vnfCreated = false;
private MsoRequest msoRequest;
@@ -51,10 +52,11 @@ public class VnfRollback {
/**
* For backwards compatibility... orchestration mode defaults to HEAT
- *
+ *
* @param vnfId
* @param tenantId
* @param cloudSiteId
+ * @param cloudOwner
* @param tenantCreated
* @param vnfCreated
* @param msoRequest
@@ -63,7 +65,7 @@ public class VnfRollback {
* @param requestType
* @param modelCustomizationUuid
*/
- public VnfRollback(String vnfId, String tenantId, String cloudSiteId,
+ public VnfRollback(String vnfId, String tenantId, String cloudOwner, String cloudSiteId,
boolean tenantCreated, boolean vnfCreated,
MsoRequest msoRequest,
String volumeGroupName, String volumeGroupId, String requestType, String modelCustomizationUuid) {
@@ -71,6 +73,7 @@ public class VnfRollback {
this.vnfId = vnfId;
this.tenantId = tenantId;
this.cloudSiteId = cloudSiteId;
+ this.cloudOwner = cloudOwner;
this.tenantCreated = tenantCreated;
this.vnfCreated = vnfCreated;
this.msoRequest = msoRequest;
@@ -82,10 +85,11 @@ public class VnfRollback {
/**
* For backwards compatibility... orchestration mode defaults to HEAT
- *
+ *
* @param vnfId
* @param tenantId
* @param cloudSiteId
+ * @param cloudOwner
* @param tenantCreated
* @param vnfCreated
* @param msoRequest
@@ -94,7 +98,7 @@ public class VnfRollback {
* @param requestType
* @param modelCustomizationUuid
*/
- public VnfRollback(String vnfId, String tenantId, String cloudSiteId,
+ public VnfRollback(String vnfId, String tenantId, String cloudOwner, String cloudSiteId,
boolean tenantCreated, boolean vnfCreated,
MsoRequest msoRequest, String volumeGroupName, String volumeGroupId,
String requestType, String modelCustomizationUuid, String orchestrationMode) {
@@ -102,6 +106,7 @@ public class VnfRollback {
this.vnfId = vnfId;
this.tenantId = tenantId;
this.cloudSiteId = cloudSiteId;
+ this.cloudOwner = cloudOwner;
this.tenantCreated = tenantCreated;
this.vnfCreated = vnfCreated;
this.msoRequest = msoRequest;
@@ -131,6 +136,12 @@ public class VnfRollback {
public void setCloudSiteId(String cloudId) {
this.cloudSiteId = cloudId;
}
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
public boolean getTenantCreated() {
return tenantCreated;
}
@@ -207,7 +218,7 @@ public class VnfRollback {
}
@Override
public String toString() {
- return "VnfRollback: cloud=" + cloudSiteId + ", tenant=" + tenantId +
+ return "VnfRollback: cloud=" + cloudSiteId + ", cloudOwner=" + cloudOwner + ", tenant=" + tenantId +
", vnf=" + vnfId + ", tenantCreated=" + tenantCreated +
", vnfCreated=" + vnfCreated + ", requestType = " + requestType
+ ", modelCustomizationUuid=" + this.modelCustomizationUuid
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
index 60088fc612..b6c98ad996 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
@@ -114,10 +114,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
@Autowired
private MsoTenantUtilsFactory tenantUtilsFactory;
-
+
@Autowired
private KeystoneV3Authentication keystoneV3Authentication;
-
+
private static final Logger logger = LoggerFactory.getLogger(MsoHeatUtils.class);
// Properties names and variables (with default values)
@@ -135,6 +135,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
* this method does not include environment, files, or heatFiles
*/
public StackInfo createStack (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String stackName,
String heatTemplate,
@@ -143,6 +144,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
int timeoutMinutes) throws MsoException {
// Just call the new method with the environment & files variable set to null
return this.createStack (cloudSiteId,
+ cloudOwner,
tenantId,
stackName,
heatTemplate,
@@ -157,6 +159,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
// This method has environment, but not files or heatFiles
public StackInfo createStack (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String stackName,
String heatTemplate,
@@ -166,6 +169,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
String environment) throws MsoException {
// Just call the new method with the files/heatFiles variables set to null
return this.createStack (cloudSiteId,
+ cloudOwner,
tenantId,
stackName,
heatTemplate,
@@ -180,6 +184,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
// This method has environment and files, but not heatFiles.
public StackInfo createStack (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String stackName,
String heatTemplate,
@@ -189,6 +194,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
String environment,
Map <String, Object> files) throws MsoException {
return this.createStack (cloudSiteId,
+ cloudOwner,
tenantId,
stackName,
heatTemplate,
@@ -203,6 +209,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
// This method has environment, files, heatfiles
public StackInfo createStack (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String stackName,
String heatTemplate,
@@ -213,6 +220,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
Map <String, Object> files,
Map <String, Object> heatFiles) throws MsoException {
return this.createStack (cloudSiteId,
+ cloudOwner,
tenantId,
stackName,
heatTemplate,
@@ -251,6 +259,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
* stack. We must combine them before we add them to the stack if they're both non-null.
*
* @param cloudSiteId The cloud (may be a region) in which to create the stack.
+ * @param cloudOwner the cloud owner of the cloud site in which to create the stack
* @param tenantId The Openstack ID of the tenant in which to create the Stack
* @param stackName The name of the stack to create
* @param heatTemplate The Heat template
@@ -267,6 +276,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
@SuppressWarnings("unchecked")
public StackInfo createStack (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String stackName,
String heatTemplate,
@@ -309,7 +319,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
request.header ("X-Auth-Key", CryptoUtils.decryptCloudConfigPassword(cloudIdentity.getMsoPass ()));
heatStack = executeAndRecordOpenstackRequest (request);
} catch (OpenStackResponseException e) {
- if (e.getStatus () == 409) {
+ if (e.getStatus () == 409) {
MsoStackAlreadyExists me = new MsoStackAlreadyExists (stackName, tenantId, cloudSiteId);
me.addContext (CREATE_STACK);
throw me;
@@ -317,9 +327,9 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
logger.debug("ERROR STATUS = {},\n{}\n{}", e.getStatus(), e.getMessage(), e.getLocalizedMessage());
throw heatExceptionToMsoException (e, CREATE_STACK);
}
- } catch (OpenStackConnectException e) {
+ } catch (OpenStackConnectException e) {
throw heatExceptionToMsoException (e, CREATE_STACK);
- } catch (RuntimeException e) {
+ } catch (RuntimeException e) {
throw runtimeExceptionToMsoException (e, CREATE_STACK);
}
@@ -327,7 +337,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
// Otherwise, simple query by name returns a 302 redirect.
// NOTE: This is specific to the v1 Orchestration API.
String canonicalName = stackName + "/" + heatStack.getId ();
-
+
if (pollForCompletion) {
heatStack = pollStackForCompletion(cloudSiteId, tenantId, stackName, timeoutMinutes, backout, heatClient,
heatStack, canonicalName);
@@ -360,7 +370,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
logger.debug("an error occurred trying to print out the current outputs of the stack", e);
}
- if ("CREATE_IN_PROGRESS".equals (heatStack.getStackStatus ())) {
+ if ("CREATE_IN_PROGRESS".equals (heatStack.getStackStatus ())) {
if (pollTimeout <= 0) {
logger.error("{} Cloud site: {} Tenant: {} Stack: {} Stack status: {} {} Create stack timeout",
MessageEnum.RA_CREATE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName,
@@ -544,11 +554,12 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
*
* @param tenantId The Openstack ID of the tenant in which to query
* @param cloudSiteId The cloud identifier (may be a region) in which to query
+ * @param cloudOwner the cloud owner of the cloud site in which to query
* @param stackName The name of the stack to query (may be simple or canonical)
* @return A StackInfo object
* @throws MsoOpenstackException Thrown if the Openstack API call returns an exception.
*/
- public StackInfo queryStack (String cloudSiteId, String tenantId, String stackName) throws MsoException {
+ public StackInfo queryStack (String cloudSiteId, String cloudOwner, String tenantId, String stackName) throws MsoException {
logger.debug ("Query HEAT stack: {} in tenant {}", stackName, tenantId);
// Obtain the cloud site information where we will create the stack
@@ -602,6 +613,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
* all or partially deleted, so the resulting stack must be considered invalid.
*
* @param tenantId The Openstack ID of the tenant in which to perform the delete
+ * @param cloudOwner the cloud owner of the cloud site in which to delete the stack
* @param cloudSiteId The cloud identifier (may be a region) from which to delete the stack.
* @param stackName The name/id of the stack to delete. May be simple or canonical
* @param pollForCompletion Indicator that polling should be handled in Java vs. in the client
@@ -610,6 +622,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
* @throws MsoCloudSiteNotFound
*/
public StackInfo deleteStack (String tenantId,
+ String cloudOwner,
String cloudSiteId,
String stackName,
boolean pollForCompletion) throws MsoException {
@@ -886,14 +899,14 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
if (ServerType.KEYSTONE.equals(cloudIdentity.getIdentityServerType())) {
Keystone keystoneTenantClient = new Keystone (keystoneUrl);
Access access = null;
-
+
Authentication credentials = authenticationMethodFactory.getAuthenticationFor(cloudIdentity);
-
+
OpenStackRequest <Access> request = keystoneTenantClient.tokens ()
.authenticate (credentials).withTenantId (tenantId);
-
+
access = executeAndRecordOpenstackRequest (request);
-
+
try {
// Isolate trying to printout the region IDs
try {
@@ -998,10 +1011,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
}
- public Map<String, Object> queryStackForOutputs(String cloudSiteId,
+ public Map<String, Object> queryStackForOutputs(String cloudSiteId, String cloudOwner,
String tenantId, String stackName) throws MsoException {
logger.debug("MsoHeatUtils.queryStackForOutputs)");
- StackInfo heatStack = this.queryStack(cloudSiteId, tenantId, stackName);
+ StackInfo heatStack = this.queryStack(cloudSiteId, cloudOwner, tenantId, stackName);
if (heatStack == null || heatStack.getStatus() == HeatStatus.NOTFOUND) {
return null;
}
@@ -1180,7 +1193,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
sb.append("[END]");
return sb;
}
-
+
public void copyBaseOutputsToInputs(Map<String, Object> inputs,
Map<String, Object> otherStackOutputs, List<String> paramNames, Map<String, String> aliases) {
@@ -1509,6 +1522,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
throws VduException
{
String cloudSiteId = cloudInfo.getCloudSiteId();
+ String cloudOwner = cloudInfo.getCloudOwner();
String tenantId = cloudInfo.getTenantId();
// Translate the VDU ModelInformation structure to that which is needed for
@@ -1534,6 +1548,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
try {
StackInfo stackInfo = createStack (cloudSiteId,
+ cloudOwner,
tenantId,
instanceName,
heatTemplate,
@@ -1562,11 +1577,12 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
throws VduException
{
String cloudSiteId = cloudInfo.getCloudSiteId();
+ String cloudOwner = cloudInfo.getCloudOwner();
String tenantId = cloudInfo.getTenantId();
try {
// Query the Cloudify Deployment object and populate a VduInstance
- StackInfo stackInfo = queryStack (cloudSiteId, tenantId, instanceId);
+ StackInfo stackInfo = queryStack (cloudSiteId, cloudOwner, tenantId, instanceId);
return stackInfoToVduInstance(stackInfo);
}
@@ -1584,11 +1600,12 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
throws VduException
{
String cloudSiteId = cloudInfo.getCloudSiteId();
+ String cloudOwner = cloudInfo.getCloudOwner();
String tenantId = cloudInfo.getTenantId();
try {
// Delete the Heat stack
- StackInfo stackInfo = deleteStack (tenantId, cloudSiteId, instanceId, true);
+ StackInfo stackInfo = deleteStack (tenantId, cloudOwner, cloudSiteId, instanceId, true);
// Populate a VduInstance based on the deleted Cloudify Deployment object
VduInstance vduInstance = stackInfoToVduInstance(stackInfo);
@@ -1686,7 +1703,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
return vduStatus;
}
-
+
public Resources queryStackResources(String cloudSiteId, String tenantId, String stackName) throws MsoException {
CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId)
.orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java
index d93ce9e1e1..c378be7d4b 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdate.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.
@@ -68,6 +68,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
*/
public StackInfo updateStack (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String stackName,
String heatTemplate,
@@ -77,6 +78,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
// Keeping this method to allow compatibility with no environment or files variable sent. In this case,
// simply return the new method with the environment variable set to null.
return this.updateStack (cloudSiteId,
+ cloudOwner,
tenantId,
stackName,
heatTemplate,
@@ -89,6 +91,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
}
public StackInfo updateStack (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String stackName,
String heatTemplate,
@@ -99,6 +102,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
// Keeping this method to allow compatibility with no environment variable sent. In this case,
// simply return the new method with the files variable set to null.
return this.updateStack (cloudSiteId,
+ cloudOwner,
tenantId,
stackName,
heatTemplate,
@@ -111,6 +115,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
}
public StackInfo updateStack (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String stackName,
String heatTemplate,
@@ -120,6 +125,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
String environment,
Map <String, Object> files) throws MsoException {
return this.updateStack (cloudSiteId,
+ cloudOwner,
tenantId,
stackName,
heatTemplate,
@@ -165,6 +171,7 @@ public class MsoHeatUtilsWithUpdate extends MsoHeatUtils {
*/
public StackInfo updateStack (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String stackName,
String heatTemplate,
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
index a939f79cf9..01120d51a3 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
@@ -112,7 +112,8 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
* The nested templates and get_file entries both end up being added to the "files" on the
* stack. We must combine them before we add them to the stack if they're both non-null.
*
- * @param cloudSiteId The cloud (may be a region) in which to create the stack.
+ * @param cloudSiteId The cloud (may be a region) in which to create the stack
+ * @param cloudOwner the cloud owner of the cloud site in which to create the stack
* @param tenantId The Openstack ID of the tenant in which to create the Stack
* @param stackName The name of the stack to create
* @param heatTemplate The Heat template
@@ -130,6 +131,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
@SuppressWarnings("unchecked")
@Override
public StackInfo createStack (String cloudSiteId,
+ String cloudOwner,
String tenantId,
String stackName,
String heatTemplate,
@@ -190,7 +192,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
logger.debug(String.format("Multicloud Request is: %s", multicloudRequest.toString()));
}
- String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, null);
+ String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, cloudOwner, null);
RestClient multicloudClient = getMulticloudClient(multicloudEndpoint);
if (multicloudClient == null) {
@@ -213,7 +215,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
if (logger.isDebugEnabled()) {
logger.debug("Multicloud Create Response Body: {}", multicloudResponseBody);
}
- return getStackStatus(cloudSiteId, tenantId, canonicalName, pollForCompletion, timeoutMinutes, backout);
+ return getStackStatus(cloudSiteId, cloudOwner, tenantId, canonicalName, pollForCompletion, timeoutMinutes, backout);
}
StringBuilder stackErrorStatusReason = new StringBuilder(response.getStatusInfo().getReasonPhrase());
if (null != multicloudResponseBody) {
@@ -225,10 +227,10 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
}
@Override
- public Map<String, Object> queryStackForOutputs(String cloudSiteId,
+ public Map<String, Object> queryStackForOutputs(String cloudSiteId, String cloudOwner,
String tenantId, String stackName) throws MsoException {
logger.debug("MsoHeatUtils.queryStackForOutputs)");
- StackInfo heatStack = this.queryStack(cloudSiteId, tenantId, stackName);
+ StackInfo heatStack = this.queryStack(cloudSiteId, cloudOwner, tenantId, stackName);
if (heatStack == null || heatStack.getStatus() == HeatStatus.NOTFOUND) {
return null;
}
@@ -242,12 +244,13 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
*
* @param tenantId The Openstack ID of the tenant in which to query
* @param cloudSiteId The cloud identifier (may be a region) in which to query
+ * @param cloudOwner cloud owner of the cloud site in which to query
* @param stackId The ID of the stack to query
* @return A StackInfo object
* @throws MsoOpenstackException Thrown if the Openstack API call returns an exception.
*/
@Override
- public StackInfo queryStack (String cloudSiteId, String tenantId, String instanceId) throws MsoException {
+ public StackInfo queryStack (String cloudSiteId, String cloudOwner, String tenantId, String instanceId) throws MsoException {
if (logger.isDebugEnabled()) {
logger.debug (String.format("Query multicloud HEAT stack: %s in tenant %s", instanceId, tenantId));
}
@@ -265,7 +268,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
StackInfo returnInfo = new StackInfo();
returnInfo.setName(stackName);
- String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, stackId);
+ String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, cloudOwner, stackId);
RestClient multicloudClient = getMulticloudClient(multicloudEndpoint);
if (multicloudClient != null) {
@@ -295,7 +298,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
return returnInfo;
}
- public StackInfo deleteStack (String cloudSiteId, String tenantId, String instanceId) throws MsoException {
+ public StackInfo deleteStack (String cloudSiteId, String cloudOwner, String tenantId, String instanceId) throws MsoException {
if (logger.isDebugEnabled()) {
logger.debug (String.format("Delete multicloud HEAT stack: %s in tenant %s", instanceId, tenantId));
}
@@ -314,7 +317,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
returnInfo.setName(stackName);
Response response = null;
- String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, stackId);
+ String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, cloudOwner, stackId);
RestClient multicloudClient = getMulticloudClient(multicloudEndpoint);
if (multicloudClient != null) {
@@ -327,7 +330,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
returnInfo.setStatus(HeatStatus.NOTFOUND);
returnInfo.setStatusMessage(response.getStatusInfo().getReasonPhrase());
} else if (response.getStatus() == Response.Status.NO_CONTENT.getStatusCode()) {
- return getStackStatus(cloudSiteId, tenantId, instanceId);
+ return getStackStatus(cloudSiteId, cloudOwner, tenantId, instanceId);
} else {
returnInfo.setStatus(HeatStatus.FAILED);
returnInfo.setStatusMessage(response.getStatusInfo().getReasonPhrase());
@@ -355,11 +358,11 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
return HeatStatus.UNKNOWN;
}
- private StackInfo getStackStatus(String cloudSiteId, String tenantId, String instanceId) throws MsoException {
- return getStackStatus(cloudSiteId, tenantId, instanceId, false, 0, false);
+ private StackInfo getStackStatus(String cloudSiteId, String cloudOwner, String tenantId, String instanceId) throws MsoException {
+ return getStackStatus(cloudSiteId, cloudOwner, tenantId, instanceId, false, 0, false);
}
- private StackInfo getStackStatus(String cloudSiteId, String tenantId, String instanceId, boolean pollForCompletion, int timeoutMinutes, boolean backout) throws MsoException {
+ private StackInfo getStackStatus(String cloudSiteId, String cloudOwner, String tenantId, String instanceId, boolean pollForCompletion, int timeoutMinutes, boolean backout) throws MsoException {
StackInfo stackInfo = new StackInfo();
// If client has requested a final response, poll for stack completion
@@ -379,7 +382,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
while (true) {
try {
- stackInfo = queryStack(cloudSiteId, tenantId, instanceId);
+ stackInfo = queryStack(cloudSiteId, cloudOwner, tenantId, instanceId);
logger.debug (stackInfo.getStatus() + " (" + instanceId + ")");
if (HeatStatus.BUILDING.equals(stackInfo.getStatus())) {
@@ -388,7 +391,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
if (pollTimeout <= 0) {
// Note that this should not occur, since there is a timeout specified
// in the Openstack (multicloud?) call.
- logger.error(String.format("%s %s %s %s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_TIMEOUT.toString(), cloudSiteId, tenantId, instanceId, stackInfo.getStatus(), "", "", ErrorCode.AvailabilityError.getValue(), "Create stack timeout"));
+ logger.error(String.format("%s %s %s %s %s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_TIMEOUT.toString(), cloudOwner, cloudSiteId, tenantId, instanceId, stackInfo.getStatus(), "", "", ErrorCode.AvailabilityError.getValue(), "Create stack timeout"));
createTimedOut = true;
break;
}
@@ -410,17 +413,17 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
} else {
try {
logger.debug("Create Stack error - unable to query for stack status - attempting to delete stack: " + instanceId + " - This will likely fail and/or we won't be able to query to see if delete worked");
- StackInfo deleteInfo = deleteStack(cloudSiteId, tenantId, instanceId);
+ StackInfo deleteInfo = deleteStack(cloudSiteId, cloudOwner, tenantId, instanceId);
// this may be a waste of time - if we just got an exception trying to query the stack - we'll just
// get another one, n'est-ce pas?
boolean deleted = false;
while (!deleted) {
try {
- StackInfo queryInfo = queryStack(cloudSiteId, tenantId, instanceId);
+ StackInfo queryInfo = queryStack(cloudSiteId, cloudOwner, tenantId, instanceId);
logger.debug("Deleting " + instanceId + ", status: " + queryInfo.getStatus());
if (HeatStatus.DELETING.equals(queryInfo.getStatus())) {
if (deletePollTimeout <= 0) {
- logger.error(String.format("%s %s %s %s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_TIMEOUT.toString(), cloudSiteId, tenantId, instanceId,
+ logger.error(String.format("%s %s %s %s %s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_TIMEOUT.toString(), cloudOwner, cloudSiteId, tenantId, instanceId,
queryInfo.getStatus(), "", "", ErrorCode.AvailabilityError.getValue(),
"Rollback: DELETE stack timeout"));
break;
@@ -466,15 +469,15 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
try {
logger.debug("Create Stack errored - attempting to DELETE stack: " + instanceId);
logger.debug("deletePollInterval=" + deletePollInterval + ", deletePollTimeout=" + deletePollTimeout);
- StackInfo deleteInfo = deleteStack(cloudSiteId, tenantId, instanceId);
+ StackInfo deleteInfo = deleteStack(cloudSiteId, cloudOwner, tenantId, instanceId);
boolean deleted = false;
while (!deleted) {
try {
- StackInfo queryInfo = queryStack(cloudSiteId, tenantId, instanceId);
+ StackInfo queryInfo = queryStack(cloudSiteId, cloudOwner, tenantId, instanceId);
logger.debug("Deleting " + instanceId + ", status: " + queryInfo.getStatus());
if (HeatStatus.DELETING.equals(queryInfo.getStatus())) {
if (deletePollTimeout <= 0) {
- logger.error(String.format("%s %s %s %s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_TIMEOUT.toString(), cloudSiteId, tenantId, instanceId,
+ logger.error(String.format("%s %s %s %s %s %s %s %s %d %s", MessageEnum.RA_CREATE_STACK_TIMEOUT.toString(), cloudOwner, cloudSiteId, tenantId, instanceId,
queryInfo.getStatus(), "", "", ErrorCode.AvailabilityError.getValue(),
"Rollback: DELETE stack timeout"));
break;
@@ -520,7 +523,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
}
} else {
// Get initial status, since it will have been null after the create.
- stackInfo = queryStack(cloudSiteId, tenantId, instanceId);
+ stackInfo = queryStack(cloudSiteId, cloudOwner, tenantId, instanceId);
logger.debug("Multicloud stack query status is: " + stackInfo.getStatus());
}
return stackInfo;
@@ -580,7 +583,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
return null;
}
- private String getMulticloudEndpoint(String cloudSiteId, String workloadId) throws MsoCloudSiteNotFound {
+ private String getMulticloudEndpoint(String cloudSiteId, String cloudOwner, String workloadId) throws MsoCloudSiteNotFound {
CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
String endpoint = cloudSite.getIdentityService().getIdentityUrl();
@@ -645,6 +648,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
throws VduException
{
String cloudSiteId = cloudInfo.getCloudSiteId();
+ String cloudOwner = cloudInfo.getCloudOwner();
String tenantId = cloudInfo.getTenantId();
// Translate the VDU ModelInformation structure to that which is needed for
@@ -670,6 +674,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
try {
StackInfo stackInfo = createStack (cloudSiteId,
+ cloudOwner,
tenantId,
instanceName,
heatTemplate,
@@ -697,11 +702,12 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
throws VduException
{
String cloudSiteId = cloudInfo.getCloudSiteId();
+ String cloudOwner = cloudInfo.getCloudOwner();
String tenantId = cloudInfo.getTenantId();
try {
// Query the Cloudify Deployment object and populate a VduInstance
- StackInfo stackInfo = queryStack (cloudSiteId, tenantId, instanceId);
+ StackInfo stackInfo = queryStack (cloudSiteId, cloudOwner, tenantId, instanceId);
return stackInfoToVduInstance(stackInfo);
}
@@ -719,11 +725,12 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
throws VduException
{
String cloudSiteId = cloudInfo.getCloudSiteId();
+ String cloudOwner = cloudInfo.getCloudOwner();
String tenantId = cloudInfo.getTenantId();
try {
// Delete the Multicloud stack
- StackInfo stackInfo = deleteStack (cloudSiteId, tenantId, instanceId);
+ StackInfo stackInfo = deleteStack (cloudSiteId, cloudOwner, tenantId, instanceId);
// Populate a VduInstance based on the deleted Cloudify Deployment object
VduInstance vduInstance = stackInfoToVduInstance(stackInfo);
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
index 22ce6d9781..93460ff119 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
@@ -23,21 +23,11 @@
package org.onap.so.openstack.utils;
-import com.woorea.openstack.base.client.OpenStackBaseException;
-import com.woorea.openstack.base.client.OpenStackConnectException;
-import com.woorea.openstack.base.client.OpenStackRequest;
-import com.woorea.openstack.base.client.OpenStackResponseException;
-import com.woorea.openstack.keystone.Keystone;
-import com.woorea.openstack.keystone.model.Access;
-import com.woorea.openstack.keystone.model.Authentication;
-import com.woorea.openstack.keystone.utils.KeystoneUtils;
-import com.woorea.openstack.quantum.Quantum;
-import com.woorea.openstack.quantum.model.Network;
-import com.woorea.openstack.quantum.model.Networks;
-import com.woorea.openstack.quantum.model.Segment;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
+import java.util.Optional;
+
import org.onap.so.cloud.CloudConfig;
import org.onap.so.cloud.authentication.AuthenticationMethodFactory;
import org.onap.so.cloud.authentication.KeystoneAuthHolder;
@@ -62,6 +52,20 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import com.woorea.openstack.base.client.OpenStackBaseException;
+import com.woorea.openstack.base.client.OpenStackConnectException;
+import com.woorea.openstack.base.client.OpenStackRequest;
+import com.woorea.openstack.base.client.OpenStackResponseException;
+import com.woorea.openstack.keystone.Keystone;
+import com.woorea.openstack.keystone.model.Access;
+import com.woorea.openstack.keystone.model.Authentication;
+import com.woorea.openstack.keystone.utils.KeystoneUtils;
+import com.woorea.openstack.quantum.Quantum;
+import com.woorea.openstack.quantum.model.Network;
+import com.woorea.openstack.quantum.model.Networks;
+import com.woorea.openstack.quantum.model.Port;
+import com.woorea.openstack.quantum.model.Segment;
+
@Component
public class MsoNeutronUtils extends MsoCommonUtils
{
@@ -211,6 +215,24 @@ public class MsoNeutronUtils extends MsoCommonUtils
throw me;
}
}
+
+ public Optional<Port> getNeutronPort(String neutronPortId, String tenantId, String cloudSiteId)
+ {
+ try {
+ CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow(
+ () -> new MsoCloudSiteNotFound(cloudSiteId));
+ Quantum neutronClient = getNeutronClient (cloudSite, tenantId);
+ Port port = findPortById (neutronClient, neutronPortId);
+ if (port == null) {
+ return Optional.empty();
+ }
+ return Optional.of(port);
+ }
+ catch (RuntimeException | MsoException e) {
+ logger.error("Error retrieving neutron port", e);
+ return Optional.empty();
+ }
+ }
/**
* Delete the specified Network (by ID) in the given cloud.
@@ -488,6 +510,29 @@ public class MsoNeutronUtils extends MsoCommonUtils
}
}
}
+
+
+ private Port findPortById (Quantum neutronClient, String neutronPortId)
+ {
+ if (neutronPortId == null) {
+ return null;
+ }
+
+ try {
+ OpenStackRequest<Port> request = neutronClient.ports().show(neutronPortId);
+ Port port = executeAndRecordOpenstackRequest(request);
+ return port;
+ }
+ catch (OpenStackResponseException e) {
+ if (e.getStatus() == 404) {
+ return null;
+ } else {
+ logger.error("{} {} Openstack Error, GET Neutron Port By ID ({}): ", MessageEnum.RA_CONNECTION_EXCEPTION,
+ ErrorCode.DataError.getValue(), neutronPortId, e);
+ throw e;
+ }
+ }
+ }
/*
* Find a network (or query its existence) by its Name. This method avoids an
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/VnfRollbackTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/VnfRollbackTest.java
index 163f141c5d..444a9a8e94 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/VnfRollbackTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/beans/VnfRollbackTest.java
@@ -33,6 +33,7 @@ public class VnfRollbackTest extends BaseTest {
private String vnfId = "testVnfId";
private String tenantId = "testTenantId";
+ private String cloudOwner = "testCloudOwner";
private String cloudSiteId = "testCloudSiteId";
private boolean tenantCreated = true;
private boolean vnfCreated = true;
@@ -42,16 +43,17 @@ public class VnfRollbackTest extends BaseTest {
private String requestType = "testRequestType";
private String modelCustomizationUuid = "testModelCustimizationUuid";
private String orchestrationMode = "testOrchestrationMode";
- private static final String VNF_ROLLBACK_STRING = "VnfRollback: cloud=testCloudSiteId, tenant=testTenantId, vnf=testVnfId, "
+ private static final String VNF_ROLLBACK_STRING = "VnfRollback: cloud=testCloudSiteId, cloudOwner=testCloudOwner, tenant=testTenantId, vnf=testVnfId, "
+ "tenantCreated=true, vnfCreated=true, requestType = testRequestType, modelCustomizationUuid=testModelCustimizationUuid, mode=testOrchestrationMode";
@Test
public void VnfRollbackInstantiationTest() {
- vnfRollback = new VnfRollback(vnfId, tenantId, cloudSiteId, tenantCreated, vnfCreated,
+ vnfRollback = new VnfRollback(vnfId, tenantId, cloudOwner, cloudSiteId, tenantCreated, vnfCreated,
msoRequest, volumeGroupName, volumeGroupId, requestType, modelCustomizationUuid);
assertEquals(vnfId, vnfRollback.getVnfId());
assertEquals(tenantId, vnfRollback.getTenantId());
+ assertEquals(cloudOwner, vnfRollback.getCloudOwner());
assertEquals(cloudSiteId, vnfRollback.getCloudSiteId());
assertEquals(tenantCreated, vnfRollback.getTenantCreated());
assertEquals(vnfCreated, vnfRollback.getVnfCreated());
@@ -64,11 +66,12 @@ public class VnfRollbackTest extends BaseTest {
@Test
public void VnfRollbackInstantiationOrchestrationModeTest() {
- vnfRollback = new VnfRollback(vnfId, tenantId, cloudSiteId, tenantCreated, vnfCreated,
+ vnfRollback = new VnfRollback(vnfId, tenantId, cloudOwner, cloudSiteId, tenantCreated, vnfCreated,
msoRequest, volumeGroupName, volumeGroupId, requestType, modelCustomizationUuid, orchestrationMode);
assertEquals(vnfId, vnfRollback.getVnfId());
assertEquals(tenantId, vnfRollback.getTenantId());
+ assertEquals(cloudOwner, vnfRollback.getCloudOwner());
assertEquals(cloudSiteId, vnfRollback.getCloudSiteId());
assertEquals(tenantCreated, vnfRollback.getTenantCreated());
assertEquals(vnfCreated, vnfRollback.getVnfCreated());
@@ -82,7 +85,7 @@ public class VnfRollbackTest extends BaseTest {
@Test
public void toStringTest() {
- vnfRollback = new VnfRollback(vnfId, tenantId, cloudSiteId, tenantCreated, vnfCreated,
+ vnfRollback = new VnfRollback(vnfId, tenantId, cloudOwner, cloudSiteId, tenantCreated, vnfCreated,
msoRequest, volumeGroupName, volumeGroupId, requestType, modelCustomizationUuid, orchestrationMode);
assertEquals(VNF_ROLLBACK_STRING, vnfRollback.toString());
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
index f9fc9284fe..888d376d37 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
@@ -229,7 +229,7 @@ public class MsoHeatUtilsTest extends BaseTest{
StubOpenStack.mockOpenStackResponseAccess(wireMockPort);
StubOpenStack.mockOpenStackPostStack_200("OpenstackResponse_Stack_Created.json");
StubOpenStack.mockOpenStackGet("TEST-stack/stackId");
- StackInfo stackInfo = heatUtils.createStack(cloudSite.getId(), "tenantId", "TEST-stack",
+ StackInfo stackInfo = heatUtils.createStack(cloudSite.getId(), "CloudOwner", "tenantId", "TEST-stack",
"TEST-heat", new HashMap<>(), false, 1, "TEST-env",
new HashMap<>(), new HashMap<>(), false);
assertNotNull(stackInfo);
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java
index b735e735c9..5691d9cd69 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java
@@ -67,6 +67,7 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup {
@InjectMocks
private MsoHeatUtilsWithUpdate heatUtils;
+ private String cloudOwner;
private String cloudSiteId;
private String tenantId;
private String stackName;
@@ -79,6 +80,7 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup {
public void before() {
MockitoAnnotations.initMocks(this);
+ cloudOwner = "cloudOwner";
cloudSiteId = "cloudSiteId";
tenantId = "tenantId";
stackName = "stackName";
@@ -104,7 +106,7 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup {
doReturn("0").when(environment).getProperty(isA(String.class), isA(String.class));
doReturn(updateStack).when(heatUtils).queryHeatStack(isA(Heat.class), isA(String.class));
- StackInfo actualStackInfo = heatUtils.updateStack(cloudSiteId, tenantId, stackName,
+ StackInfo actualStackInfo = heatUtils.updateStack(cloudSiteId, cloudOwner, tenantId, stackName,
heatTemplate, stackInputs, pollForCompletion, timeoutMinutes);
assertThat(actualStackInfo, sameBeanAs(expectedStackInfo));
@@ -129,7 +131,7 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup {
doReturn("0").when(environment).getProperty(isA(String.class), isA(String.class));
doReturn(updateStack).when(heatUtils).queryHeatStack(isA(Heat.class), isA(String.class));
- StackInfo actualStackInfo = heatUtils.updateStack(cloudSiteId, tenantId, stackName,
+ StackInfo actualStackInfo = heatUtils.updateStack(cloudSiteId, cloudOwner, tenantId, stackName,
heatTemplate, stackInputs, pollForCompletion, timeoutMinutes, environmentString);
assertThat(actualStackInfo, sameBeanAs(expectedStackInfo));
@@ -155,7 +157,7 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup {
doReturn("0").when(environment).getProperty(isA(String.class), isA(String.class));
doReturn(updateStack).when(heatUtils).queryHeatStack(isA(Heat.class), isA(String.class));
- StackInfo actualStackInfo = heatUtils.updateStack(cloudSiteId, tenantId, stackName,
+ StackInfo actualStackInfo = heatUtils.updateStack(cloudSiteId, cloudOwner, tenantId, stackName,
heatTemplate, stackInputs, pollForCompletion, timeoutMinutes , environmentString, files);
assertThat(actualStackInfo, sameBeanAs(expectedStackInfo));
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
index fcb651e4dd..b999b49ab1 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
@@ -64,7 +64,7 @@ public class MsoMulticloudUtilsTest extends BaseTest {
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBody(CREATE_STACK_RESPONSE)
.withStatus(HttpStatus.SC_CREATED)));
- StackInfo result = multicloudUtils.createStack("MTN13", "TEST-tenant", "TEST-stack",
+ StackInfo result = multicloudUtils.createStack("MTN13", "CloudOwner", "TEST-tenant", "TEST-stack",
"TEST-heat", new HashMap<>(), false, 200, "TEST-env",
new HashMap<>(), new HashMap<>());
assertNotNull(result);
@@ -79,7 +79,7 @@ public class MsoMulticloudUtilsTest extends BaseTest {
cloudSite.setIdentityService(new CloudIdentity());
when(cloudConfigMock.getCloudSite("MTN13")).
thenReturn(Optional.of(cloudSite));
- multicloudUtilsMock.createStack("MTN13", "TEST-tenant", "TEST-stack",
+ multicloudUtilsMock.createStack("MTN13", "CloudOwner", "TEST-tenant", "TEST-stack",
"TEST-heat", new HashMap<>(), false, 200, "TEST-env",
new HashMap<>(), new HashMap<>());
} catch (MsoException e) {
@@ -95,7 +95,7 @@ public class MsoMulticloudUtilsTest extends BaseTest {
stubFor(post(urlPathEqualTo("/v2.0"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withStatus(HttpStatus.SC_BAD_REQUEST)));
- multicloudUtils.createStack("MTN13", "TEST-tenant", "TEST-stack",
+ multicloudUtils.createStack("MTN13", "CloudOwner", "TEST-tenant", "TEST-stack",
"TEST-heat", new HashMap<>(), false, 200, "TEST-env",
new HashMap<>(), new HashMap<>());
} catch (MsoException e) {
@@ -110,7 +110,7 @@ public class MsoMulticloudUtilsTest extends BaseTest {
stubFor(post(urlPathEqualTo("/v2.0"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withStatus(HttpStatus.SC_CREATED)));
- StackInfo result = multicloudUtils.createStack("MTN13", "TEST-tenant", "TEST-stack",
+ StackInfo result = multicloudUtils.createStack("MTN13", "CloudOwner", "TEST-tenant", "TEST-stack",
"TEST-heat", new HashMap<>(), false, 200, "TEST-env",
new HashMap<>(), new HashMap<>());
assertNotNull(result);
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/CloudInfo.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/CloudInfo.java
index a56a6929a9..f7db785deb 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/CloudInfo.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vdu/CloudInfo.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.
@@ -22,36 +22,44 @@ package org.onap.so.adapters.vdu;
/**
* Cloud information structure for deploying/managing a VDU. Includes the cloud site
- * as well as tenant information within the site. Currently this is defined as a
+ * as well as tenant information within the site. Currently this is defined as a
* cloud site ID. which would map to a CloudConfig entry.
* Perhaps the CloudConfig entry itself should be provided, instead of requiring each
* plug-in to query it.
- *
+ *
* The meaning of 'tenant' may differ by cloud provider, but every cloud supports some
* sort of tenant partitioning.
- *
+ *
*/
public class CloudInfo {
-
+
private String cloudSiteId;
- private String tenantId;
+ private String cloudOwner;
+ private String tenantId;
private String tenantName;//bpmn query and pass
-
+
public CloudInfo() {
}
-
- public CloudInfo (String cloudSiteId, String tenantId, String tenantName) {
+
+ public CloudInfo (String cloudSiteId, String cloudOwner, String tenantId, String tenantName) {
this.cloudSiteId = cloudSiteId;
+ this.cloudOwner = cloudOwner;
this.tenantId = tenantId;
this.tenantName = tenantName;
}
-
+
public String getCloudSiteId() {
return cloudSiteId;
}
public void setCloudSiteId(String cloudSiteId) {
this.cloudSiteId = cloudSiteId;
}
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
public String getTenantId() {
return tenantId;
}
@@ -64,6 +72,6 @@ public class CloudInfo {
public void setTenantName(String tenantName) {
this.tenantName = tenantName;
}
-
-
+
+
} \ No newline at end of file
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java
index a136ff778d..80e0a95b27 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVfModuleRequest.java
@@ -43,6 +43,7 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@XmlAccessorType(XmlAccessType.FIELD)
public class CreateVfModuleRequest extends VfRequestCommon {
private String cloudSiteId;
+ private String cloudOwner;
private String tenantId;
private String vnfId;
@@ -75,6 +76,14 @@ public class CreateVfModuleRequest extends VfRequestCommon {
this.cloudSiteId = cloudSiteId;
}
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
public String getTenantId() {
return tenantId;
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java
index d402004d57..a1443f569a 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/CreateVolumeGroupRequest.java
@@ -39,6 +39,7 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@XmlAccessorType(XmlAccessType.FIELD)
public class CreateVolumeGroupRequest extends VfRequestCommon {
private String cloudSiteId;
+ private String cloudOwner;
private String tenantId;
private String volumeGroupName;
private String volumeGroupId;
@@ -65,6 +66,14 @@ public class CreateVolumeGroupRequest extends VfRequestCommon {
this.cloudSiteId = cloudSiteId;
}
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
public String getTenantId() {
return tenantId;
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVfModuleRequest.java
index 6ce9b2fa4c..d9825ddca2 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVfModuleRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVfModuleRequest.java
@@ -37,6 +37,7 @@ public class DeleteVfModuleRequest extends VfRequestCommon implements Serializab
*/
private static final long serialVersionUID = -8504083539107392561L;
private String cloudSiteId;
+ private String cloudOwner;
private String tenantId;
private String vnfId;
private String vfModuleId;
@@ -56,6 +57,14 @@ public class DeleteVfModuleRequest extends VfRequestCommon implements Serializab
this.cloudSiteId = cloudSiteId;
}
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
public String getTenantId() {
return tenantId;
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVolumeGroupRequest.java
index d17c5dd0de..aba53a4dd3 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVolumeGroupRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/DeleteVolumeGroupRequest.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.
@@ -32,6 +32,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
@XmlRootElement(name = "deleteVolumeGroupRequest")
public class DeleteVolumeGroupRequest extends VfRequestCommon {
private String cloudSiteId;
+ private String cloudOwner;
private String tenantId;
private String volumeGroupId;
private String volumeGroupStackId;
@@ -49,6 +50,14 @@ public class DeleteVolumeGroupRequest extends VfRequestCommon {
this.cloudSiteId = cloudSiteId;
}
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
public String getTenantId() {
return tenantId;
}
@@ -80,7 +89,7 @@ public class DeleteVolumeGroupRequest extends VfRequestCommon {
public void setMsoRequest(MsoRequest msoRequest) {
this.msoRequest = msoRequest;
}
-
+
@Override
public String toString() {
return new ToStringBuilder(this).appendSuper(super.toString()).append("cloudSiteId", cloudSiteId)
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java
index bac9eae2c5..a02dc1f94e 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVfModuleRequest.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.
@@ -40,6 +40,7 @@ import com.fasterxml.jackson.annotation.JsonRootName;
public class UpdateVfModuleRequest extends VfRequestCommon {
private String cloudSiteId;
+ private String cloudOwner;
private String tenantId;
private String vnfId;
@@ -62,7 +63,7 @@ public class UpdateVfModuleRequest extends VfRequestCommon {
private String requestType;
private Boolean failIfExists;
private Boolean backout;
-
+
@XmlJavaTypeAdapter(MapAdapter.class)
private Map<String,Object> vfModuleParams = new HashMap<>();
private MsoRequest msoRequest = new MsoRequest();
@@ -75,6 +76,14 @@ public class UpdateVfModuleRequest extends VfRequestCommon {
this.cloudSiteId = cloudSiteId;
}
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
public String getTenantId() {
return tenantId;
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java
index d3b685a1d0..e7c8171d6c 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/UpdateVolumeGroupRequest.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.
@@ -39,6 +39,7 @@ import com.fasterxml.jackson.annotation.JsonRootName;
@XmlAccessorType(XmlAccessType.FIELD)
public class UpdateVolumeGroupRequest extends VfRequestCommon {
private String cloudSiteId;
+ private String cloudOwner;
private String tenantId;
private String volumeGroupId;
private String volumeGroupStackId;
@@ -62,6 +63,14 @@ public class UpdateVolumeGroupRequest extends VfRequestCommon {
this.cloudSiteId = cloudSiteId;
}
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
public String getTenantId() {
return tenantId;
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java
index 0e716e5924..a6a988690c 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VfModuleRollback.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.
@@ -36,6 +36,7 @@ public class VfModuleRollback {
private String vfModuleStackId;
private boolean vfModuleCreated = false;
private String tenantId;
+ private String cloudOwner;
private String cloudSiteId;
private MsoRequest msoRequest;
private String messageId;
@@ -51,6 +52,7 @@ public class VfModuleRollback {
this.vfModuleStackId = vfModuleStackId;
this.vfModuleCreated = vrb.getVnfCreated();
this.tenantId = vrb.getTenantId();
+ this.cloudOwner = vrb.getCloudOwner();
this.cloudSiteId = vrb.getCloudSiteId();
this.msoRequest = vrb.getMsoRequest();
this.messageId = messageId;
@@ -59,6 +61,7 @@ public class VfModuleRollback {
public VfModuleRollback(String vnfId, String vfModuleId,
String vfModuleStackId, boolean vfModuleCreated, String tenantId,
+ String cloudOwner,
String cloudSiteId,
MsoRequest msoRequest,
String messageId) {
@@ -68,6 +71,7 @@ public class VfModuleRollback {
this.vfModuleStackId = vfModuleStackId;
this.vfModuleCreated = vfModuleCreated;
this.tenantId = tenantId;
+ this.cloudOwner = cloudOwner;
this.cloudSiteId = cloudSiteId;
this.msoRequest = msoRequest;
this.messageId = messageId;
@@ -109,6 +113,12 @@ public class VfModuleRollback {
public void setCloudSiteId(String cloudSiteId) {
this.cloudSiteId = cloudSiteId;
}
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
public MsoRequest getMsoRequest() {
return msoRequest;
}
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VolumeGroupRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VolumeGroupRollback.java
index 2795ba0de3..ea7ce582ad 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VolumeGroupRollback.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/adapters/vnfrest/VolumeGroupRollback.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.
@@ -34,6 +34,7 @@ public class VolumeGroupRollback {
// “volumeGroupId”: “<A&AI_ VOLUME_GROUP_ID>”,
// “volumeGroupStackId”: “<VOLUME_GROUP _STACK_ID>”,
// “tenantId”: “<TENANT_ID>”,
+// "cloudOwnerId"" "<CLOUD_OWNER>",
// “cloudSiteId”: “<CLOUD_CLLI>”,
// “volumeGroupCreated”: TRUE|FALSE,
// “msoRequest”: {
@@ -45,6 +46,7 @@ public class VolumeGroupRollback {
private String volumeGroupId;
private String volumeGroupStackId;
private String tenantId;
+ private String cloudOwnerId;
private String cloudSiteId;
private boolean volumeGroupCreated = false;
private MsoRequest msoRequest;
@@ -58,6 +60,7 @@ public class VolumeGroupRollback {
this.volumeGroupId = vrb.getVolumeGroupId();
this.volumeGroupStackId = volumeGroupStackId;
this.tenantId = vrb.getTenantId();
+ this.cloudOwnerId = vrb.getCloudOwnerId();
this.cloudSiteId = vrb.getCloudSiteId();
this.volumeGroupCreated = vrb.isVolumeGroupCreated();
this.msoRequest = vrb.getMsoRequest();
@@ -69,6 +72,7 @@ public class VolumeGroupRollback {
String volumeGroupStackId,
boolean volumeGroupCreated,
String tenantId,
+ String cloudOwnerId,
String cloudSiteId,
MsoRequest msoRequest,
String messageId)
@@ -78,6 +82,7 @@ public class VolumeGroupRollback {
this.volumeGroupStackId = volumeGroupStackId;
this.volumeGroupCreated = volumeGroupCreated;
this.tenantId = tenantId;
+ this.cloudOwnerId = cloudOwnerId;
this.cloudSiteId = cloudSiteId;
this.msoRequest = msoRequest;
this.messageId = messageId;
@@ -107,7 +112,12 @@ public class VolumeGroupRollback {
public void setCloudSiteId(String cloudSiteId) {
this.cloudSiteId = cloudSiteId;
}
- public boolean isVolumeGroupCreated() {
+ public String getCloudOwnerId() {
+ return cloudOwnerId;
+ }
+ public void setCloudOwnerId(String cloudOwnerId) {
+ this.cloudOwnerId = cloudOwnerId;
+ }public boolean isVolumeGroupCreated() {
return volumeGroupCreated;
}
public void setVolumeGroupCreated(boolean volumeGroupCreated) {
diff --git a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfRollback.java b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfRollback.java
index ba7f6532e1..1c7164a0a0 100644
--- a/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfRollback.java
+++ b/adapters/mso-adapters-rest-interface/src/main/java/org/onap/so/openstack/beans/VnfRollback.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.
@@ -31,6 +31,7 @@ import org.onap.so.entity.MsoRequest;
public class VnfRollback {
private String vnfId;
private String tenantId;
+ private String cloudOwner;
private String cloudSiteId;
private boolean tenantCreated = false;
private boolean vnfCreated = false;
@@ -49,9 +50,10 @@ public class VnfRollback {
/**
* For backwards compatibility... orchestration mode defaults to HEAT
- *
+ *
* @param vnfId
* @param tenantId
+ * @param cloudOwner
* @param cloudSiteId
* @param tenantCreated
* @param vnfCreated
@@ -61,13 +63,14 @@ public class VnfRollback {
* @param requestType
* @param modelCustomizationUuid
*/
- public VnfRollback(String vnfId, String tenantId, String cloudSiteId,
+ public VnfRollback(String vnfId, String tenantId, String cloudOwner, String cloudSiteId,
boolean tenantCreated, boolean vnfCreated,
MsoRequest msoRequest,
String volumeGroupName, String volumeGroupId, String requestType, String modelCustomizationUuid) {
super();
this.vnfId = vnfId;
this.tenantId = tenantId;
+ this.cloudOwner = cloudOwner;
this.cloudSiteId = cloudSiteId;
this.tenantCreated = tenantCreated;
this.vnfCreated = vnfCreated;
@@ -79,9 +82,10 @@ public class VnfRollback {
}
/**
- *
+ *
* @param vnfId
* @param tenantId
+ * @param cloudOwner
* @param cloudSiteId
* @param tenantCreated
* @param vnfCreated
@@ -91,13 +95,14 @@ public class VnfRollback {
* @param requestType
* @param modelCustomizationUuid
*/
- public VnfRollback(String vnfId, String tenantId, String cloudSiteId,
+ public VnfRollback(String vnfId, String tenantId, String cloudOwner, String cloudSiteId,
boolean tenantCreated, boolean vnfCreated,
MsoRequest msoRequest, String volumeGroupName, String volumeGroupId,
String requestType, String modelCustomizationUuid, String orchestrationMode) {
super();
this.vnfId = vnfId;
this.tenantId = tenantId;
+ this.cloudOwner = cloudOwner;
this.cloudSiteId = cloudSiteId;
this.tenantCreated = tenantCreated;
this.vnfCreated = vnfCreated;
@@ -128,6 +133,12 @@ public class VnfRollback {
public void setCloudSiteId(String cloudId) {
this.cloudSiteId = cloudId;
}
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
public boolean getTenantCreated() {
return tenantCreated;
}
@@ -204,7 +215,7 @@ public class VnfRollback {
}
@Override
public String toString() {
- return "VnfRollback: cloud=" + cloudSiteId + ", tenant=" + tenantId +
+ return "VnfRollback: owner=" + cloudOwner + ", cloud=" + cloudSiteId + ", tenant=" + tenantId +
", vnf=" + vnfId + ", tenantCreated=" + tenantCreated +
", vnfCreated=" + vnfCreated + ", requestType = " + requestType
+ ", modelCustomizationUuid=" + this.modelCustomizationUuid
diff --git a/adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml b/adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml
index 76ba3695f2..1ff24a50f6 100644
--- a/adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml
+++ b/adapters/mso-adapters-rest-interface/src/test/resources/createVfModuleRequest-with-params.xml
@@ -1,5 +1,6 @@
<createVfModuleRequest>
<cloudSiteId>RegionOne</cloudSiteId>
+ <cloudOwner>CloudOwner</cloudOwner>
<tenantId>09d8566ea45e43aa974cf447ed591d77</tenantId>
<vnfId>8daea639-82b9-4da6-aec9-5054f006a82d</vnfId>
<vnfName>vcpe_vnf_vcpe_infra_201903101808</vnfName>
@@ -203,4 +204,4 @@
</msoRequest>
<messageId>11c8ec20-a1f8-4aa2-926f-e55d67a30f8b-1552241542248</messageId>
<notificationUrl>http://so-bpmn-infra.onap:8081/mso/WorkflowMessage/VNFAResponse/11c8ec20-a1f8-4aa2-926f-e55d67a30f8b-1552241542248</notificationUrl>
-</createVfModuleRequest> \ No newline at end of file
+</createVfModuleRequest>
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
index 19e3ab71f5..72dee07379 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
@@ -34,6 +34,7 @@ import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.LInterfaces;
import org.onap.aai.domain.yang.Vserver;
import org.onap.so.openstack.utils.MsoHeatUtils;
+import org.onap.so.openstack.utils.MsoNeutronUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -43,6 +44,7 @@ import com.woorea.openstack.heat.model.Link;
import com.woorea.openstack.heat.model.Resource;
import com.woorea.openstack.heat.model.Resources;
import com.woorea.openstack.heat.model.Stack;
+import com.woorea.openstack.quantum.model.Port;
@Component
public class HeatStackAudit {
@@ -55,6 +57,9 @@ public class HeatStackAudit {
protected MsoHeatUtils heat;
@Autowired
+ protected MsoNeutronUtils neutron;
+
+ @Autowired
protected AuditVServer auditVservers;
public boolean auditHeatStackCreate(String cloudRegion, String cloudOwner, String tenantId, String heatStackName) {
@@ -82,8 +87,9 @@ public class HeatStackAudit {
if(novaResources.isEmpty())
return true;
else{
+ List<Optional<Port>> neutronPortDetails = retrieveNeutronPortDetails(resources,cloudRegion,tenantId);
List<Resource> resourceGroups = extractResourceGroups(resources);
- Set<Vserver> vserversToAudit = createVserverSet(resources, novaResources);
+ Set<Vserver> vserversToAudit = createVserverSet(resources, novaResources,neutronPortDetails);
Set<Vserver> vserversWithSubInterfaces = processSubInterfaces(cloudRegion, tenantId, resourceGroups,
vserversToAudit);
if(isCreateAudit){
@@ -186,18 +192,16 @@ public class HeatStackAudit {
lInterface.getInterfaceId(),subinterfaceStack.getId());
}
- protected Set<Vserver> createVserverSet(Resources resources, List<Resource> novaResources) {
+ protected Set<Vserver> createVserverSet(Resources resources, List<Resource> novaResources, List<Optional<Port>> neutronPortDetails) {
Set<Vserver> vserversToAudit = new HashSet<>();
for (Resource novaResource : novaResources) {
Vserver auditVserver = new Vserver();
auditVserver.setLInterfaces(new LInterfaces());
auditVserver.setVserverId(novaResource.getPhysicalResourceId());
- Stream<Resource> filteredNeutronNetworks = resources.getList().stream()
- .filter(resource -> resource.getRequiredBy().contains(novaResource.getLogicalResourceId()))
- .filter(resource -> "OS::Neutron::Port".equals(resource.getType()));
- filteredNeutronNetworks.forEach(network -> {
+ Stream<Port> filteredNeutronPorts = filterNeutronPorts(novaResource, neutronPortDetails);
+ filteredNeutronPorts.forEach(port -> {
LInterface lInterface = new LInterface();
- lInterface.setInterfaceId(network.getPhysicalResourceId());
+ lInterface.setInterfaceId(port.getId());
auditVserver.getLInterfaces().getLInterface().add(lInterface);
});
vserversToAudit.add(auditVserver);
@@ -205,6 +209,31 @@ public class HeatStackAudit {
return vserversToAudit;
}
+ /**
+ * @param novaResource Single openstack resource that is of type Nova
+ * @param neutronPorts List of Neutron ports created within the stack
+ * @return Filtered list of neutron ports taht relate to the nova server in openstack
+ */
+ protected Stream<Port> filterNeutronPorts(Resource novaResource, List<Optional<Port>> neutronPorts) {
+ List<Port> filteredNeutronPorts = neutronPorts.stream().filter(Optional::isPresent).map(Optional::get)
+ .collect(Collectors.toList());
+ return filteredNeutronPorts.stream()
+ .filter(port -> port.getDeviceId().equalsIgnoreCase(novaResource.getPhysicalResourceId()));
+ }
+
+ /**
+ * @param resources Resource stream created by the stack in openstack
+ * @param cloudSiteId Unique site id to identify which openstack we talk to
+ * @param tenantId The tenant within the cloud we are talking to where resouces exist
+ * @return List of optional neutron ports found within the cloud site and tenant
+ */
+ protected List<Optional<Port>> retrieveNeutronPortDetails(Resources resources,String cloudSiteId,String tenantId){
+ return resources.getList().stream()
+ .filter(resource -> "OS::Neutron::Port".equals(resource.getType()))
+ .map(resource -> neutron.getNeutronPort(resource.getPhysicalResourceId(),cloudSiteId,tenantId)).collect(Collectors.toList());
+
+ }
+
protected Optional<String> extractResourcePathFromHref(String href) {
try {
Optional<String> stackPath = extractStackPathFromHref(href);
@@ -234,3 +263,4 @@ public class HeatStackAudit {
}
}
+
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/audit/HeatStackAuditTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java
index 5eea46d09f..987e4cf76d 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java
@@ -26,6 +26,7 @@ import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.doReturn;
import java.io.File;
+import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
@@ -42,6 +43,7 @@ import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.LInterfaces;
import org.onap.aai.domain.yang.Vserver;
import org.onap.so.openstack.utils.MsoHeatUtils;
+import org.onap.so.openstack.utils.MsoNeutronUtils;
import org.skyscreamer.jsonassert.JSONAssert;
import com.fasterxml.jackson.databind.DeserializationFeature;
@@ -49,6 +51,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.woorea.openstack.heat.model.Resource;
import com.woorea.openstack.heat.model.Resources;
import com.woorea.openstack.heat.model.Stack;
+import com.woorea.openstack.quantum.model.Port;
@RunWith(MockitoJUnitRunner.Silent.class)
@@ -61,6 +64,9 @@ public class HeatStackAuditTest extends HeatStackAudit {
private MsoHeatUtils msoHeatUtilsMock;
@Mock
+ private MsoNeutronUtils neutronUtilsMock;
+
+ @Mock
private AuditVServer auditVserver;
private static final String cloudRegion = "cloudRegion";
@@ -72,10 +78,32 @@ public class HeatStackAuditTest extends HeatStackAudit {
private ObjectMapper stackObjectMapper = new ObjectMapper().configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
+ private List<Optional<Port>> portList = new ArrayList<>();
+
@Before
public void setup() throws Exception{
resources= objectMapper.readValue(new File("src/test/resources/GetResources.json"), Resources.class);
+ Port neutronPort1 =stackObjectMapper.readValue(new File("src/test/resources/NeutronPort1.json"), Port.class);
+ doReturn(Optional.of(neutronPort1)).when(neutronUtilsMock).getNeutronPort("7ee06d9d-3d18-411c-9d3e-aec930f70413", cloudRegion,tenantId);
+ Port neutronPort2 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort2.json"), Port.class);
+ doReturn(Optional.of(neutronPort2)).when(neutronUtilsMock).getNeutronPort("27391d94-33af-474a-927d-d409249e8fd3", cloudRegion,tenantId);
+ Port neutronPort3 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort3.json"), Port.class);
+ doReturn(Optional.of(neutronPort3)).when(neutronUtilsMock).getNeutronPort("fdeedf37-c01e-4ab0-bdd6-8d5fc4913943", cloudRegion,tenantId);
+ Port neutronPort4 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort4.json"), Port.class);
+ doReturn(Optional.of(neutronPort4)).when(neutronUtilsMock).getNeutronPort("8d93f63e-e972-48c7-ad98-b2122da47315", cloudRegion,tenantId);
+ Port neutronPort5 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort5.json"), Port.class);
+ doReturn(Optional.of(neutronPort5)).when(neutronUtilsMock).getNeutronPort("0594a2f2-7ea4-42eb-abc2-48ea49677fca", cloudRegion,tenantId);
+ Port neutronPort6 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort6.json"), Port.class);
+ doReturn(Optional.of(neutronPort6)).when(neutronUtilsMock).getNeutronPort("00bb8407-650e-48b5-b919-33b88d6f8fe3", cloudRegion,tenantId);
+
+ portList.add(Optional.empty());
+ portList.add(Optional.of(neutronPort1));
+ portList.add(Optional.of(neutronPort2));
+ portList.add(Optional.of(neutronPort3));
+ portList.add(Optional.of(neutronPort4));
+ portList.add(Optional.of(neutronPort5));
+ portList.add(Optional.of(neutronPort6));
}
@Test
@@ -111,13 +139,13 @@ public class HeatStackAuditTest extends HeatStackAudit {
vServer1.setLInterfaces(vServer1Linterfaces);
LInterface ssc_1_trusted_port_0 = new LInterface();
- ssc_1_trusted_port_0.setInterfaceId("d2f51f82-0ec2-4581-bd1a-d2a82073e52b");
+ ssc_1_trusted_port_0.setInterfaceId("7ee06d9d-3d18-411c-9d3e-aec930f70413");
vServer1.getLInterfaces().getLInterface().add(ssc_1_trusted_port_0);
LInterface ssc_1_mgmt_port_1 = new LInterface();
- ssc_1_mgmt_port_1.setInterfaceId("07f5b14c-147a-4d14-8c94-a9e94dbc097b");
+ ssc_1_mgmt_port_1.setInterfaceId("fdeedf37-c01e-4ab0-bdd6-8d5fc4913943");
vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_1);
LInterface ssc_1_mgmt_port_0 = new LInterface();
@@ -187,7 +215,7 @@ public class HeatStackAuditTest extends HeatStackAudit {
Resources service1ResourceQuerySubInt3 = objectMapper.readValue(new File("src/test/resources/Service1SubInterface2Resources.json"), Resources.class);
doReturn(service1ResourceQuerySubInt3).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675c/resources", cloudRegion,tenantId, Resources.class);
- Set<Vserver> vServersToAudit = heatStackAudit.createVserverSet(resources, novaResources);
+ Set<Vserver> vServersToAudit = heatStackAudit.createVserverSet(resources, novaResources,portList);
Set<Vserver> vserversWithSubInterfaces = heatStackAudit.processSubInterfaces(cloudRegion,tenantId,resourceGroups, vServersToAudit);
String actualValue = objectMapper.writeValueAsString(vserversWithSubInterfaces);
@@ -219,7 +247,7 @@ public class HeatStackAuditTest extends HeatStackAudit {
vServer1.setLInterfaces(vServer1Linterfaces);
LInterface ssc_1_trusted_port_0 = new LInterface();
- ssc_1_trusted_port_0.setInterfaceId("d2f51f82-0ec2-4581-bd1a-d2a82073e52b");
+ ssc_1_trusted_port_0.setInterfaceId("7ee06d9d-3d18-411c-9d3e-aec930f70413");
vServer1.getLInterfaces().getLInterface().add(ssc_1_trusted_port_0);
LInterface ssc_1_service1_port_0 = new LInterface();
@@ -227,7 +255,7 @@ public class HeatStackAuditTest extends HeatStackAudit {
vServer1.getLInterfaces().getLInterface().add(ssc_1_service1_port_0);
LInterface ssc_1_mgmt_port_1 = new LInterface();
- ssc_1_mgmt_port_1.setInterfaceId("07f5b14c-147a-4d14-8c94-a9e94dbc097b");
+ ssc_1_mgmt_port_1.setInterfaceId("fdeedf37-c01e-4ab0-bdd6-8d5fc4913943");
vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_1);
LInterface ssc_1_mgmt_port_0 = new LInterface();
@@ -244,7 +272,7 @@ public class HeatStackAuditTest extends HeatStackAudit {
expectedVservers.add(vServer1);
- Set<Vserver> actualVservers = heatStackAudit.createVserverSet(resources, novaResources);
+ Set<Vserver> actualVservers = heatStackAudit.createVserverSet(resources, novaResources,portList);
assertThat(actualVservers, sameBeanAs(expectedVservers));
}
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);
diff --git a/adapters/mso-openstack-adapters/src/test/resources/GetResources.json b/adapters/mso-openstack-adapters/src/test/resources/GetResources.json
index 22e66d41bb..3366ce4a05 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/GetResources.json
+++ b/adapters/mso-openstack-adapters/src/test/resources/GetResources.json
@@ -1,6 +1,6 @@
{
- "resources": [
- {
+ "resources": [
+ {
"links": [
{
"href": "https://orchestration.com:8004/v1/99cecb7b19dc4690960761abd0fe2413/stacks/zdyh3brlba05_addon/03840be2-7ce6-4e38-a748-dbd59a798732/resources/vlbagent_eph_aff_id",
@@ -22,207 +22,208 @@
"resource_type": "OS::Heat::RandomString",
"updated_time": "2019-02-07T22:56:12Z"
},
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_trusted_port_0",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_1_trusted_port_0",
+ "physical_resource_id": "7ee06d9d-3d18-411c-9d3e-aec930f70413",
+ "required_by": [
+ "ssc_server_1"
+ ],
+ "resource_name": "ssc_1_trusted_port_0",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Neutron::Port",
+ "updated_time": "2019-01-23T19:34:15Z"
+ },
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_service1_port_0",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_1_service1_port_0",
+ "physical_resource_id": "36551a08-592c-4329-ab75-6c594420754c",
+ "required_by": [
+ "ssc_1_subint_service1_port_0_subinterfaces",
+ "ssc_server_1"
+ ],
+ "resource_name": "ssc_1_service1_port_0",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Neutron::Port",
+ "updated_time": "2019-01-23T19:34:15Z"
+ },
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_subint_service2_port_0_subinterfaces",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst/447a9b41-714e-434b-b1d0-6cce8d9f0f0c",
+ "rel": "nested"
+ }
+ ],
+ "logical_resource_id": "ssc_1_subint_service2_port_0_subinterfaces",
+ "physical_resource_id": "447a9b41-714e-434b-b1d0-6cce8d9f0f0c",
+ "required_by": [],
+ "resource_name": "ssc_1_subint_service2_port_0_subinterfaces",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Heat::ResourceGroup",
+ "updated_time": "2019-01-23T19:34:15Z"
+ },
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mgmt_port_1",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_1_mgmt_port_1",
+ "physical_resource_id": "fdeedf37-c01e-4ab0-bdd6-8d5fc4913943",
+ "required_by": [
+ "ssc_server_1"
+ ],
+ "resource_name": "ssc_1_mgmt_port_1",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Neutron::Port",
+ "updated_time": "2019-01-23T19:34:15Z"
+ },
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mgmt_port_0",
+ "rel": "self"
+ },
{
- "resource_name": "ssc_1_trusted_port_0",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_trusted_port_0",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- }
- ],
- "logical_resource_id": "ssc_1_trusted_port_0",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [
- "ssc_server_1"
- ],
- "resource_status_reason": "state changed",
- "physical_resource_id": "d2f51f82-0ec2-4581-bd1a-d2a82073e52b",
- "resource_type": "OS::Neutron::Port"
- },
- {
- "resource_name": "ssc_1_service1_port_0",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_service1_port_0",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- }
- ],
- "logical_resource_id": "ssc_1_service1_port_0",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [
- "ssc_1_subint_service1_port_0_subinterfaces",
- "ssc_server_1"
- ],
- "resource_status_reason": "state changed",
- "physical_resource_id": "27391d94-33af-474a-927d-d409249e8fd3",
- "resource_type": "OS::Neutron::Port"
- },
- {
- "resource_name": "ssc_1_subint_service2_port_0_subinterfaces",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_subint_service2_port_0_subinterfaces",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst/447a9b41-714e-434b-b1d0-6cce8d9f0f0c",
- "rel": "nested"
- }
- ],
- "logical_resource_id": "ssc_1_subint_service2_port_0_subinterfaces",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [],
- "resource_status_reason": "state changed",
- "physical_resource_id": "447a9b41-714e-434b-b1d0-6cce8d9f0f0c",
- "resource_type": "OS::Heat::ResourceGroup"
- },
- {
- "resource_name": "ssc_1_mgmt_port_1",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mgmt_port_1",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- }
- ],
- "logical_resource_id": "ssc_1_mgmt_port_1",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [
- "ssc_server_1"
- ],
- "resource_status_reason": "state changed",
- "physical_resource_id": "07f5b14c-147a-4d14-8c94-a9e94dbc097b",
- "resource_type": "OS::Neutron::Port"
- },
- {
- "resource_name": "ssc_1_mgmt_port_0",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mgmt_port_0",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- }
- ],
- "logical_resource_id": "ssc_1_mgmt_port_0",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [
- "ssc_server_1"
- ],
- "resource_status_reason": "state changed",
- "physical_resource_id": "8d93f63e-e972-48c7-ad98-b2122da47315",
- "resource_type": "OS::Neutron::Port"
- },
- {
- "resource_name": "ssc_1_service2_port_0",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_service2_port_0",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- }
- ],
- "logical_resource_id": "ssc_1_service2_port_0",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [
- "ssc_1_subint_service2_port_0_subinterfaces",
- "ssc_server_1"
- ],
- "resource_status_reason": "state changed",
- "physical_resource_id": "0594a2f2-7ea4-42eb-abc2-48ea49677fca",
- "resource_type": "OS::Neutron::Port"
- },
- {
- "resource_name": "ssc_1_int_ha_port_0",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_int_ha_port_0",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- }
- ],
- "logical_resource_id": "ssc_1_int_ha_port_0",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [
- "ssc_server_1"
- ],
- "resource_status_reason": "state changed",
- "physical_resource_id": "00bb8407-650e-48b5-b919-33b88d6f8fe3",
- "resource_type": "OS::Neutron::Port"
- },
- {
- "resource_name": "ssc_server_1",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_server_1",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- }
- ],
- "logical_resource_id": "ssc_server_1",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [],
- "resource_status_reason": "state changed",
- "physical_resource_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
- "resource_type": "OS::Nova::Server"
- },
- {
- "resource_name": "ssc_1_subint_service1_port_0_subinterfaces",
- "links": [
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_subint_service1_port_0_subinterfaces",
- "rel": "self"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
- "rel": "stack"
- },
- {
- "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672",
- "rel": "nested"
- }
- ],
- "logical_resource_id": "ssc_1_subint_service1_port_0_subinterfaces",
- "resource_status": "CREATE_COMPLETE",
- "updated_time": "2019-01-23T19:34:15Z",
- "required_by": [],
- "resource_status_reason": "state changed",
- "physical_resource_id": "31d0647a-6043-49a4-81b6-ccab29380672",
- "resource_type": "OS::Heat::ResourceGroup"
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_1_mgmt_port_0",
+ "physical_resource_id": "8d93f63e-e972-48c7-ad98-b2122da47315",
+ "required_by": [
+ "ssc_server_1"
+ ],
+ "resource_name": "ssc_1_mgmt_port_0",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Neutron::Port",
+ "updated_time": "2019-01-23T19:34:15Z"
+ },
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_service2_port_0",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
}
- ]
+ ],
+ "logical_resource_id": "ssc_1_service2_port_0",
+ "physical_resource_id": "0594a2f2-7ea4-42eb-abc2-48ea49677fca",
+ "required_by": [
+ "ssc_1_subint_service2_port_0_subinterfaces",
+ "ssc_server_1"
+ ],
+ "resource_name": "ssc_1_service2_port_0",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Neutron::Port",
+ "updated_time": "2019-01-23T19:34:15Z"
+ },
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_int_ha_port_0",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_1_int_ha_port_0",
+ "physical_resource_id": "00bb8407-650e-48b5-b919-33b88d6f8fe3",
+ "required_by": [
+ "ssc_server_1"
+ ],
+ "resource_name": "ssc_1_int_ha_port_0",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Neutron::Port",
+ "updated_time": "2019-01-23T19:34:15Z"
+ },
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_server_1",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_server_1",
+ "physical_resource_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "required_by": [],
+ "resource_name": "ssc_server_1",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Nova::Server",
+ "updated_time": "2019-01-23T19:34:15Z"
+ },
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_subint_service1_port_0_subinterfaces",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34",
+ "rel": "stack"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672",
+ "rel": "nested"
+ }
+ ],
+ "logical_resource_id": "ssc_1_subint_service1_port_0_subinterfaces",
+ "physical_resource_id": "31d0647a-6043-49a4-81b6-ccab29380672",
+ "required_by": [],
+ "resource_name": "ssc_1_subint_service1_port_0_subinterfaces",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Heat::ResourceGroup",
+ "updated_time": "2019-01-23T19:34:15Z"
+ }
+ ]
}
+
diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort1.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort1.json
new file mode 100644
index 0000000000..e4bd83c21d
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort1.json
@@ -0,0 +1,41 @@
+{
+ "port": {
+ "admin_state_up": true,
+ "allowed_address_pairs": [
+ {
+ "ip_address": "192.168.1.1",
+ "mac_address": ""
+ }
+ ],
+ "binding:host_id": "cool.host.com",
+ "binding:vif_details": {
+ "vhostuser_mode": "client",
+ "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d",
+ "vhostuser_vrouter_plug": true
+ },
+ "binding:vif_type": "vhostuser",
+ "binding:vnic_type": "normal",
+ "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "device_owner": "compute:ddd-daa-ddd",
+ "fixed_ips": [
+ {
+ "ip_address": "2001:1890:1001:264d::2d:2b",
+ "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1"
+ },
+ {
+ "ip_address": "192.168.1.1",
+ "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700"
+ }
+ ],
+ "id": "7ee06d9d-3d18-411c-9d3e-aec930f70413",
+ "mac_address": "02:7e:e0:6d:9d:3d",
+ "name": "ibcx0026v_ibcx0026vm003_untrusted_port",
+ "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6",
+ "port_security_enabled": true,
+ "security_groups": [
+ "ee45e4fd-b00c-4396-85ee-18d82bd03ef6"
+ ],
+ "status": "ACTIVE",
+ "tenant_id": "a9442388264e4a198e68484e676404e9"
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort2.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort2.json
new file mode 100644
index 0000000000..376a526133
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort2.json
@@ -0,0 +1,41 @@
+{
+ "port": {
+ "admin_state_up": true,
+ "allowed_address_pairs": [
+ {
+ "ip_address": "192.168.1.1",
+ "mac_address": ""
+ }
+ ],
+ "binding:host_id": "cool.host.com",
+ "binding:vif_details": {
+ "vhostuser_mode": "client",
+ "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d",
+ "vhostuser_vrouter_plug": true
+ },
+ "binding:vif_type": "vhostuser",
+ "binding:vnic_type": "normal",
+ "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "device_owner": "compute:ddd-daa-ddd",
+ "fixed_ips": [
+ {
+ "ip_address": "2001:1890:1001:264d::2d:2b",
+ "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1"
+ },
+ {
+ "ip_address": "192.168.1.1",
+ "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700"
+ }
+ ],
+ "id": "27391d94-33af-474a-927d-d409249e8fd3",
+ "mac_address": "02:7e:e0:6d:9d:3d",
+ "name": "ibcx0026v_ibcx0026vm003_untrusted_port",
+ "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6",
+ "port_security_enabled": true,
+ "security_groups": [
+ "ee45e4fd-b00c-4396-85ee-18d82bd03ef6"
+ ],
+ "status": "ACTIVE",
+ "tenant_id": "a9442388264e4a198e68484e676404e9"
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort3.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort3.json
new file mode 100644
index 0000000000..f0549216be
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort3.json
@@ -0,0 +1,41 @@
+{
+ "port": {
+ "admin_state_up": true,
+ "allowed_address_pairs": [
+ {
+ "ip_address": "192.168.1.1",
+ "mac_address": ""
+ }
+ ],
+ "binding:host_id": "cool.host.com",
+ "binding:vif_details": {
+ "vhostuser_mode": "client",
+ "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d",
+ "vhostuser_vrouter_plug": true
+ },
+ "binding:vif_type": "vhostuser",
+ "binding:vnic_type": "normal",
+ "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "device_owner": "compute:ddd-daa-ddd",
+ "fixed_ips": [
+ {
+ "ip_address": "2001:1890:1001:264d::2d:2b",
+ "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1"
+ },
+ {
+ "ip_address": "192.168.1.1",
+ "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700"
+ }
+ ],
+ "id": "fdeedf37-c01e-4ab0-bdd6-8d5fc4913943",
+ "mac_address": "02:7e:e0:6d:9d:3d",
+ "name": "ibcx0026v_ibcx0026vm003_untrusted_port",
+ "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6",
+ "port_security_enabled": true,
+ "security_groups": [
+ "ee45e4fd-b00c-4396-85ee-18d82bd03ef6"
+ ],
+ "status": "ACTIVE",
+ "tenant_id": "a9442388264e4a198e68484e676404e9"
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort4.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort4.json
new file mode 100644
index 0000000000..fa10b0c864
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort4.json
@@ -0,0 +1,41 @@
+{
+ "port": {
+ "admin_state_up": true,
+ "allowed_address_pairs": [
+ {
+ "ip_address": "192.168.1.1",
+ "mac_address": ""
+ }
+ ],
+ "binding:host_id": "cool.host.com",
+ "binding:vif_details": {
+ "vhostuser_mode": "client",
+ "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d",
+ "vhostuser_vrouter_plug": true
+ },
+ "binding:vif_type": "vhostuser",
+ "binding:vnic_type": "normal",
+ "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "device_owner": "compute:ddd-daa-ddd",
+ "fixed_ips": [
+ {
+ "ip_address": "2001:1890:1001:264d::2d:2b",
+ "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1"
+ },
+ {
+ "ip_address": "192.168.1.1",
+ "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700"
+ }
+ ],
+ "id": "8d93f63e-e972-48c7-ad98-b2122da47315",
+ "mac_address": "02:7e:e0:6d:9d:3d",
+ "name": "ibcx0026v_ibcx0026vm003_untrusted_port",
+ "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6",
+ "port_security_enabled": true,
+ "security_groups": [
+ "ee45e4fd-b00c-4396-85ee-18d82bd03ef6"
+ ],
+ "status": "ACTIVE",
+ "tenant_id": "a9442388264e4a198e68484e676404e9"
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort5.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort5.json
new file mode 100644
index 0000000000..54a9ee8404
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort5.json
@@ -0,0 +1,41 @@
+{
+ "port": {
+ "admin_state_up": true,
+ "allowed_address_pairs": [
+ {
+ "ip_address": "192.168.1.1",
+ "mac_address": ""
+ }
+ ],
+ "binding:host_id": "cool.host.com",
+ "binding:vif_details": {
+ "vhostuser_mode": "client",
+ "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d",
+ "vhostuser_vrouter_plug": true
+ },
+ "binding:vif_type": "vhostuser",
+ "binding:vnic_type": "normal",
+ "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "device_owner": "compute:ddd-daa-ddd",
+ "fixed_ips": [
+ {
+ "ip_address": "2001:1890:1001:264d::2d:2b",
+ "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1"
+ },
+ {
+ "ip_address": "192.168.1.1",
+ "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700"
+ }
+ ],
+ "id": "0594a2f2-7ea4-42eb-abc2-48ea49677fca",
+ "mac_address": "02:7e:e0:6d:9d:3d",
+ "name": "ibcx0026v_ibcx0026vm003_untrusted_port",
+ "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6",
+ "port_security_enabled": true,
+ "security_groups": [
+ "ee45e4fd-b00c-4396-85ee-18d82bd03ef6"
+ ],
+ "status": "ACTIVE",
+ "tenant_id": "a9442388264e4a198e68484e676404e9"
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort6.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort6.json
new file mode 100644
index 0000000000..c47dfd755b
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort6.json
@@ -0,0 +1,41 @@
+{
+ "port": {
+ "admin_state_up": true,
+ "allowed_address_pairs": [
+ {
+ "ip_address": "192.168.1.1",
+ "mac_address": ""
+ }
+ ],
+ "binding:host_id": "cool.host.com",
+ "binding:vif_details": {
+ "vhostuser_mode": "client",
+ "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d",
+ "vhostuser_vrouter_plug": true
+ },
+ "binding:vif_type": "vhostuser",
+ "binding:vnic_type": "normal",
+ "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "device_owner": "compute:ddd-daa-ddd",
+ "fixed_ips": [
+ {
+ "ip_address": "2001:1890:1001:264d::2d:2b",
+ "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1"
+ },
+ {
+ "ip_address": "192.168.1.1",
+ "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700"
+ }
+ ],
+ "id": "00bb8407-650e-48b5-b919-33b88d6f8fe3",
+ "mac_address": "02:7e:e0:6d:9d:3d",
+ "name": "ibcx0026v_ibcx0026vm003_untrusted_port",
+ "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6",
+ "port_security_enabled": true,
+ "security_groups": [
+ "ee45e4fd-b00c-4396-85ee-18d82bd03ef6"
+ ],
+ "status": "ACTIVE",
+ "tenant_id": "a9442388264e4a198e68484e676404e9"
+ }
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
index 4554835b33..2e1fc97336 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/pom.xml
@@ -76,5 +76,10 @@
<artifactId>mso-adapters-rest-interface</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>mso-vnfm-adapter-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java
index 4dabec3e9b..77a3f21dca 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterController.java
@@ -21,14 +21,72 @@
package org.onap.so.adapters.vnfmadapter.rest;
import static org.onap.so.adapters.vnfmadapter.Constants.BASE_URL;
+import java.util.UUID;
+import javax.validation.Valid;
+import javax.ws.rs.core.MediaType;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
+import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
+import io.swagger.annotations.ApiParam;
/**
* Controller for handling requests to the VNFM (Virtual Network Function Manager) adapter REST API.
*/
@Controller
-@RequestMapping(value = BASE_URL)
+@RequestMapping(value = BASE_URL, produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
+ consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public class VnfmAdapterController {
+ private static final Logger logger = LoggerFactory.getLogger(VnfmAdapterController.class);
+
+ @PostMapping(value = "/vnfs/{vnfId}")
+ public ResponseEntity<CreateVnfResponse> vnfCreate(
+ @ApiParam(value = "The identifier of the VNF. This must be the vnf-id of an existing generic-vnf in AAI.",
+ required = true) @PathVariable("vnfId") final String vnfId,
+ @ApiParam(value = "VNF creation parameters",
+ required = true) @Valid @RequestBody final CreateVnfRequest createVnfRequest,
+ @ApiParam(
+ value = "Used to track REST requests for logging purposes. Identifies a single top level invocation of ONAP",
+ required = true) @RequestHeader(value = ONAPLogConstants.Headers.REQUEST_ID,
+ required = false) final String requestId,
+ @ApiParam(
+ value = "Used to track REST requests for logging purposes. Identifies the client application user agent or user invoking the API",
+ required = true) @RequestHeader(value = ONAPLogConstants.Headers.PARTNER_NAME,
+ required = false) final String partnerName,
+ @ApiParam(
+ value = "Used to track REST requests for logging purposes. Identifies a single invocation of a single component",
+ required = true) @RequestHeader(value = ONAPLogConstants.Headers.INVOCATION_ID,
+ required = false) final String invocationId) {
+
+ setLoggingMDCs(requestId, partnerName, invocationId);
+
+ logger.info("REST request vnfCreate with body: {}", createVnfRequest);
+
+ final CreateVnfResponse response = new CreateVnfResponse();
+ response.setJobId(UUID.randomUUID().toString());
+ clearLoggingMDCs();
+ return new ResponseEntity<>(response, HttpStatus.ACCEPTED);
+ }
+
+ private void setLoggingMDCs(final String requestId, final String partnerName, final String invocationId) {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
+ MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName);
+ MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
+ }
+
+ private void clearLoggingMDCs() {
+ MDC.clear();
+ }
+
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
new file mode 100644
index 0000000000..842b3b56be
--- /dev/null
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
@@ -0,0 +1,78 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.vnfmadapter.rest;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import java.net.URI;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.adapters.vnfmadapter.VnfmAdapterApplication;
+import org.onap.vnfmadapter.v1.model.CreateVnfRequest;
+import org.onap.vnfmadapter.v1.model.CreateVnfResponse;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.http.MediaType;
+import org.springframework.http.RequestEntity;
+import org.springframework.http.ResponseEntity;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+public class VnfmAdapterControllerTest {
+
+ @LocalServerPort
+ private int port;
+
+ private final TestRestTemplate restTemplate = new TestRestTemplate("test", "test");
+
+ @Test
+ public void createVnf_ValidRequest_Returns202AndJobId() throws Exception {
+ final CreateVnfRequest createVnfRequest = new CreateVnfRequest();
+ final RequestEntity<CreateVnfRequest> request =
+ RequestEntity.post(new URI("http://localhost:" + port + "/so/vnfm-adapter/v1/vnfs/myVnfId"))
+ .accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON)
+ .header("X-ONAP-RequestId", "myRequestId").header("X-ONAP-InvocationID", "myInvocationId")
+ .body(createVnfRequest);
+ final ResponseEntity<CreateVnfResponse> response = restTemplate.exchange(request, CreateVnfResponse.class);
+ assertEquals(202, response.getStatusCode().value());
+ assertNotNull(response.getBody().getJobId());
+ }
+
+ @Test
+ public void createVnf_UnauthorizedUser_Returns401() throws Exception {
+ final TestRestTemplate restTemplateWrongPassword = new TestRestTemplate("test", "wrongPassword");
+ final CreateVnfRequest createVnfRequest = new CreateVnfRequest();
+ final RequestEntity<CreateVnfRequest> request =
+ RequestEntity.post(new URI("http://localhost:" + port + "/so/vnfm-adapter/v1/vnfs/myVnfId"))
+ .accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON)
+ .header("X-ONAP-RequestId", "myRequestId").header("X-ONAP-InvocationID", "myInvocationId")
+ .body(createVnfRequest);
+ final ResponseEntity<CreateVnfResponse> response =
+ restTemplateWrongPassword.exchange(request, CreateVnfResponse.class);
+ assertEquals(401, response.getStatusCode().value());
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
index 0d9b3c5b94..d5b0b31a39 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
@@ -51,13 +51,13 @@ class CatalogDbUtils {
private static final Logger logger = LoggerFactory.getLogger( CatalogDbUtils.class);
private HttpClientFactory httpClientFactory
- private MsoUtils msoUtils
- private JsonUtils jsonUtils
+ private MsoUtils utils
+ private JsonUtils jsonUtils
static private String defaultDbAdapterVersion = "v2"
- CatalogDbUtils(HttpClientFactory httpClientFactory, MsoUtils msoUtils, JsonUtils jsonUtils) {
+ CatalogDbUtils(HttpClientFactory httpClientFactory, JsonUtils jsonUtils) {
this.httpClientFactory = httpClientFactory
- this.msoUtils = msoUtils
+ this.utils = new MsoUtils()
this.jsonUtils = jsonUtils
}
@@ -105,7 +105,7 @@ class CatalogDbUtils {
}
}
catch (Exception e) {
- msoUtils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ logger.error("Exception in Querying Catalog DB: " + e.message)
throw e
}
@@ -488,7 +488,7 @@ class CatalogDbUtils {
}
}
catch (Exception e) {
- msoUtils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ logger.error("Exception in Querying Catalog DB: " + e.message)
throw e
}
@@ -500,13 +500,13 @@ class CatalogDbUtils {
String encodedString = null
try {
String basicAuthValueDB = UrnPropertiesReader.getVariable("mso.adapters.db.auth", execution)
- msoUtils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB)
+ logger.debug("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB)
- encodedString = msoUtils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution))
+ encodedString = utils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution))
execution.setVariable("BasicAuthHeaderValueDB",encodedString)
} catch (IOException ex) {
String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage()
- msoUtils.log("ERROR", dataErrorMessage)
+ logger.error(dataErrorMessage)
}
return encodedString
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy
index faa0037169..bf7d07cbb3 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsFactory.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 NOKIA.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -26,6 +28,6 @@ import org.onap.so.client.HttpClientFactory
public class CatalogDbUtilsFactory {
CatalogDbUtils create() {
- return new CatalogDbUtils(new HttpClientFactory(), new MsoUtils(), new JsonUtils())
+ return new CatalogDbUtils(new HttpClientFactory(), new JsonUtils())
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
index ccbd682ef6..c2e4ee4454 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
@@ -28,7 +28,6 @@ import java.text.SimpleDateFormat
import org.apache.commons.codec.binary.Base64
import org.apache.commons.lang3.StringEscapeUtils
-import org.onap.so.bpmn.core.BPMNLogger
import org.onap.so.bpmn.core.xml.XmlTool
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
@@ -89,7 +88,7 @@ class MsoUtils {
}
return nodes
}
-
+
def getNodeXml(xmlInput,element){
return getNodeXml(xmlInput, element, true)
}
@@ -106,7 +105,7 @@ class MsoUtils {
return unescapeNodeContents(nodeToSerialize, nodeAsText)
}
-
+
def unescapeNodeContents(NodeChild node, String text) {
if (!node.childNodes().hasNext()) {
return StringEscapeUtils.unescapeXml(text)
@@ -125,7 +124,7 @@ class MsoUtils {
}
}
-
+
/***** Utilities when using XmlParser *****/
/**
@@ -139,12 +138,12 @@ class MsoUtils {
nodeAsString = removeXmlPreamble(nodeAsString)
return formatXml(nodeAsString)
}
-
+
/**
* Get the specified child Node of the specified parent. If there are
* multiple children of the same name, only the first one is returned.
* If there are no children with the specified name, 'null' is returned.
- *
+ *
* @param parent Parent Node in which to find a child.
* @param childNodeName Name of the child Node to get.
* @return the (first) child Node with the specified name or 'null'
@@ -158,11 +157,11 @@ class MsoUtils {
return nodeList.get(0)
}
}
-
+
/**
* Get the textual value of the specified child Node of the specified parent.
* If there are no children with the specified name, 'null' is returned.
- *
+ *
* @param parent Parent Node in which to find a child.
* @param childNodeName Name of the child Node whose value to get.
* @return the textual value of child Node with the specified name or 'null'
@@ -176,11 +175,11 @@ class MsoUtils {
return childNode.text()
}
}
-
+
/**
* Get all of the child nodes from the specified parent that have the
* specified name. The returned NodeList could be empty.
- *
+ *
* @param parent Parent Node in which to find children.
* @param childNodeName Name of the children to get.
* @return a NodeList of all the children from the parent with the specified
@@ -192,14 +191,14 @@ class MsoUtils {
/***** End of Utilities when using XmlParser *****/
-
+
/** these are covered under the common function above**/
def getSubscriberName(xmlInput,element){
def rtn=null
if(xmlInput!=null){
def xml= new XmlSlurper().parseText(xmlInput)
rtn= xml.'**'.find{node->node.name()==element}.text()
- }
+ }
return rtn
}
def getTenantInformation(xmlInput,element){
@@ -227,7 +226,7 @@ class MsoUtils {
}
return ret
}
-
+
def searchMetaDataNode(fxml, searchName, searchValue){
def ret = fxml.'**'.find {it.metaname.text() == searchName && it.metaval.text() == searchValue}
if(ret != null){
@@ -235,7 +234,7 @@ class MsoUtils {
}
return ret
}
-
+
// for Trinity L3 add/delete bonding
def getPBGFList(isDebugLogEnabled, xmlInput){
log("DEBUG", "getPBGFList: xmlInput " + xmlInput,isDebugLogEnabled)
@@ -271,20 +270,18 @@ class MsoUtils {
}
myNodes.add(XmlUtil.serialize(nodeToAdd))
}
-
}
}
-
return myNodes
}else{
return null
}
}
-
+
def getPBGFList(xmlInput){
getPBGFList("false", xmlInput)
}
-
+
def getMetaVal(node, name){
try{
return node.'**'.find {it.metaname.text() == name}.metaval.text()
@@ -295,16 +292,15 @@ class MsoUtils {
def log(logmode,logtxt,isDebugLogEnabled="false"){
if ("INFO"==logmode) {
- logger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, logtxt, "BPMN");
+ logger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), logtxt, "BPMN");
} else if ("WARN"==logmode) {
logger.warn ("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), logtxt, "BPMN",
ErrorCode.UnknownError.getValue(), logtxt);
} else if ("ERROR"==logmode) {
logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), logtxt, "BPMN",
ErrorCode.UnknownError.getValue(), logtxt);
-
} else {
- BPMNLogger.debug(isDebugLogEnabled, logtxt);
+ logger.debug(logtxt);
}
}
@@ -317,7 +313,7 @@ class MsoUtils {
}
return rtn
}
-
+
/**
* Gets the children of the specified element.
*/
@@ -336,10 +332,10 @@ class MsoUtils {
}
return out.toString();
}
-
+
/**
* Encodes a value so it can be used inside an XML text element.
- *
+ *
* <b>Will double encode</b>
* @param s the string to encode
* @return the encoded string
@@ -347,7 +343,7 @@ class MsoUtils {
public static String xmlEscape(Object value) {
return XmlTool.encode(value)
}
-
+
/**
* Removes the preamble, if present, from an XML document.
* Also, for historical reasons, this also trims leading and trailing
@@ -395,29 +391,29 @@ class MsoUtils {
public String formatXml(def xml) {
return XmlTool.normalize(xml);
}
-
+
// build single elements
def buildElements(xmlInput, elementList, parentName) {
String var = ""
def xmlBuild = ""
if (parentName != "") {
xmlBuild += "<tns2:"+parentName+">"
- }
+ }
if (xmlInput != null) {
for (element in elementList) {
def xml= new XmlSlurper().parseText(xmlInput)
var = xml.'**'.find {it.name() == element}
if (var != null) {
xmlBuild += "<tns2:"+element+">"+var.toString()+"</tns2:"+element+">"
- }
+ }
}
}
if (parentName != "") {
xmlBuild += "</tns2:"+parentName+">"
- }
+ }
return xmlBuild
}
-
+
// build the Unbounded elements
def buildElementsUnbounded(xmlInput, elementList, parentName) {
def varParents = ""
@@ -445,7 +441,7 @@ class MsoUtils {
}
return xmlBuildUnbounded
}
-
+
// Build l2-homing-information
def buildL2HomingInformation(xmlInput) {
def elementsL2HomingList = ["evc-name", "topology", "preferred-aic-clli","aic-version"]
@@ -455,7 +451,7 @@ class MsoUtils {
}
return rebuildL2Home
}
-
+
// Build internet-evc-access-information
def buildInternetEvcAccessInformation(xmlInput) {
def elementsInternetEvcAccessInformationList = ["internet-evc-speed-value", "internet-evc-speed-units", "ip-version"]
@@ -465,7 +461,7 @@ class MsoUtils {
}
return rebuildInternetEvcAccess
}
-
+
// Build ucpe-vms-service-information
def buildUcpeVmsServiceInformation(xmlInput) {
def rebuildUcpeVmsServiceInformation = ''
@@ -497,7 +493,7 @@ class MsoUtils {
log("DEBUG", " rebuildUcpeVmsServiceInformation - " + rebuildUcpeVmsServiceInformation)
return rebuildUcpeVmsServiceInformation
}
-
+
// Build internet-service-change-details
def buildInternetServiceChangeDetails(xmlInput) {
def rebuildInternetServiceChangeDetails = ""
@@ -527,33 +523,33 @@ class MsoUtils {
}
}
return rebuildInternetServiceChangeDetails
- }
-
- // Build vr-lan
+ }
+
+ // Build vr-lan
def buildVrLan(xmlInput) {
-
+
def rebuildVrLan = ''
if (xmlInput != null) {
-
+
rebuildVrLan = "<tns2:vr-lan>"
def vrLan = getNodeXml(xmlInput, "vr-lan").drop(38).trim()
rebuildVrLan += buildElements(vrLan, ["routing-protocol"], "")
-
+
// vr-lan-interface
def rebuildVrLanInterface = "<tns2:vr-lan-interface>"
def vrLanInterface = getNodeXml(vrLan, "vr-lan-interface").drop(38).trim()
rebuildVrLanInterface += buildVrLanInterfacePartial(vrLanInterface)
-
+
// dhcp
def dhcp = getNodeXml(vrLan, "dhcp").drop(38).trim()
def rebuildDhcp = buildDhcp(dhcp)
rebuildVrLanInterface += rebuildDhcp
-
+
// pat
def pat = getNodeXml(vrLan, "pat").drop(38).trim()
def rebuildPat = buildPat(pat)
rebuildVrLanInterface += rebuildPat
-
+
// nat
def rebuildNat = ""
try { // optional
@@ -563,31 +559,31 @@ class MsoUtils {
log("ERROR", " Optional - Exception 'nat' ")
}
rebuildVrLanInterface += rebuildNat
-
+
// firewall-lite
def firewallLite = getNodeXml(vrLan, "firewall-lite").drop(38).trim()
def rebuildFirewallLite = buildFirewallLite(firewallLite)
rebuildVrLanInterface += rebuildFirewallLite
-
+
// static-routes
def rebuildStaticRoutes = ""
- try { // optional
+ try { // optional
def staticRoutes = getNodeXml(vrLan, "static-routes").drop(38).trim()
rebuildStaticRoutes = buildStaticRoutes(staticRoutes)
} catch (Exception e) {
log("ERROR", " Optional - Exception 'static-routes' ")
}
rebuildVrLanInterface += rebuildStaticRoutes
-
+
rebuildVrLan += rebuildVrLanInterface
rebuildVrLan += "</tns2:vr-lan-interface>"
rebuildVrLan += "</tns2:vr-lan>"
-
+
}
log("DEBUG", " rebuildVrLan - " + rebuildVrLan)
- return rebuildVrLan
+ return rebuildVrLan
}
-
+
// Build vr-lan-interface
def buildVrLanInterfacePartial(xmlInput) {
def rebuildingVrLanInterface = ''
@@ -616,7 +612,7 @@ class MsoUtils {
log("DEBUG", " rebuildingVrLanInterface - " + rebuildingVrLanInterface)
return rebuildingVrLanInterface
}
-
+
// Build dhcp
def buildDhcp(xmlInput) {
def rebuildingDhcp = ''
@@ -686,10 +682,10 @@ class MsoUtils {
log("ERROR", " Optional - Exception DHCP 'v6-dhcp-pools' ")
}
rebuildingDhcp += "</tns2:dhcp>"
- }
+ }
log("DEBUG", " rebuildingDhcp - " + rebuildingDhcp)
return rebuildingDhcp
- }
+ }
// Build pat
def buildPat(xmlInput) {
@@ -710,7 +706,7 @@ class MsoUtils {
log("DEBUG", " rebuildingPat - " + rebuildingPat)
return rebuildingPat
}
-
+
// Build nat
def buildNat(xmlInput) {
def rebuildingNat = ''
@@ -728,19 +724,19 @@ class MsoUtils {
}
log("DEBUG", " rebuildingNat - " + rebuildingNat)
return rebuildingNat
- }
-
+ }
+
// Build firewall-lite
def buildFirewallLite(xmlInput) {
def rebuildingFirewallLite = ''
-
+
if (xmlInput != null) {
-
+
def firewallLiteData = new XmlSlurper().parseText(xmlInput)
rebuildingFirewallLite = "<tns2:firewall-lite>"
def firewallLiteList = ["stateful-firewall-lite-v4-enabled", "stateful-firewall-lite-v6-enabled"]
rebuildingFirewallLite += buildElements(xmlInput, firewallLiteList, "")
-
+
try { // optional
def v4FirewallPacketFilters = firewallLiteData.'**'.findAll {it.name() == "v4-firewall-packet-filters"}
def v4FirewallPacketFiltersSize = v4FirewallPacketFilters.size()
@@ -768,7 +764,7 @@ class MsoUtils {
} catch (Exception e) {
log("ERROR", " Optional - Exception FIREWALL-LITE 'v4-firewall-packet-filters' ")
}
-
+
try { // optional
def v6FirewallPacketFilters = firewallLiteData.'**'.findAll {it.name() == "v6-firewall-packet-filters"}
def v6FirewallPacketFiltersSize = v6FirewallPacketFilters.size()
@@ -801,7 +797,7 @@ class MsoUtils {
log("DEBUG", " rebuildingFirewallLite - " + rebuildingFirewallLite)
return rebuildingFirewallLite
}
-
+
def buildStaticRoutes(xmlInput) {
def rebuildingStaticRoutes = ''
if (xmlInput != null) {
@@ -815,21 +811,21 @@ class MsoUtils {
log("DEBUG", " rebuildingStaticRoutes - " + rebuildingStaticRoutes)
return rebuildingStaticRoutes
}
-
+
public String generateCurrentTimeInUtc(){
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
final String utcTime = sdf.format(new Date());
return utcTime;
}
-
+
public String generateCurrentTimeInGMT(){
final SimpleDateFormat sdf = new SimpleDateFormat("E, d MMM yyyy h:m:s z");
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
final String utcTime = sdf.format(new Date());
return utcTime;
}
-
+
/**
* @param encryptedAuth: encrypted credentials from urn properties
@@ -850,7 +846,7 @@ class MsoUtils {
throw ex
}
}
-
+
def encrypt(toEncrypt, msokey){
try {
String result = CryptoUtils.encrypt(toEncrypt, msokey);
@@ -860,7 +856,7 @@ class MsoUtils {
log("ERROR", "Failed to encrypt credentials")
}
}
-
+
def decrypt(toDecrypt, msokey){
try {
String result = CryptoUtils.decrypt(toDecrypt, msokey);
@@ -871,7 +867,7 @@ class MsoUtils {
throw e
}
}
-
+
/**
* Return URL with qualified host name (if any) or urn mapping
* @param String url from urn mapping
@@ -890,9 +886,9 @@ class MsoUtils {
log("DEBUG", "unable to grab qualified host name, using what's in urn properties for callbackurl. Exception was: " + e.printStackTrace())
}
return callbackUrlToUse
-
+
}
-
+
/**
* Retrieves text context of the element if the element exists, returns empty string otherwise
* @param com.sun.org.apache.xerces.internal.dom.DeferredElementNSImpl element to parse
@@ -907,7 +903,7 @@ class MsoUtils {
}
return text
}
-
+
/**
*
* Find the lowest unused module-index value in a given xml
@@ -915,14 +911,14 @@ class MsoUtils {
public String getLowestUnusedIndex(String xml) {
if (xml == null || xml.isEmpty()) {
return "0"
- }
- def moduleIndexList = getMultNodes(xml, "module-index")
- if (moduleIndexList == null || moduleIndexList.size() == 0) {
+ }
+ def moduleIndexList = getMultNodes(xml, "module-index")
+ if (moduleIndexList == null || moduleIndexList.size() == 0) {
return "0"
}
-
+
def sortedModuleIndexList = moduleIndexList.sort{ a, b -> a as Integer <=> b as Integer}
-
+
for (i in 0..sortedModuleIndexList.size()-1) {
if (Integer.parseInt(sortedModuleIndexList[i]) != i) {
return i.toString()
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy
index d6a7cf0634..d7438f80f9 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Nokia.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -51,7 +53,6 @@ class CatalogDbUtilsTest {
private static final String RESPONSE_FROM_CATALOG_DB = "{\"serviceVnfs\": [{\"name\": \"service1\"," +
"\"vfModules\": [{\"name\": \"module1\", \"isBase\":true, \"initialCount\":1}]}]}"
private HttpClientFactory httpClientFactoryMock
- private MsoUtils msoUtilsMock
private JsonUtils jsonUtilsMock
private HttpClient httpClientMock
private DelegateExecutionFake executionFake
@@ -61,11 +62,10 @@ class CatalogDbUtilsTest {
@Before
void setUp() {
httpClientFactoryMock = mock(HttpClientFactory.class)
- msoUtilsMock = mock(MsoUtils.class)
jsonUtilsMock = mock(JsonUtils.class)
httpClientMock = mock(HttpClient.class)
executionFake = new DelegateExecutionFake()
- testedObject = new CatalogDbUtils(httpClientFactoryMock, msoUtilsMock, jsonUtilsMock)
+ testedObject = new CatalogDbUtils(httpClientFactoryMock, jsonUtilsMock)
}
@Test
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy
index 21441b9b73..60385a7990 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModuleTest.groovy
@@ -34,7 +34,6 @@ import org.mockito.ArgumentCaptor
import org.mockito.Captor
import org.mockito.MockitoAnnotations
import org.mockito.runners.MockitoJUnitRunner
-import org.onap.so.bpmn.mock.StubResponseAAI
import static org.mockito.Mockito.*
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy
index 2bd5181c31..6a4d53654b 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnfTest.groovy
@@ -37,7 +37,6 @@ import org.mockito.MockitoAnnotations
import org.mockito.runners.MockitoJUnitRunner
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.mock.FileUtil
-import org.onap.so.bpmn.mock.StubResponseAAI
import static com.github.tomakehurst.wiremock.client.WireMock.*
import static org.mockito.ArgumentMatchers.any
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy
index afc180e8a4..75ddca5e98 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1Test.groovy
@@ -85,6 +85,7 @@ public class VnfAdapterRestV1Test {
<volumeGroupId>8a07b246-155e-4b08-b56e-76e98a3c2d66</volumeGroupId>
<volumeGroupStackId>phmaz401me6-vpevre-VOLUMEGROUP/dbd560b6-b03f-4a17-92e7-8942459a60c1</volumeGroupStackId>
<cloudSiteId>mtrnj1b</cloudSiteId>
+ <cloudOwnerId>CloudOwner</cloudOwnerId>
<tenantId>cfb5e0a790374c9a98a1c0d2044206a7</tenantId>
<volumeGroupCreated>true</volumeGroupCreated>
<msoRequest>
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResource.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResource.java
deleted file mode 100644
index b9a413fc96..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResource.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Response;
-
-import com.github.tomakehurst.wiremock.WireMockServer;
-import com.github.tomakehurst.wiremock.client.WireMock;
-
-/**
- *
- * Mock Resource which is used to start, stop the WireMock Server
- * Also up to 50 mock properties can be added at run-time to change the properties used in transformers such as sdnc_delay in SDNCAdapterMockTransformer
- * You can also selectively setup a stub (use reset before setting up), reset all stubs
- */
-@Path("/server")
-public class MockResource {
-
- private boolean started = false;
- private final Integer defaultPort = 28090;
- private WireMockServer wireMockServer = null;
- private static Map<String,String> mockProperties = new HashMap<>();
-
- public static String getMockProperties(String key) {
- return mockProperties.get(key);
- }
-
- private synchronized void initMockServer(int portNumber) {
- String path = "src/test/resources/" + "__files/sdncSimResponse.xml";
- path = path.substring(0,path.indexOf("__files/"));
-
- wireMockServer = new WireMockServer(wireMockConfig().port(portNumber).extensions("org.onap.so.bpmn.mock.SDNCAdapterMockTransformer")
- .extensions("org.onap.so.bpmn.mock.SDNCAdapterNetworkTopologyMockTransformer")
- .extensions("org.onap.so.bpmn.mock.VnfAdapterCreateMockTransformer")
- .extensions("org.onap.so.bpmn.mock.VnfAdapterDeleteMockTransformer")
- .extensions("org.onap.so.bpmn.mock.VnfAdapterUpdateMockTransformer")
- .extensions("org.onap.so.bpmn.mock.VnfAdapterRollbackMockTransformer")
- .extensions("org.onap.so.bpmn.mock.VnfAdapterQueryMockTransformer"));
- //.withRootDirectory(path));
- //Mocks were failing - commenting out for now, both mock and transformers seem to work fine
- WireMock.configureFor("localhost", portNumber);
- wireMockServer.start();
-// StubResponse.setupAllMocks();
- started= true;
- }
-
- public static void main(String [] args) {
- MockResource mockresource = new MockResource();
- mockresource.start(28090);
- mockresource.reset();
-// mockresource.setupStub("MockCreateTenant");
- }
-
- /**
- * Starts the wiremock server in default port
- * @return
- */
- @GET
- @Path("/start")
- @Produces("application/json")
- public Response start() {
- return startMockServer(defaultPort);
- }
-
- private Response startMockServer(int port) {
- if (!started) {
- initMockServer(defaultPort);
- System.out.println("Started Mock Server in port " + port);
- return Response.status(200).entity("Started Mock Server in port " + port).build();
- } else {
- return Response.status(200).entity("Mock Server is already running").build();
- }
- }
-
- /**
- * Starts the wiremock server in a different port
- * @param portNumber
- * @return
- */
- @GET
- @Path("/start/{portNumber}")
- @Produces("application/json")
- public Response start(@PathParam("portNumber") Integer portNumber) {
- if (portNumber == null) portNumber = defaultPort;
- return startMockServer(portNumber);
- }
-
-
- /**
- * Stop the wiremock server
- * @return
- */
- @GET
- @Path("/stop")
- @Produces("application/json")
- public synchronized Response stop() {
- if (wireMockServer.isRunning()) {
- wireMockServer.stop();
- started = false;
- return Response.status(200).entity("Stopped Mock Server in port ").build();
- }
- return Response.status(200).entity("Mock Server is not running").build();
- }
-
-
- /**
- * Return list of mock properties
- * @return
- */
- @GET
- @Path("/properties")
- @Produces("application/json")
- public Response getProperties() {
- return Response.status(200).entity(mockProperties).build();
- }
-
- /**
- * Update a particular mock property at run-time
- * @param name
- * @param value
- * @return
- */
- @POST
- @Path("/properties/{name}/{value}")
- public Response updateProperties(@PathParam("name") String name, @PathParam("value") String value) {
- if (mockProperties.size() > 50) return Response.serverError().build();
- mockProperties.put(name, value);
- return Response.status(200).build();
- }
-
- /**
- * Reset all stubs
- * @return
- */
- @GET
- @Path("/reset")
- @Produces("application/json")
- public Response reset() {
- WireMock.reset();
- return Response.status(200).entity("Wiremock stubs are reset").build();
- }
-
-
- /**
- * Setup a stub selectively
- * Prior to use, make sure that stub method is available in StubResponse class
- * @param methodName
- * @return
- */
-
- // commenting for now until we figure out a way to use new StubResponse classes to setupStubs
-// @GET
-// @Path("/stub/{methodName}")
-// @Produces("application/json")
-// public Response setupStub(@PathParam("methodName") String methodName) {
-//
-// @SuppressWarnings("rawtypes")
-// Class params[] = {};
-// Object paramsObj[] = {};
-//
-// try {
-// Method thisMethod = StubResponse.class.getDeclaredMethod(methodName, params);
-// try {
-// thisMethod.invoke(StubResponse.class, paramsObj);
-// } catch (IllegalAccessException | IllegalArgumentException
-// | InvocationTargetException e) {
-// return Response.status(200).entity("Error invoking " + methodName ).build();
-// }
-// } catch (NoSuchMethodException | SecurityException e) {
-// return Response.status(200).entity("Stub " + methodName + " not found...").build();
-// }
-// return Response.status(200).entity("Successfully invoked " + methodName).build();
-// }
-
-
- public static Map<String,String> getMockProperties(){
- return mockProperties;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResourceApplication.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResourceApplication.java
deleted file mode 100644
index 6c62920781..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/MockResourceApplication.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.ws.rs.ApplicationPath;
-import javax.ws.rs.core.Application;
-
-import org.junit.Ignore;
-
-/**
- *
- * JAX RS Application wiring for Mock Resource
- */
-@ApplicationPath("/console")
-@Ignore
-public class MockResourceApplication extends Application {
-
- private Set<Object> singletons = new HashSet<>();
- private Set<Class<?>> classes = new HashSet<>();
-
- public MockResourceApplication() {
- singletons.add(new MockResource());
- }
-
- @Override
- public Set<Class<?>> getClasses() {
- return classes;
- }
-
- @Override
- public Set<Object> getSingletons() {
- return singletons;
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java
deleted file mode 100644
index 8515307394..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.BinaryFile;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-
-/**
- *
- * Simulates SDNC Adapter Callback response
- *
- */
-public class SDNCAdapterAsyncTransformer extends ResponseDefinitionTransformer {
-
- private String syncResponse;
- private String callbackResponseWrapper;
-
- public SDNCAdapterAsyncTransformer() {
- syncResponse = FileUtil.readResourceFile("__files/StandardSDNCSynchResponse.xml");
- callbackResponseWrapper = FileUtil.readResourceFile("__files/sdncCallbackSoapWrapper.xml");
- }
-
- @Override
- public String getName() {
- return "sdnc-adapter-vf-module-assign";
- }
-
- /**
- * Grab the incoming request xml,extract the request id and replace the stub response with the incoming request id
- * so that callback response can be correlated
- *
- * Mock Resource can be used to add dynamic properties. If sdnc_delay is not in the list by default waits for 300ms before
- * the callback response is sent
- */
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>")+25, requestBody.indexOf("</sdncadapter:CallbackUrl>"));
- String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>"));
-
- System.out.println("responseDefinition: " + responseDefinition);
-
- // For this mock, the mapped response body is the Async callback (since the sync response is generic for all requests)
- String sdncResponse = responseDefinition.getBody();
- System.out.println("sdncResponse:" + sdncResponse);
-
- if (sdncResponse == null) {
- // Body wasn't specified. Check for a body file
- String bodyFileName = responseDefinition.getBodyFileName();
- System.out.println("bodyFileName" + bodyFileName);
- if (bodyFileName != null) {
- System.out.println("fileSource Class: " + fileSource.getClass().getName());
- BinaryFile bodyFile = fileSource.getBinaryFileNamed(bodyFileName);
- byte[] responseFile = bodyFile.readContents();
- sdncResponse = new String(responseFile);
- System.out.println("sdncResponse(2):" + sdncResponse);
- }
- }
-
- // Next substitute the SDNC response into the callbackResponse (SOAP wrapper).
- // Also, replace the request ID wherever it appears
- String callbackResponse = callbackResponseWrapper.replace("SDNC_RESPONSE_DATA", sdncResponse).replaceAll("SDNC_REQUEST_ID", requestId);
-
- Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay");
- int delay = 2000;
- if (sdncDelay != null) {
- delay = Integer.parseInt(sdncDelay.toString());
- }
-
- //Kick off callback thread
- System.out.println("callback Url:" + callbackUrl + ":delay:" + delay);
- CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay);
- calbackResponseThread.start();
-
- //return 200 OK with empty body
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(syncResponse).withHeader("Content-Type", "text/xml")
- .build();
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- /**
- *
- * Callback response thread which sends the callback response asynchronously
- *
- */
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.SDNC_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java
deleted file mode 100644
index 11788be76e..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * Simulates SDNC Adapter Callback response
- *
- */
-public class SDNCAdapterMockTransformer extends ResponseDefinitionTransformer {
-
- private static final Logger logger = LoggerFactory.getLogger(SDNCAdapterMockTransformer.class);
- private String callbackResponse;
- private String requestId;
-
- public SDNCAdapterMockTransformer() {
- callbackResponse = FileUtil.readResourceFile("__files/sdncSimResponse.xml");
- }
-
- public SDNCAdapterMockTransformer(String requestId) {
- this.requestId = requestId;
- }
-
- @Override
- public String getName() {
- return "sdnc-adapter-transformer";
- }
-
- /**
- * Grab the incoming request xml,extract the request id and replace the stub response with the incoming request id
- * so that callback response can be correlated
- *
- * Mock Resource can be used to add dynamic properties. If sdnc_delay is not in the list by default waits for 300ms before
- * the callback response is sent
- */
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
- String requestBody = request.getBodyAsString();
-
- String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>")+25, requestBody.indexOf("</sdncadapter:CallbackUrl>"));
- String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>"));
-
- callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- logger.info("callbackResponse:" + callbackResponse);
-
- if (this.requestId != null) {
- callbackResponse = callbackResponse.replace(this.requestId, requestId);
- } else {
- callbackResponse = callbackResponse.replace("testRequestId", requestId);
- }
-
-
- Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay");
- int delay = 300;
- if (sdncDelay != null) {
- delay = Integer.parseInt(sdncDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("callback Url:" + callbackUrl + ":delay:" + delay);
- CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay);
- calbackResponseThread.start();
-
- //return 200 OK with empty body
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody("").withHeader("Content-Type", "text/xml")
- .build();
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- /**
- *
- * Callback response thread which sends the callback response asynchronously
- *
- */
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- logger.debug("Exception :", e1);
- }
- logger.debug("Sending callback response:" + callbackUrl);
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.SDNC_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- logger.debug("Exception :", e);
- }
- }
-
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java
deleted file mode 100644
index 344c3b521d..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseDefinitionTransformer {
-
- private static final Logger logger = LoggerFactory.getLogger(SDNCAdapterNetworkTopologyMockTransformer.class);
-
- private String callbackResponse;
- private String requestId;
-
- public SDNCAdapterNetworkTopologyMockTransformer() {
- callbackResponse = ""; // FileUtil.readResourceFile("__files/sdncDeleteNetworkTopologySimResponse.xml");
- }
-
- public SDNCAdapterNetworkTopologyMockTransformer(String requestId) {
- this.requestId = requestId;
- }
-
- @Override
- public String getName() {
- return "network-topology-operation-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition, FileSource fileSource, Parameters parameters) {
- String requestBody = request.getBodyAsString();
-
- String callbackUrl = requestBody.substring(requestBody.indexOf("<sdncadapter:CallbackUrl>")+25, requestBody.indexOf("</sdncadapter:CallbackUrl>"));
- String requestId = requestBody.substring(requestBody.indexOf("<sdncadapter:RequestId>")+23, requestBody.indexOf("</sdncadapter:RequestId>"));
- logger.info("request callbackUrl : " + callbackUrl);
- logger.info("request requestId : " + requestId);
-
- logger.info("file path/name : " + responseDefinition.getBodyFileName());
- callbackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- // extract Response responseRequestId
- String responseRequestId = callbackResponse.substring(callbackResponse.indexOf("<RequestId>")+11, callbackResponse.indexOf("</RequestId>"));
- logger.info("response requestId: " + responseRequestId);
- logger.info("callbackResponse (before): " + callbackResponse);
- callbackResponse = callbackResponse.replace(responseRequestId, requestId);
- if (this.requestId != null) {
- callbackResponse = callbackResponse.replace(this.requestId, requestId);
- } else {
- callbackResponse = callbackResponse.replace(responseRequestId, requestId);
- }
- logger.info("callbackResponse (after):" + callbackResponse);
-
- Object sdncDelay = MockResource.getMockProperties().get("sdnc_delay");
- int delay = 300;
- if (sdncDelay != null) {
- delay = Integer.parseInt(sdncDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("(NetworkTopologyMockTransformer) callback Url:" + callbackUrl + ":delay:" + delay);
- CallbackResponseThread calbackResponseThread = new CallbackResponseThread(callbackUrl,callbackResponse, delay);
- calbackResponseThread.start();
-
- //return 200 OK with body
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(callbackResponse).withHeader("Content-Type", "text/xml")
- .build();
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- logger.debug("Exception :", e1);
- }
- logger.debug("Sending callback response to url: {}", callbackUrl);
- try {
- HttpClient client = new HttpClientFactory()
- .newTextXmlClient(UriBuilder.fromUri(callbackUrl).build().toURL(), TargetEntity.SDNC_ADAPTER);
- Response response = client.post(payLoad);
- logger.debug("Successfully posted callback? Status: {}", response.getStatus());
- } catch (Exception e) {
- // TODO Auto-generated catch block
- logger.debug("catch error in - request.post() ");
- logger.debug("Exception :", e);
- }
- }
-
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java
index e0c51b794c..66dc1f9910 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseSDNCAdapter.java
@@ -80,29 +80,6 @@ public class StubResponseSDNCAdapter {
.withBodyFile(responseFile)));
}
- public static void mockSDNCAdapterSimulator(String responseFile) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("sdnc_delay", "300");
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/soap+xml")
- .withTransformers("sdnc-adapter-transformer")
- .withBodyFile(responseFile)));
- }
-
- public static void mockSDNCAdapterSimulator(String responseFile, String requestContaining) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("sdnc_delay", "300");
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/soap+xml")
- .withTransformers("sdnc-adapter-transformer")
- .withBodyFile(responseFile)));
- }
-
public static void mockSDNCAdapterRest() {
stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc/services"))
.willReturn(aResponse()
@@ -133,17 +110,4 @@ public class StubResponseSDNCAdapter {
.withHeader("Content-Type", "application/json")));
}
- public static void mockSDNCAdapterTopology(String responseFile, String requestContaining) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("sdnc_delay", "300");
- stubFor(post(urlEqualTo("/SDNCAdapter"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "text/xml")
- .withTransformers("network-topology-operation-transformer")
- .withBodyFile(responseFile)));
- }
-
-
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java
index 91ecbd23b4..75283515af 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseVNFAdapter.java
@@ -53,29 +53,6 @@ public class StubResponseVNFAdapter {
.willReturn(aResponse()
.withStatus(500)));
}
-
- public static void mockVNFAdapterTransformer(String transformer, String responseFile) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("vnf_delay", "300");
- stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/soap+xml")
- .withTransformers(transformer)
- .withBodyFile(responseFile)));
- }
-
- public static void mockVNFAdapterTransformer(String transformer, String responseFile, String requestContaining) {
- MockResource mockResource = new MockResource();
- mockResource.updateProperties("vnf_delay", "300");
- stubFor(post(urlEqualTo("/vnfs/VnfAdapterAsync"))
- .withRequestBody(containing(requestContaining))
- .willReturn(aResponse()
- .withStatus(200)
- .withHeader("Content-Type", "application/soap+xml")
- .withTransformers(transformer)
- .withBodyFile(responseFile)));
- }
public static void mockVNFPost(String vfModuleId, int statusCode, String vnfId) {
stubFor(post(urlEqualTo("/services/rest/v1/vnfs" + vnfId + "/vf-modules" + vfModuleId))
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java
deleted file mode 100644
index e190535e7e..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.BinaryFile;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-
-/**
- *
- * Simulates VNF Adapter Asynch Callback response.
- * This should work for any of the operations.
- *
- * This transformer uses the mapped message as the asynchronous response.
- * By definition, the async API sends a 202 (with no body) in the sync response.
- *
- */
-public class VnfAdapterAsyncTransformer extends ResponseDefinitionTransformer {
-
- public VnfAdapterAsyncTransformer() {
- }
-
- @Override
- public String getName() {
- return "vnf-adapter-async";
- }
-
- /**
- * Grab the incoming request, extract properties to be copied to the response
- * (request id, vnf id, vf module ID, message ID). Then fetch the actual response
- * body from its FileSource, make the replacements.
- *
- * The sync response is an empty 202 response.
- * The transformed mapped response file is sent asynchronously after a delay.
- *
- * Mock Resource can be used to add dynamic properties. If vnf_delay is not in the list by
- * default waits for 5s before the callback response is sent
- */
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- // Note: Should recognize both XML and JSON. But current BPMN uses XML.
- String notificationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
-
- String vnfId = requestBody.substring(requestBody.indexOf("<vnfId>")+7, requestBody.indexOf("</vnfId>"));
- String vfModuleId = requestBody.substring(requestBody.indexOf("<vfModuleId>")+12, requestBody.indexOf("</vfModuleId>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- String requestId = requestBody.substring(requestBody.indexOf("<requestId>")+11, requestBody.indexOf("</requestId>"));
-
- System.out.println("responseDefinition: " + responseDefinition);
-
- // For this mock, the mapped response body is the Async callback (since the sync response is generic for all requests)
- String vnfResponse = responseDefinition.getBody();
- System.out.println("VNF Response:" + vnfResponse);
-
- if (vnfResponse == null) {
- // Body wasn't specified. Check for a body file
- String bodyFileName = responseDefinition.getBodyFileName();
- System.out.println("bodyFileName" + bodyFileName);
- if (bodyFileName != null) {
- System.out.println("fileSource Class: " + fileSource.getClass().getName());
- BinaryFile bodyFile = fileSource.getBinaryFileNamed(bodyFileName);
- byte[] responseFile = bodyFile.readContents();
- vnfResponse = new String(responseFile);
- System.out.println("vnfResponse(2):" + vnfResponse);
- }
- }
-
- // Transform the SDNC response to escape < and >
- vnfResponse = vnfResponse.replaceAll ("VNF_ID", vnfId);
- vnfResponse = vnfResponse.replaceAll ("VF_MODULE_ID", vfModuleId);
- vnfResponse = vnfResponse.replaceAll ("REQUEST_ID", requestId);
- vnfResponse = vnfResponse.replaceAll ("MESSAGE_ID", messageId);
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 5000;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- System.out.println("notification Url:" + notificationUrl + ":delay:" + delay);
- CallbackResponseThread calbackResponseThread = new CallbackResponseThread(notificationUrl,vnfResponse, delay);
- calbackResponseThread.start();
-
- //return 200 OK with empty body
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(202).withBody("").withHeader("Content-Type", "text/xml")
- .build();
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- /**
- *
- * Callback response thread which sends the callback response asynchronously
- *
- */
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
-
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.VNF_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java
deleted file mode 100644
index 362d9508d3..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Please describe the VnfAdapterCreateMockTransformer.java class
- *
- */
-public class VnfAdapterCreateMockTransformer extends ResponseDefinitionTransformer {
-
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterCreateMockTransformer.class);
-
- private String notifyCallbackResponse;
- private String ackResponse;
-
- public VnfAdapterCreateMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfCreateSimResponse.xml"); // default response
- }
-
- @Override
- public String getName() {
- return "vnf-adapter-create-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- String responseMessageId = "";
- String updatedResponse = "";
-
- try {
- // try supplied response file (if any)
- System.out.println(" Supplied fileName: " + responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- logger.debug("Exception :",ex);
- System.out.println(" ******* Use default response file in '__files/vnfAdapterMocks/vnfCreateSimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- logger.info("response (mock) messageId : {}", responseMessageId);
- logger.info("request (replacement) messageId: {}", messageId);
-
- logger.info("vnf Response (before): {}", notifyCallbackResponse);
- logger.info("vnf Response (after): {}", updatedResponse);
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("VnfAdapterCreateMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
-
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- @SuppressWarnings("deprecation")
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- logger.debug("Exception :",e1);
- }
- logger.debug("Sending callback response to url: {}", callbackUrl);
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.VNF_ADAPTER);
- Response response = client.post(payLoad);
- logger.debug("Successfully posted callback? Status: {}", response.getStatus());
- } catch (Exception e) {
- // TODO Auto-generated catch block
- logger.debug("catch error in - request.post() ");
- logger.debug("Exception :", e);
- }
- }
-
- }
-
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java
deleted file mode 100644
index b67f3dcedd..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Please describe the VnfAdapterCreateMockTransformer.java class
- *
- */
-public class VnfAdapterDeleteMockTransformer extends ResponseDefinitionTransformer {
-
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterDeleteMockTransformer.class);
-
- private String notifyCallbackResponse;
- private String ackResponse;
-
- public VnfAdapterDeleteMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfDeleteSimResponse.xml");
- }
-
- @Override
- public String getName() {
- return "vnf-adapter-delete-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- String responseMessageId = "";
- String updatedResponse = "";
-
- try {
- // try supplied response file (if any)
- logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- logger.debug("Exception :",ex);
- logger.info(" ******* Use default response file in '__files/vnfAdapterMocks/vnfDeleteSimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- logger.info("response (mock) messageId : {}", responseMessageId);
- logger.info("request (replacement) messageId: {}", messageId);
-
- logger.info("vnf Response (before):{}", notifyCallbackResponse);
- logger.info("vnf Response (after):{}", updatedResponse);
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("VnfAdapterDeleteMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
-
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- @SuppressWarnings("deprecation")
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- logger.debug("Exception :",e1);
- }
-
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.VNF_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- logger.info("catch error in - request.post() ");
- logger.debug("Exception :",e);
- }
- }
-
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java
deleted file mode 100644
index 48ced35810..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Please describe the VnfAdapterQueryMockTransformer.java class
- *
- */
-
-
-public class VnfAdapterQueryMockTransformer extends ResponseDefinitionTransformer{
-
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterQueryMockTransformer
- .class);
-
- private String notifyCallbackResponse;
- private String ackResponse;
- private String messageId;
-
- public VnfAdapterQueryMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfQuerySimResponse.xml");
- }
-
- public VnfAdapterQueryMockTransformer(String messageId) {
- this.messageId = messageId;
- }
-
- @Override
- public String getName() {
- return "vnf-adapter-query-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
-
- String responseMessageId = "";
- String updatedResponse = "";
-
- try {
- // try supplied response file (if any)
- logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- logger.debug("Exception :",ex);
- logger.info(" ******* Use default response file in '__files/vnfAdapterMocks/vnfQuerySimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- logger.info("response (mock) messageId : {}", responseMessageId);
- logger.info("request (replacement) messageId: {}", messageId);
-
- logger.info("vnf Response (before):{}", notifyCallbackResponse);
- logger.info("vnf Response (after):{}", updatedResponse);
-
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("VnfAdapterQueryMockTransformer notficationUrl: {}:delay: {}", notficationUrl, delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- logger.info("Inside Callback" );
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- logger.debug("Exception :",e1);
- }
-
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.VNF_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- logger.debug("Exception :",e);
- }
- }
-
- }
-
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java
deleted file mode 100644
index edf05422d1..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Please describe the VnfAdapterCreateMockTransformer.java class
- *
- */
-public class VnfAdapterRollbackMockTransformer extends ResponseDefinitionTransformer {
-
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterRollbackMockTransformer.class);
-
- private String notifyCallbackResponse;
- private String ackResponse;
- private String messageId;
-
- public VnfAdapterRollbackMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("__files/vnfAdapterMocks/vnfRollbackSimResponse.xml");
- }
-
- public VnfAdapterRollbackMockTransformer(String messageId) {
- this.messageId = messageId;
- }
-
- @Override
- public String getName() {
- return "vnf-adapter-rollback-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- String responseMessageId = "";
- String updatedResponse = "";
-
- try {
- // try supplied response file (if any)
- logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- logger.debug("Exception :",ex);
- logger.info(" ******* Use default response file in '__files/vnfAdapterMocks/vnfRollbackSimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- logger.info("response (mock) messageId : {}", responseMessageId);
- logger.info("request (replacement) messageId: {}", messageId);
-
- logger.info("vnf Response (before):{}", notifyCallbackResponse);
- logger.info("vnf Response (after):{}", updatedResponse);
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("VnfAdapterRollbackMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
-
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- logger.debug("Exception :",e1);
- }
-
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.VNF_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- logger.info("catch error in - request.post() ");
- logger.debug("Exception :", e);
- }
- }
-
- }
-}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java
deleted file mode 100644
index 5693877574..0000000000
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.mock;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.onap.so.client.HttpClient;
-import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
-
-import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder;
-import com.github.tomakehurst.wiremock.common.FileSource;
-import com.github.tomakehurst.wiremock.extension.Parameters;
-import com.github.tomakehurst.wiremock.extension.ResponseDefinitionTransformer;
-import com.github.tomakehurst.wiremock.http.Request;
-import com.github.tomakehurst.wiremock.http.ResponseDefinition;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Please describe the VnfAdapterUpdateMockTransformer.java class
- *
- */
-public class VnfAdapterUpdateMockTransformer extends ResponseDefinitionTransformer {
-
- private static final Logger logger = LoggerFactory.getLogger(VnfAdapterUpdateMockTransformer.class);
-
- private String notifyCallbackResponse;
- private String requestId;
- private String ackResponse;
-
- public VnfAdapterUpdateMockTransformer() {
- notifyCallbackResponse = FileUtil.readResourceFile("vnfAdapter/vnfUpdateSimResponse.xml");
- }
-
- public VnfAdapterUpdateMockTransformer(String requestId) {
- this.requestId = requestId;
- }
-
- @Override
- public String getName() {
- return "vnf-adapter-update-transformer";
- }
-
- @Override
- public ResponseDefinition transform(Request request, ResponseDefinition responseDefinition,
- FileSource fileSource, Parameters parameters) {
-
- String requestBody = request.getBodyAsString();
-
- String notficationUrl = requestBody.substring(requestBody.indexOf("<notificationUrl>")+17, requestBody.indexOf("</notificationUrl>"));
- String messageId = requestBody.substring(requestBody.indexOf("<messageId>")+11, requestBody.indexOf("</messageId>"));
- String responseMessageId = "";
- String updatedResponse = "";
-
- try {
- // try supplied response file (if any)
- logger.info(" Supplied fileName: {}", responseDefinition.getBodyFileName());
- ackResponse = FileUtil.readResourceFile("__files/" + responseDefinition.getBodyFileName());
- notifyCallbackResponse = ackResponse;
- responseMessageId = ackResponse.substring(ackResponse.indexOf("<messageId>")+11, ackResponse.indexOf("</messageId>"));
- updatedResponse = ackResponse.replace(responseMessageId, messageId);
- } catch (Exception ex) {
- logger.debug("Exception :",ex);
- logger.info(" ******* Use default response file in 'vnfAdapter/vnfUpdateSimResponse.xml'");
- responseMessageId = notifyCallbackResponse.substring(notifyCallbackResponse.indexOf("<messageId>")+11, notifyCallbackResponse.indexOf("</messageId>"));
- updatedResponse = notifyCallbackResponse.replace(responseMessageId, messageId);
- }
-
- logger.info("response (mock) messageId : {}", responseMessageId);
- logger.info("request (replacement) messageId: {}", messageId);
-
- logger.info("vnf Response (before):{}", notifyCallbackResponse);
- logger.info("vnf Response (after):{}", updatedResponse);
-
- Object vnfDelay = MockResource.getMockProperties().get("vnf_delay");
- int delay = 300;
- if (vnfDelay != null) {
- delay = Integer.parseInt(vnfDelay.toString());
- }
-
- //Kick off callback thread
- logger.info("VnfAdapterUpdateMockTransformer notficationUrl: {} :delay: {}", notficationUrl, delay);
- CallbackResponseThread callbackResponseThread = new CallbackResponseThread(notficationUrl,updatedResponse, delay);
- callbackResponseThread.start();
-
- return ResponseDefinitionBuilder
- .like(responseDefinition).but()
- .withStatus(200).withBody(updatedResponse).withHeader("Content-Type", "text/xml")
- .build();
-
- }
-
- @Override
- public boolean applyGlobally() {
- return false;
- }
-
- private class CallbackResponseThread extends Thread {
-
- private String callbackUrl;
- private String payLoad;
- private int delay;
-
- public CallbackResponseThread(String callbackUrl, String payLoad, int delay) {
- this.callbackUrl = callbackUrl;
- this.payLoad = payLoad;
- this.delay = delay;
- }
-
- public void run () {
- try {
- //Delay sending callback response
- sleep(delay);
- } catch (InterruptedException e1) {
- logger.debug("Exception :", e1);
- }
-
- try {
- HttpClient client = new HttpClientFactory().newTextXmlClient(
- UriBuilder.fromUri(callbackUrl).build().toURL(),
- TargetEntity.VNF_ADAPTER);
- client.post(payLoad);
- } catch (Exception e) {
- logger.info("catch error in - request.post() ");
- logger.debug("Exception :", e);
- }
- }
-
- }
-}
-
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BPMNLogger.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BPMNLogger.java
deleted file mode 100644
index ede515650e..0000000000
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/BPMNLogger.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.core;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class BPMNLogger {
- private static Logger logger = LoggerFactory.getLogger(BPMNLogger.class);
-
- public static void debug (String isDebugLogEnabled, String LogText) {
- logger.debug(LogText);
- }
-
-
-}
-
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java
index 6166071437..fb794e251d 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/ResponseBuilder.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -21,6 +23,8 @@
package org.onap.so.bpmn.core;
import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Used in the output variable mapping configuration of subflow call activity
@@ -36,6 +40,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution;
*/
public class ResponseBuilder implements java.io.Serializable {
private static final long serialVersionUID = 1L;
+ private static final Logger logger = LoggerFactory.getLogger(ResponseBuilder.class);
/**
* Creates a WorkflowException using data from the execution variables.
@@ -48,28 +53,28 @@ public class ResponseBuilder implements java.io.Serializable {
String method = getClass().getSimpleName() + ".buildWorkflowException(" +
"execution=" + execution.getId() +
")";
- String isDebugLogEnabled = (String) execution.getVariable("isDebugLogEnabled");
- logDebug("Entered " + method, isDebugLogEnabled);
-
+
+ logger.debug("Entered " + method);
+
String prefix = (String) execution.getVariable("prefix");
String processKey = getProcessKey(execution);
- logDebug("processKey=" + processKey, isDebugLogEnabled);
+ logger.debug("processKey=" + processKey);
// See if there"s already a WorkflowException object in the execution.
WorkflowException theException = (WorkflowException) execution.getVariable("WorkflowException");
if (theException != null) {
- logDebug("Exited " + method + " - propagated " + theException, isDebugLogEnabled);
+ logger.debug("Exited " + method + " - propagated " + theException);
return theException;
}
-
+
// Look in the legacy variables: ErrorResponse and ResponseCode
String errorResponse = trimString(execution.getVariable(prefix + "ErrorResponse"), null);
String responseCode = trimString(execution.getVariable(prefix + "ResponseCode"), null);
- logDebug("errorResponse=" + errorResponse, isDebugLogEnabled);
- logDebug("responseCode=" + responseCode, isDebugLogEnabled);
+ logger.debug("errorResponse=" + errorResponse);
+ logger.debug("responseCode=" + responseCode);
if (errorResponse != null || !isOneOf(responseCode, null, "0", "200", "201", "202", "204")) {
// This is an error condition. We need to return a WorkflowExcpetion
@@ -93,8 +98,8 @@ public class ResponseBuilder implements java.io.Serializable {
String xmlErrorCode = trimString(getXMLTextElement(maybeXML, "ErrorCode"), null);
if (xmlErrorMessage != null || xmlErrorCode != null) {
- logDebug("xmlErrorMessage=" + xmlErrorMessage, isDebugLogEnabled);
- logDebug("xmlErrorCode=" + xmlErrorCode, isDebugLogEnabled);
+ logger.debug("xmlErrorMessage=" + xmlErrorMessage);
+ logger.debug("xmlErrorCode=" + xmlErrorCode);
if (xmlErrorMessage == null) {
errorResponse = "Received error code " + xmlErrorCode + " from " + processKey;
@@ -135,27 +140,26 @@ public class ResponseBuilder implements java.io.Serializable {
theException = new WorkflowException(processKey, intResponseCode, errorResponse);
execution.setVariable("WorkflowException", theException);
- logDebug("Exited " + method + " - created " + theException, isDebugLogEnabled);
+ logger.debug("Exited " + method + " - created " + theException);
return theException;
}
- logDebug("Exited " + method + " - no WorkflowException", isDebugLogEnabled);
+ logger.debug("Exited " + method + " - no WorkflowException");
return null;
}
-
+
/**
* Returns the "Response" variable, unless the execution variables
* indicate there was an error. In that case, null is returned.
* @param execution the execution
*/
public Object buildWorkflowResponse(DelegateExecution execution) {
-
+
String method = getClass().getSimpleName() + ".buildWorkflowResponse(" +
"execution=" + execution.getId() +
")";
- String isDebugLogEnabled = (String) execution.getVariable("isDebugLogEnabled");
- logDebug("Entered " + method, isDebugLogEnabled);
-
+ logger.debug("Entered " + method);
+
String prefix = (String) execution.getVariable("prefix");
String processKey = getProcessKey(execution);
@@ -169,16 +173,16 @@ public class ResponseBuilder implements java.io.Serializable {
isOneOf(responseCode, null, "0", "200", "201", "202", "204")) {
theResponse = execution.getVariable("WorkflowResponse");
-
+
if (theResponse == null) {
theResponse = execution.getVariable(processKey + "Response");
}
}
- logDebug("Exited " + method, isDebugLogEnabled);
+ logger.debug("Exited " + method);
return theResponse;
}
-
+
/**
* Checks if the specified item is one of the specified values.
* @param item the item
@@ -201,10 +205,10 @@ public class ResponseBuilder implements java.io.Serializable {
}
}
}
-
+
return false;
}
-
+
/**
* Creates a string value of the specified object, trimming whitespace in
* the process. If the result is null or empty, the specified empty string
@@ -221,7 +225,7 @@ public class ResponseBuilder implements java.io.Serializable {
String s = String.valueOf(object).trim();
return s.equals("") ? emptyStringValue : s;
}
-
+
/**
* Returns the process definition key (i.e. the process name) from the
* execution.
@@ -237,16 +241,7 @@ public class ResponseBuilder implements java.io.Serializable {
return execution.getProcessEngineServices().getRepositoryService()
.getProcessDefinition(execution.getProcessDefinitionId()).getKey();
}
-
- /**
- * Logs a message at the DEBUG level.
- * @param message the message
- * @param isDebugLogEnabled a flag indicating if DEBUG level is enabled
- */
- private void logDebug(String message, String isDebugLogEnabled) {
- BPMNLogger.debug(isDebugLogEnabled, message);
- }
-
+
/**
* Removes namespace definitions and prefixes from XML, if any.
*/
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java
index 194ce58fe9..9fd3bc596f 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java
@@ -36,6 +36,7 @@ import javax.xml.bind.annotation.XmlType;
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
* &lt;element name="cloudSiteId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="cloudOwner" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* &lt;element name="msoRequest" type="{http://org.onap.so/vnfNotify}msoRequest" minOccurs="0"/>
* &lt;element name="tenantCreated" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
* &lt;element name="tenantId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
@@ -52,6 +53,7 @@ import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "vnfRollback", propOrder = {
"cloudSiteId",
+ "cloudOwner",
"msoRequest",
"tenantCreated",
"tenantId",
@@ -61,6 +63,7 @@ import javax.xml.bind.annotation.XmlType;
public class VnfRollback {
protected String cloudSiteId;
+ protected String cloudOwner;
protected MsoRequest msoRequest;
protected boolean tenantCreated;
protected String tenantId;
@@ -92,6 +95,30 @@ public class VnfRollback {
}
/**
+ * Gets the value of the cloudOwner property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ /**
+ * Sets the value of the cloudOwner property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setCloudOwner(String value) {
+ this.cloudOwner = value;
+ }
+
+ /**
* Gets the value of the msoRequest property.
*
* @return
@@ -201,6 +228,7 @@ public class VnfRollback {
return
"<cloudSiteId>"+cloudSiteId+"</cloudSiteId>" + '\n' +
+ "<cloudOwner>"+cloudOwner+"</cloudOwner>" + '\n' +
msoRequestElement +
"<tenantCreated>"+tenantCreated+"</tenantCreated>" + '\n' +
"<tenantId>"+tenantId+"</tenantId>" + '\n' +
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
index f795bcc40e..3eed14bc30 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
@@ -53,7 +53,6 @@ import org.camunda.bpm.model.bpmn.impl.instance.FlowNodeImpl;
import org.camunda.bpm.model.bpmn.instance.EndEvent;
import org.camunda.bpm.model.bpmn.instance.FlowNode;
import org.camunda.bpm.model.bpmn.instance.StartEvent;
-import org.onap.so.bpmn.core.BPMNLogger;
import org.slf4j.Logger;
@@ -71,11 +70,11 @@ import org.springframework.stereotype.Component;
* Plugin for MSO logging and URN mapping.
*/
@Component
-public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
-
+public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
+
@Autowired
private LoggingParseListener loggingParseListener;
-
+
@Override
public void preInit(
ProcessEngineConfigurationImpl processEngineConfiguration) {
@@ -87,14 +86,14 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
}
preParseListeners.add(loggingParseListener);
}
-
+
/**
* Called when a process flow is parsed so we can inject listeners.
*/
@Component
- public class LoggingParseListener extends AbstractBpmnParseListener {
-
-
+ public class LoggingParseListener extends AbstractBpmnParseListener {
+
+
private void injectLogExecutionListener(ActivityImpl activity) {
activity.addListener(
ExecutionListener.EVENTNAME_END,
@@ -115,7 +114,7 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
@Override
public void parseStartEvent(Element startEventElement, ScopeImpl scope, ActivityImpl startEventActivity) {
- // Inject these listeners only on the main start event for the flow, not on any embedded subflow start events
+ // Inject these listeners only on the main start event for the flow, not on any embedded subflow start events
injectLogExecutionListener(startEventActivity);
}
@@ -275,15 +274,15 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
injectLogExecutionListener(messageActivity);
}
}
-
+
/**
* Logs details about the current activity.
- */
+ */
public class LoggingExecutionListener implements ExecutionListener {
private final Logger logger = LoggerFactory.getLogger(LoggingExecutionListener.class);
private String event;
-
+
public LoggingExecutionListener() {
this.event = "";
}
@@ -291,31 +290,31 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
public LoggingExecutionListener(String event) {
this.event = event;
}
-
+
public String getEvent() {
return event;
}
@Override
- public void notify(DelegateExecution execution) throws Exception {
+ public void notify(DelegateExecution execution) throws Exception {
//required for legacy groovy processing in camunda
execution.setVariable("isDebugLogEnabled", "true");
if (!isBlank(execution.getCurrentActivityName())) {
try {
-
+
String id = execution.getId();
- if (id != null ) {
+ if (id != null ) {
RepositoryService repositoryService = execution.getProcessEngineServices().getRepositoryService();
String processName = repositoryService.createProcessDefinitionQuery()
.processDefinitionId(execution.getProcessDefinitionId())
.singleResult()
- .getName();
+ .getName();
+
-
String requestId = (String) execution.getVariable("mso-request-id");
String svcid = (String) execution.getVariable("mso-service-instance-id");
}
- } catch(Exception e) {
+ } catch(Exception e) {
logger.error("Exception occurred", e);
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java
index 9b8f6cd5cc..8bc0055343 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -40,9 +42,10 @@ import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl;
import org.camunda.bpm.engine.impl.pvm.process.TransitionImpl;
import org.camunda.bpm.engine.impl.util.xml.Element;
-import org.onap.so.bpmn.core.BPMNLogger;
import org.onap.so.bpmn.core.WorkflowException;
import org.springframework.stereotype.Component;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* This plugin does the following:
@@ -60,7 +63,8 @@ import org.springframework.stereotype.Component;
*/
@Component
public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin {
-
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowExceptionPlugin.class);
+
@Override
public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
List<BpmnParseListener> preParseListeners =
@@ -73,7 +77,7 @@ public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin {
preParseListeners.add(new WorkflowExceptionParseListener());
}
-
+
public static class WorkflowExceptionParseListener extends AbstractBpmnParseListener {
@Override
public void parseProcess(Element processElement, ProcessDefinitionEntity processDefinition) {
@@ -131,7 +135,7 @@ public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin {
}
}
}
-
+
/**
* If there is a WorkflowException object in the execution, this method
* removes it (saving a copy of it in a different variable).
@@ -147,8 +151,7 @@ public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin {
saveName = "SavedWorkflowException" + (++index);
}
- BPMNLogger.debug((String)execution.getVariable("isDebugLogEnabled"),
- "WorkflowExceptionResetTask is moving WorkflowException to " + saveName);
+ logger.debug("WorkflowExceptionResetTask is moving WorkflowException to " + saveName);
execution.setVariable(saveName, workflowException);
execution.setVariable("WorkflowException", null);
@@ -163,8 +166,7 @@ public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin {
public static class WorkflowExceptionTriggerTask implements JavaDelegate {
public void execute(DelegateExecution execution) throws Exception {
if (execution.getVariable("WorkflowException") instanceof WorkflowException) {
- BPMNLogger.debug((String)execution.getVariable("isDebugLogEnabled"),
- "WorkflowExceptionTriggerTask is generating a MSOWorkflowException event");
+ logger.debug("WorkflowExceptionTriggerTask is generating a MSOWorkflowException event");
throw new BpmnError("MSOWorkflowException");
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java
index ad08f8b2bb..1ef864b543 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java
@@ -59,6 +59,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest {
private final String CREATE_VF_MODULE_REQUEST =
"<createVfModuleRequest>" + EOL +
" <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
+ " <cloudOwner>cloudOwner</cloudOwner>" + EOL +
" <tenantId>tenantId</tenantId>" + EOL +
" <vnfId>vnfId</vnfId>" + EOL +
" <vfModuleName>vfModuleName</vfModuleName>" + EOL +
@@ -94,6 +95,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest {
private final String UPDATE_VF_MODULE_REQUEST =
"<updateVfModuleRequest>" + EOL +
" <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
+ " <cloudOwner>cloudOwner</cloudOwner>" + EOL +
" <tenantId>tenantId</tenantId>" + EOL +
" <vnfId>vnfId</vnfId>" + EOL +
" <vfModuleName>vfModuleName</vfModuleName>" + EOL +
@@ -130,6 +132,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest {
private final String DELETE_VF_MODULE_REQUEST =
"<deleteVfModuleRequest>" + EOL +
" <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
+ " <cloudOwner>cloudOwner</cloudOwner>" + EOL +
" <tenantId>tenantId</tenantId>" + EOL +
" <vnfId>vnfId</vnfId>" + EOL +
" <vfModuleId>vfModuleId</vfModuleId>" + EOL +
@@ -150,6 +153,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest {
" <skipAAI>true</skipAAI>" + EOL +
" <vfModuleRollback>" + EOL +
" <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
+ " <cloudOwner>cloudOwner</cloudOwner>" + EOL +
" <tenantId>tenantId</tenantId>" + EOL +
" <vnfId>vnfId</vnfId>" + EOL +
" <vfModuleId>vfModuleId</vfModuleId>" + EOL +
@@ -186,6 +190,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest {
" <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
" <vfModuleCreated>true</vfModuleCreated>" + EOL +
" <tenantId>tenantId</tenantId>" + EOL +
+ " <cloudOwner>cloudOwner</cloudOwner>" + EOL +
" <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
" <msoRequest>" + EOL +
" <requestId>requestId</requestId>" + EOL +
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
index 117d3b213a..eed2978bc7 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
@@ -1100,6 +1100,10 @@ public abstract class WorkflowTest {
"/tns:createVnfNotification/tns:rollback/tns:cloudSiteId/text()");
rollback.setCloudSiteId(cloudSiteId);
+ String cloudOwner = xpathTool.evaluate(
+ "/tns:createVnfNotification/tns:rollback/tns:cloudOwner/text()");
+ rollback.setCloudOwner(cloudOwner);
+
String requestId = xpathTool.evaluate(
"/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()");
String serviceInstanceId = xpathTool.evaluate(
@@ -1276,6 +1280,10 @@ public abstract class WorkflowTest {
"/tns:updateVnfNotification/tns:rollback/tns:cloudSiteId/text()");
rollback.setCloudSiteId(cloudSiteId);
+ String cloudOwner = xpathTool.evaluate(
+ "/tns:updateVnfNotification/tns:rollback/tns:cloudOwner/text()");
+ rollback.setCloudOwner(cloudOwner);
+
String requestId = xpathTool.evaluate(
"/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()");
String serviceInstanceId = xpathTool.evaluate(
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
index 2437476b59..76ca2a89cc 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.2">
<bpmn:process id="WorkflowActionBB" name="WorkflowActionBB" isExecutable="true">
<bpmn:startEvent id="Start_WorkflowActionBB" name="start">
<bpmn:outgoing>SequenceFlow_15s0okp</bpmn:outgoing>
@@ -88,7 +88,7 @@
</bpmn:serviceTask>
</bpmn:subProcess>
<bpmn:sequenceFlow id="SequenceFlow_0v588sm" name="Rollback = true" sourceRef="ExclusiveGateway_Finished" targetRef="Task_RollbackExecutionPath">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"}]]></bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"||execution.getVariable("handlingCode")=="RollbackToCreated"}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_1atzsgn" sourceRef="Task_RollbackExecutionPath" targetRef="Task_SelectBB">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isRollbackNeeded")==true}]]></bpmn:conditionExpression>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy
index ccd9f9bd02..cf53aff878 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy
@@ -68,6 +68,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
execution.setVariable('DELVfModVol_vnfType', null)
execution.setVariable('DELVfModVol_serviceId', null)
execution.setVariable('DELVfModVol_cloudRegion', null)
+ execution.setVariable('DELVfModVol_cloudOwner', null)
execution.setVariable('DELVfModVol_tenantId', null)
execution.setVariable('DELVfModVol_volumeParams', null)
execution.setVariable('DELVfModVol_volumeGroupHeatStackId', null)
@@ -141,6 +142,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
execution.setVariable('DELVfModVol_volumeOutputs', utils.getNodeXml(request, 'volume-outputs', false))
execution.setVariable('DELVfModVol_volumeParams', utils.getNodeXml(request, 'volume-params'))
execution.setVariable('DELVfModVol_cloudRegion', utils.getNodeText(request, 'aic-cloud-region'))
+ execution.setVariable('DELVfModVol_cloudOwner', utils.getNodeText(request, 'cloud-owner'))
setBasicDBAuthHeader(execution, isDebugLogEnabled)
@@ -308,6 +310,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
public void prepareVnfAdapterDeleteRequest(DelegateExecution execution, isDebugLogEnabled) {
def cloudRegion = execution.getVariable('DELVfModVol_cloudRegion')
+ def cloudOwner = execution.getVariable('DELVfModVol_cloudOwner')
def tenantId = execution.getVariable('DELVfModVol_tenantId')
def volumeGroupId = execution.getVariable('DELVfModVol_volumeGroupId')
def volumeGroupHeatStackId = execution.getVariable('DELVfModVol_volumeGroupHeatStackId')
@@ -324,6 +327,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor {
String vnfAdapterRestRequest = """
<deleteVolumeGroupRequest>
<cloudSiteId>${MsoUtils.xmlEscape(cloudRegion)}</cloudSiteId>
+ <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner>
<tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId>
<volumeGroupId>${MsoUtils.xmlEscape(volumeGroupId)}</volumeGroupId>
<volumeGroupStackId>${MsoUtils.xmlEscape(volumeGroupHeatStackId)}</volumeGroupStackId>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
index c03f9f9c95..7a606d515c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
@@ -982,6 +982,8 @@ public class DoCreateVfModule extends VfModuleBase {
//Get variables
//cloudSiteId
def cloudSiteId = execution.getVariable("DCVFM_cloudSiteId")
+ //cloudOwner
+ def cloudOwner = execution.getVariable("DCVFM_cloudOwner")
//tenantId
def tenantId = execution.getVariable("DCVFM_tenantId")
//vnfType
@@ -1070,6 +1072,7 @@ public class DoCreateVfModule extends VfModuleBase {
String createVnfARequest = """
<createVfModuleRequest>
<cloudSiteId>${MsoUtils.xmlEscape(cloudSiteId)}</cloudSiteId>
+ <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner>
<tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId>
<vnfId>${MsoUtils.xmlEscape(vnfId)}</vnfId>
<vnfName>${MsoUtils.xmlEscape(vnfName)}</vnfName>
@@ -1233,6 +1236,7 @@ public class DoCreateVfModule extends VfModuleBase {
def vfModuleModelName = execution.getVariable("DCVFM_vfModuleModelName")
def vnfId = execution.getVariable("DCVFM_vnfId")
def cloudSiteId = execution.getVariable("DCVFM_cloudSiteId")
+ def cloudOwner = execution.getVariable("DCVFM_cloudOwner")
def sdncVersion = execution.getVariable("DCVFM_sdncVersion")
def serviceModelInfo = execution.getVariable("serviceModelInfo")
def vnfModelInfo = execution.getVariable("vnfModelInfo")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy
index a6040ac290..07ffa38498 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy
@@ -92,6 +92,8 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
execution.setVariable("DCVFMR_vfModuleModelName", vfModuleModelName)
String cloudSiteId = rollbackData.get("VFMODULE", "aiccloudregion")
execution.setVariable("DCVFMR_cloudSiteId", cloudSiteId)
+ String cloudOwner = rollbackData.get("VFMODULE", "cloudowner")
+ execution.setVariable("DCVFMR_cloudOwner", cloudOwner)
String heatStackId = rollbackData.get("VFMODULE", "heatstackid")
execution.setVariable("DCVFMR_heatStackId", heatStackId)
String requestId = rollbackData.get("VFMODULE", "msorequestid")
@@ -358,6 +360,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
String origRequestId = execution.getVariable("DCVFMR_requestId")
String srvInstId = execution.getVariable("DCVFMR_serviceInstanceId")
String aicCloudRegion = execution.getVariable("DCVFMR_cloudSiteId")
+ String cloudOwner = execution.getVariable("DCVFMR_cloudOwner")
String vnfId = execution.getVariable("DCVFMR_vnfId")
String vfModuleId = execution.getVariable("DCVFMR_vfModuleId")
String vfModuleStackId = execution.getVariable("DCVFMR_heatStackId")
@@ -373,6 +376,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{
String request = """
<deleteVfModuleRequest>
<cloudSiteId>${MsoUtils.xmlEscape(aicCloudRegion)}</cloudSiteId>
+ <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner>
<tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId>
<vnfId>${MsoUtils.xmlEscape(vnfId)}</vnfId>
<vfModuleId>${MsoUtils.xmlEscape(vfModuleId)}</vfModuleId>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
index bedf5e0948..05ccfa02ba 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy
@@ -111,6 +111,8 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("tenantId", tenantId)
String cloudSiteId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId")
execution.setVariable("cloudSiteId", cloudSiteId)
+ String cloudOwner = jsonUtil.getJsonValue(cloudConfiguration, "cloudOwner")
+ execution.setVariable("cloudOwner", cloudOwner)
// Source is HARDCODED
String source = "VID"
execution.setVariable("source", source)
@@ -176,6 +178,8 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("vfModuleModelName", vfModuleModelName)
String cloudSiteId = utils.getNodeText(xml, "aic-cloud-region")
execution.setVariable("cloudSiteId", cloudSiteId)
+ String cloudOwner = utils.getNodeText(xml, "cloud-owner")
+ execution.setVariable("cloudOwner", cloudOwner)
}
// formulate the request for PrepareUpdateAAIVfModule
@@ -281,6 +285,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
def origRequestId = execution.getVariable('requestId')
def srvInstId = execution.getVariable("serviceInstanceId")
def aicCloudRegion = execution.getVariable("cloudSiteId")
+ def cloudOwner = execution.getVariable("cloudOwner")
def vnfId = execution.getVariable("vnfId")
def vfModuleId = execution.getVariable("vfModuleId")
def vfModuleStackId = execution.getVariable('DoDVfMod_heatStackId')
@@ -296,6 +301,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{
String request = """
<deleteVfModuleRequest>
<cloudSiteId>${MsoUtils.xmlEscape(aicCloudRegion)}</cloudSiteId>
+ <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner>
<tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId>
<vnfId>${MsoUtils.xmlEscape(vnfId)}</vnfId>
<vfModuleId>${MsoUtils.xmlEscape(vfModuleId)}</vfModuleId>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
index 3be52f50f7..47aec46277 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy
@@ -79,6 +79,9 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
String cloudSiteId = execution.getVariable("lcpCloudRegionId")
execution.setVariable("cloudSiteId", cloudSiteId)
logger.debug("cloudSiteId: " + cloudSiteId)
+ String cloudOwner = execution.getVariable("cloudOwner")
+ execution.setVariable("cloudOwner", cloudOwner)
+ logger.debug("cloudOwner: " + cloudOwner)
// Source is HARDCODED
String source = "VID"
execution.setVariable("source", source)
@@ -363,6 +366,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
def origRequestId = execution.getVariable('requestId')
def srvInstId = execution.getVariable("serviceInstanceId")
def aicCloudRegion = execution.getVariable("cloudSiteId")
+ def cloudOwner = execution.getVariable("cloudOwner")
def vnfId = execution.getVariable("vnfId")
def vfModuleId = execution.getVariable("vfModuleId")
def vfModuleStackId = execution.getVariable('DDVMFV_heatStackId')
@@ -378,6 +382,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase {
String request = """
<deleteVfModuleRequest>
<cloudSiteId>${MsoUtils.xmlEscape(aicCloudRegion)}</cloudSiteId>
+ <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner>
<tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId>
<vnfId>${MsoUtils.xmlEscape(vnfId)}</vnfId>
<vfModuleId>${MsoUtils.xmlEscape(vfModuleId)}</vfModuleId>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy
index 787b582808..6acf2223b0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy
@@ -217,6 +217,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
*/
public void prepareVnfAdapterDeleteRequest(DelegateExecution execution, isDebugLogEnabled) {
def cloudRegion = execution.getVariable(prefix+'aicCloudRegion')
+ def cloudOwner = execution.getVariable(prefix+'cloudOwner')
def tenantId = execution.getVariable('tenantId') // input parameter (optional) - see preProcessRequest
def volumeGroupId = execution.getVariable('volumeGroupId') // input parameter (required)
def volumeGroupHeatStackId = execution.getVariable(prefix+'volumeGroupHeatStackId') // from AAI query volume group
@@ -233,6 +234,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor{
String vnfAdapterRestRequest = """
<deleteVolumeGroupRequest>
<cloudSiteId>${MsoUtils.xmlEscape(cloudRegion)}</cloudSiteId>
+ <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner>
<tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId>
<volumeGroupId>${MsoUtils.xmlEscape(volumeGroupId)}</volumeGroupId>
<volumeGroupStackId>${MsoUtils.xmlEscape(volumeGroupHeatStackId)}</volumeGroupStackId>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
index a17dc9d7fe..013f66b008 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
@@ -143,6 +143,12 @@ public class DoUpdateVfModule extends VfModuleBase {
execution.setVariable("DOUPVfMod_aicCloudRegion", cloudSiteId)
logger.debug("cloudSiteId: " + cloudSiteId)
+
+ //cloudOwner
+ def cloudOwner = execution.getVariable("cloudOwner")
+ execution.setVariable("DOUPVfMod_cloudOwner", cloudOwner)
+ logger.debug("cloudOwner: " + cloudOwner)
+
//vnfType
def vnfType = execution.getVariable("vnfType")
execution.setVariable("DOUPVfMod_vnfType", vnfType)
@@ -304,6 +310,7 @@ public class DoUpdateVfModule extends VfModuleBase {
execution.setVariable('DOUPVfMod_modelCustomizationUuid', getNodeTextForce(vnfInputs, 'model-customization-id'))
execution.setVariable('DOUPVfMod_serviceId', getRequiredNodeText(execution, vnfInputs, 'service-id'))
execution.setVariable('DOUPVfMod_aicCloudRegion', getRequiredNodeText(execution, vnfInputs, 'aic-cloud-region'))
+ execution.setVariable('DOUPVfMod_cloudOwner', getRequiredNodeText(execution, vnfInputs, 'cloud-owner'))
execution.setVariable('DOUPVfMod_tenantId', getRequiredNodeText(execution, vnfInputs, 'tenant-id'))
//isBaseVfModule
def isBaseVfModule = "false"
@@ -640,6 +647,7 @@ public class DoUpdateVfModule extends VfModuleBase {
heatStackId = vfModule.getHeatStackId()
}
def cloudId = execution.getVariable('DOUPVfMod_aicCloudRegion')
+ def cloudOwner = execution.getVariable('DOUPVfMod_cloudOwner')
def vnfType = execution.getVariable('DOUPVfMod_vnfType')
def vnfName = execution.getVariable('DOUPVfMod_vnfName')
def vfModuleModelName = execution.getVariable('DOUPVfMod_vfModuleModelName')
@@ -672,6 +680,7 @@ public class DoUpdateVfModule extends VfModuleBase {
String vnfAdapterRestRequest = """
<updateVfModuleRequest>
<cloudSiteId>${MsoUtils.xmlEscape(cloudId)}</cloudSiteId>
+ <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner>
<tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId>
<vnfId>${MsoUtils.xmlEscape(vnfId)}</vnfId>
<vfModuleId>${MsoUtils.xmlEscape(vfModuleId)}</vfModuleId>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy
index 0c3294778a..3e9b934a2e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy
@@ -100,6 +100,7 @@ class UpdateVfModuleVolume extends VfModuleBase {
execution.setVariable('UPDVfModVol_vnfType', getRequiredNodeText(execution, volumeInputs, 'vnf-type'))
execution.setVariable('UPDVfModVol_serviceId', getRequiredNodeText(execution, volumeInputs, 'service-id'))
execution.setVariable('UPDVfModVol_aicCloudRegion', getRequiredNodeText(execution, volumeInputs, 'aic-cloud-region'))
+ execution.setVariable('UPDVfModVol_cloudOwner', getRequiredNodeText(execution, volumeInputs, 'cloud-owner'))
execution.setVariable('UPDVfModVol_tenantId', getRequiredNodeText(execution, volumeInputs, 'tenant-id'))
def volumeParams = utils.getNodeXml(request, 'volume-params')
@@ -255,6 +256,7 @@ class UpdateVfModuleVolume extends VfModuleBase {
String vnfAdapterRestRequest = """
<updateVolumeGroupRequest>
<cloudSiteId>${MsoUtils.xmlEscape(aicCloudRegion)}</cloudSiteId>
+ <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner>
<tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId>
<volumeGroupId>${MsoUtils.xmlEscape(volumeGroupId)}</volumeGroupId>
<volumeGroupStackId>${MsoUtils.xmlEscape(volumeGroupHeatStackId)}</volumeGroupStackId>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy
index 361d6a2173..ab7b659b51 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy
@@ -135,6 +135,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
execution.setVariable('UPDVfModVol_vnfVersion', getRequiredNodeText(execution, volumeInputs, 'asdc-service-model-version'))
execution.setVariable('UPDVfModVol_serviceId', utils.getNodeText(volumeInputs, 'service-id'))
execution.setVariable('UPDVfModVol_aicCloudRegion', getRequiredNodeText(execution, volumeInputs, 'aic-cloud-region'))
+ execution.setVariable('UPDVfModVol_cloudRegion', getRequiredNodeText(execution, volumeInputs, 'cloud-owner'))
execution.setVariable('UPDVfModVol_tenantId', getRequiredNodeText(execution, volumeInputs, 'tenant-id'))
//execution.setVariable('UPDVfModVol_modelCustomizationId', getRequiredNodeText(execution, volumeInputs, 'model-customization-id'))
@@ -328,6 +329,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
String vnfAdapterRestRequest = """
<updateVolumeGroupRequest>
<cloudSiteId>${MsoUtils.xmlEscape(aicCloudRegion)}</cloudSiteId>
+ <cloudOwner>${MsoUtils.xmlEscape(cloudOwner)}</cloudOwner>
<tenantId>${MsoUtils.xmlEscape(tenantId)}</tenantId>
<vnfId>${MsoUtils.xmlEscape(vnfId)}</vnfId>
<vnfName>${MsoUtils.xmlEscape(vnfName)}</vnfName>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy
index e7ebe23e75..fc5960b92f 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy
@@ -165,6 +165,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{
when(mockExecution.getVariable("prefix")).thenReturn(prefix)
when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
when(mockExecution.getVariable("DCVFM_cloudSiteId")).thenReturn("12345")
+ when(mockExecution.getVariable("DCVFM_cloudOwner")).thenReturn("CloudOwner")
when(mockExecution.getVariable("rollbackData")).thenReturn(new RollbackData())
List fqdnList = new ArrayList()
fqdnList.add("test")
@@ -194,6 +195,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{
when(mockExecution.getVariable("prefix")).thenReturn(prefix)
when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
when(mockExecution.getVariable("DCVFM_cloudSiteId")).thenReturn("12345")
+ when(mockExecution.getVariable("DCVFM_cloudOwner")).thenReturn("CloudOwner")
when(mockExecution.getVariable("rollbackData")).thenReturn(new RollbackData())
List fqdnList = new ArrayList()
fqdnList.add("test")
@@ -223,6 +225,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{
when(mockExecution.getVariable("prefix")).thenReturn(prefix)
when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
when(mockExecution.getVariable("DCVFM_cloudSiteId")).thenReturn("12345")
+ when(mockExecution.getVariable("DCVFM_cloudOwner")).thenReturn("CloudOwner")
when(mockExecution.getVariable("rollbackData")).thenReturn(new RollbackData())
List fqdnList = new ArrayList()
fqdnList.add("test")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy
index d635b2311a..59a2b0eda3 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy
@@ -182,6 +182,7 @@ class DoUpdateVfModuleTest extends MsoGroovyTest{
ExecutionEntity mockExecution = setupMock()
when(mockExecution.getVariable("prefix")).thenReturn(prefix)
when(mockExecution.getVariable(prefix + "aicCloudRegion")).thenReturn("RDM2WAGPLCP")
+ when(mockExecution.getVariable(prefix + "cloudRegion")).thenReturn("CloudOwner")
when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("cb510af0-5b21-4bc7-86d9-323cb396ce32")
when(mockExecution.getVariable(prefix + "volumeGroupStackId")).thenReturn("12345")
when(mockExecution.getVariable(prefix + "vfModuleName")).thenReturn("PCRF::module-0-2")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy
index 06ae576307..8af15de75b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy
@@ -143,6 +143,7 @@ class UpdateVfModuleVolumeInfraV1Test extends MsoGroovyTest{
when(mockExecution.getVariable("prefix")).thenReturn(prefix)
when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
when(mockExecution.getVariable(prefix + "aicCloudRegion")).thenReturn("RDM2WAGPLCP")
+ when(mockExecution.getVariable(prefix + "cloudOwner")).thenReturn("CloudOwner")
when(mockExecution.getVariable(prefix + "tenantId")).thenReturn("")
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setHeatStackId("heatStackId")
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
index 98174d59b6..258bea9a01 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
@@ -121,6 +121,7 @@ public class VnfAdapterVfModuleObjectMapper {
CreateVfModuleRequest createVfModuleRequest = new CreateVfModuleRequest();
createVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
+ createVfModuleRequest.setCloudOwner(cloudRegion.getCloudOwner());
createVfModuleRequest.setTenantId(cloudRegion.getTenantId());
createVfModuleRequest.setVfModuleId(vfModule.getVfModuleId());
createVfModuleRequest.setVfModuleName(vfModule.getVfModuleName());
@@ -776,6 +777,7 @@ public class VnfAdapterVfModuleObjectMapper {
VfModule vfModule) throws IOException {
DeleteVfModuleRequest deleteVfModuleRequest = new DeleteVfModuleRequest();
deleteVfModuleRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
+ deleteVfModuleRequest.setCloudOwner(cloudRegion.getCloudOwner());
deleteVfModuleRequest.setTenantId(cloudRegion.getTenantId());
deleteVfModuleRequest.setVnfId(genericVnf.getVnfId());
deleteVfModuleRequest.setVfModuleId(vfModule.getVfModuleId());
@@ -823,4 +825,4 @@ public class VnfAdapterVfModuleObjectMapper {
}
return baseVfModule;
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
index 138a20b609..f412720af7 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
@@ -50,7 +50,7 @@ public class AAIConfigurationResources {
*/
public void createConfiguration(Configuration configuration) {
AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
- configuration.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
+ configuration.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
injectionHelper.getAaiClient().create(configurationURI, aaiConfiguration);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
index 99d5fca31f..cae4a19f20 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
@@ -42,7 +42,6 @@ import org.springframework.stereotype.Component;
public class SDNCClient {
private static final Logger logger = LoggerFactory.getLogger(SDNCClient.class);
- private BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
@Autowired
private SDNCProperties properties;
@@ -61,6 +60,8 @@ public class SDNCClient {
public String post(Object request, SDNCTopology topology) throws MapperException, BadResponseException {
String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
String targetUrl = properties.getHost() + properties.getPath() + ":" + topology.toString() + "/";
+ BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
+
STOClient.setTargetUrl(targetUrl);
HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
STOClient.setHttpHeader(httpHeader);
@@ -70,7 +71,8 @@ public class SDNCClient {
public String post(Object request, String url) throws MapperException, BadResponseException {
- String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
+ String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
+ BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
STOClient.setTargetUrl(url);
HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
STOClient.setHttpHeader(httpHeader);
@@ -91,7 +93,8 @@ public class SDNCClient {
public String get(String queryLink) throws MapperException, BadResponseException {
String request = "";
String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
- String targetUrl = UriBuilder.fromUri(properties.getHost()).path(queryLink).build().toString();
+ String targetUrl = UriBuilder.fromUri(properties.getHost()).path(queryLink).build().toString();
+ BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
STOClient.setTargetUrl(targetUrl);
HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
STOClient.setHttpHeader(httpHeader);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
index 4aeed71177..4bf445949a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
@@ -98,7 +98,7 @@ public class AAIConfigurationResourcesTest extends TestDataSetup{
aaiConfigurationResources.createConfiguration(configuration);
- assertEquals(OrchestrationStatus.INVENTORIED, configuration.getOrchestrationStatus());
+ assertEquals(OrchestrationStatus.ASSIGNED, configuration.getOrchestrationStatus());
verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Configuration.class));
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
index e09dcd8d2d..cd05aa558e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
@@ -116,10 +116,11 @@ public class ActivateVnfStatusOperationalEnvironment {
// Update AAI to ACTIVE if Overall success
if (isOverallSuccess) {
- OperationalEnvironment aaiOpEnv = getAAIOperationalEnvironment(this.queryServiceModelResponse.getVnfOperationalEnvId());
+ String vnfOperationalEnvironmentId = this.queryServiceModelResponse.getVnfOperationalEnvId();
+ OperationalEnvironment aaiOpEnv = getAAIOperationalEnvironment(vnfOperationalEnvironmentId);
if (aaiOpEnv != null) {
aaiOpEnv.setOperationalEnvironmentStatus("ACTIVE");
- aaiHelper.updateAaiOperationalEnvironment(operationalEnvironmentId, aaiOpEnv);
+ aaiHelper.updateAaiOperationalEnvironment(vnfOperationalEnvironmentId, aaiOpEnv);
}else {
requestDb.updateInfraFailureCompletion("Unable to update ACTIVATE status in AAI. ", this.origRequestId, this.queryServiceModelResponse.getVnfOperationalEnvId());
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
index 6722941f95..c0250f7315 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
@@ -240,9 +240,9 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
- stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/operational-environment/VNF_operationalEnvironmentId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(json).withStatus(HttpStatus.SC_ACCEPTED)));
- stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
+ stubFor(put(urlPathEqualTo("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/operational-environment/VNF_operationalEnvironmentId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
activateVnfStatus.execute(requestId, request);
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java
index 34832b9917..0a74c1d7be 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java
@@ -33,10 +33,12 @@ import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.openpojo.business.annotation.BusinessKey;
/**
@@ -50,6 +52,8 @@ import com.openpojo.business.annotation.BusinessKey;
*/
@Entity
+
+@JsonInclude(Include.NON_NULL)
@Table(name = "request_processing_data")
public class RequestProcessingData implements Serializable{
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
index 5958397851..9c29d968c9 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
@@ -308,7 +308,7 @@ public class RequestsDbClient {
public void saveRequestProcessingData(RequestProcessingData requestProcessingData) {
HttpHeaders headers = getHttpHeaders();
- URI uri = getUri(endpoint + requestProcessingDataURI);
+ URI uri = getUri(requestProcessingDataURI);
HttpEntity<RequestProcessingData> entity = new HttpEntity<>(requestProcessingData, headers);
restTemplate.postForLocation(uri, entity);
}
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.spec.ts
index 8205226f9e..8f2af84b0d 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.spec.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.spec.ts
@@ -1,138 +1,218 @@
-/**
-============LICENSE_START=======================================================
- Copyright (C) 2018 Ericsson. All rights reserved.
-================================================================================
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
- limitations under the License.
-
-SPDX-License-Identifier: Apache-2.0
-============LICENSE_END=========================================================
-
-@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com
-*/
-
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { DetailsComponent } from './details.component';
-import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
-import { RouterTestingModule } from '@angular/router/testing';
-import { MatTableModule } from '@angular/material';
-import { inject } from '@angular/core/testing';
-import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
-import { HttpClientModule } from '@angular/common/http';
-import { HttpClient } from '@angular/common/http';
-import { RouterModule } from '@angular/router';
-import { APP_BASE_HREF } from '@angular/common';
-import { ToastrNotificationService } from '../toastr-notification-service.service';
-import { DataService } from '../data.service';
-import { Observable, of } from 'rxjs';
-import { ACTINST } from '../model/activityInstance.model';
-import { PDI } from '../model/processDefinition.model';
-import { PII } from '../model/processInstance.model';
-import { VarInstance } from '../model/variableInstance.model';
-
-// Generate stub for toastr popup notifications
-class StubbedToastrNotificationService extends ToastrNotificationService {
- toastrSettings() {
- }
-}
-
-// Create SPY Object for Jasmine tests to mock DataService
-let spyDataService: jasmine.SpyObj<DataService>;
-
-describe('DetailsComponent', () => {
- beforeEach(async(() => {
- spyDataService = jasmine.createSpyObj('DataService', ['getActivityInstance', 'getVariableInstance']);
-
- TestBed.configureTestingModule({
- providers: [DetailsComponent, HttpClient, HttpTestingController,
- { provide: APP_BASE_HREF, useValue: '/' },
- { provide: ToastrNotificationService, useClass: StubbedToastrNotificationService },
- { provide: DataService, useValue: spyDataService }],
- imports: [RouterTestingModule, MatTableModule, HttpClientModule, RouterModule.forRoot([])],
- schemas: [
- CUSTOM_ELEMENTS_SCHEMA
- ]
- })
- .compileComponents();
- }));
-
- // Ensure creation of DetailsComponent component
- it('component should be created', inject([DetailsComponent],
- (detailsComponent: DetailsComponent) => {
- expect(detailsComponent).toBeTruthy();
- }));
-
-
- // Mock an activityInstance and ensure array is populated
- it('activityInstance should be defined if data service returns activities', inject([DetailsComponent],
- (detailsComponent: DetailsComponent) => {
- const activity: ACTINST = {
- activityId: "",
- processInstanceId: "",
- calledProcessInstanceId: "",
- activityName: "",
- activityType: "",
- durationInMillis: "1",
- endTime: "",
- startTime: ""
- };
- spyDataService.getActivityInstance.and.returnValue(of([activity]));
- detailsComponent.getActInst("");
- expect(detailsComponent.activityInstance.length).toEqual(1);
- }));
-
-
- // Create a processDefinition and ensure it is defined
- it('processDefinition should be defined if PDI populated', inject([DetailsComponent],
- (detailsComponent: DetailsComponent) => {
- const activity: PDI = {
- processDefinitionId: "1",
- processDefinitionXml: ""
- };
- detailsComponent.getProcessDefinition("");
- detailsComponent.processDefinition = activity;
- expect(detailsComponent.processDefinition).toBeDefined();
- }));
-
-
- // Create a processInstance and ensure it is defined
- it('processInstance should be defined if PII populated', inject([DetailsComponent],
- (detailsComponent: DetailsComponent) => {
- const testVals: PII = {
- processInstancId: "1",
- processDefinitionId: "1",
- processDefinitionName: "test",
- superProcessInstanceId: "1"
- };
- detailsComponent.getProcInstance("");
- detailsComponent.processInstance = testVals;
- expect(detailsComponent.processInstance).toBeDefined();
- }));
-
-
- // displayCamundaflow test
- // TODO
-
- // Mock an variableInstance and ensure array is populated
- it('variableInstance should be defined if data service returns activities', inject([DetailsComponent],
- (detailsComponent: DetailsComponent) => {
- const activity2: VarInstance = {
- name: "a",
- type: "a",
- value: "1"
- };
- spyDataService.getVariableInstance.and.returnValue(of([activity2]));
- detailsComponent.getVarInst("");
- expect(detailsComponent.variableInstance.length).toEqual(1);
- }));
-});
+/**
+============LICENSE_START=======================================================
+ Copyright (C) 2018 Ericsson. All rights reserved.
+================================================================================
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+ limitations under the License.
+
+SPDX-License-Identifier: Apache-2.0
+============LICENSE_END=========================================================
+
+@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com, andrei.barcovschi@ericsson.com
+*/
+
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { DetailsComponent } from './details.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { RouterTestingModule } from '@angular/router/testing';
+import { MatTableModule } from '@angular/material';
+import { inject } from '@angular/core/testing';
+import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
+import { HttpClientModule } from '@angular/common/http';
+import { HttpClient } from '@angular/common/http';
+import { RouterModule } from '@angular/router';
+import { APP_BASE_HREF } from '@angular/common';
+import { ToastrNotificationService } from '../toastr-notification-service.service';
+import { DataService } from '../data.service';
+import { Observable, of, throwError } from 'rxjs';
+import { ACTINST } from '../model/activityInstance.model';
+import { PDI } from '../model/processDefinition.model';
+import { PII } from '../model/processInstance.model';
+import { VarInstance } from '../model/variableInstance.model';
+import { ActivatedRoute } from '@angular/router';
+import { Params } from '@angular/router';
+
+// Generate stub for toastr popup notifications
+class StubbedToastrNotificationService extends ToastrNotificationService {
+ toastrSettings() {}
+ info() {}
+ error() {}
+}
+
+const startActivity: ACTINST = {
+ activityId: "StartEvent_1",
+ processInstanceId: "processInstanceId-val-1234",
+ calledProcessInstanceId: "",
+ activityName: "",
+ activityType: "",
+ durationInMillis: "1",
+ endTime: "",
+ startTime: ""
+};
+
+const subProcessActivity: ACTINST = {
+ activityId: "CallActivity_14h26ae",
+ processInstanceId: "processInstanceId-val-1234",
+ calledProcessInstanceId: "1234",
+ activityName: "",
+ activityType: "",
+ durationInMillis: "1",
+ endTime: "",
+ startTime: ""
+};
+
+const processDefinition: PDI = {
+ processDefinitionId: "processDefinitionId-val-1234",
+ processDefinitionXml: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
+ "<bpmn:definitions xmlns:bpmn=\"http://www.omg.org/spec/BPMN/20100524/MODEL\" xmlns:bpmndi=\"http://www.omg.org/spec/BPMN/20100524/DI\" xmlns:di=\"http://www.omg.org/spec/DD/20100524/DI\" xmlns:dc=\"http://www.omg.org/spec/DD/20100524/DC\" xmlns:camunda=\"http://camunda.org/schema/1.0/bpmn\" id=\"Definitions_01lwydo\" targetNamespace=\"http://bpmn.io/schema/bpmn\" exporter=\"Camunda Modeler\" exporterVersion=\"2.2.4\">" +
+ " <bpmn:process id=\"Process_1\" isExecutable=\"true\">" +
+ " <bpmn:startEvent id=\"StartEvent_1\">" +
+ " <bpmn:outgoing>SequenceFlow_1rrp6qt</bpmn:outgoing>" +
+ " </bpmn:startEvent>" +
+ " <bpmn:callActivity id=\"CallActivity_14h26ae\" name=\"Sub Process\" calledElement=\"DecomposeService\">" +
+ " <bpmn:incoming>SequenceFlow_1rrp6qt</bpmn:incoming>" +
+ " <bpmn:outgoing>SequenceFlow_0yvdjct</bpmn:outgoing>" +
+ " </bpmn:callActivity>" +
+ " <bpmn:sequenceFlow id=\"SequenceFlow_1rrp6qt\" sourceRef=\"StartEvent_1\" targetRef=\"CallActivity_14h26ae\" />" +
+ " <bpmn:endEvent id=\"EndEvent_039q5o1\">" +
+ " <bpmn:incoming>SequenceFlow_0yvdjct</bpmn:incoming>" +
+ " </bpmn:endEvent>" +
+ " <bpmn:sequenceFlow id=\"SequenceFlow_0yvdjct\" sourceRef=\"CallActivity_14h26ae\" targetRef=\"EndEvent_039q5o1\" />" +
+ " </bpmn:process>" +
+ " <bpmndi:BPMNDiagram id=\"BPMNDiagram_1\">" +
+ " <bpmndi:BPMNPlane id=\"BPMNPlane_1\" bpmnElement=\"Process_1\">" +
+ " <bpmndi:BPMNShape id=\"_BPMNShape_StartEvent_2\" bpmnElement=\"StartEvent_1\">" +
+ " <dc:Bounds x=\"173\" y=\"102\" width=\"36\" height=\"36\" />" +
+ " </bpmndi:BPMNShape>" +
+ " <bpmndi:BPMNShape id=\"CallActivity_14h26ae_di\" bpmnElement=\"CallActivity_14h26ae\">" +
+ " <dc:Bounds x=\"267\" y=\"80\" width=\"100\" height=\"80\" />" +
+ " </bpmndi:BPMNShape>" +
+ " <bpmndi:BPMNEdge id=\"SequenceFlow_1rrp6qt_di\" bpmnElement=\"SequenceFlow_1rrp6qt\">" +
+ " <di:waypoint x=\"209\" y=\"120\" />" +
+ " <di:waypoint x=\"267\" y=\"120\" />" +
+ " </bpmndi:BPMNEdge>" +
+ " <bpmndi:BPMNShape id=\"EndEvent_039q5o1_di\" bpmnElement=\"EndEvent_039q5o1\">" +
+ " <dc:Bounds x=\"451\" y=\"102\" width=\"36\" height=\"36\" />" +
+ " </bpmndi:BPMNShape>" +
+ " <bpmndi:BPMNEdge id=\"SequenceFlow_0yvdjct_di\" bpmnElement=\"SequenceFlow_0yvdjct\">" +
+ " <di:waypoint x=\"367\" y=\"120\" />" +
+ " <di:waypoint x=\"451\" y=\"120\" />" +
+ " </bpmndi:BPMNEdge>" +
+ " </bpmndi:BPMNPlane>" +
+ " </bpmndi:BPMNDiagram>" +
+ "</bpmn:definitions>"
+};
+
+const emptyProcessDefinition: PDI = {
+ processDefinitionId: "processDefinitionId-val",
+ processDefinitionXml: ""
+};
+
+const processInstance: PII = {
+ processInstancId: "processInstanceId-val-1234",
+ processDefinitionId: "1",
+ processDefinitionName: "test",
+ superProcessInstanceId: "1"
+};
+
+const varInstanceObj: VarInstance = {
+ name: 'ABC',
+ type: 'Object',
+ value: '{value: 1234}'
+};
+
+const varInstanceStr: VarInstance = {
+ name: 'NameStr',
+ type: 'String',
+ value: 'valOfStr'
+};
+
+describe('DetailsComponent', (displayCamundaflow = {}) => {
+ // Create SPY Object for Jasmine tests to mock DataService
+ let spyDataService: jasmine.SpyObj<DataService>;
+ let component: DetailsComponent;
+ let fixture: ComponentFixture<DetailsComponent>;
+
+ beforeEach(async(() => {
+ spyDataService = jasmine.createSpyObj('DataService', ['getActivityInstance', 'getVariableInstance', 'getProcessDefinition', 'getProcessInstance']);
+
+ TestBed.configureTestingModule({
+ providers: [DetailsComponent, HttpClient, HttpTestingController,
+ { provide: APP_BASE_HREF, useValue: '/' },
+ { provide: ToastrNotificationService, useClass: StubbedToastrNotificationService },
+ { provide: DataService, useValue: spyDataService },
+ { provide: ActivatedRoute, useValue: { params: of({ id: '1234' }) } }],
+ imports: [RouterTestingModule, MatTableModule, HttpClientModule, RouterModule.forRoot([])],
+ declarations: [DetailsComponent],
+ schemas: [
+ CUSTOM_ELEMENTS_SCHEMA
+ ]
+ });
+ fixture = TestBed.createComponent(DetailsComponent);
+ component = fixture.componentInstance;
+ }));
+
+ // Ensure creation of DetailsComponent component
+ it('component should be created', inject([DetailsComponent],
+ (detailsComponent: DetailsComponent) => {
+ expect(detailsComponent).toBeTruthy();
+ }));
+
+ // Create a processInstance and ensure it is defined
+ it('processInstance should be defined if PII populated', async(() => {
+ spyDataService.getActivityInstance.and.returnValue(Promise.resolve([startActivity, subProcessActivity]));
+ spyDataService.getProcessDefinition.and.returnValue(of(processDefinition));
+ spyDataService.getProcessInstance.and.returnValue(Promise.resolve(processInstance));
+ spyDataService.getVariableInstance.and.returnValue(of([varInstanceObj]));
+ component.ngOnInit();
+
+ fixture.whenStable().then(() => {
+ expect(component.processInstance).toBeDefined();
+ });
+ }));
+
+ it('should handle bpmnViewer.importXML error', () => {
+ spyDataService.getActivityInstance.and.returnValue(Promise.resolve([startActivity, subProcessActivity]));
+ spyDataService.getProcessDefinition.and.returnValue(of(emptyProcessDefinition));
+ spyDataService.getProcessInstance.and.returnValue(Promise.resolve(processInstance));
+ spyDataService.getVariableInstance.and.returnValue(of([varInstanceObj]));
+ component.ngOnInit();
+ });
+
+ it('should handle error when dataService.getProcessInstance returns an error', () => {
+ spyDataService.getVariableInstance.and.returnValue(of([varInstanceObj]));
+ spyDataService.getProcessInstance.and.returnValue(Promise.reject(new Error('getProcessInstance Promise should not be resolved')));
+ component.ngOnInit();
+ });
+
+ it('should handle error when data.getVariableInstance returns an error', () => {
+ spyDataService.getActivityInstance.and.returnValue(Promise.resolve([startActivity, subProcessActivity]));
+ spyDataService.getProcessDefinition.and.returnValue(of(processDefinition));
+ spyDataService.getProcessInstance.and.returnValue(Promise.resolve(processInstance));
+ spyDataService.getVariableInstance.and.callFake(() => {
+ return throwError(new Error('getVariableInstance error'));
+ });
+ component.ngOnInit();
+ });
+
+ it('should handle error when data.getActivityInstance and data.getProcessDefinition return errors', () => {
+ spyDataService.getProcessInstance.and.returnValue(Promise.resolve(processInstance));
+ spyDataService.getVariableInstance.and.returnValue(of([varInstanceObj]));
+ spyDataService.getProcessDefinition.and.returnValue(of(processDefinition));
+ spyDataService.getActivityInstance.and.returnValue(Promise.reject(new Error('getActivityInstance Promise should not be resolved')));
+ spyDataService.getProcessDefinition.and.callFake(() => {
+ return throwError(new Error('getProcessDefinition error'));
+ });
+ component.ngOnInit();
+ });
+});
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.html b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.html
index 0c0e1c04c3..39fcdcb293 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.html
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.html
@@ -30,7 +30,7 @@ SPDX-License-Identifier: Apache-2.0
<!-- Dropdown Filter and TextBox for Service Instance Id -->
<div class="container-home">
<mat-form-field class="selectFilter">
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedValueSII" name="sel" placeholder="Select Filter">
+ <mat-select class="formatBox" [(value)]="searchData.selectedValueSII" placeholder="Select Filter">
<mat-option *ngFor="let option of options" [value]="option.value">{{option.name}}</mat-option>
</mat-select>
</mat-form-field>
@@ -42,7 +42,7 @@ SPDX-License-Identifier: Apache-2.0
<!-- Dropdown Filter and TextBox for Request Id -->
<div class="container-home">
<mat-form-field class="selectFilter">
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedValueRI" name="sel" placeholder="Select Filter">
+ <mat-select class="formatBox" [(value)]="searchData.selectedValueRI" placeholder="Select Filter">
<mat-option *ngFor="let option of options" [value]="option.value">{{option.name}}</mat-option>
</mat-select>
</mat-form-field>
@@ -59,14 +59,14 @@ SPDX-License-Identifier: Apache-2.0
<!-- Dropdown box for Start Hour selection -->
<mat-form-field class="selectHour">
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedStartHour" name="hourFrom" placeholder="Select Hour">
+ <mat-select class="formatBox" [(value)]="searchData.selectedStartHour" placeholder="Select Hour">
<mat-option *ngFor="let option of hourOptions" [value]="option">{{option}}</mat-option>
</mat-select>
</mat-form-field>
<!-- Dropdown box for Start Minute selection -->
<mat-form-field class="selectMinute">
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedStartMinute" name="minuteFrom" placeholder="Select Minute">
+ <mat-select class="formatBox" [(value)]="searchData.selectedStartMinute" placeholder="Select Minute">
<mat-option *ngFor="let option of minuteOptions" [value]="option">{{option}}</mat-option>
</mat-select>
</mat-form-field>
@@ -75,7 +75,7 @@ SPDX-License-Identifier: Apache-2.0
<!-- Dropdown Filter and TextBox for Service Name -->
<div class="container-home">
<mat-form-field class="selectFilter">
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedValueSN" name="sel" placeholder="Select Filter">
+ <mat-select class="formatBox" [(value)]="searchData.selectedValueSN" placeholder="Select Filter">
<mat-option *ngFor="let option of options" [value]="option.value">{{option.name}}</mat-option>
</mat-select>
</mat-form-field>
@@ -92,14 +92,14 @@ SPDX-License-Identifier: Apache-2.0
<!-- Dropdown box for End Hour selection -->
<mat-form-field class="selectHour">
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedEndHour" name="hourTo" placeholder="Select Hour">
+ <mat-select class="formatBox" [(value)]="searchData.selectedEndHour" placeholder="Select Hour">
<mat-option *ngFor="let option of hourOptions" [value]="option">{{option}}</mat-option>
</mat-select>
</mat-form-field>
<!-- Dropdown box for End Minute selection -->
<mat-form-field class="selectMinute">
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedEndMinute" name="minuteTo" placeholder="Select Minute">
+ <mat-select class="formatBox" [(value)]="searchData.selectedEndMinute" placeholder="Select Minute">
<mat-option *ngFor="let option of minuteOptions" [value]="option">{{option}}</mat-option>
</mat-select>
</mat-form-field>
@@ -108,7 +108,7 @@ SPDX-License-Identifier: Apache-2.0
<!-- Dropdown Filter for Status -->
<div class="container-home">
<mat-form-field class="selectFilter">
- <mat-select class="formatBox" [(ngModel)]="searchData.selectedValueSTATUS" name="sel" placeholder="Status">
+ <mat-select class="formatBox" [(value)]="searchData.selectedValueSTATUS" placeholder="Status">
<mat-option *ngFor="let statusOption of statusOptions" [value]="statusOption.value">{{ statusOption.name }}</mat-option>
</mat-select>
</mat-form-field>
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.spec.ts
index 1e1485eaca..cc11ebc05d 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.spec.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/home/home.component.spec.ts
@@ -1,78 +1,178 @@
-/**
-============LICENSE_START=======================================================
- Copyright (C) 2018 Ericsson. All rights reserved.
-================================================================================
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
- limitations under the License.
-
-SPDX-License-Identifier: Apache-2.0
-============LICENSE_END=========================================================
-
-@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com
-*/
-
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
-
-import { HomeComponent } from './home.component';
-import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
-import { MatTableModule } from '@angular/material';
-import { FormsModule } from '@angular/forms';
-import { MatDatepickerModule } from '@angular/material/datepicker';
-import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
-import { HttpClientModule } from '@angular/common/http';
-import { HttpClient } from '@angular/common/http';
-import { inject } from '@angular/core/testing';
-import { RouterModule } from '@angular/router';
-import { APP_BASE_HREF } from '@angular/common';
-import { ToastrNotificationService } from '../toastr-notification-service.service';
-import { environment } from '../../environments/environment.prod';
-
-class StubbedToastrNotificationService extends ToastrNotificationService {
- toastrSettings() {
- }
-}
-
-describe('HomeComponent', () => {
- let component: HomeComponent;
- let fixture: ComponentFixture<HomeComponent>;
-
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- providers: [HomeComponent, HttpClient, HttpTestingController,
- { provide: APP_BASE_HREF, useValue: '/' },
- { provide: ToastrNotificationService, useClass: StubbedToastrNotificationService }],
- imports: [MatTableModule, FormsModule, MatDatepickerModule, HttpClientModule, RouterModule.forRoot([])],
- declarations: [HomeComponent],
- schemas: [
- CUSTOM_ELEMENTS_SCHEMA
- ]
- })
- .compileComponents();
- }));
-
- // Ensure creation of HomeComponent component
- it('component should be created', inject([HttpTestingController, HomeComponent],
- (httpClient: HttpTestingController, service: HomeComponent) => {
- expect(service).toBeTruthy();
- }));
-
- // Ensure all statistic variables are initialised to zero
- it('ensure statistic variables are defaulted at zero', async(inject([HttpTestingController, HomeComponent],
- (httpClient: HttpTestingController, service: HomeComponent) => {
- expect(service.totalVal === 0 && service.completeVal === 0 &&
- service.inProgressVal === 0 && service.failedVal === 0 &&
- service.pendingVal === 0 && service.unlockedVal === 0 &&
- service.percentageComplete === 0 && service.percentageFailed === 0 &&
- service.percentageInProg === 0 && service.percentagePending === 0 &&
- service.percentageUnlocked === 0).toBeTruthy();
- })));
-});
+/**
+============LICENSE_START=======================================================
+ Copyright (C) 2018 Ericsson. All rights reserved.
+================================================================================
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+ limitations under the License.
+
+SPDX-License-Identifier: Apache-2.0
+============LICENSE_END=========================================================
+
+@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com, andrei.barcovschi@ericsson.com
+*/
+
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { HomeComponent } from './home.component';
+import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { MatTableModule, MatNativeDateModule, MatTableDataSource, MatPaginatorModule } from '@angular/material';
+import { FormsModule } from '@angular/forms';
+import { MatDatepickerModule } from '@angular/material/datepicker';
+import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
+import { HttpClientModule } from '@angular/common/http';
+import { HttpClient } from '@angular/common/http';
+import { inject } from '@angular/core/testing';
+import { RouterModule } from '@angular/router';
+import { APP_BASE_HREF } from '@angular/common';
+import { ToastrNotificationService } from '../toastr-notification-service.service';
+import { environment } from '../../environments/environment.prod';
+import { Observable, of, throwError } from 'rxjs';
+import { SearchRequest } from '../model/SearchRequest.model';
+import { DataService } from '../data.service'; // may be able to remove
+import { Process } from '../model/process.model';
+import { By } from '@angular/platform-browser';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
+import { ProcessInstanceId } from '../model/processInstanceId.model';
+import { HttpResponse } from '@angular/common/http';
+import { Router } from '@angular/router';
+import { Routes } from '@angular/router';
+import { RouterTestingModule } from '@angular/router/testing';
+import { DetailsComponent } from '../details/details.component';
+
+// Generate stub for toastr popup notifications
+class StubbedToastrNotificationService extends ToastrNotificationService {
+ toastrSettings() {}
+ info() {}
+ error() {}
+}
+
+const routes: Routes = [ { path: 'details/114e9ae4-4a32-11e9-8646-d663bd873d93' , component: DetailsComponent} ]
+
+describe('HomeComponent', () => {
+ let spyDataService: jasmine.SpyObj<DataService>;
+ let router: Router;
+ let component: HomeComponent;
+ let fixture: ComponentFixture<HomeComponent>;
+
+ beforeEach(() => {
+ spyDataService = jasmine.createSpyObj('DataService', ['retrieveInstance', 'getProcessInstanceId']);
+
+ TestBed.configureTestingModule({
+ providers: [
+ { provide: DataService, useValue: spyDataService },
+ { provide: APP_BASE_HREF, useValue: '/' },
+ { provide: ToastrNotificationService, useClass: StubbedToastrNotificationService }],
+ imports: [MatPaginatorModule, BrowserAnimationsModule, MatTableModule, FormsModule, MatDatepickerModule, MatNativeDateModule, HttpClientModule, RouterTestingModule.withRoutes(routes)],
+ declarations: [HomeComponent, DetailsComponent],
+ schemas: [
+ CUSTOM_ELEMENTS_SCHEMA
+ ]
+ });
+
+ fixture = TestBed.createComponent(HomeComponent);
+ router = TestBed.get(Router);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ // Ensure creation of HomeComponent component
+ it('component should be created', () => {
+ expect(component).toBeTruthy();
+ });
+
+ // Ensure all statistic variables are initialised to zero
+ it('should ensure statistic variables are defaulted at zero', () => {
+ expect(component.totalVal === 0 && component.completeVal === 0 &&
+ component.inProgressVal === 0 && component.failedVal === 0 &&
+ component.pendingVal === 0 && component.unlockedVal === 0 &&
+ component.percentageComplete === 0 && component.percentageFailed === 0 &&
+ component.percentageInProg === 0 && component.percentagePending === 0 &&
+ component.percentageUnlocked === 0).toBeTruthy();
+ });
+
+ it('should should navigate to a process if response status is OK', async(() => {
+ spyDataService.getProcessInstanceId.and.returnValue(of(<HttpResponse<ProcessInstanceId>>{body: {processInstanceId: '114e9ae4-4a32-11e9-8646-d663bd873d93'}, status: 200}));
+ spyOn(router, 'navigate');
+ component.getProcessIsntanceId('e8a75940-4a32-11e9-8646-d663bd873d93');
+
+ fixture.whenStable().then(() => {
+ expect(router.navigate).toHaveBeenCalledWith(['/details/114e9ae4-4a32-11e9-8646-d663bd873d93']);
+ });
+ }));
+
+ it('should handle error if no process instance id found', () => {
+ spyDataService.getProcessInstanceId.and.returnValue(of(<HttpResponse<ProcessInstanceId>>{body: {processInstanceId: 'getProcessInstanceId error not found'}, status: 404}));
+ component.getProcessIsntanceId('e8a75940-4a32-11e9-8646-d663bd873d93');
+ });
+
+ it('should handle error when searchData.getSearchRequest returns an error', () => {
+ spyOn(component.searchData, 'getSearchRequest').and.callFake(() => {
+ return throwError(new Error('getSearchRequest error'));
+ });
+ component.makeCall();
+ });
+
+ it('should handle error when dataService.retrieveInstance returns an error', () => {
+ spyOn(component.searchData, 'getSearchRequest').and.returnValue(of(getSearchRequest("965d3c92-44e0-11e9-b210-d663bd873d93", "85a7c354-44e0-11e9-b210-d663bd873d93", undefined, undefined, undefined, undefined, undefined, undefined, "ALL")));
+ spyDataService.retrieveInstance.and.callFake(() => {
+ return throwError(new Error('retrieveInstance error'));
+ });
+ component.makeCall();
+ });
+
+ it('should calculate statistics correctly', async(() => {
+ let requestStatusTypes: string[] = ["COMPLETE", "IN_PROGRESS", "FAILED", "PENDING", "UNLOCKED"];
+ let processArr: Process[] = [];
+
+ // create 5 processes, one of each requestStatusType, with default time.
+ requestStatusTypes.forEach((status) => {
+ let serviceName = "service-" + status;
+ var process = getProcess("85a7c354-44e0-11e9-b210-d663bd873d93", "965d3c92-44e0-11e9-b210-d663bd873d93", serviceName, "048a6212-44e1-11e9-b210-d663bd873d93", status, "TestType", undefined, undefined);
+ processArr.push(process);
+ })
+
+ // search request has default filter.
+ spyOn(component.searchData, 'getSearchRequest').and.returnValue(of(getSearchRequest(undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, "ALL")));
+ spyDataService.retrieveInstance.and.returnValue(of(processArr));
+ component.makeCall();
+
+ fixture.whenStable().then(() => {
+ fixture.detectChanges();
+
+ expect(
+ component.totalVal === 5 && component.completeVal === 1 &&
+ component.inProgressVal === 1 && component.failedVal === 1 &&
+ component.pendingVal === 1 && component.unlockedVal === 1 &&
+ component.percentageComplete === 20 &&
+ component.percentageFailed === 20 &&
+ component.percentageInProg === 20 &&
+ component.percentagePending === 20 &&
+ component.percentageUnlocked === 20)
+ .toBeTruthy();
+ });
+ }));
+
+ function getSearchRequest(selectedValueSII = "EQ", serviceInstanceIdVal: string, selectedValueRI = "EQ", requestIdVal: string, selectedValueSN = "EQ", serviceInstanceNameVal: string, startTimeInMilliseconds = 0, endTimeInMilliseconds = 4, selectedValueSTATUS?: string): SearchRequest {
+ if (startTimeInMilliseconds > endTimeInMilliseconds) {
+ console.error("End time cannot be greater than start time.");
+ return undefined;
+ }
+ if (typeof selectedValueSTATUS === "string")
+ return new SearchRequest({ serviceInstanceId: [selectedValueSII, serviceInstanceIdVal], requestId: [selectedValueRI, requestIdVal], serviceInstanceName: [selectedValueSN, serviceInstanceNameVal], requestStatus: ["EQ", selectedValueSTATUS] }, startTimeInMilliseconds, endTimeInMilliseconds);
+ else
+ return new SearchRequest({ serviceInstanceId: [selectedValueSII, serviceInstanceIdVal], requestId: [selectedValueRI, requestIdVal], serviceInstanceName: [selectedValueSN, serviceInstanceNameVal] }, startTimeInMilliseconds, endTimeInMilliseconds);
+ }
+
+ function getProcess(requestIdVal: string, serviceInstanceIdVal: string, serviceIstanceNameVal: string, networkIdVal: string, requestStatusVal: string, serviceTypeVal: string, startTimeVal = "1", endTimeVal = "2"): Process {
+ return <Process>{ requestId: requestIdVal, serviceInstanceId: serviceInstanceIdVal, serviceIstanceName: serviceIstanceNameVal, networkId: networkIdVal, requestStatus: requestStatusVal, serviceType: serviceTypeVal, startTime: startTimeVal, endTime: endTimeVal };
+ }
+});
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/searchData.model.spec.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/searchData.model.spec.ts
new file mode 100644
index 0000000000..5323cce1fd
--- /dev/null
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/model/searchData.model.spec.ts
@@ -0,0 +1,78 @@
+/**
+============LICENSE_START=======================================================
+ Copyright (C) 2018 Ericsson. All rights reserved.
+================================================================================
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+ limitations under the License.
+
+SPDX-License-Identifier: Apache-2.0
+============LICENSE_END=========================================================
+
+@authors: andrei.barcovschi@ericsson.com
+*/
+
+import { SearchData } from './searchData.model';
+import { SearchRequest } from './SearchRequest.model';
+import { Observable, throwError } from 'rxjs';
+
+describe('SearchData', () => {
+ let searchRequest: SearchRequest;
+ let searchData: SearchData;
+
+ beforeEach(() => {
+ searchData = new SearchData();
+ });
+
+ it('should return a SearchRequest observable with selectedValueSTATUS != ALL', () => { // NOT ALL CHANGE TEST TO TEST THIS ISNTESASD
+ searchData.serviceInstanceId = "bd827d8c-4b07-11e9-8646-d663bd873d93";
+ searchData.requestId = "cf1343d8-4b07-11e9-8646-d663bd873d93";
+ searchData.serviceInstanceName = "service-123";
+ searchData.selectedValueSTATUS = "COMPLETE";
+
+ searchData.getSearchRequest().subscribe((request: SearchRequest) => {
+ searchRequest = request;
+ });
+ let filters = searchRequest.getFilters();
+ expect(searchRequest.getFilters()).toEqual({ serviceInstanceId: [ 'EQ', 'bd827d8c-4b07-11e9-8646-d663bd873d93' ],
+ requestId: [ 'EQ', 'cf1343d8-4b07-11e9-8646-d663bd873d93' ],
+ serviceInstanceName: [ 'EQ', 'service-123' ],
+ requestStatus: [ 'EQ', 'COMPLETE' ]
+ });
+ expect(searchRequest.getStartTimeInMilliseconds()).toBe(searchData.startDate.getTime());
+ expect(searchRequest.getEndTimeInMilliseconds()).toBe(searchData.endDate.getTime());
+ });
+
+ it('should throw an error if found incorrect start or end date', () => {
+ searchData.startDate = null;
+ searchData.endDate = undefined;
+ searchData.getSearchRequest().subscribe({
+ error: (err) => {
+ expect(err).toEqual('Found end or start date empty, Please enter start and end date')
+ }
+ });
+ });
+
+ it('should throw an error if startTimeInMilliseconds > endTimeInMilliseconds', () => {
+ searchData.startDate = new Date('March 20, 2019 02:00:00');
+ searchData.endDate = new Date('March 20, 2019 01:00:00');
+ searchData.selectedStartHour = '02';
+ searchData.selectedEndHour = '01';
+ searchData.selectedStartMinute = '00';
+ searchData.selectedEndMinute = '00';
+
+ searchData.getSearchRequest().subscribe({
+ error: (err) => {
+ expect(err).toEqual("End time: " + searchData.endDate + " can not be greater then start time: " + searchData.startDate)
+ }
+ });
+ });
+});