aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/tools
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/tools')
-rw-r--r--openecomp-be/tools/build/scripts/cassandra-commands.json8
-rw-r--r--openecomp-be/tools/install/database/schemaTemplates/composition/component.ftl8
-rw-r--r--openecomp-be/tools/install/database/schemaTemplates/composition/compute.ftl17
-rw-r--r--openecomp-be/tools/install/database/schemaTemplates/composition/deployment.ftl39
-rw-r--r--openecomp-be/tools/install/database/schemaTemplates/composition/image.ftl13
-rw-r--r--openecomp-be/tools/install/database/schemaTemplates/composition/nic.ftl28
-rw-r--r--openecomp-be/tools/install/database/schemaTemplates/questionnaire/component.ftl85
-rw-r--r--openecomp-be/tools/install/database/schemaTemplates/questionnaire/compute.ftl54
-rw-r--r--openecomp-be/tools/install/database/schemaTemplates/questionnaire/image.ftl22
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/pom.xml4
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/MigrationMain.java4
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/EntitlementPoolConvertor.java1
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/FeatureGroupConvertor.java2
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/MibConvertor.java41
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspInformationConvertor.java37
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspServiceTemplateConvertor.java2
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/MibCassandraLoader.java6
-rw-r--r--openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/resources/logback.xml283
-rw-r--r--openecomp-be/tools/migration/cassandra2zusammen.sh8
-rw-r--r--openecomp-be/tools/swagger-ui/assembly/swagger.xml1
-rw-r--r--openecomp-be/tools/swagger-ui/pom.xml1
-rw-r--r--openecomp-be/tools/zusammen-tools/pom.xml246
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/assembly/zusammen-tools-lib-assembly.xml39
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java62
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ImportCommand.java43
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ResetOldVersion.java91
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java100
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ImportProperties.java20
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java62
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java74
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java116
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java42
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java51
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionImport.java41
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionInfoImport.java41
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/loaders/VersionInfoCassandraLoader.java53
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/loaders/zusammen/VspGeneralLoader.java40
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/loaders/zusammen/VspItemLoader.java4
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/main/ZusammenMainTool.java80
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/ElementCassandraLoader.java74
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/ElementHandler.java26
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/ElementNamespaceHandler.java27
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VersionCassandraLoader.java78
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VersionInfoCassandraLoader.java62
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VspGeneralLoader.java95
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/zusammen/datatypes/ElementEntity.java168
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/zusammen/datatypes/VersionEntity.java128
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ToolsUtil.java14
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/Utils.java15
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ZipUtils.java89
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/resources/logback.xml282
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/resources/zusammenMainTool.sh14
52 files changed, 2552 insertions, 389 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/VspInformationConvertor.java b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspInformationConvertor.java
index b7a1d42386..59fba5f066 100644
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspInformationConvertor.java
+++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/convertors/VspInformationConvertor.java
@@ -55,13 +55,21 @@ public class VspInformationConvertor {
public static CollaborationElement[] convertVspToElement(VspInformation vspInformation) {
- CollaborationElement[] vspElements = new CollaborationElement[4];
+ CollaborationElement[] vspElements;
+ if(vspInformation.getQuestionnaireData() == null){
+ vspElements = new CollaborationElement[4];
+ }else{
+ vspElements = new CollaborationElement[5];
+ }
+
+ int index=0;
+
List<String> vspNamespace = getVspNamespace(vspInformation);
String vspEntityId = StructureElement.General.name();
- vspElements[0] = ElementHandler.getElementEntity(
+ vspElements[index] = ElementHandler.getElementEntity(
vspInformation.getId(), vspInformation.getVersion().toString(),
vspEntityId,
vspNamespace,
@@ -70,8 +78,9 @@ public class VspInformationConvertor {
null,
null);
+ index++;
String vspOrchestrationTemplateEntityId = StructureElement.OrchestrationTemplate.name();
- vspElements[1] = ElementHandler.getElementEntity(
+ vspElements[index] = ElementHandler.getElementEntity(
vspInformation.getId(), vspInformation.getVersion().toString(),
vspOrchestrationTemplateEntityId,
vspNamespace,
@@ -80,11 +89,23 @@ public class VspInformationConvertor {
null,
null);
-
+ if(vspInformation.getQuestionnaireData()!= null) {
+ index++;
+ String vspQuestionnaireEntityId = StructureElement.Questionnaire.name();
+ vspElements[index] = ElementHandler.getElementEntity(
+ vspInformation.getId(), vspInformation.getVersion().toString(),
+ vspQuestionnaireEntityId,
+ vspNamespace,
+ ElementHandler.getStructuralElementInfo(vspQuestionnaireEntityId),
+ null,
+ null,
+ vspInformation.getQuestionnaireData().getBytes() != null ? vspInformation
+ .getQuestionnaireData().getBytes() : null);
+ }
vspNamespace.add(vspOrchestrationTemplateEntityId);
-
+ index++;
String vspOrchestrationTemplateValidationDataEntityId = StructureElement.OrchestrationTemplateValidationData.name();
- vspElements[2] = ElementHandler.getElementEntity(
+ vspElements[index] = ElementHandler.getElementEntity(
vspInformation.getId(), vspInformation.getVersion().toString(),
vspOrchestrationTemplateValidationDataEntityId,
vspNamespace,
@@ -93,9 +114,9 @@ public class VspInformationConvertor {
null,
vspInformation.getValidationData()!= null?vspInformation.getValidationData().getBytes()
:null);
-
+ index++;
String vspOrchestrationTemplateContentEntityId = StructureElement.OrchestrationTemplateContent.name();
- vspElements[3] = ElementHandler.getElementEntity(
+ vspElements[index] = ElementHandler.getElementEntity(
vspInformation.getId(), vspInformation.getVersion().toString(),
vspOrchestrationTemplateContentEntityId,
vspNamespace,
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/migration/1702_to_1707_zusammen/src/main/resources/logback.xml b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/resources/logback.xml
index b1c1335302..9c9c06c216 100644
--- a/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/resources/logback.xml
+++ b/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/resources/logback.xml
@@ -1,282 +1,15 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<configuration scan="true" scanPeriod="5 seconds">
+<configuration>
- <property scope="system" name="ECOMP-component-name" value="ASDC" />
- <property scope="system" name="ECOMP-subcomponent-name" value="ASDC-BE" />
- <property file="${config.home}/catalog-be/configuration.yaml" />
- <property scope="context" name="enable-all-log" value="false" />
-
- <!--statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />
- <include resource="asdc_debug_logback.xml"/-->
-
- <!-- value used by pattern field list (| - is inter-field separator, || - unavailable or not applicable field value) (m - mandatory, o- optional)-->
- <!--timestamp(m)| requestID(m)| serviceInstanceID(o)| threadID(m)| physicalServerName(o)| serviceName(m)| userID(m)| logLevel(m)| severity(o)| serverIpAddress(m)| serverName(m)| clientIpAddress(o)| className(m)| timer(o)| detailedMessage(o)-->
- <property name="default-log-pattern"
- value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{uuid}|%X{serviceInstanceID}|%thread||${ECOMP-subcomponent-name}|%X{userId}|%level|%X{alarmSeverity}|%X{localAddr}|${beFqdn}|%X{remoteAddr}|%logger{35}|%X{timer}|ActivityType=&lt;%M&gt;, Desc=&lt;%msg&gt;%n" />
-
- <property name="asdc-debug-log-pattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%msg %n"/>
-
- <!-- All log -->
- <if condition='property("enable-all-log").equalsIgnoreCase("true")'>
- <then>
- <appender name="ALL_ROLLING"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/all.log
- </file>
-
- <rollingPolicy
- class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/all.log.%i
- </fileNamePattern>
- <minIndex>1</minIndex>
- <maxIndex>10</maxIndex>
- </rollingPolicy>
-
- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>20MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>${default-log-pattern}</pattern>
- </encoder>
- </appender>
-
- <appender name="ASYNC_ALL" class="ch.qos.logback.classic.AsyncAppender">
- <appender-ref ref="ALL_ROLLING" />
- </appender>
- </then>
- </if>
-
- <!-- Error log -->
- <appender name="ERROR_ROLLING"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/Error.log
- </file>
-
- <!-- Audit messages filter - deny audit messages -->
- <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
- <marker>AUDIT_MARKER</marker>
- </evaluator>
- <onMismatch>NEUTRAL</onMismatch>
- <onMatch>DENY</onMatch>
- </filter>
-
- <!-- Transaction messages filter - deny Transaction messages -->
- <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
- <marker>TRANSACTION_MARKER</marker>
- </evaluator>
- <onMismatch>NEUTRAL</onMismatch>
- <onMatch>DENY</onMatch>
- </filter>
-
- <!-- deny all events with a level below INFO, that is TRACE and DEBUG -->
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>INFO</level>
- </filter>
-
- <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/Error.log.%i
- </fileNamePattern>
- <minIndex>1</minIndex>
- <maxIndex>10</maxIndex>
- </rollingPolicy>
-
- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>20MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>${default-log-pattern}</pattern>
- </encoder>
- </appender>
-
- <!-- Debug log -->
- <appender name="DEBUG_ROLLING"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/debug.log
- </file>
-
- <!-- No need to deny audit messages - they are INFO only, will be denied
- anyway -->
- <!-- Transaction messages filter - deny Transaction messages, there are
- some DEBUG level messages among them -->
- <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
- <marker>TRANSACTION_MARKER</marker>
- </evaluator>
- <onMismatch>NEUTRAL</onMismatch>
- <onMatch>DENY</onMatch>
- </filter>
-
- <!-- accept DEBUG and TRACE level -->
- <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.GEventEvaluator">
- <expression>
- e.level.toInt() &lt;= DEBUG.toInt()
- </expression>
- </evaluator>
- <OnMismatch>DENY</OnMismatch>
- <OnMatch>NEUTRAL</OnMatch>
- </filter>
-
- <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/debug.log.%i
- </fileNamePattern>
- <minIndex>1</minIndex>
- <maxIndex>10</maxIndex>
- </rollingPolicy>
-
- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>20MB</maxFileSize>
- </triggeringPolicy>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <!-- encoders are assigned the type
+ ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
- <pattern>${default-log-pattern}</pattern>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
- <!-- Debug log -->
- <appender name="MIGRATION_DEBUG_ROLLING"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/cassandra2zusammen_migration_debug.log
- </file>
-
- <!-- No need to deny audit messages - they are INFO only, will be denied
- anyway -->
- <!-- Transaction messages filter - deny Transaction messages, there are
- some DEBUG level messages among them -->
- <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
- <marker>TRANSACTION_MARKER</marker>
- </evaluator>
- <onMismatch>NEUTRAL</onMismatch>
- <onMatch>DENY</onMatch>
- </filter>
-
- <!-- accept DEBUG and TRACE level -->
- <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.GEventEvaluator">
- <expression>
- e.level.toInt() &lt;= DEBUG.toInt()
- </expression>
- </evaluator>
- <OnMismatch>DENY</OnMismatch>
- <OnMatch>NEUTRAL</OnMatch>
- </filter>
-
- <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/debug_by_package.log.%i
- </fileNamePattern>
- <minIndex>1</minIndex>
- <maxIndex>10</maxIndex>
- </rollingPolicy>
-
- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>20MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>${asdc-debug-log-pattern}</pattern>
- </encoder>
- </appender>
-
- <!-- Audit log -->
- <appender name="AUDIT_ROLLING"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
-
- <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/audit.log
- </file>
-
- <!-- Audit messages filter - accept audit messages -->
- <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
- <marker>AUDIT_MARKER</marker>
- </evaluator>
- <onMismatch>DENY</onMismatch>
- <onMatch>ACCEPT</onMatch>
- </filter>
-
- <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/audit.log.%i
- </fileNamePattern>
- <minIndex>1</minIndex>
- <maxIndex>10</maxIndex>
- </rollingPolicy>
-
- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>20MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>${default-log-pattern}</pattern>
- </encoder>
- </appender>
-
- <!-- SdncTransaction log -->
- <appender name="TRANSACTION_ROLLING"
- class="ch.qos.logback.core.rolling.RollingFileAppender">
-
- <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/transaction.log
- </file>
-
- <!-- Transaction messages filter - accept audit messages -->
- <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
- <marker>TRANSACTION_MARKER</marker>
- </evaluator>
- <onMismatch>DENY</onMismatch>
- <onMatch>ACCEPT</onMatch>
- </filter>
-
- <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
- <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/transaction.log.%i
- </fileNamePattern>
- <minIndex>1</minIndex>
- <maxIndex>10</maxIndex>
- </rollingPolicy>
-
- <triggeringPolicy
- class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
- <maxFileSize>20MB</maxFileSize>
- </triggeringPolicy>
- <encoder>
- <pattern>${default-log-pattern}</pattern>
- </encoder>
- </appender>
-
- <!-- Asynchronicity Configurations -->
- <appender name="ASYNC_DEBUG" class="ch.qos.logback.classic.AsyncAppender">
- <appender-ref ref="DEBUG_ROLLING" />
- </appender>
-
- <appender name="ASYNC_TRANSACTION" class="ch.qos.logback.classic.AsyncAppender">
- <appender-ref ref="TRANSACTION_ROLLING" />
- </appender>
-
- <appender name="ASYNC_ERROR" class="ch.qos.logback.classic.AsyncAppender">
- <appender-ref ref="ERROR_ROLLING" />
- </appender>
-
-
- <root level="INFO">
- <appender-ref ref="ASYNC_ERROR" />
- <appender-ref ref="ASYNC_DEBUG" />
- <appender-ref ref="AUDIT_ROLLING" />
- <appender-ref ref="ASYNC_TRANSACTION" />
- <if condition='property("enable-all-log").equalsIgnoreCase("true")'>
- <then>
- <appender-ref ref="ALL_ROLLING" />
- </then>
- </if>
+ <root level="warn">
+ <appender-ref ref="STDOUT"/>
</root>
- <logger name="org.openecomp.sdc" level="INFO" />
-
- <logger name="org.openecomp.core" level="DEBUG" additivity="false">
- <appender-ref ref="MIGRATION_DEBUG_ROLLING" />
- </logger>
-</configuration>
-
-
+</configuration> \ No newline at end of file
diff --git a/openecomp-be/tools/migration/cassandra2zusammen.sh b/openecomp-be/tools/migration/cassandra2zusammen.sh
index 4765fc3684..6ef90ad3bf 100644
--- a/openecomp-be/tools/migration/cassandra2zusammen.sh
+++ b/openecomp-be/tools/migration/cassandra2zusammen.sh
@@ -3,8 +3,7 @@
###########################################################################################################
# script name - cassandra2zusammen.sh
# run script - ./cassandra2zusammen.sh
-# This script migrates ASDC 1st class citizen entities and their sub-entities from Cassandra to
-# Zusammen.
+# This script migrates ASDC 1st class citizen entities and their sub-entities from Cassandra to Zusammen.
# This script should be run when upgrading from 1702 to 1707
###########################################################################################################
@@ -12,6 +11,5 @@
# change exist package and service templates in db
java -Dlog.home=/apps/jetty/base/be/logs -Dconfiguration.yaml=/apps/jetty/base/be/config/catalog-be/configuration.yaml -jar openecomp-zusammen-migration-1.0-SNAPSHOT.jar org.openecomp.core.migration.MigrationMain
-STATUS="${?}" echo "${STATUS}" echo "All log messages for the Cassandra2Zusammen
-migration process are in /apps/jetty/base/be/logs/ASDC/ASDC-
-BE/cassandra2zusammen_migration_debug.log"
+STATUS="${?}"
+echo "${STATUS}"
diff --git a/openecomp-be/tools/swagger-ui/assembly/swagger.xml b/openecomp-be/tools/swagger-ui/assembly/swagger.xml
index 769cc64840..37911dc627 100644
--- a/openecomp-be/tools/swagger-ui/assembly/swagger.xml
+++ b/openecomp-be/tools/swagger-ui/assembly/swagger.xml
@@ -2,6 +2,7 @@
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>bin</id>
<formats>
<format>war</format>
</formats>
diff --git a/openecomp-be/tools/swagger-ui/pom.xml b/openecomp-be/tools/swagger-ui/pom.xml
index b2b608cd3a..dec3d8b363 100644
--- a/openecomp-be/tools/swagger-ui/pom.xml
+++ b/openecomp-be/tools/swagger-ui/pom.xml
@@ -91,6 +91,7 @@
<descriptor>assembly/swagger.xml</descriptor>
<finalName>${plugin.name}</finalName>
<outputDirectory>${package.dir}</outputDirectory>
+ <appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
diff --git a/openecomp-be/tools/zusammen-tools/pom.xml b/openecomp-be/tools/zusammen-tools/pom.xml
new file mode 100644
index 0000000000..0289de6d8a
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/pom.xml
@@ -0,0 +1,246 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <properties>
+
+ <groovy.version>2.4.7</groovy.version>
+ <janino.version>2.7.7</janino.version>
+
+ </properties>
+
+
+
+ <name>openecomp-zusammen-tools</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-vendor-software-product-api</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <artifactId>openecomp-zusammen-plugin</artifactId>
+ <groupId>org.openecomp.sdc.core</groupId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-vendor-software-product-core</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-vendor-license-api</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-model-impl</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc.core</groupId>
+ <artifactId>openecomp-zusammen-core</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.amdocs.zusammen.plugin</groupId>
+ <artifactId>zusammen-state-store-cassandra-plugin</artifactId>
+ <version>${zusammen.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>${hibernate.validator.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-vendor-license-core</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+ <artifactId>openecomp-zusammen-tools</artifactId>
+ <groupId>org.openecomp.sdc.core.tools</groupId>
+ <version>1.1.0-SNAPSHOT</version>
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-lib</artifactId>
+ <relativePath>../../lib</relativePath>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <!--parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent-->
+ <build>
+ <plugins>
+
+ <!-- ================================================== -->
+ <!-- Set the JDK compiler version. -->
+ <!-- ================================================== -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.5.1</version>
+ <inherited>true</inherited>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>license-maven-plugin</artifactId>
+ <version>1.10</version>
+ <configuration>
+ <addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage>
+ <processStartTag>
+ ============LICENSE_START=======================================================
+ </processStartTag>
+ <processEndTag>
+ ============LICENSE_END=========================================================
+ </processEndTag>
+ <sectionDelimiter>
+ ================================================================================
+ </sectionDelimiter>
+ <licenseName>apache_v2</licenseName>
+ <inceptionYear>2017</inceptionYear>
+ <organizationName>AT&amp;T Intellectual Property. All rights reserved.
+ </organizationName>
+ <projectName>SDC</projectName>
+ <canUpdateCopyright>true</canUpdateCopyright>
+ <canUpdateDescription>true</canUpdateDescription>
+ <canUpdateLicense>true</canUpdateLicense>
+ <emptyLineAfterHeader>true</emptyLineAfterHeader>
+ <verbose>false</verbose>
+ <includes>
+ <include>**/*.java</include>
+ <include>**/*.js</include>
+ <include>**/*.ts</include>
+ </includes>
+ <roots>
+ <root>src</root>
+ <root>app</root>
+ <root>server-mock</root>
+ <root>typings</root>
+ </roots>
+ </configuration>
+ <executions>
+ <execution>
+ <id>first</id>
+ <goals>
+ <goal>update-file-header</goal>
+ </goals>
+ <!--phase>process-sources</phase-->
+ </execution>
+ </executions>
+ </plugin>
+
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.8</version>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <phase>install</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/lib</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>false</overWriteSnapshots>
+ <overWriteIfNewer>true</overWriteIfNewer>
+ <!--includeScope>runtime</includeScope-->
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.4</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ <classpathLayoutType>custom</classpathLayoutType>
+ <customClasspathLayout>
+ lib/${artifact.artifactId}-${baseVersion}.${artifact.extension}
+ </customClasspathLayout>
+ <mainClass>org.openecomp.core.tools.main.ZusammenMainTool
+ </mainClass>
+ </manifest>
+ <manifestEntries>
+ <Class-Path>lib/</Class-Path>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.19.1</version>
+ <configuration>
+ <useSystemClassLoader>false</useSystemClassLoader>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ </configuration>
+ </plugin>
+
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>ant-test</id>
+ <phase>package</phase>
+ <configuration>
+ <tasks>
+ <fixcrlf srcdir="./" eol="unix"
+ includes="zusammenMainTool.sh"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>Generate assembly</id>
+ <phase>install</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <descriptors>
+ <descriptor>${basedir}/src/main/assembly/zusammen-tools-lib-assembly.xml
+ </descriptor>
+ </descriptors>
+ <appendAssemblyId>false</appendAssemblyId>
+ <finalName>openecomp-zusammen-tools-lib</finalName>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/tools/zusammen-tools/src/main/assembly/zusammen-tools-lib-assembly.xml b/openecomp-be/tools/zusammen-tools/src/main/assembly/zusammen-tools-lib-assembly.xml
new file mode 100644
index 0000000000..923115ee5d
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/assembly/zusammen-tools-lib-assembly.xml
@@ -0,0 +1,39 @@
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+ <id>tools</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <files>
+ <file>
+ <source>src/main/resources/zusammenMainTool.sh</source>
+ </file>
+ </files>
+
+ <fileSets>
+ <fileSet>
+ <includes>
+ <include>zusammenMainTool.sh</include>
+ </includes>
+ <fileMode>0755</fileMode>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/target</directory>
+ <includes>
+ <include>
+ openecomp-zusammen*.jar
+ </include>
+ </includes>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/target/lib</directory>
+ <outputDirectory>/lib</outputDirectory>
+ </fileSet>
+ </fileSets>
+</assembly>
+
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java
new file mode 100644
index 0000000000..b92ba52000
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ExportDataCommand.java
@@ -0,0 +1,62 @@
+package org.openecomp.core.tools.Commands;
+
+import com.amdocs.zusammen.datatypes.SessionContext;
+import org.apache.commons.io.FileUtils;
+import org.openecomp.core.tools.Commands.exportdata.ElementHandler;
+import org.openecomp.core.tools.Commands.exportdata.ImportProperties;
+import org.openecomp.core.tools.Commands.exportdata.ItemHandler;
+import org.openecomp.core.tools.Commands.exportdata.VersionHandler;
+import org.openecomp.core.tools.util.ZipUtils;
+import org.openecomp.core.zusammen.impl.CassandraConnectionInitializer;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+import static java.nio.file.Files.createDirectories;
+public class ExportDataCommand {
+ private static final Logger logger = LoggerFactory.getLogger(ExportDataCommand.class);
+
+ public static void exportData(SessionContext context, String filterItem) {
+ try {
+ ImportProperties.initParams();
+ CassandraConnectionInitializer.setCassandraConnectionPropertiesToSystem();
+ Path rootDir = Paths.get(ImportProperties.ROOT_DIRECTORY);
+ initDir(rootDir);
+ if (filterItem != null) {
+ filterItem = filterItem.replaceAll("\\r", "");
+ }
+ new ItemHandler().createItemsData(context, filterItem);
+ new VersionHandler().loadVersions(filterItem);
+ new ElementHandler().loadElements(filterItem);
+ zipPath(rootDir,filterItem);
+ FileUtils.forceDelete(rootDir.toFile());
+ } catch (Exception ex) {
+ logger.error(ex.getMessage(), ex);
+ ex.printStackTrace();
+ }
+
+ }
+ private static void zipPath(Path rootDir,String filterItem ) throws Exception{
+ LocalDateTime date = LocalDateTime.now();
+ DateTimeFormatter formatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME;
+ String dateStr = date.format(formatter);
+ String zipFile = System.getProperty("user.home")+ File.separatorChar+"onboarding_import"+ dateStr + ".zip";
+ ZipUtils.createZip(zipFile, rootDir,filterItem);
+ }
+
+
+ public static void initDir(Path rootDir ) throws IOException{
+ if (Files.exists(rootDir)) {
+ FileUtils.forceDelete(rootDir.toFile());
+ }
+ createDirectories(rootDir);
+ }
+
+} \ No newline at end of file
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ImportCommand.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ImportCommand.java
new file mode 100644
index 0000000000..57486b81e3
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ImportCommand.java
@@ -0,0 +1,43 @@
+package org.openecomp.core.tools.Commands;
+
+import com.amdocs.zusammen.datatypes.SessionContext;
+import org.apache.commons.io.FileUtils;
+import org.openecomp.core.tools.Commands.importdata.TreeWalker;
+import org.openecomp.core.tools.Commands.exportdata.ImportProperties;
+import org.openecomp.core.tools.util.ZipUtils;
+import org.openecomp.core.zusammen.impl.CassandraConnectionInitializer;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public class ImportCommand {
+
+ private static final Logger logger = LoggerFactory.getLogger(ImportCommand.class);
+
+
+ public static void importData(SessionContext context, String zippedFile, String filterItem) {
+ try {
+ ImportProperties.initParams();
+ CassandraConnectionInitializer.setCassandraConnectionPropertiesToSystem();
+ if (zippedFile == null){
+ logger.error("Import must have a valid file as an input.");
+ }
+ zippedFile = zippedFile.replaceAll("\\r", "");
+ if(filterItem != null) {
+ filterItem = filterItem.replaceAll("\\r", "");
+ }
+ Path rootDir = Paths.get(ImportProperties.ROOT_DIRECTORY);
+ ExportDataCommand.initDir(rootDir);
+ ZipUtils.unzip(Paths.get(zippedFile), rootDir);
+ TreeWalker.walkFiles(context, rootDir, filterItem);
+
+ FileUtils.forceDelete(rootDir.toFile()); // clear all unzip data at the end.
+ } catch (Exception ex) {
+ logger.error(ex.getMessage(), ex);
+ ex.printStackTrace();
+ }
+ }
+
+}
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
new file mode 100644
index 0000000000..7058c57e85
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/ResetOldVersion.java
@@ -0,0 +1,91 @@
+package org.openecomp.core.tools.Commands;
+
+import com.amdocs.zusammen.datatypes.Id;
+import com.amdocs.zusammen.datatypes.SessionContext;
+import com.amdocs.zusammen.plugin.statestore.cassandra.dao.impl.VersionCassandraDao;
+import org.openecomp.core.tools.store.VersionInfoCassandraLoader;
+import org.openecomp.core.tools.store.VspGeneralLoader;
+import org.openecomp.core.tools.store.ElementHandler;
+import org.openecomp.core.zusammen.impl.CassandraConnectionInitializer;
+import org.openecomp.core.zusammen.plugin.dao.types.ElementEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
+import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
+
+import java.util.*;
+
+public class ResetOldVersion {
+
+
+ public static Map<String, List<String>> itemVersionMap = new HashMap<>();
+
+ public static int count =0;
+ public static void reset(SessionContext context, String oldVersion,String emptyOldVersion) {
+
+
+
+ CassandraConnectionInitializer.setCassandraConnectionPropertiesToSystem();
+
+ loadItemVersionInfo(context);
+
+ Map<String, ElementEntity> generalElementMap =
+ VspGeneralLoader.load(context,
+ itemVersionMap);
+
+ generalElementMap.values().forEach(elementEntity -> updateOldVersionFlag(elementEntity,
+ oldVersion,"true".equals(emptyOldVersion)));
+
+
+ itemVersionMap.entrySet().forEach(entry->entry.getValue().stream().filter
+ (version->generalElementMap.containsKey(context.getUser().getUserName()+"_"+entry.getKey()
+ +"_"+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,
+ 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++;
+ }
+
+
+ }
+
+
+ private static void loadItemVersionInfo(SessionContext context) {
+
+ List<String> items = new ArrayList<>();
+ System.setProperty("cassandra.dox.keystore", "dox");
+ VersionInfoCassandraLoader versionInfoCassandraLoader = new VersionInfoCassandraLoader();
+ Collection<VersionInfoEntity> versions =
+ versionInfoCassandraLoader.list();
+
+ versions.stream().filter(versionInfoEntity -> versionInfoEntity.getEntityType().equals
+ (VendorSoftwareProductConstants.VENDOR_SOFTWARE_PRODUCT_VERSIONABLE_TYPE)).forEach
+ (versionInfoEntity
+ -> items.add(versionInfoEntity.getEntityId()));
+ System.setProperty("cassandra.dox.keystore", "zusammen_dox");
+ VersionCassandraDao versionCassandraDao = new VersionCassandraDao();
+
+ items
+ .forEach(itemId -> versionCassandraDao.list(context, context.getUser().getUserName(), new Id
+ (itemId)).forEach(itemVersion -> addItemVersion(itemId, itemVersion.getId())));
+
+ }
+
+ private static void addItemVersion(String itemId, Id versionId) {
+ if (!itemVersionMap.containsKey(itemId)) {
+ itemVersionMap.put(itemId, new ArrayList<>());
+ }
+ itemVersionMap.get(itemId).add(versionId.getValue());
+ }
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java
new file mode 100644
index 0000000000..ebce90fb4a
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ElementHandler.java
@@ -0,0 +1,100 @@
+package org.openecomp.core.tools.Commands.exportdata;
+
+
+import org.openecomp.core.tools.store.ElementCassandraLoader;
+import org.openecomp.core.tools.store.zusammen.datatypes.ElementEntity;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+
+import java.nio.ByteBuffer;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Objects;
+
+import static java.io.File.separator;
+import static java.nio.file.Files.*;
+import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.*;
+
+public class ElementHandler {
+
+ private static final Logger logger = LoggerFactory.getLogger(ElementHandler.class);
+
+ public ElementHandler() {
+ }
+
+ public void loadElements(String filteredItem) {
+ ElementCassandraLoader elementCassandraLoader = new ElementCassandraLoader();
+ elementCassandraLoader.list().forEach(elementEntity -> handleElementEntity(elementEntity,filteredItem));
+ }
+
+ private void handleElementEntity(ElementEntity elementEntity, String filteredItem) {
+ try {
+ String itemId = elementEntity.getItemId();
+ if (filteredItem != null && !itemId.contains(filteredItem)){
+ return;
+ }
+ String versionId = elementEntity.getVersionId();
+ String space = elementEntity.getSpace();
+ String namespace = elementEntity.getNamespace();
+ String elementId = elementEntity.getElement_id();
+
+ String namespacePath = separator;
+ if (!isNull(namespace)){
+ namespacePath = namespace.replace(ELEMENT_NAMESPACE_SPLITTER,separator)+separator;
+ }
+ Path elementDirectoryPath = Paths.get( ROOT_DIRECTORY + separator + itemId
+ + separator + versionId + separator + space + separator + namespacePath+ separator + elementId);
+ if (notExists(elementDirectoryPath)) {
+ createDirectories(elementDirectoryPath);
+ }
+
+ String info = elementEntity.getInfo();
+ if (!isNull(info)) {
+ Path infoFilePath = Paths.get(elementDirectoryPath.toString() + separator + ELEMENT_INFO_PREFIX
+ + elementId + JSON_POSTFIX);
+ write(infoFilePath, info.getBytes());
+ }
+
+ String relations = elementEntity.getRelations();
+ if (!isNull(relations)) {
+ Path realtionsFilePath = Paths.get(elementDirectoryPath.toString() + separator
+ + ELEMENT_RELATION_PREFIX + elementId + JSON_POSTFIX);
+ write(realtionsFilePath, relations.getBytes());
+ }
+
+ ByteBuffer data = elementEntity.getData();
+ if (!Objects.isNull(data)) {
+ Path dataFilePath = Paths.get(elementDirectoryPath.toString() + separator
+ + ELEMENT_DATA_PREFIX + elementId + JSON_POSTFIX);
+ write(dataFilePath, data.array());
+ }
+
+ ByteBuffer visualization = elementEntity.getVisualization();
+ if (!Objects.isNull(visualization)) {
+ Path visualFilePath = Paths.get(elementDirectoryPath.toString() + separator
+ + ELEMENT_VISUALIZATION_PREFIX + elementId );
+ write(visualFilePath, visualization.array());
+ }
+
+ ByteBuffer searchableData = elementEntity.getSearchableData();
+ if (!Objects.isNull(searchableData)) {
+ Path searchableFilePath = Paths.get(elementDirectoryPath.toString() + separator
+ + ELEMENT_SEARCHABLE_PREFIX + elementId);
+ write(searchableFilePath, searchableData.array());
+ }
+
+ } catch (Exception ex) {
+ logger.error(ex.getMessage(), ex);
+ ex.printStackTrace();
+ }
+
+ }
+
+ private boolean isNull(String inStr){
+ if (Objects.isNull(inStr)){
+ return true;
+ }
+ return inStr.trim().equalsIgnoreCase("null");
+ }
+
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ImportProperties.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ImportProperties.java
new file mode 100644
index 0000000000..3b7566fd1b
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ImportProperties.java
@@ -0,0 +1,20 @@
+package org.openecomp.core.tools.Commands.exportdata;
+
+import java.io.File;
+
+public class ImportProperties {
+ public static final String VERSION_FILE_PREFIX = "version_";
+ public static final String VERSION_INFO_FILE_PREFIX = "version_info_";
+ public static final String JSON_POSTFIX = ".json";
+
+ public static final String ELEMENT_INFO_PREFIX = "elem_info";
+ public static final String ELEMENT_RELATION_PREFIX = "elem_relations";
+ public static final String ELEMENT_DATA_PREFIX = "elem_data";
+ public static final String ELEMENT_VISUALIZATION_PREFIX = "elem_visualization";
+ public static final String ELEMENT_SEARCHABLE_PREFIX = "elem_searchableData";
+ public static final String ELEMENT_NAMESPACE_SPLITTER = "/";
+ public static String ROOT_DIRECTORY;
+ public static final void initParams(){
+ ROOT_DIRECTORY = System.getProperty("user.home")+File.separator+ "onboarding_import";
+ }
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java
new file mode 100644
index 0000000000..9eea182609
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/ItemHandler.java
@@ -0,0 +1,62 @@
+package org.openecomp.core.tools.Commands.exportdata;
+
+import com.amdocs.zusammen.datatypes.SessionContext;
+import com.amdocs.zusammen.datatypes.item.Item;
+import com.amdocs.zusammen.plugin.statestore.cassandra.dao.ItemDao;
+import com.amdocs.zusammen.plugin.statestore.cassandra.dao.ItemDaoFactory;
+import org.openecomp.core.tools.Commands.ExportDataCommand;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.List;
+
+import static java.nio.file.Files.*;
+import static java.io.File.separator;
+import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.*;
+
+public class ItemHandler {
+ private static final Logger logger = LoggerFactory.getLogger(ExportDataCommand.class);
+
+
+ public ItemHandler() {
+ ImportProperties.initParams();
+ }
+
+ public void createItemsData(SessionContext context, String filteredItem) throws URISyntaxException, IOException {
+
+ List<Item> items = getItemDao(context).list(context);
+ items.parallelStream().forEach(item -> createItemDirectoryAndFiles(item,filteredItem));
+
+ }
+
+ private final void createItemDirectoryAndFiles(Item item,String filteredItem) {
+ try {
+ String itemId = item.getId().getValue();
+ if (filteredItem != null && !itemId.contains(filteredItem)){
+ return;
+ }
+ Path itemPath = Paths.get( ImportProperties.ROOT_DIRECTORY + separator + itemId);
+ Path itemFilePath = Paths.get( ImportProperties.ROOT_DIRECTORY + separator +
+ itemId + separator + itemId + JSON_POSTFIX);
+ if (notExists(itemPath)) {
+ createDirectories(itemPath);
+ }
+ String itemJson = JsonUtil.object2Json(item);
+ write(itemFilePath, itemJson.getBytes());
+ } catch (Exception ex) {
+ logger.error(ex.getMessage(), ex);
+ ex.printStackTrace();
+ }
+
+ }
+
+
+ private ItemDao getItemDao(SessionContext context) {
+ return ItemDaoFactory.getInstance().createInterface(context);
+ }
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java
new file mode 100644
index 0000000000..b8d82958c9
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/exportdata/VersionHandler.java
@@ -0,0 +1,74 @@
+package org.openecomp.core.tools.Commands.exportdata;
+
+import org.openecomp.core.tools.Commands.ExportDataCommand;
+import org.openecomp.core.tools.store.VersionInfoCassandraLoader;
+import org.openecomp.core.tools.store.VersionCassandraLoader;
+
+import org.openecomp.core.tools.store.zusammen.datatypes.VersionEntity;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
+
+import static java.io.File.separator;
+import static java.nio.file.Files.*;
+import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.*;
+import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.ROOT_DIRECTORY;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public class VersionHandler {
+ private static final Logger logger = LoggerFactory.getLogger(ExportDataCommand.class);
+
+ public VersionHandler() {
+ }
+
+ public void loadVersions(String filteredItem) {
+ VersionCassandraLoader versionCassandraLoader = new VersionCassandraLoader();
+ versionCassandraLoader.list().forEach(versionEntity -> handleVersionEntity(versionEntity,filteredItem));
+ VersionInfoCassandraLoader versionInfoCassandraLoader = new VersionInfoCassandraLoader();
+ versionInfoCassandraLoader.list().forEach(versionInfoEntity -> handleVersionInfo(versionInfoEntity,filteredItem));
+ }
+
+ private void handleVersionEntity(VersionEntity versionEntity, String filteredItem) {
+ try {
+ String itemId = versionEntity.getItemId();
+ if (filteredItem != null && !itemId.contains(filteredItem)){
+ return;
+ }
+ String versionId = versionEntity.getVersionId();
+ String space = versionEntity.getSpace();
+ Path versionDirectoryPath = Paths.get( ROOT_DIRECTORY + separator + itemId
+ + separator + versionId + separator + space);
+ Path versionFilePath = Paths.get(versionDirectoryPath.toString() + separator + VERSION_FILE_PREFIX
+ + versionId + JSON_POSTFIX);
+ if (notExists(versionDirectoryPath)) {
+ createDirectories(versionDirectoryPath);
+ }
+ String versionJson = JsonUtil.object2Json(versionEntity);
+ write(versionFilePath, versionJson.getBytes());
+ } catch (Exception ex) {
+ logger.error(ex.getMessage(), ex);
+ ex.printStackTrace();
+ }
+
+ }
+
+ private void handleVersionInfo(VersionInfoEntity versionInfoEntity, String filteredItem) {
+ try {
+ String itemId = versionInfoEntity.getEntityId();
+ Path itemDirectory = Paths.get( ROOT_DIRECTORY + separator + itemId);
+ Path versionInfoFilePath = Paths.get(itemDirectory.toString() + separator + VERSION_INFO_FILE_PREFIX
+ + itemId + JSON_POSTFIX);
+ if (exists(itemDirectory)) {
+ String versionJson = JsonUtil.object2Json(versionInfoEntity);
+ write(versionInfoFilePath, versionJson.getBytes());
+ }
+ } catch (Exception ex) {
+ logger.error(ex.getMessage(), ex);
+ ex.printStackTrace();
+ }
+
+ }
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java
new file mode 100644
index 0000000000..7ba830906c
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ElementImport.java
@@ -0,0 +1,116 @@
+package org.openecomp.core.tools.Commands.importdata;
+
+import com.amdocs.zusammen.datatypes.SessionContext;
+import org.openecomp.core.tools.store.ElementCassandraLoader;
+import org.openecomp.core.tools.store.ElementNamespaceHandler;
+import org.openecomp.core.tools.store.VersionCassandraLoader;
+import org.openecomp.core.tools.store.zusammen.datatypes.ElementEntity;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static java.io.File.separator;
+import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.*;
+
+public class ElementImport {
+ private static final Logger logger = LoggerFactory.getLogger(ElementImport.class);
+ private ElementCassandraLoader elementCassandraLoader = new ElementCassandraLoader();
+ private ElementNamespaceHandler cassandraElementRepository = new ElementNamespaceHandler();
+ private VersionCassandraLoader versionCassandraLoader = new VersionCassandraLoader();
+
+ public void loadPath(SessionContext sessionContext, Path elementDir, String elementId, String[] pathObjects) {
+ try {
+ // load info file
+ ElementEntity elementEntity = new ElementEntity();
+ Path infoFilePath = Paths.get(elementDir.toString() + separator + ELEMENT_INFO_PREFIX
+ + elementId + JSON_POSTFIX);
+ if (Files.exists(infoFilePath)) {
+ String info = new String(Files.readAllBytes(infoFilePath));
+ elementEntity.setInfo(info);
+ }
+
+ // load relation file
+ Path realtionsFilePath = Paths.get(elementDir.toString() + separator
+ + ELEMENT_RELATION_PREFIX + elementId + JSON_POSTFIX);
+ if (Files.exists(realtionsFilePath)) {
+ String relations = new String(Files.readAllBytes(realtionsFilePath));
+ elementEntity.setRelations(relations);
+ }
+
+ //load entity data
+ Path dataFilePath = Paths.get(elementDir.toString() + separator
+ + ELEMENT_DATA_PREFIX + elementId + JSON_POSTFIX);
+ if (Files.exists(dataFilePath)) {
+ byte[] bytes = Files.readAllBytes(dataFilePath);
+ ByteBuffer data = ByteBuffer.wrap(bytes);
+ elementEntity.setData(data);
+ }
+
+ //load visualization
+ Path visualFilePath = Paths.get(elementDir.toString() + separator
+ + ELEMENT_VISUALIZATION_PREFIX + elementId );
+ if (Files.exists(visualFilePath)) {
+ byte[] bytes = Files.readAllBytes(visualFilePath);
+ ByteBuffer visualization = ByteBuffer.wrap(bytes);
+ elementEntity.setVisualization(visualization);
+ }
+
+ //load searchable
+ Path searchableFilePath = Paths.get(elementDir.toString() + separator
+ + ELEMENT_SEARCHABLE_PREFIX + elementId );
+ if (Files.exists(searchableFilePath)) {
+ byte[] bytes = Files.readAllBytes(searchableFilePath);
+ ByteBuffer searchable = ByteBuffer.wrap(bytes);
+ elementEntity.setSearchableData(searchable);
+ }
+
+ elementEntity.setSpace(pathObjects[2]);
+ elementEntity.setItemId(pathObjects[0]);
+ elementEntity.setVersionId(pathObjects[1]);
+ elementEntity.setElement_id(pathObjects[pathObjects.length - 1]);
+ elementEntity.setNamespace(getNameSpace(pathObjects));
+ elementEntity.setParentId(getParentId(pathObjects));
+ elementEntity.setSubElementIds(getAllSubElementsIds(elementDir));
+ elementCassandraLoader.createEntity(elementEntity);
+ cassandraElementRepository.createElementNamespace(elementEntity);
+ versionCassandraLoader.insertElementToVersion(elementEntity);
+ } catch (Exception ex) {
+ logger.error(ex.getMessage(), ex);
+ }
+ }
+
+ private String getParentId(String[] pathObjects) {
+ if (pathObjects.length <= 4) {
+ return null;
+ }
+ return pathObjects[pathObjects.length - 2];
+ }
+
+ private Set<String> getAllSubElementsIds(Path root) throws IOException {
+ try (Stream<Path> walk = Files.walk(root)) {
+ return walk.filter(path -> Files.isDirectory(path))
+ .map(path -> path.toFile().getName() ).collect(Collectors.toSet());
+ }
+ }
+
+ private String getNameSpace(String[] pathObjects) {
+ if (pathObjects.length <= 4) {
+ return null;
+ }
+ if (pathObjects.length == 5) {
+ return pathObjects[3];
+ }
+ return Arrays.stream(pathObjects, 3, pathObjects.length - 1)
+ .reduce("", (s1, s2) -> s1 + File.separator + s2);
+ }
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java
new file mode 100644
index 0000000000..c7042743c2
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/ItemImport.java
@@ -0,0 +1,42 @@
+package org.openecomp.core.tools.Commands.importdata;
+
+import com.amdocs.zusammen.datatypes.SessionContext;
+import com.amdocs.zusammen.datatypes.item.Item;
+import com.amdocs.zusammen.plugin.statestore.cassandra.dao.ItemDao;
+import com.amdocs.zusammen.plugin.statestore.cassandra.dao.ItemDaoFactory;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.JSON_POSTFIX;
+
+public class ItemImport {
+ private static final Logger logger = LoggerFactory.getLogger(ItemImport.class);
+
+ public void loadPath(SessionContext sessionContext, Path itemDir, String itemName) {
+ try {
+ Path itemPath = Paths.get(itemDir.toString() + File.separator + itemName + JSON_POSTFIX);
+ if (!Files.exists(itemPath)) {
+ return;
+ }
+ String itemJson = new String(Files.readAllBytes(itemPath));
+ if (itemJson == null || itemJson.trim().isEmpty()) {
+ return;
+ }
+ Item item = JsonUtil.json2Object(itemJson, Item.class);
+ ItemDao itemDao = getItemDao(sessionContext);
+ itemDao.create(sessionContext, item.getId(), item.getInfo(), item.getCreationTime());
+ } catch (Exception ex) {
+ logger.error(ex.getMessage(), ex);
+ }
+ }
+
+ private ItemDao getItemDao(SessionContext context) {
+ return ItemDaoFactory.getInstance().createInterface(context);
+ }
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java
new file mode 100644
index 0000000000..020b2f3c47
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/TreeWalker.java
@@ -0,0 +1,51 @@
+package org.openecomp.core.tools.Commands.importdata;
+
+import com.amdocs.zusammen.datatypes.SessionContext;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.stream.Stream;
+
+public class TreeWalker {
+ private static final Logger logger = LoggerFactory.getLogger(TreeWalker.class);
+
+ public static final void walkFiles(SessionContext sessionContext,Path rootDir, String filterItem) throws IOException {
+ try (Stream<Path> walk = Files.walk(rootDir)) {
+ walk.parallel().filter(path -> Files.isDirectory(path)).
+ forEach(path -> handlePath(sessionContext,path, rootDir, filterItem));
+ }
+ }
+
+ private static final void handlePath(SessionContext sessionContext, Path path, Path root,String filterItem) {
+ String logicalPath = path.toString().replace(root.toString()+File.separator, "");
+ String[] splitted = logicalPath.split(File.separator);
+ if(filterItem != null && splitted.length > 0 && !splitted[0].contains(filterItem)){
+ return;
+ }
+ switch (splitted.length) {
+ case 0:
+ //root - ignore
+ break;
+ case 1: // handle Item
+ new ItemImport().loadPath(sessionContext,path,splitted[splitted.length -1]);
+ new VersionInfoImport().loadPath(sessionContext,path,splitted[splitted.length -1]);
+ break;
+ case 2:
+ //ignore this level
+ break;
+ case 3: // handle version
+ new VersionImport().loadPath(sessionContext,path,splitted[splitted.length -2]);
+ break;
+ default:
+ //handle elements
+ new ElementImport().loadPath(sessionContext,path,splitted[splitted.length -1],splitted);
+ break;
+ }
+
+ }
+
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionImport.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionImport.java
new file mode 100644
index 0000000000..8f6c67d212
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionImport.java
@@ -0,0 +1,41 @@
+package org.openecomp.core.tools.Commands.importdata;
+
+import com.amdocs.zusammen.datatypes.SessionContext;
+import org.openecomp.core.tools.store.VersionCassandraLoader;
+import org.openecomp.core.tools.store.zusammen.datatypes.VersionEntity;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import static java.io.File.separator;
+import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.JSON_POSTFIX;
+import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.VERSION_FILE_PREFIX;
+
+public class VersionImport {
+ private static final Logger logger = LoggerFactory.getLogger(VersionImport.class);
+
+ public void loadPath(SessionContext sessionContext, Path versionDir , String versionId){
+ try {
+ Path versionPath = Paths.get(versionDir.toString() + separator + VERSION_FILE_PREFIX
+ + versionId + JSON_POSTFIX);
+ if (!Files.exists(versionPath)) {
+ return;
+ }
+ String versionJson = new String(Files.readAllBytes(versionPath));
+ if (versionJson == null || versionJson.trim().isEmpty()) {
+ return;
+ }
+ VersionEntity versionEntity = JsonUtil.json2Object(versionJson, VersionEntity.class);
+ VersionCassandraLoader versionCassandraLoader = new VersionCassandraLoader();
+ versionCassandraLoader.insertVersion(versionEntity);
+ } catch (Exception ex) {
+ logger.error(ex.getMessage(), ex);
+ }
+ }
+
+
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionInfoImport.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionInfoImport.java
new file mode 100644
index 0000000000..5da7407c9f
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/Commands/importdata/VersionInfoImport.java
@@ -0,0 +1,41 @@
+package org.openecomp.core.tools.Commands.importdata;
+
+import com.amdocs.zusammen.datatypes.SessionContext;
+import org.openecomp.core.tools.store.VersionInfoCassandraLoader;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import static java.io.File.separator;
+import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.JSON_POSTFIX;
+import static org.openecomp.core.tools.Commands.exportdata.ImportProperties.VERSION_INFO_FILE_PREFIX;
+
+public class VersionInfoImport {
+ private static final Logger logger = LoggerFactory.getLogger(VersionInfoImport.class);
+
+ public void loadPath(SessionContext sessionContext, Path itemPath, String itemId) {
+ try {
+ Path versionInfoFilePath = Paths.get(itemPath.toString() + separator + VERSION_INFO_FILE_PREFIX
+ + itemId + JSON_POSTFIX);
+ if (!Files.exists(versionInfoFilePath)) {
+ return;
+ }
+ String versionInfoJson = new String(Files.readAllBytes(versionInfoFilePath));
+ if (versionInfoJson == null || versionInfoJson.trim().isEmpty()) {
+ return;
+ }
+ VersionInfoEntity versionInfoEntity = JsonUtil.json2Object(versionInfoJson, VersionInfoEntity.class);
+ VersionInfoCassandraLoader versionInfoCassandraLoader = new VersionInfoCassandraLoader();
+ versionInfoCassandraLoader.insertVersionInfo(versionInfoEntity);
+ } catch (Exception ex) {
+ logger.error(ex.getMessage(), ex);
+ }
+ }
+
+
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/loaders/VersionInfoCassandraLoader.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/loaders/VersionInfoCassandraLoader.java
new file mode 100644
index 0000000000..8840975a56
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/loaders/VersionInfoCassandraLoader.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.core.tools.loaders;
+
+import com.datastax.driver.mapping.Mapper;
+import com.datastax.driver.mapping.Result;
+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.versioning.dao.types.VersionInfoEntity;
+
+import java.util.Collection;
+
+public class VersionInfoCassandraLoader {
+
+ private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
+ private static Mapper<VersionInfoEntity> mapper =
+ noSqlDb.getMappingManager().mapper(VersionInfoEntity.class);
+ private static VersionInfoAccessor accessor =
+ noSqlDb.getMappingManager().createAccessor(VersionInfoAccessor.class);
+
+
+
+
+ public Collection<VersionInfoEntity> list() {
+ return accessor.getAll().all();
+ }
+
+ @Accessor
+ interface VersionInfoAccessor {
+ @Query("select * from version_info ")
+ Result<VersionInfoEntity> getAll();
+ }
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/loaders/zusammen/VspGeneralLoader.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/loaders/zusammen/VspGeneralLoader.java
new file mode 100644
index 0000000000..d92866bb47
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/loaders/zusammen/VspGeneralLoader.java
@@ -0,0 +1,40 @@
+package org.openecomp.core.tools.loaders.zusammen;
+
+import com.amdocs.zusammen.datatypes.Id;
+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;
+import java.util.Map;
+import java.util.Optional;
+
+public class VspGeneralLoader {
+ 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();
+ 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());
+ }
+ }
+ }
+
+ return elementEntityMap;
+ }
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/loaders/zusammen/VspItemLoader.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/loaders/zusammen/VspItemLoader.java
new file mode 100644
index 0000000000..78b915c525
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/loaders/zusammen/VspItemLoader.java
@@ -0,0 +1,4 @@
+package org.openecomp.core.tools.loaders.zusammen;
+
+public class VspItemLoader {
+}
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
new file mode 100644
index 0000000000..6f092d2f56
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/main/ZusammenMainTool.java
@@ -0,0 +1,80 @@
+package org.openecomp.core.tools.main;
+
+import com.amdocs.zusammen.datatypes.SessionContext;
+import com.amdocs.zusammen.datatypes.UserInfo;
+import org.openecomp.core.tools.Commands.ImportCommand;
+import org.openecomp.core.tools.Commands.ExportDataCommand;
+import org.openecomp.core.tools.Commands.ResetOldVersion;
+import org.openecomp.core.tools.util.ToolsUtil;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+
+import java.time.Duration;
+import java.time.Instant;
+
+import static org.openecomp.core.tools.util.Utils.printMessage;
+
+public class ZusammenMainTool {
+
+ private static final String GLOBAL_USER = "GLOBAL_USER";
+ private static Logger logger = LoggerFactory.getLogger(ZusammenMainTool.class);
+ private static int status = 0;
+
+ public static void main(String[] args) {
+
+ String command = ToolsUtil.getParam("c",args);
+ if(command == null){
+ printMessage(logger,
+ "parameter -c is mandatory. script usage: zusammenMainTool.sh -c {command name} " +
+ "[additional arguments depending on the command] ");
+ System.exit(-1);
+ }
+ Instant startTime = Instant.now();
+
+ SessionContext context = new SessionContext();
+ context.setUser(new UserInfo(GLOBAL_USER));
+ context.setTenant("dox");
+
+
+ switch (COMMANDS.valueOf(command)){
+ case RESET_OLD_VERSION:
+ ResetOldVersion.reset(context,ToolsUtil.getParam("v",args),ToolsUtil.getParam("n",args));
+ break;
+ case EXPORT:
+ ExportDataCommand.exportData(context,ToolsUtil.getParam("i",args));
+ break;
+ case IMPORT:
+ ImportCommand.importData(context, ToolsUtil.getParam("f",args),ToolsUtil.getParam("i",args));
+ break;
+
+ }
+
+ Instant stopTime = Instant.now();
+ Duration duration = Duration.between(startTime, stopTime);
+ long minutesPart = duration.toMinutes();
+ long secondsPart = duration.minusMinutes(minutesPart).getSeconds();
+
+
+ printMessage(logger,
+ "Zusammen tools command:[] finished . Total run time was : " + minutesPart + ":" +
+ secondsPart
+ + " minutes");
+ System.exit(status);
+
+ }
+
+ private enum COMMANDS{
+
+
+ RESET_OLD_VERSION("reset-old-version"),
+ EXPORT("export"),
+ IMPORT("import");
+
+ COMMANDS(String command) {
+ this.command = command;
+ }
+
+ private String command;
+ }
+
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/ElementCassandraLoader.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/ElementCassandraLoader.java
new file mode 100644
index 0000000000..1c7e185e18
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/ElementCassandraLoader.java
@@ -0,0 +1,74 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.core.tools.store;
+
+import com.datastax.driver.mapping.Mapper;
+import com.datastax.driver.mapping.Result;
+import com.datastax.driver.mapping.annotations.Accessor;
+import com.datastax.driver.mapping.annotations.Query;
+import com.datastax.driver.mapping.annotations.QueryParameters;
+import org.openecomp.core.nosqldb.api.NoSqlDb;
+import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
+import org.openecomp.core.tools.store.zusammen.datatypes.ElementEntity;
+
+import java.nio.ByteBuffer;
+import java.util.Set;
+
+public class ElementCassandraLoader {
+
+ private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
+ private static Mapper<ElementEntity> mapper = noSqlDb.getMappingManager().mapper(ElementEntity.class);
+ private static ElementAccessor accessor = noSqlDb.getMappingManager().createAccessor(ElementAccessor.class);
+ private String[] columns = {"space", "item_id", "version_id", "element_id", "data", "info", "namespace", "parent_id",
+ "relations", "searchable_data", "sub_element_ids"};
+
+
+ public void createEntity(ElementEntity elementEntity) {
+ accessor.insertElement(elementEntity.getSpace(),
+ elementEntity.getItemId(),
+ elementEntity.getVersionId(),
+ elementEntity.getElement_id(),
+ elementEntity.getData(),
+ elementEntity.getInfo(),
+ elementEntity.getNamespace(),
+ elementEntity.getParentId(),
+ elementEntity.getRelations(),
+ elementEntity.getSearchableData(),
+ elementEntity.getSubElementIds());
+ }
+
+ public Result<ElementEntity> list() {
+ return accessor.getAll();
+ }
+
+ @Accessor
+ interface ElementAccessor {
+
+ @Query("insert into zusammen_dox.element (space,item_id,version_id,element_id,data,info,namespace,parent_id,relations,searchable_data,sub_element_ids) values (?,?,?,?,?,?,?,?,?,?,?)")
+ void insertElement(String space, String itemId, String versionId, String elementId, ByteBuffer data, String info, String namespaceStr,
+ String parentId, String relations, ByteBuffer searchable, Set<String> subElementsIds);
+
+
+ @Query("select * from zusammen_dox.element ")
+ @QueryParameters(fetchSize = 100)
+ Result<ElementEntity> getAll();
+ }
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/ElementHandler.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/ElementHandler.java
new file mode 100644
index 0000000000..2690130974
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/ElementHandler.java
@@ -0,0 +1,26 @@
+package org.openecomp.core.tools.store;
+
+import com.amdocs.zusammen.datatypes.Id;
+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;
+
+public class ElementHandler {
+
+ private static final String GLOBAL_USER = "GLOBAL_USER";
+
+ public static void update(SessionContext context,
+
+ String itemId, String versionId,
+ ElementEntity elementEntity) {
+
+ ElementEntityContext elementContext;
+ elementContext = new ElementEntityContext(GLOBAL_USER, new Id(itemId),
+ new Id(versionId));
+ CassandraElementRepository cassandraElementRepository = new CassandraElementRepository();
+ cassandraElementRepository.update(context, elementContext, elementEntity);
+
+ }
+}
+
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/ElementNamespaceHandler.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/ElementNamespaceHandler.java
new file mode 100644
index 0000000000..f1ed970b4d
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/ElementNamespaceHandler.java
@@ -0,0 +1,27 @@
+package org.openecomp.core.tools.store;
+
+
+import com.datastax.driver.mapping.annotations.Accessor;
+import com.datastax.driver.mapping.annotations.Param;
+import com.datastax.driver.mapping.annotations.Query;
+import org.openecomp.core.nosqldb.api.NoSqlDb;
+import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
+import org.openecomp.core.tools.store.zusammen.datatypes.ElementEntity;
+
+public class ElementNamespaceHandler {
+
+ private static NoSqlDb nnoSqlDb = NoSqlDbFactory.getInstance().createInterface();
+ private static ElementNamespaceAccessor accessor = nnoSqlDb.getMappingManager().createAccessor(ElementNamespaceAccessor.class);
+
+ public void createElementNamespace(ElementEntity elementEntity) {
+ accessor.create(elementEntity.getSpace(),elementEntity.getItemId(),elementEntity.getElement_id(),elementEntity.getNamespace());
+ }
+
+ @Accessor
+ interface ElementNamespaceAccessor {
+ @Query("UPDATE zusammen_dox.element_namespace SET namespace=:ns WHERE space=:space AND item_id=:item AND element_id=:id ")
+ void create(@Param("space") String space, @Param("item") String item, @Param("id") String id, @Param("ns") String ns);
+ }
+
+
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VersionCassandraLoader.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VersionCassandraLoader.java
new file mode 100644
index 0000000000..851e92dcca
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VersionCassandraLoader.java
@@ -0,0 +1,78 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.core.tools.store;
+
+import com.datastax.driver.mapping.Mapper;
+import com.datastax.driver.mapping.Result;
+import com.datastax.driver.mapping.annotations.Accessor;
+import com.datastax.driver.mapping.annotations.Query;
+import com.datastax.driver.mapping.annotations.QueryParameters;
+import com.google.common.collect.Sets;
+import org.openecomp.core.nosqldb.api.NoSqlDb;
+import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
+import org.openecomp.core.tools.store.zusammen.datatypes.ElementEntity;
+import org.openecomp.core.tools.store.zusammen.datatypes.VersionEntity;
+
+import java.util.Date;
+import java.util.Set;
+
+public class VersionCassandraLoader {
+
+ private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
+ private static Mapper<VersionEntity> mapper = noSqlDb.getMappingManager().mapper(VersionEntity.class);
+ private static VersionAccessor accessor = noSqlDb.getMappingManager().createAccessor(VersionAccessor.class);
+
+ public void insertElementToVersion(ElementEntity elementEntity) {
+ accessor.addElements(Sets.newHashSet(elementEntity.getElement_id()), elementEntity.getSpace(), elementEntity.getItemId(), elementEntity.getVersionId());
+ }
+
+ public void insertVersion(VersionEntity versionEntity) {
+ accessor.insertVersion( versionEntity.getSpace(),
+ versionEntity.getItemId(),
+ versionEntity.getVersionId(),
+ versionEntity.getBaseVersionId(),
+ versionEntity.getCreationTime(),
+ versionEntity.getInfo(),
+ versionEntity.getModificationTime(),
+ versionEntity.getRelations());
+ }
+
+
+ public Result<VersionEntity> list() {
+ return accessor.getAll();
+ }
+
+ @Accessor
+ interface VersionAccessor {
+
+ @Query("UPDATE zusammen_dox.version_elements SET element_ids=element_ids+? " +
+ "WHERE space=? AND item_id=? AND version_id=?")
+ void addElements(Set<String> elementIds, String space, String itemId, String versionId);
+
+ @Query("insert into zusammen_dox.version (space,item_id,version_id,base_version_id,creation_time,info,modification_time,relations) values (?,?,?,?,?,?,?,?)")
+ void insertVersion(String space, String itemId, String versionId, String baseVersionId, Date createTime, String info, Date modificationTime, String relations);
+
+
+ @Query("select * from zusammen_dox.version ")
+ @QueryParameters(fetchSize = 400)
+ Result<VersionEntity> getAll();
+ }
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VersionInfoCassandraLoader.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VersionInfoCassandraLoader.java
new file mode 100644
index 0000000000..d7ec93962c
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VersionInfoCassandraLoader.java
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.core.tools.store;
+
+import com.datastax.driver.mapping.Mapper;
+import com.datastax.driver.mapping.Result;
+import com.datastax.driver.mapping.annotations.Accessor;
+import com.datastax.driver.mapping.annotations.Query;
+import com.datastax.driver.mapping.annotations.QueryParameters;
+import org.openecomp.core.nosqldb.api.NoSqlDb;
+import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
+import org.openecomp.sdc.versioning.dao.VersionInfoDao;
+import org.openecomp.sdc.versioning.dao.VersionInfoDaoFactory;
+import org.openecomp.sdc.versioning.dao.types.VersionInfoEntity;
+
+import java.util.Collection;
+
+public class VersionInfoCassandraLoader {
+
+ private static NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
+ private static Mapper<VersionInfoEntity> mapper =
+ noSqlDb.getMappingManager().mapper(VersionInfoEntity.class);
+ private static VersionInfoAccessor accessor =
+ noSqlDb.getMappingManager().createAccessor(VersionInfoAccessor.class);
+ private static VersionInfoDao versionInfoDao =
+ VersionInfoDaoFactory.getInstance().createInterface();
+
+ public void insertVersionInfo(VersionInfoEntity versionInfoEntity) {
+ versionInfoDao.create(versionInfoEntity);
+ }
+
+ public Collection<VersionInfoEntity> list() {
+ return accessor.getAll().all();
+ }
+
+ @Accessor
+ interface VersionInfoAccessor {
+ @Query("select * from dox.version_info ")
+ @QueryParameters(fetchSize = 400)
+ Result<VersionInfoEntity> getAll();
+ }
+
+
+}
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
new file mode 100644
index 0000000000..b5d09daf3f
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VspGeneralLoader.java
@@ -0,0 +1,95 @@
+package org.openecomp.core.tools.store;
+
+import com.amdocs.zusammen.datatypes.Id;
+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 java.util.HashMap;
+import java.util.List;
+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");
+
+ Id entityId;
+ Id itemId;
+ Id versionId;
+ for (Map.Entry<String, List<String>> entry : vspItemVersionsMap.entrySet()) {
+
+ for (String version : entry.getValue()) {
+
+
+ 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;
+
+
+
+
+
+
+ }
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/zusammen/datatypes/ElementEntity.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/zusammen/datatypes/ElementEntity.java
new file mode 100644
index 0000000000..f4f450db70
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/zusammen/datatypes/ElementEntity.java
@@ -0,0 +1,168 @@
+package org.openecomp.core.tools.store.zusammen.datatypes;
+
+import com.datastax.driver.mapping.annotations.Column;
+import com.datastax.driver.mapping.annotations.PartitionKey;
+import com.datastax.driver.mapping.annotations.Table;
+
+import java.nio.ByteBuffer;
+import java.util.Set;
+
+/**
+ * CREATE TABLE zusammen_dox.element (
+ * space text,
+ * item_id text,
+ * version_id text,
+ * element_id text,
+ * data blob,
+ * info text,
+ * namespace text,
+ * parent_id text,
+ * relations text,
+ * searchable_data blob,
+ * sub_element_ids set<text>,
+ * visualization blob,
+ * PRIMARY KEY ((space, item_id, version_id, element_id))
+ * )
+ */
+@Table(
+ keyspace = "zusammen_dox",
+ name = "version"
+)
+public class ElementEntity {
+ @Column( name = "space" )
+ @PartitionKey(0)
+ private String space;
+
+ @Column( name = "item_id" )
+ @PartitionKey(1)
+ private String itemId;
+
+ @Column( name = "version_id" )
+ @PartitionKey(2)
+ private String versionId;
+
+ @Column(name = "element_id")
+ @PartitionKey(3)
+ private String element_id;
+
+ @Column(name = "data")
+ private ByteBuffer data;
+
+ @Column(name = "info")
+ private String info;
+
+ @Column(name = "namespace")
+ private String namespace;
+
+ @Column(name = "parent_id")
+ private String parentId;
+
+ @Column(name = "relations")
+ private String relations;
+
+ @Column(name = "searchable_data")
+ private ByteBuffer searchableData;
+
+ @Column(name = "sub_element_ids")
+ private Set<String> subElementIds;
+
+
+ @Column(name = "visualization")
+ private ByteBuffer visualization;
+
+ public String getSpace() {
+ return space;
+ }
+
+ public void setSpace(String space) {
+ this.space = space;
+ }
+
+ public String getItemId() {
+ return itemId;
+ }
+
+ public void setItemId(String itemId) {
+ this.itemId = itemId;
+ }
+
+ public String getVersionId() {
+ return versionId;
+ }
+
+ public void setVersionId(String versionId) {
+ this.versionId = versionId;
+ }
+
+ public String getElement_id() {
+ return element_id;
+ }
+
+ public void setElement_id(String element_id) {
+ this.element_id = element_id;
+ }
+
+ public ByteBuffer getData() {
+ return data;
+ }
+
+ public void setData(ByteBuffer data) {
+ this.data = data;
+ }
+
+ public String getInfo() {
+ return info;
+ }
+
+ public void setInfo(String info) {
+ this.info = info;
+ }
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ public void setNamespace(String namespace) {
+ this.namespace = namespace;
+ }
+
+ public String getParentId() {
+ return parentId;
+ }
+
+ public void setParentId(String parentId) {
+ this.parentId = parentId;
+ }
+
+ public String getRelations() {
+ return relations;
+ }
+
+ public void setRelations(String relations) {
+ this.relations = relations;
+ }
+
+ public ByteBuffer getSearchableData() {
+ return searchableData;
+ }
+
+ public void setSearchableData(ByteBuffer searchableData) {
+ this.searchableData = searchableData;
+ }
+
+ public Set<String> getSubElementIds() {
+ return subElementIds;
+ }
+
+ public void setSubElementIds(Set<String> subElementIds) {
+ this.subElementIds = subElementIds;
+ }
+
+ public ByteBuffer getVisualization() {
+ return visualization;
+ }
+
+ public void setVisualization(ByteBuffer visualization) {
+ this.visualization = visualization;
+ }
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/zusammen/datatypes/VersionEntity.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/zusammen/datatypes/VersionEntity.java
new file mode 100644
index 0000000000..c7280c8a9d
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/zusammen/datatypes/VersionEntity.java
@@ -0,0 +1,128 @@
+package org.openecomp.core.tools.store.zusammen.datatypes;
+
+import com.datastax.driver.mapping.annotations.*;
+
+import java.util.Date;
+
+/**
+ * CREATE TABLE zusammen_dox.version (
+ * space text,
+ * item_id text,
+ * version_id text,
+ * base_version_id text,
+ * creation_time timestamp,
+ * info text,
+ * modification_time timestamp,
+ * relations text,
+ * PRIMARY KEY ((space, item_id), version_id)
+ * ) WITH CLUSTERING ORDER BY (version_id ASC)
+ * AND bloom_filter_fp_chance = 0.01
+ * AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'
+ * AND comment = ''
+ * AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'}
+ * AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}
+ * AND dclocal_read_repair_chance = 0.1
+ * AND default_time_to_live = 0
+ * AND gc_grace_seconds = 864000
+ * AND max_index_interval = 2048
+ * AND memtable_flush_period_in_ms = 0
+ * AND min_index_interval = 128
+ * AND read_repair_chance = 0.0
+ * AND speculative_retry = '99.0PERCENTILE';
+ */
+@Table(
+ keyspace = "zusammen_dox",
+ name = "version"
+)
+public class VersionEntity {
+ @Column(name = "space")
+ @PartitionKey(0)
+ private String space;
+
+ @Column(name = "item_id")
+ @PartitionKey(1)
+ private String itemId;
+
+ @Column(name = "version_id")
+ @PartitionKey(2)
+ private String versionId;
+
+ @Column(name = "base_version_id")
+ private String baseVersionId;
+
+ @Column(name = "creation_time")
+ private Date creationTime;
+
+ @Column(name = "info")
+ private String info;
+
+ @Column(name = "modification_time")
+ private Date modificationTime;
+
+ @Column(name = "relations")
+ private String relations;
+
+ public String getSpace() {
+ return space;
+ }
+
+ public void setSpace(String space) {
+ this.space = space;
+ }
+
+ public String getItemId() {
+ return itemId;
+ }
+
+ public void setItemId(String itemId) {
+ this.itemId = itemId;
+ }
+
+ public String getVersionId() {
+ return versionId;
+ }
+
+ public void setVersionId(String versionId) {
+ this.versionId = versionId;
+ }
+
+ public String getBaseVersionId() {
+ return baseVersionId;
+ }
+
+ public void setBaseVersionId(String baseVersionId) {
+ this.baseVersionId = baseVersionId;
+ }
+
+ public Date getCreationTime() {
+ return creationTime;
+ }
+
+ public void setCreationTime(Date creationTime) {
+ this.creationTime = creationTime;
+ }
+
+ public String getInfo() {
+ return info;
+ }
+
+ public void setInfo(String info) {
+ this.info = info;
+ }
+
+ public Date getModificationTime() {
+ return modificationTime;
+ }
+
+ public void setModificationTime(Date modificationTime) {
+ this.modificationTime = modificationTime;
+ }
+
+ public String getRelations() {
+ return relations;
+ }
+
+ public void setRelations(String relations) {
+ this.relations = relations;
+ }
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ToolsUtil.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ToolsUtil.java
new file mode 100644
index 0000000000..e2c80f0226
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ToolsUtil.java
@@ -0,0 +1,14 @@
+package org.openecomp.core.tools.util;
+
+public class ToolsUtil {
+
+ public static String getParam(String key, String[] args) {
+
+ for (int j = 0; j < args.length; j++) {
+ if (args[j].equals("-" + key)) {
+ return args[j + 1];
+ }
+ }
+ return null;
+ }
+}
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/Utils.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/Utils.java
new file mode 100644
index 0000000000..d1621ad672
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/Utils.java
@@ -0,0 +1,15 @@
+package org.openecomp.core.tools.util;
+
+import org.openecomp.sdc.logging.api.Logger;
+
+/**
+ * @author Avrahamg
+ * @since April 24, 2017
+ */
+public class Utils {
+ public static void printMessage(Logger logger, String message) {
+ System.out.println(message);
+ logger.debug(message);
+ }
+}
+
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ZipUtils.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ZipUtils.java
new file mode 100644
index 0000000000..6447f85ea7
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/util/ZipUtils.java
@@ -0,0 +1,89 @@
+package org.openecomp.core.tools.util;
+
+import com.google.common.io.ByteStreams;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Objects;
+import java.util.Scanner;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
+
+public class ZipUtils {
+ public static void createZip(String zipFileName, Path dir, String filterItem) throws Exception {
+ File dirObj = dir.toFile();
+ try (
+ FileOutputStream fileOutputStream = new FileOutputStream(zipFileName);
+ ZipOutputStream out = new ZipOutputStream(fileOutputStream)) {
+ addDir(dirObj, out, dir.toString(), filterItem);
+ }
+ }
+
+ public static final String cleanStr(String inFilterStr) {
+ if (Objects.isNull(inFilterStr)) {
+ return inFilterStr;
+ }
+ Scanner scan = new Scanner(inFilterStr);
+ while (scan.hasNextLine()) {
+ inFilterStr = scan.nextLine().replaceAll("[^a-zA-Z0-9]", "");
+ }
+ return inFilterStr;
+ }
+
+ static void addDir(File dirObj, ZipOutputStream out, String root, String filterItem) throws IOException {
+ File[] files = dirObj.listFiles();
+ filterItem = cleanStr(filterItem);
+
+ for (int i = 0; i < files.length; i++) {
+ if (files[i].isDirectory()) {
+ addDir(files[i], out, root, filterItem);
+ continue;
+ }
+ try (FileInputStream in = new FileInputStream((files[i].getAbsolutePath()))) {
+ String filePath = files[i].getAbsolutePath().replace(root + File.separator, "");
+ if (filterItem == null || filePath.contains(filterItem)) {
+ out.putNextEntry(new ZipEntry(filePath));
+ try {
+ ByteStreams.copy(in, out);
+
+ } finally {
+ out.closeEntry();
+ }
+ }
+
+ }
+ }
+ }
+
+ public static void unzip(Path zipFile, Path outputFolder) throws IOException {
+ if (zipFile == null || outputFolder == null) {
+ return;
+ }
+ if (!Files.exists(outputFolder)) {
+ Files.createDirectories(outputFolder);
+ }
+
+ try (FileInputStream fileInputStream = new FileInputStream(zipFile.toFile());
+ ZipInputStream zis = new ZipInputStream(fileInputStream)) {
+ ZipEntry ze = zis.getNextEntry();
+ while (ze != null) {
+ String fileName = ze.getName();
+ File newFile = new File(outputFolder.toString() + File.separator + fileName);
+ new File(newFile.getParent()).mkdirs();
+ try (FileOutputStream fos = new FileOutputStream(newFile)) {
+ ByteStreams.copy(zis, fos);
+ }
+ ze = zis.getNextEntry();
+ }
+
+ zis.closeEntry();
+ }
+
+ }
+}
+
diff --git a/openecomp-be/tools/zusammen-tools/src/main/resources/logback.xml b/openecomp-be/tools/zusammen-tools/src/main/resources/logback.xml
new file mode 100644
index 0000000000..b1c1335302
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/resources/logback.xml
@@ -0,0 +1,282 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration scan="true" scanPeriod="5 seconds">
+
+ <property scope="system" name="ECOMP-component-name" value="ASDC" />
+ <property scope="system" name="ECOMP-subcomponent-name" value="ASDC-BE" />
+ <property file="${config.home}/catalog-be/configuration.yaml" />
+ <property scope="context" name="enable-all-log" value="false" />
+
+ <!--statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener" />
+ <include resource="asdc_debug_logback.xml"/-->
+
+ <!-- value used by pattern field list (| - is inter-field separator, || - unavailable or not applicable field value) (m - mandatory, o- optional)-->
+ <!--timestamp(m)| requestID(m)| serviceInstanceID(o)| threadID(m)| physicalServerName(o)| serviceName(m)| userID(m)| logLevel(m)| severity(o)| serverIpAddress(m)| serverName(m)| clientIpAddress(o)| className(m)| timer(o)| detailedMessage(o)-->
+ <property name="default-log-pattern"
+ value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{uuid}|%X{serviceInstanceID}|%thread||${ECOMP-subcomponent-name}|%X{userId}|%level|%X{alarmSeverity}|%X{localAddr}|${beFqdn}|%X{remoteAddr}|%logger{35}|%X{timer}|ActivityType=&lt;%M&gt;, Desc=&lt;%msg&gt;%n" />
+
+ <property name="asdc-debug-log-pattern" value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestId}|%msg %n"/>
+
+ <!-- All log -->
+ <if condition='property("enable-all-log").equalsIgnoreCase("true")'>
+ <then>
+ <appender name="ALL_ROLLING"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/all.log
+ </file>
+
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/all.log.%i
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>10</maxIndex>
+ </rollingPolicy>
+
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>20MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${default-log-pattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="ASYNC_ALL" class="ch.qos.logback.classic.AsyncAppender">
+ <appender-ref ref="ALL_ROLLING" />
+ </appender>
+ </then>
+ </if>
+
+ <!-- Error log -->
+ <appender name="ERROR_ROLLING"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/Error.log
+ </file>
+
+ <!-- Audit messages filter - deny audit messages -->
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>AUDIT_MARKER</marker>
+ </evaluator>
+ <onMismatch>NEUTRAL</onMismatch>
+ <onMatch>DENY</onMatch>
+ </filter>
+
+ <!-- Transaction messages filter - deny Transaction messages -->
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>TRANSACTION_MARKER</marker>
+ </evaluator>
+ <onMismatch>NEUTRAL</onMismatch>
+ <onMatch>DENY</onMatch>
+ </filter>
+
+ <!-- deny all events with a level below INFO, that is TRACE and DEBUG -->
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+ <level>INFO</level>
+ </filter>
+
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/Error.log.%i
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>10</maxIndex>
+ </rollingPolicy>
+
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>20MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${default-log-pattern}</pattern>
+ </encoder>
+ </appender>
+
+ <!-- Debug log -->
+ <appender name="DEBUG_ROLLING"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/debug.log
+ </file>
+
+ <!-- No need to deny audit messages - they are INFO only, will be denied
+ anyway -->
+ <!-- Transaction messages filter - deny Transaction messages, there are
+ some DEBUG level messages among them -->
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>TRANSACTION_MARKER</marker>
+ </evaluator>
+ <onMismatch>NEUTRAL</onMismatch>
+ <onMatch>DENY</onMatch>
+ </filter>
+
+ <!-- accept DEBUG and TRACE level -->
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.GEventEvaluator">
+ <expression>
+ e.level.toInt() &lt;= DEBUG.toInt()
+ </expression>
+ </evaluator>
+ <OnMismatch>DENY</OnMismatch>
+ <OnMatch>NEUTRAL</OnMatch>
+ </filter>
+
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/debug.log.%i
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>10</maxIndex>
+ </rollingPolicy>
+
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>20MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${default-log-pattern}</pattern>
+ </encoder>
+ </appender>
+
+ <!-- Debug log -->
+ <appender name="MIGRATION_DEBUG_ROLLING"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/cassandra2zusammen_migration_debug.log
+ </file>
+
+ <!-- No need to deny audit messages - they are INFO only, will be denied
+ anyway -->
+ <!-- Transaction messages filter - deny Transaction messages, there are
+ some DEBUG level messages among them -->
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>TRANSACTION_MARKER</marker>
+ </evaluator>
+ <onMismatch>NEUTRAL</onMismatch>
+ <onMatch>DENY</onMatch>
+ </filter>
+
+ <!-- accept DEBUG and TRACE level -->
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.GEventEvaluator">
+ <expression>
+ e.level.toInt() &lt;= DEBUG.toInt()
+ </expression>
+ </evaluator>
+ <OnMismatch>DENY</OnMismatch>
+ <OnMatch>NEUTRAL</OnMatch>
+ </filter>
+
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/debug_by_package.log.%i
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>10</maxIndex>
+ </rollingPolicy>
+
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>20MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${asdc-debug-log-pattern}</pattern>
+ </encoder>
+ </appender>
+
+ <!-- Audit log -->
+ <appender name="AUDIT_ROLLING"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+
+ <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/audit.log
+ </file>
+
+ <!-- Audit messages filter - accept audit messages -->
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>AUDIT_MARKER</marker>
+ </evaluator>
+ <onMismatch>DENY</onMismatch>
+ <onMatch>ACCEPT</onMatch>
+ </filter>
+
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/audit.log.%i
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>10</maxIndex>
+ </rollingPolicy>
+
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>20MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${default-log-pattern}</pattern>
+ </encoder>
+ </appender>
+
+ <!-- SdncTransaction log -->
+ <appender name="TRANSACTION_ROLLING"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+
+ <file>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/transaction.log
+ </file>
+
+ <!-- Transaction messages filter - accept audit messages -->
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>TRANSACTION_MARKER</marker>
+ </evaluator>
+ <onMismatch>DENY</onMismatch>
+ <onMatch>ACCEPT</onMatch>
+ </filter>
+
+ <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
+ <fileNamePattern>${log.home}/${ECOMP-component-name}/${ECOMP-subcomponent-name}/transaction.log.%i
+ </fileNamePattern>
+ <minIndex>1</minIndex>
+ <maxIndex>10</maxIndex>
+ </rollingPolicy>
+
+ <triggeringPolicy
+ class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
+ <maxFileSize>20MB</maxFileSize>
+ </triggeringPolicy>
+ <encoder>
+ <pattern>${default-log-pattern}</pattern>
+ </encoder>
+ </appender>
+
+ <!-- Asynchronicity Configurations -->
+ <appender name="ASYNC_DEBUG" class="ch.qos.logback.classic.AsyncAppender">
+ <appender-ref ref="DEBUG_ROLLING" />
+ </appender>
+
+ <appender name="ASYNC_TRANSACTION" class="ch.qos.logback.classic.AsyncAppender">
+ <appender-ref ref="TRANSACTION_ROLLING" />
+ </appender>
+
+ <appender name="ASYNC_ERROR" class="ch.qos.logback.classic.AsyncAppender">
+ <appender-ref ref="ERROR_ROLLING" />
+ </appender>
+
+
+ <root level="INFO">
+ <appender-ref ref="ASYNC_ERROR" />
+ <appender-ref ref="ASYNC_DEBUG" />
+ <appender-ref ref="AUDIT_ROLLING" />
+ <appender-ref ref="ASYNC_TRANSACTION" />
+ <if condition='property("enable-all-log").equalsIgnoreCase("true")'>
+ <then>
+ <appender-ref ref="ALL_ROLLING" />
+ </then>
+ </if>
+ </root>
+
+ <logger name="org.openecomp.sdc" level="INFO" />
+
+ <logger name="org.openecomp.core" level="DEBUG" additivity="false">
+ <appender-ref ref="MIGRATION_DEBUG_ROLLING" />
+ </logger>
+</configuration>
+
+
diff --git a/openecomp-be/tools/zusammen-tools/src/main/resources/zusammenMainTool.sh b/openecomp-be/tools/zusammen-tools/src/main/resources/zusammenMainTool.sh
new file mode 100644
index 0000000000..da043b130d
--- /dev/null
+++ b/openecomp-be/tools/zusammen-tools/src/main/resources/zusammenMainTool.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+###########################################################################################################
+# script name - cassandra2zusammen.sh
+# run script - ./cassandra2zusammen.sh
+# This script migrates ASDC 1st class citizen entities and their sub-entities from Cassandra to
+# Zusammen.
+# This script should be run when upgrading from 1702 to 1707
+###########################################################################################################
+
+
+# change exist package and service templates in db
+java -Dlog.home=/apps/jetty/base/be/logs -Dconfiguration.yaml=/apps/jetty/base/be/config/catalog-be/configuration.yaml -jar openecomp-zusammen-tools-1.0-SNAPSHOT.jar org.openecomp.core.tools.main.ZusammenMainTool $1 $2 $3 $4 $5 $6
+STATUS="${?}" echo "${STATUS}" echo "All log messages for the zusammenMainTool migration process are in /apps/jetty/base/be/logs/ASDC/ASDC-BE/zusammen_tool_debug.log"