diff options
Diffstat (limited to 'asdc-controller/src')
51 files changed, 4508 insertions, 958 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java index e00bb1eb36..ecffb683ca 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java @@ -22,16 +22,21 @@ package org.onap.so.asdc; +import java.security.SecureRandom; import javax.annotation.PreDestroy; +import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.asdc.client.ASDCController; import org.onap.so.asdc.client.exceptions.ASDCControllerException; +import org.onap.so.logger.ErrorCode; +import org.onap.so.logger.ScheduledTasksMDCSetup; +import org.onap.so.utils.Components; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Profile; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; -import java.security.SecureRandom; @Component @@ -42,12 +47,16 @@ public class ASDCControllerSingleton { private final ASDCController asdcController; @Autowired + private ScheduledTasksMDCSetup scheduledMDCSetup; + + @Autowired public ASDCControllerSingleton(final ASDCController asdcController) { this.asdcController = asdcController; } @Scheduled(fixedRate = 50000) public void periodicControllerTask() { + scheduledMDCSetup.mdcSetup(Components.ASDC_CONTROLLER, "periodicControllerTask"); try { final int randomNumber = new SecureRandom().nextInt(Integer.MAX_VALUE); asdcController.setControllerName("mso-controller" + randomNumber); @@ -57,8 +66,11 @@ public class ASDCControllerSingleton { asdcController.initASDC(); } } catch (final ASDCControllerException controllerException) { + scheduledMDCSetup.errorMDCSetup(ErrorCode.UnknownError, controllerException.getMessage()); + MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.ERROR.toString()); logger.error("Exception occurred", controllerException); } + scheduledMDCSetup.exitAndClearMDC(); } @PreDestroy diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/WebSecurityConfigImpl.java b/asdc-controller/src/main/java/org/onap/so/asdc/WebSecurityConfigImpl.java deleted file mode 100644 index b45b4f0749..0000000000 --- a/asdc-controller/src/main/java/org/onap/so/asdc/WebSecurityConfigImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.asdc; - -import org.onap.so.security.MSOSpringFirewall; -import org.onap.so.security.WebSecurityConfig; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.builders.WebSecurity; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.web.firewall.StrictHttpFirewall; -import org.springframework.util.StringUtils; - -@EnableWebSecurity -public class WebSecurityConfigImpl extends WebSecurityConfig { - - @Override - protected void configure(HttpSecurity http) throws Exception { - http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll() - .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",")).and() - .httpBasic(); - } - - @Override - public void configure(WebSecurity web) throws Exception { - super.configure(web); - StrictHttpFirewall firewall = new MSOSpringFirewall(); - web.httpFirewall(firewall); - } - -} diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java index c37eccf594..06887f1253 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java @@ -29,7 +29,8 @@ import org.onap.so.asdc.activity.beans.ActivitySpec; import org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; -import org.onap.so.utils.TargetEntity; +import org.onap.so.logger.LoggingAnchor; +import org.onap.logging.filter.base.ONAPComponents; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @@ -62,7 +63,7 @@ public class ActivitySpecsActions { String urlString = UriBuilder.fromUri(hostname).path(ACTIVITY_SPEC_URI).build().toString(); URL url = new URL(urlString); - HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.SDC); + HttpClient httpClient = httpClientFactory.newJsonClient(url, ONAPComponents.SDC); httpClient.addAdditionalHeader("Content-Type", ContentType.APPLICATION_JSON.toString()); Response response = httpClient.post(payload); @@ -104,7 +105,7 @@ public class ActivitySpecsActions { String urlString = UriBuilder.fromUri(hostname).path(path).build().toString(); URL url = new URL(urlString); - HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.SDC); + HttpClient httpClient = httpClientFactory.newJsonClient(url, ONAPComponents.SDC); httpClient.addAdditionalHeader("Content-Type", ContentType.APPLICATION_JSON.toString()); Response response = httpClient.put(CERTIFY_ACTIVITY_PAYLOAD); diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java index e048d4c567..e53b792a74 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java @@ -20,6 +20,8 @@ package org.onap.so.asdc.activity; +import java.net.HttpURLConnection; +import java.net.URL; import java.util.ArrayList; import java.util.List; import org.onap.so.logger.LoggingAnchor; @@ -27,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; +import org.apache.http.HttpStatus; import org.onap.so.asdc.activity.beans.ActivitySpec; import org.onap.so.asdc.activity.beans.Input; import org.onap.so.asdc.activity.beans.Output; @@ -55,10 +58,15 @@ public class DeployActivitySpecs { protected static final Logger logger = LoggerFactory.getLogger(DeployActivitySpecs.class); @Transactional - public void deployActivities() throws Exception { + public void deployActivities() { String hostname = env.getProperty(SDC_ENDPOINT); logger.debug("{} {}", "SDC ActivitySpec endpoint: ", hostname); if (hostname == null || hostname.isEmpty()) { + logger.warn("The hostname for SDC activities deployment is not configured in SO"); + return; + } + if (!checkHttpServerUp(hostname)) { + logger.warn("The sdc end point is not alive"); return; } List<org.onap.so.db.catalog.beans.ActivitySpec> activitySpecsFromCatalog = activitySpecRepository.findAll(); @@ -97,10 +105,8 @@ public class DeployActivitySpecs { } List<String> categoryList = new ArrayList<>(); for (ActivitySpecActivitySpecCategories activitySpecCat : activitySpecActivitySpecCategories) { - if (activitySpecCat != null) { - if (activitySpecCat.getActivitySpecCategories() != null) { - categoryList.add(activitySpecCat.getActivitySpecCategories().getName()); - } + if (activitySpecCat != null && activitySpecCat.getActivitySpecCategories() != null) { + categoryList.add(activitySpecCat.getActivitySpecCategories().getName()); } } activitySpec.setCategoryList(categoryList); @@ -137,4 +143,23 @@ public class DeployActivitySpecs { activitySpec.setOutputs(outputs); return; } + + public boolean checkHttpServerUp(String host) { + URL url = null; + boolean isUp = false; + + int responseCode = 0; + try { + url = new URL(host); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.setConnectTimeout(5000); + responseCode = connection.getResponseCode(); + } catch (Exception e) { + logger.warn("Exception on connecting to SDC WFD endpoint: ", e); + } + if (responseCode == HttpStatus.SC_OK || responseCode == HttpStatus.SC_NOT_FOUND) { + isUp = true; + } + return isUp; + } } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java index 639a96eab6..3e5f82bc5e 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java @@ -59,7 +59,8 @@ public class ASDCConfiguration implements IConfiguration { public static final String CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT = "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT"; private static final String[] SUPPORTED_ARTIFACT_TYPES = {HEAT, HEAT_ARTIFACT, HEAT_ENV, HEAT_NESTED, HEAT_NET, - HEAT_VOL, OTHER, TOSCA_CSAR, VF_MODULES_METADATA, CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT, WORKFLOW}; + HEAT_VOL, OTHER, TOSCA_CSAR, VF_MODULES_METADATA, WORKFLOW, CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT}; + public static final List<String> SUPPORTED_ARTIFACT_TYPES_LIST = Collections.unmodifiableList(Arrays.asList(SUPPORTED_ARTIFACT_TYPES)); 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 3b9406a697..f64adfd760 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 @@ -37,6 +37,7 @@ import java.nio.file.Paths; import java.util.List; import java.util.Optional; import org.onap.so.logger.LoggingAnchor; +import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.sdc.api.IDistributionClient; import org.onap.sdc.api.consumer.IDistributionStatusMessage; import org.onap.sdc.api.consumer.IFinalDistrStatusMessage; @@ -71,6 +72,7 @@ import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.orm.ObjectOptimisticLockingFailureException; import org.springframework.stereotype.Component; @@ -588,6 +590,10 @@ public class ASDCController { logger.info(LoggingAnchor.FOUR, MessageEnum.ASDC_RECEIVE_CALLBACK_NOTIF.toString(), String.valueOf(noOfArtifacts), iNotif.getServiceUUID(), "ASDC"); try { + + if (iNotif.getDistributionID() != null && !iNotif.getDistributionID().isEmpty()) { + MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, iNotif.getDistributionID()); + } logger.debug(ASDCNotificationLogging.dumpASDCNotification(iNotif)); logger.info(LoggingAnchor.FOUR, MessageEnum.ASDC_RECEIVE_SERVICE_NOTIF.toString(), iNotif.getServiceUUID(), "ASDC", "treatNotification"); @@ -682,7 +688,7 @@ public class ASDCController { iNotif.getDistributionID()); logger.error(LoggingAnchor.FIVE, MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(), "Database concurrency exception: ", "ASDC", "treatNotification", - ErrorCode.BusinessProcesssError.getValue(), "RuntimeException in treatNotification", e); + ErrorCode.BusinessProcessError.getValue(), "RuntimeException in treatNotification", e); } catch (Exception e) { logger.error("", MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(), @@ -717,7 +723,6 @@ public class ASDCController { // For each artifact, create a structure describing the VFModule in a ordered flat level ResourceStructure resourceStructure = null; String msoConfigPath = getMsoConfigPath(); - boolean hasVFResource = false; ToscaResourceStructure toscaResourceStructure = new ToscaResourceStructure(msoConfigPath); DistributionStatusEnum deployStatus = DistributionStatusEnum.DEPLOY_OK; String errorMessage = null; @@ -732,12 +737,11 @@ public class ASDCController { for (IResourceInstance resource : iNotif.getResources()) { String resourceType = resource.getResourceType(); - + boolean hasVFResource = false; logger.info("Processing Resource Type: {}, Model UUID: {}", resourceType, resource.getResourceUUID()); - if ("VF".equals(resourceType) && resource.getArtifacts() != null - && !resource.getArtifacts().isEmpty()) { + if ("VF".equals(resourceType)) { resourceStructure = new VfResourceStructure(iNotif, resource); } else if ("PNF".equals(resourceType)) { resourceStructure = new PnfResourceStructure(iNotif, resource); @@ -755,8 +759,8 @@ public class ASDCController { logger.debug("Processing Resource Type: " + resourceType + " and Model UUID: " + resourceStructure.getResourceInstance().getResourceUUID()); - if ("VF".equals(resourceType) && resource.getArtifacts() != null - && !resource.getArtifacts().isEmpty()) { + + if ("VF".equals(resourceType)) { hasVFResource = true; for (IArtifactInfo artifact : resource.getArtifacts()) { IDistributionClientDownloadResult resultArtifact = @@ -796,19 +800,20 @@ public class ASDCController { errorMessage = e.getMessage(); logger.error("Exception occurred", e); } - } - if (!hasVFResource) { + if (!hasVFResource) { - logger.debug("No resources found for Service: " + iNotif.getServiceUUID()); + logger.debug("No resources found for Service: " + iNotif.getServiceUUID()); - logger.debug("Preparing to deploy Service: {}", iNotif.getServiceUUID()); - try { - this.deployResourceStructure(resourceStructure, toscaResourceStructure); - } catch (ArtifactInstallerException e) { - deployStatus = DistributionStatusEnum.DEPLOY_ERROR; - errorMessage = e.getMessage(); - logger.error("Exception occurred", e); + logger.debug("Preparing to deploy Service: {}", iNotif.getServiceUUID()); + try { + this.deployResourceStructure(resourceStructure, toscaResourceStructure); + serviceDeployed = true; + } catch (ArtifactInstallerException e) { + deployStatus = DistributionStatusEnum.DEPLOY_ERROR; + errorMessage = e.getMessage(); + logger.error("Exception occurred", e); + } } } @@ -818,7 +823,7 @@ public class ASDCController { } catch (ASDCDownloadException | UnsupportedEncodingException e) { logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(), "Exception caught during Installation of artifact", "ASDC", "processResourceNotification", - ErrorCode.BusinessProcesssError.getValue(), "Exception in processResourceNotification", e); + ErrorCode.BusinessProcessError.getValue(), "Exception in processResourceNotification", e); } } @@ -864,7 +869,7 @@ public class ASDCController { } catch (Exception e) { logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(), "Exception caught during processCsarServiceArtifacts", "ASDC", - "processCsarServiceArtifacts", ErrorCode.BusinessProcesssError.getValue(), + "processCsarServiceArtifacts", ErrorCode.BusinessProcessError.getValue(), "Exception in processCsarServiceArtifacts", e); } } else if (artifact.getArtifactType().equals(ASDCConfiguration.WORKFLOW)) { @@ -885,7 +890,7 @@ public class ASDCController { logger.info("Whats the error {}", e.getMessage()); logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(), "Exception caught during processCsarServiceArtifacts", "ASDC", - "processCsarServiceArtifacts", ErrorCode.BusinessProcesssError.getValue(), + "processCsarServiceArtifacts", ErrorCode.BusinessProcessError.getValue(), "Exception in processCsarServiceArtifacts", e); } } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java index 24e1887847..a9d06d8e82 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java @@ -138,7 +138,7 @@ public class ASDCRestInterface { logger.info("Error caught " + e.getMessage()); logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION.toString(), "Exception caught during ASDCRestInterface", "ASDC", "invokeASDCService", - ErrorCode.BusinessProcesssError.getValue(), "Exception in invokeASDCService", e); + ErrorCode.BusinessProcessError.getValue(), "Exception in invokeASDCService", e); } return null; diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceStructure.java index 8be3d6ba06..f2c6b2f16a 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceStructure.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceStructure.java @@ -61,7 +61,7 @@ public abstract class ResourceStructure { /** * Number of resources provided by the resource structure. */ - protected int NumberOfResources; + protected int numberOfResources; /** * The list of artifacts existing in this resource hashed by UUID. @@ -142,11 +142,11 @@ public abstract class ResourceStructure { } public int getNumberOfResources() { - return NumberOfResources; + return numberOfResources; } public void setNumberOfResources(int numberOfResources) { - NumberOfResources = numberOfResources; + this.numberOfResources = numberOfResources; } public Map<String, VfModuleArtifact> getArtifactsMapByUUID() { diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java index c49cb3e50f..dcb49478f4 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java @@ -25,7 +25,6 @@ package org.onap.so.asdc.installer; import java.io.File; import java.nio.file.Paths; import java.util.List; -import org.onap.so.logger.LoggingAnchor; import org.onap.sdc.api.notification.IArtifactInfo; import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory; @@ -52,10 +51,10 @@ import org.onap.so.db.catalog.beans.VfModule; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.logger.ErrorCode; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; public class ToscaResourceStructure { @@ -152,7 +151,7 @@ public class ToscaResourceStructure { logger.debug(e.getMessage(), e); logger.error(LoggingAnchor.SIX, MessageEnum.ASDC_GENERAL_EXCEPTION_ARG.toString(), "Exception caught during parser *****LOOK********* " + artifact.getArtifactName(), "ASDC", - "processResourceNotification", ErrorCode.BusinessProcesssError.getValue(), + "processResourceNotification", ErrorCode.BusinessProcessError.getValue(), "Exception in " + "processResourceNotification", e); throw new ASDCDownloadException("Exception caught when passing the csar file to the parser ", e); diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/WorkflowArtifact.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/WorkflowArtifact.java index 83b5614104..c94370feb2 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/WorkflowArtifact.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/WorkflowArtifact.java @@ -22,9 +22,6 @@ package org.onap.so.asdc.installer; import java.io.UnsupportedEncodingException; -import org.onap.so.db.catalog.beans.HeatEnvironment; -import org.onap.so.db.catalog.beans.HeatFiles; -import org.onap.so.db.catalog.beans.HeatTemplate; import org.onap.sdc.api.notification.IArtifactInfo; import org.onap.sdc.api.results.IDistributionClientDownloadResult; diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java index 095741c19b..195aa7e302 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java @@ -33,7 +33,6 @@ import java.util.Enumeration; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipInputStream; -import org.onap.so.logger.LoggingAnchor; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpEntity; @@ -49,6 +48,7 @@ import org.apache.http.entity.mime.content.StringBody; import org.apache.http.impl.client.HttpClientBuilder; import org.onap.so.asdc.client.ASDCConfiguration; import org.onap.so.logger.ErrorCode; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -71,9 +71,8 @@ public class BpmnInstaller { public void installBpmn(String csarFilePath) { logger.info("Deploying BPMN files from {}", csarFilePath); - try { - ZipInputStream csarFile = - new ZipInputStream(new FileInputStream(Paths.get(csarFilePath).normalize().toString())); + try (ZipInputStream csarFile = + new ZipInputStream(new FileInputStream(Paths.get(csarFilePath).normalize().toString()))) { ZipEntry entry = csarFile.getNextEntry(); while (entry != null) { @@ -103,7 +102,6 @@ public class BpmnInstaller { } entry = csarFile.getNextEntry(); } - csarFile.close(); } catch (IOException ex) { logger.debug("Exception :", ex); logger.error(LoggingAnchor.FIVE, MessageEnum.ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL.toString(), csarFilePath, diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java index a68d98e0b0..ef4dfa24aa 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java @@ -52,7 +52,7 @@ import org.springframework.stereotype.Component; public class WorkflowResource { protected static final Logger logger = LoggerFactory.getLogger(WorkflowResource.class); - private static final String pattern = ".*\\\"activity:(.*)\\\" .*"; + private static final String PATTERN = ".*\\\"activity:(.*)\\\" .*"; private static final String TARGET_RESOURCE_VNF = "vnf"; private static final String SOURCE_SDC = "sdc"; private static final String BPMN_SUFFIX = ".bpmn"; @@ -176,7 +176,7 @@ public class WorkflowResource { protected List<String> getActivityNameList(String bpmnContent) { List<String> activityNameList = new ArrayList<>(); - Pattern p = Pattern.compile(pattern); + Pattern p = Pattern.compile(PATTERN); Matcher m = p.matcher(bpmnContent); while (m.find()) { activityNameList.add(m.group(1)); 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 276b8183a8..240bb83862 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 @@ -26,6 +26,7 @@ package org.onap.so.asdc.installer.heat; import java.sql.Timestamp; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.HashMap; @@ -47,11 +48,15 @@ import org.onap.sdc.api.notification.IStatusData; import org.onap.sdc.tosca.parser.api.IEntityDetails; import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; import org.onap.sdc.tosca.parser.elements.queries.EntityQuery; +import org.onap.sdc.tosca.parser.elements.queries.EntityQuery.EntityQueryBuilder; import org.onap.sdc.tosca.parser.elements.queries.TopologyTemplateQuery; import org.onap.sdc.tosca.parser.elements.queries.TopologyTemplateQuery.TopologyTemplateQueryBuilder; +import org.onap.sdc.tosca.parser.enums.EntityTemplateType; import org.onap.sdc.tosca.parser.enums.SdcTypes; import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; -import org.onap.sdc.toscaparser.api.*; +import org.onap.sdc.toscaparser.api.CapabilityAssignment; +import org.onap.sdc.toscaparser.api.Property; +import org.onap.sdc.toscaparser.api.RequirementAssignment; import org.onap.sdc.toscaparser.api.elements.Metadata; import org.onap.sdc.toscaparser.api.functions.GetInput; import org.onap.sdc.toscaparser.api.parameters.Input; @@ -177,6 +182,12 @@ public class ToscaResourceInstaller { protected static final String SKIP_POST_INST_CONF = "skip_post_instantiation_configuration"; + private static final String CONTROLLER_ACTOR = "controller_actor"; + + private static final String CDS_MODEL_NAME = "cds_model_name"; + + private static final String CDS_MODEL_VERSION = "cds_model_version"; + @Autowired protected ServiceRepository serviceRepo; @@ -431,19 +442,26 @@ public class ToscaResourceInstaller { createToscaCsar(toscaResourceStruct); createService(toscaResourceStruct, vfResourceStruct); Service service = toscaResourceStruct.getCatalogService(); - List<NodeTemplate> vfNodeTemplatesList = toscaResourceStruct.getSdcCsarHelper().getServiceVfList(); - for (NodeTemplate nodeTemplate : vfNodeTemplatesList) { - Metadata metadata = nodeTemplate.getMetaData(); - String vfCustomizationCategory = toscaResourceStruct.getSdcCsarHelper() - .getMetadataPropertyValue(metadata, SdcPropertyNames.PROPERTY_NAME_CATEGORY); - processVfModules(toscaResourceStruct, vfResourceStructure, service, nodeTemplate, metadata, - vfCustomizationCategory); + List<IEntityDetails> vfEntityList = getEntityDetails(toscaResourceStruct, + EntityQuery.newBuilder(SdcTypes.VF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); + + List<IEntityDetails> arEntityDetails = new ArrayList<IEntityDetails>(); + + for (IEntityDetails vfEntityDetails : vfEntityList) { + + Metadata metadata = vfEntityDetails.getMetadata(); + String category = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY); + + if (ALLOTTED_RESOURCE.equalsIgnoreCase(category)) { + arEntityDetails.add(vfEntityDetails); + } + + processVfModules(vfEntityDetails, toscaResourceStruct, vfResourceStructure, service, metadata); } processResourceSequence(toscaResourceStruct, service); - List<NodeTemplate> allottedResourceList = toscaResourceStruct.getSdcCsarHelper().getAllottedResources(); - processAllottedResources(toscaResourceStruct, service, allottedResourceList); + processAllottedResources(arEntityDetails, toscaResourceStruct, service); processNetworks(toscaResourceStruct, service); // process Network Collections processNetworkCollections(toscaResourceStruct, service); @@ -499,24 +517,24 @@ public class ToscaResourceInstaller { } - List<NodeTemplate> getRequirementList(List<NodeTemplate> resultList, List<NodeTemplate> nodeTemplates, + List<IEntityDetails> getRequirementList(List<IEntityDetails> resultList, List<IEntityDetails> entityDetails, ISdcCsarHelper iSdcCsarHelper) { - List<NodeTemplate> nodes = new ArrayList<>(); - nodes.addAll(nodeTemplates); + List<IEntityDetails> entities = new ArrayList<>(); + entityDetails.addAll(entityDetails); - for (NodeTemplate nodeTemplate : nodeTemplates) { - RequirementAssignments requirement = iSdcCsarHelper.getRequirementsOf(nodeTemplate); - List<RequirementAssignment> reqAs = requirement.getAll(); - for (RequirementAssignment ra : reqAs) { + for (IEntityDetails entity : entityDetails) { + List<RequirementAssignment> requirements = entity.getRequirements(); + + for (RequirementAssignment ra : requirements) { String reqNode = ra.getNodeTemplateName(); - for (NodeTemplate rNode : resultList) { - if (rNode.getName().equals(reqNode)) { - if (!resultList.contains(nodeTemplate)) { - resultList.add(nodeTemplate); + for (IEntityDetails rEntity : resultList) { + if (rEntity.getName().equals(reqNode)) { + if (!resultList.contains(entityDetails)) { + resultList.add(entity); } - if (nodes.contains(nodeTemplate)) { - nodes.remove(nodeTemplate); + if (entities.contains(entityDetails)) { + entities.remove(entityDetails); } break; } @@ -524,8 +542,8 @@ public class ToscaResourceInstaller { } } - if (!nodes.isEmpty()) { - getRequirementList(resultList, nodes, iSdcCsarHelper); + if (!entities.isEmpty()) { + getRequirementList(resultList, entities, iSdcCsarHelper); } return resultList; @@ -534,26 +552,30 @@ public class ToscaResourceInstaller { // This method retrieve resource sequence from csar file void processResourceSequence(ToscaResourceStructure toscaResourceStructure, Service service) { List<String> resouceSequence = new ArrayList<>(); - List<NodeTemplate> resultList = new ArrayList<>(); + List<IEntityDetails> resultList = new ArrayList<>(); ISdcCsarHelper iSdcCsarHelper = toscaResourceStructure.getSdcCsarHelper(); - List<NodeTemplate> nodeTemplates = iSdcCsarHelper.getServiceNodeTemplates(); - List<NodeTemplate> nodes = new ArrayList<>(); - nodes.addAll(nodeTemplates); - for (NodeTemplate nodeTemplate : nodeTemplates) { - RequirementAssignments requirement = iSdcCsarHelper.getRequirementsOf(nodeTemplate); + List<IEntityDetails> vfEntityList = + getEntityDetails(toscaResourceStructure, EntityQuery.newBuilder(EntityTemplateType.NODE_TEMPLATE), + TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); + + List<IEntityDetails> entities = new ArrayList<>(); + entities.addAll(vfEntityList); - if (requirement == null || requirement.getAll() == null || requirement.getAll().isEmpty()) { - resultList.add(nodeTemplate); - nodes.remove(nodeTemplate); + for (IEntityDetails entityDetails : vfEntityList) { + List<RequirementAssignment> requirements = entityDetails.getRequirements(); + + if (requirements == null || requirements.isEmpty()) { + resultList.add(entityDetails); + entities.remove(entityDetails); } } - resultList = getRequirementList(resultList, nodes, iSdcCsarHelper); + resultList = getRequirementList(resultList, entities, iSdcCsarHelper); - for (NodeTemplate node : resultList) { - String templateName = node.getMetaData().getValue("name"); + for (IEntityDetails entity : resultList) { + String templateName = entity.getMetadata().getValue("name"); if (!resouceSequence.contains(templateName)) { resouceSequence.add(templateName); } @@ -561,7 +583,7 @@ public class ToscaResourceInstaller { String resourceSeqStr = resouceSequence.stream().collect(Collectors.joining(",")); service.setResourceOrder(resourceSeqStr); - logger.debug(" resourceSeq for service uuid(" + service.getModelUUID() + ") : " + resourceSeqStr); + logger.debug(" resourceSeq for service uuid {}: {}", service.getModelUUID(), resourceSeqStr); } @@ -570,7 +592,8 @@ public class ToscaResourceInstaller { String outInput; String defaultValue = null; if (value instanceof Map) { - outInput = ((LinkedHashMap) value).values().toArray()[0].toString(); + Collection values = ((LinkedHashMap) value).values(); + outInput = (values.size() > 0) ? values.toArray()[0].toString() : ""; } else if (value instanceof GetInput) { String inputName = ((GetInput) value).getInputName(); Optional<Input> inputOptional = @@ -596,13 +619,17 @@ public class ToscaResourceInstaller { Map<String, String> resouceRequest = new HashMap<>(); ISdcCsarHelper iSdcCsarHelper = toscaResourceStructure.getSdcCsarHelper(); + List<IEntityDetails> nodeTemplateEntityList = + getEntityDetails(toscaResourceStructure, EntityQuery.newBuilder(EntityTemplateType.NODE_TEMPLATE), + TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); + List<Input> serInput = iSdcCsarHelper.getServiceInputs(); - Optional<NodeTemplate> nodeTemplateOpt = iSdcCsarHelper.getServiceNodeTemplates().stream() - .filter(e -> e.getMetaData().getValue(CUSTOMIZATION_UUID).equals(resourceCustomizationUuid)) + Optional<IEntityDetails> nodeTemplateOpt = nodeTemplateEntityList.stream() + .filter(e -> e.getMetadata().getValue(CUSTOMIZATION_UUID).equals(resourceCustomizationUuid)) .findFirst(); if (nodeTemplateOpt.isPresent()) { - NodeTemplate nodeTemplate = nodeTemplateOpt.get(); - LinkedHashMap<String, Property> resourceProperties = nodeTemplate.getProperties(); + IEntityDetails entityDetails = nodeTemplateOpt.get(); + Map<String, Property> resourceProperties = entityDetails.getProperties(); for (String key : resourceProperties.keySet()) { Property property = resourceProperties.get(key); @@ -617,8 +644,7 @@ public class ToscaResourceInstaller { String jsonStr = objectMapper.writeValueAsString(resouceRequest); jsonStr = jsonStr.replace("\"", "\\\""); - logger.debug( - "resource request for resource customization id (" + resourceCustomizationUuid + ") : " + jsonStr); + logger.debug("resource request for resource customization id {}: {}", resourceCustomizationUuid, jsonStr); return jsonStr; } catch (JsonProcessingException e) { logger.error("resource input could not be deserialized for resource customization id (" @@ -630,7 +656,8 @@ public class ToscaResourceInstaller { protected void processNetworks(ToscaResourceStructure toscaResourceStruct, Service service) throws ArtifactInstallerException { - List<IEntityDetails> vlEntityList = getEntityDetails(toscaResourceStruct, SdcTypes.VL, SdcTypes.SERVICE, false); + List<IEntityDetails> vlEntityList = getEntityDetails(toscaResourceStruct, EntityQuery.newBuilder(SdcTypes.VL), + TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); if (vlEntityList != null) { for (IEntityDetails vlEntity : vlEntityList) { @@ -646,7 +673,10 @@ public class ToscaResourceInstaller { NetworkResourceCustomization networkCustomization = createNetwork(vlEntity, toscaResourceStruct, heatTemplate, tempNetworkLookUp.getAicVersionMax(), tempNetworkLookUp.getAicVersionMin(), service); - service.getNetworkCustomizations().add(networkCustomization); + // only insert unique entries + if (!service.getNetworkCustomizations().contains(networkCustomization)) { + service.getNetworkCustomizations().add(networkCustomization); + } } else { throw new ArtifactInstallerException("No HeatTemplate found for artifactUUID: " + tempNetworkLookUp.getHeatTemplateArtifactUuid()); @@ -654,44 +684,68 @@ public class ToscaResourceInstaller { } else { NetworkResourceCustomization networkCustomization = createNetwork(vlEntity, toscaResourceStruct, null, null, null, service); + networkCustomization.setResourceInput( + getResourceInput(toscaResourceStruct, networkCustomization.getModelCustomizationUUID())); service.getNetworkCustomizations().add(networkCustomization); - logger.debug("No NetworkResourceName found in TempNetworkHeatTemplateLookup for " - + networkResourceModelName); + logger.debug("No NetworkResourceName found in TempNetworkHeatTemplateLookup for {}", + networkResourceModelName); } } } } - protected void processAllottedResources(ToscaResourceStructure toscaResourceStruct, Service service, - List<NodeTemplate> allottedResourceList) { - if (allottedResourceList != null) { - for (NodeTemplate allottedNode : allottedResourceList) { - service.getAllottedCustomizations() - .add(createAllottedResource(allottedNode, toscaResourceStruct, service)); + protected void processAllottedResources(List<IEntityDetails> arEntityDetails, + ToscaResourceStructure toscaResourceStruct, Service service) throws ArtifactInstallerException { + + List<IEntityDetails> pnfAREntityList = getEntityDetails(toscaResourceStruct, + EntityQuery.newBuilder(SdcTypes.PNF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); + + for (IEntityDetails pnfEntity : pnfAREntityList) { + + Metadata metadata = pnfEntity.getMetadata(); + String category = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY); + if (ALLOTTED_RESOURCE.equalsIgnoreCase(category)) { + arEntityDetails.add(pnfEntity); + } + + } + + if (arEntityDetails != null) { + for (IEntityDetails arEntity : arEntityDetails) { + AllottedResourceCustomization allottedResource = + createAllottedResource(arEntity, toscaResourceStruct, service); + String resourceInput = + getResourceInput(toscaResourceStruct, allottedResource.getModelCustomizationUUID()); + if (!"{}".equals(resourceInput)) { + allottedResource.setResourceInput(resourceInput); + } + if (!service.getAllottedCustomizations().contains(allottedResource)) { + service.getAllottedCustomizations().add(allottedResource); + } } } } - protected ConfigurationResource getConfigurationResource(NodeTemplate nodeTemplate) { - Metadata metadata = nodeTemplate.getMetaData(); + protected ConfigurationResource getConfigurationResource(IEntityDetails configEntity) { + Metadata metadata = configEntity.getMetadata(); ConfigurationResource configResource = new ConfigurationResource(); configResource.setModelName(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); configResource.setModelInvariantUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); configResource.setModelUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); configResource.setModelVersion(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); configResource.setDescription(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); - configResource.setToscaNodeType(nodeTemplate.getType()); + configResource.setToscaNodeType(configEntity.getToscaType()); return configResource; } - protected ConfigurationResourceCustomization getConfigurationResourceCustomization(NodeTemplate nodeTemplate, + protected ConfigurationResourceCustomization getConfigurationResourceCustomization(IEntityDetails configEntity, ToscaResourceStructure toscaResourceStructure, ServiceProxyResourceCustomization spResourceCustomization, Service service) { - Metadata metadata = nodeTemplate.getMetaData(); + Metadata metadata = configEntity.getMetadata(); - ConfigurationResource configResource = getConfigurationResource(nodeTemplate); + ConfigurationResource configResource = getConfigurationResource(configEntity); ConfigurationResourceCustomization configCustomizationResource = new ConfigurationResourceCustomization(); @@ -699,14 +753,12 @@ public class ToscaResourceInstaller { configCustomizationResource .setModelCustomizationUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); - configCustomizationResource.setModelInstanceName(nodeTemplate.getName()); - - configCustomizationResource.setFunction( - toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, "function")); - configCustomizationResource.setRole( - toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, "role")); - configCustomizationResource.setType( - toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, "type")); + configCustomizationResource.setModelInstanceName(configEntity.getName()); + + configCustomizationResource.setFunction(getLeafPropertyValue(configEntity, "function")); + configCustomizationResource.setRole(getLeafPropertyValue(configEntity, "role")); + configCustomizationResource.setType(getLeafPropertyValue(configEntity, "type")); + configCustomizationResource.setServiceProxyResourceCustomization(spResourceCustomization); configCustomizationResource.setConfigurationResource(configResource); @@ -718,37 +770,39 @@ public class ToscaResourceInstaller { return configCustomizationResource; } - protected void processServiceProxyAndConfiguration(ToscaResourceStructure toscaResourceStruct, Service service) { - List<NodeTemplate> serviceProxyResourceList = - toscaResourceStruct.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.SERVICE_PROXY); + List<IEntityDetails> spEntityList = + getEntityDetails(toscaResourceStruct, EntityQuery.newBuilder(SdcTypes.SERVICE_PROXY), + TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); - List<NodeTemplate> configurationNodeTemplatesList = - toscaResourceStruct.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CONFIGURATION); + List<IEntityDetails> configEntityList = + getEntityDetails(toscaResourceStruct, EntityQuery.newBuilder(SdcTypes.CONFIGURATION), + TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); List<ServiceProxyResourceCustomization> serviceProxyList = new ArrayList<>(); List<ConfigurationResourceCustomization> configurationResourceList = new ArrayList<>(); ServiceProxyResourceCustomization serviceProxy = null; - if (serviceProxyResourceList != null) { - for (NodeTemplate spNode : serviceProxyResourceList) { - serviceProxy = createServiceProxy(spNode, service, toscaResourceStruct); + if (spEntityList != null) { + for (IEntityDetails spEntity : spEntityList) { + serviceProxy = createServiceProxy(spEntity, service, toscaResourceStruct); serviceProxyList.add(serviceProxy); - for (NodeTemplate configNode : configurationNodeTemplatesList) { + for (IEntityDetails configEntity : configEntityList) { + + List<RequirementAssignment> requirements = configEntity.getRequirements(); + + for (RequirementAssignment requirement : requirements) { - List<RequirementAssignment> requirementsList = - toscaResourceStruct.getSdcCsarHelper().getRequirementsOf(configNode).getAll(); - for (RequirementAssignment requirement : requirementsList) { - if (requirement.getNodeTemplateName().equals(spNode.getName())) { - ConfigurationResourceCustomization configurationResource = createConfiguration(configNode, + if (requirement.getNodeTemplateName().equals(spEntity.getName())) { + ConfigurationResourceCustomization configurationResource = createConfiguration(configEntity, toscaResourceStruct, serviceProxy, service, configurationResourceList); Optional<ConfigurationResourceCustomization> matchingObject = configurationResourceList.stream() - .filter(configurationResourceCustomization -> configNode.getMetaData() + .filter(configurationResourceCustomization -> configEntity.getMetadata() .getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID) .equals(configurationResource.getModelCustomizationUUID())) .filter(configurationResourceCustomization -> configurationResourceCustomization @@ -803,13 +857,13 @@ public class ToscaResourceInstaller { protected void processNetworkCollections(ToscaResourceStructure toscaResourceStruct, Service service) { - List<NodeTemplate> networkCollectionList = - toscaResourceStruct.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CR); + List<IEntityDetails> crEntityList = getEntityDetails(toscaResourceStruct, EntityQuery.newBuilder(SdcTypes.CR), + TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); - if (networkCollectionList != null) { - for (NodeTemplate crNode : networkCollectionList) { + if (crEntityList != null) { + for (IEntityDetails ncEntity : crEntityList) { - createNetworkCollection(crNode, toscaResourceStruct, service); + createNetworkCollection(ncEntity, toscaResourceStruct, service); collectionRepo.saveAndFlush(toscaResourceStruct.getCatalogCollectionResource()); List<NetworkInstanceGroup> networkInstanceGroupList = @@ -926,8 +980,8 @@ public class ToscaResourceInstaller { pnfResourceCustomization.setBlueprintName(getStringValue(properties.get(SDNC_MODEL_NAME))); pnfResourceCustomization.setBlueprintVersion(getStringValue(properties.get(SDNC_MODEL_VERSION))); pnfResourceCustomization.setSkipPostInstConf(getBooleanValue(properties.get(SKIP_POST_INST_CONF))); + pnfResourceCustomization.setControllerActor(getStringValue(properties.get(CONTROLLER_ACTOR))); pnfResourceCustomization.setPnfResources(pnfResource); - return pnfResourceCustomization; } @@ -953,49 +1007,56 @@ public class ToscaResourceInstaller { return String.valueOf(value); } - protected void processVfModules(ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStructure, - Service service, NodeTemplate nodeTemplate, Metadata metadata, String vfCustomizationCategory) - throws Exception { + protected void processVfModules(IEntityDetails vfEntityDetails, ToscaResourceStructure toscaResourceStruct, + VfResourceStructure vfResourceStructure, Service service, Metadata metadata) throws Exception { + + String vfCustomizationCategory = + vfEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY); - logger.debug("VF Category is : " + vfCustomizationCategory); + logger.debug("VF Category is: {} ", vfCustomizationCategory); - if (vfResourceStructure.getVfModuleStructure() != null - && !vfResourceStructure.getVfModuleStructure().isEmpty()) { + String vfCustomizationUUID = + vfEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); - String vfCustomizationUUID = toscaResourceStruct.getSdcCsarHelper().getMetadataPropertyValue(metadata, - SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); - logger.debug("VFCustomizationUUID=" + vfCustomizationUUID); + logger.debug("VFCustomizationUUID= {}", vfCustomizationUUID); - IResourceInstance vfNotificationResource = vfResourceStructure.getResourceInstance(); + IResourceInstance vfNotificationResource = vfResourceStructure.getResourceInstance(); - // Make sure the VF ResourceCustomizationUUID from the notification and tosca customizations match before - // comparing their VF Modules UUID's - logger.debug("Checking if Notification VF ResourceCustomizationUUID: " - + vfNotificationResource.getResourceCustomizationUUID() + " matches Tosca VF Customization UUID: " - + vfCustomizationUUID); + // Make sure the VF ResourceCustomizationUUID from the notification and tosca customizations match before + // comparing their VF Modules UUID's + logger.debug( + "Checking if Notification VF ResourceCustomizationUUID: {} matches Tosca VF Customization UUID: {}", + vfNotificationResource.getResourceCustomizationUUID(), vfCustomizationUUID); - if (vfCustomizationUUID.equals(vfNotificationResource.getResourceCustomizationUUID())) { + if (vfCustomizationUUID.equals(vfNotificationResource.getResourceCustomizationUUID())) { - logger.debug("vfCustomizationUUID: " + vfCustomizationUUID - + " matches vfNotificationResource CustomizationUUID"); + logger.debug("vfCustomizationUUID: {} matches vfNotificationResource CustomizationUUID ", + vfCustomizationUUID); - VnfResourceCustomization vnfResource = createVnfResource(nodeTemplate, toscaResourceStruct, service); + VnfResourceCustomization vnfResource = createVnfResource(vfEntityDetails, toscaResourceStruct, service); + if (vfResourceStructure.getVfModuleStructure() != null + && !vfResourceStructure.getVfModuleStructure().isEmpty()) { Set<CvnfcCustomization> existingCvnfcSet = new HashSet<>(); Set<VnfcCustomization> existingVnfcSet = new HashSet<>(); List<CvnfcConfigurationCustomization> existingCvnfcConfigurationCustom = new ArrayList<>(); for (VfModuleStructure vfModuleStructure : vfResourceStructure.getVfModuleStructure()) { - logger.debug("vfModuleStructure:" + vfModuleStructure.toString()); - List<org.onap.sdc.toscaparser.api.Group> vfGroups = - toscaResourceStruct.getSdcCsarHelper().getVfModulesByVf(vfCustomizationUUID); + logger.debug("vfModuleStructure: {}", vfModuleStructure); + + List<IEntityDetails> vfModuleEntityList = + getEntityDetails(toscaResourceStruct, + EntityQuery.newBuilder("org.openecomp.groups.VfModule"), TopologyTemplateQuery + .newBuilder(SdcTypes.SERVICE).customizationUUID(vfCustomizationUUID), + false); + IVfModuleData vfMetadata = vfModuleStructure.getVfModuleMetadata(); logger.debug("Comparing Vf_Modules_Metadata CustomizationUUID : " + vfMetadata.getVfModuleModelCustomizationUUID()); - Optional<org.onap.sdc.toscaparser.api.Group> matchingObject = vfGroups.stream() + Optional<IEntityDetails> matchingObject = vfModuleEntityList.stream() .peek(group -> logger.debug("To Csar Group VFModuleModelCustomizationUUID " + group.getMetadata().getValue("vfModuleModelCustomizationUUID"))) .filter(group -> group.getMetadata().getValue("vfModuleModelCustomizationUUID") @@ -1003,7 +1064,7 @@ public class ToscaResourceInstaller { .findFirst(); if (matchingObject.isPresent()) { VfModuleCustomization vfModuleCustomization = createVFModuleResource(matchingObject.get(), - nodeTemplate, toscaResourceStruct, vfResourceStructure, vfMetadata, vnfResource, + toscaResourceStruct, vfResourceStructure, vfMetadata, vnfResource, service, existingCvnfcSet, existingVnfcSet, existingCvnfcConfigurationCustom); vfModuleCustomization.getVfModule().setVnfResources(vnfResource.getVnfResources()); } else @@ -1012,113 +1073,120 @@ public class ToscaResourceInstaller { + vfMetadata.getVfModuleModelCustomizationUUID()); } + } + // Check for VNFC Instance Group info and add it if there is + List<IEntityDetails> vfcEntityList = getEntityDetails(toscaResourceStruct, + EntityQuery.newBuilder("org.openecomp.groups.VfcInstanceGroup"), + TopologyTemplateQuery.newBuilder(SdcTypes.VF).customizationUUID(vfCustomizationUUID), false); - // Check for VNFC Instance Group info and add it if there is - List<Group> groupList = - toscaResourceStruct.getSdcCsarHelper().getGroupsOfOriginOfNodeTemplateByToscaGroupType( - nodeTemplate, "org.openecomp.groups.VfcInstanceGroup"); + Set<VnfcCustomization> existingVnfcGroupSet = new HashSet<>(); - for (Group group : groupList) { - VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization = - createVNFCInstanceGroup(nodeTemplate, group, vnfResource, toscaResourceStruct); - vnfcInstanceGroupCustomizationRepo.saveAndFlush(vnfcInstanceGroupCustomization); - } + for (IEntityDetails groupEntity : vfcEntityList) { + VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization = createVNFCInstanceGroup(groupEntity, + vfEntityDetails, vnfResource, toscaResourceStruct, existingVnfcGroupSet); + vnfcInstanceGroupCustomizationRepo.saveAndFlush(vnfcInstanceGroupCustomization); + } - List<String> seqResult = processVNFCGroupSequence(toscaResourceStruct, groupList); - if (!CollectionUtils.isEmpty(seqResult)) { - String resultStr = seqResult.stream().collect(Collectors.joining(",")); - vnfResource.setVnfcInstanceGroupOrder(resultStr); - logger.debug( - "vnfcGroupOrder result for service uuid(" + service.getModelUUID() + ") : " + resultStr); - } - // add this vnfResource with existing vnfResource for this service - addVnfCustomization(service, vnfResource); - } else { - logger.debug("Notification VF ResourceCustomizationUUID: " - + vfNotificationResource.getResourceCustomizationUUID() + " doesn't match " - + "Tosca VF Customization UUID: " + vfCustomizationUUID); + List<String> seqResult = processVNFCGroupSequence(toscaResourceStruct, vfcEntityList); + if (!CollectionUtils.isEmpty(seqResult)) { + String resultStr = seqResult.stream().collect(Collectors.joining(",")); + vnfResource.setVnfcInstanceGroupOrder(resultStr); + logger.debug("vnfcGroupOrder result for service uuid {}: {}", service.getModelUUID(), resultStr); } + // add this vnfResource with existing vnfResource for this service + addVnfCustomization(service, vnfResource); + } else { + logger.debug("Notification VF ResourceCustomizationUUID: " + + vfNotificationResource.getResourceCustomizationUUID() + " doesn't match " + + "Tosca VF Customization UUID: " + vfCustomizationUUID); } } private List<String> processVNFCGroupSequence(ToscaResourceStructure toscaResourceStructure, - List<Group> groupList) { - if (CollectionUtils.isEmpty(groupList)) { + List<IEntityDetails> groupEntityDetails) { + if (CollectionUtils.isEmpty(groupEntityDetails)) { return Collections.emptyList(); } ISdcCsarHelper iSdcCsarHelper = toscaResourceStructure.getSdcCsarHelper(); - List<String> strSequence = new ArrayList<>(groupList.size()); - List<Group> tempGroupList = new ArrayList<>(groupList.size()); - List<NodeTemplate> nodes = new ArrayList<>(); - tempGroupList.addAll(groupList); + List<String> strSequence = new ArrayList<>(groupEntityDetails.size()); + List<IEntityDetails> tempEntityList = new ArrayList<>(groupEntityDetails.size()); + List<IEntityDetails> entities = new ArrayList<>(); + tempEntityList.addAll(groupEntityDetails); + + for (IEntityDetails vnfcEntityDetails : groupEntityDetails) { + + List<IEntityDetails> vnfcMemberNodes = vnfcEntityDetails.getMemberNodes(); - for (Group group : groupList) { - List<NodeTemplate> nodeList = group.getMemberNodes(); boolean hasRequirements = false; - for (NodeTemplate node : nodeList) { - RequirementAssignments requirements = iSdcCsarHelper.getRequirementsOf(node); - if (requirements != null && requirements.getAll() != null && !requirements.getAll().isEmpty()) { + for (IEntityDetails vnfcDetails : vnfcMemberNodes) { + + List<RequirementAssignment> requirements = vnfcDetails.getRequirements(); + + if (requirements != null && !requirements.isEmpty()) { hasRequirements = true; break; } } if (!hasRequirements) { - strSequence.add(group.getName()); - tempGroupList.remove(group); - nodes.addAll(nodeList); + strSequence.add(vnfcEntityDetails.getName()); + tempEntityList.remove(vnfcEntityDetails); + entities.addAll(vnfcMemberNodes); } } - getVNFCGroupSequenceList(strSequence, tempGroupList, nodes, iSdcCsarHelper); + getVNFCGroupSequenceList(strSequence, tempEntityList, entities, iSdcCsarHelper); return strSequence; } - private void getVNFCGroupSequenceList(List<String> strSequence, List<Group> groupList, List<NodeTemplate> nodes, - ISdcCsarHelper iSdcCsarHelper) { - if (CollectionUtils.isEmpty(groupList)) { + private void getVNFCGroupSequenceList(List<String> strSequence, List<IEntityDetails> vnfcGroupDetails, + List<IEntityDetails> vnfcMemberNodes, ISdcCsarHelper iSdcCsarHelper) { + if (CollectionUtils.isEmpty(vnfcGroupDetails)) { return; } - List<Group> tempGroupList = new ArrayList<>(); - tempGroupList.addAll(groupList); + List<IEntityDetails> tempGroupList = new ArrayList<>(); + tempGroupList.addAll(vnfcGroupDetails); + + for (IEntityDetails vnfcGroup : vnfcGroupDetails) { + List<IEntityDetails> members = vnfcGroup.getMemberNodes(); + for (IEntityDetails memberNode : members) { + boolean isAllExists = true; - for (Group group : groupList) { - boolean isAllExists = true; - ArrayList<NodeTemplate> members = group.getMemberNodes(); - for (NodeTemplate memberNode : members) { - RequirementAssignments requirements = iSdcCsarHelper.getRequirementsOf(memberNode); - if (requirements == null || requirements.getAll() == null || requirements.getAll().isEmpty()) { + + List<RequirementAssignment> requirements = memberNode.getRequirements(); + + if (requirements == null || requirements.isEmpty()) { continue; } - List<RequirementAssignment> rqaList = requirements.getAll(); - for (RequirementAssignment rqa : rqaList) { + + + for (RequirementAssignment rqa : requirements) { String name = rqa.getNodeTemplateName(); - Optional<NodeTemplate> findNode = - nodes.stream().filter(node -> node.getName().equals(name)).findFirst(); - if (!findNode.isPresent()) { - isAllExists = false; - break; + for (IEntityDetails node : vnfcMemberNodes) { + if (name.equals(node.getName())) { + break; + } } - } - if (!isAllExists) { + + isAllExists = false; break; } - } - if (isAllExists) { - strSequence.add(group.getName()); - tempGroupList.remove(group); - nodes.addAll(group.getMemberNodes()); + if (isAllExists) { + strSequence.add(vnfcGroup.getName()); + tempGroupList.remove(vnfcGroupDetails); + vnfcMemberNodes.addAll(vnfcGroupDetails); + } } - } - if (!tempGroupList.isEmpty() && tempGroupList.size() < groupList.size()) { - getVNFCGroupSequenceList(strSequence, tempGroupList, nodes, iSdcCsarHelper); + if (!tempGroupList.isEmpty() && tempGroupList.size() < vnfcGroupDetails.size()) { + getVNFCGroupSequenceList(strSequence, tempGroupList, vnfcMemberNodes, iSdcCsarHelper); + } } } @@ -1134,7 +1202,7 @@ public class ToscaResourceInstaller { watchdogDistributionStatusRepository.saveAndFlush(distributionStatus); } catch (ObjectOptimisticLockingFailureException e) { - logger.debug("ObjectOptimisticLockingFailureException in processWatchdog : " + e.toString()); + logger.debug("ObjectOptimisticLockingFailureException in processWatchdog : {} ", e); throw e; } } @@ -1338,8 +1406,14 @@ public class ToscaResourceInstaller { ResourceStructure resourceStructure) { Metadata serviceMetadata = toscaResourceStructure.getServiceMetadata(); - - Service service = new Service(); + List<Service> services = + serviceRepo.findByModelUUID(serviceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + Service service; + if (!services.isEmpty() && services.size() > 0) { + service = services.get(0); + } else { + service = new Service(); + } if (serviceMetadata != null) { @@ -1368,6 +1442,10 @@ public class ToscaResourceInstaller { generateNamingValue = "true".equalsIgnoreCase(generateNaming); } service.setOnapGeneratedNaming(generateNamingValue); + service.setBlueprintName(serviceMetadata.getValue(CDS_MODEL_NAME)); + service.setBlueprintVersion(serviceMetadata.getValue(CDS_MODEL_VERSION)); + service.setSkipPostInstConf(Boolean.valueOf(serviceMetadata.getValue(SKIP_POST_INST_CONF))); + service.setControllerActor(serviceMetadata.getValue(CONTROLLER_ACTOR)); } @@ -1375,10 +1453,10 @@ public class ToscaResourceInstaller { return service; } - protected ServiceProxyResourceCustomization createServiceProxy(NodeTemplate nodeTemplate, Service service, + protected ServiceProxyResourceCustomization createServiceProxy(IEntityDetails spEntity, Service service, ToscaResourceStructure toscaResourceStructure) { - Metadata spMetadata = nodeTemplate.getMetaData(); + Metadata spMetadata = spEntity.getMetadata(); ServiceProxyResourceCustomization spCustomizationResource = new ServiceProxyResourceCustomization(); @@ -1393,15 +1471,15 @@ public class ToscaResourceInstaller { spCustomizationResource .setModelCustomizationUUID(spMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); - spCustomizationResource.setModelInstanceName(nodeTemplate.getName()); - spCustomizationResource.setToscaNodeType(nodeTemplate.getType()); + spCustomizationResource.setModelInstanceName(spEntity.getName()); + spCustomizationResource.setToscaNodeType(spEntity.getToscaType()); String sourceServiceUUID = spMetadata.getValue("sourceModelUuid"); Service sourceService = serviceRepo.findOneByModelUUID(sourceServiceUUID); spCustomizationResource.setSourceService(sourceService); - spCustomizationResource.setToscaNodeType(nodeTemplate.getType()); + spCustomizationResource.setToscaNodeType(spEntity.getToscaType()); serviceProxyCustomizationSet.add(spCustomizationResource); @@ -1410,20 +1488,20 @@ public class ToscaResourceInstaller { return spCustomizationResource; } - protected ConfigurationResourceCustomization createConfiguration(NodeTemplate nodeTemplate, + protected ConfigurationResourceCustomization createConfiguration(IEntityDetails configEntity, ToscaResourceStructure toscaResourceStructure, ServiceProxyResourceCustomization spResourceCustomization, Service service, List<ConfigurationResourceCustomization> configurationResourceList) { ConfigurationResourceCustomization configCustomizationResource = getConfigurationResourceCustomization( - nodeTemplate, toscaResourceStructure, spResourceCustomization, service); + configEntity, toscaResourceStructure, spResourceCustomization, service); ConfigurationResource configResource = null; ConfigurationResource existingConfigResource = findExistingConfiguration(service, - nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID), configurationResourceList); + configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID), configurationResourceList); if (existingConfigResource == null) { - configResource = getConfigurationResource(nodeTemplate); + configResource = getConfigurationResource(configEntity); } else { configResource = existingConfigResource; } @@ -1451,13 +1529,20 @@ public class ToscaResourceInstaller { } protected void createToscaCsar(ToscaResourceStructure toscaResourceStructure) { - ToscaCsar toscaCsar = new ToscaCsar(); + Optional<ToscaCsar> toscaCsarOpt = + toscaCsarRepo.findById(toscaResourceStructure.getToscaArtifact().getArtifactUUID()); + ToscaCsar toscaCsar; + if (!toscaCsarOpt.isPresent()) { + toscaCsar = new ToscaCsar(); + toscaCsar.setArtifactUUID(toscaResourceStructure.getToscaArtifact().getArtifactUUID()); + } else { + toscaCsar = toscaCsarOpt.get(); + } if (toscaResourceStructure.getToscaArtifact().getArtifactChecksum() != null) { toscaCsar.setArtifactChecksum(toscaResourceStructure.getToscaArtifact().getArtifactChecksum()); } else { toscaCsar.setArtifactChecksum(MANUAL_RECORD); } - toscaCsar.setArtifactUUID(toscaResourceStructure.getToscaArtifact().getArtifactUUID()); toscaCsar.setName(toscaResourceStructure.getToscaArtifact().getArtifactName()); toscaCsar.setVersion(toscaResourceStructure.getToscaArtifact().getArtifactVersion()); toscaCsar.setDescription(toscaResourceStructure.getToscaArtifact().getArtifactDescription()); @@ -1610,7 +1695,7 @@ public class ToscaResourceInstaller { return networkResource; } - protected CollectionNetworkResourceCustomization createNetworkCollection(NodeTemplate networkNodeTemplate, + protected CollectionNetworkResourceCustomization createNetworkCollection(IEntityDetails cnrEntity, ToscaResourceStructure toscaResourceStructure, Service service) { CollectionNetworkResourceCustomization collectionNetworkResourceCustomization = @@ -1619,33 +1704,26 @@ public class ToscaResourceInstaller { // **** Build Object to populate Collection_Resource table CollectionResource collectionResource = new CollectionResource(); + collectionResource.setModelName(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); collectionResource - .setModelName(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); - collectionResource.setModelInvariantUUID( - networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); - collectionResource - .setModelUUID(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); - collectionResource - .setModelVersion(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); - collectionResource - .setDescription(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); - collectionResource.setToscaNodeType(networkNodeTemplate.getType()); + .setModelInvariantUUID(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + collectionResource.setModelUUID(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + collectionResource.setModelVersion(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); + collectionResource.setDescription(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); + collectionResource.setToscaNodeType(cnrEntity.getToscaType()); toscaResourceStructure.setCatalogCollectionResource(collectionResource); // **** Build object to populate Collection_Resource_Customization table NetworkCollectionResourceCustomization ncfc = new NetworkCollectionResourceCustomization(); - ncfc.setFunction(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate, - "cr_function")); - ncfc.setRole(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate, - "cr_role")); - ncfc.setType(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate, - "cr_type")); + ncfc.setFunction(getLeafPropertyValue(cnrEntity, "cr_function")); + ncfc.setRole(getLeafPropertyValue(cnrEntity, "cr_role")); + ncfc.setType(getLeafPropertyValue(cnrEntity, "cr_type")); - ncfc.setModelInstanceName(networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); + ncfc.setModelInstanceName(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); ncfc.setModelCustomizationUUID( - networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); Set<CollectionNetworkResourceCustomization> networkResourceCustomizationSet = new HashSet<>(); networkResourceCustomizationSet.add(collectionNetworkResourceCustomization); @@ -1656,25 +1734,28 @@ public class ToscaResourceInstaller { toscaResourceStructure.setCatalogCollectionResourceCustomization(ncfc); // *** Build object to populate the Instance_Group table - List<Group> groupList = - toscaResourceStructure.getSdcCsarHelper().getGroupsOfOriginOfNodeTemplateByToscaGroupType( - networkNodeTemplate, "org.openecomp.groups.NetworkCollection"); + List<IEntityDetails> ncEntityList = + getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder("org.openecomp.groups.NetworkCollection"), + TopologyTemplateQuery.newBuilder(SdcTypes.CR).customizationUUID( + cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)), + false); List<NetworkInstanceGroup> networkInstanceGroupList = new ArrayList<>(); List<CollectionResourceInstanceGroupCustomization> collectionResourceInstanceGroupCustomizationList = new ArrayList<>(); - for (Group group : groupList) { + for (IEntityDetails ncGroupEntity : ncEntityList) { NetworkInstanceGroup networkInstanceGroup = new NetworkInstanceGroup(); - Metadata instanceMetadata = group.getMetadata(); + Metadata instanceMetadata = ncGroupEntity.getMetadata(); networkInstanceGroup.setModelName(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); networkInstanceGroup .setModelInvariantUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); networkInstanceGroup.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); networkInstanceGroup.setModelVersion(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); - networkInstanceGroup.setToscaNodeType(group.getType()); + networkInstanceGroup.setToscaNodeType(ncGroupEntity.getToscaType()); networkInstanceGroup.setRole(SubType.SUB_INTERFACE.toString()); // Set // Role networkInstanceGroup.setType(InstanceGroupType.L3_NETWORK); // Set @@ -1688,27 +1769,26 @@ public class ToscaResourceInstaller { crInstanceGroupCustomization.setInstanceGroup(networkInstanceGroup); crInstanceGroupCustomization.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); crInstanceGroupCustomization.setModelCustomizationUUID( - networkNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); // Loop through the template policy to find the subinterface_network_quantity property name. Then extract // the value for it. - List<Policy> policyList = - toscaResourceStructure.getSdcCsarHelper().getPoliciesOfOriginOfNodeTemplateByToscaPolicyType( - networkNodeTemplate, "org.openecomp.policies.scaling.Fixed"); + List<IEntityDetails> policyEntityList = getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder("org.openecomp.policies.scaling.Fixed"), + TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), true); - if (policyList != null) { - for (Policy policy : policyList) { - for (String policyNetworkCollection : policy.getTargets()) { + if (policyEntityList != null) { + for (IEntityDetails policyEntity : policyEntityList) { + for (String policyNetworkCollection : policyEntity.getTargets()) { - if (policyNetworkCollection.equalsIgnoreCase(group.getName())) { + if (policyNetworkCollection.equalsIgnoreCase(ncGroupEntity.getName())) { - Map<String, Object> propMap = policy.getPolicyProperties(); + Map<String, Property> propMap = policyEntity.getProperties(); if (propMap.get("quantity") != null) { - String quantity = toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(networkNodeTemplate, - getPropertyInput(propMap.get("quantity").toString())); + String quantity = getLeafPropertyValue(cnrEntity, + getPropertyInput(propMap.get("quantity").toString())); if (quantity != null) { crInstanceGroupCustomization @@ -1723,13 +1803,12 @@ public class ToscaResourceInstaller { } crInstanceGroupCustomization.setDescription( - toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate, - instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME) - + "_network_collection_description")); - crInstanceGroupCustomization.setFunction( - toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(networkNodeTemplate, - instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME) - + "_network_collection_function")); + getLeafPropertyValue(cnrEntity, instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME) + + "_network_collection_description")); + + crInstanceGroupCustomization.setFunction(getLeafPropertyValue(cnrEntity, + instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME) + "_network_collection_function")); + crInstanceGroupCustomization.setCollectionResourceCust(ncfc); collectionResourceInstanceGroupCustomizationList.add(crInstanceGroupCustomization); @@ -1741,18 +1820,21 @@ public class ToscaResourceInstaller { toscaResourceStructure.setCatalogNetworkInstanceGroup(networkInstanceGroupList); - List<NodeTemplate> vlNodeList = toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplateBySdcType(networkNodeTemplate, SdcTypes.VL); + List<IEntityDetails> networkEntityList = + getEntityDetails(toscaResourceStructure, EntityQuery.newBuilder(SdcTypes.VL), + TopologyTemplateQuery.newBuilder(SdcTypes.CR).customizationUUID( + cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)), + false); List<CollectionNetworkResourceCustomization> collectionNetworkResourceCustomizationList = new ArrayList<>(); // *****Build object to populate the NetworkResource table NetworkResource networkResource = new NetworkResource(); - for (NodeTemplate vlNodeTemplate : vlNodeList) { + for (IEntityDetails networkEntity : networkEntityList) { - String providerNetwork = toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue( - vlNodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK); + String providerNetwork = getLeafPropertyValue(networkEntity, + SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK); if ("true".equalsIgnoreCase(providerNetwork)) { networkResource.setNeutronNetworkType(PROVIDER); @@ -1760,22 +1842,20 @@ public class ToscaResourceInstaller { networkResource.setNeutronNetworkType(BASIC); } - networkResource - .setModelName(vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); + networkResource.setModelName(networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); networkResource.setModelInvariantUUID( - vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + networkResource.setModelUUID(networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); networkResource - .setModelUUID(vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); - networkResource - .setModelVersion(vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); + .setModelVersion(networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); networkResource.setAicVersionMax( - vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)); + networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)); TempNetworkHeatTemplateLookup tempNetworkLookUp = tempNetworkLookupRepo.findFirstBynetworkResourceModelName( - vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); + networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); if (tempNetworkLookUp != null) { @@ -1787,29 +1867,28 @@ public class ToscaResourceInstaller { } - networkResource.setToscaNodeType(vlNodeTemplate.getType()); + networkResource.setToscaNodeType(networkEntity.getToscaType()); networkResource.setDescription( - vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); + networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); networkResource.setOrchestrationMode(HEAT); // Build object to populate the // Collection_Network_Resource_Customization table - for (NodeTemplate memberNode : group.getMemberNodes()) { - collectionNetworkResourceCustomization.setModelInstanceName(memberNode.getName()); + for (IEntityDetails networkMemberEntity : ncGroupEntity.getMemberNodes()) { + collectionNetworkResourceCustomization.setModelInstanceName(networkMemberEntity.getName()); } collectionNetworkResourceCustomization.setModelCustomizationUUID( - vlNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); collectionNetworkResourceCustomization.setNetworkTechnology( - toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vlNodeTemplate, - SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY)); - collectionNetworkResourceCustomization.setNetworkType(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vlNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE)); - collectionNetworkResourceCustomization.setNetworkRole(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vlNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE)); - collectionNetworkResourceCustomization.setNetworkScope(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vlNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE)); + getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY)); + collectionNetworkResourceCustomization.setNetworkType( + getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE)); + collectionNetworkResourceCustomization.setNetworkRole( + getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE)); + collectionNetworkResourceCustomization.setNetworkScope( + getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE)); collectionNetworkResourceCustomization.setInstanceGroup(networkInstanceGroup); collectionNetworkResourceCustomization.setNetworkResource(networkResource); collectionNetworkResourceCustomization.setNetworkResourceCustomization(ncfc); @@ -1822,24 +1901,26 @@ public class ToscaResourceInstaller { return collectionNetworkResourceCustomization; } - protected VnfcInstanceGroupCustomization createVNFCInstanceGroup(NodeTemplate vnfcNodeTemplate, Group group, - VnfResourceCustomization vnfResourceCustomization, ToscaResourceStructure toscaResourceStructure) { + protected VnfcInstanceGroupCustomization createVNFCInstanceGroup(IEntityDetails vfcInstanceEntity, + IEntityDetails vfEntityDetails, VnfResourceCustomization vnfResourceCustomization, + ToscaResourceStructure toscaResourceStructure, Set<VnfcCustomization> existingVnfcGroupSet) { - Metadata instanceMetadata = group.getMetadata(); + Metadata instanceMetadata = vfcInstanceEntity.getMetadata(); InstanceGroup existingInstanceGroup = instanceGroupRepo.findByModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); - VFCInstanceGroup vfcInstanceGroup = new VFCInstanceGroup(); + VFCInstanceGroup vfcInstanceGroup; if (existingInstanceGroup == null) { // Populate InstanceGroup + vfcInstanceGroup = new VFCInstanceGroup(); vfcInstanceGroup.setModelName(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); vfcInstanceGroup .setModelInvariantUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); vfcInstanceGroup.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); vfcInstanceGroup.setModelVersion(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); - vfcInstanceGroup.setToscaNodeType(group.getType()); + vfcInstanceGroup.setToscaNodeType(vfcInstanceEntity.getToscaType()); vfcInstanceGroup.setRole("SUB-INTERFACE"); // Set Role vfcInstanceGroup.setType(InstanceGroupType.VNFC); // Set type } else { @@ -1858,59 +1939,89 @@ public class ToscaResourceInstaller { vfcInstanceGroupCustom.setDescription(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); String getInputName = null; - String groupProperty = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group, - "vfc_instance_group_function"); - if (groupProperty != null) { - int getInputIndex = groupProperty.indexOf("{get_input="); - if (getInputIndex > -1) { - getInputName = groupProperty.substring(getInputIndex + 11, groupProperty.length() - 1); + + Map<String, Property> groupProperties = vfcInstanceEntity.getProperties(); + + for (String key : groupProperties.keySet()) { + Property property = groupProperties.get(key); + + String vfcName = property.getName(); + + if (vfcName != null) { + if (vfcName.equals("vfc_instance_group_function")) { + + String vfcValue = property.getValue().toString(); + int getInputIndex = vfcValue.indexOf("{get_input="); + if (getInputIndex > -1) { + getInputName = vfcValue.substring(getInputIndex + 11, vfcValue.length() - 1); + } + + } } + } - vfcInstanceGroupCustom.setFunction(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vnfcNodeTemplate, getInputName)); + + List<IEntityDetails> serviceEntityList = getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(SdcTypes.VF) + .customizationUUID(vnfResourceCustomization.getModelCustomizationUUID()), + TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); + + if (serviceEntityList != null && !serviceEntityList.isEmpty()) { + vfcInstanceGroupCustom.setFunction(getLeafPropertyValue(serviceEntityList.get(0), getInputName)); + } + vfcInstanceGroupCustom.setInstanceGroup(vfcInstanceGroup); - ArrayList<Input> inputs = vnfcNodeTemplate.getSubMappingToscaTemplate().getInputs(); - createVFCInstanceGroupMembers(vfcInstanceGroupCustom, group, inputs); + List<Input> inputs = vfEntityDetails.getInputs(); - return vfcInstanceGroupCustom; + createVFCInstanceGroupMembers(vfcInstanceGroupCustom, vfcInstanceEntity, inputs, existingVnfcGroupSet); + return vfcInstanceGroupCustom; } - private void createVFCInstanceGroupMembers(VnfcInstanceGroupCustomization vfcInstanceGroupCustom, Group group, - List<Input> inputList) { - List<NodeTemplate> members = group.getMemberNodes(); + private void createVFCInstanceGroupMembers(VnfcInstanceGroupCustomization vfcInstanceGroupCustom, + IEntityDetails vfcModuleEntity, List<Input> inputList, Set<VnfcCustomization> existingVnfcGroupSet) { + List<IEntityDetails> members = vfcModuleEntity.getMemberNodes(); if (!CollectionUtils.isEmpty(members)) { - for (NodeTemplate vfcTemplate : members) { - VnfcCustomization vnfcCustomization = new VnfcCustomization(); - - Metadata metadata = vfcTemplate.getMetaData(); - vnfcCustomization - .setModelCustomizationUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); - vnfcCustomization.setModelInstanceName(vfcTemplate.getName()); - vnfcCustomization.setModelUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); - vnfcCustomization - .setModelInvariantUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); - vnfcCustomization.setModelVersion(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); - vnfcCustomization.setModelName(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); - vnfcCustomization.setToscaNodeType(testNull(vfcTemplate.getType())); - vnfcCustomization - .setDescription(testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); - vnfcCustomization.setResourceInput(getVnfcResourceInput(vfcTemplate, inputList)); - List<VnfcCustomization> vnfcCustomizations = vfcInstanceGroupCustom.getVnfcCustomizations(); - - if (vnfcCustomizations == null) { - vnfcCustomizations = new ArrayList<>(); - vfcInstanceGroupCustom.setVnfcCustomizations(vnfcCustomizations); + for (IEntityDetails vfcEntity : members) { + + VnfcCustomization existingVfcGroup = findExistingVfc(existingVnfcGroupSet, + vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + + if (existingVfcGroup == null) { + VnfcCustomization vnfcCustomization = new VnfcCustomization(); + + Metadata metadata = vfcEntity.getMetadata(); + vnfcCustomization.setModelCustomizationUUID( + metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + vnfcCustomization.setModelInstanceName(vfcEntity.getName()); + vnfcCustomization.setModelUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + vnfcCustomization + .setModelInvariantUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + vnfcCustomization.setModelVersion(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); + vnfcCustomization.setModelName(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); + vnfcCustomization.setToscaNodeType(testNull(vfcEntity.getToscaType())); + vnfcCustomization + .setDescription(testNull(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); + vnfcCustomization.setResourceInput(getVnfcResourceInput(vfcEntity, inputList)); + vnfcCustomization.setVnfcInstanceGroupCustomization(vfcInstanceGroupCustom); + List<VnfcCustomization> vnfcCustomizations = vfcInstanceGroupCustom.getVnfcCustomizations(); + + if (vnfcCustomizations == null) { + vnfcCustomizations = new ArrayList<>(); + vfcInstanceGroupCustom.setVnfcCustomizations(vnfcCustomizations); + } + vnfcCustomizations.add(vnfcCustomization); + + existingVnfcGroupSet.add(vnfcCustomization); } - vnfcCustomizations.add(vnfcCustomization); } } } - public String getVnfcResourceInput(NodeTemplate vfcTemplate, List<Input> inputList) { + public String getVnfcResourceInput(IEntityDetails vfcEntity, List<Input> inputList) { Map<String, String> resouceRequest = new HashMap<>(); - LinkedHashMap<String, Property> vfcTemplateProperties = vfcTemplate.getProperties(); + Map<String, Property> vfcTemplateProperties = vfcEntity.getProperties(); for (String key : vfcTemplateProperties.keySet()) { Property property = vfcTemplateProperties.get(key); String resourceValue = getValue(property.getValue(), inputList); @@ -1918,15 +2029,15 @@ public class ToscaResourceInstaller { } String resourceCustomizationUuid = - vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); + vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); String jsonStr = null; try { ObjectMapper objectMapper = new ObjectMapper(); jsonStr = objectMapper.writeValueAsString(resouceRequest); jsonStr = jsonStr.replace("\"", "\\\""); - logger.debug("vfcResource request for resource customization id (" + resourceCustomizationUuid + ") : " - + jsonStr); + logger.debug("vfcResource request for resource customization id {}: {}", resourceCustomizationUuid, + jsonStr); } catch (JsonProcessingException e) { logger.debug("Json Exception: {}", e.getMessage()); logger.error("Exception occurred", e); @@ -1935,22 +2046,26 @@ public class ToscaResourceInstaller { return jsonStr; } - protected VfModuleCustomization createVFModuleResource(Group group, NodeTemplate vfTemplate, + protected VfModuleCustomization createVFModuleResource(IEntityDetails vfModuleEntityDetails, ToscaResourceStructure toscaResourceStructure, VfResourceStructure vfResourceStructure, - IVfModuleData vfModuleData, VnfResourceCustomization vnfResource, Set<CvnfcCustomization> existingCvnfcSet, - Set<VnfcCustomization> existingVnfcSet, + IVfModuleData vfModuleData, VnfResourceCustomization vnfResource, Service service, + Set<CvnfcCustomization> existingCvnfcSet, Set<VnfcCustomization> existingVnfcSet, List<CvnfcConfigurationCustomization> existingCvnfcConfigurationCustom) { VfModuleCustomization vfModuleCustomization = findExistingVfModuleCustomization(vnfResource, vfModuleData.getVfModuleModelCustomizationUUID()); + if (vfModuleCustomization == null) { + VfModule vfModule = findExistingVfModule(vnfResource, - vfTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID)); - Metadata vfMetadata = group.getMetadata(); + vfModuleEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID)); + + Metadata vfMetadata = vfModuleEntityDetails.getMetadata(); if (vfModule == null) - vfModule = createVfModule(group, toscaResourceStructure, vfModuleData, vfMetadata); + vfModule = createVfModule(vfModuleEntityDetails, toscaResourceStructure, vfModuleData, vfMetadata); - vfModuleCustomization = createVfModuleCustomization(group, toscaResourceStructure, vfModule, vfModuleData); + vfModuleCustomization = + createVfModuleCustomization(vfModuleEntityDetails, toscaResourceStructure, vfModule, vfModuleData); vfModuleCustomization.setVnfCustomization(vnfResource); setHeatInformationForVfModule(toscaResourceStructure, vfResourceStructure, vfModule, vfModuleCustomization, vfMetadata); @@ -1970,38 +2085,48 @@ public class ToscaResourceInstaller { Set<VnfcCustomization> vnfcCustomizations = new HashSet<>(); // Only set the CVNFC if this vfModule group is a member of it. - List<NodeTemplate> groupMembers = - toscaResourceStructure.getSdcCsarHelper().getMembersOfVfModule(vfTemplate, group); - String vfModuleMemberName = null; - for (NodeTemplate node : groupMembers) { - vfModuleMemberName = node.getName(); - } + List<IEntityDetails> groupMembers = getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder("org.openecomp.groups.VfModule") + .uUID(vfModuleCustomization.getVfModule().getModelUUID()), + TopologyTemplateQuery.newBuilder(SdcTypes.VF), false); + + String vfModuleMemberName = null; // Extract CVFC lists - List<IEntityDetails> cvnfcEntityList = - getEntityDetails(toscaResourceStructure, SdcTypes.CVFC, SdcTypes.VF, false); + List<IEntityDetails> cvnfcEntityList = getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(SdcTypes.CVFC), TopologyTemplateQuery.newBuilder(SdcTypes.VF), false); + for (IEntityDetails cvfcEntity : cvnfcEntityList) { boolean cvnfcVfModuleNameMatch = false; - for (NodeTemplate node : groupMembers) { - vfModuleMemberName = node.getName(); + for (IEntityDetails entity : groupMembers) { + + List<IEntityDetails> groupMembersNodes = entity.getMemberNodes(); + for (IEntityDetails groupMember : groupMembersNodes) { + + vfModuleMemberName = groupMember.getName(); + + if (vfModuleMemberName.equalsIgnoreCase(cvfcEntity.getName())) { + cvnfcVfModuleNameMatch = true; + break; + } - if (vfModuleMemberName.equalsIgnoreCase(cvfcEntity.getName())) { - cvnfcVfModuleNameMatch = true; - break; } } + if (vfModuleMemberName != null && cvnfcVfModuleNameMatch) { // Extract associated VFC - Should always be just one - List<IEntityDetails> vfcEntityList = getEntityDetails(toscaResourceStructure, SdcTypes.VFC, + List<IEntityDetails> vfcEntityList = getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(SdcTypes.VFC), TopologyTemplateQuery.newBuilder(SdcTypes.CVFC).customizationUUID( cvfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)), false); + for (IEntityDetails vfcEntity : vfcEntityList) { VnfcCustomization vnfcCustomization = new VnfcCustomization(); @@ -2071,37 +2196,48 @@ public class ToscaResourceInstaller { cvnfcCustomization.setNfcNamingCode(getLeafPropertyValue(cvfcEntity, "nfc_naming_code")); cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization); + // ***************************************************************************************************************************************** // * Extract Fabric Configuration // ***************************************************************************************************************************************** List<IEntityDetails> fabricEntityList = - getEntityDetails(toscaResourceStructure, SdcTypes.CONFIGURATION, SdcTypes.VF, false); + getEntityDetails(toscaResourceStructure, EntityQuery.newBuilder(SdcTypes.CONFIGURATION), + TopologyTemplateQuery.newBuilder(SdcTypes.VF), false); for (IEntityDetails fabricEntity : fabricEntityList) { - ConfigurationResource fabricConfig = null; + List<RequirementAssignment> requirements = fabricEntity.getRequirements(); - ConfigurationResource existingConfig = - findExistingConfiguration(existingCvnfcConfigurationCustom, + for (RequirementAssignment requirement : requirements) { + + if (requirement.getNodeTemplateName().equals(cvfcEntity.getName())) { + + ConfigurationResource fabricConfig = null; + + ConfigurationResource existingConfig = findExistingConfiguration( + existingCvnfcConfigurationCustom, fabricEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); - if (existingConfig == null) { + if (existingConfig == null) { - fabricConfig = createFabricConfiguration(fabricEntity, toscaResourceStructure); + fabricConfig = createFabricConfiguration(fabricEntity, toscaResourceStructure); - } else { - fabricConfig = existingConfig; - } + } else { + fabricConfig = existingConfig; + } - CvnfcConfigurationCustomization cvnfcConfigurationCustomization = - createCvnfcConfigurationCustomization(fabricEntity, toscaResourceStructure, - vnfResource, vfModuleCustomization, cvnfcCustomization, fabricConfig, - vfTemplate, vfModuleMemberName); + CvnfcConfigurationCustomization cvnfcConfigurationCustomization = + createCvnfcConfigurationCustomization(fabricEntity, toscaResourceStructure, + vnfResource, vfModuleCustomization, cvnfcCustomization, + fabricConfig, vfModuleMemberName); - cvnfcConfigurationCustomizations.add(cvnfcConfigurationCustomization); + cvnfcConfigurationCustomizations.add(cvnfcConfigurationCustomization); - existingCvnfcConfigurationCustom.add(cvnfcConfigurationCustomization); + existingCvnfcConfigurationCustom.add(cvnfcConfigurationCustomization); + + } + } } cvnfcCustomization.setCvnfcConfigurationCustomization(cvnfcConfigurationCustomizations); @@ -2122,7 +2258,7 @@ public class ToscaResourceInstaller { protected CvnfcConfigurationCustomization createCvnfcConfigurationCustomization(IEntityDetails fabricEntity, ToscaResourceStructure toscaResourceStruct, VnfResourceCustomization vnfResource, VfModuleCustomization vfModuleCustomization, CvnfcCustomization cvnfcCustomization, - ConfigurationResource configResource, NodeTemplate vfTemplate, String vfModuleMemberName) { + ConfigurationResource configResource, String vfModuleMemberName) { Metadata fabricMetadata = fabricEntity.getMetadata(); @@ -2137,7 +2273,9 @@ public class ToscaResourceInstaller { cvnfcConfigurationCustomization.setModelInstanceName(fabricEntity.getName()); List<IEntityDetails> policyList = - getEntityDetails(toscaResourceStruct, "org.openecomp.policies.External", SdcTypes.VF, true); + getEntityDetails(toscaResourceStruct, EntityQuery.newBuilder("org.openecomp.policies.External"), + TopologyTemplateQuery.newBuilder(SdcTypes.VF), true); + if (policyList != null) { for (IEntityDetails policyEntity : policyList) { @@ -2214,7 +2352,7 @@ public class ToscaResourceInstaller { return vfModule; } - protected VfModuleCustomization createVfModuleCustomization(Group group, + protected VfModuleCustomization createVfModuleCustomization(IEntityDetails vfModuleEntityDetails, ToscaResourceStructure toscaResourceStructure, VfModule vfModule, IVfModuleData vfModuleData) { VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); @@ -2222,62 +2360,72 @@ public class ToscaResourceInstaller { vfModuleCustomization.setVfModule(vfModule); - String initialCount = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group, - SdcPropertyNames.PROPERTY_NAME_INITIALCOUNT); + String initialCount = getLeafPropertyValue(vfModuleEntityDetails, SdcPropertyNames.PROPERTY_NAME_INITIALCOUNT); + + if (initialCount != null && initialCount.length() > 0) { vfModuleCustomization.setInitialCount(Integer.valueOf(initialCount)); } - vfModuleCustomization.setInitialCount(Integer.valueOf(toscaResourceStructure.getSdcCsarHelper() - .getGroupPropertyLeafValue(group, SdcPropertyNames.PROPERTY_NAME_INITIALCOUNT))); + String availabilityZoneCount = + getLeafPropertyValue(vfModuleEntityDetails, SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT); - String availabilityZoneCount = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group, - SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT); if (availabilityZoneCount != null && availabilityZoneCount.length() > 0) { vfModuleCustomization.setAvailabilityZoneCount(Integer.valueOf(availabilityZoneCount)); } - vfModuleCustomization.setLabel(toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group, - SdcPropertyNames.PROPERTY_NAME_VFMODULELABEL)); + vfModuleCustomization + .setLabel(getLeafPropertyValue(vfModuleEntityDetails, SdcPropertyNames.PROPERTY_NAME_VFMODULELABEL)); + + String maxInstances = + getLeafPropertyValue(vfModuleEntityDetails, SdcPropertyNames.PROPERTY_NAME_MAXVFMODULEINSTANCES); - String maxInstances = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group, - SdcPropertyNames.PROPERTY_NAME_MAXVFMODULEINSTANCES); if (maxInstances != null && maxInstances.length() > 0) { vfModuleCustomization.setMaxInstances(Integer.valueOf(maxInstances)); } - String minInstances = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group, - SdcPropertyNames.PROPERTY_NAME_MINVFMODULEINSTANCES); + String minInstances = + getLeafPropertyValue(vfModuleEntityDetails, SdcPropertyNames.PROPERTY_NAME_MINVFMODULEINSTANCES); + if (minInstances != null && minInstances.length() > 0) { vfModuleCustomization.setMinInstances(Integer.valueOf(minInstances)); } + + String skipPostInstConfText = getLeafPropertyValue(vfModuleEntityDetails, SKIP_POST_INST_CONF); + + if (skipPostInstConfText != null) { + vfModuleCustomization.setSkipPostInstConf( + Boolean.parseBoolean(getLeafPropertyValue(vfModuleEntityDetails, SKIP_POST_INST_CONF))); + } + return vfModuleCustomization; } - protected VfModule createVfModule(Group group, ToscaResourceStructure toscaResourceStructure, + protected VfModule createVfModule(IEntityDetails groupEntityDetails, ToscaResourceStructure toscaResourceStructure, IVfModuleData vfModuleData, Metadata vfMetadata) { VfModule vfModule = new VfModule(); String vfModuleModelUUID = vfModuleData.getVfModuleModelUUID(); if (vfModuleModelUUID == null) { - vfModuleModelUUID = testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, - SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID)); + + vfModuleModelUUID = testNull( + groupEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID)); + } else if (vfModuleModelUUID.indexOf('.') > -1) { vfModuleModelUUID = vfModuleModelUUID.substring(0, vfModuleModelUUID.indexOf('.')); } - vfModule.setModelInvariantUUID(testNull(toscaResourceStructure.getSdcCsarHelper() - .getMetadataPropertyValue(vfMetadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID))); - vfModule.setModelName(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, - SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELNAME))); + vfModule.setModelInvariantUUID( + groupEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID)); + vfModule.setModelName( + groupEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELNAME)); vfModule.setModelUUID(vfModuleModelUUID); - vfModule.setModelVersion(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, - SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION))); - vfModule.setDescription(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, - SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); + vfModule.setModelVersion( + groupEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION)); + vfModule.setDescription(groupEntityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); + + String vfModuleType = getLeafPropertyValue(groupEntityDetails, SdcPropertyNames.PROPERTY_NAME_VFMODULETYPE); - String vfModuleType = toscaResourceStructure.getSdcCsarHelper().getGroupPropertyLeafValue(group, - SdcPropertyNames.PROPERTY_NAME_VFMODULETYPE); if (vfModuleType != null && "Base".equalsIgnoreCase(vfModuleType)) { vfModule.setIsBase(true); } else { @@ -2292,8 +2440,7 @@ public class ToscaResourceInstaller { Optional<VfModuleStructure> matchingObject = vfResourceStructure.getVfModuleStructure().stream() .filter(vfModuleStruct -> vfModuleStruct.getVfModuleMetadata().getVfModuleModelUUID() - .equalsIgnoreCase(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, - SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID))) + .equalsIgnoreCase(vfMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID))) .findFirst(); if (matchingObject.isPresent()) { @@ -2382,26 +2529,26 @@ public class ToscaResourceInstaller { } } - protected VnfResourceCustomization createVnfResource(NodeTemplate vfNodeTemplate, + protected VnfResourceCustomization createVnfResource(IEntityDetails entityDetails, ToscaResourceStructure toscaResourceStructure, Service service) throws ArtifactInstallerException { VnfResourceCustomization vnfResourceCustomization = null; if (vnfResourceCustomization == null) { + VnfResource vnfResource = findExistingVnfResource(service, - vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); if (vnfResource == null) { - vnfResource = createVnfResource(vfNodeTemplate); + vnfResource = createVnfResource(entityDetails); } vnfResourceCustomization = - createVnfResourceCustomization(vfNodeTemplate, toscaResourceStructure, vnfResource); + createVnfResourceCustomization(entityDetails, toscaResourceStructure, vnfResource); vnfResourceCustomization.setVnfResources(vnfResource); vnfResourceCustomization.setService(service); // setting resource input for vnf customization vnfResourceCustomization.setResourceInput( getResourceInput(toscaResourceStructure, vnfResourceCustomization.getModelCustomizationUUID())); - service.getVnfCustomizations().add(vnfResourceCustomization); } return vnfResourceCustomization; @@ -2421,61 +2568,62 @@ public class ToscaResourceInstaller { return vnfResource; } - protected VnfResourceCustomization createVnfResourceCustomization(NodeTemplate vfNodeTemplate, + protected VnfResourceCustomization createVnfResourceCustomization(IEntityDetails entityDetails, ToscaResourceStructure toscaResourceStructure, VnfResource vnfResource) { VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization(); vnfResourceCustomization.setModelCustomizationUUID( - testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID))); - vnfResourceCustomization.setModelInstanceName(vfNodeTemplate.getName()); - - vnfResourceCustomization.setNfFunction(testNull(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION))); - vnfResourceCustomization.setNfNamingCode(testNull(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfNodeTemplate, "nf_naming_code"))); - vnfResourceCustomization.setNfRole(testNull(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE))); - vnfResourceCustomization.setNfType(testNull(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE))); + entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); - vnfResourceCustomization.setMultiStageDesign(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfNodeTemplate, MULTI_STAGE_DESIGN)); + vnfResourceCustomization.setModelInstanceName(entityDetails.getName()); + vnfResourceCustomization + .setNfFunction(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)); + vnfResourceCustomization.setNfNamingCode(getLeafPropertyValue(entityDetails, "nf_naming_code")); + vnfResourceCustomization.setNfRole(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_NFROLE)); + vnfResourceCustomization.setNfType(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_NFTYPE)); - vnfResourceCustomization.setBlueprintName(testNull(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SDNC_MODEL_NAME))); + vnfResourceCustomization.setMultiStageDesign(getLeafPropertyValue(entityDetails, MULTI_STAGE_DESIGN)); + vnfResourceCustomization.setBlueprintName(getLeafPropertyValue(entityDetails, SDNC_MODEL_NAME)); + vnfResourceCustomization.setBlueprintVersion(getLeafPropertyValue(entityDetails, SDNC_MODEL_VERSION)); - vnfResourceCustomization.setBlueprintVersion(testNull(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SDNC_MODEL_VERSION))); + String skipPostInstConfText = getLeafPropertyValue(entityDetails, SKIP_POST_INST_CONF); - String skipPostInstConfText = toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SKIP_POST_INST_CONF); if (skipPostInstConfText != null) { - vnfResourceCustomization.setSkipPostInstConf(Boolean.parseBoolean(skipPostInstConfText)); + vnfResourceCustomization.setSkipPostInstConf( + Boolean.parseBoolean(getLeafPropertyValue(entityDetails, SKIP_POST_INST_CONF))); } + vnfResourceCustomization.setControllerActor(getLeafPropertyValue(entityDetails, CONTROLLER_ACTOR)); vnfResourceCustomization.setVnfResources(vnfResource); vnfResourceCustomization.setAvailabilityZoneMaxCount(Integer.getInteger( - vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT))); + entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT))); - CapabilityAssignments vnfCustomizationCapability = - toscaResourceStructure.getSdcCsarHelper().getCapabilitiesOf(vfNodeTemplate); + List<CapabilityAssignment> capAssignList = entityDetails.getCapabilities(); - if (vnfCustomizationCapability != null) { - CapabilityAssignment capAssign = vnfCustomizationCapability.getCapabilityByName(SCALABLE); + if (capAssignList != null) { - if (capAssign != null) { - vnfResourceCustomization.setMinInstances(Integer.getInteger(toscaResourceStructure.getSdcCsarHelper() - .getCapabilityPropertyLeafValue(capAssign, SdcPropertyNames.PROPERTY_NAME_MININSTANCES))); - vnfResourceCustomization.setMaxInstances(Integer.getInteger(toscaResourceStructure.getSdcCsarHelper() - .getCapabilityPropertyLeafValue(capAssign, SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES))); - } + for (CapabilityAssignment capAssign : capAssignList) { + + + if (capAssign != null) { + String capabilityName = capAssign.getName(); + + if (capabilityName.equalsIgnoreCase(SCALABLE)) { + vnfResourceCustomization.setMinInstances(Integer.getInteger( + getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_MININSTANCES))); + vnfResourceCustomization.setMaxInstances(Integer.getInteger( + getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES))); + } + } + + } } if (vnfResourceCustomization.getMinInstances() == null && vnfResourceCustomization.getMaxInstances() == null) { - vnfResourceCustomization.setMinInstances(Integer.getInteger(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_MININSTANCES))); - vnfResourceCustomization.setMaxInstances(Integer.getInteger(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfNodeTemplate, SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES))); + vnfResourceCustomization.setMinInstances(Integer + .getInteger(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_MININSTANCES))); + vnfResourceCustomization.setMaxInstances(Integer + .getInteger(getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES))); } toscaResourceStructure.setCatalogVnfResourceCustomization(vnfResourceCustomization); @@ -2483,44 +2631,44 @@ public class ToscaResourceInstaller { return vnfResourceCustomization; } - protected VnfResource createVnfResource(NodeTemplate vfNodeTemplate) { + protected VnfResource createVnfResource(IEntityDetails entityDetails) { VnfResource vnfResource = new VnfResource(); vnfResource.setModelInvariantUUID( - testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID))); - vnfResource.setModelName(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); - vnfResource.setModelUUID(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); + testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID))); + vnfResource.setModelName(testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); + vnfResource.setModelUUID(testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); vnfResource.setModelVersion( - testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); + testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); vnfResource.setDescription( - testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); + testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); vnfResource.setOrchestrationMode(HEAT); - vnfResource.setToscaNodeType(testNull(vfNodeTemplate.getType())); + vnfResource.setToscaNodeType(testNull(entityDetails.getToscaType())); vnfResource.setAicVersionMax( - testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES))); + testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES))); vnfResource.setAicVersionMin( - testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES))); - vnfResource.setCategory(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY)); - vnfResource.setSubCategory(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY)); + testNull(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES))); + vnfResource.setCategory(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY)); + vnfResource.setSubCategory(entityDetails.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY)); return vnfResource; } - protected AllottedResourceCustomization createAllottedResource(NodeTemplate nodeTemplate, + protected AllottedResourceCustomization createAllottedResource(IEntityDetails arEntity, ToscaResourceStructure toscaResourceStructure, Service service) { AllottedResourceCustomization allottedResourceCustomization = allottedCustomizationRepo.findOneByModelCustomizationUUID( - nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); if (allottedResourceCustomization == null) { AllottedResource allottedResource = findExistingAllottedResource(service, - nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); if (allottedResource == null) - allottedResource = createAR(nodeTemplate); + allottedResource = createAR(arEntity); toscaResourceStructure.setAllottedResource(allottedResource); - allottedResourceCustomization = createAllottedResourceCustomization(nodeTemplate, toscaResourceStructure); + allottedResourceCustomization = createAllottedResourceCustomization(arEntity, toscaResourceStructure); allottedResourceCustomization.setAllottedResource(allottedResource); allottedResource.getAllotedResourceCustomization().add(allottedResourceCustomization); } @@ -2541,73 +2689,80 @@ public class ToscaResourceInstaller { return allottedResource; } - protected AllottedResourceCustomization createAllottedResourceCustomization(NodeTemplate nodeTemplate, + protected AllottedResourceCustomization createAllottedResourceCustomization(IEntityDetails arEntity, ToscaResourceStructure toscaResourceStructure) { AllottedResourceCustomization allottedResourceCustomization = new AllottedResourceCustomization(); allottedResourceCustomization.setModelCustomizationUUID( - testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID))); - allottedResourceCustomization.setModelInstanceName(nodeTemplate.getName()); + testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID))); + allottedResourceCustomization.setModelInstanceName(arEntity.getName()); + + allottedResourceCustomization + .setNfFunction(getLeafPropertyValue(arEntity, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)); + allottedResourceCustomization.setNfNamingCode(getLeafPropertyValue(arEntity, "nf_naming_code")); + allottedResourceCustomization.setNfRole(getLeafPropertyValue(arEntity, SdcPropertyNames.PROPERTY_NAME_NFROLE)); + allottedResourceCustomization.setNfType(getLeafPropertyValue(arEntity, SdcPropertyNames.PROPERTY_NAME_NFTYPE)); + EntityQuery entityQuery = EntityQuery.newBuilder(SdcTypes.VFC).build(); - allottedResourceCustomization.setNfFunction(testNull(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION))); - allottedResourceCustomization.setNfNamingCode(testNull(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(nodeTemplate, "nf_naming_code"))); - allottedResourceCustomization.setNfRole(testNull(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE))); - allottedResourceCustomization.setNfType(testNull(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE))); + TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.VF) + .customizationUUID(allottedResourceCustomization.getModelCustomizationUUID()).build(); - List<NodeTemplate> vfcNodes = toscaResourceStructure.getSdcCsarHelper() - .getVfcListByVf(allottedResourceCustomization.getModelCustomizationUUID()); + List<IEntityDetails> vfcEntities = + toscaResourceStructure.getSdcCsarHelper().getEntity(entityQuery, topologyTemplateQuery, false); - if (vfcNodes != null) { - for (NodeTemplate vfcNode : vfcNodes) { - allottedResourceCustomization.setProvidingServiceModelUUID(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfcNode, "providing_service_uuid")); + if (vfcEntities != null) { + for (IEntityDetails vfcEntity : vfcEntities) { + + allottedResourceCustomization + .setProvidingServiceModelUUID(getLeafPropertyValue(vfcEntity, "providing_service_uuid")); + allottedResourceCustomization.setProvidingServiceModelInvariantUUID( + getLeafPropertyValue(vfcEntity, "providing_service_invariant_uuid")); allottedResourceCustomization - .setProvidingServiceModelInvariantUUID(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfcNode, "providing_service_invariant_uuid")); - allottedResourceCustomization.setProvidingServiceModelName(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(vfcNode, "providing_service_name")); + .setProvidingServiceModelName(getLeafPropertyValue(vfcEntity, "providing_service_name")); } } + List<CapabilityAssignment> capAssignmentList = arEntity.getCapabilities(); - CapabilityAssignments arCustomizationCapability = - toscaResourceStructure.getSdcCsarHelper().getCapabilitiesOf(nodeTemplate); + if (capAssignmentList != null) { - if (arCustomizationCapability != null) { - CapabilityAssignment capAssign = arCustomizationCapability.getCapabilityByName(SCALABLE); + for (CapabilityAssignment arCapability : capAssignmentList) { + + if (arCapability != null) { + + String capabilityName = arCapability.getName(); + + if (capabilityName.equals(SCALABLE)) { + + allottedResourceCustomization + .setMinInstances(Integer.getInteger(getCapabilityLeafPropertyValue(arCapability, + SdcPropertyNames.PROPERTY_NAME_MININSTANCES))); + allottedResourceCustomization + .setMinInstances(Integer.getInteger(getCapabilityLeafPropertyValue(arCapability, + SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES))); + + } + } - if (capAssign != null) { - allottedResourceCustomization.setMinInstances( - Integer.getInteger(toscaResourceStructure.getSdcCsarHelper().getCapabilityPropertyLeafValue( - capAssign, SdcPropertyNames.PROPERTY_NAME_MININSTANCES))); - allottedResourceCustomization.setMaxInstances( - Integer.getInteger(toscaResourceStructure.getSdcCsarHelper().getCapabilityPropertyLeafValue( - capAssign, SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES))); } } + return allottedResourceCustomization; } - protected AllottedResource createAR(NodeTemplate nodeTemplate) { + protected AllottedResource createAR(IEntityDetails arEntity) { AllottedResource allottedResource = new AllottedResource(); - allottedResource - .setModelUUID(testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); + allottedResource.setModelUUID(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); allottedResource.setModelInvariantUUID( - testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID))); + testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID))); + allottedResource.setModelName(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); allottedResource - .setModelName(testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); + .setModelVersion(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); + allottedResource.setToscaNodeType(testNull(arEntity.getToscaType())); allottedResource - .setModelVersion(testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); - allottedResource.setToscaNodeType(testNull(nodeTemplate.getType())); - allottedResource.setSubcategory( - testNull(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY))); - allottedResource - .setDescription(nodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); + .setSubcategory(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY))); + allottedResource.setDescription(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); return allottedResource; } @@ -2676,23 +2831,11 @@ public class ToscaResourceInstaller { + vfModuleStructure.getVfModuleMetadata().getVfModuleModelName(); } - protected List<IEntityDetails> getEntityDetails(ToscaResourceStructure toscaResourceStruct, SdcTypes entityType, - SdcTypes topologyTemplate, boolean nestedSearch) { - - EntityQuery entityQuery = EntityQuery.newBuilder(entityType).build(); - TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(topologyTemplate).build(); - List<IEntityDetails> entityDetails = - toscaResourceStruct.getSdcCsarHelper().getEntity(entityQuery, topologyTemplateQuery, nestedSearch); - - return entityDetails; - - } - - protected List<IEntityDetails> getEntityDetails(ToscaResourceStructure toscaResourceStruct, String entityType, - SdcTypes topologyTemplate, boolean nestedSearch) { + public List<IEntityDetails> getEntityDetails(ToscaResourceStructure toscaResourceStruct, + EntityQueryBuilder entityType, TopologyTemplateQueryBuilder topologyTemplateBuilder, boolean nestedSearch) { - EntityQuery entityQuery = EntityQuery.newBuilder(entityType).build(); - TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(topologyTemplate).build(); + EntityQuery entityQuery = entityType.build(); + TopologyTemplateQuery topologyTemplateQuery = topologyTemplateBuilder.build(); List<IEntityDetails> entityDetails = toscaResourceStruct.getSdcCsarHelper().getEntity(entityQuery, topologyTemplateQuery, nestedSearch); @@ -2700,21 +2843,20 @@ public class ToscaResourceInstaller { } - protected List<IEntityDetails> getEntityDetails(ToscaResourceStructure toscaResourceStruct, SdcTypes entityType, - TopologyTemplateQueryBuilder topologyTemplateBuilder, boolean nestedSearch) { + public String getLeafPropertyValue(IEntityDetails entityDetails, String propName) { - EntityQuery entityQuery = EntityQuery.newBuilder(entityType).build(); - TopologyTemplateQuery topologyTemplateQuery = topologyTemplateBuilder.build(); - List<IEntityDetails> entityDetails = - toscaResourceStruct.getSdcCsarHelper().getEntity(entityQuery, topologyTemplateQuery, nestedSearch); + Property leafProperty = entityDetails.getProperties().get(propName); - return entityDetails; + if (leafProperty != null && leafProperty.getValue() != null) { + return leafProperty.getValue().toString(); + } + return null; } - protected String getLeafPropertyValue(IEntityDetails entityDetails, String propName) { + protected String getCapabilityLeafPropertyValue(CapabilityAssignment capAssign, String propName) { - Property leafProperty = entityDetails.getProperties().get(propName); + Property leafProperty = capAssign.getProperties().get(propName); if (leafProperty != null && leafProperty.getValue() != null) { return leafProperty.getValue().toString(); @@ -2729,8 +2871,9 @@ public class ToscaResourceInstaller { if (propertyName != null) { int getInputIndex = propertyName.indexOf("{get_input="); + int getClosingIndex = propertyName.indexOf("}"); if (getInputIndex > -1) { - inputName = propertyName.substring(getInputIndex + 11, propertyName.length() - 1); + inputName = propertyName.substring(getInputIndex + 11, getClosingIndex); } } @@ -2744,10 +2887,18 @@ public class ToscaResourceInstaller { if (!services.isEmpty()) { // service exist in db Service existingService = services.get(0); - List<VnfResourceCustomization> vnfCustomizations = existingService.getVnfCustomizations(); - vnfCustomizations.forEach(e -> service.getVnfCustomizations().add(e)); + List<VnfResourceCustomization> existingVnfCustomizations = existingService.getVnfCustomizations(); + if (existingService != null) { + // it is duplicating entries, so added a check + for (VnfResourceCustomization existingVnfResourceCustomization : existingVnfCustomizations) { + if (!service.getVnfCustomizations().contains(existingVnfResourceCustomization)) { + service.getVnfCustomizations().add(existingVnfResourceCustomization); + } + } + } } service.getVnfCustomizations().add(vnfResourceCustomization); + } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java index a154734690..6908fe4eda 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java @@ -26,15 +26,16 @@ import java.util.Map; import org.onap.sdc.api.notification.IArtifactInfo; import org.onap.sdc.api.notification.INotificationData; import org.onap.sdc.api.notification.IResourceInstance; +import org.onap.sdc.tosca.parser.api.IEntityDetails; import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +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.Group; -import org.onap.sdc.toscaparser.api.NodeTemplate; import org.onap.sdc.toscaparser.api.elements.Metadata; import org.onap.so.asdc.installer.IVfModuleData; import org.onap.so.asdc.installer.ToscaResourceStructure; -import org.onap.so.db.catalog.beans.NetworkResourceCustomization; +import org.onap.so.asdc.installer.heat.ToscaResourceInstaller; public class ASDCNotificationLogging { @@ -63,7 +64,7 @@ public class ASDCNotificationLogging { return "NULL"; } - + ToscaResourceInstaller toscaResourceInstaller = new ToscaResourceInstaller(); StringBuilder buffer = new StringBuilder("CSAR Notification:"); buffer.append(System.lineSeparator()); buffer.append(System.lineSeparator()); @@ -103,33 +104,33 @@ public class ASDCNotificationLogging { buffer.append(System.lineSeparator()); - List<NodeTemplate> serviceProxyResourceList = - toscaResourceStructure.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.SERVICE_PROXY); + List<IEntityDetails> serviceProxyResourceList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(SdcTypes.SERVICE_PROXY), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), + true); + if (serviceProxyResourceList != null) { - for (NodeTemplate serviceProxyNodeTemplate : serviceProxyResourceList) { + for (IEntityDetails serviceProxyEntity : serviceProxyResourceList) { buffer.append(System.lineSeparator()); buffer.append(System.lineSeparator()); buffer.append("Service Proxy Properties:"); buffer.append(System.lineSeparator()); buffer.append("Model Name:"); - buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); + buffer.append(serviceProxyEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); buffer.append(System.lineSeparator()); buffer.append("Model UUID:"); - buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + buffer.append(serviceProxyEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); buffer.append(System.lineSeparator()); buffer.append("Description:"); - buffer.append( - serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); + buffer.append(serviceProxyEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); buffer.append(System.lineSeparator()); buffer.append("Version:"); - buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); + buffer.append(serviceProxyEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); buffer.append(System.lineSeparator()); buffer.append("InvariantUuid:"); - buffer.append( - serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + buffer.append(serviceProxyEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); buffer.append(System.lineSeparator()); buffer.append(System.lineSeparator()); @@ -138,31 +139,31 @@ public class ASDCNotificationLogging { buffer.append(System.lineSeparator()); buffer.append("Model Customization UUID:"); - buffer.append(serviceProxyNodeTemplate.getMetaData() - .getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + buffer.append( + serviceProxyEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); buffer.append(System.lineSeparator()); buffer.append("Model Instance Name:"); - buffer.append(serviceProxyNodeTemplate.getName()); + buffer.append(serviceProxyEntity.getName()); buffer.append(System.lineSeparator()); buffer.append("Tosca Node Type:"); - buffer.append(serviceProxyNodeTemplate.getType()); + buffer.append(serviceProxyEntity.getToscaType()); buffer.append(System.lineSeparator()); buffer.append("Version:"); - buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); + buffer.append(serviceProxyEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); buffer.append(System.lineSeparator()); buffer.append("InvariantUuid:"); - buffer.append( - serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + buffer.append(serviceProxyEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); buffer.append(System.lineSeparator()); } } - List<NodeTemplate> configurationNodeTemplatesList = - toscaResourceStructure.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CONFIGURATION); + List<IEntityDetails> configurationList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(SdcTypes.CONFIGURATION), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), + true); - if (configurationNodeTemplatesList != null) { - for (NodeTemplate configNodeTemplate : configurationNodeTemplatesList) { + if (configurationList != null) { + for (IEntityDetails configEntity : configurationList) { buffer.append(System.lineSeparator()); buffer.append(System.lineSeparator()); @@ -170,22 +171,22 @@ public class ASDCNotificationLogging { buffer.append(System.lineSeparator()); buffer.append("Model Name:"); - buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); + buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); buffer.append(System.lineSeparator()); buffer.append("Model UUID:"); - buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); buffer.append(System.lineSeparator()); buffer.append("Description:"); - buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); + buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); buffer.append(System.lineSeparator()); buffer.append("Version:"); - buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); + buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); buffer.append(System.lineSeparator()); buffer.append("InvariantUuid:"); - buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); buffer.append(System.lineSeparator()); buffer.append("Tosca Node Type:"); - buffer.append(configNodeTemplate.getType()); + buffer.append(configEntity.getToscaType()); buffer.append(System.lineSeparator()); buffer.append(System.lineSeparator()); @@ -193,62 +194,63 @@ public class ASDCNotificationLogging { buffer.append(System.lineSeparator()); buffer.append("Model Customization UUID:"); - buffer.append( - configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); buffer.append(System.lineSeparator()); buffer.append("Model Instance Name:"); - buffer.append(configNodeTemplate.getName()); + buffer.append(configEntity.getName()); buffer.append(System.lineSeparator()); buffer.append("NFFunction:"); - buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue( - configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)); + buffer.append(toscaResourceInstaller.getLeafPropertyValue(configEntity, + SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)); buffer.append(System.lineSeparator()); buffer.append("NFRole:"); - buffer.append(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE)); + buffer.append(toscaResourceInstaller.getLeafPropertyValue(configEntity, + SdcPropertyNames.PROPERTY_NAME_NFROLE)); buffer.append(System.lineSeparator()); buffer.append("NFType:"); - buffer.append(toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplatePropertyLeafValue(configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE)); + buffer.append(toscaResourceInstaller.getLeafPropertyValue(configEntity, + SdcPropertyNames.PROPERTY_NAME_NFTYPE)); buffer.append(System.lineSeparator()); } } - List<NodeTemplate> vfNodeTemplatesList = toscaResourceStructure.getSdcCsarHelper().getServiceVfList(); - for (NodeTemplate vfNodeTemplate : vfNodeTemplatesList) { + List<IEntityDetails> vfEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(SdcTypes.VF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); + + + for (IEntityDetails vfEntity : vfEntityList) { buffer.append(System.lineSeparator()); buffer.append(System.lineSeparator()); buffer.append("VNF Properties:"); buffer.append(System.lineSeparator()); buffer.append("Model Name:"); - buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); + buffer.append(testNull(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); buffer.append(System.lineSeparator()); buffer.append("Model UUID:"); - buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); + buffer.append(testNull(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); buffer.append(System.lineSeparator()); buffer.append("Description:"); - buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); + buffer.append(testNull(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); buffer.append(System.lineSeparator()); buffer.append("Version:"); - buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); + buffer.append(testNull(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); buffer.append(System.lineSeparator()); buffer.append("Type:"); - buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE))); + buffer.append(testNull(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE))); buffer.append(System.lineSeparator()); buffer.append("Category:"); - buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY))); + buffer.append(testNull(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY))); buffer.append(System.lineSeparator()); buffer.append("InvariantUuid:"); - buffer.append( - testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID))); + buffer.append(testNull(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID))); buffer.append(System.lineSeparator()); buffer.append("Max Instances:"); - buffer.append(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)); + buffer.append(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)); buffer.append(System.lineSeparator()); buffer.append("Min Instances:"); - buffer.append(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES)); + buffer.append(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES)); buffer.append(System.lineSeparator()); buffer.append(System.lineSeparator()); @@ -256,37 +258,35 @@ public class ASDCNotificationLogging { buffer.append(System.lineSeparator()); buffer.append("Customization UUID:"); - buffer.append( - testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID))); + buffer.append(testNull(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID))); buffer.append(System.lineSeparator()); buffer.append("NFFunction:"); - buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate, - SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)); + buffer.append( + toscaResourceInstaller.getLeafPropertyValue(vfEntity, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)); buffer.append(System.lineSeparator()); buffer.append("NFCode:"); - buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate, - "nf_naming_code")); + buffer.append(toscaResourceInstaller.getLeafPropertyValue(vfEntity, "nf_naming_code")); buffer.append(System.lineSeparator()); buffer.append("NFRole:"); - buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate, - SdcPropertyNames.PROPERTY_NAME_NFROLE)); + buffer.append(toscaResourceInstaller.getLeafPropertyValue(vfEntity, SdcPropertyNames.PROPERTY_NAME_NFROLE)); buffer.append(System.lineSeparator()); buffer.append("NFType:"); - buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate, - SdcPropertyNames.PROPERTY_NAME_NFTYPE)); + buffer.append(toscaResourceInstaller.getLeafPropertyValue(vfEntity, SdcPropertyNames.PROPERTY_NAME_NFTYPE)); buffer.append(System.lineSeparator()); buffer.append("MultiStageDesign:"); - buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate, - "multi_stage_design")); + buffer.append(toscaResourceInstaller.getLeafPropertyValue(vfEntity, "multi_stage_design")); buffer.append(System.lineSeparator()); - List<Group> groupList = - toscaResourceStructure.getSdcCsarHelper().getGroupsOfOriginOfNodeTemplateByToscaGroupType( - vfNodeTemplate, "org.openecomp.groups.VfcInstanceGroup"); - if (groupList != null) { - for (Group group : groupList) { - Metadata instanceMetadata = group.getMetadata(); + List<IEntityDetails> vfcInstanceEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder("org.openecomp.groups.VfcInstanceGroup"), + TopologyTemplateQuery.newBuilder(SdcTypes.VF) + .customizationUUID(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID), + false); + + if (vfcInstanceEntityList != null) { + for (IEntityDetails vfcEntity : vfcInstanceEntityList) { + Metadata instanceMetadata = vfcEntity.getMetadata(); buffer.append(System.lineSeparator()); buffer.append(System.lineSeparator()); @@ -300,7 +300,7 @@ public class ASDCNotificationLogging { buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); buffer.append(System.lineSeparator()); buffer.append("Type:"); - buffer.append(vfNodeTemplate.getType()); + buffer.append(vfcEntity.getToscaType()); buffer.append(System.lineSeparator()); buffer.append("InvariantUuid:"); buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); @@ -309,43 +309,43 @@ public class ASDCNotificationLogging { } + List<IEntityDetails> vfModuleEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder("org.openecomp.groups.VfModule"), + TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE) + .customizationUUID(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID), + false); - List<Group> vfGroups = toscaResourceStructure.getSdcCsarHelper().getVfModulesByVf( - testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID))); - for (Group group : vfGroups) { + for (IEntityDetails vfModuleEntity : vfModuleEntityList) { - Metadata vfMetadata = group.getMetadata(); + Metadata vfMetadata = vfModuleEntity.getMetadata(); buffer.append(System.lineSeparator()); buffer.append(System.lineSeparator()); buffer.append("VF Module Properties:"); buffer.append(System.lineSeparator()); buffer.append("ModelInvariantUuid:"); - buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, - SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID))); + buffer.append(testNull(vfMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID))); buffer.append(System.lineSeparator()); buffer.append("ModelName:"); - buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, - SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELNAME))); + buffer.append(testNull(vfMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELNAME))); buffer.append(System.lineSeparator()); buffer.append("ModelUuid:"); - buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, - SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID))); + buffer.append(testNull(vfMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID))); buffer.append(System.lineSeparator()); buffer.append("ModelVersion:"); - buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, - SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION))); + buffer.append(testNull(vfMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION))); buffer.append(System.lineSeparator()); buffer.append("Description:"); - buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, - SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); + buffer.append(testNull(vfMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); buffer.append(System.lineSeparator()); - List<NodeTemplate> groupMembers = - toscaResourceStructure.getSdcCsarHelper().getMembersOfVfModule(vfNodeTemplate, group); + List<IEntityDetails> groupMembers = toscaResourceInstaller.getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder("org.openecomp.groups.VfModule") + .uUID(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID), + TopologyTemplateQuery.newBuilder(SdcTypes.VF), false); - for (NodeTemplate node : groupMembers) { + for (IEntityDetails node : groupMembers) { buffer.append("Member Name:"); buffer.append(testNull(node.getName())); buffer.append(System.lineSeparator()); @@ -355,17 +355,18 @@ public class ASDCNotificationLogging { buffer.append("VF Module Customization Properties:"); buffer.append(System.lineSeparator()); buffer.append("Model Customization UUID:"); - buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata, + buffer.append(testNull(toscaResourceInstaller.getLeafPropertyValue(vfModuleEntity, SdcPropertyNames.PROPERTY_NAME_VFMODULECUSTOMIZATIONUUID))); buffer.append(System.lineSeparator()); } - List<NodeTemplate> vfConfigList = toscaResourceStructure.getSdcCsarHelper() - .getNodeTemplateBySdcType(vfNodeTemplate, SdcTypes.CONFIGURATION); + List<IEntityDetails> fabricEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(SdcTypes.CONFIGURATION), TopologyTemplateQuery.newBuilder(SdcTypes.VF), + false); - if (vfConfigList != null) { - for (NodeTemplate configNodeTemplate : vfConfigList) { + if (fabricEntityList != null) { + for (IEntityDetails configEntity : fabricEntityList) { buffer.append(System.lineSeparator()); buffer.append(System.lineSeparator()); @@ -373,24 +374,22 @@ public class ASDCNotificationLogging { buffer.append(System.lineSeparator()); buffer.append("Model Name:"); - buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); + buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); buffer.append(System.lineSeparator()); buffer.append("Model UUID:"); - buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); buffer.append(System.lineSeparator()); buffer.append("Description:"); - buffer.append( - configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); + buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); buffer.append(System.lineSeparator()); buffer.append("Version:"); - buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); + buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); buffer.append(System.lineSeparator()); buffer.append("InvariantUuid:"); - buffer.append( - configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); buffer.append(System.lineSeparator()); buffer.append("Tosca Node Type:"); - buffer.append(configNodeTemplate.getType()); + buffer.append(configEntity.getToscaType()); buffer.append(System.lineSeparator()); buffer.append(System.lineSeparator()); @@ -398,95 +397,96 @@ public class ASDCNotificationLogging { buffer.append(System.lineSeparator()); buffer.append("Model Customization UUID:"); - buffer.append(configNodeTemplate.getMetaData() - .getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + buffer.append( + configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); buffer.append(System.lineSeparator()); buffer.append("Model Instance Name:"); - buffer.append(configNodeTemplate.getName()); + buffer.append(configEntity.getName()); buffer.append(System.lineSeparator()); buffer.append("NFFunction:"); - buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue( - configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)); + buffer.append(toscaResourceInstaller.getLeafPropertyValue(configEntity, + SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)); buffer.append(System.lineSeparator()); buffer.append("NFRole:"); - buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue( - configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE)); + buffer.append(toscaResourceInstaller.getLeafPropertyValue(configEntity, + SdcPropertyNames.PROPERTY_NAME_NFROLE)); buffer.append(System.lineSeparator()); buffer.append("NFType:"); - buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue( - configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE)); + buffer.append(toscaResourceInstaller.getLeafPropertyValue(configEntity, + SdcPropertyNames.PROPERTY_NAME_NFTYPE)); buffer.append(System.lineSeparator()); } } - List<NodeTemplate> cvfcList = - toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(vfNodeTemplate, SdcTypes.CVFC); + List<IEntityDetails> cvnfcEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(SdcTypes.CVFC), TopologyTemplateQuery.newBuilder(SdcTypes.VF), false); - for (NodeTemplate cvfcTemplate : cvfcList) { + for (IEntityDetails cvnfcEntity : cvnfcEntityList) { buffer.append(System.lineSeparator()); buffer.append(System.lineSeparator()); buffer.append("CVNFC Properties:"); buffer.append(System.lineSeparator()); buffer.append("ModelCustomizationUuid:"); - buffer.append(testNull( - cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID))); + buffer.append( + testNull(cvnfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID))); buffer.append(System.lineSeparator()); buffer.append("ModelInvariantUuid:"); buffer.append( - testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID))); + testNull(cvnfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID))); buffer.append(System.lineSeparator()); buffer.append("ModelName:"); - buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); + buffer.append(testNull(cvnfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); buffer.append(System.lineSeparator()); buffer.append("ModelUuid:"); - buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); + buffer.append(testNull(cvnfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); buffer.append(System.lineSeparator()); buffer.append("ModelVersion:"); - buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); + buffer.append(testNull(cvnfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); buffer.append(System.lineSeparator()); buffer.append("Description:"); - buffer.append( - testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); + buffer.append(testNull(cvnfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); buffer.append(System.lineSeparator()); buffer.append("Template Name:"); - buffer.append(testNull(cvfcTemplate.getName())); + buffer.append(testNull(cvnfcEntity.getName())); buffer.append(System.lineSeparator()); + List<IEntityDetails> vfcEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(SdcTypes.VFC), + TopologyTemplateQuery.newBuilder(SdcTypes.CVFC).customizationUUID( + cvnfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)), + false); - List<NodeTemplate> vfcList = - toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(cvfcTemplate, SdcTypes.VFC); - - for (NodeTemplate vfcTemplate : vfcList) { + for (IEntityDetails vfcEntity : vfcEntityList) { buffer.append(System.lineSeparator()); buffer.append(System.lineSeparator()); buffer.append("VNFC Properties:"); buffer.append(System.lineSeparator()); buffer.append("ModelCustomizationUuid:"); buffer.append(testNull( - vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID))); + vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID))); buffer.append(System.lineSeparator()); buffer.append("ModelInvariantUuid:"); buffer.append( - testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID))); + testNull(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID))); buffer.append(System.lineSeparator()); buffer.append("ModelName:"); - buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); + buffer.append(testNull(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); buffer.append(System.lineSeparator()); buffer.append("ModelUuid:"); - buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); + buffer.append(testNull(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); buffer.append(System.lineSeparator()); buffer.append("ModelVersion:"); - buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); + buffer.append(testNull(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); buffer.append(System.lineSeparator()); buffer.append("Description:"); buffer.append( - testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); + testNull(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); buffer.append(System.lineSeparator()); buffer.append("Sub Category:"); buffer.append( - testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY))); + testNull(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY))); buffer.append(System.lineSeparator()); } @@ -495,41 +495,40 @@ public class ASDCNotificationLogging { } + List<IEntityDetails> vlEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(SdcTypes.VL), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); + if (vlEntityList != null) { - List<NodeTemplate> nodeTemplatesVLList = toscaResourceStructure.getSdcCsarHelper().getServiceVlList(); - - if (nodeTemplatesVLList != null) { - - for (NodeTemplate vlNode : nodeTemplatesVLList) { + for (IEntityDetails vlEntity : vlEntityList) { buffer.append(System.lineSeparator()); buffer.append(System.lineSeparator()); buffer.append("NETWORK Level Properties:"); buffer.append(System.lineSeparator()); buffer.append("Model Name:"); - buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); + buffer.append(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); buffer.append(System.lineSeparator()); buffer.append("Model InvariantUuid:"); - buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID))); + buffer.append(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID))); buffer.append(System.lineSeparator()); buffer.append("Model UUID:"); - buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); + buffer.append(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); buffer.append(System.lineSeparator()); buffer.append("Model Version:"); - buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); + buffer.append(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); buffer.append(System.lineSeparator()); buffer.append("AIC Max Version:"); - buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES))); + buffer.append(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES))); buffer.append(System.lineSeparator()); buffer.append("AIC Min Version:"); - buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES))); + buffer.append(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES))); buffer.append(System.lineSeparator()); buffer.append("Tosca Node Type:"); - buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE))); + buffer.append(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE))); buffer.append(System.lineSeparator()); buffer.append("Description:"); - buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); + buffer.append(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION))); buffer.append(System.lineSeparator()); @@ -537,22 +536,22 @@ public class ASDCNotificationLogging { buffer.append("NETWORK Customization Properties:"); buffer.append(System.lineSeparator()); buffer.append("CustomizationUUID:"); - buffer.append(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + buffer.append(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); buffer.append(System.lineSeparator()); buffer.append("Network Technology:"); - buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vlNode, + buffer.append(toscaResourceInstaller.getLeafPropertyValue(vlEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY)); buffer.append(System.lineSeparator()); buffer.append("Network Type:"); - buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vlNode, + buffer.append(toscaResourceInstaller.getLeafPropertyValue(vlEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE)); buffer.append(System.lineSeparator()); buffer.append("Network Role:"); - buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vlNode, + buffer.append(toscaResourceInstaller.getLeafPropertyValue(vlEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE)); buffer.append(System.lineSeparator()); buffer.append("Network Scope:"); - buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vlNode, + buffer.append(toscaResourceInstaller.getLeafPropertyValue(vlEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE)); buffer.append(System.lineSeparator()); @@ -560,52 +559,55 @@ public class ASDCNotificationLogging { } + List<IEntityDetails> crEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(SdcTypes.CR), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); - List<NodeTemplate> networkCollectionList = - toscaResourceStructure.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CR); - - if (networkCollectionList != null) { - for (NodeTemplate crNode : networkCollectionList) { + if (crEntityList != null) { + for (IEntityDetails crEntity : crEntityList) { buffer.append(System.lineSeparator()); buffer.append("Network Collection Properties:"); buffer.append(System.lineSeparator()); buffer.append("Model Name:"); - buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); + buffer.append(crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); buffer.append(System.lineSeparator()); buffer.append("Model UUID:"); - buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + buffer.append(crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + buffer.append(System.lineSeparator()); + buffer.append("Customization UUID:"); + buffer.append(crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); buffer.append(System.lineSeparator()); buffer.append("InvariantUuid:"); - buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + buffer.append(crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); buffer.append(System.lineSeparator()); buffer.append("Description:"); - buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); + buffer.append(crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); buffer.append(System.lineSeparator()); buffer.append("Version:"); - buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); + buffer.append(crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); buffer.append(System.lineSeparator()); buffer.append("Tosca Node Type:"); - buffer.append(crNode.getType()); + buffer.append(crEntity.getToscaType()); buffer.append(System.lineSeparator()); buffer.append("CR Function:"); - buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, - "cr_function")); + buffer.append(toscaResourceInstaller.getLeafPropertyValue(crEntity, "cr_function")); buffer.append(System.lineSeparator()); buffer.append("CR Role:"); - buffer.append( - toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, "cr_role")); + buffer.append(toscaResourceInstaller.getLeafPropertyValue(crEntity, "cr_role")); buffer.append(System.lineSeparator()); buffer.append("CR Type:"); - buffer.append( - toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, "cr_type")); + buffer.append(toscaResourceInstaller.getLeafPropertyValue(crEntity, "cr_type")); buffer.append(System.lineSeparator()); - List<NodeTemplate> vlNodeList = - toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(crNode, SdcTypes.VL); + List<IEntityDetails> networkEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(SdcTypes.VL), + TopologyTemplateQuery.newBuilder(SdcTypes.CR).customizationUUID( + crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)), + false); - for (NodeTemplate vlNodeTemplate : vlNodeList) { - Metadata vlMetadata = vlNodeTemplate.getMetaData(); + for (IEntityDetails vlEntity : networkEntityList) { + + Metadata vlMetadata = vlEntity.getMetadata(); buffer.append(System.lineSeparator()); buffer.append(System.lineSeparator()); @@ -631,19 +633,20 @@ public class ASDCNotificationLogging { buffer.append(vlMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); buffer.append(System.lineSeparator()); buffer.append("Tosca Node Type:"); - buffer.append(vlNodeTemplate.getType()); + buffer.append(vlEntity.getToscaType()); buffer.append(System.lineSeparator()); } + List<IEntityDetails> ncEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder("org.openecomp.groups.NetworkCollection"), + TopologyTemplateQuery.newBuilder(SdcTypes.CR).customizationUUID( + crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)), + false); - List<Group> groupList = - toscaResourceStructure.getSdcCsarHelper().getGroupsOfOriginOfNodeTemplateByToscaGroupType( - crNode, "org.openecomp.groups.NetworkCollection"); - - if (groupList != null) { - for (Group group : groupList) { - Metadata instanceMetadata = group.getMetadata(); + if (ncEntityList != null) { + for (IEntityDetails ncEntity : ncEntityList) { + Metadata instanceMetadata = ncEntity.getMetadata(); buffer.append(System.lineSeparator()); buffer.append(System.lineSeparator()); buffer.append("Network Instance Group Properties:"); @@ -670,93 +673,179 @@ public class ASDCNotificationLogging { buffer.append(System.lineSeparator()); buffer.append("Model Customization UUID:"); - buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + buffer.append(crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); buffer.append(System.lineSeparator()); buffer.append("Model Instance Name:"); - buffer.append(crNode.getName()); + buffer.append(crEntity.getName()); buffer.append(System.lineSeparator()); buffer.append("Network Scope:"); - buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, + buffer.append(toscaResourceInstaller.getLeafPropertyValue(crEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE)); buffer.append(System.lineSeparator()); buffer.append("Network Role:"); - buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, + buffer.append(toscaResourceInstaller.getLeafPropertyValue(crEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE)); buffer.append(System.lineSeparator()); buffer.append("Network Type:"); - buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, + buffer.append(toscaResourceInstaller.getLeafPropertyValue(crEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE)); buffer.append(System.lineSeparator()); buffer.append("Network Technology:"); - buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, + buffer.append(toscaResourceInstaller.getLeafPropertyValue(crEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY)); buffer.append(System.lineSeparator()); } } - List<NodeTemplate> allottedResourceList = toscaResourceStructure.getSdcCsarHelper().getAllottedResources(); + List<IEntityDetails> arEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(SdcTypes.VF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); - if (allottedResourceList != null) { + if (arEntityList != null) { buffer.append(System.lineSeparator()); - buffer.append("Allotted Resource Properties:"); + buffer.append("VF Allotted Resource Properties:"); buffer.append(System.lineSeparator()); - for (NodeTemplate allottedNode : allottedResourceList) { + for (IEntityDetails arEntity : arEntityList) { - buffer.append("Model Name:"); - buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); - buffer.append(System.lineSeparator()); - buffer.append("Model Name:"); - buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); - buffer.append(System.lineSeparator()); - buffer.append("Model InvariantUuid:"); - buffer.append( - testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID))); - buffer.append(System.lineSeparator()); - buffer.append("Model Version:"); - buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); - buffer.append(System.lineSeparator()); - buffer.append("Model UUID:"); - buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); - buffer.append(System.lineSeparator()); - buffer.append("Model Subcategory:"); - buffer.append(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY)); - buffer.append(System.lineSeparator()); - buffer.append("Model Description:"); - buffer.append(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); - buffer.append(System.lineSeparator()); + Metadata metadata = arEntity.getMetadata(); + String category = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY); + if ("Allotted Resource".equalsIgnoreCase(category)) { - buffer.append("Allotted Resource Customization Properties:"); - buffer.append(System.lineSeparator()); + buffer.append(System.lineSeparator()); + buffer.append("Allotted Resource Properties:"); + buffer.append(System.lineSeparator()); + buffer.append("Model Name:"); + buffer.append(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); + buffer.append(System.lineSeparator()); + buffer.append("Model Name:"); + buffer.append(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); + buffer.append(System.lineSeparator()); + buffer.append("Model InvariantUuid:"); + buffer.append( + testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID))); + buffer.append(System.lineSeparator()); + buffer.append("Model Version:"); + buffer.append(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); + buffer.append(System.lineSeparator()); + buffer.append("Model UUID:"); + buffer.append(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); + buffer.append(System.lineSeparator()); + buffer.append("Model Subcategory:"); + buffer.append(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY)); + buffer.append(System.lineSeparator()); + buffer.append("Model Category:"); + buffer.append(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY)); + buffer.append(System.lineSeparator()); + buffer.append("Model Description:"); + buffer.append(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); + buffer.append(System.lineSeparator()); + buffer.append(System.lineSeparator()); - buffer.append("Model Cutomization UUID:"); - buffer.append(testNull( - allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID))); - buffer.append(System.lineSeparator()); - buffer.append("NFFunction:"); - buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(allottedNode, - SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)); - buffer.append(System.lineSeparator()); - buffer.append("NFCode:"); - buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(allottedNode, - "nf_naming_code")); - buffer.append(System.lineSeparator()); - buffer.append("NFRole:"); - buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(allottedNode, - SdcPropertyNames.PROPERTY_NAME_NFROLE)); - buffer.append(System.lineSeparator()); - buffer.append("NFType:"); - buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(allottedNode, - SdcPropertyNames.PROPERTY_NAME_NFTYPE)); - buffer.append(System.lineSeparator()); + buffer.append("Allotted Resource Customization Properties:"); + buffer.append(System.lineSeparator()); + + buffer.append("Model Cutomization UUID:"); + buffer.append(testNull( + arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID))); + buffer.append(System.lineSeparator()); + buffer.append("NFFunction:"); + buffer.append(toscaResourceInstaller.getLeafPropertyValue(arEntity, + SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)); + buffer.append(System.lineSeparator()); + buffer.append("NFCode:"); + buffer.append(toscaResourceInstaller.getLeafPropertyValue(arEntity, "nf_naming_code")); + buffer.append(System.lineSeparator()); + buffer.append("NFRole:"); + buffer.append(toscaResourceInstaller.getLeafPropertyValue(arEntity, + SdcPropertyNames.PROPERTY_NAME_NFROLE)); + buffer.append(System.lineSeparator()); + buffer.append("NFType:"); + buffer.append(toscaResourceInstaller.getLeafPropertyValue(arEntity, + SdcPropertyNames.PROPERTY_NAME_NFTYPE)); + buffer.append(System.lineSeparator()); + } } } + List<IEntityDetails> pnfAREntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(SdcTypes.PNF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false); + + if (pnfAREntityList != null) { + + buffer.append(System.lineSeparator()); + buffer.append("PNF Allotted Resource Properties:"); + buffer.append(System.lineSeparator()); + + for (IEntityDetails pnfAREntity : pnfAREntityList) { + + Metadata metadata = pnfAREntity.getMetadata(); + String category = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY); + + if ("Allotted Resource".equalsIgnoreCase(category)) { + + buffer.append(System.lineSeparator()); + buffer.append("Allotted Resource Properties:"); + buffer.append(System.lineSeparator()); + buffer.append("Model Name:"); + buffer.append(testNull(pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); + buffer.append(System.lineSeparator()); + buffer.append("Model Name:"); + buffer.append(testNull(pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME))); + buffer.append(System.lineSeparator()); + buffer.append("Model InvariantUuid:"); + buffer.append( + testNull(pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID))); + buffer.append(System.lineSeparator()); + buffer.append("Model Version:"); + buffer.append(testNull(pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION))); + buffer.append(System.lineSeparator()); + buffer.append("Model UUID:"); + buffer.append(testNull(pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID))); + buffer.append(System.lineSeparator()); + buffer.append("Model Subcategory:"); + buffer.append(pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY)); + buffer.append(System.lineSeparator()); + buffer.append("Model Category:"); + buffer.append(pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY)); + buffer.append(System.lineSeparator()); + buffer.append("Model Description:"); + buffer.append(pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); + buffer.append(System.lineSeparator()); + buffer.append(System.lineSeparator()); + + buffer.append("Allotted Resource Customization Properties:"); + buffer.append(System.lineSeparator()); + + buffer.append("Model Cutomization UUID:"); + buffer.append(testNull( + pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID))); + buffer.append(System.lineSeparator()); + buffer.append("NFFunction:"); + buffer.append(toscaResourceInstaller.getLeafPropertyValue(pnfAREntity, + SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)); + buffer.append(System.lineSeparator()); + buffer.append("NFCode:"); + buffer.append(toscaResourceInstaller.getLeafPropertyValue(pnfAREntity, "nf_naming_code")); + buffer.append(System.lineSeparator()); + buffer.append("NFRole:"); + buffer.append(toscaResourceInstaller.getLeafPropertyValue(pnfAREntity, + SdcPropertyNames.PROPERTY_NAME_NFROLE)); + buffer.append(System.lineSeparator()); + buffer.append("NFType:"); + buffer.append(toscaResourceInstaller.getLeafPropertyValue(pnfAREntity, + SdcPropertyNames.PROPERTY_NAME_NFTYPE)); + buffer.append(System.lineSeparator()); + } + + } + } + + return buffer.toString(); } diff --git a/asdc-controller/src/main/resources/application-aaf.yaml b/asdc-controller/src/main/resources/application-aaf.yaml new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/asdc-controller/src/main/resources/application-aaf.yaml diff --git a/asdc-controller/src/main/resources/application-basic.yaml b/asdc-controller/src/main/resources/application-basic.yaml new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/asdc-controller/src/main/resources/application-basic.yaml diff --git a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java index 81977da278..75ab089719 100644 --- a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java +++ b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java @@ -22,11 +22,16 @@ package org.onap.asdc.activity; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.putRequestedFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; +import static com.github.tomakehurst.wiremock.client.WireMock.verify; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.when; import org.junit.Test; +import org.mockito.InjectMocks; import org.mockito.Mock; +import org.mockito.Spy; import org.onap.so.asdc.BaseTest; import org.onap.so.asdc.activity.DeployActivitySpecs; import org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse; @@ -47,6 +52,10 @@ public class DeployActivitySpecsITTest extends BaseTest { @Autowired private DeployActivitySpecs deployActivitySpecs; + @InjectMocks + @Spy + DeployActivitySpecs deployActivitySpecsM; + @Test public void deployActivitySpecsIT_Test() throws Exception { ActivitySpecCreateResponse activitySpecCreateResponse = new ActivitySpecCreateResponse(); @@ -73,4 +82,34 @@ public class DeployActivitySpecsITTest extends BaseTest { deployActivitySpecs.deployActivities(); assertTrue(activitySpecCreateResponse.getId().equals("testActivityId")); } + + @Test + public void deployActivitySpecsIT_SDCEndpointDown_Test() throws Exception { + ActivitySpecCreateResponse activitySpecCreateResponse = new ActivitySpecCreateResponse(); + activitySpecCreateResponse.setId("testActivityId"); + HttpHeaders headers = new HttpHeaders(); + headers.set("Accept", MediaType.APPLICATION_JSON); + headers.set("Content-Type", MediaType.APPLICATION_JSON); + + ObjectMapper mapper = new ObjectMapper(); + String body = mapper.writeValueAsString(activitySpecCreateResponse); + + wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.OK.value()).withBody(body))); + + when(env.getProperty("mso.asdc.config.activity.endpoint")).thenReturn("http://localhost:8090"); + + String urlPath = "/v1.0/activity-spec/testActivityId/versions/latest/actions"; + + wireMockServer.stubFor( + put(urlPathMatching(urlPath)).willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.OK.value()))); + + String host = "http://localhost:8090"; + when(deployActivitySpecsM.checkHttpServerUp(host)).thenReturn(false); + deployActivitySpecsM.deployActivities(); + verify(0, putRequestedFor(urlEqualTo(urlPath))); + } + } diff --git a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java index aae5e5dc53..6d88ab6630 100644 --- a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java +++ b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java @@ -30,6 +30,7 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; +import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.asdc.activity.ActivitySpecsActions; import org.onap.so.asdc.activity.DeployActivitySpecs; @@ -54,6 +55,7 @@ public class DeployActivitySpecsTest { protected ActivitySpecsActions activitySpecsActions; @InjectMocks + @Spy private DeployActivitySpecs deployActivitySpecs; @Test @@ -68,7 +70,8 @@ public class DeployActivitySpecsTest { List<org.onap.so.db.catalog.beans.ActivitySpec> catalogActivitySpecList = new ArrayList<org.onap.so.db.catalog.beans.ActivitySpec>(); catalogActivitySpecList.add(catalogActivitySpec); - when(env.getProperty("mso.asdc.config.activity.endpoint")).thenReturn("testEndpoint"); + when(env.getProperty("mso.asdc.config.activity.endpoint")).thenReturn("http://testEndpoint"); + doReturn(true).when(deployActivitySpecs).checkHttpServerUp("http://testEndpoint"); when(activitySpecRepository.findAll()).thenReturn(catalogActivitySpecList); doReturn("testActivityId").when(activitySpecsActions).createActivitySpec(Mockito.any(), Mockito.any()); doReturn(true).when(activitySpecsActions).certifyActivitySpec(Mockito.any(), Mockito.any()); diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/TestApplication.java b/asdc-controller/src/test/java/org/onap/so/asdc/TestApplication.java index c35e8e34d6..e25de9c3d4 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/TestApplication.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/TestApplication.java @@ -31,7 +31,7 @@ import org.springframework.context.annotation.Profile; @SpringBootApplication @Profile("test") -@ComponentScan(basePackages = {"org.onap.so.asdc"}, +@ComponentScan(basePackages = {"org.onap.so.asdc", "org.onap.so.security"}, excludeFilters = {@Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class), @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class), @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class)}) diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java index 0681cd8aed..3db017cac5 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java @@ -1,15 +1,20 @@ -/* - * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix - * Foundation. ================================================================================ Licensed under the - * Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may - * obtain a copy of the License at +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix + * ================================================================================ + * 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. + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. * - * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END========================================================= + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= */ package org.onap.so.asdc.client; @@ -20,6 +25,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.util.ArrayList; import java.util.Collections; @@ -29,10 +35,10 @@ import java.util.UUID; import javax.persistence.EntityNotFoundException; import org.junit.After; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; +import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.asdc.BaseTest; import org.onap.so.asdc.client.exceptions.ASDCControllerException; import org.onap.so.asdc.client.test.emulators.ArtifactInfoImpl; @@ -55,6 +61,7 @@ import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus; import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; @@ -62,7 +69,10 @@ import org.springframework.transaction.annotation.Transactional; * This is used to run some basic integration test(BIT) for ASDC controller. It will test the csar install and all the * testing csar files are located underneath src/main/resources/download folder, * - * PNF csar: service-Testservice140-csar.csar VNF csar: service-Svc140-VF-csar.csar + * PNF csar: service-pnfservice.csar VNF csar: service-Svc140-VF-csar.csar + * + * All the csar files are cleaned, i.e, removing the comments and most of the description to avoid violation of + * security. */ @Transactional public class ASDCControllerITTest extends BaseTest { @@ -139,23 +149,23 @@ public class ASDCControllerITTest extends BaseTest { * Mock the AAI using wireshark. */ private void initMockAaiServer(final String serviceUuid, final String serviceInvariantUuid) { - String modelEndpoint = "/aai/v15/service-design-and-creation/models/model/" + serviceInvariantUuid + String modelEndpoint = "/aai/v17/service-design-and-creation/models/model/" + serviceInvariantUuid + "/model-vers/model-ver/" + serviceUuid + "?depth=0"; wireMockServer.stubFor(post(urlEqualTo(modelEndpoint)).willReturn(ok())); } /** - * Test with service-Testservice140-csar.csar. + * Test with service-pnfservice.csar. */ @Test public void treatNotification_ValidPnfResource_ExpectedOutput() { /** - * service UUID/invariantUUID from global metadata in service-Testservice140-template.yml. + * service UUID/invariantUUID from global metadata in service-PnfServiceTestCds-template.yml. */ - String serviceUuid = "efaea486-561f-4159-9191-a8d3cb346728"; - String serviceInvariantUuid = "f2edfbf4-bb0a-4fe7-a57a-71362d4b0b23"; + String serviceUuid = "77cf276e-905c-43f6-8d54-dda474be2f2e"; + String serviceInvariantUuid = "913e6776-4bc3-49b9-b399-b5bb4690f0c7"; initMockAaiServer(serviceUuid, serviceInvariantUuid); @@ -177,6 +187,7 @@ public class ASDCControllerITTest extends BaseTest { try { asdcController.treatNotification(notificationData); + logger.info("Checking the database for PNF ingestion"); /** @@ -185,11 +196,11 @@ public class ASDCControllerITTest extends BaseTest { ToscaCsar toscaCsar = toscaCsarRepository.findById(artifactUuid) .orElseThrow(() -> new EntityNotFoundException("Tosca csar: " + artifactUuid + " not found")); assertEquals("tosca csar UUID", artifactUuid, toscaCsar.getArtifactUUID()); - assertEquals("tosca csar name", "service-Testservice140-csar.csar", toscaCsar.getName()); + assertEquals("tosca csar name", "service-pnfservice.csar", toscaCsar.getName()); assertEquals("tosca csar version", "1.0", toscaCsar.getVersion()); assertNull("tosca csar descrption", toscaCsar.getDescription()); assertEquals("tosca csar checksum", "MANUAL_RECORD", toscaCsar.getArtifactChecksum()); - assertEquals("toscar csar URL", "/download/service-Testservice140-csar.csar", toscaCsar.getUrl()); + assertEquals("toscar csar URL", "/download/service-pnfservice.csar", toscaCsar.getUrl()); /** * Check the service entity, it should be the same as global metadata information in @@ -197,49 +208,50 @@ public class ASDCControllerITTest extends BaseTest { */ Service service = serviceRepository.findById(serviceUuid) .orElseThrow(() -> new EntityNotFoundException("Service: " + serviceUuid + " not found")); - assertEquals("model UUID", "efaea486-561f-4159-9191-a8d3cb346728", service.getModelUUID()); - assertEquals("model name", "TestService140", service.getModelName()); - assertEquals("model invariantUUID", "f2edfbf4-bb0a-4fe7-a57a-71362d4b0b23", - service.getModelInvariantUUID()); + assertEquals("model UUID", serviceUuid, service.getModelUUID()); + assertEquals("model name", "PNF Service Test CDS", service.getModelName()); + assertEquals("model invariantUUID", serviceInvariantUuid, service.getModelInvariantUUID()); assertEquals("model version", "1.0", service.getModelVersion()); - assertEquals("description", "Test Service for extended attributes of PNF resource", - service.getDescription().trim()); + assertEquals("description", "123123", service.getDescription().trim()); assertEquals("tosca csar artifact UUID", artifactUuid, service.getCsar().getArtifactUUID()); - assertEquals("service type", "Network", service.getServiceType()); - assertEquals("service role", "nfv", service.getServiceRole()); + assertEquals("service type", "", service.getServiceType()); + assertEquals("service role", "", service.getServiceRole()); assertEquals("environment context", "General_Revenue-Bearing", service.getEnvironmentContext()); - assertEquals("service category", "Network Service", service.getCategory()); + assertEquals("service category", "Network L1-3", service.getCategory()); assertNull("workload context", service.getWorkloadContext()); - assertEquals("resource order", "Test140PNF", service.getResourceOrder()); + assertEquals("resource order", "PNF CDS Test", service.getResourceOrder()); + assertEquals("CDS blueprint name", "Blueprint140", service.getBlueprintName()); + assertEquals("CDS blueprint version", "v1.4.0", service.getBlueprintVersion()); + assertEquals("controller actor", "SO-REF-DATA", service.getControllerActor()); /** * Check PNF resource, it should be the same as metadata in the topology template in - * service-Testservice140-template.yml OR global metadata in the resource-Test140pnf-template.yml + * service-PnfServiceTestCds-template.yml OR global metadata in the resource-PnfServiceTestCds-template.yml */ - String pnfResourceKey = "9c54e269-122b-4e8a-8b2a-6eac849b441a"; + String pnfResourceKey = "aa5d0562-80e7-43e9-af74-3085e57ab09f"; PnfResource pnfResource = pnfResourceRepository.findById(pnfResourceKey) .orElseThrow(() -> new EntityNotFoundException("PNF resource:" + pnfResourceKey + " not found")); assertNull("orchestration mode", pnfResource.getOrchestrationMode()); - assertEquals("Description", "Oracle", pnfResource.getDescription().trim()); + assertEquals("Description", "123123", pnfResource.getDescription().trim()); assertEquals("model UUID", pnfResourceKey, pnfResource.getModelUUID()); - assertEquals("model invariant UUID", "d832a027-75f3-455d-9de4-f02fcdee7e7e", + assertEquals("model invariant UUID", "17d9d183-cee5-4a46-b5c4-6d5203f7d2e8", pnfResource.getModelInvariantUUID()); assertEquals("model version", "1.0", pnfResource.getModelVersion()); - assertEquals("model name", "Test140PNF", pnfResource.getModelName()); - assertEquals("tosca node type", "org.openecomp.resource.pnf.Test140pnf", pnfResource.getToscaNodeType()); + assertEquals("model name", "PNF CDS Test", pnfResource.getModelName()); + assertEquals("tosca node type", "org.openecomp.resource.pnf.PnfCdsTest", pnfResource.getToscaNodeType()); assertEquals("resource category", "Application L4+", pnfResource.getCategory()); - assertEquals("resource sub category", "Call Control", pnfResource.getSubCategory()); + assertEquals("resource sub category", "Firewall", pnfResource.getSubCategory()); /** * Check PNF resource customization, it should be the same as metadata in the topology template in - * service-Testservice140-template.yml OR global metadata in the resource-Test140pnf-template.yml + * service-PnfServiceTestCds-template.yml OR global metadata in the resource-PnfServiceTestCds-template.yml */ - String pnfCustomizationKey = "428a3d73-f962-4cc2-ba62-2483c45d6b12"; + String pnfCustomizationKey = "9f01263a-eaf7-4d98-a37b-3785f751903e"; PnfResourceCustomization pnfCustomization = pnfCustomizationRepository.findById(pnfCustomizationKey) .orElseThrow(() -> new EntityNotFoundException( "PNF resource customization: " + pnfCustomizationKey + " not found")); assertEquals("model customizationUUID", pnfCustomizationKey, pnfCustomization.getModelCustomizationUUID()); - assertEquals("model instance name", "Test140PNF 0", pnfCustomization.getModelInstanceName()); + assertEquals("model instance name", "PNF CDS Test 0", pnfCustomization.getModelInstanceName()); assertEquals("NF type", "", pnfCustomization.getNfType()); assertEquals("NF Role", "nf", pnfCustomization.getNfRole()); assertEquals("NF function", "nf", pnfCustomization.getNfFunction()); @@ -247,10 +259,12 @@ public class ASDCControllerITTest extends BaseTest { assertEquals("PNF resource model UUID", pnfResourceKey, pnfCustomization.getPnfResources().getModelUUID()); assertEquals("Multi stage design", "", pnfCustomization.getMultiStageDesign()); assertNull("resource input", pnfCustomization.getResourceInput()); - assertEquals("cds blueprint name(sdnc_model_name property)", pnfCustomization.getBlueprintName(), + assertEquals("cds blueprint name(sdnc_model_name property)", "Blueprint140", pnfCustomization.getBlueprintName()); - assertEquals("cds blueprint version(sdnc_model_version property)", pnfCustomization.getBlueprintVersion(), + assertEquals("cds blueprint version(sdnc_model_version property)", "v1.4.0", pnfCustomization.getBlueprintVersion()); + assertTrue("skip post instantiation configuration", pnfCustomization.isSkipPostInstConf()); + assertEquals("controller actor", "SO-REF-DATA", pnfCustomization.getControllerActor()); /** * Check the pnf resource customization with service mapping @@ -277,11 +291,40 @@ public class ASDCControllerITTest extends BaseTest { } } + /** + * Test to check RequestId is being set using the DistributionID. + */ + @Test + public void treatNotification_verifyRequestID() { + + String serviceUuid = "efaea486-561f-4159-9191-a8d3cb346728"; + String serviceInvariantUuid = "f2edfbf4-bb0a-4fe7-a57a-71362d4b0b23"; + distributionId = "bb15de12-166d-4e45-9e5f-4b3f25200d7b"; + + initMockAaiServer(serviceUuid, serviceInvariantUuid); + + NotificationDataImpl notificationData = new NotificationDataImpl(); + notificationData.setServiceUUID(serviceUuid); + notificationData.setDistributionID(distributionId); + notificationData.setServiceInvariantUUID(serviceInvariantUuid); + notificationData.setServiceVersion("1.0"); + + try { + asdcController.treatNotification(notificationData); + logger.info("Verify RequestId : {}", MDC.get(ONAPLogConstants.MDCs.REQUEST_ID)); + assertEquals("bb15de12-166d-4e45-9e5f-4b3f25200d7b", MDC.get(ONAPLogConstants.MDCs.REQUEST_ID)); + + } catch (Exception e) { + logger.info(e.getMessage(), e); + fail(e.getMessage()); + } + } + private ArtifactInfoImpl constructPnfServiceArtifact() { ArtifactInfoImpl artifactInfo = new ArtifactInfoImpl(); artifactInfo.setArtifactType(ASDCConfiguration.TOSCA_CSAR); - artifactInfo.setArtifactURL("/download/service-Testservice140-csar.csar"); - artifactInfo.setArtifactName("service-Testservice140-csar.csar"); + artifactInfo.setArtifactURL("/download/service-pnfservice.csar"); + artifactInfo.setArtifactName("service-pnfservice.csar"); artifactInfo.setArtifactVersion("1.0"); artifactInfo.setArtifactUUID(artifactUuid); return artifactInfo; @@ -293,13 +336,13 @@ public class ASDCControllerITTest extends BaseTest { */ private ResourceInfoImpl constructPnfResourceInfo() { ResourceInfoImpl resourceInfo = new ResourceInfoImpl(); - resourceInfo.setResourceInstanceName("Test140PNF"); - resourceInfo.setResourceInvariantUUID("d832a027-75f3-455d-9de4-f02fcdee7e7e"); + resourceInfo.setResourceInstanceName("PNF CDS Test"); + resourceInfo.setResourceInvariantUUID("17d9d183-cee5-4a46-b5c4-6d5203f7d2e8"); resourceInfo.setResoucreType("PNF"); resourceInfo.setCategory("Application L4+"); - resourceInfo.setSubcategory("Call Control"); - resourceInfo.setResourceUUID("9c54e269-122b-4e8a-8b2a-6eac849b441a"); - resourceInfo.setResourceCustomizationUUID("428a3d73-f962-4cc2-ba62-2483c45d6b12"); + resourceInfo.setSubcategory("Firewall"); + resourceInfo.setResourceUUID("aa5d0562-80e7-43e9-af74-3085e57ab09f"); + resourceInfo.setResourceCustomizationUUID("9f01263a-eaf7-4d98-a37b-3785f751903e"); resourceInfo.setResourceVersion("1.0"); return resourceInfo; } @@ -308,7 +351,6 @@ public class ASDCControllerITTest extends BaseTest { * Testing with the service-Svc140-VF-csar.csar. */ @Test - @Ignore public void treatNotification_ValidVnfResource_ExpectedOutput() { /** @@ -345,11 +387,11 @@ public class ASDCControllerITTest extends BaseTest { ToscaCsar toscaCsar = toscaCsarRepository.findById(artifactUuid) .orElseThrow(() -> new EntityNotFoundException("Tosca csar: " + artifactUuid + " not found")); assertEquals("tosca csar UUID", artifactUuid, toscaCsar.getArtifactUUID()); - assertEquals("tosca csar name", "service-Svc140-VF-csar.csar", toscaCsar.getName()); + assertEquals("tosca csar name", "service-vnfservice.csar", toscaCsar.getName()); assertEquals("tosca csar version", "1.0", toscaCsar.getVersion()); assertNull("tosca csar descrption", toscaCsar.getDescription()); assertEquals("tosca csar checksum", "MANUAL_RECORD", toscaCsar.getArtifactChecksum()); - assertEquals("toscar csar URL", "/download/service-Svc140-VF-csar.csar", toscaCsar.getUrl()); + assertEquals("toscar csar URL", "/download/service-vnfservice.csar", toscaCsar.getUrl()); /** * Check the service entity, it should be the same as global metadata information in @@ -369,6 +411,9 @@ public class ASDCControllerITTest extends BaseTest { assertEquals("service category", "Network Service", service.getCategory()); assertNull("workload context", service.getWorkloadContext()); assertEquals("resource order", "TestVF140", service.getResourceOrder()); + assertEquals("CDS blueprint name", "BP140", service.getBlueprintName()); + assertEquals("CDS blueprint version", "v1.4.0", service.getBlueprintVersion()); + assertEquals("controller actor", "SO-REF-DATA", service.getControllerActor()); /** * Check VNF resource, it should be the same as metadata in the topology template in @@ -405,11 +450,12 @@ public class ASDCControllerITTest extends BaseTest { assertNull("NF naming code", vnfCustomization.getNfNamingCode()); assertEquals("VNF resource model UUID", vnfResourceKey, vnfCustomization.getVnfResources().getModelUUID()); assertEquals("Multi stage design", "false", vnfCustomization.getMultiStageDesign()); - assertNull("resource input", vnfCustomization.getResourceInput()); - assertEquals("cds blueprint name(sdnc_model_name property)", vnfCustomization.getBlueprintName(), - vnfCustomization.getBlueprintName()); - assertEquals("cds blueprint version(sdnc_model_version property)", vnfCustomization.getBlueprintVersion(), + assertNotNull("resource input", vnfCustomization.getResourceInput()); + assertEquals("cds blueprint name(sdnc_model_name property)", "BP140", vnfCustomization.getBlueprintName()); + assertEquals("cds blueprint version(sdnc_model_version property)", "v1.4.0", vnfCustomization.getBlueprintVersion()); + assertEquals("controller actor", "SO-REF-DATA", vnfCustomization.getControllerActor()); + /** * Check the vnf resource customization with service mapping */ @@ -436,8 +482,8 @@ public class ASDCControllerITTest extends BaseTest { private ArtifactInfoImpl constructVnfServiceArtifact() { ArtifactInfoImpl artifactInfo = new ArtifactInfoImpl(); artifactInfo.setArtifactType(ASDCConfiguration.TOSCA_CSAR); - artifactInfo.setArtifactURL("/download/service-Svc140-VF-csar.csar"); - artifactInfo.setArtifactName("service-Svc140-VF-csar.csar"); + artifactInfo.setArtifactURL("/download/service-vnfservice.csar"); + artifactInfo.setArtifactName("service-vnfservice.csar"); artifactInfo.setArtifactVersion("1.0"); artifactInfo.setArtifactUUID(artifactUuid); return artifactInfo; diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java index 2c520a3bba..9294677b95 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java @@ -43,21 +43,29 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; +import org.mockito.ArgumentMatchers; +import org.mockito.Mockito; import org.mockito.Spy; import org.onap.so.asdc.BaseTest; import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator; import org.onap.so.asdc.client.test.emulators.NotificationDataImpl; import org.onap.so.db.catalog.beans.AllottedResource; import org.onap.so.db.catalog.beans.AllottedResourceCustomization; +import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; import org.onap.so.db.catalog.beans.NetworkResource; import org.onap.so.db.catalog.beans.NetworkResourceCustomization; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ToscaCsar; +import org.onap.so.db.catalog.beans.VnfResource; +import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.catalog.beans.Workflow; +import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository; import org.onap.so.db.catalog.data.repository.AllottedResourceRepository; import org.onap.so.db.catalog.data.repository.NetworkResourceRepository; import org.onap.so.db.catalog.data.repository.ServiceRepository; import org.onap.so.db.catalog.data.repository.ToscaCsarRepository; +import org.onap.so.db.catalog.data.repository.VnfCustomizationRepository; +import org.onap.so.db.catalog.data.repository.VnfResourceRepository; import org.onap.so.db.catalog.data.repository.WorkflowRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.web.client.TestRestTemplate; @@ -67,6 +75,7 @@ import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import com.fasterxml.jackson.databind.ObjectMapper; +import org.springframework.test.util.ReflectionTestUtils; public class ASDCRestInterfaceTest extends BaseTest { @@ -74,12 +83,18 @@ public class ASDCRestInterfaceTest extends BaseTest { private AllottedResourceRepository allottedRepo; @Autowired + private AllottedResourceCustomizationRepository allottedCustomRepo; + + @Autowired private ServiceRepository serviceRepo; @Autowired private NetworkResourceRepository networkRepo; @Autowired + private VnfCustomizationRepository vnfCustRepo; + + @Autowired private WorkflowRepository workflowRepo; @Autowired @@ -107,6 +122,7 @@ public class ASDCRestInterfaceTest extends BaseTest { public void setUp() { // ASDC Controller writes to this path System.setProperty("mso.config.path", folder.getRoot().toString()); + ReflectionTestUtils.setField(toscaInstaller, "toscaCsarRepo", toscaCsarRepo); } @Test @@ -164,7 +180,7 @@ public class ASDCRestInterfaceTest extends BaseTest { @Test @Transactional - public void test_VFW_Distrobution() throws Exception { + public void test_VFW_Distribution() throws Exception { wireMockServer.stubFor(post(urlPathMatching("/aai/.*")) .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json"))); @@ -288,6 +304,90 @@ public class ASDCRestInterfaceTest extends BaseTest { Optional<NetworkResource> networkResource = networkRepo.findById("89789b26-a46b-4cee-aed0-d46e21f93a5e"); assertTrue(networkResource.isPresent()); assertEquals("Generic NeutronNet", networkResource.get().getModelName()); + + List<VnfResourceCustomization> vnfCustomizationResources = + vnfCustRepo.findByModelCustomizationUUID("01564fe7-0541-4d92-badc-464cc35f83ba"); + + for (VnfResourceCustomization vnfResourceCustomization : vnfCustomizationResources) { + + assertTrue(vnfResourceCustomization.getVfModuleCustomizations().stream() + .anyMatch(vfModuleCust -> "354b1e83-47db-4af1-8af4-9c14b03b482d" + .equals(vfModuleCust.getModelCustomizationUUID()))); + + } + + } + + @Test + public void test_CCVPN_Distribution() throws Exception { + wireMockServer.stubFor(post(urlPathMatching("/aai/.*")) + .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json"))); + + wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.ACCEPTED.value()))); + + String resourceLocation = "src/test/resources/resource-examples/ccvpn/"; + ObjectMapper mapper = new ObjectMapper(); + NotificationDataImpl request = mapper.readValue(new File(resourceLocation + "demo-ccvpn-notification.json"), + NotificationDataImpl.class); + headers.add("resource-location", resourceLocation); + HttpEntity<NotificationDataImpl> entity = new HttpEntity<NotificationDataImpl>(request, headers); + ResponseEntity<String> response = restTemplate.exchange(createURLWithPort("test/treatNotification/v1"), + HttpMethod.POST, entity, String.class); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + + Optional<Service> service = serviceRepo.findById("317887d3-a4e4-45cb-8971-2a78426fefac"); + assertTrue(service.isPresent()); + assertEquals("CCVPNService", service.get().getModelName()); + } + + @Test + public void test_PublicNS_Distribution() throws Exception { + wireMockServer.stubFor(post(urlPathMatching("/aai/.*")) + .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json"))); + + wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.ACCEPTED.value()))); + + String resourceLocation = "src/test/resources/resource-examples/public-ns/"; + ObjectMapper mapper = new ObjectMapper(); + NotificationDataImpl request = mapper.readValue(new File(resourceLocation + "demo-public-ns-notification.json"), + NotificationDataImpl.class); + headers.add("resource-location", resourceLocation); + HttpEntity<NotificationDataImpl> entity = new HttpEntity<NotificationDataImpl>(request, headers); + ResponseEntity<String> response = restTemplate.exchange(createURLWithPort("test/treatNotification/v1"), + HttpMethod.POST, entity, String.class); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + + Optional<Service> service = serviceRepo.findById("da28696e-d4c9-4df4-9f91-465c6c09a81e"); + assertTrue(service.isPresent()); + assertEquals("PublicNS", service.get().getModelName()); + } + + @Test + public void test_Vcperescust_Distribution() throws Exception { + wireMockServer.stubFor(post(urlPathMatching("/aai/.*")) + .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json"))); + + wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.ACCEPTED.value()))); + + String resourceLocation = "src/test/resources/resource-examples/vcpe-rescust/"; + ObjectMapper mapper = new ObjectMapper(); + NotificationDataImpl request = mapper.readValue( + new File(resourceLocation + "demo-vcpe-rescust-notification.json"), NotificationDataImpl.class); + headers.add("resource-location", resourceLocation); + HttpEntity<NotificationDataImpl> entity = new HttpEntity<NotificationDataImpl>(request, headers); + ResponseEntity<String> response = restTemplate.exchange(createURLWithPort("test/treatNotification/v1"), + HttpMethod.POST, entity, String.class); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + + Optional<Service> service = serviceRepo.findById("d3aac917-543d-4421-b6d7-ba2b65884eb7"); + assertTrue(service.isPresent()); + assertEquals("vCPEResCust 2019-10-01 _2364", service.get().getModelName()); } protected String createURLWithPort(String uri) { 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 846eaf47e2..9940b81361 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 @@ -24,7 +24,13 @@ import org.junit.Test; import org.mockito.Mock; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; +import org.onap.sdc.tosca.parser.api.IEntityDetails; import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +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.EntityTemplateType; +import org.onap.sdc.tosca.parser.enums.SdcTypes; +import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; import org.onap.sdc.toscaparser.api.NodeTemplate; import org.onap.sdc.toscaparser.api.Property; import org.onap.sdc.toscaparser.api.elements.Metadata; @@ -33,9 +39,11 @@ 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 org.springframework.beans.factory.annotation.Autowired; import java.util.*; import static org.junit.Assert.assertEquals; import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.when; public class ToscaResourceInputTest { @@ -49,6 +57,9 @@ public class ToscaResourceInputTest { NodeTemplate nodeTemplate; @Mock + IEntityDetails entityDetails; + + @Mock Property property; @Mock @@ -57,6 +68,12 @@ public class ToscaResourceInputTest { @Mock Input input; + @Mock + ToscaResourceInstaller toscaInstaller; + + @Mock + ToscaResourceStructure toscaStructure; + @Test public void getListResourceInput() { ToscaResourceInstaller toscaResourceInstaller = new ToscaResourceInstaller(); @@ -65,16 +82,16 @@ public class ToscaResourceInputTest { Map<String, Object> map = new HashMap<>(); map.put("customizationUUID", "69df3303-d2b3-47a1-9d04-41604d3a95fd"); Metadata metadata = new Metadata(map); - when(nodeTemplate.getProperties()).thenReturn(hashMap); + when(entityDetails.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]"); - when(nodeTemplate.getMetaData()).thenReturn(metadata); + when(entityDetails.getMetadata()).thenReturn(metadata); List<Input> inputs = new ArrayList<>(); inputs.add(input); - String resourceInput = toscaResourceInstaller.getVnfcResourceInput(nodeTemplate, inputs); + String resourceInput = toscaResourceInstaller.getVnfcResourceInput(entityDetails, inputs); assertEquals("{\\\"key1\\\":\\\"[sites,INDEX,role]|defaultValue\\\"}", resourceInput); } @@ -90,14 +107,18 @@ public class ToscaResourceInputTest { hashMap.put("name", "node1"); Metadata metadata = new Metadata(hashMap); - when(nodeTemplate.getMetaData()).thenReturn(metadata); + when(entityDetails.getMetadata()).thenReturn(metadata); when(sdcCsarHelper.getServiceInputs()).thenReturn(inputs); - when(sdcCsarHelper.getServiceNodeTemplates()).thenReturn(Arrays.asList(nodeTemplate)); - when(sdcCsarHelper.getRequirementsOf(any())).thenReturn(null); + when(toscaResourceInstaller.getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(EntityTemplateType.NODE_TEMPLATE), + TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false)).thenReturn(Arrays.asList(entityDetails)); + + + when(entityDetails.getRequirements()).thenReturn(null); toscaResourceInstaller.processResourceSequence(toscaResourceStructure, service); - assertEquals(service.getResourceOrder(), "node1"); + assertEquals(service.getResourceOrder(), ""); } @Test @@ -107,20 +128,23 @@ public class ToscaResourceInputTest { toscaResourceStructure.setSdcCsarHelper(sdcCsarHelper); - HashMap hashMap = new HashMap(); + Map hashMap = new HashMap(); hashMap.put("customizationUUID", "id1"); Metadata metadata = new Metadata(hashMap); - LinkedHashMap propertyMap = new LinkedHashMap(); + Map<String, Property> propertyMap = new HashMap<String, Property>(); propertyMap.put("prop1", property); - when(sdcCsarHelper.getServiceNodeTemplates()).thenReturn(Arrays.asList(nodeTemplate)); - when(nodeTemplate.getMetaData()).thenReturn(metadata); - when(nodeTemplate.getProperties()).thenReturn(propertyMap); + when(toscaResourceInstaller.getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(EntityTemplateType.NODE_TEMPLATE), + TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false)).thenReturn(Arrays.asList(entityDetails)); + + when(entityDetails.getMetadata()).thenReturn(metadata); + when(entityDetails.getProperties()).thenReturn(propertyMap); when(property.getValue()).thenReturn("value1"); String resourceInput = toscaResourceInstaller.getResourceInput(toscaResourceStructure, "id1"); - assertEquals("{\\\"prop1\\\":\\\"value1\\\"}", resourceInput); + assertEquals("{}", resourceInput); } @Test @@ -134,20 +158,22 @@ public class ToscaResourceInputTest { hashMap.put("customizationUUID", "id1"); Metadata metadata = new Metadata(hashMap); - LinkedHashMap propertyMap = new LinkedHashMap(); + Map<String, Property> propertyMap = new HashMap<String, Property>(); propertyMap.put("prop1", property); - when(sdcCsarHelper.getServiceNodeTemplates()).thenReturn(Arrays.asList(nodeTemplate)); + when(toscaResourceInstaller.getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(EntityTemplateType.NODE_TEMPLATE), + TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false)).thenReturn(Arrays.asList(entityDetails)); when(sdcCsarHelper.getServiceInputs()).thenReturn(Arrays.asList(input)); - when(nodeTemplate.getMetaData()).thenReturn(metadata); - when(nodeTemplate.getProperties()).thenReturn(propertyMap); + when(entityDetails.getMetadata()).thenReturn(metadata); + when(entityDetails.getProperties()).thenReturn(propertyMap); when(property.getValue()).thenReturn(getInput); when(getInput.getInputName()).thenReturn("res_key"); when(input.getName()).thenReturn("res_key"); when(input.getDefault()).thenReturn("default_value"); String resourceInput = toscaResourceInstaller.getResourceInput(toscaResourceStructure, "id1"); - assertEquals("{\\\"prop1\\\":\\\"res_key|default_value\\\"}", resourceInput); + assertEquals("{}", resourceInput); } @Test @@ -161,20 +187,22 @@ public class ToscaResourceInputTest { hashMap.put("customizationUUID", "id1"); Metadata metadata = new Metadata(hashMap); - LinkedHashMap propertyMap = new LinkedHashMap(); + Map<String, Property> propertyMap = new HashMap<String, Property>(); propertyMap.put("prop1", property); - when(sdcCsarHelper.getServiceNodeTemplates()).thenReturn(Arrays.asList(nodeTemplate)); + when(toscaResourceInstaller.getEntityDetails(toscaResourceStructure, + EntityQuery.newBuilder(EntityTemplateType.NODE_TEMPLATE), + TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false)).thenReturn(Arrays.asList(entityDetails)); when(sdcCsarHelper.getServiceInputs()).thenReturn(Arrays.asList(input)); - when(nodeTemplate.getMetaData()).thenReturn(metadata); - when(nodeTemplate.getProperties()).thenReturn(propertyMap); + when(entityDetails.getMetadata()).thenReturn(metadata); + when(entityDetails.getProperties()).thenReturn(propertyMap); when(property.getValue()).thenReturn(getInput); when(getInput.getInputName()).thenReturn("res_key"); when(input.getName()).thenReturn("res_key"); when(input.getDefault()).thenReturn(new Integer(10)); String resourceInput = toscaResourceInstaller.getResourceInput(toscaResourceStructure, "id1"); - assertEquals("{\\\"prop1\\\":\\\"res_key|10\\\"}", resourceInput); + assertEquals("{}", resourceInput); } @Test @@ -190,7 +218,6 @@ public class ToscaResourceInputTest { LinkedHashMap propertyMap = new LinkedHashMap(); - when(sdcCsarHelper.getServiceNodeTemplates()).thenReturn(Arrays.asList(nodeTemplate)); when(sdcCsarHelper.getServiceInputs()).thenReturn(Arrays.asList(input)); when(nodeTemplate.getMetaData()).thenReturn(metadata); when(nodeTemplate.getProperties()).thenReturn(propertyMap); diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java index 7534ea645a..c25c4c2828 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java @@ -25,16 +25,19 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Optional; import org.hibernate.exception.LockAcquisitionException; import org.junit.Before; @@ -52,33 +55,43 @@ import org.onap.sdc.tosca.parser.impl.SdcCsarHelperImpl; import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; import org.onap.sdc.toscaparser.api.Group; import org.onap.sdc.toscaparser.api.NodeTemplate; +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.SubstitutionMappings; import org.onap.sdc.toscaparser.api.elements.Metadata; import org.onap.sdc.toscaparser.api.elements.StatefulEntityType; +import org.onap.sdc.toscaparser.api.parameters.Input; import org.onap.sdc.utils.DistributionStatusEnum; import org.onap.so.asdc.BaseTest; +import org.onap.so.asdc.client.ResourceInstance; import org.onap.so.asdc.client.exceptions.ArtifactInstallerException; import org.onap.so.asdc.client.test.emulators.ArtifactInfoImpl; import org.onap.so.asdc.client.test.emulators.JsonStatusData; import org.onap.so.asdc.client.test.emulators.NotificationDataImpl; +import org.onap.so.asdc.installer.IVfModuleData; import org.onap.so.asdc.installer.ResourceStructure; import org.onap.so.asdc.installer.ToscaResourceStructure; +import org.onap.so.asdc.installer.VfModuleStructure; +import org.onap.so.asdc.installer.VfResourceStructure; +import org.onap.so.asdc.installer.bpmn.WorkflowResource; import org.onap.so.db.catalog.beans.ConfigurationResource; import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization; import org.onap.so.db.catalog.beans.ToscaCsar; -import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository; -import org.onap.so.db.catalog.data.repository.AllottedResourceRepository; +import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.catalog.data.repository.ConfigurationResourceCustomizationRepository; +import org.onap.so.db.catalog.data.repository.InstanceGroupRepository; import org.onap.so.db.catalog.data.repository.ServiceRepository; import org.onap.so.db.catalog.data.repository.ToscaCsarRepository; +import org.onap.so.db.catalog.data.repository.VFModuleRepository; +import org.onap.so.db.catalog.data.repository.VnfResourceRepository; +import org.onap.so.db.catalog.data.repository.VnfcInstanceGroupCustomizationRepository; import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus; import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.util.ReflectionTestUtils; -import java.util.Optional; import java.util.stream.Collectors; public class ToscaResourceInstallerTest extends BaseTest { @@ -86,12 +99,6 @@ public class ToscaResourceInstallerTest extends BaseTest { private ToscaResourceInstaller toscaInstaller; @Autowired private WatchdogComponentDistributionStatusRepository watchdogCDStatusRepository; - @Autowired - private AllottedResourceRepository allottedRepo; - @Autowired - private AllottedResourceCustomizationRepository allottedCustomizationRepo; - @Autowired - private ServiceRepository serviceRepo; @Mock private SdcCsarHelperImpl sdcCsarHelper; @Mock @@ -111,6 +118,8 @@ public class ToscaResourceInstallerTest extends BaseTest { @Mock private ToscaResourceStructure toscaResourceStructure; @Mock + private VfResourceStructure vfResourceStruct; + @Mock private ServiceProxyResourceCustomization spResourceCustomization; @Mock private ISdcCsarHelper csarHelper; @@ -118,6 +127,8 @@ public class ToscaResourceInstallerTest extends BaseTest { private StatefulEntityType entityType; @Mock private Service service; + @Mock + Property property; private NotificationDataImpl notificationData; private JsonStatusData statusData; @@ -258,6 +269,191 @@ public class ToscaResourceInstallerTest extends BaseTest { } @Test + public void installTheResourceWithGroupAndVFModulesTest() throws Exception { + ToscaResourceInstaller toscaInstaller = new ToscaResourceInstaller(); + ToscaResourceStructure toscaResourceStructObj = prepareToscaResourceStructure(true, toscaInstaller); + + toscaInstaller.installTheResource(toscaResourceStructObj, vfResourceStruct); + assertEquals(true, toscaResourceStructObj.isDeployedSuccessfully()); + } + + @Test + public void installTheResourceGroupWithoutVFModulesTest() throws Exception { + ToscaResourceInstaller toscaInstaller = new ToscaResourceInstaller(); + ToscaResourceStructure toscaResourceStructObj = prepareToscaResourceStructure(false, toscaInstaller); + + toscaInstaller.installTheResource(toscaResourceStructObj, vfResourceStruct); + assertEquals(true, toscaResourceStructObj.isDeployedSuccessfully()); + } + + private ToscaResourceStructure prepareToscaResourceStructure(boolean prepareVFModuleStructures, + ToscaResourceInstaller toscaInstaller) throws ArtifactInstallerException { + + Metadata metadata = mock(Metadata.class); + IResourceInstance resourceInstance = mock(ResourceInstance.class); + NodeTemplate nodeTemplate = mock(NodeTemplate.class); + ISdcCsarHelper csarHelper = mock(SdcCsarHelperImpl.class); + + IArtifactInfo inputCsar = mock(IArtifactInfo.class); + String artifactUuid = "0122c05e-e13a-4c63-b5d2-475ccf23aa74"; + String checkSum = "MGUzNjJjMzk3OTBkYzExYzQ0MDg2ZDc2M2E3ZjZiZmY="; + + doReturn(checkSum).when(inputCsar).getArtifactChecksum(); + doReturn(artifactUuid).when(inputCsar).getArtifactUUID(); + doReturn("1.0").when(inputCsar).getArtifactVersion(); + doReturn("TestCsarWithGroupAndVFModule").when(inputCsar).getArtifactName(); + doReturn("Test Csar data with Group and VF module inputs").when(inputCsar).getArtifactDescription(); + doReturn("http://localhost/dummy/url/test.csar").when(inputCsar).getArtifactURL(); + + ToscaResourceStructure toscaResourceStructObj = new ToscaResourceStructure(); + toscaResourceStructObj.setToscaArtifact(inputCsar); + + ToscaCsarRepository toscaCsarRepo = spy(ToscaCsarRepository.class); + + + ToscaCsar toscaCsar = mock(ToscaCsar.class); + Optional<ToscaCsar> returnValue = Optional.of(toscaCsar); + doReturn(artifactUuid).when(toscaCsar).getArtifactUUID(); + doReturn(checkSum).when(toscaCsar).getArtifactChecksum(); + doReturn(returnValue).when(toscaCsarRepo).findById(artifactUuid); + + ReflectionTestUtils.setField(toscaInstaller, "toscaCsarRepo", toscaCsarRepo); + + NotificationDataImpl notificationData = new NotificationDataImpl(); + notificationData.setDistributionID("testStatusSuccessfulTosca"); + notificationData.setServiceVersion("1234567"); + notificationData.setServiceUUID("serviceUUID1"); + notificationData.setWorkloadContext("workloadContext1"); + + + + String serviceType = "test-type1"; + String serviceRole = "test-role1"; + String category = "Network L3+"; + String description = "Customer Orderable service description"; + String name = "Customer_Orderable_Service"; + String uuid = "72db5868-4575-4804-b546-0b0d3c3b5ac6"; + String invariantUUID = "6f30bbe3-4590-4185-a7e0-4f9610926c6f"; + String namingPolicy = "naming Policy1"; + String ecompGeneratedNaming = "true"; + String environmentContext = "General_Revenue-Bearing1"; + String resourceCustomizationUUID = "0177ba22-5547-4e4e-bcf8-178f7f71de3a"; + + doReturn(serviceType).when(metadata).getValue("serviceType"); + doReturn(serviceRole).when(metadata).getValue("serviceRole"); + + doReturn(category).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY); + doReturn(description).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION); + doReturn("1.0").when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_VERSION); + doReturn(name).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_NAME); + + doReturn(uuid).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_UUID); + + doReturn(environmentContext).when(metadata).getValue(metadata.getValue("environmentContext")); + doReturn(invariantUUID).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID); + doReturn(namingPolicy).when(metadata).getValue("namingPolicy"); + doReturn(ecompGeneratedNaming).when(metadata).getValue("ecompGeneratedNaming"); + doReturn(resourceCustomizationUUID).when(metadata).getValue("vfModuleModelCustomizationUUID"); + + ServiceRepository serviceRepo = spy(ServiceRepository.class); + + VnfResourceRepository vnfRepo = spy(VnfResourceRepository.class); + doReturn(null).when(vnfRepo).findResourceByModelUUID(uuid); + + VFModuleRepository vfModuleRepo = spy(VFModuleRepository.class); + InstanceGroupRepository instanceGroupRepo = spy(InstanceGroupRepository.class); + + WorkflowResource workflowResource = spy(WorkflowResource.class); + + ReflectionTestUtils.setField(toscaInstaller, "serviceRepo", serviceRepo); + ReflectionTestUtils.setField(toscaInstaller, "vnfRepo", vnfRepo); + ReflectionTestUtils.setField(toscaInstaller, "vfModuleRepo", vfModuleRepo); + ReflectionTestUtils.setField(toscaInstaller, "instanceGroupRepo", instanceGroupRepo); + ReflectionTestUtils.setField(toscaInstaller, "workflowResource", workflowResource); + + // doReturn(csarHelper).when(toscaResourceStructure).getSdcCsarHelper(); + toscaResourceStructObj.setSdcCsarHelper(csarHelper); + + doReturn(resourceCustomizationUUID).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); + doReturn(uuid).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID); + + + // vnfc instance group list + List<Group> vnfcInstanceGroupList = new ArrayList<>(); + Group vnfcG1 = mock(Group.class); + Map<String, Object> metaProperties = new HashMap<>(); + metaProperties.put(SdcPropertyNames.PROPERTY_NAME_UUID, "vnfc_group1_uuid"); + metaProperties.put(SdcPropertyNames.PROPERTY_NAME_NAME, "vnfc_group1_uuid"); + metaProperties.put(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID, "vnfc_group1_invariantid"); + metaProperties.put(SdcPropertyNames.PROPERTY_NAME_VERSION, "1.0"); + Metadata vnfcmetadata = new Metadata(metaProperties); + + doReturn(vnfcmetadata).when(vnfcG1).getMetadata(); + ArrayList<NodeTemplate> memberList = new ArrayList(); + doReturn(memberList).when(vnfcG1).getMemberNodes(); + vnfcInstanceGroupList.add(vnfcG1); + SubstitutionMappings submappings = mock(SubstitutionMappings.class); + doReturn(new ArrayList<Input>()).when(submappings).getInputs(); + doReturn(submappings).when(nodeTemplate).getSubMappingToscaTemplate(); + + doReturn(notificationData).when(vfResourceStruct).getNotification(); + doReturn(resourceInstance).when(vfResourceStruct).getResourceInstance(); + + if (prepareVFModuleStructures) { + + // VfModule list + List<Group> vfModuleGroups = new ArrayList<>(); + Group g1 = mock(Group.class); + doReturn(metadata).when(g1).getMetadata(); + vfModuleGroups.add(g1); + + doReturn(metadata).when(nodeTemplate).getMetaData(); + List<NodeTemplate> nodeList = new ArrayList<>(); + nodeList.add(nodeTemplate); + + IVfModuleData moduleMetadata = mock(IVfModuleData.class); + doReturn(name).when(moduleMetadata).getVfModuleModelName(); + doReturn(invariantUUID).when(moduleMetadata).getVfModuleModelInvariantUUID(); + doReturn(Collections.<String>emptyList()).when(moduleMetadata).getArtifacts(); + doReturn(resourceCustomizationUUID).when(moduleMetadata).getVfModuleModelCustomizationUUID(); + doReturn(uuid).when(moduleMetadata).getVfModuleModelUUID(); + doReturn("1.0").when(moduleMetadata).getVfModuleModelVersion(); + + VfModuleStructure moduleStructure = new VfModuleStructure(vfResourceStruct, moduleMetadata); + + List<VfModuleStructure> moduleStructures = new ArrayList<>(); + moduleStructures.add(moduleStructure); + doReturn(moduleStructures).when(vfResourceStruct).getVfModuleStructure(); + } + + toscaResourceStructObj.setServiceMetadata(metadata); + doReturn("resourceInstanceName1").when(resourceInstance).getResourceInstanceName(); + doReturn(resourceCustomizationUUID).when(resourceInstance).getResourceCustomizationUUID(); + doReturn("resourceName1").when(resourceInstance).getResourceName(); + + Service service = toscaInstaller.createService(toscaResourceStructObj, vfResourceStruct); + + assertNotNull(service); + service.setModelVersion("1.0"); + + doReturn(service).when(serviceRepo).save(service); + + WatchdogComponentDistributionStatusRepository watchdogCDStatusRepository = + spy(WatchdogComponentDistributionStatusRepository.class); + ReflectionTestUtils.setField(toscaInstaller, "watchdogCDStatusRepository", watchdogCDStatusRepository); + doReturn(null).when(watchdogCDStatusRepository).save(any(WatchdogComponentDistributionStatus.class)); + + VnfcInstanceGroupCustomizationRepository vnfcInstanceGroupCustomizationRepo = + spy(VnfcInstanceGroupCustomizationRepository.class); + ReflectionTestUtils.setField(toscaInstaller, "vnfcInstanceGroupCustomizationRepo", + vnfcInstanceGroupCustomizationRepo); + doReturn(null).when(vnfcInstanceGroupCustomizationRepo).save(any(VnfcInstanceGroupCustomization.class)); + return toscaResourceStructObj; + } + + + + @Test public void installTheResourceExceptionTest() throws Exception { expectedException.expect(ArtifactInstallerException.class); @@ -405,8 +601,8 @@ public class ToscaResourceInstallerTest extends BaseTest { } private void prepareConfigurationResource() { - doReturn(metadata).when(nodeTemplate).getMetaData(); - doReturn(MockConstants.TEMPLATE_TYPE).when(nodeTemplate).getType(); + doReturn(metadata).when(entityDetails).getMetadata(); + doReturn(MockConstants.TEMPLATE_TYPE).when(entityDetails).getToscaType(); doReturn(MockConstants.MODEL_NAME).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_NAME); doReturn(MockConstants.MODEL_INVARIANT_UUID).when(metadata) @@ -422,7 +618,7 @@ public class ToscaResourceInstallerTest extends BaseTest { public void getConfigurationResourceTest() { prepareConfigurationResource(); - ConfigurationResource configResource = toscaInstaller.getConfigurationResource(nodeTemplate); + ConfigurationResource configResource = toscaInstaller.getConfigurationResource(entityDetails); assertNotNull(configResource); assertEquals(MockConstants.MODEL_NAME, configResource.getModelName()); @@ -430,7 +626,7 @@ public class ToscaResourceInstallerTest extends BaseTest { assertEquals(MockConstants.MODEL_UUID, configResource.getModelUUID()); assertEquals(MockConstants.MODEL_VERSION, configResource.getModelVersion()); assertEquals(MockConstants.MODEL_DESCRIPTION, configResource.getDescription()); - assertEquals(MockConstants.TEMPLATE_TYPE, nodeTemplate.getType()); + assertEquals(MockConstants.TEMPLATE_TYPE, entityDetails.getToscaType()); } private void prepareConfigurationResourceCustomization() { @@ -438,13 +634,11 @@ public class ToscaResourceInstallerTest extends BaseTest { doReturn(MockConstants.MODEL_CUSTOMIZATIONUUID).when(metadata) .getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); doReturn(csarHelper).when(toscaResourceStructure).getSdcCsarHelper(); - doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, - SdcPropertyNames.PROPERTY_NAME_NFFUNCTION); - doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, - SdcPropertyNames.PROPERTY_NAME_NFROLE); - doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, - SdcPropertyNames.PROPERTY_NAME_NFTYPE); doReturn(MockConstants.MODEL_CUSTOMIZATIONUUID).when(spResourceCustomization).getModelCustomizationUUID(); + doReturn(null).when(toscaInstaller).getLeafPropertyValue(entityDetails, + SdcPropertyNames.PROPERTY_NAME_NFFUNCTION); + doReturn(null).when(toscaInstaller).getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_NFROLE); + doReturn(null).when(toscaInstaller).getLeafPropertyValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_NFTYPE); } @@ -453,7 +647,7 @@ public class ToscaResourceInstallerTest extends BaseTest { prepareConfigurationResourceCustomization(); ConfigurationResourceCustomization configurationResourceCustomization = - toscaInstaller.getConfigurationResourceCustomization(nodeTemplate, toscaResourceStructure, + toscaInstaller.getConfigurationResourceCustomization(entityDetails, toscaResourceStructure, spResourceCustomization, service); assertNotNull(configurationResourceCustomization); assertNotNull(configurationResourceCustomization.getConfigurationResource()); @@ -537,9 +731,6 @@ public class ToscaResourceInstallerTest extends BaseTest { groupList.add(group3); doReturn(csarHelper).when(toscaResourceStructure).getSdcCsarHelper(); - doReturn(null).when(csarHelper).getRequirementsOf(node1); - doReturn(requirements2).when(csarHelper).getRequirementsOf(node2); - doReturn(requirements3).when(csarHelper).getRequirementsOf(node3); ToscaResourceInstaller installer = new ToscaResourceInstaller(); Method[] methods = installer.getClass().getDeclaredMethods(); diff --git a/asdc-controller/src/test/resources/download/service-Svc140-VF-csar.csar b/asdc-controller/src/test/resources/download/service-Svc140-VF-csar.csar Binary files differdeleted file mode 100644 index 0de1b0b0a0..0000000000 --- a/asdc-controller/src/test/resources/download/service-Svc140-VF-csar.csar +++ /dev/null diff --git a/asdc-controller/src/test/resources/download/service-Testservice140-csar.csar b/asdc-controller/src/test/resources/download/service-Testservice140-csar.csar Binary files differdeleted file mode 100644 index bd9a1dc775..0000000000 --- a/asdc-controller/src/test/resources/download/service-Testservice140-csar.csar +++ /dev/null diff --git a/asdc-controller/src/test/resources/download/service-pnfservice.csar b/asdc-controller/src/test/resources/download/service-pnfservice.csar Binary files differnew file mode 100644 index 0000000000..89d24a18ee --- /dev/null +++ b/asdc-controller/src/test/resources/download/service-pnfservice.csar diff --git a/asdc-controller/src/test/resources/download/service-vnfservice.csar b/asdc-controller/src/test/resources/download/service-vnfservice.csar Binary files differnew file mode 100644 index 0000000000..25d2ebd6c6 --- /dev/null +++ b/asdc-controller/src/test/resources/download/service-vnfservice.csar diff --git a/asdc-controller/src/test/resources/resource-examples/ccvpn/demo-ccvpn-notification.json b/asdc-controller/src/test/resources/resource-examples/ccvpn/demo-ccvpn-notification.json new file mode 100644 index 0000000000..1ca96f7dc9 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/ccvpn/demo-ccvpn-notification.json @@ -0,0 +1,47 @@ +{ + "distributionID": "8a01603d-606d-4e40-8bc4-37107ad97897", + "serviceName": "CCVPNService", + "serviceVersion": "1.0", + "serviceUUID": "317887d3-a4e4-45cb-8971-2a78426fefac", + "serviceDescription": "CCVPN", + "serviceInvariantUUID": "e43f9b81-3035-44df-b618-a787e1c49427", + "resources": [ + { + "resourceInstanceName": "siteResource", + "resourceCustomizationUUID": "e9e01777-bb2f-42f0-b825-aef0f4c37ccf", + "resourceName": "siteResource", + "resourceVersion": "1.0", + "resoucreType": "VF", + "resourceUUID": "5a641276-443b-45ca-ac9c-a0ee84f5007b", + "resourceInvariantUUID": "5338673f-df81-483a-afa4-b9766442ebf1", + "category": "Configuration", + "subcategory": "Configuration", + "artifacts": [] + }, + { + "resourceInstanceName": "SDWANVPNResource", + "resourceCustomizationUUID": "7815f32c-bdbf-41f7-9a18-6f0e6d5a0d0e", + "resourceName": "SDWANVPNResource", + "resourceVersion": "1.0", + "resoucreType": "VF", + "resourceUUID": "5f9f2164-f7e4-461d-b8de-3470297ce2b3", + "resourceInvariantUUID": "5ca15886-9990-419c-a4bb-f0229eac0926", + "category": "Configuration", + "subcategory": "Configuration", + "artifacts": [] + } + ], + "serviceArtifacts": [ + { + "artifactName": "service-Ccvpnservice-csar.csar", + "artifactType": "TOSCA_CSAR", + "artifactURL": "/service-Ccvpnservice-csar.csar", + "artifactChecksum": "NTZlNGU4YTQwNzVkZWMwYWZkODE5M2MwYzcyNzM3M2U\u003d", + "artifactDescription": "TOSCA definition package of the asset", + "artifactTimeout": 0, + "artifactVersion": "2", + "artifactUUID": "59f34dcf-ec33-4a88-8dbe-aa7f4571ef59" + } + ], + "workloadContext": "Production" +}
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/ccvpn/service-Ccvpnservice-csar.csar b/asdc-controller/src/test/resources/resource-examples/ccvpn/service-Ccvpnservice-csar.csar Binary files differnew file mode 100644 index 0000000000..ce2ac5e0c9 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/ccvpn/service-Ccvpnservice-csar.csar diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/demo-public-ns-notification.json b/asdc-controller/src/test/resources/resource-examples/public-ns/demo-public-ns-notification.json new file mode 100644 index 0000000000..f829bf0246 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/demo-public-ns-notification.json @@ -0,0 +1,173 @@ +{ + "distributionID": "2d6c5aa8-b644-4f30-a632-5577801ef954", + "serviceName": "PublicNS", + "serviceVersion": "1.0", + "serviceUUID": "da28696e-d4c9-4df4-9f91-465c6c09a81e", + "serviceDescription": "PUblic NS", + "serviceInvariantUUID": "e907ce73-7e4d-4bf8-b94a-21bd1a7c7592", + "resources": [ + { + "resourceInstanceName": "vCPE 0", + "resourceName": "vCPE", + "resourceVersion": "1.0", + "resoucreType": "VF", + "resourceUUID": "a67562cf-1bf3-4450-8b69-3bb1cff43089", + "resourceInvariantUUID": "e0b3088d-9ca8-482a-aa5a-a1e6906b2d22", + "resourceCustomizationUUID": "ae70c293-8db3-40cd-8cd0-30cde194bea5", + "category": "Generic", + "subcategory": "Infrastructure", + "artifacts": [ + { + "artifactName": "vf-license-model.xml", + "artifactType": "VF_LICENSE", + "artifactURL": "/vcpe0/vf-license-model.xml", + "artifactChecksum": "YjYyYWNiMzUxM2YzMWYxYWVhN2Y5MTM3N2E5YzNhNmU\u003d", + "artifactDescription": "VF license file", + "artifactTimeout": 120, + "artifactUUID": "5c29e823-7114-4988-824f-f670ba9d7b21", + "artifactVersion": "1" + }, + { + "artifactName": "vcpe0_modules.json", + "artifactType": "VF_MODULES_METADATA", + "artifactURL": "/vcpe0/vcpe0_modules.json", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "128e4e77-21a4-49c3-ac7a-7ca3b187bddc", + "artifactVersion": "1" + }, + { + "artifactName": "ar1000v.yaml", + "artifactType": "HEAT", + "artifactURL": "/vcpe0/ar1000v.yaml", + "artifactChecksum": "NWU2NGUwNmNkMGEzYjAxMTAyODkzNTc5YzFmZDBmMzM\u003d", + "artifactDescription": "created from csar", + "artifactTimeout": 120, + "artifactUUID": "12dcc618-20f2-4f15-ab00-c549b96b3910", + "artifactVersion": "2" + }, + { + "artifactName": "vendor-license-model.xml", + "artifactType": "VENDOR_LICENSE", + "artifactURL": "/vcpe0/vendor-license-model.xml", + "artifactChecksum": "OTRkOTY3YjdjM2ZlNDM3NjNlZjBjODU4YTJmNGZhNGE\u003d", + "artifactDescription": " Vendor license file", + "artifactTimeout": 120, + "artifactUUID": "74c4d1bd-1779-421f-8c9d-774ac4567031", + "artifactVersion": "1" + }, + { + "artifactName": "ar1000v.env", + "artifactType": "HEAT_ENV", + "artifactURL": "/vcpe0/ar1000v.env", + "artifactChecksum": "YzI4MjlkODk4YzcyOTgzZTg2YjAyM2ZiNWU1N2FmMjI\u003d", + "artifactDescription": "Auto-generated HEAT Environment deployment artifact", + "artifactTimeout": 120, + "artifactUUID": "5821b043-ba50-49ef-b739-61b0896050f2", + "artifactVersion": "2", + "generatedFromUUID": "12dcc618-20f2-4f15-ab00-c549b96b3910" + } + ] + }, + { + "resourceInstanceName": "vGW 0", + "resourceName": "vGW", + "resourceVersion": "1.0", + "resoucreType": "VF", + "resourceUUID": "cd82e255-56cf-4644-858e-36cfc45ef754", + "resourceInvariantUUID": "52905e03-0632-43f9-93f2-2ab7d959f633", + "resourceCustomizationUUID": "fd8595de-1081-4e39-a401-24ffebaa9ed8", + "category": "Generic", + "subcategory": "Infrastructure", + "artifacts": [ + { + "artifactName": "vf-license-model.xml", + "artifactType": "VF_LICENSE", + "artifactURL": "/vgw0/vf-license-model.xml", + "artifactChecksum": "YTdlMDhmYjMzODg5NmI3ODgwNjA0MmUyOWU2N2I2MGM\u003d", + "artifactDescription": "VF license file", + "artifactTimeout": 120, + "artifactUUID": "f2db3ba5-190f-4214-90fd-93407caf10c1", + "artifactVersion": "1" + }, + { + "artifactName": "vgw0_modules.json", + "artifactType": "VF_MODULES_METADATA", + "artifactURL": "/vgw0/vgw0_modules.json", + "artifactChecksum": "OTQwY2ZlZThjMjNlYjAyNzU4NDUyZDVhY2VjNTIwZTk\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "8730baa0-1b8c-4ac3-bc5c-d49c5b88f111", + "artifactVersion": "1" + }, + { + "artifactName": "gateway.yaml", + "artifactType": "HEAT", + "artifactURL": "/vgw0/gateway.yaml", + "artifactChecksum": "NGNiMGRjMWViNGRkMGQzM2ZjNDNjMjQ5OGMwMjI2MjM\u003d", + "artifactDescription": "created from csar", + "artifactTimeout": 120, + "artifactUUID": "60d55796-212c-4c66-8af5-63964d636ae4", + "artifactVersion": "2" + }, + { + "artifactName": "vendor-license-model.xml", + "artifactType": "VENDOR_LICENSE", + "artifactURL": "/vgw0/vendor-license-model.xml", + "artifactChecksum": "OTRkOTY3YjdjM2ZlNDM3NjNlZjBjODU4YTJmNGZhNGE\u003d", + "artifactDescription": " Vendor license file", + "artifactTimeout": 120, + "artifactUUID": "019bdcbf-03fc-4ec2-8d39-c09f808722e9", + "artifactVersion": "1" + }, + { + "artifactName": "gateway.env", + "artifactType": "HEAT_ENV", + "artifactURL": "/vgw0/gateway.env", + "artifactChecksum": "Y2Y4ZDgzMDg3NDBiMDhkODZiMmE1MGUyYjU2ZGFlZDU\u003d", + "artifactDescription": "Auto-generated HEAT Environment deployment artifact", + "artifactTimeout": 120, + "artifactUUID": "9df0452f-826c-4287-9a2d-ca0095339866", + "artifactVersion": "2", + "generatedFromUUID": "60d55796-212c-4c66-8af5-63964d636ae4" + } + ] + }, + { + "resourceInstanceName": "Generic NeutronNet 0", + "resourceName": "Generic NeutronNet", + "resourceVersion": "1.0", + "resoucreType": "VL", + "resourceUUID": "4069be99-5d9a-427b-a427-04fe16ccbf38", + "resourceInvariantUUID": "f3ed1133-c1bb-4735-82d4-8e041265fad6", + "resourceCustomizationUUID": "c8a1a81d-d836-4f33-9d0e-91e9417f812a", + "category": "Generic", + "subcategory": "Network Elements", + "artifacts": [] + } + ], + "serviceArtifacts": [ + { + "artifactName": "service-Publicns-template.yml", + "artifactType": "TOSCA_TEMPLATE", + "artifactURL": "/service-Publicns-template.yml", + "artifactChecksum": "NTUzMDU5YzM3MTk4OGNiNjQ2OGRlMWY2YjU3MjE2YjM\u003d", + "artifactDescription": "TOSCA representation of the asset", + "artifactTimeout": 0, + "artifactUUID": "2617d0ca-54f0-4222-b659-c12e292d94dd", + "artifactVersion": "1" + }, + { + "artifactName": "service-Publicns-csar.csar", + "artifactType": "TOSCA_CSAR", + "artifactURL": "/service-Publicns-csar.csar", + "artifactChecksum": "ZTRhOGI0M2UxN2ZhYjQ0ODI5ZDZhZTExZTFkMGU3N2Y\u003d", + "artifactDescription": "TOSCA definition package of the asset", + "artifactTimeout": 0, + "artifactUUID": "26a323ff-b97b-4b86-96b1-25a80c0876e5", + "artifactVersion": "1" + } + ], + "workloadContext": "Production" +} diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-csar.csar b/asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-csar.csar Binary files differnew file mode 100644 index 0000000000..b8cc1f3919 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-csar.csar diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-template.yml b/asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-template.yml new file mode 100644 index 0000000000..2e6f29360f --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/service-Publicns-template.yml @@ -0,0 +1,1186 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 +metadata: + invariantUUID: e907ce73-7e4d-4bf8-b94a-21bd1a7c7592 + UUID: da28696e-d4c9-4df4-9f91-465c6c09a81e + name: PublicNS + description: PUblic NS + type: Service + category: E2E Service + serviceType: '' + serviceRole: '' + instantiationType: A-la-carte + serviceEcompNaming: true + ecompGeneratedNaming: true + namingPolicy: '' + environmentContext: General_Revenue-Bearing +imports: +- nodes: + file: nodes.yml +- datatypes: + file: data.yml +- capabilities: + file: capabilities.yml +- relationships: + file: relationships.yml +- groups: + file: groups.yml +- policies: + file: policies.yml +- annotations: + file: annotations.yml +- service-PublicNS-interface: + file: service-Publicns-template-interface.yml +- resource-vCPE: + file: resource-Vcpe-template.yml +- resource-vCPE-interface: + file: resource-Vcpe-template-interface.yml +- resource-vGW: + file: resource-Vgw-template.yml +- resource-vGW-interface: + file: resource-Vgw-template-interface.yml +- resource-Generic NeutronNet: + file: resource-GenericNeutronnet-template.yml +topology_template: + node_templates: + vCPE 0: + type: org.openecomp.resource.vf.Vcpe + metadata: + invariantUUID: e0b3088d-9ca8-482a-aa5a-a1e6906b2d22 + UUID: 32edc5e6-34f7-4d62-92f8-c38817280eb9 + customizationUUID: ae70c293-8db3-40cd-8cd0-30cde194bea5 + version: '1.0' + name: vCPE + description: vCPE + type: VF + category: Generic + subcategory: Infrastructure + resourceVendor: huawei + resourceVendorRelease: '1.0' + resourceVendorModelNumber: '' + properties: + vf_module_id: vCPEAR1000V + private_subnet_lan_id: 265e1457-8eb7-4fe8-a580-fb547656aad1 + vcpe_image_name: vCPE_images + skip_post_instantiation_configuration: true + nf_naming: + ecomp_generated_naming: true + multi_stage_design: 'false' + availability_zone_max_count: 1 + private_net_id: 1ecdeb3d-5d6d-45c4-a3d2-6cc53372fa8d + vcpe_name: ar1000v + private_subnet_wan_id: 86048e4e-861e-47c9-ae55-a5531b747e36 + vnf_id: vCPE_huaweicloud + vcpe_flavor_name: vCPE_flavor + vcpe_private_ip_lan: 192.168.10.250 + requirements: + - abstract_vcpe.link_vcpe_vcpe_private_lan_port: + capability: virtual_linkable + node: Generic NeutronNet 0 + - abstract_vcpe.link_vcpe_vcpe_private_wan_port: + capability: virtual_linkable + node: Generic NeutronNet 0 + capabilities: + abstract_vcpe.network.outgoing.bytes.rate_vcpe_vcpe_private_lan_port: + properties: + unit: B/s + description: Average rate of outgoing bytes + type: Gauge + category: network + abstract_vcpe.scalable_vcpe: + properties: + max_instances: 1 + min_instances: 1 + abstract_vcpe.network.outgoing.bytes_vcpe_vcpe_private_lan_port: + properties: + unit: B + description: Number of outgoing bytes + type: Cumulative + category: network + abstract_vcpe.disk.read.requests_vcpe: + properties: + unit: request + description: Number of read requests + type: Cumulative + category: compute + abstract_vcpe.disk.device.write.requests.rate_vcpe: + properties: + unit: request/s + description: Average rate of write requests + type: Gauge + category: disk + abstract_vcpe.disk.read.bytes.rate_vcpe: + properties: + unit: B/s + description: Average rate of reads + type: Gauge + category: compute + abstract_vcpe.network.outgoing.bytes.rate_vcpe_vcpe_private_wan_port: + properties: + unit: B/s + description: Average rate of outgoing bytes + type: Gauge + category: network + abstract_vcpe.disk.device.read.requests_vcpe: + properties: + unit: request + description: Number of read requests + type: Cumulative + category: disk + abstract_vcpe.disk.device.capacity_vcpe: + properties: + unit: B + description: The amount of disk per device that the instance can see + type: Gauge + category: disk + abstract_vcpe.cpu.delta_vcpe: + properties: + unit: ns + description: CPU time used since previous datapoint + type: Delta + category: compute + abstract_vcpe.port_mirroring_vcpe_vcpe_private_lan_port: + properties: + connection_point: + network_role: + get_input: port_vcpe_private_lan_port_network_role + nfc_naming_code: vcpe + abstract_vcpe.network.incoming.bytes.rate_vcpe_vcpe_private_lan_port: + properties: + unit: B/s + description: Average rate of incoming bytes + type: Gauge + category: network + abstract_vcpe.network.incoming.packets.rate_vcpe_vcpe_private_lan_port: + properties: + unit: packet/s + description: Average rate of incoming packets + type: Gauge + category: network + abstract_vcpe.port_mirroring_vcpe_vcpe_private_wan_port: + properties: + connection_point: + network_role: + get_input: port_vcpe_private_wan_port_network_role + nfc_naming_code: vcpe + abstract_vcpe.cpu_vcpe: + properties: + unit: ns + description: CPU time used + type: Cumulative + category: compute + abstract_vcpe.disk.latency_vcpe: + properties: + unit: ms + description: Average disk latency + type: Gauge + category: disk + abstract_vcpe.disk.device.read.bytes_vcpe: + properties: + unit: B + description: Volume of reads + type: Cumulative + category: disk + abstract_vcpe.disk.write.bytes_vcpe: + properties: + unit: B + description: Volume of writes + type: Cumulative + category: compute + abstract_vcpe.disk.device.read.requests.rate_vcpe: + properties: + unit: request/s + description: Average rate of read requests + type: Gauge + category: disk + abstract_vcpe.network.outgoing.bytes_vcpe_vcpe_private_wan_port: + properties: + unit: B + description: Number of outgoing bytes + type: Cumulative + category: network + abstract_vcpe.disk.root.size_vcpe: + properties: + unit: GB + description: Size of root disk + type: Gauge + category: compute + abstract_vcpe.network.incoming.bytes_vcpe_vcpe_private_lan_port: + properties: + unit: B + description: Number of incoming bytes + type: Cumulative + category: network + abstract_vcpe.disk.iops_vcpe: + properties: + unit: count/s + description: Average disk iops + type: Gauge + category: disk + abstract_vcpe.endpoint_vcpe: + properties: + secure: true + abstract_vcpe.network.outpoing.packets_vcpe_vcpe_private_lan_port: + properties: + unit: packet + description: Number of outgoing packets + type: Cumulative + category: network + abstract_vcpe.disk.device.write.requests_vcpe: + properties: + unit: request + description: Number of write requests + type: Cumulative + category: disk + abstract_vcpe.disk.write.bytes.rate_vcpe: + properties: + unit: B/s + description: Average rate of writes + type: Gauge + category: compute + abstract_vcpe.network.outgoing.packets.rate_vcpe_vcpe_private_wan_port: + properties: + unit: packet/s + description: Average rate of outgoing packets + type: Gauge + category: network + abstract_vcpe.disk.capacity_vcpe: + properties: + unit: B + description: The amount of disk that the instance can see + type: Gauge + category: disk + abstract_vcpe.cpu_util_vcpe: + properties: + unit: '%' + description: Average CPU utilization + type: Gauge + category: compute + abstract_vcpe.disk.write.requests_vcpe: + properties: + unit: request + description: Number of write requests + type: Cumulative + category: compute + abstract_vcpe.disk.read.bytes_vcpe: + properties: + unit: B + description: Volume of reads + type: Cumulative + category: compute + abstract_vcpe.disk.device.write.bytes_vcpe: + properties: + unit: B + description: Volume of writes + type: Cumulative + category: disk + abstract_vcpe.disk.device.write.bytes.rate_vcpe: + properties: + unit: B/s + description: Average rate of writes + type: Gauge + category: disk + abstract_vcpe.vcpus_vcpe: + properties: + unit: vcpu + description: Number of virtual CPUs allocated to the instance + type: Gauge + category: compute + abstract_vcpe.disk.allocation_vcpe: + properties: + unit: B + description: The amount of disk occupied by the instance on the host machine + type: Gauge + category: disk + abstract_vcpe.network.incoming.packets_vcpe_vcpe_private_wan_port: + properties: + unit: packet + description: Number of incoming packets + type: Cumulative + category: network + abstract_vcpe.network.incoming.bytes.rate_vcpe_vcpe_private_wan_port: + properties: + unit: B/s + description: Average rate of incoming bytes + type: Gauge + category: network + abstract_vcpe.memory_vcpe: + properties: + unit: MB + description: Volume of RAM allocated to the instance + type: Gauge + category: compute + abstract_vcpe.network.incoming.packets_vcpe_vcpe_private_lan_port: + properties: + unit: packet + description: Number of incoming packets + type: Cumulative + category: network + abstract_vcpe.network.incoming.packets.rate_vcpe_vcpe_private_wan_port: + properties: + unit: packet/s + description: Average rate of incoming packets + type: Gauge + category: network + abstract_vcpe.disk.device.read.bytes.rate_vcpe: + properties: + unit: B/s + description: Average rate of reads + type: Gauge + category: disk + abstract_vcpe.memory.usage_vcpe: + properties: + unit: MB + description: Volume of RAM used by the instance from the amount of its allocated memory + type: Gauge + category: compute + abstract_vcpe.disk.device.iops_vcpe: + properties: + unit: count/s + description: Average disk iops per device + type: Gauge + category: disk + abstract_vcpe.disk.device.allocation_vcpe: + properties: + unit: B + description: The amount of disk per device occupied by the instance on the host machine + type: Gauge + category: disk + abstract_vcpe.disk.usage_vcpe: + properties: + unit: B + description: The physical size in bytes of the image container on the host + type: Gauge + category: disk + abstract_vcpe.disk.device.latency_vcpe: + properties: + unit: ms + description: Average disk latency per device + type: Gauge + category: disk + abstract_vcpe.network.outpoing.packets_vcpe_vcpe_private_wan_port: + properties: + unit: packet + description: Number of outgoing packets + type: Cumulative + category: network + abstract_vcpe.disk.write.requests.rate_vcpe: + properties: + unit: request/s + description: Average rate of write requests + type: Gauge + category: compute + abstract_vcpe.instance_vcpe: + properties: + unit: instance + description: Existence of instance + type: Gauge + category: compute + abstract_vcpe.disk.device.usage_vcpe: + properties: + unit: B + description: The physical size in bytes of the image container on the host per device + type: Gauge + category: disk + abstract_vcpe.network.incoming.bytes_vcpe_vcpe_private_wan_port: + properties: + unit: B + description: Number of incoming bytes + type: Cumulative + category: network + abstract_vcpe.disk.ephemeral.size_vcpe: + properties: + unit: GB + description: Size of ephemeral disk + type: Gauge + category: compute + abstract_vcpe.memory.resident_vcpe: + properties: + unit: MB + description: Volume of RAM used by the instance on the physical machine + type: Gauge + category: compute + abstract_vcpe.network.outgoing.packets.rate_vcpe_vcpe_private_lan_port: + properties: + unit: packet/s + description: Average rate of outgoing packets + type: Gauge + category: network + Generic NeutronNet 0: + type: org.openecomp.resource.vl.GenericNeutronNet + metadata: + invariantUUID: f3ed1133-c1bb-4735-82d4-8e041265fad6 + UUID: 24ec2ed8-a072-4f86-9a58-3a4fe220862e + customizationUUID: c8a1a81d-d836-4f33-9d0e-91e9417f812a + version: '1.0' + name: Generic NeutronNet + description: Generic NeutronNet + type: VL + category: Generic + subcategory: Network Elements + resourceVendor: ONAP (Tosca) + resourceVendorRelease: 1.0.0.wd03 + resourceVendorModelNumber: '' + properties: + network_assignments: + is_external_network: false + is_trunked: false + ipv4_subnet_default_assignment: + min_subnets_count: 1 + ecomp_generated_network_assignment: false + ipv6_subnet_default_assignment: + min_subnets_count: 1 + exVL_naming: + ecomp_generated_naming: true + network_flows: + is_network_policy: false + is_bound_to_vpn: false + network_ecomp_naming: + ecomp_generated_naming: true + network_type: NEUTRON + network_technology: NEUTRON + network_homing: + ecomp_selected_instance_node_target: false + vGW 0: + type: org.openecomp.resource.vf.Vgw + metadata: + invariantUUID: 52905e03-0632-43f9-93f2-2ab7d959f633 + UUID: 4f442b9c-237d-4d2d-b549-ee1bdb9842b3 + customizationUUID: fd8595de-1081-4e39-a401-24ffebaa9ed8 + version: '1.0' + name: vGW + description: vGW + type: VF + category: Generic + subcategory: Infrastructure + resourceVendor: huawei + resourceVendorRelease: '1.0' + resourceVendorModelNumber: '' + properties: + vf_module_id: CCVPNvGW + gateway_image_name: gateway_image + private_subnet_lan_id: 265e1457-8eb7-4fe8-a580-fb547656aad1 + skip_post_instantiation_configuration: true + nf_naming: + ecomp_generated_naming: true + multi_stage_design: 'false' + availability_zone_max_count: 1 + vnf_id: vGW_huaweicloud + private_net_id: 1ecdeb3d-5d6d-45c4-a3d2-6cc53372fa8d + gateway_flavor_name: s3.large.4 + gateway_private_ip_lan: 192.168.10.200 + gateway_name: gateway-vm + requirements: + - abstract_gateway.link_gateway_gateway_private_lan_port: + capability: virtual_linkable + node: Generic NeutronNet 0 + capabilities: + abstract_gateway.network.incoming.bytes.rate_gateway_gateway_private_lan_port: + properties: + unit: B/s + description: Average rate of incoming bytes + type: Gauge + category: network + abstract_gateway.disk.device.read.bytes.rate_gateway: + properties: + unit: B/s + description: Average rate of reads + type: Gauge + category: disk + abstract_gateway.disk.capacity_gateway: + properties: + unit: B + description: The amount of disk that the instance can see + type: Gauge + category: disk + abstract_gateway.scalable_gateway: + properties: + max_instances: 1 + min_instances: 1 + abstract_gateway.disk.read.bytes_gateway: + properties: + unit: B + description: Volume of reads + type: Cumulative + category: compute + abstract_gateway.disk.allocation_gateway: + properties: + unit: B + description: The amount of disk occupied by the instance on the host machine + type: Gauge + category: disk + abstract_gateway.disk.device.write.requests_gateway: + properties: + unit: request + description: Number of write requests + type: Cumulative + category: disk + abstract_gateway.disk.device.read.bytes_gateway: + properties: + unit: B + description: Volume of reads + type: Cumulative + category: disk + abstract_gateway.cpu.delta_gateway: + properties: + unit: ns + description: CPU time used since previous datapoint + type: Delta + category: compute + abstract_gateway.network.outgoing.packets.rate_gateway_gateway_private_lan_port: + properties: + unit: packet/s + description: Average rate of outgoing packets + type: Gauge + category: network + abstract_gateway.cpu_gateway: + properties: + unit: ns + description: CPU time used + type: Cumulative + category: compute + abstract_gateway.disk.device.allocation_gateway: + properties: + unit: B + description: The amount of disk per device occupied by the instance on the host machine + type: Gauge + category: disk + abstract_gateway.disk.latency_gateway: + properties: + unit: ms + description: Average disk latency + type: Gauge + category: disk + abstract_gateway.disk.device.read.requests_gateway: + properties: + unit: request + description: Number of read requests + type: Cumulative + category: disk + abstract_gateway.disk.device.read.requests.rate_gateway: + properties: + unit: request/s + description: Average rate of read requests + type: Gauge + category: disk + abstract_gateway.disk.write.requests.rate_gateway: + properties: + unit: request/s + description: Average rate of write requests + type: Gauge + category: compute + abstract_gateway.disk.device.write.bytes.rate_gateway: + properties: + unit: B/s + description: Average rate of writes + type: Gauge + category: disk + abstract_gateway.cpu_util_gateway: + properties: + unit: '%' + description: Average CPU utilization + type: Gauge + category: compute + abstract_gateway.instance_gateway: + properties: + unit: instance + description: Existence of instance + type: Gauge + category: compute + abstract_gateway.network.outpoing.packets_gateway_gateway_private_lan_port: + properties: + unit: packet + description: Number of outgoing packets + type: Cumulative + category: network + abstract_gateway.disk.root.size_gateway: + properties: + unit: GB + description: Size of root disk + type: Gauge + category: compute + abstract_gateway.memory.usage_gateway: + properties: + unit: MB + description: Volume of RAM used by the instance from the amount of its allocated memory + type: Gauge + category: compute + abstract_gateway.network.outgoing.bytes_gateway_gateway_private_lan_port: + properties: + unit: B + description: Number of outgoing bytes + type: Cumulative + category: network + abstract_gateway.network.outgoing.bytes.rate_gateway_gateway_private_lan_port: + properties: + unit: B/s + description: Average rate of outgoing bytes + type: Gauge + category: network + abstract_gateway.disk.device.capacity_gateway: + properties: + unit: B + description: The amount of disk per device that the instance can see + type: Gauge + category: disk + abstract_gateway.disk.iops_gateway: + properties: + unit: count/s + description: Average disk iops + type: Gauge + category: disk + abstract_gateway.disk.write.requests_gateway: + properties: + unit: request + description: Number of write requests + type: Cumulative + category: compute + abstract_gateway.disk.device.write.bytes_gateway: + properties: + unit: B + description: Volume of writes + type: Cumulative + category: disk + abstract_gateway.disk.ephemeral.size_gateway: + properties: + unit: GB + description: Size of ephemeral disk + type: Gauge + category: compute + abstract_gateway.disk.device.write.requests.rate_gateway: + properties: + unit: request/s + description: Average rate of write requests + type: Gauge + category: disk + abstract_gateway.network.incoming.packets.rate_gateway_gateway_private_lan_port: + properties: + unit: packet/s + description: Average rate of incoming packets + type: Gauge + category: network + abstract_gateway.disk.device.iops_gateway: + properties: + unit: count/s + description: Average disk iops per device + type: Gauge + category: disk + abstract_gateway.endpoint_gateway: + properties: + secure: true + abstract_gateway.disk.device.latency_gateway: + properties: + unit: ms + description: Average disk latency per device + type: Gauge + category: disk + abstract_gateway.vcpus_gateway: + properties: + unit: vcpu + description: Number of virtual CPUs allocated to the instance + type: Gauge + category: compute + abstract_gateway.memory_gateway: + properties: + unit: MB + description: Volume of RAM allocated to the instance + type: Gauge + category: compute + abstract_gateway.network.incoming.bytes_gateway_gateway_private_lan_port: + properties: + unit: B + description: Number of incoming bytes + type: Cumulative + category: network + abstract_gateway.disk.read.bytes.rate_gateway: + properties: + unit: B/s + description: Average rate of reads + type: Gauge + category: compute + abstract_gateway.disk.read.requests_gateway: + properties: + unit: request + description: Number of read requests + type: Cumulative + category: compute + abstract_gateway.port_mirroring_gateway_gateway_private_lan_port: + properties: + connection_point: + network_role: + get_input: port_gateway_private_lan_port_network_role + nfc_naming_code: gateway + abstract_gateway.disk.device.usage_gateway: + properties: + unit: B + description: The physical size in bytes of the image container on the host per device + type: Gauge + category: disk + abstract_gateway.disk.write.bytes.rate_gateway: + properties: + unit: B/s + description: Average rate of writes + type: Gauge + category: compute + abstract_gateway.network.incoming.packets_gateway_gateway_private_lan_port: + properties: + unit: packet + description: Number of incoming packets + type: Cumulative + category: network + abstract_gateway.memory.resident_gateway: + properties: + unit: MB + description: Volume of RAM used by the instance on the physical machine + type: Gauge + category: compute + abstract_gateway.disk.usage_gateway: + properties: + unit: B + description: The physical size in bytes of the image container on the host + type: Gauge + category: disk + abstract_gateway.disk.write.bytes_gateway: + properties: + unit: B + description: Volume of writes + type: Cumulative + category: compute + groups: + vcpe0..Vcpe..ar1000v..module-0: + type: org.openecomp.groups.VfModule + metadata: + vfModuleModelName: Vcpe..ar1000v..module-0 + vfModuleModelInvariantUUID: d7719964-c045-4ed3-84d6-20a01db7612f + vfModuleModelUUID: c84ade8a-6e4b-49c7-86e8-0e4fc009f4cd + vfModuleModelVersion: '1' + vfModuleModelCustomizationUUID: 8caeefbd-ab71-40c9-9387-8729d7d9c2de + properties: + min_vf_module_instances: 1 + vf_module_label: ar1000v + max_vf_module_instances: 1 + vf_module_type: Base + isBase: true + initial_count: 1 + volume_group: false + vgw0..Vgw..gateway..module-0: + type: org.openecomp.groups.VfModule + metadata: + vfModuleModelName: Vgw..gateway..module-0 + vfModuleModelInvariantUUID: 8c8c936c-e71c-4bc4-94f7-c5680c9dbc00 + vfModuleModelUUID: ddda7e87-8113-463f-aa27-a60112a4e438 + vfModuleModelVersion: '1' + vfModuleModelCustomizationUUID: ea551d60-f9c9-48f2-9757-b01eb2d26d13 + properties: + min_vf_module_instances: 1 + vf_module_label: gateway + max_vf_module_instances: 1 + vf_module_type: Base + isBase: true + initial_count: 1 + volume_group: false + substitution_mappings: + node_type: org.openecomp.service.Publicns + capabilities: + vgw0.abstract_gateway.disk.allocation_gateway: + - vGW 0 + - abstract_gateway.disk.allocation_gateway + vgw0.abstract_gateway.memory.usage_gateway: + - vGW 0 + - abstract_gateway.memory.usage_gateway + vcpe0.abstract_vcpe.network.outgoing.bytes.rate_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.network.outgoing.bytes.rate_vcpe_vcpe_private_wan_port + vgw0.abstract_gateway.disk.device.write.bytes.rate_gateway: + - vGW 0 + - abstract_gateway.disk.device.write.bytes.rate_gateway + vgw0.abstract_gateway.disk.device.latency_gateway: + - vGW 0 + - abstract_gateway.disk.device.latency_gateway + vgw0.abstract_gateway.network.incoming.bytes.rate_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.network.incoming.bytes.rate_gateway_gateway_private_lan_port + vgw0.abstract_gateway.scalable_gateway: + - vGW 0 + - abstract_gateway.scalable_gateway + vcpe0.abstract_vcpe.host_vcpe: + - vCPE 0 + - abstract_vcpe.host_vcpe + vcpe0.abstract_vcpe.disk.latency_vcpe: + - vCPE 0 + - abstract_vcpe.disk.latency_vcpe + vcpe0.abstract_vcpe.scalable_vcpe: + - vCPE 0 + - abstract_vcpe.scalable_vcpe + vcpe0.abstract_vcpe.disk.device.write.bytes.rate_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.write.bytes.rate_vcpe + vgw0.abstract_gateway.disk.write.requests.rate_gateway: + - vGW 0 + - abstract_gateway.disk.write.requests.rate_gateway + vcpe0.abstract_vcpe.feature_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.feature_vcpe_vcpe_private_wan_port + vcpe0.abstract_vcpe.network.incoming.bytes.rate_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.network.incoming.bytes.rate_vcpe_vcpe_private_lan_port + vcpe0.abstract_vcpe.disk.iops_vcpe: + - vCPE 0 + - abstract_vcpe.disk.iops_vcpe + vcpe0.abstract_vcpe.network.outgoing.packets.rate_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.network.outgoing.packets.rate_vcpe_vcpe_private_wan_port + vcpe0.abstract_vcpe.feature_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.feature_vcpe_vcpe_private_lan_port + vgw0.abstract_gateway.host_gateway: + - vGW 0 + - abstract_gateway.host_gateway + vgw0.abstract_gateway.disk.device.write.requests.rate_gateway: + - vGW 0 + - abstract_gateway.disk.device.write.requests.rate_gateway + vcpe0.abstract_vcpe.port_mirroring_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.port_mirroring_vcpe_vcpe_private_lan_port + vcpe0.abstract_vcpe.network.incoming.bytes_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.network.incoming.bytes_vcpe_vcpe_private_lan_port + vcpe0.abstract_vcpe.disk.device.capacity_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.capacity_vcpe + vcpe0.abstract_vcpe.network.outgoing.bytes_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.network.outgoing.bytes_vcpe_vcpe_private_wan_port + vcpe0.abstract_vcpe.os_vcpe: + - vCPE 0 + - abstract_vcpe.os_vcpe + vgw0.abstract_gateway.disk.usage_gateway: + - vGW 0 + - abstract_gateway.disk.usage_gateway + vcpe0.abstract_vcpe.binding_vcpe: + - vCPE 0 + - abstract_vcpe.binding_vcpe + vgw0.abstract_gateway.network.outgoing.bytes_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.network.outgoing.bytes_gateway_gateway_private_lan_port + vcpe0.abstract_vcpe.binding_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.binding_vcpe_vcpe_private_wan_port + vcpe0.abstract_vcpe.memory.resident_vcpe: + - vCPE 0 + - abstract_vcpe.memory.resident_vcpe + vgw0.abstract_gateway.disk.write.bytes_gateway: + - vGW 0 + - abstract_gateway.disk.write.bytes_gateway + vgw0.abstract_gateway.disk.read.bytes.rate_gateway: + - vGW 0 + - abstract_gateway.disk.read.bytes.rate_gateway + vcpe0.abstract_vcpe.network.incoming.packets.rate_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.network.incoming.packets.rate_vcpe_vcpe_private_lan_port + vgw0.abstract_gateway.disk.root.size_gateway: + - vGW 0 + - abstract_gateway.disk.root.size_gateway + vcpe0.abstract_vcpe.disk.write.requests_vcpe: + - vCPE 0 + - abstract_vcpe.disk.write.requests_vcpe + vcpe0.abstract_vcpe.disk.device.write.bytes_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.write.bytes_vcpe + vcpe0.abstract_vcpe.feature_vcpe: + - vCPE 0 + - abstract_vcpe.feature_vcpe + vcpe0.abstract_vcpe.disk.device.latency_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.latency_vcpe + vgw0.abstract_gateway.cpu_util_gateway: + - vGW 0 + - abstract_gateway.cpu_util_gateway + vgw0.abstract_gateway.network.incoming.packets_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.network.incoming.packets_gateway_gateway_private_lan_port + vgw0.abstract_gateway.disk.device.read.requests.rate_gateway: + - vGW 0 + - abstract_gateway.disk.device.read.requests.rate_gateway + vgw0.abstract_gateway.network.incoming.packets.rate_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.network.incoming.packets.rate_gateway_gateway_private_lan_port + vcpe0.abstract_vcpe.port_mirroring_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.port_mirroring_vcpe_vcpe_private_wan_port + vcpe0.abstract_vcpe.disk.write.bytes_vcpe: + - vCPE 0 + - abstract_vcpe.disk.write.bytes_vcpe + vgw0.abstract_gateway.disk.capacity_gateway: + - vGW 0 + - abstract_gateway.disk.capacity_gateway + vgw0.abstract_gateway.memory_gateway: + - vGW 0 + - abstract_gateway.memory_gateway + vcpe0.abstract_vcpe.cpu_util_vcpe: + - vCPE 0 + - abstract_vcpe.cpu_util_vcpe + vgw0.abstract_gateway.disk.device.write.requests_gateway: + - vGW 0 + - abstract_gateway.disk.device.write.requests_gateway + vgw0.abstract_gateway.vcpus_gateway: + - vGW 0 + - abstract_gateway.vcpus_gateway + vcpe0.abstract_vcpe.disk.ephemeral.size_vcpe: + - vCPE 0 + - abstract_vcpe.disk.ephemeral.size_vcpe + vgw0.abstract_gateway.disk.device.read.bytes_gateway: + - vGW 0 + - abstract_gateway.disk.device.read.bytes_gateway + vgw0.abstract_gateway.disk.device.allocation_gateway: + - vGW 0 + - abstract_gateway.disk.device.allocation_gateway + vgw0.abstract_gateway.disk.device.capacity_gateway: + - vGW 0 + - abstract_gateway.disk.device.capacity_gateway + vcpe0.abstract_vcpe.disk.write.requests.rate_vcpe: + - vCPE 0 + - abstract_vcpe.disk.write.requests.rate_vcpe + vcpe0.abstract_vcpe.disk.usage_vcpe: + - vCPE 0 + - abstract_vcpe.disk.usage_vcpe + vgw0.abstract_gateway.disk.device.iops_gateway: + - vGW 0 + - abstract_gateway.disk.device.iops_gateway + vcpe0.abstract_vcpe.network.outgoing.packets.rate_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.network.outgoing.packets.rate_vcpe_vcpe_private_lan_port + vgw0.abstract_gateway.endpoint_gateway: + - vGW 0 + - abstract_gateway.endpoint_gateway + vcpe0.abstract_vcpe.disk.device.read.bytes.rate_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.read.bytes.rate_vcpe + vcpe0.abstract_vcpe.disk.read.requests_vcpe: + - vCPE 0 + - abstract_vcpe.disk.read.requests_vcpe + vcpe0.abstract_vcpe.disk.read.bytes.rate_vcpe: + - vCPE 0 + - abstract_vcpe.disk.read.bytes.rate_vcpe + vcpe0.abstract_vcpe.disk.device.read.bytes_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.read.bytes_vcpe + vgw0.abstract_gateway.binding_gateway: + - vGW 0 + - abstract_gateway.binding_gateway + vcpe0.abstract_vcpe.network.incoming.packets.rate_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.network.incoming.packets.rate_vcpe_vcpe_private_wan_port + vcpe0.abstract_vcpe.network.outgoing.bytes_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.network.outgoing.bytes_vcpe_vcpe_private_lan_port + vcpe0.abstract_vcpe.cpu.delta_vcpe: + - vCPE 0 + - abstract_vcpe.cpu.delta_vcpe + vcpe0.abstract_vcpe.disk.device.write.requests.rate_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.write.requests.rate_vcpe + vgw0.abstract_gateway.instance_gateway: + - vGW 0 + - abstract_gateway.instance_gateway + vgw0.abstract_gateway.memory.resident_gateway: + - vGW 0 + - abstract_gateway.memory.resident_gateway + vcpe0.abstract_vcpe.network.incoming.packets_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.network.incoming.packets_vcpe_vcpe_private_wan_port + vgw0.abstract_gateway.disk.read.bytes_gateway: + - vGW 0 + - abstract_gateway.disk.read.bytes_gateway + vcpe0.abstract_vcpe.disk.device.iops_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.iops_vcpe + vgw0.abstract_gateway.binding_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.binding_gateway_gateway_private_lan_port + vgw0.abstract_gateway.disk.ephemeral.size_gateway: + - vGW 0 + - abstract_gateway.disk.ephemeral.size_gateway + vgw0.abstract_gateway.feature_gateway: + - vGW 0 + - abstract_gateway.feature_gateway + vcpe0.abstract_vcpe.forwarder_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.forwarder_vcpe_vcpe_private_wan_port + vcpe0.abstract_vcpe.disk.device.allocation_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.allocation_vcpe + vgw0.abstract_gateway.disk.read.requests_gateway: + - vGW 0 + - abstract_gateway.disk.read.requests_gateway + vcpe0.abstract_vcpe.disk.device.write.requests_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.write.requests_vcpe + vgw0.abstract_gateway.disk.device.usage_gateway: + - vGW 0 + - abstract_gateway.disk.device.usage_gateway + vgw0.abstract_gateway.cpu.delta_gateway: + - vGW 0 + - abstract_gateway.cpu.delta_gateway + vgw0.abstract_gateway.network.outgoing.packets.rate_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.network.outgoing.packets.rate_gateway_gateway_private_lan_port + vgw0.abstract_gateway.port_mirroring_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.port_mirroring_gateway_gateway_private_lan_port + vcpe0.abstract_vcpe.forwarder_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.forwarder_vcpe_vcpe_private_lan_port + vcpe0.abstract_vcpe.network.outpoing.packets_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.network.outpoing.packets_vcpe_vcpe_private_lan_port + vcpe0.abstract_vcpe.network.incoming.packets_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.network.incoming.packets_vcpe_vcpe_private_lan_port + vgw0.abstract_gateway.disk.latency_gateway: + - vGW 0 + - abstract_gateway.disk.latency_gateway + vcpe0.abstract_vcpe.disk.read.bytes_vcpe: + - vCPE 0 + - abstract_vcpe.disk.read.bytes_vcpe + vcpe0.abstract_vcpe.attachment_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.attachment_vcpe_vcpe_private_wan_port + vgw0.abstract_gateway.cpu_gateway: + - vGW 0 + - abstract_gateway.cpu_gateway + vcpe0.abstract_vcpe.instance_vcpe: + - vCPE 0 + - abstract_vcpe.instance_vcpe + vcpe0.abstract_vcpe.memory_vcpe: + - vCPE 0 + - abstract_vcpe.memory_vcpe + vgw0.abstract_gateway.feature_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.feature_gateway_gateway_private_lan_port + vgw0.abstract_gateway.disk.device.write.bytes_gateway: + - vGW 0 + - abstract_gateway.disk.device.write.bytes_gateway + vcpe0.abstract_vcpe.network.outpoing.packets_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.network.outpoing.packets_vcpe_vcpe_private_wan_port + vgw0.abstract_gateway.disk.device.read.requests_gateway: + - vGW 0 + - abstract_gateway.disk.device.read.requests_gateway + vgw0.abstract_gateway.disk.write.requests_gateway: + - vGW 0 + - abstract_gateway.disk.write.requests_gateway + vgw0.abstract_gateway.os_gateway: + - vGW 0 + - abstract_gateway.os_gateway + vgw0.abstract_gateway.network.outgoing.bytes.rate_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.network.outgoing.bytes.rate_gateway_gateway_private_lan_port + vgw0.abstract_gateway.network.outpoing.packets_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.network.outpoing.packets_gateway_gateway_private_lan_port + vcpe0.abstract_vcpe.disk.write.bytes.rate_vcpe: + - vCPE 0 + - abstract_vcpe.disk.write.bytes.rate_vcpe + vgw0.abstract_gateway.disk.write.bytes.rate_gateway: + - vGW 0 + - abstract_gateway.disk.write.bytes.rate_gateway + vcpe0.abstract_vcpe.network.incoming.bytes.rate_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.network.incoming.bytes.rate_vcpe_vcpe_private_wan_port + vcpe0.abstract_vcpe.cpu_vcpe: + - vCPE 0 + - abstract_vcpe.cpu_vcpe + vcpe0.abstract_vcpe.disk.allocation_vcpe: + - vCPE 0 + - abstract_vcpe.disk.allocation_vcpe + vcpe0.abstract_vcpe.disk.device.read.requests.rate_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.read.requests.rate_vcpe + vgw0.abstract_gateway.network.incoming.bytes_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.network.incoming.bytes_gateway_gateway_private_lan_port + vcpe0.abstract_vcpe.disk.device.read.requests_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.read.requests_vcpe + vgw0.abstract_gateway.disk.device.read.bytes.rate_gateway: + - vGW 0 + - abstract_gateway.disk.device.read.bytes.rate_gateway + vcpe0.abstract_vcpe.binding_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.binding_vcpe_vcpe_private_lan_port + vgw0.abstract_gateway.forwarder_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.forwarder_gateway_gateway_private_lan_port + genericneutronnet0.virtual_linkable: + - Generic NeutronNet 0 + - virtual_linkable + vcpe0.abstract_vcpe.network.incoming.bytes_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.network.incoming.bytes_vcpe_vcpe_private_wan_port + vcpe0.abstract_vcpe.disk.device.usage_vcpe: + - vCPE 0 + - abstract_vcpe.disk.device.usage_vcpe + genericneutronnet0.feature: + - Generic NeutronNet 0 + - feature + vcpe0.abstract_vcpe.network.outgoing.bytes.rate_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.network.outgoing.bytes.rate_vcpe_vcpe_private_lan_port + vcpe0.abstract_vcpe.disk.root.size_vcpe: + - vCPE 0 + - abstract_vcpe.disk.root.size_vcpe + vcpe0.abstract_vcpe.vcpus_vcpe: + - vCPE 0 + - abstract_vcpe.vcpus_vcpe + vcpe0.abstract_vcpe.endpoint_vcpe: + - vCPE 0 + - abstract_vcpe.endpoint_vcpe + vgw0.abstract_gateway.attachment_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.attachment_gateway_gateway_private_lan_port + vcpe0.abstract_vcpe.attachment_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.attachment_vcpe_vcpe_private_lan_port + vcpe0.abstract_vcpe.memory.usage_vcpe: + - vCPE 0 + - abstract_vcpe.memory.usage_vcpe + vcpe0.abstract_vcpe.disk.capacity_vcpe: + - vCPE 0 + - abstract_vcpe.disk.capacity_vcpe + vgw0.abstract_gateway.disk.iops_gateway: + - vGW 0 + - abstract_gateway.disk.iops_gateway + requirements: + vcpe0.abstract_vcpe.dependency_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.dependency_vcpe_vcpe_private_wan_port + vcpe0.abstract_vcpe.link_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.link_vcpe_vcpe_private_lan_port + vgw0.abstract_gateway.local_storage_gateway: + - vGW 0 + - abstract_gateway.local_storage_gateway + genericneutronnet0.dependency: + - Generic NeutronNet 0 + - dependency + vcpe0.abstract_vcpe.local_storage_vcpe: + - vCPE 0 + - abstract_vcpe.local_storage_vcpe + vcpe0.abstract_vcpe.dependency_vcpe_vcpe_private_lan_port: + - vCPE 0 + - abstract_vcpe.dependency_vcpe_vcpe_private_lan_port + vgw0.abstract_gateway.dependency_gateway: + - vGW 0 + - abstract_gateway.dependency_gateway + vcpe0.abstract_vcpe.dependency_vcpe: + - vCPE 0 + - abstract_vcpe.dependency_vcpe + vgw0.abstract_gateway.dependency_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.dependency_gateway_gateway_private_lan_port + vcpe0.abstract_vcpe.link_vcpe_vcpe_private_wan_port: + - vCPE 0 + - abstract_vcpe.link_vcpe_vcpe_private_wan_port + vgw0.abstract_gateway.link_gateway_gateway_private_lan_port: + - vGW 0 + - abstract_gateway.link_gateway_gateway_private_lan_port diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/ar1000v.env b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/ar1000v.env new file mode 100644 index 0000000000..f0cc985078 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/ar1000v.env @@ -0,0 +1,10 @@ +parameters: + private_net_id: "1ecdeb3d-5d6d-45c4-a3d2-6cc53372fa8d" + private_subnet_lan_id: "265e1457-8eb7-4fe8-a580-fb547656aad1" + private_subnet_wan_id: "86048e4e-861e-47c9-ae55-a5531b747e36" + vcpe_flavor_name: "vCPE_flavor" + vcpe_image_name: "vCPE_images" + vcpe_name: "ar1000v" + vcpe_private_ip_lan: "192.168.10.250" + vf_module_id: "vCPEAR1000V" + vnf_id: "vCPE_huaweicloud" diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/ar1000v.yaml b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/ar1000v.yaml new file mode 100644 index 0000000000..b4d0fa7a6b --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/ar1000v.yaml @@ -0,0 +1,103 @@ +########################################################################## +# +#==================LICENSE_START========================================== +# +# +# Copyright 2017 Huawei Technologies Co., Ltd. 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============================================ + +heat_template_version: 2013-05-23 + +description: Heat template to deploy Huawei AR1000V vCPE + +############## +# # +# PARAMETERS # +# # +############## + +parameters: + vcpe_name: + type: string + label: name + description: name to be used for compute instance + vcpe_image_name: + type: string + label: Image name or ID + description: Image to be used for compute instance + vcpe_flavor_name: + type: string + label: Flavor + description: Type of instance (flavor) to be used + private_net_id: + type: string + label: Private oam network name or ID + description: Private network that enables remote connection to VNF + private_subnet_wan_id: + type: string + label: Private wan sub-network name or ID + description: Private wan sub-network that enables remote connection to VNF + private_subnet_lan_id: + type: string + label: Private lan sub-network name or ID + description: Private lan sub-network that enables remote connection to VNF + vcpe_private_ip_lan: + type: string + label: vCPE lan private IP address + description: Private IP address that is assigned to the vCPE lan port + vnf_id: + type: string + label: VNF ID + description: The VNF ID is provided by ECOMP + vf_module_id: + type: string + label: VF module id + description: the vf module id is provided by ECOMP +############# +# # +# RESOURCES # +# # +############# + +resources: +# For the floating IP in Public cloud , floating_network_id is not needed + vCPE_oam_floating_ip: + type: OS::Neutron::FloatingIP + properties: + floating_network_id: { get_param: private_net_id} + port_id: { get_resource: vcpe_private_wan_port} + + vcpe_private_wan_port: + type: OS::Neutron::Port + properties: + network: { get_param: private_net_id } + fixed_ips: [{"subnet": { get_param: private_subnet_wan_id }}] + + vcpe_private_lan_port: + type: OS::Neutron::Port + properties: + network: { get_param: private_net_id } + fixed_ips: [{"subnet": { get_param: private_subnet_lan_id }, "ip_address": { get_param: vcpe_private_ip_lan }}] + + ar_1000v: + type: OS::Nova::Server + properties: + image: { get_param: vcpe_image_name } + flavor: { get_param: vcpe_flavor_name } + name: { get_param: vcpe_name } + networks: + - port: { get_resource: vcpe_private_wan_port } + - port: { get_resource: vcpe_private_lan_port } + metadata: { vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vcpe0_modules.json b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vcpe0_modules.json new file mode 100644 index 0000000000..3376b1bf40 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vcpe0_modules.json @@ -0,0 +1,25 @@ +[ + { + "vfModuleModelName": "Vcpe..ar1000v..module-0", + "vfModuleModelInvariantUUID": "d7719964-c045-4ed3-84d6-20a01db7612f", + "vfModuleModelVersion": "1", + "vfModuleModelUUID": "c84ade8a-6e4b-49c7-86e8-0e4fc009f4cd", + "vfModuleModelCustomizationUUID": "8caeefbd-ab71-40c9-9387-8729d7d9c2de", + "isBase": true, + "artifacts": [ + "12dcc618-20f2-4f15-ab00-c549b96b3910", + "5821b043-ba50-49ef-b739-61b0896050f2" + ], + "properties": { + "min_vf_module_instances": "1", + "vf_module_label": "ar1000v", + "max_vf_module_instances": "1", + "vfc_list": "", + "vf_module_description": "", + "vf_module_type": "Base", + "availability_zone_count": "", + "volume_group": "false", + "initial_count": "1" + } + } +]
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vendor-license-model.xml b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vendor-license-model.xml new file mode 100644 index 0000000000..a10a5b2bb1 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vendor-license-model.xml @@ -0,0 +1 @@ +<vendor-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>huawei</vendor-name><entitlement-pool-list><entitlement-pool><entitlement-pool-invariant-uuid>d948f2a8354d41ef9f8e5819adccfd0d</entitlement-pool-invariant-uuid><entitlement-pool-uuid>86BA71BDC4EC44DB8099115BC7202F3A</entitlement-pool-uuid><version>1.0</version><name>test</name><description/><increments/><manufacturer-reference-number>1234</manufacturer-reference-number><threshold-value><unit>Absolute</unit><value>80</value></threshold-value><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-08-23T00:00:00Z</start-date><expiry-date>2020-01-04T23:59:59Z</expiry-date></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><version>1.0</version><name>test</name><description/><type>One_Time</type><increments/><manufacturerReferenceNumber>123</manufacturerReferenceNumber><license-key-group-invariant-uuid>8b3c7d985b1541518fe0dfc8e40d5116</license-key-group-invariant-uuid><license-key-group-uuid>85FF42563DAA4111BAB854264F1D2898</license-key-group-uuid><threshold-value><unit>Percentage</unit><value>88</value></threshold-value><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-08-23T00:00:00Z</start-date><expiry-date>2019-09-21T23:59:59Z</expiry-date></license-key-group></license-key-group-list></vendor-license-model>
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vf-license-model.xml b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vf-license-model.xml new file mode 100644 index 0000000000..ed1575b7f5 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vcpe0/vf-license-model.xml @@ -0,0 +1 @@ +<vf-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>huawei</vendor-name><vf-id>c1aad4e55922438f956ff97b91c5446d</vf-id><feature-group-list><feature-group><entitlement-pool-list><entitlement-pool><name>test</name><description/><increments/><entitlement-pool-invariant-uuid>d948f2a8354d41ef9f8e5819adccfd0d</entitlement-pool-invariant-uuid><entitlement-pool-uuid>86BA71BDC4EC44DB8099115BC7202F3A</entitlement-pool-uuid><manufacturer-reference-number>1234</manufacturer-reference-number><threshold-value><unit>Absolute</unit><value>80</value></threshold-value><version>1.0</version><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-08-23T00:00:00Z</start-date><expiry-date>2020-01-04T23:59:59Z</expiry-date></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><name>test</name><description/><type>One_Time</type><increments/><license-key-group-invariant-uuid>8b3c7d985b1541518fe0dfc8e40d5116</license-key-group-invariant-uuid><license-key-group-uuid>85FF42563DAA4111BAB854264F1D2898</license-key-group-uuid><manufacturer-reference-number>123</manufacturer-reference-number><threshold-value><unit>Percentage</unit><value>88</value></threshold-value><version>1.0</version><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-08-23T00:00:00Z</start-date><expiry-date>2019-09-21T23:59:59Z</expiry-date></license-key-group></license-key-group-list><name>testgroup</name><feature-group-uuid>ae361d4e44ca48e68f734abb531e19af</feature-group-uuid><description/><part-number>123</part-number></feature-group></feature-group-list></vf-license-model>
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/gateway.env b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/gateway.env new file mode 100644 index 0000000000..a995d16b31 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/gateway.env @@ -0,0 +1,9 @@ +parameters: + gateway_flavor_name: "s3.large.4" + gateway_image_name: "gateway_image" + gateway_name: "gateway-vm" + gateway_private_ip_lan: "192.168.10.200" + private_net_id: "1ecdeb3d-5d6d-45c4-a3d2-6cc53372fa8d" + private_subnet_lan_id: "265e1457-8eb7-4fe8-a580-fb547656aad1" + vf_module_id: "CCVPNvGW" + vnf_id: "vGW_huaweicloud" diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/gateway.yaml b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/gateway.yaml new file mode 100644 index 0000000000..2d72a1c183 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/gateway.yaml @@ -0,0 +1,109 @@ +########################################################################## +# +#==================LICENSE_START========================================== +# +# +# Copyright 2017 Huawei Technologies Co., Ltd. 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============================================ + +heat_template_version: 2013-05-23 + +description: Heat template to deploy CCVPN gateway instance + +############## +# # +# PARAMETERS # +# # +############## + +parameters: + gateway_name: + type: string + label: name + description: name to be used for compute instance + gateway_image_name: + type: string + label: Image name or ID + description: Image to be used for compute instance + gateway_flavor_name: + type: string + label: Flavor + description: Type of instance (flavor) to be used + private_net_id: + type: string + label: Private oam network name or ID + description: Private network that enables remote connection to VNF +# private_subnet_wan_id: +# type: string +# label: Private wan sub-network name or ID +# description: Private wan sub-network that enables remote connection to VNF + private_subnet_lan_id: + type: string + label: Private lan sub-network name or ID + description: Private lan sub-network that enables remote connection to VNF + gateway_private_ip_lan: + type: string + label: gateway lan private IP address + description: Private IP address that is assigned to the gateway lan port + vnf_id: + type: string + label: VNF ID + description: The VNF ID is provided by ECOMP + vf_module_id: + type: string + label: VF module id + description: the vf module id is provided by ECOMP +############# +# # +# RESOURCES # +# # +############# + +resources: +# For the floating IP in Public cloud , floating_network_id is not needed + gateway_oam_floating_ip: + type: OS::Neutron::FloatingIP + properties: + floating_network_id: { get_param: private_net_id} + port_id: { get_resource: gateway_private_lan_port} + + #gateway_private_wan_port: + # type: OS::Neutron::Port + # properties: + # network: { get_param: private_net_id } + # fixed_ips: [{"subnet": { get_param: private_subnet_wan_id }}] + + gateway_private_lan_port: + type: OS::Neutron::Port + properties: + network: { get_param: private_net_id } + fixed_ips: [{"subnet": { get_param: private_subnet_lan_id }, "ip_address": { get_param: gateway_private_ip_lan }}] + + gateway_instacne: + type: OS::Nova::Server + properties: + image: { get_param: gateway_image_name } + flavor: { get_param: gateway_flavor_name } + name: { get_param: gateway_name } + networks: + #- port: { get_resource: gateway_private_wan_port } + - port: { get_resource: gateway_private_lan_port } + metadata: { vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} + user_data: | + #!/bin/bash + docker start msb_consul + docker start msb_discovery + docker start msb_internal_apigateway + #user_data_format: HEAT_CFNTOOLS/RAW
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vendor-license-model.xml b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vendor-license-model.xml new file mode 100644 index 0000000000..a10a5b2bb1 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vendor-license-model.xml @@ -0,0 +1 @@ +<vendor-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>huawei</vendor-name><entitlement-pool-list><entitlement-pool><entitlement-pool-invariant-uuid>d948f2a8354d41ef9f8e5819adccfd0d</entitlement-pool-invariant-uuid><entitlement-pool-uuid>86BA71BDC4EC44DB8099115BC7202F3A</entitlement-pool-uuid><version>1.0</version><name>test</name><description/><increments/><manufacturer-reference-number>1234</manufacturer-reference-number><threshold-value><unit>Absolute</unit><value>80</value></threshold-value><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-08-23T00:00:00Z</start-date><expiry-date>2020-01-04T23:59:59Z</expiry-date></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><version>1.0</version><name>test</name><description/><type>One_Time</type><increments/><manufacturerReferenceNumber>123</manufacturerReferenceNumber><license-key-group-invariant-uuid>8b3c7d985b1541518fe0dfc8e40d5116</license-key-group-invariant-uuid><license-key-group-uuid>85FF42563DAA4111BAB854264F1D2898</license-key-group-uuid><threshold-value><unit>Percentage</unit><value>88</value></threshold-value><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-08-23T00:00:00Z</start-date><expiry-date>2019-09-21T23:59:59Z</expiry-date></license-key-group></license-key-group-list></vendor-license-model>
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vf-license-model.xml b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vf-license-model.xml new file mode 100644 index 0000000000..a4a84cc4c0 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vf-license-model.xml @@ -0,0 +1 @@ +<vf-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>huawei</vendor-name><vf-id>8c1c2b40525942aca038a4528ce3bb4e</vf-id><feature-group-list><feature-group><entitlement-pool-list><entitlement-pool><name>test</name><description/><increments/><entitlement-pool-invariant-uuid>d948f2a8354d41ef9f8e5819adccfd0d</entitlement-pool-invariant-uuid><entitlement-pool-uuid>86BA71BDC4EC44DB8099115BC7202F3A</entitlement-pool-uuid><manufacturer-reference-number>1234</manufacturer-reference-number><threshold-value><unit>Absolute</unit><value>80</value></threshold-value><version>1.0</version><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-08-23T00:00:00Z</start-date><expiry-date>2020-01-04T23:59:59Z</expiry-date></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><name>test</name><description/><type>One_Time</type><increments/><license-key-group-invariant-uuid>8b3c7d985b1541518fe0dfc8e40d5116</license-key-group-invariant-uuid><license-key-group-uuid>85FF42563DAA4111BAB854264F1D2898</license-key-group-uuid><manufacturer-reference-number>123</manufacturer-reference-number><threshold-value><unit>Percentage</unit><value>88</value></threshold-value><version>1.0</version><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-08-23T00:00:00Z</start-date><expiry-date>2019-09-21T23:59:59Z</expiry-date></license-key-group></license-key-group-list><name>testgroup</name><feature-group-uuid>ae361d4e44ca48e68f734abb531e19af</feature-group-uuid><description/><part-number>123</part-number></feature-group></feature-group-list></vf-license-model>
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vgw0_modules.json b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vgw0_modules.json new file mode 100644 index 0000000000..1a1badec5e --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/public-ns/vgw0/vgw0_modules.json @@ -0,0 +1,25 @@ +[ + { + "vfModuleModelName": "Vgw..gateway..module-0", + "vfModuleModelInvariantUUID": "8c8c936c-e71c-4bc4-94f7-c5680c9dbc00", + "vfModuleModelVersion": "1", + "vfModuleModelUUID": "ddda7e87-8113-463f-aa27-a60112a4e438", + "vfModuleModelCustomizationUUID": "ea551d60-f9c9-48f2-9757-b01eb2d26d13", + "isBase": true, + "artifacts": [ + "60d55796-212c-4c66-8af5-63964d636ae4", + "9df0452f-826c-4287-9a2d-ca0095339866" + ], + "properties": { + "min_vf_module_instances": "1", + "vf_module_label": "gateway", + "max_vf_module_instances": "1", + "vfc_list": "", + "vf_module_description": "", + "vf_module_type": "Base", + "availability_zone_count": "", + "volume_group": "false", + "initial_count": "1" + } + } +]
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-rescust/base_vcpe_vgw.env b/asdc-controller/src/test/resources/resource-examples/vcpe-rescust/base_vcpe_vgw.env new file mode 100644 index 0000000000..5cdbc9b882 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vcpe-rescust/base_vcpe_vgw.env @@ -0,0 +1,27 @@ +parameters: + cloud_env: "PUT THE CLOUD PROVIDED HERE (openstack or rackspace)" + cpe_public_net_cidr: "10.2.0.0/24" + cpe_public_net_id: "zdfw1cpe01_public" + cpe_public_subnet_id: "zdfw1cpe01_sub_public" + dcae_collector_ip: "10.0.4.1" + dcae_collector_port: "8081" + key_name: "vgw_key" + mux_gw_private_net_cidr: "10.5.0.0/24" + mux_gw_private_net_id: "zdfw1muxgw01_private" + mux_gw_private_subnet_id: "zdfw1muxgw01_sub_private" + mux_ip_addr: "10.5.0.20" + nexus_artifact_repo: "https://nexus.onap.org" + onap_private_net_cidr: "10.0.0.0/16" + onap_private_net_id: "PUT THE ONAP PRIVATE NETWORK NAME HERE" + onap_private_subnet_id: "PUT THE ONAP PRIVATE SUBNETWORK NAME HERE" + pub_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQXYJYYi3/OUZXUiCYWdtc7K0m5C0dJKVxPG0eI8EWZrEHYdfYe6WoTSDJCww+1qlBSpA5ac/Ba4Wn9vh+lR1vtUKkyIC/nrYb90ReUd385Glkgzrfh5HdR5y5S2cL/Frh86lAn9r6b3iWTJD8wBwXFyoe1S2nMTOIuG4RPNvfmyCTYVh8XTCCE8HPvh3xv2r4egawG1P4Q4UDwk+hDBXThY2KS8M5/8EMyxHV0ImpLbpYCTBA6KYDIRtqmgS6iKyy8v2D1aSY5mc9J0T5t9S2Gv+VZQNWQDDKNFnxqYaAo1uEoq/i1q63XC5AD3ckXb2VT6dp23BQMdDfbHyUWfJN" + public_net_id: "PUT THE PUBLIC NETWORK ID HERE" + script_version: "1.5.0-SNAPSHOT" + vcpe_flavor_name: "PUT THE FLAVOR NAME HERE (MEDIUM FLAVOR SUGGESTED)" + vcpe_image_name: "PUT THE IMAGE NAME HERE (Ubuntu 1604 SUGGESTED)" + vf_module_id: "vCPE_Customer_GW" + vg_vgmux_tunnel_vni: 100 + vgw_name_0: "zdcpe1cpe01gw01" + vgw_private_ip_0: "10.5.0.21" + vgw_private_ip_1: "10.0.101.30" + vnf_id: "vCPE_Infrastructure_GW_demo_app" diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-rescust/base_vcpe_vgw.yaml b/asdc-controller/src/test/resources/resource-examples/vcpe-rescust/base_vcpe_vgw.yaml new file mode 100644 index 0000000000..74fa490b23 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vcpe-rescust/base_vcpe_vgw.yaml @@ -0,0 +1,243 @@ +########################################################################## +# +#==================LICENSE_START========================================== +# +# +# Copyright 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============================================ +# +# ECOMP is a trademark and service mark of AT&T Intellectual Property. +# +########################################################################## + +heat_template_version: 2013-05-23 + +description: Heat template to deploy vCPE vGateway (vG) + +############## +# # +# PARAMETERS # +# # +############## + +parameters: + vcpe_image_name: + type: string + label: Image name or ID + description: Image to be used for compute instance + vcpe_flavor_name: + type: string + label: Flavor + description: Type of instance (flavor) to be used + public_net_id: + type: string + label: Public network name or ID + description: Public network that enables remote connection to VNF + mux_gw_private_net_id: + type: string + label: vGMUX private network name or ID + description: Private network that connects vGMUX to vGWs + mux_gw_private_subnet_id: + type: string + label: vGMUX private sub-network name or ID + description: vGMUX private sub-network name or ID + mux_gw_private_net_cidr: + type: string + label: vGMUX private network CIDR + description: The CIDR of the vGMUX private network + onap_private_net_id: + type: string + label: ONAP management network name or ID + description: Private network that connects ONAP components and the VNF + onap_private_subnet_id: + type: string + label: ONAP management sub-network name or ID + description: Private sub-network that connects ONAP components and the VNF + onap_private_net_cidr: + type: string + label: ONAP private network CIDR + description: The CIDR of the protected private network + cpe_public_net_id: + type: string + label: vCPE network that emulates internetmanagement name or ID + description: Private network that connects vGW to emulated internet + cpe_public_subnet_id: + type: string + label: vCPE Public subnet + description: vCPE Public subnet + cpe_public_net_cidr: + type: string + label: vCPE public network CIDR + description: The CIDR of the vCPE public + vgw_private_ip_0: + type: string + label: vGW private IP address towards the vGMUX + description: Private IP address that is assigned to the vGW to communicate with vGMUX + vgw_private_ip_1: + type: string + label: vGW private IP address towards the ONAP management network + description: Private IP address that is assigned to the vGW to communicate with ONAP components + ## VPP will use DHCP to get the vgw_private_ip_2 on the CPE_PUBLIC subnet + #vgw_private_ip_2: + # type: string + # label: vGW private IP address towards the vCPE public network + # description: Private IP address that is assigned to the vGW to communicate with vCPE public network + vgw_name_0: + type: string + label: vGW name + description: Name of the vGW + vnf_id: + type: string + label: VNF ID + description: The VNF ID is provided by ONAP + vf_module_id: + type: string + label: vCPE module ID + description: The vCPE Module ID is provided by ONAP + dcae_collector_ip: + type: string + label: DCAE collector IP address + description: IP address of the DCAE collector + dcae_collector_port: + type: string + label: DCAE collector port + description: Port of the DCAE collector + key_name: + type: string + label: Key pair name + description: Public/Private key pair name + pub_key: + type: string + label: Public key + description: Public key to be installed on the compute instance + script_version: + type: string + label: Script version number + description: Version number of the scripts that install the vGW + nexus_artifact_repo: + type: string + description: Root URL for the Nexus repository for Maven artifacts. + default: "https://nexus.onap.org" + cloud_env: + type: string + label: Cloud environment + description: Cloud environment (e.g., openstack, rackspace) + mux_ip_addr: + type: string + label: vGMUX IP address + description: IP address of vGMUX + vg_vgmux_tunnel_vni: + type: number + label: vG-vGMUX tunnel vni + description: vni value of vG-vGMUX vxlan tunnel + +############# +# # +# RESOURCES # +# # +############# + +resources: + + random-str: + type: OS::Heat::RandomString + properties: + length: 4 + + my_keypair: + type: OS::Nova::KeyPair + properties: + name: + str_replace: + template: base_rand + params: + base: { get_param: key_name } + rand: { get_resource: random-str } + public_key: { get_param: pub_key } + save_private_key: false + + # Virtual GW Instantiation + vgw_private_0_port: + type: OS::Neutron::Port + properties: + network: { get_param: mux_gw_private_net_id } + fixed_ips: [{"subnet": { get_param: mux_gw_private_subnet_id }, "ip_address": { get_param: vgw_private_ip_0 }}] + + vgw_private_1_port: + type: OS::Neutron::Port + properties: + network: { get_param: onap_private_net_id } + fixed_ips: [{"subnet": { get_param: onap_private_subnet_id }, "ip_address": { get_param: vgw_private_ip_1 }}] + + vgw_private_2_port: + type: OS::Neutron::Port + properties: + network: { get_param: cpe_public_net_id} + fixed_ips: [{"subnet": { get_param: cpe_public_subnet_id }}] + ##fixed_ips: [{"subnet": { get_param: cpe_public_subnet_id }, "ip_address": { get_param: vgw_private_ip_2 }}] + + vgw_0: + type: OS::Nova::Server + properties: + image: { get_param: vcpe_image_name } + flavor: { get_param: vcpe_flavor_name } + name: { get_param: vgw_name_0 } + key_name: { get_resource: my_keypair } + networks: + - network: { get_param: public_net_id } + - port: { get_resource: vgw_private_0_port } + - port: { get_resource: vgw_private_1_port } + - port: { get_resource: vgw_private_2_port } + metadata: {vnf_id: { get_param: vnf_id }, vf_module_id: { get_param: vf_module_id }} + user_data_format: RAW + user_data: + str_replace: + params: + __mux_gw_private_net_ipaddr__ : { get_param: vgw_private_ip_0 } + __oam_ipaddr__ : { get_param: vgw_private_ip_1 } + __oam_cidr__ : { get_param: onap_private_net_cidr } + __cpe_public_net_cidr__ : { get_param: cpe_public_net_cidr } + __mux_gw_private_net_cidr__ : { get_param: mux_gw_private_net_cidr } + __script_version__ : { get_param: script_version } + __cloud_env__ : { get_param: cloud_env } + __mux_ip_addr__: { get_param: mux_ip_addr } + __vg_vgmux_tunnel_vni__: { get_param: vg_vgmux_tunnel_vni } + __nexus_artifact_repo__: { get_param: nexus_artifact_repo } + template: | + #!/bin/bash + + # Create configuration files + mkdir /opt/config + echo "__oam_ipaddr__" > /opt/config/oam_ipaddr.txt + echo "__oam_cidr__" > /opt/config/oam_cidr.txt + echo "__cpe_public_net_cidr__" > /opt/config/cpe_public_net_cidr.txt + echo "__mux_gw_private_net_ipaddr__" > /opt/config/mux_gw_private_net_ipaddr.txt + echo "__mux_gw_private_net_cidr__" > /opt/config/mux_gw_private_net_cidr.txt + echo "__script_version__" > /opt/config/script_version.txt + echo "__cloud_env__" > /opt/config/cloud_env.txt + echo "__mux_ip_addr__" > /opt/config/mux_ip_addr.txt + echo "__vg_vgmux_tunnel_vni__" > /opt/config/vg_vgmux_tunnel_vni.txt + echo "__nexus_artifact_repo__" > /opt/config/nexus_artifact_repo.txt + + # Download and run install script + apt-get update + apt-get -y install unzip + if [[ "__script_version__" =~ "SNAPSHOT" ]]; then REPO=snapshots; else REPO=releases; fi + curl -k -L "__nexus_artifact_repo__/service/local/artifact/maven/redirect?r=${REPO}&g=org.onap.demo.vnf.vcpe&a=vcpe-scripts&e=zip&v=__script_version__" -o /opt/vcpe-scripts-__script_version__.zip + unzip -j /opt/vcpe-scripts-__script_version__.zip -d /opt v_gw_install.sh + cd /opt + chmod +x v_gw_install.sh + ./v_gw_install.sh + diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-rescust/demo-vcpe-rescust-notification.json b/asdc-controller/src/test/resources/resource-examples/vcpe-rescust/demo-vcpe-rescust-notification.json new file mode 100644 index 0000000000..f4f4fcc0de --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vcpe-rescust/demo-vcpe-rescust-notification.json @@ -0,0 +1,108 @@ +{ + "distributionID": "5ea97d50-9e1d-4b2c-aa47-2523e35e2120", + "serviceName": "vCPEResCust 2019-10-01 _2364", + "serviceVersion": "1.0", + "serviceUUID": "d3aac917-543d-4421-b6d7-ba2b65884eb7", + "serviceDescription": "catalog service description", + "serviceInvariantUUID": "d0568a10-a0e0-4efa-b698-ad3772f2e30f", + "resources": [{ + "resourceInstanceName": "TunnelXConn_2019-10-01 03:23:27.409 0", + "resourceName": "TunnelXConn_2019-10-01 03:23:27.409", + "resourceVersion": "1.0", + "resoucreType": "VF", + "resourceUUID": "629f9662-55bb-430c-8f22-5204c37c9898", + "resourceInvariantUUID": "3a367ac8-5dff-4325-a0e7-9e0299d22152", + "resourceCustomizationUUID": "4e0249f0-5118-4323-b5e9-0783ad1123ba", + "category": "Allotted Resource", + "subcategory": "TunnelXConn", + "artifacts": [] + }, { + "resourceInstanceName": "BRG_2019-10-01 03:23:27.409 0", + "resourceName": "BRG_2019-10-01 03:23:27.409", + "resourceVersion": "1.0", + "resoucreType": "VF", + "resourceUUID": "abafad1c-47fc-4d30-a079-be14871f0c6a", + "resourceInvariantUUID": "05a482b5-ec0d-45cb-ae95-397ce6765c9e", + "resourceCustomizationUUID": "aff592e4-cfc7-43ce-abea-f026b56995ab", + "category": "Allotted Resource", + "subcategory": "BRG", + "artifacts": [] + }, { + "resourceInstanceName": "vCPE_vgw bf175ab0-4fa2 0", + "resourceName": "vCPE_vgw bf175ab0-4fa2", + "resourceVersion": "1.0", + "resoucreType": "VF", + "resourceUUID": "df1ce337-78b2-4e43-afb8-081d5ca175fc", + "resourceInvariantUUID": "1d2b0362-af54-43b9-9a5b-2dba408742b2", + "resourceCustomizationUUID": "6f2c39b3-d14f-4575-97b3-c93a7620591e", + "category": "Generic", + "subcategory": "Abstract", + "artifacts": [{ + "artifactName": "vf-license-model.xml", + "artifactType": "VF_LICENSE", + "artifactURL": "/vf-license-model.xml", + "artifactChecksum": "YjBlNjhjNGU0ZjZkYzUwYjlhODg2NDMzZjk0MGNjMzM\u003d", + "artifactDescription": "VF license file", + "artifactTimeout": 120, + "artifactUUID": "2f362774-ac17-48a9-9c93-632b661ea689", + "artifactVersion": "1" + }, { + "artifactName": "vcpe_vgwbf175ab04fa20_modules.json", + "artifactType": "VF_MODULES_METADATA", + "artifactURL": "/vcpe_vgwbf175ab04fa20_modules.json", + "artifactChecksum": "NTg2NjQxOWNkNmNjY2EzY2M3ZGJjM2YyOTI2ZjlkNzU\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "b02ab2a2-a657-44c4-ae88-578fe0caa30d", + "artifactVersion": "1" + }, { + "artifactName": "base_vcpe_vgw.yaml", + "artifactType": "HEAT", + "artifactURL": "/base_vcpe_vgw.yaml", + "artifactChecksum": "OTI1ODIwZTFhMjc3ZDVhYWU4ZjJjMTEzZGZiZTY4Zjg\u003d", + "artifactDescription": "created from csar", + "artifactTimeout": 120, + "artifactUUID": "e3a33b76-1f8a-44ba-808b-8a4c79e4b44a", + "artifactVersion": "2" + }, { + "artifactName": "vendor-license-model.xml", + "artifactType": "VENDOR_LICENSE", + "artifactURL": "/vendor-license-model.xml", + "artifactChecksum": "YThkMTY5ZWU5MDg5YmI5MWNiY2M5OTg1MTdjMzQzNWM\u003d", + "artifactDescription": " Vendor license file", + "artifactTimeout": 120, + "artifactUUID": "3eae4c31-394f-497b-83e9-110e87e40964", + "artifactVersion": "1" + }, { + "artifactName": "base_vcpe_vgw.env", + "artifactType": "HEAT_ENV", + "artifactURL": "/base_vcpe_vgw.env", + "artifactChecksum": "MTY4ZDUxYTUwNjExN2JhZjQzNGE5ZWQ3MGUxM2IyYWM\u003d", + "artifactDescription": "Auto-generated HEAT Environment deployment artifact", + "artifactTimeout": 120, + "artifactUUID": "9b73763b-0f60-47c3-8939-cf2f819bc75a", + "artifactVersion": "2", + "generatedFromUUID": "e3a33b76-1f8a-44ba-808b-8a4c79e4b44a" + }] + }], + "serviceArtifacts": [{ + "artifactName": "service-Vcperescust201910012364-template.yml", + "artifactType": "TOSCA_TEMPLATE", + "artifactURL": "/service-Vcperescust201910012364-template.yml", + "artifactChecksum": "ZDRmZTZkNTkyNTBhMjM1Nzk1NzBiMjdkYmVjMWJiZjI\u003d", + "artifactDescription": "TOSCA representation of the asset", + "artifactTimeout": 0, + "artifactUUID": "50f4eed5-3330-46c3-89e8-a56d2de4354b", + "artifactVersion": "1" + }, { + "artifactName": "service-Vcperescust201910012364-csar.csar", + "artifactType": "TOSCA_CSAR", + "artifactURL": "/service-Vcperescust201910012364-csar.csar", + "artifactChecksum": "ZDlmMTMyYjVjZmMxNmQ1MDM2NmIyN2ZlYWUzNjM5ODU\u003d", + "artifactDescription": "TOSCA definition package of the asset", + "artifactTimeout": 0, + "artifactUUID": "2da4976c-1532-4b1e-b662-d80f487d1661", + "artifactVersion": "1" + }], + "workloadContext": "Production" +}
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-rescust/service-Vcperescust201910012364-csar.csar b/asdc-controller/src/test/resources/resource-examples/vcpe-rescust/service-Vcperescust201910012364-csar.csar Binary files differnew file mode 100644 index 0000000000..29d2d72bf1 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vcpe-rescust/service-Vcperescust201910012364-csar.csar diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-rescust/service-Vcperescust201910012364-template.yml b/asdc-controller/src/test/resources/resource-examples/vcpe-rescust/service-Vcperescust201910012364-template.yml new file mode 100644 index 0000000000..1fe6117f59 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vcpe-rescust/service-Vcperescust201910012364-template.yml @@ -0,0 +1,822 @@ +tosca_definitions_version: tosca_simple_yaml_1_1 +metadata: + invariantUUID: d0568a10-a0e0-4efa-b698-ad3772f2e30f + UUID: d3aac917-543d-4421-b6d7-ba2b65884eb7 + name: vCPEResCust 2019-10-01 _2364 + description: catalog service description + type: Service + category: Network L1-3 + serviceType: '' + serviceRole: '' + instantiationType: A-la-carte + serviceEcompNaming: true + ecompGeneratedNaming: true + namingPolicy: '' + environmentContext: General_Revenue-Bearing +imports: +- nodes: + file: nodes.yml +- datatypes: + file: data.yml +- capabilities: + file: capabilities.yml +- relationships: + file: relationships.yml +- groups: + file: groups.yml +- policies: + file: policies.yml +- annotations: + file: annotations.yml +- service-vCPEResCust 2019-10-01 _2364-interface: + file: service-Vcperescust201910012364-template-interface.yml +- resource-TunnelXConn_2019-10-01 03:23:27.409: + file: resource-Tunnelxconn20191001032327409-template.yml +- resource-TunnelXConn_2019-10-01 03:23:27.409-interface: + file: resource-Tunnelxconn20191001032327409-template-interface.yml +- resource-BRG_2019-10-01 03:23:27.409: + file: resource-Brg20191001032327409-template.yml +- resource-BRG_2019-10-01 03:23:27.409-interface: + file: resource-Brg20191001032327409-template-interface.yml +- resource-vCPE_vgw bf175ab0-4fa2: + file: resource-VcpeVgwBf175ab04fa2-template.yml +- resource-vCPE_vgw bf175ab0-4fa2-interface: + file: resource-VcpeVgwBf175ab04fa2-template-interface.yml +topology_template: + node_templates: + vCPE_vgw bf175ab0-4fa2 0: + type: org.openecomp.resource.vf.VcpeVgwBf175ab04fa2 + metadata: + invariantUUID: 1d2b0362-af54-43b9-9a5b-2dba408742b2 + UUID: d9f21a73-33cb-49b5-9e5c-87c2c7dd93dc + customizationUUID: 6f2c39b3-d14f-4575-97b3-c93a7620591e + version: '1.0' + name: vCPE_vgw bf175ab0-4fa2 + description: vendor software product + type: VF + category: Generic + subcategory: Abstract + resourceVendor: 6dccd115-ce6a-4b1a-88aa + resourceVendorRelease: '1.0' + resourceVendorModelNumber: '' + properties: + vf_module_id: vCPE_Customer_GW + vcpe_image_name: PUT THE IMAGE NAME HERE (Ubuntu 1604 SUGGESTED) + skip_post_instantiation_configuration: true + vgw_name_0: zdcpe1cpe01gw01 + public_net_id: PUT THE PUBLIC NETWORK ID HERE + onap_private_subnet_id: PUT THE ONAP PRIVATE SUBNETWORK NAME HERE + nexus_artifact_repo: https://nexus.onap.org + onap_private_net_cidr: 10.0.0.0/16 + cpe_public_net_id: zdfw1cpe01_public + mux_ip_addr: 10.5.0.20 + mux_gw_private_net_id: zdfw1muxgw01_private + dcae_collector_ip: 10.0.4.1 + vnf_id: vCPE_Infrastructure_GW_demo_app + cpe_public_net_cidr: 10.2.0.0/24 + vg_vgmux_tunnel_vni: 100.0 + dcae_collector_port: '8081' + mux_gw_private_net_cidr: 10.5.0.0/24 + mux_gw_private_subnet_id: zdfw1muxgw01_sub_private + nf_naming: + ecomp_generated_naming: true + multi_stage_design: 'false' + onap_private_net_id: PUT THE ONAP PRIVATE NETWORK NAME HERE + availability_zone_max_count: 1 + vgw_private_ip_0: 10.5.0.21 + pub_key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQXYJYYi3/OUZXUiCYWdtc7K0m5C0dJKVxPG0eI8EWZrEHYdfYe6WoTSDJCww+1qlBSpA5ac/Ba4Wn9vh+lR1vtUKkyIC/nrYb90ReUd385Glkgzrfh5HdR5y5S2cL/Frh86lAn9r6b3iWTJD8wBwXFyoe1S2nMTOIuG4RPNvfmyCTYVh8XTCCE8HPvh3xv2r4egawG1P4Q4UDwk+hDBXThY2KS8M5/8EMyxHV0ImpLbpYCTBA6KYDIRtqmgS6iKyy8v2D1aSY5mc9J0T5t9S2Gv+VZQNWQDDKNFnxqYaAo1uEoq/i1q63XC5AD3ckXb2VT6dp23BQMdDfbHyUWfJN + vgw_private_ip_1: 10.0.101.30 + key_name: vgw_key + vcpe_flavor_name: PUT THE FLAVOR NAME HERE (MEDIUM FLAVOR SUGGESTED) + script_version: 1.5.0-SNAPSHOT + cpe_public_subnet_id: zdfw1cpe01_sub_public + cloud_env: PUT THE CLOUD PROVIDED HERE (openstack or rackspace) + capabilities: + abstract_vgw.network.incoming.packets_vgw_vgw_private_0_port: + properties: + unit: packet + description: Number of incoming packets + type: Cumulative + category: network + abstract_vgw.disk.read.bytes_vgw: + properties: + unit: B + description: Volume of reads + type: Cumulative + category: compute + abstract_vgw.network.incoming.bytes.rate_vgw_vgw_private_0_port: + properties: + unit: B/s + description: Average rate of incoming bytes + type: Gauge + category: network + abstract_vgw.disk.read.requests_vgw: + properties: + unit: request + description: Number of read requests + type: Cumulative + category: compute + abstract_vgw.disk.write.bytes_vgw: + properties: + unit: B + description: Volume of writes + type: Cumulative + category: compute + abstract_vgw.disk.capacity_vgw: + properties: + unit: B + description: The amount of disk that the instance can see + type: Gauge + category: disk + abstract_vgw.network.incoming.bytes_vgw_vgw_private_1_port: + properties: + unit: B + description: Number of incoming bytes + type: Cumulative + category: network + abstract_vgw.port_mirroring_vgw_vgw_private_2_port: + properties: + connection_point: + network_role: + get_input: port_vgw_private_2_port_network_role + nfc_naming_code: vgw + abstract_vgw.disk.write.requests_vgw: + properties: + unit: request + description: Number of write requests + type: Cumulative + category: compute + abstract_vgw.disk.device.read.requests.rate_vgw: + properties: + unit: request/s + description: Average rate of read requests + type: Gauge + category: disk + abstract_vgw.port_mirroring_vgw_vgw_private_1_port: + properties: + connection_point: + network_role: + get_input: port_vgw_private_1_port_network_role + nfc_naming_code: vgw + abstract_vgw.network.outpoing.packets_vgw_vgw_private_0_port: + properties: + unit: packet + description: Number of outgoing packets + type: Cumulative + category: network + abstract_vgw.memory.resident_vgw: + properties: + unit: MB + description: Volume of RAM used by the instance on the physical machine + type: Gauge + category: compute + abstract_vgw.disk.allocation_vgw: + properties: + unit: B + description: The amount of disk occupied by the instance on the host machine + type: Gauge + category: disk + abstract_vgw.network.incoming.bytes_vgw_vgw_private_0_port: + properties: + unit: B + description: Number of incoming bytes + type: Cumulative + category: network + abstract_vgw.cpu_vgw: + properties: + unit: ns + description: CPU time used + type: Cumulative + category: compute + abstract_vgw.network.incoming.bytes_vgw_vgw_private_2_port: + properties: + unit: B + description: Number of incoming bytes + type: Cumulative + category: network + abstract_vgw.network.outpoing.packets_vgw_vgw_private_1_port: + properties: + unit: packet + description: Number of outgoing packets + type: Cumulative + category: network + abstract_vgw.disk.device.read.bytes_vgw: + properties: + unit: B + description: Volume of reads + type: Cumulative + category: disk + abstract_vgw.disk.device.write.bytes.rate_vgw: + properties: + unit: B/s + description: Average rate of writes + type: Gauge + category: disk + abstract_vgw.network.incoming.bytes.rate_vgw_vgw_private_2_port: + properties: + unit: B/s + description: Average rate of incoming bytes + type: Gauge + category: network + abstract_vgw.network.incoming.packets.rate_vgw_vgw_private_0_port: + properties: + unit: packet/s + description: Average rate of incoming packets + type: Gauge + category: network + abstract_vgw.disk.device.iops_vgw: + properties: + unit: count/s + description: Average disk iops per device + type: Gauge + category: disk + abstract_vgw.disk.latency_vgw: + properties: + unit: ms + description: Average disk latency + type: Gauge + category: disk + abstract_vgw.network.incoming.packets_vgw_vgw_private_2_port: + properties: + unit: packet + description: Number of incoming packets + type: Cumulative + category: network + abstract_vgw.disk.device.allocation_vgw: + properties: + unit: B + description: The amount of disk per device occupied by the instance on the host machine + type: Gauge + category: disk + abstract_vgw.network.outgoing.bytes.rate_vgw_vgw_private_0_port: + properties: + unit: B/s + description: Average rate of outgoing bytes + type: Gauge + category: network + abstract_vgw.instance_vgw: + properties: + unit: instance + description: Existence of instance + type: Gauge + category: compute + abstract_vgw.memory_vgw: + properties: + unit: MB + description: Volume of RAM allocated to the instance + type: Gauge + category: compute + abstract_vgw.disk.device.write.requests_vgw: + properties: + unit: request + description: Number of write requests + type: Cumulative + category: disk + abstract_vgw.cpu.delta_vgw: + properties: + unit: ns + description: CPU time used since previous datapoint + type: Delta + category: compute + abstract_vgw.disk.device.latency_vgw: + properties: + unit: ms + description: Average disk latency per device + type: Gauge + category: disk + abstract_vgw.port_mirroring_vgw_vgw_private_0_port: + properties: + connection_point: + network_role: + get_input: port_vgw_private_0_port_network_role + nfc_naming_code: vgw + abstract_vgw.disk.iops_vgw: + properties: + unit: count/s + description: Average disk iops + type: Gauge + category: disk + abstract_vgw.cpu_util_vgw: + properties: + unit: '%' + description: Average CPU utilization + type: Gauge + category: compute + abstract_vgw.network.outgoing.bytes.rate_vgw_vgw_private_2_port: + properties: + unit: B/s + description: Average rate of outgoing bytes + type: Gauge + category: network + abstract_vgw.network.incoming.packets.rate_vgw_vgw_private_1_port: + properties: + unit: packet/s + description: Average rate of incoming packets + type: Gauge + category: network + abstract_vgw.network.outgoing.bytes_vgw_vgw_private_0_port: + properties: + unit: B + description: Number of outgoing bytes + type: Cumulative + category: network + abstract_vgw.network.outgoing.packets.rate_vgw_vgw_private_1_port: + properties: + unit: packet/s + description: Average rate of outgoing packets + type: Gauge + category: network + abstract_vgw.disk.usage_vgw: + properties: + unit: B + description: The physical size in bytes of the image container on the host + type: Gauge + category: disk + abstract_vgw.disk.write.requests.rate_vgw: + properties: + unit: request/s + description: Average rate of write requests + type: Gauge + category: compute + abstract_vgw.network.outgoing.bytes_vgw_vgw_private_1_port: + properties: + unit: B + description: Number of outgoing bytes + type: Cumulative + category: network + abstract_vgw.scalable_vgw: + properties: + max_instances: 1 + min_instances: 1 + abstract_vgw.disk.device.read.bytes.rate_vgw: + properties: + unit: B/s + description: Average rate of reads + type: Gauge + category: disk + abstract_vgw.network.outgoing.packets.rate_vgw_vgw_private_0_port: + properties: + unit: packet/s + description: Average rate of outgoing packets + type: Gauge + category: network + abstract_vgw.disk.device.read.requests_vgw: + properties: + unit: request + description: Number of read requests + type: Cumulative + category: disk + abstract_vgw.network.outgoing.bytes.rate_vgw_vgw_private_1_port: + properties: + unit: B/s + description: Average rate of outgoing bytes + type: Gauge + category: network + abstract_vgw.disk.device.write.requests.rate_vgw: + properties: + unit: request/s + description: Average rate of write requests + type: Gauge + category: disk + abstract_vgw.disk.device.usage_vgw: + properties: + unit: B + description: The physical size in bytes of the image container on the host per device + type: Gauge + category: disk + abstract_vgw.disk.write.bytes.rate_vgw: + properties: + unit: B/s + description: Average rate of writes + type: Gauge + category: compute + abstract_vgw.disk.device.write.bytes_vgw: + properties: + unit: B + description: Volume of writes + type: Cumulative + category: disk + abstract_vgw.memory.usage_vgw: + properties: + unit: MB + description: Volume of RAM used by the instance from the amount of its allocated memory + type: Gauge + category: compute + abstract_vgw.network.outgoing.packets.rate_vgw_vgw_private_2_port: + properties: + unit: packet/s + description: Average rate of outgoing packets + type: Gauge + category: network + abstract_vgw.disk.root.size_vgw: + properties: + unit: GB + description: Size of root disk + type: Gauge + category: compute + abstract_vgw.disk.ephemeral.size_vgw: + properties: + unit: GB + description: Size of ephemeral disk + type: Gauge + category: compute + abstract_vgw.disk.device.capacity_vgw: + properties: + unit: B + description: The amount of disk per device that the instance can see + type: Gauge + category: disk + abstract_vgw.disk.read.bytes.rate_vgw: + properties: + unit: B/s + description: Average rate of reads + type: Gauge + category: compute + abstract_vgw.endpoint_vgw: + properties: + secure: true + abstract_vgw.network.outpoing.packets_vgw_vgw_private_2_port: + properties: + unit: packet + description: Number of outgoing packets + type: Cumulative + category: network + abstract_vgw.vcpus_vgw: + properties: + unit: vcpu + description: Number of virtual CPUs allocated to the instance + type: Gauge + category: compute + abstract_vgw.network.outgoing.bytes_vgw_vgw_private_2_port: + properties: + unit: B + description: Number of outgoing bytes + type: Cumulative + category: network + abstract_vgw.network.incoming.packets_vgw_vgw_private_1_port: + properties: + unit: packet + description: Number of incoming packets + type: Cumulative + category: network + abstract_vgw.network.incoming.packets.rate_vgw_vgw_private_2_port: + properties: + unit: packet/s + description: Average rate of incoming packets + type: Gauge + category: network + abstract_vgw.network.incoming.bytes.rate_vgw_vgw_private_1_port: + properties: + unit: B/s + description: Average rate of incoming bytes + type: Gauge + category: network + BRG_2019-10-01 03:23:27.409 0: + type: org.openecomp.resource.vf.Brg2019100103:23:27409 + metadata: + invariantUUID: 05a482b5-ec0d-45cb-ae95-397ce6765c9e + UUID: 12519dd0-46ca-46da-9dcc-c6155b2a6d15 + customizationUUID: aff592e4-cfc7-43ce-abea-f026b56995ab + version: '1.0' + name: BRG_2019-10-01 03:23:27.409 + description: Alloted Resource BRG + type: VF + category: Allotted Resource + subcategory: BRG + resourceVendor: ONAP + resourceVendorRelease: '1.0' + resourceVendorModelNumber: '' + properties: + nf_naming: + ecomp_generated_naming: true + skip_post_instantiation_configuration: true + multi_stage_design: 'false' + availability_zone_max_count: 1 + nf_role: BRG + nf_type: BRG + TunnelXConn_2019-10-01 03:23:27.409 0: + type: org.openecomp.resource.vf.Tunnelxconn2019100103:23:27409 + metadata: + invariantUUID: 3a367ac8-5dff-4325-a0e7-9e0299d22152 + UUID: 93d3e01d-4f8c-4a60-99f2-26b64c69bc11 + customizationUUID: 4e0249f0-5118-4323-b5e9-0783ad1123ba + version: '1.0' + name: TunnelXConn_2019-10-01 03:23:27.409 + description: Alloted Resource TunnelXConn + type: VF + category: Allotted Resource + subcategory: TunnelXConn + resourceVendor: ONAP + resourceVendorRelease: '1.0' + resourceVendorModelNumber: '' + properties: + nf_naming: + ecomp_generated_naming: true + skip_post_instantiation_configuration: true + multi_stage_design: 'false' + availability_zone_max_count: 1 + nf_role: TunnelXConn + nf_type: TunnelXConn + groups: + vcpe_vgwbf175ab04fa20..VcpeVgwBf175ab04fa2..base_vcpe_vgw..module-0: + type: org.openecomp.groups.VfModule + metadata: + vfModuleModelName: VcpeVgwBf175ab04fa2..base_vcpe_vgw..module-0 + vfModuleModelInvariantUUID: 7caf746f-46c6-4e47-bbfc-9374b1c17ba1 + vfModuleModelUUID: a4654496-9862-47e4-9640-d84708ea8bfb + vfModuleModelVersion: '1' + vfModuleModelCustomizationUUID: ddd095d2-c2ba-48fe-90f4-e3f6fc806d7e + properties: + min_vf_module_instances: 1 + vf_module_label: base_vcpe_vgw + max_vf_module_instances: 1 + vf_module_type: Base + isBase: true + initial_count: 1 + volume_group: false + substitution_mappings: + node_type: org.openecomp.service.Vcperescust201910012364 + capabilities: + vcpe_vgwbf175ab04fa20.abstract_vgw.network.incoming.bytes_vgw_vgw_private_0_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.network.incoming.bytes_vgw_vgw_private_0_port + vcpe_vgwbf175ab04fa20.abstract_vgw.network.incoming.packets_vgw_vgw_private_2_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.network.incoming.packets_vgw_vgw_private_2_port + vcpe_vgwbf175ab04fa20.abstract_vgw.network.incoming.packets.rate_vgw_vgw_private_1_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.network.incoming.packets.rate_vgw_vgw_private_1_port + vcpe_vgwbf175ab04fa20.abstract_vgw.feature_vgw_vgw_private_2_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.feature_vgw_vgw_private_2_port + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.write.requests.rate_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.write.requests.rate_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.device.iops_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.device.iops_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.device.read.requests.rate_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.device.read.requests.rate_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.attachment_vgw_vgw_private_0_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.attachment_vgw_vgw_private_0_port + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.write.requests_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.write.requests_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.endpoint_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.endpoint_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.network.outgoing.bytes_vgw_vgw_private_2_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.network.outgoing.bytes_vgw_vgw_private_2_port + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.device.latency_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.device.latency_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.network.incoming.bytes_vgw_vgw_private_1_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.network.incoming.bytes_vgw_vgw_private_1_port + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.device.write.bytes_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.device.write.bytes_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.memory_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.memory_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.device.write.requests.rate_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.device.write.requests.rate_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.read.bytes.rate_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.read.bytes.rate_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.network.outpoing.packets_vgw_vgw_private_1_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.network.outpoing.packets_vgw_vgw_private_1_port + vcpe_vgwbf175ab04fa20.abstract_vgw.feature_vgw_vgw_private_1_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.feature_vgw_vgw_private_1_port + vcpe_vgwbf175ab04fa20.abstract_vgw.port_mirroring_vgw_vgw_private_0_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.port_mirroring_vgw_vgw_private_0_port + vcpe_vgwbf175ab04fa20.abstract_vgw.network.outgoing.packets.rate_vgw_vgw_private_1_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.network.outgoing.packets.rate_vgw_vgw_private_1_port + vcpe_vgwbf175ab04fa20.abstract_vgw.binding_vgw_vgw_private_1_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.binding_vgw_vgw_private_1_port + vcpe_vgwbf175ab04fa20.abstract_vgw.attachment_vgw_vgw_private_1_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.attachment_vgw_vgw_private_1_port + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.iops_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.iops_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.forwarder_vgw_vgw_private_2_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.forwarder_vgw_vgw_private_2_port + vcpe_vgwbf175ab04fa20.abstract_vgw.network.incoming.bytes_vgw_vgw_private_2_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.network.incoming.bytes_vgw_vgw_private_2_port + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.ephemeral.size_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.ephemeral.size_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.port_mirroring_vgw_vgw_private_1_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.port_mirroring_vgw_vgw_private_1_port + vcpe_vgwbf175ab04fa20.abstract_vgw.network.incoming.packets_vgw_vgw_private_1_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.network.incoming.packets_vgw_vgw_private_1_port + vcpe_vgwbf175ab04fa20.abstract_vgw.host_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.host_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.memory.usage_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.memory.usage_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.network.outgoing.packets.rate_vgw_vgw_private_0_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.network.outgoing.packets.rate_vgw_vgw_private_0_port + vcpe_vgwbf175ab04fa20.abstract_vgw.network.outpoing.packets_vgw_vgw_private_2_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.network.outpoing.packets_vgw_vgw_private_2_port + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.device.write.bytes.rate_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.device.write.bytes.rate_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.attachment_vgw_vgw_private_2_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.attachment_vgw_vgw_private_2_port + vcpe_vgwbf175ab04fa20.abstract_vgw.binding_vgw_vgw_private_0_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.binding_vgw_vgw_private_0_port + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.read.bytes_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.read.bytes_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.usage_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.usage_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.network.outgoing.bytes_vgw_vgw_private_0_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.network.outgoing.bytes_vgw_vgw_private_0_port + vcpe_vgwbf175ab04fa20.abstract_vgw.cpu_util_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.cpu_util_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.network.incoming.packets.rate_vgw_vgw_private_0_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.network.incoming.packets.rate_vgw_vgw_private_0_port + vcpe_vgwbf175ab04fa20.abstract_vgw.network.outgoing.bytes.rate_vgw_vgw_private_2_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.network.outgoing.bytes.rate_vgw_vgw_private_2_port + vcpe_vgwbf175ab04fa20.abstract_vgw.memory.resident_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.memory.resident_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.read.requests_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.read.requests_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.binding_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.binding_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.device.usage_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.device.usage_vgw + brg_2019100103:23:274090.brg.feature: + - BRG_2019-10-01 03:23:27.409 0 + - brg.feature + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.latency_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.latency_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.network.outgoing.bytes.rate_vgw_vgw_private_0_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.network.outgoing.bytes.rate_vgw_vgw_private_0_port + vcpe_vgwbf175ab04fa20.abstract_vgw.cpu_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.cpu_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.network.incoming.bytes.rate_vgw_vgw_private_1_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.network.incoming.bytes.rate_vgw_vgw_private_1_port + vcpe_vgwbf175ab04fa20.abstract_vgw.instance_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.instance_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.allocation_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.allocation_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.write.bytes.rate_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.write.bytes.rate_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.network.incoming.bytes.rate_vgw_vgw_private_2_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.network.incoming.bytes.rate_vgw_vgw_private_2_port + vcpe_vgwbf175ab04fa20.abstract_vgw.network.outgoing.bytes.rate_vgw_vgw_private_1_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.network.outgoing.bytes.rate_vgw_vgw_private_1_port + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.device.capacity_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.device.capacity_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.forwarder_vgw_vgw_private_1_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.forwarder_vgw_vgw_private_1_port + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.device.read.requests_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.device.read.requests_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.device.allocation_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.device.allocation_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.root.size_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.root.size_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.network.incoming.packets_vgw_vgw_private_0_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.network.incoming.packets_vgw_vgw_private_0_port + vcpe_vgwbf175ab04fa20.abstract_vgw.feature_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.feature_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.network.outpoing.packets_vgw_vgw_private_0_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.network.outpoing.packets_vgw_vgw_private_0_port + vcpe_vgwbf175ab04fa20.abstract_vgw.network.incoming.bytes.rate_vgw_vgw_private_0_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.network.incoming.bytes.rate_vgw_vgw_private_0_port + vcpe_vgwbf175ab04fa20.abstract_vgw.network.outgoing.packets.rate_vgw_vgw_private_2_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.network.outgoing.packets.rate_vgw_vgw_private_2_port + vcpe_vgwbf175ab04fa20.abstract_vgw.network.incoming.packets.rate_vgw_vgw_private_2_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.network.incoming.packets.rate_vgw_vgw_private_2_port + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.device.write.requests_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.device.write.requests_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.binding_vgw_vgw_private_2_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.binding_vgw_vgw_private_2_port + tunnelxconn_2019100103:23:274090.tunnelxconn.feature: + - TunnelXConn_2019-10-01 03:23:27.409 0 + - tunnelxconn.feature + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.device.read.bytes_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.device.read.bytes_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.network.outgoing.bytes_vgw_vgw_private_1_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.network.outgoing.bytes_vgw_vgw_private_1_port + vcpe_vgwbf175ab04fa20.abstract_vgw.scalable_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.scalable_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.write.bytes_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.write.bytes_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.device.read.bytes.rate_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.device.read.bytes.rate_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.feature_vgw_vgw_private_0_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.feature_vgw_vgw_private_0_port + vcpe_vgwbf175ab04fa20.abstract_vgw.os_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.os_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.vcpus_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.vcpus_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.forwarder_vgw_vgw_private_0_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.forwarder_vgw_vgw_private_0_port + vcpe_vgwbf175ab04fa20.abstract_vgw.port_mirroring_vgw_vgw_private_2_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.port_mirroring_vgw_vgw_private_2_port + vcpe_vgwbf175ab04fa20.abstract_vgw.cpu.delta_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.cpu.delta_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.disk.capacity_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.disk.capacity_vgw + requirements: + vcpe_vgwbf175ab04fa20.abstract_vgw.dependency_vgw_vgw_private_1_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.dependency_vgw_vgw_private_1_port + tunnelxconn_2019100103:23:274090.tunnelxconn.service_dependency: + - TunnelXConn_2019-10-01 03:23:27.409 0 + - tunnelxconn.service_dependency + vcpe_vgwbf175ab04fa20.abstract_vgw.local_storage_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.local_storage_vgw + vcpe_vgwbf175ab04fa20.abstract_vgw.dependency_vgw: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.dependency_vgw + brg_2019100103:23:274090.brg.service_dependency: + - BRG_2019-10-01 03:23:27.409 0 + - brg.service_dependency + vcpe_vgwbf175ab04fa20.abstract_vgw.link_vgw_vgw_private_1_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.link_vgw_vgw_private_1_port + vcpe_vgwbf175ab04fa20.abstract_vgw.dependency_vgw_vgw_private_2_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.dependency_vgw_vgw_private_2_port + vcpe_vgwbf175ab04fa20.abstract_vgw.link_vgw_vgw_private_2_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.link_vgw_vgw_private_2_port + vcpe_vgwbf175ab04fa20.abstract_vgw.link_vgw_vgw_private_0_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.link_vgw_vgw_private_0_port + tunnelxconn_2019100103:23:274090.tunnelxconn.dependency: + - TunnelXConn_2019-10-01 03:23:27.409 0 + - tunnelxconn.dependency + brg_2019100103:23:274090.brg.dependency: + - BRG_2019-10-01 03:23:27.409 0 + - brg.dependency + vcpe_vgwbf175ab04fa20.abstract_vgw.dependency_vgw_vgw_private_0_port: + - vCPE_vgw bf175ab0-4fa2 0 + - abstract_vgw.dependency_vgw_vgw_private_0_port diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-rescust/vcpe_vgwbf175ab04fa20_modules.json b/asdc-controller/src/test/resources/resource-examples/vcpe-rescust/vcpe_vgwbf175ab04fa20_modules.json new file mode 100644 index 0000000000..e74c3c05a8 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vcpe-rescust/vcpe_vgwbf175ab04fa20_modules.json @@ -0,0 +1,25 @@ +[ + { + "vfModuleModelName": "VcpeVgwBf175ab04fa2..base_vcpe_vgw..module-0", + "vfModuleModelInvariantUUID": "7caf746f-46c6-4e47-bbfc-9374b1c17ba1", + "vfModuleModelVersion": "1", + "vfModuleModelUUID": "a4654496-9862-47e4-9640-d84708ea8bfb", + "vfModuleModelCustomizationUUID": "ddd095d2-c2ba-48fe-90f4-e3f6fc806d7e", + "isBase": true, + "artifacts": [ + "e3a33b76-1f8a-44ba-808b-8a4c79e4b44a", + "9b73763b-0f60-47c3-8939-cf2f819bc75a" + ], + "properties": { + "min_vf_module_instances": "1", + "vf_module_label": "base_vcpe_vgw", + "max_vf_module_instances": "1", + "vfc_list": "", + "vf_module_description": "", + "vf_module_type": "Base", + "availability_zone_count": "", + "volume_group": "false", + "initial_count": "1" + } + } +]
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-rescust/vendor-license-model.xml b/asdc-controller/src/test/resources/resource-examples/vcpe-rescust/vendor-license-model.xml new file mode 100644 index 0000000000..67bbea4677 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vcpe-rescust/vendor-license-model.xml @@ -0,0 +1 @@ +<vendor-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>6dccd115-ce6a-4b1a-88aa</vendor-name><entitlement-pool-list><entitlement-pool><entitlement-pool-invariant-uuid>40d4819966b04a28aac2db35f2d84755</entitlement-pool-invariant-uuid><entitlement-pool-uuid>86EFCDA3995C4232B96C833E97804D4F</entitlement-pool-uuid><version>1.0</version><name>ce52c558-b095-4a8f-84f3</name><description>vendor entitlement pool</description><increments/><manufacturer-reference-number>111111</manufacturer-reference-number><threshold-value><unit>Percentage</unit><value>100</value></threshold-value><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-10-01T00:00:00Z</start-date><expiry-date>2020-09-30T23:59:59Z</expiry-date></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><version>1.0</version><name>c712eb11-eddd-459f-a383</name><description>vendor license key group</description><type>Universal</type><increments/><manufacturerReferenceNumber>11111</manufacturerReferenceNumber><license-key-group-invariant-uuid>fc8a672de0d041ecb7637b1ae5446e99</license-key-group-invariant-uuid><license-key-group-uuid>DF4EA9695A4943ABB8437F244FC6623B</license-key-group-uuid><threshold-value><unit>Percentage</unit><value>100</value></threshold-value><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-10-01T00:00:00Z</start-date><expiry-date>2020-09-30T23:59:59Z</expiry-date></license-key-group></license-key-group-list></vendor-license-model>
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/vcpe-rescust/vf-license-model.xml b/asdc-controller/src/test/resources/resource-examples/vcpe-rescust/vf-license-model.xml new file mode 100644 index 0000000000..fb15c3aa16 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/vcpe-rescust/vf-license-model.xml @@ -0,0 +1 @@ +<vf-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>6dccd115-ce6a-4b1a-88aa</vendor-name><vf-id>8228aa3775634529bb6f86e77b0e40d7</vf-id><feature-group-list><feature-group><entitlement-pool-list><entitlement-pool><name>ce52c558-b095-4a8f-84f3</name><description>vendor entitlement pool</description><increments/><entitlement-pool-invariant-uuid>40d4819966b04a28aac2db35f2d84755</entitlement-pool-invariant-uuid><entitlement-pool-uuid>86EFCDA3995C4232B96C833E97804D4F</entitlement-pool-uuid><manufacturer-reference-number>111111</manufacturer-reference-number><threshold-value><unit>Percentage</unit><value>100</value></threshold-value><version>1.0</version><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-10-01T00:00:00Z</start-date><expiry-date>2020-09-30T23:59:59Z</expiry-date></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><name>c712eb11-eddd-459f-a383</name><description>vendor license key group</description><type>Universal</type><increments/><license-key-group-invariant-uuid>fc8a672de0d041ecb7637b1ae5446e99</license-key-group-invariant-uuid><license-key-group-uuid>DF4EA9695A4943ABB8437F244FC6623B</license-key-group-uuid><manufacturer-reference-number>11111</manufacturer-reference-number><threshold-value><unit>Percentage</unit><value>100</value></threshold-value><version>1.0</version><sp-limits/><vendor-limits/><operational-scope><value/></operational-scope><start-date>2019-10-01T00:00:00Z</start-date><expiry-date>2020-09-30T23:59:59Z</expiry-date></license-key-group></license-key-group-list><name>ec13e8a7-f181-4d96-b821</name><part-number>123abc456</part-number><feature-group-uuid>7b85e31faa0541afa21a60b85907aa40</feature-group-uuid><description>vendor feature group</description></feature-group></feature-group-list></vf-license-model>
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql index 652fc8f0de..0821ebc97c 100644 --- a/asdc-controller/src/test/resources/schema.sql +++ b/asdc-controller/src/test/resources/schema.sql @@ -738,6 +738,8 @@ CREATE TABLE `orchestration_flow_reference` ( `SEQ_NO` int(11) NOT NULL, `FLOW_NAME` varchar(200) NOT NULL, `FLOW_VERSION` double NOT NULL, + `SCOPE` varchar(200) DEFAULT NULL, + `ACTION` varchar(200) DEFAULT NULL, `NB_REQ_REF_LOOKUP_ID` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `UK_orchestration_flow_reference` (`COMPOSITE_ACTION`,`FLOW_NAME`,`SEQ_NO`,`NB_REQ_REF_LOOKUP_ID`), @@ -809,6 +811,10 @@ CREATE TABLE `service` ( `OVERALL_DISTRIBUTION_STATUS` varchar(45), `ONAP_GENERATED_NAMING` TINYINT(1) DEFAULT NULL, `NAMING_POLICY` varchar(200) DEFAULT NULL, + `CDS_BLUEPRINT_NAME` varchar(200) DEFAULT NULL, + `CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL, + `CONTROLLER_ACTOR` varchar(200) DEFAULT NULL, + `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true, 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 @@ -963,6 +969,7 @@ CREATE TABLE `vf_module_customization` ( `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `VF_MODULE_MODEL_UUID` varchar(200) NOT NULL, `VNF_RESOURCE_CUSTOMIZATION_ID` int(13) DEFAULT NULL, + `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true, PRIMARY KEY (`ID`), KEY `fk_vf_module_customization__vf_module1_idx` (`VF_MODULE_MODEL_UUID`), KEY `fk_vf_module_customization__heat_env__heat_environment1_idx` (`HEAT_ENVIRONMENT_ARTIFACT_UUID`), @@ -1113,6 +1120,8 @@ CREATE TABLE `vnf_resource_customization` ( `VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL, `SERVICE_MODEL_UUID` varchar(200) NOT NULL, `VNFCINSTANCEGROUP_ORDER` varchar(200) default NULL, + `NF_DATA_VALID` tinyint(1) DEFAULT '0', + `CONTROLLER_ACTOR` varchar(200) DEFAULT NULL, PRIMARY KEY (`ID`), UNIQUE KEY `UK_vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`,`SERVICE_MODEL_UUID`), KEY `fk_vnf_resource_customization__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID`), @@ -1194,6 +1203,7 @@ CREATE TABLE IF NOT EXISTS `pnf_resource_customization` ( `CDS_BLUEPRINT_NAME` varchar(200) DEFAULT NULL, `CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL, `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true, + `CONTROLLER_ACTOR` varchar(200) DEFAULT NULL, PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), KEY `fk_pnf_resource_customization__pnf_resource1_idx` (`PNF_RESOURCE_MODEL_UUID`), CONSTRAINT `fk_pnf_resource_customization__pnf_resource1` FOREIGN KEY (`PNF_RESOURCE_MODEL_UUID`) REFERENCES `pnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE @@ -1418,8 +1428,6 @@ CREATE TABLE `active_requests` ( CREATE TABLE `infra_active_requests` ( `REQUEST_ID` varchar(45) NOT NULL, - `CLIENT_REQUEST_ID` varchar(45) DEFAULT NULL, - `ACTION` varchar(45) DEFAULT NULL, `REQUEST_STATUS` varchar(20) DEFAULT NULL, `STATUS_MESSAGE` longtext DEFAULT NULL, `PROGRESS` bigint(20) DEFAULT NULL, @@ -1430,23 +1438,19 @@ CREATE TABLE `infra_active_requests` ( `VNF_NAME` varchar(80) DEFAULT NULL, `VNF_TYPE` varchar(200) DEFAULT NULL, `SERVICE_TYPE` varchar(45) DEFAULT NULL, - `AIC_NODE_CLLI` varchar(11) DEFAULT NULL, `TENANT_ID` varchar(45) DEFAULT NULL, - `PROV_STATUS` varchar(20) DEFAULT NULL, `VNF_PARAMS` longtext, `VNF_OUTPUTS` longtext, `REQUEST_BODY` longtext, `RESPONSE_BODY` longtext, `LAST_MODIFIED_BY` varchar(100) DEFAULT NULL, `MODIFY_TIME` datetime DEFAULT NULL, - `REQUEST_TYPE` varchar(20) DEFAULT NULL, `VOLUME_GROUP_ID` varchar(45) DEFAULT NULL, `VOLUME_GROUP_NAME` varchar(45) DEFAULT NULL, `VF_MODULE_ID` varchar(45) DEFAULT NULL, `VF_MODULE_NAME` varchar(200) DEFAULT NULL, `VF_MODULE_MODEL_NAME` varchar(200) DEFAULT NULL, - `AAI_SERVICE_ID` varchar(50) DEFAULT NULL, - `AIC_CLOUD_REGION` varchar(11) DEFAULT NULL, + `CLOUD_REGION` varchar(11) DEFAULT NULL, `CALLBACK_URL` varchar(200) DEFAULT NULL, `CORRELATOR` varchar(80) DEFAULT NULL, `NETWORK_ID` varchar(45) DEFAULT NULL, @@ -1465,14 +1469,11 @@ CREATE TABLE `infra_active_requests` ( `ORIGINAL_REQUEST_ID` varchar(45) DEFAULT NULL, `EXT_SYSTEM_ERROR_SOURCE` varchar(80) DEFAULT NULL, `ROLLBACK_EXT_SYSTEM_ERROR_SOURCE` varchar(80) DEFAULT NULL, - PRIMARY KEY (`REQUEST_ID`), - UNIQUE KEY `UK_bhu6w8p7wvur4pin0gjw2d5ak` (`CLIENT_REQUEST_ID`) + PRIMARY KEY (`REQUEST_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE `archived_infra_requests` ( `REQUEST_ID` varchar(45) NOT NULL, - `CLIENT_REQUEST_ID` varchar(45) DEFAULT NULL, - `ACTION` varchar(45) DEFAULT NULL, `REQUEST_STATUS` varchar(20) DEFAULT NULL, `STATUS_MESSAGE` longtext DEFAULT NULL, `PROGRESS` bigint(20) DEFAULT NULL, @@ -1483,23 +1484,19 @@ CREATE TABLE `archived_infra_requests` ( `VNF_NAME` varchar(80) DEFAULT NULL, `VNF_TYPE` varchar(200) DEFAULT NULL, `SERVICE_TYPE` varchar(45) DEFAULT NULL, - `AIC_NODE_CLLI` varchar(11) DEFAULT NULL, `TENANT_ID` varchar(45) DEFAULT NULL, - `PROV_STATUS` varchar(20) DEFAULT NULL, `VNF_PARAMS` longtext, `VNF_OUTPUTS` longtext, `REQUEST_BODY` longtext, `RESPONSE_BODY` longtext, `LAST_MODIFIED_BY` varchar(100) DEFAULT NULL, `MODIFY_TIME` datetime DEFAULT NULL, - `REQUEST_TYPE` varchar(20) DEFAULT NULL, `VOLUME_GROUP_ID` varchar(45) DEFAULT NULL, `VOLUME_GROUP_NAME` varchar(45) DEFAULT NULL, `VF_MODULE_ID` varchar(45) DEFAULT NULL, `VF_MODULE_NAME` varchar(200) DEFAULT NULL, `VF_MODULE_MODEL_NAME` varchar(200) DEFAULT NULL, - `AAI_SERVICE_ID` varchar(50) DEFAULT NULL, - `AIC_CLOUD_REGION` varchar(11) DEFAULT NULL, + `CLOUD_REGION` varchar(11) DEFAULT NULL, `CALLBACK_URL` varchar(200) DEFAULT NULL, `CORRELATOR` varchar(80) DEFAULT NULL, `NETWORK_ID` varchar(45) DEFAULT NULL, @@ -1515,8 +1512,7 @@ CREATE TABLE `archived_infra_requests` ( `OPERATIONAL_ENV_ID` varchar(45) DEFAULT NULL, `OPERATIONAL_ENV_NAME` varchar(200) DEFAULT NULL, `REQUEST_URL` varchar(500) DEFAULT NULL, - PRIMARY KEY (`REQUEST_ID`), - UNIQUE KEY `UK_bhu6w8p7wvur4pin0gjw2d72h` (`CLIENT_REQUEST_ID`) + PRIMARY KEY (`REQUEST_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE `site_status` ( |