aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java30
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java3
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java1
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java128
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java76
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/manual/Migrate_Distrobution_Status.sql11
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.6.6__Add_Column_For_Distrobution_Status.sql1
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/ServiceMapperTest.java134
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java1
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/ExpectedService.json52
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/AllTestsTestSuite.java (renamed from adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/AllTestsTestSuite.java)2
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/schema.sql2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java3
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java84
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java14
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java22
-rw-r--r--asdc-controller/src/test/resources/schema.sql1
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java175
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceLevel.java5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java228
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java46
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java116
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/InstanceResourceList/InstanceResourceList.json175
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/SERVICE-SO-REQ-INPUT.json206
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/UUI-SO-REQ.json1
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/GroupResource.java2
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfcResource.java14
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy7
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml7
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java16
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResource.java19
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatEnvironment.java160
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatFile.java115
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatTemplate.java147
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatTemplateParam.java73
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Service.java165
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/VfModule.java196
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Vnf.java218
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java3
-rw-r--r--mso-catalog-db/src/test/resources/schema.sql1
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfInstantiationNotification.java9
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterCreationNotification.java9
-rw-r--r--vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterDeletionNotification.java9
48 files changed, 2488 insertions, 211 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
index 0a0f2787da..dd43837c76 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
@@ -109,6 +109,8 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
private static final String DELETE_DEPLOYMENT = "DeleteDeployment";
private static final String TERMINATED = "terminated";
private static final String CANCELLED = "cancelled";
+ private static final String UNINSTALL = "uninstall";
+ private static final String UPLOAD_BLUEPRINT = "UPLOAD_BLUEPRINT";
// Fetch cloud configuration each time (may be cached in CloudConfig class)
@Autowired
@@ -181,11 +183,11 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
Map<String, Object> expandedInputs = new HashMap<>(inputs);
String platform = cloudSite.get().getPlatform();
- if (platform == null || platform.equals("") || platform.equalsIgnoreCase("OPENSTACK")) {
+ if (platform == null || platform.isEmpty() || ("OPENSTACK").equalsIgnoreCase(platform)) {
// Create the Cloudify OpenstackConfig with the credentials
OpenstackConfig openstackConfig = getOpenstackConfig(cloudSite.get(), tenantId);
expandedInputs.put("openstack_config", openstackConfig);
- } else if (platform.equalsIgnoreCase("AZURE")) {
+ } else if (("AZURE").equalsIgnoreCase(platform)) {
// Create Cloudify AzureConfig with the credentials
AzureConfig azureConfig = getAzureConfig(cloudSite.get(), tenantId);
expandedInputs.put("azure_config", azureConfig);
@@ -265,7 +267,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
try {
// Run the uninstall to undo the install
- Execution uninstallWorkflow = executeWorkflow(cloudify, deploymentId, "uninstall", null,
+ Execution uninstallWorkflow = executeWorkflow(cloudify, deploymentId, UNINSTALL, null,
pollForCompletion, deletePollTimeout, deletePollInterval);
if (uninstallWorkflow.getStatus().equals(TERMINATED)) {
@@ -306,7 +308,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
try {
// Run the uninstall to undo the install.
// Always try to run it, as it should be idempotent
- executeWorkflow(cloudify, deploymentId, "uninstall", null, pollForCompletion, deletePollTimeout,
+ executeWorkflow(cloudify, deploymentId, UNINSTALL, null, pollForCompletion, deletePollTimeout,
deletePollInterval);
// Delete the deployment itself
@@ -402,7 +404,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
GetExecution queryExecution = cloudify.executions().byId(executionId);
command = "query";
- while (!timedOut && !(status.equals(TERMINATED) || status.equals("failed") || status.equals(CANCELLED))) {
+ while (!timedOut && !(status.equals(TERMINATED) || ("failed").equals(status) || status.equals(CANCELLED))) {
// workflow is still running; check for timeout
if (pollTimeout <= 0) {
logger.debug("workflow {} timed out on deployment {}", execution.getWorkflowId(),
@@ -425,7 +427,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
// Success!
logger.debug("Workflow '{}' completed successfully on deployment '{}'", workflowId, deploymentId);
return execution;
- } else if (status.equals("failed")) {
+ } else if (("failed").equals(status)) {
// Workflow failed. Log it and return the execution object (don't throw exception here)
logger.error("{} Cloudify workflow failure: {} {} Execute Workflow: Failed: {}",
MessageEnum.RA_CREATE_STACK_ERR, execution.getError(),
@@ -665,7 +667,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
try {
uninstallWorkflow =
- executeWorkflow(cloudify, deploymentId, "uninstall", null, true, pollTimeout, deletePollInterval);
+ executeWorkflow(cloudify, deploymentId, UNINSTALL, null, true, pollTimeout, deletePollInterval);
if (uninstallWorkflow.getStatus().equals(TERMINATED)) {
// Successful uninstall.
@@ -812,7 +814,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
try {
// Put the root directory
- String rootDir = blueprintId + ((blueprintId.endsWith("/") ? "" : "/"));
+ String rootDir = blueprintId + (blueprintId.endsWith("/") ? "" : "/");
zipOut.putNextEntry(new ZipEntry(rootDir));
zipOut.closeEntry();
@@ -836,13 +838,13 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
Blueprint blueprint = uploadRequest.execute();
logger.debug("Successfully uploaded blueprint {}", blueprint.getId());
} catch (CloudifyResponseException | CloudifyConnectException e) {
- throw cloudifyExceptionToMsoException(e, "UPLOAD_BLUEPRINT");
+ throw cloudifyExceptionToMsoException(e, UPLOAD_BLUEPRINT);
} catch (RuntimeException e) {
// Catch-all
- throw runtimeExceptionToMsoException(e, "UPLOAD_BLUEPRINT");
+ throw runtimeExceptionToMsoException(e, UPLOAD_BLUEPRINT);
} catch (IOException e) {
// for try-with-resources
- throw ioExceptionToMsoException(e, "UPLOAD_BLUEPRINT");
+ throw ioExceptionToMsoException(e, UPLOAD_BLUEPRINT);
}
return true;
@@ -960,14 +962,14 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
String type = templateParam.getParamType();
logger.debug("Parameter: {} is of type {}", templateParam.getParamName(), type);
- if (type.equalsIgnoreCase("number")) {
+ if (("number").equalsIgnoreCase(type)) {
try {
return Integer.valueOf(inputValue.toString());
} catch (Exception e) {
logger.debug("Unable to convert {} to an integer!", inputValue);
return null;
}
- } else if (type.equalsIgnoreCase("json")) {
+ } else if (("json").equalsIgnoreCase(type)) {
try {
if (inputValue instanceof String) {
return JSON_MAPPER.readTree(inputValue.toString());
@@ -978,7 +980,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
logger.debug("Unable to convert {} to a JsonNode!", inputValue);
return null;
}
- } else if (type.equalsIgnoreCase("boolean")) {
+ } else if (("boolean").equalsIgnoreCase(type)) {
return new Boolean(inputValue.toString());
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
index c9a548d5f1..79c042b10b 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
@@ -67,9 +67,6 @@ public class MsoCommonUtils {
protected <T> T executeAndRecordOpenstackRequest(OpenStackRequest<T> request) {
- int limit;
-
- long start = System.currentTimeMillis();
String requestType;
if (request.getClass().getEnclosingClass() != null) {
requestType =
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java
index db73d4afec..0e526e59fb 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java
@@ -24,6 +24,7 @@ import javax.annotation.PostConstruct;
import javax.ws.rs.ApplicationPath;
import org.glassfish.jersey.server.ResourceConfig;
import org.onap.so.adapters.catalogdb.rest.CatalogDbAdapterRest;
+import org.onap.so.adapters.catalogdb.rest.ServiceRestImpl;
import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
import org.springframework.context.annotation.Configuration;
import io.swagger.jaxrs.config.BeanConfig;
@@ -40,6 +41,7 @@ public class JerseyConfiguration extends ResourceConfig {
register(ApiListingResource.class);
register(SwaggerSerializers.class);
register(JaxRsFilterLogging.class);
+ register(ServiceRestImpl.class);
BeanConfig beanConfig = new BeanConfig();
beanConfig.setVersion("1.0.2");
beanConfig.setSchemes(new String[] {"http"});
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
index e5241a4e95..a0d822d394 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceVnfs.java
@@ -49,6 +49,7 @@ public class QueryServiceVnfs extends CatalogQuery {
+ "\t\"nfFunction\" : <NF_FUNCTION>,\n" + "\t\"nfType\" : <NF_TYPE>,\n"
+ "\t\"nfRole\" : <NF_ROLE>,\n" + "\t\"nfNamingCode\" : <NF_NAMING_CODE>,\n"
+ "\t\"multiStageDesign\" : <MULTI_STEP_DESIGN>,\n"
+ + "\t\"vnfcInstGroupOrder\" : <VNFC_INSTANCE_GROUP_ORDER>,\n"
+ "\t\"resourceInput\" : <RESOURCE_INPUT>,\n" + "<_VFMODULES_>,\n" + "<_GROUPS_>\n" + "\t}";
public QueryServiceVnfs() {
@@ -118,6 +119,7 @@ public class QueryServiceVnfs extends CatalogQuery {
put(valueMap, "NF_TYPE", o.getNfType());
put(valueMap, "NF_ROLE", o.getNfRole());
put(valueMap, "NF_NAMING_CODE", o.getNfNamingCode());
+ put(valueMap, "VNFC_INSTANCE_GROUP_ORDER", o.getVnfcInstanceGroupOrder());
put(valueMap, "MULTI_STEP_DESIGN", o.getMultiStageDesign());
put(valueMap, "RESOURCE_INPUT", o.getResourceInput());
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
index 6cc53e6ec9..589f119337 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
@@ -279,6 +279,7 @@ public class CatalogDbAdapterRest {
@QueryParam("serviceModelUuid") String modelUUID,
@QueryParam("serviceModelInvariantUuid") String modelInvariantUUID,
@QueryParam("serviceModelVersion") String modelVersion) {
+
QueryServiceMacroHolder qryResp;
int respStatus = HttpStatus.SC_OK;
String uuid = "";
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java
new file mode 100644
index 0000000000..dd18767762
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceMapper.java
@@ -0,0 +1,128 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb.rest;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.onap.so.db.catalog.beans.HeatEnvironment;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.rest.catalog.beans.Service;
+import org.onap.so.rest.catalog.beans.VfModule;
+import org.onap.so.rest.catalog.beans.Vnf;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+
+@Component
+public class ServiceMapper {
+ private static final Logger logger = LoggerFactory.getLogger(ServiceMapper.class);
+
+ public Service mapService(org.onap.so.db.catalog.beans.Service service, int depth) {
+ Service restService = new Service();
+ restService.setCategory(service.getCategory());
+ restService.setCreated(service.getCreated());
+ restService.setDescription(service.getDescription());
+ restService.setDistrobutionStatus(service.getDistrobutionStatus());
+ restService.setEnvironmentContext(service.getEnvironmentContext());
+ restService.setModelInvariantId(service.getModelInvariantUUID());
+ restService.setModelName(service.getModelName());
+ restService.setModelVersionId(service.getModelUUID());
+ restService.setModelVersion(service.getModelVersion());
+ restService.setServiceRole(service.getServiceRole());
+ restService.setServiceType(service.getServiceType());
+ restService.setWorkloadContext(service.getWorkloadContext());
+ if (depth > 0)
+ restService.setVnf(mapVnfs(service, depth));
+ return restService;
+ }
+
+ private List<Vnf> mapVnfs(org.onap.so.db.catalog.beans.Service service, int depth) {
+ List<Vnf> vnfs = new ArrayList<>();
+ logger.info("Vnf Count : {}", service.getVnfCustomizations().size());
+ service.getVnfCustomizations().parallelStream().forEach(vnf -> vnfs.add(mapVnf(vnf, depth)));
+ return vnfs;
+ }
+
+ private Vnf mapVnf(org.onap.so.db.catalog.beans.VnfResourceCustomization vnfResourceCustomization, int depth) {
+ Vnf vnf = new Vnf();
+ vnf.setAvailabilityZoneMaxCount(vnfResourceCustomization.getAvailabilityZoneMaxCount());
+ vnf.setCategory(vnfResourceCustomization.getVnfResources().getCategory());
+ vnf.setCloudVersionMax(vnfResourceCustomization.getVnfResources().getAicVersionMax());
+ vnf.setCloudVersionMin(vnfResourceCustomization.getVnfResources().getAicVersionMin());
+ vnf.setMaxInstances(vnfResourceCustomization.getMaxInstances());
+ vnf.setMinInstances(vnfResourceCustomization.getMinInstances());
+ vnf.setModelCustomizationId(vnfResourceCustomization.getModelCustomizationUUID());
+ vnf.setModelInstanceName(vnfResourceCustomization.getModelInstanceName());
+ vnf.setModelInvariantId(vnfResourceCustomization.getVnfResources().getModelInvariantId());
+ vnf.setModelName(vnfResourceCustomization.getVnfResources().getModelName());
+ vnf.setModelVersionId(vnfResourceCustomization.getVnfResources().getModelUUID());
+ vnf.setModelVersion(vnfResourceCustomization.getVnfResources().getModelVersion());
+ vnf.setMultiStageDesign(vnfResourceCustomization.getMultiStageDesign());
+ vnf.setNfFunction(vnfResourceCustomization.getNfFunction());
+ vnf.setNfNamingCode(vnfResourceCustomization.getNfNamingCode());
+ vnf.setNfRole(vnfResourceCustomization.getNfRole());
+ vnf.setOrchestrationMode(vnfResourceCustomization.getVnfResources().getOrchestrationMode());
+ vnf.setSubCategory(vnfResourceCustomization.getVnfResources().getSubCategory());
+ vnf.setToscaNodeType(vnfResourceCustomization.getVnfResources().getToscaNodeType());
+ if (depth > 1) {
+ vnf.setVfModule(mapVfModules(vnfResourceCustomization, depth));
+ }
+ return vnf;
+ }
+
+ private List<VfModule> mapVfModules(VnfResourceCustomization vnfResourceCustomization, int depth) {
+ List<VfModule> vfModules = new ArrayList<>();
+ vnfResourceCustomization.getVfModuleCustomizations().parallelStream()
+ .forEach(vfModule -> vfModules.add(mapVfModule(vfModule)));
+ return vfModules;
+ }
+
+ private VfModule mapVfModule(VfModuleCustomization vfModuleCust) {
+ VfModule vfModule = new VfModule();
+ vfModule.setAvailabilityZoneCount(vfModuleCust.getAvailabilityZoneCount());
+ vfModule.setCreated(vfModuleCust.getCreated());
+ vfModule.setDescription(vfModuleCust.getVfModule().getDescription());
+ vfModule.setInitialCount(vfModuleCust.getInitialCount());
+ vfModule.setIsBase(vfModuleCust.getVfModule().getIsBase());
+ vfModule.setIsVolumeGroup(getIsVolumeGroup(vfModuleCust));
+ vfModule.setMaxInstances(vfModuleCust.getMaxInstances());
+ vfModule.setMinInstances(vfModuleCust.getMinInstances());
+ vfModule.setLabel(vfModuleCust.getLabel());
+ vfModule.setModelCustomizationId(vfModuleCust.getModelCustomizationUUID());
+ vfModule.setModelInvariantId(vfModuleCust.getVfModule().getModelInvariantUUID());
+ vfModule.setModelName(vfModuleCust.getVfModule().getModelName());
+ vfModule.setModelVersionId(vfModuleCust.getVfModule().getModelUUID());
+ vfModule.setModelVersion(vfModuleCust.getVfModule().getModelVersion());
+ return vfModule;
+ }
+
+ private boolean getIsVolumeGroup(VfModuleCustomization vfModuleCust) {
+ boolean isVolumeGroup = false;
+ HeatEnvironment envt = vfModuleCust.getVolumeHeatEnv();
+ if (envt != null) {
+ isVolumeGroup = true;
+ }
+ return isVolumeGroup;
+ }
+
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java
new file mode 100644
index 0000000000..1ca8998396
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb.rest;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.onap.so.db.catalog.data.repository.ServiceRepository;
+import org.onap.so.rest.catalog.beans.Service;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.google.common.base.Strings;
+import io.swagger.annotations.ApiOperation;
+
+@Path("/v1/")
+@Component
+public class ServiceRestImpl {
+
+ @Autowired
+ private ServiceRepository serviceRepo;
+
+ @Autowired
+ private ServiceMapper serviceMapper;
+
+ @GET
+ @Path("/services/{modelUUID}")
+ @Produces({MediaType.APPLICATION_JSON})
+ @Transactional(readOnly = true)
+ public Service findService(@PathParam("modelUUID") String modelUUID, @QueryParam("depth") int depth) {
+ org.onap.so.db.catalog.beans.Service service = serviceRepo.findOneByModelUUID(modelUUID);
+ return serviceMapper.mapService(service, depth);
+ }
+
+ @GET
+ @Path("/services")
+ @ApiOperation(value = "Find Service Models", response = Service.class, responseContainer = "List")
+ @Produces({MediaType.APPLICATION_JSON})
+ @Transactional(readOnly = true)
+ public List<Service> queryServices(@QueryParam("modelName") String modelName,
+ @QueryParam("distributionStatus") String distributionStatus, @QueryParam("depth") int depth) {
+ List<Service> services = new ArrayList<>();
+ List<org.onap.so.db.catalog.beans.Service> serviceFromDB = new ArrayList<>();
+ if (!Strings.isNullOrEmpty(modelName) && !Strings.isNullOrEmpty(distributionStatus)) {
+ serviceFromDB = serviceRepo.findByModelNameAndDistrobutionStatus(modelName, distributionStatus);
+ } else if (!Strings.isNullOrEmpty(modelName)) {
+ serviceFromDB = serviceRepo.findByModelName(modelName);
+ }
+ serviceFromDB.stream().forEach(serviceDB -> services.add(serviceMapper.mapService(serviceDB, depth)));
+ return services;
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/manual/Migrate_Distrobution_Status.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/manual/Migrate_Distrobution_Status.sql
new file mode 100644
index 0000000000..4a9c2cce9f
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/manual/Migrate_Distrobution_Status.sql
@@ -0,0 +1,11 @@
+
+UPDATE catalogdb.service serv SET OVERALL_DISTRIBUTION_STATUS =(
+SELECT wds.DISTRIBUTION_ID_STATUS
+FROM requestdb.watchdog_distributionid_status wds
+INNER JOIN requestdb.watchdog_service_mod_ver_id_lookup wdlook
+ON wds.DISTRIBUTION_ID = wdlook.DISTRIBUTION_ID
+WHERE wdlook.SERVICE_MODEL_VERSION_ID = serv.MODEL_UUID
+ORDER BY wdlook.MODIFY_TIME DESC LIMIT 1);
+
+UPDATE catalogdb.service SET OVERALL_DISTRIBUTION_STATUS = 'DISTRIBUTION_COMPLETE_OK'
+WHERE service.OVERALL_DISTRIBUTION_STATUS = NULL; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.6.6__Add_Column_For_Distrobution_Status.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.6.6__Add_Column_For_Distrobution_Status.sql
new file mode 100644
index 0000000000..ae416ffbfe
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V5.6.6__Add_Column_For_Distrobution_Status.sql
@@ -0,0 +1 @@
+ALTER TABLE catalogdb.service ADD COLUMN IF NOT EXISTS OVERALL_DISTRIBUTION_STATUS varchar(45); \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/ServiceMapperTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/ServiceMapperTest.java
new file mode 100644
index 0000000000..b8161de6b2
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/ServiceMapperTest.java
@@ -0,0 +1,134 @@
+package org.onap.so.adapters.catalogdb.catalogrest;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.junit.Test;
+import org.onap.so.adapters.catalogdb.rest.ServiceMapper;
+import org.onap.so.db.catalog.beans.HeatTemplate;
+import org.onap.so.db.catalog.beans.HeatTemplateParam;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.rest.catalog.beans.Service;
+import wiremock.com.fasterxml.jackson.core.JsonParseException;
+import wiremock.com.fasterxml.jackson.databind.JsonMappingException;
+import wiremock.com.fasterxml.jackson.databind.ObjectMapper;
+
+public class ServiceMapperTest {
+
+ private ServiceMapper serviceMapper = new ServiceMapper();
+
+ @Test
+ public void service_map_test() throws JsonParseException, JsonMappingException, IOException {
+ Service actual = serviceMapper.mapService(getTestService(), 2);
+ assertThat(actual, sameBeanAs(getExpectedService()));
+ }
+
+ private Service getExpectedService() throws JsonParseException, JsonMappingException, IOException {
+ ObjectMapper mapper = new ObjectMapper();
+ return mapper.readValue(getJson("ExpectedService.json"), Service.class);
+ }
+
+
+ private org.onap.so.db.catalog.beans.Service getTestService() {
+ org.onap.so.db.catalog.beans.Service testService = new org.onap.so.db.catalog.beans.Service();
+ testService.setCategory("category");
+ testService.setDescription("description");
+ testService.setDistrobutionStatus("distrobutionStatus");
+ testService.setEnvironmentContext("environmentContext");
+ testService.setModelInvariantUUID("modelInvariantUUID");
+ testService.setModelName("modelName");
+ testService.setModelUUID("modelUUID");
+ testService.setModelVersion("modelVersion");
+ testService.setServiceType("serviceType");
+ testService.setServiceRole("serviceRole");
+ testService.getVnfCustomizations().add(getTestVnfCustomization());
+ return testService;
+ }
+
+ private org.onap.so.db.catalog.beans.VnfResourceCustomization getTestVnfCustomization() {
+ org.onap.so.db.catalog.beans.VnfResourceCustomization test =
+ new org.onap.so.db.catalog.beans.VnfResourceCustomization();
+ test.setId(1);
+ test.setAvailabilityZoneMaxCount(11);
+ test.setMaxInstances(3);
+ test.setMinInstances(1);
+ test.setModelCustomizationUUID("modelCustomizationUUID");
+ test.setModelInstanceName("modelInstanceName");
+ test.setMultiStageDesign("multiStageDesign");
+ test.setNfFunction("nfFunction");
+ test.setNfNamingCode("nfNamingCode");
+ test.setNfRole("nfRole");
+ test.setNfType("nfType");
+ test.setService(new org.onap.so.db.catalog.beans.Service());
+ test.setVnfResources(getTestVnfResource());
+ test.setVfModuleCustomizations(getTestVfModuleCust());
+ return test;
+ }
+
+ private List<VfModuleCustomization> getTestVfModuleCust() {
+ List<VfModuleCustomization> test = new ArrayList<>();
+ VfModuleCustomization testVfMod = new VfModuleCustomization();
+ testVfMod.setAvailabilityZoneCount(10);
+ testVfMod.setInitialCount(1);
+ testVfMod.setLabel("label");
+ testVfMod.setMaxInstances(3);
+ testVfMod.setMinInstances(1);
+ testVfMod.setModelCustomizationUUID("modelCustomizationUUID");
+ org.onap.so.db.catalog.beans.VfModule vfModule = new org.onap.so.db.catalog.beans.VfModule();
+ vfModule.setDescription("description");
+ vfModule.setIsBase(false);
+ vfModule.setModelInvariantUUID("modelInvariantUUID");
+ vfModule.setModelName("modelName");
+ vfModule.setModelUUID("modelUUID");
+ vfModule.setModelVersion("modelVersion");
+ HeatTemplate moduleHeatTemplate = new HeatTemplate();
+ moduleHeatTemplate.setArtifactChecksum("artifactChecksum");
+ moduleHeatTemplate.setArtifactUuid("artifactUuid");
+ List<HeatTemplate> childTemplates;
+ // moduleHeatTemplate.setChildTemplates(childTemplates);
+ moduleHeatTemplate.setDescription("description");
+ Set<HeatTemplateParam> parameters = new HashSet<>();
+ HeatTemplateParam heatParam = new HeatTemplateParam();
+ heatParam.setHeatTemplateArtifactUuid("heatTemplateArtifactUuid");
+ heatParam.setParamAlias("paramAlias");
+ heatParam.setParamName("paramName");
+ heatParam.setParamType("paramType");
+ heatParam.setRequired(false);
+ parameters.add(heatParam);
+ moduleHeatTemplate.setParameters(parameters);
+ moduleHeatTemplate.setTemplateBody("templateBody");
+ moduleHeatTemplate.setTemplateName("templateName");
+ moduleHeatTemplate.setTimeoutMinutes(1000);
+ moduleHeatTemplate.setVersion("version");
+ vfModule.setModuleHeatTemplate(moduleHeatTemplate);
+ testVfMod.setVfModule(vfModule);
+ test.add(testVfMod);
+ return test;
+ }
+
+ private org.onap.so.db.catalog.beans.VnfResource getTestVnfResource() {
+ org.onap.so.db.catalog.beans.VnfResource test = new org.onap.so.db.catalog.beans.VnfResource();
+ test.setCategory("category");
+ test.setDescription("description");
+ test.setModelInvariantUUID("modelInvariantUUID");
+ test.setModelName("modelName");
+ test.setModelUUID("modelUUID");
+ test.setModelVersion("modelVersion");
+ test.setAicVersionMax("cloudVersionMax");
+ test.setAicVersionMin("cloudVersionMin");
+ test.setOrchestrationMode("orchestrationMode");
+ test.setSubCategory("subCategory");
+ test.setToscaNodeType("toscaNodeType");
+ return test;
+ }
+
+ private String getJson(String filename) throws IOException {
+ return new String(Files.readAllBytes(Paths.get("src/test/resources/" + filename)));
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
index 51b44b0d3a..4127d07c5f 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -289,7 +289,6 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
Assert.assertNotNull(vnfResource.getModelInvariantId());
Assert.assertNotNull(vnfResource.getModelVersion());
Assert.assertNotNull(vnfResource.getHeatTemplates());
- Assert.assertNotNull(vnfResource.getVnfResourceCustomizations());
Assert.assertEquals("vSAMP10a", vnfResource.getModelName());
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/ExpectedService.json b/adapters/mso-catalog-db-adapter/src/test/resources/ExpectedService.json
new file mode 100644
index 0000000000..cc5145f0e3
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/resources/ExpectedService.json
@@ -0,0 +1,52 @@
+{
+ "modelName": "modelName",
+ "description": "description",
+ "modelVersionId": "modelUUID",
+ "modelInvariantId": "modelInvariantUUID",
+ "modelVersion": "modelVersion",
+ "serviceType": "serviceType",
+ "serviceRole": "serviceRole",
+ "environmentContext": "environmentContext",
+ "category": "category",
+ "distrobutionStatus": "distrobutionStatus",
+ "vnf": [
+ {
+ "modelName": "modelName",
+ "modelVersionId": "modelUUID",
+ "modelInvariantId": "modelInvariantUUID",
+ "modelVersion": "modelVersion",
+ "modelCustomizationId": "modelCustomizationUUID",
+ "modelInstanceName": "modelInstanceName",
+ "minInstances": 1,
+ "maxInstances": 3,
+ "availabilityZoneMaxCount": 11,
+ "toscaNodeType": "toscaNodeType",
+ "nfFunction": "nfFunction",
+ "nfRole": "nfRole",
+ "nfNamingCode": "nfNamingCode",
+ "multiStageDesign": "multiStageDesign",
+ "orchestrationMode": "orchestrationMode",
+ "cloudVersionMin": "cloudVersionMin",
+ "cloudVersionMax": "cloudVersionMax",
+ "category": "category",
+ "subCategory": "subCategory",
+ "vfModule": [
+ {
+ "modelVersionId": "modelUUID",
+ "modelInvariantId": "modelInvariantUUID",
+ "modelName": "modelName",
+ "modelVersion": "modelVersion",
+ "description": "description",
+ "isBase": false,
+ "modelCustomizationId": "modelCustomizationUUID",
+ "label": "label",
+ "minInstances": 1,
+ "maxInstances": 3,
+ "initialCount": "1",
+ "availabilityZoneCount": 10,
+ "isVolumeGroup": false
+ }
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/AllTestsTestSuite.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/AllTestsTestSuite.java
index a7bddd3ada..a9365a3946 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/AllTestsTestSuite.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/AllTestsTestSuite.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.vnf;
+package org.onap.so;
import org.junit.runner.RunWith;
import com.googlecode.junittoolbox.SuiteClasses;
diff --git a/adapters/mso-openstack-adapters/src/test/resources/schema.sql b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
index c700e78868..83023e53db 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/schema.sql
+++ b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
@@ -717,7 +717,6 @@ CREATE TABLE `northbound_request_ref_lookup` (
`MAX_API_VERSION` double DEFAULT NULL,
`IS_TOPLEVELFLOW` tinyint(1) DEFAULT NULL,
`CLOUD_OWNER` varchar(200) NOT NULL,
- `service_type` varchar(50) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UK_northbound_request_ref_lookup` (`MIN_API_VERSION`,`REQUEST_SCOPE`,`ACTION`,`IS_ALACARTE`,`MACRO_ACTION`,`CLOUD_OWNER`)
) ENGINE=InnoDB AUTO_INCREMENT=86 DEFAULT CHARSET=latin1;
@@ -804,6 +803,7 @@ CREATE TABLE `service` (
`WORKLOAD_CONTEXT` varchar(200) DEFAULT NULL,
`SERVICE_CATEGORY` varchar(200) DEFAULT NULL,
`RESOURCE_ORDER` varchar(200) default NULL,
+ OVERALL_DISTRIBUTION_STATUS varchar(45),
PRIMARY KEY (`MODEL_UUID`),
KEY `fk_service__tosca_csar1_idx` (`TOSCA_CSAR_ARTIFACT_UUID`),
CONSTRAINT `fk_service__tosca_csar1` FOREIGN KEY (`TOSCA_CSAR_ARTIFACT_UUID`) REFERENCES `tosca_csar` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
index faa40a694b..ea1d194c68 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
@@ -643,6 +643,8 @@ public class ASDCController {
}
}
+ wd.updateCatalogDBStatus(iNotif.getServiceInvariantUUID(), overallStatus);
+
if (isDeploySuccess && watchdogError == null) {
sendFinalDistributionStatus(iNotif.getDistributionID(), DistributionStatusEnum.DISTRIBUTION_COMPLETE_OK,
null);
@@ -657,7 +659,6 @@ public class ASDCController {
wdsRepo.save(wds);
}
-
} catch (ObjectOptimisticLockingFailureException e) {
logger.debug(
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
index b3741584f4..179fa44547 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
@@ -35,6 +35,8 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.hibernate.StaleObjectStateException;
import org.hibernate.exception.ConstraintViolationException;
@@ -48,14 +50,7 @@ import org.onap.sdc.tosca.parser.elements.queries.EntityQuery;
import org.onap.sdc.tosca.parser.elements.queries.TopologyTemplateQuery;
import org.onap.sdc.tosca.parser.enums.SdcTypes;
import org.onap.sdc.tosca.parser.impl.SdcPropertyNames;
-import org.onap.sdc.toscaparser.api.CapabilityAssignment;
-import org.onap.sdc.toscaparser.api.CapabilityAssignments;
-import org.onap.sdc.toscaparser.api.Group;
-import org.onap.sdc.toscaparser.api.NodeTemplate;
-import org.onap.sdc.toscaparser.api.Policy;
-import org.onap.sdc.toscaparser.api.Property;
-import org.onap.sdc.toscaparser.api.RequirementAssignment;
-import org.onap.sdc.toscaparser.api.RequirementAssignments;
+import org.onap.sdc.toscaparser.api.*;
import org.onap.sdc.toscaparser.api.elements.Metadata;
import org.onap.sdc.toscaparser.api.functions.GetInput;
import org.onap.sdc.toscaparser.api.parameters.Input;
@@ -565,27 +560,35 @@ public class ToscaResourceInstaller {
logger.debug(" resourceSeq for service uuid(" + service.getModelUUID() + ") : " + resourceSeqStr);
}
- private static String getValue(Object value, List<Input> servInputs) {
- String output = null;
+
+ // this of temporary solution
+ private static String getValue(Object value, List<Input> inputs) {
+ String outInput;
+ String defaultValue = null;
if (value instanceof Map) {
- // currently this logic handles only one level of nesting.
- return ((LinkedHashMap) value).values().toArray()[0].toString();
+ outInput = ((LinkedHashMap) value).values().toArray()[0].toString();
} else if (value instanceof GetInput) {
String inputName = ((GetInput) value).getInputName();
-
- for (Input input : servInputs) {
- if (input.getName().equals(inputName)) {
- // keep both input name and default value
- // if service input does not supplies value the use default value
- String defaultValue = input.getDefault() != null ? (String) input.getDefault().toString() : "";
- output = inputName + "|" + defaultValue;// return default value
- }
+ Optional<Input> inputOptional =
+ inputs.stream().filter(input -> input.getName().equals(inputName)).findFirst();
+ if (inputOptional.isPresent()) {
+ Input input = inputOptional.get();
+ defaultValue = input.getDefault() != null ? input.getDefault().toString() : "";
}
-
+ String valueStr = value.toString();
+ String regex = "(?<=\\[).*?(?=\\])";
+ Pattern pattern = Pattern.compile(regex);
+ Matcher matcher = pattern.matcher(valueStr);
+ if (matcher.find()) {
+ valueStr = matcher.group();
+ } else {
+ valueStr = inputName;
+ }
+ outInput = valueStr + "|" + defaultValue;
} else {
- output = value != null ? value.toString() : "";
+ outInput = value != null ? value.toString() : "";
}
- return output; // return property value
+ return outInput;
}
String getResourceInput(ToscaResourceStructure toscaResourceStructure, String resourceCustomizationUuid)
@@ -1846,13 +1849,16 @@ public class ToscaResourceInstaller {
vfcInstanceGroupCustom.setFunction(toscaResourceStructure.getSdcCsarHelper()
.getNodeTemplatePropertyLeafValue(vnfcNodeTemplate, getInputName));
vfcInstanceGroupCustom.setInstanceGroup(vfcInstanceGroup);
- createVFCInstanceGroupMembers(vfcInstanceGroupCustom, group);
+
+ ArrayList<Input> inputs = vnfcNodeTemplate.getSubMappingToscaTemplate().getInputs();
+ createVFCInstanceGroupMembers(vfcInstanceGroupCustom, group, inputs);
return vfcInstanceGroupCustom;
}
- private void createVFCInstanceGroupMembers(VnfcInstanceGroupCustomization vfcInstanceGroupCustom, Group group) {
+ private void createVFCInstanceGroupMembers(VnfcInstanceGroupCustomization vfcInstanceGroupCustom, Group group,
+ List<Input> inputList) {
List<NodeTemplate> members = group.getMemberNodes();
if (!CollectionUtils.isEmpty(members)) {
for (NodeTemplate vfcTemplate : members) {
@@ -1870,13 +1876,33 @@ public class ToscaResourceInstaller {
vnfcCustomization.setToscaNodeType(testNull(vfcTemplate.getType()));
vnfcCustomization
.setDescription(testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
-
- // @After vfcInstanceGroupCustom merged
- // vfcInstanceGroupCustom.getVnfcCustomizations().add(vnfcCustomization);
+ vnfcCustomization.setResourceInput(getVnfcResourceInput(vfcTemplate, inputList));
+ vfcInstanceGroupCustom.getVnfcCustomizations().add(vnfcCustomization);
}
}
}
+ public String getVnfcResourceInput(NodeTemplate vfcTemplate, List<Input> inputList) {
+ Map<String, String> resouceRequest = new HashMap<>();
+ LinkedHashMap<String, Property> vfcTemplateProperties = vfcTemplate.getProperties();
+ for (String key : vfcTemplateProperties.keySet()) {
+ Property property = vfcTemplateProperties.get(key);
+ String resourceValue = getValue(property.getValue(), inputList);
+ resouceRequest.put(key, resourceValue);
+ }
+
+ String jsonStr = null;
+ try {
+ ObjectMapper objectMapper = new ObjectMapper();
+ jsonStr = objectMapper.writeValueAsString(resouceRequest);
+ jsonStr = jsonStr.replace("\"", "\\\"");
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ }
+
+ return jsonStr;
+ }
+
protected VfModuleCustomization createVFModuleResource(Group group, NodeTemplate vfTemplate,
ToscaResourceStructure toscaResourceStructure, VfResourceStructure vfResourceStructure,
IVfModuleData vfModuleData, VnfResourceCustomization vnfResource, Service service,
@@ -2328,7 +2354,7 @@ public class ToscaResourceInstaller {
// setting resource input for vnf customization
vnfResourceCustomization.setResourceInput(
getResourceInput(toscaResourceStructure, vnfResourceCustomization.getModelCustomizationUUID()));
- vnfResource.getVnfResourceCustomizations().add(vnfResourceCustomization);
+ service.getVnfCustomizations().add(vnfResourceCustomization);
}
return vnfResourceCustomization;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java
index 3659ceed12..0128078a59 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java
@@ -30,6 +30,7 @@ import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.entities.uri.Depth;
+import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.data.repository.ServiceRepository;
import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
import org.onap.so.db.request.beans.WatchdogDistributionStatus;
@@ -140,7 +141,6 @@ public class WatchdogDistribution {
logger.debug("Updating overall DistributionStatus to: {} for distributionId: ", status,
distributionId);
- watchdogDistributionStatus.setDistributionIdStatus(status);
watchdogDistributionStatusRepository.save(watchdogDistributionStatus);
} else {
logger.debug("Components Size Didn't match with the WatchdogComponentDistributionStatus results.");
@@ -181,6 +181,8 @@ public class WatchdogDistribution {
throw new Exception(error);
}
+
+
AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.MODEL_VER, serviceModelInvariantUUID,
serviceModelVersionId);
aaiUri.depth(Depth.ZERO); // Do not return relationships if any
@@ -198,6 +200,16 @@ public class WatchdogDistribution {
}
}
+ public void updateCatalogDBStatus(String serviceModelVersionId, String status) {
+ try {
+ Service foundService = serviceRepo.findOneByModelUUID(serviceModelVersionId);
+ foundService.setDistrobutionStatus(status);
+ serviceRepo.save(foundService);
+ } catch (Exception e) {
+ logger.error("Error updating CatalogDBStatus", e);
+ }
+ }
+
public AAIResourcesClient getAaiClient() {
if (aaiClient == null) {
aaiClient = new AAIResourcesClient();
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java
index 844adeede2..f6a369e405 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInputTest.java
@@ -33,10 +33,7 @@ import org.onap.sdc.toscaparser.api.parameters.Input;
import org.onap.so.asdc.client.exceptions.ArtifactInstallerException;
import org.onap.so.asdc.installer.ToscaResourceStructure;
import org.onap.so.db.catalog.beans.Service;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
+import java.util.*;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.when;
@@ -61,6 +58,23 @@ public class ToscaResourceInputTest {
Input input;
@Test
+ public void getListResourceInput() {
+ ToscaResourceInstaller toscaResourceInstaller = new ToscaResourceInstaller();
+ LinkedHashMap<String, Property> hashMap = new LinkedHashMap<>();
+ hashMap.put("key1", property);
+ when(nodeTemplate.getProperties()).thenReturn(hashMap);
+ when(property.getValue()).thenReturn(getInput);
+ when(getInput.getInputName()).thenReturn("nameKey");
+ when(input.getName()).thenReturn("nameKey");
+ when(input.getDefault()).thenReturn("defaultValue");
+ when(getInput.toString()).thenReturn("getinput:[sites,INDEX,role]");
+ List<Input> inputs = new ArrayList<>();
+ inputs.add(input);
+ String resourceInput = toscaResourceInstaller.getVnfcResourceInput(nodeTemplate, inputs);
+ assertEquals("{\\\"key1\\\":\\\"sites,INDEX,role|defaultValue\\\"}", resourceInput);
+ }
+
+ @Test
public void processResourceSequenceTest() {
ToscaResourceInstaller toscaResourceInstaller = new ToscaResourceInstaller();
ToscaResourceStructure toscaResourceStructure = new ToscaResourceStructure();
diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql
index bdd906d870..0e8024da0a 100644
--- a/asdc-controller/src/test/resources/schema.sql
+++ b/asdc-controller/src/test/resources/schema.sql
@@ -806,6 +806,7 @@ CREATE TABLE `service` (
`WORKLOAD_CONTEXT` varchar(200) DEFAULT NULL,
`SERVICE_CATEGORY` varchar(200) DEFAULT NULL,
`RESOURCE_ORDER` varchar(200) default NULL,
+ OVERALL_DISTRIBUTION_STATUS varchar(45),
PRIMARY KEY (`MODEL_UUID`),
KEY `fk_service__tosca_csar1_idx` (`TOSCA_CSAR_ARTIFACT_UUID`),
CONSTRAINT `fk_service__tosca_csar1` FOREIGN KEY (`TOSCA_CSAR_ARTIFACT_UUID`) REFERENCES `tosca_csar` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java
index b50ecdad8b..71ea3b565b 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/InstanceResourceList.java
@@ -19,116 +19,120 @@
*/
package org.onap.so.bpmn.common.resource;
+import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
+import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import org.onap.so.bpmn.core.domain.GroupResource;
import org.onap.so.bpmn.core.domain.Resource;
import org.onap.so.bpmn.core.domain.ResourceType;
+import org.onap.so.bpmn.core.domain.VnfResource;
+import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
public class InstanceResourceList {
- private static List<Map<String, List<GroupResource>>> convertUUIReqTOStd(final String uuiRequest,
+ private static Map<String, List<List<GroupResource>>> convertUUIReqTOStd(final JsonObject reqInputJsonObj,
List<Resource> seqResourceList) {
- List<Map<String, List<GroupResource>>> normalizedList = new ArrayList<>();
+ Map<String, List<List<GroupResource>>> normalizedRequest = new HashMap<>();
+ for (Resource r : seqResourceList) {
- Gson gson = new Gson();
- JsonObject servJsonObject = gson.fromJson(uuiRequest, JsonObject.class);
+ if (r.getResourceType() == ResourceType.VNF) {
+ String pk = getPrimaryKey(r);
- JsonObject reqInputJsonObj = servJsonObject.getAsJsonObject("service").getAsJsonObject("parameters")
- .getAsJsonObject("requestInputs");
+ JsonElement vfNode = reqInputJsonObj.get(pk);
- // iterate all node in requestInputs
- Iterator<Map.Entry<String, JsonElement>> iterator = reqInputJsonObj.entrySet().iterator();
-
- while (iterator.hasNext()) { // iterate all <vf>_list
- Map.Entry<String, JsonElement> entry = iterator.next();
-
- // truncate "_list" from key and keep only the <VF_NAME>
- String key = entry.getKey().substring(0, entry.getKey().indexOf("_list"));
-
- // all the element represent VF will contain "<VF_NAME>_list".
- if (key.contains("_list")) {
- // this will return list of vf of same type
- // e.g. vf_list [{vf1}, {vf2}]
- Iterator<JsonElement> vfsIterator = entry.getValue().getAsJsonArray().iterator();
-
- while (vfsIterator.hasNext()) { // iterate all [] inside vf_list
- JsonObject vfObject = vfsIterator.next().getAsJsonObject();
- List<GroupResource> tmpGrpsHolder = new ArrayList<>();
-
- // iterate vfObject to get groups(vfc)
- // currently each vfc represented by one group.
- Iterator<Map.Entry<String, JsonElement>> vfIterator = vfObject.entrySet().iterator();
- while (vfIterator.hasNext()) { // iterate all property inside a VF
- Map.Entry<String, JsonElement> vfEntry = vfIterator.next();
-
- // property name for vfc input will always carry "<VFC_NAME>_list"
- if (vfEntry.getKey().contains("_list")) {
- // truncate "_list" from key and keep only the <VFC_NAME>
- String vfcName = vfEntry.getKey().substring(0, vfEntry.getKey().indexOf("_list"));
- GroupResource grpRes = getGroupResource(vfcName, seqResourceList);
- // A <vfc>_list can contain more than one vfc of same type
- Iterator<JsonElement> vfcsIterator = vfEntry.getValue().getAsJsonArray().iterator();
-
- while (vfcsIterator.hasNext()) { // iterate all the vfcs inside <vfc>_list
- tmpGrpsHolder.add(grpRes);
- }
+ // if the service property is type of array then it
+ // means it is a VF resource
+ if (vfNode instanceof JsonArray) {
+
+ for (int i = 0; i < ((JsonArray) vfNode).size(); i++) {
+ List<List<GroupResource>> groupsList = normalizedRequest.get(pk);
+ if (groupsList == null) {
+ groupsList = new ArrayList<>();
+ normalizedRequest.put(pk, groupsList);
}
+
+ groupsList.add(new ArrayList<>());
}
- List<GroupResource> seqGrpResourceList = seqGrpResource(tmpGrpsHolder, seqResourceList);
- HashMap<String, List<GroupResource>> entryNormList = new HashMap<>();
- entryNormList.put(key, seqGrpResourceList);
- normalizedList.add(entryNormList);
}
- }
- }
- return normalizedList;
- }
+ } else if (r.getResourceType() == ResourceType.GROUP) {
+ String sk = getPrimaryKey(r);
- private static List<GroupResource> seqGrpResource(List<GroupResource> grpResources, List<Resource> resourceList) {
- List<GroupResource> seqGrpResList = new ArrayList<>();
- for (Resource r : resourceList) {
- if (r.getResourceType() != ResourceType.GROUP) {
- continue;
- }
- for (GroupResource g : grpResources) {
- if (r.getModelInfo().getModelName().equalsIgnoreCase(g.getModelInfo().getModelName())) {
- seqGrpResList.add(g);
+ for (String pk : normalizedRequest.keySet()) {
+ JsonArray vfs = reqInputJsonObj.getAsJsonArray(pk);
+
+ for (int i = 0; i < vfs.size(); i++) {
+
+ JsonElement vfcsNode = vfs.get(i).getAsJsonObject().get(sk);
+ if (vfcsNode instanceof JsonArray) {
+
+ List<GroupResource> groupResources = normalizedRequest.get(pk).get(i);
+
+ if (groupResources == null) {
+ groupResources = new ArrayList<>();
+ normalizedRequest.get(pk).add(i, groupResources);
+ }
+
+ for (int j = 0; j < ((JsonArray) vfcsNode).size(); j++) {
+ groupResources.add((GroupResource) r);
+ }
+ }
+ }
}
}
}
- return seqGrpResList;
+ return normalizedRequest;
}
- private static GroupResource getGroupResource(String vfcName, List<Resource> seqRessourceList) {
- for (Resource r : seqRessourceList) {
- if (r.getResourceType() == ResourceType.GROUP) {
- // Currently only once vnfc is added to group
- return ((GroupResource) r).getVnfcs().get(0).getModelInfo().getModelName().contains(vfcName)
- ? (GroupResource) r
- : null;
- }
+ // this method returns key from resource input
+ // e.g. {\"sdwansite_emails\" : \"[sdwansiteresource_list(PK), INDEX, sdwansite_emails]|default\",
+ // ....}
+ // it will return sdwansiteresource_list
+ private static String getPrimaryKey(Resource resource) {
+ String pk = "";
+
+ String resourceInput = "";
+ if (resource instanceof VnfResource) {
+ resourceInput = ((VnfResource) resource).getResourceInput();
+ } else if (resource instanceof GroupResource) {
+ resourceInput = ((GroupResource) resource).getVnfcs().get(0).getResourceInput();
}
- return null;
+
+ Gson gson = new Gson();
+ Type type = new TypeToken<Map<String, String>>() {}.getType();
+ Map<String, String> map = gson.fromJson(resourceInput, type);
+
+ Optional<String> pkOpt = map.values().stream().filter(e -> e.contains("[")).map(e -> e.replace("[", ""))
+ .map(e -> e.split(",")[0]).findFirst();
+
+ return pkOpt.isPresent() ? pkOpt.get() : "";
}
- private static List<Resource> convertToInstanceResourceList(List<Map<String, List<GroupResource>>> normalizedReq,
+ private static List<Resource> convertToInstanceResourceList(Map<String, List<List<GroupResource>>> normalizedReq,
List<Resource> seqResourceList) {
List<Resource> flatResourceList = new ArrayList<>();
for (Resource r : seqResourceList) {
if (r.getResourceType() == ResourceType.VNF) {
- for (Map<String, List<GroupResource>> entry : normalizedReq) {
- if (r.getModelInfo().getModelName().equalsIgnoreCase(entry.keySet().iterator().next())) {
- flatResourceList.add(r);
- flatResourceList.addAll(entry.get(entry.keySet().iterator().next()));
+ String primaryKey = getPrimaryKey(r);
+ for (String pk : normalizedReq.keySet()) {
+
+ if (primaryKey.equalsIgnoreCase(pk)) {
+
+ List<List<GroupResource>> vfs = normalizedReq.get(pk);
+
+ vfs.stream().forEach(e -> {
+ flatResourceList.add(r);
+ flatResourceList.addAll(e);
+ });
}
}
}
@@ -139,22 +143,13 @@ public class InstanceResourceList {
public static List<Resource> getInstanceResourceList(final List<Resource> seqResourceList,
final String uuiRequest) {
+ Gson gson = new Gson();
+ JsonObject servJsonObject = gson.fromJson(uuiRequest, JsonObject.class);
+ JsonObject reqInputJsonObj = servJsonObject.getAsJsonObject("service").getAsJsonObject("parameters")
+ .getAsJsonObject("requestInputs");
+
// this will convert UUI request to normalized form
- List<Map<String, List<GroupResource>>> normalizedReq = convertUUIReqTOStd(uuiRequest, seqResourceList);
-
- // now UUI json req is normalized to
- // [
- // { VFB1 : [GrpA1, GrA2, GrB1]},
- // { VFB2 : [GrpA1, GrB1]},
- // { VFA1 : [GrpC1]}
- // ]
- // now sequence according to VF order (Group is already sequenced).
- // After sequence it will look like :
- // [
- // { VFA1 : [GrpA1, GrA2, GrB1]},
- // { VFA2 : [GrpA1, GrB1]},
- // { VFB1 : [GrpC1]}
- // ]
- return convertToInstanceResourceList(normalizedReq, seqResourceList);
+ Map<String, List<List<GroupResource>>> normalizedRequest = convertUUIReqTOStd(reqInputJsonObj, seqResourceList);
+ return convertToInstanceResourceList(normalizedRequest, seqResourceList);
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceLevel.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceLevel.java
new file mode 100644
index 0000000000..a3c75dbd41
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceLevel.java
@@ -0,0 +1,5 @@
+package org.onap.so.bpmn.common.resource;
+
+public enum ResourceLevel {
+ FIRST, SECOND
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
index 0dbf2c2a75..58f775ce0b 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
@@ -9,9 +9,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,6 +22,9 @@
package org.onap.so.bpmn.common.resource;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParser;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.ArrayList;
@@ -31,6 +34,7 @@ import java.util.List;
import java.util.Map;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
+import org.apache.commons.lang.StringUtils;
import org.camunda.bpm.engine.runtime.Execution;
import org.onap.so.bpmn.core.UrnPropertiesReader;
import org.onap.so.bpmn.core.json.JsonUtils;
@@ -82,20 +86,20 @@ public class ResourceRequestBuilder {
* "requestInputs":{K,V} } <br>
*
* @param execution Execution context
- *
+ *
* @param serviceUuid The service template uuid
- *
+ *
* @param resourceCustomizationUuid The resource customization uuid
- *
+ *
* @param serviceParameters the service parameters passed from the API
- *
+ *
* @return the resource instantiate parameters
- *
+ *
* @since ONAP Beijing Release
*/
@SuppressWarnings("unchecked")
public static String buildResourceRequestParameters(Execution execution, String serviceUuid,
- String resourceCustomizationUuid, String serviceParameters) {
+ String resourceCustomizationUuid, String serviceParameters, Map<String, Object> currentVFData) {
List<String> resourceList =
jsonUtil.StringArrayToList(execution, (String) JsonUtils.getJsonValue(serviceParameters, "resources"));
// Get the right location str for resource. default is an empty array.
@@ -126,7 +130,7 @@ public class ResourceRequestBuilder {
}
Map<String, Object> resourceInputsFromServiceDeclaredLevel =
- buildResouceRequest(serviceUuid, resourceCustomizationUuid, serviceInput);
+ buildResouceRequest(serviceUuid, resourceCustomizationUuid, serviceInput, currentVFData);
resourceInputsFromUuiMap.putAll(resourceInputsFromServiceDeclaredLevel);
String resourceInputsStr = getJsonString(resourceInputsFromUuiMap);
String result = "{\n" + "\"locationConstraints\":" + locationConstraints + ",\n" + "\"requestInputs\":"
@@ -136,7 +140,7 @@ public class ResourceRequestBuilder {
@SuppressWarnings("unchecked")
public static Map<String, Object> buildResouceRequest(String serviceUuid, String resourceCustomizationUuid,
- Map<String, Object> serviceInputs) {
+ Map<String, Object> serviceInputs, Map<String, Object> currentVFData) {
try {
Map<String, Object> serviceInstnace = getServiceInstnace(serviceUuid);
// find match of customization uuid in vnf
@@ -144,24 +148,27 @@ public class ResourceRequestBuilder {
(Map<String, Map<String, Object>>) serviceInstnace.get("serviceResources");
List<Map<String, Object>> serviceVnfCust = (List<Map<String, Object>>) serviceResources.get("serviceVnfs");
- String resourceInputStr = getResourceInputStr(serviceVnfCust, resourceCustomizationUuid);
+ Map<String, String> resourceInputData = getResourceInputStr(serviceVnfCust, resourceCustomizationUuid);
// find match in network resource
- if (resourceInputStr == null) {
+ if (resourceInputData.size() == 0) {
List<Map<String, Object>> serviceNetworkCust =
(List<Map<String, Object>>) serviceResources.get("serviceNetworks");
- resourceInputStr = getResourceInputStr(serviceNetworkCust, resourceCustomizationUuid);
+ resourceInputData = getResourceInputStr(serviceNetworkCust, resourceCustomizationUuid);
// find match in AR resource
- if (resourceInputStr == null) {
+ if (resourceInputData == null) {
List<Map<String, Object>> serviceArCust =
(List<Map<String, Object>>) serviceResources.get("serviceAllottedResources");
- resourceInputStr = getResourceInputStr(serviceArCust, resourceCustomizationUuid);
+ resourceInputData = getResourceInputStr(serviceArCust, resourceCustomizationUuid);
}
}
+ String resourceInputStr = resourceInputData.get("resourceInput");
+ ResourceLevel resourceLevel = ResourceLevel.valueOf(resourceInputData.get("nodeType"));
+
if (resourceInputStr != null && !resourceInputStr.isEmpty()) {
- return getResourceInput(resourceInputStr, serviceInputs);
+ return getResourceInput(resourceInputStr, serviceInputs, resourceLevel, currentVFData);
}
} catch (Exception e) {
@@ -170,47 +177,220 @@ public class ResourceRequestBuilder {
return new HashMap();
}
- private static String getResourceInputStr(List<Map<String, Object>> resources, String resCustomizationUuid) {
+ private static Map<String, String> getResourceInputStr(List<Map<String, Object>> resources,
+ String resCustomizationUuid) {
+ Map<String, String> resourceInputMap = new HashMap<>(2);
for (Map<String, Object> resource : resources) {
Map<String, String> modelInfo = (Map<String, String>) resource.get("modelInfo");
if (modelInfo.get("modelCustomizationUuid").equalsIgnoreCase(resCustomizationUuid)) {
- return (String) resource.get("resourceInput");
+ resourceInputMap.put("resourceInput", (String) resource.get("resourceInput"));
+ String nodeType = ResourceLevel.FIRST.toString();
+ if (((String) resource.get("toscaNodeType")).contains(".vf.")) {
+ nodeType = ResourceLevel.FIRST.toString();
+ } else if (((String) resource.get("toscaNodeType")).contains(".vfc.")) {
+ nodeType = ResourceLevel.SECOND.toString();
+ }
+ resourceInputMap.put("nodeType", nodeType);
+ return resourceInputMap;
}
}
return null;
}
// this method combines resource input with service input
- private static Map<String, Object> getResourceInput(String resourceInputStr, Map<String, Object> serviceInputs) {
+ private static Map<String, Object> getResourceInput(String resourceInputStr, Map<String, Object> serviceInputs,
+ ResourceLevel resourceLevel, Map<String, Object> currentVFData) {
Gson gson = new Gson();
Type type = new TypeToken<Map<String, String>>() {}.getType();
Map<String, Object> resourceInput = gson.fromJson(resourceInputStr, type);
+ JsonParser parser = new JsonParser();
+
+ Map<String, Object> uuiServiceInput = serviceInputs;
+
+ int firstLevelIndex = 0;
+ int secondLevelIndex = 0;
+ String firstLevelKey = null;
+ String secondLevelKey = null;
+ boolean levelKeyNameUpdated = false;
+ int indexToPick = 0;
+
+ if (null != currentVFData) {
+ firstLevelIndex = getIntValue(currentVFData.get("currentFirstLevelIndex"), 0);
+ secondLevelIndex = getIntValue(currentVFData.get("currentSecondLevelIndex"), 0);
+ final String lastFirstLevelKey = firstLevelKey = (String) currentVFData.get("currentFirstLevelKey");
+ final String lastSecondLevelKey = secondLevelKey = (String) currentVFData.get("currentSecondLevelKey");
+
+ if (null != currentVFData.get("lastNodeTypeProcessed")) {
+ ResourceLevel lastResourceLevel =
+ ResourceLevel.valueOf(currentVFData.get("lastNodeTypeProcessed").toString());
+ switch (resourceLevel) {
+ case FIRST:
+ // if it is next request for same group then increment first level index
+ switch (lastResourceLevel) {
+ case FIRST:
+ boolean isSameLevelRequest = resourceInput.values().stream().anyMatch(item -> {
+ JsonElement tree = parser.parse(((String) item).split("\\|")[0]);
+ return tree.isJsonArray() && tree.getAsJsonArray().get(0).getAsString()
+ .equalsIgnoreCase(lastFirstLevelKey);
+ });
+ if (isSameLevelRequest) {
+ firstLevelIndex++;
+ }
+ break;
+ case SECOND:
+ firstLevelIndex = 0;
+ secondLevelKey = null;
+ break;
+
+ }
+ indexToPick = firstLevelIndex;
+ break;
+ case SECOND:
+ // if it is next request for same group then increment second level index
+ switch (lastResourceLevel) {
+ case FIRST:
+ secondLevelIndex = 0;
+ break;
+ case SECOND:
+ boolean isSameLevelRequest = resourceInput.values().stream().anyMatch(item -> {
+ JsonElement tree = parser.parse(((String) item).split("\\|")[0]);
+ return tree.isJsonArray() && tree.getAsJsonArray().get(0).getAsString()
+ .equalsIgnoreCase(lastSecondLevelKey);
+ });
+ if (isSameLevelRequest) {
+ secondLevelIndex++;
+ }
+ break;
+ }
+ // get actual parent object to search for second level objects
+ if (null != lastFirstLevelKey) {
+ Object currentObject = serviceInputs.get(lastFirstLevelKey);
+ if ((null != currentObject) && (currentObject instanceof List)) {
+ List currentFirstLevelList = (List) currentObject;
+ if (currentFirstLevelList.size() > firstLevelIndex) {
+ uuiServiceInput = (Map<String, Object>) currentFirstLevelList.get(firstLevelIndex);
+ }
+
+ }
+ }
+ indexToPick = secondLevelIndex;
+ break;
+
+ }
+ }
+
+
+ }
// replace value if key is available in service input
for (String key : resourceInput.keySet()) {
String value = (String) resourceInput.get(key);
if (value.contains("|")) {
+
+ // check which level
+
// node it type of getinput
String[] split = value.split("\\|");
String tmpKey = split[0];
- if (serviceInputs.containsKey(tmpKey)) {
- value = (String) serviceInputs.get(tmpKey);
+
+ JsonElement jsonTree = parser.parse(tmpKey);
+
+ // check if it is a list type
+ if (jsonTree.isJsonArray()) {
+ JsonArray jsonArray = jsonTree.getAsJsonArray();
+ boolean matchFound = false;
+ if (jsonArray.size() == 3) {
+ String keyName = jsonArray.get(0).getAsString();
+ String keyType = jsonArray.get(2).getAsString();
+ if (!levelKeyNameUpdated) {
+ switch (resourceLevel) {
+ case FIRST:
+ firstLevelKey = keyName;
+ break;
+ case SECOND:
+ secondLevelKey = keyName;
+ break;
+ }
+ levelKeyNameUpdated = true;
+ }
+
+ if (uuiServiceInput.containsKey(keyName)) {
+ Object vfcLevelObject = uuiServiceInput.get(keyName);
+ // it will be always list
+ if (vfcLevelObject instanceof List) {
+ List vfcObject = (List) vfcLevelObject;
+ if (vfcObject.size() > indexToPick) {
+ Map<String, Object> vfMap = (Map<String, Object>) vfcObject.get(indexToPick);
+ if (vfMap.containsKey(keyType)) {
+ if (vfMap.get(keyType) instanceof String) {
+ value = (String) vfMap.get(keyType);
+ } else {
+ value = getJsonString(vfMap.get(keyType));
+ }
+ matchFound = true;
+ }
+ }
+ }
+ }
+ }
+
+ if (!matchFound) {
+ if (split.length == 1) { // means value is empty e.g. "a":"key1|"
+ value = "";
+ } else {
+ value = split[1];
+ }
+ }
+
} else {
- if (split.length == 1) { // means value is empty e.g. "a":"key1|"
- value = "";
+
+ // if not a list type
+ if (uuiServiceInput.containsKey(tmpKey)) {
+ value = (String) uuiServiceInput.get(tmpKey);
} else {
- value = split[1];
+ if (split.length == 1) { // means value is empty e.g. "a":"key1|"
+ value = "";
+ } else {
+ value = split[1];
+ }
}
}
+
}
resourceInput.put(key, value);
}
+ // store current processed details into map
+ if (null != currentVFData) {
+ currentVFData.put("currentFirstLevelKey", firstLevelKey);
+ currentVFData.put("currentFirstLevelIndex", firstLevelIndex);
+ currentVFData.put("currentSecondLevelKey", secondLevelKey);
+ currentVFData.put("currentSecondLevelIndex", secondLevelIndex);
+ currentVFData.put("lastNodeTypeProcessed", resourceLevel.toString());
+ }
+
return resourceInput;
}
+ private static int getIntValue(Object inputObj, int defaultValue) {
+ if (null != inputObj) {
+ if (inputObj instanceof Integer) {
+ return ((Integer) inputObj).intValue();
+ }
+ if (StringUtils.isNotEmpty(inputObj.toString())) {
+ try {
+ int val = Integer.parseInt(inputObj.toString());
+ return val;
+ } catch (NumberFormatException e) {
+ logger.warn("Unable to parse to int", e.getMessage());
+ }
+ }
+ }
+ return defaultValue;
+ }
+
public static Map<String, Object> getServiceInstnace(String uuid) throws Exception {
String catalogEndPoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint");
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java
new file mode 100644
index 0000000000..3be67c965c
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/InstnaceResourceListTest.java
@@ -0,0 +1,46 @@
+package org.onap.so.bpmn.common.resource;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.so.bpmn.core.domain.GroupResource;
+import org.onap.so.bpmn.core.domain.Resource;
+import org.onap.so.bpmn.core.domain.ResourceType;
+import org.onap.so.bpmn.core.domain.VnfResource;
+import org.onap.so.bpmn.core.domain.VnfcResource;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class InstnaceResourceListTest {
+
+ public static String RESOURCE_PATH = "src/test/resources/__files/InstanceResourceList/";
+
+ @Test
+ public void testInstanceResourceList() throws IOException {
+ String uuiRequest = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "InstanceResourceList" + ".json")));
+ List<Resource> instanceResourceList =
+ InstanceResourceList.getInstanceResourceList(createResourceSequence(), uuiRequest);
+ Assert.assertEquals(4, instanceResourceList.size());
+ Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(0).getResourceType());
+ Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(1).getResourceType());
+ Assert.assertEquals(ResourceType.VNF, instanceResourceList.get(2).getResourceType());
+ Assert.assertEquals(ResourceType.GROUP, instanceResourceList.get(3).getResourceType());
+ }
+
+ private List<Resource> createResourceSequence() {
+ List<Resource> resourceList = new ArrayList<>();
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setResourceInput("{\"a\":\"[sdwansiteresource_list,INDEX,sdwansiteresource_list]\"}");
+
+ VnfcResource vnfcResource = new VnfcResource();
+ vnfcResource.setResourceInput("{\"a\":\"[sdwansitewan_list,INDEX,test]\"}");
+
+ GroupResource groupResource = new GroupResource();
+ groupResource.setVnfcs(Arrays.asList(vnfcResource));
+
+ return Arrays.asList(vnfResource, groupResource);
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java
index c7c181744f..adfee796f2 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java
@@ -19,19 +19,53 @@
*/
package org.onap.so.bpmn.common.resource;
+import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
import org.onap.so.BaseTest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.so.bpmn.mock.FileUtil;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.ok;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static org.junit.Assert.assertEquals;
-
+import static org.junit.Assert.assertTrue;
public class ResourceRequestBuilderTest extends BaseTest {
+ private Map<String, Object> userInputMap = null;
+
+ private String serviceInput = null;
+
+ @Before
+ public void initializeMockObjects() {
+
+ if (null == this.userInputMap) {
+ ObjectMapper mapper = new ObjectMapper();
+
+ try {
+ String serviceInputRequest = FileUtil.readResourceFile("__files/UUI-SO-REQ.json");
+ this.userInputMap = mapper.readValue(serviceInputRequest, new TypeReference<Map<String, Object>>() {});
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ if (null == this.serviceInput) {
+
+ try {
+ this.serviceInput = FileUtil.readResourceFile("__files/SERVICE-SO-REQ-INPUT.json");
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ }
+
@Test
public void getResourceInputTest() throws Exception {
@@ -102,7 +136,7 @@ public class ResourceRequestBuilderTest extends BaseTest {
HashMap serviceInput = new HashMap();
serviceInput.put("key", "value");
Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(
- "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput);
+ "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput, null);
assertEquals(stringObjectMap.get("a"), "value");
}
@@ -173,7 +207,7 @@ public class ResourceRequestBuilderTest extends BaseTest {
HashMap serviceInput = new HashMap();
serviceInput.put("key1", "value");
Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(
- "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput);
+ "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput, null);
assertEquals(stringObjectMap.get("a"), "default_value");
}
@@ -244,7 +278,7 @@ public class ResourceRequestBuilderTest extends BaseTest {
HashMap serviceInput = new HashMap();
serviceInput.put("key1", "value");
Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(
- "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput);
+ "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput, null);
assertEquals(stringObjectMap.get("a"), "value");
}
@@ -337,7 +371,7 @@ public class ResourceRequestBuilderTest extends BaseTest {
HashMap serviceInput = new HashMap();
serviceInput.put("key1", "value");
Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(
- "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput);
+ "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput, null);
assertEquals(0, stringObjectMap.size());
}
@@ -382,8 +416,78 @@ public class ResourceRequestBuilderTest extends BaseTest {
HashMap serviceInput = new HashMap();
serviceInput.put("key2", "value");
Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(
- "c3954379-4efe-431c-8258-f84905b158e5", "a00404d5-d7eb-4c46-b6b6-9cf2d087e545", serviceInput);
+ "c3954379-4efe-431c-8258-f84905b158e5", "a00404d5-d7eb-4c46-b6b6-9cf2d087e545", serviceInput, null);
assertEquals(stringObjectMap.get("a"), "");
}
+ @Test
+ public void getListResourceInputTest() throws Exception {
+
+
+
+ wireMockServer.stubFor(get(urlEqualTo(
+ "/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5"))
+ .willReturn(ok(this.serviceInput)));
+
+ // when(UrnPropertiesReader.getVariable(anyString())).thenReturn("http://localhost:8080");
+
+ // VF level request
+ Map<String, Object> currentVFData = new HashMap<>();
+ Map<String, Object> stringObjectMap =
+ ResourceRequestBuilder.buildResouceRequest("c3954379-4efe-431c-8258-f84905b158e5",
+ "a00404d5-d7eb-4c46-b6b6-9cf2d087e545", this.userInputMap, currentVFData);
+ assertEquals("b", stringObjectMap.get("a"));
+ assertEquals("hub_spoke", stringObjectMap.get("topology"));
+ assertEquals("defaultvpn", stringObjectMap.get("name"));
+ assertTrue(((String) stringObjectMap.get("sitelist")).contains("["));
+
+ // vfc level request
+ stringObjectMap = ResourceRequestBuilder.buildResouceRequest("c3954379-4efe-431c-8258-f84905b158e5",
+ "e776449e-2b10-45c5-9217-2775c88ca1a0", this.userInputMap, currentVFData);
+ assertEquals("", stringObjectMap.get("a"));
+ assertEquals("layer3-port", stringObjectMap.get("portswitch"));
+ assertEquals("192.168.10.1", stringObjectMap.get("ipAddress"));
+ assertEquals("vCPE", stringObjectMap.get("deviceName"));
+
+ // vfc level request
+ stringObjectMap = ResourceRequestBuilder.buildResouceRequest("c3954379-4efe-431c-8258-f84905b158e5",
+ "e776449e-2b10-45c5-9217-2775c88ca1a1", this.userInputMap, currentVFData);
+ assertEquals("", stringObjectMap.get("a"));
+ assertEquals("layer2-port", stringObjectMap.get("portswitch"));
+ assertEquals("192.168.11.1", stringObjectMap.get("ipAddress"));
+ assertEquals("CPE_Beijing", stringObjectMap.get("deviceName"));
+
+ // VF level request
+ stringObjectMap = ResourceRequestBuilder.buildResouceRequest("c3954379-4efe-431c-8258-f84905b158e5",
+ "e776449e-2b10-45c5-9217-2775c88ca1c1", this.userInputMap, currentVFData);
+ assertEquals("Huawei Private Cloud", stringObjectMap.get("address"));
+ assertEquals("dsvpn_hub1", stringObjectMap.get("role"));
+ assertTrue(((String) stringObjectMap.get("wanlist")).contains("["));
+ assertTrue(((String) stringObjectMap.get("devlist")).contains("["));
+
+ // VFC request
+ stringObjectMap = ResourceRequestBuilder.buildResouceRequest("c3954379-4efe-431c-8258-f84905b158e5",
+ "e776449e-2b10-45c5-9217-2775c88cb1a1", this.userInputMap, currentVFData);
+ assertEquals("Huawei Private Cloud", stringObjectMap.get("address"));
+ assertEquals("20000", stringObjectMap.get("postcode"));
+ assertEquals("single_gateway", stringObjectMap.get("type"));
+ assertEquals("vCPE", stringObjectMap.get("deviceName"));
+ assertEquals("20.20.20.1", stringObjectMap.get("systemip"));
+ assertEquals("default_ipv6", stringObjectMap.get("systemipv6"));
+
+
+ // VFC request again
+ /*
+ * stringObjectMap = ResourceRequestBuilder.buildResouceRequest( "c3954379-4efe-431c-8258-f84905b158e5",
+ * "e776449e-2b10-45c5-9217-2775c88cb1f1", this.userInputMap, currentVFData);
+ * assertEquals("Huawei Public Cloud", stringObjectMap.get("address")); assertEquals("20001",
+ * stringObjectMap.get("postcode")); assertEquals("multiple_gateway", stringObjectMap.get("type"));
+ * assertEquals("CPE_Beijing", stringObjectMap.get("deviceName")); assertEquals("20.20.20.2",
+ * stringObjectMap.get("systemip"));
+ */
+
+
+ }
+
+
}
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/InstanceResourceList/InstanceResourceList.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/InstanceResourceList/InstanceResourceList.json
new file mode 100644
index 0000000000..0b3d9f0bbe
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/InstanceResourceList/InstanceResourceList.json
@@ -0,0 +1,175 @@
+{
+ "service":{
+ "name":"SiteService",
+ "description":"SiteService",
+ "serviceInvariantUuid":"5c13f3fb-2744-4635-9f1f-c59c92dc8f70",
+ "serviceUuid":"3a76b1f5-fb0d-4b6b-82d5-0e8a4ebc3838",
+ "globalSubscriberId":"test_custormer",
+ "serviceType":"example-service-type",
+ "parameters":{
+ "locationConstraints":[
+
+ ],
+ "resources":[
+ {
+ "resourceIndex":"1",
+ "resourceName":"sdwanvpnresource",
+ "resourceInvariantUuid":"0c0e1cbe-6e01-4f9e-8c45-a9700ebc14df",
+ "resourceUuid":"4ad2d390-5c51-45f5-9710-b467a4ec7a73",
+ "resourceCustomizationUuid":"66590e07-0777-415c-af44-36347cf3ddd3",
+ "parameters":{
+ "locationConstraints":[
+
+ ],
+ "resources":[
+
+ ],
+ "requestInputs":{
+
+ }
+ }
+ },
+ {
+ "resourceIndex":"1",
+ "resourceName":"sdwansiteresource",
+ "resourceInvariantUuid":"97a3e552-08c4-4697-aeeb-d8d3e09ce58e",
+ "resourceUuid":"63d8e1af-32dc-4c71-891d-e3f7b6a976d2",
+ "resourceCustomizationUuid":"205456e7-3dc0-40c4-8cb0-28e6c1877042",
+ "parameters":{
+ "locationConstraints":[
+
+ ],
+ "resources":[
+
+ ],
+ "requestInputs":{
+
+ }
+ }
+ },
+ {
+ "resourceIndex":"2",
+ "resourceName":"sdwansiteresource",
+ "resourceInvariantUuid":"97a3e552-08c4-4697-aeeb-d8d3e09ce58e",
+ "resourceUuid":"63d8e1af-32dc-4c71-891d-e3f7b6a976d2",
+ "resourceCustomizationUuid":"205456e7-3dc0-40c4-8cb0-28e6c1877042",
+ "parameters":{
+ "locationConstraints":[
+
+ ],
+ "resources":[
+
+ ],
+ "requestInputs":{
+
+ }
+ }
+ }
+ ],
+ "requestInputs":{
+ "sdwanvpnresource_list":[
+ {
+ "sdwanvpn_topology":"hub_spoke",
+ "sdwanvpn_name":"defaultvpn",
+ "sdwansitelan_list":[
+ {
+ "role":"Hub",
+ "portType":"GE",
+ "portSwitch":"layer3-port",
+ "vlanId":"",
+ "ipAddress":"192.168.10.1",
+ "deviceName":"vCPE",
+ "portNumer":"0/0/1"
+ },
+ {
+ "role":"Hub",
+ "portType":"GE",
+ "portSwitch":"layer2-port",
+ "vlanId":"55",
+ "ipAddress":"192.168.11.1",
+ "deviceName":"CPE_Beijing",
+ "portNumer":"0/0/1"
+ }
+ ]
+ }
+ ],
+ "sdwansiteresource_list":[
+ {
+ "sdwansite_emails":"chenchuanyu@huawei.com",
+ "sdwansite_address":"Huawei Public Cloud",
+ "sdwansite_description":"DC Site",
+ "sdwansite_role":"dsvpn_hub",
+ "sdwansite_postcode":"20000",
+ "sdwansite_type":"single_gateway",
+ "sdwansite_latitude":"",
+ "sdwansite_controlPoint":"",
+ "sdwansite_longitude":"",
+ "sdwansitewan_list":[
+ {
+ "providerIpAddress":"",
+ "portType":"GE",
+ "inputBandwidth":"1000",
+ "ipAddress":"",
+ "name":"10000",
+ "transportNetworkName":"internet",
+ "outputBandwidth":"10000",
+ "deviceName":"vCPE",
+ "portNumber":"0/0/0",
+ "ipMode":"DHCP",
+ "publicIP":"119.3.7.113"
+ }
+ ],
+ "sdwandevice_list":[
+ {
+ "esn":"XXXXXXX",
+ "vendor":"Huawei",
+ "name":"vCPE",
+ "type":"AR1000V",
+ "version":"1.0",
+ "class":"VNF",
+ "systemIp":"20.20.20.1"
+ }
+ ]
+ },
+ {
+ "sdwansite_emails":"chenchuanyu@huawei.com",
+ "sdwansite_address":"Huawei Public Cloud",
+ "sdwansite_description":"DC Site",
+ "sdwansite_role":"dsvpn_hub",
+ "sdwansite_postcode":"20000",
+ "sdwansite_type":"single_gateway",
+ "sdwansite_latitude":"",
+ "sdwansite_controlPoint":"",
+ "sdwansite_longitude":"",
+ "sdwansitewan_list":[
+ {
+ "providerIpAddress":"",
+ "portType":"GE",
+ "inputBandwidth":"1000",
+ "ipAddress":"172.18.1.2/24",
+ "name":"10000",
+ "transportNetworkName":"internet",
+ "outputBandwidth":"10000",
+ "deviceName":"CPE_Beijing",
+ "portNumber":"0/0/0",
+ "ipMode":"Static",
+ "publicIP":""
+ }
+ ],
+ "sdwandevice_list":[
+ {
+ "esn":"XXXXXXX",
+ "vendor":"Huawei",
+ "name":"CPE_Beijing",
+ "type":"AR161",
+ "version":"1.0",
+ "class":"PNF",
+ "systemIp":"20.20.20.2"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/SERVICE-SO-REQ-INPUT.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/SERVICE-SO-REQ-INPUT.json
new file mode 100644
index 0000000000..938b45e5a4
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/SERVICE-SO-REQ-INPUT.json
@@ -0,0 +1,206 @@
+{
+ "serviceResources": {
+ "modelInfo": {
+ "modelName": "demoVFWCL",
+ "modelUuid": "c3954379-4efe-431c-8258-f84905b158e5",
+ "modelInvariantUuid": "0cbff61e-3b0a-4eed-97ce-b1b4faa03493",
+ "modelVersion": "1.0"
+ },
+ "serviceType": "",
+ "serviceRole": "",
+ "environmentContext": null,
+ "resourceOrder": "res1,res2",
+ "workloadContext": "Production",
+ "serviceVnfs": [
+
+ {
+ "modelInfo": {
+ "modelName": "15968a6e-2fe5-41bf-a481",
+ "modelUuid": "808abda3-2023-4105-92d2-e62644b61d53",
+ "modelInvariantUuid": "6e4ffc7c-497e-4a77-970d-af966e642d31",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "a00404d5-d7eb-4c46-b6b6-9cf2d087e545",
+ "modelInstanceName": "15968a6e-2fe5-41bf-a481 0"
+ },
+ "toscaNodeType": "org.openecomp.resource.vf.15968a6e2fe541bfA481",
+ "nfFunction": null,
+ "resourceInput": "{\"a\":\"b\",\"topology\":\"[sdwanvpnresource_list,INDEX,sdwanvpn_topology]|default_topo\",\"name\":\"[sdwanvpnresource_list,INDEX,sdwanvpn_name]|default_name\",\"sitelist\":\"[sdwanvpnresource_list,INDEX,sdwansitelan_list]|default_sitelist\"}",
+ "nfType": null,
+ "nfRole": null,
+ "nfNamingCode": null,
+ "multiStageDesign": "false",
+ "vfModules": [{
+ "modelInfo": {
+ "modelName": "15968a6e2fe541bfA481..base_vfw..module-0",
+ "modelUuid": "ec7fadde-1e5a-42f7-8255-cb19e475ff45",
+ "modelInvariantUuid": "61ab8b64-a014-4cf3-8a5a-b5ef388f8819",
+ "modelVersion": "1",
+ "modelCustomizationUuid": "123aff6b-854f-4026-ae1e-cc74a3924576"
+ },
+ "isBase": true,
+ "vfModuleLabel": "base_vfw",
+ "initialCount": 1,
+ "hasVolumeGroup": true
+ }]
+ },
+
+ {
+ "modelInfo": {
+ "modelName": "f971106a-248f-4202-9d1f",
+ "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add7e",
+ "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe89f3",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88ca1a0",
+ "modelInstanceName": "f971106a-248f-4202-9d1f 0"
+ },
+ "toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d1f",
+ "nfFunction": null,
+ "nfType": null,
+ "nfRole": null,
+ "resourceInput": "{\"a\":\"b|\",\"portswitch\":\"[sdwansitelan_list,INDEX,portSwitch]|default_portswitch\",\"ipAddress\":\"[sdwansitelan_list,INDEX,ipAddress]|default_ipAddress\",\"deviceName\":\"[sdwansitelan_list,INDEX,deviceName]|default_deviceName\"}",
+ "nfNamingCode": null,
+ "multiStageDesign": "false",
+ "vfModules": [{
+ "modelInfo": {
+ "modelName": "F971106a248f42029d1f..base_vpkg..module-0",
+ "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35",
+ "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15",
+ "modelVersion": "1",
+ "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc"
+ },
+ "isBase": true,
+ "vfModuleLabel": "base_vpkg",
+ "initialCount": 1,
+ "hasVolumeGroup": true
+ }]
+ },
+
+ {
+ "modelInfo": {
+ "modelName": "f971106a-248f-4202-9d1e",
+ "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add7d",
+ "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe89f2",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88ca1a1",
+ "modelInstanceName": "f971106a-248f-4202-9d1e 0"
+ },
+ "toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d1f",
+ "nfFunction": null,
+ "nfType": null,
+ "nfRole": null,
+ "resourceInput": "{\"a\":\"b|\",\"portswitch\":\"[sdwansitelan_list,INDEX,portSwitch]|default_portswitch\",\"ipAddress\":\"[sdwansitelan_list,INDEX,ipAddress]|default_ipAddress\",\"deviceName\":\"[sdwansitelan_list,INDEX,deviceName]|default_deviceName\"}",
+ "nfNamingCode": null,
+ "multiStageDesign": "false",
+ "vfModules": [{
+ "modelInfo": {
+ "modelName": "F971106a248f42029d1f..base_vpkg..module-0",
+ "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35",
+ "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15",
+ "modelVersion": "1",
+ "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc"
+ },
+ "isBase": true,
+ "vfModuleLabel": "base_vpkg",
+ "initialCount": 1,
+ "hasVolumeGroup": true
+ }]
+ },
+
+ {
+ "modelInfo": {
+ "modelName": "f971106a-248f-4202-9d2e",
+ "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add8d",
+ "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe89c2",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88ca1c1",
+ "modelInstanceName": "f971106a-248f-4202-9d2e 0"
+ },
+ "toscaNodeType": "org.openecomp.resource.vf.F971106a248f42029d1f",
+ "nfFunction": null,
+ "nfType": null,
+ "nfRole": null,
+ "resourceInput": "{\"address\":\"[sdwansiteresource_list,INDEX,sdwansite_address]|default_address\",\"role\":\"[sdwansiteresource_list,INDEX,sdwansite_role]|default_role\",\"wanlist\":\"[sdwansiteresource_list,INDEX,sdwansitewan_list]|default_wanlist\",\"devlist\":\"[sdwansiteresource_list,INDEX,sdwandevice_list]|default_devlist\"}",
+ "nfNamingCode": null,
+ "multiStageDesign": "false",
+ "vfModules": [{
+ "modelInfo": {
+ "modelName": "F971106a248f42029d1f..base_vpkg..module-0",
+ "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35",
+ "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15",
+ "modelVersion": "1",
+ "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc"
+ },
+ "isBase": true,
+ "vfModuleLabel": "base_vpkg",
+ "initialCount": 1,
+ "hasVolumeGroup": true
+ }]
+ },
+
+ {
+ "modelInfo": {
+ "modelName": "f971106a-248f-4202-9d3e",
+ "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add9d",
+ "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe89f3",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88cb1a1",
+ "modelInstanceName": "f971106a-248f-4202-9d3e 0"
+ },
+ "toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d1f",
+ "nfFunction": null,
+ "nfType": null,
+ "nfRole": null,
+ "resourceInput": "{\"address\":\"sdwansite_address|default_address\", \"postcode\":\"sdwansite_postcode|default_postcode\",\"type\":\"sdwansite_type|default_role\",\"deviceName\":\"[sdwansitewan_list,INDEX,deviceName]|default_deviceName\",\"systemip\":\"[sdwandevice_list,INDEX,systemIp]|default_systemip\", \"systemipv6\":\"[sdwandevice_list,INDEX,systemIpv6]|default_ipv6\"}",
+ "nfNamingCode": null,
+ "multiStageDesign": "false",
+ "vfModules": [{
+ "modelInfo": {
+ "modelName": "F971106a248f42029d1f..base_vpkg..module-0",
+ "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35",
+ "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15",
+ "modelVersion": "1",
+ "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc"
+ },
+ "isBase": true,
+ "vfModuleLabel": "base_vpkg",
+ "initialCount": 1,
+ "hasVolumeGroup": true
+ }]
+ },
+
+ {
+ "modelInfo": {
+ "modelName": "f971106a-248f-4202-9d5e",
+ "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add3d",
+ "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe8393",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88cb1f1",
+ "modelInstanceName": "f971106a-248f-4202-9d5e 0"
+ },
+ "toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d3f",
+ "nfFunction": null,
+ "nfType": null,
+ "nfRole": null,
+ "resourceInput": "{\"address\":\"sdwansite_address|default_address\", \"postcode\":\"sdwansite_postcode|default_postcode\",\"type\":\"sdwansite_type|default_role\",\"deviceName\":\"[sdwansitewan_list,INDEX,deviceName]|default_deviceName\",\"systemip\":\"[sdwandevice_list,INDEX,systemIp]|default_systemip\"}",
+ "nfNamingCode": null,
+ "multiStageDesign": "false",
+ "vfModules": [{
+ "modelInfo": {
+ "modelName": "F971106a248f42029d1f..base_vpkg..module-0",
+ "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35",
+ "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15",
+ "modelVersion": "1",
+ "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc"
+ },
+ "isBase": true,
+ "vfModuleLabel": "base_vpkg",
+ "initialCount": 1,
+ "hasVolumeGroup": true
+ }]
+ }
+
+ ],
+ "serviceNetworks": [],
+ "serviceAllottedResources": []
+ }
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UUI-SO-REQ.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/UUI-SO-REQ.json
new file mode 100644
index 0000000000..e6161862ae
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UUI-SO-REQ.json
@@ -0,0 +1 @@
+{ "sdwanvpnresource_list":[ { "sdwanvpn_topology":"hub_spoke", "sdwanvpn_name":"defaultvpn", "sdwansitelan_list":[ { "role":"Hub", "portType":"GE", "portSwitch":"layer3-port", "vlanId":"", "ipAddress":"192.168.10.1", "deviceName":"vCPE", "portNumer":"0/0/1" }, { "role":"Hub", "portType":"GE", "portSwitch":"layer2-port", "vlanId":"55", "ipAddress":"192.168.11.1", "deviceName":"CPE_Beijing", "portNumer":"0/0/1" } ] } ], "sdwansiteresource_list":[ { "sdwansite_emails":"chenchuanyu@huawei.com", "sdwansite_address":"Huawei Private Cloud", "sdwansite_description":"DC Site", "sdwansite_role":"dsvpn_hub1", "sdwansite_postcode":"20000", "sdwansite_type":"single_gateway", "sdwansite_latitude":"", "sdwansite_controlPoint":"", "sdwansite_longitude":"", "sdwansitewan_list":[ { "providerIpAddress":"", "portType":"GE", "inputBandwidth":"1000", "ipAddress":"", "name":"10000", "transportNetworkName":"internet", "outputBandwidth":"10000", "deviceName":"vCPE", "portNumber":"0/0/0", "ipMode":"DHCP", "publicIP":"119.3.7.113" } ], "sdwandevice_list":[ { "esn":"XXXXXXX", "vendor":"Huawei", "name":"vCPE", "type":"AR1000V", "version":"1.0", "class":"VNF", "systemIp":"20.20.20.1" } ] }, { "sdwansite_emails":"chenchuanyu@huawei.com", "sdwansite_address":"Huawei Public Cloud", "sdwansite_description":"DC Site", "sdwansite_role":"dsvpn_hub", "sdwansite_postcode":"20001", "sdwansite_type":"multiple_gateway", "sdwansite_latitude":"", "sdwansite_controlPoint":"", "sdwansite_longitude":"", "sdwansitewan_list":[ { "providerIpAddress":"", "portType":"GE", "inputBandwidth":"1000", "ipAddress":"172.18.1.2/24", "name":"10000", "transportNetworkName":"internet", "outputBandwidth":"10000", "deviceName":"CPE_Beijing", "portNumber":"0/0/0", "ipMode":"Static", "publicIP":"" } ], "sdwandevice_list":[ { "esn":"XXXXXXX", "vendor":"Huawei", "name":"CPE_Beijing", "type":"AR161", "version":"1.0", "class":"PNF", "systemIp":"20.20.20.2" } ] } ] } \ No newline at end of file
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/GroupResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/GroupResource.java
index d194f2750a..79714d0f0e 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/GroupResource.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/GroupResource.java
@@ -19,10 +19,12 @@
*/
package org.onap.so.bpmn.core.domain;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.UUID;
+@JsonIgnoreProperties(ignoreUnknown = true)
public class GroupResource extends Resource {
private static final long serialVersionUID = 1L;
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfcResource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfcResource.java
index 5fced9a8ab..c363fcc7ff 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfcResource.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/VnfcResource.java
@@ -19,13 +19,27 @@
*/
package org.onap.so.bpmn.core.domain;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.UUID;
+@JsonIgnoreProperties(ignoreUnknown = true)
public class VnfcResource extends Resource {
private static final long serialVersionUID = 1L;
+ @JsonProperty("resource-input")
+ private String resourceInput;
+
public VnfcResource() {
resourceType = ResourceType.VNFC;
setResourceId(UUID.randomUUID().toString());
}
+
+ public String getResourceInput() {
+ return resourceInput;
+ }
+
+ public void setResourceInput(String resourceInput) {
+ this.resourceInput = resourceInput;
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy
index 7ad929b1c2..c99c702af0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy
@@ -184,7 +184,7 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce
rmodel.setResourceCustomizationUuid(resourceCustomizationUuid)
addedResourceList.add(rmodel)
- Map<String, Object> resourceParameters = ResourceRequestBuilder.buildResouceRequest(serviceModelUuid, resourceCustomizationUuid, null)
+ Map<String, Object> resourceParameters = ResourceRequestBuilder.buildResouceRequest(serviceModelUuid, resourceCustomizationUuid, null, null)
requestInputs.addAll(resourceParameters.keySet())
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
index 973d8a156c..0240beab9a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
@@ -260,11 +260,16 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
//set the requestInputs from tempalte To Be Done
String serviceModelUuid = jsonUtil.getJsonValue(incomingRequest,"service.serviceUuid")
String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters")
- String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, serviceModelUuid, resourceCustomizationUuid, serviceParameters)
+ Map<String, Object> currentVFData = (Map) execution.getVariable("currentVFData");
+ if (null == currentVFData) {
+ currentVFData = new HashMap<>();
+ }
+ String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, serviceModelUuid, resourceCustomizationUuid, serviceParameters, currentVFData)
resourceInput.setResourceParameters(resourceParameters)
resourceInput.setRequestsInputs(incomingRequest)
execution.setVariable("resourceInput", resourceInput.toString())
execution.setVariable("resourceModelUUID", resourceInput.getResourceModelInfo().getModelUuid())
+ execution.setVariable("currentVFData",currentVFData);
logger.trace("COMPLETED prepareResourceRecipeRequest Process ")
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
index cce476f4d8..9f8a456002 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
@@ -140,7 +140,9 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
registerClientResponse(idList.get(0), EntityUtils.toString(response.getEntity(), "UTF-8"));
}
- idList.forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound);
+ if (idList != null) {
+ idList.forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound);
+ }
} catch (IOException e) {
logger.error("Exception caught during sending rest request to dmaap for listening event topic", e);
} finally {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml b/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml
index 712fbf54ca..2e1c6a9bdc 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/application-test.yaml
@@ -83,6 +83,8 @@ mso:
spring:
+ jersey:
+ type: filter
datasource:
jdbcUrl: jdbc:mariadb://localhost:3307/catalogdb
username: root
@@ -97,11 +99,10 @@ spring:
naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
enable-lazy-load-no-trans: true
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
- jersey:
- type: filter
+
security:
usercredentials:
- -
+ -
username: test
password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu'
role: InfraPortal-Client
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java
index ffcc8e9717..3b57ae0f72 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java
@@ -25,11 +25,9 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
@@ -93,6 +91,9 @@ public class Service implements Serializable {
@Column(name = "RESOURCE_ORDER")
private String resourceOrder;
+ @Column(name = "OVERALL_DISTRIBUTION_STATUS")
+ private String distrobutionStatus;
+
@OneToMany(cascade = CascadeType.ALL)
@JoinTable(name = "network_resource_customization_to_service",
joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"),
@@ -135,6 +136,7 @@ public class Service implements Serializable {
@JoinColumn(name = "TOSCA_CSAR_ARTIFACT_UUID")
private ToscaCsar csar;
+
@Override
public String toString() {
return new ToStringBuilder(this).append("modelName", modelName).append("description", description)
@@ -367,4 +369,14 @@ public class Service implements Serializable {
public void setResourceOrder(String resourceOrder) {
this.resourceOrder = resourceOrder;
}
+
+
+ public String getDistrobutionStatus() {
+ return distrobutionStatus;
+ }
+
+ public void setDistrobutionStatus(String distrobutionStatus) {
+ this.distrobutionStatus = distrobutionStatus;
+ }
+
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResource.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResource.java
index 5d9deb6c89..fb54449d5f 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResource.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResource.java
@@ -38,9 +38,9 @@ import javax.persistence.TemporalType;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
-import com.openpojo.business.annotation.BusinessKey;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
+import com.openpojo.business.annotation.BusinessKey;
import uk.co.blackpepper.bowman.annotation.LinkedResource;
@Entity
@@ -93,9 +93,6 @@ public class VnfResource implements Serializable {
@JoinColumn(name = "HEAT_TEMPLATE_ARTIFACT_UUID")
private HeatTemplate heatTemplates;
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "vnfResources")
- private List<VnfResourceCustomization> vnfResourceCustomizations;
-
@OneToMany(fetch = FetchType.LAZY, mappedBy = "vnfResource")
private List<VnfResourceWorkflow> vnfResourceWorkflow;
@@ -111,8 +108,7 @@ public class VnfResource implements Serializable {
.append("toscaNodeType", toscaNodeType).append("description", description)
.append("orchestrationMode", orchestrationMode).append("aicVersionMin", aicVersionMin)
.append("aicVersionMax", aicVersionMax).append("created", created)
- .append("heatTemplates", heatTemplates).append("vnfResourceCustomizations", vnfResourceCustomizations)
- .append("vnfResourceWorkflow", vnfResourceWorkflow).toString();
+ .append("heatTemplates", heatTemplates).append("vnfResourceWorkflow", vnfResourceWorkflow).toString();
}
@Override
@@ -230,17 +226,6 @@ public class VnfResource implements Serializable {
}
@LinkedResource
- public List<VnfResourceCustomization> getVnfResourceCustomizations() {
- if (vnfResourceCustomizations == null)
- vnfResourceCustomizations = new ArrayList<>();
- return vnfResourceCustomizations;
- }
-
- public void setVnfResourceCustomizations(List<VnfResourceCustomization> vnfResourceCustomizations) {
- this.vnfResourceCustomizations = vnfResourceCustomizations;
- }
-
- @LinkedResource
public HeatTemplate getHeatTemplates() {
return heatTemplates;
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java
index c107192060..b456beaeff 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java
@@ -30,6 +30,8 @@ import java.util.List;
public interface ServiceRepository extends JpaRepository<Service, String> {
List<Service> findByModelName(String modelName);
+ List<Service> findByModelNameAndDistrobutionStatus(String modelName, String distrobutionStatus);
+
Service findOneByModelName(String modelName);
/**
diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatEnvironment.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatEnvironment.java
new file mode 100644
index 0000000000..97f67a5438
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatEnvironment.java
@@ -0,0 +1,160 @@
+/*-
+ * ============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.rest.catalog.beans;
+
+import java.io.Serializable;
+import java.text.DateFormat;
+import java.util.Date;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.PrePersist;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import com.openpojo.business.annotation.BusinessKey;
+
+@Entity
+@Table(name = "heat_environment")
+public class HeatEnvironment implements Serializable {
+
+ private static final long serialVersionUID = 768026109321305392L;
+
+ @BusinessKey
+ @Id
+ @Column(name = "ARTIFACT_UUID")
+ private String artifactUuid;
+
+ @Column(name = "NAME")
+ private String name = null;
+
+ @Column(name = "DESCRIPTION")
+ private String description = null;
+
+ @Lob
+ @Column(name = "BODY", columnDefinition = "LONGTEXT")
+ private String environment = null;
+
+ @Column(name = "ARTIFACT_CHECKSUM")
+ private String artifactChecksum;
+
+ @Column(name = "CREATION_TIMESTAMP", updatable = false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date created;
+
+ @BusinessKey
+ @Column(name = "VERSION")
+ private String version;
+
+ @PrePersist
+ protected void onCreate() {
+ this.created = new Date();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof HeatEnvironment)) {
+ return false;
+ }
+ HeatEnvironment castOther = (HeatEnvironment) other;
+ return new EqualsBuilder().append(artifactUuid, castOther.artifactUuid).append(version, castOther.version)
+ .isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(artifactUuid).append(version).toHashCode();
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getArtifactUuid() {
+ return this.artifactUuid;
+ }
+
+ public void setArtifactUuid(String artifactUuid) {
+ this.artifactUuid = artifactUuid;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getEnvironment() {
+ return this.environment;
+ }
+
+ public void setEnvironment(String environment) {
+ this.environment = environment;
+ }
+
+ public String getArtifactChecksum() {
+ return artifactChecksum;
+ }
+
+ public void setArtifactChecksum(String artifactChecksum) {
+ this.artifactChecksum = artifactChecksum;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Artifact UUID=" + this.artifactUuid);
+ sb.append(", name=");
+ sb.append(name);
+ sb.append(", version=");
+ sb.append(version);
+ sb.append(", description=");
+ sb.append(this.description == null ? "null" : this.description);
+ sb.append(", body=");
+ sb.append(this.environment == null ? "null" : this.environment);
+ if (this.created != null) {
+ sb.append(",creationTimestamp=");
+ sb.append(DateFormat.getInstance().format(this.created));
+ }
+ return sb.toString();
+ }
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatFile.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatFile.java
new file mode 100644
index 0000000000..94f61d30e3
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatFile.java
@@ -0,0 +1,115 @@
+/*-
+ * ============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.rest.catalog.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+
+public class HeatFile implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3280125018687060890L;
+
+ private String artifactUuid;
+
+ private String description = null;
+
+ private String fileName;
+
+ private String fileBody;
+
+ private Date created;
+
+ private String artifactChecksum;
+
+ private String version;
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("artifactUuid", artifactUuid).append("description", description)
+ .append("fileName", fileName).append("fileBody", fileBody).append("created", created)
+ .append("artifactChecksum", artifactChecksum).toString();
+ }
+
+ public String getArtifactUuid() {
+ return this.artifactUuid;
+ }
+
+ public void setArtifactUuid(String artifactUuid) {
+ this.artifactUuid = artifactUuid;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getFileName() {
+ return this.fileName;
+ }
+
+ public void setFileName(String fileName) {
+ this.fileName = fileName;
+ }
+
+ public String getFileBody() {
+ return this.fileBody;
+ }
+
+ public void setFileBody(String fileBody) {
+ this.fileBody = fileBody;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public String getAsdcUuid() {
+ return this.artifactUuid;
+ }
+
+ public void setAsdcUuid(String artifactUuid) {
+ this.artifactUuid = artifactUuid;
+ }
+
+ public String getArtifactChecksum() {
+ return artifactChecksum;
+ }
+
+ public void setArtifactChecksum(String artifactChecksum) {
+ this.artifactChecksum = artifactChecksum;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatTemplate.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatTemplate.java
new file mode 100644
index 0000000000..cb346e4167
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatTemplate.java
@@ -0,0 +1,147 @@
+/*-
+ * ============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.rest.catalog.beans;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+
+public class HeatTemplate implements Serializable {
+
+
+ private String artifactUuid;
+
+ private String templateName;
+
+ private String templateBody = null;
+
+ private Integer timeoutMinutes;
+
+ private String version;
+
+ private String description;
+
+ private String artifactChecksum;
+
+ private Date created;
+
+ private Set<HeatTemplateParam> parameters;
+
+ private List<HeatTemplate> childTemplates;
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("artifactUuid", artifactUuid).append("templateName", templateName)
+ .append("templateBody", templateBody).append("timeoutMinutes", timeoutMinutes)
+ .append("version", version).append("description", description)
+ .append("artifactChecksum", artifactChecksum).append("created", created)
+ .append("parameters", parameters).append("childTemplates", childTemplates).toString();
+ }
+
+ public List<HeatTemplate> getChildTemplates() {
+ if (childTemplates == null)
+ childTemplates = new ArrayList<>();
+ return childTemplates;
+ }
+
+ public void setChildTemplates(List<HeatTemplate> childTemplates) {
+ this.childTemplates = childTemplates;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getArtifactUuid() {
+ return this.artifactUuid;
+ }
+
+ public void setArtifactUuid(String artifactUuid) {
+ this.artifactUuid = artifactUuid;
+ }
+
+ public String getTemplateName() {
+ return templateName;
+ }
+
+ public void setTemplateName(String templateName) {
+ this.templateName = templateName;
+ }
+
+ public String getTemplateBody() {
+ return templateBody;
+ }
+
+ public void setTemplateBody(String templateBody) {
+ this.templateBody = templateBody;
+ }
+
+ public Integer getTimeoutMinutes() {
+ return timeoutMinutes;
+ }
+
+ public void setTimeoutMinutes(Integer timeout) {
+ this.timeoutMinutes = timeout;
+ }
+
+ public Set<HeatTemplateParam> getParameters() {
+ if (parameters == null)
+ parameters = new HashSet<>();
+ return parameters;
+ }
+
+ public void setParameters(Set<HeatTemplateParam> parameters) {
+ this.parameters = parameters;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getHeatTemplate() {
+ return this.templateBody;
+ }
+
+ public String getArtifactChecksum() {
+ return artifactChecksum;
+ }
+
+ public void setArtifactChecksum(String artifactChecksum) {
+ this.artifactChecksum = artifactChecksum;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatTemplateParam.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatTemplateParam.java
new file mode 100644
index 0000000000..a79ec962f8
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatTemplateParam.java
@@ -0,0 +1,73 @@
+/*-
+ * ============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.rest.catalog.beans;
+
+import java.io.Serializable;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+
+public class HeatTemplateParam implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -8251042980747916191L;
+
+ private String paramName;
+
+ private Boolean required;
+
+ private String paramType;
+
+ private String paramAlias;
+
+ public String getParamName() {
+ return paramName;
+ }
+
+ public void setParamName(String paramName) {
+ this.paramName = paramName;
+ }
+
+ public Boolean isRequired() {
+ return required;
+ }
+
+ public void setRequired(Boolean required) {
+ this.required = required;
+ }
+
+ public String getParamAlias() {
+ return paramAlias;
+ }
+
+ public void setParamAlias(String paramAlias) {
+ this.paramAlias = paramAlias;
+ }
+
+ public String getParamType() {
+ return paramType;
+ }
+
+ public void setParamType(String paramType) {
+ this.paramType = paramType;
+ }
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Service.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Service.java
new file mode 100644
index 0000000000..1620058e1e
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Service.java
@@ -0,0 +1,165 @@
+/*-
+ * ============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.rest.catalog.beans;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonInclude(Include.NON_DEFAULT)
+public class Service implements Serializable {
+
+ private static final long serialVersionUID = 768026109321305392L;
+
+ private String modelName;
+
+ private String description;
+
+ private String modelVersionId;
+
+ private String modelInvariantId;
+
+ private Date created;
+
+ private String modelVersion;
+
+ private String serviceType;
+
+ private String serviceRole;
+
+ private String environmentContext;
+
+ private String workloadContext;
+
+ private String category;
+
+ private String distrobutionStatus;
+
+ private List<Vnf> vnf = new ArrayList<>();
+
+ public List<Vnf> getVnf() {
+ return vnf;
+ }
+
+ public void setVnf(List<Vnf> vnf) {
+ this.vnf = vnf;
+ }
+
+ public String getModelName() {
+ return modelName;
+ }
+
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
+ public String getModelVersion() {
+ return modelVersion;
+ }
+
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ public String getServiceRole() {
+ return serviceRole;
+ }
+
+ public void setServiceRole(String serviceRole) {
+ this.serviceRole = serviceRole;
+ }
+
+ public String getEnvironmentContext() {
+ return environmentContext;
+ }
+
+ public void setEnvironmentContext(String environmentContext) {
+ this.environmentContext = environmentContext;
+ }
+
+ public String getWorkloadContext() {
+ return workloadContext;
+ }
+
+ public void setWorkloadContext(String workloadContext) {
+ this.workloadContext = workloadContext;
+ }
+
+ public String getCategory() {
+ return category;
+ }
+
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ public String getDistrobutionStatus() {
+ return distrobutionStatus;
+ }
+
+ public void setDistrobutionStatus(String distrobutionStatus) {
+ this.distrobutionStatus = distrobutionStatus;
+ }
+
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/VfModule.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/VfModule.java
new file mode 100644
index 0000000000..8e18f94faf
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/VfModule.java
@@ -0,0 +1,196 @@
+/*-
+ * ============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.rest.catalog.beans;
+
+import java.util.Date;
+import java.util.List;
+import org.onap.so.db.catalog.beans.HeatEnvironment;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonInclude(Include.NON_DEFAULT)
+public class VfModule {
+
+ // VfModule
+ private String modelVersionId;
+ private String modelInvariantId;
+ private String modelName;
+ private String modelVersion;
+ private String description;
+ private Boolean isBase;
+ private HeatTemplate heatTemplate;
+ private Date created;
+ private List<HeatFile> heatFile;
+
+ // Customization
+ private String modelCustomizationId;
+ private String label;
+ private Integer minInstances;
+ private Integer maxInstances;
+ private Integer initialCount;
+ private Integer availabilityZoneCount;
+ private HeatEnvironment heatEnv;
+ private Boolean isVolumeGroup;
+
+
+ // Add in cvnfcCustomization
+
+
+
+ public String getModelName() {
+ return modelName;
+ }
+
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ public String getModelCustomizationId() {
+ return modelCustomizationId;
+ }
+
+ public void setModelCustomizationId(String modelCustomizationId) {
+ this.modelCustomizationId = modelCustomizationId;
+ }
+
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ public String getModelVersion() {
+ return modelVersion;
+ }
+
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Boolean getIsBase() {
+ return isBase;
+ }
+
+ public void setIsBase(Boolean isBase) {
+ this.isBase = isBase;
+ }
+
+ public HeatTemplate getHeatTemplate() {
+ return heatTemplate;
+ }
+
+ public void setHeatTemplate(HeatTemplate heatTemplate) {
+ this.heatTemplate = heatTemplate;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
+ public List<HeatFile> getHeatFile() {
+ return heatFile;
+ }
+
+ public void setHeatFile(List<HeatFile> heatFile) {
+ this.heatFile = heatFile;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public Integer getMinInstances() {
+ return minInstances;
+ }
+
+ public void setMinInstances(Integer minInstances) {
+ this.minInstances = minInstances;
+ }
+
+ public Integer getMaxInstances() {
+ return maxInstances;
+ }
+
+ public void setMaxInstances(Integer maxInstances) {
+ this.maxInstances = maxInstances;
+ }
+
+ public Integer getInitialCount() {
+ return initialCount;
+ }
+
+ public void setInitialCount(Integer integer) {
+ this.initialCount = integer;
+ }
+
+ public Integer getAvailabilityZoneCount() {
+ return availabilityZoneCount;
+ }
+
+ public void setAvailabilityZoneCount(Integer availabilityZoneCount) {
+ this.availabilityZoneCount = availabilityZoneCount;
+ }
+
+ public HeatEnvironment getHeatEnv() {
+ return heatEnv;
+ }
+
+ public void setHeatEnv(HeatEnvironment heatEnv) {
+ this.heatEnv = heatEnv;
+ }
+
+ public Boolean getIsVolumeGroup() {
+ return isVolumeGroup;
+ }
+
+ public void setIsVolumeGroup(Boolean isVolumeGroup) {
+ this.isVolumeGroup = isVolumeGroup;
+ }
+
+
+
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Vnf.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Vnf.java
new file mode 100644
index 0000000000..40d701c3c5
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Vnf.java
@@ -0,0 +1,218 @@
+/*-
+ * ============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.rest.catalog.beans;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+
+@JsonInclude(Include.NON_DEFAULT)
+public class Vnf implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2956199674955504834L;
+
+ private String modelName;
+ private String modelVersionId;
+ private String modelInvariantId;
+ private String modelVersion;
+ private String modelCustomizationId;
+ private String modelInstanceName;
+ private Integer minInstances;
+ private Integer maxInstances;
+ private Integer availabilityZoneMaxCount;
+ private String toscaNodeType;
+ private String nfFunction;
+ private String nfRole;
+ private String nfNamingCode;
+ private String multiStageDesign;
+ private String orchestrationMode;
+ private String cloudVersionMin;
+ private String cloudVersionMax;
+ private String category;
+ private String subCategory;
+ private List<VfModule> vfModule = new ArrayList<>();
+
+ public List<VfModule> getVfModule() {
+ return vfModule;
+ }
+
+ public void setVfModule(List<VfModule> vfModule) {
+ this.vfModule = vfModule;
+ }
+
+ public Integer getAvailabilityZoneMaxCount() {
+ return availabilityZoneMaxCount;
+ }
+
+ public void setAvailabilityZoneMaxCount(Integer availabilityZoneMaxCount) {
+ this.availabilityZoneMaxCount = availabilityZoneMaxCount;
+ }
+
+ public Integer getMinInstances() {
+ return minInstances;
+ }
+
+ public void setMinInstances(Integer minInstances) {
+ this.minInstances = minInstances;
+ }
+
+ public Integer getMaxInstances() {
+ return maxInstances;
+ }
+
+ public void setMaxInstances(Integer maxInstances) {
+ this.maxInstances = maxInstances;
+ }
+
+ public String getCloudVersionMin() {
+ return cloudVersionMin;
+ }
+
+ public void setCloudVersionMin(String cloudVersionMin) {
+ this.cloudVersionMin = cloudVersionMin;
+ }
+
+ public String getCloudVersionMax() {
+ return cloudVersionMax;
+ }
+
+ public void setCloudVersionMax(String cloudVersionMax) {
+ this.cloudVersionMax = cloudVersionMax;
+ }
+
+ public String getModelVersionId() {
+ return modelVersionId;
+ }
+
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+
+ public String getModelInvariantId() {
+ return modelInvariantId;
+ }
+
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
+ }
+
+ public String getModelCustomizationId() {
+ return modelCustomizationId;
+ }
+
+ public void setModelCustomizationId(String modelCustomizationId) {
+ this.modelCustomizationId = modelCustomizationId;
+ }
+
+ public String getCategory() {
+ return category;
+ }
+
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ public String getSubCategory() {
+ return subCategory;
+ }
+
+ public void setSubCategory(String subCategory) {
+ this.subCategory = subCategory;
+ }
+
+ public String getOrchestrationMode() {
+ return orchestrationMode;
+ }
+
+ public void setOrchestrationMode(String orchestrationMode) {
+ this.orchestrationMode = orchestrationMode;
+ }
+
+ public String getModelName() {
+ return modelName;
+ }
+
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ public String getModelVersion() {
+ return modelVersion;
+ }
+
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+
+
+ public String getModelInstanceName() {
+ return modelInstanceName;
+ }
+
+ public void setModelInstanceName(String modelInstanceName) {
+ this.modelInstanceName = modelInstanceName;
+ }
+
+ public String getToscaNodeType() {
+ return toscaNodeType;
+ }
+
+ public void setToscaNodeType(String toscaNodeType) {
+ this.toscaNodeType = toscaNodeType;
+ }
+
+ public String getNfFunction() {
+ return nfFunction;
+ }
+
+ public void setNfFunction(String nfFunction) {
+ this.nfFunction = nfFunction;
+ }
+
+ public String getNfRole() {
+ return nfRole;
+ }
+
+ public void setNfRole(String nfRole) {
+ this.nfRole = nfRole;
+ }
+
+ public String getNfNamingCode() {
+ return nfNamingCode;
+ }
+
+ public void setNfNamingCode(String nfNamingCode) {
+ this.nfNamingCode = nfNamingCode;
+ }
+
+ public String getMultiStageDesign() {
+ return multiStageDesign;
+ }
+
+ public void setMultiStageDesign(String multiStepDesign) {
+ this.multiStageDesign = multiStepDesign;
+ }
+}
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java
index 371a9c13e0..e8addc4aa8 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java
@@ -74,7 +74,6 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest {
List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList<>();
vnfResourceCustomizations.add(vnfResourceCustomization);
- vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations);
vnfResourceCustomization.setVnfResources(vnfResource);
@@ -123,7 +122,6 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest {
List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList<>();
vnfResourceCustomizations.add(vnfResourceCustomization);
- vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations);
vnfResourceCustomization.setVnfResources(vnfResource);
@@ -177,7 +175,6 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest {
List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList();
vnfResourceCustomizations.add(vnfResourceCustomization);
- vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations);
vnfResourceCustomization.setVnfResources(vnfResource);
diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql
index 34340f1357..0856a4cbe2 100644
--- a/mso-catalog-db/src/test/resources/schema.sql
+++ b/mso-catalog-db/src/test/resources/schema.sql
@@ -803,6 +803,7 @@ CREATE TABLE `service` (
`WORKLOAD_CONTEXT` varchar(200) DEFAULT NULL,
`SERVICE_CATEGORY` varchar(200) DEFAULT NULL,
`RESOURCE_ORDER` varchar(200) default NULL,
+ OVERALL_DISTRIBUTION_STATUS varchar(45),
PRIMARY KEY (`MODEL_UUID`),
KEY `fk_service__tosca_csar1_idx` (`TOSCA_CSAR_ARTIFACT_UUID`),
CONSTRAINT `fk_service__tosca_csar1` FOREIGN KEY (`TOSCA_CSAR_ARTIFACT_UUID`) REFERENCES `tosca_csar` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfInstantiationNotification.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfInstantiationNotification.java
index 153970b053..9a3cd95bec 100644
--- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfInstantiationNotification.java
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfInstantiationNotification.java
@@ -22,7 +22,8 @@
package org.onap.svnfm.simulator.notifications;
-import org.onap.svnfm.simulator.services.SvnfmService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
*
@@ -31,16 +32,16 @@ import org.onap.svnfm.simulator.services.SvnfmService;
*/
public class VnfInstantiationNotification implements Runnable {
- SvnfmService svnfmService = new SvnfmService();
+ private static final Logger logger = LoggerFactory.getLogger(VnfInstantiationNotification.class);
@Override
public void run() {
try {
Thread.sleep(10000);
} catch (final InterruptedException e) {
- e.printStackTrace();
+ logger.error("Error occured while simulating instantiation ", e);
Thread.currentThread().interrupt();
}
- System.out.println("Instantiation process finished");
+ logger.info("Instantiation process finished");
}
}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterCreationNotification.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterCreationNotification.java
index ff299ce12e..39de3444db 100644
--- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterCreationNotification.java
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterCreationNotification.java
@@ -22,6 +22,9 @@
package org.onap.svnfm.simulator.notifications;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
*
* @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech)
@@ -29,15 +32,17 @@ package org.onap.svnfm.simulator.notifications;
*/
public class VnfmAdapterCreationNotification implements Runnable {
+ private static final Logger logger = LoggerFactory.getLogger(VnfmAdapterCreationNotification.class);
+
@Override
public void run() {
try {
Thread.sleep(10000);
} catch (final InterruptedException e) {
- e.printStackTrace();
+ logger.error("Error occured while simulating creation ", e);
Thread.currentThread().interrupt();
}
- System.out.println("Call to VNFM Adapter-Create");
+ logger.info("Call to VNFM Adapter-Create");
}
}
diff --git a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterDeletionNotification.java b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterDeletionNotification.java
index f7a8eaa2dd..af6064fd6a 100644
--- a/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterDeletionNotification.java
+++ b/vnfm-simulator/vnfm-service/src/main/java/org/onap/svnfm/simulator/notifications/VnfmAdapterDeletionNotification.java
@@ -22,6 +22,9 @@
package org.onap.svnfm.simulator.notifications;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
/**
*
* @author Lathishbabu Ganesan (lathishbabu.ganesan@est.tech)
@@ -29,15 +32,17 @@ package org.onap.svnfm.simulator.notifications;
*/
public class VnfmAdapterDeletionNotification implements Runnable {
+ private static final Logger logger = LoggerFactory.getLogger(VnfmAdapterDeletionNotification.class);
+
@Override
public void run() {
try {
Thread.sleep(10000);
} catch (final InterruptedException e) {
- e.printStackTrace();
+ logger.error("Error occured while simulating deletion ", e);
Thread.currentThread().interrupt();
}
- System.out.println("Call to VNFM Adapter-Delete");
+ logger.info("Call to VNFM Adapter-Delete");
}
}