diff options
Diffstat (limited to 'vid-app-common/src')
26 files changed, 446 insertions, 51 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/model/ResourceType.java b/vid-app-common/src/main/java/org/onap/vid/aai/model/ResourceType.java index 4d49b5806..0c1e3c11e 100644 --- a/vid-app-common/src/main/java/org/onap/vid/aai/model/ResourceType.java +++ b/vid-app-common/src/main/java/org/onap/vid/aai/model/ResourceType.java @@ -32,6 +32,7 @@ public enum ResourceType { SERVICE_INSTANCE("service-instances", "service-instance-name"), GENERIC_VNF("generic-vnfs", "vnf-name"), + PNF("pnfs", "pnf-name"), L3_NETWORK("l3-networks", "network-name"), VF_MODULE("vf-modules", "vf-module-name"), INSTANCE_GROUP("instance-groups", "instance-group-name"), diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/util/AAITreeConverter.java b/vid-app-common/src/main/java/org/onap/vid/aai/util/AAITreeConverter.java index 111a260e1..b68050d31 100644 --- a/vid-app-common/src/main/java/org/onap/vid/aai/util/AAITreeConverter.java +++ b/vid-app-common/src/main/java/org/onap/vid/aai/util/AAITreeConverter.java @@ -42,6 +42,7 @@ import org.springframework.stereotype.Component; public class AAITreeConverter { public static final String VNF_TYPE = "vnf-type"; + public static final String PNF_TYPE = "pnf-type"; public static final String NETWORK_TYPE = "network-type"; public static final String NETWORK_ROLE = "network-role"; public static final String PHYSICAL_NETWORK_NAME = "physical-network-name"; diff --git a/vid-app-common/src/main/java/org/onap/vid/job/JobType.java b/vid-app-common/src/main/java/org/onap/vid/job/JobType.java index b0cfa7a58..7be286be7 100644 --- a/vid-app-common/src/main/java/org/onap/vid/job/JobType.java +++ b/vid-app-common/src/main/java/org/onap/vid/job/JobType.java @@ -37,6 +37,7 @@ public enum JobType { ALaCarteServiceInstantiation(ALaCarteServiceCommand.class), ALaCarteService(ALaCarteServiceCommand.class), VnfInstantiation(VnfCommand.class), + PnfInstantiation(PnfCommand.class), VfmoduleInstantiation(VfmoduleCommand.class), VolumeGroupInstantiation(VolumeGroupCommand.class), NetworkInstantiation(NetworkCommand.class), diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt index c31e69300..17948d4b6 100644 --- a/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt +++ b/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt @@ -65,7 +65,6 @@ class MsoRequestBuilder val serviceInstantiationServiceList = generateMacroServiceInstantiationRequestParams(payload, serviceInstanceName, jobId) - val requestParameters = ServiceInstantiationRequestDetails.RequestParameters(payload.subscriptionServiceType, false, serviceInstantiationServiceList) val requestDetails = generateServiceInstantiationRequestDetails(payload, requestParameters, serviceInstanceName, userId) @@ -221,7 +220,7 @@ class MsoRequestBuilder return !aaiClient.isNodeTypeExistsByName(name, resourceType) } - private fun generateServiceInstantiationServicesList(payload: ServiceInstantiation, serviceInstanceName: String?, vnfList: ServiceInstantiationRequestDetails.ServiceInstantiationVnfList): List<ServiceInstantiationRequestDetails.ServiceInstantiationService> { + private fun generateServiceInstantiationServicesList(payload: ServiceInstantiation, serviceInstanceName: String?, vnfList: List<ServiceInstantiationRequestDetails.ServiceInstantiationVnf>, pnfList: List<ServiceInstantiationRequestDetails.ServiceInstantiationPnf>): List<ServiceInstantiationRequestDetails.ServiceInstantiationService> { val serviceInstantiationServiceList = LinkedList<ServiceInstantiationRequestDetails.ServiceInstantiationService>() val unFilteredInstanceParams = defaultIfNull<List<MutableMap<String, String>>>(payload.instanceParams, emptyList()) val filteredInstanceParams = removeUnNeededParams(unFilteredInstanceParams) @@ -229,7 +228,8 @@ class MsoRequestBuilder payload.modelInfo, serviceInstanceName, filteredInstanceParams, - vnfList + vnfList, + pnfList ) serviceInstantiationServiceList.add(serviceInstantiationService) return serviceInstantiationServiceList @@ -255,7 +255,7 @@ class MsoRequestBuilder return if (result.isEmpty()) emptyList() else listOf(result) } - private fun createServiceInstantiationVnfList(jobId: UUID?, payload: ServiceInstantiation): ServiceInstantiationRequestDetails.ServiceInstantiationVnfList { + private fun createServiceInstantiationVnfList(jobId: UUID?, payload: ServiceInstantiation): List<ServiceInstantiationRequestDetails.ServiceInstantiationVnf> { val cloudConfiguration = generateCloudConfiguration(payload.lcpCloudRegionId, payload.tenantId) val isBulk = asyncInstantiationBL.isPartOfBulk(jobId) @@ -278,7 +278,27 @@ class MsoRequestBuilder vnfList.add(serviceInstantiationVnf) } - return ServiceInstantiationRequestDetails.ServiceInstantiationVnfList(vnfList) + return vnfList; + } + + private fun createServiceInstantiationPnfList(jobId: UUID?, payload: ServiceInstantiation): List<ServiceInstantiationRequestDetails.ServiceInstantiationPnf> { + val isBulk = asyncInstantiationBL.isPartOfBulk(jobId) + + val pnfs = payload.pnfs + val pnfList = mutableListOf<ServiceInstantiationRequestDetails.ServiceInstantiationPnf>() + for (pnf in pnfs.values) { + val serviceInstantiationPnf = ServiceInstantiationRequestDetails.ServiceInstantiationPnf( + pnf.modelInfo, + pnf.platformName, + pnf.lineOfBusiness, + payload.productFamilyId, + buildPnfInstanceParams(pnf.instanceParams), + getUniqueNameIfNeeded(pnf.instanceName, ResourceType.PNF, isBulk) + ) + pnfList.add(serviceInstantiationPnf) + } + + return pnfList; } private fun convertVfModuleMapToList(vfModules: Map<String, Map<String, VfModule>>): List<VfModuleMacro> { @@ -323,6 +343,13 @@ class MsoRequestBuilder return if (vnfInstanceParams.isEmpty()) emptyList() else ImmutableList.of(vnfInstanceParams) } + fun buildPnfInstanceParams(currentPnfInstanceParams: List<MutableMap<String, String>>): List<Map<String, String>> { + val filteredPnfInstanceParams = removeUnNeededParams(currentPnfInstanceParams) + + val pnfInstanceParams = extractActualInstanceParams(filteredPnfInstanceParams) + return if (pnfInstanceParams.isEmpty()) emptyList() else ImmutableList.of(pnfInstanceParams) + } + private fun generateServiceInstantiationRequestDetails(payload: ServiceInstantiation, requestParameters: ServiceInstantiationRequestDetails.RequestParameters, serviceInstanceName: String?, userId: String): ServiceInstantiationRequestDetails { val requestInfo = ServiceInstantiationRequestDetails.RequestInfo(serviceInstanceName, payload.productFamilyId, @@ -422,7 +449,12 @@ class MsoRequestBuilder } private fun generateMacroServiceInstantiationRequestParams(payload: ServiceInstantiation, serviceInstanceName: String?, jobId: UUID?): List<UserParamTypes> { - val userParams = generateServiceInstantiationServicesList(payload, serviceInstanceName, createServiceInstantiationVnfList(jobId, payload)) + val userParams = generateServiceInstantiationServicesList( + payload, + serviceInstanceName, + createServiceInstantiationVnfList(jobId, payload), + createServiceInstantiationPnfList(jobId, payload) + ) return userParams.plus(homingSolution()) } diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/PnfCommand.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/PnfCommand.kt new file mode 100644 index 000000000..26bd5704a --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/job/command/PnfCommand.kt @@ -0,0 +1,60 @@ +package org.onap.vid.job.command + +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate +import org.onap.vid.job.Job +import org.onap.vid.job.JobAdapter +import org.onap.vid.job.JobCommand +import org.onap.vid.job.JobsBrokerService +import org.onap.vid.job.impl.JobSharedData +import org.onap.vid.model.serviceInstantiation.Pnf +import org.onap.vid.mso.RestMsoImplementation +import org.onap.vid.services.AsyncInstantiationBusinessLogic +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.beans.factory.config.ConfigurableBeanFactory +import org.springframework.context.annotation.Scope +import org.springframework.http.HttpMethod +import org.springframework.stereotype.Component +import org.togglz.core.manager.FeatureManager +import java.util.Optional; + +@Component +@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) +class PnfCommand @Autowired constructor( + private val asyncInstantiationBL: AsyncInstantiationBusinessLogic, + restMso: RestMsoImplementation, + private val msoRequestBuilder: MsoRequestBuilder, + msoResultHandlerService: MsoResultHandlerService, + inProgressStatusService:InProgressStatusService, + watchChildrenJobsBL: WatchChildrenJobsBL, + jobsBrokerService: JobsBrokerService, + jobAdapter: JobAdapter, + private val featureManager: FeatureManager +) : ResourceCommand(restMso, inProgressStatusService, msoResultHandlerService, + watchChildrenJobsBL, jobsBrokerService, jobAdapter, featureManager), JobCommand { + + override fun getData(): Map<String, Any?> { + return super.getData(); + } + + override fun init(sharedData: JobSharedData, commandData: Map<String, Any>): ResourceCommand { + super<ResourceCommand>.init(sharedData, commandData) + return this + } + + override fun createChildren(): Job.JobStatus { + TODO("Not yet implemented") + } + + override fun planCreateMyselfRestCall(commandParentData: CommandParentData, request: JobAdapter.AsyncJobRequest, userId: String, testApi: String?): MsoRestCallPlan { + return MsoRestCallPlan(HttpMethod.POST, "", Optional.empty(), Optional.empty(), ""); + } + + override fun planDeleteMyselfRestCall(commandParentData: CommandParentData, request: JobAdapter.AsyncJobRequest, userId: String): MsoRestCallPlan { + TODO("Not yet implemented") + } + + override fun getRequest(): Pnf { + return sharedData.request as Pnf + } + +} diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/ExistingElementsCounterMaps.java b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/ExistingElementsCounterMaps.java index de63c2c94..f3466f364 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/ExistingElementsCounterMaps.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/ExistingElementsCounterMaps.java @@ -26,6 +26,8 @@ public interface ExistingElementsCounterMaps { Map<String, Long> getExistingVNFCounterMap(); + Map<String, Long> getExistingPNFCounterMap(); + Map<String, Long> getExistingNetworksCounterMap(); Map<String, Long> getExistingVnfGroupCounterMap(); diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Pnf.java b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Pnf.java new file mode 100644 index 000000000..7f483d7d7 --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Pnf.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.vid.model.aaiTree; + +import static org.onap.vid.aai.util.AAITreeConverter.PNF_TYPE; + +public class Pnf extends Node { + + public Pnf(AAITreeNode node) { + super(node); + fillCloudConfigurationProperties(this, node.getCloudConfiguration()); + } + + public static Pnf from(AAITreeNode node) { + Pnf pnf = new Pnf(node); + + if (node.getAdditionalProperties().get(PNF_TYPE) != null) { + pnf.setInstanceType(node.getAdditionalProperties().get(PNF_TYPE).toString()); + } + + return pnf; + } +} diff --git a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/ServiceInstance.java b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/ServiceInstance.java index 78afe1d45..b9a62ced5 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/ServiceInstance.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/aaiTree/ServiceInstance.java @@ -41,6 +41,7 @@ public class ServiceInstance extends AbstractNode implements ExistingElementsCou private boolean isALaCarte; private Map<String, Vnf> vnfs = new HashMap<>(); + private Map<String, Pnf> pnfs = new HashMap<>(); private Map<String, Network> networks = new HashMap<>(); private Map<String, Vrf> vrfs = new HashMap<>(); @@ -50,6 +51,7 @@ public class ServiceInstance extends AbstractNode implements ExistingElementsCou private int validationCounter; private Map<String, Long> existingVNFCounterMap; + private Map<String, Long> existingPNFCounterMap; private Map<String, Long> existingNetworksCounterMap; private Map<String, Long> existingVnfGroupCounterMap; private Map<String, Long> existingVRFCounterMap; @@ -170,6 +172,14 @@ public class ServiceInstance extends AbstractNode implements ExistingElementsCou this.vnfs = vnfs; } + public Map<String, Pnf> getPnfs() { + return pnfs; + } + + public void setPnfs(Map<String, Pnf> pnfs) { + this.pnfs = pnfs; + } + public Map<String, Network> getNetworks() { return networks; } @@ -208,6 +218,15 @@ public class ServiceInstance extends AbstractNode implements ExistingElementsCou } @Override + public Map<String, Long> getExistingPNFCounterMap() { + return existingPNFCounterMap; + } + + public void setExistingPNFCounterMap(Map<String, Long> existingPNFCounterMap) { + this.existingPNFCounterMap = existingPNFCounterMap; + } + + @Override public Map<String, Long> getExistingNetworksCounterMap() { return existingNetworksCounterMap; } diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Pnf.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Pnf.java new file mode 100644 index 000000000..e2bf5794e --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Pnf.java @@ -0,0 +1,95 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.vid.model.serviceInstantiation; + + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.onap.vid.job.JobAdapter; +import org.onap.vid.job.JobType; +import org.onap.vid.mso.model.ModelInfo; + +import java.util.*; + +import static java.util.stream.Collectors.toList; + +/** + * The Class VNF. + */ +public class Pnf extends BaseResource implements JobAdapter.AsyncJobRequest { + + private final String productFamilyId; + + private final String platformName; + + private final String lineOfBusiness; + + public Pnf(@JsonProperty("modelInfo") ModelInfo modelInfo, + @JsonProperty("productFamilyId") String productFamilyId, + @JsonProperty("instanceName") String instanceName, + @JsonProperty("action") String action, + @JsonProperty("platformName") String platformName, + @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId, + @JsonProperty("legacyRegion") String legacyRegion, + @JsonProperty("tenantId") String tenantId, + @JsonProperty("instanceParams") List<Map<String, String>> instanceParams, + @JsonProperty("lineOfBusinessName") String lineOfBusiness, + @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure, + @JsonProperty("instanceId") String instanceId, + @JsonProperty("trackById") String trackById, + @JsonProperty("isFailed") Boolean isFailed, + @JsonProperty("statusMessage") String statusMessage, + @JsonProperty("position") Integer position, + @JsonProperty("originalName") String originalName) { + + super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage, + position, null, originalName); + this.productFamilyId = productFamilyId; + this.platformName = platformName; + this.lineOfBusiness = lineOfBusiness; + } + + public String getProductFamilyId() { + return productFamilyId; + } + + public String getPlatformName() { + return platformName; + } + + public String getLineOfBusiness() { + return lineOfBusiness; + } + + @Override + protected String getModelType() { + return "pnf"; + } + + @Override + public Collection<? extends BaseResource> getChildren() { + return null; + } + + @Override + public JobType getJobType() { + return JobType.VnfInstantiation; + } +} diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java index cae28f7a3..4f47d7b1a 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java @@ -59,6 +59,8 @@ public class ServiceInstantiation extends BaseResource implements JobAdapter.Asy private final Map<String, Vnf> vnfs; + private final Map<String, Pnf> pnfs; + private final Map<String, Network> networks; private final Map<String, InstanceGroup> vnfGroups; @@ -90,6 +92,7 @@ public class ServiceInstantiation extends BaseResource implements JobAdapter.Asy @JsonProperty("aicZoneId") String aicZoneId, @JsonProperty("aicZoneName") String aicZoneName, @JsonProperty("vnfs") Map<String, Vnf> vnfs, + @JsonProperty("pnfs") Map<String, Pnf> pnfs, @JsonProperty("networks") Map<String, Network> networks, @JsonProperty("vnfGroups") Map<String, InstanceGroup> vnfGroups, @JsonProperty("vrfs") Map<String, VrfEntry> vrfs, @@ -119,6 +122,7 @@ public class ServiceInstantiation extends BaseResource implements JobAdapter.Asy this.aicZoneId = aicZoneId; this.aicZoneName = aicZoneName; this.vnfs = vnfs; + this.pnfs = pnfs; this.networks = networks; this.vnfGroups = vnfGroups; this.vrfs = vrfs; @@ -181,6 +185,10 @@ public class ServiceInstantiation extends BaseResource implements JobAdapter.Asy return emptyMapIfNull(vnfs); } + public Map<String, Pnf> getPnfs() { + return emptyMapIfNull(pnfs); + } + public Map<String, Network> getNetworks() { return emptyMapIfNull(networks); } diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiationTemplate.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiationTemplate.java index 9499beb50..ed2ed1610 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiationTemplate.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiationTemplate.java @@ -29,6 +29,7 @@ import org.onap.vid.model.aaiTree.ExistingElementsCounterMaps; public class ServiceInstantiationTemplate extends ServiceInstantiation implements ExistingElementsCounterMaps { private final Map<String, Long> existingVNFCounterMap; + private final Map<String, Long> existingPNFCounterMap; private final Map<String, Long> existingNetworksCounterMap; private final Map<String, Long> existingVnfGroupCounterMap; private final Map<String, Long> existingVRFCounterMap; @@ -37,6 +38,7 @@ public class ServiceInstantiationTemplate extends ServiceInstantiation implement public ServiceInstantiationTemplate( ServiceInstantiation baseService, Map<String, Long> vnfCounterMap, + Map<String, Long> pnfCounterMap, Map<String, Long> networksCounterMap, Map<String, Long> vnfGroupCounterMap, Map<String, Long> VRFCounterMap @@ -47,7 +49,7 @@ public class ServiceInstantiationTemplate extends ServiceInstantiation implement baseService.getProductFamilyId(), baseService.getInstanceName(), baseService.getSubscriptionServiceType(), baseService.getLcpCloudRegionId(), baseService.getLcpCloudRegionId(), baseService.getTenantId(), baseService.getTenantName(), baseService.getAicZoneId(), baseService.getAicZoneName(), - baseService.getVnfs(), baseService.getNetworks(), baseService.getVnfGroups(), baseService.getVrfs(), + baseService.getVnfs(), baseService.getPnfs(), baseService.getNetworks(), baseService.getVnfGroups(), baseService.getVrfs(), baseService.getInstanceParams(), baseService.isPause(), baseService.getBulkSize(), baseService.isRollbackOnFailure(), baseService.isALaCarte(), baseService.getTestApi(), baseService.getInstanceId(), Objects.toString(baseService.getAction(), null), @@ -57,6 +59,7 @@ public class ServiceInstantiationTemplate extends ServiceInstantiation implement ); this.existingVNFCounterMap = vnfCounterMap; + this.existingPNFCounterMap = pnfCounterMap; this.existingNetworksCounterMap = networksCounterMap; this.existingVnfGroupCounterMap = vnfGroupCounterMap; this.existingVRFCounterMap = VRFCounterMap; @@ -68,6 +71,11 @@ public class ServiceInstantiationTemplate extends ServiceInstantiation implement } @Override + public Map<String, Long> getExistingPNFCounterMap() { + return existingPNFCounterMap; + } + + @Override public Map<String, Long> getExistingNetworksCounterMap() { return existingNetworksCounterMap; } diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/Resources.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/Resources.java new file mode 100644 index 000000000..f0504cdde --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/Resources.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * Copyright (C) 2020 Nokia 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.vid.mso.model; + +import java.util.List; + +public class Resources { + + private final List<ServiceInstantiationRequestDetails.ServiceInstantiationVnf> vnfs; + private final List<ServiceInstantiationRequestDetails.ServiceInstantiationPnf> pnfs; + + public Resources(List<ServiceInstantiationRequestDetails.ServiceInstantiationVnf> vnfs, List<ServiceInstantiationRequestDetails.ServiceInstantiationPnf> pnfs) { + this.vnfs = vnfs; + this.pnfs = pnfs; + } + + public List<ServiceInstantiationRequestDetails.ServiceInstantiationVnf> getVnfs() { + return vnfs; + } + + public List<ServiceInstantiationRequestDetails.ServiceInstantiationPnf> getPnfs() { + return pnfs; + } +} + diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java index acbf778ea..d769aac54 100644 --- a/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java @@ -175,8 +175,8 @@ public class ServiceInstantiationRequestDetails { public static class ServiceInstantiationService implements UserParamTypes { private final ServiceInstantiationServiceInner serviceInstantiationServiceInner; - public ServiceInstantiationService(ModelInfo modelInfo, String instanceName, List<Map<String, String>> instanceParams, ServiceInstantiationVnfList vnfs) { - serviceInstantiationServiceInner = new ServiceInstantiationServiceInner(modelInfo, instanceName, instanceParams, vnfs); + public ServiceInstantiationService(ModelInfo modelInfo, String instanceName, List<Map<String, String>> instanceParams, List<ServiceInstantiationVnf> vnfs, List<ServiceInstantiationPnf> pnfs) { + serviceInstantiationServiceInner = new ServiceInstantiationServiceInner(modelInfo, instanceName, instanceParams, vnfs, pnfs); } @JsonProperty("service") @@ -189,15 +189,15 @@ public class ServiceInstantiationRequestDetails { @JsonInclude(NON_EMPTY) public String instanceName; public List<Map<String, String>> instanceParams; - public ServiceInstantiationVnfList resources; + public Resources resources; - public ServiceInstantiationServiceInner(ModelInfo modelInfo, String instanceName, List<Map<String, String>> instanceParams, ServiceInstantiationVnfList vnfs) { + public ServiceInstantiationServiceInner(ModelInfo modelInfo, String instanceName, List<Map<String, String>> instanceParams, List<ServiceInstantiationVnf> vnfs, List<ServiceInstantiationPnf> pnfs) { this.modelInfo.setModelType(modelInfo.getModelType()); this.modelInfo.setModelName(modelInfo.getModelName()); this.modelInfo.setModelVersionId(modelInfo.getModelVersionId()); this.instanceName = instanceName; this.instanceParams = instanceParams; - this.resources = vnfs; + this.resources = new Resources(vnfs, pnfs); } } } @@ -210,6 +210,15 @@ public class ServiceInstantiationRequestDetails { } } + public static class ServiceInstantiationPnfList{ + + public final List<ServiceInstantiationPnf> pnfs; + + public ServiceInstantiationPnfList(List<ServiceInstantiationPnf> pnfList) { + this.pnfs = pnfList; + } + } + public static class ServiceInstantiationVnf{ public final ModelInfo modelInfo; public final CloudConfiguration cloudConfiguration; @@ -232,6 +241,25 @@ public class ServiceInstantiationRequestDetails { } } + public static class ServiceInstantiationPnf{ + + public final ModelInfo modelInfo; + public final Platform platform; + public final LineOfBusiness lineOfBusiness; + public final String productFamilyId; + public final List<Map<String, String>> instanceParams; + @JsonInclude(NON_EMPTY) public final String instanceName; + + public ServiceInstantiationPnf(ModelInfo modelInfo, String platform, String lineOfBusiness, String productFamilyId, List<Map<String, String>> instanceParams, String instanceName) { + this.modelInfo = modelInfo; + this.platform = new Platform(platform); + this.lineOfBusiness = new LineOfBusiness(lineOfBusiness); + this.productFamilyId = productFamilyId; + this.instanceParams = instanceParams; + this.instanceName = instanceName; + } + } + public static class Platform{ public final String platformName; diff --git a/vid-app-common/src/main/java/org/onap/vid/services/InstantiationTemplatesService.java b/vid-app-common/src/main/java/org/onap/vid/services/InstantiationTemplatesService.java index 8837798ef..8c8c1909a 100644 --- a/vid-app-common/src/main/java/org/onap/vid/services/InstantiationTemplatesService.java +++ b/vid-app-common/src/main/java/org/onap/vid/services/InstantiationTemplatesService.java @@ -63,6 +63,7 @@ public class InstantiationTemplatesService { return new ServiceInstantiationTemplate( jobRequest, counterMap(jobRequest.getVnfs()), + counterMap(jobRequest.getPnfs()), counterMap(jobRequest.getNetworks()), counterMap(jobRequest.getVnfGroups()), emptyMap() // model info for VRF is not stored diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java index 85faaab28..6d9ae13de 100644 --- a/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java @@ -286,6 +286,7 @@ public class ResourceCommandTest { static ServiceInstantiation createService(List<Vnf> vnfs, List<Network> networks, List<InstanceGroup> vnfGroups) { return new ServiceInstantiation(mock(ModelInfo.class), null, null, null, null, null, null, null, null, null, null, null, null, null, null, convertToMap(vnfs), + convertToMap(null), convertToMap(networks), convertToMap(vnfGroups), null, diff --git a/vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.java b/vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.java index ce94a7096..62108d5aa 100644 --- a/vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.java @@ -213,7 +213,7 @@ public class AsyncInstantiationIntegrationTest extends AsyncInstantiationBaseTes private List<UUID> pushMacroBulk() { ServiceInstantiation serviceInstantiation = generateMockMacroServiceInstantiationPayload(false, createVnfList(instanceParamsMapWithoutParams, Collections.EMPTY_LIST, true), - 3, true,PROJECT_NAME, true); + createPnfList(), 3, true,PROJECT_NAME, true); return asyncInstantiationBL.pushBulkJob(serviceInstantiation, USER_ID); } diff --git a/vid-app-common/src/test/java/org/onap/vid/model/serviceInstantiation/InstantiationModelSerializationTest.java b/vid-app-common/src/test/java/org/onap/vid/model/serviceInstantiation/InstantiationModelSerializationTest.java index 81ba9578f..632552e75 100644 --- a/vid-app-common/src/test/java/org/onap/vid/model/serviceInstantiation/InstantiationModelSerializationTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/model/serviceInstantiation/InstantiationModelSerializationTest.java @@ -81,6 +81,7 @@ public class InstantiationModelSerializationTest { emptyMap(), emptyMap(), emptyMap(), + emptyMap(), instanceParams, true, 1, diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java index 738af18cf..7ed3e6795 100644 --- a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java @@ -57,13 +57,10 @@ import org.onap.vid.model.Action; import org.onap.vid.model.ServiceInfo; import org.onap.vid.model.ServiceInfo.ServiceAction; import org.onap.vid.model.VidNotions; -import org.onap.vid.model.serviceInstantiation.InstanceGroup; -import org.onap.vid.model.serviceInstantiation.Network; -import org.onap.vid.model.serviceInstantiation.ServiceInstantiation; -import org.onap.vid.model.serviceInstantiation.VfModule; -import org.onap.vid.model.serviceInstantiation.Vnf; +import org.onap.vid.model.serviceInstantiation.*; import org.onap.vid.mso.RestObject; import org.onap.vid.mso.model.ModelInfo; +import org.onap.vid.mso.model.ServiceInstantiationRequestDetails; import org.onap.vid.mso.model.ServiceInstantiationRequestDetails.UserParamNameAndValue; import org.onap.vid.mso.rest.AsyncRequestStatus; import org.onap.vid.mso.rest.RequestStatus; @@ -190,22 +187,22 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests } - public ServiceInstantiation generateMockMacroServiceInstantiationPayload(boolean isPause, Map<String, Vnf> vnfs, int bulkSize, boolean isUserProvidedNaming, String projectName, boolean rollbackOnFailure) { - return generateMockServiceInstantiationPayload(isPause, vnfs, Collections.EMPTY_MAP, Collections.EMPTY_MAP, bulkSize, isUserProvidedNaming, projectName, rollbackOnFailure, false, null, Action.Create, null); + public ServiceInstantiation generateMockMacroServiceInstantiationPayload(boolean isPause, Map<String, Vnf> vnfs, Map<String, Pnf> pnfs, int bulkSize, boolean isUserProvidedNaming, String projectName, boolean rollbackOnFailure) { + return generateMockServiceInstantiationPayload(isPause, vnfs, pnfs, Collections.EMPTY_MAP, Collections.EMPTY_MAP, bulkSize, isUserProvidedNaming, projectName, rollbackOnFailure, false, null, Action.Create, null); } public ServiceInstantiation generateMockALaCarteServiceInstantiationPayload(boolean isPause, Map<String, Vnf> vnfs, Map<String, Network> networks, Map<String, InstanceGroup> vnfGroups, int bulkSize, boolean isUserProvidedNaming, String projectName, boolean rollbackOnFailure, String testApi) { - return generateMockServiceInstantiationPayload(isPause, vnfs, networks, vnfGroups, bulkSize, isUserProvidedNaming, projectName, rollbackOnFailure, true, testApi, Action.Create, null); + return generateMockServiceInstantiationPayload(isPause, vnfs, null, networks, vnfGroups, bulkSize, isUserProvidedNaming, projectName, rollbackOnFailure, true, testApi, Action.Create, null); } public ServiceInstantiation generateMockAlaCarteServiceDeletionPayload(boolean isPause, Map<String, Vnf> vnfs, Map<String, Network> networks, Map<String, InstanceGroup> vnfGroups, int bulkSize, boolean isUserProvidedNaming, String projectName, boolean rollbackOnFailure, String testApi, String instanceId) { - return generateMockServiceInstantiationPayload(isPause, vnfs, networks, vnfGroups, bulkSize, isUserProvidedNaming, projectName, rollbackOnFailure, true, testApi, Action.Delete, instanceId); + return generateMockServiceInstantiationPayload(isPause, vnfs, null, networks, vnfGroups, bulkSize, isUserProvidedNaming, projectName, rollbackOnFailure, true, testApi, Action.Delete, instanceId); } - public ServiceInstantiation generateMockServiceDeletionPayload(boolean isPause, Map<String, Vnf> vnfs, Map<String, Network> networks, Map<String, InstanceGroup> vnfGroups, int bulkSize, boolean isUserProvidedNaming, String projectName, boolean rollbackOnFailure, String testApi, String instanceId) { - return generateMockServiceInstantiationPayload(isPause, vnfs, networks, vnfGroups, bulkSize, isUserProvidedNaming, projectName, rollbackOnFailure, false, testApi, Action.Delete, instanceId); + public ServiceInstantiation generateMockServiceDeletionPayload(boolean isPause, Map<String, Vnf> vnfs, Map<String, Pnf> pnfs, Map<String, Network> networks, Map<String, InstanceGroup> vnfGroups, int bulkSize, boolean isUserProvidedNaming, String projectName, boolean rollbackOnFailure, String testApi, String instanceId) { + return generateMockServiceInstantiationPayload(isPause, vnfs, pnfs, networks, vnfGroups, bulkSize, isUserProvidedNaming, projectName, rollbackOnFailure, false, testApi, Action.Delete, instanceId); } - private ServiceInstantiation generateMockServiceInstantiationPayload(boolean isPause, Map<String, Vnf> vnfs, Map<String, Network> networks, Map<String, InstanceGroup> vnfGroups, int bulkSize, boolean isUserProvidedNaming, String projectName, boolean rollbackOnFailure, boolean isAlacarte, String testApi, Action action, String instanceId) { + private ServiceInstantiation generateMockServiceInstantiationPayload(boolean isPause, Map<String, Vnf> vnfs, Map<String, Pnf> pnfs, Map<String, Network> networks, Map<String, InstanceGroup> vnfGroups, int bulkSize, boolean isUserProvidedNaming, String projectName, boolean rollbackOnFailure, boolean isAlacarte, String testApi, Action action, String instanceId) { ModelInfo modelInfo = createModelInfo(); List<Map<String,String>> instanceParams = createInstanceParams(); @@ -226,6 +223,7 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests AsyncInstantiationBusinessLogicTest.AIC_ZONE_ID, AsyncInstantiationBusinessLogicTest.AIC_ZONE_NAME, vnfs, + pnfs, networks, vnfGroups, null, @@ -304,6 +302,26 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests return createModelInfo("vnf", modelName, modelVersion, modelVersionId, modelInvariantId, modelCustomizationId, modelCustomizationName); } + protected ModelInfo createPnfModelInfo() { + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationName("modelCustomizationName"); + modelInfo.setModelCustomizationId("modelCustomizationId"); + modelInfo.setModelInvariantId("modelInvariantId"); + modelInfo.setModelVersionId("modelVersionId"); + modelInfo.setModelName("modelName"); + modelInfo.setModelType("pnf"); + modelInfo.setModelVersion("1.0"); + return modelInfo; + } + + protected Pnf createPnf() { + ModelInfo modelInfo = createPnfModelInfo(); + List<Map<String, String>> instanceParams = new ArrayList<>(); + + return new Pnf(modelInfo, "productFamilyId", "instanceName", null, "platformName", null, null, + null, instanceParams, "lineOfBusinessName", true,null, null, null, null, null, null); + } + private ModelInfo createNetworkModelInfo(boolean isAlacarte, String modelCustomizationId) { ModelInfo modelInfo = new ModelInfo(); @@ -373,6 +391,16 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests return vnfs; } + protected Map<String, Pnf> createPnfList() { + Map<String, Pnf> pnfs = new HashMap<>(); + Pnf pnf = createPnf(); + + pnfs.put(pnf.getModelInfo().getModelName(), pnf); + + + return pnfs; + } + protected void mockAaiClientAaiStatusOK() { when(aaiClient.isNodeTypeExistsByName(eq(AsyncInstantiationBusinessLogicImpl.NAME_FOR_CHECK_AAI_STATUS), any())).thenReturn(false); } @@ -387,8 +415,8 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests enableAddCloudOwnerOnMsoRequest(true); } - protected ServiceInstantiation generateMacroMockServiceInstantiationPayload(boolean isPause, Map<String, Vnf> vnfs) { - return generateMockMacroServiceInstantiationPayload(isPause, vnfs, 1, true, PROJECT_NAME, false); + protected ServiceInstantiation generateMacroMockServiceInstantiationPayload(boolean isPause, Map<String, Vnf> vnfs, Map<String, Pnf> pnfs) { + return generateMockMacroServiceInstantiationPayload(isPause, vnfs, pnfs,1, true, PROJECT_NAME, false); } protected ServiceInstantiation generatePre1806MacroTransportServiceInstantiationPayload(String tenantId, String lcpCloudRegionId) { @@ -397,7 +425,7 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests ServiceInstantiation serviceInstantiation = new ServiceInstantiation(createServiceModelInfo(), "038d99af-0427-42c2-9d15-971b99b9b489", "JULIO ERICKSON", "some_project_name", "some_subscriber_id", "some_subscriber_name", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", null, "MOG", lcpCloudRegionId, null, tenantId, - null, null, null, Collections.EMPTY_MAP, Collections.EMPTY_MAP, Collections.EMPTY_MAP, Collections.EMPTY_MAP, instanceParams, false, 1, false, false, + null, null, null, Collections.EMPTY_MAP, Collections.EMPTY_MAP, Collections.EMPTY_MAP, Collections.EMPTY_MAP, Collections.EMPTY_MAP, instanceParams, false, 1, false, false, null, null, null, null, null, null, new VidNotions(InstantiationUI.TRANSPORT_SERVICE, ModelCategory.Transport, InstantiationUI.TRANSPORT_SERVICE, InstantiationType.Macro), "originalName" ); @@ -516,7 +544,7 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests "foo:002", instanceGroup2, "foo:003", instanceGroup3 ); - return generateMockServiceInstantiationPayload(false, emptyMap(), emptyMap(), groups, + return generateMockServiceInstantiationPayload(false, emptyMap(), emptyMap(), emptyMap(), groups, 1, true, PROJECT_NAME, false, true, "VNF_API", Action.None, "1234567890"); } diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java index 284efce45..5ff05a471 100644 --- a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java @@ -409,7 +409,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT @Test(dataProvider = "pauseAndInstanceParams") public void createMacroServiceInstantiationMsoRequestUniqueName(Boolean isPause, HashMap<String, String> vfModuleInstanceParamsMap, List vnfInstanceParams) throws Exception { defineMocks(); - ServiceInstantiation serviceInstantiationPayload = generateMockMacroServiceInstantiationPayload(isPause, createVnfList(vfModuleInstanceParamsMap, vnfInstanceParams, true), 2, true, PROJECT_NAME, false); + ServiceInstantiation serviceInstantiationPayload = generateMockMacroServiceInstantiationPayload(isPause, createVnfList(vfModuleInstanceParamsMap, vnfInstanceParams, true), null, 2, true, PROJECT_NAME, false); final URL resource = this.getClass().getResource("/payload_jsons/bulk_service_request_unique_names.json"); when(jobAdapterMock.createServiceInstantiationJob(any(), any(), any(), any(), any(), anyString(), any())).thenAnswer(invocation -> { Object[] args = invocation.getArguments(); @@ -481,7 +481,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT final ServiceInstantiation request = generateMockMacroServiceInstantiationPayload( false, createVnfList(instanceParamsMapWithoutParams, Collections.EMPTY_LIST, true), - bulkSize, isUserProvidedNaming, projectName, true + createPnfList(), bulkSize, isUserProvidedNaming, projectName, true ); // in "createServiceInstantiationJob()" we will probe the service, with the generated names @@ -618,7 +618,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT ServiceInstantiation macroPayload = generateMockMacroServiceInstantiationPayload( false, createVnfList(instanceParamsMapWithoutParams, ImmutableList.of(vnfInstanceParamsMapWithParamsToRemove, vnfInstanceParamsMapWithParamsToRemove), true), - 2, false,PROJECT_NAME, false); + createPnfList(), 2, false,PROJECT_NAME, false); ServiceInstantiation aLaCartePayload = generateALaCarteServiceInstantiationPayload(); return new Object[][]{ @@ -733,7 +733,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT @Test(dataProvider = "isPauseAndPropertyDataProvider") public void testServiceInstantiationPath_RequestPathIsAsExpected(boolean isPause, String expectedProperty) { - ServiceInstantiation serviceInstantiationPauseFlagTrue = generateMacroMockServiceInstantiationPayload(isPause, createVnfList(instanceParamsMapWithoutParams, Collections.EMPTY_LIST, true)); + ServiceInstantiation serviceInstantiationPauseFlagTrue = generateMacroMockServiceInstantiationPayload(isPause, createVnfList(instanceParamsMapWithoutParams, Collections.EMPTY_LIST, true), createPnfList()); String path = asyncInstantiationBL.getServiceInstantiationPath(serviceInstantiationPauseFlagTrue); Assert.assertEquals(path, SystemProperties.getProperty(expectedProperty)); } @@ -752,7 +752,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT final ServiceInstantiation request = generateMockMacroServiceInstantiationPayload( false, createVnfList(instanceParamsMapWithoutParams, Collections.EMPTY_LIST, true), - 100, true,PROJECT_NAME, true + createPnfList(), 100, true,PROJECT_NAME, true ); pushJobAndAssertDates(startTestDate, request); @@ -1013,7 +1013,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT @Test public void pushBulkJob_verifyMacroFlow_useMacroServiceInstantiationJobType(){ - final ServiceInstantiation request = generateMacroMockServiceInstantiationPayload(false, Collections.emptyMap()); + final ServiceInstantiation request = generateMacroMockServiceInstantiationPayload(false, Collections.emptyMap(), Collections.emptyMap()); // in "createServiceInstantiationJob()" we will probe the service, with the generated names configureMockitoWithMockedJob(); @@ -1064,7 +1064,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT public void whenLcpRegionNotEmpty_thenCloudRegionIdOfServiceIsLegacy() { String legacyCloudRegion = "legacyCloudRegion"; ServiceInstantiation service = new ServiceInstantiation(new ModelInfo(), null, null, null, null, null, null, - null, null, "anyCloudRegion", legacyCloudRegion, null, null, null, null, null, null, null, null, null, + null, null, "anyCloudRegion", legacyCloudRegion, null, null, null, null, null, null, null, null, null, null, false, 1,false, false, null, null, Action.Create.name(), UUID.randomUUID().toString(), null, null, null, "originalName"); assertThat(service.getLcpCloudRegionId(), equalTo(legacyCloudRegion)); } @@ -1087,7 +1087,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT @NotNull protected ServiceInstantiation createServiceWithIsALaCarteAndAction(boolean isALaCarte, Action action) { return new ServiceInstantiation(new ModelInfo(), null, null, null, null, null, null, - null, null, null, null, null, null, null, null, null, null, null, null, null, + null, null, null, null, null, null, null, null, null, null, null, null, null, null, false, 1, false, isALaCarte, null, null, action.name(), UUID.randomUUID().toString(), null, null, null, "originalName"); } diff --git a/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java b/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java index ef2a6a5fb..1fc3879a4 100644 --- a/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java @@ -137,7 +137,7 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest { @Test(dataProvider = "pauseAndInstanceParams", enabled = false) //Test is irrelevant with unique names feature public void createMacroServiceInstantiationMsoRequest(Boolean isPause, HashMap<String, String> vfModuleInstanceParamsMap, List vnfInstanceParams) throws Exception { - ServiceInstantiation serviceInstantiationPayload = generateMacroMockServiceInstantiationPayload(isPause, createVnfList(vfModuleInstanceParamsMap, vnfInstanceParams, true)); + ServiceInstantiation serviceInstantiationPayload = generateMacroMockServiceInstantiationPayload(isPause, createVnfList(vfModuleInstanceParamsMap, vnfInstanceParams, true), createPnfList()); final URL resource = this.getClass().getResource("/payload_jsons/bulk_macro_service_request.json"); RequestDetailsWrapper<ServiceInstantiationRequestDetails> result = msoRequestBuilder.generateMacroServiceInstantiationRequest(null, serviceInstantiationPayload, serviceInstantiationPayload.getInstanceName(), "az2016"); @@ -166,9 +166,8 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest { private void createMacroServiceInfo_WithUserProvidedNamingFalse_ServiceInfoIsAsExpected(boolean withVfmodules, boolean disabledHoming) throws IOException { ServiceInstantiation serviceInstantiationPayload = generateMockMacroServiceInstantiationPayload(true, - createVnfList(vfModuleInstanceParamsMapWithParamsToRemove, EMPTY_LIST, false), - 1, - false, PROJECT_NAME, true); + createVnfList(vfModuleInstanceParamsMapWithParamsToRemove, EMPTY_LIST, false), null, + 1, false, PROJECT_NAME, true); URL resource; if (disabledHoming) { resource = this.getClass().getResource("/payload_jsons/bulk_service_no_homing.json"); @@ -258,7 +257,7 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest { } private ServiceInstantiation generateServiceDeletionPayload() { - return generateMockServiceDeletionPayload(false, EMPTY_MAP, EMPTY_MAP, EMPTY_MAP, 1, true, PROJECT_NAME, false, "VNF_API", "1234567890"); + return generateMockServiceDeletionPayload(false, EMPTY_MAP, EMPTY_MAP, EMPTY_MAP, EMPTY_MAP,1, true, PROJECT_NAME, false, "VNF_API", "1234567890"); } @DataProvider @@ -484,16 +483,14 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest { public void checkIfNullProjectNameSentToMso() { ServiceInstantiation serviceInstantiationPayload = generateMockMacroServiceInstantiationPayload(true, createVnfList(vfModuleInstanceParamsMapWithParamsToRemove, EMPTY_LIST, false), - 1, - false, null, false); + createPnfList(), 1, false, null, false); RequestDetailsWrapper<ServiceInstantiationRequestDetails> result = msoRequestBuilder.generateMacroServiceInstantiationRequest(null, serviceInstantiationPayload, serviceInstantiationPayload.getInstanceName(), "az2016"); JsonNode jsonNode = new ObjectMapper().valueToTree(result.requestDetails); Assert.assertTrue(jsonNode.get("project").isNull()); serviceInstantiationPayload = generateMockMacroServiceInstantiationPayload(true, createVnfList(vfModuleInstanceParamsMapWithParamsToRemove, EMPTY_LIST, false), - 1, - false, "not null", false); + createPnfList(), 1, false, "not null", false); result = msoRequestBuilder.generateMacroServiceInstantiationRequest(null, serviceInstantiationPayload, serviceInstantiationPayload.getInstanceName(), "az2016"); jsonNode = new ObjectMapper().valueToTree(result.requestDetails); Assert.assertTrue(jsonNode.get("project").get("projectName").asText().equalsIgnoreCase("not null")); diff --git a/vid-app-common/src/test/resources/getTopology/serviceWithCR/getTopologyWithCR.json b/vid-app-common/src/test/resources/getTopology/serviceWithCR/getTopologyWithCR.json index f038427c5..cba323c7e 100644 --- a/vid-app-common/src/test/resources/getTopology/serviceWithCR/getTopologyWithCR.json +++ b/vid-app-common/src/test/resources/getTopology/serviceWithCR/getTopologyWithCR.json @@ -25,6 +25,7 @@ "rollbackOnFailure": null, "isALaCarte": false, "vnfs": {}, + "pnfs": {}, "networks": {}, "vrfs": {}, "vnfGroups": {}, @@ -89,6 +90,7 @@ }, "validationCounter": 0, "existingVNFCounterMap": {}, + "existingPNFCounterMap": null, "existingNetworksCounterMap": {}, "existingVnfGroupCounterMap": {}, "existingVRFCounterMap": {} diff --git a/vid-app-common/src/test/resources/payload_jsons/bulk_macro_service_request.json b/vid-app-common/src/test/resources/payload_jsons/bulk_macro_service_request.json index c0315d015..4c0740ad5 100644 --- a/vid-app-common/src/test/resources/payload_jsons/bulk_macro_service_request.json +++ b/vid-app-common/src/test/resources/payload_jsons/bulk_macro_service_request.json @@ -88,7 +88,29 @@ "vre_a_volume_size_0": "100" }] }] - }] + }], + "pnfs": [ + { + "modelInfo": { + "modelCustomizationName": "modelCustomizationName", + "modelCustomizationId": "modelCustomizationId", + "modelInvariantId": "modelInvariantId", + "modelVersionId": "modelVersionId", + "modelName": "modelName", + "modelType": "pnf", + "modelVersion": "1.0" + }, + "platform": { + "platformName": "platformName" + }, + "lineOfBusiness": { + "lineOfBusinessName": "lineOfBusinessName" + }, + "productFamilyId": "productFamilyId", + "instanceParams": [], + "instanceName": "instanceName" + } + ] } } }] diff --git a/vid-app-common/src/test/resources/payload_jsons/bulk_service_no_homing.json b/vid-app-common/src/test/resources/payload_jsons/bulk_service_no_homing.json index f61280024..4c8b4cd96 100644 --- a/vid-app-common/src/test/resources/payload_jsons/bulk_service_no_homing.json +++ b/vid-app-common/src/test/resources/payload_jsons/bulk_service_no_homing.json @@ -88,7 +88,8 @@ "vre_a_volume_size_0": "100" }] }] - }] + }], + "pnfs": [] } } }, diff --git a/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_ecomp_naming.json b/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_ecomp_naming.json index dd343f46e..8676d53d2 100644 --- a/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_ecomp_naming.json +++ b/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_ecomp_naming.json @@ -88,7 +88,8 @@ "vre_a_volume_size_0": "100" }] }] - }] + }], + "pnfs": [] } } }] diff --git a/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_no_vfmodule_ecomp_naming.json b/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_no_vfmodule_ecomp_naming.json index 0ef15d790..22ac8951c 100644 --- a/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_no_vfmodule_ecomp_naming.json +++ b/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_no_vfmodule_ecomp_naming.json @@ -59,7 +59,8 @@ }, "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", "instanceParams": [] - }] + }], + "pnfs": [] } } }] diff --git a/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_unique_names.json b/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_unique_names.json index c4f40a9c0..fe89a62ad 100644 --- a/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_unique_names.json +++ b/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_unique_names.json @@ -94,7 +94,8 @@ "vre_a_volume_size_0": "100" }] }] - }] + }], + "pnfs": [] } } }] |