summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshrek2000 <orenkle@amdocs.com>2017-09-11 15:45:37 +0300
committershrek2000 <orenkle@amdocs.com>2017-09-12 10:38:35 +0300
commitc8a540b3c234449163f6fb1899807bba951113b4 (patch)
treea8aae0dd0f6a0feb27369914e9e3fa321740e7ed
parent82d454fd3e8c9fdf66517d01a99019a379dbfdb6 (diff)
Create new VSP, onboard from TOSCA file - UI
Change-Id: I018c6d07a4b9ec7e6b1507ab37e2550865423cfe Issue-ID: SDC-230 Signed-off-by: shrek2000 <orenkle@amdocs.com>
-rw-r--r--common/openecomp-common-configuration-management/openecomp-configuration-management-core/pom.xml54
-rw-r--r--common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-test/dependency-reduced-pom.xml1
-rw-r--r--common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/capabilities.yml50
-rw-r--r--common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/data.yml223
-rw-r--r--common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/nodes.yml536
-rw-r--r--common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/relationships.yml12
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/pom.xml4
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentProcesses.java19
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/OrchestrationTemplateCandidate.java3
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapUploadFileResponseToUploadFileResponseDto.java2
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVersionedVendorSoftwareProductInfoToVspDetailsDto.java2
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetails.java2
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java29
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java35
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/OnboardingMethod.java2
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/UploadFileResponseDto.java17
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDescriptionDto.java18
-rw-r--r--openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDetailsDto.java16
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/C36B4399FCB942B19D493F839CFA10E2_0_1_General_6E70545C4854465D82DBDB9BCBEF0FB51
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml27
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/OrchestrationTemplateCandidateManager.java5
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImpl.java5
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java427
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java21
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/BaseOrchestrationTemplateHandler.java100
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java154
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateFileHandler.java12
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateZipHandler.java55
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUploadFactory.java29
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUtil.java282
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/CSARConstants.java18
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingManifest.java141
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationProcessFactory.java64
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java133
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessHandler.java12
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessZipHandler.java184
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ConfigConstants.java6
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileResponse.java19
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/resources/config-orchestration.json26
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/resources/orchestrationConfiguration.json3
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/QuestionnaireDataServiceTest.java5
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImplTest.java8
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java188
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java139
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/ManifestParsingTest.java58
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/UploadCSARFileTest.java221
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmock.csarbin0 -> 4211 bytes
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockBrokenMF.csarbin0 -> 4022 bytes
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockFail1.csarbin0 -> 4372 bytes
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockFail2.csarbin0 -> 3263 bytes
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockFail3.csarbin0 -> 4521 bytes
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf11
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf18
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf7
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf12
-rw-r--r--openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf15
-rw-r--r--openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java14
-rw-r--r--openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/CommonUtil.java47
-rw-r--r--openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/SdcCommon.java1
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java14
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/orchestration/OnboardingTypesEnum.java32
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/pom.xml7
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java5
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/FileDataStructureHealer.java3
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/HeatToToscaTranslationHealer.java3
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspOnboardingMethodHealer.java32
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/test/java/org/openecomp/sdc/healing/healers/VspOnboardingMethodHealerTest.java70
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/pom.xml27
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/ToscaTreeManager.java79
-rw-r--r--openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/messages/AuditMessages.java1
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml5
-rw-r--r--openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/ServiceModelDaoZusammenImpl.java2
-rw-r--r--openecomp-be/lib/openecomp-sdc-orchestration-lib/openecomp-sdc-orchesrtation-api/pom.xml37
-rw-r--r--openecomp-be/lib/openecomp-sdc-orchestration-lib/openecomp-sdc-orchesrtation-core/pom.xml42
-rw-r--r--openecomp-be/lib/openecomp-sdc-orchestration-lib/openecomp-sdc-orchesrtation-impl/pom.xml30
-rw-r--r--openecomp-be/lib/openecomp-sdc-orchestration-lib/pom.xml23
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetails.java22
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/filedatastructuremodule/CandidateService.java9
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/utils/CandidateEntityBuilder.java8
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java10
-rw-r--r--openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/filedatastructuremodule/CandidateServiceImpl.java33
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/pom.xml35
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/ServiceTemplateReaderService.java24
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/ToscaConverter.java12
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/api/ToscaConverterManager.java9
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/Constants.java45
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/CsarFileTypes.java9
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/factory/ToscaConverterFactory.java12
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/resources/factoryConfiguration.json3
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/pom.xml51
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/GlobalSubstitutionServiceTemplate.java59
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java446
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterManagerImpl.java49
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/factory/ToscaConverterFactoryImpl.java12
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java76
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/resources/ToscaConverters.json3
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConverterImplTest.java193
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConvertorDefinitionsTest.java62
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/csar/vCSCF.csarbin0 -> 8186 bytes
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/Artifacts/checksum.lst1
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/Artifacts/csar.meta3
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/Definitions/GlobalSubstitutionTypesServiceTemplate.yaml60
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.mf12
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.yaml551
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/TOSCA-Metadata/TOSCA.meta135
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml546
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/pom.xml23
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaServiceModel.java18
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java3
-rw-r--r--openecomp-be/lib/pom.xml2
-rw-r--r--openecomp-be/pom.xml2
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/resources/zusammenMainTool.sh18
-rw-r--r--openecomp-ui/resources/scss/modules/_softwareProductLandingPage.scss42
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js18
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/OnboardingPunchOut.jsx21
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js24
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js22
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js10
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductReducer.js2
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js12
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsActionHelper.js26
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsConstants.js6
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsReducer.js25
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx42
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationReducer.js11
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationView.jsx6
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreationView.jsx8
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPage.js5
-rw-r--r--openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx41
-rw-r--r--openecomp-ui/test/softwareProduct/attachments/SoftwareProductAttachmentsView.test.js5
130 files changed, 5886 insertions, 901 deletions
diff --git a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/pom.xml b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/pom.xml
index 609e8abdf7..186a50849a 100644
--- a/common/openecomp-common-configuration-management/openecomp-configuration-management-core/pom.xml
+++ b/common/openecomp-common-configuration-management/openecomp-configuration-management-core/pom.xml
@@ -24,62 +24,62 @@
<artifactId>jackson-dataformat-yaml</artifactId>
<version>${jackson.version}</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
<version>2.1</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>${commons.beanutils.version}</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>com.github.adejanovski</groupId>
<artifactId>cassandra-jdbc-wrapper</artifactId>
<version>${cassandra.version}</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-dbcp2</artifactId>
<version>2.0</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
<version>2.4.2</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons.io.version}</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>net.sf.corn</groupId>
<artifactId>corn-cps</artifactId>
<version>1.1.7</version>
<exclusions>
- <exclusion>
- <groupId>com.sun</groupId>
- <artifactId>tools</artifactId>
- </exclusion>
- </exclusions>
+ <exclusion>
+ <groupId>com.sun</groupId>
+ <artifactId>tools</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
- <groupId>com.virtlink.commons</groupId>
- <artifactId>commons-configuration2-jackson</artifactId>
- <version>0.6.1</version>
- </dependency>
+ <groupId>com.virtlink.commons</groupId>
+ <artifactId>commons-configuration2-jackson</artifactId>
+ <version>0.6.1</version>
+ </dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
@@ -95,16 +95,16 @@
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-ext</artifactId>
- <version>${slf4j.version}</version>
- </dependency>
<dependency>
- <groupId>org.openecomp.sdc.common</groupId>
- <artifactId>openecomp-configuration-management-api</artifactId>
- <version>1.1.0-SNAPSHOT</version>
- </dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-ext</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc.common</groupId>
+ <artifactId>openecomp-configuration-management-api</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-test/dependency-reduced-pom.xml b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-test/dependency-reduced-pom.xml
index a71fe7feaa..5a51961846 100644
--- a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-test/dependency-reduced-pom.xml
+++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-test/dependency-reduced-pom.xml
@@ -7,7 +7,6 @@
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
- <groupId>org.openecomp.sdc.common</groupId>
<artifactId>openecomp-sdc-artifact-generator-test</artifactId>
<build>
<plugins>
diff --git a/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/capabilities.yml b/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/capabilities.yml
index 77d8eb9857..e395e3fc27 100644
--- a/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/capabilities.yml
+++ b/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/capabilities.yml
@@ -98,3 +98,53 @@ capability_types:
description: Runtime monitored value
type: string
status: SUPPORTED
+
+ tosca.capabilities.nfv.VirtualLinkable:
+ derived_from: tosca.capabilities.Root
+
+ tosca.capabilities.nfv.Metric:
+ derived_from: tosca.capabilities.Root
+
+ tosca.capabilities.nfv.VirtualBindable:
+ derived_from: tosca.capabilities.Root
+
+ tosca.capabilities.nfv.VirtualCompute:
+ derived_from: tosca.capabilities.Root
+ properties:
+ virtual_memory:
+ type: tosca.datatypes.nfv.VirtualMemory
+ requested_additional_capabilities:
+ entry_schema:
+ type: tosca.datatypes.nfv.RequestedAdditionalCapability
+ required: false
+ type: map
+ virtual_cpu:
+ type: tosca.datatypes.nfv.VirtualCpu
+
+
+ tosca.capabilities.nfv.VirtualStorage:
+ derived_from: tosca.capabilities.Root
+
+ tosca.capabilities.nfv.Forwarder:
+ derived_from: tosca.capabilities.Root
+
+ tosca.capabilities.nfv.ext.Compute.Container.Architecture:
+ derived_from: tosca.capabilities.Root
+ properties:
+ num_cpus:
+ required: false
+ type: string
+ flavor_extra_specs:
+ entry_schema:
+ type: string
+ required: false
+ type: map
+ mem_size:
+ required: false
+ type: string
+
+ tosca.capabilities.nfv.ext.ImageFile:
+ derived_from: tosca.capabilities.Root
+
+ tosca.capabilities.nfv.ext.LocalAttachment:
+ derived_from: tosca.capabilities.Root \ No newline at end of file
diff --git a/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/data.yml b/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/data.yml
index c7ce3c13e0..85ff50c112 100644
--- a/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/data.yml
+++ b/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/data.yml
@@ -554,4 +554,225 @@ data_types:
description: Hash type
required: false
default: md5
-
+
+ tosca.datatypes.nfv.RequestedAdditionalCapability:
+ derived_from: tosca.datatypes.Root
+ properties:
+ support_mandatory:
+ type: boolean
+ required: true
+ min_requested_additional_capability_version:
+ type: string
+ required: false
+ preferred_requested_additional_capability_version:
+ type: string
+ required: false
+ requested_additional_capability_name:
+ type: string
+ required: true
+ target_performance_parameters:
+ type: map
+ entry_schema:
+ type: string
+ required: true
+ tosca.datatypes.nfv.VirtualMemory:
+ derived_from: tosca.datatypes.Root
+ properties:
+ virtual_mem_size:
+ type: string
+ required: true
+ virtual_mem_oversubscription_policy:
+ type: string
+ required: false
+ numa_enabled:
+ type: boolean
+ required: false
+ tosca.datatypes.nfv.VirtualCpu:
+ derived_from: tosca.datatypes.Root
+ properties:
+ cpu_architecture:
+ type: string
+ required: false
+ num_virtual_cpu:
+ type: integer
+ required: true
+ virtual_cpu_clock:
+ type: scalar-unit.frequency
+ required: false
+ virtual_cpu_oversubscription_policy:
+ type: string
+ required: false
+ virtual_cpu_pinning:
+ type: tosca.datatypes.nfv.VirtualCpuPinning
+ required: false
+ tosca.datatypes.nfv.VirtualCpuPinning:
+ derived_from: tosca.datatypes.Root
+ properties:
+ cpu_pinning_policy:
+ type: string
+ constraints:
+ - valid_values: [ static, dynamic ]
+ required: false
+ cpu_pinning_map:
+ type: map
+ entry_schema:
+ type: string
+ required: false
+ tosca.datatypes.nfv.VnfcConfigurableProperties:
+ properties:
+ additional_vnfc_configurable_properties:
+ entry_schema:
+ type: string
+ required: false
+ type: map
+ tosca.datatypes.network.NetworkInfo:
+ properties:
+ network_id:
+ required: false
+ type: string
+ addresses:
+ entry_schema:
+ type: string
+ required: false
+ type: list
+ network_name:
+ required: false
+ type: string
+ tosca.datatypes.network.PortInfo:
+ properties:
+ port_name:
+ required: false
+ type: string
+ network_id:
+ required: false
+ type: string
+ addresses:
+ entry_schema:
+ type: string
+ required: false
+ type: list
+ mac_address:
+ required: false
+ type: string
+ port_id:
+ required: false
+ type: string
+ tosca.datatypes.nfv.L3AddressData:
+ properties:
+ number_of_ip_address:
+ required: false
+ type: integer
+ ip_address_assignment:
+ type: boolean
+ ip_address_type:
+ constraints:
+ - valid_values:
+ - ipv4
+ - ipv6
+ required: false
+ type: string
+ floating_ip_activated:
+ type: string
+ tosca.datatypes.nfv.VirtualNetworkInterfaceRequirements:
+ properties:
+ name:
+ required: false
+ type: string
+ support_mandatory:
+ type: boolean
+ description:
+ required: false
+ type: string
+ requirement:
+ entry_schema:
+ type: string
+ type: map
+ tosca.datatype.nfv.AddressData:
+ properties:
+ address_type:
+ constraints:
+ - valid_values:
+ - mac_address
+ - ip_address
+ type: string
+ l2_address_data:
+ required: false
+ type: tosca.datatypes.nfv.L2AddressData
+ l3_address_data:
+ required: false
+ type: tosca.datatypes.nfv.L3AddressData
+ tosca.datatypes.nfv.L2AddressData: {}
+ tosca.datatypes.nfv.ConnectivityType:
+ properties:
+ layer_protocol:
+ constraints:
+ - valid_values:
+ - ethernet
+ - mpls
+ - odu2
+ - ipv4
+ - ipv6
+ - pseudo_wire
+ type: string
+ flow_pattern:
+ required: false
+ type: string
+ tosca.datatypes.nfv.ext.FloatingIP:
+ properties:
+ external_network:
+ required: false
+ type: string
+ ip_address:
+ required: false
+ type: string
+ tosca.datatypes.nfv.ext.AddressPairs:
+ properties:
+ ip:
+ required: false
+ type: string
+ mac:
+ required: false
+ type: string
+ tosca.datatypes.nfv.ext.InjectData:
+ properties:
+ file_name:
+ required: false
+ type: string
+ file_data:
+ required: false
+ type: string
+ tosca.datatypes.nfv.ext.zte.WatchDog:
+ properties:
+ enable_delay:
+ required: false
+ type: integer
+ action:
+ required: false
+ type: string
+ tosca.datatypes.nfv.ext.LocalAffinityOrAntiAffinityRule:
+ properties:
+ scope:
+ required: false
+ type: string
+ affinity_antiaffinity:
+ required: false
+ type: string
+ tosca.datatypes.nfv.ext.LocationInfo:
+ properties:
+ availability_zone:
+ required: false
+ type: string
+ vimid:
+ required: false
+ type: integer
+ tenant:
+ required: false
+ type: string
+ tosca.datatypes.nfv.ext.HostRouteInfo:
+ properties:
+ destination:
+ required: false
+ type: string
+ nexthop:
+ required: false
+ type: string \ No newline at end of file
diff --git a/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/nodes.yml b/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/nodes.yml
index fb2e030a06..aaff11b0ed 100644
--- a/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/nodes.yml
+++ b/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/nodes.yml
@@ -569,4 +569,538 @@ node_types:
type: map
entry_schema:
type: org.openecomp.datatypes.ImageInfo
- required: false \ No newline at end of file
+ required: false
+ tosca.nodes.nfv.NS.vEPC_NS:
+ derived_from: tosca.nodes.nfv.NS
+ properties:
+ vendor:
+ default: ChinaMobile
+ required: false
+ type: string
+ csarVersion:
+ default: v1.0
+ required: false
+ type: string
+ name:
+ default: vEPC_NS
+ required: false
+ type: string
+ csarProvider:
+ default: ChinaMobile
+ required: false
+ type: string
+ id:
+ default: vEPC_NS
+ required: false
+ type: string
+ version:
+ default: v1.0
+ required: false
+ type: string
+ csarType:
+ default: NSAR
+ required: false
+ type: string
+ requirements:
+ - virtualLink:
+ capability: tosca.capabilities.nfv.VirtualLinkable
+ occurrences:
+ - 0
+ - UNBOUNDED
+
+ tosca.nodes.nfv.NS.vIMS_NS:
+ derived_from: tosca.nodes.nfv.NS
+ properties:
+ vendor:
+ default: ChinaMobile
+ required: false
+ type: string
+ csarVersion:
+ default: v1.0
+ required: false
+ type: string
+ name:
+ default: vIMS_NS
+ required: false
+ type: string
+ csarProvider:
+ default: ChinaMobile
+ required: false
+ type: string
+ id:
+ default: vIMS_NS
+ required: false
+ type: string
+ version:
+ default: v1.0
+ required: false
+ type: string
+ csarType:
+ default: NSAR
+ required: false
+ type: string
+ requirements:
+ - virtualLink:
+ capability: tosca.capabilities.nfv.VirtualLinkable
+ occurrences:
+ - 0
+ - UNBOUNDED
+
+ tosca.nodes.nfv.NS:
+ derived_from: tosca.nodes.Root
+ properties:
+ vendor:
+ required: false
+ type: string
+ name:
+ required: false
+ type: string
+ id:
+ required: false
+ type: string
+ version:
+ required: false
+ type: string
+ requirements:
+ - virtualLink:
+ capability: tosca.capabilities.nfv.VirtualLinkable
+ occurrences:
+ - 0
+ - UNBOUNDED
+
+ tosca.nodes.nfv.VDU.Compute:
+ attributes:
+ private_address:
+ type: string
+ public_address:
+ type: string
+ networks:
+ type: string
+ ports:
+ type: string
+ capabilities:
+ scalable:
+ type: tosca.capabilities.Scalable
+ virtual_compute:
+ type: tosca.capabilities.nfv.VirtualCompute
+ endpoint:
+ type: tosca.capabilities.Endpoint.Admin
+ os:
+ type: tosca.capabilities.OperatingSystem
+ virtual_binding:
+ type: tosca.capabilities.nfv.VirtualBindable
+ host:
+ type: tosca.capabilities.Container
+ binding:
+ type: tosca.capabilities.network.Bindable
+ monitoring_parameter:
+ type: tosca.capabilities.nfv.Metric
+ derived_from: tosca.nodes.Root
+ properties:
+ configurable_properties:
+ entry_schema:
+ type: tosca.datatypes.nfv.VnfcConfigurableProperties
+ type: map
+ name:
+ type: string
+ nfvi_constraints:
+ entry_schema:
+ type: string
+ required: false
+ type: list
+ descrption:
+ type: string
+ boot_order:
+ entry_schema:
+ type: string
+ required: false
+ type: list
+ requirements:
+ - local_storage:
+ capability: tosca.capabilities.Attachment
+ occurrences:
+ - 0
+ - UNBOUNDED
+ - virtual_storage:
+ capability: tosca.capabilities.nfv.VirtualStorage
+ occurrences:
+ - 0
+ - UNBOUNDED
+
+ tosca.nodes.nfv.VDU.VirtualStorage:
+ capabilities:
+ virtual_storage:
+ type: tosca.capabilities.nfv.VirtualStorage
+ derived_from: tosca.nodes.Root
+ properties:
+ id:
+ type: string
+ size_of_storage:
+ type: string
+ rdma_enabled:
+ required: false
+ type: boolean
+ type_of_storage:
+ type: string
+
+ tosca.nodes.nfv.VduCpd:
+ derived_from: tosca.nodes.Root
+ properties:
+ virtual_network_interface_requirements:
+ entry_schema:
+ type: tosca.datatypes.nfv.VirtualNetworkInterfaceRequirements
+ required: false
+ type: list
+ role:
+ constraints:
+ - valid_values:
+ - root
+ - leaf
+ required: false
+ type: string
+ bitrate_requirement:
+ required: false
+ type: integer
+ description:
+ required: false
+ type: string
+ layer_protocol:
+ constraints:
+ - valid_values:
+ - ethernet
+ - mpls
+ - odu2
+ - ipv4
+ - ipv6
+ - pseudo_wire
+ type: string
+ address_data:
+ entry_schema:
+ type: tosca.datatype.nfv.AddressData
+ required: false
+ type: list
+ requirements:
+ - virtual_binding:
+ capability: tosca.capabilities.nfv.VirtualBindable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ - virtual_link:
+ capability: tosca.capabilities.nfv.VirtualBindable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ tosca.nodes.nfv.ext.ImageFile:
+ capabilities:
+ guest_os:
+ type: tosca.capabilities.nfv.ext.GuestOs
+ image_fle:
+ type: tosca.capabilities.nfv.ext.ImageFile
+ derived_from: tosca.nodes.Root
+ properties:
+ file_url:
+ required: false
+ type: string
+ container_type:
+ required: false
+ type: string
+ name:
+ required: false
+ type: string
+ disk_format:
+ required: false
+ type: string
+ version:
+ required: false
+ type: string
+ tosca.nodes.nfv.ext.LocalStorage:
+ capabilities:
+ local_attachment:
+ type: tosca.capabilities.nfv.ext.LocalAttachment
+ derived_from: tosca.nodes.Root
+ properties:
+ size:
+ required: false
+ type: string
+ disk_type:
+ required: false
+ type: string
+ tosca.nodes.nfv.ext.zte.CP:
+ capabilities:
+ forwarder:
+ type: tosca.capabilities.nfv.Forwarder
+ derived_from: tosca.nodes.Root
+ properties:
+ guest_os_mtu:
+ required: false
+ type: integer
+ bandwidth:
+ required: false
+ type: integer
+ interface_name:
+ required: false
+ type: string
+ allowed_address_pairs:
+ entry_schema:
+ type: tosca.datatypes.nfv.ext.AddressPairs
+ required: false
+ type: list
+ ip_address:
+ required: false
+ type: string
+ bond:
+ required: false
+ type: string
+ proxiedVNFs:
+ entry_schema:
+ type: string
+ required: false
+ type: list
+ sfc_encapsulation:
+ required: false
+ type: string
+ floating_ip_address:
+ required: false
+ type: tosca.datatypes.nfv.ext.FloatingIP
+ service_ip_address:
+ required: false
+ type: string
+ mac_address:
+ required: false
+ type: string
+ proxiedVNFtype:
+ required: false
+ type: string
+ macbond:
+ required: false
+ type: string
+ vnic_type:
+ required: false
+ type: string
+ direction:
+ required: false
+ type: string
+ order:
+ required: false
+ type: integer
+ requirements:
+ - forwarder:
+ capability: tosca.capabilities.nfv.Forwarder
+ occurrences:
+ - 0
+ - UNBOUNDED
+ - virtualbinding:
+ capability: tosca.capabilities.nfv.VirtualBindable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ - virtualLink:
+ capability: tosca.capabilities.nfv.VirtualBindable
+ occurrences:
+ - 0
+ - UNBOUNDED
+ tosca.nodes.nfv.ext.zte.VDU:
+ capabilities:
+ scalable:
+ type: tosca.capabilities.Scalable
+ monitoring_parameter:
+ type: tosca.capabilities.nfv.Metric
+ nfv_compute:
+ type: tosca.capabilities.nfv.ext.Compute.Container.Architecture
+ virtualbinding:
+ type: tosca.capabilities.nfv.VirtualBindable
+ derived_from: tosca.nodes.Root
+ properties:
+ manual_scale_select_vim:
+ required: false
+ type: boolean
+ vdu_type:
+ required: false
+ type: string
+ watchdog:
+ required: false
+ type: tosca.datatypes.nfv.ext.zte.WatchDog
+ name:
+ required: false
+ type: string
+ local_affinity_antiaffinity_rule:
+ required: false
+ type: tosca.datatypes.nfv.ext.LocalAffinityOrAntiAffinityRule
+ support_scaling:
+ required: false
+ type: boolean
+ storage_policy:
+ required: false
+ type: string
+ key_vdu:
+ required: false
+ type: boolean
+ location_info:
+ required: false
+ type: tosca.datatypes.nfv.ext.LocationInfo
+ inject_data_list:
+ entry_schema:
+ type: tosca.datatypes.nfv.ext.InjectData
+ required: false
+ type: list
+ requirements:
+ - guest_os:
+ capability: tosca.capabilities.nfv.ext.GuestOs
+ occurrences:
+ - 0
+ - UNBOUNDED
+ - local_storage:
+ capability: tosca.capabilities.nfv.ext.LocalAttachment
+ occurrences:
+ - 0
+ - UNBOUNDED
+ - volume_storage:
+ capability: tosca.capabilities.Attachment
+ occurrences:
+ - 0
+ - UNBOUNDED
+ - dependency:
+ capability: tosca.capabilities.Node
+ occurrences:
+ - 0
+ - UNBOUNDED
+ tosca.nodes.nfv.ext.zte.VL:
+ capabilities:
+ virtual_linkable:
+ type: tosca.capabilities.nfv.VirtualLinkable
+ derived_from: tosca.nodes.Root
+ properties:
+ segmentation_id:
+ required: false
+ type: string
+ network_name:
+ required: false
+ type: string
+ is_predefined:
+ required: false
+ type: boolean
+ mtu:
+ required: false
+ type: integer
+ dns_nameservers:
+ entry_schema:
+ type: string
+ required: false
+ type: list
+ physical_network:
+ required: false
+ type: string
+ dhcp_enabled:
+ required: false
+ type: boolean
+ network_id:
+ required: false
+ type: string
+ host_routes:
+ entry_schema:
+ type: tosca.datatypes.nfv.ext.HostRouteInfo
+ required: false
+ type: list
+ ip_version:
+ required: false
+ type: integer
+ vendor:
+ required: false
+ type: string
+ name:
+ required: false
+ type: string
+ start_ip:
+ required: false
+ type: string
+ vlan_transparent:
+ required: false
+ type: boolean
+ cidr:
+ required: false
+ type: string
+ gateway_ip:
+ required: false
+ type: string
+ network_type:
+ required: false
+ type: string
+ end_ip:
+ required: false
+ type: string
+ location_info:
+ required: false
+ type: tosca.datatypes.nfv.ext.LocationInfo
+ tosca.nodes.nfv.ext.zte.VNF:
+ capabilities:
+ forwarder:
+ type: tosca.capabilities.nfv.Forwarder
+ derived_from: tosca.nodes.Root
+ properties:
+ request_reclassification:
+ required: false
+ type: boolean
+ domain_type:
+ required: false
+ type: string
+ nsh_aware:
+ required: false
+ type: boolean
+ plugin_info:
+ required: false
+ type: string
+ adjust_vnf_capacity:
+ required: false
+ type: boolean
+ vnfd_version:
+ required: false
+ type: string
+ vmnumber_overquota_alarm:
+ required: false
+ type: boolean
+ custom_properties:
+ entry_schema:
+ type: string
+ required: false
+ type: map
+ version:
+ required: false
+ type: string
+ cross_dc:
+ required: false
+ type: boolean
+ script_info:
+ required: false
+ type: string
+ vendor:
+ required: false
+ type: string
+ is_shared:
+ required: false
+ type: boolean
+ name:
+ required: false
+ type: string
+ vnf_extend_type:
+ required: false
+ type: string
+ id:
+ required: false
+ type: string
+ vnf_type:
+ required: false
+ type: string
+ is_sfc_proxy:
+ required: false
+ type: boolean
+ requirements:
+ - forwarder:
+ capability: tosca.capabilities.nfv.Forwarder
+ occurrences:
+ - 0
+ - UNBOUNDED
+ - virtualLink:
+ capability: tosca.capabilities.nfv.VirtualLinkable
+ occurrences:
+ - 0
+ - UNBOUNDED \ No newline at end of file
diff --git a/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/relationships.yml b/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/relationships.yml
index 6243cfa5d1..220658a8bf 100644
--- a/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/relationships.yml
+++ b/common/openecomp-tosca-datatype/src/main/resources/globalTypes/openecomp/relationships.yml
@@ -54,3 +54,15 @@ relationship_types:
status: SUPPORTED
required: false
+ tosca.relationships.nfv.VDU.AttachedTo:
+ derived_from: tosca.relationships.Root
+ properties:
+ location:
+ required: false
+ type: string
+
+ tosca.relationships.nfv.VirtualBindsTo:
+ derived_from: tosca.relationships.Root
+
+ tosca.relationships.nfv.VirtualLinksTo:
+ derived_from: tosca.relationships.Root \ No newline at end of file
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/pom.xml b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/pom.xml
index f146881751..d65e9e6b27 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/pom.xml
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/pom.xml
@@ -102,11 +102,11 @@
<artifactId>woodstox-core-asl</artifactId>
<version>${woodstox.version}</version>
</dependency>
- <dependency>
+ <!--dependency>
<groupId>org.openecomp.sdc</groupId>
<artifactId>openecomp-sdc-vendor-software-product-manager</artifactId>
<version>${project.version}</version>
- </dependency>
+ </dependency-->
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-multipart</artifactId>
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentProcesses.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentProcesses.java
index ca50ef1426..edb3b5bfc2 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentProcesses.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/ComponentProcesses.java
@@ -20,35 +20,24 @@
package org.openecomp.sdcrests.vsp.rest;
-import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
-import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
-
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
-import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessEntityDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.ProcessRequestDto;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.HeaderParam;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
+import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import static org.openecomp.sdcrests.common.RestConstants.USER_ID_HEADER_PARAM;
+import static org.openecomp.sdcrests.common.RestConstants.USER_MISSING_ERROR_MSG;
+
@Path("/v1.0/vendor-software-products/{vspId}/versions/{versionId}/components/{componentId}/processes")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/OrchestrationTemplateCandidate.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/OrchestrationTemplateCandidate.java
index fbf29185e3..fa7f421fc8 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/OrchestrationTemplateCandidate.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/OrchestrationTemplateCandidate.java
@@ -23,6 +23,7 @@ package org.openecomp.sdcrests.vsp.rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
+import org.apache.cxf.jaxrs.ext.multipart.Attachment;
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
import org.openecomp.sdc.vendorsoftwareproduct.types.FileDataStructureDto;
import org.openecomp.sdcrests.vendorsoftwareproducts.types.UploadFileResponseDto;
@@ -61,7 +62,7 @@ public interface OrchestrationTemplateCandidate extends VspEntities {
Response upload(
@PathParam("vspId") String vspId,
@ApiParam(value = "Version Id") @PathParam("versionId") String versionId,
- @Multipart("upload") InputStream heatFileToUpload,
+ @Multipart("upload") Attachment fileToUpload,
@NotNull(message = USER_MISSING_ERROR_MSG) @HeaderParam(USER_ID_HEADER_PARAM) String user);
@GET
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapUploadFileResponseToUploadFileResponseDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapUploadFileResponseToUploadFileResponseDto.java
index cccfd02371..48053d053d 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapUploadFileResponseToUploadFileResponseDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapUploadFileResponseToUploadFileResponseDto.java
@@ -34,5 +34,7 @@ public class MapUploadFileResponseToUploadFileResponseDto
public void doMapping(UploadFileResponse source, UploadFileResponseDto target) {
target.setStatus(source.getStatus());
target.setErrors(source.getErrors());
+ target.setOnboardingOrigin(source.getOnboardingType().toString());
+ target.setNetworkPackageName(source.getNetworkPackageName());
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVersionedVendorSoftwareProductInfoToVspDetailsDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVersionedVendorSoftwareProductInfoToVspDetailsDto.java
index 9093da599f..815135f834 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVersionedVendorSoftwareProductInfoToVspDetailsDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVersionedVendorSoftwareProductInfoToVspDetailsDto.java
@@ -45,8 +45,10 @@ public class MapVersionedVendorSoftwareProductInfoToVspDetailsDto
target.setSubCategory(vsp.getSubCategory());
target.setVendorId(vsp.getVendorId());
target.setVendorName(vsp.getVendorName());
+ target.setOnboardingOrigin(vsp.getOnboardingOrigin());
target.setLicensingVersion(vsp.getVlmVersion() == null ? null : new VersionDto(vsp.getVlmVersion().toString(), vsp.getVlmVersion().toString()));
target.setIsOldVersion("False");
+ target.setNetworkPackageName(vsp.getNetworkPackageName());
if (vsp.getLicenseAgreement() != null || vsp.getFeatureGroups() != null) {
LicensingData licensingData = new LicensingData();
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetails.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetails.java
index 9808bbb2b6..ba3d92e5d2 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetails.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/mapping/MapVspDescriptionDtoToVspDetails.java
@@ -39,6 +39,8 @@ public class MapVspDescriptionDtoToVspDetails extends MappingBase<VspDescription
target.setVendorName(source.getVendorName());
target.setVendorId(source.getVendorId());
target.setOnboardingMethod(source.getOnboardingMethod());
+ target.setOnboardingOrigin(source.getOnboardingOrigin());
+ target.setNetworkPackageName(source.getNetworkPackageName());
VersionDto vlmVersion = source.getLicensingVersion();
if (vlmVersion != null) {
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java
index 0793e9473e..4c6cdaa54d 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/OrchestrationTemplateCandidateImpl.java
@@ -1,10 +1,11 @@
package org.openecomp.sdcrests.vsp.rest.services;
import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.cxf.jaxrs.ext.multipart.Attachment;
+import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder;
import org.openecomp.sdc.common.errors.Messages;
-import org.openecomp.sdc.datatypes.error.ErrorLevel;
-import org.openecomp.sdc.datatypes.error.ErrorMessage;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.logging.context.MdcUtil;
@@ -32,10 +33,8 @@ import javax.ws.rs.core.Response;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
import java.util.Optional;
+import static org.openecomp.core.utilities.file.FileUtils.*;
@Named
@Service("orchestrationTemplateCandidate")
@@ -48,31 +47,35 @@ public class OrchestrationTemplateCandidateImpl implements OrchestrationTemplate
LoggerFactory.getLogger(OrchestrationTemplateCandidateImpl.class);
@Override
- public Response upload(String vspId, String versionId, InputStream heatFileToUpload,
+ public Response upload(String vspId, String versionId, Attachment fileToUpload,
String user) {
MdcUtil.initMdc(LoggerServiceName.Upload_File.toString());
logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.UPLOAD_HEAT + vspId);
-
+ String filename = fileToUpload.getContentDisposition().getParameter("filename");
UploadFileResponse uploadFileResponse = candidateManager
.upload(vspId, resolveVspVersion(vspId, null, user, VersionableEntityAction
- .Write), heatFileToUpload, user);
+ .Write), fileToUpload.getObject(InputStream.class), user, getFileExtension(filename),
+ FileUtils.getNetworkPackageName(filename));
UploadFileResponseDto uploadFileResponseDto = new MapUploadFileResponseToUploadFileResponseDto()
.applyMapping(uploadFileResponse, UploadFileResponseDto.class);
return Response.ok(uploadFileResponseDto).build();
}
+
+
@Override
public Response get(String vspId, String versionId, String user) throws IOException {
- Optional<byte[]> zipFile =
- candidateManager
- .get(vspId, resolveVspVersion(vspId, null, user, VersionableEntityAction.Read), user);
+
+ Optional<Pair<String, byte[]>> zipFile = candidateManager
+ .get(vspId, resolveVspVersion(vspId, null, user, VersionableEntityAction.Read), user);
if (!zipFile.isPresent()) {
return Response.status(Response.Status.NOT_FOUND).build();
}
- Response.ResponseBuilder response = Response.ok(zipFile.get());
- response.header("Content-Disposition", "attachment; filename=HeatCandidate.zip");
+ Response.ResponseBuilder response = Response.ok(zipFile.get().getRight());
+ String filename = "Candidate." + zipFile.get().getLeft();
+ response.header("Content-Disposition", "attachment; filename=" + filename);
return response.build();
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
index 8f2e73bff6..0b73cbcee6 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-services/src/main/java/org/openecomp/sdcrests/vsp/rest/services/VendorSoftwareProductsImpl.java
@@ -47,14 +47,7 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.VersionedVendorSoftwareProd
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.types.VersionInfo;
import org.openecomp.sdc.versioning.types.VersionableEntityAction;
-import org.openecomp.sdcrests.vendorsoftwareproducts.types.PackageInfoDto;
-import org.openecomp.sdcrests.vendorsoftwareproducts.types.QuestionnaireResponseDto;
-import org.openecomp.sdcrests.vendorsoftwareproducts.types.ValidationResponseDto;
-import org.openecomp.sdcrests.vendorsoftwareproducts.types.VersionSoftwareProductActionRequestDto;
-import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspComputeDto;
-import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspCreationDto;
-import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDescriptionDto;
-import org.openecomp.sdcrests.vendorsoftwareproducts.types.VspDetailsDto;
+import org.openecomp.sdcrests.vendorsoftwareproducts.types.*;
import org.openecomp.sdcrests.vsp.rest.VendorSoftwareProducts;
import org.openecomp.sdcrests.vsp.rest.mapping.MapComputeEntityToVspComputeDto;
import org.openecomp.sdcrests.vsp.rest.mapping.MapPackageInfoToPackageInfoDto;
@@ -100,9 +93,13 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
+ vspDescriptionDto.getName());
VspCreationDto vspCreationDto = null;
- switch (vspDescriptionDto.getOnboardingMethod()) {
- case "HEAT":
- case "Manual":
+ OnboardingMethod onboardingMethod = OnboardingMethod.valueOf(vspDescriptionDto.getOnboardingMethod());
+ if (onboardingMethod == null){
+ return handleUnkownOnboardingMethod();
+ }
+ switch (onboardingMethod) {
+ case NetworkPackage:
+ case Manual:
VspDetails vspDetails = new MapVspDescriptionDtoToVspDetails().
applyMapping(vspDescriptionDto, VspDetails.class);
@@ -112,17 +109,21 @@ public class VendorSoftwareProductsImpl implements VendorSoftwareProducts {
vspCreationDto = mapping.applyMapping(vspDetails, VspCreationDto.class);
break;
default:
- ErrorCode onboardingMethodUpdateErrorCode = OnboardingMethodErrorBuilder
- .getInvalidOnboardingMethodErrorBuilder();
- MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
- LoggerTragetServiceName.ADD_VSP, ErrorLevel.ERROR.name(),
- LoggerErrorCode.DATA_ERROR.getErrorCode(), onboardingMethodUpdateErrorCode.message());
- throw new CoreException(onboardingMethodUpdateErrorCode);
+ return handleUnkownOnboardingMethod();
}
return Response.ok(vspCreationDto).build();
}
+ private Response handleUnkownOnboardingMethod() {
+ ErrorCode onboardingMethodUpdateErrorCode = OnboardingMethodErrorBuilder
+ .getInvalidOnboardingMethodErrorBuilder();
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_API,
+ LoggerTragetServiceName.ADD_VSP, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.DATA_ERROR.getErrorCode(), onboardingMethodUpdateErrorCode.message());
+ throw new CoreException(onboardingMethodUpdateErrorCode);
+ }
+
@Override
public Response listVsps(String versionFilter, String user) {
MdcUtil.initMdc(LoggerServiceName.List_VSP.toString());
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/OnboardingMethod.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/OnboardingMethod.java
index 3059efb171..0db4b0476d 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/OnboardingMethod.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/OnboardingMethod.java
@@ -1,6 +1,6 @@
package org.openecomp.sdcrests.vendorsoftwareproducts.types;
public enum OnboardingMethod {
- HEAT,
+ NetworkPackage,
Manual;
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/UploadFileResponseDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/UploadFileResponseDto.java
index a79c70a4d2..3bf2e8ced1 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/UploadFileResponseDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/UploadFileResponseDto.java
@@ -32,6 +32,8 @@ import java.util.Map;
public class UploadFileResponseDto {
private Map<String, List<ErrorMessage>> errors;
private UploadFileStatus status;
+ private String onboardingOrigin;
+ private String networkPackageName;
public Map<String, List<ErrorMessage>> getErrors() {
return errors;
@@ -49,4 +51,19 @@ public class UploadFileResponseDto {
this.status = status;
}
+ public String getOnboardingOrigin() {
+ return onboardingOrigin;
+ }
+
+ public void setOnboardingOrigin(String onboardingOrigin) {
+ this.onboardingOrigin = onboardingOrigin;
+ }
+
+ public String getNetworkPackageName() {
+ return networkPackageName;
+ }
+
+ public void setNetworkPackageName(String networkPackageName) {
+ this.networkPackageName = networkPackageName;
+ }
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDescriptionDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDescriptionDto.java
index 80b68deeeb..9062f89d22 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDescriptionDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDescriptionDto.java
@@ -44,6 +44,8 @@ public class VspDescriptionDto {
@NotNull
private String onboardingMethod;
+ private String onboardingOrigin;
+ private String networkPackageName;
public String getName() {
return name;
@@ -124,4 +126,20 @@ public class VspDescriptionDto {
public void setOnboardingMethod(String onboardingMethod) {
this.onboardingMethod = onboardingMethod;
}
+
+ public String getOnboardingOrigin() {
+ return onboardingOrigin;
+ }
+
+ public void setOnboardingOrigin(String onboardingOrigin) {
+ this.onboardingOrigin = onboardingOrigin;
+ }
+
+ public String getNetworkPackageName() {
+ return networkPackageName;
+ }
+
+ public void setNetworkPackageName(String networkPackageName) {
+ this.networkPackageName = networkPackageName;
+ }
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDetailsDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDetailsDto.java
index d105acb406..28a77f2e66 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDetailsDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDetailsDto.java
@@ -41,7 +41,8 @@ public class VspDetailsDto extends VspDescriptionDto {
private String lockingUser;
private ValidationStructureList validationData;
private String isOldVersion;
-
+ private String onboardingOrigin;
+ private String networkPackageName;
public String getId() {
return id;
}
@@ -104,8 +105,21 @@ public class VspDetailsDto extends VspDescriptionDto {
public void setValidationData(ValidationStructureList validationData) {
this.validationData = validationData;
+ }
+
+ public String getOnboardingOrigin() {
+ return onboardingOrigin;
+ }
+ public void setOnboardingOrigin(String onboardingOrigin) {
+ this.onboardingOrigin = onboardingOrigin;
+ }
+ public String getNetworkPackageName() {
+ return networkPackageName;
}
+ public void setNetworkPackageName(String networkPackageName) {
+ this.networkPackageName = networkPackageName;
+ }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/C36B4399FCB942B19D493F839CFA10E2_0_1_General_6E70545C4854465D82DBDB9BCBEF0FB5 b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/C36B4399FCB942B19D493F839CFA10E2_0_1_General_6E70545C4854465D82DBDB9BCBEF0FB5
deleted file mode 100644
index 58e6f9e5e2..0000000000
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/C36B4399FCB942B19D493F839CFA10E2_0_1_General_6E70545C4854465D82DBDB9BCBEF0FB5
+++ /dev/null
@@ -1 +0,0 @@
-bla bla \ No newline at end of file
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml
index ba95d4a3e4..b3fc9aa797 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/pom.xml
@@ -16,6 +16,18 @@
<dependencies>
<dependency>
<groupId>org.openecomp.sdc.common</groupId>
+ <artifactId>openecomp-configuration-management-core</artifactId>
+ <version>${openecomp.sdc.common.version}</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc.common</groupId>
<artifactId>openecomp-tosca-datatype</artifactId>
<version>${openecomp.sdc.common.version}</version>
</dependency>
@@ -185,6 +197,21 @@
<artifactId>openecomp-sdc-tosca-generator-core</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-orchesrtation-core</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-tosca-converter-api</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-tosca-converter-core</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
</dependencies>
<build>
<plugins>
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/OrchestrationTemplateCandidateManager.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/OrchestrationTemplateCandidateManager.java
index e648ccef26..e2ef86149b 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/OrchestrationTemplateCandidateManager.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/OrchestrationTemplateCandidateManager.java
@@ -20,6 +20,7 @@
package org.openecomp.sdc.vendorsoftwareproduct;
+import org.apache.commons.lang3.tuple.Pair;
import org.openecomp.sdc.vendorsoftwareproduct.types.OrchestrationTemplateActionResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.ValidationResponse;
@@ -32,7 +33,7 @@ import java.util.Optional;
public interface OrchestrationTemplateCandidateManager {
UploadFileResponse upload(String vspId, Version version, InputStream heatFileToUpload,
- String user);
+ String user, String filePrefix, String networkPackageName);
OrchestrationTemplateActionResponse process(String vspId, Version version, String user);
@@ -41,5 +42,5 @@ public interface OrchestrationTemplateCandidateManager {
ValidationResponse updateFilesDataStructure(String vspId, Version version, String user,
FilesDataStructure fileDataStructure);
- Optional<byte[]> get(String vspId, Version version, String user) throws IOException;
+ Optional<Pair<String, byte[]>> get(String vspId, Version version, String user) throws IOException;
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImpl.java
index 73558b465a..fcf54eef2f 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/MonitoringUploadsManagerImpl.java
@@ -25,6 +25,7 @@ import org.openecomp.core.enrichment.types.MonitoringUploadType;
import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.core.utilities.file.FileContentHandler;
import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.activityLog.ActivityLogManager;
import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
import org.openecomp.sdc.common.errors.CoreException;
@@ -44,6 +45,7 @@ import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import org.openecomp.sdc.vendorsoftwareproduct.MonitoringUploadsManager;
import org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.errors.MonitoringUploadErrorBuilder;
@@ -67,6 +69,7 @@ public class MonitoringUploadsManagerImpl implements MonitoringUploadsManager {
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
private ActivityLogManager activityLogManager;
private ComponentArtifactDao componentArtifactDao;
+ private VendorSoftwareProductDao vendorSoftwareProductDao;
private static final Logger logger =
LoggerFactory.getLogger(VendorSoftwareProductManagerImpl.class);
@@ -253,7 +256,7 @@ public class MonitoringUploadsManagerImpl implements MonitoringUploadsManager {
Map<String, List<ErrorMessage>> errors) {
FileContentHandler contentMap;
try {
- contentMap = CommonUtil.validateAndUploadFileContent(uploadedFileData);
+ contentMap = CommonUtil.validateAndUploadFileContent(OnboardingTypesEnum.ZIP, uploadedFileData);
VendorSoftwareProductUtils.validateContentZipData(contentMap, errors);
} catch (IOException exception) {
MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java
index 07e84803aa..3f6ffcc622 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImpl.java
@@ -21,29 +21,20 @@
package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
import org.openecomp.core.model.dao.ServiceModelDao;
import org.openecomp.core.model.types.ServiceElement;
-import org.openecomp.core.translator.datatypes.TranslatorOutput;
-import org.openecomp.core.util.UniqueValueUtil;
-import org.openecomp.core.utilities.file.FileContentHandler;
-import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.core.utilities.json.JsonUtil;
-import org.openecomp.core.validation.util.MessageContainerUtil;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.activityLog.ActivityLogManager;
-import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.Messages;
-import org.openecomp.sdc.common.utils.CommonUtil;
import org.openecomp.sdc.common.utils.SdcCommon;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
import org.openecomp.sdc.healing.api.HealingManager;
import org.openecomp.sdc.healing.types.HealCode;
-import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree;
-import org.openecomp.sdc.heat.datatypes.structure.ValidationStructureList;
-import org.openecomp.sdc.heat.services.tree.HeatTreeManager;
-import org.openecomp.sdc.heat.services.tree.HeatTreeManagerUtil;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.logging.api.annotations.Metrics;
@@ -52,8 +43,6 @@ import org.openecomp.sdc.logging.messages.AuditMessages;
import org.openecomp.sdc.logging.types.LoggerServiceName;
import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
-import org.openecomp.sdc.translator.services.heattotosca.HeatToToscaUtil;
-import org.openecomp.sdc.validation.util.ValidationManagerUtil;
import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManager;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
@@ -62,40 +51,29 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadData;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.errors.OrchestrationTemplateNotFoundErrorBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationTemplateFileHandler;
+import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationUploadFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.process.OrchestrationProcessFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.process.OrchestrationTemplateProcessHandler;
import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionDataExtractor;
import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.CandidateService;
-import org.openecomp.sdc.vendorsoftwareproduct.services.utils.CandidateEntityBuilder;
import org.openecomp.sdc.vendorsoftwareproduct.types.OrchestrationTemplateActionResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.ValidationResponse;
import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.FilesDataStructure;
-import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils;
import org.openecomp.sdc.versioning.dao.types.Version;
-import org.openecomp.sdcrests.activitylog.types.ActivityType;
-import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.nio.ByteBuffer;
-import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-import static org.openecomp.sdc.logging.messages.AuditMessages.HEAT_VALIDATION_ERROR;
-import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.GENERAL_COMPONENT_ID;
-import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME;
-
public class OrchestrationTemplateCandidateManagerImpl
implements OrchestrationTemplateCandidateManager {
private static final Logger logger =
@@ -162,65 +140,31 @@ public class OrchestrationTemplateCandidateManagerImpl
@Override
@Metrics
- public UploadFileResponse upload(String vspId, Version version, InputStream heatFileToUpload,
- String user) {
+ public UploadFileResponse upload(String vspId, Version version, InputStream fileToUpload,
+ String user, String filePrefix,
+ String networkPackageName) {
mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
-
+ OrchestrationTemplateFileHandler orchestrationTemplateFileHandler =
+ OrchestrationUploadFactory.createOrchestrationTemplateFileHandler(filePrefix);
VspDetails vspDetails = getVspDetails(vspId, version);
+ UploadFileResponse uploadResponse = orchestrationTemplateFileHandler
+ .upload(vspId, version, fileToUpload, user, candidateService,
+ vspDetails);
+ vspDetails.setOnboardingOrigin(filePrefix);
+ vspDetails.setNetworkPackageName(networkPackageName);
+ vspInfoDao.update(vspDetails);
+
+ uploadResponse.setNetworkPackageName(networkPackageName);
+ return uploadResponse;
+ }
- UploadFileResponse uploadFileResponse = new UploadFileResponse();
- if (isNotEmptyFileToUpload(heatFileToUpload, uploadFileResponse)) {
- return uploadFileResponse;
- }
-
- byte[] uploadedFileData = FileUtils.toByteArray(heatFileToUpload);
- if (isInvalidRawZipData(uploadFileResponse, uploadedFileData)) {
- return uploadFileResponse;
- }
-
- Optional<FileContentHandler> optionalContentMap =
- getZipContentMap(uploadFileResponse, uploadedFileData);
- if (!optionalContentMap.isPresent()) {
- logger.error(Messages.ZIP_CONTENT_MAP.getErrorMessage());
- uploadFileResponse
- .addStructureError(
- SdcCommon.UPLOAD_FILE,
- new ErrorMessage(ErrorLevel.ERROR, Messages.ZIP_CONTENT_MAP.getErrorMessage()));
-
- mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
- return uploadFileResponse;
- }
-
- if (!MapUtils.isEmpty(uploadFileResponse.getErrors())) {
-
- mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
- return uploadFileResponse;
- }
- try {
- OrchestrationTemplateCandidateData candidateData =
- new CandidateEntityBuilder(candidateService)
- .buildCandidateEntityFromZip(vspDetails, uploadedFileData, optionalContentMap.get(),
- uploadFileResponse.getErrors(), user);
- candidateService.updateCandidateUploadData(candidateData, vspDetails.getId());
- } catch (Exception exception) {
- logger.error(Messages.ZIP_CONTENT_MAP.getErrorMessage());
- uploadFileResponse
- .addStructureError(
- SdcCommon.UPLOAD_FILE,
- new ErrorMessage(ErrorLevel.ERROR, exception.getMessage()));
-
- mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
- return uploadFileResponse;
- }
- mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
- return uploadFileResponse;
- }
@Override
public OrchestrationTemplateActionResponse process(String vspId,
Version version, String user) {
mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
+ OrchestrationTemplateActionResponse response = new OrchestrationTemplateActionResponse();
Optional<OrchestrationTemplateCandidateData> candidate =
fetchCandidateDataEntity(vspId, version);
@@ -228,97 +172,15 @@ public class OrchestrationTemplateCandidateManagerImpl
throw new CoreException(new OrchestrationTemplateNotFoundErrorBuilder(vspId).build());
}
- logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.HEAT_VALIDATION_STARTED + vspId);
- OrchestrationTemplateActionResponse response = new OrchestrationTemplateActionResponse();
- UploadFileResponse uploadFileResponse = new UploadFileResponse();
- OrchestrationTemplateCandidateData candidateDataEntity = candidate.get();
- Optional<FileContentHandler> fileContent =
- getZipContentMap(uploadFileResponse, candidateDataEntity.getContentData().array());
- if (!fileContent.isPresent()) {
- response.addStructureErrors(uploadFileResponse.getErrors());
- mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
- response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList,vspId,
- HEAT_VALIDATION_ERROR));
- return response;
- }
-
- Map<String, List<ErrorMessage>> uploadErrors = uploadFileResponse.getErrors();
- FileContentHandler fileContentMap = fileContent.get();
- FilesDataStructure structure =
- JsonUtil.json2Object(candidateDataEntity.getFilesDataStructure(), FilesDataStructure.class);
-
- if (CollectionUtils.isNotEmpty(structure.getUnassigned())) {
- response.addErrorMessageToMap(SdcCommon.UPLOAD_FILE,
- Messages.FOUND_UNASSIGNED_FILES.getErrorMessage(), ErrorLevel.ERROR);
-
- mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
- response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList,vspId,
- HEAT_VALIDATION_ERROR));
- return response;
- }
-
VspDetails vspDetails =
getVspDetails(vspId, version);
+ Optional<OrchestrationTemplateProcessHandler> processInstance =
+ OrchestrationProcessFactory.getInstance(vspDetails.getOnboardingOrigin());
- String manifest = candidateService.createManifest(vspDetails, structure);
- fileContentMap.addFile(SdcCommon.MANIFEST_NAME, manifest.getBytes());
-
- Optional<ByteArrayInputStream> zipByteArrayInputStream = candidateService
- .fetchZipFileByteArrayInputStream(vspId, candidateDataEntity, manifest, uploadErrors);
- if (!zipByteArrayInputStream.isPresent()) {
- response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList,vspId,
- HEAT_VALIDATION_ERROR));
- return response;
- }
-
- HeatStructureTree tree = createAndValidateHeatTree(response, fileContentMap);
-
- Map<String, String> componentsQuestionnaire = new HashMap<>();
- Map<String, Map<String, String>> componentNicsQuestionnaire = new HashMap<>();
- Map<String, Collection<ComponentMonitoringUploadEntity>> componentMibList = new HashMap<>();
- Map<String, Collection<ProcessEntity>> processes = new HashMap<>();
- Map<String, ProcessEntity> processArtifact = new HashMap<>();
-
- backupComponentsQuestionnaireBeforeDelete(vspId, version, componentsQuestionnaire,
- componentNicsQuestionnaire, componentMibList, processes, processArtifact);
-
- deleteUploadDataAndContent(vspId, version);
- saveHotData(vspId, version, zipByteArrayInputStream.get(), fileContentMap, tree);
-
- response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList,vspId,
- HEAT_VALIDATION_ERROR));
- if ( MapUtils.isEmpty(MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, response.getErrors
- ()))) {
- logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.HEAT_VALIDATION_COMPLETED + vspId);
+ if(processInstance.isPresent()){
+ response = processInstance.get().process(vspDetails, candidate.get(), user);
}
- logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.HEAT_TRANSLATION_STARTED + vspId);
-
- TranslatorOutput translatorOutput =
- HeatToToscaUtil.loadAndTranslateTemplateData(fileContentMap);
-
- ToscaServiceModel toscaServiceModel = translatorOutput.getToscaServiceModel();
- if (toscaServiceModel != null) {
- serviceModelDao.storeServiceModel(vspId, version, toscaServiceModel);
- //Extracting the compostion data from the output service model of the first phase of
- // translation
- compositionEntityDataManager.saveCompositionData(vspId, version,
- compositionDataExtractor.extractServiceCompositionData(translatorOutput
- .getNonUnifiedToscaServiceModel()));
- retainComponentQuestionnaireData(vspId, version, componentsQuestionnaire,
- componentNicsQuestionnaire, componentMibList, processes, processArtifact);
-
- logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.HEAT_TRANSLATION_COMPLETED + vspId);
- }
-
- uploadFileResponse.addStructureErrors(uploadErrors);
-
- ActivityLogEntity activityLogEntity =
- new ActivityLogEntity(vspId, String.valueOf(version.getMajor() + 1),
- ActivityType.UPLOAD_HEAT.toString(), user, true, "", "");
- activityLogManager.addActionLog(activityLogEntity, user);
-
- mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
return response;
}
@@ -374,7 +236,7 @@ public class OrchestrationTemplateCandidateManagerImpl
@Override
- public Optional<byte[]> get(String vspId, Version version, String user)
+ public Optional<Pair<String, byte[]>> get(String vspId, Version version, String user)
throws IOException {
mdcDataDebugMessage.debugEntryMessage("VSP id", vspId);
@@ -393,15 +255,25 @@ public class OrchestrationTemplateCandidateManagerImpl
.debugExitMessage("VSP id", vspId);
return Optional.empty();
}
+ OnboardingTypesEnum type =
+ OnboardingTypesEnum.getOnboardingTypesEnum(vspDetails.getOnboardingOrigin());
- FilesDataStructure structure = JsonUtil
- .json2Object(candidateDataEntity.get().getFilesDataStructure(), FilesDataStructure.class);
- String manifest = candidateService.createManifest(vspDetails, structure);
+ if(vspDetails.getOnboardingOrigin().equals(OnboardingTypesEnum.ZIP.toString())) {
+ FilesDataStructure structure = JsonUtil
+ .json2Object(candidateDataEntity.get().getFilesDataStructure(), FilesDataStructure.class);
+ String manifest = candidateService.createManifest(vspDetails, structure);
- mdcDataDebugMessage
- .debugExitMessage("VSP id", vspId);
- return Optional.ofNullable(candidateService
- .replaceManifestInZip(candidateDataEntity.get().getContentData(), manifest, vspId));
+ mdcDataDebugMessage
+ .debugExitMessage("VSP id", vspId);
+ return Optional.ofNullable(
+ new ImmutablePair<>(OnboardingTypesEnum.ZIP.toString(),candidateService
+ .replaceManifestInZip(candidateDataEntity.get().getContentData(),
+ manifest, vspId, type)));
+ }
+
+ return Optional.ofNullable(
+ new ImmutablePair<>(vspDetails.getOnboardingOrigin(),candidateDataEntity.get()
+ .getContentData().array()));
}
private Optional<OrchestrationTemplateCandidateData> fetchCandidateDataEntity(
@@ -410,213 +282,6 @@ public class OrchestrationTemplateCandidateManagerImpl
.ofNullable(candidateService.getOrchestrationTemplateCandidate(vspId, version));
}
- private void retainComponentQuestionnaireData(String vspId, Version activeVersion,
- Map<String, String> componentsQustanniare,
- Map<String, Map<String, String>>
- componentNicsQustanniare,
- Map<String, Collection<ComponentMonitoringUploadEntity>> componentMibList,
- Map<String, Collection<ProcessEntity>> processes,
- Map<String, ProcessEntity> processArtifact) {
- //VSP processes
- restoreProcess(vspId, activeVersion, GENERAL_COMPONENT_ID, GENERAL_COMPONENT_ID, processes,
- processArtifact);
- Collection<ComponentEntity>
- components = vendorSoftwareProductDao.listComponents(vspId, activeVersion);
- components.forEach(componentEntity -> {
- String componentName = componentEntity.getComponentCompositionData().getName();
- if (componentsQustanniare.containsKey(componentName)) {
- componentDao.updateQuestionnaireData(vspId, activeVersion,
- componentEntity.getId(),
- componentsQustanniare.get(componentEntity.getComponentCompositionData()
- .getName()));
- if (componentNicsQustanniare.containsKey(componentName)) {
- Map<String, String> nicsQustanniare = componentNicsQustanniare.get(componentName);
- Collection<NicEntity>
- nics =
- nicDao.list(new NicEntity(vspId, activeVersion, componentEntity.getId(), null));
- nics.forEach(nicEntity -> {
- if (nicsQustanniare.containsKey(nicEntity.getNicCompositionData().getName())) {
- nicDao.updateQuestionnaireData(vspId, activeVersion,
- componentEntity.getId(), nicEntity.getId(),
- nicsQustanniare.get(nicEntity.getNicCompositionData().getName()));
- }
- });
- }
- //MIB //todo add for VES_EVENTS
- if (componentMibList.containsKey(componentName)) {
- Collection<ComponentMonitoringUploadEntity> mibList =
- componentMibList.get(componentName);
- mibList.forEach(mib -> {
- mib.setComponentId(componentEntity.getId());
- componentArtifactDao.create(mib);
- });
- }
- //VFC processes
- restoreProcess(vspId, activeVersion, componentEntity.getId(), componentName, processes,
- processArtifact);
- }
- });
- }
-
- private void backupComponentsQuestionnaireBeforeDelete(String vspId, Version activeVersion,
- Map<String, String> componentsQustanniare,
- Map<String, Map<String, String>>
- componentNicsQustanniare,
- Map<String, Collection<ComponentMonitoringUploadEntity>>
- componentMibList,
- Map<String, Collection<ProcessEntity>>
- componentProcesses,
- Map<String, ProcessEntity> processArtifact) {
- //backup VSP processes
- backupProcess(vspId, activeVersion, GENERAL_COMPONENT_ID, GENERAL_COMPONENT_ID,
- componentProcesses, processArtifact);
- Collection<ComponentEntity> componentsCompositionAndQuestionnaire = vendorSoftwareProductDao
- .listComponentsCompositionAndQuestionnaire(vspId,
- activeVersion);
- componentsCompositionAndQuestionnaire.forEach(componentEntity -> {
- String componentName = componentEntity.getComponentCompositionData().getName();
- componentsQustanniare.put(componentName, componentEntity
- .getQuestionnaireData());
- Collection<NicEntity>
- nics = nicDao.list(new NicEntity(vspId, activeVersion, componentEntity.getId(), null));
- //backup mib
- Collection<ComponentMonitoringUploadEntity> componentMib =
- componentArtifactDao.listArtifacts(new
- ComponentMonitoringUploadEntity(vspId, activeVersion, componentEntity.getId(),
- null));
- if (CollectionUtils.isNotEmpty(componentMib)) {
- componentMibList.put(componentName,componentMib);
- }
-
- //backup component processes
- backupProcess(vspId, activeVersion, componentEntity.getId(), componentName,
- componentProcesses, processArtifact);
- if (CollectionUtils.isNotEmpty(nics)) {
- Map<String, String> nicsQustanniare = new HashMap<>();
- nics.forEach(nicEntity -> {
- NicEntity nic = nicDao.get(new NicEntity(vspId, activeVersion, componentEntity.getId(),
- nicEntity.getId()));
- NicEntity nicQuestionnaire = nicDao.getQuestionnaireData(vspId, activeVersion,
- componentEntity.getId(), nicEntity.getId());
-
- nicsQustanniare
- .put(nicEntity.getNicCompositionData().getName(),
- nicQuestionnaire.getQuestionnaireData());
- });
- componentNicsQustanniare.put(componentName, nicsQustanniare);
- }
- });
- }
-
- private void backupProcess(String vspId, Version activeVersion, String componentId,
- String componentName, Map<String,
- Collection<ProcessEntity>> processes,
- Map<String, ProcessEntity> processArtifact) {
- Collection<ProcessEntity> processList = vendorSoftwareProductDao.listProcesses(vspId,
- activeVersion, componentId);
- if (!processList.isEmpty()) {
- processes.put(componentName, processList);
- processList.forEach(process -> {
- //ProcessArtifactEntity artifact = vendorSoftwareProductDao.getProcessArtifact(vspId,
- // activeVersion, componentId, process.getId());
- ProcessEntity artifact =
- processDao.get(new ProcessEntity(vspId, activeVersion, componentId, process.getId()));
- if (artifact.getArtifact() != null) {
- processArtifact.put(process.getId(), artifact);
- }
- });
- }
- }
-
- private void restoreProcess(String vspId, Version activeVersion, String componentId,
- String componentName,
- Map<String, Collection<ProcessEntity>> processes,
- Map<String, ProcessEntity> processArtifact) {
- if (processes.containsKey(componentName)) {
- Collection<ProcessEntity> processList = processes.get(componentName);
- processList.forEach(process -> {
- //Reatin VFC process
- if (!GENERAL_COMPONENT_ID.equals(componentId) && processArtifact.containsKey(process.getId
- ())) {
- ProcessEntity artifact = processArtifact.get(process.getId());
- artifact.setComponentId(componentId);
- UniqueValueUtil.createUniqueValue(PROCESS_NAME, vspId, activeVersion.toString(),
- componentId, process.getName());
- vendorSoftwareProductDao.createProcess(artifact);
- }
- });
- }
- }
-
- private HeatStructureTree createAndValidateHeatTree(OrchestrationTemplateActionResponse response,
- FileContentHandler fileContentMap) {
- VendorSoftwareProductUtils.addFileNamesToUploadFileResponse(fileContentMap, response);
- Map<String, List<ErrorMessage>> validationErrors =
- ValidationManagerUtil.initValidationManager(fileContentMap).validate();
- response.getErrors().putAll(validationErrors);
-
- HeatTreeManager heatTreeManager = HeatTreeManagerUtil.initHeatTreeManager(fileContentMap);
- heatTreeManager.createTree();
- heatTreeManager.addErrors(validationErrors);
- return heatTreeManager.getTree();
- }
-
- private void saveHotData(String vspId, Version activeVersion, InputStream uploadedFileData,
- FileContentHandler fileContentMap, HeatStructureTree tree) {
- Map<String, Object> manifestAsMap =
- (Map<String, Object>) JsonUtil.json2Object(fileContentMap.getFileContent(
- SdcCommon.MANIFEST_NAME), Map.class);
-
- UploadData uploadData = new UploadData();
- uploadData.setPackageName((String) manifestAsMap.get("name"));
- uploadData.setPackageVersion((String) manifestAsMap.get("version"));
- uploadData.setContentData(ByteBuffer.wrap(FileUtils.toByteArray(uploadedFileData)));
- uploadData.setValidationDataStructure(new ValidationStructureList(tree));
- orchestrationTemplateDataDao.updateOrchestrationTemplateData(vspId, uploadData);
- }
-
- private void deleteUploadDataAndContent(String vspId, Version version) {
- //fixme change this when more tables are zusammenized
- vendorSoftwareProductDao.deleteUploadData(vspId, version);
- }
-
- private boolean isInvalidRawZipData(UploadFileResponse uploadFileResponse,
- byte[] uploadedFileData) {
- Optional<ErrorMessage> errorMessage;
- errorMessage = candidateService.validateRawZipData(uploadedFileData);
- if (errorMessage.isPresent()) {
- uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE, errorMessage.get());
- return true;
- }
- return false;
- }
-
- private boolean isNotEmptyFileToUpload(InputStream heatFileToUpload,
- UploadFileResponse uploadFileResponse) {
- Optional<ErrorMessage> errorMessage =
- candidateService.validateNonEmptyFileToUpload(heatFileToUpload);
- if (errorMessage.isPresent()) {
- uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE, errorMessage.get());
- return true;
- }
- return false;
- }
-
- private Optional<FileContentHandler> getZipContentMap(UploadFileResponse uploadFileResponse,
- byte[] uploadedFileData) {
- FileContentHandler contentMap = null;
- try {
- contentMap = CommonUtil.validateAndUploadFileContent(uploadedFileData);
- } catch (IOException exception) {
- uploadFileResponse.addStructureError(
- SdcCommon.UPLOAD_FILE,
- new ErrorMessage(ErrorLevel.ERROR, Messages.INVALID_ZIP_FILE.getErrorMessage()));
- } catch (CoreException coreException) {
- uploadFileResponse.addStructureError(
- SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR, coreException.getMessage()));
- }
- return Optional.ofNullable(contentMap);
- }
// todo *************************** move to reusable place! *************************
@@ -646,4 +311,4 @@ public class OrchestrationTemplateCandidateManagerImpl
});
}
- }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
index 5163cfde9f..78c4cbf5d9 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImpl.java
@@ -22,6 +22,7 @@ package org.openecomp.sdc.vendorsoftwareproduct.impl;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
+import org.openecomp.core.converter.datatypes.Constants;
import org.openecomp.core.enrichment.api.EnrichmentManager;
import org.openecomp.core.enrichment.factory.EnrichmentManagerFactory;
import org.openecomp.core.model.dao.EnrichedServiceModelDao;
@@ -31,6 +32,7 @@ import org.openecomp.core.util.UniqueValueUtil;
import org.openecomp.core.utilities.file.FileContentHandler;
import org.openecomp.core.utilities.json.JsonSchemaDataGenerator;
import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.core.validation.api.ValidationManager;
import org.openecomp.core.validation.util.MessageContainerUtil;
import org.openecomp.sdc.activityLog.ActivityLogManager;
@@ -318,7 +320,7 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
validationResponse.setLicensingDataErrors(validateLicensingData(vspDetails));
validationResponse
- .setUploadDataErrors(validateUploadData(uploadData), LoggerServiceName.Submit_VSP,
+ .setUploadDataErrors(validateUploadData(uploadData,vspDetails), LoggerServiceName.Submit_VSP,
LoggerTragetServiceName.SUBMIT_VSP);
validationResponse.setQuestionnaireValidationResult(
@@ -641,6 +643,8 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
validateUniqueName(vspDetails.getName());
+ vspDetails.setOnboardingOrigin(OnboardingTypesEnum.NONE.toString());
+
vspInfoDao.create(vspDetails);//id will be set in the dao
vspInfoDao.updateQuestionnaireData(vspDetails.getId(), null,
new JsonSchemaDataGenerator(getVspQuestionnaireSchema(null)).generateData());
@@ -771,6 +775,14 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
vsp.setValidationData(orchestrationTemplateDao.getValidationData(vspId, version));
+ if(Objects.isNull(vsp.getOnboardingOrigin())){
+ vsp.setOnboardingOrigin(OnboardingTypesEnum.ZIP.toString());
+ }
+
+ if(Objects.isNull(vsp.getNetworkPackageName())){
+ vsp.setNetworkPackageName("Upload File");
+ }
+
mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
return vsp;
}
@@ -1044,7 +1056,8 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
- private Map<String, List<ErrorMessage>> validateUploadData(UploadDataEntity uploadData)
+ private Map<String, List<ErrorMessage>> validateUploadData(UploadDataEntity uploadData,
+ VspDetails vspDetails)
throws IOException {
Map<String, List<ErrorMessage>> validationErrors = new HashMap<>();
@@ -1053,7 +1066,9 @@ public class VendorSoftwareProductManagerImpl implements VendorSoftwareProductMa
}
FileContentHandler fileContentMap =
- CommonUtil.validateAndUploadFileContent(uploadData.getContentData().array());
+ CommonUtil.validateAndUploadFileContent(OnboardingTypesEnum.getOnboardingTypesEnum
+ (vspDetails.getOnboardingOrigin()),
+ uploadData.getContentData().array());
//todo - check
ValidationManager validationManager =
ValidationManagerUtil.initValidationManager(fileContentMap);
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/BaseOrchestrationTemplateHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/BaseOrchestrationTemplateHandler.java
new file mode 100644
index 0000000000..c7fb43770d
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/BaseOrchestrationTemplateHandler.java
@@ -0,0 +1,100 @@
+package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration;
+
+import org.apache.commons.collections4.MapUtils;
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
+import org.openecomp.sdc.common.errors.Messages;
+import org.openecomp.sdc.common.utils.SdcCommon;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.CandidateService;
+import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.io.InputStream;
+import java.util.Optional;
+import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters;
+public abstract class BaseOrchestrationTemplateHandler implements OrchestrationTemplateFileHandler {
+ protected static final Logger logger =
+ LoggerFactory.getLogger(BaseOrchestrationTemplateHandler.class);
+ protected static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+
+ @Override
+ public UploadFileResponse upload(String vspId, Version version, InputStream fileToUpload, String user,
+ CandidateService candidateService, VspDetails vspDetails) {
+ UploadFileResponse uploadFileResponse = new UploadFileResponse();
+ uploadFileResponse.setOnboardingType(getHandlerType());
+ if (isNotEmptyFileToUpload(fileToUpload, uploadFileResponse, candidateService)) {
+ return uploadFileResponse;
+ }
+
+ byte[] uploadedFileData = FileUtils.toByteArray(fileToUpload);
+ if (isInvalidRawZipData(uploadFileResponse, uploadedFileData, candidateService)) {
+ return uploadFileResponse;
+ }
+
+ Optional<FileContentHandler> optionalContentMap =
+ getFileContentMap(uploadFileResponse, uploadedFileData);
+ if (!optionalContentMap.isPresent()) {
+ logger.error(getErrorWithParameters(Messages.FILE_CONTENT_MAP.getErrorMessage(), getHandlerType().toString()));
+ uploadFileResponse
+ .addStructureError(
+ SdcCommon.UPLOAD_FILE,
+ new ErrorMessage(ErrorLevel.ERROR,
+ getErrorWithParameters(Messages.FILE_CONTENT_MAP.getErrorMessage(), getHandlerType().toString())));
+
+ mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+ return uploadFileResponse;
+ }
+
+ if (!MapUtils.isEmpty(uploadFileResponse.getErrors())) {
+
+ mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+ return uploadFileResponse;
+ }
+ if (updateCandidateData(vspId, user, candidateService, vspDetails, uploadFileResponse,
+ uploadedFileData, optionalContentMap))
+ return uploadFileResponse;
+
+ mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+ return uploadFileResponse;
+
+ }
+
+ protected abstract boolean updateCandidateData(String vspId, String user, CandidateService candidateService,
+ VspDetails vspDetails, UploadFileResponse uploadFileResponse,
+ byte[] uploadedFileData,
+ Optional<FileContentHandler> optionalContentMap);
+
+
+ private boolean isNotEmptyFileToUpload(InputStream fileToUpload,
+ UploadFileResponse uploadFileResponse, CandidateService candidateService) {
+ Optional<ErrorMessage> errorMessage =
+ candidateService.validateNonEmptyFileToUpload(fileToUpload);
+ if (errorMessage.isPresent()) {
+ uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE, errorMessage.get());
+ return true;
+ }
+ return false;
+ }
+
+ protected boolean isInvalidRawZipData(UploadFileResponse uploadFileResponse,
+ byte[] uploadedFileData, CandidateService candidateService) {
+ Optional<ErrorMessage> errorMessage;
+ errorMessage = candidateService.validateRawZipData(uploadedFileData);
+ if (errorMessage.isPresent()) {
+ uploadFileResponse.addStructureError(SdcCommon.UPLOAD_FILE, errorMessage.get());
+ return true;
+ }
+ return false;
+ }
+
+ public abstract Optional<FileContentHandler> getFileContentMap(UploadFileResponse uploadFileResponse,
+ byte[] uploadedFileData);
+ protected abstract OnboardingTypesEnum getHandlerType();
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java
new file mode 100644
index 0000000000..53d34749e7
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateCSARHandler.java
@@ -0,0 +1,154 @@
+package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration;
+
+import org.apache.commons.lang3.tuple.Pair;
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.common.errors.Messages;
+import org.openecomp.sdc.common.utils.CommonUtil;
+import org.openecomp.sdc.common.utils.SdcCommon;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.OnboardingManifest;
+import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.CandidateService;
+import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters;
+import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.CSARConstants.*;
+public class OrchestrationTemplateCSARHandler extends BaseOrchestrationTemplateHandler
+ implements OrchestrationTemplateFileHandler {
+
+
+ @Override
+ public Optional<FileContentHandler> getFileContentMap(UploadFileResponse uploadFileResponse,
+ byte[] uploadedFileData) {
+ FileContentHandler contentMap = null;
+ List<String> folderList = new ArrayList<>();
+ try {
+ Pair<FileContentHandler, List<String>> fileContentMapFromOrchestrationCandidateZip = CommonUtil.getFileContentMapFromOrchestrationCandidateZip(uploadedFileData);
+ contentMap = fileContentMapFromOrchestrationCandidateZip.getKey();
+ folderList = fileContentMapFromOrchestrationCandidateZip.getRight();
+ } catch (IOException exception) {
+ uploadFileResponse.addStructureError(
+ SdcCommon.UPLOAD_FILE,
+ new ErrorMessage(ErrorLevel.ERROR, Messages.INVALID_CSAR_FILE.getErrorMessage()));
+ } catch (CoreException coreException) {
+ uploadFileResponse.addStructureError(
+ SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR, coreException.getMessage()));
+ }
+ validateContent(uploadFileResponse, contentMap, folderList);
+ return Optional.ofNullable(contentMap);
+ }
+
+ private void validateContent(UploadFileResponse uploadFileResponse, FileContentHandler contentMap, List<String> folderList) {
+ validateManifest(uploadFileResponse, contentMap);
+ validateFileExist(uploadFileResponse, contentMap, MAIN_SERVICE_TEMPLATE_YAML_FILE_NAME);
+ validateNoExtraFiles(uploadFileResponse, contentMap);
+ validateFolders(uploadFileResponse, folderList);
+ }
+
+ private void validateManifest(UploadFileResponse uploadFileResponse, FileContentHandler contentMap) {
+ if (!validateFileExist(uploadFileResponse, contentMap, MAIN_SERVICE_TEMPLATE_MF_FILE_NAME)){
+ return;
+ }
+ InputStream fileContent = contentMap.getFileContent(MAIN_SERVICE_TEMPLATE_MF_FILE_NAME);
+ OnboardingManifest onboardingManifest = new OnboardingManifest(fileContent);
+ if (!onboardingManifest.isValid()){
+ onboardingManifest.getErrors().forEach(error -> uploadFileResponse.addStructureError(
+ SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR, error)));
+ }
+ }
+
+ private void validateNoExtraFiles(UploadFileResponse uploadFileResponse, FileContentHandler contentMap) {
+ List<String> unwantedFiles = contentMap.getFileList().stream()
+ .filter(this::filterFiles).collect(Collectors.toList());
+ if (!unwantedFiles.isEmpty()) {
+ unwantedFiles.stream().filter(this::filterFiles).forEach(unwantedFile ->
+ uploadFileResponse.addStructureError(
+ SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR,
+ getErrorWithParameters(Messages.CSAR_FILES_NOT_ALLOWED.getErrorMessage(),
+ unwantedFile))));
+
+ ;
+ }
+ }
+
+ private void validateFolders(UploadFileResponse uploadFileResponse, List<String> folderList) {
+ List<String> filterResult = folderList.stream().filter(this::filterFolders).collect(Collectors.toList());
+ if (!filterResult.isEmpty()) {
+ folderList.stream().filter(this::filterFolders).forEach( unwantedFolder ->
+ uploadFileResponse.addStructureError(
+ SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR,
+ getErrorWithParameters(Messages.CSAR_DIRECTORIES_NOT_ALLOWED.getErrorMessage(),
+ unwantedFolder))));
+
+ }
+ }
+ private boolean filterFiles(String inFileName) {
+ boolean valid = ELIGIBLE_FILES.stream().anyMatch(fileName -> fileName.equals(inFileName));
+ if (valid){
+ return !valid;
+ }
+ return filterFolders(inFileName);
+ }
+
+ private boolean filterFolders(String fileName) {
+ return !ELIGBLE_FOLDERS.stream().anyMatch(dirName -> fileName.startsWith(dirName));
+ }
+
+ private boolean validateFileExist(UploadFileResponse uploadFileResponse, FileContentHandler contentMap, String fileName) {
+
+ boolean containsFile = contentMap.containsFile(fileName);
+ if (!containsFile) {
+ uploadFileResponse.addStructureError(
+ SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR,
+ getErrorWithParameters(Messages.CSAR_FILE_NOT_FOUND.getErrorMessage(), fileName)));
+ }
+ return containsFile;
+ }
+
+ @Override
+ protected boolean updateCandidateData(String vspId, String user, CandidateService candidateService,
+ VspDetails vspDetails, UploadFileResponse uploadFileResponse,
+ byte[] uploadedFileData, Optional<FileContentHandler> optionalContentMap) {
+ try {
+ candidateService.updateCandidateUploadData(new OrchestrationTemplateCandidateData(
+ ByteBuffer.wrap(uploadedFileData), ""), vspDetails.getId());
+ } catch (Exception exception) {
+ logger.error(getErrorWithParameters(Messages.FILE_CONTENT_MAP.getErrorMessage(),
+ getHandlerType().toString()), exception);
+ uploadFileResponse
+ .addStructureError(
+ SdcCommon.UPLOAD_FILE,
+ new ErrorMessage(ErrorLevel.ERROR, exception.getMessage()));
+
+ mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+ return true;
+ }
+ return false;
+ }
+
+
+ @Override
+ protected OnboardingTypesEnum getHandlerType() {
+ return OnboardingTypesEnum.CSAR;
+ }
+
+ @Override
+ protected boolean isInvalidRawZipData(UploadFileResponse uploadFileResponse,
+ byte[] uploadedFileData, CandidateService candidateService) {
+ return super.isInvalidRawZipData(uploadFileResponse, uploadedFileData, candidateService);
+
+ }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateFileHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateFileHandler.java
new file mode 100644
index 0000000000..3f7d18de9f
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateFileHandler.java
@@ -0,0 +1,12 @@
+package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration;
+
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.CandidateService;
+import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.io.InputStream;
+public interface OrchestrationTemplateFileHandler {
+ UploadFileResponse upload(String vspId, Version version, InputStream fileToUpload, String user,
+ CandidateService candidateService, VspDetails vspDetails);
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateZipHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateZipHandler.java
new file mode 100644
index 0000000000..626d941911
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationTemplateZipHandler.java
@@ -0,0 +1,55 @@
+package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration;
+
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
+import org.openecomp.sdc.common.errors.Messages;
+import org.openecomp.sdc.common.utils.SdcCommon;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.CandidateService;
+import org.openecomp.sdc.vendorsoftwareproduct.services.utils.CandidateEntityBuilder;
+import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
+
+import java.util.Optional;
+
+import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters;
+public class OrchestrationTemplateZipHandler extends BaseOrchestrationTemplateHandler
+ implements OrchestrationTemplateFileHandler {
+
+ @Override
+ public Optional<FileContentHandler> getFileContentMap(UploadFileResponse uploadFileResponse,
+ byte[] uploadedFileData) {
+ return OrchestrationUtil.getFileContentMap(OnboardingTypesEnum.ZIP, uploadFileResponse, uploadedFileData);
+ }
+
+ @Override
+ protected boolean updateCandidateData(String vspId, String user, CandidateService candidateService,
+ VspDetails vspDetails, UploadFileResponse uploadFileResponse,
+ byte[] uploadedFileData, Optional<FileContentHandler> optionalContentMap) {
+ try {
+ OrchestrationTemplateCandidateData candidateData =
+ new CandidateEntityBuilder(candidateService)
+ .buildCandidateEntityFromZip(vspDetails, uploadedFileData, optionalContentMap.get(),
+ uploadFileResponse.getErrors(), user);
+ candidateService.updateCandidateUploadData(candidateData, vspDetails.getId());
+ } catch (Exception exception) {
+ logger.error(getErrorWithParameters(Messages.FILE_CONTENT_MAP.getErrorMessage(),
+ getHandlerType().toString()),exception);
+ uploadFileResponse
+ .addStructureError(
+ SdcCommon.UPLOAD_FILE,
+ new ErrorMessage(ErrorLevel.ERROR, exception.getMessage()));
+
+ mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ protected OnboardingTypesEnum getHandlerType() {
+ return OnboardingTypesEnum.ZIP;
+ }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUploadFactory.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUploadFactory.java
new file mode 100644
index 0000000000..104da69ed8
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUploadFactory.java
@@ -0,0 +1,29 @@
+package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration;
+
+import org.openecomp.config.api.Configuration;
+import org.openecomp.config.api.ConfigurationManager;
+import org.openecomp.core.utilities.CommonMethods;
+import org.openecomp.sdc.datatypes.configuration.ImplementationConfiguration;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationUtil.ORCHESTRATION_CONFIG_NAMESPACE;
+import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationUtil.ORCHESTRATION_Impl_Key;
+
+public class OrchestrationUploadFactory {
+ private static Map<String, ImplementationConfiguration> fileHanlders;
+
+ static {
+ Configuration config = ConfigurationManager.lookup();
+ fileHanlders = new ConcurrentHashMap<>(config.populateMap(ORCHESTRATION_CONFIG_NAMESPACE,
+ ORCHESTRATION_Impl_Key, ImplementationConfiguration.class));
+
+ }
+
+ public static final OrchestrationTemplateFileHandler createOrchestrationTemplateFileHandler(String filePrefix) {
+ ImplementationConfiguration orchestrationTemplateFileHandler = fileHanlders.get(filePrefix);
+ return CommonMethods.newInstance(orchestrationTemplateFileHandler.getImplementationClass(),
+ OrchestrationTemplateFileHandler.class);
+ }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUtil.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUtil.java
new file mode 100644
index 0000000000..5d14477339
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/OrchestrationUtil.java
@@ -0,0 +1,282 @@
+package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.openecomp.core.model.dao.ServiceModelDao;
+import org.openecomp.core.model.dao.ServiceModelDaoFactory;
+import org.openecomp.core.util.UniqueValueUtil;
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.common.errors.Messages;
+import org.openecomp.sdc.common.utils.CommonUtil;
+import org.openecomp.sdc.common.utils.SdcCommon;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
+import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree;
+import org.openecomp.sdc.heat.datatypes.structure.ValidationStructureList;
+import org.openecomp.sdc.heat.services.tree.HeatTreeManager;
+import org.openecomp.sdc.heat.services.tree.HeatTreeManagerUtil;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentArtifactDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ComponentDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.MonitoringUploadDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.NicDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.ProcessDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadData;
+import org.openecomp.sdc.vendorsoftwareproduct.factory.CompositionDataExtractorFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.factory.CompositionEntityDataManagerFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionDataExtractor;
+import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
+import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+
+import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.GENERAL_COMPONENT_ID;
+import static org.openecomp.sdc.vendorsoftwareproduct.VendorSoftwareProductConstants.UniqueValues.PROCESS_NAME;
+
+public class OrchestrationUtil {
+
+ public static final String ORCHESTRATION_CONFIG_NAMESPACE = "orchestration";
+ public static final String ORCHESTRATION_Impl_Key = "orchestration_impl";
+
+
+ private static VendorSoftwareProductDao vendorSoftwareProductDao =
+ VendorSoftwareProductDaoFactory.getInstance().createInterface();
+ private static NicDao nicDao = NicDaoFactory.getInstance().createInterface();
+ private static ComponentArtifactDao componentArtifactDao = MonitoringUploadDaoFactory.getInstance().createInterface();
+ private static ProcessDao processDao = ProcessDaoFactory.getInstance().createInterface();
+ private static OrchestrationTemplateDao orchestrationTemplateDataDao =
+ OrchestrationTemplateDaoFactory.getInstance().createInterface();
+ private static ComponentDao componentDao =
+ ComponentDaoFactory.getInstance().createInterface();
+ private static ServiceModelDao serviceModelDao = ServiceModelDaoFactory.getInstance()
+ .createInterface();
+ private static CompositionEntityDataManager compositionEntityDataManager =
+ CompositionEntityDataManagerFactory.getInstance().createInterface();
+ private static CompositionDataExtractor compositionDataExtractor =
+ CompositionDataExtractorFactory.getInstance().createInterface();
+
+ public static Optional<FileContentHandler> getFileContentMap(OnboardingTypesEnum type,
+ UploadFileResponse uploadFileResponse,
+ byte[] uploadedFileData) {
+ FileContentHandler contentMap = null;
+ try {
+ contentMap = CommonUtil.validateAndUploadFileContent(type, uploadedFileData);
+ } catch (IOException exception) {
+ uploadFileResponse.addStructureError(
+ SdcCommon.UPLOAD_FILE,
+ new ErrorMessage(ErrorLevel.ERROR, Messages.INVALID_ZIP_FILE.getErrorMessage()));
+ } catch (CoreException coreException) {
+ uploadFileResponse.addStructureError(
+ SdcCommon.UPLOAD_FILE, new ErrorMessage(ErrorLevel.ERROR, coreException.getMessage()));
+ }
+ return Optional.ofNullable(contentMap);
+ }
+
+ public static void backupComponentsQuestionnaireBeforeDelete(String vspId, Version activeVersion,
+ Map<String, String> componentsQustanniare,
+ Map<String, Map<String, String>>
+ componentNicsQustanniare,
+ Map<String, Collection<ComponentMonitoringUploadEntity>>
+ componentMibList,
+ Map<String, Collection<ProcessEntity>>
+ componentProcesses,
+ Map<String, ProcessEntity> processArtifact) {
+ //backup VSP processes
+ backupProcess(vspId, activeVersion, GENERAL_COMPONENT_ID, GENERAL_COMPONENT_ID,
+ componentProcesses, processArtifact);
+ Collection<ComponentEntity> componentsCompositionAndQuestionnaire = vendorSoftwareProductDao
+ .listComponentsCompositionAndQuestionnaire(vspId,
+ activeVersion);
+ componentsCompositionAndQuestionnaire.forEach(componentEntity -> {
+ String componentName = componentEntity.getComponentCompositionData().getName();
+ componentsQustanniare.put(componentName, componentEntity
+ .getQuestionnaireData());
+ Collection<NicEntity>
+ nics = nicDao.list(new NicEntity(vspId, activeVersion, componentEntity.getId(), null));
+ //backup mib
+ Collection<ComponentMonitoringUploadEntity> componentMib =
+ componentArtifactDao.listArtifacts(new
+ ComponentMonitoringUploadEntity(vspId, activeVersion, componentEntity.getId(),
+ null));
+ if (CollectionUtils.isNotEmpty(componentMib)) {
+ componentMibList.put(componentName,componentMib);
+ }
+
+ //backup component processes
+ backupProcess(vspId, activeVersion, componentEntity.getId(), componentName,
+ componentProcesses, processArtifact);
+ if (CollectionUtils.isNotEmpty(nics)) {
+ Map<String, String> nicsQustanniare = new HashMap<>();
+ nics.forEach(nicEntity -> {
+ NicEntity nic = nicDao.get(new NicEntity(vspId, activeVersion, componentEntity.getId(),
+ nicEntity.getId()));
+ NicEntity nicQuestionnaire = nicDao.getQuestionnaireData(vspId, activeVersion,
+ componentEntity.getId(), nicEntity.getId());
+
+ nicsQustanniare
+ .put(nicEntity.getNicCompositionData().getName(),
+ nicQuestionnaire.getQuestionnaireData());
+ });
+ componentNicsQustanniare.put(componentName, nicsQustanniare);
+ }
+ });
+ }
+
+ private static void backupProcess(String vspId, Version activeVersion, String componentId,
+ String componentName, Map<String,
+ Collection<ProcessEntity>> processes,
+ Map<String, ProcessEntity> processArtifact) {
+ Collection<ProcessEntity> processList = vendorSoftwareProductDao.listProcesses(vspId,
+ activeVersion, componentId);
+ if (!processList.isEmpty()) {
+ processes.put(componentName, processList);
+ processList.forEach(process -> {
+ //ProcessArtifactEntity artifact = vendorSoftwareProductDao.getProcessArtifact(vspId,
+ // activeVersion, componentId, process.getId());
+ ProcessEntity artifact =
+ processDao.get(new ProcessEntity(vspId, activeVersion, componentId, process.getId()));
+ if (artifact.getArtifact() != null) {
+ processArtifact.put(process.getId(), artifact);
+ }
+ });
+ }
+ }
+
+ public static void retainComponentQuestionnaireData(String vspId, Version activeVersion,
+ Map<String, String> componentsQustanniare,
+ Map<String, Map<String, String>>
+ componentNicsQustanniare,
+ Map<String, Collection<ComponentMonitoringUploadEntity>> componentMibList,
+ Map<String, Collection<ProcessEntity>> processes,
+ Map<String, ProcessEntity> processArtifact) {
+ //VSP processes
+ restoreProcess(vspId, activeVersion, GENERAL_COMPONENT_ID, GENERAL_COMPONENT_ID, processes,
+ processArtifact);
+ Collection<ComponentEntity>
+ components = vendorSoftwareProductDao.listComponents(vspId, activeVersion);
+ components.forEach(componentEntity -> {
+ String componentName = componentEntity.getComponentCompositionData().getName();
+ if (componentsQustanniare.containsKey(componentName)) {
+ componentDao.updateQuestionnaireData(vspId, activeVersion,
+ componentEntity.getId(),
+ componentsQustanniare.get(componentEntity.getComponentCompositionData()
+ .getName()));
+ if (componentNicsQustanniare.containsKey(componentName)) {
+ Map<String, String> nicsQustanniare = componentNicsQustanniare.get(componentName);
+ Collection<NicEntity>
+ nics =
+ nicDao.list(new NicEntity(vspId, activeVersion, componentEntity.getId(), null));
+ nics.forEach(nicEntity -> {
+ if (nicsQustanniare.containsKey(nicEntity.getNicCompositionData().getName())) {
+ nicDao.updateQuestionnaireData(vspId, activeVersion,
+ componentEntity.getId(), nicEntity.getId(),
+ nicsQustanniare.get(nicEntity.getNicCompositionData().getName()));
+ }
+ });
+ }
+ //MIB //todo add for VES_EVENTS
+ if (componentMibList.containsKey(componentName)) {
+ Collection<ComponentMonitoringUploadEntity> mibList =
+ componentMibList.get(componentName);
+ mibList.forEach(mib -> {
+ mib.setComponentId(componentEntity.getId());
+ componentArtifactDao.create(mib);
+ });
+ }
+ //VFC processes
+ restoreProcess(vspId, activeVersion, componentEntity.getId(), componentName, processes,
+ processArtifact);
+ }
+ });
+ }
+
+ private static void restoreProcess(String vspId, Version activeVersion, String componentId,
+ String componentName,
+ Map<String, Collection<ProcessEntity>> processes,
+ Map<String, ProcessEntity> processArtifact) {
+ if (processes.containsKey(componentName)) {
+ Collection<ProcessEntity> processList = processes.get(componentName);
+ processList.forEach(process -> {
+ //Reatin VFC process
+ if (!GENERAL_COMPONENT_ID.equals(componentId) && processArtifact.containsKey(process.getId
+ ())) {
+ ProcessEntity artifact = processArtifact.get(process.getId());
+ artifact.setComponentId(componentId);
+ UniqueValueUtil.createUniqueValue(PROCESS_NAME, vspId, activeVersion.toString(),
+ componentId, process.getName());
+ vendorSoftwareProductDao.createProcess(artifact);
+ }
+ });
+ }
+ }
+
+ public static void deleteUploadDataAndContent(String vspId, Version version) {
+ //fixme change this when more tables are zusammenized
+ vendorSoftwareProductDao.deleteUploadData(vspId, version);
+ }
+
+ public static void saveUploadData(String vspId, Version activeVersion, InputStream uploadedFileData,
+ FileContentHandler fileContentMap, HeatStructureTree tree) {
+ Map<String, Object> manifestAsMap =
+ fileContentMap.containsFile(SdcCommon.MANIFEST_NAME) ?
+ (Map<String, Object>) JsonUtil.json2Object(fileContentMap.getFileContent(
+ SdcCommon.MANIFEST_NAME), Map.class)
+ : new HashMap<>();
+
+ UploadData uploadData = new UploadData();
+ uploadData.setContentData(ByteBuffer.wrap(FileUtils.toByteArray(uploadedFileData)));
+ uploadData.setValidationDataStructure(new ValidationStructureList(tree));
+ uploadData.setPackageName(Objects.isNull(manifestAsMap.get("name")) ? null :
+ (String) manifestAsMap.get("name"));
+ uploadData.setPackageVersion(Objects.isNull(manifestAsMap.get("version")) ? null :
+ (String) manifestAsMap.get("version"));
+ orchestrationTemplateDataDao.updateOrchestrationTemplateData(vspId, uploadData);
+ }
+
+ public static void saveServiceModel(String vspId,
+ Version version,
+ ToscaServiceModel serviceModelToExtract,
+ ToscaServiceModel serviceModelToStore){
+ if (serviceModelToExtract != null) {
+ serviceModelDao.storeServiceModel(vspId, version, serviceModelToStore);
+ //Extracting the compostion data from the output service model of the first phase of
+ // translation
+ compositionEntityDataManager.saveCompositionData(vspId, version,
+ compositionDataExtractor.extractServiceCompositionData(serviceModelToExtract));
+// OrchestrationUtil.retainComponentQuestionnaireData(vspId, version, componentsQuestionnaire,
+// componentNicsQuestionnaire, componentMibList, processes, processArtifact);
+ }
+ }
+
+ public static HeatStructureTree createHeatTree(FileContentHandler fileContentMap,
+ Map<String, List<ErrorMessage>> validationErrors){
+ HeatTreeManager heatTreeManager = HeatTreeManagerUtil.initHeatTreeManager(fileContentMap);
+ heatTreeManager.createTree();
+ heatTreeManager.addErrors(validationErrors);
+ return heatTreeManager.getTree();
+ }
+
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/CSARConstants.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/CSARConstants.java
new file mode 100644
index 0000000000..0d204ef2c0
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/CSARConstants.java
@@ -0,0 +1,18 @@
+package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar;
+
+import com.google.common.collect.ImmutableSet;
+import static com.google.common.collect.ImmutableSet.of;
+public class CSARConstants {
+
+ public static final ImmutableSet<String> ELIGBLE_FOLDERS = of("Artifacts/","Definitions/",
+ "Licenses/", "TOSCA-Metadata/");
+
+ public static final String MAIN_SERVICE_TEMPLATE_MF_FILE_NAME = "MainServiceTemplate.mf";
+ public static final String MAIN_SERVICE_TEMPLATE_YAML_FILE_NAME = "MainServiceTemplate.yaml";
+ public static final ImmutableSet<String> ELIGIBLE_FILES =
+ of(MAIN_SERVICE_TEMPLATE_MF_FILE_NAME,MAIN_SERVICE_TEMPLATE_YAML_FILE_NAME);
+
+ public static final String METADATA_MF_ATTRIBUTE = "metadata";
+ public static final String SOURCE_MF_ATTRIBUTE = "source";
+ public static final String SEPERATOR_MF_ATTRIBUTE = ":";
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingManifest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingManifest.java
new file mode 100644
index 0000000000..d88d883e67
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/csar/OnboardingManifest.java
@@ -0,0 +1,141 @@
+package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import org.apache.commons.lang.StringUtils;
+import org.openecomp.sdc.common.errors.Messages;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+
+import java.io.*;
+import java.nio.charset.StandardCharsets;
+import java.util.*;
+
+import static org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder.getErrorWithParameters;
+import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.CSARConstants.*;
+
+public class OnboardingManifest {
+ private static final Logger logger = LoggerFactory.getLogger(OnboardingManifest.class);
+ private Map<String, String> metadata;
+ private List<String> sources;
+ private List<String> errors;
+ private State state;
+ private enum State {
+ Start, ProcessMetadata, ProcessSources, Error
+ }
+
+ public OnboardingManifest(InputStream is) {
+ errors = new ArrayList<>();
+ sources = new ArrayList<>();
+ metadata = new HashMap<>();
+ parseManifest(is);
+ }
+
+ private void parseManifest(InputStream is) {
+ try {
+ ImmutableList<String> lines = readAllLines(is);
+ state = State.Start;
+
+ for (String line : lines) {
+ line = line.trim();
+ if (!StringUtils.isEmpty(line.trim())) {
+ state = processLine(state, line);
+ }
+ }
+ if (errors.isEmpty()) {
+ if (metadata.isEmpty()) {
+ errors.add(Messages.MANIFEST_NO_METADATA.getErrorMessage());
+ }
+ if (sources.isEmpty()) {
+ errors.add(Messages.MANIFEST_NO_SOURCES.getErrorMessage());
+ }
+ }
+ } catch (IOException e){
+ logger.error(e.getMessage(),e);
+ errors.add(Messages.MANIFEST_PARSER_INTERNAL.getErrorMessage());
+ }
+ }
+
+ private State processLine(State state, String line) {
+ switch (state) {
+ case Start:
+ if (line.trim().equals(METADATA_MF_ATTRIBUTE + SEPERATOR_MF_ATTRIBUTE)) {
+ state = State.ProcessMetadata;
+ } else {
+ reportError(line);
+ }
+ break;
+ case ProcessMetadata:
+ String[] metaSplit = line.split(SEPERATOR_MF_ATTRIBUTE);
+ if (metaSplit.length < 2){
+ reportError(line);
+ break;
+ }
+ if (!metaSplit[0].equals(SOURCE_MF_ATTRIBUTE)){
+ String value = line.replace(metaSplit[0] + SEPERATOR_MF_ATTRIBUTE, "").trim();
+ metadata.put(metaSplit[0],value);
+ } else {
+ state = State.ProcessSources;
+ processSourceLine(line);
+ }
+ break;
+ case ProcessSources:
+ processSourceLine(line);
+
+ break;
+ case Error:
+ break;
+
+ } return state;
+ }
+
+ private void processSourceLine(String line) {
+ if (line.startsWith(SOURCE_MF_ATTRIBUTE+SEPERATOR_MF_ATTRIBUTE)){
+ String value = line.replaceAll(SOURCE_MF_ATTRIBUTE + SEPERATOR_MF_ATTRIBUTE, "").trim();
+ sources.add(value);
+ }else {
+ reportError(line);
+ }
+ }
+
+ private void reportError(String line) {
+ errors.add(getErrorWithParameters(Messages.MANIFEST_INVALID_LINE.getErrorMessage(), line));
+ state = State.Error;
+ }
+
+ private ImmutableList<String> readAllLines(InputStream is) throws IOException {
+ ImmutableList.Builder<String> builder = ImmutableList.<String> builder();
+ try (Reader reader = new InputStreamReader(is, StandardCharsets.UTF_8.newDecoder());
+ BufferedReader bufferedReader = new BufferedReader(reader);) {
+ for (; ; ) {
+ String line = bufferedReader.readLine();
+ if (line == null)
+ break;
+ builder.add(line);
+ }
+ }
+ return builder.build();
+ }
+
+ public Map<String, String> getMetadata() {
+ if (!isValid()){
+ return Collections.EMPTY_MAP;
+ }
+ return ImmutableMap.copyOf(metadata);
+ }
+
+ public List<String> getSources() {
+ if (!isValid()){
+ return Collections.EMPTY_LIST;
+ }
+ return ImmutableList.copyOf(sources);
+ }
+
+ public List<String> getErrors() {
+ return ImmutableList.copyOf(errors);
+ }
+
+ public boolean isValid() {
+ return errors.isEmpty();
+ }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationProcessFactory.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationProcessFactory.java
new file mode 100644
index 0000000000..5295e6a6d6
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationProcessFactory.java
@@ -0,0 +1,64 @@
+package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.process;
+
+import org.openecomp.config.api.Configuration;
+import org.openecomp.config.api.ConfigurationManager;
+import org.openecomp.core.utilities.CommonMethods;
+import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
+import org.openecomp.sdc.datatypes.configuration.ImplementationConfiguration;
+import org.openecomp.sdc.vendorsoftwareproduct.types.ConfigConstants;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentHashMap;
+
+import static org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationUtil.ORCHESTRATION_CONFIG_NAMESPACE;
+public class OrchestrationProcessFactory {
+
+ private static final String confFile = "config-orchestration.json";
+ private static Map<String, ImplementationConfiguration> processImplMap;
+
+ static {
+ Configuration config = ConfigurationManager.lookup();
+ processImplMap = new ConcurrentHashMap<>(config.populateMap(ORCHESTRATION_CONFIG_NAMESPACE,
+ ConfigConstants.processImplKey, ImplementationConfiguration.class));
+
+ }
+
+ public static Optional<OrchestrationTemplateProcessHandler> getInstance(String filePrefix) {
+ filePrefix = filePrefix == null ? null : filePrefix.toLowerCase().trim();
+ if (filePrefix == null) {
+ return Optional.empty();
+ }
+
+ OnboardingTypesEnum onboardingTypesEnum = OnboardingTypesEnum.getOnboardingTypesEnum(filePrefix);
+ if (onboardingTypesEnum == null) {
+ return Optional.empty();
+ }
+
+ try {
+ return Optional.of(createInstance(processImplMap.get(onboardingTypesEnum.toString())));
+ }catch (Exception e){
+ return Optional.empty();
+ }
+ }
+
+ private static Map<String, String> getOrchestrationImplMap(){
+ try {
+ return FileUtils.readViaInputStream(confFile,
+ stream -> JsonUtil.json2Object(stream, Map.class));
+ }catch (Exception e){
+ return new HashMap<>();
+ }
+ }
+
+ private static OrchestrationTemplateProcessHandler createInstance(ImplementationConfiguration implClass)
+ throws Exception {
+ OrchestrationTemplateProcessHandler handler;
+ handler =
+ CommonMethods.newInstance(implClass.getImplementationClass(), OrchestrationTemplateProcessHandler.class);
+ return handler;
+ }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java
new file mode 100644
index 0000000000..4866d93411
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessCsarHandler.java
@@ -0,0 +1,133 @@
+package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.process;
+
+import org.apache.commons.collections4.MapUtils;
+import org.openecomp.core.converter.ToscaConverter;
+import org.openecomp.core.impl.ToscaConverterImpl;
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
+import org.openecomp.core.validation.util.MessageContainerUtil;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
+import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree;
+import org.openecomp.sdc.heat.services.tree.ToscaTreeManager;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+import org.openecomp.sdc.logging.messages.AuditMessages;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.factory.CandidateServiceFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationUtil;
+import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.CandidateService;
+import org.openecomp.sdc.vendorsoftwareproduct.types.OrchestrationTemplateActionResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+public class OrchestrationTemplateProcessCsarHandler implements OrchestrationTemplateProcessHandler {
+
+ private static Logger logger =
+ LoggerFactory.getLogger(OrchestrationTemplateProcessCsarHandler.class);
+ private ToscaConverter toscaConverter = new ToscaConverterImpl();
+ private CandidateService candidateService =
+ CandidateServiceFactory.getInstance().createInterface();
+ ToscaTreeManager toscaTreeManager = new ToscaTreeManager();
+
+ @Override
+ public OrchestrationTemplateActionResponse process(VspDetails vspDetails,
+ OrchestrationTemplateCandidateData candidateData,
+ String user) {
+ String vspId = vspDetails.getId();
+ Version version = vspDetails.getVersion();
+ logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.CSAR_VALIDATION_STARTED + vspId);
+ OrchestrationTemplateActionResponse response = new OrchestrationTemplateActionResponse();
+ UploadFileResponse uploadFileResponse = new UploadFileResponse();
+ Optional<FileContentHandler> fileContent =
+ OrchestrationUtil
+ .getFileContentMap(
+ OnboardingTypesEnum.CSAR, uploadFileResponse, candidateData.getContentData().array());
+
+ if(fileContent.isPresent()){
+ try {
+ FileContentHandler fileContentHandler = fileContent.get();
+ processCsar(vspId, version, fileContentHandler, candidateData, response);
+ } catch (CoreException e){
+ logger.error(e.getMessage());
+ throw e;
+ } catch (Exception e){
+ logger.error(e.getMessage());
+ }
+ }
+
+ return response;
+ }
+
+ private void processCsar(String vspId, Version version,
+ FileContentHandler fileContentHandler,
+ OrchestrationTemplateCandidateData candidateData,
+ OrchestrationTemplateActionResponse response) throws IOException {
+
+
+ response.setFileNames(new ArrayList<>(fileContentHandler.getFileList()));
+ Map<String, List<ErrorMessage>> errors = validateCsar(fileContentHandler, response);
+ if(!isValid(errors)){
+ return;
+ }
+
+ HeatStructureTree tree = toscaTreeManager.getTree();
+
+ Map<String, String> componentsQuestionnaire = new HashMap<>();
+ Map<String, Map<String, String>> componentNicsQuestionnaire = new HashMap<>();
+ Map<String, Collection<ComponentMonitoringUploadEntity>> componentMibList = new HashMap<>();
+ Map<String, Collection<ProcessEntity>> processes = new HashMap<>();
+ Map<String, ProcessEntity> processArtifact = new HashMap<>();
+
+ OrchestrationUtil.backupComponentsQuestionnaireBeforeDelete(vspId,
+ version, componentsQuestionnaire,
+ componentNicsQuestionnaire, componentMibList, processes, processArtifact);
+
+ Optional<ByteArrayInputStream> zipByteArrayInputStream = candidateService
+ .fetchZipFileByteArrayInputStream(vspId, candidateData, null, OnboardingTypesEnum.CSAR, errors);
+
+ OrchestrationUtil.deleteUploadDataAndContent(vspId, version);
+ OrchestrationUtil.saveUploadData(
+ vspId, version, zipByteArrayInputStream.get(), fileContentHandler, tree);
+
+ ToscaServiceModel toscaServiceModel = toscaConverter.convert(fileContentHandler);
+ OrchestrationUtil.saveServiceModel(vspId, version, toscaServiceModel, toscaServiceModel);
+
+ }
+
+ private void addFiles(FileContentHandler fileContentHandler){
+ for(Map.Entry<String, byte[]> fileEntry : fileContentHandler.getFiles().entrySet()){
+ toscaTreeManager.addFile(fileEntry.getKey(), fileEntry.getValue());
+ }
+ }
+
+ private Map<String, List<ErrorMessage>> validateCsar(FileContentHandler fileContentHandler,
+ OrchestrationTemplateActionResponse response){
+
+
+ Map<String, List<ErrorMessage>> errors = new HashMap<>();
+ addFiles(fileContentHandler);
+ toscaTreeManager.createTree();
+ toscaTreeManager.addErrors(errors);
+ //todo - add tosca validation here to the existing validation framework
+ return errors;
+ }
+
+ private boolean isValid(Map<String, List<ErrorMessage>> errors){
+ return MapUtils.isEmpty(MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, errors));
+ }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessHandler.java
new file mode 100644
index 0000000000..8b513b4347
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessHandler.java
@@ -0,0 +1,12 @@
+package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.process;
+
+
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.types.OrchestrationTemplateActionResponse;
+
+public interface OrchestrationTemplateProcessHandler {
+ OrchestrationTemplateActionResponse process(VspDetails vspDetails,
+ OrchestrationTemplateCandidateData candidateData,
+ String user);
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessZipHandler.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessZipHandler.java
new file mode 100644
index 0000000000..cceacd47b3
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/orchestration/process/OrchestrationTemplateProcessZipHandler.java
@@ -0,0 +1,184 @@
+package org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.process;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
+import org.openecomp.core.model.dao.ServiceModelDao;
+import org.openecomp.core.model.dao.ServiceModelDaoFactory;
+import org.openecomp.core.translator.datatypes.TranslatorOutput;
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
+import org.openecomp.core.validation.util.MessageContainerUtil;
+import org.openecomp.sdc.activityLog.ActivityLogManager;
+import org.openecomp.sdc.activityLog.ActivityLogManagerFactory;
+import org.openecomp.sdc.activitylog.dao.type.ActivityLogEntity;
+import org.openecomp.sdc.common.errors.Messages;
+import org.openecomp.sdc.common.utils.SdcCommon;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
+import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
+import org.openecomp.sdc.logging.messages.AuditMessages;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.translator.services.heattotosca.HeatToToscaUtil;
+import org.openecomp.sdc.validation.util.ValidationManagerUtil;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ProcessEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.factory.CandidateServiceFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.factory.CompositionDataExtractorFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.factory.CompositionEntityDataManagerFactory;
+import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationUtil;
+import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionDataExtractor;
+import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
+import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.CandidateService;
+import org.openecomp.sdc.vendorsoftwareproduct.types.OrchestrationTemplateActionResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
+import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.FilesDataStructure;
+import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.openecomp.sdcrests.activitylog.types.ActivityType;
+
+import java.io.ByteArrayInputStream;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import static org.openecomp.sdc.logging.messages.AuditMessages.HEAT_VALIDATION_ERROR;
+
+public class OrchestrationTemplateProcessZipHandler implements OrchestrationTemplateProcessHandler {
+ Logger logger = LoggerFactory.getLogger(OrchestrationTemplateProcessZipHandler.class);
+ private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
+ private CandidateService candidateService =
+ CandidateServiceFactory.getInstance().createInterface();
+ private ServiceModelDao serviceModelDao = ServiceModelDaoFactory.getInstance().createInterface();
+ private CompositionEntityDataManager compositionEntityDataManager =
+ CompositionEntityDataManagerFactory.getInstance().createInterface();
+ private CompositionDataExtractor compositionDataExtractor =
+ CompositionDataExtractorFactory.getInstance().createInterface();
+ private ActivityLogManager activityLogManager =
+ ActivityLogManagerFactory.getInstance().createInterface();
+
+
+ public OrchestrationTemplateProcessZipHandler(){}
+
+ public OrchestrationTemplateActionResponse process(VspDetails vspDetails,
+ OrchestrationTemplateCandidateData candidateData,
+ String user) {
+ String vspId = vspDetails.getId();
+ Version version = vspDetails.getVersion();
+ logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.HEAT_VALIDATION_STARTED +
+ vspId);
+ OrchestrationTemplateActionResponse response = new OrchestrationTemplateActionResponse();
+ UploadFileResponse uploadFileResponse = new UploadFileResponse();
+ Optional<FileContentHandler> fileContent =
+ OrchestrationUtil
+ .getFileContentMap(
+ OnboardingTypesEnum.ZIP, uploadFileResponse, candidateData.getContentData().array());
+ if (!fileContent.isPresent()) {
+ response.addStructureErrors(uploadFileResponse.getErrors());
+ mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+ response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList,vspId,
+ HEAT_VALIDATION_ERROR));
+ return response;
+ }
+
+ Map<String, List<ErrorMessage>> uploadErrors = uploadFileResponse.getErrors();
+ FileContentHandler fileContentMap = fileContent.get();
+ FilesDataStructure structure =
+ JsonUtil.json2Object(candidateData.getFilesDataStructure(), FilesDataStructure.class);
+
+ if (CollectionUtils.isNotEmpty(structure.getUnassigned())) {
+ response.addErrorMessageToMap(SdcCommon.UPLOAD_FILE,
+ Messages.FOUND_UNASSIGNED_FILES.getErrorMessage(), ErrorLevel.ERROR);
+
+ mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+ response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList,vspId,
+ HEAT_VALIDATION_ERROR));
+ return response;
+ }
+
+
+ String manifest = candidateService.createManifest(vspDetails, structure);
+ fileContentMap.addFile(SdcCommon.MANIFEST_NAME, manifest.getBytes());
+
+ Optional<ByteArrayInputStream> zipByteArrayInputStream = candidateService
+ .fetchZipFileByteArrayInputStream(
+ vspId, candidateData, manifest, OnboardingTypesEnum.ZIP, uploadErrors);
+ if (!zipByteArrayInputStream.isPresent()) {
+ response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList,vspId,
+ HEAT_VALIDATION_ERROR));
+ return response;
+ }
+
+ HeatStructureTree tree = createAndValidateHeatTree(response, fileContentMap);
+
+ Map<String, String> componentsQuestionnaire = new HashMap<>();
+ Map<String, Map<String, String>> componentNicsQuestionnaire = new HashMap<>();
+ Map<String, Collection<ComponentMonitoringUploadEntity>> componentMibList = new HashMap<>();
+ Map<String, Collection<ProcessEntity>> processes = new HashMap<>();
+ Map<String, ProcessEntity> processArtifact = new HashMap<>();
+
+ OrchestrationUtil.backupComponentsQuestionnaireBeforeDelete(vspId,
+ version, componentsQuestionnaire,
+ componentNicsQuestionnaire, componentMibList, processes, processArtifact);
+
+ OrchestrationUtil.deleteUploadDataAndContent(vspId, version);
+ OrchestrationUtil.saveUploadData(vspId, version, zipByteArrayInputStream.get(), fileContentMap,
+ tree);
+
+ response.getErrors().values().forEach(errorList -> printAuditForErrors(errorList,vspId,
+ HEAT_VALIDATION_ERROR));
+ if ( MapUtils.isEmpty(MessageContainerUtil.getMessageByLevel(ErrorLevel.ERROR, response.getErrors
+ ()))) {
+ logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.HEAT_VALIDATION_COMPLETED + vspId);
+ }
+
+ logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.HEAT_TRANSLATION_STARTED + vspId);
+
+ TranslatorOutput translatorOutput =
+ HeatToToscaUtil.loadAndTranslateTemplateData(fileContentMap);
+
+ ToscaServiceModel toscaServiceModel = translatorOutput.getToscaServiceModel();
+ OrchestrationUtil.saveServiceModel(vspId, version, translatorOutput
+ .getNonUnifiedToscaServiceModel(), toscaServiceModel);
+ OrchestrationUtil.retainComponentQuestionnaireData(vspId, version, componentsQuestionnaire,
+ componentNicsQuestionnaire, componentMibList, processes, processArtifact);
+
+ logger.audit(AuditMessages.AUDIT_MSG + AuditMessages.HEAT_TRANSLATION_COMPLETED + vspId);
+ uploadFileResponse.addStructureErrors(uploadErrors);
+
+ ActivityLogEntity activityLogEntity =
+ new ActivityLogEntity(vspId, String.valueOf(version.getMajor() + 1),
+ ActivityType.UPLOAD_HEAT.toString(), user, true, "", "");
+ activityLogManager.addActionLog(activityLogEntity, user);
+
+ mdcDataDebugMessage.debugExitMessage("VSP id", vspId);
+ return response;
+ }
+
+ private HeatStructureTree createAndValidateHeatTree(OrchestrationTemplateActionResponse response,
+ FileContentHandler fileContentMap) {
+ VendorSoftwareProductUtils.addFileNamesToUploadFileResponse(fileContentMap, response);
+ Map<String, List<ErrorMessage>> validationErrors =
+ ValidationManagerUtil.initValidationManager(fileContentMap).validate();
+ response.getErrors().putAll(validationErrors);
+
+ return OrchestrationUtil.createHeatTree(fileContentMap, validationErrors);
+ }
+
+ private void printAuditForErrors(List<ErrorMessage> errorList, String vspId, String auditType) {
+
+ errorList.forEach(errorMessage -> {
+ if (errorMessage.getLevel().equals(ErrorLevel.ERROR)) {
+ logger.audit(AuditMessages.AUDIT_MSG + String.format(auditType, errorMessage.getMessage(),
+ vspId));
+ }
+ });
+ }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ConfigConstants.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ConfigConstants.java
new file mode 100644
index 0000000000..5e217d4d60
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/ConfigConstants.java
@@ -0,0 +1,6 @@
+package org.openecomp.sdc.vendorsoftwareproduct.types;
+
+public class ConfigConstants {
+ public static final String namespace = "Orchestration";
+ public static final String processImplKey = "process_impl";
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileResponse.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileResponse.java
index 99f3fa1fdf..ca0eed2153 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileResponse.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/types/UploadFileResponse.java
@@ -21,6 +21,7 @@
package org.openecomp.sdc.vendorsoftwareproduct.types;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
@@ -35,6 +36,8 @@ import java.util.Map;
public class UploadFileResponse {
private Map<String, List<ErrorMessage>> errors = new HashMap<>();
private UploadFileStatus status = UploadFileStatus.Success;
+ private OnboardingTypesEnum onboardingType;
+ private String networkPackageName;
public UploadFileStatus getStatus() {
return status;
@@ -44,6 +47,22 @@ public class UploadFileResponse {
this.status = status;
}
+ public OnboardingTypesEnum getOnboardingType() {
+ return onboardingType;
+ }
+
+ public void setOnboardingType(OnboardingTypesEnum onboardingTypesEnum) {
+ this.onboardingType = onboardingTypesEnum;
+ }
+
+ public String getNetworkPackageName() {
+ return networkPackageName;
+ }
+
+ public void setNetworkPackageName(String networkPackageName) {
+ this.networkPackageName = networkPackageName;
+ }
+
/**
* Add structure error.
*
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/resources/config-orchestration.json b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/resources/config-orchestration.json
new file mode 100644
index 0000000000..9193b818b7
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/resources/config-orchestration.json
@@ -0,0 +1,26 @@
+{
+ "orchestration_impl": {
+ "zip": {
+ "enable": true,
+ "implementationClass": "org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationTemplateZipHandler"
+ },
+ "csar": {
+ "enable": true,
+ "implementationClass": "org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.OrchestrationTemplateCSARHandler"
+ }
+ },
+ "process_impl": {
+ "zip" : {
+ "enzble": true,
+ "implementationClass" : "org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.process.OrchestrationTemplateProcessZipHandler"
+ },
+ "csar": {
+ "enable": true,
+ "implementationClass": "org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.process.OrchestrationTemplateProcessCsarHandler"
+ }
+ },
+
+ "_config":{
+ "namespace": "orchestration"
+ }
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/resources/orchestrationConfiguration.json b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/resources/orchestrationConfiguration.json
new file mode 100644
index 0000000000..7509094b56
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/resources/orchestrationConfiguration.json
@@ -0,0 +1,3 @@
+{
+ "zip" :"org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.process.orchestrationTemplateProcessZipHandler"
+} \ No newline at end of file
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/QuestionnaireDataServiceTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/QuestionnaireDataServiceTest.java
index 948d46ba10..3e42a23c6a 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/QuestionnaireDataServiceTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/QuestionnaireDataServiceTest.java
@@ -48,7 +48,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.types.questionnaire.component.Com
import org.openecomp.sdc.versioning.dao.types.Version;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
import java.io.InputStream;
import java.util.List;
@@ -112,7 +111,7 @@ public class QuestionnaireDataServiceTest {
public void testQuestionnaireDataAfterIllegalUpload() {
InputStream zipInputStream = uploadFileTest.getZipInputStream("/missingYml");
UploadFileResponse uploadFileResponse = candidateManager
- .upload(vspId, VERSION, zipInputStream, USER1);
+ .upload(vspId, VERSION, zipInputStream, USER1, "zip", "missingYml");
InformationArtifactData informationArtifactData = questionnaireDataService
.generateQuestionnaireDataForInformationArtifact(vspId, vspActiveVersion);
@@ -124,7 +123,7 @@ public class QuestionnaireDataServiceTest {
InputStream zipInputStream = uploadFileTest.getZipInputStream(filePath);
UploadFileResponse uploadFileResponse = candidateManager
.upload(vspId, VERSION,
- zipInputStream, USER1);
+ zipInputStream, USER1,"zip", "file");
candidateManager.process(vspId, VERSION, USER1);
Assert.assertTrue(MapUtils.isEmpty(
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImplTest.java
index e6d06f2e2c..252e152740 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/OrchestrationTemplateCandidateManagerImplTest.java
@@ -6,6 +6,7 @@ import org.mockito.MockitoAnnotations;
import org.openecomp.core.model.dao.ServiceModelDao;
import org.openecomp.core.model.types.ServiceElement;
import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.datatypes.error.ErrorLevel;
import org.openecomp.sdc.healing.api.HealingManager;
import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
@@ -23,7 +24,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.utils.ZipFileUtils;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
import java.io.IOException;
import java.nio.ByteBuffer;
@@ -90,7 +90,7 @@ public class OrchestrationTemplateCandidateManagerImplTest {
doReturn("{}").when(candidateServiceMock).createManifest(anyObject(), anyObject());
doReturn(Optional.empty()).when(candidateServiceMock)
- .fetchZipFileByteArrayInputStream(anyObject(), anyObject(), anyObject(), anyObject());
+ .fetchZipFileByteArrayInputStream(anyObject(), anyObject(), anyObject(), OnboardingTypesEnum.ZIP, anyObject());
OrchestrationTemplateActionResponse response =
@@ -123,7 +123,7 @@ public class OrchestrationTemplateCandidateManagerImplTest {
UploadFileResponse uploadFileResponse = candidateManager
.upload(VSP_ID, VERSION01, new ZipFileUtils().getZipInputStream("/legalUploadWithWarning"),
- USER1);
+ USER1, "zip", "legalUploadWithWarning");
Assert.assertTrue(uploadFileResponse.getStatus() == UploadFileStatus.Success);
Assert.assertTrue(
uploadFileResponse.getErrors().get("uploadFile").get(0).getLevel() == ErrorLevel.WARNING);
@@ -136,7 +136,7 @@ public class OrchestrationTemplateCandidateManagerImplTest {
public void testUploadWithManifest() {
UploadFileResponse uploadFileResponse = candidateManager
.upload(VSP_ID, VERSION01, new ZipFileUtils().getZipInputStream("/legalUploadWithWarning"),
- USER1);
+ USER1, "zip", "legalUploadWithWarning");
Assert.assertTrue(uploadFileResponse.getStatus() == UploadFileStatus.Success);
Assert.assertTrue(
uploadFileResponse.getErrors().get("uploadFile").get(0).getLevel() == ErrorLevel.WARNING);
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
index 4ead8a57d2..e0e00f8d9d 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/impl/VendorSoftwareProductManagerImplTest.java
@@ -39,7 +39,6 @@ import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
import org.openecomp.sdc.common.errors.Messages;
-import org.openecomp.sdc.common.errors.ValidationErrorBuilder;
import org.openecomp.sdc.healing.api.HealingManager;
import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import org.openecomp.sdc.tosca.datatypes.model.CapabilityDefinition;
@@ -54,14 +53,10 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.PackageInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.PackageInfo;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.UploadDataEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspQuestionnaireEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.errors.VendorSoftwareProductErrorCodes;
import org.openecomp.sdc.vendorsoftwareproduct.impl.mock.EnrichmentManagerFactoryImpl;
import org.openecomp.sdc.vendorsoftwareproduct.informationArtifact.InformationArtifactGenerator;
import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
@@ -92,7 +87,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@@ -357,7 +351,7 @@ public class VendorSoftwareProductManagerImplTest {
"subCategory", "456", fgs);
List<String> updFgs = new ArrayList<String>();
- //updFgs.add("fg2");
+ updFgs.add("fg2");
VspDetails updatedVsp =
createVspDetails(VSP_ID, VERSION01, "VSP1_updated", null, "vendorName", "vlm1Id", "icon",
"category_updated",
@@ -659,7 +653,7 @@ public class VendorSoftwareProductManagerImplTest {
InputStream zis = getFileInputStream("/vspmanager/zips/missingYml.zip");
UploadFileResponse uploadFileResponse =
- candidateManager.upload(VSP_ID, VERSION01, zis, USER1);
+ candidateManager.upload(VSP_ID, VERSION01, zis, USER1, "zip", "missingYml");
Assert.assertEquals(uploadFileResponse.getErrors().size(), 0);
}
@@ -672,7 +666,7 @@ public class VendorSoftwareProductManagerImplTest {
try {
candidateManager
.upload(VSP_ID, VERSION01,
- url.openStream(), USER1);
+ url.openStream(), USER1, "zip", "notZipFile");
candidateManager.process(VSP_ID, VERSION01, USER1);
} catch (Exception ce) {
Assert.assertEquals(ce.getMessage(), Messages.CREATE_MANIFEST_FROM_ZIP.getErrorMessage());
@@ -680,107 +674,7 @@ public class VendorSoftwareProductManagerImplTest {
verify(activityLogManagerMock, never()).addActionLog(any(ActivityLogEntity.class), eq(USER1));
}
-/*
- @Test
- public void testEnrichModelInSubmit() {
- UniqueValueUtil
- .deleteUniqueValue(VendorSoftwareProductConstants.UniqueValues.VENDOR_SOFTWARE_PRODUCT_NAME,
- "VSP_syb");
- VspDetails vspDetails = vendorSoftwareProductManager.createVsp(
- createVspDetails(null, null, "VSP_syb", "Test-vsp_syb", "vendorName", "vlm1Id", "icon",
- "category", "subCategory", "456", null), USER1);
- String id = vspDetails.getId();
-
- //upload file
- InputStream zis = getFileInputStream("/vspmanager/zips/fullComposition.zip");
- candidateManager.upload(id, VERSION01, zis, USER1);
- OrchestrationTemplateActionResponse uploadFileResponse =
- candidateManager.process(id, VERSION01, USER1);
-
- //check in
- vendorSoftwareProductManager.checkin(id, USER1);
- //submit
- try {
- ValidationResponse result = vendorSoftwareProductManager.submit(id, USER1);
- } catch (IOException exception) {
- Assert.fail();
- }
- VersionedVendorSoftwareProductInfo details =
- vendorSoftwareProductManager.getVsp(id, null, USER1);
- Collection<ComponentEntity> components =vendorSoftwareProductManager
- .listComponents(id, details.getVersionInfo().getActiveVersion(), USER1);
-
- ToscaServiceModel model =
- (ToscaServiceModel) EnrichedServiceModelDaoFactory.getInstance().createInterface()
- .getServiceModel(id, details.getVersionInfo().getActiveVersion());
-
- Map<String, CapabilityDefinition> capabilities = new HashMap<>();
- for (ComponentEntity component : components) {
- model.getServiceTemplates().
- entrySet().
- stream().
- filter(entryValue -> entryValue.getValue() != null &&
- entryValue.getValue().getNode_types() != null &&
- entryValue.getValue().
- getNode_types().
- containsKey(component.getComponentCompositionData().getName())).
- forEach(entryValue -> entryValue.getValue().getNode_types().
- values().
- stream().
- filter(type -> MapUtils.isNotEmpty(type.getCapabilities())).
- forEach(type -> type.getCapabilities().
- entrySet().
- forEach(entry -> addCapability(entryValue.getKey(), capabilities, entry.getKey(),
- entry.getValue()))));
-
- }
-
- Assert.assertNotNull(capabilities);
- }
-
- @Test(dependsOnMethods = {"testCreatePackage"})
- public void testEnrichedFilesDeletedOnNewUpload() throws IOException {
- Version activeVersion;
- createPackageFromUpload(VSP_ID, USER1, "/fullComposition");
- activeVersion = vendorSoftwareProductManager.getVsp(VSP_ID, null, USER1).getVersionInfo()
- .getActiveVersion();
-
- List<ServiceArtifact> firstExternalArtifacts = enrichedServiceModelDaoMock
- .getExternalArtifacts(VSP_ID, activeVersion);
- ToscaServiceModel firstServiceModel = enrichedServiceModelDaoMock.getServiceModel(VSP_ID,
- activeVersion);
-
- createPackageFromUpload(VSP_ID, USER1, "/emptyComposition");
- activeVersion = vendorSoftwareProductManager.getVsp(VSP_ID, null, USER1).getVersionInfo()
- .getActiveVersion();
-
- List<ServiceArtifact> secondExternalArtifacts = enrichedServiceModelDaoMock
- .getExternalArtifacts(VSP_ID, activeVersion);
- ToscaServiceModel secondServiceModel = enrichedServiceModelDaoMock.getServiceModel(VSP_ID,
- activeVersion);
-
- Assert.assertNotEquals(firstExternalArtifacts, secondExternalArtifacts);
- Assert.assertNotEquals(firstServiceModel, secondServiceModel);
-
- }
-
- @Test(dependsOnMethods = {"testMibsDeletedInCsar"})
- public void testServiceTemplatesAreDeletedInCsarOnNewUpload() throws IOException {
- String nestedPath = "Definitions" + File.separator + "nested";
-
- uploadFileAndProcess(VSP_ID, USER1, "/vspmanager/zips/fullCompositionNested.zip");
- checkinSubmitCreatePackage(VSP_ID, USER1);
- List<String> nestedFileNamesServiceTemplates =
- getWantedFileNamesFromCsar(nestedPath);
-
- uploadFileAndProcess(VSP_ID, USER1, "/vspmanager/zips/fullComposition.zip");
- checkinSubmitCreatePackage(VSP_ID, USER1);
- List<String> emptyNestedNamesList = getWantedFileNamesFromCsar(nestedPath);
-
- Assert.assertEquals(emptyNestedNamesList.size(), 0);
- Assert.assertNotEquals(emptyNestedNamesList.size(), nestedFileNamesServiceTemplates.size());
- }*/
private List<String> getWantedFileNamesFromCsar(String pathInCsar)
throws IOException {
@@ -806,21 +700,6 @@ public class VendorSoftwareProductManagerImplTest {
return fileNames;
}
- /*
- //Disabled for sonar null pointer issue for componentEntities
- private Pair<String, String> uploadMib(String vspId, String user, String filePath,
- String fileName) {
- List<ComponentEntity> componentEntities = null;
- //(List<ComponentEntity>) vendorSoftwareProductManager.listComponents(vspId, null, user);
- monitoringUploadsManager.upload(getFileInputStream(filePath),
- fileName, vspId,
- VERSION01, componentEntities.get(0).getId(), MonitoringUploadType.SNMP_POLL, user);
- //TODO: add validate of addActionLog() func call
-
- return new ImmutablePair<>(componentEntities.get(0).getId(),
- componentEntities.get(0).getComponentCompositionData()
- .getDisplayName());
- }*/
private void createPackageFromUpload(String vspId, String user, String filePath)
throws IOException {
@@ -830,7 +709,7 @@ public class VendorSoftwareProductManagerImplTest {
private void uploadFileAndProcess(String vspId, String user, String filePath) {
vendorSoftwareProductManager.checkout(vspId, user);
- candidateManager.upload(vspId, VERSION01, getFileInputStream(filePath), user);
+ candidateManager.upload(vspId, VERSION01, getFileInputStream(filePath), user, "zip", "file");
candidateManager.process(vspId, VERSION01, user);
}
@@ -888,7 +767,7 @@ public class VendorSoftwareProductManagerImplTest {
*/
private void testLegalUpload(String vspId, Version version, InputStream upload, String user) {
- candidateManager.upload(vspId, VERSION01, upload, USER1);
+ candidateManager.upload(vspId, VERSION01, upload, USER1, "zip", "file");
candidateManager.process(vspId, VERSION01, user);
UploadDataEntity uploadData =
@@ -919,23 +798,6 @@ public class VendorSoftwareProductManagerImplTest {
}
- // private void assertInfoArtifactIsInRightPathInCsar(String vspId, String zipFileName)
-// throws IOException {
-// ZipInputStream inputZipStream = new ZipInputStream(new FileInputStream(new File(zipFileName)));
-// boolean isInfoArtifactInZip = false;
-//
-// ZipEntry zipEntry;
-// while ((zipEntry = inputZipStream.getNextEntry()) != null) {
-// String currentEntryName = zipEntry.getName();
-// if(currentEntryName.equals("Artifacts\\Informative\\Guide\\VSP_" +
-// vspId + "_Information.txt")){
-// isInfoArtifactInZip = true;
-// break;
-// }
-// }
-//
-// Assert.assertTrue(isInfoArtifactInZip);
-// }
static VspDetails createVspDetails(String id, Version version, String name, String desc,
String vendorName, String vlm, String icon,
String category, String subCategory,
@@ -969,45 +831,7 @@ public class VendorSoftwareProductManagerImplTest {
Assert.assertEquals(actual.getFeatureGroups(), expected.getFeatureGroups());
}
-
-// @Test
-// public void testDownloadFile() throws IOException {
-// VspDetails expectedVsp = VSPCommon.createVspDetails(null, null, String.format("VSP-test-%s", vlm1Id), "Test-vsp", "vendorName", "vlm1Id", "icon", "category", "subCategory", "123", null);
-// VspDetails createdVsp = vendorSoftwareProductManager.createVsp(expectedVsp, USER1);
-//
-// id005 = createdVsp.getId();
-// Assert.assertNotNull(id005);
-// Assert.assertNotNull(createdVsp.getVersion());
-//
-// try (InputStream zipInputStream = new ZipFileUtils().getZipInputStream("/legalUploadWithWarning")) {
-//
-// UploadFileResponse uploadFileResponse = vendorSoftwareProductManager.upload(id005, zipInputStream, USER1);
-// vendorSoftwareProductManager.process(id005, USER1);
-// Optional<File> fileCandidate = vendorSoftwareProductManager.get(id005, USER1);
-//
-// File latestHeatPackage = fileCandidate.get();
-//
-// zipInputStream.reset();
-// byte[] uploaded = IOUtils.toByteArray(zipInputStream);
-//
-// Optional<FileContentHandler> zipContentMap = vendorSoftwareProductManager.getZipContentMap(uploadFileResponse, uploaded);
-// FileContentHandler fileContentHandler = new FileContentHandler();
-// if(zipContentMap.isPresent()){
-// fileContentHandler = zipContentMap.get();
-// }
-//
-// uploaded = IOUtils.toByteArray(fileContentHandler.getFiles().values());
-//
-// byte[] downloaded;
-// try (BufferedInputStream fileStream = new BufferedInputStream(new FileInputStream(latestHeatPackage))) {
-// downloaded = IOUtils.toByteArray(fileStream);
-// }
-//
-// Assert.assertTrue(Arrays.equals(uploaded, downloaded));
-// }
-// }
-
- // todo ********************** move to common **************************************
+ // todo ********************** move to common **************************************
private void mockVersioning(VersionableEntityAction action) {
VersionInfo versionInfo = new VersionInfo();
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java
index 236b7e7594..dfb7409bd0 100644
--- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/tree/UploadFileTest.java
@@ -27,6 +27,7 @@ import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.openecomp.core.model.dao.ServiceModelDao;
import org.openecomp.core.model.types.ServiceElement;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.healing.api.HealingManager;
import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
@@ -37,92 +38,86 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.impl.OrchestrationTemplateCandidateManagerImpl;
import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionDataExtractor;
import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
-import org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule.CandidateService;
import org.openecomp.sdc.vendorsoftwareproduct.services.impl.filedatastructuremodule.CandidateServiceImpl;
+import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
import org.openecomp.sdc.vendorsoftwareproduct.utils.VSPCommon;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
import java.net.URL;
import java.util.zip.ZipOutputStream;
import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doReturn;
+import static org.testng.Assert.assertEquals;
public class UploadFileTest {
- private static final String USER1 = "vspTestUser1";
-
- public static final Version VERSION01 = new Version(0, 1);
- @Mock
- private VendorSoftwareProductDao vendorSoftwareProductDaoMock;
- @Mock
- private OrchestrationTemplateDao orchestrationTemplateDataDaoMock;
- @Spy
- private CandidateServiceImpl candidateService;
- @Mock
- private HealingManager healingManagerMock;
- @Mock
- private CompositionDataExtractor compositionDataExtractorMock;
- @Mock
- private ServiceModelDao<ToscaServiceModel, ServiceElement> serviceModelDaoMock;
- @Mock
- private CompositionEntityDataManager compositionEntityDataManagerMock;
- @Mock
- private VendorSoftwareProductInfoDao vspInfoDaoMock;
-
- @InjectMocks
- private OrchestrationTemplateCandidateManagerImpl candidateManager;
-
- private static String vlm1Id;
- public static String id001 = null;
- public static String id002 = null;
-
- public static Version activeVersion002 = null;
-
-
- @BeforeMethod
- public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
- }
-
- @Test
- public void testUploadFile() {
- VspDetails vspDetails = new VspDetails("dummyId", new Version(1, 0));
- doReturn(vspDetails).when(vspInfoDaoMock).get(any(VspDetails.class));
- candidateManager.upload(id001, activeVersion002, getZipInputStream("/legalUpload"), USER1);
- }
-
-
- private void testLegalUpload(String vspId, Version version, InputStream upload, String user) {
- candidateManager.upload(vspId, activeVersion002, upload, user);
-
- UploadDataEntity uploadData =
- orchestrationTemplateDataDaoMock.getOrchestrationTemplate(vspId, version);
-
- }
-
- public InputStream getZipInputStream(String name) {
- URL url = this.getClass().getResource(name);
- File templateDir = new File(url.getFile());
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ZipOutputStream zos = new ZipOutputStream(baos);
-
- VSPCommon.zipDir(templateDir, "", zos, true);
- try {
- zos.close();
- } catch (IOException e) {
- e.printStackTrace();
+ private static final String USER1 = "vspTestUser1";
+
+ public static final Version VERSION01 = new Version(0, 1);
+ @Mock
+ private VendorSoftwareProductDao vendorSoftwareProductDaoMock;
+ @Mock
+ private OrchestrationTemplateDao orchestrationTemplateDataDaoMock;
+ @Spy
+ private CandidateServiceImpl candidateService;
+ @Mock
+ private HealingManager healingManagerMock;
+ @Mock
+ private CompositionDataExtractor compositionDataExtractorMock;
+ @Mock
+ private ServiceModelDao<ToscaServiceModel, ServiceElement> serviceModelDaoMock;
+ @Mock
+ private CompositionEntityDataManager compositionEntityDataManagerMock;
+ @Mock
+ private VendorSoftwareProductInfoDao vspInfoDaoMock;
+
+ @InjectMocks
+ private OrchestrationTemplateCandidateManagerImpl candidateManager;
+
+ private static String vlm1Id;
+ public static String id001 = null;
+ public static String id002 = null;
+
+ public static Version activeVersion002 = null;
+
+
+ @BeforeMethod
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void testUploadFile() {
+ VspDetails vspDetails = new VspDetails("dummyId", new Version(1, 0));
+ doReturn(vspDetails).when(vspInfoDaoMock).get(any(VspDetails.class));
+ candidateManager.upload(id001, activeVersion002, getZipInputStream("/legalUpload"), USER1, OnboardingTypesEnum.ZIP.toString(), "legalUpload");
+ }
+
+
+ private void testLegalUpload(String vspId, Version version, InputStream upload, String user) {
+ UploadFileResponse uploadFileResponse = candidateManager.upload(vspId, activeVersion002,
+ upload, user, OnboardingTypesEnum.ZIP.toString(),"file" );
+ assertEquals(uploadFileResponse.getOnboardingType(), OnboardingTypesEnum.ZIP);
+ UploadDataEntity uploadData =
+ orchestrationTemplateDataDaoMock.getOrchestrationTemplate(vspId, version);
+
+ }
+
+ public InputStream getZipInputStream(String name) {
+ URL url = this.getClass().getResource(name);
+ File templateDir = new File(url.getFile());
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ try (ZipOutputStream zos = new ZipOutputStream(baos)) {
+ VSPCommon.zipDir(templateDir, "", zos, true);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return new ByteArrayInputStream(baos.toByteArray());
}
- return new ByteArrayInputStream(baos.toByteArray());
- }
}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/ManifestParsingTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/ManifestParsingTest.java
new file mode 100644
index 0000000000..3332e81e36
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/ManifestParsingTest.java
@@ -0,0 +1,58 @@
+package org.openecomp.sdc.vendorsoftwareproduct.upload.csar;
+
+import org.junit.Test;
+import org.openecomp.sdc.common.errors.Messages;
+import org.openecomp.sdc.vendorsoftwareproduct.impl.orchestration.csar.OnboardingManifest;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import static org.junit.Assert.*;
+
+public class ManifestParsingTest {
+
+ @Test
+ public void testSuccessfulParsing() throws IOException {
+ try (InputStream is = getClass().getResourceAsStream("/vspmanager.csar/manifest/ValidTosca.mf")) {
+ OnboardingManifest onboardingManifest = new OnboardingManifest(is);
+ assertTrue(onboardingManifest.isValid());
+ assertEquals(onboardingManifest.getMetadata().size(), 4);
+ assertEquals(onboardingManifest.getSources().size(), 5);
+ }
+ }
+
+ @Test
+ public void testNoMetadataParsing() throws IOException {
+ try (InputStream is = getClass().getResourceAsStream("/vspmanager.csar/manifest/InvalidTosca1.mf")) {
+ OnboardingManifest onboardingManifest = new OnboardingManifest(is);
+ assertFalse(onboardingManifest.isValid());
+ assertTrue(onboardingManifest.getErrors().stream().
+ filter(error -> error.contains(Messages.MANIFEST_INVALID_LINE.getErrorMessage().substring(0, 10)))
+ .findAny().isPresent());
+ }
+ }
+
+ @Test
+ public void testBrokenMDParsing() throws IOException {
+ try (InputStream is = getClass().getResourceAsStream("/vspmanager.csar/manifest/InvalidTosca2.mf")) {
+ OnboardingManifest onboardingManifest = new OnboardingManifest(is);
+ assertFalse(onboardingManifest.isValid());
+ assertTrue(onboardingManifest.getErrors().stream().
+ filter(error -> error.contains(Messages.MANIFEST_INVALID_LINE.getErrorMessage().substring(0, 10)))
+ .findAny().isPresent());
+ }
+ }
+
+ @Test
+ public void testNoMetaParsing() throws IOException {
+ try (InputStream is = getClass().getResourceAsStream("/vspmanager.csar/manifest/InvalidTosca4.mf")) {
+ OnboardingManifest onboardingManifest = new OnboardingManifest(is);
+ assertFalse(onboardingManifest.isValid());
+ assertTrue(onboardingManifest.getErrors().stream().
+ filter(error -> error.contains(Messages.MANIFEST_NO_METADATA.getErrorMessage().substring(0, 10)))
+ .findAny().isPresent());
+ }
+ }
+
+
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/UploadCSARFileTest.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/UploadCSARFileTest.java
new file mode 100644
index 0000000000..a7fc0e1ba0
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/java/org/openecomp/sdc/vendorsoftwareproduct/upload/csar/UploadCSARFileTest.java
@@ -0,0 +1,221 @@
+/*-
+ * ============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.sdc.vendorsoftwareproduct.upload.csar;
+
+
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.Spy;
+import org.openecomp.core.model.dao.ServiceModelDao;
+import org.openecomp.core.model.types.ServiceElement;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
+import org.openecomp.sdc.common.errors.Messages;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
+import org.openecomp.sdc.healing.api.HealingManager;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateCandidateDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.vendorsoftwareproduct.impl.OrchestrationTemplateCandidateManagerImpl;
+import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionDataExtractor;
+import org.openecomp.sdc.vendorsoftwareproduct.services.composition.CompositionEntityDataManager;
+import org.openecomp.sdc.vendorsoftwareproduct.services.impl.filedatastructuremodule.CandidateServiceImpl;
+import org.openecomp.sdc.vendorsoftwareproduct.services.impl.filedatastructuremodule.ManifestCreatorNamingConventionImpl;
+import org.openecomp.sdc.vendorsoftwareproduct.types.UploadFileResponse;
+import org.openecomp.sdc.versioning.dao.types.Version;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.List;
+import java.util.function.Predicate;
+
+import static org.junit.Assert.*;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doReturn;
+
+public class UploadCSARFileTest {
+ private static final String USER1 = "vspTestUser1";
+
+ public static final Version VERSION01 = new Version(0, 1);
+
+ @Mock
+ private VendorSoftwareProductDao vendorSoftwareProductDaoMock;
+ @Mock
+ private OrchestrationTemplateDao orchestrationTemplateDataDaoMock;
+
+ @Spy
+ private CandidateServiceImpl candidateService;
+ @Mock
+ private HealingManager healingManagerMock;
+ @Mock
+ private CompositionDataExtractor compositionDataExtractorMock;
+ @Mock
+ private ServiceModelDao<ToscaServiceModel, ServiceElement> serviceModelDaoMock;
+ @Mock
+ private CompositionEntityDataManager compositionEntityDataManagerMock;
+ @Mock
+ private VendorSoftwareProductInfoDao vspInfoDaoMock;
+ @Mock
+ private OrchestrationTemplateCandidateDao orchestrationTemplateCandidateDao;
+ @Mock
+ private ManifestCreatorNamingConventionImpl manifestCreator;
+
+ private OrchestrationTemplateCandidateManagerImpl candidateManager;
+
+
+ public static String id001 = null;
+
+ public static Version activeVersion002 = null;
+
+
+ @BeforeMethod
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ candidateService = new CandidateServiceImpl(manifestCreator,orchestrationTemplateCandidateDao);
+ candidateManager = new OrchestrationTemplateCandidateManagerImpl( vendorSoftwareProductDaoMock,
+ vspInfoDaoMock,
+ orchestrationTemplateDataDaoMock,
+ candidateService, healingManagerMock,
+ compositionDataExtractorMock,
+ serviceModelDaoMock,
+ compositionEntityDataManagerMock,
+ null,
+ null,
+ null,
+ null,
+ null);
+ }
+
+ @Test
+ public void testSuccessfulUploadFile() throws Exception {
+ VspDetails vspDetails = new VspDetails("dummyId", new Version(1, 0));
+ doReturn(vspDetails).when(vspInfoDaoMock).get(any(VspDetails.class));
+
+ try (InputStream is = getClass().getResourceAsStream("/vspmanager.csar/SDCmock.csar")) {
+ UploadFileResponse uploadFileResponse = candidateManager.upload(id001, activeVersion002, is, USER1, "csar", "SDCmock");
+ assertEquals(uploadFileResponse.getOnboardingType(), OnboardingTypesEnum.CSAR);
+ assertEquals(0, uploadFileResponse.getErrors().size());
+ assertTrue(uploadFileResponse.getErrors().isEmpty());
+ }
+ }
+
+ @Test
+ public void testFail1UploadFile() throws Exception {
+ VspDetails vspDetails = new VspDetails("dummyId", new Version(1, 0));
+ doReturn(vspDetails).when(vspInfoDaoMock).get(any(VspDetails.class));
+
+ try (InputStream is = getClass().getResourceAsStream("/vspmanager.csar/SDCmockFail1.csar")) {
+ UploadFileResponse uploadFileResponse = candidateManager.upload(id001, activeVersion002, is, USER1,
+ "csar", "SDCmockFail1");
+ assertEquals(uploadFileResponse.getOnboardingType(), OnboardingTypesEnum.CSAR);
+ assertEquals(1, uploadFileResponse.getErrors().size());
+ assertTrue( uploadFileResponse.getErrors().values().stream()
+ .filter(getListPredicate(Messages.CSAR_FILES_NOT_ALLOWED
+ .getErrorMessage().substring(0, 7))).findAny().isPresent());
+ }
+ }
+
+ private Predicate<List<ErrorMessage>> getListPredicate(String substring) {
+ return error -> isEquals(substring, error);
+ }
+
+ private boolean isEquals(String substring, List<ErrorMessage> error) {
+ return error.iterator().next().getMessage().contains(substring);
+ }
+
+ @Test
+ public void testFail2UploadFile() throws Exception {
+ VspDetails vspDetails = new VspDetails("dummyId", new Version(1, 0));
+ doReturn(vspDetails).when(vspInfoDaoMock).get(any(VspDetails.class));
+
+ try (InputStream is = getClass().getResourceAsStream("/vspmanager.csar/SDCmockFail2.csar")) {
+ UploadFileResponse uploadFileResponse = candidateManager.upload(id001, activeVersion002, is, USER1,
+ "csar", "SDCmockFail2");
+ assertEquals(uploadFileResponse.getOnboardingType(), OnboardingTypesEnum.CSAR);
+ assertEquals(1, uploadFileResponse.getErrors().size());
+ assertTrue( uploadFileResponse.getErrors().values().stream()
+ .filter(getListPredicate(Messages.CSAR_FILE_NOT_FOUND
+ .getErrorMessage().substring(0,7))).findAny().isPresent());
+ }
+ }
+ @Test
+ public void testFail3UploadFile() throws Exception {
+ VspDetails vspDetails = new VspDetails("dummyId", new Version(1, 0));
+ doReturn(vspDetails).when(vspInfoDaoMock).get(any(VspDetails.class));
+
+ try (InputStream is = getClass().getResourceAsStream("/vspmanager.csar/SDCmockFail3.csar")) {
+ UploadFileResponse uploadFileResponse = candidateManager.upload(id001, activeVersion002, is, USER1,
+ "csar", "SDCmockFail3");
+ assertEquals(uploadFileResponse.getOnboardingType(), OnboardingTypesEnum.CSAR);
+ assertEquals(1, uploadFileResponse.getErrors().size());
+ }
+ }
+
+ @Test
+ public void testUploadFileIsNotZip() throws Exception {
+ VspDetails vspDetails = new VspDetails("dummyId", new Version(1, 0));
+ doReturn(vspDetails).when(vspInfoDaoMock).get(any(VspDetails.class));
+
+ try (InputStream is = new ByteArrayInputStream( "Thia is not a zip file".getBytes() );) {
+ UploadFileResponse uploadFileResponse = candidateManager.upload(id001, activeVersion002, is, USER1,
+ "csar", "file");
+ assertEquals(uploadFileResponse.getOnboardingType(), OnboardingTypesEnum.CSAR);
+ assertFalse(uploadFileResponse.getErrors().isEmpty());
+ assertTrue( uploadFileResponse.getErrors().values().stream()
+ .filter(getListPredicate(Messages.CSAR_FILE_NOT_FOUND
+ .getErrorMessage().substring(0,7))).findAny().isPresent());
+ }
+ }
+ @Test
+ public void testUploadFileIsEmpty() throws Exception {
+ VspDetails vspDetails = new VspDetails("dummyId", new Version(1, 0));
+ doReturn(vspDetails).when(vspInfoDaoMock).get(any(VspDetails.class));
+
+ try (InputStream is = new ByteArrayInputStream( new byte[]{} )) {
+ UploadFileResponse uploadFileResponse = candidateManager.upload(id001,
+ activeVersion002, is, USER1, "csar", "file");
+ assertEquals(uploadFileResponse.getOnboardingType(), OnboardingTypesEnum.CSAR);
+ assertEquals(1, uploadFileResponse.getErrors().size());
+ }
+ }
+
+ @Test
+ public void testMFError() throws Exception {
+ VspDetails vspDetails = new VspDetails("dummyId", new Version(1, 0));
+ doReturn(vspDetails).when(vspInfoDaoMock).get(any(VspDetails.class));
+
+ try (InputStream is = getClass().getResourceAsStream("/vspmanager.csar/SDCmockBrokenMF.csar")) {
+ UploadFileResponse uploadFileResponse = candidateManager.upload(id001, activeVersion002, is, USER1, "csar", "SDCmockBrokenMF");
+ assertEquals(uploadFileResponse.getOnboardingType(), OnboardingTypesEnum.CSAR);
+ assertEquals(1, uploadFileResponse.getErrors().size());
+ assertTrue( uploadFileResponse.getErrors()
+ .values().stream()
+ .filter(getListPredicate(Messages.MANIFEST_NO_METADATA.getErrorMessage())).findAny().isPresent());
+
+ }
+ }
+
+
+}
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmock.csar b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmock.csar
new file mode 100644
index 0000000000..f69efd2bb8
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmock.csar
Binary files differ
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockBrokenMF.csar b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockBrokenMF.csar
new file mode 100644
index 0000000000..02593a1d2f
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockBrokenMF.csar
Binary files differ
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockFail1.csar b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockFail1.csar
new file mode 100644
index 0000000000..5e3ee6f387
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockFail1.csar
Binary files differ
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockFail2.csar b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockFail2.csar
new file mode 100644
index 0000000000..4874578ad9
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockFail2.csar
Binary files differ
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockFail3.csar b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockFail3.csar
new file mode 100644
index 0000000000..c009a042e4
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/SDCmockFail3.csar
Binary files differ
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf
new file mode 100644
index 0000000000..f28014e2d6
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca1.mf
@@ -0,0 +1,11 @@
+
+
+source: MainServiceTemplate.yaml
+
+source: Definitions/GlobalSubstitutionTypesServiceTemplate.yaml
+
+source: Artifacts/install.sh
+
+source: Artifacts/create_stack.sh
+
+source: Licenses/license.xml
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf
new file mode 100644
index 0000000000..95f7a41d68
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca2.mf
@@ -0,0 +1,18 @@
+metadata:
+ vnf_product_name: Mock
+ vnf_provider_id: ZTE
+
+source: MainServiceTemplate.yaml
+
+ vnf_package_version: 1.0
+ vnf_release_data_time: 2017.01.01T10:00+03:00
+
+
+
+source: Definitions/GlobalSubstitutionTypesServiceTemplate.yaml
+
+source: Artifacts/install.sh
+
+source: Artifacts/create_stack.sh
+
+source: Licenses/license.xml
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf
new file mode 100644
index 0000000000..64e9445f7f
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca3.mf
@@ -0,0 +1,7 @@
+metadata:
+ vnf_product_name: Mock
+ vnf_provider_id: ZTE
+ vnf_package_version: 1.0
+ vnf_release_data_time: 2017.01.01T10:00+03:00
+
+
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf
new file mode 100644
index 0000000000..a563ddd581
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/InvalidTosca4.mf
@@ -0,0 +1,12 @@
+metadata:
+
+
+source: MainServiceTemplate.yaml
+
+source: Definitions/GlobalSubstitutionTypesServiceTemplate.yaml
+
+source: Artifacts/install.sh
+
+source: Artifacts/create_stack.sh
+
+source: Licenses/license.xml
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf
new file mode 100644
index 0000000000..88c67517ce
--- /dev/null
+++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/test/resources/vspmanager.csar/manifest/ValidTosca.mf
@@ -0,0 +1,15 @@
+metadata:
+ vnf_product_name: Mock
+ vnf_provider_id: ZTE
+ vnf_package_version: 1.0
+ vnf_release_data_time: 2017.01.01T10:00+03:00
+
+source: MainServiceTemplate.yaml
+
+source: Definitions/GlobalSubstitutionTypesServiceTemplate.yaml
+
+source: Artifacts/install.sh
+
+source: Artifacts/create_stack.sh
+
+source: Licenses/license.xml
diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java
index 9fff4bd749..8bcb0a5ffe 100644
--- a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java
+++ b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/errors/Messages.java
@@ -28,6 +28,14 @@ public enum Messages {
"functionalities"),
INVALID_ZIP_FILE("Invalid zip file"),
+ INVALID_CSAR_FILE("Invalid csar file"),
+ CSAR_FILE_NOT_FOUND("Each CSAR file must contain %s file."),
+ CSAR_DIRECTORIES_NOT_ALLOWED("Directory : %s , is not allowed."),
+ CSAR_FILES_NOT_ALLOWED("File : %s , are not allowed."),
+ MANIFEST_INVALID_LINE("Manifest contains invalid line : %s"),
+ MANIFEST_NO_METADATA("Manifest must contain metadata"),
+ MANIFEST_NO_SOURCES("Manifest must contain source"),
+ MANIFEST_PARSER_INTERNAL("Invalid manifest file"),
FAILED_TO_TRANSLATE_ZIP_FILE("Failed to translate zip file"),
ZIP_NOT_EXIST("Zip file doesn't exist"),
@@ -45,7 +53,7 @@ public enum Messages {
NO_ZIP_FILE_WAS_UPLOADED_OR_ZIP_NOT_EXIST("no zip file was uploaded or zip file doesn't exist"),
MAPPING_OBJECTS_FAILURE("Failed to map object %s to %s. Exception message: %s"),
MORE_THEN_ONE_VOL_FOR_HEAT("heat contains more then one vol. selecting only first vol"),
- ZIP_CONTENT_MAP("failed to load zip content"),
+ FILE_CONTENT_MAP("failed to load %s content"),
CREATE_MANIFEST_FROM_ZIP("cannot create manifest from the attached zip file"),
CANDIDATE_PROCESS_FAILED("Candidate zip file process failed"),
FOUND_UNASSIGNED_FILES("cannot process zip since it has unassigned files"),
@@ -66,7 +74,9 @@ public enum Messages {
INVALID_MANIFEST_FILE("invalid manifest file"),
INVALID_FILE_TYPE("Missing or Unknown file type in Manifest"),
ENV_NOT_ASSOCIATED_TO_HEAT("ENV file must be associated to a HEAT file"),
-
+ CSAR_MANIFEST_FILE_NOT_EXIST("CSAR manifest file does not exist"),
+ CSAR_FAILED_TO_READ("CSAR file is not readable"),
+ TOSCA_PARSING_FAILURE("Invalid tosca file. Error code : %s, Error message : %s/"),
/* content errors*/
INVALID_YAML_FORMAT("Invalid YAML format - %s"),
INVALID_YAML_FORMAT_REASON("Invalid YAML format Problem - [%s]"),
diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/CommonUtil.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/CommonUtil.java
index f4d6209eec..1c5293004d 100644
--- a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/CommonUtil.java
+++ b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/CommonUtil.java
@@ -22,8 +22,11 @@ package org.openecomp.sdc.common.utils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.commons.lang3.tuple.Pair;
import org.openecomp.core.utilities.file.FileContentHandler;
import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
@@ -45,38 +48,54 @@ import java.util.zip.ZipInputStream;
public class CommonUtil {
- public static FileContentHandler validateAndUploadFileContent(byte[] uploadedFileData)
+ public static FileContentHandler validateAndUploadFileContent(OnboardingTypesEnum type,
+ byte[] uploadedFileData)
throws IOException {
- return getFileContentMapFromOrchestrationCandidateZipAndValidateNoFolders(uploadedFileData);
+ return getFileContentMapFromOrchestrationCandidateZipAndValidateNoFolders(type, uploadedFileData);
}
/**
* Gets files out of the zip AND validates zip is flat (no folders)
*
+ *
+ * @param type
* @param uploadFileData zip file
* @return FileContentHandler if input is valid and has no folders
*/
private static FileContentHandler getFileContentMapFromOrchestrationCandidateZipAndValidateNoFolders(
- byte[] uploadFileData)
+ OnboardingTypesEnum type, byte[] uploadFileData)
throws IOException {
+ Pair<FileContentHandler,List<String> > pair = getFileContentMapFromOrchestrationCandidateZip(uploadFileData);
- List<String> folderList = new ArrayList<>();
- FileContentHandler mapFileContent = new FileContentHandler();
+ if(type.equals(OnboardingTypesEnum.ZIP)) {
+ validateNoFolders(pair.getRight());
+ }
- try (ZipInputStream inputZipStream = new ZipInputStream(new ByteArrayInputStream(uploadFileData))) {
+ return pair.getLeft();
+ }
+ public static Pair<FileContentHandler,List<String> > getFileContentMapFromOrchestrationCandidateZip(
+ byte[] uploadFileData)
+ throws IOException {
+ ZipEntry zipEntry;
+ List<String> folderList = new ArrayList<>();
+ FileContentHandler mapFileContent = new FileContentHandler();
+ try ( ByteArrayInputStream in = new ByteArrayInputStream(uploadFileData);
+ ZipInputStream inputZipStream = new ZipInputStream(in)){
+ byte[] fileByteContent;
String currentEntryName;
- ZipEntry zipEntry;
while ((zipEntry = inputZipStream.getNextEntry()) != null) {
-
currentEntryName = zipEntry.getName();
+ // else, get the file content (as byte array) and save it in a map.
+ fileByteContent = FileUtils.toByteArray(inputZipStream);
+
int index = lastIndexFileSeparatorIndex(currentEntryName);
if (index != -1) { //todo ?
folderList.add(currentEntryName);
- } else {
- // else, get the file content (as byte array) and save it in a map.
- mapFileContent.addFile(currentEntryName, FileUtils.toByteArray(inputZipStream));
+ }
+ if(isFile(currentEntryName)) {
+ mapFileContent.addFile(currentEntryName, fileByteContent);
}
}
@@ -84,9 +103,11 @@ public class CommonUtil {
throw new IOException(exception);
}
- validateNoFolders(folderList);
+ return new ImmutablePair<>(mapFileContent,folderList);
+ }
- return mapFileContent;
+ private static boolean isFile(String currentEntryName) {
+ return !(currentEntryName.endsWith("\\") || currentEntryName.endsWith("/"));
}
private static void validateNoFolders(List<String> folderList) {
diff --git a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/SdcCommon.java b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/SdcCommon.java
index 156a86c841..24da8363c1 100644
--- a/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/SdcCommon.java
+++ b/openecomp-be/lib/openecomp-common-lib/src/main/java/org/openecomp/sdc/common/utils/SdcCommon.java
@@ -23,6 +23,7 @@ package org.openecomp.sdc.common.utils;
public class SdcCommon {
public static final String MANIFEST_NAME = "MANIFEST.json";
+ public static final String CSAR_MANIFEST_NAME = "MainServiceTemplate.mf";
public static final String UPLOAD_FILE = "uploadFile";
public static final String PROCESS_FILE = "Process File";
public static final String ILLEGAL_MANIFEST = "Illegal manifest";
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java
index e04f02cce5..0fb587cc68 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/file/FileUtils.java
@@ -20,6 +20,7 @@
package org.openecomp.core.utilities.file;
+import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.openecomp.core.utilities.json.JsonUtil;
import org.openecomp.sdc.tosca.services.YamlUtil;
@@ -195,6 +196,19 @@ public class FileUtils {
return fileName.substring(0, fileName.lastIndexOf("."));
}
+ public static String getFileExtension(String filename) {
+ return FilenameUtils.getExtension(filename);
+ }
+
+ public static String getNetworkPackageName(String filename){
+ String[] split = filename.split("\\.");
+ String name = null;
+ if (split != null && split.length > 1){
+ name = split[0];
+ }
+ return name;
+ }
+
/**
* Gets file content map from zip.
*
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/orchestration/OnboardingTypesEnum.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/orchestration/OnboardingTypesEnum.java
new file mode 100644
index 0000000000..04e64c33a9
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/orchestration/OnboardingTypesEnum.java
@@ -0,0 +1,32 @@
+package org.openecomp.core.utilities.orchestration;
+
+import java.util.Optional;
+
+import static java.util.Arrays.asList;
+public enum OnboardingTypesEnum {
+ CSAR("csar"), ZIP("zip"), NONE("none");
+ private String type;
+
+ OnboardingTypesEnum(String type) {
+ this.type = type;
+ }
+
+ @Override
+ public String toString() {
+ return type;
+ }
+
+ public static final OnboardingTypesEnum getOnboardingTypesEnum(final String inStr) {
+ if (inStr == null) {
+ return null;
+ }
+ Optional<OnboardingTypesEnum> onboardingTypesOptional = asList(OnboardingTypesEnum.values()).stream()
+ .filter(onboardingTypesEnum -> onboardingTypesEnum.toString().equals(inStr)).findAny();
+ if( onboardingTypesOptional.isPresent()){
+ return onboardingTypesOptional.get();
+ }else {
+ return null;
+ }
+ }
+
+}
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/pom.xml b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/pom.xml
index 618922c2af..03ee98dd4e 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/pom.xml
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/pom.xml
@@ -33,6 +33,13 @@
<artifactId>openecomp-sdc-vendor-license-api</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
</project>
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java
index bdb7bc3a93..9800d02ba6 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/CompositionDataHealer.java
@@ -27,6 +27,7 @@ import org.openecomp.core.model.types.ServiceElement;
import org.openecomp.core.translator.datatypes.TranslatorOutput;
import org.openecomp.core.utilities.file.FileContentHandler;
import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.common.utils.CommonUtil;
import org.openecomp.sdc.common.utils.SdcCommon;
import org.openecomp.sdc.healing.interfaces.Healer;
@@ -49,7 +50,6 @@ import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.OrchestrationTemplateDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComputeEntity;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.DeploymentFlavorEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ImageEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NetworkEntity;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.NicEntity;
@@ -300,7 +300,8 @@ public class CompositionDataHealer implements Healer {
FileContentHandler fileContentHandler;
try {
fileContentHandler =
- CommonUtil.validateAndUploadFileContent(uploadData.getContentData().array());
+ CommonUtil.validateAndUploadFileContent(
+ OnboardingTypesEnum.ZIP, uploadData.getContentData().array());
return HeatToToscaUtil.loadAndTranslateTemplateData(fileContentHandler);
} catch (Exception e) {
return null;
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/FileDataStructureHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/FileDataStructureHealer.java
index e0b7adb6d3..0d484440cf 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/FileDataStructureHealer.java
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/FileDataStructureHealer.java
@@ -22,6 +22,7 @@ package org.openecomp.sdc.healing.healers;
import org.openecomp.core.utilities.file.FileContentHandler;
import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.common.utils.CommonUtil;
import org.openecomp.sdc.common.utils.SdcCommon;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
@@ -94,7 +95,7 @@ public class FileDataStructureHealer implements Healer {
byte[] byteContentData = uploadData.getContentData().array();
FileContentHandler fileContentHandler;
try{
- fileContentHandler = CommonUtil.validateAndUploadFileContent(byteContentData);
+ fileContentHandler = CommonUtil.validateAndUploadFileContent(OnboardingTypesEnum.ZIP, byteContentData);
Map<String, List<ErrorMessage>> errors = new HashMap<>();
OrchestrationTemplateCandidateData candidateDataEntity =
new CandidateEntityBuilder(candidateService)
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/HeatToToscaTranslationHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/HeatToToscaTranslationHealer.java
index d5ccd36c95..44b6062e89 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/HeatToToscaTranslationHealer.java
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/HeatToToscaTranslationHealer.java
@@ -8,6 +8,7 @@ import org.openecomp.core.model.dao.ServiceTemplateDaoInter;
import org.openecomp.core.model.types.ServiceElement;
import org.openecomp.core.translator.datatypes.TranslatorOutput;
import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.common.utils.CommonUtil;
import org.openecomp.sdc.common.utils.SdcCommon;
import org.openecomp.sdc.healing.interfaces.Healer;
@@ -53,7 +54,7 @@ public class HeatToToscaTranslationHealer implements Healer {
FileContentHandler fileContentHandler;
TranslatorOutput translatorOutput;
try {
- fileContentHandler = CommonUtil.validateAndUploadFileContent(uploadData
+ fileContentHandler = CommonUtil.validateAndUploadFileContent(OnboardingTypesEnum.ZIP, uploadData
.getContentData().array());
translatorOutput =
HeatToToscaUtil.loadAndTranslateTemplateData(fileContentHandler);
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspOnboardingMethodHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspOnboardingMethodHealer.java
index 5d6050a7f0..0b06fb1c83 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspOnboardingMethodHealer.java
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/VspOnboardingMethodHealer.java
@@ -1,11 +1,10 @@
package org.openecomp.sdc.healing.healers;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.common.utils.SdcCommon;
import org.openecomp.sdc.healing.interfaces.Healer;
import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDao;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDaoFactory;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
@@ -15,15 +14,18 @@ import java.util.Map;
import java.util.Objects;
public class VspOnboardingMethodHealer implements Healer {
- /*private static final VendorSoftwareProductDao vendorSoftwareProductDao =
- VendorSoftwareProductDaoFactory.getInstance().createInterface();*/
- private static final VendorSoftwareProductInfoDao vendorSoftwareProductInfoDao =
+ private static VendorSoftwareProductInfoDao vendorSoftwareProductInfoDao =
VendorSoftwareProductInfoDaoFactory.getInstance().createInterface();
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
public VspOnboardingMethodHealer(){
+ }
+ public VspOnboardingMethodHealer( VendorSoftwareProductInfoDao inVendorSoftwareProductInfoDao){
+ vendorSoftwareProductInfoDao = inVendorSoftwareProductInfoDao;
}
+
+
@Override
public Object heal(Map<String, Object> healingParams) throws Exception {
mdcDataDebugMessage.debugEntryMessage(null, null);
@@ -33,14 +35,22 @@ public class VspOnboardingMethodHealer implements Healer {
Version version = (Version) healingParams.get(SdcCommon.VERSION);
VspDetails vendorSoftwareProductInfo =
vendorSoftwareProductInfoDao.get(new VspDetails(vspId, version));
- vendorSoftwareProductInfo.getOnboardingMethod();
+ String onboardingValue = vendorSoftwareProductInfo.getOnboardingMethod();
- if(Objects.isNull(vendorSoftwareProductInfo.getOnboardingMethod())) {
- onboardingMethod="HEAT";
- vendorSoftwareProductInfo.setOnboardingMethod(onboardingMethod);
- vendorSoftwareProductInfoDao.update(vendorSoftwareProductInfo);
- //vendorSoftwareProductDao.updateVendorSoftwareProductInfo(vendorSoftwareProductInfo);
+ if(Objects.isNull(onboardingValue)) {
+ onboardingMethod="NetworkPackage";
+
+ updateVSPInfo(OnboardingTypesEnum.ZIP.toString(), onboardingMethod, vendorSoftwareProductInfo);
+ } else if (onboardingValue.equals("HEAT")){
+ onboardingMethod="NetworkPackage";
+ updateVSPInfo(OnboardingTypesEnum.ZIP.toString(),onboardingMethod, vendorSoftwareProductInfo);
}
return onboardingMethod;
}
+
+ private void updateVSPInfo(String onboardingOrigin, String onboardingMethod, VspDetails vendorSoftwareProductInfo) {
+ vendorSoftwareProductInfo.setOnboardingMethod(onboardingMethod);
+ vendorSoftwareProductInfo.setOnboardingOrigin(onboardingOrigin);
+ vendorSoftwareProductInfoDao.update(vendorSoftwareProductInfo);
+ }
}
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/test/java/org/openecomp/sdc/healing/healers/VspOnboardingMethodHealerTest.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/test/java/org/openecomp/sdc/healing/healers/VspOnboardingMethodHealerTest.java
new file mode 100644
index 0000000000..b732cb03b6
--- /dev/null
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/test/java/org/openecomp/sdc/healing/healers/VspOnboardingMethodHealerTest.java
@@ -0,0 +1,70 @@
+package org.openecomp.sdc.healing.healers;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.openecomp.sdc.common.utils.SdcCommon;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
+import org.openecomp.sdc.versioning.dao.types.Version;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+
+public class VspOnboardingMethodHealerTest{
+
+ @Mock
+ private VendorSoftwareProductInfoDao vendorSoftwareProductInfoDao;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(VspOnboardingMethodHealerTest.this);
+ }
+
+ @Test
+ public void checkHealingWithNullOnboarding() throws Exception{
+ VspOnboardingMethodHealer vspOnboardingMethodHealer = new VspOnboardingMethodHealer(vendorSoftwareProductInfoDao);
+ Map<String,Object> params = new HashMap<>();
+ params.put(SdcCommon.VSP_ID,"1");
+ params.put(SdcCommon.VERSION, new Version(1,1));
+ VspDetails vspDetails = new VspDetails();
+ vspDetails.setOnboardingMethod(null);
+ Mockito.when(vendorSoftwareProductInfoDao.get(any())).thenReturn(vspDetails);
+ vspOnboardingMethodHealer.heal(params);
+ assertEquals(vspDetails.getOnboardingMethod(),"NetworkPackage");
+ assertEquals(vspDetails.getOnboardingOrigin(),"zip");
+ }
+
+ @Test
+ public void checkHealingWithHEATOnboarding() throws Exception{
+ VspOnboardingMethodHealer vspOnboardingMethodHealer = new VspOnboardingMethodHealer(vendorSoftwareProductInfoDao);
+ Map<String,Object> params = new HashMap<>();
+ params.put(SdcCommon.VSP_ID,"1");
+ params.put(SdcCommon.VERSION, new Version(1,1));
+ VspDetails vspDetails = new VspDetails();
+ vspDetails.setOnboardingMethod("HEAT");
+ Mockito.when(vendorSoftwareProductInfoDao.get(any())).thenReturn(vspDetails);
+ vspOnboardingMethodHealer.heal(params);
+ assertEquals(vspDetails.getOnboardingMethod(),"NetworkPackage");
+ assertEquals(vspDetails.getOnboardingOrigin(),"zip");
+ }
+
+ @Test
+ public void checkHealingWithManualOnboarding() throws Exception{
+ VspOnboardingMethodHealer vspOnboardingMethodHealer = new VspOnboardingMethodHealer(vendorSoftwareProductInfoDao);
+ Map<String,Object> params = new HashMap<>();
+ params.put(SdcCommon.VSP_ID,"1");
+ params.put(SdcCommon.VERSION, new Version(1,1));
+ VspDetails vspDetails = new VspDetails();
+ vspDetails.setOnboardingMethod("Manual");
+ Mockito.when(vendorSoftwareProductInfoDao.get(any())).thenReturn(vspDetails);
+ vspOnboardingMethodHealer.heal(params);
+ assertEquals(vspDetails.getOnboardingMethod(),"Manual");
+ assertEquals(vspDetails.getOnboardingOrigin(),null);
+ }
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-heat-lib/pom.xml b/openecomp-be/lib/openecomp-heat-lib/pom.xml
index 55ab0623b4..0a4e14f417 100644
--- a/openecomp-be/lib/openecomp-heat-lib/pom.xml
+++ b/openecomp-be/lib/openecomp-heat-lib/pom.xml
@@ -16,6 +16,18 @@
<dependencies>
<dependency>
<groupId>org.openecomp.sdc.common</groupId>
+ <artifactId>openecomp-configuration-management-core</artifactId>
+ <version>${openecomp.sdc.common.version}</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc.common</groupId>
<artifactId>openecomp-tosca-datatype</artifactId>
<version>${openecomp.sdc.common.version}</version>
</dependency>
@@ -52,4 +64,19 @@
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${mvn.surefire.version}</version>
+ <configuration>
+ <skipTests>true</skipTests>
+ <useSystemClassLoader>false</useSystemClassLoader>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
</project>
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/ToscaTreeManager.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/ToscaTreeManager.java
new file mode 100644
index 0000000000..517c690194
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/ToscaTreeManager.java
@@ -0,0 +1,79 @@
+package org.openecomp.sdc.heat.services.tree;
+
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.sdc.common.utils.SdcCommon;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
+import org.openecomp.sdc.heat.datatypes.structure.Artifact;
+import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree;
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+public class ToscaTreeManager {
+
+ private static Logger logger = (Logger) LoggerFactory.getLogger(ToscaTreeManager.class);
+
+ private FileContentHandler csarContentMap = new FileContentHandler();
+ private byte[] manifest;
+ private HeatStructureTree tree = new HeatStructureTree();
+ private Map<String, Artifact> artifactRef = new HashMap<>();
+ private Map<String, HeatStructureTree> fileTreeRef = new HashMap<>();
+
+
+ public void addFile(String fileName, byte[] content) {
+ if (fileName.equals(SdcCommon.CSAR_MANIFEST_NAME)) {
+ manifest = content;
+
+ } else {
+ csarContentMap.addFile(fileName, content);
+ }
+ }
+
+ public void createTree(){
+ if (manifest == null) {
+ logger.error("Missing manifest file in the zip.");
+ return;
+ }
+
+ for(Map.Entry<String, byte[]> fileEntry : csarContentMap.getFiles().entrySet()){
+ String[] splitFilename = getFullFileNameAsArray(fileEntry.getKey());
+ addFileToTree(splitFilename, 0, tree);
+ }
+
+
+ }
+
+ private void addFileToTree(String[] splitFilename, int startIndex, HeatStructureTree parent){
+ fileTreeRef.putIfAbsent(splitFilename[startIndex], new HeatStructureTree());
+ HeatStructureTree heatStructureTree = fileTreeRef.get(splitFilename[startIndex]);
+ heatStructureTree.setFileName(splitFilename[startIndex]);
+ if(startIndex < splitFilename.length - 1){
+ addFileToTree(splitFilename, startIndex + 1, heatStructureTree);
+ }
+ parent.addHeatStructureTreeToNestedHeatList(heatStructureTree);
+ }
+
+ public void addErrors(Map<String, List<ErrorMessage>> validationErrors){
+ validationErrors.entrySet().stream().filter(entry -> {
+ return fileTreeRef.get(entry.getKey()) != null;
+ }).forEach(entry -> entry.getValue().stream().forEach(error ->
+ fileTreeRef.get(entry.getKey()).addErrorToErrorsList(error)));
+ }
+
+ private String[] getFullFileNameAsArray(String filename){
+ if(filename.contains("/")){
+ return filename.split("/");
+ }
+
+ return filename.split(Pattern.quote(File.separator));
+ }
+
+ public HeatStructureTree getTree(){
+ return tree;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/messages/AuditMessages.java b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/messages/AuditMessages.java
index de39cff30f..387b2046fd 100644
--- a/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/messages/AuditMessages.java
+++ b/openecomp-be/lib/openecomp-logging-lib/openecomp-sdc-logging-api/src/main/java/org/openecomp/sdc/logging/messages/AuditMessages.java
@@ -30,6 +30,7 @@ public class AuditMessages {
public static final String HEAT_VALIDATION_STARTED = "HEAT validation started. VSP Id: ";
public static final String HEAT_VALIDATION_COMPLETED = "HEAT validation completed. VSP Id: ";
public static final String HEAT_VALIDATION_ERROR = "HEAT validation error: %s. VSP Id: %s";
+ public static final String CSAR_VALIDATION_STARTED = "CSAR validation started. VSP Id: ";
public static final String HEAT_TRANSLATION_STARTED = "HEAT translation started. VSP Id: ";
public static final String HEAT_TRANSLATION_COMPLETED = "HEAT translation completed. VSP Id: ";
public static final String ENRICHMENT_ERROR = "Enrichment error: %s. VSP Id: %s";
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml
index 30c4bde443..b3b7598c11 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/pom.xml
@@ -56,5 +56,10 @@
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-tosca-converter-api</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
</dependencies>
</project>
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/ServiceModelDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/ServiceModelDaoZusammenImpl.java
index 575ba856a7..a7fecdd806 100644
--- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/ServiceModelDaoZusammenImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/ServiceModelDaoZusammenImpl.java
@@ -22,9 +22,9 @@ import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
import org.openecomp.sdc.tosca.services.ToscaExtensionYamlUtil;
import org.openecomp.sdc.versioning.dao.types.Version;
import org.openecomp.sdc.versioning.dao.types.VersionStatus;
+import org.openecomp.core.converter.datatypes.Constants;
import java.io.ByteArrayInputStream;
-import java.io.IOException;
import java.util.Collection;
import java.util.Map;
import java.util.Objects;
diff --git a/openecomp-be/lib/openecomp-sdc-orchestration-lib/openecomp-sdc-orchesrtation-api/pom.xml b/openecomp-be/lib/openecomp-sdc-orchestration-lib/openecomp-sdc-orchesrtation-api/pom.xml
new file mode 100644
index 0000000000..87a93ee6dd
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-orchestration-lib/openecomp-sdc-orchesrtation-api/pom.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-datatypes-lib</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-orchestration-lib</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-orchesrtation-api</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-orchestration-lib/openecomp-sdc-orchesrtation-core/pom.xml b/openecomp-be/lib/openecomp-sdc-orchestration-lib/openecomp-sdc-orchesrtation-core/pom.xml
new file mode 100644
index 0000000000..343ff0213c
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-orchestration-lib/openecomp-sdc-orchesrtation-core/pom.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-orchesrtation-api</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc.core</groupId>
+ <artifactId>openecomp-utilities-lib</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-orchestration-lib</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-orchesrtation-core</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-orchestration-lib/openecomp-sdc-orchesrtation-impl/pom.xml b/openecomp-be/lib/openecomp-sdc-orchestration-lib/openecomp-sdc-orchesrtation-impl/pom.xml
new file mode 100644
index 0000000000..8ecfa0de9e
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-orchestration-lib/openecomp-sdc-orchesrtation-impl/pom.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-orchesrtation-api</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-logging-api</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-orchestration-lib</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-orchesrtation-impl</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-orchestration-lib/pom.xml b/openecomp-be/lib/openecomp-sdc-orchestration-lib/pom.xml
new file mode 100644
index 0000000000..dbcef4da29
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-orchestration-lib/pom.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+
+ <artifactId>openecomp-sdc-orchestration-lib</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <parent>
+ <artifactId>openecomp-sdc-lib</artifactId>
+ <groupId>org.openecomp.sdc</groupId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>..</relativePath>
+ </parent>
+
+ <modules>
+ <module>openecomp-sdc-orchesrtation-api</module>
+ <module>openecomp-sdc-orchesrtation-core</module>
+ <module>openecomp-sdc-orchesrtation-impl</module>
+ </modules>
+</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetails.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetails.java
index 2758e3dfe9..ccadeced62 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetails.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/type/VspDetails.java
@@ -61,6 +61,11 @@ public class VspDetails implements VersionableEntity {
private Long writetimeMicroSeconds;
private String onboardingMethod;
+
+ private String onboardingOrigin;
+
+ private String networkPackageName;
+
public VspDetails() {
}
@@ -215,12 +220,29 @@ public class VspDetails implements VersionableEntity {
this.oldVersion = oldVersion;
}
+ public String getOnboardingOrigin() {
+ return onboardingOrigin;
+ }
+
+ public void setOnboardingOrigin(String onboardingOrigin) {
+ this.onboardingOrigin = onboardingOrigin;
+ }
+
public String getOnboardingMethod() {
return onboardingMethod;
}
public void setOnboardingMethod(String onboardingMethod) {
this.onboardingMethod = onboardingMethod;
}
+
+ public String getNetworkPackageName() {
+ return networkPackageName;
+ }
+
+ public void setNetworkPackageName(String networkPackageName) {
+ this.networkPackageName = networkPackageName;
+ }
+
@Override
public String toString() {
return String.format(
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/filedatastructuremodule/CandidateService.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/filedatastructuremodule/CandidateService.java
index 4ca623e6a3..6cc639fac0 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/filedatastructuremodule/CandidateService.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/filedatastructuremodule/CandidateService.java
@@ -21,10 +21,10 @@
package org.openecomp.sdc.vendorsoftwareproduct.services.filedatastructuremodule;
import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.OrchestrationTemplateCandidateData;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.VspDetails;
import org.openecomp.sdc.vendorsoftwareproduct.types.CandidateDataEntityTo;
import org.openecomp.sdc.vendorsoftwareproduct.types.candidateheat.AnalyzedZipHeatFiles;
@@ -61,9 +61,12 @@ public interface CandidateService {
Optional<ByteArrayInputStream> fetchZipFileByteArrayInputStream(String vspId,
OrchestrationTemplateCandidateData candidateDataEntity,
- String manifest, Map<String, List<ErrorMessage>> uploadErrors);
+ String manifest,
+ OnboardingTypesEnum type,
+ Map<String, List<ErrorMessage>> uploadErrors);
- byte[] replaceManifestInZip(ByteBuffer contentData, String manifest, String vspId)
+ byte[] replaceManifestInZip(ByteBuffer contentData, String manifest, String vspId,
+ OnboardingTypesEnum type)
throws IOException;
Optional<ManifestContent> createManifest(VspDetails vspDetails,
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/utils/CandidateEntityBuilder.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/utils/CandidateEntityBuilder.java
index 9540f3d965..ca5329344b 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/utils/CandidateEntityBuilder.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-api/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/utils/CandidateEntityBuilder.java
@@ -75,6 +75,14 @@ public class CandidateEntityBuilder {
return candidateDataEntity;
}
+// public OrchestrationTemplateCandidateData buildOrchestrationTemplateFromCsar(VspDetails vspDetails,
+// byte[] uploadedFileData,
+// FileContentHandler contentMap,
+// Map<String, List<ErrorMessage>> uploadErrors,
+// String user){
+//
+// }
+
private HeatStructureTree getHeatStructureTree(VspDetails vspDetails,
FileContentHandler contentMap,
AnalyzedZipHeatFiles analyzedZipHeatFiles) {
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java
index eef90d4742..7ad7929ccb 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/dao/impl/zusammen/VendorSoftwareProductInfoDaoZusammenImpl.java
@@ -200,6 +200,8 @@ public class VendorSoftwareProductInfoDaoZusammenImpl implements VendorSoftwareP
info.addProperty(InfoPropertyName.featureGroups.name(), vspDetails.getFeatureGroups());
info.addProperty(InfoPropertyName.oldVersion.name(), vspDetails.getOldVersion());
info.addProperty(InfoPropertyName.onboardingMethod.name(), vspDetails.getOnboardingMethod());
+ info.addProperty(InfoPropertyName.obBoardingOrigin.name(), vspDetails.getOnboardingOrigin());
+ info.addProperty(InfoPropertyName.networkPackageName.name(), vspDetails.getNetworkPackageName());
}
private VspDetails mapInfoToVspDetails(String vspId, Version version, Info info,
@@ -215,6 +217,7 @@ public class VendorSoftwareProductInfoDaoZusammenImpl implements VendorSoftwareP
Version.valueOf(info.getProperty(InfoPropertyName.vendorVersion.name())));
vspDetails.setLicenseAgreement(info.getProperty(InfoPropertyName.licenseAgreement.name()));
vspDetails.setFeatureGroups(info.getProperty(InfoPropertyName.featureGroups.name()));
+
vspDetails.setWritetimeMicroSeconds(
modificationTime == null ? creationTime.getTime() : modificationTime.getTime());
vspDetails.setVersion(version);
@@ -223,7 +226,8 @@ public class VendorSoftwareProductInfoDaoZusammenImpl implements VendorSoftwareP
//Boolean oldVersion = ind == null || "true".equals( ind.toLowerCase());
vspDetails.setOldVersion(oldVersion);
vspDetails.setOnboardingMethod(info.getProperty(InfoPropertyName.onboardingMethod.name()));
-
+ vspDetails.setOnboardingOrigin(info.getProperty(InfoPropertyName.obBoardingOrigin.name()));
+ vspDetails.setNetworkPackageName(info.getProperty(InfoPropertyName.networkPackageName.name()));
return vspDetails;
}
@@ -239,7 +243,9 @@ public class VendorSoftwareProductInfoDaoZusammenImpl implements VendorSoftwareP
licenseAgreement,
featureGroups,
oldVersion,
- onboardingMethod
+ onboardingMethod,
+ obBoardingOrigin,
+ networkPackageName
}
}
diff --git a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/filedatastructuremodule/CandidateServiceImpl.java b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/filedatastructuremodule/CandidateServiceImpl.java
index 6ccece1e76..e5f1a4c3ac 100644
--- a/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/filedatastructuremodule/CandidateServiceImpl.java
+++ b/openecomp-be/lib/openecomp-sdc-vendor-software-product-lib/openecomp-sdc-vendor-software-product-core/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/services/impl/filedatastructuremodule/CandidateServiceImpl.java
@@ -23,6 +23,7 @@ package org.openecomp.sdc.vendorsoftwareproduct.services.impl.filedatastructurem
import org.apache.commons.collections4.CollectionUtils;
import org.openecomp.core.utilities.file.FileContentHandler;
import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
@@ -89,17 +90,17 @@ public class CandidateServiceImpl implements CandidateService {
}
@Override
- public Optional<ErrorMessage> validateNonEmptyFileToUpload(InputStream heatFileToUpload) {
+ public Optional<ErrorMessage> validateNonEmptyFileToUpload(InputStream fileToUpload) {
mdcDataDebugMessage.debugEntryMessage(null);
- if (Objects.isNull(heatFileToUpload)) {
+ if (Objects.isNull(fileToUpload)) {
return Optional.of(new ErrorMessage(ErrorLevel.ERROR,
Messages.NO_ZIP_FILE_WAS_UPLOADED_OR_ZIP_NOT_EXIST.getErrorMessage()));
} else {
try {
- int available = heatFileToUpload.available();
+ int available = fileToUpload.available();
if (available == 0) {
mdcDataDebugMessage.debugExitMessage(null);
return Optional.of(new ErrorMessage(ErrorLevel.ERROR,
@@ -321,10 +322,7 @@ public class CandidateServiceImpl implements CandidateService {
public void updateCandidateUploadData(OrchestrationTemplateCandidateData uploadData,
String itemId) {
mdcDataDebugMessage.debugEntryMessage(null);
-
- //vendorSoftwareProductDao.updateCandidateUploadData(uploadData);
orchestrationTemplateCandidateDataDao.update(itemId, uploadData);
-
mdcDataDebugMessage.debugExitMessage(null);
}
@@ -393,11 +391,12 @@ public class CandidateServiceImpl implements CandidateService {
public Optional<ByteArrayInputStream> fetchZipFileByteArrayInputStream(String vspId,
OrchestrationTemplateCandidateData candidateDataEntity,
String manifest,
+ OnboardingTypesEnum type,
Map<String, List<ErrorMessage>> uploadErrors) {
byte[] file;
ByteArrayInputStream byteArrayInputStream = null;
try {
- file = replaceManifestInZip(candidateDataEntity.getContentData(), manifest, vspId);
+ file = replaceManifestInZip(candidateDataEntity.getContentData(), manifest, vspId, type);
byteArrayInputStream = new ByteArrayInputStream(
Objects.isNull(file) ? candidateDataEntity.getContentData().array()
: file);
@@ -413,7 +412,8 @@ public class CandidateServiceImpl implements CandidateService {
}
@Override
- public byte[] replaceManifestInZip(ByteBuffer contentData, String manifest, String vspId)
+ public byte[] replaceManifestInZip(ByteBuffer contentData, String manifest, String vspId,
+ OnboardingTypesEnum type)
throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -433,12 +433,12 @@ public class CandidateServiceImpl implements CandidateService {
}
} else {
manifestWritten = true;
- writeManifest(manifest, zos);
+ writeManifest(manifest, type, zos);
}
zos.closeEntry();
}
if (!manifestWritten) {
- writeManifest(manifest, zos);
+ writeManifest(manifest, type, zos);
zos.closeEntry();
}
}
@@ -451,7 +451,14 @@ public class CandidateServiceImpl implements CandidateService {
return candidateServiceValidator.validateFileDataStructure(filesDataStructure);
}
- private void writeManifest(String manifest, ZipOutputStream zos) throws IOException {
+ private void writeManifest(String manifest,
+ OnboardingTypesEnum type,
+ ZipOutputStream zos) throws IOException {
+
+ if(isManifestNeedsToGetWritten(type)){
+ return;
+ }
+
zos.putNextEntry(new ZipEntry(SdcCommon.MANIFEST_NAME));
try (InputStream manifestStream = new ByteArrayInputStream(
manifest.getBytes(StandardCharsets.UTF_8))) {
@@ -463,6 +470,10 @@ public class CandidateServiceImpl implements CandidateService {
}
}
+ private boolean isManifestNeedsToGetWritten(OnboardingTypesEnum type) {
+ return type.equals(OnboardingTypesEnum.CSAR);
+ }
+
private void handleArtifactsFromTree(HeatStructureTree tree, FilesDataStructure structure) {
if (Objects.isNull(tree) || Objects.isNull(tree.getArtifacts())) {
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/pom.xml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/pom.xml
new file mode 100644
index 0000000000..faf890f672
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/pom.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdc.common</groupId>
+ <artifactId>openecomp-tosca-datatype</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc.core</groupId>
+ <artifactId>openecomp-tosca-lib</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc.core</groupId>
+ <artifactId>openecomp-facade-core</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-tosca-converter-lib</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-tosca-converter-api</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/ServiceTemplateReaderService.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/ServiceTemplateReaderService.java
new file mode 100644
index 0000000000..09c823ce7e
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/ServiceTemplateReaderService.java
@@ -0,0 +1,24 @@
+package org.openecomp.core.converter;
+
+import java.util.Map;
+
+public interface ServiceTemplateReaderService {
+
+ Map<String, Object> readServiceTemplate(byte[] serivceTemplateContent);
+
+ Object getMetadata();
+
+ Object getToscaVersion();
+
+ Object getNodeTypes();
+
+ Object getTopologyTemplate();
+
+ Map<String, Object> getNodeTemplates();
+
+ Map<String, Object> getInputs();
+
+ Map<String, Object> getOutputs();
+
+ Map<String, Object> getSubstitutionMappings();
+}
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/ToscaConverter.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/ToscaConverter.java
new file mode 100644
index 0000000000..543d32347f
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/ToscaConverter.java
@@ -0,0 +1,12 @@
+package org.openecomp.core.converter;
+
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+
+import java.io.IOException;
+
+public interface ToscaConverter {
+
+ ToscaServiceModel convert(FileContentHandler fileContentHandler)
+ throws IOException;
+}
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/api/ToscaConverterManager.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/api/ToscaConverterManager.java
new file mode 100644
index 0000000000..1cf010c1b5
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/api/ToscaConverterManager.java
@@ -0,0 +1,9 @@
+package org.openecomp.core.converter.api;
+
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+
+public interface ToscaConverterManager {
+
+ ToscaServiceModel convert(String csarName, FileContentHandler fileContentHandler);
+}
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/Constants.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/Constants.java
new file mode 100644
index 0000000000..6f7e6be8af
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/Constants.java
@@ -0,0 +1,45 @@
+package org.openecomp.core.converter.datatypes;
+
+import java.io.File;
+
+public class Constants {
+ public static final String mainStName = "MainServiceTemplate.yaml";
+ public static final String globalStName = "GlobalSubstitutionTypesServiceTemplate.yaml";
+ public static final String manifestFileName = "MainServiceTemplate.mf";
+ public static final String definitionsDir = "Definitions/";
+ public static final String metadataFile = "TOSCA-Metadata/TOSCA.meta";
+
+
+ public static final String definitionVersion = "tosca_definitions_version";
+ private static final String DEFAULT_NAMESPACE = "tosca_default_namespace";
+ private static final String TEMPLATE_NAME = "template_name";
+ public static final String topologyTemplate = "topology_template";
+ private static final String TEMPLATE_AUTHOR = "template_author";
+ private static final String TEMPLATE_VERSION = "template_version";
+ private static final String DESCRIPTION = "description";
+ private static final String IMPORTS = "imports";
+ private static final String DSL_DEFINITIONS = "dsl_definitions";
+ public static final String nodeType = "node_type";
+ public static final String nodeTypes = "node_types";
+ private static final String RELATIONSHIP_TYPES = "relationship_types";
+ private static final String RELATIONSHIP_TEMPLATES = "relationship_templates";
+ private static final String CAPABILITY_TYPES = "capability_types";
+ private static final String ARTIFACT_TYPES = "artifact_types";
+ private static final String DATA_TYPES = "data_types";
+ private static final String INTERFACE_TYPES = "interface_types";
+ private static final String POLICY_TYPES = "policy_types";
+ private static final String GROUP_TYPES = "group_types";
+ private static final String REPOSITORIES = "repositories";
+ public static final String metadata = "metadata";
+ public static final String nodeTemplates = "node_templates";
+ public static final String inputs = "inputs";
+ public static final String outputs = "outputs";
+ public static final String substitutionMappings = "substitution_mappings";
+ public static final String capabilities = "capabilities";
+ public static final String requirements = "requirements";
+
+ public static final String openecompHeatIndex = "openecomp_heat_index";
+ public static final String globalSubstitution = "GlobalSubstitutionTypes";
+
+ public static final String externalFilesFolder = "External" + File.separator;
+}
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/CsarFileTypes.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/CsarFileTypes.java
new file mode 100644
index 0000000000..323bd8a5fb
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/CsarFileTypes.java
@@ -0,0 +1,9 @@
+package org.openecomp.core.converter.datatypes;
+
+public enum CsarFileTypes {
+ mainServiceTemplate,
+ globalServiceTemplate,
+ externalFile,
+ toscaMetadata,
+ definitionsFile,;
+}
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/factory/ToscaConverterFactory.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/factory/ToscaConverterFactory.java
new file mode 100644
index 0000000000..7506759d25
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/factory/ToscaConverterFactory.java
@@ -0,0 +1,12 @@
+package org.openecomp.core.converter.factory;
+
+import org.openecomp.core.converter.ToscaConverter;
+import org.openecomp.core.factory.api.AbstractComponentFactory;
+import org.openecomp.core.factory.api.AbstractFactory;
+
+public abstract class ToscaConverterFactory extends AbstractComponentFactory<ToscaConverter> {
+
+ public static ToscaConverterFactory getInstance(){
+ return AbstractFactory.getInstance(ToscaConverterFactory.class);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/resources/factoryConfiguration.json b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/resources/factoryConfiguration.json
new file mode 100644
index 0000000000..d9f4ff3cbd
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/resources/factoryConfiguration.json
@@ -0,0 +1,3 @@
+{
+ "org.openecomp.core.converter.factory.ToscaConverterFactory" : "org.openecomp.core.impl.factory.ToscaConverterFactoryImpl"
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/pom.xml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/pom.xml
new file mode 100644
index 0000000000..39f02becf8
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/pom.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-tosca-converter-api</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc.core</groupId>
+ <artifactId>openecomp-tosca-lib</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc.core</groupId>
+ <artifactId>openecomp-facade-core</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc.jtosca</groupId>
+ <artifactId>jtosca</artifactId>
+ <version>1.1.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-translator-core</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-tosca-converter-lib</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-tosca-converter-core</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/GlobalSubstitutionServiceTemplate.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/GlobalSubstitutionServiceTemplate.java
new file mode 100644
index 0000000000..2d33748e26
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/GlobalSubstitutionServiceTemplate.java
@@ -0,0 +1,59 @@
+package org.openecomp.core.impl;
+
+import org.openecomp.sdc.logging.api.Logger;
+import org.openecomp.sdc.logging.api.LoggerFactory;
+import org.openecomp.sdc.tosca.datatypes.model.Import;
+import org.openecomp.sdc.tosca.datatypes.model.NodeType;
+import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class GlobalSubstitutionServiceTemplate extends ServiceTemplate {
+ private static final Logger logger = LoggerFactory.getLogger(ServiceTemplate.class);
+
+ public static final String GLOBAL_SUBSTITUTION_SERVICE_FILE_NAME = "GlobalSubstitutionServiceTemplate.yaml";
+ public static final String TEMPLATE_NAME_PROPERTY = "template_name";
+ public static final String DEFININTION_VERSION = "tosca_simple_yaml_1_0_0";
+ public static final String HEAT_INDEX = "openecomp_heat_index";
+
+ public GlobalSubstitutionServiceTemplate() {
+ super();
+ init();
+ }
+
+
+ public void appendNodes(Map<String, NodeType> nodes) {
+ getNode_types().putAll(nodes);
+ }
+
+ public void init() {
+ writeDefinitionSection();
+ writeMetadataSection();
+ writeImportsSection();
+ setNode_types(new HashMap<>());
+ }
+
+ private void writeImportsSection() {
+ List<Map<String, Import>> imports = new ArrayList<>();
+ Map<String, Import> stringImportMap = new HashMap<>();
+ imports.add(stringImportMap);
+ setImports(imports);
+ Import imprtObj = new Import();
+ imprtObj.setFile("openecomp-heat/_index.yml");
+ stringImportMap.put("openecomp_heat_index", imprtObj);
+ }
+
+
+ private void writeMetadataSection() {
+ Map<String, String> metadata = new HashMap<>();
+ metadata.put(TEMPLATE_NAME_PROPERTY, "GlobalSubstitutionTypes");
+ setMetadata(metadata);
+ }
+
+ private void writeDefinitionSection() {
+ setTosca_definitions_version(DEFININTION_VERSION);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java
new file mode 100644
index 0000000000..c4ed6f9c5f
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java
@@ -0,0 +1,446 @@
+package org.openecomp.core.impl;
+
+import org.apache.commons.collections.MapUtils;
+import org.openecomp.core.converter.ServiceTemplateReaderService;
+import org.openecomp.core.converter.ToscaConverter;
+import org.openecomp.core.converter.datatypes.Constants;
+import org.openecomp.core.converter.datatypes.CsarFileTypes;
+import org.openecomp.core.impl.services.ServiceTemplateReaderServiceImpl;
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.tosca.datatypes.model.*;
+import org.openecomp.sdc.tosca.services.DataModelUtil;
+import org.openecomp.sdc.tosca.services.ToscaUtil;
+import org.openecomp.sdc.translator.services.heattotosca.globaltypes.GlobalTypesGenerator;
+import org.yaml.snakeyaml.error.YAMLException;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
+import java.util.jar.Manifest;
+import java.util.regex.Pattern;
+
+import static org.openecomp.core.converter.datatypes.Constants.*;
+import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.GLOBAL_SUBSTITUTION_SERVICE_FILE_NAME;
+
+public class ToscaConverterImpl implements ToscaConverter {
+
+ public ToscaConverterImpl() {
+
+ }
+
+ @Override
+ public ToscaServiceModel convert(FileContentHandler fileContentHandler)
+ throws IOException {
+ Map<String, byte[]> csarFiles = new HashMap<>(fileContentHandler.getFiles());
+ ToscaServiceModel toscaServiceModel = new ToscaServiceModel();
+ Map<String, ServiceTemplate> serviceTemplates = new HashMap<>();
+ FileContentHandler artifacts = new FileContentHandler();
+ GlobalSubstitutionServiceTemplate gsst = new GlobalSubstitutionServiceTemplate();
+ for (Map.Entry<String, byte[]> fileEntry : csarFiles.entrySet()) {
+ CsarFileTypes fileType = getFileType(fileEntry.getKey());
+ switch (fileType) {
+ case mainServiceTemplate:
+ handleServiceTemplate(mainStName, fileEntry.getKey(), csarFiles, serviceTemplates);
+ break;
+
+ case globalServiceTemplate:
+ handleServiceTemplate(globalStName, fileEntry.getKey(), csarFiles, serviceTemplates);
+ break;
+
+ case externalFile:
+ artifacts.addFile(fileEntry.getKey(), fileEntry.getValue());
+ break;
+
+ case definitionsFile:
+ handleDefintionTemplate(fileEntry.getKey(), csarFiles, gsst);
+ break;
+ }
+ }
+ handleMetadataFile(csarFiles);
+ updateToscaServiceModel(toscaServiceModel, serviceTemplates, artifacts, gsst, csarFiles);
+ return toscaServiceModel;
+ }
+
+ private void handleMetadataFile(Map<String, byte[]> csarFiles) {
+ byte[] bytes = csarFiles.remove(metadataFile);
+ if (bytes != null) {
+ csarFiles.put(metadataFile + ".old", bytes);
+ }
+ }
+
+ private void handleDefintionTemplate(String key, Map<String, byte[]> csarFiles,
+ GlobalSubstitutionServiceTemplate gsst) {
+ try {
+ ServiceTemplateReaderService readerService = new ServiceTemplateReaderServiceImpl(csarFiles.get(key));
+ if (readerService == null) {
+ return;
+ }
+ Object nodeTypes = readerService.getNodeTypes();
+ if (nodeTypes instanceof Map) {
+ Map<String, NodeType> nodeTypeMap = (Map<String, NodeType>) nodeTypes;
+ gsst.appendNodes(nodeTypeMap);
+ }
+ } catch (YAMLException ye) {
+ throw new CoreException(new ErrorCode.ErrorCodeBuilder()
+ .withMessage("Invalid YAML content in file " + key + ". reason - "
+ + ye.getMessage())
+ .withCategory(ErrorCategory.APPLICATION).build());
+ }
+ }
+
+ private void updateToscaServiceModel(ToscaServiceModel toscaServiceModel,
+ Map<String, ServiceTemplate> serviceTemplates,
+ FileContentHandler externalFilesHandler,
+ GlobalSubstitutionServiceTemplate globalSubstitutionServiceTemplate,
+ Map<String, byte[]> csarFiles) {
+ Collection<ServiceTemplate> globalServiceTemplates =
+ GlobalTypesGenerator.getGlobalTypesServiceTemplate().values();
+ addGlobalServiceTemplates(globalServiceTemplates, serviceTemplates);
+ serviceTemplates.put(GLOBAL_SUBSTITUTION_SERVICE_FILE_NAME, globalSubstitutionServiceTemplate);
+ toscaServiceModel.setEntryDefinitionServiceTemplate(mainStName);
+ toscaServiceModel.setServiceTemplates(serviceTemplates);
+ externalFilesHandler.addFile(metadataFile + ".old", csarFiles.get(metadataFile + ".old"));
+ toscaServiceModel.setArtifactFiles(externalFilesHandler);
+ }
+
+ private void addGlobalServiceTemplates(Collection<ServiceTemplate> globalServiceTemplates,
+ Map<String, ServiceTemplate> serviceTemplates) {
+ for (ServiceTemplate serviceTemplate : globalServiceTemplates) {
+ serviceTemplates.put(ToscaUtil.getServiceTemplateFileName(serviceTemplate), serviceTemplate);
+ }
+ }
+
+ private void handleServiceTemplate(String serviceTemplateName,
+ String fileName, Map<String, byte[]> csarFiles,
+ Map<String, ServiceTemplate> serviceTemplates) {
+ Optional<ServiceTemplate> serviceTemplate =
+ getServiceTemplateFromCsar(fileName, csarFiles);
+ serviceTemplate.ifPresent(
+ serviceTemplate1 -> addServiceTemplate(serviceTemplateName, serviceTemplate1,
+ serviceTemplates));
+ }
+
+ private void addServiceTemplate(String serviceTemplateName,
+ ServiceTemplate serviceTemplate,
+ Map<String, ServiceTemplate> serviceTemplates) {
+ serviceTemplates.put(serviceTemplateName, serviceTemplate);
+ }
+
+ private Optional<byte[]> getManifestContent(Map<String, byte[]> csarFiles) {
+ for (Map.Entry<String, byte[]> csarFileEntry : csarFiles.entrySet()) {
+ if (csarFileEntry.getKey().contains(manifestFileName)) {
+ return Optional.of(csarFileEntry.getValue());
+ }
+ }
+
+ return Optional.empty();
+ }
+
+ private Optional<ServiceTemplate> getServiceTemplateFromCsar(String fileName,
+ Map<String, byte[]> csarFiles) {
+ byte[] fileContent = csarFiles.get(fileName);
+ ServiceTemplate serviceTemplate = convertServiceTemplate(fileName, fileContent);
+
+ return Optional.of(serviceTemplate);
+ }
+
+ private ServiceTemplate convertServiceTemplate(String serviceTemplateName,
+ byte[] fileContent) {
+ ServiceTemplate serviceTemplate = new ServiceTemplate();
+ try {
+ ServiceTemplateReaderService readerService =
+ new ServiceTemplateReaderServiceImpl(fileContent);
+ convertMetadata(serviceTemplateName, serviceTemplate, readerService);
+ convertToscaVersion(serviceTemplate, readerService);
+ convertImports(serviceTemplate);
+ convertNodeTypes(serviceTemplate, readerService);
+ convertTopologyTemplate(serviceTemplate, readerService);
+
+ } catch (YAMLException ye) {
+ throw new CoreException(new ErrorCode.ErrorCodeBuilder()
+ .withMessage("Invalid YAML content in file" + serviceTemplateName + ". reason - "
+ + ye.getMessage())
+ .withCategory(ErrorCategory.APPLICATION).build());
+ }
+
+
+ return serviceTemplate;
+ }
+
+ private void convertToscaVersion(ServiceTemplate serviceTemplate,
+ ServiceTemplateReaderService readerService) {
+ Object toscaVersion = readerService.getToscaVersion();
+ serviceTemplate.setTosca_definitions_version((String) toscaVersion);
+ }
+
+ private void convertImports(ServiceTemplate serviceTemplate) {
+ serviceTemplate.setImports(new ArrayList<>());
+ serviceTemplate.getImports()
+ .add(createImportMap(openecompHeatIndex, "openecomp-heat/_index.yml"));
+ serviceTemplate.getImports().add(createImportMap(globalSubstitution, globalStName));
+
+ }
+
+ private Map<String, Import> createImportMap(String key, String fileName) {
+ Map<String, Import> importMap = new HashMap<>();
+ Import anImport = new Import();
+ anImport.setFile(fileName);
+ importMap.put(key, anImport);
+
+ return importMap;
+ }
+
+ private void convertMetadata(String serviceTemplateName,
+ ServiceTemplate serviceTemplate,
+ ServiceTemplateReaderService readerService) {
+ Map<String, Object> metadataToConvert = (Map<String, Object>) readerService.getMetadata();
+ Map<String, String> finalMetadata = new HashMap<>();
+
+ if (MapUtils.isNotEmpty(metadataToConvert)) {
+ for (Map.Entry<String, Object> metadataEntry : metadataToConvert.entrySet()) {
+ if (Objects.isNull(metadataEntry.getValue()) ||
+ !(metadataEntry.getValue() instanceof String)) {
+ continue;
+ }
+ finalMetadata.put(metadataEntry.getKey(), (String) metadataEntry.getValue());
+ }
+ }
+
+ finalMetadata.put("template_name", getTemplateNameFromStName(serviceTemplateName));
+ serviceTemplate.setMetadata(finalMetadata);
+ }
+
+ private void convertNodeTypes(ServiceTemplate serviceTemplate, ServiceTemplateReaderService readerService) {
+ Map<String, Object> nodeTypes = (Map<String, Object>) readerService.getNodeTypes();
+ if (MapUtils.isEmpty(nodeTypes)) {
+ return;
+ }
+
+ for (Map.Entry<String, Object> nodeTypeEntry : nodeTypes.entrySet()) {
+ DataModelUtil
+ .addNodeType(serviceTemplate, nodeTypeEntry.getKey(),
+ (NodeType) createObjectFromClass(nodeTypeEntry.getKey(), nodeTypeEntry.getValue(),
+ NodeType.class));
+ }
+ }
+
+ private void convertTopologyTemplate(ServiceTemplate serviceTemplate,
+ ServiceTemplateReaderService readerService) {
+
+ convertInputs(serviceTemplate, readerService);
+ convertNodeTemplates(serviceTemplate, readerService);
+ convertOutputs(serviceTemplate, readerService);
+ convertSubstitutionMappings(serviceTemplate, readerService);
+ }
+
+ private void convertInputs(ServiceTemplate serviceTemplate,
+ ServiceTemplateReaderService readerService) {
+ Map<String, Object> inputs = readerService.getInputs();
+ addInputsOrOutputsToServiceTemplate(serviceTemplate, inputs, Constants.inputs);
+ }
+
+ private void convertOutputs(ServiceTemplate serviceTemplate,
+ ServiceTemplateReaderService readerService) {
+ Map<String, Object> outputs = readerService.getOutputs();
+ addInputsOrOutputsToServiceTemplate(serviceTemplate, outputs, Constants.outputs);
+ }
+
+ private void addInputsOrOutputsToServiceTemplate(ServiceTemplate serviceTemplate,
+ Map<String, Object> mapToConvert,
+ String inputsOrOutputs) {
+ if (MapUtils.isEmpty(mapToConvert)) {
+ return;
+ }
+
+ for (Map.Entry<String, Object> entry : mapToConvert.entrySet()) {
+ ParameterDefinition parameterDefinition =
+ (ParameterDefinition) createObjectFromClass(
+ entry.getKey(), entry.getValue(), ParameterDefinition.class);
+ addToServiceTemplateAccordingToSection(
+ serviceTemplate, inputsOrOutputs, entry.getKey(), parameterDefinition);
+ }
+ }
+
+ private void addToServiceTemplateAccordingToSection(ServiceTemplate serviceTemplate,
+ String inputsOrOutputs,
+ String parameterId,
+ ParameterDefinition parameterDefinition) {
+ switch (inputsOrOutputs) {
+ case inputs:
+ DataModelUtil
+ .addInputParameterToTopologyTemplate(serviceTemplate, parameterId, parameterDefinition);
+ break;
+ case outputs:
+ DataModelUtil
+ .addOutputParameterToTopologyTemplate(serviceTemplate, parameterId, parameterDefinition);
+ }
+ }
+
+ private void convertNodeTemplates(ServiceTemplate serviceTemplate,
+ ServiceTemplateReaderService readerService) {
+ Map<String, Object> nodeTemplates = readerService.getNodeTemplates();
+ if (MapUtils.isEmpty(nodeTemplates)) {
+ return;
+ }
+
+ for (Map.Entry<String, Object> nodeTemplateEntry : nodeTemplates.entrySet()) {
+ NodeTemplate nodeTemplate = convertNodeTemplate(nodeTemplateEntry.getValue());
+ DataModelUtil.addNodeTemplate(serviceTemplate, nodeTemplateEntry.getKey(), nodeTemplate);
+ }
+ }
+
+ private void convertSubstitutionMappings(ServiceTemplate serviceTemplate,
+ ServiceTemplateReaderService readerService) {
+ Map<String, Object> substitutionMappings = readerService.getSubstitutionMappings();
+ if (MapUtils.isEmpty(substitutionMappings)) {
+ return;
+ }
+ SubstitutionMapping substitutionMapping = convertSubstitutionMappings(substitutionMappings);
+ DataModelUtil.addSubstitutionMapping(serviceTemplate, substitutionMapping);
+ }
+
+ private SubstitutionMapping convertSubstitutionMappings(Map<String, Object> substitutionMappings) {
+ SubstitutionMapping substitutionMapping = new SubstitutionMapping();
+
+ substitutionMapping.setNode_type((String) substitutionMappings.get(nodeType));
+ substitutionMapping.setCapabilities(
+ convertSubstitutionMappingsSections((Map<String, Object>) substitutionMappings.get(capabilities)));
+ substitutionMapping.setRequirements(
+ convertSubstitutionMappingsSections((Map<String, Object>) substitutionMappings.get(requirements)));
+
+ return substitutionMapping;
+ }
+
+ private Map<String, List<String>> convertSubstitutionMappingsSections(
+ Map<String, Object> sectionToConvert) {
+ Map<String, List<String>> convertedSection = new HashMap<>();
+ if (MapUtils.isEmpty(sectionToConvert)) {
+ return null;
+ }
+
+ for (Map.Entry<String, Object> entry : sectionToConvert.entrySet()) {
+ if (entry.getValue() instanceof List) {
+ convertedSection.put(entry.getKey(), (List<String>) entry.getValue());
+ }
+ }
+
+ return convertedSection;
+ }
+
+ private CsarFileTypes getFileType(String fileName) {
+ if (isMainServiceTemplate(fileName)) {
+ return CsarFileTypes.mainServiceTemplate;
+ } else if (isGlobalServiceTemplate(fileName)) {
+ return CsarFileTypes.globalServiceTemplate;
+ } else if (isDefinitions(fileName)) {
+ return CsarFileTypes.definitionsFile;
+ } else if (isMetadataFile(metadataFile)) {
+ return CsarFileTypes.toscaMetadata;
+ }
+ return CsarFileTypes.externalFile;
+ }
+
+ private Optional<Manifest> getCsarManifest(Map<String, byte[]> csarFiles) throws IOException {
+ Optional<byte[]> manifestContent = getManifestContent(csarFiles);
+
+ if (manifestContent.isPresent()) {
+ ByteArrayInputStream byteInputStream = new ByteArrayInputStream(manifestContent.get());
+
+ return Optional.of(new Manifest(byteInputStream));
+ }
+
+ return Optional.empty();
+ }
+
+ private NodeTemplate convertNodeTemplate(Object candidateNodeTemplate) {
+ NodeTemplate nodeTemplate = new NodeTemplate();
+
+ Map<String, Object> nodeTemplateAsMap = (Map<String, Object>) candidateNodeTemplate;
+ nodeTemplate.setArtifacts((Map<String, ArtifactDefinition>) nodeTemplateAsMap.get("artifacts"));
+ nodeTemplate.setAttributes((Map<String, Object>) nodeTemplateAsMap.get("attributes"));
+ nodeTemplate.setCopy((String) nodeTemplateAsMap.get("copy"));
+ nodeTemplate.setDescription((String) nodeTemplateAsMap.get("description"));
+ nodeTemplate.setDirectives((List<String>) nodeTemplateAsMap.get("directives"));
+ nodeTemplate.setInterfaces(
+ (Map<String, InterfaceDefinition>) nodeTemplateAsMap.get("interfaces"));
+ nodeTemplate.setNode_filter((NodeFilter) nodeTemplateAsMap.get("node_filter"));
+ nodeTemplate.setProperties((Map<String, Object>) nodeTemplateAsMap.get("properties"));
+ nodeTemplate.setRequirements(
+ (List<Map<String, RequirementAssignment>>) nodeTemplateAsMap.get("requirements"));
+ nodeTemplate.setType((String) nodeTemplateAsMap.get("type"));
+ nodeTemplate.setCapabilities(
+ convertCapabilities((Map<String, Object>) nodeTemplateAsMap.get("capabilities")));
+
+ return nodeTemplate;
+ }
+
+ private List<Map<String, CapabilityAssignment>> convertCapabilities(Map<String, Object> capabilities) {
+ List<Map<String, CapabilityAssignment>> convertedCapabilities = new ArrayList<>();
+ if (MapUtils.isEmpty(capabilities)) {
+ return null;
+ }
+ for (Map.Entry<String, Object> capabilityAssignmentEntry : capabilities.entrySet()) {
+ Map<String, CapabilityAssignment> tempMap = new HashMap<>();
+ tempMap.put(capabilityAssignmentEntry.getKey(),
+ (CapabilityAssignment) createObjectFromClass
+ (capabilityAssignmentEntry.getKey(), capabilityAssignmentEntry.getValue(), CapabilityAssignment.class));
+ convertedCapabilities.add(tempMap);
+ }
+ return convertedCapabilities;
+ }
+
+ private Object createObjectFromClass(String nodeTypeId,
+ Object objectCandidate,
+ Class classToCreate) {
+ try {
+ return JsonUtil.json2Object(objectCandidate.toString(), classToCreate);
+ } catch (Exception e) {
+ //todo - return error to user?
+ throw new CoreException(new ErrorCode.ErrorCodeBuilder()
+ .withCategory(ErrorCategory.APPLICATION)
+ .withMessage("Can't create Node Type from " + nodeTypeId).build());
+ }
+ }
+
+ private boolean isMainServiceTemplate(String fileName) {
+ return fileName.endsWith(mainStName);
+ }
+
+ private boolean isMetadataFile(String fileName) {
+ return fileName.equals(metadataFile);
+ }
+
+ private boolean isGlobalServiceTemplate(String fileName) {
+ return fileName.endsWith(globalStName);
+ }
+
+ private boolean isDefinitions(String fileName) {
+ return fileName.startsWith(definitionsDir);
+ }
+
+ private String getTemplateNameFromStName(String serviceTemplateName) {
+ String fileNameWithoutDirectories;
+ fileNameWithoutDirectories = getFileNameWithoutDirectories(serviceTemplateName);
+ return fileNameWithoutDirectories.split("ServiceTemplate")[0];
+ }
+
+ private String getFileNameWithoutDirectories(String serviceTemplateName) {
+ String fileNameWithoutDirectories;
+ if (serviceTemplateName.contains("/")) {
+ String[] split = serviceTemplateName.split("/");
+ fileNameWithoutDirectories = split[split.length - 1];
+ } else if (serviceTemplateName.contains(File.separator)) {
+ String[] split = serviceTemplateName.split(Pattern.quote(File.separator));
+ fileNameWithoutDirectories = split[split.length - 1];
+ } else {
+ fileNameWithoutDirectories = serviceTemplateName;
+ }
+ return fileNameWithoutDirectories;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterManagerImpl.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterManagerImpl.java
new file mode 100644
index 0000000000..520e41817e
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterManagerImpl.java
@@ -0,0 +1,49 @@
+package org.openecomp.core.impl;
+
+import org.openecomp.core.converter.ToscaConverter;
+import org.openecomp.core.converter.api.ToscaConverterManager;
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class ToscaConverterManagerImpl implements ToscaConverterManager {
+
+ private static List<ToscaConverter> toscaConverters;
+ private static final String toscaConverterFileName = "ToscaConverters.json";
+
+ static {
+ toscaConverters = getConvertersList();
+ }
+
+ @Override
+ public ToscaServiceModel convert(String csarName, FileContentHandler fileContentHandler) {
+ return null;
+ }
+
+ private static List<ToscaConverter> getConvertersList(){
+ List<ToscaConverter> toscaConvertersList = new ArrayList<>();
+ Map<String, String> convertersMap = FileUtils.readViaInputStream(toscaConverterFileName,
+ stream -> JsonUtil.json2Object(stream, Map.class));
+ return getToscaConvertersList(toscaConvertersList, convertersMap);
+ }
+
+ private static List<ToscaConverter> getToscaConvertersList(
+ List<ToscaConverter> toscaConvertersList, Map<String, String> convertersMap) {
+ for(String implClassName : convertersMap.values()){
+ try{
+ Class<?> clazz = Class.forName(implClassName);
+ Constructor<?> constructor = clazz.getConstructor();
+ toscaConvertersList.add((ToscaConverter) constructor.newInstance());
+ }catch (Exception e){
+ continue;
+ }
+ }
+ return toscaConvertersList;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/factory/ToscaConverterFactoryImpl.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/factory/ToscaConverterFactoryImpl.java
new file mode 100644
index 0000000000..e04cd239c9
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/factory/ToscaConverterFactoryImpl.java
@@ -0,0 +1,12 @@
+package org.openecomp.core.impl.factory;
+
+import org.openecomp.core.converter.ToscaConverter;
+import org.openecomp.core.converter.factory.ToscaConverterFactory;
+import org.openecomp.core.impl.ToscaConverterImpl;
+
+public class ToscaConverterFactoryImpl extends ToscaConverterFactory {
+ @Override
+ public ToscaConverter createInterface() {
+ return new ToscaConverterImpl();
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java
new file mode 100644
index 0000000000..fa8532546c
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java
@@ -0,0 +1,76 @@
+package org.openecomp.core.impl.services;
+
+import org.openecomp.core.converter.ServiceTemplateReaderService;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+import org.openecomp.sdc.tosca.services.YamlUtil;
+import org.yaml.snakeyaml.error.YAMLException;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+import static org.openecomp.core.converter.datatypes.Constants.*;
+
+public class ServiceTemplateReaderServiceImpl implements ServiceTemplateReaderService {
+
+ private Map<String, Object> readServiceTemplate = new HashMap<>();
+
+ public ServiceTemplateReaderServiceImpl(byte[] serviceTemplateContent){
+ this.readServiceTemplate = readServiceTemplate(serviceTemplateContent);
+ }
+
+ @Override
+ public Map<String, Object> readServiceTemplate(byte[] serviceTemplateContent) {
+
+ Map<String, Object> readSt =
+ new YamlUtil().yamlToObject(new String(serviceTemplateContent), Map.class);
+
+ return readSt;
+ }
+
+ @Override
+ public Object getMetadata(){
+ return this.readServiceTemplate.get(metadata);
+ }
+
+ @Override
+ public Object getToscaVersion(){
+ return this.readServiceTemplate.get(definitionVersion);
+ }
+
+ @Override
+ public Object getNodeTypes(){
+ return this.readServiceTemplate.get(nodeTypes);
+ }
+
+ @Override
+ public Object getTopologyTemplate(){
+ return this.readServiceTemplate.get(topologyTemplate);
+ }
+
+ @Override
+ public Map<String, Object> getNodeTemplates(){
+ return Objects.isNull(this.getTopologyTemplate()) ? new HashMap<>()
+ : (Map<String, Object>) ((Map<String, Object>)this.getTopologyTemplate()).get(nodeTemplates);
+ }
+
+ @Override
+ public Map<String, Object> getInputs(){
+ return Objects.isNull(this.getTopologyTemplate()) ? new HashMap<>()
+ : (Map<String, Object>) ((Map<String, Object>)this.getTopologyTemplate()).get(inputs);
+ }
+
+ @Override
+ public Map<String, Object> getOutputs(){
+ return Objects.isNull(this.getTopologyTemplate()) ? new HashMap<>()
+ : (Map<String, Object>) ((Map<String, Object>)this.getTopologyTemplate()).get(outputs);
+ }
+
+ @Override
+ public Map<String, Object> getSubstitutionMappings(){
+ return Objects.isNull(this.getTopologyTemplate()) ? new HashMap<>()
+ : (Map<String, Object>) ((Map<String, Object>)this.getTopologyTemplate()).get(substitutionMappings);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/resources/ToscaConverters.json b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/resources/ToscaConverters.json
new file mode 100644
index 0000000000..e1cddeb854
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/resources/ToscaConverters.json
@@ -0,0 +1,3 @@
+{
+ "ToscaConverter" : "org.openecomp.core.converter.impl.ToscaConverterImpl"
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConverterImplTest.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConverterImplTest.java
new file mode 100644
index 0000000000..4abed3e316
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConverterImplTest.java
@@ -0,0 +1,193 @@
+package org.openecomp.core.converter.impl;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.junit.Test;
+import org.openecomp.core.converter.ToscaConverter;
+import org.openecomp.core.impl.ToscaConverterImpl;
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate;
+import org.openecomp.sdc.tosca.datatypes.model.RequirementAssignment;
+import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
+import org.openecomp.sdc.tosca.services.ToscaExtensionYamlUtil;
+import org.openecomp.sdc.tosca.services.YamlUtil;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.nio.file.NotDirectoryException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Objects;
+
+import static org.junit.Assert.assertEquals;
+import static org.openecomp.core.converter.datatypes.Constants.globalStName;
+import static org.openecomp.core.converter.datatypes.Constants.mainStName;
+
+public class ToscaConverterImplTest {
+
+ private static ToscaConverter toscaConverter = new ToscaConverterImpl();
+ private static String inputFilesPath;
+ private static String outputFilesPath;
+ private static Map<String, ServiceTemplate> expectedOutserviceTemplates;
+
+
+ @Test
+ public void testConvertMainSt() throws IOException {
+ inputFilesPath = "/mock/toscaConverter/convertMainSt/in";
+ outputFilesPath = "/mock/toscaConverter/convertMainSt/out";
+
+ FileContentHandler fileContentHandler =
+ createFileContentHandlerFromInput(inputFilesPath);
+
+ expectedOutserviceTemplates = new HashMap<>();
+ loadServiceTemplates(outputFilesPath, new ToscaExtensionYamlUtil(),
+ expectedOutserviceTemplates);
+
+ ToscaServiceModel toscaServiceModel = toscaConverter.convert(fileContentHandler);
+ ServiceTemplate mainSt = toscaServiceModel.getServiceTemplates().get(mainStName);
+
+ checkSTResults(expectedOutserviceTemplates, null, mainSt);
+ }
+
+
+
+ private FileContentHandler createFileContentHandlerFromInput(String inputFilesPath)
+ throws IOException {
+ URL inputFilesUrl = this.getClass().getResource(inputFilesPath);
+ String path = inputFilesUrl.getPath();
+ File directory = new File(path);
+ File[] listFiles = directory.listFiles();
+
+ FileContentHandler fileContentHandler = new FileContentHandler();
+ insertFilesIntoFileContentHandler(listFiles, fileContentHandler);
+ return fileContentHandler;
+ }
+
+ private void insertFilesIntoFileContentHandler(File[] listFiles,
+ FileContentHandler fileContentHandler)
+ throws IOException {
+ byte[] fileContent;
+ if(CollectionUtils.isEmpty(fileContentHandler.getFileList())) {
+ fileContentHandler.setFiles(new HashMap<>());
+ }
+
+ for (File file : listFiles) {
+ if(!file.isDirectory()) {
+ try (FileInputStream fis = new FileInputStream(file)) {
+ fileContent = FileUtils.toByteArray(fis);
+ fileContentHandler.addFile(file.getPath(), fileContent);
+ }
+ }else{
+ File[] currFileList = file.listFiles();
+ insertFilesIntoFileContentHandler(currFileList, fileContentHandler);
+ }
+
+ }
+ }
+
+ private void checkSTResults(
+ Map<String, ServiceTemplate> expectedOutserviceTemplates,
+ ServiceTemplate gloablSubstitutionServiceTemplate, ServiceTemplate mainServiceTemplate) {
+ YamlUtil yamlUtil = new YamlUtil();
+ if (Objects.nonNull(gloablSubstitutionServiceTemplate)) {
+ assertEquals("difference global substitution service template: ",
+ yamlUtil.objectToYaml(expectedOutserviceTemplates.get(globalStName)),
+ yamlUtil.objectToYaml(gloablSubstitutionServiceTemplate));
+ }
+ if (Objects.nonNull(mainServiceTemplate)) {
+ assertEquals("difference main service template: ",
+ yamlUtil.objectToYaml(expectedOutserviceTemplates.get(mainStName)),
+ yamlUtil.objectToYaml(mainServiceTemplate));
+ }
+ }
+
+ public static void loadServiceTemplates(String serviceTemplatesPath,
+ ToscaExtensionYamlUtil toscaExtensionYamlUtil,
+ Map<String, ServiceTemplate> serviceTemplates)
+ throws IOException {
+ URL urlFile = ToscaConverterImplTest.class.getResource(serviceTemplatesPath);
+ if (urlFile != null) {
+ File pathFile = new File(urlFile.getFile());
+ File[] files = pathFile.listFiles();
+ if (files != null) {
+ addServiceTemplateFiles(serviceTemplates, files, toscaExtensionYamlUtil);
+ } else {
+ throw new NotDirectoryException(serviceTemplatesPath);
+ }
+ } else {
+ throw new NotDirectoryException(serviceTemplatesPath);
+ }
+ }
+
+ private static void addServiceTemplateFiles(Map<String, ServiceTemplate> serviceTemplates,
+ File[] files,
+ ToscaExtensionYamlUtil toscaExtensionYamlUtil)
+ throws IOException {
+ for (File file : files) {
+ try (InputStream yamlFile = new FileInputStream(file)) {
+ ServiceTemplate serviceTemplateFromYaml =
+ toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
+ createConcreteRequirementObjectsInServiceTemplate(serviceTemplateFromYaml, toscaExtensionYamlUtil);
+ serviceTemplates.put(file.getName(), serviceTemplateFromYaml);
+ try {
+ yamlFile.close();
+ } catch (IOException ignore) {
+ }
+ } catch (FileNotFoundException e) {
+ throw e;
+ } catch (IOException e) {
+ throw e;
+ }
+ }
+ }
+
+ private static void createConcreteRequirementObjectsInServiceTemplate(ServiceTemplate
+ serviceTemplateFromYaml,
+ ToscaExtensionYamlUtil
+ toscaExtensionYamlUtil) {
+
+ if (serviceTemplateFromYaml == null
+ || serviceTemplateFromYaml.getTopology_template() == null
+ || serviceTemplateFromYaml.getTopology_template().getNode_templates() == null) {
+ return;
+ }
+
+ //Creating concrete objects
+ Map<String, NodeTemplate> nodeTemplates =
+ serviceTemplateFromYaml.getTopology_template().getNode_templates();
+ for (Map.Entry<String, NodeTemplate> entry : nodeTemplates.entrySet()) {
+ NodeTemplate nodeTemplate = entry.getValue();
+ List<Map<String, RequirementAssignment>> requirements = nodeTemplate.getRequirements();
+ List<Map<String, RequirementAssignment>> concreteRequirementList = new ArrayList<>();
+ if (requirements != null) {
+ ListIterator<Map<String, RequirementAssignment>> reqListIterator = requirements
+ .listIterator();
+ while (reqListIterator.hasNext()){
+ Map<String, RequirementAssignment> requirement = reqListIterator.next();
+ Map<String, RequirementAssignment> concreteRequirement = new HashMap<>();
+ for (Map.Entry<String, RequirementAssignment> reqEntry : requirement.entrySet()) {
+ RequirementAssignment requirementAssignment = (toscaExtensionYamlUtil
+ .yamlToObject(toscaExtensionYamlUtil.objectToYaml(reqEntry.getValue()),
+ RequirementAssignment.class));
+ concreteRequirement.put(reqEntry.getKey(), requirementAssignment);
+ concreteRequirementList.add(concreteRequirement);
+ reqListIterator.remove();
+ }
+ }
+ requirements.clear();
+ requirements.addAll(concreteRequirementList);
+ nodeTemplate.setRequirements(requirements);
+ }
+ System.out.println();
+ //toscaExtensionYamlUtil.yamlToObject(nodeTemplate, NodeTemplate.class);
+ }
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConvertorDefinitionsTest.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConvertorDefinitionsTest.java
new file mode 100644
index 0000000000..9f7071e9e7
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConvertorDefinitionsTest.java
@@ -0,0 +1,62 @@
+package org.openecomp.core.converter.impl;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.Test;
+import org.openecomp.core.impl.GlobalSubstitutionServiceTemplate;
+import org.openecomp.core.impl.ToscaConverterImpl;
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
+
+import java.net.URL;
+import java.util.Map;
+import java.util.Set;
+
+import static org.openecomp.sdc.common.utils.CommonUtil.*;
+import static org.junit.Assert.*;
+import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.*;
+public class ToscaConvertorDefinitionsTest {
+
+
+ @Test
+ public void loadCsar() throws Exception {
+ URL resource = ToscaConvertorDefinitionsTest.class.getResource("/csar/vCSCF.csar");
+ byte[] bytes = IOUtils.toByteArray(resource);
+ assertNotNull(bytes);
+ FileContentHandler contentMap = validateAndUploadFileContent(OnboardingTypesEnum.CSAR, bytes);
+ ToscaConverterImpl toscaConverter = new ToscaConverterImpl();
+ ToscaServiceModel convert = toscaConverter.convert(contentMap);
+ Map<String, ServiceTemplate> serviceTemplates = convert.getServiceTemplates();
+ assertTrue(serviceTemplates.containsKey(GLOBAL_SUBSTITUTION_SERVICE_FILE_NAME));
+ ServiceTemplate serviceTemplate = serviceTemplates.get(GLOBAL_SUBSTITUTION_SERVICE_FILE_NAME);
+
+ assertNotNull(serviceTemplate);
+ assertTrue(serviceTemplate instanceof GlobalSubstitutionServiceTemplate);
+
+ assertNotNull(serviceTemplate.getMetadata());
+ assertFalse(serviceTemplate.getMetadata().isEmpty());
+ assertTrue(serviceTemplate.getMetadata().containsKey(TEMPLATE_NAME_PROPERTY));
+
+ assertNotNull(serviceTemplate.getImports());
+ assertFalse(serviceTemplate.getImports().isEmpty());
+ assertEquals(1 ,serviceTemplate.getImports().size());
+ assertTrue(serviceTemplate.getImports().get(0).containsKey(HEAT_INDEX));
+
+ assertEquals(DEFININTION_VERSION, serviceTemplate.getTosca_definitions_version());
+
+
+ assertNotNull(serviceTemplate.getNode_types());
+ assertEquals(7, serviceTemplate.getNode_types().size());
+ Set<String> keys = serviceTemplate.getNode_types().keySet();
+ assertTrue(keys.contains("tosca.nodes.nfv.ext.zte.VDU"));
+ assertTrue(keys.contains("tosca.nodes.nfv.ext.zte.CP"));
+ assertTrue(keys.contains("tosca.nodes.nfv.ext.zte.VNF.vCSCF"));
+ assertTrue(keys.contains("tosca.nodes.nfv.ext.ImageFile"));
+ assertTrue(keys.contains("tosca.nodes.nfv.ext.LocalStorage"));
+ assertTrue(keys.contains("tosca.nodes.nfv.ext.zte.VNF"));
+ assertTrue(keys.contains("tosca.nodes.nfv.ext.zte.VL"));
+ }
+
+
+}
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/csar/vCSCF.csar b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/csar/vCSCF.csar
new file mode 100644
index 0000000000..f1b77554e4
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/csar/vCSCF.csar
Binary files differ
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/Artifacts/checksum.lst b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/Artifacts/checksum.lst
new file mode 100644
index 0000000000..701f14d45d
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/Artifacts/checksum.lst
@@ -0,0 +1 @@
+Definitions/openovnf__vPCRF.yaml:75bd8963ecc09bf769d0bb5cb475314d
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/Artifacts/csar.meta b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/Artifacts/csar.meta
new file mode 100644
index 0000000000..aac2fed3c3
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/Artifacts/csar.meta
@@ -0,0 +1,3 @@
+Type:NFAR
+Version:v1.0
+Provider:Huawei \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/Definitions/GlobalSubstitutionTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/Definitions/GlobalSubstitutionTypesServiceTemplate.yaml
new file mode 100644
index 0000000000..a88171701e
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/Definitions/GlobalSubstitutionTypesServiceTemplate.yaml
@@ -0,0 +1,60 @@
+node_types:
+ tosca.nodes.nfv.VDU.Compute:
+ attributes:
+ private_address:
+ type: string
+ public_address:
+ type: string
+ networks:
+ type: string
+ ports:
+ type: string
+ capabilities:
+ scalable:
+ type: tosca.capabilities.Scalable
+ virtual_compute:
+ type: tosca.capabilities.nfv.VirtualCompute
+ endpoint:
+ type: tosca.capabilities.Endpoint.Admin
+ os:
+ type: tosca.capabilities.OperatingSystem
+ virtual_binding:
+ type: tosca.capabilities.nfv.VirtualBindable
+ host:
+ type: tosca.capabilities.Container
+ binding:
+ type: tosca.capabilities.network.Bindable
+ monitoring_parameter:
+ type: tosca.capabilities.nfv.Metric
+ derived_from: tosca.nodes.Root
+ properties:
+ configurable_properties:
+ entry_schema:
+ type: tosca.datatypes.nfv.VnfcConfigurableProperties
+ type: map
+ name:
+ type: string
+ nfvi_constraints:
+ entry_schema:
+ type: string
+ required: false
+ type: list
+ descrption:
+ type: string
+ boot_order:
+ entry_schema:
+ type: string
+ required: false
+ type: list
+ requirements:
+ - local_storage:
+ capability: tosca.capabilities.Attachment
+ occurrences:
+ - 0
+ - UNBOUNDED
+ - virtual_storage:
+ capability: tosca.capabilities.nfv.VirtualStorage
+ occurrences:
+ - 0
+ - UNBOUNDED
+tosca_definitions_version: tosca_simple_yaml_1_0
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.mf b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.mf
new file mode 100644
index 0000000000..e45f002332
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.mf
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+
+Name: Entry-Definitions
+Name: MainServiceTemplate.yaml
+
+Name: Definitions\GlobalSubstitutionTypesServiceTemplate.yaml
+
+Name: Artifacts\install.sh
+
+Name: Artifacts\create_stack.sh
+
+Name: Licenses\license.xml
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.yaml
new file mode 100644
index 0000000000..041afbacf8
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.yaml
@@ -0,0 +1,551 @@
+imports:
+- openovnf__tosca.nodes.nfv.VNF.vPCRF.yaml
+- openonfv__tosca.capabilities.Scalable.yaml
+- openonfv__tosca.capabilities.nfv.Metric.yaml
+- openonfv__tosca.nodes.nfv.VnfVirtualLinkDesc.yaml
+- openonfv__tosca.capabilities.network.Bindable.yaml
+- openonfv__tosca.capabilities.Attachment.yaml
+- openonfv__tosca.capabilities.nfv.VirtualBindable.yaml
+- openonfv__tosca.capabilities.nfv.VirtualLinkable.yaml
+- openonfv__tosca.requirements.nfv.VirtualStorage.yaml
+- openonfv__tosca.nodes.nfv.VDU.VirtualStorage.yaml
+- openonfv__tosca.relationships.nfv.VirtualBindsTo.yaml
+- openonfv__tosca.nodes.nfv.VDU.Compute.yaml
+- openonfv__tosca.relationships.nfv.VirtualLinksTo.yaml
+- openonfv__tosca.capabilities.nfv.VirtualCompute.yaml
+- openonfv__tosca.capabilities.Container.yaml
+- openonfv__tosca.capabilities.nfv.VirtualStorage.yaml
+- openonfv__tosca.requirements.nfv.VirtualBinding.yaml
+- openonfv__tosca.capabilities.Endpoint.Admin.yaml
+- openonfv__tosca.capabilities.OperatingSystem.yaml
+- openonfv__tosca.nodes.nfv.VduCpd.yaml
+- openonfv__tosca.relationships.nfv.VDU.AttachedTo.yaml
+
+metadata:
+ vendor: Huawei
+ csarVersion: v1.0
+ csarProvider: Huawei
+ id: vPCRF_NF_HW
+ version: v1.0
+ csarType: NFAR
+ name: vPCRF
+ vnfdVersion: v1.0
+ vnfmType: hwvnfm
+
+node_types:
+ org.openecomp.resource.vfc.nodes.heat.nat_fw:
+ derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server
+
+topology_template:
+ node_templates:
+ PUPDU_Storage:
+ attributes:
+ tosca_name: PUPDU_Storage
+ properties:
+ id: PUPDU_Storage
+ size_of_storage: 200G
+ type_of_storage: volume
+ type: tosca.nodes.nfv.VDU.VirtualStorage
+ USRSU:
+ attributes:
+ tosca_name: USRSU
+ capabilities:
+ virtual_compute:
+ properties:
+ virtual_memory:
+ virtual_mem_size: 24G
+ requested_additional_capabilities: {}
+ virtual_cpu:
+ num_virtual_cpu: 4
+ properties:
+ configurable_properties:
+ test: {"additional_vnfc_configurable_properties":{"aaa":"1"}}
+ name: USRSU
+ descrption: the virtual machine of USRSU
+ requirements:
+ - virtual_storage:
+ capability: virtual_storage
+ node: USRSU_Storage
+ - local_storage:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VDU.Compute
+ USPID3_VduCpd_Fabric:
+ attributes:
+ tosca_name: USPID3_VduCpd_Fabric
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: USPID3
+ - virtual_link:
+ capability: virtual_linkable
+ node: Fabric
+ type: tosca.nodes.nfv.VduCpd
+ PUPDU_VduCpd_Base:
+ attributes:
+ tosca_name: PUPDU_VduCpd_Base
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: PUPDU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Base
+ type: tosca.nodes.nfv.VduCpd
+ OMU_VduCpd_Fabric:
+ attributes:
+ tosca_name: OMU_VduCpd_Fabric
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: OMU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Fabric
+ type: tosca.nodes.nfv.VduCpd
+ USPID3:
+ attributes:
+ tosca_name: USPID3
+ capabilities:
+ virtual_compute:
+ properties:
+ virtual_memory:
+ virtual_mem_size: 24G
+ requested_additional_capabilities: {}
+ virtual_cpu:
+ num_virtual_cpu: 4
+ properties:
+ configurable_properties:
+ test: {"additional_vnfc_configurable_properties":{"aaa":"1"}}
+ name: USPID3
+ descrption: the virtual machine of USPID3
+ requirements:
+ - virtual_storage:
+ capability: virtual_storage
+ node: USPID3_Storage
+ - local_storage:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VDU.Compute
+ UPIRU_VduCpd_Base:
+ attributes:
+ tosca_name: UPIRU_VduCpd_Base
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: UPIRU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Base
+ type: tosca.nodes.nfv.VduCpd
+ OMU2ManageNet:
+ attributes:
+ tosca_name: OMU2ManageNet
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ node: tosca.nodes.Root
+ - virtual_link:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VduCpd
+ OMU_Storage:
+ attributes:
+ tosca_name: OMU_Storage
+ properties:
+ id: OMU_Storage
+ size_of_storage: 256G
+ rdma_enabled: false
+ type_of_storage: volume
+ type: tosca.nodes.nfv.VDU.VirtualStorage
+ UPSPU:
+ attributes:
+ tosca_name: UPSPU
+ capabilities:
+ virtual_compute:
+ properties:
+ virtual_memory:
+ virtual_mem_size: 24G
+ requested_additional_capabilities: {}
+ virtual_cpu:
+ num_virtual_cpu: 4
+ properties:
+ configurable_properties:
+ test: {"additional_vnfc_configurable_properties":{"aaa":"1"}}
+ name: UPSPU
+ descrption: the virtual machine of UPSPU
+ requirements:
+ - virtual_storage:
+ capability: virtual_storage
+ node: UPSPU_Storage
+ - local_storage:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VDU.Compute
+ PUPDU_VduCpd_Fabric:
+ attributes:
+ tosca_name: PUPDU_VduCpd_Fabric
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: PUPDU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Fabric
+ type: tosca.nodes.nfv.VduCpd
+ USPID2BossNet:
+ attributes:
+ tosca_name: USPID2BossNet
+ properties:
+ role: root
+ layer_protocol: ethernet
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: USPID3
+ - virtual_link:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VduCpd
+ OMU_VduCpd_Base:
+ attributes:
+ tosca_name: OMU_VduCpd_Base
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: OMU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Base
+ type: tosca.nodes.nfv.VduCpd
+ USPID3_Storage:
+ attributes:
+ tosca_name: USPID3_Storage
+ properties:
+ id: USPID3_Storage
+ size_of_storage: 300G
+ type_of_storage: volume
+ type: tosca.nodes.nfv.VDU.VirtualStorage
+ UPIRU2DataNet2:
+ attributes:
+ tosca_name: UPIRU2DataNet2
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: UPIRU
+ - virtual_link:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VduCpd
+ USPID2ManageNet:
+ attributes:
+ tosca_name: USPID2ManageNet
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: USPID3
+ - virtual_link:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VduCpd
+ UPIRU2DataNet3:
+ attributes:
+ tosca_name: UPIRU2DataNet3
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: UPIRU
+ - virtual_link:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VduCpd
+ PUPDU2DataNet3:
+ attributes:
+ tosca_name: PUPDU2DataNet3
+ properties:
+ role: root
+ layer_protocol: ethernet
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: PUPDU
+ - virtual_link:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VduCpd
+ USRSU2DataNet1:
+ attributes:
+ tosca_name: USRSU2DataNet1
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: USRSU
+ - virtual_link:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VduCpd
+ USRSU2DataNet2:
+ attributes:
+ tosca_name: USRSU2DataNet2
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: USRSU
+ - virtual_link:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VduCpd
+ UPIRU_Storage:
+ attributes:
+ tosca_name: UPIRU_Storage
+ properties:
+ id: UPIRU_Storage
+ size_of_storage: 4G
+ type_of_storage: volume
+ type: tosca.nodes.nfv.VDU.VirtualStorage
+ PUPDU2SignalNet1:
+ attributes:
+ tosca_name: PUPDU2SignalNet1
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: PUPDU
+ - virtual_link:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VduCpd
+ UPIRU2DataNet1:
+ attributes:
+ tosca_name: UPIRU2DataNet1
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: UPIRU
+ - virtual_link:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VduCpd
+ USPID3_VduCpd_Base:
+ attributes:
+ tosca_name: USPID3_VduCpd_Base
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: USPID3
+ - virtual_link:
+ capability: virtual_linkable
+ node: Base
+ type: tosca.nodes.nfv.VduCpd
+ Base:
+ attributes:
+ tosca_name: Base
+ properties:
+ vl_flavours:
+ flavours: test2
+ connectivity_type:
+ layer_protocol: ipv4
+ flow_pattern:
+ type: tosca.nodes.nfv.VnfVirtualLinkDesc
+ USRSU_Storage:
+ attributes:
+ tosca_name: USRSU_Storage
+ properties:
+ id: USRSU_Storage
+ size_of_storage: 200G
+ type_of_storage: volume
+ type: tosca.nodes.nfv.VDU.VirtualStorage
+ UPSPU_VduCpd_Base:
+ attributes:
+ tosca_name: UPSPU_VduCpd_Base
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: UPSPU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Base
+ type: tosca.nodes.nfv.VduCpd
+ PUPDU:
+ attributes:
+ tosca_name: PUPDU
+ capabilities:
+ virtual_compute:
+ properties:
+ virtual_memory:
+ virtual_mem_size: 24G
+ requested_additional_capabilities: {}
+ virtual_cpu:
+ num_virtual_cpu: 4
+ properties:
+ configurable_properties:
+ test: {"additional_vnfc_configurable_properties":{"aaa":"1"}}
+ name: PUPDU
+ descrption: the virtual machine of PUPDU
+ requirements:
+ - virtual_storage:
+ capability: virtual_storage
+ node: PUPDU_Storage
+ - local_storage:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VDU.Compute
+ USRSU_VduCpd_Base:
+ attributes:
+ tosca_name: USRSU_VduCpd_Base
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: USRSU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Base
+ type: tosca.nodes.nfv.VduCpd
+ OMU:
+ attributes:
+ tosca_name: OMU
+ capabilities:
+ virtual_compute:
+ properties:
+ virtual_memory:
+ virtual_mem_size: 16G
+ requested_additional_capabilities: {}
+ virtual_cpu:
+ num_virtual_cpu: 4
+ properties:
+ configurable_properties:
+ test: {"additional_vnfc_configurable_properties":{"aaa":"1"}}
+ name: OMU
+ descrption: the virtual machine of OMU
+ requirements:
+ - virtual_storage:
+ capability: virtual_storage
+ node: OMU_Storage
+ - local_storage:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VDU.Compute
+ UPIRU_VduCpd_Fabric:
+ attributes:
+ tosca_name: UPIRU_VduCpd_Fabric
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: UPIRU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Fabric
+ type: tosca.nodes.nfv.VduCpd
+ UPSPU_Storage:
+ attributes:
+ tosca_name: UPSPU_Storage
+ properties:
+ id: UPSPU_Storage
+ size_of_storage: 4G
+ type_of_storage: volume
+ type: tosca.nodes.nfv.VDU.VirtualStorage
+ PUPDU2ManageNet:
+ attributes:
+ tosca_name: PUPDU2ManageNet
+ properties:
+ role: root
+ layer_protocol: ethernet
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: PUPDU
+ - virtual_link:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VduCpd
+ USRSU_VduCpd_Fabric:
+ attributes:
+ tosca_name: USRSU_VduCpd_Fabric
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: USRSU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Fabric
+ type: tosca.nodes.nfv.VduCpd
+ UPIRU2SignalNet1:
+ attributes:
+ tosca_name: UPIRU2SignalNet1
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: UPIRU
+ - virtual_link:
+ node: tosca.nodes.Root
+ type: tosca.nodes.nfv.VduCpd
+ Fabric:
+ attributes:
+ tosca_name: Fabric
+ properties:
+ vl_flavours:
+ flavours: test1
+ connectivity_type:
+ layer_protocol: ipv4
+ flow_pattern:
+ type: tosca.nodes.nfv.VnfVirtualLinkDesc
+ UPSPU_VduCpd_Fabric:
+ attributes:
+ tosca_name: UPSPU_VduCpd_Fabric
+ properties:
+ role: root
+ layer_protocol: ipv4
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: UPSPU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Fabric
+ type: tosca.nodes.nfv.VduCpd
+
+ substitution_mappings:
+ node_type: tosca.nodes.nfv.VNF.vPCRF
+tosca_definitions_version: tosca_simple_yaml_1_0 \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/TOSCA-Metadata/TOSCA.meta b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/TOSCA-Metadata/TOSCA.meta
new file mode 100644
index 0000000000..69f62ca864
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/TOSCA-Metadata/TOSCA.meta
@@ -0,0 +1,135 @@
+TOSCA-Meta-Version: 1.0
+CSAR-Version: 1.0
+Created-By: Winery 0.1.37-SNAPSHOT
+Entry-Definitions: Definitions/openovnf__vPCRF.yaml
+
+Name: Definitions/openovnf__vPCRF.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openovnf__tosca.nodes.nfv.VNF.vPCRF.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.capabilities.Scalable.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.capabilities.nfv.Metric.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.nodes.nfv.VnfVirtualLinkDesc.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.capabilities.network.Bindable.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.capabilities.Attachment.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.capabilities.nfv.VirtualBindable.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.capabilities.nfv.VirtualLinkable.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.requirements.nfv.VirtualStorage.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.nodes.nfv.VDU.VirtualStorage.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.relationships.nfv.VirtualBindsTo.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.nodes.nfv.VDU.Compute.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.relationships.nfv.VirtualLinksTo.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.capabilities.nfv.VirtualCompute.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.capabilities.Container.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.capabilities.nfv.VirtualStorage.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.requirements.nfv.VirtualBinding.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.capabilities.Endpoint.Admin.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.capabilities.OperatingSystem.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.nodes.nfv.VduCpd.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.relationships.nfv.VDU.AttachedTo.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openonfv__tosca.requirements.nfv.VirtualLink.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: Definitions/openovnf__tosca.nodes.nfv.VNF.yaml
+Content-Type: application/vnd.oasis.tosca.definitions
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VDU.VirtualStorage/propertiesdefinition/Properties.xsd
+Content-Type: text/xml
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VnfVirtualLinkDesc/appearance/bigIcon.png
+Content-Type: image/png
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VnfVirtualLinkDesc/appearance/smallIcon.png
+Content-Type: image/png
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VDU.Compute/propertiesdefinition/Properties.xsd
+Content-Type: text/xml
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VduCpd/propertiesdefinition/Properties.xsd
+Content-Type: text/xml
+
+Name: capabilitytypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.capabilities.nfv.VirtualCompute/propertiesdefinition/Properties.xsd
+Content-Type: text/xml
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv%2Fvnf/tosca.nodes.nfv.VNF/propertiesdefinition/Properties.xsd
+Content-Type: text/xml
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VDU.VirtualStorage/appearance/bigIcon.png
+Content-Type: image/png
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VDU.VirtualStorage/appearance/smallIcon.png
+Content-Type: image/png
+
+Name: capabilitytypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.capabilities.Container/propertiesdefinition/Properties.xsd
+Content-Type: text/xml
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VDU.Compute/appearance/bigIcon.png
+Content-Type: image/png
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VDU.Compute/appearance/smallIcon.png
+Content-Type: image/png
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv%2Fvnf/tosca.nodes.nfv.VNF.vPCRF/propertiesdefinition/Properties.xsd
+Content-Type: text/xml
+
+Name: capabilitytypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.capabilities.OperatingSystem/propertiesdefinition/Properties.xsd
+Content-Type: text/xml
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VnfVirtualLinkDesc/propertiesdefinition/Properties.xsd
+Content-Type: text/xml
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VduCpd/appearance/bigIcon.png
+Content-Type: image/png
+
+Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VduCpd/appearance/smallIcon.png
+Content-Type: image/png
+
+Name: capabilitytypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.capabilities.Scalable/propertiesdefinition/Properties.xsd
+Content-Type: text/xml
+
+Name: relationshiptypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.relationships.nfv.VDU.AttachedTo/propertiesdefinition/Properties.xsd
+Content-Type: text/xml
+
+
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml
new file mode 100644
index 0000000000..77bfcac710
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml
@@ -0,0 +1,546 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+metadata:
+ vnfdVersion: v1.0
+ template_name: Main
+ vendor: Huawei
+ csarVersion: v1.0
+ vnfmType: hwvnfm
+ csarProvider: Huawei
+ name: vPCRF
+ id: vPCRF_NF_HW
+ version: v1.0
+ csarType: NFAR
+imports:
+- openecomp_heat_index:
+ file: openecomp-heat/_index.yml
+- GlobalSubstitutionTypes:
+ file: GlobalSubstitutionTypesServiceTemplate.yaml
+node_types:
+ org.openecomp.resource.vfc.nodes.heat.nat_fw:
+ derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server
+topology_template:
+ node_templates:
+ PUPDU_Storage:
+ type: tosca.nodes.nfv.VDU.VirtualStorage
+ properties:
+ id: PUPDU_Storage
+ size_of_storage: 200G
+ type_of_storage: volume
+ attributes:
+ tosca_name: PUPDU_Storage
+ USRSU:
+ type: tosca.nodes.nfv.VDU.Compute
+ properties:
+ configurable_properties:
+ test:
+ additional_vnfc_configurable_properties:
+ aaa: '1'
+ name: USRSU
+ descrption: the virtual machine of USRSU
+ attributes:
+ tosca_name: USRSU
+ requirements:
+ - virtual_storage:
+ capability: virtual_storage
+ node: USRSU_Storage
+ - local_storage:
+ node: tosca.nodes.Root
+ capabilities:
+ - virtual_compute:
+ properties:
+ virtual_memory:
+ virtual_mem_size: 24G
+ requested_additional_capabilities: {
+ }
+ virtual_cpu:
+ num_virtual_cpu: 4.0
+ USPID3_VduCpd_Fabric:
+ type: tosca.nodes.nfv.VduCpd
+ properties:
+ role: root
+ layer_protocol: ipv4
+ attributes:
+ tosca_name: USPID3_VduCpd_Fabric
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: USPID3
+ - virtual_link:
+ capability: virtual_linkable
+ node: Fabric
+ PUPDU_VduCpd_Base:
+ type: tosca.nodes.nfv.VduCpd
+ properties:
+ role: root
+ layer_protocol: ipv4
+ attributes:
+ tosca_name: PUPDU_VduCpd_Base
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: PUPDU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Base
+ OMU_VduCpd_Fabric:
+ type: tosca.nodes.nfv.VduCpd
+ properties:
+ role: root
+ layer_protocol: ipv4
+ attributes:
+ tosca_name: OMU_VduCpd_Fabric
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: OMU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Fabric
+ USPID3:
+ type: tosca.nodes.nfv.VDU.Compute
+ properties:
+ configurable_properties:
+ test:
+ additional_vnfc_configurable_properties:
+ aaa: '1'
+ name: USPID3
+ descrption: the virtual machine of USPID3
+ attributes:
+ tosca_name: USPID3
+ requirements:
+ - virtual_storage:
+ capability: virtual_storage
+ node: USPID3_Storage
+ - local_storage:
+ node: tosca.nodes.Root
+ capabilities:
+ - virtual_compute:
+ properties:
+ virtual_memory:
+ virtual_mem_size: 24G
+ requested_additional_capabilities: {
+ }
+ virtual_cpu:
+ num_virtual_cpu: 4.0
+ UPIRU_VduCpd_Base:
+ type: tosca.nodes.nfv.VduCpd
+ properties:
+ role: root
+ layer_protocol: ipv4
+ attributes:
+ tosca_name: UPIRU_VduCpd_Base
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: UPIRU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Base
+ OMU2ManageNet:
+ type: tosca.nodes.nfv.VduCpd
+ properties:
+ role: root
+ layer_protocol: ipv4
+ attributes:
+ tosca_name: OMU2ManageNet
+ requirements:
+ - virtual_binding:
+ node: tosca.nodes.Root
+ - virtual_link:
+ node: tosca.nodes.Root
+ OMU_Storage:
+ type: tosca.nodes.nfv.VDU.VirtualStorage
+ properties:
+ id: OMU_Storage
+ size_of_storage: 256G
+ rdma_enabled: false
+ type_of_storage: volume
+ attributes:
+ tosca_name: OMU_Storage
+ UPSPU:
+ type: tosca.nodes.nfv.VDU.Compute
+ properties:
+ configurable_properties:
+ test:
+ additional_vnfc_configurable_properties:
+ aaa: '1'
+ name: UPSPU
+ descrption: the virtual machine of UPSPU
+ attributes:
+ tosca_name: UPSPU
+ requirements:
+ - virtual_storage:
+ capability: virtual_storage
+ node: UPSPU_Storage
+ - local_storage:
+ node: tosca.nodes.Root
+ capabilities:
+ - virtual_compute:
+ properties:
+ virtual_memory:
+ virtual_mem_size: 24G
+ requested_additional_capabilities: {
+ }
+ virtual_cpu:
+ num_virtual_cpu: 4.0
+ PUPDU_VduCpd_Fabric:
+ type: tosca.nodes.nfv.VduCpd
+ properties:
+ role: root
+ layer_protocol: ipv4
+ attributes:
+ tosca_name: PUPDU_VduCpd_Fabric
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: PUPDU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Fabric
+ USPID2BossNet:
+ type: tosca.nodes.nfv.VduCpd
+ properties:
+ role: root
+ layer_protocol: ethernet
+ attributes:
+ tosca_name: USPID2BossNet
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: USPID3
+ - virtual_link:
+ node: tosca.nodes.Root
+ OMU_VduCpd_Base:
+ type: tosca.nodes.nfv.VduCpd
+ properties:
+ role: root
+ layer_protocol: ipv4
+ attributes:
+ tosca_name: OMU_VduCpd_Base
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: OMU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Base
+ USPID3_Storage:
+ type: tosca.nodes.nfv.VDU.VirtualStorage
+ properties:
+ id: USPID3_Storage
+ size_of_storage: 300G
+ type_of_storage: volume
+ attributes:
+ tosca_name: USPID3_Storage
+ UPIRU2DataNet2:
+ type: tosca.nodes.nfv.VduCpd
+ properties:
+ role: root
+ layer_protocol: ipv4
+ attributes:
+ tosca_name: UPIRU2DataNet2
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: UPIRU
+ - virtual_link:
+ node: tosca.nodes.Root
+ USPID2ManageNet:
+ type: tosca.nodes.nfv.VduCpd
+ properties:
+ role: root
+ layer_protocol: ipv4
+ attributes:
+ tosca_name: USPID2ManageNet
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: USPID3
+ - virtual_link:
+ node: tosca.nodes.Root
+ UPIRU2DataNet3:
+ type: tosca.nodes.nfv.VduCpd
+ properties:
+ role: root
+ layer_protocol: ipv4
+ attributes:
+ tosca_name: UPIRU2DataNet3
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: UPIRU
+ - virtual_link:
+ node: tosca.nodes.Root
+ PUPDU2DataNet3:
+ type: tosca.nodes.nfv.VduCpd
+ properties:
+ role: root
+ layer_protocol: ethernet
+ attributes:
+ tosca_name: PUPDU2DataNet3
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: PUPDU
+ - virtual_link:
+ node: tosca.nodes.Root
+ USRSU2DataNet1:
+ type: tosca.nodes.nfv.VduCpd
+ properties:
+ role: root
+ layer_protocol: ipv4
+ attributes:
+ tosca_name: USRSU2DataNet1
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: USRSU
+ - virtual_link:
+ node: tosca.nodes.Root
+ USRSU2DataNet2:
+ type: tosca.nodes.nfv.VduCpd
+ properties:
+ role: root
+ layer_protocol: ipv4
+ attributes:
+ tosca_name: USRSU2DataNet2
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: USRSU
+ - virtual_link:
+ node: tosca.nodes.Root
+ UPIRU_Storage:
+ type: tosca.nodes.nfv.VDU.VirtualStorage
+ properties:
+ id: UPIRU_Storage
+ size_of_storage: 4G
+ type_of_storage: volume
+ attributes:
+ tosca_name: UPIRU_Storage
+ PUPDU2SignalNet1:
+ type: tosca.nodes.nfv.VduCpd
+ properties:
+ role: root
+ layer_protocol: ipv4
+ attributes:
+ tosca_name: PUPDU2SignalNet1
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: PUPDU
+ - virtual_link:
+ node: tosca.nodes.Root
+ UPIRU2DataNet1:
+ type: tosca.nodes.nfv.VduCpd
+ properties:
+ role: root
+ layer_protocol: ipv4
+ attributes:
+ tosca_name: UPIRU2DataNet1
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: UPIRU
+ - virtual_link:
+ node: tosca.nodes.Root
+ USPID3_VduCpd_Base:
+ type: tosca.nodes.nfv.VduCpd
+ properties:
+ role: root
+ layer_protocol: ipv4
+ attributes:
+ tosca_name: USPID3_VduCpd_Base
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: USPID3
+ - virtual_link:
+ capability: virtual_linkable
+ node: Base
+ Base:
+ type: tosca.nodes.nfv.VnfVirtualLinkDesc
+ properties:
+ vl_flavours:
+ flavours: test2
+ connectivity_type:
+ layer_protocol: ipv4
+ flow_pattern: null
+ attributes:
+ tosca_name: Base
+ USRSU_Storage:
+ type: tosca.nodes.nfv.VDU.VirtualStorage
+ properties:
+ id: USRSU_Storage
+ size_of_storage: 200G
+ type_of_storage: volume
+ attributes:
+ tosca_name: USRSU_Storage
+ UPSPU_VduCpd_Base:
+ type: tosca.nodes.nfv.VduCpd
+ properties:
+ role: root
+ layer_protocol: ipv4
+ attributes:
+ tosca_name: UPSPU_VduCpd_Base
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: UPSPU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Base
+ PUPDU:
+ type: tosca.nodes.nfv.VDU.Compute
+ properties:
+ configurable_properties:
+ test:
+ additional_vnfc_configurable_properties:
+ aaa: '1'
+ name: PUPDU
+ descrption: the virtual machine of PUPDU
+ attributes:
+ tosca_name: PUPDU
+ requirements:
+ - virtual_storage:
+ capability: virtual_storage
+ node: PUPDU_Storage
+ - local_storage:
+ node: tosca.nodes.Root
+ capabilities:
+ - virtual_compute:
+ properties:
+ virtual_memory:
+ virtual_mem_size: 24G
+ requested_additional_capabilities: {
+ }
+ virtual_cpu:
+ num_virtual_cpu: 4.0
+ USRSU_VduCpd_Base:
+ type: tosca.nodes.nfv.VduCpd
+ properties:
+ role: root
+ layer_protocol: ipv4
+ attributes:
+ tosca_name: USRSU_VduCpd_Base
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: USRSU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Base
+ OMU:
+ type: tosca.nodes.nfv.VDU.Compute
+ properties:
+ configurable_properties:
+ test:
+ additional_vnfc_configurable_properties:
+ aaa: '1'
+ name: OMU
+ descrption: the virtual machine of OMU
+ attributes:
+ tosca_name: OMU
+ requirements:
+ - virtual_storage:
+ capability: virtual_storage
+ node: OMU_Storage
+ - local_storage:
+ node: tosca.nodes.Root
+ capabilities:
+ - virtual_compute:
+ properties:
+ virtual_memory:
+ virtual_mem_size: 16G
+ requested_additional_capabilities: {
+ }
+ virtual_cpu:
+ num_virtual_cpu: 4.0
+ UPIRU_VduCpd_Fabric:
+ type: tosca.nodes.nfv.VduCpd
+ properties:
+ role: root
+ layer_protocol: ipv4
+ attributes:
+ tosca_name: UPIRU_VduCpd_Fabric
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: UPIRU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Fabric
+ UPSPU_Storage:
+ type: tosca.nodes.nfv.VDU.VirtualStorage
+ properties:
+ id: UPSPU_Storage
+ size_of_storage: 4G
+ type_of_storage: volume
+ attributes:
+ tosca_name: UPSPU_Storage
+ PUPDU2ManageNet:
+ type: tosca.nodes.nfv.VduCpd
+ properties:
+ role: root
+ layer_protocol: ethernet
+ attributes:
+ tosca_name: PUPDU2ManageNet
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: PUPDU
+ - virtual_link:
+ node: tosca.nodes.Root
+ USRSU_VduCpd_Fabric:
+ type: tosca.nodes.nfv.VduCpd
+ properties:
+ role: root
+ layer_protocol: ipv4
+ attributes:
+ tosca_name: USRSU_VduCpd_Fabric
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: USRSU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Fabric
+ UPIRU2SignalNet1:
+ type: tosca.nodes.nfv.VduCpd
+ properties:
+ role: root
+ layer_protocol: ipv4
+ attributes:
+ tosca_name: UPIRU2SignalNet1
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: UPIRU
+ - virtual_link:
+ node: tosca.nodes.Root
+ Fabric:
+ type: tosca.nodes.nfv.VnfVirtualLinkDesc
+ properties:
+ vl_flavours:
+ flavours: test1
+ connectivity_type:
+ layer_protocol: ipv4
+ flow_pattern: null
+ attributes:
+ tosca_name: Fabric
+ UPSPU_VduCpd_Fabric:
+ type: tosca.nodes.nfv.VduCpd
+ properties:
+ role: root
+ layer_protocol: ipv4
+ attributes:
+ tosca_name: UPSPU_VduCpd_Fabric
+ requirements:
+ - virtual_binding:
+ capability: virtual_binding
+ node: UPSPU
+ - virtual_link:
+ capability: virtual_linkable
+ node: Fabric
+ substitution_mappings:
+ node_type: tosca.nodes.nfv.VNF.vPCRF
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/pom.xml b/openecomp-be/lib/openecomp-tosca-converter-lib/pom.xml
new file mode 100644
index 0000000000..e789e09965
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/pom.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+
+ <parent>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-lib</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>openecomp-tosca-converter-lib</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>openecomp-tosca-converter-api</module>
+ <module>openecomp-tosca-converter-core</module>
+ </modules>
+
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaServiceModel.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaServiceModel.java
index 0fcaafa1c2..722c286f50 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaServiceModel.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaServiceModel.java
@@ -33,6 +33,7 @@ import java.util.Map;
*/
public class ToscaServiceModel implements AsdcModel {
private FileContentHandler artifactFiles;
+ private FileContentHandler externalFiles;
private Map<String, ServiceTemplate> serviceTemplates;
private String entryDefinitionServiceTemplate;
@@ -54,6 +55,15 @@ public class ToscaServiceModel implements AsdcModel {
this.entryDefinitionServiceTemplate = entryDefinitionServiceTemplate;
}
+ public ToscaServiceModel(FileContentHandler artifactFiles,
+ FileContentHandler externalFiles,
+ Map<String, ServiceTemplate> serviceTemplates,
+ String entryDefinitionServiceTemplate) {
+ this.artifactFiles = artifactFiles;
+ this.externalFiles = externalFiles;
+ this.serviceTemplates = serviceTemplates;
+ this.entryDefinitionServiceTemplate = entryDefinitionServiceTemplate;
+ }
/**
* Gets artifact files.
@@ -113,4 +123,12 @@ public class ToscaServiceModel implements AsdcModel {
public static ToscaServiceModel getClonedServiceModel(ToscaServiceModel toscaServiceModel) {
return ToscaServiceModel.class.cast(DataModelUtil.getClonedObject(toscaServiceModel));
}
+
+ public FileContentHandler getExternalFiles() {
+ return externalFiles;
+ }
+
+ public void setExternalFiles(FileContentHandler externalFiles) {
+ this.externalFiles = externalFiles;
+ }
}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java
index dc2ed6c76b..45e6c3deef 100644
--- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java
@@ -492,7 +492,8 @@ public class ToscaAnalyzerServiceImpl implements ToscaAnalyzerService {
toscaServiceModel.getServiceTemplates().get(fetchFileNameForImport(importFile,
serviceTemplate.getMetadata() == null ? null
: serviceTemplate.getMetadata().get("filename")));
- if (filesScanned.contains(ToscaUtil.getServiceTemplateFileName(template))) {
+ if (Objects.isNull(template) ||
+ filesScanned.contains(ToscaUtil.getServiceTemplateFileName(template))) {
continue;
} else {
filesScanned.add(ToscaUtil.getServiceTemplateFileName(template));
diff --git a/openecomp-be/lib/pom.xml b/openecomp-be/lib/pom.xml
index 5095578db4..df1b854a31 100644
--- a/openecomp-be/lib/pom.xml
+++ b/openecomp-be/lib/pom.xml
@@ -31,5 +31,7 @@
<module>openecomp-logging-lib</module>
<module>openecomp-healing-lib</module>
<module>openecomp-sdc-activity-log-lib</module>
+ <module>openecomp-tosca-converter-lib</module>
+ <module>openecomp-sdc-orchestration-lib</module>
</modules>
</project>
diff --git a/openecomp-be/pom.xml b/openecomp-be/pom.xml
index 10b59fa23f..6147ea8fe4 100644
--- a/openecomp-be/pom.xml
+++ b/openecomp-be/pom.xml
@@ -192,7 +192,7 @@
<artifactId>groovy-all</artifactId>
<version>${groovy.version}</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
<version>${janino.version}</version>
diff --git a/openecomp-be/tools/zusammen-tools/src/main/resources/zusammenMainTool.sh b/openecomp-be/tools/zusammen-tools/src/main/resources/zusammenMainTool.sh
index b92266fc84..42c347f4e8 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/resources/zusammenMainTool.sh
+++ b/openecomp-be/tools/zusammen-tools/src/main/resources/zusammenMainTool.sh
@@ -1,16 +1,26 @@
#!/bin/bash
+###########################################################################################################
+# script name - zusammenMainTool.sh
+# run script - ./zusammenMainTool.sh
+# 1. Export all - ./zusammenMainTool.sh -c EXPORT
+# 2. Export one item ./zusammenMainTool.sh -c EXPORT -i ${elementId}
+# 3. Import one item - ./zusammenMainTool.sh -c IMPORT -f ${fileName} -i ${elementId}
+# 4. Import all - ./zusammenMainTool.sh -c IMPORT -f ${fileName}
+# 5. Reset old version - ./zusammenMainTool.sh -c RESET_OLD_VERSION
+#
+##########################################################################################################
+
OSTYPE=`uname -a | grep -iq ubuntu; echo $?`
echo "${OSTYPE}"
-if [ ${OSTYPE} -eq 1 ]
+if [ ${OSTYPE} -eq 0 ]
then
CONF_FILE_LOCATION="/opt/app/jetty/base/be/config/catalog-be/configuration.yaml"
else
- CONF_FILE_LOCATION="/apps/jetty/base/be/config/catalog-be/configuration.yaml"
+ CONF_FILE_LOCATION="/apps/jetty/base/be/config/catalog-be/configuration.yaml"
fi
echo "Configuration file location: ${CONF_FILE_LOCATION}"
-# change exist package and service templates in db
java -Dlog.home=/apps/jetty/base/be/logs -Dconfiguration.yaml=${CONF_FILE_LOCATION} -jar openecomp-zusammen-tools-1.0-SNAPSHOT.jar org.openecomp.core.tools.main.ZusammenMainTool $1 $2 $3 $4 $5 $6
-STATUS="${?}" echo "${STATUS}" \ No newline at end of file
+STATUS="${?}" echo "${STATUS}"
diff --git a/openecomp-ui/resources/scss/modules/_softwareProductLandingPage.scss b/openecomp-ui/resources/scss/modules/_softwareProductLandingPage.scss
index 9b0375d24a..28b54cc78f 100644
--- a/openecomp-ui/resources/scss/modules/_softwareProductLandingPage.scss
+++ b/openecomp-ui/resources/scss/modules/_softwareProductLandingPage.scss
@@ -164,27 +164,29 @@
color: $light-blue;
}
}
- .software-product-landing-view-top-block-col-upl {
- @extend .flex;
- text-align: center;
- flex-direction: column;
- justify-content: center;
- border: 2px dashed $light-gray;
- margin-bottom: 20px;
- @extend .body-1;
- align-items: center;
- .upload-btn {
- padding: 15px 55px;
+ }
- }
- .drag-text {
- color: $blue;
- @extend .body-1-semibold;
- }
- .or-text {
- margin-top: 10px;
- margin-bottom: 10px;
- }
+ .software-product-landing-view-top-block-col-upl {
+ @extend .flex;
+ height: 215px;
+ text-align: center;
+ flex-direction: column;
+ justify-content: center;
+ border: 2px dashed $light-gray;
+ margin-bottom: 20px;
+ @extend .body-1;
+ align-items: center;
+ .upload-btn {
+ padding: 15px 55px;
+
+ }
+ .drag-text {
+ color: $blue;
+ @extend .body-1-semibold;
+ }
+ .or-text {
+ margin-top: 10px;
+ margin-bottom: 10px;
}
}
}
diff --git a/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js
index 24ba05e303..fc65083bff 100644
--- a/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js
+++ b/openecomp-ui/src/sdc-app/onboarding/OnboardingActionHelper.js
@@ -31,11 +31,13 @@ import OnboardActionHelper from './onboard/OnboardActionHelper.js';
import SoftwareProductComponentsMonitoringAction from './softwareProduct/components/monitoring/SoftwareProductComponentsMonitoringActionHelper.js';
import {actionTypes, enums} from './OnboardingConstants.js';
import SoftwareProductComponentsImageActionHelper from './softwareProduct/components/images/SoftwareProductComponentsImageActionHelper.js';
-import {navigationItems as SoftwareProductNavigationItems, actionTypes as SoftwareProductActionTypes} from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js';
+import {navigationItems as SoftwareProductNavigationItems, actionTypes as SoftwareProductActionTypes, onboardingOriginTypes} from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js';
import ActivityLogActionHelper from 'sdc-app/common/activity-log/ActivityLogActionHelper.js';
import licenseModelOverviewActionHelper from 'sdc-app/onboarding/licenseModel/overview/licenseModelOverviewActionHelper.js';
import store from 'sdc-app/AppStore.js';
import {selectedButton as licenseModelOverviewSelectedButton} from 'sdc-app/onboarding/licenseModel/overview/LicenseModelOverviewConstants.js';
+import {tabsMapping as attachmentsTabsMapping} from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsConstants.js';
+import SoftwareProductAttachmentsActionHelper from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsActionHelper.js';
function setCurrentScreen(dispatch, screen, props = {}) {
dispatch({
@@ -165,7 +167,9 @@ export default {
SoftwareProductActionHelper.loadSoftwareProductDetailsData(dispatch, {licenseModelId, licensingVersion});
SoftwareProductComponentsActionHelper.fetchSoftwareProductComponents(dispatch, {softwareProductId, version: newVersion});
- SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(dispatch, {softwareProductId, version: newVersion});
+ if(response[0].onboardingOrigin === onboardingOriginTypes.ZIP) {
+ SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(dispatch, {softwareProductId, version: newVersion});
+ }
setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_LANDING_PAGE, {softwareProductId, licenseModelId, version: newVersion});
});
},
@@ -175,11 +179,19 @@ export default {
setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_DETAILS, {softwareProductId, version});
},
- navigateToSoftwareProductAttachments(dispatch, {softwareProductId, version}) {
+ navigateToSoftwareProductAttachmentsSetupTab(dispatch, {softwareProductId, version}) {
SoftwareProductActionHelper.loadSoftwareProductHeatCandidate(dispatch, {softwareProductId, version});
+ SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, {activeTab: attachmentsTabsMapping.SETUP});
setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS, {softwareProductId, version});
},
+ navigateToSoftwareProductAttachmentsValidationTab(dispatch, {softwareProductId, version}) {
+ SoftwareProductActionHelper.processAndValidateHeatCandidate(dispatch, {softwareProductId, version}).then(() => {
+ SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, {activeTab: attachmentsTabsMapping.VALIDATION});
+ setCurrentScreen(dispatch, enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS, {softwareProductId, version});
+ });
+ },
+
navigateToSoftwareProductProcesses(dispatch, {softwareProductId, version}) {
if (softwareProductId) {
SoftwareProductProcessesActionHelper.fetchProcessesList(dispatch, {softwareProductId, version});
diff --git a/openecomp-ui/src/sdc-app/onboarding/OnboardingPunchOut.jsx b/openecomp-ui/src/sdc-app/onboarding/OnboardingPunchOut.jsx
index aea5fc6406..c1f3251281 100644
--- a/openecomp-ui/src/sdc-app/onboarding/OnboardingPunchOut.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/OnboardingPunchOut.jsx
@@ -28,7 +28,6 @@ import Onboard from './onboard/Onboard.js';
import LicenseModel from './licenseModel/LicenseModel.js';
import LicenseModelOverview from './licenseModel/overview/LicenseModelOverview.js';
import ActivityLog from 'sdc-app/common/activity-log/ActivityLog.js';
-import {doesHeatDataExist} from './softwareProduct/attachments/SoftwareProductAttachmentsUtils.js';
import LicenseAgreementListEditor from './licenseModel/licenseAgreement/LicenseAgreementListEditor.js';
import FeatureGroupListEditor from './licenseModel/featureGroups/FeatureGroupListEditor.js';
@@ -55,7 +54,8 @@ import SoftwareProductComponentsMonitoring from './softwareProduct/components/mo
import {
navigationItems as SoftwareProductNavigationItems,
onboardingMethod as onboardingMethodTypes,
- actionTypes as SoftwareProductActionTypes
+ actionTypes as SoftwareProductActionTypes,
+ onboardingOriginTypes
} from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js';
import {statusEnum as VCItemStatus} from 'nfvo-components/panel/versionController/VersionControllerConstants.js';
@@ -314,7 +314,12 @@ export default class OnboardingPunchOut {
OnboardingActionHelper.navigateToSoftwareProductDetails(dispatch, {softwareProductId, version: currentSoftwareProductVersion});
break;
case enums.BREADCRUMS.SOFTWARE_PRODUCT_ATTACHMENTS:
- OnboardingActionHelper.navigateToSoftwareProductAttachments(dispatch, {softwareProductId, version: currentSoftwareProductVersion});
+ if(softwareProduct.onboardingOrigin === onboardingOriginTypes.ZIP) {
+ OnboardingActionHelper.navigateToSoftwareProductAttachmentsSetupTab(dispatch, {softwareProductId, version: currentSoftwareProductVersion});
+ }
+ else if(softwareProduct.onboardingOrigin === onboardingOriginTypes.CSAR) {
+ OnboardingActionHelper.navigateToSoftwareProductAttachmentsValidationTab(dispatch, {softwareProductId, version: currentSoftwareProductVersion});
+ }
break;
case enums.BREADCRUMS.SOFTWARE_PRODUCT_PROCESSES:
OnboardingActionHelper.navigateToSoftwareProductProcesses(dispatch, {softwareProductId, version: currentSoftwareProductVersion});
@@ -415,9 +420,9 @@ export default class OnboardingPunchOut {
handleStoreChange() {
let {currentScreen, licenseModelList, softwareProductList,
softwareProduct: {softwareProductEditor: {data = {onboardingMethod: ''}},
- softwareProductComponents: {componentsList}, softwareProductAttachments: {heatSetup}}} = store.getState();
- let {onboardingMethod} = data;
- let breadcrumbsData = {onboardingMethod, currentScreen, licenseModelList, softwareProductList, componentsList, heatSetup};
+ softwareProductComponents: {componentsList}}} = store.getState();
+ let {onboardingMethod, onboardingOrigin} = data;
+ let breadcrumbsData = {onboardingMethod, currentScreen, licenseModelList, softwareProductList, componentsList, onboardingOrigin};
if (currentScreen.forceBreadCrumbsUpdate || !isEqual(breadcrumbsData, this.prevBreadcrumbsData) || this.breadcrumbsPrefixSelected) {
this.prevBreadcrumbsData = breadcrumbsData;
this.breadcrumbsPrefixSelected = false;
@@ -434,7 +439,7 @@ export default class OnboardingPunchOut {
}
}
- buildBreadcrumbs({currentScreen: {screen, props}, onboardingMethod, licenseModelList, softwareProductList, componentsList, heatSetup}) {
+ buildBreadcrumbs({currentScreen: {screen, props}, onboardingMethod, licenseModelList, softwareProductList, componentsList, onboardingOrigin}) {
let screenToBreadcrumb;
switch (screen) {
case enums.SCREEN.ONBOARDING_CATALOG:
@@ -593,7 +598,7 @@ export default class OnboardingPunchOut {
key: enums.BREADCRUMS.SOFTWARE_PRODUCT_COMPONENTS,
displayText: i18n('Components')
}].filter(item => {
- let isHeatData = doesHeatDataExist(heatSetup);
+ let isHeatData = onboardingOrigin !== onboardingOriginTypes.NONE;
let isManualMode = onboardingMethod === onboardingMethodTypes.MANUAL;
switch (item.key) {
case enums.BREADCRUMS.SOFTWARE_PRODUCT_ATTACHMENTS:
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js
index c9c95f359e..6426847cfc 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProduct.js
@@ -22,11 +22,10 @@ import TabulatedEditor from 'src/nfvo-components/editor/TabulatedEditor.jsx';
import {enums} from 'sdc-app/onboarding/OnboardingConstants.js';
import OnboardingActionHelper from 'sdc-app/onboarding/OnboardingActionHelper.js';
-import {navigationItems, mapScreenToNavigationItem, onboardingMethod as onboardingMethodTypes} from './SoftwareProductConstants.js';
+import {navigationItems, mapScreenToNavigationItem, onboardingMethod as onboardingMethodTypes, onboardingOriginTypes} from './SoftwareProductConstants.js';
import SoftwareProductActionHelper from './SoftwareProductActionHelper.js';
import SoftwareProductComponentsActionHelper from './components/SoftwareProductComponentsActionHelper.js';
import SoftwareProductDependenciesActionHelper from './dependencies/SoftwareProductDependenciesActionHelper.js';
-import {doesHeatDataExist} from './attachments/SoftwareProductAttachmentsUtils.js';
import HeatSetupActionHelper from './attachments/setup/HeatSetupActionHelper.js';
import { actionsEnum as versionControllerActions } from 'nfvo-components/panel/versionController/VersionControllerConstants.js';
@@ -86,7 +85,7 @@ const buildComponentNavigationBarGroups = ({componentId, meta}) => {
const buildNavigationBarProps = ({softwareProduct, meta, screen, componentId, componentsList, mapOfExpandedIds}) => {
const {softwareProductEditor: {data: currentSoftwareProduct = {}}} = softwareProduct;
- const {id, name, onboardingMethod} = currentSoftwareProduct;
+ const {id, name, onboardingMethod, onboardingOrigin} = currentSoftwareProduct;
const groups = [{
id: id,
name: name,
@@ -122,7 +121,7 @@ const buildNavigationBarProps = ({softwareProduct, meta, screen, componentId, co
id: navigationItems.ATTACHMENTS,
name: i18n('Attachments'),
disabled: false,
- hidden: !doesHeatDataExist(meta.heatSetup),
+ hidden: onboardingOrigin === onboardingOriginTypes.NONE,
meta
}, {
id: navigationItems.ACTIVITY_LOG,
@@ -175,7 +174,7 @@ const buildVersionControllerProps = (softwareProduct) => {
function buildMeta({softwareProduct, componentId, softwareProductDependencies}) {
const {softwareProductEditor, softwareProductComponents, softwareProductQuestionnaire, softwareProductAttachments} = softwareProduct;
const {data: currentSoftwareProduct = {}} = softwareProductEditor;
- const {version} = currentSoftwareProduct;
+ const {version, onboardingOrigin} = currentSoftwareProduct;
const isReadOnlyMode = VersionControllerUtils.isReadOnly(currentSoftwareProduct);
const {qdata} = softwareProductQuestionnaire;
const {heatSetup, heatSetupCache} = softwareProductAttachments;
@@ -184,7 +183,7 @@ function buildMeta({softwareProduct, componentId, softwareProductDependencies})
const {componentEditor: {data: componentData = {} , qdata: componentQdata}} = softwareProductComponents;
currentComponentMeta = {componentData, componentQdata};
}
- const meta = {softwareProduct: currentSoftwareProduct, qdata, version, heatSetup, heatSetupCache, isReadOnlyMode, currentComponentMeta, softwareProductDependencies};
+ const meta = {softwareProduct: currentSoftwareProduct, qdata, version, onboardingOrigin, heatSetup, heatSetupCache, isReadOnlyMode, currentComponentMeta, softwareProductDependencies};
return meta;
}
@@ -280,7 +279,7 @@ const mapActionsToProps = (dispatch, {currentScreen: {screen, props: {softwarePr
},
onToggle: (groups, itemIdToExpand) => groups.map(({items}) => SoftwareProductActionHelper.toggleNavigationItems(dispatch, {items, itemIdToExpand})),
onNavigate: ({id, meta, version}) => {
- let {heatSetup, heatSetupCache} = meta;
+ let {onboardingOrigin, heatSetup, heatSetupCache} = meta;
let heatSetupPopupPromise = screen === enums.SCREEN.SOFTWARE_PRODUCT_ATTACHMENTS ?
HeatSetupActionHelper.heatSetupLeaveConfirmation(dispatch, {softwareProductId, heatSetup, heatSetupCache}) :
Promise.resolve();
@@ -307,7 +306,12 @@ const mapActionsToProps = (dispatch, {currentScreen: {screen, props: {softwarePr
OnboardingActionHelper.navigateToSoftwareProductDependencies(dispatch, {softwareProductId, version});
break;
case navigationItems.ATTACHMENTS:
- OnboardingActionHelper.navigateToSoftwareProductAttachments(dispatch, {softwareProductId, version});
+ if(onboardingOrigin === onboardingOriginTypes.ZIP) {
+ OnboardingActionHelper.navigateToSoftwareProductAttachmentsSetupTab(dispatch, {softwareProductId, version});
+ }
+ else if(onboardingOrigin === onboardingOriginTypes.CSAR) {
+ OnboardingActionHelper.navigateToSoftwareProductAttachmentsValidationTab(dispatch, {softwareProductId, version});
+ }
break;
case navigationItems.COMPONENTS:
OnboardingActionHelper.navigateToSoftwareProductComponents(dispatch, {softwareProductId, version});
@@ -334,9 +338,7 @@ const mapActionsToProps = (dispatch, {currentScreen: {screen, props: {softwarePr
case enums.SCREEN.SOFTWARE_PRODUCT_DEPLOYMENT:
case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_PROCESSES:
case enums.SCREEN.SOFTWARE_PRODUCT_COMPONENT_MONITORING:
- props.onSave = () => {
- return Promise.resolve();
- };
+ props.onSave = () => Promise.resolve();
break;
default:
props.onSave = ({softwareProduct, qdata}) => SoftwareProductActionHelper.updateSoftwareProduct(dispatch, {softwareProduct, qdata});
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js
index d4bee0a876..41306a1c1a 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js
@@ -20,7 +20,7 @@ import LicenseModelActionHelper from 'sdc-app/onboarding/licenseModel/LicenseMod
import LicenseAgreementActionHelper from 'sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementActionHelper.js';
import FeatureGroupsActionHelper from 'sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsActionHelper.js';
-import {actionTypes} from './SoftwareProductConstants.js';
+import {actionTypes, onboardingOriginTypes, PRODUCT_QUESTIONNAIRE, forms} from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js';
import OnboardingActionHelper from 'sdc-app/onboarding/OnboardingActionHelper.js';
import SoftwareProductComponentsActionHelper from './components/SoftwareProductComponentsActionHelper.js';
import {actionsEnum as VersionControllerActionsEnum} from 'nfvo-components/panel/versionController/VersionControllerConstants.js';
@@ -29,10 +29,10 @@ import {actionTypes as featureGroupsActionConstants} from 'sdc-app/onboarding/li
import {actionTypes as licenseAgreementActionTypes} from 'sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementConstants.js';
import {actionTypes as componentActionTypes} from './components/SoftwareProductComponentsConstants.js';
import ValidationHelper from 'sdc-app/common/helpers/ValidationHelper.js';
-import {PRODUCT_QUESTIONNAIRE} from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js';
import {actionTypes as modalActionTypes} from 'nfvo-components/modal/GlobalModalConstants.js';
import {modalContentMapper} from 'sdc-app/common/modal/ModalContentMapper.js';
import {statusEnum} from 'nfvo-components/panel/versionController/VersionControllerConstants.js';
+import {actionTypes as commonActionTypes} from 'sdc-app/common/reducers/PlainDataReducerConstants.js';
function baseUrl() {
const restPrefix = Configuration.get('restPrefix');
@@ -59,7 +59,9 @@ function putSoftwareProduct(softwareProduct) {
licensingVersion: softwareProduct.licensingVersion && softwareProduct.licensingVersion.id ? softwareProduct.licensingVersion : {} ,
icon: softwareProduct.icon,
licensingData: softwareProduct.licensingData,
- onboardingMethod: softwareProduct.onboardingMethod
+ onboardingMethod: softwareProduct.onboardingMethod,
+ networkPackageName: softwareProduct.networkPackageName,
+ onboardingOrigin: softwareProduct.onboardingOrigin
});
}
@@ -267,7 +269,19 @@ const SoftwareProductActionHelper = {
.then(() => uploadFile(softwareProductId, formData, version))
.then(response => {
if (response.status === 'Success') {
- OnboardingActionHelper.navigateToSoftwareProductAttachments(dispatch, {softwareProductId, version});
+ dispatch({
+ type: commonActionTypes.DATA_CHANGED,
+ deltaData: {onboardingOrigin: response.onboardingOrigin},
+ formName: forms.VENDOR_SOFTWARE_PRODUCT_DETAILS
+ });
+ switch(response.onboardingOrigin){
+ case onboardingOriginTypes.ZIP:
+ OnboardingActionHelper.navigateToSoftwareProductAttachmentsSetupTab(dispatch, {softwareProductId, version});
+ break;
+ case onboardingOriginTypes.CSAR:
+ OnboardingActionHelper.navigateToSoftwareProductAttachmentsValidationTab(dispatch, {softwareProductId, version});
+ break;
+ }
}
else {
throw new Error(parseUploadErrorMsg(response.errors));
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js
index 0379ee5d4a..2c094ac36a 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js
@@ -39,7 +39,7 @@ export const navigationItems = keyMirror({
GENERAL: 'general',
PROCESS_DETAILS: 'process-details',
DEPLOYMENT_FLAVORS: 'deployment-flavor',
- NETWORKS: 'networks',
+ NETWORKS: 'networks',
IMAGES: 'images',
ATTACHMENTS: 'attachments',
ACTIVITY_LOG: 'activity-log',
@@ -54,7 +54,13 @@ export const navigationItems = keyMirror({
export const onboardingMethod = {
MANUAL: 'Manual',
- HEAT: 'HEAT'
+ NETWORK_PACKAGE: 'NetworkPackage'
+};
+
+export const onboardingOriginTypes = {
+ NONE: 'none',
+ ZIP: 'zip',
+ CSAR: 'csar'
};
export const forms = keyMirror({
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductReducer.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductReducer.js
index 977a76ac69..d7a6c2ef5c 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductReducer.js
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/SoftwareProductReducer.js
@@ -15,6 +15,7 @@
*/
import {combineReducers} from 'redux';
import {actionTypes, PRODUCT_QUESTIONNAIRE} from './SoftwareProductConstants.js';
+import SoftwareProductAttachmentsReducer from './attachments/SoftwareProductAttachmentsReducer.js';
import HeatValidationReducer from './attachments/validation/HeatValidationReducer.js';
import HeatSetupReducer from './attachments/setup/HeatSetupReducer.js';
import {actionTypes as heatSetupActionTypes} from './attachments/setup/HeatSetupConstants.js';
@@ -48,6 +49,7 @@ import {IMAGE_QUESTIONNAIRE} from 'sdc-app/onboarding/softwareProduct/components
export default combineReducers({
softwareProductAttachments: combineReducers({
+ attachmentsDetails: SoftwareProductAttachmentsReducer,
heatValidation: HeatValidationReducer,
heatSetup: HeatSetupReducer,
heatSetupCache: (state = {}, action) => action.type === heatSetupActionTypes.FILL_HEAT_SETUP_CACHE ? action.payload : state
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js
index 945de4fc36..f14c988866 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js
@@ -23,6 +23,7 @@ import {errorLevels} from 'sdc-app/onboarding/softwareProduct/attachments/valida
import OnboardingActionHelper from 'sdc-app/onboarding/OnboardingActionHelper.js';
import HeatSetup from './setup/HeatSetup.js';
import {doesHeatDataExist} from './SoftwareProductAttachmentsUtils.js';
+import SoftwareProductAttachmentsActionHelper from './SoftwareProductAttachmentsActionHelper.js';
import VersionControllerUtils from 'nfvo-components/panel/versionController/VersionControllerUtils.js';
@@ -30,7 +31,7 @@ export const mapStateToProps = (state) => {
let {
softwareProduct: {
softwareProductEditor:{data: currentSoftwareProduct = {}},
- softwareProductAttachments: {heatSetup, heatSetupCache, heatValidation : {errorList}}
+ softwareProductAttachments: {attachmentsDetails: {activeTab}, heatSetup, heatSetupCache, heatValidation : {errorList}}
}
} = state;
@@ -47,7 +48,7 @@ export const mapStateToProps = (state) => {
let isReadOnlyMode = currentSoftwareProduct && currentSoftwareProduct.version ?
VersionControllerUtils.isReadOnly(currentSoftwareProduct) : false;
- let {version} = currentSoftwareProduct;
+ let {version, onboardingOrigin} = currentSoftwareProduct;
return {
isValidationAvailable: unassigned.length === 0 && modules.length > 0,
heatSetup,
@@ -56,7 +57,9 @@ export const mapStateToProps = (state) => {
goToOverview,
HeatSetupComponent: HeatSetup,
isReadOnlyMode,
- version
+ version,
+ onboardingOrigin,
+ activeTab
};
};
@@ -83,7 +86,8 @@ export const mapActionsToProps = (dispatch, {softwareProductId}) => {
onProcessAndValidate: ({heatData, heatDataCache, isReadOnlyMode, version}) => {
return HeatSetupActionHelper.processAndValidateHeat(dispatch,
{softwareProductId, heatData, heatDataCache, isReadOnlyMode, version});
- }
+ },
+ setActiveTab: ({activeTab}) => SoftwareProductAttachmentsActionHelper.setActiveTab(dispatch, {activeTab})
};
};
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsActionHelper.js
new file mode 100644
index 0000000000..ae4a615a40
--- /dev/null
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsActionHelper.js
@@ -0,0 +1,26 @@
+/*!
+ * 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.
+ */
+
+import {actionTypes} from './SoftwareProductAttachmentsConstants';
+
+export default {
+ setActiveTab(dispatch, {activeTab}) {
+ dispatch({
+ type: actionTypes.SET_ACTIVE_TAB,
+ activeTab
+ });
+ }
+};
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsConstants.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsConstants.js
index b0410d1566..67265909d7 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsConstants.js
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsConstants.js
@@ -13,7 +13,13 @@
* or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
+import keyMirror from 'nfvo-utils/KeyMirror.js';
+
export const tabsMapping = {
SETUP: 1,
VALIDATION: 2
};
+
+export const actionTypes = keyMirror({
+ SET_ACTIVE_TAB: null
+});
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsReducer.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsReducer.js
new file mode 100644
index 0000000000..5f6538ab7e
--- /dev/null
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsReducer.js
@@ -0,0 +1,25 @@
+/*!
+ * 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.
+ */
+import {actionTypes} from './SoftwareProductAttachmentsConstants.js';
+
+export default (state = [], action) => {
+ switch (action.type) {
+ case actionTypes.SET_ACTIVE_TAB:
+ return {activeTab: action.activeTab};
+ default:
+ return state;
+ }
+};
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx
index 3da26cc20f..8c59b2b1cc 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx
@@ -20,34 +20,34 @@ import {tabsMapping} from './SoftwareProductAttachmentsConstants.js';
import i18n from 'nfvo-utils/i18n/i18n.js';
import SVGIcon from 'sdc-ui/lib/react/SVGIcon.js';
import HeatValidation from './validation/HeatValidation.js';
+import {onboardingOriginTypes} from 'sdc-app/onboarding/softwareProduct/SoftwareProductConstants.js';
class HeatScreenView extends Component {
static propTypes = {
isValidationAvailable: PropTypes.bool,
- goToOverview: PropTypes.bool
- };
-
- state = {
- activeTab: tabsMapping.SETUP
+ goToOverview: PropTypes.bool,
+ setActiveTab: PropTypes.function
};
render() {
- let {isValidationAvailable, isReadOnlyMode, heatDataExist, onDownload, softwareProductId, onProcessAndValidate, heatSetup, HeatSetupComponent, onGoToOverview, version, ...other} = this.props;
+ let {isValidationAvailable, isReadOnlyMode, heatDataExist, onDownload, softwareProductId, onProcessAndValidate,
+ heatSetup, HeatSetupComponent, onGoToOverview, version, onboardingOrigin, activeTab, setActiveTab, ...other} = this.props;
+
return (
<div className='vsp-attachments-view'>
<div className='attachments-view-controllers'>
- {(this.state.activeTab === tabsMapping.SETUP) &&
+ {(activeTab === tabsMapping.SETUP) &&
<SVGIcon
disabled={heatDataExist ? false : true}
name='download'
className='icon-component'
- label={i18n('Download HEAT')}
+ label={i18n('Export Validation')}
labelPosition='right'
color='secondary'
onClick={heatDataExist ? () => onDownload({heatCandidate: heatSetup, isReadOnlyMode, version}) : undefined}
data-test-id='download-heat'/>}
- {(this.state.activeTab === tabsMapping.VALIDATION && softwareProductId) &&
+ {(activeTab === tabsMapping.VALIDATION && softwareProductId) &&
<SVGIcon
disabled={this.props.goToOverview !== true}
onClick={this.props.goToOverview ? () => onGoToOverview({version}) : undefined}
@@ -60,7 +60,7 @@ class HeatScreenView extends Component {
<SVGIcon
name='upload'
className='icon-component'
- label={i18n('Upload New HEAT')}
+ label={i18n('Upload New File')}
labelPosition='right'
color='secondary'
disabled={isReadOnlyMode}
@@ -70,20 +70,20 @@ class HeatScreenView extends Component {
ref='hiddenImportFileInput'
type='file'
name='fileInput'
- accept='.zip'
+ accept='.zip, .csar'
onChange={evt => this.handleImport(evt)}/>
</div>
- <Tabs id='attachments-tabs' activeKey={this.state.activeTab} onSelect={key => this.handleTabPress(key)}>
- <Tab eventKey={tabsMapping.SETUP} title='HEAT Setup'>
+ <Tabs id='attachments-tabs' activeKey={activeTab} onSelect={key => this.handleTabPress(key)}>
+ <Tab eventKey={tabsMapping.SETUP} title='Setup' disabled={onboardingOrigin === onboardingOriginTypes.CSAR}>
<HeatSetupComponent
heatDataExist={heatDataExist}
- changeAttachmentsTab={tab => this.setState({activeTab: tab})}
+ changeAttachmentsTab={tab => setActiveTab({activeTab: tab})}
onProcessAndValidate={onProcessAndValidate}
softwareProductId={softwareProductId}
isReadOnlyMode={isReadOnlyMode}
version={version}/>
</Tab>
- <Tab eventKey={tabsMapping.VALIDATION} title='Heat Validation' disabled={!isValidationAvailable}>
+ <Tab eventKey={tabsMapping.VALIDATION} title='Validation' disabled={!isValidationAvailable}>
<HeatValidation {...other}/>
</Tab>
</Tabs>
@@ -92,15 +92,15 @@ class HeatScreenView extends Component {
}
handleTabPress(key) {
- let {heatSetup, heatSetupCache, onProcessAndValidate, isReadOnlyMode, version} = this.props;
+ let {heatSetup, heatSetupCache, onProcessAndValidate, isReadOnlyMode, version, setActiveTab} = this.props;
switch (key) {
case tabsMapping.VALIDATION:
onProcessAndValidate({heatData: heatSetup, heatDataCache: heatSetupCache, isReadOnlyMode, version}).then(
- () => this.setState({activeTab: tabsMapping.VALIDATION})
+ () => setActiveTab({activeTab: tabsMapping.VALIDATION})
);
return;
case tabsMapping.SETUP:
- this.setState({activeTab: tabsMapping.SETUP});
+ setActiveTab({activeTab: tabsMapping.SETUP});
return;
}
}
@@ -112,11 +112,13 @@ class HeatScreenView extends Component {
formData.append('upload', this.refs.hiddenImportFileInput.files[0]);
this.refs.hiddenImportFileInput.value = '';
this.props.onUpload(formData, version);
- this.setState({activeTab: tabsMapping.SETUP});
}
save() {
- return this.props.onSave(this.props.heatSetup, this.props.version);
+
+ return this.props.onboardingOrigin === onboardingOriginTypes.ZIP ?
+ this.props.onSave(this.props.heatSetup, this.props.version) :
+ Promise.resolve();
}
}
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationReducer.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationReducer.js
index f0c10ed457..1d11bdd6b7 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationReducer.js
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationReducer.js
@@ -89,16 +89,16 @@ function createErrorList(node, parent, deep = 0, errorList = []) {
return errorList;
}
-const mapValidationDataToTree = validationData => {
- let {heat, volume, network, artifacts, other} = validationData.importStructure || {};
+const mapValidationDataToTree = (validationData, packageName) => {
+ let {heat, nested, volume, network, artifacts, other} = validationData.importStructure || {};
return {
children: [
{
- name: 'HEAT',
+ name: packageName,
expanded: true,
type: 'heat',
header: true,
- children: (heat ? heat.map(mapHeatData) : [])
+ children: (heat ? heat.map(mapHeatData) : nested ? nested.map(mapHeatData) : [])
},
...(artifacts ? [{
name: 'artifacts',
@@ -165,7 +165,8 @@ export default (state = {attachmentsTree: {}}, action) => {
switch (action.type) {
case softwareProductsActionTypes.SOFTWARE_PRODUCT_LOADED:
let currentSoftwareProduct = action.response;
- let attachmentsTree = currentSoftwareProduct.validationData ? mapValidationDataToTree(currentSoftwareProduct.validationData) : {};
+ const packageName = currentSoftwareProduct.networkPackageName;
+ let attachmentsTree = currentSoftwareProduct.validationData ? mapValidationDataToTree(currentSoftwareProduct.validationData, packageName) : {};
let errorList = createErrorList(attachmentsTree);
return {
...state,
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationView.jsx
index 2a2f4ac291..80d74b2964 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/attachments/validation/HeatValidationView.jsx
@@ -93,9 +93,9 @@ function HeatFileTreeHeader(props) {
<div onClick={() => props.selectNode(nodeFilters.ALL)} className={classNames({'attachments-tree-header': true,
'header-selected' : props.selectedNode === nodeFilters.ALL})} data-test-id='validation-tree-header'>
<div className='tree-header-title' >
- <SVGIcon name='zip' color={props.selectedNode === nodeFilters.ALL ? 'primary' : ''} iconClassName='header-icon' />
+ {/*<SVGIcon name='zip' color={props.selectedNode === nodeFilters.ALL ? 'primary' : ''} iconClassName='header-icon' />*/}
<span className={classNames({'tree-header-title-text' : true,
- 'tree-header-title-selected' : props.selectedNode === nodeFilters.ALL})}>{i18n(`HEAT${hasErrors ? ' (Draft)' : ''}`)}</span>
+ 'tree-header-title-selected' : props.selectedNode === nodeFilters.ALL})}>{i18n(`${props.headerTitle} ${hasErrors ? '(Draft)' : ''}`)}</span>
</div>
<ErrorsAndWarningsCount errorList={props.errorList} size='large' />
</div>);
@@ -134,7 +134,7 @@ class HeatFileTree extends React.Component {
<div key={node.name + rand} className={classNames({'tree-block-inside' : !node.header})}>
{
node.header ?
- <HeatFileTreeHeader selectedNode={selectedNode} errorList={this.props.errorList} selectNode={(nodeName) => this.selectNode(nodeName)} /> :
+ <HeatFileTreeHeader headerTitle={node.name} selectedNode={selectedNode} errorList={this.props.errorList} selectNode={(nodeName) => this.selectNode(nodeName)} /> :
<HeatFileTreeRow toggleExpanded={this.props.toggleExpanded} node={node} path={path} selectedNode={selectedNode} selectNode={() => this.selectNode(node.name)} />
}
{
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreationView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreationView.jsx
index 11f3543e39..c7ab3e644c 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreationView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/creation/SoftwareProductCreationView.jsx
@@ -186,12 +186,12 @@ const OnboardingProcedure = ({onboardingMethod, onDataChanged, genericFieldInfo}
<GridSection title={i18n('Onboarding procedure')}>
<GridItem colSpan={4}>
<Input
- label={i18n('HEAT file')}
+ label={i18n('Network Package')}
overlayPos='top'
isValid={genericFieldInfo.onboardingMethod.isValid}
- checked={onboardingMethod === onboardingMethodConst.HEAT}
+ checked={onboardingMethod === onboardingMethodConst.NETWORK_PACKAGE}
errorText={genericFieldInfo.onboardingMethod.errorText}
- onChange={() => onDataChanged({onboardingMethod:'HEAT'},SP_CREATION_FORM_NAME)}
+ onChange={() => onDataChanged({onboardingMethod: onboardingMethodConst.NETWORK_PACKAGE},SP_CREATION_FORM_NAME)}
type='radio'
data-test-id='new-vsp-creation-procedure-heat' />
</GridItem>
@@ -202,7 +202,7 @@ const OnboardingProcedure = ({onboardingMethod, onDataChanged, genericFieldInfo}
checked={onboardingMethod === onboardingMethodConst.MANUAL}
isValid={genericFieldInfo.onboardingMethod.isValid}
errorText={genericFieldInfo.onboardingMethod.errorText}
- onChange={() => onDataChanged({onboardingMethod:'Manual'},SP_CREATION_FORM_NAME)}
+ onChange={() => onDataChanged({onboardingMethod: onboardingMethodConst.MANUAL},SP_CREATION_FORM_NAME)}
type='radio'
data-test-id='new-vsp-creation-procedure-manual' />
</GridItem>
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPage.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPage.js
index 8806ffd0bf..a13e742006 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPage.js
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPage.js
@@ -53,7 +53,7 @@ export const mapStateToProps = ({softwareProduct, licenseModel: {licenseAgreemen
fullCategoryDisplayName
},
isReadOnlyMode,
- componentsList,
+ componentsList,
isManual: currentSoftwareProduct.onboardingMethod === onboardingMethod.MANUAL
};
};
@@ -65,7 +65,6 @@ const mapActionsToProps = (dispatch, {version}) => {
licenseModelId,
version
}),
- onAttachmentsSelect: ({id: softwareProductId}) => OnboardingActionHelper.navigateToSoftwareProductAttachments(dispatch, {softwareProductId, version}),
onUpload: (softwareProductId, formData) =>
SoftwareProductActionHelper.uploadFile(dispatch, {
softwareProductId,
@@ -98,7 +97,7 @@ const mapActionsToProps = (dispatch, {version}) => {
data: {
title: i18n('Upload Failed'),
confirmationButtonText: i18n('Continue'),
- msg: i18n('no zip file was uploaded or zip file doesn\'t exist')
+ msg: i18n('no zip or csar file was uploaded or expected file doesn\'t exist')
}
}),
onComponentSelect: ({id: softwareProductId, componentId}) => {
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx
index 7ffbeda4dc..72a416473c 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx
@@ -57,7 +57,6 @@ class SoftwareProductLandingPageView extends React.Component {
isReadOnlyMode: React.PropTypes.bool,
componentsList: React.PropTypes.arrayOf(ComponentPropType),
onDetailsSelect: React.PropTypes.func,
- onAttachmentsSelect: React.PropTypes.func,
onUpload: React.PropTypes.func,
onUploadConfirmation: React.PropTypes.func,
onInvalidFileSizeUpload: React.PropTypes.func,
@@ -78,15 +77,13 @@ class SoftwareProductLandingPageView extends React.Component {
disableClick={true}
ref='fileInput'
name='fileInput'
- accept='.zip'
+ accept='.zip, .csar'
disabled>
<div className='draggable-wrapper'>
<div className='software-product-landing-view-top'>
<div className='row'>
<ProductSummary currentSoftwareProduct={currentSoftwareProduct} onDetailsSelect={onDetailsSelect} />
- {isManual ?
- <div className='details-panel'/>
- : this.renderProductDetails(currentSoftwareProduct, isReadOnlyMode)}
+ {this.renderProductDetails(isManual, isReadOnlyMode)}
</div>
</div>
</div>
@@ -106,34 +103,18 @@ class SoftwareProductLandingPageView extends React.Component {
}
}
- renderProductDetails(currentSoftwareProduct, isReadOnlyMode) {
- let {validationData} = currentSoftwareProduct;
- let {onAttachmentsSelect} = this.props;
- let details = {
- heatTemplates: validationData ? '1' : '0',
- images: '0',
- otherArtifacts: '0'
- };
-
+ renderProductDetails(isManual, isReadOnlyMode) {
return (
<div className='details-panel'>
- <div className='software-product-landing-view-heading-title'>{i18n('Software Product Attachments')}</div>
- <div className='software-product-landing-view-top-block'>
- <div
- className='software-product-landing-view-top-block-col'
- onClick={() => onAttachmentsSelect(currentSoftwareProduct)}>
- <div>
- <div className='attachment-details'>{i18n('HEAT Templates')} (<span
- className='attachment-details-count'>{details.heatTemplates}</span>)
- </div>
- </div>
+ { !isManual && <div>
+ <div className='software-product-landing-view-heading-title'>{i18n('Software Product Attachments')}</div>
+ <DraggableUploadFileBox
+ dataTestId='upload-btn'
+ isReadOnlyMode={isReadOnlyMode}
+ className={classnames('software-product-landing-view-top-block-col-upl', {'disabled': isReadOnlyMode})}
+ onClick={() => this.refs.fileInput.open()}/>
</div>
- <DraggableUploadFileBox
- dataTestId='upload-btn'
- isReadOnlyMode={isReadOnlyMode}
- className={classnames('software-product-landing-view-top-block-col-upl', {'disabled': isReadOnlyMode})}
- onClick={() => this.refs.fileInput.open()}/>
- </div>
+ }
</div>
);
}
diff --git a/openecomp-ui/test/softwareProduct/attachments/SoftwareProductAttachmentsView.test.js b/openecomp-ui/test/softwareProduct/attachments/SoftwareProductAttachmentsView.test.js
index 5dfe98f273..355a3162b1 100644
--- a/openecomp-ui/test/softwareProduct/attachments/SoftwareProductAttachmentsView.test.js
+++ b/openecomp-ui/test/softwareProduct/attachments/SoftwareProductAttachmentsView.test.js
@@ -36,13 +36,13 @@ describe('SoftwareProduct Attachments - View: ', function () {
let versionControllerData = VersionControllerUtilsFactory.build();
let softwareProductAttachments = {
+ attachmentsDetails: {activeTab: tabsMapping.SETUP},
heatSetup: {},
heatValidation: {
attachmentsTree,
errorList
},
- heatSetupCache: {},
- activeTab: tabsMapping.SETUP
+ heatSetupCache: {}
};
let data = defaultStoreFactory.build({softwareProduct: {softwareProductAttachments, softwareProductEditor: {data: {...versionControllerData}}}});
var result = mapStateToProps(data);
@@ -57,6 +57,7 @@ describe('SoftwareProduct Attachments - View: ', function () {
let versionControllerData = VersionControllerUtilsFactory.build();
let softwareProductAttachments = {
+ attachmentsDetails: {},
heatSetup: {},
heatValidation: {
attachmentsTree,