diff options
9 files changed, 200 insertions, 36 deletions
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/ETSI-Catalog-API.json b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/ETSI-Catalog-API.json index 514029bab8..efd427009d 100644 --- a/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/ETSI-Catalog-API.json +++ b/adapters/mso-vnfm-adapter/mso-vnfm-adapter-ext-clients/src/main/resources/ETSI-Catalog-API.json @@ -764,6 +764,7 @@ } } }, + "produces": ["application/octet-stream", "application/json"], "tags": ["NSD Management interface"] }, "put": { @@ -1129,8 +1130,17 @@ "$ref": "#/definitions/PkgmSubscription" } }, + "400": { + "description": "", + "schema": { + "$ref": "#/definitions/SUBSCRIPTION_ProblemDetailsSerializer" + } + }, "500": { - "description": "Internal error" + "description": "", + "schema": { + "$ref": "#/definitions/SUBSCRIPTION_ProblemDetailsSerializer" + } } }, "tags": ["VNF Package Management interface"] @@ -1330,6 +1340,7 @@ } } }, + "produces": ["application/octet-stream", "application/json"], "tags": ["VNF Package Management interface"] }, "parameters": [{ @@ -1370,6 +1381,7 @@ } } }, + "produces": ["application/octet-stream", "application/json"], "tags": ["VNF Package Management interface"] }, "put": { @@ -1460,6 +1472,7 @@ } } }, + "produces": ["application/octet-stream", "application/json"], "tags": ["VNF Package Management interface"] }, "parameters": [{ @@ -2710,8 +2723,6 @@ } }, "vnfProductsProviders": { - "title": "Vnfproductsfromproviders", - "description": "Match VNF packages that contain VNF products from certain providers.", "required": ["vnfProvider"], "type": "object", "properties": { @@ -2741,7 +2752,11 @@ } }, "vnfProductsFromProviders": { - "$ref": "#/definitions/vnfProductsProviders" + "description": "Match VNF packages that contain VNF products from certain providers.", + "type": "array", + "items": { + "$ref": "#/definitions/vnfProductsProviders" + } }, "vnfdId": { "description": "Match VNF packages with a VNFD identifierlisted in the attribute", diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java index 8608fee244..30a6e1fe35 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java @@ -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 } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java index dc07d13acb..e8be2734cc 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java @@ -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; } 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 88c36bec3a..6b96bc384a 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,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) { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java index aa71ee540f..bb70853bbb 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java @@ -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); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index 483b626f95..8ee3979386 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -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); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index 68f33c18a8..99ba35232c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -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 index 0000000000..f601ebc3bd --- /dev/null +++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Pnfs.java @@ -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 + "]"; + } + +} diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java index 2123b2f6fc..acac8c4033 100644 --- a/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java +++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java @@ -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; } |