From 8cc03e2c78639be5500ab50f3ebaaf7d64404775 Mon Sep 17 00:00:00 2001 From: MichaelMorris Date: Fri, 5 Feb 2021 16:18:52 +0000 Subject: Update node and data types for SOL001 3.3.1 + CNF enhancements Types in 2.7.1 folder are types valid for v3.3.1 that have not changed from v2.7.1 Types in 4.1.1 folder are the CNF enhancements which it is assumed will be in v4.1.1 Includes some changes in functionality to support: 1. Deployment of both existing (2.5.1) versions of types and new versions of types through sdc-BE-init 2. Selection of the correct node type definition version at onboarding of an ETSI SOL004 VNF/CNF csar, based on the declared version supported in the csar (i.e. when a 3.3.1 csar is imported, the node type definitions valid for 3.3.1 are used (rather than current logic which always selects the latest version) Signed-off-by: MichaelMorris Issue-ID: SDC-3470 Change-Id: Iff835d230b173b9d44349caa6b0b11d783e8f8d3 --- .../be/components/impl/DataTypeImportManager.java | 8 +- .../be/components/impl/ResourceBusinessLogic.java | 34 +-- .../be/components/impl/ResourceImportManager.java | 9 +- .../import/tosca/data-types/dataTypes.yml | 228 ++++++++++++++++++++- .../nfv-types/2.7.1/vduCompute/vduCompute.json | 17 ++ .../nfv-types/2.7.1/vduCompute/vduCompute.yml | 69 +++++++ .../import/tosca/nfv-types/2.7.1/vduCp/vduCp.json | 17 ++ .../import/tosca/nfv-types/2.7.1/vduCp/vduCp.yml | 43 ++++ .../vduVirtualFileStorage.json | 17 ++ .../vduVirtualFileStorage.yml | 20 ++ .../import/tosca/nfv-types/2.7.1/vipCp/vipCp.json | 17 ++ .../import/tosca/nfv-types/2.7.1/vipCp/vipCp.yml | 21 ++ .../tosca/nfv-types/2.7.1/vnfExtCp/vnfExtCp.json | 17 ++ .../tosca/nfv-types/2.7.1/vnfExtCp/vnfExtCp.yml | 21 ++ .../import/tosca/nfv-types/3.3.1/VNF/VNF.json | 17 ++ .../import/tosca/nfv-types/3.3.1/VNF/VNF.yml | 101 +++++++++ .../vduVirtualBlockStorage.json | 17 ++ .../vduVirtualBlockStorage.yml | 19 ++ .../import/tosca/nfv-types/4.1.1/VNF/VNF.json | 17 ++ .../import/tosca/nfv-types/4.1.1/VNF/VNF.yml | 106 ++++++++++ .../nfv-types/4.1.1/osContainer/osContainer.json | 17 ++ .../nfv-types/4.1.1/osContainer/osContainer.yml | 54 +++++ .../4.1.1/osContainerGroup/osContainerGroup.json | 17 ++ .../4.1.1/osContainerGroup/osContainerGroup.yml | 51 +++++ .../tosca/nfv-types/4.1.1/virtualCp/virtualCp.json | 17 ++ .../tosca/nfv-types/4.1.1/virtualCp/virtualCp.yml | 21 ++ .../tosca/nfv-types/vduCompute/vduCompute.yml | 8 +- .../scripts/sdcBePy/common/normative/toscaTypes.py | 5 +- .../sdcBePy/tosca/data/onapTypesToUpgrade.json | 17 ++ .../sdcBePy/tosca/imports/runNormativeType.py | 13 +- .../sdcBePy/tosca/models/normativeToUpdateList.py | 24 ++- .../sdcBePy/tosca/models/normativeTypesList.py | 24 ++- .../resources/scripts/sdcBePy/tosca/upgrade/run.py | 12 +- .../sdcBePy/tosca/upgrade/runUpgradeNormative.py | 13 +- catalog-be/src/main/resources/scripts/setup.py | 3 + .../be/components/ResourceImportManagerTest.java | 41 +++- .../sdc/be/dao/jsongraph/JanusGraphDao.java | 41 ++-- catalog-model/pom.xml | 5 + .../ByToscaNameDerivedNodeTypeResolver.java | 3 +- .../operations/NodeTypeOperation.java | 22 +- .../operations/ToscaOperationFacade.java | 115 ++++++++++- .../impl/VendorSoftwareProductManagerImpl.java | 1 + 42 files changed, 1267 insertions(+), 72 deletions(-) create mode 100644 catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vduCompute/vduCompute.json create mode 100644 catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vduCompute/vduCompute.yml create mode 100644 catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vduCp/vduCp.json create mode 100644 catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vduCp/vduCp.yml create mode 100644 catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vduVirtualFileStorage/vduVirtualFileStorage.json create mode 100644 catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vduVirtualFileStorage/vduVirtualFileStorage.yml create mode 100644 catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vipCp/vipCp.json create mode 100644 catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vipCp/vipCp.yml create mode 100644 catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vnfExtCp/vnfExtCp.json create mode 100644 catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vnfExtCp/vnfExtCp.yml create mode 100644 catalog-be/src/main/resources/import/tosca/nfv-types/3.3.1/VNF/VNF.json create mode 100644 catalog-be/src/main/resources/import/tosca/nfv-types/3.3.1/VNF/VNF.yml create mode 100644 catalog-be/src/main/resources/import/tosca/nfv-types/3.3.1/vduVirtualBlockStorage/vduVirtualBlockStorage.json create mode 100644 catalog-be/src/main/resources/import/tosca/nfv-types/3.3.1/vduVirtualBlockStorage/vduVirtualBlockStorage.yml create mode 100644 catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/VNF/VNF.json create mode 100644 catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/VNF/VNF.yml create mode 100644 catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/osContainer/osContainer.json create mode 100644 catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/osContainer/osContainer.yml create mode 100644 catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/osContainerGroup/osContainerGroup.json create mode 100644 catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/osContainerGroup/osContainerGroup.yml create mode 100644 catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/virtualCp/virtualCp.json create mode 100644 catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/virtualCp/virtualCp.yml diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java index 5ba9cfbe87..2e8344fc0a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java @@ -86,14 +86,10 @@ public class DataTypeImportManager { return Either.right(responseFormat); } } else { - // if it is not a scalar data type and it derives from abstract - // data type, we should reject the request. if (!ToscaPropertyType.isScalarType(dataTypeName) && isAbstract(derivedDataType)) { - log.debug("Data type {} which derived from abstract data type must have at least one property", dataType.getName()); - ResponseFormat responseFormat = componentsUtils.getResponseFormatByDataType(ActionStatus.DATA_TYPE_NOR_PROPERTIES_NEITHER_DERIVED_FROM, dataType, null); - return Either.right(responseFormat); + log.warn("Creating data type {} which derived from abstract data type with no properties", dataType.getName()); } - } + } } else { // properties tag cannot be empty if (properties.isEmpty()) { diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java index 80093bcf0a..01b7451a53 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java @@ -93,6 +93,7 @@ import org.openecomp.sdc.be.dao.jsongraph.JanusGraphDao; import org.openecomp.sdc.be.datamodel.api.HighestFilterEnum; import org.openecomp.sdc.be.datamodel.utils.ArtifactUtils; import org.openecomp.sdc.be.datamodel.utils.UiComponentDataConverter; +import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; import org.openecomp.sdc.be.datatypes.elements.GetInputValueDataDefinition; @@ -3427,24 +3428,24 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } PropertyDefinition curPropertyDef = currPropertiesMap.get(propName); ComponentInstanceProperty property = null; - + String value = null; List getInputs = null; boolean isValidate = true; if (propertyInfo.getValue() != null) { - getInputs = propertyInfo.getGet_input(); - isValidate = getInputs == null || getInputs.isEmpty(); - if (isValidate) { - value = getPropertyJsonStringValue(propertyInfo.getValue(), curPropertyDef.getType()); - } else { - value = getPropertyJsonStringValue(propertyInfo.getValue(), - TypeUtils.ToscaTagNamesEnum.GET_INPUT.getElementName()); - } - } + getInputs = propertyInfo.getGet_input(); + isValidate = getInputs == null || getInputs.isEmpty(); + if (isValidate) { + value = getPropertyJsonStringValue(propertyInfo.getValue(), curPropertyDef.getType()); + } else { + value = getPropertyJsonStringValue(propertyInfo.getValue(), + TypeUtils.ToscaTagNamesEnum.GET_INPUT.getElementName()); + } + } property = new ComponentInstanceProperty(curPropertyDef, value, null); String validatePropValue = validatePropValueBeforeCreate(property, value, isValidate, allDataTypes); - property.setValue(validatePropValue); + property.setValue(validatePropValue); if (getInputs != null && !getInputs.isEmpty()) { List getInputValues = new ArrayList<>(); @@ -3706,7 +3707,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { .getToscaResourceName()); } Resource refResource = validateResourceInstanceBeforeCreate(yamlName, uploadComponentInstanceInfo, - existingnodeTypeMap); + existingnodeTypeMap, resource); ComponentInstance componentInstance = new ComponentInstance(); componentInstance.setComponentUid(refResource.getUniqueId()); @@ -3796,7 +3797,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { } private Resource validateResourceInstanceBeforeCreate(String yamlName, - UploadComponentInstanceInfo uploadComponentInstanceInfo, Map nodeNamespaceMap) { + UploadComponentInstanceInfo uploadComponentInstanceInfo, Map nodeNamespaceMap, Resource resource) { log.debug( "validateResourceInstanceBeforeCreate - going to validate resource instance with name {} and type {} before create", @@ -3806,10 +3807,11 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { refResource = nodeNamespaceMap.get(uploadComponentInstanceInfo.getType()); } else { Either findResourceEither = toscaOperationFacade - .getLatestCertifiedNodeTypeByToscaResourceName(uploadComponentInstanceInfo.getType()); + .getByToscaResourceNameMatchingVendorRelease(uploadComponentInstanceInfo.getType(), + ((ResourceMetadataDataDefinition)resource.getComponentMetadataDefinition().getMetadataDataDefinition()).getVendorRelease()); if (findResourceEither.isRight()) { log.debug( - "validateResourceInstanceBeforeCreate - not found lates version for resource instance with name {} and type {}", + "validateResourceInstanceBeforeCreate - not found latest version for resource instance with name {} and type {}", uploadComponentInstanceInfo.getName(), uploadComponentInstanceInfo.getType()); throw new ByActionStatusComponentException(componentsUtils.convertFromStorageResponse(findResourceEither.right().value())); } @@ -4139,7 +4141,7 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic { if (derivedFromResource.getComponentType() == ComponentTypeEnum.RESOURCE) { Resource parentResource = (Resource) derivedFromResource; if (!(parentResource.isAbstract() && (ResourceTypeEnum.VFC == parentResource.getResourceType() || ResourceTypeEnum.ABSTRACT == parentResource.getResourceType())) && - parentResource.getResourceType() != updatedResourceType) { + parentResource.getResourceType() != updatedResourceType && oldResource.getResourceType() != updatedResourceType) { BeEcompErrorManager.getInstance() .logInternalDataError("mergeOldResourceMetadataWithNew", "resource type of the resource does not match to derived from resource type", ErrorSeverity.ERROR); diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java index b2e4ef298f..7e5e1b9568 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceImportManager.java @@ -60,6 +60,7 @@ import org.openecomp.sdc.be.config.BeEcompErrorManager; import org.openecomp.sdc.be.config.BeEcompErrorManager.ErrorSeverity; import org.openecomp.sdc.be.dao.api.ActionStatus; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; +import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; @@ -196,7 +197,7 @@ public class ResourceImportManager { populateResourceFromYaml(resourceYml, resource); - Boolean isValidResource = validationFunction.apply(resource); + validationFunction.apply(resource); if (!createNewVersion) { Either latestByName = toscaOperationFacade .getLatestByName(resource.getName()); @@ -204,6 +205,12 @@ public class ResourceImportManager { throw new ByActionStatusComponentException(ActionStatus.COMPONENT_NAME_ALREADY_EXIST, resource.getName()); } + } else { + final Either component = toscaOperationFacade.getComponentByNameAndVendorRelease(resource.getComponentType(), resource.getName(), resource.getVendorRelease(), JsonParseFlagEnum.ParseAll); + if (component.isLeft()) { + throw new ByActionStatusComponentException(ActionStatus.COMPONENT_VERSION_ALREADY_EXIST, + resource.getName()); + } } resource = resourceBusinessLogic .createOrUpdateResourceByImport(resource, creator, true, isInTransaction, needLock, csarInfo, nodeName, diff --git a/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.yml b/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.yml index 6c1228927f..ff2942fe2b 100644 --- a/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.yml +++ b/catalog-be/src/main/resources/import/tosca/data-types/dataTypes.yml @@ -2108,7 +2108,7 @@ tosca.datatypes.nfv.L2ProtocolData: required: false constraints: - greater_than: 0 - segmentation_id: #Introduced from Beijing release, only used for vCPE usecase, outside the scope of SOL001 v2.5.1 + segmentation_id: #Introduced from Beijing release, only used for vCPE usecase, outside the scope of SOL001 v2.5.1 type: integer required: false physical_network: #Introduced from Beijing release, only used for vCPE usecase, outside the scope of SOL001 v2.5.1 @@ -2332,6 +2332,12 @@ tosca.datatypes.nfv.VnfProfile: required: true constraints: - greater_or_equal: 0 + service_availability_level: + type: integer + description: If present, specifies the service availability level for the VNF instance created from this profile. + required: false + constraints: + - greater_or_equal: 1 tosca.datatypes.nfv.UriAuthority: derived_from: tosca.datatypes.Root description: information that corresponds to the authority component of a URI as specified in IETF RFC 3986 [8] @@ -2399,7 +2405,7 @@ tosca.datatypes.nfv.VirtualLinkMonitoringParameter: description: Identifies a performance metric derived from those defined in ETSI GS NFV-IFA 027.The packetOutgoingVirtualLink and packetIncomingVirtualLink metrics shall be obtained by aggregation the PacketOutgoing and PacketIncoming measurements defined in clause 7.1 of GS NFV-IFA 027 of all virtual link ports attached to the virtual link to which the metrics apply. required: true constraints: - - valid_values: [ packet_outgoing_virtual_link, packet_incoming_virtual_link ] + - valid_values: [ packet_outgoing_virtual_link, packet_incoming_virtual_link, byte_incoming, byte_outgoing, packet_incoming, packet_outgoing ] collection_period: type: scalar-unit.time description: Describes the recommended periodicity at which to collect the performance information. @@ -2419,7 +2425,7 @@ tosca.datatypes.nfv.VnfcMonitoringParameter: description: Identifies the performance metric, according to ETSI GS NFV-IFA 027. required: true constraints: - - valid_values: [ v_cpu_usage_mean_vnf, v_cpu_usage_peak_vnf, v_memory_usage_mean_vnf, v_memory_usage_peak_vnf, v_disk_usage_mean_vnf, v_disk_usage_peak_vnf, byte_incoming_vnf_int_cp, byte_outgoing_vnf_int_cp, packet_incoming_vnf_int_cp, packet_outgoing_vnf_int_cp ] + - valid_values: [ v_cpu_usage_mean_vnf, v_cpu_usage_peak_vnf, v_memory_usage_mean_vnf, v_memory_usage_peak_vnf, v_disk_usage_mean_vnf, v_disk_usage_peak_vnf, byte_incoming_vnf_int_cp, byte_outgoing_vnf_int_cp, packet_incoming_vnf_int_cp, packet_outgoing_vnf_int_cp, v_cpu_usage_mean, v_cpu_usage_peak, v_memory_usage_mean, v_memory_usage_peak, v_disk_usage_mean, v_disk_usage_peak, v_net_byte_incoming, v_net_byte_outgoing, v_net_packet_incoming, v_net_packet_outgoing, usage_mean_vStorage, usage_peak_vStorage ] collection_period: type: scalar-unit.time description: Describes the recommended periodicity at which to collect the performance information. @@ -2453,6 +2459,21 @@ tosca.datatypes.nfv.VnfMonitoringParameter: required: false constraints: - greater_than: 0 s +tosca.datatypes.nfv.VnfChangeCurrentPackageOperationConfiguration: + derived_from: tosca.datatypes.Root + description: represents information that affect the invocation of the change current VNF Package operation. + # This data type definition is reserved for future use in the present document. + # properties: +tosca.datatypes.nfv.VnfCreateSnapshotOperationConfiguration: + derived_from: tosca.datatypes.Root + description: represents information that affect the invocation of the CreateVnfSnapshot operation + # This data type definition is reserved for future use in the present document. + # properties: +tosca.datatypes.nfv.VnfRevertToSnapshotOperationConfiguration: + derived_from: tosca.datatypes.Root + description: represents information that affect the invocation of the RevertToVnfSnapshot operation + # This data type definition is reserved for future use in the present document. + # properties: tosca.datatypes.nfv.VnfLcmOperationsConfiguration: derived_from: tosca.datatypes.Root description: Represents information to configure lifecycle management operations @@ -2489,6 +2510,18 @@ tosca.datatypes.nfv.VnfLcmOperationsConfiguration: type: tosca.datatypes.nfv.VnfChangeExtConnectivityOperationConfiguration description: Configuration parameters for the changeExtVnfConnectivityOpConfig operation required: false + change_current_package: + type: tosca.datatypes.nfv.VnfChangeCurrentPackageOperationConfiguration + description: Configuration parameters for the ChangeCurrentVnfPackage operation + required: false + create_snapshot: + type: tosca.datatypes.nfv.VnfCreateSnapshotOperationConfiguration + description: Configuration parameters for the CreateVnfSnapshot operation + required: false + revert_to_snapsot: + type: tosca.datatypes.nfv.VnfRevertToSnapshotOperationConfiguration + description: Configuration parameters for the RevertToVnfSnapshot operation + required: false tosca.datatypes.nfv.CpProtocolData: derived_from: tosca.datatypes.Root description: Describes and associates the protocol layer that a CP uses together with other protocol and connection point information @@ -2512,7 +2545,35 @@ tosca.datatypes.nfv.VnfAdditionalConfigurableProperties: properties: description: type: string + is_writable_anytime: + type: boolean + description: It specifies whether these additional configurable properties are writeable (TRUE) at anytime (i.e. prior to / at instantiation time as well as after instantiation).or (FALSE) only prior to / at instantiation time. If this property is not present, the additional configurable properties are writable anytime + required: false +tosca.datatypes.nfv.VnfmInterfaceInfo: + derived_from: tosca.datatypes.Root + description: describes information enabling the VNF instance to access the NFV-MANO interfaces produced by the VNFM + properties: + interface_name: + type: string + description: Identifies an interface produced by the VNFM. + required: true + constraints: + - valid_values: [ vnf_lcm, vnf_pm, vnf_fm ] + details: + type: tosca.datatypes.nfv.InterfaceDetails + description: Provide additional data to access the interface endpoint + required: false + credentials: + type: map + description: Provides credential enabling access to the interface required: false + entry_schema: + type: string +tosca.datatypes.nfv.OauthServerInfo: + derived_from: tosca.datatypes.Root + description: information to enable discovery of the authorization server + #properties: FFS + #This data type definition is reserved for future use in the present document tosca.datatypes.nfv.VnfConfigurableProperties: derived_from: tosca.datatypes.Root description: indicates configuration properties for a given VNF (e.g. related to auto scaling and auto healing). @@ -2525,6 +2586,18 @@ tosca.datatypes.nfv.VnfConfigurableProperties: type: boolean description: It permits to enable (TRUE)/disable (FALSE) the auto-healing functionality. If the properties is not present for configuring, then VNF property is not supported required: false + vnfm_interface_info: + type: tosca.datatypes.nfv.VnfmInterfaceInfo + description: Contains information enabling access to the NFV-MANO interfaces produced by the VNFM (e.g. URIs and credentials). If the property is not present, then configuring this VNF property is not supported. + required: false + vnfm_oauth_server_info: + type: tosca.datatypes.nfv.OauthServerInfo + description: Contains information to enable discovery of the authorization server protecting access to VNFM interfaces. If the property is not present, then configuring this VNF property is not supported. + required: false + vnf_oauth_server_info: + type: tosca.datatypes.nfv.OauthServerInfo + description: Contains information to enable discovery of the authorization server to validate the access tokens provided by the VNFM when the VNFM accesses the VNF interfaces, if that functionality (token introspection) is supported by the authorization server. If the property is not present, then configuring this VNF property is not supported. + required: false additional_configurable_properties: description: It provides VNF specific configurable properties that can be modified using the ModifyVnfInfo operation required: false @@ -2543,7 +2616,6 @@ tosca.datatypes.nfv.VnfInfoModifiableAttributesExtensions: tosca.datatypes.nfv.VnfInfoModifiableAttributesMetadata: derived_from: tosca.datatypes.Root description: is an empty base type for deriving data types for describing VNF-specific metadata - # below description properties added as optional, since atleast one property required to define a dataType in SDC properties: description: type: string @@ -2626,6 +2698,21 @@ tosca.datatypes.nfv.VirtualBlockStorageData: description: Indicates if the storage support RDMA required: false default: false +tosca.datatypes.nfv.ChecksumData: + derived_from: tosca.datatypes.Root + description: Describes information about the result of performing a checksum operation over some arbitrary data + properties: + algorithm: + type: string + description: Describes the algorithm used to obtain the checksum value + required: true + constraints: + - valid_values: [sha-224, sha-256, sha-384, sha-512 ] + hash: + type: string + description: Contains the result of applying the algorithm indicated by the algorithm property to the data to which this ChecksumData refers + required: true + tosca.datatypes.nfv.SwImageData: derived_from: tosca.datatypes.Root description: describes information related to a software image artifact @@ -2638,9 +2725,13 @@ tosca.datatypes.nfv.SwImageData: type: string description: Version of this software image required: true + provider: + type: string + description: Provider of this software image + required: false checksum: type: string - description: Checksum of the software image file + description: Checksum of the software image file required: true container_format: type: string @@ -2741,6 +2832,133 @@ tosca.datatypes.nfv.NsProfile: description: Identifies the applicable network service DF within the scope of the NSD. required: true +tosca.datatypes.nfv.MciopProfile: + derived_from: tosca.datatypes.Root + description: describes a profile for instantiating VNFs of a particular NS DF according to a specific VNFD and VNF DF. + properties: + mciopId: + type: string + description: dentifies the MCIOP in the VNF package. + required: true + deploymentOrder: + type: integer + description: Indicates the order in which this MCIOP shall be deployed in relation to other MCIOPs. A lower value specifies an earlier deployment. + required: false + constraints: + - greater_or_equal: 0 + affinityOrAntiAffinityGroupId: + type: list + description: List of VDUs which are associated to this MCIOP and which are deployed using this MCIOP + required: false + entry_schema: + type: string + associatedVdu: + type: list + description: List of VDUs which are associated to this MCIOP and which are deployed using this MCIOP + required: false + entry_schema: + type: string +tosca.datatypes.nfv.BootDataVimSpecificProperties: + derived_from: tosca.datatypes.Root + description: describes the VIM specific information used for selecting VIM specific capabilities when setting the boot data. + properties: + vim_type: + type: string + description: Discriminator for the different types of the VIM information. + required: false + properties: + type: map + description: Properties used for selecting VIM specific capabilities when setting the boot data + entry_schema: + type: string + required: true +tosca.datatypes.nfv.KvpData: + derived_from: tosca.datatypes.Root + description: describes a set of key-value pairs information used to customize a virtualised compute resource at boot time by using only key-value pairs data. + properties: + data: + type: map + description: A map of strings that contains a set of key-value pairs that describes the information for configuring the virtualised compute resource. + required: false + entry_schema: + type: string +tosca.datatypes.nfv.ContentOrFileData: + derived_from: tosca.datatypes.Root + description: describes a string content or a file information used to customize a virtualised compute resource at boot time by using string content or file. + properties: + data: + type: map + description: A map of strings that contains a set of key-value pairs that carries the dynamic deployment values which used to replace the corresponding variable parts in the file as identify by a URL as described in source_path. Shall be present if "source_path" is present and shall be absent otherwise.. + required: false + entry_schema: + type: string + content: + type: string + description: The string information used to customize a virtualised compute resource at boot time. + required: false + source_path: + type: string + description: The URL to a file contained in the VNF package used to customize a virtualised compute resource. The content shall comply with IETF RFC 3986 [8]. + required: false + destination_path: + type: string + description: The URL address when inject a file into the virtualised compute resource. The content shall comply with IETF RFC 3986 [8]. + required: false +tosca.datatypes.nfv.BootData: + derived_from: tosca.datatypes.Root + description: describes the information used to customize a virtualised compute resource at boot time. + properties: + vim_specific_properties: + type: tosca.datatypes.nfv.BootDataVimSpecificProperties + description: Properties used for selecting VIM specific capabilities when setting the boot data. + required: false + kvp_data: + type: tosca.datatypes.nfv.KvpData + description: A set of key-value pairs for configuring a virtual compute resource. + required: false + content_or_file_data: + type: tosca.datatypes.nfv.ContentOrFileData + description: A string content or a file for configuring a virtual compute resource. + required: false +tosca.datatypes.nfv.ServicePortData: + derived_from: tosca.datatypes.Root + description: describes the service identifying port properties exposed by the VirtualCp + properties: + name: + type: string + description: The name of the port exposed by the VirtualCp. + required: true + protocol: + type: string + description: The L4 protocol for this port exposed by the VirtualCp. + constraints: + - valid_values: + - TCP + - UDP + - SCTP + port: + type: integer + description: The L4 port number exposed by the VirtualCp. + required: true + portConfigurable: + type: boolean + description: Specifies whether the port attribute value is allowed to be configurable. + required: true +tosca.datatypes.nfv.AdditionalServiceData: + derived_from: tosca.datatypes.Root + description: describes the additional service data of the VirtualCp used to expose properties of the VirtualCp to NFV-MANO. + properties: + portData: + type: list + description: Service port numbers exposed by the VirtualCp. + required: false + entry_schema: + type: tosca.datatypes.nfv.ServicePortData + serviceData: + type: string + description: Service matching information exposed by the VirtualCp. + required: false + ##### Partner service domain datatypes ###### onap.datatypes.partner.access_details: diff --git a/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vduCompute/vduCompute.json b/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vduCompute/vduCompute.json new file mode 100644 index 0000000000..eec2edb73e --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vduCompute/vduCompute.json @@ -0,0 +1,17 @@ +{ + "payloadName": "vduCompute.yml", + "contactId": "jh0003", + "name": "VDU Compute", + "description": "VDU Compute", + "resourceIconPath": "compute", + "resourceType": "VFC", + "categories": [{ + "name": "Generic", + "subcategories": [{ + "name": "Infrastructure" + }] + }], + "vendorName": "ETSI", + "vendorRelease": "2.7.1", + "tags": ["VDU Compute"] +} diff --git a/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vduCompute/vduCompute.yml b/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vduCompute/vduCompute.yml new file mode 100644 index 0000000000..5322197a0e --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vduCompute/vduCompute.yml @@ -0,0 +1,69 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + tosca.nodes.nfv.Vdu.Compute: + derived_from: tosca.nodes.Root + description: Describes the virtual compute part of a VDU which is a construct supporting the description of the deployment and operational behavior of a VNFC + properties: + name: + type: string + description: Human readable name of the VDU + required: true + description: + type: string + description: Human readable description of the VDU + required: true + boot_order: + type: boolean + description: It indicates whether the order of the virtual_storage requirements is used as the boot index (the first requirement represents the lowest index and defines highest boot priority). + default: false + required: false + nfvi_constraints: + type: map + description: Describes constraints on the NFVI for the VNFC instance(s) created from this VDU. This property is reserved for future use in the present document. + required: false + entry_schema: + type: string + monitoring_parameters: + type: list + description: Describes monitoring parameters applicable to a VNFC instantiated from this VDU + required: false + entry_schema: + type: tosca.datatypes.nfv.VnfcMonitoringParameter + #configurable_properties: + #type: tosca.datatypes.nfv.VnfcConfigurableProperties + #required: false + # derived types are expected to introduce + # configurable_properties with its type derived from + # tosca.datatypes.nfv.VnfcConfigurableProperties + vdu_profile: + type: tosca.datatypes.nfv.VduProfile + description: Defines additional instantiation data for the VDU.Compute node + required: true + sw_image_data: + type: tosca.datatypes.nfv.SwImageData + description: Defines information related to a SwImage artifact used by this Vdu.Compute node + required: false # property is required when the node template has an associated artifact of type tosca.artifacts.nfv.SwImage and not required otherwise + boot_data: + type: tosca.datatypes.nfv.BootData + description: Contains the information used to customize a virtualised compute resource at boot time. The bootData may contain variable parts that are replaced by deployment specific values before being sent to the VIM. + required: false + inject_files: #Introduced from Beijing release, used for vCPE usecase, outside the scope of SOL001 v2.5.1 + type: tosca.datatypes.nfv.injectFile + required: false #Aligned with ONAP R2 IM. it should be false. + meta_data: #Introduced from Beijing release, used for metadata attached to the VM or container, outside the scope of SOL001 v2.5.1 + type: map + entry_schema: + type: string + required: false + capabilities: + virtual_compute: + type: tosca.capabilities.nfv.VirtualCompute + occurrences: [ 1, 1 ] + virtual_binding: + type: tosca.capabilities.nfv.VirtualBindable + occurrences: [ 1, UNBOUNDED ] + requirements: + - virtual_storage: + capability: tosca.capabilities.nfv.VirtualStorage + relationship: tosca.relationships.nfv.AttachesTo + occurrences: [ 0, UNBOUNDED ] diff --git a/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vduCp/vduCp.json b/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vduCp/vduCp.json new file mode 100644 index 0000000000..0cddba8ec3 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vduCp/vduCp.json @@ -0,0 +1,17 @@ +{ + "payloadName": "vduCp.yml", + "contactId": "jh0003", + "name": "VDU Cp", + "description": "VDU Cp", + "resourceIconPath": "port", + "resourceType": "CP", + "categories": [{ + "name": "Generic", + "subcategories": [{ + "name": "Network Elements" + }] + }], + "vendorName": "ETSI", + "vendorRelease": "2.7.1", + "tags": ["VDU Cp"] +} diff --git a/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vduCp/vduCp.yml b/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vduCp/vduCp.yml new file mode 100644 index 0000000000..942d8e65a1 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vduCp/vduCp.yml @@ -0,0 +1,43 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + tosca.nodes.nfv.VduCp: + derived_from: tosca.nodes.nfv.Cp + description: describes network connectivity between a VNFC instance based on this VDU and an internal VL + properties: + bitrate_requirement: + type: integer # in bits per second + description: Bitrate requirement in bit per second on this connection point + required: false + constraints: + - greater_or_equal: 0 + virtual_network_interface_requirements: + type: list + description: Specifies requirements on a virtual network interface realising the CPs instantiated from this CPD + required: false + entry_schema: + type: tosca.datatypes.nfv.VirtualNetworkInterfaceRequirements + order: + type: integer + description: The order of the NIC on the compute instance (e.g.eth2) + required: false + constraints: + - greater_or_equal: 0 + vnic_type: + type: string + description: Describes the type of the virtual network interface realizing the CPs instantiated from this CPD + required: false + constraints: + - valid_values: [ normal, macvtap, direct, baremetal, virtio-forwarder, direct-physical, smart-nic, virtio ] + vnic_name: # Introduced from Beijing release, aligned with ONAP resource IM, outside the scope of SOL001 v2.5.1 + type: string + required: false + requirements: + - virtual_link: + capability: tosca.capabilities.nfv.VirtualLinkable + relationship: tosca.relationships.nfv.VirtualLinksTo + occurrences: [0, 1] + - virtual_binding: + capability: tosca.capabilities.nfv.VirtualBindable + relationship: tosca.relationships.nfv.VirtualBindsTo + node: tosca.nodes.nfv.Vdu.Compute + occurrences: [1, 1] diff --git a/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vduVirtualFileStorage/vduVirtualFileStorage.json b/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vduVirtualFileStorage/vduVirtualFileStorage.json new file mode 100644 index 0000000000..f0112eddd7 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vduVirtualFileStorage/vduVirtualFileStorage.json @@ -0,0 +1,17 @@ +{ + "payloadName": "vduVirtualFileStorage.yml", + "contactId": "jh0003", + "name": "VDU VirtualFileStorage", + "description": "VDU VirtualFileStorage", + "resourceIconPath": "objectStorage", + "resourceType": "VFC", + "categories": [{ + "name": "Generic", + "subcategories": [{ + "name": "Infrastructure" + }] + }], + "vendorName": "ETSI", + "vendorRelease": "2.7.1", + "tags": ["VDU VirtualFileStorage"] +} diff --git a/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vduVirtualFileStorage/vduVirtualFileStorage.yml b/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vduVirtualFileStorage/vduVirtualFileStorage.yml new file mode 100644 index 0000000000..ee8a6b527a --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vduVirtualFileStorage/vduVirtualFileStorage.yml @@ -0,0 +1,20 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + tosca.nodes.nfv.Vdu.VirtualFileStorage: + derived_from: tosca.nodes.Root + description: This node type describes the specifications of requirements related to virtual file storage resources + properties: + virtual_file_storage_data: + type: tosca.datatypes.nfv.VirtualFileStorageData + description: Describes the file storage characteristics. + required: true + capabilities: + virtual_storage: + type: tosca.capabilities.nfv.VirtualStorage + description: Defines the capabilities of virtual_storage. + requirements: + - virtual_link: + capability: tosca.capabilities.nfv.VirtualLinkable + relationship: tosca.relationships.nfv.VirtualLinksTo + occurrences: [1, 1] + #description: Describes the requirements for linking to virtual link diff --git a/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vipCp/vipCp.json b/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vipCp/vipCp.json new file mode 100644 index 0000000000..f9a70225d2 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vipCp/vipCp.json @@ -0,0 +1,17 @@ +{ + "payloadName": "vipCp.yml", + "contactId": "jh0003", + "name": "VIP Cp", + "description": "VIP Cp", + "resourceIconPath": "port", + "resourceType": "CP", + "categories": [{ + "name": "Generic", + "subcategories": [{ + "name": "Network Elements" + }] + }], + "vendorName": "ETSI", + "vendorRelease": "2.7.1", + "tags": ["VIP Cp"] +} diff --git a/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vipCp/vipCp.yml b/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vipCp/vipCp.yml new file mode 100644 index 0000000000..b1c80705fe --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vipCp/vipCp.yml @@ -0,0 +1,21 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + tosca.nodes.nfv.VipCp: + derived_from: tosca.nodes.nfv.Cp + description: Describes a connection point to allocate one or a set of virtual IP addresses + properties: + vip_function: + type: string + description: "Indicates the function the virtual IP address is used for: high availability or load balancing. When used for high availability, only one of the internal VDU CP instances or VNF external CP instances that share the virtual IP is bound to the VIP address at a time. When used for load balancing purposes all CP instances that share the virtual IP are bound to it." + required: true + constraints: + - valid_values: [ high_availability, load_balance ] + requirements: + - target: + capability: tosca.capabilities.Node + relationship: tosca.relationships.DependsOn + occurrences: [ 1, UNBOUNDED ] + - virtual_link: + capability: tosca.capabilities.nfv.VirtualLinkable + relationship: tosca.relationships.nfv.VipVirtualLinksTo + occurrences: [1, 1] diff --git a/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vnfExtCp/vnfExtCp.json b/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vnfExtCp/vnfExtCp.json new file mode 100644 index 0000000000..7a6d15a2cb --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vnfExtCp/vnfExtCp.json @@ -0,0 +1,17 @@ +{ + "payloadName": "vnfExtCp.yml", + "contactId": "jh0003", + "name": "VNF External CP", + "description": "VNF External CP", + "resourceIconPath": "network", + "resourceType": "CP", + "categories": [{ + "name": "Generic", + "subcategories": [{ + "name": "Infrastructure" + }] + }], + "vendorName": "ETSI", + "vendorRelease": "2.7.1", + "tags": ["VNF External CP"] +} diff --git a/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vnfExtCp/vnfExtCp.yml b/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vnfExtCp/vnfExtCp.yml new file mode 100644 index 0000000000..8b77aceb70 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/nfv-types/2.7.1/vnfExtCp/vnfExtCp.yml @@ -0,0 +1,21 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + tosca.nodes.nfv.VnfExtCp: + derived_from: tosca.nodes.nfv.Cp + description: Describes a logical external connection point, exposed by the VNF enabling connection with an external Virtual Link + properties: + virtual_network_interface_requirements: + type: list + description: The actual virtual NIC requirements that is been assigned when instantiating the connection point + required: false + entry_schema: + type: tosca.datatypes.nfv.VirtualNetworkInterfaceRequirements + requirements: + - external_virtual_link: + capability: tosca.capabilities.nfv.VirtualLinkable + relationship: tosca.relationships.nfv.VirtualLinksTo + occurrences: [0, 1] + - internal_virtual_link: #name in ETSI NFV IFA011 v0.7.3: intVirtualLinkDesc + capability: tosca.capabilities.nfv.VirtualLinkable + relationship: tosca.relationships.nfv.VirtualLinksTo + occurrences: [1, 1] diff --git a/catalog-be/src/main/resources/import/tosca/nfv-types/3.3.1/VNF/VNF.json b/catalog-be/src/main/resources/import/tosca/nfv-types/3.3.1/VNF/VNF.json new file mode 100644 index 0000000000..5460dffbdb --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/nfv-types/3.3.1/VNF/VNF.json @@ -0,0 +1,17 @@ +{ + "payloadName": "VNF.yml", + "contactId": "jh0003", + "name": "VNF", + "description": "VNF", + "resourceIconPath": "compute", + "resourceType": "VFC", + "categories": [{ + "name": "Generic", + "subcategories": [{ + "name": "Infrastructure" + }] + }], + "vendorName": "ETSI", + "vendorRelease": "3.3.1", + "tags": ["VNF"] +} diff --git a/catalog-be/src/main/resources/import/tosca/nfv-types/3.3.1/VNF/VNF.yml b/catalog-be/src/main/resources/import/tosca/nfv-types/3.3.1/VNF/VNF.yml new file mode 100644 index 0000000000..829ce185b6 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/nfv-types/3.3.1/VNF/VNF.yml @@ -0,0 +1,101 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + tosca.nodes.nfv.VNF: + derived_from: tosca.nodes.Root + description: The generic abstract type from which all VNF specific abstract node types shall be derived to form, together with other node types, the TOSCA service template(s) representing the VNFD + properties: + descriptor_id: # instead of vnfd_id + type: string # GUID + description: Globally unique identifier of the VNFD + required: true + descriptor_version: # instead of vnfd_version + type: string + description: Identifies the version of the VNFD + required: true + provider: # instead of vnf_provider + type: string + description: Provider of the VNF and of the VNFD + required: true + product_name: # instead of vnf_product_name + type: string + description: Human readable name for the VNF Product + required: true + software_version: # instead of vnf_software_version + type: string + description: Software version of the VNF + required: true + product_info_name: # instead of vnf_product_info_name + type: string + description: Human readable name for the VNF Product + required: false + product_info_description: # instead of vnf_product_info_description + type: string + description: Human readable description of the VNF Product + required: false + vnfm_info: + type: list + required: true + description: Identifies VNFM(s) compatible with the VNF + entry_schema: + type: string + localization_languages: + type: list + description: Information about localization languages of the VNF + required: false + entry_schema: + type: string #IETF RFC 5646 string + default_localization_language: + type: string #IETF RFC 5646 string + description: Default localization language that is instantiated if no information about selected localization language is available + required: false + #configurable_properties: + #type: tosca.datatypes.nfv.VnfConfigurableProperties + #description: Describes the configurable properties of the VNF + #required: false + # derived types are expected to introduce configurable_properties + # with its type derived from + # tosca.datatypes.nfv.VnfConfigurableProperties + #modifiable_attributes: + #type: tosca.datatypes.nfv.VnfInfoModifiableAttributes + #description: Describes the modifiable attributes of the VNF + #required: false + # derived types are expected to introduce modifiable_attributes + # with its type derived from + # tosca.datatypes.nfv.VnfInfoModifiableAttributes + lcm_operations_configuration: + type: tosca.datatypes.nfv.VnfLcmOperationsConfiguration + description: Describes the configuration parameters for the VNF LCM operations + required: false + monitoring_parameters: + type: list + entry_schema: + type: tosca.datatypes.nfv.VnfMonitoringParameter + description: Describes monitoring parameters applicable to the VNF. + required: false + flavour_id: + type: string + description: Identifier of the Deployment Flavour within the VNFD + required: true + flavour_description: + type: string + description: Human readable description of the DF + required: true + vnf_profile: + type: tosca.datatypes.nfv.VnfProfile + description: Describes a profile for instantiating VNFs of a particular NS DF according to a specific VNFD and VNF DF + required: false + attributes: + scale_status: + type: map # key: aspectId + description: Scale status of the VNF, one entry per aspect. Represents for every scaling aspect how "big" the VNF has been scaled w.r.t. that aspect. + entry_schema: + type: tosca.datatypes.nfv.ScaleInfo + requirements: + - virtual_link: + capability: tosca.capabilities.nfv.VirtualLinkable + relationship: tosca.relationships.nfv.VirtualLinksTo + occurrences: [ 0, 1 ] + # Additional requirements shall be defined in the VNF specific node type (deriving from tosca.nodes.nfv.VNF) corresponding to NS virtual links that need to connect to VnfExtCps + interfaces: + Vnflcm: + type: tosca.interfaces.nfv.Vnflcm diff --git a/catalog-be/src/main/resources/import/tosca/nfv-types/3.3.1/vduVirtualBlockStorage/vduVirtualBlockStorage.json b/catalog-be/src/main/resources/import/tosca/nfv-types/3.3.1/vduVirtualBlockStorage/vduVirtualBlockStorage.json new file mode 100644 index 0000000000..63b1162e62 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/nfv-types/3.3.1/vduVirtualBlockStorage/vduVirtualBlockStorage.json @@ -0,0 +1,17 @@ +{ + "payloadName": "vduVirtualBlockStorage.yml", + "contactId": "jh0003", + "name": "VDU VirtualBlockStorage", + "description": "VDU VirtualBlockStorage", + "resourceIconPath": "objectStorage", + "resourceType": "VFC", + "categories": [{ + "name": "Generic", + "subcategories": [{ + "name": "Infrastructure" + }] + }], + "vendorName": "ETSI", + "vendorRelease": "3.3.1", + "tags": ["VDU VirtualBlockStorage"] +} diff --git a/catalog-be/src/main/resources/import/tosca/nfv-types/3.3.1/vduVirtualBlockStorage/vduVirtualBlockStorage.yml b/catalog-be/src/main/resources/import/tosca/nfv-types/3.3.1/vduVirtualBlockStorage/vduVirtualBlockStorage.yml new file mode 100644 index 0000000000..562cbad15a --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/nfv-types/3.3.1/vduVirtualBlockStorage/vduVirtualBlockStorage.yml @@ -0,0 +1,19 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + tosca.nodes.nfv.Vdu.VirtualBlockStorage: + derived_from: tosca.nodes.Root + description: This node type describes the specifications of requirements related to virtual block storage resources + properties: + virtual_block_storage_data: + type: tosca.datatypes.nfv.VirtualBlockStorageData + description: Describes the block storage characteristics. + required: true + sw_image_data: + type: tosca.datatypes.nfv.SwImageData + description: Defines information related to a SwImage artifact used by this Vdu.Compute node. + required: false # property is required when the node template has an associated artifact of type tosca.artifacts.nfv.SwImage and not required otherwise + status: deprecated + capabilities: + virtual_storage: + type: tosca.capabilities.nfv.VirtualStorage + description: Defines the capabilities of virtual_storage. diff --git a/catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/VNF/VNF.json b/catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/VNF/VNF.json new file mode 100644 index 0000000000..6cc6f687ac --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/VNF/VNF.json @@ -0,0 +1,17 @@ +{ + "payloadName": "VNF.yml", + "contactId": "jh0003", + "name": "VNF", + "description": "VNF", + "resourceIconPath": "compute", + "resourceType": "VFC", + "categories": [{ + "name": "Generic", + "subcategories": [{ + "name": "Infrastructure" + }] + }], + "vendorName": "ETSI", + "vendorRelease": "4.1.1", + "tags": ["VNF"] +} diff --git a/catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/VNF/VNF.yml b/catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/VNF/VNF.yml new file mode 100644 index 0000000000..c9f922befa --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/VNF/VNF.yml @@ -0,0 +1,106 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + tosca.nodes.nfv.VNF: + derived_from: tosca.nodes.Root + description: The generic abstract type from which all VNF specific abstract node types shall be derived to form, together with other node types, the TOSCA service template(s) representing the VNFD + properties: + descriptor_id: # instead of vnfd_id + type: string # GUID + description: Globally unique identifier of the VNFD + required: true + descriptor_version: # instead of vnfd_version + type: string + description: Identifies the version of the VNFD + required: true + provider: # instead of vnf_provider + type: string + description: Provider of the VNF and of the VNFD + required: true + product_name: # instead of vnf_product_name + type: string + description: Human readable name for the VNF Product + required: true + software_version: # instead of vnf_software_version + type: string + description: Software version of the VNF + required: true + product_info_name: # instead of vnf_product_info_name + type: string + description: Human readable name for the VNF Product + required: false + product_info_description: # instead of vnf_product_info_description + type: string + description: Human readable description of the VNF Product + required: false + vnfm_info: + type: list + required: true + description: Identifies VNFM(s) compatible with the VNF + entry_schema: + type: string + localization_languages: + type: list + description: Information about localization languages of the VNF + required: false + entry_schema: + type: string #IETF RFC 5646 string + default_localization_language: + type: string #IETF RFC 5646 string + description: Default localization language that is instantiated if no information about selected localization language is available + required: false + #configurable_properties: + #type: tosca.datatypes.nfv.VnfConfigurableProperties + #description: Describes the configurable properties of the VNF + #required: false + # derived types are expected to introduce configurable_properties + # with its type derived from + # tosca.datatypes.nfv.VnfConfigurableProperties + #modifiable_attributes: + #type: tosca.datatypes.nfv.VnfInfoModifiableAttributes + #description: Describes the modifiable attributes of the VNF + #required: false + # derived types are expected to introduce modifiable_attributes + # with its type derived from + # tosca.datatypes.nfv.VnfInfoModifiableAttributes + lcm_operations_configuration: + type: tosca.datatypes.nfv.VnfLcmOperationsConfiguration + description: Describes the configuration parameters for the VNF LCM operations + required: false + monitoring_parameters: + type: list + entry_schema: + type: tosca.datatypes.nfv.VnfMonitoringParameter + description: Describes monitoring parameters applicable to the VNF. + required: false + flavour_id: + type: string + description: Identifier of the Deployment Flavour within the VNFD + required: true + flavour_description: + type: string + description: Human readable description of the DF + required: true + vnf_profile: + type: tosca.datatypes.nfv.VnfProfile + description: Describes a profile for instantiating VNFs of a particular NS DF according to a specific VNFD and VNF DF + required: false + mciop_profile: + type: list + entry_schema: + type: tosca.datatypes.nfv.MciopProfile + description: Describes additional instantiation data for the MCIOPs used in this deployment + attributes: + scale_status: + type: map # key: aspectId + description: Scale status of the VNF, one entry per aspect. Represents for every scaling aspect how "big" the VNF has been scaled w.r.t. that aspect. + entry_schema: + type: tosca.datatypes.nfv.ScaleInfo + requirements: + - virtual_link: + capability: tosca.capabilities.nfv.VirtualLinkable + relationship: tosca.relationships.nfv.VirtualLinksTo + occurrences: [ 0, 1 ] + # Additional requirements shall be defined in the VNF specific node type (deriving from tosca.nodes.nfv.VNF) corresponding to NS virtual links that need to connect to VnfExtCps + interfaces: + Vnflcm: + type: tosca.interfaces.nfv.Vnflcm diff --git a/catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/osContainer/osContainer.json b/catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/osContainer/osContainer.json new file mode 100644 index 0000000000..1cc0dac5ac --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/osContainer/osContainer.json @@ -0,0 +1,17 @@ +{ + "payloadName": "osContainer.yml", + "contactId": "jh0003", + "name": "osContainer", + "description": "osContainer", + "resourceIconPath": "compute", + "resourceType": "VFC", + "categories": [{ + "name": "Generic", + "subcategories": [{ + "name": "Infrastructure" + }] + }], + "vendorName": "ETSI", + "vendorRelease": "4.1.1", + "tags": ["osContainer"] +} diff --git a/catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/osContainer/osContainer.yml b/catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/osContainer/osContainer.yml new file mode 100644 index 0000000000..a8f9200d25 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/osContainer/osContainer.yml @@ -0,0 +1,54 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + tosca.nodes.nfv.Vdu.osContainer: + derived_from: tosca.nodes.Root + description: Describes the resources of a single container within a VDU + properties: + name: + type: string + description: Human readable name of the Container + required: true + description: + type: string + description: Human readable description of the Container + required: true + logical_node: + type: map + description: Describes the logical node requirements + required: false + entry_schema: + type: tosca.datatypes.nfv.LogicalNodeData + requested_additional_capabilities: + type: map + description: Describes additional capabilities to host this container + required: false + entry_schema: + type: tosca.datatypes.nfv.RequestedAdditionalCapability + requestedCpuResources: + type: integer + required: false + description: Number of milli-Cpus + cpuResourcesLimit: + type: integer + required: false + description: Limit (Max) Number of milli-Cpus + requestedMemoryResources: + type: scalar-unit.size + required: false + description: Amount of Memory requested + memoryResourcesLimit: + type: scalar-unit.size + required: false + description: Limit (Max) Memory + requestedEphemeralStorageResources: + type: scalar-unit.size + required: false + description: Amount of Ephemeral Storage Requested + ephemeralStorageResourcesLimit: + type: scalar-unit.size + required: false + description: Limit on Ephemeral Storage + capabilities: + containerGroupable: + type: tosca.capabilities.nfv.ContainerGroupable + occurrences: [ 1, UNBOUNDED ] diff --git a/catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/osContainerGroup/osContainerGroup.json b/catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/osContainerGroup/osContainerGroup.json new file mode 100644 index 0000000000..980c03ab83 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/osContainerGroup/osContainerGroup.json @@ -0,0 +1,17 @@ +{ + "payloadName": "osContainerGroup.yml", + "contactId": "jh0003", + "name": "osContainerGroup", + "description": "osContainerGroup", + "resourceIconPath": "compute", + "resourceType": "VFC", + "categories": [{ + "name": "Generic", + "subcategories": [{ + "name": "Infrastructure" + }] + }], + "vendorName": "ETSI", + "vendorRelease": "4.1.1", + "tags": ["osContainerGroup"] +} diff --git a/catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/osContainerGroup/osContainerGroup.yml b/catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/osContainerGroup/osContainerGroup.yml new file mode 100644 index 0000000000..cf0ffc76e1 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/osContainerGroup/osContainerGroup.yml @@ -0,0 +1,51 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + tosca.nodes.nfv.Vdu.osContainerGroup: + derived_from: tosca.nodes.Root + description: Describes the aggregate of container(s) of a VDU which is a construct supporting the description of the deployment and operational behavior of a VNFC; Corresponds to a "Pod" in K8S; Can have multiple constitute containers. + properties: + name: + type: string + description: Human readable name of the VDU + required: true + description: + type: string + description: Human readable description of the VDU + required: true + nfvi_constraints: + type: map + description: Describes constraints on the NFVI for the VNFC instance(s) created from this VDU. This property is reserved for future use in the present document. + required: false + entry_schema: + type: string + monitoring_parameters: + type: list + description: Describes monitoring parameters applicable to a VNFC instantiated from this VDU; Per Container on IFA011 v4.1.1 but more relevant at the VDU (Pod) Level + required: false + entry_schema: + type: tosca.datatypes.nfv.VnfcMonitoringParameter + #configurable_properties: + #type: tosca.datatypes.nfv.VnfcConfigurableProperties + #description: derived types are expected to introduce configurable_properties with its type derived from tosca.datatypes.nfv.VnfcConfigurableProperties + #required: false; + vdu_profile: + type: tosca.datatypes.nfv.VduProfile + required: true + description: Defines additional instantiation data for the Vdu.OsContainerGroup node + boot_data: + type: tosca.datatypes.nfv.BootData + required: false + description: Contains the information used to customize a container compute resource at boot time. The bootData may contain variable parts that are replaced by deployment specific values before being sent Per Container on IFA011 v4.1.1 but more relevant at the VDU (Pod) Level + capabilities: + virtual_binding: + type: tosca.capabilities.nfv.VirtualBindable + occurrences: [ 1, UNBOUNDED ] + requirements: + - virtual_storage: + capability: tosca.capabilities.nfv.VirtualStorage + relationship: tosca.relationships.nfv.AttachesTo + occurrences: [ 0, UNBOUNDED ] + - container_grouping: + capability: tosca.capabilities.nfv.ContainerGroupable + relationship: tosca.relationships.nfv.GroupsTo + occurrences: [ 1, UNBOUNDED ] diff --git a/catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/virtualCp/virtualCp.json b/catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/virtualCp/virtualCp.json new file mode 100644 index 0000000000..4fd97111d9 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/virtualCp/virtualCp.json @@ -0,0 +1,17 @@ +{ + "payloadName": "virtualCp.yml", + "contactId": "jh0003", + "name": "Virtual Cp", + "description": "Virtual Cp", + "resourceIconPath": "port", + "resourceType": "CP", + "categories": [{ + "name": "Generic", + "subcategories": [{ + "name": "Network Elements" + }] + }], + "vendorName": "ETSI", + "vendorRelease": "4.1.1", + "tags": ["Virtual Cp"] +} diff --git a/catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/virtualCp/virtualCp.yml b/catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/virtualCp/virtualCp.yml new file mode 100644 index 0000000000..3027651b38 --- /dev/null +++ b/catalog-be/src/main/resources/import/tosca/nfv-types/4.1.1/virtualCp/virtualCp.yml @@ -0,0 +1,21 @@ +tosca_definitions_version: tosca_simple_yaml_1_0_0 +node_types: + tosca.nodes.nfv.VirtualCp: + derived_from: tosca.nodes.nfv.Cp + description: Describes a virtual connection point allowing the access to a number of VNFC instances (based on their respective VDUs). + properties: + additionalServiceData: + type: list + description: References the VDU(s) which implement this service + required: true + entry_schema: + type: tosca.datatypes.nfv.AdditionalServiceData + requirements: + - target: + capability: tosca.capabilities.Node + relationship: tosca.relationships.DependsOn + occurrences: [ 1, UNBOUNDED ] + - virtual_link: + capability: tosca.capabilities.nfv.VirtualLinkable + relationship: tosca.relationships.nfv.VipVirtualLinksTo + occurrences: [1, 1] diff --git a/catalog-be/src/main/resources/import/tosca/nfv-types/vduCompute/vduCompute.yml b/catalog-be/src/main/resources/import/tosca/nfv-types/vduCompute/vduCompute.yml index 83bba36fe0..131c282b74 100644 --- a/catalog-be/src/main/resources/import/tosca/nfv-types/vduCompute/vduCompute.yml +++ b/catalog-be/src/main/resources/import/tosca/nfv-types/vduCompute/vduCompute.yml @@ -13,8 +13,8 @@ node_types: description: Human readable description of the VDU required: true boot_order: - type: list # explicit index (boot index) not necessary, contrary to IFA011 - description: References a node template name from which a valid boot device is created + type: list # explicit index (boot index) not necessary, contrary to IFA011 + description: References a node template name from which a valid boot device is created required: false entry_schema: type: string @@ -45,8 +45,8 @@ node_types: description: Defines information related to a SwImage artifact used by this Vdu.Compute node required: false # property is required when the node template has an associated artifact of type tosca.artifacts.nfv.SwImage and not required otherwise boot_data: - type: string - description: Contains a string or a URL to a file contained in the VNF package used to customize a virtualised compute resource at boot time. The bootData may contain variable parts that are replaced by deployment specific values before being sent to the VIM. + type: string + description: Contains a string or a URL to a file contained in the VNF package used to customize a virtualised compute resource at boot time. The bootData may contain variable parts that are replaced by deployment specific values before being sent to the VIM. required: false inject_files: #Introduced from Beijing release, used for vCPE usecase, outside the scope of SOL001 v2.5.1 type: tosca.datatypes.nfv.injectFile diff --git a/catalog-be/src/main/resources/scripts/sdcBePy/common/normative/toscaTypes.py b/catalog-be/src/main/resources/scripts/sdcBePy/common/normative/toscaTypes.py index 97fb2d1d7e..56fe2b4b39 100644 --- a/catalog-be/src/main/resources/scripts/sdcBePy/common/normative/toscaTypes.py +++ b/catalog-be/src/main/resources/scripts/sdcBePy/common/normative/toscaTypes.py @@ -114,10 +114,7 @@ def _results_ok(results, response_codes): def _get_response_code(update_version): - response_codes = [200, 201] - if update_version is False: - response_codes.append(409) - + response_codes = [200, 201, 409] return response_codes diff --git a/catalog-be/src/main/resources/scripts/sdcBePy/tosca/data/onapTypesToUpgrade.json b/catalog-be/src/main/resources/scripts/sdcBePy/tosca/data/onapTypesToUpgrade.json index 0c363b01ea..7076705619 100644 --- a/catalog-be/src/main/resources/scripts/sdcBePy/tosca/data/onapTypesToUpgrade.json +++ b/catalog-be/src/main/resources/scripts/sdcBePy/tosca/data/onapTypesToUpgrade.json @@ -4,6 +4,23 @@ "NS", "NsVirtualLink" ], + "nfv_2_7_1": [ + "vduCompute", + "vduVirtualFileStorage", + "vnfExtCp", + "vduCp", + "vipCp" + ], + "nfv_3_3_1": [ + "VNF", + "vduVirtualBlockStorage" + ], + "nfv_4_1_1": [ + "VNF", + "osContainer", + "osContainerGroup", + "virtualCp" + ], "onap": [ ], "sol":[ diff --git a/catalog-be/src/main/resources/scripts/sdcBePy/tosca/imports/runNormativeType.py b/catalog-be/src/main/resources/scripts/sdcBePy/tosca/imports/runNormativeType.py index ee4e05b21a..4e9a14932f 100644 --- a/catalog-be/src/main/resources/scripts/sdcBePy/tosca/imports/runNormativeType.py +++ b/catalog-be/src/main/resources/scripts/sdcBePy/tosca/imports/runNormativeType.py @@ -4,7 +4,7 @@ import sys from sdcBePy.common.normative.toscaTypes import process_and_create_normative_types from sdcBePy.tosca.main import get_args, usage -from sdcBePy.tosca.models.normativeTypesList import get_normative, get_heat, get_nfv, get_onap, get_sol +from sdcBePy.tosca.models.normativeTypesList import get_normative, get_heat, get_nfv, get_nfv_2_7_1, get_nfv_3_3_1, get_nfv_4_1_1, get_onap, get_sol def run(candidate, exit_on_success=True): @@ -37,6 +37,17 @@ def run_import_nfv(): nfv_candidate = get_nfv() run(nfv_candidate) +def run_import_nfv_2_7_1(): + nfv_candidate = get_nfv_3_3_1() + run(nfv_candidate) + +def run_import_nfv_3_3_1(): + nfv_candidate = get_nfv_3_3_1() + run(nfv_candidate) + +def run_import_nfv_4_1_1(): + nfv_candidate = get_nfv_3_3_1() + run(nfv_candidate) def run_import_onap(): onap_candidate = get_onap() diff --git a/catalog-be/src/main/resources/scripts/sdcBePy/tosca/models/normativeToUpdateList.py b/catalog-be/src/main/resources/scripts/sdcBePy/tosca/models/normativeToUpdateList.py index a2830185d5..2d243d80ab 100644 --- a/catalog-be/src/main/resources/scripts/sdcBePy/tosca/models/normativeToUpdateList.py +++ b/catalog-be/src/main/resources/scripts/sdcBePy/tosca/models/normativeToUpdateList.py @@ -27,13 +27,20 @@ def get_heat_and_normative_to_update_list(types, base_file_location): ] -def get_nfv_onap_sol_to_update_list(types, base_file_location): +def get_onap_sol_to_update_list(types, base_file_location): return [ - get_nfv(types, base_file_location), get_onap(types, base_file_location), get_sol(types, base_file_location) ] +def get_nfv_to_update_list(types, base_file_location): + return [ + get_nfv(types, base_file_location), + get_nfv_2_7_1(types, base_file_location), + get_nfv_3_3_1(types, base_file_location), + get_nfv_4_1_1(types, base_file_location), + ] + def get_heat(types, base_location="/"): return NormativeTypeCandidate(base_location + "heat-types/", @@ -48,7 +55,18 @@ def get_normative(types, base_location="/"): def get_nfv(types, base_location="/"): return NormativeTypeCandidate(base_location + "nfv-types/", types.get_type("nfv")) - + +def get_nfv_2_7_1(types, base_location="/"): + return NormativeTypeCandidate(base_location + "nfv-types/2.7.1/", + types.get_type("nfv_2_7_1")) + +def get_nfv_3_3_1(types, base_location="/"): + return NormativeTypeCandidate(base_location + "nfv-types/3.3.1/", + types.get_type("nfv_3_3_1")) + +def get_nfv_4_1_1(types, base_location="/"): + return NormativeTypeCandidate(base_location + "nfv-types/4.1.1/", + types.get_type("nfv_4_1_1")) def get_onap(types, base_location="/"): return NormativeTypeCandidate(base_location + "onap-types/", diff --git a/catalog-be/src/main/resources/scripts/sdcBePy/tosca/models/normativeTypesList.py b/catalog-be/src/main/resources/scripts/sdcBePy/tosca/models/normativeTypesList.py index 46b8d9b5bc..12a4491b96 100644 --- a/catalog-be/src/main/resources/scripts/sdcBePy/tosca/models/normativeTypesList.py +++ b/catalog-be/src/main/resources/scripts/sdcBePy/tosca/models/normativeTypesList.py @@ -6,6 +6,9 @@ def get_normative_type_candidate_list(base_file_location): get_normative(base_file_location), get_heat(base_file_location), get_nfv(base_file_location), + get_nfv_2_7_1(base_file_location), + get_nfv_3_3_1(base_file_location), + get_nfv_4_1_1(base_file_location), get_onap(base_file_location), get_sol(base_file_location) ] @@ -110,7 +113,26 @@ def get_nfv(base_file_location="/"): "PonUni", "OltNni", "OntNni"]) - + +def get_nfv_2_7_1(base_file_location="/"): + return NormativeTypeCandidate(base_file_location + "nfv-types/2.7.1/", + ["vduCompute", + "vduVirtualFileStorage", + "vnfExtCp", + "vduCp", + "vipCp"]) + +def get_nfv_3_3_1(base_file_location="/"): + return NormativeTypeCandidate(base_file_location + "nfv-types/3.3.1/", + ["vduVirtualBlockStorage", + "VNF"]) + +def get_nfv_4_1_1(base_file_location="/"): + return NormativeTypeCandidate(base_file_location + "nfv-types/4.1.1/", + ["VNF", + "osContainer", + "osContainerGroup", + "virtualCp"]) def get_onap(base_file_location="/"): return NormativeTypeCandidate(base_file_location + "onap-types/", diff --git a/catalog-be/src/main/resources/scripts/sdcBePy/tosca/upgrade/run.py b/catalog-be/src/main/resources/scripts/sdcBePy/tosca/upgrade/run.py index 47acd05f5f..8cdf22842f 100644 --- a/catalog-be/src/main/resources/scripts/sdcBePy/tosca/upgrade/run.py +++ b/catalog-be/src/main/resources/scripts/sdcBePy/tosca/upgrade/run.py @@ -9,12 +9,13 @@ from sdcBePy.tosca.main import parse_and_create_proxy from sdcBePy.tosca.models.normativeElementsList import get_normative_element_candidate_list, \ get_normative_element_with_metadata_list from sdcBePy.tosca.models.normativeToUpdateList import TypesToUpdate, get_heat_and_normative_to_update_list, \ - get_nfv_onap_sol_to_update_list + get_onap_sol_to_update_list, get_nfv_to_update_list def main(sdc_be_proxy): update_version = True - update_onap_version = False + update_onap_version = False + update_nfv_version = True # use to run script form this dir (not like the command) # base_file_location = os.getcwd() + "/../../../../import/tosca/" @@ -28,8 +29,11 @@ def main(sdc_be_proxy): heat_and_normative_list = get_heat_and_normative_to_update_list(all_types, base_file_location) process_type_list(heat_and_normative_list, sdc_be_proxy, update_version) - nfv_onap_sol_list = get_nfv_onap_sol_to_update_list(all_types, base_file_location) - process_type_list(nfv_onap_sol_list, sdc_be_proxy, update_onap_version) + onap_sol_list = get_onap_sol_to_update_list(all_types, base_file_location) + process_type_list(onap_sol_list, sdc_be_proxy, update_onap_version) + + nfv_list = get_nfv_to_update_list(all_types, base_file_location) + process_type_list(nfv_list, sdc_be_proxy, update_nfv_version) logger.log("Updating end ->", "All normatives updated successfully!") print_and_exit(0, None) diff --git a/catalog-be/src/main/resources/scripts/sdcBePy/tosca/upgrade/runUpgradeNormative.py b/catalog-be/src/main/resources/scripts/sdcBePy/tosca/upgrade/runUpgradeNormative.py index 4b0d0cc8a2..a4305ec352 100644 --- a/catalog-be/src/main/resources/scripts/sdcBePy/tosca/upgrade/runUpgradeNormative.py +++ b/catalog-be/src/main/resources/scripts/sdcBePy/tosca/upgrade/runUpgradeNormative.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 from sdcBePy.tosca.imports.runNormativeType import run -from sdcBePy.tosca.models.normativeToUpdateList import get_heat, get_normative, get_nfv, get_onap, get_sol +from sdcBePy.tosca.models.normativeToUpdateList import get_heat, get_normative, get_nfv, get_2_7_1, get_nfv_3_3_1, get_nfv_4_1_1, get_onap, get_sol from sdcBePy.tosca.models.normativeTypesList import get_heat1707, get_heat1702_3537, get_heat_version from sdcBePy.tosca.upgrade.run import get_all_types @@ -21,7 +21,18 @@ def run_upgrade_normative(): def run_upgrade_nfv(): normative_candidate = get_nfv(all_types) run(normative_candidate) + +def run_upgrade_nfv_2_7_1(): + normative_candidate = get_nfv_2_7_1(all_types) + run(normative_candidate) + +def run_upgrade_nfv_3_3_1(): + normative_candidate = get_nfv_3_3_1(all_types) + run(normative_candidate) +def run_upgrade_nfv_4_1_1(): + normative_candidate = get_nfv_4_1_1(all_types) + run(normative_candidate) def run_upgrade_onap(): normative_candidate = get_onap(all_types) diff --git a/catalog-be/src/main/resources/scripts/setup.py b/catalog-be/src/main/resources/scripts/setup.py index da2cad2da3..e536e9360f 100644 --- a/catalog-be/src/main/resources/scripts/setup.py +++ b/catalog-be/src/main/resources/scripts/setup.py @@ -25,6 +25,9 @@ setup( "sdcimportnormative=sdcBePy.tosca.imports.runNormativeType:run_import_normative", "sdcimportheat=sdcBePy.tosca.imports.runNormativeType:run_import_heat", "sdcimportnfv=sdcBePy.tosca.imports.runNormativeType:run_import_nfv", + "sdcimportnfv271=sdcBePy.tosca.imports.runNormativeType:run_import_nfv_2_7_1", + "sdcimportnfv331=sdcBePy.tosca.imports.runNormativeType:run_import_nfv_3_3_1", + "sdcimportnfv411=sdcBePy.tosca.imports.runNormativeType:run_import_nfv_4_1_1", "sdcimportonap=sdcBePy.tosca.imports.runNormativeType:run_import_onap", "sdcimportsol=sdcBePy.tosca.imports.runNormativeType:run_import_sol", "sdcimportannotation=sdcBePy.tosca.imports.runNormativeType:run_import_annotation", diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java index 18dc67f752..622027df30 100644 --- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java +++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/ResourceImportManagerTest.java @@ -29,6 +29,8 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.when; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; import fj.data.Either; import java.io.IOException; @@ -55,9 +57,13 @@ import org.openecomp.sdc.be.components.lifecycle.LifecycleChangeInfoWithAction; import org.openecomp.sdc.be.config.Configuration; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.api.ActionStatus; +import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; +import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition; +import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.impl.ComponentsUtils; import org.openecomp.sdc.be.model.CapabilityDefinition; +import org.openecomp.sdc.be.model.Component; import org.openecomp.sdc.be.model.InterfaceDefinition; import org.openecomp.sdc.be.model.PropertyConstraint; import org.openecomp.sdc.be.model.PropertyDefinition; @@ -66,6 +72,7 @@ import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.UploadResourceInfo; import org.openecomp.sdc.be.model.User; import org.openecomp.sdc.be.model.jsonjanusgraph.operations.ToscaOperationFacade; +import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.openecomp.sdc.be.model.operations.impl.CapabilityTypeOperation; import org.openecomp.sdc.be.model.tosca.constraints.GreaterOrEqualConstraint; import org.openecomp.sdc.be.resources.data.auditing.AuditingActionEnum; @@ -102,7 +109,7 @@ public class ResourceImportManagerTest { importManager.setResponseFormatManager(responseFormatManager); importManager.setResourceBusinessLogic(resourceBusinessLogic); importManager.setToscaOperationFacade(toscaOperationFacade); - + String appConfigDir = "src/test/resources/config/catalog-be"; ConfigurationSource configurationSource = new FSConfigurationSource(ExternalConfiguration.getChangeListener(), appConfigDir); final ConfigurationManager configurationManager = new ConfigurationManager(configurationSource); @@ -115,6 +122,8 @@ public class ResourceImportManagerTest { @Before public void beforeTest() { Mockito.reset(auditingManager, responseFormatManager, resourceBusinessLogic, userAdmin); + Either notFound = Either.right(StorageOperationStatus.NOT_FOUND); + when(toscaOperationFacade.getComponentByNameAndVendorRelease(any(ComponentTypeEnum.class), anyString(), anyString(), any(JsonParseFlagEnum.class))).thenReturn(notFound); } @Test @@ -273,10 +282,38 @@ public class ResourceImportManagerTest { interfaceDefinition.setOperations(operations ); interfaceTypes.put("tosca.interfaces.node.lifecycle.standard", interfaceDefinition); when(interfaceOperationBusinessLogic.getAllInterfaceLifecycleTypes()).thenReturn(Either.left(interfaceTypes)); - + ImmutablePair createResource = importManager.importNormativeResource(jsonContent, resourceMD, user, true, true); assertNull(createResource.left.getInterfaces()); } + + @Test + public void testResourceCreationFailedVendorReleaseAlreadyExists() throws IOException { + UploadResourceInfo resourceMD = createDummyResourceMD(); + + User user = new User(); + user.setUserId(resourceMD.getContactId()); + user.setRole("ADMIN"); + user.setFirstName("Jhon"); + user.setLastName("Doh"); + when(userAdmin.getUser(Mockito.anyString(), Mockito.anyBoolean())).thenReturn(user); + + setResourceBusinessLogicMock(); + + Either notFound = Either.left(Mockito.mock(Resource.class)); + when(toscaOperationFacade.getComponentByNameAndVendorRelease(any(ComponentTypeEnum.class), anyString(), anyString(), any(JsonParseFlagEnum.class))).thenReturn(notFound); + + String jsonContent = ImportUtilsTest.loadFileNameToJsonString("normative-types-new-blockStorage.yml"); + + ComponentException errorInfoFromTest = null; + try { + importManager.importNormativeResource(jsonContent, resourceMD, user, true, true); + }catch (ComponentException e){ + errorInfoFromTest = e; + } + assertNotNull(errorInfoFromTest); + assertEquals(ActionStatus.COMPONENT_VERSION_ALREADY_EXIST, errorInfoFromTest.getActionStatus()); + } private void setResourceBusinessLogicMock() { when(resourceBusinessLogic.getUserAdmin()).thenReturn(userAdmin); diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java index 729d3c57da..be1dc454f8 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/jsongraph/JanusGraphDao.java @@ -21,6 +21,7 @@ package org.openecomp.sdc.be.dao.jsongraph; import org.janusgraph.core.*; +import org.janusgraph.graphdb.query.JanusGraphPredicate; import fj.data.Either; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.tuple.ImmutablePair; @@ -461,6 +462,12 @@ public class JanusGraphDao { } public Either, JanusGraphOperationStatus> getByCriteria(VertexTypeEnum type, Map props, Map hasNotProps, JsonParseFlagEnum parseFlag) { + return getByCriteria(type, props, hasNotProps, null, parseFlag); + } + + public Either, JanusGraphOperationStatus> getByCriteria(final VertexTypeEnum type, + final Map hasProps, final Map hasNotProps, + final Map> predicates, final JsonParseFlagEnum parseFlag) { Either graph = janusGraphClient.getGraph(); if (graph.isLeft()) { try { @@ -471,8 +478,8 @@ public class JanusGraphDao { query = query.has(GraphPropertyEnum.LABEL.getProperty(), type.getName()); } - if (props != null && !props.isEmpty()) { - for (Map.Entry entry : props.entrySet()) { + if (hasProps != null && !hasProps.isEmpty()) { + for (Map.Entry entry : hasProps.entrySet()) { query = query.has(entry.getKey().getProperty(), entry.getValue()); } } @@ -485,40 +492,36 @@ public class JanusGraphDao { } } } + if (predicates != null && !predicates.isEmpty()) { + for (Map.Entry> entry : predicates.entrySet()) { + JanusGraphPredicate predicate = entry.getValue().getKey(); + Object object = entry.getValue().getValue(); + query = query.has(entry.getKey(), predicate, object); + } + } Iterable vertices = query.vertices(); - if (vertices == null) { + if (vertices == null || !vertices.iterator().hasNext()) { return Either.right(JanusGraphOperationStatus.NOT_FOUND); } - Iterator iterator = vertices.iterator(); List result = new ArrayList<>(); - - while (iterator.hasNext()) { - JanusGraphVertex vertex = iterator.next(); - - Map newProp = getVertexProperties(vertex); - GraphVertex graphVertex = createAndFill(vertex, parseFlag); - - result.add(graphVertex); - } + vertices.forEach(vertex -> result.add(createAndFill(vertex, parseFlag))); + if (logger.isDebugEnabled()) { - logger.debug("Number of fetced nodes in graph for criteria : from type = {} and properties = {} is {}", type, props, result.size()); - } - if (result.size() == 0) { - return Either.right(JanusGraphOperationStatus.NOT_FOUND); + logger.debug("Number of fetched nodes in graph for criteria : from type '{}' and properties '{}' is '{}'", type, hasProps, result.size()); } return Either.left(result); } catch (Exception e) { if (logger.isDebugEnabled()) { - logger.debug("Failed get by criteria for type = {} and properties = {}", type, props, e); + logger.debug("Failed to get by criteria for type '{}' and properties '{}'", type, hasProps, e); } return Either.right(JanusGraphClient.handleJanusGraphException(e)); } } else { if (logger.isDebugEnabled()) { - logger.debug("Failed get by criteria for type ={} and properties = {} error : {}", type, props, graph.right().value()); + logger.debug("Failed to get by criteria for type '{}' and properties '{}'. Error : '{}'", type, hasProps, graph.right().value()); } return Either.right(graph.right().value()); } diff --git a/catalog-model/pom.xml b/catalog-model/pom.xml index 82d1eac6e8..27e40bf1f4 100644 --- a/catalog-model/pom.xml +++ b/catalog-model/pom.xml @@ -333,6 +333,11 @@ + + com.vdurmont + semver4j + 3.1.0 + diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ByToscaNameDerivedNodeTypeResolver.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ByToscaNameDerivedNodeTypeResolver.java index a34dd7e920..9b9a3e6799 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ByToscaNameDerivedNodeTypeResolver.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ByToscaNameDerivedNodeTypeResolver.java @@ -48,9 +48,8 @@ public class ByToscaNameDerivedNodeTypeResolver implements DerivedNodeTypeResolv propertiesToMatch.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name()); propertiesToMatch.put(GraphPropertyEnum.TOSCA_RESOURCE_NAME, parentResource); - propertiesToMatch.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true); return janusGraphDao - .getByCriteria(VertexTypeEnum.NODE_TYPE, propertiesToMatch, JsonParseFlagEnum.NoParse); + .getByCriteria(VertexTypeEnum.NODE_TYPE, propertiesToMatch, JsonParseFlagEnum.ParseMetadata); } } diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java index a67f92fff2..1860e696e5 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTypeOperation.java @@ -26,6 +26,7 @@ import java.util.Collection; import java.util.EnumSet; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -62,6 +63,8 @@ import org.openecomp.sdc.common.jsongraph.util.CommonUtility; import org.openecomp.sdc.common.jsongraph.util.CommonUtility.LogLevelEnum; import org.openecomp.sdc.common.log.wrappers.Logger; import org.springframework.beans.factory.annotation.Qualifier; +import com.vdurmont.semver4j.Semver; +import com.vdurmont.semver4j.Semver.SemverType; @org.springframework.stereotype.Component("node-type-operation") public class NodeTypeOperation extends ToscaElementOperation { @@ -602,7 +605,7 @@ public class NodeTypeOperation extends ToscaElementOperation { return Either.right(StorageOperationStatus.PARENT_RESOURCE_NOT_FOUND); } else { if (resources.size() > 1) { - return handleMultipleParent(parentResource, derivedResources, resources); + return handleMultipleParent(parentResource, derivedResources, resources, (String)nodeType.getMetadataValue(JsonPresentationFields.VENDOR_RELEASE)); } else { GraphVertex parentResourceData = resources.get(0); derivedResources.add(parentResourceData); @@ -616,10 +619,11 @@ public class NodeTypeOperation extends ToscaElementOperation { return Either.left(derivedResources); } - Either, StorageOperationStatus> handleMultipleParent(String parentResource, List derivedResource, List fetchedDerivedResources) { + Either, StorageOperationStatus> handleMultipleParent(String parentResource, List derivedResource, List fetchedDerivedResources, String vendorRelease) { Either, StorageOperationStatus> result = Either.left(derivedResource); try { + fetchedDerivedResources.removeIf(graphVertex -> !isValidForVendorRelease(graphVertex, vendorRelease)); fetchedDerivedResources.sort((d1, d2) -> { return new Double(Double.parseDouble((String) d1.getMetadataProperty(GraphPropertyEnum.VERSION))).compareTo(Double.parseDouble((String) d2.getMetadataProperty(GraphPropertyEnum.VERSION))); }); @@ -638,6 +642,20 @@ public class NodeTypeOperation extends ToscaElementOperation { } return result; } + + private boolean isValidForVendorRelease(final GraphVertex resource, final String vendorRelease) { + if (vendorRelease != null && !vendorRelease.equals("1.0")) { + try { + Semver resourceSemVer = new Semver((String)resource.getJsonMetadataField(JsonPresentationFields.VENDOR_RELEASE), SemverType.NPM); + Semver packageSemVer = new Semver(vendorRelease, SemverType.NPM); + return !resourceSemVer.isGreaterThan(packageSemVer); + } catch (Exception exception) { + log.debug("Error in comparing vendor release", exception); + return false; + } + } + return true; + } private StorageOperationStatus fixMultipleParent(List fetchedDerivedResources) { StorageOperationStatus result = StorageOperationStatus.OK; diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java index b16e129d2e..cdddb2049f 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java @@ -23,7 +23,9 @@ package org.openecomp.sdc.be.model.jsonjanusgraph.operations; import static java.util.Objects.requireNonNull; import static org.apache.commons.collections.CollectionUtils.isEmpty; import static org.apache.commons.collections.CollectionUtils.isNotEmpty; - +import static org.janusgraph.core.attribute.Contain.NOT_IN; +import static org.janusgraph.core.attribute.Text.REGEX; +import static org.openecomp.sdc.be.dao.janusgraph.JanusGraphUtils.buildNotInPredicate; import fj.data.Either; import java.util.ArrayList; import java.util.Arrays; @@ -47,6 +49,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.Edge; +import org.janusgraph.graphdb.query.JanusGraphPredicate; import org.openecomp.sdc.be.config.Configuration; import org.openecomp.sdc.be.config.ConfigurationManager; import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus; @@ -55,6 +58,7 @@ import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao; import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; +import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary; import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition; import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition; @@ -74,6 +78,7 @@ import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition; import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum; import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; +import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum; import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum; import org.openecomp.sdc.be.datatypes.enums.PromoteVersionEnum; import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; @@ -113,11 +118,14 @@ import org.openecomp.sdc.be.model.operations.impl.DaoStatusConverter; import org.openecomp.sdc.be.model.operations.impl.UniqueIdBuilder; import org.openecomp.sdc.be.model.utils.GroupUtils; import org.openecomp.sdc.be.resources.data.ComponentMetadataData; +import org.openecomp.sdc.be.resources.data.GroupTypeData; import org.openecomp.sdc.common.jsongraph.util.CommonUtility; import org.openecomp.sdc.common.jsongraph.util.CommonUtility.LogLevelEnum; import org.openecomp.sdc.common.log.wrappers.Logger; import org.openecomp.sdc.common.util.ValidationUtils; import org.springframework.beans.factory.annotation.Autowired; +import com.vdurmont.semver4j.Semver; +import com.vdurmont.semver4j.Semver.SemverType; @org.springframework.stereotype.Component("tosca-operation-facade") @@ -418,6 +426,87 @@ public class ToscaOperationFacade { return getLatestCertifiedByToscaResourceName(toscaResourceName, VertexTypeEnum.NODE_TYPE, JsonParseFlagEnum.ParseMetadata); } + + public Either getByToscaResourceNameMatchingVendorRelease(final String toscaResourceName, final String vendorVersion) { + + return getByToscaResourceNameMatchingVendorRelease(toscaResourceName, VertexTypeEnum.NODE_TYPE, JsonParseFlagEnum.ParseMetadata, vendorVersion); + } + + public Either getByToscaResourceNameMatchingVendorRelease(String toscaResourceName, + VertexTypeEnum vertexType, JsonParseFlagEnum parseFlag, String vendorRelease) { + + Map props = new EnumMap<>(GraphPropertyEnum.class); + props.put(GraphPropertyEnum.TOSCA_RESOURCE_NAME, toscaResourceName); + props.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name()); + + Map> predicateCriteria = getVendorVersionPredicate(vendorRelease); + + Either, JanusGraphOperationStatus> getLatestRes = janusGraphDao + .getByCriteria(vertexType, props, null, predicateCriteria, parseFlag); + + if(getLatestRes.isRight() || CollectionUtils.isEmpty(getLatestRes.left().value())) { + getLatestRes = janusGraphDao.getByCriteria(vertexType, props, parseFlag); + } + + return getLatestRes + .right().map( + status -> { + CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to fetch {} with name {}. status={} ", + vertexType, toscaResourceName, status); + return DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status); + } + ) + .left().bind( + resources -> { + double version = 0.0; + GraphVertex highestResource = null; + for (GraphVertex resource : resources) { + double resourceVersion = Double + .parseDouble((String) resource.getJsonMetadataField(JsonPresentationFields.VERSION)); + if (resourceVersion > version && isValidForVendorRelease(resource, vendorRelease)) { + version = resourceVersion; + highestResource = resource; + } + } + if (highestResource != null) { + return getToscaFullElement(highestResource.getUniqueId()); + } else { + log.debug("The vertex with the highest version could not be found for {}", toscaResourceName); + return Either.right(StorageOperationStatus.GENERAL_ERROR); + } + } + ); + } + + private Map> getVendorVersionPredicate(final String vendorRelease) { + Map> predicateCriteria = new HashMap<>(); + if (vendorRelease != null && vendorRelease != "1.0") { + String[] vendorReleaseElements = vendorRelease.split("\\."); + if (vendorReleaseElements.length > 0) { + String regex = ".*\"vendorRelease\":\""; + for (int i = 0; i (REGEX, regex)); + } + } + return predicateCriteria; + } + + private boolean isValidForVendorRelease(final GraphVertex resource, final String vendorRelease) { + if (!vendorRelease.equals("1.0")) { + try { + Semver resourceSemVer = new Semver((String)resource.getJsonMetadataField(JsonPresentationFields.VENDOR_RELEASE), SemverType.NPM); + Semver packageSemVer = new Semver(vendorRelease, SemverType.NPM); + return !resourceSemVer.isGreaterThan(packageSemVer); + } catch (Exception exception) { + log.debug("Error in comparing vendor release", exception); + return true; + } + } + return true; + } public Either getLatestCertifiedByToscaResourceName(String toscaResourceName, VertexTypeEnum vertexType, JsonParseFlagEnum parseFlag) { @@ -785,6 +874,30 @@ public class ToscaOperationFacade { } return getToscaElementByOperation(getResourceRes.left().value().get(0)); } + + public Either getComponentByNameAndVendorRelease( + final ComponentTypeEnum componentType, final String name, final String vendorRelease, + final JsonParseFlagEnum parseFlag) { + + Map hasProperties = new EnumMap<>(GraphPropertyEnum.class); + Map hasNotProperties = new EnumMap<>(GraphPropertyEnum.class); + + hasProperties.put(GraphPropertyEnum.NAME, name); + hasNotProperties.put(GraphPropertyEnum.IS_DELETED, true); + if (componentType != null) { + hasProperties.put(GraphPropertyEnum.COMPONENT_TYPE, componentType.name()); + } + Map> predicateCriteria = getVendorVersionPredicate(vendorRelease); + + Either, JanusGraphOperationStatus> getResourceRes = janusGraphDao + .getByCriteria(null, hasProperties, hasNotProperties, predicateCriteria, parseFlag); + if (getResourceRes.isRight()) { + JanusGraphOperationStatus status = getResourceRes.right().value(); + log.debug("failed to find resource with name {}, version {}. Status is {} ", name, predicateCriteria, status); + return Either.right(DaoStatusConverter.convertJanusGraphStatusToStorageStatus(status)); + } + return getToscaElementByOperation(getResourceRes.left().value().get(0)); + } public Either, StorageOperationStatus> getCatalogOrArchiveComponents(boolean isCatalog, List excludeTypes) { List excludedResourceTypes = Optional.ofNullable(excludeTypes).orElse(Collections.emptyList()).stream().filter(type -> !type.equals(OriginTypeEnum.SERVICE)).map(type -> ResourceTypeEnum.getTypeByName(type.name())) diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java index a2db915d8b..3f45885999 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java @@ -615,6 +615,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa final Optional> fromToMovedPaths = etsiService.moveNonManoFileToArtifactFolder(handler); fromToMovedPaths.ifPresent(it -> etsiService.updateMainDescriptorPaths(toscaServiceModel, it)); packageInfo.setResourceType(etsiService.getResourceType(manifest).name()); + packageInfo.setVendorRelease(etsiService.getHighestCompatibleSpecificationVersion(handler).getOriginalValue()); } packageInfo.setTranslatedFile( ByteBuffer.wrap(toscaServiceTemplateServiceCsar.createOutputFile(toscaServiceModel, licenseArtifacts))); -- cgit 1.2.3-korg