Merge "SOL003 Adapter Package Management - Fetch VNF Package Artifacts"
authorByung-Woo Jun <byung-woo.jun@est.tech>
Thu, 2 Jan 2020 12:30:06 +0000 (12:30 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 2 Jan 2020 12:30:06 +0000 (12:30 +0000)
adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/pom.xml
adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/src/main/resources/ETSI-Catalog-Notification-API.json [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
common/src/main/java/org/onap/so/serviceinstancebeans/Pnfs.java [new file with mode: 0644]
common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java

index f828a12..e874c4b 100644 (file)
@@ -15,6 +15,8 @@
     <threetenbp-version>1.3.5</threetenbp-version>
     <oltu-version>1.0.1</oltu-version>
     <swagger-core-version>1.5.15</swagger-core-version>
+    <okhttp3-version>3.14.0</okhttp3-version>
+    <okhttp-version>2.7.5</okhttp-version>
   </properties>
   <name>mso-vnfm-adapter-api</name>
   <description>MSO VNFM adapter API</description>
               </configOptions>
             </configuration>
           </execution>
+
+          <execution>
+            <id>etsicatalog-notification-api</id>
+            <goals>
+              <goal>generate</goal>
+            </goals>
+            <configuration>
+              <inputSpec>${basedir}/src/main/resources/ETSI-Catalog-Notification-API.json</inputSpec>
+              <language>java</language>
+              <library>okhttp-gson</library>
+              <output>${project.build.directory}/generated-sources/etsicatalog/notification</output>
+              <apiPackage>org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.notification.api</apiPackage>
+              <modelPackage>org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.notification.model</modelPackage>
+              <configOptions>
+                <sourceFolder>src/gen/java/main</sourceFolder>
+                <withXml>true</withXml>
+                <useRxJava2>true</useRxJava2>
+                <serializableModel>true</serializableModel>
+              </configOptions>
+            </configuration>
+          </execution>
         </executions>
       </plugin>
     </plugins>
       <artifactId>okio</artifactId>
       <version>1.13.0</version>
     </dependency>
+    <dependency>
+      <groupId>com.squareup.okhttp3</groupId>
+      <artifactId>okhttp</artifactId>
+      <version>${okhttp3-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.squareup.okhttp3</groupId>
+      <artifactId>logging-interceptor</artifactId>
+      <version>${okhttp3-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.squareup.okhttp</groupId>
+      <artifactId>logging-interceptor</artifactId>
+      <version>${okhttp-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.squareup.okhttp</groupId>
+      <artifactId>okhttp</artifactId>
+      <version>${okhttp-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.squareup.okhttp</groupId>
+      <artifactId>logging-interceptor</artifactId>
+      <version>${okhttp-version}</version>
+    </dependency>
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/src/main/resources/ETSI-Catalog-Notification-API.json b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-api/src/main/resources/ETSI-Catalog-Notification-API.json
new file mode 100644 (file)
index 0000000..6f9b2c3
--- /dev/null
@@ -0,0 +1,230 @@
+{
+  "swagger": "2.0",
+  "info": {
+    "title": "Modeling etsicatalog API",
+    "description": "\n\nThe `swagger-ui` view can be found [here](/api/catalog/v1/swagger).\nThe `ReDoc` view can be found [here](/api/catalog/v1/redoc).\nThe swagger YAML document can be found [here](/api/catalog/v1/swagger.yaml).\nThe swagger JSON document can be found [here](/api/catalog/v1/swagger.json).",
+    "version": "v1"
+  },
+  "host": "127.0.0.1:8000",
+  "schemes": ["http"],
+  "basePath": "/",
+  "consumes": ["application/json"],
+  "produces": ["application/json"],
+  "securityDefinitions": {
+    "Basic": {
+      "type": "basic"
+    }
+  },
+  "security": [{
+    "Basic": []
+  }],
+  "paths": {
+    "/URI-is-provided-by-the-client-when-creating-the-subscription-VnfPackageChangeNotification": {
+      "get": {
+        "operationId": "URI-is-provided-by-the-client-when-creating-the-subscription-VnfPackageChangeNotification_list",
+        "description": "",
+        "parameters": [],
+        "responses": {
+          "204": {
+            "description": ""
+          },
+          "500": {
+            "description": "error message",
+            "schema": {
+              "type": "string"
+            }
+          }
+        },
+        "tags": ["VNF Package Management interface"]
+      },
+      "post": {
+        "operationId": "URI-is-provided-by-the-client-when-creating-the-subscription-VnfPackageChangeNotification_create",
+        "description": "",
+        "parameters": [{
+          "name": "data",
+          "in": "body",
+          "required": true,
+          "schema": {
+            "$ref": "#/definitions/PkgChangeNotification"
+          }
+        }],
+        "responses": {
+          "204": {
+            "description": ""
+          }
+        },
+        "tags": ["VNF Package Management interface"]
+      },
+      "parameters": []
+    },
+    "/URI-is-provided-by-the-client-when-creating-the-subscription-VnfPackageOnboardingNotification": {
+      "get": {
+        "operationId": "URI-is-provided-by-the-client-when-creating-the-subscription-VnfPackageOnboardingNotification_list",
+        "description": "",
+        "parameters": [],
+        "responses": {
+          "204": {
+            "description": ""
+          },
+          "500": {
+            "description": "error message",
+            "schema": {
+              "type": "string"
+            }
+          }
+        },
+        "tags": ["VNF Package Management interface"]
+      },
+      "post": {
+        "operationId": "URI-is-provided-by-the-client-when-creating-the-subscription-VnfPackageOnboardingNotification_create",
+        "description": "",
+        "parameters": [{
+          "name": "data",
+          "in": "body",
+          "required": true,
+          "schema": {
+            "$ref": "#/definitions/PkgOnboardingNotification"
+          }
+        }],
+        "responses": {
+          "204": {
+            "description": ""
+          }
+        },
+        "tags": ["VNF Package Management interface"]
+      },
+      "parameters": []
+    }
+  },
+  "definitions": {
+    "NOTIFICATION_LINKSERIALIZER": {
+      "title": "Vnfpackage",
+      "description": "Link to the resource representing the VNF package to which the notified change applies.",
+      "required": ["href"],
+      "type": "object",
+      "properties": {
+        "href": {
+          "title": "Href",
+          "description": "URI of the referenced resource.",
+          "type": "string",
+          "minLength": 1
+        }
+      }
+    },
+    "PkgmLinks": {
+      "title": " links",
+      "description": "Links to resources related to this resource.",
+      "type": "object",
+      "properties": {
+        "vnfPackage": {
+          "$ref": "#/definitions/NOTIFICATION_LINKSERIALIZER"
+        },
+        "subscription": {
+          "$ref": "#/definitions/NOTIFICATION_LINKSERIALIZER"
+        }
+      }
+    },
+    "PkgChangeNotification": {
+      "required": ["id", "notificationType", "timeStamp", "subscriptionId", "vnfPkgId", "changeType", "vnfdId", "_links"],
+      "type": "object",
+      "properties": {
+        "id": {
+          "title": "Id",
+          "description": "Identifier of this notification.",
+          "type": "string",
+          "minLength": 1
+        },
+        "notificationType": {
+          "title": "Notificationtype",
+          "description": "Discriminator for the different notification types.",
+          "type": "string",
+          "enum": ["VnfPackageChangeNotification"]
+        },
+        "timeStamp": {
+          "title": "Timestamp",
+          "description": "Date-time of the generation of the notification.",
+          "type": "string",
+          "format": "date-time"
+        },
+        "subscriptionId": {
+          "title": "Subscriptionid",
+          "description": "Identifier of the subscription that this notification relates to.",
+          "type": "string",
+          "minLength": 1
+        },
+        "vnfPkgId": {
+          "title": "Vnfpkgid",
+          "description": "Identifier of the VNF package.",
+          "type": "string",
+          "format": "uuid"
+        },
+        "changeType": {
+          "title": "Changetype",
+          "description": "The type of change of the VNF package.",
+          "type": "string",
+          "enum": ["OP_STATE_CHANGE", "PKG_DELETE"]
+        },
+        "operationalState": {
+          "title": "Operationalstate",
+          "description": "New operational state of the VNF package.",
+          "type": "string",
+          "enum": ["ENABLED", "DISABLED"]
+        },
+        "vnfdId": {
+          "title": "Vnfdid",
+          "description": "This identifier, which is managed by the VNF provider, identifies the VNF package and the VNFD in a globally unique way.",
+          "type": "string",
+          "minLength": 1
+        },
+        "_links": {
+          "$ref": "#/definitions/PkgmLinks"
+        }
+      }
+    },
+    "PkgOnboardingNotification": {
+      "required": ["id", "notificationType", "subscriptionId", "timeStamp", "vnfPkgId", "vnfdId", "_links"],
+      "type": "object",
+      "properties": {
+        "id": {
+          "title": "Id",
+          "description": "Identifier of this notification.",
+          "type": "string",
+          "minLength": 1
+        },
+        "notificationType": {
+          "title": "Notificationtype",
+          "description": "Discriminator for the different notification types.",
+          "type": "string",
+          "enum": ["VnfPackageOnboardingNotification"]
+        },
+        "subscriptionId": {
+          "title": "Subscriptionid",
+          "description": "Identifier of the subscription that this notification relates to.",
+          "type": "string",
+          "minLength": 1
+        },
+        "timeStamp": {
+          "title": "Timestamp",
+          "description": "Date-time of the generation of the notification.",
+          "type": "string",
+          "format": "date-time"
+        },
+        "vnfPkgId": {
+          "title": "Vnfpkgid",
+          "description": "Identifier of the VNF package.",
+          "type": "string",
+          "format": "uuid"
+        },
+        "vnfdId": {
+          "title": "Vnfdid",
+          "description": "This identifier, which is managed by the VNF provider, identifies the VNF package and the VNFD in a globally unique way.",
+          "type": "string",
+          "format": "uuid"
+        },
+        "_links": {
+          "$ref": "#/definitions/PkgmLinks"
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
index 8608fee..30a6e1f 100644 (file)
@@ -4,6 +4,8 @@
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (c) 2019 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
@@ -31,5 +33,6 @@ public enum ResourceKey {
     NETWORK_COLLECTION_ID,
     VPN_ID,
     VPN_BONDING_LINK_ID,
-    INSTANCE_GROUP_ID;
+    INSTANCE_GROUP_ID,
+    PNF
 }
index dc07d13..e8be273 100644 (file)
@@ -4,6 +4,8 @@
  * ================================================================================
  * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (c) 2019 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
@@ -30,6 +32,7 @@ public class WorkflowResourceIds implements Serializable {
      */
     private static final long serialVersionUID = 8591599114353940105L;
     private String serviceInstanceId;
+    private String pnfId;
     private String vnfId;
     private String networkId;
     private String volumeGroupId;
@@ -40,10 +43,10 @@ public class WorkflowResourceIds implements Serializable {
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this).append("serviceInstanceId", serviceInstanceId).append("vnfId", vnfId)
-                .append("networkId", networkId).append("volumeGroupId", volumeGroupId).append("vfModuleId", vfModuleId)
-                .append("networkCollectionId", networkCollectionId).append("configurationId", configurationId)
-                .toString();
+        return new ToStringBuilder(this).append("serviceInstanceId", serviceInstanceId).append("pnfId", pnfId)
+                .append("vnfId", vnfId).append("networkId", networkId).append("volumeGroupId", volumeGroupId)
+                .append("vfModuleId", vfModuleId).append("networkCollectionId", networkCollectionId)
+                .append("configurationId", configurationId).toString();
     }
 
     public String getServiceInstanceId() {
@@ -54,6 +57,14 @@ public class WorkflowResourceIds implements Serializable {
         this.serviceInstanceId = serviceInstanceId;
     }
 
+    public String getPnfId() {
+        return pnfId;
+    }
+
+    public void setPnfId(String pnfId) {
+        this.pnfId = pnfId;
+    }
+
     public String getVnfId() {
         return vnfId;
     }
index 88c36be..6b96bc3 100644 (file)
@@ -6,6 +6,8 @@
  * ================================================================================
  * Modifications Copyright (c) 2019 Samsung
  * ================================================================================
+ * Modifications Copyright (c) 2019 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
@@ -26,6 +28,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Optional;
 import java.util.UUID;
 import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -33,27 +36,12 @@ import org.camunda.bpm.engine.delegate.JavaDelegate;
 import org.javatuples.Pair;
 import org.onap.so.bpmn.common.BuildingBlockExecution;
 import org.onap.so.bpmn.common.DelegateExecutionImpl;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.*;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
 import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
 import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
 import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
@@ -89,6 +77,7 @@ import org.onap.so.serviceinstancebeans.CloudConfiguration;
 import org.onap.so.serviceinstancebeans.ModelInfo;
 import org.onap.so.serviceinstancebeans.ModelType;
 import org.onap.so.serviceinstancebeans.Networks;
+import org.onap.so.serviceinstancebeans.Pnfs;
 import org.onap.so.serviceinstancebeans.RelatedInstance;
 import org.onap.so.serviceinstancebeans.RelatedInstanceList;
 import org.onap.so.serviceinstancebeans.RequestDetails;
@@ -115,6 +104,7 @@ public class BBInputSetup implements JavaDelegate {
     private static final String VF_MODULE = "VfModule";
     private static final String NETWORK = "Network";
     private static final String VNF = "Vnf";
+    private static final String PNF = "Pnf";
     private static final String NETWORK_COLLECTION = "NetworkCollection";
     private static final String PREPROV = "PREPROV";
     private static final String CREATEVOLUME = "CreateVolume";
@@ -243,6 +233,7 @@ public class BBInputSetup implements JavaDelegate {
         lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, workflowResourceIds.getServiceInstanceId());
         lookupKeyMap.put(ResourceKey.NETWORK_ID, workflowResourceIds.getNetworkId());
         lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, workflowResourceIds.getVnfId());
+        lookupKeyMap.put(ResourceKey.PNF, workflowResourceIds.getPnfId());
         lookupKeyMap.put(ResourceKey.VF_MODULE_ID, workflowResourceIds.getVfModuleId());
         lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, workflowResourceIds.getVolumeGroupId());
         lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, workflowResourceIds.getConfigurationId());
@@ -806,6 +797,13 @@ 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)) {
@@ -1456,6 +1454,11 @@ public class BBInputSetup implements JavaDelegate {
             this.populateGenericVnf(executeBB.getRequestId(), vnfs.getModelInfo(), vnfs.getInstanceName(),
                     vnfs.getPlatform(), vnfs.getLineOfBusiness(), service, bbName, serviceInstance, lookupKeyMap, null,
                     vnfId, vnfType, vnfs.getInstanceParams(), productFamilyId, applicationId);
+        } 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));
         } else if (bbName.contains(VF_MODULE) || bbName.contains(VOLUME_GROUP)) {
             Pair<Vnfs, VfModules> vnfsAndVfModules = getVfModulesAndItsVnfsByKey(key, resources);
             if (vnfsAndVfModules != null) {
index aa71ee5..bb70853 100644 (file)
@@ -59,6 +59,10 @@ public class ExtractPojosForBB {
                     serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
                     result = lookupObjectInList(serviceInstance.getVnfs(), value);
                     break;
+                case PNF:
+                    serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+                    result = lookupObjectInList(serviceInstance.getPnfs(), value);
+                    break;
                 case NETWORK_ID:
                     serviceInstance = extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
                     result = lookupObjectInList(serviceInstance.getNetworks(), value);
index 483b626..8ee3979 100644 (file)
@@ -1934,6 +1934,7 @@ public class BBInputSetupTest {
         String serviceInstanceId = "serviceInstanceId";
         String networkId = "networkId";
         String vnfId = "vnfId";
+        String pnfId = "pnfId";
         String vfModuleId = "vfModuleId";
         String volumeGroupId = "volumeGroupId";
         String configurationId = "configurationId";
@@ -1942,6 +1943,7 @@ public class BBInputSetupTest {
         expected.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstanceId);
         expected.put(ResourceKey.NETWORK_ID, networkId);
         expected.put(ResourceKey.GENERIC_VNF_ID, vnfId);
+        expected.put(ResourceKey.PNF, pnfId);
         expected.put(ResourceKey.VF_MODULE_ID, vfModuleId);
         expected.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupId);
         expected.put(ResourceKey.CONFIGURATION_ID, configurationId);
@@ -1951,6 +1953,7 @@ public class BBInputSetupTest {
         workflowResourceIds.setServiceInstanceId(serviceInstanceId);
         workflowResourceIds.setNetworkId(networkId);
         workflowResourceIds.setVnfId(vnfId);
+        workflowResourceIds.setPnfId(pnfId);
         workflowResourceIds.setVfModuleId(vfModuleId);
         workflowResourceIds.setVolumeGroupId(volumeGroupId);
         workflowResourceIds.setConfigurationId(configurationId);
index 68f33c1..99ba352 100644 (file)
@@ -75,17 +75,7 @@ import org.onap.so.db.catalog.beans.VfModuleCustomization;
 import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
 import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
 import org.onap.so.db.catalog.client.CatalogDbClient;
-import org.onap.so.serviceinstancebeans.CloudConfiguration;
-import org.onap.so.serviceinstancebeans.ModelInfo;
-import org.onap.so.serviceinstancebeans.ModelType;
-import org.onap.so.serviceinstancebeans.Networks;
-import org.onap.so.serviceinstancebeans.RelatedInstance;
-import org.onap.so.serviceinstancebeans.RequestDetails;
-import org.onap.so.serviceinstancebeans.RequestInfo;
-import org.onap.so.serviceinstancebeans.Service;
-import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
-import org.onap.so.serviceinstancebeans.VfModules;
-import org.onap.so.serviceinstancebeans.Vnfs;
+import org.onap.so.serviceinstancebeans.*;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -730,6 +720,8 @@ public class WorkflowAction {
                 workflowResourceIds.setServiceInstanceId(serviceInstanceId);
                 if (resource == WorkflowType.VNF) {
                     workflowResourceIds.setVnfId(resourceId);
+                } else if (resource == WorkflowType.PNF) {
+                    workflowResourceIds.setPnfId(resourceId);
                 } else if (resource == WorkflowType.VFMODULE) {
                     workflowResourceIds.setVfModuleId(resourceId);
                 } else if (resource == WorkflowType.VOLUMEGROUP) {
@@ -1173,6 +1165,13 @@ public class WorkflowAction {
                             }
                         }
                     }
+                    if (validate.getResources().getPnfs() != null) {
+                        for (Pnfs pnf : validate.getResources().getPnfs()) {
+                            resourceCounter.add(new Resource(WorkflowType.PNF,
+                                    pnf.getModelInfo().getModelCustomizationId(), false));
+                            foundRelated = true;
+                        }
+                    }
                     if (validate.getResources().getNetworks() != null) {
                         for (Networks network : validate.getResources().getNetworks()) {
                             resourceCounter.add(new Resource(WorkflowType.NETWORK,
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Pnfs.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Pnfs.java
new file mode 100644 (file)
index 0000000..f601ebc
--- /dev/null
@@ -0,0 +1,114 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 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
+ *
+ *      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.serviceinstancebeans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+@JsonRootName(value = "pnfs")
+@JsonInclude(JsonInclude.Include.NON_DEFAULT)
+public class Pnfs implements Serializable {
+
+    private static final long serialVersionUID = 8081495240474276501L;
+    @JsonProperty("modelInfo")
+    protected ModelInfo modelInfo;
+    @JsonProperty("cloudConfiguration")
+    protected CloudConfiguration cloudConfiguration;
+    @JsonProperty("instanceName")
+    protected String instanceName;
+    @JsonProperty("platform")
+    protected Platform platform;
+    @JsonProperty("lineOfBusiness")
+    protected LineOfBusiness lineOfBusiness;
+    @JsonProperty("productFamilyId")
+    protected String productFamilyId;
+    @JsonProperty("instanceParams")
+    private List<Map<String, String>> instanceParams = new ArrayList<>();
+
+
+    public ModelInfo getModelInfo() {
+        return modelInfo;
+    }
+
+    public void setModelInfo(ModelInfo modelInfo) {
+        this.modelInfo = modelInfo;
+    }
+
+    public CloudConfiguration getCloudConfiguration() {
+        return cloudConfiguration;
+    }
+
+    public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
+        this.cloudConfiguration = cloudConfiguration;
+    }
+
+    public String getInstanceName() {
+        return instanceName;
+    }
+
+    public void setInstanceName(String instanceName) {
+        this.instanceName = instanceName;
+    }
+
+    public Platform getPlatform() {
+        return platform;
+    }
+
+    public void setPlatform(Platform platform) {
+        this.platform = platform;
+    }
+
+    public LineOfBusiness getLineOfBusiness() {
+        return lineOfBusiness;
+    }
+
+    public void setLineOfBusiness(LineOfBusiness lineOfBusiness) {
+        this.lineOfBusiness = lineOfBusiness;
+    }
+
+    public String getProductFamilyId() {
+        return productFamilyId;
+    }
+
+    public void setProductFamilyId(String productFamilyId) {
+        this.productFamilyId = productFamilyId;
+    }
+
+    public List<Map<String, String>> getInstanceParams() {
+        return instanceParams;
+    }
+
+    public void setInstanceParams(List<Map<String, String>> instanceParams) {
+        this.instanceParams = instanceParams;
+    }
+
+    @Override
+    public String toString() {
+        return "Pnfs [modelInfo=" + modelInfo + ", cloudConfiguration=" + cloudConfiguration + ", instanceName="
+                + instanceName + ", platform=" + platform + ", " + "lineOfBusiness=" + lineOfBusiness
+                + ", productFamilyId=" + productFamilyId + ", instanceParams=" + instanceParams + "]";
+    }
+
+}
index 2123b2f..acac8c4 100644 (file)
@@ -5,6 +5,8 @@
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (c) 2019 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
@@ -36,6 +38,8 @@ public class Resources implements Serializable {
     private static final long serialVersionUID = 2194797231782624520L;
     @JsonProperty("vnfs")
     private List<Vnfs> vnfs = new ArrayList<>();
+    @JsonProperty("pnfs")
+    private List<Pnfs> pnfs = new ArrayList<>();
     @JsonProperty("networks")
     private List<Networks> networks = new ArrayList<>();
 
@@ -47,6 +51,14 @@ public class Resources implements Serializable {
         this.vnfs = vnfs;
     }
 
+    public List<Pnfs> getPnfs() {
+        return pnfs;
+    }
+
+    public void setPnfs(List<Pnfs> pnfs) {
+        this.pnfs = pnfs;
+    }
+
     public List<Networks> getNetworks() {
         return networks;
     }