summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java
diff options
context:
space:
mode:
authorMateusz Gołuchowski <mateusz.goluchowski@nokia.com>2020-11-05 15:47:23 +0100
committerIkram Ikramullah <ikram@research.att.com>2020-11-27 15:14:17 +0000
commit164596ffc56c1f9a4418a2f3b8f3941896b124f7 (patch)
tree6b622ce09273cad1e73735f77dd650624a54e5f1 /vid-app-common/src/main/java
parent3e558222d300ff70ff490914cc2245cf2a59e72a (diff)
Update VID SO API call generation - include PNF instanceName parameter in SO API call (macro)
Creation of functionality to prepare service with PNF request which call SO. Issue-ID: VID-695 Signed-off-by: Mateusz Goluchowski <mateusz.goluchowski@nokia.com> Change-Id: I5285ac2ab5e95665244ca18c6549249d9330b1ed
Diffstat (limited to 'vid-app-common/src/main/java')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/model/ResourceType.java1
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/util/AAITreeConverter.java1
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/JobType.java1
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt44
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/command/PnfCommand.kt60
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/ExistingElementsCounterMaps.java2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/Pnf.java41
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/aaiTree/ServiceInstance.java19
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Pnf.java95
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java8
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiationTemplate.java10
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/Resources.java43
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java38
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/InstantiationTemplatesService.java1
14 files changed, 352 insertions, 12 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