diff options
author | Avi Ziv <avi.ziv@amdocs.com> | 2017-07-18 19:45:38 +0300 |
---|---|---|
committer | Avi Ziv <avi.ziv@amdocs.com> | 2017-07-18 19:45:38 +0300 |
commit | b8e2faf476202b6ffe61bc3a9a37df1304881d40 (patch) | |
tree | f78b8c0517d8e16c5ae610bf8b49f68ea8a312a1 /openecomp-be/tools | |
parent | 75aacbbe1acf78fa53378f07f0a8c7769449a17e (diff) |
[SDC] Onboarding 1710 rebase.
Change-Id: If3b6b81d221fde13908f1e8160db6f7d9433c535
Signed-off-by: Avi Ziv <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-be/tools')
22 files changed, 325 insertions, 122 deletions
diff --git a/openecomp-be/tools/build/scripts/cassandra-commands.json b/openecomp-be/tools/build/scripts/cassandra-commands.json index 3a606241bd..2935acad4a 100644 --- a/openecomp-be/tools/build/scripts/cassandra-commands.json +++ b/openecomp-be/tools/build/scripts/cassandra-commands.json @@ -12,11 +12,12 @@ "feature_group": "CREATE TABLE IF NOT EXISTS feature_group (vlm_id text, version frozen<version>, fg_id text, name text, description text, part_num text, ep_ids set<text>, lkg_ids set<text>, ref_la_ids set<text>, PRIMARY KEY ((vlm_id, version), fg_id))", "license_key_group": "CREATE TABLE IF NOT EXISTS license_key_group (vlm_id text, version frozen<version>, lkg_id text,name text,description text, type text, operational_scope frozen<multi_choice_or_other>, ref_fg_ids set<text>, version_uuid text, PRIMARY KEY ((vlm_id, version), lkg_id))", "entitlement_pool": "CREATE TABLE IF NOT EXISTS entitlement_pool (vlm_id text, version frozen<version>, ep_id text,name text,description text,threshold float,threshold_unit text,entitlement_metric frozen<choice_or_other>,increments text,aggregation_func frozen<choice_or_other>, operational_scope frozen<multi_choice_or_other>, time frozen<choice_or_other>,manufacturer_ref_num text,ref_fg_ids set<text>, version_uuid text, PRIMARY KEY ((vlm_id, version), ep_id))", - "vsp_information": "CREATE TABLE IF NOT EXISTS vsp_information (VSP_ID text, version frozen<version>, NAME text,DESCRIPTION text,CATEGORY text,SUB_CATEGORY text,ICON text,PACKAGE_NAME text,PACKAGE_VERSION text,vendor_name text, vendor_id text,LICENSE_AGREEMENT text,FEATURE_GROUPS list<text>,VALIDATION_DATA text,CONTENT_DATA blob, questionnaire_data text, vlm_version frozen<version>, is_old_version text, PRIMARY KEY ((VSP_ID, version)))", + "vsp_information": "CREATE TABLE IF NOT EXISTS vsp_information (VSP_ID text, version frozen<version>, NAME text,DESCRIPTION text,CATEGORY text,SUB_CATEGORY text,ICON text,PACKAGE_NAME text,PACKAGE_VERSION text,vendor_name text, vendor_id text,LICENSE_AGREEMENT text,FEATURE_GROUPS list<text>,VALIDATION_DATA text,CONTENT_DATA blob, questionnaire_data text, vlm_version frozen<version>, is_old_version text, onboarding_method text, PRIMARY KEY ((VSP_ID, version)))", "package_details": "CREATE TABLE IF NOT EXISTS package_details (VSP_ID text, version frozen<version>,DISPLAY_NAME text,vsp_name text,vsp_description text,VENDOR_NAME text,CATEGORY text,SUB_CATEGORY text,VENDOR_RELEASE text,PACKAGE_CHECKSUM text,PACKAGE_TYPE text,TRANSLATE_CONTENT blob,PRIMARY KEY ((VSP_ID, version)))", "vsp_network": "CREATE TABLE IF NOT EXISTS vsp_network (vsp_id text, version frozen<version>, network_id text, composition_data text, questionnaire_data text, PRIMARY KEY ((vsp_id, version), network_id))", "vsp_component": "CREATE TABLE IF NOT EXISTS vsp_component (vsp_id text, version frozen<version>, component_id text, composition_data text, questionnaire_data text, PRIMARY KEY ((vsp_id, version), component_id))", "vsp_component_nic": "CREATE TABLE IF NOT EXISTS vsp_component_nic (vsp_id text, version frozen<version>, component_id text, nic_id text, composition_data text, questionnaire_data text, PRIMARY KEY ((vsp_id, version), component_id, nic_id))", + "vsp_component_image": "CREATE TABLE IF NOT EXISTS vsp_component_image (vsp_id text, version frozen<version>, component_id text, image_id text, composition_data text, questionnaire_data text, PRIMARY KEY ((vsp_id, version), component_id, image_id))", "vsp_process" : "CREATE TABLE IF NOT EXISTS vsp_process (vsp_id text, version frozen<version>, component_id text, process_id text, name text, description text, type text, artifact_name text, artifact blob, PRIMARY KEY ((vsp_id, version), component_id, process_id))", "vsp_service_artifact" : "CREATE TABLE IF NOT EXISTS vsp_service_artifact (vsp_id text, version frozen<version>, name text, content_data blob, PRIMARY KEY ((vsp_id, version), name))", "vsp_service_template" : "CREATE TABLE IF NOT EXISTS vsp_service_template (vsp_id text, version frozen<version>, base_name text static, name text, content_data blob, PRIMARY KEY ((vsp_id, version), name))", @@ -34,6 +35,8 @@ "name_index": "CREATE INDEX IF NOT EXISTS action_name ON dox.Action (name)", "action_artifact":"CREATE TABLE IF NOT EXISTS action_artifact(artifactuuid text, effective_version int, artifact blob, PRIMARY KEY(artifactuuid, effective_version)) WITH CLUSTERING ORDER BY (effective_version DESC)", "vsp_orchestration_template_candidate" : "CREATE TABLE IF NOT EXISTS vsp_orchestration_template_candidate (vsp_id text, version frozen<version>, files_data_structure text, content_data blob, PRIMARY KEY ((vsp_id, version)))", + "vsp_deployment_flavor" : "CREATE TABLE IF NOT EXISTS vsp_deployment_flavor (vsp_id text, version frozen<version>, deployment_flavor_id text, composition_data text, questionnaire_data text, PRIMARY KEY ((vsp_id, version), deployment_flavor_id))", + "vsp_component_compute": "CREATE TABLE IF NOT EXISTS vsp_component_compute (vsp_id text, version frozen<version>, component_id text, compute_id text, composition_data text, questionnaire_data text, PRIMARY KEY ((vsp_id, version), component_id, compute_id))", "vsp_component_dependency_model" : "CREATE TABLE IF NOT EXISTS vsp_component_dependency_model (vsp_id text, version frozen<version>, dependency_id text, sourcecomponent_id text, targetcomponent_id text, relation text, PRIMARY KEY ((vsp_id, version), dependency_id))", "activity_log" : "CREATE TABLE IF NOT EXISTS activity_log (item_id text, version_id text, activity_id text, type text, user text, timestamp timestamp, success boolean, message text, comment text, PRIMARY KEY (item_id, version_id, activity_id))", "migration": "CREATE TABLE IF NOT EXISTS migration (id text, ismigrated boolean, primary key(id))" @@ -50,6 +53,7 @@ "vsp_information": "DROP TABLE IF EXISTS vsp_information", "package_details": "DROP TABLE IF EXISTS package_details", "vsp_network": "DROP TABLE IF EXISTS vsp_network", + "vsp_component_image": "DROP TABLE IF EXISTS vsp_component_image", "vsp_component": "DROP TABLE IF EXISTS vsp_component", "vsp_component_nic": "DROP TABLE IF EXISTS vsp_component_nic", "vsp_process":"DROP TABLE IF EXISTS vsp_process", @@ -71,6 +75,7 @@ "vsp_component_artifact": "DROP TABLE IF EXISTS dox.vsp_component_artifact", "action_artifact":"DROP TABLE IF EXISTS action_artifact", "vsp_orchestration_template_candidate":"DROP TABLE IF EXISTS vsp_orchestration_template_candidate", + "vsp_deployment_flavor":"DROP TABLE IF EXISTS vsp_deployment_flavor", "vsp_component_dependency_model":"DROP TABLE IF EXISTS vsp_component_dependency_model", "activity_log": "DROP TABLE IF EXISTS activity_log", "migration": "DROP TABLE IF EXISTS migration" @@ -78,6 +83,7 @@ "alter": { "vsp_information": "ALTER TABLE vsp_information ADD questionnaire_data text", "vsp_information_1": "ALTER TABLE vsp_information ADD vlm_version frozen<version>", + "vsp_information_2": "ALTER TABLE vsp_information ADD onboarding_method text", "vsp_process": "ALTER TABLE vsp_process ADD type text", "entitlement_pool": "alter table entitlement_pool ADD version_uuid text", "license_key_group": "alter table license_key_group ADD version_uuid text", diff --git a/openecomp-be/tools/install/database/schemaTemplates/composition/component.ftl b/openecomp-be/tools/install/database/schemaTemplates/composition/component.ftl index e70deffc89..e2953b83d0 100644 --- a/openecomp-be/tools/install/database/schemaTemplates/composition/component.ftl +++ b/openecomp-be/tools/install/database/schemaTemplates/composition/component.ftl @@ -19,7 +19,13 @@ "vfcCode": { "type": "string" }, - "description": { +"nfcCode": { +"type": "string" +}, +"nfcFunction": { +"type": "string" +}, +"description": { "type": "string" } }, diff --git a/openecomp-be/tools/install/database/schemaTemplates/composition/compute.ftl b/openecomp-be/tools/install/database/schemaTemplates/composition/compute.ftl new file mode 100644 index 0000000000..02b46633a6 --- /dev/null +++ b/openecomp-be/tools/install/database/schemaTemplates/composition/compute.ftl @@ -0,0 +1,17 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "name": { + "type": "string" <#if !manual>, + "enum": [ + "${compute.name}" + ], + "default": "${compute.name}"</#if> + }, + "description": { + "type": "string", + "maxLength": 300 + } + } +}
\ No newline at end of file diff --git a/openecomp-be/tools/install/database/schemaTemplates/composition/deployment.ftl b/openecomp-be/tools/install/database/schemaTemplates/composition/deployment.ftl new file mode 100644 index 0000000000..67271c79e2 --- /dev/null +++ b/openecomp-be/tools/install/database/schemaTemplates/composition/deployment.ftl @@ -0,0 +1,39 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "model": { + "type": "string", + "maxLength": 30, + "pattern": "^[A-Za-z0-9_,-]*$" + }, + "description": { + "type": "string", + + "maxLength": 300 + }, + "featureGroupId":{ + "type": "string", + "enum": [<#if featureGroupIds??> <#list featureGroupIds as featureGroupId> + "${featureGroupId}"<#sep>,</#list> </#if> + ] + }, + "componentComputeAssociations": { + "type": "array", + "properties": { + "vfcid": { + "type": "string" + }, + "computeFlavorid": { + "type": "string" + } + }, + "additionalProperties": false + } + + }, + "additionalProperties": false, + "required": [ + "model" + ] +}
\ No newline at end of file diff --git a/openecomp-be/tools/install/database/schemaTemplates/composition/image.ftl b/openecomp-be/tools/install/database/schemaTemplates/composition/image.ftl new file mode 100644 index 0000000000..8391390506 --- /dev/null +++ b/openecomp-be/tools/install/database/schemaTemplates/composition/image.ftl @@ -0,0 +1,13 @@ +{ +"$schema": "http://json-schema.org/draft-04/schema#", +"type": "object", +"properties": { + "fileName": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "additionalProperties": false +} diff --git a/openecomp-be/tools/install/database/schemaTemplates/composition/nic.ftl b/openecomp-be/tools/install/database/schemaTemplates/composition/nic.ftl index 6111348f88..fec5b9cd64 100644 --- a/openecomp-be/tools/install/database/schemaTemplates/composition/nic.ftl +++ b/openecomp-be/tools/install/database/schemaTemplates/composition/nic.ftl @@ -3,12 +3,11 @@ "type": "object", "properties": { "name": { - "type": "string"<#if !manual>, + "type": "string", "enum": [ "${nic.name}" ], "default": "${nic.name}" - </#if> }, "description": { "type": "string" @@ -20,15 +19,36 @@ ], "default": "${nic.networkId}" } - </#if><#else>, + </#if> + <#elseif manual><#if nic.networkId??>, + "networkId": { + "type": "string", + "enum": [ + "${nic.networkId}" + ], + "default": "${nic.networkId}" + } + </#if> +<#else>, "networkId": { "type": "string", "enum": [<#list networkIds as networkId> "${networkId}"<#sep>,</#list> ] } - </#if> + </#if>, + "networkDescription": { + "type": "string" + }, + "networkType": { + "type": "string", + "enum": [ + "${nic.networkType}" + ], + "default": "${nic.networkType}" + } }, + "additionalProperties": false, "required": [ "name" diff --git a/openecomp-be/tools/install/database/schemaTemplates/questionnaire/component.ftl b/openecomp-be/tools/install/database/schemaTemplates/questionnaire/component.ftl index d525c62474..062bf55928 100644 --- a/openecomp-be/tools/install/database/schemaTemplates/questionnaire/component.ftl +++ b/openecomp-be/tools/install/database/schemaTemplates/questionnaire/component.ftl @@ -32,39 +32,30 @@ "image": { "type": "object", "properties": { - "format": { - "type": "string", - "enum": [ - "aki", - "ami", - "ari", - "iso", - "qcow2", - "raw", - "vdi", - "vhd", - "vmdk" - ], - "default": "qcow2" - }, "providedBy": { "type": "string", "enum": [ "Vendor" ], "default": "Vendor" - }, - "bootDiskSizePerVM": { - "type": "number", - "maximum": 100 - }, - "ephemeralDiskSizePerVM": { - "type": "number", - "maximum": 400 } }, "additionalProperties": false }, + "disk": { + "type": "object" , + "properties": { + "bootDiskSizePerVM": { + "type": "number", + "maximum": 100 + }, + "ephemeralDiskSizePerVM": { + "type": "number", + "maximum": 400 + } + }, + "additionalProperties": false + }, "recovery": { "type": "object", "properties": { @@ -101,35 +92,6 @@ "compute": { "type": "object", "properties": { - "vmSizing": { - "type": "object", - "properties": { - "numOfCPUs": { - "type": "number", - "minimum": 0, - "exclusiveMinimum": true, - "maximum": 16, - "default": 2 - }, - "fileSystemSizeGB": { - "type": "number", - "minimum": 0, - "exclusiveMinimum": true, - "default": 5 - }, - "persistentStorageVolumeSize": { - "type": "number", - "minimum": 0, - "exclusiveMinimum": true - }, - "IOOperationsPerSec": { - "type": "number", - "minimum": 0, - "exclusiveMinimum": true - } - }, - "additionalProperties": false - }, "numOfVMs": { "type": "object", "properties": { @@ -148,24 +110,6 @@ 0</#if> , "exclusiveMinimum": true, "maximum": 100 - }, - "CpuOverSubscriptionRatio": { - "type": "string", - "enum": [ - "1:1", - "4:1", - "16:1" - ], - "default": "4:1" - }, - "MemoryRAM": { - "type": "string", - "enum": [ - "2 GB", - "4 GB", - "8 GB" - ], - "default": "2 GB" } }, "additionalProperties": false @@ -184,6 +128,7 @@ 32 ], "default": 64 + }, "tools": { "type": "string" diff --git a/openecomp-be/tools/install/database/schemaTemplates/questionnaire/compute.ftl b/openecomp-be/tools/install/database/schemaTemplates/questionnaire/compute.ftl new file mode 100644 index 0000000000..3dc85cf192 --- /dev/null +++ b/openecomp-be/tools/install/database/schemaTemplates/questionnaire/compute.ftl @@ -0,0 +1,54 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "vmSizing": { + "type": "object", + "properties": { + "numOfCPUs": { + "type": "number", + "minimum": 0, + "exclusiveMinimum": true, + "maximum": 16, + "default": 2 + }, + "fileSystemSizeGB": { + "type": "number", + "minimum": 0, + "exclusiveMinimum": true, + "default": 5 + }, + "persistentStorageVolumeSize": { + "type": "number", + "minimum": 0, + "exclusiveMinimum": true + }, + "ioOperationsPerSec": { + "type": "number", + "minimum": 0, + "exclusiveMinimum": true + }, + "cpuOverSubscriptionRatio": { + "type": "string", + "enum": [ + "1:1", + "4:1", + "16:1" + ], + "default": "4:1" + }, + "memoryRAM": { + "type": "string", + "enum": [ + "1", + "2", + "4", + "8" + ], + "default": "1" + } + }, + "additionalProperties": false + } + } +}
\ No newline at end of file diff --git a/openecomp-be/tools/install/database/schemaTemplates/questionnaire/image.ftl b/openecomp-be/tools/install/database/schemaTemplates/questionnaire/image.ftl new file mode 100644 index 0000000000..4313e65c44 --- /dev/null +++ b/openecomp-be/tools/install/database/schemaTemplates/questionnaire/image.ftl @@ -0,0 +1,22 @@ +{ +"$schema": "http://json-schema.org/draft-04/schema#", +"type": "object", +"properties": { + "format": { + "type": "string", + "enum": [ + "aki","ami","ari","iso","qcow2","raw", "vdi","vhd","vmdk" + ] + }, + "version": { + "type": "string" + }, + "md5": { + "type": "string" + } +}, + "additionalProperties": false, + "required": [ + "version" + ] +}
\ No newline at end of file diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/pom.xml b/openecomp-be/tools/migration/1702_to_1707_zusammen/pom.xml index 1f281c950b..47808dbc3a 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/pom.xml +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/pom.xml @@ -47,12 +47,12 @@ <dependency> <groupId>com.amdocs.zusammen.plugin</groupId> <artifactId>zusammen-state-store-cassandra-plugin</artifactId> - <version>0.0.1</version> + <version>${zusammen.version}</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> - <version>RELEASE</version> + <version>${hibernate.validator.version}</version> </dependency> <dependency> <groupId>org.openecomp.sdc</groupId> diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java index c43cf32001..e0f3e016fe 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java @@ -49,7 +49,7 @@ import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity; import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyGroupEntity; import org.openecomp.sdc.vendorlicense.dao.types.VendorLicenseModelEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.MibEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity; import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity; @@ -266,7 +266,7 @@ public class MigrationMain { private static void convertMibs(SessionContext context, CassandraElementRepository cassandraElementRepository) { MibCassandraLoader cassandraLoader = new MibCassandraLoader(); - Collection<MibEntity> mibs = cassandraLoader.list(); + Collection<ComponentMonitoringUploadEntity> mibs = cassandraLoader.list(); mibs.stream().filter(mibEntity -> needMigration(mibEntity.getVspId(), mibEntity.getVersion())) .forEach (mibEntity -> { diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/EntitlementPoolConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/EntitlementPoolConvertor.java index 4c667f6708..c8037cecf4 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/EntitlementPoolConvertor.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/EntitlementPoolConvertor.java @@ -84,7 +84,6 @@ public class EntitlementPoolConvertor { info.addProperty("EntitlementTime", entitlementPool.getTime()); info.addProperty("manufacturerReferenceNumber", entitlementPool.getManufacturerReferenceNumber()); - return info; } diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/FeatureGroupConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/FeatureGroupConvertor.java index dd3fbe0485..eac5ce64ea 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/FeatureGroupConvertor.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/FeatureGroupConvertor.java @@ -90,6 +90,8 @@ public class FeatureGroupConvertor { info.setName(featureGroup.getName()); info.setDescription(featureGroup.getDescription()); info.addProperty("partNumber", featureGroup.getPartNumber()); + info.addProperty("manufacturerReferenceNumber", featureGroup.getManufacturerReferenceNumber()); + return info; } diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/MibConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/MibConvertor.java index 88b9dce95f..f145e51f02 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/MibConvertor.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/MibConvertor.java @@ -8,9 +8,8 @@ import org.openecomp.core.migration.MigrationMain; import org.openecomp.core.migration.store.ElementHandler; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; -import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.ElementType; import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.MibEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity; import java.util.HashSet; import java.util.List; @@ -22,45 +21,57 @@ public class MibConvertor { private static Set<String> compMibLoaded = new HashSet<>(); - public static CollaborationElement[] convertMibToElement(MibEntity mibEntity) { + public static CollaborationElement[] convertMibToElement( + ComponentMonitoringUploadEntity componentMonitoringUploadEntity) { CollaborationElement[] elements; - List<String> mibNamespace = getMibNamespace(mibEntity); + List<String> mibNamespace = getMibNamespace(componentMonitoringUploadEntity); int index = 0; - String mibsEntityId = StructureElement.Mibs.name() + "_" + mibEntity.getComponentId(); + String mibsEntityId = + StructureElement.Mibs.name() + "_" + componentMonitoringUploadEntity.getComponentId(); if (compMibLoaded.contains(mibsEntityId)) { elements = new CollaborationElement[1]; } else { compMibLoaded.add(mibsEntityId); elements = new CollaborationElement[2]; elements[index++] = ElementHandler.getElementEntity( - mibEntity.getVspId(), mibEntity.getVersion().toString(), mibsEntityId, mibNamespace, + componentMonitoringUploadEntity.getVspId(), + componentMonitoringUploadEntity.getVersion().toString(), mibsEntityId, mibNamespace, ElementHandler.getStructuralElementInfo(StructureElement.Mibs.name()), null, null, null); } mibNamespace.add(mibsEntityId); elements[index] = ElementHandler.getElementEntity( - mibEntity.getVspId(), mibEntity.getVersion().toString(), mibEntity.getId(), mibNamespace, - getMibInfo(mibEntity), null, null, mibEntity.getArtifact().array()); + componentMonitoringUploadEntity.getVspId(), + componentMonitoringUploadEntity.getVersion().toString(), componentMonitoringUploadEntity + .getId(), mibNamespace, + getMibInfo(componentMonitoringUploadEntity), null, null, componentMonitoringUploadEntity + .getArtifact().array()); return elements; } - private static Info getMibInfo(MibEntity mibEntity) { + private static Info getMibInfo( + ComponentMonitoringUploadEntity componentMonitoringUploadEntity) { Info info = new Info(); - info.setName(mibEntity.getType().toString()); - info.getProperties().put("name", mibEntity.getArtifactName()); + info.setName(componentMonitoringUploadEntity.getType().toString()); + info.getProperties().put("name", componentMonitoringUploadEntity.getArtifactName()); return info; } - private static List<String> getMibNamespace(MibEntity mibEntity) { - return ElementHandler.getElementPath(StructureElement.Components.name(), mibEntity + private static List<String> getMibNamespace( + ComponentMonitoringUploadEntity componentMonitoringUploadEntity) { + return ElementHandler + .getElementPath(StructureElement.Components.name(), componentMonitoringUploadEntity .getComponentId()); } - public static ElementEntityContext convertMibToElementContext(MibEntity mibEntity) { + public static ElementEntityContext convertMibToElementContext( + ComponentMonitoringUploadEntity componentMonitoringUploadEntity) { return new ElementEntityContext("GLOBAL_USER", new - ElementContext(mibEntity.getVspId(), mibEntity.getVersion().toString())); + ElementContext(componentMonitoringUploadEntity.getVspId(), + componentMonitoringUploadEntity + .getVersion().toString())); } } diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceTemplateConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceTemplateConvertor.java index 3854b32366..a767246f12 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceTemplateConvertor.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceTemplateConvertor.java @@ -9,9 +9,7 @@ import org.openecomp.core.model.types.ServiceTemplate; import org.openecomp.core.utilities.file.FileUtils; import org.openecomp.sdc.model.impl.zusammen.ElementType; import org.openecomp.sdc.model.impl.zusammen.StructureElement; -import org.openecomp.sdc.tosca.services.yamlutil.ToscaExtensionYamlUtil; -import java.io.ByteArrayInputStream; import java.util.HashSet; import java.util.List; import java.util.Set; diff --git a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/MibCassandraLoader.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/MibCassandraLoader.java index fdb534df32..b93033cc72 100644 --- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/MibCassandraLoader.java +++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/MibCassandraLoader.java @@ -25,7 +25,7 @@ import com.datastax.driver.mapping.annotations.Accessor; import com.datastax.driver.mapping.annotations.Query; import org.openecomp.core.nosqldb.api.NoSqlDb; import org.openecomp.core.nosqldb.factory.NoSqlDbFactory; -import org.openecomp.sdc.vendorsoftwareproduct.dao.type.MibEntity; +import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity; import java.util.Collection; @@ -36,7 +36,7 @@ public class MibCassandraLoader { noSqlDb.getMappingManager().createAccessor(MibAccessor.class); - public Collection<MibEntity> list() { + public Collection<ComponentMonitoringUploadEntity> list() { return accessor.list().all(); } @@ -45,7 +45,7 @@ public class MibCassandraLoader { @Query( "select * from vsp_component_artifact") - Result<MibEntity> list(); + Result<ComponentMonitoringUploadEntity> list(); } diff --git a/openecomp-be/tools/swagger-ui/assembly/swagger.xml b/openecomp-be/tools/swagger-ui/assembly/swagger.xml index b88714254f..37911dc627 100644 --- a/openecomp-be/tools/swagger-ui/assembly/swagger.xml +++ b/openecomp-be/tools/swagger-ui/assembly/swagger.xml @@ -74,4 +74,4 @@ </includes> </fileSet> </fileSets> -</assembly> +</assembly>
\ No newline at end of file diff --git a/openecomp-be/tools/swagger-ui/pom.xml b/openecomp-be/tools/swagger-ui/pom.xml index 4a354624ee..dec3d8b363 100644 --- a/openecomp-be/tools/swagger-ui/pom.xml +++ b/openecomp-be/tools/swagger-ui/pom.xml @@ -91,7 +91,7 @@ <descriptor>assembly/swagger.xml</descriptor> <finalName>${plugin.name}</finalName> <outputDirectory>${package.dir}</outputDirectory> - <appendAssemblyId>false</appendAssemblyId> + <appendAssemblyId>false</appendAssemblyId> </configuration> <executions> <execution> diff --git a/openecomp-be/tools/zusammen-tools/pom.xml b/openecomp-be/tools/zusammen-tools/pom.xml index 57f3250a5c..0289de6d8a 100644 --- a/openecomp-be/tools/zusammen-tools/pom.xml +++ b/openecomp-be/tools/zusammen-tools/pom.xml @@ -47,12 +47,12 @@ <dependency> <groupId>com.amdocs.zusammen.plugin</groupId> <artifactId>zusammen-state-store-cassandra-plugin</artifactId> - <version>0.0.1</version> + <version>${zusammen.version}</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> - <version>RELEASE</version> + <version>${hibernate.validator.version}</version> </dependency> <dependency> <groupId>org.openecomp.sdc</groupId> @@ -62,7 +62,7 @@ </dependencies> <artifactId>openecomp-zusammen-tools</artifactId> <groupId>org.openecomp.sdc.core.tools</groupId> - <version>1.0-SNAPSHOT</version> + <version>1.1.0-SNAPSHOT</version> <parent> <groupId>org.openecomp.sdc</groupId> <artifactId>openecomp-sdc-lib</artifactId> diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ResetOldVersion.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ResetOldVersion.java index 527efa5fc6..7058c57e85 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ResetOldVersion.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ResetOldVersion.java @@ -18,7 +18,8 @@ public class ResetOldVersion { public static Map<String, List<String>> itemVersionMap = new HashMap<>(); - public static void reset(SessionContext context, String oldVersion) { + public static int count =0; + public static void reset(SessionContext context, String oldVersion,String emptyOldVersion) { @@ -30,7 +31,8 @@ public class ResetOldVersion { VspGeneralLoader.load(context, itemVersionMap); - generalElementMap.values().forEach(elementEntity -> updateOldVersionFlag(elementEntity,oldVersion)); + generalElementMap.values().forEach(elementEntity -> updateOldVersionFlag(elementEntity, + oldVersion,"true".equals(emptyOldVersion))); itemVersionMap.entrySet().forEach(entry->entry.getValue().stream().filter @@ -38,10 +40,24 @@ public class ResetOldVersion { +"_"+version)).forEach(version->ElementHandler.update(context, entry.getKey(),version,generalElementMap.get(context.getUser().getUserName()+"_"+entry.getKey() +"_"+version)))); + + System.out.println("nymber of element updated:"+count); + } - private static void updateOldVersionFlag(ElementEntity elementEntity, String oldVersion) { - elementEntity.getInfo().addProperty("oldVersion",oldVersion); + private static void updateOldVersionFlag(ElementEntity elementEntity, String oldVersion, + boolean emptyOldVersion) { + + if(!emptyOldVersion){ + elementEntity.getInfo().addProperty("oldVersion",oldVersion); + count++; + }else if(elementEntity.getInfo().getProperty("oldVersion")== null || "" + .equals(elementEntity.getInfo().getProperty("oldVersion"))){ + elementEntity.getInfo().addProperty("oldVersion",oldVersion); + count++; + } + + } diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/main/ZusammenMainTool.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/main/ZusammenMainTool.java index 926566864f..6f092d2f56 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/main/ZusammenMainTool.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/main/ZusammenMainTool.java @@ -38,7 +38,7 @@ public class ZusammenMainTool { switch (COMMANDS.valueOf(command)){ case RESET_OLD_VERSION: - ResetOldVersion.reset(context,ToolsUtil.getParam("v",args)); + ResetOldVersion.reset(context,ToolsUtil.getParam("v",args),ToolsUtil.getParam("n",args)); break; case EXPORT: ExportDataCommand.exportData(context,ToolsUtil.getParam("i",args)); diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VspGeneralLoader.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VspGeneralLoader.java index 54a3dd9ada..b5d09daf3f 100644 --- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VspGeneralLoader.java +++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VspGeneralLoader.java @@ -5,7 +5,6 @@ import com.amdocs.zusammen.datatypes.SessionContext; import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext; import org.openecomp.core.zusammen.plugin.dao.impl.CassandraElementRepository; import org.openecomp.core.zusammen.plugin.dao.types.ElementEntity; -import org.openecomp.sdc.vendorsoftwareproduct.dao.impl.zusammen.StructureElement; import java.util.HashMap; import java.util.List; @@ -13,28 +12,84 @@ import java.util.Map; import java.util.Optional; public class VspGeneralLoader { + private static CassandraElementRepository cassandraElementRepository = + new CassandraElementRepository(); + public static Map<String, ElementEntity> load(SessionContext context, Map<String, List<String>> vspItemVersionsMap) { Map<String, ElementEntity> elementEntityMap = new HashMap<>(); System.setProperty("cassandra.dox.keystore", "zusammen_dox"); - CassandraElementRepository cassandraElementRepository = new CassandraElementRepository(); + + Id entityId; + Id itemId; + Id versionId; for (Map.Entry<String, List<String>> entry : vspItemVersionsMap.entrySet()) { for (String version : entry.getValue()) { - Optional<ElementEntity> result = - cassandraElementRepository.get(context, new ElementEntityContext( - context.getUser().getUserName(), - new Id(entry.getKey()), - new Id(version)), - new ElementEntity(new Id(StructureElement.General.name()))); - if (result.isPresent()) { - elementEntityMap.put(context.getUser().getUserName() + "_" + entry.getKey() - + "_" + version, result.get()); + + itemId = new Id(entry.getKey()); + versionId = new Id(version); + entityId = getEntityIdByInfoNameValue(context, itemId, versionId, null, "name", + "General"); + if (entityId != null) { + Optional<ElementEntity> result = + cassandraElementRepository.get(context, new ElementEntityContext( + context.getUser().getUserName(), + itemId, + versionId), + new ElementEntity(entityId)); + if (result.isPresent()) { + elementEntityMap.put(context.getUser().getUserName() + "_" + entry.getKey() + + "_" + version, result.get()); + } } } } return elementEntityMap; } + + private static Id getEntityIdByInfoNameValue(SessionContext context, Id itemId, Id versionId, + Id elementId, String + name, String value) { + + Id id; + Optional<ElementEntity> result = + cassandraElementRepository.get(context, new ElementEntityContext( + context.getUser().getUserName(), + itemId, + versionId), + new ElementEntity(Id.ZERO)); + if (result.isPresent()) { + ElementEntity elementEntity = result.get(); + return elementEntity.getSubElementIds().stream().filter(subelementId -> { + Optional<ElementEntity> subElementEntity = + cassandraElementRepository.get(context, new ElementEntityContext( + context.getUser().getUserName(), + itemId, + versionId), + new ElementEntity(subelementId)); + if (subElementEntity.isPresent()) { + if("name".equals(name)){ + if(value.equals(subElementEntity.get().getInfo().getName())){ + return true; + } + } + if (value.equals(subElementEntity.get().getInfo().getProperty(name))) { + return true; + } + } + return false; + + }).findFirst().orElse(null); + } + return null; + + + + + + + } } |