aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Pnf.java13
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoPnf.java27
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java13
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java48
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java73
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java32
7 files changed, 206 insertions, 11 deletions
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<Pnf> {
@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<Pnf> {
@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<Pnf> {
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 145d4c83a7..e7e51bba77 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)) {
@@ -1503,8 +1496,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<Vnfs, VfModules> 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);
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java
new file mode 100644
index 0000000000..aa9943b9b1
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java
@@ -0,0 +1,73 @@
+/*-
+ * ============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 static org.junit.Assert.*;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.Pnfs;
+import static org.mockito.Mockito.doReturn;
+
+@RunWith(MockitoJUnitRunner.class)
+public class BBInputSetupPnfTest {
+
+ @Mock
+ private Pnfs pnfs;
+
+ @Mock
+ private ModelInfo modelInfo;
+
+ @Test
+ public void populatePnfShouldSetRequiredFields() {
+ final String pnfId = "PNF_id1";
+ final String pnfName = "PNF_name1";
+ final String modelCustomizationId = "8421fe03-fd1b-4bf7-845a-c3fe91edb031";
+ final String modelInvariantId = "3360a2a5-22ff-44c7-8935-08c8e5ecbd06";
+ final String modelVersionId = "b80c3a52-abd4-436c-a22e-9c5da768781a";
+
+ doReturn(modelCustomizationId).when(modelInfo).getModelCustomizationId();
+ doReturn(modelInvariantId).when(modelInfo).getModelInvariantId();
+ doReturn(modelVersionId).when(modelInfo).getModelVersionId();
+ doReturn(pnfName).when(pnfs).getInstanceName();
+ doReturn(modelInfo).when(pnfs).getModelInfo();
+
+ ServiceInstance serviceInstance = new ServiceInstance();
+ BBInputSetupPnf.populatePnfToServiceInstance(pnfs, pnfId, serviceInstance);
+
+ assertEquals(1, serviceInstance.getPnfs().size());
+
+ Pnf pnf = serviceInstance.getPnfs().get(0);
+
+ assertEquals(pnfId, pnf.getPnfId());
+ assertEquals(pnfName, pnf.getPnfName());
+ assertEquals(modelCustomizationId, pnf.getModelInfoPnf().getModelCustomizationUuid());
+ assertEquals(modelInvariantId, pnf.getModelInfoPnf().getModelInvariantUuid());
+ assertEquals(modelVersionId, pnf.getModelInfoPnf().getModelUuid());
+ assertEquals(OrchestrationStatus.PRECREATED, pnf.getOrchestrationStatus());
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
index 11a7b83259..cf56964af3 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
@@ -90,6 +90,17 @@ public class AAIObjectMapper {
}
public org.onap.aai.domain.yang.Pnf mapPnf(Pnf pnf) {
+ if (modelMapper.getTypeMap(Pnf.class, org.onap.aai.domain.yang.Pnf.class) == null) {
+ modelMapper.addMappings(new PropertyMap<Pnf, org.onap.aai.domain.yang.Pnf>() {
+ @Override
+ protected void configure() {
+ map().setModelCustomizationId(source.getModelInfoPnf().getModelCustomizationUuid());
+ map().setModelInvariantId(source.getModelInfoPnf().getModelInvariantUuid());
+ map().setModelVersionId(source.getModelInfoPnf().getModelUuid());
+ }
+ });
+ }
+
return modelMapper.map(pnf, org.onap.aai.domain.yang.Pnf.class);
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
index 821e70a8c8..dc64e4ee48 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
* You may obtain a copy of the License at
@@ -41,6 +43,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget;
import org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment;
@@ -55,6 +58,7 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@@ -233,6 +237,34 @@ public class AAIObjectMapperTest {
}
@Test
+ public void pnfMap() {
+ final String pnfId = "PNF_id1";
+ final String pnfName = "PNF_name1";
+ final String modelCustomizationId = "8421fe03-fd1b-4bf7-845a-c3fe91edb03e";
+ final String modelInvariantId = "341a6f84-2cf9-4942-8f9e-2472ffe4e1d8";
+ final String modelVersionId = "b13a0706-46b9-4a98-a9f9-5b28431235e7";
+ final OrchestrationStatus orchestrationStatus = OrchestrationStatus.PRECREATED;
+
+ Pnf pnf = new Pnf();
+ pnf.setPnfId(pnfId);
+ pnf.setPnfName(pnfName);
+ pnf.setModelInfoPnf(new ModelInfoPnf());
+ pnf.getModelInfoPnf().setModelCustomizationUuid(modelCustomizationId);
+ pnf.getModelInfoPnf().setModelInvariantUuid(modelInvariantId);
+ pnf.getModelInfoPnf().setModelUuid(modelVersionId);
+ pnf.setOrchestrationStatus(orchestrationStatus);
+
+ org.onap.aai.domain.yang.Pnf aaiPnf = aaiObjectMapper.mapPnf(pnf);
+
+ assertEquals(aaiPnf.getPnfId(), pnfId);
+ assertEquals(aaiPnf.getPnfName(), pnfName);
+ assertEquals(aaiPnf.getModelCustomizationId(), modelCustomizationId);
+ assertEquals(aaiPnf.getModelInvariantId(), modelInvariantId);
+ assertEquals(aaiPnf.getModelVersionId(), modelVersionId);
+ assertEquals(aaiPnf.getOrchestrationStatus(), orchestrationStatus.toString());
+ }
+
+ @Test
public void vfModuleMap() throws Exception {
VfModule vfModule = new VfModule();
vfModule.setVfModuleId("a");