From 6829555c125ee4243482acc792455272c214c6fe Mon Sep 17 00:00:00 2001 From: Joanna Jeremicz Date: Tue, 4 Feb 2020 13:21:31 +0100 Subject: AssignPnfBB - store model related PNF parameters in AAI Issue-ID: SO-2640 Change-Id: Ie30c928e730ab858e9fe4ac5a4b14cebf6c0f806 Signed-off-by: Joanna Jeremicz --- .../bpmn/servicedecomposition/bbobjects/Pnf.java | 13 +++++- .../modelinfo/ModelInfoPnf.java | 27 ++++++++++++ .../servicedecomposition/tasks/BBInputSetup.java | 13 ++---- .../tasks/BBInputSetupPnf.java | 48 ++++++++++++++++++++++ 4 files changed, 90 insertions(+), 11 deletions(-) create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoPnf.java create mode 100644 bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java (limited to 'bpmn/MSOCommonBPMN/src/main') diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Pnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Pnf.java index 772c61e48b..1953ba410b 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Pnf.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Pnf.java @@ -24,6 +24,7 @@ import java.io.Serializable; import javax.persistence.Id; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf; import org.onap.so.db.catalog.beans.OrchestrationStatus; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonRootName; @@ -41,7 +42,7 @@ public class Pnf implements Serializable, ShallowCopy { @JsonProperty("pnf-name") private String pnfName; - @JsonProperty("role") + @JsonProperty("nf-role") private String role; @JsonProperty("orchestration-status") @@ -50,6 +51,8 @@ public class Pnf implements Serializable, ShallowCopy { @JsonProperty("cloud-region") private CloudRegion cloudRegion; + @JsonProperty("model-info-pnf") + private ModelInfoPnf modelInfoPnf; public String getPnfId() { return pnfId; @@ -97,6 +100,14 @@ public class Pnf implements Serializable, ShallowCopy { this.cloudRegion = cloudRegion; } + public ModelInfoPnf getModelInfoPnf() { + return modelInfoPnf; + } + + public void setModelInfoPnf(ModelInfoPnf modelInfoPnf) { + this.modelInfoPnf = modelInfoPnf; + } + @Override public boolean equals(final Object other) { if (!(other instanceof Pnf)) { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoPnf.java new file mode 100644 index 0000000000..a01fa9698b --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoPnf.java @@ -0,0 +1,27 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.so.bpmn.servicedecomposition.modelinfo; + +import java.io.Serializable; + +public class ModelInfoPnf extends ModelInfoMetadata implements Serializable { + private static final long serialVersionUID = 50687109134317615L; +} diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index a4793476e4..a5ad64ef55 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -6,7 +6,7 @@ * ================================================================================ * Modifications Copyright (c) 2019 Samsung * ================================================================================ - * Modifications Copyright (c) 2019 Nokia + * Modifications Copyright (c) 2020 Nokia * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -815,13 +815,6 @@ public class BBInputSetup implements JavaDelegate { } } - private void populatePnf(Pnfs pnf, String pnfId, ServiceInstance serviceInstance) { - Pnf genericPnf = new Pnf(); - genericPnf.setPnfId(pnfId); - genericPnf.setPnfName(pnf.getInstanceName()); - serviceInstance.getPnfs().add(genericPnf); - } - protected boolean instanceGroupInList(GenericVnf vnf, String instanceGroupId) { for (InstanceGroup instanceGroup : vnf.getInstanceGroups()) { if (instanceGroup.getId() != null && instanceGroup.getId().equalsIgnoreCase(instanceGroupId)) { @@ -1495,8 +1488,8 @@ public class BBInputSetup implements JavaDelegate { } else if (bbName.contains(PNF)) { String pnfId = lookupKeyMap.get(ResourceKey.PNF); resources.getPnfs().stream() - .filter(pnf -> Objects.equals(key, pnf.getModelInfo().getModelCustomizationId())).findFirst() - .ifPresent(pnf -> this.populatePnf(pnf, pnfId, serviceInstance)); + .filter(pnfs -> Objects.equals(key, pnfs.getModelInfo().getModelCustomizationId())).findFirst() + .ifPresent(pnfs -> BBInputSetupPnf.populatePnfToServiceInstance(pnfs, pnfId, serviceInstance)); } else if (bbName.contains(VF_MODULE) || bbName.contains(VOLUME_GROUP)) { Pair vnfsAndVfModules = getVfModulesAndItsVnfsByKey(key, resources); if (vnfsAndVfModules != null) { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java new file mode 100644 index 0000000000..68161a8dd5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.so.bpmn.servicedecomposition.tasks; + +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.serviceinstancebeans.Pnfs; + +final class BBInputSetupPnf { + + private BBInputSetupPnf() { + throw new IllegalStateException("Utility class"); + } + + static void populatePnfToServiceInstance(Pnfs pnfs, String pnfId, ServiceInstance serviceInstance) { + Pnf pnf = new Pnf(); + pnf.setPnfId(pnfId); + pnf.setPnfName(pnfs.getInstanceName()); + pnf.setModelInfoPnf(new ModelInfoPnf()); + pnf.getModelInfoPnf().setModelCustomizationUuid(pnfs.getModelInfo().getModelCustomizationId()); + pnf.getModelInfoPnf().setModelInvariantUuid(pnfs.getModelInfo().getModelInvariantId()); + pnf.getModelInfoPnf().setModelUuid(pnfs.getModelInfo().getModelVersionId()); + pnf.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + + serviceInstance.getPnfs().add(pnf); + } +} -- cgit 1.2.3-korg